@wordpress/components 40.0.0 → 40.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 (472) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/CONTRIBUTING.md +2 -0
  3. package/build/border-box-control/border-box-control/component.cjs +37 -5
  4. package/build/border-box-control/border-box-control/component.cjs.map +3 -3
  5. package/build/border-box-control/border-box-control/hook.cjs +24 -3
  6. package/build/border-box-control/border-box-control/hook.cjs.map +3 -3
  7. package/build/border-box-control/border-box-control-linked-button/hook.cjs +2 -2
  8. package/build/border-box-control/border-box-control-linked-button/hook.cjs.map +2 -2
  9. package/build/border-box-control/border-box-control-split-controls/hook.cjs +2 -2
  10. package/build/border-box-control/border-box-control-split-controls/hook.cjs.map +2 -2
  11. package/build/border-box-control/border-box-control-visualizer/hook.cjs +2 -2
  12. package/build/border-box-control/border-box-control-visualizer/hook.cjs.map +2 -2
  13. package/build/color-palette/index.cjs +1 -1
  14. package/build/color-palette/index.cjs.map +2 -2
  15. package/build/composite/context.cjs +9 -2
  16. package/build/composite/context.cjs.map +2 -2
  17. package/build/composite/group-label.cjs +4 -0
  18. package/build/composite/group-label.cjs.map +2 -2
  19. package/build/composite/group.cjs +10 -2
  20. package/build/composite/group.cjs.map +2 -2
  21. package/build/composite/item.cjs +4 -0
  22. package/build/composite/item.cjs.map +3 -3
  23. package/build/context/context-system-provider.cjs +2 -5
  24. package/build/context/context-system-provider.cjs.map +3 -3
  25. package/build/context/use-context-system.cjs +7 -2
  26. package/build/context/use-context-system.cjs.map +2 -2
  27. package/build/disabled/index.cjs +1 -1
  28. package/build/disabled/index.cjs.map +2 -2
  29. package/build/draggable/index.cjs.map +1 -1
  30. package/build/form-token-field/index.cjs +1 -1
  31. package/build/form-token-field/index.cjs.map +2 -2
  32. package/build/icon/index.cjs +30 -12
  33. package/build/icon/index.cjs.map +2 -2
  34. package/build/input-control/styles/input-control-styles.cjs +42 -27
  35. package/build/input-control/styles/input-control-styles.cjs.map +2 -2
  36. package/build/item-group/context.cjs +1 -0
  37. package/build/item-group/context.cjs.map +2 -2
  38. package/build/item-group/item/component.cjs +12 -0
  39. package/build/item-group/item/component.cjs.map +3 -3
  40. package/build/item-group/item/hook.cjs +7 -6
  41. package/build/item-group/item/hook.cjs.map +2 -2
  42. package/build/item-group/item-group/component.cjs +1 -0
  43. package/build/item-group/item-group/component.cjs.map +2 -2
  44. package/build/item-group/item-group/hook.cjs +1 -1
  45. package/build/item-group/item-group/hook.cjs.map +2 -2
  46. package/build/progress-bar/index.cjs +1 -1
  47. package/build/progress-bar/index.cjs.map +2 -2
  48. package/build/resizable-box/index.cjs.map +1 -1
  49. package/build/snackbar/index.cjs +8 -5
  50. package/build/snackbar/index.cjs.map +2 -2
  51. package/build/textarea-control/index.cjs +1 -1
  52. package/build/textarea-control/index.cjs.map +2 -2
  53. package/build/toggle-group-control/context.cjs +8 -2
  54. package/build/toggle-group-control/context.cjs.map +2 -2
  55. package/build/toggle-group-control/toggle-group-control/as-button-group.cjs +5 -2
  56. package/build/toggle-group-control/toggle-group-control/as-button-group.cjs.map +2 -2
  57. package/build/toggle-group-control/toggle-group-control/as-radio-group.cjs +5 -2
  58. package/build/toggle-group-control/toggle-group-control/as-radio-group.cjs.map +2 -2
  59. package/build/toggle-group-control/toggle-group-control/component.cjs +3 -1
  60. package/build/toggle-group-control/toggle-group-control/component.cjs.map +2 -2
  61. package/build/toggle-group-control/toggle-group-control-option/component.cjs +2 -0
  62. package/build/toggle-group-control/toggle-group-control-option/component.cjs.map +2 -2
  63. package/build/toggle-group-control/toggle-group-control-option-base/component.cjs +2 -1
  64. package/build/toggle-group-control/toggle-group-control-option-base/component.cjs.map +2 -2
  65. package/build/toggle-group-control/toggle-group-control-option-icon/component.cjs +2 -0
  66. package/build/toggle-group-control/toggle-group-control-option-icon/component.cjs.map +2 -2
  67. package/build/tools-panel/tools-panel/hook.cjs +102 -106
  68. package/build/tools-panel/tools-panel/hook.cjs.map +2 -2
  69. package/build/tools-panel/tools-panel-item/hook.cjs +33 -33
  70. package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
  71. package/build/tree-grid/cell.cjs +4 -0
  72. package/build/tree-grid/cell.cjs.map +2 -2
  73. package/build/tree-grid/roving-tab-index-item.cjs +5 -1
  74. package/build/tree-grid/roving-tab-index-item.cjs.map +2 -2
  75. package/build/tree-grid/row.cjs +6 -1
  76. package/build/tree-grid/row.cjs.map +2 -2
  77. package/build/tree-grid/use-validate-tree-grid-structure.cjs +81 -0
  78. package/build/tree-grid/use-validate-tree-grid-structure.cjs.map +7 -0
  79. package/build/utils/colors-values.cjs +3 -2
  80. package/build/utils/colors-values.cjs.map +2 -2
  81. package/build-module/border-box-control/border-box-control/component.mjs +38 -6
  82. package/build-module/border-box-control/border-box-control/component.mjs.map +2 -2
  83. package/build-module/border-box-control/border-box-control/hook.mjs +14 -3
  84. package/build-module/border-box-control/border-box-control/hook.mjs.map +2 -2
  85. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs +2 -2
  86. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs.map +2 -2
  87. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs +2 -2
  88. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs.map +2 -2
  89. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs +2 -2
  90. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs.map +2 -2
  91. package/build-module/color-palette/index.mjs +1 -1
  92. package/build-module/color-palette/index.mjs.map +2 -2
  93. package/build-module/composite/context.mjs +6 -1
  94. package/build-module/composite/context.mjs.map +2 -2
  95. package/build-module/composite/group-label.mjs +5 -1
  96. package/build-module/composite/group-label.mjs.map +2 -2
  97. package/build-module/composite/group.mjs +11 -3
  98. package/build-module/composite/group.mjs.map +2 -2
  99. package/build-module/composite/item.mjs +4 -0
  100. package/build-module/composite/item.mjs.map +2 -2
  101. package/build-module/context/context-system-provider.mjs +2 -5
  102. package/build-module/context/context-system-provider.mjs.map +3 -3
  103. package/build-module/context/use-context-system.mjs +7 -2
  104. package/build-module/context/use-context-system.mjs.map +2 -2
  105. package/build-module/disabled/index.mjs +1 -1
  106. package/build-module/disabled/index.mjs.map +2 -2
  107. package/build-module/draggable/index.mjs.map +1 -1
  108. package/build-module/form-token-field/index.mjs +1 -1
  109. package/build-module/form-token-field/index.mjs.map +2 -2
  110. package/build-module/icon/index.mjs +30 -12
  111. package/build-module/icon/index.mjs.map +2 -2
  112. package/build-module/input-control/styles/input-control-styles.mjs +42 -27
  113. package/build-module/input-control/styles/input-control-styles.mjs.map +2 -2
  114. package/build-module/item-group/context.mjs +1 -0
  115. package/build-module/item-group/context.mjs.map +2 -2
  116. package/build-module/item-group/item/component.mjs +12 -0
  117. package/build-module/item-group/item/component.mjs.map +2 -2
  118. package/build-module/item-group/item/hook.mjs +7 -6
  119. package/build-module/item-group/item/hook.mjs.map +2 -2
  120. package/build-module/item-group/item-group/component.mjs +1 -0
  121. package/build-module/item-group/item-group/component.mjs.map +2 -2
  122. package/build-module/item-group/item-group/hook.mjs +1 -1
  123. package/build-module/item-group/item-group/hook.mjs.map +2 -2
  124. package/build-module/progress-bar/index.mjs +1 -1
  125. package/build-module/progress-bar/index.mjs.map +2 -2
  126. package/build-module/resizable-box/index.mjs.map +1 -1
  127. package/build-module/snackbar/index.mjs +8 -5
  128. package/build-module/snackbar/index.mjs.map +2 -2
  129. package/build-module/textarea-control/index.mjs +1 -1
  130. package/build-module/textarea-control/index.mjs.map +2 -2
  131. package/build-module/toggle-group-control/context.mjs +8 -2
  132. package/build-module/toggle-group-control/context.mjs.map +2 -2
  133. package/build-module/toggle-group-control/toggle-group-control/as-button-group.mjs +5 -2
  134. package/build-module/toggle-group-control/toggle-group-control/as-button-group.mjs.map +2 -2
  135. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.mjs +5 -2
  136. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.mjs.map +2 -2
  137. package/build-module/toggle-group-control/toggle-group-control/component.mjs +3 -1
  138. package/build-module/toggle-group-control/toggle-group-control/component.mjs.map +2 -2
  139. package/build-module/toggle-group-control/toggle-group-control-option/component.mjs +2 -0
  140. package/build-module/toggle-group-control/toggle-group-control-option/component.mjs.map +2 -2
  141. package/build-module/toggle-group-control/toggle-group-control-option-base/component.mjs +2 -1
  142. package/build-module/toggle-group-control/toggle-group-control-option-base/component.mjs.map +2 -2
  143. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.mjs +2 -0
  144. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.mjs.map +2 -2
  145. package/build-module/tools-panel/tools-panel/hook.mjs +103 -107
  146. package/build-module/tools-panel/tools-panel/hook.mjs.map +2 -2
  147. package/build-module/tools-panel/tools-panel-item/hook.mjs +35 -35
  148. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
  149. package/build-module/tree-grid/cell.mjs +5 -1
  150. package/build-module/tree-grid/cell.mjs.map +2 -2
  151. package/build-module/tree-grid/roving-tab-index-item.mjs +5 -1
  152. package/build-module/tree-grid/roving-tab-index-item.mjs.map +2 -2
  153. package/build-module/tree-grid/row.mjs +7 -2
  154. package/build-module/tree-grid/row.mjs.map +2 -2
  155. package/build-module/tree-grid/use-validate-tree-grid-structure.mjs +56 -0
  156. package/build-module/tree-grid/use-validate-tree-grid-structure.mjs.map +7 -0
  157. package/build-module/utils/colors-values.mjs +3 -2
  158. package/build-module/utils/colors-values.mjs.map +2 -2
  159. package/build-style/style-rtl.css +27 -85
  160. package/build-style/style.css +27 -85
  161. package/build-types/border-box-control/border-box-control/component.d.ts +4 -0
  162. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  163. package/build-types/border-box-control/border-box-control/hook.d.ts +4 -2
  164. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  165. package/build-types/border-box-control/types.d.ts +6 -2
  166. package/build-types/border-box-control/types.d.ts.map +1 -1
  167. package/build-types/composite/context.d.ts +2 -0
  168. package/build-types/composite/context.d.ts.map +1 -1
  169. package/build-types/composite/group-label.d.ts.map +1 -1
  170. package/build-types/composite/group.d.ts.map +1 -1
  171. package/build-types/composite/item.d.ts.map +1 -1
  172. package/build-types/composite/types.d.ts +1 -1
  173. package/build-types/context/context-system-provider.d.ts +8 -6
  174. package/build-types/context/context-system-provider.d.ts.map +1 -1
  175. package/build-types/context/use-context-system.d.ts.map +1 -1
  176. package/build-types/icon/index.d.ts.map +1 -1
  177. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  178. package/build-types/item-group/context.d.ts.map +1 -1
  179. package/build-types/item-group/item/component.d.ts.map +1 -1
  180. package/build-types/item-group/item/hook.d.ts +1 -1
  181. package/build-types/item-group/item/hook.d.ts.map +1 -1
  182. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  183. package/build-types/item-group/types.d.ts +4 -0
  184. package/build-types/item-group/types.d.ts.map +1 -1
  185. package/build-types/popover/types.d.ts +6 -2
  186. package/build-types/popover/types.d.ts.map +1 -1
  187. package/build-types/snackbar/index.d.ts.map +1 -1
  188. package/build-types/toggle-group-control/context.d.ts +2 -2
  189. package/build-types/toggle-group-control/context.d.ts.map +1 -1
  190. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
  191. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  192. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
  193. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  194. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  195. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -2
  196. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  197. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  198. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +2 -2
  199. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  200. package/build-types/toggle-group-control/types.d.ts +12 -3
  201. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  202. package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
  203. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  204. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  205. package/build-types/tools-panel/types.d.ts +52 -9
  206. package/build-types/tools-panel/types.d.ts.map +1 -1
  207. package/build-types/tree-grid/cell.d.ts.map +1 -1
  208. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
  209. package/build-types/tree-grid/row.d.ts.map +1 -1
  210. package/build-types/tree-grid/use-validate-tree-grid-structure.d.ts +2 -0
  211. package/build-types/tree-grid/use-validate-tree-grid-structure.d.ts.map +1 -0
  212. package/build-types/utils/colors-values.d.ts.map +1 -1
  213. package/emotion-to-scss-modules.md +149 -0
  214. package/package.json +28 -27
  215. package/src/alignment-matrix-control/test/{index.tsx → index.jsdom.test.tsx} +5 -4
  216. package/src/angle-picker-control/style.module.scss +1 -1
  217. package/src/autocomplete/test/get-autocomplete-match.ts +2 -1
  218. package/src/autocomplete/test/{index.tsx → index.jsdom.test.tsx} +2 -1
  219. package/src/badge/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  220. package/src/base-control/stories/index.story.tsx +2 -2
  221. package/src/base-control/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  222. package/src/border-box-control/border-box-control/README.md +5 -3
  223. package/src/border-box-control/border-box-control/component.tsx +83 -15
  224. package/src/border-box-control/border-box-control/hook.ts +19 -1
  225. package/src/border-box-control/stories/index.story.tsx +10 -0
  226. package/src/border-box-control/style.module.scss +34 -3
  227. package/src/border-box-control/test/{index.tsx → index.jsdom.test.tsx} +138 -2
  228. package/src/border-box-control/test/utils.ts +11 -0
  229. package/src/border-box-control/types.ts +6 -2
  230. package/src/border-control/test/{index.js → index.jsdom.test.tsx} +44 -24
  231. package/src/box-control/test/{index.tsx → index.jsdom.test.tsx} +6 -3
  232. package/src/button/style.scss +0 -6
  233. package/src/button/test/{index.tsx → index.jsdom.test.tsx} +6 -2
  234. package/src/checkbox-control/stories/index.story.tsx +1 -1
  235. package/src/checkbox-control/style.scss +2 -2
  236. package/src/checkbox-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +10 -7
  237. package/src/checkbox-control/test/{index.tsx → index.jsdom.test.tsx} +4 -1
  238. package/src/circular-option-picker/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  239. package/src/color-indicator/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +2 -2
  240. package/src/color-indicator/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  241. package/src/color-palette/index.tsx +1 -1
  242. package/src/color-palette/test/{index.tsx → index.jsdom.test.tsx} +25 -22
  243. package/src/color-palette/test/{utils.ts → utils.jsdom.test.ts} +1 -0
  244. package/src/combobox-control/test/{index.tsx → index.jsdom.test.tsx} +12 -7
  245. package/src/composite/README.md +1 -1
  246. package/src/composite/context.tsx +6 -0
  247. package/src/composite/group-label.tsx +8 -1
  248. package/src/composite/group.tsx +9 -2
  249. package/src/composite/item.tsx +6 -0
  250. package/src/composite/legacy/test/{index.tsx → index.jsdom.test.tsx} +6 -13
  251. package/src/composite/test/{index.tsx → index.jsdom.test.tsx} +60 -17
  252. package/src/composite/types.ts +1 -1
  253. package/src/confirm-dialog/test/{index.tsx → index.jsdom.test.tsx} +16 -14
  254. package/src/content-editable-control/test/{index.tsx → index.jsdom.test.tsx} +4 -3
  255. package/src/context/{context-system-provider.js → context-system-provider.tsx} +19 -5
  256. package/src/context/stories/{ComponentsProvider.stories.jsx → ComponentsProvider.stories.tsx} +2 -2
  257. package/src/context/test/context-connect.tsx +1 -2
  258. package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx} +93 -51
  259. package/src/context/test/wordpress-component.tsx +1 -2
  260. package/src/context/use-context-system.js +13 -4
  261. package/src/custom-gradient-picker/gradient-bar/test/{utils.ts → utils.jsdom.test.ts} +6 -5
  262. package/src/custom-gradient-picker/test/serializer.ts +1 -0
  263. package/src/custom-select-control-v2/test/{index.tsx → index.jsdom.test.tsx} +4 -1
  264. package/src/date-time/date-picker/test/{index.tsx → index.jsdom.test.tsx} +6 -3
  265. package/src/date-time/date-picker/test/{use-lilius.ts → use-lilius.jsdom.test.ts} +1 -0
  266. package/src/date-time/date-time/test/{index.tsx → index.jsdom.test.tsx} +20 -11
  267. package/src/date-time/test/utils.test.ts +9 -0
  268. package/src/date-time/time-picker/test/{index.tsx → index.jsdom.test.tsx} +37 -27
  269. package/src/date-time/time-picker/time-input/test/{index.tsx → index.jsdom.test.tsx} +8 -3
  270. package/src/disabled/index.tsx +7 -7
  271. package/src/disabled/test/{index.tsx → index.jsdom.test.tsx} +26 -0
  272. package/src/draggable/index.tsx +1 -1
  273. package/src/draggable/style.module.scss +1 -1
  274. package/src/dropdown/style.module.scss +2 -2
  275. package/src/dropdown/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  276. package/src/dropdown-menu/test/{index.tsx → index.jsdom.test.tsx} +5 -4
  277. package/src/duotone-picker/test/{custom-duotone-bar.tsx → custom-duotone-bar.jsdom.test.tsx} +11 -8
  278. package/src/duotone-picker/test/{index.tsx → index.jsdom.test.tsx} +11 -10
  279. package/src/external-link/test/{index.tsx → index.jsdom.test.tsx} +5 -4
  280. package/src/focal-point-picker/test/{index.tsx → index.jsdom.test.tsx} +12 -9
  281. package/src/focal-point-picker/test/{media.tsx → media.jsdom.test.tsx} +1 -0
  282. package/src/font-size-picker/test/{font-size-picker-select.tsx → font-size-picker-select.jsdom.test.tsx} +19 -16
  283. package/src/font-size-picker/test/{font-size-picker-toggle-group.tsx → font-size-picker-toggle-group.jsdom.test.tsx} +13 -11
  284. package/src/font-size-picker/test/{index.tsx → index.jsdom.test.tsx} +19 -14
  285. package/src/font-size-picker/test/utils.ts +1 -0
  286. package/src/form-toggle/style.scss +1 -1
  287. package/src/form-toggle/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +4 -4
  288. package/src/form-toggle/test/{index.tsx → index.jsdom.test.tsx} +2 -1
  289. package/src/form-token-field/index.tsx +1 -1
  290. package/src/form-token-field/test/{index.tsx → index.jsdom.test.tsx} +86 -44
  291. package/src/gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +12 -9
  292. package/src/guide/test/{index.tsx → index.jsdom.test.tsx} +4 -2
  293. package/src/h-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +4 -4
  294. package/src/h-stack/test/{index.tsx → index.jsdom.test.tsx} +3 -0
  295. package/src/higher-order/with-fallback-styles/test/{index.tsx → index.jsdom.test.tsx} +3 -2
  296. package/src/higher-order/with-filters/test/__snapshots__/index.jsdom.test.tsx.snap +87 -0
  297. package/src/higher-order/with-filters/test/{index.tsx → index.jsdom.test.tsx} +6 -5
  298. package/src/higher-order/with-focus-outside/test/{index.tsx → index.jsdom.test.tsx} +2 -1
  299. package/src/higher-order/with-focus-return/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  300. package/src/higher-order/with-notices/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  301. package/src/higher-order/with-spoken-messages/test/{index.tsx → index.jsdom.test.tsx} +3 -2
  302. package/src/icon/index.tsx +28 -12
  303. package/src/icon/test/{index.tsx → index.jsdom.test.tsx} +66 -0
  304. package/src/input-control/styles/input-control-styles.tsx +38 -7
  305. package/src/input-control/test/{index.js → index.jsdom.test.tsx} +16 -10
  306. package/src/isolated-event-container/test/{index.tsx → index.jsdom.test.tsx} +4 -3
  307. package/src/item-group/context.ts +1 -0
  308. package/src/item-group/item/component.tsx +19 -1
  309. package/src/item-group/item/hook.ts +2 -3
  310. package/src/item-group/item-group/component.tsx +1 -0
  311. package/src/item-group/style.module.scss +1 -2
  312. package/src/item-group/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +9 -9
  313. package/src/item-group/test/{index.js → index.jsdom.test.tsx} +99 -2
  314. package/src/item-group/types.ts +4 -0
  315. package/src/keyboard-shortcuts/test/{index.tsx → index.jsdom.test.tsx} +5 -4
  316. package/src/menu/test/{index.tsx → index.jsdom.test.tsx} +67 -23
  317. package/src/menu-group/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  318. package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +5 -5
  319. package/src/menu-item/test/{index.js → index.jsdom.test.tsx} +1 -0
  320. package/src/modal/test/{aria-helper.ts → aria-helper.jsdom.test.ts} +1 -0
  321. package/src/modal/test/{index.tsx → index.jsdom.test.tsx} +9 -5
  322. package/src/navigable-container/test/{navigable-menu.tsx → navigable-menu.jsdom.test.tsx} +7 -5
  323. package/src/navigable-container/test/{tababble-container.tsx → tababble-container.jsdom.test.tsx} +5 -3
  324. package/src/navigator/test/{index.tsx → index.jsdom.test.tsx} +5 -2
  325. package/src/navigator/test/router.ts +1 -0
  326. package/src/notice/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +7 -4
  327. package/src/notice/test/{index.tsx → index.jsdom.test.tsx} +8 -4
  328. package/src/notice/test/{list.tsx → list.jsdom.test.tsx} +1 -0
  329. package/src/number-control/test/{index.tsx → index.jsdom.test.tsx} +9 -6
  330. package/src/palette-edit/test/{index.tsx → index.jsdom.test.tsx} +16 -13
  331. package/src/panel/test/__snapshots__/body.jsdom.test.tsx.snap +9 -0
  332. package/src/panel/test/__snapshots__/header.jsdom.test.tsx.snap +9 -0
  333. package/src/panel/test/__snapshots__/index.jsdom.test.tsx.snap +17 -0
  334. package/src/panel/test/__snapshots__/row.jsdom.test.tsx.snap +17 -0
  335. package/src/panel/test/{body.tsx → body.jsdom.test.tsx} +2 -1
  336. package/src/panel/test/{header.tsx → header.jsdom.test.tsx} +1 -0
  337. package/src/panel/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  338. package/src/panel/test/{row.tsx → row.jsdom.test.tsx} +1 -0
  339. package/src/placeholder/style.scss +0 -5
  340. package/src/placeholder/test/{index.tsx → index.jsdom.test.tsx} +19 -14
  341. package/src/popover/README.md +2 -2
  342. package/src/popover/test/{index.tsx → index.jsdom.test.tsx} +23 -0
  343. package/src/popover/types.ts +9 -3
  344. package/src/progress-bar/style.module.scss +9 -1
  345. package/src/query-controls/test/terms.ts +1 -0
  346. package/src/radio-control/test/{index.tsx → index.jsdom.test.tsx} +14 -11
  347. package/src/range-control/test/{index.tsx → index.jsdom.test.tsx} +10 -7
  348. package/src/resizable-box/index.tsx +1 -1
  349. package/src/sandbox/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  350. package/src/scroll-lock/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  351. package/src/shortcut/test/__snapshots__/index.jsdom.test.tsx.snap +15 -0
  352. package/src/shortcut/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  353. package/src/slot-fill/test/{index.js → index.jsdom.test.tsx} +4 -3
  354. package/src/slot-fill/test/{slot.js → slot.jsdom.test.tsx} +17 -9
  355. package/src/snackbar/index.tsx +10 -6
  356. package/src/snackbar/test/{index.tsx → index.jsdom.test.tsx} +41 -11
  357. package/src/snackbar/test/list.jsdom.test.tsx +100 -0
  358. package/src/style-provider/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  359. package/src/surface/style.module.scss +2 -2
  360. package/src/surface/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  361. package/src/tab-panel/style.scss +4 -23
  362. package/src/tab-panel/test/{index.tsx → index.jsdom.test.tsx} +22 -21
  363. package/src/tabs/test/{index.tsx → index.jsdom.test.tsx} +21 -19
  364. package/src/text-control/test/{text-control.tsx → text-control.jsdom.test.tsx} +1 -0
  365. package/src/text-highlight/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  366. package/src/textarea-control/style.module.scss +9 -4
  367. package/src/tip/style.scss +1 -1
  368. package/src/toggle-control/test/{index.tsx → index.jsdom.test.tsx} +4 -1
  369. package/src/toggle-group-control/context.ts +14 -5
  370. package/src/toggle-group-control/stories/index.story.tsx +15 -2
  371. package/src/toggle-group-control/test/{index.tsx → index.jsdom.test.tsx} +283 -9
  372. package/src/toggle-group-control/toggle-group-control/README.md +8 -5
  373. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +4 -0
  374. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +4 -0
  375. package/src/toggle-group-control/toggle-group-control/component.tsx +2 -0
  376. package/src/toggle-group-control/toggle-group-control/style.module.scss +8 -2
  377. package/src/toggle-group-control/toggle-group-control-option/README.md +8 -5
  378. package/src/toggle-group-control/toggle-group-control-option/component.tsx +2 -0
  379. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +4 -1
  380. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +7 -0
  381. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +2 -0
  382. package/src/toggle-group-control/types.ts +12 -3
  383. package/src/toolbar/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  384. package/src/toolbar/test/{toolbar-group.tsx → toolbar-group.jsdom.test.tsx} +2 -1
  385. package/src/tools-panel/test/{index.tsx → index.jsdom.test.tsx} +595 -47
  386. package/src/tools-panel/tools-panel/hook.ts +195 -180
  387. package/src/tools-panel/tools-panel-item/README.md +42 -1
  388. package/src/tools-panel/tools-panel-item/hook.ts +97 -69
  389. package/src/tools-panel/types.ts +54 -9
  390. package/src/tooltip/test/{index.tsx → index.jsdom.test.tsx} +5 -3
  391. package/src/tree-grid/cell.tsx +6 -2
  392. package/src/tree-grid/roving-tab-index-item.tsx +7 -3
  393. package/src/tree-grid/row.tsx +8 -2
  394. package/src/tree-grid/test/__snapshots__/{cell.tsx.snap → cell.jsdom.test.tsx.snap} +2 -2
  395. package/src/tree-grid/test/__snapshots__/index.jsdom.test.tsx.snap +3 -0
  396. package/src/tree-grid/test/__snapshots__/roving-tab-index-item.jsdom.test.tsx.snap +27 -0
  397. package/src/tree-grid/test/__snapshots__/roving-tab-index.jsdom.test.tsx.snap +9 -0
  398. package/src/tree-grid/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +9 -5
  399. package/src/tree-grid/test/cell.jsdom.test.tsx +149 -0
  400. package/src/tree-grid/test/{index.tsx → index.jsdom.test.tsx} +9 -7
  401. package/src/tree-grid/test/{roving-tab-index-item.tsx → roving-tab-index-item.jsdom.test.tsx} +4 -1
  402. package/src/tree-grid/test/{roving-tab-index.tsx → roving-tab-index.jsdom.test.tsx} +1 -0
  403. package/src/tree-grid/test/row.jsdom.test.tsx +132 -0
  404. package/src/tree-grid/use-validate-tree-grid-structure.ts +104 -0
  405. package/src/truncate/style.module.scss +0 -1
  406. package/src/truncate/test/{index.tsx → index.jsdom.test.tsx} +1 -0
  407. package/src/unit-control/test/{index.tsx → index.jsdom.test.tsx} +22 -19
  408. package/src/unit-control/test/utils.ts +1 -0
  409. package/src/utils/colors-values.js +5 -4
  410. package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsdom.test.tsx} +22 -7
  411. package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsdom.test.tsx} +6 -3
  412. package/src/utils/hooks/test/{use-cx.js → use-cx.jsdom.test.tsx} +8 -5
  413. package/src/utils/test/colors.js +1 -0
  414. package/src/utils/test/{get-node-text.js → get-node-text.tsx} +1 -0
  415. package/src/utils/test/math.js +1 -0
  416. package/src/utils/test/rtl.js +1 -0
  417. package/src/utils/test/space.js +1 -0
  418. package/src/utils/test/strings.js +1 -0
  419. package/src/utils/test/unit-values.js +1 -0
  420. package/src/v-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +4 -4
  421. package/src/v-stack/test/{index.tsx → index.jsdom.test.tsx} +3 -0
  422. package/src/validated-form-controls/style.scss +11 -15
  423. package/src/validated-form-controls/test/{content-editable-control.tsx → content-editable-control.jsdom.test.tsx} +1 -1
  424. package/src/validated-form-controls/test/{custom-select-control.tsx → custom-select-control.jsdom.test.tsx} +3 -0
  425. package/src/validated-form-controls/test/{input-control.tsx → input-control.jsdom.test.tsx} +3 -0
  426. package/src/validated-form-controls/test/{range-control.tsx → range-control.jsdom.test.tsx} +3 -0
  427. package/src/validated-form-controls/test/{textarea-control.tsx → textarea-control.jsdom.test.tsx} +1 -0
  428. package/src/view/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +7 -7
  429. package/src/view/test/{index.js → index.jsdom.test.tsx} +7 -2
  430. package/src/context/test/__snapshots__/context-system-provider.js.snap +0 -35
  431. package/src/higher-order/with-filters/test/__snapshots__/index.tsx.snap +0 -87
  432. package/src/panel/test/__snapshots__/body.tsx.snap +0 -9
  433. package/src/panel/test/__snapshots__/header.tsx.snap +0 -9
  434. package/src/panel/test/__snapshots__/index.tsx.snap +0 -17
  435. package/src/panel/test/__snapshots__/row.tsx.snap +0 -17
  436. package/src/shortcut/test/__snapshots__/index.tsx.snap +0 -15
  437. package/src/snackbar/test/list.tsx +0 -39
  438. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +0 -359
  439. package/src/tree-grid/test/__snapshots__/index.tsx.snap +0 -3
  440. package/src/tree-grid/test/__snapshots__/roving-tab-index-item.tsx.snap +0 -27
  441. package/src/tree-grid/test/__snapshots__/roving-tab-index.tsx.snap +0 -9
  442. package/src/tree-grid/test/cell.tsx +0 -46
  443. package/src/tree-grid/test/row.tsx +0 -37
  444. /package/src/card/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  445. /package/src/card/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  446. /package/src/color-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  447. /package/src/custom-gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  448. /package/src/custom-select-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  449. /package/src/custom-select-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  450. /package/src/divider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  451. /package/src/elevation/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  452. /package/src/elevation/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  453. /package/src/flex/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  454. /package/src/flex/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  455. /package/src/form-file-upload/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  456. /package/src/grid/test/{grid.tsx → grid.jsdom.test.tsx} +0 -0
  457. /package/src/heading/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  458. /package/src/heading/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  459. /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  460. /package/src/progress-bar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  461. /package/src/resizable-box/resize-tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  462. /package/src/resizable-box/resize-tooltip/test/{label.tsx → label.jsdom.test.tsx} +0 -0
  463. /package/src/scrollable/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  464. /package/src/search-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  465. /package/src/select-control/test/__snapshots__/{select-control.tsx.snap → select-control.jsdom.test.tsx.snap} +0 -0
  466. /package/src/select-control/test/{select-control.tsx → select-control.jsdom.test.tsx} +0 -0
  467. /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsdom.test.tsx.snap} +0 -0
  468. /package/src/spacer/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  469. /package/src/spacer/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  470. /package/src/text/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  471. /package/src/text/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  472. /package/src/utils/test/{polymorphic-element.tsx → polymorphic-element.jsdom.test.tsx} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/context/context-system-provider.js"],
