@wordpress/components 29.13.1-next.719a03cbe.0 → 30.1.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 (280) hide show
  1. package/CHANGELOG.md +34 -3
  2. package/build/autocomplete/index.js +4 -0
  3. package/build/autocomplete/index.js.map +1 -1
  4. package/build/calendar/date-calendar/index.js +13 -4
  5. package/build/calendar/date-calendar/index.js.map +1 -1
  6. package/build/calendar/date-range-calendar/index.js +8 -4
  7. package/build/calendar/date-range-calendar/index.js.map +1 -1
  8. package/build/calendar/types.js.map +1 -1
  9. package/build/color-picker/styles.js +7 -7
  10. package/build/color-picker/styles.js.map +1 -1
  11. package/build/icon/index.js +2 -0
  12. package/build/icon/index.js.map +1 -1
  13. package/build/index.js +0 -19
  14. package/build/index.js.map +1 -1
  15. package/build/palette-edit/index.js +1 -1
  16. package/build/palette-edit/index.js.map +1 -1
  17. package/build/private-apis.js +9 -1
  18. package/build/private-apis.js.map +1 -1
  19. package/build/range-control/index.js +1 -1
  20. package/build/range-control/index.js.map +1 -1
  21. package/build/range-control/styles/range-control-styles.js +35 -35
  22. package/build/range-control/styles/range-control-styles.js.map +1 -1
  23. package/build/range-control/tooltip.js +15 -15
  24. package/build/range-control/tooltip.js.map +1 -1
  25. package/build/range-control/types.js.map +1 -1
  26. package/build/select-control/index.js +1 -1
  27. package/build/select-control/index.js.map +1 -1
  28. package/build/textarea-control/index.js +7 -1
  29. package/build/textarea-control/index.js.map +1 -1
  30. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  31. package/build/utils/hooks/use-controlled-value.js +8 -4
  32. package/build/utils/hooks/use-controlled-value.js.map +1 -1
  33. package/build/validated-form-controls/components/checkbox-control.js +52 -0
  34. package/build/validated-form-controls/components/checkbox-control.js.map +1 -0
  35. package/build/validated-form-controls/components/combobox-control.js +64 -0
  36. package/build/validated-form-controls/components/combobox-control.js.map +1 -0
  37. package/build/validated-form-controls/components/custom-select-control.js +71 -0
  38. package/build/validated-form-controls/components/custom-select-control.js.map +1 -0
  39. package/build/validated-form-controls/components/index.js +138 -0
  40. package/build/validated-form-controls/components/index.js.map +1 -0
  41. package/build/validated-form-controls/components/input-control.js +50 -0
  42. package/build/validated-form-controls/components/input-control.js.map +1 -0
  43. package/build/validated-form-controls/components/number-control.js +53 -0
  44. package/build/validated-form-controls/components/number-control.js.map +1 -0
  45. package/build/validated-form-controls/components/radio-control.js +51 -0
  46. package/build/validated-form-controls/components/radio-control.js.map +1 -0
  47. package/build/validated-form-controls/components/range-control.js +51 -0
  48. package/build/validated-form-controls/components/range-control.js.map +1 -0
  49. package/build/validated-form-controls/components/select-control.js +53 -0
  50. package/build/validated-form-controls/components/select-control.js.map +1 -0
  51. package/build/validated-form-controls/components/text-control.js +51 -0
  52. package/build/validated-form-controls/components/text-control.js.map +1 -0
  53. package/build/validated-form-controls/components/textarea-control.js +50 -0
  54. package/build/validated-form-controls/components/textarea-control.js.map +1 -0
  55. package/build/validated-form-controls/components/toggle-control.js +60 -0
  56. package/build/validated-form-controls/components/toggle-control.js.map +1 -0
  57. package/build/validated-form-controls/components/toggle-group-control.js +69 -0
  58. package/build/validated-form-controls/components/toggle-group-control.js.map +1 -0
  59. package/build/validated-form-controls/components/types.js +6 -0
  60. package/build/validated-form-controls/components/types.js.map +1 -0
  61. package/build/validated-form-controls/control-with-error.js +137 -0
  62. package/build/validated-form-controls/control-with-error.js.map +1 -0
  63. package/build/validated-form-controls/index.js +28 -0
  64. package/build/validated-form-controls/index.js.map +1 -0
  65. package/build-module/autocomplete/index.js +4 -0
  66. package/build-module/autocomplete/index.js.map +1 -1
  67. package/build-module/calendar/date-calendar/index.js +11 -3
  68. package/build-module/calendar/date-calendar/index.js.map +1 -1
  69. package/build-module/calendar/date-range-calendar/index.js +8 -4
  70. package/build-module/calendar/date-range-calendar/index.js.map +1 -1
  71. package/build-module/calendar/types.js.map +1 -1
  72. package/build-module/color-picker/styles.js +7 -7
  73. package/build-module/color-picker/styles.js.map +1 -1
  74. package/build-module/icon/index.js +2 -0
  75. package/build-module/icon/index.js.map +1 -1
  76. package/build-module/index.js +0 -1
  77. package/build-module/index.js.map +1 -1
  78. package/build-module/palette-edit/index.js +2 -2
  79. package/build-module/palette-edit/index.js.map +1 -1
  80. package/build-module/private-apis.js +9 -1
  81. package/build-module/private-apis.js.map +1 -1
  82. package/build-module/range-control/index.js +1 -1
  83. package/build-module/range-control/index.js.map +1 -1
  84. package/build-module/range-control/styles/range-control-styles.js +35 -35
  85. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  86. package/build-module/range-control/tooltip.js +15 -15
  87. package/build-module/range-control/tooltip.js.map +1 -1
  88. package/build-module/range-control/types.js.map +1 -1
  89. package/build-module/select-control/index.js +1 -1
  90. package/build-module/select-control/index.js.map +1 -1
  91. package/build-module/textarea-control/index.js +7 -1
  92. package/build-module/textarea-control/index.js.map +1 -1
  93. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  94. package/build-module/utils/hooks/use-controlled-value.js +9 -5
  95. package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
  96. package/build-module/validated-form-controls/components/checkbox-control.js +44 -0
  97. package/build-module/validated-form-controls/components/checkbox-control.js.map +1 -0
  98. package/build-module/validated-form-controls/components/combobox-control.js +56 -0
  99. package/build-module/validated-form-controls/components/combobox-control.js.map +1 -0
  100. package/build-module/validated-form-controls/components/custom-select-control.js +63 -0
  101. package/build-module/validated-form-controls/components/custom-select-control.js.map +1 -0
  102. package/build-module/validated-form-controls/components/index.js +13 -0
  103. package/build-module/validated-form-controls/components/index.js.map +1 -0
  104. package/build-module/validated-form-controls/components/input-control.js +42 -0
  105. package/build-module/validated-form-controls/components/input-control.js.map +1 -0
  106. package/build-module/validated-form-controls/components/number-control.js +45 -0
  107. package/build-module/validated-form-controls/components/number-control.js.map +1 -0
  108. package/build-module/validated-form-controls/components/radio-control.js +43 -0
  109. package/build-module/validated-form-controls/components/radio-control.js.map +1 -0
  110. package/build-module/validated-form-controls/components/range-control.js +43 -0
  111. package/build-module/validated-form-controls/components/range-control.js.map +1 -0
  112. package/build-module/validated-form-controls/components/select-control.js +45 -0
  113. package/build-module/validated-form-controls/components/select-control.js.map +1 -0
  114. package/build-module/validated-form-controls/components/text-control.js +43 -0
  115. package/build-module/validated-form-controls/components/text-control.js.map +1 -0
  116. package/build-module/validated-form-controls/components/textarea-control.js +42 -0
  117. package/build-module/validated-form-controls/components/textarea-control.js.map +1 -0
  118. package/build-module/validated-form-controls/components/toggle-control.js +52 -0
  119. package/build-module/validated-form-controls/components/toggle-control.js.map +1 -0
  120. package/build-module/validated-form-controls/components/toggle-group-control.js +62 -0
  121. package/build-module/validated-form-controls/components/toggle-group-control.js.map +1 -0
  122. package/build-module/validated-form-controls/components/types.js +2 -0
  123. package/build-module/validated-form-controls/components/types.js.map +1 -0
  124. package/build-module/validated-form-controls/control-with-error.js +129 -0
  125. package/build-module/validated-form-controls/control-with-error.js.map +1 -0
  126. package/build-module/validated-form-controls/index.js +3 -0
  127. package/build-module/validated-form-controls/index.js.map +1 -0
  128. package/build-style/style-rtl.css +81 -71
  129. package/build-style/style.css +81 -71
  130. package/build-types/autocomplete/index.d.ts.map +1 -1
  131. package/build-types/box-control/utils.d.ts +7 -7
  132. package/build-types/calendar/date-calendar/index.d.ts.map +1 -1
  133. package/build-types/calendar/date-range-calendar/index.d.ts.map +1 -1
  134. package/build-types/calendar/types.d.ts +2 -2
  135. package/build-types/calendar/types.d.ts.map +1 -1
  136. package/build-types/calendar/utils/use-localization-props.d.ts +3 -3
  137. package/build-types/color-picker/styles.d.ts.map +1 -1
  138. package/build-types/custom-gradient-picker/constants.d.ts +2 -2
  139. package/build-types/dimension-control/sizes.d.ts +5 -5
  140. package/build-types/font-size-picker/constants.d.ts +2 -2
  141. package/build-types/font-size-picker/constants.d.ts.map +1 -1
  142. package/build-types/icon/index.d.ts.map +1 -1
  143. package/build-types/index.d.ts +0 -1
  144. package/build-types/index.d.ts.map +1 -1
  145. package/build-types/private-apis.d.ts.map +1 -1
  146. package/build-types/range-control/types.d.ts +2 -2
  147. package/build-types/range-control/types.d.ts.map +1 -1
  148. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  149. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  150. package/build-types/textarea-control/index.d.ts.map +1 -1
  151. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  152. package/build-types/utils/hooks/use-controlled-value.d.ts +2 -2
  153. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  154. package/build-types/validated-form-controls/components/checkbox-control.d.ts +9 -0
  155. package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -0
  156. package/build-types/validated-form-controls/components/combobox-control.d.ts +21 -0
  157. package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -0
  158. package/build-types/validated-form-controls/components/custom-select-control.d.ts +4 -0
  159. package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -0
  160. package/build-types/validated-form-controls/components/index.d.ts +13 -0
  161. package/build-types/validated-form-controls/components/index.d.ts.map +1 -0
  162. package/build-types/validated-form-controls/components/input-control.d.ts +4 -0
  163. package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -0
  164. package/build-types/validated-form-controls/components/number-control.d.ts +17 -0
  165. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -0
  166. package/build-types/validated-form-controls/components/radio-control.d.ts +11 -0
  167. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -0
  168. package/build-types/validated-form-controls/components/range-control.d.ts +36 -0
  169. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -0
  170. package/build-types/validated-form-controls/components/select-control.d.ts +9 -0
  171. package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -0
  172. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts +12 -0
  173. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -0
  174. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts +12 -0
  175. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -0
  176. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts +12 -0
  177. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -0
  178. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts +18 -0
  179. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -0
  180. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts +12 -0
  181. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -0
  182. package/build-types/validated-form-controls/components/stories/overview.story.d.ts +19 -0
  183. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -0
  184. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts +12 -0
  185. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -0
  186. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts +9 -0
  187. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -0
  188. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts +12 -0
  189. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -0
  190. package/build-types/validated-form-controls/components/stories/story-utils.d.ts +9 -0
  191. package/build-types/validated-form-controls/components/stories/story-utils.d.ts.map +1 -0
  192. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts +9 -0
  193. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -0
  194. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts +9 -0
  195. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -0
  196. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts +9 -0
  197. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -0
  198. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts +9 -0
  199. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -0
  200. package/build-types/validated-form-controls/components/text-control.d.ts +8 -0
  201. package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -0
  202. package/build-types/validated-form-controls/components/textarea-control.d.ts +7 -0
  203. package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -0
  204. package/build-types/validated-form-controls/components/toggle-control.d.ts +7 -0
  205. package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -0
  206. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +15 -0
  207. package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -0
  208. package/build-types/validated-form-controls/components/types.d.ts +27 -0
  209. package/build-types/validated-form-controls/components/types.d.ts.map +1 -0
  210. package/build-types/validated-form-controls/control-with-error.d.ts +36 -0
  211. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -0
  212. package/build-types/validated-form-controls/index.d.ts +3 -0
  213. package/build-types/validated-form-controls/index.d.ts.map +1 -0
  214. package/package.json +19 -19
  215. package/src/autocomplete/index.tsx +4 -0
  216. package/src/calendar/date-calendar/README.md +57 -46
  217. package/src/calendar/date-calendar/index.tsx +22 -8
  218. package/src/calendar/date-range-calendar/README.md +63 -52
  219. package/src/calendar/date-range-calendar/index.tsx +23 -11
  220. package/src/calendar/types.ts +2 -2
  221. package/src/color-picker/styles.ts +10 -0
  222. package/src/dimension-control/test/__snapshots__/index.test.js.snap +8 -8
  223. package/src/icon/index.tsx +2 -0
  224. package/src/index.ts +0 -1
  225. package/src/modal/style.scss +2 -2
  226. package/src/palette-edit/index.tsx +3 -3
  227. package/src/private-apis.ts +13 -0
  228. package/src/range-control/index.tsx +1 -1
  229. package/src/range-control/styles/range-control-styles.ts +3 -3
  230. package/src/range-control/tooltip.tsx +13 -13
  231. package/src/range-control/types.ts +2 -2
  232. package/src/select-control/index.tsx +1 -1
  233. package/src/style.scss +2 -2
  234. package/src/text-control/stories/index.story.tsx +1 -0
  235. package/src/text-control/style.scss +6 -1
  236. package/src/textarea-control/index.tsx +8 -1
  237. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +3 -1
  238. package/src/utils/hooks/use-controlled-value.ts +16 -8
  239. package/src/utils/theme-variables.scss +3 -0
  240. package/src/validated-form-controls/components/checkbox-control.tsx +64 -0
  241. package/src/validated-form-controls/components/combobox-control.tsx +77 -0
  242. package/src/validated-form-controls/components/custom-select-control.tsx +86 -0
  243. package/src/validated-form-controls/components/index.ts +12 -0
  244. package/src/validated-form-controls/components/input-control.tsx +59 -0
  245. package/src/validated-form-controls/components/number-control.tsx +61 -0
  246. package/src/validated-form-controls/components/radio-control.tsx +60 -0
  247. package/src/validated-form-controls/components/range-control.tsx +60 -0
  248. package/src/validated-form-controls/components/select-control.tsx +75 -0
  249. package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +57 -0
  250. package/src/validated-form-controls/components/stories/combobox-control.story.tsx +64 -0
  251. package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +64 -0
  252. package/src/validated-form-controls/components/stories/input-control.story.tsx +132 -0
  253. package/src/validated-form-controls/components/stories/number-control.story.tsx +62 -0
  254. package/src/validated-form-controls/components/stories/overview.mdx +52 -0
  255. package/src/validated-form-controls/components/stories/overview.story.tsx +100 -0
  256. package/src/validated-form-controls/components/stories/radio-control.story.tsx +64 -0
  257. package/src/validated-form-controls/components/stories/range-control.story.tsx +60 -0
  258. package/src/validated-form-controls/components/stories/select-control.story.tsx +60 -0
  259. package/src/validated-form-controls/components/stories/story-utils.tsx +46 -0
  260. package/src/validated-form-controls/components/stories/text-control.story.tsx +55 -0
  261. package/src/validated-form-controls/components/stories/textarea-control.story.tsx +52 -0
  262. package/src/validated-form-controls/components/stories/toggle-control.story.tsx +55 -0
  263. package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +66 -0
  264. package/src/validated-form-controls/components/text-control.tsx +60 -0
  265. package/src/validated-form-controls/components/textarea-control.tsx +59 -0
  266. package/src/validated-form-controls/components/toggle-control.tsx +69 -0
  267. package/src/validated-form-controls/components/toggle-group-control.tsx +82 -0
  268. package/src/validated-form-controls/components/types.ts +28 -0
  269. package/src/validated-form-controls/control-with-error.tsx +198 -0
  270. package/src/validated-form-controls/index.ts +2 -0
  271. package/src/validated-form-controls/style.scss +75 -0
  272. package/tsconfig.tsbuildinfo +1 -1
  273. package/build/calendar/utils/use-controlled-value.js +0 -58
  274. package/build/calendar/utils/use-controlled-value.js.map +0 -1
  275. package/build-module/calendar/utils/use-controlled-value.js +0 -51
  276. package/build-module/calendar/utils/use-controlled-value.js.map +0 -1
  277. package/build-types/calendar/utils/use-controlled-value.d.ts +0 -27
  278. package/build-types/calendar/utils/use-controlled-value.d.ts.map +0 -1
  279. package/src/calendar/utils/use-controlled-value.ts +0 -61
  280. package/src/dimension-control/style.scss +0 -22
