@wordpress/components 33.0.1-next.v.202604201441.0 → 33.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (870) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/build/alignment-matrix-control/cell.cjs +79 -5
  3. package/build/alignment-matrix-control/cell.cjs.map +3 -3
  4. package/build/alignment-matrix-control/index.cjs +79 -5
  5. package/build/alignment-matrix-control/index.cjs.map +3 -3
  6. package/build/angle-picker-control/angle-circle.cjs +79 -5
  7. package/build/angle-picker-control/angle-circle.cjs.map +3 -3
  8. package/build/autocomplete/autocompleter-ui.cjs.map +2 -2
  9. package/build/color-palette/index.cjs +14 -8
  10. package/build/color-palette/index.cjs.map +2 -2
  11. package/build/color-palette/utils.cjs +9 -2
  12. package/build/color-palette/utils.cjs.map +2 -2
  13. package/build/color-picker/hex-input.cjs +1 -1
  14. package/build/color-picker/hex-input.cjs.map +2 -2
  15. package/build/custom-gradient-picker/index.cjs.map +2 -2
  16. package/build/focal-point-picker/index.cjs.map +2 -2
  17. package/build/form-token-field/index.cjs +22 -6
  18. package/build/form-token-field/index.cjs.map +3 -3
  19. package/build/form-token-field/token-input.cjs +1 -1
  20. package/build/form-token-field/token-input.cjs.map +2 -2
  21. package/build/menu/popover.cjs +7 -3
  22. package/build/menu/popover.cjs.map +2 -2
  23. package/build/menu/styles.cjs +39 -16
  24. package/build/menu/styles.cjs.map +2 -2
  25. package/build/modal/index.cjs +1 -5
  26. package/build/modal/index.cjs.map +2 -2
  27. package/build/modal/use-modal-exit-animation.cjs +52 -41
  28. package/build/modal/use-modal-exit-animation.cjs.map +2 -2
  29. package/build/palette-edit/index.cjs.map +2 -2
  30. package/build/slot-fill/fill.cjs +2 -2
  31. package/build/slot-fill/fill.cjs.map +2 -2
  32. package/build/style-provider/index.cjs +82 -3
  33. package/build/style-provider/index.cjs.map +4 -4
  34. package/build/text/styles.cjs +7 -7
  35. package/build/text/styles.cjs.map +2 -2
  36. package/build/utils/breakpoint.cjs.map +1 -1
  37. package/build/utils/config-values.cjs +3 -0
  38. package/build/utils/config-values.cjs.map +2 -2
  39. package/build/utils/dropdown-motion.cjs +2 -2
  40. package/build/utils/dropdown-motion.cjs.map +2 -2
  41. package/build/utils/font.cjs.map +1 -1
  42. package/build/visually-hidden/component.cjs +1 -0
  43. package/build/visually-hidden/component.cjs.map +2 -2
  44. package/build-module/alignment-matrix-control/cell.mjs +79 -5
  45. package/build-module/alignment-matrix-control/cell.mjs.map +3 -3
  46. package/build-module/alignment-matrix-control/index.mjs +79 -5
  47. package/build-module/alignment-matrix-control/index.mjs.map +3 -3
  48. package/build-module/angle-picker-control/angle-circle.mjs +79 -5
  49. package/build-module/angle-picker-control/angle-circle.mjs.map +3 -3
  50. package/build-module/autocomplete/autocompleter-ui.mjs.map +2 -2
  51. package/build-module/color-palette/index.mjs +14 -8
  52. package/build-module/color-palette/index.mjs.map +2 -2
  53. package/build-module/color-palette/utils.mjs +9 -2
  54. package/build-module/color-palette/utils.mjs.map +2 -2
  55. package/build-module/color-picker/hex-input.mjs +1 -1
  56. package/build-module/color-picker/hex-input.mjs.map +2 -2
  57. package/build-module/custom-gradient-picker/index.mjs.map +2 -2
  58. package/build-module/focal-point-picker/index.mjs.map +2 -2
  59. package/build-module/form-token-field/index.mjs +22 -6
  60. package/build-module/form-token-field/index.mjs.map +2 -2
  61. package/build-module/form-token-field/token-input.mjs +1 -1
  62. package/build-module/form-token-field/token-input.mjs.map +2 -2
  63. package/build-module/menu/popover.mjs +7 -3
  64. package/build-module/menu/popover.mjs.map +2 -2
  65. package/build-module/menu/styles.mjs +37 -16
  66. package/build-module/menu/styles.mjs.map +2 -2
  67. package/build-module/modal/index.mjs +1 -5
  68. package/build-module/modal/index.mjs.map +2 -2
  69. package/build-module/modal/use-modal-exit-animation.mjs +52 -41
  70. package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
  71. package/build-module/palette-edit/index.mjs.map +2 -2
  72. package/build-module/slot-fill/fill.mjs +2 -2
  73. package/build-module/slot-fill/fill.mjs.map +2 -2
  74. package/build-module/style-provider/index.mjs +82 -3
  75. package/build-module/style-provider/index.mjs.map +4 -4
  76. package/build-module/text/styles.mjs +7 -7
  77. package/build-module/text/styles.mjs.map +2 -2
  78. package/build-module/utils/breakpoint.mjs.map +1 -1
  79. package/build-module/utils/config-values.mjs +3 -0
  80. package/build-module/utils/config-values.mjs.map +2 -2
  81. package/build-module/utils/dropdown-motion.mjs +2 -2
  82. package/build-module/utils/dropdown-motion.mjs.map +2 -2
  83. package/build-module/utils/font.mjs.map +1 -1
  84. package/build-module/visually-hidden/component.mjs +1 -0
  85. package/build-module/visually-hidden/component.mjs.map +2 -2
  86. package/build-style/style-rtl.css +90 -34
  87. package/build-style/style.css +90 -34
  88. package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
  89. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  90. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  91. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  92. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  93. package/build-types/angle-picker-control/index.d.ts +1 -1
  94. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  95. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  96. package/build-types/angle-picker-control/stories/index.story.d.ts.map +1 -1
  97. package/build-types/animate/index.d.ts.map +1 -1
  98. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  99. package/build-types/autocomplete/autocompleter-ui.d.ts +1 -1
  100. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  101. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -1
  102. package/build-types/autocomplete/index.d.ts +3 -3
  103. package/build-types/autocomplete/index.d.ts.map +1 -1
  104. package/build-types/badge/index.d.ts.map +1 -1
  105. package/build-types/badge/stories/index.story.d.ts.map +1 -1
  106. package/build-types/base-control/hooks.d.ts +4 -4
  107. package/build-types/base-control/index.d.ts +2 -2
  108. package/build-types/base-control/index.d.ts.map +1 -1
  109. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  110. package/build-types/border-box-control/border-box-control/component.d.ts +4 -4
  111. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  112. package/build-types/border-box-control/border-box-control/hook.d.ts +124 -124
  113. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  114. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  115. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +117 -117
  116. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +4 -4
  117. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  118. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +116 -116
  119. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  120. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +106 -106
  121. package/build-types/border-box-control/stories/index.story.d.ts +5 -5
  122. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  123. package/build-types/border-box-control/styles.d.ts +3 -3
  124. package/build-types/border-box-control/styles.d.ts.map +1 -1
  125. package/build-types/border-box-control/utils.d.ts.map +1 -1
  126. package/build-types/border-control/border-control/component.d.ts +5 -5
  127. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  128. package/build-types/border-control/border-control/hook.d.ts +129 -129
  129. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  130. package/build-types/border-control/border-control-dropdown/component.d.ts +3 -3
  131. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  132. package/build-types/border-control/border-control-dropdown/hook.d.ts +122 -122
  133. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  134. package/build-types/border-control/border-control-style-picker/component.d.ts +1 -1
  135. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  136. package/build-types/border-control/stories/index.story.d.ts +30 -30
  137. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  138. package/build-types/border-control/styles.d.ts +2 -2
  139. package/build-types/border-control/styles.d.ts.map +1 -1
  140. package/build-types/box-control/index.d.ts +1 -1
  141. package/build-types/box-control/index.d.ts.map +1 -1
  142. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  143. package/build-types/box-control/styles/box-control-styles.d.ts +15 -15
  144. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  145. package/build-types/box-control/utils.d.ts +2 -2
  146. package/build-types/box-control/utils.d.ts.map +1 -1
  147. package/build-types/button/deprecated.d.ts +34 -34
  148. package/build-types/button/deprecated.d.ts.map +1 -1
  149. package/build-types/button/index.d.ts.map +1 -1
  150. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  151. package/build-types/button/stories/index.story.d.ts.map +1 -1
  152. package/build-types/button-group/index.d.ts.map +1 -1
  153. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  154. package/build-types/calendar/date-calendar/index.d.ts.map +1 -1
  155. package/build-types/calendar/date-range-calendar/index.d.ts +1 -1
  156. package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -1
  157. package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -1
  158. package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -1
  159. package/build-types/calendar/test/__utils__/index.d.ts.map +1 -1
  160. package/build-types/calendar/utils/constants.d.ts +2 -2
  161. package/build-types/calendar/utils/constants.d.ts.map +1 -1
  162. package/build-types/calendar/utils/use-localization-props.d.ts +3 -3
  163. package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -1
  164. package/build-types/card/card/component.d.ts.map +1 -1
  165. package/build-types/card/card/hook.d.ts +110 -110
  166. package/build-types/card/card-body/component.d.ts.map +1 -1
  167. package/build-types/card/card-body/hook.d.ts +107 -107
  168. package/build-types/card/card-divider/component.d.ts +2 -2
  169. package/build-types/card/card-divider/component.d.ts.map +1 -1
  170. package/build-types/card/card-divider/hook.d.ts +108 -108
  171. package/build-types/card/card-footer/component.d.ts.map +1 -1
  172. package/build-types/card/card-footer/hook.d.ts +113 -113
  173. package/build-types/card/card-header/component.d.ts.map +1 -1
  174. package/build-types/card/card-header/hook.d.ts +113 -113
  175. package/build-types/card/card-media/component.d.ts.map +1 -1
  176. package/build-types/card/card-media/hook.d.ts +106 -106
  177. package/build-types/card/get-padding-by-size.d.ts +1 -1
  178. package/build-types/card/get-padding-by-size.d.ts.map +1 -1
  179. package/build-types/card/stories/index.story.d.ts +0 -6
  180. package/build-types/card/stories/index.story.d.ts.map +1 -1
  181. package/build-types/checkbox-control/index.d.ts.map +1 -1
  182. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  183. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +1 -1
  184. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  185. package/build-types/circular-option-picker/circular-option-picker.d.ts +8 -0
  186. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  187. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  188. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  189. package/build-types/color-indicator/index.d.ts +1 -1
  190. package/build-types/color-indicator/index.d.ts.map +1 -1
  191. package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
  192. package/build-types/color-palette/index.d.ts.map +1 -1
  193. package/build-types/color-palette/stories/index.story.d.ts +1 -0
  194. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  195. package/build-types/color-palette/styles.d.ts +5 -5
  196. package/build-types/color-palette/types.d.ts +16 -2
  197. package/build-types/color-palette/types.d.ts.map +1 -1
  198. package/build-types/color-palette/utils.d.ts +1 -1
  199. package/build-types/color-palette/utils.d.ts.map +1 -1
  200. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  201. package/build-types/color-picker/color-input.d.ts.map +1 -1
  202. package/build-types/color-picker/component.d.ts +1 -1
  203. package/build-types/color-picker/component.d.ts.map +1 -1
  204. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  205. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  206. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  207. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  208. package/build-types/color-picker/picker.d.ts.map +1 -1
  209. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  210. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  211. package/build-types/color-picker/styles.d.ts +20 -20
  212. package/build-types/color-picker/styles.d.ts.map +1 -1
  213. package/build-types/combobox-control/index.d.ts.map +1 -1
  214. package/build-types/combobox-control/stories/index.story.d.ts +8 -8
  215. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  216. package/build-types/combobox-control/styles.d.ts +1 -1
  217. package/build-types/composite/index.d.ts +25 -25
  218. package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
  219. package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
  220. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  221. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  222. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  223. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  224. package/build-types/context/constants.d.ts +3 -3
  225. package/build-types/context/constants.d.ts.map +1 -1
  226. package/build-types/context/context-system-provider.d.ts +4 -4
  227. package/build-types/context/context-system-provider.d.ts.map +1 -1
  228. package/build-types/context/use-context-system.d.ts +4 -4
  229. package/build-types/context/use-context-system.d.ts.map +1 -1
  230. package/build-types/context/utils.d.ts +2 -2
  231. package/build-types/context/utils.d.ts.map +1 -1
  232. package/build-types/custom-gradient-picker/constants.d.ts +2 -2
  233. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
  234. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +1 -1
  235. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  236. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +1 -1
  237. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  238. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  239. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  240. package/build-types/custom-gradient-picker/serializer.d.ts +3 -3
  241. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  242. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  243. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  244. package/build-types/custom-select-control/index.d.ts.map +1 -1
  245. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  246. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  247. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  248. package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
  249. package/build-types/custom-select-control-v2/stories/index.story.d.ts +6 -6
  250. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  251. package/build-types/custom-select-control-v2/styles.d.ts +6 -6
  252. package/build-types/dashicon/index.d.ts.map +1 -1
  253. package/build-types/date-time/date-picker/index.d.ts +1 -1
  254. package/build-types/date-time/date-picker/index.d.ts.map +1 -1
  255. package/build-types/date-time/date-picker/styles.d.ts +9 -9
  256. package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -1
  257. package/build-types/date-time/date-time/index.d.ts +1 -1
  258. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  259. package/build-types/date-time/date-time/styles.d.ts +4 -4
  260. package/build-types/date-time/index.d.ts.map +1 -1
  261. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  262. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  263. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  264. package/build-types/date-time/time-picker/index.d.ts +1 -1
  265. package/build-types/date-time/time-picker/index.d.ts.map +1 -1
  266. package/build-types/date-time/time-picker/styles.d.ts +28 -28
  267. package/build-types/date-time/time-picker/time-input/index.d.ts +1 -1
  268. package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -1
  269. package/build-types/date-time/time-picker/timezone.d.ts.map +1 -1
  270. package/build-types/date-time/utils.d.ts.map +1 -1
  271. package/build-types/disabled/context.d.ts.map +1 -1
  272. package/build-types/disabled/index.d.ts +2 -0
  273. package/build-types/disabled/index.d.ts.map +1 -1
  274. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  275. package/build-types/disclosure/index.d.ts.map +1 -1
  276. package/build-types/divider/component.d.ts +2 -2
  277. package/build-types/divider/component.d.ts.map +1 -1
  278. package/build-types/divider/stories/index.story.d.ts.map +1 -1
  279. package/build-types/divider/styles.d.ts +2 -2
  280. package/build-types/draggable/index.d.ts +1 -1
  281. package/build-types/draggable/index.d.ts.map +1 -1
  282. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  283. package/build-types/drop-zone/index.d.ts.map +1 -1
  284. package/build-types/drop-zone/provider.d.ts +1 -1
  285. package/build-types/drop-zone/provider.d.ts.map +1 -1
  286. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  287. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  288. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  289. package/build-types/dropdown/index.d.ts.map +1 -1
  290. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  291. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  292. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  293. package/build-types/duotone-picker/color-list-picker/index.d.ts +1 -1
  294. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  295. package/build-types/duotone-picker/custom-duotone-bar.d.ts +1 -1
  296. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -1
  297. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  298. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -1
  299. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  300. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  301. package/build-types/elevation/component.d.ts.map +1 -1
  302. package/build-types/elevation/hook.d.ts +105 -105
  303. package/build-types/elevation/stories/index.story.d.ts.map +1 -1
  304. package/build-types/external-link/index.d.ts.map +1 -1
  305. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  306. package/build-types/flex/context.d.ts +2 -2
  307. package/build-types/flex/flex/component.d.ts.map +1 -1
  308. package/build-types/flex/flex/hook.d.ts +108 -108
  309. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  310. package/build-types/flex/flex-block/hook.d.ts +106 -106
  311. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  312. package/build-types/flex/flex-item/hook.d.ts +106 -106
  313. package/build-types/flex/stories/index.story.d.ts.map +1 -1
  314. package/build-types/focal-point-picker/controls.d.ts +1 -1
  315. package/build-types/focal-point-picker/controls.d.ts.map +1 -1
  316. package/build-types/focal-point-picker/index.d.ts +16 -11
  317. package/build-types/focal-point-picker/index.d.ts.map +1 -1
  318. package/build-types/focal-point-picker/stories/index.story.d.ts +16 -16
  319. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  320. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +254 -254
  321. package/build-types/focal-point-picker/utils.d.ts.map +1 -1
  322. package/build-types/font-size-picker/constants.d.ts +2 -2
  323. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  324. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  325. package/build-types/font-size-picker/index.d.ts.map +1 -1
  326. package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
  327. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  328. package/build-types/font-size-picker/styles.d.ts +5 -5
  329. package/build-types/form-file-upload/index.d.ts.map +1 -1
  330. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  331. package/build-types/form-toggle/index.d.ts +1 -1
  332. package/build-types/form-toggle/index.d.ts.map +1 -1
  333. package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
  334. package/build-types/form-token-field/index.d.ts.map +1 -1
  335. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  336. package/build-types/form-token-field/styles.d.ts +1 -1
  337. package/build-types/form-token-field/suggestions-list.d.ts +1 -1
  338. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  339. package/build-types/form-token-field/token-input.d.ts +1 -1
  340. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  341. package/build-types/form-token-field/token.d.ts +1 -1
  342. package/build-types/form-token-field/token.d.ts.map +1 -1
  343. package/build-types/form-token-field/types.d.ts +16 -2
  344. package/build-types/form-token-field/types.d.ts.map +1 -1
  345. package/build-types/gradient-picker/index.d.ts.map +1 -1
  346. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  347. package/build-types/grid/component.d.ts.map +1 -1
  348. package/build-types/grid/hook.d.ts +106 -106
  349. package/build-types/grid/stories/index.story.d.ts.map +1 -1
  350. package/build-types/grid/utils.d.ts.map +1 -1
  351. package/build-types/guide/index.d.ts +1 -1
  352. package/build-types/guide/index.d.ts.map +1 -1
  353. package/build-types/guide/page-control.d.ts +1 -1
  354. package/build-types/guide/page-control.d.ts.map +1 -1
  355. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  356. package/build-types/h-stack/component.d.ts +3 -3
  357. package/build-types/h-stack/component.d.ts.map +1 -1
  358. package/build-types/h-stack/hook.d.ts +107 -107
  359. package/build-types/h-stack/stories/e2e/index.story.d.ts.map +1 -1
  360. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  361. package/build-types/heading/component.d.ts +4 -4
  362. package/build-types/heading/component.d.ts.map +1 -1
  363. package/build-types/heading/hook.d.ts +107 -107
  364. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  365. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -1
  366. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  367. package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -1
  368. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -1
  369. package/build-types/higher-order/with-filters/index.d.ts +2 -2
  370. package/build-types/higher-order/with-focus-outside/index.d.ts.map +1 -1
  371. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -1
  372. package/build-types/higher-order/with-notices/index.d.ts +3 -3
  373. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  374. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  375. package/build-types/icon/index.d.ts.map +1 -1
  376. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  377. package/build-types/input-control/backdrop.d.ts.map +1 -1
  378. package/build-types/input-control/index.d.ts.map +1 -1
  379. package/build-types/input-control/input-base.d.ts.map +1 -1
  380. package/build-types/input-control/input-field.d.ts +1 -1
  381. package/build-types/input-control/input-field.d.ts.map +1 -1
  382. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  383. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  384. package/build-types/input-control/reducer/reducer.d.ts +9 -9
  385. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  386. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  387. package/build-types/input-control/styles/input-control-styles.d.ts +3 -3
  388. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  389. package/build-types/isolated-event-container/index.d.ts.map +1 -1
  390. package/build-types/item-group/item/component.d.ts.map +1 -1
  391. package/build-types/item-group/item/hook.d.ts +104 -104
  392. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  393. package/build-types/item-group/item-group/hook.d.ts +105 -105
  394. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  395. package/build-types/item-group/styles.d.ts +1 -1
  396. package/build-types/item-group/styles.d.ts.map +1 -1
  397. package/build-types/keyboard-shortcuts/index.d.ts +1 -1
  398. package/build-types/keyboard-shortcuts/index.d.ts.map +1 -1
  399. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  400. package/build-types/lock-unlock.d.ts +1 -2
  401. package/build-types/lock-unlock.d.ts.map +1 -1
  402. package/build-types/menu/group-label.d.ts +1 -1
  403. package/build-types/menu/group.d.ts +1 -1
  404. package/build-types/menu/index.d.ts +5 -5
  405. package/build-types/menu/index.d.ts.map +1 -1
  406. package/build-types/menu/item-help-text.d.ts +1 -1
  407. package/build-types/menu/item-label.d.ts +1 -1
  408. package/build-types/menu/popover.d.ts.map +1 -1
  409. package/build-types/menu/separator.d.ts +1 -1
  410. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  411. package/build-types/menu/styles.d.ts +23 -8
  412. package/build-types/menu/styles.d.ts.map +1 -1
  413. package/build-types/menu-group/index.d.ts.map +1 -1
  414. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  415. package/build-types/menu-item/index.d.ts +2 -2
  416. package/build-types/menu-item/index.d.ts.map +1 -1
  417. package/build-types/menu-item/stories/index.story.d.ts +8 -8
  418. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  419. package/build-types/menu-items-choice/index.d.ts +1 -1
  420. package/build-types/menu-items-choice/index.d.ts.map +1 -1
  421. package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
  422. package/build-types/mobile/image/constants.d.ts +4 -4
  423. package/build-types/mobile/image/constants.d.ts.map +1 -1
  424. package/build-types/modal/index.d.ts.map +1 -1
  425. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  426. package/build-types/modal/use-modal-exit-animation.d.ts +0 -3
  427. package/build-types/modal/use-modal-exit-animation.d.ts.map +1 -1
  428. package/build-types/navigable-container/container.d.ts +2 -2
  429. package/build-types/navigable-container/container.d.ts.map +1 -1
  430. package/build-types/navigable-container/menu.d.ts +1 -1
  431. package/build-types/navigable-container/menu.d.ts.map +1 -1
  432. package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
  433. package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
  434. package/build-types/navigable-container/tabbable.d.ts +2 -2
  435. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  436. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  437. package/build-types/navigation/group/index.d.ts +1 -1
  438. package/build-types/navigation/group/index.d.ts.map +1 -1
  439. package/build-types/navigation/index.d.ts +1 -1
  440. package/build-types/navigation/index.d.ts.map +1 -1
  441. package/build-types/navigation/item/index.d.ts.map +1 -1
  442. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -1
  443. package/build-types/navigation/menu/index.d.ts.map +1 -1
  444. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -1
  445. package/build-types/navigation/menu/menu-title.d.ts +1 -1
  446. package/build-types/navigation/menu/menu-title.d.ts.map +1 -1
  447. package/build-types/navigation/menu/search-no-results-found.d.ts +1 -1
  448. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -1
  449. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -1
  450. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  451. package/build-types/navigation/styles/navigation-styles.d.ts +6 -6
  452. package/build-types/navigation/utils.d.ts.map +1 -1
  453. package/build-types/navigator/index.d.ts +12 -12
  454. package/build-types/navigator/legacy.d.ts +18 -18
  455. package/build-types/navigator/navigator-back-button/component.d.ts +6 -6
  456. package/build-types/navigator/navigator-back-button/hook.d.ts +136 -136
  457. package/build-types/navigator/navigator-button/component.d.ts +6 -6
  458. package/build-types/navigator/navigator-button/hook.d.ts +136 -136
  459. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +1 -1
  460. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -1
  461. package/build-types/navigator/navigator-to-parent-button/component.d.ts +6 -6
  462. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  463. package/build-types/navigator/styles.d.ts.map +1 -1
  464. package/build-types/notice/index.d.ts +1 -1
  465. package/build-types/notice/index.d.ts.map +1 -1
  466. package/build-types/notice/list.d.ts +1 -1
  467. package/build-types/notice/list.d.ts.map +1 -1
  468. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  469. package/build-types/number-control/index.d.ts +7 -7
  470. package/build-types/number-control/index.d.ts.map +1 -1
  471. package/build-types/number-control/stories/index.story.d.ts +7 -7
  472. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  473. package/build-types/palette-edit/index.d.ts +1 -1
  474. package/build-types/palette-edit/index.d.ts.map +1 -1
  475. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  476. package/build-types/palette-edit/styles.d.ts +759 -759
  477. package/build-types/panel/body.d.ts.map +1 -1
  478. package/build-types/panel/header.d.ts.map +1 -1
  479. package/build-types/panel/index.d.ts.map +1 -1
  480. package/build-types/panel/row.d.ts.map +1 -1
  481. package/build-types/panel/stories/index.story.d.ts.map +1 -1
  482. package/build-types/placeholder/index.d.ts.map +1 -1
  483. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  484. package/build-types/popover/index.d.ts +1 -1
  485. package/build-types/popover/index.d.ts.map +1 -1
  486. package/build-types/popover/overlay-middlewares.d.ts +2 -2
  487. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  488. package/build-types/popover/stories/e2e/index.story.d.ts.map +1 -1
  489. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  490. package/build-types/popover/test/utils/index.d.ts.map +1 -1
  491. package/build-types/popover/utils.d.ts +3 -3
  492. package/build-types/popover/utils.d.ts.map +1 -1
  493. package/build-types/progress-bar/index.d.ts +1 -1
  494. package/build-types/progress-bar/index.d.ts.map +1 -1
  495. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  496. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  497. package/build-types/query-controls/author-select.d.ts +1 -1
  498. package/build-types/query-controls/author-select.d.ts.map +1 -1
  499. package/build-types/query-controls/index.d.ts.map +1 -1
  500. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  501. package/build-types/radio-control/index.d.ts.map +1 -1
  502. package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
  503. package/build-types/radio-group/index.d.ts.map +1 -1
  504. package/build-types/radio-group/radio.d.ts +1 -1
  505. package/build-types/radio-group/radio.d.ts.map +1 -1
  506. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  507. package/build-types/range-control/index.d.ts +8 -8
  508. package/build-types/range-control/index.d.ts.map +1 -1
  509. package/build-types/range-control/input-range.d.ts +1 -1
  510. package/build-types/range-control/input-range.d.ts.map +1 -1
  511. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  512. package/build-types/range-control/styles/range-control-styles.d.ts +9 -9
  513. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  514. package/build-types/range-control/utils.d.ts +1 -1
  515. package/build-types/range-control/utils.d.ts.map +1 -1
  516. package/build-types/resizable-box/index.d.ts.map +1 -1
  517. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  518. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  519. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -1
  520. package/build-types/resizable-box/resize-tooltip/utils.d.ts +3 -3
  521. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  522. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  523. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  524. package/build-types/responsive-wrapper/index.d.ts +1 -1
  525. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  526. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  527. package/build-types/sandbox/index.d.ts.map +1 -1
  528. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  529. package/build-types/scroll-lock/index.d.ts.map +1 -1
  530. package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
  531. package/build-types/scrollable/component.d.ts.map +1 -1
  532. package/build-types/scrollable/hook.d.ts +106 -106
  533. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  534. package/build-types/search-control/index.d.ts +9 -9
  535. package/build-types/search-control/index.d.ts.map +1 -1
  536. package/build-types/search-control/stories/index.story.d.ts +9 -9
  537. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  538. package/build-types/select-control/chevron-down.d.ts.map +1 -1
  539. package/build-types/select-control/index.d.ts +1 -1
  540. package/build-types/select-control/index.d.ts.map +1 -1
  541. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  542. package/build-types/select-control/styles/select-control-styles.d.ts +2 -2
  543. package/build-types/shortcut/index.d.ts.map +1 -1
  544. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  545. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  546. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  547. package/build-types/slot-fill/context.d.ts.map +1 -1
  548. package/build-types/slot-fill/index.d.ts +2 -2
  549. package/build-types/slot-fill/index.d.ts.map +1 -1
  550. package/build-types/slot-fill/provider.d.ts.map +1 -1
  551. package/build-types/slot-fill/slot.d.ts.map +1 -1
  552. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  553. package/build-types/snackbar/index.d.ts +3 -3
  554. package/build-types/snackbar/index.d.ts.map +1 -1
  555. package/build-types/snackbar/list.d.ts +1 -1
  556. package/build-types/snackbar/list.d.ts.map +1 -1
  557. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  558. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  559. package/build-types/spacer/component.d.ts.map +1 -1
  560. package/build-types/spacer/hook.d.ts +106 -106
  561. package/build-types/spacer/stories/index.story.d.ts.map +1 -1
  562. package/build-types/spinner/index.d.ts.map +1 -1
  563. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  564. package/build-types/style-provider/index.d.ts +0 -3
  565. package/build-types/style-provider/index.d.ts.map +1 -1
  566. package/build-types/style-provider/test/index.d.ts.map +1 -0
  567. package/build-types/surface/component.d.ts.map +1 -1
  568. package/build-types/surface/hook.d.ts +106 -106
  569. package/build-types/surface/stories/index.story.d.ts.map +1 -1
  570. package/build-types/surface/styles.d.ts +1 -1
  571. package/build-types/surface/styles.d.ts.map +1 -1
  572. package/build-types/tab-panel/index.d.ts.map +1 -1
  573. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  574. package/build-types/tabs/index.d.ts +1 -1
  575. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  576. package/build-types/tabs/styles.d.ts +3 -3
  577. package/build-types/tabs/tablist.d.ts +1 -1
  578. package/build-types/text/component.d.ts.map +1 -1
  579. package/build-types/text/hook.d.ts +106 -106
  580. package/build-types/text/stories/index.story.d.ts +3 -3
  581. package/build-types/text/stories/index.story.d.ts.map +1 -1
  582. package/build-types/text/utils.d.ts +1 -1
  583. package/build-types/text/utils.d.ts.map +1 -1
  584. package/build-types/text-control/index.d.ts +3 -3
  585. package/build-types/text-control/index.d.ts.map +1 -1
  586. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  587. package/build-types/text-highlight/index.d.ts +4 -19
  588. package/build-types/text-highlight/index.d.ts.map +1 -1
  589. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  590. package/build-types/textarea-control/index.d.ts +3 -3
  591. package/build-types/textarea-control/index.d.ts.map +1 -1
  592. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  593. package/build-types/theme/color-algorithms.d.ts +1 -1
  594. package/build-types/theme/color-algorithms.d.ts.map +1 -1
  595. package/build-types/theme/index.d.ts.map +1 -1
  596. package/build-types/theme/stories/index.story.d.ts +1 -1
  597. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  598. package/build-types/theme/styles.d.ts.map +1 -1
  599. package/build-types/tip/index.d.ts.map +1 -1
  600. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  601. package/build-types/toggle-control/index.d.ts +2 -2
  602. package/build-types/toggle-control/index.d.ts.map +1 -1
  603. package/build-types/toggle-control/stories/index.story.d.ts +4 -4
  604. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  605. package/build-types/toggle-group-control/context.d.ts.map +1 -1
  606. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  607. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
  608. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
  609. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
  610. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  611. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +3 -3
  612. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  613. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -2
  614. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  615. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
  616. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  617. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +1 -1
  618. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  619. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  620. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  621. package/build-types/toolbar/index.d.ts +6 -6
  622. package/build-types/toolbar/index.d.ts.map +1 -1
  623. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  624. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  625. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
  626. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  627. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  628. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  629. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -1
  630. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
  631. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
  632. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +1 -1
  633. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
  634. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  635. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  636. package/build-types/tools-panel/styles.d.ts.map +1 -1
  637. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  638. package/build-types/tools-panel/tools-panel/hook.d.ts +128 -128
  639. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  640. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  641. package/build-types/tools-panel/tools-panel-header/hook.d.ts +116 -116
  642. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  643. package/build-types/tools-panel/tools-panel-item/hook.d.ts +108 -108
  644. package/build-types/tooltip/index.d.ts.map +1 -1
  645. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  646. package/build-types/tree-grid/cell.d.ts.map +1 -1
  647. package/build-types/tree-grid/index.d.ts.map +1 -1
  648. package/build-types/tree-grid/item.d.ts.map +1 -1
  649. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
  650. package/build-types/tree-grid/roving-tab-index.d.ts +1 -1
  651. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -1
  652. package/build-types/tree-grid/row.d.ts.map +1 -1
  653. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  654. package/build-types/tree-select/index.d.ts.map +1 -1
  655. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  656. package/build-types/truncate/component.d.ts.map +1 -1
  657. package/build-types/truncate/hook.d.ts +106 -106
  658. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  659. package/build-types/truncate/utils.d.ts +5 -5
  660. package/build-types/truncate/utils.d.ts.map +1 -1
  661. package/build-types/unit-control/index.d.ts +2 -2
  662. package/build-types/unit-control/index.d.ts.map +1 -1
  663. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  664. package/build-types/unit-control/styles/unit-control-styles.d.ts +7 -7
  665. package/build-types/unit-control/unit-select-control.d.ts +1 -1
  666. package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
  667. package/build-types/unit-control/utils.d.ts.map +1 -1
  668. package/build-types/utils/breakpoint-values.d.ts.map +1 -1
  669. package/build-types/utils/breakpoint.d.ts +9 -1
  670. package/build-types/utils/breakpoint.d.ts.map +1 -1
  671. package/build-types/utils/colors-values.d.ts +1 -1
  672. package/build-types/utils/colors-values.d.ts.map +1 -1
  673. package/build-types/utils/colors.d.ts +3 -3
  674. package/build-types/utils/colors.d.ts.map +1 -1
  675. package/build-types/utils/deprecated-36px-size.d.ts +1 -1
  676. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
  677. package/build-types/utils/dropdown-motion.d.ts +3 -3
  678. package/build-types/utils/dropdown-motion.d.ts.map +1 -1
  679. package/build-types/utils/font-values.d.ts.map +1 -1
  680. package/build-types/utils/font.d.ts +6 -2
  681. package/build-types/utils/font.d.ts.map +1 -1
  682. package/build-types/utils/get-node-text.d.ts.map +1 -1
  683. package/build-types/utils/hooks/index.d.ts +4 -4
  684. package/build-types/utils/hooks/index.d.ts.map +1 -1
  685. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +1 -1
  686. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
  687. package/build-types/utils/hooks/use-controlled-state.d.ts +2 -8
  688. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  689. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  690. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  691. package/build-types/utils/hooks/use-update-effect.d.ts +1 -1
  692. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  693. package/build-types/utils/index.d.ts +2 -2
  694. package/build-types/utils/index.d.ts.map +1 -1
  695. package/build-types/utils/math.d.ts +5 -5
  696. package/build-types/utils/math.d.ts.map +1 -1
  697. package/build-types/utils/rtl.d.ts +11 -16
  698. package/build-types/utils/rtl.d.ts.map +1 -1
  699. package/build-types/utils/strings.d.ts.map +1 -1
  700. package/build-types/utils/style-mixins.d.ts +9 -9
  701. package/build-types/utils/style-mixins.d.ts.map +1 -1
  702. package/build-types/utils/use-responsive-value.d.ts.map +1 -1
  703. package/build-types/utils/values.d.ts +19 -5
  704. package/build-types/utils/values.d.ts.map +1 -1
  705. package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -1
  706. package/build-types/v-stack/component.d.ts +3 -3
  707. package/build-types/v-stack/component.d.ts.map +1 -1
  708. package/build-types/v-stack/hook.d.ts +107 -107
  709. package/build-types/v-stack/stories/e2e/index.story.d.ts.map +1 -1
  710. package/build-types/v-stack/stories/index.story.d.ts +4 -4
  711. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  712. package/build-types/validated-form-controls/components/checkbox-control.d.ts +2 -2
  713. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  714. package/build-types/validated-form-controls/components/number-control.d.ts +7 -7
  715. package/build-types/validated-form-controls/components/radio-control.d.ts +2 -2
  716. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
  717. package/build-types/validated-form-controls/components/range-control.d.ts +8 -8
  718. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  719. package/build-types/validated-form-controls/components/select-control.d.ts +1 -1
  720. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
  721. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
  722. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
  723. package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -1
  724. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
  725. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
  726. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  727. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
  728. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
  729. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
  730. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
  731. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
  732. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
  733. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
  734. package/build-types/validated-form-controls/components/text-control.d.ts +3 -3
  735. package/build-types/validated-form-controls/components/textarea-control.d.ts +3 -3
  736. package/build-types/validated-form-controls/components/toggle-control.d.ts +2 -2
  737. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +3 -3
  738. package/build-types/validated-form-controls/control-with-error.d.ts +1 -1
  739. package/build-types/validated-form-controls/validity-indicator.d.ts +1 -1
  740. package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
  741. package/build-types/view/component.d.ts +251 -251
  742. package/build-types/view/component.d.ts.map +1 -1
  743. package/build-types/view/stories/index.story.d.ts.map +1 -1
  744. package/build-types/visually-hidden/component.d.ts.map +1 -1
  745. package/build-types/visually-hidden/stories/index.story.d.ts +0 -6
  746. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
  747. package/build-types/z-stack/component.d.ts.map +1 -1
  748. package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
  749. package/package.json +24 -23
  750. package/src/alignment-matrix-control/stories/index.story.tsx +1 -1
  751. package/src/angle-picker-control/stories/index.story.tsx +1 -1
  752. package/src/autocomplete/autocompleter-ui.tsx +0 -1
  753. package/src/base-control/stories/index.story.tsx +1 -1
  754. package/src/border-box-control/stories/index.story.tsx +1 -1
  755. package/src/border-control/stories/index.story.tsx +1 -1
  756. package/src/button/stories/index.story.tsx +1 -1
  757. package/src/button/style.scss +2 -0
  758. package/src/button-group/style.scss +1 -2
  759. package/src/card/stories/index.story.tsx +2 -9
  760. package/src/checkbox-control/stories/index.story.tsx +1 -1
  761. package/src/circular-option-picker/style.scss +8 -6
  762. package/src/color-indicator/stories/index.story.tsx +1 -1
  763. package/src/color-palette/index.tsx +25 -9
  764. package/src/color-palette/stories/index.story.tsx +21 -3
  765. package/src/color-palette/test/index.tsx +152 -1
  766. package/src/color-palette/test/utils.ts +18 -0
  767. package/src/color-palette/types.ts +19 -2
  768. package/src/color-palette/utils.ts +14 -2
  769. package/src/color-picker/hex-input.tsx +1 -1
  770. package/src/color-picker/stories/index.story.tsx +1 -1
  771. package/src/color-picker/test/index.tsx +24 -2
  772. package/src/combobox-control/stories/index.story.tsx +1 -1
  773. package/src/composite/legacy/test/index.tsx +13 -13
  774. package/src/composite/stories/index.story.tsx +1 -1
  775. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  776. package/src/custom-gradient-picker/index.tsx +0 -1
  777. package/src/custom-select-control/stories/index.story.tsx +1 -1
  778. package/src/disabled/stories/index.story.tsx +1 -1
  779. package/src/drop-zone/stories/index.story.tsx +1 -1
  780. package/src/dropdown/stories/index.story.tsx +1 -1
  781. package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
  782. package/src/duotone-picker/stories/duotone-swatch.story.tsx +1 -1
  783. package/src/external-link/stories/index.story.tsx +2 -2
  784. package/src/external-link/style.scss +34 -2
  785. package/src/focal-point-picker/README.md +12 -8
  786. package/src/focal-point-picker/index.tsx +16 -11
  787. package/src/focal-point-picker/stories/index.story.tsx +1 -1
  788. package/src/font-size-picker/stories/index.story.tsx +1 -1
  789. package/src/form-file-upload/stories/index.story.tsx +1 -1
  790. package/src/form-toggle/stories/index.story.tsx +1 -1
  791. package/src/form-toggle/style.scss +3 -2
  792. package/src/form-token-field/README.md +2 -1
  793. package/src/form-token-field/index.tsx +39 -9
  794. package/src/form-token-field/stories/index.story.tsx +2 -1
  795. package/src/form-token-field/test/index.tsx +70 -10
  796. package/src/form-token-field/token-input.tsx +1 -6
  797. package/src/form-token-field/types.ts +16 -2
  798. package/src/gradient-picker/stories/index.story.tsx +1 -1
  799. package/src/guide/stories/index.story.tsx +1 -1
  800. package/src/higher-order/with-notices/test/index.tsx +12 -10
  801. package/src/icon/stories/index.story.tsx +1 -1
  802. package/src/input-control/stories/index.story.tsx +1 -1
  803. package/src/item-group/stories/index.story.tsx +1 -1
  804. package/src/keyboard-shortcuts/stories/index.story.tsx +1 -1
  805. package/src/menu/popover.tsx +15 -8
  806. package/src/menu/stories/index.story.tsx +1 -1
  807. package/src/menu/styles.ts +25 -15
  808. package/src/menu/test/index.tsx +28 -37
  809. package/src/menu-group/stories/index.story.tsx +1 -1
  810. package/src/menu-item/stories/index.story.tsx +1 -1
  811. package/src/menu-items-choice/stories/index.story.tsx +1 -1
  812. package/src/modal/index.tsx +2 -7
  813. package/src/modal/stories/index.story.tsx +1 -1
  814. package/src/modal/style.scss +68 -24
  815. package/src/modal/use-modal-exit-animation.ts +10 -7
  816. package/src/navigator/stories/index.story.tsx +1 -1
  817. package/src/notice/stories/index.story.tsx +1 -1
  818. package/src/notice/test/__snapshots__/index.tsx.snap +1 -0
  819. package/src/number-control/stories/index.story.tsx +1 -1
  820. package/src/palette-edit/index.tsx +0 -1
  821. package/src/palette-edit/stories/index.story.tsx +1 -1
  822. package/src/panel/stories/index.story.tsx +1 -1
  823. package/src/placeholder/stories/index.story.tsx +1 -1
  824. package/src/popover/stories/index.story.tsx +1 -1
  825. package/src/popover/style.scss +0 -4
  826. package/src/progress-bar/stories/index.story.tsx +1 -1
  827. package/src/query-controls/stories/index.story.tsx +1 -1
  828. package/src/radio-control/stories/index.story.tsx +1 -1
  829. package/src/range-control/stories/index.story.tsx +1 -1
  830. package/src/resizable-box/stories/index.story.tsx +1 -1
  831. package/src/resizable-box/style.scss +4 -5
  832. package/src/sandbox/stories/index.story.tsx +1 -1
  833. package/src/scroll-lock/stories/index.story.tsx +1 -1
  834. package/src/search-control/stories/index.story.tsx +1 -1
  835. package/src/select-control/stories/index.story.tsx +1 -1
  836. package/src/shortcut/stories/index.story.tsx +1 -1
  837. package/src/slot-fill/fill.tsx +2 -2
  838. package/src/slot-fill/stories/index.story.tsx +1 -1
  839. package/src/snackbar/stories/index.story.tsx +1 -1
  840. package/src/spinner/stories/index.story.tsx +1 -1
  841. package/src/style-provider/index.tsx +10 -7
  842. package/src/style-provider/test/index.tsx +38 -0
  843. package/src/tab-panel/style.scss +2 -2
  844. package/src/tabs/stories/index.story.tsx +1 -1
  845. package/src/text/styles.ts +1 -1
  846. package/src/text/test/index.tsx +1 -1
  847. package/src/text-control/stories/index.story.tsx +1 -1
  848. package/src/text-highlight/stories/index.story.tsx +1 -1
  849. package/src/textarea-control/stories/index.story.tsx +1 -1
  850. package/src/toggle-control/stories/index.story.tsx +1 -1
  851. package/src/toggle-group-control/stories/index.story.tsx +1 -1
  852. package/src/toolbar/stories/index.story.tsx +1 -1
  853. package/src/toolbar/toolbar-group/index.tsx +2 -2
  854. package/src/tools-panel/stories/index.story.tsx +1 -1
  855. package/src/tooltip/stories/index.story.tsx +1 -1
  856. package/src/tooltip/test/index.tsx +3 -2
  857. package/src/tree-grid/stories/index.story.tsx +1 -1
  858. package/src/tree-select/stories/index.story.tsx +1 -1
  859. package/src/truncate/stories/index.story.tsx +1 -1
  860. package/src/unit-control/stories/index.story.tsx +1 -1
  861. package/src/utils/breakpoint.js +1 -1
  862. package/src/utils/config-values.js +3 -0
  863. package/src/utils/dropdown-motion.ts +6 -2
  864. package/src/utils/font.js +1 -1
  865. package/src/visually-hidden/component.tsx +1 -0
  866. package/src/visually-hidden/stories/index.story.tsx +2 -9
  867. package/build-types/visually-hidden/test/index.d.ts.map +0 -1
  868. package/src/visually-hidden/test/__snapshots__/index.tsx.snap +0 -12
  869. package/src/visually-hidden/test/index.tsx +0 -17
  870. /package/build-types/{visually-hidden → style-provider}/test/index.d.ts +0 -0
