carbon-react 110.1.3 → 110.2.2
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/esm/__internal__/character-count/character-count.component.d.ts +8 -25
- package/esm/__internal__/character-count/character-count.component.js +12 -18
- package/esm/__internal__/character-count/character-count.style.d.ts +3 -1
- package/esm/__internal__/character-count/character-count.style.js +4 -0
- package/esm/__internal__/input/index.d.ts +1 -1
- package/esm/__spec_helper__/test-utils.d.ts +3 -2
- package/esm/__spec_helper__/test-utils.js +17 -1
- package/esm/components/box/box.component.d.ts +4 -2
- package/esm/components/box/box.component.js +2 -1
- package/esm/components/dismissible-box/dismissible-box.component.js +398 -0
- package/esm/components/numeral-date/numeral-date-context.d.ts +6 -0
- package/esm/components/popover-container/popover-container.component.d.ts +2 -0
- package/esm/components/popover-container/popover-container.component.js +9 -4
- package/esm/components/portal/portal.d.ts +15 -12
- package/esm/components/portal/portal.js +3 -13
- package/esm/components/select/multi-select/multi-select.component.js +1 -1
- package/esm/components/select/select-list/select-list.component.js +20 -11
- package/esm/components/textarea/textarea.component.js +6 -27
- package/esm/components/textarea/textarea.d.ts +2 -1
- package/esm/components/textbox/__internal__/prefix.style.d.ts +2 -0
- package/esm/components/textbox/index.d.ts +2 -1
- package/esm/components/textbox/index.js +1 -1
- package/esm/components/textbox/textbox.component.d.ts +92 -0
- package/esm/components/textbox/textbox.component.js +533 -197
- package/esm/components/textbox/textbox.style.d.ts +5 -0
- package/esm/components/textbox/textbox.style.js +0 -12
- package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +1 -1
- package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.js +7 -6
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +6 -5
- package/esm/style/utils/filter-out-position-props.d.ts +3 -0
- package/esm/style/utils/filter-out-position-props.js +5 -0
- package/lib/__internal__/character-count/character-count.component.d.ts +8 -25
- package/lib/__internal__/character-count/character-count.component.js +13 -23
- package/lib/__internal__/character-count/character-count.style.d.ts +3 -1
- package/lib/__internal__/character-count/character-count.style.js +7 -0
- package/lib/__internal__/input/index.d.ts +1 -1
- package/lib/__spec_helper__/test-utils.d.ts +3 -2
- package/lib/__spec_helper__/test-utils.js +20 -2
- package/lib/components/box/box.component.d.ts +4 -2
- package/lib/components/box/box.component.js +1 -0
- package/lib/components/dismissible-box/dismissible-box.component.js +398 -0
- package/lib/components/numeral-date/numeral-date-context.d.ts +6 -0
- package/lib/components/popover-container/popover-container.component.d.ts +2 -0
- package/lib/components/popover-container/popover-container.component.js +9 -4
- package/lib/components/portal/portal.d.ts +15 -12
- package/lib/components/portal/portal.js +3 -14
- package/lib/components/select/multi-select/multi-select.component.js +1 -1
- package/lib/components/select/select-list/select-list.component.js +20 -11
- package/lib/components/textarea/textarea.component.js +6 -27
- package/lib/components/textarea/textarea.d.ts +2 -1
- package/lib/components/textbox/__internal__/prefix.style.d.ts +2 -0
- package/lib/components/textbox/index.d.ts +2 -1
- package/lib/components/textbox/index.js +2 -10
- package/lib/components/textbox/textbox.component.d.ts +92 -0
- package/lib/components/textbox/textbox.component.js +534 -201
- package/lib/components/textbox/textbox.style.d.ts +5 -0
- package/lib/components/textbox/textbox.style.js +1 -16
- package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +1 -1
- package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.js +7 -6
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +6 -5
- package/lib/style/utils/filter-out-position-props.d.ts +3 -0
- package/lib/style/utils/filter-out-position-props.js +18 -0
- package/package.json +1 -1
- package/esm/components/textbox/textbox.d.ts +0 -125
- package/lib/components/textbox/textbox.d.ts +0 -125
|
@@ -16,20 +16,25 @@ const renderOpen = ({
|
|
|
16
16
|
"data-element": dataElement,
|
|
17
17
|
ref,
|
|
18
18
|
"aria-label": ariaLabel,
|
|
19
|
-
id
|
|
19
|
+
id,
|
|
20
|
+
"aria-expanded": ariaExpanded,
|
|
21
|
+
"aria-haspopup": ariaHasPopup
|
|
20
22
|
}) => /*#__PURE__*/React.createElement(PopoverContainerOpenIcon, {
|
|
21
23
|
tabIndex: tabIndex,
|
|
22
24
|
onAction: onClick,
|
|
23
25
|
"data-element": dataElement,
|
|
24
26
|
ref: ref,
|
|
25
27
|
"aria-label": ariaLabel,
|
|
26
|
-
"aria-haspopup":
|
|
28
|
+
"aria-haspopup": ariaHasPopup,
|
|
29
|
+
"aria-expanded": ariaExpanded,
|
|
27
30
|
id: id
|
|
28
31
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
29
32
|
type: "settings"
|
|
30
33
|
}));
|
|
31
34
|
|
|
32
35
|
renderOpen.propTypes = {
|
|
36
|
+
"aria-expanded": PropTypes.bool.isRequired,
|
|
37
|
+
"aria-haspopup": PropTypes.oneOf(["dialog"]).isRequired,
|
|
33
38
|
"aria-label": PropTypes.string,
|
|
34
39
|
"data-element": PropTypes.string.isRequired,
|
|
35
40
|
"id": PropTypes.string,
|
|
@@ -122,6 +127,8 @@ const PopoverContainer = ({
|
|
|
122
127
|
|
|
123
128
|
const renderOpenComponentProps = {
|
|
124
129
|
tabIndex: isOpen ? -1 : 0,
|
|
130
|
+
"aria-expanded": isOpen,
|
|
131
|
+
"aria-haspopup": "dialog",
|
|
125
132
|
isOpen,
|
|
126
133
|
"data-element": "popover-container-open-component",
|
|
127
134
|
onClick: handleOpenButtonClick,
|
|
@@ -145,8 +152,6 @@ const PopoverContainer = ({
|
|
|
145
152
|
const handleClick = useClickAwayListener(handleClickAway, "mousedown");
|
|
146
153
|
return /*#__PURE__*/React.createElement(PopoverContainerWrapperStyle, {
|
|
147
154
|
"data-component": "popover-container",
|
|
148
|
-
role: "region",
|
|
149
|
-
"aria-labelledby": popoverContainerId,
|
|
150
155
|
onMouseDown: handleClick
|
|
151
156
|
}, renderOpenComponent(renderOpenComponentProps), /*#__PURE__*/React.createElement(Transition, {
|
|
152
157
|
in: isOpen,
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** The content of the portal. */
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
id?: string;
|
|
8
|
-
/** Callback function triggered when parent element is scrolled or window resized. */
|
|
9
|
-
onReposition?: () => void;
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface PortalContextProps {
|
|
3
|
+
renderInRoot?: boolean;
|
|
10
4
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
export declare const PortalContext: React.Context<PortalContextProps>;
|
|
6
|
+
interface PortalProps {
|
|
7
|
+
/** The content of the portal. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Classname attached to portal container. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Id attribute attached to portal container. */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Callback function triggered when parent element is scrolled or window resized. */
|
|
14
|
+
onReposition?: () => void;
|
|
15
|
+
}
|
|
16
|
+
declare const Portal: ({ children, className, id, onReposition }: PortalProps) => JSX.Element;
|
|
14
17
|
export default Portal;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useMemo, useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import ReactDOM from "react-dom";
|
|
4
3
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
5
4
|
import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
|
|
@@ -30,13 +29,13 @@ const Portal = ({
|
|
|
30
29
|
}, [onReposition]);
|
|
31
30
|
useEffect(() => {
|
|
32
31
|
return () => {
|
|
33
|
-
portalNode.remove();
|
|
32
|
+
portalNode === null || portalNode === void 0 ? void 0 : portalNode.remove();
|
|
34
33
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
34
|
}, []);
|
|
36
35
|
|
|
37
36
|
const addClassNames = node => {
|
|
38
|
-
className.split(" ").forEach(el => {
|
|
39
|
-
node.classList.add(el);
|
|
37
|
+
className === null || className === void 0 ? void 0 : className.split(" ").forEach(el => {
|
|
38
|
+
node === null || node === void 0 ? void 0 : node.classList.add(el);
|
|
40
39
|
});
|
|
41
40
|
return node;
|
|
42
41
|
};
|
|
@@ -80,13 +79,4 @@ const Portal = ({
|
|
|
80
79
|
}, /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(CarbonScopedTokensProvider, null, children), getPortalContainer()));
|
|
81
80
|
};
|
|
82
81
|
|
|
83
|
-
Portal.propTypes = {
|
|
84
|
-
/** The content of the portal. */
|
|
85
|
-
children: PropTypes.node,
|
|
86
|
-
className: PropTypes.string,
|
|
87
|
-
id: PropTypes.string,
|
|
88
|
-
|
|
89
|
-
/** Callback function triggered when parent element is scrolled or window resized. */
|
|
90
|
-
onReposition: PropTypes.func
|
|
91
|
-
};
|
|
92
82
|
export default Portal;
|
|
@@ -208,7 +208,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
208
208
|
wrapText: wrapPillText
|
|
209
209
|
}, pillProps), title));
|
|
210
210
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
211
|
-
}, [children, disabled, readOnly,
|
|
211
|
+
}, [children, disabled, readOnly, actualValue]);
|
|
212
212
|
useEffect(() => {
|
|
213
213
|
const modeSwitchedMessage = "Input elements should not switch from uncontrolled to controlled (or vice versa). " + "Decide between using a controlled or uncontrolled input element for the lifetime of the component";
|
|
214
214
|
const onChangeMissingMessage = "onChange prop required when using a controlled input element";
|
|
@@ -61,6 +61,24 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
61
61
|
blockScroll,
|
|
62
62
|
allowScroll
|
|
63
63
|
} = useScrollBlock();
|
|
64
|
+
|
|
65
|
+
const updateListHeight = () => {
|
|
66
|
+
let newHeight = listRef.current.clientHeight;
|
|
67
|
+
|
|
68
|
+
if (listActionButtonRef.current) {
|
|
69
|
+
newHeight += listActionButtonRef.current.parentElement.clientHeight;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setListHeight(`${newHeight}px`);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const listCallbackRef = useCallback(element => {
|
|
76
|
+
listRef.current = element;
|
|
77
|
+
|
|
78
|
+
if (element) {
|
|
79
|
+
setTimeout(updateListHeight, 0);
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
64
82
|
useEffect(() => {
|
|
65
83
|
blockScroll();
|
|
66
84
|
return () => {
|
|
@@ -225,16 +243,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
225
243
|
window.removeEventListener("resize", assignListWidth);
|
|
226
244
|
};
|
|
227
245
|
}, [assignListWidth]);
|
|
228
|
-
useLayoutEffect(
|
|
229
|
-
let newHeight;
|
|
230
|
-
newHeight = listRef.current.clientHeight;
|
|
231
|
-
|
|
232
|
-
if (listActionButtonRef.current) {
|
|
233
|
-
newHeight += listActionButtonRef.current.parentElement.clientHeight;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
setListHeight(`${newHeight}px`);
|
|
237
|
-
}, [children]);
|
|
246
|
+
useLayoutEffect(updateListHeight, [children]);
|
|
238
247
|
useEffect(() => {
|
|
239
248
|
const keyboardEvent = "keydown";
|
|
240
249
|
const listElement = listRef.current;
|
|
@@ -325,7 +334,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
|
|
|
325
334
|
"aria-labelledby": labelId,
|
|
326
335
|
"data-element": "select-list",
|
|
327
336
|
role: "listbox",
|
|
328
|
-
ref:
|
|
337
|
+
ref: listCallbackRef,
|
|
329
338
|
tabIndex: "-1",
|
|
330
339
|
isLoading: isLoading,
|
|
331
340
|
multiColumn: multiColumn
|
|
@@ -5,22 +5,18 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
6
|
import { InputPresentation } from "../../__internal__/input";
|
|
7
7
|
import FormField from "../../__internal__/form-field";
|
|
8
|
-
import
|
|
8
|
+
import useCharacterCount from "../../hooks/__internal__/useCharacterCount";
|
|
9
9
|
import Input from "../../__internal__/input/input.component";
|
|
10
10
|
import { InputBehaviour } from "../../__internal__/input-behaviour";
|
|
11
11
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
12
12
|
import InputIconToggle from "../../__internal__/input-icon-toggle";
|
|
13
13
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
14
14
|
import StyledTextarea, { MIN_HEIGHT } from "./textarea.style";
|
|
15
|
-
import LocaleContext from "../../__internal__/i18n-context";
|
|
16
15
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
17
16
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
18
17
|
import { NewValidationContext } from "../carbon-provider/carbon-provider.component";
|
|
19
18
|
import { ErrorBorder, StyledHintText } from "../textbox/textbox.style";
|
|
20
19
|
import ValidationMessage from "../../__internal__/validation-message";
|
|
21
|
-
|
|
22
|
-
const getFormatNumber = (value, locale) => new Intl.NumberFormat(locale).format(value);
|
|
23
|
-
|
|
24
20
|
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
25
21
|
|
|
26
22
|
const Textarea = ({
|
|
@@ -61,7 +57,6 @@ const Textarea = ({
|
|
|
61
57
|
helpAriaLabel,
|
|
62
58
|
...props
|
|
63
59
|
}) => {
|
|
64
|
-
const locale = useContext(LocaleContext);
|
|
65
60
|
const {
|
|
66
61
|
validationRedesignOptIn
|
|
67
62
|
} = useContext(NewValidationContext);
|
|
@@ -98,6 +93,8 @@ const Textarea = ({
|
|
|
98
93
|
label,
|
|
99
94
|
fieldHelp
|
|
100
95
|
});
|
|
96
|
+
const [maxLength, characterCount] = useCharacterCount(value, // TODO: Can be removed after the characterLimit type is changed to number
|
|
97
|
+
typeof characterLimit === "string" ? parseInt(characterLimit, 10) : characterLimit, warnOverLimit, enforceCharacterLimit);
|
|
101
98
|
useEffect(() => {
|
|
102
99
|
if (rows) {
|
|
103
100
|
minHeight.current = inputRef.current.scrollHeight;
|
|
@@ -120,24 +117,6 @@ const Textarea = ({
|
|
|
120
117
|
}
|
|
121
118
|
};
|
|
122
119
|
}, [expandable]);
|
|
123
|
-
|
|
124
|
-
const isOverLimit = () => {
|
|
125
|
-
return (value || "").length > parseInt(characterLimit, 10);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const characterCount = () => {
|
|
129
|
-
if (!characterLimit) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return /*#__PURE__*/React.createElement(CharacterCount, {
|
|
134
|
-
isOverLimit: isOverLimit() && warnOverLimit,
|
|
135
|
-
value: getFormatNumber((value || "").length, locale.locale()),
|
|
136
|
-
limit: getFormatNumber(characterLimit, locale.locale()),
|
|
137
|
-
"data-element": "character-limit"
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
120
|
return /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
142
121
|
tooltipPosition: tooltipPosition,
|
|
143
122
|
helpAriaLabel: helpAriaLabel
|
|
@@ -186,7 +165,7 @@ const Textarea = ({
|
|
|
186
165
|
name: name,
|
|
187
166
|
value: value,
|
|
188
167
|
ref: inputRef,
|
|
189
|
-
maxLength:
|
|
168
|
+
maxLength: maxLength,
|
|
190
169
|
onChange: onChange,
|
|
191
170
|
disabled: disabled,
|
|
192
171
|
readOnly: readOnly,
|
|
@@ -206,7 +185,7 @@ const Textarea = ({
|
|
|
206
185
|
info: info,
|
|
207
186
|
validationIconId: validationRedesignOptIn ? undefined : validationIconId,
|
|
208
187
|
useValidationIcon: !(validationRedesignOptIn || validationOnLabel)
|
|
209
|
-
}))), characterCount
|
|
188
|
+
}))), characterCount)));
|
|
210
189
|
};
|
|
211
190
|
|
|
212
191
|
Textarea.propTypes = { ...marginPropTypes,
|
|
@@ -227,7 +206,7 @@ Textarea.propTypes = { ...marginPropTypes,
|
|
|
227
206
|
id: PropTypes.string,
|
|
228
207
|
|
|
229
208
|
/** Character limit of the textarea */
|
|
230
|
-
characterLimit: PropTypes.string,
|
|
209
|
+
characterLimit: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
231
210
|
|
|
232
211
|
/** Type of the icon that will be rendered next to the input */
|
|
233
212
|
children: PropTypes.node,
|
|
@@ -4,6 +4,7 @@ import { MarginProps } from "styled-system";
|
|
|
4
4
|
import { ValidationProps } from "../../__internal__/validations";
|
|
5
5
|
import { CommonInputProps } from "../../__internal__/input";
|
|
6
6
|
|
|
7
|
+
// TODO: Change characterLimit type to number - batch with other breaking changes
|
|
7
8
|
export interface TextareaProps
|
|
8
9
|
extends ValidationProps,
|
|
9
10
|
MarginProps,
|
|
@@ -19,7 +20,7 @@ export interface TextareaProps
|
|
|
19
20
|
/** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
20
21
|
adaptiveLabelBreakpoint?: number;
|
|
21
22
|
/** Character limit of the textarea */
|
|
22
|
-
characterLimit?: string;
|
|
23
|
+
characterLimit?: string | number;
|
|
23
24
|
/** Type of the icon that will be rendered next to the input */
|
|
24
25
|
children?: React.ReactNode;
|
|
25
26
|
/** The visible width of the text control, in average character widths */
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./textbox.component";
|
|
2
|
+
export type { TextboxProps, CommonTextboxProps } from "./textbox.component";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./textbox.component";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { CommonInputProps } from "../../__internal__/input";
|
|
4
|
+
import { ValidationProps } from "../../__internal__/validations";
|
|
5
|
+
import { IconType } from "../icon";
|
|
6
|
+
export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<CommonInputProps, "size"> {
|
|
7
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
8
|
+
"data-component"?: string;
|
|
9
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
10
|
+
"data-element"?: string;
|
|
11
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
12
|
+
"data-role"?: string;
|
|
13
|
+
/** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
14
|
+
adaptiveLabelBreakpoint?: number;
|
|
15
|
+
/** Integer to determine a timeout for the deferred callback */
|
|
16
|
+
deferTimeout?: number;
|
|
17
|
+
/** Help content to be displayed under an input */
|
|
18
|
+
fieldHelp?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* An optional alternative for props.value, this is useful if the
|
|
21
|
+
* real value is an ID but you want to show a human-readable version.
|
|
22
|
+
*/
|
|
23
|
+
formattedValue?: string;
|
|
24
|
+
/** Unique identifier for the input. Will use a randomly generated GUID if none is provided */
|
|
25
|
+
id?: string;
|
|
26
|
+
/** Type of the icon that will be rendered next to the input */
|
|
27
|
+
inputIcon?: IconType;
|
|
28
|
+
/** Optional handler for click event on Textbox icon */
|
|
29
|
+
iconOnClick?: (ev: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
|
|
30
|
+
/** Optional handler for mouse down event on Textbox icon */
|
|
31
|
+
iconOnMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
32
|
+
/** Overrides the default tabindex of the component */
|
|
33
|
+
iconTabIndex?: number;
|
|
34
|
+
/** The width of the input as a percentage */
|
|
35
|
+
inputWidth?: number;
|
|
36
|
+
/** Additional child elements to display before the input */
|
|
37
|
+
leftChildren?: React.ReactNode;
|
|
38
|
+
/** Label content */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** Inline label alignment */
|
|
41
|
+
labelAlign?: "left" | "right";
|
|
42
|
+
/** A message that the Help component will display */
|
|
43
|
+
labelHelp?: React.ReactNode;
|
|
44
|
+
/** When true label is inline */
|
|
45
|
+
labelInline?: boolean;
|
|
46
|
+
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
|
|
47
|
+
labelSpacing?: 1 | 2;
|
|
48
|
+
/** Label width */
|
|
49
|
+
labelWidth?: number;
|
|
50
|
+
/** Specify a callback triggered on change */
|
|
51
|
+
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
52
|
+
/** Deferred callback to be called after the onChange event */
|
|
53
|
+
onChangeDeferred?: () => void;
|
|
54
|
+
/** Specify a callback triggered on click */
|
|
55
|
+
onClick?: (ev: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
|
|
56
|
+
/** Event handler for the focus event */
|
|
57
|
+
onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
58
|
+
/** Event handler for the blur event */
|
|
59
|
+
onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
60
|
+
/** Event handler for the mouse down event */
|
|
61
|
+
onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
62
|
+
/** Emphasized part of the displayed text */
|
|
63
|
+
prefix?: string;
|
|
64
|
+
/** Reverses label and input display */
|
|
65
|
+
reverse?: boolean;
|
|
66
|
+
/** Size of an input */
|
|
67
|
+
size?: "small" | "medium" | "large";
|
|
68
|
+
/** When true, validation icon will be placed on label instead of being placed on the input */
|
|
69
|
+
validationOnLabel?: boolean;
|
|
70
|
+
/** Overrides the default tooltip position */
|
|
71
|
+
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
72
|
+
/** Aria label for rendered help component */
|
|
73
|
+
helpAriaLabel?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface TextboxProps extends CommonTextboxProps {
|
|
76
|
+
/** Content to be rendered next to the input */
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
/** [Legacy] Flag to configure component as optional in Form */
|
|
79
|
+
isOptional?: boolean;
|
|
80
|
+
/** Container for DatePicker or SelectList components */
|
|
81
|
+
positionedChildren?: React.ReactNode;
|
|
82
|
+
/** Label id passed from Select component */
|
|
83
|
+
labelId?: string;
|
|
84
|
+
/** Character limit of the textarea */
|
|
85
|
+
characterLimit?: string | number;
|
|
86
|
+
/** Stop the user typing over the characterLimit */
|
|
87
|
+
enforceCharacterLimit?: boolean;
|
|
88
|
+
/** Whether to display the character count message in red */
|
|
89
|
+
warnOverLimit?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export declare const Textbox: ({ align, autoFocus, children, disabled, inputIcon, leftChildren, labelId: externalLabelId, label, labelAlign, labelHelp, labelInline, labelSpacing, id, formattedValue, fieldHelp, error, warning, info, name, reverse, size, value, readOnly, placeholder, inputRef, onBlur, onClick, onFocus, onChange, onMouseDown, onChangeDeferred, deferTimeout, isOptional, iconOnClick, iconOnMouseDown, iconTabIndex, validationOnLabel, labelWidth, inputWidth, prefix, adaptiveLabelBreakpoint, required, positionedChildren, tooltipPosition, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, enforceCharacterLimit, characterLimit, warnOverLimit, helpAriaLabel, ...props }: TextboxProps) => JSX.Element;
|
|
92
|
+
export default Textbox;
|