@wordpress/components 19.13.0 → 19.16.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 (1183) hide show
  1. package/CHANGELOG.md +139 -12
  2. package/build/alignment-matrix-control/utils.js +1 -7
  3. package/build/alignment-matrix-control/utils.js.map +1 -1
  4. package/build/angle-picker-control/index.js +2 -2
  5. package/build/angle-picker-control/index.js.map +1 -1
  6. package/build/autocomplete/autocompleter-ui.js +4 -2
  7. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  8. package/build/autocomplete/autocompleter-ui.native.js +9 -3
  9. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  10. package/build/autocomplete/get-default-use-items.js +5 -1
  11. package/build/autocomplete/get-default-use-items.js.map +1 -1
  12. package/build/autocomplete/index.js +9 -3
  13. package/build/autocomplete/index.js.map +1 -1
  14. package/build/base-control/styles/base-control-styles.js +8 -8
  15. package/build/base-control/styles/base-control-styles.js.map +1 -1
  16. package/build/border-box-control/border-box-control/component.js +2 -1
  17. package/build/border-box-control/border-box-control/component.js.map +1 -1
  18. package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
  19. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  20. package/build/border-control/border-control/component.js +78 -29
  21. package/build/border-control/border-control/component.js.map +1 -1
  22. package/build/border-control/border-control/hook.js +4 -7
  23. package/build/border-control/border-control/hook.js.map +1 -1
  24. package/build/border-control/border-control-dropdown/component.js +13 -7
  25. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  26. package/build/border-control/border-control-dropdown/hook.js +0 -4
  27. package/build/border-control/border-control-dropdown/hook.js.map +1 -1
  28. package/build/border-control/styles.js +33 -56
  29. package/build/border-control/styles.js.map +1 -1
  30. package/build/box-control/axial-input-controls.js +1 -1
  31. package/build/box-control/axial-input-controls.js.map +1 -1
  32. package/build/box-control/index.js +1 -1
  33. package/build/box-control/index.js.map +1 -1
  34. package/build/box-control/utils.js +5 -11
  35. package/build/box-control/utils.js.map +1 -1
  36. package/build/color-indicator/index.js +27 -10
  37. package/build/color-indicator/index.js.map +1 -1
  38. package/build/color-indicator/types.js +6 -0
  39. package/build/color-indicator/types.js.map +1 -0
  40. package/build/color-palette/index.js +16 -3
  41. package/build/color-palette/index.js.map +1 -1
  42. package/build/color-picker/component.js +6 -9
  43. package/build/color-picker/component.js.map +1 -1
  44. package/build/color-picker/hex-input.js +7 -5
  45. package/build/color-picker/hex-input.js.map +1 -1
  46. package/build/color-picker/index.native.js +35 -34
  47. package/build/color-picker/index.native.js.map +1 -1
  48. package/build/color-picker/input-with-slider.js +7 -5
  49. package/build/color-picker/input-with-slider.js.map +1 -1
  50. package/build/color-picker/styles.js +42 -43
  51. package/build/color-picker/styles.js.map +1 -1
  52. package/build/color-picker/use-deprecated-props.js +22 -31
  53. package/build/color-picker/use-deprecated-props.js.map +1 -1
  54. package/build/combobox-control/index.js +19 -13
  55. package/build/combobox-control/index.js.map +1 -1
  56. package/build/combobox-control/styles.js +39 -0
  57. package/build/combobox-control/styles.js.map +1 -0
  58. package/build/custom-gradient-picker/index.js +8 -8
  59. package/build/custom-gradient-picker/index.js.map +1 -1
  60. package/build/custom-gradient-picker/index.native.js +8 -9
  61. package/build/custom-gradient-picker/index.native.js.map +1 -1
  62. package/build/custom-gradient-picker/serializer.js +4 -7
  63. package/build/custom-gradient-picker/serializer.js.map +1 -1
  64. package/build/custom-select-control/index.js +26 -8
  65. package/build/custom-select-control/index.js.map +1 -1
  66. package/build/date-time/date/index.js +3 -1
  67. package/build/date-time/date/index.js.map +1 -1
  68. package/build/date-time/date-time/index.js +3 -1
  69. package/build/date-time/date-time/index.js.map +1 -1
  70. package/build/divider/component.js +0 -1
  71. package/build/divider/component.js.map +1 -1
  72. package/build/divider/index.js.map +1 -1
  73. package/build/divider/styles.js +5 -5
  74. package/build/divider/styles.js.map +1 -1
  75. package/build/dropdown/dropdown-content-wrapper.js +60 -0
  76. package/build/dropdown/dropdown-content-wrapper.js.map +1 -0
  77. package/build/dropdown/styles.js +42 -0
  78. package/build/dropdown/styles.js.map +1 -0
  79. package/build/dropdown/types.js +6 -0
  80. package/build/dropdown/types.js.map +1 -0
  81. package/build/dropdown-menu/index.js +5 -5
  82. package/build/dropdown-menu/index.js.map +1 -1
  83. package/build/dropdown-menu/index.native.js +5 -5
  84. package/build/dropdown-menu/index.native.js.map +1 -1
  85. package/build/duotone-picker/duotone-picker.js +42 -29
  86. package/build/duotone-picker/duotone-picker.js.map +1 -1
  87. package/build/elevation/component.js +15 -15
  88. package/build/elevation/component.js.map +1 -1
  89. package/build/elevation/hook.js +15 -27
  90. package/build/elevation/hook.js.map +1 -1
  91. package/build/elevation/index.js.map +1 -1
  92. package/build/elevation/styles.js +1 -1
  93. package/build/elevation/styles.js.map +1 -1
  94. package/build/external-link/index.js +1 -3
  95. package/build/external-link/index.js.map +1 -1
  96. package/build/flex/flex/component.js +11 -17
  97. package/build/flex/flex/component.js.map +1 -1
  98. package/build/flex/flex-block/component.js +9 -3
  99. package/build/flex/flex-block/component.js.map +1 -1
  100. package/build/flex/flex-item/component.js +9 -3
  101. package/build/flex/flex-item/component.js.map +1 -1
  102. package/build/focal-point-picker/grid.js +2 -7
  103. package/build/focal-point-picker/grid.js.map +1 -1
  104. package/build/focal-point-picker/index.native.js +12 -12
  105. package/build/focal-point-picker/index.native.js.map +1 -1
  106. package/build/focal-point-picker/tooltip/index.native.js +11 -12
  107. package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
  108. package/build/form-toggle/index.js +28 -5
  109. package/build/form-toggle/index.js.map +1 -1
  110. package/build/form-toggle/types.js +6 -0
  111. package/build/form-toggle/types.js.map +1 -0
  112. package/build/form-token-field/index.js +22 -7
  113. package/build/form-token-field/index.js.map +1 -1
  114. package/build/form-token-field/styles.js +40 -0
  115. package/build/form-token-field/styles.js.map +1 -0
  116. package/build/form-token-field/suggestions-list.js +2 -7
  117. package/build/form-token-field/suggestions-list.js.map +1 -1
  118. package/build/grid/component.js +7 -8
  119. package/build/grid/component.js.map +1 -1
  120. package/build/grid/hook.js +1 -5
  121. package/build/grid/hook.js.map +1 -1
  122. package/build/grid/index.js.map +1 -1
  123. package/build/grid/utils.js +4 -7
  124. package/build/grid/utils.js.map +1 -1
  125. package/build/h-stack/component.js +5 -9
  126. package/build/h-stack/component.js.map +1 -1
  127. package/build/h-stack/hook.js +8 -10
  128. package/build/h-stack/hook.js.map +1 -1
  129. package/build/h-stack/index.js.map +1 -1
  130. package/build/h-stack/utils.js +8 -19
  131. package/build/h-stack/utils.js.map +1 -1
  132. package/build/heading/component.js +0 -1
  133. package/build/heading/component.js.map +1 -1
  134. package/build/heading/hook.js.map +1 -1
  135. package/build/heading/types.js +6 -0
  136. package/build/heading/types.js.map +1 -0
  137. package/build/icon/index.js.map +1 -1
  138. package/build/index.js +24 -0
  139. package/build/index.js.map +1 -1
  140. package/build/input-control/index.js +7 -0
  141. package/build/input-control/index.js.map +1 -1
  142. package/build/input-control/input-base.js +23 -1
  143. package/build/input-control/input-base.js.map +1 -1
  144. package/build/input-control/input-prefix-wrapper.js +54 -0
  145. package/build/input-control/input-prefix-wrapper.js.map +1 -0
  146. package/build/input-control/input-suffix-wrapper.js +54 -0
  147. package/build/input-control/input-suffix-wrapper.js.map +1 -0
  148. package/build/input-control/styles/input-control-styles.js +61 -42
  149. package/build/input-control/styles/input-control-styles.js.map +1 -1
  150. package/build/menu-item/index.js +1 -3
  151. package/build/menu-item/index.js.map +1 -1
  152. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
  153. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  154. package/build/mobile/focal-point-settings-panel/index.native.js +1 -1
  155. package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  156. package/build/mobile/image/index.native.js +9 -4
  157. package/build/mobile/image/index.native.js.map +1 -1
  158. package/build/mobile/link-picker/index.native.js +4 -4
  159. package/build/mobile/link-picker/index.native.js.map +1 -1
  160. package/build/mobile/media-edit/index.native.js +1 -7
  161. package/build/mobile/media-edit/index.native.js.map +1 -1
  162. package/build/mobile/segmented-control/index.native.js +2 -4
  163. package/build/mobile/segmented-control/index.native.js.map +1 -1
  164. package/build/modal/index.js +17 -3
  165. package/build/modal/index.js.map +1 -1
  166. package/build/navigation/group/index.js +4 -7
  167. package/build/navigation/group/index.js.map +1 -1
  168. package/build/navigation/index.js +4 -1
  169. package/build/navigation/index.js.map +1 -1
  170. package/build/navigation/item/base.js +6 -3
  171. package/build/navigation/item/base.js.map +1 -1
  172. package/build/navigation/item/use-navigation-tree-item.js +2 -1
  173. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  174. package/build/navigation/menu/menu-title-search.js +1 -7
  175. package/build/navigation/menu/menu-title-search.js.map +1 -1
  176. package/build/navigation/menu/search-no-results-found.js +1 -7
  177. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  178. package/build/navigation/use-navigation-tree-nodes.js +18 -10
  179. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  180. package/build/navigation/utils.js +4 -2
  181. package/build/navigation/utils.js.map +1 -1
  182. package/build/popover/index.js +17 -14
  183. package/build/popover/index.js.map +1 -1
  184. package/build/radio-control/index.js +1 -3
  185. package/build/radio-control/index.js.map +1 -1
  186. package/build/range-control/index.js +57 -43
  187. package/build/range-control/index.js.map +1 -1
  188. package/build/range-control/input-range.js +5 -7
  189. package/build/range-control/input-range.js.map +1 -1
  190. package/build/range-control/mark.js +5 -7
  191. package/build/range-control/mark.js.map +1 -1
  192. package/build/range-control/rail.js +10 -16
  193. package/build/range-control/rail.js.map +1 -1
  194. package/build/range-control/styles/range-control-styles.js +62 -62
  195. package/build/range-control/styles/range-control-styles.js.map +1 -1
  196. package/build/range-control/tooltip.js +5 -7
  197. package/build/range-control/tooltip.js.map +1 -1
  198. package/build/range-control/types.js +6 -0
  199. package/build/range-control/types.js.map +1 -0
  200. package/build/range-control/utils.js +21 -32
  201. package/build/range-control/utils.js.map +1 -1
  202. package/build/resizable-box/resize-tooltip/utils.js +2 -7
  203. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  204. package/build/sandbox/index.native.js +13 -2
  205. package/build/sandbox/index.native.js.map +1 -1
  206. package/build/scroll-lock/index.js +35 -6
  207. package/build/scroll-lock/index.js.map +1 -1
  208. package/build/scrollable/component.js +7 -8
  209. package/build/scrollable/component.js.map +1 -1
  210. package/build/scrollable/hook.js +0 -8
  211. package/build/scrollable/hook.js.map +1 -1
  212. package/build/scrollable/index.js.map +1 -1
  213. package/build/scrollable/styles.js +7 -7
  214. package/build/scrollable/styles.js.map +1 -1
  215. package/build/select-control/index.js +1 -3
  216. package/build/select-control/index.js.map +1 -1
  217. package/build/select-control/styles/select-control-styles.js +31 -11
  218. package/build/select-control/styles/select-control-styles.js.map +1 -1
  219. package/build/shortcut/index.js +6 -21
  220. package/build/shortcut/index.js.map +1 -1
  221. package/build/shortcut/types.js +6 -0
  222. package/build/shortcut/types.js.map +1 -0
  223. package/build/slot-fill/index.native.js +6 -8
  224. package/build/slot-fill/index.native.js.map +1 -1
  225. package/build/slot-fill/provider.js +4 -8
  226. package/build/slot-fill/provider.js.map +1 -1
  227. package/build/slot-fill/slot.js +4 -8
  228. package/build/slot-fill/slot.js.map +1 -1
  229. package/build/spacer/component.js +8 -6
  230. package/build/spacer/component.js.map +1 -1
  231. package/build/spacer/hook.js +2 -2
  232. package/build/spacer/hook.js.map +1 -1
  233. package/build/spacer/index.js.map +1 -1
  234. package/build/spinner/index.js +26 -13
  235. package/build/spinner/index.js.map +1 -1
  236. package/build/spinner/styles.js +10 -10
  237. package/build/spinner/styles.js.map +1 -1
  238. package/build/text-highlight/index.js +22 -5
  239. package/build/text-highlight/index.js.map +1 -1
  240. package/build/text-highlight/types.js +6 -0
  241. package/build/text-highlight/types.js.map +1 -0
  242. package/build/tip/index.js +5 -11
  243. package/build/tip/index.js.map +1 -1
  244. package/build/tip/types.js +6 -0
  245. package/build/tip/types.js.map +1 -0
  246. package/build/toggle-group-control/toggle-group-control/component.js +4 -1
  247. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  248. package/build/toggle-group-control/toggle-group-control/styles.js +20 -4
  249. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  250. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +7 -9
  251. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  252. package/build/toolbar-group/index.js +3 -3
  253. package/build/toolbar-group/index.js.map +1 -1
  254. package/build/tooltip/index.js +51 -14
  255. package/build/tooltip/index.js.map +1 -1
  256. package/build/tree-select/index.js +4 -4
  257. package/build/tree-select/index.js.map +1 -1
  258. package/build/truncate/component.js +7 -8
  259. package/build/truncate/component.js.map +1 -1
  260. package/build/truncate/hook.js +3 -10
  261. package/build/truncate/hook.js.map +1 -1
  262. package/build/truncate/index.js.map +1 -1
  263. package/build/truncate/styles.js +1 -1
  264. package/build/truncate/styles.js.map +1 -1
  265. package/build/truncate/utils.js +3 -16
  266. package/build/truncate/utils.js.map +1 -1
  267. package/build/ui/context/use-context-system.js +7 -2
  268. package/build/ui/context/use-context-system.js.map +1 -1
  269. package/build/ui/utils/get-valid-children.js.map +1 -1
  270. package/build/ui/utils/space.js +7 -1
  271. package/build/ui/utils/space.js.map +1 -1
  272. package/build/unit-control/styles/unit-control-styles.js +10 -26
  273. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  274. package/build/utils/math.js +17 -7
  275. package/build/utils/math.js.map +1 -1
  276. package/build/v-stack/component.js +9 -9
  277. package/build/v-stack/component.js.map +1 -1
  278. package/build/v-stack/hook.js +0 -5
  279. package/build/v-stack/hook.js.map +1 -1
  280. package/build/v-stack/index.js.map +1 -1
  281. package/build/visually-hidden/component.js +12 -13
  282. package/build/visually-hidden/component.js.map +1 -1
  283. package/build/visually-hidden/index.js.map +1 -1
  284. package/build/visually-hidden/styles.js +3 -1
  285. package/build/visually-hidden/styles.js.map +1 -1
  286. package/build/visually-hidden/types.js +6 -0
  287. package/build/visually-hidden/types.js.map +1 -0
  288. package/build-module/alignment-matrix-control/utils.js +1 -6
  289. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  290. package/build-module/angle-picker-control/index.js +2 -2
  291. package/build-module/angle-picker-control/index.js.map +1 -1
  292. package/build-module/autocomplete/autocompleter-ui.js +4 -2
  293. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  294. package/build-module/autocomplete/autocompleter-ui.native.js +9 -3
  295. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  296. package/build-module/autocomplete/get-default-use-items.js +3 -2
  297. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  298. package/build-module/autocomplete/index.js +7 -4
  299. package/build-module/autocomplete/index.js.map +1 -1
  300. package/build-module/base-control/styles/base-control-styles.js +8 -8
  301. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  302. package/build-module/border-box-control/border-box-control/component.js +2 -1
  303. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  304. package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
  305. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  306. package/build-module/border-control/border-control/component.js +75 -28
  307. package/build-module/border-control/border-control/component.js.map +1 -1
  308. package/build-module/border-control/border-control/hook.js +4 -7
  309. package/build-module/border-control/border-control/hook.js.map +1 -1
  310. package/build-module/border-control/border-control-dropdown/component.js +12 -7
  311. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  312. package/build-module/border-control/border-control-dropdown/hook.js +0 -4
  313. package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
  314. package/build-module/border-control/styles.js +33 -49
  315. package/build-module/border-control/styles.js.map +1 -1
  316. package/build-module/box-control/axial-input-controls.js +1 -1
  317. package/build-module/box-control/axial-input-controls.js.map +1 -1
  318. package/build-module/box-control/index.js +1 -1
  319. package/build-module/box-control/index.js.map +1 -1
  320. package/build-module/box-control/utils.js +5 -10
  321. package/build-module/box-control/utils.js.map +1 -1
  322. package/build-module/color-indicator/index.js +29 -8
  323. package/build-module/color-indicator/index.js.map +1 -1
  324. package/build-module/color-indicator/types.js +2 -0
  325. package/build-module/color-indicator/types.js.map +1 -0
  326. package/build-module/color-palette/index.js +12 -2
  327. package/build-module/color-palette/index.js.map +1 -1
  328. package/build-module/color-picker/component.js +7 -8
  329. package/build-module/color-picker/component.js.map +1 -1
  330. package/build-module/color-picker/hex-input.js +6 -4
  331. package/build-module/color-picker/hex-input.js.map +1 -1
  332. package/build-module/color-picker/index.native.js +36 -35
  333. package/build-module/color-picker/index.native.js.map +1 -1
  334. package/build-module/color-picker/input-with-slider.js +7 -5
  335. package/build-module/color-picker/input-with-slider.js.map +1 -1
  336. package/build-module/color-picker/styles.js +29 -39
  337. package/build-module/color-picker/styles.js.map +1 -1
  338. package/build-module/color-picker/use-deprecated-props.js +22 -31
  339. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  340. package/build-module/combobox-control/index.js +19 -13
  341. package/build-module/combobox-control/index.js.map +1 -1
  342. package/build-module/combobox-control/styles.js +27 -0
  343. package/build-module/combobox-control/styles.js.map +1 -0
  344. package/build-module/custom-gradient-picker/index.js +8 -7
  345. package/build-module/custom-gradient-picker/index.js.map +1 -1
  346. package/build-module/custom-gradient-picker/index.native.js +8 -8
  347. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  348. package/build-module/custom-gradient-picker/serializer.js +4 -6
  349. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  350. package/build-module/custom-select-control/index.js +26 -10
  351. package/build-module/custom-select-control/index.js.map +1 -1
  352. package/build-module/date-time/date/index.js +3 -1
  353. package/build-module/date-time/date/index.js.map +1 -1
  354. package/build-module/date-time/date-time/index.js +3 -1
  355. package/build-module/date-time/date-time/index.js.map +1 -1
  356. package/build-module/divider/component.js +0 -1
  357. package/build-module/divider/component.js.map +1 -1
  358. package/build-module/divider/index.js.map +1 -1
  359. package/build-module/divider/styles.js +5 -5
  360. package/build-module/divider/styles.js.map +1 -1
  361. package/build-module/dropdown/dropdown-content-wrapper.js +47 -0
  362. package/build-module/dropdown/dropdown-content-wrapper.js.map +1 -0
  363. package/build-module/dropdown/styles.js +31 -0
  364. package/build-module/dropdown/styles.js.map +1 -0
  365. package/build-module/dropdown/types.js +2 -0
  366. package/build-module/dropdown/types.js.map +1 -0
  367. package/build-module/dropdown-menu/index.js +5 -4
  368. package/build-module/dropdown-menu/index.js.map +1 -1
  369. package/build-module/dropdown-menu/index.native.js +5 -4
  370. package/build-module/dropdown-menu/index.native.js.map +1 -1
  371. package/build-module/duotone-picker/duotone-picker.js +42 -29
  372. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  373. package/build-module/elevation/component.js +15 -15
  374. package/build-module/elevation/component.js.map +1 -1
  375. package/build-module/elevation/hook.js +14 -26
  376. package/build-module/elevation/hook.js.map +1 -1
  377. package/build-module/elevation/index.js.map +1 -1
  378. package/build-module/elevation/styles.js +1 -1
  379. package/build-module/elevation/styles.js.map +1 -1
  380. package/build-module/external-link/index.js +1 -2
  381. package/build-module/external-link/index.js.map +1 -1
  382. package/build-module/flex/flex/component.js +11 -17
  383. package/build-module/flex/flex/component.js.map +1 -1
  384. package/build-module/flex/flex-block/component.js +9 -3
  385. package/build-module/flex/flex-block/component.js.map +1 -1
  386. package/build-module/flex/flex-item/component.js +9 -3
  387. package/build-module/flex/flex-item/component.js.map +1 -1
  388. package/build-module/focal-point-picker/grid.js +2 -6
  389. package/build-module/focal-point-picker/grid.js.map +1 -1
  390. package/build-module/focal-point-picker/index.native.js +9 -9
  391. package/build-module/focal-point-picker/index.native.js.map +1 -1
  392. package/build-module/focal-point-picker/tooltip/index.native.js +11 -12
  393. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  394. package/build-module/form-toggle/index.js +30 -6
  395. package/build-module/form-toggle/index.js.map +1 -1
  396. package/build-module/form-toggle/types.js +2 -0
  397. package/build-module/form-toggle/types.js.map +1 -0
  398. package/build-module/form-token-field/index.js +20 -6
  399. package/build-module/form-token-field/index.js.map +1 -1
  400. package/build-module/form-token-field/styles.js +28 -0
  401. package/build-module/form-token-field/styles.js.map +1 -0
  402. package/build-module/form-token-field/suggestions-list.js +2 -7
  403. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  404. package/build-module/grid/component.js +7 -8
  405. package/build-module/grid/component.js.map +1 -1
  406. package/build-module/grid/hook.js +1 -5
  407. package/build-module/grid/hook.js.map +1 -1
  408. package/build-module/grid/index.js.map +1 -1
  409. package/build-module/grid/utils.js +3 -8
  410. package/build-module/grid/utils.js.map +1 -1
  411. package/build-module/h-stack/component.js +3 -7
  412. package/build-module/h-stack/component.js.map +1 -1
  413. package/build-module/h-stack/hook.js +10 -12
  414. package/build-module/h-stack/hook.js.map +1 -1
  415. package/build-module/h-stack/index.js.map +1 -1
  416. package/build-module/h-stack/utils.js +8 -20
  417. package/build-module/h-stack/utils.js.map +1 -1
  418. package/build-module/heading/component.js +0 -1
  419. package/build-module/heading/component.js.map +1 -1
  420. package/build-module/heading/hook.js.map +1 -1
  421. package/build-module/heading/types.js +2 -0
  422. package/build-module/heading/types.js.map +1 -0
  423. package/build-module/icon/index.js.map +1 -1
  424. package/build-module/index.js +3 -0
  425. package/build-module/index.js.map +1 -1
  426. package/build-module/input-control/index.js +6 -0
  427. package/build-module/input-control/index.js.map +1 -1
  428. package/build-module/input-control/input-base.js +24 -3
  429. package/build-module/input-control/input-base.js.map +1 -1
  430. package/build-module/input-control/input-prefix-wrapper.js +41 -0
  431. package/build-module/input-control/input-prefix-wrapper.js.map +1 -0
  432. package/build-module/input-control/input-suffix-wrapper.js +41 -0
  433. package/build-module/input-control/input-suffix-wrapper.js.map +1 -0
  434. package/build-module/input-control/styles/input-control-styles.js +57 -41
  435. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  436. package/build-module/menu-item/index.js +1 -2
  437. package/build-module/menu-item/index.js.map +1 -1
  438. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
  439. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  440. package/build-module/mobile/focal-point-settings-panel/index.native.js +2 -2
  441. package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  442. package/build-module/mobile/image/index.native.js +10 -6
  443. package/build-module/mobile/image/index.native.js.map +1 -1
  444. package/build-module/mobile/link-picker/index.native.js +4 -3
  445. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  446. package/build-module/mobile/media-edit/index.native.js +1 -6
  447. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  448. package/build-module/mobile/segmented-control/index.native.js +2 -3
  449. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  450. package/build-module/modal/index.js +19 -5
  451. package/build-module/modal/index.js.map +1 -1
  452. package/build-module/navigation/group/index.js +3 -6
  453. package/build-module/navigation/group/index.js.map +1 -1
  454. package/build-module/navigation/index.js +4 -1
  455. package/build-module/navigation/index.js.map +1 -1
  456. package/build-module/navigation/item/base.js +5 -2
  457. package/build-module/navigation/item/base.js.map +1 -1
  458. package/build-module/navigation/item/use-navigation-tree-item.js +2 -1
  459. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  460. package/build-module/navigation/menu/menu-title-search.js +1 -6
  461. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  462. package/build-module/navigation/menu/search-no-results-found.js +1 -6
  463. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  464. package/build-module/navigation/use-navigation-tree-nodes.js +18 -9
  465. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  466. package/build-module/navigation/utils.js +2 -2
  467. package/build-module/navigation/utils.js.map +1 -1
  468. package/build-module/popover/index.js +17 -14
  469. package/build-module/popover/index.js.map +1 -1
  470. package/build-module/radio-control/index.js +1 -2
  471. package/build-module/radio-control/index.js.map +1 -1
  472. package/build-module/range-control/index.js +55 -41
  473. package/build-module/range-control/index.js.map +1 -1
  474. package/build-module/range-control/input-range.js +5 -6
  475. package/build-module/range-control/input-range.js.map +1 -1
  476. package/build-module/range-control/mark.js +5 -6
  477. package/build-module/range-control/mark.js.map +1 -1
  478. package/build-module/range-control/rail.js +10 -15
  479. package/build-module/range-control/rail.js.map +1 -1
  480. package/build-module/range-control/styles/range-control-styles.js +62 -64
  481. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  482. package/build-module/range-control/tooltip.js +5 -6
  483. package/build-module/range-control/tooltip.js.map +1 -1
  484. package/build-module/range-control/types.js +2 -0
  485. package/build-module/range-control/types.js.map +1 -0
  486. package/build-module/range-control/utils.js +22 -33
  487. package/build-module/range-control/utils.js.map +1 -1
  488. package/build-module/resizable-box/resize-tooltip/utils.js +2 -6
  489. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  490. package/build-module/sandbox/index.native.js +13 -3
  491. package/build-module/sandbox/index.native.js.map +1 -1
  492. package/build-module/scroll-lock/index.js +32 -6
  493. package/build-module/scroll-lock/index.js.map +1 -1
  494. package/build-module/scrollable/component.js +7 -8
  495. package/build-module/scrollable/component.js.map +1 -1
  496. package/build-module/scrollable/hook.js +0 -8
  497. package/build-module/scrollable/hook.js.map +1 -1
  498. package/build-module/scrollable/index.js.map +1 -1
  499. package/build-module/scrollable/styles.js +7 -7
  500. package/build-module/scrollable/styles.js.map +1 -1
  501. package/build-module/select-control/index.js +1 -2
  502. package/build-module/select-control/index.js.map +1 -1
  503. package/build-module/select-control/styles/select-control-styles.js +31 -11
  504. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  505. package/build-module/shortcut/index.js +6 -20
  506. package/build-module/shortcut/index.js.map +1 -1
  507. package/build-module/shortcut/types.js +2 -0
  508. package/build-module/shortcut/types.js.map +1 -0
  509. package/build-module/slot-fill/index.native.js +6 -7
  510. package/build-module/slot-fill/index.native.js.map +1 -1
  511. package/build-module/slot-fill/provider.js +4 -7
  512. package/build-module/slot-fill/provider.js.map +1 -1
  513. package/build-module/slot-fill/slot.js +4 -7
  514. package/build-module/slot-fill/slot.js.map +1 -1
  515. package/build-module/spacer/component.js +6 -5
  516. package/build-module/spacer/component.js.map +1 -1
  517. package/build-module/spacer/hook.js +2 -2
  518. package/build-module/spacer/hook.js.map +1 -1
  519. package/build-module/spacer/index.js.map +1 -1
  520. package/build-module/spinner/index.js +22 -13
  521. package/build-module/spinner/index.js.map +1 -1
  522. package/build-module/spinner/styles.js +10 -10
  523. package/build-module/spinner/styles.js.map +1 -1
  524. package/build-module/text-highlight/index.js +23 -6
  525. package/build-module/text-highlight/index.js.map +1 -1
  526. package/build-module/text-highlight/types.js +2 -0
  527. package/build-module/text-highlight/types.js.map +1 -0
  528. package/build-module/tip/index.js +6 -10
  529. package/build-module/tip/index.js.map +1 -1
  530. package/build-module/tip/types.js +2 -0
  531. package/build-module/tip/types.js.map +1 -0
  532. package/build-module/toggle-group-control/toggle-group-control/component.js +4 -1
  533. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  534. package/build-module/toggle-group-control/toggle-group-control/styles.js +15 -3
  535. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  536. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +6 -7
  537. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  538. package/build-module/toolbar-group/index.js +3 -2
  539. package/build-module/toolbar-group/index.js.map +1 -1
  540. package/build-module/tooltip/index.js +53 -16
  541. package/build-module/tooltip/index.js.map +1 -1
  542. package/build-module/tree-select/index.js +5 -5
  543. package/build-module/tree-select/index.js.map +1 -1
  544. package/build-module/truncate/component.js +7 -8
  545. package/build-module/truncate/component.js.map +1 -1
  546. package/build-module/truncate/hook.js +3 -10
  547. package/build-module/truncate/hook.js.map +1 -1
  548. package/build-module/truncate/index.js.map +1 -1
  549. package/build-module/truncate/styles.js +1 -1
  550. package/build-module/truncate/styles.js.map +1 -1
  551. package/build-module/truncate/utils.js +3 -16
  552. package/build-module/truncate/utils.js.map +1 -1
  553. package/build-module/ui/context/use-context-system.js +7 -2
  554. package/build-module/ui/context/use-context-system.js.map +1 -1
  555. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  556. package/build-module/ui/utils/space.js +7 -1
  557. package/build-module/ui/utils/space.js.map +1 -1
  558. package/build-module/unit-control/styles/unit-control-styles.js +10 -27
  559. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  560. package/build-module/utils/math.js +15 -6
  561. package/build-module/utils/math.js.map +1 -1
  562. package/build-module/v-stack/component.js +9 -9
  563. package/build-module/v-stack/component.js.map +1 -1
  564. package/build-module/v-stack/hook.js +0 -5
  565. package/build-module/v-stack/hook.js.map +1 -1
  566. package/build-module/v-stack/index.js.map +1 -1
  567. package/build-module/visually-hidden/component.js +12 -13
  568. package/build-module/visually-hidden/component.js.map +1 -1
  569. package/build-module/visually-hidden/index.js.map +1 -1
  570. package/build-module/visually-hidden/styles.js +3 -1
  571. package/build-module/visually-hidden/styles.js.map +1 -1
  572. package/build-module/visually-hidden/types.js +2 -0
  573. package/build-module/visually-hidden/types.js.map +1 -0
  574. package/build-style/style-rtl.css +41 -45
  575. package/build-style/style.css +41 -43
  576. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  577. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  578. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  579. package/build-types/border-control/border-control/component.d.ts +36 -2
  580. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  581. package/build-types/border-control/border-control/hook.d.ts +2 -2
  582. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  583. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  584. package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
  585. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  586. package/build-types/border-control/stories/index.d.ts +33 -0
  587. package/build-types/border-control/stories/index.d.ts.map +1 -0
  588. package/build-types/border-control/styles.d.ts +1 -4
  589. package/build-types/border-control/styles.d.ts.map +1 -1
  590. package/build-types/card/card-divider/hook.d.ts +1 -1
  591. package/build-types/color-indicator/index.d.ts +16 -5
  592. package/build-types/color-indicator/index.d.ts.map +1 -1
  593. package/build-types/color-indicator/stories/index.d.ts +12 -0
  594. package/build-types/color-indicator/stories/index.d.ts.map +1 -0
  595. package/build-types/color-indicator/test/index.d.ts +2 -0
  596. package/build-types/color-indicator/test/index.d.ts.map +1 -0
  597. package/build-types/color-indicator/types.d.ts +12 -0
  598. package/build-types/color-indicator/types.d.ts.map +1 -0
  599. package/build-types/color-palette/index.d.ts +1 -0
  600. package/build-types/color-palette/index.d.ts.map +1 -1
  601. package/build-types/color-palette/styles.d.ts +4 -2
  602. package/build-types/color-palette/styles.d.ts.map +1 -1
  603. package/build-types/color-picker/component.d.ts.map +1 -1
  604. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  605. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  606. package/build-types/color-picker/styles.d.ts +47 -31
  607. package/build-types/color-picker/styles.d.ts.map +1 -1
  608. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  609. package/build-types/date-time/date/index.d.ts +1 -1
  610. package/build-types/date-time/date/index.d.ts.map +1 -1
  611. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  612. package/build-types/date-time/types.d.ts +6 -0
  613. package/build-types/date-time/types.d.ts.map +1 -1
  614. package/build-types/divider/component.d.ts +2 -3
  615. package/build-types/divider/component.d.ts.map +1 -1
  616. package/build-types/divider/index.d.ts +1 -1
  617. package/build-types/divider/index.d.ts.map +1 -1
  618. package/build-types/divider/styles.d.ts +6 -2
  619. package/build-types/divider/styles.d.ts.map +1 -1
  620. package/build-types/divider/test/index.d.ts +2 -0
  621. package/build-types/divider/test/index.d.ts.map +1 -0
  622. package/build-types/divider/types.d.ts +18 -10
  623. package/build-types/divider/types.d.ts.map +1 -1
  624. package/build-types/dropdown/dropdown-content-wrapper.d.ts +23 -0
  625. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -0
  626. package/build-types/dropdown/styles.d.ts +7 -0
  627. package/build-types/dropdown/styles.d.ts.map +1 -0
  628. package/build-types/dropdown/types.d.ts +9 -0
  629. package/build-types/dropdown/types.d.ts.map +1 -0
  630. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  631. package/build-types/elevation/component.d.ts +11 -10
  632. package/build-types/elevation/component.d.ts.map +1 -1
  633. package/build-types/elevation/hook.d.ts +6 -7
  634. package/build-types/elevation/hook.d.ts.map +1 -1
  635. package/build-types/elevation/index.d.ts +2 -2
  636. package/build-types/elevation/index.d.ts.map +1 -1
  637. package/build-types/elevation/stories/index.d.ts +22 -0
  638. package/build-types/elevation/stories/index.d.ts.map +1 -0
  639. package/build-types/elevation/styles.d.ts +1 -1
  640. package/build-types/elevation/styles.d.ts.map +1 -1
  641. package/build-types/elevation/test/index.d.ts +2 -0
  642. package/build-types/elevation/test/index.d.ts.map +1 -0
  643. package/build-types/elevation/types.d.ts +12 -19
  644. package/build-types/elevation/types.d.ts.map +1 -1
  645. package/build-types/external-link/index.d.ts.map +1 -1
  646. package/build-types/flex/flex/component.d.ts +11 -17
  647. package/build-types/flex/flex/component.d.ts.map +1 -1
  648. package/build-types/flex/flex-block/component.d.ts +9 -3
  649. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  650. package/build-types/flex/flex-item/component.d.ts +9 -3
  651. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  652. package/build-types/flex/types.d.ts +4 -1
  653. package/build-types/flex/types.d.ts.map +1 -1
  654. package/build-types/form-toggle/index.d.ts +29 -0
  655. package/build-types/form-toggle/index.d.ts.map +1 -0
  656. package/build-types/form-toggle/stories/index.d.ts +12 -0
  657. package/build-types/form-toggle/stories/index.d.ts.map +1 -0
  658. package/build-types/form-toggle/test/index.d.ts +2 -0
  659. package/build-types/form-toggle/test/index.d.ts.map +1 -0
  660. package/build-types/form-toggle/types.d.ts +22 -0
  661. package/build-types/form-toggle/types.d.ts.map +1 -0
  662. package/build-types/form-token-field/index.d.ts.map +1 -1
  663. package/build-types/form-token-field/styles.d.ts +14 -0
  664. package/build-types/form-token-field/styles.d.ts.map +1 -0
  665. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  666. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +3 -0
  667. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -1
  668. package/build-types/form-token-field/types.d.ts +7 -0
  669. package/build-types/form-token-field/types.d.ts.map +1 -1
  670. package/build-types/grid/component.d.ts +3 -3
  671. package/build-types/grid/component.d.ts.map +1 -1
  672. package/build-types/grid/hook.d.ts +5 -2
  673. package/build-types/grid/hook.d.ts.map +1 -1
  674. package/build-types/grid/index.d.ts +2 -2
  675. package/build-types/grid/index.d.ts.map +1 -1
  676. package/build-types/grid/stories/index.d.ts +9 -0
  677. package/build-types/grid/stories/index.d.ts.map +1 -0
  678. package/build-types/grid/test/grid.d.ts +2 -0
  679. package/build-types/grid/test/grid.d.ts.map +1 -0
  680. package/build-types/grid/types.d.ts +16 -15
  681. package/build-types/grid/types.d.ts.map +1 -1
  682. package/build-types/grid/utils.d.ts +50 -69
  683. package/build-types/grid/utils.d.ts.map +1 -1
  684. package/build-types/h-stack/component.d.ts +3 -2
  685. package/build-types/h-stack/component.d.ts.map +1 -1
  686. package/build-types/h-stack/hook.d.ts +5 -3
  687. package/build-types/h-stack/hook.d.ts.map +1 -1
  688. package/build-types/h-stack/index.d.ts +2 -2
  689. package/build-types/h-stack/index.d.ts.map +1 -1
  690. package/build-types/h-stack/stories/index.d.ts +9 -0
  691. package/build-types/h-stack/stories/index.d.ts.map +1 -0
  692. package/build-types/h-stack/test/index.d.ts +2 -0
  693. package/build-types/h-stack/test/index.d.ts.map +1 -0
  694. package/build-types/h-stack/utils.d.ts +8 -4
  695. package/build-types/h-stack/utils.d.ts.map +1 -1
  696. package/build-types/heading/component.d.ts +1 -2
  697. package/build-types/heading/component.d.ts.map +1 -1
  698. package/build-types/heading/hook.d.ts +1 -28
  699. package/build-types/heading/hook.d.ts.map +1 -1
  700. package/build-types/heading/stories/index.d.ts.map +1 -1
  701. package/build-types/heading/test/index.d.ts +2 -0
  702. package/build-types/heading/test/index.d.ts.map +1 -0
  703. package/build-types/heading/types.d.ts +16 -0
  704. package/build-types/heading/types.d.ts.map +1 -0
  705. package/build-types/icon/index.d.ts +1 -1
  706. package/build-types/icon/index.d.ts.map +1 -1
  707. package/build-types/input-control/index.d.ts +1 -1
  708. package/build-types/input-control/index.d.ts.map +1 -1
  709. package/build-types/input-control/input-base.d.ts +1 -1
  710. package/build-types/input-control/input-base.d.ts.map +1 -1
  711. package/build-types/input-control/input-prefix-wrapper.d.ts +19 -0
  712. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -0
  713. package/build-types/input-control/input-suffix-wrapper.d.ts +19 -0
  714. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -0
  715. package/build-types/input-control/stories/index.d.ts +10 -0
  716. package/build-types/input-control/stories/index.d.ts.map +1 -1
  717. package/build-types/input-control/styles/input-control-styles.d.ts +21 -0
  718. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  719. package/build-types/input-control/types.d.ts +45 -3
  720. package/build-types/input-control/types.d.ts.map +1 -1
  721. package/build-types/menu-item/index.d.ts.map +1 -1
  722. package/build-types/popover/index.d.ts.map +1 -1
  723. package/build-types/radio-control/index.d.ts.map +1 -1
  724. package/build-types/range-control/index.d.ts +54 -29
  725. package/build-types/range-control/index.d.ts.map +1 -1
  726. package/build-types/range-control/input-range.d.ts +7 -10
  727. package/build-types/range-control/input-range.d.ts.map +1 -1
  728. package/build-types/range-control/mark.d.ts +4 -7
  729. package/build-types/range-control/mark.d.ts.map +1 -1
  730. package/build-types/range-control/rail.d.ts +4 -9
  731. package/build-types/range-control/rail.d.ts.map +1 -1
  732. package/build-types/range-control/stories/index.d.ts +48 -0
  733. package/build-types/range-control/stories/index.d.ts.map +1 -0
  734. package/build-types/range-control/styles/range-control-styles.d.ts +32 -40
  735. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  736. package/build-types/range-control/test/index.d.ts +2 -0
  737. package/build-types/range-control/test/index.d.ts.map +1 -0
  738. package/build-types/range-control/tooltip.d.ts +4 -11
  739. package/build-types/range-control/tooltip.d.ts.map +1 -1
  740. package/build-types/range-control/types.d.ts +304 -0
  741. package/build-types/range-control/types.d.ts.map +1 -0
  742. package/build-types/range-control/utils.d.ts +15 -33
  743. package/build-types/range-control/utils.d.ts.map +1 -1
  744. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  745. package/build-types/scroll-lock/index.d.ts +32 -3
  746. package/build-types/scroll-lock/index.d.ts.map +1 -1
  747. package/build-types/scroll-lock/stories/index.d.ts +9 -0
  748. package/build-types/scroll-lock/stories/index.d.ts.map +1 -0
  749. package/build-types/scroll-lock/test/index.d.ts +2 -0
  750. package/build-types/scroll-lock/test/index.d.ts.map +1 -0
  751. package/build-types/scrollable/component.d.ts +3 -3
  752. package/build-types/scrollable/component.d.ts.map +1 -1
  753. package/build-types/scrollable/hook.d.ts +5 -2
  754. package/build-types/scrollable/hook.d.ts.map +1 -1
  755. package/build-types/scrollable/index.d.ts +2 -2
  756. package/build-types/scrollable/index.d.ts.map +1 -1
  757. package/build-types/scrollable/stories/index.d.ts +9 -0
  758. package/build-types/scrollable/stories/index.d.ts.map +1 -0
  759. package/build-types/scrollable/styles.d.ts +7 -7
  760. package/build-types/scrollable/styles.d.ts.map +1 -1
  761. package/build-types/scrollable/test/index.d.ts +2 -0
  762. package/build-types/scrollable/test/index.d.ts.map +1 -0
  763. package/build-types/scrollable/types.d.ts +9 -6
  764. package/build-types/scrollable/types.d.ts.map +1 -1
  765. package/build-types/select-control/index.d.ts.map +1 -1
  766. package/build-types/select-control/styles/select-control-styles.d.ts +1 -1
  767. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  768. package/build-types/select-control/types.d.ts +1 -1
  769. package/build-types/select-control/types.d.ts.map +1 -1
  770. package/build-types/shortcut/index.d.ts +5 -24
  771. package/build-types/shortcut/index.d.ts.map +1 -1
  772. package/build-types/shortcut/test/index.d.ts +2 -0
  773. package/build-types/shortcut/test/index.d.ts.map +1 -0
  774. package/build-types/shortcut/types.d.ts +14 -0
  775. package/build-types/shortcut/types.d.ts.map +1 -0
  776. package/build-types/slot-fill/provider.d.ts.map +1 -1
  777. package/build-types/slot-fill/slot.d.ts.map +1 -1
  778. package/build-types/spacer/component.d.ts +6 -5
  779. package/build-types/spacer/component.d.ts.map +1 -1
  780. package/build-types/spacer/hook.d.ts +2 -2
  781. package/build-types/spacer/hook.d.ts.map +1 -1
  782. package/build-types/spacer/index.d.ts +1 -1
  783. package/build-types/spacer/index.d.ts.map +1 -1
  784. package/build-types/spacer/stories/index.d.ts +12 -0
  785. package/build-types/spacer/stories/index.d.ts.map +1 -0
  786. package/build-types/spacer/test/index.d.ts +2 -0
  787. package/build-types/spacer/test/index.d.ts.map +1 -0
  788. package/build-types/spacer/types.d.ts +41 -29
  789. package/build-types/spacer/types.d.ts.map +1 -1
  790. package/build-types/spinner/index.d.ts +16 -15
  791. package/build-types/spinner/index.d.ts.map +1 -1
  792. package/build-types/spinner/stories/index.d.ts +13 -0
  793. package/build-types/spinner/stories/index.d.ts.map +1 -0
  794. package/build-types/spinner/styles.d.ts +4 -3
  795. package/build-types/spinner/styles.d.ts.map +1 -1
  796. package/build-types/text/types.d.ts +1 -1
  797. package/build-types/text/types.d.ts.map +1 -1
  798. package/build-types/text-highlight/index.d.ts +23 -0
  799. package/build-types/text-highlight/index.d.ts.map +1 -0
  800. package/build-types/text-highlight/stories/index.d.ts +12 -0
  801. package/build-types/text-highlight/stories/index.d.ts.map +1 -0
  802. package/build-types/text-highlight/test/index.d.ts +2 -0
  803. package/build-types/text-highlight/test/index.d.ts.map +1 -0
  804. package/build-types/text-highlight/types.d.ts +17 -0
  805. package/build-types/text-highlight/types.d.ts.map +1 -0
  806. package/build-types/tip/index.d.ts +5 -14
  807. package/build-types/tip/index.d.ts.map +1 -1
  808. package/build-types/tip/stories/index.d.ts +12 -0
  809. package/build-types/tip/stories/index.d.ts.map +1 -0
  810. package/build-types/tip/types.d.ts +11 -0
  811. package/build-types/tip/types.d.ts.map +1 -0
  812. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +5 -1
  813. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  814. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +0 -1
  815. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  816. package/build-types/toggle-group-control/types.d.ts +6 -0
  817. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  818. package/build-types/tooltip/index.d.ts.map +1 -1
  819. package/build-types/tree-select/index.d.ts.map +1 -1
  820. package/build-types/tree-select/types.d.ts +1 -0
  821. package/build-types/tree-select/types.d.ts.map +1 -1
  822. package/build-types/truncate/component.d.ts +3 -3
  823. package/build-types/truncate/component.d.ts.map +1 -1
  824. package/build-types/truncate/hook.d.ts +5 -2
  825. package/build-types/truncate/hook.d.ts.map +1 -1
  826. package/build-types/truncate/index.d.ts +2 -2
  827. package/build-types/truncate/index.d.ts.map +1 -1
  828. package/build-types/truncate/stories/index.d.ts +13 -0
  829. package/build-types/truncate/stories/index.d.ts.map +1 -0
  830. package/build-types/truncate/styles.d.ts +1 -1
  831. package/build-types/truncate/styles.d.ts.map +1 -1
  832. package/build-types/truncate/test/index.d.ts +2 -0
  833. package/build-types/truncate/test/index.d.ts.map +1 -0
  834. package/build-types/truncate/types.d.ts +22 -11
  835. package/build-types/truncate/types.d.ts.map +1 -1
  836. package/build-types/truncate/utils.d.ts +17 -28
  837. package/build-types/truncate/utils.d.ts.map +1 -1
  838. package/build-types/ui/context/use-context-system.d.ts.map +1 -1
  839. package/build-types/ui/form-group/form-group.d.ts +1 -1
  840. package/build-types/ui/form-group/types.d.ts +1 -1
  841. package/build-types/ui/form-group/types.d.ts.map +1 -1
  842. package/build-types/ui/form-group/use-form-group.d.ts +5 -5
  843. package/build-types/ui/utils/get-valid-children.d.ts +2 -2
  844. package/build-types/ui/utils/get-valid-children.d.ts.map +1 -1
  845. package/build-types/ui/utils/space.d.ts +7 -1
  846. package/build-types/ui/utils/space.d.ts.map +1 -1
  847. package/build-types/unit-control/index.d.ts +2 -2
  848. package/build-types/unit-control/index.d.ts.map +1 -1
  849. package/build-types/unit-control/styles/unit-control-styles.d.ts +0 -1
  850. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  851. package/build-types/unit-control/types.d.ts +1 -1
  852. package/build-types/unit-control/types.d.ts.map +1 -1
  853. package/build-types/utils/math.d.ts +10 -0
  854. package/build-types/utils/math.d.ts.map +1 -1
  855. package/build-types/v-stack/component.d.ts +5 -4
  856. package/build-types/v-stack/component.d.ts.map +1 -1
  857. package/build-types/v-stack/hook.d.ts +5 -3
  858. package/build-types/v-stack/hook.d.ts.map +1 -1
  859. package/build-types/v-stack/index.d.ts +2 -2
  860. package/build-types/v-stack/index.d.ts.map +1 -1
  861. package/build-types/v-stack/stories/index.d.ts +9 -0
  862. package/build-types/v-stack/stories/index.d.ts.map +1 -0
  863. package/build-types/v-stack/test/index.d.ts +2 -0
  864. package/build-types/v-stack/test/index.d.ts.map +1 -0
  865. package/build-types/v-stack/types.d.ts +21 -1
  866. package/build-types/v-stack/types.d.ts.map +1 -1
  867. package/build-types/visually-hidden/component.d.ts +8 -10
  868. package/build-types/visually-hidden/component.d.ts.map +1 -1
  869. package/build-types/visually-hidden/index.d.ts +1 -1
  870. package/build-types/visually-hidden/index.d.ts.map +1 -1
  871. package/build-types/visually-hidden/stories/index.d.ts +14 -0
  872. package/build-types/visually-hidden/stories/index.d.ts.map +1 -0
  873. package/build-types/visually-hidden/styles.d.ts +5 -2
  874. package/build-types/visually-hidden/styles.d.ts.map +1 -1
  875. package/build-types/visually-hidden/test/index.d.ts +2 -0
  876. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  877. package/build-types/visually-hidden/types.d.ts +11 -0
  878. package/build-types/visually-hidden/types.d.ts.map +1 -0
  879. package/package.json +18 -17
  880. package/src/alignment-matrix-control/utils.js +1 -6
  881. package/src/angle-picker-control/index.js +1 -2
  882. package/src/autocomplete/autocompleter-ui.js +4 -1
  883. package/src/autocomplete/autocompleter-ui.native.js +8 -2
  884. package/src/autocomplete/get-default-use-items.js +3 -2
  885. package/src/autocomplete/index.js +7 -10
  886. package/src/base-control/styles/base-control-styles.ts +5 -0
  887. package/src/border-box-control/border-box-control/component.tsx +1 -0
  888. package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
  889. package/src/border-control/border-control/component.tsx +82 -36
  890. package/src/border-control/border-control/hook.ts +5 -10
  891. package/src/border-control/border-control-dropdown/component.tsx +50 -45
  892. package/src/border-control/border-control-dropdown/hook.ts +0 -5
  893. package/src/border-control/stories/index.tsx +153 -0
  894. package/src/border-control/styles.ts +23 -69
  895. package/src/border-control/test/index.js +19 -8
  896. package/src/box-control/axial-input-controls.js +1 -1
  897. package/src/box-control/index.js +1 -1
  898. package/src/box-control/utils.js +9 -16
  899. package/src/button/README.md +1 -1
  900. package/src/card/test/__snapshots__/index.js.snap +8 -8
  901. package/src/color-indicator/README.md +7 -9
  902. package/src/color-indicator/index.tsx +47 -0
  903. package/src/color-indicator/stories/index.tsx +37 -0
  904. package/src/color-indicator/test/__snapshots__/index.tsx.snap +11 -0
  905. package/src/color-indicator/test/{index.js → index.tsx} +4 -4
  906. package/src/color-indicator/types.ts +12 -0
  907. package/src/color-palette/index.js +24 -9
  908. package/src/color-palette/style.scss +5 -0
  909. package/src/color-palette/test/utils.ts +19 -1
  910. package/src/color-picker/component.tsx +12 -11
  911. package/src/color-picker/hex-input.tsx +5 -3
  912. package/src/color-picker/index.native.js +20 -27
  913. package/src/color-picker/input-with-slider.tsx +6 -3
  914. package/src/color-picker/styles.ts +20 -17
  915. package/src/color-picker/use-deprecated-props.ts +24 -43
  916. package/src/combobox-control/index.js +20 -13
  917. package/src/combobox-control/stories/index.js +3 -2
  918. package/src/combobox-control/style.scss +1 -1
  919. package/src/combobox-control/styles.ts +27 -0
  920. package/src/confirm-dialog/README.md +1 -1
  921. package/src/custom-gradient-picker/index.js +4 -11
  922. package/src/custom-gradient-picker/index.native.js +3 -11
  923. package/src/custom-gradient-picker/serializer.js +5 -11
  924. package/src/custom-select-control/index.js +44 -26
  925. package/src/custom-select-control/stories/index.js +7 -2
  926. package/src/custom-select-control/style.scss +4 -29
  927. package/src/date-time/README.md +7 -0
  928. package/src/date-time/date/index.tsx +2 -0
  929. package/src/date-time/date-time/index.tsx +2 -0
  930. package/src/date-time/types.ts +7 -0
  931. package/src/dimension-control/README.md +5 -2
  932. package/src/dimension-control/test/index.test.js +7 -7
  933. package/src/divider/README.md +12 -5
  934. package/src/divider/component.tsx +2 -3
  935. package/src/divider/index.ts +1 -1
  936. package/src/divider/stories/index.tsx +4 -4
  937. package/src/divider/styles.ts +7 -7
  938. package/src/divider/test/__snapshots__/{index.js.snap → index.tsx.snap} +7 -7
  939. package/src/divider/test/index.tsx +40 -0
  940. package/src/divider/types.ts +21 -15
  941. package/src/draggable/README.md +1 -1
  942. package/src/dropdown/dropdown-content-wrapper.tsx +59 -0
  943. package/src/dropdown/stories/index.js +60 -69
  944. package/src/dropdown/styles.ts +38 -0
  945. package/src/dropdown/types.ts +8 -0
  946. package/src/dropdown-menu/index.js +3 -4
  947. package/src/dropdown-menu/index.native.js +3 -5
  948. package/src/duotone-picker/duotone-picker.js +58 -37
  949. package/src/duotone-picker/style.scss +19 -0
  950. package/src/elevation/README.md +16 -14
  951. package/src/elevation/component.tsx +48 -0
  952. package/src/elevation/{hook.js → hook.ts} +29 -26
  953. package/src/elevation/{index.js → index.ts} +0 -0
  954. package/src/elevation/stories/index.tsx +85 -0
  955. package/src/elevation/{styles.js → styles.ts} +0 -0
  956. package/src/elevation/test/__snapshots__/{index.js.snap → index.tsx.snap} +19 -13
  957. package/src/elevation/test/index.tsx +64 -0
  958. package/src/elevation/types.ts +12 -19
  959. package/src/external-link/index.tsx +10 -4
  960. package/src/flex/flex/README.md +3 -12
  961. package/src/flex/flex/component.js +11 -17
  962. package/src/flex/flex-block/README.md +0 -4
  963. package/src/flex/flex-block/component.js +9 -3
  964. package/src/flex/flex-item/README.md +1 -5
  965. package/src/flex/flex-item/component.js +9 -3
  966. package/src/flex/stories/index.js +1 -1
  967. package/src/flex/types.ts +4 -1
  968. package/src/focal-point-picker/grid.js +2 -5
  969. package/src/focal-point-picker/index.native.js +9 -9
  970. package/src/focal-point-picker/tooltip/index.native.js +10 -11
  971. package/src/form-toggle/README.md +10 -11
  972. package/src/form-toggle/index.tsx +71 -0
  973. package/src/form-toggle/stories/index.tsx +52 -0
  974. package/src/form-toggle/test/__snapshots__/index.tsx.snap +54 -0
  975. package/src/form-toggle/test/index.tsx +102 -0
  976. package/src/form-toggle/types.ts +22 -0
  977. package/src/form-token-field/index.tsx +45 -24
  978. package/src/form-token-field/style.scss +2 -7
  979. package/src/form-token-field/styles.ts +32 -0
  980. package/src/form-token-field/suggestions-list.tsx +2 -4
  981. package/src/form-token-field/test/index.js +7 -10
  982. package/src/form-token-field/test/lib/token-field-wrapper.tsx +2 -2
  983. package/src/form-token-field/types.ts +7 -0
  984. package/src/grid/README.md +33 -19
  985. package/src/grid/{component.js → component.tsx} +13 -9
  986. package/src/grid/{hook.js → hook.ts} +5 -5
  987. package/src/grid/{index.js → index.ts} +0 -0
  988. package/src/grid/stories/index.tsx +72 -0
  989. package/src/grid/test/{grid.js → grid.tsx} +4 -4
  990. package/src/grid/types.ts +16 -17
  991. package/src/grid/{utils.js → utils.ts} +9 -7
  992. package/src/guide/style.scss +1 -0
  993. package/src/h-stack/{component.js → component.tsx} +8 -8
  994. package/src/h-stack/{hook.js → hook.tsx} +21 -16
  995. package/src/h-stack/{index.js → index.ts} +0 -0
  996. package/src/h-stack/stories/index.tsx +92 -0
  997. package/src/h-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  998. package/src/h-stack/test/{index.js → index.tsx} +0 -0
  999. package/src/h-stack/{utils.js → utils.ts} +16 -16
  1000. package/src/heading/README.md +4 -3
  1001. package/src/heading/component.tsx +2 -2
  1002. package/src/heading/hook.ts +1 -42
  1003. package/src/heading/stories/index.tsx +5 -1
  1004. package/src/heading/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1005. package/src/heading/test/index.tsx +68 -0
  1006. package/src/heading/types.ts +29 -0
  1007. package/src/higher-order/navigate-regions/README.md +4 -1
  1008. package/src/icon/index.tsx +1 -1
  1009. package/src/index.js +3 -0
  1010. package/src/input-control/index.tsx +6 -0
  1011. package/src/input-control/input-base.tsx +28 -12
  1012. package/src/input-control/input-prefix-wrapper.tsx +48 -0
  1013. package/src/input-control/input-suffix-wrapper.tsx +48 -0
  1014. package/src/input-control/stories/index.tsx +15 -2
  1015. package/src/input-control/styles/input-control-styles.tsx +25 -11
  1016. package/src/input-control/test/index.js +106 -31
  1017. package/src/input-control/types.ts +52 -3
  1018. package/src/menu-item/index.js +1 -2
  1019. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +2 -7
  1020. package/src/mobile/focal-point-settings-panel/index.native.js +2 -2
  1021. package/src/mobile/image/index.native.js +12 -6
  1022. package/src/mobile/link-picker/index.native.js +2 -3
  1023. package/src/mobile/media-edit/index.native.js +2 -7
  1024. package/src/mobile/segmented-control/index.native.js +6 -5
  1025. package/src/modal/index.js +21 -2
  1026. package/src/modal/stories/index.js +17 -1
  1027. package/src/modal/style.scss +14 -19
  1028. package/src/navigation/group/index.js +8 -3
  1029. package/src/navigation/index.js +3 -0
  1030. package/src/navigation/item/base.js +5 -3
  1031. package/src/navigation/item/use-navigation-tree-item.js +2 -0
  1032. package/src/navigation/menu/menu-title-search.js +3 -6
  1033. package/src/navigation/menu/search-no-results-found.js +3 -6
  1034. package/src/navigation/use-navigation-tree-nodes.js +11 -10
  1035. package/src/navigation/utils.js +2 -2
  1036. package/src/number-control/stories/index.js +24 -24
  1037. package/src/popover/README.md +2 -2
  1038. package/src/popover/index.js +20 -13
  1039. package/src/popover/stories/index.js +2 -0
  1040. package/src/popover/style.scss +1 -1
  1041. package/src/radio-control/index.tsx +1 -2
  1042. package/src/range-control/README.md +108 -80
  1043. package/src/range-control/{index.js → index.tsx} +79 -49
  1044. package/src/range-control/{input-range.js → input-range.tsx} +11 -7
  1045. package/src/range-control/{mark.js → mark.tsx} +15 -9
  1046. package/src/range-control/{rail.js → rail.tsx} +40 -23
  1047. package/src/range-control/stories/index.tsx +244 -0
  1048. package/src/range-control/styles/{range-control-styles.js → range-control-styles.ts} +28 -24
  1049. package/src/range-control/test/index.tsx +341 -0
  1050. package/src/range-control/{tooltip.js → tooltip.tsx} +19 -14
  1051. package/src/range-control/types.ts +328 -0
  1052. package/src/range-control/utils.ts +135 -0
  1053. package/src/resizable-box/resize-tooltip/utils.ts +2 -3
  1054. package/src/sandbox/index.native.js +14 -1
  1055. package/src/scroll-lock/README.md +1 -1
  1056. package/src/scroll-lock/{index.js → index.tsx} +34 -7
  1057. package/src/scroll-lock/stories/index.tsx +96 -0
  1058. package/src/scroll-lock/test/index.tsx +26 -0
  1059. package/src/scrollable/README.md +14 -8
  1060. package/src/scrollable/{component.js → component.tsx} +13 -10
  1061. package/src/scrollable/{hook.js → hook.ts} +5 -7
  1062. package/src/scrollable/{index.js → index.ts} +0 -0
  1063. package/src/scrollable/stories/{index.js → index.tsx} +29 -34
  1064. package/src/scrollable/{styles.js → styles.ts} +0 -0
  1065. package/src/scrollable/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
  1066. package/src/scrollable/test/index.tsx +34 -0
  1067. package/src/scrollable/types.ts +10 -5
  1068. package/src/select-control/index.tsx +1 -2
  1069. package/src/select-control/styles/select-control-styles.ts +33 -9
  1070. package/src/select-control/test/select-control.tsx +22 -15
  1071. package/src/select-control/types.ts +1 -0
  1072. package/src/shortcut/index.tsx +32 -0
  1073. package/src/shortcut/test/__snapshots__/index.tsx.snap +15 -0
  1074. package/src/shortcut/test/index.tsx +41 -0
  1075. package/src/shortcut/types.ts +10 -0
  1076. package/src/slot-fill/index.native.js +2 -7
  1077. package/src/slot-fill/provider.js +3 -7
  1078. package/src/slot-fill/slot.js +21 -24
  1079. package/src/slot-fill/test/slot.js +2 -3
  1080. package/src/spacer/README.md +43 -37
  1081. package/src/spacer/component.tsx +8 -7
  1082. package/src/spacer/hook.ts +4 -2
  1083. package/src/spacer/index.ts +1 -1
  1084. package/src/spacer/stories/index.tsx +70 -0
  1085. package/src/spacer/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
  1086. package/src/spacer/test/index.tsx +149 -0
  1087. package/src/spacer/types.ts +41 -29
  1088. package/src/spinner/{index.js → index.tsx} +23 -9
  1089. package/src/spinner/stories/index.tsx +32 -0
  1090. package/src/spinner/{styles.js → styles.ts} +0 -0
  1091. package/src/style.scss +1 -0
  1092. package/src/tab-panel/README.md +1 -1
  1093. package/src/text/types.ts +1 -1
  1094. package/src/text-highlight/README.md +6 -6
  1095. package/src/text-highlight/index.tsx +49 -0
  1096. package/src/text-highlight/stories/index.tsx +33 -0
  1097. package/src/text-highlight/test/index.tsx +93 -0
  1098. package/src/text-highlight/types.ts +16 -0
  1099. package/src/tip/index.tsx +22 -0
  1100. package/src/tip/stories/index.tsx +33 -0
  1101. package/src/tip/types.ts +11 -0
  1102. package/src/toggle-group-control/stories/index.js +19 -3
  1103. package/src/toggle-group-control/test/__snapshots__/index.js.snap +4 -4
  1104. package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
  1105. package/src/toggle-group-control/toggle-group-control/styles.ts +22 -2
  1106. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -4
  1107. package/src/toggle-group-control/types.ts +6 -0
  1108. package/src/toolbar-group/index.js +1 -2
  1109. package/src/tools-panel/tools-panel/README.md +94 -21
  1110. package/src/tooltip/index.js +56 -10
  1111. package/src/tooltip/stories/index.js +28 -13
  1112. package/src/tooltip/style.scss +1 -1
  1113. package/src/tree-select/index.tsx +7 -6
  1114. package/src/tree-select/types.ts +4 -0
  1115. package/src/truncate/README.md +16 -12
  1116. package/src/truncate/{component.js → component.tsx} +13 -9
  1117. package/src/truncate/{hook.js → hook.ts} +8 -10
  1118. package/src/truncate/{index.js → index.ts} +0 -0
  1119. package/src/truncate/stories/index.tsx +49 -0
  1120. package/src/truncate/{styles.js → styles.ts} +0 -0
  1121. package/src/truncate/test/{index.js → index.tsx} +4 -4
  1122. package/src/truncate/types.ts +28 -10
  1123. package/src/truncate/{utils.js → utils.ts} +19 -19
  1124. package/src/ui/context/test/context-system-provider.js +101 -1
  1125. package/src/ui/context/use-context-system.js +7 -2
  1126. package/src/ui/form-group/types.ts +1 -1
  1127. package/src/ui/utils/get-valid-children.ts +4 -2
  1128. package/src/ui/utils/space.ts +7 -1
  1129. package/src/unit-control/styles/unit-control-styles.ts +15 -13
  1130. package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -4
  1131. package/src/unit-control/types.ts +1 -1
  1132. package/src/utils/math.js +14 -5
  1133. package/src/utils/test/math.js +22 -1
  1134. package/src/v-stack/README.md +6 -18
  1135. package/src/v-stack/{component.js → component.tsx} +15 -10
  1136. package/src/v-stack/{hook.js → hook.ts} +5 -6
  1137. package/src/v-stack/{index.js → index.ts} +0 -0
  1138. package/src/v-stack/stories/index.tsx +41 -0
  1139. package/src/v-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1140. package/src/v-stack/test/{index.js → index.tsx} +0 -0
  1141. package/src/v-stack/types.ts +21 -1
  1142. package/src/visually-hidden/{component.js → component.tsx} +23 -15
  1143. package/src/visually-hidden/{index.js → index.ts} +0 -0
  1144. package/src/visually-hidden/stories/index.tsx +66 -0
  1145. package/src/visually-hidden/{styles.js → styles.ts} +6 -2
  1146. package/src/visually-hidden/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1147. package/src/visually-hidden/test/index.tsx +17 -0
  1148. package/src/visually-hidden/types.ts +11 -0
  1149. package/tsconfig.json +2 -0
  1150. package/tsconfig.tsbuildinfo +1 -1
  1151. package/src/border-control/stories/index.js +0 -119
  1152. package/src/color-indicator/index.js +0 -16
  1153. package/src/color-indicator/stories/index.js +0 -22
  1154. package/src/color-indicator/test/__snapshots__/index.js.snap +0 -13
  1155. package/src/divider/test/index.js +0 -41
  1156. package/src/elevation/component.js +0 -43
  1157. package/src/elevation/stories/index.js +0 -148
  1158. package/src/elevation/test/index.js +0 -51
  1159. package/src/form-toggle/index.js +0 -38
  1160. package/src/form-toggle/stories/index.js +0 -28
  1161. package/src/form-toggle/test/index.js +0 -74
  1162. package/src/grid/stories/index.js +0 -49
  1163. package/src/h-stack/stories/index.js +0 -22
  1164. package/src/heading/test/index.js +0 -67
  1165. package/src/range-control/stories/index.js +0 -180
  1166. package/src/range-control/test/index.js +0 -320
  1167. package/src/range-control/utils.js +0 -134
  1168. package/src/scroll-lock/stories/index.js +0 -71
  1169. package/src/scroll-lock/test/index.js +0 -53
  1170. package/src/scrollable/test/index.js +0 -31
  1171. package/src/shortcut/index.js +0 -41
  1172. package/src/shortcut/test/index.js +0 -37
  1173. package/src/spacer/stories/index.js +0 -59
  1174. package/src/spacer/test/index.js +0 -146
  1175. package/src/spinner/stories/index.js +0 -43
  1176. package/src/text-highlight/index.js +0 -28
  1177. package/src/text-highlight/stories/index.js +0 -28
  1178. package/src/text-highlight/test/index.js +0 -120
  1179. package/src/tip/index.js +0 -24
  1180. package/src/tip/stories/index.js +0 -26
  1181. package/src/truncate/stories/index.js +0 -38
  1182. package/src/visually-hidden/stories/index.js +0 -42
  1183. package/src/visually-hidden/test/index.js +0 -19
