@wordpress/components 30.1.0 → 30.2.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 (211) hide show
  1. package/CHANGELOG.md +19 -3
  2. package/build/custom-gradient-picker/serializer.js +14 -0
  3. package/build/custom-gradient-picker/serializer.js.map +1 -1
  4. package/build/custom-gradient-picker/utils.js +12 -0
  5. package/build/custom-gradient-picker/utils.js.map +1 -1
  6. package/build/date-time/date/index.js +2 -4
  7. package/build/date-time/date/index.js.map +1 -1
  8. package/build/date-time/date/styles.js +41 -20
  9. package/build/date-time/date/styles.js.map +1 -1
  10. package/build/menu-item/index.js +1 -0
  11. package/build/menu-item/index.js.map +1 -1
  12. package/build/validated-form-controls/components/checkbox-control.js +5 -3
  13. package/build/validated-form-controls/components/checkbox-control.js.map +1 -1
  14. package/build/validated-form-controls/components/combobox-control.js +5 -3
  15. package/build/validated-form-controls/components/combobox-control.js.map +1 -1
  16. package/build/validated-form-controls/components/custom-select-control.js +5 -3
  17. package/build/validated-form-controls/components/custom-select-control.js.map +1 -1
  18. package/build/validated-form-controls/components/input-control.js +5 -3
  19. package/build/validated-form-controls/components/input-control.js.map +1 -1
  20. package/build/validated-form-controls/components/number-control.js +5 -3
  21. package/build/validated-form-controls/components/number-control.js.map +1 -1
  22. package/build/validated-form-controls/components/radio-control.js +5 -3
  23. package/build/validated-form-controls/components/radio-control.js.map +1 -1
  24. package/build/validated-form-controls/components/range-control.js +5 -3
  25. package/build/validated-form-controls/components/range-control.js.map +1 -1
  26. package/build/validated-form-controls/components/select-control.js +5 -3
  27. package/build/validated-form-controls/components/select-control.js.map +1 -1
  28. package/build/validated-form-controls/components/text-control.js +5 -3
  29. package/build/validated-form-controls/components/text-control.js.map +1 -1
  30. package/build/validated-form-controls/components/textarea-control.js +5 -3
  31. package/build/validated-form-controls/components/textarea-control.js.map +1 -1
  32. package/build/validated-form-controls/components/toggle-control.js +5 -3
  33. package/build/validated-form-controls/components/toggle-control.js.map +1 -1
  34. package/build/validated-form-controls/components/toggle-group-control.js +5 -3
  35. package/build/validated-form-controls/components/toggle-group-control.js.map +1 -1
  36. package/build/validated-form-controls/components/types.js.map +1 -1
  37. package/build/validated-form-controls/control-with-error.js +57 -22
  38. package/build/validated-form-controls/control-with-error.js.map +1 -1
  39. package/build/validated-form-controls/validity-indicator.js +45 -0
  40. package/build/validated-form-controls/validity-indicator.js.map +1 -0
  41. package/build-module/custom-gradient-picker/serializer.js +14 -0
  42. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  43. package/build-module/custom-gradient-picker/utils.js +12 -0
  44. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  45. package/build-module/date-time/date/index.js +3 -4
  46. package/build-module/date-time/date/index.js.map +1 -1
  47. package/build-module/date-time/date/styles.js +39 -14
  48. package/build-module/date-time/date/styles.js.map +1 -1
  49. package/build-module/menu-item/index.js +1 -0
  50. package/build-module/menu-item/index.js.map +1 -1
  51. package/build-module/validated-form-controls/components/checkbox-control.js +5 -3
  52. package/build-module/validated-form-controls/components/checkbox-control.js.map +1 -1
  53. package/build-module/validated-form-controls/components/combobox-control.js +5 -3
  54. package/build-module/validated-form-controls/components/combobox-control.js.map +1 -1
  55. package/build-module/validated-form-controls/components/custom-select-control.js +5 -3
  56. package/build-module/validated-form-controls/components/custom-select-control.js.map +1 -1
  57. package/build-module/validated-form-controls/components/input-control.js +5 -3
  58. package/build-module/validated-form-controls/components/input-control.js.map +1 -1
  59. package/build-module/validated-form-controls/components/number-control.js +5 -3
  60. package/build-module/validated-form-controls/components/number-control.js.map +1 -1
  61. package/build-module/validated-form-controls/components/radio-control.js +5 -3
  62. package/build-module/validated-form-controls/components/radio-control.js.map +1 -1
  63. package/build-module/validated-form-controls/components/range-control.js +5 -3
  64. package/build-module/validated-form-controls/components/range-control.js.map +1 -1
  65. package/build-module/validated-form-controls/components/select-control.js +5 -3
  66. package/build-module/validated-form-controls/components/select-control.js.map +1 -1
  67. package/build-module/validated-form-controls/components/text-control.js +5 -3
  68. package/build-module/validated-form-controls/components/text-control.js.map +1 -1
  69. package/build-module/validated-form-controls/components/textarea-control.js +5 -3
  70. package/build-module/validated-form-controls/components/textarea-control.js.map +1 -1
  71. package/build-module/validated-form-controls/components/toggle-control.js +5 -3
  72. package/build-module/validated-form-controls/components/toggle-control.js.map +1 -1
  73. package/build-module/validated-form-controls/components/toggle-group-control.js +5 -3
  74. package/build-module/validated-form-controls/components/toggle-group-control.js.map +1 -1
  75. package/build-module/validated-form-controls/components/types.js.map +1 -1
  76. package/build-module/validated-form-controls/control-with-error.js +57 -21
  77. package/build-module/validated-form-controls/control-with-error.js.map +1 -1
  78. package/build-module/validated-form-controls/validity-indicator.js +37 -0
  79. package/build-module/validated-form-controls/validity-indicator.js.map +1 -0
  80. package/build-style/style-rtl.css +37 -25
  81. package/build-style/style.css +37 -25
  82. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  83. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  84. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -1
  85. package/build-types/date-time/date/index.d.ts.map +1 -1
  86. package/build-types/date-time/date/styles.d.ts +6 -0
  87. package/build-types/date-time/date/styles.d.ts.map +1 -1
  88. package/build-types/divider/stories/index.story.d.ts.map +1 -1
  89. package/build-types/elevation/stories/index.story.d.ts.map +1 -1
  90. package/build-types/form-token-field/stories/index.story.d.ts +10 -5
  91. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  92. package/build-types/gradient-picker/stories/index.story.d.ts +2 -1
  93. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  94. package/build-types/grid/stories/index.story.d.ts.map +1 -1
  95. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  96. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  97. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  98. package/build-types/item-group/stories/index.story.d.ts.map +1 -1
  99. package/build-types/menu-item/index.d.ts.map +1 -1
  100. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  101. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  102. package/build-types/spacer/stories/index.story.d.ts.map +1 -1
  103. package/build-types/surface/stories/index.story.d.ts.map +1 -1
  104. package/build-types/text/stories/index.story.d.ts.map +1 -1
  105. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  106. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  107. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  108. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  109. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  110. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  111. package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
  112. package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -1
  113. package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -1
  114. package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -1
  115. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  116. package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
  117. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  118. package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -1
  119. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
  120. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
  121. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
  122. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
  123. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
  124. package/build-types/validated-form-controls/components/stories/overview.story.d.ts +13 -0
  125. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  126. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
  127. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
  128. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
  129. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
  130. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
  131. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
  132. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
  133. package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -1
  134. package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -1
  135. package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -1
  136. package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
  137. package/build-types/validated-form-controls/components/types.d.ts +21 -10
  138. package/build-types/validated-form-controls/components/types.d.ts.map +1 -1
  139. package/build-types/validated-form-controls/control-with-error.d.ts +4 -5
  140. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  141. package/build-types/validated-form-controls/validity-indicator.d.ts +5 -0
  142. package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -0
  143. package/build-types/view/stories/index.story.d.ts.map +1 -1
  144. package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
  145. package/package.json +21 -21
  146. package/src/button/style.scss +3 -3
  147. package/src/calendar/style.scss +22 -22
  148. package/src/confirm-dialog/stories/index.story.tsx +3 -2
  149. package/src/custom-gradient-picker/serializer.ts +14 -0
  150. package/src/custom-gradient-picker/test/serializer.ts +25 -0
  151. package/src/custom-gradient-picker/utils.ts +10 -0
  152. package/src/date-time/date/index.tsx +4 -3
  153. package/src/date-time/date/styles.ts +13 -20
  154. package/src/divider/stories/index.story.tsx +2 -1
  155. package/src/elevation/stories/index.story.tsx +2 -1
  156. package/src/form-token-field/stories/index.story.tsx +15 -7
  157. package/src/gradient-picker/stories/index.story.tsx +48 -0
  158. package/src/grid/stories/index.story.tsx +2 -1
  159. package/src/h-stack/stories/e2e/index.story.tsx +1 -1
  160. package/src/h-stack/stories/index.story.tsx +3 -2
  161. package/src/heading/stories/index.story.tsx +3 -2
  162. package/src/input-control/stories/index.story.tsx +3 -2
  163. package/src/item-group/stories/index.story.tsx +2 -1
  164. package/src/menu/stories/index.story.tsx +1 -1
  165. package/src/menu-item/index.tsx +1 -0
  166. package/src/number-control/stories/index.story.tsx +3 -2
  167. package/src/scrollable/stories/index.story.tsx +2 -1
  168. package/src/spacer/stories/index.story.tsx +2 -1
  169. package/src/surface/stories/index.story.tsx +2 -1
  170. package/src/text/stories/index.story.tsx +3 -2
  171. package/src/toggle-group-control/stories/index.story.tsx +3 -2
  172. package/src/tools-panel/stories/index.story.tsx +2 -1
  173. package/src/tree-grid/stories/index.story.tsx +3 -2
  174. package/src/truncate/stories/index.story.tsx +3 -2
  175. package/src/unit-control/stories/index.story.tsx +3 -2
  176. package/src/utils/theme-variables.scss +1 -0
  177. package/src/v-stack/stories/e2e/index.story.tsx +1 -1
  178. package/src/v-stack/stories/index.story.tsx +3 -2
  179. package/src/validated-form-controls/components/checkbox-control.tsx +5 -3
  180. package/src/validated-form-controls/components/combobox-control.tsx +5 -3
  181. package/src/validated-form-controls/components/custom-select-control.tsx +5 -3
  182. package/src/validated-form-controls/components/input-control.tsx +5 -3
  183. package/src/validated-form-controls/components/number-control.tsx +5 -3
  184. package/src/validated-form-controls/components/radio-control.tsx +5 -3
  185. package/src/validated-form-controls/components/range-control.tsx +5 -3
  186. package/src/validated-form-controls/components/select-control.tsx +5 -3
  187. package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +19 -7
  188. package/src/validated-form-controls/components/stories/combobox-control.story.tsx +19 -7
  189. package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +19 -7
  190. package/src/validated-form-controls/components/stories/input-control.story.tsx +53 -19
  191. package/src/validated-form-controls/components/stories/number-control.story.tsx +19 -7
  192. package/src/validated-form-controls/components/stories/overview.mdx +2 -2
  193. package/src/validated-form-controls/components/stories/overview.story.tsx +124 -16
  194. package/src/validated-form-controls/components/stories/radio-control.story.tsx +19 -7
  195. package/src/validated-form-controls/components/stories/range-control.story.tsx +19 -7
  196. package/src/validated-form-controls/components/stories/select-control.story.tsx +19 -7
  197. package/src/validated-form-controls/components/stories/text-control.story.tsx +19 -7
  198. package/src/validated-form-controls/components/stories/textarea-control.story.tsx +19 -7
  199. package/src/validated-form-controls/components/stories/toggle-control.story.tsx +19 -7
  200. package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +19 -7
  201. package/src/validated-form-controls/components/text-control.tsx +5 -3
  202. package/src/validated-form-controls/components/textarea-control.tsx +5 -3
  203. package/src/validated-form-controls/components/toggle-control.tsx +5 -3
  204. package/src/validated-form-controls/components/toggle-group-control.tsx +5 -3
  205. package/src/validated-form-controls/components/types.ts +21 -12
  206. package/src/validated-form-controls/control-with-error.tsx +77 -26
  207. package/src/validated-form-controls/style.scss +19 -5
  208. package/src/validated-form-controls/validity-indicator.tsx +48 -0
  209. package/src/view/stories/index.story.tsx +2 -1
  210. package/src/z-stack/stories/index.story.tsx +2 -1
  211. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"input-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/input-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAOvD;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAKzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,qBAAqB,CAe7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAkB3D,CAAC;AAaF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAgC5D,CAAC"}