@@ -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;AAA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end } 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+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AAAL,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;",
6
6
  "names": ["namesPlugin", "a11yPlugin", "_jsx", "CircularOptionPicker", "_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\",\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,QAAW;AAC3B;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;",
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,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AA,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;A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AAM,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;",
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;AA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A,KAAK;AAAA,QACL,MAAM;AAAA,QACN,UAAU;AAAA,QACV,UAAU,CAAc,uCAAAC,KAAK,YAAAC,SAAM;AAAA,UACjC;AAAA,UACA,aAAa;AAAA,QACf,CAAC,GAAgB,uCAAAD,KAAK,aAAAE,SAAO;AAAA,UAC3B,SAAK,gBAAG,eAAe;AAAA,UACvB;AAAA,UACA,QAAQ,gBAAgB;AAAA,UACxB,KAAK;AAAA,QACP,CAAC,GAAgB,uCAAAF,KAAK,mBAAAG,SAAY;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QACF,CAAC,CAAC;AAAA,MACJ,CAAC;AAAA,IACH,CAAC,GAAgB,uCAAAH,KAAK,gBAAAI,SAAU;AAAA,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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KAAK;AAAA,QACP,CAAC,GAAgB,uCAAAF,KAAK,mBAAAG,SAAY;AAAA,UAChC,GAAG;AAAA,UACH;AAAA,QACF,CAAC,CAAC;AAAA,MACJ,CAAC;AAAA,IACH,CAAC,GAAgB,uCAAAH,KAAK,gBAAAI,SAAU;AAAA,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;",
6
6
  "names": ["useDragging", "clsx", "_jsxs", "_jsx", "Grid", "Media", "FocalPoint", "Controls"]
7
7
  }
