@wordpress/components 33.0.1-next.v.202604201441.0 → 33.1.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 (870) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/build/alignment-matrix-control/cell.cjs +79 -5
  3. package/build/alignment-matrix-control/cell.cjs.map +3 -3
  4. package/build/alignment-matrix-control/index.cjs +79 -5
  5. package/build/alignment-matrix-control/index.cjs.map +3 -3
  6. package/build/angle-picker-control/angle-circle.cjs +79 -5
  7. package/build/angle-picker-control/angle-circle.cjs.map +3 -3
  8. package/build/autocomplete/autocompleter-ui.cjs.map +2 -2
  9. package/build/color-palette/index.cjs +14 -8
  10. package/build/color-palette/index.cjs.map +2 -2
  11. package/build/color-palette/utils.cjs +9 -2
  12. package/build/color-palette/utils.cjs.map +2 -2
  13. package/build/color-picker/hex-input.cjs +1 -1
  14. package/build/color-picker/hex-input.cjs.map +2 -2
  15. package/build/custom-gradient-picker/index.cjs.map +2 -2
  16. package/build/focal-point-picker/index.cjs.map +2 -2
  17. package/build/form-token-field/index.cjs +22 -6
  18. package/build/form-token-field/index.cjs.map +3 -3
  19. package/build/form-token-field/token-input.cjs +1 -1
  20. package/build/form-token-field/token-input.cjs.map +2 -2
  21. package/build/menu/popover.cjs +7 -3
  22. package/build/menu/popover.cjs.map +2 -2
  23. package/build/menu/styles.cjs +39 -16
  24. package/build/menu/styles.cjs.map +2 -2
  25. package/build/modal/index.cjs +1 -5
  26. package/build/modal/index.cjs.map +2 -2
  27. package/build/modal/use-modal-exit-animation.cjs +52 -41
  28. package/build/modal/use-modal-exit-animation.cjs.map +2 -2
  29. package/build/palette-edit/index.cjs.map +2 -2
  30. package/build/slot-fill/fill.cjs +2 -2
  31. package/build/slot-fill/fill.cjs.map +2 -2
  32. package/build/style-provider/index.cjs +82 -3
  33. package/build/style-provider/index.cjs.map +4 -4
  34. package/build/text/styles.cjs +7 -7
  35. package/build/text/styles.cjs.map +2 -2
  36. package/build/utils/breakpoint.cjs.map +1 -1
  37. package/build/utils/config-values.cjs +3 -0
  38. package/build/utils/config-values.cjs.map +2 -2
  39. package/build/utils/dropdown-motion.cjs +2 -2
  40. package/build/utils/dropdown-motion.cjs.map +2 -2
  41. package/build/utils/font.cjs.map +1 -1
  42. package/build/visually-hidden/component.cjs +1 -0
  43. package/build/visually-hidden/component.cjs.map +2 -2
  44. package/build-module/alignment-matrix-control/cell.mjs +79 -5
  45. package/build-module/alignment-matrix-control/cell.mjs.map +3 -3
  46. package/build-module/alignment-matrix-control/index.mjs +79 -5
  47. package/build-module/alignment-matrix-control/index.mjs.map +3 -3
  48. package/build-module/angle-picker-control/angle-circle.mjs +79 -5
  49. package/build-module/angle-picker-control/angle-circle.mjs.map +3 -3
  50. package/build-module/autocomplete/autocompleter-ui.mjs.map +2 -2
  51. package/build-module/color-palette/index.mjs +14 -8
  52. package/build-module/color-palette/index.mjs.map +2 -2
  53. package/build-module/color-palette/utils.mjs +9 -2
  54. package/build-module/color-palette/utils.mjs.map +2 -2
  55. package/build-module/color-picker/hex-input.mjs +1 -1
  56. package/build-module/color-picker/hex-input.mjs.map +2 -2
  57. package/build-module/custom-gradient-picker/index.mjs.map +2 -2
  58. package/build-module/focal-point-picker/index.mjs.map +2 -2
  59. package/build-module/form-token-field/index.mjs +22 -6
  60. package/build-module/form-token-field/index.mjs.map +2 -2
  61. package/build-module/form-token-field/token-input.mjs +1 -1
  62. package/build-module/form-token-field/token-input.mjs.map +2 -2
  63. package/build-module/menu/popover.mjs +7 -3
  64. package/build-module/menu/popover.mjs.map +2 -2
  65. package/build-module/menu/styles.mjs +37 -16
  66. package/build-module/menu/styles.mjs.map +2 -2
  67. package/build-module/modal/index.mjs +1 -5
  68. package/build-module/modal/index.mjs.map +2 -2
  69. package/build-module/modal/use-modal-exit-animation.mjs +52 -41
  70. package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
  71. package/build-module/palette-edit/index.mjs.map +2 -2
  72. package/build-module/slot-fill/fill.mjs +2 -2
  73. package/build-module/slot-fill/fill.mjs.map +2 -2
  74. package/build-module/style-provider/index.mjs +82 -3
  75. package/build-module/style-provider/index.mjs.map +4 -4
  76. package/build-module/text/styles.mjs +7 -7
  77. package/build-module/text/styles.mjs.map +2 -2
  78. package/build-module/utils/breakpoint.mjs.map +1 -1
  79. package/build-module/utils/config-values.mjs +3 -0
  80. package/build-module/utils/config-values.mjs.map +2 -2
  81. package/build-module/utils/dropdown-motion.mjs +2 -2
  82. package/build-module/utils/dropdown-motion.mjs.map +2 -2
  83. package/build-module/utils/font.mjs.map +1 -1
  84. package/build-module/visually-hidden/component.mjs +1 -0
  85. package/build-module/visually-hidden/component.mjs.map +2 -2
  86. package/build-style/style-rtl.css +90 -34
  87. package/build-style/style.css +90 -34
  88. package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
  89. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  90. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  91. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  92. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  93. package/build-types/angle-picker-control/index.d.ts +1 -1
  94. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  95. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  96. package/build-types/angle-picker-control/stories/index.story.d.ts.map +1 -1
  97. package/build-types/animate/index.d.ts.map +1 -1
  98. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  99. package/build-types/autocomplete/autocompleter-ui.d.ts +1 -1
  100. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  101. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -1
  102. package/build-types/autocomplete/index.d.ts +3 -3
  103. package/build-types/autocomplete/index.d.ts.map +1 -1
  104. package/build-types/badge/index.d.ts.map +1 -1
  105. package/build-types/badge/stories/index.story.d.ts.map +1 -1
  106. package/build-types/base-control/hooks.d.ts +4 -4
  107. package/build-types/base-control/index.d.ts +2 -2
  108. package/build-types/base-control/index.d.ts.map +1 -1
  109. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  110. package/build-types/border-box-control/border-box-control/component.d.ts +4 -4
  111. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  112. package/build-types/border-box-control/border-box-control/hook.d.ts +124 -124
  113. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  114. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  115. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +117 -117
  116. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +4 -4
  117. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  118. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +116 -116
  119. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  120. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +106 -106
  121. package/build-types/border-box-control/stories/index.story.d.ts +5 -5
  122. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  123. package/build-types/border-box-control/styles.d.ts +3 -3
  124. package/build-types/border-box-control/styles.d.ts.map +1 -1
  125. package/build-types/border-box-control/utils.d.ts.map +1 -1
  126. package/build-types/border-control/border-control/component.d.ts +5 -5
  127. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  128. package/build-types/border-control/border-control/hook.d.ts +129 -129
  129. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  130. package/build-types/border-control/border-control-dropdown/component.d.ts +3 -3
  131. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  132. package/build-types/border-control/border-control-dropdown/hook.d.ts +122 -122
  133. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  134. package/build-types/border-control/border-control-style-picker/component.d.ts +1 -1
  135. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  136. package/build-types/border-control/stories/index.story.d.ts +30 -30
  137. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  138. package/build-types/border-control/styles.d.ts +2 -2
  139. package/build-types/border-control/styles.d.ts.map +1 -1
  140. package/build-types/box-control/index.d.ts +1 -1
  141. package/build-types/box-control/index.d.ts.map +1 -1
  142. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  143. package/build-types/box-control/styles/box-control-styles.d.ts +15 -15
  144. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  145. package/build-types/box-control/utils.d.ts +2 -2
  146. package/build-types/box-control/utils.d.ts.map +1 -1
  147. package/build-types/button/deprecated.d.ts +34 -34
  148. package/build-types/button/deprecated.d.ts.map +1 -1
  149. package/build-types/button/index.d.ts.map +1 -1
  150. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  151. package/build-types/button/stories/index.story.d.ts.map +1 -1
  152. package/build-types/button-group/index.d.ts.map +1 -1
  153. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  154. package/build-types/calendar/date-calendar/index.d.ts.map +1 -1
  155. package/build-types/calendar/date-range-calendar/index.d.ts +1 -1
  156. package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -1
  157. package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -1
  158. package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -1
  159. package/build-types/calendar/test/__utils__/index.d.ts.map +1 -1
  160. package/build-types/calendar/utils/constants.d.ts +2 -2
  161. package/build-types/calendar/utils/constants.d.ts.map +1 -1
  162. package/build-types/calendar/utils/use-localization-props.d.ts +3 -3
  163. package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -1
  164. package/build-types/card/card/component.d.ts.map +1 -1
  165. package/build-types/card/card/hook.d.ts +110 -110
  166. package/build-types/card/card-body/component.d.ts.map +1 -1
  167. package/build-types/card/card-body/hook.d.ts +107 -107
  168. package/build-types/card/card-divider/component.d.ts +2 -2
  169. package/build-types/card/card-divider/component.d.ts.map +1 -1
  170. package/build-types/card/card-divider/hook.d.ts +108 -108
  171. package/build-types/card/card-footer/component.d.ts.map +1 -1
  172. package/build-types/card/card-footer/hook.d.ts +113 -113
  173. package/build-types/card/card-header/component.d.ts.map +1 -1
  174. package/build-types/card/card-header/hook.d.ts +113 -113
  175. package/build-types/card/card-media/component.d.ts.map +1 -1
  176. package/build-types/card/card-media/hook.d.ts +106 -106
  177. package/build-types/card/get-padding-by-size.d.ts +1 -1
  178. package/build-types/card/get-padding-by-size.d.ts.map +1 -1
  179. package/build-types/card/stories/index.story.d.ts +0 -6
  180. package/build-types/card/stories/index.story.d.ts.map +1 -1
  181. package/build-types/checkbox-control/index.d.ts.map +1 -1
  182. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  183. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +1 -1
  184. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  185. package/build-types/circular-option-picker/circular-option-picker.d.ts +8 -0
  186. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  187. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  188. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  189. package/build-types/color-indicator/index.d.ts +1 -1
  190. package/build-types/color-indicator/index.d.ts.map +1 -1
  191. package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
  192. package/build-types/color-palette/index.d.ts.map +1 -1
  193. package/build-types/color-palette/stories/index.story.d.ts +1 -0
  194. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  195. package/build-types/color-palette/styles.d.ts +5 -5
  196. package/build-types/color-palette/types.d.ts +16 -2
  197. package/build-types/color-palette/types.d.ts.map +1 -1
  198. package/build-types/color-palette/utils.d.ts +1 -1
  199. package/build-types/color-palette/utils.d.ts.map +1 -1
  200. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  201. package/build-types/color-picker/color-input.d.ts.map +1 -1
  202. package/build-types/color-picker/component.d.ts +1 -1
  203. package/build-types/color-picker/component.d.ts.map +1 -1
  204. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  205. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  206. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  207. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  208. package/build-types/color-picker/picker.d.ts.map +1 -1
  209. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  210. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  211. package/build-types/color-picker/styles.d.ts +20 -20
  212. package/build-types/color-picker/styles.d.ts.map +1 -1
  213. package/build-types/combobox-control/index.d.ts.map +1 -1
  214. package/build-types/combobox-control/stories/index.story.d.ts +8 -8
  215. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  216. package/build-types/combobox-control/styles.d.ts +1 -1
  217. package/build-types/composite/index.d.ts +25 -25
  218. package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
  219. package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
  220. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  221. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  222. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  223. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  224. package/build-types/context/constants.d.ts +3 -3
  225. package/build-types/context/constants.d.ts.map +1 -1
  226. package/build-types/context/context-system-provider.d.ts +4 -4
  227. package/build-types/context/context-system-provider.d.ts.map +1 -1
  228. package/build-types/context/use-context-system.d.ts +4 -4
  229. package/build-types/context/use-context-system.d.ts.map +1 -1
  230. package/build-types/context/utils.d.ts +2 -2
  231. package/build-types/context/utils.d.ts.map +1 -1
  232. package/build-types/custom-gradient-picker/constants.d.ts +2 -2
  233. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
  234. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +1 -1
  235. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  236. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +1 -1
  237. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  238. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  239. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  240. package/build-types/custom-gradient-picker/serializer.d.ts +3 -3
  241. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  242. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  243. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  244. package/build-types/custom-select-control/index.d.ts.map +1 -1
  245. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  246. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  247. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  248. package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
  249. package/build-types/custom-select-control-v2/stories/index.story.d.ts +6 -6
  250. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  251. package/build-types/custom-select-control-v2/styles.d.ts +6 -6
  252. package/build-types/dashicon/index.d.ts.map +1 -1
  253. package/build-types/date-time/date-picker/index.d.ts +1 -1
  254. package/build-types/date-time/date-picker/index.d.ts.map +1 -1
  255. package/build-types/date-time/date-picker/styles.d.ts +9 -9
  256. package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -1
  257. package/build-types/date-time/date-time/index.d.ts +1 -1
  258. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  259. package/build-types/date-time/date-time/styles.d.ts +4 -4
  260. package/build-types/date-time/index.d.ts.map +1 -1
  261. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  262. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  263. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  264. package/build-types/date-time/time-picker/index.d.ts +1 -1
  265. package/build-types/date-time/time-picker/index.d.ts.map +1 -1
  266. package/build-types/date-time/time-picker/styles.d.ts +28 -28
  267. package/build-types/date-time/time-picker/time-input/index.d.ts +1 -1
  268. package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -1
  269. package/build-types/date-time/time-picker/timezone.d.ts.map +1 -1
  270. package/build-types/date-time/utils.d.ts.map +1 -1
  271. package/build-types/disabled/context.d.ts.map +1 -1
  272. package/build-types/disabled/index.d.ts +2 -0
  273. package/build-types/disabled/index.d.ts.map +1 -1
  274. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  275. package/build-types/disclosure/index.d.ts.map +1 -1
  276. package/build-types/divider/component.d.ts +2 -2
  277. package/build-types/divider/component.d.ts.map +1 -1
  278. package/build-types/divider/stories/index.story.d.ts.map +1 -1
  279. package/build-types/divider/styles.d.ts +2 -2
  280. package/build-types/draggable/index.d.ts +1 -1
  281. package/build-types/draggable/index.d.ts.map +1 -1
  282. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  283. package/build-types/drop-zone/index.d.ts.map +1 -1
  284. package/build-types/drop-zone/provider.d.ts +1 -1
  285. package/build-types/drop-zone/provider.d.ts.map +1 -1
  286. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  287. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  288. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  289. package/build-types/dropdown/index.d.ts.map +1 -1
  290. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  291. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  292. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  293. package/build-types/duotone-picker/color-list-picker/index.d.ts +1 -1
  294. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  295. package/build-types/duotone-picker/custom-duotone-bar.d.ts +1 -1
  296. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -1
  297. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  298. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -1
  299. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  300. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  301. package/build-types/elevation/component.d.ts.map +1 -1
  302. package/build-types/elevation/hook.d.ts +105 -105
  303. package/build-types/elevation/stories/index.story.d.ts.map +1 -1
  304. package/build-types/external-link/index.d.ts.map +1 -1
  305. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  306. package/build-types/flex/context.d.ts +2 -2
  307. package/build-types/flex/flex/component.d.ts.map +1 -1
  308. package/build-types/flex/flex/hook.d.ts +108 -108
  309. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  310. package/build-types/flex/flex-block/hook.d.ts +106 -106
  311. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  312. package/build-types/flex/flex-item/hook.d.ts +106 -106
  313. package/build-types/flex/stories/index.story.d.ts.map +1 -1
  314. package/build-types/focal-point-picker/controls.d.ts +1 -1
  315. package/build-types/focal-point-picker/controls.d.ts.map +1 -1
  316. package/build-types/focal-point-picker/index.d.ts +16 -11
  317. package/build-types/focal-point-picker/index.d.ts.map +1 -1
  318. package/build-types/focal-point-picker/stories/index.story.d.ts +16 -16
  319. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  320. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +254 -254
  321. package/build-types/focal-point-picker/utils.d.ts.map +1 -1
  322. package/build-types/font-size-picker/constants.d.ts +2 -2
  323. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  324. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  325. package/build-types/font-size-picker/index.d.ts.map +1 -1
  326. package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
  327. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  328. package/build-types/font-size-picker/styles.d.ts +5 -5
  329. package/build-types/form-file-upload/index.d.ts.map +1 -1
  330. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  331. package/build-types/form-toggle/index.d.ts +1 -1
  332. package/build-types/form-toggle/index.d.ts.map +1 -1
  333. package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
  334. package/build-types/form-token-field/index.d.ts.map +1 -1
  335. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  336. package/build-types/form-token-field/styles.d.ts +1 -1
  337. package/build-types/form-token-field/suggestions-list.d.ts +1 -1
  338. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  339. package/build-types/form-token-field/token-input.d.ts +1 -1
  340. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  341. package/build-types/form-token-field/token.d.ts +1 -1
  342. package/build-types/form-token-field/token.d.ts.map +1 -1
  343. package/build-types/form-token-field/types.d.ts +16 -2
  344. package/build-types/form-token-field/types.d.ts.map +1 -1
  345. package/build-types/gradient-picker/index.d.ts.map +1 -1
  346. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  347. package/build-types/grid/component.d.ts.map +1 -1
  348. package/build-types/grid/hook.d.ts +106 -106
  349. package/build-types/grid/stories/index.story.d.ts.map +1 -1
  350. package/build-types/grid/utils.d.ts.map +1 -1
  351. package/build-types/guide/index.d.ts +1 -1
  352. package/build-types/guide/index.d.ts.map +1 -1
  353. package/build-types/guide/page-control.d.ts +1 -1
  354. package/build-types/guide/page-control.d.ts.map +1 -1
  355. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  356. package/build-types/h-stack/component.d.ts +3 -3
  357. package/build-types/h-stack/component.d.ts.map +1 -1
  358. package/build-types/h-stack/hook.d.ts +107 -107
  359. package/build-types/h-stack/stories/e2e/index.story.d.ts.map +1 -1
  360. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  361. package/build-types/heading/component.d.ts +4 -4
  362. package/build-types/heading/component.d.ts.map +1 -1
  363. package/build-types/heading/hook.d.ts +107 -107
  364. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  365. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -1
  366. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  367. package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -1
  368. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -1
  369. package/build-types/higher-order/with-filters/index.d.ts +2 -2
  370. package/build-types/higher-order/with-focus-outside/index.d.ts.map +1 -1
  371. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -1
  372. package/build-types/higher-order/with-notices/index.d.ts +3 -3
  373. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  374. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  375. package/build-types/icon/index.d.ts.map +1 -1
  376. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  377. package/build-types/input-control/backdrop.d.ts.map +1 -1
  378. package/build-types/input-control/index.d.ts.map +1 -1
  379. package/build-types/input-control/input-base.d.ts.map +1 -1
  380. package/build-types/input-control/input-field.d.ts +1 -1
  381. package/build-types/input-control/input-field.d.ts.map +1 -1
  382. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  383. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  384. package/build-types/input-control/reducer/reducer.d.ts +9 -9
  385. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  386. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  387. package/build-types/input-control/styles/input-control-styles.d.ts +3 -3
  388. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  389. package/build-types/isolated-event-container/index.d.ts.map +1 -1
  390. package/build-types/item-group/item/component.d.ts.map +1 -1
  391. package/build-types/item-group/item/hook.d.ts +104 -104
  392. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  393. package/build-types/item-group/item-group/hook.d.ts +105 -105
  394. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  395. package/build-types/item-group/styles.d.ts +1 -1
  396. package/build-types/item-group/styles.d.ts.map +1 -1
  397. package/build-types/keyboard-shortcuts/index.d.ts +1 -1
  398. package/build-types/keyboard-shortcuts/index.d.ts.map +1 -1
  399. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  400. package/build-types/lock-unlock.d.ts +1 -2
  401. package/build-types/lock-unlock.d.ts.map +1 -1
  402. package/build-types/menu/group-label.d.ts +1 -1
  403. package/build-types/menu/group.d.ts +1 -1
  404. package/build-types/menu/index.d.ts +5 -5
  405. package/build-types/menu/index.d.ts.map +1 -1
  406. package/build-types/menu/item-help-text.d.ts +1 -1
  407. package/build-types/menu/item-label.d.ts +1 -1
  408. package/build-types/menu/popover.d.ts.map +1 -1
  409. package/build-types/menu/separator.d.ts +1 -1
  410. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  411. package/build-types/menu/styles.d.ts +23 -8
  412. package/build-types/menu/styles.d.ts.map +1 -1
  413. package/build-types/menu-group/index.d.ts.map +1 -1
  414. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  415. package/build-types/menu-item/index.d.ts +2 -2
  416. package/build-types/menu-item/index.d.ts.map +1 -1
  417. package/build-types/menu-item/stories/index.story.d.ts +8 -8
  418. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  419. package/build-types/menu-items-choice/index.d.ts +1 -1
  420. package/build-types/menu-items-choice/index.d.ts.map +1 -1
  421. package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
  422. package/build-types/mobile/image/constants.d.ts +4 -4
  423. package/build-types/mobile/image/constants.d.ts.map +1 -1
  424. package/build-types/modal/index.d.ts.map +1 -1
  425. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  426. package/build-types/modal/use-modal-exit-animation.d.ts +0 -3
  427. package/build-types/modal/use-modal-exit-animation.d.ts.map +1 -1
  428. package/build-types/navigable-container/container.d.ts +2 -2
  429. package/build-types/navigable-container/container.d.ts.map +1 -1
  430. package/build-types/navigable-container/menu.d.ts +1 -1
  431. package/build-types/navigable-container/menu.d.ts.map +1 -1
  432. package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
  433. package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
  434. package/build-types/navigable-container/tabbable.d.ts +2 -2
  435. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  436. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  437. package/build-types/navigation/group/index.d.ts +1 -1
  438. package/build-types/navigation/group/index.d.ts.map +1 -1
  439. package/build-types/navigation/index.d.ts +1 -1
  440. package/build-types/navigation/index.d.ts.map +1 -1
  441. package/build-types/navigation/item/index.d.ts.map +1 -1
  442. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -1
  443. package/build-types/navigation/menu/index.d.ts.map +1 -1
  444. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -1
  445. package/build-types/navigation/menu/menu-title.d.ts +1 -1
  446. package/build-types/navigation/menu/menu-title.d.ts.map +1 -1
  447. package/build-types/navigation/menu/search-no-results-found.d.ts +1 -1
  448. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -1
  449. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -1
  450. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  451. package/build-types/navigation/styles/navigation-styles.d.ts +6 -6
  452. package/build-types/navigation/utils.d.ts.map +1 -1
  453. package/build-types/navigator/index.d.ts +12 -12
  454. package/build-types/navigator/legacy.d.ts +18 -18
  455. package/build-types/navigator/navigator-back-button/component.d.ts +6 -6
  456. package/build-types/navigator/navigator-back-button/hook.d.ts +136 -136
  457. package/build-types/navigator/navigator-button/component.d.ts +6 -6
  458. package/build-types/navigator/navigator-button/hook.d.ts +136 -136
  459. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +1 -1
  460. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -1
  461. package/build-types/navigator/navigator-to-parent-button/component.d.ts +6 -6
  462. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  463. package/build-types/navigator/styles.d.ts.map +1 -1
  464. package/build-types/notice/index.d.ts +1 -1
  465. package/build-types/notice/index.d.ts.map +1 -1
  466. package/build-types/notice/list.d.ts +1 -1
  467. package/build-types/notice/list.d.ts.map +1 -1
  468. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  469. package/build-types/number-control/index.d.ts +7 -7
  470. package/build-types/number-control/index.d.ts.map +1 -1
  471. package/build-types/number-control/stories/index.story.d.ts +7 -7
  472. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  473. package/build-types/palette-edit/index.d.ts +1 -1
  474. package/build-types/palette-edit/index.d.ts.map +1 -1
  475. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  476. package/build-types/palette-edit/styles.d.ts +759 -759
  477. package/build-types/panel/body.d.ts.map +1 -1
  478. package/build-types/panel/header.d.ts.map +1 -1
  479. package/build-types/panel/index.d.ts.map +1 -1
  480. package/build-types/panel/row.d.ts.map +1 -1
  481. package/build-types/panel/stories/index.story.d.ts.map +1 -1
  482. package/build-types/placeholder/index.d.ts.map +1 -1
  483. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  484. package/build-types/popover/index.d.ts +1 -1
  485. package/build-types/popover/index.d.ts.map +1 -1
  486. package/build-types/popover/overlay-middlewares.d.ts +2 -2
  487. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  488. package/build-types/popover/stories/e2e/index.story.d.ts.map +1 -1
  489. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  490. package/build-types/popover/test/utils/index.d.ts.map +1 -1
  491. package/build-types/popover/utils.d.ts +3 -3
  492. package/build-types/popover/utils.d.ts.map +1 -1
  493. package/build-types/progress-bar/index.d.ts +1 -1
  494. package/build-types/progress-bar/index.d.ts.map +1 -1
  495. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  496. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  497. package/build-types/query-controls/author-select.d.ts +1 -1
  498. package/build-types/query-controls/author-select.d.ts.map +1 -1
  499. package/build-types/query-controls/index.d.ts.map +1 -1
  500. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  501. package/build-types/radio-control/index.d.ts.map +1 -1
  502. package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
  503. package/build-types/radio-group/index.d.ts.map +1 -1
  504. package/build-types/radio-group/radio.d.ts +1 -1
  505. package/build-types/radio-group/radio.d.ts.map +1 -1
  506. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  507. package/build-types/range-control/index.d.ts +8 -8
  508. package/build-types/range-control/index.d.ts.map +1 -1
  509. package/build-types/range-control/input-range.d.ts +1 -1
  510. package/build-types/range-control/input-range.d.ts.map +1 -1
  511. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  512. package/build-types/range-control/styles/range-control-styles.d.ts +9 -9
  513. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  514. package/build-types/range-control/utils.d.ts +1 -1
  515. package/build-types/range-control/utils.d.ts.map +1 -1
  516. package/build-types/resizable-box/index.d.ts.map +1 -1
  517. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  518. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  519. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -1
  520. package/build-types/resizable-box/resize-tooltip/utils.d.ts +3 -3
  521. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  522. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  523. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  524. package/build-types/responsive-wrapper/index.d.ts +1 -1
  525. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  526. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  527. package/build-types/sandbox/index.d.ts.map +1 -1
  528. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  529. package/build-types/scroll-lock/index.d.ts.map +1 -1
  530. package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
  531. package/build-types/scrollable/component.d.ts.map +1 -1
  532. package/build-types/scrollable/hook.d.ts +106 -106
  533. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  534. package/build-types/search-control/index.d.ts +9 -9
  535. package/build-types/search-control/index.d.ts.map +1 -1
  536. package/build-types/search-control/stories/index.story.d.ts +9 -9
  537. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  538. package/build-types/select-control/chevron-down.d.ts.map +1 -1
  539. package/build-types/select-control/index.d.ts +1 -1
  540. package/build-types/select-control/index.d.ts.map +1 -1
  541. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  542. package/build-types/select-control/styles/select-control-styles.d.ts +2 -2
  543. package/build-types/shortcut/index.d.ts.map +1 -1
  544. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  545. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  546. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  547. package/build-types/slot-fill/context.d.ts.map +1 -1
  548. package/build-types/slot-fill/index.d.ts +2 -2
  549. package/build-types/slot-fill/index.d.ts.map +1 -1
  550. package/build-types/slot-fill/provider.d.ts.map +1 -1
  551. package/build-types/slot-fill/slot.d.ts.map +1 -1
  552. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  553. package/build-types/snackbar/index.d.ts +3 -3
  554. package/build-types/snackbar/index.d.ts.map +1 -1
  555. package/build-types/snackbar/list.d.ts +1 -1
  556. package/build-types/snackbar/list.d.ts.map +1 -1
  557. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  558. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  559. package/build-types/spacer/component.d.ts.map +1 -1
  560. package/build-types/spacer/hook.d.ts +106 -106
  561. package/build-types/spacer/stories/index.story.d.ts.map +1 -1
  562. package/build-types/spinner/index.d.ts.map +1 -1
  563. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  564. package/build-types/style-provider/index.d.ts +0 -3
  565. package/build-types/style-provider/index.d.ts.map +1 -1
  566. package/build-types/style-provider/test/index.d.ts.map +1 -0
  567. package/build-types/surface/component.d.ts.map +1 -1
  568. package/build-types/surface/hook.d.ts +106 -106
  569. package/build-types/surface/stories/index.story.d.ts.map +1 -1
  570. package/build-types/surface/styles.d.ts +1 -1
  571. package/build-types/surface/styles.d.ts.map +1 -1
  572. package/build-types/tab-panel/index.d.ts.map +1 -1
  573. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  574. package/build-types/tabs/index.d.ts +1 -1
  575. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  576. package/build-types/tabs/styles.d.ts +3 -3
  577. package/build-types/tabs/tablist.d.ts +1 -1
  578. package/build-types/text/component.d.ts.map +1 -1
  579. package/build-types/text/hook.d.ts +106 -106
  580. package/build-types/text/stories/index.story.d.ts +3 -3
  581. package/build-types/text/stories/index.story.d.ts.map +1 -1
  582. package/build-types/text/utils.d.ts +1 -1
  583. package/build-types/text/utils.d.ts.map +1 -1
  584. package/build-types/text-control/index.d.ts +3 -3
  585. package/build-types/text-control/index.d.ts.map +1 -1
  586. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  587. package/build-types/text-highlight/index.d.ts +4 -19
  588. package/build-types/text-highlight/index.d.ts.map +1 -1
  589. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  590. package/build-types/textarea-control/index.d.ts +3 -3
  591. package/build-types/textarea-control/index.d.ts.map +1 -1
  592. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  593. package/build-types/theme/color-algorithms.d.ts +1 -1
  594. package/build-types/theme/color-algorithms.d.ts.map +1 -1
  595. package/build-types/theme/index.d.ts.map +1 -1
  596. package/build-types/theme/stories/index.story.d.ts +1 -1
  597. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  598. package/build-types/theme/styles.d.ts.map +1 -1
  599. package/build-types/tip/index.d.ts.map +1 -1
  600. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  601. package/build-types/toggle-control/index.d.ts +2 -2
  602. package/build-types/toggle-control/index.d.ts.map +1 -1
  603. package/build-types/toggle-control/stories/index.story.d.ts +4 -4
  604. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  605. package/build-types/toggle-group-control/context.d.ts.map +1 -1
  606. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  607. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
  608. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
  609. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
  610. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  611. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +3 -3
  612. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  613. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -2
  614. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  615. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
  616. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  617. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -1
  618. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  619. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  620. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  621. package/build-types/toolbar/index.d.ts +6 -6
  622. package/build-types/toolbar/index.d.ts.map +1 -1
  623. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  624. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  625. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
  626. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  627. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  628. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  629. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -1
  630. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
  631. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
  632. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +1 -1
  633. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
  634. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  635. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  636. package/build-types/tools-panel/styles.d.ts.map +1 -1
  637. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  638. package/build-types/tools-panel/tools-panel/hook.d.ts +128 -128
  639. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  640. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  641. package/build-types/tools-panel/tools-panel-header/hook.d.ts +116 -116
  642. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  643. package/build-types/tools-panel/tools-panel-item/hook.d.ts +108 -108
  644. package/build-types/tooltip/index.d.ts.map +1 -1
  645. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  646. package/build-types/tree-grid/cell.d.ts.map +1 -1
  647. package/build-types/tree-grid/index.d.ts.map +1 -1
  648. package/build-types/tree-grid/item.d.ts.map +1 -1
  649. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
  650. package/build-types/tree-grid/roving-tab-index.d.ts +1 -1
  651. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -1
  652. package/build-types/tree-grid/row.d.ts.map +1 -1
  653. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  654. package/build-types/tree-select/index.d.ts.map +1 -1
  655. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  656. package/build-types/truncate/component.d.ts.map +1 -1
  657. package/build-types/truncate/hook.d.ts +106 -106
  658. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  659. package/build-types/truncate/utils.d.ts +5 -5
  660. package/build-types/truncate/utils.d.ts.map +1 -1
  661. package/build-types/unit-control/index.d.ts +2 -2
  662. package/build-types/unit-control/index.d.ts.map +1 -1
  663. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  664. package/build-types/unit-control/styles/unit-control-styles.d.ts +7 -7
  665. package/build-types/unit-control/unit-select-control.d.ts +1 -1
  666. package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
  667. package/build-types/unit-control/utils.d.ts.map +1 -1
  668. package/build-types/utils/breakpoint-values.d.ts.map +1 -1
  669. package/build-types/utils/breakpoint.d.ts +9 -1
  670. package/build-types/utils/breakpoint.d.ts.map +1 -1
  671. package/build-types/utils/colors-values.d.ts +1 -1
  672. package/build-types/utils/colors-values.d.ts.map +1 -1
  673. package/build-types/utils/colors.d.ts +3 -3
  674. package/build-types/utils/colors.d.ts.map +1 -1
  675. package/build-types/utils/deprecated-36px-size.d.ts +1 -1
  676. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
  677. package/build-types/utils/dropdown-motion.d.ts +3 -3
  678. package/build-types/utils/dropdown-motion.d.ts.map +1 -1
  679. package/build-types/utils/font-values.d.ts.map +1 -1
  680. package/build-types/utils/font.d.ts +6 -2
  681. package/build-types/utils/font.d.ts.map +1 -1
  682. package/build-types/utils/get-node-text.d.ts.map +1 -1
  683. package/build-types/utils/hooks/index.d.ts +4 -4
  684. package/build-types/utils/hooks/index.d.ts.map +1 -1
  685. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +1 -1
  686. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
  687. package/build-types/utils/hooks/use-controlled-state.d.ts +2 -8
  688. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  689. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  690. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  691. package/build-types/utils/hooks/use-update-effect.d.ts +1 -1
  692. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  693. package/build-types/utils/index.d.ts +2 -2
  694. package/build-types/utils/index.d.ts.map +1 -1
  695. package/build-types/utils/math.d.ts +5 -5
  696. package/build-types/utils/math.d.ts.map +1 -1
  697. package/build-types/utils/rtl.d.ts +11 -16
  698. package/build-types/utils/rtl.d.ts.map +1 -1
  699. package/build-types/utils/strings.d.ts.map +1 -1
  700. package/build-types/utils/style-mixins.d.ts +9 -9
  701. package/build-types/utils/style-mixins.d.ts.map +1 -1
  702. package/build-types/utils/use-responsive-value.d.ts.map +1 -1
  703. package/build-types/utils/values.d.ts +19 -5
  704. package/build-types/utils/values.d.ts.map +1 -1
  705. package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -1
  706. package/build-types/v-stack/component.d.ts +3 -3
  707. package/build-types/v-stack/component.d.ts.map +1 -1
  708. package/build-types/v-stack/hook.d.ts +107 -107
  709. package/build-types/v-stack/stories/e2e/index.story.d.ts.map +1 -1
  710. package/build-types/v-stack/stories/index.story.d.ts +4 -4
  711. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  712. package/build-types/validated-form-controls/components/checkbox-control.d.ts +2 -2
  713. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  714. package/build-types/validated-form-controls/components/number-control.d.ts +7 -7
  715. package/build-types/validated-form-controls/components/radio-control.d.ts +2 -2
  716. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
  717. package/build-types/validated-form-controls/components/range-control.d.ts +8 -8
  718. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  719. package/build-types/validated-form-controls/components/select-control.d.ts +1 -1
  720. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
  721. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
  722. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
  723. package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -1
  724. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
  725. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
  726. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  727. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
  728. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
  729. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
  730. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
  731. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
  732. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
  733. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
  734. package/build-types/validated-form-controls/components/text-control.d.ts +3 -3
  735. package/build-types/validated-form-controls/components/textarea-control.d.ts +3 -3
  736. package/build-types/validated-form-controls/components/toggle-control.d.ts +2 -2
  737. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +3 -3
  738. package/build-types/validated-form-controls/control-with-error.d.ts +1 -1
  739. package/build-types/validated-form-controls/validity-indicator.d.ts +1 -1
  740. package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
  741. package/build-types/view/component.d.ts +251 -251
  742. package/build-types/view/component.d.ts.map +1 -1
  743. package/build-types/view/stories/index.story.d.ts.map +1 -1
  744. package/build-types/visually-hidden/component.d.ts.map +1 -1
  745. package/build-types/visually-hidden/stories/index.story.d.ts +0 -6
  746. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
  747. package/build-types/z-stack/component.d.ts.map +1 -1
  748. package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
  749. package/package.json +24 -23
  750. package/src/alignment-matrix-control/stories/index.story.tsx +1 -1
  751. package/src/angle-picker-control/stories/index.story.tsx +1 -1
  752. package/src/autocomplete/autocompleter-ui.tsx +0 -1
  753. package/src/base-control/stories/index.story.tsx +1 -1
  754. package/src/border-box-control/stories/index.story.tsx +1 -1
  755. package/src/border-control/stories/index.story.tsx +1 -1
  756. package/src/button/stories/index.story.tsx +1 -1
  757. package/src/button/style.scss +2 -0
  758. package/src/button-group/style.scss +1 -2
  759. package/src/card/stories/index.story.tsx +2 -9
  760. package/src/checkbox-control/stories/index.story.tsx +1 -1
  761. package/src/circular-option-picker/style.scss +8 -6
  762. package/src/color-indicator/stories/index.story.tsx +1 -1
  763. package/src/color-palette/index.tsx +25 -9
  764. package/src/color-palette/stories/index.story.tsx +21 -3
  765. package/src/color-palette/test/index.tsx +152 -1
  766. package/src/color-palette/test/utils.ts +18 -0
  767. package/src/color-palette/types.ts +19 -2
  768. package/src/color-palette/utils.ts +14 -2
  769. package/src/color-picker/hex-input.tsx +1 -1
  770. package/src/color-picker/stories/index.story.tsx +1 -1
  771. package/src/color-picker/test/index.tsx +24 -2
  772. package/src/combobox-control/stories/index.story.tsx +1 -1
  773. package/src/composite/legacy/test/index.tsx +13 -13
  774. package/src/composite/stories/index.story.tsx +1 -1
  775. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  776. package/src/custom-gradient-picker/index.tsx +0 -1
  777. package/src/custom-select-control/stories/index.story.tsx +1 -1
  778. package/src/disabled/stories/index.story.tsx +1 -1
  779. package/src/drop-zone/stories/index.story.tsx +1 -1
  780. package/src/dropdown/stories/index.story.tsx +1 -1
  781. package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
  782. package/src/duotone-picker/stories/duotone-swatch.story.tsx +1 -1
  783. package/src/external-link/stories/index.story.tsx +2 -2
  784. package/src/external-link/style.scss +34 -2
  785. package/src/focal-point-picker/README.md +12 -8
  786. package/src/focal-point-picker/index.tsx +16 -11
  787. package/src/focal-point-picker/stories/index.story.tsx +1 -1
  788. package/src/font-size-picker/stories/index.story.tsx +1 -1
  789. package/src/form-file-upload/stories/index.story.tsx +1 -1
  790. package/src/form-toggle/stories/index.story.tsx +1 -1
  791. package/src/form-toggle/style.scss +3 -2
  792. package/src/form-token-field/README.md +2 -1
  793. package/src/form-token-field/index.tsx +39 -9
  794. package/src/form-token-field/stories/index.story.tsx +2 -1
  795. package/src/form-token-field/test/index.tsx +70 -10
  796. package/src/form-token-field/token-input.tsx +1 -6
  797. package/src/form-token-field/types.ts +16 -2
  798. package/src/gradient-picker/stories/index.story.tsx +1 -1
  799. package/src/guide/stories/index.story.tsx +1 -1
  800. package/src/higher-order/with-notices/test/index.tsx +12 -10
  801. package/src/icon/stories/index.story.tsx +1 -1
  802. package/src/input-control/stories/index.story.tsx +1 -1
  803. package/src/item-group/stories/index.story.tsx +1 -1
  804. package/src/keyboard-shortcuts/stories/index.story.tsx +1 -1
  805. package/src/menu/popover.tsx +15 -8
  806. package/src/menu/stories/index.story.tsx +1 -1
  807. package/src/menu/styles.ts +25 -15
  808. package/src/menu/test/index.tsx +28 -37
  809. package/src/menu-group/stories/index.story.tsx +1 -1
  810. package/src/menu-item/stories/index.story.tsx +1 -1
  811. package/src/menu-items-choice/stories/index.story.tsx +1 -1
  812. package/src/modal/index.tsx +2 -7
  813. package/src/modal/stories/index.story.tsx +1 -1
  814. package/src/modal/style.scss +68 -24
  815. package/src/modal/use-modal-exit-animation.ts +10 -7
  816. package/src/navigator/stories/index.story.tsx +1 -1
  817. package/src/notice/stories/index.story.tsx +1 -1
  818. package/src/notice/test/__snapshots__/index.tsx.snap +1 -0
  819. package/src/number-control/stories/index.story.tsx +1 -1
  820. package/src/palette-edit/index.tsx +0 -1
  821. package/src/palette-edit/stories/index.story.tsx +1 -1
  822. package/src/panel/stories/index.story.tsx +1 -1
  823. package/src/placeholder/stories/index.story.tsx +1 -1
  824. package/src/popover/stories/index.story.tsx +1 -1
  825. package/src/popover/style.scss +0 -4
  826. package/src/progress-bar/stories/index.story.tsx +1 -1
  827. package/src/query-controls/stories/index.story.tsx +1 -1
  828. package/src/radio-control/stories/index.story.tsx +1 -1
  829. package/src/range-control/stories/index.story.tsx +1 -1
  830. package/src/resizable-box/stories/index.story.tsx +1 -1
  831. package/src/resizable-box/style.scss +4 -5
  832. package/src/sandbox/stories/index.story.tsx +1 -1
  833. package/src/scroll-lock/stories/index.story.tsx +1 -1
  834. package/src/search-control/stories/index.story.tsx +1 -1
  835. package/src/select-control/stories/index.story.tsx +1 -1
  836. package/src/shortcut/stories/index.story.tsx +1 -1
  837. package/src/slot-fill/fill.tsx +2 -2
  838. package/src/slot-fill/stories/index.story.tsx +1 -1
  839. package/src/snackbar/stories/index.story.tsx +1 -1
  840. package/src/spinner/stories/index.story.tsx +1 -1
  841. package/src/style-provider/index.tsx +10 -7
  842. package/src/style-provider/test/index.tsx +38 -0
  843. package/src/tab-panel/style.scss +2 -2
  844. package/src/tabs/stories/index.story.tsx +1 -1
  845. package/src/text/styles.ts +1 -1
  846. package/src/text/test/index.tsx +1 -1
  847. package/src/text-control/stories/index.story.tsx +1 -1
  848. package/src/text-highlight/stories/index.story.tsx +1 -1
  849. package/src/textarea-control/stories/index.story.tsx +1 -1
  850. package/src/toggle-control/stories/index.story.tsx +1 -1
  851. package/src/toggle-group-control/stories/index.story.tsx +1 -1
  852. package/src/toolbar/stories/index.story.tsx +1 -1
  853. package/src/toolbar/toolbar-group/index.tsx +2 -2
  854. package/src/tools-panel/stories/index.story.tsx +1 -1
  855. package/src/tooltip/stories/index.story.tsx +1 -1
  856. package/src/tooltip/test/index.tsx +3 -2
  857. package/src/tree-grid/stories/index.story.tsx +1 -1
  858. package/src/tree-select/stories/index.story.tsx +1 -1
  859. package/src/truncate/stories/index.story.tsx +1 -1
  860. package/src/unit-control/stories/index.story.tsx +1 -1
  861. package/src/utils/breakpoint.js +1 -1
  862. package/src/utils/config-values.js +3 -0
  863. package/src/utils/dropdown-motion.ts +6 -2
  864. package/src/utils/font.js +1 -1
  865. package/src/visually-hidden/component.tsx +1 -0
  866. package/src/visually-hidden/stories/index.story.tsx +2 -9
  867. package/build-types/visually-hidden/test/index.d.ts.map +0 -1
  868. package/src/visually-hidden/test/__snapshots__/index.tsx.snap +0 -12
  869. package/src/visually-hidden/test/index.tsx +0 -17
  870. /package/build-types/{visually-hidden → style-provider}/test/index.d.ts +0 -0
