@dxc-technology/halstack-react 0.0.0-2b0d695 → 0.0.0-2be11f4
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 +48 -0
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +243 -0
- package/{dist/select/Select.js → V3Select/V3Select.js} +40 -134
- package/V3Select/index.d.ts +27 -0
- package/{dist/V3Textarea → V3Textarea}/V3Textarea.js +12 -16
- package/V3Textarea/index.d.ts +27 -0
- package/accordion/Accordion.d.ts +4 -0
- package/{dist/accordion → accordion}/Accordion.js +37 -132
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +170 -0
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/{dist/alert → alert}/Alert.js +40 -153
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.js +59 -0
- package/box/Box.d.ts +4 -0
- package/{dist/box → box}/Box.js +15 -45
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/{dist/button → button}/Button.js +24 -83
- package/button/Button.stories.tsx +276 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/{dist/card → card}/Card.js +34 -124
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/{dist/checkbox → checkbox}/Checkbox.js +18 -65
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +60 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/{dist/chip → chip}/Chip.js +18 -84
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/{dist/common → common}/OpenSans.css +0 -0
- package/{dist/common → common}/RequiredComponent.js +3 -11
- package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/{dist/common → common}/utils.js +0 -0
- package/{dist/common → common}/variables.js +159 -152
- package/{dist/date → date}/Date.js +22 -28
- package/date/index.d.ts +27 -0
- package/date-input/DateInput.d.ts +4 -0
- package/{dist/date-input → date-input}/DateInput.js +23 -62
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/types.d.ts +100 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/{dist/dialog → dialog}/Dialog.js +22 -75
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/{dist/dropdown → dropdown}/Dropdown.js +45 -172
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/{dist/file-input → file-input}/FileInput.js +70 -203
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +184 -0
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/{dist/footer → footer}/Footer.js +40 -195
- package/footer/Footer.stories.jsx +151 -0
- package/{dist/footer → footer}/Icons.js +13 -13
- package/footer/types.d.ts +69 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/{dist/header → header}/Header.js +58 -204
- package/header/Header.stories.tsx +162 -0
- package/{dist/header → header}/Icons.js +7 -32
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +25 -96
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/{dist/input-text → input-text}/Icons.js +2 -2
- package/{dist/input-text → input-text}/InputText.js +38 -132
- package/input-text/index.d.ts +36 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/{dist/layout → layout}/ApplicationLayout.js +39 -141
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/{dist/layout → layout}/Icons.js +7 -7
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/{dist/link → link}/Link.js +19 -95
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/list/List.d.ts +7 -0
- package/list/List.js +37 -0
- package/list/List.stories.tsx +70 -0
- package/main.d.ts +48 -0
- package/{dist/main.js → main.js} +116 -88
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +86 -0
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +32 -25
- package/{dist/paginator → paginator}/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +198 -0
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/{dist/password-input → password-input}/PasswordInput.js +31 -65
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/{dist/progress-bar → progress-bar}/ProgressBar.js +22 -94
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/{dist/radio → radio}/Radio.js +17 -52
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +39 -146
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +11 -0
- package/row/Row.js +124 -0
- package/row/Row.stories.tsx +223 -0
- package/select/Select.js +865 -0
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +131 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/{dist/sidenav → sidenav}/Sidenav.js +21 -64
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/{dist/slider → slider}/Slider.js +74 -161
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +250 -0
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/stack/Stack.d.ts +10 -0
- package/stack/Stack.js +94 -0
- package/stack/Stack.stories.tsx +150 -0
- package/switch/Switch.d.ts +4 -0
- package/{dist/switch → switch}/Switch.js +28 -71
- package/switch/Switch.stories.tsx +160 -0
- package/switch/types.d.ts +58 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/{dist/table → table}/Table.js +12 -26
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +213 -0
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +193 -0
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/{dist/text-input → text-input}/TextInput.js +265 -448
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/{dist/textarea → textarea}/Textarea.js +35 -88
- package/textarea/Textarea.stories.jsx +135 -0
- package/{dist/textarea → textarea}/index.d.ts +18 -8
- package/{dist/toggle → toggle}/Toggle.js +16 -50
- package/toggle/index.d.ts +21 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/{dist/toggle-group → toggle-group}/ToggleGroup.js +29 -139
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/{dist/upload → upload}/Upload.js +14 -18
- package/upload/buttons-upload/ButtonsUpload.js +111 -0
- package/{dist/upload → upload}/buttons-upload/Icons.js +7 -7
- package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
- package/{dist/upload → upload}/dragAndDropArea/Icons.js +6 -6
- package/upload/file-upload/FileToUpload.js +115 -0
- package/{dist/upload → upload}/file-upload/Icons.js +13 -13
- package/{dist/upload → upload}/files-upload/FilesToUpload.js +13 -27
- package/upload/index.d.ts +15 -0
- package/{dist/upload → upload}/transaction/Icons.js +31 -31
- package/upload/transaction/Transaction.js +104 -0
- package/upload/transactions/Transactions.js +94 -0
- package/useTheme.d.ts +2 -0
- package/{dist/useTheme.js → useTheme.js} +1 -1
- package/{dist/wizard → wizard}/Icons.js +8 -8
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +231 -0
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/README.md +0 -66
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -250
- package/dist/accordion-group/AccordionGroup.js +0 -186
- package/dist/alert/index.d.ts +0 -51
- package/dist/badge/Badge.js +0 -63
- package/dist/date-input/index.d.ts +0 -95
- package/dist/file-input/FileItem.js +0 -280
- package/dist/file-input/index.d.ts +0 -81
- package/dist/main.d.ts +0 -8
- package/dist/new-select/NewSelect.js +0 -836
- package/dist/new-select/index.d.ts +0 -53
- package/dist/number-input/NumberInput.js +0 -136
- package/dist/number-input/index.d.ts +0 -113
- package/dist/paginator/Paginator.js +0 -283
- package/dist/password-input/index.d.ts +0 -94
- package/dist/spinner/Spinner.js +0 -381
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tag/Tag.js +0 -282
- package/dist/text-input/index.d.ts +0 -135
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/dist/upload/file-upload/FileToUpload.js +0 -189
- package/dist/upload/transaction/Transaction.js +0 -148
- package/dist/upload/transactions/Transactions.js +0 -138
- package/dist/wizard/Wizard.js +0 -405
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -397
- package/test/DateInput.test.js +0 -242
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -145
- package/test/FileInput.test.js +0 -201
- package/test/Footer.test.js +0 -94
- package/test/Header.test.js +0 -34
- package/test/Heading.test.js +0 -83
- package/test/InputText.test.js +0 -248
- package/test/Link.test.js +0 -43
- package/test/NumberInput.test.js +0 -259
- package/test/Paginator.test.js +0 -177
- package/test/PasswordInput.test.js +0 -83
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -329
- package/test/Select.test.js +0 -212
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -74
- package/test/Spinner.test.js +0 -32
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextInput.test.js +0 -732
- package/test/Textarea.test.js +0 -193
- package/test/ToggleGroup.test.js +0 -85
- package/test/Upload.test.js +0 -60
- package/test/V3TextArea.test.js +0 -51
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -21,9 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
21
19
|
|
|
22
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
21
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
25
|
-
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
23
|
|
|
28
24
|
var _variables = require("../common/variables.js");
|
|
29
25
|
|
|
@@ -31,179 +27,63 @@ var _utils = require("../common/utils.js");
|
|
|
31
27
|
|
|
32
28
|
var _uuid = require("uuid");
|
|
33
29
|
|
|
34
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
35
|
-
|
|
36
|
-
var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext.js"));
|
|
37
|
-
|
|
38
|
-
function _templateObject17() {
|
|
39
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n align-items: center;\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
|
|
40
|
-
|
|
41
|
-
_templateObject17 = function _templateObject17() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _templateObject16() {
|
|
49
|
-
var data = (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\n svg {\n line-height: 1.75em;\n font-size: 0.875rem;\n }\n"]);
|
|
50
|
-
|
|
51
|
-
_templateObject16 = function _templateObject16() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _templateObject15() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
|
|
60
|
-
|
|
61
|
-
_templateObject15 = function _templateObject15() {
|
|
62
|
-
return data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _templateObject14() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n line-height: 1.75em;\n list-style-type: none;\n cursor: pointer;\n\n ", "\n"]);
|
|
70
|
-
|
|
71
|
-
_templateObject14 = function _templateObject14() {
|
|
72
|
-
return data;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _templateObject13() {
|
|
79
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n position: absolute;\n z-index: 1;\n max-height: 160px;\n overflow: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0;\n width: 100%;\n box-sizing: border-box;\n cursor: default;\n border-radius: 4px;\n border: 1px solid ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
|
|
80
|
-
|
|
81
|
-
_templateObject13 = function _templateObject13() {
|
|
82
|
-
return data;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _templateObject12() {
|
|
89
|
-
var data = (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"]);
|
|
90
|
-
|
|
91
|
-
_templateObject12 = function _templateObject12() {
|
|
92
|
-
return data;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return data;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _templateObject11() {
|
|
99
|
-
var data = (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: calc(1rem * 0.25);\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
|
|
100
|
-
|
|
101
|
-
_templateObject11 = function _templateObject11() {
|
|
102
|
-
return data;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
return data;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function _templateObject10() {
|
|
109
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(1rem * 1.5);\n line-height: calc(1rem * 1.5);\n margin: 0 calc(1rem * 0.25);\n padding: 0 0 0 calc(1rem * 0.5);\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
|
|
110
|
-
|
|
111
|
-
_templateObject10 = function _templateObject10() {
|
|
112
|
-
return data;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
return data;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _templateObject9() {
|
|
119
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(1rem * 1.5);\n line-height: calc(1rem * 1.5);\n margin-left: calc(1rem * 0.25);\n padding: 0 calc(1rem * 0.5) 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
|
|
120
|
-
|
|
121
|
-
_templateObject9 = function _templateObject9() {
|
|
122
|
-
return data;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return data;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function _templateObject8() {
|
|
129
|
-
var data = (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: 4px;\n padding: 3px;\n margin-left: calc(1rem * 0.25);\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"]);
|
|
130
|
-
|
|
131
|
-
_templateObject8 = function _templateObject8() {
|
|
132
|
-
return data;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
return data;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function _templateObject7() {
|
|
139
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"]);
|
|
140
|
-
|
|
141
|
-
_templateObject7 = function _templateObject7() {
|
|
142
|
-
return data;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
return data;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function _templateObject6() {
|
|
149
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 calc(1rem * 0.5);\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"]);
|
|
150
|
-
|
|
151
|
-
_templateObject6 = function _templateObject6() {
|
|
152
|
-
return data;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return data;
|
|
156
|
-
}
|
|
30
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
157
31
|
|
|
158
|
-
|
|
159
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n margin: calc(1rem * 0.25) 0;\n padding: 0 calc(1rem * 0.5);\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
|
|
32
|
+
var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext"));
|
|
160
33
|
|
|
161
|
-
|
|
162
|
-
return data;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return data;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function _templateObject4() {
|
|
169
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
170
|
-
|
|
171
|
-
_templateObject4 = function _templateObject4() {
|
|
172
|
-
return data;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
return data;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function _templateObject3() {
|
|
179
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
|
|
180
35
|
|
|
181
|
-
|
|
182
|
-
return data;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
return data;
|
|
186
|
-
}
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
187
37
|
|
|
188
|
-
function
|
|
189
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
190
|
-
|
|
191
|
-
_templateObject2 = function _templateObject2() {
|
|
192
|
-
return data;
|
|
193
|
-
};
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
194
39
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
40
|
+
var textInputIcons = {
|
|
41
|
+
error: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
height: "24px",
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
width: "24px",
|
|
46
|
+
fill: "currentColor"
|
|
47
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
48
|
+
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
49
|
+
})),
|
|
50
|
+
clear: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
width: "24",
|
|
53
|
+
height: "24",
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
fill: "currentColor"
|
|
56
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
57
|
+
d: "M0 0h24v24H0V0z",
|
|
58
|
+
fill: "none"
|
|
59
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
60
|
+
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
61
|
+
})),
|
|
62
|
+
increment: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
height: "24px",
|
|
65
|
+
viewBox: "0 0 24 24",
|
|
66
|
+
width: "24px",
|
|
67
|
+
fill: "currentColor"
|
|
68
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
69
|
+
d: "M0 0h24v24H0z",
|
|
70
|
+
fill: "none"
|
|
71
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
72
|
+
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
|
73
|
+
})),
|
|
74
|
+
decrement: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
height: "24px",
|
|
77
|
+
viewBox: "0 0 24 24",
|
|
78
|
+
width: "24px",
|
|
79
|
+
fill: "currentColor"
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
81
|
+
d: "M0 0h24v24H0z",
|
|
82
|
+
fill: "none"
|
|
83
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
84
|
+
d: "M19 13H5v-2h14v2z"
|
|
85
|
+
}))
|
|
86
|
+
};
|
|
207
87
|
|
|
208
88
|
var makeCancelable = function makeCancelable(promise) {
|
|
209
89
|
var hasCanceled_ = false;
|
|
@@ -230,10 +110,6 @@ var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
|
|
|
230
110
|
return "This field is required. Please, enter a value.";
|
|
231
111
|
};
|
|
232
112
|
|
|
233
|
-
var getLengthErrorMessage = function getLengthErrorMessage(length) {
|
|
234
|
-
return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
|
|
235
|
-
};
|
|
236
|
-
|
|
237
113
|
var getPatternErrorMessage = function getPatternErrorMessage() {
|
|
238
114
|
return "Please match the format requested.";
|
|
239
115
|
};
|
|
@@ -242,7 +118,20 @@ var patternMatch = function patternMatch(pattern, value) {
|
|
|
242
118
|
return new RegExp(pattern).test(value);
|
|
243
119
|
};
|
|
244
120
|
|
|
245
|
-
var
|
|
121
|
+
var getLastOptionIndex = function getLastOptionIndex(filteredSuggestions) {
|
|
122
|
+
var last = 0;
|
|
123
|
+
|
|
124
|
+
var reducer = function reducer(acc, current) {
|
|
125
|
+
var _current$options;
|
|
126
|
+
|
|
127
|
+
return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
if (filteredSuggestions.length > 0) filteredSuggestions[0].options ? last = filteredSuggestions.reduce(reducer, 0) - 1 : last = filteredSuggestions.length - 1;
|
|
131
|
+
return last;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
246
135
|
var _ref$label = _ref.label,
|
|
247
136
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
248
137
|
_ref$name = _ref.name,
|
|
@@ -269,7 +158,8 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
269
158
|
error = _ref$error === void 0 ? "" : _ref$error,
|
|
270
159
|
suggestions = _ref.suggestions,
|
|
271
160
|
pattern = _ref.pattern,
|
|
272
|
-
|
|
161
|
+
minLength = _ref.minLength,
|
|
162
|
+
maxLength = _ref.maxLength,
|
|
273
163
|
_ref$autocomplete = _ref.autocomplete,
|
|
274
164
|
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
275
165
|
margin = _ref.margin,
|
|
@@ -278,49 +168,39 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
278
168
|
_ref$tabIndex = _ref.tabIndex,
|
|
279
169
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
280
170
|
|
|
281
|
-
var _useState = (0, _react.useState)(""),
|
|
282
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState,
|
|
283
|
-
|
|
284
|
-
setInnerValue = _useState2[1];
|
|
171
|
+
var _useState = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
172
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
173
|
+
inputId = _useState2[0];
|
|
285
174
|
|
|
286
|
-
var _useState3 = (0, _react.useState)(
|
|
175
|
+
var _useState3 = (0, _react.useState)(""),
|
|
287
176
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
288
|
-
|
|
289
|
-
|
|
177
|
+
innerValue = _useState4[0],
|
|
178
|
+
setInnerValue = _useState4[1];
|
|
290
179
|
|
|
291
180
|
var _useState5 = (0, _react.useState)(false),
|
|
292
181
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
293
|
-
|
|
294
|
-
|
|
182
|
+
isOpen = _useState6[0],
|
|
183
|
+
changeIsOpen = _useState6[1];
|
|
295
184
|
|
|
296
185
|
var _useState7 = (0, _react.useState)(false),
|
|
297
186
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
298
|
-
|
|
299
|
-
|
|
187
|
+
isSearching = _useState8[0],
|
|
188
|
+
changeIsSearching = _useState8[1];
|
|
300
189
|
|
|
301
190
|
var _useState9 = (0, _react.useState)(false),
|
|
302
191
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
303
|
-
|
|
304
|
-
|
|
192
|
+
isAutosuggestError = _useState10[0],
|
|
193
|
+
changeIsAutosuggestError = _useState10[1];
|
|
305
194
|
|
|
306
|
-
var _useState11 = (0, _react.useState)(
|
|
195
|
+
var _useState11 = (0, _react.useState)([]),
|
|
307
196
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
308
|
-
|
|
309
|
-
|
|
197
|
+
filteredSuggestions = _useState12[0],
|
|
198
|
+
changeFilteredSuggestions = _useState12[1];
|
|
310
199
|
|
|
311
|
-
var _useState13 = (0, _react.useState)(
|
|
200
|
+
var _useState13 = (0, _react.useState)(-1),
|
|
312
201
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
var _useState15 = (0, _react.useState)(-1),
|
|
317
|
-
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
318
|
-
visualFocusedSuggIndex = _useState16[0],
|
|
319
|
-
changeVisualFocusedSuggIndex = _useState16[1];
|
|
320
|
-
|
|
321
|
-
var _useState17 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
322
|
-
_useState18 = (0, _slicedToArray2["default"])(_useState17, 1),
|
|
323
|
-
inputId = _useState18[0];
|
|
202
|
+
visualFocusedSuggIndex = _useState14[0],
|
|
203
|
+
changeVisualFocusedSuggIndex = _useState14[1];
|
|
324
204
|
|
|
325
205
|
var suggestionsRef = (0, _react.useRef)(null);
|
|
326
206
|
var inputRef = (0, _react.useRef)(null);
|
|
@@ -330,13 +210,20 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
330
210
|
var autosuggestId = "".concat(inputId, "-listBox");
|
|
331
211
|
var errorId = "error-message-".concat(inputId);
|
|
332
212
|
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
213
|
+
var lastOptionIndex = (0, _react.useMemo)(function () {
|
|
214
|
+
return getLastOptionIndex(filteredSuggestions);
|
|
215
|
+
}, [filteredSuggestions]);
|
|
333
216
|
|
|
334
217
|
var isNotOptional = function isNotOptional(value) {
|
|
335
218
|
return value === "" && !optional;
|
|
336
219
|
};
|
|
337
220
|
|
|
338
221
|
var isLengthIncorrect = function isLengthIncorrect(value) {
|
|
339
|
-
return value
|
|
222
|
+
return value && minLength && maxLength && (value.length < minLength || value.length > maxLength);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
var getLengthErrorMessage = function getLengthErrorMessage() {
|
|
226
|
+
return "Min length ".concat(minLength, ", max length ").concat(maxLength, ".");
|
|
340
227
|
};
|
|
341
228
|
|
|
342
229
|
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
@@ -353,12 +240,12 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
353
240
|
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return "Value must be greater than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, ".");else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return "Value must be less than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber, ".");
|
|
354
241
|
};
|
|
355
242
|
|
|
356
|
-
var
|
|
357
|
-
return typeof suggestions === "function" || suggestions
|
|
243
|
+
var hasSuggestions = function hasSuggestions() {
|
|
244
|
+
return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
|
|
358
245
|
};
|
|
359
246
|
|
|
360
247
|
var openSuggestions = function openSuggestions() {
|
|
361
|
-
|
|
248
|
+
hasSuggestions() && changeIsOpen(true);
|
|
362
249
|
};
|
|
363
250
|
|
|
364
251
|
var closeSuggestions = function closeSuggestions() {
|
|
@@ -374,7 +261,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
374
261
|
error: getNotOptionalErrorMessage()
|
|
375
262
|
});else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
376
263
|
value: changedValue,
|
|
377
|
-
error: getLengthErrorMessage(
|
|
264
|
+
error: getLengthErrorMessage()
|
|
378
265
|
});else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
379
266
|
value: changedValue,
|
|
380
267
|
error: getPatternErrorMessage()
|
|
@@ -391,13 +278,14 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
391
278
|
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
392
279
|
};
|
|
393
280
|
|
|
394
|
-
var
|
|
395
|
-
|
|
396
|
-
|
|
281
|
+
var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
|
|
282
|
+
// Avoid input to lose the focus when the container is pressed
|
|
283
|
+
document.activeElement === inputRef.current && event.preventDefault();
|
|
397
284
|
};
|
|
398
285
|
|
|
399
|
-
var
|
|
286
|
+
var handleIOnChange = function handleIOnChange(event) {
|
|
400
287
|
openSuggestions();
|
|
288
|
+
changeValue(event.target.value);
|
|
401
289
|
};
|
|
402
290
|
|
|
403
291
|
var handleIOnBlur = function handleIOnBlur(event) {
|
|
@@ -407,7 +295,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
407
295
|
error: getNotOptionalErrorMessage()
|
|
408
296
|
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
409
297
|
value: event.target.value,
|
|
410
|
-
error: getLengthErrorMessage(
|
|
298
|
+
error: getLengthErrorMessage()
|
|
411
299
|
});else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
412
300
|
value: event.target.value,
|
|
413
301
|
error: getPatternErrorMessage()
|
|
@@ -420,15 +308,11 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
420
308
|
});
|
|
421
309
|
};
|
|
422
310
|
|
|
423
|
-
var handleIOnFocus = function handleIOnFocus() {
|
|
424
|
-
openSuggestions();
|
|
425
|
-
};
|
|
426
|
-
|
|
427
311
|
var handleIOnKeyDown = function handleIOnKeyDown(event) {
|
|
428
312
|
switch (event.keyCode) {
|
|
429
313
|
case 40:
|
|
430
314
|
// Arrow Down
|
|
431
|
-
if (numberInputContext) {
|
|
315
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
|
|
432
316
|
decrementNumber();
|
|
433
317
|
event.preventDefault();
|
|
434
318
|
} else {
|
|
@@ -439,8 +323,6 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
439
323
|
changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
|
|
440
324
|
if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
|
|
441
325
|
});
|
|
442
|
-
changeIsScrollable(true);
|
|
443
|
-
changeIsActiveSuggestion(false);
|
|
444
326
|
}
|
|
445
327
|
}
|
|
446
328
|
|
|
@@ -448,7 +330,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
448
330
|
|
|
449
331
|
case 38:
|
|
450
332
|
// Arrow Up
|
|
451
|
-
if (numberInputContext) {
|
|
333
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") {
|
|
452
334
|
incrementNumber();
|
|
453
335
|
event.preventDefault();
|
|
454
336
|
} else {
|
|
@@ -459,8 +341,6 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
459
341
|
changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
|
|
460
342
|
if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
|
|
461
343
|
});
|
|
462
|
-
changeIsScrollable(true);
|
|
463
|
-
changeIsActiveSuggestion(false);
|
|
464
344
|
}
|
|
465
345
|
}
|
|
466
346
|
|
|
@@ -470,7 +350,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
470
350
|
// Esc
|
|
471
351
|
event.preventDefault();
|
|
472
352
|
|
|
473
|
-
if (
|
|
353
|
+
if (hasSuggestions()) {
|
|
474
354
|
changeValue("");
|
|
475
355
|
isOpen && closeSuggestions();
|
|
476
356
|
}
|
|
@@ -479,7 +359,7 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
479
359
|
|
|
480
360
|
case 13:
|
|
481
361
|
// Enter
|
|
482
|
-
if (
|
|
362
|
+
if (hasSuggestions() && !isSearching) {
|
|
483
363
|
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
|
|
484
364
|
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
|
|
485
365
|
isOpen && closeSuggestions();
|
|
@@ -489,6 +369,22 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
489
369
|
}
|
|
490
370
|
};
|
|
491
371
|
|
|
372
|
+
var handleClearActionOnClick = function handleClearActionOnClick() {
|
|
373
|
+
changeValue("");
|
|
374
|
+
inputRef.current.focus();
|
|
375
|
+
suggestions && closeSuggestions();
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
|
|
379
|
+
decrementNumber();
|
|
380
|
+
inputRef.current.focus();
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
|
|
384
|
+
incrementNumber();
|
|
385
|
+
inputRef.current.focus();
|
|
386
|
+
};
|
|
387
|
+
|
|
492
388
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
493
389
|
var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
|
|
494
390
|
|
|
@@ -498,72 +394,6 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
498
394
|
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
|
|
499
395
|
};
|
|
500
396
|
|
|
501
|
-
(0, _react.useLayoutEffect)(function () {
|
|
502
|
-
var _suggestionsRef$curre;
|
|
503
|
-
|
|
504
|
-
isScrollable && (suggestionsRef === null || suggestionsRef === void 0 ? void 0 : (_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.scrollTo({
|
|
505
|
-
top: visualFocusedSuggIndex * 39
|
|
506
|
-
}));
|
|
507
|
-
return changeIsScrollable(false);
|
|
508
|
-
}, [isScrollable, visualFocusedSuggIndex]);
|
|
509
|
-
(0, _react.useEffect)(function () {
|
|
510
|
-
if (typeof suggestions === "function") {
|
|
511
|
-
changeIsSearching(true);
|
|
512
|
-
changeIsAutosuggestError(false);
|
|
513
|
-
changeFilteredSuggestions([]);
|
|
514
|
-
var cancelablePromise = makeCancelable(suggestions(value !== null && value !== void 0 ? value : innerValue));
|
|
515
|
-
cancelablePromise.promise.then(function (promiseResponse) {
|
|
516
|
-
changeIsSearching(false);
|
|
517
|
-
changeIsAutosuggestError(false);
|
|
518
|
-
changeFilteredSuggestions(promiseResponse);
|
|
519
|
-
})["catch"](function (err) {
|
|
520
|
-
if (!err.isCanceled) {
|
|
521
|
-
changeIsSearching(false);
|
|
522
|
-
changeIsAutosuggestError(true);
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
return function () {
|
|
526
|
-
cancelablePromise.cancel();
|
|
527
|
-
};
|
|
528
|
-
} else if (suggestions && suggestions.length) {
|
|
529
|
-
changeFilteredSuggestions(suggestions.filter(function (suggestion) {
|
|
530
|
-
return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
|
|
531
|
-
}));
|
|
532
|
-
changeVisualFocusedSuggIndex(-1);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
536
|
-
}, [value, innerValue, suggestions]);
|
|
537
|
-
var defaultClearAction = {
|
|
538
|
-
onClick: function onClick() {
|
|
539
|
-
changeValue("");
|
|
540
|
-
inputRef.current.focus();
|
|
541
|
-
suggestions && closeSuggestions();
|
|
542
|
-
},
|
|
543
|
-
icon: _react["default"].createElement("svg", {
|
|
544
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
545
|
-
width: "24",
|
|
546
|
-
height: "24",
|
|
547
|
-
viewBox: "0 0 24 24",
|
|
548
|
-
fill: "currentColor"
|
|
549
|
-
}, _react["default"].createElement("path", {
|
|
550
|
-
d: "M0 0h24v24H0V0z",
|
|
551
|
-
fill: "none"
|
|
552
|
-
}), _react["default"].createElement("path", {
|
|
553
|
-
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"
|
|
554
|
-
}))
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
var errorIcon = _react["default"].createElement("svg", {
|
|
558
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
559
|
-
height: "24px",
|
|
560
|
-
viewBox: "0 0 24 24",
|
|
561
|
-
width: "24px",
|
|
562
|
-
fill: "currentColor"
|
|
563
|
-
}, _react["default"].createElement("path", {
|
|
564
|
-
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"
|
|
565
|
-
}));
|
|
566
|
-
|
|
567
397
|
var decrementNumber = function decrementNumber() {
|
|
568
398
|
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
569
399
|
|
|
@@ -604,42 +434,43 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
604
434
|
}
|
|
605
435
|
};
|
|
606
436
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
437
|
+
(0, _react.useLayoutEffect)(function () {
|
|
438
|
+
var _suggestionsRef$curre, _visualFocusedOptionE;
|
|
439
|
+
|
|
440
|
+
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];
|
|
441
|
+
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
442
|
+
block: "nearest",
|
|
443
|
+
inline: "start"
|
|
444
|
+
});
|
|
445
|
+
}, [visualFocusedSuggIndex]);
|
|
446
|
+
(0, _react.useEffect)(function () {
|
|
447
|
+
if (typeof suggestions === "function") {
|
|
448
|
+
changeIsSearching(true);
|
|
449
|
+
changeIsAutosuggestError(false);
|
|
450
|
+
changeFilteredSuggestions([]);
|
|
451
|
+
var cancelablePromise = makeCancelable(suggestions(value !== null && value !== void 0 ? value : innerValue));
|
|
452
|
+
cancelablePromise.promise.then(function (promiseResponse) {
|
|
453
|
+
changeIsSearching(false);
|
|
454
|
+
changeIsAutosuggestError(false);
|
|
455
|
+
changeFilteredSuggestions(promiseResponse);
|
|
456
|
+
})["catch"](function (err) {
|
|
457
|
+
if (!err.isCanceled) {
|
|
458
|
+
changeIsSearching(false);
|
|
459
|
+
changeIsAutosuggestError(true);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
return function () {
|
|
463
|
+
cancelablePromise.cancel();
|
|
464
|
+
};
|
|
465
|
+
} else if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0) {
|
|
466
|
+
changeFilteredSuggestions(suggestions.filter(function (suggestion) {
|
|
467
|
+
return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
|
|
468
|
+
}));
|
|
469
|
+
changeVisualFocusedSuggIndex(-1);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
473
|
+
}, [value, innerValue, suggestions, numberInputContext]);
|
|
643
474
|
|
|
644
475
|
var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
|
|
645
476
|
var suggestion = _ref2.suggestion,
|
|
@@ -647,132 +478,142 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
647
478
|
var regEx = new RegExp(value !== null && value !== void 0 ? value : innerValue, "i");
|
|
648
479
|
var matchedWords = suggestion.match(regEx);
|
|
649
480
|
var noMatchedWords = suggestion.replace(regEx, "");
|
|
650
|
-
|
|
481
|
+
var isLastOption = index === lastOptionIndex;
|
|
482
|
+
return /*#__PURE__*/_react["default"].createElement(Suggestion, {
|
|
651
483
|
id: "suggestion-".concat(index),
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
onMouseUp: function onMouseUp() {
|
|
656
|
-
if (isActiveSuggestion) {
|
|
657
|
-
changeValue(suggestion);
|
|
658
|
-
changeIsActiveSuggestion(false);
|
|
659
|
-
closeSuggestions();
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
onMouseEnter: function onMouseEnter() {
|
|
663
|
-
changeVisualFocusedSuggIndex(index);
|
|
664
|
-
},
|
|
665
|
-
onMouseLeave: function onMouseLeave() {
|
|
666
|
-
changeIsActiveSuggestion(false);
|
|
484
|
+
onClick: function onClick() {
|
|
485
|
+
changeValue(suggestion);
|
|
486
|
+
closeSuggestions();
|
|
667
487
|
},
|
|
668
488
|
visualFocused: visualFocusedSuggIndex === index,
|
|
669
|
-
active: visualFocusedSuggIndex === index && isActiveSuggestion,
|
|
670
489
|
role: "option",
|
|
671
490
|
"aria-selected": visualFocusedSuggIndex === index && "true"
|
|
672
|
-
},
|
|
491
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledSuggestion, {
|
|
492
|
+
last: isLastOption,
|
|
493
|
+
visualFocused: visualFocusedSuggIndex === index
|
|
494
|
+
}, typeof suggestions === "function" ? suggestion : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedWords), noMatchedWords)));
|
|
673
495
|
};
|
|
674
496
|
|
|
675
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
497
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
676
498
|
theme: colorsTheme.textInput
|
|
677
|
-
}, _react["default"].createElement(DxcInput, {
|
|
499
|
+
}, /*#__PURE__*/_react["default"].createElement(DxcInput, {
|
|
678
500
|
margin: margin,
|
|
679
501
|
ref: ref,
|
|
680
502
|
size: size
|
|
681
|
-
}, _react["default"].createElement(Label, {
|
|
503
|
+
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
682
504
|
htmlFor: inputId,
|
|
683
505
|
disabled: disabled,
|
|
684
506
|
backgroundType: backgroundType
|
|
685
|
-
}, label, " ", optional && _react["default"].createElement(OptionalLabel, null, "(Optional)")), _react["default"].createElement(HelperText, {
|
|
507
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
686
508
|
disabled: disabled,
|
|
687
509
|
backgroundType: backgroundType
|
|
688
|
-
}, helperText), _react["default"].createElement(InputContainer, {
|
|
510
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
|
|
689
511
|
error: error,
|
|
690
512
|
disabled: disabled,
|
|
691
513
|
backgroundType: backgroundType,
|
|
692
|
-
onClick: handleInputContainerOnClick
|
|
693
|
-
|
|
514
|
+
onClick: handleInputContainerOnClick,
|
|
515
|
+
onMouseDown: handleInputContainerOnMouseDown
|
|
516
|
+
}, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
|
|
694
517
|
disabled: disabled,
|
|
695
518
|
backgroundType: backgroundType
|
|
696
|
-
}, prefix), _react["default"].createElement(Input, {
|
|
519
|
+
}, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
|
|
697
520
|
id: inputId,
|
|
698
521
|
name: name,
|
|
699
522
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
700
523
|
placeholder: placeholder,
|
|
701
|
-
onChange: handleIOnChange,
|
|
702
|
-
onClick: handleIOnClick,
|
|
703
524
|
onBlur: handleIOnBlur,
|
|
704
|
-
|
|
525
|
+
onChange: handleIOnChange,
|
|
526
|
+
onFocus: function onFocus() {
|
|
527
|
+
openSuggestions();
|
|
528
|
+
},
|
|
705
529
|
onKeyDown: handleIOnKeyDown,
|
|
530
|
+
onMouseDown: function onMouseDown(event) {
|
|
531
|
+
event.stopPropagation();
|
|
532
|
+
},
|
|
706
533
|
disabled: disabled,
|
|
707
534
|
ref: inputRef,
|
|
708
535
|
backgroundType: backgroundType,
|
|
709
536
|
pattern: pattern,
|
|
710
|
-
minLength:
|
|
711
|
-
maxLength:
|
|
537
|
+
minLength: minLength,
|
|
538
|
+
maxLength: maxLength,
|
|
712
539
|
autoComplete: autocomplete,
|
|
713
540
|
tabIndex: tabIndex,
|
|
714
|
-
role: isTextInputType() &&
|
|
715
|
-
"aria-autocomplete": isTextInputType() &&
|
|
716
|
-
"aria-controls": isTextInputType() &&
|
|
717
|
-
"aria-expanded": isTextInputType() &&
|
|
718
|
-
"aria-activedescendant": isTextInputType() &&
|
|
541
|
+
role: isTextInputType() && hasSuggestions() ? "combobox" : "textbox",
|
|
542
|
+
"aria-autocomplete": isTextInputType() && hasSuggestions() ? "list" : undefined,
|
|
543
|
+
"aria-controls": isTextInputType() && hasSuggestions() ? autosuggestId : undefined,
|
|
544
|
+
"aria-expanded": isTextInputType() && hasSuggestions() ? isOpen ? "true" : "false" : undefined,
|
|
545
|
+
"aria-activedescendant": isTextInputType() && hasSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
|
|
719
546
|
"aria-invalid": error ? "true" : "false",
|
|
720
547
|
"aria-describedby": error ? errorId : undefined,
|
|
721
548
|
"aria-required": optional ? "false" : "true"
|
|
722
|
-
}), !disabled && error && _react["default"].createElement(ErrorIcon, {
|
|
549
|
+
}), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
723
550
|
backgroundType: backgroundType,
|
|
724
551
|
"aria-label": "Error"
|
|
725
|
-
},
|
|
726
|
-
onClick:
|
|
552
|
+
}, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
553
|
+
onClick: handleClearActionOnClick,
|
|
554
|
+
onMouseDown: function onMouseDown(event) {
|
|
555
|
+
event.stopPropagation();
|
|
556
|
+
},
|
|
727
557
|
backgroundType: backgroundType,
|
|
728
558
|
tabIndex: tabIndex,
|
|
729
|
-
|
|
730
|
-
|
|
559
|
+
title: "Clear field",
|
|
560
|
+
"aria-label": "Clear field"
|
|
561
|
+
}, textInputIcons.clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Action, {
|
|
731
562
|
ref: actionRef,
|
|
732
563
|
disabled: disabled,
|
|
733
|
-
onClick:
|
|
564
|
+
onClick: handleDecrementActionOnClick,
|
|
565
|
+
onMouseDown: function onMouseDown(event) {
|
|
566
|
+
event.stopPropagation();
|
|
567
|
+
},
|
|
734
568
|
backgroundType: backgroundType,
|
|
735
569
|
tabIndex: tabIndex,
|
|
736
|
-
|
|
737
|
-
|
|
570
|
+
title: "Decrement value",
|
|
571
|
+
"aria-label": "Decrement value"
|
|
572
|
+
}, textInputIcons.decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
738
573
|
ref: actionRef,
|
|
739
574
|
disabled: disabled,
|
|
740
|
-
onClick:
|
|
575
|
+
onClick: handleIncrementActionOnClick,
|
|
576
|
+
onMouseDown: function onMouseDown(event) {
|
|
577
|
+
event.stopPropagation();
|
|
578
|
+
},
|
|
741
579
|
backgroundType: backgroundType,
|
|
742
580
|
tabIndex: tabIndex,
|
|
743
|
-
|
|
744
|
-
|
|
581
|
+
title: "Increment value",
|
|
582
|
+
"aria-label": "Increment value"
|
|
583
|
+
}, textInputIcons.increment)) : action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
745
584
|
ref: actionRef,
|
|
746
585
|
disabled: disabled,
|
|
747
586
|
onClick: action.onClick,
|
|
587
|
+
onMouseDown: function onMouseDown(event) {
|
|
588
|
+
event.stopPropagation();
|
|
589
|
+
},
|
|
590
|
+
title: action.title,
|
|
591
|
+
"aria-label": action.title,
|
|
748
592
|
backgroundType: backgroundType,
|
|
749
593
|
tabIndex: tabIndex
|
|
750
|
-
}, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
|
|
594
|
+
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(ActionIcon, {
|
|
751
595
|
src: action.icon
|
|
752
|
-
}) : action.icon), suffix && _react["default"].createElement(Suffix, {
|
|
596
|
+
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
753
597
|
disabled: disabled,
|
|
754
598
|
backgroundType: backgroundType
|
|
755
|
-
}, suffix), isOpen && _react["default"].createElement(Suggestions, {
|
|
599
|
+
}, suffix), isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError) && /*#__PURE__*/_react["default"].createElement(Suggestions, {
|
|
756
600
|
id: autosuggestId,
|
|
757
601
|
isError: isAutosuggestError,
|
|
758
602
|
onMouseDown: function onMouseDown(event) {
|
|
759
603
|
event.preventDefault();
|
|
760
604
|
},
|
|
761
|
-
onMouseLeave: function onMouseLeave() {
|
|
762
|
-
changeVisualFocusedSuggIndex(-1);
|
|
763
|
-
},
|
|
764
605
|
ref: suggestionsRef,
|
|
765
606
|
role: "listbox",
|
|
766
607
|
"aria-label": label
|
|
767
|
-
}, !isSearching && !isAutosuggestError && filteredSuggestions.length
|
|
768
|
-
return _react["default"].createElement(HighlightedSuggestion, {
|
|
608
|
+
}, !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
|
|
609
|
+
return /*#__PURE__*/_react["default"].createElement(HighlightedSuggestion, {
|
|
769
610
|
key: "suggestion-".concat((0, _uuid.v4)()),
|
|
770
611
|
suggestion: suggestion,
|
|
771
612
|
index: index
|
|
772
613
|
});
|
|
773
|
-
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(SuggestionsErrorIcon, {
|
|
614
|
+
}), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && /*#__PURE__*/_react["default"].createElement(SuggestionsError, null, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, {
|
|
774
615
|
backgroundType: backgroundType
|
|
775
|
-
},
|
|
616
|
+
}, textInputIcons.error), "Error fetching data"))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
776
617
|
id: errorId,
|
|
777
618
|
backgroundType: backgroundType
|
|
778
619
|
}, error)));
|
|
@@ -789,7 +630,7 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
789
630
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
790
631
|
};
|
|
791
632
|
|
|
792
|
-
var DxcInput = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
633
|
+
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) {
|
|
793
634
|
return calculateWidth(props.margin, props.size);
|
|
794
635
|
}, function (props) {
|
|
795
636
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -803,7 +644,7 @@ var DxcInput = _styledComponents["default"].div(_templateObject(), function (pro
|
|
|
803
644
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
804
645
|
});
|
|
805
646
|
|
|
806
|
-
var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
|
|
647
|
+
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) {
|
|
807
648
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
808
649
|
}, function (props) {
|
|
809
650
|
return props.theme.fontFamily;
|
|
@@ -817,11 +658,11 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
|
|
|
817
658
|
return props.theme.labelLineHeight;
|
|
818
659
|
});
|
|
819
660
|
|
|
820
|
-
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
661
|
+
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
821
662
|
return props.theme.optionalLabelFontWeight;
|
|
822
663
|
});
|
|
823
664
|
|
|
824
|
-
var HelperText = _styledComponents["default"].span(_templateObject4(), function (props) {
|
|
665
|
+
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) {
|
|
825
666
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
826
667
|
}, function (props) {
|
|
827
668
|
return props.theme.fontFamily;
|
|
@@ -835,7 +676,9 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
|
|
|
835
676
|
return props.theme.helperTextLineHeight;
|
|
836
677
|
});
|
|
837
678
|
|
|
838
|
-
var InputContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
679
|
+
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n margin: ", ";\n padding: 0 0.5rem;\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
680
|
+
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
681
|
+
}, function (props) {
|
|
839
682
|
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
840
683
|
}, function (props) {
|
|
841
684
|
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
@@ -847,7 +690,7 @@ var InputContainer = _styledComponents["default"].div(_templateObject5(), functi
|
|
|
847
690
|
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 ");
|
|
848
691
|
});
|
|
849
692
|
|
|
850
|
-
var Input = _styledComponents["default"].input(_templateObject6(), function (props) {
|
|
693
|
+
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) {
|
|
851
694
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
|
|
852
695
|
}, function (props) {
|
|
853
696
|
return props.theme.fontFamily;
|
|
@@ -863,9 +706,9 @@ var Input = _styledComponents["default"].input(_templateObject6(), function (pro
|
|
|
863
706
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
864
707
|
});
|
|
865
708
|
|
|
866
|
-
var ActionIcon = _styledComponents["default"].img(_templateObject7());
|
|
709
|
+
var ActionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"])));
|
|
867
710
|
|
|
868
|
-
var Action = _styledComponents["default"].button(_templateObject8(), function (props) {
|
|
711
|
+
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) {
|
|
869
712
|
return props.theme.fontFamily;
|
|
870
713
|
}, function (props) {
|
|
871
714
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
@@ -874,37 +717,37 @@ var Action = _styledComponents["default"].button(_templateObject8(), function (p
|
|
|
874
717
|
}, function (props) {
|
|
875
718
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
876
719
|
}, function (props) {
|
|
877
|
-
return !props.disabled && "\n &:
|
|
720
|
+
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 ");
|
|
878
721
|
});
|
|
879
722
|
|
|
880
|
-
var Prefix = _styledComponents["default"].span(_templateObject9(), function (props) {
|
|
723
|
+
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) {
|
|
881
724
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
|
|
882
725
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
883
726
|
}, function (props) {
|
|
884
727
|
return props.theme.fontFamily;
|
|
885
728
|
});
|
|
886
729
|
|
|
887
|
-
var Suffix = _styledComponents["default"].span(_templateObject10(), function (props) {
|
|
730
|
+
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) {
|
|
888
731
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
|
|
889
732
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
890
733
|
}, function (props) {
|
|
891
734
|
return props.theme.fontFamily;
|
|
892
735
|
});
|
|
893
736
|
|
|
894
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject11(), function (props) {
|
|
737
|
+
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) {
|
|
895
738
|
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
896
739
|
});
|
|
897
740
|
|
|
898
|
-
var Error = _styledComponents["default"].span(_templateObject12(), function (props) {
|
|
741
|
+
var Error = _styledComponents["default"].span(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n"])), function (props) {
|
|
899
742
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
900
743
|
}, function (props) {
|
|
901
744
|
return props.theme.fontFamily;
|
|
902
745
|
});
|
|
903
746
|
|
|
904
|
-
var Suggestions = _styledComponents["default"].ul(_templateObject13(), function (props) {
|
|
905
|
-
return props.isError ? props.theme.
|
|
747
|
+
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) {
|
|
748
|
+
return props.isError ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
|
|
906
749
|
}, function (props) {
|
|
907
|
-
return props.isError ? props.theme.
|
|
750
|
+
return props.isError ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
|
|
908
751
|
}, function (props) {
|
|
909
752
|
return props.theme.listOptionFontColor;
|
|
910
753
|
}, function (props) {
|
|
@@ -917,55 +760,29 @@ var Suggestions = _styledComponents["default"].ul(_templateObject13(), function
|
|
|
917
760
|
return props.theme.listOptionFontWeight;
|
|
918
761
|
});
|
|
919
762
|
|
|
920
|
-
var Suggestion = _styledComponents["default"].li(_templateObject14(), function (props) {
|
|
921
|
-
return props.
|
|
763
|
+
var Suggestion = _styledComponents["default"].li(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0 0.5rem;\n line-height: 1.715em;\n cursor: pointer;\n\n box-shadow: inset 0 0 0 2px\n ", ";\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
764
|
+
return props.visualFocused ? props.theme.focusListOptionBorderColor : "transparent";
|
|
765
|
+
}, function (props) {
|
|
766
|
+
return props.theme.hoverListOptionBackgroundColor;
|
|
767
|
+
}, function (props) {
|
|
768
|
+
return props.theme.activeListOptionBackgroundColor;
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
var StyledSuggestion = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.25rem 0.5rem 0.188rem 0.5rem;\n ", ";\n"])), function (props) {
|
|
772
|
+
return props.last || props.visualFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
922
773
|
});
|
|
923
774
|
|
|
924
|
-
var SuggestionsSystemMessage = _styledComponents["default"].span(
|
|
775
|
+
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) {
|
|
925
776
|
return props.theme.systemMessageFontColor;
|
|
926
777
|
});
|
|
927
778
|
|
|
928
|
-
var SuggestionsErrorIcon = _styledComponents["default"].span(
|
|
779
|
+
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) {
|
|
929
780
|
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
930
781
|
});
|
|
931
782
|
|
|
932
|
-
var SuggestionsError = _styledComponents["default"].span(
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
name: _propTypes["default"].string,
|
|
937
|
-
value: _propTypes["default"].string,
|
|
938
|
-
helperText: _propTypes["default"].string,
|
|
939
|
-
placeholder: _propTypes["default"].string,
|
|
940
|
-
action: _propTypes["default"].shape({
|
|
941
|
-
onClick: _propTypes["default"].func.isRequired,
|
|
942
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
943
|
-
type: _propTypes["default"].oneOf(["svg"])
|
|
944
|
-
}), _propTypes["default"].string]).isRequired
|
|
945
|
-
}),
|
|
946
|
-
clearable: _propTypes["default"].bool,
|
|
947
|
-
disabled: _propTypes["default"].bool,
|
|
948
|
-
optional: _propTypes["default"].bool,
|
|
949
|
-
prefix: _propTypes["default"].string,
|
|
950
|
-
suffix: _propTypes["default"].string,
|
|
951
|
-
onChange: _propTypes["default"].func,
|
|
952
|
-
onBlur: _propTypes["default"].func,
|
|
953
|
-
error: _propTypes["default"].string,
|
|
954
|
-
autocomplete: _propTypes["default"].string,
|
|
955
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
956
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
957
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
958
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
959
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
960
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
961
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
962
|
-
suggestions: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].array]),
|
|
963
|
-
pattern: _propTypes["default"].string,
|
|
964
|
-
length: _propTypes["default"].shape({
|
|
965
|
-
min: _propTypes["default"].number,
|
|
966
|
-
max: _propTypes["default"].number
|
|
967
|
-
}),
|
|
968
|
-
tabIndex: _propTypes["default"].number
|
|
969
|
-
};
|
|
783
|
+
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) {
|
|
784
|
+
return props.theme.errorListDialogFontColor;
|
|
785
|
+
});
|
|
786
|
+
|
|
970
787
|
var _default = DxcTextInput;
|
|
971
788
|
exports["default"] = _default;
|