carbon-react 110.2.0 → 110.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/esm/__internal__/character-count/character-count.component.d.ts +8 -25
  2. package/esm/__internal__/character-count/character-count.component.js +12 -18
  3. package/esm/__internal__/character-count/character-count.style.d.ts +3 -1
  4. package/esm/__internal__/character-count/character-count.style.js +4 -0
  5. package/esm/__internal__/checkable-input/checkable-input-svg-wrapper.style.d.ts +1 -1
  6. package/esm/__internal__/checkable-input/checkable-input.component.d.ts +50 -0
  7. package/esm/__internal__/checkable-input/checkable-input.component.js +360 -98
  8. package/esm/__internal__/checkable-input/checkable-input.style.d.ts +11 -2
  9. package/esm/__internal__/checkable-input/checkable-input.style.js +0 -7
  10. package/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +31 -0
  11. package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +301 -45
  12. package/esm/__internal__/checkable-input/hidden-checkable-input.style.d.ts +1 -1
  13. package/esm/__internal__/checkable-input/index.d.ts +2 -5
  14. package/esm/__internal__/input/index.d.ts +1 -1
  15. package/esm/__internal__/input/input-presentation.style.d.ts +1 -1
  16. package/esm/__internal__/input/input.style.d.ts +1 -1
  17. package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +1 -0
  18. package/esm/components/numeral-date/numeral-date-context.d.ts +6 -0
  19. package/esm/components/popover-container/popover-container.component.d.ts +2 -0
  20. package/esm/components/popover-container/popover-container.component.js +9 -4
  21. package/esm/components/select/multi-select/multi-select.component.js +1 -1
  22. package/esm/components/select/select-list/select-list.component.js +20 -11
  23. package/esm/components/textarea/textarea.component.js +6 -27
  24. package/esm/components/textarea/textarea.d.ts +2 -1
  25. package/esm/components/textbox/__internal__/prefix.style.d.ts +2 -0
  26. package/esm/components/textbox/index.d.ts +2 -1
  27. package/esm/components/textbox/index.js +1 -1
  28. package/esm/components/textbox/textbox.component.d.ts +92 -0
  29. package/esm/components/textbox/textbox.component.js +533 -197
  30. package/esm/components/textbox/textbox.style.d.ts +5 -0
  31. package/esm/components/textbox/textbox.style.js +0 -12
  32. package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +1 -1
  33. package/esm/hooks/__internal__/useCharacterCount/useCharacterCount.js +7 -6
  34. package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +6 -5
  35. package/lib/__internal__/character-count/character-count.component.d.ts +8 -25
  36. package/lib/__internal__/character-count/character-count.component.js +13 -23
  37. package/lib/__internal__/character-count/character-count.style.d.ts +3 -1
  38. package/lib/__internal__/character-count/character-count.style.js +7 -0
  39. package/lib/__internal__/checkable-input/checkable-input-svg-wrapper.style.d.ts +1 -1
  40. package/lib/__internal__/checkable-input/checkable-input.component.d.ts +50 -0
  41. package/lib/__internal__/checkable-input/checkable-input.component.js +360 -98
  42. package/lib/__internal__/checkable-input/checkable-input.style.d.ts +11 -2
  43. package/lib/__internal__/checkable-input/checkable-input.style.js +1 -9
  44. package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +31 -0
  45. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +301 -45
  46. package/lib/__internal__/checkable-input/hidden-checkable-input.style.d.ts +1 -1
  47. package/lib/__internal__/checkable-input/index.d.ts +2 -5
  48. package/lib/__internal__/input/index.d.ts +1 -1
  49. package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
  50. package/lib/__internal__/input/input.style.d.ts +1 -1
  51. package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +1 -0
  52. package/lib/components/numeral-date/numeral-date-context.d.ts +6 -0
  53. package/lib/components/popover-container/popover-container.component.d.ts +2 -0
  54. package/lib/components/popover-container/popover-container.component.js +9 -4
  55. package/lib/components/select/multi-select/multi-select.component.js +1 -1
  56. package/lib/components/select/select-list/select-list.component.js +20 -11
  57. package/lib/components/textarea/textarea.component.js +6 -27
  58. package/lib/components/textarea/textarea.d.ts +2 -1
  59. package/lib/components/textbox/__internal__/prefix.style.d.ts +2 -0
  60. package/lib/components/textbox/index.d.ts +2 -1
  61. package/lib/components/textbox/index.js +2 -10
  62. package/lib/components/textbox/textbox.component.d.ts +92 -0
  63. package/lib/components/textbox/textbox.component.js +534 -201
  64. package/lib/components/textbox/textbox.style.d.ts +5 -0
  65. package/lib/components/textbox/textbox.style.js +1 -16
  66. package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.d.ts +1 -1
  67. package/lib/hooks/__internal__/useCharacterCount/useCharacterCount.js +7 -6
  68. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +6 -5
  69. package/package.json +1 -1
  70. package/esm/__internal__/checkable-input/checkable-input.d.ts +0 -55
  71. package/esm/__internal__/checkable-input/hidden-checkable-input.d.ts +0 -42
  72. package/esm/components/textbox/textbox.d.ts +0 -125
  73. package/lib/__internal__/checkable-input/checkable-input.d.ts +0 -55
  74. package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +0 -42
  75. package/lib/components/textbox/textbox.d.ts +0 -125