4
- "sourcesContent": ["import deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport { isPlainObject } from 'is-plain-object';\nimport { createContext, useContext, useRef, useMemo, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\nimport { useUpdateEffect } from '../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComponentsContext = createContext(/** @type {Record<string, any>} */{});\nComponentsContext.displayName = 'ComponentsContext';\nexport const useComponentsContext = () => useContext(ComponentsContext);\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) &&\n // But not the same reference.\n valueRef.current !== value) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n\n // `parentContext` will always be memoized (i.e., the result of this hook itself)\n // or the default value from when the `ComponentsContext` was originally\n // initialized (which will never change, it's a static variable)\n // so this memoization will prevent `deepmerge()` from rerunning unless\n // the references to `value` change OR the `parentContext` has an actual material change\n // (because again, it's guaranteed to be memoized or a static reference to the empty object\n // so we know that the only changes for `parentContext` are material ones... i.e., why we\n // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n // correctly warning when the `value` isn't being properly memoized. All of that to say\n // that this should be super safe to assume that `useMemo` will only run on actual\n // changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n const config = useMemo(() => {\n // Deep clone `parentContext` to avoid mutating it later.\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {React.ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {React.JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /*#__PURE__*/_jsx(ComponentsContext.Provider, {\n value: contextValue,\n children: children\n });\n};\nexport const ContextSystemProvider = memo(BaseContextSystemProvider);"],
5
- "mappings": ";AAAA,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,YAAY,QAAQ,SAAS,YAAY;AACjE,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,OAAO,YAAY;AACrB,IAAM,oBAAoB;AAAA;AAAA,EAAgD,CAAC;AAAC;AACnF,kBAAkB,cAAc;AACzB,IAAM,uBAAuB,MAAM,WAAW,iBAAiB;AAWtE,SAAS,uBAAuB;AAAA,EAC9B;AACF,GAAG;AACD,QAAM,gBAAgB,qBAAqB;AAC3C,QAAM,WAAW,OAAO,KAAK;AAC7B,kBAAgB,MAAM;AACpB;AAAA;AAAA,MAEA,cAAc,SAAS,SAAS,KAAK;AAAA,MAErC,SAAS,YAAY;AAAA,MAAO;AAC1B,iBAAW,iBAAiB,OAAO,KAAK,gCAAgC,KAAK,UAAU,KAAK,CAAC,EAAE,IAAI;AAAA,IACrG;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAcV,QAAM,SAAS,QAAQ,MAAM;AAE3B,WAAO,UAAU,iBAAiB,CAAC,GAAG,SAAS,CAAC,GAAG;AAAA,MACjD,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,SAAO;AACT;AAmBA,IAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,uBAAuB;AAAA,IAC1C;AAAA,EACF,CAAC;AACD,SAAoB,qBAAK,kBAAkB,UAAU;AAAA,IACnD,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;AACO,IAAM,wBAAwB,KAAK,yBAAyB;",
3
+ "sources": ["../../src/context/context-system-provider.tsx"],
4
+ "sourcesContent": ["import deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport { isPlainObject } from 'is-plain-object';\nimport { createContext, useContext, useRef, useMemo, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\nimport { useUpdateEffect } from '../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComponentsContext = createContext({});\nComponentsContext.displayName = 'ComponentsContext';\nexport const useComponentsContext = () => useContext(ComponentsContext);\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) &&\n // But not the same reference.\n valueRef.current !== value) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n\n // `parentContext` will always be memoized (i.e., the result of this hook itself)\n // or the default value from when the `ComponentsContext` was originally\n // initialized (which will never change, it's a static variable)\n // so this memoization will prevent `deepmerge()` from rerunning unless\n // the references to `value` change OR the `parentContext` has an actual material change\n // (because again, it's guaranteed to be memoized or a static reference to the empty object\n // so we know that the only changes for `parentContext` are material ones... i.e., why we\n // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n // correctly warning when the `value` isn't being properly memoized. All of that to say\n // that this should be super safe to assume that `useMemo` will only run on actual\n // changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n const config = useMemo(() => {\n // Deep clone `parentContext` to avoid mutating it later.\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {React.ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {React.JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /*#__PURE__*/_jsx(ComponentsContext.Provider, {\n value: contextValue,\n children: children\n });\n};\nexport const ContextSystemProvider = memo(BaseContextSystemProvider);"],
5
+ "mappings": ";AAAA,OAAO,eAAe;AACtB,OAAO,mBAAmB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,YAAY,QAAQ,SAAS,YAAY;AACjE,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,OAAO,YAAY;AACrB,IAAM,oBAAoB,cAAc,CAAC,CAAC;AACjD,kBAAkB,cAAc;AACzB,IAAM,uBAAuB,MAAM,WAAW,iBAAiB;AAWtE,SAAS,uBAAuB;AAAA,EAC9B;AACF,GAAG;AACD,QAAM,gBAAgB,qBAAqB;AAC3C,QAAM,WAAW,OAAO,KAAK;AAC7B,kBAAgB,MAAM;AACpB;AAAA;AAAA,MAEA,cAAc,SAAS,SAAS,KAAK;AAAA,MAErC,SAAS,YAAY;AAAA,MAAO;AAC1B,iBAAW,iBAAiB,OAAO,KAAK,gCAAgC,KAAK,UAAU,KAAK,CAAC,EAAE,IAAI;AAAA,IACrG;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAcV,QAAM,SAAS,QAAQ,MAAM;AAE3B,WAAO,UAAU,iBAAiB,CAAC,GAAG,SAAS,CAAC,GAAG;AAAA,MACjD,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,SAAO;AACT;AAmBA,IAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,uBAAuB;AAAA,IAC1C;AAAA,EACF,CAAC;AACD,SAAoB,qBAAK,kBAAkB,UAAU;AAAA,IACnD,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;AACO,IAAM,wBAAwB,KAAK,yBAAyB;",
6
6
  "names": []
