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