@wordpress/components 35.0.0 → 35.1.1-next.v.202606191442.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 (434) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/build/alignment-matrix-control/cell.cjs +1 -1
  3. package/build/alignment-matrix-control/cell.cjs.map +2 -2
  4. package/build/alignment-matrix-control/index.cjs +1 -1
  5. package/build/alignment-matrix-control/index.cjs.map +2 -2
  6. package/build/angle-picker-control/angle-circle.cjs +1 -1
  7. package/build/angle-picker-control/angle-circle.cjs.map +2 -2
  8. package/build/angle-picker-control/index.cjs +2 -2
  9. package/build/autocomplete/get-autocomplete-match.cjs.map +1 -1
  10. package/build/autocomplete/index.cjs.map +1 -1
  11. package/build/base-control/styles/base-control-styles.cjs +6 -6
  12. package/build/base-control/styles/base-control-styles.cjs.map +2 -2
  13. package/build/border-control/styles.cjs +17 -14
  14. package/build/border-control/styles.cjs.map +2 -2
  15. package/build/button/index.cjs +3 -7
  16. package/build/button/index.cjs.map +2 -2
  17. package/build/card/card-divider/hook.cjs.map +2 -2
  18. package/build/color-palette/index.cjs +3 -0
  19. package/build/color-palette/index.cjs.map +2 -2
  20. package/build/color-picker/component.cjs.map +1 -1
  21. package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
  22. package/build/date-time/utils.cjs.map +1 -1
  23. package/build/draggable/index.cjs +1 -1
  24. package/build/draggable/index.cjs.map +2 -2
  25. package/build/external-link/index.cjs +1 -1
  26. package/build/external-link/index.cjs.map +1 -1
  27. package/build/menu/popover.cjs.map +1 -1
  28. package/build/menu/styles.cjs +17 -17
  29. package/build/menu/styles.cjs.map +2 -2
  30. package/build/modal/index.cjs.map +1 -1
  31. package/build/modal/use-modal-exit-animation.cjs +37 -52
  32. package/build/modal/use-modal-exit-animation.cjs.map +2 -2
  33. package/build/navigable-container/container.cjs +15 -21
  34. package/build/navigable-container/container.cjs.map +2 -2
  35. package/build/palette-edit/index.cjs +1 -1
  36. package/build/progress-bar/index.cjs +1 -1
  37. package/build/progress-bar/index.cjs.map +2 -2
  38. package/build/query-controls/index.cjs +2 -2
  39. package/build/query-controls/index.cjs.map +2 -2
  40. package/build/range-control/index.cjs.map +1 -1
  41. package/build/sandbox/index.cjs +7 -1
  42. package/build/sandbox/index.cjs.map +2 -2
  43. package/build/snackbar/index.cjs +1 -1
  44. package/build/spinner/styles.cjs +4 -4
  45. package/build/spinner/styles.cjs.map +2 -2
  46. package/build/tabs/index.cjs +0 -18
  47. package/build/tabs/index.cjs.map +2 -2
  48. package/build/tabs/tablist.cjs +5 -15
  49. package/build/tabs/tablist.cjs.map +2 -2
  50. package/build/tools-panel/styles.cjs +13 -13
  51. package/build/tools-panel/styles.cjs.map +2 -2
  52. package/build/tools-panel/tools-panel/hook.cjs.map +1 -1
  53. package/build/tree-select/index.cjs +1 -1
  54. package/build/tree-select/index.cjs.map +1 -1
  55. package/build/truncate/utils.cjs +1 -1
  56. package/build/truncate/utils.cjs.map +1 -1
  57. package/build/unit-control/utils.cjs +33 -35
  58. package/build/unit-control/utils.cjs.map +2 -2
  59. package/build/utils/colors-values.cjs +12 -12
  60. package/build/utils/colors-values.cjs.map +2 -2
  61. package/build/utils/config-values.cjs +2 -2
  62. package/build/utils/config-values.cjs.map +2 -2
  63. package/build/utils/dropdown-motion.cjs.map +2 -2
  64. package/build/utils/strings.cjs.map +1 -1
  65. package/build-module/alignment-matrix-control/cell.mjs +1 -1
  66. package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
  67. package/build-module/alignment-matrix-control/index.mjs +1 -1
  68. package/build-module/alignment-matrix-control/index.mjs.map +2 -2
  69. package/build-module/angle-picker-control/angle-circle.mjs +1 -1
  70. package/build-module/angle-picker-control/angle-circle.mjs.map +2 -2
  71. package/build-module/angle-picker-control/index.mjs +2 -2
  72. package/build-module/autocomplete/get-autocomplete-match.mjs.map +1 -1
  73. package/build-module/autocomplete/index.mjs.map +1 -1
  74. package/build-module/base-control/styles/base-control-styles.mjs +6 -6
  75. package/build-module/base-control/styles/base-control-styles.mjs.map +2 -2
  76. package/build-module/border-control/styles.mjs +17 -14
  77. package/build-module/border-control/styles.mjs.map +2 -2
  78. package/build-module/button/index.mjs +2 -5
  79. package/build-module/button/index.mjs.map +2 -2
  80. package/build-module/card/card-divider/hook.mjs.map +2 -2
  81. package/build-module/color-palette/index.mjs +3 -0
  82. package/build-module/color-palette/index.mjs.map +2 -2
  83. package/build-module/color-picker/component.mjs.map +1 -1
  84. package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
  85. package/build-module/date-time/utils.mjs.map +1 -1
  86. package/build-module/draggable/index.mjs +1 -1
  87. package/build-module/draggable/index.mjs.map +2 -2
  88. package/build-module/external-link/index.mjs +1 -1
  89. package/build-module/external-link/index.mjs.map +1 -1
  90. package/build-module/menu/popover.mjs.map +1 -1
  91. package/build-module/menu/styles.mjs +17 -17
  92. package/build-module/menu/styles.mjs.map +2 -2
  93. package/build-module/modal/index.mjs.map +1 -1
  94. package/build-module/modal/use-modal-exit-animation.mjs +37 -52
  95. package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
  96. package/build-module/navigable-container/container.mjs +16 -22
  97. package/build-module/navigable-container/container.mjs.map +2 -2
  98. package/build-module/palette-edit/index.mjs +1 -1
  99. package/build-module/progress-bar/index.mjs +1 -1
  100. package/build-module/progress-bar/index.mjs.map +2 -2
  101. package/build-module/query-controls/index.mjs +2 -2
  102. package/build-module/query-controls/index.mjs.map +2 -2
  103. package/build-module/range-control/index.mjs.map +1 -1
  104. package/build-module/sandbox/index.mjs +3 -1
  105. package/build-module/sandbox/index.mjs.map +2 -2
  106. package/build-module/snackbar/index.mjs +1 -1
  107. package/build-module/spinner/styles.mjs +4 -4
  108. package/build-module/spinner/styles.mjs.map +2 -2
  109. package/build-module/tabs/index.mjs +1 -19
  110. package/build-module/tabs/index.mjs.map +2 -2
  111. package/build-module/tabs/tablist.mjs +5 -15
  112. package/build-module/tabs/tablist.mjs.map +2 -2
  113. package/build-module/tools-panel/styles.mjs +13 -13
  114. package/build-module/tools-panel/styles.mjs.map +2 -2
  115. package/build-module/tools-panel/tools-panel/hook.mjs.map +1 -1
  116. package/build-module/tree-select/index.mjs +1 -1
  117. package/build-module/tree-select/index.mjs.map +1 -1
  118. package/build-module/truncate/utils.mjs +1 -1
  119. package/build-module/truncate/utils.mjs.map +1 -1
  120. package/build-module/unit-control/utils.mjs +33 -35
  121. package/build-module/unit-control/utils.mjs.map +2 -2
  122. package/build-module/utils/colors-values.mjs +12 -12
  123. package/build-module/utils/colors-values.mjs.map +2 -2
  124. package/build-module/utils/config-values.mjs +2 -2
  125. package/build-module/utils/config-values.mjs.map +2 -2
  126. package/build-module/utils/dropdown-motion.mjs.map +2 -2
  127. package/build-module/utils/strings.mjs.map +1 -1
  128. package/build-style/style-rtl.css +122 -91
  129. package/build-style/style.css +122 -91
  130. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  131. package/build-types/border-control/styles.d.ts.map +1 -1
  132. package/build-types/button/index.d.ts +0 -2
  133. package/build-types/button/index.d.ts.map +1 -1
  134. package/build-types/card/card-divider/hook.d.ts +1 -274
  135. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  136. package/build-types/color-palette/index.d.ts.map +1 -1
  137. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  138. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  139. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  140. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  141. package/build-types/menu/styles.d.ts.map +1 -1
  142. package/build-types/menu/types.d.ts +2 -2
  143. package/build-types/navigable-container/container.d.ts.map +1 -1
  144. package/build-types/sandbox/index.d.ts +15 -0
  145. package/build-types/sandbox/index.d.ts.map +1 -1
  146. package/build-types/spinner/styles.d.ts.map +1 -1
  147. package/build-types/tabs/index.d.ts.map +1 -1
  148. package/build-types/tabs/tablist.d.ts.map +1 -1
  149. package/build-types/tools-panel/styles.d.ts.map +1 -1
  150. package/build-types/unit-control/utils.d.ts.map +1 -1
  151. package/build-types/utils/colors-values.d.ts.map +1 -1
  152. package/build-types/utils/dropdown-motion.d.ts.map +1 -1
  153. package/build-types/validated-form-controls/components/combobox-control.d.ts +1 -1
  154. package/package.json +44 -36
  155. package/src/angle-picker-control/angle-circle.tsx +3 -3
  156. package/src/base-control/README.md +2 -2
  157. package/src/base-control/styles/base-control-styles.ts +1 -0
  158. package/src/border-control/styles.ts +1 -0
  159. package/src/button/index.tsx +2 -4
  160. package/src/button/style.scss +3 -3
  161. package/src/card/card/README.md +4 -4
  162. package/src/card/card-divider/hook.ts +5 -1
  163. package/src/card/test/__snapshots__/index.tsx.snap +3 -3
  164. package/src/checkbox-control/README.md +1 -1
  165. package/src/clipboard-button/README.md +4 -4
  166. package/src/color-palette/index.tsx +5 -0
  167. package/src/color-palette/test/index.tsx +30 -0
  168. package/src/combobox-control/README.md +1 -1
  169. package/src/composite/stories/index.story.tsx +5 -0
  170. package/src/confirm-dialog/README.md +1 -1
  171. package/src/confirm-dialog/stories/index.story.tsx +1 -0
  172. package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
  173. package/src/dropdown/stories/index.story.tsx +5 -0
  174. package/src/dropdown-menu/style.scss +1 -1
  175. package/src/external-link/style.scss +4 -4
  176. package/src/flex/flex/README.md +1 -1
  177. package/src/form-toggle/style.scss +1 -1
  178. package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
  179. package/src/menu/README.md +2 -2
  180. package/src/menu/styles.ts +2 -0
  181. package/src/menu/test/index.tsx +120 -87
  182. package/src/menu/types.ts +2 -2
  183. package/src/modal/style.scss +1 -1
  184. package/src/modal/use-modal-exit-animation.ts +2 -2
  185. package/src/navigable-container/container.tsx +22 -30
  186. package/src/notice/style.scss +11 -13
  187. package/src/panel/README.md +2 -0
  188. package/src/panel/stories/index.story.tsx +2 -2
  189. package/src/panel/style.scss +1 -1
  190. package/src/popover/README.md +1 -1
  191. package/src/radio-control/style.scss +1 -1
  192. package/src/sandbox/index.tsx +18 -1
  193. package/src/sandbox/test/index.tsx +44 -1
  194. package/src/scrollable/README.md +1 -1
  195. package/src/spinner/styles.ts +1 -0
  196. package/src/tab-panel/style.scss +6 -6
  197. package/src/tabs/index.tsx +1 -26
  198. package/src/tabs/tablist.tsx +5 -21
  199. package/src/tabs/test/index.tsx +16 -27
  200. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  201. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +34 -26
  202. package/src/toolbar/toolbar-group/style.scss +2 -2
  203. package/src/tools-panel/styles.ts +1 -1
  204. package/src/tooltip/stories/index.story.tsx +2 -2
  205. package/src/tooltip/style.scss +1 -1
  206. package/src/unit-control/utils.ts +33 -52
  207. package/src/utils/colors-values.js +36 -16
  208. package/src/utils/config-values.js +2 -2
  209. package/src/utils/dropdown-motion.ts +6 -4
  210. package/src/utils/theme-variables.scss +18 -13
  211. package/build/mobile/image/constants.cjs +0 -34
  212. package/build/mobile/image/constants.cjs.map +0 -7
  213. package/build-module/mobile/image/constants.mjs +0 -9
  214. package/build-module/mobile/image/constants.mjs.map +0 -7
  215. package/build-types/mobile/image/constants.d.ts +0 -5
  216. package/build-types/mobile/image/constants.d.ts.map +0 -1
  217. package/src/autocomplete/autocompleter-ui.native.js +0 -211
  218. package/src/autocomplete/background-view.android.js +0 -25
  219. package/src/autocomplete/background-view.ios.js +0 -23
  220. package/src/autocomplete/style.android.scss +0 -7
  221. package/src/autocomplete/style.native.scss +0 -74
  222. package/src/base-control/index.native.js +0 -14
  223. package/src/button/index.native.js +0 -236
  224. package/src/button/style.native.scss +0 -9
  225. package/src/color-control/index.native.js +0 -24
  226. package/src/color-indicator/index.native.js +0 -80
  227. package/src/color-indicator/style.native.scss +0 -51
  228. package/src/color-palette/index.native.js +0 -360
  229. package/src/color-palette/style.native.scss +0 -49
  230. package/src/color-picker/hsv-color-picker.native.js +0 -88
  231. package/src/color-picker/hue-picker.native.js +0 -198
  232. package/src/color-picker/index.native.js +0 -215
  233. package/src/color-picker/saturation-picker.native.js +0 -167
  234. package/src/color-picker/style.native.scss +0 -87
  235. package/src/custom-gradient-picker/index.native.js +0 -110
  236. package/src/custom-gradient-picker/style.native.scss +0 -3
  237. package/src/dashicon/index.native.js +0 -18
  238. package/src/disabled/index.native.js +0 -10
  239. package/src/draggable/index.native.js +0 -234
  240. package/src/draggable/style.native.scss +0 -3
  241. package/src/draggable/test/index.native.js +0 -138
  242. package/src/dropdown/index.native.js +0 -59
  243. package/src/dropdown-menu/index.native.js +0 -152
  244. package/src/external-link/index.native.js +0 -25
  245. package/src/focal-point-picker/focal-point.native.js +0 -30
  246. package/src/focal-point-picker/index.native.js +0 -281
  247. package/src/focal-point-picker/tooltip/index.native.js +0 -144
  248. package/src/focal-point-picker/tooltip/style.native.scss +0 -42
  249. package/src/font-size-picker/index.native.js +0 -190
  250. package/src/font-size-picker/style.native.scss +0 -6
  251. package/src/footer-message-control/index.native.js +0 -14
  252. package/src/higher-order/with-focus-outside/index.native.js +0 -38
  253. package/src/index.native.js +0 -134
  254. package/src/keyboard-shortcuts/index.native.js +0 -2
  255. package/src/mobile/README.md +0 -3
  256. package/src/mobile/autocompletion-items.native.js +0 -11
  257. package/src/mobile/badge/README.md +0 -31
  258. package/src/mobile/badge/index.native.js +0 -27
  259. package/src/mobile/badge/style.scss +0 -18
  260. package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
  261. package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
  262. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
  263. package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
  264. package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
  265. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
  266. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
  267. package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
  268. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
  269. package/src/mobile/bottom-sheet/button.native.js +0 -19
  270. package/src/mobile/bottom-sheet/cell.native.js +0 -464
  271. package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
  272. package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
  273. package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
  274. package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
  275. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
  276. package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
  277. package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
  278. package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
  279. package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
  280. package/src/mobile/bottom-sheet/index.native.js +0 -646
  281. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
  282. package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
  283. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
  284. package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
  285. package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
  286. package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
  287. package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
  288. package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
  289. package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
  290. package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
  291. package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
  292. package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
  293. package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
  294. package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
  295. package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
  296. package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
  297. package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
  298. package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
  299. package/src/mobile/bottom-sheet/ripple.native.js +0 -83
  300. package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
  301. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
  302. package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
  303. package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
  304. package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
  305. package/src/mobile/bottom-sheet/styles.native.scss +0 -333
  306. package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
  307. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
  308. package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
  309. package/src/mobile/bottom-sheet/test/index.native.js +0 -24
  310. package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
  311. package/src/mobile/bottom-sheet-select-control/README.md +0 -97
  312. package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
  313. package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
  314. package/src/mobile/bottom-sheet-text-control/README.md +0 -98
  315. package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
  316. package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
  317. package/src/mobile/clipboard/index.native.js +0 -18
  318. package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
  319. package/src/mobile/color-settings/index.native.js +0 -88
  320. package/src/mobile/color-settings/palette.screen.native.js +0 -232
  321. package/src/mobile/color-settings/picker-screen.native.js +0 -60
  322. package/src/mobile/color-settings/style.native.scss +0 -62
  323. package/src/mobile/color-settings/utils.native.js +0 -36
  324. package/src/mobile/cycle-select-control/README.md +0 -3
  325. package/src/mobile/cycle-select-control/index.native.js +0 -39
  326. package/src/mobile/dashicons/index.native.js +0 -22
  327. package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
  328. package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
  329. package/src/mobile/gradient/index.native.js +0 -188
  330. package/src/mobile/gradient/style.native.scss +0 -8
  331. package/src/mobile/gradient/test/index.native.js +0 -114
  332. package/src/mobile/gridicons/index.native.js +0 -39
  333. package/src/mobile/html-text-input/index.native.js +0 -169
  334. package/src/mobile/html-text-input/style.android.scss +0 -8
  335. package/src/mobile/html-text-input/style.ios.scss +0 -10
  336. package/src/mobile/html-text-input/style.scss +0 -45
  337. package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
  338. package/src/mobile/html-text-input/test/index.native.js +0 -118
  339. package/src/mobile/image/constants.js +0 -1
  340. package/src/mobile/image/icon-customize.native.js +0 -10
  341. package/src/mobile/image/icon-retry.native.js +0 -11
  342. package/src/mobile/image/image-editing-button.native.js +0 -63
  343. package/src/mobile/image/index.native.js +0 -401
  344. package/src/mobile/image/style.native.scss +0 -179
  345. package/src/mobile/image/utils/index.native.js +0 -58
  346. package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
  347. package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
  348. package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
  349. package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
  350. package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
  351. package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
  352. package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
  353. package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
  354. package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
  355. package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
  356. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
  357. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
  358. package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
  359. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
  360. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
  361. package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
  362. package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
  363. package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
  364. package/src/mobile/layout-animation/index.native.js +0 -16
  365. package/src/mobile/link-picker/index.native.js +0 -160
  366. package/src/mobile/link-picker/link-picker-results.native.js +0 -129
  367. package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
  368. package/src/mobile/link-picker/styles.native.scss +0 -45
  369. package/src/mobile/link-picker/test/performance/index.native.js +0 -35
  370. package/src/mobile/link-settings/index.native.js +0 -332
  371. package/src/mobile/link-settings/link-rel.native.js +0 -10
  372. package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
  373. package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
  374. package/src/mobile/link-settings/style.native.scss +0 -4
  375. package/src/mobile/link-settings/test/edit.native.js +0 -325
  376. package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
  377. package/src/mobile/media-edit/index.native.js +0 -125
  378. package/src/mobile/picker/index.android.js +0 -104
  379. package/src/mobile/picker/index.ios.js +0 -96
  380. package/src/mobile/picker/styles.native.scss +0 -29
  381. package/src/mobile/segmented-control/index.native.js +0 -186
  382. package/src/mobile/segmented-control/style.native.scss +0 -99
  383. package/src/mobile/utils/alignments.native.js +0 -78
  384. package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
  385. package/src/mobile/utils/index.native.js +0 -12
  386. package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
  387. package/src/mobile/utils/test/index.native.js +0 -134
  388. package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
  389. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
  390. package/src/notice/index.native.js +0 -123
  391. package/src/notice/list.native.js +0 -55
  392. package/src/notice/style.native.scss +0 -60
  393. package/src/panel/actions.native.js +0 -46
  394. package/src/panel/actions.native.scss +0 -12
  395. package/src/panel/body.native.js +0 -29
  396. package/src/panel/body.native.scss +0 -11
  397. package/src/panel/bottom-separator-cover.native.js +0 -27
  398. package/src/panel/bottom-separator-cover.native.scss +0 -9
  399. package/src/private-apis.native.js +0 -13
  400. package/src/query-controls/index.native.js +0 -103
  401. package/src/radio-control/index.native.js +0 -24
  402. package/src/range-control/index.native.js +0 -73
  403. package/src/resizable-box/index.native.js +0 -32
  404. package/src/resizable-box/style.native.scss +0 -14
  405. package/src/sandbox/index.native.js +0 -392
  406. package/src/sandbox/style.native.scss +0 -7
  407. package/src/search-control/index.native.js +0 -274
  408. package/src/search-control/platform-style.android.scss +0 -57
  409. package/src/search-control/platform-style.ios.scss +0 -43
  410. package/src/search-control/style.native.scss +0 -63
  411. package/src/select-control/index.native.js +0 -41
  412. package/src/slot-fill/index.native.js +0 -25
  413. package/src/spinner/index.native.js +0 -22
  414. package/src/spinner/style.native.scss +0 -4
  415. package/src/style-provider/index.native.js +0 -3
  416. package/src/text/index.native.js +0 -13
  417. package/src/text/styles/emotion-css.native.js +0 -6
  418. package/src/text/styles/font-family.native.js +0 -1
  419. package/src/text/styles/text-mixins.native.js +0 -163
  420. package/src/text-control/index.native.js +0 -41
  421. package/src/textarea-control/index.native.js +0 -26
  422. package/src/toggle-control/index.native.js +0 -31
  423. package/src/toolbar/toolbar/style.native.scss +0 -11
  424. package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
  425. package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
  426. package/src/toolbar/toolbar-group/style.native.scss +0 -10
  427. package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
  428. package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
  429. package/src/toolbar/toolbar-item/index.native.js +0 -17
  430. package/src/tooltip/index.native.js +0 -292
  431. package/src/tooltip/style.native.scss +0 -39
  432. package/src/tooltip/test/index.native.js +0 -98
  433. package/src/unit-control/index.native.js +0 -202
  434. package/src/unit-control/style.native.scss +0 -19
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modal/index.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { createPortal, useCallback, useEffect, useRef, useState, forwardRef, useLayoutEffect, useContext } from '@wordpress/element';\nimport { useInstanceId, useFocusReturn, useFocusOnMount, useConstrainedTabbing, useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { Spacer } from '../spacer';\nimport { useModalExitAnimation } from './use-modal-exit-animation';\nimport { ModalContext } from './context';\n\n// Used to track body class names applied while modals are open.\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst bodyOpenClasses = new Map();\nfunction UnforwardedModal(props, forwardedRef) {\n const {\n bodyOpenClassName = 'modal-open',\n role = 'dialog',\n title = null,\n focusOnMount = true,\n shouldCloseOnEsc = true,\n shouldCloseOnClickOutside = true,\n isDismissible = true,\n /* Accessibility. */\n aria = {\n labelledby: undefined,\n describedby: undefined\n },\n onRequestClose,\n icon,\n closeButtonLabel,\n children,\n style,\n overlayClassName: overlayClassnameProp,\n className,\n contentLabel,\n onKeyDown,\n isFullScreen = false,\n size,\n headerActions = null,\n __experimentalHideHeader = false\n } = props;\n const ref = useRef(null);\n const instanceId = useInstanceId(Modal);\n const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;\n\n // The focus hook does not support 'firstContentElement' but this is a valid\n // value for the Modal's focusOnMount prop. The following code ensures the focus\n // hook will focus the first focusable node within the element to which it is applied.\n // When `firstContentElement` is passed as the value of the focusOnMount prop,\n // the focus hook is applied to the Modal's content element.\n // Otherwise, the focus hook is applied to the Modal's ref. This ensures that the\n // focus hook will focus the first element in the Modal's **content** when\n // `firstContentElement` is passed.\n const focusOnMountRef = useFocusOnMount(focusOnMount === 'firstContentElement' ? 'firstElement' : focusOnMount);\n const constrainedTabbingRef = useConstrainedTabbing();\n const focusReturnRef = useFocusReturn();\n const contentRef = useRef(null);\n const childrenContainerRef = useRef(null);\n const [hasScrolledContent, setHasScrolledContent] = useState(false);\n const [hasScrollableContent, setHasScrollableContent] = useState(false);\n let sizeClass;\n if (isFullScreen || size === 'fill') {\n sizeClass = 'is-full-screen';\n } else if (size) {\n sizeClass = `has-size-${size}`;\n }\n\n // Determines whether the Modal content is scrollable and updates the state.\n const isContentScrollable = useCallback(() => {\n if (!contentRef.current) {\n return;\n }\n const closestScrollContainer = getScrollContainer(contentRef.current);\n if (contentRef.current === closestScrollContainer) {\n setHasScrollableContent(true);\n } else {\n setHasScrollableContent(false);\n }\n }, [contentRef]);\n\n // Accessibly isolates/unisolates the modal.\n useEffect(() => {\n ariaHelper.modalize(ref.current);\n return () => ariaHelper.unmodalize();\n }, []);\n\n // Keeps a fresh ref for the subsequent effect.\n const onRequestCloseRef = useRef(undefined);\n useEffect(() => {\n onRequestCloseRef.current = onRequestClose;\n }, [onRequestClose]);\n\n // The list of `onRequestClose` callbacks of open (non-nested) Modals. Only\n // one should remain open at a time and the list enables closing prior ones.\n const dismissers = useContext(ModalContext);\n // Used for the tracking and dismissing any nested modals.\n const [nestedDismissers] = useState(() => new Set());\n\n // Updates the stack tracking open modals at this level and calls\n // onRequestClose for any prior and/or nested modals as applicable.\n useEffect(() => {\n // add this modal instance to the dismissers set\n dismissers.add(onRequestCloseRef);\n // request that all the other modals close themselves\n for (const dismisser of dismissers) {\n if (dismisser !== onRequestCloseRef) {\n dismisser.current?.();\n }\n }\n return () => {\n // request that all the nested modals close themselves\n for (const dismisser of nestedDismissers) {\n dismisser.current?.();\n }\n // remove this modal instance from the dismissers set\n dismissers.delete(onRequestCloseRef);\n };\n }, [dismissers, nestedDismissers]);\n\n // Adds/removes the value of bodyOpenClassName to body element.\n useEffect(() => {\n const theClass = bodyOpenClassName;\n const oneMore = 1 + (bodyOpenClasses.get(theClass) ?? 0);\n bodyOpenClasses.set(theClass, oneMore);\n document.body.classList.add(bodyOpenClassName);\n return () => {\n const oneLess = bodyOpenClasses.get(theClass) - 1;\n if (oneLess === 0) {\n document.body.classList.remove(theClass);\n bodyOpenClasses.delete(theClass);\n } else {\n bodyOpenClasses.set(theClass, oneLess);\n }\n };\n }, [bodyOpenClassName]);\n const {\n closeModal,\n frameRef,\n overlayClassname\n } = useModalExitAnimation();\n\n // Calls the isContentScrollable callback when the Modal children container resizes.\n useLayoutEffect(() => {\n if (!window.ResizeObserver || !childrenContainerRef.current) {\n return;\n }\n const resizeObserver = new ResizeObserver(isContentScrollable);\n resizeObserver.observe(childrenContainerRef.current);\n isContentScrollable();\n return () => {\n resizeObserver.disconnect();\n };\n }, [isContentScrollable, childrenContainerRef]);\n function handleEscapeKeyDown(event) {\n if (shouldCloseOnEsc && (event.code === 'Escape' || event.key === 'Escape') && !event.defaultPrevented) {\n event.preventDefault();\n closeModal().then(() => onRequestClose(event));\n }\n }\n const onContentContainerScroll = useCallback(e => {\n const scrollY = e?.currentTarget?.scrollTop ?? -1;\n if (!hasScrolledContent && scrollY > 0) {\n setHasScrolledContent(true);\n } else if (hasScrolledContent && scrollY <= 0) {\n setHasScrolledContent(false);\n }\n }, [hasScrolledContent]);\n let pressTarget = null;\n const overlayPressHandlers = {\n onPointerDown: event => {\n if (event.target === event.currentTarget) {\n pressTarget = event.target;\n // Avoids focus changing so that focus return works as expected.\n event.preventDefault();\n }\n },\n // Closes the modal with two exceptions. 1. Opening the context menu on\n // the overlay. 2. Pressing on the overlay then dragging the pointer\n // over the modal and releasing. Due to the modal being a child of the\n // overlay, such a gesture is a `click` on the overlay and cannot be\n // excepted by a `click` handler. Thus the tactic of handling\n // `pointerup` and comparing its target to that of the `pointerdown`.\n onPointerUp: ({\n target,\n button\n }) => {\n const isSameTarget = target === pressTarget;\n pressTarget = null;\n if (button === 0 && isSameTarget) {\n closeModal().then(() => onRequestClose());\n }\n }\n };\n const modal =\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: useMergeRefs([ref, forwardedRef]),\n className: clsx('components-modal__screen-overlay', overlayClassname, overlayClassnameProp),\n onKeyDown: withIgnoreIMEEvents(handleEscapeKeyDown),\n ...(shouldCloseOnClickOutside ? overlayPressHandlers : {}),\n children: /*#__PURE__*/_jsx(StyleProvider, {\n document: document,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-modal__frame', sizeClass, className),\n style: style,\n ref: useMergeRefs([frameRef, constrainedTabbingRef, focusReturnRef, focusOnMount !== 'firstContentElement' ? focusOnMountRef : null]),\n role: role,\n \"aria-label\": contentLabel,\n \"aria-labelledby\": contentLabel ? undefined : headingId,\n \"aria-describedby\": aria.describedby,\n tabIndex: -1,\n onKeyDown: onKeyDown,\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-modal__content', {\n 'hide-header': __experimentalHideHeader,\n 'is-scrollable': hasScrollableContent,\n 'has-scrolled-content': hasScrolledContent\n }),\n role: \"document\",\n onScroll: onContentContainerScroll,\n ref: contentRef,\n \"aria-label\": hasScrollableContent ? __('Scrollable section') : undefined,\n tabIndex: hasScrollableContent ? 0 : undefined,\n children: [!__experimentalHideHeader && /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header\",\n children: [/*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header-heading-container\",\n children: [icon && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-modal__icon-container\",\n \"aria-hidden\": true,\n children: icon\n }), title && /*#__PURE__*/_jsx(\"h1\", {\n id: headingId,\n className: \"components-modal__header-heading\",\n children: title\n })]\n }), headerActions, isDismissible && /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(Spacer, {\n marginBottom: 0,\n marginLeft: 2\n }), /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n onClick: event => closeModal().then(() => onRequestClose(event)),\n icon: close,\n label: closeButtonLabel || __('Close')\n })]\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: useMergeRefs([childrenContainerRef, focusOnMount === 'firstContentElement' ? focusOnMountRef : null]),\n className: \"components-modal__children-container\",\n children: children\n })]\n })\n })\n })\n });\n return createPortal(/*#__PURE__*/_jsx(ModalContext.Provider, {\n value: nestedDismissers,\n children: modal\n }), document.body);\n}\n\n/**\n * Modals give users information and choices related to a task they\u2019re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef(UnforwardedModal);\nModal.displayName = 'Modal';\nexport default Modal;"],
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { createPortal, useCallback, useEffect, useRef, useState, forwardRef, useLayoutEffect, useContext } from '@wordpress/element';\nimport { useInstanceId, useFocusReturn, useFocusOnMount, useConstrainedTabbing, useMergeRefs } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { Spacer } from '../spacer';\nimport { useModalExitAnimation } from './use-modal-exit-animation';\nimport { ModalContext } from './context';\n\n// Used to track body class names applied while modals are open.\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst bodyOpenClasses = new Map();\nfunction UnforwardedModal(props, forwardedRef) {\n const {\n bodyOpenClassName = 'modal-open',\n role = 'dialog',\n title = null,\n focusOnMount = true,\n shouldCloseOnEsc = true,\n shouldCloseOnClickOutside = true,\n isDismissible = true,\n /* Accessibility. */\n aria = {\n labelledby: undefined,\n describedby: undefined\n },\n onRequestClose,\n icon,\n closeButtonLabel,\n children,\n style,\n overlayClassName: overlayClassnameProp,\n className,\n contentLabel,\n onKeyDown,\n isFullScreen = false,\n size,\n headerActions = null,\n __experimentalHideHeader = false\n } = props;\n const ref = useRef(null);\n const instanceId = useInstanceId(Modal);\n const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;\n\n // The focus hook does not support 'firstContentElement' but this is a valid\n // value for the Modal's focusOnMount prop. The following code ensures the focus\n // hook will focus the first focusable node within the element to which it is applied.\n // When `firstContentElement` is passed as the value of the focusOnMount prop,\n // the focus hook is applied to the Modal's content element.\n // Otherwise, the focus hook is applied to the Modal's ref. This ensures that the\n // focus hook will focus the first element in the Modal's **content** when\n // `firstContentElement` is passed.\n const focusOnMountRef = useFocusOnMount(focusOnMount === 'firstContentElement' ? 'firstElement' : focusOnMount);\n const constrainedTabbingRef = useConstrainedTabbing();\n const focusReturnRef = useFocusReturn();\n const contentRef = useRef(null);\n const childrenContainerRef = useRef(null);\n const [hasScrolledContent, setHasScrolledContent] = useState(false);\n const [hasScrollableContent, setHasScrollableContent] = useState(false);\n let sizeClass;\n if (isFullScreen || size === 'fill') {\n sizeClass = 'is-full-screen';\n } else if (size) {\n sizeClass = `has-size-${size}`;\n }\n\n // Determines whether the Modal content is scrollable and updates the state.\n const isContentScrollable = useCallback(() => {\n if (!contentRef.current) {\n return;\n }\n const closestScrollContainer = getScrollContainer(contentRef.current);\n if (contentRef.current === closestScrollContainer) {\n setHasScrollableContent(true);\n } else {\n setHasScrollableContent(false);\n }\n }, [contentRef]);\n\n // Accessibly isolates/unisolates the modal.\n useEffect(() => {\n ariaHelper.modalize(ref.current);\n return () => ariaHelper.unmodalize();\n }, []);\n\n // Keeps a fresh ref for the subsequent effect.\n const onRequestCloseRef = useRef(undefined);\n useEffect(() => {\n onRequestCloseRef.current = onRequestClose;\n }, [onRequestClose]);\n\n // The list of `onRequestClose` callbacks of open (non-nested) Modals. Only\n // one should remain open at a time and the list enables closing prior ones.\n const dismissers = useContext(ModalContext);\n // Used for the tracking and dismissing any nested modals.\n const [nestedDismissers] = useState(() => new Set());\n\n // Updates the stack tracking open modals at this level and calls\n // onRequestClose for any prior and/or nested modals as applicable.\n useEffect(() => {\n // add this modal instance to the dismissers set\n dismissers.add(onRequestCloseRef);\n // request that all the other modals close themselves\n for (const dismisser of dismissers) {\n if (dismisser !== onRequestCloseRef) {\n dismisser.current?.();\n }\n }\n return () => {\n // request that all the nested modals close themselves\n for (const dismisser of nestedDismissers) {\n dismisser.current?.();\n }\n // remove this modal instance from the dismissers set\n dismissers.delete(onRequestCloseRef);\n };\n }, [dismissers, nestedDismissers]);\n\n // Adds/removes the value of bodyOpenClassName to body element.\n useEffect(() => {\n const theClass = bodyOpenClassName;\n const oneMore = 1 + (bodyOpenClasses.get(theClass) ?? 0);\n bodyOpenClasses.set(theClass, oneMore);\n document.body.classList.add(bodyOpenClassName);\n return () => {\n const oneLess = bodyOpenClasses.get(theClass) - 1;\n if (oneLess === 0) {\n document.body.classList.remove(theClass);\n bodyOpenClasses.delete(theClass);\n } else {\n bodyOpenClasses.set(theClass, oneLess);\n }\n };\n }, [bodyOpenClassName]);\n const {\n closeModal,\n frameRef,\n overlayClassname\n } = useModalExitAnimation();\n\n // Calls the isContentScrollable callback when the Modal children container resizes.\n useLayoutEffect(() => {\n if (!window.ResizeObserver || !childrenContainerRef.current) {\n return;\n }\n const resizeObserver = new ResizeObserver(isContentScrollable);\n resizeObserver.observe(childrenContainerRef.current);\n isContentScrollable();\n return () => {\n resizeObserver.disconnect();\n };\n }, [isContentScrollable, childrenContainerRef]);\n function handleEscapeKeyDown(event) {\n if (shouldCloseOnEsc && (event.code === 'Escape' || event.key === 'Escape') && !event.defaultPrevented) {\n event.preventDefault();\n closeModal().then(() => onRequestClose(event));\n }\n }\n const onContentContainerScroll = useCallback(e => {\n const scrollY = e?.currentTarget?.scrollTop ?? -1;\n if (!hasScrolledContent && scrollY > 0) {\n setHasScrolledContent(true);\n } else if (hasScrolledContent && scrollY <= 0) {\n setHasScrolledContent(false);\n }\n }, [hasScrolledContent]);\n let pressTarget = null;\n const overlayPressHandlers = {\n onPointerDown: event => {\n if (event.target === event.currentTarget) {\n pressTarget = event.target;\n // Avoids focus changing so that focus return works as expected.\n event.preventDefault();\n }\n },\n // Closes the modal with two exceptions. 1. Opening the context menu on\n // the overlay. 2. Pressing on the overlay then dragging the pointer\n // over the modal and releasing. Due to the modal being a child of the\n // overlay, such a gesture is a `click` on the overlay and cannot be\n // excepted by a `click` handler. Thus the tactic of handling\n // `pointerup` and comparing its target to that of the `pointerdown`.\n onPointerUp: ({\n target,\n button\n }) => {\n const isSameTarget = target === pressTarget;\n pressTarget = null;\n if (button === 0 && isSameTarget) {\n closeModal().then(() => onRequestClose());\n }\n }\n };\n const modal =\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: useMergeRefs([ref, forwardedRef]),\n className: clsx('components-modal__screen-overlay', overlayClassname, overlayClassnameProp),\n onKeyDown: withIgnoreIMEEvents(handleEscapeKeyDown),\n ...(shouldCloseOnClickOutside ? overlayPressHandlers : {}),\n children: /*#__PURE__*/_jsx(StyleProvider, {\n document: document,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-modal__frame', sizeClass, className),\n style: style,\n ref: useMergeRefs([frameRef, constrainedTabbingRef, focusReturnRef, focusOnMount !== 'firstContentElement' ? focusOnMountRef : null]),\n role: role,\n \"aria-label\": contentLabel,\n \"aria-labelledby\": contentLabel ? undefined : headingId,\n \"aria-describedby\": aria.describedby,\n tabIndex: -1,\n onKeyDown: onKeyDown,\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-modal__content', {\n 'hide-header': __experimentalHideHeader,\n 'is-scrollable': hasScrollableContent,\n 'has-scrolled-content': hasScrolledContent\n }),\n role: \"document\",\n onScroll: onContentContainerScroll,\n ref: contentRef,\n \"aria-label\": hasScrollableContent ? __('Scrollable section') : undefined,\n tabIndex: hasScrollableContent ? 0 : undefined,\n children: [!__experimentalHideHeader && /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header\",\n children: [/*#__PURE__*/_jsxs(\"div\", {\n className: \"components-modal__header-heading-container\",\n children: [icon && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-modal__icon-container\",\n \"aria-hidden\": true,\n children: icon\n }), title && /*#__PURE__*/_jsx(\"h1\", {\n id: headingId,\n className: \"components-modal__header-heading\",\n children: title\n })]\n }), headerActions, isDismissible && /*#__PURE__*/_jsxs(_Fragment, {\n children: [/*#__PURE__*/_jsx(Spacer, {\n marginBottom: 0,\n marginLeft: 2\n }), /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n onClick: event => closeModal().then(() => onRequestClose(event)),\n icon: close,\n label: closeButtonLabel || __('Close')\n })]\n })]\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: useMergeRefs([childrenContainerRef, focusOnMount === 'firstContentElement' ? focusOnMountRef : null]),\n className: \"components-modal__children-container\",\n children: children\n })]\n })\n })\n })\n });\n return createPortal(/*#__PURE__*/_jsx(ModalContext.Provider, {\n value: nestedDismissers,\n children: modal\n }), document.body);\n}\n\n/**\n * Modals give users information and choices related to a task they’re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef(UnforwardedModal);\nModal.displayName = 'Modal';\nexport default Modal;"],
5
5
  "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,cAAc,aAAa,WAAW,QAAQ,UAAU,YAAY,iBAAiB,kBAAkB;AAChH,SAAS,eAAe,gBAAgB,iBAAiB,uBAAuB,oBAAoB;AACpG,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,YAAY,gBAAgB;AAC5B,OAAO,YAAY;AACnB,OAAO,mBAAmB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAG7B,SAAS,OAAO,MAAM,QAAQ,OAAO,YAAY,iBAAiB;AAClE,IAAM,kBAAkB,oBAAI,IAAI;AAChC,SAAS,iBAAiB,OAAO,cAAc;AAC7C,QAAM;AAAA,IACJ,oBAAoB;AAAA,IACpB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,4BAA4B;AAAA,IAC5B,gBAAgB;AAAA;AAAA,IAEhB,OAAO;AAAA,MACL,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAA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;AAAA,EACZ,CAAC,GAAG,SAAS,IAAI;AACnB;AAiCO,IAAM,QAAQ,WAAW,gBAAgB;AAChD,MAAM,cAAc;AACpB,IAAO,gBAAQ;",
6
6
  "names": []
7
7
  }
