@wordpress/components 27.4.0 → 27.6.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 (1287) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/build/alignment-matrix-control/icon.js +2 -2
  3. package/build/alignment-matrix-control/icon.js.map +1 -1
  4. package/build/alignment-matrix-control/index.js +5 -3
  5. package/build/alignment-matrix-control/index.js.map +1 -1
  6. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -8
  7. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  8. package/build/alignment-matrix-control/utils.js +6 -2
  9. package/build/alignment-matrix-control/utils.js.map +1 -1
  10. package/build/angle-picker-control/index.js +2 -2
  11. package/build/angle-picker-control/index.js.map +1 -1
  12. package/build/animate/index.js +4 -4
  13. package/build/animate/index.js.map +1 -1
  14. package/build/autocomplete/autocompleter-ui.js +5 -3
  15. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  16. package/build/autocomplete/index.js +21 -7
  17. package/build/autocomplete/index.js.map +1 -1
  18. package/build/base-control/hooks.js +1 -4
  19. package/build/base-control/hooks.js.map +1 -1
  20. package/build/base-control/index.js +2 -2
  21. package/build/base-control/index.js.map +1 -1
  22. package/build/base-control/types.js.map +1 -1
  23. package/build/border-control/types.js.map +1 -1
  24. package/build/button/index.js +2 -2
  25. package/build/button/index.js.map +1 -1
  26. package/build/button-group/index.js +2 -2
  27. package/build/button-group/index.js.map +1 -1
  28. package/build/checkbox-control/index.js +11 -4
  29. package/build/checkbox-control/index.js.map +1 -1
  30. package/build/circular-option-picker/circular-option-picker-actions.js +3 -3
  31. package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  32. package/build/circular-option-picker/circular-option-picker-option-group.js +2 -2
  33. package/build/circular-option-picker/circular-option-picker-option-group.js.map +1 -1
  34. package/build/circular-option-picker/circular-option-picker-option.js +2 -2
  35. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  36. package/build/circular-option-picker/circular-option-picker.js +2 -2
  37. package/build/circular-option-picker/circular-option-picker.js.map +1 -1
  38. package/build/clipboard-button/index.js +2 -2
  39. package/build/clipboard-button/index.js.map +1 -1
  40. package/build/color-indicator/index.js +2 -2
  41. package/build/color-indicator/index.js.map +1 -1
  42. package/build/color-palette/index.js +2 -2
  43. package/build/color-palette/index.js.map +1 -1
  44. package/build/color-picker/hex-input.js +3 -1
  45. package/build/color-picker/hex-input.js.map +1 -1
  46. package/build/color-picker/hue-picker.native.js +6 -2
  47. package/build/color-picker/hue-picker.native.js.map +1 -1
  48. package/build/color-picker/index.native.js +9 -3
  49. package/build/color-picker/index.native.js.map +1 -1
  50. package/build/color-picker/saturation-picker.native.js +6 -2
  51. package/build/color-picker/saturation-picker.native.js.map +1 -1
  52. package/build/color-picker/use-deprecated-props.js +9 -3
  53. package/build/color-picker/use-deprecated-props.js.map +1 -1
  54. package/build/combobox-control/index.js +7 -2
  55. package/build/combobox-control/index.js.map +1 -1
  56. package/build/combobox-control/types.js.map +1 -1
  57. package/build/context/context-connect.js +6 -2
  58. package/build/context/context-connect.js.map +1 -1
  59. package/build/custom-gradient-picker/gradient-bar/control-points.js +3 -3
  60. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  61. package/build/custom-gradient-picker/gradient-bar/index.js +2 -2
  62. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  63. package/build/custom-gradient-picker/index.js.map +1 -1
  64. package/build/custom-select-control/index.js +3 -3
  65. package/build/custom-select-control/index.js.map +1 -1
  66. package/build/custom-select-control-v2/legacy-component/index.js +3 -1
  67. package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
  68. package/build/dimension-control/index.js +2 -2
  69. package/build/dimension-control/index.js.map +1 -1
  70. package/build/drop-zone/index.js +74 -66
  71. package/build/drop-zone/index.js.map +1 -1
  72. package/build/dropdown/index.js +2 -2
  73. package/build/dropdown/index.js.map +1 -1
  74. package/build/dropdown/styles.js +5 -3
  75. package/build/dropdown/styles.js.map +1 -1
  76. package/build/dropdown-menu/index.js +5 -5
  77. package/build/dropdown-menu/index.js.map +1 -1
  78. package/build/dropdown-menu/index.native.js +4 -4
  79. package/build/dropdown-menu/index.native.js.map +1 -1
  80. package/build/duotone-picker/utils.js +3 -1
  81. package/build/duotone-picker/utils.js.map +1 -1
  82. package/build/elevation/hook.js +5 -6
  83. package/build/elevation/hook.js.map +1 -1
  84. package/build/external-link/index.js +2 -2
  85. package/build/external-link/index.js.map +1 -1
  86. package/build/focal-point-picker/controls.js +3 -1
  87. package/build/focal-point-picker/controls.js.map +1 -1
  88. package/build/focal-point-picker/focal-point.js +2 -2
  89. package/build/focal-point-picker/focal-point.js.map +1 -1
  90. package/build/focal-point-picker/index.js +23 -9
  91. package/build/focal-point-picker/index.js.map +1 -1
  92. package/build/focal-point-picker/styles/focal-point-picker-style.js +12 -12
  93. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  94. package/build/focal-point-picker/tooltip/index.native.js +3 -8
  95. package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
  96. package/build/focal-point-picker/utils.js +3 -1
  97. package/build/focal-point-picker/utils.js.map +1 -1
  98. package/build/font-size-picker/index.js +3 -2
  99. package/build/font-size-picker/index.js.map +1 -1
  100. package/build/font-size-picker/types.js.map +1 -1
  101. package/build/form-toggle/index.js +2 -2
  102. package/build/form-toggle/index.js.map +1 -1
  103. package/build/form-token-field/index.js +3 -3
  104. package/build/form-token-field/index.js.map +1 -1
  105. package/build/form-token-field/suggestions-list.js +9 -5
  106. package/build/form-token-field/suggestions-list.js.map +1 -1
  107. package/build/form-token-field/token-input.js +2 -2
  108. package/build/form-token-field/token-input.js.map +1 -1
  109. package/build/form-token-field/token.js +2 -2
  110. package/build/form-token-field/token.js.map +1 -1
  111. package/build/guide/index.js +2 -2
  112. package/build/guide/index.js.map +1 -1
  113. package/build/input-control/index.js +3 -6
  114. package/build/input-control/index.js.map +1 -1
  115. package/build/input-control/input-field.js +3 -1
  116. package/build/input-control/input-field.js.map +1 -1
  117. package/build/input-control/label.js +3 -1
  118. package/build/input-control/label.js.map +1 -1
  119. package/build/input-control/styles/input-control-styles.js +31 -23
  120. package/build/input-control/styles/input-control-styles.js.map +1 -1
  121. package/build/input-control/utils.js +8 -4
  122. package/build/input-control/utils.js.map +1 -1
  123. package/build/item-group/item/hook.js +0 -4
  124. package/build/item-group/item/hook.js.map +1 -1
  125. package/build/menu-group/index.js +2 -2
  126. package/build/menu-group/index.js.map +1 -1
  127. package/build/menu-item/index.js +3 -3
  128. package/build/menu-item/index.js.map +1 -1
  129. package/build/mobile/color-settings/utils.native.js +1 -1
  130. package/build/mobile/color-settings/utils.native.js.map +1 -1
  131. package/build/mobile/gradient/index.native.js +3 -1
  132. package/build/mobile/gradient/index.native.js.map +1 -1
  133. package/build/mobile/keyboard-aware-flat-list/index.android.js +9 -3
  134. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  135. package/build/mobile/keyboard-aware-flat-list/index.ios.js +15 -13
  136. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  137. package/build/mobile/keyboard-aware-flat-list/shared.native.js +33 -0
  138. package/build/mobile/keyboard-aware-flat-list/shared.native.js.map +1 -0
  139. package/build/modal/aria-helper.js +9 -3
  140. package/build/modal/aria-helper.js.map +1 -1
  141. package/build/modal/index.js +10 -6
  142. package/build/modal/index.js.map +1 -1
  143. package/build/navigation/back-button/index.js +2 -2
  144. package/build/navigation/back-button/index.js.map +1 -1
  145. package/build/navigation/group/index.js +2 -2
  146. package/build/navigation/group/index.js.map +1 -1
  147. package/build/navigation/index.js +3 -3
  148. package/build/navigation/index.js.map +1 -1
  149. package/build/navigation/item/base.js +2 -2
  150. package/build/navigation/item/base.js.map +1 -1
  151. package/build/navigation/item/index.js +2 -2
  152. package/build/navigation/item/index.js.map +1 -1
  153. package/build/navigation/menu/index.js +2 -2
  154. package/build/navigation/menu/index.js.map +1 -1
  155. package/build/navigation/styles/navigation-styles.js +12 -12
  156. package/build/navigation/styles/navigation-styles.js.map +1 -1
  157. package/build/notice/index.js +3 -3
  158. package/build/notice/index.js.map +1 -1
  159. package/build/notice/list.js +2 -2
  160. package/build/notice/list.js.map +1 -1
  161. package/build/number-control/index.js +2 -2
  162. package/build/number-control/index.js.map +1 -1
  163. package/build/palette-edit/index.js +5 -5
  164. package/build/palette-edit/index.js.map +1 -1
  165. package/build/palette-edit/styles.js +14 -15
  166. package/build/palette-edit/styles.js.map +1 -1
  167. package/build/panel/body.js +5 -3
  168. package/build/panel/body.js.map +1 -1
  169. package/build/panel/index.js +2 -2
  170. package/build/panel/index.js.map +1 -1
  171. package/build/panel/row.js +2 -2
  172. package/build/panel/row.js.map +1 -1
  173. package/build/placeholder/index.js +3 -3
  174. package/build/placeholder/index.js.map +1 -1
  175. package/build/popover/index.js +5 -3
  176. package/build/popover/index.js.map +1 -1
  177. package/build/popover/overlay-middlewares.js +3 -1
  178. package/build/popover/overlay-middlewares.js.map +1 -1
  179. package/build/query-controls/author-select.js +3 -1
  180. package/build/query-controls/author-select.js.map +1 -1
  181. package/build/radio-control/index.js +2 -2
  182. package/build/radio-control/index.js.map +1 -1
  183. package/build/range-control/index.js +3 -3
  184. package/build/range-control/index.js.map +1 -1
  185. package/build/range-control/mark.js +3 -3
  186. package/build/range-control/mark.js.map +1 -1
  187. package/build/range-control/rail.js +1 -1
  188. package/build/range-control/rail.js.map +1 -1
  189. package/build/range-control/styles/range-control-styles.js +29 -29
  190. package/build/range-control/styles/range-control-styles.js.map +1 -1
  191. package/build/range-control/tooltip.js +2 -2
  192. package/build/range-control/tooltip.js.map +1 -1
  193. package/build/resizable-box/index.js +10 -10
  194. package/build/resizable-box/index.js.map +1 -1
  195. package/build/resizable-box/resize-tooltip/index.js +5 -3
  196. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  197. package/build/resizable-box/resize-tooltip/label.js +3 -1
  198. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  199. package/build/resizable-box/resize-tooltip/utils.js +12 -4
  200. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  201. package/build/responsive-wrapper/index.js +2 -2
  202. package/build/responsive-wrapper/index.js.map +1 -1
  203. package/build/search-control/index.js +2 -2
  204. package/build/search-control/index.js.map +1 -1
  205. package/build/select-control/index.js +5 -3
  206. package/build/select-control/index.js.map +1 -1
  207. package/build/select-control/styles/select-control-styles.js +8 -6
  208. package/build/select-control/styles/select-control-styles.js.map +1 -1
  209. package/build/slot-fill/bubbles-virtually/slot-fill-context.js +3 -3
  210. package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  211. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +3 -3
  212. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  213. package/build/slot-fill/bubbles-virtually/use-slot-fills.js +2 -2
  214. package/build/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
  215. package/build/slot-fill/bubbles-virtually/use-slot.js +2 -2
  216. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  217. package/build/slot-fill/types.js.map +1 -1
  218. package/build/snackbar/index.js +3 -3
  219. package/build/snackbar/index.js.map +1 -1
  220. package/build/snackbar/list.js +2 -2
  221. package/build/snackbar/list.js.map +1 -1
  222. package/build/spinner/index.js +2 -2
  223. package/build/spinner/index.js.map +1 -1
  224. package/build/tab-panel/index.js +2 -2
  225. package/build/tab-panel/index.js.map +1 -1
  226. package/build/text/get-line-height.js +6 -2
  227. package/build/text/get-line-height.js.map +1 -1
  228. package/build/text/utils.js +6 -2
  229. package/build/text/utils.js.map +1 -1
  230. package/build/text-control/index.js +2 -2
  231. package/build/text-control/index.js.map +1 -1
  232. package/build/theme/color-algorithms.js +6 -2
  233. package/build/theme/color-algorithms.js.map +1 -1
  234. package/build/toggle-group-control/toggle-group-control-option-base/component.js +3 -1
  235. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  236. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
  237. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  238. package/build/toolbar/toolbar/index.js +2 -2
  239. package/build/toolbar/toolbar/index.js.map +1 -1
  240. package/build/toolbar/toolbar-button/index.js +3 -3
  241. package/build/toolbar/toolbar-button/index.js.map +1 -1
  242. package/build/toolbar/toolbar-group/index.js +2 -2
  243. package/build/toolbar/toolbar-group/index.js.map +1 -1
  244. package/build/tools-panel/tools-panel/hook.js +5 -6
  245. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  246. package/build/tools-panel/tools-panel-item/hook.js +6 -8
  247. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  248. package/build/tools-panel/types.js.map +1 -1
  249. package/build/tree-grid/roving-tab-index-item.js +3 -1
  250. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  251. package/build/truncate/hook.js +1 -1
  252. package/build/truncate/hook.js.map +1 -1
  253. package/build/unit-control/index.js +5 -3
  254. package/build/unit-control/index.js.map +1 -1
  255. package/build/unit-control/unit-select-control.js +2 -2
  256. package/build/unit-control/unit-select-control.js.map +1 -1
  257. package/build/utils/colors.js +21 -7
  258. package/build/utils/colors.js.map +1 -1
  259. package/build/utils/font-size.js +3 -1
  260. package/build/utils/font-size.js.map +1 -1
  261. package/build/utils/get-valid-children.js +3 -1
  262. package/build/utils/get-valid-children.js.map +1 -1
  263. package/build/utils/input/base.js +2 -3
  264. package/build/utils/input/base.js.map +1 -1
  265. package/build/utils/strings.js +11 -57
  266. package/build/utils/strings.js.map +1 -1
  267. package/build/utils/use-responsive-value.js +3 -1
  268. package/build/utils/use-responsive-value.js.map +1 -1
  269. package/build/view/component.js +26 -8
  270. package/build/view/component.js.map +1 -1
  271. package/build-module/alignment-matrix-control/icon.js +2 -2
  272. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  273. package/build-module/alignment-matrix-control/index.js +5 -3
  274. package/build-module/alignment-matrix-control/index.js.map +1 -1
  275. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
  276. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  277. package/build-module/alignment-matrix-control/utils.js +6 -2
  278. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  279. package/build-module/angle-picker-control/index.js +2 -2
  280. package/build-module/angle-picker-control/index.js.map +1 -1
  281. package/build-module/animate/index.js +4 -4
  282. package/build-module/animate/index.js.map +1 -1
  283. package/build-module/autocomplete/autocompleter-ui.js +5 -3
  284. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  285. package/build-module/autocomplete/index.js +21 -7
  286. package/build-module/autocomplete/index.js.map +1 -1
  287. package/build-module/base-control/hooks.js +1 -4
  288. package/build-module/base-control/hooks.js.map +1 -1
  289. package/build-module/base-control/index.js +2 -2
  290. package/build-module/base-control/index.js.map +1 -1
  291. package/build-module/base-control/types.js.map +1 -1
  292. package/build-module/border-control/types.js.map +1 -1
  293. package/build-module/button/index.js +2 -2
  294. package/build-module/button/index.js.map +1 -1
  295. package/build-module/button-group/index.js +2 -2
  296. package/build-module/button-group/index.js.map +1 -1
  297. package/build-module/checkbox-control/index.js +11 -4
  298. package/build-module/checkbox-control/index.js.map +1 -1
  299. package/build-module/circular-option-picker/circular-option-picker-actions.js +3 -3
  300. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  301. package/build-module/circular-option-picker/circular-option-picker-option-group.js +2 -2
  302. package/build-module/circular-option-picker/circular-option-picker-option-group.js.map +1 -1
  303. package/build-module/circular-option-picker/circular-option-picker-option.js +2 -2
  304. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  305. package/build-module/circular-option-picker/circular-option-picker.js +2 -2
  306. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  307. package/build-module/clipboard-button/index.js +2 -2
  308. package/build-module/clipboard-button/index.js.map +1 -1
  309. package/build-module/color-indicator/index.js +2 -2
  310. package/build-module/color-indicator/index.js.map +1 -1
  311. package/build-module/color-palette/index.js +2 -2
  312. package/build-module/color-palette/index.js.map +1 -1
  313. package/build-module/color-picker/hex-input.js +3 -1
  314. package/build-module/color-picker/hex-input.js.map +1 -1
  315. package/build-module/color-picker/hue-picker.native.js +6 -2
  316. package/build-module/color-picker/hue-picker.native.js.map +1 -1
  317. package/build-module/color-picker/index.native.js +9 -3
  318. package/build-module/color-picker/index.native.js.map +1 -1
  319. package/build-module/color-picker/saturation-picker.native.js +6 -2
  320. package/build-module/color-picker/saturation-picker.native.js.map +1 -1
  321. package/build-module/color-picker/use-deprecated-props.js +9 -3
  322. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  323. package/build-module/combobox-control/index.js +7 -2
  324. package/build-module/combobox-control/index.js.map +1 -1
  325. package/build-module/combobox-control/types.js.map +1 -1
  326. package/build-module/context/context-connect.js +6 -2
  327. package/build-module/context/context-connect.js.map +1 -1
  328. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +3 -3
  329. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  330. package/build-module/custom-gradient-picker/gradient-bar/index.js +2 -2
  331. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  332. package/build-module/custom-gradient-picker/index.js.map +1 -1
  333. package/build-module/custom-select-control/index.js +3 -3
  334. package/build-module/custom-select-control/index.js.map +1 -1
  335. package/build-module/custom-select-control-v2/legacy-component/index.js +3 -1
  336. package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
  337. package/build-module/dimension-control/index.js +2 -2
  338. package/build-module/dimension-control/index.js.map +1 -1
  339. package/build-module/drop-zone/index.js +74 -66
  340. package/build-module/drop-zone/index.js.map +1 -1
  341. package/build-module/dropdown/index.js +2 -2
  342. package/build-module/dropdown/index.js.map +1 -1
  343. package/build-module/dropdown/styles.js +5 -3
  344. package/build-module/dropdown/styles.js.map +1 -1
  345. package/build-module/dropdown-menu/index.js +5 -5
  346. package/build-module/dropdown-menu/index.js.map +1 -1
  347. package/build-module/dropdown-menu/index.native.js +4 -4
  348. package/build-module/dropdown-menu/index.native.js.map +1 -1
  349. package/build-module/duotone-picker/utils.js +3 -1
  350. package/build-module/duotone-picker/utils.js.map +1 -1
  351. package/build-module/elevation/hook.js +6 -7
  352. package/build-module/elevation/hook.js.map +1 -1
  353. package/build-module/external-link/index.js +2 -2
  354. package/build-module/external-link/index.js.map +1 -1
  355. package/build-module/focal-point-picker/controls.js +3 -1
  356. package/build-module/focal-point-picker/controls.js.map +1 -1
  357. package/build-module/focal-point-picker/focal-point.js +2 -2
  358. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  359. package/build-module/focal-point-picker/index.js +23 -9
  360. package/build-module/focal-point-picker/index.js.map +1 -1
  361. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +13 -13
  362. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  363. package/build-module/focal-point-picker/tooltip/index.native.js +3 -8
  364. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  365. package/build-module/focal-point-picker/utils.js +3 -1
  366. package/build-module/focal-point-picker/utils.js.map +1 -1
  367. package/build-module/font-size-picker/index.js +3 -2
  368. package/build-module/font-size-picker/index.js.map +1 -1
  369. package/build-module/font-size-picker/types.js.map +1 -1
  370. package/build-module/form-toggle/index.js +2 -2
  371. package/build-module/form-toggle/index.js.map +1 -1
  372. package/build-module/form-token-field/index.js +3 -3
  373. package/build-module/form-token-field/index.js.map +1 -1
  374. package/build-module/form-token-field/suggestions-list.js +9 -5
  375. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  376. package/build-module/form-token-field/token-input.js +2 -2
  377. package/build-module/form-token-field/token-input.js.map +1 -1
  378. package/build-module/form-token-field/token.js +2 -2
  379. package/build-module/form-token-field/token.js.map +1 -1
  380. package/build-module/guide/index.js +2 -2
  381. package/build-module/guide/index.js.map +1 -1
  382. package/build-module/input-control/index.js +3 -6
  383. package/build-module/input-control/index.js.map +1 -1
  384. package/build-module/input-control/input-field.js +3 -1
  385. package/build-module/input-control/input-field.js.map +1 -1
  386. package/build-module/input-control/label.js +3 -1
  387. package/build-module/input-control/label.js.map +1 -1
  388. package/build-module/input-control/styles/input-control-styles.js +31 -23
  389. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  390. package/build-module/input-control/utils.js +8 -4
  391. package/build-module/input-control/utils.js.map +1 -1
  392. package/build-module/item-group/item/hook.js +0 -4
  393. package/build-module/item-group/item/hook.js.map +1 -1
  394. package/build-module/menu-group/index.js +2 -2
  395. package/build-module/menu-group/index.js.map +1 -1
  396. package/build-module/menu-item/index.js +3 -3
  397. package/build-module/menu-item/index.js.map +1 -1
  398. package/build-module/mobile/color-settings/utils.native.js +1 -1
  399. package/build-module/mobile/color-settings/utils.native.js.map +1 -1
  400. package/build-module/mobile/gradient/index.native.js +3 -1
  401. package/build-module/mobile/gradient/index.native.js.map +1 -1
  402. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +9 -3
  403. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  404. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +16 -15
  405. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  406. package/build-module/mobile/keyboard-aware-flat-list/shared.native.js +27 -0
  407. package/build-module/mobile/keyboard-aware-flat-list/shared.native.js.map +1 -0
  408. package/build-module/modal/aria-helper.js +9 -3
  409. package/build-module/modal/aria-helper.js.map +1 -1
  410. package/build-module/modal/index.js +10 -6
  411. package/build-module/modal/index.js.map +1 -1
  412. package/build-module/navigation/back-button/index.js +2 -2
  413. package/build-module/navigation/back-button/index.js.map +1 -1
  414. package/build-module/navigation/group/index.js +2 -2
  415. package/build-module/navigation/group/index.js.map +1 -1
  416. package/build-module/navigation/index.js +3 -3
  417. package/build-module/navigation/index.js.map +1 -1
  418. package/build-module/navigation/item/base.js +2 -2
  419. package/build-module/navigation/item/base.js.map +1 -1
  420. package/build-module/navigation/item/index.js +2 -2
  421. package/build-module/navigation/item/index.js.map +1 -1
  422. package/build-module/navigation/menu/index.js +2 -2
  423. package/build-module/navigation/menu/index.js.map +1 -1
  424. package/build-module/navigation/styles/navigation-styles.js +13 -13
  425. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  426. package/build-module/notice/index.js +3 -3
  427. package/build-module/notice/index.js.map +1 -1
  428. package/build-module/notice/list.js +2 -2
  429. package/build-module/notice/list.js.map +1 -1
  430. package/build-module/number-control/index.js +2 -2
  431. package/build-module/number-control/index.js.map +1 -1
  432. package/build-module/palette-edit/index.js +6 -6
  433. package/build-module/palette-edit/index.js.map +1 -1
  434. package/build-module/palette-edit/styles.js +13 -14
  435. package/build-module/palette-edit/styles.js.map +1 -1
  436. package/build-module/panel/body.js +5 -3
  437. package/build-module/panel/body.js.map +1 -1
  438. package/build-module/panel/index.js +2 -2
  439. package/build-module/panel/index.js.map +1 -1
  440. package/build-module/panel/row.js +2 -2
  441. package/build-module/panel/row.js.map +1 -1
  442. package/build-module/placeholder/index.js +3 -3
  443. package/build-module/placeholder/index.js.map +1 -1
  444. package/build-module/popover/index.js +5 -3
  445. package/build-module/popover/index.js.map +1 -1
  446. package/build-module/popover/overlay-middlewares.js +3 -1
  447. package/build-module/popover/overlay-middlewares.js.map +1 -1
  448. package/build-module/query-controls/author-select.js +3 -1
  449. package/build-module/query-controls/author-select.js.map +1 -1
  450. package/build-module/radio-control/index.js +2 -2
  451. package/build-module/radio-control/index.js.map +1 -1
  452. package/build-module/range-control/index.js +3 -3
  453. package/build-module/range-control/index.js.map +1 -1
  454. package/build-module/range-control/mark.js +3 -3
  455. package/build-module/range-control/mark.js.map +1 -1
  456. package/build-module/range-control/rail.js +1 -1
  457. package/build-module/range-control/rail.js.map +1 -1
  458. package/build-module/range-control/styles/range-control-styles.js +30 -30
  459. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  460. package/build-module/range-control/tooltip.js +2 -2
  461. package/build-module/range-control/tooltip.js.map +1 -1
  462. package/build-module/resizable-box/index.js +10 -10
  463. package/build-module/resizable-box/index.js.map +1 -1
  464. package/build-module/resizable-box/resize-tooltip/index.js +5 -3
  465. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  466. package/build-module/resizable-box/resize-tooltip/label.js +3 -1
  467. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  468. package/build-module/resizable-box/resize-tooltip/utils.js +12 -4
  469. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  470. package/build-module/responsive-wrapper/index.js +2 -2
  471. package/build-module/responsive-wrapper/index.js.map +1 -1
  472. package/build-module/search-control/index.js +2 -2
  473. package/build-module/search-control/index.js.map +1 -1
  474. package/build-module/select-control/index.js +5 -3
  475. package/build-module/select-control/index.js.map +1 -1
  476. package/build-module/select-control/styles/select-control-styles.js +8 -6
  477. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  478. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +2 -1
  479. package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
  480. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  481. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  482. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js +1 -1
  483. package/build-module/slot-fill/bubbles-virtually/use-slot-fills.js.map +1 -1
  484. package/build-module/slot-fill/bubbles-virtually/use-slot.js +1 -1
  485. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  486. package/build-module/slot-fill/types.js.map +1 -1
  487. package/build-module/snackbar/index.js +3 -3
  488. package/build-module/snackbar/index.js.map +1 -1
  489. package/build-module/snackbar/list.js +2 -2
  490. package/build-module/snackbar/list.js.map +1 -1
  491. package/build-module/spinner/index.js +2 -2
  492. package/build-module/spinner/index.js.map +1 -1
  493. package/build-module/tab-panel/index.js +2 -2
  494. package/build-module/tab-panel/index.js.map +1 -1
  495. package/build-module/text/get-line-height.js +6 -2
  496. package/build-module/text/get-line-height.js.map +1 -1
  497. package/build-module/text/utils.js +6 -2
  498. package/build-module/text/utils.js.map +1 -1
  499. package/build-module/text-control/index.js +2 -2
  500. package/build-module/text-control/index.js.map +1 -1
  501. package/build-module/theme/color-algorithms.js +6 -2
  502. package/build-module/theme/color-algorithms.js.map +1 -1
  503. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +3 -1
  504. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  505. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +10 -10
  506. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  507. package/build-module/toolbar/toolbar/index.js +2 -2
  508. package/build-module/toolbar/toolbar/index.js.map +1 -1
  509. package/build-module/toolbar/toolbar-button/index.js +3 -3
  510. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  511. package/build-module/toolbar/toolbar-group/index.js +2 -2
  512. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  513. package/build-module/tools-panel/tools-panel/hook.js +5 -6
  514. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  515. package/build-module/tools-panel/tools-panel-item/hook.js +6 -8
  516. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  517. package/build-module/tools-panel/types.js.map +1 -1
  518. package/build-module/tree-grid/roving-tab-index-item.js +3 -1
  519. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  520. package/build-module/truncate/hook.js +1 -1
  521. package/build-module/truncate/hook.js.map +1 -1
  522. package/build-module/unit-control/index.js +5 -3
  523. package/build-module/unit-control/index.js.map +1 -1
  524. package/build-module/unit-control/unit-select-control.js +2 -2
  525. package/build-module/unit-control/unit-select-control.js.map +1 -1
  526. package/build-module/utils/colors.js +21 -7
  527. package/build-module/utils/colors.js.map +1 -1
  528. package/build-module/utils/font-size.js +3 -1
  529. package/build-module/utils/font-size.js.map +1 -1
  530. package/build-module/utils/get-valid-children.js +3 -1
  531. package/build-module/utils/get-valid-children.js.map +1 -1
  532. package/build-module/utils/input/base.js +2 -3
  533. package/build-module/utils/input/base.js.map +1 -1
  534. package/build-module/utils/strings.js +12 -57
  535. package/build-module/utils/strings.js.map +1 -1
  536. package/build-module/utils/use-responsive-value.js +3 -1
  537. package/build-module/utils/use-responsive-value.js.map +1 -1
  538. package/build-module/view/component.js +26 -8
  539. package/build-module/view/component.js.map +1 -1
  540. package/build-style/style-rtl.css +56 -55
  541. package/build-style/style.css +56 -55
  542. package/build-types/alignment-matrix-control/cell.d.ts +1 -1
  543. package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
  544. package/build-types/alignment-matrix-control/icon.d.ts +1 -1
  545. package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
  546. package/build-types/alignment-matrix-control/index.d.ts +1 -1
  547. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  548. package/build-types/alignment-matrix-control/stories/index.story.d.ts +2 -2
  549. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  550. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +4 -4
  551. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +4 -4
  552. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -1
  553. package/build-types/alignment-matrix-control/utils.d.ts.map +1 -1
  554. package/build-types/angle-picker-control/angle-circle.d.ts +1 -1
  555. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  556. package/build-types/angle-picker-control/index.d.ts +1 -1
  557. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  558. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +4 -4
  559. package/build-types/animate/index.d.ts.map +1 -1
  560. package/build-types/autocomplete/autocompleter-ui.d.ts +1 -1
  561. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  562. package/build-types/autocomplete/index.d.ts +3 -3
  563. package/build-types/autocomplete/index.d.ts.map +1 -1
  564. package/build-types/base-control/hooks.d.ts +1 -0
  565. package/build-types/base-control/hooks.d.ts.map +1 -1
  566. package/build-types/base-control/index.d.ts +2 -2
  567. package/build-types/base-control/index.d.ts.map +1 -1
  568. package/build-types/base-control/styles/base-control-styles.d.ts +5 -5
  569. package/build-types/base-control/types.d.ts +1 -2
  570. package/build-types/base-control/types.d.ts.map +1 -1
  571. package/build-types/border-box-control/border-box-control/hook.d.ts +69 -59
  572. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  573. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +70 -61
  574. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  575. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +69 -59
  576. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  577. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +69 -59
  578. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  579. package/build-types/border-box-control/stories/index.story.d.ts +1 -1
  580. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  581. package/build-types/border-control/border-control/component.d.ts +1 -0
  582. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  583. package/build-types/border-control/border-control/hook.d.ts +70 -59
  584. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  585. package/build-types/border-control/border-control-dropdown/hook.d.ts +69 -59
  586. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  587. package/build-types/border-control/border-control-style-picker/component.d.ts +1 -1
  588. package/build-types/border-control/stories/index.story.d.ts +12 -6
  589. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  590. package/build-types/border-control/types.d.ts +4 -0
  591. package/build-types/border-control/types.d.ts.map +1 -1
  592. package/build-types/box-control/all-input-control.d.ts +1 -1
  593. package/build-types/box-control/all-input-control.d.ts.map +1 -1
  594. package/build-types/box-control/axial-input-controls.d.ts +1 -1
  595. package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
  596. package/build-types/box-control/icon.d.ts +1 -1
  597. package/build-types/box-control/icon.d.ts.map +1 -1
  598. package/build-types/box-control/index.d.ts +1 -1
  599. package/build-types/box-control/index.d.ts.map +1 -1
  600. package/build-types/box-control/input-controls.d.ts +1 -1
  601. package/build-types/box-control/input-controls.d.ts.map +1 -1
  602. package/build-types/box-control/linked-button.d.ts +1 -1
  603. package/build-types/box-control/linked-button.d.ts.map +1 -1
  604. package/build-types/box-control/stories/index.story.d.ts +439 -390
  605. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  606. package/build-types/box-control/styles/box-control-icon-styles.d.ts +6 -6
  607. package/build-types/box-control/styles/box-control-styles.d.ts +5 -5
  608. package/build-types/button/deprecated.d.ts +5 -51
  609. package/build-types/button/deprecated.d.ts.map +1 -1
  610. package/build-types/button/index.d.ts +1 -1
  611. package/build-types/button/index.d.ts.map +1 -1
  612. package/build-types/button/stories/index.story.d.ts +1 -1
  613. package/build-types/button/stories/index.story.d.ts.map +1 -1
  614. package/build-types/button-group/index.d.ts +1 -1
  615. package/build-types/button-group/index.d.ts.map +1 -1
  616. package/build-types/card/card/hook.d.ts +69 -59
  617. package/build-types/card/card/hook.d.ts.map +1 -1
  618. package/build-types/card/card-body/hook.d.ts +69 -59
  619. package/build-types/card/card-body/hook.d.ts.map +1 -1
  620. package/build-types/card/card-divider/hook.d.ts +69 -59
  621. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  622. package/build-types/card/card-footer/hook.d.ts +69 -59
  623. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  624. package/build-types/card/card-header/hook.d.ts +69 -59
  625. package/build-types/card/card-header/hook.d.ts.map +1 -1
  626. package/build-types/card/card-media/hook.d.ts +69 -59
  627. package/build-types/card/card-media/hook.d.ts.map +1 -1
  628. package/build-types/card/stories/index.story.d.ts +2 -2
  629. package/build-types/checkbox-control/index.d.ts +1 -1
  630. package/build-types/checkbox-control/index.d.ts.map +1 -1
  631. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +2 -2
  632. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  633. package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts +1 -1
  634. package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts.map +1 -1
  635. package/build-types/circular-option-picker/circular-option-picker-option.d.ts +1 -1
  636. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  637. package/build-types/circular-option-picker/circular-option-picker.d.ts +1 -1
  638. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  639. package/build-types/clipboard-button/index.d.ts +1 -1
  640. package/build-types/clipboard-button/index.d.ts.map +1 -1
  641. package/build-types/color-indicator/index.d.ts +1 -1
  642. package/build-types/color-indicator/index.d.ts.map +1 -1
  643. package/build-types/color-palette/index.d.ts +1 -1
  644. package/build-types/color-palette/index.d.ts.map +1 -1
  645. package/build-types/color-palette/styles.d.ts +1 -1
  646. package/build-types/color-picker/color-copy-button.d.ts +1 -1
  647. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  648. package/build-types/color-picker/color-input.d.ts +1 -1
  649. package/build-types/color-picker/color-input.d.ts.map +1 -1
  650. package/build-types/color-picker/component.d.ts +2 -2
  651. package/build-types/color-picker/component.d.ts.map +1 -1
  652. package/build-types/color-picker/hex-input.d.ts +1 -1
  653. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  654. package/build-types/color-picker/hsl-input.d.ts +1 -1
  655. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  656. package/build-types/color-picker/input-with-slider.d.ts +1 -1
  657. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  658. package/build-types/color-picker/legacy-adapter.d.ts +1 -1
  659. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  660. package/build-types/color-picker/picker.d.ts +1 -1
  661. package/build-types/color-picker/picker.d.ts.map +1 -1
  662. package/build-types/color-picker/rgb-input.d.ts +1 -1
  663. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  664. package/build-types/color-picker/stories/index.story.d.ts +1 -1
  665. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  666. package/build-types/color-picker/styles.d.ts +6 -6
  667. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  668. package/build-types/combobox-control/index.d.ts +3 -1
  669. package/build-types/combobox-control/index.d.ts.map +1 -1
  670. package/build-types/combobox-control/stories/index.story.d.ts +22 -2
  671. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  672. package/build-types/combobox-control/styles.d.ts +1 -1
  673. package/build-types/combobox-control/types.d.ts +1 -0
  674. package/build-types/combobox-control/types.d.ts.map +1 -1
  675. package/build-types/composite/current/stories/utils.d.ts +1 -1
  676. package/build-types/composite/current/stories/utils.d.ts.map +1 -1
  677. package/build-types/composite/legacy/stories/utils.d.ts +1 -1
  678. package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
  679. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  680. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  681. package/build-types/context/context-connect.d.ts.map +1 -1
  682. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +2 -2
  683. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  684. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +1 -1
  685. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  686. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  687. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  688. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
  689. package/build-types/custom-select-control/index.d.ts +2 -2
  690. package/build-types/custom-select-control/index.d.ts.map +1 -1
  691. package/build-types/custom-select-control-v2/custom-select.d.ts +1 -1
  692. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  693. package/build-types/custom-select-control-v2/default-component/index.d.ts +1 -1
  694. package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
  695. package/build-types/custom-select-control-v2/item.d.ts +1 -1
  696. package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
  697. package/build-types/custom-select-control-v2/legacy-component/index.d.ts +1 -1
  698. package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
  699. package/build-types/custom-select-control-v2/stories/default.story.d.ts +3 -3
  700. package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
  701. package/build-types/custom-select-control-v2/styles.d.ts +8 -8
  702. package/build-types/dashicon/index.d.ts +1 -1
  703. package/build-types/dashicon/index.d.ts.map +1 -1
  704. package/build-types/date-time/date/index.d.ts +1 -1
  705. package/build-types/date-time/date/index.d.ts.map +1 -1
  706. package/build-types/date-time/date/styles.d.ts +5 -5
  707. package/build-types/date-time/date-time/styles.d.ts +1 -1
  708. package/build-types/date-time/time/index.d.ts +1 -1
  709. package/build-types/date-time/time/index.d.ts.map +1 -1
  710. package/build-types/date-time/time/styles.d.ts +10 -10
  711. package/build-types/date-time/time/timezone.d.ts +1 -1
  712. package/build-types/date-time/time/timezone.d.ts.map +1 -1
  713. package/build-types/dimension-control/index.d.ts +1 -1
  714. package/build-types/dimension-control/index.d.ts.map +1 -1
  715. package/build-types/disabled/index.d.ts +1 -1
  716. package/build-types/disabled/index.d.ts.map +1 -1
  717. package/build-types/disclosure/index.d.ts +1 -1
  718. package/build-types/disclosure/index.d.ts.map +1 -1
  719. package/build-types/divider/styles.d.ts +1 -1
  720. package/build-types/draggable/index.d.ts +1 -1
  721. package/build-types/draggable/index.d.ts.map +1 -1
  722. package/build-types/drop-zone/index.d.ts +1 -1
  723. package/build-types/drop-zone/index.d.ts.map +1 -1
  724. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  725. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  726. package/build-types/dropdown/index.d.ts +1 -1
  727. package/build-types/dropdown/index.d.ts.map +1 -1
  728. package/build-types/dropdown/stories/index.story.d.ts +4 -4
  729. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  730. package/build-types/dropdown/styles.d.ts +1 -1
  731. package/build-types/dropdown/styles.d.ts.map +1 -1
  732. package/build-types/dropdown-menu/index.d.ts +1 -1
  733. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  734. package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
  735. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  736. package/build-types/dropdown-menu-v2/index.d.ts +7 -7
  737. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
  738. package/build-types/dropdown-menu-v2/styles.d.ts +12 -12
  739. package/build-types/duotone-picker/color-list-picker/index.d.ts +1 -1
  740. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  741. package/build-types/duotone-picker/custom-duotone-bar.d.ts +1 -1
  742. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -1
  743. package/build-types/duotone-picker/duotone-picker.d.ts +1 -1
  744. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  745. package/build-types/duotone-picker/duotone-swatch.d.ts +1 -1
  746. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -1
  747. package/build-types/duotone-picker/utils.d.ts.map +1 -1
  748. package/build-types/elevation/hook.d.ts +68 -58
  749. package/build-types/elevation/hook.d.ts.map +1 -1
  750. package/build-types/flex/flex/hook.d.ts +69 -59
  751. package/build-types/flex/flex/hook.d.ts.map +1 -1
  752. package/build-types/flex/flex-block/hook.d.ts +69 -59
  753. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  754. package/build-types/flex/flex-item/hook.d.ts +69 -59
  755. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  756. package/build-types/focal-point-picker/controls.d.ts +1 -1
  757. package/build-types/focal-point-picker/controls.d.ts.map +1 -1
  758. package/build-types/focal-point-picker/focal-point.d.ts +1 -1
  759. package/build-types/focal-point-picker/focal-point.d.ts.map +1 -1
  760. package/build-types/focal-point-picker/grid.d.ts +1 -1
  761. package/build-types/focal-point-picker/grid.d.ts.map +1 -1
  762. package/build-types/focal-point-picker/index.d.ts +1 -1
  763. package/build-types/focal-point-picker/index.d.ts.map +1 -1
  764. package/build-types/focal-point-picker/media.d.ts +1 -1
  765. package/build-types/focal-point-picker/media.d.ts.map +1 -1
  766. package/build-types/focal-point-picker/stories/index.story.d.ts +8 -8
  767. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  768. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +9 -9
  769. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  770. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +1 -1
  771. package/build-types/focal-point-picker/test/index.d.ts +2 -0
  772. package/build-types/focal-point-picker/test/index.d.ts.map +1 -0
  773. package/build-types/focal-point-picker/test/media.d.ts +2 -0
  774. package/build-types/focal-point-picker/test/media.d.ts.map +1 -0
  775. package/build-types/focal-point-picker/utils.d.ts.map +1 -1
  776. package/build-types/focusable-iframe/index.d.ts +1 -1
  777. package/build-types/focusable-iframe/index.d.ts.map +1 -1
  778. package/build-types/font-size-picker/font-size-picker-select.d.ts +1 -1
  779. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  780. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts +1 -1
  781. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  782. package/build-types/font-size-picker/index.d.ts.map +1 -1
  783. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  784. package/build-types/font-size-picker/styles.d.ts +4 -4
  785. package/build-types/font-size-picker/types.d.ts +2 -0
  786. package/build-types/font-size-picker/types.d.ts.map +1 -1
  787. package/build-types/form-file-upload/index.d.ts +1 -1
  788. package/build-types/form-file-upload/index.d.ts.map +1 -1
  789. package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
  790. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  791. package/build-types/form-toggle/index.d.ts +2 -2
  792. package/build-types/form-toggle/index.d.ts.map +1 -1
  793. package/build-types/form-token-field/index.d.ts +1 -1
  794. package/build-types/form-token-field/index.d.ts.map +1 -1
  795. package/build-types/form-token-field/styles.d.ts +1 -1
  796. package/build-types/form-token-field/suggestions-list.d.ts +2 -1
  797. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  798. package/build-types/form-token-field/token-input.d.ts +2 -2
  799. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  800. package/build-types/form-token-field/token.d.ts +1 -1
  801. package/build-types/form-token-field/token.d.ts.map +1 -1
  802. package/build-types/gradient-picker/index.d.ts +1 -1
  803. package/build-types/gradient-picker/index.d.ts.map +1 -1
  804. package/build-types/grid/hook.d.ts +69 -59
  805. package/build-types/grid/hook.d.ts.map +1 -1
  806. package/build-types/guide/icons.d.ts +1 -1
  807. package/build-types/guide/icons.d.ts.map +1 -1
  808. package/build-types/guide/index.d.ts +1 -1
  809. package/build-types/guide/index.d.ts.map +1 -1
  810. package/build-types/guide/page-control.d.ts +1 -1
  811. package/build-types/guide/page-control.d.ts.map +1 -1
  812. package/build-types/guide/page.d.ts +1 -1
  813. package/build-types/guide/page.d.ts.map +1 -1
  814. package/build-types/h-stack/hook.d.ts +69 -59
  815. package/build-types/h-stack/hook.d.ts.map +1 -1
  816. package/build-types/heading/hook.d.ts +69 -59
  817. package/build-types/heading/hook.d.ts.map +1 -1
  818. package/build-types/higher-order/navigate-regions/index.d.ts +1 -1
  819. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +1 -1
  820. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  821. package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -1
  822. package/build-types/higher-order/with-filters/index.d.ts +2 -2
  823. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  824. package/build-types/higher-order/with-notices/index.d.ts +2 -2
  825. package/build-types/higher-order/with-spoken-messages/index.d.ts +1 -1
  826. package/build-types/icon/index.d.ts +1 -1
  827. package/build-types/icon/index.d.ts.map +1 -1
  828. package/build-types/input-control/backdrop.d.ts +1 -1
  829. package/build-types/input-control/backdrop.d.ts.map +1 -1
  830. package/build-types/input-control/index.d.ts +1 -1
  831. package/build-types/input-control/index.d.ts.map +1 -1
  832. package/build-types/input-control/input-base.d.ts +1 -1
  833. package/build-types/input-control/input-base.d.ts.map +1 -1
  834. package/build-types/input-control/input-field.d.ts +1 -1
  835. package/build-types/input-control/input-field.d.ts.map +1 -1
  836. package/build-types/input-control/label.d.ts +1 -1
  837. package/build-types/input-control/label.d.ts.map +1 -1
  838. package/build-types/input-control/stories/index.story.d.ts +2 -1
  839. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  840. package/build-types/input-control/styles/input-control-styles.d.ts +8 -8
  841. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  842. package/build-types/input-control/utils.d.ts.map +1 -1
  843. package/build-types/isolated-event-container/index.d.ts +1 -1
  844. package/build-types/isolated-event-container/index.d.ts.map +1 -1
  845. package/build-types/item-group/item/hook.d.ts +70 -60
  846. package/build-types/item-group/item/hook.d.ts.map +1 -1
  847. package/build-types/item-group/item-group/hook.d.ts +69 -59
  848. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  849. package/build-types/keyboard-shortcuts/index.d.ts +1 -1
  850. package/build-types/keyboard-shortcuts/index.d.ts.map +1 -1
  851. package/build-types/menu-group/index.d.ts +1 -1
  852. package/build-types/menu-group/index.d.ts.map +1 -1
  853. package/build-types/menu-item/index.d.ts +1 -1
  854. package/build-types/menu-item/index.d.ts.map +1 -1
  855. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  856. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  857. package/build-types/menu-items-choice/index.d.ts +1 -1
  858. package/build-types/menu-items-choice/index.d.ts.map +1 -1
  859. package/build-types/modal/aria-helper.d.ts.map +1 -1
  860. package/build-types/modal/index.d.ts.map +1 -1
  861. package/build-types/navigable-container/container.d.ts +1 -1
  862. package/build-types/navigable-container/menu.d.ts +2 -2
  863. package/build-types/navigable-container/menu.d.ts.map +1 -1
  864. package/build-types/navigable-container/tabbable.d.ts +2 -2
  865. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  866. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  867. package/build-types/navigation/group/index.d.ts +1 -1
  868. package/build-types/navigation/group/index.d.ts.map +1 -1
  869. package/build-types/navigation/index.d.ts +1 -1
  870. package/build-types/navigation/index.d.ts.map +1 -1
  871. package/build-types/navigation/item/base-content.d.ts +1 -1
  872. package/build-types/navigation/item/base-content.d.ts.map +1 -1
  873. package/build-types/navigation/item/base.d.ts +1 -1
  874. package/build-types/navigation/item/base.d.ts.map +1 -1
  875. package/build-types/navigation/item/index.d.ts +1 -1
  876. package/build-types/navigation/item/index.d.ts.map +1 -1
  877. package/build-types/navigation/menu/index.d.ts +1 -1
  878. package/build-types/navigation/menu/index.d.ts.map +1 -1
  879. package/build-types/navigation/menu/menu-title-search.d.ts +1 -1
  880. package/build-types/navigation/menu/menu-title.d.ts +1 -1
  881. package/build-types/navigation/menu/menu-title.d.ts.map +1 -1
  882. package/build-types/navigation/menu/search-no-results-found.d.ts +1 -1
  883. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -1
  884. package/build-types/navigation/styles/navigation-styles.d.ts +11 -11
  885. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  886. package/build-types/navigator/navigator-back-button/hook.d.ts +70 -61
  887. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  888. package/build-types/navigator/navigator-button/hook.d.ts +70 -61
  889. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  890. package/build-types/notice/index.d.ts +1 -1
  891. package/build-types/notice/index.d.ts.map +1 -1
  892. package/build-types/notice/list.d.ts +1 -1
  893. package/build-types/notice/list.d.ts.map +1 -1
  894. package/build-types/number-control/index.d.ts +1 -1
  895. package/build-types/number-control/index.d.ts.map +1 -1
  896. package/build-types/number-control/stories/index.story.d.ts +1 -1
  897. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  898. package/build-types/palette-edit/index.d.ts +1 -1
  899. package/build-types/palette-edit/index.d.ts.map +1 -1
  900. package/build-types/palette-edit/styles.d.ts +1009 -19
  901. package/build-types/palette-edit/styles.d.ts.map +1 -1
  902. package/build-types/panel/body.d.ts +1 -1
  903. package/build-types/panel/body.d.ts.map +1 -1
  904. package/build-types/panel/header.d.ts +1 -1
  905. package/build-types/panel/header.d.ts.map +1 -1
  906. package/build-types/placeholder/index.d.ts +1 -1
  907. package/build-types/placeholder/index.d.ts.map +1 -1
  908. package/build-types/popover/index.d.ts +1 -1
  909. package/build-types/popover/index.d.ts.map +1 -1
  910. package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
  911. package/build-types/popover/stories/e2e/index.story.d.ts +2 -2
  912. package/build-types/popover/stories/e2e/index.story.d.ts.map +1 -1
  913. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  914. package/build-types/popover/test/utils/index.d.ts +1 -1
  915. package/build-types/popover/test/utils/index.d.ts.map +1 -1
  916. package/build-types/progress-bar/index.d.ts +1 -1
  917. package/build-types/progress-bar/index.d.ts.map +1 -1
  918. package/build-types/progress-bar/styles.d.ts +3 -3
  919. package/build-types/query-controls/author-select.d.ts +1 -1
  920. package/build-types/query-controls/author-select.d.ts.map +1 -1
  921. package/build-types/query-controls/category-select.d.ts +1 -1
  922. package/build-types/query-controls/category-select.d.ts.map +1 -1
  923. package/build-types/query-controls/index.d.ts +1 -1
  924. package/build-types/query-controls/index.d.ts.map +1 -1
  925. package/build-types/radio-control/index.d.ts +1 -1
  926. package/build-types/radio-control/index.d.ts.map +1 -1
  927. package/build-types/radio-group/index.d.ts +1 -1
  928. package/build-types/radio-group/index.d.ts.map +1 -1
  929. package/build-types/radio-group/radio.d.ts +1 -1
  930. package/build-types/radio-group/radio.d.ts.map +1 -1
  931. package/build-types/range-control/index.d.ts +1 -1
  932. package/build-types/range-control/index.d.ts.map +1 -1
  933. package/build-types/range-control/input-range.d.ts +1 -1
  934. package/build-types/range-control/mark.d.ts +1 -1
  935. package/build-types/range-control/mark.d.ts.map +1 -1
  936. package/build-types/range-control/rail.d.ts +1 -1
  937. package/build-types/range-control/rail.d.ts.map +1 -1
  938. package/build-types/range-control/styles/range-control-styles.d.ts +15 -15
  939. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  940. package/build-types/range-control/tooltip.d.ts +1 -1
  941. package/build-types/range-control/tooltip.d.ts.map +1 -1
  942. package/build-types/resizable-box/index.d.ts +3 -3
  943. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  944. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  945. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  946. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  947. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +4 -4
  948. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  949. package/build-types/resizable-box/stories/index.story.d.ts +6 -6
  950. package/build-types/responsive-wrapper/index.d.ts +1 -1
  951. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  952. package/build-types/sandbox/index.d.ts +1 -1
  953. package/build-types/sandbox/index.d.ts.map +1 -1
  954. package/build-types/scrollable/hook.d.ts +69 -59
  955. package/build-types/scrollable/hook.d.ts.map +1 -1
  956. package/build-types/search-control/index.d.ts.map +1 -1
  957. package/build-types/search-control/styles.d.ts +1 -1
  958. package/build-types/select-control/chevron-down.d.ts +1 -1
  959. package/build-types/select-control/chevron-down.d.ts.map +1 -1
  960. package/build-types/select-control/index.d.ts.map +1 -1
  961. package/build-types/select-control/styles/select-control-styles.d.ts +3 -3
  962. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  963. package/build-types/shortcut/index.d.ts +1 -1
  964. package/build-types/shortcut/index.d.ts.map +1 -1
  965. package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
  966. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +1 -1
  967. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  968. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  969. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -1
  970. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  971. package/build-types/slot-fill/index.d.ts +7 -7
  972. package/build-types/slot-fill/index.d.ts.map +1 -1
  973. package/build-types/slot-fill/provider.d.ts +1 -1
  974. package/build-types/slot-fill/provider.d.ts.map +1 -1
  975. package/build-types/slot-fill/slot.d.ts +1 -1
  976. package/build-types/slot-fill/slot.d.ts.map +1 -1
  977. package/build-types/slot-fill/types.d.ts +2 -2
  978. package/build-types/slot-fill/types.d.ts.map +1 -1
  979. package/build-types/snackbar/index.d.ts +2 -2
  980. package/build-types/snackbar/index.d.ts.map +1 -1
  981. package/build-types/snackbar/list.d.ts +1 -1
  982. package/build-types/snackbar/list.d.ts.map +1 -1
  983. package/build-types/spacer/hook.d.ts +69 -59
  984. package/build-types/spacer/hook.d.ts.map +1 -1
  985. package/build-types/spinner/index.d.ts +2 -2
  986. package/build-types/spinner/index.d.ts.map +1 -1
  987. package/build-types/spinner/styles.d.ts +3 -3
  988. package/build-types/style-provider/index.d.ts +1 -1
  989. package/build-types/style-provider/index.d.ts.map +1 -1
  990. package/build-types/surface/hook.d.ts +69 -59
  991. package/build-types/surface/hook.d.ts.map +1 -1
  992. package/build-types/tab-panel/index.d.ts +1 -1
  993. package/build-types/tab-panel/index.d.ts.map +1 -1
  994. package/build-types/tab-panel/stories/index.story.d.ts +4 -4
  995. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  996. package/build-types/tabs/index.d.ts +2 -2
  997. package/build-types/tabs/index.d.ts.map +1 -1
  998. package/build-types/tabs/styles.d.ts +3 -3
  999. package/build-types/tabs/tablist.d.ts +1 -1
  1000. package/build-types/tabs/tablist.d.ts.map +1 -1
  1001. package/build-types/text/get-line-height.d.ts.map +1 -1
  1002. package/build-types/text/hook.d.ts +68 -59
  1003. package/build-types/text/hook.d.ts.map +1 -1
  1004. package/build-types/text/stories/index.story.d.ts +3 -3
  1005. package/build-types/text/utils.d.ts.map +1 -1
  1006. package/build-types/text-control/index.d.ts +3 -3
  1007. package/build-types/text-control/index.d.ts.map +1 -1
  1008. package/build-types/text-highlight/index.d.ts +1 -1
  1009. package/build-types/text-highlight/index.d.ts.map +1 -1
  1010. package/build-types/textarea-control/index.d.ts +2 -2
  1011. package/build-types/textarea-control/index.d.ts.map +1 -1
  1012. package/build-types/textarea-control/styles/textarea-control-styles.d.ts +1 -1
  1013. package/build-types/theme/color-algorithms.d.ts.map +1 -1
  1014. package/build-types/theme/index.d.ts +1 -1
  1015. package/build-types/theme/index.d.ts.map +1 -1
  1016. package/build-types/theme/stories/index.story.d.ts +1 -1
  1017. package/build-types/theme/styles.d.ts +1 -1
  1018. package/build-types/tip/index.d.ts +1 -1
  1019. package/build-types/tip/index.d.ts.map +1 -1
  1020. package/build-types/toggle-control/index.d.ts +2 -2
  1021. package/build-types/toggle-control/index.d.ts.map +1 -1
  1022. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  1023. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  1024. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
  1025. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  1026. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
  1027. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  1028. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -1
  1029. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
  1030. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  1031. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
  1032. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  1033. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +2 -2
  1034. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  1035. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  1036. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  1037. package/build-types/toolbar/stories/index.story.d.ts +3 -3
  1038. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  1039. package/build-types/toolbar/toolbar/index.d.ts +1 -1
  1040. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  1041. package/build-types/toolbar/toolbar/toolbar-container.d.ts +1 -1
  1042. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
  1043. package/build-types/toolbar/toolbar-button/index.d.ts +5 -51
  1044. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  1045. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +1 -1
  1046. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  1047. package/build-types/toolbar/toolbar-group/index.d.ts +1 -1
  1048. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
  1049. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +1 -1
  1050. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
  1051. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +1 -1
  1052. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
  1053. package/build-types/tools-panel/styles.d.ts +1 -1
  1054. package/build-types/tools-panel/tools-panel/hook.d.ts +71 -61
  1055. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  1056. package/build-types/tools-panel/tools-panel-header/hook.d.ts +70 -60
  1057. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  1058. package/build-types/tools-panel/tools-panel-item/hook.d.ts +69 -59
  1059. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  1060. package/build-types/tools-panel/types.d.ts +1 -1
  1061. package/build-types/tools-panel/types.d.ts.map +1 -1
  1062. package/build-types/tree-grid/index.d.ts +1 -1
  1063. package/build-types/tree-grid/index.d.ts.map +1 -1
  1064. package/build-types/tree-grid/item.d.ts +1 -1
  1065. package/build-types/tree-grid/item.d.ts.map +1 -1
  1066. package/build-types/tree-grid/roving-tab-index-item.d.ts +1 -1
  1067. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
  1068. package/build-types/tree-grid/roving-tab-index.d.ts +1 -1
  1069. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -1
  1070. package/build-types/tree-grid/row.d.ts +1 -1
  1071. package/build-types/tree-grid/row.d.ts.map +1 -1
  1072. package/build-types/tree-grid/stories/index.story.d.ts +1 -1
  1073. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  1074. package/build-types/tree-select/index.d.ts +1 -1
  1075. package/build-types/tree-select/index.d.ts.map +1 -1
  1076. package/build-types/truncate/hook.d.ts +69 -59
  1077. package/build-types/truncate/hook.d.ts.map +1 -1
  1078. package/build-types/unit-control/index.d.ts +1 -1
  1079. package/build-types/unit-control/index.d.ts.map +1 -1
  1080. package/build-types/unit-control/styles/unit-control-styles.d.ts +3 -3
  1081. package/build-types/unit-control/unit-select-control.d.ts +1 -1
  1082. package/build-types/utils/colors.d.ts.map +1 -1
  1083. package/build-types/utils/font-size.d.ts.map +1 -1
  1084. package/build-types/utils/get-valid-children.d.ts.map +1 -1
  1085. package/build-types/utils/input/base.d.ts.map +1 -1
  1086. package/build-types/utils/strings.d.ts.map +1 -1
  1087. package/build-types/utils/use-responsive-value.d.ts.map +1 -1
  1088. package/build-types/v-stack/hook.d.ts +69 -59
  1089. package/build-types/v-stack/hook.d.ts.map +1 -1
  1090. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  1091. package/build-types/view/component.d.ts +255 -7
  1092. package/build-types/view/component.d.ts.map +1 -1
  1093. package/build-types/z-stack/styles.d.ts +2 -2
  1094. package/package.json +22 -22
  1095. package/src/alignment-matrix-control/icon.tsx +2 -2
  1096. package/src/alignment-matrix-control/index.tsx +5 -6
  1097. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +4 -3
  1098. package/src/alignment-matrix-control/utils.tsx +6 -2
  1099. package/src/angle-picker-control/index.tsx +2 -2
  1100. package/src/animate/index.tsx +4 -7
  1101. package/src/autocomplete/autocompleter-ui.tsx +5 -3
  1102. package/src/autocomplete/index.tsx +21 -7
  1103. package/src/autocomplete/style.scss +10 -4
  1104. package/src/base-control/README.md +1 -1
  1105. package/src/base-control/hooks.ts +1 -5
  1106. package/src/base-control/index.tsx +2 -5
  1107. package/src/base-control/test/index.tsx +3 -3
  1108. package/src/base-control/types.ts +1 -2
  1109. package/src/border-control/types.ts +4 -0
  1110. package/src/box-control/test/index.tsx +22 -0
  1111. package/src/button/index.tsx +2 -2
  1112. package/src/button/style.scss +4 -6
  1113. package/src/button-group/index.tsx +2 -2
  1114. package/src/card/test/__snapshots__/index.tsx.snap +44 -47
  1115. package/src/checkbox-control/index.tsx +46 -37
  1116. package/src/checkbox-control/style.scss +12 -1
  1117. package/src/checkbox-control/test/__snapshots__/index.tsx.snap +27 -26
  1118. package/src/checkbox-control/test/index.tsx +5 -0
  1119. package/src/circular-option-picker/circular-option-picker-actions.tsx +3 -3
  1120. package/src/circular-option-picker/circular-option-picker-option-group.tsx +2 -2
  1121. package/src/circular-option-picker/circular-option-picker-option.tsx +2 -2
  1122. package/src/circular-option-picker/circular-option-picker.tsx +2 -5
  1123. package/src/circular-option-picker/style.scss +1 -2
  1124. package/src/clipboard-button/index.tsx +2 -2
  1125. package/src/color-indicator/index.tsx +2 -2
  1126. package/src/color-palette/index.tsx +2 -2
  1127. package/src/color-picker/hex-input.tsx +3 -1
  1128. package/src/color-picker/hue-picker.native.js +6 -2
  1129. package/src/color-picker/index.native.js +9 -3
  1130. package/src/color-picker/saturation-picker.native.js +6 -2
  1131. package/src/color-picker/use-deprecated-props.ts +9 -3
  1132. package/src/combobox-control/README.md +1 -1
  1133. package/src/combobox-control/index.tsx +8 -5
  1134. package/src/combobox-control/stories/index.story.tsx +28 -0
  1135. package/src/combobox-control/types.ts +1 -0
  1136. package/src/context/context-connect.ts +6 -2
  1137. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +3 -3
  1138. package/src/custom-gradient-picker/gradient-bar/index.tsx +2 -2
  1139. package/src/custom-gradient-picker/index.tsx +2 -2
  1140. package/src/custom-select-control/index.js +3 -6
  1141. package/src/custom-select-control-v2/README.md +0 -4
  1142. package/src/custom-select-control-v2/legacy-component/index.tsx +3 -1
  1143. package/src/custom-select-control-v2/stories/default.story.tsx +1 -1
  1144. package/src/custom-select-control-v2/stories/legacy.story.tsx +1 -1
  1145. package/src/dimension-control/index.tsx +2 -5
  1146. package/src/drop-zone/index.tsx +68 -68
  1147. package/src/dropdown/index.tsx +2 -2
  1148. package/src/dropdown/styles.ts +3 -1
  1149. package/src/dropdown-menu/index.native.js +6 -12
  1150. package/src/dropdown-menu/index.tsx +9 -16
  1151. package/src/duotone-picker/utils.ts +3 -1
  1152. package/src/elevation/hook.ts +6 -3
  1153. package/src/elevation/test/__snapshots__/index.tsx.snap +18 -24
  1154. package/src/external-link/index.tsx +2 -2
  1155. package/src/flex/test/__snapshots__/index.tsx.snap +4 -4
  1156. package/src/focal-point-picker/controls.tsx +3 -1
  1157. package/src/focal-point-picker/focal-point.tsx +2 -4
  1158. package/src/focal-point-picker/index.tsx +22 -12
  1159. package/src/focal-point-picker/styles/focal-point-picker-style.ts +4 -3
  1160. package/src/focal-point-picker/test/{index.js → index.tsx} +44 -17
  1161. package/src/focal-point-picker/test/{media.js → media.tsx} +18 -13
  1162. package/src/focal-point-picker/tooltip/index.native.js +1 -7
  1163. package/src/focal-point-picker/utils.ts +3 -1
  1164. package/src/font-size-picker/README.md +1 -0
  1165. package/src/font-size-picker/index.tsx +4 -2
  1166. package/src/font-size-picker/stories/index.story.tsx +0 -1
  1167. package/src/font-size-picker/types.ts +2 -0
  1168. package/src/form-toggle/index.tsx +2 -2
  1169. package/src/form-token-field/index.tsx +10 -8
  1170. package/src/form-token-field/style.scss +9 -0
  1171. package/src/form-token-field/suggestions-list.tsx +16 -10
  1172. package/src/form-token-field/token-input.tsx +2 -2
  1173. package/src/form-token-field/token.tsx +2 -2
  1174. package/src/guide/index.tsx +2 -2
  1175. package/src/higher-order/navigate-regions/style.scss +3 -3
  1176. package/src/input-control/index.tsx +3 -6
  1177. package/src/input-control/input-field.tsx +3 -1
  1178. package/src/input-control/label.tsx +3 -1
  1179. package/src/input-control/stories/index.story.tsx +31 -1
  1180. package/src/input-control/styles/input-control-styles.tsx +12 -4
  1181. package/src/input-control/test/index.js +10 -6
  1182. package/src/input-control/utils.ts +3 -2
  1183. package/src/item-group/item/hook.ts +1 -10
  1184. package/src/item-group/test/__snapshots__/index.js.snap +16 -16
  1185. package/src/menu-group/index.tsx +2 -2
  1186. package/src/menu-item/index.tsx +3 -3
  1187. package/src/mobile/color-settings/utils.native.js +1 -1
  1188. package/src/mobile/gradient/index.native.js +3 -1
  1189. package/src/mobile/keyboard-aware-flat-list/index.android.js +11 -2
  1190. package/src/mobile/keyboard-aware-flat-list/index.ios.js +30 -19
  1191. package/src/mobile/keyboard-aware-flat-list/shared.native.js +26 -0
  1192. package/src/mobile/keyboard-aware-flat-list/styles.native.scss +8 -0
  1193. package/src/modal/aria-helper.ts +8 -3
  1194. package/src/modal/index.tsx +10 -6
  1195. package/src/modal/test/index.tsx +11 -4
  1196. package/src/navigation/back-button/index.tsx +2 -5
  1197. package/src/navigation/group/index.tsx +2 -2
  1198. package/src/navigation/index.tsx +3 -3
  1199. package/src/navigation/item/base.tsx +2 -2
  1200. package/src/navigation/item/index.tsx +2 -2
  1201. package/src/navigation/menu/index.tsx +2 -2
  1202. package/src/navigation/styles/navigation-styles.tsx +4 -3
  1203. package/src/notice/index.tsx +5 -10
  1204. package/src/notice/list.tsx +2 -2
  1205. package/src/number-control/index.tsx +2 -2
  1206. package/src/palette-edit/index.tsx +10 -8
  1207. package/src/palette-edit/styles.ts +2 -3
  1208. package/src/panel/body.tsx +5 -3
  1209. package/src/panel/index.tsx +2 -2
  1210. package/src/panel/row.tsx +2 -2
  1211. package/src/panel/style.scss +1 -0
  1212. package/src/placeholder/index.tsx +3 -3
  1213. package/src/placeholder/style.scss +12 -35
  1214. package/src/popover/index.tsx +4 -3
  1215. package/src/popover/overlay-middlewares.tsx +3 -1
  1216. package/src/popover/stories/index.story.tsx +0 -2
  1217. package/src/query-controls/author-select.tsx +3 -1
  1218. package/src/radio-control/index.tsx +2 -2
  1219. package/src/range-control/index.tsx +3 -3
  1220. package/src/range-control/mark.tsx +3 -3
  1221. package/src/range-control/rail.tsx +1 -1
  1222. package/src/range-control/styles/range-control-styles.ts +5 -3
  1223. package/src/range-control/tooltip.tsx +2 -2
  1224. package/src/resizable-box/index.tsx +10 -10
  1225. package/src/resizable-box/resize-tooltip/index.tsx +5 -3
  1226. package/src/resizable-box/resize-tooltip/label.tsx +3 -1
  1227. package/src/resizable-box/resize-tooltip/utils.ts +12 -4
  1228. package/src/responsive-wrapper/index.tsx +2 -2
  1229. package/src/search-control/index.tsx +2 -5
  1230. package/src/select-control/index.tsx +5 -3
  1231. package/src/select-control/styles/select-control-styles.ts +3 -1
  1232. package/src/slot-fill/bubbles-virtually/slot-fill-context.ts +2 -1
  1233. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +1 -1
  1234. package/src/slot-fill/bubbles-virtually/use-slot-fills.ts +1 -1
  1235. package/src/slot-fill/bubbles-virtually/use-slot.ts +1 -1
  1236. package/src/slot-fill/types.ts +2 -2
  1237. package/src/snackbar/index.tsx +5 -8
  1238. package/src/snackbar/list.tsx +2 -2
  1239. package/src/spinner/index.tsx +2 -2
  1240. package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
  1241. package/src/tab-panel/index.tsx +2 -2
  1242. package/src/text/get-line-height.ts +6 -2
  1243. package/src/text/utils.ts +6 -2
  1244. package/src/text-control/index.tsx +2 -2
  1245. package/src/theme/color-algorithms.ts +6 -2
  1246. package/src/theme/stories/index.story.tsx +1 -1
  1247. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -26
  1248. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +3 -1
  1249. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +7 -6
  1250. package/src/toolbar/toolbar/index.tsx +2 -2
  1251. package/src/toolbar/toolbar/style.scss +2 -14
  1252. package/src/toolbar/toolbar-button/index.tsx +3 -3
  1253. package/src/toolbar/toolbar-group/index.tsx +2 -2
  1254. package/src/tools-panel/tools-panel/hook.ts +9 -6
  1255. package/src/tools-panel/tools-panel-item/hook.ts +12 -8
  1256. package/src/tools-panel/types.ts +1 -0
  1257. package/src/tree-grid/roving-tab-index-item.tsx +3 -1
  1258. package/src/truncate/hook.ts +1 -1
  1259. package/src/unit-control/index.tsx +7 -3
  1260. package/src/unit-control/unit-select-control.tsx +2 -2
  1261. package/src/utils/colors.js +21 -7
  1262. package/src/utils/font-size.ts +3 -1
  1263. package/src/utils/get-valid-children.ts +3 -1
  1264. package/src/utils/input/base.js +4 -3
  1265. package/src/utils/strings.ts +11 -59
  1266. package/src/utils/test/strings.js +62 -0
  1267. package/src/utils/theme-variables.scss +4 -0
  1268. package/src/utils/use-responsive-value.ts +2 -1
  1269. package/src/view/component.tsx +18 -11
  1270. package/tsconfig.json +1 -2
  1271. package/tsconfig.tsbuildinfo +1 -1
  1272. package/build/slot-fill/bubbles-virtually/observable-map.js +0 -68
  1273. package/build/slot-fill/bubbles-virtually/observable-map.js.map +0 -1
  1274. package/build/view/types.js +0 -6
  1275. package/build/view/types.js.map +0 -1
  1276. package/build-module/slot-fill/bubbles-virtually/observable-map.js +0 -60
  1277. package/build-module/slot-fill/bubbles-virtually/observable-map.js.map +0 -1
  1278. package/build-module/view/types.js +0 -2
  1279. package/build-module/view/types.js.map +0 -1
  1280. package/build-types/slot-fill/bubbles-virtually/observable-map.d.ts +0 -19
  1281. package/build-types/slot-fill/bubbles-virtually/observable-map.d.ts.map +0 -1
  1282. package/build-types/view/types.d.ts +0 -8
  1283. package/build-types/view/types.d.ts.map +0 -1
  1284. package/src/slot-fill/bubbles-virtually/observable-map.ts +0 -79
  1285. package/src/slot-fill/test/observable-map.js +0 -83
  1286. package/src/utils/hooks/stories/use-cx.js +0 -157
  1287. package/src/view/types.ts +0 -6
