@dxc-technology/halstack-react 0.0.0-3a698b0 → 0.0.0-3ac400c
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/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +4 -21
- package/HalstackContext.d.ts +25 -129
- package/HalstackContext.js +10 -35
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +24 -76
- package/accordion/Accordion.stories.tsx +1 -113
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +5 -17
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +27 -75
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.js +43 -71
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +6 -18
- package/alert/Alert.js +16 -53
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.js +4 -17
- package/badge/types.d.ts +1 -1
- package/bleed/Bleed.js +13 -21
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +16 -55
- package/box/Box.stories.tsx +25 -53
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -15
- package/bulleted-list/BulletedList.js +19 -53
- package/bulleted-list/BulletedList.stories.tsx +8 -93
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +66 -99
- package/button/Button.stories.tsx +8 -89
- package/button/Button.test.js +17 -16
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +39 -79
- package/card/Card.stories.tsx +0 -29
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +6 -12
- package/checkbox/Checkbox.js +85 -120
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +34 -66
- package/chip/Chip.stories.tsx +25 -17
- package/chip/Chip.test.js +15 -28
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.js +2 -8
- package/common/variables.d.ts +24 -268
- package/common/variables.js +860 -1111
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/date-input/Calendar.js +15 -59
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +27 -21
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +15 -60
- package/dialog/Dialog.stories.tsx +215 -169
- package/dialog/Dialog.test.js +125 -187
- package/dialog/types.d.ts +18 -26
- package/dropdown/Dropdown.js +39 -93
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +13 -20
- package/dropdown/DropdownMenuItem.js +5 -17
- package/dropdown/types.d.ts +17 -19
- package/file-input/FileInput.js +180 -248
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +356 -354
- package/file-input/FileItem.js +14 -41
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +27 -39
- package/flex/Flex.stories.tsx +24 -10
- package/flex/types.d.ts +74 -9
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +54 -112
- package/footer/Footer.stories.tsx +19 -95
- package/footer/Footer.test.js +21 -33
- package/footer/Icons.d.ts +2 -2
- package/footer/Icons.js +2 -7
- package/footer/types.d.ts +21 -29
- package/grid/Grid.d.ts +1 -1
- package/grid/Grid.js +2 -17
- package/grid/Grid.stories.tsx +38 -38
- package/grid/types.d.ts +10 -10
- package/header/Header.d.ts +2 -2
- package/header/Header.js +31 -114
- package/header/Header.stories.tsx +7 -71
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +5 -20
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- package/heading/types.d.ts +7 -7
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.js +13 -21
- package/inset/Inset.stories.tsx +1 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +28 -65
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +3 -9
- package/layout/types.d.ts +5 -6
- package/link/Link.js +22 -43
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +4 -3
- package/main.js +17 -58
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +16 -51
- package/nav-tabs/NavTabs.stories.tsx +15 -1
- package/nav-tabs/NavTabs.test.js +36 -43
- package/nav-tabs/Tab.js +36 -69
- package/nav-tabs/types.d.ts +14 -15
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +26 -35
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +700 -412
- package/number-input/types.d.ts +11 -5
- package/package.json +30 -28
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +16 -44
- package/paginator/Paginator.test.js +229 -199
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.js +3 -19
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +157 -140
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.js +21 -53
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +31 -63
- package/radio-group/RadioGroup.js +45 -93
- package/radio-group/RadioGroup.stories.tsx +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.js +23 -59
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +72 -92
- package/{resultsetTable → resultset-table}/types.d.ts +7 -7
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +9 -26
- package/select/Select.js +70 -155
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +1946 -1804
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +80 -150
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/Sidenav.test.js +3 -10
- package/sidenav/types.d.ts +31 -28
- package/slider/Slider.js +68 -125
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +16 -54
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/switch/Switch.js +49 -97
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/Table.js +5 -27
- package/table/Table.test.js +1 -6
- package/table/types.d.ts +8 -8
- package/tabs/Tab.js +10 -29
- package/tabs/Tabs.js +52 -129
- package/tabs/Tabs.test.js +62 -118
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +21 -51
- package/tag/Tag.test.js +19 -30
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.d.ts +5 -5
- package/text-input/Icons.js +1 -5
- package/text-input/Suggestion.js +9 -26
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +15 -65
- package/text-input/TextInput.js +189 -284
- package/text-input/TextInput.stories.tsx +48 -152
- package/text-input/TextInput.test.js +1210 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +67 -109
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +150 -179
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +90 -107
- package/toggle-group/ToggleGroup.stories.tsx +7 -4
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +21 -122
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +24 -42
- package/wizard/Wizard.js +14 -49
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +6 -6
- package/card/ice-cream.jpg +0 -0
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/resultsetTable/Icons.d.ts +0 -7
- package/slider/Slider.stories.tsx +0 -240
- /package/{resultsetTable → container}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +0 -0
- /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
- /package/table/{Table.stories.jsx → Table.stories.tsx} +0 -0
package/text-input/TextInput.js
CHANGED
|
@@ -1,68 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
14
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
-
|
|
24
15
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
25
|
-
|
|
26
16
|
var _variables = require("../common/variables");
|
|
27
|
-
|
|
28
17
|
var _utils = require("../common/utils");
|
|
29
|
-
|
|
30
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
31
|
-
|
|
32
|
-
var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext"));
|
|
33
|
-
|
|
18
|
+
var _NumberInput = require("../number-input/NumberInput");
|
|
34
19
|
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
|
35
|
-
|
|
36
20
|
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
37
|
-
|
|
38
21
|
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
39
|
-
|
|
40
22
|
var _uuid = require("uuid");
|
|
41
|
-
|
|
42
23
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
47
|
-
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
48
26
|
var sizes = {
|
|
49
27
|
small: "240px",
|
|
50
28
|
medium: "360px",
|
|
51
29
|
large: "480px",
|
|
52
30
|
fillParent: "100%"
|
|
53
31
|
};
|
|
54
|
-
|
|
55
32
|
var AutosuggestWrapper = function AutosuggestWrapper(_ref) {
|
|
56
33
|
var condition = _ref.condition,
|
|
57
|
-
|
|
58
|
-
|
|
34
|
+
wrapper = _ref.wrapper,
|
|
35
|
+
children = _ref.children;
|
|
59
36
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, condition ? wrapper(children) : children);
|
|
60
37
|
};
|
|
61
|
-
|
|
62
38
|
var calculateWidth = function calculateWidth(margin, size) {
|
|
63
39
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
64
40
|
};
|
|
65
|
-
|
|
66
41
|
var makeCancelable = function makeCancelable(promise) {
|
|
67
42
|
var hasCanceled_ = false;
|
|
68
43
|
var wrappedPromise = new Promise(function (resolve, reject) {
|
|
@@ -83,307 +58,257 @@ var makeCancelable = function makeCancelable(promise) {
|
|
|
83
58
|
}
|
|
84
59
|
};
|
|
85
60
|
};
|
|
86
|
-
|
|
87
61
|
var hasSuggestions = function hasSuggestions(suggestions) {
|
|
88
62
|
return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
|
-
var isNotOptional = function isNotOptional(value, optional) {
|
|
64
|
+
var isRequired = function isRequired(value, optional) {
|
|
92
65
|
return value === "" && !optional;
|
|
93
66
|
};
|
|
94
|
-
|
|
95
67
|
var isLengthIncorrect = function isLengthIncorrect(value, minLength, maxLength) {
|
|
96
|
-
return value
|
|
68
|
+
return value != null && (value.length < minLength || value.length > maxLength);
|
|
97
69
|
};
|
|
98
|
-
|
|
99
70
|
var isNumberIncorrect = function isNumberIncorrect(value, minNumber, maxNumber) {
|
|
100
|
-
return
|
|
71
|
+
return value < minNumber || value > maxNumber;
|
|
101
72
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
73
|
+
var patternMismatch = function patternMismatch(pattern, value) {
|
|
74
|
+
return pattern != null && !new RegExp(pattern).test(value);
|
|
75
|
+
};
|
|
76
|
+
var useWidth = function useWidth(target) {
|
|
77
|
+
var _useState = (0, _react.useState)(0),
|
|
78
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
79
|
+
width = _useState2[0],
|
|
80
|
+
setWidth = _useState2[1];
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
if (target != null) {
|
|
83
|
+
setWidth(target.getBoundingClientRect().width);
|
|
84
|
+
var triggerObserver = new ResizeObserver(function (entries) {
|
|
85
|
+
var rect = entries[0].target.getBoundingClientRect();
|
|
86
|
+
setWidth(rect === null || rect === void 0 ? void 0 : rect.width);
|
|
87
|
+
});
|
|
88
|
+
triggerObserver.observe(target);
|
|
89
|
+
return function () {
|
|
90
|
+
triggerObserver.unobserve(target);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, [target]);
|
|
94
|
+
return width;
|
|
105
95
|
};
|
|
106
|
-
|
|
107
96
|
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
108
97
|
var label = _ref2.label,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
98
|
+
_ref2$name = _ref2.name,
|
|
99
|
+
name = _ref2$name === void 0 ? "" : _ref2$name,
|
|
100
|
+
_ref2$defaultValue = _ref2.defaultValue,
|
|
101
|
+
defaultValue = _ref2$defaultValue === void 0 ? "" : _ref2$defaultValue,
|
|
102
|
+
value = _ref2.value,
|
|
103
|
+
helperText = _ref2.helperText,
|
|
104
|
+
_ref2$placeholder = _ref2.placeholder,
|
|
105
|
+
placeholder = _ref2$placeholder === void 0 ? "" : _ref2$placeholder,
|
|
106
|
+
action = _ref2.action,
|
|
107
|
+
_ref2$clearable = _ref2.clearable,
|
|
108
|
+
clearable = _ref2$clearable === void 0 ? false : _ref2$clearable,
|
|
109
|
+
_ref2$disabled = _ref2.disabled,
|
|
110
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
111
|
+
_ref2$readOnly = _ref2.readOnly,
|
|
112
|
+
readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
|
|
113
|
+
_ref2$optional = _ref2.optional,
|
|
114
|
+
optional = _ref2$optional === void 0 ? false : _ref2$optional,
|
|
115
|
+
_ref2$prefix = _ref2.prefix,
|
|
116
|
+
prefix = _ref2$prefix === void 0 ? "" : _ref2$prefix,
|
|
117
|
+
_ref2$suffix = _ref2.suffix,
|
|
118
|
+
suffix = _ref2$suffix === void 0 ? "" : _ref2$suffix,
|
|
119
|
+
onChange = _ref2.onChange,
|
|
120
|
+
onBlur = _ref2.onBlur,
|
|
121
|
+
error = _ref2.error,
|
|
122
|
+
suggestions = _ref2.suggestions,
|
|
123
|
+
pattern = _ref2.pattern,
|
|
124
|
+
minLength = _ref2.minLength,
|
|
125
|
+
maxLength = _ref2.maxLength,
|
|
126
|
+
_ref2$autocomplete = _ref2.autocomplete,
|
|
127
|
+
autocomplete = _ref2$autocomplete === void 0 ? "off" : _ref2$autocomplete,
|
|
128
|
+
margin = _ref2.margin,
|
|
129
|
+
_ref2$size = _ref2.size,
|
|
130
|
+
size = _ref2$size === void 0 ? "medium" : _ref2$size,
|
|
131
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
132
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
133
|
+
var _useState3 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
134
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
135
|
+
inputId = _useState4[0];
|
|
147
136
|
var autosuggestId = "suggestions-".concat(inputId);
|
|
148
137
|
var errorId = "error-".concat(inputId);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
setInnerValue = _useState4[1];
|
|
154
|
-
|
|
155
|
-
var _useState5 = (0, _react.useState)(false),
|
|
156
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
157
|
-
isOpen = _useState6[0],
|
|
158
|
-
changeIsOpen = _useState6[1];
|
|
159
|
-
|
|
138
|
+
var _useState5 = (0, _react.useState)(defaultValue),
|
|
139
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
140
|
+
innerValue = _useState6[0],
|
|
141
|
+
setInnerValue = _useState6[1];
|
|
160
142
|
var _useState7 = (0, _react.useState)(false),
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
143
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
144
|
+
isOpen = _useState8[0],
|
|
145
|
+
changeIsOpen = _useState8[1];
|
|
165
146
|
var _useState9 = (0, _react.useState)(false),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
147
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
148
|
+
isSearching = _useState10[0],
|
|
149
|
+
changeIsSearching = _useState10[1];
|
|
150
|
+
var _useState11 = (0, _react.useState)(false),
|
|
151
|
+
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
152
|
+
isAutosuggestError = _useState12[0],
|
|
153
|
+
changeIsAutosuggestError = _useState12[1];
|
|
154
|
+
var _useState13 = (0, _react.useState)([]),
|
|
155
|
+
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
156
|
+
filteredSuggestions = _useState14[0],
|
|
157
|
+
changeFilteredSuggestions = _useState14[1];
|
|
158
|
+
var _useState15 = (0, _react.useState)(-1),
|
|
159
|
+
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
160
|
+
visualFocusIndex = _useState16[0],
|
|
161
|
+
changeVisualFocusIndex = _useState16[1];
|
|
180
162
|
var inputRef = (0, _react.useRef)(null);
|
|
163
|
+
var inputContainerRef = (0, _react.useRef)(null);
|
|
181
164
|
var actionRef = (0, _react.useRef)(null);
|
|
165
|
+
var width = useWidth(inputContainerRef.current);
|
|
182
166
|
var colorsTheme = (0, _useTheme["default"])();
|
|
183
167
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
184
|
-
var
|
|
185
|
-
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
186
|
-
|
|
168
|
+
var numberInputContext = (0, _react.useContext)(_NumberInput.NumberInputContext);
|
|
187
169
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
188
|
-
if (
|
|
170
|
+
if (value < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return translatedLabels.numberInput.valueGreaterThanOrEqualToErrorMessage(numberInputContext.minNumber);else if (value > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return translatedLabels.numberInput.valueLessThanOrEqualToErrorMessage(numberInputContext.maxNumber);
|
|
189
171
|
};
|
|
190
|
-
|
|
191
|
-
var getTextInputWidth = (0, _react.useCallback)(function () {
|
|
192
|
-
var _inputRef$current, _inputRef$current$par;
|
|
193
|
-
|
|
194
|
-
var rect = inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$par = _inputRef$current.parentElement) === null || _inputRef$current$par === void 0 ? void 0 : _inputRef$current$par.getBoundingClientRect();
|
|
195
|
-
return rect === null || rect === void 0 ? void 0 : rect.width;
|
|
196
|
-
}, []);
|
|
197
|
-
|
|
198
172
|
var openSuggestions = function openSuggestions() {
|
|
199
173
|
hasSuggestions(suggestions) && changeIsOpen(true);
|
|
200
174
|
};
|
|
201
|
-
|
|
202
175
|
var closeSuggestions = function closeSuggestions() {
|
|
203
176
|
if (hasSuggestions(suggestions)) {
|
|
204
177
|
changeIsOpen(false);
|
|
205
178
|
changeVisualFocusIndex(-1);
|
|
206
179
|
}
|
|
207
180
|
};
|
|
208
|
-
|
|
209
181
|
var changeValue = function changeValue(newValue) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
value:
|
|
182
|
+
var formattedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
183
|
+
value !== null && value !== void 0 ? value : setInnerValue(formattedValue);
|
|
184
|
+
if (isRequired(formattedValue, optional)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
185
|
+
value: formattedValue,
|
|
214
186
|
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
215
|
-
});else if (isLengthIncorrect(
|
|
216
|
-
value:
|
|
187
|
+
});else if (isLengthIncorrect(formattedValue, minLength, maxLength)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
188
|
+
value: formattedValue,
|
|
217
189
|
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
218
|
-
});else if (
|
|
219
|
-
value:
|
|
190
|
+
});else if (patternMismatch(pattern, formattedValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
191
|
+
value: formattedValue,
|
|
220
192
|
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
221
|
-
});else if (isNumberIncorrect(newValue, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
222
|
-
value:
|
|
223
|
-
error: getNumberErrorMessage(newValue)
|
|
193
|
+
});else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && isNumberIncorrect(Number(newValue), numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
194
|
+
value: formattedValue,
|
|
195
|
+
error: getNumberErrorMessage(Number(newValue))
|
|
224
196
|
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
225
|
-
value:
|
|
197
|
+
value: formattedValue
|
|
226
198
|
});
|
|
227
199
|
};
|
|
228
|
-
|
|
229
200
|
var handleInputContainerOnClick = function handleInputContainerOnClick() {
|
|
230
201
|
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
231
202
|
};
|
|
232
|
-
|
|
233
203
|
var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
|
|
234
204
|
// Avoid input to lose the focus when the container is pressed
|
|
235
205
|
document.activeElement === inputRef.current && event.preventDefault();
|
|
236
206
|
};
|
|
237
|
-
|
|
238
207
|
var handleInputOnChange = function handleInputOnChange(event) {
|
|
239
208
|
openSuggestions();
|
|
240
209
|
changeValue(event.target.value);
|
|
241
210
|
};
|
|
242
|
-
|
|
243
211
|
var handleInputOnBlur = function handleInputOnBlur(event) {
|
|
244
212
|
closeSuggestions();
|
|
245
|
-
if (
|
|
213
|
+
if (isRequired(event.target.value, optional)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
246
214
|
value: event.target.value,
|
|
247
215
|
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
248
216
|
});else if (isLengthIncorrect(event.target.value, minLength, maxLength)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
249
217
|
value: event.target.value,
|
|
250
218
|
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
251
|
-
});else if (
|
|
219
|
+
});else if (patternMismatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
252
220
|
value: event.target.value,
|
|
253
221
|
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
254
|
-
});else if (isNumberIncorrect(event.target.value, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
222
|
+
});else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && isNumberIncorrect(Number(event.target.value), numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
255
223
|
value: event.target.value,
|
|
256
|
-
error: getNumberErrorMessage(event.target.value)
|
|
224
|
+
error: getNumberErrorMessage(Number(event.target.value))
|
|
257
225
|
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
258
226
|
value: event.target.value
|
|
259
227
|
});
|
|
260
228
|
};
|
|
261
|
-
|
|
262
229
|
var handleInputOnKeyDown = function handleInputOnKeyDown(event) {
|
|
263
230
|
switch (event.key) {
|
|
264
231
|
case "Down":
|
|
265
232
|
case "ArrowDown":
|
|
266
233
|
event.preventDefault();
|
|
267
|
-
|
|
268
|
-
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
|
|
269
|
-
decrementNumber();
|
|
270
|
-
} else {
|
|
234
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") decrementNumber();else {
|
|
271
235
|
openSuggestions();
|
|
272
|
-
|
|
273
236
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
274
237
|
changeVisualFocusIndex(function (visualFocusedSuggIndex) {
|
|
275
238
|
if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
|
|
276
239
|
});
|
|
277
240
|
}
|
|
278
241
|
}
|
|
279
|
-
|
|
280
242
|
break;
|
|
281
|
-
|
|
282
243
|
case "Up":
|
|
283
244
|
case "ArrowUp":
|
|
284
245
|
event.preventDefault();
|
|
285
|
-
|
|
286
|
-
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
|
|
287
|
-
incrementNumber();
|
|
288
|
-
} else {
|
|
246
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") incrementNumber();else {
|
|
289
247
|
openSuggestions();
|
|
290
|
-
|
|
291
248
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
292
249
|
changeVisualFocusIndex(function (visualFocusedSuggIndex) {
|
|
293
250
|
if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
|
|
294
251
|
});
|
|
295
252
|
}
|
|
296
253
|
}
|
|
297
|
-
|
|
298
254
|
break;
|
|
299
|
-
|
|
300
255
|
case "Esc":
|
|
301
256
|
case "Escape":
|
|
302
257
|
event.preventDefault();
|
|
303
|
-
|
|
304
258
|
if (hasSuggestions(suggestions)) {
|
|
305
259
|
changeValue("");
|
|
306
260
|
isOpen && closeSuggestions();
|
|
307
261
|
}
|
|
308
|
-
|
|
309
262
|
break;
|
|
310
|
-
|
|
311
263
|
case "Enter":
|
|
312
264
|
if (hasSuggestions(suggestions) && !isSearching) {
|
|
313
265
|
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusIndex >= 0 && visualFocusIndex < filteredSuggestions.length;
|
|
314
266
|
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusIndex]);
|
|
315
267
|
isOpen && closeSuggestions();
|
|
316
268
|
}
|
|
317
|
-
|
|
318
269
|
break;
|
|
319
270
|
}
|
|
320
271
|
};
|
|
321
|
-
|
|
322
272
|
var handleClearActionOnClick = function handleClearActionOnClick() {
|
|
323
273
|
changeValue("");
|
|
324
274
|
inputRef.current.focus();
|
|
325
275
|
suggestions && closeSuggestions();
|
|
326
276
|
};
|
|
327
|
-
|
|
328
277
|
var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
|
|
329
278
|
decrementNumber();
|
|
330
279
|
inputRef.current.focus();
|
|
331
280
|
};
|
|
332
|
-
|
|
333
281
|
var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
|
|
334
282
|
incrementNumber();
|
|
335
283
|
inputRef.current.focus();
|
|
336
284
|
};
|
|
337
|
-
|
|
338
285
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
339
|
-
var _inputRef$
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("step", step));
|
|
286
|
+
var _inputRef$current, _inputRef$current2, _inputRef$current3, _inputRef$current4;
|
|
287
|
+
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setAttribute("min", min));
|
|
288
|
+
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setAttribute("max", max));
|
|
289
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("step", step);
|
|
290
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("type", type);
|
|
345
291
|
};
|
|
346
|
-
|
|
347
292
|
var decrementNumber = function decrementNumber() {
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
354
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "" || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber))) {
|
|
355
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
356
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) >= (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue !== "") {
|
|
357
|
-
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
358
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
359
|
-
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
360
|
-
} else if (numberValue === "") {
|
|
361
|
-
changeValue(-1);
|
|
293
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
294
|
+
var numberValue = Number(currentValue);
|
|
295
|
+
var steppedValue = Math.round((numberValue - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
296
|
+
if (currentValue !== "") {
|
|
297
|
+
if (numberValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || steppedValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberValue);else if (numberValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else if (numberValue === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else changeValue(steppedValue);
|
|
362
298
|
} else {
|
|
363
|
-
changeValue(
|
|
299
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) >= 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) < 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(-numberInputContext.stepNumber);
|
|
364
300
|
}
|
|
365
301
|
};
|
|
366
|
-
|
|
367
302
|
var incrementNumber = function incrementNumber() {
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
374
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && (parseInt(numberValue) === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber))) {
|
|
375
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
376
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) <= (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue !== "") {
|
|
377
|
-
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
378
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
379
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
380
|
-
} else if (numberValue === "") {
|
|
381
|
-
changeValue(1);
|
|
303
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
304
|
+
var numberValue = Number(currentValue);
|
|
305
|
+
var steppedValue = Math.round((numberValue + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
306
|
+
if (currentValue !== "") {
|
|
307
|
+
if (numberValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || steppedValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberValue);else if (numberValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if (numberValue === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(steppedValue);
|
|
382
308
|
} else {
|
|
383
|
-
changeValue(
|
|
309
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) > 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) <= 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(numberInputContext.stepNumber);
|
|
384
310
|
}
|
|
385
311
|
};
|
|
386
|
-
|
|
387
312
|
(0, _react.useEffect)(function () {
|
|
388
313
|
if (typeof suggestions === "function") {
|
|
389
314
|
changeIsSearching(true);
|
|
@@ -409,8 +334,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
409
334
|
}));
|
|
410
335
|
changeVisualFocusIndex(-1);
|
|
411
336
|
}
|
|
412
|
-
|
|
413
|
-
(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
337
|
+
numberInputContext != null && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
414
338
|
}, [value, innerValue, suggestions, numberInputContext]);
|
|
415
339
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
416
340
|
theme: colorsTheme.textInput
|
|
@@ -421,21 +345,10 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
421
345
|
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
422
346
|
htmlFor: inputId,
|
|
423
347
|
disabled: disabled,
|
|
424
|
-
backgroundType: backgroundType,
|
|
425
348
|
hasHelperText: helperText ? true : false
|
|
426
349
|
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
427
|
-
disabled: disabled
|
|
428
|
-
|
|
429
|
-
}, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
|
|
430
|
-
error: error ? true : false,
|
|
431
|
-
disabled: disabled,
|
|
432
|
-
backgroundType: backgroundType,
|
|
433
|
-
onClick: handleInputContainerOnClick,
|
|
434
|
-
onMouseDown: handleInputContainerOnMouseDown
|
|
435
|
-
}, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
|
|
436
|
-
disabled: disabled,
|
|
437
|
-
backgroundType: backgroundType
|
|
438
|
-
}, prefix), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
|
|
350
|
+
disabled: disabled
|
|
351
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
|
|
439
352
|
condition: hasSuggestions(suggestions),
|
|
440
353
|
wrapper: function wrapper(children) {
|
|
441
354
|
return /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
@@ -443,8 +356,11 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
443
356
|
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
444
357
|
asChild: true,
|
|
445
358
|
"aria-controls": undefined
|
|
446
|
-
}, children), /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
359
|
+
}, children), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
447
360
|
sideOffset: 5,
|
|
361
|
+
style: {
|
|
362
|
+
zIndex: "2147483647"
|
|
363
|
+
},
|
|
448
364
|
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
|
449
365
|
// Avoid select to lose focus when the list is opened
|
|
450
366
|
event.preventDefault();
|
|
@@ -465,24 +381,35 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
465
381
|
changeValue(suggestion);
|
|
466
382
|
closeSuggestions();
|
|
467
383
|
},
|
|
468
|
-
|
|
469
|
-
|
|
384
|
+
styles: {
|
|
385
|
+
width: width
|
|
386
|
+
}
|
|
387
|
+
}))));
|
|
470
388
|
}
|
|
471
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
389
|
+
}, /*#__PURE__*/_react["default"].createElement(InputContainer, {
|
|
390
|
+
error: error ? true : false,
|
|
391
|
+
disabled: disabled,
|
|
392
|
+
readOnly: readOnly,
|
|
393
|
+
onClick: handleInputContainerOnClick,
|
|
394
|
+
onMouseDown: handleInputContainerOnMouseDown,
|
|
395
|
+
ref: inputContainerRef
|
|
396
|
+
}, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
|
|
397
|
+
disabled: disabled
|
|
398
|
+
}, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
|
|
472
399
|
id: inputId,
|
|
473
400
|
name: name,
|
|
474
401
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
475
402
|
placeholder: placeholder,
|
|
476
403
|
onBlur: handleInputOnBlur,
|
|
477
404
|
onChange: handleInputOnChange,
|
|
478
|
-
onFocus: openSuggestions,
|
|
479
|
-
onKeyDown: handleInputOnKeyDown,
|
|
405
|
+
onFocus: !readOnly ? openSuggestions : undefined,
|
|
406
|
+
onKeyDown: !readOnly ? handleInputOnKeyDown : undefined,
|
|
480
407
|
onMouseDown: function onMouseDown(event) {
|
|
481
408
|
event.stopPropagation();
|
|
482
409
|
},
|
|
483
410
|
disabled: disabled,
|
|
411
|
+
readOnly: readOnly,
|
|
484
412
|
ref: inputRef,
|
|
485
|
-
backgroundType: backgroundType,
|
|
486
413
|
pattern: pattern,
|
|
487
414
|
minLength: minLength,
|
|
488
415
|
maxLength: maxLength,
|
|
@@ -497,69 +424,61 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
497
424
|
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? "suggestion-".concat(visualFocusIndex) : undefined,
|
|
498
425
|
"aria-invalid": error ? true : false,
|
|
499
426
|
"aria-errormessage": error ? errorId : undefined,
|
|
500
|
-
"aria-required":
|
|
501
|
-
})
|
|
502
|
-
backgroundType: backgroundType,
|
|
427
|
+
"aria-required": !disabled && !optional
|
|
428
|
+
}), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
503
429
|
"aria-label": "Error"
|
|
504
|
-
}, _Icons["default"].error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
430
|
+
}, _Icons["default"].error), !disabled && !readOnly && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
431
|
+
"aria-label": translatedLabels.textInput.clearFieldActionTitle,
|
|
505
432
|
onClick: handleClearActionOnClick,
|
|
506
433
|
onMouseDown: function onMouseDown(event) {
|
|
507
434
|
event.stopPropagation();
|
|
508
435
|
},
|
|
509
|
-
backgroundType: backgroundType,
|
|
510
436
|
tabIndex: tabIndex,
|
|
511
437
|
title: translatedLabels.textInput.clearFieldActionTitle,
|
|
512
|
-
"aria-label": translatedLabels.textInput.clearFieldActionTitle,
|
|
513
438
|
type: "button"
|
|
514
439
|
}, _Icons["default"].clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Action, {
|
|
515
|
-
|
|
440
|
+
"aria-label": translatedLabels.numberInput.decrementValueTitle,
|
|
516
441
|
disabled: disabled,
|
|
517
|
-
onClick: handleDecrementActionOnClick,
|
|
442
|
+
onClick: !readOnly ? handleDecrementActionOnClick : undefined,
|
|
518
443
|
onMouseDown: function onMouseDown(event) {
|
|
519
444
|
event.stopPropagation();
|
|
520
445
|
},
|
|
521
|
-
|
|
446
|
+
ref: actionRef,
|
|
522
447
|
tabIndex: tabIndex,
|
|
523
448
|
title: translatedLabels.numberInput.decrementValueTitle,
|
|
524
|
-
"aria-label": translatedLabels.numberInput.decrementValueTitle,
|
|
525
449
|
type: "button"
|
|
526
450
|
}, _Icons["default"].decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
527
|
-
|
|
451
|
+
"aria-label": translatedLabels.numberInput.incrementValueTitle,
|
|
528
452
|
disabled: disabled,
|
|
529
|
-
onClick: handleIncrementActionOnClick,
|
|
453
|
+
onClick: !readOnly ? handleIncrementActionOnClick : undefined,
|
|
530
454
|
onMouseDown: function onMouseDown(event) {
|
|
531
455
|
event.stopPropagation();
|
|
532
456
|
},
|
|
533
|
-
|
|
457
|
+
ref: actionRef,
|
|
534
458
|
tabIndex: tabIndex,
|
|
535
459
|
title: translatedLabels.numberInput.incrementValueTitle,
|
|
536
|
-
"aria-label": translatedLabels.numberInput.incrementValueTitle,
|
|
537
460
|
type: "button"
|
|
538
461
|
}, _Icons["default"].increment)), action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
539
|
-
|
|
462
|
+
"aria-label": action.title,
|
|
540
463
|
disabled: disabled,
|
|
541
|
-
onClick: action.onClick,
|
|
464
|
+
onClick: !readOnly ? action.onClick : undefined,
|
|
542
465
|
onMouseDown: function onMouseDown(event) {
|
|
543
466
|
event.stopPropagation();
|
|
544
467
|
},
|
|
545
|
-
|
|
546
|
-
"aria-label": action.title,
|
|
547
|
-
backgroundType: backgroundType,
|
|
468
|
+
ref: actionRef,
|
|
548
469
|
tabIndex: tabIndex,
|
|
470
|
+
title: action.title,
|
|
549
471
|
type: "button"
|
|
550
472
|
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
551
473
|
src: action.icon
|
|
552
474
|
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
553
|
-
disabled: disabled
|
|
554
|
-
|
|
555
|
-
}, suffix)), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
475
|
+
disabled: disabled
|
|
476
|
+
}, suffix))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
556
477
|
id: errorId,
|
|
557
|
-
backgroundType: backgroundType,
|
|
558
478
|
"aria-live": error ? "assertive" : "off"
|
|
559
479
|
}, error)));
|
|
560
480
|
});
|
|
561
|
-
|
|
562
|
-
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
481
|
+
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
563
482
|
return calculateWidth(props.margin, props.size);
|
|
564
483
|
}, function (props) {
|
|
565
484
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -572,9 +491,8 @@ var TextInputContainer = _styledComponents["default"].div(_templateObject || (_t
|
|
|
572
491
|
}, function (props) {
|
|
573
492
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
574
493
|
});
|
|
575
|
-
|
|
576
494
|
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
577
|
-
return props.disabled ? props.
|
|
495
|
+
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
578
496
|
}, function (props) {
|
|
579
497
|
return props.theme.fontFamily;
|
|
580
498
|
}, function (props) {
|
|
@@ -588,13 +506,11 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
|
|
|
588
506
|
}, function (props) {
|
|
589
507
|
return !props.hasHelperText && "margin-bottom: 0.25rem";
|
|
590
508
|
});
|
|
591
|
-
|
|
592
509
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
593
510
|
return props.theme.optionalLabelFontWeight;
|
|
594
511
|
});
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
512
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
513
|
+
return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
|
|
598
514
|
}, function (props) {
|
|
599
515
|
return props.theme.fontFamily;
|
|
600
516
|
}, function (props) {
|
|
@@ -606,21 +522,17 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
606
522
|
}, function (props) {
|
|
607
523
|
return props.theme.helperTextLineHeight;
|
|
608
524
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
525
|
+
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: flex;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n\n ", ";\n"])), function (props) {
|
|
526
|
+
if (props.disabled) return "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
612
527
|
}, function (props) {
|
|
613
|
-
if (props.disabled) return props.
|
|
528
|
+
if (props.disabled) return props.theme.disabledBorderColor;else if (props.readOnly) return props.theme.readOnlyBorderColor;else return props.theme.enabledBorderColor;
|
|
614
529
|
}, function (props) {
|
|
615
|
-
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.
|
|
616
|
-
}, function (props) {
|
|
617
|
-
return props.disabled && "cursor: not-allowed;";
|
|
530
|
+
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorBorderColor, ";\n ");
|
|
618
531
|
}, function (props) {
|
|
619
|
-
return !props.disabled
|
|
532
|
+
return !props.disabled ? "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.theme.hoverBorderColor, ";\n ").concat(props.error ? "box-shadow: 0 0 0 2px ".concat(props.theme.hoverErrorBorderColor, ";") : "", "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusBorderColor, ";\n }\n ") : "cursor: not-allowed;";
|
|
620
533
|
});
|
|
621
|
-
|
|
622
534
|
var Input = _styledComponents["default"].input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(2.5rem - 2px);\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n ", "\n\n ::placeholder {\n color: ", ";\n }\n"])), function (props) {
|
|
623
|
-
return props.disabled ? props.
|
|
535
|
+
return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
|
|
624
536
|
}, function (props) {
|
|
625
537
|
return props.theme.fontFamily;
|
|
626
538
|
}, function (props) {
|
|
@@ -632,42 +544,35 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
|
|
|
632
544
|
}, function (props) {
|
|
633
545
|
return props.disabled && "cursor: not-allowed;";
|
|
634
546
|
}, function (props) {
|
|
635
|
-
return props.disabled ? props.
|
|
547
|
+
return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
|
|
636
548
|
});
|
|
637
|
-
|
|
638
|
-
var Action = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n border: 1px solid transparent;\n border-radius: 2px;\n width: 24px;\n height: 24px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n img, svg {\n width: 16px;\n height: 16px;\n }\n"])), function (props) {
|
|
549
|
+
var Action = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n border: 1px solid transparent;\n border-radius: 2px;\n width: 24px;\n height: 24px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n \n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n color: ", ";\n\n ", "\n\n img, svg {\n width: 16px;\n height: 16px;\n }\n"])), function (props) {
|
|
639
550
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
640
551
|
}, function (props) {
|
|
641
|
-
return props.disabled ? props.
|
|
552
|
+
return props.disabled ? props.theme.disabledActionBackgroundColor : props.theme.actionBackgroundColor;
|
|
642
553
|
}, function (props) {
|
|
643
|
-
return props.disabled ? props.
|
|
554
|
+
return props.disabled ? props.theme.disabledActionIconColor : props.theme.actionIconColor;
|
|
644
555
|
}, function (props) {
|
|
645
|
-
return !props.disabled && "\n &:focus
|
|
556
|
+
return !props.disabled && "\n &:focus, \n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.theme.focusActionBorderColor, ";\n color: ").concat(props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.theme.activeActionIconColor, ";\n }\n ");
|
|
646
557
|
});
|
|
647
|
-
|
|
648
558
|
var Prefix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
649
|
-
var color = props.disabled ? props.
|
|
559
|
+
var color = props.disabled ? props.theme.disabledPrefixColor : props.theme.prefixColor;
|
|
650
560
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
651
561
|
}, function (props) {
|
|
652
562
|
return props.theme.fontFamily;
|
|
653
563
|
});
|
|
654
|
-
|
|
655
564
|
var Suffix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
656
|
-
var color = props.disabled ? props.
|
|
565
|
+
var color = props.disabled ? props.theme.disabledSuffixColor : props.theme.suffixColor;
|
|
657
566
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
658
567
|
}, function (props) {
|
|
659
568
|
return props.theme.fontFamily;
|
|
660
569
|
});
|
|
661
|
-
|
|
662
570
|
var ErrorIcon = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
|
|
663
|
-
return props.
|
|
571
|
+
return props.theme.errorIconColor;
|
|
664
572
|
});
|
|
665
|
-
|
|
666
573
|
var Error = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
667
|
-
return props.
|
|
574
|
+
return props.theme.errorMessageColor;
|
|
668
575
|
}, function (props) {
|
|
669
576
|
return props.theme.fontFamily;
|
|
670
577
|
});
|
|
671
|
-
|
|
672
|
-
var _default = DxcTextInput;
|
|
673
|
-
exports["default"] = _default;
|
|
578
|
+
var _default = exports["default"] = DxcTextInput;
|