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