@wordpress/components 27.0.0 → 27.2.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 (314) hide show
  1. package/CHANGELOG.md +50 -2
  2. package/build/base-control/index.native.js.map +1 -1
  3. package/build/border-box-control/border-box-control/component.js.map +1 -1
  4. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  5. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  6. package/build/button/index.js +4 -5
  7. package/build/button/index.js.map +1 -1
  8. package/build/button/index.native.js.map +1 -1
  9. package/build/button/types.js.map +1 -1
  10. package/build/confirm-dialog/component.js.map +1 -1
  11. package/build/custom-select-control-v2/default-component/index.js.map +1 -1
  12. package/build/custom-select-control-v2/index.js +2 -2
  13. package/build/custom-select-control-v2/index.js.map +1 -1
  14. package/build/custom-select-control-v2/types.js.map +1 -1
  15. package/build/date-time/date/styles.js +7 -7
  16. package/build/date-time/date/styles.js.map +1 -1
  17. package/build/draggable/index.native.js +2 -2
  18. package/build/draggable/index.native.js.map +1 -1
  19. package/build/dropdown-menu/index.native.js.map +1 -1
  20. package/build/flex/flex/hook.js +1 -1
  21. package/build/flex/flex/hook.js.map +1 -1
  22. package/build/font-size-picker/index.native.js.map +1 -1
  23. package/build/form-token-field/index.js +1 -1
  24. package/build/form-token-field/index.js.map +1 -1
  25. package/build/h-stack/hook.js +6 -1
  26. package/build/h-stack/hook.js.map +1 -1
  27. package/build/input-control/index.js +1 -1
  28. package/build/input-control/index.js.map +1 -1
  29. package/build/mobile/bottom-sheet/button.native.js.map +1 -1
  30. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  31. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  32. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  33. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  34. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  35. package/build/mobile/gradient/index.native.js.map +1 -1
  36. package/build/mobile/image/index.native.js +4 -13
  37. package/build/mobile/image/index.native.js.map +1 -1
  38. package/build/mobile/media-edit/index.native.js.map +1 -1
  39. package/build/palette-edit/index.js +18 -12
  40. package/build/palette-edit/index.js.map +1 -1
  41. package/build/query-controls/index.native.js.map +1 -1
  42. package/build/range-control/index.js.map +1 -1
  43. package/build/search-control/index.native.js.map +1 -1
  44. package/build/snackbar/index.js +3 -2
  45. package/build/snackbar/index.js.map +1 -1
  46. package/build/snackbar/list.js +2 -1
  47. package/build/snackbar/list.js.map +1 -1
  48. package/build/snackbar/types.js.map +1 -1
  49. package/build/tabs/index.js +7 -7
  50. package/build/tabs/index.js.map +1 -1
  51. package/build/tabs/types.js.map +1 -1
  52. package/build/text-control/types.js.map +1 -1
  53. package/build/toggle-group-control/toggle-group-control-option-base/component.js +4 -1
  54. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  55. package/build/tools-panel/tools-panel-header/component.js +1 -1
  56. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  57. package/build/utils/config-values.js +1 -1
  58. package/build/utils/config-values.js.map +1 -1
  59. package/build/utils/hooks/index.js +0 -7
  60. package/build/utils/hooks/index.js.map +1 -1
  61. package/build/utils/input/base.js +2 -2
  62. package/build/utils/input/base.js.map +1 -1
  63. package/build-module/base-control/index.native.js.map +1 -1
  64. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  65. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  66. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  67. package/build-module/button/index.js +4 -5
  68. package/build-module/button/index.js.map +1 -1
  69. package/build-module/button/index.native.js.map +1 -1
  70. package/build-module/button/types.js.map +1 -1
  71. package/build-module/confirm-dialog/component.js.map +1 -1
  72. package/build-module/custom-select-control-v2/default-component/index.js.map +1 -1
  73. package/build-module/custom-select-control-v2/index.js +1 -1
  74. package/build-module/custom-select-control-v2/index.js.map +1 -1
  75. package/build-module/custom-select-control-v2/types.js.map +1 -1
  76. package/build-module/date-time/date/styles.js +7 -7
  77. package/build-module/date-time/date/styles.js.map +1 -1
  78. package/build-module/draggable/index.native.js +2 -2
  79. package/build-module/draggable/index.native.js.map +1 -1
  80. package/build-module/dropdown-menu/index.native.js.map +1 -1
  81. package/build-module/flex/flex/hook.js +1 -1
  82. package/build-module/flex/flex/hook.js.map +1 -1
  83. package/build-module/font-size-picker/index.native.js.map +1 -1
  84. package/build-module/form-token-field/index.js +1 -1
  85. package/build-module/form-token-field/index.js.map +1 -1
  86. package/build-module/h-stack/hook.js +6 -1
  87. package/build-module/h-stack/hook.js.map +1 -1
  88. package/build-module/input-control/index.js +1 -1
  89. package/build-module/input-control/index.js.map +1 -1
  90. package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
  91. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  92. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  93. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  94. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  95. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  96. package/build-module/mobile/gradient/index.native.js.map +1 -1
  97. package/build-module/mobile/image/index.native.js +6 -15
  98. package/build-module/mobile/image/index.native.js.map +1 -1
  99. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  100. package/build-module/palette-edit/index.js +17 -11
  101. package/build-module/palette-edit/index.js.map +1 -1
  102. package/build-module/query-controls/index.native.js.map +1 -1
  103. package/build-module/range-control/index.js.map +1 -1
  104. package/build-module/search-control/index.native.js.map +1 -1
  105. package/build-module/snackbar/index.js +3 -2
  106. package/build-module/snackbar/index.js.map +1 -1
  107. package/build-module/snackbar/list.js +2 -1
  108. package/build-module/snackbar/list.js.map +1 -1
  109. package/build-module/snackbar/types.js.map +1 -1
  110. package/build-module/tabs/index.js +7 -7
  111. package/build-module/tabs/index.js.map +1 -1
  112. package/build-module/tabs/types.js.map +1 -1
  113. package/build-module/text-control/types.js.map +1 -1
  114. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +4 -1
  115. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  116. package/build-module/tools-panel/tools-panel-header/component.js +1 -1
  117. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  118. package/build-module/utils/config-values.js +1 -1
  119. package/build-module/utils/config-values.js.map +1 -1
  120. package/build-module/utils/hooks/index.js +0 -1
  121. package/build-module/utils/hooks/index.js.map +1 -1
  122. package/build-module/utils/input/base.js +2 -2
  123. package/build-module/utils/input/base.js.map +1 -1
  124. package/build-style/style-rtl.css +33 -23
  125. package/build-style/style.css +33 -23
  126. package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
  127. package/build-types/button/deprecated.d.ts +4 -10
  128. package/build-types/button/deprecated.d.ts.map +1 -1
  129. package/build-types/button/index.d.ts +3 -3
  130. package/build-types/button/index.d.ts.map +1 -1
  131. package/build-types/button/stories/e2e/index.story.d.ts +1 -1
  132. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  133. package/build-types/button/stories/index.story.d.ts +7 -7
  134. package/build-types/button/stories/index.story.d.ts.map +1 -1
  135. package/build-types/button/types.d.ts +37 -8
  136. package/build-types/button/types.d.ts.map +1 -1
  137. package/build-types/color-picker/styles.d.ts +1 -1
  138. package/build-types/custom-select-control-v2/default-component/index.d.ts +2 -1
  139. package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
  140. package/build-types/custom-select-control-v2/index.d.ts +1 -1
  141. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  142. package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts +2 -0
  143. package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts.map +1 -0
  144. package/build-types/custom-select-control-v2/stories/default.story.d.ts +4 -3
  145. package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
  146. package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +2 -2
  147. package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -1
  148. package/build-types/custom-select-control-v2/types.d.ts +0 -1
  149. package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
  150. package/build-types/date-time/date/styles.d.ts +1 -1
  151. package/build-types/dropdown/stories/index.story.d.ts +1 -0
  152. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  153. package/build-types/flex/flex/hook.d.ts +2 -3
  154. package/build-types/flex/flex/hook.d.ts.map +1 -1
  155. package/build-types/font-size-picker/styles.d.ts +1 -1
  156. package/build-types/form-token-field/index.d.ts +1 -1
  157. package/build-types/h-stack/hook.d.ts +2 -4
  158. package/build-types/h-stack/hook.d.ts.map +1 -1
  159. package/build-types/input-control/index.d.ts +1 -1
  160. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  161. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
  162. package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
  163. package/build-types/navigator/navigator-back-button/component.d.ts +0 -1
  164. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  165. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -2
  166. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  167. package/build-types/navigator/navigator-button/component.d.ts +0 -1
  168. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  169. package/build-types/navigator/navigator-button/hook.d.ts +1 -2
  170. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  171. package/build-types/navigator/navigator-to-parent-button/component.d.ts +0 -1
  172. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  173. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  174. package/build-types/palette-edit/index.d.ts +6 -3
  175. package/build-types/palette-edit/index.d.ts.map +1 -1
  176. package/build-types/palette-edit/styles.d.ts +2 -2
  177. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  178. package/build-types/snackbar/index.d.ts +5 -2
  179. package/build-types/snackbar/index.d.ts.map +1 -1
  180. package/build-types/snackbar/list.d.ts.map +1 -1
  181. package/build-types/snackbar/test/index.d.ts +2 -0
  182. package/build-types/snackbar/test/index.d.ts.map +1 -0
  183. package/build-types/snackbar/test/list.d.ts +2 -0
  184. package/build-types/snackbar/test/list.d.ts.map +1 -0
  185. package/build-types/snackbar/types.d.ts +18 -2
  186. package/build-types/snackbar/types.d.ts.map +1 -1
  187. package/build-types/tabs/index.d.ts +1 -1
  188. package/build-types/tabs/types.d.ts +1 -1
  189. package/build-types/text-control/index.d.ts +1 -1
  190. package/build-types/text-control/types.d.ts +1 -1
  191. package/build-types/text-control/types.d.ts.map +1 -1
  192. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  193. package/build-types/toolbar/toolbar-button/index.d.ts +4 -10
  194. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  195. package/build-types/utils/hooks/index.d.ts +0 -1
  196. package/build-types/v-stack/hook.d.ts +2 -4
  197. package/build-types/v-stack/hook.d.ts.map +1 -1
  198. package/package.json +19 -19
  199. package/src/base-control/index.native.js +1 -1
  200. package/src/base-control/test/index.tsx +1 -1
  201. package/src/border-box-control/border-box-control/component.tsx +1 -1
  202. package/src/border-box-control/border-box-control-split-controls/component.tsx +4 -4
  203. package/src/border-control/border-control-dropdown/component.tsx +1 -1
  204. package/src/button/index.native.js +1 -1
  205. package/src/button/index.tsx +3 -4
  206. package/src/button/style.scss +1 -3
  207. package/src/button/test/index.tsx +6 -6
  208. package/src/button/types.ts +37 -9
  209. package/src/circular-option-picker/test/index.tsx +2 -4
  210. package/src/combobox-control/test/index.tsx +1 -1
  211. package/src/confirm-dialog/README.md +7 -0
  212. package/src/confirm-dialog/component.tsx +1 -1
  213. package/src/confirm-dialog/test/index.tsx +5 -21
  214. package/src/custom-select-control-v2/default-component/index.tsx +4 -1
  215. package/src/custom-select-control-v2/index.tsx +1 -1
  216. package/src/custom-select-control-v2/legacy-component/test/index.tsx +457 -0
  217. package/src/custom-select-control-v2/stories/legacy.story.tsx +5 -6
  218. package/src/custom-select-control-v2/test/index.tsx +279 -749
  219. package/src/custom-select-control-v2/types.ts +0 -1
  220. package/src/date-time/date/styles.ts +2 -2
  221. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  222. package/src/disabled/test/index.tsx +1 -1
  223. package/src/draggable/index.native.js +2 -2
  224. package/src/draggable/test/index.native.js +6 -2
  225. package/src/dropdown/stories/index.story.tsx +19 -0
  226. package/src/dropdown/style.scss +26 -0
  227. package/src/dropdown-menu/index.native.js +2 -2
  228. package/src/dropdown-menu/style.scss +0 -25
  229. package/src/flex/flex/README.md +2 -2
  230. package/src/flex/flex/hook.ts +1 -1
  231. package/src/font-size-picker/index.native.js +2 -2
  232. package/src/form-token-field/README.md +1 -1
  233. package/src/form-token-field/index.tsx +2 -2
  234. package/src/grid/README.md +11 -11
  235. package/src/h-stack/README.md +6 -6
  236. package/src/h-stack/hook.tsx +2 -1
  237. package/src/h-stack/test/index.tsx +10 -0
  238. package/src/heading/README.md +1 -1
  239. package/src/heading/test/__snapshots__/index.tsx.snap +3 -3
  240. package/src/input-control/README.md +1 -1
  241. package/src/input-control/index.tsx +1 -1
  242. package/src/input-control/stories/index.story.tsx +1 -0
  243. package/src/item-group/test/__snapshots__/index.js.snap +11 -11
  244. package/src/item-group/test/index.js +2 -2
  245. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +10 -15
  246. package/src/mobile/bottom-sheet/button.native.js +1 -5
  247. package/src/mobile/bottom-sheet/index.native.js +2 -2
  248. package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
  249. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -2
  250. package/src/mobile/bottom-sheet-select-control/README.md +1 -1
  251. package/src/mobile/bottom-sheet-select-control/index.native.js +1 -1
  252. package/src/mobile/bottom-sheet-text-control/index.native.js +1 -1
  253. package/src/mobile/gradient/index.native.js +1 -1
  254. package/src/mobile/image/index.native.js +8 -23
  255. package/src/mobile/media-edit/index.native.js +1 -1
  256. package/src/modal/test/index.tsx +1 -1
  257. package/src/navigation/stories/utils/hide-if-empty.tsx +2 -6
  258. package/src/palette-edit/index.tsx +23 -23
  259. package/src/palette-edit/test/index.tsx +21 -17
  260. package/src/placeholder/style.scss +5 -1
  261. package/src/popover/test/index.tsx +1 -4
  262. package/src/progress-bar/README.md +1 -1
  263. package/src/query-controls/index.native.js +2 -2
  264. package/src/radio-control/README.md +3 -3
  265. package/src/radio-group/stories/index.story.tsx +1 -0
  266. package/src/range-control/index.tsx +3 -3
  267. package/src/range-control/test/index.tsx +2 -2
  268. package/src/resizable-box/resize-tooltip/README.md +2 -2
  269. package/src/search-control/index.native.js +1 -1
  270. package/src/snackbar/index.tsx +5 -2
  271. package/src/snackbar/list.tsx +6 -1
  272. package/src/snackbar/stories/list.story.tsx +0 -3
  273. package/src/snackbar/test/index.tsx +267 -0
  274. package/src/snackbar/test/list.tsx +46 -0
  275. package/src/snackbar/types.ts +31 -3
  276. package/src/tabs/README.md +18 -18
  277. package/src/tabs/index.tsx +7 -7
  278. package/src/tabs/stories/index.story.tsx +1 -1
  279. package/src/tabs/test/index.tsx +30 -30
  280. package/src/tabs/types.ts +1 -1
  281. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  282. package/src/text-control/types.ts +12 -1
  283. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +14 -10
  284. package/src/toggle-group-control/test/index.tsx +1 -1
  285. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +12 -10
  286. package/src/tools-panel/stories/index.story.tsx +8 -8
  287. package/src/tools-panel/test/index.tsx +10 -28
  288. package/src/tools-panel/tools-panel-header/component.tsx +1 -1
  289. package/src/tooltip/style.scss +2 -1
  290. package/src/tooltip/test/index.native.js +3 -3
  291. package/src/tree-grid/test/index.tsx +1 -1
  292. package/src/truncate/README.md +5 -5
  293. package/src/utils/config-values.js +1 -1
  294. package/src/utils/hooks/index.js +0 -1
  295. package/src/utils/input/base.js +1 -1
  296. package/src/v-stack/README.md +6 -6
  297. package/src/v-stack/test/index.tsx +10 -0
  298. package/tsconfig.json +1 -0
  299. package/tsconfig.tsbuildinfo +1 -1
  300. package/build/custom-select-control-v2/legacy-adapter.js +0 -29
  301. package/build/custom-select-control-v2/legacy-adapter.js.map +0 -1
  302. package/build/utils/hooks/use-latest-ref.js +0 -33
  303. package/build/utils/hooks/use-latest-ref.js.map +0 -1
  304. package/build-module/custom-select-control-v2/legacy-adapter.js +0 -21
  305. package/build-module/custom-select-control-v2/legacy-adapter.js.map +0 -1
  306. package/build-module/utils/hooks/use-latest-ref.js +0 -27
  307. package/build-module/utils/hooks/use-latest-ref.js.map +0 -1
  308. package/build-types/custom-select-control-v2/legacy-adapter.d.ts +0 -6
  309. package/build-types/custom-select-control-v2/legacy-adapter.d.ts.map +0 -1
  310. package/build-types/utils/hooks/use-latest-ref.d.ts +0 -15
  311. package/build-types/utils/hooks/use-latest-ref.d.ts.map +0 -1
  312. package/src/custom-select-control-v2/legacy-adapter.tsx +0 -25
  313. package/src/utils/hooks/test/use-latest-ref.js +0 -119
  314. package/src/utils/hooks/use-latest-ref.ts +0 -29
