@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,76 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useCopyToClipboard } from '@wordpress/compose';
5
+ import { useState, useEffect, useRef } from '@wordpress/element';
6
+ import { copy } from '@wordpress/icons';
7
+ import { __ } from '@wordpress/i18n';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { CopyButton } from './styles';
13
+ import { Text } from '../text';
14
+ import { Tooltip } from '../ui/tooltip';
15
+
16
+ import type { ColorCopyButtonProps } from './types';
17
+
18
+ export const ColorCopyButton = ( props: ColorCopyButtonProps ) => {
19
+ const { color, colorType } = props;
20
+ const [ copiedColor, setCopiedColor ] = useState< string | null >( null );
21
+ const copyTimer = useRef< ReturnType< typeof setTimeout > | undefined >();
22
+ const copyRef = useCopyToClipboard< HTMLDivElement >(
23
+ () => {
24
+ switch ( colorType ) {
25
+ case 'hsl': {
26
+ return color.toHslString();
27
+ }
28
+ case 'rgb': {
29
+ return color.toRgbString();
30
+ }
31
+ default:
32
+ case 'hex': {
33
+ return color.toHex();
34
+ }
35
+ }
36
+ },
37
+ () => {
38
+ if ( copyTimer.current ) {
39
+ clearTimeout( copyTimer.current );
40
+ }
41
+ setCopiedColor( color.toHex() );
42
+ copyTimer.current = setTimeout( () => {
43
+ setCopiedColor( null );
44
+ copyTimer.current = undefined;
45
+ }, 3000 );
46
+ }
47
+ );
48
+ useEffect( () => {
49
+ // Clear copyTimer on component unmount.
50
+ return () => {
51
+ if ( copyTimer.current ) {
52
+ clearTimeout( copyTimer.current );
53
+ }
54
+ };
55
+ }, [] );
56
+
57
+ return (
58
+ <Tooltip
59
+ content={
60
+ <Text color="white">
61
+ { copiedColor === color.toHex()
62
+ ? __( 'Copied!' )
63
+ : __( 'Copy' ) }
64
+ </Text>
65
+ }
66
+ placement="bottom"
67
+ >
68
+ <CopyButton
69
+ isSmall
70
+ ref={ copyRef }
71
+ icon={ copy }
72
+ showTooltip={ false }
73
+ />
74
+ </Tooltip>
75
+ );
76
+ };
@@ -9,7 +9,6 @@ import namesPlugin from 'colord/plugins/names';
9
9
  * WordPress dependencies
10
10
  */
11
11
  import { useCallback, useState, useMemo } from '@wordpress/element';
12
- import { settings } from '@wordpress/icons';
13
12
  import { useDebounce } from '@wordpress/compose';
14
13
  import { __ } from '@wordpress/i18n';
15
14
 
@@ -27,9 +26,8 @@ import {
27
26
  ColorfulWrapper,
28
27
  SelectControl,
29
28
  AuxiliaryColorArtefactWrapper,
30
- DetailsControlButton,
31
29
  } from './styles';
32
- import { ColorDisplay } from './color-display';
30
+ import { ColorCopyButton } from './color-copy-button';
33
31
  import { ColorInput } from './color-input';
34
32
  import { Picker } from './picker';
35
33
  import { useControlledValue } from '../utils/hooks';
@@ -85,7 +83,6 @@ const ColorPicker = (
85
83
  [ debouncedSetColor ]
86
84
  );
87
85
 
88
- const [ showInputs, setShowInputs ] = useState< boolean >( false );
89
86
  const [ colorType, setColorType ] = useState< ColorType >(
90
87
  copyFormat || 'hex'
91
88
  );
@@ -99,44 +96,27 @@ const ColorPicker = (
99
96
  />
100
97
  <AuxiliaryColorArtefactWrapper>
101
98
  <HStack justify="space-between">
102
- { showInputs ? (
103
- <SelectControl
104
- options={ options }
105
- value={ colorType }
106
- onChange={ ( nextColorType ) =>
107
- setColorType( nextColorType as ColorType )
108
- }
109
- label={ __( 'Color format' ) }
110
- hideLabelFromVision
111
- />
112
- ) : (
113
- <ColorDisplay
114
- color={ safeColordColor }
115
- colorType={ copyFormat || colorType }
116
- enableAlpha={ enableAlpha }
117
- />
118
- ) }
119
- <DetailsControlButton
120
- isSmall
121
- onClick={ () => setShowInputs( ! showInputs ) }
122
- icon={ settings }
123
- isPressed={ showInputs }
124
- label={
125
- showInputs
126
- ? __( 'Hide detailed inputs' )
127
- : __( 'Show detailed inputs' )
99
+ <SelectControl
100
+ options={ options }
101
+ value={ colorType }
102
+ onChange={ ( nextColorType ) =>
103
+ setColorType( nextColorType as ColorType )
128
104
  }
105
+ label={ __( 'Color format' ) }
106
+ hideLabelFromVision
129
107
  />
130
- </HStack>
131
- <Spacer margin={ 4 } />
132
- { showInputs && (
133
- <ColorInput
134
- colorType={ colorType }
108
+ <ColorCopyButton
135
109
  color={ safeColordColor }
136
- onChange={ handleChange }
137
- enableAlpha={ enableAlpha }
110
+ colorType={ copyFormat || colorType }
138
111
  />
139
- ) }
112
+ </HStack>
113
+ <Spacer margin={ 4 } />
114
+ <ColorInput
115
+ colorType={ colorType }
116
+ color={ safeColordColor }
117
+ onChange={ handleChange }
118
+ enableAlpha={ enableAlpha }
119
+ />
140
120
  </AuxiliaryColorArtefactWrapper>
141
121
  </ColorfulWrapper>
142
122
  );
@@ -16,6 +16,7 @@ import { Spacer } from '../spacer';
16
16
  import { space } from '../ui/utils/space';
17
17
  import { ColorHexInputControl } from './styles';
18
18
  import { COLORS } from '../utils/colors-values';
19
+ import type { StateReducer } from '../input-control/reducer/state';
19
20
 
20
21
  interface HexInputProps {
21
22
  color: Colord;
@@ -33,6 +34,20 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
33
34
  onChange( colord( hexValue ) );
34
35
  };
35
36
 
37
+ const stateReducer: StateReducer = ( state, action ) => {
38
+ const nativeEvent = action.payload?.event?.nativeEvent as InputEvent;
39
+
40
+ if ( 'insertFromPaste' !== nativeEvent?.inputType ) {
41
+ return { ...state };
42
+ }
43
+
44
+ const value = state.value?.startsWith( '#' )
45
+ ? state.value.slice( 1 ).toUpperCase()
46
+ : state.value?.toUpperCase();
47
+
48
+ return { ...state, value };
49
+ };
50
+
36
51
  return (
37
52
  <ColorHexInputControl
38
53
  prefix={
@@ -50,6 +65,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
50
65
  maxLength={ enableAlpha ? 9 : 7 }
51
66
  label={ __( 'Hex color' ) }
52
67
  hideLabelFromVision
68
+ __unstableStateReducer={ stateReducer }
53
69
  />
54
70
  );
55
71
  };
@@ -111,10 +111,14 @@ export const ColorfulWrapper = styled.div`
111
111
  ${ inputHeightStyle }
112
112
  `;
113
113
 
114
- export const DetailsControlButton = styled( Button )`
114
+ export const CopyButton = styled( Button )`
115
115
  &&&&& {
116
116
  min-width: ${ space( 6 ) };
117
117
  padding: 0;
118
+
119
+ > svg {
120
+ margin-right: 0;
121
+ }
118
122
  }
119
123
  `;
120
124
 
@@ -1 +1,10 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { Colord } from 'colord';
5
+
1
6
  export type ColorType = 'rgb' | 'hsl' | 'hex';
7
+ export type ColorCopyButtonProps = {
8
+ color: Colord;
9
+ colorType: ColorType;
10
+ };
@@ -75,7 +75,7 @@ export function getGradientAstWithControlPoints(
75
75
  return {
76
76
  length: {
77
77
  type: '%',
78
- value: position.toString(),
78
+ value: position?.toString(),
79
79
  },
80
80
  type: a < 1 ? 'rgba' : 'rgb',
81
81
  value: a < 1 ? [ r, g, b, a ] : [ r, g, b ],
@@ -26,6 +26,8 @@ const MyDateTimePicker = () => {
26
26
  currentDate={ date }
27
27
  onChange={ ( newDate ) => setDate( newDate ) }
28
28
  is12Hour={ true }
29
+ __nextRemoveHelpButton
30
+ __nextRemoveResetButton
29
31
  />
30
32
  );
31
33
  };
@@ -74,3 +76,17 @@ List of events to show in the date picker. Each event will appear as a dot on th
74
76
 
75
77
  - Type: `Array`
76
78
  - Required: No
79
+
80
+ ### `__nextRemoveHelpButton`: `boolean`
81
+
82
+ Start opting in to not displaying a Help button which will become the default in a future version.
83
+
84
+ - Required: No
85
+ - Default: `false`
86
+
87
+ ### `__nextRemoveResetButton`: `boolean`
88
+
89
+ Start opting in to not displaying a Reset button which will become the default in a future version.
90
+
91
+ - Required: No
92
+ - Default: `false`
@@ -2,30 +2,28 @@
2
2
  * External dependencies
3
3
  */
4
4
  import moment from 'moment';
5
- import classnames from 'classnames';
6
5
  import type { Moment } from 'moment';
7
6
  import { noop } from 'lodash';
8
-
7
+ // Needed to initialise the default datepicker styles.
8
+ // See: https://github.com/airbnb/react-dates#initialize
9
+ import 'react-dates/initialize';
9
10
  // `react-dates` doesn't tree-shake correctly, so we import from the individual
10
11
  // component here.
11
- // @ts-expect-error TypeScript won't find any type declarations at
12
- // `react-dates/lib/components/DayPickerSingleDateController` as they're located
13
- // at `react-dates`.
14
- import UntypedDayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';
15
- import type { DayPickerSingleDateController } from 'react-dates';
16
- const TypedDayPickerSingleDateController = UntypedDayPickerSingleDateController as DayPickerSingleDateController;
12
+ import DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';
17
13
 
18
14
  /**
19
15
  * WordPress dependencies
20
16
  */
21
17
  import { useEffect, useRef } from '@wordpress/element';
22
18
  import { isRTL, _n, sprintf } from '@wordpress/i18n';
19
+ import { arrowLeft, arrowRight } from '@wordpress/icons';
23
20
 
24
21
  /**
25
22
  * Internal dependencies
26
23
  */
27
24
  import { getMomentDate } from './utils';
28
- import type { DatePickerDayProps, DatePickerProps } from './types';
25
+ import type { DatePickerDayProps, DatePickerProps } from '../types';
26
+ import { Day, NavPrevButton, NavNextButton } from './styles';
29
27
 
30
28
  const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
31
29
  const ARIAL_LABEL_TIME_FORMAT = 'dddd, LL';
@@ -69,14 +67,14 @@ function DatePickerDay( { day, events = [] }: DatePickerDayProps ) {
69
67
  }, [ events.length ] );
70
68
 
71
69
  return (
72
- <div
70
+ <Day
73
71
  ref={ ref }
74
- className={ classnames( 'components-datetime__date__day', {
75
- 'has-events': events?.length,
76
- } ) }
72
+ className="components-datetime__date__day" // Unused, for backwards compatibility.
73
+ hasEvents={ !! events?.length }
74
+ alignment="center"
77
75
  >
78
76
  { day.format( 'D' ) }
79
- </div>
77
+ </Day>
80
78
  );
81
79
  }
82
80
 
@@ -107,6 +105,7 @@ export function DatePicker( {
107
105
  onMonthPreviewed,
108
106
  }: DatePickerProps ) {
109
107
  const nodeRef = useRef< HTMLDivElement >( null );
108
+
110
109
  const onMonthPreviewedHandler = ( newMonthDate: Moment ) => {
111
110
  onMonthPreviewed?.( newMonthDate.toISOString() );
112
111
  keepFocusInside();
@@ -176,9 +175,11 @@ export function DatePicker( {
176
175
 
177
176
  return (
178
177
  <div className="components-datetime__date" ref={ nodeRef }>
179
- <TypedDayPickerSingleDateController
178
+ <DayPickerSingleDateController
180
179
  date={ momentDate }
180
+ initialVisibleMonth={ null }
181
181
  daySize={ 30 }
182
+ horizontalMonthPadding={ 0 }
182
183
  focused
183
184
  hideKeyboardShortcutsPanel
184
185
  // This is a hack to force the calendar to update on month or year change
@@ -204,6 +205,28 @@ export function DatePicker( {
204
205
  events={ getEventsPerDay( day ) }
205
206
  />
206
207
  ) }
208
+ renderMonthElement={ ( { month } ) => (
209
+ <>
210
+ <strong>{ month.format( 'MMMM' ) }</strong>{ ' ' }
211
+ { month.format( 'YYYY' ) }
212
+ </>
213
+ ) }
214
+ renderNavPrevButton={ ( { ariaLabel, ...props } ) => (
215
+ <NavPrevButton
216
+ icon={ arrowLeft }
217
+ variant="tertiary"
218
+ aria-label={ ariaLabel }
219
+ { ...props }
220
+ />
221
+ ) }
222
+ renderNavNextButton={ ( { ariaLabel, ...props } ) => (
223
+ <NavNextButton
224
+ icon={ arrowRight }
225
+ variant="tertiary"
226
+ aria-label={ ariaLabel }
227
+ { ...props }
228
+ />
229
+ ) }
207
230
  onFocusChange={ noop }
208
231
  />
209
232
  </div>
@@ -0,0 +1,75 @@
1
+ @import "./datepicker.scss";
2
+
3
+ // Styles that overrides the calendar styling provided by react-dates go here.
4
+ // Everything else goes in styles.ts.
5
+
6
+ .components-datetime__date {
7
+ //
8
+ // Margin overrides
9
+ //
10
+
11
+ // Remove the left and right margin from the calendar by setting all the
12
+ // containers' widths to 100%. This means that the slide left / slide right
13
+ // animation won't work but we don't want that, anyway.
14
+
15
+ .CalendarMonthGrid__horizontal,
16
+ .DayPicker_weekHeader_li {
17
+ transform: none !important; // Override inline style.
18
+ width: 100% !important; // Override inline style.
19
+ }
20
+
21
+ .CalendarMonthGrid_month__horizontal,
22
+ .CalendarMonth_table,
23
+ .DayPicker_weekHeader {
24
+ width: 100%;
25
+ }
26
+
27
+ .DayPicker_weekHeaders__horizontal {
28
+ margin: 0;
29
+ }
30
+
31
+ .DayPicker_weekHeader_ul {
32
+ display: flex;
33
+ }
34
+
35
+ //
36
+ // Theming
37
+ //
38
+
39
+ .DayPicker_weekHeader {
40
+ top: 50px;
41
+ }
42
+
43
+ .CalendarMonth_caption {
44
+ font-size: $default-font-size;
45
+ }
46
+
47
+ .CalendarMonth_table {
48
+ border-collapse: separate;
49
+ border-spacing: 2px;
50
+ }
51
+
52
+ .CalendarDay {
53
+ border: none;
54
+ font-size: $default-font-size;
55
+ border-radius: $radius-round;
56
+
57
+ &:focus {
58
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 #{ $border-width-focus + $border-width } $white;
59
+ outline: 2px solid transparent; // Shown in Windows 10 high contrast mode.
60
+ }
61
+ }
62
+
63
+ .CalendarDay__selected {
64
+ background: var(--wp-admin-theme-color);
65
+ border: 2px solid transparent; // This indicates selection in Windows 10 high contrast mode.
66
+
67
+ &:hover {
68
+ background: var(--wp-admin-theme-color-darker-20);
69
+ }
70
+
71
+ &:focus {
72
+ box-shadow: inset 0 0 0 $border-width $white;
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import styled from '@emotion/styled';
5
+ import { css } from '@emotion/react';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import Button from '../../button';
11
+ import { COLORS } from '../../utils';
12
+ import { VStack } from '../../v-stack';
13
+
14
+ // Styles that overrides the calendar styling provided by react-dates go in
15
+ // style.scss. Everything else goes here.
16
+
17
+ export const Day = styled( VStack )< { hasEvents: boolean } >`
18
+ height: 100%;
19
+ position: relative;
20
+
21
+ ${ ( props ) =>
22
+ props.hasEvents &&
23
+ `
24
+ ::before {
25
+ background: var(--wp-admin-theme-color);
26
+ border-radius: 2px;
27
+ bottom: 0;
28
+ content: " ";
29
+ height: 4px;
30
+ left: 50%;
31
+ margin-left: -2px;
32
+ position: absolute;
33
+ width: 4px;
34
+
35
+ .CalendarDay__selected & {
36
+ background: ${ COLORS.white };
37
+ }
38
+ }
39
+ ` }
40
+ `;
41
+
42
+ const baseNavButton = css`
43
+ position: absolute;
44
+ top: 15px;
45
+ `;
46
+
47
+ export const NavPrevButton = styled( Button )`
48
+ ${ baseNavButton }
49
+ left: 0;
50
+ `;
51
+
52
+ export const NavNextButton = styled( Button )`
53
+ ${ baseNavButton }
54
+ right: 0;
55
+ `;
@@ -9,7 +9,7 @@ import 'react-dates/initialize';
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
- import DatePicker from '../date';
12
+ import DatePicker from '..';
13
13
 
14
14
  describe( 'DatePicker', () => {
15
15
  it( 'should highlight the current date', () => {
File without changes
File without changes