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