@wordpress/components 32.5.0 → 32.6.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 (282) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +40 -0
  3. package/README.md +18 -4
  4. package/build/alignment-matrix-control/cell.cjs +3 -3
  5. package/build/alignment-matrix-control/cell.cjs.map +2 -2
  6. package/build/alignment-matrix-control/index.cjs +3 -3
  7. package/build/alignment-matrix-control/index.cjs.map +2 -2
  8. package/build/autocomplete/autocompleter-ui.cjs +75 -79
  9. package/build/autocomplete/autocompleter-ui.cjs.map +2 -2
  10. package/build/autocomplete/get-autocomplete-match.cjs +91 -0
  11. package/build/autocomplete/get-autocomplete-match.cjs.map +7 -0
  12. package/build/autocomplete/index.cjs +104 -107
  13. package/build/autocomplete/index.cjs.map +3 -3
  14. package/build/box-control/index.cjs +0 -8
  15. package/build/box-control/index.cjs.map +2 -2
  16. package/build/box-control/utils.cjs +1 -10
  17. package/build/box-control/utils.cjs.map +2 -2
  18. package/build/calendar/utils/use-localization-props.cjs +3 -2
  19. package/build/calendar/utils/use-localization-props.cjs.map +2 -2
  20. package/build/custom-gradient-picker/index.cjs.map +2 -2
  21. package/build/custom-select-control/index.cjs.map +3 -3
  22. package/build/custom-select-control-v2/custom-select.cjs +2 -2
  23. package/build/custom-select-control-v2/custom-select.cjs.map +2 -2
  24. package/build/custom-select-control-v2/index.cjs.map +3 -3
  25. package/build/date-time/{date → date-picker}/index.cjs +6 -6
  26. package/build/date-time/{date → date-picker}/index.cjs.map +2 -2
  27. package/build/date-time/{date → date-picker}/styles.cjs +17 -17
  28. package/build/date-time/{date → date-picker}/styles.cjs.map +2 -2
  29. package/build/date-time/{date → date-picker}/use-lilius/index.cjs +1 -1
  30. package/build/date-time/{date → date-picker}/use-lilius/index.cjs.map +1 -1
  31. package/build/date-time/date-time/index.cjs +6 -6
  32. package/build/date-time/date-time/index.cjs.map +2 -2
  33. package/build/date-time/index.cjs +4 -4
  34. package/build/date-time/index.cjs.map +2 -2
  35. package/build/date-time/{time → time-picker}/index.cjs +6 -6
  36. package/build/date-time/time-picker/index.cjs.map +7 -0
  37. package/build/date-time/{time → time-picker}/styles.cjs +21 -21
  38. package/build/date-time/{time → time-picker}/styles.cjs.map +2 -2
  39. package/build/date-time/{time → time-picker}/time-input/index.cjs +1 -1
  40. package/build/date-time/{time → time-picker}/time-input/index.cjs.map +1 -1
  41. package/build/date-time/{time → time-picker}/timezone.cjs +1 -1
  42. package/build/date-time/{time → time-picker}/timezone.cjs.map +1 -1
  43. package/build/modal/index.cjs.map +2 -2
  44. package/build/palette-edit/index.cjs.map +2 -2
  45. package/build/radio-control/index.cjs +2 -0
  46. package/build/radio-control/index.cjs.map +2 -2
  47. package/build/sandbox/index.cjs +127 -3
  48. package/build/sandbox/index.cjs.map +2 -2
  49. package/build/textarea-control/styles/textarea-control-styles.cjs +3 -3
  50. package/build/textarea-control/styles/textarea-control-styles.cjs.map +2 -2
  51. package/build/validated-form-controls/control-with-error.cjs +12 -8
  52. package/build/validated-form-controls/control-with-error.cjs.map +2 -2
  53. package/build-module/alignment-matrix-control/cell.mjs +3 -3
  54. package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
  55. package/build-module/alignment-matrix-control/index.mjs +3 -3
  56. package/build-module/alignment-matrix-control/index.mjs.map +2 -2
  57. package/build-module/autocomplete/autocompleter-ui.mjs +74 -78
  58. package/build-module/autocomplete/autocompleter-ui.mjs.map +2 -2
  59. package/build-module/autocomplete/get-autocomplete-match.mjs +56 -0
  60. package/build-module/autocomplete/get-autocomplete-match.mjs.map +7 -0
  61. package/build-module/autocomplete/index.mjs +103 -107
  62. package/build-module/autocomplete/index.mjs.map +3 -3
  63. package/build-module/box-control/index.mjs +1 -9
  64. package/build-module/box-control/index.mjs.map +2 -2
  65. package/build-module/box-control/utils.mjs +1 -9
  66. package/build-module/box-control/utils.mjs.map +2 -2
  67. package/build-module/calendar/utils/use-localization-props.mjs +3 -2
  68. package/build-module/calendar/utils/use-localization-props.mjs.map +2 -2
  69. package/build-module/custom-gradient-picker/index.mjs.map +2 -2
  70. package/build-module/custom-select-control/index.mjs +2 -2
  71. package/build-module/custom-select-control/index.mjs.map +2 -2
  72. package/build-module/custom-select-control-v2/custom-select.mjs +2 -2
  73. package/build-module/custom-select-control-v2/custom-select.mjs.map +2 -2
  74. package/build-module/custom-select-control-v2/index.mjs +2 -2
  75. package/build-module/custom-select-control-v2/index.mjs.map +2 -2
  76. package/build-module/date-time/{date → date-picker}/index.mjs +3 -3
  77. package/build-module/date-time/{date → date-picker}/index.mjs.map +2 -2
  78. package/build-module/date-time/{date → date-picker}/styles.mjs +17 -17
  79. package/build-module/date-time/{date → date-picker}/styles.mjs.map +2 -2
  80. package/build-module/date-time/{date → date-picker}/use-lilius/index.mjs +1 -1
  81. package/build-module/date-time/{date → date-picker}/use-lilius/index.mjs.map +1 -1
  82. package/build-module/date-time/date-time/index.mjs +2 -2
  83. package/build-module/date-time/date-time/index.mjs.map +1 -1
  84. package/build-module/date-time/index.mjs +2 -2
  85. package/build-module/date-time/index.mjs.map +1 -1
  86. package/build-module/date-time/{time → time-picker}/index.mjs +3 -3
  87. package/build-module/date-time/time-picker/index.mjs.map +7 -0
  88. package/build-module/date-time/{time → time-picker}/styles.mjs +21 -21
  89. package/build-module/date-time/{time → time-picker}/styles.mjs.map +2 -2
  90. package/build-module/date-time/{time → time-picker}/time-input/index.mjs +1 -1
  91. package/build-module/date-time/{time → time-picker}/time-input/index.mjs.map +1 -1
  92. package/build-module/date-time/{time → time-picker}/timezone.mjs +1 -1
  93. package/build-module/date-time/{time → time-picker}/timezone.mjs.map +1 -1
  94. package/build-module/modal/index.mjs.map +2 -2
  95. package/build-module/palette-edit/index.mjs.map +2 -2
  96. package/build-module/radio-control/index.mjs +2 -0
  97. package/build-module/radio-control/index.mjs.map +2 -2
  98. package/build-module/sandbox/index.mjs +128 -4
  99. package/build-module/sandbox/index.mjs.map +2 -2
  100. package/build-module/textarea-control/styles/textarea-control-styles.mjs +3 -3
  101. package/build-module/textarea-control/styles/textarea-control-styles.mjs.map +2 -2
  102. package/build-module/validated-form-controls/control-with-error.mjs +12 -8
  103. package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
  104. package/build-style/style-rtl.css +83 -26
  105. package/build-style/style.css +83 -26
  106. package/build-types/autocomplete/autocompleter-ui.d.ts +2 -2
  107. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  108. package/build-types/autocomplete/get-autocomplete-match.d.ts +11 -0
  109. package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
  110. package/build-types/autocomplete/index.d.ts +8 -0
  111. package/build-types/autocomplete/index.d.ts.map +1 -1
  112. package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
  113. package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
  114. package/build-types/autocomplete/types.d.ts +23 -9
  115. package/build-types/autocomplete/types.d.ts.map +1 -1
  116. package/build-types/box-control/index.d.ts.map +1 -1
  117. package/build-types/box-control/utils.d.ts +7 -16
  118. package/build-types/box-control/utils.d.ts.map +1 -1
  119. package/build-types/button/stories/index.story.d.ts +0 -1
  120. package/build-types/button/stories/index.story.d.ts.map +1 -1
  121. package/build-types/calendar/utils/use-localization-props.d.ts +3 -3
  122. package/build-types/calendar/utils/use-localization-props.d.ts.map +1 -1
  123. package/build-types/checkbox-control/types.d.ts +4 -0
  124. package/build-types/checkbox-control/types.d.ts.map +1 -1
  125. package/build-types/custom-gradient-picker/constants.d.ts +2 -2
  126. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  127. package/build-types/custom-select-control-v2/custom-select.d.ts +3 -3
  128. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  129. package/build-types/custom-select-control-v2/types.d.ts +1 -1
  130. package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
  131. package/build-types/date-time/date-picker/index.d.ts.map +1 -0
  132. package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
  133. package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
  134. package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
  135. package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
  136. package/build-types/date-time/date-time/index.d.ts +2 -2
  137. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  138. package/build-types/date-time/index.d.ts +2 -2
  139. package/build-types/date-time/index.d.ts.map +1 -1
  140. package/build-types/date-time/stories/date.story.d.ts +1 -1
  141. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  142. package/build-types/date-time/stories/time.story.d.ts +1 -1
  143. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  144. package/build-types/date-time/{time → time-picker}/index.d.ts +1 -1
  145. package/build-types/date-time/time-picker/index.d.ts.map +1 -0
  146. package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
  147. package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
  148. package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
  149. package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
  150. package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
  151. package/build-types/date-time/types.d.ts +1 -1
  152. package/build-types/date-time/types.d.ts.map +1 -1
  153. package/build-types/font-size-picker/constants.d.ts +2 -2
  154. package/build-types/font-size-picker/constants.d.ts.map +1 -1
  155. package/build-types/modal/index.d.ts.map +1 -1
  156. package/build-types/palette-edit/index.d.ts +1 -1
  157. package/build-types/palette-edit/index.d.ts.map +1 -1
  158. package/build-types/radio-control/index.d.ts.map +1 -1
  159. package/build-types/radio-control/types.d.ts +6 -0
  160. package/build-types/radio-control/types.d.ts.map +1 -1
  161. package/build-types/sandbox/index.d.ts +1 -1
  162. package/build-types/sandbox/index.d.ts.map +1 -1
  163. package/build-types/sandbox/types.d.ts +11 -0
  164. package/build-types/sandbox/types.d.ts.map +1 -1
  165. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  166. package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
  167. package/build-types/validated-form-controls/components/checkbox-control.d.ts +2 -1
  168. package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
  169. package/build-types/validated-form-controls/components/radio-control.d.ts +2 -1
  170. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
  171. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  172. package/package.json +21 -21
  173. package/src/alignment-matrix-control/README.md +1 -1
  174. package/src/alignment-matrix-control/style.module.scss +1 -1
  175. package/src/angle-picker-control/style.module.scss +1 -0
  176. package/src/autocomplete/README.md +2 -2
  177. package/src/autocomplete/autocompleter-ui.native.js +166 -173
  178. package/src/autocomplete/autocompleter-ui.tsx +114 -116
  179. package/src/autocomplete/get-autocomplete-match.ts +115 -0
  180. package/src/autocomplete/index.tsx +129 -208
  181. package/src/autocomplete/test/get-autocomplete-match.ts +338 -0
  182. package/src/autocomplete/test/index.tsx +112 -4
  183. package/src/autocomplete/types.ts +17 -10
  184. package/src/box-control/index.tsx +1 -19
  185. package/src/box-control/utils.ts +1 -19
  186. package/src/button/README.md +1 -1
  187. package/src/button/stories/index.story.tsx +0 -1
  188. package/src/button/style.scss +1 -7
  189. package/src/calendar/style.scss +3 -3
  190. package/src/calendar/utils/use-localization-props.ts +3 -4
  191. package/src/checkbox-control/style.scss +17 -5
  192. package/src/checkbox-control/types.ts +4 -0
  193. package/src/circular-option-picker/style.scss +1 -1
  194. package/src/color-palette/style.scss +1 -1
  195. package/src/css.d.ts +1 -0
  196. package/src/custom-gradient-picker/index.tsx +1 -0
  197. package/src/custom-select-control/index.tsx +3 -3
  198. package/src/custom-select-control-v2/custom-select.tsx +4 -4
  199. package/src/custom-select-control-v2/index.tsx +2 -2
  200. package/src/custom-select-control-v2/types.ts +1 -1
  201. package/src/date-time/README.md +3 -3
  202. package/src/date-time/date-picker/README.md +65 -0
  203. package/src/date-time/date-time/index.tsx +2 -2
  204. package/src/date-time/index.ts +2 -2
  205. package/src/date-time/stories/date.story.tsx +1 -1
  206. package/src/date-time/stories/time.story.tsx +1 -1
  207. package/src/date-time/time-picker/README.md +119 -0
  208. package/src/date-time/{time → time-picker}/index.tsx +1 -1
  209. package/src/date-time/types.ts +1 -1
  210. package/src/divider/README.md +5 -6
  211. package/src/dropdown-menu/style.scss +1 -1
  212. package/src/flex/stories/index.story.tsx +1 -1
  213. package/src/form-file-upload/README.md +3 -3
  214. package/src/form-toggle/style.scss +35 -2
  215. package/src/form-token-field/style.scss +12 -3
  216. package/src/gradient-picker/README.md +2 -2
  217. package/src/h-stack/README.md +10 -15
  218. package/src/h-stack/stories/index.story.tsx +2 -2
  219. package/src/heading/stories/index.story.tsx +1 -1
  220. package/src/higher-order/with-focus-outside/index.native.js +21 -20
  221. package/src/icon/README.md +1 -1
  222. package/src/menu/README.md +2 -2
  223. package/src/mobile/utils/get-px-from-css-unit.native.js +1 -1
  224. package/src/modal/index.tsx +1 -0
  225. package/src/palette-edit/index.tsx +1 -0
  226. package/src/radio-control/index.tsx +2 -0
  227. package/src/radio-control/style.scss +21 -2
  228. package/src/radio-control/test/index.tsx +10 -0
  229. package/src/radio-control/types.ts +6 -0
  230. package/src/sandbox/index.native.js +2 -2
  231. package/src/sandbox/index.tsx +191 -11
  232. package/src/sandbox/test/index.tsx +65 -24
  233. package/src/sandbox/types.ts +11 -0
  234. package/src/snackbar/style.scss +2 -2
  235. package/src/tab-panel/style.scss +1 -1
  236. package/src/tabs/README.md +6 -6
  237. package/src/text/stories/index.story.tsx +1 -1
  238. package/src/textarea-control/stories/index.story.tsx +3 -0
  239. package/src/textarea-control/styles/textarea-control-styles.ts +6 -0
  240. package/src/toggle-control/style.scss +1 -1
  241. package/src/toggle-control/test/index.tsx +8 -2
  242. package/src/toolbar/toolbar-button/toolbar-button-container.native.js +3 -1
  243. package/src/tree-select/README.md +1 -1
  244. package/src/v-stack/README.md +10 -15
  245. package/src/v-stack/stories/index.story.tsx +2 -2
  246. package/src/validated-form-controls/control-with-error.tsx +17 -12
  247. package/src/validated-form-controls/test/control-with-error.tsx +28 -1
  248. package/src/view/README.md +2 -5
  249. package/build/date-time/time/index.cjs.map +0 -7
  250. package/build-module/date-time/time/index.mjs.map +0 -7
  251. package/build-types/date-time/date/index.d.ts.map +0 -1
  252. package/build-types/date-time/date/styles.d.ts.map +0 -1
  253. package/build-types/date-time/date/test/index.d.ts.map +0 -1
  254. package/build-types/date-time/date/test/use-lilius.d.ts.map +0 -1
  255. package/build-types/date-time/date/use-lilius/index.d.ts.map +0 -1
  256. package/build-types/date-time/time/index.d.ts.map +0 -1
  257. package/build-types/date-time/time/styles.d.ts.map +0 -1
  258. package/build-types/date-time/time/test/index.d.ts.map +0 -1
  259. package/build-types/date-time/time/time-input/index.d.ts.map +0 -1
  260. package/build-types/date-time/time/time-input/test/index.d.ts.map +0 -1
  261. package/build-types/date-time/time/timezone.d.ts.map +0 -1
  262. package/src/button/stories/style.css +0 -8
  263. /package/build-types/date-time/{date → date-picker}/index.d.ts +0 -0
  264. /package/build-types/date-time/{date → date-picker}/styles.d.ts +0 -0
  265. /package/build-types/date-time/{date → date-picker}/test/index.d.ts +0 -0
  266. /package/build-types/date-time/{date → date-picker}/test/use-lilius.d.ts +0 -0
  267. /package/build-types/date-time/{date → date-picker}/use-lilius/index.d.ts +0 -0
  268. /package/build-types/date-time/{time → time-picker}/styles.d.ts +0 -0
  269. /package/build-types/date-time/{time → time-picker}/test/index.d.ts +0 -0
  270. /package/build-types/date-time/{time → time-picker}/time-input/index.d.ts +0 -0
  271. /package/build-types/date-time/{time → time-picker}/time-input/test/index.d.ts +0 -0
  272. /package/build-types/date-time/{time → time-picker}/timezone.d.ts +0 -0
  273. /package/src/date-time/{date → date-picker}/index.tsx +0 -0
  274. /package/src/date-time/{date → date-picker}/styles.ts +0 -0
  275. /package/src/date-time/{date → date-picker}/test/index.tsx +0 -0
  276. /package/src/date-time/{date → date-picker}/test/use-lilius.ts +0 -0
  277. /package/src/date-time/{date → date-picker}/use-lilius/index.ts +0 -0
  278. /package/src/date-time/{time → time-picker}/styles.ts +0 -0
  279. /package/src/date-time/{time → time-picker}/test/index.tsx +0 -0
  280. /package/src/date-time/{time → time-picker}/time-input/index.tsx +0 -0
  281. /package/src/date-time/{time → time-picker}/time-input/test/index.tsx +0 -0
  282. /package/src/date-time/{time → time-picker}/timezone.tsx +0 -0
