@wordpress/components 19.11.0 → 19.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -1
  3. package/build/alignment-matrix-control/index.js +5 -2
  4. package/build/alignment-matrix-control/index.js.map +1 -1
  5. package/build/autocomplete/autocompleter-ui.js +1 -1
  6. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  7. package/build/autocomplete/autocompleter-ui.native.js +2 -2
  8. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  9. package/build/autocomplete/index.js +12 -10
  10. package/build/autocomplete/index.js.map +1 -1
  11. package/build/border-box-control/border-box-control/hook.js +2 -2
  12. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  13. package/build/border-box-control/border-box-control-split-controls/component.js +2 -0
  14. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  15. package/build/border-box-control/border-box-control-split-controls/hook.js +13 -4
  16. package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  17. package/build/border-box-control/border-box-control-visualizer/hook.js +6 -2
  18. package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  19. package/build/border-box-control/styles.js +21 -11
  20. package/build/border-box-control/styles.js.map +1 -1
  21. package/build/border-control/border-control/hook.js +2 -2
  22. package/build/border-control/border-control/hook.js.map +1 -1
  23. package/build/color-palette/index.js +9 -2
  24. package/build/color-palette/index.js.map +1 -1
  25. package/build/color-palette/index.native.js +4 -1
  26. package/build/color-palette/index.native.js.map +1 -1
  27. package/build/color-picker/color-copy-button.js +87 -0
  28. package/build/color-picker/color-copy-button.js.map +1 -0
  29. package/build/color-picker/component.js +5 -15
  30. package/build/color-picker/component.js.map +1 -1
  31. package/build/color-picker/hex-input.js +18 -1
  32. package/build/color-picker/hex-input.js.map +1 -1
  33. package/build/color-picker/styles.js +11 -11
  34. package/build/color-picker/styles.js.map +1 -1
  35. package/build/custom-gradient-picker/utils.js +1 -1
  36. package/build/custom-gradient-picker/utils.js.map +1 -1
  37. package/build/date-time/{date.js → date/index.js} +51 -12
  38. package/build/date-time/date/index.js.map +1 -0
  39. package/build/date-time/date/styles.js +70 -0
  40. package/build/date-time/date/styles.js.map +1 -0
  41. package/build/date-time/{utils.js → date/utils.js} +0 -0
  42. package/build/date-time/date/utils.js.map +1 -0
  43. package/build/date-time/date-time/index.js +175 -0
  44. package/build/date-time/date-time/index.js.map +1 -0
  45. package/build/date-time/date-time/styles.js +32 -0
  46. package/build/date-time/date-time/styles.js.map +1 -0
  47. package/build/date-time/index.js +2 -109
  48. package/build/date-time/index.js.map +1 -1
  49. package/build/date-time/time/index.js +322 -0
  50. package/build/date-time/time/index.js.map +1 -0
  51. package/build/date-time/time/styles.js +139 -0
  52. package/build/date-time/time/styles.js.map +1 -0
  53. package/build/date-time/{timezone.js → time/timezone.js} +4 -2
  54. package/build/date-time/time/timezone.js.map +1 -0
  55. package/build/draggable/index.native.js +10 -5
  56. package/build/draggable/index.native.js.map +1 -1
  57. package/build/dropdown/index.js +4 -1
  58. package/build/dropdown/index.js.map +1 -1
  59. package/build/input-control/index.js +9 -4
  60. package/build/input-control/index.js.map +1 -1
  61. package/build/input-control/input-field.js +1 -26
  62. package/build/input-control/input-field.js.map +1 -1
  63. package/build/input-control/reducer/reducer.js +36 -24
  64. package/build/input-control/reducer/reducer.js.map +1 -1
  65. package/build/input-control/reducer/state.js +0 -1
  66. package/build/input-control/reducer/state.js.map +1 -1
  67. package/build/input-control/utils.js +45 -0
  68. package/build/input-control/utils.js.map +1 -1
  69. package/build/popover/index.js +40 -33
  70. package/build/popover/index.js.map +1 -1
  71. package/build/search-control/index.js +4 -6
  72. package/build/search-control/index.js.map +1 -1
  73. package/build/select-control/index.js +3 -1
  74. package/build/select-control/index.js.map +1 -1
  75. package/build/spacer/hook.js +11 -3
  76. package/build/spacer/hook.js.map +1 -1
  77. package/build/surface/component.js +7 -7
  78. package/build/surface/component.js.map +1 -1
  79. package/build/surface/hook.js +8 -11
  80. package/build/surface/hook.js.map +1 -1
  81. package/build/surface/index.js.map +1 -1
  82. package/build/surface/styles.js +8 -48
  83. package/build/surface/styles.js.map +1 -1
  84. package/build/textarea-control/index.js +40 -6
  85. package/build/textarea-control/index.js.map +1 -1
  86. package/build/textarea-control/styles/textarea-control-styles.js +3 -3
  87. package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
  88. package/build/textarea-control/types.js +6 -0
  89. package/build/textarea-control/types.js.map +1 -0
  90. package/build/utils/hooks/index.js +0 -8
  91. package/build/utils/hooks/index.js.map +1 -1
  92. package/build-module/alignment-matrix-control/index.js +5 -2
  93. package/build-module/alignment-matrix-control/index.js.map +1 -1
  94. package/build-module/autocomplete/autocompleter-ui.js +1 -1
  95. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  96. package/build-module/autocomplete/autocompleter-ui.native.js +2 -2
  97. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  98. package/build-module/autocomplete/index.js +13 -11
  99. package/build-module/autocomplete/index.js.map +1 -1
  100. package/build-module/border-box-control/border-box-control/hook.js +2 -2
  101. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  102. package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -0
  103. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  104. package/build-module/border-box-control/border-box-control-split-controls/hook.js +11 -4
  105. package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
  106. package/build-module/border-box-control/border-box-control-visualizer/hook.js +4 -2
  107. package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
  108. package/build-module/border-box-control/styles.js +13 -8
  109. package/build-module/border-box-control/styles.js.map +1 -1
  110. package/build-module/border-control/border-control/hook.js +2 -2
  111. package/build-module/border-control/border-control/hook.js.map +1 -1
  112. package/build-module/color-palette/index.js +7 -5
  113. package/build-module/color-palette/index.js.map +1 -1
  114. package/build-module/color-palette/index.native.js +4 -1
  115. package/build-module/color-palette/index.native.js.map +1 -1
  116. package/build-module/color-picker/color-copy-button.js +73 -0
  117. package/build-module/color-picker/color-copy-button.js.map +1 -0
  118. package/build-module/color-picker/component.js +6 -15
  119. package/build-module/color-picker/component.js.map +1 -1
  120. package/build-module/color-picker/hex-input.js +18 -1
  121. package/build-module/color-picker/hex-input.js.map +1 -1
  122. package/build-module/color-picker/styles.js +9 -9
  123. package/build-module/color-picker/styles.js.map +1 -1
  124. package/build-module/custom-gradient-picker/utils.js +1 -1
  125. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  126. package/build-module/date-time/{date.js → date/index.js} +46 -14
  127. package/build-module/date-time/date/index.js.map +1 -0
  128. package/build-module/date-time/date/styles.js +61 -0
  129. package/build-module/date-time/date/styles.js.map +1 -0
  130. package/build-module/date-time/{utils.js → date/utils.js} +0 -0
  131. package/build-module/date-time/date/utils.js.map +1 -0
  132. package/build-module/date-time/date-time/index.js +144 -0
  133. package/build-module/date-time/date-time/index.js.map +1 -0
  134. package/build-module/date-time/date-time/styles.js +22 -0
  135. package/build-module/date-time/date-time/styles.js.map +1 -0
  136. package/build-module/date-time/index.js +1 -105
  137. package/build-module/date-time/index.js.map +1 -1
  138. package/build-module/date-time/time/index.js +302 -0
  139. package/build-module/date-time/time/index.js.map +1 -0
  140. package/build-module/date-time/time/styles.js +118 -0
  141. package/build-module/date-time/time/styles.js.map +1 -0
  142. package/build-module/date-time/{timezone.js → time/timezone.js} +3 -2
  143. package/build-module/date-time/time/timezone.js.map +1 -0
  144. package/build-module/draggable/index.native.js +10 -5
  145. package/build-module/draggable/index.native.js.map +1 -1
  146. package/build-module/dropdown/index.js +4 -1
  147. package/build-module/dropdown/index.js.map +1 -1
  148. package/build-module/input-control/index.js +8 -4
  149. package/build-module/input-control/index.js.map +1 -1
  150. package/build-module/input-control/input-field.js +1 -25
  151. package/build-module/input-control/input-field.js.map +1 -1
  152. package/build-module/input-control/reducer/reducer.js +38 -26
  153. package/build-module/input-control/reducer/reducer.js.map +1 -1
  154. package/build-module/input-control/reducer/state.js +0 -1
  155. package/build-module/input-control/reducer/state.js.map +1 -1
  156. package/build-module/input-control/utils.js +48 -2
  157. package/build-module/input-control/utils.js.map +1 -1
  158. package/build-module/popover/index.js +40 -33
  159. package/build-module/popover/index.js.map +1 -1
  160. package/build-module/search-control/index.js +6 -7
  161. package/build-module/search-control/index.js.map +1 -1
  162. package/build-module/select-control/index.js +3 -1
  163. package/build-module/select-control/index.js.map +1 -1
  164. package/build-module/spacer/hook.js +10 -2
  165. package/build-module/spacer/hook.js.map +1 -1
  166. package/build-module/surface/component.js +7 -7
  167. package/build-module/surface/component.js.map +1 -1
  168. package/build-module/surface/hook.js +8 -11
  169. package/build-module/surface/hook.js.map +1 -1
  170. package/build-module/surface/index.js.map +1 -1
  171. package/build-module/surface/styles.js +8 -48
  172. package/build-module/surface/styles.js.map +1 -1
  173. package/build-module/textarea-control/index.js +36 -5
  174. package/build-module/textarea-control/index.js.map +1 -1
  175. package/build-module/textarea-control/styles/textarea-control-styles.js +3 -3
  176. package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
  177. package/build-module/textarea-control/types.js +2 -0
  178. package/build-module/textarea-control/types.js.map +1 -0
  179. package/build-module/utils/hooks/index.js +0 -1
  180. package/build-module/utils/hooks/index.js.map +1 -1
  181. package/build-style/style-rtl.css +13 -188
  182. package/build-style/style.css +13 -191
  183. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  184. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -0
  185. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  186. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  187. package/build-types/border-box-control/styles.d.ts +3 -2
  188. package/build-types/border-box-control/styles.d.ts.map +1 -1
  189. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  190. package/build-types/card/types.d.ts +1 -1
  191. package/build-types/card/types.d.ts.map +1 -1
  192. package/build-types/checkbox-control/test/index.d.ts +2 -0
  193. package/build-types/checkbox-control/test/index.d.ts.map +1 -0
  194. package/build-types/color-palette/index.d.ts +1 -0
  195. package/build-types/color-palette/index.d.ts.map +1 -1
  196. package/build-types/{date-time → color-palette}/test/utils.d.ts +0 -0
  197. package/build-types/color-palette/test/utils.d.ts.map +1 -0
  198. package/build-types/color-picker/color-copy-button.d.ts +4 -0
  199. package/build-types/color-picker/color-copy-button.d.ts.map +1 -0
  200. package/build-types/color-picker/component.d.ts.map +1 -1
  201. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  202. package/build-types/color-picker/styles.d.ts +1 -1
  203. package/build-types/color-picker/styles.d.ts.map +1 -1
  204. package/build-types/color-picker/types.d.ts +8 -0
  205. package/build-types/color-picker/types.d.ts.map +1 -1
  206. package/build-types/date-time/{date.d.ts → date/index.d.ts} +3 -2
  207. package/build-types/date-time/date/index.d.ts.map +1 -0
  208. package/build-types/date-time/date/styles.d.ts +23 -0
  209. package/build-types/date-time/date/styles.d.ts.map +1 -0
  210. package/build-types/date-time/date/test/index.d.ts +2 -0
  211. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  212. package/build-types/date-time/date/test/utils.d.ts +2 -0
  213. package/build-types/date-time/date/test/utils.d.ts.map +1 -0
  214. package/build-types/date-time/{utils.d.ts → date/utils.d.ts} +0 -0
  215. package/build-types/date-time/date/utils.d.ts.map +1 -0
  216. package/build-types/date-time/date-time/index.d.ts +33 -0
  217. package/build-types/date-time/date-time/index.d.ts.map +1 -0
  218. package/build-types/date-time/date-time/styles.d.ts +6 -0
  219. package/build-types/date-time/date-time/styles.d.ts.map +1 -0
  220. package/build-types/date-time/index.d.ts +2 -28
  221. package/build-types/date-time/index.d.ts.map +1 -1
  222. package/build-types/date-time/stories/{index.d.ts → date-time.d.ts} +2 -2
  223. package/build-types/date-time/stories/date-time.d.ts.map +1 -0
  224. package/build-types/date-time/{time.d.ts → time/index.d.ts} +2 -2
  225. package/build-types/date-time/time/index.d.ts.map +1 -0
  226. package/build-types/date-time/time/styles.d.ts +111 -0
  227. package/build-types/date-time/time/styles.d.ts.map +1 -0
  228. package/build-types/date-time/time/test/index.d.ts +2 -0
  229. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  230. package/build-types/date-time/{timezone.d.ts → time/timezone.d.ts} +0 -0
  231. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  232. package/build-types/date-time/types.d.ts +14 -15
  233. package/build-types/date-time/types.d.ts.map +1 -1
  234. package/build-types/dropdown/index.d.ts.map +1 -1
  235. package/build-types/input-control/index.d.ts.map +1 -1
  236. package/build-types/input-control/input-field.d.ts.map +1 -1
  237. package/build-types/input-control/reducer/reducer.d.ts +5 -3
  238. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  239. package/build-types/input-control/reducer/state.d.ts +2 -2
  240. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  241. package/build-types/input-control/utils.d.ts +17 -0
  242. package/build-types/input-control/utils.d.ts.map +1 -1
  243. package/build-types/popover/index.d.ts +1 -0
  244. package/build-types/popover/index.d.ts.map +1 -1
  245. package/build-types/select-control/index.d.ts.map +1 -1
  246. package/build-types/select-control/types.d.ts +1 -1
  247. package/build-types/select-control/types.d.ts.map +1 -1
  248. package/build-types/surface/component.d.ts +3 -2
  249. package/build-types/surface/component.d.ts.map +1 -1
  250. package/build-types/surface/hook.d.ts +4 -4
  251. package/build-types/surface/hook.d.ts.map +1 -1
  252. package/build-types/surface/index.d.ts +2 -2
  253. package/build-types/surface/index.d.ts.map +1 -1
  254. package/build-types/surface/stories/index.d.ts +12 -0
  255. package/build-types/surface/stories/index.d.ts.map +1 -0
  256. package/build-types/surface/styles.d.ts +10 -21
  257. package/build-types/surface/styles.d.ts.map +1 -1
  258. package/build-types/surface/test/index.d.ts +2 -0
  259. package/build-types/surface/test/index.d.ts.map +1 -0
  260. package/build-types/surface/types.d.ts +1 -1
  261. package/build-types/surface/types.d.ts.map +1 -1
  262. package/build-types/textarea-control/index.d.ts +29 -0
  263. package/build-types/textarea-control/index.d.ts.map +1 -0
  264. package/build-types/textarea-control/stories/index.d.ts +12 -0
  265. package/build-types/textarea-control/stories/index.d.ts.map +1 -0
  266. package/build-types/textarea-control/styles/textarea-control-styles.d.ts +6 -0
  267. package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -0
  268. package/build-types/textarea-control/types.d.ts +26 -0
  269. package/build-types/textarea-control/types.d.ts.map +1 -0
  270. package/build-types/utils/hooks/index.d.ts +0 -1
  271. package/package.json +18 -18
  272. package/src/alignment-matrix-control/index.js +4 -2
  273. package/src/autocomplete/autocompleter-ui.js +1 -1
  274. package/src/autocomplete/autocompleter-ui.native.js +2 -2
  275. package/src/autocomplete/index.js +21 -9
  276. package/src/border-box-control/border-box-control/hook.ts +2 -2
  277. package/src/border-box-control/border-box-control-split-controls/component.tsx +2 -0
  278. package/src/border-box-control/border-box-control-split-controls/hook.ts +18 -4
  279. package/src/border-box-control/border-box-control-visualizer/hook.ts +5 -2
  280. package/src/border-box-control/styles.ts +6 -2
  281. package/src/border-control/border-control/hook.ts +8 -2
  282. package/src/box-control/test/index.js +120 -109
  283. package/src/card/types.ts +1 -1
  284. package/src/checkbox-control/test/__snapshots__/index.tsx.snap +42 -0
  285. package/src/checkbox-control/test/index.tsx +109 -0
  286. package/src/color-palette/index.js +11 -4
  287. package/src/color-palette/index.native.js +3 -0
  288. package/src/color-palette/stories/index.js +25 -1
  289. package/src/color-palette/test/utils.ts +24 -0
  290. package/src/color-picker/color-copy-button.tsx +76 -0
  291. package/src/color-picker/component.tsx +18 -38
  292. package/src/color-picker/hex-input.tsx +16 -0
  293. package/src/color-picker/styles.ts +5 -1
  294. package/src/color-picker/types.ts +9 -0
  295. package/src/custom-gradient-picker/utils.js +1 -1
  296. package/src/date-time/README.md +16 -0
  297. package/src/date-time/{datepicker.scss → date/datepicker.scss} +0 -0
  298. package/src/date-time/{date.tsx → date/index.tsx} +38 -15
  299. package/src/date-time/date/style.scss +75 -0
  300. package/src/date-time/date/styles.ts +55 -0
  301. package/src/date-time/{test/date.tsx → date/test/index.tsx} +1 -1
  302. package/src/date-time/{test → date/test}/utils.ts +0 -0
  303. package/src/date-time/{utils.ts → date/utils.ts} +0 -0
  304. package/src/date-time/date-time/index.tsx +217 -0
  305. package/src/date-time/date-time/styles.ts +8 -0
  306. package/src/date-time/index.ts +9 -0
  307. package/src/date-time/stories/{index.tsx → date-time.tsx} +1 -1
  308. package/src/date-time/style.scss +1 -262
  309. package/src/date-time/time/index.tsx +356 -0
  310. package/src/date-time/time/styles.ts +119 -0
  311. package/src/date-time/{test/time.tsx → time/test/index.tsx} +85 -38
  312. package/src/date-time/{timezone.tsx → time/timezone.tsx} +5 -2
  313. package/src/date-time/types.ts +16 -18
  314. package/src/draggable/index.native.js +14 -3
  315. package/src/draggable/test/index.native.js +130 -0
  316. package/src/dropdown/index.js +5 -1
  317. package/src/input-control/index.tsx +8 -2
  318. package/src/input-control/input-field.tsx +10 -30
  319. package/src/input-control/reducer/reducer.ts +40 -26
  320. package/src/input-control/reducer/state.ts +2 -3
  321. package/src/input-control/utils.ts +55 -1
  322. package/src/popover/index.js +42 -27
  323. package/src/query-controls/README.md +1 -1
  324. package/src/search-control/index.js +6 -7
  325. package/src/select-control/README.md +11 -0
  326. package/src/select-control/index.tsx +6 -1
  327. package/src/select-control/types.ts +1 -1
  328. package/src/slot-fill/README.md +1 -1
  329. package/src/spacer/hook.ts +13 -13
  330. package/src/surface/README.md +15 -15
  331. package/src/surface/{component.js → component.tsx} +13 -7
  332. package/src/surface/{hook.js → hook.ts} +13 -12
  333. package/src/surface/{index.js → index.ts} +0 -0
  334. package/src/surface/stories/index.tsx +40 -0
  335. package/src/surface/{styles.js → styles.ts} +15 -44
  336. package/src/surface/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  337. package/src/surface/test/{index.js → index.tsx} +2 -1
  338. package/src/surface/types.ts +1 -1
  339. package/src/textarea-control/README.md +14 -20
  340. package/src/textarea-control/index.tsx +86 -0
  341. package/src/textarea-control/stories/index.tsx +58 -0
  342. package/src/textarea-control/styles/{textarea-control-styles.js → textarea-control-styles.ts} +0 -0
  343. package/src/textarea-control/types.ts +30 -0
  344. package/src/utils/hooks/index.js +0 -1
  345. package/tsconfig.json +1 -0
  346. package/tsconfig.tsbuildinfo +1 -1
  347. package/build/color-picker/color-display.js +0 -184
  348. package/build/color-picker/color-display.js.map +0 -1
  349. package/build/date-time/date.js.map +0 -1
  350. package/build/date-time/time.js +0 -289
  351. package/build/date-time/time.js.map +0 -1
  352. package/build/date-time/timezone.js.map +0 -1
  353. package/build/date-time/utils.js.map +0 -1
  354. package/build/utils/hooks/use-combined-ref.js +0 -32
  355. package/build/utils/hooks/use-combined-ref.js.map +0 -1
  356. package/build-module/color-picker/color-display.js +0 -170
  357. package/build-module/color-picker/color-display.js.map +0 -1
  358. package/build-module/date-time/date.js.map +0 -1
  359. package/build-module/date-time/time.js +0 -271
  360. package/build-module/date-time/time.js.map +0 -1
  361. package/build-module/date-time/timezone.js.map +0 -1
  362. package/build-module/date-time/utils.js.map +0 -1
  363. package/build-module/utils/hooks/use-combined-ref.js +0 -28
  364. package/build-module/utils/hooks/use-combined-ref.js.map +0 -1
  365. package/build-types/color-picker/color-display.d.ts +0 -14
  366. package/build-types/color-picker/color-display.d.ts.map +0 -1
  367. package/build-types/date-time/date.d.ts.map +0 -1
  368. package/build-types/date-time/stories/index.d.ts.map +0 -1
  369. package/build-types/date-time/test/date.d.ts +0 -2
  370. package/build-types/date-time/test/date.d.ts.map +0 -1
  371. package/build-types/date-time/test/time.d.ts +0 -2
  372. package/build-types/date-time/test/time.d.ts.map +0 -1
  373. package/build-types/date-time/test/utils.d.ts.map +0 -1
  374. package/build-types/date-time/time.d.ts.map +0 -1
  375. package/build-types/date-time/timezone.d.ts.map +0 -1
  376. package/build-types/date-time/utils.d.ts.map +0 -1
  377. package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
  378. package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
  379. package/src/color-picker/color-display.tsx +0 -169
  380. package/src/date-time/index.tsx +0 -196
  381. package/src/date-time/time.tsx +0 -321
  382. package/src/surface/stories/index.js +0 -46
  383. package/src/textarea-control/index.js +0 -45
  384. package/src/textarea-control/stories/index.js +0 -48
  385. package/src/utils/hooks/use-combined-ref.ts +0 -28
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { SyntheticEvent } from 'react';
4
+ import type { SyntheticEvent, ChangeEvent, PointerEvent } from 'react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useReducer } from '@wordpress/element';
9
+ import { useReducer, useLayoutEffect, useRef } from '@wordpress/element';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
@@ -18,6 +18,7 @@ import {
18
18
  initialStateReducer,
19
19
  } from './state';
