@wordpress/components 30.9.1-next.8b30e05b0.0 → 31.0.1-next.6deb34194.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 (214) hide show
  1. package/CHANGELOG.md +25 -4
  2. package/build/alignment-matrix-control/cell.js +131 -3
  3. package/build/alignment-matrix-control/cell.js.map +4 -4
  4. package/build/alignment-matrix-control/index.js +134 -6
  5. package/build/alignment-matrix-control/index.js.map +3 -3
  6. package/build/angle-picker-control/angle-circle.js +119 -15
  7. package/build/angle-picker-control/angle-circle.js.map +4 -4
  8. package/build/angle-picker-control/index.js +12 -7
  9. package/build/angle-picker-control/index.js.map +3 -3
  10. package/build/dropdown-menu/index.js +1 -1
  11. package/build/dropdown-menu/index.js.map +2 -2
  12. package/build/menu/styles.js +17 -17
  13. package/build/menu/styles.js.map +2 -2
  14. package/build/menu-item/index.js +1 -1
  15. package/build/menu-item/index.js.map +2 -2
  16. package/build/notice/index.js +1 -1
  17. package/build/notice/index.js.map +2 -2
  18. package/build/snackbar/index.js +1 -1
  19. package/build/snackbar/index.js.map +1 -1
  20. package/build/validated-form-controls/components/checkbox-control.js +0 -10
  21. package/build/validated-form-controls/components/checkbox-control.js.map +2 -2
  22. package/build/validated-form-controls/components/combobox-control.js +1 -11
  23. package/build/validated-form-controls/components/combobox-control.js.map +2 -2
  24. package/build/validated-form-controls/components/custom-select-control.js +0 -10
  25. package/build/validated-form-controls/components/custom-select-control.js.map +2 -2
  26. package/build/validated-form-controls/components/form-token-field.js +2 -12
  27. package/build/validated-form-controls/components/form-token-field.js.map +2 -2
  28. package/build/validated-form-controls/components/input-control.js +0 -10
  29. package/build/validated-form-controls/components/input-control.js.map +2 -2
  30. package/build/validated-form-controls/components/number-control.js +0 -10
  31. package/build/validated-form-controls/components/number-control.js.map +2 -2
  32. package/build/validated-form-controls/components/radio-control.js +0 -10
  33. package/build/validated-form-controls/components/radio-control.js.map +2 -2
  34. package/build/validated-form-controls/components/range-control.js +0 -10
  35. package/build/validated-form-controls/components/range-control.js.map +2 -2
  36. package/build/validated-form-controls/components/select-control.js +0 -10
  37. package/build/validated-form-controls/components/select-control.js.map +2 -2
  38. package/build/validated-form-controls/components/text-control.js +0 -10
  39. package/build/validated-form-controls/components/text-control.js.map +2 -2
  40. package/build/validated-form-controls/components/textarea-control.js +0 -10
  41. package/build/validated-form-controls/components/textarea-control.js.map +2 -2
  42. package/build/validated-form-controls/components/toggle-control.js +0 -10
  43. package/build/validated-form-controls/components/toggle-control.js.map +2 -2
  44. package/build/validated-form-controls/components/toggle-group-control.js +0 -10
  45. package/build/validated-form-controls/components/toggle-group-control.js.map +2 -2
  46. package/build/validated-form-controls/control-with-error.js +53 -58
  47. package/build/validated-form-controls/control-with-error.js.map +2 -2
  48. package/build-module/alignment-matrix-control/cell.js +131 -3
  49. package/build-module/alignment-matrix-control/cell.js.map +3 -3
  50. package/build-module/alignment-matrix-control/index.js +134 -6
  51. package/build-module/alignment-matrix-control/index.js.map +3 -3
  52. package/build-module/angle-picker-control/angle-circle.js +109 -15
  53. package/build-module/angle-picker-control/angle-circle.js.map +3 -3
  54. package/build-module/angle-picker-control/index.js +12 -7
  55. package/build-module/angle-picker-control/index.js.map +2 -2
  56. package/build-module/dropdown-menu/index.js +1 -1
  57. package/build-module/dropdown-menu/index.js.map +2 -2
  58. package/build-module/menu/styles.js +17 -17
  59. package/build-module/menu/styles.js.map +2 -2
  60. package/build-module/menu-item/index.js +1 -1
  61. package/build-module/menu-item/index.js.map +2 -2
  62. package/build-module/notice/index.js +1 -1
  63. package/build-module/notice/index.js.map +2 -2
  64. package/build-module/snackbar/index.js +1 -1
  65. package/build-module/snackbar/index.js.map +1 -1
  66. package/build-module/validated-form-controls/components/checkbox-control.js +0 -10
  67. package/build-module/validated-form-controls/components/checkbox-control.js.map +2 -2
  68. package/build-module/validated-form-controls/components/combobox-control.js +1 -11
  69. package/build-module/validated-form-controls/components/combobox-control.js.map +2 -2
  70. package/build-module/validated-form-controls/components/custom-select-control.js +0 -10
  71. package/build-module/validated-form-controls/components/custom-select-control.js.map +2 -2
  72. package/build-module/validated-form-controls/components/form-token-field.js +2 -12
  73. package/build-module/validated-form-controls/components/form-token-field.js.map +2 -2
  74. package/build-module/validated-form-controls/components/input-control.js +0 -10
  75. package/build-module/validated-form-controls/components/input-control.js.map +2 -2
  76. package/build-module/validated-form-controls/components/number-control.js +0 -10
  77. package/build-module/validated-form-controls/components/number-control.js.map +2 -2
  78. package/build-module/validated-form-controls/components/radio-control.js +0 -10
  79. package/build-module/validated-form-controls/components/radio-control.js.map +2 -2
  80. package/build-module/validated-form-controls/components/range-control.js +0 -10
  81. package/build-module/validated-form-controls/components/range-control.js.map +2 -2
  82. package/build-module/validated-form-controls/components/select-control.js +0 -10
  83. package/build-module/validated-form-controls/components/select-control.js.map +2 -2
  84. package/build-module/validated-form-controls/components/text-control.js +0 -10
  85. package/build-module/validated-form-controls/components/text-control.js.map +2 -2
  86. package/build-module/validated-form-controls/components/textarea-control.js +0 -10
  87. package/build-module/validated-form-controls/components/textarea-control.js.map +2 -2
  88. package/build-module/validated-form-controls/components/toggle-control.js +0 -10
  89. package/build-module/validated-form-controls/components/toggle-control.js.map +2 -2
  90. package/build-module/validated-form-controls/components/toggle-group-control.js +0 -10
  91. package/build-module/validated-form-controls/components/toggle-group-control.js.map +2 -2
  92. package/build-module/validated-form-controls/control-with-error.js +53 -58
  93. package/build-module/validated-form-controls/control-with-error.js.map +2 -2
  94. package/build-style/style-rtl.css +21 -33
  95. package/build-style/style.css +21 -33
  96. package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
  97. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  98. package/build-types/angle-picker-control/angle-circle.d.ts +1 -1
  99. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  100. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  101. package/build-types/notice/index.d.ts.map +1 -1
  102. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  103. package/build-types/validated-form-controls/components/checkbox-control.d.ts +1 -1
  104. package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
  105. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -3
  106. package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -1
  107. package/build-types/validated-form-controls/components/custom-select-control.d.ts +1 -2
  108. package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -1
  109. package/build-types/validated-form-controls/components/form-token-field.d.ts +1 -2
  110. package/build-types/validated-form-controls/components/form-token-field.d.ts.map +1 -1
  111. package/build-types/validated-form-controls/components/input-control.d.ts +1 -2
  112. package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -1
  113. package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
  114. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  115. package/build-types/validated-form-controls/components/radio-control.d.ts +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 +1 -1
  118. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  119. package/build-types/validated-form-controls/components/select-control.d.ts +2 -3
  120. package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -1
  121. package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
  122. package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
  123. package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
  124. package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -1
  125. package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
  126. package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
  127. package/build-types/validated-form-controls/components/stories/overview.story.d.ts +7 -0
  128. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  129. package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
  130. package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
  131. package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
  132. package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
  133. package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
  134. package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
  135. package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
  136. package/build-types/validated-form-controls/components/text-control.d.ts +1 -1
  137. package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -1
  138. package/build-types/validated-form-controls/components/textarea-control.d.ts +1 -1
  139. package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -1
  140. package/build-types/validated-form-controls/components/toggle-control.d.ts +1 -1
  141. package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -1
  142. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +1 -1
  143. package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
  144. package/build-types/validated-form-controls/components/types.d.ts +1 -9
  145. package/build-types/validated-form-controls/components/types.d.ts.map +1 -1
  146. package/build-types/validated-form-controls/control-with-error.d.ts +4 -5
  147. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  148. package/package.json +20 -20
  149. package/src/alignment-matrix-control/cell.tsx +14 -3
  150. package/src/alignment-matrix-control/index.tsx +15 -6
  151. package/src/alignment-matrix-control/style.module.scss +84 -0
  152. package/src/angle-picker-control/angle-circle.tsx +27 -12
  153. package/src/angle-picker-control/index.tsx +8 -7
  154. package/src/angle-picker-control/style.module.scss +40 -0
  155. package/src/button/style.scss +1 -1
  156. package/src/dropdown-menu/index.tsx +1 -1
  157. package/src/dropdown-menu/style.scss +1 -1
  158. package/src/guide/style.scss +3 -3
  159. package/src/menu/styles.ts +2 -2
  160. package/src/menu-item/index.tsx +1 -1
  161. package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
  162. package/src/modal/style.scss +5 -5
  163. package/src/notice/index.tsx +53 -46
  164. package/src/notice/stories/index.story.tsx +17 -1
  165. package/src/notice/style.scss +3 -20
  166. package/src/snackbar/index.tsx +1 -1
  167. package/src/validated-form-controls/components/checkbox-control.tsx +1 -14
  168. package/src/validated-form-controls/components/combobox-control.tsx +1 -14
  169. package/src/validated-form-controls/components/custom-select-control.tsx +1 -19
  170. package/src/validated-form-controls/components/form-token-field.tsx +2 -15
  171. package/src/validated-form-controls/components/input-control.tsx +1 -14
  172. package/src/validated-form-controls/components/number-control.tsx +1 -16
  173. package/src/validated-form-controls/components/radio-control.tsx +2 -18
  174. package/src/validated-form-controls/components/range-control.tsx +1 -14
  175. package/src/validated-form-controls/components/select-control.tsx +1 -23
  176. package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +11 -20
  177. package/src/validated-form-controls/components/stories/combobox-control.story.tsx +8 -17
  178. package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +8 -17
  179. package/src/validated-form-controls/components/stories/form-token-field.story.tsx +14 -26
  180. package/src/validated-form-controls/components/stories/input-control.story.tsx +25 -50
  181. package/src/validated-form-controls/components/stories/number-control.story.tsx +10 -19
  182. package/src/validated-form-controls/components/stories/overview.mdx +3 -3
  183. package/src/validated-form-controls/components/stories/overview.story.tsx +94 -79
  184. package/src/validated-form-controls/components/stories/radio-control.story.tsx +11 -20
  185. package/src/validated-form-controls/components/stories/range-control.story.tsx +8 -17
  186. package/src/validated-form-controls/components/stories/select-control.story.tsx +9 -18
  187. package/src/validated-form-controls/components/stories/text-control.story.tsx +11 -17
  188. package/src/validated-form-controls/components/stories/textarea-control.story.tsx +12 -16
  189. package/src/validated-form-controls/components/stories/toggle-control.story.tsx +11 -20
  190. package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +8 -17
  191. package/src/validated-form-controls/components/text-control.tsx +1 -14
  192. package/src/validated-form-controls/components/textarea-control.tsx +1 -14
  193. package/src/validated-form-controls/components/toggle-control.tsx +1 -14
  194. package/src/validated-form-controls/components/toggle-group-control.tsx +1 -14
  195. package/src/validated-form-controls/components/types.ts +1 -9
  196. package/src/validated-form-controls/control-with-error.tsx +57 -84
  197. package/src/validated-form-controls/style.scss +7 -7
  198. package/src/validated-form-controls/test/control-with-error.tsx +66 -5
  199. package/tsconfig.json +1 -0
  200. package/tsconfig.tsbuildinfo +1 -1
  201. package/build/alignment-matrix-control/styles.js +0 -105
  202. package/build/alignment-matrix-control/styles.js.map +0 -7
  203. package/build/angle-picker-control/styles/angle-picker-control-styles.js +0 -88
  204. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +0 -7
  205. package/build-module/alignment-matrix-control/styles.js +0 -67
  206. package/build-module/alignment-matrix-control/styles.js.map +0 -7
  207. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +0 -50
  208. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +0 -7
  209. package/build-types/alignment-matrix-control/styles.d.ts +0 -21
  210. package/build-types/alignment-matrix-control/styles.d.ts.map +0 -1
  211. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +0 -18
  212. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +0 -1
  213. package/src/alignment-matrix-control/styles.ts +0 -113
  214. package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +0 -58
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validated-form-controls/components/select-control.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport SelectControl from '../../select-control';\n\n// Only support single value selection\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedSelectControl = ({\n required,\n onValidate,\n customValidity,\n onChange,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n const valueRef = useRef(restProps.value);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n onValidate: () => {\n return onValidate?.(valueRef.current);\n },\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(SelectControl, {\n __nextHasNoMarginBottom: true,\n __next40pxDefaultSize: true,\n ref: mergedRefs,\n onChange: value => {\n valueRef.current = value;\n onChange?.(value);\n },\n ...restProps\n })\n });\n};\nexport const ValidatedSelectControl = forwardRef(UnforwardedValidatedSelectControl);"],
5
- "mappings": ";AAGA,SAAS,YAAY,cAAc;AACnC,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,mBAAmB;AAG1B,SAAS,OAAO,YAAY;AAC5B,IAAM,oCAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,QAAM,WAAW,OAAO,UAAU,KAAK;AACvC,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAChB,aAAO,aAAa,SAAS,OAAO;AAAA,IACtC;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,eAAe;AAAA,MACzC,yBAAyB;AAAA,MACzB,uBAAuB;AAAA,MACvB,KAAK;AAAA,MACL,UAAU,WAAS;AACjB,iBAAS,UAAU;AACnB,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,yBAAyB,WAAW,iCAAiC;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport SelectControl from '../../select-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedSelectControl = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(SelectControl, {\n __nextHasNoMarginBottom: true,\n __next40pxDefaultSize: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedSelectControl = forwardRef(UnforwardedValidatedSelectControl);"],
5
+ "mappings": ";AAGA,SAAS,YAAY,cAAc;AACnC,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,mBAAmB;AAC1B,SAAS,OAAO,YAAY;AAC5B,IAAM,oCAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,eAAe;AAAA,MACzC,yBAAyB;AAAA,MACzB,uBAAuB;AAAA,MACvB,KAAK;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,yBAAyB,WAAW,iCAAiC;",
6
6
  "names": []