@@ -0,0 +1,5 @@
1
+ declare const ErrorBorder: import("styled-components").StyledComponent<"span", any, {
2
+ warning: boolean;
3
+ }, never>;
4
+ declare const StyledHintText: import("styled-components").StyledComponent<"p", any, {}, never>;
5
+ export { StyledHintText, ErrorBorder };
@@ -7,10 +7,6 @@ exports.ErrorBorder = exports.StyledHintText = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
 
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
15
11
 
16
12
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -35,15 +31,4 @@ const StyledHintText = _styledComponents.default.p`
35
31
  color: var(--colorsUtilityYin055);
36
32
  font-size: 14px;
37
33
  `;
38
- exports.StyledHintText = StyledHintText;
39
- StyledHintText.defaultProps = {
40
- size: "medium"
41
- };
42
- ErrorBorder.propTypes = {
43
- warning: _propTypes.default.bool,
44
- size: _propTypes.default.string
45
- };
46
- ErrorBorder.defaultProps = {
47
- warning: false,
48
- size: "medium"
49
- };
34
+ exports.StyledHintText = StyledHintText;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const useCharacterCount: (value: string, characterLimit?: string | undefined, warnOverLimit?: boolean, enforceCharacterLimit?: boolean) => [string | undefined, JSX.Element | null];
2
+ declare const useCharacterCount: (value?: string, characterLimit?: number | undefined, warnOverLimit?: boolean, enforceCharacterLimit?: boolean) => [number | undefined, JSX.Element | null];
3
3
  export default useCharacterCount;
@@ -19,19 +19,20 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
19
19
 
20
20
  const getFormatNumber = (value, locale) => new Intl.NumberFormat(locale).format(value);
21
21
 