@@ -146,7 +146,6 @@ function UnforwardedModal(props, forwardedRef) {
146
146
  const {
147
147
  closeModal,
148
148
  frameRef,
149
- frameStyle,
150
149
  overlayClassname
151
150
  } = (0, import_use_modal_exit_animation.useModalExitAnimation)();
152
151
  (0, import_element.useLayoutEffect)(() => {
@@ -210,10 +209,7 @@ function UnforwardedModal(props, forwardedRef) {
210
209
  document,
211
210
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
212
211
  className: (0, import_clsx.default)("components-modal__frame", sizeClass, className),
213
- style: {
214
- ...frameStyle,
215
- ...style
216
- },
212
+ style,
217
213
  ref: (0, import_compose.useMergeRefs)([frameRef, constrainedTabbingRef, focusReturnRef, focusOnMount !== "firstContentElement" ? focusOnMountRef : null]),
218
214
  role,
219
215
  "aria-label": contentLabel,
@@ -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 // eslint-disable-next-line react-compiler/react-compiler -- false positive, see https://github.com/facebook/react/issues/29196\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 frameStyle,\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: {\n ...frameStyle,\n ...style\n },\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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AAK,QAAQ;AAAA,kBAC3C,WAAW;AAAA,kBACX,eAAe;AAAA,kBACf,UAAU;AAAA,gBACZ,CAAC,GAAG,SAAsB,uCAAAA,KAAK,MAAM;AAAA,kBACnC,IAAI;AAAA,kBACJ,WAAW;AAAA,kBACX,UAAU;AAAA,gBACZ,CAAC,CAAC;AAAA,cACJ,CAAC,GAAG,eAAe,iBAA8B,uCAAAG,MAAM,mBAAAC,UAAW;AAAA,gBAChE,UAAU,CAAc,uCAAAJ,KAAK,sBAAQ;AAAA,kBACnC,cAAc;AAAA,kBACd,YAAY;AAAA,gBACd,CAAC,GAAgB,uCAAAA,KAAK,cAAAK,SAAQ;AAAA,kBAC5B,MAAM;AAAA,kBACN,SAAS,WAAS,WAAW,EAAE,KAAK,MAAM,eAAe,KAAK,CAAC;AAAA,kBAC/D,MAAM;AAAA,kBACN,OAAO,wBAAoB,gBAAG,OAAO;AAAA,gBACvC,CAAC,CAAC;AAAA,cACJ,CAAC,CAAC;AAAA,YACJ,CAAC,GAAgB,uCAAAL,KAAK,OAAO;AAAA,cAC3B,SAAK,6BAAa,CAAC,sBAAsB,iBAAiB,wBAAwB,kBAAkB,IAAI,CAAC;AAAA,cACzG,WAAW;AAAA,cACX;AAAA,YACF,CAAC,CAAC;AAAA,UACJ,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA;AACD,aAAO,6BAA0B,uCAAAA,KAAK,4BAAa,UAAU;AAAA,IAC3D,OAAO;AAAA,IACP,UAAU;AAAA,EACZ,CAAC,GAAG,SAAS,IAAI;AACnB;AAiCO,IAAM,YAAQ,2BAAW,gBAAgB;AAChD,MAAM,cAAc;AACpB,IAAO,gBAAQ;",
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;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,qBAAgH;AAChH,qBAAoG;AACpG,kBAAmB;AACnB,mBAAsB;AACtB,iBAAmC;AACnC,iBAA4B;AAC5B,oBAAmB;AACnB,4BAA0B;AAC1B,oCAAoC;AACpC,oBAAuB;AACvB,sCAAsC;AACtC,qBAA6B;AAG7B,yBAAkE;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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,YACF,CAAC,CAAC;AAAA,UACJ,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA;AACD,aAAO,6BAA0B,uCAAAA,KAAK,4BAAa,UAAU;AAAA,IAC3D,OAAO;AAAA,IACP,UAAU;AAAA,EACZ,CAAC,GAAG,SAAS,IAAI;AACnB;AAiCO,IAAM,YAAQ,2BAAW,gBAAgB;AAChD,MAAM,cAAc;AACpB,IAAO,gBAAQ;",
6
6
  "names": ["_jsx", "clsx", "StyleProvider", "_jsxs", "_Fragment", "Button"]
7
7
  }
@@ -37,57 +37,68 @@ var import_compose = require("@wordpress/compose");
37
37
  var import_element = require("@wordpress/element");
38
38
  var import_warning = __toESM(require("@wordpress/warning"));
39
39
  var import_utils = require("../utils/index.cjs");
40
- var FRAME_ANIMATION_DURATION = import_utils.CONFIG.transitionDuration;
41
- var FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(import_utils.CONFIG.transitionDuration);
40
+ var FRAME_ANIMATION_DURATION_MS = Number.parseInt(
41
+ import_utils.CONFIG.transitionDuration
42
+ );
42
43
  var EXIT_ANIMATION_NAME = "components-modal__disappear-animation";
43
44
  function useModalExitAnimation() {
44
45
  const frameRef = (0, import_element.useRef)(null);
45
46
  const [isAnimatingOut, setIsAnimatingOut] = (0, import_element.useState)(false);
46
47
  const isReducedMotion = (0, import_compose.useReducedMotion)();
47
- const closeModal = (0, import_element.useCallback)(() => new Promise((closeModalResolve) => {
48
- const frameEl = frameRef.current;
49
- if (isReducedMotion) {
50
- closeModalResolve();
51
- return;
52
- }
53
- if (!frameEl) {
54
- globalThis.SCRIPT_DEBUG === true ? (0, import_warning.default)("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;
55
- closeModalResolve();
56
- return;
57
- }
58
- let handleAnimationEnd;
59
- const startAnimation = () => new Promise((animationResolve) => {
60
- handleAnimationEnd = (e) => {
61
- if (e.animationName === EXIT_ANIMATION_NAME) {
62
- animationResolve();
48
+ const closeModal = (0, import_element.useCallback)(
49
+ () => new Promise((closeModalResolve) => {
50
+ const frameEl = frameRef.current;
51
+ if (isReducedMotion) {
52
+ closeModalResolve();
53
+ return;
54
+ }
55
+ if (!frameEl) {
56
+ (0, import_warning.default)(
57
+ "wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element."
58
+ );
59
+ closeModalResolve();
60
+ return;
61
+ }
62
+ let handleAnimationEnd;
63
+ const startAnimation = () => new Promise((animationResolve) => {
64
+ handleAnimationEnd = (e) => {
65
+ if (e.animationName === EXIT_ANIMATION_NAME) {
66
+ animationResolve();
67
+ }
68
+ };
69
+ frameEl.addEventListener(
70
+ "animationend",
71
+ handleAnimationEnd
72
+ );
73
+ setIsAnimatingOut(true);
74
+ });
75
+ const animationTimeout = () => new Promise((timeoutResolve) => {
76
+ setTimeout(
77
+ () => timeoutResolve(),
78
+ // Allow an extra 20% of the animation duration for the
79
+ // animationend event to fire, in case the animation frame is
80
+ // slightly delayes by some other events in the event loop.
81
+ FRAME_ANIMATION_DURATION_MS * 1.2
82
+ );
83
+ });
84
+ Promise.race([startAnimation(), animationTimeout()]).then(
85
+ () => {
86
+ if (handleAnimationEnd) {
87
+ frameEl.removeEventListener(
88
+ "animationend",
89
+ handleAnimationEnd
90
+ );
91
+ }
92
+ setIsAnimatingOut(false);
93
+ closeModalResolve();
63
94
  }
64
- };
65
- frameEl.addEventListener("animationend", handleAnimationEnd);
66
- setIsAnimatingOut(true);
67
- });
68
- const animationTimeout = () => new Promise((timeoutResolve) => {
69
- setTimeout(
70
- () => timeoutResolve(),
71
- // Allow an extra 20% of the animation duration for the
72
- // animationend event to fire, in case the animation frame is
73
- // slightly delayes by some other events in the event loop.
74
- FRAME_ANIMATION_DURATION_NUMBER * 1.2
75
95
  );
76
- });
77
- Promise.race([startAnimation(), animationTimeout()]).then(() => {
78
- if (handleAnimationEnd) {
79
- frameEl.removeEventListener("animationend", handleAnimationEnd);
80
- }
81
- setIsAnimatingOut(false);
82
- closeModalResolve();
83
- });
84
- }), [isReducedMotion]);
96
+ }),
97
+ [isReducedMotion]
98
+ );
85
99
  return {
86
100
  overlayClassname: isAnimatingOut ? "is-animating-out" : void 0,
87
101
  frameRef,
88
- frameStyle: {
89
- "--modal-frame-animation-duration": `${FRAME_ANIMATION_DURATION}`
90
- },
91
102
  closeModal
92
103
  };
93
104
  }
@@ -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// Animation duration (ms) extracted to JS in order to be used on a setTimeout.\nconst FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;\nconst FRAME_ANIMATION_DURATION_NUMBER = 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_NUMBER * 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 frameStyle: {\n '--modal-frame-animation-duration': `${FRAME_ANIMATION_DURATION}`\n },\n closeModal\n };\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAiC;AACjC,qBAA8C;AAC9C,qBAAoB;AAKpB,mBAAuB;AAGvB,IAAM,2BAA2B,oBAAO;AACxC,IAAM,kCAAkC,OAAO,SAAS,oBAAO,kBAAkB;AACjF,IAAM,sBAAsB;AACrB,SAAS,wBAAwB;AACtC,QAAM,eAAW,uBAAO,IAAI;AAC5B,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,yBAAS,KAAK;AAC1D,QAAM,sBAAkB,iCAAiB;AACzC,QAAM,iBAAa,4BAAY,MAAM,IAAI,QAAQ,uBAAqB;AAGpE,UAAM,UAAU,SAAS;AACzB,QAAI,iBAAiB;AACnB,wBAAkB;AAClB;AAAA,IACF;AACA,QAAI,CAAC,SAAS;AACZ,iBAAW,iBAAiB,WAAO,eAAAA,SAAQ,4IAA4I,IAAI;AAC3L,wBAAkB;AAClB;AAAA,IACF;AACA,QAAI;AACJ,UAAM,iBAAiB,MAAM,IAAI,QAAQ,sBAAoB;AAC3D,2BAAqB,OAAK;AACxB,YAAI,EAAE,kBAAkB,qBAAqB;AAC3C,2BAAiB;AAAA,QACnB;AAAA,MACF;AACA,cAAQ,iBAAiB,gBAAgB,kBAAkB;AAC3D,wBAAkB,IAAI;AAAA,IACxB,CAAC;AACD,UAAM,mBAAmB,MAAM,IAAI,QAAQ,oBAAkB;AAC3D;AAAA,QAAW,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA,QAIhC,kCAAkC;AAAA,MAAG;AAAA,IACvC,CAAC;AACD,YAAQ,KAAK,CAAC,eAAe,GAAG,iBAAiB,CAAC,CAAC,EAAE,KAAK,MAAM;AAC9D,UAAI,oBAAoB;AACtB,gBAAQ,oBAAoB,gBAAgB,kBAAkB;AAAA,MAChE;AACA,wBAAkB,KAAK;AACvB,wBAAkB;AAAA,IACpB,CAAC;AAAA,EACH,CAAC,GAAG,CAAC,eAAe,CAAC;AACrB,SAAO;AAAA,IACL,kBAAkB,iBAAiB,qBAAqB;AAAA,IACxD;AAAA,IACA,YAAY;AAAA,MACV,oCAAoC,GAAG,wBAAwB;AAAA,IACjE;AAAA,IACA;AAAA,EACF;AACF;",
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAiC;AACjC,qBAA8C;AAC9C,qBAAoB;AAKpB,mBAAuB;AAUvB,IAAM,8BAA8B,OAAO;AAAA,EAC1C,oBAAO;AACR;AAEA,IAAM,sBAAsB;AAErB,SAAS,wBAAwB;AACvC,QAAM,eAAW,uBAA0B,IAAK;AAChD,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,KAAM;AAC9D,QAAM,sBAAkB,iCAAiB;AAEzC,QAAM,iBAAa;AAAA,IAClB,MACC,IAAI,QAAiB,CAAE,sBAAuB;AAG7C,YAAM,UAAU,SAAS;AAEzB,UAAK,iBAAkB;AACtB,0BAAkB;AAClB;AAAA,MACD;AAEA,UAAK,CAAE,SAAU;AAChB,2BAAAA;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;",
6
6
  "names": ["warning"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/palette-edit/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useCallback, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexBlock, FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { Item, ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport { PaletteActionsContainer, PaletteEditStyles, PaletteHeading, IndicatorStyled, NameContainer, NameInputControl, DoneButton, RemoveButton, PaletteEditContents } from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst DEFAULT_COLOR = '#000';\nfunction NameInput({\n value,\n onChange,\n label\n}) {\n return /*#__PURE__*/_jsx(NameInputControl, {\n size: \"compact\",\n label: label,\n hideLabelFromVision: true,\n value: value,\n onChange: onChange\n });\n}\n\n/*\n * Deduplicates the slugs of the provided elements.\n */\nexport function deduplicateElementSlugs(elements) {\n const slugCounts = {};\n return elements.map(element => {\n let newSlug;\n const {\n slug\n } = element;\n slugCounts[slug] = (slugCounts[slug] || 0) + 1;\n if (slugCounts[slug] > 1) {\n newSlug = `${slug}-${slugCounts[slug] - 1}`;\n }\n return {\n ...element,\n slug: newSlug ?? slug\n };\n });\n}\n\n/**\n * Returns a name and slug for a palette item. The name takes the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A name and slug for the new palette item.\n */\nexport function getNameAndSlugForPosition(elements, slugPrefix) {\n const nameRegex = new RegExp(`^${slugPrefix}color-([\\\\d]+)$`);\n const position = elements.reduce((previousValue, currentValue) => {\n if (typeof currentValue?.slug === 'string') {\n const matches = currentValue?.slug.match(nameRegex);\n if (matches) {\n const id = parseInt(matches[1], 10);\n if (id >= previousValue) {\n return id + 1;\n }\n }\n }\n return previousValue;\n }, 1);\n return {\n name: sprintf(/* translators: %d: is an id for a custom color */\n __('Color %d'), position),\n slug: `${slugPrefix}color-${position}`\n };\n}\nfunction ColorPickerPopover({\n isGradient,\n element,\n onChange,\n popoverProps: receivedPopoverProps,\n onClose = () => {}\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\n offset: 20,\n // Disabling resize as it would otherwise cause the popover to show\n // scrollbars while dragging the color picker's handle close to the\n // popover edge.\n resize: false,\n placement: 'left-start',\n ...receivedPopoverProps,\n className: clsx('components-palette-edit__popover', receivedPopoverProps?.className)\n }), [receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Popover, {\n ...popoverProps,\n onClose: onClose,\n children: [!isGradient && /*#__PURE__*/_jsx(ColorPicker, {\n color: element.color,\n enableAlpha: true,\n onChange: newColor => {\n onChange({\n ...element,\n color: newColor\n });\n }\n }), isGradient && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-palette-edit__popover-gradient-picker\",\n children: /*#__PURE__*/_jsx(CustomGradientPicker, {\n __experimentalIsRenderedInSidebar: true,\n value: element.gradient,\n onChange: newGradient => {\n onChange({\n ...element,\n gradient: newGradient\n });\n }\n })\n })]\n });\n}\nfunction Option({\n canOnlyChangeValues,\n element,\n onChange,\n onRemove,\n popoverProps: receivedPopoverProps,\n slugPrefix,\n isGradient\n}) {\n const value = isGradient ? element.gradient : element.color;\n const [isEditingColor, setIsEditingColor] = useState(false);\n\n // Use internal state instead of a ref to make sure that the component\n // re-renders when the popover's anchor updates.\n const [popoverAnchor, setPopoverAnchor] = useState(null);\n const popoverProps = useMemo(() => ({\n ...receivedPopoverProps,\n // Use the custom palette color item as the popover anchor.\n anchor: popoverAnchor\n }), [popoverAnchor, receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Item, {\n ref: setPopoverAnchor,\n size: \"small\",\n children: [/*#__PURE__*/_jsxs(HStack, {\n justify: \"flex-start\",\n children: [/*#__PURE__*/_jsx(Button, {\n size: \"small\",\n onClick: () => {\n setIsEditingColor(true);\n },\n \"aria-label\": sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Edit: %s'), element.name.trim().length ? element.name : value || ''),\n style: {\n padding: 0\n },\n children: /*#__PURE__*/_jsx(IndicatorStyled, {\n colorValue: value\n })\n }), /*#__PURE__*/_jsx(FlexBlock, {\n children: !canOnlyChangeValues ? /*#__PURE__*/_jsx(NameInput, {\n label: isGradient ? __('Gradient name') : __('Color name'),\n value: element.name,\n onChange: nextName => onChange({\n ...element,\n name: nextName,\n slug: slugPrefix + kebabCase(nextName ?? '')\n })\n }) : /*#__PURE__*/_jsx(NameContainer, {\n children: element.name.trim().length ? element.name : /* Fall back to non-breaking space to maintain height */\n '\\u00A0'\n })\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(FlexItem, {\n children: /*#__PURE__*/_jsx(RemoveButton, {\n size: \"small\",\n icon: lineSolid,\n label: sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Remove color: %s'), element.name.trim().length ? element.name : value || ''),\n onClick: onRemove\n })\n })]\n }), isEditingColor && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onChange: onChange,\n element: element,\n popoverProps: popoverProps,\n onClose: () => setIsEditingColor(false)\n })]\n });\n}\nfunction PaletteEditListView({\n elements,\n onChange,\n canOnlyChangeValues,\n slugPrefix,\n isGradient,\n popoverProps,\n addColorRef\n}) {\n // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n const elementsReferenceRef = useRef(undefined);\n useEffect(() => {\n // eslint-disable-next-line react-compiler/react-compiler -- false positive, see https://github.com/facebook/react/issues/29196\n elementsReferenceRef.current = elements;\n }, [elements]);\n const debounceOnChange = useDebounce(updatedElements => onChange(deduplicateElementSlugs(updatedElements)), 100);\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n children: /*#__PURE__*/_jsx(ItemGroup, {\n isRounded: true,\n isBordered: true,\n isSeparated: true,\n children: elements.map((element, index) => /*#__PURE__*/_jsx(Option, {\n isGradient: isGradient,\n canOnlyChangeValues: canOnlyChangeValues,\n element: element,\n onChange: newElement => {\n debounceOnChange(elements.map((currentElement, currentIndex) => {\n if (currentIndex === index) {\n return newElement;\n }\n return currentElement;\n }));\n },\n onRemove: () => {\n const newElements = elements.filter((_currentElement, currentIndex) => {\n if (currentIndex === index) {\n return false;\n }\n return true;\n });\n onChange(newElements.length ? newElements : undefined);\n addColorRef.current?.focus();\n },\n slugPrefix: slugPrefix,\n popoverProps: popoverProps\n }, index))\n })\n });\n}\nconst EMPTY_ARRAY = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit({\n gradients,\n colors = EMPTY_ARRAY,\n onChange,\n paletteLabel,\n paletteLabelHeadingLevel = 2,\n emptyMessage,\n canOnlyChangeValues,\n canReset,\n slugPrefix = '',\n popoverProps\n}) {\n const isGradient = !!gradients;\n const elements = isGradient ? gradients : colors;\n const [isEditing, setIsEditing] = useState(false);\n const [editingElement, setEditingElement] = useState(null);\n const isAdding = isEditing && !!editingElement && elements[editingElement] && !elements[editingElement].slug;\n const elementsLength = elements.length;\n const hasElements = elementsLength > 0;\n const debounceOnChange = useDebounce(onChange, 100);\n const onSelectPaletteItem = useCallback((value, newEditingElementIndex) => {\n const selectedElement = newEditingElementIndex === undefined ? undefined : elements[newEditingElementIndex];\n const key = isGradient ? 'gradient' : 'color';\n // Ensures that the index returned matches a known element value.\n if (!!selectedElement && selectedElement[key] === value) {\n setEditingElement(newEditingElementIndex);\n } else {\n setIsEditing(true);\n }\n }, [isGradient, elements]);\n const addColorRef = useRef(null);\n return /*#__PURE__*/_jsxs(PaletteEditStyles, {\n children: [/*#__PURE__*/_jsxs(HStack, {\n children: [/*#__PURE__*/_jsx(PaletteHeading, {\n level: paletteLabelHeadingLevel,\n children: paletteLabel\n }), /*#__PURE__*/_jsxs(PaletteActionsContainer, {\n children: [hasElements && isEditing && /*#__PURE__*/_jsx(DoneButton, {\n size: \"small\",\n onClick: () => {\n setIsEditing(false);\n setEditingElement(null);\n },\n children: __('Done')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n ref: addColorRef,\n size: \"small\",\n isPressed: isAdding,\n icon: plus,\n label: isGradient ? __('Add gradient') : __('Add color'),\n onClick: () => {\n const {\n name,\n slug\n } = getNameAndSlugForPosition(elements, slugPrefix);\n if (!!gradients) {\n onChange([...gradients, {\n gradient: DEFAULT_GRADIENT,\n name,\n slug\n }]);\n } else {\n onChange([...colors, {\n color: DEFAULT_COLOR,\n name,\n slug\n }]);\n }\n setIsEditing(true);\n setEditingElement(elements.length);\n }\n }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && /*#__PURE__*/_jsx(DropdownMenu, {\n icon: moreVertical,\n label: isGradient ? __('Gradient options') : __('Color options'),\n toggleProps: {\n size: 'small'\n },\n children: ({\n onClose\n }) => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(NavigableMenu, {\n role: \"menu\",\n children: [!isEditing && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setIsEditing(true);\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: __('Show details')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n setIsEditing(false);\n onChange();\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: isGradient ? __('Remove all gradients') : __('Remove all colors')\n }), canReset && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n className: \"components-palette-edit__menu-button\",\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n onChange();\n onClose();\n },\n children: isGradient ? __('Reset gradient') : __('Reset colors')\n })]\n })\n })\n })]\n })]\n }), hasElements && /*#__PURE__*/_jsxs(PaletteEditContents, {\n children: [isEditing && /*#__PURE__*/_jsx(PaletteEditListView, {\n canOnlyChangeValues: canOnlyChangeValues,\n elements: elements\n // @ts-expect-error TODO: Don't know how to resolve\n ,\n onChange: onChange,\n slugPrefix: slugPrefix,\n isGradient: isGradient,\n popoverProps: popoverProps,\n addColorRef: addColorRef\n }), !isEditing && editingElement !== null && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onClose: () => setEditingElement(null),\n onChange: newElement => {\n debounceOnChange(\n // @ts-expect-error TODO: Don't know how to resolve\n elements.map((currentElement, currentIndex) => {\n if (currentIndex === editingElement) {\n return newElement;\n }\n return currentElement;\n }));\n },\n element: elements[editingElement ?? -1],\n popoverProps: popoverProps\n }), !isEditing && (isGradient ? /*#__PURE__*/_jsx(GradientPicker, {\n gradients: gradients,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomGradients: true\n }) : /*#__PURE__*/_jsx(ColorPalette, {\n colors: colors,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomColors: true\n }))]\n }), !hasElements && emptyMessage && /*#__PURE__*/_jsx(PaletteEditContents, {\n children: emptyMessage\n })]\n });\n}\nexport default PaletteEdit;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkE;AAClE,kBAA4B;AAC5B,mBAA8C;AAC9C,qBAA4B;AAK5B,oBAAmB;AACnB,0BAA4B;AAC5B,kBAAoC;AACpC,qBAAuB;AACvB,wBAAgC;AAChC,qBAAuB;AACvB,6BAA2B;AAC3B,2BAAyB;AACzB,2BAAyB;AACzB,qBAAoB;AACpB,oBAA4K;AAC5K,iCAA8B;AAC9B,uBAAiC;AACjC,oCAAiC;AACjC,qBAA0B;AAC1B,yBAAkE;AAClE,IAAM,gBAAgB;AACtB,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,SAAoB,uCAAAA,KAAK,gCAAkB;AAAA,IACzC,MAAM;AAAA,IACN;AAAA,IACA,qBAAqB;AAAA,IACrB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SAAc;AAAA,QACnC;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA,QACX,qBAAqB;AAAA,MACvB,CAAC,EAAE;AAAA,IACL,CAAC,GAAG,CAAC,eAAe,gBAA6B,uCAAAT,KAAK,mCAAqB;AAAA,MACzE,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,uBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useCallback, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexBlock, FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { Item, ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport { PaletteActionsContainer, PaletteEditStyles, PaletteHeading, IndicatorStyled, NameContainer, NameInputControl, DoneButton, RemoveButton, PaletteEditContents } from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst DEFAULT_COLOR = '#000';\nfunction NameInput({\n value,\n onChange,\n label\n}) {\n return /*#__PURE__*/_jsx(NameInputControl, {\n size: \"compact\",\n label: label,\n hideLabelFromVision: true,\n value: value,\n onChange: onChange\n });\n}\n\n/*\n * Deduplicates the slugs of the provided elements.\n */\nexport function deduplicateElementSlugs(elements) {\n const slugCounts = {};\n return elements.map(element => {\n let newSlug;\n const {\n slug\n } = element;\n slugCounts[slug] = (slugCounts[slug] || 0) + 1;\n if (slugCounts[slug] > 1) {\n newSlug = `${slug}-${slugCounts[slug] - 1}`;\n }\n return {\n ...element,\n slug: newSlug ?? slug\n };\n });\n}\n\n/**\n * Returns a name and slug for a palette item. The name takes the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A name and slug for the new palette item.\n */\nexport function getNameAndSlugForPosition(elements, slugPrefix) {\n const nameRegex = new RegExp(`^${slugPrefix}color-([\\\\d]+)$`);\n const position = elements.reduce((previousValue, currentValue) => {\n if (typeof currentValue?.slug === 'string') {\n const matches = currentValue?.slug.match(nameRegex);\n if (matches) {\n const id = parseInt(matches[1], 10);\n if (id >= previousValue) {\n return id + 1;\n }\n }\n }\n return previousValue;\n }, 1);\n return {\n name: sprintf(/* translators: %d: is an id for a custom color */\n __('Color %d'), position),\n slug: `${slugPrefix}color-${position}`\n };\n}\nfunction ColorPickerPopover({\n isGradient,\n element,\n onChange,\n popoverProps: receivedPopoverProps,\n onClose = () => {}\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\n offset: 20,\n // Disabling resize as it would otherwise cause the popover to show\n // scrollbars while dragging the color picker's handle close to the\n // popover edge.\n resize: false,\n placement: 'left-start',\n ...receivedPopoverProps,\n className: clsx('components-palette-edit__popover', receivedPopoverProps?.className)\n }), [receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Popover, {\n ...popoverProps,\n onClose: onClose,\n children: [!isGradient && /*#__PURE__*/_jsx(ColorPicker, {\n color: element.color,\n enableAlpha: true,\n onChange: newColor => {\n onChange({\n ...element,\n color: newColor\n });\n }\n }), isGradient && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-palette-edit__popover-gradient-picker\",\n children: /*#__PURE__*/_jsx(CustomGradientPicker, {\n __experimentalIsRenderedInSidebar: true,\n value: element.gradient,\n onChange: newGradient => {\n onChange({\n ...element,\n gradient: newGradient\n });\n }\n })\n })]\n });\n}\nfunction Option({\n canOnlyChangeValues,\n element,\n onChange,\n onRemove,\n popoverProps: receivedPopoverProps,\n slugPrefix,\n isGradient\n}) {\n const value = isGradient ? element.gradient : element.color;\n const [isEditingColor, setIsEditingColor] = useState(false);\n\n // Use internal state instead of a ref to make sure that the component\n // re-renders when the popover's anchor updates.\n const [popoverAnchor, setPopoverAnchor] = useState(null);\n const popoverProps = useMemo(() => ({\n ...receivedPopoverProps,\n // Use the custom palette color item as the popover anchor.\n anchor: popoverAnchor\n }), [popoverAnchor, receivedPopoverProps]);\n return /*#__PURE__*/_jsxs(Item, {\n ref: setPopoverAnchor,\n size: \"small\",\n children: [/*#__PURE__*/_jsxs(HStack, {\n justify: \"flex-start\",\n children: [/*#__PURE__*/_jsx(Button, {\n size: \"small\",\n onClick: () => {\n setIsEditingColor(true);\n },\n \"aria-label\": sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Edit: %s'), element.name.trim().length ? element.name : value || ''),\n style: {\n padding: 0\n },\n children: /*#__PURE__*/_jsx(IndicatorStyled, {\n colorValue: value\n })\n }), /*#__PURE__*/_jsx(FlexBlock, {\n children: !canOnlyChangeValues ? /*#__PURE__*/_jsx(NameInput, {\n label: isGradient ? __('Gradient name') : __('Color name'),\n value: element.name,\n onChange: nextName => onChange({\n ...element,\n name: nextName,\n slug: slugPrefix + kebabCase(nextName ?? '')\n })\n }) : /*#__PURE__*/_jsx(NameContainer, {\n children: element.name.trim().length ? element.name : /* Fall back to non-breaking space to maintain height */\n '\\u00A0'\n })\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(FlexItem, {\n children: /*#__PURE__*/_jsx(RemoveButton, {\n size: \"small\",\n icon: lineSolid,\n label: sprintf(\n // translators: %s is a color or gradient name, e.g. \"Red\".\n __('Remove color: %s'), element.name.trim().length ? element.name : value || ''),\n onClick: onRemove\n })\n })]\n }), isEditingColor && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onChange: onChange,\n element: element,\n popoverProps: popoverProps,\n onClose: () => setIsEditingColor(false)\n })]\n });\n}\nfunction PaletteEditListView({\n elements,\n onChange,\n canOnlyChangeValues,\n slugPrefix,\n isGradient,\n popoverProps,\n addColorRef\n}) {\n // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n const elementsReferenceRef = useRef(undefined);\n useEffect(() => {\n elementsReferenceRef.current = elements;\n }, [elements]);\n const debounceOnChange = useDebounce(updatedElements => onChange(deduplicateElementSlugs(updatedElements)), 100);\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n children: /*#__PURE__*/_jsx(ItemGroup, {\n isRounded: true,\n isBordered: true,\n isSeparated: true,\n children: elements.map((element, index) => /*#__PURE__*/_jsx(Option, {\n isGradient: isGradient,\n canOnlyChangeValues: canOnlyChangeValues,\n element: element,\n onChange: newElement => {\n debounceOnChange(elements.map((currentElement, currentIndex) => {\n if (currentIndex === index) {\n return newElement;\n }\n return currentElement;\n }));\n },\n onRemove: () => {\n const newElements = elements.filter((_currentElement, currentIndex) => {\n if (currentIndex === index) {\n return false;\n }\n return true;\n });\n onChange(newElements.length ? newElements : undefined);\n addColorRef.current?.focus();\n },\n slugPrefix: slugPrefix,\n popoverProps: popoverProps\n }, index))\n })\n });\n}\nconst EMPTY_ARRAY = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit({\n gradients,\n colors = EMPTY_ARRAY,\n onChange,\n paletteLabel,\n paletteLabelHeadingLevel = 2,\n emptyMessage,\n canOnlyChangeValues,\n canReset,\n slugPrefix = '',\n popoverProps\n}) {\n const isGradient = !!gradients;\n const elements = isGradient ? gradients : colors;\n const [isEditing, setIsEditing] = useState(false);\n const [editingElement, setEditingElement] = useState(null);\n const isAdding = isEditing && !!editingElement && elements[editingElement] && !elements[editingElement].slug;\n const elementsLength = elements.length;\n const hasElements = elementsLength > 0;\n const debounceOnChange = useDebounce(onChange, 100);\n const onSelectPaletteItem = useCallback((value, newEditingElementIndex) => {\n const selectedElement = newEditingElementIndex === undefined ? undefined : elements[newEditingElementIndex];\n const key = isGradient ? 'gradient' : 'color';\n // Ensures that the index returned matches a known element value.\n if (!!selectedElement && selectedElement[key] === value) {\n setEditingElement(newEditingElementIndex);\n } else {\n setIsEditing(true);\n }\n }, [isGradient, elements]);\n const addColorRef = useRef(null);\n return /*#__PURE__*/_jsxs(PaletteEditStyles, {\n children: [/*#__PURE__*/_jsxs(HStack, {\n children: [/*#__PURE__*/_jsx(PaletteHeading, {\n level: paletteLabelHeadingLevel,\n children: paletteLabel\n }), /*#__PURE__*/_jsxs(PaletteActionsContainer, {\n children: [hasElements && isEditing && /*#__PURE__*/_jsx(DoneButton, {\n size: \"small\",\n onClick: () => {\n setIsEditing(false);\n setEditingElement(null);\n },\n children: __('Done')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n ref: addColorRef,\n size: \"small\",\n isPressed: isAdding,\n icon: plus,\n label: isGradient ? __('Add gradient') : __('Add color'),\n onClick: () => {\n const {\n name,\n slug\n } = getNameAndSlugForPosition(elements, slugPrefix);\n if (!!gradients) {\n onChange([...gradients, {\n gradient: DEFAULT_GRADIENT,\n name,\n slug\n }]);\n } else {\n onChange([...colors, {\n color: DEFAULT_COLOR,\n name,\n slug\n }]);\n }\n setIsEditing(true);\n setEditingElement(elements.length);\n }\n }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && /*#__PURE__*/_jsx(DropdownMenu, {\n icon: moreVertical,\n label: isGradient ? __('Gradient options') : __('Color options'),\n toggleProps: {\n size: 'small'\n },\n children: ({\n onClose\n }) => /*#__PURE__*/_jsx(_Fragment, {\n children: /*#__PURE__*/_jsxs(NavigableMenu, {\n role: \"menu\",\n children: [!isEditing && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setIsEditing(true);\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: __('Show details')\n }), !canOnlyChangeValues && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n setIsEditing(false);\n onChange();\n onClose();\n },\n className: \"components-palette-edit__menu-button\",\n children: isGradient ? __('Remove all gradients') : __('Remove all colors')\n }), canReset && /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n className: \"components-palette-edit__menu-button\",\n variant: \"tertiary\",\n onClick: () => {\n setEditingElement(null);\n onChange();\n onClose();\n },\n children: isGradient ? __('Reset gradient') : __('Reset colors')\n })]\n })\n })\n })]\n })]\n }), hasElements && /*#__PURE__*/_jsxs(PaletteEditContents, {\n children: [isEditing && /*#__PURE__*/_jsx(PaletteEditListView, {\n canOnlyChangeValues: canOnlyChangeValues,\n elements: elements\n // @ts-expect-error TODO: Don't know how to resolve\n ,\n onChange: onChange,\n slugPrefix: slugPrefix,\n isGradient: isGradient,\n popoverProps: popoverProps,\n addColorRef: addColorRef\n }), !isEditing && editingElement !== null && /*#__PURE__*/_jsx(ColorPickerPopover, {\n isGradient: isGradient,\n onClose: () => setEditingElement(null),\n onChange: newElement => {\n debounceOnChange(\n // @ts-expect-error TODO: Don't know how to resolve\n elements.map((currentElement, currentIndex) => {\n if (currentIndex === editingElement) {\n return newElement;\n }\n return currentElement;\n }));\n },\n element: elements[editingElement ?? -1],\n popoverProps: popoverProps\n }), !isEditing && (isGradient ? /*#__PURE__*/_jsx(GradientPicker, {\n gradients: gradients,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomGradients: true\n }) : /*#__PURE__*/_jsx(ColorPalette, {\n colors: colors,\n onChange: onSelectPaletteItem,\n clearable: false,\n disableCustomColors: true\n }))]\n }), !hasElements && emptyMessage && /*#__PURE__*/_jsx(PaletteEditContents, {\n children: emptyMessage\n })]\n });\n}\nexport default PaletteEdit;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkE;AAClE,kBAA4B;AAC5B,mBAA8C;AAC9C,qBAA4B;AAK5B,oBAAmB;AACnB,0BAA4B;AAC5B,kBAAoC;AACpC,qBAAuB;AACvB,wBAAgC;AAChC,qBAAuB;AACvB,6BAA2B;AAC3B,2BAAyB;AACzB,2BAAyB;AACzB,qBAAoB;AACpB,oBAA4K;AAC5K,iCAA8B;AAC9B,uBAAiC;AACjC,oCAAiC;AACjC,qBAA0B;AAC1B,yBAAkE;AAClE,IAAM,gBAAgB;AACtB,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,SAAoB,uCAAAA,KAAK,gCAAkB;AAAA,IACzC,MAAM;AAAA,IACN;AAAA,IACA,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAKO,SAAS,wBAAwB,UAAU;AAChD,QAAM,aAAa,CAAC;AACpB,SAAO,SAAS,IAAI,aAAW;AAC7B,QAAI;AACJ,UAAM;AAAA,MACJ;AAAA,IACF,IAAI;AACJ,eAAW,IAAI,KAAK,WAAW,IAAI,KAAK,KAAK;AAC7C,QAAI,WAAW,IAAI,IAAI,GAAG;AACxB,gBAAU,GAAG,IAAI,IAAI,WAAW,IAAI,IAAI,CAAC;AAAA,IAC3C;AACA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,MAAM,WAAW;AAAA,IACnB;AAAA,EACF,CAAC;AACH;AAaO,SAAS,0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,CAAC;AAAA,UACH,CAAC;AAAA,QACH,CAAC,CAAC;AAAA,MACJ,CAAC,CAAC;AAAA,IACJ,CAAC,GAAG,eAA4B,uCAAAH,MAAM,mCAAqB;AAAA,MACzD,UAAU,CAAC,aAA0B,uCAAAF,KAAK,qBAAqB;AAAA,QAC7D;AAAA,QACA;AAAA,QAGA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,GAAG,CAAC,aAAa,mBAAmB,QAAqB,uCAAAA,KAAK,oBAAoB;AAAA,QACjF;AAAA,QACA,SAAS,MAAM,kBAAkB,IAAI;AAAA,QACrC,UAAU,gBAAc;AACtB;AAAA;AAAA,YAEA,SAAS,IAAI,CAAC,gBAAgB,iBAAiB;AAC7C,kBAAI,iBAAiB,gBAAgB;AACnC,uBAAO;AAAA,cACT;AACA,qBAAO;AAAA,YACT,CAAC;AAAA,UAAC;AAAA,QACJ;AAAA,QACA,SAAS,SAAS,kBAAkB,EAAE;AAAA,QACtC;AAAA,MACF,CAAC,GAAG,CAAC,cAAc,aAA0B,uCAAAA,KAAK,uBAAAQ,SAAgB;AAAA,QAChE;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA,QACX,wBAAwB;AAAA,MAC1B,CAAC,IAAiB,uCAAAR,KAAK,qBAAAS,SAAc;AAAA,QACnC;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA,QACX,qBAAqB;AAAA,MACvB,CAAC,EAAE;AAAA,IACL,CAAC,GAAG,CAAC,eAAe,gBAA6B,uCAAAT,KAAK,mCAAqB;AAAA,MACzE,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,uBAAQ;",
6
6
  "names": ["_jsx", "clsx", "_jsxs", "Popover", "CustomGradientPicker", "Button", "DropdownMenu", "_Fragment", "GradientPicker", "ColorPalette"]
7
7
  }
@@ -59,9 +59,9 @@ function Fill({
59
59
  (0, import_element.useLayoutEffect)(() => {
60
60
  registry.updateFill(name, {
61
61
  instance: instanceRef.current,
62
- children: childrenRef.current
62
+ children
63
63
  });
64
- });
64
+ }, [registry, name, children]);
65
65
  const slot = (0, import_compose.useObservableValue)(registry.slots, name);
66
66
  if (!slot) {
67
67
  return null;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/slot-fill/fill.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useObservableValue } from '@wordpress/compose';\nimport { useContext, useLayoutEffect, useRef, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport StyleProvider from '../style-provider';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default function Fill({\n name,\n children\n}) {\n const registry = useContext(SlotFillContext);\n const instanceRef = useRef({});\n const childrenRef = useRef(children);\n useLayoutEffect(() => {\n childrenRef.current = children;\n }, [children]);\n useLayoutEffect(() => {\n const instance = instanceRef.current;\n registry.registerFill(name, {\n instance,\n children: childrenRef.current\n });\n return () => registry.unregisterFill(name, instance);\n }, [registry, name]);\n useLayoutEffect(() => {\n registry.updateFill(name, {\n instance: instanceRef.current,\n children: childrenRef.current\n });\n });\n const slot = useObservableValue(registry.slots, name);\n if (!slot) {\n return null;\n }\n if (slot.type === 'children') {\n return null;\n }\n const portalEl = slot.ref.current;\n if (!portalEl) {\n return null;\n }\n const wrappedChildren = typeof children === 'function' ? children(slot.fillProps ?? {}) : children;\n\n // When using a `Fill`, the `children` will be rendered in the document of the\n // `Slot`. This means that we need to wrap the `children` in a `StyleProvider`\n // to make sure we're referencing the right document/iframe (instead of the\n // context of the `Fill`'s parent).\n return createPortal(/*#__PURE__*/_jsx(StyleProvider, {\n document: portalEl.ownerDocument,\n children: wrappedChildren\n }), portalEl);\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmC;AACnC,qBAAkE;AAKlE,qBAA4B;AAC5B,4BAA0B;AAC1B,yBAA4B;AACb,SAAR,KAAsB;AAAA,EAC3B;AAAA,EACA;AACF,GAAG;AACD,QAAM,eAAW,2BAAW,eAAAA,OAAe;AAC3C,QAAM,kBAAc,uBAAO,CAAC,CAAC;AAC7B,QAAM,kBAAc,uBAAO,QAAQ;AACnC,sCAAgB,MAAM;AACpB,gBAAY,UAAU;AAAA,EACxB,GAAG,CAAC,QAAQ,CAAC;AACb,sCAAgB,MAAM;AACpB,UAAM,WAAW,YAAY;AAC7B,aAAS,aAAa,MAAM;AAAA,MAC1B;AAAA,MACA,UAAU,YAAY;AAAA,IACxB,CAAC;AACD,WAAO,MAAM,SAAS,eAAe,MAAM,QAAQ;AAAA,EACrD,GAAG,CAAC,UAAU,IAAI,CAAC;AACnB,sCAAgB,MAAM;AACpB,aAAS,WAAW,MAAM;AAAA,MACxB,UAAU,YAAY;AAAA,MACtB,UAAU,YAAY;AAAA,IACxB,CAAC;AAAA,EACH,CAAC;AACD,QAAM,WAAO,mCAAmB,SAAS,OAAO,IAAI;AACpD,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,MAAI,KAAK,SAAS,YAAY;AAC5B,WAAO;AAAA,EACT;AACA,QAAM,WAAW,KAAK,IAAI;AAC1B,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,kBAAkB,OAAO,aAAa,aAAa,SAAS,KAAK,aAAa,CAAC,CAAC,IAAI;AAM1F,aAAO,6BAA0B,uCAAAC,KAAK,sBAAAC,SAAe;AAAA,IACnD,UAAU,SAAS;AAAA,IACnB,UAAU;AAAA,EACZ,CAAC,GAAG,QAAQ;AACd;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useObservableValue } from '@wordpress/compose';\nimport { useContext, useLayoutEffect, useRef, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport StyleProvider from '../style-provider';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport default function Fill({\n name,\n children\n}) {\n const registry = useContext(SlotFillContext);\n const instanceRef = useRef({});\n const childrenRef = useRef(children);\n useLayoutEffect(() => {\n childrenRef.current = children;\n }, [children]);\n useLayoutEffect(() => {\n const instance = instanceRef.current;\n registry.registerFill(name, {\n instance,\n children: childrenRef.current\n });\n return () => registry.unregisterFill(name, instance);\n }, [registry, name]);\n useLayoutEffect(() => {\n registry.updateFill(name, {\n instance: instanceRef.current,\n children\n });\n }, [registry, name, children]);\n const slot = useObservableValue(registry.slots, name);\n if (!slot) {\n return null;\n }\n if (slot.type === 'children') {\n return null;\n }\n const portalEl = slot.ref.current;\n if (!portalEl) {\n return null;\n }\n const wrappedChildren = typeof children === 'function' ? children(slot.fillProps ?? {}) : children;\n\n // When using a `Fill`, the `children` will be rendered in the document of the\n // `Slot`. This means that we need to wrap the `children` in a `StyleProvider`\n // to make sure we're referencing the right document/iframe (instead of the\n // context of the `Fill`'s parent).\n return createPortal(/*#__PURE__*/_jsx(StyleProvider, {\n document: portalEl.ownerDocument,\n children: wrappedChildren\n }), portalEl);\n}"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmC;AACnC,qBAAkE;AAKlE,qBAA4B;AAC5B,4BAA0B;AAC1B,yBAA4B;AACb,SAAR,KAAsB;AAAA,EAC3B;AAAA,EACA;AACF,GAAG;AACD,QAAM,eAAW,2BAAW,eAAAA,OAAe;AAC3C,QAAM,kBAAc,uBAAO,CAAC,CAAC;AAC7B,QAAM,kBAAc,uBAAO,QAAQ;AACnC,sCAAgB,MAAM;AACpB,gBAAY,UAAU;AAAA,EACxB,GAAG,CAAC,QAAQ,CAAC;AACb,sCAAgB,MAAM;AACpB,UAAM,WAAW,YAAY;AAC7B,aAAS,aAAa,MAAM;AAAA,MAC1B;AAAA,MACA,UAAU,YAAY;AAAA,IACxB,CAAC;AACD,WAAO,MAAM,SAAS,eAAe,MAAM,QAAQ;AAAA,EACrD,GAAG,CAAC,UAAU,IAAI,CAAC;AACnB,sCAAgB,MAAM;AACpB,aAAS,WAAW,MAAM;AAAA,MACxB,UAAU,YAAY;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,UAAU,MAAM,QAAQ,CAAC;AAC7B,QAAM,WAAO,mCAAmB,SAAS,OAAO,IAAI;AACpD,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,MAAI,KAAK,SAAS,YAAY;AAC5B,WAAO;AAAA,EACT;AACA,QAAM,WAAW,KAAK,IAAI;AAC1B,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,kBAAkB,OAAO,aAAa,aAAa,SAAS,KAAK,aAAa,CAAC,CAAC,IAAI;AAM1F,aAAO,6BAA0B,uCAAAC,KAAK,sBAAAC,SAAe;AAAA,IACnD,UAAU,SAAS;AAAA,IACnB,UAAU;AAAA,EACZ,CAAC,GAAG,QAAQ;AACd;",
6
6
  "names": ["SlotFillContext", "_jsx", "StyleProvider"]
7
7
  }
@@ -37,6 +37,79 @@ module.exports = __toCommonJS(style_provider_exports);
37
37
  var import_react = require("@emotion/react");
38
38
  var import_cache = __toESM(require("@emotion/cache"));
39
39
  var uuid = __toESM(require("uuid"));
40
+ var import_element = require("@wordpress/element");
41
+
42
+ // packages/style-runtime/src/index.ts
43
+ var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
44
+ function getRuntime() {
45
+ const globalScope = globalThis;
46
+ if (globalScope.__wpStyleRuntime) {
47
+ return globalScope.__wpStyleRuntime;
48
+ }
49
+ globalScope.__wpStyleRuntime = {
50
+ documents: /* @__PURE__ */ new Map(),
51
+ styles: /* @__PURE__ */ new Map(),
52
+ injectedStyles: /* @__PURE__ */ new WeakMap()
53
+ };
54
+ if (typeof document !== "undefined") {
55
+ registerDocument(document);
56
+ }
57
+ return globalScope.__wpStyleRuntime;
58
+ }
59
+ function documentContainsStyleHash(targetDocument, hash) {
60
+ if (!targetDocument.head) {
61
+ return false;
62
+ }
63
+ for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {
64
+ if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
65
+ return true;
66
+ }
67
+ }
68
+ return false;
69
+ }
70
+ function injectStyle(targetDocument, hash, css) {
71
+ if (!targetDocument.head) {
72
+ return;
73
+ }
74
+ const runtime = getRuntime();
75
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
76
+ if (!injectedStyles) {
77
+ injectedStyles = /* @__PURE__ */ new Set();
78
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
79
+ }
80
+ if (injectedStyles.has(hash)) {
81
+ return;
82
+ }
83
+ if (documentContainsStyleHash(targetDocument, hash)) {
84
+ injectedStyles.add(hash);
85
+ return;
86
+ }
87
+ const style = targetDocument.createElement("style");
88
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
89
+ style.appendChild(targetDocument.createTextNode(css));
90
+ targetDocument.head.appendChild(style);
91
+ injectedStyles.add(hash);
92
+ }
93
+ function registerDocument(targetDocument) {
94
+ const runtime = getRuntime();
95
+ runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
96
+ for (const [hash, css] of runtime.styles) {
97
+ injectStyle(targetDocument, hash, css);
98
+ }
99
+ return () => {
100
+ const count = runtime.documents.get(targetDocument);
101
+ if (count === void 0) {
102
+ return;
103
+ }
104
+ if (count <= 1) {
105
+ runtime.documents.delete(targetDocument);
106
+ return;
107
+ }
108
+ runtime.documents.set(targetDocument, count - 1);
109
+ };
110
+ }
111
+
112
+ // packages/components/src/style-provider/index.tsx
40
113
  var import_jsx_runtime = require("react/jsx-runtime");
41
114
  var uuidCache = /* @__PURE__ */ new Set();
42
115
  var containerCacheMap = /* @__PURE__ */ new WeakMap();
@@ -59,12 +132,18 @@ var memoizedCreateCacheWithContainer = (container) => {
59
132
  function StyleProvider(props) {
60
133
  const {
61
134
  children,
62
- document
135
+ document: document2
63
136
  } = props;
64
- if (!document) {
137
+ (0, import_element.useLayoutEffect)(() => {
138
+ if (!document2) {
139
+ return;
140
+ }
141
+ return registerDocument(document2);
142
+ }, [document2]);
143
+ if (!document2) {
65
144
  return null;
66
145
  }
67
- const cache = memoizedCreateCacheWithContainer(document.head);
146
+ const cache = memoizedCreateCacheWithContainer(document2.head);
68
147
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.CacheProvider, {
69
148
  value: cache,
70
149
  children
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/style-provider/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { CacheProvider } from '@emotion/react';\nimport createCache from '@emotion/cache';\nimport * as uuid from 'uuid';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst uuidCache = new Set();\n// Use a weak map so that when the container is detached it's automatically\n// dereferenced to avoid memory leak.\nconst containerCacheMap = new WeakMap();\nconst memoizedCreateCacheWithContainer = container => {\n if (containerCacheMap.has(container)) {\n return containerCacheMap.get(container);\n }\n\n // Emotion only accepts alphabetical and hyphenated keys so we just\n // strip the numbers from the UUID. It _should_ be fine.\n let key = uuid.v4().replace(/[0-9]/g, '');\n while (uuidCache.has(key)) {\n key = uuid.v4().replace(/[0-9]/g, '');\n }\n uuidCache.add(key);\n const cache = createCache({\n container,\n key\n });\n containerCacheMap.set(container, cache);\n return cache;\n};\nexport function StyleProvider(props) {\n const {\n children,\n document\n } = props;\n if (!document) {\n return null;\n }\n const cache = memoizedCreateCacheWithContainer(document.head);\n return /*#__PURE__*/_jsx(CacheProvider, {\n value: cache,\n children: children\n });\n}\nexport default StyleProvider;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;AAC9B,mBAAwB;AACxB,WAAsB;AAKtB,yBAA4B;AAC5B,IAAM,YAAY,oBAAI,IAAI;AAG1B,IAAM,oBAAoB,oBAAI,QAAQ;AACtC,IAAM,mCAAmC,eAAa;AACpD,MAAI,kBAAkB,IAAI,SAAS,GAAG;AACpC,WAAO,kBAAkB,IAAI,SAAS;AAAA,EACxC;AAIA,MAAI,MAAW,QAAG,EAAE,QAAQ,UAAU,EAAE;AACxC,SAAO,UAAU,IAAI,GAAG,GAAG;AACzB,UAAW,QAAG,EAAE,QAAQ,UAAU,EAAE;AAAA,EACtC;AACA,YAAU,IAAI,GAAG;AACjB,QAAM,YAAQ,aAAAA,SAAY;AAAA,IACxB;AAAA,IACA;AAAA,EACF,CAAC;AACD,oBAAkB,IAAI,WAAW,KAAK;AACtC,SAAO;AACT;AACO,SAAS,cAAc,OAAO;AACnC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,iCAAiC,SAAS,IAAI;AAC5D,SAAoB,uCAAAC,KAAK,4BAAe;AAAA,IACtC,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;AACA,IAAO,yBAAQ;",
6
- "names": ["createCache", "_jsx"]
3
+ "sources": ["../../src/style-provider/index.tsx", "../../../style-runtime/src/index.ts"],
4
+ "sourcesContent": ["import { CacheProvider } from '@emotion/react';\nimport createCache from '@emotion/cache';\nimport * as uuid from 'uuid';\nimport { useLayoutEffect } from '@wordpress/element';\nimport { registerDocument } from '@wordpress/style-runtime';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst uuidCache = new Set();\n// Use a weak map so that when the container is detached it's automatically\n// dereferenced to avoid memory leak.\nconst containerCacheMap = new WeakMap();\nconst memoizedCreateCacheWithContainer = container => {\n if (containerCacheMap.has(container)) {\n return containerCacheMap.get(container);\n }\n\n // Emotion only accepts alphabetical and hyphenated keys so we just\n // strip the numbers from the UUID. It _should_ be fine.\n let key = uuid.v4().replace(/[0-9]/g, '');\n while (uuidCache.has(key)) {\n key = uuid.v4().replace(/[0-9]/g, '');\n }\n uuidCache.add(key);\n const cache = createCache({\n container,\n key\n });\n containerCacheMap.set(container, cache);\n return cache;\n};\nexport function StyleProvider(props) {\n const {\n children,\n document\n } = props;\n useLayoutEffect(() => {\n if (!document) {\n return;\n }\n return registerDocument(document);\n }, [document]);\n if (!document) {\n return null;\n }\n const cache = memoizedCreateCacheWithContainer(document.head);\n return /*#__PURE__*/_jsx(CacheProvider, {\n value: cache,\n children: children\n });\n}\nexport default StyleProvider;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAC9B,mBAAwB;AACxB,WAAsB;AACtB,qBAAgC;;;ACHhC,IAAM,uBAAuB;AA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