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