@@ -3,65 +3,50 @@ import { useReducedMotion } from "@wordpress/compose";
3
3
  import { useCallback, useRef, useState } from "@wordpress/element";
4
4
  import warning from "@wordpress/warning";
5
5
  import { CONFIG } from "../utils/index.mjs";
6
- var FRAME_ANIMATION_DURATION_MS = Number.parseInt(
7
- CONFIG.transitionDuration
8
- );
6
+ var FRAME_ANIMATION_DURATION_MS = Number.parseInt(CONFIG.transitionDuration);
9
7
  var EXIT_ANIMATION_NAME = "components-modal__disappear-animation";
10
8
  function useModalExitAnimation() {
11
9
  const frameRef = useRef(null);
12
10
  const [isAnimatingOut, setIsAnimatingOut] = useState(false);
13
11
  const isReducedMotion = useReducedMotion();
14
- const closeModal = useCallback(
15
- () => new Promise((closeModalResolve) => {
16
- const frameEl = frameRef.current;
17
- if (isReducedMotion) {
18
- closeModalResolve();
19
- return;
20
- }
21
- if (!frameEl) {
22
- warning(
23
- "wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element."
24
- );
25
- closeModalResolve();
26
- return;
27
- }
28
- let handleAnimationEnd;
29
- const startAnimation = () => new Promise((animationResolve) => {
30
- handleAnimationEnd = (e) => {
31
- if (e.animationName === EXIT_ANIMATION_NAME) {
32
- animationResolve();
33
- }
34
- };
35
- frameEl.addEventListener(
36
- "animationend",
37
- handleAnimationEnd
38
- );
39
- setIsAnimatingOut(true);
40
- });
41
- const animationTimeout = () => new Promise((timeoutResolve) => {
42
- setTimeout(
43
- () => timeoutResolve(),
44
- // Allow an extra 20% of the animation duration for the
45
- // animationend event to fire, in case the animation frame is
46
- // slightly delayes by some other events in the event loop.
47
- FRAME_ANIMATION_DURATION_MS * 1.2
48
- );
49
- });
50
- Promise.race([startAnimation(), animationTimeout()]).then(
51
- () => {
52
- if (handleAnimationEnd) {
53
- frameEl.removeEventListener(
54
- "animationend",
55
- handleAnimationEnd
56
- );
57
- }
58
- setIsAnimatingOut(false);
59
- closeModalResolve();
12
+ const closeModal = useCallback(() => new Promise((closeModalResolve) => {
13
+ const frameEl = frameRef.current;
14
+ if (isReducedMotion) {
15
+ closeModalResolve();
16
+ return;
17
+ }
18
+ if (!frameEl) {
19
+ globalThis.SCRIPT_DEBUG === true ? warning("wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element.") : void 0;
20
+ closeModalResolve();
21
+ return;
22
+ }
23
+ let handleAnimationEnd;
24
+ const startAnimation = () => new Promise((animationResolve) => {
25
+ handleAnimationEnd = (e) => {
26
+ if (e.animationName === EXIT_ANIMATION_NAME) {
27
+ animationResolve();
60
28
  }
29
+ };
30
+ frameEl.addEventListener("animationend", handleAnimationEnd);
31
+ setIsAnimatingOut(true);
32
+ });
33
+ const animationTimeout = () => new Promise((timeoutResolve) => {
34
+ setTimeout(
35
+ () => timeoutResolve(),
36
+ // Allow an extra 20% of the animation duration for the
37
+ // animationend event to fire, in case the animation frame is
38
+ // slightly delayes by some other events in the event loop.
39
+ FRAME_ANIMATION_DURATION_MS * 1.2
61
40
  );
62
- }),
63
- [isReducedMotion]
64
- );
41
+ });
42
+ Promise.race([startAnimation(), animationTimeout()]).then(() => {
43
+ if (handleAnimationEnd) {
44
+ frameEl.removeEventListener("animationend", handleAnimationEnd);
45
+ }
46
+ setIsAnimatingOut(false);
47
+ closeModalResolve();
48
+ });
49
+ }), [isReducedMotion]);
65
50
  return {
66
51
  overlayClassname: isAnimatingOut ? "is-animating-out" : void 0,
67
52
  frameRef,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/modal/use-modal-exit-animation.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONFIG } from '../utils';\n\n/**\n * Milliseconds used as a fallback when racing `animationend` against a timeout.\n *\n * Sourced from `CONFIG.transitionDuration`. This value is implicitly coupled to\n * the modal frame\u2019s CSS `animation-duration` in `style.scss`, which uses\n * `var(--wpds-motion-duration-md, 200ms)`. If either the token, the SCSS, or\n * `CONFIG.transitionDuration` changes, keep them aligned so exit timing stays correct.\n */\nconst FRAME_ANIMATION_DURATION_MS = Number.parseInt(\n\tCONFIG.transitionDuration\n);\n\nconst EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';\n\nexport function useModalExitAnimation() {\n\tconst frameRef = useRef< HTMLDivElement >( null );\n\tconst [ isAnimatingOut, setIsAnimatingOut ] = useState( false );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst closeModal = useCallback(\n\t\t() =>\n\t\t\tnew Promise< void >( ( closeModalResolve ) => {\n\t\t\t\t// Grab a \"stable\" reference of the frame element, since\n\t\t\t\t// the value held by the react ref might change at runtime.\n\t\t\t\tconst frameEl = frameRef.current;\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\tcloseModalResolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! frameEl ) {\n\t\t\t\t\twarning(\n\t\t\t\t\t\t\"wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element.\"\n\t\t\t\t\t);\n\t\t\t\t\tcloseModalResolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet handleAnimationEnd:\n\t\t\t\t\t| undefined\n\t\t\t\t\t| ( ( e: AnimationEvent ) => void );\n\n\t\t\t\tconst startAnimation = () =>\n\t\t\t\t\tnew Promise< void >( ( animationResolve ) => {\n\t\t\t\t\t\thandleAnimationEnd = ( e: AnimationEvent ) => {\n\t\t\t\t\t\t\tif ( e.animationName === EXIT_ANIMATION_NAME ) {\n\t\t\t\t\t\t\t\tanimationResolve();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tframeEl.addEventListener(\n\t\t\t\t\t\t\t'animationend',\n\t\t\t\t\t\t\thandleAnimationEnd\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetIsAnimatingOut( true );\n\t\t\t\t\t} );\n\t\t\t\tconst animationTimeout = () =>\n\t\t\t\t\tnew Promise< void >( ( timeoutResolve ) => {\n\t\t\t\t\t\tsetTimeout(\n\t\t\t\t\t\t\t() => timeoutResolve(),\n\t\t\t\t\t\t\t// Allow an extra 20% of the animation duration for the\n\t\t\t\t\t\t\t// animationend event to fire, in case the animation frame is\n\t\t\t\t\t\t\t// slightly delayes by some other events in the event loop.\n\t\t\t\t\t\t\tFRAME_ANIMATION_DURATION_MS * 1.2\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\n\t\t\t\tPromise.race( [ startAnimation(), animationTimeout() ] ).then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif ( handleAnimationEnd ) {\n\t\t\t\t\t\t\tframeEl.removeEventListener(\n\t\t\t\t\t\t\t\t'animationend',\n\t\t\t\t\t\t\t\thandleAnimationEnd\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetIsAnimatingOut( false );\n\t\t\t\t\t\tcloseModalResolve();\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} ),\n\t\t[ isReducedMotion ]\n\t);\n\n\treturn {\n\t\toverlayClassname: isAnimatingOut ? 'is-animating-out' : undefined,\n\t\tframeRef,\n\t\tcloseModal,\n\t};\n}\n"],
5
- "mappings": ";AAGA,SAAS,wBAAwB;AACjC,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,OAAO,aAAa;AAKpB,SAAS,cAAc;AAUvB,IAAM,8BAA8B,OAAO;AAAA,EAC1C,OAAO;AACR;AAEA,IAAM,sBAAsB;AAErB,SAAS,wBAAwB;AACvC,QAAM,WAAW,OAA0B,IAAK;AAChD,QAAM,CAAE,gBAAgB,iBAAkB,IAAI,SAAU,KAAM;AAC9D,QAAM,kBAAkB,iBAAiB;AAEzC,QAAM,aAAa;AAAA,IAClB,MACC,IAAI,QAAiB,CAAE,sBAAuB;AAG7C,YAAM,UAAU,SAAS;AAEzB,UAAK,iBAAkB;AACtB,0BAAkB;AAClB;AAAA,MACD;AAEA,UAAK,CAAE,SAAU;AAChB;AAAA,UACC;AAAA,QACD;AACA,0BAAkB;AAClB;AAAA,MACD;AAEA,UAAI;AAIJ,YAAM,iBAAiB,MACtB,IAAI,QAAiB,CAAE,qBAAsB;AAC5C,6BAAqB,CAAE,MAAuB;AAC7C,cAAK,EAAE,kBAAkB,qBAAsB;AAC9C,6BAAiB;AAAA,UAClB;AAAA,QACD;AAEA,gBAAQ;AAAA,UACP;AAAA,UACA;AAAA,QACD;AACA,0BAAmB,IAAK;AAAA,MACzB,CAAE;AACH,YAAM,mBAAmB,MACxB,IAAI,QAAiB,CAAE,mBAAoB;AAC1C;AAAA,UACC,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,UAIrB,8BAA8B;AAAA,QAC/B;AAAA,MACD,CAAE;AAEH,cAAQ,KAAM,CAAE,eAAe,GAAG,iBAAiB,CAAE,CAAE,EAAE;AAAA,QACxD,MAAM;AACL,cAAK,oBAAqB;AACzB,oBAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA,UACD;AACA,4BAAmB,KAAM;AACzB,4BAAkB;AAAA,QACnB;AAAA,MACD;AAAA,IACD,CAAE;AAAA,IACH,CAAE,eAAgB;AAAA,EACnB;AAEA,SAAO;AAAA,IACN,kBAAkB,iBAAiB,qBAAqB;AAAA,IACxD;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONFIG } from '../utils';\n\n/**\n * Milliseconds used as a fallback when racing `animationend` against a timeout.\n *\n * Sourced from `CONFIG.transitionDuration`. This value is implicitly coupled to\n * the modal frame’s CSS `animation-duration` in `style.scss`, which uses the\n * WPDS `motion-duration-md` token. If either the token, the SCSS, or\n * `CONFIG.transitionDuration` changes, keep them aligned so exit timing stays correct.\n */\nconst FRAME_ANIMATION_DURATION_MS = Number.parseInt(CONFIG.transitionDuration);\nconst EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';\nexport function useModalExitAnimation() {\n const frameRef = useRef(null);\n const [isAnimatingOut, setIsAnimatingOut] = useState(false);\n const isReducedMotion = useReducedMotion();\n const closeModal = useCallback(() => new Promise(closeModalResolve => {\n // Grab a \"stable\" reference of the frame element, since\n // the value held by the react ref might change at runtime.\n const frameEl = frameRef.current;\n if (isReducedMotion) {\n closeModalResolve();\n return;\n }\n if (!frameEl) {\n globalThis.SCRIPT_DEBUG === true ? warning(\"wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element.\") : void 0;\n closeModalResolve();\n return;\n }\n let handleAnimationEnd;\n const startAnimation = () => new Promise(animationResolve => {\n handleAnimationEnd = e => {\n if (e.animationName === EXIT_ANIMATION_NAME) {\n animationResolve();\n }\n };\n frameEl.addEventListener('animationend', handleAnimationEnd);\n setIsAnimatingOut(true);\n });\n const animationTimeout = () => new Promise(timeoutResolve => {\n setTimeout(() => timeoutResolve(),\n // Allow an extra 20% of the animation duration for the\n // animationend event to fire, in case the animation frame is\n // slightly delayes by some other events in the event loop.\n FRAME_ANIMATION_DURATION_MS * 1.2);\n });\n Promise.race([startAnimation(), animationTimeout()]).then(() => {\n if (handleAnimationEnd) {\n frameEl.removeEventListener('animationend', handleAnimationEnd);\n }\n setIsAnimatingOut(false);\n closeModalResolve();\n });\n }), [isReducedMotion]);\n return {\n overlayClassname: isAnimatingOut ? 'is-animating-out' : undefined,\n frameRef,\n closeModal\n };\n}"],
5
+ "mappings": ";AAGA,SAAS,wBAAwB;AACjC,SAAS,aAAa,QAAQ,gBAAgB;AAC9C,OAAO,aAAa;AAKp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
- import { forwardRef, useRef, useEffect, useCallback } from "@wordpress/element";
2
+ import { forwardRef, useRef, useEffect } from "@wordpress/element";
3
3
  import { useMergeRefs } from "@wordpress/compose";
4
4
  import { focus } from "@wordpress/dom";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -15,6 +15,19 @@ function cycleValue(value, total, offset) {
15
15
  }
16
16
  return nextValue;
17
17
  }
18
+ function getFocusableContext(container, target, tabbableOnly) {
19
+ const finder = tabbableOnly ? focus.tabbable : focus.focusable;
20
+ const focusables = finder.find(container);
21
+ const index = focusables.indexOf(target);
22
+ if (index > -1) {
23
+ return {
24
+ index,
25
+ target,
26
+ focusables
27
+ };
28
+ }
29
+ return null;
30
+ }
18
31
  function UnforwardedNavigableContainer({
19
32
  children,
20
33
  stopNavigationEvents,
@@ -26,25 +39,6 @@ function UnforwardedNavigableContainer({
26
39
  ...restProps
27
40
  }, ref) {
28
41
  const containerRef = useRef(null);
29
- const getFocusableIndex = useCallback((focusables, target) => {
30
- return focusables.indexOf(target);
31
- }, []);
32
- const getFocusableContext = useCallback((target) => {
33
- if (!containerRef.current) {
34
- return null;
35
- }
36
- const finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;
37
- const focusables = finder.find(containerRef.current);
38
- const index = getFocusableIndex(focusables, target);
39
- if (index > -1 && target) {
40
- return {
41
- index,
42
- target,
43
- focusables
44
- };
45
- }
46
- return null;
47
- }, [onlyBrowserTabstops, getFocusableIndex]);
48
42
  useEffect(() => {
49
43
  const container = containerRef.current;
50
44
  if (!container) {
@@ -70,7 +64,7 @@ function UnforwardedNavigableContainer({
70
64
  if (!activeElement) {
71
65
  return;
72
66
  }
73
- const context = getFocusableContext(activeElement);
67
+ const context = getFocusableContext(container, activeElement, !!onlyBrowserTabstops);
74
68
  if (!context) {
75
69
  return;
76
70
  }
@@ -91,7 +85,7 @@ function UnforwardedNavigableContainer({
91
85
  return () => {
92
86
  container.removeEventListener("keydown", handleKeyDown);
93
87
  };
94
- }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, getFocusableContext]);
88
+ }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, onlyBrowserTabstops]);
95
89
  const mergedRef = useMergeRefs([containerRef, ref]);
96
90
  return /* @__PURE__ */ _jsx("div", {
97
91
  ref: mergedRef,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/navigable-container/container.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect, useCallback } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];\nfunction cycleValue(value, total, offset) {\n const nextValue = value + offset;\n if (nextValue < 0) {\n return total + nextValue;\n } else if (nextValue >= total) {\n return nextValue - total;\n }\n return nextValue;\n}\nfunction UnforwardedNavigableContainer({\n children,\n stopNavigationEvents,\n eventToOffset,\n onNavigate = noop,\n onKeyDown,\n cycle = true,\n onlyBrowserTabstops,\n ...restProps\n}, ref) {\n const containerRef = useRef(null);\n const getFocusableIndex = useCallback((focusables, target) => {\n return focusables.indexOf(target);\n }, []);\n const getFocusableContext = useCallback(target => {\n if (!containerRef.current) {\n return null;\n }\n const finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;\n const focusables = finder.find(containerRef.current);\n const index = getFocusableIndex(focusables, target);\n if (index > -1 && target) {\n return {\n index,\n target,\n focusables\n };\n }\n return null;\n }, [onlyBrowserTabstops, getFocusableIndex]);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n function handleKeyDown(event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n const offset = eventToOffset(event);\n\n // eventToOffset returns undefined if the event is not handled by the component.\n if (offset !== undefined && stopNavigationEvents) {\n // Prevents arrow key handlers bound to the document directly interfering.\n event.stopImmediatePropagation();\n\n // When navigating a collection of items, prevent scroll containers\n // from scrolling. The preventDefault also prevents Voiceover from\n // 'handling' the event, as voiceover will try to use arrow keys\n // for highlighting text.\n const targetRole = event.target?.getAttribute('role');\n const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole);\n if (targetHasMenuItemRole) {\n event.preventDefault();\n }\n }\n if (!offset) {\n return;\n }\n const activeElement = event.target?.ownerDocument?.activeElement;\n if (!activeElement) {\n return;\n }\n const context = getFocusableContext(activeElement);\n if (!context) {\n return;\n }\n const {\n index,\n focusables\n } = context;\n const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;\n if (nextIndex >= 0 && nextIndex < focusables.length) {\n focusables[nextIndex].focus();\n onNavigate(nextIndex, focusables[nextIndex]);\n\n // `preventDefault()` on tab to avoid having the browser move the focus\n // after this component has already moved it.\n if (event.code === 'Tab') {\n event.preventDefault();\n }\n }\n }\n\n // We use DOM event listeners instead of React event listeners\n // because we want to catch events from the underlying DOM tree.\n // The React Tree can be different from the DOM tree when using\n // portals. Block Toolbars for instance are rendered in a separate\n // React Trees.\n container.addEventListener('keydown', handleKeyDown);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, getFocusableContext]);\n const mergedRef = useMergeRefs([containerRef, ref]);\n return /*#__PURE__*/_jsx(\"div\", {\n ref: mergedRef,\n ...restProps,\n children: children\n });\n}\nconst NavigableContainer = forwardRef(UnforwardedNavigableContainer);\nNavigableContainer.displayName = 'NavigableContainer';\nexport default NavigableContainer;"],
5
- "mappings": ";AAOA,SAAS,YAAY,QAAQ,WAAW,mBAAmB;AAC3D,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AAKtB,SAAS,OAAO,YAAY;AAC5B,IAAM,OAAO,MAAM;AAAC;AACpB,IAAM,kBAAkB,CAAC,YAAY,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A,QACvB;AAAA,MACF;AACA,UAAI,CAAC,QAAQ;AACX;AAAA,MACF;AACA,YAAM,gBAAgB,MAAM,QAAQ,eAAe;AACnD,UAAI,CAAC,eAAe;AAClB;AAAA,MACF;AACA,YAAM,UAAU,oBAAoB,aAAa;AACjD,UAAI,CAAC,SAAS;AACZ;AAAA,MACF;AACA,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,MACF,IAAI;AACJ,YAAM,YAAY,QAAQ,WAAW,OAAO,WAAW,QAAQ,MAAM,IAAI,QAAQ;AACjF,UAAI,aAAa,KAAK,YAAY,WAAW,QAAQ;AACnD,mBAAW,SAAS,EAAE,MAAM;AAC5B,mBAAW,WAAW,WAAW,SAAS,CAAC;AAI3C,YAAI,MAAM,SAAS,OAAO;AACxB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAOA,cAAU,iBAAiB,WAAW,aAAa;AACnD,WAAO,MAAM;AACX,gBAAU,oBAAoB,WAAW,aAAa;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,WAAW,eAAe,sBAAsB,OAAO,YAAY,mBAAmB,CAAC;AAC3F,QAAM,YAAY,aAAa,CAAC,cAAc,GAAG,CAAC;AAClD,SAAoB,qBAAK,OAAO;AAAA,IAC9B,KAAK;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;AACA,IAAM,qBAAqB,WAAW,6BAA6B;AACnE,mBAAmB,cAAc;AACjC,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\nconst MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];\nfunction cycleValue(value, total, offset) {\n const nextValue = value + offset;\n if (nextValue < 0) {\n return total + nextValue;\n } else if (nextValue >= total) {\n return nextValue - total;\n }\n return nextValue;\n}\nfunction getFocusableContext(container, target, tabbableOnly) {\n const finder = tabbableOnly ? focus.tabbable : focus.focusable;\n const focusables = finder.find(container);\n const index = focusables.indexOf(target);\n if (index > -1) {\n return {\n index,\n target,\n focusables\n };\n }\n return null;\n}\nfunction UnforwardedNavigableContainer({\n children,\n stopNavigationEvents,\n eventToOffset,\n onNavigate = noop,\n onKeyDown,\n cycle = true,\n onlyBrowserTabstops,\n ...restProps\n}, ref) {\n const containerRef = useRef(null);\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return;\n }\n function handleKeyDown(event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n const offset = eventToOffset(event);\n\n // eventToOffset returns undefined if the event is not handled by the component.\n if (offset !== undefined && stopNavigationEvents) {\n // Prevents arrow key handlers bound to the document directly interfering.\n event.stopImmediatePropagation();\n\n // When navigating a collection of items, prevent scroll containers\n // from scrolling. The preventDefault also prevents Voiceover from\n // 'handling' the event, as voiceover will try to use arrow keys\n // for highlighting text.\n const targetRole = event.target?.getAttribute('role');\n const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole);\n if (targetHasMenuItemRole) {\n event.preventDefault();\n }\n }\n if (!offset) {\n return;\n }\n const activeElement = event.target?.ownerDocument?.activeElement;\n if (!activeElement) {\n return;\n }\n const context = getFocusableContext(container, activeElement, !!onlyBrowserTabstops);\n if (!context) {\n return;\n }\n const {\n index,\n focusables\n } = context;\n const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;\n if (nextIndex >= 0 && nextIndex < focusables.length) {\n focusables[nextIndex].focus();\n onNavigate(nextIndex, focusables[nextIndex]);\n\n // `preventDefault()` on tab to avoid having the browser move the focus\n // after this component has already moved it.\n if (event.code === 'Tab') {\n event.preventDefault();\n }\n }\n }\n\n // We use DOM event listeners instead of React event listeners\n // because we want to catch events from the underlying DOM tree.\n // The React Tree can be different from the DOM tree when using\n // portals. Block Toolbars for instance are rendered in a separate\n // React Trees.\n container.addEventListener('keydown', handleKeyDown);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n };\n }, [onKeyDown, eventToOffset, stopNavigationEvents, cycle, onNavigate, onlyBrowserTabstops]);\n const mergedRef = useMergeRefs([containerRef, ref]);\n return /*#__PURE__*/_jsx(\"div\", {\n ref: mergedRef,\n ...restProps,\n children: children\n });\n}\nconst NavigableContainer = forwardRef(UnforwardedNavigableContainer);\nNavigableContainer.displayName = 'NavigableContainer';\nexport default NavigableContainer;"],
5
+ "mappings": ";AAOA,SAAS,YAAY,QAAQ,iBAAiB;AAC9C,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AAKtB,SAAS,OAAO,YAAY;AAC5B,IAAM,OAAO,MAAM;AAAC;AACpB,IAAM,kBAAkB,CAAC,YAAY,iBAAiB,kBAAkB;AACxE,SAAS,WAAW,OAAO,OAAO,QAAQ;AACxC,QAAM,YAAY,QAAQ;AAC1B,MAAI,YAAY,GAAG;AACjB,WAAO,QAAQ;AAAA,EACjB,WAAW,aAAa,OAAO;AAC7B,WAAO,YAAY;AAAA,EACrB;AACA,SAAO;AACT;AACA,SAAS,oBAAoB,WAAW,QAAQ,cAAc;AAC5D,QAAM,SAAS,eAAe,MAAM,WAAW,MAAM;AACrD,QAAM,aAAa,OAAO,KAAK,SAAS;AACxC,QAAM,QAAQ,WAAW,QAAQ,MAAM;AACvC,MAAI,QAAQ,IAAI;AACd,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AACA,SAAS,8BAA8B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAAG,KAAK;AACN,QAAM,eAAe,OAAO,IAAI;AAChC,YAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,WAA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,cAAc;AACjC,IAAO,oBAAQ;",
6
6
  "names": []
7
7
  }
@@ -170,7 +170,7 @@ function Option({
170
170
  }) : /* @__PURE__ */ _jsx(NameContainer, {
171
171
  children: element.name.trim().length ? element.name : (
172
172
  /* Fall back to non-breaking space to maintain height */
173
- "\xA0"
173
+ " "
174
174
  )
175
175
  })
176
176
  }), !canOnlyChangeValues && /* @__PURE__ */ _jsx(FlexItem, {
@@ -20,7 +20,7 @@ function UnforwardedProgressBar(props, ref) {
20
20
  }), /* @__PURE__ */ _jsx(ProgressBarStyled.ProgressElement, {
21
21
  max: 100,
22
22
  value,
23
- "aria-label": __("Loading \u2026"),
23
+ "aria-label": __("Loading "),
24
24
  ref,
25
25
  ...progressProps
26
26
  })]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/progress-bar/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as ProgressBarStyled from './styles';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedProgressBar(props, ref) {\n const {\n className,\n value,\n ...progressProps\n } = props;\n const isIndeterminate = !Number.isFinite(value);\n return /*#__PURE__*/_jsxs(ProgressBarStyled.Track, {\n className: className,\n children: [/*#__PURE__*/_jsx(ProgressBarStyled.Indicator, {\n style: {\n '--indicator-width': !isIndeterminate ? `${value}%` : undefined\n },\n isIndeterminate: isIndeterminate\n }), /*#__PURE__*/_jsx(ProgressBarStyled.ProgressElement, {\n max: 100,\n value: value,\n \"aria-label\": __('Loading \u2026'),\n ref: ref,\n ...progressProps\n })]\n });\n}\n\n/**\n * A simple horizontal progress bar component.\n *\n * Supports two modes: determinate and indeterminate. A progress bar is determinate\n * when a specific progress value has been specified (from 0 to 100), and indeterminate\n * when a value hasn't been specified.\n *\n * ```jsx\n * import { ProgressBar } from '@wordpress/components';\n *\n * const MyLoadingComponent = () => {\n * \treturn <ProgressBar />;\n * };\n * ```\n */\nexport const ProgressBar = forwardRef(UnforwardedProgressBar);\nProgressBar.displayName = 'ProgressBar';\nexport default ProgressBar;"],
5
- "mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAK3B,YAAY,uBAAuB;AACnC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,uBAAuB,OAAO,KAAK;AAC1C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,kBAAkB,CAAC,OAAO,SAAS,KAAK;AAC9C,SAAoB,sBAAwB,yBAAO;AAAA,IACjD;AAAA,IACA,UAAU,CAAc,qBAAuB,6BAAW;AAAA,MACxD,OAAO;AAAA,QACL,qBAAqB,CAAC,kBAAkB,GAAG,KAAK,MAAM;AAAA,MACxD;AAAA,MACA;AAAA,IACF,CAAC,GAAgB,qBAAuB,mCAAiB;AAAA,MACvD,KAAK;AAAA,MACL;AAAA,MACA,cAAc,GAAG,gBAAW;AAAA,MAC5B;AAAA,MACA,GAAG;AAAA,IACL,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AAiBO,IAAM,cAAc,WAAW,sBAAsB;AAC5D,YAAY,cAAc;AAC1B,IAAO,uBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as ProgressBarStyled from './styles';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedProgressBar(props, ref) {\n const {\n className,\n value,\n ...progressProps\n } = props;\n const isIndeterminate = !Number.isFinite(value);\n return /*#__PURE__*/_jsxs(ProgressBarStyled.Track, {\n className: className,\n children: [/*#__PURE__*/_jsx(ProgressBarStyled.Indicator, {\n style: {\n '--indicator-width': !isIndeterminate ? `${value}%` : undefined\n },\n isIndeterminate: isIndeterminate\n }), /*#__PURE__*/_jsx(ProgressBarStyled.ProgressElement, {\n max: 100,\n value: value,\n \"aria-label\": __('Loading '),\n ref: ref,\n ...progressProps\n })]\n });\n}\n\n/**\n * A simple horizontal progress bar component.\n *\n * Supports two modes: determinate and indeterminate. A progress bar is determinate\n * when a specific progress value has been specified (from 0 to 100), and indeterminate\n * when a value hasn't been specified.\n *\n * ```jsx\n * import { ProgressBar } from '@wordpress/components';\n *\n * const MyLoadingComponent = () => {\n * \treturn <ProgressBar />;\n * };\n * ```\n */\nexport const ProgressBar = forwardRef(UnforwardedProgressBar);\nProgressBar.displayName = 'ProgressBar';\nexport default ProgressBar;"],
5
+ "mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAK3B,YAAY,uBAAuB;AACnC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,uBAAuB,OAAO,KAAK;AAC1C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,kBAAkB,CAAC,OAAO,SAAS,KAAK;AAC9C,SAAoB,sBAAwB,yBAAO;AAAA,IACjD;AAAA,IACA,UAAU,CAAc,qBAAuB,6BAAW;AAAA,MACxD,OAAO;AAAA,QACL,qBAAqB,CAAC,kBAAkB,GAAG,KAAK,MAAM;AAAA,MACxD;AAAA,MACA;AAAA,IACF,CAAC,GAAgB,qBAAuB,mCAAiB;AAAA,MACvD,KAAK;AAAA,MACL;AAAA,MACA,cAAc,GAAG,WAAW;AAAA,MAC5B;AAAA,MACA,GAAG;AAAA,IACL,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AAiBO,IAAM,cAAc,WAAW,sBAAsB;AAC5D,YAAY,cAAc;AAC1B,IAAO,uBAAQ;",
6
6
  "names": []
7
7
  }
@@ -24,11 +24,11 @@ var defaultOrderByOptions = [{
24
24
  value: "date/asc"
25
25
  }, {
26
26
  /* translators: Label for ordering posts by title in ascending order. */
27
- label: __("A \u2192 Z"),
27
+ label: __("A Z"),
28
28
  value: "title/asc"
29
29
  }, {
30
30
  /* translators: Label for ordering posts by title in descending order. */
31
- label: __("Z \u2192 A"),
31
+ label: __("Z A"),
32
32
  value: "title/desc"
33
33
  }];
34
34
  function QueryControls({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/query-controls/index.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AuthorSelect from './author-select';\nimport CategorySelect from './category-select';\nimport FormTokenField from '../form-token-field';\nimport RangeControl from '../range-control';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst DEFAULT_MIN_ITEMS = 1;\nconst DEFAULT_MAX_ITEMS = 100;\nconst MAX_CATEGORIES_SUGGESTIONS = 20;\nfunction isSingleCategorySelection(props) {\n return 'categoriesList' in props;\n}\nfunction isMultipleCategorySelection(props) {\n return 'categorySuggestions' in props;\n}\nconst defaultOrderByOptions = [{\n label: __('Newest to oldest'),\n value: 'date/desc'\n}, {\n label: __('Oldest to newest'),\n value: 'date/asc'\n}, {\n /* translators: Label for ordering posts by title in ascending order. */\n label: __('A \u2192 Z'),\n value: 'title/asc'\n}, {\n /* translators: Label for ordering posts by title in descending order. */\n label: __('Z \u2192 A'),\n value: 'title/desc'\n}];\n\n/**\n * Controls to query for posts.\n *\n * ```jsx\n * const MyQueryControls = () => (\n * <QueryControls\n * { ...{ maxItems, minItems, numberOfItems, order, orderBy, orderByOptions } }\n * onOrderByChange={ ( newOrderBy ) => {\n * updateQuery( { orderBy: newOrderBy } )\n * }\n * onOrderChange={ ( newOrder ) => {\n * updateQuery( { order: newOrder } )\n * }\n * categoriesList={ categories }\n * selectedCategoryId={ category }\n * onCategoryChange={ ( newCategory ) => {\n * updateQuery( { category: newCategory } )\n * }\n * onNumberOfItemsChange={ ( newNumberOfItems ) => {\n * updateQuery( { numberOfItems: newNumberOfItems } )\n * } }\n * />\n * );\n * ```\n */\nexport function QueryControls({\n authorList,\n selectedAuthorId,\n numberOfItems,\n order,\n orderBy,\n orderByOptions = defaultOrderByOptions,\n maxItems = DEFAULT_MAX_ITEMS,\n minItems = DEFAULT_MIN_ITEMS,\n onAuthorChange,\n onNumberOfItemsChange,\n onOrderChange,\n onOrderByChange,\n // Props for single OR multiple category selection are not destructured here,\n // but instead are destructured inline where necessary.\n ...props\n}) {\n return /*#__PURE__*/_jsx(VStack, {\n spacing: \"4\",\n className: \"components-query-controls\",\n children: [onOrderChange && onOrderByChange && /*#__PURE__*/_jsx(SelectControl, {\n __next40pxDefaultSize: true,\n label: __('Order by'),\n value: orderBy === undefined || order === undefined ? undefined : `${orderBy}/${order}`,\n options: orderByOptions,\n onChange: value => {\n if (typeof value !== 'string') {\n return;\n }\n const [newOrderBy, newOrder] = value.split('/');\n if (newOrder !== order) {\n onOrderChange(newOrder);\n }\n if (newOrderBy !== orderBy) {\n onOrderByChange(newOrderBy);\n }\n }\n }, \"query-controls-order-select\"), isSingleCategorySelection(props) && props.categoriesList && props.onCategoryChange && /*#__PURE__*/_jsx(CategorySelect, {\n __next40pxDefaultSize: true,\n categoriesList: props.categoriesList,\n label: __('Category'),\n noOptionLabel: _x('All', 'categories'),\n selectedCategoryId: props.selectedCategoryId,\n onChange: props.onCategoryChange\n }, \"query-controls-category-select\"), isMultipleCategorySelection(props) && props.categorySuggestions && props.onCategoryChange && /*#__PURE__*/_jsx(FormTokenField, {\n __next40pxDefaultSize: true,\n label: __('Categories'),\n value: props.selectedCategories && props.selectedCategories.map(item => ({\n id: item.id,\n // Keeping the fallback to `item.value` for legacy reasons,\n // even if items of `selectedCategories` should not have a\n // `value` property.\n // @ts-expect-error\n value: item.name || item.value\n })),\n suggestions: Object.keys(props.categorySuggestions),\n onChange: props.onCategoryChange,\n maxSuggestions: MAX_CATEGORIES_SUGGESTIONS\n }, \"query-controls-categories-select\"), onAuthorChange && /*#__PURE__*/_jsx(AuthorSelect, {\n __next40pxDefaultSize: true,\n authorList: authorList,\n label: __('Author'),\n noOptionLabel: _x('All', 'authors'),\n selectedAuthorId: selectedAuthorId,\n onChange: onAuthorChange\n }, \"query-controls-author-select\"), onNumberOfItemsChange && /*#__PURE__*/_jsx(RangeControl, {\n __next40pxDefaultSize: true,\n label: __('Number of items'),\n value: numberOfItems,\n onChange: onNumberOfItemsChange,\n min: minItems,\n max: maxItems,\n required: true\n }, \"query-controls-range-control\")]\n });\n}\nexport default QueryControls;"],
5
- "mappings": ";AAGA,SAAS,IAAI,UAAU;AAKvB,OAAO,kBAAkB;AACzB,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,SAAS,cAAc;AACvB,SAAS,OAAO,YAAY;AAC5B,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;AAC1B,IAAM,6BAA6B;AACnC,SAAS,0BAA0B,OAAO;AACxC,SAAO,oBAAoB;AAC7B;AACA,SAAS,4BAA4B,OAAO;AAC1C,SAAO,yBAAyB;AAClC;AACA,IAAM,wBAAwB,CAAC;AAAA,EAC7B,OAAO,GAAG,kBAAkB;AAAA,EAC5B,OAAO;AACT,GAAG;AAAA,EACD,OAAO,GAAG,kBAAkB;AAAA,EAC5B,OAAO;AACT,GAAG;AAAA;AAAA,EAED,OAAO,GAAG,YAAO;AAAA,EACjB,OAAO;AACT,GAAG;AAAA;AAAA,EAED,OAAO,GAAG,YAAO;AAAA,EACjB,OAAO;AACT,CAAC;AA2BM,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA,GAAG;AACL,G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AA,MACxF,uBAAuB;AAAA,MACvB;AAAA,MACA,OAAO,GAAG,QAAQ;AAAA,MAClB,eAAe,GAAG,OAAO,SAAS;AAAA,MAClC;AAAA,MACA,UAAU;AAAA,IACZ,GAAG,8BAA8B,GAAG,yBAAsC,qBAAK,cAAc;AAAA,MAC3F,uBAAuB;AAAA,MACvB,OAAO,GAAG,iBAAiB;AAAA,MAC3B,OAAO;AAAA,MACP,UAAU;AAAA,MACV,KAAK;AAAA,MACL,KAAK;AAAA,MACL,UAAU;AAAA,IACZ,GAAG,8BAA8B,CAAC;AAAA,EACpC,CAAC;AACH;AACA,IAAO,yBAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AuthorSelect from './author-select';\nimport CategorySelect from './category-select';\nimport FormTokenField from '../form-token-field';\nimport RangeControl from '../range-control';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst DEFAULT_MIN_ITEMS = 1;\nconst DEFAULT_MAX_ITEMS = 100;\nconst MAX_CATEGORIES_SUGGESTIONS = 20;\nfunction isSingleCategorySelection(props) {\n return 'categoriesList' in props;\n}\nfunction isMultipleCategorySelection(props) {\n return 'categorySuggestions' in props;\n}\nconst defaultOrderByOptions = [{\n label: __('Newest to oldest'),\n value: 'date/desc'\n}, {\n label: __('Oldest to newest'),\n value: 'date/asc'\n}, {\n /* translators: Label for ordering posts by title in ascending order. */\n label: __('A Z'),\n value: 'title/asc'\n}, {\n /* translators: Label for ordering posts by title in descending order. */\n label: __('Z A'),\n value: 'title/desc'\n}];\n\n/**\n * Controls to query for posts.\n *\n * ```jsx\n * const MyQueryControls = () => (\n * <QueryControls\n * { ...{ maxItems, minItems, numberOfItems, order, orderBy, orderByOptions } }\n * onOrderByChange={ ( newOrderBy ) => {\n * updateQuery( { orderBy: newOrderBy } )\n * }\n * onOrderChange={ ( newOrder ) => {\n * updateQuery( { order: newOrder } )\n * }\n * categoriesList={ categories }\n * selectedCategoryId={ category }\n * onCategoryChange={ ( newCategory ) => {\n * updateQuery( { category: newCategory } )\n * }\n * onNumberOfItemsChange={ ( newNumberOfItems ) => {\n * updateQuery( { numberOfItems: newNumberOfItems } )\n * } }\n * />\n * );\n * ```\n */\nexport function QueryControls({\n authorList,\n selectedAuthorId,\n numberOfItems,\n order,\n orderBy,\n orderByOptions = defaultOrderByOptions,\n maxItems = DEFAULT_MAX_ITEMS,\n minItems = DEFAULT_MIN_ITEMS,\n onAuthorChange,\n onNumberOfItemsChange,\n onOrderChange,\n onOrderByChange,\n // Props for single OR multiple category selection are not destructured here,\n // but instead are destructured inline where necessary.\n ...props\n}) {\n return /*#__PURE__*/_jsx(VStack, {\n spacing: \"4\",\n className: \"components-query-controls\",\n children: [onOrderChange && onOrderByChange && /*#__PURE__*/_jsx(SelectControl, {\n __next40pxDefaultSize: true,\n label: __('Order by'),\n value: orderBy === undefined || order === undefined ? undefined : `${orderBy}/${order}`,\n options: orderByOptions,\n onChange: value => {\n if (typeof value !== 'string') {\n return;\n }\n const [newOrderBy, newOrder] = value.split('/');\n if (newOrder !== order) {\n onOrderChange(newOrder);\n }\n if (newOrderBy !== orderBy) {\n onOrderByChange(newOrderBy);\n }\n }\n }, \"query-controls-order-select\"), isSingleCategorySelection(props) && props.categoriesList && props.onCategoryChange && /*#__PURE__*/_jsx(CategorySelect, {\n __next40pxDefaultSize: true,\n categoriesList: props.categoriesList,\n label: __('Category'),\n noOptionLabel: _x('All', 'categories'),\n selectedCategoryId: props.selectedCategoryId,\n onChange: props.onCategoryChange\n }, \"query-controls-category-select\"), isMultipleCategorySelection(props) && props.categorySuggestions && props.onCategoryChange && /*#__PURE__*/_jsx(FormTokenField, {\n __next40pxDefaultSize: true,\n label: __('Categories'),\n value: props.selectedCategories && props.selectedCategories.map(item => ({\n id: item.id,\n // Keeping the fallback to `item.value` for legacy reasons,\n // even if items of `selectedCategories` should not have a\n // `value` property.\n // @ts-expect-error\n value: item.name || item.value\n })),\n suggestions: Object.keys(props.categorySuggestions),\n onChange: props.onCategoryChange,\n maxSuggestions: MAX_CATEGORIES_SUGGESTIONS\n }, \"query-controls-categories-select\"), onAuthorChange && /*#__PURE__*/_jsx(AuthorSelect, {\n __next40pxDefaultSize: true,\n authorList: authorList,\n label: __('Author'),\n noOptionLabel: _x('All', 'authors'),\n selectedAuthorId: selectedAuthorId,\n onChange: onAuthorChange\n }, \"query-controls-author-select\"), onNumberOfItemsChange && /*#__PURE__*/_jsx(RangeControl, {\n __next40pxDefaultSize: true,\n label: __('Number of items'),\n value: numberOfItems,\n onChange: onNumberOfItemsChange,\n min: minItems,\n max: maxItems,\n required: true\n }, \"query-controls-range-control\")]\n });\n}\nexport default QueryControls;"],
5
+ "mappings": ";AAGA,SAAS,IAAI,UAAU;AAKvB,OAAO,kBAAkB;AACzB,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,SAAS,cAAc;AACvB,SAAS,OAAO,YAAY;AAC5B,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;AAC1B,IAAM,6BAA6B;AACnC,SAAS,0BAA0B,OAAO;AACxC,SAAO,oBAAoB;AAC7B;AACA,SAAS,4BAA4B,OAAO;AAC1C,SAAO,yBAAyB;AAClC;AACA,IAAM,wBAAwB,CAAC;AAAA,EAC7B,OAAO,GAAG,kBAAkB;AAAA,EAC5B,OAAO;AACT,GAAG;AAAA,EACD,OAAO,GAAG,kBAAkB;AAAA,EAC5B,OAAO;AACT,GAAG;AAAA;AAAA,EAED,OAAO,GAAG,OAAO;AAAA,EACjB,OAAO;AACT,GAAG;AAAA;AAAA,EAED,OAAO,GAAG,OAAO;AAAA,EACjB,OAAO;AACT,CAAC;AA2BM,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,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BAAmB;AAAA,MAClD,UAAU,MAAM;AAAA,MAChB,gBAAgB;AAAA,IAClB,GAAG,kCAAkC,GAAG,kBAA+B,qBAAK,cAAc;AAAA,MACxF,uBAAuB;AAAA,MACvB;AAAA,MACA,OAAO,GAAG,QAAQ;AAAA,MAClB,eAAe,GAAG,OAAO,SAAS;AAAA,MAClC;AAAA,MACA,UAAU;AAAA,IACZ,GAAG,8BAA8B,GAAG,yBAAsC,qBAAK,cAAc;AAAA,MAC3F,uBAAuB;AAAA,MACvB,OAAO,GAAG,iBAAiB;AAAA,MAC3B,OAAO;AAAA,MACP,UAAU;AAAA,MACV,KAAK;AAAA,MACL,KAAK;AAAA,MACL,UAAU;AAAA,IACZ,GAAG,8BAA8B,CAAC;AAAA,EACpC,CAAC;AACH;AACA,IAAO,yBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/range-control/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport { ActionRightWrapper, AfterIconWrapper, BeforeIconWrapper, InputNumber, Root, Track, ThumbWrapper, Thumb, Wrapper } from './styles/range-control-styles';\nimport { space } from '../utils/space';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Computes the value that `RangeControl` should reset to when pressing\n * the reset button.\n */\nfunction computeResetValue({\n resetFallbackValue,\n initialPosition\n}) {\n if (resetFallbackValue !== undefined) {\n return !Number.isNaN(resetFallbackValue) ? resetFallbackValue : null;\n }\n if (initialPosition !== undefined) {\n return !Number.isNaN(initialPosition) ? initialPosition : null;\n }\n return null;\n}\nfunction UnforwardedRangeControl(props, forwardedRef) {\n const {\n __nextHasNoMarginBottom: _,\n // Prevent passing to internal component\n afterIcon,\n allowReset = false,\n beforeIcon,\n className,\n color: colorProp = COLORS.theme.accent,\n currentInput,\n disabled = false,\n help,\n hideLabelFromVision = false,\n initialPosition,\n isShiftStepEnabled = true,\n label,\n marks = false,\n max = 100,\n min = 0,\n onBlur = noop,\n onChange = noop,\n onFocus = noop,\n onMouseLeave = noop,\n onMouseMove = noop,\n railColor,\n renderTooltipContent = v => v,\n resetFallbackValue,\n __next40pxDefaultSize = false,\n shiftStep = 10,\n showTooltip: showTooltipProp,\n step = 1,\n trackColor,\n value: valueProp,\n withInputField = true,\n __shouldNotWarnDeprecated36pxSize,\n ...otherProps\n } = props;\n const [value, setValue] = useControlledRangeValue({\n min,\n max,\n value: valueProp ?? null,\n initial: initialPosition\n });\n const isResetPendent = useRef(false);\n let hasTooltip = showTooltipProp;\n let hasInputField = withInputField;\n if (step === 'any') {\n // The tooltip and number input field are hidden when the step is \"any\"\n // because the decimals get too lengthy to fit well.\n hasTooltip = false;\n hasInputField = false;\n }\n const [showTooltip, setShowTooltip] = useState(hasTooltip);\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef(null);\n const isCurrentlyFocused = inputRef.current?.matches(':focus');\n const isThumbFocused = !disabled && isFocused;\n const isValueReset = value === null;\n const currentValue = value !== undefined ? value : currentInput;\n const inputSliderValue = isValueReset ? '' : currentValue;\n const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;\n const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100;\n const fillValueOffset = `${clamp(fillValue, 0, 100)}%`;\n const classes = clsx('components-range-control', className);\n const wrapperClasses = clsx('components-range-control__wrapper', !!marks && 'is-marked');\n const id = useInstanceId(UnforwardedRangeControl, 'inspector-range-control');\n const describedBy = !!help ? `${id}__help` : undefined;\n const enableTooltip = hasTooltip !== false && Number.isFinite(value);\n const handleOnRangeChange = event => {\n const nextValue = parseFloat(event.target.value);\n setValue(nextValue);\n onChange(nextValue);\n };\n const handleOnChange = next => {\n // @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n // potentially receive a NaN when next is undefined.\n let nextValue = parseFloat(next);\n setValue(nextValue);\n\n /*\n * Calls onChange only when nextValue is numeric\n * otherwise may queue a reset for the blur event.\n */\n if (!isNaN(nextValue)) {\n if (nextValue < min || nextValue > max) {\n nextValue = floatClamp(nextValue, min, max);\n }\n onChange(nextValue);\n isResetPendent.current = false;\n } else if (allowReset) {\n isResetPendent.current = true;\n }\n };\n const handleOnInputNumberBlur = () => {\n if (isResetPendent.current) {\n handleOnReset();\n isResetPendent.current = false;\n }\n };\n const handleOnReset = () => {\n // Reset to `resetFallbackValue` if defined, otherwise set internal value\n // to `null` \u2014 which, if propagated to the `value` prop, will cause\n // the value to be reset to the `initialPosition` prop if defined.\n const resetValue = Number.isNaN(resetFallbackValue) ? null : resetFallbackValue ?? null;\n setValue(resetValue);\n\n /**\n * Previously, this callback would always receive undefined as\n * an argument. This behavior is unexpected, specifically\n * when resetFallbackValue is defined.\n *\n * The value of undefined is not ideal. Passing it through\n * to internal <input /> elements would change it from a\n * controlled component to an uncontrolled component.\n *\n * For now, to minimize unexpected regressions, we're going to\n * preserve the undefined callback argument, except when a\n * resetFallbackValue is defined.\n */\n onChange(resetValue ?? undefined);\n };\n const handleShowTooltip = () => setShowTooltip(true);\n const handleHideTooltip = () => setShowTooltip(false);\n const handleOnBlur = event => {\n onBlur(event);\n setIsFocused(false);\n handleHideTooltip();\n };\n const handleOnFocus = event => {\n onFocus(event);\n setIsFocused(true);\n handleShowTooltip();\n };\n const offsetStyle = {\n [isRTL() ? 'right' : 'left']: fillValueOffset\n };\n\n // Add default size deprecation warning.\n maybeWarnDeprecated36pxSize({\n componentName: 'RangeControl',\n __next40pxDefaultSize,\n size: undefined,\n __shouldNotWarnDeprecated36pxSize\n });\n return /*#__PURE__*/_jsx(BaseControl, {\n className: classes,\n label: label,\n hideLabelFromVision: hideLabelFromVision,\n id: `${id}`,\n help: help,\n children: /*#__PURE__*/_jsxs(Root, {\n className: \"components-range-control__root\",\n __next40pxDefaultSize: __next40pxDefaultSize,\n children: [beforeIcon && /*#__PURE__*/_jsx(BeforeIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: beforeIcon\n })\n }), /*#__PURE__*/_jsxs(Wrapper, {\n className: wrapperClasses,\n color: colorProp,\n marks: !!marks,\n children: [/*#__PURE__*/_jsx(InputRange, {\n ...otherProps,\n className: \"components-range-control__slider\",\n describedBy: describedBy,\n disabled: disabled,\n id: `${id}`,\n label: label,\n max: max,\n min: min,\n onBlur: handleOnBlur,\n onChange: handleOnRangeChange,\n onFocus: handleOnFocus,\n onMouseMove: onMouseMove,\n onMouseLeave: onMouseLeave,\n ref: useMergeRefs([inputRef, forwardedRef]),\n step: step,\n value: inputSliderValue ?? undefined\n }), /*#__PURE__*/_jsx(RangeRail, {\n \"aria-hidden\": true,\n disabled: disabled,\n marks: marks,\n max: max,\n min: min,\n railColor: railColor,\n step: step,\n value: rangeFillValue\n }), /*#__PURE__*/_jsx(Track, {\n \"aria-hidden\": true,\n className: \"components-range-control__track\",\n disabled: disabled,\n style: {\n width: fillValueOffset\n },\n trackColor: trackColor\n }), /*#__PURE__*/_jsx(ThumbWrapper, {\n className: \"components-range-control__thumb-wrapper\",\n style: offsetStyle,\n disabled: disabled,\n children: /*#__PURE__*/_jsx(Thumb, {\n \"aria-hidden\": true,\n isFocused: isThumbFocused,\n disabled: disabled\n })\n }), enableTooltip && /*#__PURE__*/_jsx(SimpleTooltip, {\n className: \"components-range-control__tooltip\",\n inputRef: inputRef,\n tooltipPlacement: \"bottom\",\n renderTooltipContent: renderTooltipContent,\n show: isCurrentlyFocused || showTooltip,\n style: offsetStyle,\n value: value\n })]\n }), afterIcon && /*#__PURE__*/_jsx(AfterIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: afterIcon\n })\n }), hasInputField && /*#__PURE__*/_jsx(InputNumber, {\n \"aria-label\": label,\n className: \"components-range-control__number\",\n disabled: disabled,\n inputMode: \"decimal\",\n isShiftStepEnabled: isShiftStepEnabled,\n max: max,\n min: min,\n onBlur: handleOnInputNumberBlur,\n onChange: handleOnChange,\n shiftStep: shiftStep,\n size: __next40pxDefaultSize ? '__unstable-large' : 'default',\n __unstableInputWidth: __next40pxDefaultSize ? space(20) : space(16),\n step: step\n // @ts-expect-error TODO: Investigate if the `null` value is necessary\n ,\n value: inputSliderValue,\n __shouldNotWarnDeprecated36pxSize: true\n }), allowReset && /*#__PURE__*/_jsx(ActionRightWrapper, {\n children: /*#__PURE__*/_jsx(Button, {\n className: \"components-range-control__reset\"\n // If the RangeControl itself is disabled, the reset button shouldn't be in the tab sequence.\n ,\n accessibleWhenDisabled: !disabled\n // The reset button should be disabled if RangeControl itself is disabled,\n // or if the current `value` is equal to the value that would be currently\n // assigned when clicking the button.\n ,\n disabled: disabled || value === computeResetValue({\n resetFallbackValue,\n initialPosition\n }),\n variant: \"secondary\",\n size: \"small\",\n onClick: handleOnReset,\n children: __('Reset')\n })\n })]\n })\n });\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ value, setValue ] = useState();\n * return (\n * <RangeControl\n * __next40pxDefaultSize\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={ 50 }\n * label=\"Opacity\"\n * max={ 100 }\n * min={ 0 }\n * value={ value }\n * onChange={ setValue }\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef(UnforwardedRangeControl);\nRangeControl.displayName = 'RangeControl';\nexport default RangeControl;"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport { ActionRightWrapper, AfterIconWrapper, BeforeIconWrapper, InputNumber, Root, Track, ThumbWrapper, Thumb, Wrapper } from './styles/range-control-styles';\nimport { space } from '../utils/space';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Computes the value that `RangeControl` should reset to when pressing\n * the reset button.\n */\nfunction computeResetValue({\n resetFallbackValue,\n initialPosition\n}) {\n if (resetFallbackValue !== undefined) {\n return !Number.isNaN(resetFallbackValue) ? resetFallbackValue : null;\n }\n if (initialPosition !== undefined) {\n return !Number.isNaN(initialPosition) ? initialPosition : null;\n }\n return null;\n}\nfunction UnforwardedRangeControl(props, forwardedRef) {\n const {\n __nextHasNoMarginBottom: _,\n // Prevent passing to internal component\n afterIcon,\n allowReset = false,\n beforeIcon,\n className,\n color: colorProp = COLORS.theme.accent,\n currentInput,\n disabled = false,\n help,\n hideLabelFromVision = false,\n initialPosition,\n isShiftStepEnabled = true,\n label,\n marks = false,\n max = 100,\n min = 0,\n onBlur = noop,\n onChange = noop,\n onFocus = noop,\n onMouseLeave = noop,\n onMouseMove = noop,\n railColor,\n renderTooltipContent = v => v,\n resetFallbackValue,\n __next40pxDefaultSize = false,\n shiftStep = 10,\n showTooltip: showTooltipProp,\n step = 1,\n trackColor,\n value: valueProp,\n withInputField = true,\n __shouldNotWarnDeprecated36pxSize,\n ...otherProps\n } = props;\n const [value, setValue] = useControlledRangeValue({\n min,\n max,\n value: valueProp ?? null,\n initial: initialPosition\n });\n const isResetPendent = useRef(false);\n let hasTooltip = showTooltipProp;\n let hasInputField = withInputField;\n if (step === 'any') {\n // The tooltip and number input field are hidden when the step is \"any\"\n // because the decimals get too lengthy to fit well.\n hasTooltip = false;\n hasInputField = false;\n }\n const [showTooltip, setShowTooltip] = useState(hasTooltip);\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef(null);\n const isCurrentlyFocused = inputRef.current?.matches(':focus');\n const isThumbFocused = !disabled && isFocused;\n const isValueReset = value === null;\n const currentValue = value !== undefined ? value : currentInput;\n const inputSliderValue = isValueReset ? '' : currentValue;\n const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;\n const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100;\n const fillValueOffset = `${clamp(fillValue, 0, 100)}%`;\n const classes = clsx('components-range-control', className);\n const wrapperClasses = clsx('components-range-control__wrapper', !!marks && 'is-marked');\n const id = useInstanceId(UnforwardedRangeControl, 'inspector-range-control');\n const describedBy = !!help ? `${id}__help` : undefined;\n const enableTooltip = hasTooltip !== false && Number.isFinite(value);\n const handleOnRangeChange = event => {\n const nextValue = parseFloat(event.target.value);\n setValue(nextValue);\n onChange(nextValue);\n };\n const handleOnChange = next => {\n // @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n // potentially receive a NaN when next is undefined.\n let nextValue = parseFloat(next);\n setValue(nextValue);\n\n /*\n * Calls onChange only when nextValue is numeric\n * otherwise may queue a reset for the blur event.\n */\n if (!isNaN(nextValue)) {\n if (nextValue < min || nextValue > max) {\n nextValue = floatClamp(nextValue, min, max);\n }\n onChange(nextValue);\n isResetPendent.current = false;\n } else if (allowReset) {\n isResetPendent.current = true;\n }\n };\n const handleOnInputNumberBlur = () => {\n if (isResetPendent.current) {\n handleOnReset();\n isResetPendent.current = false;\n }\n };\n const handleOnReset = () => {\n // Reset to `resetFallbackValue` if defined, otherwise set internal value\n // to `null` — which, if propagated to the `value` prop, will cause\n // the value to be reset to the `initialPosition` prop if defined.\n const resetValue = Number.isNaN(resetFallbackValue) ? null : resetFallbackValue ?? null;\n setValue(resetValue);\n\n /**\n * Previously, this callback would always receive undefined as\n * an argument. This behavior is unexpected, specifically\n * when resetFallbackValue is defined.\n *\n * The value of undefined is not ideal. Passing it through\n * to internal <input /> elements would change it from a\n * controlled component to an uncontrolled component.\n *\n * For now, to minimize unexpected regressions, we're going to\n * preserve the undefined callback argument, except when a\n * resetFallbackValue is defined.\n */\n onChange(resetValue ?? undefined);\n };\n const handleShowTooltip = () => setShowTooltip(true);\n const handleHideTooltip = () => setShowTooltip(false);\n const handleOnBlur = event => {\n onBlur(event);\n setIsFocused(false);\n handleHideTooltip();\n };\n const handleOnFocus = event => {\n onFocus(event);\n setIsFocused(true);\n handleShowTooltip();\n };\n const offsetStyle = {\n [isRTL() ? 'right' : 'left']: fillValueOffset\n };\n\n // Add default size deprecation warning.\n maybeWarnDeprecated36pxSize({\n componentName: 'RangeControl',\n __next40pxDefaultSize,\n size: undefined,\n __shouldNotWarnDeprecated36pxSize\n });\n return /*#__PURE__*/_jsx(BaseControl, {\n className: classes,\n label: label,\n hideLabelFromVision: hideLabelFromVision,\n id: `${id}`,\n help: help,\n children: /*#__PURE__*/_jsxs(Root, {\n className: \"components-range-control__root\",\n __next40pxDefaultSize: __next40pxDefaultSize,\n children: [beforeIcon && /*#__PURE__*/_jsx(BeforeIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: beforeIcon\n })\n }), /*#__PURE__*/_jsxs(Wrapper, {\n className: wrapperClasses,\n color: colorProp,\n marks: !!marks,\n children: [/*#__PURE__*/_jsx(InputRange, {\n ...otherProps,\n className: \"components-range-control__slider\",\n describedBy: describedBy,\n disabled: disabled,\n id: `${id}`,\n label: label,\n max: max,\n min: min,\n onBlur: handleOnBlur,\n onChange: handleOnRangeChange,\n onFocus: handleOnFocus,\n onMouseMove: onMouseMove,\n onMouseLeave: onMouseLeave,\n ref: useMergeRefs([inputRef, forwardedRef]),\n step: step,\n value: inputSliderValue ?? undefined\n }), /*#__PURE__*/_jsx(RangeRail, {\n \"aria-hidden\": true,\n disabled: disabled,\n marks: marks,\n max: max,\n min: min,\n railColor: railColor,\n step: step,\n value: rangeFillValue\n }), /*#__PURE__*/_jsx(Track, {\n \"aria-hidden\": true,\n className: \"components-range-control__track\",\n disabled: disabled,\n style: {\n width: fillValueOffset\n },\n trackColor: trackColor\n }), /*#__PURE__*/_jsx(ThumbWrapper, {\n className: \"components-range-control__thumb-wrapper\",\n style: offsetStyle,\n disabled: disabled,\n children: /*#__PURE__*/_jsx(Thumb, {\n \"aria-hidden\": true,\n isFocused: isThumbFocused,\n disabled: disabled\n })\n }), enableTooltip && /*#__PURE__*/_jsx(SimpleTooltip, {\n className: \"components-range-control__tooltip\",\n inputRef: inputRef,\n tooltipPlacement: \"bottom\",\n renderTooltipContent: renderTooltipContent,\n show: isCurrentlyFocused || showTooltip,\n style: offsetStyle,\n value: value\n })]\n }), afterIcon && /*#__PURE__*/_jsx(AfterIconWrapper, {\n children: /*#__PURE__*/_jsx(Icon, {\n icon: afterIcon\n })\n }), hasInputField && /*#__PURE__*/_jsx(InputNumber, {\n \"aria-label\": label,\n className: \"components-range-control__number\",\n disabled: disabled,\n inputMode: \"decimal\",\n isShiftStepEnabled: isShiftStepEnabled,\n max: max,\n min: min,\n onBlur: handleOnInputNumberBlur,\n onChange: handleOnChange,\n shiftStep: shiftStep,\n size: __next40pxDefaultSize ? '__unstable-large' : 'default',\n __unstableInputWidth: __next40pxDefaultSize ? space(20) : space(16),\n step: step\n // @ts-expect-error TODO: Investigate if the `null` value is necessary\n ,\n value: inputSliderValue,\n __shouldNotWarnDeprecated36pxSize: true\n }), allowReset && /*#__PURE__*/_jsx(ActionRightWrapper, {\n children: /*#__PURE__*/_jsx(Button, {\n className: \"components-range-control__reset\"\n // If the RangeControl itself is disabled, the reset button shouldn't be in the tab sequence.\n ,\n accessibleWhenDisabled: !disabled\n // The reset button should be disabled if RangeControl itself is disabled,\n // or if the current `value` is equal to the value that would be currently\n // assigned when clicking the button.\n ,\n disabled: disabled || value === computeResetValue({\n resetFallbackValue,\n initialPosition\n }),\n variant: \"secondary\",\n size: \"small\",\n onClick: handleOnReset,\n children: __('Reset')\n })\n })]\n })\n });\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ value, setValue ] = useState();\n * return (\n * <RangeControl\n * __next40pxDefaultSize\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={ 50 }\n * label=\"Opacity\"\n * max={ 100 }\n * min={ 0 }\n * value={ value }\n * onChange={ setValue }\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef(UnforwardedRangeControl);\nRangeControl.displayName = 'RangeControl';\nexport default RangeControl;"],
5
5
  "mappings": ";AAGA,OAAO,UAAU;AAIjB,SAAS,IAAI,aAAa;AAC1B,SAAS,QAAQ,UAAU,kBAAkB;AAC7C,SAAS,eAAe,oBAAoB;AAK5C,OAAO,iBAAiB;AACxB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,YAAY,+BAA+B;AACpD,SAAS,aAAa;AACtB,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,oBAAoB,kBAAkB,mBAAmB,aAAa,MAAM,OAAO,cAAc,OAAO,eAAe;AAChI,SAAS,aAAa;AACtB,SAAS,mCAAmC;AAC5C,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,OAAO,MAAM;AAAC;AAMpB,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AACF,GAAG;AACD,MAAI,uBAAuB,QAAW;AACpC,WAAO,CAAC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;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;AA0BO,IAAM,eAAe,WAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,7 @@
2
2
  import { renderToString, useRef, useState, useEffect, useMemo } from "@wordpress/element";
3
3
  import { useFocusableIframe, useMergeRefs } from "@wordpress/compose";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ var VIEWPORT_UNIT_VALUE_REGEX = /^\d*\.?\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/;
5
6
  var observeAndResizeJS = function() {
6
7
  const {
7
8
  MutationObserver
@@ -30,7 +31,7 @@ var observeAndResizeJS = function() {
30
31
  function removeViewportStyles(ruleOrNode) {
31
32
  if (ruleOrNode.style) {
32
33
  ["width", "height", "minHeight", "maxHeight"].forEach(function(style2) {
33
- if (/^\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style2])) {
34
+ if (/^\d*\.?\d+(?:vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style2])) {
34
35
  ruleOrNode.style[style2] = "";
35
36
  }
36
37
  });
@@ -309,6 +310,7 @@ function SandBox({
309
310
  }
310
311
  var sandbox_default = SandBox;
311
312
  export {
313
+ VIEWPORT_UNIT_VALUE_REGEX,
312
314
  sandbox_default as default
313
315
  };
314
316
  //# sourceMappingURL=index.mjs.map