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