@wordpress/components 29.12.0 → 30.0.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 (337) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/build/autocomplete/index.js +4 -0
  3. package/build/autocomplete/index.js.map +1 -1
  4. package/build/box-control/input-control.js +2 -2
  5. package/build/box-control/input-control.js.map +1 -1
  6. package/build/calendar/date-calendar/index.js +69 -0
  7. package/build/calendar/date-calendar/index.js.map +1 -0
  8. package/build/calendar/date-range-calendar/index.js +172 -0
  9. package/build/calendar/date-range-calendar/index.js.map +1 -0
  10. package/build/calendar/index.js +27 -0
  11. package/build/calendar/index.js.map +1 -0
  12. package/build/calendar/types.js +6 -0
  13. package/build/calendar/types.js.map +1 -0
  14. package/build/calendar/utils/constants.js +68 -0
  15. package/build/calendar/utils/constants.js.map +1 -0
  16. package/build/calendar/utils/day-cell.js +137 -0
  17. package/build/calendar/utils/day-cell.js.map +1 -0
  18. package/build/calendar/utils/misc.js +10 -0
  19. package/build/calendar/utils/misc.js.map +1 -0
  20. package/build/calendar/utils/use-localization-props.js +162 -0
  21. package/build/calendar/utils/use-localization-props.js.map +1 -0
  22. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -1
  23. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  24. package/build/custom-select-control-v2/custom-select.js +3 -3
  25. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  26. package/build/date-time/date/index.js +1 -1
  27. package/build/date-time/date/index.js.map +1 -1
  28. package/build/form-token-field/index.js +11 -1
  29. package/build/form-token-field/index.js.map +1 -1
  30. package/build/form-token-field/token.js +1 -1
  31. package/build/form-token-field/token.js.map +1 -1
  32. package/build/icon/index.js +2 -0
  33. package/build/icon/index.js.map +1 -1
  34. package/build/mobile/bottom-sheet/cell.native.js +2 -2
  35. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  36. package/build/mobile/link-picker/index.native.js +1 -1
  37. package/build/mobile/link-picker/index.native.js.map +1 -1
  38. package/build/navigation/menu/menu-title-search.js +1 -1
  39. package/build/navigation/menu/menu-title-search.js.map +1 -1
  40. package/build/palette-edit/index.js +4 -4
  41. package/build/palette-edit/index.js.map +1 -1
  42. package/build/private-apis.js +5 -1
  43. package/build/private-apis.js.map +1 -1
  44. package/build/select-control/index.js +1 -1
  45. package/build/select-control/index.js.map +1 -1
  46. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  47. package/build/utils/hooks/use-controlled-value.js +8 -4
  48. package/build/utils/hooks/use-controlled-value.js.map +1 -1
  49. package/build/validated-form-controls/components/checkbox-control.js +52 -0
  50. package/build/validated-form-controls/components/checkbox-control.js.map +1 -0
  51. package/build/validated-form-controls/components/combobox-control.js +64 -0
  52. package/build/validated-form-controls/components/combobox-control.js.map +1 -0
  53. package/build/validated-form-controls/components/custom-select-control.js +71 -0
  54. package/build/validated-form-controls/components/custom-select-control.js.map +1 -0
  55. package/build/validated-form-controls/components/index.js +138 -0
  56. package/build/validated-form-controls/components/index.js.map +1 -0
  57. package/build/validated-form-controls/components/input-control.js +50 -0
  58. package/build/validated-form-controls/components/input-control.js.map +1 -0
  59. package/build/validated-form-controls/components/number-control.js +53 -0
  60. package/build/validated-form-controls/components/number-control.js.map +1 -0
  61. package/build/validated-form-controls/components/radio-control.js +51 -0
  62. package/build/validated-form-controls/components/radio-control.js.map +1 -0
  63. package/build/validated-form-controls/components/range-control.js +51 -0
  64. package/build/validated-form-controls/components/range-control.js.map +1 -0
  65. package/build/validated-form-controls/components/select-control.js +53 -0
  66. package/build/validated-form-controls/components/select-control.js.map +1 -0
  67. package/build/validated-form-controls/components/text-control.js +51 -0
  68. package/build/validated-form-controls/components/text-control.js.map +1 -0
  69. package/build/validated-form-controls/components/textarea-control.js +50 -0
  70. package/build/validated-form-controls/components/textarea-control.js.map +1 -0
  71. package/build/validated-form-controls/components/toggle-control.js +60 -0
  72. package/build/validated-form-controls/components/toggle-control.js.map +1 -0
  73. package/build/validated-form-controls/components/toggle-group-control.js +69 -0
  74. package/build/validated-form-controls/components/toggle-group-control.js.map +1 -0
  75. package/build/validated-form-controls/components/types.js +6 -0
  76. package/build/validated-form-controls/components/types.js.map +1 -0
  77. package/build/validated-form-controls/control-with-error.js +137 -0
  78. package/build/validated-form-controls/control-with-error.js.map +1 -0
  79. package/build/validated-form-controls/index.js +28 -0
  80. package/build/validated-form-controls/index.js.map +1 -0
  81. package/build-module/autocomplete/index.js +4 -0
  82. package/build-module/autocomplete/index.js.map +1 -1
  83. package/build-module/box-control/input-control.js +2 -2
  84. package/build-module/box-control/input-control.js.map +1 -1
  85. package/build-module/calendar/date-calendar/index.js +59 -0
  86. package/build-module/calendar/date-calendar/index.js.map +1 -0
  87. package/build-module/calendar/date-range-calendar/index.js +161 -0
  88. package/build-module/calendar/date-range-calendar/index.js.map +1 -0
  89. package/build-module/calendar/index.js +4 -0
  90. package/build-module/calendar/index.js.map +1 -0
  91. package/build-module/calendar/types.js +2 -0
  92. package/build-module/calendar/types.js.map +1 -0
  93. package/build-module/calendar/utils/constants.js +61 -0
  94. package/build-module/calendar/utils/constants.js.map +1 -0
  95. package/build-module/calendar/utils/day-cell.js +131 -0
  96. package/build-module/calendar/utils/day-cell.js.map +1 -0
  97. package/build-module/calendar/utils/misc.js +4 -0
  98. package/build-module/calendar/utils/misc.js.map +1 -0
  99. package/build-module/calendar/utils/use-localization-props.js +154 -0
  100. package/build-module/calendar/utils/use-localization-props.js.map +1 -0
  101. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -1
  102. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  103. package/build-module/custom-select-control-v2/custom-select.js +4 -4
  104. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  105. package/build-module/date-time/date/index.js +1 -1
  106. package/build-module/date-time/date/index.js.map +1 -1
  107. package/build-module/form-token-field/index.js +11 -1
  108. package/build-module/form-token-field/index.js.map +1 -1
  109. package/build-module/form-token-field/token.js +1 -1
  110. package/build-module/form-token-field/token.js.map +1 -1
  111. package/build-module/icon/index.js +2 -0
  112. package/build-module/icon/index.js.map +1 -1
  113. package/build-module/mobile/bottom-sheet/cell.native.js +2 -2
  114. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  115. package/build-module/mobile/link-picker/index.native.js +1 -1
  116. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  117. package/build-module/navigation/menu/menu-title-search.js +1 -1
  118. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  119. package/build-module/palette-edit/index.js +4 -4
  120. package/build-module/palette-edit/index.js.map +1 -1
  121. package/build-module/private-apis.js +5 -1
  122. package/build-module/private-apis.js.map +1 -1
  123. package/build-module/select-control/index.js +1 -1
  124. package/build-module/select-control/index.js.map +1 -1
  125. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  126. package/build-module/utils/hooks/use-controlled-value.js +9 -5
  127. package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
  128. package/build-module/validated-form-controls/components/checkbox-control.js +44 -0
  129. package/build-module/validated-form-controls/components/checkbox-control.js.map +1 -0
  130. package/build-module/validated-form-controls/components/combobox-control.js +56 -0
  131. package/build-module/validated-form-controls/components/combobox-control.js.map +1 -0
  132. package/build-module/validated-form-controls/components/custom-select-control.js +63 -0
  133. package/build-module/validated-form-controls/components/custom-select-control.js.map +1 -0
  134. package/build-module/validated-form-controls/components/index.js +13 -0
  135. package/build-module/validated-form-controls/components/index.js.map +1 -0
  136. package/build-module/validated-form-controls/components/input-control.js +42 -0
  137. package/build-module/validated-form-controls/components/input-control.js.map +1 -0
  138. package/build-module/validated-form-controls/components/number-control.js +45 -0
  139. package/build-module/validated-form-controls/components/number-control.js.map +1 -0
  140. package/build-module/validated-form-controls/components/radio-control.js +43 -0
  141. package/build-module/validated-form-controls/components/radio-control.js.map +1 -0
  142. package/build-module/validated-form-controls/components/range-control.js +43 -0
  143. package/build-module/validated-form-controls/components/range-control.js.map +1 -0
  144. package/build-module/validated-form-controls/components/select-control.js +45 -0
  145. package/build-module/validated-form-controls/components/select-control.js.map +1 -0
  146. package/build-module/validated-form-controls/components/text-control.js +43 -0
  147. package/build-module/validated-form-controls/components/text-control.js.map +1 -0
  148. package/build-module/validated-form-controls/components/textarea-control.js +42 -0
  149. package/build-module/validated-form-controls/components/textarea-control.js.map +1 -0
  150. package/build-module/validated-form-controls/components/toggle-control.js +52 -0
  151. package/build-module/validated-form-controls/components/toggle-control.js.map +1 -0
  152. package/build-module/validated-form-controls/components/toggle-group-control.js +62 -0
  153. package/build-module/validated-form-controls/components/toggle-group-control.js.map +1 -0
  154. package/build-module/validated-form-controls/components/types.js +2 -0
  155. package/build-module/validated-form-controls/components/types.js.map +1 -0
  156. package/build-module/validated-form-controls/control-with-error.js +129 -0
  157. package/build-module/validated-form-controls/control-with-error.js.map +1 -0
  158. package/build-module/validated-form-controls/index.js +3 -0
  159. package/build-module/validated-form-controls/index.js.map +1 -0
  160. package/build-style/style-rtl.css +418 -22
  161. package/build-style/style.css +418 -22
  162. package/build-types/autocomplete/index.d.ts.map +1 -1
  163. package/build-types/box-control/input-control.d.ts.map +1 -1
  164. package/build-types/box-control/utils.d.ts +7 -7
  165. package/build-types/calendar/date-calendar/index.d.ts +11 -0
  166. package/build-types/calendar/date-calendar/index.d.ts.map +1 -0
  167. package/build-types/calendar/date-range-calendar/index.d.ts +14 -0
  168. package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -0
  169. package/build-types/calendar/index.d.ts +4 -0
  170. package/build-types/calendar/index.d.ts.map +1 -0
  171. package/build-types/calendar/stories/date-calendar.story.d.ts +16 -0
  172. package/build-types/calendar/stories/date-calendar.story.d.ts.map +1 -0
  173. package/build-types/calendar/stories/date-range-calendar.story.d.ts +16 -0
  174. package/build-types/calendar/stories/date-range-calendar.story.d.ts.map +1 -0
  175. package/build-types/calendar/test/__utils__/index.d.ts +10 -0
  176. package/build-types/calendar/test/__utils__/index.d.ts.map +1 -0
  177. package/build-types/calendar/test/date-calendar.d.ts +2 -0
  178. package/build-types/calendar/test/date-calendar.d.ts.map +1 -0
  179. package/build-types/calendar/test/date-range-calendar.d.ts +2 -0
  180. package/build-types/calendar/test/date-range-calendar.d.ts.map +1 -0
  181. package/build-types/calendar/types.d.ts +317 -0
  182. package/build-types/calendar/types.d.ts.map +1 -0
  183. package/build-types/calendar/utils/constants.d.ts +52 -0
  184. package/build-types/calendar/utils/constants.d.ts.map +1 -0
  185. package/build-types/calendar/utils/day-cell.d.ts +21 -0
  186. package/build-types/calendar/utils/day-cell.d.ts.map +1 -0
  187. package/build-types/calendar/utils/misc.d.ts +2 -0
  188. package/build-types/calendar/utils/misc.d.ts.map +1 -0
  189. package/build-types/calendar/utils/use-localization-props.d.ts +64 -0
  190. package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -0
  191. package/build-types/color-picker/styles.d.ts.map +1 -1
  192. package/build-types/custom-gradient-picker/constants.d.ts +6 -3
  193. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
  194. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  195. package/build-types/dimension-control/sizes.d.ts +15 -3
  196. package/build-types/dimension-control/sizes.d.ts.map +1 -1
  197. package/build-types/font-size-picker/constants.d.ts +2 -2
  198. package/build-types/font-size-picker/constants.d.ts.map +1 -1
  199. package/build-types/form-token-field/index.d.ts.map +1 -1
  200. package/build-types/icon/index.d.ts.map +1 -1
  201. package/build-types/popover/overlay-middlewares.d.ts +6 -1
  202. package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
  203. package/build-types/private-apis.d.ts.map +1 -1
  204. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  205. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  206. package/build-types/utils/hooks/use-controlled-value.d.ts +2 -2
  207. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  208. package/build-types/validated-form-controls/components/checkbox-control.d.ts +9 -0
  209. package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -0
  210. package/build-types/validated-form-controls/components/combobox-control.d.ts +21 -0
  211. package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -0
  212. package/build-types/validated-form-controls/components/custom-select-control.d.ts +4 -0
  213. package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -0
  214. package/build-types/validated-form-controls/components/index.d.ts +13 -0
  215. package/build-types/validated-form-controls/components/index.d.ts.map +1 -0
  216. package/build-types/validated-form-controls/components/input-control.d.ts +4 -0
  217. package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -0
  218. package/build-types/validated-form-controls/components/number-control.d.ts +17 -0
  219. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -0
  220. package/build-types/validated-form-controls/components/radio-control.d.ts +11 -0
  221. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -0
  222. package/build-types/validated-form-controls/components/range-control.d.ts +36 -0
  223. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -0
  224. package/build-types/validated-form-controls/components/select-control.d.ts +9 -0
  225. package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -0
  226. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts +12 -0
  227. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -0
  228. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts +12 -0
  229. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -0
  230. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts +12 -0
  231. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -0
  232. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts +18 -0
  233. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -0
  234. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts +12 -0
  235. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -0
  236. package/build-types/validated-form-controls/components/stories/overview.story.d.ts +19 -0
  237. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -0
  238. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts +12 -0
  239. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -0
  240. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts +9 -0
  241. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -0
  242. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts +12 -0
  243. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -0
  244. package/build-types/validated-form-controls/components/stories/story-utils.d.ts +9 -0
  245. package/build-types/validated-form-controls/components/stories/story-utils.d.ts.map +1 -0
  246. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts +9 -0
  247. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -0
  248. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts +9 -0
  249. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -0
  250. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts +9 -0
  251. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -0
  252. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts +9 -0
  253. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -0
  254. package/build-types/validated-form-controls/components/text-control.d.ts +8 -0
  255. package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -0
  256. package/build-types/validated-form-controls/components/textarea-control.d.ts +7 -0
  257. package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -0
  258. package/build-types/validated-form-controls/components/toggle-control.d.ts +7 -0
  259. package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -0
  260. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +15 -0
  261. package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -0
  262. package/build-types/validated-form-controls/components/types.d.ts +27 -0
  263. package/build-types/validated-form-controls/components/types.d.ts.map +1 -0
  264. package/build-types/validated-form-controls/control-with-error.d.ts +36 -0
  265. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -0
  266. package/build-types/validated-form-controls/index.d.ts +3 -0
  267. package/build-types/validated-form-controls/index.d.ts.map +1 -0
  268. package/package.json +21 -20
  269. package/src/autocomplete/index.tsx +4 -0
  270. package/src/box-control/input-control.tsx +14 -5
  271. package/src/calendar/date-calendar/README.md +261 -0
  272. package/src/calendar/date-calendar/index.tsx +69 -0
  273. package/src/calendar/date-range-calendar/README.md +298 -0
  274. package/src/calendar/date-range-calendar/index.tsx +215 -0
  275. package/src/calendar/index.tsx +3 -0
  276. package/src/calendar/stories/date-calendar.story.tsx +221 -0
  277. package/src/calendar/stories/date-range-calendar.story.tsx +230 -0
  278. package/src/calendar/style.scss +431 -0
  279. package/src/calendar/test/__utils__/index.ts +56 -0
  280. package/src/calendar/test/date-calendar.tsx +975 -0
  281. package/src/calendar/test/date-range-calendar.tsx +1701 -0
  282. package/src/calendar/types.ts +342 -0
  283. package/src/calendar/utils/constants.ts +62 -0
  284. package/src/calendar/utils/day-cell.tsx +133 -0
  285. package/src/calendar/utils/misc.ts +3 -0
  286. package/src/calendar/utils/use-localization-props.ts +169 -0
  287. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
  288. package/src/custom-select-control-v2/custom-select.tsx +6 -3
  289. package/src/date-time/date/index.tsx +1 -1
  290. package/src/dimension-control/test/__snapshots__/index.test.js.snap +8 -8
  291. package/src/form-token-field/index.tsx +12 -1
  292. package/src/form-token-field/token.tsx +1 -1
  293. package/src/icon/index.tsx +2 -0
  294. package/src/mobile/bottom-sheet/cell.native.js +2 -2
  295. package/src/mobile/link-picker/index.native.js +1 -1
  296. package/src/navigation/menu/menu-title-search.tsx +1 -1
  297. package/src/palette-edit/index.tsx +4 -4
  298. package/src/private-apis.ts +5 -0
  299. package/src/select-control/index.tsx +1 -1
  300. package/src/select-control/style.scss +0 -6
  301. package/src/style.scss +3 -2
  302. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +3 -1
  303. package/src/utils/hooks/use-controlled-value.ts +16 -8
  304. package/src/validated-form-controls/components/checkbox-control.tsx +64 -0
  305. package/src/validated-form-controls/components/combobox-control.tsx +77 -0
  306. package/src/validated-form-controls/components/custom-select-control.tsx +86 -0
  307. package/src/validated-form-controls/components/index.ts +12 -0
  308. package/src/validated-form-controls/components/input-control.tsx +59 -0
  309. package/src/validated-form-controls/components/number-control.tsx +61 -0
  310. package/src/validated-form-controls/components/radio-control.tsx +60 -0
  311. package/src/validated-form-controls/components/range-control.tsx +60 -0
  312. package/src/validated-form-controls/components/select-control.tsx +75 -0
  313. package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +57 -0
  314. package/src/validated-form-controls/components/stories/combobox-control.story.tsx +64 -0
  315. package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +64 -0
  316. package/src/validated-form-controls/components/stories/input-control.story.tsx +132 -0
  317. package/src/validated-form-controls/components/stories/number-control.story.tsx +62 -0
  318. package/src/validated-form-controls/components/stories/overview.mdx +52 -0
  319. package/src/validated-form-controls/components/stories/overview.story.tsx +100 -0
  320. package/src/validated-form-controls/components/stories/radio-control.story.tsx +64 -0
  321. package/src/validated-form-controls/components/stories/range-control.story.tsx +60 -0
  322. package/src/validated-form-controls/components/stories/select-control.story.tsx +60 -0
  323. package/src/validated-form-controls/components/stories/story-utils.tsx +46 -0
  324. package/src/validated-form-controls/components/stories/text-control.story.tsx +55 -0
  325. package/src/validated-form-controls/components/stories/textarea-control.story.tsx +52 -0
  326. package/src/validated-form-controls/components/stories/toggle-control.story.tsx +55 -0
  327. package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +66 -0
  328. package/src/validated-form-controls/components/text-control.tsx +60 -0
  329. package/src/validated-form-controls/components/textarea-control.tsx +59 -0
  330. package/src/validated-form-controls/components/toggle-control.tsx +69 -0
  331. package/src/validated-form-controls/components/toggle-group-control.tsx +82 -0
  332. package/src/validated-form-controls/components/types.ts +28 -0
  333. package/src/validated-form-controls/control-with-error.tsx +198 -0
  334. package/src/validated-form-controls/index.ts +2 -0
  335. package/src/validated-form-controls/style.scss +75 -0
  336. package/tsconfig.tsbuildinfo +1 -1
  337. package/src/dimension-control/style.scss +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "29.12.0",
