@dxc-technology/halstack-react 0.0.0-d238e47 → 0.0.0-d25aef4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6703 -0
  3. package/dist/index.d.ts +6703 -0
  4. package/dist/index.js +1 -0
  5. package/dist/index.mjs +1 -0
  6. package/package.json +70 -66
  7. package/BackgroundColorContext.js +0 -50
  8. package/ThemeContext.js +0 -246
  9. package/V3Select/V3Select.js +0 -455
  10. package/V3Select/index.d.ts +0 -27
  11. package/V3Textarea/V3Textarea.js +0 -260
  12. package/V3Textarea/index.d.ts +0 -27
  13. package/accordion/Accordion.d.ts +0 -4
  14. package/accordion/Accordion.js +0 -258
  15. package/accordion/types.d.ts +0 -68
  16. package/accordion/types.js +0 -5
  17. package/accordion-group/AccordionGroup.d.ts +0 -7
  18. package/accordion-group/AccordionGroup.js +0 -170
  19. package/accordion-group/types.d.ts +0 -72
  20. package/accordion-group/types.js +0 -5
  21. package/alert/Alert.d.ts +0 -4
  22. package/alert/Alert.js +0 -290
  23. package/alert/Alert.stories.tsx +0 -170
  24. package/alert/types.d.ts +0 -49
  25. package/alert/types.js +0 -5
  26. package/badge/Badge.js +0 -59
  27. package/box/Box.d.ts +0 -4
  28. package/box/Box.js +0 -126
  29. package/box/Box.stories.tsx +0 -132
  30. package/box/types.d.ts +0 -43
  31. package/box/types.js +0 -5
  32. package/button/Button.d.ts +0 -4
  33. package/button/Button.js +0 -179
  34. package/button/Button.stories.tsx +0 -276
  35. package/button/types.d.ts +0 -57
  36. package/button/types.js +0 -5
  37. package/card/Card.d.ts +0 -4
  38. package/card/Card.js +0 -164
  39. package/card/Card.stories.tsx +0 -201
  40. package/card/ice-cream.jpg +0 -0
  41. package/card/types.d.ts +0 -67
  42. package/card/types.js +0 -5
  43. package/checkbox/Checkbox.d.ts +0 -4
  44. package/checkbox/Checkbox.js +0 -253
  45. package/checkbox/Checkbox.stories.tsx +0 -192
  46. package/checkbox/types.d.ts +0 -60
  47. package/checkbox/types.js +0 -5
  48. package/chip/Chip.js +0 -221
  49. package/chip/Chip.stories.tsx +0 -121
  50. package/chip/index.d.ts +0 -22
  51. package/common/OpenSans.css +0 -81
  52. package/common/RequiredComponent.js +0 -32
  53. package/common/fonts/OpenSans-Bold.ttf +0 -0
  54. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  55. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  56. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  57. package/common/fonts/OpenSans-Italic.ttf +0 -0
  58. package/common/fonts/OpenSans-Light.ttf +0 -0
  59. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  60. package/common/fonts/OpenSans-Regular.ttf +0 -0
  61. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  62. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  63. package/common/utils.js +0 -22
  64. package/common/variables.js +0 -1577
  65. package/date/Date.js +0 -373
  66. package/date/index.d.ts +0 -27
  67. package/date-input/DateInput.d.ts +0 -4
  68. package/date-input/DateInput.js +0 -361
  69. package/date-input/DateInput.stories.tsx +0 -138
  70. package/date-input/types.d.ts +0 -100
  71. package/date-input/types.js +0 -5
  72. package/dialog/Dialog.d.ts +0 -4
  73. package/dialog/Dialog.js +0 -165
  74. package/dialog/Dialog.stories.tsx +0 -212
  75. package/dialog/types.d.ts +0 -43
  76. package/dialog/types.js +0 -5
  77. package/dropdown/Dropdown.d.ts +0 -4
  78. package/dropdown/Dropdown.js +0 -417
  79. package/dropdown/types.d.ts +0 -89
  80. package/dropdown/types.js +0 -5
  81. package/file-input/FileInput.d.ts +0 -4
  82. package/file-input/FileInput.js +0 -511
  83. package/file-input/FileItem.d.ts +0 -14
  84. package/file-input/FileItem.js +0 -182
  85. package/file-input/types.d.ts +0 -87
  86. package/file-input/types.js +0 -5
  87. package/footer/Footer.d.ts +0 -4
  88. package/footer/Footer.js +0 -266
  89. package/footer/Footer.stories.jsx +0 -151
  90. package/footer/Icons.js +0 -77
  91. package/footer/types.d.ts +0 -61
  92. package/footer/types.js +0 -5
  93. package/header/Header.d.ts +0 -7
  94. package/header/Header.js +0 -324
  95. package/header/Header.stories.tsx +0 -162
  96. package/header/Icons.js +0 -34
  97. package/header/types.d.ts +0 -47
  98. package/header/types.js +0 -5
  99. package/heading/Heading.d.ts +0 -4
  100. package/heading/Heading.js +0 -159
  101. package/heading/Heading.stories.tsx +0 -53
  102. package/heading/types.d.ts +0 -33
  103. package/heading/types.js +0 -5
  104. package/input-text/Icons.js +0 -22
  105. package/input-text/InputText.js +0 -611
  106. package/input-text/index.d.ts +0 -36
  107. package/layout/ApplicationLayout.js +0 -235
  108. package/layout/Icons.js +0 -55
  109. package/link/Link.d.ts +0 -3
  110. package/link/Link.js +0 -161
  111. package/link/Link.stories.tsx +0 -146
  112. package/link/types.d.ts +0 -74
  113. package/link/types.js +0 -5
  114. package/main.d.ts +0 -44
  115. package/main.js +0 -363
  116. package/number-input/NumberInput.d.ts +0 -4
  117. package/number-input/NumberInput.js +0 -86
  118. package/number-input/NumberInput.stories.tsx +0 -115
  119. package/number-input/NumberInputContext.d.ts +0 -4
  120. package/number-input/NumberInputContext.js +0 -19
  121. package/number-input/numberInputContextTypes.d.ts +0 -19
  122. package/number-input/numberInputContextTypes.js +0 -5
  123. package/number-input/types.d.ts +0 -117
  124. package/number-input/types.js +0 -5
  125. package/paginator/Icons.js +0 -66
  126. package/paginator/Paginator.d.ts +0 -4
  127. package/paginator/Paginator.js +0 -198
  128. package/paginator/Paginator.stories.tsx +0 -63
  129. package/paginator/types.d.ts +0 -38
  130. package/paginator/types.js +0 -5
  131. package/password-input/PasswordInput.d.ts +0 -4
  132. package/password-input/PasswordInput.js +0 -162
  133. package/password-input/PasswordInput.stories.tsx +0 -131
  134. package/password-input/types.d.ts +0 -105
  135. package/password-input/types.js +0 -5
  136. package/progress-bar/ProgressBar.d.ts +0 -4
  137. package/progress-bar/ProgressBar.js +0 -170
  138. package/progress-bar/ProgressBar.stories.jsx +0 -58
  139. package/progress-bar/types.d.ts +0 -37
  140. package/progress-bar/types.js +0 -5
  141. package/radio/Radio.d.ts +0 -4
  142. package/radio/Radio.js +0 -174
  143. package/radio/Radio.stories.tsx +0 -192
  144. package/radio/types.d.ts +0 -54
  145. package/radio/types.js +0 -5
  146. package/resultsetTable/ResultsetTable.d.ts +0 -4
  147. package/resultsetTable/ResultsetTable.js +0 -249
  148. package/resultsetTable/types.d.ts +0 -63
  149. package/resultsetTable/types.js +0 -5
  150. package/select/Select.js +0 -865
  151. package/select/Select.stories.tsx +0 -572
  152. package/select/index.d.ts +0 -131
  153. package/sidenav/Sidenav.d.ts +0 -9
  154. package/sidenav/Sidenav.js +0 -136
  155. package/sidenav/Sidenav.stories.tsx +0 -165
  156. package/sidenav/types.d.ts +0 -50
  157. package/sidenav/types.js +0 -5
  158. package/slider/Slider.d.ts +0 -4
  159. package/slider/Slider.js +0 -317
  160. package/slider/Slider.stories.tsx +0 -177
  161. package/slider/types.d.ts +0 -78
  162. package/slider/types.js +0 -5
  163. package/spinner/Spinner.d.ts +0 -4
  164. package/spinner/Spinner.js +0 -250
  165. package/spinner/Spinner.stories.jsx +0 -102
  166. package/spinner/types.d.ts +0 -32
  167. package/spinner/types.js +0 -5
  168. package/switch/Switch.d.ts +0 -4
  169. package/switch/Switch.js +0 -179
  170. package/switch/Switch.stories.tsx +0 -160
  171. package/switch/types.d.ts +0 -58
  172. package/switch/types.js +0 -5
  173. package/table/Table.d.ts +0 -4
  174. package/table/Table.js +0 -118
  175. package/table/Table.stories.jsx +0 -276
  176. package/table/types.d.ts +0 -21
  177. package/table/types.js +0 -5
  178. package/tabs/Tabs.d.ts +0 -4
  179. package/tabs/Tabs.js +0 -213
  180. package/tabs/types.d.ts +0 -70
  181. package/tabs/types.js +0 -5
  182. package/tag/Tag.d.ts +0 -4
  183. package/tag/Tag.js +0 -193
  184. package/tag/Tag.stories.tsx +0 -145
  185. package/tag/types.d.ts +0 -60
  186. package/tag/types.js +0 -5
  187. package/text-input/TextInput.d.ts +0 -4
  188. package/text-input/TextInput.js +0 -785
  189. package/text-input/types.d.ts +0 -157
  190. package/text-input/types.js +0 -5
  191. package/textarea/Textarea.js +0 -317
  192. package/textarea/Textarea.stories.jsx +0 -135
  193. package/textarea/index.d.ts +0 -117
  194. package/toggle/Toggle.js +0 -186
  195. package/toggle/index.d.ts +0 -21
  196. package/toggle-group/ToggleGroup.js +0 -243
  197. package/toggle-group/ToggleGroup.stories.tsx +0 -178
  198. package/toggle-group/index.d.ts +0 -21
  199. package/upload/Upload.js +0 -201
  200. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  201. package/upload/buttons-upload/Icons.js +0 -40
  202. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  203. package/upload/dragAndDropArea/Icons.js +0 -39
  204. package/upload/file-upload/FileToUpload.js +0 -115
  205. package/upload/file-upload/Icons.js +0 -66
  206. package/upload/files-upload/FilesToUpload.js +0 -109
  207. package/upload/index.d.ts +0 -15
  208. package/upload/transaction/Icons.js +0 -160
  209. package/upload/transaction/Transaction.js +0 -104
  210. package/upload/transactions/Transactions.js +0 -94
  211. package/useTheme.js +0 -22
  212. package/wizard/Icons.js +0 -65
  213. package/wizard/Wizard.d.ts +0 -4
  214. package/wizard/Wizard.js +0 -231
  215. package/wizard/Wizard.stories.jsx +0 -224
  216. package/wizard/types.d.ts +0 -64
  217. package/wizard/types.js +0 -5