@@ -92,7 +92,6 @@ type LegacyOnChangeObject = {
92
92
  };
93
93
 
94
94
  export type LegacyCustomSelectProps = {
95
- children?: never;
96
95
  /**
97
96
  * Optional classname for the component.
98
97
  */
@@ -84,8 +84,8 @@ export const DayButton = styled( Button, {
84
84
 
85
85
  &&& {
86
86
  border-radius: 100%;
87
- height: ${ space( 8 ) };
88
- width: ${ space( 8 ) };
87
+ height: ${ space( 7 ) };
88
+ width: ${ space( 7 ) };
89
89
 
90
90
  ${ ( props ) =>
91
91
  props.isSelected &&
@@ -59,7 +59,7 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = `
59
59
 
60
60
  .emotion-11 {
61
61
  color: #1e1e1e;
62
- line-height: 1.2;
62
+ line-height: 1.4;
63
63
  margin: 0;
64
64
  font-size: calc((13 / 13) * 13px);
65
65
  font-weight: normal;
@@ -330,7 +330,7 @@ exports[`DimensionControl rendering renders with defaults 1`] = `
330
330
 
331
331
  .emotion-11 {
332
332
  color: #1e1e1e;
333
- line-height: 1.2;
333
+ line-height: 1.4;
334
334
  margin: 0;
335
335
  font-size: calc((13 / 13) * 13px);
336
336
  font-weight: normal;
@@ -611,7 +611,7 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`]
611
611
 
612
612
  .emotion-11 {
613
613
  color: #1e1e1e;
614
- line-height: 1.2;
614
+ line-height: 1.4;
615
615
  margin: 0;
616
616
  font-size: calc((13 / 13) * 13px);
617
617
  font-weight: normal;
@@ -904,7 +904,7 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`]
904
904
 
905
905
  .emotion-11 {
906
906
  color: #1e1e1e;
907
- line-height: 1.2;
907
+ line-height: 1.4;
908
908
  margin: 0;
909
909
  font-size: calc((13 / 13) * 13px);
910
910
  font-weight: normal;
@@ -94,7 +94,7 @@ describe( 'Disabled', () => {
94
94
  'This is contentEditable.'
95
95
  );
96
96
 
97
- rerender( <MaybeDisable isDisabled={ true } /> );
97
+ rerender( <MaybeDisable isDisabled /> );
98
98
  expect( getInput() ).toHaveValue( 'This is input.' );
99
99
  expect( getContentEditable() ).toHaveTextContent(
100
100
  'This is contentEditable.'
@@ -63,7 +63,7 @@ const Draggable = ( {
63
63
  useAnimatedReaction(
64
64
  () => isDragging.value,
65
65
  ( result, previous ) => {
66
- if ( result === previous || previous === null ) {
66
+ if ( result === previous ) {
67
67
  return;
68
68
  }
69
69
 
@@ -75,7 +75,7 @@ const Draggable = ( {
75
75
  id: draggingId.value,
76
76
  } );
77
77
  }
78
- } else if ( onDragEnd ) {
78
+ } else if ( previous !== null && onDragEnd ) {
79
79
  onDragEnd( {
80
80
  x: lastPosition.x.value,
81
81
  y: lastPosition.y.value,
@@ -28,10 +28,12 @@ const TouchEventType = {
28
28
  // For testing, we mock the "requestAnimationFrame" so it calls the callback passed instantly.
29
29
  let requestAnimationFrameCopy;
30
30
  beforeEach( () => {
31
+ jest.useFakeTimers();
31
32
  requestAnimationFrameCopy = global.requestAnimationFrame;
32
33
  global.requestAnimationFrame = ( callback ) => callback();
33
34
  } );
34
35
  afterEach( () => {
36
+ jest.useRealTimers();
35
37
  global.requestAnimationFrame = requestAnimationFrameCopy;
36
38
  } );
37
39
 
@@ -43,7 +45,7 @@ describe( 'Draggable', () => {
43
45
  <Draggable>
44
46
  <DraggableTrigger
45
47
  id={ triggerId }
46
- enabled={ true }
48
+ enabled
47
49
  minDuration={ 500 }
48
50
  onLongPress={ onLongPress }
49
51
  testID="draggableTrigger"
@@ -58,6 +60,7 @@ describe( 'Draggable', () => {
58
60
  { oldState: State.BEGAN, state: State.ACTIVE },
59
61
  { state: State.ACTIVE },
60
62
  ] );
63
+ jest.runOnlyPendingTimers();
61
64
 
62
65
  expect( onLongPress ).toHaveBeenCalledTimes( 1 );
63
66
  expect( onLongPress ).toHaveBeenCalledWith( triggerId );
@@ -93,6 +96,7 @@ describe( 'Draggable', () => {
93
96
  { oldState: State.BEGAN, state: State.ACTIVE },
94
97
  { state: State.ACTIVE },
95
98
  ] );
99
+ jest.runOnlyPendingTimers();
96
100
  fireGestureHandler( draggable, [
97
101
  // TOUCHES_DOWN event is only received on ACTIVE state, so we have to fire it manually.
98
102
  { oldState: State.BEGAN, state: State.ACTIVE },
@@ -112,7 +116,7 @@ describe( 'Draggable', () => {
112
116
  ] );
113
117
  // TODO(jest-console): Fix the warning and remove the expect below.
114
118
  expect( console ).toHaveWarnedWith(
115
- '[Reanimated] You can not use setGestureState in non-worklet function.'
119
+ '[Reanimated] setGestureState() cannot be used with Jest.'
116
120
  );
117
121
 
118
122
  expect( onDragStart ).toHaveBeenCalledTimes( 1 );
@@ -8,6 +8,8 @@ import type { Meta, StoryFn } from '@storybook/react';
8
8
  */
9
9
  import Dropdown from '..';
10
10
  import Button from '../../button';
11
+ import MenuGroup from '../../menu-group';
12
+ import MenuItem from '../../menu-item';
11
13
  import { DropdownContentWrapper } from '../dropdown-content-wrapper';
12
14
 
13
15
  const meta: Meta< typeof Dropdown > = {
@@ -83,3 +85,20 @@ WithNoPadding.args = {
83
85
  </DropdownContentWrapper>
84
86
  ),
85
87
  };
88
+
89
+ export const WithMenuItems = Template.bind( {} );
90
+ WithMenuItems.args = {
91
+ ...Default.args,
92
+ renderContent: () => (
93
+ <>
94
+ <MenuGroup label="Group 1">
95
+ <MenuItem>Item 1</MenuItem>
96
+ <MenuItem>Item 2</MenuItem>
97
+ </MenuGroup>
98
+ <MenuGroup label="Group 2">
99
+ <MenuItem>Item 1</MenuItem>
100
+ <MenuItem>Item 2</MenuItem>
101
+ </MenuGroup>
102
+ </>
103
+ ),
104
+ };
@@ -10,4 +10,30 @@
10
10
  [role="menuitem"] {
11
11
  white-space: nowrap;
12
12
  }
13
+
14
+ .components-menu-group {
15
+ padding: $grid-unit-10;
16
+ margin-top: 0;
17
+ margin-bottom: 0;
18
+ margin-left: -$grid-unit-10;
19
+ margin-right: -$grid-unit-10;
20
+
21
+ &:first-child {
22
+ margin-top: -$grid-unit-10;
23
+ }
24
+
25
+ &:last-child {
26
+ margin-bottom: -$grid-unit-10;
27
+ }
28
+ }
29
+
30
+ .components-menu-group + .components-menu-group {
31
+ margin-top: 0;
32
+ border-top: $border-width solid $gray-400;
33
+ padding: $grid-unit-10;
34
+
35
+ .is-alternate & {
36
+ border-color: $gray-900;
37
+ }
38
+ }
13
39
  }
@@ -108,7 +108,7 @@ function DropdownMenu( {
108
108
  renderContent={ ( { isOpen, onClose, ...props } ) => {
109
109
  return (
110
110
  <BottomSheet
111
- hideHeader={ true }
111
+ hideHeader
112
112
  isVisible={ isOpen }
113
113
  onClose={ onClose }
114
114
  >
@@ -135,7 +135,7 @@ function DropdownMenu( {
135
135
  } }
136
136
  editable={ false }
137
137
  icon={ control.icon }
138
- leftAlign={ true }
138
+ leftAlign
139
139
  isSelected={ control.isActive }
140
140
  separatorType={
141
141
  Platform.OS === 'android'
@@ -60,29 +60,4 @@
60
60
  padding-right: $grid-unit-10;
61
61
  }
62
62
 
63
- .components-menu-group {
64
- padding: $grid-unit-10;
65
- margin-top: 0;
66
- margin-bottom: 0;
67
- margin-left: -$grid-unit-10;
68
- margin-right: -$grid-unit-10;
69
-
70
- &:first-child {
71
- margin-top: -$grid-unit-10;
72
- }
73
-
74
- &:last-child {
75
- margin-bottom: -$grid-unit-10;
76
- }
77
- }
78
-
79
- .components-menu-group + .components-menu-group {
80
- margin-top: 0;
81
- border-top: $border-width solid $gray-400;
82
- padding: $grid-unit-10;
83
-
84
- .is-alternate & {
85
- border-color: $gray-900;
86
- }
87
- }
88
63
  }
@@ -53,14 +53,14 @@ Spacing in between each child can be adjusted by using `gap`. The value of `gap`
53
53
  - Required: No
54
54
  - Default: `2`
55
55
 
56
- ##### `justify`: `CSSProperties['justifyContent']`
56
+ ### `justify`: `CSSProperties['justifyContent']`
57
57
 
58
58
  Horizontally aligns content if the `direction` is `row`, or vertically aligns content if the `direction` is `column`.
59
59
 
60
60
  - Required: No
61
61
  - Default: `space-between`
62
62
 
63
- ##### `wrap`: `boolean`
63
+ ### `wrap`: `boolean`
64
64
 
65
65
  Determines if children should wrap.
66
66
 
@@ -22,7 +22,7 @@ import type { FlexProps } from '../types';
22
22
 
23
23
  function useDeprecatedProps(
24
24
  props: WordPressComponentProps< FlexProps, 'div' >
25
- ): WordPressComponentProps< FlexProps, 'div' > {
25
+ ): Omit< typeof props, 'isReversed' > {
26
26
  const { isReversed, ...otherProps } = props;
27
27
 
28
28
  if ( typeof isReversed !== 'undefined' ) {
@@ -111,7 +111,7 @@ function FontSizePicker( {
111
111
  separatorType="none"
112
112
  label={ __( 'Default' ) }
113
113
  onPress={ onChangeValue( undefined ) }
114
- leftAlign={ true }
114
+ leftAlign
115
115
  key={ 'default' }
116
116
  accessibilityRole={ 'button' }
117
117
  accessibilityLabel={ __( 'Selected: Default' ) }
@@ -137,7 +137,7 @@ function FontSizePicker( {
137
137
  label={ item.name }
138
138
  subLabel={ item.sizePx }
139
139
  onPress={ onChangeValue( item.sizePx ) }
140
- leftAlign={ true }
140
+ leftAlign
141
141
  key={ index }
142
142
  accessibilityRole={ 'button' }
143
143
  accessibilityLabel={
@@ -4,7 +4,7 @@ A `FormTokenField` is a field similar to the tags and categories fields in the i
4
4
 
5
5
  Up to one hundred suggestions that match what the user has typed so far will be shown from which the user can pick from (auto-complete). Tokens are separated by the "," character. Suggestions can be selected with the up or down arrows and added with the tab or enter key.
6
6
 
7
- The `value` property is handled in a manner similar to controlled form components. See [Forms](http://facebook.github.io/react/docs/forms.html) in the React Documentation for more information.
7
+ The `value` property is handled in a manner similar to controlled form components. See [Forms](https://react.dev/reference/react-dom/components#form-components) in the React Documentation for more information.
8
8
 
9
9
  ## Keyboard Accessibility
10
10
 
@@ -40,7 +40,7 @@ const identity = ( value: string ) => value;
40
40
  * Tokens are separated by the "," character. Suggestions can be selected with the up or down arrows and added with the tab or enter key.
41
41
  *
42
42
  * The `value` property is handled in a manner similar to controlled form components.
43
- * See [Forms](http://facebook.github.io/react/docs/forms.html) in the React Documentation for more information.
43
+ * See [Forms](https://react.dev/reference/react-dom/components#form-components) in the React Documentation for more information.
44
44
  */
45
45
  export function FormTokenField( props: FormTokenFieldProps ) {
46
46
  const {
@@ -711,7 +711,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
711
711
  justify="flex-start"
712
712
  align="center"
713
713
  gap={ 1 }
714
- wrap={ true }
714
+ wrap
715
715
  __next40pxDefaultSize={ __next40pxDefaultSize }
716
716
  hasTokens={ !! value.length }
717
717
  >
@@ -27,69 +27,69 @@ function Example() {
27
27
 
28
28
  ## Props
29
29
 
30
- ##### `align`: `CSS['alignItems']`
30
+ ### `align`: `CSS['alignItems']`
31
31
 
32
32
  Adjusts the block alignment of children.
33
33
 
34
34
  - Required: No
35
35
 
36
- ##### `alignment`: `GridAlignment`
36
+ ### `alignment`: `GridAlignment`
37
37
 
38
38
  Adjusts the horizontal and vertical alignment of children.
39
39
 
40
40
  - Required: No
41
41
 
42
- ##### `columnGap`: `CSSProperties['gridColumnGap']`
42
+ ### `columnGap`: `CSSProperties['gridColumnGap']`
43
43
 
44
44
  Adjusts the `grid-column-gap`.
45
45
 
46
46
  - Required: No
47
47
 
48
- ##### `columns`: `number`
48
+ ### `columns`: `number`
49
49
 
50
50
  Adjusts the number of columns of the `Grid`.
51
51
 
52
52
  - Required: No
53
53
  - Default: `2`
54
54
 
55
- ##### `gap`: `number`
55
+ ### `gap`: `number`
56
56
 
57
57
  Gap between each child.
58
58
 
59
59
  - Required: No
60
60
  - Default: `3`
61
61
 
62
- ##### `isInline`: `boolean`
62
+ ### `isInline`: `boolean`
63
63
 
64
64
  Changes the CSS display from `grid` to `inline-grid`.
65
65
 
66
66
  - Required: No
67
67
 
68
- ##### `justify`: `CSS['justifyContent']`
68
+ ### `justify`: `CSS['justifyContent']`
69
69
 
70
70
  Adjusts the inline alignment of children.
71
71
 
72
72
  - Required: No
73
73
 
74
- ##### `rowGap`: `CSSProperties['gridRowGap']`
74
+ ### `rowGap`: `CSSProperties['gridRowGap']`
75
75
 
76
76
  Adjusts the `grid-row-gap`.
77
77
 
78
78
  - Required: No
79
79
 
80
- ##### `rows`: `number`
80
+ ### `rows`: `number`
81
81
 
82
82
  Adjusts the number of rows of the `Grid`.
83
83
 
84
84
  - Required: No
85
85
 
86
- ##### `templateColumns`: `CSS['gridTemplateColumns']`
86
+ ### `templateColumns`: `CSS['gridTemplateColumns']`
87
87
 
88
88
  Adjusts the CSS grid `template-columns`.
89
89
 
90
90
  - Required: No
91
91
 
92
- ##### `templateRows`: `CSS['gridTemplateRows']`
92
+ ### `templateRows`: `CSS['gridTemplateRows']`
93
93
 
94
94
  Adjusts the CSS grid `template-rows`.
95
95
 
@@ -29,7 +29,7 @@ function Example() {
29
29
 
30
30
  ## Props
31
31
 
32
- ##### alignment
32
+ ### alignment
33
33
 
34
34
  **Type**: `HStackAlignment` | `CSS[ 'alignItems' ]`
35
35
 
@@ -47,33 +47,33 @@ Determines how the child elements are aligned.
47
47
  - `edge`: Justifies content to be evenly spread out up to the main axis edges of the container.
48
48
  - `stretch`: Stretches content to the cross axis edges of the container.
49
49
 
50
- ##### direction
50
+ ### direction
51
51
 
52
52
  **Type**: `FlexDirection`
53
53
 
54
54
  The direction flow of the children content can be adjusted with `direction`. `column` will align children vertically and `row` will align children horizontally.
55
55
 
56
- ##### expanded
56
+ ### expanded
57
57
 
58
58
  **Type**: `boolean`
59
59
 
60
60
  Expands to the maximum available width (if horizontal) or height (if vertical).
61
61
 
62
- ##### justify
62
+ ### justify
63
63
 
64
64
  **Type**: `CSS['justifyContent']`
65
65
 
66
66
  Horizontally aligns content if the `direction` is `row`, or vertically aligns content if the `direction` is `column`.
67
67
  In the example below, `flex-start` will align the children content to the left.
68
68
 
69
- ##### spacing
69
+ ### spacing
70
70
 
71
71
  **Type**: `CSS['width']`
72
72
 
73
73
  The amount of space between each child element. Spacing in between each child can be adjusted by using `spacing`.
74
74
  The value of `spacing` works as a multiplier to the library's grid system (base of `4px`).
75
75
 
76
- ##### wrap
76
+ ### wrap
77
77
 
78
78
  **Type**: `boolean`
79
79
 
@@ -47,7 +47,8 @@ export function useHStack( props: WordPressComponentProps< Props, 'div' > ) {
47
47
  gap: spacing,
48
48
  };
49
49
 
50
- const flexProps = useFlex( propsForFlex );
50
+ // Omit `isColumn` because it's not used in HStack.
51
+ const { isColumn, ...flexProps } = useFlex( propsForFlex );
51
52
 
52
53
  return flexProps;
53
54
  }
@@ -39,4 +39,14 @@ describe( 'props', () => {
39
39
  );
40
40
  expect( container ).toMatchSnapshot();
41
41
  } );
42
+
43
+ test( 'should not pass through invalid props to the `as` component', () => {
44
+ const AsComponent = ( props: JSX.IntrinsicElements[ 'div' ] ) => {
45
+ return <div { ...props } />;
46
+ };
47
+
48
+ render( <HStack as={ AsComponent }>foobar</HStack> );
49
+
50
+ expect( console ).not.toHaveErrored();
51
+ } );
42
52
  } );
@@ -25,7 +25,7 @@ function Example() {
25
25
 
26
26
  For a complete list of those props, check out [`Text`](/packages/components/src/text/README.md#props).
27
27
 
28
- ##### `level`: `1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'`
28
+ ### `level`: `1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'`
29
29
 
30
30
  Passing any of the heading levels to `level` will both render the correct typographic text size as well as the semantic element corresponding to the level (`h1` for `1` for example).
31
31
 
@@ -3,7 +3,7 @@
3
3
  exports[`props should render correctly 1`] = `
4
4
  .emotion-0 {
5
5
  color: #1e1e1e;
6
- line-height: 1.2;
6
+ line-height: 1.4;
7
7
  margin: 0;
8
8
  color: #1e1e1e;
9
9
  font-size: calc(1.95 * 13px);
@@ -32,7 +32,7 @@ Snapshot Diff:
32
32
  - "font-size": "calc(1.25 * 13px)",
33
33
  + "font-size": "calc(1.95 * 13px)",
34
34
  "font-weight": "600",
35
- "line-height": "1.2",
35
+ "line-height": "1.4",
36
36
  "margin": "0",
37
37
  },
38
38
  ]
@@ -50,7 +50,7 @@ Snapshot Diff:
50
50
  - "font-size": "calc(1.25 * 13px)",
51
51
  + "font-size": "calc(1.95 * 13px)",
52
52
  "font-weight": "600",
53
- "line-height": "1.2",
53
+ "line-height": "1.4",
54
54
  "margin": "0",
55
55
  },
56
56
  ]
@@ -10,7 +10,7 @@ InputControl components let users enter and edit text. This is an experimental c
10
10
 
11
11
  ```js
12
12
  import { __experimentalInputControl as InputControl } from '@wordpress/components';
13
- import { useState } from '@wordpress/compose';
13
+ import { useState } from 'react';
14
14
 
15
15
  const Example = () => {
16
16
  const [ value, setValue ] = useState( '' );
@@ -126,7 +126,7 @@ export function UnforwardedInputControl(
126
126
  *
127
127
  * ```jsx
128
128
  * import { __experimentalInputControl as InputControl } from '@wordpress/components';
129
- * import { useState } from '@wordpress/compose';
129
+ * import { useState } from 'react';
130
130
  *
131
131
  * const Example = () => {
132
132
  * const [ value, setValue ] = useState( '' );
@@ -25,6 +25,7 @@ const meta: Meta< typeof InputControl > = {
25
25
  value: { control: { disable: true } },
26
26
  },
27
27
  parameters: {
28
+ actions: { argTypesRegex: '^on.*' },
28
29
  controls: { expanded: true },
29
30
  docs: { canvas: { sourceState: 'shown' } },
30
31
  },
@@ -11,8 +11,8 @@ Snapshot Diff:
11
11
  role="listitem"
12
12
  >
13
13
  <div
14
- - class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
15
- + class="components-item css-17haj95-View-large-item-spacedAround e19lxcc00"
14
+ - class="components-item css-1n28wmo-View-medium-item-spacedAround e19lxcc00"
15
+ + class="components-item css-gg7ygh-View-large-item-spacedAround e19lxcc00"
16
16
  data-wp-c16t="true"
17
17
  data-wp-component="Item"
18
18
  >
@@ -24,8 +24,8 @@ Snapshot Diff:
24
24
  role="listitem"
25
25
  >
26
26
  <div
27
- - class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
28
- + class="components-item css-17haj95-View-large-item-spacedAround e19lxcc00"
27
+ - class="components-item css-1n28wmo-View-medium-item-spacedAround e19lxcc00"
28
+ + class="components-item css-gg7ygh-View-large-item-spacedAround e19lxcc00"
29
29
  data-wp-c16t="true"
30
30
  data-wp-component="Item"
31
31
  >
@@ -44,8 +44,8 @@ Snapshot Diff:
44
44
  role="listitem"
45
45
  >
46
46
  <div
47
- - class="components-item css-cl593w-View-medium-item e19lxcc00"
48
- + class="components-item css-1yvqxd-View-large-item e19lxcc00"
47
+ - class="components-item css-1lf4kzd-View-medium-item e19lxcc00"
48
+ + class="components-item css-1vv4aem-View-large-item e19lxcc00"
49
49
  data-wp-c16t="true"
50
50
  data-wp-component="Item"
51
51
  >
@@ -74,7 +74,7 @@ exports[`ItemGroup ItemGroup component should render correctly 1`] = `
74
74
  }
75
75
 
76
76
  .emotion-3 {
77
- padding: calc((36px - calc(13px * 1.2) - 2px) / 2) 12px;
77
+ padding: calc((36px - calc(13px * 1.4) - 2px) / 2) 12px;
78
78
  box-sizing: border-box;
79
79
  width: 100%;
80
80
  display: block;
@@ -125,8 +125,8 @@ Snapshot Diff:
125
125
  role="listitem"
126
126
  >
127
127
  <div
128
- - class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
129
- + class="components-item css-cl593w-View-medium-item e19lxcc00"
128
+ - class="components-item css-1n28wmo-View-medium-item-spacedAround e19lxcc00"
129
+ + class="components-item css-1lf4kzd-View-medium-item e19lxcc00"
130
130
  data-wp-c16t="true"
131
131
  data-wp-component="Item"
132
132
  >
@@ -153,8 +153,8 @@ Snapshot Diff:
153
153
  role="listitem"
154
154
  >
155
155
  <div
156
- - class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
157
- + class="components-item css-cl593w-View-medium-item e19lxcc00"
156
+ - class="components-item css-1n28wmo-View-medium-item-spacedAround e19lxcc00"
157
+ + class="components-item css-1lf4kzd-View-medium-item e19lxcc00"
158
158
  data-wp-c16t="true"
159
159
  data-wp-component="Item"
160
160
  >
@@ -29,7 +29,7 @@ describe( 'ItemGroup', () => {
29
29
  );
30
30
 
31
31
  const { container: withBorders } = render(
32
- <ItemGroup isBordered={ true }>
32
+ <ItemGroup isBordered>
33
33
  <Item>Code is poetry</Item>
34
34
  </ItemGroup>
35
35
  );
@@ -63,7 +63,7 @@ describe( 'ItemGroup', () => {
63
63
  );
64
64
 
65
65
  const { container: separatedItems } = render(
66
- <ItemGroup isSeparated={ true }>
66
+ <ItemGroup isSeparated>
67
67
  <Item>Code is poetry</Item>
68
68
  </ItemGroup>
69
69
  );