3
+ "version": "30.0.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -40,27 +40,27 @@
40
40
  "@emotion/serialize": "^1.0.2",
41
41
  "@emotion/styled": "^11.6.0",
42
42
  "@emotion/utils": "^1.0.0",
43
- "@floating-ui/react-dom": "^2.0.8",
43
+ "@floating-ui/react-dom": "2.0.8",
44
44
  "@types/gradient-parser": "0.1.3",
45
45
  "@types/highlight-words-core": "1.2.1",
46
46
  "@use-gesture/react": "^10.3.1",
47
- "@wordpress/a11y": "^4.26.0",
48
- "@wordpress/compose": "^7.26.0",
49
- "@wordpress/date": "^5.26.0",
50
- "@wordpress/deprecated": "^4.26.0",
51
- "@wordpress/dom": "^4.26.0",
52
- "@wordpress/element": "^6.26.0",
53
- "@wordpress/escape-html": "^3.26.0",
54
- "@wordpress/hooks": "^4.26.0",
55
- "@wordpress/html-entities": "^4.26.0",
56
- "@wordpress/i18n": "^5.26.0",
57
- "@wordpress/icons": "^10.26.0",
58
- "@wordpress/is-shallow-equal": "^5.26.0",
59
- "@wordpress/keycodes": "^4.26.0",
60
- "@wordpress/primitives": "^4.26.0",
61
- "@wordpress/private-apis": "^1.26.0",
62
- "@wordpress/rich-text": "^7.26.0",
63
- "@wordpress/warning": "^3.26.0",
47
+ "@wordpress/a11y": "^4.27.0",
48
+ "@wordpress/compose": "^7.27.0",
49
+ "@wordpress/date": "^5.27.0",
50
+ "@wordpress/deprecated": "^4.27.0",
51
+ "@wordpress/dom": "^4.27.0",
52
+ "@wordpress/element": "^6.27.0",
53
+ "@wordpress/escape-html": "^3.27.0",
54
+ "@wordpress/hooks": "^4.27.0",
55
+ "@wordpress/html-entities": "^4.27.0",
56
+ "@wordpress/i18n": "^6.0.0",
57
+ "@wordpress/icons": "^10.27.0",
58
+ "@wordpress/is-shallow-equal": "^5.27.0",
59
+ "@wordpress/keycodes": "^4.27.0",
60
+ "@wordpress/primitives": "^4.27.0",
61
+ "@wordpress/private-apis": "^1.27.0",
62
+ "@wordpress/rich-text": "^7.27.0",
63
+ "@wordpress/warning": "^3.27.0",
64
64
  "change-case": "^4.1.2",
