@wordpress/components 33.0.0 → 33.1.1-next.v.202605131006.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 (817) hide show
  1. package/CHANGELOG.md +24 -0
  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/modal/index.cjs +1 -5
  18. package/build/modal/index.cjs.map +2 -2
  19. package/build/modal/use-modal-exit-animation.cjs +52 -41
  20. package/build/modal/use-modal-exit-animation.cjs.map +2 -2
  21. package/build/palette-edit/index.cjs.map +2 -2
  22. package/build/slot-fill/fill.cjs +2 -2
  23. package/build/slot-fill/fill.cjs.map +2 -2
  24. package/build/style-provider/index.cjs +82 -3
  25. package/build/style-provider/index.cjs.map +4 -4
  26. package/build/text/styles.cjs +7 -7
  27. package/build/text/styles.cjs.map +2 -2
  28. package/build/utils/config-values.cjs +3 -0
  29. package/build/utils/config-values.cjs.map +2 -2
  30. package/build/utils/dropdown-motion.cjs +2 -2
  31. package/build/utils/dropdown-motion.cjs.map +2 -2
  32. package/build-module/alignment-matrix-control/cell.mjs +79 -5
  33. package/build-module/alignment-matrix-control/cell.mjs.map +3 -3
  34. package/build-module/alignment-matrix-control/index.mjs +79 -5
  35. package/build-module/alignment-matrix-control/index.mjs.map +3 -3
  36. package/build-module/angle-picker-control/angle-circle.mjs +79 -5
  37. package/build-module/angle-picker-control/angle-circle.mjs.map +3 -3
  38. package/build-module/autocomplete/autocompleter-ui.mjs.map +2 -2
  39. package/build-module/color-palette/index.mjs +14 -8
  40. package/build-module/color-palette/index.mjs.map +2 -2
  41. package/build-module/color-palette/utils.mjs +9 -2
  42. package/build-module/color-palette/utils.mjs.map +2 -2
  43. package/build-module/color-picker/hex-input.mjs +1 -1
  44. package/build-module/color-picker/hex-input.mjs.map +2 -2
  45. package/build-module/custom-gradient-picker/index.mjs.map +2 -2
  46. package/build-module/focal-point-picker/index.mjs.map +2 -2
  47. package/build-module/modal/index.mjs +1 -5
  48. package/build-module/modal/index.mjs.map +2 -2
  49. package/build-module/modal/use-modal-exit-animation.mjs +52 -41
  50. package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
  51. package/build-module/palette-edit/index.mjs.map +2 -2
  52. package/build-module/slot-fill/fill.mjs +2 -2
  53. package/build-module/slot-fill/fill.mjs.map +2 -2
  54. package/build-module/style-provider/index.mjs +82 -3
  55. package/build-module/style-provider/index.mjs.map +4 -4
  56. package/build-module/text/styles.mjs +7 -7
  57. package/build-module/text/styles.mjs.map +2 -2
  58. package/build-module/utils/config-values.mjs +3 -0
  59. package/build-module/utils/config-values.mjs.map +2 -2
  60. package/build-module/utils/dropdown-motion.mjs +2 -2
  61. package/build-module/utils/dropdown-motion.mjs.map +2 -2
  62. package/build-style/style-rtl.css +64 -32
  63. package/build-style/style.css +64 -32
  64. package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
  65. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  66. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  67. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  68. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  69. package/build-types/angle-picker-control/index.d.ts +1 -1
  70. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  71. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  72. package/build-types/angle-picker-control/stories/index.story.d.ts.map +1 -1
  73. package/build-types/animate/index.d.ts.map +1 -1
  74. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  75. package/build-types/autocomplete/autocompleter-ui.d.ts +1 -1
  76. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  77. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -1
  78. package/build-types/autocomplete/index.d.ts +3 -3
  79. package/build-types/autocomplete/index.d.ts.map +1 -1
  80. package/build-types/badge/index.d.ts.map +1 -1
  81. package/build-types/badge/stories/index.story.d.ts.map +1 -1
  82. package/build-types/base-control/hooks.d.ts +4 -4
  83. package/build-types/base-control/index.d.ts +2 -2
  84. package/build-types/base-control/index.d.ts.map +1 -1
  85. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  86. package/build-types/border-box-control/border-box-control/component.d.ts +4 -4
  87. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  88. package/build-types/border-box-control/border-box-control/hook.d.ts +124 -124
  89. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  90. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  91. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +117 -117
  92. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +4 -4
  93. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  94. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +116 -116
  95. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  96. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +106 -106
  97. package/build-types/border-box-control/stories/index.story.d.ts +5 -5
  98. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  99. package/build-types/border-box-control/styles.d.ts +3 -3
  100. package/build-types/border-box-control/styles.d.ts.map +1 -1
  101. package/build-types/border-box-control/utils.d.ts.map +1 -1
  102. package/build-types/border-control/border-control/component.d.ts +5 -5
  103. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  104. package/build-types/border-control/border-control/hook.d.ts +129 -129
  105. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  106. package/build-types/border-control/border-control-dropdown/component.d.ts +3 -3
  107. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  108. package/build-types/border-control/border-control-dropdown/hook.d.ts +122 -122
  109. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  110. package/build-types/border-control/border-control-style-picker/component.d.ts +1 -1
  111. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  112. package/build-types/border-control/stories/index.story.d.ts +30 -30
  113. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  114. package/build-types/border-control/styles.d.ts +2 -2
  115. package/build-types/border-control/styles.d.ts.map +1 -1
  116. package/build-types/box-control/index.d.ts +1 -1
  117. package/build-types/box-control/index.d.ts.map +1 -1
  118. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  119. package/build-types/box-control/styles/box-control-styles.d.ts +15 -15
  120. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  121. package/build-types/box-control/utils.d.ts +2 -2
  122. package/build-types/box-control/utils.d.ts.map +1 -1
  123. package/build-types/button/deprecated.d.ts +34 -34
  124. package/build-types/button/deprecated.d.ts.map +1 -1
  125. package/build-types/button/index.d.ts.map +1 -1
  126. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  127. package/build-types/button/stories/index.story.d.ts.map +1 -1
  128. package/build-types/button-group/index.d.ts.map +1 -1
  129. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  130. package/build-types/calendar/date-calendar/index.d.ts.map +1 -1
  131. package/build-types/calendar/date-range-calendar/index.d.ts +1 -1
  132. package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -1
  133. package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -1
  134. package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -1
  135. package/build-types/calendar/test/__utils__/index.d.ts.map +1 -1
  136. package/build-types/calendar/utils/constants.d.ts +2 -2
  137. package/build-types/calendar/utils/constants.d.ts.map +1 -1
  138. package/build-types/calendar/utils/use-localization-props.d.ts +3 -3
  139. package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -1
  140. package/build-types/card/card/component.d.ts.map +1 -1
  141. package/build-types/card/card/hook.d.ts +110 -110
  142. package/build-types/card/card-body/component.d.ts.map +1 -1
  143. package/build-types/card/card-body/hook.d.ts +107 -107
  144. package/build-types/card/card-divider/component.d.ts +2 -2
  145. package/build-types/card/card-divider/component.d.ts.map +1 -1
  146. package/build-types/card/card-divider/hook.d.ts +108 -108
  147. package/build-types/card/card-footer/component.d.ts.map +1 -1
  148. package/build-types/card/card-footer/hook.d.ts +113 -113
  149. package/build-types/card/card-header/component.d.ts.map +1 -1
  150. package/build-types/card/card-header/hook.d.ts +113 -113
  151. package/build-types/card/card-media/component.d.ts.map +1 -1
  152. package/build-types/card/card-media/hook.d.ts +106 -106
  153. package/build-types/card/get-padding-by-size.d.ts +1 -1
  154. package/build-types/card/get-padding-by-size.d.ts.map +1 -1
  155. package/build-types/card/stories/index.story.d.ts.map +1 -1
  156. package/build-types/checkbox-control/index.d.ts.map +1 -1
  157. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  158. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +1 -1
  159. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  160. package/build-types/circular-option-picker/circular-option-picker.d.ts +8 -0
  161. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  162. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  163. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  164. package/build-types/color-indicator/index.d.ts +1 -1
  165. package/build-types/color-indicator/index.d.ts.map +1 -1
  166. package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
  167. package/build-types/color-palette/index.d.ts.map +1 -1
  168. package/build-types/color-palette/stories/index.story.d.ts +1 -0
  169. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  170. package/build-types/color-palette/styles.d.ts +5 -5
  171. package/build-types/color-palette/types.d.ts +16 -2
  172. package/build-types/color-palette/types.d.ts.map +1 -1
  173. package/build-types/color-palette/utils.d.ts +1 -1
  174. package/build-types/color-palette/utils.d.ts.map +1 -1
  175. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  176. package/build-types/color-picker/color-input.d.ts.map +1 -1
  177. package/build-types/color-picker/component.d.ts +1 -1
  178. package/build-types/color-picker/component.d.ts.map +1 -1
  179. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  180. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  181. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  182. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  183. package/build-types/color-picker/picker.d.ts.map +1 -1
  184. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  185. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  186. package/build-types/color-picker/styles.d.ts +20 -20
  187. package/build-types/color-picker/styles.d.ts.map +1 -1
  188. package/build-types/combobox-control/index.d.ts.map +1 -1
  189. package/build-types/combobox-control/stories/index.story.d.ts +8 -8
  190. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  191. package/build-types/combobox-control/styles.d.ts +1 -1
  192. package/build-types/composite/index.d.ts +25 -25
  193. package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
  194. package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
  195. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  196. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  197. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  198. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  199. package/build-types/context/constants.d.ts +3 -3
  200. package/build-types/context/constants.d.ts.map +1 -1
  201. package/build-types/context/context-system-provider.d.ts +4 -4
  202. package/build-types/context/context-system-provider.d.ts.map +1 -1
  203. package/build-types/context/use-context-system.d.ts +4 -4
  204. package/build-types/context/use-context-system.d.ts.map +1 -1
  205. package/build-types/context/utils.d.ts +2 -2
  206. package/build-types/context/utils.d.ts.map +1 -1
  207. package/build-types/custom-gradient-picker/constants.d.ts +2 -2
  208. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
  209. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +1 -1
  210. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  211. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +1 -1
  212. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  213. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  214. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  215. package/build-types/custom-gradient-picker/serializer.d.ts +3 -3
  216. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  217. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  218. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  219. package/build-types/custom-select-control/index.d.ts.map +1 -1
  220. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  221. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  222. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  223. package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
  224. package/build-types/custom-select-control-v2/stories/index.story.d.ts +6 -6
  225. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  226. package/build-types/custom-select-control-v2/styles.d.ts +6 -6
  227. package/build-types/dashicon/index.d.ts.map +1 -1
  228. package/build-types/date-time/date-picker/index.d.ts +1 -1
  229. package/build-types/date-time/date-picker/index.d.ts.map +1 -1
  230. package/build-types/date-time/date-picker/styles.d.ts +9 -9
  231. package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -1
  232. package/build-types/date-time/date-time/index.d.ts +1 -1
  233. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  234. package/build-types/date-time/date-time/styles.d.ts +4 -4
  235. package/build-types/date-time/index.d.ts.map +1 -1
  236. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  237. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  238. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  239. package/build-types/date-time/time-picker/index.d.ts +1 -1
  240. package/build-types/date-time/time-picker/index.d.ts.map +1 -1
  241. package/build-types/date-time/time-picker/styles.d.ts +28 -28
  242. package/build-types/date-time/time-picker/time-input/index.d.ts +1 -1
  243. package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -1
  244. package/build-types/date-time/time-picker/timezone.d.ts.map +1 -1
  245. package/build-types/date-time/utils.d.ts.map +1 -1
  246. package/build-types/disabled/context.d.ts.map +1 -1
  247. package/build-types/disabled/index.d.ts +2 -0
  248. package/build-types/disabled/index.d.ts.map +1 -1
  249. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  250. package/build-types/disclosure/index.d.ts.map +1 -1
  251. package/build-types/divider/component.d.ts +2 -2
  252. package/build-types/divider/component.d.ts.map +1 -1
  253. package/build-types/divider/stories/index.story.d.ts.map +1 -1
  254. package/build-types/divider/styles.d.ts +2 -2
  255. package/build-types/draggable/index.d.ts +1 -1
  256. package/build-types/draggable/index.d.ts.map +1 -1
  257. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  258. package/build-types/drop-zone/index.d.ts.map +1 -1
  259. package/build-types/drop-zone/provider.d.ts +1 -1
  260. package/build-types/drop-zone/provider.d.ts.map +1 -1
  261. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  262. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  263. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  264. package/build-types/dropdown/index.d.ts.map +1 -1
  265. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  266. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  267. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  268. package/build-types/duotone-picker/color-list-picker/index.d.ts +1 -1
  269. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  270. package/build-types/duotone-picker/custom-duotone-bar.d.ts +1 -1
  271. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -1
  272. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  273. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -1
  274. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  275. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  276. package/build-types/elevation/component.d.ts.map +1 -1
  277. package/build-types/elevation/hook.d.ts +105 -105
  278. package/build-types/elevation/stories/index.story.d.ts.map +1 -1
  279. package/build-types/external-link/index.d.ts.map +1 -1
  280. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  281. package/build-types/flex/context.d.ts +2 -2
  282. package/build-types/flex/flex/component.d.ts.map +1 -1
  283. package/build-types/flex/flex/hook.d.ts +108 -108
  284. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  285. package/build-types/flex/flex-block/hook.d.ts +106 -106
  286. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  287. package/build-types/flex/flex-item/hook.d.ts +106 -106
  288. package/build-types/flex/stories/index.story.d.ts.map +1 -1
  289. package/build-types/focal-point-picker/controls.d.ts +1 -1
  290. package/build-types/focal-point-picker/controls.d.ts.map +1 -1
  291. package/build-types/focal-point-picker/index.d.ts +16 -11
  292. package/build-types/focal-point-picker/index.d.ts.map +1 -1
  293. package/build-types/focal-point-picker/stories/index.story.d.ts +16 -16
  294. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  295. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +254 -254
  296. package/build-types/focal-point-picker/utils.d.ts.map +1 -1
  297. package/build-types/font-size-picker/constants.d.ts +2 -2
  298. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  299. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  300. package/build-types/font-size-picker/index.d.ts.map +1 -1
  301. package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
  302. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  303. package/build-types/font-size-picker/styles.d.ts +5 -5
  304. package/build-types/form-file-upload/index.d.ts.map +1 -1
  305. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  306. package/build-types/form-toggle/index.d.ts +1 -1
  307. package/build-types/form-toggle/index.d.ts.map +1 -1
  308. package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
  309. package/build-types/form-token-field/index.d.ts.map +1 -1
  310. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  311. package/build-types/form-token-field/styles.d.ts +1 -1
  312. package/build-types/form-token-field/suggestions-list.d.ts +1 -1
  313. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  314. package/build-types/form-token-field/token-input.d.ts +1 -1
  315. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  316. package/build-types/form-token-field/token.d.ts +1 -1
  317. package/build-types/form-token-field/token.d.ts.map +1 -1
  318. package/build-types/gradient-picker/index.d.ts.map +1 -1
  319. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  320. package/build-types/grid/component.d.ts.map +1 -1
  321. package/build-types/grid/hook.d.ts +106 -106
  322. package/build-types/grid/stories/index.story.d.ts.map +1 -1
  323. package/build-types/grid/utils.d.ts.map +1 -1
  324. package/build-types/guide/index.d.ts +1 -1
  325. package/build-types/guide/index.d.ts.map +1 -1
  326. package/build-types/guide/page-control.d.ts +1 -1
  327. package/build-types/guide/page-control.d.ts.map +1 -1
  328. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  329. package/build-types/h-stack/component.d.ts +3 -3
  330. package/build-types/h-stack/component.d.ts.map +1 -1
  331. package/build-types/h-stack/hook.d.ts +107 -107
  332. package/build-types/h-stack/stories/e2e/index.story.d.ts.map +1 -1
  333. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  334. package/build-types/heading/component.d.ts +4 -4
  335. package/build-types/heading/component.d.ts.map +1 -1
  336. package/build-types/heading/hook.d.ts +107 -107
  337. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  338. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -1
  339. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  340. package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -1
  341. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -1
  342. package/build-types/higher-order/with-filters/index.d.ts +2 -2
  343. package/build-types/higher-order/with-focus-outside/index.d.ts.map +1 -1
  344. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -1
  345. package/build-types/higher-order/with-notices/index.d.ts +3 -3
  346. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  347. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  348. package/build-types/icon/index.d.ts.map +1 -1
  349. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  350. package/build-types/input-control/backdrop.d.ts.map +1 -1
  351. package/build-types/input-control/index.d.ts.map +1 -1
  352. package/build-types/input-control/input-base.d.ts.map +1 -1
  353. package/build-types/input-control/input-field.d.ts +1 -1
  354. package/build-types/input-control/input-field.d.ts.map +1 -1
  355. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  356. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  357. package/build-types/input-control/reducer/reducer.d.ts +9 -9
  358. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  359. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  360. package/build-types/input-control/styles/input-control-styles.d.ts +3 -3
  361. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  362. package/build-types/isolated-event-container/index.d.ts.map +1 -1
  363. package/build-types/item-group/item/component.d.ts.map +1 -1
  364. package/build-types/item-group/item/hook.d.ts +104 -104
  365. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  366. package/build-types/item-group/item-group/hook.d.ts +105 -105
  367. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  368. package/build-types/item-group/styles.d.ts +1 -1
  369. package/build-types/item-group/styles.d.ts.map +1 -1
  370. package/build-types/keyboard-shortcuts/index.d.ts +1 -1
  371. package/build-types/keyboard-shortcuts/index.d.ts.map +1 -1
  372. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  373. package/build-types/lock-unlock.d.ts +1 -2
  374. package/build-types/lock-unlock.d.ts.map +1 -1
  375. package/build-types/menu/group-label.d.ts +1 -1
  376. package/build-types/menu/group.d.ts +1 -1
  377. package/build-types/menu/index.d.ts +5 -5
  378. package/build-types/menu/index.d.ts.map +1 -1
  379. package/build-types/menu/item-help-text.d.ts +1 -1
  380. package/build-types/menu/item-label.d.ts +1 -1
  381. package/build-types/menu/separator.d.ts +1 -1
  382. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  383. package/build-types/menu/styles.d.ts +7 -7
  384. package/build-types/menu-group/index.d.ts.map +1 -1
  385. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  386. package/build-types/menu-item/index.d.ts +2 -2
  387. package/build-types/menu-item/index.d.ts.map +1 -1
  388. package/build-types/menu-item/stories/index.story.d.ts +8 -8
  389. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  390. package/build-types/menu-items-choice/index.d.ts +1 -1
  391. package/build-types/menu-items-choice/index.d.ts.map +1 -1
  392. package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
  393. package/build-types/mobile/image/constants.d.ts +4 -4
  394. package/build-types/mobile/image/constants.d.ts.map +1 -1
  395. package/build-types/modal/index.d.ts.map +1 -1
  396. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  397. package/build-types/modal/use-modal-exit-animation.d.ts +0 -3
  398. package/build-types/modal/use-modal-exit-animation.d.ts.map +1 -1
  399. package/build-types/navigable-container/container.d.ts +2 -2
  400. package/build-types/navigable-container/container.d.ts.map +1 -1
  401. package/build-types/navigable-container/menu.d.ts +1 -1
  402. package/build-types/navigable-container/menu.d.ts.map +1 -1
  403. package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
  404. package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
  405. package/build-types/navigable-container/tabbable.d.ts +2 -2
  406. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  407. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  408. package/build-types/navigation/group/index.d.ts +1 -1
  409. package/build-types/navigation/group/index.d.ts.map +1 -1
  410. package/build-types/navigation/index.d.ts +1 -1
  411. package/build-types/navigation/index.d.ts.map +1 -1
  412. package/build-types/navigation/item/index.d.ts.map +1 -1
  413. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -1
  414. package/build-types/navigation/menu/index.d.ts.map +1 -1
  415. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -1
  416. package/build-types/navigation/menu/menu-title.d.ts +1 -1
  417. package/build-types/navigation/menu/menu-title.d.ts.map +1 -1
  418. package/build-types/navigation/menu/search-no-results-found.d.ts +1 -1
  419. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -1
  420. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -1
  421. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  422. package/build-types/navigation/styles/navigation-styles.d.ts +6 -6
  423. package/build-types/navigation/utils.d.ts.map +1 -1
  424. package/build-types/navigator/index.d.ts +12 -12
  425. package/build-types/navigator/legacy.d.ts +18 -18
  426. package/build-types/navigator/navigator-back-button/component.d.ts +6 -6
  427. package/build-types/navigator/navigator-back-button/hook.d.ts +136 -136
  428. package/build-types/navigator/navigator-button/component.d.ts +6 -6
  429. package/build-types/navigator/navigator-button/hook.d.ts +136 -136
  430. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +1 -1
  431. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -1
  432. package/build-types/navigator/navigator-to-parent-button/component.d.ts +6 -6
  433. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  434. package/build-types/navigator/styles.d.ts.map +1 -1
  435. package/build-types/notice/index.d.ts +1 -1
  436. package/build-types/notice/index.d.ts.map +1 -1
  437. package/build-types/notice/list.d.ts +1 -1
  438. package/build-types/notice/list.d.ts.map +1 -1
  439. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  440. package/build-types/number-control/index.d.ts +7 -7
  441. package/build-types/number-control/index.d.ts.map +1 -1
  442. package/build-types/number-control/stories/index.story.d.ts +7 -7
  443. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  444. package/build-types/palette-edit/index.d.ts +1 -1
  445. package/build-types/palette-edit/index.d.ts.map +1 -1
  446. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  447. package/build-types/palette-edit/styles.d.ts +759 -759
  448. package/build-types/panel/body.d.ts.map +1 -1
  449. package/build-types/panel/header.d.ts.map +1 -1
  450. package/build-types/panel/index.d.ts.map +1 -1
  451. package/build-types/panel/row.d.ts.map +1 -1
  452. package/build-types/panel/stories/index.story.d.ts.map +1 -1
  453. package/build-types/placeholder/index.d.ts.map +1 -1
  454. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  455. package/build-types/popover/index.d.ts +1 -1
  456. package/build-types/popover/index.d.ts.map +1 -1
  457. package/build-types/popover/overlay-middlewares.d.ts +2 -2
  458. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  459. package/build-types/popover/stories/e2e/index.story.d.ts.map +1 -1
  460. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  461. package/build-types/popover/test/utils/index.d.ts.map +1 -1
  462. package/build-types/popover/utils.d.ts +3 -3
  463. package/build-types/popover/utils.d.ts.map +1 -1
  464. package/build-types/progress-bar/index.d.ts +1 -1
  465. package/build-types/progress-bar/index.d.ts.map +1 -1
  466. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  467. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  468. package/build-types/query-controls/author-select.d.ts +1 -1
  469. package/build-types/query-controls/author-select.d.ts.map +1 -1
  470. package/build-types/query-controls/index.d.ts.map +1 -1
  471. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  472. package/build-types/radio-control/index.d.ts.map +1 -1
  473. package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
  474. package/build-types/radio-group/index.d.ts.map +1 -1
  475. package/build-types/radio-group/radio.d.ts +1 -1
  476. package/build-types/radio-group/radio.d.ts.map +1 -1
  477. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  478. package/build-types/range-control/index.d.ts +8 -8
  479. package/build-types/range-control/index.d.ts.map +1 -1
  480. package/build-types/range-control/input-range.d.ts +1 -1
  481. package/build-types/range-control/input-range.d.ts.map +1 -1
  482. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  483. package/build-types/range-control/styles/range-control-styles.d.ts +9 -9
  484. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  485. package/build-types/range-control/utils.d.ts +1 -1
  486. package/build-types/range-control/utils.d.ts.map +1 -1
  487. package/build-types/resizable-box/index.d.ts.map +1 -1
  488. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  489. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  490. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -1
  491. package/build-types/resizable-box/resize-tooltip/utils.d.ts +3 -3
  492. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  493. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  494. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  495. package/build-types/responsive-wrapper/index.d.ts +1 -1
  496. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  497. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  498. package/build-types/sandbox/index.d.ts.map +1 -1
  499. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  500. package/build-types/scroll-lock/index.d.ts.map +1 -1
  501. package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
  502. package/build-types/scrollable/component.d.ts.map +1 -1
  503. package/build-types/scrollable/hook.d.ts +106 -106
  504. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  505. package/build-types/search-control/index.d.ts +9 -9
  506. package/build-types/search-control/index.d.ts.map +1 -1
  507. package/build-types/search-control/stories/index.story.d.ts +9 -9
  508. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  509. package/build-types/select-control/chevron-down.d.ts.map +1 -1
  510. package/build-types/select-control/index.d.ts +1 -1
  511. package/build-types/select-control/index.d.ts.map +1 -1
  512. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  513. package/build-types/select-control/styles/select-control-styles.d.ts +2 -2
  514. package/build-types/shortcut/index.d.ts.map +1 -1
  515. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  516. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  517. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  518. package/build-types/slot-fill/context.d.ts.map +1 -1
  519. package/build-types/slot-fill/index.d.ts +2 -2
  520. package/build-types/slot-fill/index.d.ts.map +1 -1
  521. package/build-types/slot-fill/provider.d.ts.map +1 -1
  522. package/build-types/slot-fill/slot.d.ts.map +1 -1
  523. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  524. package/build-types/snackbar/index.d.ts +3 -3
  525. package/build-types/snackbar/index.d.ts.map +1 -1
  526. package/build-types/snackbar/list.d.ts +1 -1
  527. package/build-types/snackbar/list.d.ts.map +1 -1
  528. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  529. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  530. package/build-types/spacer/component.d.ts.map +1 -1
  531. package/build-types/spacer/hook.d.ts +106 -106
  532. package/build-types/spacer/stories/index.story.d.ts.map +1 -1
  533. package/build-types/spinner/index.d.ts.map +1 -1
  534. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  535. package/build-types/style-provider/index.d.ts +0 -3
  536. package/build-types/style-provider/index.d.ts.map +1 -1
  537. package/build-types/style-provider/test/index.d.ts +2 -0
  538. package/build-types/style-provider/test/index.d.ts.map +1 -0
  539. package/build-types/surface/component.d.ts.map +1 -1
  540. package/build-types/surface/hook.d.ts +106 -106
  541. package/build-types/surface/stories/index.story.d.ts.map +1 -1
  542. package/build-types/surface/styles.d.ts +1 -1
  543. package/build-types/surface/styles.d.ts.map +1 -1
  544. package/build-types/tab-panel/index.d.ts.map +1 -1
  545. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  546. package/build-types/tabs/index.d.ts +1 -1
  547. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  548. package/build-types/tabs/styles.d.ts +3 -3
  549. package/build-types/tabs/tablist.d.ts +1 -1
  550. package/build-types/text/component.d.ts.map +1 -1
  551. package/build-types/text/hook.d.ts +106 -106
  552. package/build-types/text/stories/index.story.d.ts +3 -3
  553. package/build-types/text/stories/index.story.d.ts.map +1 -1
  554. package/build-types/text/utils.d.ts +1 -1
  555. package/build-types/text/utils.d.ts.map +1 -1
  556. package/build-types/text-control/index.d.ts +3 -3
  557. package/build-types/text-control/index.d.ts.map +1 -1
  558. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  559. package/build-types/text-highlight/index.d.ts +4 -19
  560. package/build-types/text-highlight/index.d.ts.map +1 -1
  561. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  562. package/build-types/textarea-control/index.d.ts +3 -3
  563. package/build-types/textarea-control/index.d.ts.map +1 -1
  564. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  565. package/build-types/theme/color-algorithms.d.ts +1 -1
  566. package/build-types/theme/color-algorithms.d.ts.map +1 -1
  567. package/build-types/theme/index.d.ts.map +1 -1
  568. package/build-types/theme/stories/index.story.d.ts +1 -1
  569. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  570. package/build-types/theme/styles.d.ts.map +1 -1
  571. package/build-types/tip/index.d.ts.map +1 -1
  572. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  573. package/build-types/toggle-control/index.d.ts +2 -2
  574. package/build-types/toggle-control/index.d.ts.map +1 -1
  575. package/build-types/toggle-control/stories/index.story.d.ts +4 -4
  576. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  577. package/build-types/toggle-group-control/context.d.ts.map +1 -1
  578. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  579. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
  580. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
  581. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
  582. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  583. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +3 -3
  584. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  585. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -2
  586. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  587. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
  588. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  589. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -1
  590. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  591. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  592. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  593. package/build-types/toolbar/index.d.ts +6 -6
  594. package/build-types/toolbar/index.d.ts.map +1 -1
  595. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  596. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  597. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
  598. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  599. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  600. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  601. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -1
  602. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
  603. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
  604. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +1 -1
  605. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
  606. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  607. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  608. package/build-types/tools-panel/styles.d.ts.map +1 -1
  609. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  610. package/build-types/tools-panel/tools-panel/hook.d.ts +128 -128
  611. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  612. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  613. package/build-types/tools-panel/tools-panel-header/hook.d.ts +116 -116
  614. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  615. package/build-types/tools-panel/tools-panel-item/hook.d.ts +108 -108
  616. package/build-types/tooltip/index.d.ts.map +1 -1
  617. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  618. package/build-types/tree-grid/cell.d.ts.map +1 -1
  619. package/build-types/tree-grid/index.d.ts.map +1 -1
  620. package/build-types/tree-grid/item.d.ts.map +1 -1
  621. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
  622. package/build-types/tree-grid/roving-tab-index.d.ts +1 -1
  623. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -1
  624. package/build-types/tree-grid/row.d.ts.map +1 -1
  625. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  626. package/build-types/tree-select/index.d.ts.map +1 -1
  627. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  628. package/build-types/truncate/component.d.ts.map +1 -1
  629. package/build-types/truncate/hook.d.ts +106 -106
  630. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  631. package/build-types/truncate/utils.d.ts +5 -5
  632. package/build-types/truncate/utils.d.ts.map +1 -1
  633. package/build-types/unit-control/index.d.ts +2 -2
  634. package/build-types/unit-control/index.d.ts.map +1 -1
  635. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  636. package/build-types/unit-control/styles/unit-control-styles.d.ts +7 -7
  637. package/build-types/unit-control/unit-select-control.d.ts +1 -1
  638. package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
  639. package/build-types/unit-control/utils.d.ts.map +1 -1
  640. package/build-types/utils/breakpoint-values.d.ts.map +1 -1
  641. package/build-types/utils/breakpoint.d.ts +8 -1
  642. package/build-types/utils/breakpoint.d.ts.map +1 -1
  643. package/build-types/utils/colors-values.d.ts +1 -1
  644. package/build-types/utils/colors-values.d.ts.map +1 -1
  645. package/build-types/utils/colors.d.ts +3 -3
  646. package/build-types/utils/colors.d.ts.map +1 -1
  647. package/build-types/utils/deprecated-36px-size.d.ts +1 -1
  648. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
  649. package/build-types/utils/dropdown-motion.d.ts +3 -3
  650. package/build-types/utils/dropdown-motion.d.ts.map +1 -1
  651. package/build-types/utils/font-values.d.ts.map +1 -1
  652. package/build-types/utils/font.d.ts +5 -2
  653. package/build-types/utils/font.d.ts.map +1 -1
  654. package/build-types/utils/get-node-text.d.ts.map +1 -1
  655. package/build-types/utils/hooks/index.d.ts +4 -4
  656. package/build-types/utils/hooks/index.d.ts.map +1 -1
  657. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +1 -1
  658. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
  659. package/build-types/utils/hooks/use-controlled-state.d.ts +2 -8
  660. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  661. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  662. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  663. package/build-types/utils/hooks/use-update-effect.d.ts +1 -1
  664. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  665. package/build-types/utils/index.d.ts +2 -2
  666. package/build-types/utils/index.d.ts.map +1 -1
  667. package/build-types/utils/math.d.ts +5 -5
  668. package/build-types/utils/math.d.ts.map +1 -1
  669. package/build-types/utils/rtl.d.ts +11 -16
  670. package/build-types/utils/rtl.d.ts.map +1 -1
  671. package/build-types/utils/strings.d.ts.map +1 -1
  672. package/build-types/utils/style-mixins.d.ts +9 -9
  673. package/build-types/utils/style-mixins.d.ts.map +1 -1
  674. package/build-types/utils/use-responsive-value.d.ts.map +1 -1
  675. package/build-types/utils/values.d.ts +19 -5
  676. package/build-types/utils/values.d.ts.map +1 -1
  677. package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -1
  678. package/build-types/v-stack/component.d.ts +3 -3
  679. package/build-types/v-stack/component.d.ts.map +1 -1
  680. package/build-types/v-stack/hook.d.ts +107 -107
  681. package/build-types/v-stack/stories/e2e/index.story.d.ts.map +1 -1
  682. package/build-types/v-stack/stories/index.story.d.ts +4 -4
  683. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  684. package/build-types/validated-form-controls/components/checkbox-control.d.ts +2 -2
  685. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  686. package/build-types/validated-form-controls/components/number-control.d.ts +7 -7
  687. package/build-types/validated-form-controls/components/radio-control.d.ts +2 -2
  688. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
  689. package/build-types/validated-form-controls/components/range-control.d.ts +8 -8
  690. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  691. package/build-types/validated-form-controls/components/select-control.d.ts +1 -1
  692. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
  693. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
  694. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
  695. package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -1
  696. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
  697. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
  698. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  699. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
  700. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
  701. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
  702. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
  703. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
  704. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
  705. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
  706. package/build-types/validated-form-controls/components/text-control.d.ts +3 -3
  707. package/build-types/validated-form-controls/components/textarea-control.d.ts +3 -3
  708. package/build-types/validated-form-controls/components/toggle-control.d.ts +2 -2
  709. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +3 -3
  710. package/build-types/validated-form-controls/control-with-error.d.ts +1 -1
  711. package/build-types/validated-form-controls/validity-indicator.d.ts +1 -1
  712. package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
  713. package/build-types/view/component.d.ts +251 -251
  714. package/build-types/view/component.d.ts.map +1 -1
  715. package/build-types/view/stories/index.story.d.ts.map +1 -1
  716. package/build-types/visually-hidden/component.d.ts.map +1 -1
  717. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
  718. package/build-types/z-stack/component.d.ts.map +1 -1
  719. package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
  720. package/package.json +24 -23
  721. package/src/alignment-matrix-control/stories/index.story.tsx +1 -1
  722. package/src/angle-picker-control/stories/index.story.tsx +1 -1
  723. package/src/autocomplete/autocompleter-ui.tsx +0 -1
  724. package/src/base-control/stories/index.story.tsx +1 -1
  725. package/src/border-box-control/stories/index.story.tsx +1 -1
  726. package/src/border-control/stories/index.story.tsx +1 -1
  727. package/src/button/stories/index.story.tsx +1 -1
  728. package/src/button/style.scss +2 -0
  729. package/src/checkbox-control/stories/index.story.tsx +1 -1
  730. package/src/color-indicator/stories/index.story.tsx +1 -1
  731. package/src/color-palette/index.tsx +25 -9
  732. package/src/color-palette/stories/index.story.tsx +21 -3
  733. package/src/color-palette/test/index.tsx +152 -1
  734. package/src/color-palette/test/utils.ts +18 -0
  735. package/src/color-palette/types.ts +19 -2
  736. package/src/color-palette/utils.ts +14 -2
  737. package/src/color-picker/hex-input.tsx +1 -1
  738. package/src/color-picker/stories/index.story.tsx +1 -1
  739. package/src/color-picker/test/index.tsx +24 -2
  740. package/src/combobox-control/stories/index.story.tsx +1 -1
  741. package/src/composite/legacy/test/index.tsx +13 -13
  742. package/src/composite/stories/index.story.tsx +1 -1
  743. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  744. package/src/custom-gradient-picker/index.tsx +0 -1
  745. package/src/custom-select-control/stories/index.story.tsx +1 -1
  746. package/src/disabled/stories/index.story.tsx +1 -1
  747. package/src/drop-zone/stories/index.story.tsx +1 -1
  748. package/src/dropdown/stories/index.story.tsx +1 -1
  749. package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
  750. package/src/duotone-picker/stories/duotone-swatch.story.tsx +1 -1
  751. package/src/external-link/style.scss +4 -0
  752. package/src/focal-point-picker/README.md +12 -8
  753. package/src/focal-point-picker/index.tsx +16 -11
  754. package/src/focal-point-picker/stories/index.story.tsx +1 -1
  755. package/src/font-size-picker/stories/index.story.tsx +1 -1
  756. package/src/form-file-upload/stories/index.story.tsx +1 -1
  757. package/src/form-toggle/stories/index.story.tsx +1 -1
  758. package/src/form-token-field/stories/index.story.tsx +1 -1
  759. package/src/gradient-picker/stories/index.story.tsx +1 -1
  760. package/src/guide/stories/index.story.tsx +1 -1
  761. package/src/higher-order/with-notices/test/index.tsx +12 -10
  762. package/src/icon/stories/index.story.tsx +1 -1
  763. package/src/input-control/stories/index.story.tsx +1 -1
  764. package/src/item-group/stories/index.story.tsx +1 -1
  765. package/src/keyboard-shortcuts/stories/index.story.tsx +1 -1
  766. package/src/menu/stories/index.story.tsx +1 -1
  767. package/src/menu/test/index.tsx +4 -3
  768. package/src/menu-group/stories/index.story.tsx +1 -1
  769. package/src/menu-item/stories/index.story.tsx +1 -1
  770. package/src/menu-items-choice/stories/index.story.tsx +1 -1
  771. package/src/modal/index.tsx +2 -7
  772. package/src/modal/stories/index.story.tsx +1 -1
  773. package/src/modal/style.scss +68 -24
  774. package/src/modal/use-modal-exit-animation.ts +10 -7
  775. package/src/navigator/stories/index.story.tsx +1 -1
  776. package/src/notice/stories/index.story.tsx +1 -1
  777. package/src/number-control/stories/index.story.tsx +1 -1
  778. package/src/palette-edit/index.tsx +0 -1
  779. package/src/palette-edit/stories/index.story.tsx +1 -1
  780. package/src/panel/stories/index.story.tsx +1 -1
  781. package/src/placeholder/stories/index.story.tsx +1 -1
  782. package/src/popover/stories/index.story.tsx +1 -1
  783. package/src/popover/style.scss +0 -4
  784. package/src/progress-bar/stories/index.story.tsx +1 -1
  785. package/src/query-controls/stories/index.story.tsx +1 -1
  786. package/src/radio-control/stories/index.story.tsx +1 -1
  787. package/src/range-control/stories/index.story.tsx +1 -1
  788. package/src/resizable-box/stories/index.story.tsx +1 -1
  789. package/src/sandbox/stories/index.story.tsx +1 -1
  790. package/src/scroll-lock/stories/index.story.tsx +1 -1
  791. package/src/search-control/stories/index.story.tsx +1 -1
  792. package/src/select-control/stories/index.story.tsx +1 -1
  793. package/src/shortcut/stories/index.story.tsx +1 -1
  794. package/src/slot-fill/fill.tsx +2 -2
  795. package/src/slot-fill/stories/index.story.tsx +1 -1
  796. package/src/snackbar/stories/index.story.tsx +1 -1
  797. package/src/spinner/stories/index.story.tsx +1 -1
  798. package/src/style-provider/index.tsx +10 -7
  799. package/src/style-provider/test/index.tsx +38 -0
  800. package/src/tab-panel/style.scss +2 -2
  801. package/src/tabs/stories/index.story.tsx +1 -1
  802. package/src/text/styles.ts +1 -1
  803. package/src/text/test/index.tsx +1 -1
  804. package/src/text-control/stories/index.story.tsx +1 -1
  805. package/src/text-highlight/stories/index.story.tsx +1 -1
  806. package/src/textarea-control/stories/index.story.tsx +1 -1
  807. package/src/toggle-control/stories/index.story.tsx +1 -1
  808. package/src/toggle-group-control/stories/index.story.tsx +1 -1
  809. package/src/toolbar/stories/index.story.tsx +1 -1
  810. package/src/tools-panel/stories/index.story.tsx +1 -1
  811. package/src/tooltip/stories/index.story.tsx +1 -1
  812. package/src/tree-grid/stories/index.story.tsx +1 -1
  813. package/src/tree-select/stories/index.story.tsx +1 -1
  814. package/src/truncate/stories/index.story.tsx +1 -1
  815. package/src/unit-control/stories/index.story.tsx +1 -1
  816. package/src/utils/config-values.js +3 -0
  817. package/src/utils/dropdown-motion.ts +6 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/color-palette/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker, { getComputeCircularOptionPickerCommonProps } from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport { extractColorNameFromCurrentValue, isMultiplePaletteArray, normalizeColorValue } from './utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nextend([namesPlugin, a11yPlugin]);\nfunction SinglePalette({\n className,\n clearColor,\n colors,\n onChange,\n value,\n ...additionalProps\n}) {\n const colorOptions = useMemo(() => {\n return colors.map(({\n color,\n name\n }, index) => {\n const colordColor = colord(color);\n const isSelected = value === color;\n return /*#__PURE__*/_jsx(CircularOptionPicker.Option, {\n isSelected: isSelected,\n selectedIconProps: isSelected ? {\n fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'\n } : {},\n tooltipText: name ||\n // translators: %s: color hex code e.g: \"#f00\".\n sprintf(__('Color code: %s'), color),\n style: {\n backgroundColor: color,\n color\n },\n onClick: isSelected ? clearColor : () => onChange(color, index)\n }, `${color}-${index}`);\n });\n }, [colors, value, onChange, clearColor]);\n return /*#__PURE__*/_jsx(CircularOptionPicker.OptionGroup, {\n className: className,\n options: colorOptions,\n ...additionalProps\n });\n}\nfunction MultiplePalettes({\n className,\n clearColor,\n colors,\n onChange,\n value,\n headingLevel\n}) {\n const instanceId = useInstanceId(MultiplePalettes, 'color-palette');\n if (colors.length === 0) {\n return null;\n }\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n className: className,\n children: colors.map(({\n name,\n colors: colorPalette\n }, index) => {\n const id = `${instanceId}-${index}`;\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 2,\n children: [/*#__PURE__*/_jsx(ColorHeading, {\n id: id,\n level: headingLevel,\n children: name\n }), /*#__PURE__*/_jsx(SinglePalette, {\n clearColor: clearColor,\n colors: colorPalette,\n onChange: newColor => onChange(newColor, index),\n value: value,\n \"aria-labelledby\": id\n })]\n }, index);\n })\n });\n}\nexport function CustomColorPickerDropdown({\n isRenderedInSidebar,\n popoverProps: receivedPopoverProps,\n ...props\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\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 ...(isRenderedInSidebar ? {\n // When in the sidebar: open to the left (stacking),\n // leaving the same gap as the parent popover.\n placement: 'left-start',\n offset: 34\n } : {\n // Default behavior: open below the anchor\n placement: 'bottom',\n offset: 8\n }),\n ...receivedPopoverProps\n }), [isRenderedInSidebar, receivedPopoverProps]);\n return /*#__PURE__*/_jsx(Dropdown, {\n contentClassName: \"components-color-palette__custom-color-dropdown-content\",\n popoverProps: popoverProps,\n ...props\n });\n}\nfunction UnforwardedColorPalette(props, forwardedRef) {\n const {\n asButtons,\n loop,\n clearable = true,\n colors = [],\n disableCustomColors = false,\n enableAlpha = false,\n onChange,\n value,\n __experimentalIsRenderedInSidebar = false,\n headingLevel = 2,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...additionalProps\n } = props;\n const [normalizedColorValue, setNormalizedColorValue] = useState(value);\n const clearColor = useCallback(() => onChange(undefined), [onChange]);\n const customColorPaletteCallbackRef = useCallback(node => {\n setNormalizedColorValue(normalizeColorValue(value, node));\n }, [value]);\n const hasMultipleColorOrigins = isMultiplePaletteArray(colors);\n const buttonLabelName = useMemo(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins), [value, colors, hasMultipleColorOrigins]);\n const renderCustomColorPicker = () => /*#__PURE__*/_jsx(DropdownContentWrapper, {\n paddingSize: \"none\",\n children: /*#__PURE__*/_jsx(ColorPicker, {\n color: normalizedColorValue,\n onChange: color => onChange(color),\n enableAlpha: enableAlpha\n })\n });\n const isHex = value?.startsWith('#');\n\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n const displayValue = value?.replace(/^var\\((.+)\\)$/, '$1');\n const customColorAccessibleLabel = !!displayValue ? sprintf(\n // translators: 1: The name of the color e.g: \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), buttonLabelName, displayValue) : __('Custom color picker');\n const paletteCommonProps = {\n clearColor,\n onChange,\n value\n };\n const actions = !!clearable && /*#__PURE__*/_jsx(CircularOptionPicker.ButtonAction, {\n onClick: clearColor,\n accessibleWhenDisabled: true,\n disabled: !value,\n children: __('Clear')\n });\n const {\n metaProps,\n labelProps\n } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby);\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 3,\n ref: forwardedRef,\n ...additionalProps,\n children: [!disableCustomColors && /*#__PURE__*/_jsx(CustomColorPickerDropdown, {\n isRenderedInSidebar: __experimentalIsRenderedInSidebar,\n renderContent: renderCustomColorPicker,\n renderToggle: ({\n isOpen,\n onToggle\n }) => /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-wrapper\",\n spacing: 0,\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: customColorPaletteCallbackRef,\n className: \"components-color-palette__custom-color-button\",\n \"aria-expanded\": isOpen,\n \"aria-haspopup\": \"true\",\n onClick: onToggle,\n \"aria-label\": customColorAccessibleLabel,\n style: {\n background: value\n },\n type: \"button\"\n }), /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-text-wrapper\",\n spacing: 0.5,\n children: [/*#__PURE__*/_jsx(Truncate, {\n className: \"components-color-palette__custom-color-name\",\n children: value ? buttonLabelName : __('No color selected')\n }), /*#__PURE__*/_jsx(Truncate, {\n className: clsx('components-color-palette__custom-color-value', {\n 'components-color-palette__custom-color-value--is-hex': isHex\n }),\n children: displayValue\n })]\n })]\n })\n }), (colors.length > 0 || actions) && /*#__PURE__*/_jsx(CircularOptionPicker, {\n ...metaProps,\n ...labelProps,\n actions: actions,\n options: hasMultipleColorOrigins ? /*#__PURE__*/_jsx(MultiplePalettes, {\n ...paletteCommonProps,\n headingLevel: headingLevel,\n colors: colors,\n value: value\n }) : /*#__PURE__*/_jsx(SinglePalette, {\n ...paletteCommonProps,\n colors: colors,\n value: value\n })\n })]\n });\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef(UnforwardedColorPalette);\nColorPalette.displayName = 'ColorPalette';\nexport default ColorPalette;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAA+B;AAC/B,mBAAwB;AACxB,kBAAuB;AACvB,kBAAiB;AAKjB,qBAA8B;AAC9B,kBAA4B;AAC5B,qBAA2D;AAK3D,sBAAqB;AACrB,0BAA4B;AAC5B,oCAAgF;AAChF,qBAAuB;AACvB,sBAAyB;AACzB,oBAA6B;AAC7B,sCAAmC;AACnC,mBAA8F;AAC9F,yBAA2C;AAAA,IAC3C,sBAAO,CAAC,aAAAA,SAAa,YAAAC,OAAU,CAAC;AAChC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,mBAAe,wBAAQ,MAAM;AACjC,WAAO,OAAO,IAAI,CAAC;AAAA,MACjB;AAAA,MACA;AAAA,IACF,GAAG,UAAU;AACX,YAAM,kBAAc,sBAAO,KAAK;AAChC,YAAM,aAAa,UAAU;AAC7B,aAAoB,uCAAAC,KAAK,8BAAAC,QAAqB,QAAQ;AAAA,QACpD;AAAA,QACA,mBAAmB,aAAa;AAAA,UAC9B,MAAM,YAAY,SAAS,IAAI,YAAY,SAAS,MAAM,IAAI,SAAS;AAAA,QACzE,IAAI,CAAC;AAAA,QACL,aAAa;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AF,KAAK,0BAAU;AAAA,YACrC,WAAW;AAAA,YACX,UAAU,QAAQ,sBAAkB,gBAAG,mBAAmB;AAAA,UAC5D,CAAC,GAAgB,uCAAAA,KAAK,0BAAU;AAAA,YAC9B,eAAW,YAAAK,SAAK,gDAAgD;AAAA,cAC9D,wDAAwD;AAAA,YAC1D,CAAC;AAAA,YACD,UAAU;AAAA,UACZ,CAAC,CAAC;AAAA,QACJ,CAAC,CAAC;AAAA,MACJ,CAAC;AAAA,IACH,CAAC,IAAI,OAAO,SAAS,KAAK,YAAyB,uCAAAL,KAAK,8BAAAC,SAAsB;AAAA,MAC5E,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,MACA,SAAS,0BAAuC,uCAAAD,KAAK,kBAAkB;AAAA,QACrE,GAAG;AAAA,QACH;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,IAAiB,uCAAAA,KAAK,eAAe;AAAA,QACpC,GAAG;AAAA,QACH;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AA0BO,IAAM,mBAAe,2BAAW,uBAAuB;AAC9D,aAAa,cAAc;AAC3B,IAAO,wBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker, { getComputeCircularOptionPickerCommonProps } from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport { extractColorNameFromCurrentValue, isMultiplePaletteArray, normalizeColorValue } from './utils';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nextend([namesPlugin, a11yPlugin]);\nfunction SinglePalette({\n className,\n clearColor,\n colors,\n onChange,\n value,\n selectedSlug,\n ...additionalProps\n}) {\n const colorOptions = useMemo(() => {\n return colors.map(({\n color,\n name,\n slug\n }, index) => {\n const colordColor = colord(color);\n // When a non-empty selectedSlug is provided, selection is decided\n // strictly by slug \u2014 entries without a slug or with a different slug\n // are not selected, even when their color value matches `value`.\n // This correctly handles mixed palettes where some entries have slugs\n // and others don't. Fall back to color value matching otherwise\n // (including when selectedSlug is an empty string).\n const isSelected = selectedSlug ? slug === selectedSlug : value === color;\n return /*#__PURE__*/_jsx(CircularOptionPicker.Option, {\n isSelected: isSelected,\n selectedIconProps: isSelected ? {\n fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'\n } : {},\n tooltipText: name ||\n // translators: %s: color hex code e.g: \"#f00\".\n sprintf(__('Color code: %s'), color),\n style: {\n backgroundColor: color,\n color\n },\n onClick: isSelected ? clearColor : () => onChange(color, index, slug)\n }, slug ?? `${color}-${index}`);\n });\n }, [colors, value, selectedSlug, onChange, clearColor]);\n return /*#__PURE__*/_jsx(CircularOptionPicker.OptionGroup, {\n className: className,\n options: colorOptions,\n ...additionalProps\n });\n}\nfunction MultiplePalettes({\n className,\n clearColor,\n colors,\n onChange,\n value,\n selectedSlug,\n headingLevel\n}) {\n const instanceId = useInstanceId(MultiplePalettes, 'color-palette');\n if (colors.length === 0) {\n return null;\n }\n return /*#__PURE__*/_jsx(VStack, {\n spacing: 3,\n className: className,\n children: colors.map(({\n name,\n colors: colorPalette\n }, index) => {\n const id = `${instanceId}-${index}`;\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 2,\n children: [/*#__PURE__*/_jsx(ColorHeading, {\n id: id,\n level: headingLevel,\n children: name\n }), /*#__PURE__*/_jsx(SinglePalette, {\n clearColor: clearColor,\n colors: colorPalette,\n onChange: (newColor, _colorIndex, slug) => onChange(newColor, index, slug),\n value: value,\n selectedSlug: selectedSlug,\n \"aria-labelledby\": id\n })]\n }, index);\n })\n });\n}\nexport function CustomColorPickerDropdown({\n isRenderedInSidebar,\n popoverProps: receivedPopoverProps,\n ...props\n}) {\n const popoverProps = useMemo(() => ({\n shift: true,\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 ...(isRenderedInSidebar ? {\n // When in the sidebar: open to the left (stacking),\n // leaving the same gap as the parent popover.\n placement: 'left-start',\n offset: 34\n } : {\n // Default behavior: open below the anchor\n placement: 'bottom',\n offset: 8\n }),\n ...receivedPopoverProps\n }), [isRenderedInSidebar, receivedPopoverProps]);\n return /*#__PURE__*/_jsx(Dropdown, {\n contentClassName: \"components-color-palette__custom-color-dropdown-content\",\n popoverProps: popoverProps,\n ...props\n });\n}\nfunction UnforwardedColorPalette(props, forwardedRef) {\n const {\n asButtons,\n loop,\n clearable = true,\n colors = [],\n disableCustomColors = false,\n enableAlpha = false,\n onChange,\n value,\n selectedSlug,\n __experimentalIsRenderedInSidebar = false,\n headingLevel = 2,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...additionalProps\n } = props;\n const [normalizedColorValue, setNormalizedColorValue] = useState(value);\n const clearColor = useCallback(() => onChange(undefined), [onChange]);\n const customColorPaletteCallbackRef = useCallback(node => {\n setNormalizedColorValue(normalizeColorValue(value, node));\n }, [value]);\n const hasMultipleColorOrigins = isMultiplePaletteArray(colors);\n const buttonLabelName = useMemo(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins, selectedSlug), [value, colors, hasMultipleColorOrigins, selectedSlug]);\n const renderCustomColorPicker = () => /*#__PURE__*/_jsx(DropdownContentWrapper, {\n paddingSize: \"none\",\n children: /*#__PURE__*/_jsx(ColorPicker, {\n color: normalizedColorValue,\n onChange: color => onChange(color),\n enableAlpha: enableAlpha\n })\n });\n const isHex = value?.startsWith('#');\n\n // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n const displayValue = value?.replace(/^var\\((.+)\\)$/, '$1');\n const customColorAccessibleLabel = !!displayValue ? sprintf(\n // translators: 1: The name of the color e.g: \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n __('Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'), buttonLabelName, displayValue) : __('Custom color picker');\n const paletteCommonProps = {\n clearColor,\n onChange,\n value,\n selectedSlug\n };\n const actions = !!clearable && /*#__PURE__*/_jsx(CircularOptionPicker.ButtonAction, {\n onClick: clearColor,\n accessibleWhenDisabled: true,\n disabled: !value,\n children: __('Clear')\n });\n const {\n metaProps,\n labelProps\n } = getComputeCircularOptionPickerCommonProps(asButtons, loop, ariaLabel, ariaLabelledby);\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 3,\n ref: forwardedRef,\n ...additionalProps,\n children: [!disableCustomColors && /*#__PURE__*/_jsx(CustomColorPickerDropdown, {\n isRenderedInSidebar: __experimentalIsRenderedInSidebar,\n renderContent: renderCustomColorPicker,\n renderToggle: ({\n isOpen,\n onToggle\n }) => /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-wrapper\",\n spacing: 0,\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: customColorPaletteCallbackRef,\n className: \"components-color-palette__custom-color-button\",\n \"aria-expanded\": isOpen,\n \"aria-haspopup\": \"true\",\n onClick: onToggle,\n \"aria-label\": customColorAccessibleLabel,\n style: {\n background: value\n },\n type: \"button\"\n }), /*#__PURE__*/_jsxs(VStack, {\n className: \"components-color-palette__custom-color-text-wrapper\",\n spacing: 0.5,\n children: [/*#__PURE__*/_jsx(Truncate, {\n className: \"components-color-palette__custom-color-name\",\n children: value ? buttonLabelName : __('No color selected')\n }), /*#__PURE__*/_jsx(Truncate, {\n className: clsx('components-color-palette__custom-color-value', {\n 'components-color-palette__custom-color-value--is-hex': isHex\n }),\n children: displayValue\n })]\n })]\n })\n }), (colors.length > 0 || actions) && /*#__PURE__*/_jsx(CircularOptionPicker, {\n ...metaProps,\n ...labelProps,\n actions: actions,\n options: hasMultipleColorOrigins ? /*#__PURE__*/_jsx(MultiplePalettes, {\n ...paletteCommonProps,\n headingLevel: headingLevel,\n colors: colors,\n value: value\n }) : /*#__PURE__*/_jsx(SinglePalette, {\n ...paletteCommonProps,\n colors: colors,\n value: value\n })\n })]\n });\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef(UnforwardedColorPalette);\nColorPalette.displayName = 'ColorPalette';\nexport default ColorPalette;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAA+B;AAC/B,mBAAwB;AACxB,kBAAuB;AACvB,kBAAiB;AAKjB,qBAA8B;AAC9B,kBAA4B;AAC5B,qBAA2D;AAK3D,sBAAqB;AACrB,0BAA4B;AAC5B,oCAAgF;AAChF,qBAAuB;AACvB,sBAAyB;AACzB,oBAA6B;AAC7B,sCAAmC;AACnC,mBAA8F;AAC9F,yBAA2C;AAAA,IAC3C,sBAAO,CAAC,aAAAA,SAAa,YAAAC,OAAU,CAAC;AAChC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,mBAAe,wBAAQ,MAAM;AACjC,WA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ircularOptionPicker", "_jsxs", "Dropdown", "DropdownContentWrapper", "clsx"]
