@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":["isRTL","BASE","G2","UI","Button","Text","Heading","reduceMotion","rtl","space","SearchControl","NavigationUI","MenuUI","MenuBackButtonUI","MenuTitleUI","MenuTitleActionsUI","MenuTitleSearchUI","GroupTitleUI","ItemBaseUI","textAlign","theme","white","lightGray","ui","ItemUI","ItemIconUI","ItemBadgeUI","ItemTitleUI"],"mappings":";;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,EAAeC,EAAf,EAAmBC,EAAnB,Q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EAAH,CACpB,MAAQL,KAAK,KAAK,oBAAL,GAA4B,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":["isRTL","COLORS","Button","Text","Heading","reduceMotion","rtl","space","SearchControl","NavigationUI","MenuUI","MenuBackButtonUI","MenuTitleUI","MenuTitleActionsUI","MenuTitleSearchUI","GroupTitleUI","ItemBaseUI","textAlign","ui","theme","white","gray","ItemUI","ItemIconUI","ItemBadgeUI","ItemTitleUI"],"mappings":";;;;AAAA;AACA;AACA;;AAGA;AAC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BQ,i8MAAjB;AAoBP,OAAO,MAAMoB,WAAW,GAAG,qBAAQtB,IAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,CACpB,MAAQH,KAAK,KAAK,oBAAL,GAA4B,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"]}
@@ -3,19 +3,20 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { Animated, Easing, Text, TouchableWithoutFeedback, View, Dimensions, Platform } from 'react-native';
6
+ import { Animated, Easing, Text, TouchableWithoutFeedback, View, useWindowDimensions } from 'react-native';
7
7
  import { BlurView } from '@react-native-community/blur';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- import { useEffect, useRef, useState } from '@wordpress/element';
12
+ import { useEffect, useRef, Platform } from '@wordpress/element';
13
13
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
17
 
18
18
  import styles from './style.scss';
19
+ const HIDE_TIMER = 3000;
19
20
 
20
21
  const Notice = _ref => {
21
22
  let {
@@ -24,66 +25,69 @@ const Notice = _ref => {
24
25
  id,
25
26
  status
26
27
  } = _ref;
27
- const [width, setWidth] = useState(Dimensions.get('window').width);
28
- const [visible, setVisible] = useState(true);
28
+ const {
29
+ width
30
+ } = useWindowDimensions();
29
31
  const animationValue = useRef(new Animated.Value(0)).current;
30
32
  const timer = useRef(null);
31
- const isIOS = Platform.OS === 'ios';
32
-
33
- const onDimensionsChange = () => {
34
- setWidth(Dimensions.get('window').width);
35
- };
36
-
37
- useEffect(() => {
38
- const dimensionsChangeSubscription = Dimensions.addEventListener('change', onDimensionsChange);
39
- return () => {
40
- dimensionsChangeSubscription.remove();
41
- };
42
- }, []);
43
33
  useEffect(() => {
44
34
  startAnimation();
45
35
  return () => {
46
36
  clearTimeout(timer === null || timer === void 0 ? void 0 : timer.current);
47
37
  };
48
- }, [visible, id]);
38
+ }, []);
39
+
40
+ function onHide() {
41
+ Animated.timing(animationValue, {
42
+ toValue: 0,
43
+ duration: 150,
44
+ useNativeDriver: true,
45
+ easing: Easing.out(Easing.quad)
46
+ }).start(_ref2 => {
47
+ let {
48
+ finished
49
+ } = _ref2;
49
50
 
50
- const onHide = () => {
51
- setVisible(false);
52
- };
51
+ if (finished && onNoticeHidden) {
52
+ onNoticeHidden(id);
53
+ }
54
+ });
55
+ }
53
56
 
