@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
@@ -0,0 +1,40 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Surface } from '..';
10
+ import { Text } from '../../text';
11
+
12
+ const meta: ComponentMeta< typeof Surface > = {
13
+ component: Surface,
14
+ title: 'Components (Experimental)/Surface',
15
+ argTypes: {
16
+ children: { control: { type: null } },
17
+ as: { control: { type: 'text' } },
18
+ },
19
+ parameters: {
20
+ controls: {
21
+ expanded: true,
22
+ },
23
+ docs: { source: { state: 'open' } },
24
+ },
25
+ };
26
+ export default meta;
27
+
28
+ const Template: ComponentStory< typeof Surface > = ( args ) => {
29
+ return (
30
+ <Surface
31
+ { ...args }
32
+ style={ { padding: 20, maxWidth: 400, margin: '20vh auto' } }
33
+ >
34
+ <Text>Code is Poetry</Text>
35
+ </Surface>
36
+ );
37
+ };
38
+
39
+ export const Default: ComponentStory< typeof Surface > = Template.bind( {} );
40
+ Default.args = {};
@@ -7,6 +7,7 @@ import { css } from '@emotion/react';
7
7
  * Internal dependencies
8
8
  */
9
9
  import { CONFIG, COLORS } from '../utils';
10
+ import type { SurfaceVariant, SurfaceProps } from './types';
10
11
 
11
12
  export const Surface = css`
12
13
  background-color: ${ CONFIG.surfaceColor };
@@ -18,19 +19,15 @@ export const background = css`
18
19
  background-color: ${ CONFIG.surfaceBackgroundColor };
19
20
  `;
20
21
 
21
- /**
22
- * @param {Object} props
23
- * @param {boolean} [props.borderBottom]
24
- * @param {boolean} [props.borderLeft]
25
- * @param {boolean} [props.borderRight]
26
- * @param {boolean} [props.borderTop]
27
- */
28
22
  export function getBorders( {
29
23
  borderBottom,
30
24
  borderLeft,
31
25
  borderRight,
32
26
  borderTop,
33
- } ) {
27
+ }: Pick<
28
+ SurfaceProps,
29
+ 'borderBottom' | 'borderLeft' | 'borderRight' | 'borderTop'
30
+ > ) {
34
31
  const borderStyle = `1px solid ${ CONFIG.surfaceBorderColor }`;
35
32
 
36
33
  return css( {
@@ -51,16 +48,10 @@ export const tertiary = css`
51
48
  background: ${ CONFIG.surfaceBackgroundTertiaryColor };