7
7
  }
@@ -46,7 +46,7 @@ var isSimpleCSSColor = (value) => {
46
46
  const valueIsColorMix = /color-mix\(/.test(value ?? "");
47
47
  return !valueIsCssVariable && !valueIsColorMix;
48
48
  };
49
- var extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false) => {
49
+ var extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false, selectedSlug) => {
50
50
  if (!currentValue) {
51
51
  return "";
52
52
  }
@@ -60,8 +60,15 @@ var extractColorNameFromCurrentValue = (currentValue, colors = [], showMultipleP
60
60
  } of colorPalettes) {
61
61
  for (const {
62
62
  name: colorName,
63
- color: colorValue
63
+ color: colorValue,
64
+ slug
64
65
  } of paletteColors) {
66
+ if (selectedSlug) {
67
+ if (slug === selectedSlug) {
68
+ return colorName;
69
+ }
70
+ continue;
71
+ }
65
72
  const normalizedColorValue = currentValueIsSimpleColor ? (0, import_colord.colord)(colorValue).toHex() : colorValue;
66
73
  if (normalizedCurrentValue === normalizedColorValue) {
67
74
  return colorName;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/color-palette/utils.ts"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nextend([namesPlugin, a11yPlugin]);\n\n/**\n * Checks if a color value is a simple CSS color.\n *\n * @param value The color value to check.\n * @return A boolean indicating whether the color value is a simple CSS color.\n */\nconst isSimpleCSSColor = value => {\n const valueIsCssVariable = /var\\(/.test(value ?? '');\n const valueIsColorMix = /color-mix\\(/.test(value ?? '');\n return !valueIsCssVariable && !valueIsColorMix;\n};\nexport const extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false) => {\n if (!currentValue) {\n return '';\n }\n const currentValueIsSimpleColor = currentValue ? isSimpleCSSColor(currentValue) : false;\n const normalizedCurrentValue = currentValueIsSimpleColor ? colord(currentValue).toHex() : currentValue;\n\n // Normalize format of `colors` to simplify the following loop\n\n const colorPalettes = showMultiplePalettes ? colors : [{\n colors: colors\n }];\n for (const {\n colors: paletteColors\n } of colorPalettes) {\n for (const {\n name: colorName,\n color: colorValue\n } of paletteColors) {\n const normalizedColorValue = currentValueIsSimpleColor ? colord(colorValue).toHex() : colorValue;\n if (normalizedCurrentValue === normalizedColorValue) {\n return colorName;\n }\n }\n }\n\n // translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n return __('Custom');\n};\n\n// The PaletteObject type has a `colors` property (an array of ColorObject),\n// while the ColorObject type has a `color` property (the CSS color value).\nexport const isMultiplePaletteObject = obj => Array.isArray(obj.colors) && !('color' in obj);\nexport const isMultiplePaletteArray = arr => {\n return arr.length > 0 && arr.every(colorObj => isMultiplePaletteObject(colorObj));\n};\n\n/**\n * Transform a CSS variable used as background color into the color value itself.\n *\n * @param value The color value that may be a CSS variable.\n * @param element The element for which to get the computed style.\n * @return The background color value computed from a element.\n */\nexport const normalizeColorValue = (value, element) => {\n if (!value || !element || isSimpleCSSColor(value)) {\n return value;\n }\n const {\n ownerDocument\n } = element;\n const {\n defaultView\n } = ownerDocument;\n const computedBackgroundColor = defaultView?.getComputedStyle(element).backgroundColor;\n return computedBackgroundColor ? colord(computedBackgroundColor).toHex() : value;\n};"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA+B;AAC/B,mBAAwB;AACxB,kBAAuB;AAKvB,kBAAmB;AAAA,IAMnB,sBAAO,CAAC,aAAAA,SAAa,YAAAC,OAAU,CAAC;AAQhC,IAAM,mBAAmB,WAAS;AAChC,QAAM,qBAAqB,QAAQ,KAAK,SAAS,EAAE;AACnD,QAAM,kBAAkB,cAAc,KAAK,SAAS,EAAE;AACtD,SAAO,CAAC,sBAAsB,CAAC;AACjC;AACO,IAAM,mCAAmC,CAAC,cAAc,SAAS,CAAC,GAAG,uBAAuB,UAAU;AAC3G,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AACA,QAAM,4BAA4B,eAAe,iBAAiB,YAAY,IAAI;AAClF,QAAM,yBAAyB,gCAA4B,sBAAO,YAAY,EAAE,MAAM,IAAI;AAI1F,QAAM,gBAAgB,uBAAuB,SAAS,CAAC;AAAA,IACrD;AAAA,EACF,CAAC;AACD,aAAW;AAAA,IACT,QAAQ;AAAA,EACV,KAAK,eAAe;AAClB,eAAW;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT,KAAK,eAAe;AAClB,YAAM,uBAAuB,gCAA4B,sBAAO,UAAU,EAAE,MAAM,IAAI;AACtF,UAAI,2BAA2B,sBAAsB;AACnD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAGA,aAAO,gBAAG,QAAQ;AACpB;AAIO,IAAM,0BAA0B,SAAO,MAAM,QAAQ,IAAI,MAAM,KAAK,EAAE,WAAW;AACjF,IAAM,yBAAyB,SAAO;AAC3C,SAAO,IAAI,SAAS,KAAK,IAAI,MAAM,cAAY,wBAAwB,QAAQ,CAAC;AAClF;AASO,IAAM,sBAAsB,CAAC,OAAO,YAAY;AACrD,MAAI,CAAC,SAAS,CAAC,WAAW,iBAAiB,KAAK,GAAG;AACjD,WAAO;AAAA,EACT;AACA,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,QAAM,0BAA0B,aAAa,iBAAiB,OAAO,EAAE;AACvE,SAAO,8BAA0B,sBAAO,uBAAuB,EAAE,MAAM,IAAI;AAC7E;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nextend([namesPlugin, a11yPlugin]);\n\n/**\n * Checks if a color value is a simple CSS color.\n *\n * @param value The color value to check.\n * @return A boolean indicating whether the color value is a simple CSS color.\n */\nconst isSimpleCSSColor = value => {\n const valueIsCssVariable = /var\\(/.test(value ?? '');\n const valueIsColorMix = /color-mix\\(/.test(value ?? '');\n return !valueIsCssVariable && !valueIsColorMix;\n};\nexport const extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false, selectedSlug) => {\n if (!currentValue) {\n return '';\n }\n const currentValueIsSimpleColor = currentValue ? isSimpleCSSColor(currentValue) : false;\n const normalizedCurrentValue = currentValueIsSimpleColor ? colord(currentValue).toHex() : currentValue;\n\n // Normalize format of `colors` to simplify the following loop\n\n const colorPalettes = showMultiplePalettes ? colors : [{\n colors: colors\n }];\n for (const {\n colors: paletteColors\n } of colorPalettes) {\n for (const {\n name: colorName,\n color: colorValue,\n slug\n } of paletteColors) {\n if (selectedSlug) {\n if (slug === selectedSlug) {\n return colorName;\n }\n continue;\n }\n const normalizedColorValue = currentValueIsSimpleColor ? colord(colorValue).toHex() : colorValue;\n if (normalizedCurrentValue === normalizedColorValue) {\n return colorName;\n }\n }\n }\n\n // translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n return __('Custom');\n};\n\n// The PaletteObject type has a `colors` property (an array of ColorObject),\n// while the ColorObject type has a `color` property (the CSS color value).\nexport const isMultiplePaletteObject = obj => Array.isArray(obj.colors) && !('color' in obj);\nexport const isMultiplePaletteArray = arr => {\n return arr.length > 0 && arr.every(colorObj => isMultiplePaletteObject(colorObj));\n};\n\n/**\n * Transform a CSS variable used as background color into the color value itself.\n *\n * @param value The color value that may be a CSS variable.\n * @param element The element for which to get the computed style.\n * @return The background color value computed from a element.\n */\nexport const normalizeColorValue = (value, element) => {\n if (!value || !element || isSimpleCSSColor(value)) {\n return value;\n }\n const {\n ownerDocument\n } = element;\n const {\n defaultView\n } = ownerDocument;\n const computedBackgroundColor = defaultView?.getComputedStyle(element).backgroundColor;\n return computedBackgroundColor ? colord(computedBackgroundColor).toHex() : value;\n};"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA+B;AAC/B,mBAAwB;AACxB,kBAAuB;AAKvB,kBAAmB;AAAA,IAMnB,sBAAO,CAAC,aAAAA,SAAa,YAAAC,OAAU,CAAC;AAQhC,IAAM,mBAAmB,WAAS;AAChC,QAAM,qBAAqB,QAAQ,KAAK,SAAS,EAAE;AACnD,QAAM,kBAAkB,cAAc,KAAK,SAAS,EAAE;AACtD,SAAO,CAAC,sBAAsB,CAAC;AACjC;AACO,IAAM,mCAAmC,CAAC,cAAc,SAAS,CAAC,GAAG,uBAAuB,OAAO,iBAAiB;AACzH,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AACA,QAAM,4BAA4B,eAAe,iBAAiB,YAAY,IAAI;AAClF,QAAM,yBAAyB,gCAA4B,sBAAO,YAAY,EAAE,MAAM,IAAI;AAI1F,QAAM,gBAAgB,uBAAuB,SAAS,CAAC;AAAA,IACrD;AAAA,EACF,CAAC;AACD,aAAW;AAAA,IACT,QAAQ;AAAA,EACV,KAAK,eAAe;AAClB,eAAW;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,MACP;AAAA,IACF,KAAK,eAAe;AAClB,UAAI,cAAc;AAChB,YAAI,SAAS,cAAc;AACzB,iBAAO;AAAA,QACT;AACA;AAAA,MACF;AACA,YAAM,uBAAuB,gCAA4B,sBAAO,UAAU,EAAE,MAAM,IAAI;AACtF,UAAI,2BAA2B,sBAAsB;AACnD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAGA,aAAO,gBAAG,QAAQ;AACpB;AAIO,IAAM,0BAA0B,SAAO,MAAM,QAAQ,IAAI,MAAM,KAAK,EAAE,WAAW;AACjF,IAAM,yBAAyB,SAAO;AAC3C,SAAO,IAAI,SAAS,KAAK,IAAI,MAAM,cAAY,wBAAwB,QAAQ,CAAC;AAClF;AASO,IAAM,sBAAsB,CAAC,OAAO,YAAY;AACrD,MAAI,CAAC,SAAS,CAAC,WAAW,iBAAiB,KAAK,GAAG;AACjD,WAAO;AAAA,EACT;AACA,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,QAAM,0BAA0B,aAAa,iBAAiB,OAAO,EAAE;AACvE,SAAO,8BAA0B,sBAAO,uBAAuB,EAAE,MAAM,IAAI;AAC7E;",
6
6
  "names": ["namesPlugin", "a11yPlugin"]
7
7
  }
@@ -46,7 +46,7 @@ var HexInput = ({
46
46
  enableAlpha
47
47
  }) => {
48
48
  const handleChange = (nextValue) => {
49
- if (!nextValue) {
49
+ if (nextValue === void 0) {
50
50
  return;
51
51
  }
52
52
  const hexValue = nextValue.startsWith("#") ? nextValue : "#" + nextValue;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/color-picker/hex-input.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { InputControl } from '../input-control';\nimport { Text } from '../text';\nimport { COLORS } from '../utils/colors-values';\nimport InputControlPrefixWrapper from '../input-control/input-prefix-wrapper';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const HexInput = ({\n color,\n onChange,\n enableAlpha\n}) => {\n const handleChange = nextValue => {\n if (!nextValue) {\n return;\n }\n const hexValue = nextValue.startsWith('#') ? nextValue : '#' + nextValue;\n onChange(colord(hexValue));\n };\n const stateReducer = (state, action) => {\n const nativeEvent = action.payload?.event?.nativeEvent;\n if ('insertFromPaste' !== nativeEvent?.inputType) {\n return {\n ...state\n };\n }\n const value = state.value?.startsWith('#') ? state.value.slice(1).toUpperCase() : state.value?.toUpperCase();\n return {\n ...state,\n value\n };\n };\n return /*#__PURE__*/_jsx(InputControl, {\n prefix: /*#__PURE__*/_jsx(InputControlPrefixWrapper, {\n children: /*#__PURE__*/_jsx(Text, {\n color: COLORS.theme.accent,\n lineHeight: 1,\n children: \"#\"\n })\n }),\n value: color.toHex().slice(1).toUpperCase(),\n onChange: handleChange,\n maxLength: enableAlpha ? 9 : 7,\n label: __('Hex color'),\n hideLabelFromVision: true,\n size: \"__unstable-large\",\n __unstableStateReducer: stateReducer,\n __unstableInputWidth: \"9em\"\n });\n};"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAuB;AAKvB,kBAAmB;AAKnB,2BAA6B;AAC7B,kBAAqB;AACrB,2BAAuB;AACvB,kCAAsC;AACtC,yBAA4B;AACrB,IAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,eAAa;AAChC,QAAI,CAAC,WAAW;AACd;AAAA,IACF;AACA,UAAM,WAAW,UAAU,WAAW,GAAG,IAAI,YAAY,MAAM;AAC/D,iBAAS,sBAAO,QAAQ,CAAC;AAAA,EAC3B;AACA,QAAM,eAAe,CAAC,OAAO,WAAW;AACtC,UAAM,cAAc,OAAO,SAAS,OAAO;AAC3C,QAAI,sBAAsB,aAAa,WAAW;AAChD,aAAO;AAAA,QACL,GAAG;AAAA,MACL;AAAA,IACF;AACA,UAAM,QAAQ,MAAM,OAAO,WAAW,GAAG,IAAI,MAAM,MAAM,MAAM,CAAC,EAAE,YAAY,IAAI,MAAM,OAAO,YAAY;AAC3G,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SAAoB,uCAAAA,KAAK,mCAAc;AAAA,IACrC,QAAqB,uCAAAA,KAAK,4BAAAC,SAA2B;AAAA,MACnD,UAAuB,uCAAAD,KAAK,kBAAM;AAAA,QAChC,OAAO,4BAAO,MAAM;AAAA,QACpB,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ,CAAC;AAAA,IACH,CAAC;AAAA,IACD,OAAO,MAAM,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY;AAAA,IAC1C,UAAU;AAAA,IACV,WAAW,cAAc,IAAI;AAAA,IAC7B,WAAO,gBAAG,WAAW;AAAA,IACrB,qBAAqB;AAAA,IACrB,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,sBAAsB;AAAA,EACxB,CAAC;AACH;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { InputControl } from '../input-control';\nimport { Text } from '../text';\nimport { COLORS } from '../utils/colors-values';\nimport InputControlPrefixWrapper from '../input-control/input-prefix-wrapper';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const HexInput = ({\n color,\n onChange,\n enableAlpha\n}) => {\n const handleChange = nextValue => {\n if (nextValue === undefined) {\n return;\n }\n const hexValue = nextValue.startsWith('#') ? nextValue : '#' + nextValue;\n onChange(colord(hexValue));\n };\n const stateReducer = (state, action) => {\n const nativeEvent = action.payload?.event?.nativeEvent;\n if ('insertFromPaste' !== nativeEvent?.inputType) {\n return {\n ...state\n };\n }\n const value = state.value?.startsWith('#') ? state.value.slice(1).toUpperCase() : state.value?.toUpperCase();\n return {\n ...state,\n value\n };\n };\n return /*#__PURE__*/_jsx(InputControl, {\n prefix: /*#__PURE__*/_jsx(InputControlPrefixWrapper, {\n children: /*#__PURE__*/_jsx(Text, {\n color: COLORS.theme.accent,\n lineHeight: 1,\n children: \"#\"\n })\n }),\n value: color.toHex().slice(1).toUpperCase(),\n onChange: handleChange,\n maxLength: enableAlpha ? 9 : 7,\n label: __('Hex color'),\n hideLabelFromVision: true,\n size: \"__unstable-large\",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B,sBAAsB;AAAA,EACxB,CAAC;AACH;",
6
6
  "names": ["_jsx", "InputControlPrefixWrapper"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/custom-gradient-picker/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport { getGradientAstWithDefault, getLinearGradientRepresentation, getGradientAstWithControlPoints, getStopCssColor } from './utils';\nimport { serializeGradient } from './serializer';\nimport { DEFAULT_LINEAR_GRADIENT_ANGLE, GRADIENT_OPTIONS, HORIZONTAL_GRADIENT_ORIENTATION } from './constants';\nimport { AccessoryWrapper, SelectWrapper } from './styles/custom-gradient-picker-styles';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst GradientAnglePicker = ({\n gradientAST,\n hasGradient,\n onChange\n}) => {\n const angle = gradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n const onAngleChange = newAngle => {\n onChange(serializeGradient({\n ...gradientAST,\n orientation: {\n type: 'angular',\n value: `${newAngle}`\n }\n }));\n };\n return /*#__PURE__*/_jsx(AnglePickerControl, {\n onChange: onAngleChange,\n value: hasGradient ? angle : ''\n });\n};\nconst GradientTypePicker = ({\n gradientAST,\n hasGradient,\n onChange\n}) => {\n const {\n type\n } = gradientAST;\n const lastLinearOrientationAngle = useRef(Number(HORIZONTAL_GRADIENT_ORIENTATION.value));\n if (type === 'linear-gradient' && gradientAST.orientation) {\n // eslint-disable-next-line react-compiler/react-compiler -- false positive, see https://github.com/facebook/react/issues/29196\n lastLinearOrientationAngle.current = Number(gradientAST.orientation.value);\n }\n const onSetLinearGradient = () => {\n onChange(serializeGradient({\n ...gradientAST,\n orientation: {\n type: 'angular',\n value: `${lastLinearOrientationAngle.current}`\n },\n type: 'linear-gradient'\n }));\n };\n const onSetRadialGradient = () => {\n const {\n orientation,\n ...restGradientAST\n } = gradientAST;\n onChange(serializeGradient({\n ...restGradientAST,\n type: 'radial-gradient'\n }));\n };\n const handleOnChange = next => {\n if (next === 'linear-gradient') {\n onSetLinearGradient();\n }\n if (next === 'radial-gradient') {\n onSetRadialGradient();\n }\n };\n return /*#__PURE__*/_jsx(SelectControl, {\n className: \"components-custom-gradient-picker__type-picker\",\n label: __('Type'),\n labelPosition: \"top\",\n onChange: handleOnChange,\n options: GRADIENT_OPTIONS,\n size: \"__unstable-large\",\n value: hasGradient ? type : undefined\n });\n};\n\n/**\n * CustomGradientPicker is a React component that renders a UI for specifying\n * linear or radial gradients. Radial gradients are displayed in the picker as\n * a slice of the gradient from the center to the outside.\n *\n * ```jsx\n * import { CustomGradientPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyCustomGradientPicker = () => {\n * const [ gradient, setGradient ] = useState();\n *\n * return (\n * <CustomGradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ setGradient }\n * />\n * );\n * };\n * ```\n */\nexport function CustomGradientPicker({\n value,\n onChange,\n enableAlpha = true,\n __experimentalIsRenderedInSidebar = false\n}) {\n const {\n gradientAST,\n hasGradient\n } = getGradientAstWithDefault(value);\n\n // On radial gradients the bar should display a linear gradient.\n // On radial gradients the bar represents a slice of the gradient from the center until the outside.\n // On liner gradients the bar represents the color stops from left to right independently of the angle.\n const background = getLinearGradientRepresentation(gradientAST);\n\n // Control points color option may be hex from presets, custom colors will be rgb.\n // The position should always be a percentage.\n const controlPoints = gradientAST.colorStops.map(colorStop => {\n return {\n color: getStopCssColor(colorStop),\n // Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,\n // TypeScript doesn't know that `colorStop.length` is not undefined here.\n // @ts-expect-error\n position: parseInt(colorStop.length.value)\n };\n });\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 4,\n className: \"components-custom-gradient-picker\",\n children: [/*#__PURE__*/_jsx(CustomGradientBar, {\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n disableAlpha: !enableAlpha,\n background: background,\n hasGradient: hasGradient,\n value: controlPoints,\n onChange: newControlPoints => {\n onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));\n }\n }), /*#__PURE__*/_jsxs(Flex, {\n gap: 3,\n className: \"components-custom-gradient-picker__ui-line\",\n children: [/*#__PURE__*/_jsx(SelectWrapper, {\n children: /*#__PURE__*/_jsx(GradientTypePicker, {\n gradientAST: gradientAST,\n hasGradient: hasGradient,\n onChange: onChange\n })\n }), /*#__PURE__*/_jsx(AccessoryWrapper, {\n children: gradientAST.type === 'linear-gradient' && /*#__PURE__*/_jsx(GradientAnglePicker, {\n gradientAST: gradientAST,\n hasGradient: hasGradient,\n onChange: onChange\n })\n })]\n })]\n });\n}\nexport default CustomGradientPicker;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,kBAAmB;AACnB,qBAAuB;AAKvB,kCAA+B;AAC/B,0BAA8B;AAC9B,kBAAqB;AACrB,4BAA0B;AAC1B,qBAAuB;AACvB,mBAA6H;AAC7H,wBAAkC;AAClC,uBAAiG;AACjG,2CAAgD;AAChD,yBAA2C;AAC3C,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,QAAQ,aAAa,aAAa,SAAS;AACjD,QAAM,gBAAgB,cAAY;AAChC,iBAAS,qCAAkB;AAAA,MACzB,GAAG;AAAA,MACH,aAAa;AAAA,QACX,MAAM;AAAA,QACN,OAAO,GAAG,QAAQ;AAAA,MACpB;AAAA,IACF,CAAC,CAAC;AAAA,EACJ;AACA,SAAoB,uCAAAA,KAAK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A0B,KAAK;AAKnC,QAAM,iBAAa,8CAAgC,WAAW;AAI9D,QAAM,gBAAgB,YAAY,WAAW,IAAI,eAAa;AAC5D,WAAO;AAAA,MACL,WAAO,8BAAgB,SAAS;AAAA;AAAA;AAAA;AAAA,MAIhC,UAAU,SAAS,UAAU,OAAO,KAAK;AAAA,IAC3C;AAAA,EACF,CAAC;AACD,SAAoB,uCAAAC,MAAM,uBAAQ;AAAA,IAChC,SAAS;AAAA,IACT,WAAW;AAAA,IACX,UAAU,CAAc,uCAAAH,KAAK,oBAAAI,SAAmB;AAAA,MAC9C;AAAA,MACA,cAAc,CAAC;AAAA,MACf;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,UAAU,sBAAoB;AAC5B,qBAAS,yCAAkB,8CAAgC,aAAa,gBAAgB,CAAC,CAAC;AAAA,MAC5F;AAAA,IACF,CAAC,GAAgB,uCAAAD,MAAM,kBAAM;AAAA,MAC3B,KAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU,CAAc,uCAAAH,KAAK,oDAAe;AAAA,QAC1C,UAAuB,uCAAAA,KAAK,oBAAoB;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH,CAAC,GAAgB,uCAAAA,KAAK,uDAAkB;AAAA,QACtC,UAAU,YAAY,SAAS,qBAAkC,uCAAAA,KAAK,qBAAqB;AAAA,UACzF;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,iCAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport { getGradientAstWithDefault, getLinearGradientRepresentation, getGradientAstWithControlPoints, getStopCssColor } from './utils';\nimport { serializeGradient } from './serializer';\nimport { DEFAULT_LINEAR_GRADIENT_ANGLE, GRADIENT_OPTIONS, HORIZONTAL_GRADIENT_ORIENTATION } from './constants';\nimport { AccessoryWrapper, SelectWrapper } from './styles/custom-gradient-picker-styles';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst GradientAnglePicker = ({\n gradientAST,\n hasGradient,\n onChange\n}) => {\n const angle = gradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n const onAngleChange = newAngle => {\n onChange(serializeGradient({\n ...gradientAST,\n orientation: {\n type: 'angular',\n value: `${newAngle}`\n }\n }));\n };\n return /*#__PURE__*/_jsx(AnglePickerControl, {\n onChange: onAngleChange,\n value: hasGradient ? angle : ''\n });\n};\nconst GradientTypePicker = ({\n gradientAST,\n hasGradient,\n onChange\n}) => {\n const {\n type\n } = gradientAST;\n const lastLinearOrientationAngle = useRef(Number(HORIZONTAL_GRADIENT_ORIENTATION.value));\n if (type === 'linear-gradient' && gradientAST.orientation) {\n lastLinearOrientationAngle.current = Number(gradientAST.orientation.value);\n }\n const onSetLinearGradient = () => {\n onChange(serializeGradient({\n ...gradientAST,\n orientation: {\n type: 'angular',\n value: `${lastLinearOrientationAngle.current}`\n },\n type: 'linear-gradient'\n }));\n };\n const onSetRadialGradient = () => {\n const {\n orientation,\n ...restGradientAST\n } = gradientAST;\n onChange(serializeGradient({\n ...restGradientAST,\n type: 'radial-gradient'\n }));\n };\n const handleOnChange = next => {\n if (next === 'linear-gradient') {\n onSetLinearGradient();\n }\n if (next === 'radial-gradient') {\n onSetRadialGradient();\n }\n };\n return /*#__PURE__*/_jsx(SelectControl, {\n className: \"components-custom-gradient-picker__type-picker\",\n label: __('Type'),\n labelPosition: \"top\",\n onChange: handleOnChange,\n options: GRADIENT_OPTIONS,\n size: \"__unstable-large\",\n value: hasGradient ? type : undefined\n });\n};\n\n/**\n * CustomGradientPicker is a React component that renders a UI for specifying\n * linear or radial gradients. Radial gradients are displayed in the picker as\n * a slice of the gradient from the center to the outside.\n *\n * ```jsx\n * import { CustomGradientPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyCustomGradientPicker = () => {\n * const [ gradient, setGradient ] = useState();\n *\n * return (\n * <CustomGradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ setGradient }\n * />\n * );\n * };\n * ```\n */\nexport function CustomGradientPicker({\n value,\n onChange,\n enableAlpha = true,\n __experimentalIsRenderedInSidebar = false\n}) {\n const {\n gradientAST,\n hasGradient\n } = getGradientAstWithDefault(value);\n\n // On radial gradients the bar should display a linear gradient.\n // On radial gradients the bar represents a slice of the gradient from the center until the outside.\n // On liner gradients the bar represents the color stops from left to right independently of the angle.\n const background = getLinearGradientRepresentation(gradientAST);\n\n // Control points color option may be hex from presets, custom colors will be rgb.\n // The position should always be a percentage.\n const controlPoints = gradientAST.colorStops.map(colorStop => {\n return {\n color: getStopCssColor(colorStop),\n // Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,\n // TypeScript doesn't know that `colorStop.length` is not undefined here.\n // @ts-expect-error\n position: parseInt(colorStop.length.value)\n };\n });\n return /*#__PURE__*/_jsxs(VStack, {\n spacing: 4,\n className: \"components-custom-gradient-picker\",\n children: [/*#__PURE__*/_jsx(CustomGradientBar, {\n __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,\n disableAlpha: !enableAlpha,\n background: background,\n hasGradient: hasGradient,\n value: controlPoints,\n onChange: newControlPoints => {\n onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));\n }\n }), /*#__PURE__*/_jsxs(Flex, {\n gap: 3,\n className: \"components-custom-gradient-picker__ui-line\",\n children: [/*#__PURE__*/_jsx(SelectWrapper, {\n children: /*#__PURE__*/_jsx(GradientTypePicker, {\n gradientAST: gradientAST,\n hasGradient: hasGradient,\n onChange: onChange\n })\n }), /*#__PURE__*/_jsx(AccessoryWrapper, {\n children: gradientAST.type === 'linear-gradient' && /*#__PURE__*/_jsx(GradientAnglePicker, {\n gradientAST: gradientAST,\n hasGradient: hasGradient,\n onChange: onChange\n })\n })]\n })]\n });\n}\nexport default CustomGradientPicker;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,kBAAmB;AACnB,qBAAuB;AAKvB,kCAA+B;AAC/B,0BAA8B;AAC9B,kBAAqB;AACrB,4BAA0B;AAC1B,qBAAuB;AACvB,mBAA6H;AAC7H,wBAAkC;AAClC,uBAAiG;AACjG,2CAAgD;AAChD,yBAA2C;AAC3C,IAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,QAAQ,aAAa,aAAa,SAAS;AACjD,QAAM,gBAAgB,cAAY;AAChC,iBAAS,qCAAkB;AAAA,MACzB,GAAG;AAAA,MACH,aAAa;AAAA,QACX,MAAM;AAAA,QACN,OAAO,GAAG,QAAQ;AAAA,MACpB;AAAA,IACF,CAAC,CAAC;AAAA,EACJ;AACA,SAAoB,uCAAAA,KAAK,4BAAAC,SAAoB;AAAA,IAC3C,UAAU;AAAA,IACV,OAAO,cAAc,QAAQ;AAAA,EAC/B,CAAC;AACH;AACA,IAAM,qBAAqB,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,QAAM,iCAA6B,uBAAO,OAAO,iDAAgC,KAAK,CAAC;AACvF,MAAI,SAAS,qBAAqB,YAAY,aAAa;AACzD,+BAA2B,UAAU,OAAO,YAAY,YAAY,KAAK;AAAA,EAC3E;AACA,QAAM,sBAAsB,MAAM;AAChC,iBAAS,qCAAkB;AAAA,MACzB,GAAG;AAAA,MACH,aAAa;AAAA,QACX,MAAM;AAAA,Q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AAS,yCAAkB,8CAAgC,aAAa,gBAAgB,CAAC,CAAC;AAAA,MAC5F;AAAA,IACF,CAAC,GAAgB,uCAAAD,MAAM,kBAAM;AAAA,MAC3B,KAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU,CAAc,uCAAAH,KAAK,oDAAe;AAAA,QAC1C,UAAuB,uCAAAA,KAAK,oBAAoB;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH,CAAC,GAAgB,uCAAAA,KAAK,uDAAkB;AAAA,QACtC,UAAU,YAAY,SAAS,qBAAkC,uCAAAA,KAAK,qBAAqB;AAAA,UACzF;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,iCAAQ;",
6
6
  "names": ["_jsx", "AnglePickerControl", "SelectControl", "_jsxs", "CustomGradientBar"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/focal-point-picker/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging, useIsomorphicLayoutEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Controls from './controls';\nimport FocalPoint from './focal-point';\nimport Grid from './grid';\nimport Media from './media';\nimport { Container, MediaWrapper, MediaContainer } from './styles/focal-point-picker-style';\nimport { INITIAL_BOUNDS } from './utils';\nimport { useUpdateEffect } from '../utils/hooks';\nimport { StyledLabel, StyledHelp } from '../base-control/styles/base-control-styles';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst GRID_OVERLAY_TIMEOUT = 600;\n\n/**\n * Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image.\n *\n * This component addresses a specific problem: with large background images it is common to see undesirable crops,\n * especially when viewing on smaller viewports such as mobile phones. This component allows the selection of\n * the point with the most important visual information and returns it as a pair of numbers between 0 and 1.\n * This value can be easily converted into the CSS `background-position` attribute, and will ensure that the\n * focal point is never cropped out, regardless of viewport.\n *\n * - Example focal point picker value: `{ x: 0.5, y: 0.1 }`\n * - Corresponding CSS: `background-position: 50% 10%;`\n *\n * ```jsx\n * import { FocalPointPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ focalPoint, setFocalPoint ] = useState( {\n * \t\tx: 0.5,\n * \t\ty: 0.5,\n * \t} );\n *\n * \tconst url = '/path/to/image';\n *\n * \t// Example function to render the CSS styles based on Focal Point Picker value\n * \tconst style = {\n * \t\tbackgroundImage: `url(${ url })`,\n * \t\tbackgroundPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`,\n * \t};\n *\n * \treturn (\n * \t\t<>\n * \t\t\t<FocalPointPicker\n * \t\t\t\turl={ url }\n * \t\t\t\tvalue={ focalPoint }\n * \t\t\t\tonDragStart={ setFocalPoint }\n * \t\t\t\tonDrag={ setFocalPoint }\n * \t\t\t\tonChange={ setFocalPoint }\n * \t\t\t/>\n * \t\t\t<div style={ style } />\n * \t\t</>\n * \t);\n * };\n * ```\n */\nexport function FocalPointPicker({\n // Prevent passing to internal component.\n __nextHasNoMarginBottom: _,\n autoPlay = true,\n className,\n help,\n hideLabelFromVision,\n label,\n onChange,\n onDrag,\n onDragEnd,\n onDragStart,\n resolvePoint,\n url,\n value: valueProp = {\n x: 0.5,\n y: 0.5\n },\n ...restProps\n}) {\n const [point, setPoint] = useState(valueProp);\n const [showGridOverlay, setShowGridOverlay] = useState(false);\n const {\n startDrag,\n endDrag,\n isDragging\n } = useDragging({\n onDragStart: event => {\n dragAreaRef.current?.focus();\n const value = getValueWithinDragArea(event);\n\n // `value` can technically be undefined if getValueWithinDragArea() is\n // called before dragAreaRef is set, but this shouldn't happen in reality.\n if (!value) {\n return;\n }\n onDragStart?.(value, event);\n setPoint(value);\n },\n onDragMove: event => {\n // Prevents text-selection when dragging.\n event.preventDefault();\n const value = getValueWithinDragArea(event);\n if (!value) {\n return;\n }\n onDrag?.(value, event);\n setPoint(value);\n },\n onDragEnd: () => {\n onDragEnd?.();\n onChange?.(point);\n }\n });\n\n // Uses the internal point while dragging or else the value from props.\n const {\n x,\n y\n } = isDragging ? point : valueProp;\n const dragAreaRef = useRef(null);\n const [bounds, setBounds] = useState(INITIAL_BOUNDS);\n const refUpdateBounds = useRef(() => {\n if (!dragAreaRef.current) {\n return;\n }\n const {\n clientWidth: width,\n clientHeight: height\n } = dragAreaRef.current;\n // Falls back to initial bounds if the ref has no size. Since styles\n // give the drag area dimensions even when the media has not loaded\n // this should only happen in unit tests (jsdom).\n setBounds(width > 0 && height > 0 ? {\n width,\n height\n } : {\n ...INITIAL_BOUNDS\n });\n });\n useEffect(() => {\n const updateBounds = refUpdateBounds.current;\n if (!dragAreaRef.current) {\n return;\n }\n const {\n defaultView\n } = dragAreaRef.current.ownerDocument;\n defaultView?.addEventListener('resize', updateBounds);\n return () => defaultView?.removeEventListener('resize', updateBounds);\n }, []);\n\n // Updates the bounds to cover cases of unspecified media or load failures.\n useIsomorphicLayoutEffect(() => void refUpdateBounds.current(), []);\n\n // TODO: Consider refactoring getValueWithinDragArea() into a pure function.\n // https://github.com/WordPress/gutenberg/pull/43872#discussion_r963455173\n const getValueWithinDragArea = ({\n clientX,\n clientY,\n shiftKey\n }) => {\n if (!dragAreaRef.current) {\n return;\n }\n const {\n top,\n left\n } = dragAreaRef.current.getBoundingClientRect();\n let nextX = (clientX - left) / bounds.width;\n let nextY = (clientY - top) / bounds.height;\n // Enables holding shift to jump values by 10%.\n if (shiftKey) {\n nextX = Math.round(nextX / 0.1) * 0.1;\n nextY = Math.round(nextY / 0.1) * 0.1;\n }\n return getFinalValue({\n x: nextX,\n y: nextY\n });\n };\n const getFinalValue = value => {\n const resolvedValue = resolvePoint?.(value) ?? value;\n resolvedValue.x = Math.max(0, Math.min(resolvedValue.x, 1));\n resolvedValue.y = Math.max(0, Math.min(resolvedValue.y, 1));\n const roundToTwoDecimalPlaces = n => Math.round(n * 1e2) / 1e2;\n return {\n x: roundToTwoDecimalPlaces(resolvedValue.x),\n y: roundToTwoDecimalPlaces(resolvedValue.y)\n };\n };\n const arrowKeyStep = event => {\n const {\n code,\n shiftKey\n } = event;\n if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(code)) {\n return;\n }\n event.preventDefault();\n const value = {\n x,\n y\n };\n const step = shiftKey ? 0.1 : 0.01;\n const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step;\n const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x';\n value[axis] = value[axis] + delta;\n onChange?.(getFinalValue(value));\n };\n const focalPointPosition = {\n left: x !== undefined ? x * bounds.width : 0.5 * bounds.width,\n top: y !== undefined ? y * bounds.height : 0.5 * bounds.height\n };\n const classes = clsx('components-focal-point-picker-control', className);\n const Label = hideLabelFromVision ? VisuallyHidden : StyledLabel;\n useUpdateEffect(() => {\n setShowGridOverlay(true);\n const timeout = window.setTimeout(() => {\n setShowGridOverlay(false);\n }, GRID_OVERLAY_TIMEOUT);\n return () => window.clearTimeout(timeout);\n }, [x, y]);\n return /*#__PURE__*/_jsxs(Container, {\n ...restProps,\n as: \"fieldset\",\n className: classes,\n children: [!!label && /*#__PURE__*/_jsx(Label, {\n as: \"legend\",\n children: label\n }), /*#__PURE__*/_jsx(MediaWrapper, {\n className: \"components-focal-point-picker-wrapper\",\n children: /*#__PURE__*/_jsxs(MediaContainer, {\n className: \"components-focal-point-picker\",\n onKeyDown: arrowKeyStep,\n onMouseDown: startDrag,\n onBlur: () => {\n if (isDragging) {\n endDrag();\n }\n },\n ref: dragAreaRef,\n role: \"button\",\n tabIndex: -1,\n children: [/*#__PURE__*/_jsx(Grid, {\n bounds: bounds,\n showOverlay: showGridOverlay\n }), /*#__PURE__*/_jsx(Media, {\n alt: __('Media preview'),\n autoPlay: autoPlay,\n onLoad: refUpdateBounds.current,\n src: url\n }), /*#__PURE__*/_jsx(FocalPoint, {\n ...focalPointPosition,\n isDragging: isDragging\n })]\n })\n }), /*#__PURE__*/_jsx(Controls, {\n hasHelpText: !!help,\n point: {\n x,\n y\n },\n onChange: value => {\n onChange?.(getFinalValue(value));\n }\n }), !!help && /*#__PURE__*/_jsx(StyledHelp, {\n children: help\n })]\n });\n}\nexport default FocalPointPicker;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,kBAAmB;AACnB,qBAA4C;AAC5C,qBAAoF;AAKpF,sBAAqB;AACrB,yBAAuB;AACvB,kBAAiB;AACjB,mBAAkB;AAClB,sCAAwD;AACxD,mBAA+B;AAC/B,mBAAgC;AAChC,iCAAwC;AACxC,6BAA+B;AAC/B,yBAA2C;AAC3C,IAAM,uBAAuB;AA+CtB,SAAS,iBAAiB;AAAA;AAAA,EAE/B,yBAAyB;AAAA,EACzB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,YAAY;AAAA,IACjB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,CAAC,OAAO,QAAQ,QAAI,yBAAS,SAAS;AAC5C,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,yBAAS,KAAK;AAC5D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,eAAAA,2BAAY;AAAA,IACd,aAAa,WAAS;AACpB,kBAAY,SAAS,MAAM;AAC3B,YAAM,QAAQ,uBAAuB,KAAK;AAI1C,UAAI,CA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AA,MAC9B,aAAa,CAAC,CAAC;AAAA,MACf,OAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF;AAAA,MACA,UAAU,WAAS;AACjB,mBAAW,cAAc,KAAK,CAAC;AAAA,MACjC;AAAA,IACF,CAAC,GAAG,CAAC,CAAC,QAAqB,uCAAAJ,KAAK,uCAAY;AAAA,MAC1C,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,6BAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging, useIsomorphicLayoutEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Controls from './controls';\nimport FocalPoint from './focal-point';\nimport Grid from './grid';\nimport Media from './media';\nimport { Container, MediaWrapper, MediaContainer } from './styles/focal-point-picker-style';\nimport { INITIAL_BOUNDS } from './utils';\nimport { useUpdateEffect } from '../utils/hooks';\nimport { StyledLabel, StyledHelp } from '../base-control/styles/base-control-styles';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst GRID_OVERLAY_TIMEOUT = 600;\n\n/**\n * Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image.\n *\n * It addresses two common issues when displaying images in cropped containers. First, large\n * background images can be cropped in undesirable ways, especially on smaller viewports such as\n * mobile devices. Second, the CSS aspect-ratio property can inadvertently crop out the area of\n * highest visual interest. This component allows the selection of the point with the most\n * important visual information and returns it as a pair of numbers between 0 and 1.\n * The output value can be applied to either CSS `background-position` (for elements with\n * `background-image`) or `object-position` (for `<img>` / `<video>` elements rendered with\n * `object-fit: cover`).\n *\n * - Example focal point picker value: `{ x: 0.5, y: 0.1 }`;\n * - Corresponding CSS: `object-position: 50% 10%`;\n *\n * ```jsx\n * import { FocalPointPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ focalPoint, setFocalPoint ] = useState( {\n * \t\tx: 0.5,\n * \t\ty: 0.1,\n * \t} );\n *\n * \tconst url = '/path/to/image';\n *\n * \t// Example function to render the CSS styles based on Focal Point Picker value\n * \tconst style = {\n * \t\twidth: '100%',\n * \t\taspectRatio: '16 / 9',\n * \t\tobjectFit: 'cover',\n * \t\tobjectPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`,\n * \t};\n *\n * \treturn (\n * \t\t<>\n * \t\t\t<FocalPointPicker\n * \t\t\t\turl={ url }\n * \t\t\t\tvalue={ focalPoint }\n * \t\t\t\tonDragStart={ setFocalPoint }\n * \t\t\t\tonDrag={ setFocalPoint }\n * \t\t\t\tonChange={ setFocalPoint }\n * \t\t\t/>\n * \t\t\t<img src={ url } alt=\"\" style={ style } />\n * \t\t</>\n * \t);\n * };\n * ```\n */\nexport function FocalPointPicker({\n // Prevent passing to internal component.\n __nextHasNoMarginBottom: _,\n autoPlay = true,\n className,\n help,\n hideLabelFromVision,\n label,\n onChange,\n onDrag,\n onDragEnd,\n onDragStart,\n resolvePoint,\n url,\n value: valueProp = {\n x: 0.5,\n y: 0.5\n },\n ...restProps\n}) {\n const [point, setPoint] = useState(valueProp);\n const [showGridOverlay, setShowGridOverlay] = useState(false);\n const {\n startDrag,\n endDrag,\n isDragging\n } = useDragging({\n onDragStart: event => {\n dragAreaRef.current?.focus();\n const value = getValueWithinDragArea(event);\n\n // `value` can technically be undefined if getValueWithinDragArea() is\n // called before dragAreaRef is set, but this shouldn't happen in reality.\n if (!value) {\n return;\n }\n onDragStart?.(value, event);\n setPoint(value);\n },\n onDragMove: event => {\n // Prevents text-selection when dragging.\n event.preventDefault();\n const value = getValueWithinDragArea(event);\n if (!value) {\n return;\n }\n onDrag?.(value, event);\n setPoint(value);\n },\n onDragEnd: () => {\n onDragEnd?.();\n onChange?.(point);\n }\n });\n\n // Uses the internal point while dragging or else the value from props.\n const {\n x,\n y\n } = isDragging ? point : valueProp;\n const dragAreaRef = useRef(null);\n const [bounds, setBounds] = useState(INITIAL_BOUNDS);\n const refUpdateBounds = useRef(() => {\n if (!dragAreaRef.current) {\n return;\n }\n const {\n clientWidth: width,\n clientHeight: height\n } = dragAreaRef.current;\n // Falls back to initial bounds if the ref has no size. Since styles\n // give the drag area dimensions even when the media has not loaded\n // this should only happen in unit tests (jsdom).\n setBounds(width > 0 && height > 0 ? {\n width,\n height\n } : {\n ...INITIAL_BOUNDS\n });\n });\n useEffect(() => {\n const updateBounds = refUpdateBounds.current;\n if (!dragAreaRef.current) {\n return;\n }\n const {\n defaultView\n } = dragAreaRef.current.ownerDocument;\n defaultView?.addEventListener('resize', updateBounds);\n return () => defaultView?.removeEventListener('resize', updateBounds);\n }, []);\n\n // Updates the bounds to cover cases of unspecified media or load failures.\n useIsomorphicLayoutEffect(() => void refUpdateBounds.current(), []);\n\n // TODO: Consider refactoring getValueWithinDragArea() into a pure function.\n // https://github.com/WordPress/gutenberg/pull/43872#discussion_r963455173\n const getValueWithinDragArea = ({\n clientX,\n clientY,\n shiftKey\n }) => {\n if (!dragAreaRef.current) {\n return;\n }\n const {\n top,\n left\n } = dragAreaRef.current.getBoundingClientRect();\n let nextX = (clientX - left) / bounds.width;\n let nextY = (clientY - top) / bounds.height;\n // Enables holding shift to jump values by 10%.\n if (shiftKey) {\n nextX = Math.round(nextX / 0.1) * 0.1;\n nextY = Math.round(nextY / 0.1) * 0.1;\n }\n return getFinalValue({\n x: nextX,\n y: nextY\n });\n };\n const getFinalValue = value => {\n const resolvedValue = resolvePoint?.(value) ?? value;\n resolvedValue.x = Math.max(0, Math.min(resolvedValue.x, 1));\n resolvedValue.y = Math.max(0, Math.min(resolvedValue.y, 1));\n const roundToTwoDecimalPlaces = n => Math.round(n * 1e2) / 1e2;\n return {\n x: roundToTwoDecimalPlaces(resolvedValue.x),\n y: roundToTwoDecimalPlaces(resolvedValue.y)\n };\n };\n const arrowKeyStep = event => {\n const {\n code,\n shiftKey\n } = event;\n if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(code)) {\n return;\n }\n event.preventDefault();\n const value = {\n x,\n y\n };\n const step = shiftKey ? 0.1 : 0.01;\n const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step;\n const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x';\n value[axis] = value[axis] + delta;\n onChange?.(getFinalValue(value));\n };\n const focalPointPosition = {\n left: x !== undefined ? x * bounds.width : 0.5 * bounds.width,\n top: y !== undefined ? y * bounds.height : 0.5 * bounds.height\n };\n const classes = clsx('components-focal-point-picker-control', className);\n const Label = hideLabelFromVision ? VisuallyHidden : StyledLabel;\n useUpdateEffect(() => {\n setShowGridOverlay(true);\n const timeout = window.setTimeout(() => {\n setShowGridOverlay(false);\n }, GRID_OVERLAY_TIMEOUT);\n return () => window.clearTimeout(timeout);\n }, [x, y]);\n return /*#__PURE__*/_jsxs(Container, {\n ...restProps,\n as: \"fieldset\",\n className: classes,\n children: [!!label && /*#__PURE__*/_jsx(Label, {\n as: \"legend\",\n children: label\n }), /*#__PURE__*/_jsx(MediaWrapper, {\n className: \"components-focal-point-picker-wrapper\",\n children: /*#__PURE__*/_jsxs(MediaContainer, {\n className: \"components-focal-point-picker\",\n onKeyDown: arrowKeyStep,\n onMouseDown: startDrag,\n onBlur: () => {\n if (isDragging) {\n endDrag();\n }\n },\n ref: dragAreaRef,\n role: \"button\",\n tabIndex: -1,\n children: [/*#__PURE__*/_jsx(Grid, {\n bounds: bounds,\n showOverlay: showGridOverlay\n }), /*#__PURE__*/_jsx(Media, {\n alt: __('Media preview'),\n autoPlay: autoPlay,\n onLoad: refUpdateBounds.current,\n src: url\n }), /*#__PURE__*/_jsx(FocalPoint, {\n ...focalPointPosition,\n isDragging: isDragging\n })]\n })\n }), /*#__PURE__*/_jsx(Controls, {\n hasHelpText: !!help,\n point: {\n x,\n y\n },\n onChange: value => {\n onChange?.(getFinalValue(value));\n }\n }), !!help && /*#__PURE__*/_jsx(StyledHelp, {\n children: help\n })]\n });\n}\nexport default FocalPointPicker;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,kBAAmB;AACnB,qBAA4C;AAC5C,qBAAoF;AAKpF,sBAAqB;AACrB,yBAAuB;AACvB,kBAAiB;AACjB,mBAAkB;AAClB,sCAAwD;AACxD,mBAA+B;AAC/B,mBAAgC;AAChC,iCAAwC;AACxC,6BAA+B;AAC/B,yBAA2C;AAC3C,IAAM,uBAAuB;AAoDtB,SAAS,iBAAiB;AAAA;AAAA,EAE/B,yBAAyB;AAAA,EACzB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,YAAY;AAAA,IACjB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,CAAC,OAAO,QAAQ,QAAI,yBAAS,SAAS;AAC5C,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,yBAAS,KAAK;AAC5D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,eAAAA,2BAAY;AAAA,IACd,aAAa,WAAS;AACpB,kBAAY,SAAS,MAAM;AAC3B,YAAM,QAAQ,uBAAuB,KAAK;AAI1C,UAAI,CAAC,OAAO;AACV;AAAA,MACF;AACA,oBAAc,OAAO,KAAK;AAC1B,eAAS,KAAK;AAAA,IAChB;AAAA,IACA,YAAY,WAAS;AAEnB,YAAM,eAAe;AACrB,YAAM,QAAQ,uBAAuB,KAAK;AAC1C,UAAI,CAAC,OAAO;AACV;AAAA,MACF;AACA,eAAS,OAAO,KAAK;AACrB,eAAS,KAAK;AAAA,IAChB;AAAA,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A,EACJ,CAAC;AACH;AACA,IAAO,6BAAQ;",
6
6
  "names": ["useDragging", "clsx", "_jsxs", "_jsx", "Grid", "Media", "FocalPoint", "Controls"]
7
7
  }
@@ -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 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,eAAe;AAAA,IACf;AAAA,IACA,gBAAgB;AAAA,IAChB,2BAA2B;AAAA,EAC7B,IAAI;AACJ,QAAM,UAAM,uBAAO,IAAI;AACvB,QAAM,iBAAa,8BAAc,KAAK;AACtC,QAAM,YAAY,QAAQ,2BAA2B,UAAU,KAAK,KAAK;AAUzE,QAAM,sBAAkB,gCAAgB,iBAAiB,wBAAwB,iBAAiB,YAAY;AAC9G,QAAM,4BAAwB,sCAAsB;AACpD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CO,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,IAC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AAA,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;",
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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