@wordpress/components 30.3.2-next.836ecdcae.0 → 30.4.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 +10 -1
- package/build/private-apis.js +9 -1
- package/build/private-apis.js.map +1 -1
- package/build/validated-form-controls/components/form-token-field.js +64 -0
- package/build/validated-form-controls/components/form-token-field.js.map +1 -0
- package/build/validated-form-controls/components/index.js +11 -0
- package/build/validated-form-controls/components/index.js.map +1 -1
- package/build/validated-form-controls/components/toggle-group-control.js +2 -5
- package/build/validated-form-controls/components/toggle-group-control.js.map +1 -1
- package/build-module/private-apis.js +10 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/validated-form-controls/components/form-token-field.js +57 -0
- package/build-module/validated-form-controls/components/form-token-field.js.map +1 -0
- package/build-module/validated-form-controls/components/index.js +1 -0
- package/build-module/validated-form-controls/components/index.js.map +1 -1
- package/build-module/validated-form-controls/components/toggle-group-control.js +2 -5
- package/build-module/validated-form-controls/components/toggle-group-control.js.map +1 -1
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/form-token-field.d.ts +4 -0
- package/build-types/validated-form-controls/components/form-token-field.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/index.d.ts +1 -0
- package/build-types/validated-form-controls/components/index.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts +15 -0
- package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -0
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/private-apis.ts +14 -0
- package/src/validated-form-controls/components/form-token-field.tsx +84 -0
- package/src/validated-form-controls/components/index.ts +1 -0
- package/src/validated-form-controls/components/stories/form-token-field.story.tsx +83 -0
- package/src/validated-form-controls/components/toggle-group-control.tsx +1 -3
- package/src/validated-form-controls/style.scss +6 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 30.
|
|
5
|
+
## 30.4.0 (2025-09-17)
|
|
6
6
|
|
|
7
7
|
### Bug Fixes
|
|
8
8
|
|
|
9
9
|
- `Modal`: Fix modal headings and labels to use proper editor text color instead of wp-admin colors ([#71311](https://github.com/WordPress/gutenberg/pull/71311)).
|
|
10
10
|
|
|
11
|
+
### Internal
|
|
12
|
+
|
|
13
|
+
- Expose `ValidatedRadioControl` via private API's ([#71664](https://github.com/WordPress/gutenberg/pull/71664)).
|
|
14
|
+
- `ValidatedCheckboxControl`: Expose the component under private API's ([#71505](https://github.com/WordPress/gutenberg/pull/71505/)).
|
|
15
|
+
- Expose `ValidatedTextareaControl` via Private APIs ([#71495](https://github.com/WordPress/gutenberg/pull/71495))
|
|
16
|
+
- Add support for ValidatedFormTokenField [#71350](https://github.com/WordPress/gutenberg/pull/71350).
|
|
17
|
+
- Expose `ValidatedSelectControl` via Private APIs ([#71665](https://github.com/WordPress/gutenberg/pull/71665))
|
|
18
|
+
- Expose `ValidatedToggleGroupControl` via private APIs. Also properly detects `undefined` values for `required` validation ([#71666](https://github.com/WordPress/gutenberg/pull/71666)).
|
|
19
|
+
|
|
11
20
|
## 30.3.0 (2025-09-03)
|
|
12
21
|
|
|
13
22
|
### Bug Fixes
|
package/build/private-apis.js
CHANGED
|
@@ -16,6 +16,7 @@ var _lockUnlock = require("./lock-unlock");
|
|
|
16
16
|
var _badge = _interopRequireDefault(require("./badge"));
|
|
17
17
|
var _calendar = require("./calendar");
|
|
18
18
|
var _validatedFormControls = require("./validated-form-controls");
|
|
19
|
+
var _picker = require("./color-picker/picker");
|
|
19
20
|
/**
|
|
20
21
|
* Internal dependencies
|
|
21
22
|
*/
|
|
@@ -34,8 +35,15 @@ const privateApis = exports.privateApis = {};
|
|
|
34
35
|
DateCalendar: _calendar.DateCalendar,
|
|
35
36
|
DateRangeCalendar: _calendar.DateRangeCalendar,
|
|
36
37
|
TZDate: _calendar.TZDate,
|
|
38
|
+
Picker: _picker.Picker,
|
|
39
|
+
ValidatedInputControl: _validatedFormControls.ValidatedInputControl,
|
|
40
|
+
ValidatedCheckboxControl: _validatedFormControls.ValidatedCheckboxControl,
|
|
37
41
|
ValidatedNumberControl: _validatedFormControls.ValidatedNumberControl,
|
|
42
|
+
ValidatedSelectControl: _validatedFormControls.ValidatedSelectControl,
|
|
43
|
+
ValidatedRadioControl: _validatedFormControls.ValidatedRadioControl,
|
|
38
44
|
ValidatedTextControl: _validatedFormControls.ValidatedTextControl,
|
|
39
|
-
|
|
45
|
+
ValidatedTextareaControl: _validatedFormControls.ValidatedTextareaControl,
|
|
46
|
+
ValidatedToggleControl: _validatedFormControls.ValidatedToggleControl,
|
|
47
|
+
ValidatedToggleGroupControl: _validatedFormControls.ValidatedToggleGroupControl
|
|
40
48
|
});
|
|
41
49
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","_menu","_contextSystemProvider","_theme","_interopRequireDefault","_tabs","_strings","_withIgnoreImeEvents","_lockUnlock","_badge","_calendar","_validatedFormControls","privateApis","exports","lock","__experimentalPopoverLegacyPositionToPlacement","ComponentsContext","Tabs","Theme","Menu","kebabCase","withIgnoreIMEEvents","Badge","normalizeTextString","DateCalendar","DateRangeCalendar","TZDate","ValidatedNumberControl","ValidatedTextControl","ValidatedToggleControl"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\n\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport {\n\tValidatedNumberControl,\n\tValidatedTextControl,\n\tValidatedToggleControl,\n} from './validated-form-controls';\n\nexport const privateApis = {};\nlock( privateApis, {\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tComponentsContext,\n\tTabs,\n\tTheme,\n\tMenu,\n\tkebabCase,\n\twithIgnoreIMEEvents,\n\tBadge,\n\tnormalizeTextString,\n\tDateCalendar,\n\tDateRangeCalendar,\n\tTZDate,\n\tValidatedNumberControl,\n\tValidatedTextControl,\n\tValidatedToggleControl,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAL,sBAAA,CAAAJ,OAAA;AAEA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,sBAAA,GAAAX,OAAA;
|
|
1
|
+
{"version":3,"names":["_utils","require","_menu","_contextSystemProvider","_theme","_interopRequireDefault","_tabs","_strings","_withIgnoreImeEvents","_lockUnlock","_badge","_calendar","_validatedFormControls","_picker","privateApis","exports","lock","__experimentalPopoverLegacyPositionToPlacement","ComponentsContext","Tabs","Theme","Menu","kebabCase","withIgnoreIMEEvents","Badge","normalizeTextString","DateCalendar","DateRangeCalendar","TZDate","Picker","ValidatedInputControl","ValidatedCheckboxControl","ValidatedNumberControl","ValidatedSelectControl","ValidatedRadioControl","ValidatedTextControl","ValidatedTextareaControl","ValidatedToggleControl","ValidatedToggleGroupControl"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\n\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport {\n\tValidatedCheckboxControl,\n\tValidatedInputControl,\n\tValidatedNumberControl,\n\tValidatedSelectControl,\n\tValidatedRadioControl,\n\tValidatedTextControl,\n\tValidatedTextareaControl,\n\tValidatedToggleControl,\n\tValidatedToggleGroupControl,\n} from './validated-form-controls';\nimport { Picker } from './color-picker/picker';\n\nexport const privateApis = {};\nlock( privateApis, {\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tComponentsContext,\n\tTabs,\n\tTheme,\n\tMenu,\n\tkebabCase,\n\twithIgnoreIMEEvents,\n\tBadge,\n\tnormalizeTextString,\n\tDateCalendar,\n\tDateRangeCalendar,\n\tTZDate,\n\tPicker,\n\tValidatedInputControl,\n\tValidatedCheckboxControl,\n\tValidatedNumberControl,\n\tValidatedSelectControl,\n\tValidatedRadioControl,\n\tValidatedTextControl,\n\tValidatedTextareaControl,\n\tValidatedToggleControl,\n\tValidatedToggleGroupControl,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,oBAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAL,sBAAA,CAAAJ,OAAA;AAEA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,sBAAA,GAAAX,OAAA;AAWA,IAAAY,OAAA,GAAAZ,OAAA;AAzBA;AACA;AACA;;AAyBO,MAAMa,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,CAAC,CAAC;AAC7B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,8CAA8C,EAA9CA,0BAA8C;EAC9CC,iBAAiB,EAAjBA,wCAAiB;EACjBC,IAAI,EAAJA,UAAI;EACJC,KAAK,EAALA,cAAK;EACLC,IAAI,EAAJA,UAAI;EACJC,SAAS,EAATA,kBAAS;EACTC,mBAAmB,EAAnBA,wCAAmB;EACnBC,KAAK,EAALA,cAAK;EACLC,mBAAmB,EAAnBA,4BAAmB;EACnBC,YAAY,EAAZA,sBAAY;EACZC,iBAAiB,EAAjBA,2BAAiB;EACjBC,MAAM,EAANA,gBAAM;EACNC,MAAM,EAANA,cAAM;EACNC,qBAAqB,EAArBA,4CAAqB;EACrBC,wBAAwB,EAAxBA,+CAAwB;EACxBC,sBAAsB,EAAtBA,6CAAsB;EACtBC,sBAAsB,EAAtBA,6CAAsB;EACtBC,qBAAqB,EAArBA,4CAAqB;EACrBC,oBAAoB,EAApBA,2CAAoB;EACpBC,wBAAwB,EAAxBA,+CAAwB;EACxBC,sBAAsB,EAAtBA,6CAAsB;EACtBC,2BAA2B,EAA3BA;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ValidatedFormTokenField = void 0;
|
|
7
|
+
var _element = require("@wordpress/element");
|
|
8
|
+
var _controlWithError = require("../control-with-error");
|
|
9
|
+
var _formTokenField = require("../../form-token-field");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const UnforwardedValidatedFormTokenField = ({
|
|
20
|
+
required,
|
|
21
|
+
onValidate,
|
|
22
|
+
customValidity,
|
|
23
|
+
onChange,
|
|
24
|
+
markWhenOptional,
|
|
25
|
+
...restProps
|
|
26
|
+
}, forwardedRef) => {
|
|
27
|
+
const validityTargetRef = (0, _element.useRef)(null);
|
|
28
|
+
const valueRef = (0, _element.useRef)(restProps.value);
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
30
|
+
className: "components-validated-control__wrapper-with-error-delegate",
|
|
31
|
+
ref: forwardedRef,
|
|
32
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_controlWithError.ControlWithError, {
|
|
33
|
+
required: required,
|
|
34
|
+
markWhenOptional: markWhenOptional,
|
|
35
|
+
onValidate: () => {
|
|
36
|
+
return onValidate?.(valueRef.current);
|
|
37
|
+
},
|
|
38
|
+
customValidity: customValidity,
|
|
39
|
+
getValidityTarget: () => validityTargetRef.current,
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formTokenField.FormTokenField, {
|
|
41
|
+
__next40pxDefaultSize: true,
|
|
42
|
+
__nextHasNoMarginBottom: true,
|
|
43
|
+
...restProps,
|
|
44
|
+
onChange: (value, ...args) => {
|
|
45
|
+
valueRef.current = value;
|
|
46
|
+
onChange?.(value, ...args);
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
50
|
+
className: "components-validated-control__error-delegate",
|
|
51
|
+
type: "text",
|
|
52
|
+
ref: validityTargetRef,
|
|
53
|
+
required: required,
|
|
54
|
+
value: valueRef.current && valueRef.current.length > 0 ? 'hasvalue' : '',
|
|
55
|
+
tabIndex: -1,
|
|
56
|
+
onChange: () => {},
|
|
57
|
+
onFocus: e => {
|
|
58
|
+
e.target.previousElementSibling?.querySelector('input[type="text"]')?.focus();
|
|
59
|
+
}
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const ValidatedFormTokenField = exports.ValidatedFormTokenField = (0, _element.forwardRef)(UnforwardedValidatedFormTokenField);
|
|
64
|
+
//# sourceMappingURL=form-token-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_controlWithError","_formTokenField","_jsxRuntime","UnforwardedValidatedFormTokenField","required","onValidate","customValidity","onChange","markWhenOptional","restProps","forwardedRef","validityTargetRef","useRef","valueRef","value","jsxs","className","ref","children","jsx","ControlWithError","current","getValidityTarget","FormTokenField","__next40pxDefaultSize","__nextHasNoMarginBottom","args","type","length","tabIndex","onFocus","e","target","previousElementSibling","querySelector","focus","ValidatedFormTokenField","exports","forwardRef"],"sources":["@wordpress/components/src/validated-form-controls/components/form-token-field.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport type { ValidatedControlProps } from './types';\nimport { FormTokenField } from '../../form-token-field';\nimport type { FormTokenFieldProps } from '../../form-token-field/types';\n\ntype Value = FormTokenFieldProps[ 'value' ];\n\nconst UnforwardedValidatedFormTokenField = (\n\t{\n\t\trequired,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tonChange,\n\t\tmarkWhenOptional,\n\t\t...restProps\n\t}: Omit<\n\t\tReact.ComponentProps< typeof FormTokenField >,\n\t\t'__next40pxDefaultSize' | '__nextHasNoMarginBottom'\n\t> &\n\t\tValidatedControlProps< FormTokenFieldProps[ 'value' ] >,\n\tforwardedRef: React.ForwardedRef< HTMLDivElement >\n) => {\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst valueRef = useRef< Value >( restProps.value );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"components-validated-control__wrapper-with-error-delegate\"\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t<ControlWithError\n\t\t\t\trequired={ required }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tonValidate={ () => {\n\t\t\t\t\treturn onValidate?.( valueRef.current );\n\t\t\t\t} }\n\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\tgetValidityTarget={ () => validityTargetRef.current }\n\t\t\t>\n\t\t\t\t<FormTokenField\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tonChange={ ( value, ...args ) => {\n\t\t\t\t\t\tvalueRef.current = value;\n\t\t\t\t\t\tonChange?.( value, ...args );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</ControlWithError>\n\t\t\t<input\n\t\t\t\tclassName=\"components-validated-control__error-delegate\"\n\t\t\t\ttype=\"text\"\n\t\t\t\tref={ validityTargetRef }\n\t\t\t\trequired={ required }\n\t\t\t\tvalue={\n\t\t\t\t\tvalueRef.current && valueRef.current.length > 0\n\t\t\t\t\t\t? 'hasvalue'\n\t\t\t\t\t\t: ''\n\t\t\t\t}\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonChange={ () => {} }\n\t\t\t\tonFocus={ ( e ) => {\n\t\t\t\t\te.target.previousElementSibling\n\t\t\t\t\t\t?.querySelector< HTMLInputElement >(\n\t\t\t\t\t\t\t'input[type=\"text\"]'\n\t\t\t\t\t\t)\n\t\t\t\t\t\t?.focus();\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nexport const ValidatedFormTokenField = forwardRef(\n\tUnforwardedValidatedFormTokenField\n);\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AAAwD,IAAAG,WAAA,GAAAH,OAAA;AAVxD;AACA;AACA;;AAGA;AACA;AACA;;AAQ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M,GAAG,CAAC,GAC5C,UAAU,GACV,EACH;MACDC,QAAQ,EAAG,CAAC,CAAG;MACftB,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAG;MACrBuB,OAAO,EAAKC,CAAC,IAAM;QAClBA,CAAC,CAACC,MAAM,CAACC,sBAAsB,EAC5BC,aAAa,CACd,oBACD,CAAC,EACCC,KAAK,CAAC,CAAC;MACX;IAAG,CACH,CAAC;EAAA,CACE,CAAC;AAER,CAAC;AAEM,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAAE,mBAAU,EAChDnC,kCACD,CAAC","ignoreList":[]}
|
|
@@ -36,6 +36,17 @@ Object.keys(_customSelectControl).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _formTokenField = require("./form-token-field");
|
|
40
|
+
Object.keys(_formTokenField).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _formTokenField[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _formTokenField[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
var _inputControl = require("./input-control");
|
|
40
51
|
Object.keys(_inputControl).forEach(function (key) {
|
|
41
52
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_checkboxControl","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_comboboxControl","_customSelectControl","_inputControl","_numberControl","_radioControl","_rangeControl","_selectControl","_textControl","_textareaControl","_toggleControl","_toggleGroupControl"],"sources":["@wordpress/components/src/validated-form-controls/components/index.ts"],"sourcesContent":["export * from './checkbox-control';\nexport * from './combobox-control';\nexport * from './custom-select-control';\nexport * from './input-control';\nexport * from './number-control';\nexport * from './radio-control';\nexport * from './range-control';\nexport * from './select-control';\nexport * from './text-control';\nexport * from './textarea-control';\nexport * from './toggle-control';\nexport * from './toggle-group-control';\n"],"mappings":";;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,gBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,oBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,oBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,oBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,oBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,
|
|
1
|
+
{"version":3,"names":["_checkboxControl","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_comboboxControl","_customSelectControl","_formTokenField","_inputControl","_numberControl","_radioControl","_rangeControl","_selectControl","_textControl","_textareaControl","_toggleControl","_toggleGroupControl"],"sources":["@wordpress/components/src/validated-form-controls/components/index.ts"],"sourcesContent":["export * from './checkbox-control';\nexport * from './combobox-control';\nexport * from './custom-select-control';\nexport * from './form-token-field';\nexport * from './input-control';\nexport * from './number-control';\nexport * from './radio-control';\nexport * from './range-control';\nexport * from './select-control';\nexport * from './text-control';\nexport * from './textarea-control';\nexport * from './toggle-control';\nexport * from './toggle-group-control';\n"],"mappings":";;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,gBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,oBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,oBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GA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D,GAAA,MAAAgB,mBAAA,CAAAhB,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAY,mBAAA,CAAAhB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -40,10 +40,7 @@ const UnforwardedValidatedToggleGroupControl = ({
|
|
|
40
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_toggleGroupControl.ToggleGroupControl, {
|
|
41
41
|
__nextHasNoMarginBottom: true,
|
|
42
42
|
__next40pxDefaultSize: true,
|
|
43
|
-
ref: forwardedRef
|
|
44
|
-
// TODO: Upstream limitation - In uncontrolled mode, starting from an undefined value then
|
|
45
|
-
// setting a value has a visual bug.
|
|
46
|
-
,
|
|
43
|
+
ref: forwardedRef,
|
|
47
44
|
onChange: value => {
|
|
48
45
|
valueRef.current = value;
|
|
49
46
|
onChange?.(value);
|
|
@@ -55,7 +52,7 @@ const UnforwardedValidatedToggleGroupControl = ({
|
|
|
55
52
|
type: "radio",
|
|
56
53
|
ref: validityTargetRef,
|
|
57
54
|
required: required,
|
|
58
|
-
checked: restProps.value !==
|
|
55
|
+
checked: restProps.value !== undefined,
|
|
59
56
|
tabIndex: -1
|
|
60
57
|
// A name attribute is needed for the `required` behavior to work.
|
|
61
58
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_controlWithError","_toggleGroupControl","_jsxRuntime","UnforwardedValidatedToggleGroupControl","required","onValidate","customValidity","onChange","markWhenOptional","restProps","forwardedRef","validityTargetRef","useRef","valueRef","value","nameAttr","useId","jsxs","className","children","jsx","ControlWithError","current","getValidityTarget","ToggleGroupControl","__nextHasNoMarginBottom","__next40pxDefaultSize","ref","type","checked","tabIndex","name","onFocus","e","target","previousElementSibling","querySelector","focus","ValidatedToggleGroupControl","exports","forwardRef"],"sources":["@wordpress/components/src/validated-form-controls/components/toggle-group-control.tsx"],"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 type { ValidatedControlProps } from './types';\nimport { ToggleGroupControl } from '../../toggle-group-control';\nimport type { ToggleGroupControlProps } from '../../toggle-group-control/types';\n\ntype Value = ToggleGroupControlProps[ 'value' ];\n\nconst UnforwardedValidatedToggleGroupControl = (\n\t{\n\t\trequired,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tonChange,\n\t\tmarkWhenOptional,\n\t\t...restProps\n\t}: Omit<\n\t\tReact.ComponentProps< typeof ToggleGroupControl >,\n\t\t'__next40pxDefaultSize' | '__nextHasNoMarginBottom'\n\t> &\n\t\tValidatedControlProps< Value >,\n\tforwardedRef: React.ForwardedRef< HTMLInputElement >\n) => {\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst valueRef = useRef< Value >( restProps.value );\n\n\tconst nameAttr = useId();\n\n\treturn (\n\t\t<div className=\"components-validated-control__wrapper-with-error-delegate\">\n\t\t\t<ControlWithError\n\t\t\t\trequired={ required }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tonValidate={ () => {\n\t\t\t\t\treturn onValidate?.( valueRef.current );\n\t\t\t\t} }\n\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\tgetValidityTarget={ () => validityTargetRef.current }\n\t\t\t>\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\
|
|
1
|
+
{"version":3,"names":["_element","require","_controlWithError","_toggleGroupControl","_jsxRuntime","UnforwardedValidatedToggleGroupControl","required","onValidate","customValidity","onChange","markWhenOptional","restProps","forwardedRef","validityTargetRef","useRef","valueRef","value","nameAttr","useId","jsxs","className","children","jsx","ControlWithError","current","getValidityTarget","ToggleGroupControl","__nextHasNoMarginBottom","__next40pxDefaultSize","ref","type","checked","undefined","tabIndex","name","onFocus","e","target","previousElementSibling","querySelector","focus","ValidatedToggleGroupControl","exports","forwardRef"],"sources":["@wordpress/components/src/validated-form-controls/components/toggle-group-control.tsx"],"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 type { ValidatedControlProps } from './types';\nimport { ToggleGroupControl } from '../../toggle-group-control';\nimport type { ToggleGroupControlProps } from '../../toggle-group-control/types';\n\ntype Value = ToggleGroupControlProps[ 'value' ];\n\nconst UnforwardedValidatedToggleGroupControl = (\n\t{\n\t\trequired,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tonChange,\n\t\tmarkWhenOptional,\n\t\t...restProps\n\t}: Omit<\n\t\tReact.ComponentProps< typeof ToggleGroupControl >,\n\t\t'__next40pxDefaultSize' | '__nextHasNoMarginBottom'\n\t> &\n\t\tValidatedControlProps< Value >,\n\tforwardedRef: React.ForwardedRef< HTMLInputElement >\n) => {\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst valueRef = useRef< Value >( restProps.value );\n\n\tconst nameAttr = useId();\n\n\treturn (\n\t\t<div className=\"components-validated-control__wrapper-with-error-delegate\">\n\t\t\t<ControlWithError\n\t\t\t\trequired={ required }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tonValidate={ () => {\n\t\t\t\t\treturn onValidate?.( valueRef.current );\n\t\t\t\t} }\n\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\tgetValidityTarget={ () => validityTargetRef.current }\n\t\t\t>\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tvalueRef.current = value;\n\t\t\t\t\t\tonChange?.( value );\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t/>\n\t\t\t</ControlWithError>\n\t\t\t<input\n\t\t\t\tclassName=\"components-validated-control__error-delegate\"\n\t\t\t\ttype=\"radio\"\n\t\t\t\tref={ validityTargetRef }\n\t\t\t\trequired={ required }\n\t\t\t\tchecked={ restProps.value !== undefined }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\t// A name attribute is needed for the `required` behavior to work.\n\t\t\t\tname={ nameAttr }\n\t\t\t\tonChange={ () => {} }\n\t\t\t\tonFocus={ ( e ) => {\n\t\t\t\t\te.target.previousElementSibling\n\t\t\t\t\t\t?.querySelector< HTMLButtonElement | HTMLInputElement >(\n\t\t\t\t\t\t\t'[data-active-item=\"true\"]'\n\t\t\t\t\t\t)\n\t\t\t\t\t\t?.focus();\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nexport const ValidatedToggleGroupControl = forwardRef(\n\tUnforwardedValidatedToggleGroupControl\n);\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAF,OAAA;AAAgE,IAAAG,WAAA,GAAAH,OAAA;AAVhE;AACA;AACA;;AAGA;AACA;AACA;;AAQA,MAAMI,sCAAsC,GAAGA,CAC9C;EACCC,QAAQ;EACRC,UAAU;EACVC,cAAc;EACdC,QAAQ;EACRC,gBAAgB;EAChB,GAAGC;AAK0B,CAAC,EAC/BC,YAAoD,KAChD;EACJ,MAAMC,iBAAiB,GAAG,IAAAC,eAAM,EAAsB,IAAK,CAAC;EAC5D,MAAMC,QAAQ,GAAG,IAAAD,eAAM,EAAWH,SAAS,CAACK,KAAM,CAAC;EAEnD,MAAMC,QAAQ,GAAG,IAAAC,cAAK,EAAC,CAAC;EAExB,oBACC,IAAAd,WAAA,CAAAe,IAAA;IAAKC,SAAS,EAAC,2DAA2D;IAAAC,QAAA,gBACzE,IAAAjB,WAAA,CAAAkB,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|
|
11
11
|
import { lock } from './lock-unlock';
|
|
12
12
|
import Badge from './badge';
|
|
13
13
|
import { DateCalendar, DateRangeCalendar, TZDate } from './calendar';
|
|
14
|
-
import { ValidatedNumberControl, ValidatedTextControl, ValidatedToggleControl } from './validated-form-controls';
|
|
14
|
+
import { ValidatedCheckboxControl, ValidatedInputControl, ValidatedNumberControl, ValidatedSelectControl, ValidatedRadioControl, ValidatedTextControl, ValidatedTextareaControl, ValidatedToggleControl, ValidatedToggleGroupControl } from './validated-form-controls';
|
|
15
|
+
import { Picker } from './color-picker/picker';
|
|
15
16
|
export const privateApis = {};
|
|
16
17
|
lock(privateApis, {
|
|
17
18
|
__experimentalPopoverLegacyPositionToPlacement,
|
|
@@ -26,8 +27,15 @@ lock(privateApis, {
|
|
|
26
27
|
DateCalendar,
|
|
27
28
|
DateRangeCalendar,
|
|
28
29
|
TZDate,
|
|
30
|
+
Picker,
|
|
31
|
+
ValidatedInputControl,
|
|
32
|
+
ValidatedCheckboxControl,
|
|
29
33
|
ValidatedNumberControl,
|
|
34
|
+
ValidatedSelectControl,
|
|
35
|
+
ValidatedRadioControl,
|
|
30
36
|
ValidatedTextControl,
|
|
31
|
-
|
|
37
|
+
ValidatedTextareaControl,
|
|
38
|
+
ValidatedToggleControl,
|
|
39
|
+
ValidatedToggleGroupControl
|
|
32
40
|
});
|
|
33
41
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["positionToPlacement","__experimentalPopoverLegacyPositionToPlacement","Menu","ComponentsContext","Theme","Tabs","kebabCase","normalizeTextString","withIgnoreIMEEvents","lock","Badge","DateCalendar","DateRangeCalendar","TZDate","ValidatedNumberControl","ValidatedTextControl","ValidatedToggleControl","privateApis"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\n\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport {\n\tValidatedNumberControl,\n\tValidatedTextControl,\n\tValidatedToggleControl,\n} from './validated-form-controls';\n\nexport const privateApis = {};\nlock( privateApis, {\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tComponentsContext,\n\tTabs,\n\tTheme,\n\tMenu,\n\tkebabCase,\n\twithIgnoreIMEEvents,\n\tBadge,\n\tnormalizeTextString,\n\tDateCalendar,\n\tDateRangeCalendar,\n\tTZDate,\n\tValidatedNumberControl,\n\tValidatedTextControl,\n\tValidatedToggleControl,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,IAAIC,8CAA8C,QAAQ,iBAAiB;AACvG,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,OAAOC,KAAK,MAAM,SAAS;AAC3B,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,SAAS,EAAEC,mBAAmB,QAAQ,iBAAiB;AAChE,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,IAAI,QAAQ,eAAe;AACpC,OAAOC,KAAK,MAAM,SAAS;AAE3B,SAASC,YAAY,EAAEC,iBAAiB,EAAEC,MAAM,QAAQ,YAAY;AACpE,SACCC,sBAAsB,EACtBC,oBAAoB,EACpBC,sBAAsB,
|
|
1
|
+
{"version":3,"names":["positionToPlacement","__experimentalPopoverLegacyPositionToPlacement","Menu","ComponentsContext","Theme","Tabs","kebabCase","normalizeTextString","withIgnoreIMEEvents","lock","Badge","DateCalendar","DateRangeCalendar","TZDate","ValidatedCheckboxControl","ValidatedInputControl","ValidatedNumberControl","ValidatedSelectControl","ValidatedRadioControl","ValidatedTextControl","ValidatedTextareaControl","ValidatedToggleControl","ValidatedToggleGroupControl","Picker","privateApis"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { Menu } from './menu';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport { Tabs } from './tabs';\nimport { kebabCase, normalizeTextString } from './utils/strings';\nimport { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';\nimport { lock } from './lock-unlock';\nimport Badge from './badge';\n\nimport { DateCalendar, DateRangeCalendar, TZDate } from './calendar';\nimport {\n\tValidatedCheckboxControl,\n\tValidatedInputControl,\n\tValidatedNumberControl,\n\tValidatedSelectControl,\n\tValidatedRadioControl,\n\tValidatedTextControl,\n\tValidatedTextareaControl,\n\tValidatedToggleControl,\n\tValidatedToggleGroupControl,\n} from './validated-form-controls';\nimport { Picker } from './color-picker/picker';\n\nexport const privateApis = {};\nlock( privateApis, {\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tComponentsContext,\n\tTabs,\n\tTheme,\n\tMenu,\n\tkebabCase,\n\twithIgnoreIMEEvents,\n\tBadge,\n\tnormalizeTextString,\n\tDateCalendar,\n\tDateRangeCalendar,\n\tTZDate,\n\tPicker,\n\tValidatedInputControl,\n\tValidatedCheckboxControl,\n\tValidatedNumberControl,\n\tValidatedSelectControl,\n\tValidatedRadioControl,\n\tValidatedTextControl,\n\tValidatedTextareaControl,\n\tValidatedToggleControl,\n\tValidatedToggleGroupControl,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,IAAIC,8CAA8C,QAAQ,iBAAiB;AACvG,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,OAAOC,KAAK,MAAM,SAAS;AAC3B,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,SAAS,EAAEC,mBAAmB,QAAQ,iBAAiB;AAChE,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,IAAI,QAAQ,eAAe;AACpC,OAAOC,KAAK,MAAM,SAAS;AAE3B,SAASC,YAAY,EAAEC,iBAAiB,EAAEC,MAAM,QAAQ,YAAY;AACpE,SACCC,wBAAwB,EACxBC,qBAAqB,EACrBC,sBAAsB,EACtBC,sBAAsB,EACtBC,qBAAqB,EACrBC,oBAAoB,EACpBC,wBAAwB,EACxBC,sBAAsB,EACtBC,2BAA2B,QACrB,2BAA2B;AAClC,SAASC,MAAM,QAAQ,uBAAuB;AAE9C,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAC7Bf,IAAI,CAAEe,WAAW,EAAE;EAClBvB,8CAA8C;EAC9CE,iBAAiB;EACjBE,IAAI;EACJD,KAAK;EACLF,IAAI;EACJI,SAAS;EACTE,mBAAmB;EACnBE,KAAK;EACLH,mBAAmB;EACnBI,YAAY;EACZC,iBAAiB;EACjBC,MAAM;EACNU,MAAM;EACNR,qBAAqB;EACrBD,wBAAwB;EACxBE,sBAAsB;EACtBC,sBAAsB;EACtBC,qBAAqB;EACrBC,oBAAoB;EACpBC,wBAAwB;EACxBC,sBAAsB;EACtBC;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef, useRef } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { ControlWithError } from '../control-with-error';
|
|
10
|
+
import { FormTokenField } from '../../form-token-field';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const UnforwardedValidatedFormTokenField = ({
|
|
13
|
+
required,
|
|
14
|
+
onValidate,
|
|
15
|
+
customValidity,
|
|
16
|
+
onChange,
|
|
17
|
+
markWhenOptional,
|
|
18
|
+
...restProps
|
|
19
|
+
}, forwardedRef) => {
|
|
20
|
+
const validityTargetRef = useRef(null);
|
|
21
|
+
const valueRef = useRef(restProps.value);
|
|
22
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
23
|
+
className: "components-validated-control__wrapper-with-error-delegate",
|
|
24
|
+
ref: forwardedRef,
|
|
25
|
+
children: [/*#__PURE__*/_jsx(ControlWithError, {
|
|
26
|
+
required: required,
|
|
27
|
+
markWhenOptional: markWhenOptional,
|
|
28
|
+
onValidate: () => {
|
|
29
|
+
return onValidate?.(valueRef.current);
|
|
30
|
+
},
|
|
31
|
+
customValidity: customValidity,
|
|
32
|
+
getValidityTarget: () => validityTargetRef.current,
|
|
33
|
+
children: /*#__PURE__*/_jsx(FormTokenField, {
|
|
34
|
+
__next40pxDefaultSize: true,
|
|
35
|
+
__nextHasNoMarginBottom: true,
|
|
36
|
+
...restProps,
|
|
37
|
+
onChange: (value, ...args) => {
|
|
38
|
+
valueRef.current = value;
|
|
39
|
+
onChange?.(value, ...args);
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}), /*#__PURE__*/_jsx("input", {
|
|
43
|
+
className: "components-validated-control__error-delegate",
|
|
44
|
+
type: "text",
|
|
45
|
+
ref: validityTargetRef,
|
|
46
|
+
required: required,
|
|
47
|
+
value: valueRef.current && valueRef.current.length > 0 ? 'hasvalue' : '',
|
|
48
|
+
tabIndex: -1,
|
|
49
|
+
onChange: () => {},
|
|
50
|
+
onFocus: e => {
|
|
51
|
+
e.target.previousElementSibling?.querySelector('input[type="text"]')?.focus();
|
|
52
|
+
}
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
export const ValidatedFormTokenField = forwardRef(UnforwardedValidatedFormTokenField);
|
|
57
|
+
//# sourceMappingURL=form-token-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","useRef","ControlWithError","FormTokenField","jsx","_jsx","jsxs","_jsxs","UnforwardedValidatedFormTokenField","required","onValidate","customValidity","onChange","markWhenOptional","restProps","forwardedRef","validityTargetRef","valueRef","value","className","ref","children","current","getValidityTarget","__next40pxDefaultSize","__nextHasNoMarginBottom","args","type","length","tabIndex","onFocus","e","target","previousElementSibling","querySelector","focus","ValidatedFormTokenField"],"sources":["@wordpress/components/src/validated-form-controls/components/form-token-field.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { ControlWithError } from '../control-with-error';\nimport type { ValidatedControlProps } from './types';\nimport { FormTokenField } from '../../form-token-field';\nimport type { FormTokenFieldProps } from '../../form-token-field/types';\n\ntype Value = FormTokenFieldProps[ 'value' ];\n\nconst UnforwardedValidatedFormTokenField = (\n\t{\n\t\trequired,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tonChange,\n\t\tmarkWhenOptional,\n\t\t...restProps\n\t}: Omit<\n\t\tReact.ComponentProps< typeof FormTokenField >,\n\t\t'__next40pxDefaultSize' | '__nextHasNoMarginBottom'\n\t> &\n\t\tValidatedControlProps< FormTokenFieldProps[ 'value' ] >,\n\tforwardedRef: React.ForwardedRef< HTMLDivElement >\n) => {\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst valueRef = useRef< Value >( restProps.value );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"components-validated-control__wrapper-with-error-delegate\"\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t<ControlWithError\n\t\t\t\trequired={ required }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tonValidate={ () => {\n\t\t\t\t\treturn onValidate?.( valueRef.current );\n\t\t\t\t} }\n\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\tgetValidityTarget={ () => validityTargetRef.current }\n\t\t\t>\n\t\t\t\t<FormTokenField\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\tonChange={ ( value, ...args ) => {\n\t\t\t\t\t\tvalueRef.current = value;\n\t\t\t\t\t\tonChange?.( value, ...args );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</ControlWithError>\n\t\t\t<input\n\t\t\t\tclassName=\"components-validated-control__error-delegate\"\n\t\t\t\ttype=\"text\"\n\t\t\t\tref={ validityTargetRef }\n\t\t\t\trequired={ required }\n\t\t\t\tvalue={\n\t\t\t\t\tvalueRef.current && valueRef.current.length > 0\n\t\t\t\t\t\t? 'hasvalue'\n\t\t\t\t\t\t: ''\n\t\t\t\t}\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonChange={ () => {} }\n\t\t\t\tonFocus={ ( e ) => {\n\t\t\t\t\te.target.previousElementSibling\n\t\t\t\t\t\t?.querySelector< HTMLInputElement >(\n\t\t\t\t\t\t\t'input[type=\"text\"]'\n\t\t\t\t\t\t)\n\t\t\t\t\t\t?.focus();\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nexport const ValidatedFormTokenField = forwardRef(\n\tUnforwardedValidatedFormTokenField\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,MAAM,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,SAASC,cAAc,QAAQ,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKxD,MAAMC,kCAAkC,GAAGA,CAC1C;EACCC,QAAQ;EACRC,UAAU;EACVC,cAAc;EACdC,QAAQ;EACRC,gBAAgB;EAChB,GAAGC;AAKmD,CAAC,EACxDC,YAAkD,KAC9C;EACJ,MAAMC,iBAAiB,GAAGf,MAAM,CAAsB,IAAK,CAAC;EAC5D,MAAMgB,QAAQ,GAAGhB,MAAM,CAAWa,SAAS,CAACI,KAAM,CAAC;EAEnD,oBACCX,KAAA;IACCY,SAAS,EAAC,2DAA2D;IACrEC,GAAG,EAAGL,YAAc;IAAAM,QAAA,gBAEpBhB,IAAA,CAACH,gBAAgB;MAChBO,QAAQ,EAAGA,QAAU;MACrBI,gBAAgB,EAAGA,gBAAkB;MACrCH,UAAU,EAAGA,CAAA,KAAM;QAClB,OAAOA,UAAU,GAAIO,QAAQ,CAACK,OAAQ,CAAC;MACxC,CAAG;MACHX,cAAc,EAAGA,cAAgB;MACjCY,iBAAiB,EAAGA,CAAA,KAAMP,iBAAiB,CAACM,OAAS;MAAAD,QAAA,eAErDhB,IAAA,CAACF,cAAc;QACdqB,qBAAqB;QACrBC,uBAAuB;QAAA,GAClBX,SAAS;QACdF,QAAQ,EAAGA,CAAEM,KAAK,EAAE,GAAGQ,IAAI,KAAM;UAChCT,QAAQ,CAACK,OAAO,GAAGJ,KAAK;UACxBN,QAAQ,GAAIM,KAAK,EAAE,GAAGQ,IAAK,CAAC;QAC7B;MAAG,CACH;IAAC,CACe,CAAC,eACnBrB,IAAA;MACCc,SAAS,EAAC,8CAA8C;MACxDQ,IAAI,EAAC,MAAM;MACXP,GAAG,EAAGJ,iBAAmB;MACzBP,QAAQ,EAAGA,QAAU;MACrBS,KAAK,EACJD,QAAQ,CAACK,OAAO,IAAIL,QAAQ,CAACK,OAAO,CAACM,MAAM,GAAG,CAAC,GAC5C,UAAU,GACV,EACH;MACDC,QAAQ,EAAG,CAAC,CAAG;MACfjB,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAG;MACrBkB,OAAO,EAAKC,CAAC,IAAM;QAClBA,CAAC,CAACC,MAAM,CAACC,sBAAsB,EAC5BC,aAAa,CACd,oBACD,CAAC,EACCC,KAAK,CAAC,CAAC;MACX;IAAG,CACH,CAAC;EAAA,CACE,CAAC;AAER,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAAGpC,UAAU,CAChDQ,kCACD,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/validated-form-controls/components/index.ts"],"sourcesContent":["export * from './checkbox-control';\nexport * from './combobox-control';\nexport * from './custom-select-control';\nexport * from './input-control';\nexport * from './number-control';\nexport * from './radio-control';\nexport * from './range-control';\nexport * from './select-control';\nexport * from './text-control';\nexport * from './textarea-control';\nexport * from './toggle-control';\nexport * from './toggle-group-control';\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/validated-form-controls/components/index.ts"],"sourcesContent":["export * from './checkbox-control';\nexport * from './combobox-control';\nexport * from './custom-select-control';\nexport * from './form-token-field';\nexport * from './input-control';\nexport * from './number-control';\nexport * from './radio-control';\nexport * from './range-control';\nexport * from './select-control';\nexport * from './text-control';\nexport * from './textarea-control';\nexport * from './toggle-control';\nexport * from './toggle-group-control';\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,yBAAyB;AACvC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,wBAAwB","ignoreList":[]}
|
|
@@ -33,10 +33,7 @@ const UnforwardedValidatedToggleGroupControl = ({
|
|
|
33
33
|
children: /*#__PURE__*/_jsx(ToggleGroupControl, {
|
|
34
34
|
__nextHasNoMarginBottom: true,
|
|
35
35
|
__next40pxDefaultSize: true,
|
|
36
|
-
ref: forwardedRef
|
|
37
|
-
// TODO: Upstream limitation - In uncontrolled mode, starting from an undefined value then
|
|
38
|
-
// setting a value has a visual bug.
|
|
39
|
-
,
|
|
36
|
+
ref: forwardedRef,
|
|
40
37
|
onChange: value => {
|
|
41
38
|
valueRef.current = value;
|
|
42
39
|
onChange?.(value);
|
|
@@ -48,7 +45,7 @@ const UnforwardedValidatedToggleGroupControl = ({
|
|
|
48
45
|
type: "radio",
|
|
49
46
|
ref: validityTargetRef,
|
|
50
47
|
required: required,
|
|
51
|
-
checked: restProps.value !==
|
|
48
|
+
checked: restProps.value !== undefined,
|
|
52
49
|
tabIndex: -1
|
|
53
50
|
// A name attribute is needed for the `required` behavior to work.
|
|
54
51
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useId","useRef","ControlWithError","ToggleGroupControl","jsx","_jsx","jsxs","_jsxs","UnforwardedValidatedToggleGroupControl","required","onValidate","customValidity","onChange","markWhenOptional","restProps","forwardedRef","validityTargetRef","valueRef","value","nameAttr","className","children","current","getValidityTarget","__nextHasNoMarginBottom","__next40pxDefaultSize","ref","type","checked","tabIndex","name","onFocus","e","target","previousElementSibling","querySelector","focus","ValidatedToggleGroupControl"],"sources":["@wordpress/components/src/validated-form-controls/components/toggle-group-control.tsx"],"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 type { ValidatedControlProps } from './types';\nimport { ToggleGroupControl } from '../../toggle-group-control';\nimport type { ToggleGroupControlProps } from '../../toggle-group-control/types';\n\ntype Value = ToggleGroupControlProps[ 'value' ];\n\nconst UnforwardedValidatedToggleGroupControl = (\n\t{\n\t\trequired,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tonChange,\n\t\tmarkWhenOptional,\n\t\t...restProps\n\t}: Omit<\n\t\tReact.ComponentProps< typeof ToggleGroupControl >,\n\t\t'__next40pxDefaultSize' | '__nextHasNoMarginBottom'\n\t> &\n\t\tValidatedControlProps< Value >,\n\tforwardedRef: React.ForwardedRef< HTMLInputElement >\n) => {\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst valueRef = useRef< Value >( restProps.value );\n\n\tconst nameAttr = useId();\n\n\treturn (\n\t\t<div className=\"components-validated-control__wrapper-with-error-delegate\">\n\t\t\t<ControlWithError\n\t\t\t\trequired={ required }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tonValidate={ () => {\n\t\t\t\t\treturn onValidate?.( valueRef.current );\n\t\t\t\t} }\n\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\tgetValidityTarget={ () => validityTargetRef.current }\n\t\t\t>\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\
|
|
1
|
+
{"version":3,"names":["forwardRef","useId","useRef","ControlWithError","ToggleGroupControl","jsx","_jsx","jsxs","_jsxs","UnforwardedValidatedToggleGroupControl","required","onValidate","customValidity","onChange","markWhenOptional","restProps","forwardedRef","validityTargetRef","valueRef","value","nameAttr","className","children","current","getValidityTarget","__nextHasNoMarginBottom","__next40pxDefaultSize","ref","type","checked","undefined","tabIndex","name","onFocus","e","target","previousElementSibling","querySelector","focus","ValidatedToggleGroupControl"],"sources":["@wordpress/components/src/validated-form-controls/components/toggle-group-control.tsx"],"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 type { ValidatedControlProps } from './types';\nimport { ToggleGroupControl } from '../../toggle-group-control';\nimport type { ToggleGroupControlProps } from '../../toggle-group-control/types';\n\ntype Value = ToggleGroupControlProps[ 'value' ];\n\nconst UnforwardedValidatedToggleGroupControl = (\n\t{\n\t\trequired,\n\t\tonValidate,\n\t\tcustomValidity,\n\t\tonChange,\n\t\tmarkWhenOptional,\n\t\t...restProps\n\t}: Omit<\n\t\tReact.ComponentProps< typeof ToggleGroupControl >,\n\t\t'__next40pxDefaultSize' | '__nextHasNoMarginBottom'\n\t> &\n\t\tValidatedControlProps< Value >,\n\tforwardedRef: React.ForwardedRef< HTMLInputElement >\n) => {\n\tconst validityTargetRef = useRef< HTMLInputElement >( null );\n\tconst valueRef = useRef< Value >( restProps.value );\n\n\tconst nameAttr = useId();\n\n\treturn (\n\t\t<div className=\"components-validated-control__wrapper-with-error-delegate\">\n\t\t\t<ControlWithError\n\t\t\t\trequired={ required }\n\t\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\t\tonValidate={ () => {\n\t\t\t\t\treturn onValidate?.( valueRef.current );\n\t\t\t\t} }\n\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\tgetValidityTarget={ () => validityTargetRef.current }\n\t\t\t>\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tvalueRef.current = value;\n\t\t\t\t\t\tonChange?.( value );\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t/>\n\t\t\t</ControlWithError>\n\t\t\t<input\n\t\t\t\tclassName=\"components-validated-control__error-delegate\"\n\t\t\t\ttype=\"radio\"\n\t\t\t\tref={ validityTargetRef }\n\t\t\t\trequired={ required }\n\t\t\t\tchecked={ restProps.value !== undefined }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\t// A name attribute is needed for the `required` behavior to work.\n\t\t\t\tname={ nameAttr }\n\t\t\t\tonChange={ () => {} }\n\t\t\t\tonFocus={ ( e ) => {\n\t\t\t\t\te.target.previousElementSibling\n\t\t\t\t\t\t?.querySelector< HTMLButtonElement | HTMLInputElement >(\n\t\t\t\t\t\t\t'[data-active-item=\"true\"]'\n\t\t\t\t\t\t)\n\t\t\t\t\t\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EJ;MAAS,CACd;IAAC,CACe,CAAC,eACnBT,IAAA;MACCe,SAAS,EAAC,8CAA8C;MACxDO,IAAI,EAAC,OAAO;MACZD,GAAG,EAAGV,iBAAmB;MACzBP,QAAQ,EAAGA,QAAU;MACrBmB,OAAO,EAAGd,SAAS,CAACI,KAAK,KAAKW,SAAW;MACzCC,QAAQ,EAAG,CAAC;MACZ;MAAA;MACAC,IAAI,EAAGZ,QAAU;MACjBP,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAG;MACrBoB,OAAO,EAAKC,CAAC,IAAM;QAClBA,CAAC,CAACC,MAAM,CAACC,sBAAsB,EAC5BC,aAAa,CACd,2BACD,CAAC,EACCC,KAAK,CAAC,CAAC;MACX;IAAG,CACH,CAAC;EAAA,CACE,CAAC;AAER,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGvC,UAAU,CACpDS,sCACD,CAAC","ignoreList":[]}
|
|
@@ -3847,6 +3847,10 @@ div.components-toolbar > div + div.has-left-divider::before {
|
|
|
3847
3847
|
.components-validated-control__wrapper-with-error-delegate:has(input[type=radio]:invalid) {
|
|
3848
3848
|
--wp-components-color-accent: #cc1818;
|
|
3849
3849
|
}
|
|
3850
|
+
.components-validated-control__wrapper-with-error-delegate:has(input:user-invalid) .components-form-token-field__input-container:not(:has([aria-expanded=true])) {
|
|
3851
|
+
--wp-components-color-accent: #cc1818;
|
|
3852
|
+
border-color: #cc1818;
|
|
3853
|
+
}
|
|
3850
3854
|
|
|
3851
3855
|
.components-validated-control__error-delegate {
|
|
3852
3856
|
position: absolute;
|
package/build-style/style.css
CHANGED
|
@@ -3860,6 +3860,10 @@ div.components-toolbar > div + div.has-left-divider::before {
|
|
|
3860
3860
|
.components-validated-control__wrapper-with-error-delegate:has(input[type=radio]:invalid) {
|
|
3861
3861
|
--wp-components-color-accent: #cc1818;
|
|
3862
3862
|
}
|
|
3863
|
+
.components-validated-control__wrapper-with-error-delegate:has(input:user-invalid) .components-form-token-field__input-container:not(:has([aria-expanded=true])) {
|
|
3864
|
+
--wp-components-color-accent: #cc1818;
|
|
3865
|
+
border-color: #cc1818;
|
|
3866
|
+
}
|
|
3863
3867
|
|
|
3864
3868
|
.components-validated-control__error-delegate {
|
|
3865
3869
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,WAAW,IAAK,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ValidatedControlProps } from './types';
|
|
2
|
+
import type { FormTokenFieldProps } from '../../form-token-field/types';
|
|
3
|
+
export declare const ValidatedFormTokenField: import("react").ForwardRefExoticComponent<Omit<FormTokenFieldProps, "__next40pxDefaultSize" | "__nextHasNoMarginBottom"> & ValidatedControlProps<(string | import("../../form-token-field/types").TokenItem)[] | undefined> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
//# sourceMappingURL=form-token-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-token-field.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/form-token-field.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAsExE,eAAO,MAAM,uBAAuB,8QAEnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { ValidatedFormTokenField } from '../form-token-field';
|
|
9
|
+
declare const meta: Meta<typeof ValidatedFormTokenField>;
|
|
10
|
+
export default meta;
|
|
11
|
+
/**
|
|
12
|
+
* This demonstrates how array validation would work with the ValidatedFormTokenField component.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Default: StoryObj<typeof ValidatedFormTokenField>;
|
|
15
|
+
//# sourceMappingURL=form-token-field.story.d.ts.map
|
package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-token-field.story.d.ts","sourceRoot":"","sources":["../../../../src/validated-form-controls/components/stories/form-token-field.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,uBAAuB,CAY/C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,uBAAuB,CAuC7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/toggle-group-control.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"toggle-group-control.d.ts","sourceRoot":"","sources":["../../../src/validated-form-controls/components/toggle-group-control.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAsErD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;2lBAEvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "30.
|
|
3
|
+
"version": "30.4.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,23 +44,23 @@
|
|
|
44
44
|
"@types/gradient-parser": "1.1.0",
|
|
45
45
|
"@types/highlight-words-core": "1.2.1",
|
|
46
46
|
"@use-gesture/react": "^10.3.1",
|
|
47
|
-
"@wordpress/a11y": "^4.
|
|
48
|
-
"@wordpress/compose": "^7.
|
|
49
|
-
"@wordpress/date": "^5.
|
|
50
|
-
"@wordpress/deprecated": "^4.
|
|
51
|
-
"@wordpress/dom": "^4.
|
|
52
|
-
"@wordpress/element": "^6.
|
|
53
|
-
"@wordpress/escape-html": "^3.
|
|
54
|
-
"@wordpress/hooks": "^4.
|
|
55
|
-
"@wordpress/html-entities": "^4.
|
|
56
|
-
"@wordpress/i18n": "^6.
|
|
57
|
-
"@wordpress/icons": "^10.
|
|
58
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
59
|
-
"@wordpress/keycodes": "^4.
|
|
60
|
-
"@wordpress/primitives": "^4.
|
|
61
|
-
"@wordpress/private-apis": "^1.
|
|
62
|
-
"@wordpress/rich-text": "^7.
|
|
63
|
-
"@wordpress/warning": "^3.
|
|
47
|
+
"@wordpress/a11y": "^4.31.0",
|
|
48
|
+
"@wordpress/compose": "^7.31.0",
|
|
49
|
+
"@wordpress/date": "^5.31.0",
|
|
50
|
+
"@wordpress/deprecated": "^4.31.0",
|
|
51
|
+
"@wordpress/dom": "^4.31.0",
|
|
52
|
+
"@wordpress/element": "^6.31.0",
|
|
53
|
+
"@wordpress/escape-html": "^3.31.0",
|
|
54
|
+
"@wordpress/hooks": "^4.31.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.31.0",
|
|
56
|
+
"@wordpress/i18n": "^6.4.0",
|
|
57
|
+
"@wordpress/icons": "^10.31.0",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.31.0",
|
|
59
|
+
"@wordpress/keycodes": "^4.31.0",
|
|
60
|
+
"@wordpress/primitives": "^4.31.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.31.0",
|
|
62
|
+
"@wordpress/rich-text": "^7.31.0",
|
|
63
|
+
"@wordpress/warning": "^3.31.0",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"clsx": "^2.1.1",
|
|
66
66
|
"colord": "^2.7.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "d7601d30d49462ea942168e8ab6bf449fb93097e"
|
|
90
90
|
}
|
package/src/private-apis.ts
CHANGED
|
@@ -13,10 +13,17 @@ import Badge from './badge';
|
|
|
13
13
|
|
|
14
14
|
import { DateCalendar, DateRangeCalendar, TZDate } from './calendar';
|
|
15
15
|
import {
|
|
16
|
+
ValidatedCheckboxControl,
|
|
17
|
+
ValidatedInputControl,
|
|
16
18
|
ValidatedNumberControl,
|
|
19
|
+
ValidatedSelectControl,
|
|
20
|
+
ValidatedRadioControl,
|
|
17
21
|
ValidatedTextControl,
|
|
22
|
+
ValidatedTextareaControl,
|
|
18
23
|
ValidatedToggleControl,
|
|
24
|
+
ValidatedToggleGroupControl,
|
|
19
25
|
} from './validated-form-controls';
|
|
26
|
+
import { Picker } from './color-picker/picker';
|
|
20
27
|
|
|
21
28
|
export const privateApis = {};
|
|
22
29
|
lock( privateApis, {
|
|
@@ -32,7 +39,14 @@ lock( privateApis, {
|
|
|
32
39
|
DateCalendar,
|
|
33
40
|
DateRangeCalendar,
|
|
34
41
|
TZDate,
|
|
42
|
+
Picker,
|
|
43
|
+
ValidatedInputControl,
|
|
44
|
+
ValidatedCheckboxControl,
|
|
35
45
|
ValidatedNumberControl,
|
|
46
|
+
ValidatedSelectControl,
|
|
47
|
+
ValidatedRadioControl,
|
|
36
48
|
ValidatedTextControl,
|
|
49
|
+
ValidatedTextareaControl,
|
|
37
50
|
ValidatedToggleControl,
|
|
51
|
+
ValidatedToggleGroupControl,
|
|
38
52
|
} );
|