@@ -10,10 +10,9 @@ import type { Modifiers, BaseProps } from '../types';
10
10
 
11
11
  function isLocaleRTL( localeCode: string ) {
12
12
  const localeObj = new Intl.Locale( localeCode );
13
- if ( 'getTextInfo' in localeObj ) {
14
- // @ts-expect-error - getTextInfo is not typed yet
15
- // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
16
- return localeObj.getTextInfo().direction === 'rtl';
13
+ const direction = localeObj.getTextInfo?.().direction;
14
+ if ( direction ) {
15
+ return direction === 'rtl';
17
16
  }
18
17
  return [
19
18
  'ar', // Arabic
@@ -17,7 +17,10 @@
17
17
  .components-checkbox-control__label {
18
18
  // Ensure label is aligned with checkbox along X axis
19
19
  line-height: var(--checkbox-input-size);
20
- cursor: pointer;
20
+
21
+ .components-checkbox-control:not(:has(:disabled)) & {
22
+ cursor: var(--wpds-cursor-control);
23
+ }
21
24
  }
22
25
 
23
26
  .components-checkbox-control__input[type="checkbox"] {
@@ -25,7 +28,6 @@
25
28
  background: $white;
26
29
  color: $gray-900;
27
30
  clear: none;
28
- cursor: pointer;
29
31
  display: inline-block;
30
32
  line-height: 0;
31
33
  margin: 0 $grid-unit-05 0 0;
@@ -46,12 +48,15 @@
46
48
  @include button-style-outset__focus(var(--wp-admin-theme-color));
47
49
  }
48
50
 
49
- &:checked,
50
- &:indeterminate {
51
+ &:not(:disabled):is(:checked, :indeterminate) {
51
52
  background: $components-color-accent;
52
53
  border-color: $components-color-accent;
53
54
  }
54
55
 
56
+ &:not(:disabled) {
57
+ cursor: var(--wpds-cursor-control);
58
+ }
59
+
55
60
  &:checked::before {
56
61
  content: none;
57
62
  }
@@ -73,7 +78,7 @@ svg.components-checkbox-control__indeterminate {
73
78
  --checkmark-size: var(--checkbox-input-size);
74
79
 
75
80
  fill: $white;
76
- cursor: pointer;
81
+ cursor: var(--wpds-cursor-control);
77
82
  position: absolute;
78
83
  left: 50%;
79
84
  top: 50%;
@@ -88,6 +93,13 @@ svg.components-checkbox-control__indeterminate {
88
93
  }
89
94
  }
90
95
 
96
+ .components-checkbox-control:has(:disabled) {
97
+ svg.components-checkbox-control__checked,
98
+ svg.components-checkbox-control__indeterminate {
99
+ fill: $components-color-gray-400;
100
+ }
101
+ }
102
+
91
103
  .components-checkbox-control__help {
92
104
  display: inline-block;
93
105
  margin-inline-start: calc(var(--checkbox-input-size) + var(--checkbox-input-margin));
@@ -12,6 +12,10 @@ export type CheckboxControlProps = Pick<
12
12
  BaseControlProps,
13
13
  '__nextHasNoMarginBottom' | 'help'
14
14
  > & {
15
+ /**
16
+ * Whether the checkbox should be disabled.
17
+ */
18
+ disabled?: boolean;
15
19
  /**
16
20
  * A function that receives the checked state (boolean) as input.
17
21
  */
@@ -84,7 +84,7 @@ $color-palette-circle-spacing: 12px;
84
84
  transition: 100ms box-shadow ease;
85
85
  }
86
86
 
87
- cursor: pointer;
87
+ cursor: var(--wpds-cursor-control);
88
88
 
89
89
  &:hover {
90
90
  // Override default button hover style.
@@ -16,7 +16,7 @@ $border-as-box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
16
16
  height: $grid-unit-80;
17
17
  width: 100%;
18
18
  box-sizing: border-box;
19
- cursor: pointer;
19
+ cursor: var(--wpds-cursor-control);
20
20
  // Show a thin outline in Windows high contrast mode.
21
21
  outline: 1px solid transparent;
22
22
  border-radius: $radius-medium $radius-medium 0 0;
package/src/css.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1
2
  import type * as CSS from 'csstype';
2
3
 
3
4
  // See: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f6d4d15522356eba4a0267142834e3abc6b603fc/types/react/index.d.ts#L2580-L2587
@@ -76,6 +76,7 @@ const GradientTypePicker = ( {
76
76
  );
77
77
 
78
78
  if ( type === 'linear-gradient' && gradientAST.orientation ) {
79
+ // eslint-disable-next-line react-compiler/react-compiler -- false positive, see https://github.com/facebook/react/issues/29196
79
80
  lastLinearOrientationAngle.current = Number(
80
81
  gradientAST.orientation.value
81
82
  );
@@ -13,7 +13,7 @@ import { __, sprintf } from '@wordpress/i18n';
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
- import _CustomSelect from '../custom-select-control-v2/custom-select';
16
+ import CustomSelect from '../custom-select-control-v2/custom-select';
17
17
  import CustomSelectItem from '../custom-select-control-v2/item';
18
18
  import * as Styled from '../custom-select-control-v2/styles';
19
19
  import type { CustomSelectProps, CustomSelectOption } from './types';
@@ -189,7 +189,7 @@ function CustomSelectControl< T extends CustomSelectOption >(
189
189
 
190
190
  return (
191
191
  <>
192
- <_CustomSelect
192
+ <CustomSelect
193
193
  aria-describedby={ descriptionId }
194
194
  renderSelectedValue={ renderSelectedValue }
195
195
  size={ translatedSize }
@@ -203,7 +203,7 @@ function CustomSelectControl< T extends CustomSelectOption >(
203
203
  { ...restProps }
204
204
  >
205
205
  { children }
206
- </_CustomSelect>
206
+ </CustomSelect>
207
207
  <VisuallyHidden>
208
208
  <span id={ descriptionId }>
209
209
  { getDescribedBy( selectedOption?.name, describedBy ) }
@@ -19,7 +19,7 @@ import type {
19
19
  CustomSelectStore,
20
20
  CustomSelectButtonProps,
21
21
  CustomSelectButtonSize,
22
- _CustomSelectInternalProps,
22
+ CustomSelectInternalProps,
23
23
  _CustomSelectProps,
24
24
  } from './types';
25
25
  import InputBase from '../input-control/input-base';
@@ -85,8 +85,8 @@ const CustomSelectButton = ( {
85
85
  );
86
86
  };
87
87
 
88
- function _CustomSelect(
89
- props: _CustomSelectInternalProps &
88
+ function CustomSelect(
89
+ props: CustomSelectInternalProps &
90
90
  _CustomSelectProps &
91
91
  CustomSelectStore &
92
92
  CustomSelectButtonSize
@@ -161,4 +161,4 @@ function _CustomSelect(
161
161
  );
162
162
  }
163
163
 
164
- export default _CustomSelect;
164
+ export default CustomSelect;
@@ -5,7 +5,7 @@ import * as Ariakit from '@ariakit/react';
5
5
  /**
6
6
  * Internal dependencies
7
7
  */
8
- import _CustomSelect from './custom-select';
8
+ import CustomSelect from './custom-select';
9
9
  import type { CustomSelectProps } from './types';
10
10
  import type { WordPressComponentProps } from '../context';
11
11
  import Item from './item';
@@ -21,7 +21,7 @@ function CustomSelectControlV2(
21
21
  value,
22
22
  } );
23
23
 
24
- return <_CustomSelect { ...restProps } store={ store } />;
24
+ return <CustomSelect { ...restProps } store={ store } />;
25
25
  }
26
26
 
27
27
  CustomSelectControlV2.Item = Item;
@@ -50,7 +50,7 @@ export type CustomSelectButtonProps = {
50
50
  };
51
51
 
52
52
  // Props only exposed on the internal implementation
53
- export type _CustomSelectInternalProps = {
53
+ export type CustomSelectInternalProps = {
54
54
  /**
55
55
  * True if the consumer is emulating the legacy component behavior and look
56
56
  */
@@ -70,7 +70,7 @@ A callback function which receives a Date object representing a day as an argume
70
70
 
71
71
  - Required: No
72
72
 
73
- ### `onMonthPreviewed`: `( date: Date ) => void`
73
+ ### `onMonthPreviewed`: `( date: string ) => void`
74
74
 
75
75
  A callback invoked when selecting the previous/next month in the date picker. The callback receives the new month date in the ISO format as an argument.
76
76
 
@@ -87,5 +87,5 @@ List of events to show in the date picker. Each event will appear as a dot on th
87
87
 
88
88
  The day that the week should start on. 0 for Sunday, 1 for Monday, etc.
89
89
 
90
- - Required: No
91
- - Default: 0
90
+ - Required: No
91
+ - Default: 0
@@ -0,0 +1,65 @@
1
+ # DatePicker
2
+
3
+ DatePicker is a React component that renders a calendar for date selection. It can be used independently or as part of the `DateTimePicker` component.
4
+
5
+ ## Usage
6
+
7
+ Render a DatePicker.
8
+
9
+ ```jsx
10
+ import { useState } from 'react';
11
+ import { DatePicker } from '@wordpress/components';
12
+
13
+ const MyDatePicker = () => {
14
+ const [ date, setDate ] = useState( new Date() );
15
+
16
+ return (
17
+ <DatePicker
18
+ currentDate={ date }
19
+ onChange={ ( newDate ) => setDate( newDate ) }
20
+ />
21
+ );
22
+ };
23
+ ```
24
+
25
+ ## Props
26
+
27
+ The component accepts the following props:
28
+
29
+ ### `currentDate`: `Date | string | number | null`
30
+
31
+ The current date at initialization. Optionally pass in a `null` value to specify no date is currently selected.
32
+
33
+ - Required: No
34
+ - Default: today's date
35
+
36
+ ### `onChange`: `( date: string ) => void`
37
+
38
+ The function called when a new date has been selected. It is passed the `currentDate` as an argument.
39
+
40
+ - Required: No
41
+
42
+ ### `events`: `{ date: Date }[]`
43
+
44
+ List of events to show in the date picker. Each event will appear as a dot on the day of the event.
45
+
46
+ - Required: No
47
+
48
+ ### `isInvalidDate`: `( date: Date ) => boolean`
49
+
50
+ A callback function which receives a Date object representing a day as an argument, and should return a Boolean to signify if the day is valid or not.
51
+
52
+ - Required: No
53
+
54
+ ### `onMonthPreviewed`: `( date: string ) => void`
55
+
56
+ A callback invoked when selecting the previous/next month in the date picker. The callback receives the new month date in the ISO format as an argument.
57
+
58
+ - Required: No
59
+
60
+ ### `startOfWeek`: `0 | 1 | 2 | 3 | 4 | 5 | 6`
61
+
62
+ The day that the week should start on. 0 for Sunday, 1 for Monday, etc.
63
+
64
+ - Required: No
65
+ - Default: 0
@@ -11,8 +11,8 @@ import { forwardRef } from '@wordpress/element';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
- import { default as DatePicker } from '../date';
15
- import { default as TimePicker } from '../time';
14
+ import { default as DatePicker } from '../date-picker';
15
+ import { default as TimePicker } from '../time-picker';
16
16
  import type { DateTimePickerProps } from '../types';
17
17
  import { Wrapper } from './styles';
18
18
 
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { default as DatePicker } from './date';
5
- import { default as TimePicker } from './time';
4
+ import { default as DatePicker } from './date-picker';
5
+ import { default as TimePicker } from './time-picker';
6
6
  import { default as DateTimePicker } from './date-time';
7
7
 
8
8
  export { DatePicker, TimePicker };
@@ -11,7 +11,7 @@ import { useState, useEffect } from '@wordpress/element';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
- import DatePicker from '../date';
14
+ import DatePicker from '../date-picker';
15
15
  import { daysFromNow, isWeekend } from './utils';
16
16
 
17
17
  const meta: Meta< typeof DatePicker > = {
@@ -11,7 +11,7 @@ import { useState, useEffect } from '@wordpress/element';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
- import TimePicker from '../time';
14
+ import TimePicker from '../time-picker';
15
15
 
16
16
  const meta: Meta< typeof TimePicker > = {
17
17
  title: 'Components/Selection & Input/Time & Date/TimePicker',
@@ -0,0 +1,119 @@
1
+ # TimePicker
2
+
3
+ TimePicker is a React component that renders form inputs for time and date selection. It can be used independently or as part of the `DateTimePicker` component.
4
+
5
+ **Note:** `TimePicker` also exposes a compound sub-component, `TimePicker.TimeInput`, which can be used independently to render a time input field without the full picker UI.
6
+
7
+ ## Usage
8
+
9
+ Render a TimePicker.
10
+
11
+ ```jsx
12
+ import { useState } from 'react';
13
+ import { TimePicker } from '@wordpress/components';
14
+
15
+ const MyTimePicker = () => {
16
+ const [ time, setTime ] = useState( new Date() );
17
+
18
+ return (
19
+ <TimePicker
20
+ currentTime={ time }
21
+ onChange={ ( newTime ) => setTime( newTime ) }
22
+ is12Hour
23
+ />
24
+ );
25
+ };
26
+ ```
27
+
28
+ ## Props
29
+
30
+ The component accepts the following props:
31
+
32
+ ### `currentTime`: `Date | string | number | null`
33
+
34
+ The current time at initialization. Optionally pass in a `null` value to specify no time is currently selected.
35
+
36
+ - Required: No
37
+ - Default: current time
38
+
39
+ ### `onChange`: `( time: string ) => void`
40
+
41
+ The function called when a new time has been selected. It is passed the time as an ISO-formatted string.
42
+
43
+ - Required: No
44
+
45
+ ### `is12Hour`: `boolean`
46
+
47
+ Whether we use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed.
48
+
49
+ - Required: No
50
+ - Default: false
51
+
52
+ ### `dateOrder`: `'dmy' | 'mdy' | 'ymd'`
53
+
54
+ The order of day, month, and year. This prop overrides the time format determined by `is12Hour` prop.
55
+
56
+ - Required: No
57
+ - Default: `'dmy'` (or `'mdy'` when `is12Hour` is `true`)
58
+
59
+ ### `hideLabelFromVision`: `boolean`
60
+
61
+ Whether to visually hide field labels while keeping them accessible to screen readers.
62
+
63
+ - Required: No
64
+ - Default: false
65
+
66
+ ## TimePicker.TimeInput
67
+
68
+ A standalone time input component. Values are passed as an object in 24-hour format (`{ hours: number, minutes: number }`).
69
+
70
+ ### Usage
71
+
72
+ ```jsx
73
+ import { useState } from 'react';
74
+ import { TimePicker } from '@wordpress/components';
75
+
76
+ const MyTimeInput = () => {
77
+ const [ time, setTime ] = useState( { hours: 13, minutes: 30 } );
78
+
79
+ return (
80
+ <TimePicker.TimeInput
81
+ value={ time }
82
+ onChange={ setTime }
83
+ label="Time"
84
+ />
85
+ );
86
+ };
87
+ ```
88
+
89
+ ### Props
90
+
91
+ #### `value`: `{ hours: number, minutes: number }`
92
+
93
+ The time input value in 24-hour format.
94
+
95
+ - Required: No
96
+
97
+ #### `defaultValue`: `{ hours: number, minutes: number }`
98
+
99
+ An optional default value for the control when used in uncontrolled mode. If left `undefined`, the current time will be used.
100
+
101
+ - Required: No
102
+
103
+ #### `onChange`: `( time: { hours: number, minutes: number } ) => void`
104
+
105
+ Called when the time changes. Receives the new value as an object with `hours` and `minutes`.
106
+
107
+ - Required: No
108
+
109
+ #### `is12Hour`: `boolean`
110
+
111
+ Whether to use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed.
112
+
113
+ - Required: No
114
+
115
+ #### `label`: `string`
116
+
117
+ The label for the time input.
118
+
119
+ - Required: No
@@ -30,7 +30,7 @@ import { TimeInput } from './time-input';
30
30
  const VALID_DATE_ORDERS = [ 'dmy', 'mdy', 'ymd' ];
31
31
 
32
32
  /**
33
- * TimePicker is a React component that renders a clock for time selection.
33
+ * TimePicker is a React component that renders form inputs for time and date selection. It can be used independently or as part of the `DateTimePicker` component.
34
34
  *
35
35
  * ```jsx
36
36
  * import { TimePicker } from '@wordpress/components';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import type { MinutesInput } from './time/styles';
4
+ import type { MinutesInput } from './time-picker/styles';
5
5
 
6
6
  export type TimePickerProps = {
7
7
  /**
@@ -11,17 +11,16 @@ This feature is still experimental. “Experimental” means this is an early im
11
11
  ```jsx
12
12
  import {
13
13
  __experimentalDivider as Divider,
14
- __experimentalText as Text,
15
- __experimentalVStack as VStack,
16
14
  } from `@wordpress/components`;
15
+ import { Stack } from '@wordpress/ui';
17
16
 
18
17
  function Example() {
19
18
  return (
20
- <VStack spacing={4}>
21
- <Text>Some text here</Text>
19
+ <Stack direction="column" gap="lg">
20
+ <span>Some text here</span>
22
21
  <Divider />
23
- <Text>Some more text here</Text>
24
- </VStack>
22
+ <span>Some more text here</span>
23
+ </Stack>
25
24
  );
26
25
  }
27
26
  ```
@@ -16,7 +16,7 @@
16
16
  width: 100%;
17
17
  padding: 6px;
18
18
  outline: none;
19
- cursor: pointer;
19
+ cursor: var(--wpds-cursor-control);
20
20
  white-space: nowrap;
21
21
  font-weight: $font-weight-regular;
22
22
 
@@ -34,7 +34,7 @@ const meta: Meta< typeof Flex > = {
34
34
  componentStatus: {
35
35
  status: 'not-recommended',
36
36
  whereUsed: 'global',
37
- notes: 'Planned for deprecation. For use cases not covered by `HStack` and `VStack`, write your own CSS.',
37
+ notes: 'Planned for deprecation. For use cases not covered by `Stack` from `@wordpress/ui`, write your own CSS.',
38
38
  },
39
39
  },
40
40
  };
@@ -48,7 +48,7 @@ Children are passed as children of `Button`.
48
48
 
49
49
  ### `icon`
50
50
 
51
- - Type: `IconType`
51
+ - Type: `IconType | null`
52
52
  - Required: No
53
53
 
54
54
  The icon to render in the default button.
@@ -65,7 +65,7 @@ Whether to allow multiple selection of files or not.
65
65
 
66
66
  ### `onChange`
67
67
 
68
- - Type: `ChangeEventHandler<HTMLInputElement>`
68
+ - Type: `ChangeEventHandler<HTMLInputElement> | undefined`
69
69
  - Required: Yes
70
70
 
71
71
  Callback function passed directly to the `input` file element.
@@ -95,7 +95,7 @@ an empty string in the `onClick` function.
95
95
 
96
96
  ### `render`
97
97
 
98
- - Type: `(arg: { openFileDialog: () => void; }) => ReactNode`
98
+ - Type: `((arg: { openFileDialog: () => void; }) => ReactNode)`
99
99
  - Required: No
100
100
 
101
101
  Optional callback function used to render the UI.
@@ -104,7 +104,40 @@ $transition-duration: 0.2s;
104
104
  // Disabled state:
105
105
  &.is-disabled,
106
106
  .components-disabled & {
107
- opacity: 0.3;
107
+ .components-form-toggle__track {
108
+ background-color: $components-color-gray-100;
109
+ border-color: $components-color-gray-300;
110
+
111
+ @media ( forced-colors: active ) {
112
+ border-color: GrayText;
113
+ }
114
+ }
115
+
116
+ .components-form-toggle__thumb {
117
+ background-color: $components-color-gray-400;
118
+ box-shadow: none;
119
+
120
+ @media ( forced-colors: active ) {
121
+ border-color: GrayText;
122
+ }
123
+ }
124
+
125
+ &.is-checked .components-form-toggle__track {
126
+ background-color: $components-color-gray-400;
127
+ border-color: $components-color-gray-400;
128
+
129
+ @media ( forced-colors: active ) {
130
+ border-color: GrayText;
131
+
132
+ &::after {
133
+ border-top-color: GrayText;
134
+ }
135
+ }
136
+ }
137
+
138
+ &.is-checked .components-form-toggle__thumb {
139
+ background-color: $white;
140
+ }
108
141
  }
109
142
  }
110
143
 
@@ -132,6 +165,6 @@ $transition-duration: 0.2s;
132
165
  }
133
166
 
134
167
  &:not(:disabled, [aria-disabled="true"]) {
135
- cursor: pointer;
168
+ cursor: var(--wpds-cursor-control);
136
169
  }
137
170
  }
@@ -11,8 +11,9 @@
11
11
  cursor: text;
12
12
 
13
13
  &.is-disabled {
14
- background: $gray-300;
15
- border-color: $gray-300;
14
+ background: $components-color-gray-100;
15
+ border-color: $components-color-gray-400;
16
+ cursor: default;
16
17
  }
17
18
 
18
19
  &.is-active {
@@ -82,6 +83,14 @@
82
83
  }
83
84
  }
84
85
 
86
+ &.is-disabled {
87
+ .components-form-token-field__token-text,
88
+ .components-form-token-field__remove-token.components-button {
89
+ background: $components-color-gray-100;
90
+ color: $components-color-gray-600;
91
+ }
92
+ }
93
+
85
94
  &.is-borderless {
86
95
  position: relative;
87
96
  padding: 0 24px 0 0;
@@ -198,6 +207,6 @@
198
207
  }
199
208
 
200
209
  &:not(.is-empty) {
201
- cursor: pointer;
210
+ cursor: var(--wpds-cursor-control);
202
211
  }
203
212
  }
@@ -141,7 +141,7 @@ Only used when `asButtons` is not true.
141
141
 
142
142
  ### `onChange`
143
143
 
144
- - Type: `(currentGradient: string) => void`
144
+ - Type: `(currentGradient: string | undefined) => void`
145
145
  - Required: Yes
146
146
 
147
147
  The function called when a new gradient has been defined. It is passed to
@@ -149,7 +149,7 @@ the `currentGradient` as an argument.
149
149
 
150
150
  ### `value`
151
151
 
152
- - Type: `string`
152
+ - Type: `string | null`
153
153
  - Required: No
154
154
  - Default: `'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'`
155
155