7
7
  }
@@ -6,31 +6,21 @@ import TextControl from "../../text-control";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  var UnforwardedValidatedTextControl = ({
8
8
  required,
9
- onValidate,
10
9
  customValidity,
11
- onChange,
12
10
  markWhenOptional,
13
11
  ...restProps
14
12
  }, forwardedRef) => {
15
13
  const validityTargetRef = useRef(null);
16
14
  const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
17
- const valueRef = useRef(restProps.value);
18
15
  return /* @__PURE__ */ _jsx(ControlWithError, {
19
16
  required,
20
17
  markWhenOptional,
21
- onValidate: () => {
22
- return onValidate?.(valueRef.current);
23
- },
24
18
  customValidity,
25
19
  getValidityTarget: () => validityTargetRef.current,
26
20
  children: /* @__PURE__ */ _jsx(TextControl, {
27
21
  __next40pxDefaultSize: true,
28
22
  __nextHasNoMarginBottom: true,
29
23
  ref: mergedRefs,
30
- onChange: (value) => {
31
- valueRef.current = value;
32
- onChange?.(value);
33
- },
34
24
  ...restProps
35
25
  })
36
26
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validated-form-controls/components/text-control.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport TextControl from '../../text-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedTextControl = ({\n required,\n onValidate,\n customValidity,\n onChange,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n const valueRef = useRef(restProps.value);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n onValidate: () => {\n return onValidate?.(valueRef.current);\n },\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(TextControl, {\n __next40pxDefaultSize: true,\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n onChange: value => {\n valueRef.current = value;\n onChange?.(value);\n },\n ...restProps\n })\n });\n};\nexport const ValidatedTextControl = forwardRef(UnforwardedValidatedTextControl);"],
5
- "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,iBAAiB;AACxB,SAAS,OAAO,YAAY;AAC5B,IAAM,kCAAkC,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,QAAM,WAAW,OAAO,UAAU,KAAK;AACvC,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAChB,aAAO,aAAa,SAAS,OAAO;AAAA,IACtC;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,aAAa;AAAA,MACvC,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,UAAU,WAAS;AACjB,iBAAS,UAAU;AACnB,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,uBAAuB,WAAW,+BAA+B;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport TextControl from '../../text-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedTextControl = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(TextControl, {\n __next40pxDefaultSize: true,\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedTextControl = forwardRef(UnforwardedValidatedTextControl);"],
5
+ "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,iBAAiB;AACxB,SAAS,OAAO,YAAY;AAC5B,IAAM,kCAAkC,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,aAAa;AAAA,MACvC,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,uBAAuB,WAAW,+BAA+B;",
6
6
  "names": []
7
7
  }
@@ -6,30 +6,20 @@ import TextareaControl from "../../textarea-control";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  var UnforwardedValidatedTextareaControl = ({
8
8
  required,
9
- onValidate,
10
9
  customValidity,
11
- onChange,
12
10
  markWhenOptional,
13
11
  ...restProps
14
12
  }, forwardedRef) => {
15
13
  const validityTargetRef = useRef(null);
16
14
  const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
17
- const valueRef = useRef(restProps.value);
18
15
  return /* @__PURE__ */ _jsx(ControlWithError, {
19
16
  required,
20
17
  markWhenOptional,
21
- onValidate: () => {
22
- return onValidate?.(valueRef.current);
23
- },
24
18
  customValidity,
25
19
  getValidityTarget: () => validityTargetRef.current,
26
20
  children: /* @__PURE__ */ _jsx(TextareaControl, {
27
21
  __nextHasNoMarginBottom: true,
28
22
  ref: mergedRefs,
29
- onChange: (value) => {
30
- valueRef.current = value;
31
- onChange?.(value);
32
- },
33
23
  ...restProps
34
24
  })
35
25
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validated-form-controls/components/textarea-control.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport TextareaControl from '../../textarea-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedTextareaControl = ({\n required,\n onValidate,\n customValidity,\n onChange,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n const valueRef = useRef(restProps.value);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n onValidate: () => {\n return onValidate?.(valueRef.current);\n },\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(TextareaControl, {\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n onChange: value => {\n valueRef.current = value;\n onChange?.(value);\n },\n ...restProps\n })\n });\n};\nexport const ValidatedTextareaControl = forwardRef(UnforwardedValidatedTextareaControl);"],
5
- "mappings": ";AAGA,SAAS,YAAY,cAAc;AACnC,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,qBAAqB;AAC5B,SAAS,OAAO,YAAY;AAC5B,IAAM,sCAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,QAAM,WAAW,OAAO,UAAU,KAAK;AACvC,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAChB,aAAO,aAAa,SAAS,OAAO;AAAA,IACtC;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,iBAAiB;AAAA,MAC3C,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,UAAU,WAAS;AACjB,iBAAS,UAAU;AACnB,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,2BAA2B,WAAW,mCAAmC;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport TextareaControl from '../../textarea-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedTextareaControl = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(TextareaControl, {\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedTextareaControl = forwardRef(UnforwardedValidatedTextareaControl);"],
5
+ "mappings": ";AAGA,SAAS,YAAY,cAAc;AACnC,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,qBAAqB;AAC5B,SAAS,OAAO,YAAY;AAC5B,IAAM,sCAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,iBAAiB;AAAA,MAC3C,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,2BAA2B,WAAW,mCAAmC;",
6
6
  "names": []
7
7
  }
@@ -6,15 +6,12 @@ import ToggleControl from "../../toggle-control";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  var UnforwardedValidatedToggleControl = ({
8
8
  required,
9
- onValidate,
10
9
  customValidity,
11
- onChange,
12
10
  markWhenOptional,
13
11
  ...restProps
14
12
  }, forwardedRef) => {
15
13
  const validityTargetRef = useRef(null);
16
14
  const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);
17
- const valueRef = useRef(restProps.checked);
18
15
  useEffect(() => {
19
16
  if (validityTargetRef.current) {
20
17
  validityTargetRef.current.required = required !== null && required !== void 0 ? required : false;
@@ -23,18 +20,11 @@ var UnforwardedValidatedToggleControl = ({
23
20
  return /* @__PURE__ */ _jsx(ControlWithError, {
24
21
  required,
25
22
  markWhenOptional,
26
- onValidate: () => {
27
- return onValidate?.(valueRef.current);
28
- },
29
23
  customValidity,
30
24
  getValidityTarget: () => validityTargetRef.current,
31
25
  children: /* @__PURE__ */ _jsx(ToggleControl, {
32
26
  __nextHasNoMarginBottom: true,
33
27
  ref: mergedRefs,
34
- onChange: (value) => {
35
- valueRef.current = value;
36
- onChange?.(value);
37
- },
38
28
  ...restProps
39
29
  })
40
30
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validated-form-controls/components/toggle-control.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport ToggleControl from '../../toggle-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n// TODO: Should we customize the default `missingValue` message? It says to \"check this box\".\n\nconst UnforwardedValidatedToggleControl = ({\n required,\n onValidate,\n customValidity,\n onChange,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n const valueRef = useRef(restProps.checked);\n\n // TODO: Upstream limitation - The `required` attribute is not passed down to the input,\n // so we need to set it manually.\n useEffect(() => {\n if (validityTargetRef.current) {\n validityTargetRef.current.required = required !== null && required !== void 0 ? required : false;\n }\n }, [required]);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n onValidate: () => {\n return onValidate?.(valueRef.current);\n },\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(ToggleControl, {\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n onChange: value => {\n valueRef.current = value;\n onChange?.(value);\n },\n ...restProps\n })\n });\n};\nexport const ValidatedToggleControl = forwardRef(UnforwardedValidatedToggleControl);"],
5
- "mappings": ";AAGA,SAAS,YAAY,QAAQ,iBAAiB;AAC9C,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,mBAAmB;AAC1B,SAAS,OAAO,YAAY;AAG5B,IAAM,oCAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AACjE,QAAM,WAAW,OAAO,UAAU,OAAO;AAIzC,YAAU,MAAM;AACd,QAAI,kBAAkB,SAAS;AAC7B,wBAAkB,QAAQ,WAAW,aAAa,QAAQ,aAAa,SAAS,WAAW;AAAA,IAC7F;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AACb,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAChB,aAAO,aAAa,SAAS,OAAO;AAAA,IACtC;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,eAAe;AAAA,MACzC,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,UAAU,WAAS;AACjB,iBAAS,UAAU;AACnB,mBAAW,KAAK;AAAA,MAClB;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,yBAAyB,WAAW,iCAAiC;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef, useEffect } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport ToggleControl from '../../toggle-control';\n\n// TODO: Should we customize the default `missingValue` message? It says to \"check this box\".\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedToggleControl = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const mergedRefs = useMergeRefs([forwardedRef, validityTargetRef]);\n\n // TODO: Upstream limitation - The `required` attribute is not passed down to the input,\n // so we need to set it manually.\n useEffect(() => {\n if (validityTargetRef.current) {\n validityTargetRef.current.required = required !== null && required !== void 0 ? required : false;\n }\n }, [required]);\n return /*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(ToggleControl, {\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedToggleControl = forwardRef(UnforwardedValidatedToggleControl);"],
5
+ "mappings": ";AAGA,SAAS,YAAY,QAAQ,iBAAiB;AAC9C,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,mBAAmB;AAG1B,SAAS,OAAO,YAAY;AAC5B,IAAM,oCAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,aAAa,aAAa,CAAC,cAAc,iBAAiB,CAAC;AAIjE,YAAU,MAAM;AACd,QAAI,kBAAkB,SAAS;AAC7B,wBAAkB,QAAQ,WAAW,aAAa,QAAQ,aAAa,SAAS,WAAW;AAAA,IAC7F;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AACb,SAAoB,qBAAK,kBAAkB;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB,MAAM,kBAAkB;AAAA,IAC3C,UAAuB,qBAAK,eAAe;AAAA,MACzC,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,yBAAyB,WAAW,iCAAiC;",
6
6
  "names": []
7
7
  }
@@ -5,33 +5,23 @@ import { ToggleGroupControl } from "../../toggle-group-control";
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  var UnforwardedValidatedToggleGroupControl = ({
7
7
  required,
8
- onValidate,
9
8
  customValidity,
10
- onChange,
11
9
  markWhenOptional,
12
10
  ...restProps
13
11
  }, forwardedRef) => {
14
12
  const validityTargetRef = useRef(null);
15
- const valueRef = useRef(restProps.value);
16
13
  const nameAttr = useId();
17
14
  return /* @__PURE__ */ _jsxs("div", {
18
15
  className: "components-validated-control__wrapper-with-error-delegate",
19
16
  children: [/* @__PURE__ */ _jsx(ControlWithError, {
20
17
  required,
21
18
  markWhenOptional,
22
- onValidate: () => {
23
- return onValidate?.(valueRef.current);
24
- },
25
19
  customValidity,
26
20
  getValidityTarget: () => validityTargetRef.current,
27
21
  children: /* @__PURE__ */ _jsx(ToggleGroupControl, {
28
22
  __nextHasNoMarginBottom: true,
29
23
  __next40pxDefaultSize: true,
30
24
  ref: forwardedRef,
31
- onChange: (value) => {
32
- valueRef.current = value;
33
- onChange?.(value);
34
- },
35
25
  ...restProps
36
26
  })
37
27
  }), /* @__PURE__ */ _jsx("input", {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validated-form-controls/components/toggle-group-control.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useId, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport { ToggleGroupControl } from '../../toggle-group-control';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst UnforwardedValidatedToggleGroupControl = ({\n required,\n onValidate,\n customValidity,\n onChange,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const valueRef = useRef(restProps.value);\n const nameAttr = useId();\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-validated-control__wrapper-with-error-delegate\",\n children: [/*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n onValidate: () => {\n return onValidate?.(valueRef.current);\n },\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(ToggleGroupControl, {\n __nextHasNoMarginBottom: true,\n __next40pxDefaultSize: true,\n ref: forwardedRef,\n onChange: value => {\n valueRef.current = value;\n onChange?.(value);\n },\n ...restProps\n })\n }), /*#__PURE__*/_jsx(\"input\", {\n className: \"components-validated-control__error-delegate\",\n type: \"radio\",\n ref: validityTargetRef,\n required: required,\n checked: restProps.value !== undefined,\n tabIndex: -1\n // A name attribute is needed for the `required` behavior to work.\n ,\n name: nameAttr,\n onChange: () => {},\n onFocus: e => {\n e.target.previousElementSibling?.querySelector('[data-active-item=\"true\"]')?.focus();\n }\n })]\n });\n};\nexport const ValidatedToggleGroupControl = forwardRef(UnforwardedValidatedToggleGroupControl);"],
5
- "mappings": ";AAGA,SAAS,YAAY,OAAO,cAAc;AAK1C,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,yCAAyC,CAAC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,WAAW,OAAO,UAAU,KAAK;AACvC,QAAM,WAAW,MAAM;AACvB,SAAoB,sBAAM,OAAO;AAAA,IAC/B,WAAW;AAAA,IACX,UAAU,CAAc,qBAAK,kBAAkB;AAAA,MAC7C;AAAA,MACA;AAAA,MACA,YAAY,MAAM;AAChB,eAAO,aAAa,SAAS,OAAO;AAAA,MACtC;AAAA,MACA;AAAA,MACA,mBAAmB,MAAM,kBAAkB;AAAA,MAC3C,UAAuB,qBAAK,oBAAoB;AAAA,QAC9C,yBAAyB;AAAA,QACzB,uBAAuB;AAAA,QACvB,KAAK;AAAA,QACL,UAAU,WAAS;AACjB,mBAAS,UAAU;AACnB,qBAAW,KAAK;AAAA,QAClB;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAAA,IACH,CAAC,GAAgB,qBAAK,SAAS;AAAA,MAC7B,WAAW;AAAA,MACX,MAAM;AAAA,MACN,KAAK;AAAA,MACL;AAAA,MACA,SAAS,UAAU,UAAU;AAAA,MAC7B,UAAU;AAAA,MAGV,MAAM;AAAA,MACN,UAAU,MAAM;AAAA,MAAC;AAAA,MACjB,SAAS,OAAK;AACZ,UAAE,OAAO,wBAAwB,cAAc,2BAA2B,GAAG,MAAM;AAAA,MACrF;AAAA,IACF,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAM,8BAA8B,WAAW,sCAAsC;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useId, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport { ToggleGroupControl } from '../../toggle-group-control';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst UnforwardedValidatedToggleGroupControl = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n const nameAttr = useId();\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-validated-control__wrapper-with-error-delegate\",\n children: [/*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(ToggleGroupControl, {\n __nextHasNoMarginBottom: true,\n __next40pxDefaultSize: true,\n ref: forwardedRef,\n ...restProps\n })\n }), /*#__PURE__*/_jsx(\"input\", {\n className: \"components-validated-control__error-delegate\",\n type: \"radio\",\n ref: validityTargetRef,\n required: required,\n checked: restProps.value !== undefined,\n tabIndex: -1\n // A name attribute is needed for the `required` behavior to work.\n ,\n name: nameAttr,\n onChange: () => {},\n onFocus: e => {\n e.target.previousElementSibling?.querySelector('[data-active-item=\"true\"]')?.focus();\n }\n })]\n });\n};\nexport const ValidatedToggleGroupControl = forwardRef(UnforwardedValidatedToggleGroupControl);"],
5
+ "mappings": ";AAGA,SAAS,YAAY,OAAO,cAAc;AAK1C,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,yCAAyC,CAAC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,WAAW,MAAM;AACvB,SAAoB,sBAAM,OAAO;AAAA,IAC/B,WAAW;AAAA,IACX,UAAU,CAAc,qBAAK,kBAAkB;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB,MAAM,kBAAkB;AAAA,MAC3C,UAAuB,qBAAK,oBAAoB;AAAA,QAC9C,yBAAyB;AAAA,QACzB,uBAAuB;AAAA,QACvB,KAAK;AAAA,QACL,GAAG;AAAA,MACL,CAAC;AAAA,IACH,CAAC,GAAgB,qBAAK,SAAS;AAAA,MAC7B,WAAW;AAAA,MACX,MAAM;AAAA,MACN,KAAK;AAAA,MACL;AAAA,MACA,SAAS,UAAU,UAAU;AAAA,MAC7B,UAAU;AAAA,MAGV,MAAM;AAAA,MACN,UAAU,MAAM;AAAA,MAAC;AAAA,MACjB,SAAS,OAAK;AACZ,UAAE,OAAO,wBAAwB,cAAc,2BAA2B,GAAG,MAAM;AAAA,MACrF;AAAA,IACF,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAM,8BAA8B,WAAW,sCAAsC;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,6 @@
1
1
  // packages/components/src/validated-form-controls/control-with-error.tsx
2
- import { usePrevious } from "@wordpress/compose";
3
2
  import { __ } from "@wordpress/i18n";
4
3
  import { cloneElement, forwardRef, useEffect, useState } from "@wordpress/element";
5
- import { withIgnoreIMEEvents } from "../utils/with-ignore-ime-events";
6
4
  import { ValidityIndicator } from "./validity-indicator";
7
5
  import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
8
6
  function appendRequiredIndicator(label, required, markWhenOptional) {
@@ -18,30 +16,28 @@ function appendRequiredIndicator(label, required, markWhenOptional) {
18
16
  }
19
17
  return label;
20
18
  }
19
+ var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible";
21
20
  function UnforwardedControlWithError({
22
21
  required,
23
22
  markWhenOptional,
24
- onValidate,
25
23
  customValidity,
26
24
  getValidityTarget,
27
25
  children
28
26
  }, forwardedRef) {
29
27
  const [errorMessage, setErrorMessage] = useState();
30
28
  const [statusMessage, setStatusMessage] = useState();
29
+ const [showMessage, setShowMessage] = useState(false);
31
30
  const [isTouched, setIsTouched] = useState(false);
32
- const previousCustomValidityType = usePrevious(customValidity?.type);
33
31
  useEffect(() => {
34
32
  const validityTarget = getValidityTarget();
35
- const showValidationMessage = () => setErrorMessage(validityTarget?.validationMessage);
36
- validityTarget?.addEventListener("invalid", showValidationMessage);
37
- return () => {
38
- validityTarget?.removeEventListener("invalid", showValidationMessage);
33
+ const handler = () => {
34
+ setShowMessage(true);
35
+ validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
39
36
  };
40
- });
37
+ validityTarget?.addEventListener("invalid", handler);
38
+ return () => validityTarget?.removeEventListener("invalid", handler);
39
+ }, [getValidityTarget]);
41
40
  useEffect(() => {
42
- if (!isTouched) {
43
- return;
44
- }
45
41
  const validityTarget = getValidityTarget();
46
42
  if (!customValidity?.type) {
47
43
  validityTarget?.setCustomValidity("");
@@ -51,20 +47,15 @@ function UnforwardedControlWithError({
51
47
  }
52
48
  switch (customValidity.type) {
53
49
  case "validating": {
54
- const timer = setTimeout(() => {
55
- validityTarget?.setCustomValidity("");
56
- setErrorMessage(void 0);
57
- setStatusMessage({
58
- type: "validating",
59
- message: customValidity.message
60
- });
61
- }, 1e3);
62
- return () => clearTimeout(timer);
50
+ validityTarget?.setCustomValidity("");
51
+ setErrorMessage(void 0);
52
+ setStatusMessage({
53
+ type: "validating",
54
+ message: customValidity.message
55
+ });
56
+ break;
63
57
  }
64
58
  case "valid": {
65
- if (previousCustomValidityType === "valid") {
66
- break;
67
- }
68
59
  validityTarget?.setCustomValidity("");
69
60
  setErrorMessage(validityTarget?.validationMessage);
70
61
  setStatusMessage({
@@ -81,51 +72,55 @@ function UnforwardedControlWithError({
81
72
  break;
82
73
  }
83
74
  }
84
- }, [isTouched, customValidity?.type, customValidity?.message, getValidityTarget, previousCustomValidityType]);
75
+ }, [customValidity, getValidityTarget]);
76
+ useEffect(() => {
77
+ if (!isTouched || showMessage) {
78
+ return;
79
+ }
80
+ if (customValidity?.type === "validating") {
81
+ const timer = setTimeout(() => {
82
+ setShowMessage(true);
83
+ }, 1e3);
84
+ return () => clearTimeout(timer);
85
+ }
86
+ setShowMessage(true);
87
+ }, [isTouched, customValidity?.type, showMessage]);
85
88
  const onBlur = (event) => {
86
89
  if (isTouched) {
87
90
  return;
88
91
  }
89
92
  if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
90
93
  setIsTouched(true);
91
- onValidate?.();
94
+ getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
92
95
  }
93
96
  };
94
- const onChange = (...args) => {
95
- children.props.onChange?.(...args);
96
- if (isTouched || errorMessage) {
97
- onValidate?.();
97
+ const message = () => {
98
+ if (errorMessage) {
99
+ return /* @__PURE__ */ _jsx(ValidityIndicator, {
100
+ type: "invalid",
101
+ message: errorMessage
102
+ });
98
103
  }
99
- };
100
- const onKeyDown = (event) => {
101
- if (event.key === "Enter") {
102
- onValidate?.();
104
+ if (statusMessage?.type) {
105
+ return /* @__PURE__ */ _jsx(ValidityIndicator, {
106
+ type: statusMessage.type,
107
+ message: statusMessage.message
108
+ });
103
109
  }
110
+ return null;
104
111
  };
105
- return (
106
- // Disable reason: Just listening to a bubbled event, not for interaction.
107
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
108
- /* @__PURE__ */ _jsxs("div", {
109
- className: "components-validated-control",
110
- ref: forwardedRef,
111
- onBlur,
112
- onKeyDown: withIgnoreIMEEvents(onKeyDown),
113
- children: [cloneElement(children, {
114
- label: appendRequiredIndicator(children.props.label, required, markWhenOptional),
115
- onChange,
116
- required
117
- }), /* @__PURE__ */ _jsxs("div", {
118
- "aria-live": "polite",
119
- children: [errorMessage && /* @__PURE__ */ _jsx(ValidityIndicator, {
120
- type: "invalid",
121
- message: errorMessage
122
- }), !errorMessage && statusMessage && /* @__PURE__ */ _jsx(ValidityIndicator, {
123
- type: statusMessage.type,
124
- message: statusMessage.message
125
- })]
126
- })]
127
- })
128
- );
112
+ return /* @__PURE__ */ _jsxs("div", {
113
+ className: "components-validated-control",
114
+ ref: forwardedRef,
115
+ onBlur,
116
+ children: [cloneElement(children, {
117
+ label: appendRequiredIndicator(children.props.label, required, markWhenOptional),
118
+ required
119
+ }), /* @__PURE__ */ _jsx("div", {
120
+ "aria-live": "polite",
121
+ children: showMessage && message()
122
+ })]
123
+ });
129
124
  }
130
125
  var ControlWithError = forwardRef(UnforwardedControlWithError);
131
126
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/validated-form-controls/control-with-error.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { cloneElement, forwardRef, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { ValidityIndicator } from './validity-indicator';\nimport { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nfunction appendRequiredIndicator(label, required, markWhenOptional) {\n if (required && !markWhenOptional) {\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [label, \" \", `(${__('Required')})`]\n });\n }\n if (!required && markWhenOptional) {\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [label, \" \", `(${__('Optional')})`]\n });\n }\n return label;\n}\n\n/**\n * HTML elements that support the Constraint Validation API.\n *\n * Here, we exclude HTMLButtonElement because although it does technically support the API,\n * normal buttons are actually exempted from any validation.\n * @see https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/willValidate\n */\n\nfunction UnforwardedControlWithError({\n required,\n markWhenOptional,\n onValidate,\n customValidity,\n getValidityTarget,\n children\n}, forwardedRef) {\n const [errorMessage, setErrorMessage] = useState();\n const [statusMessage, setStatusMessage] = useState();\n const [isTouched, setIsTouched] = useState(false);\n const previousCustomValidityType = usePrevious(customValidity?.type);\n\n // Ensure that error messages are visible after user attemps to submit a form\n // with multiple invalid fields.\n useEffect(() => {\n const validityTarget = getValidityTarget();\n const showValidationMessage = () => setErrorMessage(validityTarget?.validationMessage);\n validityTarget?.addEventListener('invalid', showValidationMessage);\n return () => {\n validityTarget?.removeEventListener('invalid', showValidationMessage);\n };\n });\n useEffect(() => {\n if (!isTouched) {\n return;\n }\n const validityTarget = getValidityTarget();\n if (!customValidity?.type) {\n validityTarget?.setCustomValidity('');\n setErrorMessage(validityTarget?.validationMessage);\n setStatusMessage(undefined);\n return;\n }\n switch (customValidity.type) {\n case 'validating':\n {\n // Wait before showing a validating state.\n const timer = setTimeout(() => {\n validityTarget?.setCustomValidity('');\n setErrorMessage(undefined);\n setStatusMessage({\n type: 'validating',\n message: customValidity.message\n });\n }, 1000);\n return () => clearTimeout(timer);\n }\n case 'valid':\n {\n // Ensures that we wait for any async responses before showing\n // a synchronously valid state.\n if (previousCustomValidityType === 'valid') {\n break;\n }\n validityTarget?.setCustomValidity('');\n setErrorMessage(validityTarget?.validationMessage);\n setStatusMessage({\n type: 'valid',\n message: customValidity.message\n });\n break;\n }\n case 'invalid':\n {\n var _customValidity$messa;\n validityTarget?.setCustomValidity((_customValidity$messa = customValidity.message) !== null && _customValidity$messa !== void 0 ? _customValidity$messa : '');\n setErrorMessage(validityTarget?.validationMessage);\n setStatusMessage(undefined);\n break;\n }\n }\n }, [isTouched, customValidity?.type, customValidity?.message, getValidityTarget, previousCustomValidityType]);\n const onBlur = event => {\n if (isTouched) {\n return;\n }\n\n // Only consider \"blurred from the component\" if focus has fully left the wrapping div.\n // This prevents unnecessary blurs from components with multiple focusable elements.\n if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {\n setIsTouched(true);\n onValidate?.();\n }\n };\n const onChange = (...args) => {\n children.props.onChange?.(...args);\n\n // Only validate incrementally if the field has blurred at least once,\n // or currently has an error message.\n if (isTouched || errorMessage) {\n onValidate?.();\n }\n };\n const onKeyDown = event => {\n // Ensures that custom validators are triggered when the user submits by pressing Enter,\n // without ever blurring the control.\n if (event.key === 'Enter') {\n onValidate?.();\n }\n };\n return (\n /*#__PURE__*/\n // Disable reason: Just listening to a bubbled event, not for interaction.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsxs(\"div\", {\n className: \"components-validated-control\",\n ref: forwardedRef,\n onBlur: onBlur,\n onKeyDown: withIgnoreIMEEvents(onKeyDown),\n children: [cloneElement(children, {\n label: appendRequiredIndicator(children.props.label, required, markWhenOptional),\n onChange,\n required\n }), /*#__PURE__*/_jsxs(\"div\", {\n \"aria-live\": \"polite\",\n children: [errorMessage && /*#__PURE__*/_jsx(ValidityIndicator, {\n type: \"invalid\",\n message: errorMessage\n }), !errorMessage && statusMessage && /*#__PURE__*/_jsx(ValidityIndicator, {\n type: statusMessage.type,\n message: statusMessage.message\n })]\n })]\n })\n );\n}\nexport const ControlWithError = forwardRef(UnforwardedControlWithError);"],
5
- "mappings": "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",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cloneElement, forwardRef, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { ValidityIndicator } from './validity-indicator';\nimport { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nfunction appendRequiredIndicator(label, required, markWhenOptional) {\n if (required && !markWhenOptional) {\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [label, \" \", `(${__('Required')})`]\n });\n }\n if (!required && markWhenOptional) {\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [label, \" \", `(${__('Optional')})`]\n });\n }\n return label;\n}\nconst VALIDITY_VISIBLE_ATTRIBUTE = 'data-validity-visible';\n\n/**\n * HTML elements that support the Constraint Validation API.\n *\n * Here, we exclude HTMLButtonElement because although it does technically support the API,\n * normal buttons are actually exempted from any validation.\n * @see https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/willValidate\n */\n\nfunction UnforwardedControlWithError({\n required,\n markWhenOptional,\n customValidity,\n getValidityTarget,\n children\n}, forwardedRef) {\n const [errorMessage, setErrorMessage] = useState();\n const [statusMessage, setStatusMessage] = useState();\n const [showMessage, setShowMessage] = useState(false);\n const [isTouched, setIsTouched] = useState(false);\n\n // Ensure that error messages are visible when an `invalid` event is triggered,\n // e.g. when a form is submitted or reportValidity() is called.\n useEffect(() => {\n const validityTarget = getValidityTarget();\n const handler = () => {\n setShowMessage(true);\n validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, '');\n };\n validityTarget?.addEventListener('invalid', handler);\n return () => validityTarget?.removeEventListener('invalid', handler);\n }, [getValidityTarget]);\n\n // Handle validity messages.\n useEffect(() => {\n const validityTarget = getValidityTarget();\n if (!customValidity?.type) {\n validityTarget?.setCustomValidity('');\n setErrorMessage(validityTarget?.validationMessage);\n setStatusMessage(undefined);\n return;\n }\n switch (customValidity.type) {\n case 'validating':\n {\n validityTarget?.setCustomValidity('');\n setErrorMessage(undefined);\n setStatusMessage({\n type: 'validating',\n message: customValidity.message\n });\n break;\n }\n case 'valid':\n {\n validityTarget?.setCustomValidity('');\n setErrorMessage(validityTarget?.validationMessage);\n setStatusMessage({\n type: 'valid',\n message: customValidity.message\n });\n break;\n }\n case 'invalid':\n {\n var _customValidity$messa;\n validityTarget?.setCustomValidity((_customValidity$messa = customValidity.message) !== null && _customValidity$messa !== void 0 ? _customValidity$messa : '');\n setErrorMessage(validityTarget?.validationMessage);\n setStatusMessage(undefined);\n break;\n }\n }\n }, [customValidity, getValidityTarget]);\n\n // Show messages if field has been touched (i.e. has blurred at least once),\n // or validation has been triggered by the consumer/user.\n useEffect(() => {\n if (!isTouched || showMessage) {\n return;\n }\n if (customValidity?.type === 'validating') {\n // Don't show validating indicators for quick calls that take less than 1 sec.\n const timer = setTimeout(() => {\n setShowMessage(true);\n }, 1000);\n return () => clearTimeout(timer);\n }\n setShowMessage(true);\n }, [isTouched, customValidity?.type, showMessage]);\n\n // Mark blurred fields as touched.\n const onBlur = event => {\n if (isTouched) {\n return;\n }\n\n // Only consider \"blurred from the component\" if focus has fully left the wrapping div.\n // This prevents unnecessary blurs from components with multiple focusable elements.\n if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {\n setIsTouched(true);\n getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, '');\n }\n };\n const message = () => {\n if (errorMessage) {\n return /*#__PURE__*/_jsx(ValidityIndicator, {\n type: \"invalid\",\n message: errorMessage\n });\n }\n if (statusMessage?.type) {\n return /*#__PURE__*/_jsx(ValidityIndicator, {\n type: statusMessage.type,\n message: statusMessage.message\n });\n }\n return null;\n };\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-validated-control\",\n ref: forwardedRef,\n onBlur: onBlur,\n children: [cloneElement(children, {\n label: appendRequiredIndicator(children.props.label, required, markWhenOptional),\n required\n }), /*#__PURE__*/_jsx(\"div\", {\n \"aria-live\": \"polite\",\n children: showMessage && message()\n })]\n });\n}\nexport const ControlWithError = forwardRef(UnforwardedControlWithError);"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
@@ -274,7 +274,7 @@
274
274
  height: 36px;
275
275
  align-items: center;
276
276
  box-sizing: border-box;
277
- padding: 6px 12px;
277
+ padding: 4px 12px;
278
278
  border-radius: 2px;
279
279
  color: var(--wp-components-color-foreground, #1e1e1e);
280
280
  }
@@ -1630,7 +1630,7 @@ body.is-dragging-components-draggable {
1630
1630
  }
1631
1631
  .components-dropdown-menu__menu .components-menu-item__button,
1632
1632
  .components-dropdown-menu__menu .components-menu-item__button.components-button {
1633
- min-height: 40px;
1633
+ min-height: 32px;
1634
1634
  height: auto;
1635
1635
  text-align: right;
1636
1636
  padding-right: 8px;
@@ -2033,7 +2033,7 @@ body.is-dragging-components-draggable {
2033
2033
  height: 36px;
2034
2034
  justify-content: center;
2035
2035
  margin: 0 0 24px 0;
2036
- padding: 0 32px;
2036
+ padding: 0 24px;
2037
2037
  position: relative;
2038
2038
  width: 100%;
2039
2039
  }
@@ -2069,10 +2069,10 @@ body.is-dragging-components-draggable {
2069
2069
  position: absolute;
2070
2070
  }
2071
2071
  .components-button.components-guide__back-button {
2072
- right: 32px;
2072
+ right: 24px;
2073
2073
  }
2074
2074
  .components-button.components-guide__forward-button, .components-button.components-guide__finish-button {
2075
- left: 32px;
2075
+ left: 24px;
2076
2076
  }
2077
2077
 
2078
2078
  [role=region] {
@@ -2355,12 +2355,12 @@ body.is-dragging-components-draggable {
2355
2355
  max-height: 70%;
2356
2356
  }
2357
2357
  }
2358
- .components-modal__frame.is-full-screen .components-modal__content {
2358
+ .components-modal__frame.is-full-screen :where(.components-modal__content) {
2359
2359
  display: flex;
2360
- margin-bottom: 32px;
2360
+ margin-bottom: 24px;
2361
2361
  padding-bottom: 0;
2362
2362
  }
2363
- .components-modal__frame.is-full-screen .components-modal__content > :last-child {
2363
+ .components-modal__frame.is-full-screen :where(.components-modal__content) > :last-child {
2364
2364
  flex: 1;
2365
2365
  }
2366
2366
 
@@ -2387,7 +2387,7 @@ body.is-dragging-components-draggable {
2387
2387
  .components-modal__header {
2388
2388
  box-sizing: border-box;
2389
2389
  border-bottom: 1px solid transparent;
2390
- padding: 24px 32px 8px;
2390
+ padding: 24px;
2391
2391
  display: flex;
2392
2392
  flex-direction: row;
2393
2393
  justify-content: space-between;
@@ -2434,12 +2434,12 @@ body.is-dragging-components-draggable {
2434
2434
  .components-modal__content {
2435
2435
  flex: 1;
2436
2436
  margin-top: 72px;
2437
- padding: 4px 32px 32px;
2437
+ padding: 4px 24px 24px;
2438
2438
  overflow: auto;
2439
2439
  }
2440
2440
  .components-modal__content.hide-header {
2441
2441
  margin-top: 0;
2442
- padding-top: 32px;
2442
+ padding-top: 24px;
2443
2443
  }
2444
2444
  .components-modal__content.is-scrollable:focus-visible {
2445
2445
  box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
@@ -2481,16 +2481,9 @@ body.is-dragging-components-draggable {
2481
2481
  .components-notice__actions {
2482
2482
  display: flex;
2483
2483
  flex-wrap: wrap;
2484
- }
2485
-
2486
- .components-notice__action.components-button, .components-notice__action.components-button.is-link {
2487
- margin-right: 12px;
2488
- }
2489
- .components-notice__action.components-button.is-secondary {
2490
- vertical-align: initial;
2491
- }
2492
- .components-notice__action.components-button {
2493
- margin-left: 8px;
2484
+ align-items: center;
2485
+ gap: 12px;
2486
+ margin-top: 12px;
2494
2487
  }
2495
2488
 
2496
2489
  .components-notice__dismiss {
@@ -2515,11 +2508,6 @@ body.is-dragging-components-draggable {
2515
2508
  margin-bottom: 12px;
2516
2509
  line-height: 2;
2517
2510
  }
2518
- .components-notice-list .components-notice__action.components-button {
2519
- display: block;
2520
- margin-right: 0;
2521
- margin-top: 8px;
2522
- }
2523
2511
 
2524
2512
  .components-panel {
2525
2513
  background: #fff;
@@ -3891,30 +3879,30 @@ div.components-toolbar > div + div.has-left-divider::before {
3891
3879
  margin-right: 8px;
3892
3880
  }
3893
3881
 
3894
- .components-validated-control:has(:is(input, select):user-invalid) .components-input-control__backdrop {
3882
+ .components-validated-control:has(:is(input, select):invalid[data-validity-visible]) .components-input-control__backdrop {
3895
3883
  --wp-components-color-accent: #cc1818;
3896
3884
  border-color: #cc1818;
3897
3885
  }
3898
- .components-validated-control :is(textarea, input[type=text]):user-invalid {
3886
+ .components-validated-control :is(textarea, input[type=text]):invalid[data-validity-visible] {
3899
3887
  --wp-admin-theme-color: #cc1818;
3900
3888
  --wp-components-color-accent: #cc1818;
3901
3889
  border-color: #cc1818;
3902
3890
  }
3903
- .components-validated-control .components-combobox-control__suggestions-container:has(input:user-invalid):not(:has([aria-expanded=true])) {
3904
- border-color: #cc1818;
3891
+ .components-validated-control .components-combobox-control__suggestions-container:has(input:invalid[data-validity-visible]):not(:has([aria-expanded=true])) {
3892
+ --wp-components-color-accent: #cc1818;
3905
3893
  }
3906
3894
 
3907
3895
  .components-validated-control__wrapper-with-error-delegate {
3908
3896
  position: relative;
3909
3897
  }
3910
- .components-validated-control__wrapper-with-error-delegate:has(select:user-invalid) .components-input-control__backdrop {
3898
+ .components-validated-control__wrapper-with-error-delegate:has(select:invalid[data-validity-visible]) .components-input-control__backdrop {
3911
3899
  --wp-components-color-accent: #cc1818;
3912
3900
  border-color: #cc1818;
3913
3901
  }
3914
- .components-validated-control__wrapper-with-error-delegate:has(input[type=radio]:invalid) {
3902
+ .components-validated-control__wrapper-with-error-delegate:has(input[type=radio]:invalid[data-validity-visible]) {
3915
3903
  --wp-components-color-accent: #cc1818;
3916
3904
  }
3917
- .components-validated-control__wrapper-with-error-delegate:has(input:user-invalid) .components-form-token-field__input-container:not(:has([aria-expanded=true])) {
3905
+ .components-validated-control__wrapper-with-error-delegate:has(input:invalid[data-validity-visible]) .components-form-token-field__input-container:not(:has([aria-expanded=true])) {
3918
3906
  --wp-components-color-accent: #cc1818;
3919
3907
  border-color: #cc1818;
3920
3908
  }