20
20
  import * as actions from './actions';
21
+ import type { InputChangeCallback } from '../types';
21
22
 
22
23
  /**
23
24
  * Prepares initialState for the reducer.
@@ -108,9 +109,7 @@ function inputControlStateReducer(
108
109
  break;
109
110
  }
110
111
 
111
- if ( action.payload.event ) {
112
- nextState._event = action.payload.event;
113
- }
112
+ nextState._event = action.payload.event;
114
113
 
115
114
  /**
116
115
  * Send the nextState + action to the composedReducers via
@@ -131,13 +130,15 @@ function inputControlStateReducer(
131
130
  * This technique uses the "stateReducer" design pattern:
132
131
  * https://kentcdodds.com/blog/the-state-reducer-pattern/
133
132
  *
134
- * @param stateReducer An external state reducer.
135
- * @param initialState The initial state for the reducer.
133
+ * @param stateReducer An external state reducer.
134
+ * @param initialState The initial state for the reducer.
135
+ * @param onChangeHandler A handler for the onChange event.
136
136
  * @return State, dispatch, and a collection of actions.
137
137
  */
138
138
  export function useInputControlStateReducer(
139
139
  stateReducer: StateReducer = initialStateReducer,
140
- initialState: Partial< InputState > = initialInputControlState
140
+ initialState: Partial< InputState > = initialInputControlState,
141
+ onChangeHandler: InputChangeCallback
141
142
  ) {
142
143
  const [ state, dispatch ] = useReducer< StateReducer >(
143
144
  inputControlStateReducer( stateReducer ),
@@ -148,15 +149,6 @@ export function useInputControlStateReducer(
148
149
  nextValue: actions.ChangeEventAction[ 'payload' ][ 'value' ],
149
150
  event: actions.ChangeEventAction[ 'payload' ][ 'event' ]
150
151
  ) => {
151
- /**
152
- * Persist allows for the (Synthetic) event to be used outside of
153
- * this function call.
154
- * https://reactjs.org/docs/events.html#event-pooling
155
- */
156
- if ( event && event.persist ) {
157
- event.persist();
158
- }
159
-
160
152
  dispatch( {
161
153
  type,
162
154
  payload: { value: nextValue, event },
@@ -166,15 +158,6 @@ export function useInputControlStateReducer(
166
158
  const createKeyEvent = ( type: actions.KeyEventAction[ 'type' ] ) => (
167
159
  event: actions.KeyEventAction[ 'payload' ][ 'event' ]
168
160
  ) => {
169
- /**
170
- * Persist allows for the (Synthetic) event to be used outside of
171
- * this function call.
172
- * https://reactjs.org/docs/events.html#event-pooling
173
- */
174
- if ( event && event.persist ) {
175
- event.persist();
176
- }
177
-
178
161
  dispatch( { type, payload: { event } } );
179
162
  };
180
163
 
@@ -201,6 +184,37 @@ export function useInputControlStateReducer(
201
184
  const pressDown = createKeyEvent( actions.PRESS_DOWN );
202
185
  const pressEnter = createKeyEvent( actions.PRESS_ENTER );
203
186
 
187
+ const currentState = useRef( state );
188
+ const refProps = useRef( { value: initialState.value, onChangeHandler } );
189
+ useLayoutEffect( () => {
190
+ currentState.current = state;
191
+ refProps.current = { value: initialState.value, onChangeHandler };
192
+ } );
193
+ useLayoutEffect( () => {
194
+ if (
195
+ currentState.current._event !== undefined &&
196
+ state.value !== refProps.current.value &&
197
+ ! state.isDirty
198
+ ) {
199
+ refProps.current.onChangeHandler( state.value ?? '', {
200
+ event: currentState.current._event as
201
+ | ChangeEvent< HTMLInputElement >
202
+ | PointerEvent< HTMLInputElement >,
203
+ } );
204
+ }
205
+ }, [ state.value, state.isDirty ] );
206
+ useLayoutEffect( () => {
207
+ if (
208
+ initialState.value !== currentState.current.value &&
209
+ ! currentState.current.isDirty
210
+ ) {
211
+ dispatch( {
212
+ type: actions.RESET,
213
+ payload: { value: initialState.value },
214
+ } );
215
+ }
216
+ }, [ initialState.value ] );
217
+
204
218
  return {
205
219
  change,
206
220
  commit,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { Reducer } from 'react';
4
+ import type { Reducer, SyntheticEvent } from 'react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -9,7 +9,7 @@ import type { Reducer } from 'react';
9
9
  import type { InputAction } from './actions';
10
10
 
11
11
  export interface InputState {
12
- _event: Event | {};
12
+ _event?: SyntheticEvent;
13
13
  error: unknown;
14
14
  initialValue?: string;
15
15
  isDirty: boolean;
@@ -24,7 +24,6 @@ export type StateReducer = Reducer< InputState, InputAction >;
24
24
  export const initialStateReducer: StateReducer = ( state: InputState ) => state;
25
25
 
26
26
  export const initialInputControlState: InputState = {
27
- _event: {},
28
27
  error: null,
29
28
  initialValue: '',
30
29
  isDirty: false,
@@ -1,7 +1,22 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { FocusEventHandler } from 'react';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
- import { useEffect } from '@wordpress/element';
9
+ import {
10
+ useEffect,
11
+ useLayoutEffect,
12
+ useRef,
13
+ useState,
14
+ } from '@wordpress/element';
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+ import type { InputChangeCallback } from './types';
5
20
 
6
21
  /**
7
22
  * Gets a CSS cursor value based on a drag direction.
@@ -52,3 +67,42 @@ export function useDragCursor(
52
67
 
53
68
  return dragCursor;
54
69
  }
70
+
71
+ export function useDraft( props: {
72
+ value: string | undefined;
73
+ onBlur?: FocusEventHandler;
74
+ onChange: InputChangeCallback;
75
+ } ) {
76
+ const refPreviousValue = useRef( props.value );
77
+ const [ draft, setDraft ] = useState< {
78
+ value?: string;
79
+ isStale?: boolean;
80
+ } >( {} );
81
+ const value = draft.value !== undefined ? draft.value : props.value;
82
+
83
+ // Determines when to discard the draft value to restore controlled status.
84
+ // To do so, it tracks the previous value and marks the draft value as stale
85
+ // after each render.
86
+ useLayoutEffect( () => {
87
+ const { current: previousValue } = refPreviousValue;
88
+ refPreviousValue.current = props.value;
89
+ if ( draft.value !== undefined && ! draft.isStale )
90
+ setDraft( { ...draft, isStale: true } );
91
+ else if ( draft.isStale && props.value !== previousValue )
92
+ setDraft( {} );
93
+ }, [ props.value, draft ] );
94
+
95
+ const onChange: InputChangeCallback = ( nextValue, extra ) => {
96
+ // Mutates the draft value to avoid an extra effect run.
97
+ setDraft( ( current ) =>
98
+ Object.assign( current, { value: nextValue, isStale: false } )
99
+ );
100
+ props.onChange( nextValue, extra );
101
+ };
102
+ const onBlur: FocusEventHandler = ( event ) => {
103
+ setDraft( {} );
104
+ props.onBlur?.( event );
105
+ };
106
+
107
+ return { value, onBlur, onChange };
108
+ }
@@ -115,6 +115,7 @@ const Popover = (
115
115
  __unstableSlotName = SLOT_NAME,
116
116
  __unstableObserveElement,
117
117
  __unstableForcePosition,
118
+ __unstableShift = false,
118
119
  ...contentProps
119
120
  },
120
121
  ref
@@ -134,26 +135,29 @@ const Popover = (
134
135
  ? positionToPlacement( position )
135
136
  : placement;
136
137
 
137
- /**
138
- * Offsets the the position of the popover when the anchor is inside an iframe.
139
- */
140
- const frameOffset = useMemo( () => {
141
- let ownerDocument = document;
138
+ const ownerDocument = useMemo( () => {
142
139
  if ( anchorRef?.top ) {
143
- ownerDocument = anchorRef?.top.ownerDocument;
140
+ return anchorRef?.top.ownerDocument;
144
141
  } else if ( anchorRef?.startContainer ) {
145
- ownerDocument = anchorRef.startContainer.ownerDocument;
142
+ return anchorRef.startContainer.ownerDocument;
146
143
  } else if ( anchorRef?.current ) {
147
- ownerDocument = anchorRef.current.ownerDocument;
144
+ return anchorRef.current.ownerDocument;
148
145
  } else if ( anchorRef ) {
149
146
  // This one should be deprecated.
150
- ownerDocument = anchorRef.ownerDocument;
147
+ return anchorRef.ownerDocument;
151
148
  } else if ( anchorRect && anchorRect?.ownerDocument ) {
152
- ownerDocument = anchorRect.ownerDocument;
149
+ return anchorRect.ownerDocument;
153
150
  } else if ( getAnchorRect ) {
154
- ownerDocument = getAnchorRect()?.ownerDocument ?? document;
151
+ return getAnchorRect()?.ownerDocument ?? document;
155
152
  }
156
153
 
154
+ return document;
155
+ }, [ anchorRef, anchorRect, getAnchorRect ] );
156
+
157
+ /**
158
+ * Offsets the the position of the popover when the anchor is inside an iframe.
159
+ */
160
+ const frameOffset = useMemo( () => {
157
161
  const { defaultView } = ownerDocument;
158
162
  const { frameElement } = defaultView;
159
163
 
@@ -171,7 +175,7 @@ const Popover = (
171
175
  };
172
176
  },
173
177
  };
174
- }, [ anchorRef, anchorRect, getAnchorRect ] );
178
+ }, [ ownerDocument ] );
175
179
 
176
180
  const middlewares = [
177
181
  frameOffset,
@@ -180,21 +184,23 @@ const Popover = (
180
184
  __unstableForcePosition
181
185
  ? undefined
182
186
  : size( {
183
- apply( { width, height } ) {
187
+ apply( sizeProps ) {
188
+ const { height } = sizeProps;
184
189
  if ( ! refs.floating.current ) return;
185
-
190
+ // Reduce the height of the popover to the available space.
186
191
  Object.assign( refs.floating.current.firstChild.style, {
187
- maxWidth: `${ width }px`,
188
192
  maxHeight: `${ height }px`,
189
193
  overflow: 'auto',
190
194
  } );
191
195
  },
192
196
  } ),
193
- ,
194
- shift( {
195
- crossAxis: true,
196
- limiter: limitShift(),
197
- } ),
197
+ __unstableShift
198
+ ? shift( {
199
+ crossAxis: true,
200
+ limiter: limitShift(),
201
+ padding: 1, // Necessary to avoid flickering at the edge of the viewport.
202
+ } )
203
+ : undefined,
198
204
  hasArrow ? arrow( { element: arrowRef } ) : undefined,
199
205
  ].filter( ( m ) => !! m );
200
206
  const anchorRefFallback = useRef( null );
@@ -270,13 +276,12 @@ const Popover = (
270
276
  usedRef = {
271
277
  getBoundingClientRect() {
272
278
  const rect = getAnchorRect();
273
- return {
274
- ...rect,
275
- x: rect.x ?? rect.left,
276
- y: rect.y ?? rect.top,
277
- height: rect.height ?? rect.bottom - rect.top,
278
- width: rect.width ?? rect.right - rect.left,
279
- };
279
+ return new window.DOMRect(
280
+ rect.x ?? rect.left,
281
+ rect.y ?? rect.top,
282
+ rect.width ?? rect.right - rect.left,
283
+ rect.height ?? rect.bottom - rect.top
284
+ );
280
285
  },
281
286
  };
282
287
  } else if ( anchorRefFallback.current ) {
@@ -309,6 +314,16 @@ const Popover = (
309
314
  };
310
315
  }, [ __unstableObserveElement ] );
311
316
 
317
+ // If we're using getAnchorRect, we need to update the position as we scroll the iframe.
318
+ useLayoutEffect( () => {
319
+ if ( ownerDocument === document ) {
320
+ return;
321
+ }
322
+
323
+ ownerDocument.addEventListener( 'scroll', update );
324
+ return () => ownerDocument.removeEventListener( 'scroll', update );
325
+ }, [ ownerDocument ] );
326
+
312
327
  /** @type {false | string} */
313
328
  const animateClassName =
314
329
  !! animate &&
@@ -179,7 +179,7 @@ A function that receives the new author value. If this is not specified, the aut
179
179
 
180
180
  #### onCategoryChange
181
181
 
182
- A function that receives the new author value. If this is not specified, the category controls are not included.
182
+ A function that receives the new category value. If this is not specified, the category controls are not included.
183
183
 
184
184
  - Type: `Function`
185
185
  - Required: No
@@ -6,17 +6,16 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useInstanceId } from '@wordpress/compose';
9
+ import { useInstanceId, useMergeRefs } from '@wordpress/compose';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { Icon, search, closeSmall } from '@wordpress/icons';
12
- import { forwardRef } from '@wordpress/element';
12
+ import { forwardRef, useRef } from '@wordpress/element';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
17
  import { Button } from '../';
18
18
  import BaseControl from '../base-control';
19
- import { useCombinedRef } from '../utils';
20
19
 
21
20
  function SearchControl(
22
21
  {
@@ -30,10 +29,10 @@ function SearchControl(
30
29
  help,
31
30
  onClose,
32
31
  },
33
- ref
32
+ forwardedRef
34
33
  ) {
34
+ const searchRef = useRef();
35
35
  const instanceId = useInstanceId( SearchControl );
36
- const searchInput = useCombinedRef( ref );
37
36
  const id = `components-search-control-${ instanceId }`;
38
37
 
39
38
  const renderRightButton = () => {
@@ -54,7 +53,7 @@ function SearchControl(
54
53
  label={ __( 'Reset search' ) }
55
54
  onClick={ () => {
56
55
  onChange( '' );
57
- searchInput.current.focus();
56
+ searchRef.current.focus();
58
57
  } }
59
58
  />
60
59
  );
@@ -73,7 +72,7 @@ function SearchControl(
73
72
  >
74
73
  <div className="components-search-control__input-wrapper">
75
74
  <input
76
- ref={ searchInput }
75
+ ref={ useMergeRefs( [ searchRef, forwardedRef ] ) }
77
76
  className="components-search-control__input"
78
77
  id={ id }
79
78
  type="search"
@@ -98,6 +98,7 @@ const MySelectControl = () => {
98
98
  { label: 'Small', value: '25%' },
99
99
  ] }
100
100
  onChange={ ( newSize ) => setSize( newSize ) }
101
+ __nextHasNoMarginBottom
101
102
  />
102
103
  );
103
104
  };
@@ -119,6 +120,7 @@ Render a user interface to select multiple users from a list.
119
120
  { value: 'b', label: 'User B' },
120
121
  { value: 'c', label: 'User c' },
121
122
  ] }
123
+ __nextHasNoMarginBottom
122
124
  />
123
125
  ```
124
126
 
@@ -133,6 +135,7 @@ const [ item, setItem ] = useState( '' );
133
135
  label={ __( 'Select an item:' ) }
134
136
  value={ item } // e.g: value = 'a'
135
137
  onChange={ ( selection ) => { setItem( selection ) } }
138
+ __nextHasNoMarginBottom
136
139
  >
137
140
  <optgroup label="Theropods">
138
141
  <option value="Tyrannosaurus">Tyrannosaurus</option>
@@ -215,6 +218,14 @@ If multiple is false the value received is a single value with the new selected
215
218
  - Type: `function`
216
219
  - Required: Yes
217
220
 
221
+ ### __nextHasNoMarginBottom
222
+
223
+ Start opting into the new margin-free styles that will become the default in a future version.
224
+
225
+ - Type: `Boolean`
226
+ - Required: No
227
+ - Default: `false`
228
+
218
229
  ## Related components
219
230
 
220
231
  - To select one option from a set, and you want to show them all the available options at once, use the `Radio` component.
@@ -47,6 +47,7 @@ function UnforwardedSelectControl(
47
47
  children,
48
48
  prefix,
49
49
  suffix,
50
+ __nextHasNoMarginBottom = false,
50
51
  ...props
51
52
  }: WordPressComponentProps< SelectControlProps, 'select', false >,
52
53
  ref: ForwardedRef< HTMLSelectElement >
@@ -85,7 +86,11 @@ function UnforwardedSelectControl(
85
86
 
86
87
  /* eslint-disable jsx-a11y/no-onchange */
87
88
  return (
88
- <BaseControl help={ help } id={ id }>
89
+ <BaseControl
90
+ help={ help }
91
+ id={ id }
92
+ __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
93
+ >
89
94
  <InputBase
90
95
  className={ classes }
91
96
  disabled={ disabled }
@@ -20,7 +20,7 @@ export interface SelectControlProps
20
20
  | 'size'
21
21
  | 'suffix'
22
22
  >,
23
- Pick< BaseControlProps, 'help' > {
23
+ Pick< BaseControlProps, 'help' | '__nextHasNoMarginBottom' > {
24
24
  /**
25
25
  * If this property is added, multiple values can be selected. The value passed should be an array.
26
26
  *
@@ -2,7 +2,7 @@
2
2
 
3
3
  Slot and Fill are a pair of components which enable developers to render elsewhere in a React element tree, a pattern often referred to as "portal" rendering. It is a pattern for component extensibility, where a single Slot may be occupied by an indeterminate number of Fills elsewhere in the application.
4
4
 
5
- Slot Fill is heavily inspired by the [`react-slot-fill` library](https://github.com/camwest/react-slot-fill), but uses React's own portal rendering API, exposed as an unstable API in React 16 and slated to be promoted to a stable API in React 17.
5
+ Slot Fill is heavily inspired by the [`react-slot-fill` library](https://github.com/camwest/react-slot-fill), but uses React's own portal rendering API.
6
6
 
7
7
  ## Usage
8
8
 
@@ -8,7 +8,7 @@ import { css } from '@emotion/react';
8
8
  */
9
9
  import { useContextSystem, WordPressComponentProps } from '../ui/context';
10
10
  import { space } from '../ui/utils/space';
11
- import { useCx } from '../utils/hooks/use-cx';
11
+ import { rtl, useCx } from '../utils';
12
12
  import type { Props } from './types';
13
13
 
14
14
  const isDefined = < T >( o: T ): o is Exclude< T, null | undefined > =>
@@ -60,13 +60,13 @@ export function useSpacer( props: WordPressComponentProps< Props, 'div' > ) {
60
60
  margin-bottom: ${ space( marginBottom ) };
61
61
  `,
62
62
  isDefined( marginLeft ) &&
63
- css`
64
- margin-left: ${ space( marginLeft ) };
65
- `,
63
+ rtl( {
64
+ marginLeft: space( marginLeft ),
65
+ } )(),
66
66
  isDefined( marginRight ) &&
67
- css`
68
- margin-right: ${ space( marginRight ) };
69
- `,
67
+ rtl( {
68
+ marginRight: space( marginRight ),
69
+ } )(),
70
70
  isDefined( padding ) &&
71
71
  css`
72
72
  padding: ${ space( padding ) };
@@ -90,13 +90,13 @@ export function useSpacer( props: WordPressComponentProps< Props, 'div' > ) {
90
90
  padding-bottom: ${ space( paddingBottom ) };
91
91
  `,
92
92
  isDefined( paddingLeft ) &&
93
- css`
94
- padding-left: ${ space( paddingLeft ) };
95
- `,
93
+ rtl( {
94
+ paddingLeft: space( paddingLeft ),
95
+ } )(),
96
96
  isDefined( paddingRight ) &&
97
- css`
98
- padding-right: ${ space( paddingRight ) };
99
- `,
97
+ rtl( {
98
+ paddingRight: space( paddingRight ),
99
+ } )(),
100
100
  className
101
101
  );
102
102
 
@@ -13,7 +13,7 @@ In the example below, notice how the `Surface` renders in white (or dark gray if
13
13
  ```jsx
14
14
  import {
15
15
  __experimentalSurface as Surface,
16
- __experimentalText as Text
16
+ __experimentalText as Text,
17
17
  } from '@wordpress/components';
18
18
 
19
19
  function Example() {
@@ -27,46 +27,46 @@ function Example() {
27
27
 
28
28
  ## Props
29
29
 
30
- ### `backgroundSize`: number
30
+ ### `backgroundSize`: `number`
31
31
 
32
- - Required: No
33
- - Default: `12`
32
+ - Required: No
33
+ - Default: `12`
34
34
 
35
35
  Determines the grid size for "dotted" and "grid" variants.
36
36
 
37
37
  ### `borderBottom`: `boolean`
38
38
 
39
- - Required: No
40
- - Default: `false`
39
+ - Required: No
40
+ - Default: `false`
41
41
 
42
42
  Renders a bottom border.
43
43
 
44
44
  ### `borderLeft`: `boolean`
45
45
 
46
- - Required: No
47
- - Default: `false`
46
+ - Required: No
47
+ - Default: `false`
48
48
 
49
49
  Renders a left border.
50
50
 
51
51
  ### `borderRight`: `boolean`
52
52
 
53
- - Required: No
54
- - Default: `false`
53
+ - Required: No
54
+ - Default: `false`
55
55
 
56
56
  Renders a right border.
57
57
 
58
58
  ### `borderTop`: `boolean`
59
59
 
60
- - Required: No
61
- - Default: `false`
60
+ - Required: No
61
+ - Default: `false`
62
62
 
63
63
  Renders a top border.
64
64
 
65
65
  ### `variant`: `string`
66
66
 
67
- - Required: No
68
- - Default: `false`
69
- - Allowed values: `primary`, `secondary`, `tertiary`, `dotted`, `grid`
67
+ - Required: No
68
+ - Default: `false`
69
+ - Allowed values: `primary`, `secondary`, `tertiary`, `dotted`, `grid`
70
70
 
71
71
  Modifies the background color of `Surface`.
72
72
 
@@ -1,15 +1,21 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
4
9
  import { contextConnect } from '../ui/context';
5
10
  import { View } from '../view';
6
11
  import { useSurface } from './hook';
12
+ import type { SurfaceProps } from './types';
13
+ import type { WordPressComponentProps } from '../ui/context';
7
14
 
8
- /**
9
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
10
- * @param {import('react').ForwardedRef<any>} forwardedRef
11
- */
12
- function Surface( props, forwardedRef ) {
15
+ function UnconnectedSurface(
16
+ props: WordPressComponentProps< SurfaceProps, 'div' >,
17
+ forwardedRef: ForwardedRef< any >
18
+ ) {
13
19
  const surfaceProps = useSurface( props );
14
20
 
15
21
  return <View { ...surfaceProps } ref={ forwardedRef } />;
@@ -35,6 +41,6 @@ function Surface( props, forwardedRef ) {
35
41
  * }
36
42
  * ```
37
43
  */
38
- const ConnectedSurface = contextConnect( Surface, 'Surface' );
44
+ export const Surface = contextConnect( UnconnectedSurface, 'Surface' );
39
45
 
40
- export default ConnectedSurface;
46
+ export default Surface;
@@ -9,11 +9,12 @@ import { useMemo } from '@wordpress/element';
9
9
  import { useContextSystem } from '../ui/context';
10
10
  import * as styles from './styles';
11
11
  import { useCx } from '../utils/hooks/use-cx';
12
+ import type { SurfaceProps } from './types';
13
+ import type { WordPressComponentProps } from '../ui/context';
12
14
 
13
- /**
14
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
15
- */
16
- export function useSurface( props ) {
15
+ export function useSurface(
16
+ props: WordPressComponentProps< SurfaceProps, 'div' >
17
+ ) {
17
18
  const {
18
19
  backgroundSize = 12,
19
20
  borderBottom = false,
@@ -28,14 +29,14 @@ export function useSurface( props ) {
28
29
  const cx = useCx();
29
30
 
30
31
  const classes = useMemo( () => {
31
- const sx = {};
32
-
33
- sx.borders = styles.getBorders( {
34
- borderBottom,
35
- borderLeft,
36
- borderRight,
37
- borderTop,
38
- } );
32
+ const sx = {
33
+ borders: styles.getBorders( {
34
+ borderBottom,
35
+ borderLeft,
36
+ borderRight,
37
+ borderTop,
38
+ } ),
39
+ };
39
40
 
40
41
  return cx(
41
42
  styles.Surface,
File without changes