@@ -1,5 +1,7 @@
1
1
  # `DateRangeCalendar`
2
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
+
3
5
  `DateRangeCalendar` is a React component that provides a customizable calendar interface for **date range** selection.
4
6
 
5
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.
@@ -7,7 +9,7 @@ The component is built with accessibility in mind and follows ARIA best practice
7
9
  ## Usage example
8
10
 
9
11
  ```tsx
10
- import { DateRangeCalendar } from '@automattic/components';
12
+ import { DateRangeCalendar } from '@wordpress/components';
11
13
 
12
14
  type DateRange = {
13
15
  from: Date | undefined;
@@ -30,16 +32,16 @@ These props are shared between both single date and date range calendar modes.
30
32
 
31
33
  ### `required`
32
34
 
33
- - Type: `boolean`
34
- - Required: No
35
- - Default: `false`
35
+ - Type: `boolean`
36
+ - Required: No
37
+ - Default: `false`
36
38
 
37
39
  Whether the selection is required. When `true`, there always needs to be a date selected.
38
40
 
39
41
  ### `selected`
40
42
 
41
- - Type: `DateRange | undefined | null`
42
- - Required: No
43
+ - Type: `DateRange | undefined | null`
44
+ - Required: No
43
45
 
44
46
  The selected date range. A `DateRange` object has the following shape:
45
47
 
@@ -52,101 +54,101 @@ The selected date range. A `DateRange` object has the following shape:
52
54
 
53
55
  ### `onSelect`
54
56
 
55
- - Type: `(selected: DateRange | undefined, triggerDate: Date, modifiers: Modifiers, e: React.MouseEvent | React.KeyboardEvent) => void`
56
- - Required: No
57
+ - Type: `(selected: DateRange | undefined, triggerDate: Date, modifiers: Modifiers, e: React.MouseEvent | React.KeyboardEvent) => void`
58
+ - Required: No
57
59
 
58
60
  Event handler when the selection changes. The `selected` parameter will contain the new date range.
59
61
 
60
62
  ### `defaultSelected`
61
63
 
62
- - Type: `DateRange`
63
- - Required: No
64
+ - Type: `DateRange`
65
+ - Required: No
64
66
 
65
67
  The default selected range (for uncontrolled usage).
66
68
 
67
69
  ### `excludeDisabled`
68
70
 
69
- - Type: `boolean`
70
- - Required: No
71
+ - Type: `boolean`
72
+ - Required: No
71
73
 
72
74
  When `true`, the range will reset when including a disabled day. This is useful to prevent users from selecting ranges that include unavailable dates.
73
75
 
74
76
  ### `min`
75
77
 
76
- - Type: `number`
77
- - Required: No
78
+ - Type: `number`
79
+ - Required: No
78
80
 
79
81
  The minimum number of days to include in the range. If a user tries to select a range shorter than this, the selection will be adjusted to meet the minimum requirement.
80
82
 
81
83
  ### `max`
82
84
 
83
- - Type: `number`
84
- - Required: No
85
+ - Type: `number`
86
+ - Required: No
85
87
 
86
88
  The maximum number of days to include in the range. If a user tries to select a range longer than this, the selection will be adjusted to meet the maximum requirement.
87
89
 
88
90
  ### `defaultMonth`
89
91
 
90
- - Type: `Date`
91
- - Required: No
92
- - Default: Current month
92
+ - Type: `Date`
93
+ - Required: No
94
+ - Default: Current month
93
95
 
94
96
  The initial month to show in the calendar view (uncontrolled).
95
97
 
96
98
  ### `month`
97
99
 
98
- - Type: `Date`
99
- - Required: No
100
+ - Type: `Date`
101
+ - Required: No
100
102
 
101
103
  The month displayed in the calendar view (controlled). Use together with `onMonthChange` to change the month programmatically.
102
104
 
103
105
  ### `numberOfMonths`
104
106
 
105
- - Type: `number`
106
- - Required: No
107
- - Default: `1`
107
+ - Type: `number`
108
+ - Required: No
109
+ - Default: `1`
108
110
 
109
111
  The number of months displayed at once.
110
112
 
111
113
  ### `startMonth`
112
114
 
113
- - Type: `Date`
114
- - Required: No
115
+ - Type: `Date`
116
+ - Required: No
115
117
 
116
118
  The earliest month to start the month navigation.
117
119
 
118
120
  ### `endMonth`
119
121
 
120
- - Type: `Date`
121
- - Required: No
122
+ - Type: `Date`
123
+ - Required: No
122
124
 
123
125
  The latest month to end the month navigation.
124
126
 
125
127
  ### `autoFocus`
126
128
 
127
- - Type: `boolean`
128
- - Required: No
129
+ - Type: `boolean`
130
+ - Required: No
129
131
 
130
132
  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).
131
133
 
132
134
  ### `disabled`
133
135
 
134
- - Type: `Matcher | Matcher[] | undefined`
135
- - Required: No
136
+ - Type: `Matcher | Matcher[] | undefined`
137
+ - Required: No
136
138
 
137
139
  Specify which days are disabled. Using `true` will disable all dates. See the [Matcher Types](#matcher-types) section for more details.
138
140
 
139
141
  ### `disableNavigation`
140
142
 
141
- - Type: `boolean`
142
- - Required: No
143
+ - Type: `boolean`
144
+ - Required: No
143
145
 
144
146
  Disable the navigation buttons.
145
147
 
146
148
  ### `labels`
147
149
 
148
- - Type: `object`
149
- - Required: No
150
+ - Type: `object`
151
+ - Required: No
150
152
 
151
153
  Use custom labels for internationalization. All labels are optional and have sensible defaults:
152
154
 
@@ -166,9 +168,9 @@ Use custom labels for internationalization. All labels are optional and have sen
166
168
 
167
169
  ### `locale`
168
170
 
169
- - Type: `Locale`
170
- - Required: No
171
- - Default: `enUS` from `@date-fns/locale`
171
+ - Type: `Locale`
172
+ - Required: No
173
+ - Default: `enUS` from `@date-fns/locale`
172
174
 
173
175
  The locale object used to localize dates. Pass a locale from `@date-fns/locale` to localize the calendar.
174
176
 
@@ -176,30 +178,30 @@ The locale object used to localize dates. Pass a locale from `@date-fns/locale`
176
178
 
177
179
  ### `weekStartsOn`
178
180
 
179
- - Type: `0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined`
180
- - Required: No
181
- - Default: Based on the `locale` prop
181
+ - Type: `0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined`
182
+ - Required: No
183
+ - Default: Based on the `locale` prop
182
184
 
183
185
  The index of the first day of the week (0 - Sunday). Overrides the locale's setting.
184
186
 
185
187
  ### `onMonthChange`
186
188
 
187
- - Type: `(month: Date) => void`
188
- - Required: No
189
+ - Type: `(month: Date) => void`
190
+ - Required: No
189
191
 
190
192
  Event fired when the user navigates between months.
191
193
 
192
194
  ### `timeZone`
193
195
 
194
- - Type: `string`
195
- - Required: No
196
+ - Type: `string`
197
+ - Required: No
196
198
 
197
199
  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.
198
200
 
199
201
  When working with time zones, use the `TZDate` object exported by this package instead of the native `Date` object.
200
202
 
201
203
  ```tsx