22
- const useCharacterCount = (value, characterLimit, warnOverLimit = false, enforceCharacterLimit = true) => {
22
+ const useCharacterCount = (value = "", characterLimit, warnOverLimit = false, enforceCharacterLimit = true) => {
23
+ const isCharacterLimitValid = typeof characterLimit === "number" && !Number.isNaN(characterLimit);
23
24
  const l = (0, _useLocale.default)();
24
25
  const isOverLimit = (0, _react.useMemo)(() => {
25
- if (value && characterLimit) {
26
- return value.length > parseInt(characterLimit, 10);
26
+ if (value && isCharacterLimitValid) {
27
+ return value.length > characterLimit;
27
28
  }
28
29
 
29
30
  return false;
30
- }, [value, characterLimit]);
31
- return [enforceCharacterLimit && characterLimit ? characterLimit : undefined, characterLimit ? /*#__PURE__*/_react.default.createElement(_characterCount.default, {
31
+ }, [value, characterLimit, isCharacterLimitValid]);
32
+ return [enforceCharacterLimit && isCharacterLimitValid ? characterLimit : undefined, isCharacterLimitValid ? /*#__PURE__*/_react.default.createElement(_characterCount.default, {
32
33
  isOverLimit: isOverLimit && warnOverLimit,
33
34
  value: getFormatNumber(value.length, l.locale()),
34
- limit: getFormatNumber(+characterLimit, l.locale()),
35
+ limit: getFormatNumber(characterLimit, l.locale()),
35
36
  "data-element": "character-limit"
36
37
  }) : null];
37
38
  };
@@ -1,10 +1,11 @@
1
+ /// <reference types="react" />
1
2
  export default function useInputAccessibility({ id, error, warning, info, label, fieldHelp, }: {
2
3
  id: string;
3
- error?: string;
4
- warning?: string;
5
- info?: string;
6
- label?: string;
7
- fieldHelp?: string;
4
+ error?: string | boolean;
5
+ warning?: string | boolean;
6
+ info?: string | boolean;
7
+ label?: React.ReactNode;
8
+ fieldHelp?: React.ReactNode;
8
9
  }): {
9
10
  labelId?: string;
10
11
  validationIconId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "110.2.0",
3
+ "version": "110.2.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -1,55 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { ValidationProps } from "../validations";
4
- import { CommonHiddenCheckableInputProps } from "./hidden-checkable-input";
5
-
6
- export interface CommonCheckableInputProps
7
- extends ValidationProps,
8
- CommonHiddenCheckableInputProps {
9
- /** If true, the component will be disabled */
10
- disabled?: boolean;
11
- /** Help content to be displayed under an input */
12
- fieldHelp?: React.ReactNode;
13
- /**
14
- * If true, the FieldHelp will be displayed inline
15
- * To be used with labelInline prop set to true
16
- */
17
- fieldHelpInline?: boolean;
18
- /** Unique Identifier for the input. Will use a randomly generated GUID if none is provided */
19
- id?: string;
20
- /** Sets percentage-based input width */
21
- inputWidth?: number | string;
22
- /** Label content */
23
- label?: React.ReactNode;
24
- /** The content for the help tooltip, to appear next to the Label */
25
- labelHelp?: string | React.ReactNode;
26
- /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
27
- labelSpacing?: 1 | 2;
28
- /** Label width */
29
- labelWidth?: number;
30
- /** Flag to configure component as mandatory */
31
- required?: boolean;
32
- /** If true the label switches position with the input */
33
- reverse?: boolean;
34
- /** Size of the component */
35
- size?: "small" | "large";
36
- /** The id of the element that labels the input */
37
- ariaLabelledBy?: string;
38
- }
39
-
40
- export interface CheckableInputProps extends CommonCheckableInputProps {
41
- /** Used to set the visible aspect of the input (i.e. the checkbox sprite, input slider etc) */
42
- children?: React.ReactNode;
43
- /** HTML type attribute of the input */
44
- type: string;
45
- /** Value passed to the input */
46
- value?: string;
47
- /** Text alignment of the label */
48
- labelAlign?: "left" | "right";
49
- /** When true label is inline */
50
- labelInline?: boolean;
51
- }
52
-
53
- declare function CheckableInput(props: CheckableInputProps): JSX.Element;
54
-
55
- export default CheckableInput;
@@ -1,42 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface CommonHiddenCheckableInputProps
4
- extends Omit<
5
- React.InputHTMLAttributes<HTMLInputElement>,
6
- "value" | "size" | "type"
7
- > {
8
- /** If true the Component will be focused when page load */
9
- autoFocus?: boolean;
10
- /** Checked state of the input */
11
- checked?: boolean;
12
- /** Input name */
13
- name?: string;
14
- /** OnChange event handler */
15
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
16
- /** OnFocus event handler */
17
- onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
18
- /** Blur event handler */
19
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
20
- /** OnMouseLeave event handler */
21
- onMouseLeave?: (ev: React.MouseEvent<HTMLInputElement>) => void;
22
- /** OnMouseEnter event handler */
23
- onMouseEnter?: (ev: React.MouseEvent<HTMLInputElement>) => void;
24
- /** Value of the input */
25
- value?: string;
26
- /** A callback to retrieve the input reference */
27
- inputRef?: React.Ref<HTMLInputElement>;
28
- }
29
-
30
- export interface HiddenCheckableInputProps
31
- extends CommonHiddenCheckableInputProps {
32
- /** HTML type attribute of the input */
33
- type: string;
34
- /** Role attribute of the input */
35
- role?: string;
36
- }
37
-
38
- declare function HiddenCheckableInput(
39
- props: HiddenCheckableInputProps
40
- ): JSX.Element;
41
-
42
- export default HiddenCheckableInput;
@@ -1,125 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
-
4
- import { ValidationProps } from "../../__internal__/validations";
5
- import { CommonInputProps } from "../../__internal__/input";
6
-
7
- export interface CommonTextboxProps
8
- extends ValidationProps,
9
- MarginProps,
10
- Omit<CommonInputProps, "size"> {
11
- /** Automatically focus the input on component mount */
12
- autoFocus?: boolean;
13
- /* The default value alignment on the input */
14
- align?: "right" | "left";
15
- /** Identifier used for testing purposes, applied to the root element of the component. */
16
- "data-component"?: string;
17
- /** Identifier used for testing purposes, applied to the root element of the component. */
18
- "data-element"?: string;
19
- /** Identifier used for testing purposes, applied to the root element of the component. */
20
- "data-role"?: string;
21
- /** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
22
- adaptiveLabelBreakpoint?: number;
23
- /** Integer to determine a timeout for the deferred callback */
24
- deferTimeout?: number;
25
- /** If true, the component will be disabled */
26
- disabled?: boolean;
27
- /** Help content to be displayed under an input */
28
- fieldHelp?: React.ReactNode;
29
- /**
30
- * An optional alternative for props.value, this is useful if the
31
- * real value is an ID but you want to show a human-readable version.
32
- */
33
- formattedValue?: string;
34
- /** Unique identifier for the input. Will use a randomly generated GUID if none is provided */
35
- id?: string;
36
- /** Type of the icon that will be rendered next to the input */
37
- inputIcon?: string;
38
- /** Optional handler for click event on Textbox icon */
39
- iconOnClick?: (ev: React.MouseEvent<HTMLElement>) => void;
40
- /** Overrides the default tabindex of the component */
41
- iconTabIndex?: string | number;
42
- /** The width of the input as a percentage */
43
- inputWidth?: number;
44
- /** Additional child elements to display before the input */
45
- leftChildren?: React.ReactNode;
46
- /** Label content */
47
- label?: string;
48
- /** Inline label alignment */
49
- labelAlign?: "left" | "right";
50
- /** A message that the Help component will display */
51
- labelHelp?: React.ReactNode;
52
- /** When true label is inline */
53
- labelInline?: boolean;
54
- /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
55
- labelSpacing?: 1 | 2;
56
- /** Label width */
57
- labelWidth?: number;
58
- /** Specify a callback triggered on change */
59
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
60
- /** Deferred callback to be called after the onChange event */
61
- onChangeDeferred?: () => void;
62
- /** Specify a callback triggered on click */
63
- onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
64
- /** Event handler for the focus event */
65
- onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
66
- /** Event handler for the blur event */
67
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
68
- /** Event handler for the mouse down event */
69
- onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
70
- /** Input name */
71
- name?: string;
72
- /** Placeholder string to be displayed in input */
73
- placeholder?: string;
74
- /** Emphasized part of the displayed text */
75
- prefix?: string;
76
- /** Reverses label and input display */
77
- reverse?: boolean;
78
- /** The unformatted value */
79
- rawValue?: string;
80
- /** If true, the component will be read-only */
81
- readOnly?: boolean;
82
- /** Flag to configure component as mandatory */
83
- required?: boolean;
84
- /** Size of an input */
85
- size?: "small" | "medium" | "large";
86
- /** When true, validation icon will be placed on label instead of being placed on the input */
87
- validationOnLabel?: boolean;
88
- /** The value of the Input */
89
- value?:
90
- | string
91
- | string[]
92
- | Record<string, unknown>
93
- | Record<string, unknown>[];
94
- /** A callback to retrieve the input reference */
95
- inputRef?: (input: React.RefObject<HTMLInputElement>) => void;
96
- /** Overrides the default tooltip position */
97
- tooltipPosition?: "top" | "bottom" | "left" | "right";
98
- /** Aria label for rendered help component */
99
- helpAriaLabel?: string;
100
- }
101
-
102
- export interface TextboxProps extends CommonTextboxProps {
103
- /** Content to be rendered next to the input */
104
- children?: React.ReactNode;
105
- /** [Legacy] Flag to configure component as optional in Form */
106
- isOptional?: boolean;
107
- /** Container for DatePicker or SelectList components */
108
- positionedChildren?: React.ReactNode;
109
- /** Label id passed from Select component */
110
- labelId?: string;
111
- /** Character limit of the textarea */
112
- characterLimit?: string;
113
- /** Stop the user typing over the characterLimit */
114
- enforceCharacterLimit?: boolean;
115
- /** Whether to display the character count message in red */
116
- warnOverLimit?: boolean;
117
- }
118
-
119
- declare function Textbox(props: TextboxProps): JSX.Element;
120
- declare function TextboxWithUniqueIdProps(
121
- props: TextboxProps & React.RefAttributes<HTMLInputElement>
122
- ): JSX.Element;
123
-
124
- export { Textbox as OriginalTextbox };
125
- export default TextboxWithUniqueIdProps;
@@ -1,55 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { ValidationProps } from "../validations";
4
- import { CommonHiddenCheckableInputProps } from "./hidden-checkable-input";
5
-
6
- export interface CommonCheckableInputProps
7
- extends ValidationProps,
8
- CommonHiddenCheckableInputProps {
9
- /** If true, the component will be disabled */
10
- disabled?: boolean;
11
- /** Help content to be displayed under an input */
12
- fieldHelp?: React.ReactNode;
13
- /**
14
- * If true, the FieldHelp will be displayed inline
15
- * To be used with labelInline prop set to true
16
- */
17
- fieldHelpInline?: boolean;
18
- /** Unique Identifier for the input. Will use a randomly generated GUID if none is provided */
19
- id?: string;
20
- /** Sets percentage-based input width */
21
- inputWidth?: number | string;
22
- /** Label content */
23
- label?: React.ReactNode;
24
- /** The content for the help tooltip, to appear next to the Label */
25
- labelHelp?: string | React.ReactNode;
26
- /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
27
- labelSpacing?: 1 | 2;
28
- /** Label width */
29
- labelWidth?: number;
30
- /** Flag to configure component as mandatory */
31
- required?: boolean;
32
- /** If true the label switches position with the input */
33
- reverse?: boolean;
34
- /** Size of the component */
35
- size?: "small" | "large";
36
- /** The id of the element that labels the input */
37
- ariaLabelledBy?: string;
38
- }
39
-
40
- export interface CheckableInputProps extends CommonCheckableInputProps {
41
- /** Used to set the visible aspect of the input (i.e. the checkbox sprite, input slider etc) */
42
- children?: React.ReactNode;
43
- /** HTML type attribute of the input */
44
- type: string;
45
- /** Value passed to the input */
46
- value?: string;
47
- /** Text alignment of the label */
48
- labelAlign?: "left" | "right";
49
- /** When true label is inline */
50
- labelInline?: boolean;
51
- }
52
-
53
- declare function CheckableInput(props: CheckableInputProps): JSX.Element;
54
-
55
- export default CheckableInput;
@@ -1,42 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface CommonHiddenCheckableInputProps
4
- extends Omit<
5
- React.InputHTMLAttributes<HTMLInputElement>,
6
- "value" | "size" | "type"
7
- > {
8
- /** If true the Component will be focused when page load */
9
- autoFocus?: boolean;
10
- /** Checked state of the input */
11
- checked?: boolean;
12
- /** Input name */
13
- name?: string;
14
- /** OnChange event handler */
15
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
16
- /** OnFocus event handler */
17
- onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
18
- /** Blur event handler */
19
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
20
- /** OnMouseLeave event handler */
21
- onMouseLeave?: (ev: React.MouseEvent<HTMLInputElement>) => void;
22
- /** OnMouseEnter event handler */
23
- onMouseEnter?: (ev: React.MouseEvent<HTMLInputElement>) => void;
24
- /** Value of the input */
25
- value?: string;
26
- /** A callback to retrieve the input reference */
27
- inputRef?: React.Ref<HTMLInputElement>;
28
- }
29
-
30
- export interface HiddenCheckableInputProps
31
- extends CommonHiddenCheckableInputProps {
32
- /** HTML type attribute of the input */
33
- type: string;
34
- /** Role attribute of the input */
35
- role?: string;
36
- }
37
-
38
- declare function HiddenCheckableInput(
39
- props: HiddenCheckableInputProps
40
- ): JSX.Element;
41
-
42
- export default HiddenCheckableInput;
@@ -1,125 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
-
4
- import { ValidationProps } from "../../__internal__/validations";
5
- import { CommonInputProps } from "../../__internal__/input";
6
-
7
- export interface CommonTextboxProps
8
- extends ValidationProps,
9
- MarginProps,
10
- Omit<CommonInputProps, "size"> {
11
- /** Automatically focus the input on component mount */
12
- autoFocus?: boolean;
13
- /* The default value alignment on the input */
14
- align?: "right" | "left";
15
- /** Identifier used for testing purposes, applied to the root element of the component. */
16
- "data-component"?: string;
17
- /** Identifier used for testing purposes, applied to the root element of the component. */
18
- "data-element"?: string;
19
- /** Identifier used for testing purposes, applied to the root element of the component. */
20
- "data-role"?: string;
21
- /** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
22
- adaptiveLabelBreakpoint?: number;
23
- /** Integer to determine a timeout for the deferred callback */
24
- deferTimeout?: number;
25
- /** If true, the component will be disabled */
26
- disabled?: boolean;
27
- /** Help content to be displayed under an input */
28
- fieldHelp?: React.ReactNode;
29
- /**
30
- * An optional alternative for props.value, this is useful if the
31
- * real value is an ID but you want to show a human-readable version.
32
- */
33
- formattedValue?: string;
34
- /** Unique identifier for the input. Will use a randomly generated GUID if none is provided */
35
- id?: string;
36
- /** Type of the icon that will be rendered next to the input */
37
- inputIcon?: string;
38
- /** Optional handler for click event on Textbox icon */
39
- iconOnClick?: (ev: React.MouseEvent<HTMLElement>) => void;
40
- /** Overrides the default tabindex of the component */
41
- iconTabIndex?: string | number;
42
- /** The width of the input as a percentage */
43
- inputWidth?: number;
44
- /** Additional child elements to display before the input */
45
- leftChildren?: React.ReactNode;
46
- /** Label content */
47
- label?: string;
48
- /** Inline label alignment */
49
- labelAlign?: "left" | "right";
50
- /** A message that the Help component will display */
51
- labelHelp?: React.ReactNode;
52
- /** When true label is inline */
53
- labelInline?: boolean;
54
- /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
55
- labelSpacing?: 1 | 2;
56
- /** Label width */
57
- labelWidth?: number;
58
- /** Specify a callback triggered on change */
59
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
60
- /** Deferred callback to be called after the onChange event */
61
- onChangeDeferred?: () => void;
62
- /** Specify a callback triggered on click */
63
- onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
64
- /** Event handler for the focus event */
65
- onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
66
- /** Event handler for the blur event */
67
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
68
- /** Event handler for the mouse down event */
69
- onMouseDown?: (ev: React.MouseEvent<HTMLElement>) => void;
70
- /** Input name */
71
- name?: string;
72
- /** Placeholder string to be displayed in input */
73
- placeholder?: string;
74
- /** Emphasized part of the displayed text */
75
- prefix?: string;
76
- /** Reverses label and input display */
77
- reverse?: boolean;
78
- /** The unformatted value */
79
- rawValue?: string;
80
- /** If true, the component will be read-only */
81
- readOnly?: boolean;
82
- /** Flag to configure component as mandatory */
83
- required?: boolean;
84
- /** Size of an input */
85
- size?: "small" | "medium" | "large";
86
- /** When true, validation icon will be placed on label instead of being placed on the input */
87
- validationOnLabel?: boolean;
88
- /** The value of the Input */
89
- value?:
90
- | string
91
- | string[]
92
- | Record<string, unknown>
93
- | Record<string, unknown>[];
94
- /** A callback to retrieve the input reference */
95
- inputRef?: (input: React.RefObject<HTMLInputElement>) => void;
96
- /** Overrides the default tooltip position */
97
- tooltipPosition?: "top" | "bottom" | "left" | "right";
98
- /** Aria label for rendered help component */
99
- helpAriaLabel?: string;
100
- }
101
-
102
- export interface TextboxProps extends CommonTextboxProps {
103
- /** Content to be rendered next to the input */
104
- children?: React.ReactNode;
105
- /** [Legacy] Flag to configure component as optional in Form */
106
- isOptional?: boolean;
107
- /** Container for DatePicker or SelectList components */
108
- positionedChildren?: React.ReactNode;
109
- /** Label id passed from Select component */
110
- labelId?: string;
111
- /** Character limit of the textarea */
112
- characterLimit?: string;
113
- /** Stop the user typing over the characterLimit */
114
- enforceCharacterLimit?: boolean;
115
- /** Whether to display the character count message in red */
116
- warnOverLimit?: boolean;
117
- }
118
-
119
- declare function Textbox(props: TextboxProps): JSX.Element;
120
- declare function TextboxWithUniqueIdProps(
121
- props: TextboxProps & React.RefAttributes<HTMLInputElement>
122
- ): JSX.Element;
123
-
124
- export { Textbox as OriginalTextbox };
125
- export default TextboxWithUniqueIdProps;