54
- const startAnimation = () => {
57
+ function startAnimation() {
55
58
  Animated.timing(animationValue, {
56
- toValue: visible ? 1 : 0,
57
- duration: visible ? 300 : 150,
59
+ toValue: 1,
60
+ duration: 300,
58
61
  useNativeDriver: true,
59
62
  easing: Easing.out(Easing.quad)
60
- }).start(() => {
61
- if (visible && onNoticeHidden) {
63
+ }).start(_ref3 => {
64
+ let {
65
+ finished
66
+ } = _ref3;
67
+
68
+ if (finished && onNoticeHidden) {
62
69
  timer.current = setTimeout(() => {
63
70
  onHide();
64
- }, 3000);
65
- }
66
-
67
- if (!visible && onNoticeHidden) {
68
- onNoticeHidden(id);
71
+ }, HIDE_TIMER);
69
72
  }
70
73
  });
71
- };
74
+ }
72
75
 
73
76
  const noticeSolidStyles = usePreferredColorSchemeStyle(styles.noticeSolid, styles.noticeSolidDark);
74
77
  const successTextStyles = usePreferredColorSchemeStyle(styles.successText, styles.successTextDark);
75
78
  const errorTextStyles = usePreferredColorSchemeStyle(styles.errorText, styles.errorTextDark);
76
79
  const textStyles = [status === 'success' && successTextStyles, status === 'error' && errorTextStyles];
