@dxc-technology/halstack-react 0.0.0-da90bf9 → 0.0.0-da9270d
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 +1 -0
- package/BackgroundColorContext.js +8 -24
- package/HalstackContext.d.ts +1235 -0
- package/HalstackContext.js +310 -0
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +120 -291
- package/accordion/Accordion.stories.tsx +283 -0
- package/accordion/Accordion.test.js +56 -0
- package/accordion/types.d.ts +57 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +8 -0
- package/accordion-group/AccordionGroup.js +57 -142
- package/accordion-group/AccordionGroup.stories.tsx +252 -0
- package/accordion-group/AccordionGroup.test.js +98 -0
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +67 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +55 -204
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +75 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +15 -30
- package/badge/types.d.ts +5 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +43 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +35 -116
- package/box/Box.stories.tsx +119 -0
- package/box/Box.test.js +13 -0
- package/box/types.d.ts +32 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +89 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +67 -185
- package/button/Button.stories.tsx +344 -0
- package/button/Button.test.js +36 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +60 -194
- package/card/Card.stories.tsx +171 -0
- package/card/Card.test.js +39 -0
- package/card/types.d.ts +62 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +147 -231
- package/checkbox/Checkbox.stories.tsx +222 -0
- package/checkbox/Checkbox.test.js +199 -0
- package/checkbox/types.d.ts +72 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +50 -194
- package/chip/Chip.stories.tsx +214 -0
- package/chip/Chip.test.js +41 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1381 -0
- package/common/variables.js +1006 -1319
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/container/types.js +5 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +179 -356
- package/date-input/DateInput.stories.tsx +285 -0
- package/date-input/DateInput.test.js +808 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +115 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +164 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +70 -184
- package/dialog/Dialog.stories.tsx +365 -0
- package/dialog/Dialog.test.js +307 -0
- package/dialog/types.d.ts +36 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +247 -457
- package/dropdown/Dropdown.stories.tsx +438 -0
- package/dropdown/Dropdown.test.js +599 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +67 -0
- package/dropdown/types.d.ts +98 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +297 -462
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +459 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +61 -213
- package/file-input/types.d.ts +129 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +64 -360
- package/footer/Footer.stories.tsx +152 -0
- package/footer/Footer.test.js +85 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +16 -21
- package/footer/types.d.ts +58 -0
- package/footer/types.js +5 -0
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.d.ts +8 -0
- package/header/Header.js +122 -372
- package/header/Header.stories.tsx +251 -0
- package/header/Header.test.js +66 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +9 -39
- package/header/types.d.ts +33 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +31 -124
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +169 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +43 -0
- package/inset/Inset.stories.tsx +230 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +85 -278
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +8 -0
- package/layout/Icons.js +51 -48
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +13 -0
- package/layout/types.d.ts +41 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +67 -189
- package/link/Link.stories.tsx +253 -0
- package/link/Link.test.js +63 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +46 -40
- package/main.js +117 -140
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +90 -0
- package/nav-tabs/NavTabs.stories.tsx +274 -0
- package/nav-tabs/NavTabs.test.js +75 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +117 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +11 -0
- package/number-input/NumberInput.js +32 -101
- package/number-input/NumberInput.stories.tsx +131 -0
- package/number-input/NumberInput.test.js +830 -0
- package/number-input/types.d.ts +130 -0
- package/number-input/types.js +5 -0
- package/package.json +53 -49
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +26 -52
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +41 -211
- package/paginator/Paginator.stories.tsx +87 -0
- package/paginator/Paginator.test.js +335 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +66 -172
- package/password-input/PasswordInput.stories.tsx +99 -0
- package/password-input/PasswordInput.test.js +198 -0
- package/password-input/types.d.ts +111 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +76 -174
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +93 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +94 -0
- package/quick-nav/QuickNav.stories.tsx +356 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +124 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +235 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +756 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.d.ts +4 -0
- package/resultset-table/ResultsetTable.js +159 -0
- package/resultset-table/ResultsetTable.stories.tsx +300 -0
- package/resultset-table/ResultsetTable.test.js +305 -0
- package/resultset-table/types.d.ts +67 -0
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +89 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +143 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +80 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +294 -849
- package/select/Select.stories.tsx +971 -0
- package/select/Select.test.js +2370 -0
- package/select/types.d.ts +209 -0
- package/select/types.js +5 -0
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +134 -117
- package/sidenav/Sidenav.stories.tsx +282 -0
- package/sidenav/Sidenav.test.js +37 -0
- package/sidenav/types.d.ts +76 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +172 -291
- package/slider/Slider.test.js +254 -0
- package/slider/types.d.ts +86 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +66 -241
- package/spinner/Spinner.stories.tsx +129 -0
- package/spinner/Spinner.test.js +55 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +153 -161
- package/switch/Switch.stories.tsx +137 -0
- package/switch/Switch.test.js +180 -0
- package/switch/types.d.ts +66 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +14 -50
- package/table/Table.stories.tsx +356 -0
- package/table/Table.test.js +21 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +113 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +322 -281
- package/tabs/Tabs.stories.tsx +226 -0
- package/tabs/Tabs.test.js +294 -0
- package/tabs/types.d.ts +92 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +61 -192
- package/tag/Tag.stories.tsx +155 -0
- package/tag/Tag.test.js +49 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +56 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +67 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +84 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +360 -757
- package/text-input/TextInput.stories.tsx +465 -0
- package/text-input/TextInput.test.js +1739 -0
- package/text-input/types.d.ts +205 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +105 -240
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +406 -0
- package/textarea/types.d.ts +141 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +107 -233
- package/toggle-group/ToggleGroup.stories.tsx +218 -0
- package/toggle-group/ToggleGroup.test.js +137 -0
- package/toggle-group/types.d.ts +114 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +23 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1134 -0
- package/useTheme.js +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +121 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +138 -293
- package/wizard/Wizard.stories.tsx +253 -0
- package/wizard/Wizard.test.js +114 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/ThemeContext.js +0 -250
- package/V3Select/V3Select.js +0 -549
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -264
- package/V3Textarea/index.d.ts +0 -27
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/alert/index.d.ts +0 -51
- package/box/index.d.ts +0 -25
- package/button/Button.stories.js +0 -27
- package/button/index.d.ts +0 -24
- package/card/index.d.ts +0 -22
- package/checkbox/index.d.ts +0 -24
- package/chip/index.d.ts +0 -22
- package/common/RequiredComponent.js +0 -40
- package/date/Date.js +0 -379
- package/date/index.d.ts +0 -27
- package/date-input/index.d.ts +0 -95
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -705
- package/input-text/index.d.ts +0 -36
- package/link/index.d.ts +0 -23
- package/number-input/NumberInputContext.js +0 -16
- package/number-input/index.d.ts +0 -113
- package/paginator/index.d.ts +0 -20
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/radio/Radio.js +0 -209
- package/radio/index.d.ts +0 -23
- package/resultsetTable/ResultsetTable.js +0 -358
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/switch/index.d.ts +0 -24
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -220
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -205
- package/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -189
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -123
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -148
- package/upload/transactions/Transactions.js +0 -138
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
package/text-input/TextInput.js
CHANGED
|
@@ -1,268 +1,43 @@
|
|
|
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
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
-
|
|
18
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
-
|
|
20
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
13
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
14
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
15
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
16
|
+
var _variables = require("../common/variables");
|
|
17
|
+
var _utils = require("../common/utils");
|
|
18
|
+
var _NumberInput = require("../number-input/NumberInput");
|
|
19
|
+
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
|
20
|
+
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
21
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
32
22
|
var _uuid = require("uuid");
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_templateObject17 = function _templateObject17() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _templateObject16() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n color: ", ";\n line-height: 1.715em;\n"]);
|
|
60
|
-
|
|
61
|
-
_templateObject16 = function _templateObject16() {
|
|
62
|
-
return data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _templateObject15() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.25rem 0.5rem 0.188rem 0.5rem;\n ", ";\n"]);
|
|
70
|
-
|
|
71
|
-
_templateObject15 = function _templateObject15() {
|
|
72
|
-
return data;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _templateObject14() {
|
|
79
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 0.5rem;\n line-height: 1.715em;\n cursor: pointer;\n\n box-shadow: inset 0 0 0 2px\n ", ";\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"]);
|
|
80
|
-
|
|
81
|
-
_templateObject14 = function _templateObject14() {
|
|
82
|
-
return data;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _templateObject13() {
|
|
89
|
-
var data = (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"]);
|
|
90
|
-
|
|
91
|
-
_templateObject13 = function _templateObject13() {
|
|
92
|
-
return data;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return data;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _templateObject12() {
|
|
99
|
-
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"]);
|
|
100
|
-
|
|
101
|
-
_templateObject12 = function _templateObject12() {
|
|
102
|
-
return data;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
return data;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function _templateObject11() {
|
|
109
|
-
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"]);
|
|
110
|
-
|
|
111
|
-
_templateObject11 = function _templateObject11() {
|
|
112
|
-
return data;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
return data;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _templateObject10() {
|
|
119
|
-
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"]);
|
|
120
|
-
|
|
121
|
-
_templateObject10 = function _templateObject10() {
|
|
122
|
-
return data;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return data;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function _templateObject9() {
|
|
129
|
-
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"]);
|
|
130
|
-
|
|
131
|
-
_templateObject9 = function _templateObject9() {
|
|
132
|
-
return data;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
return data;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function _templateObject8() {
|
|
139
|
-
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: 2px;\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"]);
|
|
140
|
-
|
|
141
|
-
_templateObject8 = function _templateObject8() {
|
|
142
|
-
return data;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
return data;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function _templateObject7() {
|
|
149
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"]);
|
|
150
|
-
|
|
151
|
-
_templateObject7 = function _templateObject7() {
|
|
152
|
-
return data;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return data;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function _templateObject6() {
|
|
159
|
-
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"]);
|
|
160
|
-
|
|
161
|
-
_templateObject6 = function _templateObject6() {
|
|
162
|
-
return data;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return data;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function _templateObject5() {
|
|
169
|
-
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"]);
|
|
170
|
-
|
|
171
|
-
_templateObject5 = function _templateObject5() {
|
|
172
|
-
return data;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
return data;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function _templateObject4() {
|
|
179
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
180
|
-
|
|
181
|
-
_templateObject4 = function _templateObject4() {
|
|
182
|
-
return data;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
return data;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function _templateObject3() {
|
|
189
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
|
|
190
|
-
|
|
191
|
-
_templateObject3 = function _templateObject3() {
|
|
192
|
-
return data;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
return data;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function _templateObject2() {
|
|
199
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
200
|
-
|
|
201
|
-
_templateObject2 = function _templateObject2() {
|
|
202
|
-
return data;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
return data;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function _templateObject() {
|
|
209
|
-
var data = (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"]);
|
|
210
|
-
|
|
211
|
-
_templateObject = function _templateObject() {
|
|
212
|
-
return data;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
return data;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
var textInputIcons = {
|
|
219
|
-
error: _react["default"].createElement("svg", {
|
|
220
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
221
|
-
height: "24px",
|
|
222
|
-
viewBox: "0 0 24 24",
|
|
223
|
-
width: "24px",
|
|
224
|
-
fill: "currentColor"
|
|
225
|
-
}, _react["default"].createElement("path", {
|
|
226
|
-
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"
|
|
227
|
-
})),
|
|
228
|
-
clear: _react["default"].createElement("svg", {
|
|
229
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
230
|
-
width: "24",
|
|
231
|
-
height: "24",
|
|
232
|
-
viewBox: "0 0 24 24",
|
|
233
|
-
fill: "currentColor"
|
|
234
|
-
}, _react["default"].createElement("path", {
|
|
235
|
-
d: "M0 0h24v24H0V0z",
|
|
236
|
-
fill: "none"
|
|
237
|
-
}), _react["default"].createElement("path", {
|
|
238
|
-
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"
|
|
239
|
-
})),
|
|
240
|
-
increment: _react["default"].createElement("svg", {
|
|
241
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
242
|
-
height: "24px",
|
|
243
|
-
viewBox: "0 0 24 24",
|
|
244
|
-
width: "24px",
|
|
245
|
-
fill: "currentColor"
|
|
246
|
-
}, _react["default"].createElement("path", {
|
|
247
|
-
d: "M0 0h24v24H0z",
|
|
248
|
-
fill: "none"
|
|
249
|
-
}), _react["default"].createElement("path", {
|
|
250
|
-
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
|
251
|
-
})),
|
|
252
|
-
decrement: _react["default"].createElement("svg", {
|
|
253
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
254
|
-
height: "24px",
|
|
255
|
-
viewBox: "0 0 24 24",
|
|
256
|
-
width: "24px",
|
|
257
|
-
fill: "currentColor"
|
|
258
|
-
}, _react["default"].createElement("path", {
|
|
259
|
-
d: "M0 0h24v24H0z",
|
|
260
|
-
fill: "none"
|
|
261
|
-
}), _react["default"].createElement("path", {
|
|
262
|
-
d: "M19 13H5v-2h14v2z"
|
|
263
|
-
}))
|
|
23
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
26
|
+
var sizes = {
|
|
27
|
+
small: "240px",
|
|
28
|
+
medium: "360px",
|
|
29
|
+
large: "480px",
|
|
30
|
+
fillParent: "100%"
|
|
31
|
+
};
|
|
32
|
+
var AutosuggestWrapper = function AutosuggestWrapper(_ref) {
|
|
33
|
+
var condition = _ref.condition,
|
|
34
|
+
wrapper = _ref.wrapper,
|
|
35
|
+
children = _ref.children;
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, condition ? wrapper(children) : children);
|
|
37
|
+
};
|
|
38
|
+
var calculateWidth = function calculateWidth(margin, size) {
|
|
39
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
264
40
|
};
|
|
265
|
-
|
|
266
41
|
var makeCancelable = function makeCancelable(promise) {
|
|
267
42
|
var hasCanceled_ = false;
|
|
268
43
|
var wrappedPromise = new Promise(function (resolve, reject) {
|
|
@@ -283,332 +58,263 @@ var makeCancelable = function makeCancelable(promise) {
|
|
|
283
58
|
}
|
|
284
59
|
};
|
|
285
60
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return "This field is required. Please, enter a value.";
|
|
61
|
+
var hasSuggestions = function hasSuggestions(suggestions) {
|
|
62
|
+
return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
|
|
289
63
|
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
|
|
64
|
+
var isRequired = function isRequired(value, optional) {
|
|
65
|
+
return value === "" && !optional;
|
|
293
66
|
};
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return "Please match the format requested.";
|
|
67
|
+
var isLengthIncorrect = function isLengthIncorrect(value, minLength, maxLength) {
|
|
68
|
+
return value != null && (value.length < minLength || value.length > maxLength);
|
|
297
69
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return new RegExp(pattern).test(value);
|
|
70
|
+
var isNumberIncorrect = function isNumberIncorrect(value, minNumber, maxNumber) {
|
|
71
|
+
return value < minNumber || value > maxNumber;
|
|
301
72
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
var
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
73
|
+
var patternMismatch = function patternMismatch(pattern, value) {
|
|
74
|
+
return pattern != null && !new RegExp(pattern).test(value);
|
|
75
|
+
};
|
|
76
|
+
var useWidth = function useWidth(target) {
|
|
77
|
+
var _useState = (0, _react.useState)(0),
|
|
78
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
79
|
+
width = _useState2[0],
|
|
80
|
+
setWidth = _useState2[1];
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
if (target != null) {
|
|
83
|
+
setWidth(target.getBoundingClientRect().width);
|
|
84
|
+
var triggerObserver = new ResizeObserver(function (entries) {
|
|
85
|
+
var rect = entries[0].target.getBoundingClientRect();
|
|
86
|
+
setWidth(rect === null || rect === void 0 ? void 0 : rect.width);
|
|
87
|
+
});
|
|
88
|
+
triggerObserver.observe(target);
|
|
89
|
+
return function () {
|
|
90
|
+
triggerObserver.unobserve(target);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, [target]);
|
|
94
|
+
return width;
|
|
95
|
+
};
|
|
96
|
+
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
97
|
+
var label = _ref2.label,
|
|
98
|
+
_ref2$name = _ref2.name,
|
|
99
|
+
name = _ref2$name === void 0 ? "" : _ref2$name,
|
|
100
|
+
_ref2$defaultValue = _ref2.defaultValue,
|
|
101
|
+
defaultValue = _ref2$defaultValue === void 0 ? "" : _ref2$defaultValue,
|
|
102
|
+
value = _ref2.value,
|
|
103
|
+
helperText = _ref2.helperText,
|
|
104
|
+
_ref2$placeholder = _ref2.placeholder,
|
|
105
|
+
placeholder = _ref2$placeholder === void 0 ? "" : _ref2$placeholder,
|
|
106
|
+
action = _ref2.action,
|
|
107
|
+
_ref2$clearable = _ref2.clearable,
|
|
108
|
+
clearable = _ref2$clearable === void 0 ? false : _ref2$clearable,
|
|
109
|
+
_ref2$disabled = _ref2.disabled,
|
|
110
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
111
|
+
_ref2$readOnly = _ref2.readOnly,
|
|
112
|
+
readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
|
|
113
|
+
_ref2$optional = _ref2.optional,
|
|
114
|
+
optional = _ref2$optional === void 0 ? false : _ref2$optional,
|
|
115
|
+
_ref2$prefix = _ref2.prefix,
|
|
116
|
+
prefix = _ref2$prefix === void 0 ? "" : _ref2$prefix,
|
|
117
|
+
_ref2$suffix = _ref2.suffix,
|
|
118
|
+
suffix = _ref2$suffix === void 0 ? "" : _ref2$suffix,
|
|
119
|
+
onChange = _ref2.onChange,
|
|
120
|
+
onBlur = _ref2.onBlur,
|
|
121
|
+
error = _ref2.error,
|
|
122
|
+
suggestions = _ref2.suggestions,
|
|
123
|
+
pattern = _ref2.pattern,
|
|
124
|
+
minLength = _ref2.minLength,
|
|
125
|
+
maxLength = _ref2.maxLength,
|
|
126
|
+
_ref2$autocomplete = _ref2.autocomplete,
|
|
127
|
+
autocomplete = _ref2$autocomplete === void 0 ? "off" : _ref2$autocomplete,
|
|
128
|
+
margin = _ref2.margin,
|
|
129
|
+
_ref2$size = _ref2.size,
|
|
130
|
+
size = _ref2$size === void 0 ? "medium" : _ref2$size,
|
|
131
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
132
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
133
|
+
var _useState3 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
134
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
135
|
+
inputId = _useState4[0];
|
|
136
|
+
var autosuggestId = "suggestions-".concat(inputId);
|
|
137
|
+
var errorId = "error-".concat(inputId);
|
|
138
|
+
var _useState5 = (0, _react.useState)(defaultValue),
|
|
139
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
140
|
+
innerValue = _useState6[0],
|
|
141
|
+
setInnerValue = _useState6[1];
|
|
355
142
|
var _useState7 = (0, _react.useState)(false),
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
143
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
144
|
+
isOpen = _useState8[0],
|
|
145
|
+
changeIsOpen = _useState8[1];
|
|
360
146
|
var _useState9 = (0, _react.useState)(false),
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
147
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
148
|
+
isSearching = _useState10[0],
|
|
149
|
+
changeIsSearching = _useState10[1];
|
|
150
|
+
var _useState11 = (0, _react.useState)(false),
|
|
151
|
+
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
152
|
+
isAutosuggestError = _useState12[0],
|
|
153
|
+
changeIsAutosuggestError = _useState12[1];
|
|
154
|
+
var _useState13 = (0, _react.useState)([]),
|
|
155
|
+
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
156
|
+
filteredSuggestions = _useState14[0],
|
|
157
|
+
changeFilteredSuggestions = _useState14[1];
|
|
158
|
+
var _useState15 = (0, _react.useState)(-1),
|
|
159
|
+
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
160
|
+
visualFocusIndex = _useState16[0],
|
|
161
|
+
changeVisualFocusIndex = _useState16[1];
|
|
376
162
|
var inputRef = (0, _react.useRef)(null);
|
|
163
|
+
var inputContainerRef = (0, _react.useRef)(null);
|
|
377
164
|
var actionRef = (0, _react.useRef)(null);
|
|
165
|
+
var width = useWidth(inputContainerRef.current);
|
|
378
166
|
var colorsTheme = (0, _useTheme["default"])();
|
|
379
|
-
var
|
|
380
|
-
var
|
|
381
|
-
var errorId = "error-message-".concat(inputId);
|
|
382
|
-
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
383
|
-
|
|
384
|
-
var isNotOptional = function isNotOptional(value) {
|
|
385
|
-
return value === "" && !optional;
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
var isLengthIncorrect = function isLengthIncorrect(value) {
|
|
389
|
-
return value !== "" && length && length.min && length.max && (value.length < length.min || value.length > length.max);
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
393
|
-
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);
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
var isTextInputType = function isTextInputType() {
|
|
397
|
-
var _inputRef$current, _inputRef$current2;
|
|
398
|
-
|
|
399
|
-
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";
|
|
400
|
-
};
|
|
401
|
-
|
|
167
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
168
|
+
var numberInputContext = (0, _react.useContext)(_NumberInput.NumberInputContext);
|
|
402
169
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
403
|
-
if (
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
var hasSuggestions = function hasSuggestions() {
|
|
407
|
-
return typeof suggestions === "function" || suggestions && suggestions.length > 0;
|
|
170
|
+
if (value < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return translatedLabels.numberInput.valueGreaterThanOrEqualToErrorMessage(numberInputContext.minNumber);else if (value > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return translatedLabels.numberInput.valueLessThanOrEqualToErrorMessage(numberInputContext.maxNumber);
|
|
408
171
|
};
|
|
409
|
-
|
|
410
172
|
var openSuggestions = function openSuggestions() {
|
|
411
|
-
|
|
173
|
+
hasSuggestions(suggestions) && changeIsOpen(true);
|
|
412
174
|
};
|
|
413
|
-
|
|
414
175
|
var closeSuggestions = function closeSuggestions() {
|
|
415
|
-
|
|
416
|
-
|
|
176
|
+
if (hasSuggestions(suggestions)) {
|
|
177
|
+
changeIsOpen(false);
|
|
178
|
+
changeVisualFocusIndex(-1);
|
|
179
|
+
}
|
|
417
180
|
};
|
|
418
|
-
|
|
419
181
|
var changeValue = function changeValue(newValue) {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
if (
|
|
423
|
-
value:
|
|
424
|
-
error:
|
|
425
|
-
});else if (isLengthIncorrect(
|
|
426
|
-
value:
|
|
427
|
-
error:
|
|
428
|
-
});else if (
|
|
429
|
-
value:
|
|
430
|
-
error:
|
|
431
|
-
});else if (
|
|
432
|
-
value:
|
|
433
|
-
error: getNumberErrorMessage(newValue)
|
|
182
|
+
var formattedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
183
|
+
value !== null && value !== void 0 ? value : setInnerValue(formattedValue);
|
|
184
|
+
if (isRequired(formattedValue, optional)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
185
|
+
value: formattedValue,
|
|
186
|
+
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
187
|
+
});else if (isLengthIncorrect(formattedValue, minLength, maxLength)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
188
|
+
value: formattedValue,
|
|
189
|
+
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
190
|
+
});else if (patternMismatch(pattern, formattedValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
191
|
+
value: formattedValue,
|
|
192
|
+
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
193
|
+
});else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && isNumberIncorrect(Number(newValue), numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
194
|
+
value: formattedValue,
|
|
195
|
+
error: getNumberErrorMessage(Number(newValue))
|
|
434
196
|
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
435
|
-
value:
|
|
436
|
-
error: null
|
|
197
|
+
value: formattedValue
|
|
437
198
|
});
|
|
438
199
|
};
|
|
439
|
-
|
|
440
200
|
var handleInputContainerOnClick = function handleInputContainerOnClick() {
|
|
441
201
|
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
442
202
|
};
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
changeValue(event.target.value);
|
|
203
|
+
var handleInputContainerOnMouseDown = function handleInputContainerOnMouseDown(event) {
|
|
204
|
+
// Avoid input to lose the focus when the container is pressed
|
|
205
|
+
document.activeElement === inputRef.current && event.preventDefault();
|
|
447
206
|
};
|
|
448
|
-
|
|
449
|
-
var handleIOnClick = function handleIOnClick() {
|
|
207
|
+
var handleInputOnChange = function handleInputOnChange(event) {
|
|
450
208
|
openSuggestions();
|
|
209
|
+
changeValue(event.target.value);
|
|
451
210
|
};
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
211
|
+
var handleInputOnBlur = function handleInputOnBlur(event) {
|
|
212
|
+
closeSuggestions();
|
|
213
|
+
if (isRequired(event.target.value, optional)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
456
214
|
value: event.target.value,
|
|
457
|
-
error:
|
|
458
|
-
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
215
|
+
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
216
|
+
});else if (isLengthIncorrect(event.target.value, minLength, maxLength)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
459
217
|
value: event.target.value,
|
|
460
|
-
error:
|
|
461
|
-
});else if (
|
|
218
|
+
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
219
|
+
});else if (patternMismatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
462
220
|
value: event.target.value,
|
|
463
|
-
error:
|
|
464
|
-
});else if (
|
|
221
|
+
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
222
|
+
});else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && isNumberIncorrect(Number(event.target.value), numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
465
223
|
value: event.target.value,
|
|
466
|
-
error: getNumberErrorMessage(event.target.value)
|
|
224
|
+
error: getNumberErrorMessage(Number(event.target.value))
|
|
467
225
|
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
468
|
-
value: event.target.value
|
|
469
|
-
error: null
|
|
226
|
+
value: event.target.value
|
|
470
227
|
});
|
|
471
228
|
};
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
switch (event.keyCode) {
|
|
479
|
-
case 40:
|
|
480
|
-
// Arrow Down
|
|
481
|
-
if (numberInputContext) {
|
|
482
|
-
decrementNumber();
|
|
483
|
-
event.preventDefault();
|
|
484
|
-
} else {
|
|
485
|
-
event.preventDefault();
|
|
229
|
+
var handleInputOnKeyDown = function handleInputOnKeyDown(event) {
|
|
230
|
+
switch (event.key) {
|
|
231
|
+
case "Down":
|
|
232
|
+
case "ArrowDown":
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") decrementNumber();else {
|
|
486
235
|
openSuggestions();
|
|
487
|
-
|
|
488
236
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
489
|
-
|
|
237
|
+
changeVisualFocusIndex(function (visualFocusedSuggIndex) {
|
|
490
238
|
if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
|
|
491
239
|
});
|
|
492
240
|
}
|
|
493
241
|
}
|
|
494
|
-
|
|
495
242
|
break;
|
|
496
|
-
|
|
497
|
-
case
|
|
498
|
-
|
|
499
|
-
if (numberInputContext) {
|
|
500
|
-
incrementNumber();
|
|
501
|
-
event.preventDefault();
|
|
502
|
-
} else {
|
|
503
|
-
event.preventDefault();
|
|
243
|
+
case "Up":
|
|
244
|
+
case "ArrowUp":
|
|
245
|
+
event.preventDefault();
|
|
246
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number") incrementNumber();else {
|
|
504
247
|
openSuggestions();
|
|
505
|
-
|
|
506
248
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
507
|
-
|
|
249
|
+
changeVisualFocusIndex(function (visualFocusedSuggIndex) {
|
|
508
250
|
if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
|
|
509
251
|
});
|
|
510
252
|
}
|
|
511
253
|
}
|
|
512
|
-
|
|
513
254
|
break;
|
|
514
|
-
|
|
515
|
-
case
|
|
516
|
-
// Esc
|
|
255
|
+
case "Esc":
|
|
256
|
+
case "Escape":
|
|
517
257
|
event.preventDefault();
|
|
518
|
-
|
|
519
|
-
if (hasSuggestions()) {
|
|
258
|
+
if (hasSuggestions(suggestions)) {
|
|
520
259
|
changeValue("");
|
|
521
260
|
isOpen && closeSuggestions();
|
|
522
261
|
}
|
|
523
|
-
|
|
524
262
|
break;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
|
|
530
|
-
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
|
|
263
|
+
case "Enter":
|
|
264
|
+
if (hasSuggestions(suggestions) && !isSearching) {
|
|
265
|
+
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusIndex >= 0 && visualFocusIndex < filteredSuggestions.length;
|
|
266
|
+
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusIndex]);
|
|
531
267
|
isOpen && closeSuggestions();
|
|
532
268
|
}
|
|
533
|
-
|
|
534
269
|
break;
|
|
535
270
|
}
|
|
536
271
|
};
|
|
537
|
-
|
|
272
|
+
var handleWheel = (0, _react.useCallback)(function (event) {
|
|
273
|
+
if (document.activeElement === inputRef.current) {
|
|
274
|
+
event.preventDefault();
|
|
275
|
+
event.deltaY < 0 ? incrementNumber(inputRef.current.value) : decrementNumber(inputRef.current.value);
|
|
276
|
+
}
|
|
277
|
+
}, []);
|
|
538
278
|
var handleClearActionOnClick = function handleClearActionOnClick() {
|
|
539
279
|
changeValue("");
|
|
540
280
|
inputRef.current.focus();
|
|
541
281
|
suggestions && closeSuggestions();
|
|
542
282
|
};
|
|
543
|
-
|
|
544
283
|
var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
|
|
545
284
|
decrementNumber();
|
|
546
285
|
inputRef.current.focus();
|
|
547
286
|
};
|
|
548
|
-
|
|
549
287
|
var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
|
|
550
288
|
incrementNumber();
|
|
551
289
|
inputRef.current.focus();
|
|
552
290
|
};
|
|
553
|
-
|
|
554
291
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
555
|
-
var _inputRef$
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
|
|
292
|
+
var _inputRef$current, _inputRef$current2, _inputRef$current3, _inputRef$current4;
|
|
293
|
+
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setAttribute("min", min));
|
|
294
|
+
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.setAttribute("max", max));
|
|
295
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("step", step);
|
|
296
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("type", type);
|
|
561
297
|
};
|
|
562
|
-
|
|
563
298
|
var decrementNumber = function decrementNumber() {
|
|
564
|
-
var
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
570
|
-
} 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))) {
|
|
571
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
572
|
-
} 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 !== "") {
|
|
573
|
-
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
574
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
575
|
-
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
576
|
-
} else if (numberValue === "") {
|
|
577
|
-
changeValue(-1);
|
|
299
|
+
var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value !== null && value !== void 0 ? value : innerValue;
|
|
300
|
+
var numberValue = Number(currentValue);
|
|
301
|
+
var steppedValue = Math.round((numberValue - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
302
|
+
if (currentValue !== "") {
|
|
303
|
+
if (numberValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || steppedValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberValue);else if (numberValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else if (numberValue === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else changeValue(steppedValue);
|
|
578
304
|
} else {
|
|
579
|
-
changeValue(
|
|
305
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) >= 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) < 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(-numberInputContext.stepNumber);
|
|
580
306
|
}
|
|
581
307
|
};
|
|
582
|
-
|
|
583
308
|
var incrementNumber = function incrementNumber() {
|
|
584
|
-
var
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
590
|
-
} 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))) {
|
|
591
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
592
|
-
} 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 !== "") {
|
|
593
|
-
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
594
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
595
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
596
|
-
} else if (numberValue === "") {
|
|
597
|
-
changeValue(1);
|
|
309
|
+
var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : value !== null && value !== void 0 ? value : innerValue;
|
|
310
|
+
var numberValue = Number(currentValue);
|
|
311
|
+
var steppedValue = Math.round((numberValue + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
312
|
+
if (currentValue !== "") {
|
|
313
|
+
if (numberValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || steppedValue > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberValue);else if (numberValue < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if (numberValue === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(steppedValue);
|
|
598
314
|
} else {
|
|
599
|
-
changeValue(
|
|
315
|
+
if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) > 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);else if ((numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) <= 0) changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);else changeValue(numberInputContext.stepNumber);
|
|
600
316
|
}
|
|
601
317
|
};
|
|
602
|
-
|
|
603
|
-
(0, _react.useLayoutEffect)(function () {
|
|
604
|
-
var _suggestionsRef$curre, _visualFocusedOptionE;
|
|
605
|
-
|
|
606
|
-
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];
|
|
607
|
-
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
608
|
-
block: "nearest",
|
|
609
|
-
inline: "start"
|
|
610
|
-
});
|
|
611
|
-
}, [visualFocusedSuggIndex]);
|
|
612
318
|
(0, _react.useEffect)(function () {
|
|
613
319
|
if (typeof suggestions === "function") {
|
|
614
320
|
changeIsSearching(true);
|
|
@@ -632,173 +338,162 @@ var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
632
338
|
changeFilteredSuggestions(suggestions.filter(function (suggestion) {
|
|
633
339
|
return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
|
|
634
340
|
}));
|
|
635
|
-
|
|
341
|
+
changeVisualFocusIndex(-1);
|
|
636
342
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
var reducer = function reducer(acc, current) {
|
|
648
|
-
var _current$options;
|
|
649
|
-
|
|
650
|
-
return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
|
|
343
|
+
numberInputContext != null && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
344
|
+
}, [value, innerValue, suggestions, numberInputContext]);
|
|
345
|
+
(0, _react.useEffect)(function () {
|
|
346
|
+
var input = inputRef.current;
|
|
347
|
+
input.addEventListener('wheel', handleWheel, {
|
|
348
|
+
passive: false
|
|
349
|
+
});
|
|
350
|
+
return function () {
|
|
351
|
+
input.removeEventListener('wheel', handleWheel);
|
|
651
352
|
};
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
return last;
|
|
655
|
-
};
|
|
656
|
-
|
|
657
|
-
var lastOptionIndex = (0, _react.useMemo)(function () {
|
|
658
|
-
return getLastOptionIndex();
|
|
659
|
-
}, [filteredSuggestions]);
|
|
660
|
-
|
|
661
|
-
var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
|
|
662
|
-
var suggestion = _ref2.suggestion,
|
|
663
|
-
index = _ref2.index;
|
|
664
|
-
var regEx = new RegExp(value !== null && value !== void 0 ? value : innerValue, "i");
|
|
665
|
-
var matchedWords = suggestion.match(regEx);
|
|
666
|
-
var noMatchedWords = suggestion.replace(regEx, "");
|
|
667
|
-
var isLastOption = index === lastOptionIndex;
|
|
668
|
-
return _react["default"].createElement(Suggestion, {
|
|
669
|
-
id: "suggestion-".concat(index),
|
|
670
|
-
onClick: function onClick() {
|
|
671
|
-
changeValue(suggestion);
|
|
672
|
-
closeSuggestions();
|
|
673
|
-
},
|
|
674
|
-
role: "option",
|
|
675
|
-
"aria-selected": visualFocusedSuggIndex === index && "true",
|
|
676
|
-
visualFocused: visualFocusedSuggIndex === index
|
|
677
|
-
}, _react["default"].createElement(StyledSuggestion, {
|
|
678
|
-
last: isLastOption,
|
|
679
|
-
visualFocused: visualFocusedSuggIndex === index
|
|
680
|
-
}, typeof suggestions === "function" ? suggestion : _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("strong", null, matchedWords), noMatchedWords)));
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
353
|
+
}, [handleWheel]);
|
|
354
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
684
355
|
theme: colorsTheme.textInput
|
|
685
|
-
}, _react["default"].createElement(
|
|
356
|
+
}, /*#__PURE__*/_react["default"].createElement(TextInputContainer, {
|
|
686
357
|
margin: margin,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}, _react["default"].createElement(Label, {
|
|
358
|
+
size: size,
|
|
359
|
+
ref: ref
|
|
360
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
690
361
|
htmlFor: inputId,
|
|
691
362
|
disabled: disabled,
|
|
692
|
-
|
|
693
|
-
}, label, " ", optional && _react["default"].createElement(OptionalLabel, null,
|
|
694
|
-
disabled: disabled
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
363
|
+
hasHelperText: helperText ? true : false
|
|
364
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
365
|
+
disabled: disabled
|
|
366
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
|
|
367
|
+
condition: hasSuggestions(suggestions),
|
|
368
|
+
wrapper: function wrapper(children) {
|
|
369
|
+
return /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
370
|
+
open: isOpen && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError)
|
|
371
|
+
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
372
|
+
asChild: true,
|
|
373
|
+
"aria-controls": undefined
|
|
374
|
+
}, children), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
375
|
+
sideOffset: 5,
|
|
376
|
+
style: {
|
|
377
|
+
zIndex: "2147483647"
|
|
378
|
+
},
|
|
379
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
|
380
|
+
// Avoid select to lose focus when the list is opened
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
},
|
|
383
|
+
onCloseAutoFocus: function onCloseAutoFocus(event) {
|
|
384
|
+
// Avoid select to lose focus when the list is closed
|
|
385
|
+
event.preventDefault();
|
|
386
|
+
}
|
|
387
|
+
}, /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
388
|
+
id: autosuggestId,
|
|
389
|
+
value: value !== null && value !== void 0 ? value : innerValue,
|
|
390
|
+
suggestions: filteredSuggestions,
|
|
391
|
+
visualFocusIndex: visualFocusIndex,
|
|
392
|
+
highlightedSuggestions: typeof suggestions !== "function",
|
|
393
|
+
searchHasErrors: isAutosuggestError,
|
|
394
|
+
isSearching: isSearching,
|
|
395
|
+
suggestionOnClick: function suggestionOnClick(suggestion) {
|
|
396
|
+
changeValue(suggestion);
|
|
397
|
+
closeSuggestions();
|
|
398
|
+
},
|
|
399
|
+
styles: {
|
|
400
|
+
width: width
|
|
401
|
+
}
|
|
402
|
+
}))));
|
|
403
|
+
}
|
|
404
|
+
}, /*#__PURE__*/_react["default"].createElement(InputContainer, {
|
|
405
|
+
error: error ? true : false,
|
|
702
406
|
disabled: disabled,
|
|
703
|
-
|
|
704
|
-
|
|
407
|
+
readOnly: readOnly,
|
|
408
|
+
onClick: handleInputContainerOnClick,
|
|
409
|
+
onMouseDown: handleInputContainerOnMouseDown,
|
|
410
|
+
ref: inputContainerRef
|
|
411
|
+
}, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
|
|
412
|
+
disabled: disabled
|
|
413
|
+
}, prefix), /*#__PURE__*/_react["default"].createElement(Input, {
|
|
705
414
|
id: inputId,
|
|
706
415
|
name: name,
|
|
707
416
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
708
417
|
placeholder: placeholder,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
418
|
+
onBlur: handleInputOnBlur,
|
|
419
|
+
onChange: handleInputOnChange,
|
|
420
|
+
onFocus: !readOnly ? openSuggestions : undefined,
|
|
421
|
+
onKeyDown: !readOnly ? handleInputOnKeyDown : undefined,
|
|
422
|
+
onMouseDown: function onMouseDown(event) {
|
|
423
|
+
event.stopPropagation();
|
|
424
|
+
},
|
|
714
425
|
disabled: disabled,
|
|
426
|
+
readOnly: readOnly,
|
|
715
427
|
ref: inputRef,
|
|
716
|
-
backgroundType: backgroundType,
|
|
717
428
|
pattern: pattern,
|
|
718
|
-
minLength:
|
|
719
|
-
maxLength:
|
|
720
|
-
autoComplete: autocomplete,
|
|
429
|
+
minLength: minLength,
|
|
430
|
+
maxLength: maxLength,
|
|
431
|
+
autoComplete: autocomplete === "off" ? "nope" : autocomplete,
|
|
721
432
|
tabIndex: tabIndex,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
"aria-
|
|
725
|
-
"aria-
|
|
726
|
-
"aria-
|
|
727
|
-
"aria-
|
|
728
|
-
"aria-
|
|
729
|
-
"aria-
|
|
730
|
-
|
|
731
|
-
|
|
433
|
+
type: "text",
|
|
434
|
+
role: hasSuggestions(suggestions) ? "combobox" : undefined,
|
|
435
|
+
"aria-autocomplete": hasSuggestions(suggestions) ? "list" : undefined,
|
|
436
|
+
"aria-controls": hasSuggestions(suggestions) ? autosuggestId : undefined,
|
|
437
|
+
"aria-expanded": hasSuggestions(suggestions) ? isOpen : undefined,
|
|
438
|
+
"aria-haspopup": hasSuggestions(suggestions) ? "listbox" : undefined,
|
|
439
|
+
"aria-activedescendant": hasSuggestions(suggestions) && isOpen && visualFocusIndex !== -1 ? "suggestion-".concat(visualFocusIndex) : undefined,
|
|
440
|
+
"aria-invalid": error ? true : false,
|
|
441
|
+
"aria-errormessage": error ? errorId : undefined,
|
|
442
|
+
"aria-required": !disabled && !optional
|
|
443
|
+
}), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
732
444
|
"aria-label": "Error"
|
|
733
|
-
},
|
|
445
|
+
}, _Icons["default"].error), !disabled && !readOnly && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
446
|
+
"aria-label": translatedLabels.textInput.clearFieldActionTitle,
|
|
734
447
|
onClick: handleClearActionOnClick,
|
|
735
|
-
|
|
448
|
+
onMouseDown: function onMouseDown(event) {
|
|
449
|
+
event.stopPropagation();
|
|
450
|
+
},
|
|
736
451
|
tabIndex: tabIndex,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
452
|
+
title: translatedLabels.textInput.clearFieldActionTitle,
|
|
453
|
+
type: "button"
|
|
454
|
+
}, _Icons["default"].clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Action, {
|
|
455
|
+
"aria-label": translatedLabels.numberInput.decrementValueTitle,
|
|
740
456
|
disabled: disabled,
|
|
741
|
-
onClick: handleDecrementActionOnClick,
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}, textInputIcons.decrement), _react["default"].createElement(Action, {
|
|
457
|
+
onClick: !readOnly ? handleDecrementActionOnClick : undefined,
|
|
458
|
+
onMouseDown: function onMouseDown(event) {
|
|
459
|
+
event.stopPropagation();
|
|
460
|
+
},
|
|
746
461
|
ref: actionRef,
|
|
747
|
-
disabled: disabled,
|
|
748
|
-
onClick: handleIncrementActionOnClick,
|
|
749
|
-
backgroundType: backgroundType,
|
|
750
462
|
tabIndex: tabIndex,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
463
|
+
title: translatedLabels.numberInput.decrementValueTitle,
|
|
464
|
+
type: "button"
|
|
465
|
+
}, _Icons["default"].decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
466
|
+
"aria-label": translatedLabels.numberInput.incrementValueTitle,
|
|
754
467
|
disabled: disabled,
|
|
755
|
-
onClick:
|
|
756
|
-
title: (_action$title = action.title) !== null && _action$title !== void 0 ? _action$title : action.title,
|
|
757
|
-
backgroundType: backgroundType,
|
|
758
|
-
tabIndex: tabIndex
|
|
759
|
-
}, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
|
|
760
|
-
src: action.icon
|
|
761
|
-
}) : action.icon), suffix && _react["default"].createElement(Suffix, {
|
|
762
|
-
disabled: disabled,
|
|
763
|
-
backgroundType: backgroundType
|
|
764
|
-
}, suffix), isOpen && _react["default"].createElement(Suggestions, {
|
|
765
|
-
id: autosuggestId,
|
|
766
|
-
isError: isAutosuggestError,
|
|
468
|
+
onClick: !readOnly ? handleIncrementActionOnClick : undefined,
|
|
767
469
|
onMouseDown: function onMouseDown(event) {
|
|
768
|
-
event.
|
|
470
|
+
event.stopPropagation();
|
|
769
471
|
},
|
|
770
|
-
|
|
771
|
-
|
|
472
|
+
ref: actionRef,
|
|
473
|
+
tabIndex: tabIndex,
|
|
474
|
+
title: translatedLabels.numberInput.incrementValueTitle,
|
|
475
|
+
type: "button"
|
|
476
|
+
}, _Icons["default"].increment)), action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
477
|
+
"aria-label": action.title,
|
|
478
|
+
disabled: disabled,
|
|
479
|
+
onClick: !readOnly ? action.onClick : undefined,
|
|
480
|
+
onMouseDown: function onMouseDown(event) {
|
|
481
|
+
event.stopPropagation();
|
|
772
482
|
},
|
|
773
|
-
ref:
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(SuggestionsErrorIcon, {
|
|
783
|
-
backgroundType: backgroundType
|
|
784
|
-
}, textInputIcons.error), "Error fetching data"))), !disabled && _react["default"].createElement(Error, {
|
|
483
|
+
ref: actionRef,
|
|
484
|
+
tabIndex: tabIndex,
|
|
485
|
+
title: action.title,
|
|
486
|
+
type: "button"
|
|
487
|
+
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
488
|
+
src: action.icon
|
|
489
|
+
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
490
|
+
disabled: disabled
|
|
491
|
+
}, suffix))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
785
492
|
id: errorId,
|
|
786
|
-
|
|
493
|
+
"aria-live": error ? "assertive" : "off"
|
|
787
494
|
}, error)));
|
|
788
495
|
});
|
|
789
|
-
|
|
790
|
-
var sizes = {
|
|
791
|
-
small: "240px",
|
|
792
|
-
medium: "360px",
|
|
793
|
-
large: "480px",
|
|
794
|
-
fillParent: "100%"
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
798
|
-
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
799
|
-
};
|
|
800
|
-
|
|
801
|
-
var DxcInput = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
496
|
+
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
802
497
|
return calculateWidth(props.margin, props.size);
|
|
803
498
|
}, function (props) {
|
|
804
499
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -811,9 +506,8 @@ var DxcInput = _styledComponents["default"].div(_templateObject(), function (pro
|
|
|
811
506
|
}, function (props) {
|
|
812
507
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
813
508
|
});
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
509
|
+
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) {
|
|
510
|
+
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
817
511
|
}, function (props) {
|
|
818
512
|
return props.theme.fontFamily;
|
|
819
513
|
}, function (props) {
|
|
@@ -824,14 +518,14 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
|
|
|
824
518
|
return props.theme.labelFontWeight;
|
|
825
519
|
}, function (props) {
|
|
826
520
|
return props.theme.labelLineHeight;
|
|
521
|
+
}, function (props) {
|
|
522
|
+
return !props.hasHelperText && "margin-bottom: 0.25rem";
|
|
827
523
|
});
|
|
828
|
-
|
|
829
|
-
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
524
|
+
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
830
525
|
return props.theme.optionalLabelFontWeight;
|
|
831
526
|
});
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
527
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
528
|
+
return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
|
|
835
529
|
}, function (props) {
|
|
836
530
|
return props.theme.fontFamily;
|
|
837
531
|
}, function (props) {
|
|
@@ -843,21 +537,17 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
|
|
|
843
537
|
}, function (props) {
|
|
844
538
|
return props.theme.helperTextLineHeight;
|
|
845
539
|
});
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
540
|
+
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: flex;\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"])), function (props) {
|
|
541
|
+
if (props.disabled) return "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
849
542
|
}, function (props) {
|
|
850
|
-
if (props.disabled) return props.
|
|
543
|
+
if (props.disabled) return props.theme.disabledBorderColor;else if (props.readOnly) return props.theme.readOnlyBorderColor;else return props.theme.enabledBorderColor;
|
|
851
544
|
}, function (props) {
|
|
852
|
-
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.
|
|
545
|
+
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorBorderColor, ";\n ");
|
|
853
546
|
}, function (props) {
|
|
854
|
-
return props.disabled
|
|
855
|
-
}, function (props) {
|
|
856
|
-
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 ");
|
|
547
|
+
return !props.disabled ? "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.theme.hoverBorderColor, ";\n ").concat(props.error ? "box-shadow: 0 0 0 2px ".concat(props.theme.hoverErrorBorderColor, ";") : "", "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusBorderColor, ";\n }\n ") : "cursor: not-allowed;";
|
|
857
548
|
});
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
|
|
549
|
+
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) {
|
|
550
|
+
return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
|
|
861
551
|
}, function (props) {
|
|
862
552
|
return props.theme.fontFamily;
|
|
863
553
|
}, function (props) {
|
|
@@ -869,122 +559,35 @@ var Input = _styledComponents["default"].input(_templateObject6(), function (pro
|
|
|
869
559
|
}, function (props) {
|
|
870
560
|
return props.disabled && "cursor: not-allowed;";
|
|
871
561
|
}, function (props) {
|
|
872
|
-
return props.disabled ? props.
|
|
562
|
+
return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
|
|
873
563
|
});
|
|
874
|
-
|
|
875
|
-
var ActionIcon = _styledComponents["default"].img(_templateObject7());
|
|
876
|
-
|
|
877
|
-
var Action = _styledComponents["default"].button(_templateObject8(), function (props) {
|
|
878
|
-
return props.theme.fontFamily;
|
|
879
|
-
}, function (props) {
|
|
564
|
+
var Action = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n border: 1px solid transparent;\n border-radius: 2px;\n width: 24px;\n height: 24px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n \n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n color: ", ";\n\n ", "\n\n img, svg {\n width: 16px;\n height: 16px;\n }\n"])), function (props) {
|
|
880
565
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
881
566
|
}, function (props) {
|
|
882
|
-
return props.disabled ? props.
|
|
567
|
+
return props.disabled ? props.theme.disabledActionBackgroundColor : props.theme.actionBackgroundColor;
|
|
883
568
|
}, function (props) {
|
|
884
|
-
return props.disabled ? props.
|
|
569
|
+
return props.disabled ? props.theme.disabledActionIconColor : props.theme.actionIconColor;
|
|
885
570
|
}, function (props) {
|
|
886
|
-
return !props.disabled && "\n &:focus
|
|
571
|
+
return !props.disabled && "\n &:focus, \n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.theme.focusActionBorderColor, ";\n color: ").concat(props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.theme.activeActionIconColor, ";\n }\n ");
|
|
887
572
|
});
|
|
888
|
-
|
|
889
|
-
var
|
|
890
|
-
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
|
|
573
|
+
var Prefix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
574
|
+
var color = props.disabled ? props.theme.disabledPrefixColor : props.theme.prefixColor;
|
|
891
575
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
892
576
|
}, function (props) {
|
|
893
577
|
return props.theme.fontFamily;
|
|
894
578
|
});
|
|
895
|
-
|
|
896
|
-
var
|
|
897
|
-
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
|
|
579
|
+
var Suffix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
580
|
+
var color = props.disabled ? props.theme.disabledSuffixColor : props.theme.suffixColor;
|
|
898
581
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
899
582
|
}, function (props) {
|
|
900
583
|
return props.theme.fontFamily;
|
|
901
584
|
});
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
585
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
|
|
586
|
+
return props.theme.errorIconColor;
|
|
905
587
|
});
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
588
|
+
var Error = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
589
|
+
return props.theme.errorMessageColor;
|
|
909
590
|
}, function (props) {
|
|
910
591
|
return props.theme.fontFamily;
|
|
911
592
|
});
|
|
912
|
-
|
|
913
|
-
var Suggestions = _styledComponents["default"].ul(_templateObject13(), function (props) {
|
|
914
|
-
return props.isError ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
|
|
915
|
-
}, function (props) {
|
|
916
|
-
return props.isError ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
|
|
917
|
-
}, function (props) {
|
|
918
|
-
return props.theme.listOptionFontColor;
|
|
919
|
-
}, function (props) {
|
|
920
|
-
return props.theme.fontFamily;
|
|
921
|
-
}, function (props) {
|
|
922
|
-
return props.theme.listOptionFontSize;
|
|
923
|
-
}, function (props) {
|
|
924
|
-
return props.theme.listOptionFontStyle;
|
|
925
|
-
}, function (props) {
|
|
926
|
-
return props.theme.listOptionFontWeight;
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
var Suggestion = _styledComponents["default"].li(_templateObject14(), function (props) {
|
|
930
|
-
return props.visualFocused ? props.theme.focusListOptionBorderColor : "transparent";
|
|
931
|
-
}, function (props) {
|
|
932
|
-
return props.theme.hoverListOptionBackgroundColor;
|
|
933
|
-
}, function (props) {
|
|
934
|
-
return props.theme.activeListOptionBackgroundColor;
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
var StyledSuggestion = _styledComponents["default"].span(_templateObject15(), function (props) {
|
|
938
|
-
return props.last || props.visualFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
939
|
-
});
|
|
940
|
-
|
|
941
|
-
var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject16(), function (props) {
|
|
942
|
-
return props.theme.systemMessageFontColor;
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject17(), function (props) {
|
|
946
|
-
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
947
|
-
});
|
|
948
|
-
|
|
949
|
-
var SuggestionsError = _styledComponents["default"].span(_templateObject18(), function (props) {
|
|
950
|
-
return props.theme.errorListDialogFontColor;
|
|
951
|
-
});
|
|
952
|
-
|
|
953
|
-
DxcTextInput.propTypes = {
|
|
954
|
-
label: _propTypes["default"].string,
|
|
955
|
-
name: _propTypes["default"].string,
|
|
956
|
-
value: _propTypes["default"].string,
|
|
957
|
-
helperText: _propTypes["default"].string,
|
|
958
|
-
placeholder: _propTypes["default"].string,
|
|
959
|
-
action: _propTypes["default"].shape({
|
|
960
|
-
onClick: _propTypes["default"].func.isRequired,
|
|
961
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
962
|
-
type: _propTypes["default"].oneOf(["svg"])
|
|
963
|
-
}), _propTypes["default"].string]).isRequired
|
|
964
|
-
}),
|
|
965
|
-
clearable: _propTypes["default"].bool,
|
|
966
|
-
disabled: _propTypes["default"].bool,
|
|
967
|
-
optional: _propTypes["default"].bool,
|
|
968
|
-
prefix: _propTypes["default"].string,
|
|
969
|
-
suffix: _propTypes["default"].string,
|
|
970
|
-
onChange: _propTypes["default"].func,
|
|
971
|
-
onBlur: _propTypes["default"].func,
|
|
972
|
-
error: _propTypes["default"].string,
|
|
973
|
-
autocomplete: _propTypes["default"].string,
|
|
974
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
975
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
976
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
977
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
978
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
979
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
980
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
981
|
-
suggestions: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].array]),
|
|
982
|
-
pattern: _propTypes["default"].string,
|
|
983
|
-
length: _propTypes["default"].shape({
|
|
984
|
-
min: _propTypes["default"].number,
|
|
985
|
-
max: _propTypes["default"].number
|
|
986
|
-
}),
|
|
987
|
-
tabIndex: _propTypes["default"].number
|
|
988
|
-
};
|
|
989
|
-
var _default = DxcTextInput;
|
|
990
|
-
exports["default"] = _default;
|
|
593
|
+
var _default = exports["default"] = DxcTextInput;
|