@wordpress/components 19.11.0 → 19.14.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 (1322) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/CONTRIBUTING.md +94 -12
  3. package/README.md +1 -1
  4. package/build/alignment-matrix-control/index.js +8 -5
  5. package/build/alignment-matrix-control/index.js.map +1 -1
  6. package/build/alignment-matrix-control/utils.js +1 -7
  7. package/build/alignment-matrix-control/utils.js.map +1 -1
  8. package/build/angle-picker-control/index.js +2 -2
  9. package/build/angle-picker-control/index.js.map +1 -1
  10. package/build/autocomplete/autocompleter-ui.js +3 -1
  11. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  12. package/build/autocomplete/autocompleter-ui.native.js +8 -2
  13. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  14. package/build/autocomplete/index.js +14 -10
  15. package/build/autocomplete/index.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/hook.js +2 -2
  19. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  20. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  21. package/build/border-box-control/border-box-control-split-controls/component.js +4 -1
  22. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  23. package/build/border-box-control/border-box-control-split-controls/hook.js +13 -4
  24. package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  25. package/build/border-box-control/border-box-control-visualizer/hook.js +6 -2
  26. package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  27. package/build/border-box-control/styles.js +21 -11
  28. package/build/border-box-control/styles.js.map +1 -1
  29. package/build/border-box-control/utils.js.map +1 -1
  30. package/build/border-control/border-control/component.js +40 -4
  31. package/build/border-control/border-control/component.js.map +1 -1
  32. package/build/border-control/border-control/hook.js +2 -2
  33. package/build/border-control/border-control/hook.js.map +1 -1
  34. package/build/box-control/all-input-control.js +6 -10
  35. package/build/box-control/all-input-control.js.map +1 -1
  36. package/build/box-control/axial-input-controls.js.map +1 -1
  37. package/build/box-control/index.js +3 -7
  38. package/build/box-control/index.js.map +1 -1
  39. package/build/box-control/input-controls.js +6 -10
  40. package/build/box-control/input-controls.js.map +1 -1
  41. package/build/box-control/unit-control.js +4 -4
  42. package/build/box-control/unit-control.js.map +1 -1
  43. package/build/box-control/utils.js +3 -3
  44. package/build/box-control/utils.js.map +1 -1
  45. package/build/button/index.native.js +1 -3
  46. package/build/button/index.native.js.map +1 -1
  47. package/build/checkbox-control/index.js.map +1 -1
  48. package/build/color-indicator/index.js +27 -10
  49. package/build/color-indicator/index.js.map +1 -1
  50. package/build/color-indicator/types.js +6 -0
  51. package/build/color-indicator/types.js.map +1 -0
  52. package/build/color-palette/index.js +11 -3
  53. package/build/color-palette/index.js.map +1 -1
  54. package/build/color-palette/index.native.js +4 -1
  55. package/build/color-palette/index.native.js.map +1 -1
  56. package/build/color-picker/color-copy-button.js +87 -0
  57. package/build/color-picker/color-copy-button.js.map +1 -0
  58. package/build/color-picker/component.js +10 -23
  59. package/build/color-picker/component.js.map +1 -1
  60. package/build/color-picker/hex-input.js +18 -1
  61. package/build/color-picker/hex-input.js.map +1 -1
  62. package/build/color-picker/index.native.js.map +1 -1
  63. package/build/color-picker/input-with-slider.js +1 -2
  64. package/build/color-picker/input-with-slider.js.map +1 -1
  65. package/build/color-picker/styles.js +37 -19
  66. package/build/color-picker/styles.js.map +1 -1
  67. package/build/combobox-control/index.js +4 -2
  68. package/build/combobox-control/index.js.map +1 -1
  69. package/build/confirm-dialog/component.js.map +1 -1
  70. package/build/custom-gradient-bar/constants.js +1 -3
  71. package/build/custom-gradient-bar/constants.js.map +1 -1
  72. package/build/custom-gradient-bar/control-points.js +15 -8
  73. package/build/custom-gradient-bar/control-points.js.map +1 -1
  74. package/build/custom-gradient-bar/index.js +5 -5
  75. package/build/custom-gradient-bar/index.js.map +1 -1
  76. package/build/custom-gradient-bar/utils.js +5 -7
  77. package/build/custom-gradient-bar/utils.js.map +1 -1
  78. package/build/custom-gradient-picker/index.js +8 -8
  79. package/build/custom-gradient-picker/index.js.map +1 -1
  80. package/build/custom-gradient-picker/index.native.js +8 -9
  81. package/build/custom-gradient-picker/index.native.js.map +1 -1
  82. package/build/custom-gradient-picker/serializer.js +4 -7
  83. package/build/custom-gradient-picker/serializer.js.map +1 -1
  84. package/build/custom-gradient-picker/utils.js +1 -1
  85. package/build/custom-gradient-picker/utils.js.map +1 -1
  86. package/build/custom-select-control/index.js.map +1 -1
  87. package/build/date-time/{date.js → date/index.js} +57 -16
  88. package/build/date-time/date/index.js.map +1 -0
  89. package/build/date-time/date/styles.js +70 -0
  90. package/build/date-time/date/styles.js.map +1 -0
  91. package/build/date-time/{utils.js → date/utils.js} +0 -0
  92. package/build/date-time/date/utils.js.map +1 -0
  93. package/build/date-time/date-time/index.js +177 -0
  94. package/build/date-time/date-time/index.js.map +1 -0
  95. package/build/date-time/date-time/styles.js +32 -0
  96. package/build/date-time/date-time/styles.js.map +1 -0
  97. package/build/date-time/index.js +2 -109
  98. package/build/date-time/index.js.map +1 -1
  99. package/build/date-time/time/index.js +322 -0
  100. package/build/date-time/time/index.js.map +1 -0
  101. package/build/date-time/time/styles.js +139 -0
  102. package/build/date-time/time/styles.js.map +1 -0
  103. package/build/date-time/{timezone.js → time/timezone.js} +4 -2
  104. package/build/date-time/time/timezone.js.map +1 -0
  105. package/build/dimension-control/index.js +1 -3
  106. package/build/dimension-control/index.js.map +1 -1
  107. package/build/divider/styles.js +5 -5
  108. package/build/divider/styles.js.map +1 -1
  109. package/build/draggable/index.js.map +1 -1
  110. package/build/draggable/index.native.js +16 -6
  111. package/build/draggable/index.native.js.map +1 -1
  112. package/build/drop-zone/provider.js.map +1 -1
  113. package/build/dropdown/index.js +6 -3
  114. package/build/dropdown/index.js.map +1 -1
  115. package/build/dropdown-menu/index.js +13 -2
  116. package/build/dropdown-menu/index.js.map +1 -1
  117. package/build/dropdown-menu/index.native.js +13 -2
  118. package/build/dropdown-menu/index.native.js.map +1 -1
  119. package/build/duotone-picker/duotone-picker.js +42 -29
  120. package/build/duotone-picker/duotone-picker.js.map +1 -1
  121. package/build/elevation/hook.js +13 -13
  122. package/build/elevation/hook.js.map +1 -1
  123. package/build/external-link/index.js +20 -8
  124. package/build/external-link/index.js.map +1 -1
  125. package/build/external-link/styles/external-link-styles.js +3 -3
  126. package/build/external-link/styles/external-link-styles.js.map +1 -1
  127. package/build/external-link/types.js +6 -0
  128. package/build/external-link/types.js.map +1 -0
  129. package/build/flex/flex/hook.js +9 -5
  130. package/build/flex/flex/hook.js.map +1 -1
  131. package/build/focal-point-picker/controls.js +3 -7
  132. package/build/focal-point-picker/controls.js.map +1 -1
  133. package/build/focal-point-picker/index.js.map +1 -1
  134. package/build/focal-point-picker/index.native.js +4 -4
  135. package/build/focal-point-picker/index.native.js.map +1 -1
  136. package/build/focal-point-picker/media.js +4 -8
  137. package/build/focal-point-picker/media.js.map +1 -1
  138. package/build/font-size-picker/index.js +1 -1
  139. package/build/font-size-picker/index.js.map +1 -1
  140. package/build/form-toggle/index.js +34 -9
  141. package/build/form-toggle/index.js.map +1 -1
  142. package/build/form-toggle/types.js +6 -0
  143. package/build/form-toggle/types.js.map +1 -0
  144. package/build/form-token-field/index.js +328 -359
  145. package/build/form-token-field/index.js.map +1 -1
  146. package/build/form-token-field/suggestions-list.js +26 -20
  147. package/build/form-token-field/suggestions-list.js.map +1 -1
  148. package/build/form-token-field/token-input.js +39 -53
  149. package/build/form-token-field/token-input.js.map +1 -1
  150. package/build/form-token-field/token.js +3 -3
  151. package/build/form-token-field/token.js.map +1 -1
  152. package/build/form-token-field/types.js +6 -0
  153. package/build/form-token-field/types.js.map +1 -0
  154. package/build/gradient-picker/index.js.map +1 -1
  155. package/build/h-stack/utils.js +3 -3
  156. package/build/h-stack/utils.js.map +1 -1
  157. package/build/heading/component.js +0 -1
  158. package/build/heading/component.js.map +1 -1
  159. package/build/heading/hook.js.map +1 -1
  160. package/build/heading/types.js +6 -0
  161. package/build/heading/types.js.map +1 -0
  162. package/build/higher-order/navigate-regions/index.js.map +1 -1
  163. package/build/higher-order/with-focus-return/index.js.map +1 -1
  164. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  165. package/build/icon/index.js.map +1 -1
  166. package/build/input-control/index.js +14 -9
  167. package/build/input-control/index.js.map +1 -1
  168. package/build/input-control/input-field.js +11 -36
  169. package/build/input-control/input-field.js.map +1 -1
  170. package/build/input-control/reducer/reducer.js +36 -24
  171. package/build/input-control/reducer/reducer.js.map +1 -1
  172. package/build/input-control/reducer/state.js +0 -1
  173. package/build/input-control/reducer/state.js.map +1 -1
  174. package/build/input-control/utils.js +46 -1
  175. package/build/input-control/utils.js.map +1 -1
  176. package/build/menu-items-choice/index.js +3 -7
  177. package/build/menu-items-choice/index.js.map +1 -1
  178. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  179. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  180. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -7
  181. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  182. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  183. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
  184. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  185. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  186. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  187. package/build/mobile/color-settings/index.native.js.map +1 -1
  188. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  189. package/build/mobile/gradient/index.native.js.map +1 -1
  190. package/build/mobile/html-text-input/index.native.js.map +1 -1
  191. package/build/mobile/inserter-button/index.native.js.map +1 -1
  192. package/build/mobile/link-picker/index.native.js +4 -4
  193. package/build/mobile/link-picker/index.native.js.map +1 -1
  194. package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  195. package/build/mobile/media-edit/index.native.js.map +1 -1
  196. package/build/mobile/segmented-control/index.native.js +3 -5
  197. package/build/mobile/segmented-control/index.native.js.map +1 -1
  198. package/build/modal/index.js +1 -1
  199. package/build/modal/index.js.map +1 -1
  200. package/build/navigable-container/container.js +4 -2
  201. package/build/navigable-container/container.js.map +1 -1
  202. package/build/navigation/context.js +12 -16
  203. package/build/navigation/context.js.map +1 -1
  204. package/build/navigation/group/index.js +4 -7
  205. package/build/navigation/group/index.js.map +1 -1
  206. package/build/navigation/index.js +3 -3
  207. package/build/navigation/index.js.map +1 -1
  208. package/build/navigation/item/base.js +3 -3
  209. package/build/navigation/item/base.js.map +1 -1
  210. package/build/navigation/item/index.js +3 -3
  211. package/build/navigation/item/index.js.map +1 -1
  212. package/build/navigation/item/use-navigation-tree-item.js +2 -1
  213. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  214. package/build/navigation/menu/menu-title-search.js +1 -7
  215. package/build/navigation/menu/menu-title-search.js.map +1 -1
  216. package/build/navigation/menu/search-no-results-found.js +1 -7
  217. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  218. package/build/navigation/use-navigation-tree-nodes.js +18 -10
  219. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  220. package/build/navigation/utils.js +4 -2
  221. package/build/navigation/utils.js.map +1 -1
  222. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  223. package/build/navigator/navigator-button/hook.js.map +1 -1
  224. package/build/navigator/navigator-provider/component.js +1 -1
  225. package/build/navigator/navigator-provider/component.js.map +1 -1
  226. package/build/navigator/navigator-screen/component.js +1 -1
  227. package/build/navigator/navigator-screen/component.js.map +1 -1
  228. package/build/notice/index.js +5 -5
  229. package/build/notice/index.js.map +1 -1
  230. package/build/notice/list.js +4 -2
  231. package/build/notice/list.js.map +1 -1
  232. package/build/panel/body.js +3 -3
  233. package/build/panel/body.js.map +1 -1
  234. package/build/placeholder/index.js +26 -12
  235. package/build/placeholder/index.js.map +1 -1
  236. package/build/popover/index.js +40 -33
  237. package/build/popover/index.js.map +1 -1
  238. package/build/radio-control/index.js +43 -7
  239. package/build/radio-control/index.js.map +1 -1
  240. package/build/radio-control/types.js +6 -0
  241. package/build/radio-control/types.js.map +1 -0
  242. package/build/range-control/index.js +11 -9
  243. package/build/range-control/index.js.map +1 -1
  244. package/build/range-control/input-range.js +6 -10
  245. package/build/range-control/input-range.js.map +1 -1
  246. package/build/range-control/utils.js +10 -12
  247. package/build/range-control/utils.js.map +1 -1
  248. package/build/resizable-box/resize-tooltip/index.js +3 -3
  249. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  250. package/build/resizable-box/resize-tooltip/utils.js +4 -7
  251. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  252. package/build/responsive-wrapper/index.js.map +1 -1
  253. package/build/search-control/index.js +4 -6
  254. package/build/search-control/index.js.map +1 -1
  255. package/build/select-control/index.js +8 -4
  256. package/build/select-control/index.js.map +1 -1
  257. package/build/slot-fill/fill.js +1 -7
  258. package/build/slot-fill/fill.js.map +1 -1
  259. package/build/slot-fill/slot.js +14 -3
  260. package/build/slot-fill/slot.js.map +1 -1
  261. package/build/snackbar/index.js +7 -7
  262. package/build/snackbar/index.js.map +1 -1
  263. package/build/snackbar/list.js +3 -1
  264. package/build/snackbar/list.js.map +1 -1
  265. package/build/spacer/component.js +5 -5
  266. package/build/spacer/component.js.map +1 -1
  267. package/build/spacer/hook.js +11 -3
  268. package/build/spacer/hook.js.map +1 -1
  269. package/build/spinner/index.js +26 -13
  270. package/build/spinner/index.js.map +1 -1
  271. package/build/spinner/styles.js +10 -10
  272. package/build/spinner/styles.js.map +1 -1
  273. package/build/surface/component.js +7 -7
  274. package/build/surface/component.js.map +1 -1
  275. package/build/surface/hook.js +8 -11
  276. package/build/surface/hook.js.map +1 -1
  277. package/build/surface/index.js.map +1 -1
  278. package/build/surface/styles.js +8 -48
  279. package/build/surface/styles.js.map +1 -1
  280. package/build/tab-panel/index.js +3 -1
  281. package/build/tab-panel/index.js.map +1 -1
  282. package/build/text/hook.js +4 -4
  283. package/build/text/hook.js.map +1 -1
  284. package/build/text/utils.js.map +1 -1
  285. package/build/textarea-control/index.js +40 -6
  286. package/build/textarea-control/index.js.map +1 -1
  287. package/build/textarea-control/styles/textarea-control-styles.js +3 -3
  288. package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
  289. package/build/textarea-control/types.js +6 -0
  290. package/build/textarea-control/types.js.map +1 -0
  291. package/build/toggle-control/index.js +1 -3
  292. package/build/toggle-control/index.js.map +1 -1
  293. package/build/toggle-control/index.native.js +1 -7
  294. package/build/toggle-control/index.native.js.map +1 -1
  295. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  296. package/build/toolbar/index.js.map +1 -1
  297. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  298. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  299. package/build/tooltip/index.js +2 -1
  300. package/build/tooltip/index.js.map +1 -1
  301. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  302. package/build/tree-select/index.js +57 -4
  303. package/build/tree-select/index.js.map +1 -1
  304. package/build/tree-select/types.js +6 -0
  305. package/build/tree-select/types.js.map +1 -0
  306. package/build/truncate/component.js +7 -8
  307. package/build/truncate/component.js.map +1 -1
  308. package/build/truncate/hook.js +3 -10
  309. package/build/truncate/hook.js.map +1 -1
  310. package/build/truncate/index.js.map +1 -1
  311. package/build/truncate/styles.js +1 -1
  312. package/build/truncate/styles.js.map +1 -1
  313. package/build/truncate/utils.js +3 -16
  314. package/build/truncate/utils.js.map +1 -1
  315. package/build/ui/form-group/form-group-content.js.map +1 -1
  316. package/build/unit-control/index.js.map +1 -1
  317. package/build/utils/hooks/index.js +0 -8
  318. package/build/utils/hooks/index.js.map +1 -1
  319. package/build/utils/math.js +17 -7
  320. package/build/utils/math.js.map +1 -1
  321. package/build/utils/unit-values.js.map +1 -1
  322. package/build/utils/values.js.map +1 -1
  323. package/build/v-stack/component.js +9 -9
  324. package/build/v-stack/component.js.map +1 -1
  325. package/build/v-stack/hook.js +0 -5
  326. package/build/v-stack/hook.js.map +1 -1
  327. package/build/v-stack/index.js.map +1 -1
  328. package/build/z-stack/component.js +22 -3
  329. package/build/z-stack/component.js.map +1 -1
  330. package/build/z-stack/types.js +6 -0
  331. package/build/z-stack/types.js.map +1 -0
  332. package/build-module/alignment-matrix-control/index.js +7 -3
  333. package/build-module/alignment-matrix-control/index.js.map +1 -1
  334. package/build-module/alignment-matrix-control/utils.js +1 -6
  335. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  336. package/build-module/angle-picker-control/index.js +1 -1
  337. package/build-module/angle-picker-control/index.js.map +1 -1
  338. package/build-module/autocomplete/autocompleter-ui.js +3 -1
  339. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  340. package/build-module/autocomplete/autocompleter-ui.native.js +8 -2
  341. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  342. package/build-module/autocomplete/index.js +15 -11
  343. package/build-module/autocomplete/index.js.map +1 -1
  344. package/build-module/border-box-control/border-box-control/component.js +2 -1
  345. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  346. package/build-module/border-box-control/border-box-control/hook.js +2 -2
  347. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  348. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  349. package/build-module/border-box-control/border-box-control-split-controls/component.js +4 -1
  350. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  351. package/build-module/border-box-control/border-box-control-split-controls/hook.js +11 -4
  352. package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  353. package/build-module/border-box-control/border-box-control-visualizer/hook.js +4 -2
  354. package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  355. package/build-module/border-box-control/styles.js +13 -8
  356. package/build-module/border-box-control/styles.js.map +1 -1
  357. package/build-module/border-box-control/utils.js.map +1 -1
  358. package/build-module/border-control/border-control/component.js +38 -3
  359. package/build-module/border-control/border-control/component.js.map +1 -1
  360. package/build-module/border-control/border-control/hook.js +2 -2
  361. package/build-module/border-control/border-control/hook.js.map +1 -1
  362. package/build-module/box-control/all-input-control.js +3 -5
  363. package/build-module/box-control/all-input-control.js.map +1 -1
  364. package/build-module/box-control/axial-input-controls.js.map +1 -1
  365. package/build-module/box-control/index.js +2 -5
  366. package/build-module/box-control/index.js.map +1 -1
  367. package/build-module/box-control/input-controls.js +3 -5
  368. package/build-module/box-control/input-controls.js.map +1 -1
  369. package/build-module/box-control/unit-control.js +3 -1
  370. package/build-module/box-control/unit-control.js.map +1 -1
  371. package/build-module/box-control/utils.js +4 -4
  372. package/build-module/box-control/utils.js.map +1 -1
  373. package/build-module/button/index.native.js +1 -2
  374. package/build-module/button/index.native.js.map +1 -1
  375. package/build-module/checkbox-control/index.js.map +1 -1
  376. package/build-module/color-indicator/index.js +29 -8
  377. package/build-module/color-indicator/index.js.map +1 -1
  378. package/build-module/color-indicator/types.js +2 -0
  379. package/build-module/color-indicator/types.js.map +1 -0
  380. package/build-module/color-palette/index.js +9 -6
  381. package/build-module/color-palette/index.js.map +1 -1
  382. package/build-module/color-palette/index.native.js +4 -1
  383. package/build-module/color-palette/index.native.js.map +1 -1
  384. package/build-module/color-picker/color-copy-button.js +73 -0
  385. package/build-module/color-picker/color-copy-button.js.map +1 -0
  386. package/build-module/color-picker/component.js +11 -21
  387. package/build-module/color-picker/component.js.map +1 -1
  388. package/build-module/color-picker/hex-input.js +18 -1
  389. package/build-module/color-picker/hex-input.js.map +1 -1
  390. package/build-module/color-picker/index.native.js.map +1 -1
  391. package/build-module/color-picker/input-with-slider.js +1 -2
  392. package/build-module/color-picker/input-with-slider.js.map +1 -1
  393. package/build-module/color-picker/styles.js +30 -16
  394. package/build-module/color-picker/styles.js.map +1 -1
  395. package/build-module/combobox-control/index.js +5 -2
  396. package/build-module/combobox-control/index.js.map +1 -1
  397. package/build-module/confirm-dialog/component.js.map +1 -1
  398. package/build-module/custom-gradient-bar/constants.js +0 -1
  399. package/build-module/custom-gradient-bar/constants.js.map +1 -1
  400. package/build-module/custom-gradient-bar/control-points.js +16 -9
  401. package/build-module/custom-gradient-bar/control-points.js.map +1 -1
  402. package/build-module/custom-gradient-bar/index.js +6 -6
  403. package/build-module/custom-gradient-bar/index.js.map +1 -1
  404. package/build-module/custom-gradient-bar/utils.js +6 -8
  405. package/build-module/custom-gradient-bar/utils.js.map +1 -1
  406. package/build-module/custom-gradient-picker/index.js +8 -7
  407. package/build-module/custom-gradient-picker/index.js.map +1 -1
  408. package/build-module/custom-gradient-picker/index.native.js +8 -8
  409. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  410. package/build-module/custom-gradient-picker/serializer.js +4 -6
  411. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  412. package/build-module/custom-gradient-picker/utils.js +1 -1
  413. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  414. package/build-module/custom-select-control/index.js.map +1 -1
  415. package/build-module/date-time/{date.js → date/index.js} +51 -16
  416. package/build-module/date-time/date/index.js.map +1 -0
  417. package/build-module/date-time/date/styles.js +61 -0
  418. package/build-module/date-time/date/styles.js.map +1 -0
  419. package/build-module/date-time/{utils.js → date/utils.js} +0 -0
  420. package/build-module/date-time/date/utils.js.map +1 -0
  421. package/build-module/date-time/date-time/index.js +147 -0
  422. package/build-module/date-time/date-time/index.js.map +1 -0
  423. package/build-module/date-time/date-time/styles.js +22 -0
  424. package/build-module/date-time/date-time/styles.js.map +1 -0
  425. package/build-module/date-time/index.js +1 -105
  426. package/build-module/date-time/index.js.map +1 -1
  427. package/build-module/date-time/time/index.js +302 -0
  428. package/build-module/date-time/time/index.js.map +1 -0
  429. package/build-module/date-time/time/styles.js +118 -0
  430. package/build-module/date-time/time/styles.js.map +1 -0
  431. package/build-module/date-time/{timezone.js → time/timezone.js} +3 -2
  432. package/build-module/date-time/time/timezone.js.map +1 -0
  433. package/build-module/dimension-control/index.js +1 -2
  434. package/build-module/dimension-control/index.js.map +1 -1
  435. package/build-module/divider/styles.js +5 -5
  436. package/build-module/divider/styles.js.map +1 -1
  437. package/build-module/draggable/index.js.map +1 -1
  438. package/build-module/draggable/index.native.js +16 -6
  439. package/build-module/draggable/index.native.js.map +1 -1
  440. package/build-module/drop-zone/provider.js.map +1 -1
  441. package/build-module/dropdown/index.js +6 -3
  442. package/build-module/dropdown/index.js.map +1 -1
  443. package/build-module/dropdown-menu/index.js +12 -1
  444. package/build-module/dropdown-menu/index.js.map +1 -1
  445. package/build-module/dropdown-menu/index.native.js +12 -1
  446. package/build-module/dropdown-menu/index.native.js.map +1 -1
  447. package/build-module/duotone-picker/duotone-picker.js +42 -29
  448. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  449. package/build-module/elevation/hook.js +12 -12
  450. package/build-module/elevation/hook.js.map +1 -1
  451. package/build-module/external-link/index.js +22 -7
  452. package/build-module/external-link/index.js.map +1 -1
  453. package/build-module/external-link/styles/external-link-styles.js +3 -3
  454. package/build-module/external-link/styles/external-link-styles.js.map +1 -1
  455. package/build-module/external-link/types.js +2 -0
  456. package/build-module/external-link/types.js.map +1 -0
  457. package/build-module/flex/flex/hook.js +7 -5
  458. package/build-module/flex/flex/hook.js.map +1 -1
  459. package/build-module/focal-point-picker/controls.js +3 -5
  460. package/build-module/focal-point-picker/controls.js.map +1 -1
  461. package/build-module/focal-point-picker/index.js.map +1 -1
  462. package/build-module/focal-point-picker/index.native.js +1 -1
  463. package/build-module/focal-point-picker/index.native.js.map +1 -1
  464. package/build-module/focal-point-picker/media.js +3 -5
  465. package/build-module/focal-point-picker/media.js.map +1 -1
  466. package/build-module/font-size-picker/index.js +1 -1
  467. package/build-module/font-size-picker/index.js.map +1 -1
  468. package/build-module/form-toggle/index.js +31 -7
  469. package/build-module/form-toggle/index.js.map +1 -1
  470. package/build-module/form-toggle/types.js +2 -0
  471. package/build-module/form-toggle/types.js.map +1 -0
  472. package/build-module/form-token-field/index.js +329 -361
  473. package/build-module/form-token-field/index.js.map +1 -1
  474. package/build-module/form-token-field/suggestions-list.js +32 -23
  475. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  476. package/build-module/form-token-field/token-input.js +43 -58
  477. package/build-module/form-token-field/token-input.js.map +1 -1
  478. package/build-module/form-token-field/token.js +3 -1
  479. package/build-module/form-token-field/token.js.map +1 -1
  480. package/build-module/form-token-field/types.js +2 -0
  481. package/build-module/form-token-field/types.js.map +1 -0
  482. package/build-module/gradient-picker/index.js.map +1 -1
  483. package/build-module/h-stack/utils.js +3 -3
  484. package/build-module/h-stack/utils.js.map +1 -1
  485. package/build-module/heading/component.js +0 -1
  486. package/build-module/heading/component.js.map +1 -1
  487. package/build-module/heading/hook.js.map +1 -1
  488. package/build-module/heading/types.js +2 -0
  489. package/build-module/heading/types.js.map +1 -0
  490. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  491. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  492. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  493. package/build-module/icon/index.js.map +1 -1
  494. package/build-module/input-control/index.js +10 -5
  495. package/build-module/input-control/index.js.map +1 -1
  496. package/build-module/input-control/input-field.js +3 -26
  497. package/build-module/input-control/input-field.js.map +1 -1
  498. package/build-module/input-control/reducer/reducer.js +38 -26
  499. package/build-module/input-control/reducer/reducer.js.map +1 -1
  500. package/build-module/input-control/reducer/state.js +0 -1
  501. package/build-module/input-control/reducer/state.js.map +1 -1
  502. package/build-module/input-control/utils.js +49 -3
  503. package/build-module/input-control/utils.js.map +1 -1
  504. package/build-module/menu-items-choice/index.js +3 -5
  505. package/build-module/menu-items-choice/index.js.map +1 -1
  506. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  507. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  508. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -6
  509. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  510. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  511. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
  512. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  513. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  514. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  515. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  516. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  517. package/build-module/mobile/gradient/index.native.js.map +1 -1
  518. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  519. package/build-module/mobile/inserter-button/index.native.js.map +1 -1
  520. package/build-module/mobile/link-picker/index.native.js +4 -3
  521. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  522. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  523. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  524. package/build-module/mobile/segmented-control/index.native.js +3 -4
  525. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  526. package/build-module/modal/index.js +1 -1
  527. package/build-module/modal/index.js.map +1 -1
  528. package/build-module/navigable-container/container.js +5 -2
  529. package/build-module/navigable-container/container.js.map +1 -1
  530. package/build-module/navigation/context.js +3 -5
  531. package/build-module/navigation/context.js.map +1 -1
  532. package/build-module/navigation/group/index.js +3 -6
  533. package/build-module/navigation/group/index.js.map +1 -1
  534. package/build-module/navigation/index.js +3 -1
  535. package/build-module/navigation/index.js.map +1 -1
  536. package/build-module/navigation/item/base.js +2 -2
  537. package/build-module/navigation/item/base.js.map +1 -1
  538. package/build-module/navigation/item/index.js +3 -1
  539. package/build-module/navigation/item/index.js.map +1 -1
  540. package/build-module/navigation/item/use-navigation-tree-item.js +2 -1
  541. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  542. package/build-module/navigation/menu/menu-title-search.js +1 -6
  543. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  544. package/build-module/navigation/menu/search-no-results-found.js +1 -6
  545. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  546. package/build-module/navigation/use-navigation-tree-nodes.js +18 -9
  547. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  548. package/build-module/navigation/utils.js +2 -2
  549. package/build-module/navigation/utils.js.map +1 -1
  550. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  551. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  552. package/build-module/navigator/navigator-provider/component.js +1 -1
  553. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  554. package/build-module/navigator/navigator-screen/component.js +1 -1
  555. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  556. package/build-module/notice/index.js +2 -1
  557. package/build-module/notice/index.js.map +1 -1
  558. package/build-module/notice/list.js +4 -1
  559. package/build-module/notice/list.js.map +1 -1
  560. package/build-module/panel/body.js +3 -1
  561. package/build-module/panel/body.js.map +1 -1
  562. package/build-module/placeholder/index.js +24 -11
  563. package/build-module/placeholder/index.js.map +1 -1
  564. package/build-module/popover/index.js +40 -33
  565. package/build-module/popover/index.js.map +1 -1
  566. package/build-module/radio-control/index.js +40 -7
  567. package/build-module/radio-control/index.js.map +1 -1
  568. package/build-module/radio-control/types.js +2 -0
  569. package/build-module/radio-control/types.js.map +1 -0
  570. package/build-module/range-control/index.js +4 -2
  571. package/build-module/range-control/index.js.map +1 -1
  572. package/build-module/range-control/input-range.js +2 -5
  573. package/build-module/range-control/input-range.js.map +1 -1
  574. package/build-module/range-control/utils.js +4 -5
  575. package/build-module/range-control/utils.js.map +1 -1
  576. package/build-module/resizable-box/resize-tooltip/index.js +2 -1
  577. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  578. package/build-module/resizable-box/resize-tooltip/utils.js +3 -5
  579. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  580. package/build-module/responsive-wrapper/index.js.map +1 -1
  581. package/build-module/search-control/index.js +6 -7
  582. package/build-module/search-control/index.js.map +1 -1
  583. package/build-module/select-control/index.js +6 -2
  584. package/build-module/select-control/index.js.map +1 -1
  585. package/build-module/slot-fill/fill.js +1 -6
  586. package/build-module/slot-fill/fill.js.map +1 -1
  587. package/build-module/slot-fill/slot.js +12 -2
  588. package/build-module/slot-fill/slot.js.map +1 -1
  589. package/build-module/snackbar/index.js +3 -1
  590. package/build-module/snackbar/index.js.map +1 -1
  591. package/build-module/snackbar/list.js +4 -1
  592. package/build-module/snackbar/list.js.map +1 -1
  593. package/build-module/spacer/component.js +3 -4
  594. package/build-module/spacer/component.js.map +1 -1
  595. package/build-module/spacer/hook.js +10 -2
  596. package/build-module/spacer/hook.js.map +1 -1
  597. package/build-module/spinner/index.js +22 -13
  598. package/build-module/spinner/index.js.map +1 -1
  599. package/build-module/spinner/styles.js +10 -10
  600. package/build-module/spinner/styles.js.map +1 -1
  601. package/build-module/surface/component.js +7 -7
  602. package/build-module/surface/component.js.map +1 -1
  603. package/build-module/surface/hook.js +8 -11
  604. package/build-module/surface/hook.js.map +1 -1
  605. package/build-module/surface/index.js.map +1 -1
  606. package/build-module/surface/styles.js +8 -48
  607. package/build-module/surface/styles.js.map +1 -1
  608. package/build-module/tab-panel/index.js +3 -1
  609. package/build-module/tab-panel/index.js.map +1 -1
  610. package/build-module/text/hook.js +4 -4
  611. package/build-module/text/hook.js.map +1 -1
  612. package/build-module/text/utils.js.map +1 -1
  613. package/build-module/textarea-control/index.js +36 -5
  614. package/build-module/textarea-control/index.js.map +1 -1
  615. package/build-module/textarea-control/styles/textarea-control-styles.js +3 -3
  616. package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
  617. package/build-module/textarea-control/types.js +2 -0
  618. package/build-module/textarea-control/types.js.map +1 -0
  619. package/build-module/toggle-control/index.js +1 -2
  620. package/build-module/toggle-control/index.js.map +1 -1
  621. package/build-module/toggle-control/index.native.js +1 -6
  622. package/build-module/toggle-control/index.native.js.map +1 -1
  623. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  624. package/build-module/toolbar/index.js.map +1 -1
  625. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  626. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  627. package/build-module/tooltip/index.js +2 -1
  628. package/build-module/tooltip/index.js.map +1 -1
  629. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  630. package/build-module/tree-select/index.js +53 -3
  631. package/build-module/tree-select/index.js.map +1 -1
  632. package/build-module/tree-select/types.js +2 -0
  633. package/build-module/tree-select/types.js.map +1 -0
  634. package/build-module/truncate/component.js +7 -8
  635. package/build-module/truncate/component.js.map +1 -1
  636. package/build-module/truncate/hook.js +3 -10
  637. package/build-module/truncate/hook.js.map +1 -1
  638. package/build-module/truncate/index.js.map +1 -1
  639. package/build-module/truncate/styles.js +1 -1
  640. package/build-module/truncate/styles.js.map +1 -1
  641. package/build-module/truncate/utils.js +3 -16
  642. package/build-module/truncate/utils.js.map +1 -1
  643. package/build-module/ui/form-group/form-group-content.js.map +1 -1
  644. package/build-module/unit-control/index.js.map +1 -1
  645. package/build-module/utils/hooks/index.js +0 -1
  646. package/build-module/utils/hooks/index.js.map +1 -1
  647. package/build-module/utils/math.js +15 -6
  648. package/build-module/utils/math.js.map +1 -1
  649. package/build-module/utils/unit-values.js.map +1 -1
  650. package/build-module/utils/values.js.map +1 -1
  651. package/build-module/v-stack/component.js +9 -9
  652. package/build-module/v-stack/component.js.map +1 -1
  653. package/build-module/v-stack/hook.js +0 -5
  654. package/build-module/v-stack/hook.js.map +1 -1
  655. package/build-module/v-stack/index.js.map +1 -1
  656. package/build-module/z-stack/component.js +21 -2
  657. package/build-module/z-stack/component.js.map +1 -1
  658. package/build-module/z-stack/types.js +2 -0
  659. package/build-module/z-stack/types.js.map +1 -0
  660. package/build-style/style-rtl.css +61 -191
  661. package/build-style/style.css +61 -195
  662. package/build-types/base-control/stories/index.d.ts.map +1 -1
  663. package/build-types/base-field/hook.d.ts +0 -1
  664. package/build-types/base-field/hook.d.ts.map +1 -1
  665. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  666. package/build-types/border-box-control/border-box-control/hook.d.ts +0 -1
  667. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  668. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  669. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +0 -1
  670. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  671. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  672. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
  673. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  674. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +0 -1
  675. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  676. package/build-types/border-box-control/styles.d.ts +3 -2
  677. package/build-types/border-box-control/styles.d.ts.map +1 -1
  678. package/build-types/border-box-control/utils.d.ts.map +1 -1
  679. package/build-types/border-control/border-control/component.d.ts +36 -2
  680. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  681. package/build-types/border-control/border-control/hook.d.ts +0 -1
  682. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  683. package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
  684. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  685. package/build-types/border-control/border-control-style-picker/hook.d.ts +0 -1
  686. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  687. package/build-types/border-control/stories/index.d.ts +33 -0
  688. package/build-types/border-control/stories/index.d.ts.map +1 -0
  689. package/build-types/button-group/index.d.ts +1 -1
  690. package/build-types/button-group/index.d.ts.map +1 -1
  691. package/build-types/card/card/hook.d.ts +0 -1
  692. package/build-types/card/card/hook.d.ts.map +1 -1
  693. package/build-types/card/card-body/hook.d.ts +0 -1
  694. package/build-types/card/card-body/hook.d.ts.map +1 -1
  695. package/build-types/card/card-divider/hook.d.ts +0 -1
  696. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  697. package/build-types/card/card-footer/hook.d.ts +0 -1
  698. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  699. package/build-types/card/card-header/hook.d.ts +0 -1
  700. package/build-types/card/card-header/hook.d.ts.map +1 -1
  701. package/build-types/card/card-media/hook.d.ts +0 -1
  702. package/build-types/card/card-media/hook.d.ts.map +1 -1
  703. package/build-types/card/types.d.ts +1 -1
  704. package/build-types/card/types.d.ts.map +1 -1
  705. package/build-types/checkbox-control/index.d.ts.map +1 -1
  706. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  707. package/build-types/checkbox-control/test/index.d.ts +2 -0
  708. package/build-types/checkbox-control/test/index.d.ts.map +1 -0
  709. package/build-types/color-indicator/index.d.ts +16 -5
  710. package/build-types/color-indicator/index.d.ts.map +1 -1
  711. package/build-types/color-indicator/stories/index.d.ts +12 -0
  712. package/build-types/color-indicator/stories/index.d.ts.map +1 -0
  713. package/build-types/color-indicator/test/index.d.ts +2 -0
  714. package/build-types/color-indicator/test/index.d.ts.map +1 -0
  715. package/build-types/color-indicator/types.d.ts +12 -0
  716. package/build-types/color-indicator/types.d.ts.map +1 -0
  717. package/build-types/color-palette/index.d.ts +1 -0
  718. package/build-types/color-palette/index.d.ts.map +1 -1
  719. package/build-types/color-palette/styles.d.ts +4 -2
  720. package/build-types/color-palette/styles.d.ts.map +1 -1
  721. package/build-types/{date-time → color-palette}/test/utils.d.ts +0 -0
  722. package/build-types/color-palette/test/utils.d.ts.map +1 -0
  723. package/build-types/color-picker/color-copy-button.d.ts +4 -0
  724. package/build-types/color-picker/color-copy-button.d.ts.map +1 -0
  725. package/build-types/color-picker/component.d.ts.map +1 -1
  726. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  727. package/build-types/color-picker/styles.d.ts +25 -8
  728. package/build-types/color-picker/styles.d.ts.map +1 -1
  729. package/build-types/color-picker/types.d.ts +8 -0
  730. package/build-types/color-picker/types.d.ts.map +1 -1
  731. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  732. package/build-types/date-time/{date.d.ts → date/index.d.ts} +4 -3
  733. package/build-types/date-time/date/index.d.ts.map +1 -0
  734. package/build-types/date-time/date/styles.d.ts +23 -0
  735. package/build-types/date-time/date/styles.d.ts.map +1 -0
  736. package/build-types/date-time/date/test/index.d.ts +2 -0
  737. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  738. package/build-types/date-time/date/test/utils.d.ts +2 -0
  739. package/build-types/date-time/date/test/utils.d.ts.map +1 -0
  740. package/build-types/date-time/{utils.d.ts → date/utils.d.ts} +0 -0
  741. package/build-types/date-time/date/utils.d.ts.map +1 -0
  742. package/build-types/date-time/date-time/index.d.ts +33 -0
  743. package/build-types/date-time/date-time/index.d.ts.map +1 -0
  744. package/build-types/date-time/date-time/styles.d.ts +6 -0
  745. package/build-types/date-time/date-time/styles.d.ts.map +1 -0
  746. package/build-types/date-time/index.d.ts +2 -28
  747. package/build-types/date-time/index.d.ts.map +1 -1
  748. package/build-types/date-time/stories/{index.d.ts → date-time.d.ts} +2 -2
  749. package/build-types/date-time/stories/date-time.d.ts.map +1 -0
  750. package/build-types/date-time/stories/date.d.ts.map +1 -1
  751. package/build-types/date-time/{time.d.ts → time/index.d.ts} +2 -2
  752. package/build-types/date-time/time/index.d.ts.map +1 -0
  753. package/build-types/date-time/time/styles.d.ts +111 -0
  754. package/build-types/date-time/time/styles.d.ts.map +1 -0
  755. package/build-types/date-time/time/test/index.d.ts +2 -0
  756. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  757. package/build-types/date-time/{timezone.d.ts → time/timezone.d.ts} +0 -0
  758. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  759. package/build-types/date-time/types.d.ts +20 -15
  760. package/build-types/date-time/types.d.ts.map +1 -1
  761. package/build-types/divider/styles.d.ts.map +1 -1
  762. package/build-types/dropdown/index.d.ts.map +1 -1
  763. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  764. package/build-types/elevation/hook.d.ts +0 -1
  765. package/build-types/elevation/hook.d.ts.map +1 -1
  766. package/build-types/external-link/index.d.ts +17 -0
  767. package/build-types/external-link/index.d.ts.map +1 -0
  768. package/build-types/external-link/stories/index.d.ts +12 -0
  769. package/build-types/external-link/stories/index.d.ts.map +1 -0
  770. package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
  771. package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
  772. package/build-types/external-link/types.d.ts +15 -0
  773. package/build-types/external-link/types.d.ts.map +1 -0
  774. package/build-types/flex/flex/hook.d.ts +0 -1
  775. package/build-types/flex/flex/hook.d.ts.map +1 -1
  776. package/build-types/flex/flex-block/hook.d.ts +0 -1
  777. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  778. package/build-types/flex/flex-item/hook.d.ts +0 -1
  779. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  780. package/build-types/form-toggle/index.d.ts +29 -0
  781. package/build-types/form-toggle/index.d.ts.map +1 -0
  782. package/build-types/form-toggle/stories/index.d.ts +12 -0
  783. package/build-types/form-toggle/stories/index.d.ts.map +1 -0
  784. package/build-types/form-toggle/test/index.d.ts +2 -0
  785. package/build-types/form-toggle/test/index.d.ts.map +1 -0
  786. package/build-types/form-toggle/types.d.ts +22 -0
  787. package/build-types/form-toggle/types.d.ts.map +1 -0
  788. package/build-types/form-token-field/index.d.ts +15 -0
  789. package/build-types/form-token-field/index.d.ts.map +1 -0
  790. package/build-types/form-token-field/stories/index.d.ts +13 -0
  791. package/build-types/form-token-field/stories/index.d.ts.map +1 -0
  792. package/build-types/form-token-field/suggestions-list.d.ts +10 -0
  793. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -0
  794. package/build-types/form-token-field/test/lib/fixtures.d.ts +26 -0
  795. package/build-types/form-token-field/test/lib/fixtures.d.ts.map +1 -0
  796. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +21 -0
  797. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -0
  798. package/build-types/form-token-field/token-input.d.ts +12 -0
  799. package/build-types/form-token-field/token-input.d.ts.map +1 -0
  800. package/build-types/form-token-field/token.d.ts +4 -0
  801. package/build-types/form-token-field/token.d.ts.map +1 -0
  802. package/build-types/form-token-field/types.d.ts +176 -0
  803. package/build-types/form-token-field/types.d.ts.map +1 -0
  804. package/build-types/grid/hook.d.ts +0 -1
  805. package/build-types/grid/hook.d.ts.map +1 -1
  806. package/build-types/h-stack/hook.d.ts +0 -1
  807. package/build-types/h-stack/hook.d.ts.map +1 -1
  808. package/build-types/heading/component.d.ts +1 -2
  809. package/build-types/heading/component.d.ts.map +1 -1
  810. package/build-types/heading/hook.d.ts +1 -29
  811. package/build-types/heading/hook.d.ts.map +1 -1
  812. package/build-types/heading/stories/index.d.ts.map +1 -1
  813. package/build-types/heading/test/index.d.ts +2 -0
  814. package/build-types/heading/test/index.d.ts.map +1 -0
  815. package/build-types/heading/types.d.ts +16 -0
  816. package/build-types/heading/types.d.ts.map +1 -0
  817. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  818. package/build-types/input-control/index.d.ts +1 -1
  819. package/build-types/input-control/index.d.ts.map +1 -1
  820. package/build-types/input-control/input-field.d.ts +1 -1
  821. package/build-types/input-control/input-field.d.ts.map +1 -1
  822. package/build-types/input-control/reducer/reducer.d.ts +5 -3
  823. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  824. package/build-types/input-control/reducer/state.d.ts +2 -2
  825. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  826. package/build-types/input-control/stories/index.d.ts +5 -5
  827. package/build-types/input-control/stories/index.d.ts.map +1 -1
  828. package/build-types/input-control/utils.d.ts +17 -0
  829. package/build-types/input-control/utils.d.ts.map +1 -1
  830. package/build-types/item-group/item/hook.d.ts +0 -1
  831. package/build-types/item-group/item/hook.d.ts.map +1 -1
  832. package/build-types/item-group/item-group/hook.d.ts +0 -1
  833. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  834. package/build-types/navigator/navigator-back-button/hook.d.ts +0 -1
  835. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  836. package/build-types/navigator/navigator-button/hook.d.ts +0 -1
  837. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  838. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  839. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  840. package/build-types/popover/index.d.ts +1 -0
  841. package/build-types/popover/index.d.ts.map +1 -1
  842. package/build-types/radio-control/index.d.ts +31 -0
  843. package/build-types/radio-control/index.d.ts.map +1 -0
  844. package/build-types/radio-control/stories/index.d.ts +12 -0
  845. package/build-types/radio-control/stories/index.d.ts.map +1 -0
  846. package/build-types/radio-control/types.d.ts +29 -0
  847. package/build-types/radio-control/types.d.ts.map +1 -0
  848. package/build-types/range-control/index.d.ts +5 -5
  849. package/build-types/range-control/index.d.ts.map +1 -1
  850. package/build-types/range-control/input-range.d.ts +4 -4
  851. package/build-types/range-control/input-range.d.ts.map +1 -1
  852. package/build-types/range-control/utils.d.ts.map +1 -1
  853. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  854. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  855. package/build-types/scrollable/hook.d.ts +0 -1
  856. package/build-types/scrollable/hook.d.ts.map +1 -1
  857. package/build-types/select-control/index.d.ts +1 -1
  858. package/build-types/select-control/index.d.ts.map +1 -1
  859. package/build-types/select-control/stories/index.d.ts +3 -3
  860. package/build-types/select-control/stories/index.d.ts.map +1 -1
  861. package/build-types/select-control/types.d.ts +1 -1
  862. package/build-types/select-control/types.d.ts.map +1 -1
  863. package/build-types/slot-fill/fill.d.ts.map +1 -1
  864. package/build-types/slot-fill/slot.d.ts.map +1 -1
  865. package/build-types/spacer/component.d.ts +2 -3
  866. package/build-types/spacer/component.d.ts.map +1 -1
  867. package/build-types/spacer/hook.d.ts +0 -1
  868. package/build-types/spacer/hook.d.ts.map +1 -1
  869. package/build-types/spacer/stories/index.d.ts +12 -0
  870. package/build-types/spacer/stories/index.d.ts.map +1 -0
  871. package/build-types/spinner/index.d.ts +16 -15
  872. package/build-types/spinner/index.d.ts.map +1 -1
  873. package/build-types/spinner/stories/index.d.ts +13 -0
  874. package/build-types/spinner/stories/index.d.ts.map +1 -0
  875. package/build-types/spinner/styles.d.ts +4 -3
  876. package/build-types/spinner/styles.d.ts.map +1 -1
  877. package/build-types/surface/component.d.ts +3 -2
  878. package/build-types/surface/component.d.ts.map +1 -1
  879. package/build-types/surface/hook.d.ts +4 -5
  880. package/build-types/surface/hook.d.ts.map +1 -1
  881. package/build-types/surface/index.d.ts +2 -2
  882. package/build-types/surface/index.d.ts.map +1 -1
  883. package/build-types/surface/stories/index.d.ts +12 -0
  884. package/build-types/surface/stories/index.d.ts.map +1 -0
  885. package/build-types/surface/styles.d.ts +10 -21
  886. package/build-types/surface/styles.d.ts.map +1 -1
  887. package/build-types/surface/test/index.d.ts +2 -0
  888. package/build-types/surface/test/index.d.ts.map +1 -0
  889. package/build-types/surface/types.d.ts +1 -1
  890. package/build-types/surface/types.d.ts.map +1 -1
  891. package/build-types/text/hook.d.ts +0 -1
  892. package/build-types/text/hook.d.ts.map +1 -1
  893. package/build-types/text/types.d.ts +1 -1
  894. package/build-types/text/types.d.ts.map +1 -1
  895. package/build-types/text/utils.d.ts.map +1 -1
  896. package/build-types/text-control/index.d.ts +1 -1
  897. package/build-types/text-control/index.d.ts.map +1 -1
  898. package/build-types/text-control/stories/index.d.ts.map +1 -1
  899. package/build-types/textarea-control/index.d.ts +29 -0
  900. package/build-types/textarea-control/index.d.ts.map +1 -0
  901. package/build-types/textarea-control/stories/index.d.ts +12 -0
  902. package/build-types/textarea-control/stories/index.d.ts.map +1 -0
  903. package/build-types/textarea-control/styles/textarea-control-styles.d.ts +6 -0
  904. package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -0
  905. package/build-types/textarea-control/types.d.ts +26 -0
  906. package/build-types/textarea-control/types.d.ts.map +1 -0
  907. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
  908. package/build-types/tools-panel/tools-panel/hook.d.ts +0 -1
  909. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  910. package/build-types/tools-panel/tools-panel-header/hook.d.ts +0 -1
  911. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  912. package/build-types/tools-panel/tools-panel-item/hook.d.ts +0 -1
  913. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  914. package/build-types/tooltip/index.d.ts.map +1 -1
  915. package/build-types/tree-select/index.d.ts +53 -0
  916. package/build-types/tree-select/index.d.ts.map +1 -0
  917. package/build-types/tree-select/stories/index.d.ts +12 -0
  918. package/build-types/tree-select/stories/index.d.ts.map +1 -0
  919. package/build-types/tree-select/types.d.ts +30 -0
  920. package/build-types/tree-select/types.d.ts.map +1 -0
  921. package/build-types/truncate/component.d.ts +3 -3
  922. package/build-types/truncate/component.d.ts.map +1 -1
  923. package/build-types/truncate/hook.d.ts +5 -3
  924. package/build-types/truncate/hook.d.ts.map +1 -1
  925. package/build-types/truncate/index.d.ts +2 -2
  926. package/build-types/truncate/index.d.ts.map +1 -1
  927. package/build-types/truncate/stories/index.d.ts +13 -0
  928. package/build-types/truncate/stories/index.d.ts.map +1 -0
  929. package/build-types/truncate/styles.d.ts +1 -1
  930. package/build-types/truncate/styles.d.ts.map +1 -1
  931. package/build-types/truncate/test/index.d.ts +2 -0
  932. package/build-types/truncate/test/index.d.ts.map +1 -0
  933. package/build-types/truncate/types.d.ts +22 -11
  934. package/build-types/truncate/types.d.ts.map +1 -1
  935. package/build-types/truncate/utils.d.ts +17 -28
  936. package/build-types/truncate/utils.d.ts.map +1 -1
  937. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  938. package/build-types/ui/control-group/hook.d.ts +0 -1
  939. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  940. package/build-types/ui/control-label/hook.d.ts +0 -1
  941. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  942. package/build-types/ui/form-group/use-form-group.d.ts +2 -4
  943. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  944. package/build-types/unit-control/index.d.ts +1 -1
  945. package/build-types/unit-control/index.d.ts.map +1 -1
  946. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  947. package/build-types/utils/hooks/index.d.ts +0 -1
  948. package/build-types/utils/math.d.ts +10 -0
  949. package/build-types/utils/math.d.ts.map +1 -1
  950. package/build-types/utils/unit-values.d.ts.map +1 -1
  951. package/build-types/utils/values.d.ts.map +1 -1
  952. package/build-types/v-stack/component.d.ts +5 -4
  953. package/build-types/v-stack/component.d.ts.map +1 -1
  954. package/build-types/v-stack/hook.d.ts +5 -4
  955. package/build-types/v-stack/hook.d.ts.map +1 -1
  956. package/build-types/v-stack/index.d.ts +2 -2
  957. package/build-types/v-stack/index.d.ts.map +1 -1
  958. package/build-types/v-stack/stories/index.d.ts +9 -0
  959. package/build-types/v-stack/stories/index.d.ts.map +1 -0
  960. package/build-types/v-stack/test/index.d.ts +2 -0
  961. package/build-types/v-stack/test/index.d.ts.map +1 -0
  962. package/build-types/v-stack/types.d.ts +21 -1
  963. package/build-types/v-stack/types.d.ts.map +1 -1
  964. package/build-types/z-stack/component.d.ts +18 -28
  965. package/build-types/z-stack/component.d.ts.map +1 -1
  966. package/build-types/z-stack/stories/index.d.ts +6 -0
  967. package/build-types/z-stack/stories/index.d.ts.map +1 -0
  968. package/build-types/z-stack/types.d.ts +33 -0
  969. package/build-types/z-stack/types.d.ts.map +1 -0
  970. package/package.json +19 -18
  971. package/src/alignment-matrix-control/index.js +6 -3
  972. package/src/alignment-matrix-control/utils.js +1 -6
  973. package/src/angle-picker-control/index.js +1 -1
  974. package/src/autocomplete/autocompleter-ui.js +3 -0
  975. package/src/autocomplete/autocompleter-ui.native.js +6 -0
  976. package/src/autocomplete/index.js +16 -8
  977. package/src/base-control/stories/index.tsx +2 -3
  978. package/src/border-box-control/border-box-control/component.tsx +1 -0
  979. package/src/border-box-control/border-box-control/hook.ts +2 -2
  980. package/src/border-box-control/border-box-control-linked-button/component.tsx +2 -5
  981. package/src/border-box-control/border-box-control-split-controls/component.tsx +3 -0
  982. package/src/border-box-control/border-box-control-split-controls/hook.ts +18 -4
  983. package/src/border-box-control/border-box-control-visualizer/hook.ts +5 -2
  984. package/src/border-box-control/styles.ts +6 -2
  985. package/src/border-box-control/utils.ts +5 -2
  986. package/src/border-control/border-control/component.tsx +41 -4
  987. package/src/border-control/border-control/hook.ts +10 -5
  988. package/src/border-control/stories/index.tsx +150 -0
  989. package/src/box-control/all-input-control.js +2 -4
  990. package/src/box-control/axial-input-controls.js +4 -6
  991. package/src/box-control/index.js +2 -5
  992. package/src/box-control/input-controls.js +33 -36
  993. package/src/box-control/test/index.js +120 -109
  994. package/src/box-control/unit-control.js +2 -1
  995. package/src/box-control/utils.js +4 -4
  996. package/src/button/index.native.js +1 -2
  997. package/src/card/stories/index.js +10 -5
  998. package/src/card/types.ts +1 -1
  999. package/src/checkbox-control/index.tsx +2 -3
  1000. package/src/checkbox-control/stories/index.tsx +2 -3
  1001. package/src/checkbox-control/test/__snapshots__/index.tsx.snap +42 -0
  1002. package/src/checkbox-control/test/index.tsx +110 -0
  1003. package/src/color-indicator/README.md +7 -9
  1004. package/src/color-indicator/index.tsx +47 -0
  1005. package/src/color-indicator/stories/index.tsx +37 -0
  1006. package/src/color-indicator/test/__snapshots__/index.tsx.snap +11 -0
  1007. package/src/color-indicator/test/{index.js → index.tsx} +4 -4
  1008. package/src/color-indicator/types.ts +12 -0
  1009. package/src/color-palette/index.js +16 -5
  1010. package/src/color-palette/index.native.js +3 -0
  1011. package/src/color-palette/stories/index.js +25 -1
  1012. package/src/color-palette/test/utils.ts +24 -0
  1013. package/src/color-picker/color-copy-button.tsx +76 -0
  1014. package/src/color-picker/component.tsx +18 -37
  1015. package/src/color-picker/hex-input.tsx +16 -0
  1016. package/src/color-picker/index.native.js +7 -4
  1017. package/src/color-picker/input-with-slider.tsx +2 -2
  1018. package/src/color-picker/styles.ts +25 -2
  1019. package/src/color-picker/types.ts +9 -0
  1020. package/src/combobox-control/index.js +4 -2
  1021. package/src/confirm-dialog/component.tsx +7 -8
  1022. package/src/custom-gradient-bar/constants.js +2 -2
  1023. package/src/custom-gradient-bar/control-points.js +20 -16
  1024. package/src/custom-gradient-bar/index.js +11 -11
  1025. package/src/custom-gradient-bar/test/utils.js +79 -0
  1026. package/src/custom-gradient-bar/utils.js +6 -18
  1027. package/src/custom-gradient-picker/index.js +4 -11
  1028. package/src/custom-gradient-picker/index.native.js +3 -11
  1029. package/src/custom-gradient-picker/serializer.js +5 -11
  1030. package/src/custom-gradient-picker/style.scss +1 -3
  1031. package/src/custom-gradient-picker/utils.js +5 -4
  1032. package/src/custom-select-control/index.js +2 -1
  1033. package/src/custom-select-control/stories/index.js +1 -2
  1034. package/src/date-time/README.md +23 -0
  1035. package/src/date-time/{datepicker.scss → date/datepicker.scss} +0 -0
  1036. package/src/date-time/{date.tsx → date/index.tsx} +42 -17
  1037. package/src/date-time/date/style.scss +85 -0
  1038. package/src/date-time/date/styles.ts +55 -0
  1039. package/src/date-time/{test/date.tsx → date/test/index.tsx} +2 -2
  1040. package/src/date-time/{test → date/test}/utils.ts +0 -0
  1041. package/src/date-time/{utils.ts → date/utils.ts} +0 -0
  1042. package/src/date-time/date-time/index.tsx +217 -0
  1043. package/src/date-time/date-time/styles.ts +8 -0
  1044. package/src/date-time/index.ts +9 -0
  1045. package/src/date-time/stories/{index.tsx → date-time.tsx} +5 -7
  1046. package/src/date-time/stories/date.tsx +2 -3
  1047. package/src/date-time/style.scss +1 -262
  1048. package/src/date-time/time/index.tsx +356 -0
  1049. package/src/date-time/time/styles.ts +119 -0
  1050. package/src/date-time/{test/time.tsx → time/test/index.tsx} +97 -50
  1051. package/src/date-time/{timezone.tsx → time/timezone.tsx} +5 -2
  1052. package/src/date-time/types.ts +23 -18
  1053. package/src/dimension-control/README.md +5 -2
  1054. package/src/dimension-control/index.js +1 -2
  1055. package/src/dimension-control/test/index.test.js +7 -7
  1056. package/src/divider/styles.ts +2 -3
  1057. package/src/draggable/index.js +3 -3
  1058. package/src/draggable/index.native.js +26 -7
  1059. package/src/draggable/test/index.native.js +130 -0
  1060. package/src/drop-zone/provider.js +1 -2
  1061. package/src/dropdown/index.js +7 -3
  1062. package/src/dropdown-menu/index.js +11 -1
  1063. package/src/dropdown-menu/index.native.js +11 -1
  1064. package/src/duotone-picker/duotone-picker.js +58 -37
  1065. package/src/duotone-picker/style.scss +19 -0
  1066. package/src/elevation/hook.js +8 -8
  1067. package/src/external-link/README.md +18 -0
  1068. package/src/external-link/{index.js → index.tsx} +26 -6
  1069. package/src/external-link/stories/index.tsx +36 -0
  1070. package/src/external-link/styles/{external-link-styles.js → external-link-styles.ts} +0 -0
  1071. package/src/external-link/types.ts +15 -0
  1072. package/src/flex/flex/README.md +5 -10
  1073. package/src/flex/flex/hook.js +4 -1
  1074. package/src/flex/flex-item/README.md +1 -1
  1075. package/src/focal-point-picker/controls.js +1 -5
  1076. package/src/focal-point-picker/index.js +2 -8
  1077. package/src/focal-point-picker/index.native.js +1 -1
  1078. package/src/focal-point-picker/media.js +2 -5
  1079. package/src/font-size-picker/index.js +3 -1
  1080. package/src/form-toggle/README.md +10 -11
  1081. package/src/form-toggle/index.tsx +71 -0
  1082. package/src/form-toggle/stories/index.tsx +52 -0
  1083. package/src/form-toggle/test/__snapshots__/index.tsx.snap +54 -0
  1084. package/src/form-toggle/test/index.tsx +102 -0
  1085. package/src/form-toggle/types.ts +22 -0
  1086. package/src/form-token-field/index.tsx +694 -0
  1087. package/src/form-token-field/stories/index.tsx +103 -0
  1088. package/src/form-token-field/style.scss +2 -1
  1089. package/src/form-token-field/{suggestions-list.js → suggestions-list.tsx} +45 -29
  1090. package/src/form-token-field/test/index.js +70 -40
  1091. package/src/form-token-field/test/lib/token-field-wrapper.tsx +71 -0
  1092. package/src/form-token-field/token-input.tsx +76 -0
  1093. package/src/form-token-field/{token.js → token.tsx} +4 -2
  1094. package/src/form-token-field/types.ts +178 -0
  1095. package/src/gradient-picker/index.js +4 -3
  1096. package/src/h-stack/utils.js +3 -3
  1097. package/src/heading/README.md +4 -3
  1098. package/src/heading/component.tsx +2 -2
  1099. package/src/heading/hook.ts +6 -46
  1100. package/src/heading/stories/index.tsx +5 -1
  1101. package/src/heading/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1102. package/src/heading/test/index.tsx +68 -0
  1103. package/src/heading/types.ts +29 -0
  1104. package/src/higher-order/navigate-regions/index.js +7 -5
  1105. package/src/higher-order/with-filters/test/index.js +43 -36
  1106. package/src/higher-order/with-focus-return/index.js +14 -13
  1107. package/src/higher-order/with-spoken-messages/index.js +8 -7
  1108. package/src/higher-order/with-spoken-messages/test/index.js +1 -1
  1109. package/src/icon/index.tsx +2 -2
  1110. package/src/input-control/index.tsx +10 -3
  1111. package/src/input-control/input-field.tsx +12 -31
  1112. package/src/input-control/reducer/reducer.ts +63 -47
  1113. package/src/input-control/reducer/state.ts +2 -3
  1114. package/src/input-control/test/index.js +106 -31
  1115. package/src/input-control/utils.ts +56 -2
  1116. package/src/item-group/stories/index.js +2 -1
  1117. package/src/menu-item/test/index.js +2 -1
  1118. package/src/menu-items-choice/index.js +2 -5
  1119. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +2 -4
  1120. package/src/mobile/bottom-sheet/cell.native.js +2 -3
  1121. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +3 -5
  1122. package/src/mobile/bottom-sheet/index.native.js +14 -17
  1123. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +2 -7
  1124. package/src/mobile/bottom-sheet/picker-cell.native.js +2 -7
  1125. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +4 -6
  1126. package/src/mobile/color-settings/index.native.js +2 -4
  1127. package/src/mobile/global-styles-context/index.native.js +8 -7
  1128. package/src/mobile/gradient/index.native.js +12 -9
  1129. package/src/mobile/gradient/test/index.native.js +1 -3
  1130. package/src/mobile/html-text-input/index.native.js +2 -3
  1131. package/src/mobile/inserter-button/index.native.js +2 -6
  1132. package/src/mobile/link-picker/index.native.js +2 -3
  1133. package/src/mobile/link-settings/image-link-destinations-screen.native.js +6 -2
  1134. package/src/mobile/media-edit/index.native.js +2 -3
  1135. package/src/mobile/segmented-control/index.native.js +9 -9
  1136. package/src/mobile/utils/test/index.native.js +3 -12
  1137. package/src/modal/index.js +1 -1
  1138. package/src/navigable-container/container.js +3 -2
  1139. package/src/navigable-container/test/menu.js +1 -2
  1140. package/src/navigable-container/test/tabbable.js +1 -2
  1141. package/src/navigation/context.js +2 -5
  1142. package/src/navigation/group/index.js +8 -3
  1143. package/src/navigation/index.js +2 -1
  1144. package/src/navigation/item/base.js +3 -2
  1145. package/src/navigation/item/index.js +2 -1
  1146. package/src/navigation/item/use-navigation-tree-item.js +2 -0
  1147. package/src/navigation/menu/menu-title-search.js +3 -6
  1148. package/src/navigation/menu/search-no-results-found.js +3 -6
  1149. package/src/navigation/stories/controlled-state.js +1 -1
  1150. package/src/navigation/stories/more-examples.js +2 -3
  1151. package/src/navigation/test/index.js +252 -52
  1152. package/src/navigation/use-navigation-tree-nodes.js +11 -10
  1153. package/src/navigation/utils.js +2 -2
  1154. package/src/navigator/navigator-back-button/hook.ts +14 -12
  1155. package/src/navigator/navigator-button/hook.ts +14 -13
  1156. package/src/navigator/navigator-provider/component.tsx +2 -6
  1157. package/src/navigator/navigator-screen/component.tsx +3 -3
  1158. package/src/notice/index.js +2 -1
  1159. package/src/notice/list.js +3 -1
  1160. package/src/number-control/stories/index.js +24 -24
  1161. package/src/panel/body.js +2 -1
  1162. package/src/placeholder/README.md +7 -6
  1163. package/src/placeholder/index.js +27 -10
  1164. package/src/placeholder/style.scss +23 -0
  1165. package/src/popover/index.js +42 -27
  1166. package/src/query-controls/README.md +1 -1
  1167. package/src/radio-control/README.md +17 -23
  1168. package/src/radio-control/index.tsx +107 -0
  1169. package/src/radio-control/stories/index.tsx +72 -0
  1170. package/src/radio-control/types.ts +32 -0
  1171. package/src/range-control/index.js +4 -2
  1172. package/src/range-control/input-range.js +2 -5
  1173. package/src/range-control/utils.js +3 -4
  1174. package/src/resizable-box/resize-tooltip/index.tsx +2 -1
  1175. package/src/resizable-box/resize-tooltip/utils.ts +1 -5
  1176. package/src/responsive-wrapper/index.js +2 -4
  1177. package/src/sandbox/test/index.js +4 -6
  1178. package/src/search-control/index.js +6 -7
  1179. package/src/select-control/README.md +11 -0
  1180. package/src/select-control/index.tsx +9 -2
  1181. package/src/select-control/stories/index.tsx +3 -4
  1182. package/src/select-control/types.ts +1 -1
  1183. package/src/slot-fill/README.md +1 -1
  1184. package/src/slot-fill/fill.js +1 -5
  1185. package/src/slot-fill/slot.js +12 -2
  1186. package/src/slot-fill/test/slot.js +2 -3
  1187. package/src/snackbar/index.js +1 -1
  1188. package/src/snackbar/list.js +2 -1
  1189. package/src/spacer/component.tsx +3 -4
  1190. package/src/spacer/hook.ts +13 -13
  1191. package/src/spacer/stories/index.tsx +70 -0
  1192. package/src/spinner/{index.js → index.tsx} +23 -9
  1193. package/src/spinner/stories/index.tsx +32 -0
  1194. package/src/spinner/{styles.js → styles.ts} +0 -0
  1195. package/src/style.scss +1 -0
  1196. package/src/surface/README.md +15 -15
  1197. package/src/surface/{component.js → component.tsx} +13 -7
  1198. package/src/surface/{hook.js → hook.ts} +13 -12
  1199. package/src/surface/{index.js → index.ts} +0 -0
  1200. package/src/surface/stories/index.tsx +40 -0
  1201. package/src/surface/{styles.js → styles.ts} +15 -44
  1202. package/src/surface/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1203. package/src/surface/test/{index.js → index.tsx} +2 -1
  1204. package/src/surface/types.ts +1 -1
  1205. package/src/tab-panel/index.js +3 -1
  1206. package/src/text/hook.js +4 -1
  1207. package/src/text/types.ts +1 -1
  1208. package/src/text/utils.js +2 -3
  1209. package/src/text-control/stories/index.tsx +4 -6
  1210. package/src/textarea-control/README.md +14 -20
  1211. package/src/textarea-control/index.tsx +86 -0
  1212. package/src/textarea-control/stories/index.tsx +58 -0
  1213. package/src/textarea-control/styles/{textarea-control-styles.js → textarea-control-styles.ts} +0 -0
  1214. package/src/textarea-control/types.ts +30 -0
  1215. package/src/toggle-control/index.js +1 -2
  1216. package/src/toggle-control/index.native.js +2 -6
  1217. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +2 -4
  1218. package/src/toolbar/index.js +1 -2
  1219. package/src/tools-panel/tools-panel/hook.ts +2 -4
  1220. package/src/tools-panel/tools-panel-header/hook.ts +2 -5
  1221. package/src/tooltip/index.js +1 -0
  1222. package/src/tree-grid/roving-tab-index-item.js +2 -4
  1223. package/src/tree-grid/test/index.js +2 -3
  1224. package/src/tree-select/README.md +2 -2
  1225. package/src/tree-select/index.tsx +99 -0
  1226. package/src/tree-select/stories/index.tsx +80 -0
  1227. package/src/tree-select/types.ts +35 -0
  1228. package/src/truncate/README.md +16 -12
  1229. package/src/truncate/{component.js → component.tsx} +13 -9
  1230. package/src/truncate/{hook.js → hook.ts} +8 -10
  1231. package/src/truncate/{index.js → index.ts} +0 -0
  1232. package/src/truncate/stories/index.tsx +49 -0
  1233. package/src/truncate/{styles.js → styles.ts} +0 -0
  1234. package/src/truncate/test/{index.js → index.tsx} +4 -4
  1235. package/src/truncate/types.ts +28 -10
  1236. package/src/truncate/{utils.js → utils.ts} +19 -19
  1237. package/src/ui/context/wordpress-component.ts +4 -5
  1238. package/src/ui/form-group/form-group-content.js +4 -4
  1239. package/src/unit-control/index.tsx +7 -9
  1240. package/src/unit-control/stories/index.tsx +8 -12
  1241. package/src/unit-control/test/index.tsx +4 -7
  1242. package/src/utils/hooks/index.js +0 -1
  1243. package/src/utils/hooks/stories/use-cx.js +8 -7
  1244. package/src/utils/hooks/test/use-controlled-state.js +2 -1
  1245. package/src/utils/math.js +14 -5
  1246. package/src/utils/test/math.js +22 -1
  1247. package/src/utils/unit-values.ts +2 -1
  1248. package/src/utils/values.js +2 -3
  1249. package/src/v-stack/README.md +6 -18
  1250. package/src/v-stack/{component.js → component.tsx} +15 -10
  1251. package/src/v-stack/{hook.js → hook.ts} +5 -6
  1252. package/src/v-stack/{index.js → index.ts} +0 -0
  1253. package/src/v-stack/stories/index.tsx +41 -0
  1254. package/src/v-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1255. package/src/v-stack/test/{index.js → index.tsx} +0 -0
  1256. package/src/v-stack/types.ts +21 -1
  1257. package/src/z-stack/README.md +14 -3
  1258. package/src/z-stack/component.tsx +24 -29
  1259. package/src/z-stack/stories/index.tsx +76 -0
  1260. package/src/z-stack/types.ts +33 -0
  1261. package/tsconfig.json +7 -0
  1262. package/tsconfig.tsbuildinfo +1 -1
  1263. package/build/color-picker/color-display.js +0 -184
  1264. package/build/color-picker/color-display.js.map +0 -1
  1265. package/build/date-time/date.js.map +0 -1
  1266. package/build/date-time/time.js +0 -289
  1267. package/build/date-time/time.js.map +0 -1
  1268. package/build/date-time/timezone.js.map +0 -1
  1269. package/build/date-time/utils.js.map +0 -1
  1270. package/build/utils/hooks/use-combined-ref.js +0 -32
  1271. package/build/utils/hooks/use-combined-ref.js.map +0 -1
  1272. package/build-module/color-picker/color-display.js +0 -170
  1273. package/build-module/color-picker/color-display.js.map +0 -1
  1274. package/build-module/date-time/date.js.map +0 -1
  1275. package/build-module/date-time/time.js +0 -271
  1276. package/build-module/date-time/time.js.map +0 -1
  1277. package/build-module/date-time/timezone.js.map +0 -1
  1278. package/build-module/date-time/utils.js.map +0 -1
  1279. package/build-module/utils/hooks/use-combined-ref.js +0 -28
  1280. package/build-module/utils/hooks/use-combined-ref.js.map +0 -1
  1281. package/build-types/color-picker/color-display.d.ts +0 -14
  1282. package/build-types/color-picker/color-display.d.ts.map +0 -1
  1283. package/build-types/date-time/date.d.ts.map +0 -1
  1284. package/build-types/date-time/stories/index.d.ts.map +0 -1
  1285. package/build-types/date-time/test/date.d.ts +0 -2
  1286. package/build-types/date-time/test/date.d.ts.map +0 -1
  1287. package/build-types/date-time/test/time.d.ts +0 -2
  1288. package/build-types/date-time/test/time.d.ts.map +0 -1
  1289. package/build-types/date-time/test/utils.d.ts.map +0 -1
  1290. package/build-types/date-time/time.d.ts.map +0 -1
  1291. package/build-types/date-time/timezone.d.ts.map +0 -1
  1292. package/build-types/date-time/utils.d.ts.map +0 -1
  1293. package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
  1294. package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
  1295. package/src/border-control/stories/index.js +0 -119
  1296. package/src/color-indicator/index.js +0 -16
  1297. package/src/color-indicator/stories/index.js +0 -22
  1298. package/src/color-indicator/test/__snapshots__/index.js.snap +0 -13
  1299. package/src/color-picker/color-display.tsx +0 -169
  1300. package/src/date-time/index.tsx +0 -196
  1301. package/src/date-time/time.tsx +0 -321
  1302. package/src/external-link/stories/index.js +0 -23
  1303. package/src/form-toggle/index.js +0 -37
  1304. package/src/form-toggle/stories/index.js +0 -28
  1305. package/src/form-toggle/test/index.js +0 -75
  1306. package/src/form-token-field/index.js +0 -725
  1307. package/src/form-token-field/stories/index.js +0 -102
  1308. package/src/form-token-field/test/lib/token-field-wrapper.js +0 -56
  1309. package/src/form-token-field/token-input.js +0 -81
  1310. package/src/heading/test/index.js +0 -67
  1311. package/src/radio-control/index.js +0 -69
  1312. package/src/radio-control/stories/index.js +0 -41
  1313. package/src/spacer/stories/index.js +0 -59
  1314. package/src/spinner/stories/index.js +0 -43
  1315. package/src/surface/stories/index.js +0 -46
  1316. package/src/textarea-control/index.js +0 -45
  1317. package/src/textarea-control/stories/index.js +0 -48
  1318. package/src/tree-select/index.js +0 -48
  1319. package/src/tree-select/stories/index.js +0 -80
  1320. package/src/truncate/stories/index.js +0 -38
  1321. package/src/utils/hooks/use-combined-ref.ts +0 -28
  1322. package/src/z-stack/stories/index.js +0 -70