@@ -1,785 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
- var _react = _interopRequireWildcard(require("react"));
19
-
20
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
23
-
24
- var _variables = require("../common/variables.js");
25
-
26
- var _utils = require("../common/utils.js");
27
-
28
- var _uuid = require("uuid");
29
-
30
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
31
-
32
- var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext"));
33
-
34
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
35
-
36
- 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
-
38
- 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
-
40
- var textInputIcons = {
41
- error: /*#__PURE__*/_react["default"].createElement("svg", {
42
- xmlns: "http://www.w3.org/2000/svg",
43
- height: "24px",
44
- viewBox: "0 0 24 24",
45
- width: "24px",
46
- fill: "currentColor"
47
- }, /*#__PURE__*/_react["default"].createElement("path", {
48
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
49
- })),
50
- clear: /*#__PURE__*/_react["default"].createElement("svg", {
51
- xmlns: "http://www.w3.org/2000/svg",
52
- width: "24",
53
- height: "24",
54
- viewBox: "0 0 24 24",
55
- fill: "currentColor"
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
- }))
86
- };
87
-
88
- var makeCancelable = function makeCancelable(promise) {
89
- var hasCanceled_ = false;
90
- var wrappedPromise = new Promise(function (resolve, reject) {
91
- promise.then(function (val) {
92
- return hasCanceled_ ? reject({
93
- isCanceled: true
94
- }) : resolve(val);
95
- }, function (promiseError) {
96
- return hasCanceled_ ? reject({
97
- isCanceled: true
98
- }) : reject(promiseError);
99
- });
100
- });
101
- return {
102
- promise: wrappedPromise,
103
- cancel: function cancel() {
104
- hasCanceled_ = true;
105
- }
106
- };
107
- };
108
-
109
- var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
110
- return "This field is required. Please, enter a value.";
111
- };
112
-
113
- var getLengthErrorMessage = function getLengthErrorMessage(length) {
114
- return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
115
- };
116
-
117
- var getPatternErrorMessage = function getPatternErrorMessage() {
118
- return "Please match the format requested.";
119
- };
120
-
121
- var patternMatch = function patternMatch(pattern, value) {
122
- return new RegExp(pattern).test(value);
123
- };
124
-
125
- var getLastOptionIndex = function getLastOptionIndex(filteredSuggestions) {
126
- var last = 0;
127
-
128
- var reducer = function reducer(acc, current) {
129
- var _current$options;
130
-
131
- return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
132
- };
133
-
134
- if (filteredSuggestions.length > 0) filteredSuggestions[0].options ? last = filteredSuggestions.reduce(reducer, 0) - 1 : last = filteredSuggestions.length - 1;
135
- return last;
136
- };
137
-
138
- var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
139
- var _action$title;
140
-
141
- var _ref$label = _ref.label,
142
- label = _ref$label === void 0 ? "" : _ref$label,
143
- _ref$name = _ref.name,
144
- name = _ref$name === void 0 ? "" : _ref$name,
145
- value = _ref.value,
146
- _ref$helperText = _ref.helperText,
147
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
148
- _ref$placeholder = _ref.placeholder,
149
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
150
- action = _ref.action,
151
- _ref$clearable = _ref.clearable,
152
- clearable = _ref$clearable === void 0 ? false : _ref$clearable,
153
- _ref$disabled = _ref.disabled,
154
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
155
- _ref$optional = _ref.optional,
156
- optional = _ref$optional === void 0 ? false : _ref$optional,
157
- _ref$prefix = _ref.prefix,
158
- prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
159
- _ref$suffix = _ref.suffix,
160
- suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
161
- onChange = _ref.onChange,
162
- onBlur = _ref.onBlur,
163
- _ref$error = _ref.error,
164
- error = _ref$error === void 0 ? "" : _ref$error,
165
- suggestions = _ref.suggestions,
166
- pattern = _ref.pattern,
167
- length = _ref.length,
168
- _ref$autocomplete = _ref.autocomplete,
169
- autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
170
- margin = _ref.margin,
171
- _ref$size = _ref.size,
172
- size = _ref$size === void 0 ? "medium" : _ref$size,
173
- _ref$tabIndex = _ref.tabIndex,
174
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
175
-
176
- var _useState = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
177
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
178
- inputId = _useState2[0];
179
-
180
- var _useState3 = (0, _react.useState)(""),
181
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
182
- innerValue = _useState4[0],
183
- setInnerValue = _useState4[1];
184
-
185
- var _useState5 = (0, _react.useState)(false),
186
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
187
- isOpen = _useState6[0],
188
- changeIsOpen = _useState6[1];
189
-
190
- var _useState7 = (0, _react.useState)(false),
191
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
192
- isSearching = _useState8[0],
193
- changeIsSearching = _useState8[1];
194
-
195
- var _useState9 = (0, _react.useState)(false),
196
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
197
- isAutosuggestError = _useState10[0],
198
- changeIsAutosuggestError = _useState10[1];
199
-
200
- var _useState11 = (0, _react.useState)([]),
201
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
202
- filteredSuggestions = _useState12[0],
203
- changeFilteredSuggestions = _useState12[1];
204
-
205
- var _useState13 = (0, _react.useState)(-1),
206
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
207
- visualFocusedSuggIndex = _useState14[0],
208
- changeVisualFocusedSuggIndex = _useState14[1];
209
-
210
- var suggestionsRef = (0, _react.useRef)(null);
211
- var inputRef = (0, _react.useRef)(null);
212
- var actionRef = (0, _react.useRef)(null);
213
- var colorsTheme = (0, _useTheme["default"])();
214
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
215
- var autosuggestId = "".concat(inputId, "-listBox");
216
- var errorId = "error-message-".concat(inputId);
217
- var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
218
- var lastOptionIndex = (0, _react.useMemo)(function () {
219
- return getLastOptionIndex(filteredSuggestions);
220
- }, [filteredSuggestions]);
221
-
222
- var isNotOptional = function isNotOptional(value) {
223
- return value === "" && !optional;
224
- };
225
-
226
- var isLengthIncorrect = function isLengthIncorrect(value) {
227
- return value && (length === null || length === void 0 ? void 0 : length.min) && (length === null || length === void 0 ? void 0 : length.max) && (value.length < length.min || value.length > length.max);
228
- };
229
-
230
- var isNumberIncorrect = function isNumberIncorrect(value) {
231
- 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);
232
- };
233
-
234
- var isTextInputType = function isTextInputType() {
235
- var _inputRef$current, _inputRef$current2;
236
-
237
- 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";
238
- };
239
-
240
- var getNumberErrorMessage = function getNumberErrorMessage(value) {
241
- if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return "Value must be greater than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, ".");else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return "Value must be less than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber, ".");
242
- };
243
-
244
- var hasSuggestions = function hasSuggestions() {
245
- return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
246
- };
247
-
248
- var openSuggestions = function openSuggestions() {
249
- hasSuggestions() && changeIsOpen(true);
250
- };
251
-
252
- var closeSuggestions = function closeSuggestions() {
253
- changeIsOpen(false);
254
- changeVisualFocusedSuggIndex(-1);
255
- };
256
-
257
- var changeValue = function changeValue(newValue) {
258
- value !== null && value !== void 0 ? value : setInnerValue(newValue);
259
- var changedValue = typeof newValue === "number" ? newValue.toString() : newValue;
260
- if (isNotOptional(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
261
- value: changedValue,
262
- error: getNotOptionalErrorMessage()
263
- });else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
264
- value: changedValue,
265
- error: getLengthErrorMessage(length)
266
- });else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
267
- value: changedValue,
268
- error: getPatternErrorMessage()
269
- });else if (newValue && isNumberIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
270
- value: changedValue,
271
- error: getNumberErrorMessage(newValue)
272
- });else onChange === null || onChange === void 0 ? void 0 : onChange({
273
- value: changedValue,
274
- error: null
275
- });
276
- };
277
-
278
- var handleInputContainerOnClick = function handleInputContainerOnClick() {
279
- document.activeElement !== actionRef.current && inputRef.current.focus();
280
- };
281
-
282
- var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
283
- // Avoid input to lose the focus when the container is pressed
284
- document.activeElement === inputRef.current && event.preventDefault();
285
- };
286
-
287
- var handleIOnChange = function handleIOnChange(event) {
288
- openSuggestions();
289
- changeValue(event.target.value);
290
- };
291
-
292
- var handleIOnBlur = function handleIOnBlur(event) {
293
- suggestions && closeSuggestions();
294
- if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
295
- value: event.target.value,
296
- error: getNotOptionalErrorMessage()
297
- });else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
298
- value: event.target.value,
299
- error: getLengthErrorMessage(length)
300
- });else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
301
- value: event.target.value,
302
- error: getPatternErrorMessage()
303
- });else if (event.target.value && isNumberIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
304
- value: event.target.value,
305
- error: getNumberErrorMessage(event.target.value)
306
- });else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
307
- value: event.target.value,
308
- error: null
309
- });
310
- };
311
-
312
- var handleIOnKeyDown = function handleIOnKeyDown(event) {
313
- switch (event.keyCode) {
314
- case 40:
315
- // Arrow Down
316
- if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
317
- decrementNumber();
318
- event.preventDefault();
319
- } else {
320
- event.preventDefault();
321
- openSuggestions();
322
-
323
- if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
324
- changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
325
- if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
326
- });
327
- }
328
- }
329
-
330
- break;
331
-
332
- case 38:
333
- // Arrow Up
334
- if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
335
- incrementNumber();
336
- event.preventDefault();
337
- } else {
338
- event.preventDefault();
339
- openSuggestions();
340
-
341
- if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
342
- changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
343
- if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
344
- });
345
- }
346
- }
347
-
348
- break;
349
-
350
- case 27:
351
- // Esc
352
- event.preventDefault();
353
-
354
- if (hasSuggestions()) {
355
- changeValue("");
356
- isOpen && closeSuggestions();
357
- }
358
-
359
- break;
360
-
361
- case 13:
362
- // Enter
363
- if (hasSuggestions() && !isSearching) {
364
- var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
365
- validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
366
- isOpen && closeSuggestions();
367
- }
368
-
369
- break;
370
- }
371
- };
372
-
373
- var handleClearActionOnClick = function handleClearActionOnClick() {
374
- changeValue("");
375
- inputRef.current.focus();
376
- suggestions && closeSuggestions();
377
- };
378
-
379
- var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
380
- decrementNumber();
381
- inputRef.current.focus();
382
- };
383
-
384
- var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
385
- incrementNumber();
386
- inputRef.current.focus();
387
- };
388
-
389
- var setNumberProps = function setNumberProps(type, min, max, step) {
390
- var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
391
-
392
- type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("type", type));
393
- min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("min", min));
394
- max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("max", max));
395
- step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
396
- };
397
-
398
- var decrementNumber = function decrementNumber() {
399
- var numberValue = value !== null && value !== void 0 ? value : innerValue;
400
-
401
- if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) {
402
- changeValue(parseInt(numberValue));
403
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
404
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
405
- } 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))) {
406
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
407
- } 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 !== "") {
408
- changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
409
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
410
- changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
411
- } else if (numberValue === "") {
412
- changeValue(-1);
413
- } else {
414
- changeValue(parseInt(numberValue) - 1);
415
- }
416
- };
417
-
418
- var incrementNumber = function incrementNumber() {
419
- var numberValue = value !== null && value !== void 0 ? value : innerValue;
420
-
421
- if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
422
- changeValue(parseInt(numberValue));
423
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "")) {
424
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
425
- } 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))) {
426
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
427
- } 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 !== "") {
428
- changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
429
- } else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
430
- changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
431
- } else if (numberValue === "") {
432
- changeValue(1);
433
- } else {
434
- changeValue(parseInt(numberValue) + 1);
435
- }
436
- };
437
-
438
- (0, _react.useLayoutEffect)(function () {
439
- var _suggestionsRef$curre, _visualFocusedOptionE;
440
-
441
- 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];
442
- visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
443
- block: "nearest",
444
- inline: "start"
445
- });
446
- }, [visualFocusedSuggIndex]);
447
- (0, _react.useEffect)(function () {
448
- if (typeof suggestions === "function") {
449
- changeIsSearching(true);
450
- changeIsAutosuggestError(false);
451
- changeFilteredSuggestions([]);
452
- var cancelablePromise = makeCancelable(suggestions(value !== null && value !== void 0 ? value : innerValue));
453
- cancelablePromise.promise.then(function (promiseResponse) {
454
- changeIsSearching(false);
455
- changeIsAutosuggestError(false);
456
- changeFilteredSuggestions(promiseResponse);
457
- })["catch"](function (err) {
458
- if (!err.isCanceled) {
459
- changeIsSearching(false);
460
- changeIsAutosuggestError(true);
461
- }
462
- });
463
- return function () {
464
- cancelablePromise.cancel();
465
- };
466
- } else if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0) {
467
- changeFilteredSuggestions(suggestions.filter(function (suggestion) {
468
- return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
469
- }));
470
- changeVisualFocusedSuggIndex(-1);
471
- }
472
-
473
- (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
474
- }, [value, innerValue, suggestions, numberInputContext]);
475
-
476
- var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
477
- var suggestion = _ref2.suggestion,
478
- index = _ref2.index;
479
- var regEx = new RegExp(value !== null && value !== void 0 ? value : innerValue, "i");
480
- var matchedWords = suggestion.match(regEx);
481
- var noMatchedWords = suggestion.replace(regEx, "");
482
- var isLastOption = index === lastOptionIndex;
483
- return /*#__PURE__*/_react["default"].createElement(Suggestion, {
484
- id: "suggestion-".concat(index),
485
- onClick: function onClick() {
486
- changeValue(suggestion);
487
- closeSuggestions();
488
- },
489
- visualFocused: visualFocusedSuggIndex === index,
490
- role: "option",
491
- "aria-selected": visualFocusedSuggIndex === index && "true"
492
- }, /*#__PURE__*/_react["default"].createElement(StyledSuggestion, {
493
- last: isLastOption,
494
- visualFocused: visualFocusedSuggIndex === index
495
- }, typeof suggestions === "function" ? suggestion : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedWords), noMatchedWords)));
496
- };
497
-
498
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
499
- theme: colorsTheme.textInput
500
- }, /*#__PURE__*/_react["default"].createElement(DxcInput, {
501
- margin: margin,
502
- ref: ref,
503
- size: size
504
- }, /*#__PURE__*/_react["default"].createElement(Label, {
505
- htmlFor: inputId,
506
- disabled: disabled,
507
- backgroundType: backgroundType
508
- }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), /*#__PURE__*/_react["default"].createElement(HelperText, {
509
- disabled: disabled,
510
- backgroundType: backgroundType
511
- }, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
512
- error: error,
513
- disabled: disabled,
514
- backgroundType: backgroundType,
515
- onClick: handleInputContainerOnClick,
516
- onMouseDown: handleInputContainerOnMouseDown
517
- }, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
518
- disabled: disabled,
519
- backgroundType: backgroundType
520
- }, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
521
- id: inputId,
522
- name: name,
523
- value: value !== null && value !== void 0 ? value : innerValue,
524
- placeholder: placeholder,
525
- onBlur: handleIOnBlur,
526
- onChange: handleIOnChange,
527
- onFocus: function onFocus() {
528
- openSuggestions();
529
- },
530
- onKeyDown: handleIOnKeyDown,
531
- onMouseDown: function onMouseDown(event) {
532
- event.stopPropagation();
533
- },
534
- disabled: disabled,
535
- ref: inputRef,
536
- backgroundType: backgroundType,
537
- pattern: pattern,
538
- minLength: length === null || length === void 0 ? void 0 : length.min,
539
- maxLength: length === null || length === void 0 ? void 0 : length.max,
540
- autoComplete: autocomplete,
541
- tabIndex: tabIndex,
542
- role: isTextInputType() && hasSuggestions() ? "combobox" : "textbox",
543
- "aria-autocomplete": isTextInputType() && hasSuggestions() ? "list" : undefined,
544
- "aria-controls": isTextInputType() && hasSuggestions() ? autosuggestId : undefined,
545
- "aria-expanded": isTextInputType() && hasSuggestions() ? isOpen ? "true" : "false" : undefined,
546
- "aria-activedescendant": isTextInputType() && hasSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
547
- "aria-invalid": error ? "true" : "false",
548
- "aria-describedby": error ? errorId : undefined,
549
- "aria-required": optional ? "false" : "true"
550
- }), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
551
- backgroundType: backgroundType,
552
- "aria-label": "Error"
553
- }, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
554
- onClick: handleClearActionOnClick,
555
- onMouseDown: function onMouseDown(event) {
556
- event.stopPropagation();
557
- },
558
- backgroundType: backgroundType,
559
- tabIndex: tabIndex,
560
- "aria-label": "Clear"
561
- }, textInputIcons.clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Action, {
562
- ref: actionRef,
563
- disabled: disabled,
564
- onClick: handleDecrementActionOnClick,
565
- onMouseDown: function onMouseDown(event) {
566
- event.stopPropagation();
567
- },
568
- backgroundType: backgroundType,
569
- tabIndex: tabIndex,
570
- "aria-label": "Decrement"
571
- }, textInputIcons.decrement), /*#__PURE__*/_react["default"].createElement(Action, {
572
- ref: actionRef,
573
- disabled: disabled,
574
- onClick: handleIncrementActionOnClick,
575
- onMouseDown: function onMouseDown(event) {
576
- event.stopPropagation();
577
- },
578
- backgroundType: backgroundType,
579
- tabIndex: tabIndex,
580
- "aria-label": "Increment"
581
- }, textInputIcons.increment)) : action && /*#__PURE__*/_react["default"].createElement(Action, {
582
- ref: actionRef,
583
- disabled: disabled,
584
- onClick: action.onClick,
585
- onMouseDown: function onMouseDown(event) {
586
- event.stopPropagation();
587
- },
588
- title: (_action$title = action.title) !== null && _action$title !== void 0 ? _action$title : action.title,
589
- backgroundType: backgroundType,
590
- tabIndex: tabIndex
591
- }, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ActionIcon, {
592
- src: action.icon
593
- }) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
594
- disabled: disabled,
595
- backgroundType: backgroundType
596
- }, suffix), isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError) && /*#__PURE__*/_react["default"].createElement(Suggestions, {
597
- id: autosuggestId,
598
- isError: isAutosuggestError,
599
- onMouseDown: function onMouseDown(event) {
600
- event.preventDefault();
601
- },
602
- ref: suggestionsRef,
603
- role: "listbox",
604
- "aria-label": label
605
- }, !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
606
- return /*#__PURE__*/_react["default"].createElement(HighlightedSuggestion, {
607
- key: "suggestion-".concat((0, _uuid.v4)()),
608
- suggestion: suggestion,
609
- index: index
610
- });
611
- }), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && /*#__PURE__*/_react["default"].createElement(SuggestionsError, null, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, {
612
- backgroundType: backgroundType
613
- }, textInputIcons.error), "Error fetching data"))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, {
614
- id: errorId,
615
- backgroundType: backgroundType
616
- }, error)));
617
- });
618
-
619
- var sizes = {
620
- small: "240px",
621
- medium: "360px",
622
- large: "480px",
623
- fillParent: "100%"
624
- };
625
-
626
- var calculateWidth = function calculateWidth(margin, size) {
627
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
628
- };
629
-
630
- 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) {
631
- return calculateWidth(props.margin, props.size);
632
- }, function (props) {
633
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
634
- }, function (props) {
635
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
636
- }, function (props) {
637
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
638
- }, function (props) {
639
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
640
- }, function (props) {
641
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
642
- });
643
-
644
- var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
645
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
646
- }, function (props) {
647
- return props.theme.fontFamily;
648
- }, function (props) {
649
- return props.theme.labelFontSize;
650
- }, function (props) {
651
- return props.theme.labelFontStyle;
652
- }, function (props) {
653
- return props.theme.labelFontWeight;
654
- }, function (props) {
655
- return props.theme.labelLineHeight;
656
- });
657
-
658
- var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
659
- return props.theme.optionalLabelFontWeight;
660
- });
661
-
662
- var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
663
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
664
- }, function (props) {
665
- return props.theme.fontFamily;
666
- }, function (props) {
667
- return props.theme.helperTextFontSize;
668
- }, function (props) {
669
- return props.theme.helperTextFontStyle;
670
- }, function (props) {
671
- return props.theme.helperTextFontWeight;
672
- }, function (props) {
673
- return props.theme.helperTextLineHeight;
674
- });
675
-
676
- var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n margin: ", ";\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 ", ";\n"])), function (props) {
677
- return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
678
- }, function (props) {
679
- if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
680
- }, function (props) {
681
- if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
682
- }, function (props) {
683
- 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 ");
684
- }, function (props) {
685
- return props.disabled && "cursor: not-allowed;";
686
- }, function (props) {
687
- 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 ");
688
- });
689
-
690
- 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\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
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
692
- }, function (props) {
693
- return props.theme.fontFamily;
694
- }, function (props) {
695
- return props.theme.valueFontSize;
696
- }, function (props) {
697
- return props.theme.valueFontStyle;
698
- }, function (props) {
699
- return props.theme.valueFontWeight;
700
- }, function (props) {
701
- return props.disabled && "cursor: not-allowed;";
702
- }, function (props) {
703
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
704
- });
705
-
706
- var ActionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
707
-
708
- 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) {
709
- return props.theme.fontFamily;
710
- }, function (props) {
711
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
712
- }, function (props) {
713
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
714
- }, function (props) {
715
- return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
716
- }, function (props) {
717
- 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 ");
718
- });
719
-
720
- var Prefix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (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) {
721
- var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
722
- return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
723
- }, function (props) {
724
- return props.theme.fontFamily;
725
- });
726
-
727
- var Suffix = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (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) {
728
- var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
729
- return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
730
- }, function (props) {
731
- return props.theme.fontFamily;
732
- });
733
-
734
- var ErrorIcon = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (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) {
735
- return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
736
- });
737
-
738
- var Error = _styledComponents["default"].span(_templateObject12 || (_templateObject12 = (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"])), function (props) {
739
- return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
740
- }, function (props) {
741
- return props.theme.fontFamily;
742
- });
743
-
744
- 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) {
745
- return props.isError ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
746
- }, function (props) {
747
- return props.isError ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
748
- }, function (props) {
749
- return props.theme.listOptionFontColor;
750
- }, function (props) {
751
- return props.theme.fontFamily;
752
- }, function (props) {
753
- return props.theme.listOptionFontSize;
754
- }, function (props) {
755
- return props.theme.listOptionFontStyle;
756
- }, function (props) {
757
- return props.theme.listOptionFontWeight;
758
- });
759
-
760
- var Suggestion = _styledComponents["default"].li(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\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) {
761
- return props.visualFocused ? props.theme.focusListOptionBorderColor : "transparent";
762
- }, function (props) {
763
- return props.theme.hoverListOptionBackgroundColor;
764
- }, function (props) {
765
- return props.theme.activeListOptionBackgroundColor;
766
- });
767
-
768
- var StyledSuggestion = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\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) {
769
- return props.last || props.visualFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
770
- });
771
-
772
- 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) {
773
- return props.theme.systemMessageFontColor;
774
- });
775
-
776
- 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) {
777
- return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
778
- });
779
-
780
- 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) {
781
- return props.theme.errorListDialogFontColor;
782
- });
783
-
784
- var _default = DxcTextInput;
785
- exports["default"] = _default;