@@ -9,8 +9,8 @@ import { includes } from 'lodash';
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- import { Children, cloneElement, concatChildren, useEffect, useState } from '@wordpress/element';
13
- import { useDebounce } from '@wordpress/compose';
12
+ import { Children, cloneElement, concatChildren, useEffect, useState, useRef } from '@wordpress/element';
13
+ import { useDebounce, useMergeRefs } from '@wordpress/compose';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
@@ -32,33 +32,40 @@ const getDisabledElement = _ref => {
32
32
  let {
33
33
  eventHandlers,
34
34
  child,
35
- childrenWithPopover
35
+ childrenWithPopover,
36
+ mergedRefs
36
37
  } = _ref;
37
38
  return cloneElement(createElement("span", {
38
39
  className: "disabled-element-wrapper"
39
40
  }, cloneElement(eventCatcher, eventHandlers), cloneElement(child, {
40
- children: childrenWithPopover
41
- })), eventHandlers);
41
+ children: childrenWithPopover,
42
+ ref: mergedRefs
43
+ })), { ...eventHandlers
44
+ });
42
45
  };
43
46
 
44
47
  const getRegularElement = _ref2 => {
45
48
  let {
46
49
  child,
47
50
  eventHandlers,
48
- childrenWithPopover
51
+ childrenWithPopover,
52
+ mergedRefs
49
53
  } = _ref2;
50
54
  return cloneElement(child, { ...eventHandlers,
51
- children: childrenWithPopover
55
+ children: childrenWithPopover,
56
+ ref: mergedRefs
52
57
  });
53
58
  };