@@ -40,6 +40,7 @@ var import_i18n = require("@wordpress/i18n");
40
40
  var import_compose = require("@wordpress/compose");
41
41
  var import_a11y = require("@wordpress/a11y");
42
42
  var import_is_shallow_equal = require("@wordpress/is-shallow-equal");
43
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
43
44
  var import_token = __toESM(require("./token.cjs"));
44
45
  var import_token_input = __toESM(require("./token-input.cjs"));
45
46
  var import_styles = require("./styles.cjs");
@@ -81,16 +82,29 @@ function FormTokenField(props) {
81
82
  __experimentalRenderItem,
82
83
  __experimentalExpandOnFocus = false,
83
84
  __experimentalValidateInput = () => true,
84
- __experimentalShowHowTo = true,
85
+ __experimentalShowHowTo,
85
86
  __next40pxDefaultSize = false,
86
87
  __experimentalAutoSelectFirstMatch = false,
87
- tokenizeOnBlur = false
88
+ tokenizeOnBlur = false,
89
+ help
88
90
  } = (0, import_use_deprecated_props.useDeprecated36pxDefaultSizeProp)(props);
89
91
  (0, import_deprecated_36px_size.maybeWarnDeprecated36pxSize)({
90
92
  componentName: "FormTokenField",
91
93
  size: void 0,
92
94
  __next40pxDefaultSize
93
95
  });
