@wordpress/components 28.10.0 → 28.12.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 (680) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/build/autocomplete/autocompleter-ui.js +2 -6
  3. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  4. package/build/autocomplete/autocompleter-ui.native.js +2 -4
  5. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  6. package/build/autocomplete/index.js +4 -5
  7. package/build/autocomplete/index.js.map +1 -1
  8. package/build/base-control/types.js.map +1 -1
  9. package/build/border-box-control/border-box-control/component.js +1 -0
  10. package/build/border-box-control/border-box-control/component.js.map +1 -1
  11. package/build/border-box-control/border-box-control/hook.js +6 -0
  12. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  13. package/build/border-control/border-control/component.js +1 -0
  14. package/build/border-control/border-control/component.js.map +1 -1
  15. package/build/border-control/border-control/hook.js +6 -0
  16. package/build/border-control/border-control/hook.js.map +1 -1
  17. package/build/border-control/border-control-dropdown/component.js +13 -13
  18. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  19. package/build/color-palette/index.js +1 -1
  20. package/build/color-palette/index.js.map +1 -1
  21. package/build/color-palette/index.native.js +1 -2
  22. package/build/color-palette/index.native.js.map +1 -1
  23. package/build/color-picker/index.native.js +0 -1
  24. package/build/color-picker/index.native.js.map +1 -1
  25. package/build/composite/legacy/index.js +5 -2
  26. package/build/composite/legacy/index.js.map +1 -1
  27. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -1
  28. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  29. package/build/date-time/date/index.js +0 -1
  30. package/build/date-time/date/index.js.map +1 -1
  31. package/build/font-size-picker/index.native.js +6 -6
  32. package/build/font-size-picker/index.native.js.map +1 -1
  33. package/build/form-file-upload/index.js +5 -1
  34. package/build/form-file-upload/index.js.map +1 -1
  35. package/build/form-token-field/index.js +0 -3
  36. package/build/form-token-field/index.js.map +1 -1
  37. package/build/form-token-field/suggestions-list.js +7 -3
  38. package/build/form-token-field/suggestions-list.js.map +1 -1
  39. package/build/form-token-field/token.js +1 -0
  40. package/build/form-token-field/token.js.map +1 -1
  41. package/build/guide/page-control.js +1 -0
  42. package/build/guide/page-control.js.map +1 -1
  43. package/build/{dropdown-menu-v2 → menu}/checkbox-item.js +8 -8
  44. package/build/menu/checkbox-item.js.map +1 -0
  45. package/build/{dropdown-menu-v2 → menu}/context.js +2 -2
  46. package/build/menu/context.js.map +1 -0
  47. package/build/{dropdown-menu-v2 → menu}/group-label.js +5 -5
  48. package/build/menu/group-label.js.map +1 -0
  49. package/build/{dropdown-menu-v2 → menu}/group.js +5 -5
  50. package/build/menu/group.js.map +1 -0
  51. package/build/{dropdown-menu-v2 → menu}/index.js +38 -38
  52. package/build/menu/index.js.map +1 -0
  53. package/build/{dropdown-menu-v2 → menu}/item-help-text.js +3 -3
  54. package/build/menu/item-help-text.js.map +1 -0
  55. package/build/{dropdown-menu-v2 → menu}/item-label.js +3 -3
  56. package/build/menu/item-label.js.map +1 -0
  57. package/build/{dropdown-menu-v2 → menu}/item.js +7 -7
  58. package/build/menu/item.js.map +1 -0
  59. package/build/{dropdown-menu-v2 → menu}/radio-item.js +8 -8
  60. package/build/menu/radio-item.js.map +1 -0
  61. package/build/{dropdown-menu-v2 → menu}/separator.js +6 -6
  62. package/build/menu/separator.js.map +1 -0
  63. package/build/menu/styles.js +150 -0
  64. package/build/menu/styles.js.map +1 -0
  65. package/build/menu/types.js.map +1 -0
  66. package/build/menu/use-temporary-focus-visible-fix.js.map +1 -0
  67. package/build/menu-item/index.js +1 -0
  68. package/build/menu-item/index.js.map +1 -1
  69. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
  70. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  71. package/build/mobile/bottom-sheet/range-cell.native.js +1 -1
  72. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  73. package/build/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  74. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  75. package/build/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  76. package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  77. package/build/mobile/bottom-sheet-select-control/index.native.js +2 -2
  78. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  79. package/build/mobile/color-settings/index.native.js +1 -3
  80. package/build/mobile/color-settings/index.native.js.map +1 -1
  81. package/build/mobile/color-settings/picker-screen.native.js +1 -3
  82. package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
  83. package/build/mobile/image/index.native.js +1 -3
  84. package/build/mobile/image/index.native.js.map +1 -1
  85. package/build/mobile/keyboard-avoiding-view/index.ios.js +1 -3
  86. package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  87. package/build/mobile/link-picker/link-picker-results.native.js +2 -5
  88. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  89. package/build/mobile/link-picker/link-picker-screen.native.js +1 -3
  90. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  91. package/build/mobile/link-settings/index.native.js +6 -18
  92. package/build/mobile/link-settings/index.native.js.map +1 -1
  93. package/build/mobile/link-settings/link-settings-screen.native.js +1 -3
  94. package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  95. package/build/mobile/segmented-control/index.native.js +2 -6
  96. package/build/mobile/segmented-control/index.native.js.map +1 -1
  97. package/build/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
  98. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  99. package/build/navigation/index.js +1 -2
  100. package/build/navigation/index.js.map +1 -1
  101. package/build/navigation/item/use-navigation-tree-item.js +2 -2
  102. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  103. package/build/navigation/menu/menu-title-search.js +2 -2
  104. package/build/navigation/menu/menu-title-search.js.map +1 -1
  105. package/build/navigation/menu/use-navigation-tree-menu.js +2 -2
  106. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  107. package/build/notice/index.js +2 -0
  108. package/build/notice/index.js.map +1 -1
  109. package/build/palette-edit/index.js +9 -2
  110. package/build/palette-edit/index.js.map +1 -1
  111. package/build/palette-edit/styles.js +13 -28
  112. package/build/palette-edit/styles.js.map +1 -1
  113. package/build/panel/body.js +1 -0
  114. package/build/panel/body.js.map +1 -1
  115. package/build/popover/index.js +4 -1
  116. package/build/popover/index.js.map +1 -1
  117. package/build/private-apis.js +4 -4
  118. package/build/private-apis.js.map +1 -1
  119. package/build/radio-group/index.js +3 -1
  120. package/build/radio-group/index.js.map +1 -1
  121. package/build/radio-group/radio.js +6 -0
  122. package/build/radio-group/radio.js.map +1 -1
  123. package/build/radio-group/types.js.map +1 -1
  124. package/build/sandbox/index.js +3 -6
  125. package/build/sandbox/index.js.map +1 -1
  126. package/build/sandbox/index.native.js +1 -3
  127. package/build/sandbox/index.native.js.map +1 -1
  128. package/build/search-control/index.native.js +1 -3
  129. package/build/search-control/index.native.js.map +1 -1
  130. package/build/slot-fill/bubbles-virtually/slot.js +1 -2
  131. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  132. package/build/slot-fill/fill.js +3 -6
  133. package/build/slot-fill/fill.js.map +1 -1
  134. package/build/snackbar/index.js +2 -1
  135. package/build/snackbar/index.js.map +1 -1
  136. package/build/spacer/hook.js +5 -3
  137. package/build/spacer/hook.js.map +1 -1
  138. package/build/tab-panel/index.js +4 -1
  139. package/build/tab-panel/index.js.map +1 -1
  140. package/build/tabs/index.js +48 -113
  141. package/build/tabs/index.js.map +1 -1
  142. package/build/tabs/styles.js +12 -12
  143. package/build/tabs/styles.js.map +1 -1
  144. package/build/tabs/tab.js +23 -6
  145. package/build/tabs/tab.js.map +1 -1
  146. package/build/tabs/tablist.js +37 -14
  147. package/build/tabs/tablist.js.map +1 -1
  148. package/build/tabs/types.js.map +1 -1
  149. package/build/toggle-group-control/toggle-group-control/component.js +3 -2
  150. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  151. package/build/toolbar/toolbar/index.js +3 -0
  152. package/build/toolbar/toolbar/index.js.map +1 -1
  153. package/build/tools-panel/tools-panel-header/component.js +1 -1
  154. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  155. package/build/tools-panel/tools-panel-item/hook.js +0 -2
  156. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  157. package/build/tooltip/index.native.js +5 -15
  158. package/build/tooltip/index.native.js.map +1 -1
  159. package/build/unit-control/index.native.js +2 -6
  160. package/build/unit-control/index.native.js.map +1 -1
  161. package/build/utils/deprecated-36px-size.js +27 -0
  162. package/build/utils/deprecated-36px-size.js.map +1 -0
  163. package/build/utils/element-rect.js +13 -2
  164. package/build/utils/element-rect.js.map +1 -1
  165. package/build/utils/hooks/use-animated-offset-rect.js +3 -2
  166. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  167. package/build/utils/hooks/use-update-effect.js +0 -2
  168. package/build/utils/hooks/use-update-effect.js.map +1 -1
  169. package/build-module/autocomplete/autocompleter-ui.js +2 -6
  170. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  171. package/build-module/autocomplete/autocompleter-ui.native.js +2 -4
  172. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  173. package/build-module/autocomplete/index.js +4 -5
  174. package/build-module/autocomplete/index.js.map +1 -1
  175. package/build-module/base-control/types.js.map +1 -1
  176. package/build-module/border-box-control/border-box-control/component.js +1 -0
  177. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  178. package/build-module/border-box-control/border-box-control/hook.js +6 -0
  179. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  180. package/build-module/border-control/border-control/component.js +1 -0
  181. package/build-module/border-control/border-control/component.js.map +1 -1
  182. package/build-module/border-control/border-control/hook.js +7 -0
  183. package/build-module/border-control/border-control/hook.js.map +1 -1
  184. package/build-module/border-control/border-control-dropdown/component.js +13 -13
  185. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  186. package/build-module/color-palette/index.js +1 -1
  187. package/build-module/color-palette/index.js.map +1 -1
  188. package/build-module/color-palette/index.native.js +1 -2
  189. package/build-module/color-palette/index.native.js.map +1 -1
  190. package/build-module/color-picker/index.native.js +0 -1
  191. package/build-module/color-picker/index.native.js.map +1 -1
  192. package/build-module/composite/legacy/index.js +5 -2
  193. package/build-module/composite/legacy/index.js.map +1 -1
  194. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -1
  195. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  196. package/build-module/date-time/date/index.js +0 -1
  197. package/build-module/date-time/date/index.js.map +1 -1
  198. package/build-module/font-size-picker/index.native.js +7 -7
  199. package/build-module/font-size-picker/index.native.js.map +1 -1
  200. package/build-module/form-file-upload/index.js +5 -1
  201. package/build-module/form-file-upload/index.js.map +1 -1
  202. package/build-module/form-token-field/index.js +0 -3
  203. package/build-module/form-token-field/index.js.map +1 -1
  204. package/build-module/form-token-field/suggestions-list.js +7 -3
  205. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  206. package/build-module/form-token-field/token.js +1 -0
  207. package/build-module/form-token-field/token.js.map +1 -1
  208. package/build-module/guide/page-control.js +1 -0
  209. package/build-module/guide/page-control.js.map +1 -1
  210. package/build-module/{dropdown-menu-v2 → menu}/checkbox-item.js +8 -8
  211. package/build-module/menu/checkbox-item.js.map +1 -0
  212. package/build-module/{dropdown-menu-v2 → menu}/context.js +1 -1
  213. package/build-module/menu/context.js.map +1 -0
  214. package/build-module/{dropdown-menu-v2 → menu}/group-label.js +5 -5
  215. package/build-module/menu/group-label.js.map +1 -0
  216. package/build-module/menu/group.js +21 -0
  217. package/build-module/menu/group.js.map +1 -0
  218. package/build-module/{dropdown-menu-v2 → menu}/index.js +46 -46
  219. package/build-module/menu/index.js.map +1 -0
  220. package/build-module/{dropdown-menu-v2 → menu}/item-help-text.js +2 -2
  221. package/build-module/menu/item-help-text.js.map +1 -0
  222. package/build-module/{dropdown-menu-v2 → menu}/item-label.js +2 -2
  223. package/build-module/menu/item-label.js.map +1 -0
  224. package/build-module/{dropdown-menu-v2 → menu}/item.js +7 -7
  225. package/build-module/menu/item.js.map +1 -0
  226. package/build-module/{dropdown-menu-v2 → menu}/radio-item.js +8 -8
  227. package/build-module/menu/radio-item.js.map +1 -0
  228. package/build-module/menu/separator.js +22 -0
  229. package/build-module/menu/separator.js.map +1 -0
  230. package/build-module/menu/styles.js +143 -0
  231. package/build-module/menu/styles.js.map +1 -0
  232. package/build-module/menu/types.js.map +1 -0
  233. package/build-module/menu/use-temporary-focus-visible-fix.js.map +1 -0
  234. package/build-module/menu-item/index.js +1 -0
  235. package/build-module/menu-item/index.js.map +1 -1
  236. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
  237. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  238. package/build-module/mobile/bottom-sheet/range-cell.native.js +1 -1
  239. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  240. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  241. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  242. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  243. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  244. package/build-module/mobile/bottom-sheet-select-control/index.native.js +2 -2
  245. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  246. package/build-module/mobile/color-settings/index.native.js +1 -3
  247. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  248. package/build-module/mobile/color-settings/picker-screen.native.js +1 -3
  249. package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
  250. package/build-module/mobile/image/index.native.js +1 -3
  251. package/build-module/mobile/image/index.native.js.map +1 -1
  252. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +1 -3
  253. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  254. package/build-module/mobile/link-picker/link-picker-results.native.js +2 -5
  255. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  256. package/build-module/mobile/link-picker/link-picker-screen.native.js +1 -3
  257. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  258. package/build-module/mobile/link-settings/index.native.js +6 -18
  259. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  260. package/build-module/mobile/link-settings/link-settings-screen.native.js +1 -3
  261. package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  262. package/build-module/mobile/segmented-control/index.native.js +2 -6
  263. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  264. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
  265. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  266. package/build-module/navigation/index.js +1 -2
  267. package/build-module/navigation/index.js.map +1 -1
  268. package/build-module/navigation/item/use-navigation-tree-item.js +2 -2
  269. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  270. package/build-module/navigation/menu/menu-title-search.js +2 -2
  271. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  272. package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -2
  273. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  274. package/build-module/notice/index.js +2 -0
  275. package/build-module/notice/index.js.map +1 -1
  276. package/build-module/palette-edit/index.js +11 -4
  277. package/build-module/palette-edit/index.js.map +1 -1
  278. package/build-module/palette-edit/styles.js +13 -29
  279. package/build-module/palette-edit/styles.js.map +1 -1
  280. package/build-module/panel/body.js +1 -0
  281. package/build-module/panel/body.js.map +1 -1
  282. package/build-module/popover/index.js +4 -1
  283. package/build-module/popover/index.js.map +1 -1
  284. package/build-module/private-apis.js +3 -3
  285. package/build-module/private-apis.js.map +1 -1
  286. package/build-module/radio-group/index.js +3 -1
  287. package/build-module/radio-group/index.js.map +1 -1
  288. package/build-module/radio-group/radio.js +6 -0
  289. package/build-module/radio-group/radio.js.map +1 -1
  290. package/build-module/radio-group/types.js.map +1 -1
  291. package/build-module/sandbox/index.js +3 -6
  292. package/build-module/sandbox/index.js.map +1 -1
  293. package/build-module/sandbox/index.native.js +1 -3
  294. package/build-module/sandbox/index.native.js.map +1 -1
  295. package/build-module/search-control/index.native.js +1 -3
  296. package/build-module/search-control/index.native.js.map +1 -1
  297. package/build-module/slot-fill/bubbles-virtually/slot.js +1 -2
  298. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  299. package/build-module/slot-fill/fill.js +3 -6
  300. package/build-module/slot-fill/fill.js.map +1 -1
  301. package/build-module/snackbar/index.js +2 -1
  302. package/build-module/snackbar/index.js.map +1 -1
  303. package/build-module/spacer/hook.js +5 -3
  304. package/build-module/spacer/hook.js.map +1 -1
  305. package/build-module/tab-panel/index.js +4 -1
  306. package/build-module/tab-panel/index.js.map +1 -1
  307. package/build-module/tabs/index.js +47 -112
  308. package/build-module/tabs/index.js.map +1 -1
  309. package/build-module/tabs/styles.js +11 -11
  310. package/build-module/tabs/styles.js.map +1 -1
  311. package/build-module/tabs/tab.js +21 -6
  312. package/build-module/tabs/tab.js.map +1 -1
  313. package/build-module/tabs/tablist.js +37 -14
  314. package/build-module/tabs/tablist.js.map +1 -1
  315. package/build-module/tabs/types.js.map +1 -1
  316. package/build-module/toggle-group-control/toggle-group-control/component.js +3 -2
  317. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  318. package/build-module/toolbar/toolbar/index.js +3 -0
  319. package/build-module/toolbar/toolbar/index.js.map +1 -1
  320. package/build-module/tools-panel/tools-panel-header/component.js +1 -1
  321. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  322. package/build-module/tools-panel/tools-panel-item/hook.js +0 -2
  323. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  324. package/build-module/tooltip/index.native.js +5 -15
  325. package/build-module/tooltip/index.native.js.map +1 -1
  326. package/build-module/unit-control/index.native.js +2 -6
  327. package/build-module/unit-control/index.native.js.map +1 -1
  328. package/build-module/utils/deprecated-36px-size.js +19 -0
  329. package/build-module/utils/deprecated-36px-size.js.map +1 -0
  330. package/build-module/utils/element-rect.js +13 -2
  331. package/build-module/utils/element-rect.js.map +1 -1
  332. package/build-module/utils/hooks/use-animated-offset-rect.js +3 -2
  333. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  334. package/build-module/utils/hooks/use-update-effect.js +0 -2
  335. package/build-module/utils/hooks/use-update-effect.js.map +1 -1
  336. package/build-style/style-rtl.css +21 -35
  337. package/build-style/style.css +21 -35
  338. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  339. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  340. package/build-types/autocomplete/index.d.ts.map +1 -1
  341. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  342. package/build-types/base-control/types.d.ts +3 -0
  343. package/build-types/base-control/types.d.ts.map +1 -1
  344. package/build-types/border-box-control/border-box-control/component.d.ts +1 -0
  345. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  346. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  347. package/build-types/border-control/border-control/component.d.ts +1 -0
  348. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  349. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  350. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  351. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  352. package/build-types/button/stories/index.story.d.ts.map +1 -1
  353. package/build-types/card/stories/index.story.d.ts.map +1 -1
  354. package/build-types/composite/legacy/index.d.ts.map +1 -1
  355. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  356. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  357. package/build-types/date-time/date/index.d.ts.map +1 -1
  358. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  359. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  360. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  361. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  362. package/build-types/form-file-upload/index.d.ts.map +1 -1
  363. package/build-types/form-token-field/index.d.ts.map +1 -1
  364. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  365. package/build-types/form-token-field/token.d.ts.map +1 -1
  366. package/build-types/guide/page-control.d.ts.map +1 -1
  367. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  368. package/build-types/item-group/stories/index.story.d.ts +1 -1
  369. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  370. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  371. package/build-types/lock-unlock.d.ts +2 -2
  372. package/build-types/menu/checkbox-item.d.ts +3 -0
  373. package/build-types/menu/checkbox-item.d.ts.map +1 -0
  374. package/build-types/menu/context.d.ts +6 -0
  375. package/build-types/menu/context.d.ts.map +1 -0
  376. package/build-types/menu/group-label.d.ts +3 -0
  377. package/build-types/menu/group-label.d.ts.map +1 -0
  378. package/build-types/menu/group.d.ts +3 -0
  379. package/build-types/menu/group.d.ts.map +1 -0
  380. package/build-types/menu/index.d.ts +40 -0
  381. package/build-types/menu/index.d.ts.map +1 -0
  382. package/build-types/{dropdown-menu-v2 → menu}/item-help-text.d.ts +1 -1
  383. package/build-types/menu/item-help-text.d.ts.map +1 -0
  384. package/build-types/{dropdown-menu-v2 → menu}/item-label.d.ts +1 -1
  385. package/build-types/menu/item-label.d.ts.map +1 -0
  386. package/build-types/menu/item.d.ts +3 -0
  387. package/build-types/menu/item.d.ts.map +1 -0
  388. package/build-types/menu/radio-item.d.ts +3 -0
  389. package/build-types/menu/radio-item.d.ts.map +1 -0
  390. package/build-types/menu/separator.d.ts +3 -0
  391. package/build-types/menu/separator.d.ts.map +1 -0
  392. package/build-types/menu/stories/index.story.d.ts +16 -0
  393. package/build-types/menu/stories/index.story.d.ts.map +1 -0
  394. package/build-types/{dropdown-menu-v2 → menu}/styles.d.ts +13 -13
  395. package/build-types/menu/styles.d.ts.map +1 -0
  396. package/build-types/menu/test/index.d.ts.map +1 -0
  397. package/build-types/{dropdown-menu-v2 → menu}/types.d.ts +22 -21
  398. package/build-types/menu/types.d.ts.map +1 -0
  399. package/build-types/menu/use-temporary-focus-visible-fix.d.ts.map +1 -0
  400. package/build-types/menu-item/index.d.ts.map +1 -1
  401. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  402. package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
  403. package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
  404. package/build-types/navigation/index.d.ts.map +1 -1
  405. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  406. package/build-types/notice/index.d.ts.map +1 -1
  407. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  408. package/build-types/palette-edit/index.d.ts.map +1 -1
  409. package/build-types/palette-edit/styles.d.ts +0 -256
  410. package/build-types/palette-edit/styles.d.ts.map +1 -1
  411. package/build-types/panel/body.d.ts.map +1 -1
  412. package/build-types/panel/stories/index.story.d.ts.map +1 -1
  413. package/build-types/popover/index.d.ts.map +1 -1
  414. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  415. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  416. package/build-types/radio-group/index.d.ts.map +1 -1
  417. package/build-types/radio-group/radio.d.ts +4 -2
  418. package/build-types/radio-group/radio.d.ts.map +1 -1
  419. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  420. package/build-types/radio-group/types.d.ts +5 -1
  421. package/build-types/radio-group/types.d.ts.map +1 -1
  422. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  423. package/build-types/sandbox/index.d.ts.map +1 -1
  424. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  425. package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
  426. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  427. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  428. package/build-types/slot-fill/fill.d.ts.map +1 -1
  429. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  430. package/build-types/snackbar/index.d.ts.map +1 -1
  431. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  432. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  433. package/build-types/spacer/hook.d.ts.map +1 -1
  434. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  435. package/build-types/tab-panel/index.d.ts.map +1 -1
  436. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  437. package/build-types/tabs/index.d.ts +21 -8
  438. package/build-types/tabs/index.d.ts.map +1 -1
  439. package/build-types/tabs/stories/index.story.d.ts +1 -1
  440. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  441. package/build-types/tabs/styles.d.ts +6 -3
  442. package/build-types/tabs/styles.d.ts.map +1 -1
  443. package/build-types/tabs/tab.d.ts +0 -3
  444. package/build-types/tabs/tab.d.ts.map +1 -1
  445. package/build-types/tabs/tablist.d.ts.map +1 -1
  446. package/build-types/tabs/types.d.ts +85 -48
  447. package/build-types/tabs/types.d.ts.map +1 -1
  448. package/build-types/text/stories/index.story.d.ts.map +1 -1
  449. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  450. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  451. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  452. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  453. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  454. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  455. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  456. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  457. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  458. package/build-types/utils/deprecated-36px-size.d.ts +6 -0
  459. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -0
  460. package/build-types/utils/element-rect.d.ts +1 -1
  461. package/build-types/utils/element-rect.d.ts.map +1 -1
  462. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +8 -1
  463. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
  464. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  465. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
  466. package/package.json +21 -20
  467. package/src/alignment-matrix-control/README.md +1 -2
  468. package/src/angle-picker-control/README.md +1 -2
  469. package/src/animate/stories/index.story.tsx +2 -1
  470. package/src/autocomplete/autocompleter-ui.native.js +2 -4
  471. package/src/autocomplete/autocompleter-ui.tsx +2 -6
  472. package/src/autocomplete/index.tsx +4 -5
  473. package/src/base-control/README.md +58 -47
  474. package/src/base-control/docs-manifest.json +12 -0
  475. package/src/base-control/stories/index.story.tsx +4 -0
  476. package/src/base-control/types.ts +3 -0
  477. package/src/border-box-control/border-box-control/README.md +1 -0
  478. package/src/border-box-control/border-box-control/component.tsx +1 -0
  479. package/src/border-box-control/border-box-control/hook.ts +7 -0
  480. package/src/border-box-control/stories/index.story.tsx +1 -0
  481. package/src/border-box-control/test/index.tsx +1 -0
  482. package/src/border-control/border-control/README.md +1 -0
  483. package/src/border-control/border-control/component.tsx +1 -0
  484. package/src/border-control/border-control/hook.ts +7 -1
  485. package/src/border-control/border-control-dropdown/component.tsx +25 -13
  486. package/src/border-control/stories/index.story.tsx +1 -0
  487. package/src/border-control/test/index.js +1 -0
  488. package/src/button/stories/index.story.tsx +2 -1
  489. package/src/card/stories/index.story.tsx +2 -1
  490. package/src/color-palette/index.native.js +1 -2
  491. package/src/color-palette/index.tsx +1 -1
  492. package/src/color-palette/style.scss +2 -4
  493. package/src/color-picker/index.native.js +0 -1
  494. package/src/composite/legacy/index.tsx +5 -2
  495. package/src/composite/stories/index.story.tsx +2 -1
  496. package/src/confirm-dialog/stories/index.story.tsx +2 -1
  497. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
  498. package/src/date-time/date/index.tsx +0 -1
  499. package/src/disabled/stories/index.story.tsx +2 -1
  500. package/src/draggable/stories/index.story.tsx +2 -1
  501. package/src/dropdown/stories/index.story.tsx +2 -1
  502. package/src/external-link/stories/index.story.tsx +2 -1
  503. package/src/font-size-picker/index.native.js +7 -7
  504. package/src/form-file-upload/index.tsx +7 -1
  505. package/src/form-token-field/index.tsx +0 -3
  506. package/src/form-token-field/style.scss +12 -13
  507. package/src/form-token-field/suggestions-list.tsx +6 -0
  508. package/src/form-token-field/token.tsx +1 -0
  509. package/src/guide/page-control.tsx +1 -0
  510. package/src/guide/style.scss +4 -6
  511. package/src/heading/stories/index.story.tsx +2 -1
  512. package/src/item-group/stories/index.story.tsx +8 -4
  513. package/src/keyboard-shortcuts/stories/index.story.tsx +2 -1
  514. package/src/{dropdown-menu-v2 → menu}/README.md +34 -34
  515. package/src/{dropdown-menu-v2 → menu}/checkbox-item.tsx +14 -14
  516. package/src/menu/context.tsx +13 -0
  517. package/src/{dropdown-menu-v2 → menu}/group-label.tsx +8 -8
  518. package/src/menu/group.tsx +26 -0
  519. package/src/{dropdown-menu-v2 → menu}/index.tsx +65 -70
  520. package/src/{dropdown-menu-v2 → menu}/item-help-text.tsx +3 -7
  521. package/src/{dropdown-menu-v2 → menu}/item-label.tsx +3 -7
  522. package/src/{dropdown-menu-v2 → menu}/item.tsx +13 -13
  523. package/src/{dropdown-menu-v2 → menu}/radio-item.tsx +14 -14
  524. package/src/menu/separator.tsx +27 -0
  525. package/src/menu/stories/index.story.tsx +543 -0
  526. package/src/{dropdown-menu-v2 → menu}/styles.ts +17 -17
  527. package/src/{dropdown-menu-v2 → menu}/test/index.tsx +145 -225
  528. package/src/{dropdown-menu-v2 → menu}/types.ts +24 -23
  529. package/src/menu-item/index.tsx +1 -0
  530. package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
  531. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
  532. package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
  533. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  534. package/src/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  535. package/src/mobile/bottom-sheet-select-control/index.native.js +2 -2
  536. package/src/mobile/color-settings/index.native.js +1 -3
  537. package/src/mobile/color-settings/picker-screen.native.js +1 -3
  538. package/src/mobile/image/index.native.js +1 -3
  539. package/src/mobile/keyboard-avoiding-view/index.ios.js +1 -3
  540. package/src/mobile/link-picker/link-picker-results.native.js +2 -5
  541. package/src/mobile/link-picker/link-picker-screen.native.js +1 -3
  542. package/src/mobile/link-settings/index.native.js +6 -18
  543. package/src/mobile/link-settings/link-settings-screen.native.js +1 -3
  544. package/src/mobile/segmented-control/index.native.js +2 -6
  545. package/src/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
  546. package/src/modal/stories/index.story.tsx +2 -1
  547. package/src/navigable-container/stories/navigable-menu.story.tsx +2 -1
  548. package/src/navigable-container/stories/tabbable-container.story.tsx +2 -1
  549. package/src/navigation/index.tsx +1 -2
  550. package/src/navigation/item/use-navigation-tree-item.tsx +2 -2
  551. package/src/navigation/menu/menu-title-search.tsx +2 -2
  552. package/src/navigation/menu/use-navigation-tree-menu.tsx +2 -2
  553. package/src/navigator/stories/index.story.tsx +2 -1
  554. package/src/notice/index.tsx +2 -0
  555. package/src/notice/stories/index.story.tsx +7 -2
  556. package/src/notice/test/__snapshots__/index.tsx.snap +4 -4
  557. package/src/palette-edit/index.tsx +9 -5
  558. package/src/palette-edit/styles.ts +1 -67
  559. package/src/panel/body.tsx +1 -0
  560. package/src/panel/stories/index.story.tsx +2 -1
  561. package/src/popover/index.tsx +3 -0
  562. package/src/popover/stories/index.story.tsx +2 -1
  563. package/src/private-apis.ts +3 -3
  564. package/src/progress-bar/stories/index.story.tsx +2 -1
  565. package/src/radio-group/README.md +8 -8
  566. package/src/radio-group/index.tsx +2 -0
  567. package/src/radio-group/radio.tsx +7 -0
  568. package/src/radio-group/stories/index.story.tsx +16 -4
  569. package/src/radio-group/types.ts +6 -1
  570. package/src/resizable-box/stories/index.story.tsx +2 -1
  571. package/src/sandbox/index.native.js +1 -3
  572. package/src/sandbox/index.tsx +3 -6
  573. package/src/sandbox/stories/index.story.tsx +2 -1
  574. package/src/scroll-lock/stories/index.story.tsx +2 -1
  575. package/src/search-control/index.native.js +1 -3
  576. package/src/shortcut/stories/index.story.tsx +2 -1
  577. package/src/slot-fill/bubbles-virtually/slot.tsx +1 -2
  578. package/src/slot-fill/fill.ts +3 -6
  579. package/src/slot-fill/stories/index.story.tsx +2 -1
  580. package/src/snackbar/index.tsx +2 -1
  581. package/src/snackbar/stories/index.story.tsx +2 -1
  582. package/src/snackbar/stories/list.story.tsx +2 -1
  583. package/src/snackbar/style.scss +7 -16
  584. package/src/spacer/hook.ts +3 -2
  585. package/src/spinner/stories/index.story.tsx +2 -1
  586. package/src/tab-panel/index.tsx +3 -0
  587. package/src/tab-panel/stories/index.story.tsx +2 -1
  588. package/src/tab-panel/style.scss +1 -3
  589. package/src/tabs/README.md +63 -21
  590. package/src/tabs/index.tsx +112 -189
  591. package/src/tabs/stories/index.story.tsx +5 -2
  592. package/src/tabs/styles.ts +13 -5
  593. package/src/tabs/tab.tsx +23 -3
  594. package/src/tabs/tablist.tsx +44 -17
  595. package/src/tabs/test/index.tsx +131 -118
  596. package/src/tabs/types.ts +89 -49
  597. package/src/text/stories/index.story.tsx +2 -1
  598. package/src/text-highlight/stories/index.story.tsx +2 -1
  599. package/src/theme/stories/index.story.tsx +2 -1
  600. package/src/tip/stories/index.story.tsx +2 -1
  601. package/src/toggle-group-control/toggle-group-control/component.tsx +2 -1
  602. package/src/toolbar/toolbar/index.tsx +3 -0
  603. package/src/tools-panel/tools-panel-header/component.tsx +1 -1
  604. package/src/tools-panel/tools-panel-item/hook.ts +0 -2
  605. package/src/tooltip/index.native.js +5 -15
  606. package/src/tooltip/stories/index.story.tsx +2 -1
  607. package/src/tree-grid/stories/index.story.tsx +2 -1
  608. package/src/truncate/stories/index.story.tsx +2 -1
  609. package/src/unit-control/index.native.js +2 -6
  610. package/src/utils/deprecated-36px-size.ts +27 -0
  611. package/src/utils/element-rect.ts +14 -2
  612. package/src/utils/hooks/use-animated-offset-rect.ts +13 -1
  613. package/src/utils/hooks/use-update-effect.js +0 -2
  614. package/src/visually-hidden/stories/index.story.tsx +2 -1
  615. package/tsconfig.tsbuildinfo +1 -1
  616. package/build/dropdown-menu-v2/checkbox-item.js.map +0 -1
  617. package/build/dropdown-menu-v2/context.js.map +0 -1
  618. package/build/dropdown-menu-v2/group-label.js.map +0 -1
  619. package/build/dropdown-menu-v2/group.js.map +0 -1
  620. package/build/dropdown-menu-v2/index.js.map +0 -1
  621. package/build/dropdown-menu-v2/item-help-text.js.map +0 -1
  622. package/build/dropdown-menu-v2/item-label.js.map +0 -1
  623. package/build/dropdown-menu-v2/item.js.map +0 -1
  624. package/build/dropdown-menu-v2/radio-item.js.map +0 -1
  625. package/build/dropdown-menu-v2/separator.js.map +0 -1
  626. package/build/dropdown-menu-v2/styles.js +0 -150
  627. package/build/dropdown-menu-v2/styles.js.map +0 -1
  628. package/build/dropdown-menu-v2/types.js.map +0 -1
  629. package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +0 -1
  630. package/build-module/dropdown-menu-v2/checkbox-item.js.map +0 -1
  631. package/build-module/dropdown-menu-v2/context.js.map +0 -1
  632. package/build-module/dropdown-menu-v2/group-label.js.map +0 -1
  633. package/build-module/dropdown-menu-v2/group.js +0 -21
  634. package/build-module/dropdown-menu-v2/group.js.map +0 -1
  635. package/build-module/dropdown-menu-v2/index.js.map +0 -1
  636. package/build-module/dropdown-menu-v2/item-help-text.js.map +0 -1
  637. package/build-module/dropdown-menu-v2/item-label.js.map +0 -1
  638. package/build-module/dropdown-menu-v2/item.js.map +0 -1
  639. package/build-module/dropdown-menu-v2/radio-item.js.map +0 -1
  640. package/build-module/dropdown-menu-v2/separator.js +0 -22
  641. package/build-module/dropdown-menu-v2/separator.js.map +0 -1
  642. package/build-module/dropdown-menu-v2/styles.js +0 -143
  643. package/build-module/dropdown-menu-v2/styles.js.map +0 -1
  644. package/build-module/dropdown-menu-v2/types.js.map +0 -1
  645. package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +0 -1
  646. package/build-types/dropdown-menu-v2/checkbox-item.d.ts +0 -3
  647. package/build-types/dropdown-menu-v2/checkbox-item.d.ts.map +0 -1
  648. package/build-types/dropdown-menu-v2/context.d.ts +0 -6
  649. package/build-types/dropdown-menu-v2/context.d.ts.map +0 -1
  650. package/build-types/dropdown-menu-v2/group-label.d.ts +0 -3
  651. package/build-types/dropdown-menu-v2/group-label.d.ts.map +0 -1
  652. package/build-types/dropdown-menu-v2/group.d.ts +0 -3
  653. package/build-types/dropdown-menu-v2/group.d.ts.map +0 -1
  654. package/build-types/dropdown-menu-v2/index.d.ts +0 -40
  655. package/build-types/dropdown-menu-v2/index.d.ts.map +0 -1
  656. package/build-types/dropdown-menu-v2/item-help-text.d.ts.map +0 -1
  657. package/build-types/dropdown-menu-v2/item-label.d.ts.map +0 -1
  658. package/build-types/dropdown-menu-v2/item.d.ts +0 -3
  659. package/build-types/dropdown-menu-v2/item.d.ts.map +0 -1
  660. package/build-types/dropdown-menu-v2/radio-item.d.ts +0 -3
  661. package/build-types/dropdown-menu-v2/radio-item.d.ts.map +0 -1
  662. package/build-types/dropdown-menu-v2/separator.d.ts +0 -3
  663. package/build-types/dropdown-menu-v2/separator.d.ts.map +0 -1
  664. package/build-types/dropdown-menu-v2/stories/index.story.d.ts +0 -16
  665. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +0 -1
  666. package/build-types/dropdown-menu-v2/styles.d.ts.map +0 -1
  667. package/build-types/dropdown-menu-v2/test/index.d.ts.map +0 -1
  668. package/build-types/dropdown-menu-v2/types.d.ts.map +0 -1
  669. package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts.map +0 -1
  670. package/src/dropdown-menu-v2/context.tsx +0 -13
  671. package/src/dropdown-menu-v2/group.tsx +0 -26
  672. package/src/dropdown-menu-v2/separator.tsx +0 -27
  673. package/src/dropdown-menu-v2/stories/index.story.tsx +0 -639
  674. /package/build/{dropdown-menu-v2 → menu}/types.js +0 -0
  675. /package/build/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.js +0 -0
  676. /package/build-module/{dropdown-menu-v2 → menu}/types.js +0 -0
  677. /package/build-module/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.js +0 -0
  678. /package/build-types/{dropdown-menu-v2 → menu}/test/index.d.ts +0 -0
  679. /package/build-types/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.d.ts +0 -0
  680. /package/src/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["removeAccents","renderToString","useEffect","useState","useRef","useMemo","useInstanceId","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","isAppleOS","getAutoCompleterUI","escapeRegExp","withIgnoreIMEEvents","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getNodeText","node","toString","Array","map","join","props","children","EMPTY_FILTERED_OPTIONS","AUTOCOMPLETE_HOOK_REFERENCE","useAutocomplete","record","onChange","onReplace","completers","contentRef","instanceId","selectedIndex","setSelectedIndex","filteredOptions","setFilteredOptions","filterValue","setFilterValue","autocompleter","setAutocompleter","AutocompleterUI","setAutocompleterUI","backspacing","insertCompletion","replacement","end","start","triggerPrefix","length","toInsert","html","select","option","getOptionCompletion","isDisabled","completion","value","isCompletionObject","obj","action","undefined","completionObject","reset","onChangeOptions","options","handleKeyDown","event","current","key","defaultPrevented","newIndex","label","preventDefault","textContent","completer","reduce","lastTrigger","currentCompleter","triggerIndex","lastIndexOf","lastTriggerIndex","allowContext","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","textAfterSelection","test","safeTrigger","text","match","RegExp","query","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","onSelect","useLastDifferentValue","history","Set","add","size","delete","from","useAutocompleteProps","ref","onKeyDownRef","previousRecord","mergedRefs","element","_onKeyDown","addEventListener","removeEventListener","didUserInput","Autocomplete","isSelected"],"sources":["@wordpress/components/src/autocomplete/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n} from '@wordpress/element';\nimport { useInstanceId, useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n} from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport type {\n\tAutocompleteProps,\n\tAutocompleterUIProps,\n\tInsertOption,\n\tKeyedOption,\n\tOptionCompletion,\n\tReplaceOption,\n\tUseAutocompleteProps,\n\tWPCompleter,\n} from './types';\n\nconst getNodeText = ( node: React.ReactNode ): string => {\n\tif ( node === null ) {\n\t\treturn '';\n\t}\n\n\tswitch ( typeof node ) {\n\t\tcase 'string':\n\t\tcase 'number':\n\t\t\treturn node.toString();\n\t\t\tbreak;\n\t\tcase 'boolean':\n\t\t\treturn '';\n\t\t\tbreak;\n\t\tcase 'object': {\n\t\t\tif ( node instanceof Array ) {\n\t\t\t\treturn node.map( getNodeText ).join( '' );\n\t\t\t}\n\t\t\tif ( 'props' in node ) {\n\t\t\t\treturn getNodeText( node.props.children );\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\treturn '';\n\t}\n\n\treturn '';\n};\n\nconst EMPTY_FILTERED_OPTIONS: KeyedOption[] = [];\n\n// Used for generating the instance ID\nconst AUTOCOMPLETE_HOOK_REFERENCE = {};\n\nexport function useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n}: UseAutocompleteProps ) {\n\tconst instanceId = useInstanceId( AUTOCOMPLETE_HOOK_REFERENCE );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\n\tconst [ filteredOptions, setFilteredOptions ] = useState<\n\t\tArray< KeyedOption >\n\t>( EMPTY_FILTERED_OPTIONS );\n\tconst [ filterValue, setFilterValue ] =\n\t\tuseState< AutocompleterUIProps[ 'filterValue' ] >( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState< WPCompleter | null >(\n\t\tnull\n\t);\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState<\n\t\t( ( props: AutocompleterUIProps ) => JSX.Element | null ) | null\n\t>( null );\n\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement: React.ReactNode ) {\n\t\tif ( autocompleter === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t}\n\n\tfunction select( option: KeyedOption ) {\n\t\tconst { getOptionCompletion } = autocompleter || {};\n\n\t\tif ( option.isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( getOptionCompletion ) {\n\t\t\tconst completion = getOptionCompletion( option.value, filterValue );\n\n\t\t\tconst isCompletionObject = (\n\t\t\t\tobj: OptionCompletion\n\t\t\t): obj is InsertOption | ReplaceOption => {\n\t\t\t\treturn (\n\t\t\t\t\tobj !== null &&\n\t\t\t\t\ttypeof obj === 'object' &&\n\t\t\t\t\t'action' in obj &&\n\t\t\t\t\tobj.action !== undefined &&\n\t\t\t\t\t'value' in obj &&\n\t\t\t\t\tobj.value !== undefined\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst completionObject = isCompletionObject( completion )\n\t\t\t\t? completion\n\t\t\t\t: ( {\n\t\t\t\t\t\taction: 'insert-at-caret',\n\t\t\t\t\t\tvalue: completion,\n\t\t\t\t } as InsertOption );\n\n\t\t\tif ( 'replace' === completionObject.action ) {\n\t\t\t\tonReplace( [ completionObject.value ] );\n\t\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t\t// state (below) on an unmounted component.\n\t\t\t\treturn;\n\t\t\t} else if ( 'insert-at-caret' === completionObject.action ) {\n\t\t\t\tinsertCompletion( completionObject.value );\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\treset();\n\t}\n\n\tfunction reset() {\n\t\tsetSelectedIndex( 0 );\n\t\tsetFilteredOptions( EMPTY_FILTERED_OPTIONS );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\t/**\n\t * Load options for an autocompleter.\n\t *\n\t * @param {Array} options\n\t */\n\tfunction onChangeOptions( options: Array< KeyedOption > ) {\n\t\tsetSelectedIndex(\n\t\t\toptions.length === filteredOptions.length ? selectedIndex : 0\n\t\t);\n\t\tsetFilteredOptions( options );\n\t}\n\n\tfunction handleKeyDown( event: KeyboardEvent ) {\n\t\tbackspacing.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp': {\n\t\t\t\tconst newIndex =\n\t\t\t\t\t( selectedIndex === 0\n\t\t\t\t\t\t? filteredOptions.length\n\t\t\t\t\t\t: selectedIndex ) - 1;\n\t\t\t\tsetSelectedIndex( newIndex );\n\t\t\t\t// See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902.\n\t\t\t\tif ( isAppleOS() ) {\n\t\t\t\t\tspeak(\n\t\t\t\t\t\tgetNodeText( filteredOptions[ newIndex ].label ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'ArrowDown': {\n\t\t\t\tconst newIndex = ( selectedIndex + 1 ) % filteredOptions.length;\n\t\t\t\tsetSelectedIndex( newIndex );\n\t\t\t\tif ( isAppleOS() ) {\n\t\t\t\t\tspeak(\n\t\t\t\t\t\tgetNodeText( filteredOptions[ newIndex ].label ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'Escape':\n\t\t\t\tsetAutocompleter( null );\n\t\t\t\tsetAutocompleterUI( null );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\treset();\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t\treturn '';\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Find the completer with the highest triggerPrefix index in the\n\t\t// textContent.\n\t\tconst completer = completers.reduce< WPCompleter | null >(\n\t\t\t( lastTrigger, currentCompleter ) => {\n\t\t\t\tconst triggerIndex = textContent.lastIndexOf(\n\t\t\t\t\tcurrentCompleter.triggerPrefix\n\t\t\t\t);\n\t\t\t\tconst lastTriggerIndex =\n\t\t\t\t\tlastTrigger !== null\n\t\t\t\t\t\t? textContent.lastIndexOf( lastTrigger.triggerPrefix )\n\t\t\t\t\t\t: -1;\n\n\t\t\t\treturn triggerIndex > lastTriggerIndex\n\t\t\t\t\t? currentCompleter\n\t\t\t\t\t: lastTrigger;\n\t\t\t},\n\t\t\tnull\n\t\t);\n\n\t\tif ( ! completer ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst { allowContext, triggerPrefix } = completer;\n\t\tconst triggerIndex = textContent.lastIndexOf( triggerPrefix );\n\t\tconst textWithoutTrigger = textContent.slice(\n\t\t\ttriggerIndex + triggerPrefix.length\n\t\t);\n\n\t\tconst tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n\t\t// This is a final barrier to prevent the effect from completing with\n\t\t// an extremely long string, which causes the editor to slow-down\n\t\t// significantly. This could happen, for example, if `matchingWhileBackspacing`\n\t\t// is true and one of the \"words\" end up being too long. If that's the case,\n\t\t// it will be caught by this guard.\n\t\tif ( tooDistantFromTrigger ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst mismatch = filteredOptions.length === 0;\n\t\tconst wordsFromTrigger = textWithoutTrigger.split( /\\s/ );\n\t\t// We need to allow the effect to run when not backspacing and if there\n\t\t// was a mismatch. i.e when typing a trigger + the match string or when\n\t\t// clicking in an existing trigger word on the page. We do that if we\n\t\t// detect that we have one word from trigger in the current textual context.\n\t\t//\n\t\t// Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n\t\t// allow the effect to run. It will run until there's a mismatch.\n\t\tconst hasOneTriggerWord = wordsFromTrigger.length === 1;\n\t\t// This is used to allow the effect to run when backspacing and if\n\t\t// \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n\t\t// word\" any word up to the limit of 3 from the trigger character.\n\t\t// Anything beyond that is ignored if there's a mismatch. This allows\n\t\t// us to \"escape\" a mismatch when backspacing, but still imposing some\n\t\t// sane limits.\n\t\t//\n\t\t// Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n\t\t// if the user presses backspace here, it will show the completion popup again.\n\t\tconst matchingWhileBackspacing =\n\t\t\tbackspacing.current && wordsFromTrigger.length <= 3;\n\n\t\tif ( mismatch && ! ( matchingWhileBackspacing || hasOneTriggerWord ) ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst textAfterSelection = getTextContent(\n\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t);\n\n\t\tif (\n\t\t\tallowContext &&\n\t\t\t! allowContext(\n\t\t\t\ttextContent.slice( 0, triggerIndex ),\n\t\t\t\ttextAfterSelection\n\t\t\t)\n\t\t) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t/^\\s/.test( textWithoutTrigger ) ||\n\t\t\t/\\s\\s+$/.test( textWithoutTrigger )\n\t\t) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! /[\\u0000-\\uFFFF]*$/.test( textWithoutTrigger ) ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\n\t\tconst text = removeAccents( textContent );\n\t\tconst match = text\n\t\t\t.slice( text.lastIndexOf( completer.triggerPrefix ) )\n\t\t\t.match( new RegExp( `${ safeTrigger }([\\u0000-\\uFFFF]*)$` ) );\n\t\tconst query = match && match[ 1 ];\n\n\t\tsetAutocompleter( completer );\n\t\tsetAutocompleterUI( () =>\n\t\t\tcompleter !== autocompleter\n\t\t\t\t? getAutoCompleterUI( completer )\n\t\t\t\t: AutocompleterUI\n\t\t);\n\t\tsetFilterValue( query === null ? '' : query );\n\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: undefined;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: withIgnoreIMEEvents( handleKeyDown ),\n\t\tpopover: hasSelection && AutocompleterUI && (\n\t\t\t<AutocompleterUI\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tvalue={ record }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ reset }\n\t\t\t/>\n\t\t),\n\t};\n}\n\nfunction useLastDifferentValue( value: UseAutocompleteProps[ 'record' ] ) {\n\tconst history = useRef< Set< typeof value > >( new Set() );\n\n\thistory.current.add( value );\n\n\t// Keep the history size to 2.\n\tif ( history.current.size > 2 ) {\n\t\thistory.current.delete( Array.from( history.current )[ 0 ] );\n\t}\n\n\treturn Array.from( history.current )[ 0 ];\n}\n\nexport function useAutocompleteProps( options: UseAutocompleteProps ) {\n\tconst ref = useRef< HTMLElement >( null );\n\tconst onKeyDownRef = useRef< ( event: KeyboardEvent ) => void >();\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect( ( element: HTMLElement ) => {\n\t\t\tfunction _onKeyDown( event: KeyboardEvent ) {\n\t\t\t\tonKeyDownRef.current?.( event );\n\t\t\t}\n\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t};\n\t\t}, [] ),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? 'list' : undefined,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId,\n\t};\n}\n\nexport default function Autocomplete( {\n\tchildren,\n\tisSelected,\n\t...options\n}: AutocompleteProps ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1C;AACA;AACA;AACA,SACCC,cAAc,EACdC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,OAAO,QACD,oBAAoB;AAC3B,SAASC,aAAa,EAAEC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC9E,SACCC,MAAM,EACNC,KAAK,EACLC,MAAM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AAE,SAAS,EAAEF,UAAW,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC,CACN,CAAC;;EAEH;EACA,MAAMG,YAAY,GAAG/F,MAAM,CAACkE,IAAI,KAAKuB,cAAc,EAAEvB,IAAI;EAEzD,IAAK,CAAE6B,YAAY,EAAG;IACrB,OAAO;MAAER,GAAG,EAAEG;IAAW,CAAC;EAC3B;EAEA,OAAO;IACNH,GAAG,EAAEG,UAAU;IACf9F,QAAQ,EAAEiF,OAAO;IACjB,mBAAmB,EAAEJ,SAAS,GAAG,MAAM,GAAGvC,SAAS;IACnD,WAAW,EAAEuC,SAAS;IACtB,uBAAuB,EAAEC;EAC1B,CAAC;AACF;AAEA,eAAe,SAASsB,YAAYA,CAAE;EACrCpG,QAAQ;EACRqG,UAAU;EACV,GAAG3D;AACe,CAAC,EAAG;EACtB,MAAM;IAAEuC,OAAO;IAAE,GAAGlF;EAAM,CAAC,GAAGI,eAAe,CAAEuC,OAAQ,CAAC;EACxD,oBACClD,KAAA,CAAAF,SAAA;IAAAU,QAAA,GACGA,QAAQ,CAAED,KAAM,CAAC,EACjBsG,UAAU,IAAIpB,OAAO;EAAA,CACtB,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["removeAccents","renderToString","useEffect","useState","useRef","useMemo","useInstanceId","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","isAppleOS","getAutoCompleterUI","escapeRegExp","withIgnoreIMEEvents","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getNodeText","node","toString","Array","map","join","props","children","EMPTY_FILTERED_OPTIONS","AUTOCOMPLETE_HOOK_REFERENCE","useAutocomplete","record","onChange","onReplace","completers","contentRef","instanceId","selectedIndex","setSelectedIndex","filteredOptions","setFilteredOptions","filterValue","setFilterValue","autocompleter","setAutocompleter","AutocompleterUI","setAutocompleterUI","backspacingRef","insertCompletion","replacement","end","start","triggerPrefix","length","toInsert","html","select","option","getOptionCompletion","isDisabled","completion","value","isCompletionObject","obj","action","undefined","completionObject","reset","onChangeOptions","options","handleKeyDown","event","current","key","defaultPrevented","newIndex","label","preventDefault","textContent","completer","reduce","lastTrigger","currentCompleter","triggerIndex","lastIndexOf","lastTriggerIndex","allowContext","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","textAfterSelection","test","safeTrigger","text","match","RegExp","query","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","onSelect","useLastDifferentValue","history","Set","add","size","delete","from","useAutocompleteProps","ref","onKeyDownRef","previousRecord","mergedRefs","element","_onKeyDown","addEventListener","removeEventListener","didUserInput","Autocomplete","isSelected"],"sources":["@wordpress/components/src/autocomplete/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n} from '@wordpress/element';\nimport { useInstanceId, useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n} from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport type {\n\tAutocompleteProps,\n\tAutocompleterUIProps,\n\tInsertOption,\n\tKeyedOption,\n\tOptionCompletion,\n\tReplaceOption,\n\tUseAutocompleteProps,\n\tWPCompleter,\n} from './types';\n\nconst getNodeText = ( node: React.ReactNode ): string => {\n\tif ( node === null ) {\n\t\treturn '';\n\t}\n\n\tswitch ( typeof node ) {\n\t\tcase 'string':\n\t\tcase 'number':\n\t\t\treturn node.toString();\n\t\t\tbreak;\n\t\tcase 'boolean':\n\t\t\treturn '';\n\t\t\tbreak;\n\t\tcase 'object': {\n\t\t\tif ( node instanceof Array ) {\n\t\t\t\treturn node.map( getNodeText ).join( '' );\n\t\t\t}\n\t\t\tif ( 'props' in node ) {\n\t\t\t\treturn getNodeText( node.props.children );\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\treturn '';\n\t}\n\n\treturn '';\n};\n\nconst EMPTY_FILTERED_OPTIONS: KeyedOption[] = [];\n\n// Used for generating the instance ID\nconst AUTOCOMPLETE_HOOK_REFERENCE = {};\n\nexport function useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n}: UseAutocompleteProps ) {\n\tconst instanceId = useInstanceId( AUTOCOMPLETE_HOOK_REFERENCE );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\n\tconst [ filteredOptions, setFilteredOptions ] = useState<\n\t\tArray< KeyedOption >\n\t>( EMPTY_FILTERED_OPTIONS );\n\tconst [ filterValue, setFilterValue ] =\n\t\tuseState< AutocompleterUIProps[ 'filterValue' ] >( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState< WPCompleter | null >(\n\t\tnull\n\t);\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState<\n\t\t( ( props: AutocompleterUIProps ) => JSX.Element | null ) | null\n\t>( null );\n\n\tconst backspacingRef = useRef( false );\n\n\tfunction insertCompletion( replacement: React.ReactNode ) {\n\t\tif ( autocompleter === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t}\n\n\tfunction select( option: KeyedOption ) {\n\t\tconst { getOptionCompletion } = autocompleter || {};\n\n\t\tif ( option.isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( getOptionCompletion ) {\n\t\t\tconst completion = getOptionCompletion( option.value, filterValue );\n\n\t\t\tconst isCompletionObject = (\n\t\t\t\tobj: OptionCompletion\n\t\t\t): obj is InsertOption | ReplaceOption => {\n\t\t\t\treturn (\n\t\t\t\t\tobj !== null &&\n\t\t\t\t\ttypeof obj === 'object' &&\n\t\t\t\t\t'action' in obj &&\n\t\t\t\t\tobj.action !== undefined &&\n\t\t\t\t\t'value' in obj &&\n\t\t\t\t\tobj.value !== undefined\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst completionObject = isCompletionObject( completion )\n\t\t\t\t? completion\n\t\t\t\t: ( {\n\t\t\t\t\t\taction: 'insert-at-caret',\n\t\t\t\t\t\tvalue: completion,\n\t\t\t\t } as InsertOption );\n\n\t\t\tif ( 'replace' === completionObject.action ) {\n\t\t\t\tonReplace( [ completionObject.value ] );\n\t\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t\t// state (below) on an unmounted component.\n\t\t\t\treturn;\n\t\t\t} else if ( 'insert-at-caret' === completionObject.action ) {\n\t\t\t\tinsertCompletion( completionObject.value );\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\treset();\n\t}\n\n\tfunction reset() {\n\t\tsetSelectedIndex( 0 );\n\t\tsetFilteredOptions( EMPTY_FILTERED_OPTIONS );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\t/**\n\t * Load options for an autocompleter.\n\t *\n\t * @param {Array} options\n\t */\n\tfunction onChangeOptions( options: Array< KeyedOption > ) {\n\t\tsetSelectedIndex(\n\t\t\toptions.length === filteredOptions.length ? selectedIndex : 0\n\t\t);\n\t\tsetFilteredOptions( options );\n\t}\n\n\tfunction handleKeyDown( event: KeyboardEvent ) {\n\t\tbackspacingRef.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp': {\n\t\t\t\tconst newIndex =\n\t\t\t\t\t( selectedIndex === 0\n\t\t\t\t\t\t? filteredOptions.length\n\t\t\t\t\t\t: selectedIndex ) - 1;\n\t\t\t\tsetSelectedIndex( newIndex );\n\t\t\t\t// See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902.\n\t\t\t\tif ( isAppleOS() ) {\n\t\t\t\t\tspeak(\n\t\t\t\t\t\tgetNodeText( filteredOptions[ newIndex ].label ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'ArrowDown': {\n\t\t\t\tconst newIndex = ( selectedIndex + 1 ) % filteredOptions.length;\n\t\t\t\tsetSelectedIndex( newIndex );\n\t\t\t\tif ( isAppleOS() ) {\n\t\t\t\t\tspeak(\n\t\t\t\t\t\tgetNodeText( filteredOptions[ newIndex ].label ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase 'Escape':\n\t\t\t\tsetAutocompleter( null );\n\t\t\t\tsetAutocompleterUI( null );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\treset();\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t\treturn '';\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Find the completer with the highest triggerPrefix index in the\n\t\t// textContent.\n\t\tconst completer = completers.reduce< WPCompleter | null >(\n\t\t\t( lastTrigger, currentCompleter ) => {\n\t\t\t\tconst triggerIndex = textContent.lastIndexOf(\n\t\t\t\t\tcurrentCompleter.triggerPrefix\n\t\t\t\t);\n\t\t\t\tconst lastTriggerIndex =\n\t\t\t\t\tlastTrigger !== null\n\t\t\t\t\t\t? textContent.lastIndexOf( lastTrigger.triggerPrefix )\n\t\t\t\t\t\t: -1;\n\n\t\t\t\treturn triggerIndex > lastTriggerIndex\n\t\t\t\t\t? currentCompleter\n\t\t\t\t\t: lastTrigger;\n\t\t\t},\n\t\t\tnull\n\t\t);\n\n\t\tif ( ! completer ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst { allowContext, triggerPrefix } = completer;\n\t\tconst triggerIndex = textContent.lastIndexOf( triggerPrefix );\n\t\tconst textWithoutTrigger = textContent.slice(\n\t\t\ttriggerIndex + triggerPrefix.length\n\t\t);\n\n\t\tconst tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n\t\t// This is a final barrier to prevent the effect from completing with\n\t\t// an extremely long string, which causes the editor to slow-down\n\t\t// significantly. This could happen, for example, if `matchingWhileBackspacing`\n\t\t// is true and one of the \"words\" end up being too long. If that's the case,\n\t\t// it will be caught by this guard.\n\t\tif ( tooDistantFromTrigger ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst mismatch = filteredOptions.length === 0;\n\t\tconst wordsFromTrigger = textWithoutTrigger.split( /\\s/ );\n\t\t// We need to allow the effect to run when not backspacing and if there\n\t\t// was a mismatch. i.e when typing a trigger + the match string or when\n\t\t// clicking in an existing trigger word on the page. We do that if we\n\t\t// detect that we have one word from trigger in the current textual context.\n\t\t//\n\t\t// Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n\t\t// allow the effect to run. It will run until there's a mismatch.\n\t\tconst hasOneTriggerWord = wordsFromTrigger.length === 1;\n\t\t// This is used to allow the effect to run when backspacing and if\n\t\t// \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n\t\t// word\" any word up to the limit of 3 from the trigger character.\n\t\t// Anything beyond that is ignored if there's a mismatch. This allows\n\t\t// us to \"escape\" a mismatch when backspacing, but still imposing some\n\t\t// sane limits.\n\t\t//\n\t\t// Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n\t\t// if the user presses backspace here, it will show the completion popup again.\n\t\tconst matchingWhileBackspacing =\n\t\t\tbackspacingRef.current && wordsFromTrigger.length <= 3;\n\n\t\tif ( mismatch && ! ( matchingWhileBackspacing || hasOneTriggerWord ) ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst textAfterSelection = getTextContent(\n\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t);\n\n\t\tif (\n\t\t\tallowContext &&\n\t\t\t! allowContext(\n\t\t\t\ttextContent.slice( 0, triggerIndex ),\n\t\t\t\ttextAfterSelection\n\t\t\t)\n\t\t) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t/^\\s/.test( textWithoutTrigger ) ||\n\t\t\t/\\s\\s+$/.test( textWithoutTrigger )\n\t\t) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! /[\\u0000-\\uFFFF]*$/.test( textWithoutTrigger ) ) {\n\t\t\tif ( autocompleter ) {\n\t\t\t\treset();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\n\t\tconst text = removeAccents( textContent );\n\t\tconst match = text\n\t\t\t.slice( text.lastIndexOf( completer.triggerPrefix ) )\n\t\t\t.match( new RegExp( `${ safeTrigger }([\\u0000-\\uFFFF]*)$` ) );\n\t\tconst query = match && match[ 1 ];\n\n\t\tsetAutocompleter( completer );\n\t\tsetAutocompleterUI( () =>\n\t\t\tcompleter !== autocompleter\n\t\t\t\t? getAutoCompleterUI( completer )\n\t\t\t\t: AutocompleterUI\n\t\t);\n\t\tsetFilterValue( query === null ? '' : query );\n\t\t// We want to avoid introducing unexpected side effects.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: undefined;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: withIgnoreIMEEvents( handleKeyDown ),\n\t\tpopover: hasSelection && AutocompleterUI && (\n\t\t\t<AutocompleterUI\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tvalue={ record }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ reset }\n\t\t\t/>\n\t\t),\n\t};\n}\n\nfunction useLastDifferentValue( value: UseAutocompleteProps[ 'record' ] ) {\n\tconst history = useRef< Set< typeof value > >( new Set() );\n\n\thistory.current.add( value );\n\n\t// Keep the history size to 2.\n\tif ( history.current.size > 2 ) {\n\t\thistory.current.delete( Array.from( history.current )[ 0 ] );\n\t}\n\n\treturn Array.from( history.current )[ 0 ];\n}\n\nexport function useAutocompleteProps( options: UseAutocompleteProps ) {\n\tconst ref = useRef< HTMLElement >( null );\n\tconst onKeyDownRef = useRef< ( event: KeyboardEvent ) => void >();\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect( ( element: HTMLElement ) => {\n\t\t\tfunction _onKeyDown( event: KeyboardEvent ) {\n\t\t\t\tonKeyDownRef.current?.( event );\n\t\t\t}\n\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t};\n\t\t}, [] ),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? 'list' : undefined,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId,\n\t};\n}\n\nexport default function Autocomplete( {\n\tchildren,\n\tisSelected,\n\t...options\n}: AutocompleteProps ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1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C,UAAUA,CAAEpD,KAAoB,EAAG;MAC3CgD,YAAY,CAAC/C,OAAO,GAAID,KAAM,CAAC;IAChC;IACAmD,OAAO,CAACE,gBAAgB,CAAE,SAAS,EAAED,UAAW,CAAC;IACjD,OAAO,MAAM;MACZD,OAAO,CAACG,mBAAmB,CAAE,SAAS,EAAEF,UAAW,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC,CACN,CAAC;;EAEH;EACA,MAAMG,YAAY,GAAG/F,MAAM,CAACkE,IAAI,KAAKuB,cAAc,EAAEvB,IAAI;EAEzD,IAAK,CAAE6B,YAAY,EAAG;IACrB,OAAO;MAAER,GAAG,EAAEG;IAAW,CAAC;EAC3B;EAEA,OAAO;IACNH,GAAG,EAAEG,UAAU;IACf9F,QAAQ,EAAEiF,OAAO;IACjB,mBAAmB,EAAEJ,SAAS,GAAG,MAAM,GAAGvC,SAAS;IACnD,WAAW,EAAEuC,SAAS;IACtB,uBAAuB,EAAEC;EAC1B,CAAC;AACF;AAEA,eAAe,SAASsB,YAAYA,CAAE;EACrCpG,QAAQ;EACRqG,UAAU;EACV,GAAG3D;AACe,CAAC,EAAG;EACtB,MAAM;IAAEuC,OAAO;IAAE,GAAGlF;EAAM,CAAC,GAAGI,eAAe,CAAEuC,OAAQ,CAAC;EACxD,oBACClD,KAAA,CAAAF,SAAA;IAAAU,QAAA,GACGA,QAAQ,CAAED,KAAM,CAAC,EACjBsG,UAAU,IAAIpB,OAAO;EAAA,CACtB,CAAC;AAEL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/base-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\nexport type BaseControlProps = {\n\t/**\n\t * Start opting into the new margin-free styles that will become the default in a future version.\n\t *\n\t * @default false\n\t */\n\t__nextHasNoMarginBottom?: boolean;\n\t/**\n\t * Temporary private prop for showing better deprecation messages,\n\t * e.g. `Some feature from wp.components.${ __associatedWPControl } is deprecated`.\n\t *\n\t * @ignore\n\t */\n\t__associatedWPComponentName?: string;\n\t/**\n\t * The HTML `id` of the control element (passed in as a child to `BaseControl`) to which labels and help text are being generated.\n\t * This is necessary to accessibly associate the label with that element.\n\t *\n\t * The recommended way is to use the `useBaseControlProps` hook, which takes care of generating a unique `id` for you.\n\t * Otherwise, if you choose to pass an explicit `id` to this prop, you are responsible for ensuring the uniqueness of the `id`.\n\t */\n\tid?: string;\n\t/**\n\t * Additional description for the control.\n\t *\n\t * Only use for meaningful description or instructions for the control. An element containing the description will be programmatically associated to the BaseControl by the means of an `aria-describedby` attribute.\n\t */\n\thelp?: ReactNode;\n\t/**\n\t * If this property is added, a label will be generated using label property as the content.\n\t */\n\tlabel?: ReactNode;\n\t/**\n\t * If true, the label will only be visible to screen readers.\n\t *\n\t * @default false\n\t */\n\thideLabelFromVision?: boolean;\n\tclassName?: string;\n\t/**\n\t * The content to be displayed within the `BaseControl`.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type BaseControlVisualLabelProps = {\n\tchildren: ReactNode;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/base-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\nexport type BaseControlProps = {\n\t/**\n\t * Start opting into the new margin-free styles that will become the default in a future version.\n\t *\n\t * @default false\n\t */\n\t__nextHasNoMarginBottom?: boolean;\n\t/**\n\t * Temporary private prop for showing better deprecation messages,\n\t * e.g. `Some feature from wp.components.${ __associatedWPControl } is deprecated`.\n\t *\n\t * @ignore\n\t */\n\t__associatedWPComponentName?: string;\n\t/**\n\t * The HTML `id` of the control element (passed in as a child to `BaseControl`) to which labels and help text are being generated.\n\t * This is necessary to accessibly associate the label with that element.\n\t *\n\t * The recommended way is to use the `useBaseControlProps` hook, which takes care of generating a unique `id` for you.\n\t * Otherwise, if you choose to pass an explicit `id` to this prop, you are responsible for ensuring the uniqueness of the `id`.\n\t */\n\tid?: string;\n\t/**\n\t * Additional description for the control.\n\t *\n\t * Only use for meaningful description or instructions for the control. An element containing the description will be programmatically associated to the BaseControl by the means of an `aria-describedby` attribute.\n\t */\n\thelp?: ReactNode;\n\t/**\n\t * If this property is added, a label will be generated using label property as the content.\n\t */\n\tlabel?: ReactNode;\n\t/**\n\t * If true, the label will only be visible to screen readers.\n\t *\n\t * @default false\n\t */\n\thideLabelFromVision?: boolean;\n\tclassName?: string;\n\t/**\n\t * The content to be displayed within the `BaseControl`.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type BaseControlVisualLabelProps = {\n\t/**\n\t * The content to be displayed within the `BaseControl.VisualLabel`.\n\t */\n\tchildren: ReactNode;\n};\n"],"mappings":"","ignoreList":[]}
@@ -145,6 +145,7 @@ const UnconnectedBorderBoxControl = (props, forwardedRef) => {
145
145
  *
146
146
  * return (
147
147
  * <BorderBoxControl
148
+ * __next40pxDefaultSize
148
149
  * colors={ colors }
149
150
  * label={ __( 'Borders' ) }
150
151
  * onChange={ onChange }
@@ -1 +1 @@
1
- {"version":3,"names":["__","useMemo","useState","useMergeRefs","BorderBoxControlLinkedButton","BorderBoxControlSplitControls","BorderControl","StyledLabel","View","VisuallyHidden","contextConnect","useBorderBoxControl","jsx","_jsx","jsxs","_jsxs","BorderLabel","props","label","hideLabelFromVision","as","children","UnconnectedBorderBoxControl","forwardedRef","className","colors","disableCustomColors","disableUnits","enableAlpha","enableStyle","hasMixedBorders","isLinked","linkedControlClassName","linkedValue","onLinkedChange","onSplitChange","popoverPlacement","popoverOffset","size","splitValue","toggleLinked","wrapperClassName","__experimentalIsRenderedInSidebar","otherProps","popoverAnchor","setPopoverAnchor","popoverProps","placement","offset","anchor","shift","undefined","mergedRef","ref","onChange","placeholder","__unstablePopoverProps","shouldSanitizeBorder","value","withSlider","width","onClick","BorderBoxControl"],"sources":["@wordpress/components/src/border-box-control/border-box-control/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BorderBoxControlLinkedButton from '../border-box-control-linked-button';\nimport BorderBoxControlSplitControls from '../border-box-control-split-controls';\nimport { BorderControl } from '../../border-control';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderBoxControl } from './hook';\n\nimport type { BorderBoxControlProps } from '../types';\nimport type {\n\tLabelProps,\n\tBorderControlProps,\n} from '../../border-control/types';\n\nconst BorderLabel = ( props: LabelProps ) => {\n\tconst { label, hideLabelFromVision } = props;\n\n\tif ( ! label ) {\n\t\treturn null;\n\t}\n\n\treturn hideLabelFromVision ? (\n\t\t<VisuallyHidden as=\"label\">{ label }</VisuallyHidden>\n\t) : (\n\t\t<StyledLabel>{ label }</StyledLabel>\n\t);\n};\n\nconst UnconnectedBorderBoxControl = (\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tclassName,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tdisableUnits,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thasMixedBorders,\n\t\thideLabelFromVision,\n\t\tisLinked,\n\t\tlabel,\n\t\tlinkedControlClassName,\n\t\tlinkedValue,\n\t\tonLinkedChange,\n\t\tonSplitChange,\n\t\tpopoverPlacement,\n\t\tpopoverOffset,\n\t\tsize,\n\t\tsplitValue,\n\t\ttoggleLinked,\n\t\twrapperClassName,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t...otherProps\n\t} = useBorderBoxControl( props );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(\n\t\tnull\n\t);\n\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps: BorderControlProps[ '__unstablePopoverProps' ] =\n\t\tuseMemo(\n\t\t\t() =>\n\t\t\t\tpopoverPlacement\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tplacement: popoverPlacement,\n\t\t\t\t\t\t\toffset: popoverOffset,\n\t\t\t\t\t\t\tanchor: popoverAnchor,\n\t\t\t\t\t\t\tshift: true,\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t[ popoverPlacement, popoverOffset, popoverAnchor ]\n\t\t);\n\n\tconst mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );\n\treturn (\n\t\t<View className={ className } { ...otherProps } ref={ mergedRef }>\n\t\t\t<BorderLabel\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t\t<View className={ wrapperClassName }>\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<BorderControl\n\t\t\t\t\t\tclassName={ linkedControlClassName }\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onLinkedChange }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\thasMixedBorders ? __( 'Mixed' ) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\t\t\tshouldSanitizeBorder={ false } // This component will handle that.\n\t\t\t\t\t\tvalue={ linkedValue }\n\t\t\t\t\t\twithSlider\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsize === '__unstable-large' ? '116px' : '110px'\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BorderBoxControlSplitControls\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onSplitChange }\n\t\t\t\t\t\tpopoverPlacement={ popoverPlacement }\n\t\t\t\t\t\tpopoverOffset={ popoverOffset }\n\t\t\t\t\t\tvalue={ splitValue }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BorderBoxControlLinkedButton\n\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\tsize={ size }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</View>\n\t);\n};\n\n/**\n * An input control for the color, style, and width of the border of a box. The\n * border can be customized as a whole, or individually for each side of the box.\n *\n * ```jsx\n * import { BorderBoxControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderBoxControl = () => {\n * \tconst defaultBorder = {\n * \t\tcolor: '#72aee6',\n * \t\tstyle: 'dashed',\n * \t\twidth: '1px',\n * \t};\n * \tconst [ borders, setBorders ] = useState( {\n * \t\ttop: defaultBorder,\n * \t\tright: defaultBorder,\n * \t\tbottom: defaultBorder,\n * \t\tleft: defaultBorder,\n * \t} );\n * \tconst onChange = ( newBorders ) => setBorders( newBorders );\n *\n * \treturn (\n * \t\t<BorderBoxControl\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Borders' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ borders }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderBoxControl = contextConnect(\n\tUnconnectedBorderBoxControl,\n\t'BorderBoxControl'\n);\n\nexport default BorderBoxControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,OAAOC,4BAA4B,MAAM,qCAAqC;AAC9E,OAAOC,6BAA6B,MAAM,sCAAsC;AAChF,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,WAAW,QAAQ,+CAA+C;AAC3E,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,cAAc,QAAQ,uBAAuB;AAEtD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,mBAAmB,QAAQ,QAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQ7C,MAAMC,WAAW,GAAKC,KAAiB,IAAM;EAC5C,MAAM;IAAEC,KAAK;IAAEC;EAAoB,CAAC,GAAGF,KAAK;EAE5C,IAAK,CAAEC,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OAAOC,mBAAmB,gBACzBN,IAAA,CAACJ,cAAc;IAACW,EAAE,EAAC,OAAO;IAAAC,QAAA,EAAGH;EAAK,CAAkB,CAAC,gBAErDL,IAAA,CAACN,WAAW;IAAAc,QAAA,EAAGH;EAAK,CAAe,CACnC;AACF,CAAC;AAED,MAAMI,2BAA2B,GAAGA,CACnCL,KAAqE,EACrEM,YAAuC,KACnC;EACJ,MAAM;IACLC,SAAS;IACTC,MAAM;IACNC,mBAAmB;IACnBC,YAAY;IACZC,WAAW;IACXC,WAAW;IACXC,eAAe;IACfX,mBAAmB;IACnBY,QAAQ;IACRb,KAAK;IACLc,sBAAsB;IACtBC,WAAW;IACXC,cAAc;IACdC,aAAa;IACbC,gBAAg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;QAAA;QAC/BC,KAAK,EAAGzB,WAAa;QACrB0B,UAAU;QACVC,KAAK,EACJtB,IAAI,KAAK,kBAAkB,GAAG,OAAO,GAAG,OACxC;QACDI,iCAAiC,EAChCA,iCACA;QACDJ,IAAI,EAAGA;MAAM,CACb,CAAC,gBAEFzB,IAAA,CAACR,6BAA6B;QAC7BoB,MAAM,EAAGA,MAAQ;QACjBC,mBAAmB,EAAGA,mBAAqB;QAC3CE,WAAW,EAAGA,WAAa;QAC3BC,WAAW,EAAGA,WAAa;QAC3ByB,QAAQ,EAAGnB,aAAe;QAC1BC,gBAAgB,EAAGA,gBAAkB;QACrCC,aAAa,EAAGA,aAAe;QAC/BqB,KAAK,EAAGnB,UAAY;QACpBG,iCAAiC,EAChCA,iCACA;QACDJ,IAAI,EAAGA;MAAM,CACb,CACD,eACDzB,IAAA,CAACT,4BAA4B;QAC5ByD,OAAO,EAAGrB,YAAc;QACxBT,QAAQ,EAAGA,QAAU;QACrBO,IAAI,EAAGA;MAAM,CACb,CAAC;IAAA,CACG,CAAC;EAAA,CACF,CAAC;AAET,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMwB,gBAAgB,GAAGpD,cAAc,CAC7CY,2BAA2B,EAC3B,kBACD,CAAC;AAED,eAAewC,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["__","useMemo","useState","useMergeRefs","BorderBoxControlLinkedButton","BorderBoxControlSplitControls","BorderControl","StyledLabel","View","VisuallyHidden","contextConnect","useBorderBoxControl","jsx","_jsx","jsxs","_jsxs","BorderLabel","props","label","hideLabelFromVision","as","children","UnconnectedBorderBoxControl","forwardedRef","className","colors","disableCustomColors","disableUnits","enableAlpha","enableStyle","hasMixedBorders","isLinked","linkedControlClassName","linkedValue","onLinkedChange","onSplitChange","popoverPlacement","popoverOffset","size","splitValue","toggleLinked","wrapperClassName","__experimentalIsRenderedInSidebar","otherProps","popoverAnchor","setPopoverAnchor","popoverProps","placement","offset","anchor","shift","undefined","mergedRef","ref","onChange","placeholder","__unstablePopoverProps","shouldSanitizeBorder","value","withSlider","width","onClick","BorderBoxControl"],"sources":["@wordpress/components/src/border-box-control/border-box-control/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BorderBoxControlLinkedButton from '../border-box-control-linked-button';\nimport BorderBoxControlSplitControls from '../border-box-control-split-controls';\nimport { BorderControl } from '../../border-control';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderBoxControl } from './hook';\n\nimport type { BorderBoxControlProps } from '../types';\nimport type {\n\tLabelProps,\n\tBorderControlProps,\n} from '../../border-control/types';\n\nconst BorderLabel = ( props: LabelProps ) => {\n\tconst { label, hideLabelFromVision } = props;\n\n\tif ( ! label ) {\n\t\treturn null;\n\t}\n\n\treturn hideLabelFromVision ? (\n\t\t<VisuallyHidden as=\"label\">{ label }</VisuallyHidden>\n\t) : (\n\t\t<StyledLabel>{ label }</StyledLabel>\n\t);\n};\n\nconst UnconnectedBorderBoxControl = (\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tclassName,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tdisableUnits,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thasMixedBorders,\n\t\thideLabelFromVision,\n\t\tisLinked,\n\t\tlabel,\n\t\tlinkedControlClassName,\n\t\tlinkedValue,\n\t\tonLinkedChange,\n\t\tonSplitChange,\n\t\tpopoverPlacement,\n\t\tpopoverOffset,\n\t\tsize,\n\t\tsplitValue,\n\t\ttoggleLinked,\n\t\twrapperClassName,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t...otherProps\n\t} = useBorderBoxControl( props );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(\n\t\tnull\n\t);\n\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps: BorderControlProps[ '__unstablePopoverProps' ] =\n\t\tuseMemo(\n\t\t\t() =>\n\t\t\t\tpopoverPlacement\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tplacement: popoverPlacement,\n\t\t\t\t\t\t\toffset: popoverOffset,\n\t\t\t\t\t\t\tanchor: popoverAnchor,\n\t\t\t\t\t\t\tshift: true,\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t[ popoverPlacement, popoverOffset, popoverAnchor ]\n\t\t);\n\n\tconst mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );\n\treturn (\n\t\t<View className={ className } { ...otherProps } ref={ mergedRef }>\n\t\t\t<BorderLabel\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t\t<View className={ wrapperClassName }>\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<BorderControl\n\t\t\t\t\t\tclassName={ linkedControlClassName }\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onLinkedChange }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\thasMixedBorders ? __( 'Mixed' ) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\t\t\tshouldSanitizeBorder={ false } // This component will handle that.\n\t\t\t\t\t\tvalue={ linkedValue }\n\t\t\t\t\t\twithSlider\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsize === '__unstable-large' ? '116px' : '110px'\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BorderBoxControlSplitControls\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onSplitChange }\n\t\t\t\t\t\tpopoverPlacement={ popoverPlacement }\n\t\t\t\t\t\tpopoverOffset={ popoverOffset }\n\t\t\t\t\t\tvalue={ splitValue }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BorderBoxControlLinkedButton\n\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\tsize={ size }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</View>\n\t);\n};\n\n/**\n * An input control for the color, style, and width of the border of a box. The\n * border can be customized as a whole, or individually for each side of the box.\n *\n * ```jsx\n * import { BorderBoxControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderBoxControl = () => {\n * \tconst defaultBorder = {\n * \t\tcolor: '#72aee6',\n * \t\tstyle: 'dashed',\n * \t\twidth: '1px',\n * \t};\n * \tconst [ borders, setBorders ] = useState( {\n * \t\ttop: defaultBorder,\n * \t\tright: defaultBorder,\n * \t\tbottom: defaultBorder,\n * \t\tleft: defaultBorder,\n * \t} );\n * \tconst onChange = ( newBorders ) => setBorders( newBorders );\n *\n * \treturn (\n * \t\t<BorderBoxControl\n * \t\t\t__next40pxDefaultSize\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Borders' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ borders }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderBoxControl = contextConnect(\n\tUnconnectedBorderBoxControl,\n\t'BorderBoxControl'\n);\n\nexport default BorderBoxControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,OAAOC,4BAA4B,MAAM,qCAAqC;AAC9E,OAAOC,6BAA6B,MAAM,sCAAsC;AAChF,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,WAAW,QAAQ,+CAA+C;AAC3E,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,cAAc,QAAQ,uBAAuB;AAEtD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,mBAAmB,QAAQ,QAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQ7C,MAAMC,WAAW,GAAKC,KAAiB,IAAM;EAC5C,MAAM;IAAEC,KAAK;IAAEC;EAAoB,CAAC,GAAGF,KAAK;EAE5C,IAAK,CAAEC,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OAAOC,mBAAmB,gBACzBN,IAAA,CAACJ,cAAc;IAACW,EAAE,EAAC,OAAO;IAAAC,QAAA,EAAGH;EAAK,CAAkB,CA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,gBAAgB,GAAGpD,cAAc,CAC7CY,2BAA2B,EAC3B,kBACD,CAAC;AAED,eAAewC,gBAAgB","ignoreList":[]}
@@ -10,6 +10,7 @@ import * as styles from '../styles';
10
10
  import { getBorderDiff, getCommonBorder, getSplitBorders, hasMixedBorders, hasSplitBorders, isCompleteBorder, isEmptyBorder } from '../utils';
11
11
  import { useContextSystem } from '../../context';
12
12
  import { useCx } from '../../utils/hooks/use-cx';
13
+ import { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';
13
14
  export function useBorderBoxControl(props) {
14
15
  const {
15
16
  className,
@@ -23,6 +24,11 @@ export function useBorderBoxControl(props) {
23
24
  __next40pxDefaultSize,
24
25
  ...otherProps
25
26
  } = useContextSystem(props, 'BorderBoxControl');
27
+ maybeWarnDeprecated36pxSize({
28
+ componentName: 'BorderBoxControl',
29
+ __next40pxDefaultSize,
30
+ size
31
+ });
26
32
  const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;
27
33
  const mixedBorders = hasMixedBorders(value);
28
34
  const splitBorders = hasSplitBorders(value);
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","styles","getBorderDiff","getCommonBorder","getSplitBorders","hasMixedBorders","hasSplitBorders","isCompleteBorder","isEmptyBorder","useContextSystem","useCx","useBorderBoxControl","props","className","colors","onChange","enableAlpha","enableStyle","size","value","__experimentalIsRenderedInSidebar","__next40pxDefaultSize","otherProps","computedSize","mixedBorders","splitBorders","linkedValue","splitValue","hasWidthValue","isNaN","parseFloat","width","isLinked","setIsLinked","toggleLinked","onLinkedChange","newBorder","undefined","changes","updatedBorders","top","right","bottom","left","filteredResult","onSplitChange","side","cx","classes","borderBoxControl","linkedControlClassName","linkedBorderControl","wrapperClassName","wrapper","disableUnits"],"sources":["@wordpress/components/src/border-box-control/border-box-control/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport {\n\tgetBorderDiff,\n\tgetCommonBorder,\n\tgetSplitBorders,\n\thasMixedBorders,\n\thasSplitBorders,\n\tisCompleteBorder,\n\tisEmptyBorder,\n} from '../utils';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\n\nimport type { Border } from '../../border-control/types';\nimport type { Borders, BorderSide, BorderBoxControlProps } from '../types';\n\nexport function useBorderBoxControl(\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tcolors = [],\n\t\tonChange,\n\t\tenableAlpha = false,\n\t\tenableStyle = true,\n\t\tsize = 'default',\n\t\tvalue,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\t__next40pxDefaultSize,\n\t\t...otherProps\n\t} = useContextSystem( props, 'BorderBoxControl' );\n\n\tconst computedSize =\n\t\tsize === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;\n\n\tconst mixedBorders = hasMixedBorders( value );\n\tconst splitBorders = hasSplitBorders( value );\n\n\tconst linkedValue = splitBorders\n\t\t? getCommonBorder( value as Borders | undefined )\n\t\t: ( value as Border );\n\n\tconst splitValue = splitBorders\n\t\t? ( value as Borders )\n\t\t: getSplitBorders( value as Border | undefined );\n\n\t// If no numeric width value is set, the unit select will be disabled.\n\tconst hasWidthValue = ! isNaN( parseFloat( `${ linkedValue?.width }` ) );\n\n\tconst [ isLinked, setIsLinked ] = useState( ! mixedBorders );\n\tconst toggleLinked = () => setIsLinked( ! isLinked );\n\n\tconst onLinkedChange = ( newBorder?: Border ) => {\n\t\tif ( ! newBorder ) {\n\t\t\treturn onChange( undefined );\n\t\t}\n\n\t\t// If we have all props defined on the new border apply it.\n\t\tif ( ! mixedBorders || isCompleteBorder( newBorder ) ) {\n\t\t\treturn onChange(\n\t\t\t\tisEmptyBorder( newBorder ) ? undefined : newBorder\n\t\t\t);\n\t\t}\n\n\t\t// If we had mixed borders we might have had some shared border props\n\t\t// that we need to maintain. For example; we could have mixed borders\n\t\t// with all the same color but different widths. Then from the linked\n\t\t// control we change the color. We should keep the separate widths.\n\t\tconst changes = getBorderDiff(\n\t\t\tlinkedValue as Border,\n\t\t\tnewBorder as Border\n\t\t);\n\t\tconst updatedBorders = {\n\t\t\ttop: { ...( value as Borders )?.top, ...changes },\n\t\t\tright: { ...( value as Borders )?.right, ...changes },\n\t\t\tbottom: { ...( value as Borders )?.bottom, ...changes },\n\t\t\tleft: { ...( value as Borders )?.left, ...changes },\n\t\t};\n\n\t\tif ( hasMixedBorders( updatedBorders ) ) {\n\t\t\treturn onChange( updatedBorders );\n\t\t}\n\n\t\tconst filteredResult = isEmptyBorder( updatedBorders.top )\n\t\t\t? undefined\n\t\t\t: updatedBorders.top;\n\n\t\tonChange( filteredResult );\n\t};\n\n\tconst onSplitChange = (\n\t\tnewBorder: Border | undefined,\n\t\tside: BorderSide\n\t) => {\n\t\tconst updatedBorders = { ...splitValue, [ side ]: newBorder };\n\n\t\tif ( hasMixedBorders( updatedBorders ) ) {\n\t\t\tonChange( updatedBorders );\n\t\t} else {\n\t\t\tonChange( newBorder );\n\t\t}\n\t};\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\treturn cx( styles.borderBoxControl, className );\n\t}, [ cx, className ] );\n\n\tconst linkedControlClassName = useMemo( () => {\n\t\treturn cx( styles.linkedBorderControl() );\n\t}, [ cx ] );\n\n\tconst wrapperClassName = useMemo( () => {\n\t\treturn cx( styles.wrapper );\n\t}, [ cx ] );\n\n\treturn {\n\t\t...otherProps,\n\t\tclassName: classes,\n\t\tcolors,\n\t\tdisableUnits: mixedBorders && ! hasWidthValue,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thasMixedBorders: mixedBorders,\n\t\tisLinked,\n\t\tlinkedControlClassName,\n\t\tonLinkedChange,\n\t\tonSplitChange,\n\t\ttoggleLinked,\n\t\tlinkedValue,\n\t\tsize: computedSize,\n\t\tsplitValue,\n\t\twrapper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CxB,QAAQ,CAAEwB,cAAe,CAAC;IAC3B,CAAC,MAAM;MACNxB,QAAQ,CAAEqB,SAAU,CAAC;IACtB;EACD,CAAC;EAED,MAAMW,EAAE,GAAGrC,KAAK,CAAC,CAAC;EAClB,MAAMsC,OAAO,GAAGjD,OAAO,CAAE,MAAM;IAC9B,OAAOgD,EAAE,CAAE9C,MAAM,CAACgD,gBAAgB,EAAEpC,SAAU,CAAC;EAChD,CAAC,EAAE,CAAEkC,EAAE,EAAElC,SAAS,CAAG,CAAC;EAEtB,MAAMqC,sBAAsB,GAAGnD,OAAO,CAAE,MAAM;IAC7C,OAAOgD,EAAE,CAAE9C,MAAM,CAACkD,mBAAmB,CAAC,CAAE,CAAC;EAC1C,CAAC,EAAE,CAAEJ,EAAE,CAAG,CAAC;EAEX,MAAMK,gBAAgB,GAAGrD,OAAO,CAAE,MAAM;IACvC,OAAOgD,EAAE,CAAE9C,MAAM,CAACoD,OAAQ,CAAC;EAC5B,CAAC,EAAE,CAAEN,EAAE,CAAG,CAAC;EAEX,OAAO;IACN,GAAGzB,UAAU;IACbT,SAAS,EAAEmC,OAAO;IAClBlC,MAAM;IACNwC,YAAY,EAAE9B,YAAY,IAAI,CAAEI,aAAa;IAC7CZ,WAAW;IACXC,WAAW;IACXZ,eAAe,EAAEmB,YAAY;IAC7BQ,QAAQ;IACRkB,sBAAsB;IACtBf,cAAc;IACdU,aAAa;IACbX,YAAY;IACZR,WAAW;IACXR,IAAI,EAAEK,YAAY;IAClBI,UAAU;IACVyB,gBAAgB;IAChBhC;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useState","styles","getBorderDiff","getCommonBorder","getSplitBorders","hasMixedBorders","hasSplitBorders","isCompleteBorder","isEmptyBorder","useContextSystem","useCx","maybeWarnDeprecated36pxSize","useBorderBoxControl","props","className","colors","onChange","enableAlpha","enableStyle","size","value","__experimentalIsRenderedInSidebar","__next40pxDefaultSize","otherProps","componentName","computedSize","mixedBorders","splitBorders","linkedValue","splitValue","hasWidthValue","isNaN","parseFloat","width","isLinked","setIsLinked","toggleLinked","onLinkedChange","newBorder","undefined","changes","updatedBorders","top","right","bottom","left","filteredResult","onSplitChange","side","cx","classes","borderBoxControl","linkedControlClassName","linkedBorderControl","wrapperClassName","wrapper","disableUnits"],"sources":["@wordpress/components/src/border-box-control/border-box-control/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport {\n\tgetBorderDiff,\n\tgetCommonBorder,\n\tgetSplitBorders,\n\thasMixedBorders,\n\thasSplitBorders,\n\tisCompleteBorder,\n\tisEmptyBorder,\n} from '../utils';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';\n\nimport type { Border } from '../../border-control/types';\nimport type { Borders, BorderSide, BorderBoxControlProps } from '../types';\n\nexport function useBorderBoxControl(\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tcolors = [],\n\t\tonChange,\n\t\tenableAlpha = false,\n\t\tenableStyle = true,\n\t\tsize = 'default',\n\t\tvalue,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\t__next40pxDefaultSize,\n\t\t...otherProps\n\t} = useContextSystem( props, 'BorderBoxControl' );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'BorderBoxControl',\n\t\t__next40pxDefaultSize,\n\t\tsize,\n\t} );\n\n\tconst computedSize =\n\t\tsize === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;\n\n\tconst mixedBorders = hasMixedBorders( value );\n\tconst splitBorders = hasSplitBorders( value );\n\n\tconst linkedValue = splitBorders\n\t\t? getCommonBorder( value as Borders | undefined )\n\t\t: ( value as Border );\n\n\tconst splitValue = splitBorders\n\t\t? ( value as Borders )\n\t\t: getSplitBorders( value as Border | undefined );\n\n\t// If no numeric width value is set, the unit select will be disabled.\n\tconst hasWidthValue = ! isNaN( parseFloat( `${ linkedValue?.width }` ) );\n\n\tconst [ isLinked, setIsLinked ] = useState( ! mixedBorders );\n\tconst toggleLinked = () => setIsLinked( ! isLinked );\n\n\tconst onLinkedChange = ( newBorder?: Border ) => {\n\t\tif ( ! newBorder ) {\n\t\t\treturn onChange( undefined );\n\t\t}\n\n\t\t// If we have all props defined on the new border apply it.\n\t\tif ( ! mixedBorders || isCompleteBorder( newBorder ) ) {\n\t\t\treturn onChange(\n\t\t\t\tisEmptyBorder( newBorder ) ? undefined : newBorder\n\t\t\t);\n\t\t}\n\n\t\t// If we had mixed borders we might have had some shared border props\n\t\t// that we need to maintain. For example; we could have mixed borders\n\t\t// with all the same color but different widths. Then from the linked\n\t\t// control we change the color. We should keep the separate widths.\n\t\tconst changes = getBorderDiff(\n\t\t\tlinkedValue as Border,\n\t\t\tnewBorder as Border\n\t\t);\n\t\tconst updatedBorders = {\n\t\t\ttop: { ...( value as Borders )?.top, ...changes },\n\t\t\tright: { ...( value as Borders )?.right, ...changes },\n\t\t\tbottom: { ...( value as Borders )?.bottom, ...changes },\n\t\t\tleft: { ...( value as Borders )?.left, ...changes },\n\t\t};\n\n\t\tif ( hasMixedBorders( updatedBorders ) ) {\n\t\t\treturn onChange( updatedBorders );\n\t\t}\n\n\t\tconst filteredResult = isEmptyBorder( updatedBorders.top )\n\t\t\t? undefined\n\t\t\t: updatedBorders.top;\n\n\t\tonChange( filteredResult );\n\t};\n\n\tconst onSplitChange = (\n\t\tnewBorder: Border | undefined,\n\t\tside: BorderSide\n\t) => {\n\t\tconst updatedBorders = { ...splitValue, [ side ]: newBorder };\n\n\t\tif ( hasMixedBorders( updatedBorders ) ) {\n\t\t\tonChange( updatedBorders );\n\t\t} else {\n\t\t\tonChange( newBorder );\n\t\t}\n\t};\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\treturn cx( styles.borderBoxControl, className );\n\t}, [ cx, className ] );\n\n\tconst linkedControlClassName = useMemo( () => {\n\t\treturn cx( styles.linkedBorderControl() );\n\t}, [ cx ] );\n\n\tconst wrapperClassName = useMemo( () => {\n\t\treturn cx( styles.wrapper );\n\t}, [ cx ] );\n\n\treturn {\n\t\t...otherProps,\n\t\tclassName: classes,\n\t\tcolors,\n\t\tdisableUnits: mixedBorders && ! hasWidthValue,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thasMixedBorders: mixedBorders,\n\t\tisLinked,\n\t\tlinkedControlClassName,\n\t\tonLinkedChange,\n\t\tonSplitChange,\n\t\ttoggleLinked,\n\t\tlinkedValue,\n\t\tsize: computedSize,\n\t\tsplitValue,\n\t\twrapperClassName,\n\t\t__experimentalIsRenderedInSidebar,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AACnC,SACCC,aAAa,EACbC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,QACP,UAAU;AAEjB,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,QAAQ,0BAA0B;AAChD,SAASC,2BAA2B,QAAQ,kCAAkC;AAK9E,OAAO,SAASC,mBAAmBA,CAClCC,KAA8D,EAC7D;EACD,MAAM;IACLC,SAAS;IACTC,MAAM,GAAG,EAAE;IACXC,QAAQ;IACRC,WAAW,GAAG,KAAK;IACnBC,WAAW,GAAG,IAAI;IAClBC,IAAI,GAAG,SAAS;IAChBC,KAAK;IACLC,iCAAiC,GAAG,KAAK;IACzCC,qBAAqB;IACrB,GAAGC;EACJ,CAAC,GAAGd,gBAAgB,CAAEI,KAAK,EAAE,kBAAmB,CAAC;EAEjDF,2BAA2B,CAAE;IAC5Ba,aAAa,EAAE,kBAAkB;IACjCF,qBAAqB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AAC;EAEX,OAAO;IACN,GAAG1B,UAAU;IACbT,SAAS,EAAEoC,OAAO;IAClBnC,MAAM;IACNyC,YAAY,EAAE9B,YAAY,IAAI,CAAEI,aAAa;IAC7Cb,WAAW;IACXC,WAAW;IACXb,eAAe,EAAEqB,YAAY;IAC7BQ,QAAQ;IACRkB,sBAAsB;IACtBf,cAAc;IACdU,aAAa;IACbX,YAAY;IACZR,WAAW;IACXT,IAAI,EAAEM,YAAY;IAClBI,UAAU;IACVyB,gBAAgB;IAChBjC;EACD,CAAC;AACF","ignoreList":[]}
@@ -142,6 +142,7 @@ const UnconnectedBorderControl = (props, forwardedRef) => {
142
142
  *
143
143
  * return (
144
144
  * <BorderControl
145
+ * __next40pxDefaultSize
145
146
  * colors={ colors }
146
147
  * label={ __( 'Border' ) }
147
148
  * onChange={ onChange }
@@ -1 +1 @@
1
- {"version":3,"names":["__","BorderControlDropdown","UnitControl","RangeControl","HStack","StyledLabel","View","VisuallyHidden","contextConnect","useBorderControl","Spacer","jsx","_jsx","jsxs","_jsxs","BorderLabel","props","label","hideLabelFromVision","as","children","UnconnectedBorderControl","forwardedRef","__next40pxDefaultSize","colors","disableCustomColors","disableUnits","enableAlpha","enableStyle","innerWrapperClassName","inputWidth","isStyleSettable","onBorderChange","onSliderChange","onWidthChange","placeholder","__unstablePopoverProps","previousStyleSelection","showDropdownHeader","size","sliderClassName","value","border","widthUnit","widthValue","withSlider","__experimentalIsRenderedInSidebar","otherProps","ref","spacing","className","prefix","marginRight","marginBottom","onChange","min","width","__unstableInputWidth","__nextHasNoMarginBottom","initialPosition","max","step","includes","undefined","withInputField","BorderControl"],"sources":["@wordpress/components/src/border-control/border-control/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlDropdown from '../border-control-dropdown';\nimport UnitControl from '../../unit-control';\nimport RangeControl from '../../range-control';\nimport { HStack } from '../../h-stack';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderControl } from './hook';\n\nimport type { BorderControlProps, LabelProps } from '../types';\nimport { Spacer } from '../../spacer';\n\nconst BorderLabel = ( props: LabelProps ) => {\n\tconst { label, hideLabelFromVision } = props;\n\n\tif ( ! label ) {\n\t\treturn null;\n\t}\n\n\treturn hideLabelFromVision ? (\n\t\t<VisuallyHidden as=\"legend\">{ label }</VisuallyHidden>\n\t) : (\n\t\t<StyledLabel as=\"legend\">{ label }</StyledLabel>\n\t);\n};\n\nconst UnconnectedBorderControl = (\n\tprops: WordPressComponentProps< BorderControlProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tdisableUnits,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thideLabelFromVision,\n\t\tinnerWrapperClassName,\n\t\tinputWidth,\n\t\tisStyleSettable,\n\t\tlabel,\n\t\tonBorderChange,\n\t\tonSliderChange,\n\t\tonWidthChange,\n\t\tplaceholder,\n\t\t__unstablePopoverProps,\n\t\tpreviousStyleSelection,\n\t\tshowDropdownHeader,\n\t\tsize,\n\t\tsliderClassName,\n\t\tvalue: border,\n\t\twidthUnit,\n\t\twidthValue,\n\t\twithSlider,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t...otherProps\n\t} = useBorderControl( props );\n\n\treturn (\n\t\t<View as=\"fieldset\" { ...otherProps } ref={ forwardedRef }>\n\t\t\t<BorderLabel\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t\t<HStack spacing={ 4 } className={ innerWrapperClassName }>\n\t\t\t\t<UnitControl\n\t\t\t\t\tprefix={\n\t\t\t\t\t\t<Spacer marginRight={ 1 } marginBottom={ 0 }>\n\t\t\t\t\t\t\t<BorderControlDropdown\n\t\t\t\t\t\t\t\tborder={ border }\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\t__unstablePopoverProps={\n\t\t\t\t\t\t\t\t\t__unstablePopoverProps\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\t\t\tisStyleSettable={ isStyleSettable }\n\t\t\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\t\t\tpreviousStyleSelection={\n\t\t\t\t\t\t\t\t\tpreviousStyleSelection\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( 'Border width' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ onWidthChange }\n\t\t\t\t\tvalue={ border?.width || '' }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\t\t__unstableInputWidth={ inputWidth }\n\t\t\t\t\tsize={ size }\n\t\t\t\t/>\n\t\t\t\t{ withSlider && (\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Border width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName={ sliderClassName }\n\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tonChange={ onSliderChange }\n\t\t\t\t\t\tstep={ [ 'px', '%' ].includes( widthUnit ) ? 1 : 0.1 }\n\t\t\t\t\t\tvalue={ widthValue || undefined }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</View>\n\t);\n};\n\n/**\n * The `BorderControl` brings together internal sub-components which allow users to\n * set the various properties of a border. The first sub-component, a\n * `BorderDropdown` contains options representing border color and style. The\n * border width is controlled via a `UnitControl` and an optional `RangeControl`.\n *\n * Border radius is not covered by this control as it may be desired separate to\n * color, style, and width. For example, the border radius may be absorbed under\n * a \"shape\" abstraction.\n *\n * ```jsx\n * import { BorderControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderControl = () => {\n * \tconst [ border, setBorder ] = useState();\n * \tconst onChange = ( newBorder ) => setBorder( newBorder );\n *\n * \treturn (\n * \t\t<BorderControl\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Border' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ border }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderControl = contextConnect(\n\tUnconnectedBorderControl,\n\t'BorderControl'\n);\n\nexport default BorderControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,WAAW,MAAM,oBAAoB;AAC5C,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,WAAW,QAAQ,+CAA+C;AAC3E,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,cAAc,QAAQ,uBAAuB;AAEtD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,gBA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ImB,SAAW;QACjCC,cAAc,EAAG,KAAO;QACxBzC,qBAAqB,EAAGA;MAAuB,CAC/C,CACD;IAAA,CACM,CAAC;EAAA,CACJ,CAAC;AAET,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM0C,aAAa,GAAGzD,cAAc,CAC1Ca,wBAAwB,EACxB,eACD,CAAC;AAED,eAAe4C,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["__","BorderControlDropdown","UnitControl","RangeControl","HStack","StyledLabel","View","VisuallyHidden","contextConnect","useBorderControl","Spacer","jsx","_jsx","jsxs","_jsxs","BorderLabel","props","label","hideLabelFromVision","as","children","UnconnectedBorderControl","forwardedRef","__next40pxDefaultSize","colors","disableCustomColors","disableUnits","enableAlpha","enableStyle","innerWrapperClassName","inputWidth","isStyleSettable","onBorderChange","onSliderChange","onWidthChange","placeholder","__unstablePopoverProps","previousStyleSelection","showDropdownHeader","size","sliderClassName","value","border","widthUnit","widthValue","withSlider","__experimentalIsRenderedInSidebar","otherProps","ref","spacing","className","prefix","marginRight","marginBottom","onChange","min","width","__unstableInputWidth","__nextHasNoMarginBottom","initialPosition","max","step","includes","undefined","withInputField","BorderControl"],"sources":["@wordpress/components/src/border-control/border-control/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlDropdown from '../border-control-dropdown';\nimport UnitControl from '../../unit-control';\nimport RangeControl from '../../range-control';\nimport { HStack } from '../../h-stack';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderControl } from './hook';\n\nimport type { BorderControlProps, LabelProps } from '../types';\nimport { Spacer } from '../../spacer';\n\nconst BorderLabel = ( props: LabelProps ) => {\n\tconst { label, hideLabelFromVision } = props;\n\n\tif ( ! label ) {\n\t\treturn null;\n\t}\n\n\treturn hideLabelFromVision ? (\n\t\t<VisuallyHidden as=\"legend\">{ label }</VisuallyHidden>\n\t) : (\n\t\t<StyledLabel as=\"legend\">{ label }</StyledLabel>\n\t);\n};\n\nconst UnconnectedBorderControl = (\n\tprops: WordPressComponentProps< BorderControlProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tdisableUnits,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thideLabelFromVision,\n\t\tinnerWrapperClassName,\n\t\tinputWidth,\n\t\tisStyleSettable,\n\t\tlabel,\n\t\tonBorderChange,\n\t\tonSliderChange,\n\t\tonWidthChange,\n\t\tplaceholder,\n\t\t__unstablePopoverProps,\n\t\tpreviousStyleSelection,\n\t\tshowDropdownHeader,\n\t\tsize,\n\t\tsliderClassName,\n\t\tvalue: border,\n\t\twidthUnit,\n\t\twidthValue,\n\t\twithSlider,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t...otherProps\n\t} = useBorderControl( props );\n\n\treturn (\n\t\t<View as=\"fieldset\" { ...otherProps } ref={ forwardedRef }>\n\t\t\t<BorderLabel\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t\t<HStack spacing={ 4 } className={ innerWrapperClassName }>\n\t\t\t\t<UnitControl\n\t\t\t\t\tprefix={\n\t\t\t\t\t\t<Spacer marginRight={ 1 } marginBottom={ 0 }>\n\t\t\t\t\t\t\t<BorderControlDropdown\n\t\t\t\t\t\t\t\tborder={ border }\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\t__unstablePopoverProps={\n\t\t\t\t\t\t\t\t\t__unstablePopoverProps\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\t\t\tisStyleSettable={ isStyleSettable }\n\t\t\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\t\t\tpreviousStyleSelection={\n\t\t\t\t\t\t\t\t\tpreviousStyleSelection\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( 'Border width' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ onWidthChange }\n\t\t\t\t\tvalue={ border?.width || '' }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\t\t__unstableInputWidth={ inputWidth }\n\t\t\t\t\tsize={ size }\n\t\t\t\t/>\n\t\t\t\t{ withSlider && (\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Border width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName={ sliderClassName }\n\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tonChange={ onSliderChange }\n\t\t\t\t\t\tstep={ [ 'px', '%' ].includes( widthUnit ) ? 1 : 0.1 }\n\t\t\t\t\t\tvalue={ widthValue || undefined }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</View>\n\t);\n};\n\n/**\n * The `BorderControl` brings together internal sub-components which allow users to\n * set the various properties of a border. The first sub-component, a\n * `BorderDropdown` contains options representing border color and style. The\n * border width is controlled via a `UnitControl` and an optional `RangeControl`.\n *\n * Border radius is not covered by this control as it may be desired separate to\n * color, style, and width. For example, the border radius may be absorbed under\n * a \"shape\" abstraction.\n *\n * ```jsx\n * import { BorderControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderControl = () => {\n * \tconst [ border, setBorder ] = useState();\n * \tconst onChange = ( newBorder ) => setBorder( newBorder );\n *\n * \treturn (\n * \t\t<BorderControl\n * \t\t\t__next40pxDefaultSize\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Border' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ border }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderControl = contextConnect(\n\tUnconnectedBorderControl,\n\t'BorderControl'\n);\n\nexport default BorderControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,WAAW,MAAM,oBAAoB;AAC5C,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,WAAW,QAAQ,+CAA+C;AAC3E,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,cAAc,QAAQ,uBAAuB;AAEtD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,gBAAgB,QAAQ,QAAQ;AAGzC,SAASC,MAAM,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;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C;AAET,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM0C,aAAa,GAAGzD,cAAc,CAC1Ca,wBAAwB,EACxB,eACD,CAAC;AAED,eAAe4C,aAAa","ignoreList":[]}
@@ -10,6 +10,8 @@ import * as styles from '../styles';
10
10
  import { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';
11
11
  import { useContextSystem } from '../../context';
12
12
  import { useCx } from '../../utils/hooks/use-cx';
13
+ import { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';
14
+
13
15
  // If either width or color are defined, the border is considered valid
14
16
  // and a border style can be set as well.
15
17
  const isValidBorder = border => {
@@ -33,6 +35,11 @@ export function useBorderControl(props) {
33
35
  __next40pxDefaultSize,
34
36
  ...otherProps
35
37
  } = useContextSystem(props, 'BorderControl');
38
+ maybeWarnDeprecated36pxSize({
39
+ componentName: 'BorderControl',
40
+ __next40pxDefaultSize,
41
+ size
42
+ });
36
43
  const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;
37
44
  const [widthValue, originalWidthUnit] = parseQuantityAndUnitFromRawValue(border?.width);
38
45
  const widthUnit = originalWidthUnit || 'px';
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useMemo","useState","styles","parseQuantityAndUnitFromRawValue","useContextSystem","useCx","isValidBorder","border","hasWidth","width","undefined","hasColor","color","useBorderControl","props","className","colors","isCompact","onChange","enableAlpha","enableStyle","shouldSanitizeBorder","size","value","__experimentalIsRenderedInSidebar","__next40pxDefaultSize","otherProps","computedSize","widthValue","originalWidthUnit","widthUnit","hadPreviousZeroWidth","colorSelection","setColorSelection","styleSelection","setStyleSelection","isStyleSettable","onBorderChange","newBorder","onWidthChange","newWidth","newWidthValue","parsedValue","hasZeroWidth","updatedBorder","style","onSliderChange","cx","classes","borderControl","wrapperWidth","innerWrapperClassName","widthStyle","heightStyle","wrapperHeight","innerWrapper","sliderClassName","borderSlider","inputWidth","previousStyleSelection"],"sources":["@wordpress/components/src/border-control/border-control/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\n\nimport type { Border, BorderControlProps } from '../types';\n\n// If either width or color are defined, the border is considered valid\n// and a border style can be set as well.\nconst isValidBorder = ( border?: Border ) => {\n\tconst hasWidth = border?.width !== undefined && border.width !== '';\n\tconst hasColor = border?.color !== undefined;\n\treturn hasWidth || hasColor;\n};\n\nexport function useBorderControl(\n\tprops: WordPressComponentProps< BorderControlProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tcolors = [],\n\t\tisCompact,\n\t\tonChange,\n\t\tenableAlpha = true,\n\t\tenableStyle = true,\n\t\tshouldSanitizeBorder = true,\n\t\tsize = 'default',\n\t\tvalue: border,\n\t\twidth,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\t__next40pxDefaultSize,\n\t\t...otherProps\n\t} = useContextSystem( props, 'BorderControl' );\n\n\tconst computedSize =\n\t\tsize === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;\n\n\tconst [ widthValue, originalWidthUnit ] = parseQuantityAndUnitFromRawValue(\n\t\tborder?.width\n\t);\n\tconst widthUnit = originalWidthUnit || 'px';\n\tconst hadPreviousZeroWidth = widthValue === 0;\n\n\tconst [ colorSelection, setColorSelection ] = useState< string >();\n\tconst [ styleSelection, setStyleSelection ] = useState< string >();\n\n\tconst isStyleSettable = shouldSanitizeBorder\n\t\t? isValidBorder( border )\n\t\t: true;\n\n\tconst onBorderChange = useCallback(\n\t\t( newBorder?: Border ) => {\n\t\t\tif ( shouldSanitizeBorder && ! isValidBorder( newBorder ) ) {\n\t\t\t\tonChange( undefined );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonChange( newBorder );\n\t\t},\n\t\t[ onChange, shouldSanitizeBorder ]\n\t);\n\n\tconst onWidthChange = useCallback(\n\t\t( newWidth?: string ) => {\n\t\t\tconst newWidthValue = newWidth === '' ? undefined : newWidth;\n\t\t\tconst [ parsedValue ] =\n\t\t\t\tparseQuantityAndUnitFromRawValue( newWidth );\n\t\t\tconst hasZeroWidth = parsedValue === 0;\n\t\t\tconst updatedBorder = { ...border, width: newWidthValue };\n\n\t\t\t// Setting the border width explicitly to zero will also set the\n\t\t\t// border style to `none` and clear the border color.\n\t\t\tif ( hasZeroWidth && ! hadPreviousZeroWidth ) {\n\t\t\t\t// Before clearing the color and style selections, keep track of\n\t\t\t\t// the current selections so they can be restored when the width\n\t\t\t\t// changes to a non-zero value.\n\t\t\t\tsetColorSelection( border?.color );\n\t\t\t\tsetStyleSelection( border?.style );\n\n\t\t\t\t// Clear the color and style border properties.\n\t\t\t\tupdatedBorder.color = undefined;\n\t\t\t\tupdatedBorder.style = 'none';\n\t\t\t}\n\n\t\t\t// Selection has changed from zero border width to non-zero width.\n\t\t\tif ( ! hasZeroWidth && hadPreviousZeroWidth ) {\n\t\t\t\t// Restore previous border color and style selections if width\n\t\t\t\t// is now not zero.\n\t\t\t\tif ( updatedBorder.color === undefined ) {\n\t\t\t\t\tupdatedBorder.color = colorSelection;\n\t\t\t\t}\n\t\t\t\tif ( updatedBorder.style === 'none' ) {\n\t\t\t\t\tupdatedBorder.style = styleSelection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tonBorderChange( updatedBorder );\n\t\t},\n\t\t[\n\t\t\tborder,\n\t\t\thadPreviousZeroWidth,\n\t\t\tcolorSelection,\n\t\t\tstyleSelection,\n\t\t\tonBorderChange,\n\t\t]\n\t);\n\n\tconst onSliderChange = useCallback(\n\t\t( value?: number ) => {\n\t\t\tonWidthChange( `${ value }${ widthUnit }` );\n\t\t},\n\t\t[ onWidthChange, widthUnit ]\n\t);\n\n\t// Generate class names.\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\treturn cx( styles.borderControl, className );\n\t}, [ className, cx ] );\n\n\tlet wrapperWidth = width;\n\tif ( isCompact ) {\n\t\t// Widths below represent the minimum usable width for compact controls.\n\t\t// Taller controls contain greater internal padding, thus greater width.\n\t\twrapperWidth = size === '__unstable-large' ? '116px' : '90px';\n\t}\n\tconst innerWrapperClassName = useMemo( () => {\n\t\tconst widthStyle = !! wrapperWidth && styles.wrapperWidth;\n\t\tconst heightStyle = styles.wrapperHeight( computedSize );\n\n\t\treturn cx( styles.innerWrapper(), widthStyle, heightStyle );\n\t}, [ wrapperWidth, cx, computedSize ] );\n\n\tconst sliderClassName = useMemo( () => {\n\t\treturn cx( styles.borderSlider() );\n\t}, [ cx ] );\n\n\treturn {\n\t\t...otherProps,\n\t\tclassName: classes,\n\t\tcolors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tinnerWrapperClassName,\n\t\tinputWidth: wrapperWidth,\n\t\tisStyleSettable,\n\t\tonBorderChange,\n\t\tonSliderChange,\n\t\tonWidthChange,\n\t\tpreviousStyleSelection: styleSelection,\n\t\tsliderClassName,\n\t\tvalue: border,\n\t\twidthUnit,\n\t\twidthValue,\n\t\tsize: computedSize,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next40pxDefaultSize,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEnE;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AACnC,SAASC,gCAAgC,QAAQ,0BAA0B;AAE3E,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,QAAQ,0BAA0B;AAIhD;AACA;AACA,MAAMC,aAAa,GAAKC,MAAe,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;IACVN,IAAI,EAAEK,YAAY;IAClBH,iCAAiC;IACjCC;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useMemo","useState","styles","parseQuantityAndUnitFromRawValue","useContextSystem","useCx","maybeWarnDeprecated36pxSize","isValidBorder","border","hasWidth","width","undefined","hasColor","color","useBorderControl","props","className","colors","isCompact","onChange","enableAlpha","enableStyle","shouldSanitizeBorder","size","value","__experimentalIsRenderedInSidebar","__next40pxDefaultSize","otherProps","componentName","computedSize","widthValue","originalWidthUnit","widthUnit","hadPreviousZeroWidth","colorSelection","setColorSelection","styleSelection","setStyleSelection","isStyleSettable","onBorderChange","newBorder","onWidthChange","newWidth","newWidthValue","parsedValue","hasZeroWidth","updatedBorder","style","onSliderChange","cx","classes","borderControl","wrapperWidth","innerWrapperClassName","widthStyle","heightStyle","wrapperHeight","innerWrapper","sliderClassName","borderSlider","inputWidth","previousStyleSelection"],"sources":["@wordpress/components/src/border-control/border-control/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { Border, BorderControlProps } from '../types';\nimport { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';\n\n// If either width or color are defined, the border is considered valid\n// and a border style can be set as well.\nconst isValidBorder = ( border?: Border ) => {\n\tconst hasWidth = border?.width !== undefined && border.width !== '';\n\tconst hasColor = border?.color !== undefined;\n\treturn hasWidth || hasColor;\n};\n\nexport function useBorderControl(\n\tprops: WordPressComponentProps< BorderControlProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tcolors = [],\n\t\tisCompact,\n\t\tonChange,\n\t\tenableAlpha = true,\n\t\tenableStyle = true,\n\t\tshouldSanitizeBorder = true,\n\t\tsize = 'default',\n\t\tvalue: border,\n\t\twidth,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\t__next40pxDefaultSize,\n\t\t...otherProps\n\t} = useContextSystem( props, 'BorderControl' );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'BorderControl',\n\t\t__next40pxDefaultSize,\n\t\tsize,\n\t} );\n\n\tconst computedSize =\n\t\tsize === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;\n\n\tconst [ widthValue, originalWidthUnit ] = parseQuantityAndUnitFromRawValue(\n\t\tborder?.width\n\t);\n\tconst widthUnit = originalWidthUnit || 'px';\n\tconst hadPreviousZeroWidth = widthValue === 0;\n\n\tconst [ colorSelection, setColorSelection ] = useState< string >();\n\tconst [ styleSelection, setStyleSelection ] = useState< string >();\n\n\tconst isStyleSettable = shouldSanitizeBorder\n\t\t? isValidBorder( border )\n\t\t: true;\n\n\tconst onBorderChange = useCallback(\n\t\t( newBorder?: Border ) => {\n\t\t\tif ( shouldSanitizeBorder && ! isValidBorder( newBorder ) ) {\n\t\t\t\tonChange( undefined );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonChange( newBorder );\n\t\t},\n\t\t[ onChange, shouldSanitizeBorder ]\n\t);\n\n\tconst onWidthChange = useCallback(\n\t\t( newWidth?: string ) => {\n\t\t\tconst newWidthValue = newWidth === '' ? undefined : newWidth;\n\t\t\tconst [ parsedValue ] =\n\t\t\t\tparseQuantityAndUnitFromRawValue( newWidth );\n\t\t\tconst hasZeroWidth = parsedValue === 0;\n\t\t\tconst updatedBorder = { ...border, width: newWidthValue };\n\n\t\t\t// Setting the border width explicitly to zero will also set the\n\t\t\t// border style to `none` and clear the border color.\n\t\t\tif ( hasZeroWidth && ! hadPreviousZeroWidth ) {\n\t\t\t\t// Before clearing the color and style selections, keep track of\n\t\t\t\t// the current selections so they can be restored when the width\n\t\t\t\t// changes to a non-zero value.\n\t\t\t\tsetColorSelection( border?.color );\n\t\t\t\tsetStyleSelection( border?.style );\n\n\t\t\t\t// Clear the color and style border properties.\n\t\t\t\tupdatedBorder.color = undefined;\n\t\t\t\tupdatedBorder.style = 'none';\n\t\t\t}\n\n\t\t\t// Selection has changed from zero border width to non-zero width.\n\t\t\tif ( ! hasZeroWidth && hadPreviousZeroWidth ) {\n\t\t\t\t// Restore previous border color and style selections if width\n\t\t\t\t// is now not zero.\n\t\t\t\tif ( updatedBorder.color === undefined ) {\n\t\t\t\t\tupdatedBorder.color = colorSelection;\n\t\t\t\t}\n\t\t\t\tif ( updatedBorder.style === 'none' ) {\n\t\t\t\t\tupdatedBorder.style = styleSelection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tonBorderChange( updatedBorder );\n\t\t},\n\t\t[\n\t\t\tborder,\n\t\t\thadPreviousZeroWidth,\n\t\t\tcolorSelection,\n\t\t\tstyleSelection,\n\t\t\tonBorderChange,\n\t\t]\n\t);\n\n\tconst onSliderChange = useCallback(\n\t\t( value?: number ) => {\n\t\t\tonWidthChange( `${ value }${ widthUnit }` );\n\t\t},\n\t\t[ onWidthChange, widthUnit ]\n\t);\n\n\t// Generate class names.\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\treturn cx( styles.borderControl, className );\n\t}, [ className, cx ] );\n\n\tlet wrapperWidth = width;\n\tif ( isCompact ) {\n\t\t// Widths below represent the minimum usable width for compact controls.\n\t\t// Taller controls contain greater internal padding, thus greater width.\n\t\twrapperWidth = size === '__unstable-large' ? '116px' : '90px';\n\t}\n\tconst innerWrapperClassName = useMemo( () => {\n\t\tconst widthStyle = !! wrapperWidth && styles.wrapperWidth;\n\t\tconst heightStyle = styles.wrapperHeight( computedSize );\n\n\t\treturn cx( styles.innerWrapper(), widthStyle, heightStyle );\n\t}, [ wrapperWidth, cx, computedSize ] );\n\n\tconst sliderClassName = useMemo( () => {\n\t\treturn cx( styles.borderSlider() );\n\t}, [ cx ] );\n\n\treturn {\n\t\t...otherProps,\n\t\tclassName: classes,\n\t\tcolors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tinnerWrapperClassName,\n\t\tinputWidth: wrapperWidth,\n\t\tisStyleSettable,\n\t\tonBorderChange,\n\t\tonSliderChange,\n\t\tonWidthChange,\n\t\tpreviousStyleSelection: styleSelection,\n\t\tsliderClassName,\n\t\tvalue: border,\n\t\twidthUnit,\n\t\twidthValue,\n\t\tsize: computedSize,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next40pxDefaultSize,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEnE;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AACnC,SAASC,gCAAgC,QAAQ,0BAA0B;AAE3E,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,QAAQ,0BAA0B;AAEhD,SAASC,2BAA2B,QAAQ,kCAAkC;;AAE9E;AACA;AACA,MAAMC,aAAa,GAAKC,MAAe,IAAM;EAC5C,MAAMC,QAAQ,GAAGD,MAAM,EAAEE,KAAK,KAAKC,SAAS,IAAIH,MAAM,CAACE,KAAK,KAAK,EAAE;EACnE,MAAME,QAAQ,GAAGJ,MAAM,EAAEK,KAAK,KAAKF,SAAS;EAC5C,OAAOF,QAAQ,IAAIG,QAAQ;AAC5B,CAAC;AAED,OAAO,SAASE,gBAAgBA,CAC/BC,KAA2D,EAC1D;EACD,MAAM;IACLC,SAAS;IACTC,MAAM,GAAG,EAAE;IACXC,SAAS;IACTC,QAAQ;IACRC,WAAW,GAAG,IAAI;IAClBC,WAAW,GAAG,IAAI;IAClBC,oBAAoB,GAAG,IAAI;IAC3BC,IAAI,GAAG,SAAS;IAChBC,KAAK,EAAEhB,MAAM;IACbE,KAAK;IACLe,iCAAiC,GAAG,KAAK;IACzCC,qBAAqB;IACrB,GAAGC;EACJ,CAAC,GAAGvB,gBAAgB,CAAEW,KAAK,EAAE,eAAgB,CAAC;EAE9CT,2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CAAC,CAAEF,YAAY,IAAIlD,MAAM,CAACkD,YAAY;IACzD,MAAMG,WAAW,GAAGrD,MAAM,CAACsD,aAAa,CAAE3B,YAAa,CAAC;IAExD,OAAOoB,EAAE,CAAE/C,MAAM,CAACuD,YAAY,CAAC,CAAC,EAAEH,UAAU,EAAEC,WAAY,CAAC;EAC5D,CAAC,EAAE,CAAEH,YAAY,EAAEH,EAAE,EAAEpB,YAAY,CAAG,CAAC;EAEvC,MAAM6B,eAAe,GAAG1D,OAAO,CAAE,MAAM;IACtC,OAAOiD,EAAE,CAAE/C,MAAM,CAACyD,YAAY,CAAC,CAAE,CAAC;EACnC,CAAC,EAAE,CAAEV,EAAE,CAAG,CAAC;EAEX,OAAO;IACN,GAAGtB,UAAU;IACbX,SAAS,EAAEkC,OAAO;IAClBjC,MAAM;IACNG,WAAW;IACXC,WAAW;IACXgC,qBAAqB;IACrBO,UAAU,EAAER,YAAY;IACxBd,eAAe;IACfC,cAAc;IACdS,cAAc;IACdP,aAAa;IACboB,sBAAsB,EAAEzB,cAAc;IACtCsB,eAAe;IACflC,KAAK,EAAEhB,MAAM;IACbwB,SAAS;IACTF,UAAU;IACVP,IAAI,EAAEM,YAAY;IAClBJ,iCAAiC;IACjCC;EACD,CAAC;AACF","ignoreList":[]}
@@ -50,30 +50,30 @@ const getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {
50
50
  if (colorObject) {
51
51
  const ariaLabelValue = getAriaLabelColorValue(colorObject.color);
52
52
  return style ? sprintf(
53
- // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:". %3$s: The current border style selection e.g. "solid".
54
- 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".', colorObject.name, ariaLabelValue, style) : sprintf(
55
- // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:".
56
- 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, ariaLabelValue);
53
+ // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g.: "#f00:". 3: The current border style selection e.g. "solid".
54
+ __('Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".'), colorObject.name, ariaLabelValue, style) : sprintf(
55
+ // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g.: "#f00:".
56
+ __('Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), colorObject.name, ariaLabelValue);
57
57
  }
58
58
  if (colorValue) {
59
59
  const ariaLabelValue = getAriaLabelColorValue(colorValue);
60
60
  return style ? sprintf(
61
- // translators: %1$s: The color's hex code e.g.: "#f00:". %2$s: The current border style selection e.g. "solid".
62
- 'Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".', ariaLabelValue, style) : sprintf(
63
- // translators: %1$s: The color's hex code e.g: "#f00".
64
- 'Border color and style picker. The currently selected color has a value of "%1$s".', ariaLabelValue);
61
+ // translators: 1: The color's hex code e.g.: "#f00:". 2: The current border style selection e.g. "solid".
62
+ __('Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".'), ariaLabelValue, style) : sprintf(
63
+ // translators: %s: The color's hex code e.g: "#f00".
64
+ __('Border color and style picker. The currently selected color has a value of "%s".'), ariaLabelValue);
65
65
  }
66
66
  return __('Border color and style picker.');
67
67
  }
68
68
  if (colorObject) {
69
69
  return sprintf(
70
- // translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g: "#f00".
71
- 'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, getAriaLabelColorValue(colorObject.color));
70
+ // translators: 1: The name of the color e.g. "vivid red". 2: The color's hex code e.g: "#f00".
71
+ __('Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), colorObject.name, getAriaLabelColorValue(colorObject.color));
72
72
  }
73
73
  if (colorValue) {
74
74
  return sprintf(
75
- // translators: %1$s: The color's hex code e.g: "#f00".
76
- 'Border color picker. The currently selected color has a value of "%1$s".', getAriaLabelColorValue(colorValue));
75
+ // translators: %s: The color's hex code e.g: "#f00".
76
+ __('Border color picker. The currently selected color has a value of "%s".'), getAriaLabelColorValue(colorValue));
77
77
  }
78
78
  return __('Border color picker.');
79
79
  };
@@ -115,7 +115,7 @@ const BorderControlDropdown = (props, forwardedRef) => {
115
115
  tooltipPosition: dropdownPosition,
116
116
  label: __('Border color and style picker'),
117
117
  showTooltip: true,
118
- __next40pxDefaultSize: size === '__unstable-large' ? true : false,
118
+ __next40pxDefaultSize: size === '__unstable-large',
119
119
  children: /*#__PURE__*/_jsx("span", {
120
120
  className: indicatorWrapperClassName,
121
121
  children: /*#__PURE__*/_jsx(ColorIndicator, {
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","BorderControlStylePicker","Button","ColorIndicator","ColorPalette","Dropdown","VStack","contextConnect","useBorderControlDropdown","DropdownContentWrapper","isMultiplePaletteArray","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getAriaLabelColorValue","colorValue","replace","getColorObject","colors","matchedColor","some","origin","color","find","getToggleAriaLabel","colorObject","style","isStyleEnabled","ariaLabelValue","name","BorderControlDropdown","props","forwardedRef","__experimentalIsRenderedInSidebar","border","disableCustomColors","enableAlpha","enableStyle","indicatorClassName","indicatorWrapperClassName","isStyleSettable","onReset","onColorChange","onStyleChange","popoverContentClassName","popoverControlsClassName","resetButtonClassName","size","__unstablePopoverProps","otherProps","toggleAriaLabel","showResetButton","dropdownPosition","undefined","renderToggle","onToggle","onClick","variant","tooltipPosition","label","showTooltip","__next40pxDefaultSize","children","className","renderContent","onClose","paddingSize","spacing","value","onChange","clearable","popoverProps","ref","ConnectedBorderControlDropdown"],"sources":["@wordpress/components/src/border-control/border-control-dropdown/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nimport type { ColorObject } from '../../color-palette/types';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport type { DropdownProps as DropdownComponentProps } from '../../dropdown/types';\nimport type { ColorProps, DropdownProps } from '../types';\n\nconst getAriaLabelColorValue = ( colorValue: string ) => {\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\treturn colorValue.replace( /^var\\((.+)\\)$/, '$1' );\n};\n\nconst getColorObject = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolors: ColorProps[ 'colors' ] | undefined\n) => {\n\tif ( ! colorValue || ! colors ) {\n\t\treturn;\n\t}\n\n\tif ( isMultiplePaletteArray( colors ) ) {\n\t\t// Multiple origins\n\t\tlet matchedColor;\n\n\t\tcolors.some( ( origin ) =>\n\t\t\torigin.colors.some( ( color ) => {\n\t\t\t\tif ( color.color === colorValue ) {\n\t\t\t\t\tmatchedColor = color;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t} )\n\t\t);\n\n\t\treturn matchedColor;\n\t}\n\n\t// Single origin\n\treturn colors.find( ( color ) => color.color === colorValue );\n};\n\nconst getToggleAriaLabel = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolorObject: ColorObject | undefined,\n\tstyle: CSSProperties[ 'borderStyle' ],\n\tisStyleEnabled: boolean\n) => {\n\tif ( isStyleEnabled ) {\n\t\tif ( colorObject ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorObject.color );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\". %3$s: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".',\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".',\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\tif ( colorValue ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorValue );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\". %2$s: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".',\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %1$s: The color's hex code e.g: \"#f00\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\".',\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\treturn __( 'Border color and style picker.' );\n\t}\n\n\tif ( colorObject ) {\n\t\treturn sprintf(\n\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g: \"#f00\".\n\t\t\t'Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".',\n\t\t\tcolorObject.name,\n\t\t\tgetAriaLabelColorValue( colorObject.color )\n\t\t);\n\t}\n\n\tif ( colorValue ) {\n\t\treturn sprintf(\n\t\t\t// translators: %1$s: The color's hex code e.g: \"#f00\".\n\t\t\t'Border color picker. The currently selected color has a value of \"%1$s\".',\n\t\t\tgetAriaLabelColorValue( colorValue )\n\t\t);\n\t}\n\n\treturn __( 'Border color picker.' );\n};\n\nconst BorderControlDropdown = (\n\tprops: WordPressComponentProps< DropdownProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__experimentalIsRenderedInSidebar,\n\t\tborder,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tindicatorClassName,\n\t\tindicatorWrapperClassName,\n\t\tisStyleSettable,\n\t\tonReset,\n\t\tonColorChange,\n\t\tonStyleChange,\n\t\tpopoverContentClassName,\n\t\tpopoverControlsClassName,\n\t\tresetButtonClassName,\n\t\tsize,\n\t\t__unstablePopoverProps,\n\t\t...otherProps\n\t} = useBorderControlDropdown( props );\n\n\tconst { color, style } = border || {};\n\tconst colorObject = getColorObject( color, colors );\n\n\tconst toggleAriaLabel = getToggleAriaLabel(\n\t\tcolor,\n\t\tcolorObject,\n\t\tstyle,\n\t\tenableStyle\n\t);\n\n\tconst showResetButton = color || ( style && style !== 'none' );\n\tconst dropdownPosition = __experimentalIsRenderedInSidebar\n\t\t? 'bottom left'\n\t\t: undefined;\n\n\tconst renderToggle: DropdownComponentProps[ 'renderToggle' ] = ( {\n\t\tonToggle,\n\t} ) => (\n\t\t<Button\n\t\t\tonClick={ onToggle }\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ toggleAriaLabel }\n\t\t\ttooltipPosition={ dropdownPosition }\n\t\t\tlabel={ __( 'Border color and style picker' ) }\n\t\t\tshowTooltip\n\t\t\t__next40pxDefaultSize={ size === '__unstable-large' ? true : false }\n\t\t>\n\t\t\t<span className={ indicatorWrapperClassName }>\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tclassName={ indicatorClassName }\n\t\t\t\t\tcolorValue={ color }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</Button>\n\t);\n\n\tconst renderContent: DropdownComponentProps[ 'renderContent' ] = ( {\n\t\tonClose,\n\t} ) => (\n\t\t<>\n\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t<VStack className={ popoverControlsClassName } spacing={ 6 }>\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tclassName={ popoverContentClassName }\n\t\t\t\t\t\tvalue={ color }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t\t{ enableStyle && isStyleSettable && (\n\t\t\t\t\t\t<BorderControlStylePicker\n\t\t\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\t\tonChange={ onStyleChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</DropdownContentWrapper>\n\t\t\t{ showResetButton && (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ resetButtonClassName }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ renderToggle }\n\t\t\trenderContent={ renderContent }\n\t\t\tpopoverProps={ {\n\t\t\t\t...__unstablePopoverProps,\n\t\t\t} }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n};\n\nconst ConnectedBorderControlDropdown = contextConnect(\n\tBorderControlDropdown,\n\t'BorderControlDropdown'\n);\n\nexport default ConnectedBorderControlDropdown;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,wBAAwB,MAAM,gCAAgC;AACrE,OAAOC,MAAM,MAAM,cAAc;AACjC,OAAOC,cAAc,MAAM,uBAAuB;AAClD,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,OAAOC,QAAQ,MAAM,gBAAgB;AACrC,SAASC,MAAM,QAAQ,eAAe;AAEtC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,wBAAwB,QAAQ,QAAQ;AACjD,OAAOC,sBAAsB,MAAM,yCAAyC;AAG5E,SAASC,sBAAsB,QAAQ,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAInE,MAAMC,sBAAsB,GAAKC,UAAkB,IAAM;EACxD;EACA,OAAOA,UAAU,CAACC,OAAO,CAAE,eAAe,EAAE,IAAK,CAAC;AACnD,CAAC;AAED,MAAMC,cAAc,GAAGA,CACtBF,UAA0C,EAC1CG,MAA0C,KACtC;EACJ,IAAK,CAAEH,UAAU,IAAI,CAAEG,MAAM,EAAG;IAC/B;EACD;EAEA,IAAKX,sBAAsB,CAAEW,MAAO,CAAC,EAAG;IACvC;IACA,IAAIC,YAAY;IAEhBD,MAAM,CAACE,IAAI,CAAIC,MAAM,IACpBA,MAAM,CAACH,MAAM,CAACE,IAAI,CAAIE,KAAK,IAAM;MAChC,IAAKA,KAAK,CAACA,KAAK,KAAKP,UAAU,EAAG;QACjCI,YAAY,GAAGG,KAAK;QACpB,O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,MAAMyC,8BAA8B,GAAGrE,cAAc,CACpD0B,qBAAqB,EACrB,uBACD,CAAC;AAED,eAAe2C,8BAA8B","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","BorderControlStylePicker","Button","ColorIndicator","ColorPalette","Dropdown","VStack","contextConnect","useBorderControlDropdown","DropdownContentWrapper","isMultiplePaletteArray","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getAriaLabelColorValue","colorValue","replace","getColorObject","colors","matchedColor","some","origin","color","find","getToggleAriaLabel","colorObject","style","isStyleEnabled","ariaLabelValue","name","BorderControlDropdown","props","forwardedRef","__experimentalIsRenderedInSidebar","border","disableCustomColors","enableAlpha","enableStyle","indicatorClassName","indicatorWrapperClassName","isStyleSettable","onReset","onColorChange","onStyleChange","popoverContentClassName","popoverControlsClassName","resetButtonClassName","size","__unstablePopoverProps","otherProps","toggleAriaLabel","showResetButton","dropdownPosition","undefined","renderToggle","onToggle","onClick","variant","tooltipPosition","label","showTooltip","__next40pxDefaultSize","children","className","renderContent","onClose","paddingSize","spacing","value","onChange","clearable","popoverProps","ref","ConnectedBorderControlDropdown"],"sources":["@wordpress/components/src/border-control/border-control-dropdown/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { VStack } from '../../v-stack';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport { useBorderControlDropdown } from './hook';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nimport type { ColorObject } from '../../color-palette/types';\nimport { isMultiplePaletteArray } from '../../color-palette/utils';\nimport type { DropdownProps as DropdownComponentProps } from '../../dropdown/types';\nimport type { ColorProps, DropdownProps } from '../types';\n\nconst getAriaLabelColorValue = ( colorValue: string ) => {\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\treturn colorValue.replace( /^var\\((.+)\\)$/, '$1' );\n};\n\nconst getColorObject = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolors: ColorProps[ 'colors' ] | undefined\n) => {\n\tif ( ! colorValue || ! colors ) {\n\t\treturn;\n\t}\n\n\tif ( isMultiplePaletteArray( colors ) ) {\n\t\t// Multiple origins\n\t\tlet matchedColor;\n\n\t\tcolors.some( ( origin ) =>\n\t\t\torigin.colors.some( ( color ) => {\n\t\t\t\tif ( color.color === colorValue ) {\n\t\t\t\t\tmatchedColor = color;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t} )\n\t\t);\n\n\t\treturn matchedColor;\n\t}\n\n\t// Single origin\n\treturn colors.find( ( color ) => color.color === colorValue );\n};\n\nconst getToggleAriaLabel = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolorObject: ColorObject | undefined,\n\tstyle: CSSProperties[ 'borderStyle' ],\n\tisStyleEnabled: boolean\n) => {\n\tif ( isStyleEnabled ) {\n\t\tif ( colorObject ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorObject.color );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\". 3: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g.: \"#f00:\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\tif ( colorValue ) {\n\t\t\tconst ariaLabelValue = getAriaLabelColorValue( colorValue );\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: 1: The color's hex code e.g.: \"#f00:\". 2: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tariaLabelValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: The color's hex code e.g: \"#f00\".\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%s\".'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tariaLabelValue\n\t\t\t\t );\n\t\t}\n\n\t\treturn __( 'Border color and style picker.' );\n\t}\n\n\tif ( colorObject ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The name of the color e.g. \"vivid red\". 2: The color's hex code e.g: \"#f00\".\n\t\t\t__(\n\t\t\t\t'Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t),\n\t\t\tcolorObject.name,\n\t\t\tgetAriaLabelColorValue( colorObject.color )\n\t\t);\n\t}\n\n\tif ( colorValue ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The color's hex code e.g: \"#f00\".\n\t\t\t__(\n\t\t\t\t'Border color picker. The currently selected color has a value of \"%s\".'\n\t\t\t),\n\t\t\tgetAriaLabelColorValue( colorValue )\n\t\t);\n\t}\n\n\treturn __( 'Border color picker.' );\n};\n\nconst BorderControlDropdown = (\n\tprops: WordPressComponentProps< DropdownProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__experimentalIsRenderedInSidebar,\n\t\tborder,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tindicatorClassName,\n\t\tindicatorWrapperClassName,\n\t\tisStyleSettable,\n\t\tonReset,\n\t\tonColorChange,\n\t\tonStyleChange,\n\t\tpopoverContentClassName,\n\t\tpopoverControlsClassName,\n\t\tresetButtonClassName,\n\t\tsize,\n\t\t__unstablePopoverProps,\n\t\t...otherProps\n\t} = useBorderControlDropdown( props );\n\n\tconst { color, style } = border || {};\n\tconst colorObject = getColorObject( color, colors );\n\n\tconst toggleAriaLabel = getToggleAriaLabel(\n\t\tcolor,\n\t\tcolorObject,\n\t\tstyle,\n\t\tenableStyle\n\t);\n\n\tconst showResetButton = color || ( style && style !== 'none' );\n\tconst dropdownPosition = __experimentalIsRenderedInSidebar\n\t\t? 'bottom left'\n\t\t: undefined;\n\n\tconst renderToggle: DropdownComponentProps[ 'renderToggle' ] = ( {\n\t\tonToggle,\n\t} ) => (\n\t\t<Button\n\t\t\tonClick={ onToggle }\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ toggleAriaLabel }\n\t\t\ttooltipPosition={ dropdownPosition }\n\t\t\tlabel={ __( 'Border color and style picker' ) }\n\t\t\tshowTooltip\n\t\t\t__next40pxDefaultSize={ size === '__unstable-large' }\n\t\t>\n\t\t\t<span className={ indicatorWrapperClassName }>\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tclassName={ indicatorClassName }\n\t\t\t\t\tcolorValue={ color }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</Button>\n\t);\n\n\tconst renderContent: DropdownComponentProps[ 'renderContent' ] = ( {\n\t\tonClose,\n\t} ) => (\n\t\t<>\n\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t<VStack className={ popoverControlsClassName } spacing={ 6 }>\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tclassName={ popoverContentClassName }\n\t\t\t\t\t\tvalue={ color }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t\t{ enableStyle && isStyleSettable && (\n\t\t\t\t\t\t<BorderControlStylePicker\n\t\t\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\t\tonChange={ onStyleChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</DropdownContentWrapper>\n\t\t\t{ showResetButton && (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ resetButtonClassName }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ renderToggle }\n\t\t\trenderContent={ renderContent }\n\t\t\tpopoverProps={ {\n\t\t\t\t...__unstablePopoverProps,\n\t\t\t} }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n};\n\nconst ConnectedBorderControlDropdown = contextConnect(\n\tBorderControlDropdown,\n\t'BorderControlDropdown'\n);\n\nexport default ConnectedBorderContro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props, forwardedRef) {
171
171
  // Leave hex values as-is. Remove the `var()` wrapper from CSS vars.
172
172
  const displayValue = value?.replace(/^var\((.+)\)$/, '$1');
173
173
  const customColorAccessibleLabel = !!displayValue ? sprintf(
174
- // translators: %1$s: The name of the color e.g: "vivid red". %2$s: The color's hex code e.g: "#f00".
174
+ // translators: 1: The name of the color e.g: "vivid red". 2: The color's hex code e.g: "#f00".
175
175
  __('Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), buttonLabelName, displayValue) : __('Custom color picker.');
176
176
  const paletteCommonProps = {
177
177
  clearColor,