77
- return createElement(Fragment, null, createElement(Animated.View, {
78
- style: [styles.notice, !isIOS && noticeSolidStyles, {
79
- width,
80
- transform: [{
81
- translateY: animationValue.interpolate({
82
- inputRange: [0, 1],
83
- outputRange: [-24, 0]
84
- })
85
- }]
80
+ const containerStyles = [styles.notice, !Platform.isIOS && noticeSolidStyles, {
81
+ width,
82
+ transform: [{
83
+ translateY: animationValue.interpolate({
84
+ inputRange: [0, 1],
85
+ outputRange: [-24, 0]
86
+ })
86
87
  }]
88
+ }];
89
+ return createElement(Fragment, null, createElement(Animated.View, {
90
+ style: containerStyles
87
91
  }, createElement(TouchableWithoutFeedback, {
88
92
  onPress: onHide
89
93
  }, createElement(View, {
@@ -91,7 +95,7 @@ const Notice = _ref => {
91
95
  }, createElement(Text, {
92
96
  numberOfLines: 3,
93
97
  style: textStyles
94
- }, content))), isIOS && createElement(BlurView, {
98
+ }, content))), Platform.isIOS && createElement(BlurView, {
95
99
  style: styles.blurBackground,
96
100
  blurType: "prominent",
97
101
  blurAmount: 10
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/notice/index.native.js"],"names":["Animated","Easing","Text","TouchableWithoutFeedback","View","Dimensions","Platform","BlurView","useEffect","useRef","useState","usePreferredColorSchemeStyle","styles","Notice","onNoticeHidden","content","id","status","width","setWidth","get","visible","setVisible","animationValue","Value","current","timer","isIOS","OS","onDimensionsChange","dimensionsChangeSubscription","addEventListener","remove","startAnimation","clearTimeout","onHide","timing","toValue","duration","useNativeDriver","easing","out","quad","start","setTimeout","noticeSolidStyles","noticeSolid","noticeSolidDark","successTextStyles","successText","successTextDark","errorTextStyles","errorText","errorTextDark","textStyles","notice","transform","translateY","interpolate","inputRange","outputRange","noticeContent","blurBackground"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,QADD,EAECC,MAFD,EAGCC,IAHD,EAICC,wBAJD,EAKCC,IALD,EAMCC,UAND,EAOCC,QAPD,QAQO,cARP;AASA,SAASC,QAAT,QAAyB,8BAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,SAASC,4BAAT,QAA6C,oBAA7C;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;;AAEA,MAAMC,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,IAAsBT,QAAQ,CAAEL,UAAU,CAACe,GAAX,CAAgB,QAAhB,EAA2BF,KAA7B,CAApC;AACA,QAAM,CAAEG,OAAF,EAAWC,UAAX,IAA0BZ,QAAQ,CAAE,IAAF,CAAxC;AAEA,QAAMa,cAAc,GAAGd,MAAM,CAAE,IAAIT,QAAQ,CAACwB,KAAb,CAAoB,CAApB,CAAF,CAAN,CAAkCC,OAAzD;AACA,QAAMC,KAAK,GAAGjB,MAAM,CAAE,IAAF,CAApB;AACA,QAAMkB,KAAK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A,QAAQ,EAAC,WAFV;AAGC,IAAA,UAAU,EAAG;AAHd,IAzBF,CADD,CADD;AAoCA,CA5GD;;AA8GA,eAAejD,MAAf","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":["Animated","Easing","Text","TouchableWithoutFeedback","View","useWindowDimensions","BlurView","useEffect","useRef","Platform","usePreferredColorSchemeStyle","styles","HIDE_TIMER","Notice","onNoticeHidden","content","id","status","width","animationValue","Value","current","timer","startAnimation","clearTimeout","onHide","timing","toValue","duration","useNativeDriver","easing","out","quad","start","finished","setTimeout","noticeSolidStyles","noticeSolid","noticeSolidDark","successTextStyles","successText","successTextDark","errorTextStyles","errorText","errorTextDark","textStyles","containerStyles","notice","isIOS","transform","translateY","interpolate","inputRange","outputRange","noticeContent","blurBackground"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,QADD,EAECC,MAFD,EAGCC,IAHD,EAICC,wBAJD,EAKCC,IALD,EAMCC,mBAND,QAOO,cAPP;AAQA,SAASC,QAAT,QAAyB,8BAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,SAASC,4BAAT,QAA6C,oBAA7C;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,MAAMC,UAAU,GAAG,IAAnB;;AAEA,MAAMC,MAAM,GAAG,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,OAAlB;AAA2BC,IAAAA,EAA3B;AAA+BC,IAAAA;AAA/B,GAA6C;AAC7D,QAAM;AAAEC,IAAAA;AAAF,MAAYb,mBAAmB,EAArC;AACA,QAAMc,cAAc,GAAGX,MAAM,CAAE,IAAIR,QAAQ,CAACoB,KAAb,CAAoB,CAApB,CAAF,CAAN,CAAkCC,OAAzD;AACA,QAAMC,KAAK,GAAGd,MAAM,CAAE,IAAF,CAApB;AAEAD,EAAAA,SAAS,CAAE,MAAM;AAChBgB,IAAAA,cAAc;AAEd,WAAO,MAAM;AACZC,MAAAA,YAAY,CAAEF,KAAF,aAAEA,KAAF,uB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seWindowDimensions,\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"]}
@@ -9,9 +9,8 @@ import { View } from 'react-native';
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- import { Component } from '@wordpress/element';
13
- import { withDispatch, withSelect } from '@wordpress/data';
14
- import { compose } from '@wordpress/compose';
12
+ import { useSelect, useDispatch } from '@wordpress/data';
13
+ import { store as noticesStore } from '@wordpress/notices';
15
14
  /**
16
15
  * Internal dependencies
17
16
  */
@@ -19,55 +18,38 @@ import { compose } from '@wordpress/compose';
19
18
  import Notice from './';
20
19
  import styles from './style.scss';
21
20
 
22
- class NoticeList extends Component {
23
- constructor() {
24
- super(...arguments);
25
- this.removeNotice = this.removeNotice.bind(this);
26
- }
27
-
28
- removeNotice(id) {
21
+ function NoticeList() {
22
+ const {
23
+ notices
24
+ } = useSelect(select => {
29
25
  const {
30
- removeNotice
31
- } = this.props;
26
+ getNotices
27
+ } = select(noticesStore);
28
+ return {
29
+ notices: getNotices()
30
+ };
31
+ }, []);
32
+ const {
33
+ removeNotice
34
+ } = useDispatch(noticesStore);
35
+
36
+ function onRemoveNotice(id) {
32
37
  removeNotice(id);
33
38
  }
34
39
 
35
- render() {
36
- const {
37
- notices,
38
- shouldStack
39
- } = this.props;
40
-
41
- if (!notices.length) {
42
- return null;
43
- }
44
-
45
- return createElement(View, {
46
- style: styles.list,
47
- key: notices.length
48
- }, shouldStack ? notices.reverse().map(notice => createElement(Notice, _extends({}, notice, {
49
- key: notice.id,
50
- onNoticeHidden: this.removeNotice
51
- }))) : createElement(Notice, _extends({}, notices[notices.length - 1], {
52
- onNoticeHidden: this.removeNotice
53
- })));
40
+ if (!notices.length) {
41
+ return null;
54
42
  }
55
43
 
44
+ return createElement(View, {
45
+ style: styles.list
46
+ }, notices.map(notice => {
47
+ return createElement(Notice, _extends({}, notice, {
48
+ key: notice.id,
49
+ onNoticeHidden: onRemoveNotice
50
+ }));
51
+ }));
56
52
  }
57
53
 
58
- export default compose([withSelect(select => {
59
- const {
60
- getNotices
61
- } = select('core/notices');
62
- return {
63
- notices: getNotices()
64
- };
65
- }), withDispatch(dispatch => {
66
- const {
67
- removeNotice
68
- } = dispatch('core/notices');
69
- return {
70
- removeNotice
71
- };
72
- })])(NoticeList);
54
+ export default NoticeList;
73
55
  //# sourceMappingURL=list.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/notice/list.native.js"],"names":["View","Component","withDispatch","withSelect","compose","Notice","styles","NoticeList","constructor","arguments","removeNotice","bind","id","props","render","notices","shouldStack","length","list","reverse","map","notice","select","getNotices","dispatch"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA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O,EAAEQ,UAAU;AADb,GAAP;AAGA,CANS,CADa,EAQvBrB,YAAY,CAAIsB,QAAF,IAAgB;AAC7B,QAAM;AAAEd,IAAAA;AAAF,MAAmBc,QAAQ,CAAE,cAAF,CAAjC;AAEA,SAAO;AACNd,IAAAA;AADM,GAAP;AAGA,CANW,CARW,CAAF,CAAP,CAeVH,UAfU,CAAf","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":["View","useSelect","useDispatch","store","noticesStore","Notice","styles","NoticeList","notices","select","getNotices","removeNotice","onRemoveNotice","id","length","list","map","notice"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,IAAnB;AACA,OAAOC,MAAP,MAAmB,cAAnB;;AAEA,SAASC,UAAT,GAAsB;AACrB,QAAM;AAAEC,IAAAA;AAAF,MAAcP,SAAS,CAAIQ,MAAF,IAAc;AAC5C,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,MAAM,CAAEL,YAAF,CAA7B;AACA,WAAO;AACNI,MAAAA,OAAO,EAAEE,UAAU;AADb,KAAP;AAGA,GAL4B,EAK1B,EAL0B,CAA7B;AAOA,QAAM;AAAEC,IAAAA;AAAF,MAAmBT,WAAW,CAAEE,YAAF,CAApC;;AAEA,WAASQ,cAAT,CAAyBC,EAAzB,EAA8B;AAC7BF,IAAAA,YAAY,CAAEE,EAAF,CAAZ;AACA;;AAED,MAAK,CAAEL,OAAO,CAACM,MAAf,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGR,MAAM,CAACS;AAArB,KACGP,OAAO,CAACQ,GAAR,CAAeC,MAAF,IAAc;AAC5B,WACC,cAAC,MAAD,eACMA,MADN;AAEC,MAAA,GAAG,EAAGA,MAAM,CAACJ,EAFd;AAGC,MAAA,cAAc,EAAGD;AAHlB,OADD;AAOA,GARC,CADH,CADD;AAaA;;AAED,eAAeL,UAAf","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"]}
@@ -34,8 +34,7 @@ const slotNameContext = createContext();
34
34
 
35
35
  function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
36
36
  let anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
37
- let shouldAnchorIncludePadding = arguments.length > 4 ? arguments[4] : undefined;
38
- let container = arguments.length > 5 ? arguments[5] : undefined;
37
+ let container = arguments.length > 4 ? arguments[4] : undefined;
39
38
 
40
39
  if (anchorRect) {
41
40
  return anchorRect;
@@ -67,12 +66,7 @@ function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
67
66
 
68
67
  if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.getBoundingClientRect) === 'function') {
69
68
  const rect = offsetIframe(anchorRef.getBoundingClientRect(), anchorRef.ownerDocument, container);
70
-
71
- if (shouldAnchorIncludePadding) {
72
- return rect;
73
- }
74
-
75
- return withoutPadding(rect, anchorRef);
69
+ return rect;
76
70
  }
77
71
 
78
72
  const {
@@ -81,13 +75,7 @@ function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
81
75
  } = anchorRef;
82
76
  const topRect = top.getBoundingClientRect();
83
77
  const bottomRect = bottom.getBoundingClientRect();
84
- const rect = offsetIframe(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
85
-
86
- if (shouldAnchorIncludePadding) {
87
- return rect;
88
- }
89
-
90
- return withoutPadding(rect, anchorRef);
78
+ return offsetIframe(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
91
79
  }
92
80
 
93
81
  if (!anchorRefFallback.current) {
@@ -97,40 +85,7 @@ function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
97
85
  const {
98
86
  parentNode
99
87
  } = anchorRefFallback.current;
100
- const rect = offsetIframe(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
101
-
102
- if (shouldAnchorIncludePadding) {
103
- return rect;
104
- }
105
-
106
- return withoutPadding(rect, parentNode);
107
- }
108
-
109
- function getComputedStyle(node) {
110
- return node.ownerDocument.defaultView.getComputedStyle(node);
111
- }
112
-
113
- function withoutPadding(rect, element) {
114
- const {
115
- paddingTop,
116
- paddingBottom,
117
- paddingLeft,
118
- paddingRight
119
- } = getComputedStyle(element);
120
- const top = paddingTop ? parseInt(paddingTop, 10) : 0;
121
- const bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0;
122
- const left = paddingLeft ? parseInt(paddingLeft, 10) : 0;
123
- const right = paddingRight ? parseInt(paddingRight, 10) : 0;
124
- return {
125
- x: rect.left + left,
126
- y: rect.top + top,
127
- width: rect.width - left - right,
128
- height: rect.height - top - bottom,
129
- left: rect.left + left,
130
- right: rect.right - right,
131
- top: rect.top + top,
132
- bottom: rect.bottom - bottom
133
- };
88
+ return offsetIframe(parentNode.getBoundingClientRect(), parentNode.ownerDocument, container);
134
89
  }
135
90
  /**
136
91
  * Sets or removes an element attribute.
@@ -219,7 +174,6 @@ const Popover = (_ref, ref) => {
219
174
  range,
220
175
  focusOnMount = 'firstElement',
221
176
  anchorRef,
222
- shouldAnchorIncludePadding,
223
177
  anchorRect,
224
178
  getAnchorRect,
225
179
  expandOnMobile,
@@ -266,7 +220,7 @@ const Popover = (_ref, ref) => {
266
220
  return;
267
221
  }
268
222
 
269
- let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, containerRef.current);
223
+ let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, containerRef.current);
270
224
 
271
225
  if (!anchor) {
272
226
  return;
@@ -393,7 +347,7 @@ const Popover = (_ref, ref) => {
393
347
  observer.disconnect();
394
348
  }
395
349
  };
396
- }, [isExpanded, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
350
+ }, [isExpanded, anchorRect, getAnchorRect, anchorRef, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]);
397
351
 
398
352
  const onDialogClose = (type, event) => {
399
353
  // Ideally the popover should have just a single onClose prop and
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["classnames","useRef","useState","useLayoutEffect","forwardRef","createContext","useContext","getRectangleFromRange","useViewportMatch","useResizeObserver","useMergeRefs","__experimentalUseDialog","useDialog","close","computePopoverPosition","offsetIframe","Button","ScrollLock","Slot","Fill","useSlot","getAnimateClassName","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","PopoverContainer","PopoverSlot","__unstableSlotNameProvider","Provider"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,eAHD,EAICC,UAJD,EAKCC,aALD,EAMCC,UAND,QAOO,oBAPP;AAQA,SAASC,qBAAT,QAAsC,gBAAtC;AACA,SACCC,gBADD,EAECC,iBAFD,EAGCC,YAHD,EAICC,uBAAuB,IAAIC,SAJ5B,QAKO,oBALP;AAMA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,SAArD;AACA,OAAOC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OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAGjI;AAAZ,KAAkCiI,OAAlC,CAAP;AACA,CA1UD;;AA4UA,MAAMC,gBAAgB,GAAGvJ,UAAU,CAAE2E,OAAF,CAAnC;;AAEA,SAAS6E,WAAT,QAA4C5E,GAA5C,EAAkD;AAAA,MAA5B;AAAEjB,IAAAA,IAAI,GAAGzC;AAAT,GAA4B;AACjD,SACC,cAAC,IAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGyC,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGiB;AAJP,IADD;AAQA;;AAED2E,gBAAgB,CAACzI,IAAjB,GAAwBd,UAAU,CAAEwJ,WAAF,CAAlC;AACAD,gBAAgB,CAACE,0BAAjB,GAA8CtI,eAAe,CAACuI,QAA9D;AAEA,eAAeH,gBAAf","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":["classnames","useRef","useState","useLayoutEffect","forwardRef","createContext","useContext","getRectangleFromRange","useViewportMatch","useResizeObserver","useMergeRefs","__experimentalUseDialog","useDialog","close","computePopoverPosition","offsetIframe","Button","ScrollLock","Slot","Fill","useSlot","getAnimateClassName","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","PopoverContainer","PopoverSlot","__unstableSlotNameProvider","Provider"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,eAHD,EAICC,UAJD,EAKCC,aALD,EAMCC,UAND,QAOO,oBAPP;AAQA,SAASC,qBAAT,QAAsC,gBAAtC;AACA,SACCC,gBADD,EAECC,iBAFD,EAGCC,YAHD,EAICC,uBAAuB,IAAIC,SAJ5B,QAKO,oBALP;AAMA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,SAArD;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,OAArB,QAAoC,cAApC;AACA,SAASC,mBAAT,QAAoC,YAApC;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,SAAS,GAAG,SAAlB;AAEA,MAAMC,eAAe,GAAGlB,aAAa,EAArC;;AAEA,SAASmB,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,OA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,EAAE;AAAZ;AAAb,KACGsB,uBADH,EAEG1B,QAFH,CADD,CA7BD,CAHD;;AAyCA,MAAKwB,IAAI,CAAC3B,GAAV,EAAgB;AACf6E,IAAAA,OAAO,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGnD;AAAb,OAA0BmD,OAA1B,CAAV;AACA;;AAED,MAAKnH,SAAS,IAAIF,UAAlB,EAA+B;AAC9B,WAAOqH,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAGtH;AAAZ,KAAkCsH,OAAlC,CAAP;AACA,CAvUD;;AAyUA,MAAMC,gBAAgB,GAAG5I,UAAU,CAAE6D,OAAF,CAAnC;;AAEA,SAASgF,WAAT,QAA4C/E,GAA5C,EAAkD;AAAA,MAA5B;AAAEjB,IAAAA,IAAI,GAAG3B;AAAT,GAA4B;AACjD,SACC,cAAC,IAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAG2B,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGiB;AAJP,IADD;AAQA;;AAED8E,gBAAgB,CAAC9H,IAAjB,GAAwBd,UAAU,CAAE6I,WAAF,CAAlC;AACAD,gBAAgB,CAACE,0BAAjB,GAA8C3H,eAAe,CAAC4H,QAA9D;AAEA,eAAeH,gBAAf","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"]}
@@ -219,10 +219,10 @@ export default function Sandbox(_ref) {
219
219
  }, []);
220
220
  useEffect(() => {
221
221
  trySandbox();
222
- }, [title, type, styles, scripts]);
222
+ }, [title, styles, scripts]);
223
223
  useEffect(() => {
224
224
  trySandbox(true);
225
- }, [html]);
225
+ }, [html, type]);
226
226
  return createElement("iframe", {
227
227
  ref: useMergeRefs([ref, useFocusableIframe()]),
228
228
  title: title,