96
+ const defaultHelp = tokenizeOnSpace ? (0, import_i18n.__)("Separate with commas, spaces, or the Enter key.") : (0, import_i18n.__)("Separate with commas or the Enter key.");
97
+ let computedHelp = help !== void 0 ? help : defaultHelp;
98
+ if (typeof __experimentalShowHowTo === "boolean") {
99
+ (0, import_deprecated.default)("`__experimentalShowHowTo` prop in wp.components.FormTokenField", {
100
+ since: "7.1",
101
+ alternative: "`help` prop",
102
+ hint: "The `help` prop now defaults to the previous how-to text. Pass an empty string to hide it."
103
+ });
104
+ if (__experimentalShowHowTo === false && help === void 0) {
105
+ computedHelp = "";
106
+ }
107
+ }
94
108
  const instanceId = (0, import_compose.useInstanceId)(FormTokenField);
95
109
  const [incompleteTokenValue, setIncompleteTokenValue] = (0, import_element.useState)("");
96
110
  const [inputOffsetFromEnd, setInputOffsetFromEnd] = (0, import_element.useState)(0);
@@ -483,6 +497,7 @@ function FormTokenField(props) {
483
497
  }, "token-" + _value);
484
498
  }
485
499
  function renderInput() {
500
+ const describedById = computedHelp ? `components-form-token-input-${instanceId}__help` : void 0;
486
501
  const inputProps = {
487
502
  instanceId,
488
503
  autoCapitalize,
@@ -492,7 +507,8 @@ function FormTokenField(props) {
492
507
  value: incompleteTokenValue,
493
508
  onBlur,
494
509
  isExpanded,
495
- selectedSuggestionIndex
510
+ selectedSuggestionIndex,
511
+ "aria-describedby": describedById
496
512
  };
497
513
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_token_input.default, {
498
514
  ...inputProps,
@@ -547,10 +563,10 @@ function FormTokenField(props) {
547
563
  onSelect: onSuggestionSelected,
548
564
  __experimentalRenderItem
549
565
  })]
550
- }), __experimentalShowHowTo && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_base_control_styles.StyledHelp, {
551
- id: `components-form-token-suggestions-howto-${instanceId}`,
566
+ }), computedHelp && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_base_control_styles.StyledHelp, {
567
+ id: `components-form-token-input-${instanceId}__help`,
552
568
  className: "components-form-token-field__help",
553
- children: tokenizeOnSpace ? (0, import_i18n.__)("Separate with commas, spaces, or the Enter key.") : (0, import_i18n.__)("Separate with commas or the Enter key.")
569
+ children: computedHelp
554
570
  })]
555
571
  });