65
65
  "clsx": "^2.1.1",
66
66
  "colord": "^2.7.0",
@@ -75,6 +75,7 @@
75
75
  "path-to-regexp": "^6.2.1",
76
76
  "re-resizable": "^6.4.0",
77
77
  "react-colorful": "^5.3.1",
78
+ "react-day-picker": "^9.7.0",
78
79
  "remove-accents": "^0.5.0",
79
80
  "uuid": "^9.0.1"
80
81
  },
@@ -85,5 +86,5 @@
85
86
  "publishConfig": {
86
87
  "access": "public"
87
88
  },
88
- "gitHead": "35e26942820d8237771af0c58e45b4303f0497f1"
89
+ "gitHead": "abe06a6f2aef8d03c30ea9d5b3e133f041e523b1"
89
90
  }
@@ -126,6 +126,10 @@ export function useAutocomplete( {
126
126
  // Reset autocomplete state after insertion rather than before
127
127
  // so insertion events don't cause the completion menu to redisplay.
128
128
  reset();
129
+
130
+ // Make sure that the content remains focused after making a selection
131
+ // and that the text cursor position is not lost.
132
+ contentRef.current?.focus();
129
133
  }
130
134
 
131
135
  function reset() {
@@ -178,14 +178,23 @@ export default function BoxInputControl( {
178
178
  const presetIndex = hasPresetValue
179
179
  ? getPresetIndexFromValue( mergedValue, presetKey, presets )
180
180
  : undefined;
181
- const marks = hasPresets
182
- ? [ { value: 0, label: '', tooltip: __( 'None' ) } ].concat(
183
- presets.map( ( preset, index ) => ( {
181
+ const marks: Array< {
182
+ value: number;
183
+ label: string;
184
+ tooltip: string;
185
+ } > = hasPresets
186
+ ? [
187
+ {
188
+ value: 0,
189
+ label: '',
190
+ tooltip: __( 'None' ),
191
+ },
192
+ ...presets.map( ( preset, index ) => ( {
184
193
  value: index + 1,
185
194
  label: '',
186
195
  tooltip: preset.name ?? preset.slug,
187
- } ) )
188
- )
196
+ } ) ),
197
+ ]
189
198
  : [];
190
199
 
191
200
  return (
@@ -0,0 +1,261 @@
1
+ # `DateCalendar`
2
+
3
+ 🔒 This component is locked as a [private API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-private-apis/). We do not yet recommend using this outside of the Gutenberg project.
4
+
5
+ `DateCalendar` is a React component that provides a customizable calendar interface for **single date** selection.
6
+
7
+ The component is built with accessibility in mind and follows ARIA best practices for calendar widgets. It provides keyboard navigation, screen reader support, and customizable labels for internationalization.
8
+
9
+ ## Usage example
10
+
11
+ ```tsx
12
+ import { DateCalendar } from '@wordpress/components';
13
+
14
+ function MyComponent() {
15
+ const [ selected, setSelected ] = useState< Date >( new Date() );
16
+
17
+ return <DateCalendar selected={ selected } onSelect={ setSelected } />;
18
+ }
19
+ ```
20
+
21
+ ## Props
22
+
23
+ These props are shared between both single date and date range calendar modes.
24
+
25
+ ### `required`
26
+
27
+ - Type: `boolean`
28
+ - Required: No
29
+ - Default: `false`
30
+
31
+ Whether the selection is required. When `true`, there always needs to be a date selected.
32
+
33
+ ### `selected`
34
+
35
+ - Type: `Date | undefined | null`
36
+ - Required: No
37
+
38
+ The selected date.
39
+
40
+ ### `onSelect`
41
+
42
+ - Type: `(selected: Date | undefined, triggerDate: Date, modifiers: Modifiers, e: React.MouseEvent | React.KeyboardEvent) => void`
43
+ - Required: No
44
+
45
+ Event handler when a day is selected.
46
+
47
+ ### `defaultSelected`
48
+
49
+ - Type: `Date`
50
+ - Required: No
51
+
52
+ The default selected date (for uncontrolled usage).
53
+
54
+ ### `defaultMonth`
55
+
56
+ - Type: `Date`
57
+ - Required: No
58
+ - Default: Current month
59
+
60
+ The initial month to show in the calendar view (uncontrolled).
61
+
62
+ ### `month`
63
+
64
+ - Type: `Date`
65
+ - Required: No
66
+
67
+ The month displayed in the calendar view (controlled). Use together with `onMonthChange` to change the month programmatically.
68
+
69
+ ### `numberOfMonths`
70
+
71
+ - Type: `number`
72
+ - Required: No
73
+ - Default: `1`
74
+
75
+ The number of months displayed at once.
76
+
77
+ ### `startMonth`
78
+
79
+ - Type: `Date`
80
+ - Required: No
81
+
82
+ The earliest month to start the month navigation.
83
+
84
+ ### `endMonth`
85
+
86
+ - Type: `Date`
87
+ - Required: No
88
+
89
+ The latest month to end the month navigation.
90
+
91
+ ### `autoFocus`
92
+
93
+ - Type: `boolean`
94
+ - Required: No
95
+
96
+ Focus the first selected day (if set) or today's date (if not disabled). Use this prop when you need to focus the calendar after a user action (e.g. opening the dialog with the calendar).
97
+
98
+ ### `disabled`
99
+
100
+ - Type: `Matcher | Matcher[] | undefined`
101
+ - Required: No
102
+
103
+ Specify which days are disabled. Using `true` will disable all dates. See the [Matcher Types](#matcher-types) section for more details.
104
+
105
+ ### `disableNavigation`
106
+
107
+ - Type: `boolean`
108
+ - Required: No
109
+
110
+ Disable the navigation buttons.
111
+
112
+ ### `labels`
113
+
114
+ - Type: `object`
115
+ - Required: No
116
+
117
+ Use custom labels for internationalization. All labels are optional and have sensible defaults:
118
+
119
+ ```typescript
120
+ {
121
+ labelNav?: () => string; // Navigation toolbar label
122
+ labelGrid?: (date: Date) => string; // Month grid label (default: "LLLL y")
123
+ labelGridcell?: (date: Date, modifiers?: Modifiers) => string; // Grid cell label
124
+ labelNext?: (month: Date | undefined) => string; // Next month button label
125
+ labelPrevious?: (month: Date | undefined) => string; // Previous month button label
126
+ labelDayButton?: (date: Date, modifiers?: Modifiers) => string; // Day button label
127
+ labelWeekday?: (date: Date) => string; // Weekday label
128
+ }
129
+ ```
130
+
131
+ **Important: For a correct localized experience, consumers should make sure the locale used for the translated labels and `locale` prop are consistent.**
132
+
133
+ ### `locale`
134
+
135
+ - Type: `Locale`
136
+ - Required: No
137
+ - Default: `enUS` from `@date-fns/locale`
138
+
139
+ The locale object used to localize dates. Pass a locale from `@date-fns/locale` to localize the calendar.
140
+
141
+ **Important: For a correct localized experience, consumers should make sure the locale used for the translated labels and `locale` prop are consistent.**
142
+
143
+ ### `weekStartsOn`
144
+
145
+ - Type: `0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined`
146
+ - Required: No
147
+ - Default: Based on the `locale` prop
148
+
149
+ The index of the first day of the week (0 - Sunday). Overrides the locale's setting.
150
+
151
+ ### `onMonthChange`
152
+
153
+ - Type: `(month: Date) => void`
154
+ - Required: No
155
+
156
+ Event fired when the user navigates between months.
157
+
158
+ ### `timeZone`
159
+
160
+ - Type: `string`
161
+ - Required: No
162
+
163
+ The time zone (IANA or UTC offset) to use in the calendar. See [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for possible values.
164
+
165
+ When working with time zones, use the `TZDate` object exported by this package instead of the native `Date` object.
166
+
167
+ ```tsx
168
+ import { DateCalendar, TZDate } from '@wordpress/components';
169
+
170
+ export function WithTimeZone() {
171
+ const timeZone = 'America/New_York';
172
+ const [ selected, setSelected ] = useState< Date | undefined >(
173
+ new TZDate( 2024, 12, 10, timeZone ) // Use `TZDate` instead of `Date`
174
+ );
175
+ return (
176
+ <DateCalendar
177
+ timeZone={ timeZone }
178
+ selected={ selected }
179
+ onSelect={ setSelected }
180
+ />
181
+ );
182
+ }
183
+ ```
184
+
185
+ ### `role`
186
+
187
+ - Type: `'application' | 'dialog' | undefined`
188
+ - Required: No
189
+ - Default: `'application'`
190
+
191
+ The role attribute to add to the container element.
192
+
193
+ ## Matcher Types
194
+
195
+ The calendar component uses a flexible matching system to determine which days should be disabled or have specific modifiers. Here are the available matcher types:
196
+
197
+ ### Boolean Matcher
198
+
199
+ ```typescript
200
+ const booleanMatcher: Matcher = true; // Will always match the day
201
+ ```
202
+
203
+ ### Date Matcher
204
+
205
+ ```typescript
206
+ const dateMatcher: Matcher = new Date(); // Will match today's date
207
+ ```
208
+
209
+ ### Array Matcher
210
+
211
+ ```typescript
212
+ const arrayMatcher: Matcher = [
213
+ new Date( 2019, 1, 2 ),
214
+ new Date( 2019, 1, 4 ),
215
+ ]; // Will match the days in the array
216
+ ```
217
+
218
+ ### Date After Matcher
219
+
220
+ ```typescript
221
+ const afterMatcher: DateAfter = { after: new Date( 2019, 1, 2 ) }; // Will match days after the 2nd of February 2019
222
+ ```
223
+
224
+ ### Date Before Matcher
225
+
226
+ ```typescript
227
+ const beforeMatcher: DateBefore = { before: new Date( 2019, 1, 2 ) }; // Will match days before the 2nd of February 2019
228
+ ```
229
+
230
+ ### Date Interval Matcher
231
+
232
+ ```typescript
233
+ const intervalMatcher: DateInterval = {
234
+ after: new Date( 2019, 1, 2 ),
235
+ before: new Date( 2019, 1, 5 ),
236
+ }; // Will match the days between the 2nd and the 5th of February 2019 (exclusive)
237
+ ```
238
+
239
+ ### Date Range Matcher
240
+
241
+ ```typescript
242
+ const rangeMatcher: DateRange = {
243
+ from: new Date( 2019, 1, 2 ),
244
+ to: new Date( 2019, 1, 5 ),
245
+ }; // Will match the days between the 2nd and the 5th of February 2019 (inclusive)
246
+ ```
247
+
248
+ ### Day of Week Matcher
249
+
250
+ ```typescript
251
+ const dayOfWeekMatcher: DayOfWeek = { dayOfWeek: 0 }; // Will match Sundays
252
+ const weekendMatcher: DayOfWeek = { dayOfWeek: [ 0, 6 ] }; // Will match weekends
253
+ ```
254
+
255
+ ### Function Matcher
256
+
257
+ ```typescript
258
+ const functionMatcher: Matcher = ( day: Date ) => {
259
+ return day.getMonth() === 2; // Will match when month is March
260
+ };
261
+ ```
@@ -0,0 +1,69 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { DayPicker } from 'react-day-picker';
5
+ import { enUS } from 'react-day-picker/locale';
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useCallback } from '@wordpress/element';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { COMMON_PROPS } from '../utils/constants';
14
+ import { clampNumberOfMonths } from '../utils/misc';
15
+ import { useControlledValue } from '../../utils/hooks';
16
+ import { useLocalizationProps } from '../utils/use-localization-props';
17
+ import type { DateCalendarProps, OnSelectHandler } from '../types';
18
+
19
+ /**
20
+ * `DateCalendar` is a React component that provides a customizable calendar
21
+ * interface for **single date** selection.
22
+ *
23
+ * The component is built with accessibility in mind and follows ARIA best
24
+ * practices for calendar widgets. It provides keyboard navigation, screen reader
25
+ * support, and customizable labels for internationalization.
26
+ */
27
+ export const DateCalendar = ( {
28
+ defaultSelected,
29
+ selected: selectedProp,
30
+ onSelect,
31
+ numberOfMonths = 1,
32
+ locale = enUS,
33
+ timeZone,
34
+ ...props
35
+ }: DateCalendarProps ) => {
36
+ const localizationProps = useLocalizationProps( {
37
+ locale,
38
+ timeZone,
39
+ mode: 'single',
40
+ } );
41
+
42
+ const onChange: OnSelectHandler< typeof selectedProp > = useCallback(
43
+ ( selected, triggerDate, modifiers, e ) => {
44
+ // Convert internal `null` to `undefined` for the public event handler.
45
+ onSelect?.( selected ?? undefined, triggerDate, modifiers, e );
46
+ },
47
+ [ onSelect ]
48
+ );
49
+
50
+ const [ selected, setSelected ] = useControlledValue< typeof selectedProp >(
51
+ {
52
+ defaultValue: defaultSelected,
53
+ value: selectedProp,
54
+ onChange,
55
+ }
56
+ );
57
+
58
+ return (
59
+ <DayPicker
60
+ { ...COMMON_PROPS }
61
+ { ...localizationProps }
62
+ { ...props }
63
+ mode="single"
64
+ numberOfMonths={ clampNumberOfMonths( numberOfMonths ) }
65
+ selected={ selected ?? undefined }
66
+ onSelect={ setSelected }
67
+ />
68
+ );
69
+ };