@@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFpRHdCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcb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XHRcdGVsbGlwc2l6ZU1vZGUsXG5cdFx0XHRsaW1pdCxcblx0XHRcdG51bWJlck9mTGluZXMsXG5cdFx0fVxuXHQpO1xuXG5cdGNvbnN0IHNob3VsZFRydW5jYXRlID0gZWxsaXBzaXplTW9kZSA9PT0gVFJVTkNBVEVfVFlQRS5hdXRvO1xuXG5cdGNvbnN0IGNsYXNzZXMgPSB1c2VNZW1vKCAoKSA9PiB7XG5cdFx0Y29uc3Qgc3ggPSB7fTtcblxuXHRcdHN4Lm51bWJlck9mTGluZXMgPSBjc3NgXG5cdFx0XHQtd2Via2l0LWJveC1vcmllbnQ6IHZlcnRpY2FsO1xuXHRcdFx0LXdlYmtpdC1saW5lLWNsYW1wOiAkeyBudW1iZXJPZkxpbmVzIH07XG5cdFx0XHRkaXNwbGF5OiAtd2Via2l0LWJveDtcblx0XHRcdG92ZXJmbG93OiBoaWRkZW47XG5cdFx0YDtcblxuXHRcdHJldHVybiBjeChcblx0XHRcdHNob3VsZFRydW5jYXRlICYmICEgbnVtYmVyT2ZMaW5lcyAmJiBzdHlsZXMuVHJ1bmNhdGUsXG5cdFx0XHRzaG91bGRUcnVuY2F0ZSAmJiAhISBudW1iZXJPZkxpbmVzICYmIHN4Lm51bWJlck9mTGluZXMsXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbIGNsYXNzTmFtZSwgY3gsIG51bWJlck9mTGluZXMsIHNob3VsZFRydW5jYXRlIF0gKTtcblxuXHRyZXR1cm4geyAuLi5vdGhlclByb3BzLCBjbGFzc05hbWU6IGNsYXNzZXMsIGNoaWxkcmVuOiB0cnVuY2F0ZWRDb250ZW50IH07XG59XG4iXX0= */");
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" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErQzJCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyB1c2VDb250ZXh0U3lzdGVtLCBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQnO1xuaW1wb3J0ICogYXMgc3R5bGVzIGZyb20gJy4vc3R5bGVzJztcbmltcG9ydCB7IFRSVU5DQVRFX0VMTElQU0lTLCBUUlVOQ0FURV9UWVBFLCB0cnVuY2F0ZUNvbnRlbnQgfSBmcm9tICcuL3V0aWxzJztcbmltcG9ydCB7IHVzZUN4IH0gZnJvbSAnLi4vdXRpbHMvaG9va3MvdXNlLWN4JztcbmltcG9ydCB0eXBlIHsgVHJ1bmNhdGVQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiB1c2VUcnVuY2F0ZShcblx0cHJvcHM6IFdvcmRQcmVzc0NvbXBvbmVudFByb3BzPCBUcnVuY2F0ZVByb3BzLCAnc3BhbicgPlxu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lRydW5jYXRlLFxuXHRcdFx0c2hvdWxkVHJ1bmNhdGUgJiYgISEgbnVtYmVyT2ZMaW5lcyAmJiB0cnVuY2F0ZUxpbmVzLFxuXHRcdFx0Y2xhc3NOYW1lXG5cdFx0KTtcblx0fSwgWyBjbGFzc05hbWUsIGN4LCBudW1iZXJPZkxpbmVzLCBzaG91bGRUcnVuY2F0ZSBdICk7XG5cblx0cmV0dXJuIHsgLi4ub3RoZXJQcm9wcywgY2xhc3NOYW1lOiBjbGFzc2VzLCBjaGlsZHJlbjogdHJ1bmNhdGVkQ29udGVudCB9O1xufVxuIl19 */");
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":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Y,CAAZ,EAAeH,WAAf,IAA+BE,WAAtC;AACA;;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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,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 * 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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/form-group/form-group-content.js"],"names":["useMemo","memo","VStack","FormGroupContext","FormGroupHelp","FormGroupLabel","FormGroupContent","alignLabel","children","help","horizontal","id","label","labelHidden","spacing","truncate","props","contextProps","content"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,IAAlB,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,OAWI;AAAA,MAXuB;AAC1BC,IAAAA,UAD0B;AAE1BC,IAAAA,QAF0B;AAG1BC,IAAAA,IAH0B;AAI1BC,IAAAA,UAAU,GAAG,KAJa;AAK1BC,IAAAA,EAL0B;AAM1BC,IAAAA,KAN0B;AAO1BC,IAAAA,WAP0B;AAQ1BC,IAAAA,OAAO,GAAG,CARgB;AAS1BC,IAAAA,QAT0B;AAU1B,OAAGC;AAVuB,GAWvB;AACH,QAAMC,YAAY,GAAGjB,OAAO,CAAE,OAAQ;AAAEW,IAAAA,EAAF;AAAMD,IAAAA;AAAN,GAAR,CAAF,EAAgC,CAC3DC,EAD2D,EAE3DD,UAF2D,CAAhC,CAA5B;AAKA,QAAMQ,OAAO,GAAGT,IAAI,GACnB,cAAC,MAAD;AAAQ,IAAA,QAAQ,EAAG,KAAnB;AAA2B,IAAA,OAAO,EAAGK;AAArC,KACGN,QADH,EAEC,cAAC,aAAD,QAAiBC,IAAjB,CAFD,CADmB,GAMnBD,QAND;AASA,SACC,cAAC,gBAAD,CAAkB,QAAlB;AAA2B,IAAA,KAAK,EAAGS;AAAnC,KACC,cAAC,cAAD;AACC,IAAA,KAAK,EAAGV,UADT;AAEC,IAAA,EAAE,EAAGI,EAFN;AAGC,IAAA,WAAW,EAAGE,WAHf;AAIC,IAAA,QAAQ,EAAGE;AAJZ,KAKMC,KALN,GAOGJ,KAPH,CADD,EAUGM,OAVH,CADD;AAcA;;AAED,eAAejB,IAAI,CAAEK,gBAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, memo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { VStack } from '../../v-stack';\nimport { FormGroupContext } from './form-group-context';\nimport FormGroupHelp from './form-group-help';\nimport FormGroupLabel from './form-group-label';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').FormGroupContentProps, 'label', false>} props\n */\nfunction FormGroupContent( {\n\talignLabel,\n\tchildren,\n\thelp,\n\thorizontal = false,\n\tid,\n\tlabel,\n\tlabelHidden,\n\tspacing = 2,\n\ttruncate,\n\t...props\n} ) {\n\tconst contextProps = useMemo( () => ( { id, horizontal } ), [\n\t\tid,\n\t\thorizontal,\n\t] );\n\n\tconst content = help ? (\n\t\t<VStack expanded={ false } spacing={ spacing }>\n\t\t\t{ children }\n\t\t\t<FormGroupHelp>{ help }</FormGroupHelp>\n\t\t</VStack>\n\t) : (\n\t\tchildren\n\t);\n\n\treturn (\n\t\t<FormGroupContext.Provider value={ contextProps }>\n\t\t\t<FormGroupLabel\n\t\t\t\talign={ alignLabel }\n\t\t\t\tid={ id }\n\t\t\t\tlabelHidden={ labelHidden }\n\t\t\t\ttruncate={ truncate }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</FormGroupLabel>\n\t\t\t{ content }\n\t\t</FormGroupContext.Provider>\n\t);\n}\n\nexport default memo( FormGroupContent );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/form-group/form-group-content.js"],"names":["useMemo","memo","VStack","FormGroupContext","FormGroupHelp","FormGroupLabel","FormGroupContent","alignLabel","children","help","horizontal","id","label","labelHidden","spacing","truncate","props","contextProps","content"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,IAAlB,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,OAWI;AAAA,MAXuB;AAC1BC,IAAAA,UAD0B;AAE1BC,IAAAA,QAF0B;AAG1BC,IAAAA,IAH0B;AAI1BC,IAAAA,UAAU,GAAG,KAJa;AAK1BC,IAAAA,EAL0B;AAM1BC,IAAAA,KAN0B;AAO1BC,IAAAA,WAP0B;AAQ1BC,IAAAA,OAAO,GAAG,CARgB;AAS1BC,IAAAA,QAT0B;AAU1B,OAAGC;AAVuB,GAWvB;AACH,QAAMC,YAAY,GAAGjB,OAAO,CAC3B,OAAQ;AAAEW,IAAAA,EAAF;AAAMD,IAAAA;AAAN,GAAR,CAD2B,EAE3B,CAAEC,EAAF,EAAMD,UAAN,CAF2B,CAA5B;AAKA,QAAMQ,OAAO,GAAGT,IAAI,GACnB,cAAC,MAAD;AAAQ,IAAA,QAAQ,EAAG,KAAnB;AAA2B,IAAA,OAAO,EAAGK;AAArC,KACGN,QADH,EAEC,cAAC,aAAD,QAAiBC,IAAjB,CAFD,CADmB,GAMnBD,QAND;AASA,SACC,cAAC,gBAAD,CAAkB,QAAlB;AAA2B,IAAA,KAAK,EAAGS;AAAnC,KACC,cAAC,cAAD;AACC,IAAA,KAAK,EAAGV,UADT;AAEC,IAAA,EAAE,EAAGI,EAFN;AAGC,IAAA,WAAW,EAAGE,WAHf;AAIC,IAAA,QAAQ,EAAGE;AAJZ,KAKMC,KALN,GAOGJ,KAPH,CADD,EAUGM,OAVH,CADD;AAcA;;AAED,eAAejB,IAAI,CAAEK,gBAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, memo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { VStack } from '../../v-stack';\nimport { FormGroupContext } from './form-group-context';\nimport FormGroupHelp from './form-group-help';\nimport FormGroupLabel from './form-group-label';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').FormGroupContentProps, 'label', false>} props\n */\nfunction FormGroupContent( {\n\talignLabel,\n\tchildren,\n\thelp,\n\thorizontal = false,\n\tid,\n\tlabel,\n\tlabelHidden,\n\tspacing = 2,\n\ttruncate,\n\t...props\n} ) {\n\tconst contextProps = useMemo(\n\t\t() => ( { id, horizontal } ),\n\t\t[ id, horizontal ]\n\t);\n\n\tconst content = help ? (\n\t\t<VStack expanded={ false } spacing={ spacing }>\n\t\t\t{ children }\n\t\t\t<FormGroupHelp>{ help }</FormGroupHelp>\n\t\t</VStack>\n\t) : (\n\t\tchildren\n\t);\n\n\treturn (\n\t\t<FormGroupContext.Provider value={ contextProps }>\n\t\t\t<FormGroupLabel\n\t\t\t\talign={ alignLabel }\n\t\t\t\tid={ id }\n\t\t\t\tlabelHidden={ labelHidden }\n\t\t\t\ttruncate={ truncate }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</FormGroupLabel>\n\t\t\t{ content }\n\t\t</FormGroupContext.Provider>\n\t);\n}\n\nexport default memo( FormGroupContent );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["omit","classnames","deprecated","forwardRef","useMemo","useRef","useEffect","__","inputControlActionTypes","Root","ValueInput","UnitSelectControl","CSS_UNITS","getParsedQuantityAndUnit","getUnitsWithCurrentUnit","getValidParsedQuantityAndUnit","useControlledState","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","stateReducerProp","autoComplete","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","style","unit","unitProp","units","unitsProp","value","valueProp","onBlur","onBlurProp","props","since","hint","version","nonNullValueProp","undefined","parsedQuantity","parsedUnit","setUnit","length","initial","fallback","refParsedQuantity","classes","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","mayUpdateUnit","event","isNaN","Number","currentTarget","current","validParsedQuantity","validParsedUnit","Array","isArray","find","option","handleOnBlur","handleOnKeyDown","key","unitControlStateReducer","state","action","nextState","type","COMMIT","toString","stateReducer","baseState","inputSuffix","step","activeUnit","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits"],"mappings":";;;AAAA;AACA;AACA;AASA,SAASA,IAAT,QAAqB,QAArB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AAC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;AAAkD,IAAA,KAAK,EAAG1D;AAA1D,KACC,cAAC,UAAD;AACC,kBAAaL,KADd;AAEC,IAAA,IAAI,EAAGH,oBAAoB,GAAG,MAAH,GAAY;AAFxC,KAGM1B,IAAI,CAAE2C,KAAF,EAAS,CAAE,UAAF,CAAT,CAHV;AAIC,IAAA,YAAY,EAAGrB,YAJhB;AAKC,IAAA,SAAS,EAAGkC,OALb;AAMC,IAAA,QAAQ,EAAGhC,QANZ;AAOC,IAAA,YAAY,EAAGC,YAPhB;AAQC,IAAA,oBAAoB,EAAGC,oBARxB;AASC,IAAA,KAAK,EAAGG,KATT;AAUC,IAAA,MAAM,EAAGkD,YAVV;AAWC,IAAA,SAAS,EAAGC,eAXb;AAYC,IAAA,QAAQ,EAAGvB,sBAZZ;AAaC,IAAA,GAAG,EAAGtC,YAbP;AAcC,IAAA,IAAI,EAAGc,IAdR;AAeC,IAAA,MAAM,EAAG0D,WAfV;AAgBC,IAAA,KAAK,EAAG1C,cAAH,aAAGA,cAAH,cAAGA,cAAH,GAAqB,EAhB3B;AAiBC,IAAA,IAAI,EAAG2C,IAjBR;AAkBC,IAAA,sBAAsB,EAAGH;AAlB1B,KADD,CADD;AAwBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMK,WAAW,GAAG3F,UAAU,CAAEc,sBAAF,CAA9B;AAEP,SAAS8E,gCAAT,EAA2CC,cAA3C,QAAiE,SAAjE;AACA,eAAeF,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tKeyboardEvent,\n\tForwardedRef,\n\tSyntheticEvent,\n\tChangeEvent,\n\tPointerEvent,\n} from 'react';\nimport { omit } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { Root, ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport type { StateReducer } from '../input-control/reducer/state';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tautoComplete = 'off',\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tstyle,\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonBlur: onBlurProp,\n\t\t...props\n\t} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst units = useMemo(\n\t\t() => getUnitsWithCurrentUnit( nonNullValueProp, unitProp, unitsProp ),\n\t\t[ nonNullValueProp, unitProp, unitsProp ]\n\t);\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit ] );\n\n\t// Stores parsed value for hand-off in state reducer.\n\tconst refParsedQuantity = useRef< number | undefined >( undefined );\n\n\tconst classes = classnames( 'components-unit-control', className );\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent:\n\t\t\t\t| ChangeEvent< HTMLInputElement >\n\t\t\t\t| PointerEvent< HTMLInputElement >;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tconst mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tif ( ! isNaN( Number( event.currentTarget.value ) ) ) {\n\t\t\trefParsedQuantity.current = undefined;\n\t\t\treturn;\n\t\t}\n\t\tconst [\n\t\t\tvalidParsedQuantity,\n\t\t\tvalidParsedUnit,\n\t\t] = getValidParsedQuantityAndUnit(\n\t\t\tevent.currentTarget.value,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t);\n\n\t\trefParsedQuantity.current = validParsedQuantity;\n\n\t\tif ( isPressEnterToChange && validParsedUnit !== unit ) {\n\t\t\tconst data = Array.isArray( units )\n\t\t\t\t? units.find( ( option ) => option.value === validParsedUnit )\n\t\t\t\t: undefined;\n\t\t\tconst changeProps = { event, data };\n\n\t\t\t// The `onChange` callback already gets called, no need to call it explicitely.\n\t\t\tonUnitChange?.( validParsedUnit, changeProps );\n\n\t\t\tsetUnit( validParsedUnit );\n\t\t}\n\t};\n\n\tconst handleOnBlur: FocusEventHandler< HTMLInputElement > = ( event ) => {\n\t\tmayUpdateUnit( event );\n\t\tonBlurProp?.( event );\n\t};\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { key } = event;\n\t\tif ( key === 'Enter' ) {\n\t\t\tmayUpdateUnit( event );\n\t\t}\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @param state State from InputControl\n\t * @param action Action triggering state change\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst unitControlStateReducer: StateReducer = ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\t/*\n\t\t * On commits (when pressing ENTER and on blur if\n\t\t * isPressEnterToChange is true), if a parse has been performed\n\t\t * then use that result to update the state.\n\t\t */\n\t\tif ( action.type === inputControlActionTypes.COMMIT ) {\n\t\t\tif ( refParsedQuantity.current !== undefined ) {\n\t\t\t\tnextState.value = (\n\t\t\t\t\trefParsedQuantity.current ?? ''\n\t\t\t\t).toString();\n\t\t\t\trefParsedQuantity.current = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn nextState;\n\t};\n\n\tlet stateReducer: StateReducer = unitControlStateReducer;\n\tif ( stateReducerProp ) {\n\t\tstateReducer = ( state, action ) => {\n\t\t\tconst baseState = unitControlStateReducer( state, action );\n\t\t\treturn stateReducerProp( baseState, action );\n\t\t};\n\t}\n\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonBlur={ onBlurProp }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<Root className=\"components-unit-control-wrapper\" style={ style }>\n\t\t\t<ValueInput\n\t\t\t\taria-label={ label }\n\t\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\t\t{ ...omit( props, [ 'children' ] ) }\n\t\t\t\tautoComplete={ autoComplete }\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\tlabel={ label }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\t\tonChange={ handleOnQuantityChange }\n\t\t\t\tref={ forwardedRef }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={ inputSuffix }\n\t\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\t\tstep={ step }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t/>\n\t\t</Root>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["omit","classnames","deprecated","forwardRef","useMemo","useRef","useEffect","__","inputControlActionTypes","Root","ValueInput","UnitSelectControl","CSS_UNITS","getParsedQuantityAndUnit","getUnitsWithCurrentUnit","getValidParsedQuantityAndUnit","useControlledState","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","stateReducerProp","autoComplete","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","style","unit","unitProp","units","unitsProp","value","valueProp","onBlur","onBlurProp","props","since","hint","version","nonNullValueProp","undefined","parsedQuantity","parsedUnit","setUnit","length","initial","fallback","refParsedQuantity","classes","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","mayUpdateUnit","event","isNaN","Number","currentTarget","current","validParsedQuantity","validParsedUnit","Array","isArray","find","option","handleOnBlur","handleOnKeyDown","key","unitControlStateReducer","state","action","nextState","type","COMMIT","toString","stateReducer","baseState","inputSuffix","step","activeUnit","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits"],"m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,UAAH,uBAAGA,UAAU,CAAED,IAAf,+DAAuB,CAA3B;AACA;;AAED,SACC,cAAC,IAAD;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,KAAK,EAAG1D;AAA1D,KACC,cAAC,UAAD;AACC,kBAAaL,KADd;AAEC,IAAA,IAAI,EAAGH,oBAAoB,GAAG,MAAH,GAAY;AAFxC,KAGM1B,IAAI,CAAE2C,KAAF,EAAS,CAAE,UAAF,CAAT,CAHV;AAIC,IAAA,YAAY,EAAGrB,YAJhB;AAKC,IAAA,SAAS,EAAGkC,OALb;AAMC,IAAA,QAAQ,EAAGhC,QANZ;AAOC,IAAA,YAAY,EAAGC,YAPhB;AAQC,IAAA,oBAAoB,EAAGC,oBARxB;AASC,IAAA,KAAK,EAAGG,KATT;AAUC,IAAA,MAAM,EAAGkD,YAVV;AAWC,IAAA,SAAS,EAAGC,eAXb;AAYC,IAAA,QAAQ,EAAGvB,sBAZZ;AAaC,IAAA,GAAG,EAAGtC,YAbP;AAcC,IAAA,IAAI,EAAGc,IAdR;AAeC,IAAA,MAAM,EAAG0D,WAfV;AAgBC,IAAA,KAAK,EAAG1C,cAAH,aAAGA,cAAH,cAAGA,cAAH,GAAqB,EAhB3B;AAiBC,IAAA,IAAI,EAAG2C,IAjBR;AAkBC,IAAA,sBAAsB,EAAGH;AAlB1B,KADD,CADD;AAwBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMK,WAAW,GAAG3F,UAAU,CAAEc,sBAAF,CAA9B;AAEP,SAAS8E,gCAAT,EAA2CC,cAA3C,QAAiE,SAAjE;AACA,eAAeF,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tKeyboardEvent,\n\tForwardedRef,\n\tSyntheticEvent,\n\tChangeEvent,\n\tPointerEvent,\n} from 'react';\nimport { omit } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { Root, ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport type { StateReducer } from '../input-control/reducer/state';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tautoComplete = 'off',\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tstyle,\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonBlur: onBlurProp,\n\t\t...props\n\t} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst units = useMemo(\n\t\t() => getUnitsWithCurrentUnit( nonNullValueProp, unitProp, unitsProp ),\n\t\t[ nonNullValueProp, unitProp, unitsProp ]\n\t);\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit ] );\n\n\t// Stores parsed value for hand-off in state reducer.\n\tconst refParsedQuantity = useRef< number | undefined >( undefined );\n\n\tconst classes = classnames( 'components-unit-control', className );\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent:\n\t\t\t\t| ChangeEvent< HTMLInputElement >\n\t\t\t\t| PointerEvent< HTMLInputElement >;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tconst mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tif ( ! isNaN( Number( event.currentTarget.value ) ) ) {\n\t\t\trefParsedQuantity.current = undefined;\n\t\t\treturn;\n\t\t}\n\t\tconst [ validParsedQuantity, validParsedUnit ] =\n\t\t\tgetValidParsedQuantityAndUnit(\n\t\t\t\tevent.currentTarget.value,\n\t\t\t\tunits,\n\t\t\t\tparsedQuantity,\n\t\t\t\tunit\n\t\t\t);\n\n\t\trefParsedQuantity.current = validParsedQuantity;\n\n\t\tif ( isPressEnterToChange && validParsedUnit !== unit ) {\n\t\t\tconst data = Array.isArray( units )\n\t\t\t\t? units.find( ( option ) => option.value === validParsedUnit )\n\t\t\t\t: undefined;\n\t\t\tconst changeProps = { event, data };\n\n\t\t\t// The `onChange` callback already gets called, no need to call it explicitely.\n\t\t\tonUnitChange?.( validParsedUnit, changeProps );\n\n\t\t\tsetUnit( validParsedUnit );\n\t\t}\n\t};\n\n\tconst handleOnBlur: FocusEventHandler< HTMLInputElement > = ( event ) => {\n\t\tmayUpdateUnit( event );\n\t\tonBlurProp?.( event );\n\t};\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { key } = event;\n\t\tif ( key === 'Enter' ) {\n\t\t\tmayUpdateUnit( event );\n\t\t}\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @param state State from InputControl\n\t * @param action Action triggering state change\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst unitControlStateReducer: StateReducer = ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\t/*\n\t\t * On commits (when pressing ENTER and on blur if\n\t\t * isPressEnterToChange is true), if a parse has been performed\n\t\t * then use that result to update the state.\n\t\t */\n\t\tif ( action.type === inputControlActionTypes.COMMIT ) {\n\t\t\tif ( refParsedQuantity.current !== undefined ) {\n\t\t\t\tnextState.value = (\n\t\t\t\t\trefParsedQuantity.current ?? ''\n\t\t\t\t).toString();\n\t\t\t\trefParsedQuantity.current = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn nextState;\n\t};\n\n\tlet stateReducer: StateReducer = unitControlStateReducer;\n\tif ( stateReducerProp ) {\n\t\tstateReducer = ( state, action ) => {\n\t\t\tconst baseState = unitControlStateReducer( state, action );\n\t\t\treturn stateReducerProp( baseState, action );\n\t\t};\n\t}\n\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonBlur={ onBlurProp }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<Root className=\"components-unit-control-wrapper\" style={ style }>\n\t\t\t<ValueInput\n\t\t\t\taria-label={ label }\n\t\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\t\t{ ...omit( props, [ 'children' ] ) }\n\t\t\t\tautoComplete={ autoComplete }\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\tlabel={ label }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\t\tonChange={ handleOnQuantityChange }\n\t\t\t\tref={ forwardedRef }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={ inputSuffix }\n\t\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\t\tstep={ step }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t/>\n\t\t</Root>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"]}
@@ -1,6 +1,5 @@
1
1
  export { default as useControlledState } from './use-controlled-state';