556
572
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/form-token-field/index.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useDebounce, useInstanceId, usePrevious } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport Token from './token';\nimport TokenInput from './token-input';\nimport { TokensAndInputWrapperFlex } from './styles';\nimport SuggestionsList from './suggestions-list';\nimport { FlexItem } from '../flex';\nimport { StyledHelp, StyledLabel } from '../base-control/styles/base-control-styles';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst identity = value => value;\n\n/**\n * A `FormTokenField` is a field similar to the tags and categories fields in the interim editor chrome,\n * or the \"to\" field in Mail on OS X. Tokens can be entered by typing them or selecting them from a list of suggested tokens.\n *\n * Up to one hundred suggestions that match what the user has typed so far will be shown from which the user can pick from (auto-complete).\n * Tokens are separated by the \",\" character. Suggestions can be selected with the up or down arrows and added with the tab or enter key.\n *\n * The `value` property is handled in a manner similar to controlled form components.\n * See [Forms](https://react.dev/reference/react-dom/components#form-components) in the React Documentation for more information.\n */\nexport function FormTokenField(props) {\n const {\n autoCapitalize,\n autoComplete,\n maxLength,\n placeholder,\n label = __('Add item'),\n className,\n suggestions = [],\n maxSuggestions = 100,\n value = [],\n displayTransform = identity,\n saveTransform = token => token.trim(),\n onChange = () => {},\n onInputChange = () => {},\n onFocus = undefined,\n isBorderless = false,\n disabled = false,\n tokenizeOnSpace = false,\n messages = {\n added: __('Item added.'),\n removed: __('Item removed.'),\n remove: __('Remove item'),\n __experimentalInvalid: __('Invalid item')\n },\n __experimentalRenderItem,\n __experimentalExpandOnFocus = false,\n __experimentalValidateInput = () => true,\n __experimentalShowHowTo = true,\n __next40pxDefaultSize = false,\n __experimentalAutoSelectFirstMatch = false,\n tokenizeOnBlur = false\n } = useDeprecated36pxDefaultSizeProp(props);\n maybeWarnDeprecated36pxSize({\n componentName: 'FormTokenField',\n size: undefined,\n __next40pxDefaultSize\n });\n const instanceId = useInstanceId(FormTokenField);\n\n // We reset to these initial values again in the onBlur\n const [incompleteTokenValue, setIncompleteTokenValue] = useState('');\n const [inputOffsetFromEnd, setInputOffsetFromEnd] = useState(0);\n const [isActive, setIsActive] = useState(false);\n const [isExpanded, setIsExpanded] = useState(false);\n const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(-1);\n const [selectedSuggestionScroll, setSelectedSuggestionScroll] = useState(false);\n const prevSuggestions = usePrevious(suggestions);\n const prevValue = usePrevious(value);\n const input = useRef(null);\n const tokensAndInput = useRef(null);\n const debouncedSpeak = useDebounce(speak, 500);\n useEffect(() => {\n // Make sure to focus the input when the isActive state is true.\n if (isActive && !hasFocus()) {\n focus();\n }\n }, [isActive]);\n useEffect(() => {\n const suggestionsDidUpdate = !isShallowEqual(suggestions, prevSuggestions || []);\n if (suggestionsDidUpdate || value !== prevValue) {\n updateSuggestions(suggestionsDidUpdate);\n }\n\n // TODO: updateSuggestions() should first be refactored so its actual deps are clearer.\n }, [suggestions, prevSuggestions, value, prevValue]);\n useEffect(() => {\n updateSuggestions();\n }, [incompleteTokenValue]);\n useEffect(() => {\n updateSuggestions();\n }, [__experimentalAutoSelectFirstMatch]);\n if (disabled && isActive) {\n setIsActive(false);\n setIncompleteTokenValue('');\n }\n function focus() {\n input.current?.focus();\n }\n function hasFocus() {\n return input.current === input.current?.ownerDocument.activeElement;\n }\n function onFocusHandler(event) {\n // If focus is on the input or on the container, set the isActive state to true.\n if (hasFocus() || event.target === tokensAndInput.current) {\n setIsActive(true);\n setIsExpanded(__experimentalExpandOnFocus || isExpanded);\n } else {\n /*\n * Otherwise, focus is on one of the token \"remove\" buttons and we\n * set the isActive state to false to prevent the input to be\n * re-focused, see componentDidUpdate().\n */\n setIsActive(false);\n }\n if ('function' === typeof onFocus) {\n onFocus(event);\n }\n }\n function onBlur(event) {\n if (inputHasValidValue() && __experimentalValidateInput(incompleteTokenValue)) {\n setIsActive(false);\n if (tokenizeOnBlur && inputHasValidValue()) {\n addNewToken(incompleteTokenValue);\n }\n } else {\n // Reset to initial state\n setIncompleteTokenValue('');\n setInputOffsetFromEnd(0);\n setIsActive(false);\n if (__experimentalExpandOnFocus) {\n // If `__experimentalExpandOnFocus` is true, don't close the suggestions list when\n // the user clicks on it (`tokensAndInput` will be the element that caused the blur).\n const hasFocusWithin = event.relatedTarget === tokensAndInput.current;\n setIsExpanded(hasFocusWithin);\n } else {\n // Else collapse the suggestion list. This will result in the suggestion list closing\n // after a suggestion has been submitted since that causes a blur.\n setIsExpanded(false);\n }\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n }\n }\n function onKeyDown(event) {\n let preventDefault = false;\n if (event.defaultPrevented) {\n return;\n }\n switch (event.key) {\n case 'Backspace':\n preventDefault = handleDeleteKey(deleteTokenBeforeInput);\n break;\n case 'Enter':\n preventDefault = addCurrentToken();\n break;\n case 'ArrowLeft':\n preventDefault = handleLeftArrowKey();\n break;\n case 'ArrowUp':\n preventDefault = handleUpArrowKey();\n break;\n case 'ArrowRight':\n preventDefault = handleRightArrowKey();\n break;\n case 'ArrowDown':\n preventDefault = handleDownArrowKey();\n break;\n case 'Delete':\n preventDefault = handleDeleteKey(deleteTokenAfterInput);\n break;\n case 'Space':\n if (tokenizeOnSpace) {\n preventDefault = addCurrentToken();\n }\n break;\n case 'Escape':\n preventDefault = handleEscapeKey(event);\n break;\n case 'Tab':\n preventDefault = handleTabKey(event);\n break;\n default:\n break;\n }\n if (preventDefault) {\n event.preventDefault();\n }\n }\n function onKeyPress(event) {\n let preventDefault = false;\n switch (event.key) {\n case ',':\n preventDefault = handleCommaKey();\n break;\n default:\n break;\n }\n if (preventDefault) {\n event.preventDefault();\n }\n }\n function onContainerTouched(event) {\n // Prevent clicking/touching the tokensAndInput container from blurring\n // the input and adding the current token.\n if (event.target === tokensAndInput.current && isActive) {\n event.preventDefault();\n }\n }\n function onTokenClickRemove(event) {\n deleteToken(event.value);\n focus();\n }\n function onSuggestionHovered(suggestion) {\n const index = getMatchingSuggestions().indexOf(suggestion);\n if (index >= 0) {\n setSelectedSuggestionIndex(index);\n setSelectedSuggestionScroll(false);\n }\n }\n function onSuggestionSelected(suggestion) {\n addNewToken(suggestion);\n }\n function onInputChangeHandler(event) {\n const text = event.value;\n const separator = tokenizeOnSpace ? /[ ,\\t]+/ : /[,\\t]+/;\n const items = text.split(separator);\n const tokenValue = items[items.length - 1] || '';\n if (items.length > 1) {\n addNewTokens(items.slice(0, -1));\n }\n setIncompleteTokenValue(tokenValue);\n onInputChange(tokenValue);\n }\n function handleDeleteKey(_deleteToken) {\n let preventDefault = false;\n if (hasFocus() && isInputEmpty()) {\n _deleteToken();\n preventDefault = true;\n }\n return preventDefault;\n }\n function handleLeftArrowKey() {\n let preventDefault = false;\n if (isInputEmpty()) {\n moveInputBeforePreviousToken();\n preventDefault = true;\n }\n return preventDefault;\n }\n function handleRightArrowKey() {\n let preventDefault = false;\n if (isInputEmpty()) {\n moveInputAfterNextToken();\n preventDefault = true;\n }\n return preventDefault;\n }\n function handleUpArrowKey() {\n setSelectedSuggestionIndex(index => {\n return (index === 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1;\n });\n setSelectedSuggestionScroll(true);\n return true; // PreventDefault.\n }\n function handleDownArrowKey() {\n setSelectedSuggestionIndex(index => {\n return (index + 1) % getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length;\n });\n setSelectedSuggestionScroll(true);\n return true; // PreventDefault.\n }\n function collapseSuggestionsList(event) {\n if (event.target instanceof HTMLInputElement) {\n setIncompleteTokenValue(event.target.value);\n setIsExpanded(false);\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n }\n }\n function handleEscapeKey(event) {\n collapseSuggestionsList(event);\n return true; // PreventDefault.\n }\n function handleTabKey(event) {\n collapseSuggestionsList(event);\n return false; // Do not prevent the default behavior.\n }\n function handleCommaKey() {\n if (inputHasValidValue()) {\n addNewToken(incompleteTokenValue);\n }\n return true; // PreventDefault.\n }\n function moveInputToIndex(index) {\n setInputOffsetFromEnd(value.length - Math.max(index, -1) - 1);\n }\n function moveInputBeforePreviousToken() {\n setInputOffsetFromEnd(prevInputOffsetFromEnd => {\n return Math.min(prevInputOffsetFromEnd + 1, value.length);\n });\n }\n function moveInputAfterNextToken() {\n setInputOffsetFromEnd(prevInputOffsetFromEnd => {\n return Math.max(prevInputOffsetFromEnd - 1, 0);\n });\n }\n function deleteTokenBeforeInput() {\n const index = getIndexOfInput() - 1;\n if (index > -1) {\n deleteToken(value[index]);\n }\n }\n function deleteTokenAfterInput() {\n const index = getIndexOfInput();\n if (index < value.length) {\n deleteToken(value[index]);\n // Update input offset since it's the offset from the last token.\n moveInputToIndex(index);\n }\n }\n function addCurrentToken() {\n let preventDefault = false;\n const selectedSuggestion = getSelectedSuggestion();\n if (selectedSuggestion) {\n addNewToken(selectedSuggestion);\n preventDefault = true;\n } else if (inputHasValidValue()) {\n addNewToken(incompleteTokenValue);\n preventDefault = true;\n }\n return preventDefault;\n }\n function addNewTokens(tokens) {\n const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)))];\n if (tokensToAdd.length > 0) {\n const newValue = [...value];\n newValue.splice(getIndexOfInput(), 0, ...tokensToAdd);\n onChange(newValue);\n }\n }\n function addNewToken(token) {\n if (!__experimentalValidateInput(token)) {\n speak(messages.__experimentalInvalid, 'assertive');\n return;\n }\n addNewTokens([token]);\n speak(messages.added, 'assertive');\n setIncompleteTokenValue('');\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n setIsExpanded(!__experimentalExpandOnFocus);\n if (isActive && !tokenizeOnBlur) {\n focus();\n }\n }\n function deleteToken(token) {\n const newTokens = value.filter(item => {\n return getTokenValue(item) !== getTokenValue(token);\n });\n onChange(newTokens);\n speak(messages.removed, 'assertive');\n }\n function getTokenValue(token) {\n if ('object' === typeof token) {\n return token.value;\n }\n return token;\n }\n function getMatchingSuggestions(searchValue = incompleteTokenValue, _suggestions = suggestions, _value = value, _maxSuggestions = maxSuggestions, _saveTransform = saveTransform) {\n let match = _saveTransform(searchValue);\n const startsWithMatch = [];\n const containsMatch = [];\n const normalizedValue = _value.map(item => {\n if (typeof item === 'string') {\n return item;\n }\n return item.value;\n });\n if (match.length === 0) {\n _suggestions = _suggestions.filter(suggestion => !normalizedValue.includes(suggestion));\n } else {\n match = match.normalize('NFKC').toLocaleLowerCase();\n _suggestions.forEach(suggestion => {\n const index = suggestion.normalize('NFKC').toLocaleLowerCase().indexOf(match);\n if (normalizedValue.indexOf(suggestion) === -1) {\n if (index === 0) {\n startsWithMatch.push(suggestion);\n } else if (index > 0) {\n containsMatch.push(suggestion);\n }\n }\n });\n _suggestions = startsWithMatch.concat(containsMatch);\n }\n return _suggestions.slice(0, _maxSuggestions);\n }\n function getSelectedSuggestion() {\n if (selectedSuggestionIndex !== -1) {\n return getMatchingSuggestions()[selectedSuggestionIndex];\n }\n return undefined;\n }\n function valueContainsToken(token) {\n return value.some(item => {\n return getTokenValue(token) === getTokenValue(item);\n });\n }\n function getIndexOfInput() {\n return value.length - inputOffsetFromEnd;\n }\n function isInputEmpty() {\n return incompleteTokenValue.length === 0;\n }\n function inputHasValidValue() {\n return saveTransform(incompleteTokenValue).length > 0;\n }\n function updateSuggestions(resetSelectedSuggestion = true) {\n const inputHasMinimumChars = incompleteTokenValue.trim().length > 1;\n const matchingSuggestions = getMatchingSuggestions(incompleteTokenValue);\n const hasMatchingSuggestions = matchingSuggestions.length > 0;\n const shouldExpandIfFocuses = hasFocus() && __experimentalExpandOnFocus;\n setIsExpanded(shouldExpandIfFocuses || inputHasMinimumChars && hasMatchingSuggestions);\n if (resetSelectedSuggestion) {\n if (__experimentalAutoSelectFirstMatch && inputHasMinimumChars && hasMatchingSuggestions) {\n setSelectedSuggestionIndex(0);\n setSelectedSuggestionScroll(true);\n } else {\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n }\n }\n if (inputHasMinimumChars) {\n const message = hasMatchingSuggestions ? sprintf(/* translators: %d: number of results. */\n _n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : __('No results.');\n debouncedSpeak(message, 'assertive');\n }\n }\n function renderTokensAndInput() {\n const components = value.map(renderToken);\n components.splice(getIndexOfInput(), 0, renderInput());\n return components;\n }\n function renderToken(token, index, tokens) {\n const _value = getTokenValue(token);\n const status = typeof token !== 'string' ? token.status : undefined;\n const termPosition = index + 1;\n const termsCount = tokens.length;\n return /*#__PURE__*/_jsx(FlexItem, {\n children: /*#__PURE__*/_jsx(Token, {\n value: _value,\n status: status,\n title: typeof token !== 'string' ? token.title : undefined,\n displayTransform: displayTransform,\n onClickRemove: onTokenClickRemove,\n isBorderless: typeof token !== 'string' && token.isBorderless || isBorderless,\n onMouseEnter: typeof token !== 'string' ? token.onMouseEnter : undefined,\n onMouseLeave: typeof token !== 'string' ? token.onMouseLeave : undefined,\n disabled: 'error' !== status && disabled,\n messages: messages,\n termsCount: termsCount,\n termPosition: termPosition\n })\n }, 'token-' + _value);\n }\n function renderInput() {\n const inputProps = {\n instanceId,\n autoCapitalize,\n autoComplete,\n placeholder: value.length === 0 ? placeholder : '',\n disabled,\n value: incompleteTokenValue,\n onBlur,\n isExpanded,\n selectedSuggestionIndex\n };\n return /*#__PURE__*/_jsx(TokenInput, {\n ...inputProps,\n onChange: !(maxLength && value.length >= maxLength) ? onInputChangeHandler : undefined,\n ref: input\n }, \"input\");\n }\n const classes = clsx(className, 'components-form-token-field__input-container', {\n 'is-active': isActive,\n 'is-disabled': disabled\n });\n let tokenFieldProps = {\n className: 'components-form-token-field',\n tabIndex: -1\n };\n const matchingSuggestions = getMatchingSuggestions();\n if (!disabled) {\n tokenFieldProps = Object.assign({}, tokenFieldProps, {\n onKeyDown: withIgnoreIMEEvents(onKeyDown),\n onKeyPress,\n onFocus: onFocusHandler\n });\n }\n\n // Disable reason: There is no appropriate role which describes the\n // input container intended accessible usability.\n // TODO: Refactor click detection to use blur to stop propagation.\n /* eslint-disable jsx-a11y/no-static-element-interactions */\n return /*#__PURE__*/_jsxs(\"div\", {\n ...tokenFieldProps,\n children: [label && /*#__PURE__*/_jsx(StyledLabel, {\n htmlFor: `components-form-token-input-${instanceId}`,\n className: \"components-form-token-field__label\",\n children: label\n }), /*#__PURE__*/_jsxs(\"div\", {\n ref: tokensAndInput,\n className: classes,\n tabIndex: -1,\n onMouseDown: onContainerTouched,\n onTouchStart: onContainerTouched,\n children: [/*#__PURE__*/_jsx(TokensAndInputWrapperFlex, {\n justify: \"flex-start\",\n align: \"center\",\n gap: 1,\n wrap: true,\n __next40pxDefaultSize: __next40pxDefaultSize,\n hasTokens: !!value.length,\n children: renderTokensAndInput()\n }), isExpanded && /*#__PURE__*/_jsx(SuggestionsList, {\n instanceId: instanceId,\n match: saveTransform(incompleteTokenValue),\n displayTransform: displayTransform,\n suggestions: matchingSuggestions,\n selectedIndex: selectedSuggestionIndex,\n scrollIntoView: selectedSuggestionScroll,\n onHover: onSuggestionHovered,\n onSelect: onSuggestionSelected,\n __experimentalRenderItem: __experimentalRenderItem\n })]\n }), __experimentalShowHowTo && /*#__PURE__*/_jsx(StyledHelp, {\n id: `components-form-token-suggestions-howto-${instanceId}`,\n className: \"components-form-token-field__help\",\n children: tokenizeOnSpace ? __('Separate with commas, spaces, or the Enter key.') : __('Separate with commas or the Enter key.')\n })]\n });\n /* eslint-enable jsx-a11y/no-static-element-interactions */\n}\nexport default FormTokenField;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,qBAA4C;AAC5C,kBAAgC;AAChC,qBAAwD;AACxD,kBAAsB;AACtB,8BAA+B;AAK/B,mBAAkB;AAClB,yBAAuB;AACvB,oBAA0C;AAC1C,8BAA4B;AAC5B,kBAAyB;AACzB,iCAAwC;AACxC,kCAAiD;AACjD,oCAAoC;AACpC,kCAA4C;AAC5C,yBAA2C;AAC3C,IAAM,WAAW,WAAS;AAYnB,SAAS,eAAe,OAAO;AACpC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAQ,gBAAG,UAAU;AAAA,IACrB;AAAA,IACA,cAAc,CAAC;AAAA,IACf,iBAAiB;AAAA,IACjB,QAAQ,CAAC;AAAA,IACT,mBAAmB;AAAA,IACnB,gBAAgB,WAAS,MAAM,KAAK;AAAA,IACpC,WAAW,MAAM;AAAA,IAAC;AAAA,IAClB,gBAAgB,MAAM;AAAA,IAAC;AAAA,IACvB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,WAAW;AAAA,MACT,WAAO,gBAAG,aAAa;AAAA,MACvB,aAAS,gBAAG,eAAe;AAAA,MAC3B,YAAQ,gBAAG,aAAa;AAAA,MACxB,2BAAuB,gBAAG,cAAc;AAAA,IAC1C;AAAA,IACA;AAAA,IACA,8BAA8B;AAAA,IAC9B,8BAA8B,MAAM;AAAA,IACpC,0BAA0B;AAAA,IAC1B,wBAAwB;AAAA,IACxB,qCAAqC;AAAA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,mDAAoB,SAAS;AAAA,MACxC;AAAA,MACA,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAMA,SAAoB,uCAAAC,MAAM,OAAO;AAAA,IAC/B,GAAG;AAAA,IACH,UAAU,CAAC,SAAsB,uCAAAJ,KAAK,wCAAa;AAAA,MACjD,SAAS,+BAA+B,UAAU;AAAA,MAClD,WAAW;AAAA,MACX,UAAU;AAAA,IACZ,CAAC,GAAgB,uCAAAI,MAAM,OAAO;AAAA,MAC5B,KAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU;AAAA,MACV,aAAa;AAAA,MACb,cAAc;AAAA,MACd,UAAU,CAAc,uCAAAJ,KAAK,yCAA2B;AAAA,QACtD,SAAS;AAAA,QACT,OAAO;AAAA,QACP,KAAK;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA,WAAW,CAAC,CAAC,MAAM;AAAA,QACnB,UAAU,qBAAqB;AAAA,MACjC,CAAC,GAAG,cAA2B,uCAAAA,KAAK,wBAAAK,SAAiB;AAAA,QACnD;AAAA,QACA,OAAO,cAAc,oBAAoB;AAAA,QACzC;AAAA,QACA,aAAa;AAAA,QACb,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,SAAS;AAAA,QACT,UAAU;AAAA,QACV;AAAA,MACF,CAAC,CAAC;AAAA,IACJ,CAAC,GAAG,2BAAwC,uCAAAL,KAAK,uCAAY;AAAA,MAC3D,IAAI,2CAA2C,UAAU;AAAA,MACzD,WAAW;AAAA,MACX,UAAU,sBAAkB,gBAAG,iDAAiD,QAAI,gBAAG,wCAAwC;AAAA,IACjI,CAAC,CAAC;AAAA,EACJ,CAAC;AAEH;AACA,IAAO,2BAAQ;",
6
- "names": ["matchingSuggestions", "_jsx", "Token", "TokenInput", "clsx", "_jsxs", "SuggestionsList"]
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useDebounce, useInstanceId, usePrevious } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Token from './token';\nimport TokenInput from './token-input';\nimport { TokensAndInputWrapperFlex } from './styles';\nimport SuggestionsList from './suggestions-list';\nimport { FlexItem } from '../flex';\nimport { StyledHelp, StyledLabel } from '../base-control/styles/base-control-styles';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst identity = value => value;\n\n/**\n * A `FormTokenField` is a field similar to the tags and categories fields in the interim editor chrome,\n * or the \"to\" field in Mail on OS X. Tokens can be entered by typing them or selecting them from a list of suggested tokens.\n *\n * Up to one hundred suggestions that match what the user has typed so far will be shown from which the user can pick from (auto-complete).\n * Tokens are separated by the \",\" character. Suggestions can be selected with the up or down arrows and added with the tab or enter key.\n *\n * The `value` property is handled in a manner similar to controlled form components.\n * See [Forms](https://react.dev/reference/react-dom/components#form-components) in the React Documentation for more information.\n */\nexport function FormTokenField(props) {\n const {\n autoCapitalize,\n autoComplete,\n maxLength,\n placeholder,\n label = __('Add item'),\n className,\n suggestions = [],\n maxSuggestions = 100,\n value = [],\n displayTransform = identity,\n saveTransform = token => token.trim(),\n onChange = () => {},\n onInputChange = () => {},\n onFocus = undefined,\n isBorderless = false,\n disabled = false,\n tokenizeOnSpace = false,\n messages = {\n added: __('Item added.'),\n removed: __('Item removed.'),\n remove: __('Remove item'),\n __experimentalInvalid: __('Invalid item')\n },\n __experimentalRenderItem,\n __experimentalExpandOnFocus = false,\n __experimentalValidateInput = () => true,\n __experimentalShowHowTo,\n __next40pxDefaultSize = false,\n __experimentalAutoSelectFirstMatch = false,\n tokenizeOnBlur = false,\n help\n } = useDeprecated36pxDefaultSizeProp(props);\n maybeWarnDeprecated36pxSize({\n componentName: 'FormTokenField',\n size: undefined,\n __next40pxDefaultSize\n });\n const defaultHelp = tokenizeOnSpace ? __('Separate with commas, spaces, or the Enter key.') : __('Separate with commas or the Enter key.');\n let computedHelp = help !== undefined ? help : defaultHelp;\n if (typeof __experimentalShowHowTo === 'boolean') {\n deprecated('`__experimentalShowHowTo` prop in wp.components.FormTokenField', {\n since: '7.1',\n alternative: '`help` prop',\n hint: 'The `help` prop now defaults to the previous how-to text. Pass an empty string to hide it.'\n });\n if (__experimentalShowHowTo === false && help === undefined) {\n computedHelp = '';\n }\n }\n const instanceId = useInstanceId(FormTokenField);\n\n // We reset to these initial values again in the onBlur\n const [incompleteTokenValue, setIncompleteTokenValue] = useState('');\n const [inputOffsetFromEnd, setInputOffsetFromEnd] = useState(0);\n const [isActive, setIsActive] = useState(false);\n const [isExpanded, setIsExpanded] = useState(false);\n const [selectedSuggestionIndex, setSelectedSuggestionIndex] = useState(-1);\n const [selectedSuggestionScroll, setSelectedSuggestionScroll] = useState(false);\n const prevSuggestions = usePrevious(suggestions);\n const prevValue = usePrevious(value);\n const input = useRef(null);\n const tokensAndInput = useRef(null);\n const debouncedSpeak = useDebounce(speak, 500);\n useEffect(() => {\n // Make sure to focus the input when the isActive state is true.\n if (isActive && !hasFocus()) {\n focus();\n }\n }, [isActive]);\n useEffect(() => {\n const suggestionsDidUpdate = !isShallowEqual(suggestions, prevSuggestions || []);\n if (suggestionsDidUpdate || value !== prevValue) {\n updateSuggestions(suggestionsDidUpdate);\n }\n\n // TODO: updateSuggestions() should first be refactored so its actual deps are clearer.\n }, [suggestions, prevSuggestions, value, prevValue]);\n useEffect(() => {\n updateSuggestions();\n }, [incompleteTokenValue]);\n useEffect(() => {\n updateSuggestions();\n }, [__experimentalAutoSelectFirstMatch]);\n if (disabled && isActive) {\n setIsActive(false);\n setIncompleteTokenValue('');\n }\n function focus() {\n input.current?.focus();\n }\n function hasFocus() {\n return input.current === input.current?.ownerDocument.activeElement;\n }\n function onFocusHandler(event) {\n // If focus is on the input or on the container, set the isActive state to true.\n if (hasFocus() || event.target === tokensAndInput.current) {\n setIsActive(true);\n setIsExpanded(__experimentalExpandOnFocus || isExpanded);\n } else {\n /*\n * Otherwise, focus is on one of the token \"remove\" buttons and we\n * set the isActive state to false to prevent the input to be\n * re-focused, see componentDidUpdate().\n */\n setIsActive(false);\n }\n if ('function' === typeof onFocus) {\n onFocus(event);\n }\n }\n function onBlur(event) {\n if (inputHasValidValue() && __experimentalValidateInput(incompleteTokenValue)) {\n setIsActive(false);\n if (tokenizeOnBlur && inputHasValidValue()) {\n addNewToken(incompleteTokenValue);\n }\n } else {\n // Reset to initial state\n setIncompleteTokenValue('');\n setInputOffsetFromEnd(0);\n setIsActive(false);\n if (__experimentalExpandOnFocus) {\n // If `__experimentalExpandOnFocus` is true, don't close the suggestions list when\n // the user clicks on it (`tokensAndInput` will be the element that caused the blur).\n const hasFocusWithin = event.relatedTarget === tokensAndInput.current;\n setIsExpanded(hasFocusWithin);\n } else {\n // Else collapse the suggestion list. This will result in the suggestion list closing\n // after a suggestion has been submitted since that causes a blur.\n setIsExpanded(false);\n }\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n }\n }\n function onKeyDown(event) {\n let preventDefault = false;\n if (event.defaultPrevented) {\n return;\n }\n switch (event.key) {\n case 'Backspace':\n preventDefault = handleDeleteKey(deleteTokenBeforeInput);\n break;\n case 'Enter':\n preventDefault = addCurrentToken();\n break;\n case 'ArrowLeft':\n preventDefault = handleLeftArrowKey();\n break;\n case 'ArrowUp':\n preventDefault = handleUpArrowKey();\n break;\n case 'ArrowRight':\n preventDefault = handleRightArrowKey();\n break;\n case 'ArrowDown':\n preventDefault = handleDownArrowKey();\n break;\n case 'Delete':\n preventDefault = handleDeleteKey(deleteTokenAfterInput);\n break;\n case 'Space':\n if (tokenizeOnSpace) {\n preventDefault = addCurrentToken();\n }\n break;\n case 'Escape':\n preventDefault = handleEscapeKey(event);\n break;\n case 'Tab':\n preventDefault = handleTabKey(event);\n break;\n default:\n break;\n }\n if (preventDefault) {\n event.preventDefault();\n }\n }\n function onKeyPress(event) {\n let preventDefault = false;\n switch (event.key) {\n case ',':\n preventDefault = handleCommaKey();\n break;\n default:\n break;\n }\n if (preventDefault) {\n event.preventDefault();\n }\n }\n function onContainerTouched(event) {\n // Prevent clicking/touching the tokensAndInput container from blurring\n // the input and adding the current token.\n if (event.target === tokensAndInput.current && isActive) {\n event.preventDefault();\n }\n }\n function onTokenClickRemove(event) {\n deleteToken(event.value);\n focus();\n }\n function onSuggestionHovered(suggestion) {\n const index = getMatchingSuggestions().indexOf(suggestion);\n if (index >= 0) {\n setSelectedSuggestionIndex(index);\n setSelectedSuggestionScroll(false);\n }\n }\n function onSuggestionSelected(suggestion) {\n addNewToken(suggestion);\n }\n function onInputChangeHandler(event) {\n const text = event.value;\n const separator = tokenizeOnSpace ? /[ ,\\t]+/ : /[,\\t]+/;\n const items = text.split(separator);\n const tokenValue = items[items.length - 1] || '';\n if (items.length > 1) {\n addNewTokens(items.slice(0, -1));\n }\n setIncompleteTokenValue(tokenValue);\n onInputChange(tokenValue);\n }\n function handleDeleteKey(_deleteToken) {\n let preventDefault = false;\n if (hasFocus() && isInputEmpty()) {\n _deleteToken();\n preventDefault = true;\n }\n return preventDefault;\n }\n function handleLeftArrowKey() {\n let preventDefault = false;\n if (isInputEmpty()) {\n moveInputBeforePreviousToken();\n preventDefault = true;\n }\n return preventDefault;\n }\n function handleRightArrowKey() {\n let preventDefault = false;\n if (isInputEmpty()) {\n moveInputAfterNextToken();\n preventDefault = true;\n }\n return preventDefault;\n }\n function handleUpArrowKey() {\n setSelectedSuggestionIndex(index => {\n return (index === 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1;\n });\n setSelectedSuggestionScroll(true);\n return true; // PreventDefault.\n }\n function handleDownArrowKey() {\n setSelectedSuggestionIndex(index => {\n return (index + 1) % getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length;\n });\n setSelectedSuggestionScroll(true);\n return true; // PreventDefault.\n }\n function collapseSuggestionsList(event) {\n if (event.target instanceof HTMLInputElement) {\n setIncompleteTokenValue(event.target.value);\n setIsExpanded(false);\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n }\n }\n function handleEscapeKey(event) {\n collapseSuggestionsList(event);\n return true; // PreventDefault.\n }\n function handleTabKey(event) {\n collapseSuggestionsList(event);\n return false; // Do not prevent the default behavior.\n }\n function handleCommaKey() {\n if (inputHasValidValue()) {\n addNewToken(incompleteTokenValue);\n }\n return true; // PreventDefault.\n }\n function moveInputToIndex(index) {\n setInputOffsetFromEnd(value.length - Math.max(index, -1) - 1);\n }\n function moveInputBeforePreviousToken() {\n setInputOffsetFromEnd(prevInputOffsetFromEnd => {\n return Math.min(prevInputOffsetFromEnd + 1, value.length);\n });\n }\n function moveInputAfterNextToken() {\n setInputOffsetFromEnd(prevInputOffsetFromEnd => {\n return Math.max(prevInputOffsetFromEnd - 1, 0);\n });\n }\n function deleteTokenBeforeInput() {\n const index = getIndexOfInput() - 1;\n if (index > -1) {\n deleteToken(value[index]);\n }\n }\n function deleteTokenAfterInput() {\n const index = getIndexOfInput();\n if (index < value.length) {\n deleteToken(value[index]);\n // Update input offset since it's the offset from the last token.\n moveInputToIndex(index);\n }\n }\n function addCurrentToken() {\n let preventDefault = false;\n const selectedSuggestion = getSelectedSuggestion();\n if (selectedSuggestion) {\n addNewToken(selectedSuggestion);\n preventDefault = true;\n } else if (inputHasValidValue()) {\n addNewToken(incompleteTokenValue);\n preventDefault = true;\n }\n return preventDefault;\n }\n function addNewTokens(tokens) {\n const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)))];\n if (tokensToAdd.length > 0) {\n const newValue = [...value];\n newValue.splice(getIndexOfInput(), 0, ...tokensToAdd);\n onChange(newValue);\n }\n }\n function addNewToken(token) {\n if (!__experimentalValidateInput(token)) {\n speak(messages.__experimentalInvalid, 'assertive');\n return;\n }\n addNewTokens([token]);\n speak(messages.added, 'assertive');\n setIncompleteTokenValue('');\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n setIsExpanded(!__experimentalExpandOnFocus);\n if (isActive && !tokenizeOnBlur) {\n focus();\n }\n }\n function deleteToken(token) {\n const newTokens = value.filter(item => {\n return getTokenValue(item) !== getTokenValue(token);\n });\n onChange(newTokens);\n speak(messages.removed, 'assertive');\n }\n function getTokenValue(token) {\n if ('object' === typeof token) {\n return token.value;\n }\n return token;\n }\n function getMatchingSuggestions(searchValue = incompleteTokenValue, _suggestions = suggestions, _value = value, _maxSuggestions = maxSuggestions, _saveTransform = saveTransform) {\n let match = _saveTransform(searchValue);\n const startsWithMatch = [];\n const containsMatch = [];\n const normalizedValue = _value.map(item => {\n if (typeof item === 'string') {\n return item;\n }\n return item.value;\n });\n if (match.length === 0) {\n _suggestions = _suggestions.filter(suggestion => !normalizedValue.includes(suggestion));\n } else {\n match = match.normalize('NFKC').toLocaleLowerCase();\n _suggestions.forEach(suggestion => {\n const index = suggestion.normalize('NFKC').toLocaleLowerCase().indexOf(match);\n if (normalizedValue.indexOf(suggestion) === -1) {\n if (index === 0) {\n startsWithMatch.push(suggestion);\n } else if (index > 0) {\n containsMatch.push(suggestion);\n }\n }\n });\n _suggestions = startsWithMatch.concat(containsMatch);\n }\n return _suggestions.slice(0, _maxSuggestions);\n }\n function getSelectedSuggestion() {\n if (selectedSuggestionIndex !== -1) {\n return getMatchingSuggestions()[selectedSuggestionIndex];\n }\n return undefined;\n }\n function valueContainsToken(token) {\n return value.some(item => {\n return getTokenValue(token) === getTokenValue(item);\n });\n }\n function getIndexOfInput() {\n return value.length - inputOffsetFromEnd;\n }\n function isInputEmpty() {\n return incompleteTokenValue.length === 0;\n }\n function inputHasValidValue() {\n return saveTransform(incompleteTokenValue).length > 0;\n }\n function updateSuggestions(resetSelectedSuggestion = true) {\n const inputHasMinimumChars = incompleteTokenValue.trim().length > 1;\n const matchingSuggestions = getMatchingSuggestions(incompleteTokenValue);\n const hasMatchingSuggestions = matchingSuggestions.length > 0;\n const shouldExpandIfFocuses = hasFocus() && __experimentalExpandOnFocus;\n setIsExpanded(shouldExpandIfFocuses || inputHasMinimumChars && hasMatchingSuggestions);\n if (resetSelectedSuggestion) {\n if (__experimentalAutoSelectFirstMatch && inputHasMinimumChars && hasMatchingSuggestions) {\n setSelectedSuggestionIndex(0);\n setSelectedSuggestionScroll(true);\n } else {\n setSelectedSuggestionIndex(-1);\n setSelectedSuggestionScroll(false);\n }\n }\n if (inputHasMinimumChars) {\n const message = hasMatchingSuggestions ? sprintf(/* translators: %d: number of results. */\n _n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : __('No results.');\n debouncedSpeak(message, 'assertive');\n }\n }\n function renderTokensAndInput() {\n const components = value.map(renderToken);\n components.splice(getIndexOfInput(), 0, renderInput());\n return components;\n }\n function renderToken(token, index, tokens) {\n const _value = getTokenValue(token);\n const status = typeof token !== 'string' ? token.status : undefined;\n const termPosition = index + 1;\n const termsCount = tokens.length;\n return /*#__PURE__*/_jsx(FlexItem, {\n children: /*#__PURE__*/_jsx(Token, {\n value: _value,\n status: status,\n title: typeof token !== 'string' ? token.title : undefined,\n displayTransform: displayTransform,\n onClickRemove: onTokenClickRemove,\n isBorderless: typeof token !== 'string' && token.isBorderless || isBorderless,\n onMouseEnter: typeof token !== 'string' ? token.onMouseEnter : undefined,\n onMouseLeave: typeof token !== 'string' ? token.onMouseLeave : undefined,\n disabled: 'error' !== status && disabled,\n messages: messages,\n termsCount: termsCount,\n termPosition: termPosition\n })\n }, 'token-' + _value);\n }\n function renderInput() {\n const describedById = computedHelp ? `components-form-token-input-${instanceId}__help` : undefined;\n const inputProps = {\n instanceId,\n autoCapitalize,\n autoComplete,\n placeholder: value.length === 0 ? placeholder : '',\n disabled,\n value: incompleteTokenValue,\n onBlur,\n isExpanded,\n selectedSuggestionIndex,\n 'aria-describedby': describedById\n };\n return /*#__PURE__*/_jsx(TokenInput, {\n ...inputProps,\n onChange: !(maxLength && value.length >= maxLength) ? onInputChangeHandler : undefined,\n ref: input\n }, \"input\");\n }\n const classes = clsx(className, 'components-form-token-field__input-container', {\n 'is-active': isActive,\n 'is-disabled': disabled\n });\n let tokenFieldProps = {\n className: 'components-form-token-field',\n tabIndex: -1\n };\n const matchingSuggestions = getMatchingSuggestions();\n if (!disabled) {\n tokenFieldProps = Object.assign({}, tokenFieldProps, {\n onKeyDown: withIgnoreIMEEvents(onKeyDown),\n onKeyPress,\n onFocus: onFocusHandler\n });\n }\n\n // Disable reason: There is no appropriate role which describes the\n // input container intended accessible usability.\n // TODO: Refactor click detection to use blur to stop propagation.\n /* eslint-disable jsx-a11y/no-static-element-interactions */\n return /*#__PURE__*/_jsxs(\"div\", {\n ...tokenFieldProps,\n children: [label && /*#__PURE__*/_jsx(StyledLabel, {\n htmlFor: `components-form-token-input-${instanceId}`,\n className: \"components-form-token-field__label\",\n children: label\n }), /*#__PURE__*/_jsxs(\"div\", {\n ref: tokensAndInput,\n className: classes,\n tabIndex: -1,\n onMouseDown: onContainerTouched,\n onTouchStart: onContainerTouched,\n children: [/*#__PURE__*/_jsx(TokensAndInputWrapperFlex, {\n justify: \"flex-start\",\n align: \"center\",\n gap: 1,\n wrap: true,\n __next40pxDefaultSize: __next40pxDefaultSize,\n hasTokens: !!value.length,\n children: renderTokensAndInput()\n }), isExpanded && /*#__PURE__*/_jsx(SuggestionsList, {\n instanceId: instanceId,\n match: saveTransform(incompleteTokenValue),\n displayTransform: displayTransform,\n suggestions: matchingSuggestions,\n selectedIndex: selectedSuggestionIndex,\n scrollIntoView: selectedSuggestionScroll,\n onHover: onSuggestionHovered,\n onSelect: onSuggestionSelected,\n __experimentalRenderItem: __experimentalRenderItem\n })]\n }), computedHelp && /*#__PURE__*/_jsx(StyledHelp, {\n id: `components-form-token-input-${instanceId}__help`,\n className: \"components-form-token-field__help\",\n children: computedHelp\n })]\n });\n /* eslint-enable jsx-a11y/no-static-element-interactions */\n}\nexport default FormTokenField;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,qBAA4C;AAC5C,kBAAgC;AAChC,qBAAwD;AACxD,kBAAsB;AACtB,8BAA+B;AAC/B,wBAAuB;AAKvB,mBAAkB;AAClB,yBAAuB;AACvB,oBAA0C;AAC1C,8BAA4B;AAC5B,kBAAyB;AACzB,iCAAwC;AACxC,kCAAiD;AACjD,oCAAoC;AACpC,kCAA4C;AAC5C,yBAA2C;AAC3C,IAAM,WAAW,WAAS;AAYnB,SAAS,eAAe,OAAO;AACpC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAQ,gBAAG,UAAU;AAAA,IACrB;AAAA,IACA,cAAc,CAAC;AAAA,IACf,iBAAiB;AAAA,IACjB,QAAQ,CAAC;AAAA,IACT,mBAAmB;AAAA,IACnB,gBAAgB,WAAS,MAAM,KAAK;AAAA,IACpC,WAAW,MAAM;AAAA,IAAC;AAAA,IAClB,gBAAgB,MAAM;AAAA,IAAC;AAAA,IACvB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,WAAW;AAAA,MACT,WAAO,gBAAG,aAAa;AAAA,MACvB,aAAS,gBAAG,eAAe;AAAA,MAC3B,YAAQ,gBAAG,aAAa;AAAA,MACxB,2BAAuB,gBAAG,cAAc;AAAA,IAC1C;AAAA,IACA;AAAA,IACA,8BAA8B;AAAA,IAC9B,8BAA8B,MAAM;AAAA,IACpC;AAAA,IACA,wBAAwB;AAAA,IACxB,qCAAqC;AAAA,IACrC,iBAAiB;AAAA,IACj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I,+BAA+B,UAAU;AAAA,MAC7C,WAAW;AAAA,MACX,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AAEH;AACA,IAAO,2BAAQ;",
6
+ "names": ["deprecated", "matchingSuggestions", "_jsx", "Token", "TokenInput", "clsx", "_jsxs", "SuggestionsList"]
7
7
  }