54
59
 
55
60
  const addPopoverToGrandchildren = _ref3 => {
56
61
  let {
62
+ anchorRef,
57
63
  grandchildren,
58
64
  isOver,
65
+ offset,
59
66
  position,
60
- text,
61
- shortcut
67
+ shortcut,
68
+ text
62
69
  } = _ref3;
63
70
  return concatChildren(grandchildren, isOver && createElement(Popover, {
64
71
  focusOnMount: false,
@@ -66,7 +73,8 @@ const addPopoverToGrandchildren = _ref3 => {
66
73
  className: "components-tooltip",
67
74
  "aria-hidden": "true",
68
75
  animate: false,
69
- offset: 12,
76
+ offset: offset,
77
+ anchorRef: anchorRef,
70
78
  __unstableShift: true
71
79
  }, text, createElement(Shortcut, {
72
80
  className: "components-tooltip__shortcut",
@@ -91,6 +99,8 @@ const emitToChild = (children, eventName, event) => {
91
99
  };
92
100
 
93
101
  function Tooltip(props) {
102
+ var _Children$toArray$;
103
+
94
104
  const {
95
105
  children,
96
106
  position = 'bottom middle',
@@ -107,10 +117,25 @@ function Tooltip(props) {
107
117
 
108
118
  const [isMouseDown, setIsMouseDown] = useState(false);
109
119
  const [isOver, setIsOver] = useState(false);
110
- const delayedSetIsOver = useDebounce(setIsOver, delay);
120
+ const delayedSetIsOver = useDebounce(setIsOver, delay); // Create a reference to the Tooltip's child, to be passed to the Popover
121
+ // so that the Tooltip can be correctly positioned. Also, merge with the
122
+ // existing ref for the first child, so that its ref is preserved.
123
+
124
+ const childRef = useRef(null);
125
+ const existingChildRef = (_Children$toArray$ = Children.toArray(children)[0]) === null || _Children$toArray$ === void 0 ? void 0 : _Children$toArray$.ref;
126
+ const mergedChildRefs = useMergeRefs([childRef, existingChildRef]);
111
127
 
112
128
  const createMouseDown = event => {
113
- // Preserve original child callback behavior.
129
+ // In firefox, the mouse down event is also fired when the select
130
+ // list is chosen.
131
+ // Cancel further processing because re-rendering of child components
132
+ // causes onChange to be triggered with the old value.
133
+ // See https://github.com/WordPress/gutenberg/pull/42483
134
+ if (event.target.tagName === 'OPTION') {
135
+ return;
136
+ } // Preserve original child callback behavior.
137
+
138
+
114
139
  emitToChild(children, 'onMouseDown', event); // On mouse down, the next `mouseup` should revert the value of the
115
140
  // instance property and remove its own event handler. The bind is
116
141
  // made on the document since the `mouseup` might not occur within
@@ -121,6 +146,15 @@ function Tooltip(props) {
121
146
  };
122
147
 
123
148
  const createMouseUp = event => {
149
+ // In firefox, the mouse up event is also fired when the select
150
+ // list is chosen.
151
+ // Cancel further processing because re-rendering of child components
152
+ // causes onChange to be triggered with the old value.
153
+ // See https://github.com/WordPress/gutenberg/pull/42483
154
+ if (event.target.tagName === 'OPTION') {
155
+ return;
156
+ }
157
+
124
158
  emitToChild(children, 'onMouseUp', event);
125
159
  document.removeEventListener('mouseup', cancelIsMouseDown);
126
160
  setIsMouseDown(false);
@@ -146,7 +180,7 @@ function Tooltip(props) {
146
180
  emitToChild(children, eventName, event); // Mouse events behave unreliably in React for disabled elements,
147
181
  // firing on mouseenter but not mouseleave. Further, the default
148
182
  // behavior for disabled elements in some browsers is to ignore
149
- // mouse events. Don't bother trying to to handle them.
183
+ // mouse events. Don't bother trying to handle them.
150
184
  //
151
185
  // See: https://github.com/facebook/react/issues/4251
152
186
 
@@ -210,10 +244,12 @@ function Tooltip(props) {
210
244
  } = child.props;
211
245
  const getElementWithPopover = disabled ? getDisabledElement : getRegularElement;
212
246
  const popoverData = {
247
+ anchorRef: childRef,
213
248
  isOver,
249
+ offset: 4,
214
250
  position,
215
- text,
216
- shortcut
251
+ shortcut,
252
+ text
217
253
  };
218
254
  const childrenWithPopover = addPopoverToGrandchildren({
219
255
  grandchildren,
@@ -222,7 +258,8 @@ function Tooltip(props) {
222
258
  return getElementWithPopover({
223
259
  child,
224
260
  eventHandlers,
225
- childrenWithPopover
261
+ childrenWithPopover,
262
+ mergedRefs: mergedChildRefs
226
263
  });
227
264
  }
228
265
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tooltip/index.js"],"names":["includes","Children","cloneElement","concatChildren","useEffect","useState","useDebounce","Popover","Shortcut","TOOLTIP_DELAY","eventCatcher","getDisabledElement","eventHandlers","child","childrenWithPopover","children","getRegularElement","addPopoverToGrandchildren","grandchildren","isOver","position","text","shortcut","emitToChild","eventName","event","count","only","props","disabled","Tooltip","delay","isMouseDown","setIsMouseDown","setIsOver","delayedSetIsOver","createMouseDown","document","addEventListener","cancelIsMouseDown","createMouseUp","removeEventListener","createMouseEvent","type","createToggleIsOver","isDelayed","currentTarget","cancel","_isOver","clearOnUnmount","process","env","NODE_ENV","console","error","onMouseEnter","onMouseLeave","onClick","onFocus","onBlur","onMouseDown","getElementWithPopover","popoverData"],"mappings":";AAAA;;AACA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,cAHD,EAICC,SAJD,EAKCC,QALD,QAMO,oBANP;AAOA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,QAAP,MAAqB,aAArB;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,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;AAED,eAAegB,OAAf","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tcloneElement,\n\tconcatChildren,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Popover from '../popover';\nimport Shortcut from '../shortcut';\n\n/**\n * Time over children to wait before showing tooltip\n *\n * @type {number}\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst eventCatcher = <div className=\"event-catcher\" />;\n\nconst getDisabledElement = ( { eventHandlers, child, childrenWithPopover } ) =>\n\tcloneElement(\n\t\t<span className=\"disabled-element-wrapper\">\n\t\t\t{ cloneElement( eventCatcher, eventHandlers ) }\n\t\t\t{ cloneElement( child, {\n\t\t\t\tchildren: childrenWithPopover,\n\t\t\t} ) }\n\t\t</span>,\n\t\teventHandlers\n\t);\n\nconst getRegularElement = ( { child, eventHandlers, childrenWithPopover } ) =>\n\tcloneElement( child, {\n\t\t...eventHandlers,\n\t\tchildren: childrenWithPopover,\n\t} );\n\nconst addPopoverToGrandchildren = ( {\n\tgrandchildren,\n\tisOver,\n\tposition,\n\ttext,\n\tshortcut,\n} ) =>\n\tconcatChildren(\n\t\tgrandchildren,\n\t\tisOver && (\n\t\t\t<Popover\n\t\t\t\tfocusOnMount={ false }\n\t\t\t\tposition={ position }\n\t\t\t\tclassName=\"components-tooltip\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tanimate={ false }\n\t\t\t\toffset={ 12 }\n\t\t\t\t__unstableShift\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-tooltip__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t)\n\t);\n\nconst emitToChild = ( children, eventName, event ) => {\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn;\n\t}\n\n\tconst child = Children.only( children );\n\n\t// If the underlying element is disabled, do not emit the event.\n\tif ( child.props.disabled ) {\n\t\treturn;\n\t}\n\n\tif ( typeof child.props[ eventName ] === 'function' ) {\n\t\tchild.props[ eventName ]( event );\n\t}\n};\n\nfunction Tooltip( props ) {\n\tconst {\n\t\tchildren,\n\t\tposition = 'bottom middle',\n\t\ttext,\n\t\tshortcut,\n\t\tdelay = TOOLTIP_DELAY,\n\t} = props;\n\t/**\n\t * Whether a mouse is currently pressed, used in determining whether\n\t * to handle a focus event as displaying the tooltip immediately.\n\t *\n\t * @type {boolean}\n\t */\n\tconst [ isMouseDown, setIsMouseDown ] = useState( false );\n\tconst [ isOver, setIsOver ] = useState( false );\n\tconst delayedSetIsOver = useDebounce( setIsOver, delay );\n\n\tconst createMouseDown = ( event ) => {\n\t\t// Preserve original child callback behavior.\n\t\temitToChild( children, 'onMouseDown', event );\n\n\t\t// On mouse down, the next `mouseup` should revert the value of the\n\t\t// instance property and remove its own event handler. The bind is\n\t\t// made on the document since the `mouseup` might not occur within\n\t\t// the bounds of the element.\n\t\tdocument.addEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( true );\n\t};\n\n\tconst createMouseUp = ( event ) => {\n\t\temitToChild( children, 'onMouseUp', event );\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( false );\n\t};\n\n\tconst createMouseEvent = ( type ) => {\n\t\tif ( type === 'mouseUp' ) return createMouseUp;\n\t\tif ( type === 'mouseDown' ) return createMouseDown;\n\t};\n\n\t/**\n\t * Prebound `isInMouseDown` handler, created as a constant reference to\n\t * assure ability to remove in component unmount.\n\t *\n\t * @type {Function}\n\t */\n\tconst cancelIsMouseDown = createMouseEvent( 'mouseUp' );\n\n\tconst createToggleIsOver = ( eventName, isDelayed ) => {\n\t\treturn ( event ) => {\n\t\t\t// Preserve original child callback behavior.\n\t\t\temitToChild( children, eventName, event );\n\n\t\t\t// Mouse events behave unreliably in React for disabled elements,\n\t\t\t// firing on mouseenter but not mouseleave. Further, the default\n\t\t\t// behavior for disabled elements in some browsers is to ignore\n\t\t\t// mouse events. Don't bother trying to to handle them.\n\t\t\t//\n\t\t\t// See: https://github.com/facebook/react/issues/4251\n\t\t\tif ( event.currentTarget.disabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// A focus event will occur as a result of a mouse click, but it\n\t\t\t// should be disambiguated between interacting with the button and\n\t\t\t// using an explicit focus shift as a cue to display the tooltip.\n\t\t\tif ( 'focus' === event.type && isMouseDown ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Needed in case unsetting is over while delayed set pending, i.e.\n\t\t\t// quickly blur/mouseleave before delayedSetIsOver is called.\n\t\t\tdelayedSetIsOver.cancel();\n\n\t\t\tconst _isOver = includes( [ 'focus', 'mouseenter' ], event.type );\n\t\t\tif ( _isOver === isOver ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isDelayed ) {\n\t\t\t\tdelayedSetIsOver( _isOver );\n\t\t\t} else {\n\t\t\t\tsetIsOver( _isOver );\n\t\t\t}\n\t\t};\n\t};\n\tconst clearOnUnmount = () => {\n\t\tdelayedSetIsOver.cancel();\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t};\n\n\tuseEffect( () => clearOnUnmount, [] );\n\n\tif ( Children.count( children ) !== 1 ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\n\t\treturn children;\n\t}\n\n\tconst eventHandlers = {\n\t\tonMouseEnter: createToggleIsOver( 'onMouseEnter', true ),\n\t\tonMouseLeave: createToggleIsOver( 'onMouseLeave' ),\n\t\tonClick: createToggleIsOver( 'onClick' ),\n\t\tonFocus: createToggleIsOver( 'onFocus' ),\n\t\tonBlur: createToggleIsOver( 'onBlur' ),\n\t\tonMouseDown: createMouseEvent( 'mouseDown' ),\n\t};\n\n\tconst child = Children.only( children );\n\tconst { children: grandchildren, disabled } = child.props;\n\tconst getElementWithPopover = disabled\n\t\t? getDisabledElement\n\t\t: getRegularElement;\n\n\tconst popoverData = {\n\t\tisOver,\n\t\tposition,\n\t\ttext,\n\t\tshortcut,\n\t};\n\tconst childrenWithPopover = addPopoverToGrandchildren( {\n\t\tgrandchildren,\n\t\t...popoverData,\n\t} );\n\n\treturn getElementWithPopover( {\n\t\tchild,\n\t\teventHandlers,\n\t\tchildrenWithPopover,\n\t} );\n}\n\nexport default Tooltip;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tooltip/index.js"],"names":["includes","Children","cloneElement","concatChildren","useEffect","useState","useRef","useDebounce","useMergeRefs","Popover","Shortcut","TOOLTIP_DELAY","eventCatcher","getDisabledElement","eventHandlers","child","childrenWithPopover","mergedRefs","children","ref","getRegularElement","addPopoverToGrandchildren","anchorRef","grandchildren","isOver","offset","position","shortcut","text","emitToChild","eventName","event","count","only","props","disabled","Tooltip","delay","isMouseDown","setIsMouseDown","setIsOver","delayedSetIsOver","childRef","existingChildRef","toArray","mergedChildRefs","createMouseDown","target","tagName","document","addEventListener","cancelIsMouseDown","createMouseUp","removeEventListener","createMouseEvent","type","createToggleIsOver","isDelayed","currentTarget","cancel","_isOver","clearOnUnmount","process","env","NODE_ENV","console","error","onMouseEnter","onMouseLeave","onClick","onFocus","onBlur","onMouseDown","getElementWithPopover","popoverData"],"mappings":";AAAA;;AACA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,cAHD,EAICC,SAJD,EAKCC,QALD,EAMCC,MAND,QAOO,oBAPP;AAQA,SAASC,WAAT,EAAsBC,YAAtB,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,QAAP,MAAqB,aAArB;AAEA;AACA;AACA;AAC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AF,CAFX;AAGrBa,IAAAA,OAAO,EAAEb,kBAAkB,CAAE,SAAF,CAHN;AAIrBc,IAAAA,OAAO,EAAEd,kBAAkB,CAAE,SAAF,CAJN;AAKrBe,IAAAA,MAAM,EAAEf,kBAAkB,CAAE,QAAF,CALL;AAMrBgB,IAAAA,WAAW,EAAElB,gBAAgB,CAAE,WAAF;AANR,GAAtB;AASA,QAAMvC,KAAK,GAAGd,QAAQ,CAACgC,IAAT,CAAef,QAAf,CAAd;AACA,QAAM;AAAEA,IAAAA,QAAQ,EAAEK,aAAZ;AAA2BY,IAAAA;AAA3B,MAAwCpB,KAAK,CAACmB,KAApD;AACA,QAAMuC,qBAAqB,GAAGtC,QAAQ,GACnCtB,kBADmC,GAEnCO,iBAFH;AAIA,QAAMsD,WAAW,GAAG;AACnBpD,IAAAA,SAAS,EAAEoB,QADQ;AAEnBlB,IAAAA,MAFmB;AAGnBC,IAAAA,MAAM,EAAE,CAHW;AAInBC,IAAAA,QAJmB;AAKnBC,IAAAA,QALmB;AAMnBC,IAAAA;AANmB,GAApB;AAQA,QAAMZ,mBAAmB,GAAGK,yBAAyB,CAAE;AACtDE,IAAAA,aADsD;AAEtD,OAAGmD;AAFmD,GAAF,CAArD;AAKA,SAAOD,qBAAqB,CAAE;AAC7B1D,IAAAA,KAD6B;AAE7BD,IAAAA,aAF6B;AAG7BE,IAAAA,mBAH6B;AAI7BC,IAAAA,UAAU,EAAE4B;AAJiB,GAAF,CAA5B;AAMA;;AAED,eAAeT,OAAf","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tChildren,\n\tcloneElement,\n\tconcatChildren,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n} from '@wordpress/element';\nimport { useDebounce, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Popover from '../popover';\nimport Shortcut from '../shortcut';\n\n/**\n * Time over children to wait before showing tooltip\n *\n * @type {number}\n */\nexport const TOOLTIP_DELAY = 700;\n\nconst eventCatcher = <div className=\"event-catcher\" />;\n\nconst getDisabledElement = ( {\n\teventHandlers,\n\tchild,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement(\n\t\t<span className=\"disabled-element-wrapper\">\n\t\t\t{ cloneElement( eventCatcher, eventHandlers ) }\n\t\t\t{ cloneElement( child, {\n\t\t\t\tchildren: childrenWithPopover,\n\t\t\t\tref: mergedRefs,\n\t\t\t} ) }\n\t\t</span>,\n\t\t{ ...eventHandlers }\n\t);\n};\n\nconst getRegularElement = ( {\n\tchild,\n\teventHandlers,\n\tchildrenWithPopover,\n\tmergedRefs,\n} ) => {\n\treturn cloneElement( child, {\n\t\t...eventHandlers,\n\t\tchildren: childrenWithPopover,\n\t\tref: mergedRefs,\n\t} );\n};\n\nconst addPopoverToGrandchildren = ( {\n\tanchorRef,\n\tgrandchildren,\n\tisOver,\n\toffset,\n\tposition,\n\tshortcut,\n\ttext,\n} ) =>\n\tconcatChildren(\n\t\tgrandchildren,\n\t\tisOver && (\n\t\t\t<Popover\n\t\t\t\tfocusOnMount={ false }\n\t\t\t\tposition={ position }\n\t\t\t\tclassName=\"components-tooltip\"\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tanimate={ false }\n\t\t\t\toffset={ offset }\n\t\t\t\tanchorRef={ anchorRef }\n\t\t\t\t__unstableShift\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t\t<Shortcut\n\t\t\t\t\tclassName=\"components-tooltip__shortcut\"\n\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t/>\n\t\t\t</Popover>\n\t\t)\n\t);\n\nconst emitToChild = ( children, eventName, event ) => {\n\tif ( Children.count( children ) !== 1 ) {\n\t\treturn;\n\t}\n\n\tconst child = Children.only( children );\n\n\t// If the underlying element is disabled, do not emit the event.\n\tif ( child.props.disabled ) {\n\t\treturn;\n\t}\n\n\tif ( typeof child.props[ eventName ] === 'function' ) {\n\t\tchild.props[ eventName ]( event );\n\t}\n};\n\nfunction Tooltip( props ) {\n\tconst {\n\t\tchildren,\n\t\tposition = 'bottom middle',\n\t\ttext,\n\t\tshortcut,\n\t\tdelay = TOOLTIP_DELAY,\n\t} = props;\n\t/**\n\t * Whether a mouse is currently pressed, used in determining whether\n\t * to handle a focus event as displaying the tooltip immediately.\n\t *\n\t * @type {boolean}\n\t */\n\tconst [ isMouseDown, setIsMouseDown ] = useState( false );\n\tconst [ isOver, setIsOver ] = useState( false );\n\tconst delayedSetIsOver = useDebounce( setIsOver, delay );\n\n\t// Create a reference to the Tooltip's child, to be passed to the Popover\n\t// so that the Tooltip can be correctly positioned. Also, merge with the\n\t// existing ref for the first child, so that its ref is preserved.\n\tconst childRef = useRef( null );\n\tconst existingChildRef = Children.toArray( children )[ 0 ]?.ref;\n\tconst mergedChildRefs = useMergeRefs( [ childRef, existingChildRef ] );\n\n\tconst createMouseDown = ( event ) => {\n\t\t// In firefox, the mouse down event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Preserve original child callback behavior.\n\t\temitToChild( children, 'onMouseDown', event );\n\n\t\t// On mouse down, the next `mouseup` should revert the value of the\n\t\t// instance property and remove its own event handler. The bind is\n\t\t// made on the document since the `mouseup` might not occur within\n\t\t// the bounds of the element.\n\t\tdocument.addEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( true );\n\t};\n\n\tconst createMouseUp = ( event ) => {\n\t\t// In firefox, the mouse up event is also fired when the select\n\t\t// list is chosen.\n\t\t// Cancel further processing because re-rendering of child components\n\t\t// causes onChange to be triggered with the old value.\n\t\t// See https://github.com/WordPress/gutenberg/pull/42483\n\t\tif ( event.target.tagName === 'OPTION' ) {\n\t\t\treturn;\n\t\t}\n\n\t\temitToChild( children, 'onMouseUp', event );\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t\tsetIsMouseDown( false );\n\t};\n\n\tconst createMouseEvent = ( type ) => {\n\t\tif ( type === 'mouseUp' ) return createMouseUp;\n\t\tif ( type === 'mouseDown' ) return createMouseDown;\n\t};\n\n\t/**\n\t * Prebound `isInMouseDown` handler, created as a constant reference to\n\t * assure ability to remove in component unmount.\n\t *\n\t * @type {Function}\n\t */\n\tconst cancelIsMouseDown = createMouseEvent( 'mouseUp' );\n\n\tconst createToggleIsOver = ( eventName, isDelayed ) => {\n\t\treturn ( event ) => {\n\t\t\t// Preserve original child callback behavior.\n\t\t\temitToChild( children, eventName, event );\n\n\t\t\t// Mouse events behave unreliably in React for disabled elements,\n\t\t\t// firing on mouseenter but not mouseleave. Further, the default\n\t\t\t// behavior for disabled elements in some browsers is to ignore\n\t\t\t// mouse events. Don't bother trying to handle them.\n\t\t\t//\n\t\t\t// See: https://github.com/facebook/react/issues/4251\n\t\t\tif ( event.currentTarget.disabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// A focus event will occur as a result of a mouse click, but it\n\t\t\t// should be disambiguated between interacting with the button and\n\t\t\t// using an explicit focus shift as a cue to display the tooltip.\n\t\t\tif ( 'focus' === event.type && isMouseDown ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Needed in case unsetting is over while delayed set pending, i.e.\n\t\t\t// quickly blur/mouseleave before delayedSetIsOver is called.\n\t\t\tdelayedSetIsOver.cancel();\n\n\t\t\tconst _isOver = includes( [ 'focus', 'mouseenter' ], event.type );\n\t\t\tif ( _isOver === isOver ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isDelayed ) {\n\t\t\t\tdelayedSetIsOver( _isOver );\n\t\t\t} else {\n\t\t\t\tsetIsOver( _isOver );\n\t\t\t}\n\t\t};\n\t};\n\tconst clearOnUnmount = () => {\n\t\tdelayedSetIsOver.cancel();\n\t\tdocument.removeEventListener( 'mouseup', cancelIsMouseDown );\n\t};\n\n\tuseEffect( () => clearOnUnmount, [] );\n\n\tif ( Children.count( children ) !== 1 ) {\n\t\tif ( 'development' === process.env.NODE_ENV ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'Tooltip should be called with only a single child element.'\n\t\t\t);\n\t\t}\n\n\t\treturn children;\n\t}\n\n\tconst eventHandlers = {\n\t\tonMouseEnter: createToggleIsOver( 'onMouseEnter', true ),\n\t\tonMouseLeave: createToggleIsOver( 'onMouseLeave' ),\n\t\tonClick: createToggleIsOver( 'onClick' ),\n\t\tonFocus: createToggleIsOver( 'onFocus' ),\n\t\tonBlur: createToggleIsOver( 'onBlur' ),\n\t\tonMouseDown: createMouseEvent( 'mouseDown' ),\n\t};\n\n\tconst child = Children.only( children );\n\tconst { children: grandchildren, disabled } = child.props;\n\tconst getElementWithPopover = disabled\n\t\t? getDisabledElement\n\t\t: getRegularElement;\n\n\tconst popoverData = {\n\t\tanchorRef: childRef,\n\t\tisOver,\n\t\toffset: 4,\n\t\tposition,\n\t\tshortcut,\n\t\ttext,\n\t};\n\tconst childrenWithPopover = addPopoverToGrandchildren( {\n\t\tgrandchildren,\n\t\t...popoverData,\n\t} );\n\n\treturn getElementWithPopover( {\n\t\tchild,\n\t\teventHandlers,\n\t\tchildrenWithPopover,\n\t\tmergedRefs: mergedChildRefs,\n\t} );\n}\n\nexport default Tooltip;\n"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  /**
5
5
  * External dependencies
6
6
  */
7
- import { unescape as unescapeString, repeat, flatMap, compact } from 'lodash';
7
+ import { unescape as unescapeString } from 'lodash';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
@@ -18,9 +18,9 @@ import { SelectControl } from '../select-control';
18
18
 
19
19
  function getSelectOptions(tree) {
20
20
  let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
21
- return flatMap(tree, treeNode => [{
21
+ return tree.flatMap(treeNode => [{
22
22
  value: treeNode.id,
23
- label: repeat('\u00A0', level * 3) + unescapeString(treeNode.name)
23
+ label: '\u00A0'.repeat(level * 3) + unescapeString(treeNode.name)
24
24
  }, ...getSelectOptions(treeNode.children || [], level + 1)]);
25
25
  }
26
26
  /**
@@ -83,10 +83,10 @@ export function TreeSelect(_ref) {
83
83
  ...props
84
84
  } = _ref;
85
85
  const options = useMemo(() => {
86
- return compact([noOptionLabel && {
86
+ return [noOptionLabel && {
87
87
  value: '',
88
88
  label: noOptionLabel
89
- }, ...getSelectOptions(tree)]);
89
+ }, ...getSelectOptions(tree)].filter(option => !!option);
90
90
  }, [noOptionLabel, tree]);
91
91
  return createElement(SelectControl, _extends({
92
92
  label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-select/index.tsx"],"names":["unescape","unescapeString","repeat","flatMap","compact","useMemo","SelectControl","getSelectOptions","tree","level","treeNode","value","id","label","name","children","TreeSelect","noOptionLabel","onChange","selectedId","props","options"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,cAArB,EAAqCC,MAArC,EAA6CC,OAA7C,EAAsDC,OAAtD,QAAqE,QAArE;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;;AAGA,SAASC,gBAAT,CAA2BC,IAA3B,EAAoE;AAAA,MAA3BC,KAA2B,uEAAnB,CAAmB;AACnE,SAAON,OAAO,CAAEK,IAAF,EAAUE,QAAF,IAAgB,CACrC;AACCC,IAAAA,KAAK,EAAED,QAAQ,CAACE,EADjB;AAECC,IAAAA,KAAK,EACJX,MAAM,CAAE,QAAF,EAAYO,KAAK,GAAG,CAApB,CAAN,GAAgCR,cAAc,CAAES,QAAQ,CAACI,IAAX;AAHhD,GADqC,EAMrC,GAAGP,gBAAgB,CAAEG,QAAQ,CAACK,QAAT,IAAqB,EAAvB,EAA2BN,KAAK,GAAG,CAAnC,CANkB,CAAxB,CAAd;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASO,UAAT,OAOc;AAAA,MAPO;AAC3BH,IAAAA,KAD2B;AAE3BI,IAAAA,aAF2B;AAG3BC,IAAAA,QAH2B;AAI3BC,IAAAA,UAJ2B;AAK3BX,IAAAA,IAAI,GAAG,EALoB;AAM3B,OAAGY;AANwB,GAOP;AACpB,QAAMC,OAAO,GAAGhB,OAAO,CAAE,MAAM;AAC9B,WAAOD,OAAO,CAAE,CACfa,aAAa,IAAI;AAAEN,MAAAA,KAAK,EAAE,EAAT;AAAaE,MAAAA,KAAK,EAAEI;AAApB,KADF,EAEf,GAAGV,gBAAgB,CAAEC,IAAF,CAFJ,CAAF,CAAd;AAIA,GALsB,EAKpB,CAAES,aAAF,EAAiBT,IAAjB,CALoB,CAAvB;AAOA,SACC,cAAC,aAAD;AACQK,IAAAA,KADR;AACeQ,IAAAA,OADf;AACwBH,IAAAA,QADxB;AAEC,IAAA,KAAK,EAAGC;AAFT,KAGMC,KAHN,EADD;AAOA;AAED,eAAeJ,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { unescape as unescapeString, repeat, flatMap, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { SelectControl } from '../select-control';\nimport type { TreeSelectProps, Tree, SelectOptions } from './types';\n\nfunction getSelectOptions( tree: Tree[], level = 0 ): SelectOptions {\n\treturn flatMap( tree, ( treeNode ) => [\n\t\t{\n\t\t\tvalue: treeNode.id,\n\t\t\tlabel:\n\t\t\t\trepeat( '\\u00A0', level * 3 ) + unescapeString( treeNode.name ),\n\t\t},\n\t\t...getSelectOptions( treeNode.children || [], level + 1 ),\n\t] );\n}\n\n/**\n * TreeSelect component is used to generate select input fields.\n *\n * @example\n * ```jsx\n * import { TreeSelect } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTreeSelect = () => {\n * \tconst [ page, setPage ] = useState( 'p21' );\n *\n * \treturn (\n * \t\t<TreeSelect\n * \t\t\tlabel=\"Parent page\"\n * \t\t\tnoOptionLabel=\"No parent page\"\n * \t\t\tonChange={ ( newPage ) => setPage( newPage ) }\n * \t\t\tselectedId={ page }\n * \t\t\ttree={ [\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 1',\n * \t\t\t\t\tid: 'p1',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{ name: 'Descend 1 of page 1', id: 'p11' },\n * \t\t\t\t\t\t{ name: 'Descend 2 of page 1', id: 'p12' },\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 2',\n * \t\t\t\t\tid: 'p2',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{\n * \t\t\t\t\t\t\tname: 'Descend 1 of page 2',\n * \t\t\t\t\t\t\tid: 'p21',\n * \t\t\t\t\t\t\tchildren: [\n * \t\t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\t\tname: 'Descend 1 of Descend 1 of page 2',\n * \t\t\t\t\t\t\t\t\tid: 'p211',\n * \t\t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t],\n * \t\t\t\t\t\t},\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t] }\n * \t\t/>\n * \t);\n * }\n * ```\n */\nexport function TreeSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tonChange,\n\tselectedId,\n\ttree = [],\n\t...props\n}: TreeSelectProps ) {\n\tconst options = useMemo( () => {\n\t\treturn compact( [\n\t\t\tnoOptionLabel && { value: '', label: noOptionLabel },\n\t\t\t...getSelectOptions( tree ),\n\t\t] );\n\t}, [ noOptionLabel, tree ] );\n\n\treturn (\n\t\t<SelectControl\n\t\t\t{ ...{ label, options, onChange } }\n\t\t\tvalue={ selectedId }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default TreeSelect;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-select/index.tsx"],"names":["unescape","unescapeString","useMemo","SelectControl","getSelectOptions","tree","level","flatMap","treeNode","value","id","label","repeat","name","children","TreeSelect","noOptionLabel","onChange","selectedId","props","options","filter","option"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,cAArB,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;;AAGA,SAASC,gBAAT,CAA2BC,IAA3B,EAAoE;AAAA,MAA3BC,KAA2B,uEAAnB,CAAmB;AACnE,SAAOD,IAAI,CAACE,OAAL,CAAgBC,QAAF,IAAgB,CACpC;AACCC,IAAAA,KAAK,EAAED,QAAQ,CAACE,EADjB;AAECC,IAAAA,KAAK,EACJ,SAASC,MAAT,CAAiBN,KAAK,GAAG,CAAzB,IAA+BL,cAAc,CAAEO,QAAQ,CAACK,IAAX;AAH/C,GADoC,EAMpC,GAAGT,gBAAgB,CAAEI,QAAQ,CAACM,QAAT,IAAqB,EAAvB,EAA2BR,KAAK,GAAG,CAAnC,CANiB,CAA9B,CAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,OAAO,SAASS,UAAT,OAOc;AAAA,MAPO;AAC3BJ,IAAAA,KAD2B;AAE3BK,IAAAA,aAF2B;AAG3BC,IAAAA,QAH2B;AAI3BC,IAAAA,UAJ2B;AAK3Bb,IAAAA,IAAI,GAAG,EALoB;AAM3B,OAAGc;AANwB,GAOP;AACpB,QAAMC,OAAO,GAAGlB,OAAO,CAAE,MAAM;AAC9B,WAAO,CACNc,aAAa,IAAI;AAAEP,MAAAA,KAAK,EAAE,EAAT;AAAaE,MAAAA,KAAK,EAAEK;AAApB,KADX,EAEN,GAAGZ,gBAAgB,CAAEC,IAAF,CAFb,EAGLgB,MAHK,CAGWC,MAAR,IAA8C,CAAC,CAAEA,MAHpD,CAAP;AAIA,GALsB,EAKpB,CAAEN,aAAF,EAAiBX,IAAjB,CALoB,CAAvB;AAOA,SACC,cAAC,aAAD;AACQM,IAAAA,KADR;AACeS,IAAAA,OADf;AACwBH,IAAAA,QADxB;AAEC,IAAA,KAAK,EAAGC;AAFT,KAGMC,KAHN,EADD;AAOA;AAED,eAAeJ,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { unescape as unescapeString } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { SelectControl } from '../select-control';\nimport type { TreeSelectProps, Tree, SelectOptions, Truthy } from './types';\n\nfunction getSelectOptions( tree: Tree[], level = 0 ): SelectOptions {\n\treturn tree.flatMap( ( treeNode ) => [\n\t\t{\n\t\t\tvalue: treeNode.id,\n\t\t\tlabel:\n\t\t\t\t'\\u00A0'.repeat( level * 3 ) + unescapeString( treeNode.name ),\n\t\t},\n\t\t...getSelectOptions( treeNode.children || [], level + 1 ),\n\t] );\n}\n\n/**\n * TreeSelect component is used to generate select input fields.\n *\n * @example\n * ```jsx\n * import { TreeSelect } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTreeSelect = () => {\n * \tconst [ page, setPage ] = useState( 'p21' );\n *\n * \treturn (\n * \t\t<TreeSelect\n * \t\t\tlabel=\"Parent page\"\n * \t\t\tnoOptionLabel=\"No parent page\"\n * \t\t\tonChange={ ( newPage ) => setPage( newPage ) }\n * \t\t\tselectedId={ page }\n * \t\t\ttree={ [\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 1',\n * \t\t\t\t\tid: 'p1',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{ name: 'Descend 1 of page 1', id: 'p11' },\n * \t\t\t\t\t\t{ name: 'Descend 2 of page 1', id: 'p12' },\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t\t{\n * \t\t\t\t\tname: 'Page 2',\n * \t\t\t\t\tid: 'p2',\n * \t\t\t\t\tchildren: [\n * \t\t\t\t\t\t{\n * \t\t\t\t\t\t\tname: 'Descend 1 of page 2',\n * \t\t\t\t\t\t\tid: 'p21',\n * \t\t\t\t\t\t\tchildren: [\n * \t\t\t\t\t\t\t\t{\n * \t\t\t\t\t\t\t\t\tname: 'Descend 1 of Descend 1 of page 2',\n * \t\t\t\t\t\t\t\t\tid: 'p211',\n * \t\t\t\t\t\t\t\t},\n * \t\t\t\t\t\t\t],\n * \t\t\t\t\t\t},\n * \t\t\t\t\t],\n * \t\t\t\t},\n * \t\t\t] }\n * \t\t/>\n * \t);\n * }\n * ```\n */\n\nexport function TreeSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tonChange,\n\tselectedId,\n\ttree = [],\n\t...props\n}: TreeSelectProps ) {\n\tconst options = useMemo( () => {\n\t\treturn [\n\t\t\tnoOptionLabel && { value: '', label: noOptionLabel },\n\t\t\t...getSelectOptions( tree ),\n\t\t].filter( < T, >( option: T ): option is Truthy< T > => !! option );\n\t}, [ noOptionLabel, tree ] );\n\n\treturn (\n\t\t<SelectControl\n\t\t\t{ ...{ label, options, onChange } }\n\t\t\tvalue={ selectedId }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default TreeSelect;\n"]}
@@ -1,18 +1,18 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { createElement } from "@wordpress/element";
3
3
 
4
+ /**
5
+ * External dependencies
6
+ */
7
+
4
8
  /**
5
9
  * Internal dependencies
6
10
  */
7
11
  import { contextConnect } from '../ui/context';
8
12
  import { View } from '../view';
9
13
  import useTruncate from './hook';
10
- /**
11
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
12
- * @param {import('react').ForwardedRef<any>} forwardedRef
13
- */
14
14
 
15
- function Truncate(props, forwardedRef) {
15
+ function UnconnectedTruncate(props, forwardedRef) {
16
16
  const truncateProps = useTruncate(props);
17
17
  return createElement(View, _extends({
18
18
  as: "span"
@@ -26,7 +26,6 @@ function Truncate(props, forwardedRef) {
26
26
  * `Subheading` is used to render text content. However,`Truncate` is
27
27
  * available for custom implementations.
28
28
  *
29
- * @example
30
29
  * ```jsx
31
30
  * import { __experimentalTruncate as Truncate } from `@wordpress/components`;
32
31
  *
@@ -43,6 +42,6 @@ function Truncate(props, forwardedRef) {
43
42
  */
44
43
 
45
44
 
46
- const ConnectedTruncate = contextConnect(Truncate, 'Truncate');
47
- export default ConnectedTruncate;
45
+ export const Truncate = contextConnect(UnconnectedTruncate, 'Truncate');
46
+ export default Truncate;
48
47
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/component.js"],"names":["contextConnect","View","useTruncate","Truncate","props","forwardedRef","truncateProps","ConnectedTruncate"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,WAAP,MAAwB,QAAxB;AAEA;AACA;AACA;AACA;;AACA,SAASC,QAAT,CAAmBC,KAAnB,EAA0BC,YAA1B,EAAyC;AACxC,QAAMC,aAAa,GAAGJ,WAAW,CAAEE,KAAF,CAAjC;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,aAArB;AAAqC,IAAA,GAAG,EAAGD;AAA3C,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,iBAAiB,GAAGP,cAAc,CAAEG,QAAF,EAAY,UAAZ,CAAxC;AAEA,eAAeI,iBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport useTruncate from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Truncate( props, forwardedRef ) {\n\tconst truncateProps = useTruncate( props );\n\n\treturn <View as=\"span\" { ...truncateProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Truncate` is a typography primitive that trims text content.\n * For almost all cases, it is recommended that `Text`, `Heading`, or\n * `Subheading` is used to render text content. However,`Truncate` is\n * available for custom implementations.\n *\n * @example\n * ```jsx\n * import { __experimentalTruncate as Truncate } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Truncate>\n * \t\t\tLorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex\n * \t\t\tneque, vulputate a diam et, luctus convallis lacus. Vestibulum ac\n * \t\t\tmollis mi. Morbi id elementum massa.\n * \t\t</Truncate>\n * \t);\n * }\n * ```\n */\nconst ConnectedTruncate = contextConnect( Truncate, 'Truncate' );\n\nexport default ConnectedTruncate;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/component.tsx"],"names":["contextConnect","View","useTruncate","UnconnectedTruncate","props","forwardedRef","truncateProps","Truncate"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAAwD,eAAxD;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,WAAP,MAAwB,QAAxB;;AAGA,SAASC,mBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,aAAa,GAAGJ,WAAW,CAAEE,KAAF,CAAjC;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,aAArB;AAAqC,IAAA,GAAG,EAAGD;AAA3C,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAME,QAAQ,GAAGP,cAAc,CAAEG,mBAAF,EAAuB,UAAvB,CAA/B;AAEP,eAAeI,QAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../ui/context';\nimport { View } from '../view';\nimport useTruncate from './hook';\nimport type { TruncateProps } from './types';\n\nfunction UnconnectedTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst truncateProps = useTruncate( props );\n\n\treturn <View as=\"span\" { ...truncateProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Truncate` is a typography primitive that trims text content.\n * For almost all cases, it is recommended that `Text`, `Heading`, or\n * `Subheading` is used to render text content. However,`Truncate` is\n * available for custom implementations.\n *\n * ```jsx\n * import { __experimentalTruncate as Truncate } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Truncate>\n * \t\t\tLorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex\n * \t\t\tneque, vulputate a diam et, luctus convallis lacus. Vestibulum ac\n * \t\t\tmollis mi. Morbi id elementum massa.\n * \t\t</Truncate>\n * \t);\n * }\n * ```\n */\nexport const Truncate = contextConnect( UnconnectedTruncate, 'Truncate' );\n\nexport default Truncate;\n"]}
@@ -15,10 +15,6 @@ import { useContextSystem } from '../ui/context';
15
15
  import * as styles from './styles';
16
16
  import { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';
17
17
  import { useCx } from '../utils/hooks/use-cx';
18
- /**
19
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
20
- */
21
-
22
18
  export default function useTruncate(props) {
23
19
  const {
24
20
  className,
@@ -30,9 +26,7 @@ export default function useTruncate(props) {
30
26
  ...otherProps
31
27
  } = useContextSystem(props, 'Truncate');
32
28
  const cx = useCx();
33
- const truncatedContent = truncateContent(typeof children === 'string' ?
34
- /** @type {string} */
35
- children : '', {
29
+ const truncatedContent = truncateContent(typeof children === 'string' ? children : '', {
36
30
  ellipsis,
37
31
  ellipsizeMode,
38
32
  limit,
@@ -40,9 +34,8 @@ export default function useTruncate(props) {
40
34
  });
41
35
  const shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;
42
36
  const classes = useMemo(() => {
43
- const sx = {};
44
- sx.numberOfLines = /*#__PURE__*/css("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:sx-numberOfLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpRHdCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5p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aW1pdCxcblx0XHRcdG51bWJlck9mTGluZXMsXG5cdFx0fVxuXHQpO1xuXG5cdGNvbnN0IHNob3VsZFRydW5jYXRlID0gZWxsaXBzaXplTW9kZSA9PT0gVFJVTkNBVEVfVFlQRS5hdXRvO1xuXG5cdGNvbnN0IGNsYXNzZXMgPSB1c2VNZW1vKCAoKSA9PiB7XG5cdFx0Y29uc3Qgc3ggPSB7fTtcblxuXHRcdHN4Lm51bWJlck9mTGluZXMgPSBjc3NgXG5cdFx0XHQtd2Via2l0LWJveC1vcmllbnQ6IHZlcnRpY2FsO1xuXHRcdFx0LXdlYmtpdC1saW5lLWNsYW1wOiAkeyBudW1iZXJPZkxpbmVzIH07XG5cdFx0XHRkaXNwbGF5OiAtd2Via2l0LWJveDtcblx0XHRcdG92ZXJmbG93OiBoaWRkZW47XG5cdFx0YDtcblxuXHRcdHJldHVybiBjeChcblx0XHRcdHNob3VsZFRydW5jYXRlICYmICEgbnVtYmVyT2ZMaW5lcyAmJiBzdHlsZXMuVHJ1bmNhdGUsXG5cdFx0XHRzaG91bGRUcnVuY2F0ZSAmJiAhISBudW1iZXJPZkxpbmVzICYmIHN4Lm51bWJlck9mTGluZXMsXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbIGNsYXNzTmFtZSwgY3gsIG51bWJlck9mTGluZXMsIHNob3VsZFRydW5jYXRlIF0gKTtcblxuXHRyZXR1cm4geyAuLi5vdGhlclByb3BzLCBjbGFzc05hbWU6IGNsYXNzZXMsIGNoaWxkcmVuOiB0cnVuY2F0ZWRDb250ZW50IH07XG59XG4iXX0= */");
45
- return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && sx.numberOfLines, className);
37
+ const truncateLines = /*#__PURE__*/css("-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" ? "" : "/*# s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NhdGUgJiYgISEgbnVtYmVyT2ZMaW5lcyAmJiB0cnVuY2F0ZUxpbmVzLFxuXHRcdFx0Y2xhc3NOYW1lXG5cdFx0KTtcblx0fSwgWyBjbGFzc05hbWUsIGN4LCBudW1iZXJPZkxpbmVzLCBzaG91bGRUcnVuY2F0ZSBdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBjaGlsZHJlbjogdHJ1bmNhdGVkQ29udGVudCB9O1xufVxuIl19 */");
38
+ return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
46
39
  }, [className, cx, numberOfLines, shouldTruncate]);
47
40
  return { ...otherProps,
48
41
  className: classes,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/hook.js"],"names":["css","useMemo","useContextSystem","styles","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","truncateContent","useCx","useTruncate","props","className","children","ellipsis","ellipsizeMode","auto","limit","numberOfLines","otherProps","cx","truncatedContent","shouldTruncate","classes","sx","Truncate"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,eAAjC;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,iBAAT,EAA4BC,aAA5B,EAA2CC,eAA3C,QAAkE,SAAlE;AACA,SAASC,KAAT,QAAsB,uBAAtB;AAEA;AACA;AACA;;AACA,eAAe,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AAC5C,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,GAAGR,iBAHN;AAILS,IAAAA,aAAa,GAAGR,aAAa,CAACS,IAJzB;AAKLC,IAAAA,KAAK,GAAG,CALH;AAMLC,IAAAA,aAAa,GAAG,CANX;AAOL,OAAGC;AAPE,MAQFf,gBAAgB,CAAEO,KAAF,EAAS,UAAT,CARpB;AAUA,QAAMS,EAAE,GAAGX,KAAK,EAAhB;AAEA,QAAMY,gBAAgB,GAAGb,eAAe,CACvC,OAAOK,QAAP,KAAoB,QAApB;AAA+B;AAAwBA,EAAAA,QAAvD,GAAoE,EAD7B,EAEvC;AACCC,IAAAA,QADD;AAECC,IAAAA,aAFD;AAGCE,IAAAA,KAHD;AAICC,IAAAA;AAJD,GAFuC,CAAxC;AAUA,QAAMI,cAAc,GAAGP,aAAa,KAAKR,aAAa,CAACS,IAAvD;AAEA,QAAMO,OAAO,GAAGpB,OAAO,CAAE,MAAM;AAC9B,UAAMqB,EAAE,GAAG,EAAX;AAEAA,IAAAA,EAAE,CAACN,aAAH,gBAAmBhB,GAAnB,oDAEwBgB,aAFxB;AAOA,WAAOE,EAAE,CACRE,cAAc,IAAI,CAAEJ,aAApB,IAAqCb,MAAM,CAACoB,QADpC,EAERH,cAAc,IAAI,CAAC,CAAEJ,aAArB,IAAsCM,EAAE,CAACN,aAFjC,EAGRN,SAHQ,CAAT;AAKA,GAfsB,EAepB,CAAEA,SAAF,EAAaQ,EAAb,EAAiBF,aAAjB,EAAgCI,cAAhC,CAfoB,CAAvB;AAiBA,SAAO,EAAE,GAAGH,UAAL;AAAiBP,IAAAA,SAAS,EAAEW,OAA5B;AAAqCV,IAAAA,QAAQ,EAAEQ;AAA/C,GAAP;AACA","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 { useContextSystem } from '../ui/context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n */\nexport default function useTruncate( props ) {\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\tconst truncatedContent = truncateContent(\n\t\ttypeof children === 'string' ? /** @type {string} */ ( children ) : '',\n\t\t{\n\t\t\tellipsis,\n\t\t\tellipsizeMode,\n\t\t\tlimit,\n\t\t\tnumberOfLines,\n\t\t}\n\t);\n\n\tconst shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\tconst sx = {};\n\n\t\tsx.numberOfLines = css`\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 && sx.numberOfLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/hook.ts"],"names":["css","useMemo","useContextSystem","styles","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","truncateContent","useCx","useTruncate","props","className","children","ellipsis","ellipsizeMode","auto","limit","numberOfLines","otherProps","cx","truncatedContent","shouldTruncate","classes","truncateLines","Truncate"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAA0D,eAA1D;AACA,OAAO,KAAKC,MAAZ,MAAwB,UAAxB;AACA,SAASC,iBAAT,EAA4BC,aAA5B,EAA2CC,eAA3C,QAAkE,SAAlE;AACA,SAASC,KAAT,QAAsB,uBAAtB;AAGA,eAAe,SAASC,WAAT,CACdC,KADc,EAEb;AACD,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,QAAQ,GAAGR,iBAHN;AAILS,IAAAA,aAAa,GAAGR,aAAa,CAACS,IAJzB;AAKLC,IAAAA,KAAK,GAAG,CALH;AAMLC,IAAAA,aAAa,GAAG,CANX;AAOL,OAAGC;AAPE,MAQFf,gBAAgB,CAAEO,KAAF,EAAS,UAAT,CARpB;AAUA,QAAMS,EAAE,GAAGX,KAAK,EAAhB;AAEA,QAAMY,gBAAgB,GAAGb,eAAe,CACvC,OAAOK,QAAP,KAAoB,QAApB,GAA+BA,QAA/B,GAA0C,EADH,EAEvC;AACCC,IAAAA,QADD;AAECC,IAAAA,aAFD;AAGCE,IAAAA,KAHD;AAICC,IAAAA;AAJD,GAFuC,CAAxC;AAUA,QAAMI,cAAc,GAAGP,aAAa,KAAKR,aAAa,CAACS,IAAvD;AAEA,QAAMO,OAAO,GAAGpB,OAAO,CAAE,MAAM;AAC9B,UAAMqB,aAAa,gBAAGtB,GAAH,oDAEKgB,aAFL,2jFAAnB;AAOA,WAAOE,EAAE,CACRE,cAAc,IAAI,CAAEJ,aAApB,IAAqCb,MAAM,CAACoB,QADpC,EAERH,cAAc,IAAI,CAAC,CAAEJ,aAArB,IAAsCM,aAF9B,EAGRZ,SAHQ,CAAT;AAKA,GAbsB,EAapB,CAAEA,SAAF,EAAaQ,EAAb,EAAiBF,aAAjB,EAAgCI,cAAhC,CAboB,CAAvB;AAeA,SAAO,EAAE,GAAGH,UAAL;AAAiBP,IAAAA,SAAS,EAAEW,OAA5B;AAAqCV,IAAAA,QAAQ,EAAEQ;AAA/C,GAAP;AACA","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 { useContextSystem, WordPressComponentProps } from '../ui/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\tconst truncatedContent = truncateContent(\n\t\ttypeof children === 'string' ? children : '',\n\t\t{\n\t\t\tellipsis,\n\t\t\tellipsizeMode,\n\t\t\tlimit,\n\t\t\tnumberOfLines,\n\t\t}\n\t);\n\n\tconst shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\tconst truncateLines = css`\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/index.js"],"names":["default","Truncate","useTruncate"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAApB,QAAoC,aAApC;AACA,SAASD,OAAO,IAAIE,WAApB,QAAuC,QAAvC","sourcesContent":["export { default as Truncate } from './component';\nexport { default as useTruncate } from './hook';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/index.ts"],"names":["default","Truncate","useTruncate"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAApB,QAAoC,aAApC;AACA,SAASD,OAAO,IAAIE,WAApB,QAAuC,QAAvC","sourcesContent":["export { default as Truncate } from './component';\nexport { default as useTruncate } from './hook';\n"]}
@@ -10,7 +10,7 @@ export const Truncate = process.env.NODE_ENV === "production" ? {
10
10
  } : {
11
11
  name: "abxxyf-Truncate",
12
12
  styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;label:Truncate;",
13
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvc3R5bGVzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUsyQiIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3RydW5jYXRlL3N0eWxlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuZXhwb3J0IGNvbnN0IFRydW5jYXRlID0gY3NzYFxuXHRkaXNwbGF5OiBibG9jaztcblx0b3ZlcmZsb3c6IGhpZGRlbjtcblx0dGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7XG5cdHdoaXRlLXNwYWNlOiBub3dyYXA7XG5gO1xuIl19 */",
13
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUsyQiIsImZpbGUiOiJAd29yZHByZXNzL2NvbXBvbmVudHMvc3JjL3RydW5jYXRlL3N0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuZXhwb3J0IGNvbnN0IFRydW5jYXRlID0gY3NzYFxuXHRkaXNwbGF5OiBibG9jaztcblx0b3ZlcmZsb3c6IGhpZGRlbjtcblx0dGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7XG5cdHdoaXRlLXNwYWNlOiBub3dyYXA7XG5gO1xuIl19 */",
14
14
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
15
15
  };
16
16
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/styles.js"],"names":["css","Truncate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;AAEA,OAAO,MAAMC,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAd","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\nexport const Truncate = css`\n\tdisplay: block;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n`;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/styles.ts"],"names":["css","Truncate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;AAEA,OAAO,MAAMC,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAd","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\nexport const Truncate = css`\n\tdisplay: block;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n`;\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * External dependencies
2
+ * Internal dependencies
3
3
  */
4
- import { isNil } from 'lodash';
4
+ import { isValueDefined } from '../utils/values';
5
5
  export const TRUNCATE_ELLIPSIS = '…';
6
6
  export const TRUNCATE_TYPE = {
7
7
  auto: 'auto',
@@ -18,13 +18,6 @@ export const TRUNCATE_DEFAULT_PROPS = {
18
18
  }; // Source
19
19
  // https://github.com/kahwee/truncate-middle
20
20
 
21
- /**
22
- * @param {string} word
23
- * @param {number} headLength
24
- * @param {number} tailLength
25
- * @param {string} ellipsis
26
- */
27
-
28
21
  export function truncateMiddle(word, headLength, tailLength, ellipsis) {
29
22
  if (typeof word !== 'string') {
30
23
  return '';
@@ -39,7 +32,7 @@ export function truncateMiddle(word, headLength, tailLength, ellipsis) {
39
32
  const backLength = ~~tailLength;
40
33
  /* istanbul ignore next */
41
34
 
42
- const truncateStr = !isNil(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
35
+ const truncateStr = isValueDefined(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
43
36
 
44
37
  if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
45
38
  return word;
@@ -49,12 +42,6 @@ export function truncateMiddle(word, headLength, tailLength, ellipsis) {
49
42
 
50
43
  return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
51
44
  }
52
- /**
53
- *
54
- * @param {string} words
55
- * @param {typeof TRUNCATE_DEFAULT_PROPS} props
56
- */
57
-
58
45
  export function truncateContent() {
59
46
  let words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
60
47
  let props = arguments.length > 1 ? arguments[1] : undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/utils.js"],"names":["isNil","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","auto","head","middle","tail","none","TRUNCATE_DEFAULT_PROPS","ellipsis","ellipsizeMode","limit","numberOfLines","truncateMiddle","word","headLength","tailLength","wordLength","length","frontLength","backLength","truncateStr","slice","truncateContent","words","props","mergedProps","truncateHead","truncateTail","Math","floor","truncatedContent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAA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AACD,SACCP,IAAI,CAACQ,KAAL,CAAY,CAAZ,EAAeH,WAAf,IACAE,WADA,GAEAP,IAAI,CAACQ,KAAL,CAAYL,UAAU,GAAGG,UAAzB,CAHD;AAKA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,eAAT,GAA8C;AAAA,MAApBC,KAAoB,uEAAZ,EAAY;AAAA,MAARC,KAAQ;AACpD,QAAMC,WAAW,GAAG,EAAE,GAAGlB,sBAAL;AAA6B,OAAGiB;AAAhC,GAApB;AACA,QAAM;AAAEhB,IAAAA,QAAF;AAAYC,IAAAA,aAAZ;AAA2BC,IAAAA;AAA3B,MAAqCe,WAA3C;;AAEA,MAAKhB,aAAa,KAAKR,aAAa,CAACK,IAArC,EAA4C;AAC3C,WAAOiB,KAAP;AACA;;AAED,MAAIG,YAAJ;AACA,MAAIC,YAAJ;;AAEA,UAASlB,aAAT;AACC,SAAKR,aAAa,CAACE,IAAnB;AACCuB,MAAAA,YAAY,GAAG,CAAf;AACAC,MAAAA,YAAY,GAAGjB,KAAf;AACA;;AACD,SAAKT,aAAa,CAACG,MAAnB;AACCsB,MAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAYnB,KAAK,GAAG,CAApB,CAAf;AACAiB,MAAAA,YAAY,GAAGC,IAAI,CAACC,KAAL,CAAYnB,KAAK,GAAG,CAApB,CAAf;AACA;;AACD;AACCgB,MAAAA,YAAY,GAAGhB,KAAf;AACAiB,MAAAA,YAAY,GAAG,CAAf;AAXF;;AAcA,QAAMG,gBAAgB,GACrBrB,aAAa,KAAKR,aAAa,CAACC,IAAhC,GACGU,cAAc,CAAEW,KAAF,EAASG,YAAT,EAAuBC,YAAvB,EAAqCnB,QAArC,CADjB,GAEGe,KAHJ;AAKA,SAAOO,gBAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isNil } from 'lodash';\n\nexport const TRUNCATE_ELLIPSIS = '…';\nexport const TRUNCATE_TYPE = {\n\tauto: 'auto',\n\thead: 'head',\n\tmiddle: 'middle',\n\ttail: 'tail',\n\tnone: 'none',\n};\n\nexport const TRUNCATE_DEFAULT_PROPS = {\n\tellipsis: TRUNCATE_ELLIPSIS,\n\tellipsizeMode: TRUNCATE_TYPE.auto,\n\tlimit: 0,\n\tnumberOfLines: 0,\n};\n\n// Source\n// https://github.com/kahwee/truncate-middle\n/**\n * @param {string} word\n * @param {number} headLength\n * @param {number} tailLength\n * @param {string} ellipsis\n */\nexport function truncateMiddle( word, headLength, tailLength, ellipsis ) {\n\tif ( typeof word !== 'string' ) {\n\t\treturn '';\n\t}\n\tconst wordLength = word.length;\n\t// Setting default values\n\t// eslint-disable-next-line no-bitwise\n\tconst frontLength = ~~headLength; // Will cast to integer\n\t// eslint-disable-next-line no-bitwise\n\tconst backLength = ~~tailLength;\n\t/* istanbul ignore next */\n\tconst truncateStr = ! isNil( ellipsis ) ? ellipsis : TRUNCATE_ELLIPSIS;\n\n\tif (\n\t\t( frontLength === 0 && backLength === 0 ) ||\n\t\tfrontLength >= wordLength ||\n\t\tbackLength >= wordLength ||\n\t\tfrontLength + backLength >= wordLength\n\t) {\n\t\treturn word;\n\t} else if ( backLength === 0 ) {\n\t\treturn word.slice( 0, frontLength ) + truncateStr;\n\t}\n\treturn (\n\t\tword.slice( 0, frontLength ) +\n\t\ttruncateStr +\n\t\tword.slice( wordLength - backLength )\n\t);\n}\n\n/**\n *\n * @param {string} words\n * @param {typeof TRUNCATE_DEFAULT_PROPS} props\n */\nexport function truncateContent( words = '', props ) {\n\tconst mergedProps = { ...TRUNCATE_DEFAULT_PROPS, ...props };\n\tconst { ellipsis, ellipsizeMode, limit } = mergedProps;\n\n\tif ( ellipsizeMode === TRUNCATE_TYPE.none ) {\n\t\treturn words;\n\t}\n\n\tlet truncateHead;\n\tlet truncateTail;\n\n\tswitch ( ellipsizeMode ) {\n\t\tcase TRUNCATE_TYPE.head:\n\t\t\ttruncateHead = 0;\n\t\t\ttruncateTail = limit;\n\t\t\tbreak;\n\t\tcase TRUNCATE_TYPE.middle:\n\t\t\ttruncateHead = Math.floor( limit / 2 );\n\t\t\ttruncateTail = Math.floor( limit / 2 );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ttruncateHead = limit;\n\t\t\ttruncateTail = 0;\n\t}\n\n\tconst truncatedContent =\n\t\tellipsizeMode !== TRUNCATE_TYPE.auto\n\t\t\t? truncateMiddle( words, truncateHead, truncateTail, ellipsis )\n\t\t\t: words;\n\n\treturn truncatedContent;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/utils.ts"],"names":["isValueDefined","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","auto","head","middle","tail","none","TRUNCATE_DEFAULT_PROPS","ellipsis","ellipsizeMode","limit","numberOfLines","truncateMiddle","word","headLength","tailLength","wordLength","length","frontLength","backLength","truncateStr","slice","truncateContent","words","props","mergedProps","truncateHead","truncateTail","Math","floor","truncatedContent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,iBAA/B;AAGA,OAAO,MAAMC,iBAAiB,GAAG,GAA1B;AACP,OAAO,MAAMC,aAAa,GAAG;AAC5BC,EAAAA,IAAI,EAAE,MADsB;AAE5BC,EAAAA,IAAI,EAAE,MAFsB;AAG5BC,EAAAA,MAAM,EAAE,QAHoB;AAI5BC,EAAAA,IAAI,EAAE,MAJsB;AAK5BC,EAAAA,IAAI,EAAE;AALsB,CAAtB;AAQP,OAAO,MAAMC,sBAAsB,GAAG;AACrCC,EAAAA,QAAQ,EAAER,iBAD2B;AAErCS,EAAAA,aAAa,EAAER,aAAa,CAACC,IAFQ;AAGrCQ,EAAAA,KAAK,EAAE,CAH8B;AAIrCC,EAAAA,aAAa,EAAE;AAJsB,CAA/B,C,CAOP;AACA;;AACA,OAAO,SAASC,cAAT,CACNC,IADM,EAENC,UAFM,EAGNC,UAHM,EAINP,QAJM,EAKL;AACD,MAAK,OAAOK,IAAP,KAAgB,QAArB,EAAgC;AAC/B,WAAO,EAAP;AACA;;AACD,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AY,GAAGE,IAAI,CAACC,KAAL,CAAYnB,KAAK,GAAG,CAApB,CAAf;AACAiB,MAAAA,YAAY,GAAGC,IAAI,CAACC,KAAL,CAAYnB,KAAK,GAAG,CAApB,CAAf;AACA;;AACD;AACCgB,MAAAA,YAAY,GAAGhB,KAAf;AACAiB,MAAAA,YAAY,GAAG,CAAf;AAXF;;AAcA,QAAMG,gBAAgB,GACrBrB,aAAa,KAAKR,aAAa,CAACC,IAAhC,GACGU,cAAc,CAAEW,KAAF,EAASG,YAAT,EAAuBC,YAAvB,EAAqCnB,QAArC,CADjB,GAEGe,KAHJ;AAKA,SAAOO,gBAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { isValueDefined } from '../utils/values';\nimport type { TruncateProps } from './types';\n\nexport const TRUNCATE_ELLIPSIS = '…';\nexport const TRUNCATE_TYPE = {\n\tauto: 'auto',\n\thead: 'head',\n\tmiddle: 'middle',\n\ttail: 'tail',\n\tnone: 'none',\n} as const;\n\nexport const TRUNCATE_DEFAULT_PROPS = {\n\tellipsis: TRUNCATE_ELLIPSIS,\n\tellipsizeMode: TRUNCATE_TYPE.auto,\n\tlimit: 0,\n\tnumberOfLines: 0,\n};\n\n// Source\n// https://github.com/kahwee/truncate-middle\nexport function truncateMiddle(\n\tword: string,\n\theadLength: number,\n\ttailLength: number,\n\tellipsis: string\n) {\n\tif ( typeof word !== 'string' ) {\n\t\treturn '';\n\t}\n\tconst wordLength = word.length;\n\t// Setting default values\n\t// eslint-disable-next-line no-bitwise\n\tconst frontLength = ~~headLength; // Will cast to integer\n\t// eslint-disable-next-line no-bitwise\n\tconst backLength = ~~tailLength;\n\t/* istanbul ignore next */\n\tconst truncateStr = isValueDefined( ellipsis )\n\t\t? ellipsis\n\t\t: TRUNCATE_ELLIPSIS;\n\n\tif (\n\t\t( frontLength === 0 && backLength === 0 ) ||\n\t\tfrontLength >= wordLength ||\n\t\tbackLength >= wordLength ||\n\t\tfrontLength + backLength >= wordLength\n\t) {\n\t\treturn word;\n\t} else if ( backLength === 0 ) {\n\t\treturn word.slice( 0, frontLength ) + truncateStr;\n\t}\n\treturn (\n\t\tword.slice( 0, frontLength ) +\n\t\ttruncateStr +\n\t\tword.slice( wordLength - backLength )\n\t);\n}\n\nexport function truncateContent(\n\twords: string = '',\n\tprops: Omit< TruncateProps, 'children' >\n) {\n\tconst mergedProps = { ...TRUNCATE_DEFAULT_PROPS, ...props };\n\tconst { ellipsis, ellipsizeMode, limit } = mergedProps;\n\n\tif ( ellipsizeMode === TRUNCATE_TYPE.none ) {\n\t\treturn words;\n\t}\n\n\tlet truncateHead: number;\n\tlet truncateTail: number;\n\n\tswitch ( ellipsizeMode ) {\n\t\tcase TRUNCATE_TYPE.head:\n\t\t\ttruncateHead = 0;\n\t\t\ttruncateTail = limit;\n\t\t\tbreak;\n\t\tcase TRUNCATE_TYPE.middle:\n\t\t\ttruncateHead = Math.floor( limit / 2 );\n\t\t\ttruncateTail = Math.floor( limit / 2 );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ttruncateHead = limit;\n\t\t\ttruncateTail = 0;\n\t}\n\n\tconst truncatedContent =\n\t\tellipsizeMode !== TRUNCATE_TYPE.auto\n\t\t\t? truncateMiddle( words, truncateHead, truncateTail, ellipsis )\n\t\t\t: words;\n\n\treturn truncatedContent;\n}\n"]}
@@ -61,10 +61,15 @@ export function useContextSystem(props, namespace) {
61
61
  for (const key in overrideProps) {
62
62
  // @ts-ignore filling in missing props
63
63
  finalComponentProps[key] = overrideProps[key];
64
- } // @ts-ignore
64
+ } // Setting an `undefined` explicitly can cause unintended overwrites
65
+ // when a `cloneElement()` is involved.
65
66
 
66
67
 
67
- finalComponentProps.children = rendered;
68
+ if (rendered !== undefined) {
69
+ // @ts-ignore
70
+ finalComponentProps.children = rendered;
71
+ }
72
+
68
73
  finalComponentProps.className = classes;
69
74
  return finalComponentProps;
70
75
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/use-context-system.js"],"names":["warn","useComponentsContext","getNamespace","getConnectedNamespace","getStyledClassNameFromKey","useCx","useContextSystem","props","namespace","contextSystemProps","contextProps","finalComponentProps","_overrides","overrideProps","otherContextProps","initialMergedProps","Object","entries","length","assign","cx","classes","className","rendered","renderChildren","children","key"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,oBAAjB;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,2BAArC;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,SAApD;AACA,SAASC,yBAAT,QAA0C,kCAA1C;AACA,SAASC,KAAT,QAAsB,0BAAtB;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,KAA3B,EAAkCC,SAAlC,EAA8C;AACpD,QAAMC,kBAAkB,GAAGR,oBAAoB,EAA/C;;AACA,MAAK,OAAOO,SAAP,KAAqB,WAA1B,EAAwC;AACvC,6FAAAR,IAAI,CAAE,8CAAF,CAAJ;AACA;;AAED,QAAMU,YAAY,GAAG,CAAAD,kBAAkB,SAAlB,IAAAA,kBAAkB,WAAlB,YAAAA,kBAAkB,CAAID,SAAJ,CAAlB,KAAqC,EAA1D;AAEA;;AACA;AACA;;AACA,QAAMG,mBAAmB,GAAG,EAC3B,GAAGR,qBAAqB,EADG;AAE3B,OAAGD,YAAY,CAAEM,SAAF;AAFY,GAA5B;AAIA;;AAEA,QAAM;AAAEI,IAAAA,UAAU,EAAEC,aAAd;AAA6B,OAAGC;AAAhC,MAAsDJ,YAA5D;AAEA,QAAMK,kBAAkB,GAAGC,MAAM,CAACC,OAAP,CAAgBH,iBAAhB,EAAoCI,MAApC,GACxBF,MAAM,CAACG,MAAP,CAAe,EAAf,EAAmBL,iBAAnB,EAAsCP,KAAtC,CADwB,GAExBA,KAFH;AAIA,QAAMa,EAAE,GAAGf,KAAK,EAAhB;AAEA,QAAMgB,OAAO,GAAGD,EAAE,CACjBhB,yBAAyB,CAAEI,SAAF,CADR,EAEjBD,KAAK,CAACe,SAFW,CAAlB,CAzBoD,CA8BpD;;AACA,QAAMC,QAAQ,GACb,OAAOR,kBAAkB,CAACS,cAA1B,KAA6C,UAA7C,GACGT,kBAAkB,CAACS,cAAnB,CAAmCT,kBAAnC,CADH,GAEGA,kBAAkB,CAACU,QAHvB;;AAKA,OAAM,MAAMC,GAAZ,IAAmBX,kBAAnB,EAAwC;AACvC;AACAJ,IAAAA,mBAAmB,CAAEe,GAAF,CAAnB,GAA6BX,kBAAkB,CAAEW,GAAF,CAA/C;AACA;;AAED,OAAM,MAAMA,GAAZ,IAAmBb,aAAnB,EAAmC;AAClC;AACAF,IAAAA,mBAAmB,CAAEe,GAAF,CAAnB,GAA6Bb,aAAa,CAAEa,GAAF,CAA1C;AACA,GA5CmD,CA8CpD;;;AACAf,EAAAA,mBAAmB,CAACc,QAApB,GAA+BF,QAA/B;AACAZ,EAAAA,mBAAmB,CAACW,SAApB,GAAgCD,OAAhC;AAEA,SAAOV,mBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useComponentsContext } from './context-system-provider';\nimport { getNamespace, getConnectedNamespace } from './utils';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport { useCx } from '../../utils/hooks/use-cx';\n\n/**\n * @template TProps\n * @typedef {TProps & { className: string }} ConnectedProps\n */\n\n/**\n * Custom hook that derives registered props from the Context system.\n * These derived props are then consolidated with incoming component props.\n *\n * @template {{ className?: string }} P\n * @param {P} props Incoming props from the component.\n * @param {string} namespace The namespace to register and to derive context props from.\n * @return {ConnectedProps<P>} The connected props.\n */\nexport function useContextSystem( props, namespace ) {\n\tconst contextSystemProps = useComponentsContext();\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'useContextSystem: Please provide a namespace' );\n\t}\n\n\tconst contextProps = contextSystemProps?.[ namespace ] || {};\n\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {ConnectedProps<P>} */\n\t// @ts-ignore We fill in the missing properties below\n\tconst finalComponentProps = {\n\t\t...getConnectedNamespace(),\n\t\t...getNamespace( namespace ),\n\t};\n\t/* eslint-enable jsdoc/no-undefined-types */\n\n\tconst { _overrides: overrideProps, ...otherContextProps } = contextProps;\n\n\tconst initialMergedProps = Object.entries( otherContextProps ).length\n\t\t? Object.assign( {}, otherContextProps, props )\n\t\t: props;\n\n\tconst cx = useCx();\n\n\tconst classes = cx(\n\t\tgetStyledClassNameFromKey( namespace ),\n\t\tprops.className\n\t);\n\n\t// Provides the ability to customize the render of the component.\n\tconst rendered =\n\t\ttypeof initialMergedProps.renderChildren === 'function'\n\t\t\t? initialMergedProps.renderChildren( initialMergedProps )\n\t\t\t: initialMergedProps.children;\n\n\tfor ( const key in initialMergedProps ) {\n\t\t// @ts-ignore filling in missing props\n\t\tfinalComponentProps[ key ] = initialMergedProps[ key ];\n\t}\n\n\tfor ( const key in overrideProps ) {\n\t\t// @ts-ignore filling in missing props\n\t\tfinalComponentProps[ key ] = overrideProps[ key ];\n\t}\n\n\t// @ts-ignore\n\tfinalComponentProps.children = rendered;\n\tfinalComponentProps.className = classes;\n\n\treturn finalComponentProps;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/use-context-system.js"],"names":["warn","useComponentsContext","getNamespace","getConnectedNamespace","getStyledClassNameFromKey","useCx","useContextSystem","props","namespace","contextSystemProps","contextProps","finalComponentProps","_overrides","overrideProps","otherContextProps","initialMergedProps","Object","entries","length","assign","cx","classes","className","rendered","renderChildren","children","key","undefined"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,oBAAjB;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,2BAArC;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,SAApD;AACA,SAASC,yBAAT,QAA0C,kCAA1C;AACA,SAASC,KAAT,QAAsB,0BAAtB;AAEA;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Z,IAAmBb,aAAnB,EAAmC;AAClC;AACAF,IAAAA,mBAAmB,CAAEe,GAAF,CAAnB,GAA6Bb,aAAa,CAAEa,GAAF,CAA1C;AACA,GA5CmD,CA8CpD;AACA;;;AACA,MAAKH,QAAQ,KAAKI,SAAlB,EAA8B;AAC7B;AACAhB,IAAAA,mBAAmB,CAACc,QAApB,GAA+BF,QAA/B;AACA;;AAEDZ,EAAAA,mBAAmB,CAACW,SAApB,GAAgCD,OAAhC;AAEA,SAAOV,mBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useComponentsContext } from './context-system-provider';\nimport { getNamespace, getConnectedNamespace } from './utils';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport { useCx } from '../../utils/hooks/use-cx';\n\n/**\n * @template TProps\n * @typedef {TProps & { className: string }} ConnectedProps\n */\n\n/**\n * Custom hook that derives registered props from the Context system.\n * These derived props are then consolidated with incoming component props.\n *\n * @template {{ className?: string }} P\n * @param {P} props Incoming props from the component.\n * @param {string} namespace The namespace to register and to derive context props from.\n * @return {ConnectedProps<P>} The connected props.\n */\nexport function useContextSystem( props, namespace ) {\n\tconst contextSystemProps = useComponentsContext();\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'useContextSystem: Please provide a namespace' );\n\t}\n\n\tconst contextProps = contextSystemProps?.[ namespace ] || {};\n\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {ConnectedProps<P>} */\n\t// @ts-ignore We fill in the missing properties below\n\tconst finalComponentProps = {\n\t\t...getConnectedNamespace(),\n\t\t...getNamespace( namespace ),\n\t};\n\t/* eslint-enable jsdoc/no-undefined-types */\n\n\tconst { _overrides: overrideProps, ...otherContextProps } = contextProps;\n\n\tconst initialMergedProps = Object.entries( otherContextProps ).length\n\t\t? Object.assign( {}, otherContextProps, props )\n\t\t: props;\n\n\tconst cx = useCx();\n\n\tconst classes = cx(\n\t\tgetStyledClassNameFromKey( namespace ),\n\t\tprops.className\n\t);\n\n\t// Provides the ability to customize the render of the component.\n\tconst rendered =\n\t\ttypeof initialMergedProps.renderChildren === 'function'\n\t\t\t? initialMergedProps.renderChildren( initialMergedProps )\n\t\t\t: initialMergedProps.children;\n\n\tfor ( const key in initialMergedProps ) {\n\t\t// @ts-ignore filling in missing props\n\t\tfinalComponentProps[ key ] = initialMergedProps[ key ];\n\t}\n\n\tfor ( const key in overrideProps ) {\n\t\t// @ts-ignore filling in missing props\n\t\tfinalComponentProps[ key ] = overrideProps[ key ];\n\t}\n\n\t// Setting an `undefined` explicitly can cause unintended overwrites\n\t// when a `cloneElement()` is involved.\n\tif ( rendered !== undefined ) {\n\t\t// @ts-ignore\n\t\tfinalComponentProps.children = rendered;\n\t}\n\n\tfinalComponentProps.className = classes;\n\n\treturn finalComponentProps;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/utils/get-valid-children.ts"],"names":["Children","isValidElement","getValidChildren","children","toArray","filter","child"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,oBAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,QAA3B,EAAiE;AACvE,MAAK,OAAOA,QAAP,KAAoB,QAAzB,EAAoC,OAAO,CAAEA,QAAF,CAAP;AAEpC,SAAOH,QAAQ,CAACI,OAAT,CAAkBD,QAAlB,EAA6BE,MAA7B,CAAuCC,KAAF,IAC3CL,cAAc,CAAEK,KAAF,CADR,CAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactNodeArray } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren( children: ReactNode ): ReactNodeArray {\n\tif ( typeof children === 'string' ) return [ children ];\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/utils/get-valid-children.ts"],"names":["Children","isValidElement","getValidChildren","children","toArray","filter","child"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,oBAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CACNC,QADM,EAE8C;AACpD,MAAK,OAAOA,QAAP,KAAoB,QAAzB,EAAoC,OAAO,CAAEA,QAAF,CAAP;AAEpC,SAAOH,QAAQ,CAACI,OAAT,CAAkBD,QAAlB,EAA6BE,MAA7B,CAAuCC,KAAF,IAC3CL,cAAc,CAAEK,KAAF,CADR,CAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactChild, ReactFragment, ReactPortal } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren(\n\tchildren: ReactNode\n): Array< ReactChild | ReactFragment | ReactPortal > {\n\tif ( typeof children === 'string' ) return [ children ];\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"]}
@@ -1,5 +1,11 @@
1
1
  /**
2
- * A real number or something parsable as a number
2
+ * The argument value for the `space()` utility function.
3
+ *
4
+ * When this is a number or a numeric string, it will be interpreted as a
5
+ * multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.
6
+ *
7
+ * Otherwise, it will be interpreted as a literal CSS length value. For example,
8
+ * `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.
3
9
  */
4
10
  const GRID_BASE = '4px';
5
11
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/utils/space.ts"],"names":["GRID_BASE","space","value","undefined","asInt","Number","window","CSS","supports","toString","isNaN"],"mappings":"AAAA;AACA;AACA;AAGA,MAAMA,SAAS,GAAG,KAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAgBC,KAAhB,EAAyD;AAAA;;AAC/D,MAAK,OAAOA,KAAP,KAAiB,WAAtB,EAAoC;AACnC,WAAOC,SAAP;AACA,GAH8D,CAK/D;;;AACA,MAAK,CAAED,KAAP,EAAe;AACd,WAAO,GAAP;AACA;;AAED,QAAME,KAAK,GAAG,OAAOF,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCG,MAAM,CAAEH,KAAF,CAAxD,CAV+D,CAY/D;;AACA,MACG,OAAOI,MAAP,KAAkB,WAAlB,mBACDA,MAAM,CAACC,GADN,gEACD,YAAYC,QADX,iDACD,uCAAwB,QAAxB,EAAkCN,KAAK,CAACO,QAAN,EAAlC,CADD,IAEAJ,MAAM,CAACK,KAAP,CAAcN,KAAd,CAHD,EAIE;AACD,WAAOF,KAAK,CAACO,QAAN,EAAP;AACA;;AAED,SAAQ,QAAQT,SAAW,MAAME,KAAO,GAAxC;AACA","sourcesContent":["/**\n * A real number or something parsable as a number\n */\nexport type SpaceInput = number | string;\n\nconst GRID_BASE = '4px';\n\n/**\n * A function that handles numbers, numeric strings, and unit values.\n *\n * When given a number or a numeric string, it will return the grid-based\n * value as a factor of GRID_BASE, defined above.\n *\n * When given a unit value or one of the named CSS values like `auto`,\n * it will simply return the value back.\n *\n * @param value A number, numeric string, or a unit value.\n */\nexport function space( value?: SpaceInput ): string | undefined {\n\tif ( typeof value === 'undefined' ) {\n\t\treturn undefined;\n\t}\n\n\t// Handle empty strings, if it's the number 0 this still works.\n\tif ( ! value ) {\n\t\treturn '0';\n\t}\n\n\tconst asInt = typeof value === 'number' ? value : Number( value );\n\n\t// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.\n\tif (\n\t\t( typeof window !== 'undefined' &&\n\t\t\twindow.CSS?.supports?.( 'margin', value.toString() ) ) ||\n\t\tNumber.isNaN( asInt )\n\t) {\n\t\treturn value.toString();\n\t}\n\n\treturn `calc(${ GRID_BASE } * ${ value })`;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/utils/space.ts"],"names":["GRID_BASE","space","value","undefined","asInt","Number","window","CSS","supports","toString","isNaN"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAMA,SAAS,GAAG,KAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAgBC,KAAhB,EAAyD;AAAA;;AAC/D,MAAK,OAAOA,KAAP,KAAiB,WAAtB,EAAoC;AACnC,WAAOC,SAAP;AACA,GAH8D,CAK/D;;;AACA,MAAK,CAAED,KAAP,EAAe;AACd,WAAO,GAAP;AACA;;AAED,QAAME,KAAK,GAAG,OAAOF,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCG,MAAM,CAAEH,KAAF,CAAxD,CAV+D,CAY/D;;AACA,MACG,OAAOI,MAAP,KAAkB,WAAlB,mBACDA,MAAM,CAACC,GADN,gEACD,YAAYC,QADX,iDACD,uCAAwB,QAAxB,EAAkCN,KAAK,CAACO,QAAN,EAAlC,CADD,IAEAJ,MAAM,CAACK,KAAP,CAAcN,KAAd,CAHD,EAIE;AACD,WAAOF,KAAK,CAACO,QAAN,EAAP;AACA;;AAED,SAAQ,QAAQT,SAAW,MAAME,KAAO,GAAxC;AACA","sourcesContent":["/**\n * The argument value for the `space()` utility function.\n *\n * When this is a number or a numeric string, it will be interpreted as a\n * multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.\n *\n * Otherwise, it will be interpreted as a literal CSS length value. For example,\n * `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.\n */\nexport type SpaceInput = number | string;\n\nconst GRID_BASE = '4px';\n\n/**\n * A function that handles numbers, numeric strings, and unit values.\n *\n * When given a number or a numeric string, it will return the grid-based\n * value as a factor of GRID_BASE, defined above.\n *\n * When given a unit value or one of the named CSS values like `auto`,\n * it will simply return the value back.\n *\n * @param value A number, numeric string, or a unit value.\n */\nexport function space( value?: SpaceInput ): string | undefined {\n\tif ( typeof value === 'undefined' ) {\n\t\treturn undefined;\n\t}\n\n\t// Handle empty strings, if it's the number 0 this still works.\n\tif ( ! value ) {\n\t\treturn '0';\n\t}\n\n\tconst asInt = typeof value === 'number' ? value : Number( value );\n\n\t// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.\n\tif (\n\t\t( typeof window !== 'undefined' &&\n\t\t\twindow.CSS?.supports?.( 'margin', value.toString() ) ) ||\n\t\tNumber.isNaN( asInt )\n\t) {\n\t\treturn value.toString();\n\t}\n\n\treturn `calc(${ GRID_BASE } * ${ value })`;\n}\n"]}