52
49
  `;
53
50
 
54
- /**
55
- * @param {string} surfaceBackgroundSize
56
- */
57
- const customBackgroundSize = ( surfaceBackgroundSize ) =>
51
+ const customBackgroundSize = ( surfaceBackgroundSize: string ) =>
58
52
  [ surfaceBackgroundSize, surfaceBackgroundSize ].join( ' ' );
59
53
 
60
- /**
61
- * @param {string} surfaceBackgroundSizeDotted
62
- */
63
- const dottedBackground1 = ( surfaceBackgroundSizeDotted ) =>
54
+ const dottedBackground1 = ( surfaceBackgroundSizeDotted: string ) =>
64
55
  [
65
56
  '90deg',
66
57
  [ CONFIG.surfaceBackgroundColor, surfaceBackgroundSizeDotted ].join(
@@ -69,10 +60,7 @@ const dottedBackground1 = ( surfaceBackgroundSizeDotted ) =>
69
60
  'transparent 1%',
70
61
  ].join( ',' );
71
62
 
72
- /**
73
- * @param {string} surfaceBackgroundSizeDotted
74
- */
75
- const dottedBackground2 = ( surfaceBackgroundSizeDotted ) =>
63
+ const dottedBackground2 = ( surfaceBackgroundSizeDotted: string ) =>
76
64
  [
77
65
  [ CONFIG.surfaceBackgroundColor, surfaceBackgroundSizeDotted ].join(
78
66
  ' '
@@ -80,10 +68,7 @@ const dottedBackground2 = ( surfaceBackgroundSizeDotted ) =>
80
68
  'transparent 1%',
81
69
  ].join( ',' );
82
70
 
83
- /**
84
- * @param {string} surfaceBackgroundSizeDotted
85
- */
86
- const dottedBackgroundCombined = ( surfaceBackgroundSizeDotted ) =>
71
+ const dottedBackgroundCombined = ( surfaceBackgroundSizeDotted: string ) =>
87
72
  [
88
73
  `linear-gradient( ${ dottedBackground1(
89
74
  surfaceBackgroundSizeDotted
@@ -94,14 +79,9 @@ const dottedBackgroundCombined = ( surfaceBackgroundSizeDotted ) =>
94
79
  CONFIG.surfaceBorderBoldColor,
95
80
  ].join( ',' );
96
81
 
97
- /**
98
- *
99
- * @param {string} surfaceBackgroundSize
100
- * @param {string} surfaceBackgroundSizeDotted
101
- */
102
82
  export const getDotted = (
103
- surfaceBackgroundSize,
104
- surfaceBackgroundSizeDotted
83
+ surfaceBackgroundSize: string,
84
+ surfaceBackgroundSizeDotted: string
105
85
  ) => css`
106
86
  background: ${ dottedBackgroundCombined( surfaceBackgroundSizeDotted ) };
107
87
  background-size: ${ customBackgroundSize( surfaceBackgroundSize ) };
@@ -123,11 +103,7 @@ const gridBackgroundCombined = [
123
103
  `linear-gradient( ${ gridBackground2 } )`,
124
104
  ].join( ',' );
125
105
 
126
- /**
127
- * @param {string} surfaceBackgroundSize
128
- * @return {import('@emotion/react').SerializedStyles} CSS.
129
- */
130
- export const getGrid = ( surfaceBackgroundSize ) => {
106
+ export const getGrid = ( surfaceBackgroundSize: string ) => {
131
107
  return css`
132
108
  background: ${ CONFIG.surfaceBackgroundColor };
133
109
  background-image: ${ gridBackgroundCombined };
@@ -135,15 +111,10 @@ export const getGrid = ( surfaceBackgroundSize ) => {
135
111
  `;
136
112
  };
137
113
 
138
- /**
139
- * @param {'dotted' | 'grid' | 'primary' | 'secondary' | 'tertiary'} variant
140
- * @param {string} surfaceBackgroundSize
141
- * @param {string} surfaceBackgroundSizeDotted
142
- */
143
114
  export const getVariant = (
144
- variant,
145
- surfaceBackgroundSize,
146
- surfaceBackgroundSizeDotted
115
+ variant: SurfaceVariant,
116
+ surfaceBackgroundSize: string,
117
+ surfaceBackgroundSizeDotted: string
147
118
  ) => {
148
119
  switch ( variant ) {
149
120
  case 'dotted': {
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { render } from '@testing-library/react';
5
+ import type { RenderResult } from '@testing-library/react';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -9,7 +10,7 @@ import { render } from '@testing-library/react';
9
10
  import { Surface } from '../index';
10
11
 
11
12
  describe( 'props', () => {
12
- let base;
13
+ let base: RenderResult;
13
14
  beforeEach( () => {
14
15
  base = render( <Surface>Surface</Surface> );
15
16
  } );
@@ -5,7 +5,7 @@ export type SurfaceVariant =
5
5
  | 'dotted'
6
6
  | 'grid';
7
7
 
8
- export type Props = {
8
+ export type SurfaceProps = {
9
9
  /**
10
10
  * Determines the grid size for "dotted" and "grid" variants.
11
11
  *
@@ -100,47 +100,41 @@ The set of props accepted by the component will be specified below.
100
100
 
101
101
  Props not included in this set will be applied to the textarea element.
102
102
 
103
- #### label
103
+ #### `help`: `string | WPElement`
104
104
 
105
- If this property is added, a label will be generated using label property as the content.
105
+ If this property is added, a help text will be generated using help property as the content.
106
106
 
107
- - Type: `String`
108
107
  - Required: No
109
108
 
110
- #### hideLabelFromVision
109
+ #### `hideLabelFromVision`: `boolean`
111
110
 
112
111
  If true, the label will only be visible to screen readers.
113
112
 
114
- - Type: `Boolean`
115
113
  - Required: No
116
114
 
117
- #### help
115
+ #### `label`: `string`
118
116
 
119
- If this property is added, a help text will be generated using help property as the content.
117
+ If this property is added, a label will be generated using label property as the content.
120
118
 
121
- - Type: `String|WPElement`
122
119
  - Required: No
123
120
 
124
- #### rows
121
+ #### `onChange`: `( value: string ) => void`
125
122
 
126
- The number of rows the textarea should contain. Defaults to four.
123
+ A function that receives the new value of the textarea each time it changes.
127
124
 
128
- - Type: `String`
129
- - Required: No
130
- - Default: 4
125
+ - Required: Yes
131
126
 
132
- #### value
127
+ #### `rows`: `number`
133
128
 
134
- The current value of the textarea.
129
+ The number of rows the textarea should contain.
135
130
 
136
- - Type: `String`
137
- - Required: Yes
131
+ - Required: No
132
+ - Default: 4
138
133
 
139
- #### onChange
134
+ #### `value`: `string`
140
135
 
141
- A function that receives the new value of the textarea each time it changes.
136
+ The current value of the textarea.
142
137
 
143
- - Type: `function`
144
138
  - Required: Yes
145
139
 
146
140
  ## Related components
@@ -0,0 +1,86 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ChangeEvent } from 'react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useInstanceId } from '@wordpress/compose';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import BaseControl from '../base-control';
15
+ import { StyledTextarea } from './styles/textarea-control-styles';
16
+ import type { TextareaControlProps } from './types';
17
+ import type { WordPressComponentProps } from '../ui/context';
18
+
19
+ /**
20
+ * TextareaControls are TextControls that allow for multiple lines of text, and
21
+ * wrap overflow text onto a new line. They are a fixed height and scroll
22
+ * vertically when the cursor reaches the bottom of the field.
23
+ *
24
+ * ```jsx
25
+ * import { TextareaControl } from '@wordpress/components';
26
+ * import { useState } from '@wordpress/element';
27
+ *
28
+ * const MyTextareaControl = () => {
29
+ * const [ text, setText ] = useState( '' );
30
+ *
31
+ * return (
32
+ * <TextareaControl
33
+ * label="Text"
34
+ * help="Enter some text"
35
+ * value={ text }
36
+ * onChange={ ( value ) => setText( value ) }
37
+ * />
38
+ * );
39
+ * };
40
+ * ```
41
+ */
42
+ export function TextareaControl(
43
+ // ref is omitted until we have `WordPressComponentPropsWithoutRef` or add
44
+ // ref forwarding to TextareaControl.
45
+ props: Omit<
46
+ WordPressComponentProps< TextareaControlProps, 'textarea', false >,
47
+ 'ref'
48
+ >
49
+ ) {
50
+ const {
51
+ label,
52
+ hideLabelFromVision,
53
+ value,
54
+ help,
55
+ onChange,
56
+ rows = 4,
57
+ className,
58
+ ...additionalProps
59
+ } = props;
60
+ const instanceId = useInstanceId( TextareaControl );
61
+ const id = `inspector-textarea-control-${ instanceId }`;
62
+ const onChangeValue = ( event: ChangeEvent< HTMLTextAreaElement > ) =>
63
+ onChange( event.target.value );
64
+
65
+ return (
66
+ <BaseControl
67
+ label={ label }
68
+ hideLabelFromVision={ hideLabelFromVision }
69
+ id={ id }
70
+ help={ help }
71
+ className={ className }
72
+ >
73
+ <StyledTextarea
74
+ className="components-textarea-control__input"
75
+ id={ id }
76
+ rows={ rows }
77
+ onChange={ onChangeValue }
78
+ aria-describedby={ !! help ? id + '__help' : undefined }
79
+ value={ value }
80
+ { ...additionalProps }
81
+ />
82
+ </BaseControl>
83
+ );
84
+ }
85
+
86
+ export default TextareaControl;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useState } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import TextareaControl from '..';
15
+
16
+ const meta: ComponentMeta< typeof TextareaControl > = {
17
+ component: TextareaControl,
18
+ title: 'Components/TextareaControl',
19
+ argTypes: {
20
+ onChange: { action: 'onChange' },
21
+ label: { control: { type: 'text' } },
22
+ help: { control: { type: 'text' } },
23
+ value: { control: { type: null } },
24
+ },
25
+ parameters: {
26
+ controls: {
27
+ expanded: true,
28
+ },
29
+ docs: { source: { state: 'open' } },
30
+ },
31
+ };
32
+ export default meta;
33
+
34
+ const Template: ComponentStory< typeof TextareaControl > = ( {
35
+ onChange,
36
+ ...args
37
+ } ) => {
38
+ const [ value, setValue ] = useState( '' );
39
+
40
+ return (
41
+ <TextareaControl
42
+ { ...args }
43
+ value={ value }
44
+ onChange={ ( v ) => {
45
+ setValue( v );
46
+ onChange( v );
47
+ } }
48
+ />
49
+ );
50
+ };
51
+
52
+ export const Default: ComponentStory< typeof TextareaControl > = Template.bind(
53
+ {}
54
+ );
55
+ Default.args = {
56
+ label: 'Text',
57
+ help: 'Enter some text',
58
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { TextareaHTMLAttributes } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import type { BaseControlProps } from '../base-control/types';
10
+
11
+ export type TextareaControlProps = Pick<
12
+ BaseControlProps,
13
+ 'hideLabelFromVision' | 'help' | 'label'
14
+ > & {
15
+ /**
16
+ * A function that receives the new value of the textarea each time it
17
+ * changes.
18
+ */
19
+ onChange: ( value: string ) => void;
20
+ /**
21
+ * The current value of the textarea.
22
+ */
23
+ value: string;
24
+ /**
25
+ * The number of rows the textarea should contain.
26
+ *
27
+ * @default 4
28
+ */
29
+ rows?: TextareaHTMLAttributes< HTMLTextAreaElement >[ 'rows' ];
30
+ };
@@ -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';
package/tsconfig.json CHANGED
@@ -82,6 +82,7 @@
82
82
  "src/surface/**/*",
83
83
  "src/text/**/*",
84
84
  "src/text-control/**/*",
85
+ "src/textarea-control/**/*",
85
86
  "src/tip/**/*",
86
87
  "src/toggle-group-control/**/*",
87
88
  "src/tools-panel/**/*",