202
- import { DateRangeCalendar, TZDate } from '@automattic/components';
204
+ import { DateRangeCalendar, TZDate } from '@wordpress/components';
203
205
 
204
206
  export function WithTimeZone() {
205
207
  const timeZone = 'America/New_York';
@@ -207,15 +209,21 @@ export function WithTimeZone() {
207
209
  from: new TZDate( 2024, 12, 10, timeZone ), // Use `TZDate` instead of `Date`
208
210
  to: new TZDate( 2024, 12, 8, timeZone ), // Use `TZDate` instead of `Date`
209
211
  } );
210
- return <DateRangeCalendar timeZone={ timeZone } selected={ selected } onSelect={ setSelected } />;
212
+ return (
213
+ <DateRangeCalendar
214
+ timeZone={ timeZone }
215
+ selected={ selected }
216
+ onSelect={ setSelected }
217
+ />
218
+ );
211
219
  }
212
220
  ```
213
221
 
214
222
  ### `role`
215
223
 
216
- - Type: `'application' | 'dialog' | undefined`
217
- - Required: No
218
- - Default: `'application'`
224
+ - Type: `'application' | 'dialog' | undefined`
225
+ - Required: No
226
+ - Default: `'application'`
219
227
 
220
228
  The role attribute to add to the container element.
221
229
 
@@ -238,7 +246,10 @@ const dateMatcher: Matcher = new Date(); // Will match today's date
238
246
  ### Array Matcher
239
247
 
240
248
  ```typescript