1
+ {"version":3,"file":"input-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/input-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAOvD;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAKzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,qBAAqB,CAgB7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAmC3D,CAAC;AAOF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAkE5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"number-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/number-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,sBAAsB,CAa9C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,sBAAsB,CAkB5D,CAAC"}
1
+ {"version":3,"file":"number-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/number-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,sBAAsB,CAc9C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,sBAAsB,CAmC5D,CAAC"}
@@ -2,6 +2,10 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { Meta, StoryObj } from '@storybook/react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { ValidatedInputControl } from '..';
5
9
  import type { ControlWithError } from '../../control-with-error';
6
10
  declare const meta: Meta<typeof ControlWithError>;
7
11
  export default meta;
@@ -16,4 +20,13 @@ export declare const WithMultipleControls: Story;
16
20
  * will depend on context.
17
21
  */
18
22
  export declare const WithHelpTextReplacement: Story;
23
+ /**
24
+ * To provide feedback from server-side validation, the `customValidity` prop can be used
25
+ * to show additional status indicators while waiting for the server response,
26
+ * and after the response is received.
27
+ *
28
+ * These indicators are intended for asynchronous validation calls that may take more than 1 second to complete.
29
+ * They may be unnecessary when responses are generally quick.
30
+ */
31
+ export declare const AsyncValidation: StoryObj<typeof ValidatedInputControl>;
19
32
  //# sourceMappingURL=overview.story.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overview.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/overview.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,gBAAgB,CAIxC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,gBAAgB,CAAE,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAoClC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,KA2BrC,CAAC"}
1
+ {"version":3,"file":"overview.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/overview.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,gBAAgB,CAIxC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,gBAAgB,CAAE,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,KA0DlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAmCrC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CA8DnE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"radio-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/radio-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,qBAAqB,CAS7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAoB3D,CAAC"}
1
+ {"version":3,"file":"radio-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/radio-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,qBAAqB,CAU7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAqC3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"range-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/range-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,qBAAqB,CAS7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAkB3D,CAAC"}
1
+ {"version":3,"file":"range-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/range-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,qBAAqB,CAU7C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,qBAAqB,CAmC3D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"select-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/select-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,sBAAsB,CAS9C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,sBAAsB,CAe5D,CAAC"}
1
+ {"version":3,"file":"select-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/select-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,sBAAsB,CAU9C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,sBAAsB,CAgC5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"text-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/text-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,oBAAoB,CAS5C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,oBAAoB,CAe1D,CAAC"}
1
+ {"version":3,"file":"text-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/text-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,oBAAoB,CAU5C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,oBAAoB,CAgC1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"textarea-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/textarea-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,wBAAwB,CAOhD,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,wBAAwB,CAe9D,CAAC"}
1
+ {"version":3,"file":"textarea-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/textarea-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,wBAAwB,CAQhD,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,wBAAwB,CAgC9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/toggle-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,sBAAsB,CAS9C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,sBAAsB,CAe5D,CAAC"}
1
+ {"version":3,"file":"toggle-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/toggle-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,sBAAsB,CAU9C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,sBAAsB,CAgC5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-group-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/toggle-group-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAGtE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,2BAA2B,CASnD,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,2BAA2B,CAoBjE,CAAC"}
1
+ {"version":3,"file":"toggle-group-control.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/toggle-group-control.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAGtE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,2BAA2B,CAUnD,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,2BAA2B,CAqCjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"text-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/text-control.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA+CrD,eAAO,MAAM,oBAAoB;;;;;+eAEhC,CAAC"}
1
+ {"version":3,"file":"text-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/text-control.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAiDrD,eAAO,MAAM,oBAAoB;;;;;+eAEhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"textarea-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/textarea-control.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA8CrD,eAAO,MAAM,wBAAwB;;;;mbAEpC,CAAC"}
1
+ {"version":3,"file":"textarea-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/textarea-control.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAgDrD,eAAO,MAAM,wBAAwB;;;;mbAEpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/toggle-control.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAwDrD,eAAO,MAAM,sBAAsB;;;;6aAElC,CAAC"}
1
+ {"version":3,"file":"toggle-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/toggle-control.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA0DrD,eAAO,MAAM,sBAAsB;;;;6aAElC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-group-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/toggle-group-control.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAsErD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;2lBAEvC,CAAC"}
1
+ {"version":3,"file":"toggle-group-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/toggle-group-control.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAwErD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;2lBAEvC,CAAC"}
@@ -10,18 +10,29 @@ export type ValidatedControlProps<V> = {
10
10
  */
11
11
  markWhenOptional?: boolean;
12
12
  /**
13
- * A function that returns a custom validity message when applicable. This error message will be applied to the
14
- * underlying element using the native [`setCustomValidity()` method](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity).
15
- * This means the custom validator will be run _in addition_ to any other HTML attribute-based validation, and
16
- * will be prioritized over any existing validity messages dictated by the HTML attributes.
17
- * An empty string or `undefined` return value will clear any existing custom validity message.
13
+ * Optional callback to run when the input should be validated. Use this to set
14
+ * a `customValidity` as necessary.
18
15
  *
19
- * Make sure you don't programatically pass a value (such as an initial value) to the control component
20
- * that fails this validator, because the validator will only run for user-initiated changes.
16
+ * Always prefer using standard HTML attributes like `required` and `min`/`max` over
17
+ * custom validators when possible, as they are simpler and have localized error messages built in.
18
+ */
19
+ onValidate?: (currentValue: V) => void;
20
+ /**
21
+ * Show a custom message based on the validation status.
21
22
  *
22
- * Always prefer using standard HTML attributes like `required` and `min`/`max` over custom validators
23
- * when possible, as they are simpler and have localized error messages built in.
23
+ * - When `type` is `invalid`, the message will be applied to the underlying element using the
24
+ * native [`setCustomValidity()` method](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity).
25
+ * This means the custom message will be prioritized over any existing validity messages
26
+ * triggered by HTML attribute-based validation.
27
+ * - When `type` is `validating` or `valid`, the custom validity message of the underlying element
28
+ * will be cleared. If there are no remaining validity messages triggered by HTML attribute-based validation,
29
+ * the message will be presented as a status indicator rather than an error. These indicators are intended
30
+ * for asynchronous validation calls that may take more than 1 second to complete.
31
+ * Otherwise, custom errors can simply be cleared by setting the `customValidity` prop to `undefined`.
24
32
  */
25
- customValidator?: (currentValue: V) => string | void;
33
+ customValidity?: {
34
+ type: 'validating' | 'valid' | 'invalid';
35
+ message: string;
36
+ };
26
37
  };
27
38
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,CAAE,CAAC,IAAK;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;;;;OAYG;IAGH,eAAe,CAAC,EAAE,CAAE,YAAY,EAAE,CAAC,KAAM,MAAM,GAAG,IAAI,CAAC;CACvD,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,CAAE,CAAC,IAAK;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAE,YAAY,EAAE,CAAC,KAAM,IAAI,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE;QAChB,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;QACzC,OAAO,EAAE,MAAM,CAAC;KAChB,CAAC;CACF,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { ValidatedControlProps } from './components/types';
1
2
  /**
2
3
  * HTML elements that support the Constraint Validation API.
3
4
  *
@@ -17,12 +18,10 @@ export declare const ControlWithError: import("react").ForwardRefExoticComponent
17
18
  */
18
19
  markWhenOptional?: boolean;
19
20
  /**
20
- * A function that returns a custom validity message when applicable.
21
- *
22
- * This message will be applied to the element returned by `getValidityTarget`.
23
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity
21
+ * The callback to run when the input should be validated.
24
22
  */
25
- customValidator?: () => string | void;
23
+ onValidate?: () => void;
24
+ customValidity?: ValidatedControlProps<unknown>["customValidity"];
26
25
  /**
27
26
  * A function that returns the actual element on which the validity data should be applied.
28
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"control-with-error.d.ts","sourceRoot":"","sources":["../../src/validated-form-controls/control-with-error.tsx"],"names":[],"mappings":"AA6CA;;;;;;;GAOG;AACH,KAAK,cAAc,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,CAAC;AA4IvB,eAAO,MAAM,gBAAgB;IAlI3B;;OAEG;eACQ,OAAO;IAClB;;OAEG;uBACgB,OAAO;IAC1B;;;;;OAKG;sBACe,MAAM,MAAM,GAAG,IAAI;IACrC;;OAEG;uBACgB,MAAM,cAAc,GAAG,IAAI,GAAG,SAAS;IAC1D;;OAEG;;kDA6GoE,CAAC"}
1
+ {"version":3,"file":"control-with-error.d.ts","sourceRoot":"","sources":["../../src/validated-form-controls/control-with-error.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAyBhE;;;;;;;GAOG;AACH,KAAK,cAAc,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,CAAC;AAgMvB,eAAO,MAAM,gBAAgB;IArL3B;;OAEG;eACQ,OAAO;IAClB;;OAEG;uBACgB,OAAO;IAC1B;;OAEG;iBACU,MAAM,IAAI;qBACN,qBAAqB,CAAE,OAAO,CAAE,CAAE,gBAAgB,CAAE;IACrE;;OAEG;uBACgB,MAAM,cAAc,GAAG,IAAI,GAAG,SAAS;IAC1D;;OAEG;;kDAkKoE,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function ValidityIndicator({ type, message, }: {
2
+ type: 'validating' | 'valid' | 'invalid';
3
+ message?: string;
4
+ }): import("react").JSX.Element;
5
+ //# sourceMappingURL=validity-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validity-indicator.d.ts","sourceRoot":"","sources":["../../src/validated-form-controls/validity-indicator.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,iBAAiB,CAAE,EAClC,IAAI,EACJ,OAAO,GACP,EAAE;IACF,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,+BAyBA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/view/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAW5B,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,IAAI,CAAwB,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/view/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAY5B,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,IAAI,CAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/z-stack/stories/index.story.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOtD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,MAAM,CAa9B,CAAC;AACF,eAAe,IAAI,CAAC;AAsCpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,MAAM,CAAwB,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/z-stack/stories/index.story.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOtD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,MAAM,CAc9B,CAAC;AACF,eAAe,IAAI,CAAC;AAsCpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,MAAM,CAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "30.1.0",
3
+ "version": "30.2.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -41,26 +41,26 @@
41
41
  "@emotion/styled": "^11.6.0",
42
42
  "@emotion/utils": "^1.0.0",
43
43
  "@floating-ui/react-dom": "2.0.8",
44
- "@types/gradient-parser": "0.1.3",
44
+ "@types/gradient-parser": "1.1.0",
45
45
  "@types/highlight-words-core": "1.2.1",
46
46
  "@use-gesture/react": "^10.3.1",
47
- "@wordpress/a11y": "^4.28.0",
48
- "@wordpress/compose": "^7.28.0",
49
- "@wordpress/date": "^5.28.0",
50
- "@wordpress/deprecated": "^4.28.0",
51
- "@wordpress/dom": "^4.28.0",
52
- "@wordpress/element": "^6.28.0",
53
- "@wordpress/escape-html": "^3.28.0",
54
- "@wordpress/hooks": "^4.28.0",
55
- "@wordpress/html-entities": "^4.28.0",
56
- "@wordpress/i18n": "^6.1.0",
57
- "@wordpress/icons": "^10.28.0",
58
- "@wordpress/is-shallow-equal": "^5.28.0",
59
- "@wordpress/keycodes": "^4.28.0",
60
- "@wordpress/primitives": "^4.28.0",
61
- "@wordpress/private-apis": "^1.28.0",
62
- "@wordpress/rich-text": "^7.28.0",
63
- "@wordpress/warning": "^3.28.0",
47
+ "@wordpress/a11y": "^4.29.0",
48
+ "@wordpress/compose": "^7.29.0",
49
+ "@wordpress/date": "^5.29.0",
50
+ "@wordpress/deprecated": "^4.29.0",
51
+ "@wordpress/dom": "^4.29.0",
52
+ "@wordpress/element": "^6.29.0",
53
+ "@wordpress/escape-html": "^3.29.0",
54
+ "@wordpress/hooks": "^4.29.0",
55
+ "@wordpress/html-entities": "^4.29.0",
56
+ "@wordpress/i18n": "^6.2.0",
57
+ "@wordpress/icons": "^10.29.0",
58
+ "@wordpress/is-shallow-equal": "^5.29.0",
59
+ "@wordpress/keycodes": "^4.29.0",
60
+ "@wordpress/primitives": "^4.29.0",
61
+ "@wordpress/private-apis": "^1.29.0",
62
+ "@wordpress/rich-text": "^7.29.0",
63
+ "@wordpress/warning": "^3.29.0",
64
64
  "change-case": "^4.1.2",
65
65
  "clsx": "^2.1.1",
66
66
  "colord": "^2.7.0",
@@ -68,7 +68,7 @@
68
68
  "deepmerge": "^4.3.0",
69
69
  "fast-deep-equal": "^3.1.3",
70
70
  "framer-motion": "^11.1.9",
71
- "gradient-parser": "1.0.2",
71
+ "gradient-parser": "1.1.1",
72
72
  "highlight-words-core": "^1.2.2",
73
73
  "is-plain-object": "^5.0.0",
74
74
  "memize": "^2.1.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "28cc2098f5ee28f89096b638533796538f495f72"
89
+ "gitHead": "445ede01e8abc8e49a1101b21a3651adbe852120"
90
90
  }
@@ -80,9 +80,9 @@
80
80
  &[aria-disabled="true"]:enabled, // This catches a situation where a Button is aria-disabled, but not disabled.
81
81
  &[aria-disabled="true"]:active:enabled {
82
82
  // TODO: Prepare for theming (https://github.com/WordPress/gutenberg/pull/45466/files#r1030872724)
83
- color: rgba($white, 0.4);
84
- background: $components-color-accent;
85
- border-color: $components-color-accent;
83
+ color: $components-color-foreground-inverted;
84
+ background: $components-color-gray-300;
85
+ border-color: $components-color-gray-300;
86
86
  outline: none;
87
87
 
88
88
  &:focus:enabled {
@@ -1,9 +1,9 @@
1
1
  /* Root of the component. */
2
2
  // Internal variables
3
3
  $wp-components-calendar-outline-focus: var(--wp-admin-border-width-focus) solid $components-color-accent;
4
- $wp-components-calendar-button-height: 2rem;
5
- $wp-components-calendar-button-width: 2rem;
6
- $wp-components-calendar-nav-height: 2rem;
4
+ $wp-components-calendar-button-height: $grid-unit-40;
5
+ $wp-components-calendar-button-width: $grid-unit-40;
6
+ $wp-components-calendar-nav-height: $grid-unit-40;
7
7
  $wp-components-calendar-range-middle-background-color: color-mix(in srgb, $components-color-accent 4%, transparent);
8
8
  $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-color-accent 16%, transparent);
9
9
 
@@ -13,10 +13,10 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
13
13
  position: relative; /* Required to position the navigation toolbar. */
14
14
  box-sizing: border-box;
15
15
  display: inline flow-root;
16
- color: $gray-900;
17
- background-color: $white;
18
- font-size: 13px;
19
- font-weight: 400;
16
+ color: $components-color-foreground;
17
+ background-color: $components-color-background;
18
+ font-size: $font-size-medium;
19
+ font-weight: $font-weight-regular;
20
20
  z-index: 0; // Create a stacking context and render on top of the background.
21
21
 
22
22
  *,
@@ -35,7 +35,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
35
35
  // date follows the same color as the button's text, since the button
36
36
  // inherits its text color.
37
37
  &:has(.components-calendar__day-button:disabled) {
38
- color: $gray-600;
38
+ color: $components-color-disabled;
39
39
  }
40
40
  &:has(.components-calendar__day-button:hover:not(:disabled)),
41
41
  &:has(.components-calendar__day-button:focus-visible) {
@@ -57,7 +57,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
57
57
  height: $wp-components-calendar-button-height;
58
58
 
59
59
  border: none;
60
- border-radius: 2px;
60
+ border-radius: $radius-small;
61
61
 
62
62
  font: inherit;
63
63
  font-variant-numeric: tabular-nums;
@@ -73,7 +73,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
73
73
  z-index: -1;
74
74
  inset: 0;
75
75
  border: none; // No default border to avoid polluting high-contrast mode.
76
- border-radius: 2px;
76
+ border-radius: $radius-small;
77
77
  }
78
78
 
79
79
  // Use the button's ::after to show the selection preview.
@@ -117,7 +117,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
117
117
  .components-calendar__button-next,
118
118
  .components-calendar__button-previous {
119
119
  border: none;
120
- border-radius: 2px;
120
+ border-radius: $radius-small;
121
121
  background: none;
122
122
  padding: 0;
123
123
  margin: 0;
@@ -139,7 +139,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
139
139
  &[aria-disabled="true"] {
140
140
  cursor: revert;
141
141
 
142
- color: $gray-600;
142
+ color: $components-color-disabled;
143
143
  }
144
144
 
145
145
  &:focus-visible {
@@ -150,8 +150,8 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
150
150
  .components-calendar__chevron {
151
151
  display: inline-block;
152
152
  fill: currentColor;
153
- width: 16px;
154
- height: 16px;
153
+ width: $grid-unit-20;
154
+ height: $grid-unit-20;
155
155
  }
156
156
 
157
157
  .components-calendar[dir="rtl"]
@@ -167,7 +167,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
167
167
  align-content: center;
168
168
 
169
169
  height: $wp-components-calendar-nav-height;
170
- margin-bottom: 12px;
170
+ margin-bottom: $grid-unit-15;
171
171
  }
172
172
 
173
173
  .components-calendar__months {
@@ -175,13 +175,13 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
175
175
  display: flex;
176
176
  justify-content: center;
177
177
  flex-wrap: wrap;
178
- gap: 1rem;
178
+ gap: $grid-unit-20;
179
179
  max-width: fit-content;
180
180
  }
181
181
 
182
182
  .components-calendar__month-grid {
183
183
  border-collapse: separate;
184
- border-spacing: 0 4px;
184
+ border-spacing: 0 $grid-unit-05;
185
185
  }
186
186
 
187
187
  .components-calendar__nav {
@@ -202,7 +202,7 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
202
202
  height: $wp-components-calendar-button-height;
203
203
  padding: 0;
204
204
 
205
- color: $gray-700;
205
+ color: $components-color-gray-700;
206
206
  text-align: center;
207
207
  text-transform: uppercase;
208
208
  }
@@ -227,12 +227,12 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
227
227
  .components-calendar__day-button,
228
228
  .components-calendar__day-button:hover:not(:disabled)
229
229
  ) {
230
- color: $white;
230
+ color: $components-color-foreground-inverted;
231
231
  }
232
232
 
233
233
  .components-calendar__day-button {
234
234
  &::before {
235
- background-color: $gray-900;
235
+ background-color: $components-color-foreground;
236
236
  // Render a transparent border to highlight the selected day in
237
237
  // forced-colors (high-contrast) mode, since the background is not
238
238
  // visible.
@@ -240,11 +240,11 @@ $wp-components-calendar-preview-border-color: color-mix(in srgb, $components-col
240
240
  }
241
241
 
242
242
  &:disabled::before {
243
- background-color: $gray-600;
243
+ background-color: $components-color-disabled;
244
244
  }
245
245
 
246
246
  &:hover:not(:disabled)::before {
247
- background-color: $gray-800;
247
+ background-color: $components-color-gray-800;
248
248
  }
249
249
  }
250
250
  }
@@ -16,13 +16,14 @@ import { ConfirmDialog } from '../component';
16
16
 
17
17
  const meta: Meta< typeof ConfirmDialog > = {
18
18
  component: ConfirmDialog,
19
- title: 'Components (Experimental)/Overlays/ConfirmDialog',
20
- id: 'components-experimental-confirmdialog',
19
+ title: 'Components/Overlays/ConfirmDialog',
20
+ id: 'components-confirmdialog',
21
21
  argTypes: {
22
22
  isOpen: {
23
23
  control: false,
24
24
  },
25
25
  },
26
+ tags: [ 'status-experimental' ],
26
27
  parameters: {
27
28
  actions: { argTypesRegex: '^on.*' },
28
29
  controls: {
@@ -13,6 +13,17 @@ export function serializeGradientColor( {
13
13
  if ( type === 'hex' ) {
14
14
  return `#${ value }`;
15
15
  }
16
+ if ( type === 'var' ) {
17
+ return `var(${ value })`;
18
+ }
19
+ if ( type === 'hsl' ) {
20
+ const [ hue, saturation, lightness ] = value;
21
+ return `hsl(${ hue },${ saturation }%,${ lightness }%)`;
22
+ }
23
+ if ( type === 'hsla' ) {
24
+ const [ hue, saturation, lightness, alpha ] = value;
25
+ return `hsla(${ hue },${ saturation }%,${ lightness }%,${ alpha })`;
26
+ }
16
27
  return `${ type }(${ value.join( ',' ) })`;
17
28
  }
18
29
 
@@ -23,6 +34,9 @@ export function serializeGradientPosition(
23
34
  return '';
24
35
  }
25
36
  const { value, type } = position;
37
+ if ( type === 'calc' ) {
38
+ return `calc(${ value })`;
39
+ }
26
40
  return `${ value }${ type }`;
27
41
  }
28
42
 
@@ -24,6 +24,27 @@ describe( 'It should serialize a gradient', () => {
24
24
  value: [ '255', '0', '0' ],
25
25
  } )
26
26
  ).toBe( 'rgb(255,0,0)' );
27
+
28
+ expect(
29
+ serializeGradientColor( {
30
+ type: 'hsl',
31
+ value: [ '1', '2', '3' ],
32
+ } )
33
+ ).toBe( 'hsl(1,2%,3%)' );
34
+
35
+ expect(
36
+ serializeGradientColor( {
37
+ type: 'hsla',
38
+ value: [ '1', '2', '3', '0.5' ],
39
+ } )
40
+ ).toBe( 'hsla(1,2%,3%,0.5)' );
41
+
42
+ expect(
43
+ serializeGradientColor( {
44
+ type: 'var',
45
+ value: '--my-color',
46
+ } as any )
47
+ ).toBe( 'var(--my-color)' );
27
48
  } );
28
49
 
29
50
  test( 'serializeGradientPosition', () => {
@@ -38,6 +59,10 @@ describe( 'It should serialize a gradient', () => {
38
59
  expect( serializeGradientPosition( { type: 'px', value: '4' } ) ).toBe(
39
60
  '4px'
40
61
  );
62
+
63
+ expect(
64
+ serializeGradientPosition( { type: 'calc', value: '50% + 10px' } )
65
+ ).toBe( 'calc(50% + 10px)' );
41
66
  } );
42
67
 
43
68
  test( 'serializeGradientColorStop', () => {
@@ -108,9 +108,19 @@ export function getStopCssColor( colorStop: gradientParser.ColorStop ) {
108
108
  return `#${ colorStop.value }`;
109
109
  case 'literal':
110
110
  return colorStop.value;
111
+ case 'var':
112
+ return `${ colorStop.type }(${ colorStop.value })`;
111
113
  case 'rgb':
112
114
  case 'rgba':
113
115
  return `${ colorStop.type }(${ colorStop.value.join( ',' ) })`;
116
+ case 'hsl': {
117
+ const [ hue, saturation, lightness ] = colorStop.value;
118
+ return `hsl(${ hue },${ saturation }%,${ lightness }%)`;
119
+ }
120
+ case 'hsla': {
121
+ const [ hue, saturation, lightness, alpha ] = colorStop.value;
122
+ return `hsla(${ hue },${ saturation }%,${ lightness }%,${ alpha })`;
123
+ }
114
124
  default:
115
125
  // Should be unreachable if passing an AST from gradient-parser.
116
126
  // See https://github.com/rafaelcaricio/gradient-parser#ast.
@@ -33,13 +33,14 @@ import type { DatePickerProps } from '../types';
33
33
  import {
34
34
  Wrapper,
35
35
  Navigator,
36
+ ViewPreviousMonthButton,
37
+ ViewNextMonthButton,
36
38
  NavigatorHeading,
37
39
  Calendar,
38
40
  DayOfWeek,
39
41
  DayButton,
40
42
  } from './styles';
41
43
  import { inputToDate } from '../utils';
42
- import Button from '../../button';
43
44
  import { TIMEZONELESS_FORMAT } from '../constants';
44
45
 
45
46
  /**
@@ -111,7 +112,7 @@ export function DatePicker( {
111
112
  aria-label={ __( 'Calendar' ) }
112
113
  >
113
114
  <Navigator>
114
- <Button
115
+ <ViewPreviousMonthButton
115
116
  icon={ isRTL() ? arrowRight : arrowLeft }
116
117
  variant="tertiary"
117
118
  aria-label={ __( 'View previous month' ) }
@@ -137,7 +138,7 @@ export function DatePicker( {
137
138
  </strong>{ ' ' }
138
139
  { dateI18n( 'Y', viewing, -viewing.getTimezoneOffset() ) }
139
140
  </NavigatorHeading>
140
- <Button
141
+ <ViewNextMonthButton
141
142
  icon={ isRTL() ? arrowLeft : arrowRight }
142
143
  variant="tertiary"
143
144
  aria-label={ __( 'View next month' ) }
@@ -17,12 +17,25 @@ export const Wrapper = styled.div`
17
17
  `;
18
18
 
19
19
  export const Navigator = styled( HStack )`
20
+ column-gap: ${ space( 2 ) };
21
+ display: grid;
22
+ grid-template-columns: 0.5fr repeat( 5, 1fr ) 0.5fr;
23
+ justify-items: center;
20
24
  margin-bottom: ${ space( 4 ) };
21
25
  `;
22
26
 
27
+ export const ViewPreviousMonthButton = styled( Button )`
28
+ grid-column: 1 / 2;
29
+ `;
30
+
31
+ export const ViewNextMonthButton = styled( Button )`
32
+ grid-column: 7 / 8;
33
+ `;
34
+
23
35
  export const NavigatorHeading = styled( Heading )`
24
36
  font-size: ${ CONFIG.fontSize };
25
37
  font-weight: ${ CONFIG.fontWeight };
38
+ grid-column: 2 / 7;
26
39
 
27
40
  strong {
28
41
  font-weight: ${ CONFIG.fontWeightHeading };
@@ -41,14 +54,6 @@ export const DayOfWeek = styled.div`
41
54
  color: ${ COLORS.theme.gray[ 700 ] };
42
55
  font-size: ${ CONFIG.fontSize };
43
56
  line-height: ${ CONFIG.fontLineHeightBase };
44
-
45
- &:nth-of-type( 1 ) {
46
- justify-self: start;
47
- }
48
-
49
- &:nth-of-type( 7 ) {
50
- justify-self: end;
51
- }
52
57
  `;
53
58
 
54
59
  export const DayButton = styled( Button, {
@@ -64,18 +69,6 @@ export const DayButton = styled( Button, {
64
69
  position: relative;
65
70
  justify-content: center;
66
71
 
67
- ${ ( props ) =>
68
- props.column === 1 &&
69
- `
70
- justify-self: start;
71
- ` }
72
-
73
- ${ ( props ) =>
74
- props.column === 7 &&
75
- `
76
- justify-self: end;
77
- ` }
78
-
79
72
  ${ ( props ) =>
80
73
  props.disabled &&
81
74
  `