@@ -91,7 +91,7 @@ function UnForwardedTokenInput(props, ref) {
91
91
  // - the list of suggestions are rendered in the DOM (`isExpanded`)
92
92
  hasFocus && selectedSuggestionIndex !== -1 && isExpanded ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : void 0
93
93
  ),
94
- "aria-describedby": [`components-form-token-suggestions-howto-${instanceId}`, ariaDescribedBy].filter(Boolean).join(" ")
94
+ "aria-describedby": ariaDescribedBy
95
95
  });
96
96
  }
97
97
  var TokenInput = (0, import_element.forwardRef)(UnForwardedTokenInput);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/form-token-field/token-input.tsx"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function UnForwardedTokenInput(props, ref) {\n const {\n value,\n isExpanded,\n instanceId,\n selectedSuggestionIndex,\n className,\n onChange,\n onFocus,\n onBlur,\n 'aria-describedby': ariaDescribedBy,\n ...restProps\n } = props;\n const [hasFocus, setHasFocus] = useState(false);\n const size = value ? value.length + 1 : 0;\n const onChangeHandler = event => {\n if (onChange) {\n onChange({\n value: event.target.value\n });\n }\n };\n const onFocusHandler = e => {\n setHasFocus(true);\n onFocus?.(e);\n };\n const onBlurHandler = e => {\n setHasFocus(false);\n onBlur?.(e);\n };\n return /*#__PURE__*/_jsx(\"input\", {\n ref: ref,\n id: `components-form-token-input-${instanceId}`,\n type: \"text\",\n ...restProps,\n value: value || '',\n onChange: onChangeHandler,\n onFocus: onFocusHandler,\n onBlur: onBlurHandler,\n size: size,\n className: clsx(className, 'components-form-token-field__input'),\n autoComplete: \"off\",\n role: \"combobox\",\n \"aria-expanded\": isExpanded,\n \"aria-autocomplete\": \"list\",\n \"aria-owns\": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined,\n \"aria-activedescendant\":\n // Only add the `aria-activedescendant` attribute when:\n // - the user is actively interacting with the input (`hasFocus`)\n // - there is a selected suggestion (`selectedSuggestionIndex !== -1`)\n // - the list of suggestions are rendered in the DOM (`isExpanded`)\n hasFocus && selectedSuggestionIndex !== -1 && isExpanded ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined,\n \"aria-describedby\": [`components-form-token-suggestions-howto-${instanceId}`, ariaDescribedBy].filter(Boolean).join(' ')\n });\n}\nexport const TokenInput = forwardRef(UnForwardedTokenInput);\nTokenInput.displayName = 'TokenInput';\nexport default TokenInput;"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,qBAAqC;AAKrC,yBAA4B;AACrB,SAAS,sBAAsB,OAAO,KAAK;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,CAAC,UAAU,WAAW,QAAI,yBAAS,KAAK;AAC9C,QAAM,OAAO,QAAQ,MAAM,SAAS,IAAI;AACxC,QAAM,kBAAkB,WAAS;AAC/B,QAAI,UAAU;AACZ,eAAS;AAAA,QACP,OAAO,MAAM,OAAO;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,iBAAiB,OAAK;AAC1B,gBAAY,IAAI;AAChB,cAAU,CAAC;AAAA,EACb;AACA,QAAM,gBAAgB,OAAK;AACzB,gBAAY,KAAK;AACjB,aAAS,CAAC;AAAA,EACZ;AACA,SAAoB,uCAAAA,KAAK,SAAS;AAAA,IAChC;AAAA,IACA,IAAI,+BAA+B,UAAU;AAAA,IAC7C,MAAM;AAAA,IACN,GAAG;AAAA,IACH,OAAO,SAAS;AAAA,IAChB,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR;AAAA,IACA,eAAW,YAAAC,SAAK,WAAW,oCAAoC;AAAA,IAC/D,cAAc;AAAA,IACd,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB,aAAa,aAAa,qCAAqC,UAAU,KAAK;AAAA,IAC9E;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,YAAY,4BAA4B,MAAM,aAAa,qCAAqC,UAAU,IAAI,uBAAuB,KAAK;AAAA;AAAA,IAC1I,oBAAoB,CAAC,2CAA2C,UAAU,IAAI,eAAe,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,EACzH,CAAC;AACH;AACO,IAAM,iBAAa,2BAAW,qBAAqB;AAC1D,WAAW,cAAc;AACzB,IAAO,sBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function UnForwardedTokenInput(props, ref) {\n const {\n value,\n isExpanded,\n instanceId,\n selectedSuggestionIndex,\n className,\n onChange,\n onFocus,\n onBlur,\n 'aria-describedby': ariaDescribedBy,\n ...restProps\n } = props;\n const [hasFocus, setHasFocus] = useState(false);\n const size = value ? value.length + 1 : 0;\n const onChangeHandler = event => {\n if (onChange) {\n onChange({\n value: event.target.value\n });\n }\n };\n const onFocusHandler = e => {\n setHasFocus(true);\n onFocus?.(e);\n };\n const onBlurHandler = e => {\n setHasFocus(false);\n onBlur?.(e);\n };\n return /*#__PURE__*/_jsx(\"input\", {\n ref: ref,\n id: `components-form-token-input-${instanceId}`,\n type: \"text\",\n ...restProps,\n value: value || '',\n onChange: onChangeHandler,\n onFocus: onFocusHandler,\n onBlur: onBlurHandler,\n size: size,\n className: clsx(className, 'components-form-token-field__input'),\n autoComplete: \"off\",\n role: \"combobox\",\n \"aria-expanded\": isExpanded,\n \"aria-autocomplete\": \"list\",\n \"aria-owns\": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined,\n \"aria-activedescendant\":\n // Only add the `aria-activedescendant` attribute when:\n // - the user is actively interacting with the input (`hasFocus`)\n // - there is a selected suggestion (`selectedSuggestionIndex !== -1`)\n // - the list of suggestions are rendered in the DOM (`isExpanded`)\n hasFocus && selectedSuggestionIndex !== -1 && isExpanded ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined,\n \"aria-describedby\": ariaDescribedBy\n });\n}\nexport const TokenInput = forwardRef(UnForwardedTokenInput);\nTokenInput.displayName = 'TokenInput';\nexport default TokenInput;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,qBAAqC;AAKrC,yBAA4B;AACrB,SAAS,sBAAsB,OAAO,KAAK;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,CAAC,UAAU,WAAW,QAAI,yBAAS,KAAK;AAC9C,QAAM,OAAO,QAAQ,MAAM,SAAS,IAAI;AACxC,QAAM,kBAAkB,WAAS;AAC/B,QAAI,UAAU;AACZ,eAAS;AAAA,QACP,OAAO,MAAM,OAAO;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,iBAAiB,OAAK;AAC1B,gBAAY,IAAI;AAChB,cAAU,CAAC;AAAA,EACb;AACA,QAAM,gBAAgB,OAAK;AACzB,gBAAY,KAAK;AACjB,aAAS,CAAC;AAAA,EACZ;AACA,SAAoB,uCAAAA,KAAK,SAAS;AAAA,IAChC;AAAA,IACA,IAAI,+BAA+B,UAAU;AAAA,IAC7C,MAAM;AAAA,IACN,GAAG;AAAA,IACH,OAAO,SAAS;AAAA,IAChB,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR;AAAA,IACA,eAAW,YAAAC,SAAK,WAAW,oCAAoC;AAAA,IAC/D,cAAc;AAAA,IACd,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,qBAAqB;AAAA,IACrB,aAAa,aAAa,qCAAqC,UAAU,KAAK;AAAA,IAC9E;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,YAAY,4BAA4B,MAAM,aAAa,qCAAqC,UAAU,IAAI,uBAAuB,KAAK;AAAA;AAAA,IAC1I,oBAAoB;AAAA,EACtB,CAAC;AACH;AACO,IAAM,iBAAa,2BAAW,qBAAqB;AAC1D,WAAW,cAAc;AACzB,IAAO,sBAAQ;",
6
6
  "names": ["_jsx", "clsx"]
7
7
  }
@@ -40,7 +40,6 @@ var import_context = require("./context.cjs");
40
40
  var import_jsx_runtime = require("react/jsx-runtime");
41
41
  var Popover = (0, import_element.forwardRef)(function Popover2({
42
42
  gutter,
43
- children,
44
43
  shift,
45
44
  modal = true,
46
45
  ...otherProps
@@ -61,6 +60,12 @@ var Popover = (0, import_element.forwardRef)(function Popover2({
61
60
  if (!menuContext?.store) {
62
61
  throw new Error("Menu.Popover can only be rendered inside a Menu component");
63
62
  }
63
+ const renderMenu = (0, import_element.useCallback)((htmlProps) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Styled.MenuMotionRoot, {
64
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Styled.MenuSurface, {
65
+ ...htmlProps,
66
+ variant: menuContext.variant
67
+ })
68
+ }), [menuContext.variant]);
64
69
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Styled.Menu, {
65
70
  ...otherProps,
66
71
  ref,
@@ -74,8 +79,7 @@ var Popover = (0, import_element.forwardRef)(function Popover2({
74
79
  wrapperProps,
75
80
  hideOnEscape,
76
81
  unmountOnHide: true,
77
- variant: menuContext.variant,
78
- children
82
+ render: renderMenu
79
83
  });
80
84
  });
81
85
  // Annotate the CommonJS export names for ESM import in node: