@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,184 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ColorDisplay = void 0;
7
-
8
- var _element = require("@wordpress/element");
9
-
10
- var _compose = require("@wordpress/compose");
11
-
12
- var _i18n = require("@wordpress/i18n");
13
-
14
- var _text = require("../text");
15
-
16
- var _flex = require("../flex");
17
-
18
- var _tooltip = require("../ui/tooltip");
19
-
20
- var _space = require("../ui/utils/space");
21
-
22
- var _colorsValues = require("../utils/colors-values");
23
-
24
- /**
25
- * External dependencies
26
- */
27
-
28
- /**
29
- * WordPress dependencies
30
- */
31
-
32
- /**
33
- * Internal dependencies
34
- */
35
- const ValueDisplay = _ref => {
36
- let {
37
- values
38
- } = _ref;
39
- return (0, _element.createElement)(_element.Fragment, null, values.map(_ref2 => {
40
- let [value, abbreviation] = _ref2;
41
- return (0, _element.createElement)(_flex.FlexItem, {
42
- key: abbreviation,
43
- isBlock: true,
44
- display: "flex"
45
- }, (0, _element.createElement)(_text.Text, {
46
- color: _colorsValues.COLORS.ui.theme
47
- }, abbreviation), (0, _element.createElement)(_text.Text, null, value));
48
- }));
49
- };
50
-
51
- const HslDisplay = _ref3 => {
52
- let {
53
- color,
54
- enableAlpha
55
- } = _ref3;
56
- const {
57
- h,
58
- s,
59
- l,
60
- a
61
- } = color.toHsl();
62
- const values = [[Math.floor(h), 'H'], [Math.round(s * 100), 'S'], [Math.round(l * 100), 'L']];
63
-
64
- if (enableAlpha) {
65
- values.push([Math.round(a * 100), 'A']);
66
- }
67
-
68
- return (0, _element.createElement)(ValueDisplay, {
69
- values: values
70
- });
71
- };
72
-
73
- const RgbDisplay = _ref4 => {
74
- let {
75
- color,
76
- enableAlpha
77
- } = _ref4;
78
- const {
79
- r,
80
- g,
81
- b,
82
- a
83
- } = color.toRgb();
84
- const values = [[r, 'R'], [g, 'G'], [b, 'B']];
85
-
86
- if (enableAlpha) {
87
- values.push([Math.round(a * 100), 'A']);
88
- }
89
-
90
- return (0, _element.createElement)(ValueDisplay, {
91
- values: values
92
- });
93
- };
94
-
95
- const HexDisplay = _ref5 => {
96
- let {
97
- color
98
- } = _ref5;
99
- const colorWithoutHash = color.toHex().slice(1).toUpperCase();
100
- return (0, _element.createElement)(_flex.FlexItem, null, (0, _element.createElement)(_text.Text, {
101
- color: _colorsValues.COLORS.ui.theme
102
- }, "#"), (0, _element.createElement)(_text.Text, null, colorWithoutHash));
103
- };
104
-
105
- const getComponent = colorType => {
106
- switch (colorType) {
107
- case 'hsl':
108
- return HslDisplay;
109
-
110
- case 'rgb':
111
- return RgbDisplay;
112
-
113
- default:
114
- case 'hex':
115
- return HexDisplay;
116
- }
117
- };
118
-
119
- const ColorDisplay = _ref6 => {
120
- let {
121
- color,
122
- colorType,
123
- enableAlpha
124
- } = _ref6;
125
- const [copiedColor, setCopiedColor] = (0, _element.useState)(null);
126
- const copyTimer = (0, _element.useRef)();
127
- const props = {
128
- color,
129
- enableAlpha
130
- };
131
- const Component = getComponent(colorType);
132
- const copyRef = (0, _compose.useCopyToClipboard)(() => {
133
- switch (colorType) {
134
- case 'hsl':
135
- {
136
- return color.toHslString();
137
- }
138
-
139
- case 'rgb':
140
- {
141
- return color.toRgbString();
142
- }
143
-
144
- default:
145
- case 'hex':
146
- {
147
- return color.toHex();
148
- }
149
- }
150
- }, () => {
151
- if (copyTimer.current) {
152
- clearTimeout(copyTimer.current);
153
- }
154
-
155
- setCopiedColor(color.toHex());
156
- copyTimer.current = setTimeout(() => {
157
- setCopiedColor(null);
158
- copyTimer.current = undefined;
159
- }, 3000);
160
- });
161
- (0, _element.useEffect)(() => {
162
- // Clear copyTimer on component unmount.
163
- return () => {
164
- if (copyTimer.current) {
165
- clearTimeout(copyTimer.current);
166
- }
167
- };
168
- }, []);
169
- return (0, _element.createElement)(_tooltip.Tooltip, {
170
- content: (0, _element.createElement)(_text.Text, {
171
- color: "white"
172
- }, copiedColor === color.toHex() ? (0, _i18n.__)('Copied!') : (0, _i18n.__)('Copy'))
173
- }, (0, _element.createElement)(_flex.Flex, {
174
- justify: "flex-start",
175
- gap: (0, _space.space)(1),
176
- ref: copyRef,
177
- style: {
178
- height: 30
179
- }
180
- }, (0, _element.createElement)(Component, props)));
181
- };
182
-
183
- exports.ColorDisplay = ColorDisplay;
184
- //# sourceMappingURL=color-display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/color-display.tsx"],"names":["ValueDisplay","values","map","value","abbreviation","COLORS","ui","theme","HslDisplay","color","enableAlpha","h","s","l","a","toHsl","Math","floor","round","push","RgbDisplay","r","g","b","toRgb","HexDisplay","colorWithoutHash","toHex","slice","toUpperCase","getComponent","colorType","ColorDisplay","copiedColor","setCopiedColor","copyTimer","props","Component","copyRef","toHslString","toRgbString","current","clearTimeout","setTimeout","undefined","height"],"mappings":";;;;;;;AASA;;AADA;;AAEA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAyBA,MAAMA,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACpB,qDACGA,MAAM,CAACC,GAAP,CAAY,SAA+B;AAAA,QAA7B,CAAEC,KAAF,EAASC,YAAT,CAA6B;AAC5C,WACC,4BAAC,cAAD;AAAU,MAAA,GAAG,EAAGA,YAAhB;AAA+B,MAAA,OAAO,MAAtC;AAAuC,MAAA,OAAO,EAAC;AAA/C,OACC,4BAAC,UAAD;AAAM,MAAA,KAAK,EAAGC,qBAAOC,EAAP,CAAUC;AAAxB,OAAkCH,YAAlC,CADD,EAEC,4BAAC,UAAD,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WAAK,KAAL;AAAY;AACX,iBAAO/B,KAAK,CAACkB,KAAN,EAAP;AACA;AAVF;AAYA,GAdc,EAef,MAAM;AACL,QAAKQ,SAAS,CAACM,OAAf,EAAyB;AACxBC,MAAAA,YAAY,CAAEP,SAAS,CAACM,OAAZ,CAAZ;AACA;;AACDP,IAAAA,cAAc,CAAEzB,KAAK,CAACkB,KAAN,EAAF,CAAd;AACAQ,IAAAA,SAAS,CAACM,OAAV,GAAoBE,UAAU,CAAE,MAAM;AACrCT,MAAAA,cAAc,CAAE,IAAF,CAAd;AACAC,MAAAA,SAAS,CAACM,OAAV,GAAoBG,SAApB;AACA,KAH6B,EAG3B,IAH2B,CAA9B;AAIA,GAxBc,CAAhB;AA0BA,0BAAW,MAAM;AAChB;AACA,WAAO,MAAM;AACZ,UAAKT,SAAS,CAACM,OAAf,EAAyB;AACxBC,QAAAA,YAAY,CAAEP,SAAS,CAACM,OAAZ,CAAZ;AACA;AACD,KAJD;AAKA,GAPD,EAOG,EAPH;AAQA,SACC,4BAAC,gBAAD;AACC,IAAA,OAAO,EACN,4BAAC,UAAD;AAAM,MAAA,KAAK,EAAC;AAAZ,OACGR,WAAW,KAAKxB,KAAK,CAACkB,KAAN,EAAhB,GACC,cAAI,SAAJ,CADD,GAEC,cAAI,MAAJ,CAHJ;AAFF,KASC,4BAAC,UAAD;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,GAAG,EAAG,kBAAO,CAAP,CAFP;AAGC,IAAA,GAAG,EAAGW,OAHP;AAIC,IAAA,KAAK,EAAG;AAAEO,MAAAA,MAAM,EAAE;AAAV;AAJT,KAMC,4BAAC,SAAD,EAAgBT,KAAhB,CAND,CATD,CADD;AAoBA,CA/DM","sourcesContent":["/**\n * External dependencies\n */\nimport type { Colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Text } from '../text';\nimport { Flex, FlexItem } from '../flex';\nimport { Tooltip } from '../ui/tooltip';\nimport type { ColorType } from './types';\nimport { space } from '../ui/utils/space';\nimport { COLORS } from '../utils/colors-values';\n\ninterface ColorDisplayProps {\n\tcolor: Colord;\n\tcolorType: ColorType;\n\tenableAlpha: boolean;\n}\n\ninterface DisplayProps {\n\tcolor: Colord;\n\tenableAlpha: boolean;\n}\n\ntype Values = [ number, string ][];\n\ninterface ValueDisplayProps {\n\tvalues: Values;\n}\n\nconst ValueDisplay = ( { values }: ValueDisplayProps ) => (\n\t<>\n\t\t{ values.map( ( [ value, abbreviation ] ) => {\n\t\t\treturn (\n\t\t\t\t<FlexItem key={ abbreviation } isBlock display=\"flex\">\n\t\t\t\t\t<Text color={ COLORS.ui.theme }>{ abbreviation }</Text>\n\t\t\t\t\t<Text>{ value }</Text>\n\t\t\t\t</FlexItem>\n\t\t\t);\n\t\t} ) }\n\t</>\n);\n\nconst HslDisplay = ( { color, enableAlpha }: DisplayProps ) => {\n\tconst { h, s, l, a } = color.toHsl();\n\n\tconst values: Values = [\n\t\t[ Math.floor( h ), 'H' ],\n\t\t[ Math.round( s * 100 ), 'S' ],\n\t\t[ Math.round( l * 100 ), 'L' ],\n\t];\n\tif ( enableAlpha ) {\n\t\tvalues.push( [ Math.round( a * 100 ), 'A' ] );\n\t}\n\n\treturn <ValueDisplay values={ values } />;\n};\n\nconst RgbDisplay = ( { color, enableAlpha }: DisplayProps ) => {\n\tconst { r, g, b, a } = color.toRgb();\n\n\tconst values: Values = [\n\t\t[ r, 'R' ],\n\t\t[ g, 'G' ],\n\t\t[ b, 'B' ],\n\t];\n\n\tif ( enableAlpha ) {\n\t\tvalues.push( [ Math.round( a * 100 ), 'A' ] );\n\t}\n\n\treturn <ValueDisplay values={ values } />;\n};\n\nconst HexDisplay = ( { color }: DisplayProps ) => {\n\tconst colorWithoutHash = color.toHex().slice( 1 ).toUpperCase();\n\treturn (\n\t\t<FlexItem>\n\t\t\t<Text color={ COLORS.ui.theme }>#</Text>\n\t\t\t<Text>{ colorWithoutHash }</Text>\n\t\t</FlexItem>\n\t);\n};\n\nconst getComponent = ( colorType: ColorType ) => {\n\tswitch ( colorType ) {\n\t\tcase 'hsl':\n\t\t\treturn HslDisplay;\n\t\tcase 'rgb':\n\t\t\treturn RgbDisplay;\n\t\tdefault:\n\t\tcase 'hex':\n\t\t\treturn HexDisplay;\n\t}\n};\n\nexport const ColorDisplay = ( {\n\tcolor,\n\tcolorType,\n\tenableAlpha,\n}: ColorDisplayProps ) => {\n\tconst [ copiedColor, setCopiedColor ] = useState< string | null >( null );\n\tconst copyTimer = useRef< ReturnType< typeof setTimeout > | undefined >();\n\tconst props = { color, enableAlpha };\n\tconst Component = getComponent( colorType );\n\tconst copyRef = useCopyToClipboard< HTMLDivElement >(\n\t\t() => {\n\t\t\tswitch ( colorType ) {\n\t\t\t\tcase 'hsl': {\n\t\t\t\t\treturn color.toHslString();\n\t\t\t\t}\n\t\t\t\tcase 'rgb': {\n\t\t\t\t\treturn color.toRgbString();\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\tcase 'hex': {\n\t\t\t\t\treturn color.toHex();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t() => {\n\t\t\tif ( copyTimer.current ) {\n\t\t\t\tclearTimeout( copyTimer.current );\n\t\t\t}\n\t\t\tsetCopiedColor( color.toHex() );\n\t\t\tcopyTimer.current = setTimeout( () => {\n\t\t\t\tsetCopiedColor( null );\n\t\t\t\tcopyTimer.current = undefined;\n\t\t\t}, 3000 );\n\t\t}\n\t);\n\tuseEffect( () => {\n\t\t// Clear copyTimer on component unmount.\n\t\treturn () => {\n\t\t\tif ( copyTimer.current ) {\n\t\t\t\tclearTimeout( copyTimer.current );\n\t\t\t}\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<Tooltip\n\t\t\tcontent={\n\t\t\t\t<Text color=\"white\">\n\t\t\t\t\t{ copiedColor === color.toHex()\n\t\t\t\t\t\t? __( 'Copied!' )\n\t\t\t\t\t\t: __( 'Copy' ) }\n\t\t\t\t</Text>\n\t\t\t}\n\t\t>\n\t\t\t<Flex\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tgap={ space( 1 ) }\n\t\t\t\tref={ copyRef }\n\t\t\t\tstyle={ { height: 30 } }\n\t\t\t>\n\t\t\t\t<Component { ...props } />\n\t\t\t</Flex>\n\t\t</Tooltip>\n\t);\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/date.tsx"],"names":["TypedDayPickerSingleDateController","UntypedDayPickerSingleDateController","TIMEZONELESS_FORMAT","ARIAL_LABEL_TIME_FORMAT","DatePickerDay","day","events","ref","current","parentNode","Element","dayAriaLabel","format","length","setAttribute","dayWithEventsDescription","DatePicker","currentDate","onChange","isInvalidDate","onMonthPreviewed","nodeRef","onMonthPreviewedHandler","newMonthDate","toISOString","keepFocusInside","ownerDocument","activeElement","contains","focusRegion","querySelector","HTMLElement","focus","onChangeMoment","newDate","momentDate","momentTime","hours","minutes","seconds","set","getEventsPerDay","filter","eventDay","isSame","date","toDate","noop"],"mappings":";;;;;;;;;;AAoBA;;AAjBA;;AACA;;AAEA;;AAOA;;AAQA;;AAKA;;AA1BA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AAGA,MAAMA,kCAAkC,GAAGC,sCAA3C;AAEA;AACA;AACA;;AAUA,MAAMC,mBAAmB,GAAG,qBAA5B;AACA,MAAMC,uBAAuB,GAAG,UAAhC;;AAEA,SAASC,aAAT,OAAmE;AAAA,MAA3C;AAAEC,IAAAA,GAAF;AAAOC,IAAAA,MAAM,GAAG;AAAhB,GAA2C;AAClE,QAAMC,GAAG,GAAG,qBAA0B,IAA1B,CAAZ;AAEA;AACD;AACA;AACA;AACA;AACA;;AACC,0BAAW,MAAM;AAAA;;AAChB;AACA,QAAK,EAAI,CAAAA,GAAG,SAAH,IAAAA,GAAG,WAAH,4BAAAA,GAAG,CA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/B,U","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\nimport classnames from 'classnames';\nimport type { Moment } from 'moment';\nimport { noop } from 'lodash';\n\n// `react-dates` doesn't tree-shake correctly, so we import from the individual\n// component here.\n// @ts-expect-error TypeScript won't find any type declarations at\n// `react-dates/lib/components/DayPickerSingleDateController` as they're located\n// at `react-dates`.\nimport UntypedDayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';\nimport type { DayPickerSingleDateController } from 'react-dates';\nconst TypedDayPickerSingleDateController = UntypedDayPickerSingleDateController as DayPickerSingleDateController;\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { isRTL, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getMomentDate } from './utils';\nimport type { DatePickerDayProps, DatePickerProps } from './types';\n\nconst TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';\nconst ARIAL_LABEL_TIME_FORMAT = 'dddd, LL';\n\nfunction DatePickerDay( { day, events = [] }: DatePickerDayProps ) {\n\tconst ref = useRef< HTMLDivElement >( null );\n\n\t/*\n\t * a11y hack to make the `There is/are n events` string\n\t * available speaking for readers,\n\t * re-defining the aria-label attribute.\n\t * This attribute is handled by the react-dates component.\n\t */\n\tuseEffect( () => {\n\t\t// Bail when no parent node.\n\t\tif ( ! ( ref?.current?.parentNode instanceof Element ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { parentNode } = ref.current;\n\t\tconst dayAriaLabel = moment( day ).format( ARIAL_LABEL_TIME_FORMAT );\n\n\t\tif ( ! events.length ) {\n\t\t\t// Set aria-label without event description.\n\t\t\tparentNode.setAttribute( 'aria-label', dayAriaLabel );\n\t\t\treturn;\n\t\t}\n\n\t\tconst dayWithEventsDescription = sprintf(\n\t\t\t// translators: 1: Calendar day format, 2: Calendar event number.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event.',\n\t\t\t\t'%1$s. There are %2$d events.',\n\t\t\t\tevents.length\n\t\t\t),\n\t\t\tdayAriaLabel,\n\t\t\tevents.length\n\t\t);\n\n\t\tparentNode.setAttribute( 'aria-label', dayWithEventsDescription );\n\t}, [ events.length ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classnames( 'components-datetime__date__day', {\n\t\t\t\t'has-events': events?.length,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ day.format( 'D' ) }\n\t\t</div>\n\t);\n}\n\n/**\n * DatePicker is a React component that renders a calendar for date selection.\n *\n * ```jsx\n * import { DatePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDatePicker = () => {\n * const [ date, setDate ] = useState( new Date() );\n *\n * return (\n * <DatePicker\n * currentDate={ date }\n * onChange={ ( newDate ) => setDate( newDate ) }\n * />\n * );\n * };\n * ```\n */\nexport function DatePicker( {\n\tcurrentDate,\n\tonChange,\n\tevents,\n\tisInvalidDate,\n\tonMonthPreviewed,\n}: DatePickerProps ) {\n\tconst nodeRef = useRef< HTMLDivElement >( null );\n\tconst onMonthPreviewedHandler = ( newMonthDate: Moment ) => {\n\t\tonMonthPreviewed?.( newMonthDate.toISOString() );\n\t\tkeepFocusInside();\n\t};\n\n\t/*\n\t * Todo: We should remove this function ASAP.\n\t * It is kept because focus is lost when we click on the previous and next month buttons.\n\t * This focus loss closes the date picker popover.\n\t * Ideally we should add an upstream commit on react-dates to fix this issue.\n\t */\n\tconst keepFocusInside = () => {\n\t\tif ( ! nodeRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = nodeRef.current;\n\t\tconst { activeElement } = ownerDocument;\n\n\t\t// If focus was lost.\n\t\tif (\n\t\t\t! activeElement ||\n\t\t\t! nodeRef.current.contains( ownerDocument.activeElement )\n\t\t) {\n\t\t\t// Retrieve the focus region div.\n\t\t\tconst focusRegion = nodeRef.current.querySelector(\n\t\t\t\t'.DayPicker_focusRegion'\n\t\t\t);\n\t\t\tif ( ! ( focusRegion instanceof HTMLElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Keep the focus on focus region.\n\t\t\tfocusRegion.focus();\n\t\t}\n\t};\n\n\tconst onChangeMoment = ( newDate: Moment | null ) => {\n\t\tif ( ! newDate ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If currentDate is null, use now as momentTime to designate hours, minutes, seconds.\n\t\tconst momentDate = currentDate ? moment( currentDate ) : moment();\n\t\tconst momentTime = {\n\t\t\thours: momentDate.hours(),\n\t\t\tminutes: momentDate.minutes(),\n\t\t\tseconds: 0,\n\t\t};\n\n\t\tonChange?.( newDate.set( momentTime ).format( TIMEZONELESS_FORMAT ) );\n\n\t\t// Keep focus on the date picker.\n\t\tkeepFocusInside();\n\t};\n\n\tconst getEventsPerDay = ( day: Moment ) => {\n\t\tif ( ! events?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn events.filter( ( eventDay ) =>\n\t\t\tday.isSame( eventDay.date, 'day' )\n\t\t);\n\t};\n\n\tconst momentDate = getMomentDate( currentDate );\n\n\treturn (\n\t\t<div className=\"components-datetime__date\" ref={ nodeRef }>\n\t\t\t<TypedDayPickerSingleDateController\n\t\t\t\tdate={ momentDate }\n\t\t\t\tdaySize={ 30 }\n\t\t\t\tfocused\n\t\t\t\thideKeyboardShortcutsPanel\n\t\t\t\t// This is a hack to force the calendar to update on month or year change\n\t\t\t\t// https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665\n\t\t\t\tkey={ `datepicker-controller-${\n\t\t\t\t\tmomentDate ? momentDate.format( 'MM-YYYY' ) : 'null'\n\t\t\t\t}` }\n\t\t\t\tnoBorder\n\t\t\t\tnumberOfMonths={ 1 }\n\t\t\t\tonDateChange={ onChangeMoment }\n\t\t\t\ttransitionDuration={ 0 }\n\t\t\t\tweekDayFormat=\"ddd\"\n\t\t\t\tdayAriaLabelFormat={ ARIAL_LABEL_TIME_FORMAT }\n\t\t\t\tisRTL={ isRTL() }\n\t\t\t\tisOutsideRange={ ( date ) => {\n\t\t\t\t\treturn !! isInvalidDate && isInvalidDate( date.toDate() );\n\t\t\t\t} }\n\t\t\t\tonPrevMonthClick={ onMonthPreviewedHandler }\n\t\t\t\tonNextMonthClick={ onMonthPreviewedHandler }\n\t\t\t\trenderDayContents={ ( day ) => (\n\t\t\t\t\t<DatePickerDay\n\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\tevents={ getEventsPerDay( day ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\tonFocusChange={ noop }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default DatePicker;\n"]}
@@ -1,289 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.TimePicker = TimePicker;
9
- exports.default = void 0;
10
-
11
- var _element = require("@wordpress/element");
12
-
13
- var _classnames = _interopRequireDefault(require("classnames"));
14
-
15
- var _lodash = require("lodash");
16
-
17
- var _moment = _interopRequireDefault(require("moment"));
18
-
19
- var _i18n = require("@wordpress/i18n");
20
-
21
- var _button = _interopRequireDefault(require("../button"));
22
-
23
- var _buttonGroup = _interopRequireDefault(require("../button-group"));
24
-
25
- var _timezone = _interopRequireDefault(require("./timezone"));
26
-
27
- /**
28
- * External dependencies
29
- */
30
-
31
- /**
32
- * WordPress dependencies
33
- */
34
-
35
- /**
36
- * Internal dependencies
37
- */
38
- const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
39
-
40
- function from12hTo24h(hours, isPm) {
41
- return isPm ? (hours % 12 + 12) % 24 : hours % 12;
42
- }
43
- /**
44
- * A shared component to parse, validate, and handle remounting of the
45
- * underlying form field element like <input> and <select>.
46
- */
47
-
48
-
49
- function UpdateOnBlurAsIntegerField(_ref) {
50
- let {
51
- as,
52
- value,
53
- onUpdate,
54
- className,
55
- ...props
56
- } = _ref;
57
-
58
- function handleBlur(event) {
59
- const {
60
- target
61
- } = event;
62
-
63
- if (String(value) === target.value) {
64
- return;
65
- }
66
-
67
- const parsedValue = parseInt(target.value, 10); // Run basic number validation on the input.
68
-
69
- if (!(0, _lodash.isInteger)(parsedValue) || typeof props.max !== 'undefined' && parsedValue > props.max || typeof props.min !== 'undefined' && parsedValue < props.min) {
70
- // If validation failed, reset the value to the previous valid value.
71
- target.value = String(value);
72
- } else {
73
- // Otherwise, it's valid, call onUpdate.
74
- onUpdate(parsedValue);
75
- }
76
- }
77
-
78
- return (0, _element.createElement)(as || 'input', {
79
- // Re-mount the input value to accept the latest value as the defaultValue.
80
- key: value,
81
- defaultValue: value,
82
- onBlur: handleBlur,
83
- className: (0, _classnames.default)('components-datetime__time-field-integer-field', className),
84
- ...props
85
- });
86
- }
87
- /**
88
- * TimePicker is a React component that renders a clock for time selection.
89
- *
90
- * ```jsx
91
- * import { TimePicker } from '@wordpress/components';
92
- * import { useState } from '@wordpress/element';
93
- *
94
- * const MyTimePicker = () => {
95
- * const [ time, setTime ] = useState( new Date() );
96
- *
97
- * return (
98
- * <TimePicker
99
- * currentTime={ date }
100
- * onChange={ ( newTime ) => setTime( newTime ) }
101
- * is12Hour
102
- * />
103
- * );
104
- * };
105
- * ```
106
- */
107
-
108
-
109
- function TimePicker(_ref2) {
110
- let {
111
- is12Hour,
112
- currentTime,
113
- onChange
114
- } = _ref2;
115
- const [date, setDate] = (0, _element.useState)(() => // Truncate the date at the minutes, see: #15495.
116
- currentTime ? (0, _moment.default)(currentTime).startOf('minutes') : (0, _moment.default)()); // Reset the state when currentTime changed.
117
-
118
- (0, _element.useEffect)(() => {
119
- setDate(currentTime ? (0, _moment.default)(currentTime).startOf('minutes') : (0, _moment.default)());
120
- }, [currentTime]);
121
- const {
122
- day,
123
- month,
124
- year,
125
- minutes,
126
- hours,
127
- am
128
- } = (0, _element.useMemo)(() => ({
129
- day: date.format('DD'),
130
- month: date.format('MM'),
131
- year: date.format('YYYY'),
132
- minutes: date.format('mm'),
133
- hours: date.format(is12Hour ? 'hh' : 'HH'),
134
- am: Number(date.format('H')) <= 11 ? 'AM' : 'PM'
135
- }), [date, is12Hour]);
136
- /**
137
- * Function that sets the date state and calls the onChange with a new date.
138
- * The date is truncated at the minutes.
139
- *
140
- * @param {Moment} newDate The date object.
141
- */
142
-
143
- function changeDate(newDate) {
144
- setDate(newDate);
145
- onChange === null || onChange === void 0 ? void 0 : onChange(newDate.format(TIMEZONELESS_FORMAT));
146
- }
147
-
148
- function update(name) {
149
- return value => {
150
- // If the 12-hour format is being used and the 'PM' period is selected, then
151
- // the incoming value (which ranges 1-12) should be increased by 12 to match
152
- // the expected 24-hour format.
153
- let adjustedValue = value;
154
-
155
- if (name === 'hours' && is12Hour) {
156
- adjustedValue = from12hTo24h(value, am === 'PM');
157
- } // Clone the date and call the specific setter function according to `name`.
158
-
159
-
160
- const newDate = date.clone()[name](adjustedValue);
161
- changeDate(newDate);
162
- };
163
- }
164
-
165
- function updateAmPm(value) {
166
- return () => {
167
- if (am === value) {
168
- return;
169
- }
170
-
171
- const parsedHours = parseInt(hours, 10);
172
- const newDate = date.clone().hours(from12hTo24h(parsedHours, value === 'PM'));
173
- changeDate(newDate);
174
- };
175
- }
176
-
177
- const dayFormat = (0, _element.createElement)("div", {
178
- className: "components-datetime__time-field components-datetime__time-field-day"
179
- }, (0, _element.createElement)(UpdateOnBlurAsIntegerField, {
180
- "aria-label": (0, _i18n.__)('Day'),
181
- className: "components-datetime__time-field-day-input",
182
- type: "number" // The correct function to call in moment.js is "date" not "day".
183
- ,
184
- name: "date",
185
- value: day,
186
- step: 1,
187
- min: 1,
188
- max: 31,
189
- onUpdate: update('date')
190
- }));
191
- const monthFormat = (0, _element.createElement)("div", {
192
- className: "components-datetime__time-field components-datetime__time-field-month"
193
- }, (0, _element.createElement)(UpdateOnBlurAsIntegerField, {
194
- as: "select",
195
- "aria-label": (0, _i18n.__)('Month'),
196
- className: "components-datetime__time-field-month-select",
197
- name: "month",
198
- value: month // The value starts from 0, so we have to -1 when setting month.
199
- ,
200
- onUpdate: value => update('month')(value - 1)
201
- }, (0, _element.createElement)("option", {
202
- value: "01"
203
- }, (0, _i18n.__)('January')), (0, _element.createElement)("option", {
204
- value: "02"
205
- }, (0, _i18n.__)('February')), (0, _element.createElement)("option", {
206
- value: "03"
207
- }, (0, _i18n.__)('March')), (0, _element.createElement)("option", {
208
- value: "04"
209
- }, (0, _i18n.__)('April')), (0, _element.createElement)("option", {
210
- value: "05"
211
- }, (0, _i18n.__)('May')), (0, _element.createElement)("option", {
212
- value: "06"
213
- }, (0, _i18n.__)('June')), (0, _element.createElement)("option", {
214
- value: "07"
215
- }, (0, _i18n.__)('July')), (0, _element.createElement)("option", {
216
- value: "08"
217
- }, (0, _i18n.__)('August')), (0, _element.createElement)("option", {
218
- value: "09"
219
- }, (0, _i18n.__)('September')), (0, _element.createElement)("option", {
220
- value: "10"
221
- }, (0, _i18n.__)('October')), (0, _element.createElement)("option", {
222
- value: "11"
223
- }, (0, _i18n.__)('November')), (0, _element.createElement)("option", {
224
- value: "12"
225
- }, (0, _i18n.__)('December'))));
226
- const dayMonthFormat = is12Hour ? (0, _element.createElement)(_element.Fragment, null, monthFormat, dayFormat) : (0, _element.createElement)(_element.Fragment, null, dayFormat, monthFormat);
227
- return (0, _element.createElement)("div", {
228
- className: (0, _classnames.default)('components-datetime__time')
229
- }, (0, _element.createElement)("fieldset", null, (0, _element.createElement)("legend", {
230
- className: "components-datetime__time-legend invisible"
231
- }, (0, _i18n.__)('Date')), (0, _element.createElement)("div", {
232
- className: "components-datetime__time-wrapper"
233
- }, dayMonthFormat, (0, _element.createElement)("div", {
234
- className: "components-datetime__time-field components-datetime__time-field-year"
235
- }, (0, _element.createElement)(UpdateOnBlurAsIntegerField, {
236
- "aria-label": (0, _i18n.__)('Year'),
237
- className: "components-datetime__time-field-year-input",
238
- type: "number",
239
- name: "year",
240
- step: 1,
241
- min: 0,
242
- max: 9999,
243
- value: year,
244
- onUpdate: update('year')
245
- })))), (0, _element.createElement)("fieldset", null, (0, _element.createElement)("legend", {
246
- className: "components-datetime__time-legend invisible"
247
- }, (0, _i18n.__)('Time')), (0, _element.createElement)("div", {
248
- className: "components-datetime__time-wrapper"
249
- }, (0, _element.createElement)("div", {
250
- className: "components-datetime__time-field components-datetime__time-field-time"
251
- }, (0, _element.createElement)(UpdateOnBlurAsIntegerField, {
252
- "aria-label": (0, _i18n.__)('Hours'),
253
- className: "components-datetime__time-field-hours-input",
254
- type: "number",
255
- name: "hours",
256
- step: 1,
257
- min: is12Hour ? 1 : 0,
258
- max: is12Hour ? 12 : 23,
259
- value: hours,
260
- onUpdate: update('hours')
261
- }), (0, _element.createElement)("span", {
262
- className: "components-datetime__time-separator",
263
- "aria-hidden": "true"
264
- }, ":"), (0, _element.createElement)(UpdateOnBlurAsIntegerField, {
265
- "aria-label": (0, _i18n.__)('Minutes'),
266
- className: "components-datetime__time-field-minutes-input",
267
- type: "number",
268
- name: "minutes",
269
- step: 1,
270
- min: 0,
271
- max: 59,
272
- value: minutes,
273
- onUpdate: update('minutes')
274
- })), is12Hour && (0, _element.createElement)(_buttonGroup.default, {
275
- className: "components-datetime__time-field components-datetime__time-field-am-pm"
276
- }, (0, _element.createElement)(_button.default, {
277
- variant: am === 'AM' ? 'primary' : 'secondary',
278
- onClick: updateAmPm('AM'),
279
- className: "components-datetime__time-am-button"
280
- }, (0, _i18n.__)('AM')), (0, _element.createElement)(_button.default, {
281
- variant: am === 'PM' ? 'primary' : 'secondary',
282
- onClick: updateAmPm('PM'),
283
- className: "components-datetime__time-pm-button"
284
- }, (0, _i18n.__)('PM'))), (0, _element.createElement)(_timezone.default, null))));
285
- }
286
-
287
- var _default = TimePicker;
288
- exports.default = _default;
289
- //# sourceMappingURL=time.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/time.tsx"],"names":["TIMEZONELESS_FORMAT","from12hTo24h","hours","isPm","UpdateOnBlurAsIntegerField","as","value","onUpdate","className","props","handleBlur","event","target","String","parsedValue","parseInt","max","min","key","defaultValue","onBlur","TimePicker","is12Hour","currentTime","onChange","date","setDate","startOf","day","month","year","minutes","am","format","Number","changeDate","newDate","update","name","adjustedValue","clone","updateAmPm","parsedHours","dayFormat","monthFormat","dayMonthFormat"],"mappings":";;;;;;;;;;AAYA;;AATA;;AACA;;AACA;;AAaA;;AAKA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAOA;AACA;AACA;;AASA;AACA;AACA;AAOA,MAAMA,mBAAmB,GAAG,qBAA5B;;AAEA,SAASC,YAAT,CAAuBC,KAAvB,EAAsCC,IAAtC,EAAsD;AACrD,SAAOA,IAAI,GAAG,CAAID,KAAK,GAAG,EAAV,GAAiB,EAAnB,IAA0B,EAA7B,GAAkCA,KAAK,GAAG,EAArD;AACA;AAED;AACA;AACA;AACA;;;AACA,SAASE,0BAAT,OAM+E;AAAA,MAN1C;AACpCC,IAAAA,EADoC;AAEpCC,IAAAA,KAFoC;AAGpCC,IAAAA,QAHoC;AAIpCC,IAAAA,SAJoC;AAKpC,OAAGC;AALiC,GAM0C;;AAC9E,WAASC,UAAT,CAAqBC,KAArB,EAA6D;AAC5D,UAAM;AAAEC,MAAAA;AAAF,QAAaD,KAAnB;;AAEA,QAAKE,MAAM,CAAEP,KAAF,CAAN,KAAoBM,MAAM,CAACN,KAAhC,EAAwC;AACvC;AACA;;AAED,UAAMQ,WAAW,GAAGC,QAAQ,CAAEH,MAAM,CAACN,KAAT,EAAgB,EAAhB,CAA5B,CAP4D,CAS5D;;AACA,QACC,CAAE,uBAAWQ,WAAX,CAAF,IACE,OAAOL,KAAK,CAACO,GAAb,KAAqB,WAArB,IAAoCF,WAAW,GAAGL,KAAK,CAACO,GAD1D,IAEE,OAAOP,KAAK,CAACQ,GAAb,KAAqB,WAArB,IAAoCH,WAAW,GAAGL,KAAK,CAACQ,GAH3D,EAIE;AACD;AACAL,MAAAA,MAAM,CAACN,KAAP,GAAeO,MAAM,CAAEP,KAAF,C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G,cAAI,IAAJ,CAPH,CAVD,CAhCF,EAsDC,4BAAC,iBAAD,OAtDD,CAJD,CAxBD,CADD;AAwFA;;eAEcpB,U","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isInteger } from 'lodash';\nimport moment from 'moment';\nimport type { FocusEvent } from 'react';\nimport type { Moment } from 'moment';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateElement,\n\tuseState,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ButtonGroup from '../button-group';\nimport TimeZone from './timezone';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { UpdateOnBlurAsIntegerFieldProps, TimePickerProps } from './types';\n\nconst TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';\n\nfunction from12hTo24h( hours: number, isPm: boolean ) {\n\treturn isPm ? ( ( hours % 12 ) + 12 ) % 24 : hours % 12;\n}\n\n/**\n * A shared component to parse, validate, and handle remounting of the\n * underlying form field element like <input> and <select>.\n */\nfunction UpdateOnBlurAsIntegerField( {\n\tas,\n\tvalue,\n\tonUpdate,\n\tclassName,\n\t...props\n}: WordPressComponentProps< UpdateOnBlurAsIntegerFieldProps, 'input', true > ) {\n\tfunction handleBlur( event: FocusEvent< HTMLInputElement > ) {\n\t\tconst { target } = event;\n\n\t\tif ( String( value ) === target.value ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst parsedValue = parseInt( target.value, 10 );\n\n\t\t// Run basic number validation on the input.\n\t\tif (\n\t\t\t! isInteger( parsedValue ) ||\n\t\t\t( typeof props.max !== 'undefined' && parsedValue > props.max ) ||\n\t\t\t( typeof props.min !== 'undefined' && parsedValue < props.min )\n\t\t) {\n\t\t\t// If validation failed, reset the value to the previous valid value.\n\t\t\ttarget.value = String( value );\n\t\t} else {\n\t\t\t// Otherwise, it's valid, call onUpdate.\n\t\t\tonUpdate( parsedValue );\n\t\t}\n\t}\n\n\treturn createElement( as || 'input', {\n\t\t// Re-mount the input value to accept the latest value as the defaultValue.\n\t\tkey: value,\n\t\tdefaultValue: value,\n\t\tonBlur: handleBlur,\n\t\tclassName: classnames(\n\t\t\t'components-datetime__time-field-integer-field',\n\t\t\tclassName\n\t\t),\n\t\t...props,\n\t} );\n}\n\n/**\n * TimePicker is a React component that renders a clock for time selection.\n *\n * ```jsx\n * import { TimePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTimePicker = () => {\n * const [ time, setTime ] = useState( new Date() );\n *\n * return (\n * <TimePicker\n * currentTime={ date }\n * onChange={ ( newTime ) => setTime( newTime ) }\n * is12Hour\n * />\n * );\n * };\n * ```\n */\nexport function TimePicker( {\n\tis12Hour,\n\tcurrentTime,\n\tonChange,\n}: TimePickerProps ) {\n\tconst [ date, setDate ] = useState( () =>\n\t\t// Truncate the date at the minutes, see: #15495.\n\t\tcurrentTime ? moment( currentTime ).startOf( 'minutes' ) : moment()\n\t);\n\n\t// Reset the state when currentTime changed.\n\tuseEffect( () => {\n\t\tsetDate(\n\t\t\tcurrentTime ? moment( currentTime ).startOf( 'minutes' ) : moment()\n\t\t);\n\t}, [ currentTime ] );\n\n\tconst { day, month, year, minutes, hours, am } = useMemo(\n\t\t() => ( {\n\t\t\tday: date.format( 'DD' ),\n\t\t\tmonth: date.format( 'MM' ),\n\t\t\tyear: date.format( 'YYYY' ),\n\t\t\tminutes: date.format( 'mm' ),\n\t\t\thours: date.format( is12Hour ? 'hh' : 'HH' ),\n\t\t\tam: Number( date.format( 'H' ) ) <= 11 ? 'AM' : 'PM',\n\t\t} ),\n\t\t[ date, is12Hour ]\n\t);\n\n\t/**\n\t * Function that sets the date state and calls the onChange with a new date.\n\t * The date is truncated at the minutes.\n\t *\n\t * @param {Moment} newDate The date object.\n\t */\n\tfunction changeDate( newDate: Moment ) {\n\t\tsetDate( newDate );\n\t\tonChange?.( newDate.format( TIMEZONELESS_FORMAT ) );\n\t}\n\n\tfunction update( name: 'date' | 'month' | 'year' | 'hours' | 'minutes' ) {\n\t\treturn ( value: number ) => {\n\t\t\t// If the 12-hour format is being used and the 'PM' period is selected, then\n\t\t\t// the incoming value (which ranges 1-12) should be increased by 12 to match\n\t\t\t// the expected 24-hour format.\n\t\t\tlet adjustedValue = value;\n\t\t\tif ( name === 'hours' && is12Hour ) {\n\t\t\t\tadjustedValue = from12hTo24h( value, am === 'PM' );\n\t\t\t}\n\n\t\t\t// Clone the date and call the specific setter function according to `name`.\n\t\t\tconst newDate = date.clone()[ name ]( adjustedValue );\n\t\t\tchangeDate( newDate );\n\t\t};\n\t}\n\n\tfunction updateAmPm( value: 'AM' | 'PM' ) {\n\t\treturn () => {\n\t\t\tif ( am === value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst parsedHours = parseInt( hours, 10 );\n\n\t\t\tconst newDate = date\n\t\t\t\t.clone()\n\t\t\t\t.hours( from12hTo24h( parsedHours, value === 'PM' ) );\n\n\t\t\tchangeDate( newDate );\n\t\t};\n\t}\n\n\tconst dayFormat = (\n\t\t<div className=\"components-datetime__time-field components-datetime__time-field-day\">\n\t\t\t<UpdateOnBlurAsIntegerField\n\t\t\t\taria-label={ __( 'Day' ) }\n\t\t\t\tclassName=\"components-datetime__time-field-day-input\"\n\t\t\t\ttype=\"number\"\n\t\t\t\t// The correct function to call in moment.js is \"date\" not \"day\".\n\t\t\t\tname=\"date\"\n\t\t\t\tvalue={ day }\n\t\t\t\tstep={ 1 }\n\t\t\t\tmin={ 1 }\n\t\t\t\tmax={ 31 }\n\t\t\t\tonUpdate={ update( 'date' ) }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\tconst monthFormat = (\n\t\t<div className=\"components-datetime__time-field components-datetime__time-field-month\">\n\t\t\t<UpdateOnBlurAsIntegerField\n\t\t\t\tas=\"select\"\n\t\t\t\taria-label={ __( 'Month' ) }\n\t\t\t\tclassName=\"components-datetime__time-field-month-select\"\n\t\t\t\tname=\"month\"\n\t\t\t\tvalue={ month }\n\t\t\t\t// The value starts from 0, so we have to -1 when setting month.\n\t\t\t\tonUpdate={ ( value ) => update( 'month' )( value - 1 ) }\n\t\t\t>\n\t\t\t\t<option value=\"01\">{ __( 'January' ) }</option>\n\t\t\t\t<option value=\"02\">{ __( 'February' ) }</option>\n\t\t\t\t<option value=\"03\">{ __( 'March' ) }</option>\n\t\t\t\t<option value=\"04\">{ __( 'April' ) }</option>\n\t\t\t\t<option value=\"05\">{ __( 'May' ) }</option>\n\t\t\t\t<option value=\"06\">{ __( 'June' ) }</option>\n\t\t\t\t<option value=\"07\">{ __( 'July' ) }</option>\n\t\t\t\t<option value=\"08\">{ __( 'August' ) }</option>\n\t\t\t\t<option value=\"09\">{ __( 'September' ) }</option>\n\t\t\t\t<option value=\"10\">{ __( 'October' ) }</option>\n\t\t\t\t<option value=\"11\">{ __( 'November' ) }</option>\n\t\t\t\t<option value=\"12\">{ __( 'December' ) }</option>\n\t\t\t</UpdateOnBlurAsIntegerField>\n\t\t</div>\n\t);\n\n\tconst dayMonthFormat = is12Hour ? (\n\t\t<>\n\t\t\t{ monthFormat }\n\t\t\t{ dayFormat }\n\t\t</>\n\t) : (\n\t\t<>\n\t\t\t{ dayFormat }\n\t\t\t{ monthFormat }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className={ classnames( 'components-datetime__time' ) }>\n\t\t\t<fieldset>\n\t\t\t\t<legend className=\"components-datetime__time-legend invisible\">\n\t\t\t\t\t{ __( 'Date' ) }\n\t\t\t\t</legend>\n\t\t\t\t<div className=\"components-datetime__time-wrapper\">\n\t\t\t\t\t{ dayMonthFormat }\n\n\t\t\t\t\t<div className=\"components-datetime__time-field components-datetime__time-field-year\">\n\t\t\t\t\t\t<UpdateOnBlurAsIntegerField\n\t\t\t\t\t\t\taria-label={ __( 'Year' ) }\n\t\t\t\t\t\t\tclassName=\"components-datetime__time-field-year-input\"\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tname=\"year\"\n\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 9999 }\n\t\t\t\t\t\t\tvalue={ year }\n\t\t\t\t\t\t\tonUpdate={ update( 'year' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\n\t\t\t<fieldset>\n\t\t\t\t<legend className=\"components-datetime__time-legend invisible\">\n\t\t\t\t\t{ __( 'Time' ) }\n\t\t\t\t</legend>\n\t\t\t\t<div className=\"components-datetime__time-wrapper\">\n\t\t\t\t\t<div className=\"components-datetime__time-field components-datetime__time-field-time\">\n\t\t\t\t\t\t<UpdateOnBlurAsIntegerField\n\t\t\t\t\t\t\taria-label={ __( 'Hours' ) }\n\t\t\t\t\t\t\tclassName=\"components-datetime__time-field-hours-input\"\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tname=\"hours\"\n\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\tmin={ is12Hour ? 1 : 0 }\n\t\t\t\t\t\t\tmax={ is12Hour ? 12 : 23 }\n\t\t\t\t\t\t\tvalue={ hours }\n\t\t\t\t\t\t\tonUpdate={ update( 'hours' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"components-datetime__time-separator\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t:\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<UpdateOnBlurAsIntegerField\n\t\t\t\t\t\t\taria-label={ __( 'Minutes' ) }\n\t\t\t\t\t\t\tclassName=\"components-datetime__time-field-minutes-input\"\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tname=\"minutes\"\n\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 59 }\n\t\t\t\t\t\t\tvalue={ minutes }\n\t\t\t\t\t\t\tonUpdate={ update( 'minutes' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ is12Hour && (\n\t\t\t\t\t\t<ButtonGroup className=\"components-datetime__time-field components-datetime__time-field-am-pm\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tam === 'AM' ? 'primary' : 'secondary'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ updateAmPm( 'AM' ) }\n\t\t\t\t\t\t\t\tclassName=\"components-datetime__time-am-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'AM' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tam === 'PM' ? 'primary' : 'secondary'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ updateAmPm( 'PM' ) }\n\t\t\t\t\t\t\t\tclassName=\"components-datetime__time-pm-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'PM' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<TimeZone />\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</div>\n\t);\n}\n\nexport default TimePicker;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/timezone.tsx"],"names":["TimeZone","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG,MAAM;AACtB,QAAM;AAAEC,IAAAA;AAAF,MAAe,sCAArB,CADsB,CAGtB;;AACA,QAAMC,kBAAkB,GAAG,CAAC,CAAD,IAAO,IAAIC,IAAJ,GAAWC,iBAAX,KAAiC,EAAxC,CAA3B,CAJsB,CAMtB;AACA;;AACA,MAAKC,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,KAA8BJ,kBAAnC,EAAwD;AACvD,WAAO,IAAP;AACA;;AAED,QAAMK,YAAY,GAAGF,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,IAA6B,CAA7B,GAAiC,GAAjC,GAAuC,EAA5D;AACA,QAAME,QAAQ,GACb,OAAOP,QAAQ,CAACQ,IAAhB,IAAwBC,KAAK,CAAEL,MAAM,CAAEJ,QAAQ,CAACQ,IAAX,CAAR,CAA7B,GACGR,QAAQ,CAACQ,IADZ,GAEI,MAAMF,YAAc,GAAGN,QAAQ,CAACK,MAAQ,EAH7C;AAKA,QAAMK,cAAc,GACnB,UAAUV,QAAQ,CAACW,MAAnB,GACG,cAAI,4BAAJ,CADH,GAEI,IAAIJ,QAAU,KAAKP,QAAQ,CAACW,MAAT,CAAgBC,OAAhB,CAAyB,GAAzB,EAA8B,GAA9B,CAAqC,EAH7D;AAKA,SACC,4BAAC,gBAAD;AAAS,IAAA,QAAQ,EAAC,YAAlB;AAA+B,IAAA,IAAI,EAAGF;AAAtC,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KAAiDH,QAAjD,CADD,CADD;AAKA,CA5BD;;eA8BeR,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalGetSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\n\n/**\n * Displays timezone information when user timezone is different from site\n * timezone.\n */\nconst TimeZone = () => {\n\tconst { timezone } = getDateSettings();\n\n\t// Convert timezone offset to hours.\n\tconst userTimezoneOffset = -1 * ( new Date().getTimezoneOffset() / 60 );\n\n\t// System timezone and user timezone match, nothing needed.\n\t// Compare as numbers because it comes over as string.\n\tif ( Number( timezone.offset ) === userTimezoneOffset ) {\n\t\treturn null;\n\t}\n\n\tconst offsetSymbol = Number( timezone.offset ) >= 0 ? '+' : '';\n\tconst zoneAbbr =\n\t\t'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )\n\t\t\t? timezone.abbr\n\t\t\t: `UTC${ offsetSymbol }${ timezone.offset }`;\n\n\tconst timezoneDetail =\n\t\t'UTC' === timezone.string\n\t\t\t? __( 'Coordinated Universal Time' )\n\t\t\t: `(${ zoneAbbr }) ${ timezone.string.replace( '_', ' ' ) }`;\n\n\treturn (\n\t\t<Tooltip position=\"top center\" text={ timezoneDetail }>\n\t\t\t<div className=\"components-datetime__timezone\">{ zoneAbbr }</div>\n\t\t</Tooltip>\n\t);\n};\n\nexport default TimeZone;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/date-time/utils.ts"],"names":["getMomentDate","date"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAKC,IAAF,IAA4C;AACxE,MAAK,SAASA,IAAd,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SAAOA,IAAI,GAAG,qBAAQA,IAAR,CAAH,GAAoB,sBAA/B;AACA,CALM","sourcesContent":["/**\n * External dependencies\n */\nimport moment from 'moment';\n\n/**\n * Create a Moment object from a date string. With no date supplied, default to\n * a Moment object representing now. If a null value is passed, return a null\n * value.\n *\n * @param [date] Date representing the currently selected\n * date or null to signify no selection.\n * @return Moment object for selected date or null.\n */\nexport const getMomentDate = ( date?: Date | string | number | null ) => {\n\tif ( null === date ) {\n\t\treturn null;\n\t}\n\treturn date ? moment( date ) : moment();\n};\n"]}
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useCombinedRef = useCombinedRef;
7
-
8
- var _element = require("@wordpress/element");
9
-
10
- /**
11
- * WordPress dependencies
12
- */
13
- function useCombinedRef() {
14
- for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
15
- refs[_key] = arguments[_key];
16
- }
17
-
18
- const targetRef = (0, _element.useRef)(null);
19
- (0, _element.useEffect)(() => {
20
- refs.forEach(ref => {
21
- if (!ref) return;
22
-
23
- if (typeof ref === 'function') {
24
- ref(targetRef.current);
25
- } else {
26
- ref.current = targetRef.current;
27
- }
28
- });
29
- }, [refs]);
30
- return targetRef;
31
- }
32
- //# sourceMappingURL=use-combined-ref.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-combined-ref.ts"],"names":["useCombinedRef","refs","targetRef","forEach","ref","current"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AASO,SAASA,cAAT,GAAwE;AAAA,oCAAnBC,IAAmB;AAAnBA,IAAAA,IAAmB;AAAA;;AAC9E,QAAMC,SAAS,GAAG,qBAAQ,IAAR,CAAlB;AAEA,0BAAW,MAAM;AAChBD,IAAAA,IAAI,CAACE,OAAL,CAAgBC,GAAF,IAAW;AACxB,UAAK,CAAEA,GAAP,EAAa;;AAEb,UAAK,OAAOA,GAAP,KAAe,UAApB,EAAiC;AAChCA,QAAAA,GAAG,CAAEF,SAAS,CAACG,OAAZ,CAAH;AACA,OAFD,MAEO;AACND,QAAAA,GAAG,CAACC,OAAJ,GAAcH,SAAS,CAACG,OAAxB;AACA;AACD,KARD;AASA,GAVD,EAUG,CAAEJ,IAAF,CAVH;AAYA,SAAOC,SAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\n/**\n * External dependencies\n */\nimport type { MutableRefObject, RefCallback } from 'react';\n\ntype Ref< T > = MutableRefObject< T | null > | RefCallback< T | null >;\n\nexport function useCombinedRef< T extends HTMLElement >( ...refs: Ref< T >[] ) {\n\tconst targetRef = useRef( null );\n\n\tuseEffect( () => {\n\t\trefs.forEach( ( ref ) => {\n\t\t\tif ( ! ref ) return;\n\n\t\t\tif ( typeof ref === 'function' ) {\n\t\t\t\tref( targetRef.current );\n\t\t\t} else {\n\t\t\t\tref.current = targetRef.current;\n\t\t\t}\n\t\t} );\n\t}, [ refs ] );\n\n\treturn targetRef;\n}\n"]}