241
- const arrayMatcher: Matcher = [ new Date( 2019, 1, 2 ), new Date( 2019, 1, 4 ) ]; // Will match the days in the array
249
+ const arrayMatcher: Matcher = [
250
+ new Date( 2019, 1, 2 ),
251
+ new Date( 2019, 1, 4 ),
252
+ ]; // Will match the days in the array
242
253
  ```
243
254
 
244
255
  ### Date After Matcher
@@ -7,15 +7,19 @@ import { enUS } from 'react-day-picker/locale';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { useMemo, useState } from '@wordpress/element';
10
+ import { useMemo, useState, useCallback } from '@wordpress/element';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
14
  import { COMMON_PROPS, MODIFIER_CLASSNAMES } from '../utils/constants';
15
15
  import { clampNumberOfMonths } from '../utils/misc';
16
- import { useControlledValue } from '../utils/use-controlled-value';
16
+ import { useControlledValue } from '../../utils/hooks';
17
17
  import { useLocalizationProps } from '../utils/use-localization-props';
18
- import type { DateRangeCalendarProps, DateRange } from '../types';
18
+ import type {
19
+ DateRangeCalendarProps,
20
+ DateRange,
21
+ OnSelectHandler,
22
+ } from '../types';
19
23
 
20
24
  export function usePreviewRange( {
21
25
  selected,
@@ -151,13 +155,21 @@ export const DateRangeCalendar = ( {
151
155
  mode: 'range',
152
156
  } );
153
157
 
154
- const [ selected, setSelected ] = useControlledValue<
155
- DateRange | undefined
156
- >( {
157
- defaultValue: defaultSelected,
158
- value: selectedProp,
159
- onChange: onSelect,
160
- } );
158
+ const onChange: OnSelectHandler< typeof selectedProp > = useCallback(
159
+ ( selected, triggerDate, modifiers, e ) => {
160
+ // Convert internal `null` to `undefined` for the public event handler.
161
+ onSelect?.( selected ?? undefined, triggerDate, modifiers, e );
162
+ },
163
+ [ onSelect ]
164
+ );
165
+
166
+ const [ selected, setSelected ] = useControlledValue< typeof selectedProp >(
167
+ {
168
+ defaultValue: defaultSelected,
169
+ value: selectedProp,
170
+ onChange,
171
+ }
172
+ );
161
173
 
162
174
  const [ hoveredDate, setHoveredDate ] = useState< Date | undefined >(
163
175
  undefined
@@ -192,7 +204,7 @@ export const DateRangeCalendar = ( {
192
204
  excludeDisabled={ excludeDisabled }
193
205
  min={ min }
194
206
  max={ max }
195
- selected={ selected }
207
+ selected={ selected ?? undefined }
196
208
  onSelect={ setSelected }
197
209
  onDayMouseEnter={ ( date ) => setHoveredDate( date ) }
198
210
  onDayMouseLeave={ () => setHoveredDate( undefined ) }
@@ -153,7 +153,7 @@ type DayOfWeek = {
153
153
  * @param {Modifiers} modifiers - The modifiers associated with the event.
154
154
  * @param {React.MouseEvent | React.KeyboardEvent} e - The event object.
155
155
  */
156
- type OnSelectHandler< T > = (
156
+ export type OnSelectHandler< T > = (
157
157
  selected: T,
158
158
  triggerDate: Date,
159
159
  modifiers: Modifiers,
@@ -284,7 +284,7 @@ export interface BaseProps
284
284
  * When working with time zones, use the `TZDate` object exported by this
285
285
  * package instead of the native `Date` object.
286
286
  * @example
287
- * import { DateCalendar, TZDate } from "@automattic/components";
287
+ * import { DateCalendar, TZDate } from "@wordpress/components";
288
288
  *
289
289
  * export function WithTimeZone() {
290
290
  * const timeZone = "America/New_York";
@@ -91,6 +91,16 @@ export const ColorfulWrapper = styled.div`
91
91
 