2
2
  export { default as useUpdateEffect } from './use-update-effect';
3
- export { useCombinedRef } from './use-combined-ref';
4
3
  export { useControlledValue } from './use-controlled-value';
5
4
  export { useCx } from './use-cx';
6
5
  export { useLatestRef } from './use-latest-ref';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/hooks/index.js"],"names":["default","useControlledState","useUpdateEffect","useCombinedRef","useControlledValue","useCx","useLatestRef"],"mappings":"AAAA,SAASA,OAAO,IAAIC,kBAApB,QAA8C,wBAA9C;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,qBAA3C;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,kBAAT,QAAmC,wBAAnC;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,YAAT,QAA6B,kBAA7B","sourcesContent":["export { default as useControlledState } from './use-controlled-state';\nexport { default as useUpdateEffect } from './use-update-effect';\nexport { useCombinedRef } from './use-combined-ref';\nexport { useControlledValue } from './use-controlled-value';\nexport { useCx } from './use-cx';\nexport { useLatestRef } from './use-latest-ref';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/hooks/index.js"],"names":["default","useControlledState","useUpdateEffect","useControlledValue","useCx","useLatestRef"],"mappings":"AAAA,SAASA,OAAO,IAAIC,kBAApB,QAA8C,wBAA9C;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,qBAA3C;AACA,SAASC,kBAAT,QAAmC,wBAAnC;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,YAAT,QAA6B,kBAA7B","sourcesContent":["export { default as useControlledState } from './use-controlled-state';\nexport { default as useUpdateEffect } from './use-update-effect';\nexport { useControlledValue } from './use-controlled-value';\nexport { useCx } from './use-cx';\nexport { useLatestRef } from './use-latest-ref';\n"]}
