@wordpress/components 19.8.4 → 19.11.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 (630) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/CONTRIBUTING.md +80 -7
  3. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +11 -11
  4. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  5. package/build/border-box-control/border-box-control/component.js +22 -7
  6. package/build/border-box-control/border-box-control/component.js.map +1 -1
  7. package/build/border-box-control/border-box-control-linked-button/hook.js +3 -2
  8. package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  9. package/build/border-box-control/border-box-control-split-controls/component.js +21 -8
  10. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  11. package/build/border-box-control/border-box-control-visualizer/hook.js +3 -2
  12. package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  13. package/build/border-box-control/styles.js +11 -15
  14. package/build/border-box-control/styles.js.map +1 -1
  15. package/build/border-control/border-control/component.js +5 -3
  16. package/build/border-control/border-control/component.js.map +1 -1
  17. package/build/border-control/border-control/hook.js +6 -3
  18. package/build/border-control/border-control/hook.js.map +1 -1
  19. package/build/border-control/border-control-dropdown/component.js +6 -2
  20. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  21. package/build/border-control/border-control-dropdown/hook.js +5 -5
  22. package/build/border-control/border-control-dropdown/hook.js.map +1 -1
  23. package/build/border-control/styles.js +58 -29
  24. package/build/border-control/styles.js.map +1 -1
  25. package/build/box-control/index.js +0 -21
  26. package/build/box-control/index.js.map +1 -1
  27. package/build/box-control/utils.js +1 -8
  28. package/build/box-control/utils.js.map +1 -1
  29. package/build/button/index.js +3 -5
  30. package/build/button/index.js.map +1 -1
  31. package/build/button/index.native.js +16 -2
  32. package/build/button/index.native.js.map +1 -1
  33. package/build/button-group/index.js +24 -7
  34. package/build/button-group/index.js.map +1 -1
  35. package/build/{flyout → button-group}/types.js +0 -0
  36. package/build/button-group/types.js.map +1 -0
  37. package/build/checkbox-control/index.js +34 -7
  38. package/build/checkbox-control/index.js.map +1 -1
  39. package/build/checkbox-control/types.js +6 -0
  40. package/build/checkbox-control/types.js.map +1 -0
  41. package/build/circular-option-picker/index.js +1 -2
  42. package/build/circular-option-picker/index.js.map +1 -1
  43. package/build/color-palette/index.js +5 -12
  44. package/build/color-palette/index.js.map +1 -1
  45. package/build/date-time/date.js +43 -19
  46. package/build/date-time/date.js.map +1 -1
  47. package/build/date-time/index.js +28 -3
  48. package/build/date-time/index.js.map +1 -1
  49. package/build/date-time/time.js +42 -40
  50. package/build/date-time/time.js.map +1 -1
  51. package/build/date-time/timezone.js +4 -3
  52. package/build/date-time/timezone.js.map +1 -1
  53. package/build/date-time/types.js +6 -0
  54. package/build/date-time/types.js.map +1 -0
  55. package/build/date-time/utils.js +6 -4
  56. package/build/date-time/utils.js.map +1 -1
  57. package/build/disabled/index.js +4 -76
  58. package/build/disabled/index.js.map +1 -1
  59. package/build/draggable/index.native.js +223 -0
  60. package/build/draggable/index.native.js.map +1 -0
  61. package/build/dropdown/index.js +7 -5
  62. package/build/dropdown/index.js.map +1 -1
  63. package/build/focal-point-picker/index.native.js +3 -3
  64. package/build/focal-point-picker/index.native.js.map +1 -1
  65. package/build/heading/hook.js +1 -1
  66. package/build/heading/hook.js.map +1 -1
  67. package/build/index.js +0 -8
  68. package/build/index.js.map +1 -1
  69. package/build/index.native.js +16 -0
  70. package/build/index.native.js.map +1 -1
  71. package/build/input-control/index.js +27 -4
  72. package/build/input-control/index.js.map +1 -1
  73. package/build/input-control/styles/input-control-styles.js +42 -30
  74. package/build/input-control/styles/input-control-styles.js.map +1 -1
  75. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  76. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  77. package/build/mobile/bottom-sheet/index.native.js +1 -1
  78. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  79. package/build/mobile/bottom-sheet-select-control/index.native.js +4 -2
  80. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  81. package/build/mobile/html-text-input/index.native.js +19 -8
  82. package/build/mobile/html-text-input/index.native.js.map +1 -1
  83. package/build/mobile/keyboard-aware-flat-list/index.android.js +28 -5
  84. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  85. package/build/mobile/keyboard-aware-flat-list/index.ios.js +47 -24
  86. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  87. package/build/navigation/styles/navigation-styles.js +12 -12
  88. package/build/navigation/styles/navigation-styles.js.map +1 -1
  89. package/build/notice/index.native.js +44 -40
  90. package/build/notice/index.native.js.map +1 -1
  91. package/build/notice/list.native.js +27 -45
  92. package/build/notice/list.native.js.map +1 -1
  93. package/build/palette-edit/index.js +38 -7
  94. package/build/palette-edit/index.js.map +1 -1
  95. package/build/popover/index.js +223 -323
  96. package/build/popover/index.js.map +1 -1
  97. package/build/resizable-box/resize-tooltip/utils.js +5 -8
  98. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  99. package/build/sandbox/index.js +2 -2
  100. package/build/sandbox/index.js.map +1 -1
  101. package/build/sandbox/index.native.js +1 -1
  102. package/build/sandbox/index.native.js.map +1 -1
  103. package/build/select-control/index.js +31 -4
  104. package/build/select-control/index.js.map +1 -1
  105. package/build/select-control/styles/select-control-styles.js +17 -14
  106. package/build/select-control/styles/select-control-styles.js.map +1 -1
  107. package/build/surface/styles.js +8 -8
  108. package/build/surface/styles.js.map +1 -1
  109. package/build/text/hook.js +5 -5
  110. package/build/text/hook.js.map +1 -1
  111. package/build/text/styles/text-mixins.native.js +1 -1
  112. package/build/text/styles/text-mixins.native.js.map +1 -1
  113. package/build/text/styles.js +7 -7
  114. package/build/text/styles.js.map +1 -1
  115. package/build/text-control/index.js +35 -28
  116. package/build/text-control/index.js.map +1 -1
  117. package/build/text-control/types.js +6 -0
  118. package/build/text-control/types.js.map +1 -0
  119. package/build/toggle-group-control/toggle-group-control/component.js +1 -3
  120. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  121. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +6 -4
  122. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  123. package/build/tools-panel/tools-panel-header/component.js +52 -36
  124. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  125. package/build/tooltip/index.js +2 -2
  126. package/build/tooltip/index.js.map +1 -1
  127. package/build/ui/spinner/component.js +1 -1
  128. package/build/ui/spinner/component.js.map +1 -1
  129. package/build/unit-control/index.js +3 -3
  130. package/build/unit-control/index.js.map +1 -1
  131. package/build/unit-control/styles/unit-control-styles.js +11 -20
  132. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  133. package/build/unit-control/utils.js.map +1 -1
  134. package/build/utils/colors-values.js +9 -24
  135. package/build/utils/colors-values.js.map +1 -1
  136. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +11 -11
  137. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  138. package/build-module/border-box-control/border-box-control/component.js +22 -7
  139. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  140. package/build-module/border-box-control/border-box-control-linked-button/hook.js +3 -2
  141. package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
  142. package/build-module/border-box-control/border-box-control-split-controls/component.js +21 -8
  143. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  144. package/build-module/border-box-control/border-box-control-visualizer/hook.js +3 -2
  145. package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  146. package/build-module/border-box-control/styles.js +9 -15
  147. package/build-module/border-box-control/styles.js.map +1 -1
  148. package/build-module/border-control/border-control/component.js +5 -3
  149. package/build-module/border-control/border-control/component.js.map +1 -1
  150. package/build-module/border-control/border-control/hook.js +6 -3
  151. package/build-module/border-control/border-control/hook.js.map +1 -1
  152. package/build-module/border-control/border-control-dropdown/component.js +6 -2
  153. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  154. package/build-module/border-control/border-control-dropdown/hook.js +5 -5
  155. package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
  156. package/build-module/border-control/styles.js +56 -29
  157. package/build-module/border-control/styles.js.map +1 -1
  158. package/build-module/box-control/index.js +1 -20
  159. package/build-module/box-control/index.js.map +1 -1
  160. package/build-module/box-control/utils.js +0 -6
  161. package/build-module/box-control/utils.js.map +1 -1
  162. package/build-module/button/index.js +3 -4
  163. package/build-module/button/index.js.map +1 -1
  164. package/build-module/button/index.native.js +16 -3
  165. package/build-module/button/index.native.js.map +1 -1
  166. package/build-module/button-group/index.js +27 -7
  167. package/build-module/button-group/index.js.map +1 -1
  168. package/build-module/{flyout → button-group}/types.js +0 -0
  169. package/build-module/{flyout → button-group}/types.js.map +0 -0
  170. package/build-module/checkbox-control/index.js +31 -7
  171. package/build-module/checkbox-control/index.js.map +1 -1
  172. package/build-module/checkbox-control/types.js +2 -0
  173. package/{build/flyout → build-module/checkbox-control}/types.js.map +0 -0
  174. package/build-module/circular-option-picker/index.js +1 -2
  175. package/build-module/circular-option-picker/index.js.map +1 -1
  176. package/build-module/color-palette/index.js +5 -11
  177. package/build-module/color-palette/index.js.map +1 -1
  178. package/build-module/date-time/date.js +44 -19
  179. package/build-module/date-time/date.js.map +1 -1
  180. package/build-module/date-time/index.js +28 -4
  181. package/build-module/date-time/index.js.map +1 -1
  182. package/build-module/date-time/time.js +43 -41
  183. package/build-module/date-time/time.js.map +1 -1
  184. package/build-module/date-time/timezone.js +4 -3
  185. package/build-module/date-time/timezone.js.map +1 -1
  186. package/build-module/date-time/types.js +2 -0
  187. package/build-module/date-time/types.js.map +1 -0
  188. package/build-module/date-time/utils.js +6 -4
  189. package/build-module/date-time/utils.js.map +1 -1
  190. package/build-module/disabled/index.js +5 -76
  191. package/build-module/disabled/index.js.map +1 -1
  192. package/build-module/draggable/index.native.js +206 -0
  193. package/build-module/draggable/index.native.js.map +1 -0
  194. package/build-module/dropdown/index.js +7 -5
  195. package/build-module/dropdown/index.js.map +1 -1
  196. package/build-module/focal-point-picker/index.native.js +3 -3
  197. package/build-module/focal-point-picker/index.native.js.map +1 -1
  198. package/build-module/heading/hook.js +1 -1
  199. package/build-module/heading/hook.js.map +1 -1
  200. package/build-module/index.js +0 -1
  201. package/build-module/index.js.map +1 -1
  202. package/build-module/index.native.js +2 -1
  203. package/build-module/index.native.js.map +1 -1
  204. package/build-module/input-control/index.js +24 -3
  205. package/build-module/input-control/index.js.map +1 -1
  206. package/build-module/input-control/styles/input-control-styles.js +42 -30
  207. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  208. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  209. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  210. package/build-module/mobile/bottom-sheet/index.native.js +1 -1
  211. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  212. package/build-module/mobile/bottom-sheet-select-control/index.native.js +4 -2
  213. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  214. package/build-module/mobile/html-text-input/index.native.js +20 -9
  215. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  216. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +21 -5
  217. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  218. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +42 -25
  219. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  220. package/build-module/navigation/styles/navigation-styles.js +13 -13
  221. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  222. package/build-module/notice/index.native.js +45 -41
  223. package/build-module/notice/index.native.js.map +1 -1
  224. package/build-module/notice/list.native.js +28 -46
  225. package/build-module/notice/list.native.js.map +1 -1
  226. package/build-module/palette-edit/index.js +37 -7
  227. package/build-module/palette-edit/index.js.map +1 -1
  228. package/build-module/popover/index.js +225 -325
  229. package/build-module/popover/index.js.map +1 -1
  230. package/build-module/resizable-box/resize-tooltip/utils.js +4 -5
  231. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  232. package/build-module/sandbox/index.js +2 -2
  233. package/build-module/sandbox/index.js.map +1 -1
  234. package/build-module/sandbox/index.native.js +1 -1
  235. package/build-module/sandbox/index.native.js.map +1 -1
  236. package/build-module/select-control/index.js +29 -3
  237. package/build-module/select-control/index.js.map +1 -1
  238. package/build-module/select-control/styles/select-control-styles.js +17 -14
  239. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  240. package/build-module/surface/styles.js +8 -8
  241. package/build-module/surface/styles.js.map +1 -1
  242. package/build-module/text/hook.js +5 -5
  243. package/build-module/text/hook.js.map +1 -1
  244. package/build-module/text/styles/text-mixins.native.js +2 -2
  245. package/build-module/text/styles/text-mixins.native.js.map +1 -1
  246. package/build-module/text/styles.js +7 -7
  247. package/build-module/text/styles.js.map +1 -1
  248. package/build-module/text-control/index.js +35 -27
  249. package/build-module/text-control/index.js.map +1 -1
  250. package/build-module/text-control/types.js +2 -0
  251. package/build-module/text-control/types.js.map +1 -0
  252. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -3
  253. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  254. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -5
  255. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  256. package/build-module/tools-panel/tools-panel-header/component.js +51 -36
  257. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  258. package/build-module/tooltip/index.js +2 -2
  259. package/build-module/tooltip/index.js.map +1 -1
  260. package/build-module/ui/spinner/component.js +1 -1
  261. package/build-module/ui/spinner/component.js.map +1 -1
  262. package/build-module/unit-control/index.js +3 -3
  263. package/build-module/unit-control/index.js.map +1 -1
  264. package/build-module/unit-control/styles/unit-control-styles.js +11 -20
  265. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  266. package/build-module/unit-control/utils.js.map +1 -1
  267. package/build-module/utils/colors-values.js +19 -23
  268. package/build-module/utils/colors-values.js.map +1 -1
  269. package/build-style/style-rtl.css +55 -170
  270. package/build-style/style.css +51 -170
  271. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  272. package/build-types/border-box-control/border-box-control/hook.d.ts +3 -1
  273. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  274. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  275. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  276. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +3 -1
  277. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  278. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  279. package/build-types/border-box-control/styles.d.ts +2 -2
  280. package/build-types/border-box-control/styles.d.ts.map +1 -1
  281. package/build-types/border-box-control/types.d.ts +40 -13
  282. package/build-types/border-box-control/types.d.ts.map +1 -1
  283. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  284. package/build-types/border-control/border-control/hook.d.ts +2 -1
  285. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  286. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  287. package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -0
  288. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  289. package/build-types/border-control/styles.d.ts +2 -1
  290. package/build-types/border-control/styles.d.ts.map +1 -1
  291. package/build-types/border-control/types.d.ts +18 -6
  292. package/build-types/border-control/types.d.ts.map +1 -1
  293. package/build-types/button/index.d.ts.map +1 -1
  294. package/build-types/button-group/index.d.ts +25 -0
  295. package/build-types/button-group/index.d.ts.map +1 -0
  296. package/build-types/button-group/stories/index.d.ts +12 -0
  297. package/build-types/button-group/stories/index.d.ts.map +1 -0
  298. package/build-types/button-group/types.d.ts +11 -0
  299. package/build-types/button-group/types.d.ts.map +1 -0
  300. package/build-types/checkbox-control/index.d.ts +26 -0
  301. package/build-types/checkbox-control/index.d.ts.map +1 -0
  302. package/build-types/checkbox-control/stories/index.d.ts +13 -0
  303. package/build-types/checkbox-control/stories/index.d.ts.map +1 -0
  304. package/build-types/checkbox-control/types.d.ts +35 -0
  305. package/build-types/checkbox-control/types.d.ts.map +1 -0
  306. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  307. package/build-types/color-palette/index.d.ts.map +1 -1
  308. package/build-types/color-picker/styles.d.ts +3 -3
  309. package/build-types/date-time/date.d.ts +24 -0
  310. package/build-types/date-time/date.d.ts.map +1 -0
  311. package/build-types/date-time/index.d.ts +35 -0
  312. package/build-types/date-time/index.d.ts.map +1 -0
  313. package/build-types/date-time/stories/date.d.ts +14 -0
  314. package/build-types/date-time/stories/date.d.ts.map +1 -0
  315. package/build-types/date-time/stories/index.d.ts +14 -0
  316. package/build-types/date-time/stories/index.d.ts.map +1 -0
  317. package/build-types/date-time/stories/time.d.ts +12 -0
  318. package/build-types/date-time/stories/time.d.ts.map +1 -0
  319. package/build-types/date-time/stories/utils.d.ts +3 -0
  320. package/build-types/date-time/stories/utils.d.ts.map +1 -0
  321. package/build-types/date-time/test/date.d.ts +2 -0
  322. package/build-types/date-time/test/date.d.ts.map +1 -0
  323. package/build-types/date-time/test/time.d.ts +2 -0
  324. package/build-types/date-time/test/time.d.ts.map +1 -0
  325. package/build-types/date-time/test/utils.d.ts +2 -0
  326. package/build-types/date-time/test/utils.d.ts.map +1 -0
  327. package/build-types/date-time/time.d.ts +25 -0
  328. package/build-types/date-time/time.d.ts.map +1 -0
  329. package/build-types/date-time/timezone.d.ts +8 -0
  330. package/build-types/date-time/timezone.d.ts.map +1 -0
  331. package/build-types/date-time/types.d.ts +91 -0
  332. package/build-types/date-time/types.d.ts.map +1 -0
  333. package/build-types/date-time/utils.d.ts +15 -0
  334. package/build-types/date-time/utils.d.ts.map +1 -0
  335. package/build-types/disabled/index.d.ts.map +1 -1
  336. package/build-types/dropdown/index.d.ts.map +1 -1
  337. package/build-types/input-control/index.d.ts +23 -3
  338. package/build-types/input-control/index.d.ts.map +1 -1
  339. package/build-types/input-control/input-field.d.ts +1 -1
  340. package/build-types/input-control/input-field.d.ts.map +1 -1
  341. package/build-types/input-control/stories/index.d.ts +5 -5
  342. package/build-types/input-control/stories/index.d.ts.map +1 -1
  343. package/build-types/input-control/styles/input-control-styles.d.ts +1 -0
  344. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  345. package/build-types/input-control/types.d.ts +79 -3
  346. package/build-types/input-control/types.d.ts.map +1 -1
  347. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  348. package/build-types/popover/index.d.ts +5 -8
  349. package/build-types/popover/index.d.ts.map +1 -1
  350. package/build-types/resizable-box/index.d.ts +1 -1
  351. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  352. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  353. package/build-types/select-control/index.d.ts +30 -26
  354. package/build-types/select-control/index.d.ts.map +1 -1
  355. package/build-types/select-control/stories/index.d.ts +23 -0
  356. package/build-types/select-control/stories/index.d.ts.map +1 -0
  357. package/build-types/select-control/styles/select-control-styles.d.ts +3 -4
  358. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  359. package/build-types/select-control/test/select-control.d.ts +2 -0
  360. package/build-types/select-control/test/select-control.d.ts.map +1 -0
  361. package/build-types/select-control/types.d.ts +52 -1
  362. package/build-types/select-control/types.d.ts.map +1 -1
  363. package/build-types/text-control/index.d.ts +2 -2
  364. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  365. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  366. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  367. package/build-types/tools-panel/types.d.ts +0 -1
  368. package/build-types/tools-panel/types.d.ts.map +1 -1
  369. package/build-types/tooltip/index.d.ts.map +1 -1
  370. package/build-types/unit-control/index.d.ts +2 -2
  371. package/build-types/unit-control/index.d.ts.map +1 -1
  372. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  373. package/build-types/unit-control/test/index.d.ts +2 -0
  374. package/build-types/unit-control/test/index.d.ts.map +1 -0
  375. package/build-types/unit-control/test/utils.d.ts +2 -0
  376. package/build-types/unit-control/test/utils.d.ts.map +1 -0
  377. package/build-types/unit-control/types.d.ts +1 -1
  378. package/build-types/unit-control/types.d.ts.map +1 -1
  379. package/build-types/unit-control/utils.d.ts +3 -3
  380. package/build-types/unit-control/utils.d.ts.map +1 -1
  381. package/build-types/utils/colors-values.d.ts +6 -146
  382. package/build-types/utils/colors-values.d.ts.map +1 -1
  383. package/package.json +19 -19
  384. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +5 -3
  385. package/src/autocomplete/style.scss +1 -1
  386. package/src/border-box-control/border-box-control/README.md +10 -14
  387. package/src/border-box-control/border-box-control/component.tsx +21 -4
  388. package/src/border-box-control/border-box-control-linked-button/hook.ts +10 -6
  389. package/src/border-box-control/border-box-control-split-controls/component.tsx +24 -7
  390. package/src/border-box-control/border-box-control-visualizer/hook.ts +11 -6
  391. package/src/border-box-control/stories/index.js +1 -0
  392. package/src/border-box-control/styles.ts +15 -8
  393. package/src/border-box-control/types.ts +40 -14
  394. package/src/border-control/border-control/README.md +0 -7
  395. package/src/border-control/border-control/component.tsx +4 -2
  396. package/src/border-control/border-control/hook.ts +5 -2
  397. package/src/border-control/border-control-dropdown/component.tsx +18 -11
  398. package/src/border-control/border-control-dropdown/hook.ts +7 -5
  399. package/src/border-control/stories/index.js +1 -0
  400. package/src/border-control/styles.ts +82 -22
  401. package/src/border-control/types.ts +18 -6
  402. package/src/box-control/README.md +0 -74
  403. package/src/box-control/index.js +0 -15
  404. package/src/box-control/stories/index.js +0 -29
  405. package/src/box-control/utils.js +0 -7
  406. package/src/button/index.js +2 -4
  407. package/src/button/index.native.js +33 -18
  408. package/src/button/test/index.js +16 -1
  409. package/src/button-group/index.tsx +47 -0
  410. package/src/button-group/stories/index.tsx +41 -0
  411. package/src/button-group/types.ts +11 -0
  412. package/src/checkbox-control/README.md +10 -8
  413. package/src/checkbox-control/{index.js → index.tsx} +49 -14
  414. package/src/checkbox-control/stories/{index.js → index.tsx} +49 -27
  415. package/src/checkbox-control/types.ts +36 -0
  416. package/src/circular-option-picker/index.js +1 -2
  417. package/src/circular-option-picker/style.scss +1 -0
  418. package/src/color-palette/README.md +0 -1
  419. package/src/color-palette/index.js +6 -13
  420. package/src/color-palette/style.scss +3 -18
  421. package/src/color-palette/test/__snapshots__/index.js.snap +2 -3
  422. package/src/confirm-dialog/stories/index.js +87 -99
  423. package/src/date-time/README.md +13 -10
  424. package/src/date-time/{date.js → date.tsx} +49 -20
  425. package/src/date-time/{index.js → index.tsx} +31 -5
  426. package/src/date-time/stories/date.tsx +73 -0
  427. package/src/date-time/stories/index.tsx +75 -0
  428. package/src/date-time/stories/time.tsx +51 -0
  429. package/src/date-time/stories/utils.ts +9 -0
  430. package/src/date-time/test/date.tsx +127 -0
  431. package/src/date-time/test/{time.js → time.tsx} +34 -19
  432. package/src/date-time/test/{utils.js → utils.ts} +1 -1
  433. package/src/date-time/{time.js → time.tsx} +57 -46
  434. package/src/date-time/{timezone.js → timezone.tsx} +4 -3
  435. package/src/date-time/types.ts +106 -0
  436. package/src/date-time/utils.ts +20 -0
  437. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  438. package/src/disabled/index.js +5 -90
  439. package/src/draggable/index.native.js +215 -0
  440. package/src/draggable/style.native.scss +3 -0
  441. package/src/dropdown/index.js +9 -4
  442. package/src/dropdown/style.scss +1 -1
  443. package/src/focal-point-picker/index.native.js +3 -3
  444. package/src/form-file-upload/test/index.js +20 -13
  445. package/src/heading/hook.ts +1 -1
  446. package/src/heading/test/__snapshots__/index.js.snap +3 -3
  447. package/src/index.js +0 -1
  448. package/src/index.native.js +1 -0
  449. package/src/input-control/README.md +3 -3
  450. package/src/input-control/index.tsx +23 -3
  451. package/src/input-control/stories/index.tsx +63 -0
  452. package/src/input-control/styles/input-control-styles.tsx +20 -7
  453. package/src/input-control/types.ts +79 -2
  454. package/src/item-group/stories/index.js +22 -18
  455. package/src/menu-item/style.scss +10 -0
  456. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  457. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +9 -2
  458. package/src/mobile/bottom-sheet/index.native.js +1 -1
  459. package/src/mobile/bottom-sheet-select-control/index.native.js +8 -2
  460. package/src/mobile/html-text-input/index.native.js +45 -29
  461. package/src/mobile/html-text-input/style.android.scss +2 -15
  462. package/src/mobile/html-text-input/style.ios.scss +2 -15
  463. package/src/mobile/html-text-input/{style-common.native.scss → style.scss} +16 -0
  464. package/src/mobile/keyboard-aware-flat-list/index.android.js +15 -5
  465. package/src/mobile/keyboard-aware-flat-list/index.ios.js +75 -46
  466. package/src/mobile/link-settings/test/link-settings-navigation.native.js +9 -1
  467. package/src/navigation/styles/navigation-styles.js +5 -5
  468. package/src/navigator/stories/index.js +16 -10
  469. package/src/notice/index.native.js +44 -54
  470. package/src/notice/list.native.js +27 -51
  471. package/src/notice/style.native.scss +1 -0
  472. package/src/palette-edit/index.js +37 -9
  473. package/src/palette-edit/style.scss +0 -7
  474. package/src/palette-edit/test/index.js +63 -0
  475. package/src/panel/README.md +1 -1
  476. package/src/placeholder/test/index.js +7 -0
  477. package/src/popover/README.md +7 -9
  478. package/src/popover/index.js +242 -417
  479. package/src/popover/style.scss +20 -190
  480. package/src/popover/test/__snapshots__/index.js.snap +6 -18
  481. package/src/query-controls/README.md +2 -2
  482. package/src/resizable-box/resize-tooltip/utils.ts +4 -5
  483. package/src/sandbox/index.js +2 -2
  484. package/src/sandbox/index.native.js +1 -1
  485. package/src/select-control/README.md +2 -2
  486. package/src/select-control/index.tsx +30 -29
  487. package/src/select-control/stories/index.tsx +90 -0
  488. package/src/select-control/styles/select-control-styles.ts +16 -12
  489. package/src/select-control/test/{select-control.js → select-control.tsx} +2 -2
  490. package/src/select-control/types.ts +66 -1
  491. package/src/surface/styles.js +1 -1
  492. package/src/tab-panel/style.scss +1 -1
  493. package/src/text/hook.js +1 -1
  494. package/src/text/styles/text-mixins.native.js +2 -2
  495. package/src/text/styles.js +1 -1
  496. package/src/text/test/__snapshots__/{index.js.snap → index.tsx.snap} +16 -0
  497. package/src/text/test/{index.js → index.tsx} +12 -6
  498. package/src/text-control/index.tsx +84 -0
  499. package/src/text-control/stories/index.tsx +66 -0
  500. package/src/text-control/types.ts +29 -0
  501. package/src/toggle-group-control/test/__snapshots__/index.js.snap +4 -10
  502. package/src/toggle-group-control/toggle-group-control/component.tsx +7 -3
  503. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -5
  504. package/src/toolbar-group/style.scss +20 -0
  505. package/src/tools-panel/test/__snapshots__/index.js.snap +2 -2
  506. package/src/tools-panel/test/index.js +71 -18
  507. package/src/tools-panel/tools-panel-header/component.tsx +75 -33
  508. package/src/tools-panel/types.ts +0 -1
  509. package/src/tooltip/index.js +8 -2
  510. package/src/tooltip/style.scss +2 -4
  511. package/src/tooltip/test/index.js +6 -0
  512. package/src/tooltip/test/index.native.js +1 -1
  513. package/src/ui/spinner/component.js +1 -1
  514. package/src/ui/spinner/test/__snapshots__/index.js.snap +3 -3
  515. package/src/unit-control/index.tsx +2 -5
  516. package/src/unit-control/styles/unit-control-styles.ts +3 -13
  517. package/src/unit-control/test/__snapshots__/index.tsx.snap +33 -0
  518. package/src/unit-control/test/{index.js → index.tsx} +295 -166
  519. package/src/unit-control/test/{utils.js → utils.ts} +38 -19
  520. package/src/unit-control/types.ts +4 -1
  521. package/src/unit-control/utils.ts +5 -3
  522. package/src/utils/colors-values.js +18 -22
  523. package/tsconfig.json +14 -3
  524. package/tsconfig.tsbuildinfo +1 -1
  525. package/build/box-control/visualizer.js +0 -165
  526. package/build/box-control/visualizer.js.map +0 -1
  527. package/build/flyout/context.js +0 -23
  528. package/build/flyout/context.js.map +0 -1
  529. package/build/flyout/flyout/component.js +0 -106
  530. package/build/flyout/flyout/component.js.map +0 -1
  531. package/build/flyout/flyout/hook.js +0 -53
  532. package/build/flyout/flyout/hook.js.map +0 -1
  533. package/build/flyout/flyout/index.js +0 -24
  534. package/build/flyout/flyout/index.js.map +0 -1
  535. package/build/flyout/flyout-content/component.js +0 -65
  536. package/build/flyout/flyout-content/component.js.map +0 -1
  537. package/build/flyout/flyout-content/index.js +0 -16
  538. package/build/flyout/flyout-content/index.js.map +0 -1
  539. package/build/flyout/index.js +0 -16
  540. package/build/flyout/index.js.map +0 -1
  541. package/build/flyout/styles.js +0 -46
  542. package/build/flyout/styles.js.map +0 -1
  543. package/build/flyout/utils.js +0 -36
  544. package/build/flyout/utils.js.map +0 -1
  545. package/build/mobile/html-text-input/container.android.js +0 -41
  546. package/build/mobile/html-text-input/container.android.js.map +0 -1
  547. package/build/mobile/html-text-input/container.ios.js +0 -60
  548. package/build/mobile/html-text-input/container.ios.js.map +0 -1
  549. package/build/popover/utils.js +0 -322
  550. package/build/popover/utils.js.map +0 -1
  551. package/build-module/box-control/visualizer.js +0 -154
  552. package/build-module/box-control/visualizer.js.map +0 -1
  553. package/build-module/flyout/context.js +0 -11
  554. package/build-module/flyout/context.js.map +0 -1
  555. package/build-module/flyout/flyout/component.js +0 -89
  556. package/build-module/flyout/flyout/component.js.map +0 -1
  557. package/build-module/flyout/flyout/hook.js +0 -44
  558. package/build-module/flyout/flyout/hook.js.map +0 -1
  559. package/build-module/flyout/flyout/index.js +0 -3
  560. package/build-module/flyout/flyout/index.js.map +0 -1
  561. package/build-module/flyout/flyout-content/component.js +0 -51
  562. package/build-module/flyout/flyout-content/component.js.map +0 -1
  563. package/build-module/flyout/flyout-content/index.js +0 -2
  564. package/build-module/flyout/flyout-content/index.js.map +0 -1
  565. package/build-module/flyout/index.js +0 -2
  566. package/build-module/flyout/index.js.map +0 -1
  567. package/build-module/flyout/styles.js +0 -27
  568. package/build-module/flyout/styles.js.map +0 -1
  569. package/build-module/flyout/utils.js +0 -25
  570. package/build-module/flyout/utils.js.map +0 -1
  571. package/build-module/mobile/html-text-input/container.android.js +0 -29
  572. package/build-module/mobile/html-text-input/container.android.js.map +0 -1
  573. package/build-module/mobile/html-text-input/container.ios.js +0 -48
  574. package/build-module/mobile/html-text-input/container.ios.js.map +0 -1
  575. package/build-module/popover/utils.js +0 -308
  576. package/build-module/popover/utils.js.map +0 -1
  577. package/build-types/flyout/context.d.ts +0 -6
  578. package/build-types/flyout/context.d.ts.map +0 -1
  579. package/build-types/flyout/flyout/component.d.ts +0 -21
  580. package/build-types/flyout/flyout/component.d.ts.map +0 -1
  581. package/build-types/flyout/flyout/hook.d.ts +0 -270
  582. package/build-types/flyout/flyout/hook.d.ts.map +0 -1
  583. package/build-types/flyout/flyout/index.d.ts +0 -3
  584. package/build-types/flyout/flyout/index.d.ts.map +0 -1
  585. package/build-types/flyout/flyout-content/component.d.ts +0 -3
  586. package/build-types/flyout/flyout-content/component.d.ts.map +0 -1
  587. package/build-types/flyout/flyout-content/index.d.ts +0 -2
  588. package/build-types/flyout/flyout-content/index.d.ts.map +0 -1
  589. package/build-types/flyout/index.d.ts +0 -2
  590. package/build-types/flyout/index.d.ts.map +0 -1
  591. package/build-types/flyout/styles.d.ts +0 -22
  592. package/build-types/flyout/styles.d.ts.map +0 -1
  593. package/build-types/flyout/types.d.ts +0 -80
  594. package/build-types/flyout/types.d.ts.map +0 -1
  595. package/build-types/flyout/utils.d.ts +0 -8
  596. package/build-types/flyout/utils.d.ts.map +0 -1
  597. package/build-types/popover/utils.d.ts +0 -70
  598. package/build-types/popover/utils.d.ts.map +0 -1
  599. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts +0 -19
  600. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +0 -1
  601. package/src/box-control/visualizer.js +0 -116
  602. package/src/button-group/index.js +0 -17
  603. package/src/button-group/stories/index.js +0 -21
  604. package/src/date-time/stories/date.js +0 -17
  605. package/src/date-time/stories/index.js +0 -72
  606. package/src/date-time/stories/time.js +0 -32
  607. package/src/date-time/test/date.js +0 -97
  608. package/src/date-time/utils.js +0 -18
  609. package/src/flyout/context.js +0 -10
  610. package/src/flyout/flyout/README.md +0 -98
  611. package/src/flyout/flyout/component.js +0 -111
  612. package/src/flyout/flyout/hook.js +0 -45
  613. package/src/flyout/flyout/index.js +0 -2
  614. package/src/flyout/flyout-content/component.js +0 -53
  615. package/src/flyout/flyout-content/index.js +0 -1
  616. package/src/flyout/index.js +0 -1
  617. package/src/flyout/stories/index.js +0 -24
  618. package/src/flyout/styles.ts +0 -41
  619. package/src/flyout/test/__snapshots__/index.js.snap +0 -186
  620. package/src/flyout/test/index.js +0 -103
  621. package/src/flyout/types.ts +0 -84
  622. package/src/flyout/utils.js +0 -23
  623. package/src/input-control/stories/index.js +0 -71
  624. package/src/mobile/html-text-input/container.android.js +0 -23
  625. package/src/mobile/html-text-input/container.ios.js +0 -50
  626. package/src/popover/test/utils.js +0 -304
  627. package/src/popover/utils.js +0 -396
  628. package/src/select-control/stories/index.js +0 -104
  629. package/src/text-control/index.js +0 -72
  630. package/src/text-control/stories/index.js +0 -46
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _element = require("@wordpress/element");
11
-
12
- var _reactNative = require("react-native");
13
-
14
- var _keyboardAvoidingView = _interopRequireDefault(require("../keyboard-avoiding-view"));
15
-
16
- var _styleAndroid = _interopRequireDefault(require("./style.android.scss"));
17
-
18
- /**
19
- * External dependencies
20
- */
21
-
22
- /**
23
- * Internal dependencies
24
- */
25
- const HTMLInputContainer = _ref => {
26
- let {
27
- children,
28
- parentHeight
29
- } = _ref;
30
- return (0, _element.createElement)(_keyboardAvoidingView.default, {
31
- style: _styleAndroid.default.keyboardAvoidingView,
32
- parentHeight: parentHeight
33
- }, (0, _element.createElement)(_reactNative.ScrollView, {
34
- style: _styleAndroid.default.scrollView
35
- }, children));
36
- };
37
-
38
- HTMLInputContainer.scrollEnabled = false;
39
- var _default = HTMLInputContainer;
40
- exports.default = _default;
41
- //# sourceMappingURL=container.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/mobile/html-text-input/container.android.js"],"names":["HTMLInputContainer","children","parentHeight","styles","keyboardAvoidingView","scrollView","scrollEnabled"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,kBAAkB,GAAG;AAAA,MAAE;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAF;AAAA,SAC1B,4BAAC,6BAAD;AACC,IAAA,KAAK,EAAGC,sBAAOC,oBADhB;AAEC,IAAA,YAAY,EAAGF;AAFhB,KAIC,4BAAC,uBAAD;AAAY,IAAA,KAAK,EAAGC,sBAAOE;AAA3B,KAA0CJ,QAA1C,CAJD,CAD0B;AAAA,CAA3B;;AASAD,kBAAkB,CAACM,aAAnB,GAAmC,KAAnC;eAEeN,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView } from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport KeyboardAvoidingView from '../keyboard-avoiding-view';\nimport styles from './style.android.scss';\n\nconst HTMLInputContainer = ( { children, parentHeight } ) => (\n\t<KeyboardAvoidingView\n\t\tstyle={ styles.keyboardAvoidingView }\n\t\tparentHeight={ parentHeight }\n\t>\n\t\t<ScrollView style={ styles.scrollView }>{ children }</ScrollView>\n\t</KeyboardAvoidingView>\n);\n\nHTMLInputContainer.scrollEnabled = false;\n\nexport default HTMLInputContainer;\n"]}
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _element = require("@wordpress/element");
11
-
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
- var _reactNative = require("react-native");
15
-
16
- var _keyboardAvoidingView = _interopRequireDefault(require("../keyboard-avoiding-view"));
17
-
18
- var _styleIos = _interopRequireDefault(require("./style.ios.scss"));
19
-
20
- /**
21
- * External dependencies
22
- */
23
-
24
- /**
25
- * WordPress dependencies
26
- */
27
-
28
- /**
29
- * Internal dependencies
30
- */
31
- class HTMLInputContainer extends _element.Component {
32
- constructor() {
33
- super(...arguments);
34
- this.panResponder = _reactNative.PanResponder.create({
35
- onStartShouldSetPanResponderCapture: () => true,
36
- onPanResponderMove: (e, gestureState) => {
37
- if (gestureState.dy > 100 && gestureState.dy < 110) {
38
- // Keyboard.dismiss() and this.textInput.blur() are not working here
39
- // They require to know the currentlyFocusedID under the hood but
40
- // during this gesture there's no currentlyFocusedID.
41
- _reactNative.UIManager.blur(e.target);
42
- }
43
- }
44
- });
45
- }
46
-
47
- render() {
48
- return (0, _element.createElement)(_keyboardAvoidingView.default, (0, _extends2.default)({
49
- style: _styleIos.default.keyboardAvoidingView
50
- }, this.panResponder.panHandlers, {
51
- parentHeight: this.props.parentHeight
52
- }), this.props.children);
53
- }
54
-
55
- }
56
-
57
- HTMLInputContainer.scrollEnabled = true;
58
- var _default = HTMLInputContainer;
59
- exports.default = _default;
60
- //# sourceMappingURL=container.ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/mobile/html-text-input/container.ios.js"],"names":["HTMLInputContainer","Component","constructor","arguments","panResponder","PanResponder","create","onStartShouldSetPanResponderCapture","onPanResponderMove","e","gestureState","dy","UIManager","blur","target","render","styles","keyboardAvoidingView","panHandlers","props","parentHeight","children","scrollEnabled"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAUA;;AACA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,kBAAN,SAAiCC,kBAAjC,CAA2C;AAC1CC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,YAAL,GAAoBC,0BAAaC,MAAb,CAAqB;AACxCC,MAAAA,mCAAmC,EAAE,MAAM,IADH;AAGxCC,MAAAA,kBAAkB,EAAE,CAAEC,CAAF,EAAKC,YAAL,KAAuB;AAC1C,YAAKA,YAAY,CAACC,EAAb,GAAkB,GAAlB,IAAyBD,YAAY,CAACC,EAAb,GAAkB,GAAhD,EAAsD;AACrD;AACA;AACA;AACAC,iCAAUC,IAAV,CAAgBJ,CAAC,CAACK,MAAlB;AACA;AACD;AAVuC,KAArB,CAApB;AAYA;;AAEDC,EAAAA,MAAM,GAAG;AACR,WACC,4BAAC,6BAAD;AACC,MAAA,KAAK,EAAGC,kBAAOC;AADhB,OAEM,KAAKb,YAAL,CAAkBc,WAFxB;AAGC,MAAA,YAAY,EAAG,KAAKC,KAAL,CAAWC;AAH3B,QAKG,KAAKD,KAAL,CAAWE,QALd,CADD;AASA;;AA5ByC;;AA+B3CrB,kBAAkB,CAACsB,aAAnB,GAAmC,IAAnC;eAEetB,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { UIManager, PanResponder } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport KeyboardAvoidingView from '../keyboard-avoiding-view';\nimport styles from './style.ios.scss';\n\nclass HTMLInputContainer extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.panResponder = PanResponder.create( {\n\t\t\tonStartShouldSetPanResponderCapture: () => true,\n\n\t\t\tonPanResponderMove: ( e, gestureState ) => {\n\t\t\t\tif ( gestureState.dy > 100 && gestureState.dy < 110 ) {\n\t\t\t\t\t// Keyboard.dismiss() and this.textInput.blur() are not working here\n\t\t\t\t\t// They require to know the currentlyFocusedID under the hood but\n\t\t\t\t\t// during this gesture there's no currentlyFocusedID.\n\t\t\t\t\tUIManager.blur( e.target );\n\t\t\t\t}\n\t\t\t},\n\t\t} );\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<KeyboardAvoidingView\n\t\t\t\tstyle={ styles.keyboardAvoidingView }\n\t\t\t\t{ ...this.panResponder.panHandlers }\n\t\t\t\tparentHeight={ this.props.parentHeight }\n\t\t\t>\n\t\t\t\t{ this.props.children }\n\t\t\t</KeyboardAvoidingView>\n\t\t);\n\t}\n}\n\nHTMLInputContainer.scrollEnabled = true;\n\nexport default HTMLInputContainer;\n"]}
@@ -1,322 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.computePopoverPosition = computePopoverPosition;
7
- exports.computePopoverXAxisPosition = computePopoverXAxisPosition;
8
- exports.computePopoverYAxisPosition = computePopoverYAxisPosition;
9
- exports.offsetIframe = offsetIframe;
10
-
11
- var _i18n = require("@wordpress/i18n");
12
-
13
- // @ts-nocheck
14
-
15
- /**
16
- * WordPress dependencies
17
- */
18
-
19
- /**
20
- * Module constants
21
- */
22
- const HEIGHT_OFFSET = 10; // Used by the arrow and a bit of empty space.
23
-
24
- /**
25
- * Utility used to compute the popover position over the xAxis
26
- *
27
- * @param {Object} anchorRect Anchor Rect.
28
- * @param {Object} contentSize Content Size.
29
- * @param {string} xAxis Desired xAxis.
30
- * @param {string} corner Desired corner.
31
- * @param {boolean} stickyBoundaryElement The boundary element to use when
32
- * switching between sticky and normal
33
- * position.
34
- * @param {string} chosenYAxis yAxis to be used.
35
- * @param {Element} boundaryElement Boundary element.
36
- * @param {boolean} forcePosition Don't adjust position based on anchor.
37
- * @param {boolean} forceXAlignment Don't adjust alignment based on YAxis
38
- *
39
- * @return {Object} Popover xAxis position and constraints.
40
- */
41
-
42
- function computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, chosenYAxis, boundaryElement, forcePosition, forceXAlignment) {
43
- const {
44
- width
45
- } = contentSize; // Correct xAxis for RTL support.
46
-
47
- if (xAxis === 'left' && (0, _i18n.isRTL)()) {
48
- xAxis = 'right';
49
- } else if (xAxis === 'right' && (0, _i18n.isRTL)()) {
50
- xAxis = 'left';
51
- }
52
-
53
- if (corner === 'left' && (0, _i18n.isRTL)()) {
54
- corner = 'right';
55
- } else if (corner === 'right' && (0, _i18n.isRTL)()) {
56
- corner = 'left';
57
- } // X axis alignment choices.
58
-
59
-
60
- const anchorMidPoint = Math.round(anchorRect.left + anchorRect.width / 2);
61
- const centerAlignment = {
62
- popoverLeft: anchorMidPoint,
63
- contentWidth: (anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint) + (anchorMidPoint + width / 2 > window.innerWidth ? window.innerWidth - anchorMidPoint : width / 2)
64
- };
65
- let leftAlignmentX = anchorRect.left;
66
-
67
- if (corner === 'right') {
68
- leftAlignmentX = anchorRect.right;
69
- } else if (chosenYAxis !== 'middle' && !forceXAlignment) {
70
- leftAlignmentX = anchorMidPoint;
71
- }
72
-
73
- let rightAlignmentX = anchorRect.right;
74
-
75
- if (corner === 'left') {
76
- rightAlignmentX = anchorRect.left;
77
- } else if (chosenYAxis !== 'middle' && !forceXAlignment) {
78
- rightAlignmentX = anchorMidPoint;
79
- }
80
-
81
- const leftAlignment = {
82
- popoverLeft: leftAlignmentX,
83
- contentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX
84
- };
85
- const rightAlignment = {
86
- popoverLeft: rightAlignmentX,
87
- contentWidth: rightAlignmentX + width > window.innerWidth ? window.innerWidth - rightAlignmentX : width
88
- }; // Choosing the x axis.
89
-
90
- let chosenXAxis = xAxis;
91
- let contentWidth = null;
92
-
93
- if (!stickyBoundaryElement && !forcePosition) {
94
- if (xAxis === 'center' && centerAlignment.contentWidth === width) {
95
- chosenXAxis = 'center';
96
- } else if (xAxis === 'left' && leftAlignment.contentWidth === width) {
97
- chosenXAxis = 'left';
98
- } else if (xAxis === 'right' && rightAlignment.contentWidth === width) {
99
- chosenXAxis = 'right';
100
- } else {
101
- chosenXAxis = leftAlignment.contentWidth > rightAlignment.contentWidth ? 'left' : 'right';
102
- const chosenWidth = chosenXAxis === 'left' ? leftAlignment.contentWidth : rightAlignment.contentWidth; // Limit width of the content to the viewport width
103
-
104
- if (width > window.innerWidth) {
105
- contentWidth = window.innerWidth;
106
- } // If we can't find any alignment options that could fit
107
- // our content, then let's fallback to the center of the viewport.
108
-
109
-
110
- if (chosenWidth !== width) {
111
- chosenXAxis = 'center';
112
- centerAlignment.popoverLeft = window.innerWidth / 2;
113
- }
114
- }
115
- }
116
-
117
- let popoverLeft;
118
-
119
- if (chosenXAxis === 'center') {
120
- popoverLeft = centerAlignment.popoverLeft;
121
- } else if (chosenXAxis === 'left') {
122
- popoverLeft = leftAlignment.popoverLeft;
123
- } else {
124
- popoverLeft = rightAlignment.popoverLeft;
125
- }
126
-
127
- if (boundaryElement) {
128
- popoverLeft = Math.min(popoverLeft, boundaryElement.offsetLeft + boundaryElement.offsetWidth - width); // Avoid the popover being position beyond the left boundary if the
129
- // direction is left to right.
130
-
131
- if (!(0, _i18n.isRTL)()) {
132
- popoverLeft = Math.max(popoverLeft, 0);
133
- }
134
- }
135
-
136
- return {
137
- xAxis: chosenXAxis,
138
- popoverLeft,
139
- contentWidth
140
- };
141
- }
142
- /**
143
- * Utility used to compute the popover position over the yAxis
144
- *
145
- * @param {Object} anchorRect Anchor Rect.
146
- * @param {Object} contentSize Content Size.
147
- * @param {string} yAxis Desired yAxis.
148
- * @param {string} corner Desired corner.
149
- * @param {boolean} stickyBoundaryElement The boundary element to use when switching between sticky
150
- * and normal position.
151
- * @param {Element} anchorRef The anchor element.
152
- * @param {Element} relativeOffsetTop If applicable, top offset of the relative positioned
153
- * parent container.
154
- * @param {boolean} forcePosition Don't adjust position based on anchor.
155
- * @param {Element|null} editorWrapper Element that wraps the editor content. Used to access
156
- * scroll position to determine sticky behavior.
157
- * @return {Object} Popover xAxis position and constraints.
158
- */
159
-
160
-
161
- function computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition, editorWrapper) {
162
- const {
163
- height
164
- } = contentSize;
165
-
166
- if (stickyBoundaryElement) {
167
- const stickyRect = stickyBoundaryElement.getBoundingClientRect();
168
- const stickyPositionTop = stickyRect.top + height - relativeOffsetTop;
169
- const stickyPositionBottom = stickyRect.bottom - height - relativeOffsetTop;
170
-
171
- if (anchorRect.top <= stickyPositionTop) {
172
- if (editorWrapper) {
173
- // If a popover cannot be positioned above the anchor, even after scrolling, we must
174
- // ensure we use the bottom position instead of the popover slot. This prevents the
175
- // popover from always restricting block content and interaction while selected if the
176
- // block is near the top of the site editor.
177
- const isRoomAboveInCanvas = height + HEIGHT_OFFSET < editorWrapper.scrollTop + anchorRect.top;
178
-
179
- if (!isRoomAboveInCanvas) {
180
- return {
181
- yAxis: 'bottom',
182
- // If the bottom of the block is also below the bottom sticky position (ex -
183
- // block is also taller than the editor window), return the bottom sticky
184
- // position instead. We do this instead of the top sticky position both to
185
- // allow a smooth transition and more importantly to ensure every section of
186
- // the block can be free from popover obscuration at some point in the
187
- // scroll position.
188
- popoverTop: Math.min(anchorRect.bottom, stickyPositionBottom)
189
- };
190
- }
191
- } // Default sticky behavior.
192
-
193
-
194
- return {
195
- yAxis,
196
- popoverTop: Math.min(anchorRect.bottom, stickyPositionTop)
197
- };
198
- }
199
- } // Y axis alignment choices.
200
-
201
-
202
- let anchorMidPoint = anchorRect.top + anchorRect.height / 2;
203
-
204
- if (corner === 'bottom') {
205
- anchorMidPoint = anchorRect.bottom;
206
- } else if (corner === 'top') {
207
- anchorMidPoint = anchorRect.top;
208
- }
209
-
210
- const middleAlignment = {
211
- popoverTop: anchorMidPoint,
212
- contentHeight: (anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint) + (anchorMidPoint + height / 2 > window.innerHeight ? window.innerHeight - anchorMidPoint : height / 2)
213
- };
214
- const topAlignment = {
215
- popoverTop: anchorRect.top,
216
- contentHeight: anchorRect.top - HEIGHT_OFFSET - height > 0 ? height : anchorRect.top - HEIGHT_OFFSET
217
- };
218
- const bottomAlignment = {
219
- popoverTop: anchorRect.bottom,
220
- contentHeight: anchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight ? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom : height
221
- }; // Choosing the y axis.
222
-
223
- let chosenYAxis = yAxis;
224
- let contentHeight = null;
225
-
226
- if (!stickyBoundaryElement && !forcePosition) {
227
- if (yAxis === 'middle' && middleAlignment.contentHeight === height) {
228
- chosenYAxis = 'middle';
229
- } else if (yAxis === 'top' && topAlignment.contentHeight === height) {
230
- chosenYAxis = 'top';
231
- } else if (yAxis === 'bottom' && bottomAlignment.contentHeight === height) {
232
- chosenYAxis = 'bottom';
233
- } else {
234
- chosenYAxis = topAlignment.contentHeight > bottomAlignment.contentHeight ? 'top' : 'bottom';
235
- const chosenHeight = chosenYAxis === 'top' ? topAlignment.contentHeight : bottomAlignment.contentHeight;
236
- contentHeight = chosenHeight !== height ? chosenHeight : null;
237
- }
238
- }
239
-
240
- let popoverTop;
241
-
242
- if (chosenYAxis === 'middle') {
243
- popoverTop = middleAlignment.popoverTop;
244
- } else if (chosenYAxis === 'top') {
245
- popoverTop = topAlignment.popoverTop;
246
- } else {
247
- popoverTop = bottomAlignment.popoverTop;
248
- }
249
-
250
- return {
251
- yAxis: chosenYAxis,
252
- popoverTop,
253
- contentHeight
254
- };
255
- }
256
- /**
257
- * Utility used to compute the popover position and the content max width/height for a popover given
258
- * its anchor rect and its content size.
259
- *
260
- * @param {Object} anchorRect Anchor Rect.
261
- * @param {Object} contentSize Content Size.
262
- * @param {string} position Position.
263
- * @param {boolean} stickyBoundaryElement The boundary element to use when switching between
264
- * sticky and normal position.
265
- * @param {Element} anchorRef The anchor element.
266
- * @param {number} relativeOffsetTop If applicable, top offset of the relative positioned
267
- * parent container.
268
- * @param {Element} boundaryElement Boundary element.
269
- * @param {boolean} forcePosition Don't adjust position based on anchor.
270
- * @param {boolean} forceXAlignment Don't adjust alignment based on YAxis
271
- * @param {Element|null} editorWrapper Element that wraps the editor content. Used to access
272
- * scroll position to determine sticky behavior.
273
- * @return {Object} Popover position and constraints.
274
- */
275
-
276
-
277
- function computePopoverPosition(anchorRect, contentSize) {
278
- let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'top';
279
- let stickyBoundaryElement = arguments.length > 3 ? arguments[3] : undefined;
280
- let anchorRef = arguments.length > 4 ? arguments[4] : undefined;
281
- let relativeOffsetTop = arguments.length > 5 ? arguments[5] : undefined;
282
- let boundaryElement = arguments.length > 6 ? arguments[6] : undefined;
283
- let forcePosition = arguments.length > 7 ? arguments[7] : undefined;
284
- let forceXAlignment = arguments.length > 8 ? arguments[8] : undefined;
285
- let editorWrapper = arguments.length > 9 ? arguments[9] : undefined;
286
- const [yAxis, xAxis = 'center', corner] = position.split(' ');
287
- const yAxisPosition = computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition, editorWrapper);
288
- const xAxisPosition = computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, yAxisPosition.yAxis, boundaryElement, forcePosition, forceXAlignment);
289
- return { ...xAxisPosition,
290
- ...yAxisPosition
291
- };
292
- }
293
- /**
294
- * Offsets the given rect by the position of the iframe that contains the
295
- * element. If the owner document is not in an iframe then it returns with the
296
- * original rect. If the popover container document and the anchor document are
297
- * the same, the original rect will also be returned.
298
- *
299
- * @param {DOMRect} rect bounds of the element
300
- * @param {Document} ownerDocument document of the element
301
- * @param {Element} container The popover container to position.
302
- *
303
- * @return {DOMRect} offsetted bounds
304
- */
305
-
306
-
307
- function offsetIframe(rect, ownerDocument, container) {
308
- const {
309
- defaultView
310
- } = ownerDocument;
311
- const {
312
- frameElement
313
- } = defaultView;
314
-
315
- if (!frameElement || ownerDocument === container.ownerDocument) {
316
- return rect;
317
- }
318
-
319
- const iframeRect = frameElement.getBoundingClientRect();
320
- return new defaultView.DOMRect(rect.left + iframeRect.left, rect.top + iframeRect.top, rect.width, rect.height);
321
- }
322
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/utils.js"],"names":["HEIGHT_OFFSET","computePopoverXAxisPosition","anchorRect","contentSize","xAxis","corner","stickyBoundaryElement","chosenYAxis","boundaryElement","forcePosition","forceXAlignment","width","anchorMidPoint","Math","round","left","centerAlignment","popoverLeft","contentWidth","window","innerWidth","leftAlignmentX","right","rightAlignmentX","leftAlignment","rightAlignment","chosenXAxis","chosenWidth","min","offsetLeft","offsetWidth","max","computePopoverYAxisPosition","yAxis","anchorRef","relativeOffsetTop","editorWrapper","height","stickyRect","getBoundingClientRect","stickyPositionTop","top","stickyPositionBottom","bottom","isRoomAboveInCanvas","scrollTop","popoverTop","middleAlignment","contentHeight","innerHeight","topAlignment","bottomAlignment","chosenHeight","computePopoverPosition","position","split","yAxisPosition","xAxisPosition","offsetIframe","rect","ownerDocument","container","defaultView","frameElement","iframeRect","DOMRect"],"mappings":";;;;;;;;;;AAIA;;AAJA;;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA,MAAMA,aAAa,GAAG,EAAtB,C,CAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,2BAAT,CACNC,UADM,EAENC,WAFM,EAGNC,KAHM,EAINC,MAJM,EAKNC,qBALM,EAMNC,WANM,EAONC,eAPM,EAQNC,aARM,EASNC,eATM,EAUL;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAYR,WAAlB,CADC,CAGD;;AACA,MAAKC,KAAK,KAAK,MAAV,IAAoB,kBAAzB,EAAmC;AAClCA,IAAAA,KAAK,GAAG,OAAR;AACA,GAFD,MAEO,IAAKA,KAAK,KAAK,OAAV,IAAqB,kBAA1B,EAAoC;AAC1C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AACvB,KANkC,EAOhDzB,eAPgD,EAQhDC,aARgD,EAShDC,eATgD,CAAjD;AAYA,SAAO,EACN,GAAG+C,aADG;AAEN,OAAGD;AAFG,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,YAAT,CAAuBC,IAAvB,EAA6BC,aAA7B,EAA4CC,SAA5C,EAAwD;AAC9D,QAAM;AAAEC,IAAAA;AAAF,MAAkBF,aAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAmBD,WAAzB;;AAEA,MAAK,CAAEC,YAAF,IAAkBH,aAAa,KAAKC,SAAS,CAACD,aAAnD,EAAmE;AAClE,WAAOD,IAAP;AACA;;AAED,QAAMK,UAAU,GAAGD,YAAY,CAACxB,qBAAb,EAAnB;AACA,SAAO,IAAIuB,WAAW,CAACG,OAAhB,CACNN,IAAI,CAAC5C,IAAL,GAAYiD,UAAU,CAACjD,IADjB,EAEN4C,IAAI,CAAClB,GAAL,GAAWuB,UAAU,CAACvB,GAFhB,EAGNkB,IAAI,CAAChD,KAHC,EAINgD,IAAI,CAACtB,MAJC,CAAP;AAMA","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Module constants\n */\nconst HEIGHT_OFFSET = 10; // Used by the arrow and a bit of empty space.\n\n/**\n * Utility used to compute the popover position over the xAxis\n *\n * @param {Object} anchorRect Anchor Rect.\n * @param {Object} contentSize Content Size.\n * @param {string} xAxis Desired xAxis.\n * @param {string} corner Desired corner.\n * @param {boolean} stickyBoundaryElement The boundary element to use when\n * switching between sticky and normal\n * position.\n * @param {string} chosenYAxis yAxis to be used.\n * @param {Element} boundaryElement Boundary element.\n * @param {boolean} forcePosition Don't adjust position based on anchor.\n * @param {boolean} forceXAlignment Don't adjust alignment based on YAxis\n *\n * @return {Object} Popover xAxis position and constraints.\n */\nexport function computePopoverXAxisPosition(\n\tanchorRect,\n\tcontentSize,\n\txAxis,\n\tcorner,\n\tstickyBoundaryElement,\n\tchosenYAxis,\n\tboundaryElement,\n\tforcePosition,\n\tforceXAlignment\n) {\n\tconst { width } = contentSize;\n\n\t// Correct xAxis for RTL support.\n\tif ( xAxis === 'left' && isRTL() ) {\n\t\txAxis = 'right';\n\t} else if ( xAxis === 'right' && isRTL() ) {\n\t\txAxis = 'left';\n\t}\n\n\tif ( corner === 'left' && isRTL() ) {\n\t\tcorner = 'right';\n\t} else if ( corner === 'right' && isRTL() ) {\n\t\tcorner = 'left';\n\t}\n\n\t// X axis alignment choices.\n\tconst anchorMidPoint = Math.round( anchorRect.left + anchorRect.width / 2 );\n\tconst centerAlignment = {\n\t\tpopoverLeft: anchorMidPoint,\n\t\tcontentWidth:\n\t\t\t( anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint ) +\n\t\t\t( anchorMidPoint + width / 2 > window.innerWidth\n\t\t\t\t? window.innerWidth - anchorMidPoint\n\t\t\t\t: width / 2 ),\n\t};\n\n\tlet leftAlignmentX = anchorRect.left;\n\n\tif ( corner === 'right' ) {\n\t\tleftAlignmentX = anchorRect.right;\n\t} else if ( chosenYAxis !== 'middle' && ! forceXAlignment ) {\n\t\tleftAlignmentX = anchorMidPoint;\n\t}\n\n\tlet rightAlignmentX = anchorRect.right;\n\n\tif ( corner === 'left' ) {\n\t\trightAlignmentX = anchorRect.left;\n\t} else if ( chosenYAxis !== 'middle' && ! forceXAlignment ) {\n\t\trightAlignmentX = anchorMidPoint;\n\t}\n\n\tconst leftAlignment = {\n\t\tpopoverLeft: leftAlignmentX,\n\t\tcontentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX,\n\t};\n\tconst rightAlignment = {\n\t\tpopoverLeft: rightAlignmentX,\n\t\tcontentWidth:\n\t\t\trightAlignmentX + width > window.innerWidth\n\t\t\t\t? window.innerWidth - rightAlignmentX\n\t\t\t\t: width,\n\t};\n\n\t// Choosing the x axis.\n\tlet chosenXAxis = xAxis;\n\tlet contentWidth = null;\n\n\tif ( ! stickyBoundaryElement && ! forcePosition ) {\n\t\tif ( xAxis === 'center' && centerAlignment.contentWidth === width ) {\n\t\t\tchosenXAxis = 'center';\n\t\t} else if ( xAxis === 'left' && leftAlignment.contentWidth === width ) {\n\t\t\tchosenXAxis = 'left';\n\t\t} else if (\n\t\t\txAxis === 'right' &&\n\t\t\trightAlignment.contentWidth === width\n\t\t) {\n\t\t\tchosenXAxis = 'right';\n\t\t} else {\n\t\t\tchosenXAxis =\n\t\t\t\tleftAlignment.contentWidth > rightAlignment.contentWidth\n\t\t\t\t\t? 'left'\n\t\t\t\t\t: 'right';\n\t\t\tconst chosenWidth =\n\t\t\t\tchosenXAxis === 'left'\n\t\t\t\t\t? leftAlignment.contentWidth\n\t\t\t\t\t: rightAlignment.contentWidth;\n\n\t\t\t// Limit width of the content to the viewport width\n\t\t\tif ( width > window.innerWidth ) {\n\t\t\t\tcontentWidth = window.innerWidth;\n\t\t\t}\n\n\t\t\t// If we can't find any alignment options that could fit\n\t\t\t// our content, then let's fallback to the center of the viewport.\n\t\t\tif ( chosenWidth !== width ) {\n\t\t\t\tchosenXAxis = 'center';\n\t\t\t\tcenterAlignment.popoverLeft = window.innerWidth / 2;\n\t\t\t}\n\t\t}\n\t}\n\n\tlet popoverLeft;\n\tif ( chosenXAxis === 'center' ) {\n\t\tpopoverLeft = centerAlignment.popoverLeft;\n\t} else if ( chosenXAxis === 'left' ) {\n\t\tpopoverLeft = leftAlignment.popoverLeft;\n\t} else {\n\t\tpopoverLeft = rightAlignment.popoverLeft;\n\t}\n\n\tif ( boundaryElement ) {\n\t\tpopoverLeft = Math.min(\n\t\t\tpopoverLeft,\n\t\t\tboundaryElement.offsetLeft + boundaryElement.offsetWidth - width\n\t\t);\n\n\t\t// Avoid the popover being position beyond the left boundary if the\n\t\t// direction is left to right.\n\t\tif ( ! isRTL() ) {\n\t\t\tpopoverLeft = Math.max( popoverLeft, 0 );\n\t\t}\n\t}\n\n\treturn {\n\t\txAxis: chosenXAxis,\n\t\tpopoverLeft,\n\t\tcontentWidth,\n\t};\n}\n\n/**\n * Utility used to compute the popover position over the yAxis\n *\n * @param {Object} anchorRect Anchor Rect.\n * @param {Object} contentSize Content Size.\n * @param {string} yAxis Desired yAxis.\n * @param {string} corner Desired corner.\n * @param {boolean} stickyBoundaryElement The boundary element to use when switching between sticky\n * and normal position.\n * @param {Element} anchorRef The anchor element.\n * @param {Element} relativeOffsetTop If applicable, top offset of the relative positioned\n * parent container.\n * @param {boolean} forcePosition Don't adjust position based on anchor.\n * @param {Element|null} editorWrapper Element that wraps the editor content. Used to access\n * scroll position to determine sticky behavior.\n * @return {Object} Popover xAxis position and constraints.\n */\nexport function computePopoverYAxisPosition(\n\tanchorRect,\n\tcontentSize,\n\tyAxis,\n\tcorner,\n\tstickyBoundaryElement,\n\tanchorRef,\n\trelativeOffsetTop,\n\tforcePosition,\n\teditorWrapper\n) {\n\tconst { height } = contentSize;\n\n\tif ( stickyBoundaryElement ) {\n\t\tconst stickyRect = stickyBoundaryElement.getBoundingClientRect();\n\t\tconst stickyPositionTop = stickyRect.top + height - relativeOffsetTop;\n\t\tconst stickyPositionBottom =\n\t\t\tstickyRect.bottom - height - relativeOffsetTop;\n\n\t\tif ( anchorRect.top <= stickyPositionTop ) {\n\t\t\tif ( editorWrapper ) {\n\t\t\t\t// If a popover cannot be positioned above the anchor, even after scrolling, we must\n\t\t\t\t// ensure we use the bottom position instead of the popover slot. This prevents the\n\t\t\t\t// popover from always restricting block content and interaction while selected if the\n\t\t\t\t// block is near the top of the site editor.\n\n\t\t\t\tconst isRoomAboveInCanvas =\n\t\t\t\t\theight + HEIGHT_OFFSET <\n\t\t\t\t\teditorWrapper.scrollTop + anchorRect.top;\n\t\t\t\tif ( ! isRoomAboveInCanvas ) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tyAxis: 'bottom',\n\t\t\t\t\t\t// If the bottom of the block is also below the bottom sticky position (ex -\n\t\t\t\t\t\t// block is also taller than the editor window), return the bottom sticky\n\t\t\t\t\t\t// position instead. We do this instead of the top sticky position both to\n\t\t\t\t\t\t// allow a smooth transition and more importantly to ensure every section of\n\t\t\t\t\t\t// the block can be free from popover obscuration at some point in the\n\t\t\t\t\t\t// scroll position.\n\t\t\t\t\t\tpopoverTop: Math.min(\n\t\t\t\t\t\t\tanchorRect.bottom,\n\t\t\t\t\t\t\tstickyPositionBottom\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Default sticky behavior.\n\t\t\treturn {\n\t\t\t\tyAxis,\n\t\t\t\tpopoverTop: Math.min( anchorRect.bottom, stickyPositionTop ),\n\t\t\t};\n\t\t}\n\t}\n\n\t// Y axis alignment choices.\n\tlet anchorMidPoint = anchorRect.top + anchorRect.height / 2;\n\n\tif ( corner === 'bottom' ) {\n\t\tanchorMidPoint = anchorRect.bottom;\n\t} else if ( corner === 'top' ) {\n\t\tanchorMidPoint = anchorRect.top;\n\t}\n\n\tconst middleAlignment = {\n\t\tpopoverTop: anchorMidPoint,\n\t\tcontentHeight:\n\t\t\t( anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint ) +\n\t\t\t( anchorMidPoint + height / 2 > window.innerHeight\n\t\t\t\t? window.innerHeight - anchorMidPoint\n\t\t\t\t: height / 2 ),\n\t};\n\n\tconst topAlignment = {\n\t\tpopoverTop: anchorRect.top,\n\t\tcontentHeight:\n\t\t\tanchorRect.top - HEIGHT_OFFSET - height > 0\n\t\t\t\t? height\n\t\t\t\t: anchorRect.top - HEIGHT_OFFSET,\n\t};\n\tconst bottomAlignment = {\n\t\tpopoverTop: anchorRect.bottom,\n\t\tcontentHeight:\n\t\t\tanchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight\n\t\t\t\t? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom\n\t\t\t\t: height,\n\t};\n\n\t// Choosing the y axis.\n\tlet chosenYAxis = yAxis;\n\tlet contentHeight = null;\n\n\tif ( ! stickyBoundaryElement && ! forcePosition ) {\n\t\tif ( yAxis === 'middle' && middleAlignment.contentHeight === height ) {\n\t\t\tchosenYAxis = 'middle';\n\t\t} else if ( yAxis === 'top' && topAlignment.contentHeight === height ) {\n\t\t\tchosenYAxis = 'top';\n\t\t} else if (\n\t\t\tyAxis === 'bottom' &&\n\t\t\tbottomAlignment.contentHeight === height\n\t\t) {\n\t\t\tchosenYAxis = 'bottom';\n\t\t} else {\n\t\t\tchosenYAxis =\n\t\t\t\ttopAlignment.contentHeight > bottomAlignment.contentHeight\n\t\t\t\t\t? 'top'\n\t\t\t\t\t: 'bottom';\n\t\t\tconst chosenHeight =\n\t\t\t\tchosenYAxis === 'top'\n\t\t\t\t\t? topAlignment.contentHeight\n\t\t\t\t\t: bottomAlignment.contentHeight;\n\t\t\tcontentHeight = chosenHeight !== height ? chosenHeight : null;\n\t\t}\n\t}\n\n\tlet popoverTop;\n\tif ( chosenYAxis === 'middle' ) {\n\t\tpopoverTop = middleAlignment.popoverTop;\n\t} else if ( chosenYAxis === 'top' ) {\n\t\tpopoverTop = topAlignment.popoverTop;\n\t} else {\n\t\tpopoverTop = bottomAlignment.popoverTop;\n\t}\n\n\treturn {\n\t\tyAxis: chosenYAxis,\n\t\tpopoverTop,\n\t\tcontentHeight,\n\t};\n}\n\n/**\n * Utility used to compute the popover position and the content max width/height for a popover given\n * its anchor rect and its content size.\n *\n * @param {Object} anchorRect Anchor Rect.\n * @param {Object} contentSize Content Size.\n * @param {string} position Position.\n * @param {boolean} stickyBoundaryElement The boundary element to use when switching between\n * sticky and normal position.\n * @param {Element} anchorRef The anchor element.\n * @param {number} relativeOffsetTop If applicable, top offset of the relative positioned\n * parent container.\n * @param {Element} boundaryElement Boundary element.\n * @param {boolean} forcePosition Don't adjust position based on anchor.\n * @param {boolean} forceXAlignment Don't adjust alignment based on YAxis\n * @param {Element|null} editorWrapper Element that wraps the editor content. Used to access\n * scroll position to determine sticky behavior.\n * @return {Object} Popover position and constraints.\n */\nexport function computePopoverPosition(\n\tanchorRect,\n\tcontentSize,\n\tposition = 'top',\n\tstickyBoundaryElement,\n\tanchorRef,\n\trelativeOffsetTop,\n\tboundaryElement,\n\tforcePosition,\n\tforceXAlignment,\n\teditorWrapper\n) {\n\tconst [ yAxis, xAxis = 'center', corner ] = position.split( ' ' );\n\n\tconst yAxisPosition = computePopoverYAxisPosition(\n\t\tanchorRect,\n\t\tcontentSize,\n\t\tyAxis,\n\t\tcorner,\n\t\tstickyBoundaryElement,\n\t\tanchorRef,\n\t\trelativeOffsetTop,\n\t\tforcePosition,\n\t\teditorWrapper\n\t);\n\tconst xAxisPosition = computePopoverXAxisPosition(\n\t\tanchorRect,\n\t\tcontentSize,\n\t\txAxis,\n\t\tcorner,\n\t\tstickyBoundaryElement,\n\t\tyAxisPosition.yAxis,\n\t\tboundaryElement,\n\t\tforcePosition,\n\t\tforceXAlignment\n\t);\n\n\treturn {\n\t\t...xAxisPosition,\n\t\t...yAxisPosition,\n\t};\n}\n\n/**\n * Offsets the given rect by the position of the iframe that contains the\n * element. If the owner document is not in an iframe then it returns with the\n * original rect. If the popover container document and the anchor document are\n * the same, the original rect will also be returned.\n *\n * @param {DOMRect} rect bounds of the element\n * @param {Document} ownerDocument document of the element\n * @param {Element} container The popover container to position.\n *\n * @return {DOMRect} offsetted bounds\n */\nexport function offsetIframe( rect, ownerDocument, container ) {\n\tconst { defaultView } = ownerDocument;\n\tconst { frameElement } = defaultView;\n\n\tif ( ! frameElement || ownerDocument === container.ownerDocument ) {\n\t\treturn rect;\n\t}\n\n\tconst iframeRect = frameElement.getBoundingClientRect();\n\treturn new defaultView.DOMRect(\n\t\trect.left + iframeRect.left,\n\t\trect.top + iframeRect.top,\n\t\trect.width,\n\t\trect.height\n\t);\n}\n"]}
@@ -1,154 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createElement, Fragment } from "@wordpress/element";
3
-
4
- /**
5
- * WordPress dependencies
6
- */
7
- import { useRef, useEffect, useState } from '@wordpress/element';
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- import { Container, TopView, RightView, BottomView, LeftView } from './styles/box-control-visualizer-styles';
13
- import { DEFAULT_VALUES, DEFAULT_VISUALIZER_VALUES } from './utils';
14
- export default function BoxControlVisualizer(_ref) {
15
- let {
16
- children,
17
- showValues = DEFAULT_VISUALIZER_VALUES,
18
- values: valuesProp = DEFAULT_VALUES,
19
- ...props
20
- } = _ref;
21
- const isPositionAbsolute = !children;
22
- return createElement(Container, _extends({}, props, {
23
- isPositionAbsolute: isPositionAbsolute,
24
- "aria-hidden": "true"
25
- }), createElement(Sides, {
26
- showValues: showValues,
27
- values: valuesProp
28
- }), children);
29
- }
30
-
31
- function Sides(_ref2) {
32
- let {
33
- showValues = DEFAULT_VISUALIZER_VALUES,
34
- values
35
- } = _ref2;
36
- const {
37
- top,
38
- right,
39
- bottom,
40
- left
41
- } = values;
42
- return createElement(Fragment, null, createElement(Top, {
43
- isVisible: showValues.top,
44
- value: top
45
- }), createElement(Right, {
46
- isVisible: showValues.right,
47
- value: right
48
- }), createElement(Bottom, {
49
- isVisible: showValues.bottom,
50
- value: bottom
51
- }), createElement(Left, {
52
- isVisible: showValues.left,
53
- value: left
54
- }));
55
- }
56
-
57
- function Top(_ref3) {
58
- let {
59
- isVisible = false,
60
- value
61
- } = _ref3;
62
- const height = value;
63
- const animationProps = useSideAnimation(height);
64
- const isActive = animationProps.isActive || isVisible;
65
- return createElement(TopView, {
66
- isActive: isActive,
67
- style: {
68
- height
69
- }
70
- });
71
- }
72
-
73
- function Right(_ref4) {
74
- let {
75
- isVisible = false,
76
- value
77
- } = _ref4;
78
- const width = value;
79
- const animationProps = useSideAnimation(width);
80
- const isActive = animationProps.isActive || isVisible;
81
- return createElement(RightView, {
82
- isActive: isActive,
83
- style: {
84
- width
85
- }
86
- });
87
- }
88
-
89
- function Bottom(_ref5) {
90
- let {
91
- isVisible = false,
92
- value
93
- } = _ref5;
94
- const height = value;
95
- const animationProps = useSideAnimation(height);
96
- const isActive = animationProps.isActive || isVisible;
97
- return createElement(BottomView, {
98
- isActive: isActive,
99
- style: {
100
- height
101
- }
102
- });
103
- }
104
-
105
- function Left(_ref6) {
106
- let {
107
- isVisible = false,
108
- value
109
- } = _ref6;
110
- const width = value;
111
- const animationProps = useSideAnimation(width);
112
- const isActive = animationProps.isActive || isVisible;
113
- return createElement(LeftView, {
114
- isActive: isActive,
115
- style: {
116
- width
117
- }
118
- });
119
- }
120
- /**
121
- * Custom hook that renders the "flash" animation whenever the value changes.
122
- *
123
- * @param {string} value Value of (box) side.
124
- */
125
-
126
-
127
- function useSideAnimation(value) {
128
- const [isActive, setIsActive] = useState(false);
129
- const valueRef = useRef(value);
130
- const timeoutRef = useRef();
131
-
132
- const clearTimer = () => {
133
- if (timeoutRef.current) {
134
- window.clearTimeout(timeoutRef.current);
135
- }
136
- };
137
-
138
- useEffect(() => {
139
- if (value !== valueRef.current) {
140
- setIsActive(true);
141
- valueRef.current = value;
142
- clearTimer();
143
- timeoutRef.current = setTimeout(() => {
144
- setIsActive(false);
145
- }, 400);
146
- }
147
-
148
- return () => clearTimer();
149
- }, [value]);
150
- return {
151
- isActive
152
- };
153
- }
154
- //# sourceMappingURL=visualizer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/box-control/visualizer.js"],"names":["useRef","useEffect","useState","Container","TopView","RightView","BottomView","LeftView","DEFAULT_VALUES","DEFAULT_VISUALIZER_VALUES","BoxControlVisualizer","children","showValues","values","valuesProp","props","isPositionAbsolute","Sides","top","right","bottom","left","Top","isVisible","value","height","animationProps","useSideAnimation","isActive","Right","width","Bottom","Left","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,QAA5B,QAA4C,oBAA5C;AAEA;AACA;AACA;;AACA,SACCC,SADD,EAECC,OAFD,EAGCC,SAHD,EAICC,UA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c,CAACE,QAAf,IAA2BL,SAA5C;AAEA,SAAO,cAAC,QAAD;AAAU,IAAA,QAAQ,EAAGK,QAArB;AAAgC,IAAA,KAAK,EAAG;AAAEE,MAAAA;AAAF;AAAxC,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;;;AACA,SAASH,gBAAT,CAA2BH,KAA3B,EAAmC;AAClC,QAAM,CAAEI,QAAF,EAAYK,WAAZ,IAA4B/B,QAAQ,CAAE,KAAF,CAA1C;AACA,QAAMgC,QAAQ,GAAGlC,MAAM,CAAEwB,KAAF,CAAvB;AACA,QAAMW,UAAU,GAAGnC,MAAM,EAAzB;;AAEA,QAAMoC,UAAU,GAAG,MAAM;AACxB,QAAKD,UAAU,CAACE,OAAhB,EAA0B;AACzBC,MAAAA,MAAM,CAACC,YAAP,CAAqBJ,UAAU,CAACE,OAAhC;AACA;AACD,GAJD;;AAMApC,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKuB,KAAK,KAAKU,QAAQ,CAACG,OAAxB,EAAkC;AACjCJ,MAAAA,WAAW,CAAE,IAAF,CAAX;AACAC,MAAAA,QAAQ,CAACG,OAAT,GAAmBb,KAAnB;AAEAY,MAAAA,UAAU;AAEVD,MAAAA,UAAU,CAACE,OAAX,GAAqBG,UAAU,CAAE,MAAM;AACtCP,QAAAA,WAAW,CAAE,KAAF,CAAX;AACA,OAF8B,EAE5B,GAF4B,CAA/B;AAGA;;AAED,WAAO,MAAMG,UAAU,EAAvB;AACA,GAbQ,EAaN,CAAEZ,KAAF,CAbM,CAAT;AAeA,SAAO;AACNI,IAAAA;AADM,GAAP;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tContainer,\n\tTopView,\n\tRightView,\n\tBottomView,\n\tLeftView,\n} from './styles/box-control-visualizer-styles';\nimport { DEFAULT_VALUES, DEFAULT_VISUALIZER_VALUES } from './utils';\n\nexport default function BoxControlVisualizer( {\n\tchildren,\n\tshowValues = DEFAULT_VISUALIZER_VALUES,\n\tvalues: valuesProp = DEFAULT_VALUES,\n\t...props\n} ) {\n\tconst isPositionAbsolute = ! children;\n\treturn (\n\t\t<Container\n\t\t\t{ ...props }\n\t\t\tisPositionAbsolute={ isPositionAbsolute }\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<Sides showValues={ showValues } values={ valuesProp } />\n\t\t\t{ children }\n\t\t</Container>\n\t);\n}\n\nfunction Sides( { showValues = DEFAULT_VISUALIZER_VALUES, values } ) {\n\tconst { top, right, bottom, left } = values;\n\n\treturn (\n\t\t<>\n\t\t\t<Top isVisible={ showValues.top } value={ top } />\n\t\t\t<Right isVisible={ showValues.right } value={ right } />\n\t\t\t<Bottom isVisible={ showValues.bottom } value={ bottom } />\n\t\t\t<Left isVisible={ showValues.left } value={ left } />\n\t\t</>\n\t);\n}\n\nfunction Top( { isVisible = false, value } ) {\n\tconst height = value;\n\tconst animationProps = useSideAnimation( height );\n\tconst isActive = animationProps.isActive || isVisible;\n\n\treturn <TopView isActive={ isActive } style={ { height } } />;\n}\n\nfunction Right( { isVisible = false, value } ) {\n\tconst width = value;\n\tconst animationProps = useSideAnimation( width );\n\tconst isActive = animationProps.isActive || isVisible;\n\n\treturn <RightView isActive={ isActive } style={ { width } } />;\n}\n\nfunction Bottom( { isVisible = false, value } ) {\n\tconst height = value;\n\tconst animationProps = useSideAnimation( height );\n\tconst isActive = animationProps.isActive || isVisible;\n\n\treturn <BottomView isActive={ isActive } style={ { height } } />;\n}\n\nfunction Left( { isVisible = false, value } ) {\n\tconst width = value;\n\tconst animationProps = useSideAnimation( width );\n\tconst isActive = animationProps.isActive || isVisible;\n\n\treturn <LeftView isActive={ isActive } style={ { width } } />;\n}\n\n/**\n * Custom hook that renders the \"flash\" animation whenever the value changes.\n *\n * @param {string} value Value of (box) side.\n */\nfunction useSideAnimation( value ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( value );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( value !== valueRef.current ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = value;\n\n\t\t\tclearTimer();\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => clearTimer();\n\t}, [ value ] );\n\n\treturn {\n\t\tisActive,\n\t};\n}\n"]}
@@ -1,11 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createContext, useContext } from '@wordpress/element';
5
- /**
6
- * @type {import('react').Context<import('./types').Context>}
7
- */
8
-
9
- export const FlyoutContext = createContext({});
10
- export const useFlyoutContext = () => useContext(FlyoutContext);
11
- //# sourceMappingURL=context.js.map