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