@wordpress/components 19.8.3 → 19.10.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 (256) hide show
  1. package/CHANGELOG.md +42 -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/angle-picker-control/angle-circle.js +5 -7
  6. package/build/angle-picker-control/angle-circle.js.map +1 -1
  7. package/build/box-control/index.js +0 -21
  8. package/build/box-control/index.js.map +1 -1
  9. package/build/box-control/utils.js +1 -8
  10. package/build/box-control/utils.js.map +1 -1
  11. package/build/button/index.js +3 -5
  12. package/build/button/index.js.map +1 -1
  13. package/build/circular-option-picker/index.js +1 -2
  14. package/build/circular-option-picker/index.js.map +1 -1
  15. package/build/disabled/index.js +4 -76
  16. package/build/disabled/index.js.map +1 -1
  17. package/build/heading/hook.js +1 -1
  18. package/build/heading/hook.js.map +1 -1
  19. package/build/input-control/index.js +27 -4
  20. package/build/input-control/index.js.map +1 -1
  21. package/build/input-control/styles/input-control-styles.js +42 -30
  22. package/build/input-control/styles/input-control-styles.js.map +1 -1
  23. package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
  24. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  25. package/build/navigation/styles/navigation-styles.js +12 -12
  26. package/build/navigation/styles/navigation-styles.js.map +1 -1
  27. package/build/notice/index.native.js +44 -40
  28. package/build/notice/index.native.js.map +1 -1
  29. package/build/notice/list.native.js +27 -45
  30. package/build/notice/list.native.js.map +1 -1
  31. package/build/popover/index.js +6 -52
  32. package/build/popover/index.js.map +1 -1
  33. package/build/sandbox/index.js +2 -2
  34. package/build/sandbox/index.js.map +1 -1
  35. package/build/select-control/index.js +31 -4
  36. package/build/select-control/index.js.map +1 -1
  37. package/build/select-control/styles/select-control-styles.js +8 -8
  38. package/build/select-control/styles/select-control-styles.js.map +1 -1
  39. package/build/surface/styles.js +8 -8
  40. package/build/surface/styles.js.map +1 -1
  41. package/build/text/hook.js +5 -5
  42. package/build/text/hook.js.map +1 -1
  43. package/build/text/styles/text-mixins.native.js +1 -1
  44. package/build/text/styles/text-mixins.native.js.map +1 -1
  45. package/build/text/styles.js +7 -7
  46. package/build/text/styles.js.map +1 -1
  47. package/build/text-control/index.js +35 -28
  48. package/build/text-control/index.js.map +1 -1
  49. package/build/text-control/types.js +6 -0
  50. package/build/text-control/types.js.map +1 -0
  51. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +6 -4
  52. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  53. package/build/tools-panel/tools-panel-header/component.js +52 -36
  54. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  55. package/build/ui/spinner/component.js +1 -1
  56. package/build/ui/spinner/component.js.map +1 -1
  57. package/build/unit-control/index.js +3 -3
  58. package/build/unit-control/index.js.map +1 -1
  59. package/build/unit-control/styles/unit-control-styles.js +11 -20
  60. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  61. package/build/unit-control/utils.js.map +1 -1
  62. package/build/utils/colors-values.js +9 -24
  63. package/build/utils/colors-values.js.map +1 -1
  64. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +11 -11
  65. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  66. package/build-module/angle-picker-control/angle-circle.js +5 -7
  67. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  68. package/build-module/box-control/index.js +1 -20
  69. package/build-module/box-control/index.js.map +1 -1
  70. package/build-module/box-control/utils.js +0 -6
  71. package/build-module/box-control/utils.js.map +1 -1
  72. package/build-module/button/index.js +3 -4
  73. package/build-module/button/index.js.map +1 -1
  74. package/build-module/circular-option-picker/index.js +1 -2
  75. package/build-module/circular-option-picker/index.js.map +1 -1
  76. package/build-module/disabled/index.js +5 -76
  77. package/build-module/disabled/index.js.map +1 -1
  78. package/build-module/heading/hook.js +1 -1
  79. package/build-module/heading/hook.js.map +1 -1
  80. package/build-module/input-control/index.js +24 -3
  81. package/build-module/input-control/index.js.map +1 -1
  82. package/build-module/input-control/styles/input-control-styles.js +42 -30
  83. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  84. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
  85. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  86. package/build-module/navigation/styles/navigation-styles.js +13 -13
  87. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  88. package/build-module/notice/index.native.js +45 -41
  89. package/build-module/notice/index.native.js.map +1 -1
  90. package/build-module/notice/list.native.js +28 -46
  91. package/build-module/notice/list.native.js.map +1 -1
  92. package/build-module/popover/index.js +6 -52
  93. package/build-module/popover/index.js.map +1 -1
  94. package/build-module/sandbox/index.js +2 -2
  95. package/build-module/sandbox/index.js.map +1 -1
  96. package/build-module/select-control/index.js +29 -3
  97. package/build-module/select-control/index.js.map +1 -1
  98. package/build-module/select-control/styles/select-control-styles.js +8 -8
  99. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  100. package/build-module/surface/styles.js +8 -8
  101. package/build-module/surface/styles.js.map +1 -1
  102. package/build-module/text/hook.js +5 -5
  103. package/build-module/text/hook.js.map +1 -1
  104. package/build-module/text/styles/text-mixins.native.js +2 -2
  105. package/build-module/text/styles/text-mixins.native.js.map +1 -1
  106. package/build-module/text/styles.js +7 -7
  107. package/build-module/text/styles.js.map +1 -1
  108. package/build-module/text-control/index.js +35 -27
  109. package/build-module/text-control/index.js.map +1 -1
  110. package/build-module/text-control/types.js +2 -0
  111. package/build-module/text-control/types.js.map +1 -0
  112. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -5
  113. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  114. package/build-module/tools-panel/tools-panel-header/component.js +51 -36
  115. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  116. package/build-module/ui/spinner/component.js +1 -1
  117. package/build-module/ui/spinner/component.js.map +1 -1
  118. package/build-module/unit-control/index.js +3 -3
  119. package/build-module/unit-control/index.js.map +1 -1
  120. package/build-module/unit-control/styles/unit-control-styles.js +11 -20
  121. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  122. package/build-module/unit-control/utils.js.map +1 -1
  123. package/build-module/utils/colors-values.js +19 -23
  124. package/build-module/utils/colors-values.js.map +1 -1
  125. package/build-style/style-rtl.css +24 -0
  126. package/build-style/style.css +24 -0
  127. package/build-types/button/index.d.ts.map +1 -1
  128. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  129. package/build-types/color-picker/styles.d.ts +3 -3
  130. package/build-types/disabled/index.d.ts.map +1 -1
  131. package/build-types/input-control/index.d.ts +23 -3
  132. package/build-types/input-control/index.d.ts.map +1 -1
  133. package/build-types/input-control/input-field.d.ts +1 -1
  134. package/build-types/input-control/input-field.d.ts.map +1 -1
  135. package/build-types/input-control/stories/index.d.ts +5 -5
  136. package/build-types/input-control/styles/input-control-styles.d.ts +1 -0
  137. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  138. package/build-types/input-control/types.d.ts +79 -3
  139. package/build-types/input-control/types.d.ts.map +1 -1
  140. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  141. package/build-types/popover/index.d.ts +0 -1
  142. package/build-types/popover/index.d.ts.map +1 -1
  143. package/build-types/select-control/index.d.ts +30 -26
  144. package/build-types/select-control/index.d.ts.map +1 -1
  145. package/build-types/select-control/stories/index.d.ts +23 -0
  146. package/build-types/select-control/stories/index.d.ts.map +1 -0
  147. package/build-types/select-control/styles/select-control-styles.d.ts +3 -4
  148. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  149. package/build-types/select-control/test/select-control.d.ts +2 -0
  150. package/build-types/select-control/test/select-control.d.ts.map +1 -0
  151. package/build-types/select-control/types.d.ts +52 -1
  152. package/build-types/select-control/types.d.ts.map +1 -1
  153. package/build-types/text-control/index.d.ts +32 -0
  154. package/build-types/text-control/index.d.ts.map +1 -0
  155. package/build-types/text-control/stories/index.d.ts +13 -0
  156. package/build-types/text-control/stories/index.d.ts.map +1 -0
  157. package/build-types/text-control/types.d.ts +25 -0
  158. package/build-types/text-control/types.d.ts.map +1 -0
  159. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  160. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  161. package/build-types/tools-panel/types.d.ts +0 -1
  162. package/build-types/tools-panel/types.d.ts.map +1 -1
  163. package/build-types/unit-control/index.d.ts +2 -2
  164. package/build-types/unit-control/index.d.ts.map +1 -1
  165. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  166. package/build-types/unit-control/test/index.d.ts +2 -0
  167. package/build-types/unit-control/test/index.d.ts.map +1 -0
  168. package/build-types/unit-control/test/utils.d.ts +2 -0
  169. package/build-types/unit-control/test/utils.d.ts.map +1 -0
  170. package/build-types/unit-control/types.d.ts +1 -1
  171. package/build-types/unit-control/types.d.ts.map +1 -1
  172. package/build-types/unit-control/utils.d.ts +3 -3
  173. package/build-types/unit-control/utils.d.ts.map +1 -1
  174. package/build-types/utils/colors-values.d.ts +6 -146
  175. package/build-types/utils/colors-values.d.ts.map +1 -1
  176. package/package.json +17 -17
  177. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +5 -3
  178. package/src/angle-picker-control/angle-circle.js +3 -3
  179. package/src/box-control/README.md +0 -74
  180. package/src/box-control/index.js +0 -15
  181. package/src/box-control/stories/index.js +0 -29
  182. package/src/box-control/utils.js +0 -7
  183. package/src/button/index.js +2 -4
  184. package/src/button/test/index.js +16 -1
  185. package/src/circular-option-picker/index.js +1 -2
  186. package/src/color-palette/README.md +0 -1
  187. package/src/color-palette/test/__snapshots__/index.js.snap +2 -3
  188. package/src/confirm-dialog/stories/index.js +87 -99
  189. package/src/date-time/stories/index.js +19 -0
  190. package/src/date-time/test/date.js +107 -78
  191. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  192. package/src/disabled/index.js +5 -90
  193. package/src/form-file-upload/test/index.js +15 -12
  194. package/src/heading/hook.ts +1 -1
  195. package/src/heading/test/__snapshots__/index.js.snap +3 -3
  196. package/src/input-control/README.md +3 -3
  197. package/src/input-control/index.tsx +23 -3
  198. package/src/input-control/stories/index.tsx +63 -0
  199. package/src/input-control/styles/input-control-styles.tsx +20 -7
  200. package/src/input-control/types.ts +79 -2
  201. package/src/menu-item/style.scss +10 -0
  202. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +8 -1
  203. package/src/mobile/bottom-sheet-select-control/index.native.js +1 -0
  204. package/src/mobile/html-text-input/style.android.scss +1 -0
  205. package/src/mobile/html-text-input/style.ios.scss +1 -0
  206. package/src/mobile/link-settings/test/link-settings-navigation.native.js +9 -1
  207. package/src/navigation/styles/navigation-styles.js +5 -5
  208. package/src/notice/index.native.js +44 -54
  209. package/src/notice/list.native.js +27 -51
  210. package/src/notice/style.native.scss +1 -0
  211. package/src/popover/index.js +5 -51
  212. package/src/query-controls/README.md +2 -2
  213. package/src/sandbox/index.js +2 -2
  214. package/src/select-control/README.md +2 -2
  215. package/src/select-control/index.tsx +30 -29
  216. package/src/select-control/stories/index.tsx +90 -0
  217. package/src/select-control/styles/select-control-styles.ts +10 -9
  218. package/src/select-control/test/{select-control.js → select-control.tsx} +2 -2
  219. package/src/select-control/types.ts +66 -1
  220. package/src/surface/styles.js +1 -1
  221. package/src/text/hook.js +1 -1
  222. package/src/text/styles/text-mixins.native.js +2 -2
  223. package/src/text/styles.js +1 -1
  224. package/src/text/test/__snapshots__/{index.js.snap → index.tsx.snap} +16 -0
  225. package/src/text/test/{index.js → index.tsx} +12 -6
  226. package/src/text-control/index.tsx +84 -0
  227. package/src/text-control/stories/index.tsx +66 -0
  228. package/src/text-control/types.ts +29 -0
  229. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -5
  230. package/src/toolbar-group/style.scss +20 -0
  231. package/src/tools-panel/test/__snapshots__/index.js.snap +2 -2
  232. package/src/tools-panel/test/index.js +71 -18
  233. package/src/tools-panel/tools-panel-header/component.tsx +75 -33
  234. package/src/tools-panel/types.ts +0 -1
  235. package/src/tooltip/test/index.js +6 -0
  236. package/src/ui/spinner/component.js +1 -1
  237. package/src/ui/spinner/test/__snapshots__/index.js.snap +3 -3
  238. package/src/unit-control/index.tsx +2 -5
  239. package/src/unit-control/styles/unit-control-styles.ts +3 -13
  240. package/src/unit-control/test/__snapshots__/index.tsx.snap +33 -0
  241. package/src/unit-control/test/{index.js → index.tsx} +214 -165
  242. package/src/unit-control/test/{utils.js → utils.ts} +38 -19
  243. package/src/unit-control/types.ts +4 -1
  244. package/src/unit-control/utils.ts +5 -3
  245. package/src/utils/colors-values.js +18 -22
  246. package/tsconfig.json +9 -2
  247. package/tsconfig.tsbuildinfo +1 -1
  248. package/build/box-control/visualizer.js +0 -165
  249. package/build/box-control/visualizer.js.map +0 -1
  250. package/build-module/box-control/visualizer.js +0 -154
  251. package/build-module/box-control/visualizer.js.map +0 -1
  252. package/src/box-control/visualizer.js +0 -116
  253. package/src/input-control/stories/index.js +0 -71
  254. package/src/select-control/stories/index.js +0 -104
  255. package/src/text-control/index.js +0 -72
  256. package/src/text-control/stories/index.js +0 -46
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/navigation/styles/navigation-styles.js"],"names":["NavigationUI","MenuUI","MenuBackButtonUI","Button","MenuTitleUI","MenuTitleActionsUI","MenuTitleSearchUI","SearchControl","GroupTitleUI","Heading","ItemBaseUI","textAlign","UI","theme","BASE","white","G2","lightGray","ui","ItemUI","ItemIconUI","ItemBadgeUI","ItemTitleUI","Text"],"mappings":";;;;;;;;;;;AAQA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,kDAGV,kBAAO,CAAP,CAHU,y8MAAlB;;AA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B,CAZkB,iKAuBAC,iBAAGC,KAvBH,aAwBXC,mBAAKC,KAxBM,wBA4BVD,mBAAKC,KA5BK,mCAkCXC,iBAAGC,SAAH,CAAaC,EAlCF,07MAAhB;;AAsCA,MAAMC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oFAMN,kBAAO,GAAP,CANM,OAMY,kBAAO,CAAP,CANZ,+/MAAZ;;AAcA,MAAMC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,iCAEL,kBAAO,CAAP,CAFK,y7MAAhB;;AAKA,MAAMC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,mBACP,MAAQ,qBAAU,GAAV,GAAgB,kBAAO,CAAP,CADjB,oBAEN,MAAQ,qBAAU,kBAAO,CAAP,CAAV,GAAuB,GAFzB,mCAIX,kBAAO,CAAP,CAJW,OAIK,kBAAO,CAAP,CAJL,4GAiBpB,yBAAc,WAAd,CAjBoB,y7MAAjB;;AAoBA,MAAMC,WAAW,GAAG,iCAAQC,UAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,CACpB,MAAQ,qBAAU,oBAAV,GAAiC,qBADrB,u+MAAjB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * WordPress dependencies\n */\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { BASE, G2, UI } from '../../utils/colors-values';\nimport Button from '../../button';\nimport { Text } from '../../text';\nimport { Heading } from '../../heading';\nimport { reduceMotion, rtl } from '../../utils';\nimport { space } from '../../ui/utils/space';\nimport SearchControl from '../../search-control';\n\nexport const NavigationUI = styled.div`\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 0 ${ space( 4 ) };\n\toverflow: hidden;\n`;\n\nexport const MenuUI = styled.div`\n\tmargin-top: ${ space( 6 ) };\n\tmargin-bottom: ${ space( 6 ) };\n\tdisplay: flex;\n\tflex-direction: column;\n\tul {\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n\t.components-navigation__back-button {\n\t\tmargin-bottom: ${ space( 6 ) };\n\t}\n\n\t.components-navigation__group + .components-navigation__group {\n\t\tmargin-top: ${ space( 6 ) };\n\t}\n`;\n\nexport const MenuBackButtonUI = styled( Button )`\n\t&.is-tertiary {\n\t\tcolor: inherit;\n\t\topacity: 0.7;\n\n\t\t&:hover:not( :disabled ) {\n\t\t\topacity: 1;\n\t\t\tbox-shadow: none;\n\t\t\tcolor: inherit;\n\t\t}\n\n\t\t&:active:not( :disabled ) {\n\t\t\tbackground: transparent;\n\t\t\topacity: 1;\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n`;\n\nexport const MenuTitleUI = styled.div`\n\toverflow: hidden;\n\twidth: 100%;\n`;\n\nexport const MenuTitleActionsUI = styled.span`\n\theight: ${ space( 6 ) }; // 24px, same height as the buttons inside\n\n\t.components-button.is-small {\n\t\tcolor: inherit;\n\t\topacity: 0.7;\n\t\tmargin-right: ${ space( 1 ) }; // Avoid hiding the focus outline\n\t\tpadding: 0;\n\n\t\t&:active:not( :disabled ) {\n\t\t\tbackground: none;\n\t\t\topacity: 1;\n\t\t\tcolor: inherit;\n\t\t}\n\t\t&:hover:not( :disabled ) {\n\t\t\tbox-shadow: none;\n\t\t\topacity: 1;\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n`;\n\nexport const MenuTitleSearchUI = styled( SearchControl )`\n\tinput[type='search'].components-search-control__input {\n\t\tmargin: 0;\n\t\tbackground: #303030;\n\t\tcolor: #fff;\n\n\t\t&:focus {\n\t\t\tbackground: #434343;\n\t\t\tcolor: #fff;\n\t\t}\n\n\t\t&::placeholder {\n\t\t\tcolor: rgba( 255, 255, 255, 0.6 );\n\t\t}\n\t}\n\n\tsvg {\n\t\tfill: white;\n\t}\n\n\t.components-button.has-icon {\n\t\tpadding: 0;\n\t\tmin-width: auto;\n\t}\n`;\n\nexport const GroupTitleUI = styled( Heading )`\n\tmin-height: ${ space( 12 ) };\n\talign-items: center;\n\tcolor: inherit;\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tmargin-bottom: ${ space( 2 ) };\n\tpadding: ${ () =>\n\t\tisRTL()\n\t\t\t? `${ space( 1 ) } ${ space( 4 ) } ${ space( 1 ) } ${ space( 2 ) }`\n\t\t\t: `${ space( 1 ) } ${ space( 2 ) } ${ space( 1 ) } ${ space(\n\t\t\t\t\t4\n\t\t\t ) }` };\n`;\n\nexport const ItemBaseUI = styled.li`\n\tborder-radius: 2px;\n\tcolor: inherit;\n\tmargin-bottom: 0;\n\n\t> button,\n\t> a.components-button,\n\t> a {\n\t\twidth: 100%;\n\t\tcolor: inherit;\n\t\topacity: 0.7;\n\t\tpadding: ${ space( 2 ) } ${ space( 4 ) }; /* 8px 16px */\n\t\t${ rtl( { textAlign: 'left' }, { textAlign: 'right' } ) }\n\n\t\t&:hover,\n\t\t&:focus:not( [aria-disabled='true'] ):active,\n\t\t&:active:not( [aria-disabled='true'] ):active {\n\t\t\tcolor: inherit;\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t&.is-active {\n\t\tbackground-color: ${ UI.theme };\n\t\tcolor: ${ BASE.white };\n\n\t\t> button,\n\t\t> a {\n\t\t\tcolor: ${ BASE.white };\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t> svg path {\n\t\tcolor: ${ G2.lightGray.ui };\n\t}\n`;\n\nexport const ItemUI = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\theight: auto;\n\tmin-height: 40px;\n\tmargin: 0;\n\tpadding: ${ space( 1.5 ) } ${ space( 4 ) };\n\tfont-weight: 400;\n\tline-height: 20px;\n\twidth: 100%;\n\tcolor: inherit;\n\topacity: 0.7;\n`;\n\nexport const ItemIconUI = styled.span`\n\tdisplay: flex;\n\tmargin-right: ${ space( 2 ) };\n`;\n\nexport const ItemBadgeUI = styled.span`\n\tmargin-left: ${ () => ( isRTL() ? '0' : space( 2 ) ) };\n\tmargin-right: ${ () => ( isRTL() ? space( 2 ) : '0' ) };\n\tdisplay: inline-flex;\n\tpadding: ${ space( 1 ) } ${ space( 3 ) };\n\tborder-radius: 2px;\n\tanimation: fade-in 250ms ease-out;\n\n\t@keyframes fade-in {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t${ reduceMotion( 'animation' ) };\n`;\n\nexport const ItemTitleUI = styled( Text )`\n\t${ () => ( isRTL() ? 'margin-left: auto;' : 'margin-right: auto;' ) }\n\tfont-size: 14px;\n\tline-height: 20px;\n\tcolor: inherit;\n`;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/navigation/styles/navigation-styles.js"],"names":["NavigationUI","MenuUI","MenuBackButtonUI","Button","MenuTitleUI","MenuTitleActionsUI","MenuTitleSearchUI","SearchControl","GroupTitleUI","Heading","ItemBaseUI","textAlign","COLORS","ui","theme","white","gray","ItemUI","ItemIconUI","ItemBadgeUI","ItemTitleUI","Text"],"mappings":";;;;;;;;;;;AAQA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,kDAGV,kBAAO,CAAP,CAHU,i9MAAlB;;AAOA,MAAMC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,kBACH,kBAAO,CAAP,CADG,qBAEA,kBAAO,CAAP,CAFA,mIAWC,kBAAO,CAAP,CAXD,+EAeF,kBAAO,CAAP,CAfE,k8MAAZ;;AAmBA,MAAMC,gBAAgB,GAAG,iCAAQC,eAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAtB;;AAmBA,MAAMC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAjB;;AAKA,MAAMC,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,cACnB,kBAAO,CAAP,CADmB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O,CAAP,CAAV,GAAuB,GAFzB,mCAIX,kBAAO,CAAP,CAJW,OAIK,kBAAO,CAAP,CAJL,4GAiBpB,yBAAc,WAAd,CAjBoB,i8MAAjB;;AAoBA,MAAMC,WAAW,GAAG,iCAAQC,UAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,CACpB,MAAQ,qBAAU,oBAAV,GAAiC,qBADrB,++MAAjB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * WordPress dependencies\n */\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COLORS } from '../../utils/colors-values';\nimport Button from '../../button';\nimport { Text } from '../../text';\nimport { Heading } from '../../heading';\nimport { reduceMotion, rtl } from '../../utils';\nimport { space } from '../../ui/utils/space';\nimport SearchControl from '../../search-control';\n\nexport const NavigationUI = styled.div`\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 0 ${ space( 4 ) };\n\toverflow: hidden;\n`;\n\nexport const MenuUI = styled.div`\n\tmargin-top: ${ space( 6 ) };\n\tmargin-bottom: ${ space( 6 ) };\n\tdisplay: flex;\n\tflex-direction: column;\n\tul {\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\tlist-style: none;\n\t}\n\t.components-navigation__back-button {\n\t\tmargin-bottom: ${ space( 6 ) };\n\t}\n\n\t.components-navigation__group + .components-navigation__group {\n\t\tmargin-top: ${ space( 6 ) };\n\t}\n`;\n\nexport const MenuBackButtonUI = styled( Button )`\n\t&.is-tertiary {\n\t\tcolor: inherit;\n\t\topacity: 0.7;\n\n\t\t&:hover:not( :disabled ) {\n\t\t\topacity: 1;\n\t\t\tbox-shadow: none;\n\t\t\tcolor: inherit;\n\t\t}\n\n\t\t&:active:not( :disabled ) {\n\t\t\tbackground: transparent;\n\t\t\topacity: 1;\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n`;\n\nexport const MenuTitleUI = styled.div`\n\toverflow: hidden;\n\twidth: 100%;\n`;\n\nexport const MenuTitleActionsUI = styled.span`\n\theight: ${ space( 6 ) }; // 24px, same height as the buttons inside\n\n\t.components-button.is-small {\n\t\tcolor: inherit;\n\t\topacity: 0.7;\n\t\tmargin-right: ${ space( 1 ) }; // Avoid hiding the focus outline\n\t\tpadding: 0;\n\n\t\t&:active:not( :disabled ) {\n\t\t\tbackground: none;\n\t\t\topacity: 1;\n\t\t\tcolor: inherit;\n\t\t}\n\t\t&:hover:not( :disabled ) {\n\t\t\tbox-shadow: none;\n\t\t\topacity: 1;\n\t\t\tcolor: inherit;\n\t\t}\n\t}\n`;\n\nexport const MenuTitleSearchUI = styled( SearchControl )`\n\tinput[type='search'].components-search-control__input {\n\t\tmargin: 0;\n\t\tbackground: #303030;\n\t\tcolor: #fff;\n\n\t\t&:focus {\n\t\t\tbackground: #434343;\n\t\t\tcolor: #fff;\n\t\t}\n\n\t\t&::placeholder {\n\t\t\tcolor: rgba( 255, 255, 255, 0.6 );\n\t\t}\n\t}\n\n\tsvg {\n\t\tfill: white;\n\t}\n\n\t.components-button.has-icon {\n\t\tpadding: 0;\n\t\tmin-width: auto;\n\t}\n`;\n\nexport const GroupTitleUI = styled( Heading )`\n\tmin-height: ${ space( 12 ) };\n\talign-items: center;\n\tcolor: inherit;\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tmargin-bottom: ${ space( 2 ) };\n\tpadding: ${ () =>\n\t\tisRTL()\n\t\t\t? `${ space( 1 ) } ${ space( 4 ) } ${ space( 1 ) } ${ space( 2 ) }`\n\t\t\t: `${ space( 1 ) } ${ space( 2 ) } ${ space( 1 ) } ${ space(\n\t\t\t\t\t4\n\t\t\t ) }` };\n`;\n\nexport const ItemBaseUI = styled.li`\n\tborder-radius: 2px;\n\tcolor: inherit;\n\tmargin-bottom: 0;\n\n\t> button,\n\t> a.components-button,\n\t> a {\n\t\twidth: 100%;\n\t\tcolor: inherit;\n\t\topacity: 0.7;\n\t\tpadding: ${ space( 2 ) } ${ space( 4 ) }; /* 8px 16px */\n\t\t${ rtl( { textAlign: 'left' }, { textAlign: 'right' } ) }\n\n\t\t&:hover,\n\t\t&:focus:not( [aria-disabled='true'] ):active,\n\t\t&:active:not( [aria-disabled='true'] ):active {\n\t\t\tcolor: inherit;\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t&.is-active {\n\t\tbackground-color: ${ COLORS.ui.theme };\n\t\tcolor: ${ COLORS.white };\n\n\t\t> button,\n\t\t> a {\n\t\t\tcolor: ${ COLORS.white };\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t> svg path {\n\t\tcolor: ${ COLORS.gray[ 600 ] };\n\t}\n`;\n\nexport const ItemUI = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\theight: auto;\n\tmin-height: 40px;\n\tmargin: 0;\n\tpadding: ${ space( 1.5 ) } ${ space( 4 ) };\n\tfont-weight: 400;\n\tline-height: 20px;\n\twidth: 100%;\n\tcolor: inherit;\n\topacity: 0.7;\n`;\n\nexport const ItemIconUI = styled.span`\n\tdisplay: flex;\n\tmargin-right: ${ space( 2 ) };\n`;\n\nexport const ItemBadgeUI = styled.span`\n\tmargin-left: ${ () => ( isRTL() ? '0' : space( 2 ) ) };\n\tmargin-right: ${ () => ( isRTL() ? space( 2 ) : '0' ) };\n\tdisplay: inline-flex;\n\tpadding: ${ space( 1 ) } ${ space( 3 ) };\n\tborder-radius: 2px;\n\tanimation: fade-in 250ms ease-out;\n\n\t@keyframes fade-in {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\n\t${ reduceMotion( 'animation' ) };\n`;\n\nexport const ItemTitleUI = styled( Text )`\n\t${ () => ( isRTL() ? 'margin-left: auto;' : 'margin-right: auto;' ) }\n\tfont-size: 14px;\n\tline-height: 20px;\n\tcolor: inherit;\n`;\n"]}
@@ -28,6 +28,8 @@ var _style = _interopRequireDefault(require("./style.scss"));
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
+ const HIDE_TIMER = 3000;
32
+
31
33
  const Notice = _ref => {
32
34
  let {
33
35
  onNoticeHidden,
@@ -35,67 +37,69 @@ const Notice = _ref => {
35
37
  id,
36
38
  status
37
39
  } = _ref;
38
- const [width, setWidth] = (0, _element.useState)(_reactNative.Dimensions.get('window').width);
39
- const [visible, setVisible] = (0, _element.useState)(true);
40
+ const {
41
+ width
42
+ } = (0, _reactNative.useWindowDimensions)();
40
43
  const animationValue = (0, _element.useRef)(new _reactNative.Animated.Value(0)).current;
41
44
  const timer = (0, _element.useRef)(null);
42
- const isIOS = _reactNative.Platform.OS === 'ios';
43
-
44
- const onDimensionsChange = () => {
45
- setWidth(_reactNative.Dimensions.get('window').width);
46
- };
47
-
48
- (0, _element.useEffect)(() => {
49
- const dimensionsChangeSubscription = _reactNative.Dimensions.addEventListener('change', onDimensionsChange);
50
-
51
- return () => {
52
- dimensionsChangeSubscription.remove();
53
- };
54
- }, []);
55
45
  (0, _element.useEffect)(() => {
56
46
  startAnimation();
57
47
  return () => {
58
48
  clearTimeout(timer === null || timer === void 0 ? void 0 : timer.current);
59
49
  };
60
- }, [visible, id]);
50
+ }, []);
51
+
52
+ function onHide() {
53
+ _reactNative.Animated.timing(animationValue, {
54
+ toValue: 0,
55
+ duration: 150,
56
+ useNativeDriver: true,
57
+ easing: _reactNative.Easing.out(_reactNative.Easing.quad)
58
+ }).start(_ref2 => {
59
+ let {
60
+ finished
61
+ } = _ref2;
61
62
 
62
- const onHide = () => {
63
- setVisible(false);
64
- };
63
+ if (finished && onNoticeHidden) {
64
+ onNoticeHidden(id);
65
+ }
66
+ });
67
+ }
65
68
 
66
- const startAnimation = () => {
69
+ function startAnimation() {
67
70
  _reactNative.Animated.timing(animationValue, {
68
- toValue: visible ? 1 : 0,
69
- duration: visible ? 300 : 150,
71
+ toValue: 1,
72
+ duration: 300,
70
73
  useNativeDriver: true,
71
74
  easing: _reactNative.Easing.out(_reactNative.Easing.quad)
72
- }).start(() => {
73
- if (visible && onNoticeHidden) {
75
+ }).start(_ref3 => {
76
+ let {
77
+ finished
78
+ } = _ref3;
79
+
80
+ if (finished && onNoticeHidden) {
74
81
  timer.current = setTimeout(() => {
75
82
  onHide();
76
- }, 3000);
77
- }
78
-
79
- if (!visible && onNoticeHidden) {
80
- onNoticeHidden(id);
83
+ }, HIDE_TIMER);
81
84
  }
82
85
  });
83
- };
86
+ }
84
87
 
85
88
  const noticeSolidStyles = (0, _compose.usePreferredColorSchemeStyle)(_style.default.noticeSolid, _style.default.noticeSolidDark);
86
89
  const successTextStyles = (0, _compose.usePreferredColorSchemeStyle)(_style.default.successText, _style.default.successTextDark);
87
90
  const errorTextStyles = (0, _compose.usePreferredColorSchemeStyle)(_style.default.errorText, _style.default.errorTextDark);
88
91
  const textStyles = [status === 'success' && successTextStyles, status === 'error' && errorTextStyles];
89
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_reactNative.Animated.View, {
90
- style: [_style.default.notice, !isIOS && noticeSolidStyles, {
91
- width,
92
- transform: [{
93
- translateY: animationValue.interpolate({
94
- inputRange: [0, 1],
95
- outputRange: [-24, 0]
96
- })
97
- }]
92
+ const containerStyles = [_style.default.notice, !_element.Platform.isIOS && noticeSolidStyles, {
93
+ width,
94
+ transform: [{
95
+ translateY: animationValue.interpolate({
96
+ inputRange: [0, 1],
97
+ outputRange: [-24, 0]
98
+ })
98
99
  }]
100
+ }];
101
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_reactNative.Animated.View, {
102
+ style: containerStyles
99
103
  }, (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
100
104
  onPress: onHide
101
105
  }, (0, _element.createElement)(_reactNative.View, {
@@ -103,7 +107,7 @@ const Notice = _ref => {
103
107
  }, (0, _element.createElement)(_reactNative.Text, {
104
108
  numberOfLines: 3,
105
109
  style: textStyles
106
- }, content))), isIOS && (0, _element.createElement)(_blur.BlurView, {
110
+ }, content))), _element.Platform.isIOS && (0, _element.createElement)(_blur.BlurView, {
107
111
  style: _style.default.blurBackground,
108
112
  blurType: "prominent",
109
113
  blurAmount: 10
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/notice/index.native.js"],"names":["Notice","onNoticeHidden","content","id","status","width","setWidth","Dimensions","get","visible","setVisible","animationValue","Animated","Value","current","timer","isIOS","Platform","OS","onDimensionsChange","dimensionsChangeSubscription","addEventListener","remove","startAnimation","clearTimeout","onHide","timing","toValue","duration","useNativeDriver","easing","Easing","out","quad","start","setTimeout","noticeSolidStyles","styles","noticeSolid","noticeSolidDark","successTextStyles","successText","successTextDark","errorTextStyles","errorText","errorTextDark","textStyles","notice","transform","translateY","interpolate","inputRange","outputRange","noticeContent","blurBackground"],"mappings":";;;;;;;;;AAiBA;;AAdA;;AASA;;AAMA;;AAKA;;AAvBA;AACA;AACA;;AAYA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,MAAM,GAAG,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,OAAlB;AAA2BC,IAAAA,EAA3B;AAA+BC,IAAAA;AAA/B,GAA6C;AAC7D,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAUC,wBAAWC,GAAX,CAAgB,QAAhB,EAA2BH,KAArC,CAA5B;AACA,QAAM,CAAEI,OAAF,EAAWC,UAAX,IAA0B,uBAAU,IAAV,CAAhC;AAEA,QAAMC,cAAc,GAAG,qBAAQ,IAAIC,sBAASC,KAAb,CAAoB,CAApB,CAAR,EAAkCC,OAAzD;AACA,QAAMC,KAAK,GAAG,qBAAQ,IAAR,CAAd;AACA,QAAMC,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;;AAEA,QAAMC,kBAAkB,GAAG,MAAM;AAChCb,IAAAA,QAAQ,CAAEC,wBAAWC,GAAX,CAAgB,QAAhB,EAA2BH,KAA7B,CAAR;AACA,GAFD;;AAIA,0BAAW,MAAM;AAChB,UAAMe,4BAA4B,GAAGb,wBAAWc,gBAAX,CACpC,QADoC,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aAFgB,CAAxB;AAKA,QAAMC,UAAU,GAAG,CAClB1C,MAAM,KAAK,SAAX,IAAwBoC,iBADN,EAElBpC,MAAM,KAAK,OAAX,IAAsBuC,eAFJ,CAAnB;AAKA,SACC,qDACC,4BAAC,qBAAD,CAAU,IAAV;AACC,IAAA,KAAK,EAAG,CACPN,eAAOU,MADA,EAEP,CAAE/B,KAAF,IAAWoB,iBAFJ,EAGP;AACC/B,MAAAA,KADD;AAEC2C,MAAAA,SAAS,EAAE,CACV;AACCC,QAAAA,UAAU,EAAEtC,cAAc,CAACuC,WAAf,CAA4B;AACvCC,UAAAA,UAAU,EAAE,CAAE,CAAF,EAAK,CAAL,CAD2B;AAEvCC,UAAAA,WAAW,EAAE,CAAE,CAAC,EAAH,EAAO,CAAP;AAF0B,SAA5B;AADb,OADU;AAFZ,KAHO;AADT,KAiBC,4BAAC,qCAAD;AAA0B,IAAA,OAAO,EAAG3B;AAApC,KACC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGY,eAAOgB;AAArB,KACC,4BAAC,iBAAD;AAAM,IAAA,aAAa,EAAG,CAAtB;AAA0B,IAAA,KAAK,EAAGP;AAAlC,KACG5C,OADH,CADD,CADD,CAjBD,EAwBGc,KAAK,IACN,4BAAC,cAAD;AACC,IAAA,KAAK,EAAGqB,eAAOiB,cADhB;AAEC,IAAA,QAAQ,EAAC,WAFV;AAGC,IAAA,UAAU,EAAG;AAHd,IAzBF,CADD,CADD;AAoCA,CA5GD;;eA8GetD,M","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tAnimated,\n\tEasing,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n\tDimensions,\n\tPlatform,\n} from 'react-native';\nimport { BlurView } from '@react-native-community/blur';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst Notice = ( { onNoticeHidden, content, id, status } ) => {\n\tconst [ width, setWidth ] = useState( Dimensions.get( 'window' ).width );\n\tconst [ visible, setVisible ] = useState( true );\n\n\tconst animationValue = useRef( new Animated.Value( 0 ) ).current;\n\tconst timer = useRef( null );\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst onDimensionsChange = () => {\n\t\tsetWidth( Dimensions.get( 'window' ).width );\n\t};\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonDimensionsChange\n\t\t);\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tstartAnimation();\n\t\treturn () => {\n\t\t\tclearTimeout( timer?.current );\n\t\t};\n\t}, [ visible, id ] );\n\n\tconst onHide = () => {\n\t\tsetVisible( false );\n\t};\n\n\tconst startAnimation = () => {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: visible ? 1 : 0,\n\t\t\tduration: visible ? 300 : 150,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( () => {\n\t\t\tif ( visible && onNoticeHidden ) {\n\t\t\t\ttimer.current = setTimeout( () => {\n\t\t\t\t\tonHide();\n\t\t\t\t}, 3000 );\n\t\t\t}\n\n\t\t\tif ( ! visible && onNoticeHidden ) {\n\t\t\t\tonNoticeHidden( id );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst noticeSolidStyles = usePreferredColorSchemeStyle(\n\t\tstyles.noticeSolid,\n\t\tstyles.noticeSolidDark\n\t);\n\n\tconst successTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.successText,\n\t\tstyles.successTextDark\n\t);\n\n\tconst errorTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.errorText,\n\t\tstyles.errorTextDark\n\t);\n\n\tconst textStyles = [\n\t\tstatus === 'success' && successTextStyles,\n\t\tstatus === 'error' && errorTextStyles,\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Animated.View\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.notice,\n\t\t\t\t\t! isIOS && noticeSolidStyles,\n\t\t\t\t\t{\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttranslateY: animationValue.interpolate( {\n\t\t\t\t\t\t\t\t\tinputRange: [ 0, 1 ],\n\t\t\t\t\t\t\t\t\toutputRange: [ -24, 0 ],\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t},\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\t<TouchableWithoutFeedback onPress={ onHide }>\n\t\t\t\t\t<View style={ styles.noticeContent }>\n\t\t\t\t\t\t<Text numberOfLines={ 3 } style={ textStyles }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t{ isIOS && (\n\t\t\t\t\t<BlurView\n\t\t\t\t\t\tstyle={ styles.blurBackground }\n\t\t\t\t\t\tblurType=\"prominent\"\n\t\t\t\t\t\tblurAmount={ 10 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\nexport default Notice;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/notice/index.native.js"],"names":["HIDE_TIMER","Notice","onNoticeHidden","content","id","status","width","animationValue","Animated","Value","current","timer","startAnimation","clearTimeout","onHide","timing","toValue","duration","useNativeDriver","easing","Easing","out","quad","start","finished","setTimeout","noticeSolidStyles","styles","noticeSolid","noticeSolidDark","successTextStyles","successText","successTextDark","errorTextStyles","errorText","errorTextDark","textStyles","containerStyles","notice","Platform","isIOS","transform","translateY","interpolate","inputRange","outputRange","noticeContent","blurBackground"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAQA;;AAMA;;AAKA;;AAtBA;A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A,KAAK,EAAGV;AAAlC,KACGjC,OADH,CADD,CADD,CADD,EAQGoC,kBAASC,KAAT,IACD,4BAAC,cAAD;AACC,IAAA,KAAK,EAAGb,eAAOoB,cADhB;AAEC,IAAA,QAAQ,EAAC,WAFV;AAGC,IAAA,UAAU,EAAG;AAHd,IATF,CADD,CADD;AAoBA,CAjGD;;eAmGe9C,M","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tAnimated,\n\tEasing,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n\tuseWindowDimensions,\n} from 'react-native';\nimport { BlurView } from '@react-native-community/blur';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, Platform } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst HIDE_TIMER = 3000;\n\nconst Notice = ( { onNoticeHidden, content, id, status } ) => {\n\tconst { width } = useWindowDimensions();\n\tconst animationValue = useRef( new Animated.Value( 0 ) ).current;\n\tconst timer = useRef( null );\n\n\tuseEffect( () => {\n\t\tstartAnimation();\n\n\t\treturn () => {\n\t\t\tclearTimeout( timer?.current );\n\t\t};\n\t}, [] );\n\n\tfunction onHide() {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: 0,\n\t\t\tduration: 150,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( ( { finished } ) => {\n\t\t\tif ( finished && onNoticeHidden ) {\n\t\t\t\tonNoticeHidden( id );\n\t\t\t}\n\t\t} );\n\t}\n\n\tfunction startAnimation() {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: 1,\n\t\t\tduration: 300,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( ( { finished } ) => {\n\t\t\tif ( finished && onNoticeHidden ) {\n\t\t\t\ttimer.current = setTimeout( () => {\n\t\t\t\t\tonHide();\n\t\t\t\t}, HIDE_TIMER );\n\t\t\t}\n\t\t} );\n\t}\n\n\tconst noticeSolidStyles = usePreferredColorSchemeStyle(\n\t\tstyles.noticeSolid,\n\t\tstyles.noticeSolidDark\n\t);\n\n\tconst successTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.successText,\n\t\tstyles.successTextDark\n\t);\n\n\tconst errorTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.errorText,\n\t\tstyles.errorTextDark\n\t);\n\n\tconst textStyles = [\n\t\tstatus === 'success' && successTextStyles,\n\t\tstatus === 'error' && errorTextStyles,\n\t];\n\n\tconst containerStyles = [\n\t\tstyles.notice,\n\t\t! Platform.isIOS && noticeSolidStyles,\n\t\t{\n\t\t\twidth,\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: animationValue.interpolate( {\n\t\t\t\t\t\tinputRange: [ 0, 1 ],\n\t\t\t\t\t\toutputRange: [ -24, 0 ],\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Animated.View style={ containerStyles }>\n\t\t\t\t<TouchableWithoutFeedback onPress={ onHide }>\n\t\t\t\t\t<View style={ styles.noticeContent }>\n\t\t\t\t\t\t<Text numberOfLines={ 3 } style={ textStyles }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t{ Platform.isIOS && (\n\t\t\t\t\t<BlurView\n\t\t\t\t\t\tstyle={ styles.blurBackground }\n\t\t\t\t\t\tblurType=\"prominent\"\n\t\t\t\t\t\tblurAmount={ 10 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\nexport default Notice;\n"]}
@@ -15,7 +15,7 @@ var _reactNative = require("react-native");
15
15
 
16
16
  var _data = require("@wordpress/data");
17
17
 
18
- var _compose = require("@wordpress/compose");
18
+ var _notices = require("@wordpress/notices");
19
19
 
20
20
  var _ = _interopRequireDefault(require("./"));
21
21
 
@@ -32,57 +32,39 @@ var _style = _interopRequireDefault(require("./style.scss"));
32
32
  /**
33
33
  * Internal dependencies
34
34
  */
35
- class NoticeList extends _element.Component {
36
- constructor() {
37
- super(...arguments);
38
- this.removeNotice = this.removeNotice.bind(this);
39
- }
40
-
41
- removeNotice(id) {
35
+ function NoticeList() {
36
+ const {
37
+ notices
38
+ } = (0, _data.useSelect)(select => {
42
39
  const {
43
- removeNotice
44
- } = this.props;
40
+ getNotices
41
+ } = select(_notices.store);
42
+ return {
43
+ notices: getNotices()
44
+ };
45
+ }, []);
46
+ const {
47
+ removeNotice
48
+ } = (0, _data.useDispatch)(_notices.store);
49
+
50
+ function onRemoveNotice(id) {
45
51
  removeNotice(id);
46
52
  }
47
53
 
48
- render() {
49
- const {
50
- notices,
51
- shouldStack
52
- } = this.props;
53
-
54
- if (!notices.length) {
55
- return null;
56
- }
57
-
58
- return (0, _element.createElement)(_reactNative.View, {
59
- style: _style.default.list,
60
- key: notices.length
61
- }, shouldStack ? notices.reverse().map(notice => (0, _element.createElement)(_.default, (0, _extends2.default)({}, notice, {
62
- key: notice.id,
63
- onNoticeHidden: this.removeNotice
64
- }))) : (0, _element.createElement)(_.default, (0, _extends2.default)({}, notices[notices.length - 1], {
65
- onNoticeHidden: this.removeNotice
66
- })));
54
+ if (!notices.length) {
55
+ return null;
67
56
  }
68
57
 
58
+ return (0, _element.createElement)(_reactNative.View, {
59
+ style: _style.default.list
60
+ }, notices.map(notice => {
61
+ return (0, _element.createElement)(_.default, (0, _extends2.default)({}, notice, {
62
+ key: notice.id,
63
+ onNoticeHidden: onRemoveNotice
64
+ }));
65
+ }));
69
66
  }
70
67
 
71
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
72
- const {
73
- getNotices
74
- } = select('core/notices');
75
- return {
76
- notices: getNotices()
77
- };
78
- }), (0, _data.withDispatch)(dispatch => {
79
- const {
80
- removeNotice
81
- } = dispatch('core/notices');
82
- return {
83
- removeNotice
84
- };
85
- })])(NoticeList);
86
-
68
+ var _default = NoticeList;
87
69
  exports.default = _default;
88
70
  //# sourceMappingURL=list.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/notice/list.native.js"],"names":["NoticeList","Component","constructor","arguments","removeNotice","bind","id","props","render","notices","shouldStack","length","styles","list","reverse","map","notice","select","getNotices","dispatch"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,UAAN,SAAyBC,kBAAzB,CAAmC;AAClCC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,YAAL,GAAoB,KAAKA,YAAL,CAAkBC,IAAlB,CAAwB,IAAxB,CAApB;AACA;;AAEDD,EAAAA,YAAY,CAAEE,EAAF,EAAO;AAClB,UAAM;AAAEF,MAAAA;AAAF,QAAmB,KAAKG,KAA9B;AACAH,IAAAA,YAAY,CAAEE,EAAF,CAAZ;AACA;;AAEDE,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA2B,KAAKH,KAAtC;;AAEA,QAAK,CAAEE,OAAO,CAACE,MAAf,EAAwB;AACvB,aAAO,IAAP;AACA;;AAED,WACC,4BAAC,iBAAD;AAAM,MAAA,KAAK,EAAGC,eAAOC,IAArB;AAA4B,MAAA,GAAG,EAAGJ,OAAO,CAACE;AAA1C,OACGD,WAAW,GACZD,OAAO,CACLK,OADF,GAEEC,GAFF,CAESC,MAAF,IACL,4BAAC,SAAD,6BACMA,MADN;AAEC,MAAA,GAAG,EAAGA,MAAM,CAACV,EAFd;AAGC,MAAA,cAAc,EAAG,KAAKF;AAHvB,OAHF,CADY,GAWZ,4BAAC,SAAD,6BACMK,OAAO,CAAEA,OAAO,CAACE,MAAR,GAAiB,CAAnB,CADb;AAEC,MAAA,cAAc,EAAG,KAAKP;AAFvB,OAZF,CADD;AAoBA;;AAtCiC;;eAyCpB,sBAAS,CACvB,sBAAca,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAAiBD,MAAM,CAAE,cAAF,CAA7B;AAEA,SAAO;AACNR,IAAAA,OAAO,EAAES,UAAU;AADb,GAAP;AAGA,CAND,CADuB,EAQvB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEf,IAAAA;AAAF,MAAmBe,QAAQ,CAAE,cAAF,CAAjC;AAEA,SAAO;AACNf,IAAAA;AADM,GAAP;AAGA,CAND,CARuB,CAAT,EAeVJ,UAfU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Notice from './';\nimport styles from './style.scss';\n\nclass NoticeList extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.removeNotice = this.removeNotice.bind( this );\n\t}\n\n\tremoveNotice( id ) {\n\t\tconst { removeNotice } = this.props;\n\t\tremoveNotice( id );\n\t}\n\n\trender() {\n\t\tconst { notices, shouldStack } = this.props;\n\n\t\tif ( ! notices.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ styles.list } key={ notices.length }>\n\t\t\t\t{ shouldStack ? (\n\t\t\t\t\tnotices\n\t\t\t\t\t\t.reverse()\n\t\t\t\t\t\t.map( ( notice ) => (\n\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t{ ...notice }\n\t\t\t\t\t\t\t\tkey={ notice.id }\n\t\t\t\t\t\t\t\tonNoticeHidden={ this.removeNotice }\n\t\t\t\t\t\t\t></Notice>\n\t\t\t\t\t\t) )\n\t\t\t\t) : (\n\t\t\t\t\t<Notice\n\t\t\t\t\t\t{ ...notices[ notices.length - 1 ] }\n\t\t\t\t\t\tonNoticeHidden={ this.removeNotice }\n\t\t\t\t\t></Notice>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getNotices } = select( 'core/notices' );\n\n\t\treturn {\n\t\t\tnotices: getNotices(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { removeNotice } = dispatch( 'core/notices' );\n\n\t\treturn {\n\t\t\tremoveNotice,\n\t\t};\n\t} ),\n] )( NoticeList );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/notice/list.native.js"],"names":["NoticeList","notices","select","getNotices","noticesStore","removeNotice","onRemoveNotice","id","length","styles","list","map","notice"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,UAAT,GAAsB;AACrB,QAAM;AAAEC,IAAAA;AAAF,MAAc,qBAAaC,MAAF,IAAc;AAC5C,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,MAAM,CAAEE,cAAF,CAA7B;AACA,WAAO;AACNH,MAAAA,OAAO,EAAEE,UAAU;AADb,KAAP;AAGA,GALmB,EAKjB,EALiB,CAApB;AAOA,QAAM;AAAEE,IAAAA;AAAF,MAAmB,uBAAaD,cAAb,CAAzB;;AAEA,WAASE,cAAT,CAAyBC,EAAzB,EAA8B;AAC7BF,IAAAA,YAAY,CAAEE,EAAF,CAAZ;AACA;;AAED,MAAK,CAAEN,OAAO,CAACO,MAAf,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGC,eAAOC;AAArB,KACGT,OAAO,CAACU,GAAR,CAAeC,MAAF,IAAc;AAC5B,WACC,4BAAC,SAAD,6BACMA,MADN;AAEC,MAAA,GAAG,EAAGA,MAAM,CAACL,EAFd;AAGC,MAAA,cAAc,EAAGD;AAHlB,OADD;AAOA,GARC,CADH,CADD;AAaA;;eAEcN,U","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport Notice from './';\nimport styles from './style.scss';\n\nfunction NoticeList() {\n\tconst { notices } = useSelect( ( select ) => {\n\t\tconst { getNotices } = select( noticesStore );\n\t\treturn {\n\t\t\tnotices: getNotices(),\n\t\t};\n\t}, [] );\n\n\tconst { removeNotice } = useDispatch( noticesStore );\n\n\tfunction onRemoveNotice( id ) {\n\t\tremoveNotice( id );\n\t}\n\n\tif ( ! notices.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<View style={ styles.list }>\n\t\t\t{ notices.map( ( notice ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Notice\n\t\t\t\t\t\t{ ...notice }\n\t\t\t\t\t\tkey={ notice.id }\n\t\t\t\t\t\tonNoticeHidden={ onRemoveNotice }\n\t\t\t\t\t></Notice>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</View>\n\t);\n}\n\nexport default NoticeList;\n"]}
@@ -53,8 +53,7 @@ const slotNameContext = (0, _element.createContext)();
53
53
 
54
54
  function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
55
55
  let anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
56
- let shouldAnchorIncludePadding = arguments.length > 4 ? arguments[4] : undefined;
57
- let container = arguments.length > 5 ? arguments[5] : undefined;
56
+ let container = arguments.length > 4 ? arguments[4] : undefined;
58
57
 
59
58
  if (anchorRect) {
60
59
  return anchorRect;
@@ -86,12 +85,7 @@ function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
86
85
 
87
86
  if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.getBoundingClientRect) === 'function') {
88
87
  const rect = (0, _utils.offsetIframe)(anchorRef.getBoundingClientRect(), anchorRef.ownerDocument, container);
89
-
90
- if (shouldAnchorIncludePadding) {
91
- return rect;
92
- }
93
-
94
- return withoutPadding(rect, anchorRef);
88
+ return rect;
95
89
  }
96
90
 
97
91
  const {
@@ -100,13 +94,7 @@ function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
100
94
  } = anchorRef;
101
95
  const topRect = top.getBoundingClientRect();
102
96
  const bottomRect = bottom.getBoundingClientRect();
103
- const rect = (0, _utils.offsetIframe)(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
104
-
105
- if (shouldAnchorIncludePadding) {
106
- return rect;
107
- }
108
-
109
- return withoutPadding(rect, anchorRef);
97
+ return (0, _utils.offsetIframe)(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
110
98
  }
111
99
 
112
100
  if (!anchorRefFallback.current) {
@@ -116,40 +104,7 @@ function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
116
104
  const {
117
105
  parentNode
118
106
  } = anchorRefFallback.current;
119
- const rect = (0, _utils.offsetIframe)(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
120
-
121
- if (shouldAnchorIncludePadding) {
122
- return rect;
123
- }
124
-
125
- return withoutPadding(rect, parentNode);
126
- }
127
-
128
- function getComputedStyle(node) {
129
- return node.ownerDocument.defaultView.getComputedStyle(node);
130
- }
131
-
132
- function withoutPadding(rect, element) {
133
- const {
134
- paddingTop,
135
- paddingBottom,
136
- paddingLeft,
137
- paddingRight
138
- } = getComputedStyle(element);
139
- const top = paddingTop ? parseInt(paddingTop, 10) : 0;
140
- const bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0;
141
- const left = paddingLeft ? parseInt(paddingLeft, 10) : 0;
142
- const right = paddingRight ? parseInt(paddingRight, 10) : 0;
143
- return {
144
- x: rect.left + left,
145
- y: rect.top + top,
146
- width: rect.width - left - right,
147
- height: rect.height - top - bottom,
148
- left: rect.left + left,
149
- right: rect.right - right,
150
- top: rect.top + top,
151
- bottom: rect.bottom - bottom
152
- };
107
+ return (0, _utils.offsetIframe)(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
153
108
  }
154
109
  /**
155
110
  * Sets or removes an element attribute.
@@ -238,7 +193,6 @@ const Popover = (_ref, ref) => {
238
193
  range,
239
194
  focusOnMount = 'firstElement',
240
195
  anchorRef,
241
- shouldAnchorIncludePadding,
242
196
  anchorRect,
243
197
  getAnchorRect,
244
198
  expandOnMobile,
@@ -285,7 +239,7 @@ const Popover = (_ref, ref) => {
285
239
  return;
286
240
  }
287
241
 
288
- let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, containerRef.current);
242
+ let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, containerRef.current);
289
243
 
290
244
  if (!anchor) {
291
245
  return;
@@ -412,7 +366,7 @@ const Popover = (_ref, ref) => {
412
366
  observer.disconnect();
413
367
  }
414
368
  };
415
- }, [isExpanded, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
369
+ }, [isExpanded, anchorRect, getAnchorRect, anchorRef, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
416
370
 
417
371
  const onDialogClose = (type, event) => {
418
372
  // Ideally the popover should have just a single onClose prop and
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["SLOT_NAME","slotNameContext","computeAnchorRect","anchorRefFallback","anchorRect","getAnchorRect","anchorRef","shouldAnchorIncludePadding","container","current","rect","ownerDocument","window","Range","Element","DOMRect","cloneRange","endContainer","getBoundingClientRect","withoutPadding","top","bottom","topRect","bottomRect","left","width","parentNode","getComputedStyle","node","defaultView","element","paddingTop","paddingBottom","paddingLeft","paddingRight","parseInt","right","x","y","height","setAttribute","name","value","hasAttribute","removeAttribute","getAttribute","setStyle","property","style","setClass","toggle","classList","contains","add","remove","getAnchorDocument","anchor","Popover","ref","headerTitle","onClose","children","className","noArrow","isAlternate","position","range","focusOnMount","expandOnMobile","animate","onFocusOutside","__unstableStickyBoundaryElement","__unstableSlotName","__unstableObserveElement","__unstableBoundaryParent","__unstableForcePosition","__unstableForceXAlignment","__unstableEditorCanvasWrapper","contentProps","contentRef","containerRef","isMobileViewport","animateOrigin","setAnimateOrigin","slotName","slot","isExpanded","containerResizeListener","contentSize","refresh","offsetParent","relativeOffsetTop","body","offsetParentRect","boundaryElement","parentElement","usedContentSize","popoverTop","popoverLeft","xAxis","yAxis","contentHeight","contentWidth","yAxisMapping","xAxisMapping","animateYAxis","animateXAxis","intervalHandle","setInterval","rafId","refreshOnAnimationFrame","cancelAnimationFrame","requestAnimationFrame","addEventListener","anchorDocument","observer","MutationObserver","observe","attributes","clearInterval","removeEventListener","disconnect","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","mergedRefs","animateClassName","Boolean","origin","content","close","PopoverContainer","PopoverSlot","Slot","__unstableSlotNameProvider","Provider"],"mappings":";;;;;;;;;AASA;;;;AALA;;AAaA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAjCA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,SAAlB;AAEA,MAAMC,eAAe,GAAG,6BAAxB;;AAEA,SAASC,iBAAT,CACCC,iBADD,EAECC,UAFD,EAGCC,aAHD,EAOE;AAAA,MAHDC,SAGC,uEAHW,KAGX;AAAA,MAFDC,0BAEC;AAAA,MADDC,SACC;;AACD,MAAKJ,UAAL,EAAkB;AACjB,WAAOA,UAAP;AACA;;AAED,MAAKC,aAAL,EAAqB;AACpB,QAAK,CAAEF,iBAAiB,CAACM,OAAzB,EAAmC;AAClC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AAA,SAAS,EAAC,2BADX;AAEC,IAAA,IAAI,EAAG0E,YAFR;AAGC,IAAA,OAAO,EAAGzE;AAHX,IAJD,CAlBF,EA6BC;AAAK,IAAA,GAAG,EAAGmB,UAAX;AAAwB,IAAA,SAAS,EAAC;AAAlC,KACC;AAAK,IAAA,KAAK,EAAG;AAAEd,MAAAA,QAAQ,EAAE;AAAZ;AAAb,KACGsB,uBADH,EAEG1B,QAFH,CADD,CA7BD,CAHD;;AAyCA,MAAKwB,IAAI,CAAC3B,GAAV,EAAgB;AACf0E,IAAAA,OAAO,GAAG,4BAAC,cAAD;AAAM,MAAA,IAAI,EAAGhD;AAAb,OAA0BgD,OAA1B,CAAV;AACA;;AAED,MAAK9H,SAAS,IAAIF,UAAlB,EAA+B;AAC9B,WAAOgI,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAGjI;AAAZ,KAAkCiI,OAAlC,CAAP;AACA,CA1UD;;AA4UA,MAAME,gBAAgB,GAAG,yBAAY7E,OAAZ,CAAzB;;AAEA,SAAS8E,WAAT,QAA4C7E,GAA5C,EAAkD;AAAA,MAA5B;AAAEjB,IAAAA,IAAI,GAAGzC;AAAT,GAA4B;AACjD,SACC,4BAAC,cAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGyC,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGiB;AAJP,IADD;AAQA;;AAED4E,gBAAgB,CAACE,IAAjB,GAAwB,yBAAYD,WAAZ,CAAxB;AACAD,gBAAgB,CAACG,0BAAjB,GAA8CxI,eAAe,CAACyI,QAA9D;eAEeJ,gB","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseState,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { getRectangleFromRange } from '@wordpress/dom';\nimport {\n\tuseViewportMatch,\n\tuseResizeObserver,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { computePopoverPosition, offsetIframe } from './utils';\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport { getAnimateClassName } from '../animate';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\nconst slotNameContext = createContext();\n\nfunction computeAnchorRect(\n\tanchorRefFallback,\n\tanchorRect,\n\tgetAnchorRect,\n\tanchorRef = false,\n\tshouldAnchorIncludePadding,\n\tcontainer\n) {\n\tif ( anchorRect ) {\n\t\treturn anchorRect;\n\t}\n\n\tif ( getAnchorRect ) {\n\t\tif ( ! anchorRefFallback.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rect = getAnchorRect( anchorRefFallback.current );\n\t\treturn offsetIframe(\n\t\t\trect,\n\t\t\trect.ownerDocument || anchorRefFallback.current.ownerDocument,\n\t\t\tcontainer\n\t\t);\n\t}\n\n\tif ( anchorRef !== false ) {\n\t\tif (\n\t\t\t! anchorRef ||\n\t\t\t! window.Range ||\n\t\t\t! window.Element ||\n\t\t\t! window.DOMRect\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Duck-type to check if `anchorRef` is an instance of Range\n\t\t// `anchorRef instanceof window.Range` checks will break across document boundaries\n\t\t// such as in an iframe.\n\t\tif ( typeof anchorRef?.cloneRange === 'function' ) {\n\t\t\treturn offsetIframe(\n\t\t\t\tgetRectangleFromRange( anchorRef ),\n\t\t\t\tanchorRef.endContainer.ownerDocument,\n\t\t\t\tcontainer\n\t\t\t);\n\t\t}\n\n\t\t// Duck-type to check if `anchorRef` is an instance of Element\n\t\t// `anchorRef instanceof window.Element` checks will break across document boundaries\n\t\t// such as in an iframe.\n\t\tif ( typeof anchorRef?.getBoundingClientRect === 'function' ) {\n\t\t\tconst rect = offsetIframe(\n\t\t\t\tanchorRef.getBoundingClientRect(),\n\t\t\t\tanchorRef.ownerDocument,\n\t\t\t\tcontainer\n\t\t\t);\n\n\t\t\tif ( shouldAnchorIncludePadding ) {\n\t\t\t\treturn rect;\n\t\t\t}\n\n\t\t\treturn withoutPadding( rect, anchorRef );\n\t\t}\n\n\t\tconst { top, bottom } = anchorRef;\n\t\tconst topRect = top.getBoundingClientRect();\n\t\tconst bottomRect = bottom.getBoundingClientRect();\n\t\tconst rect = offsetIframe(\n\t\t\tnew window.DOMRect(\n\t\t\t\ttopRect.left,\n\t\t\t\ttopRect.top,\n\t\t\t\ttopRect.width,\n\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t),\n\t\t\ttop.ownerDocument,\n\t\t\tcontainer\n\t\t);\n\n\t\tif ( shouldAnchorIncludePadding ) {\n\t\t\treturn rect;\n\t\t}\n\n\t\treturn withoutPadding( rect, anchorRef );\n\t}\n\n\tif ( ! anchorRefFallback.current ) {\n\t\treturn;\n\t}\n\n\tconst { parentNode } = anchorRefFallback.current;\n\tconst rect = offsetIframe(\n\t\tparentNode.getBoundingClientRect(),\n\t\tparentNode.ownerDocument,\n\t\tcontainer\n\t);\n\n\tif ( shouldAnchorIncludePadding ) {\n\t\treturn rect;\n\t}\n\n\treturn withoutPadding( rect, parentNode );\n}\n\nfunction getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nfunction withoutPadding( rect, element ) {\n\tconst {\n\t\tpaddingTop,\n\t\tpaddingBottom,\n\t\tpaddingLeft,\n\t\tpaddingRight,\n\t} = getComputedStyle( element );\n\tconst top = paddingTop ? parseInt( paddingTop, 10 ) : 0;\n\tconst bottom = paddingBottom ? parseInt( paddingBottom, 10 ) : 0;\n\tconst left = paddingLeft ? parseInt( paddingLeft, 10 ) : 0;\n\tconst right = paddingRight ? parseInt( paddingRight, 10 ) : 0;\n\n\treturn {\n\t\tx: rect.left + left,\n\t\ty: rect.top + top,\n\t\twidth: rect.width - left - right,\n\t\theight: rect.height - top - bottom,\n\t\tleft: rect.left + left,\n\t\tright: rect.right - right,\n\t\ttop: rect.top + top,\n\t\tbottom: rect.bottom - bottom,\n\t};\n}\n\n/**\n * Sets or removes an element attribute.\n *\n * @param {Element} element The element to modify.\n * @param {string} name The attribute name to set or remove.\n * @param {?string} value The value to set. A falsy value will remove the\n * attribute.\n */\nfunction setAttribute( element, name, value ) {\n\tif ( ! value ) {\n\t\tif ( element.hasAttribute( name ) ) {\n\t\t\telement.removeAttribute( name );\n\t\t}\n\t} else if ( element.getAttribute( name ) !== value ) {\n\t\telement.setAttribute( name, value );\n\t}\n}\n\n/**\n * Sets or removes an element style property.\n *\n * @param {Element} element The element to modify.\n * @param {string} property The property to set or remove.\n * @param {?string} value The value to set. A falsy value will remove the\n * property.\n */\nfunction setStyle( element, property, value = '' ) {\n\tif ( element.style[ property ] !== value ) {\n\t\telement.style[ property ] = value;\n\t}\n}\n\n/**\n * Sets or removes an element class.\n *\n * @param {Element} element The element to modify.\n * @param {string} name The class to set or remove.\n * @param {boolean} toggle True to set the class, false to remove.\n */\nfunction setClass( element, name, toggle ) {\n\tif ( toggle ) {\n\t\tif ( ! element.classList.contains( name ) ) {\n\t\t\telement.classList.add( name );\n\t\t}\n\t} else if ( element.classList.contains( name ) ) {\n\t\telement.classList.remove( name );\n\t}\n}\n\nfunction getAnchorDocument( anchor ) {\n\tif ( ! anchor ) {\n\t\treturn;\n\t}\n\n\tif ( anchor.endContainer ) {\n\t\treturn anchor.endContainer.ownerDocument;\n\t}\n\n\tif ( anchor.top ) {\n\t\treturn anchor.top.ownerDocument;\n\t}\n\n\treturn anchor.ownerDocument;\n}\n\nconst Popover = (\n\t{\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\t// Disable reason: We generate the `...contentProps` rest as remainder\n\t\t// of props which aren't explicitly handled by this component.\n\t\t/* eslint-disable no-unused-vars */\n\t\tposition = 'bottom right',\n\t\trange,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tshouldAnchorIncludePadding,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tanimate = true,\n\t\tonFocusOutside,\n\t\t__unstableStickyBoundaryElement,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\t__unstableObserveElement,\n\t\t__unstableBoundaryParent,\n\t\t__unstableForcePosition,\n\t\t__unstableForceXAlignment,\n\t\t__unstableEditorCanvasWrapper,\n\t\t/* eslint-enable no-unused-vars */\n\t\t...contentProps\n\t},\n\tref\n) => {\n\tconst anchorRefFallback = useRef( null );\n\tconst contentRef = useRef( null );\n\tconst containerRef = useRef();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ animateOrigin, setAnimateOrigin ] = useState();\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst [ containerResizeListener, contentSize ] = useResizeObserver();\n\tnoArrow = isExpanded || noArrow;\n\n\tuseLayoutEffect( () => {\n\t\tif ( isExpanded ) {\n\t\t\tsetClass( containerRef.current, 'is-without-arrow', noArrow );\n\t\t\tsetClass( containerRef.current, 'is-alternate', isAlternate );\n\t\t\tsetAttribute( containerRef.current, 'data-x-axis' );\n\t\t\tsetAttribute( containerRef.current, 'data-y-axis' );\n\t\t\tsetStyle( containerRef.current, 'top' );\n\t\t\tsetStyle( containerRef.current, 'left' );\n\t\t\tsetStyle( contentRef.current, 'maxHeight' );\n\t\t\tsetStyle( contentRef.current, 'maxWidth' );\n\t\t\treturn;\n\t\t}\n\n\t\tconst refresh = () => {\n\t\t\tif ( ! containerRef.current || ! contentRef.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet anchor = computeAnchorRect(\n\t\t\t\tanchorRefFallback,\n\t\t\t\tanchorRect,\n\t\t\t\tgetAnchorRect,\n\t\t\t\tanchorRef,\n\t\t\t\tshouldAnchorIncludePadding,\n\t\t\t\tcontainerRef.current\n\t\t\t);\n\n\t\t\tif ( ! anchor ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { offsetParent, ownerDocument } = containerRef.current;\n\n\t\t\tlet relativeOffsetTop = 0;\n\n\t\t\t// If there is a positioned ancestor element that is not the body,\n\t\t\t// subtract the position from the anchor rect. If the position of\n\t\t\t// the popover is fixed, the offset parent is null or the body\n\t\t\t// element, in which case the position is relative to the viewport.\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent\n\t\t\tif ( offsetParent && offsetParent !== ownerDocument.body ) {\n\t\t\t\tconst offsetParentRect = offsetParent.getBoundingClientRect();\n\n\t\t\t\trelativeOffsetTop = offsetParentRect.top;\n\t\t\t\tanchor = new window.DOMRect(\n\t\t\t\t\tanchor.left - offsetParentRect.left,\n\t\t\t\t\tanchor.top - offsetParentRect.top,\n\t\t\t\t\tanchor.width,\n\t\t\t\t\tanchor.height\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet boundaryElement;\n\t\t\tif ( __unstableBoundaryParent ) {\n\t\t\t\tboundaryElement = containerRef.current.parentElement;\n\t\t\t}\n\n\t\t\tconst usedContentSize = ! contentSize.height\n\t\t\t\t? contentRef.current.getBoundingClientRect()\n\t\t\t\t: contentSize;\n\n\t\t\tconst {\n\t\t\t\tpopoverTop,\n\t\t\t\tpopoverLeft,\n\t\t\t\txAxis,\n\t\t\t\tyAxis,\n\t\t\t\tcontentHeight,\n\t\t\t\tcontentWidth,\n\t\t\t} = computePopoverPosition(\n\t\t\t\tanchor,\n\t\t\t\tusedContentSize,\n\t\t\t\tposition,\n\t\t\t\t__unstableStickyBoundaryElement,\n\t\t\t\tcontainerRef.current,\n\t\t\t\trelativeOffsetTop,\n\t\t\t\tboundaryElement,\n\t\t\t\t__unstableForcePosition,\n\t\t\t\t__unstableForceXAlignment,\n\t\t\t\t__unstableEditorCanvasWrapper\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\ttypeof popoverTop === 'number' &&\n\t\t\t\ttypeof popoverLeft === 'number'\n\t\t\t) {\n\t\t\t\tsetStyle( containerRef.current, 'top', popoverTop + 'px' );\n\t\t\t\tsetStyle( containerRef.current, 'left', popoverLeft + 'px' );\n\t\t\t}\n\n\t\t\tsetClass(\n\t\t\t\tcontainerRef.current,\n\t\t\t\t'is-without-arrow',\n\t\t\t\tnoArrow || ( xAxis === 'center' && yAxis === 'middle' )\n\t\t\t);\n\t\t\tsetClass( containerRef.current, 'is-alternate', isAlternate );\n\t\t\tsetAttribute( containerRef.current, 'data-x-axis', xAxis );\n\t\t\tsetAttribute( containerRef.current, 'data-y-axis', yAxis );\n\t\t\tsetStyle(\n\t\t\t\tcontentRef.current,\n\t\t\t\t'maxHeight',\n\t\t\t\ttypeof contentHeight === 'number' ? contentHeight + 'px' : ''\n\t\t\t);\n\t\t\tsetStyle(\n\t\t\t\tcontentRef.current,\n\t\t\t\t'maxWidth',\n\t\t\t\ttypeof contentWidth === 'number' ? contentWidth + 'px' : ''\n\t\t\t);\n\n\t\t\t// Compute the animation position.\n\t\t\tconst yAxisMapping = {\n\t\t\t\ttop: 'bottom',\n\t\t\t\tbottom: 'top',\n\t\t\t};\n\t\t\tconst xAxisMapping = {\n\t\t\t\tleft: 'right',\n\t\t\t\tright: 'left',\n\t\t\t};\n\t\t\tconst animateYAxis = yAxisMapping[ yAxis ] || 'middle';\n\t\t\tconst animateXAxis = xAxisMapping[ xAxis ] || 'center';\n\n\t\t\tsetAnimateOrigin( animateXAxis + ' ' + animateYAxis );\n\t\t};\n\n\t\trefresh();\n\n\t\tconst { ownerDocument } = containerRef.current;\n\t\tconst { defaultView } = ownerDocument;\n\n\t\t/*\n\t\t * There are sometimes we need to reposition or resize the popover that\n\t\t * are not handled by the resize/scroll window events (i.e. CSS changes\n\t\t * in the layout that changes the position of the anchor).\n\t\t *\n\t\t * For these situations, we refresh the popover every 0.5s\n\t\t */\n\t\tconst intervalHandle = defaultView.setInterval( refresh, 500 );\n\n\t\tlet rafId;\n\n\t\tconst refreshOnAnimationFrame = () => {\n\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\trafId = defaultView.requestAnimationFrame( refresh );\n\t\t};\n\n\t\t// Sometimes a click trigger a layout change that affects the popover\n\t\t// position. This is an opportunity to immediately refresh rather than\n\t\t// at the interval.\n\t\tdefaultView.addEventListener( 'click', refreshOnAnimationFrame );\n\t\tdefaultView.addEventListener( 'resize', refresh );\n\t\tdefaultView.addEventListener( 'scroll', refresh, true );\n\n\t\tconst anchorDocument = getAnchorDocument( anchorRef );\n\n\t\t// If the anchor is within an iframe, the popover position also needs\n\t\t// to refrest when the iframe content is scrolled or resized.\n\t\tif ( anchorDocument && anchorDocument !== ownerDocument ) {\n\t\t\tanchorDocument.defaultView.addEventListener( 'resize', refresh );\n\t\t\tanchorDocument.defaultView.addEventListener(\n\t\t\t\t'scroll',\n\t\t\t\trefresh,\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\tlet observer;\n\n\t\tif ( __unstableObserveElement ) {\n\t\t\tobserver = new defaultView.MutationObserver( refresh );\n\t\t\tobserver.observe( __unstableObserveElement, { attributes: true } );\n\t\t}\n\n\t\treturn () => {\n\t\t\tdefaultView.clearInterval( intervalHandle );\n\t\t\tdefaultView.removeEventListener( 'resize', refresh );\n\t\t\tdefaultView.removeEventListener( 'scroll', refresh, true );\n\t\t\tdefaultView.removeEventListener( 'click', refreshOnAnimationFrame );\n\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\n\t\t\tif ( anchorDocument && anchorDocument !== ownerDocument ) {\n\t\t\t\tanchorDocument.defaultView?.removeEventListener(\n\t\t\t\t\t'resize',\n\t\t\t\t\trefresh\n\t\t\t\t);\n\t\t\t\tanchorDocument.defaultView?.removeEventListener(\n\t\t\t\t\t'scroll',\n\t\t\t\t\trefresh,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( observer ) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [\n\t\tisExpanded,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\tanchorRef,\n\t\tshouldAnchorIncludePadding,\n\t\tposition,\n\t\tcontentSize,\n\t\t__unstableStickyBoundaryElement,\n\t\t__unstableObserveElement,\n\t\t__unstableBoundaryParent,\n\t] );\n\n\tconst onDialogClose = ( type, event ) => {\n\t\t// Ideally the popover should have just a single onClose prop and\n\t\t// not three props that potentially do the same thing.\n\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\tonFocusOutside( event );\n\t\t} else if ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst mergedRefs = useMergeRefs( [ containerRef, dialogRef, ref ] );\n\n\t/** @type {false | string} */\n\tconst animateClassName =\n\t\tBoolean( animate && animateOrigin ) &&\n\t\tgetAnimateClassName( {\n\t\t\ttype: 'appear',\n\t\t\torigin: animateOrigin,\n\t\t} );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-popover',\n\t\t\t\tclassName,\n\t\t\t\tanimateClassName,\n\t\t\t\t{\n\t\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t\t'is-without-arrow': noArrow,\n\t\t\t\t\t'is-alternate': isAlternate,\n\t\t\t\t}\n\t\t\t) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedRefs }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex=\"-1\"\n\t\t>\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div ref={ contentRef } className=\"components-popover__content\">\n\t\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t\t{ containerResizeListener }\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\nconst PopoverContainer = forwardRef( Popover );\n\nfunction PopoverSlot( { name = SLOT_NAME }, ref ) {\n\treturn (\n\t\t<Slot\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nPopoverContainer.Slot = forwardRef( PopoverSlot );\nPopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default PopoverContainer;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["SLOT_NAME","slotNameContext","computeAnchorRect","anchorRefFallback","anchorRect","getAnchorRect","anchorRef","container","current","rect","ownerDocument","window","Range","Element","DOMRect","cloneRange","endContainer","getBoundingClientRect","top","bottom","topRect","bottomRect","left","width","parentNode","setAttribute","element","name","value","hasAttribute","removeAttribute","getAttribute","setStyle","property","style","setClass","toggle","classList","contains","add","remove","getAnchorDocument","anchor","Popover","ref","headerTitle","onClose","children","className","noArrow","isAlternate","position","range","focusOnMount","expandOnMobile","animate","onFocusOutside","__unstableStickyBoundaryElement","__unstableSlotName","__unstableObserveElement","__unstableBoundaryParent","__unstableForcePosition","__unstableForceXAlignment","__unstableEditorCanvasWrapper","contentProps","contentRef","containerRef","isMobileViewport","animateOrigin","setAnimateOrigin","slotName","slot","isExpanded","containerResizeListener","contentSize","refresh","offsetParent","relativeOffsetTop","body","offsetParentRect","height","boundaryElement","parentElement","usedContentSize","popoverTop","popoverLeft","xAxis","yAxis","contentHeight","contentWidth","yAxisMapping","xAxisMapping","right","animateYAxis","animateXAxis","defaultView","intervalHandle","setInterval","rafId","refreshOnAnimationFrame","cancelAnimationFrame","requestAnimationFrame","addEventListener","anchorDocument","observer","MutationObserver","observe","attributes","clearInterval","removeEventListener","disconnect","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","mergedRefs","animateClassName","Boolean","origin","content","close","PopoverContainer","PopoverSlot","Slot","__unstableSlotNameProvider","Provider"],"mappings":";;;;;;;;;AASA;;;;AALA;;AAaA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAjCA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,SAAlB;AAEA,MAAMC,eAAe,GAAG,6BAAxB;;AAEA,SAASC,iBAAT,CACCC,iBADD,EAECC,UAFD,EAGCC,aAHD,EAME;AAAA,MAFDC,SAEC,uEAFW,KAEX;AAAA,MADDC,SACC;;AACD,MAAKH,UAAL,EAAkB;AACjB,WAAOA,UAAP;AACA;;AAED,MAAKC,aAAL,EAAqB;AACpB,QAAK,CAAEF,iBAAiB,CAACK,OAAzB,EAAmC;AAClC;AACA;;AAED,UAAMC,IAAI,GAAGJ,aAAa,CAAEF,iBAAiB,CAACK,OAApB,CAA1B;AACA,WAAO,yBACNC,IADM,EAENA,IAAI,CAACC,aAAL,IAAsBP,iBAAiB,CAACK,OAAlB,CAA0BE,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CsH,OAAlC,CAAP;AACA,CAvUD;;AAyUA,MAAME,gBAAgB,GAAG,yBAAYhF,OAAZ,CAAzB;;AAEA,SAASiF,WAAT,QAA4ChF,GAA5C,EAAkD;AAAA,MAA5B;AAAEjB,IAAAA,IAAI,GAAG3B;AAAT,GAA4B;AACjD,SACC,4BAAC,cAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAG2B,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGiB;AAJP,IADD;AAQA;;AAED+E,gBAAgB,CAACE,IAAjB,GAAwB,yBAAYD,WAAZ,CAAxB;AACAD,gBAAgB,CAACG,0BAAjB,GAA8C7H,eAAe,CAAC8H,QAA9D;eAEeJ,gB","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseState,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { getRectangleFromRange } from '@wordpress/dom';\nimport {\n\tuseViewportMatch,\n\tuseResizeObserver,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { computePopoverPosition, offsetIframe } from './utils';\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport { getAnimateClassName } from '../animate';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\nconst slotNameContext = createContext();\n\nfunction computeAnchorRect(\n\tanchorRefFallback,\n\tanchorRect,\n\tgetAnchorRect,\n\tanchorRef = false,\n\tcontainer\n) {\n\tif ( anchorRect ) {\n\t\treturn anchorRect;\n\t}\n\n\tif ( getAnchorRect ) {\n\t\tif ( ! anchorRefFallback.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rect = getAnchorRect( anchorRefFallback.current );\n\t\treturn offsetIframe(\n\t\t\trect,\n\t\t\trect.ownerDocument || anchorRefFallback.current.ownerDocument,\n\t\t\tcontainer\n\t\t);\n\t}\n\n\tif ( anchorRef !== false ) {\n\t\tif (\n\t\t\t! anchorRef ||\n\t\t\t! window.Range ||\n\t\t\t! window.Element ||\n\t\t\t! window.DOMRect\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Duck-type to check if `anchorRef` is an instance of Range\n\t\t// `anchorRef instanceof window.Range` checks will break across document boundaries\n\t\t// such as in an iframe.\n\t\tif ( typeof anchorRef?.cloneRange === 'function' ) {\n\t\t\treturn offsetIframe(\n\t\t\t\tgetRectangleFromRange( anchorRef ),\n\t\t\t\tanchorRef.endContainer.ownerDocument,\n\t\t\t\tcontainer\n\t\t\t);\n\t\t}\n\n\t\t// Duck-type to check if `anchorRef` is an instance of Element\n\t\t// `anchorRef instanceof window.Element` checks will break across document boundaries\n\t\t// such as in an iframe.\n\t\tif ( typeof anchorRef?.getBoundingClientRect === 'function' ) {\n\t\t\tconst rect = offsetIframe(\n\t\t\t\tanchorRef.getBoundingClientRect(),\n\t\t\t\tanchorRef.ownerDocument,\n\t\t\t\tcontainer\n\t\t\t);\n\n\t\t\treturn rect;\n\t\t}\n\n\t\tconst { top, bottom } = anchorRef;\n\t\tconst topRect = top.getBoundingClientRect();\n\t\tconst bottomRect = bottom.getBoundingClientRect();\n\n\t\treturn offsetIframe(\n\t\t\tnew window.DOMRect(\n\t\t\t\ttopRect.left,\n\t\t\t\ttopRect.top,\n\t\t\t\ttopRect.width,\n\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t),\n\t\t\ttop.ownerDocument,\n\t\t\tcontainer\n\t\t);\n\t}\n\n\tif ( ! anchorRefFallback.current ) {\n\t\treturn;\n\t}\n\n\tconst { parentNode } = anchorRefFallback.current;\n\n\treturn offsetIframe(\n\t\tparentNode.getBoundingClientRect(),\n\t\tparentNode.ownerDocument,\n\t\tcontainer\n\t);\n}\n\n/**\n * Sets or removes an element attribute.\n *\n * @param {Element} element The element to modify.\n * @param {string} name The attribute name to set or remove.\n * @param {?string} value The value to set. A falsy value will remove the\n * attribute.\n */\nfunction setAttribute( element, name, value ) {\n\tif ( ! value ) {\n\t\tif ( element.hasAttribute( name ) ) {\n\t\t\telement.removeAttribute( name );\n\t\t}\n\t} else if ( element.getAttribute( name ) !== value ) {\n\t\telement.setAttribute( name, value );\n\t}\n}\n\n/**\n * Sets or removes an element style property.\n *\n * @param {Element} element The element to modify.\n * @param {string} property The property to set or remove.\n * @param {?string} value The value to set. A falsy value will remove the\n * property.\n */\nfunction setStyle( element, property, value = '' ) {\n\tif ( element.style[ property ] !== value ) {\n\t\telement.style[ property ] = value;\n\t}\n}\n\n/**\n * Sets or removes an element class.\n *\n * @param {Element} element The element to modify.\n * @param {string} name The class to set or remove.\n * @param {boolean} toggle True to set the class, false to remove.\n */\nfunction setClass( element, name, toggle ) {\n\tif ( toggle ) {\n\t\tif ( ! element.classList.contains( name ) ) {\n\t\t\telement.classList.add( name );\n\t\t}\n\t} else if ( element.classList.contains( name ) ) {\n\t\telement.classList.remove( name );\n\t}\n}\n\nfunction getAnchorDocument( anchor ) {\n\tif ( ! anchor ) {\n\t\treturn;\n\t}\n\n\tif ( anchor.endContainer ) {\n\t\treturn anchor.endContainer.ownerDocument;\n\t}\n\n\tif ( anchor.top ) {\n\t\treturn anchor.top.ownerDocument;\n\t}\n\n\treturn anchor.ownerDocument;\n}\n\nconst Popover = (\n\t{\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\t// Disable reason: We generate the `...contentProps` rest as remainder\n\t\t// of props which aren't explicitly handled by this component.\n\t\t/* eslint-disable no-unused-vars */\n\t\tposition = 'bottom right',\n\t\trange,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tanimate = true,\n\t\tonFocusOutside,\n\t\t__unstableStickyBoundaryElement,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\t__unstableObserveElement,\n\t\t__unstableBoundaryParent,\n\t\t__unstableForcePosition,\n\t\t__unstableForceXAlignment,\n\t\t__unstableEditorCanvasWrapper,\n\t\t/* eslint-enable no-unused-vars */\n\t\t...contentProps\n\t},\n\tref\n) => {\n\tconst anchorRefFallback = useRef( null );\n\tconst contentRef = useRef( null );\n\tconst containerRef = useRef();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ animateOrigin, setAnimateOrigin ] = useState();\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst [ containerResizeListener, contentSize ] = useResizeObserver();\n\tnoArrow = isExpanded || noArrow;\n\n\tuseLayoutEffect( () => {\n\t\tif ( isExpanded ) {\n\t\t\tsetClass( containerRef.current, 'is-without-arrow', noArrow );\n\t\t\tsetClass( containerRef.current, 'is-alternate', isAlternate );\n\t\t\tsetAttribute( containerRef.current, 'data-x-axis' );\n\t\t\tsetAttribute( containerRef.current, 'data-y-axis' );\n\t\t\tsetStyle( containerRef.current, 'top' );\n\t\t\tsetStyle( containerRef.current, 'left' );\n\t\t\tsetStyle( contentRef.current, 'maxHeight' );\n\t\t\tsetStyle( contentRef.current, 'maxWidth' );\n\t\t\treturn;\n\t\t}\n\n\t\tconst refresh = () => {\n\t\t\tif ( ! containerRef.current || ! contentRef.current ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet anchor = computeAnchorRect(\n\t\t\t\tanchorRefFallback,\n\t\t\t\tanchorRect,\n\t\t\t\tgetAnchorRect,\n\t\t\t\tanchorRef,\n\t\t\t\tcontainerRef.current\n\t\t\t);\n\n\t\t\tif ( ! anchor ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { offsetParent, ownerDocument } = containerRef.current;\n\n\t\t\tlet relativeOffsetTop = 0;\n\n\t\t\t// If there is a positioned ancestor element that is not the body,\n\t\t\t// subtract the position from the anchor rect. If the position of\n\t\t\t// the popover is fixed, the offset parent is null or the body\n\t\t\t// element, in which case the position is relative to the viewport.\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent\n\t\t\tif ( offsetParent && offsetParent !== ownerDocument.body ) {\n\t\t\t\tconst offsetParentRect = offsetParent.getBoundingClientRect();\n\n\t\t\t\trelativeOffsetTop = offsetParentRect.top;\n\t\t\t\tanchor = new window.DOMRect(\n\t\t\t\t\tanchor.left - offsetParentRect.left,\n\t\t\t\t\tanchor.top - offsetParentRect.top,\n\t\t\t\t\tanchor.width,\n\t\t\t\t\tanchor.height\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet boundaryElement;\n\t\t\tif ( __unstableBoundaryParent ) {\n\t\t\t\tboundaryElement = containerRef.current.parentElement;\n\t\t\t}\n\n\t\t\tconst usedContentSize = ! contentSize.height\n\t\t\t\t? contentRef.current.getBoundingClientRect()\n\t\t\t\t: contentSize;\n\n\t\t\tconst {\n\t\t\t\tpopoverTop,\n\t\t\t\tpopoverLeft,\n\t\t\t\txAxis,\n\t\t\t\tyAxis,\n\t\t\t\tcontentHeight,\n\t\t\t\tcontentWidth,\n\t\t\t} = computePopoverPosition(\n\t\t\t\tanchor,\n\t\t\t\tusedContentSize,\n\t\t\t\tposition,\n\t\t\t\t__unstableStickyBoundaryElement,\n\t\t\t\tcontainerRef.current,\n\t\t\t\trelativeOffsetTop,\n\t\t\t\tboundaryElement,\n\t\t\t\t__unstableForcePosition,\n\t\t\t\t__unstableForceXAlignment,\n\t\t\t\t__unstableEditorCanvasWrapper\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\ttypeof popoverTop === 'number' &&\n\t\t\t\ttypeof popoverLeft === 'number'\n\t\t\t) {\n\t\t\t\tsetStyle( containerRef.current, 'top', popoverTop + 'px' );\n\t\t\t\tsetStyle( containerRef.current, 'left', popoverLeft + 'px' );\n\t\t\t}\n\n\t\t\tsetClass(\n\t\t\t\tcontainerRef.current,\n\t\t\t\t'is-without-arrow',\n\t\t\t\tnoArrow || ( xAxis === 'center' && yAxis === 'middle' )\n\t\t\t);\n\t\t\tsetClass( containerRef.current, 'is-alternate', isAlternate );\n\t\t\tsetAttribute( containerRef.current, 'data-x-axis', xAxis );\n\t\t\tsetAttribute( containerRef.current, 'data-y-axis', yAxis );\n\t\t\tsetStyle(\n\t\t\t\tcontentRef.current,\n\t\t\t\t'maxHeight',\n\t\t\t\ttypeof contentHeight === 'number' ? contentHeight + 'px' : ''\n\t\t\t);\n\t\t\tsetStyle(\n\t\t\t\tcontentRef.current,\n\t\t\t\t'maxWidth',\n\t\t\t\ttypeof contentWidth === 'number' ? contentWidth + 'px' : ''\n\t\t\t);\n\n\t\t\t// Compute the animation position.\n\t\t\tconst yAxisMapping = {\n\t\t\t\ttop: 'bottom',\n\t\t\t\tbottom: 'top',\n\t\t\t};\n\t\t\tconst xAxisMapping = {\n\t\t\t\tleft: 'right',\n\t\t\t\tright: 'left',\n\t\t\t};\n\t\t\tconst animateYAxis = yAxisMapping[ yAxis ] || 'middle';\n\t\t\tconst animateXAxis = xAxisMapping[ xAxis ] || 'center';\n\n\t\t\tsetAnimateOrigin( animateXAxis + ' ' + animateYAxis );\n\t\t};\n\n\t\trefresh();\n\n\t\tconst { ownerDocument } = containerRef.current;\n\t\tconst { defaultView } = ownerDocument;\n\n\t\t/*\n\t\t * There are sometimes we need to reposition or resize the popover that\n\t\t * are not handled by the resize/scroll window events (i.e. CSS changes\n\t\t * in the layout that changes the position of the anchor).\n\t\t *\n\t\t * For these situations, we refresh the popover every 0.5s\n\t\t */\n\t\tconst intervalHandle = defaultView.setInterval( refresh, 500 );\n\n\t\tlet rafId;\n\n\t\tconst refreshOnAnimationFrame = () => {\n\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\trafId = defaultView.requestAnimationFrame( refresh );\n\t\t};\n\n\t\t// Sometimes a click trigger a layout change that affects the popover\n\t\t// position. This is an opportunity to immediately refresh rather than\n\t\t// at the interval.\n\t\tdefaultView.addEventListener( 'click', refreshOnAnimationFrame );\n\t\tdefaultView.addEventListener( 'resize', refresh );\n\t\tdefaultView.addEventListener( 'scroll', refresh, true );\n\n\t\tconst anchorDocument = getAnchorDocument( anchorRef );\n\n\t\t// If the anchor is within an iframe, the popover position also needs\n\t\t// to refrest when the iframe content is scrolled or resized.\n\t\tif ( anchorDocument && anchorDocument !== ownerDocument ) {\n\t\t\tanchorDocument.defaultView.addEventListener( 'resize', refresh );\n\t\t\tanchorDocument.defaultView.addEventListener(\n\t\t\t\t'scroll',\n\t\t\t\trefresh,\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\tlet observer;\n\n\t\tif ( __unstableObserveElement ) {\n\t\t\tobserver = new defaultView.MutationObserver( refresh );\n\t\t\tobserver.observe( __unstableObserveElement, { attributes: true } );\n\t\t}\n\n\t\treturn () => {\n\t\t\tdefaultView.clearInterval( intervalHandle );\n\t\t\tdefaultView.removeEventListener( 'resize', refresh );\n\t\t\tdefaultView.removeEventListener( 'scroll', refresh, true );\n\t\t\tdefaultView.removeEventListener( 'click', refreshOnAnimationFrame );\n\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\n\t\t\tif ( anchorDocument && anchorDocument !== ownerDocument ) {\n\t\t\t\tanchorDocument.defaultView?.removeEventListener(\n\t\t\t\t\t'resize',\n\t\t\t\t\trefresh\n\t\t\t\t);\n\t\t\t\tanchorDocument.defaultView?.removeEventListener(\n\t\t\t\t\t'scroll',\n\t\t\t\t\trefresh,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( observer ) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [\n\t\tisExpanded,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\tanchorRef,\n\t\tposition,\n\t\tcontentSize,\n\t\t__unstableStickyBoundaryElement,\n\t\t__unstableObserveElement,\n\t\t__unstableBoundaryParent,\n\t] );\n\n\tconst onDialogClose = ( type, event ) => {\n\t\t// Ideally the popover should have just a single onClose prop and\n\t\t// not three props that potentially do the same thing.\n\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\tonFocusOutside( event );\n\t\t} else if ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\t};\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst mergedRefs = useMergeRefs( [ containerRef, dialogRef, ref ] );\n\n\t/** @type {false | string} */\n\tconst animateClassName =\n\t\tBoolean( animate && animateOrigin ) &&\n\t\tgetAnimateClassName( {\n\t\t\ttype: 'appear',\n\t\t\torigin: animateOrigin,\n\t\t} );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-popover',\n\t\t\t\tclassName,\n\t\t\t\tanimateClassName,\n\t\t\t\t{\n\t\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t\t'is-without-arrow': noArrow,\n\t\t\t\t\t'is-alternate': isAlternate,\n\t\t\t\t}\n\t\t\t) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedRefs }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex=\"-1\"\n\t\t>\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div ref={ contentRef } className=\"components-popover__content\">\n\t\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t\t{ containerResizeListener }\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\nconst PopoverContainer = forwardRef( Popover );\n\nfunction PopoverSlot( { name = SLOT_NAME }, ref ) {\n\treturn (\n\t\t<Slot\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nPopoverContainer.Slot = forwardRef( PopoverSlot );\nPopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default PopoverContainer;\n"]}
@@ -227,10 +227,10 @@ function Sandbox(_ref) {
227
227
  }, []);
228
228
  (0, _element.useEffect)(() => {
229
229
  trySandbox();
230
- }, [title, type, styles, scripts]);
230
+ }, [title, styles, scripts]);
231
231
  (0, _element.useEffect)(() => {
232
232
  trySandbox(true);
233
- }, [html]);
233
+ }, [html, type]);
234
234
  return (0, _element.createElement)("iframe", {
235
235
  ref: (0, _compose.useMergeRefs)([ref, (0, _compose.useFocusableIframe)()]),
236
236
  title: title,