@dxc-technology/halstack-react 0.0.0-61a8ced → 0.0.0-62702b8
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 +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1349 -5
- package/HalstackContext.js +117 -77
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +14 -37
- package/accordion/Accordion.stories.tsx +104 -113
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +2 -13
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +23 -44
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +7 -17
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +2 -13
- package/alert/Alert.js +4 -8
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +7 -26
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -11
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +48 -60
- package/button/Button.stories.tsx +151 -9
- package/button/Button.test.js +12 -1
- package/button/types.d.ts +7 -3
- package/card/Card.d.ts +1 -1
- package/card/Card.js +27 -45
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +1 -1
- package/card/types.d.ts +1 -6
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +74 -53
- package/checkbox/Checkbox.stories.tsx +146 -58
- package/checkbox/Checkbox.test.js +84 -11
- package/checkbox/types.d.ts +10 -2
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1499 -0
- package/common/variables.js +1004 -1134
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +138 -239
- package/date-input/DateInput.stories.tsx +209 -33
- package/date-input/DateInput.test.js +519 -149
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +57 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +54 -85
- package/dialog/Dialog.stories.tsx +154 -170
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +0 -12
- package/dropdown/Dropdown.js +42 -41
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +22 -27
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +5 -18
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +174 -220
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +18 -1
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +33 -19
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +83 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +44 -64
- package/footer/Footer.stories.tsx +36 -21
- package/footer/Footer.test.js +16 -26
- package/footer/types.d.ts +10 -11
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +20 -49
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +1 -14
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/image/Image.d.ts +4 -0
- package/image/Image.js +85 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/inset/Inset.stories.tsx +2 -1
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +15 -12
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +7 -4
- package/layout/Icons.js +52 -56
- package/layout/types.d.ts +2 -3
- package/link/Link.js +4 -4
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +5 -3
- package/main.js +18 -2
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +110 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +49 -33
- package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +8 -4
- package/number-input/NumberInput.stories.tsx +47 -2
- package/number-input/NumberInput.test.js +354 -92
- package/number-input/types.d.ts +6 -0
- package/package.json +14 -19
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +8 -16
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +58 -48
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.js +35 -82
- package/password-input/PasswordInput.stories.tsx +1 -0
- package/password-input/PasswordInput.test.js +34 -40
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +111 -19
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +50 -35
- package/radio-group/RadioGroup.js +29 -29
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.js +153 -99
- package/radio-group/types.d.ts +5 -5
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +51 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +49 -108
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +50 -25
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +41 -64
- package/{resultsetTable → resultset-table}/types.d.ts +1 -1
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -35
- package/select/Option.js +11 -24
- package/select/Select.js +59 -36
- package/select/Select.stories.tsx +497 -153
- package/select/Select.test.js +345 -292
- package/select/types.d.ts +2 -2
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +66 -96
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +17 -14
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +95 -84
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +27 -14
- package/switch/types.d.ts +8 -3
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +40 -11
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +232 -342
- package/text-input/TextInput.stories.tsx +319 -184
- package/text-input/TextInput.test.js +848 -726
- package/text-input/types.d.ts +27 -2
- package/textarea/Textarea.js +27 -26
- package/textarea/Textarea.stories.jsx +68 -1
- package/textarea/Textarea.test.js +61 -19
- package/textarea/types.d.ts +4 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +85 -59
- package/toggle-group/ToggleGroup.stories.tsx +48 -3
- package/toggle-group/ToggleGroup.test.js +38 -24
- package/toggle-group/types.d.ts +22 -13
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1251 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- package/card/ice-cream.jpg +0 -0
- package/common/RequiredComponent.js +0 -32
- 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 → grid}/types.js +0 -0
- /package/{tabs-nav → image}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{number-input/numberInputContextTypes.js → nav-tabs/types.js} +0 -0
- /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
package/text-input/TextInput.js
CHANGED
|
@@ -23,70 +23,44 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
23
23
|
|
|
24
24
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
25
25
|
|
|
26
|
-
var _variables = require("../common/variables
|
|
26
|
+
var _variables = require("../common/variables");
|
|
27
27
|
|
|
28
|
-
var _utils = require("../common/utils
|
|
29
|
-
|
|
30
|
-
var _uuid = require("uuid");
|
|
28
|
+
var _utils = require("../common/utils");
|
|
31
29
|
|
|
32
30
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
31
|
|
|
34
|
-
var
|
|
32
|
+
var _NumberInput = require("../number-input/NumberInput");
|
|
35
33
|
|
|
36
|
-
var
|
|
34
|
+
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
|
37
35
|
|
|
38
|
-
var
|
|
36
|
+
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
37
|
+
|
|
38
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
39
|
+
|
|
40
|
+
var _uuid = require("uuid");
|
|
41
|
+
|
|
42
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
39
43
|
|
|
40
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
45
|
|
|
42
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; }
|
|
43
47
|
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
61
|
-
d: "M0 0h24v24H0V0z",
|
|
62
|
-
fill: "none"
|
|
63
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
64
|
-
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
65
|
-
})),
|
|
66
|
-
increment: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
67
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
68
|
-
height: "24px",
|
|
69
|
-
viewBox: "0 0 24 24",
|
|
70
|
-
width: "24px",
|
|
71
|
-
fill: "currentColor"
|
|
72
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
73
|
-
d: "M0 0h24v24H0z",
|
|
74
|
-
fill: "none"
|
|
75
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
76
|
-
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
|
77
|
-
})),
|
|
78
|
-
decrement: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
79
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
-
height: "24px",
|
|
81
|
-
viewBox: "0 0 24 24",
|
|
82
|
-
width: "24px",
|
|
83
|
-
fill: "currentColor"
|
|
84
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
85
|
-
d: "M0 0h24v24H0z",
|
|
86
|
-
fill: "none"
|
|
87
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
88
|
-
d: "M19 13H5v-2h14v2z"
|
|
89
|
-
}))
|
|
48
|
+
var sizes = {
|
|
49
|
+
small: "240px",
|
|
50
|
+
medium: "360px",
|
|
51
|
+
large: "480px",
|
|
52
|
+
fillParent: "100%"
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var AutosuggestWrapper = function AutosuggestWrapper(_ref) {
|
|
56
|
+
var condition = _ref.condition,
|
|
57
|
+
wrapper = _ref.wrapper,
|
|
58
|
+
children = _ref.children;
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, condition ? wrapper(children) : children);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var calculateWidth = function calculateWidth(margin, size) {
|
|
63
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
90
64
|
};
|
|
91
65
|
|
|
92
66
|
var makeCancelable = function makeCancelable(promise) {
|
|
@@ -110,63 +84,71 @@ var makeCancelable = function makeCancelable(promise) {
|
|
|
110
84
|
};
|
|
111
85
|
};
|
|
112
86
|
|
|
113
|
-
var
|
|
114
|
-
return
|
|
87
|
+
var hasSuggestions = function hasSuggestions(suggestions) {
|
|
88
|
+
return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
|
|
115
89
|
};
|
|
116
90
|
|
|
117
|
-
var
|
|
118
|
-
|
|
91
|
+
var isRequired = function isRequired(value, optional) {
|
|
92
|
+
return value === "" && !optional;
|
|
93
|
+
};
|
|
119
94
|
|
|
120
|
-
|
|
121
|
-
|
|
95
|
+
var isLengthIncorrect = function isLengthIncorrect(value, minLength, maxLength) {
|
|
96
|
+
return value != null && (value.length < minLength || value.length > maxLength);
|
|
97
|
+
};
|
|
122
98
|
|
|
123
|
-
|
|
124
|
-
|
|
99
|
+
var isNumberIncorrect = function isNumberIncorrect(value, minNumber, maxNumber) {
|
|
100
|
+
return value < minNumber || value > maxNumber;
|
|
101
|
+
};
|
|
125
102
|
|
|
126
|
-
|
|
127
|
-
return
|
|
103
|
+
var patternMismatch = function patternMismatch(pattern, value) {
|
|
104
|
+
return pattern != null && !new RegExp(pattern).test(value);
|
|
128
105
|
};
|
|
129
106
|
|
|
130
|
-
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
131
|
-
var label =
|
|
132
|
-
|
|
133
|
-
name =
|
|
134
|
-
|
|
135
|
-
defaultValue =
|
|
136
|
-
value =
|
|
137
|
-
helperText =
|
|
138
|
-
|
|
139
|
-
placeholder =
|
|
140
|
-
action =
|
|
141
|
-
|
|
142
|
-
clearable =
|
|
143
|
-
|
|
144
|
-
disabled =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
107
|
+
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
108
|
+
var label = _ref2.label,
|
|
109
|
+
_ref2$name = _ref2.name,
|
|
110
|
+
name = _ref2$name === void 0 ? "" : _ref2$name,
|
|
111
|
+
_ref2$defaultValue = _ref2.defaultValue,
|
|
112
|
+
defaultValue = _ref2$defaultValue === void 0 ? "" : _ref2$defaultValue,
|
|
113
|
+
value = _ref2.value,
|
|
114
|
+
helperText = _ref2.helperText,
|
|
115
|
+
_ref2$placeholder = _ref2.placeholder,
|
|
116
|
+
placeholder = _ref2$placeholder === void 0 ? "" : _ref2$placeholder,
|
|
117
|
+
action = _ref2.action,
|
|
118
|
+
_ref2$clearable = _ref2.clearable,
|
|
119
|
+
clearable = _ref2$clearable === void 0 ? false : _ref2$clearable,
|
|
120
|
+
_ref2$disabled = _ref2.disabled,
|
|
121
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
122
|
+
_ref2$readOnly = _ref2.readOnly,
|
|
123
|
+
readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
|
|
124
|
+
_ref2$optional = _ref2.optional,
|
|
125
|
+
optional = _ref2$optional === void 0 ? false : _ref2$optional,
|
|
126
|
+
_ref2$prefix = _ref2.prefix,
|
|
127
|
+
prefix = _ref2$prefix === void 0 ? "" : _ref2$prefix,
|
|
128
|
+
_ref2$suffix = _ref2.suffix,
|
|
129
|
+
suffix = _ref2$suffix === void 0 ? "" : _ref2$suffix,
|
|
130
|
+
onChange = _ref2.onChange,
|
|
131
|
+
onBlur = _ref2.onBlur,
|
|
132
|
+
error = _ref2.error,
|
|
133
|
+
suggestions = _ref2.suggestions,
|
|
134
|
+
pattern = _ref2.pattern,
|
|
135
|
+
minLength = _ref2.minLength,
|
|
136
|
+
maxLength = _ref2.maxLength,
|
|
137
|
+
_ref2$autocomplete = _ref2.autocomplete,
|
|
138
|
+
autocomplete = _ref2$autocomplete === void 0 ? "off" : _ref2$autocomplete,
|
|
139
|
+
margin = _ref2.margin,
|
|
140
|
+
_ref2$size = _ref2.size,
|
|
141
|
+
size = _ref2$size === void 0 ? "medium" : _ref2$size,
|
|
142
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
143
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
165
144
|
|
|
166
145
|
var _useState = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
167
146
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
168
147
|
inputId = _useState2[0];
|
|
169
148
|
|
|
149
|
+
var autosuggestId = "suggestions-".concat(inputId);
|
|
150
|
+
var errorId = "error-".concat(inputId);
|
|
151
|
+
|
|
170
152
|
var _useState3 = (0, _react.useState)(defaultValue),
|
|
171
153
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
172
154
|
innerValue = _useState4[0],
|
|
@@ -194,74 +176,55 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
194
176
|
|
|
195
177
|
var _useState13 = (0, _react.useState)(-1),
|
|
196
178
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
visualFocusIndex = _useState14[0],
|
|
180
|
+
changeVisualFocusIndex = _useState14[1];
|
|
199
181
|
|
|
200
|
-
var suggestionsRef = (0, _react.useRef)(null);
|
|
201
182
|
var inputRef = (0, _react.useRef)(null);
|
|
202
183
|
var actionRef = (0, _react.useRef)(null);
|
|
203
184
|
var colorsTheme = (0, _useTheme["default"])();
|
|
204
185
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
205
186
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
206
|
-
var
|
|
207
|
-
var errorId = "error-".concat(inputId);
|
|
208
|
-
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
209
|
-
var lastOptionIndex = (0, _react.useMemo)(function () {
|
|
210
|
-
return getLastOptionIndex(filteredSuggestions);
|
|
211
|
-
}, [filteredSuggestions]);
|
|
212
|
-
|
|
213
|
-
var isNotOptional = function isNotOptional(value) {
|
|
214
|
-
return value === "" && !optional;
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
var isLengthIncorrect = function isLengthIncorrect(value) {
|
|
218
|
-
return value && minLength && maxLength && (value.length < minLength || value.length > maxLength);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
222
|
-
return (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
var isTextInputType = function isTextInputType() {
|
|
226
|
-
var _inputRef$current, _inputRef$current2;
|
|
227
|
-
|
|
228
|
-
return !(inputRef !== null && inputRef !== void 0 && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.getAttribute("type")) || (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.getAttribute("type")) === "text";
|
|
229
|
-
};
|
|
187
|
+
var numberInputContext = (0, _react.useContext)(_NumberInput.NumberInputContext);
|
|
230
188
|
|
|
231
189
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
232
|
-
if (
|
|
190
|
+
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);
|
|
233
191
|
};
|
|
234
192
|
|
|
235
|
-
var
|
|
236
|
-
|
|
237
|
-
|
|
193
|
+
var getTextInputWidth = (0, _react.useCallback)(function () {
|
|
194
|
+
var _inputRef$current, _inputRef$current$par;
|
|
195
|
+
|
|
196
|
+
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();
|
|
197
|
+
return rect === null || rect === void 0 ? void 0 : rect.width;
|
|
198
|
+
}, []);
|
|
238
199
|
|
|
239
200
|
var openSuggestions = function openSuggestions() {
|
|
240
|
-
hasSuggestions() && changeIsOpen(true);
|
|
201
|
+
hasSuggestions(suggestions) && changeIsOpen(true);
|
|
241
202
|
};
|
|
242
203
|
|
|
243
204
|
var closeSuggestions = function closeSuggestions() {
|
|
244
|
-
|
|
245
|
-
|
|
205
|
+
if (hasSuggestions(suggestions)) {
|
|
206
|
+
changeIsOpen(false);
|
|
207
|
+
changeVisualFocusIndex(-1);
|
|
208
|
+
}
|
|
246
209
|
};
|
|
247
210
|
|
|
248
211
|
var changeValue = function changeValue(newValue) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (
|
|
252
|
-
value:
|
|
212
|
+
var formattedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
213
|
+
value !== null && value !== void 0 ? value : setInnerValue(formattedValue);
|
|
214
|
+
if (isRequired(formattedValue, optional)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
215
|
+
value: formattedValue,
|
|
253
216
|
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
254
|
-
});else if (isLengthIncorrect(
|
|
255
|
-
value:
|
|
217
|
+
});else if (isLengthIncorrect(formattedValue, minLength, maxLength)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
218
|
+
value: formattedValue,
|
|
256
219
|
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
257
|
-
});else if (
|
|
258
|
-
value:
|
|
220
|
+
});else if (patternMismatch(pattern, formattedValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
221
|
+
value: formattedValue,
|
|
259
222
|
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
260
|
-
});else if (
|
|
261
|
-
value:
|
|
262
|
-
error: getNumberErrorMessage(newValue)
|
|
223
|
+
});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({
|
|
224
|
+
value: formattedValue,
|
|
225
|
+
error: getNumberErrorMessage(Number(newValue))
|
|
263
226
|
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
264
|
-
value:
|
|
227
|
+
value: formattedValue
|
|
265
228
|
});
|
|
266
229
|
};
|
|
267
230
|
|
|
@@ -274,73 +237,65 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
274
237
|
document.activeElement === inputRef.current && event.preventDefault();
|
|
275
238
|
};
|
|
276
239
|
|
|
277
|
-
var
|
|
240
|
+
var handleInputOnChange = function handleInputOnChange(event) {
|
|
278
241
|
openSuggestions();
|
|
279
242
|
changeValue(event.target.value);
|
|
280
243
|
};
|
|
281
244
|
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
if (
|
|
245
|
+
var handleInputOnBlur = function handleInputOnBlur(event) {
|
|
246
|
+
closeSuggestions();
|
|
247
|
+
if (isRequired(event.target.value, optional)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
285
248
|
value: event.target.value,
|
|
286
249
|
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
287
|
-
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
250
|
+
});else if (isLengthIncorrect(event.target.value, minLength, maxLength)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
288
251
|
value: event.target.value,
|
|
289
252
|
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
290
|
-
});else if (
|
|
253
|
+
});else if (patternMismatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
291
254
|
value: event.target.value,
|
|
292
255
|
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
293
|
-
});else if (
|
|
256
|
+
});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({
|
|
294
257
|
value: event.target.value,
|
|
295
|
-
error: getNumberErrorMessage(event.target.value)
|
|
258
|
+
error: getNumberErrorMessage(Number(event.target.value))
|
|
296
259
|
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
297
260
|
value: event.target.value
|
|
298
261
|
});
|
|
299
262
|
};
|
|
300
263
|
|
|
301
|
-
var
|
|
264
|
+
var handleInputOnKeyDown = function handleInputOnKeyDown(event) {
|
|
302
265
|
switch (event.key) {
|
|
303
266
|
case "Down":
|
|
304
267
|
case "ArrowDown":
|
|
305
268
|
event.preventDefault();
|
|
306
|
-
|
|
307
|
-
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
|
|
308
|
-
decrementNumber();
|
|
309
|
-
} else {
|
|
269
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") decrementNumber();else {
|
|
310
270
|
openSuggestions();
|
|
311
271
|
|
|
312
272
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
313
|
-
|
|
273
|
+
changeVisualFocusIndex(function (visualFocusedSuggIndex) {
|
|
314
274
|
if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
|
|
315
275
|
});
|
|
316
276
|
}
|
|
317
277
|
}
|
|
318
|
-
|
|
319
278
|
break;
|
|
320
279
|
|
|
321
280
|
case "Up":
|
|
322
281
|
case "ArrowUp":
|
|
323
282
|
event.preventDefault();
|
|
324
|
-
|
|
325
|
-
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
|
|
326
|
-
incrementNumber();
|
|
327
|
-
} else {
|
|
283
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") incrementNumber();else {
|
|
328
284
|
openSuggestions();
|
|
329
285
|
|
|
330
286
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
331
|
-
|
|
287
|
+
changeVisualFocusIndex(function (visualFocusedSuggIndex) {
|
|
332
288
|
if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
|
|
333
289
|
});
|
|
334
290
|
}
|
|
335
291
|
}
|
|
336
|
-
|
|
337
292
|
break;
|
|
338
293
|
|
|
339
294
|
case "Esc":
|
|
340
295
|
case "Escape":
|
|
341
296
|
event.preventDefault();
|
|
342
297
|
|
|
343
|
-
if (hasSuggestions()) {
|
|
298
|
+
if (hasSuggestions(suggestions)) {
|
|
344
299
|
changeValue("");
|
|
345
300
|
isOpen && closeSuggestions();
|
|
346
301
|
}
|
|
@@ -348,9 +303,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
348
303
|
break;
|
|
349
304
|
|
|
350
305
|
case "Enter":
|
|
351
|
-
if (hasSuggestions() && !isSearching) {
|
|
352
|
-
var validFocusedSuggestion = filteredSuggestions.length > 0 &&
|
|
353
|
-
validFocusedSuggestion && changeValue(filteredSuggestions[
|
|
306
|
+
if (hasSuggestions(suggestions) && !isSearching) {
|
|
307
|
+
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusIndex >= 0 && visualFocusIndex < filteredSuggestions.length;
|
|
308
|
+
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusIndex]);
|
|
354
309
|
isOpen && closeSuggestions();
|
|
355
310
|
}
|
|
356
311
|
|
|
@@ -375,63 +330,38 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
375
330
|
};
|
|
376
331
|
|
|
377
332
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
378
|
-
var _inputRef$
|
|
333
|
+
var _inputRef$current2, _inputRef$current3, _inputRef$current4, _inputRef$current5;
|
|
379
334
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
335
|
+
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setAttribute("min", min));
|
|
336
|
+
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("max", max));
|
|
337
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("step", step);
|
|
338
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("type", type);
|
|
384
339
|
};
|
|
385
340
|
|
|
386
341
|
var decrementNumber = function decrementNumber() {
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
393
|
-
} 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))) {
|
|
394
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
395
|
-
} 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 !== "") {
|
|
396
|
-
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
397
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
398
|
-
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
399
|
-
} else if (numberValue === "") {
|
|
400
|
-
changeValue(-1);
|
|
342
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
343
|
+
var numberValue = Number(currentValue);
|
|
344
|
+
var steppedValue = Math.round((numberValue - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
345
|
+
|
|
346
|
+
if (currentValue !== "") {
|
|
347
|
+
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);
|
|
401
348
|
} else {
|
|
402
|
-
changeValue(
|
|
349
|
+
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);
|
|
403
350
|
}
|
|
404
351
|
};
|
|
405
352
|
|
|
406
353
|
var incrementNumber = function incrementNumber() {
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
413
|
-
} 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))) {
|
|
414
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
415
|
-
} 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 !== "") {
|
|
416
|
-
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
417
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
418
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
419
|
-
} else if (numberValue === "") {
|
|
420
|
-
changeValue(1);
|
|
354
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
355
|
+
var numberValue = Number(currentValue);
|
|
356
|
+
var steppedValue = Math.round((numberValue + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
357
|
+
|
|
358
|
+
if (currentValue !== "") {
|
|
359
|
+
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);
|
|
421
360
|
} else {
|
|
422
|
-
changeValue(
|
|
361
|
+
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);
|
|
423
362
|
}
|
|
424
363
|
};
|
|
425
364
|
|
|
426
|
-
(0, _react.useLayoutEffect)(function () {
|
|
427
|
-
var _suggestionsRef$curre, _visualFocusedOptionE;
|
|
428
|
-
|
|
429
|
-
var visualFocusedOptionEl = suggestionsRef === null || suggestionsRef === void 0 ? void 0 : (_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.querySelectorAll("[role='option']")[visualFocusedSuggIndex];
|
|
430
|
-
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
431
|
-
block: "nearest",
|
|
432
|
-
inline: "start"
|
|
433
|
-
});
|
|
434
|
-
}, [visualFocusedSuggIndex]);
|
|
435
365
|
(0, _react.useEffect)(function () {
|
|
436
366
|
if (typeof suggestions === "function") {
|
|
437
367
|
changeIsSearching(true);
|
|
@@ -455,10 +385,10 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
455
385
|
changeFilteredSuggestions(suggestions.filter(function (suggestion) {
|
|
456
386
|
return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
|
|
457
387
|
}));
|
|
458
|
-
|
|
388
|
+
changeVisualFocusIndex(-1);
|
|
459
389
|
}
|
|
460
390
|
|
|
461
|
-
|
|
391
|
+
numberInputContext != null && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
462
392
|
}, [value, innerValue, suggestions, numberInputContext]);
|
|
463
393
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
464
394
|
theme: colorsTheme.textInput
|
|
@@ -477,145 +407,139 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
477
407
|
}, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
|
|
478
408
|
error: error ? true : false,
|
|
479
409
|
disabled: disabled,
|
|
410
|
+
readOnly: readOnly,
|
|
480
411
|
backgroundType: backgroundType,
|
|
481
412
|
onClick: handleInputContainerOnClick,
|
|
482
413
|
onMouseDown: handleInputContainerOnMouseDown
|
|
483
414
|
}, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
|
|
484
415
|
disabled: disabled,
|
|
485
416
|
backgroundType: backgroundType
|
|
486
|
-
}, prefix), /*#__PURE__*/_react["default"].createElement(
|
|
417
|
+
}, prefix), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
|
|
418
|
+
condition: hasSuggestions(suggestions),
|
|
419
|
+
wrapper: function wrapper(children) {
|
|
420
|
+
return /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
421
|
+
open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError)
|
|
422
|
+
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
423
|
+
asChild: true,
|
|
424
|
+
"aria-controls": undefined
|
|
425
|
+
}, children), /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
426
|
+
sideOffset: 5,
|
|
427
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
|
428
|
+
// Avoid select to lose focus when the list is opened
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
},
|
|
431
|
+
onCloseAutoFocus: function onCloseAutoFocus(event) {
|
|
432
|
+
// Avoid select to lose focus when the list is closed
|
|
433
|
+
event.preventDefault();
|
|
434
|
+
}
|
|
435
|
+
}, /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
436
|
+
id: autosuggestId,
|
|
437
|
+
value: value !== null && value !== void 0 ? value : innerValue,
|
|
438
|
+
suggestions: filteredSuggestions,
|
|
439
|
+
visualFocusIndex: visualFocusIndex,
|
|
440
|
+
highlightedSuggestions: typeof suggestions !== "function",
|
|
441
|
+
searchHasErrors: isAutosuggestError,
|
|
442
|
+
isSearching: isSearching,
|
|
443
|
+
suggestionOnClick: function suggestionOnClick(suggestion) {
|
|
444
|
+
changeValue(suggestion);
|
|
445
|
+
closeSuggestions();
|
|
446
|
+
},
|
|
447
|
+
getTextInputWidth: getTextInputWidth
|
|
448
|
+
})));
|
|
449
|
+
}
|
|
450
|
+
}, /*#__PURE__*/_react["default"].createElement(Input, {
|
|
487
451
|
id: inputId,
|
|
488
452
|
name: name,
|
|
489
453
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
490
454
|
placeholder: placeholder,
|
|
491
|
-
onBlur:
|
|
492
|
-
onChange:
|
|
493
|
-
onFocus:
|
|
494
|
-
|
|
495
|
-
},
|
|
496
|
-
onKeyDown: handleIOnKeyDown,
|
|
455
|
+
onBlur: handleInputOnBlur,
|
|
456
|
+
onChange: handleInputOnChange,
|
|
457
|
+
onFocus: !readOnly ? openSuggestions : undefined,
|
|
458
|
+
onKeyDown: !readOnly ? handleInputOnKeyDown : undefined,
|
|
497
459
|
onMouseDown: function onMouseDown(event) {
|
|
498
460
|
event.stopPropagation();
|
|
499
461
|
},
|
|
500
462
|
disabled: disabled,
|
|
463
|
+
readOnly: readOnly,
|
|
501
464
|
ref: inputRef,
|
|
502
465
|
backgroundType: backgroundType,
|
|
503
466
|
pattern: pattern,
|
|
504
467
|
minLength: minLength,
|
|
505
468
|
maxLength: maxLength,
|
|
506
|
-
autoComplete: autocomplete,
|
|
469
|
+
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
507
470
|
tabIndex: tabIndex,
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
"aria-
|
|
511
|
-
"aria-
|
|
512
|
-
"aria-expanded":
|
|
513
|
-
"aria-
|
|
514
|
-
"aria-
|
|
471
|
+
type: "text",
|
|
472
|
+
role: hasSuggestions(suggestions) ? "combobox" : undefined,
|
|
473
|
+
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : undefined,
|
|
474
|
+
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : undefined,
|
|
475
|
+
"aria-expanded": hasSuggestions(suggestions) ? isOpen : undefined,
|
|
476
|
+
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : undefined,
|
|
477
|
+
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? "suggestion-".concat(visualFocusIndex) : undefined,
|
|
478
|
+
"aria-invalid": error ? true : false,
|
|
515
479
|
"aria-errormessage": error ? errorId : undefined,
|
|
516
|
-
"aria-required":
|
|
517
|
-
}), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
480
|
+
"aria-required": !disabled && !optional
|
|
481
|
+
})), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
518
482
|
backgroundType: backgroundType,
|
|
519
483
|
"aria-label": "Error"
|
|
520
|
-
},
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
},
|
|
484
|
+
}, _Icons["default"].error), !disabled && !readOnly && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
485
|
+
"aria-label": translatedLabels.textInput.clearFieldActionTitle,
|
|
486
|
+
onClick: handleClearActionOnClick,
|
|
524
487
|
onMouseDown: function onMouseDown(event) {
|
|
525
488
|
event.stopPropagation();
|
|
526
489
|
},
|
|
527
|
-
backgroundType: backgroundType,
|
|
528
490
|
tabIndex: tabIndex,
|
|
529
491
|
title: translatedLabels.textInput.clearFieldActionTitle,
|
|
530
|
-
"
|
|
531
|
-
|
|
532
|
-
|
|
492
|
+
type: "button",
|
|
493
|
+
backgroundType: backgroundType
|
|
494
|
+
}, _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, {
|
|
495
|
+
"aria-label": translatedLabels.numberInput.decrementValueTitle,
|
|
533
496
|
disabled: disabled,
|
|
534
|
-
onClick:
|
|
535
|
-
return handleDecrementActionOnClick();
|
|
536
|
-
},
|
|
497
|
+
onClick: !readOnly ? handleDecrementActionOnClick : undefined,
|
|
537
498
|
onMouseDown: function onMouseDown(event) {
|
|
538
499
|
event.stopPropagation();
|
|
539
500
|
},
|
|
540
|
-
|
|
501
|
+
ref: actionRef,
|
|
541
502
|
tabIndex: tabIndex,
|
|
542
503
|
title: translatedLabels.numberInput.decrementValueTitle,
|
|
543
|
-
"
|
|
544
|
-
|
|
545
|
-
|
|
504
|
+
type: "button",
|
|
505
|
+
backgroundType: backgroundType
|
|
506
|
+
}, _Icons["default"].decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
507
|
+
"aria-label": translatedLabels.numberInput.incrementValueTitle,
|
|
546
508
|
disabled: disabled,
|
|
547
|
-
onClick:
|
|
548
|
-
return handleIncrementActionOnClick();
|
|
549
|
-
},
|
|
509
|
+
onClick: !readOnly ? handleIncrementActionOnClick : undefined,
|
|
550
510
|
onMouseDown: function onMouseDown(event) {
|
|
551
511
|
event.stopPropagation();
|
|
552
512
|
},
|
|
553
|
-
|
|
513
|
+
ref: actionRef,
|
|
554
514
|
tabIndex: tabIndex,
|
|
555
515
|
title: translatedLabels.numberInput.incrementValueTitle,
|
|
556
|
-
"
|
|
557
|
-
|
|
558
|
-
|
|
516
|
+
type: "button",
|
|
517
|
+
backgroundType: backgroundType
|
|
518
|
+
}, _Icons["default"].increment)), action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
519
|
+
"aria-label": action.title,
|
|
559
520
|
disabled: disabled,
|
|
560
|
-
onClick:
|
|
561
|
-
return action.onClick();
|
|
562
|
-
},
|
|
521
|
+
onClick: !readOnly ? action.onClick : undefined,
|
|
563
522
|
onMouseDown: function onMouseDown(event) {
|
|
564
523
|
event.stopPropagation();
|
|
565
524
|
},
|
|
525
|
+
ref: actionRef,
|
|
526
|
+
tabIndex: tabIndex,
|
|
566
527
|
title: action.title,
|
|
567
|
-
"
|
|
568
|
-
backgroundType: backgroundType
|
|
569
|
-
|
|
570
|
-
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ActionIcon, {
|
|
528
|
+
type: "button",
|
|
529
|
+
backgroundType: backgroundType
|
|
530
|
+
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
571
531
|
src: action.icon
|
|
572
532
|
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
573
533
|
disabled: disabled,
|
|
574
534
|
backgroundType: backgroundType
|
|
575
|
-
}, suffix),
|
|
576
|
-
id: autosuggestId,
|
|
577
|
-
error: isAutosuggestError ? true : false,
|
|
578
|
-
onMouseDown: function onMouseDown(event) {
|
|
579
|
-
event.preventDefault();
|
|
580
|
-
},
|
|
581
|
-
ref: suggestionsRef,
|
|
582
|
-
role: "listbox",
|
|
583
|
-
"aria-label": label
|
|
584
|
-
}, !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
|
|
585
|
-
return /*#__PURE__*/_react["default"].createElement(_Suggestion["default"], {
|
|
586
|
-
key: "suggestion-".concat(index),
|
|
587
|
-
id: "suggestion-".concat(index),
|
|
588
|
-
value: value !== null && value !== void 0 ? value : innerValue,
|
|
589
|
-
onClick: function onClick() {
|
|
590
|
-
changeValue(suggestion);
|
|
591
|
-
closeSuggestions();
|
|
592
|
-
},
|
|
593
|
-
suggestion: suggestion,
|
|
594
|
-
isLast: index === lastOptionIndex,
|
|
595
|
-
visuallyFocused: visualFocusedSuggIndex === index,
|
|
596
|
-
highlighted: typeof suggestions === "function"
|
|
597
|
-
});
|
|
598
|
-
}), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, null, translatedLabels.textInput.searchingMessage), isAutosuggestError && /*#__PURE__*/_react["default"].createElement(SuggestionsError, null, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, {
|
|
599
|
-
backgroundType: backgroundType
|
|
600
|
-
}, textInputIcons.error), translatedLabels.textInput.fetchingDataErrorMessage))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
535
|
+
}, suffix)), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
601
536
|
id: errorId,
|
|
602
537
|
backgroundType: backgroundType,
|
|
603
538
|
"aria-live": error ? "assertive" : "off"
|
|
604
539
|
}, error)));
|
|
605
540
|
});
|
|
606
541
|
|
|
607
|
-
var
|
|
608
|
-
small: "240px",
|
|
609
|
-
medium: "360px",
|
|
610
|
-
large: "480px",
|
|
611
|
-
fillParent: "100%"
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
615
|
-
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
542
|
+
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) {
|
|
619
543
|
return calculateWidth(props.margin, props.size);
|
|
620
544
|
}, function (props) {
|
|
621
545
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -663,16 +587,14 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
663
587
|
return props.theme.helperTextLineHeight;
|
|
664
588
|
});
|
|
665
589
|
|
|
666
|
-
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
590
|
+
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) {
|
|
667
591
|
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
668
592
|
}, function (props) {
|
|
669
|
-
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
593
|
+
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else if (props.readOnly) return props.theme.readOnlyBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
670
594
|
}, function (props) {
|
|
671
595
|
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.errorBorderColorOnDark : props.theme.errorBorderColor, ";\n ");
|
|
672
596
|
}, function (props) {
|
|
673
|
-
return props.disabled
|
|
674
|
-
}, function (props) {
|
|
675
|
-
return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.hoverErrorBorderColorOnDark : props.theme.hoverErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n ");
|
|
597
|
+
return !props.disabled ? "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor, ";\n ").concat(props.error ? "box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.hoverErrorBorderColorOnDark : props.theme.hoverErrorBorderColor, ";") : "", "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n ") : "cursor: not-allowed;";
|
|
676
598
|
});
|
|
677
599
|
|
|
678
600
|
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) {
|
|
@@ -691,71 +613,39 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
|
|
|
691
613
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
692
614
|
});
|
|
693
615
|
|
|
694
|
-
var
|
|
695
|
-
|
|
696
|
-
var Action = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\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 svg {\n line-height: 18px;\n }\n"])), function (props) {
|
|
697
|
-
return props.theme.fontFamily;
|
|
698
|
-
}, function (props) {
|
|
616
|
+
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) {
|
|
699
617
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
700
618
|
}, function (props) {
|
|
701
619
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
|
|
702
620
|
}, function (props) {
|
|
703
621
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
704
622
|
}, function (props) {
|
|
705
|
-
return !props.disabled && "\n &:focus
|
|
623
|
+
return !props.disabled && "\n &:focus, \n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
|
|
706
624
|
});
|
|
707
625
|
|
|
708
|
-
var Prefix = _styledComponents["default"].span(
|
|
626
|
+
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) {
|
|
709
627
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
|
|
710
628
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
711
629
|
}, function (props) {
|
|
712
630
|
return props.theme.fontFamily;
|
|
713
631
|
});
|
|
714
632
|
|
|
715
|
-
var Suffix = _styledComponents["default"].span(
|
|
633
|
+
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) {
|
|
716
634
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
|
|
717
635
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
718
636
|
}, function (props) {
|
|
719
637
|
return props.theme.fontFamily;
|
|
720
638
|
});
|
|
721
639
|
|
|
722
|
-
var ErrorIcon = _styledComponents["default"].span(
|
|
640
|
+
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) {
|
|
723
641
|
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
724
642
|
});
|
|
725
643
|
|
|
726
|
-
var Error = _styledComponents["default"].span(
|
|
644
|
+
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) {
|
|
727
645
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
728
646
|
}, function (props) {
|
|
729
647
|
return props.theme.fontFamily;
|
|
730
648
|
});
|
|
731
649
|
|
|
732
|
-
var Suggestions = _styledComponents["default"].ul(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-y: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0.25rem 0;\n width: 100%;\n background-color: ", ";\n border: 1px solid\n ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
733
|
-
return props.error ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
|
|
734
|
-
}, function (props) {
|
|
735
|
-
return props.error ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
|
|
736
|
-
}, function (props) {
|
|
737
|
-
return props.theme.listOptionFontColor;
|
|
738
|
-
}, function (props) {
|
|
739
|
-
return props.theme.fontFamily;
|
|
740
|
-
}, function (props) {
|
|
741
|
-
return props.theme.listOptionFontSize;
|
|
742
|
-
}, function (props) {
|
|
743
|
-
return props.theme.listOptionFontStyle;
|
|
744
|
-
}, function (props) {
|
|
745
|
-
return props.theme.listOptionFontWeight;
|
|
746
|
-
});
|
|
747
|
-
|
|
748
|
-
var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n color: ", ";\n line-height: 1.715em;\n"])), function (props) {
|
|
749
|
-
return props.theme.systemMessageFontColor;
|
|
750
|
-
});
|
|
751
|
-
|
|
752
|
-
var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n margin-right: 0.5rem;\n height: 18px;\n width: 18px;\n color: ", ";\n"])), function (props) {
|
|
753
|
-
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
754
|
-
});
|
|
755
|
-
|
|
756
|
-
var SuggestionsError = _styledComponents["default"].span(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n align-items: center;\n line-height: 1.715em;\n color: ", ";\n"])), function (props) {
|
|
757
|
-
return props.theme.errorListDialogFontColor;
|
|
758
|
-
});
|
|
759
|
-
|
|
760
650
|
var _default = DxcTextInput;
|
|
761
651
|
exports["default"] = _default;
|