@wordpress/components 19.8.0 → 19.8.1
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/build/guide/index.js +14 -8
- package/build/guide/index.js.map +1 -1
- package/build-module/guide/index.js +14 -8
- package/build-module/guide/index.js.map +1 -1
- package/build-style/style-rtl.css +0 -3
- package/build-style/style.css +0 -3
- package/build-types/input-control/stories/index.d.ts +17 -0
- package/build-types/input-control/stories/index.d.ts.map +1 -0
- package/build-types/spinner/styles/spinner-styles.d.ts +5 -0
- package/build-types/spinner/styles/spinner-styles.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts +15 -0
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +1 -0
- package/package.json +17 -17
- package/src/guide/index.js +12 -13
- package/src/guide/style.scss +0 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/build/guide/finish-button.js +0 -44
- package/build/guide/finish-button.js.map +0 -1
- package/build-module/guide/finish-button.js +0 -34
- package/build-module/guide/finish-button.js.map +0 -1
- package/src/guide/finish-button.js +0 -26
- package/src/guide/test/finish-button.js +0 -49
package/build/guide/index.js
CHANGED
|
@@ -17,14 +17,14 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
17
|
|
|
18
18
|
var _keycodes = require("@wordpress/keycodes");
|
|
19
19
|
|
|
20
|
+
var _dom = require("@wordpress/dom");
|
|
21
|
+
|
|
20
22
|
var _modal = _interopRequireDefault(require("../modal"));
|
|
21
23
|
|
|
22
24
|
var _button = _interopRequireDefault(require("../button"));
|
|
23
25
|
|
|
24
26
|
var _pageControl = _interopRequireDefault(require("./page-control"));
|
|
25
27
|
|
|
26
|
-
var _finishButton = _interopRequireDefault(require("./finish-button"));
|
|
27
|
-
|
|
28
28
|
/**
|
|
29
29
|
* External dependencies
|
|
30
30
|
*/
|
|
@@ -45,6 +45,7 @@ function Guide(_ref) {
|
|
|
45
45
|
onFinish,
|
|
46
46
|
pages = []
|
|
47
47
|
} = _ref;
|
|
48
|
+
const guideContainer = (0, _element.useRef)();
|
|
48
49
|
const [currentPage, setCurrentPage] = (0, _element.useState)(0);
|
|
49
50
|
(0, _element.useEffect)(() => {
|
|
50
51
|
if (_element.Children.count(children)) {
|
|
@@ -54,6 +55,13 @@ function Guide(_ref) {
|
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
}, [children]);
|
|
58
|
+
(0, _element.useEffect)(() => {
|
|
59
|
+
var _focus$tabbable$find, _focus$tabbable$find$;
|
|
60
|
+
|
|
61
|
+
// Each time we change the current page, start from the first element of the page.
|
|
62
|
+
// This also solves any focus loss that can happen.
|
|
63
|
+
(_focus$tabbable$find = _dom.focus.tabbable.find(guideContainer.current)) === null || _focus$tabbable$find === void 0 ? void 0 : (_focus$tabbable$find$ = _focus$tabbable$find[0]) === null || _focus$tabbable$find$ === void 0 ? void 0 : _focus$tabbable$find$.focus();
|
|
64
|
+
}, [currentPage]);
|
|
57
65
|
|
|
58
66
|
if (_element.Children.count(children)) {
|
|
59
67
|
pages = _element.Children.map(children, child => ({
|
|
@@ -90,7 +98,8 @@ function Guide(_ref) {
|
|
|
90
98
|
} else if (event.keyCode === _keycodes.RIGHT) {
|
|
91
99
|
goForward();
|
|
92
100
|
}
|
|
93
|
-
}
|
|
101
|
+
},
|
|
102
|
+
ref: guideContainer
|
|
94
103
|
}, (0, _element.createElement)("div", {
|
|
95
104
|
className: "components-guide__container"
|
|
96
105
|
}, (0, _element.createElement)("div", {
|
|
@@ -99,10 +108,7 @@ function Guide(_ref) {
|
|
|
99
108
|
currentPage: currentPage,
|
|
100
109
|
numberOfPages: pages.length,
|
|
101
110
|
setCurrentPage: setCurrentPage
|
|
102
|
-
}), pages[currentPage].content,
|
|
103
|
-
className: "components-guide__inline-finish-button",
|
|
104
|
-
onClick: onFinish
|
|
105
|
-
}, finishButtonText || (0, _i18n.__)('Finish'))), (0, _element.createElement)("div", {
|
|
111
|
+
}), pages[currentPage].content), (0, _element.createElement)("div", {
|
|
106
112
|
className: "components-guide__footer"
|
|
107
113
|
}, canGoBack && (0, _element.createElement)(_button.default, {
|
|
108
114
|
className: "components-guide__back-button",
|
|
@@ -110,7 +116,7 @@ function Guide(_ref) {
|
|
|
110
116
|
}, (0, _i18n.__)('Previous')), canGoForward && (0, _element.createElement)(_button.default, {
|
|
111
117
|
className: "components-guide__forward-button",
|
|
112
118
|
onClick: goForward
|
|
113
|
-
}, (0, _i18n.__)('Next')), !canGoForward && (0, _element.createElement)(
|
|
119
|
+
}, (0, _i18n.__)('Next')), !canGoForward && (0, _element.createElement)(_button.default, {
|
|
114
120
|
className: "components-guide__finish-button",
|
|
115
121
|
onClick: onFinish
|
|
116
122
|
}, finishButtonText || (0, _i18n.__)('Finish')))));
|
package/build/guide/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/guide/index.js"],"names":["Guide","children","className","contentLabel","finishButtonText","onFinish","pages","currentPage","setCurrentPage","Children","count","since","alternative","map","child","content","canGoBack","canGoForward","length","goBack","goForward","event","keyCode","LEFT","RIGHT","image"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/guide/index.js"],"names":["Guide","children","className","contentLabel","finishButtonText","onFinish","pages","guideContainer","currentPage","setCurrentPage","Children","count","since","alternative","tabbable","find","current","focus","map","child","content","canGoBack","canGoForward","length","goBack","goForward","event","keyCode","LEFT","RIGHT","image"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect, Children, useRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport Button from '../button';\nimport PageControl from './page-control';\n\nexport default function Guide( {\n\tchildren,\n\tclassName,\n\tcontentLabel,\n\tfinishButtonText,\n\tonFinish,\n\tpages = [],\n} ) {\n\tconst guideContainer = useRef();\n\tconst [ currentPage, setCurrentPage ] = useState( 0 );\n\n\tuseEffect( () => {\n\t\tif ( Children.count( children ) ) {\n\t\t\tdeprecated( 'Passing children to <Guide>', {\n\t\t\t\tsince: '5.5',\n\t\t\t\talternative: 'the `pages` prop',\n\t\t\t} );\n\t\t}\n\t}, [ children ] );\n\n\tuseEffect( () => {\n\t\t// Each time we change the current page, start from the first element of the page.\n\t\t// This also solves any focus loss that can happen.\n\t\tfocus.tabbable.find( guideContainer.current )?.[ 0 ]?.focus();\n\t}, [ currentPage ] );\n\n\tif ( Children.count( children ) ) {\n\t\tpages = Children.map( children, ( child ) => ( { content: child } ) );\n\t}\n\n\tconst canGoBack = currentPage > 0;\n\tconst canGoForward = currentPage < pages.length - 1;\n\n\tconst goBack = () => {\n\t\tif ( canGoBack ) {\n\t\t\tsetCurrentPage( currentPage - 1 );\n\t\t}\n\t};\n\n\tconst goForward = () => {\n\t\tif ( canGoForward ) {\n\t\t\tsetCurrentPage( currentPage + 1 );\n\t\t}\n\t};\n\n\tif ( pages.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName={ classnames( 'components-guide', className ) }\n\t\t\tcontentLabel={ contentLabel }\n\t\t\tonRequestClose={ onFinish }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.keyCode === LEFT ) {\n\t\t\t\t\tgoBack();\n\t\t\t\t} else if ( event.keyCode === RIGHT ) {\n\t\t\t\t\tgoForward();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tref={ guideContainer }\n\t\t>\n\t\t\t<div className=\"components-guide__container\">\n\t\t\t\t<div className=\"components-guide__page\">\n\t\t\t\t\t{ pages[ currentPage ].image }\n\n\t\t\t\t\t{ pages.length > 1 && (\n\t\t\t\t\t\t<PageControl\n\t\t\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\t\t\tnumberOfPages={ pages.length }\n\t\t\t\t\t\t\tsetCurrentPage={ setCurrentPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ pages[ currentPage ].content }\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"components-guide__footer\">\n\t\t\t\t\t{ canGoBack && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-guide__back-button\"\n\t\t\t\t\t\t\tonClick={ goBack }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Previous' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canGoForward && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-guide__forward-button\"\n\t\t\t\t\t\t\tonClick={ goForward }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Next' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canGoForward && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-guide__finish-button\"\n\t\t\t\t\t\t\tonClick={ onFinish }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ finishButtonText || __( 'Finish' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -8,10 +8,11 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useState, useEffect, Children } from '@wordpress/element';
|
|
11
|
+
import { useState, useEffect, Children, useRef } from '@wordpress/element';
|
|
12
12
|
import deprecated from '@wordpress/deprecated';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { LEFT, RIGHT } from '@wordpress/keycodes';
|
|
15
|
+
import { focus } from '@wordpress/dom';
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
@@ -19,7 +20,6 @@ import { LEFT, RIGHT } from '@wordpress/keycodes';
|
|
|
19
20
|
import Modal from '../modal';
|
|
20
21
|
import Button from '../button';
|
|
21
22
|
import PageControl from './page-control';
|
|
22
|
-
import FinishButton from './finish-button';
|
|
23
23
|
export default function Guide(_ref) {
|
|
24
24
|
let {
|
|
25
25
|
children,
|
|
@@ -29,6 +29,7 @@ export default function Guide(_ref) {
|
|
|
29
29
|
onFinish,
|
|
30
30
|
pages = []
|
|
31
31
|
} = _ref;
|
|
32
|
+
const guideContainer = useRef();
|
|
32
33
|
const [currentPage, setCurrentPage] = useState(0);
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
if (Children.count(children)) {
|
|
@@ -38,6 +39,13 @@ export default function Guide(_ref) {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
}, [children]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
var _focus$tabbable$find, _focus$tabbable$find$;
|
|
44
|
+
|
|
45
|
+
// Each time we change the current page, start from the first element of the page.
|
|
46
|
+
// This also solves any focus loss that can happen.
|
|
47
|
+
(_focus$tabbable$find = focus.tabbable.find(guideContainer.current)) === null || _focus$tabbable$find === void 0 ? void 0 : (_focus$tabbable$find$ = _focus$tabbable$find[0]) === null || _focus$tabbable$find$ === void 0 ? void 0 : _focus$tabbable$find$.focus();
|
|
48
|
+
}, [currentPage]);
|
|
41
49
|
|
|
42
50
|
if (Children.count(children)) {
|
|
43
51
|
pages = Children.map(children, child => ({
|
|
@@ -74,7 +82,8 @@ export default function Guide(_ref) {
|
|
|
74
82
|
} else if (event.keyCode === RIGHT) {
|
|
75
83
|
goForward();
|
|
76
84
|
}
|
|
77
|
-
}
|
|
85
|
+
},
|
|
86
|
+
ref: guideContainer
|
|
78
87
|
}, createElement("div", {
|
|
79
88
|
className: "components-guide__container"
|
|
80
89
|
}, createElement("div", {
|
|
@@ -83,10 +92,7 @@ export default function Guide(_ref) {
|
|
|
83
92
|
currentPage: currentPage,
|
|
84
93
|
numberOfPages: pages.length,
|
|
85
94
|
setCurrentPage: setCurrentPage
|
|
86
|
-
}), pages[currentPage].content,
|
|
87
|
-
className: "components-guide__inline-finish-button",
|
|
88
|
-
onClick: onFinish
|
|
89
|
-
}, finishButtonText || __('Finish'))), createElement("div", {
|
|
95
|
+
}), pages[currentPage].content), createElement("div", {
|
|
90
96
|
className: "components-guide__footer"
|
|
91
97
|
}, canGoBack && createElement(Button, {
|
|
92
98
|
className: "components-guide__back-button",
|
|
@@ -94,7 +100,7 @@ export default function Guide(_ref) {
|
|
|
94
100
|
}, __('Previous')), canGoForward && createElement(Button, {
|
|
95
101
|
className: "components-guide__forward-button",
|
|
96
102
|
onClick: goForward
|
|
97
|
-
}, __('Next')), !canGoForward && createElement(
|
|
103
|
+
}, __('Next')), !canGoForward && createElement(Button, {
|
|
98
104
|
className: "components-guide__finish-button",
|
|
99
105
|
onClick: onFinish
|
|
100
106
|
}, finishButtonText || __('Finish')))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/guide/index.js"],"names":["classnames","useState","useEffect","Children","deprecated","__","LEFT","RIGHT","Modal","Button","PageControl","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/guide/index.js"],"names":["classnames","useState","useEffect","Children","useRef","deprecated","__","LEFT","RIGHT","focus","Modal","Button","PageControl","Guide","children","className","contentLabel","finishButtonText","onFinish","pages","guideContainer","currentPage","setCurrentPage","count","since","alternative","tabbable","find","current","map","child","content","canGoBack","canGoForward","length","goBack","goForward","event","keyCode","image"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect, Children, useRef } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport Button from '../button';\nimport PageControl from './page-control';\n\nexport default function Guide( {\n\tchildren,\n\tclassName,\n\tcontentLabel,\n\tfinishButtonText,\n\tonFinish,\n\tpages = [],\n} ) {\n\tconst guideContainer = useRef();\n\tconst [ currentPage, setCurrentPage ] = useState( 0 );\n\n\tuseEffect( () => {\n\t\tif ( Children.count( children ) ) {\n\t\t\tdeprecated( 'Passing children to <Guide>', {\n\t\t\t\tsince: '5.5',\n\t\t\t\talternative: 'the `pages` prop',\n\t\t\t} );\n\t\t}\n\t}, [ children ] );\n\n\tuseEffect( () => {\n\t\t// Each time we change the current page, start from the first element of the page.\n\t\t// This also solves any focus loss that can happen.\n\t\tfocus.tabbable.find( guideContainer.current )?.[ 0 ]?.focus();\n\t}, [ currentPage ] );\n\n\tif ( Children.count( children ) ) {\n\t\tpages = Children.map( children, ( child ) => ( { content: child } ) );\n\t}\n\n\tconst canGoBack = currentPage > 0;\n\tconst canGoForward = currentPage < pages.length - 1;\n\n\tconst goBack = () => {\n\t\tif ( canGoBack ) {\n\t\t\tsetCurrentPage( currentPage - 1 );\n\t\t}\n\t};\n\n\tconst goForward = () => {\n\t\tif ( canGoForward ) {\n\t\t\tsetCurrentPage( currentPage + 1 );\n\t\t}\n\t};\n\n\tif ( pages.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName={ classnames( 'components-guide', className ) }\n\t\t\tcontentLabel={ contentLabel }\n\t\t\tonRequestClose={ onFinish }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.keyCode === LEFT ) {\n\t\t\t\t\tgoBack();\n\t\t\t\t} else if ( event.keyCode === RIGHT ) {\n\t\t\t\t\tgoForward();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tref={ guideContainer }\n\t\t>\n\t\t\t<div className=\"components-guide__container\">\n\t\t\t\t<div className=\"components-guide__page\">\n\t\t\t\t\t{ pages[ currentPage ].image }\n\n\t\t\t\t\t{ pages.length > 1 && (\n\t\t\t\t\t\t<PageControl\n\t\t\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\t\t\tnumberOfPages={ pages.length }\n\t\t\t\t\t\t\tsetCurrentPage={ setCurrentPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ pages[ currentPage ].content }\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"components-guide__footer\">\n\t\t\t\t\t{ canGoBack && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-guide__back-button\"\n\t\t\t\t\t\t\tonClick={ goBack }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Previous' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canGoForward && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-guide__forward-button\"\n\t\t\t\t\t\t\tonClick={ goForward }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Next' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canGoForward && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-guide__finish-button\"\n\t\t\t\t\t\t\tonClick={ onFinish }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ finishButtonText || __( 'Finish' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -3036,9 +3036,6 @@ body.is-dragging-components-draggable {
|
|
|
3036
3036
|
.components-button.components-guide__finish-button {
|
|
3037
3037
|
left: 32px;
|
|
3038
3038
|
}
|
|
3039
|
-
.components-button.components-guide__inline-finish-button {
|
|
3040
|
-
display: none;
|
|
3041
|
-
}
|
|
3042
3039
|
|
|
3043
3040
|
[role=region] {
|
|
3044
3041
|
position: relative;
|
package/build-style/style.css
CHANGED
|
@@ -3044,9 +3044,6 @@ body.is-dragging-components-draggable {
|
|
|
3044
3044
|
.components-button.components-guide__finish-button {
|
|
3045
3045
|
right: 32px;
|
|
3046
3046
|
}
|
|
3047
|
-
.components-button.components-guide__inline-finish-button {
|
|
3048
|
-
display: none;
|
|
3049
|
-
}
|
|
3050
3047
|
|
|
3051
3048
|
[role=region] {
|
|
3052
3049
|
position: relative;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import InputControl from '..';
|
|
10
|
+
declare const meta: ComponentMeta<typeof InputControl>;
|
|
11
|
+
export default meta;
|
|
12
|
+
export declare const Default: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("../types").InputControlProps, "dangerouslySetInnerHTML" | "onDrag" | "onDragStart" | "onDragEnd" | "onWheel" | "onScroll" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "type" | "width" | "color" | "hidden" | "prefix" | "suffix" | "disabled" | "className" | "id" | "label" | "__unstableInputWidth" | "hideLabelFromVision" | "labelPosition" | "size" | "form" | "slot" | "style" | "title" | "pattern" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dragDirection" | "dragThreshold" | "isDragEnabled" | "isPressEnterToChange" | "onValidate" | "__unstableStateReducer"> & import("react").RefAttributes<HTMLInputElement>>>;
|
|
13
|
+
export declare const WithPrefix: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("../types").InputControlProps, "dangerouslySetInnerHTML" | "onDrag" | "onDragStart" | "onDragEnd" | "onWheel" | "onScroll" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "type" | "width" | "color" | "hidden" | "prefix" | "suffix" | "disabled" | "className" | "id" | "label" | "__unstableInputWidth" | "hideLabelFromVision" | "labelPosition" | "size" | "form" | "slot" | "style" | "title" | "pattern" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dragDirection" | "dragThreshold" | "isDragEnabled" | "isPressEnterToChange" | "onValidate" | "__unstableStateReducer"> & import("react").RefAttributes<HTMLInputElement>>>;
|
|
14
|
+
export declare const WithSuffix: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("../types").InputControlProps, "dangerouslySetInnerHTML" | "onDrag" | "onDragStart" | "onDragEnd" | "onWheel" | "onScroll" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "type" | "width" | "color" | "hidden" | "prefix" | "suffix" | "disabled" | "className" | "id" | "label" | "__unstableInputWidth" | "hideLabelFromVision" | "labelPosition" | "size" | "form" | "slot" | "style" | "title" | "pattern" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dragDirection" | "dragThreshold" | "isDragEnabled" | "isPressEnterToChange" | "onValidate" | "__unstableStateReducer"> & import("react").RefAttributes<HTMLInputElement>>>;
|
|
15
|
+
export declare const WithSideLabel: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("../types").InputControlProps, "dangerouslySetInnerHTML" | "onDrag" | "onDragStart" | "onDragEnd" | "onWheel" | "onScroll" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "type" | "width" | "color" | "hidden" | "prefix" | "suffix" | "disabled" | "className" | "id" | "label" | "__unstableInputWidth" | "hideLabelFromVision" | "labelPosition" | "size" | "form" | "slot" | "style" | "title" | "pattern" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dragDirection" | "dragThreshold" | "isDragEnabled" | "isPressEnterToChange" | "onValidate" | "__unstableStateReducer"> & import("react").RefAttributes<HTMLInputElement>>>;
|
|
16
|
+
export declare const WithEdgeLabel: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("../types").InputControlProps, "dangerouslySetInnerHTML" | "onDrag" | "onDragStart" | "onDragEnd" | "onWheel" | "onScroll" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "type" | "width" | "color" | "hidden" | "prefix" | "suffix" | "disabled" | "className" | "id" | "label" | "__unstableInputWidth" | "hideLabelFromVision" | "labelPosition" | "size" | "form" | "slot" | "style" | "title" | "pattern" | "key" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dragDirection" | "dragThreshold" | "isDragEnabled" | "isPressEnterToChange" | "onValidate" | "__unstableStateReducer"> & import("react").RefAttributes<HTMLInputElement>>>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input-control/stories/index.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE;;GAEG;AACH,OAAO,YAAY,MAAM,IAAI,CAAC;AAE9B,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,YAAY,CAe7C,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,+tKAAsB,CAAC;AAO3C,eAAO,MAAM,UAAU,+tKAAsB,CAAC;AAM9C,eAAO,MAAM,UAAU,+tKAAsB,CAAC;AAM9C,eAAO,MAAM,aAAa,+tKAAsB,CAAC;AAMjD,eAAO,MAAM,aAAa,+tKAAsB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const StyledSpinner: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
3
|
+
as?: import("react").ElementType<any> | undefined;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
+
//# sourceMappingURL=spinner-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner-styles.d.ts","sourceRoot":"","sources":["../../../src/spinner/styles/spinner-styles.js"],"names":[],"mappings":"AAuBA;;;4GAuBE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const LabelView: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const labelBlock: import("@emotion/utils").SerializedStyles;
|
|
7
|
+
export declare const buttonView: import("@emotion/utils").SerializedStyles;
|
|
8
|
+
export declare const buttonActive: import("@emotion/utils").SerializedStyles;
|
|
9
|
+
export declare const ButtonContentView: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
11
|
+
as?: import("react").ElementType<any> | undefined;
|
|
12
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
+
export declare const separatorActive: import("@emotion/utils").SerializedStyles;
|
|
14
|
+
export declare const medium: import("@emotion/utils").SerializedStyles;
|
|
15
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option/styles.ts"],"names":[],"mappings":";AAWA,eAAO,MAAM,SAAS;;;yGAKrB,CAAC;AAEF,eAAO,MAAM,UAAU,2CAEtB,CAAC;AAEF,eAAO,MAAM,UAAU,2CA+BtB,CAAC;AAEF,eAAO,MAAM,YAAY,2CAGxB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;yGAG7B,CAAC;AAEF,eAAO,MAAM,eAAe,2CAE3B,CAAC;AAEF,eAAO,MAAM,MAAM,2CAElB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "19.8.
|
|
3
|
+
"version": "19.8.1",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"@emotion/styled": "^11.6.0",
|
|
38
38
|
"@emotion/utils": "1.0.0",
|
|
39
39
|
"@use-gesture/react": "^10.2.6",
|
|
40
|
-
"@wordpress/a11y": "^3.6.
|
|
41
|
-
"@wordpress/compose": "^5.4.
|
|
42
|
-
"@wordpress/date": "^4.6.
|
|
43
|
-
"@wordpress/deprecated": "^3.6.
|
|
44
|
-
"@wordpress/dom": "^3.6.
|
|
45
|
-
"@wordpress/element": "^4.4.
|
|
46
|
-
"@wordpress/escape-html": "^2.6.
|
|
47
|
-
"@wordpress/hooks": "^3.6.
|
|
48
|
-
"@wordpress/i18n": "^4.6.
|
|
49
|
-
"@wordpress/icons": "^8.2.
|
|
50
|
-
"@wordpress/is-shallow-equal": "^4.6.
|
|
51
|
-
"@wordpress/keycodes": "^3.6.
|
|
52
|
-
"@wordpress/primitives": "^3.4.
|
|
53
|
-
"@wordpress/rich-text": "^5.4.
|
|
54
|
-
"@wordpress/warning": "^2.6.
|
|
40
|
+
"@wordpress/a11y": "^3.6.1",
|
|
41
|
+
"@wordpress/compose": "^5.4.1",
|
|
42
|
+
"@wordpress/date": "^4.6.1",
|
|
43
|
+
"@wordpress/deprecated": "^3.6.1",
|
|
44
|
+
"@wordpress/dom": "^3.6.1",
|
|
45
|
+
"@wordpress/element": "^4.4.1",
|
|
46
|
+
"@wordpress/escape-html": "^2.6.1",
|
|
47
|
+
"@wordpress/hooks": "^3.6.1",
|
|
48
|
+
"@wordpress/i18n": "^4.6.1",
|
|
49
|
+
"@wordpress/icons": "^8.2.1",
|
|
50
|
+
"@wordpress/is-shallow-equal": "^4.6.1",
|
|
51
|
+
"@wordpress/keycodes": "^3.6.1",
|
|
52
|
+
"@wordpress/primitives": "^3.4.1",
|
|
53
|
+
"@wordpress/rich-text": "^5.4.1",
|
|
54
|
+
"@wordpress/warning": "^2.6.1",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"colord": "^2.7.0",
|
|
57
57
|
"dom-scroll-into-view": "^1.2.1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "446565ecaa40370173c18926535e975ec5652b71"
|
|
80
80
|
}
|
package/src/guide/index.js
CHANGED
|
@@ -6,10 +6,11 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useState, useEffect, Children } from '@wordpress/element';
|
|
9
|
+
import { useState, useEffect, Children, useRef } from '@wordpress/element';
|
|
10
10
|
import deprecated from '@wordpress/deprecated';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { LEFT, RIGHT } from '@wordpress/keycodes';
|
|
13
|
+
import { focus } from '@wordpress/dom';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -17,7 +18,6 @@ import { LEFT, RIGHT } from '@wordpress/keycodes';
|
|
|
17
18
|
import Modal from '../modal';
|
|
18
19
|
import Button from '../button';
|
|
19
20
|
import PageControl from './page-control';
|
|
20
|
-
import FinishButton from './finish-button';
|
|
21
21
|
|
|
22
22
|
export default function Guide( {
|
|
23
23
|
children,
|
|
@@ -27,6 +27,7 @@ export default function Guide( {
|
|
|
27
27
|
onFinish,
|
|
28
28
|
pages = [],
|
|
29
29
|
} ) {
|
|
30
|
+
const guideContainer = useRef();
|
|
30
31
|
const [ currentPage, setCurrentPage ] = useState( 0 );
|
|
31
32
|
|
|
32
33
|
useEffect( () => {
|
|
@@ -38,6 +39,12 @@ export default function Guide( {
|
|
|
38
39
|
}
|
|
39
40
|
}, [ children ] );
|
|
40
41
|
|
|
42
|
+
useEffect( () => {
|
|
43
|
+
// Each time we change the current page, start from the first element of the page.
|
|
44
|
+
// This also solves any focus loss that can happen.
|
|
45
|
+
focus.tabbable.find( guideContainer.current )?.[ 0 ]?.focus();
|
|
46
|
+
}, [ currentPage ] );
|
|
47
|
+
|
|
41
48
|
if ( Children.count( children ) ) {
|
|
42
49
|
pages = Children.map( children, ( child ) => ( { content: child } ) );
|
|
43
50
|
}
|
|
@@ -73,6 +80,7 @@ export default function Guide( {
|
|
|
73
80
|
goForward();
|
|
74
81
|
}
|
|
75
82
|
} }
|
|
83
|
+
ref={ guideContainer }
|
|
76
84
|
>
|
|
77
85
|
<div className="components-guide__container">
|
|
78
86
|
<div className="components-guide__page">
|
|
@@ -87,15 +95,6 @@ export default function Guide( {
|
|
|
87
95
|
) }
|
|
88
96
|
|
|
89
97
|
{ pages[ currentPage ].content }
|
|
90
|
-
|
|
91
|
-
{ ! canGoForward && (
|
|
92
|
-
<FinishButton
|
|
93
|
-
className="components-guide__inline-finish-button"
|
|
94
|
-
onClick={ onFinish }
|
|
95
|
-
>
|
|
96
|
-
{ finishButtonText || __( 'Finish' ) }
|
|
97
|
-
</FinishButton>
|
|
98
|
-
) }
|
|
99
98
|
</div>
|
|
100
99
|
|
|
101
100
|
<div className="components-guide__footer">
|
|
@@ -116,12 +115,12 @@ export default function Guide( {
|
|
|
116
115
|
</Button>
|
|
117
116
|
) }
|
|
118
117
|
{ ! canGoForward && (
|
|
119
|
-
<
|
|
118
|
+
<Button
|
|
120
119
|
className="components-guide__finish-button"
|
|
121
120
|
onClick={ onFinish }
|
|
122
121
|
>
|
|
123
122
|
{ finishButtonText || __( 'Finish' ) }
|
|
124
|
-
</
|
|
123
|
+
</Button>
|
|
125
124
|
) }
|
|
126
125
|
</div>
|
|
127
126
|
</div>
|