92
92
  // Shown instead of box-shadow to Windows high contrast mode.
93
93
  outline: 2px solid transparent;
94
+
95
+ @media not ( prefers-reduced-motion ) {
96
+ transition: transform ${ CONFIG.transitionDurationFast } ease-in-out;
97
+ }
98
+ }
99
+
100
+ .react-colorful__interactive:focus .react-colorful__pointer {
101
+ box-shadow: 0 0 0 ${ CONFIG.borderWidthFocus } ${ CONFIG.surfaceColor };
102
+ border: ${ CONFIG.borderWidthFocus } solid black;
103
+ transform: translate( -50%, -50% ) scale( 1.5 );
94
104
  }
95
105
 
96
106
  .react-colorful__pointer-fill {
@@ -193,13 +193,13 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = `
193
193
 
194
194
  <div>
195
195
  <div
196
- class="components-base-control emotion-0 emotion-1"
196
+ class="components-base-control components-select-control block-editor-dimension-control emotion-0 emotion-1"
197
197
  >
198
198
  <div
199
199
  class="components-base-control__field emotion-2 emotion-3"
200
200
  >
201
201
  <div
202
- class="components-flex components-input-base components-select-control block-editor-dimension-control emotion-4 emotion-5 emotion-6 emotion-7"
202
+ class="components-flex components-input-base emotion-4 emotion-5 emotion-6 emotion-7"
203
203
  data-wp-c16t="true"
204
204
  data-wp-component="InputBase"
205
205
  >
@@ -475,13 +475,13 @@ exports[`DimensionControl rendering renders with defaults 1`] = `
475
475
 
476
476
  <div>
477
477
  <div
478
- class="components-base-control emotion-0 emotion-1"
478
+ class="components-base-control components-select-control block-editor-dimension-control emotion-0 emotion-1"
479
479
  >
480
480
  <div
481
481
  class="components-base-control__field emotion-2 emotion-3"
482
482
  >
483
483
  <div
484
- class="components-flex components-input-base components-select-control block-editor-dimension-control emotion-4 emotion-5 emotion-6 emotion-7"
484
+ class="components-flex components-input-base emotion-4 emotion-5 emotion-6 emotion-7"
485
485
  data-wp-c16t="true"
486
486
  data-wp-component="InputBase"
487
487
  >
@@ -767,13 +767,13 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`]
767
767
 
768
768
  <div>
769
769
  <div
770
- class="components-base-control emotion-0 emotion-1"
770
+ class="components-base-control components-select-control block-editor-dimension-control emotion-0 emotion-1"
771
771
  >
772
772
  <div
773
773
  class="components-base-control__field emotion-2 emotion-3"
774
774
  >
775
775
  <div
776
- class="components-flex components-input-base components-select-control block-editor-dimension-control emotion-4 emotion-5 emotion-6 emotion-7"
776
+ class="components-flex components-input-base emotion-4 emotion-5 emotion-6 emotion-7"
777
777
  data-wp-c16t="true"
778
778
  data-wp-component="InputBase"
779
779
  >
@@ -1071,13 +1071,13 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`]
1071
1071
 