7
7
  }
@@ -15,13 +15,18 @@ function useContextSystem(props, namespace) {
15
15
  ...getNamespace(namespace)
16
16
  };
17
17
  const {
18
- _overrides: overrideProps,
18
+ _overrides,
19
19
  ...otherContextProps
20
20
  } = contextProps;
21
+ const overrideProps = (
22
+ /** @type {Record<string, unknown>} */
23
+ _overrides
24
+ );
21
25
  const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
26
+ const propsWithChildren = initialMergedProps;
22
27
  const cx = useCx();
23
28
  const classes = cx(getStyledClassNameFromKey(namespace), props.className);
24
- const rendered = typeof initialMergedProps.renderChildren === "function" ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
29
+ const rendered = typeof propsWithChildren.renderChildren === "function" ? propsWithChildren.renderChildren(initialMergedProps) : propsWithChildren.children;
25
30
  for (const key in initialMergedProps) {
26
31
  finalComponentProps[key] = initialMergedProps[key];
27
32
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/context/use-context-system.js"],
4
- "sourcesContent": ["import warn from '@wordpress/warning';\nimport { useComponentsContext } from './context-system-provider';\nimport { getNamespace, getConnectedNamespace } from './utils';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport { useCx } from '../utils/hooks/use-cx';\n\n/**\n * @template TProps\n * @typedef {TProps & { className: string }} ConnectedProps\n */\n\n/**\n * Custom hook that derives registered props from the Context system.\n * These derived props are then consolidated with incoming component props.\n *\n * @template {{ className?: string }} P\n * @param {P} props Incoming props from the component.\n * @param {string} namespace The namespace to register and to derive context props from.\n * @return {ConnectedProps<P>} The connected props.\n */\nexport function useContextSystem(props, namespace) {\n const contextSystemProps = useComponentsContext();\n if (typeof namespace === 'undefined') {\n globalThis.SCRIPT_DEBUG === true ? warn('useContextSystem: Please provide a namespace') : void 0;\n }\n const contextProps = contextSystemProps?.[namespace] || {};\n\n /** @type {ConnectedProps<P>} */\n // @ts-expect-error The initial object cannot satisfy the generic `P`, whose props are copied in below.\n const finalComponentProps = {\n ...getConnectedNamespace(),\n ...getNamespace(namespace)\n };\n const {\n _overrides: overrideProps,\n ...otherContextProps\n } = contextProps;\n const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;\n const cx = useCx();\n const classes = cx(getStyledClassNameFromKey(namespace), props.className);\n\n // Provides the ability to customize the render of the component.\n const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;\n for (const key in initialMergedProps) {\n // @ts-expect-error A string key cannot index the merged props type.\n finalComponentProps[key] = initialMergedProps[key];\n }\n for (const key in overrideProps) {\n // @ts-expect-error A string key cannot index the merged props type.\n finalComponentProps[key] = overrideProps[key];\n }\n\n // Setting an `undefined` explicitly can cause unintended overwrites\n // when a `cloneElement()` is involved.\n if (rendered !== undefined) {\n // @ts-expect-error `children` does not exist on `ConnectedProps<P>`.\n finalComponentProps.children = rendered;\n }\n finalComponentProps.className = classes;\n return finalComponentProps;\n}"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,4BAA4B;AACrC,SAAS,cAAc,6BAA6B;AACpD,SAAS,iCAAiC;AAC1C,SAAS,aAAa;AAgBf,SAAS,iBAAiB,OAAO,WAAW;AACjD,QAAM,qBAAqB,qBAAqB;AAChD,MAAI,OAAO,cAAc,aAAa;AACpC,eAAW,iBAAiB,OAAO,KAAK,8CAA8C,IAAI;AAAA,EAC5F;AACA,QAAM,eAAe,qBAAqB,SAAS,KAAK,CAAC;AAIzD,QAAM,sBAAsB;AAAA,IAC1B,GAAG,sBAAsB;AAAA,IACzB,GAAG,aAAa,SAAS;AAAA,EAC3B;AACA,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,qBAAqB,OAAO,QAAQ,iBAAiB,EAAE,SAAS,OAAO,OAAO,CAAC,GAAG,mBAAmB,KAAK,IAAI;AACpH,QAAM,KAAK,MAAM;AACjB,QAAM,UAAU,GAAG,0BAA0B,SAAS,GAAG,MAAM,SAAS;AAGxE,QAAM,WAAW,OAAO,mBAAmB,mBAAmB,aAAa,mBAAmB,eAAe,kBAAkB,IAAI,mBAAmB;AACtJ,aAAW,OAAO,oBAAoB;AAEpC,wBAAoB,GAAG,IAAI,mBAAmB,GAAG;AAAA,EACnD;AACA,aAAW,OAAO,eAAe;AAE/B,wBAAoB,GAAG,IAAI,cAAc,GAAG;AAAA,EAC9C;AAIA,MAAI,aAAa,QAAW;AAE1B,wBAAoB,WAAW;AAAA,EACjC;AACA,sBAAoB,YAAY;AAChC,SAAO;AACT;",
4
+ "sourcesContent": ["import warn from '@wordpress/warning';\nimport { useComponentsContext } from './context-system-provider';\nimport { getNamespace, getConnectedNamespace } from './utils';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport { useCx } from '../utils/hooks/use-cx';\n\n/**\n * @template TProps\n * @typedef {TProps & { className: string }} ConnectedProps\n */\n\n/**\n * Custom hook that derives registered props from the Context system.\n * These derived props are then consolidated with incoming component props.\n *\n * @template {{ className?: string }} P\n * @param {P} props Incoming props from the component.\n * @param {string} namespace The namespace to register and to derive context props from.\n * @return {ConnectedProps<P>} The connected props.\n */\nexport function useContextSystem(props, namespace) {\n const contextSystemProps = useComponentsContext();\n if (typeof namespace === 'undefined') {\n globalThis.SCRIPT_DEBUG === true ? warn('useContextSystem: Please provide a namespace') : void 0;\n }\n const contextProps = contextSystemProps?.[namespace] || {};\n\n /** @type {ConnectedProps<P>} */\n // @ts-expect-error The initial object cannot satisfy the generic `P`, whose props are copied in below.\n const finalComponentProps = {\n ...getConnectedNamespace(),\n ...getNamespace(namespace)\n };\n const {\n _overrides,\n ...otherContextProps\n } = contextProps;\n /** @type {Record<string, unknown>} */\n const overrideProps = /** @type {Record<string, unknown>} */_overrides;\n const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;\n /**\n * @type {P & {\n * children?: React.ReactNode,\n * renderChildren?: (props: P) => React.ReactNode\n * }}\n */\n const propsWithChildren = initialMergedProps;\n const cx = useCx();\n const classes = cx(getStyledClassNameFromKey(namespace), props.className);\n\n // Provides the ability to customize the render of the component.\n const rendered = typeof propsWithChildren.renderChildren === 'function' ? propsWithChildren.renderChildren(initialMergedProps) : propsWithChildren.children;\n for (const key in initialMergedProps) {\n // @ts-expect-error A string key cannot index the merged props type.\n finalComponentProps[key] = initialMergedProps[key];\n }\n for (const key in overrideProps) {\n // @ts-expect-error A string key cannot index the merged props type.\n finalComponentProps[key] = overrideProps[key];\n }\n\n // Setting an `undefined` explicitly can cause unintended overwrites\n // when a `cloneElement()` is involved.\n if (rendered !== undefined) {\n // @ts-expect-error `children` does not exist on `ConnectedProps<P>`.\n finalComponentProps.children = rendered;\n }\n finalComponentProps.className = classes;\n return finalComponentProps;\n}"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,4BAA4B;AACrC,SAAS,cAAc,6BAA6B;AACpD,SAAS,iCAAiC;AAC1C,SAAS,aAAa;AAgBf,SAAS,iBAAiB,OAAO,WAAW;AACjD,QAAM,qBAAqB,qBAAqB;AAChD,MAAI,OAAO,cAAc,aAAa;AACpC,eAAW,iBAAiB,OAAO,KAAK,8CAA8C,IAAI;AAAA,EAC5F;AACA,QAAM,eAAe,qBAAqB,SAAS,KAAK,CAAC;AAIzD,QAAM,sBAAsB;AAAA,IAC1B,GAAG,sBAAsB;AAAA,IACzB,GAAG,aAAa,SAAS;AAAA,EAC3B;AACA,QAAM;AAAA,IACJ;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM;AAAA;AAAA,IAAsD;AAAA;AAC5D,QAAM,qBAAqB,OAAO,QAAQ,iBAAiB,EAAE,SAAS,OAAO,OAAO,CAAC,GAAG,mBAAmB,KAAK,IAAI;AAOpH,QAAM,oBAAoB;AAC1B,QAAM,KAAK,MAAM;AACjB,QAAM,UAAU,GAAG,0BAA0B,SAAS,GAAG,MAAM,SAAS;AAGxE,QAAM,WAAW,OAAO,kBAAkB,mBAAmB,aAAa,kBAAkB,eAAe,kBAAkB,IAAI,kBAAkB;AACnJ,aAAW,OAAO,oBAAoB;AAEpC,wBAAoB,GAAG,IAAI,mBAAmB,GAAG;AAAA,EACnD;AACA,aAAW,OAAO,eAAe;AAE/B,wBAAoB,GAAG,IAAI,cAAc,GAAG;AAAA,EAC9C;AAIA,MAAI,aAAa,QAAW;AAE1B,wBAAoB,WAAW;AAAA,EACjC;AACA,sBAAoB,YAAY;AAChC,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -102,7 +102,7 @@ function Disabled({
102
102
  children: /* @__PURE__ */ _jsx("div", {
103
103
  // @ts-expect-error `inert` is not declared in React 18's HTML attribute types.
104
104
  inert: isDisabled ? "true" : void 0,
105
- className: isDisabled ? clsx(style_module_default.disabled, className, "components-disabled") : void 0,
105
+ className: clsx(className, isDisabled && [style_module_default.disabled, "components-disabled"]) || void 0,
106
106
  ...props,
107
107
  children
108
108
  })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/disabled/index.tsx", "../../../style-runtime/src/index.ts", "../../src/disabled/style.module.scss"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport Context from './context';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst {\n Consumer,\n Provider\n} = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled({\n className,\n children,\n isDisabled = true,\n ...props\n}) {\n return /*#__PURE__*/_jsx(Provider, {\n value: isDisabled,\n children: /*#__PURE__*/_jsx(\"div\", {\n // @ts-expect-error `inert` is not declared in React 18's HTML attribute types.\n inert: isDisabled ? 'true' : undefined,\n className: isDisabled ? clsx(styles.disabled, className, 'components-disabled') : undefined,\n ...props,\n children: children\n })\n });\n}\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\nexport default Disabled;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"bacc423d2b\", \"._556ae8be2a7ddc8e__disabled{pointer-events:none;position:relative}._556ae8be2a7ddc8e__disabled:after{content:\\\"\\\";inset:0;position:absolute}._556ae8be2a7ddc8e__disabled *{pointer-events:none}\");\n}\nexport default {\"disabled\":\"_556ae8be2a7ddc8e__disabled\"};\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,OAAO,aAAa;;;ACDpB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YA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ACA,YAAQ,UAAU,IAAI,gBAAgB,QAAQ,CAAC;AAAA,EACjD;AACF;AAaO,SAAS,cAAc,MAAM,KAAK;AACvC,QAAM,UAAU,WAAW;AAC3B,UAAQ,OAAO,IAAI,MAAM,GAAG;AAC5B,aAAW,kBAAkB,QAAQ,UAAU,KAAK,GAAG;AACrD,gBAAY,gBAAgB,MAAM,GAAG;AAAA,EACvC;AACF;;;AChIA,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,gMAAkM;AAC/N;AACA,IAAO,uBAAQ,EAAC,YAAW,8BAA6B;;;AFDxD,SAAS,OAAO,YAAY;AAC5B,IAAM;AAAA,EACJ;AAAA,EACA;AACF,IAAI;AA4CJ,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GAAG;AACD,SAAoB,qBAAK,UAAU;AAAA,IACjC,OAAO;AAAA,IACP,UAAuB,qBAAK,OAAO;AAAA;AAAA,MAEjC,OAAO,aAAa,SAAS;AAAA,MAC7B,WAAW,aAAa,KAAK,qBAAO,UAAU,WAAW,qBAAqB,IAAI;AAAA,MAClF,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AACA,SAAS,UAAU;AACnB,SAAS,WAAW;AACpB,IAAO,mBAAQ;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport Context from './context';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst {\n Consumer,\n Provider\n} = Context;\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and\n * prevents pointer interaction.\n *\n * _Note: this component may not behave as expected in browsers that don't\n * support the `inert` HTML attribute. We recommend adding the official WICG\n * polyfill when using this component in your project._\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n *\tlet input = (\n *\t\t<TextControl\n *\t\t\tlabel=\"Input\"\n *\t\t\tonChange={ () => {} }\n *\t\t/>\n *\t);\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled({\n className,\n children,\n isDisabled = true,\n ...props\n}) {\n return /*#__PURE__*/_jsx(Provider, {\n value: isDisabled,\n children: /*#__PURE__*/_jsx(\"div\", {\n // @ts-expect-error `inert` is not declared in React 18's HTML attribute types.\n inert: isDisabled ? 'true' : undefined\n // Only the disabled styling is conditional. The consumer's own\n // className has to stick around so the wrapper stays targetable\n // whether or not it is currently disabled.\n ,\n className: clsx(className, isDisabled && [styles.disabled, 'components-disabled']) || undefined,\n ...props,\n children: children\n })\n });\n}\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\nexport default Disabled;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"bacc423d2b\", \"._556ae8be2a7ddc8e__disabled{pointer-events:none;position:relative}._556ae8be2a7ddc8e__disabled:after{content:\\\"\\\";inset:0;position:absolute}._556ae8be2a7ddc8e__disabled *{pointer-events:none}\");\n}\nexport default {\"disabled\":\"_556ae8be2a7ddc8e__disabled\"};\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,OAAO,aAAa;;;ACDpB,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAA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AAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,gMAAkM;AAC/N;AACA,IAAO,uBAAQ,EAAC,YAAW,8BAA6B;;;AFDxD,SAAS,OAAO,YAAY;AAC5B,IAAM;AAAA,EACJ;AAAA,EACA;AACF,IAAI;AA4CJ,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GAAG;AACD,SAAoB,qBAAK,UAAU;AAAA,IACjC,OAAO;AAAA,IACP,UAAuB,qBAAK,OAAO;AAAA;AAAA,MAEjC,OAAO,aAAa,SAAS;AAAA,MAK7B,WAAW,KAAK,WAAW,cAAc,CAAC,qBAAO,UAAU,qBAAqB,CAAC,KAAK;AAAA,MACtF,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AACA,SAAS,UAAU;AACnB,SAAS,WAAW;AACpB,IAAO,mBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/draggable/index.tsx", "../../../style-runtime/src/index.ts", "../../src/draggable/style.module.scss"],
4
- "sourcesContent": ["import { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { getWpCompatOverlaySlot } from '@wordpress/ui';\nimport styles from './style.module.scss';\n\n// Legacy class names preserved alongside the CSS-module hashed ones for\n// backwards compatibility. `filter(Boolean)` strips `undefined` from Jest's\n// CSS-module mock.\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst dragImageClasses = [styles['invisible-drag-image'], 'components-draggable__invisible-drag-image'].filter(Boolean);\nconst cloneWrapperClasses = [styles.clone, 'components-draggable__clone'].filter(Boolean);\n// Global class — shared with external code (e.g. block-editor keyboard drag).\nconst bodyClass = 'is-dragging-components-draggable';\nconst clonePadding = 0;\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable({\n children,\n onDragStart,\n onDragOver,\n onDragEnd,\n appendToOwnerDocument = false,\n cloneClassname,\n elementId,\n transferData,\n __experimentalTransferDataType: transferDataType = 'text',\n __experimentalDragComponent: dragComponent\n}) {\n const dragComponentRef = useRef(null);\n const cleanupRef = useRef(() => {});\n\n /**\n * Removes the element clone, resets cursor, and removes drag listener.\n *\n * @param event The non-custom DragEvent.\n */\n function end(event) {\n event.preventDefault();\n cleanupRef.current();\n if (onDragEnd) {\n onDragEnd(event);\n }\n }\n\n /**\n * This method does a couple of things:\n *\n * - Clones the current element and spawns clone over original element.\n * - Adds a fake temporary drag image to avoid browser defaults.\n * - Sets transfer data.\n * - Adds dragover listener.\n *\n * @param event The non-custom DragEvent.\n */\n function start(event) {\n const {\n ownerDocument\n } = event.target;\n // Only use the slot when it lives in the same document as the\n // dragged element, so coordinate resolution stays in one space.\n const slot = getWpCompatOverlaySlot();\n const compatSlot = slot?.ownerDocument === ownerDocument ? slot : null;\n event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));\n const cloneWrapper = ownerDocument.createElement('div');\n // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n cloneWrapper.style.top = '0';\n cloneWrapper.style.left = '0';\n const dragImage = ownerDocument.createElement('div');\n\n // Set a fake drag image to avoid browser defaults. Remove from DOM\n // right after. event.dataTransfer.setDragImage is not supported yet in\n // IE, we need to check for its existence first.\n if ('function' === typeof event.dataTransfer.setDragImage) {\n dragImage.classList.add(...dragImageClasses);\n // Invisible — stays at the document body, no slot needed.\n ownerDocument.body.appendChild(dragImage);\n event.dataTransfer.setDragImage(dragImage, 0, 0);\n }\n cloneWrapper.classList.add(...cloneWrapperClasses);\n const inSlotClass = styles['is-in-compat-slot'];\n if (compatSlot && inSlotClass) {\n cloneWrapper.classList.add(inSlotClass);\n }\n if (cloneClassname) {\n cloneWrapper.classList.add(cloneClassname);\n }\n let x = 0;\n let y = 0;\n // If a dragComponent is defined, the following logic will clone the\n // HTML node and inject it into the cloneWrapper.\n if (dragComponentRef.current) {\n // Position dragComponent at the same position as the cursor.\n x = event.clientX;\n y = event.clientY;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n const clonedDragComponent = ownerDocument.createElement('div');\n clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n cloneWrapper.appendChild(clonedDragComponent);\n (compatSlot ?? ownerDocument.body).appendChild(cloneWrapper);\n } else {\n const element = ownerDocument.getElementById(elementId);\n\n // Prepare element clone and append to element wrapper.\n const elementRect = element.getBoundingClientRect();\n const elementWrapper = element.parentNode;\n const elementTopOffset = elementRect.top;\n const elementLeftOffset = elementRect.left;\n cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;\n const clone = element.cloneNode(true);\n clone.id = `clone-${elementId}`;\n\n // Position clone right over the original element (20px padding).\n x = elementLeftOffset - clonePadding;\n y = elementTopOffset - clonePadding;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n\n // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode?.removeChild(child));\n cloneWrapper.appendChild(clone);\n if (compatSlot) {\n compatSlot.appendChild(cloneWrapper);\n } else if (appendToOwnerDocument) {\n ownerDocument.body.appendChild(cloneWrapper);\n } else {\n elementWrapper?.appendChild(cloneWrapper);\n }\n }\n\n // Mark the current cursor coordinates.\n let cursorLeft = event.clientX;\n let cursorTop = event.clientY;\n function over(e) {\n // Skip doing any work if mouse has not moved.\n if (cursorLeft === e.clientX && cursorTop === e.clientY) {\n return;\n }\n const nextX = x + e.clientX - cursorLeft;\n const nextY = y + e.clientY - cursorTop;\n cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;\n cursorLeft = e.clientX;\n cursorTop = e.clientY;\n x = nextX;\n y = nextY;\n if (onDragOver) {\n onDragOver(e);\n }\n }\n\n // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n // note that browsers may throttle raf below 60fps in certain conditions.\n // @ts-expect-error `throttle` expects a `(...args: unknown[]) => unknown` callback.\n const throttledDragOver = throttle(over, 16);\n ownerDocument.addEventListener('dragover', throttledDragOver);\n\n // Update cursor to 'grabbing', document wide.\n ownerDocument.body.classList.add(bodyClass);\n if (onDragStart) {\n onDragStart(event);\n }\n cleanupRef.current = () => {\n // Remove drag clone.\n if (cloneWrapper && cloneWrapper.parentNode) {\n cloneWrapper.parentNode.removeChild(cloneWrapper);\n }\n if (dragImage && dragImage.parentNode) {\n dragImage.parentNode.removeChild(dragImage);\n }\n\n // Reset cursor.\n ownerDocument.body.classList.remove(bodyClass);\n ownerDocument.removeEventListener('dragover', throttledDragOver);\n };\n }\n useEffect(() => () => {\n cleanupRef.current();\n }, []);\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [children({\n onDraggableStart: start,\n onDraggableEnd: end\n }), dragComponent && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-draggable-drag-component-root\",\n style: {\n display: 'none'\n },\n ref: dragComponentRef,\n children: dragComponent\n })]\n });\n}\nexport default Draggable;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"e7e88c1781\", \"._3476c2e530687f96__invisible-drag-image{height:50px;left:-1000px;position:fixed;width:50px}._6f00e51ab7574306__clone{background:transparent;padding:0;pointer-events:none;position:fixed}._6f00e51ab7574306__clone:not(._664ecd37377558df__is-in-compat-slot){z-index:1000000000}body.is-dragging-components-draggable{cursor:move;cursor:grabbing!important}\");\n}\nexport default {\"invisible-drag-image\":\"_3476c2e530687f96__invisible-drag-image\",\"clone\":\"_6f00e51ab7574306__clone\",\"is-in-compat-slot\":\"_664ecd37377558df__is-in-compat-slot\"};\n"],
4
+ "sourcesContent": ["import { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { getWpCompatOverlaySlot } from '@wordpress/ui';\nimport styles from './style.module.scss';\n\n// Legacy class names preserved alongside the CSS-module hashed ones for\n// backwards compatibility. `filter(Boolean)` strips `undefined` from the\n// CSS-module mock.\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst dragImageClasses = [styles['invisible-drag-image'], 'components-draggable__invisible-drag-image'].filter(Boolean);\nconst cloneWrapperClasses = [styles.clone, 'components-draggable__clone'].filter(Boolean);\n// Global class — shared with external code (e.g. block-editor keyboard drag).\nconst bodyClass = 'is-dragging-components-draggable';\nconst clonePadding = 0;\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable({\n children,\n onDragStart,\n onDragOver,\n onDragEnd,\n appendToOwnerDocument = false,\n cloneClassname,\n elementId,\n transferData,\n __experimentalTransferDataType: transferDataType = 'text',\n __experimentalDragComponent: dragComponent\n}) {\n const dragComponentRef = useRef(null);\n const cleanupRef = useRef(() => {});\n\n /**\n * Removes the element clone, resets cursor, and removes drag listener.\n *\n * @param event The non-custom DragEvent.\n */\n function end(event) {\n event.preventDefault();\n cleanupRef.current();\n if (onDragEnd) {\n onDragEnd(event);\n }\n }\n\n /**\n * This method does a couple of things:\n *\n * - Clones the current element and spawns clone over original element.\n * - Adds a fake temporary drag image to avoid browser defaults.\n * - Sets transfer data.\n * - Adds dragover listener.\n *\n * @param event The non-custom DragEvent.\n */\n function start(event) {\n const {\n ownerDocument\n } = event.target;\n // Only use the slot when it lives in the same document as the\n // dragged element, so coordinate resolution stays in one space.\n const slot = getWpCompatOverlaySlot();\n const compatSlot = slot?.ownerDocument === ownerDocument ? slot : null;\n event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));\n const cloneWrapper = ownerDocument.createElement('div');\n // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n cloneWrapper.style.top = '0';\n cloneWrapper.style.left = '0';\n const dragImage = ownerDocument.createElement('div');\n\n // Set a fake drag image to avoid browser defaults. Remove from DOM\n // right after. event.dataTransfer.setDragImage is not supported yet in\n // IE, we need to check for its existence first.\n if ('function' === typeof event.dataTransfer.setDragImage) {\n dragImage.classList.add(...dragImageClasses);\n // Invisible — stays at the document body, no slot needed.\n ownerDocument.body.appendChild(dragImage);\n event.dataTransfer.setDragImage(dragImage, 0, 0);\n }\n cloneWrapper.classList.add(...cloneWrapperClasses);\n const inSlotClass = styles['is-in-compat-slot'];\n if (compatSlot && inSlotClass) {\n cloneWrapper.classList.add(inSlotClass);\n }\n if (cloneClassname) {\n cloneWrapper.classList.add(cloneClassname);\n }\n let x = 0;\n let y = 0;\n // If a dragComponent is defined, the following logic will clone the\n // HTML node and inject it into the cloneWrapper.\n if (dragComponentRef.current) {\n // Position dragComponent at the same position as the cursor.\n x = event.clientX;\n y = event.clientY;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n const clonedDragComponent = ownerDocument.createElement('div');\n clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n cloneWrapper.appendChild(clonedDragComponent);\n (compatSlot ?? ownerDocument.body).appendChild(cloneWrapper);\n } else {\n const element = ownerDocument.getElementById(elementId);\n\n // Prepare element clone and append to element wrapper.\n const elementRect = element.getBoundingClientRect();\n const elementWrapper = element.parentNode;\n const elementTopOffset = elementRect.top;\n const elementLeftOffset = elementRect.left;\n cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;\n const clone = element.cloneNode(true);\n clone.id = `clone-${elementId}`;\n\n // Position clone right over the original element (20px padding).\n x = elementLeftOffset - clonePadding;\n y = elementTopOffset - clonePadding;\n cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;\n\n // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode?.removeChild(child));\n cloneWrapper.appendChild(clone);\n if (compatSlot) {\n compatSlot.appendChild(cloneWrapper);\n } else if (appendToOwnerDocument) {\n ownerDocument.body.appendChild(cloneWrapper);\n } else {\n elementWrapper?.appendChild(cloneWrapper);\n }\n }\n\n // Mark the current cursor coordinates.\n let cursorLeft = event.clientX;\n let cursorTop = event.clientY;\n function over(e) {\n // Skip doing any work if mouse has not moved.\n if (cursorLeft === e.clientX && cursorTop === e.clientY) {\n return;\n }\n const nextX = x + e.clientX - cursorLeft;\n const nextY = y + e.clientY - cursorTop;\n cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;\n cursorLeft = e.clientX;\n cursorTop = e.clientY;\n x = nextX;\n y = nextY;\n if (onDragOver) {\n onDragOver(e);\n }\n }\n\n // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n // note that browsers may throttle raf below 60fps in certain conditions.\n // @ts-expect-error `throttle` expects a `(...args: unknown[]) => unknown` callback.\n const throttledDragOver = throttle(over, 16);\n ownerDocument.addEventListener('dragover', throttledDragOver);\n\n // Update cursor to 'grabbing', document wide.\n ownerDocument.body.classList.add(bodyClass);\n if (onDragStart) {\n onDragStart(event);\n }\n cleanupRef.current = () => {\n // Remove drag clone.\n if (cloneWrapper && cloneWrapper.parentNode) {\n cloneWrapper.parentNode.removeChild(cloneWrapper);\n }\n if (dragImage && dragImage.parentNode) {\n dragImage.parentNode.removeChild(dragImage);\n }\n\n // Reset cursor.\n ownerDocument.body.classList.remove(bodyClass);\n ownerDocument.removeEventListener('dragover', throttledDragOver);\n };\n }\n useEffect(() => () => {\n cleanupRef.current();\n }, []);\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [children({\n onDraggableStart: start,\n onDraggableEnd: end\n }), dragComponent && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-draggable-drag-component-root\",\n style: {\n display: 'none'\n },\n ref: dragComponentRef,\n children: dragComponent\n })]\n });\n}\nexport default Draggable;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"e7e88c1781\", \"._3476c2e530687f96__invisible-drag-image{height:50px;left:-1000px;position:fixed;width:50px}._6f00e51ab7574306__clone{background:transparent;padding:0;pointer-events:none;position:fixed}._6f00e51ab7574306__clone:not(._664ecd37377558df__is-in-compat-slot){z-index:1000000000}body.is-dragging-components-draggable{cursor:move;cursor:grabbing!important}\");\n}\nexport default {\"invisible-drag-image\":\"_3476c2e530687f96__invisible-drag-image\",\"clone\":\"_6f00e51ab7574306__clone\",\"is-in-compat-slot\":\"_664ecd37377558df__is-in-compat-slot\"};\n"],
5
5
  "mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,WAAW,cAAc;AAClC,SAAS,8BAA8B;;;ACFvC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SA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okenField(props) {
360
360
  }
361
361
  function handleUpArrowKey() {
362
362
  setSelectedSuggestionIndex((index) => {
363
- return (index === 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1;
363
+ return (index <= 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1;
364
364
  });
365
365
  setSelectedSuggestionScroll(true);
366
366
  return true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/form-token-field/index.tsx", "../../../style-runtime/src/index.ts", "../../src/form-token-field/style.module.scss"],
4
- "sourcesContent": ["import clsx from 'clsx';\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';\nimport { withIgnoreIMEEvents } from '@wordpress/keycodes';\nimport Token from './token';\nimport TokenInput from './token-input';\nimport SuggestionsList from './suggestions-list';\nimport { Flex, FlexItem } from '../flex';\nimport styles from './style.module.scss';\nimport { StyledHelp, StyledLabel } from '../base-control/styles/base-control-styles';\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 __experimentalAutoSelectFirstMatch = false,\n tokenizeOnBlur = false,\n help\n } = props;\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 preventDefaultOnFailedValidation: false\n });\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 const tokensToProcess = items.slice(0, -1);\n\n // Pre-check: would any segment be rejected by\n // `__experimentalValidateInput`? Empties and duplicates of the\n // current selection are intentional skips, not failures.\n const willFailValidation = segment => {\n const transformed = saveTransform(segment);\n return !!transformed && !valueContainsToken(transformed) && !__experimentalValidateInput(transformed);\n };\n const hasFailures = tokensToProcess.some(willFailValidation);\n\n // When there are failures, also commit the trailing in-progress\n // segment so the user is left with only the items that need\n // fixing, instead of mixing the trailing segment with the failed\n // ones (which would block tokenization on Enter or comma).\n const addedTokens = addNewTokens(hasFailures ? items : tokensToProcess);\n if (hasFailures) {\n // Derive rejected segments from `addedTokens` so this stays\n // in sync with `addNewTokens`'s filter chain.\n const rejected = items.filter(token => {\n const transformed = saveTransform(token);\n if (!transformed) {\n return false;\n }\n if (addedTokens.has(transformed)) {\n return false;\n }\n if (valueContainsToken(transformed)) {\n return false;\n }\n return !__experimentalValidateInput(transformed);\n });\n\n // Reuse the separator the user actually used (the last one\n // in `text`) so we don't rewrite their input: comma-separated\n // paste under `tokenizeOnSpace` stays comma-separated, and\n // typed space under `tokenizeOnSpace` stays a space. Falls\n // back to the mode-appropriate separator only when no\n // separator characters are present in `text`.\n const usedSeparators = text.match(/[ ,\\t]/g);\n const separatorChar = usedSeparators?.[usedSeparators.length - 1] ?? (tokenizeOnSpace ? ' ' : ',');\n // Preserve a trailing separator when the input ended with\n // one, so the user can keep typing past a failed-validation\n // space without their separator disappearing.\n const trailing = tokenValue === '' ? separatorChar : '';\n const remaining = rejected.join(separatorChar) + trailing;\n setIncompleteTokenValue(remaining);\n onInputChange(remaining);\n return;\n }\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\n // Comma is always a separator (typed in onKeyPress, never as input).\n // Pasted commas go through onInputChangeHandler, which validates.\n return true;\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 preventDefaultOnFailedValidation = true\n } = {}) {\n let preventDefault = false;\n const selectedSuggestion = getSelectedSuggestion();\n if (selectedSuggestion) {\n addNewToken(selectedSuggestion);\n preventDefault = true;\n } else if (inputHasValidValue()) {\n const passedValidation = addNewToken(incompleteTokenValue);\n preventDefault = passedValidation || preventDefaultOnFailedValidation;\n }\n return preventDefault;\n }\n function addNewTokens(tokens) {\n const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)).filter(token => __experimentalValidateInput(token)))];\n if (tokensToAdd.length > 0) {\n const newValue = [...value];\n newValue.splice(getIndexOfInput(), 0, ...tokensToAdd);\n onChange(newValue);\n }\n return new Set(tokensToAdd);\n }\n\n /**\n * Validates and adds `token`. Returns `true` if validation passed,\n * `false` if it was rejected by `__experimentalValidateInput`. A `true`\n * return does not guarantee the token was added: `addNewTokens` may\n * still drop it as a duplicate or after `saveTransform` returns empty.\n */\n function addNewToken(token) {\n if (!__experimentalValidateInput(token)) {\n speak(messages.__experimentalInvalid, 'assertive');\n return false;\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 return true;\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(Flex, {\n className: styles['tokens-and-input'],\n justify: \"flex-start\",\n align: \"center\",\n gap: 1,\n wrap: true,\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;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"f9ae5dc19e\", \".df878b202c3b3cb7__tokens-and-input{box-sizing:border-box;padding:7px}.df878b202c3b3cb7__tokens-and-input *,.df878b202c3b3cb7__tokens-and-input :after,.df878b202c3b3cb7__tokens-and-input :before{box-sizing:inherit}\");\n}\nexport default {\"tokens-and-input\":\"df878b202c3b3cb7__tokens-and-input\"};\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,aAAa,eAAe,mBAAmB;AACxD,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,OAAO,gBAAgB;AACvB,SAAS,2BAA2B;AACpC,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,SAAS,MAAM,gBAAgB;;;ACX/B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iB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A2B,qBAAK,iBAAiB;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,gBAA6B,qBAAK,YAAY;AAAA,MAChD,IAAI,+BAA+B,UAAU;AAAA,MAC7C,WAAW;AAAA,MACX,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AAEH;AACA,IAAO,2BAAQ;",
4
+ "sourcesContent": ["import clsx from 'clsx';\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';\nimport { withIgnoreIMEEvents } from '@wordpress/keycodes';\nimport Token from './token';\nimport TokenInput from './token-input';\nimport SuggestionsList from './suggestions-list';\nimport { Flex, FlexItem } from '../flex';\nimport styles from './style.module.scss';\nimport { StyledHelp, StyledLabel } from '../base-control/styles/base-control-styles';\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 __experimentalAutoSelectFirstMatch = false,\n tokenizeOnBlur = false,\n help\n } = props;\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 preventDefaultOnFailedValidation: false\n });\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 const tokensToProcess = items.slice(0, -1);\n\n // Pre-check: would any segment be rejected by\n // `__experimentalValidateInput`? Empties and duplicates of the\n // current selection are intentional skips, not failures.\n const willFailValidation = segment => {\n const transformed = saveTransform(segment);\n return !!transformed && !valueContainsToken(transformed) && !__experimentalValidateInput(transformed);\n };\n const hasFailures = tokensToProcess.some(willFailValidation);\n\n // When there are failures, also commit the trailing in-progress\n // segment so the user is left with only the items that need\n // fixing, instead of mixing the trailing segment with the failed\n // ones (which would block tokenization on Enter or comma).\n const addedTokens = addNewTokens(hasFailures ? items : tokensToProcess);\n if (hasFailures) {\n // Derive rejected segments from `addedTokens` so this stays\n // in sync with `addNewTokens`'s filter chain.\n const rejected = items.filter(token => {\n const transformed = saveTransform(token);\n if (!transformed) {\n return false;\n }\n if (addedTokens.has(transformed)) {\n return false;\n }\n if (valueContainsToken(transformed)) {\n return false;\n }\n return !__experimentalValidateInput(transformed);\n });\n\n // Reuse the separator the user actually used (the last one\n // in `text`) so we don't rewrite their input: comma-separated\n // paste under `tokenizeOnSpace` stays comma-separated, and\n // typed space under `tokenizeOnSpace` stays a space. Falls\n // back to the mode-appropriate separator only when no\n // separator characters are present in `text`.\n const usedSeparators = text.match(/[ ,\\t]/g);\n const separatorChar = usedSeparators?.[usedSeparators.length - 1] ?? (tokenizeOnSpace ? ' ' : ',');\n // Preserve a trailing separator when the input ended with\n // one, so the user can keep typing past a failed-validation\n // space without their separator disappearing.\n const trailing = tokenValue === '' ? separatorChar : '';\n const remaining = rejected.join(separatorChar) + trailing;\n setIncompleteTokenValue(remaining);\n onInputChange(remaining);\n return;\n }\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\n // Comma is always a separator (typed in onKeyPress, never as input).\n // Pasted commas go through onInputChangeHandler, which validates.\n return true;\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 preventDefaultOnFailedValidation = true\n } = {}) {\n let preventDefault = false;\n const selectedSuggestion = getSelectedSuggestion();\n if (selectedSuggestion) {\n addNewToken(selectedSuggestion);\n preventDefault = true;\n } else if (inputHasValidValue()) {\n const passedValidation = addNewToken(incompleteTokenValue);\n preventDefault = passedValidation || preventDefaultOnFailedValidation;\n }\n return preventDefault;\n }\n function addNewTokens(tokens) {\n const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)).filter(token => __experimentalValidateInput(token)))];\n if (tokensToAdd.length > 0) {\n const newValue = [...value];\n newValue.splice(getIndexOfInput(), 0, ...tokensToAdd);\n onChange(newValue);\n }\n return new Set(tokensToAdd);\n }\n\n /**\n * Validates and adds `token`. Returns `true` if validation passed,\n * `false` if it was rejected by `__experimentalValidateInput`. A `true`\n * return does not guarantee the token was added: `addNewTokens` may\n * still drop it as a duplicate or after `saveTransform` returns empty.\n */\n function addNewToken(token) {\n if (!__experimentalValidateInput(token)) {\n speak(messages.__experimentalInvalid, 'assertive');\n return false;\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 return true;\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(Flex, {\n className: styles['tokens-and-input'],\n justify: \"flex-start\",\n align: \"center\",\n gap: 1,\n wrap: true,\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;", "const STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n const globalScope = globalThis;\n if (globalScope.__wpStyleRuntime) {\n return globalScope.__wpStyleRuntime;\n }\n globalScope.__wpStyleRuntime = {\n documents: new Map(),\n styles: new Map(),\n injectedStyles: new WeakMap()\n };\n if (typeof document !== 'undefined') {\n registerDocument(document);\n }\n return globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(targetDocument, hash) {\n if (!targetDocument.head) {\n return false;\n }\n for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) {\n if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle(targetDocument, hash, css) {\n if (!targetDocument.head) {\n return;\n }\n const runtime = getRuntime();\n let injectedStyles = runtime.injectedStyles.get(targetDocument);\n if (!injectedStyles) {\n injectedStyles = new Set();\n runtime.injectedStyles.set(targetDocument, injectedStyles);\n }\n if (injectedStyles.has(hash)) {\n return;\n }\n\n // Older generated CSS module output can still inject matching style tags\n // after this document's cache is created, so keep the DOM as the fallback\n // source of truth on cache misses.\n if (documentContainsStyleHash(targetDocument, hash)) {\n injectedStyles.add(hash);\n return;\n }\n const style = targetDocument.createElement('style');\n style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);\n style.appendChild(targetDocument.createTextNode(css));\n targetDocument.head.appendChild(style);\n injectedStyles.add(hash);\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument(targetDocument) {\n const runtime = getRuntime();\n runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);\n for (const [hash, css] of runtime.styles) {\n injectStyle(targetDocument, hash, css);\n }\n return () => {\n const count = runtime.documents.get(targetDocument);\n if (count === undefined) {\n return;\n }\n if (count <= 1) {\n runtime.documents.delete(targetDocument);\n return;\n }\n runtime.documents.set(targetDocument, count - 1);\n };\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle(hash, css) {\n const runtime = getRuntime();\n runtime.styles.set(hash, css);\n for (const targetDocument of runtime.documents.keys()) {\n injectStyle(targetDocument, hash, css);\n }\n}", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"f9ae5dc19e\", \".df878b202c3b3cb7__tokens-and-input{box-sizing:border-box;padding:7px}.df878b202c3b3cb7__tokens-and-input *,.df878b202c3b3cb7__tokens-and-input :after,.df878b202c3b3cb7__tokens-and-input :before{box-sizing:inherit}\");\n}\nexport default {\"tokens-and-input\":\"df878b202c3b3cb7__tokens-and-input\"};\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,aAAa,eAAe,mBAAmB;AACxD,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,OAAO,gBAAgB;AACvB,SAAS,2BAA2B;AACpC,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,SAAS,MAAM,gBAAgB;;;ACX/B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACpB,QAAM,cAAc;AACpB,MAAI,YAAY,kBAAkB;AAChC,WAAO,YAAY;AAAA,EACrB;AACA,cAAY,mBAAmB;AAAA,IAC7B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC9B;AACA,MAAI,OAAO,aAAa,aAAa;AACnC,qBAAiB,QAAQ;AAAA,EAC3B;AACA,SAAO,YAAY;AACrB;AAUA,SAAS,0BAA0B,gBAAgB,MAAM;AACvD,MAAI,CAAC,eAAe,MAAM;AACxB,WAAO;AAAA,EACT;AACA,aAAW,SAAS,eAAe,KAAK,iBAAiB,SAAS,oBAAoB,GAAG,GAAG;AAC1F,QAAI,MAAM,aAAa,oBAAoB,MAAM,MAAM;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAUA,SAAS,YAAY,gBAAgB,MAAM,KAAK;AAC9C,MAAI,CAAC,eAAe,MAAM;AACxB;AAAA,EACF;AACA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAA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,qBAAK,iBAAiB;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,gBAA6B,qBAAK,YAAY;AAAA,MAChD,IAAI,+BAA+B,UAAU;AAAA,MAC7C,WAAW;AAAA,MACX,UAAU;AAAA,IACZ,CAAC,CAAC;AAAA,EACJ,CAAC;AAEH;AACA,IAAO,2BAAQ;",
6
6
  "names": ["matchingSuggestions"]
7
7
  }
@@ -26,23 +26,41 @@ function Icon({
26
26
  ...additionalProps
27
27
  });
28
28
  }
29
- if (icon && (icon.type === "svg" || icon.type === SVG)) {
30
- const appliedProps = {
31
- ...icon.props,
32
- width: size,
33
- height: size,
34
- ...additionalProps
35
- };
36
- return /* @__PURE__ */ _jsx(SVG, {
37
- ...appliedProps
38
- });
39
- }
40
29
  if (isValidElement(icon)) {
30
+ const {
31
+ style: consumerStyle,
32
+ ...restProps
33
+ } = additionalProps;
34
+ const mergedStyle = icon.props.style || consumerStyle ? {
35
+ ...icon.props.style,
36
+ ...consumerStyle
37
+ } : void 0;
38
+ const styleProps = mergedStyle ? {
39
+ style: mergedStyle
40
+ } : {};
41
+ if (icon.type === "svg" || icon.type === SVG) {
42
+ const appliedProps = {
43
+ ...icon.props,
44
+ width: size,
45
+ height: size,
46
+ ...restProps,
47
+ // Merge styles so the icon's intrinsic style (e.g. `fill: none` on
48
+ // stroke-based icons) is preserved unless the consumer overrides
49
+ // the same property explicitly.
50
+ ...styleProps
51
+ };
52
+ return /* @__PURE__ */ _jsx(SVG, {
53
+ ...appliedProps
54
+ });
55
+ }
41
56
  return cloneElement(icon, {
42
57
  size,
43
58
  width: size,
44
59
  height: size,
45
- ...additionalProps
60
+ ...restProps,
61
+ // Merge styles so the icon's intrinsic style is preserved unless
62
+ // the consumer overrides the same property explicitly.
63
+ ...styleProps
46
64
  });
47
65
  }
48
66
  return icon;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/icon/index.tsx"],
4
- "sourcesContent": ["import { cloneElement, createElement, isValidElement } from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\nimport Dashicon from '../dashicon';\n\n/* The sizing props forwarded to an icon element that is not an `SVG` or a `Dashicon`. */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Renders a raw icon without any initial styling or wrappers.\n *\n * ```jsx\n * import { wordpress } from '@wordpress/icons';\n *\n * <Icon icon={ wordpress } />\n * ```\n */\nfunction Icon({\n icon = null,\n size = 'string' === typeof icon ? 20 : 24,\n ...additionalProps\n}) {\n if ('string' === typeof icon) {\n return /*#__PURE__*/_jsx(Dashicon, {\n icon: icon,\n size: size,\n ...additionalProps\n });\n }\n if (isValidElement(icon) && Dashicon === icon.type) {\n return cloneElement(icon, {\n ...additionalProps\n });\n }\n if ('function' === typeof icon) {\n return createElement(icon, {\n size,\n ...additionalProps\n });\n }\n if (icon && (icon.type === 'svg' || icon.type === SVG)) {\n const appliedProps = {\n ...icon.props,\n width: size,\n height: size,\n ...additionalProps\n };\n return /*#__PURE__*/_jsx(SVG, {\n ...appliedProps\n });\n }\n if (isValidElement(icon)) {\n return cloneElement(icon, {\n size,\n width: size,\n height: size,\n ...additionalProps\n });\n }\n return icon;\n}\nexport default Icon;"],
5
- "mappings": ";AAAA,SAAS,cAAc,eAAe,sBAAsB;AAC5D,SAAS,WAAW;AACpB,OAAO,cAAc;AAGrB,SAAS,OAAO,YAAY;AAU5B,SAAS,KAAK;AAAA,EACZ,OAAO;AAAA,EACP,OAAO,aAAa,OAAO,OAAO,KAAK;AAAA,EACvC,GAAG;AACL,GAAG;AACD,MAAI,aAAa,OAAO,MAAM;AAC5B,WAAoB,qBAAK,UAAU;AAAA,MACjC;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,eAAe,IAAI,KAAK,aAAa,KAAK,MAAM;AAClD,WAAO,aAAa,MAAM;AAAA,MACxB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,eAAe,OAAO,MAAM;AAC9B,WAAO,cAAc,MAAM;AAAA,MACzB;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,SAAS,KAAK,SAAS,SAAS,KAAK,SAAS,MAAM;AACtD,UAAM,eAAe;AAAA,MACnB,GAAG,KAAK;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IACL;AACA,WAAoB,qBAAK,KAAK;AAAA,MAC5B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,eAAe,IAAI,GAAG;AACxB,WAAO,aAAa,MAAM;AAAA,MACxB;AAAA,MACA,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,SAAO;AACT;AACA,IAAO,eAAQ;",
4
+ "sourcesContent": ["import { cloneElement, createElement, isValidElement } from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\nimport Dashicon from '../dashicon';\n\n/* The sizing props forwarded to an icon element that is not an `SVG` or a `Dashicon`. */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Renders a raw icon without any initial styling or wrappers.\n *\n * ```jsx\n * import { wordpress } from '@wordpress/icons';\n *\n * <Icon icon={ wordpress } />\n * ```\n */\nfunction Icon({\n icon = null,\n size = 'string' === typeof icon ? 20 : 24,\n ...additionalProps\n}) {\n if ('string' === typeof icon) {\n return /*#__PURE__*/_jsx(Dashicon, {\n icon: icon,\n size: size,\n ...additionalProps\n });\n }\n if (isValidElement(icon) && Dashicon === icon.type) {\n return cloneElement(icon, {\n ...additionalProps\n });\n }\n if ('function' === typeof icon) {\n return createElement(icon, {\n size,\n ...additionalProps\n });\n }\n if (isValidElement(icon)) {\n const {\n style: consumerStyle,\n ...restProps\n } = additionalProps;\n const mergedStyle = icon.props.style || consumerStyle ? {\n ...icon.props.style,\n ...consumerStyle\n } : undefined;\n const styleProps = mergedStyle ? {\n style: mergedStyle\n } : {};\n if (icon.type === 'svg' || icon.type === SVG) {\n const appliedProps = {\n ...icon.props,\n width: size,\n height: size,\n ...restProps,\n // Merge styles so the icon's intrinsic style (e.g. `fill: none` on\n // stroke-based icons) is preserved unless the consumer overrides\n // the same property explicitly.\n ...styleProps\n };\n return /*#__PURE__*/_jsx(SVG, {\n ...appliedProps\n });\n }\n return cloneElement(icon, {\n size,\n width: size,\n height: size,\n ...restProps,\n // Merge styles so the icon's intrinsic style is preserved unless\n // the consumer overrides the same property explicitly.\n ...styleProps\n });\n }\n return icon;\n}\nexport default Icon;"],
5
+ "mappings": ";AAAA,SAAS,cAAc,eAAe,sBAAsB;AAC5D,SAAS,WAAW;AACpB,OAAO,cAAc;AAGrB,SAAS,OAAO,YAAY;AAU5B,SAAS,KAAK;AAAA,EACZ,OAAO;AAAA,EACP,OAAO,aAAa,OAAO,OAAO,KAAK;AAAA,EACvC,GAAG;AACL,GAAG;AACD,MAAI,aAAa,OAAO,MAAM;AAC5B,WAAoB,qBAAK,UAAU;AAAA,MACjC;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,eAAe,IAAI,KAAK,aAAa,KAAK,MAAM;AAClD,WAAO,aAAa,MAAM;AAAA,MACxB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,eAAe,OAAO,MAAM;AAC9B,WAAO,cAAc,MAAM;AAAA,MACzB;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACA,MAAI,eAAe,IAAI,GAAG;AACxB,UAAM;AAAA,MACJ,OAAO;AAAA,MACP,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,cAAc,KAAK,MAAM,SAAS,gBAAgB;AAAA,MACtD,GAAG,KAAK,MAAM;AAAA,MACd,GAA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