@@ -1,7 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { clamp } from 'lodash';
5
1
  /**
6
2
  * Parses and retrieves a number value.
7
3
  *
@@ -9,7 +5,6 @@ import { clamp } from 'lodash';
9
5
  *
10
6
  * @return {number} The parsed number value.
11
7
  */
12
-
13
8
  export function getNumber(value) {
14
9
  const number = Number(value);
15
10
  return isNaN(number) ? 0 : number;
@@ -63,6 +58,21 @@ function getPrecision(value) {
63
58
  const split = (value + '').split('.');
64
59
  return split[1] !== undefined ? split[1].length : 0;
65
60
  }
61
+ /**
62
+ * Clamps a value based on a min/max range.
63
+ *
64
+ * @param {number} value The value.
65
+ * @param {number} min The minimum range.
66
+ * @param {number} max The maximum range.
67
+ *
68
+ * @return {number} The clamped value.
69
+ */
70
+
71
+
72
+ export function clamp(value, min, max) {
73
+ const baseValue = getNumber(value);
74
+ return Math.max(min, Math.min(baseValue, max));
75
+ }
66
76
  /**
67
77
  * Clamps a value based on a min/max range with rounding
68
78
  *
@@ -74,7 +84,6 @@ function getPrecision(value) {
74
84
  * @return {number} The rounded and clamped value.
75
85
  */
76
86
 
77
-
78
87
  export function roundClamp() {
79
88
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
80
89
  let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/math.js"],"names":["clamp","getNumber","value","number","Number","isNaN","add","args","reduce","sum","arg","subtract","diff","index","getPrecision","split","undefined","length","roundClamp","min","Infinity","max","step","baseValue","stepValue","precision","rounded","Math","round","clampedValue","toFixed","roundClampString","toString"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBC,KAApB,EAA4B;AAClC,QAAMC,MAAM,GAAGC,MAAM,CAAEF,KAAF,CAArB;AAEA,SAAOG,KAAK,CAAEF,MAAF,CAAL,GAAkB,CAAlB,GAAsBA,MAA7B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,GAAT,GAAwB;AAAA,oCAAPC,IAAO;AAAPA,IAAAA,IAAO;AAAA;;AAC9B,SAAOA,IAAI,CAACC,MAAL;AACN;AACA,GAAEC,GAAF,EAAOC,GAAP,KAAgBD,GAAG,GAAGR,SAAS,CAAES,GAAF,CAFzB,EAGN,CAHM,CAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,QAAT,GAA6B;AAAA,qCAAPJ,IAAO;AAAPA,IAAAA,IAAO;AAAA;;AACnC,SAAOA,IAAI,CAACC,MAAL;AACN;AACA,GAAEI,IAAF,EAAQF,GAAR,EAAaG,KAAb,KAAwB;AACvB,UAAMX,KAAK,GAAGD,SAAS,CAAES,GAAF,CAAvB;AACA,WAAOG,KAAK,KAAK,CAAV,GAAcX,KAAd,GAAsBU,IAAI,GAAGV,KAApC;AACA,GALK,EAMN,CANM,CAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASY,YAAT,CAAuBZ,KAAvB,EAA+B;AAC9B,QAAMa,KAAK,GAAG,CAAEb,KAAK,GAAG,EAAV,EAAea,KAAf,CAAsB,GAAtB,CAAd;AACA,SAAOA,KAAK,CAAE,CAAF,CAAL,KAAeC,SAAf,GAA2BD,KAAK,CAAE,CAAF,CAAL,CAAWE,MAAtC,GAA+C,CAAtD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,UAAT,GAKL;AAAA,MAJDhB,KAIC,uEAJO,CAIP;AAAA,MAHDiB,GAGC,uEAHKC,QAGL;AAAA,MAFDC,GAEC,uEAFKD,QAEL;AAAA,MADDE,IACC,uEADM,CACN;AACD,QAAMC,SAAS,GAAGtB,SAAS,CAAEC,KAAF,CAA3B;AACA,QAAMsB,SAAS,GAAGvB,SAAS,CAAEqB,IAAF,CAA3B;AACA,QAAMG,SAAS,GAAGX,YAAY,CAAEQ,IAAF,CAA9B;AACA,QAAMI,OAAO,GAAGC,IAAI,CAACC,KAAL,CAAYL,SAAS,GAAGC,SAAxB,IAAsCA,SAAtD;AACA,QAAMK,YAAY,GAAG7B,KAAK,CAAE0B,OAAF,EAAWP,GAAX,EAAgBE,GAAhB,CAA1B;AAEA,SAAOI,SAAS,GACbxB,SAAS,CAAE4B,YAAY,CAACC,OAAb,CAAsBL,SAAtB,CAAF,CADI,GAEbI,YAFH;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,gBAAT,GAAqC;AAC3C,SAAOb,UAAU,CAAE,YAAF,CAAV,CAAsBc,QAAtB,EAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { clamp } from 'lodash';\n\n/**\n * Parses and retrieves a number value.\n *\n * @param {unknown} value The incoming value.\n *\n * @return {number} The parsed number value.\n */\nexport function getNumber( value ) {\n\tconst number = Number( value );\n\n\treturn isNaN( number ) ? 0 : number;\n}\n\n/**\n * Safely adds 2 values.\n *\n * @param {Array<number|string>} args Values to add together.\n *\n * @return {number} The sum of values.\n */\nexport function add( ...args ) {\n\treturn args.reduce(\n\t\t/** @type {(sum:number, arg: number|string) => number} */\n\t\t( sum, arg ) => sum + getNumber( arg ),\n\t\t0\n\t);\n}\n\n/**\n * Safely subtracts 2 values.\n *\n * @param {Array<number|string>} args Values to subtract together.\n *\n * @return {number} The difference of the values.\n */\nexport function subtract( ...args ) {\n\treturn args.reduce(\n\t\t/** @type {(diff:number, arg: number|string, index:number) => number} */\n\t\t( diff, arg, index ) => {\n\t\t\tconst value = getNumber( arg );\n\t\t\treturn index === 0 ? value : diff - value;\n\t\t},\n\t\t0\n\t);\n}\n\n/**\n * Determines the decimal position of a number value.\n *\n * @param {number} value The number to evaluate.\n *\n * @return {number} The number of decimal places.\n */\nfunction getPrecision( value ) {\n\tconst split = ( value + '' ).split( '.' );\n\treturn split[ 1 ] !== undefined ? split[ 1 ].length : 0;\n}\n\n/**\n * Clamps a value based on a min/max range with rounding\n *\n * @param {number} value The value.\n * @param {number} min The minimum range.\n * @param {number} max The maximum range.\n * @param {number} step A multiplier for the value.\n *\n * @return {number} The rounded and clamped value.\n */\nexport function roundClamp(\n\tvalue = 0,\n\tmin = Infinity,\n\tmax = Infinity,\n\tstep = 1\n) {\n\tconst baseValue = getNumber( value );\n\tconst stepValue = getNumber( step );\n\tconst precision = getPrecision( step );\n\tconst rounded = Math.round( baseValue / stepValue ) * stepValue;\n\tconst clampedValue = clamp( rounded, min, max );\n\n\treturn precision\n\t\t? getNumber( clampedValue.toFixed( precision ) )\n\t\t: clampedValue;\n}\n\n/**\n * Clamps a value based on a min/max range with rounding.\n * Returns a string.\n *\n * @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().\n * @return {string} The rounded and clamped value.\n */\nexport function roundClampString( ...args ) {\n\treturn roundClamp( ...args ).toString();\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/math.js"],"names":["getNumber","value","number","Number","isNaN","add","args","reduce","sum","arg","subtract","diff","index","getPrecision","split","undefined","length","clamp","min","max","baseValue","Math","roundClamp","Infinity","step","stepValue","precision","rounded","round","clampedValue","toFixed","roundClampString","toString"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAAT,CAAoBC,KAApB,EAA4B;AAClC,QAAMC,MAAM,GAAGC,MAAM,CAAEF,KAAF,CAArB;AAEA,SAAOG,KAAK,CAAEF,MAAF,CAAL,GAAkB,CAAlB,GAAsBA,MAA7B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,GAAT,GAAwB;AAAA,oCAAPC,IAAO;AAAPA,IAAAA,IAAO;AAAA;;AAC9B,SAAOA,IAAI,CAACC,MAAL;AACN;AACA,GAAEC,GAAF,EAAOC,GAAP,KAAgBD,GAAG,GAAGR,SAAS,CAAES,GAAF,CAFzB,EAGN,CAHM,CAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,QAAT,GAA6B;AAAA,qCAAPJ,IAAO;AAAPA,IAAAA,IAAO;AAAA;;AACnC,SAAOA,IAAI,CAACC,MAAL;AACN;AACA,GAAEI,IAAF,EAAQF,GAAR,EAAaG,KAAb,KAAwB;AACvB,UAAMX,KAAK,GAAGD,SAAS,CAAES,GAAF,CAAvB;AACA,WAAOG,KAAK,KAAK,CAAV,GAAcX,KAAd,GAAsBU,IAAI,GAAGV,KAApC;AACA,GALK,EAMN,CANM,CAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASY,YAAT,CAAuBZ,KAAvB,EAA+B;AAC9B,QAAMa,KAAK,GAAG,CAAEb,KAAK,GAAG,EAAV,EAAea,KAAf,CAAsB,GAAtB,CAAd;AACA,SAAOA,KAAK,CAAE,CAAF,CAAL,KAAeC,SAAf,GAA2BD,KAAK,CAAE,CAAF,CAAL,CAAWE,MAAtC,GAA+C,CAAtD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,KAAT,CAAgBhB,KAAhB,EAAuBiB,GAAvB,EAA4BC,GAA5B,EAAkC;AACxC,QAAMC,SAAS,GAAGpB,SAAS,CAAEC,KAAF,CAA3B;AACA,SAAOoB,IAAI,CAACF,GAAL,CAAUD,GAAV,EAAeG,IAAI,CAACH,GAAL,CAAUE,SAAV,EAAqBD,GAArB,CAAf,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,UAAT,GAKL;AAAA,MAJDrB,KAIC,uEAJO,CAIP;AAAA,MAHDiB,GAGC,uEAHKK,QAGL;AAAA,MAFDJ,GAEC,uEAFKI,QAEL;AAAA,MADDC,IACC,uEADM,CACN;AACD,QAAMJ,SAAS,GAAGpB,SAAS,CAAEC,KAAF,CAA3B;AACA,QAAMwB,SAAS,GAAGzB,SAAS,CAAEwB,IAAF,CAA3B;AACA,QAAME,SAAS,GAAGb,YAAY,CAAEW,IAAF,CAA9B;AACA,QAAMG,OAAO,GAAGN,IAAI,CAACO,KAAL,CAAYR,SAAS,GAAGK,SAAxB,IAAsCA,SAAtD;AACA,QAAMI,YAAY,GAAGZ,KAAK,CAAEU,OAAF,EAAWT,GAAX,EAAgBC,GAAhB,CAA1B;AAEA,SAAOO,SAAS,GACb1B,SAAS,CAAE6B,YAAY,CAACC,OAAb,CAAsBJ,SAAtB,CAAF,CADI,GAEbG,YAFH;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,gBAAT,GAAqC;AAC3C,SAAOT,UAAU,CAAE,YAAF,CAAV,CAAsBU,QAAtB,EAAP;AACA","sourcesContent":["/**\n * Parses and retrieves a number value.\n *\n * @param {unknown} value The incoming value.\n *\n * @return {number} The parsed number value.\n */\nexport function getNumber( value ) {\n\tconst number = Number( value );\n\n\treturn isNaN( number ) ? 0 : number;\n}\n\n/**\n * Safely adds 2 values.\n *\n * @param {Array<number|string>} args Values to add together.\n *\n * @return {number} The sum of values.\n */\nexport function add( ...args ) {\n\treturn args.reduce(\n\t\t/** @type {(sum:number, arg: number|string) => number} */\n\t\t( sum, arg ) => sum + getNumber( arg ),\n\t\t0\n\t);\n}\n\n/**\n * Safely subtracts 2 values.\n *\n * @param {Array<number|string>} args Values to subtract together.\n *\n * @return {number} The difference of the values.\n */\nexport function subtract( ...args ) {\n\treturn args.reduce(\n\t\t/** @type {(diff:number, arg: number|string, index:number) => number} */\n\t\t( diff, arg, index ) => {\n\t\t\tconst value = getNumber( arg );\n\t\t\treturn index === 0 ? value : diff - value;\n\t\t},\n\t\t0\n\t);\n}\n\n/**\n * Determines the decimal position of a number value.\n *\n * @param {number} value The number to evaluate.\n *\n * @return {number} The number of decimal places.\n */\nfunction getPrecision( value ) {\n\tconst split = ( value + '' ).split( '.' );\n\treturn split[ 1 ] !== undefined ? split[ 1 ].length : 0;\n}\n\n/**\n * Clamps a value based on a min/max range.\n *\n * @param {number} value The value.\n * @param {number} min The minimum range.\n * @param {number} max The maximum range.\n *\n * @return {number} The clamped value.\n */\nexport function clamp( value, min, max ) {\n\tconst baseValue = getNumber( value );\n\treturn Math.max( min, Math.min( baseValue, max ) );\n}\n\n/**\n * Clamps a value based on a min/max range with rounding\n *\n * @param {number} value The value.\n * @param {number} min The minimum range.\n * @param {number} max The maximum range.\n * @param {number} step A multiplier for the value.\n *\n * @return {number} The rounded and clamped value.\n */\nexport function roundClamp(\n\tvalue = 0,\n\tmin = Infinity,\n\tmax = Infinity,\n\tstep = 1\n) {\n\tconst baseValue = getNumber( value );\n\tconst stepValue = getNumber( step );\n\tconst precision = getPrecision( step );\n\tconst rounded = Math.round( baseValue / stepValue ) * stepValue;\n\tconst clampedValue = clamp( rounded, min, max );\n\n\treturn precision\n\t\t? getNumber( clampedValue.toFixed( precision ) )\n\t\t: clampedValue;\n}\n\n/**\n * Clamps a value based on a min/max range with rounding.\n * Returns a string.\n *\n * @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().\n * @return {string} The rounded and clamped value.\n */\nexport function roundClampString( ...args ) {\n\treturn roundClamp( ...args ).toString();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/unit-values.ts"],"names":["UNITED_VALUE_REGEX","parseCSSUnitValue","toParse","value","trim","matched","match","undefined","num","unit","numParsed","parseFloat","Number","isNaN","createCSSUnitValue"],"mappings":"AAAA,MAAMA,kBAAkB,GAAG,0IAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CACNC,OADM,EAEuC;AAC7C,QAAMC,KAAK,GAAGD,OAAO,CAACE,IAAR,EAAd;AAEA,QAAMC,OAAO,GAAGF,KAAK,CAACG,KAAN,CAAaN,kBAAb,CAAhB;;AACA,MAAK,CAAEK,OAAP,EAAiB;AAChB,WAAO,CAAEE,SAAF,EAAaA,SAAb,CAAP;AACA;;AACD,QAAM,GAAIC,GAAJ,EAASC,IAAT,IAAkBJ,OAAxB;AACA,MAAIK,SAA6B,GAAGC,UAAU,CAAEH,GAAF,CAA9C;AACAE,EAAAA,SAAS,GAAGE,MAAM,CAACC,KAAP,CAAcH,SAAd,IAA4BH,SAA5B,GAAwCG,SAApD;AAEA,SAAO,CAAEA,SAAF,EAAaD,IAAb,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,kBAAT,CACNX,KADM,EAENM,IAFM,EAGG;AACT,SAAQ,GAAGN,KAAO,GAAGM,IAAM,EAA3B;AACA","sourcesContent":["const UNITED_VALUE_REGEX = /^([\\d.\\-+]*)\\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%|cap|ic|rlh|vi|vb|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?$/;\n\n/**\n * Parses a number and unit from a value.\n *\n * @param toParse Value to parse\n *\n * @return The extracted number and unit.\n */\nexport function parseCSSUnitValue(\n\ttoParse: string\n): [ number | undefined, string | undefined ] {\n\tconst value = toParse.trim();\n\n\tconst matched = value.match( UNITED_VALUE_REGEX );\n\tif ( ! matched ) {\n\t\treturn [ undefined, undefined ];\n\t}\n\tconst [ , num, unit ] = matched;\n\tlet numParsed: number | undefined = parseFloat( num );\n\tnumParsed = Number.isNaN( numParsed ) ? undefined : numParsed;\n\n\treturn [ numParsed, unit ];\n}\n\n/**\n * Combines a value and a unit into a unit value.\n *\n * @param value\n * @param unit\n *\n * @return The unit value.\n */\nexport function createCSSUnitValue(\n\tvalue: string | number,\n\tunit: string\n): string {\n\treturn `${ value }${ unit }`;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/unit-values.ts"],"names":["UNITED_VALUE_REGEX","parseCSSUnitValue","toParse","value","trim","matched","match","undefined","num","unit","numParsed","parseFloat","Number","isNaN","createCSSUnitValue"],"mappings":"AAAA,MAAMA,kBAAkB,GACvB,0IADD;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CACNC,OADM,EAEuC;AAC7C,QAAMC,KAAK,GAAGD,OAAO,CAACE,IAAR,EAAd;AAEA,QAAMC,OAAO,GAAGF,KAAK,CAACG,KAAN,CAAaN,kBAAb,CAAhB;;AACA,MAAK,CAAEK,OAAP,EAAiB;AAChB,WAAO,CAAEE,SAAF,EAAaA,SAAb,CAAP;AACA;;AACD,QAAM,GAAIC,GAAJ,EAASC,IAAT,IAAkBJ,OAAxB;AACA,MAAIK,SAA6B,GAAGC,UAAU,CAAEH,GAAF,CAA9C;AACAE,EAAAA,SAAS,GAAGE,MAAM,CAACC,KAAP,CAAcH,SAAd,IAA4BH,SAA5B,GAAwCG,SAApD;AAEA,SAAO,CAAEA,SAAF,EAAaD,IAAb,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,kBAAT,CACNX,KADM,EAENM,IAFM,EAGG;AACT,SAAQ,GAAGN,KAAO,GAAGM,IAAM,EAA3B;AACA","sourcesContent":["const UNITED_VALUE_REGEX =\n\t/^([\\d.\\-+]*)\\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%|cap|ic|rlh|vi|vb|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?$/;\n\n/**\n * Parses a number and unit from a value.\n *\n * @param toParse Value to parse\n *\n * @return The extracted number and unit.\n */\nexport function parseCSSUnitValue(\n\ttoParse: string\n): [ number | undefined, string | undefined ] {\n\tconst value = toParse.trim();\n\n\tconst matched = value.match( UNITED_VALUE_REGEX );\n\tif ( ! matched ) {\n\t\treturn [ undefined, undefined ];\n\t}\n\tconst [ , num, unit ] = matched;\n\tlet numParsed: number | undefined = parseFloat( num );\n\tnumParsed = Number.isNaN( numParsed ) ? undefined : numParsed;\n\n\treturn [ numParsed, unit ];\n}\n\n/**\n * Combines a value and a unit into a unit value.\n *\n * @param value\n * @param unit\n *\n * @return The unit value.\n */\nexport function createCSSUnitValue(\n\tvalue: string | number,\n\tunit: string\n): string {\n\treturn `${ value }${ unit }`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/values.js"],"names":["isValueDefined","value","undefined","isValueEmpty","isEmptyString","getDefinedValue","values","fallbackValue","find","getDelimiterAndDecimalRegex","locale","formatted","Intl","NumberFormat","format","delimiter","decimal","length","RegExp","INTERNATIONAL_THOUSANDS_DELIMITER","ARABIC_NUMERAL_LOCALES","EASTERN_ARABIC_NUMBERS","isValueNumeric","window","navigator","language","some","l","startsWith","test","replace","d","indexOf","delimiterRegexp","decimalRegexp","valueToCheck","isNaN","parseFloat","isFinite"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AACvC,SAAOA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAAxC;AACA;AACD;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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kB,UAAP,CAAmBD,CAAnB,CAAtC,CAAL,EAAsE;AACrEjB,IAAAA,MAAM,GAAG,OAAT;;AACA,QAAKW,sBAAsB,CAACQ,IAAvB,CAA6B5B,KAA7B,CAAL,EAA4C;AAC3CA,MAAAA,KAAK,GAAGA,KAAK,CACX6B,OADM,CACG,QADH,EACa;AAAE;AAAsBC,MAAAA,CAAxB,KACnB,aAAaC,OAAb,CAAsBD,CAAtB,CAFM,EAIND,OAJM,CAIG,QAJH,EAIa;AAAE;AAAsBC,MAAAA,CAAxB,KACnB,aAAaC,OAAb,CAAsBD,CAAtB,CALM,EAOND,OAPM,CAOG,IAPH,EAOS,GAPT,EAQNA,OARM,CAQG,IARH,EAQS,GART,CAAR;AASA;AACD;;AAED,QAAM,CAAEG,eAAF,EAAmBC,aAAnB,IAAqCzB,2BAA2B,CACrEC,MADqE,CAAtE;AAGA,QAAMyB,YAAY,GACjB,OAAOlC,KAAP,KAAiB,QAAjB,GACGA,KAAK,CACJ6B,OADD,CACUG,eADV,EAC2B,EAD3B,EAECH,OAFD,CAEUI,aAFV,EAEyB,GAFzB,EAGCJ,OAHD,CAGUX,iCAHV,EAG6C,EAH7C,CADH,GAKGlB,KANJ;AAOA,SAAO,CAAEmC,KAAK,CAAEC,UAAU,CAAEF,YAAF,CAAZ,CAAP,IAAyCG,QAAQ,CAAEH,YAAF,CAAxD;AACA","sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * Determines if a value is null or undefined.\n *\n * @template T\n *\n * @param {T | null | undefined} value The value to check.\n * @return {value is T} Whether value is not null or undefined.\n */\nexport function isValueDefined( value ) {\n\treturn value !== undefined && value !== null;\n}\n/* eslint-enable jsdoc/valid-types */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Determines if a value is empty, null, or undefined.\n *\n * @template T\n *\n * @param {T | \"\" | null | undefined} value The value to check.\n * @return {value is T} Whether value is empty.\n */\nexport function isValueEmpty( value ) {\n\tconst isEmptyString = value === '';\n\n\treturn ! isValueDefined( value ) || isEmptyString;\n}\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Get the first defined/non-null value from an array.\n *\n * @template T\n *\n * @param {Array<T | null | undefined>} values Values to derive from.\n * @param {T} fallbackValue Fallback value if there are no defined values.\n * @return {T} A defined value or the fallback value.\n */\nexport function getDefinedValue( values = [], fallbackValue ) {\n\treturn values.find( isValueDefined ) ?? fallbackValue;\n}\n\n/**\n * @param {string} [locale]\n * @return {[RegExp, RegExp]} The delimiter and decimal regexp\n */\nconst getDelimiterAndDecimalRegex = ( locale ) => {\n\tconst formatted = Intl.NumberFormat( locale ).format( 1000.1 );\n\tconst delimiter = formatted[ 1 ];\n\tconst decimal = formatted[ formatted.length - 2 ];\n\treturn [\n\t\tnew RegExp( `\\\\${ delimiter }`, 'g' ),\n\t\tnew RegExp( `\\\\${ decimal }`, 'g' ),\n\t];\n};\n\n// https://en.wikipedia.org/wiki/Decimal_separator#Current_standards\nconst INTERNATIONAL_THOUSANDS_DELIMITER = / /g;\n\nconst ARABIC_NUMERAL_LOCALES = [ 'ar', 'fa', 'ur', 'ckb', 'ps' ];\n\nconst EASTERN_ARABIC_NUMBERS = /([۰-۹]|[٠-٩])/g;\n\n/**\n * Checks to see if a value is a numeric value (`number` or `string`).\n *\n * Intentionally ignores whether the thousands delimiters are only\n * in the thousands marks.\n *\n * @param {any} value\n * @param {string} [locale]\n * @return {boolean} Whether value is numeric.\n */\nexport function isValueNumeric( value, locale = window.navigator.language ) {\n\tif ( ARABIC_NUMERAL_LOCALES.some( ( l ) => locale.startsWith( l ) ) ) {\n\t\tlocale = 'en-GB';\n\t\tif ( EASTERN_ARABIC_NUMBERS.test( value ) ) {\n\t\t\tvalue = value\n\t\t\t\t.replace( /[٠-٩]/g, ( /** @type {string} */ d ) =>\n\t\t\t\t\t'٠١٢٣٤٥٦٧٨٩'.indexOf( d )\n\t\t\t\t)\n\t\t\t\t.replace( /[۰-۹]/g, ( /** @type {string} */ d ) =>\n\t\t\t\t\t'۰۱۲۳۴۵۶۷۸۹'.indexOf( d )\n\t\t\t\t)\n\t\t\t\t.replace( /٬/g, ',' )\n\t\t\t\t.replace( /٫/g, '.' );\n\t\t}\n\t}\n\n\tconst [ delimiterRegexp, decimalRegexp ] = getDelimiterAndDecimalRegex(\n\t\tlocale\n\t);\n\tconst valueToCheck =\n\t\ttypeof value === 'string'\n\t\t\t? value\n\t\t\t\t\t.replace( delimiterRegexp, '' )\n\t\t\t\t\t.replace( decimalRegexp, '.' )\n\t\t\t\t\t.replace( INTERNATIONAL_THOUSANDS_DELIMITER, '' )\n\t\t\t: value;\n\treturn ! isNaN( parseFloat( valueToCheck ) ) && isFinite( valueToCheck );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/values.js"],"names":["isValueDefined","value","undefined","isValueEmpty","isEmptyString","getDefinedValue","values","fallbackValue","find","getDelimiterAndDecimalRegex","locale","formatted","Intl","NumberFormat","format","delimiter","decimal","length","RegExp","INTERNATIONAL_THOUSANDS_DELIMITER","ARABIC_NUMERAL_LOCALES","EASTERN_ARABIC_NUMBERS","isValueNumeric","window","navigator","language","some","l","startsWith","test","replace","d","indexOf","delimiterRegexp","decimalRegexp","valueToCheck","isNaN","parseFloat","isFinite"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAT,CAAyBC,KAAzB,EAAiC;AACvC,SAAOA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAAxC;AACA;AACD;;AAEA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,YAAT,CAAuBF,KAAvB,EAA+B;AACrC,QAAMG,aAAa,GAAGH,KAAK,KAAK,EAAhC;AAEA,SAAO,CAAED,cAAc,CAAEC,KAAF,CAAhB,IAA6BG,aAApC;AACA;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,GAAuD;AAAA;;AAAA,MAA7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AAsBD,CAAtB,CAFM,EAIND,OAJM,CAIG,QAJH,EAIa;AAAE;AAAsBC,MAAAA,CAAxB,KACnB,aAAaC,OAAb,CAAsBD,CAAtB,CALM,EAOND,OAPM,CAOG,IAPH,EAOS,GAPT,EAQNA,OARM,CAQG,IARH,EAQS,GART,CAAR;AASA;AACD;;AAED,QAAM,CAAEG,eAAF,EAAmBC,aAAnB,IACLzB,2BAA2B,CAAEC,MAAF,CAD5B;AAEA,QAAMyB,YAAY,GACjB,OAAOlC,KAAP,KAAiB,QAAjB,GACGA,KAAK,CACJ6B,OADD,CACUG,eADV,EAC2B,EAD3B,EAECH,OAFD,CAEUI,aAFV,EAEyB,GAFzB,EAGCJ,OAHD,CAGUX,iCAHV,EAG6C,EAH7C,CADH,GAKGlB,KANJ;AAOA,SAAO,CAAEmC,KAAK,CAAEC,UAAU,CAAEF,YAAF,CAAZ,CAAP,IAAyCG,QAAQ,CAAEH,YAAF,CAAxD;AACA","sourcesContent":["/* eslint-disable jsdoc/valid-types */\n/**\n * Determines if a value is null or undefined.\n *\n * @template T\n *\n * @param {T | null | undefined} value The value to check.\n * @return {value is T} Whether value is not null or undefined.\n */\nexport function isValueDefined( value ) {\n\treturn value !== undefined && value !== null;\n}\n/* eslint-enable jsdoc/valid-types */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Determines if a value is empty, null, or undefined.\n *\n * @template T\n *\n * @param {T | \"\" | null | undefined} value The value to check.\n * @return {value is T} Whether value is empty.\n */\nexport function isValueEmpty( value ) {\n\tconst isEmptyString = value === '';\n\n\treturn ! isValueDefined( value ) || isEmptyString;\n}\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Get the first defined/non-null value from an array.\n *\n * @template T\n *\n * @param {Array<T | null | undefined>} values Values to derive from.\n * @param {T} fallbackValue Fallback value if there are no defined values.\n * @return {T} A defined value or the fallback value.\n */\nexport function getDefinedValue( values = [], fallbackValue ) {\n\treturn values.find( isValueDefined ) ?? fallbackValue;\n}\n\n/**\n * @param {string} [locale]\n * @return {[RegExp, RegExp]} The delimiter and decimal regexp\n */\nconst getDelimiterAndDecimalRegex = ( locale ) => {\n\tconst formatted = Intl.NumberFormat( locale ).format( 1000.1 );\n\tconst delimiter = formatted[ 1 ];\n\tconst decimal = formatted[ formatted.length - 2 ];\n\treturn [\n\t\tnew RegExp( `\\\\${ delimiter }`, 'g' ),\n\t\tnew RegExp( `\\\\${ decimal }`, 'g' ),\n\t];\n};\n\n// https://en.wikipedia.org/wiki/Decimal_separator#Current_standards\nconst INTERNATIONAL_THOUSANDS_DELIMITER = / /g;\n\nconst ARABIC_NUMERAL_LOCALES = [ 'ar', 'fa', 'ur', 'ckb', 'ps' ];\n\nconst EASTERN_ARABIC_NUMBERS = /([۰-۹]|[٠-٩])/g;\n\n/**\n * Checks to see if a value is a numeric value (`number` or `string`).\n *\n * Intentionally ignores whether the thousands delimiters are only\n * in the thousands marks.\n *\n * @param {any} value\n * @param {string} [locale]\n * @return {boolean} Whether value is numeric.\n */\nexport function isValueNumeric( value, locale = window.navigator.language ) {\n\tif ( ARABIC_NUMERAL_LOCALES.some( ( l ) => locale.startsWith( l ) ) ) {\n\t\tlocale = 'en-GB';\n\t\tif ( EASTERN_ARABIC_NUMBERS.test( value ) ) {\n\t\t\tvalue = value\n\t\t\t\t.replace( /[٠-٩]/g, ( /** @type {string} */ d ) =>\n\t\t\t\t\t'٠١٢٣٤٥٦٧٨٩'.indexOf( d )\n\t\t\t\t)\n\t\t\t\t.replace( /[۰-۹]/g, ( /** @type {string} */ d ) =>\n\t\t\t\t\t'۰۱۲۳۴۵۶۷۸۹'.indexOf( d )\n\t\t\t\t)\n\t\t\t\t.replace( /٬/g, ',' )\n\t\t\t\t.replace( /٫/g, '.' );\n\t\t}\n\t}\n\n\tconst [ delimiterRegexp, decimalRegexp ] =\n\t\tgetDelimiterAndDecimalRegex( locale );\n\tconst valueToCheck =\n\t\ttypeof value === 'string'\n\t\t\t? value\n\t\t\t\t\t.replace( delimiterRegexp, '' )\n\t\t\t\t\t.replace( decimalRegexp, '.' )\n\t\t\t\t\t.replace( INTERNATIONAL_THOUSANDS_DELIMITER, '' )\n\t\t\t: value;\n\treturn ! isNaN( parseFloat( valueToCheck ) ) && isFinite( valueToCheck );\n}\n"]}
@@ -1,29 +1,29 @@
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 { useVStack } from './hook';
10
- /**
11
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
12
- * @param {import('react').ForwardedRef<any>} forwardedRef
13
- */
14
14
 
15
- function VStack(props, forwardedRef) {
15
+ function UnconnectedVStack(props, forwardedRef) {
16
16
  const vStackProps = useVStack(props);
17
17
  return createElement(View, _extends({}, vStackProps, {
18
18
  ref: forwardedRef
19
19
  }));
20
20
  }
21
21
  /**
22
- * `VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.
22
+ * `VStack` (or Vertical Stack) is a layout component that arranges child
23
+ * elements in a vertical line.
23
24
  *
24
25
  * `VStack` can render anything inside.
25
26
  *
26
- * @example
27
27
  * ```jsx
28
28
  * import {
29
29
  * __experimentalText as Text,
@@ -43,6 +43,6 @@ function VStack(props, forwardedRef) {
43
43
  */
44
44
 
45
45
 
46
- const ConnectedVStack = contextConnect(VStack, 'VStack');
47
- export default ConnectedVStack;
46
+ export const VStack = contextConnect(UnconnectedVStack, 'VStack');
47
+ export default VStack;
48
48
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/v-stack/component.js"],"names":["contextConnect","View","useVStack","VStack","props","forwardedRef","vStackProps","ConnectedVStack"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;AACA;;AACA,SAASC,MAAT,CAAiBC,KAAjB,EAAwBC,YAAxB,EAAuC;AACtC,QAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAF,CAA7B;AAEA,SAAO,cAAC,IAAD,eAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,eAAe,GAAGP,cAAc,CAAEG,MAAF,EAAU,QAAV,CAAtC;AAEA,eAAeI,eAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useVStack } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction VStack( props, forwardedRef ) {\n\tconst vStackProps = useVStack( props );\n\n\treturn <View { ...vStackProps } ref={ forwardedRef } />;\n}\n\n/**\n * `VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.\n *\n * `VStack` can render anything inside.\n *\n * @example\n * ```jsx\n * import {\n * \t__experimentalText as Text,\n * \t__experimentalVStack as VStack,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<VStack>\n * \t\t\t<Text>Code</Text>\n * \t\t\t<Text>is</Text>\n * \t\t\t<Text>Poetry</Text>\n * \t\t</VStack>\n * \t);\n * }\n * ```\n */\nconst ConnectedVStack = contextConnect( VStack, 'VStack' );\n\nexport default ConnectedVStack;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/v-stack/component.tsx"],"names":["contextConnect","View","useVStack","UnconnectedVStack","props","forwardedRef","vStackProps","VStack"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAAwD,eAAxD;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,SAAT,QAA0B,QAA1B;;AAGA,SAASC,iBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAF,CAA7B;AAEA,SAAO,cAAC,IAAD,eAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAME,MAAM,GAAGP,cAAc,CAAEG,iBAAF,EAAqB,QAArB,CAA7B;AAEP,eAAeI,MAAf","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 { useVStack } from './hook';\nimport type { VStackProps } from './types';\n\nfunction UnconnectedVStack(\n\tprops: WordPressComponentProps< VStackProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst vStackProps = useVStack( props );\n\n\treturn <View { ...vStackProps } ref={ forwardedRef } />;\n}\n\n/**\n * `VStack` (or Vertical Stack) is a layout component that arranges child\n * elements in a vertical line.\n *\n * `VStack` can render anything inside.\n *\n * ```jsx\n * import {\n * \t__experimentalText as Text,\n * \t__experimentalVStack as VStack,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<VStack>\n * \t\t\t<Text>Code</Text>\n * \t\t\t<Text>is</Text>\n * \t\t\t<Text>Poetry</Text>\n * \t\t</VStack>\n * \t);\n * }\n * ```\n */\nexport const VStack = contextConnect( UnconnectedVStack, 'VStack' );\n\nexport default VStack;\n"]}
@@ -3,11 +3,6 @@
3
3
  */
4
4
  import { useContextSystem } from '../ui/context';
5
5
  import { useHStack } from '../h-stack';
6
- /**
7
- *
8
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
9
- */
10
-
11
6
  export function useVStack(props) {
12
7
  const {
13
8
  expanded = false,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/v-stack/hook.js"],"names":["useContextSystem","useHStack","useVStack","props","expanded","otherProps","hStackProps","direction"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,eAAjC;AACA,SAASC,SAAT,QAA0B,YAA1B;AAEA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBC,KAApB,EAA4B;AAClC,QAAM;AAAEC,IAAAA,QAAQ,GAAG,KAAb;AAAoB,OAAGC;AAAvB,MAAsCL,gBAAgB,CAC3DG,KAD2D,EAE3D,QAF2D,CAA5D;AAKA,QAAMG,WAAW,GAAGL,SAAS,CAAE;AAC9BM,IAAAA,SAAS,EAAE,QADmB;AAE9BH,IAAAA,QAF8B;AAG9B,OAAGC;AAH2B,GAAF,CAA7B;AAMA,SAAOC,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem } from '../ui/context';\nimport { useHStack } from '../h-stack';\n\n/**\n *\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n */\nexport function useVStack( props ) {\n\tconst { expanded = false, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'VStack'\n\t);\n\n\tconst hStackProps = useHStack( {\n\t\tdirection: 'column',\n\t\texpanded,\n\t\t...otherProps,\n\t} );\n\n\treturn hStackProps;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/v-stack/hook.ts"],"names":["useContextSystem","useHStack","useVStack","props","expanded","otherProps","hStackProps","direction"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAA0D,eAA1D;AACA,SAASC,SAAT,QAA0B,YAA1B;AAGA,OAAO,SAASC,SAAT,CACNC,KADM,EAEL;AACD,QAAM;AAAEC,IAAAA,QAAQ,GAAG,KAAb;AAAoB,OAAGC;AAAvB,MAAsCL,gBAAgB,CAC3DG,KAD2D,EAE3D,QAF2D,CAA5D;AAKA,QAAMG,WAAW,GAAGL,SAAS,CAAE;AAC9BM,IAAAA,SAAS,EAAE,QADmB;AAE9BH,IAAAA,QAF8B;AAG9B,OAAGC;AAH2B,GAAF,CAA7B;AAMA,SAAOC,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../ui/context';\nimport { useHStack } from '../h-stack';\nimport type { VStackProps } from './types';\n\nexport function useVStack(\n\tprops: WordPressComponentProps< VStackProps, 'div' >\n) {\n\tconst { expanded = false, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'VStack'\n\t);\n\n\tconst hStackProps = useHStack( {\n\t\tdirection: 'column',\n\t\texpanded,\n\t\t...otherProps,\n\t} );\n\n\treturn hStackProps;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/v-stack/index.js"],"names":["default","VStack","useVStack"],"mappings":"AAAA,SAASA,OAAO,IAAIC,MAApB,QAAkC,aAAlC;AACA,SAASC,SAAT,QAA0B,QAA1B","sourcesContent":["export { default as VStack } from './component';\nexport { useVStack } from './hook';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/v-stack/index.ts"],"names":["default","VStack","useVStack"],"mappings":"AAAA,SAASA,OAAO,IAAIC,MAApB,QAAkC,aAAlC;AACA,SAASC,SAAT,QAA0B,QAA1B","sourcesContent":["export { default as VStack } from './component';\nexport { useVStack } from './hook';\n"]}
@@ -17,7 +17,7 @@ import { getValidChildren } from '../ui/utils/get-valid-children';
17
17
  import { contextConnect, useContextSystem } from '../ui/context';
18
18
  import { ZStackView, ZStackChildView } from './styles';
19
19
 
20
- function ZStack(props, forwardedRef) {
20
+ function UnconnectedZStack(props, forwardedRef) {
21
21
  const {
22
22
  children,
23
23
  className,
@@ -44,6 +44,25 @@ function ZStack(props, forwardedRef) {
44
44
  ref: forwardedRef
45
45
  }), clonedChildren);
46
46
  }
47
+ /**
48
+ * `ZStack` allows you to stack things along the Z-axis.
49
+ *
50
+ * ```jsx
51
+ * import { __experimentalZStack as ZStack } from '@wordpress/components';
52
+ *
53
+ * function Example() {
54
+ * return (
55
+ * <ZStack offset={ 20 } isLayered>
56
+ * <ExampleImage />
57
+ * <ExampleImage />
58
+ * <ExampleImage />
59
+ * </ZStack>
60
+ * );
61
+ * }
62
+ * ```
63
+ */
64
+
47
65
 
48
- export default contextConnect(ZStack, 'ZStack');
66
+ export const ZStack = contextConnect(UnconnectedZStack, 'ZStack');
67
+ export default ZStack;
49
68
  //# sourceMappingURL=component.js.map