@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.
- package/CHANGELOG.md +25 -4
- package/build/alignment-matrix-control/cell.js +131 -3
- package/build/alignment-matrix-control/cell.js.map +4 -4
- package/build/alignment-matrix-control/index.js +134 -6
- package/build/alignment-matrix-control/index.js.map +3 -3
- package/build/angle-picker-control/angle-circle.js +119 -15
- package/build/angle-picker-control/angle-circle.js.map +4 -4
- package/build/angle-picker-control/index.js +12 -7
- package/build/angle-picker-control/index.js.map +3 -3
- package/build/dropdown-menu/index.js +1 -1
- package/build/dropdown-menu/index.js.map +2 -2
- package/build/menu/styles.js +17 -17
- package/build/menu/styles.js.map +2 -2
- package/build/menu-item/index.js +1 -1
- package/build/menu-item/index.js.map +2 -2
- package/build/notice/index.js +1 -1
- package/build/notice/index.js.map +2 -2
- package/build/snackbar/index.js +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/validated-form-controls/components/checkbox-control.js +0 -10
- package/build/validated-form-controls/components/checkbox-control.js.map +2 -2
- package/build/validated-form-controls/components/combobox-control.js +1 -11
- package/build/validated-form-controls/components/combobox-control.js.map +2 -2
- package/build/validated-form-controls/components/custom-select-control.js +0 -10
- package/build/validated-form-controls/components/custom-select-control.js.map +2 -2
- package/build/validated-form-controls/components/form-token-field.js +2 -12
- package/build/validated-form-controls/components/form-token-field.js.map +2 -2
- package/build/validated-form-controls/components/input-control.js +0 -10
- package/build/validated-form-controls/components/input-control.js.map +2 -2
- package/build/validated-form-controls/components/number-control.js +0 -10
- package/build/validated-form-controls/components/number-control.js.map +2 -2
- package/build/validated-form-controls/components/radio-control.js +0 -10
- package/build/validated-form-controls/components/radio-control.js.map +2 -2
- package/build/validated-form-controls/components/range-control.js +0 -10
- package/build/validated-form-controls/components/range-control.js.map +2 -2
- package/build/validated-form-controls/components/select-control.js +0 -10
- package/build/validated-form-controls/components/select-control.js.map +2 -2
- package/build/validated-form-controls/components/text-control.js +0 -10
- package/build/validated-form-controls/components/text-control.js.map +2 -2
- package/build/validated-form-controls/components/textarea-control.js +0 -10
- package/build/validated-form-controls/components/textarea-control.js.map +2 -2
- package/build/validated-form-controls/components/toggle-control.js +0 -10
- package/build/validated-form-controls/components/toggle-control.js.map +2 -2
- package/build/validated-form-controls/components/toggle-group-control.js +0 -10
- package/build/validated-form-controls/components/toggle-group-control.js.map +2 -2
- package/build/validated-form-controls/control-with-error.js +53 -58
- package/build/validated-form-controls/control-with-error.js.map +2 -2
- package/build-module/alignment-matrix-control/cell.js +131 -3
- package/build-module/alignment-matrix-control/cell.js.map +3 -3
- package/build-module/alignment-matrix-control/index.js +134 -6
- package/build-module/alignment-matrix-control/index.js.map +3 -3
- package/build-module/angle-picker-control/angle-circle.js +109 -15
- package/build-module/angle-picker-control/angle-circle.js.map +3 -3
- package/build-module/angle-picker-control/index.js +12 -7
- package/build-module/angle-picker-control/index.js.map +2 -2
- package/build-module/dropdown-menu/index.js +1 -1
- package/build-module/dropdown-menu/index.js.map +2 -2
- package/build-module/menu/styles.js +17 -17
- package/build-module/menu/styles.js.map +2 -2
- package/build-module/menu-item/index.js +1 -1
- package/build-module/menu-item/index.js.map +2 -2
- package/build-module/notice/index.js +1 -1
- package/build-module/notice/index.js.map +2 -2
- package/build-module/snackbar/index.js +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/validated-form-controls/components/checkbox-control.js +0 -10
- package/build-module/validated-form-controls/components/checkbox-control.js.map +2 -2
- package/build-module/validated-form-controls/components/combobox-control.js +1 -11
- package/build-module/validated-form-controls/components/combobox-control.js.map +2 -2
- package/build-module/validated-form-controls/components/custom-select-control.js +0 -10
- package/build-module/validated-form-controls/components/custom-select-control.js.map +2 -2
- package/build-module/validated-form-controls/components/form-token-field.js +2 -12
- package/build-module/validated-form-controls/components/form-token-field.js.map +2 -2
- package/build-module/validated-form-controls/components/input-control.js +0 -10
- package/build-module/validated-form-controls/components/input-control.js.map +2 -2
- package/build-module/validated-form-controls/components/number-control.js +0 -10
- package/build-module/validated-form-controls/components/number-control.js.map +2 -2
- package/build-module/validated-form-controls/components/radio-control.js +0 -10
- package/build-module/validated-form-controls/components/radio-control.js.map +2 -2
- package/build-module/validated-form-controls/components/range-control.js +0 -10
- package/build-module/validated-form-controls/components/range-control.js.map +2 -2
- package/build-module/validated-form-controls/components/select-control.js +0 -10
- package/build-module/validated-form-controls/components/select-control.js.map +2 -2
- package/build-module/validated-form-controls/components/text-control.js +0 -10
- package/build-module/validated-form-controls/components/text-control.js.map +2 -2
- package/build-module/validated-form-controls/components/textarea-control.js +0 -10
- package/build-module/validated-form-controls/components/textarea-control.js.map +2 -2
- package/build-module/validated-form-controls/components/toggle-control.js +0 -10
- package/build-module/validated-form-controls/components/toggle-control.js.map +2 -2
- package/build-module/validated-form-controls/components/toggle-group-control.js +0 -10
- package/build-module/validated-form-controls/components/toggle-group-control.js.map +2 -2
- package/build-module/validated-form-controls/control-with-error.js +53 -58
- package/build-module/validated-form-controls/control-with-error.js.map +2 -2
- package/build-style/style-rtl.css +21 -33
- package/build-style/style.css +21 -33
- package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts.map +1 -1
- package/build-types/notice/index.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -3
- package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/custom-select-control.d.ts +1 -2
- package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/form-token-field.d.ts +1 -2
- package/build-types/validated-form-controls/components/form-token-field.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/input-control.d.ts +1 -2
- package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/select-control.d.ts +2 -3
- package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts +7 -0
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/text-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/textarea-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/toggle-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/types.d.ts +1 -9
- package/build-types/validated-form-controls/components/types.d.ts.map +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts +4 -5
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/alignment-matrix-control/cell.tsx +14 -3
- package/src/alignment-matrix-control/index.tsx +15 -6
- package/src/alignment-matrix-control/style.module.scss +84 -0
- package/src/angle-picker-control/angle-circle.tsx +27 -12
- package/src/angle-picker-control/index.tsx +8 -7
- package/src/angle-picker-control/style.module.scss +40 -0
- package/src/button/style.scss +1 -1
- package/src/dropdown-menu/index.tsx +1 -1
- package/src/dropdown-menu/style.scss +1 -1
- package/src/guide/style.scss +3 -3
- package/src/menu/styles.ts +2 -2
- package/src/menu-item/index.tsx +1 -1
- package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
- package/src/modal/style.scss +5 -5
- package/src/notice/index.tsx +53 -46
- package/src/notice/stories/index.story.tsx +17 -1
- package/src/notice/style.scss +3 -20
- package/src/snackbar/index.tsx +1 -1
- package/src/validated-form-controls/components/checkbox-control.tsx +1 -14
- package/src/validated-form-controls/components/combobox-control.tsx +1 -14
- package/src/validated-form-controls/components/custom-select-control.tsx +1 -19
- package/src/validated-form-controls/components/form-token-field.tsx +2 -15
- package/src/validated-form-controls/components/input-control.tsx +1 -14
- package/src/validated-form-controls/components/number-control.tsx +1 -16
- package/src/validated-form-controls/components/radio-control.tsx +2 -18
- package/src/validated-form-controls/components/range-control.tsx +1 -14
- package/src/validated-form-controls/components/select-control.tsx +1 -23
- package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +11 -20
- package/src/validated-form-controls/components/stories/combobox-control.story.tsx +8 -17
- package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +8 -17
- package/src/validated-form-controls/components/stories/form-token-field.story.tsx +14 -26
- package/src/validated-form-controls/components/stories/input-control.story.tsx +25 -50
- package/src/validated-form-controls/components/stories/number-control.story.tsx +10 -19
- package/src/validated-form-controls/components/stories/overview.mdx +3 -3
- package/src/validated-form-controls/components/stories/overview.story.tsx +94 -79
- package/src/validated-form-controls/components/stories/radio-control.story.tsx +11 -20
- package/src/validated-form-controls/components/stories/range-control.story.tsx +8 -17
- package/src/validated-form-controls/components/stories/select-control.story.tsx +9 -18
- package/src/validated-form-controls/components/stories/text-control.story.tsx +11 -17
- package/src/validated-form-controls/components/stories/textarea-control.story.tsx +12 -16
- package/src/validated-form-controls/components/stories/toggle-control.story.tsx +11 -20
- package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +8 -17
- package/src/validated-form-controls/components/text-control.tsx +1 -14
- package/src/validated-form-controls/components/textarea-control.tsx +1 -14
- package/src/validated-form-controls/components/toggle-control.tsx +1 -14
- package/src/validated-form-controls/components/toggle-group-control.tsx +1 -14
- package/src/validated-form-controls/components/types.ts +1 -9
- package/src/validated-form-controls/control-with-error.tsx +57 -84
- package/src/validated-form-controls/style.scss +7 -7
- package/src/validated-form-controls/test/control-with-error.tsx +66 -5
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/alignment-matrix-control/styles.js +0 -105
- package/build/alignment-matrix-control/styles.js.map +0 -7
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +0 -88
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +0 -7
- package/build-module/alignment-matrix-control/styles.js +0 -67
- package/build-module/alignment-matrix-control/styles.js.map +0 -7
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +0 -50
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +0 -7
- package/build-types/alignment-matrix-control/styles.d.ts +0 -21
- package/build-types/alignment-matrix-control/styles.d.ts.map +0 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +0 -18
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +0 -1
- package/src/alignment-matrix-control/styles.ts +0 -113
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +0 -58
|
@@ -39,7 +39,7 @@ function UnforwardedMenuItem(props, ref) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return /* @__PURE__ */ _jsxs(Button, {
|
|
42
|
-
|
|
42
|
+
size: "compact",
|
|
43
43
|
ref,
|
|
44
44
|
"aria-checked": role === "menuitemcheckbox" || role === "menuitemradio" ? isSelected : void 0,
|
|
45
45
|
role,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/menu-item/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from '../shortcut';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedMenuItem(props, ref) {\n let {\n children,\n info,\n className,\n icon,\n iconPosition = 'right',\n shortcut,\n isSelected,\n role = 'menuitem',\n suffix,\n ...buttonProps\n } = props;\n className = clsx('components-menu-item__button', className);\n if (info) {\n children = /*#__PURE__*/_jsxs(\"span\", {\n className: \"components-menu-item__info-wrapper\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"components-menu-item__item\",\n children: children\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"components-menu-item__info\",\n children: info\n })]\n });\n }\n if (icon && typeof icon !== 'string') {\n icon = cloneElement(icon, {\n className: clsx('components-menu-items__item-icon', {\n 'has-icon-right': iconPosition === 'right'\n })\n });\n }\n return /*#__PURE__*/_jsxs(Button, {\n
|
|
5
|
-
"mappings": ";AAIA,OAAO,UAAU;AAKjB,SAAS,cAAc,kBAAkB;AAKzC,OAAO,cAAc;AACrB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,oBAAoB,OAAO,KAAK;AACvC,MAAI;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,cAAY,KAAK,gCAAgC,SAAS;AAC1D,MAAI,MAAM;AACR,eAAwB,sBAAM,QAAQ;AAAA,MACpC,WAAW;AAAA,MACX,UAAU,CAAc,qBAAK,QAAQ;AAAA,QACnC,WAAW;AAAA,QACX;AAAA,MACF,CAAC,GAAgB,qBAAK,QAAQ;AAAA,QAC5B,WAAW;AAAA,QACX,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH;AACA,MAAI,QAAQ,OAAO,SAAS,UAAU;AACpC,WAAO,aAAa,MAAM;AAAA,MACxB,WAAW,KAAK,oCAAoC;AAAA,QAClD,kBAAkB,iBAAiB;AAAA,MACrC,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,SAAoB,sBAAM,QAAQ;AAAA,IAChC,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneElement, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from '../shortcut';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedMenuItem(props, ref) {\n let {\n children,\n info,\n className,\n icon,\n iconPosition = 'right',\n shortcut,\n isSelected,\n role = 'menuitem',\n suffix,\n ...buttonProps\n } = props;\n className = clsx('components-menu-item__button', className);\n if (info) {\n children = /*#__PURE__*/_jsxs(\"span\", {\n className: \"components-menu-item__info-wrapper\",\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"components-menu-item__item\",\n children: children\n }), /*#__PURE__*/_jsx(\"span\", {\n className: \"components-menu-item__info\",\n children: info\n })]\n });\n }\n if (icon && typeof icon !== 'string') {\n icon = cloneElement(icon, {\n className: clsx('components-menu-items__item-icon', {\n 'has-icon-right': iconPosition === 'right'\n })\n });\n }\n return /*#__PURE__*/_jsxs(Button, {\n size: \"compact\",\n ref: ref\n // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked\n ,\n \"aria-checked\": role === 'menuitemcheckbox' || role === 'menuitemradio' ? isSelected : undefined,\n role: role,\n icon: iconPosition === 'left' ? icon : undefined,\n className: className,\n accessibleWhenDisabled: true,\n ...buttonProps,\n children: [/*#__PURE__*/_jsx(\"span\", {\n className: \"components-menu-item__item\",\n children: children\n }), !suffix && /*#__PURE__*/_jsx(Shortcut, {\n className: \"components-menu-item__shortcut\",\n shortcut: shortcut\n }), !suffix && icon && iconPosition === 'right' && /*#__PURE__*/_jsx(Icon, {\n icon: icon\n }), suffix]\n });\n}\n\n/**\n * MenuItem is a component which renders a button intended to be used in combination with the `DropdownMenu` component.\n *\n * ```jsx\n * import { MenuItem } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyMenuItem = () => {\n * \tconst [ isActive, setIsActive ] = useState( true );\n *\n * \treturn (\n * \t\t<MenuItem\n * \t\t\ticon={ isActive ? 'yes' : 'no' }\n * \t\t\tisSelected={ isActive }\n * \t\t\trole=\"menuitemcheckbox\"\n * \t\t\tonClick={ () => setIsActive( ( state ) => ! state ) }\n * \t\t>\n * \t\t\tToggle\n * \t\t</MenuItem>\n * \t);\n * };\n * ```\n */\nexport const MenuItem = forwardRef(UnforwardedMenuItem);\nexport default MenuItem;"],
|
|
5
|
+
"mappings": ";AAIA,OAAO,UAAU;AAKjB,SAAS,cAAc,kBAAkB;AAKzC,OAAO,cAAc;AACrB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,oBAAoB,OAAO,KAAK;AACvC,MAAI;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,cAAY,KAAK,gCAAgC,SAAS;AAC1D,MAAI,MAAM;AACR,eAAwB,sBAAM,QAAQ;AAAA,MACpC,WAAW;AAAA,MACX,UAAU,CAAc,qBAAK,QAAQ;AAAA,QACnC,WAAW;AAAA,QACX;AAAA,MACF,CAAC,GAAgB,qBAAK,QAAQ;AAAA,QAC5B,WAAW;AAAA,QACX,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH;AACA,MAAI,QAAQ,OAAO,SAAS,UAAU;AACpC,WAAO,aAAa,MAAM;AAAA,MACxB,WAAW,KAAK,oCAAoC;AAAA,QAClD,kBAAkB,iBAAiB;AAAA,MACrC,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,SAAoB,sBAAM,QAAQ;AAAA,IAChC,MAAM;AAAA,IACN;AAAA,IAGA,gBAAgB,SAAS,sBAAsB,SAAS,kBAAkB,aAAa;AAAA,IACvF;AAAA,IACA,MAAM,iBAAiB,SAAS,OAAO;AAAA,IACvC;AAAA,IACA,wBAAwB;AAAA,IACxB,GAAG;AAAA,IACH,UAAU,CAAc,qBAAK,QAAQ;AAAA,MACnC,WAAW;AAAA,MACX;AAAA,IACF,CAAC,GAAG,CAAC,UAAuB,qBAAK,UAAU;AAAA,MACzC,WAAW;AAAA,MACX;AAAA,IACF,CAAC,GAAG,CAAC,UAAU,QAAQ,iBAAiB,WAAwB,qBAAK,MAAM;AAAA,MACzE;AAAA,IACF,CAAC,GAAG,MAAM;AAAA,EACZ,CAAC;AACH;AAyBO,IAAM,WAAW,WAAW,mBAAmB;AACtD,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -75,7 +75,7 @@ function Notice({
|
|
|
75
75
|
children: getStatusLabel(status)
|
|
76
76
|
}), /* @__PURE__ */ _jsxs("div", {
|
|
77
77
|
className: "components-notice__content",
|
|
78
|
-
children: [children, /* @__PURE__ */ _jsx("div", {
|
|
78
|
+
children: [children, actions.length > 0 && /* @__PURE__ */ _jsx("div", {
|
|
79
79
|
className: "components-notice__actions",
|
|
80
80
|
children: actions.map(({
|
|
81
81
|
className: buttonCustomClasses,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/notice/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RawHTML, useEffect, renderToString } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction getDefaultPoliteness(status) {\n switch (status) {\n case 'success':\n case 'warning':\n case 'info':\n return 'polite';\n // The default will also catch the 'error' status.\n default:\n return 'assertive';\n }\n}\nfunction getStatusLabel(status) {\n switch (status) {\n case 'warning':\n return __('Warning notice');\n case 'info':\n return __('Information notice');\n case 'error':\n return __('Error notice');\n // The default will also catch the 'success' status.\n default:\n return __('Notice');\n }\n}\n\n/**\n * `Notice` is a component used to communicate feedback to the user.\n *\n *```jsx\n * import { Notice } from `@wordpress/components`;\n *\n * const MyNotice = () => (\n * <Notice status=\"error\">An unknown error occurred.</Notice>\n * );\n * ```\n */\nfunction Notice({\n className,\n status = 'info',\n children,\n spokenMessage = children,\n onRemove = noop,\n isDismissible = true,\n actions = [],\n politeness = getDefaultPoliteness(status),\n __unstableHTML,\n // onDismiss is a callback executed when the notice is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the notice from the UI.\n onDismiss = noop\n}) {\n useSpokenMessage(spokenMessage, politeness);\n const classes = clsx(className, 'components-notice', 'is-' + status, {\n 'is-dismissible': isDismissible\n });\n if (__unstableHTML && typeof children === 'string') {\n children = /*#__PURE__*/_jsx(RawHTML, {\n children: children\n });\n }\n const onDismissNotice = () => {\n onDismiss();\n onRemove();\n };\n return /*#__PURE__*/_jsxs(\"div\", {\n className: classes,\n children: [/*#__PURE__*/_jsx(VisuallyHidden, {\n children: getStatusLabel(status)\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-notice__content\",\n children: [children, /*#__PURE__*/_jsx(\"div\", {\n className: \"components-notice__actions\",\n children: actions.map(({\n className: buttonCustomClasses,\n label,\n isPrimary,\n variant,\n noDefaultClasses = false,\n onClick,\n url\n }, index) => {\n let computedVariant = variant;\n if (variant !== 'primary' && !noDefaultClasses) {\n computedVariant = !url ? 'secondary' : 'link';\n }\n if (typeof computedVariant === 'undefined' && isPrimary) {\n computedVariant = 'primary';\n }\n return /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: computedVariant,\n onClick: url ? undefined : onClick,\n className: clsx('components-notice__action', buttonCustomClasses),\n children: label\n }, index);\n })\n })]\n }), isDismissible && /*#__PURE__*/_jsx(Button, {\n size: \"small\",\n className: \"components-notice__dismiss\",\n icon: close,\n label: __('Close'),\n onClick: onDismissNotice\n })]\n });\n}\nexport default Notice;"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB,SAAS,SAAS,WAAW,sBAAsB;AACnD,SAAS,aAAa;AACtB,SAAS,aAAa;AAKtB,OAAO,YAAY;AACnB,SAAS,sBAAsB;AAC/B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,OAAO,MAAM;AAAC;AAMpB,SAAS,iBAAiB,SAAS,YAAY;AAC7C,QAAM,gBAAgB,OAAO,YAAY,WAAW,UAAU,eAAe,OAAO;AACpF,YAAU,MAAM;AACd,QAAI,eAAe;AACjB,YAAM,eAAe,UAAU;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,CAAC;AAChC;AACA,SAAS,qBAAqB,QAAQ;AACpC,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA;AAAA,IAET;AACE,aAAO;AAAA,EACX;AACF;AACA,SAAS,eAAe,QAAQ;AAC9B,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,GAAG,gBAAgB;AAAA,IAC5B,KAAK;AACH,aAAO,GAAG,oBAAoB;AAAA,IAChC,KAAK;AACH,aAAO,GAAG,cAAc;AAAA;AAAA,IAE1B;AACE,aAAO,GAAG,QAAQ;AAAA,EACtB;AACF;AAaA,SAAS,OAAO;AAAA,EACd;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,UAAU,CAAC;AAAA,EACX,aAAa,qBAAqB,MAAM;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA,EAIA,YAAY;AACd,GAAG;AACD,mBAAiB,eAAe,UAAU;AAC1C,QAAM,UAAU,KAAK,WAAW,qBAAqB,QAAQ,QAAQ;AAAA,IACnE,kBAAkB;AAAA,EACpB,CAAC;AACD,MAAI,kBAAkB,OAAO,aAAa,UAAU;AAClD,eAAwB,qBAAK,SAAS;AAAA,MACpC;AAAA,IACF,CAAC;AAAA,EACH;AACA,QAAM,kBAAkB,MAAM;AAC5B,cAAU;AACV,aAAS;AAAA,EACX;AACA,SAAoB,sBAAM,OAAO;AAAA,IAC/B,WAAW;AAAA,IACX,UAAU,CAAc,qBAAK,gBAAgB;AAAA,MAC3C,UAAU,eAAe,MAAM;AAAA,IACjC,CAAC,GAAgB,sBAAM,OAAO;AAAA,MAC5B,WAAW;AAAA,MACX,UAAU,CAAC,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RawHTML, useEffect, renderToString } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst noop = () => {};\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction getDefaultPoliteness(status) {\n switch (status) {\n case 'success':\n case 'warning':\n case 'info':\n return 'polite';\n // The default will also catch the 'error' status.\n default:\n return 'assertive';\n }\n}\nfunction getStatusLabel(status) {\n switch (status) {\n case 'warning':\n return __('Warning notice');\n case 'info':\n return __('Information notice');\n case 'error':\n return __('Error notice');\n // The default will also catch the 'success' status.\n default:\n return __('Notice');\n }\n}\n\n/**\n * `Notice` is a component used to communicate feedback to the user.\n *\n *```jsx\n * import { Notice } from `@wordpress/components`;\n *\n * const MyNotice = () => (\n * <Notice status=\"error\">An unknown error occurred.</Notice>\n * );\n * ```\n */\nfunction Notice({\n className,\n status = 'info',\n children,\n spokenMessage = children,\n onRemove = noop,\n isDismissible = true,\n actions = [],\n politeness = getDefaultPoliteness(status),\n __unstableHTML,\n // onDismiss is a callback executed when the notice is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the notice from the UI.\n onDismiss = noop\n}) {\n useSpokenMessage(spokenMessage, politeness);\n const classes = clsx(className, 'components-notice', 'is-' + status, {\n 'is-dismissible': isDismissible\n });\n if (__unstableHTML && typeof children === 'string') {\n children = /*#__PURE__*/_jsx(RawHTML, {\n children: children\n });\n }\n const onDismissNotice = () => {\n onDismiss();\n onRemove();\n };\n return /*#__PURE__*/_jsxs(\"div\", {\n className: classes,\n children: [/*#__PURE__*/_jsx(VisuallyHidden, {\n children: getStatusLabel(status)\n }), /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-notice__content\",\n children: [children, actions.length > 0 && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-notice__actions\",\n children: actions.map(({\n className: buttonCustomClasses,\n label,\n isPrimary,\n variant,\n noDefaultClasses = false,\n onClick,\n url\n }, index) => {\n let computedVariant = variant;\n if (variant !== 'primary' && !noDefaultClasses) {\n computedVariant = !url ? 'secondary' : 'link';\n }\n if (typeof computedVariant === 'undefined' && isPrimary) {\n computedVariant = 'primary';\n }\n return /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: computedVariant,\n onClick: url ? undefined : onClick,\n className: clsx('components-notice__action', buttonCustomClasses),\n children: label\n }, index);\n })\n })]\n }), isDismissible && /*#__PURE__*/_jsx(Button, {\n size: \"small\",\n className: \"components-notice__dismiss\",\n icon: close,\n label: __('Close'),\n onClick: onDismissNotice\n })]\n });\n}\nexport default Notice;"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,7 +7,7 @@ import warning from "@wordpress/warning";
|
|
|
7
7
|
import Button from "../button";
|
|
8
8
|
import ExternalLink from "../external-link";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
var NOTICE_TIMEOUT =
|
|
10
|
+
var NOTICE_TIMEOUT = 6e3;
|
|
11
11
|
function useSpokenMessage(message, politeness) {
|
|
12
12
|
const spokenMessage = typeof message === "string" ? message : renderToString(message);
|
|
13
13
|
useEffect(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/snackbar/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ExternalLink from '../external-link';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst NOTICE_TIMEOUT =
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, useLayoutEffect, useRef, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ExternalLink from '../external-link';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst NOTICE_TIMEOUT = 6000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(message, politeness) {\n const spokenMessage = typeof message === 'string' ? message : renderToString(message);\n useEffect(() => {\n if (spokenMessage) {\n speak(spokenMessage, politeness);\n }\n }, [spokenMessage, politeness]);\n}\nfunction UnforwardedSnackbar({\n className,\n children,\n spokenMessage = children,\n politeness = 'polite',\n actions = [],\n onRemove,\n icon = null,\n explicitDismiss = false,\n // onDismiss is a callback executed when the snackbar is dismissed.\n // It is distinct from onRemove, which _looks_ like a callback but is\n // actually the function to call to remove the snackbar from the UI.\n onDismiss,\n listRef\n}, ref) {\n function dismissMe(event) {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n\n // Prevent focus loss by moving it to the list element.\n listRef?.current?.focus();\n onDismiss?.();\n onRemove?.();\n }\n function onActionClick(event, onClick) {\n event.stopPropagation();\n onRemove?.();\n if (onClick) {\n onClick(event);\n }\n }\n useSpokenMessage(spokenMessage, politeness);\n\n // The `onDismiss/onRemove` can have unstable references,\n // trigger side-effect cleanup, and reset timers.\n const callbacksRef = useRef({\n onDismiss,\n onRemove\n });\n useLayoutEffect(() => {\n callbacksRef.current = {\n onDismiss,\n onRemove\n };\n });\n useEffect(() => {\n // Only set up the timeout dismiss if we're not explicitly dismissing.\n const timeoutHandle = setTimeout(() => {\n if (!explicitDismiss) {\n callbacksRef.current.onDismiss?.();\n callbacksRef.current.onRemove?.();\n }\n }, NOTICE_TIMEOUT);\n return () => clearTimeout(timeoutHandle);\n }, [explicitDismiss]);\n const classes = clsx(className, 'components-snackbar', {\n 'components-snackbar-explicit-dismiss': !!explicitDismiss\n });\n if (actions && actions.length > 1) {\n // We need to inform developers that snackbar only accepts 1 action.\n globalThis.SCRIPT_DEBUG === true ? warning('Snackbar can only have one action. Use Notice if your message requires many actions.') : void 0;\n // return first element only while keeping it inside an array\n actions = [actions[0]];\n }\n const snackbarContentClassnames = clsx('components-snackbar__content', {\n 'components-snackbar__content-with-icon': !!icon\n });\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n className: classes,\n onClick: !explicitDismiss ? dismissMe : undefined,\n tabIndex: 0,\n role: !explicitDismiss ? 'button' : undefined,\n onKeyPress: !explicitDismiss ? dismissMe : undefined,\n \"aria-label\": !explicitDismiss ? __('Dismiss this notice') : undefined,\n \"data-testid\": \"snackbar\",\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: snackbarContentClassnames,\n children: [icon && /*#__PURE__*/_jsx(\"div\", {\n className: \"components-snackbar__icon\",\n children: icon\n }), children, actions.map(({\n label,\n onClick,\n url,\n openInNewTab = false\n }, index) => url !== undefined && openInNewTab ? /*#__PURE__*/_jsx(ExternalLink, {\n href: url,\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index) : /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n href: url,\n variant: \"link\",\n onClick: event => onActionClick(event, onClick),\n className: \"components-snackbar__action\",\n children: label\n }, index)), explicitDismiss && /*#__PURE__*/_jsx(\"span\", {\n role: \"button\",\n \"aria-label\": __('Dismiss this notice'),\n tabIndex: 0,\n className: \"components-snackbar__dismiss-button\",\n onClick: dismissMe,\n onKeyPress: dismissMe,\n children: \"\\u2715\"\n })]\n })\n });\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef(UnforwardedSnackbar);\nexport default Snackbar;"],
|
|
5
5
|
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,30 +6,20 @@ import CheckboxControl from "../../checkbox-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedCheckboxControl = ({
|
|
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
|
return /* @__PURE__ */ _jsx(ControlWithError, {
|
|
19
16
|
required,
|
|
20
17
|
markWhenOptional,
|
|
21
18
|
ref: mergedRefs,
|
|
22
|
-
onValidate: () => {
|
|
23
|
-
return onValidate?.(valueRef.current);
|
|
24
|
-
},
|
|
25
19
|
customValidity,
|
|
26
20
|
getValidityTarget: () => validityTargetRef.current?.querySelector('input[type="checkbox"]'),
|
|
27
21
|
children: /* @__PURE__ */ _jsx(CheckboxControl, {
|
|
28
22
|
__nextHasNoMarginBottom: true,
|
|
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/checkbox-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 CheckboxControl from '../../checkbox-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedCheckboxControl = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,qBAAqB;AAC5B,SAAS,OAAO,YAAY;AAC5B,IAAM,sCAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
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 CheckboxControl from '../../checkbox-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedCheckboxControl = ({\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 ref: mergedRefs,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current?.querySelector('input[type=\"checkbox\"]'),\n children: /*#__PURE__*/_jsx(CheckboxControl, {\n __nextHasNoMarginBottom: true\n // TODO: Upstream limitation - CheckboxControl doesn't support uncontrolled mode, visually.\n ,\n ...restProps\n })\n });\n};\nexport const ValidatedCheckboxControl = forwardRef(UnforwardedValidatedCheckboxControl);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,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,KAAK;AAAA,IACL;AAAA,IACA,mBAAmB,MAAM,kBAAkB,SAAS,cAAc,wBAAwB;AAAA,IAC1F,UAAuB,qBAAK,iBAAiB;AAAA,MAC3C,yBAAyB;AAAA,MAGzB,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,2BAA2B,WAAW,mCAAmC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,15 +6,12 @@ import ComboboxControl from "../../combobox-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedComboboxControl = ({
|
|
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
|
useEffect(() => {
|
|
19
16
|
const input = validityTargetRef.current?.querySelector('input[role="combobox"]');
|
|
20
17
|
if (input) {
|
|
@@ -27,19 +24,12 @@ var UnforwardedValidatedComboboxControl = ({
|
|
|
27
24
|
required,
|
|
28
25
|
markWhenOptional,
|
|
29
26
|
ref: mergedRefs,
|
|
30
|
-
onValidate: () => {
|
|
31
|
-
return onValidate?.(valueRef.current);
|
|
32
|
-
},
|
|
33
27
|
customValidity,
|
|
34
28
|
getValidityTarget: () => validityTargetRef.current?.querySelector('input[role="combobox"]'),
|
|
35
29
|
children: /* @__PURE__ */ _jsx(ComboboxControl, {
|
|
36
30
|
__nextHasNoMarginBottom: true,
|
|
37
31
|
__next40pxDefaultSize: true,
|
|
38
|
-
...restProps
|
|
39
|
-
onChange: (value) => {
|
|
40
|
-
valueRef.current = value;
|
|
41
|
-
onChange?.(value);
|
|
42
|
-
}
|
|
32
|
+
...restProps
|
|
43
33
|
})
|
|
44
34
|
})
|
|
45
35
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/validated-form-controls/components/combobox-control.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport ComboboxControl from '../../combobox-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedComboboxControl = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,cAAc;AAK9C,SAAS,wBAAwB;AACjC,OAAO,qBAAqB;AAC5B,SAAS,OAAO,YAAY;AAC5B,IAAM,sCAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport ComboboxControl from '../../combobox-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedComboboxControl = ({\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 const input = validityTargetRef.current?.querySelector('input[role=\"combobox\"]');\n if (input) {\n input.required = required !== null && required !== void 0 ? required : false;\n }\n }, [required]);\n return (\n /*#__PURE__*/\n // TODO: Bug - Missing value error is not cleared immediately on change, waits for blur.\n _jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n ref: mergedRefs,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current?.querySelector('input[role=\"combobox\"]'),\n children: /*#__PURE__*/_jsx(ComboboxControl, {\n __nextHasNoMarginBottom: true,\n __next40pxDefaultSize: true,\n ...restProps\n })\n })\n );\n};\nexport const ValidatedComboboxControl = forwardRef(UnforwardedValidatedComboboxControl);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,cAAc;AAK9C,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;AAIjE,YAAU,MAAM;AACd,UAAM,QAAQ,kBAAkB,SAAS,cAAc,wBAAwB;AAC/E,QAAI,OAAO;AACT,YAAM,WAAW,aAAa,QAAQ,aAAa,SAAS,WAAW;AAAA,IACzE;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AACb;AAAA;AAAA,IAGE,qBAAK,kBAAkB;AAAA,MACrB;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL;AAAA,MACA,mBAAmB,MAAM,kBAAkB,SAAS,cAAc,wBAAwB;AAAA,MAC1F,UAAuB,qBAAK,iBAAiB;AAAA,QAC3C,yBAAyB;AAAA,QACzB,uBAAuB;AAAA,QACvB,GAAG;AAAA,MACL,CAAC;AAAA,IACH,CAAC;AAAA;AAEL;AACO,IAAM,2BAA2B,WAAW,mCAAmC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,33 +5,23 @@ import CustomSelectControl from "../../custom-select-control";
|
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
var UnforwardedValidatedCustomSelectControl = ({
|
|
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
|
return /* @__PURE__ */ _jsxs("div", {
|
|
17
14
|
className: "components-validated-control__wrapper-with-error-delegate",
|
|
18
15
|
ref: forwardedRef,
|
|
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(
|
|
28
22
|
CustomSelectControl,
|
|
29
23
|
{
|
|
30
24
|
__next40pxDefaultSize: true,
|
|
31
|
-
onChange: (value) => {
|
|
32
|
-
valueRef.current = value.selectedItem;
|
|
33
|
-
onChange?.(value);
|
|
34
|
-
},
|
|
35
25
|
...restProps
|
|
36
26
|
}
|
|
37
27
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/validated-form-controls/components/custom-select-control.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport CustomSelectControl from '../../custom-select-control';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst UnforwardedValidatedCustomSelectControl = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,yBAAyB;AAChC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,0CAA0C,CAAC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport CustomSelectControl from '../../custom-select-control';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst UnforwardedValidatedCustomSelectControl = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-validated-control__wrapper-with-error-delegate\",\n ref: forwardedRef,\n children: [/*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(CustomSelectControl\n // TODO: Upstream limitation - Required isn't passed down correctly,\n // so it needs to be set on a delegate element.\n , {\n __next40pxDefaultSize: true,\n ...restProps\n })\n }), /*#__PURE__*/_jsxs(\"select\", {\n className: \"components-validated-control__error-delegate\",\n ref: validityTargetRef,\n required: required,\n tabIndex: -1,\n value: restProps.value?.key ? 'hasvalue' : '',\n onChange: () => {},\n onFocus: e => {\n e.target.previousElementSibling?.querySelector('[role=\"combobox\"]')?.focus();\n },\n children: [/*#__PURE__*/_jsx(\"option\", {\n value: \"\",\n children: \"No selection\"\n }), /*#__PURE__*/_jsx(\"option\", {\n value: \"hasvalue\",\n children: \"Has selection\"\n })]\n })]\n });\n};\nexport const ValidatedCustomSelectControl = forwardRef(UnforwardedValidatedCustomSelectControl);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,yBAAyB;AAChC,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,0CAA0C,CAAC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,SAAoB,sBAAM,OAAO;AAAA,IAC/B,WAAW;AAAA,IACX,KAAK;AAAA,IACL,UAAU,CAAc,qBAAK,kBAAkB;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB,MAAM,kBAAkB;AAAA,MAC3C,UAAuB;AAAA,QAAK;AAAA,QAG1B;AAAA,UACA,uBAAuB;AAAA,UACvB,GAAG;AAAA,QACL;AAAA,MAAC;AAAA,IACH,CAAC,GAAgB,sBAAM,UAAU;AAAA,MAC/B,WAAW;AAAA,MACX,KAAK;AAAA,MACL;AAAA,MACA,UAAU;AAAA,MACV,OAAO,UAAU,OAAO,MAAM,aAAa;AAAA,MAC3C,UAAU,MAAM;AAAA,MAAC;AAAA,MACjB,SAAS,OAAK;AACZ,UAAE,OAAO,wBAAwB,cAAc,mBAAmB,GAAG,MAAM;AAAA,MAC7E;AAAA,MACA,UAAU,CAAc,qBAAK,UAAU;AAAA,QACrC,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC,GAAgB,qBAAK,UAAU;AAAA,QAC9B,OAAO;AAAA,QACP,UAAU;AAAA,MACZ,CAAC,CAAC;AAAA,IACJ,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAM,+BAA+B,WAAW,uCAAuC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,40 +5,30 @@ import { FormTokenField } from "../../form-token-field";
|
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
var UnforwardedValidatedFormTokenField = ({
|
|
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
|
return /* @__PURE__ */ _jsxs("div", {
|
|
17
14
|
className: "components-validated-control__wrapper-with-error-delegate",
|
|
18
15
|
ref: forwardedRef,
|
|
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(FormTokenField, {
|
|
28
22
|
__next40pxDefaultSize: true,
|
|
29
23
|
__nextHasNoMarginBottom: true,
|
|
30
|
-
...restProps
|
|
31
|
-
onChange: (value, ...args) => {
|
|
32
|
-
valueRef.current = value;
|
|
33
|
-
onChange?.(value, ...args);
|
|
34
|
-
}
|
|
24
|
+
...restProps
|
|
35
25
|
})
|
|
36
26
|
}), /* @__PURE__ */ _jsx("input", {
|
|
37
27
|
className: "components-validated-control__error-delegate",
|
|
38
28
|
type: "text",
|
|
39
29
|
ref: validityTargetRef,
|
|
40
30
|
required,
|
|
41
|
-
value:
|
|
31
|
+
value: restProps.value && restProps.value.length > 0 ? "hasvalue" : "",
|
|
42
32
|
tabIndex: -1,
|
|
43
33
|
onChange: () => {
|
|
44
34
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/validated-form-controls/components/form-token-field.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport { FormTokenField } from '../../form-token-field';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst UnforwardedValidatedFormTokenField = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,qCAAqC,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport { FormTokenField } from '../../form-token-field';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst UnforwardedValidatedFormTokenField = ({\n required,\n customValidity,\n markWhenOptional,\n ...restProps\n}, forwardedRef) => {\n const validityTargetRef = useRef(null);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: \"components-validated-control__wrapper-with-error-delegate\",\n ref: forwardedRef,\n children: [/*#__PURE__*/_jsx(ControlWithError, {\n required: required,\n markWhenOptional: markWhenOptional,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current,\n children: /*#__PURE__*/_jsx(FormTokenField, {\n __next40pxDefaultSize: true,\n __nextHasNoMarginBottom: true,\n ...restProps\n })\n }), /*#__PURE__*/_jsx(\"input\", {\n className: \"components-validated-control__error-delegate\",\n type: \"text\",\n ref: validityTargetRef,\n required: required,\n value: restProps.value && restProps.value.length > 0 ? 'hasvalue' : '',\n tabIndex: -1,\n onChange: () => {},\n onFocus: e => {\n e.target.previousElementSibling?.querySelector('input[type=\"text\"]')?.focus();\n }\n })]\n });\n};\nexport const ValidatedFormTokenField = forwardRef(UnforwardedValidatedFormTokenField);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,IAAM,qCAAqC,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG,iBAAiB;AAClB,QAAM,oBAAoB,OAAO,IAAI;AACrC,SAAoB,sBAAM,OAAO;AAAA,IAC/B,WAAW;AAAA,IACX,KAAK;AAAA,IACL,UAAU,CAAc,qBAAK,kBAAkB;AAAA,MAC7C;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB,MAAM,kBAAkB;AAAA,MAC3C,UAAuB,qBAAK,gBAAgB;AAAA,QAC1C,uBAAuB;AAAA,QACvB,yBAAyB;AAAA,QACzB,GAAG;AAAA,MACL,CAAC;AAAA,IACH,CAAC,GAAgB,qBAAK,SAAS;AAAA,MAC7B,WAAW;AAAA,MACX,MAAM;AAAA,MACN,KAAK;AAAA,MACL;AAAA,MACA,OAAO,UAAU,SAAS,UAAU,MAAM,SAAS,IAAI,aAAa;AAAA,MACpE,UAAU;AAAA,MACV,UAAU,MAAM;AAAA,MAAC;AAAA,MACjB,SAAS,OAAK;AACZ,UAAE,OAAO,wBAAwB,cAAc,oBAAoB,GAAG,MAAM;AAAA,MAC9E;AAAA,IACF,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACO,IAAM,0BAA0B,WAAW,kCAAkC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,30 +6,20 @@ import InputControl from "../../input-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedInputControl = ({
|
|
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(InputControl, {
|
|
27
21
|
__next40pxDefaultSize: true,
|
|
28
22
|
ref: mergedRefs,
|
|
29
|
-
onChange: (value, ...args) => {
|
|
30
|
-
valueRef.current = value;
|
|
31
|
-
onChange?.(value, ...args);
|
|
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/input-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 InputControl from '../../input-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedInputControl = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAAY,cAAc;AACnC,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,kBAAkB;AACzB,SAAS,OAAO,YAAY;AAC5B,IAAM,mCAAmC,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
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 InputControl from '../../input-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedInputControl = ({\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(InputControl, {\n __next40pxDefaultSize: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedInputControl = forwardRef(UnforwardedValidatedInputControl);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY,cAAc;AACnC,SAAS,oBAAoB;AAK7B,SAAS,wBAAwB;AACjC,OAAO,kBAAkB;AACzB,SAAS,OAAO,YAAY;AAC5B,IAAM,mCAAmC,CAAC;AAAA,EACxC;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,cAAc;AAAA,MACxC,uBAAuB;AAAA,MACvB,KAAK;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,wBAAwB,WAAW,gCAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,30 +6,20 @@ import NumberControl from "../../number-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedNumberControl = ({
|
|
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(NumberControl, {
|
|
27
21
|
__next40pxDefaultSize: true,
|
|
28
22
|
ref: mergedRefs,
|
|
29
|
-
onChange: (value, ...args) => {
|
|
30
|
-
valueRef.current = value;
|
|
31
|
-
onChange?.(value, ...args);
|
|
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/number-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 NumberControl from '../../number-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedNumberControl = ({\n required,\n
|
|
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
|
|
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 NumberControl from '../../number-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedNumberControl = ({\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(NumberControl, {\n __next40pxDefaultSize: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedNumberControl = forwardRef(UnforwardedValidatedNumberControl);"],
|
|
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,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,29 +6,19 @@ import RadioControl from "../../radio-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedRadioControl = ({
|
|
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.selected);
|
|
18
15
|
return /* @__PURE__ */ _jsx(ControlWithError, {
|
|
19
16
|
required,
|
|
20
17
|
markWhenOptional,
|
|
21
18
|
ref: mergedRefs,
|
|
22
|
-
onValidate: () => {
|
|
23
|
-
return onValidate?.(valueRef.current);
|
|
24
|
-
},
|
|
25
19
|
customValidity,
|
|
26
20
|
getValidityTarget: () => validityTargetRef.current?.querySelector('input[type="radio"]'),
|
|
27
21
|
children: /* @__PURE__ */ _jsx(RadioControl, {
|
|
28
|
-
onChange: (value) => {
|
|
29
|
-
valueRef.current = value;
|
|
30
|
-
onChange?.(value);
|
|
31
|
-
},
|
|
32
22
|
...restProps
|
|
33
23
|
})
|
|
34
24
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/validated-form-controls/components/radio-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 RadioControl from '../../radio-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedRadioControl = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,kBAAkB;AACzB,SAAS,OAAO,YAAY;AAC5B,IAAM,mCAAmC,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
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 RadioControl from '../../radio-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedRadioControl = ({\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 // TODO: Upstream limitation - RadioControl does not accept a ref.\n ,\n ref: mergedRefs,\n customValidity: customValidity,\n getValidityTarget: () => validityTargetRef.current?.querySelector('input[type=\"radio\"]'),\n children: /*#__PURE__*/_jsx(RadioControl, {\n ...restProps\n })\n });\n};\nexport const ValidatedRadioControl = forwardRef(UnforwardedValidatedRadioControl);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,kBAAkB;AACzB,SAAS,OAAO,YAAY;AAC5B,IAAM,mCAAmC,CAAC;AAAA,EACxC;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,IAGA,KAAK;AAAA,IACL;AAAA,IACA,mBAAmB,MAAM,kBAAkB,SAAS,cAAc,qBAAqB;AAAA,IACvF,UAAuB,qBAAK,cAAc;AAAA,MACxC,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,wBAAwB,WAAW,gCAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,31 +6,21 @@ import RangeControl from "../../range-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedRangeControl = ({
|
|
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(RangeControl, {
|
|
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/range-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 RangeControl from '../../range-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedRangeControl = ({\n required,\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,kBAAkB;AACzB,SAAS,OAAO,YAAY;AAC5B,IAAM,mCAAmC,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA
|
|
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 RangeControl from '../../range-control';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst UnforwardedValidatedRangeControl = ({\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(RangeControl, {\n __next40pxDefaultSize: true,\n __nextHasNoMarginBottom: true,\n ref: mergedRefs,\n ...restProps\n })\n });\n};\nexport const ValidatedRangeControl = forwardRef(UnforwardedValidatedRangeControl);"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,cAAc;AAKnC,SAAS,wBAAwB;AACjC,OAAO,kBAAkB;AACzB,SAAS,OAAO,YAAY;AAC5B,IAAM,mCAAmC,CAAC;AAAA,EACxC;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,cAAc;AAAA,MACxC,uBAAuB;AAAA,MACvB,yBAAyB;AAAA,MACzB,KAAK;AAAA,MACL,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACO,IAAM,wBAAwB,WAAW,gCAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,31 +6,21 @@ import SelectControl from "../../select-control";
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
var UnforwardedValidatedSelectControl = ({
|
|
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(SelectControl, {
|
|
27
21
|
__nextHasNoMarginBottom: true,
|
|
28
22
|
__next40pxDefaultSize: true,
|
|
29
23
|
ref: mergedRefs,
|
|
30
|
-
onChange: (value) => {
|
|
31
|
-
valueRef.current = value;
|
|
32
|
-
onChange?.(value);
|
|
33
|
-
},
|
|
34
24
|
...restProps
|
|
35
25
|
})
|
|
36
26
|
});
|