@@ -2,7 +2,7 @@ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import classnames from 'classnames';
5
+ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
@@ -53,7 +53,7 @@ function UnforwardedToolbar({
53
53
  });
54
54
  }
55
55
  // `ToolbarGroup` already uses components-toolbar for compatibility reasons.
56
- const finalClassName = classnames('components-accessible-toolbar', className, variant && `is-${variant}`);
56
+ const finalClassName = clsx('components-accessible-toolbar', className, variant && `is-${variant}`);
57
57
  return createElement(ContextSystemProvider, {
58
58
  value: contextSystemValue
59
59
  }, createElement(ToolbarContainer, {
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","forwardRef","useMemo","deprecated","ToolbarGroup","ToolbarContainer","ContextSystemProvider","UnforwardedToolbar","className","label","variant","props","ref","isVariantDefined","undefined","contextSystemValue","DropdownMenu","Dropdown","since","alternative","link","title","_title","restProps","createElement","isCollapsed","finalClassName","value","Toolbar"],"sources":["@wordpress/components/src/toolbar/toolbar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport ToolbarGroup from '../toolbar-group';\nimport ToolbarContainer from './toolbar-container';\nimport type { ToolbarProps } from './types';\nimport type { WordPressComponentProps } from '../../context';\nimport { ContextSystemProvider } from '../../context';\n\nfunction UnforwardedToolbar(\n\t{\n\t\tclassName,\n\t\tlabel,\n\t\tvariant,\n\t\t...props\n\t}: WordPressComponentProps< ToolbarProps, 'div', false >,\n\tref: ForwardedRef< any >\n) {\n\tconst isVariantDefined = variant !== undefined;\n\tconst contextSystemValue = useMemo( () => {\n\t\tif ( isVariantDefined ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn {\n\t\t\tDropdownMenu: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t\tDropdown: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t};\n\t}, [ isVariantDefined ] );\n\n\tif ( ! label ) {\n\t\tdeprecated( 'Using Toolbar without label prop', {\n\t\t\tsince: '5.6',\n\t\t\talternative: 'ToolbarGroup component',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar/',\n\t\t} );\n\t\t// Extracting title from `props` because `ToolbarGroup` doesn't accept it.\n\t\tconst { title: _title, ...restProps } = props;\n\t\treturn (\n\t\t\t<ToolbarGroup\n\t\t\t\tisCollapsed={ false }\n\t\t\t\t{ ...restProps }\n\t\t\t\tclassName={ className }\n\t\t\t/>\n\t\t);\n\t}\n\t// `ToolbarGroup` already uses components-toolbar for compatibility reasons.\n\tconst finalClassName = classnames(\n\t\t'components-accessible-toolbar',\n\t\tclassName,\n\t\tvariant && `is-${ variant }`\n\t);\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextSystemValue }>\n\t\t\t<ToolbarContainer\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tlabel={ label }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\n/**\n * Renders a toolbar.\n *\n * To add controls, simply pass `ToolbarButton` components as children.\n *\n * ```jsx\n * import { Toolbar, ToolbarButton } from '@wordpress/components';\n * import { formatBold, formatItalic, link } from '@wordpress/icons';\n *\n * function MyToolbar() {\n * return (\n * <Toolbar label=\"Options\">\n * <ToolbarButton icon={ formatBold } label=\"Bold\" />\n * <ToolbarButton icon={ formatItalic } label=\"Italic\" />\n * <ToolbarButton icon={ link } label=\"Link\" />\n * </Toolbar>\n * );\n * }\n * ```\n */\nexport const Toolbar = forwardRef( UnforwardedToolbar );\nexport default Toolbar;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AAGnC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,gBAAgB,MAAM,qBAAqB;AAGlD,SAASC,qBAAqB,QAAQ,eAAe;AAErD,SAASC,kBAAkBA,CAC1B;EACCC,SAAS;EACTC,KAAK;EACLC,OAAO;EACP,GAAGC;AACmD,CAAC,EACxDC,GAAwB,EACvB;EACD,MAAMC,gBAAgB,GAAGH,OAAO,KAAKI,SAAS;EAC9C,MAAMC,kBAAkB,GAAGb,OAAO,CAAE,MAAM;IACzC,IAAKW,gBAAgB,EAAG;MACvB,OAAO,CAAC,CAAC;IACV;IACA,OAAO;MACNG,YAAY,EAAE;QACbN,OAAO,EAAE;MACV,CAAC;MACDO,QAAQ,EAAE;QACTP,OAAO,EAAE;MACV;IACD,CAAC;EACF,CAAC,EAAE,CAAEG,gBAAgB,CAAG,CAAC;EAEzB,IAAK,CAAEJ,KAAK,EAAG;IACdN,UAAU,CAAE,kCAAkC,EAAE;MAC/Ce,KAAK,EAAE,KAAK;MACZC,WAAW,EAAE,wBAAwB;MACrCC,IAAI,EAAE;IACP,CAAE,CAAC;IACH;IACA,MAAM;MAAEC,KAAK,EAAEC,MAAM;MAAE,GAAGC;IAAU,CAAC,GAAGZ,KAAK;IAC7C,OACCa,aAAA,CAACpB,YAAY;MACZqB,WAAW,EAAG,KAAO;MAAA,GAChBF,SAAS;MACdf,SAAS,EAAGA;IAAW,CACvB,CAAC;EAEJ;EACA;EACA,MAAMkB,cAAc,GAAG1B,UAAU,CAChC,+BAA+B,EAC/BQ,SAAS,EACTE,OAAO,IAAK,MAAMA,OAAS,EAC5B,CAAC;EAED,OACCc,aAAA,CAAClB,qBAAqB;IAACqB,KAAK,EAAGZ;EAAoB,GAClDS,aAAA,CAACnB,gBAAgB;IAChBG,SAAS,EAAGkB,cAAgB;IAC5BjB,KAAK,EAAGA,KAAO;IACfG,GAAG,EAAGA,GAAK;IAAA,GACND;EAAK,CACV,CACqB,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMiB,OAAO,GAAG3B,UAAU,CAAEM,kBAAmB,CAAC;AACvD,eAAeqB,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["clsx","forwardRef","useMemo","deprecated","ToolbarGroup","ToolbarContainer","ContextSystemProvider","UnforwardedToolbar","className","label","variant","props","ref","isVariantDefined","undefined","contextSystemValue","DropdownMenu","Dropdown","since","alternative","link","title","_title","restProps","createElement","isCollapsed","finalClassName","value","Toolbar"],"sources":["@wordpress/components/src/toolbar/toolbar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport ToolbarGroup from '../toolbar-group';\nimport ToolbarContainer from './toolbar-container';\nimport type { ToolbarProps } from './types';\nimport type { WordPressComponentProps } from '../../context';\nimport { ContextSystemProvider } from '../../context';\n\nfunction UnforwardedToolbar(\n\t{\n\t\tclassName,\n\t\tlabel,\n\t\tvariant,\n\t\t...props\n\t}: WordPressComponentProps< ToolbarProps, 'div', false >,\n\tref: ForwardedRef< any >\n) {\n\tconst isVariantDefined = variant !== undefined;\n\tconst contextSystemValue = useMemo( () => {\n\t\tif ( isVariantDefined ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn {\n\t\t\tDropdownMenu: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t\tDropdown: {\n\t\t\t\tvariant: 'toolbar',\n\t\t\t},\n\t\t};\n\t}, [ isVariantDefined ] );\n\n\tif ( ! label ) {\n\t\tdeprecated( 'Using Toolbar without label prop', {\n\t\t\tsince: '5.6',\n\t\t\talternative: 'ToolbarGroup component',\n\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar/',\n\t\t} );\n\t\t// Extracting title from `props` because `ToolbarGroup` doesn't accept it.\n\t\tconst { title: _title, ...restProps } = props;\n\t\treturn (\n\t\t\t<ToolbarGroup\n\t\t\t\tisCollapsed={ false }\n\t\t\t\t{ ...restProps }\n\t\t\t\tclassName={ className }\n\t\t\t/>\n\t\t);\n\t}\n\t// `ToolbarGroup` already uses components-toolbar for compatibility reasons.\n\tconst finalClassName = clsx(\n\t\t'components-accessible-toolbar',\n\t\tclassName,\n\t\tvariant && `is-${ variant }`\n\t);\n\n\treturn (\n\t\t<ContextSystemProvider value={ contextSystemValue }>\n\t\t\t<ToolbarContainer\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tlabel={ label }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ContextSystemProvider>\n\t);\n}\n\n/**\n * Renders a toolbar.\n *\n * To add controls, simply pass `ToolbarButton` components as children.\n *\n * ```jsx\n * import { Toolbar, ToolbarButton } from '@wordpress/components';\n * import { formatBold, formatItalic, link } from '@wordpress/icons';\n *\n * function MyToolbar() {\n * return (\n * <Toolbar label=\"Options\">\n * <ToolbarButton icon={ formatBold } label=\"Bold\" />\n * <ToolbarButton icon={ formatItalic } label=\"Italic\" />\n * <ToolbarButton icon={ link } label=\"Link\" />\n * </Toolbar>\n * );\n * }\n * ```\n */\nexport const Toolbar = forwardRef( UnforwardedToolbar );\nexport default Toolbar;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM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C5BjB,KAAK,EAAGA,KAAO;IACfG,GAAG,EAAGA,GAAK;IAAA,GACND;EAAK,CACV,CACqB,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMiB,OAAO,GAAG3B,UAAU,CAAEM,kBAAmB,CAAC;AACvD,eAAeqB,OAAO","ignoreList":[]}
@@ -2,7 +2,7 @@ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import classnames from 'classnames';
5
+ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
@@ -42,7 +42,7 @@ function UnforwardedToolbarButton({
42
42
  props.onClick(event);
43
43
  }
44
44
  },
45
- className: classnames('components-toolbar__control', className),
45
+ className: clsx('components-toolbar__control', className),
46
46
  isPressed: isActive,
47
47
  disabled: isDisabled,
48
48
  "data-toolbar-item": true,
@@ -55,7 +55,7 @@ function UnforwardedToolbarButton({
55
55
  // all props to Button. This means that ToolbarButton has the same API as
56
56
  // Button.
57
57
  return createElement(ToolbarItem, {
58
- className: classnames('components-toolbar-button', className),
58
+ className: clsx('components-toolbar-button', className),
59
59
  ...extraProps,
60
60
  ...props,
61
61
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useContext","forwardRef","Button","ToolbarItem","ToolbarContext","ToolbarButtonContainer","UnforwardedToolbarButton","children","className","containerClassName","extraProps","isActive","isDisabled","title","props","ref","accessibleToolbarState","createElement","icon","label","shortcut","subscript","onClick","event","stopPropagation","isPressed","disabled","toolbarItemProps","ToolbarButton"],"sources":["@wordpress/components/src/toolbar/toolbar-button/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef, MouseEvent as ReactMouseEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport ToolbarItem from '../toolbar-item';\nimport ToolbarContext from '../toolbar-context';\nimport ToolbarButtonContainer from './toolbar-button-container';\nimport type { ToolbarButtonProps } from './types';\nimport type { WordPressComponentProps } from '../../context';\n\nfunction UnforwardedToolbarButton(\n\t{\n\t\tchildren,\n\t\tclassName,\n\t\tcontainerClassName,\n\t\textraProps,\n\t\tisActive,\n\t\tisDisabled,\n\t\ttitle,\n\t\t...props\n\t}: WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,\n\tref: ForwardedRef< any >\n) {\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ! accessibleToolbarState ) {\n\t\treturn (\n\t\t\t<ToolbarButtonContainer className={ containerClassName }>\n\t\t\t\t<Button\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ props.icon }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tshortcut={ props.shortcut }\n\t\t\t\t\tdata-subscript={ props.subscript }\n\t\t\t\t\tonClick={ (\n\t\t\t\t\t\tevent: ReactMouseEvent<\n\t\t\t\t\t\t\tHTMLButtonElement & HTMLAnchorElement,\n\t\t\t\t\t\t\tMouseEvent\n\t\t\t\t\t\t>\n\t\t\t\t\t) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t// TODO: Possible bug; maybe use onClick instead of props.onClick.\n\t\t\t\t\t\tif ( props.onClick ) {\n\t\t\t\t\t\t\tprops.onClick( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-toolbar__control',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tdata-toolbar-item\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Button>\n\t\t\t</ToolbarButtonContainer>\n\t\t);\n\t}\n\n\t// ToobarItem will pass all props to the render prop child, which will pass\n\t// all props to Button. This means that ToolbarButton has the same API as\n\t// Button.\n\treturn (\n\t\t<ToolbarItem\n\t\t\tclassName={ classnames( 'components-toolbar-button', className ) }\n\t\t\t{ ...extraProps }\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ ( toolbarItemProps ) => (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\t{ ...toolbarItemProps }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\n/**\n * ToolbarButton can be used to add actions to a toolbar, usually inside a Toolbar\n * or ToolbarGroup when used to create general interfaces.\n *\n * ```jsx\n * import { Toolbar, ToolbarButton } from '@wordpress/components';\n * import { edit } from '@wordpress/icons';\n *\n * function MyToolbar() {\n * return (\n *\t\t<Toolbar label=\"Options\">\n *\t\t\t<ToolbarButton\n *\t\t\t\ticon={ edit }\n *\t\t\t\tlabel=\"Edit\"\n *\t\t\t\tonClick={ () => alert( 'Editing' ) }\n *\t\t\t/>\n *\t\t</Toolbar>\n * );\n * }\n * ```\n */\nexport const ToolbarButton = forwardRef( UnforwardedToolbarButton );\nexport default ToolbarButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AAGnC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,sBAAsB,MAAM,4BAA4B;AAI/D,SAASC,wBAAwBA,CAChC;EACCC,QAAQ;EACRC,SAAS;EACTC,kBAAkB;EAClBC,UAAU;EACVC,QAAQ;EACRC,U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AAa,GAAG3B,UAAU,CAAEK,wBAAyB,CAAC;AACnE,eAAesB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useContext","forwardRef","Button","ToolbarItem","ToolbarContext","ToolbarButtonContainer","UnforwardedToolbarButton","children","className","containerClassName","extraProps","isActive","isDisabled","title","props","ref","accessibleToolbarState","createElement","icon","label","shortcut","subscript","onClick","event","stopPropagation","isPressed","disabled","toolbarItemProps","ToolbarButton"],"sources":["@wordpress/components/src/toolbar/toolbar-button/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef, MouseEvent as ReactMouseEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport ToolbarItem from '../toolbar-item';\nimport ToolbarContext from '../toolbar-context';\nimport ToolbarButtonContainer from './toolbar-button-container';\nimport type { ToolbarButtonProps } from './types';\nimport type { WordPressComponentProps } from '../../context';\n\nfunction UnforwardedToolbarButton(\n\t{\n\t\tchildren,\n\t\tclassName,\n\t\tcontainerClassName,\n\t\textraProps,\n\t\tisActive,\n\t\tisDisabled,\n\t\ttitle,\n\t\t...props\n\t}: WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,\n\tref: ForwardedRef< any >\n) {\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ! accessibleToolbarState ) {\n\t\treturn (\n\t\t\t<ToolbarButtonContainer className={ containerClassName }>\n\t\t\t\t<Button\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ props.icon }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tshortcut={ props.shortcut }\n\t\t\t\t\tdata-subscript={ props.subscript }\n\t\t\t\t\tonClick={ (\n\t\t\t\t\t\tevent: ReactMouseEvent<\n\t\t\t\t\t\t\tHTMLButtonElement & HTMLAnchorElement,\n\t\t\t\t\t\t\tMouseEvent\n\t\t\t\t\t\t>\n\t\t\t\t\t) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t// TODO: Possible bug; maybe use onClick instead of props.onClick.\n\t\t\t\t\t\tif ( props.onClick ) {\n\t\t\t\t\t\t\tprops.onClick( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'components-toolbar__control',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tdata-toolbar-item\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Button>\n\t\t\t</ToolbarButtonContainer>\n\t\t);\n\t}\n\n\t// ToobarItem will pass all props to the render prop child, which will pass\n\t// all props to Button. This means that ToolbarButton has the same API as\n\t// Button.\n\treturn (\n\t\t<ToolbarItem\n\t\t\tclassName={ clsx( 'components-toolbar-button', className ) }\n\t\t\t{ ...extraProps }\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ ( toolbarItemProps ) => (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\t{ ...toolbarItemProps }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\n/**\n * ToolbarButton can be used to add actions to a toolbar, usually inside a Toolbar\n * or ToolbarGroup when used to create general interfaces.\n *\n * ```jsx\n * import { Toolbar, ToolbarButton } from '@wordpress/components';\n * import { edit } from '@wordpress/icons';\n *\n * function MyToolbar() {\n * return (\n *\t\t<Toolbar label=\"Options\">\n *\t\t\t<ToolbarButton\n *\t\t\t\ticon={ edit }\n *\t\t\t\tlabel=\"Edit\"\n *\t\t\t\tonClick={ () => alert( 'Editing' ) }\n *\t\t\t/>\n *\t\t</Toolbar>\n * );\n * }\n * ```\n */\nexport const ToolbarButton = forwardRef( UnforwardedToolbarButton );\nexport default ToolbarButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,sBAAsB,MAAM,4BAA4B;AAI/D,SAASC,wBAAwBA,CAChC;EACCC,QAAQ;EACRC,SAAS;EACTC,kBAAkB;EAClBC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,KAAK;EACL,GAAGC;AACiE,CAAC,EACtEC,GAAwB,EACvB;EACD,MAAMC,sBAAsB,GAAGhB,UAAU,CAAEI,cAAe,CAAC;EAE3D,IAAK,CAAEY,sBAAsB,EAAG;IAC/B,OACCC,aAAA,CAACZ,sBAAsB;MAACG,SAAS,EAAGC;IAAoB,GACvDQ,aAAA,CAACf,MAAM;MACNa,GAAG,EAAGA,GAAK;MACXG,IAAI,EAAGJ,KAAK,CAACI,IAAM;MACnBC,KAAK,EAAGN,KAAO;MACfO,QAAQ,EAAGN,KAAK,CAACM,QAAU;MAC3B,kBAAiBN,KAAK,CAACO,SAAW;MAClCC,OAAO,EACNC,KAGC,IACG;QACJA,KAAK,CAACC,eAAe,CAAC,CAAC;QACvB;QACA,IAAKV,KAAK,CAACQ,OAAO,EAAG;UACpBR,KAAK,CAACQ,OAAO,CAAEC,KAAM,CAAC;QACvB;MACD,CAAG;MACHf,SAAS,EAAGT,IAAI,CACf,6BAA6B,EAC7BS,SACD,CAAG;MACHiB,SAAS,EAAGd,QAAU;MACtBe,QAAQ,EAAGd,UAAY;MACvB,yBAAiB;MAAA,GACZF,UAAU;MAAA,GACVI;IAAK,GAERP,QACK,CACe,CAAC;EAE3B;;EAEA;EACA;EACA;EACA,OACCU,aAAA,CAACd,WAAW;IACXK,SAAS,EAAGT,IAAI,CAAE,2BAA2B,EAAES,SAAU,CAAG;IAAA,GACvDE,UAAU;IAAA,GACVI,KAAK;IACVC,GAAG,EAAGA;EAAK,GAEPY,gBAAgB,IACnBV,aAAA,CAACf,MAAM;IACNiB,KAAK,EAAGN,KAAO;IACfY,SAAS,EAAGd,QAAU;IACtBe,QAAQ,EAAGd,UAAY;IAAA,GAClBe;EAAgB,GAEnBpB,QACK,CAEG,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMqB,aAAa,GAAG3B,UAAU,CAAEK,wBAAyB,CAAC;AACnE,eAAesB,aAAa","ignoreList":[]}
@@ -2,7 +2,7 @@ import { createElement } from "react";
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import classnames from 'classnames';
5
+ import clsx from 'clsx';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -64,7 +64,7 @@ function ToolbarGroup({
64
64
  if ((!controls || !controls.length) && !children) {
65
65
  return null;
66
66
  }
67
- const finalClassName = classnames(
67
+ const finalClassName = clsx(
68
68
  // Unfortunately, there's legacy code referencing to `.components-toolbar`
69
69
  // So we can't get rid of it
70
70
  accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className);
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useContext","ToolbarButton","ToolbarGroupContainer","ToolbarGroupCollapsed","ToolbarContext","isNestedArray","arr","Array","isArray","ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","length","finalClassName","controlSets","createElement","label","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","containerClassName","undefined"],"sources":["@wordpress/components/src/toolbar/toolbar-group/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarButton from '../toolbar-button';\nimport ToolbarGroupContainer from './toolbar-group-container';\nimport ToolbarGroupCollapsed from './toolbar-group-collapsed';\nimport ToolbarContext from '../toolbar-context';\nimport type { ToolbarGroupProps, ToolbarGroupControls } from './types';\n\nfunction isNestedArray< T = any >( arr: T[] | T[][] ): arr is T[][] {\n\treturn Array.isArray( arr ) && Array.isArray( arr[ 0 ] );\n}\n\n/**\n * Renders a collapsible group of controls\n *\n * The `controls` prop accepts an array of sets. A set is an array of controls.\n * Controls have the following shape:\n *\n * ```\n * {\n * icon: string,\n * title: string,\n * subscript: string,\n * onClick: Function,\n * isActive: boolean,\n * isDisabled: boolean\n * }\n * ```\n *\n * For convenience it is also possible to pass only an array of controls. It is\n * then assumed this is the only set.\n *\n * Either `controls` or `children` is required, otherwise this components\n * renders nothing.\n *\n * @param props Component props.\n * @param [props.controls] The controls to render in this toolbar.\n * @param [props.children] Any other things to render inside the toolbar besides the controls.\n * @param [props.className] Class to set on the container div.\n * @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.\n * @param [props.title] ARIA label for dropdown menu if is collapsed.\n */\nfunction ToolbarGroup( {\n\tcontrols = [],\n\tchildren,\n\tclassName,\n\tisCollapsed,\n\ttitle,\n\t...props\n}: ToolbarGroupProps ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ( ! controls || ! controls.length ) && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst finalClassName = classnames(\n\t\t// Unfortunately, there's legacy code referencing to `.components-toolbar`\n\t\t// So we can't get rid of it\n\t\taccessibleToolbarState\n\t\t\t? 'components-toolbar-group'\n\t\t\t: 'components-toolbar',\n\t\tclassName\n\t);\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: ToolbarGroupControls[][];\n\tif ( isNestedArray( controls ) ) {\n\t\tcontrolSets = controls;\n\t} else {\n\t\tcontrolSets = [ controls ];\n\t}\n\n\tif ( isCollapsed ) {\n\t\treturn (\n\t\t\t<ToolbarGroupCollapsed\n\t\t\t\tlabel={ title }\n\t\t\t\tcontrols={ controlSets }\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tchildren={ children }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarGroupContainer className={ finalClassName } { ...props }>\n\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\tcontrolSet.map( ( control, indexOfControl: number ) => (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tkey={ [ indexOfSet, indexOfControl ].join() }\n\t\t\t\t\t\tcontainerClassName={\n\t\t\t\t\t\t\tindexOfSet > 0 && indexOfControl === 0\n\t\t\t\t\t\t\t\t? 'has-left-divider'\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...control }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t\t{ children }\n\t\t</ToolbarGroupContainer>\n\t);\n}\n\nexport default ToolbarGroup;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,qBAAqB,MAAM,2BAA2B;AAC7D,OAAOC,qBAAqB,MAAM,2BAA2B;AAC7D,OAAOC,cAAc,MAAM,oBAAoB;AAG/C,SAASC,aAAaA,CAAaC,GAAgB,EAAiB;EACnE,OAAOC,KAAK,CAACC,OAAO,CAAEF,GAAI,CAAC,IAAIC,KAAK,CAACC,OAAO,CAAEF,GAAG,CAAE,CAAC,CAAG,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA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,GAAG,CAAC,IAAIG,cAAc,KAAK,CAAC,GACnC,kBAAkB,GAClBI,SACH;IAAA,GACIL;EAAO,CACZ,CACA,CACH,CAAC,EACCf,QACoB,CAAC;AAE1B;AAEA,eAAeF,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useContext","ToolbarButton","ToolbarGroupContainer","ToolbarGroupCollapsed","ToolbarContext","isNestedArray","arr","Array","isArray","ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","length","finalClassName","controlSets","createElement","label","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","containerClassName","undefined"],"sources":["@wordpress/components/src/toolbar/toolbar-group/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarButton from '../toolbar-button';\nimport ToolbarGroupContainer from './toolbar-group-container';\nimport ToolbarGroupCollapsed from './toolbar-group-collapsed';\nimport ToolbarContext from '../toolbar-context';\nimport type { ToolbarGroupProps, ToolbarGroupControls } from './types';\n\nfunction isNestedArray< T = any >( arr: T[] | T[][] ): arr is T[][] {\n\treturn Array.isArray( arr ) && Array.isArray( arr[ 0 ] );\n}\n\n/**\n * Renders a collapsible group of controls\n *\n * The `controls` prop accepts an array of sets. A set is an array of controls.\n * Controls have the following shape:\n *\n * ```\n * {\n * icon: string,\n * title: string,\n * subscript: string,\n * onClick: Function,\n * isActive: boolean,\n * isDisabled: boolean\n * }\n * ```\n *\n * For convenience it is also possible to pass only an array of controls. It is\n * then assumed this is the only set.\n *\n * Either `controls` or `children` is required, otherwise this components\n * renders nothing.\n *\n * @param props Component props.\n * @param [props.controls] The controls to render in this toolbar.\n * @param [props.children] Any other things to render inside the toolbar besides the controls.\n * @param [props.className] Class to set on the container div.\n * @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.\n * @param [props.title] ARIA label for dropdown menu if is collapsed.\n */\nfunction ToolbarGroup( {\n\tcontrols = [],\n\tchildren,\n\tclassName,\n\tisCollapsed,\n\ttitle,\n\t...props\n}: ToolbarGroupProps ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ( ! controls || ! controls.length ) && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst finalClassName = clsx(\n\t\t// Unfortunately, there's legacy code referencing to `.components-toolbar`\n\t\t// So we can't get rid of it\n\t\taccessibleToolbarState\n\t\t\t? 'components-toolbar-group'\n\t\t\t: 'components-toolbar',\n\t\tclassName\n\t);\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: ToolbarGroupControls[][];\n\tif ( isNestedArray( controls ) ) {\n\t\tcontrolSets = controls;\n\t} else {\n\t\tcontrolSets = [ controls ];\n\t}\n\n\tif ( isCollapsed ) {\n\t\treturn (\n\t\t\t<ToolbarGroupCollapsed\n\t\t\t\tlabel={ title }\n\t\t\t\tcontrols={ controlSets }\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tchildren={ children }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarGroupContainer className={ finalClassName } { ...props }>\n\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\tcontrolSet.map( ( control, indexOfControl: number ) => (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tkey={ [ indexOfSet, indexOfControl ].join() }\n\t\t\t\t\t\tcontainerClassName={\n\t\t\t\t\t\t\tindexOfSet > 0 && indexOfControl === 0\n\t\t\t\t\t\t\t\t? 'has-left-divider'\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...control }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t\t{ children }\n\t\t</ToolbarGroupContainer>\n\t);\n}\n\nexport default ToolbarGroup;\n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GP,KAAO;MACfJ,QAAQ,EAAGS,WAAa;MACxBP,SAAS,EAAGM,cAAgB;MAC5BP,QAAQ,EAAGA,QAAU;MAAA,GAChBI;IAAK,CACV,CAAC;EAEJ;EAEA,OACCK,aAAA,CAAClB,qBAAqB;IAACU,SAAS,EAAGM,cAAgB;IAAA,GAAMH;EAAK,GAC3DI,WAAW,EAAEG,OAAO,CAAE,CAAEC,UAAU,EAAEC,UAAU,KAC/CD,UAAU,CAACE,GAAG,CAAE,CAAEC,OAAO,EAAEC,cAAsB,KAChDP,aAAA,CAACnB,aAAa;IACb2B,GAAG,EAAG,CAAEJ,UAAU,EAAEG,cAAc,CAAE,CAACE,IAAI,CAAC,CAAG;IAC7CC,kBAAkB,EACjBN,UAAU,GAAG,CAAC,IAAIG,cAAc,KAAK,CAAC,GACnC,kBAAkB,GAClBI,SACH;IAAA,GACIL;EAAO,CACZ,CACA,CACH,CAAC,EACCf,QACoB,CAAC;AAE1B;AAEA,eAAeF,YAAY","ignoreList":[]}
@@ -162,17 +162,16 @@ export function useToolsPanel(props) {
162
162
  });
163
163
  }, [panelItems, setMenuItems, menuItemOrder]);
164
164
 
165
- // Force a menu item to be checked.
166
- // This is intended for use with default panel items. They are displayed
167
- // separately to optional items and have different display states,
168
- // we need to update that when their value is customized.
169
- const flagItemCustomization = useCallback((label, group = 'default') => {
165
+ // Updates the status of the panel’s menu items. For default items the
166
+ // value represents whether it differs from the default and for optional
167
+ // items whether the item is shown.
168
+ const flagItemCustomization = useCallback((value, label, group = 'default') => {
170
169
  setMenuItems(items => {
171
170
  const newState = {
172
171
  ...items,
173
172
  [group]: {
174
173
  ...items[group],
175
- [label]: true
174
+ [label]: value
176
175
  }
177
176
  };
178
177
  return newState;
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","styles","useContextSystem","useCx","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItemOrder","newMenuItems","default","optional","menuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","hasOwnProperty","Object","keys","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","setMenuItemOrder","resetAllFilters","setResetAllFilters","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","includes","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ menuItemOrder, setMenuItemOrder ] = useState< string[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\t// Add item to panel items.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tsetMenuItemOrder( ( items ) => {\n\t\t\t\tif ( items.includes( item.label ) ) {\n\t\t\t\t\treturn items;\n\t\t\t\t}\n\n\t\t\t\treturn [ ...items, item.label ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems, setMenuItemOrder ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t\tmenuItemOrder,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems, menuItemOrder ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tmenuItemOrder,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACF,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AAEnC,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,QAAQ,0BAA0B;AAUhD,MAAMC,eAAe,GAAG,CAAC;AAEzB,MAAMC,iBAAiB,GAAGA,CAAE;EAC3BC,UAAU;EACVC,WAAW;EACXC,gBAAgB;EAChBC;AAC0B,CAAC,KAAM;EACjC,MAAMC,YAAiC,GAAG;IAAEC,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE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CAAE,GAAGhF,UAAU,CAAE,CAACqF,OAAO,CAAC,CAC3B,CAAC;EAED,MAAMC,YAAY,GAAG9F,OAAO,CAC3B,OAAQ;IACPqE,4BAA4B;IAC5BZ,mBAAmB;IACnBK,wBAAwB;IACxB6B,kBAAkB;IAClBxB,qBAAqB;IACrB4B,YAAY,EAAE,CAAC,CAAEvF,UAAU,CAACqB,MAAM;IAClCY,WAAW,EAAEA,WAAW,CAACE,OAAO;IAChCiD,iBAAiB;IACjB7E,SAAS;IACToB,OAAO;IACPa,iBAAiB;IACjBW,sBAAsB;IACtBtB,4BAA4B;IAC5BC,mCAAmC;IACnCC;EACD,CAAC,CAAE,EACH,CACC8B,4BAA4B,EAC5BZ,mBAAmB,EACnBK,wBAAwB,EACxB6B,kBAAkB,EAClBxB,qBAAqB,EACrByB,iBAAiB,EACjB7E,SAAS,EACToB,OAAO,EACP3B,UAAU,EACVmD,sBAAsB,EACtBX,iBAAiB,EACjBX,4BAA4B,EAC5BC,mCAAmC,EACnCC,kCAAkC,CAEpC,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbP,YAAY;IACZ6D,YAAY;IACZR,aAAa;IACbJ,UAAU;IACVlD,SAAS,EAAE4C;EACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","styles","useContextSystem","useCx","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItemOrder","newMenuItems","default","optional","menuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","hasOwnProperty","Object","keys","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","setMenuItemOrder","resetAllFilters","setResetAllFilters","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","includes","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ menuItemOrder, setMenuItemOrder ] = useState< string[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\t// Add item to panel items.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tsetMenuItemOrder( ( items ) => {\n\t\t\t\tif ( items.includes( item.label ) ) {\n\t\t\t\t\treturn items;\n\t\t\t\t}\n\n\t\t\t\treturn [ ...items, item.label ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems, setMenuItemOrder ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t\tmenuItemOrder,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems, menuItemOrder ] );\n\n\t// Updates the status of the panel’s menu items. For default items the\n\t// value represents whether it differs from the default and for optional\n\t// items whether the item is shown.\n\tconst flagItemCustomization = useCallback(\n\t\t(\n\t\t\tvalue: boolean,\n\t\t\tlabel: string,\n\t\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t\t) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: value,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tmenuItemOrder,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACF,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AAEnC,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,QAAQ,0BAA0B;AAUhD,MAAMC,eAAe,GAAG,CAAC;AAEzB,MAAMC,iBAAiB,GAAGA,CAAE;EAC3BC,UAAU;EACVC,WAAW;EACXC,gBAAgB;EAChBC;AAC0B,CAAC,KAAM;EACjC,MAAMC,YAAiC,GAAG;IAAEC,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAC;EACvE,MAAMC,SAA8B,GAAG;IAAEF,OAAO,EAAE,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;EAAE,CAAC;EAEpEN,UAAU,CAACQ,OAAO,CAAE,CAAE;IAAEC,QAAQ;IAAEC,gBAAgB;IAAEC;EAAM,CAAC,KAAM;IAChE,MAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAS,GAAG,UAAU;;IAEvD;IACA;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AW,CAACE,OAAO;IAChCiD,iBAAiB;IACjB7E,SAAS;IACToB,OAAO;IACPa,iBAAiB;IACjBW,sBAAsB;IACtBtB,4BAA4B;IAC5BC,mCAAmC;IACnCC;EACD,CAAC,CAAE,EACH,CACC8B,4BAA4B,EAC5BZ,mBAAmB,EACnBK,wBAAwB,EACxB6B,kBAAkB,EAClBxB,qBAAqB,EACrByB,iBAAiB,EACjB7E,SAAS,EACToB,OAAO,EACP3B,UAAU,EACVmD,sBAAsB,EACtBX,iBAAiB,EACjBX,4BAA4B,EAC5BC,mCAAmC,EACnCC,kCAAkC,CAEpC,CAAC;EAED,OAAO;IACN,GAAGC,UAAU;IACbP,YAAY;IACZ6D,YAAY;IACZR,aAAa;IACbJ,UAAU;IACVlD,SAAS,EAAE4C;EACZ,CAAC;AACF","ignoreList":[]}
@@ -90,16 +90,14 @@ export function useToolsPanelItem(props) {
90
90
  const wasMenuItemChecked = usePrevious(isMenuItemChecked);
91
91
  const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;
92
92
  const isValueSet = hasValue();
93
- const wasValueSet = usePrevious(isValueSet);
94
- const newValueSet = isValueSet && !wasValueSet;
95
-
96
- // Notify the panel when an item's value has been set.
93
+ // Notify the panel when an item's value has changed except for optional
94
+ // items without value because the item should not cause itself to hide.
97
95
  useEffect(() => {
98
- if (!newValueSet) {
96
+ if (!isShownByDefault && !isValueSet) {
99
97
  return;
100
98
  }
101
- flagItemCustomization(label, menuGroup);
102
- }, [newValueSet, menuGroup, label, flagItemCustomization]);
99
+ flagItemCustomization(isValueSet, label, menuGroup);
100
+ }, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
103
101
 
104
102
  // Determine if the panel item's corresponding menu is being toggled and
105
103
  // trigger appropriate callback if it is.
@@ -113,7 +111,7 @@ export function useToolsPanelItem(props) {
113
111
  if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
114
112
  onSelect?.();
115
113
  }
116
- if (!isMenuItemChecked && wasMenuItemChecked) {
114
+ if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {
117
115
  onDeselect?.();
118
116
  }
119
117
  }, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);
@@ -1 +1 @@
1
- {"version":3,"names":["usePrevious","useCallback","useEffect","useLayoutEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","wasValueSet","newValueSet","isShown","cx","classes","shouldApplyPlaceholderStyles","firstItemStyle","lastItemStyle","ToolsPanelItem","ToolsPanelItemPlaceholder"],"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\t// hasValue is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\t// resetAllFilter is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\t//\n\t// This is performed in a layout effect to ensure that the panel item\n\t// is registered before it is rendered preventing a rendering glitch.\n\t// See: https://github.com/WordPress/gutenberg/issues/56470\n\tuseLayoutEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\tconst newValueSet = isValueSet && ! wasValueSet;\n\n\t// Notify the panel when an item's value has been set.\n\tuseEffect( () => {\n\t\tif ( ! newValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tflagItemCustomization( label, menuGroup );\n\t}, [ newValueSet, menuGroup, label, flagItemCustomization ] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst shouldApplyPlaceholderStyles =\n\t\t\tshouldRenderPlaceholder && ! isShown;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tshouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,\n\t\t\t! shouldApplyPlaceholderStyles && className,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,OAAO,QACD,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AACnC,SAASC,oBAAoB,QAAQ,YAAY;AAEjD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ACN,GAAGK,UAAU;IACb2B,OAAO;IACPjB,uBAAuB;IACvBlB,SAAS,EAAEqC;EACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["usePrevious","useCallback","useEffect","useLayoutEffect","useMemo","styles","useToolsPanelContext","useContextSystem","useCx","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","hasValueCallback","resetAllFilterCallback","previousPanelId","hasMatchingPanel","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","isShown","cx","classes","shouldApplyPlaceholderStyles","firstItemStyle","lastItemStyle","ToolsPanelItem","ToolsPanelItemPlaceholder"],"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\t// hasValue is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\t// resetAllFilter is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\t//\n\t// This is performed in a layout effect to ensure that the panel item\n\t// is registered before it is rendered preventing a rendering glitch.\n\t// See: https://github.com/WordPress/gutenberg/issues/56470\n\tuseLayoutEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\t// Notify the panel when an item's value has changed except for optional\n\t// items without value because the item should not cause itself to hide.\n\tuseEffect( () => {\n\t\tif ( ! isShownByDefault && ! isValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tflagItemCustomization( isValueSet, label, menuGroup );\n\t}, [\n\t\tisValueSet,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t\tisShownByDefault,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && isValueSet && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst shouldApplyPlaceholderStyles =\n\t\t\tshouldRenderPlaceholder && ! isShown;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tshouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,\n\t\t\t! shouldApplyPlaceholderStyles && className,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,SACCC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,OAAO,QACD,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAO,KAAKC,MAAM,MAAM,WAAW;AACnC,SAASC,oBAAoB,QAAQ,YAAY;AAEjD,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KA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]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/tools-panel/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\nimport type { DropdownMenu } from '../dropdown-menu';\n\nexport type ResetAllFilter = ( attributes?: any ) => any;\ntype ResetAll = ( filters?: ResetAllFilter[] ) => void;\n\nexport type ToolsPanelProps = {\n\t/**\n\t * The child elements.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * Flags that the items in this ToolsPanel will be contained within an inner\n\t * wrapper element allowing the panel to lay them out accordingly.\n\t *\n\t * @default false\n\t */\n\thasInnerWrapper?: boolean;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel's header and as the `aria-label`\n\t * for the panel's dropdown menu.\n\t */\n\tlabel: string;\n\t/**\n\t * If a `panelId` is set, it is passed through the `ToolsPanelContext` and\n\t * used to restrict panel items. When a `panelId` is set, items can only\n\t * register themselves if the `panelId` is explicitly `null` or the item's\n\t * `panelId` matches exactly.\n\t */\n\tpanelId?: string | null;\n\t/**\n\t * A function to call when the `Reset all` menu option is selected. As an\n\t * argument, it receives an array containing the `resetAllFilter` callbacks\n\t * of all the valid registered `ToolsPanelItems`.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render\n\t * placeholder content instead of null when they are toggled off and hidden.\n\t * Note that placeholder items won't apply the `className` that would be\n\t * normally applied to a visible `ToolsPanelItem` via the `className` prop.\n\t *\n\t * @default false\n\t */\n\tshouldRenderPlaceholderItems?: boolean;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * first visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalFirstVisibleItemClass?: string;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * last visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelHeaderProps = {\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel header. It is also passed along as\n\t * the `label` for the panel header's `DropdownMenu`.\n\t */\n\tlabel: string;\n\t/**\n\t * The `resetAll` prop provides the callback to execute when the \"Reset all\"\n\t * menu item is selected. Its purpose is to facilitate resetting any control\n\t * values for items contained within this header's panel.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * This is executed when an individual control's menu item is toggled. It\n\t * will update the panel's menu item state and call the panel item's\n\t * `onSelect` or `onDeselect` callbacks as appropriate.\n\t */\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelItem = {\n\t/**\n\t * This is called when building the `ToolsPanel` menu to determine the\n\t * item's initial checked state.\n\t */\n\thasValue: () => boolean;\n\t/**\n\t * This prop identifies the current item as being displayed by default. This\n\t * means it will show regardless of whether it has a value set or is toggled\n\t * on in the panel's menu.\n\t *\n\t * @default false\n\t */\n\tisShownByDefault?: boolean;\n\t/**\n\t * The supplied label is dual purpose. It is used as:\n\t * 1. the human-readable label for the panel's dropdown menu\n\t * 2. a key to locate the corresponding item in the panel's menu context to\n\t * determine if the panel item should be displayed.\n\t * A panel item's `label` should be unique among all items within a single\n\t * panel.\n\t */\n\tlabel: string;\n\t/**\n\t * Panel items will ensure they are only registering with their intended panel\n\t * by comparing the `panelId` props set on both the item and the panel itself,\n\t * or if the `panelId` is explicitly `null`. This allows items to be injected\n\t * from a shared source.\n\t */\n\tpanelId?: string | null;\n};\n\nexport type ToolsPanelItemProps = ToolsPanelItem & {\n\t/**\n\t * The child elements.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Called when this item is deselected in the `ToolsPanel` menu. This is\n\t * normally used to reset the panel item control's value.\n\t */\n\tonDeselect?: () => void;\n\t/**\n\t * A callback to take action when this item is selected in the `ToolsPanel`\n\t * menu.\n\t */\n\tonSelect?: () => void;\n\n\t/**\n\t * A `ToolsPanel` will collect each item's `resetAllFilter` and pass an\n\t * array of these functions through to the panel's `resetAll` callback. They\n\t * can then be iterated over to perform additional tasks.\n\t *\n\t * @default noop\n\t */\n\tresetAllFilter?: ResetAllFilter;\n};\n\nexport type ToolsPanelMenuItemKey = 'default' | 'optional';\n\nexport type ToolsPanelMenuItems = {\n\t[ menuItemKey in ToolsPanelMenuItemKey ]: { [ key: string ]: boolean };\n};\n\nexport type ToolsPanelContext = {\n\tpanelId?: string | null;\n\tmenuItems: ToolsPanelMenuItems;\n\thasMenuItems: boolean;\n\tregisterPanelItem: ( item: ToolsPanelItem ) => void;\n\tderegisterPanelItem: ( label: string ) => void;\n\tregisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tderegisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tflagItemCustomization: (\n\t\tlabel: string,\n\t\tgroup?: ToolsPanelMenuItemKey\n\t) => void;\n\tisResetting: boolean;\n\tshouldRenderPlaceholderItems: boolean;\n\tareAllOptionalControlsHidden: boolean;\n\tfirstDisplayedItem?: string;\n\tlastDisplayedItem?: string;\n\t__experimentalFirstVisibleItemClass?: string;\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelControlsGroupProps = {\n\titemClassName?: string;\n\titems: [ string, boolean ][];\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelMenuItemsConfig = {\n\tpanelItems: ToolsPanelItem[];\n\tshouldReset: boolean;\n\tcurrentMenuItems?: ToolsPanelMenuItems;\n\tmenuItemOrder: string[];\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/tools-panel/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\nimport type { DropdownMenu } from '../dropdown-menu';\n\nexport type ResetAllFilter = ( attributes?: any ) => any;\ntype ResetAll = ( filters?: ResetAllFilter[] ) => void;\n\nexport type ToolsPanelProps = {\n\t/**\n\t * The child elements.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * Flags that the items in this ToolsPanel will be contained within an inner\n\t * wrapper element allowing the panel to lay them out accordingly.\n\t *\n\t * @default false\n\t */\n\thasInnerWrapper?: boolean;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel's header and as the `aria-label`\n\t * for the panel's dropdown menu.\n\t */\n\tlabel: string;\n\t/**\n\t * If a `panelId` is set, it is passed through the `ToolsPanelContext` and\n\t * used to restrict panel items. When a `panelId` is set, items can only\n\t * register themselves if the `panelId` is explicitly `null` or the item's\n\t * `panelId` matches exactly.\n\t */\n\tpanelId?: string | null;\n\t/**\n\t * A function to call when the `Reset all` menu option is selected. As an\n\t * argument, it receives an array containing the `resetAllFilter` callbacks\n\t * of all the valid registered `ToolsPanelItems`.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render\n\t * placeholder content instead of null when they are toggled off and hidden.\n\t * Note that placeholder items won't apply the `className` that would be\n\t * normally applied to a visible `ToolsPanelItem` via the `className` prop.\n\t *\n\t * @default false\n\t */\n\tshouldRenderPlaceholderItems?: boolean;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * first visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalFirstVisibleItemClass?: string;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * last visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelHeaderProps = {\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel header. It is also passed along as\n\t * the `label` for the panel header's `DropdownMenu`.\n\t */\n\tlabel: string;\n\t/**\n\t * The `resetAll` prop provides the callback to execute when the \"Reset all\"\n\t * menu item is selected. Its purpose is to facilitate resetting any control\n\t * values for items contained within this header's panel.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * This is executed when an individual control's menu item is toggled. It\n\t * will update the panel's menu item state and call the panel item's\n\t * `onSelect` or `onDeselect` callbacks as appropriate.\n\t */\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelItem = {\n\t/**\n\t * This is called when building the `ToolsPanel` menu to determine the\n\t * item's initial checked state.\n\t */\n\thasValue: () => boolean;\n\t/**\n\t * This prop identifies the current item as being displayed by default. This\n\t * means it will show regardless of whether it has a value set or is toggled\n\t * on in the panel's menu.\n\t *\n\t * @default false\n\t */\n\tisShownByDefault?: boolean;\n\t/**\n\t * The supplied label is dual purpose. It is used as:\n\t * 1. the human-readable label for the panel's dropdown menu\n\t * 2. a key to locate the corresponding item in the panel's menu context to\n\t * determine if the panel item should be displayed.\n\t * A panel item's `label` should be unique among all items within a single\n\t * panel.\n\t */\n\tlabel: string;\n\t/**\n\t * Panel items will ensure they are only registering with their intended panel\n\t * by comparing the `panelId` props set on both the item and the panel itself,\n\t * or if the `panelId` is explicitly `null`. This allows items to be injected\n\t * from a shared source.\n\t */\n\tpanelId?: string | null;\n};\n\nexport type ToolsPanelItemProps = ToolsPanelItem & {\n\t/**\n\t * The child elements.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Called when this item is deselected in the `ToolsPanel` menu. This is\n\t * normally used to reset the panel item control's value.\n\t */\n\tonDeselect?: () => void;\n\t/**\n\t * A callback to take action when this item is selected in the `ToolsPanel`\n\t * menu.\n\t */\n\tonSelect?: () => void;\n\n\t/**\n\t * A `ToolsPanel` will collect each item's `resetAllFilter` and pass an\n\t * array of these functions through to the panel's `resetAll` callback. They\n\t * can then be iterated over to perform additional tasks.\n\t *\n\t * @default noop\n\t */\n\tresetAllFilter?: ResetAllFilter;\n};\n\nexport type ToolsPanelMenuItemKey = 'default' | 'optional';\n\nexport type ToolsPanelMenuItems = {\n\t[ menuItemKey in ToolsPanelMenuItemKey ]: { [ key: string ]: boolean };\n};\n\nexport type ToolsPanelContext = {\n\tpanelId?: string | null;\n\tmenuItems: ToolsPanelMenuItems;\n\thasMenuItems: boolean;\n\tregisterPanelItem: ( item: ToolsPanelItem ) => void;\n\tderegisterPanelItem: ( label: string ) => void;\n\tregisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tderegisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tflagItemCustomization: (\n\t\tvalue: boolean,\n\t\tlabel: string,\n\t\tgroup?: ToolsPanelMenuItemKey\n\t) => void;\n\tisResetting: boolean;\n\tshouldRenderPlaceholderItems: boolean;\n\tareAllOptionalControlsHidden: boolean;\n\tfirstDisplayedItem?: string;\n\tlastDisplayedItem?: string;\n\t__experimentalFirstVisibleItemClass?: string;\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelControlsGroupProps = {\n\titemClassName?: string;\n\titems: [ string, boolean ][];\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelMenuItemsConfig = {\n\tpanelItems: ToolsPanelItem[];\n\tshouldReset: boolean;\n\tcurrentMenuItems?: ToolsPanelMenuItems;\n\tmenuItemOrder: string[];\n};\n"],"mappings":"","ignoreList":[]}
@@ -39,7 +39,9 @@ export const RovingTabIndexItem = forwardRef(function UnforwardedRovingTabIndexI
39
39
  if (typeof children === 'function') {
40
40
  return children(allProps);
41
41
  }
42
- if (!Component) return null;
42
+ if (!Component) {
43
+ return null;
44
+ }
43
45
  return createElement(Component, {
44
46
  ...allProps
45
47
  }, children);
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","forwardRef","useRovingTabIndexContext","RovingTabIndexItem","UnforwardedRovingTabIndexItem","children","as","Component","props","forwardedRef","localRef","ref","lastFocusedElement","setLastFocusedElement","tabIndex","current","undefined","onFocus","event","target","allProps","createElement"],"sources":["@wordpress/components/src/tree-grid/roving-tab-index-item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useRovingTabIndexContext } from './roving-tab-index-context';\nimport type { RovingTabIndexItemProps } from './types';\n\nexport const RovingTabIndexItem = forwardRef(\n\tfunction UnforwardedRovingTabIndexItem(\n\t\t{ children, as: Component, ...props }: RovingTabIndexItemProps,\n\t\tforwardedRef: React.ForwardedRef< any >\n\t) {\n\t\tconst localRef = useRef< any >();\n\t\tconst ref = forwardedRef || localRef;\n\t\t// @ts-expect-error - We actually want to throw an error if this is undefined.\n\t\tconst { lastFocusedElement, setLastFocusedElement } =\n\t\t\tuseRovingTabIndexContext();\n\t\tlet tabIndex;\n\n\t\tif ( lastFocusedElement ) {\n\t\t\ttabIndex =\n\t\t\t\tlastFocusedElement ===\n\t\t\t\t// TODO: The original implementation simply used `ref.current` here, assuming\n\t\t\t\t// that a forwarded ref would always be an object, which is not necessarily true.\n\t\t\t\t// This workaround maintains the original runtime behavior in a type-safe way,\n\t\t\t\t// but should be revisited.\n\t\t\t\t( 'current' in ref ? ref.current : undefined )\n\t\t\t\t\t? 0\n\t\t\t\t\t: -1;\n\t\t}\n\n\t\tconst onFocus: React.FocusEventHandler< HTMLElement > = ( event ) =>\n\t\t\tsetLastFocusedElement?.( event.target );\n\t\tconst allProps = { ref, tabIndex, onFocus, ...props };\n\n\t\tif ( typeof children === 'function' ) {\n\t\t\treturn children( allProps );\n\t\t}\n\n\t\tif ( ! Component ) return null;\n\n\t\treturn <Component { ...allProps }>{ children }</Component>;\n\t}\n);\n\nexport default RovingTabIndexItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,UAAU,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AAGrE,OAAO,MAAMC,kBAAkB,GAAGF,UAAU,CAC3C,SAASG,6BAA6BA,CACrC;EAAEC,QAAQ;EAAEC,EAAE,EAAEC,SAAS;EAAE,GAAGC;AAA+B,CAAC,EAC9DC,YAAuC,EACtC;EACD,MAAMC,QAAQ,GAAGV,MAAM,CAAQ,CAAC;EAChC,MAAMW,GAAG,GAAGF,YAAY,IAAIC,QAAQ;EACpC;EACA,MAAM;IAAEE,kBAAkB;IAAEC;EAAsB,CAAC,GAClDX,wBAAwB,CAAC,CAAC;EAC3B,IAAIY,QAAQ;EAEZ,IAAKF,kBAAkB,EAAG;IACzBE,QAAQ,GACPF,kBAAkB;IAClB;IACA;IACA;IACA;IACE,SAAS,IAAID,GAAG,GAAGA,GAAG,CAACI,OAAO,GAAGC,SAAS,CAAE,GAC3C,CAAC,GACD,CAAC,CAAC;EACP;EAEA,MAAMC,OAA+C,GAAKC,KAAK,IAC9DL,qBAAqB,GAAIK,KAAK,CAACC,MAAO,CAAC;EACxC,MAAMC,QAAQ,GAAG;IAAET,GAAG;IAAEG,QAAQ;IAAEG,OAAO;IAAE,GAAGT;EAAM,CAAC;EAErD,IAAK,OAAOH,QAAQ,KAAK,UAAU,EAAG;IACrC,OAAOA,QAAQ,CAAEe,QAAS,CAAC;EAC5B;EAEA,IAAK,CAAEb,SAAS,EAAG,OAAO,IAAI;EAE9B,OAAOc,aAAA,CAACd,SAAS;IAAA,GAAMa;EAAQ,GAAKf,QAAqB,CAAC;AAC3D,CACD,CAAC;AAED,eAAeF,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["useRef","forwardRef","useRovingTabIndexContext","RovingTabIndexItem","UnforwardedRovingTabIndexItem","children","as","Component","props","forwardedRef","localRef","ref","lastFocusedElement","setLastFocusedElement","tabIndex","current","undefined","onFocus","event","target","allProps","createElement"],"sources":["@wordpress/components/src/tree-grid/roving-tab-index-item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useRovingTabIndexContext } from './roving-tab-index-context';\nimport type { RovingTabIndexItemProps } from './types';\n\nexport const RovingTabIndexItem = forwardRef(\n\tfunction UnforwardedRovingTabIndexItem(\n\t\t{ children, as: Component, ...props }: RovingTabIndexItemProps,\n\t\tforwardedRef: React.ForwardedRef< any >\n\t) {\n\t\tconst localRef = useRef< any >();\n\t\tconst ref = forwardedRef || localRef;\n\t\t// @ts-expect-error - We actually want to throw an error if this is undefined.\n\t\tconst { lastFocusedElement, setLastFocusedElement } =\n\t\t\tuseRovingTabIndexContext();\n\t\tlet tabIndex;\n\n\t\tif ( lastFocusedElement ) {\n\t\t\ttabIndex =\n\t\t\t\tlastFocusedElement ===\n\t\t\t\t// TODO: The original implementation simply used `ref.current` here, assuming\n\t\t\t\t// that a forwarded ref would always be an object, which is not necessarily true.\n\t\t\t\t// This workaround maintains the original runtime behavior in a type-safe way,\n\t\t\t\t// but should be revisited.\n\t\t\t\t( 'current' in ref ? ref.current : undefined )\n\t\t\t\t\t? 0\n\t\t\t\t\t: -1;\n\t\t}\n\n\t\tconst onFocus: React.FocusEventHandler< HTMLElement > = ( event ) =>\n\t\t\tsetLastFocusedElement?.( event.target );\n\t\tconst allProps = { ref, tabIndex, onFocus, ...props };\n\n\t\tif ( typeof children === 'function' ) {\n\t\t\treturn children( allProps );\n\t\t}\n\n\t\tif ( ! Component ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn <Component { ...allProps }>{ children }</Component>;\n\t}\n);\n\nexport default RovingTabIndexItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,UAAU,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AAGrE,OAAO,MAAMC,kBAAkB,GAAGF,UAAU,CAC3C,SAASG,6BAA6BA,CACrC;EAAEC,QAAQ;EAAEC,EAAE,EAAEC,SAAS;EAAE,GAAGC;AAA+B,CAAC,EAC9DC,YAAuC,EACtC;EACD,MAAMC,QAAQ,GAAGV,MAAM,CAAQ,CAAC;EAChC,MAAMW,GAAG,GAAGF,YAAY,IAAIC,QAAQ;EACpC;EACA,MAAM;IAAEE,kBAAkB;IAAEC;EAAsB,CAAC,GAClDX,wBAAwB,CAAC,CAAC;EAC3B,IAAIY,QAAQ;EAEZ,IAAKF,kBAAkB,EAAG;IACzBE,QAAQ,GACPF,kBAAkB;IAClB;IACA;IACA;IACA;IACE,SAAS,IAAID,GAAG,GAAGA,GAAG,CAACI,OAAO,GAAGC,SAAS,CAAE,GAC3C,CAAC,GACD,CAAC,CAAC;EACP;EAEA,MAAMC,OAA+C,GAAKC,KAAK,IAC9DL,qBAAqB,GAAIK,KAAK,CAACC,MAAO,CAAC;EACxC,MAAMC,QAAQ,GAAG;IAAET,GAAG;IAAEG,QAAQ;IAAEG,OAAO;IAAE,GAAGT;EAAM,CAAC;EAErD,IAAK,OAAOH,QAAQ,KAAK,UAAU,EAAG;IACrC,OAAOA,QAAQ,CAAEe,QAAS,CAAC;EAC5B;EAEA,IAAK,CAAEb,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAOc,aAAA,CAACd,SAAS;IAAA,GAAMa;EAAQ,GAAKf,QAAqB,CAAC;AAC3D,CACD,CAAC;AAED,eAAeF,kBAAkB","ignoreList":[]}
@@ -44,7 +44,7 @@ export default function useTruncate(props) {
44
44
  // The `word-break: break-all` property first makes sure a text line
45
45
  // breaks even when it contains 'unbreakable' content such as long URLs.
46
46
  // See https://github.com/WordPress/gutenberg/issues/60860.
47
- const truncateLines = /*#__PURE__*/css("word-break:break-all;-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:truncateLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEwRDJCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IFdvcmRQcmVzc0NvbXBvbmVudFByb3BzIH0gZnJvbSAnLi4vY29udGV4dCc7XG5pbXBvcnQgeyB1c2VDb250ZXh0U3lzdGVtIH0gZnJvbSAnLi4vY29udGV4dCc7XG5pbXBvcnQgKiBhcyBzdHlsZXMgZnJvbSAnLi9zdHlsZXMnO1xuaW1wb3J0IHsgVFJVTkNBVEVfRUxMSVBTSVMsIFRSVU5DQVRFX1RZUEUsIHRydW5jYXRlQ29udGVudCB9IGZyb20gJy4vdXRpbHMnO1xuaW1wb3J0IHsgdXNlQ3ggfSBmcm9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0ZSBdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBjaGlsZHJlbjogdHJ1bmNhdGVkQ29udGVudCB9O1xufVxuIl19 */");
47
+ const truncateLines = /*#__PURE__*/css(numberOfLines === 1 ? 'word-break: break-all;' : '', " -webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:truncateLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEwRDJCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IFdvcmRQcmVzc0NvbXBvbmVudFByb3BzIH0gZnJvbSAnLi4vY29udGV4dCc7XG5pbXBvcnQgeyB1c2VDb250ZXh0U3lzdGVtIH0gZnJvbSAnLi4vY29udGV4dCc7XG5pbXBvcnQgKiBhcyBzdHlsZXMgZnJvbSAnLi9zdHlsZXMnO1xuaW1wb3J0IHsgVFJVTkNBVEVfRUxMSVBTSVMsIFRSVU5DQVRFX1RZUEUsIH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aW5lcyxcblx0XHRcdGNsYXNzTmFtZVxuXHRcdCk7XG5cdH0sIFsgY2xhc3NOYW1lLCBjeCwgbnVtYmVyT2ZMaW5lcywgc2hvdWxkVHJ1bmNhdGUgXSApO1xuXG5cdHJldHVybiB7IC4uLm90aGVyUHJvcHMsIGNsYXNzTmFtZTogY2xhc3NlcywgY2hpbGRyZW46IHRydW5jYXRlZENvbnRlbnQgfTtcbn1cbiJdfQ== */");
48
48
  return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
49
49
  }, [className, cx, numberOfLines, shouldTruncate]);
50
50
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["css","useMemo","useContextSystem","styles","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","truncateContent","useCx","useTruncate","props","className","children","ellipsis","ellipsizeMode","auto","limit","numberOfLines","otherProps","cx","childrenAsText","toString","truncatedContent","shouldTruncate","classes","truncateLines","process","env","NODE_ENV","Truncate"],"sources":["@wordpress/components/src/truncate/hook.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tlet childrenAsText;\n\tif ( typeof children === 'string' ) {\n\t\tchildrenAsText = children;\n\t} else if ( typeof children === 'number' ) {\n\t\tchildrenAsText = children.toString();\n\t}\n\n\tconst truncatedContent = childrenAsText\n\t\t? truncateContent( childrenAsText, {\n\t\t\t\tellipsis,\n\t\t\t\tellipsizeMode,\n\t\t\t\tlimit,\n\t\t\t\tnumberOfLines,\n\t\t } )\n\t\t: children;\n\n\tconst shouldTruncate =\n\t\t!! childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\t// The `word-break: break-all` property first makes sure a text line\n\t\t// breaks even when it contains 'unbreakable' content such as long URLs.\n\t\t// See https://github.com/WordPress/gutenberg/issues/60860.\n\t\tconst truncateLines = css`\n\t\t\tword-break: break-all;\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && truncateLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;;AAEpC;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;;AAEA,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,eAAe,QAAQ,SAAS;AAC3E,SAASC,KAAK,QAAQ,uBAAuB;AAG7C,eAAe,SAASC,WAAWA,CAClCC,KAAuD,EACtD;EACD,MAAM;IACLC,SAAS;IACTC,QAAQ;IACRC,QAAQ,GAAGR,iBAAiB;IAC5BS,aAAa,GAAGR,aAAa,CAACS,IAAI;IAClCC,KAAK,GAAG,CAAC;IACTC,aAAa,GAAG,CAAC;IACjB,GAAGC;EACJ,CAAC,GAAGf,gBAAgB,CAAEO,KAAK,EAAE,UAAW,CAAC;EAEzC,MAAMS,EAAE,GAAGX,KAAK,CAAC,CAAC;EAElB,IAAIY,cAAc;EAClB,IAAK,OAAOR,QAAQ,KAAK,QAAQ,EAAG;IACnCQ,cAAc,GAAGR,QAAQ;EAC1B,CAAC,MAAM,IAAK,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IAC1CQ,cAAc,GAAGR,QAAQ,CAACS,QAAQ,CAAC,CAAC;EACrC;EAEA,MAAMC,gBAAgB,GAAGF,cAAc,GACpCb,eAAe,CAAEa,cAAc,EAAE;IACjCP,QAAQ;IACRC,aAAa;IACbE,KAAK;IACLC;EACA,CAAE,CAAC,GACHL,QAAQ;EAEX,MAAMW,cAAc,GACnB,CAAC,CAAEH,cAAc,IAAIN,aAAa,KAAKR,aAAa,CAACS,IAAI;EAE1D,MAAMS,OAAO,GAAGtB,OAAO,CAAE,MAAM;IAC9B;IACA;IACA;IACA,MAAMuB,aAAa,gBAAGxB,GAAG,yEAGDgB,aAAa,6CAAAS,OAAA,CAAAC,GAAA,CAAAC,QAAA,mDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,mlGAGpC;IAED,OAAOT,EAAE,CACRI,cAAc,IAAI,CAAEN,aAAa,IAAIb,MAAM,CAACyB,QAAQ,EACpDN,cAAc,IAAI,CAAC,CAAEN,aAAa,IAAIQ,aAAa,EACnDd,SACD,CAAC;EACF,CAAC,EAAE,CAAEA,SAAS,EAAEQ,EAAE,EAAEF,aAAa,EAAEM,cAAc,CAAG,CAAC;EAErD,OAAO;IAAE,GAAGL,UAAU;IAAEP,SAAS,EAAEa,OAAO;IAAEZ,QAAQ,EAAEU;EAAiB,CAAC;AACzE","ignoreList":[]}
1
+ {"version":3,"names":["css","useMemo","useContextSystem","styles","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","truncateContent","useCx","useTruncate","props","className","children","ellipsis","ellipsizeMode","auto","limit","numberOfLines","otherProps","cx","childrenAsText","toString","truncatedContent","shouldTruncate","classes","truncateLines","process","env","NODE_ENV","Truncate"],"sources":["@wordpress/components/src/truncate/hook.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tlet childrenAsText;\n\tif ( typeof children === 'string' ) {\n\t\tchildrenAsText = children;\n\t} else if ( typeof children === 'number' ) {\n\t\tchildrenAsText = children.toString();\n\t}\n\n\tconst truncatedContent = childrenAsText\n\t\t? truncateContent( childrenAsText, {\n\t\t\t\tellipsis,\n\t\t\t\tellipsizeMode,\n\t\t\t\tlimit,\n\t\t\t\tnumberOfLines,\n\t\t } )\n\t\t: children;\n\n\tconst shouldTruncate =\n\t\t!! childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\t// The `word-break: break-all` property first makes sure a text line\n\t\t// breaks even when it contains 'unbreakable' content such as long URLs.\n\t\t// See https://github.com/WordPress/gutenberg/issues/60860.\n\t\tconst truncateLines = css`\n\t\t\t${ numberOfLines === 1 ? 'word-break: break-all;' : '' }\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && truncateLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;;AAEpC;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;;AAEA,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,eAAe,QAAQ,SAAS;AAC3E,SAASC,KAAK,QAAQ,uBAAuB;AAG7C,eAAe,SAASC,WAAWA,CAClCC,KAAuD,EACtD;EACD,MAAM;IACLC,SAAS;IACTC,QAAQ;IACRC,QAAQ,GAAGR,iBAAiB;IAC5BS,aAAa,GAAGR,aAAa,CAACS,IAAI;IAClCC,KAAK,GAAG,CAAC;IACTC,aAAa,GAAG,CAAC;IACjB,GAAGC;EACJ,CAAC,GAAGf,gBAAgB,CAAEO,KAAK,EAAE,UAAW,CAAC;EAEzC,MAAMS,EAAE,GAAGX,KAAK,CAAC,CAAC;EAElB,IAAIY,cAAc;EAClB,IAAK,OAAOR,QAAQ,KAAK,QAAQ,EAAG;IACnCQ,cAAc,GAAGR,QAAQ;EAC1B,CAAC,MAAM,IAAK,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IAC1CQ,cAAc,GAAGR,QAAQ,CAACS,QAAQ,CAAC,CAAC;EACrC;EAEA,MAAMC,gBAAgB,GAAGF,cAAc,GACpCb,eAAe,CAAEa,cAAc,EAAE;IACjCP,QAAQ;IACRC,aAAa;IACbE,KAAK;IACLC;EACA,CAAE,CAAC,GACHL,QAAQ;EAEX,MAAMW,cAAc,GACnB,CAAC,CAAEH,cAAc,IAAIN,aAAa,KAAKR,aAAa,CAACS,IAAI;EAE1D,MAAMS,OAAO,GAAGtB,OAAO,CAAE,MAAM;IAC9B;IACA;IACA;IACA,MAAMuB,aAAa,gBAAGxB,GAAG,CACrBgB,aAAa,KAAK,CAAC,GAAG,wBAAwB,GAAG,EAAE,sDAE/BA,aAAa,6CAAAS,OAAA,CAAAC,GAAA,CAAAC,QAAA,mDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,moGAGpC;IAED,OAAOT,EAAE,CACRI,cAAc,IAAI,CAAEN,aAAa,IAAIb,MAAM,CAACyB,QAAQ,EACpDN,cAAc,IAAI,CAAC,CAAEN,aAAa,IAAIQ,aAAa,EACnDd,SACD,CAAC;EACF,CAAC,EAAE,CAAEA,SAAS,EAAEQ,EAAE,EAAEF,aAAa,EAAEM,cAAc,CAAG,CAAC;EAErD,OAAO;IAAE,GAAGL,UAAU;IAAEP,SAAS,EAAEa,OAAO;IAAEZ,QAAQ,EAAEU;EAAiB,CAAC;AACzE","ignoreList":[]}
@@ -3,7 +3,7 @@ import { createElement } from "react";
3
3
  * External dependencies
4
4
  */
5
5
 
6
- import classnames from 'classnames';
6
+ import clsx from 'clsx';
7
7
 
8
8
  /**
9
9
  * WordPress dependencies
@@ -79,7 +79,7 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
79
79
  setUnit(parsedUnit);
80
80
  }
81
81
  }, [parsedUnit, setUnit]);
82
- const classes = classnames('components-unit-control',
82
+ const classes = clsx('components-unit-control',
83
83
  // This class is added for legacy purposes to maintain it on the outer
84
84
  // wrapper. See: https://github.com/WordPress/gutenberg/pull/45139
85
85
  'components-unit-control-wrapper', className);
@@ -115,7 +115,9 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
115
115
  // Unless the meta key was pressed (to avoid interfering with
116
116
  // shortcuts, e.g. pastes), moves focus to the unit select if a key
117
117
  // matches the first character of a unit.
118
- if (!event.metaKey && reFirstCharacterOfUnits.test(event.key)) refInputSuffix.current?.focus();
118
+ if (!event.metaKey && reFirstCharacterOfUnits.test(event.key)) {
119
+ refInputSuffix.current?.focus();
120
+ }
119
121
  };
120
122
  }
121
123
  const refInputSuffix = useRef(null);