1072
1072
  <div>
1073
1073
  <div
1074
- class="components-base-control emotion-0 emotion-1"
1074
+ class="components-base-control components-select-control block-editor-dimension-control emotion-0 emotion-1"
1075
1075
  >
1076
1076
  <div
1077
1077
  class="components-base-control__field emotion-2 emotion-3"
1078
1078
  >
1079
1079
  <div
1080
- class="components-flex components-input-base components-select-control block-editor-dimension-control emotion-4 emotion-5 emotion-6 emotion-7"
1080
+ class="components-flex components-input-base emotion-4 emotion-5 emotion-6 emotion-7"
1081
1081
  data-wp-c16t="true"
1082
1082
  data-wp-component="InputBase"
1083
1083
  >
@@ -107,6 +107,8 @@ function Icon( {
107
107
  return cloneElement( icon, {
108
108
  // @ts-ignore Just forwarding the size prop along
109
109
  size,
110
+ width: size,
111
+ height: size,
110
112
  ...additionalProps,
111
113
  } );
112
114
  }
package/src/index.ts CHANGED
@@ -57,7 +57,6 @@ export {
57
57
  CardHeader,
58
58
  CardMedia,
59
59
  } from './card';
60
- export { DateCalendar, DateRangeCalendar, TZDate } from './calendar';
61
60
  export { default as CheckboxControl } from './checkbox-control';
62
61
  export { default as ClipboardButton } from './clipboard-button';
63
62
  export { default as __experimentalPaletteEdit } from './palette-edit';
@@ -128,7 +128,7 @@
128
128
  flex-direction: row;
129
129
  justify-content: space-between;
130
130
  align-items: center;
131
- height: $header-height + $grid-unit-15;
131
+ height: $header-height + $grid-unit-10; // 72px
132
132
  width: 100%;
133
133
  z-index: z-index(".components-modal__header");
134
134
  position: absolute;
@@ -175,7 +175,7 @@
175
175
  // Modal contents.
176
176
  .components-modal__content {
177
177
  flex: 1;
178
- margin-top: $header-height + $grid-unit-15;
178
+ margin-top: $header-height + $grid-unit-10;
179
179
  // Small top padding required to avoid cutting off the visible outline when the first child element is focusable.
180
180
  padding: $grid-unit-05 $grid-unit-40 $grid-unit-40;
181
181
  overflow: auto;
@@ -22,7 +22,7 @@ import { useDebounce } from '@wordpress/compose';
22
22
  */
23
23
  import Button from '../button';
24
24
  import { ColorPicker } from '../color-picker';
25
- import { FlexItem } from '../flex';
25
+ import { FlexBlock, FlexItem } from '../flex';
26
26
  import { HStack } from '../h-stack';
27
27
  import { Item, ItemGroup } from '../item-group';
28
28
  import { VStack } from '../v-stack';
@@ -229,7 +229,7 @@ function Option< T extends PaletteElement >( {
229
229
  >
230
230
  <IndicatorStyled colorValue={ value } />
231
231
  </Button>
232
- <FlexItem>
232
+ <FlexBlock>
233
233
  { ! canOnlyChangeValues ? (
234
234
  <NameInput
235
235
  label={
@@ -256,7 +256,7 @@ function Option< T extends PaletteElement >( {
256
256
  '\u00A0' }
257
257
  </NameContainer>
258
258
  ) }
259
- </FlexItem>
259
+ </FlexBlock>
260
260
  { ! canOnlyChangeValues && (
261
261
  <FlexItem>
262
262
  <RemoveButton
@@ -11,6 +11,13 @@ import { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';
11
11
  import { lock } from './lock-unlock';
12
12
  import Badge from './badge';
13
13
 
14
+ import { DateCalendar, DateRangeCalendar, TZDate } from './calendar';
15
+ import {
16
+ ValidatedNumberControl,
17
+ ValidatedTextControl,
18
+ ValidatedToggleControl,
19
+ } from './validated-form-controls';
20
+
14
21
  export const privateApis = {};
15
22
  lock( privateApis, {
16
23
  __experimentalPopoverLegacyPositionToPlacement,
@@ -22,4 +29,10 @@ lock( privateApis, {
22
29
  withIgnoreIMEEvents,
23
30
  Badge,
24
31
  normalizeTextString,
32
+ DateCalendar,
33
+ DateRangeCalendar,
34
+ TZDate,
35
+ ValidatedNumberControl,
36
+ ValidatedTextControl,
37
+ ValidatedToggleControl,
25
38
  } );
@@ -314,7 +314,7 @@ function UnforwardedRangeControl(
314
314
  <SimpleTooltip
315
315
  className="components-range-control__tooltip"
316
316
  inputRef={ inputRef }
317
- tooltipPosition="bottom"
317
+ tooltipPlacement="bottom"
318
318
  renderTooltipContent={ renderTooltipContent }
319
319
  show={ isCurrentlyFocused || showTooltip }
320
320
  style={ offsetStyle }
@@ -283,8 +283,8 @@ const tooltipShow = ( { show }: TooltipProps ) => {
283
283
  `;
284
284
  };
285
285
 
286
- const tooltipPosition = ( { position }: TooltipProps ) => {
287
- const isBottom = position === 'bottom';
286
+ const tooltipPlacement = ( { placement }: TooltipProps ) => {
287
+ const isBottom = placement === 'bottom';
288
288
 
289
289
  if ( isBottom ) {
290
290
  return css`
@@ -312,7 +312,7 @@ export const Tooltip = styled.span< TooltipProps >`
312
312
 
313
313
  ${ tooltipShow };
314
314
 
315
- ${ tooltipPosition };
315
+ ${ tooltipPlacement };
316
316
  ${ rtl(
317
317
  { transform: 'translateX(-50%)' },
318
318
  { transform: 'translateX(50%)' }
@@ -22,7 +22,7 @@ export default function SimpleTooltip(
22
22
  const {
23
23
  className,
24
24
  inputRef,
25
- tooltipPosition,
25
+ tooltipPlacement,
26
26
  show = false,
27
27
  style = {},
28
28
  value = 0,
@@ -30,7 +30,7 @@ export default function SimpleTooltip(
30
30
  zIndex = 100,
31
31
  ...restProps
32
32
  } = props;
33
- const position = useTooltipPosition( { inputRef, tooltipPosition } );
33
+ const placement = useTooltipPlacement( { inputRef, tooltipPlacement } );
34
34
  const classes = clsx( 'components-simple-tooltip', className );
35
35
  const styles = {
36
36
  ...style,
@@ -42,7 +42,7 @@ export default function SimpleTooltip(
42
42
  { ...restProps }
43
43
  aria-hidden="false"
44
44
  className={ classes }
45
- position={ position }
45
+ placement={ placement }
46
46
  show={ show }
47
47
  role="tooltip"
48
48
  style={ styles }
@@ -52,26 +52,26 @@ export default function SimpleTooltip(
52
52
  );
53
53
  }
54
54
 
55
- function useTooltipPosition( { inputRef, tooltipPosition }: TooltipProps ) {
56
- const [ position, setPosition ] = useState< string >();
55
+ function useTooltipPlacement( { inputRef, tooltipPlacement }: TooltipProps ) {
56
+ const [ placement, setPlacement ] = useState< string >();
57
57
 
58
- const setTooltipPosition = useCallback( () => {
58
+ const setTooltipPlacement = useCallback( () => {
59
59
  if ( inputRef && inputRef.current ) {
60
- setPosition( tooltipPosition );
60
+ setPlacement( tooltipPlacement );
61
61
  }
62
- }, [ tooltipPosition, inputRef ] );
62
+ }, [ tooltipPlacement, inputRef ] );
63
63
 
64
64
  useEffect( () => {
65
- setTooltipPosition();
66
- }, [ setTooltipPosition ] );
65
+ setTooltipPlacement();
66
+ }, [ setTooltipPlacement ] );
67
67
 
68
68
  useEffect( () => {
69
- window.addEventListener( 'resize', setTooltipPosition );
69
+ window.addEventListener( 'resize', setTooltipPlacement );
70
70
 
71
71
  return () => {
72
- window.removeEventListener( 'resize', setTooltipPosition );
72
+ window.removeEventListener( 'resize', setTooltipPlacement );
73
73
  };
74
74
  } );
75
75
 
76
- return position;
76
+ return placement;
77
77
  }
@@ -269,9 +269,9 @@ export type ThumbProps = {
269
269
 
270
270
  export type TooltipProps = {
271
271
  show?: boolean;
272
- position?: string;
272
+ placement?: string;
273
273
  inputRef?: MutableRefObject< HTMLElement | undefined >;
274
- tooltipPosition?: string;
274
+ tooltipPlacement?: string;
275
275
  value?: ControlledRangeValue;
276
276
  renderTooltipContent?: (
277
277
  value?: ControlledRangeValue
@@ -107,11 +107,11 @@ function UnforwardedSelectControl< V extends string >(
107
107
  <BaseControl
108
108
  help={ help }
109
109
  id={ id }
110
+ className={ classes }
110
111
  __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
111
112
  __associatedWPComponentName="SelectControl"
112
113
  >
113
114
  <StyledInputBase
114
- className={ classes }
115
115
  disabled={ disabled }
116
116
  hideLabelFromVision={ hideLabelFromVision }
117
117
  id={ id }
package/src/style.scss CHANGED
@@ -1,7 +1,7 @@
1
1
  // Include the default WP Components color variables.
2
2
  // TODO: Remove this once all admin-scheme variables are accounted for in the wp-components fallback values.
3
3
  :root {
4
- @include admin-scheme(#3858e9);
4
+ @include admin-scheme( #3858e9 );
5
5
  }
6
6
 
7
7
  // Variables
@@ -21,7 +21,6 @@
21
21
  @import "./combobox-control/style.scss";
22
22
  @import "./color-palette/style.scss";
23
23
  @import "./custom-gradient-picker/style.scss";
24
- @import "./dimension-control/style.scss";
25
24
  @import "./draggable/style.scss";
26
25
  @import "./drop-zone/style.scss";
27
26
  @import "./dropdown/style.scss";
@@ -56,3 +55,4 @@
56
55
  @import "./toolbar/toolbar-button/style.scss";
57
56
  @import "./toolbar/toolbar-group/style.scss";
58
57
  @import "./tooltip/style.scss";
58
+ @import "./validated-form-controls/style.scss";
@@ -56,6 +56,7 @@ export const Default: StoryFn< typeof TextControl > = DefaultTemplate.bind(
56
56
  Default.args = {
57
57
  __nextHasNoMarginBottom: true,
58
58
  __next40pxDefaultSize: true,
59
+ placeholder: 'Placeholder',
59
60
  };
60
61
 
61
62
  export const WithLabelAndHelpText: StoryFn< typeof TextControl > =