@dxc-technology/halstack-react 0.0.0-c9c1158 → 0.0.0-c9efd3e
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 -10
- package/BackgroundColorContext.js +2 -7
- package/HalstackContext.d.ts +29 -133
- package/HalstackContext.js +1 -1
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +10 -26
- package/accordion/Accordion.stories.tsx +4 -36
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +3 -3
- package/accordion-group/AccordionGroupAccordion.js +2 -2
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +1 -1
- 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/action-icon/types.js +5 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +15 -72
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -28
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.js +1 -4
- package/bulleted-list/BulletedList.accessibility.test.js +107 -0
- package/bulleted-list/BulletedList.js +15 -22
- package/bulleted-list/BulletedList.stories.tsx +1 -2
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +15 -15
- package/button/Button.stories.tsx +32 -51
- package/button/Button.test.js +3 -1
- package/button/types.d.ts +1 -1
- package/card/Card.accessibility.test.js +36 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.js +26 -31
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +8 -5
- package/chip/Chip.stories.tsx +5 -24
- package/chip/Chip.test.js +4 -4
- package/common/coreTokens.d.ts +1 -1
- package/common/coreTokens.js +3 -3
- package/common/variables.d.ts +29 -133
- package/common/variables.js +38 -142
- package/container/Container.js +3 -7
- package/container/Container.stories.tsx +10 -25
- package/contextual-menu/ContextualMenu.accessibility.test.js +86 -0
- package/contextual-menu/ContextualMenu.d.ts +7 -0
- package/contextual-menu/ContextualMenu.js +71 -0
- package/contextual-menu/ContextualMenu.stories.tsx +182 -0
- package/contextual-menu/ContextualMenu.test.js +71 -0
- package/contextual-menu/MenuItemAction.d.ts +4 -0
- package/contextual-menu/MenuItemAction.js +46 -0
- package/contextual-menu/types.d.ts +22 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/DateInput.accessibility.test.js +216 -0
- package/date-input/types.d.ts +2 -2
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.js +2 -5
- package/dialog/Dialog.stories.tsx +170 -0
- package/dialog/Dialog.test.js +1 -1
- 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.js +21 -36
- package/dropdown/Dropdown.stories.tsx +5 -16
- package/dropdown/DropdownMenuItem.js +6 -3
- package/dropdown/types.d.ts +3 -5
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.js +3 -39
- package/file-input/FileInput.test.js +7 -84
- package/file-input/FileItem.js +13 -27
- package/footer/Footer.accessibility.test.js +117 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +36 -31
- package/footer/Footer.stories.tsx +46 -2
- package/footer/Icons.d.ts +1 -0
- package/footer/Icons.js +65 -1
- package/footer/types.d.ts +8 -8
- package/header/Header.accessibility.test.js +84 -0
- package/header/Header.js +18 -40
- package/header/types.d.ts +4 -3
- package/heading/Heading.accessibility.test.js +33 -0
- 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.stories.tsx +3 -1
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +1 -1
- package/layout/Icons.js +0 -2
- package/link/Link.accessibility.test.js +112 -0
- package/link/Link.js +7 -5
- package/link/Link.stories.tsx +2 -2
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -3
- package/main.js +22 -8
- package/nav-tabs/NavTabs.accessibility.test.js +52 -0
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +9 -6
- package/nav-tabs/NavTabs.stories.tsx +6 -4
- package/nav-tabs/NavTabs.test.js +3 -2
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +8 -7
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +24 -5
- package/number-input/NumberInput.test.js +165 -6
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +6 -0
- package/package.json +12 -12
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +1 -4
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.js +2 -7
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.stories.tsx +0 -1
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +5 -11
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +1 -1
- package/resultset-table/ResultsetTable.accessibility.test.js +274 -0
- package/resultset-table/ResultsetTable.d.ts +4 -1
- package/resultset-table/ResultsetTable.js +23 -12
- package/resultset-table/ResultsetTable.stories.tsx +106 -5
- package/resultset-table/ResultsetTable.test.js +76 -0
- package/resultset-table/types.d.ts +40 -7
- package/select/Option.js +8 -1
- package/select/Select.accessibility.test.js +217 -0
- package/select/Select.js +35 -27
- package/select/Select.stories.tsx +0 -1
- package/select/Select.test.js +498 -462
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +20 -18
- package/sidenav/Sidenav.stories.tsx +4 -9
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.js +37 -46
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +6 -14
- 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.js +23 -28
- 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 +73 -11
- package/table/Table.stories.tsx +297 -2
- package/table/Table.test.js +92 -0
- package/table/types.d.ts +28 -0
- package/tabs/Tab.js +7 -4
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +4 -5
- package/tabs/Tabs.stories.tsx +1 -1
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +6 -6
- package/tag/Tag.stories.tsx +4 -7
- package/tag/Tag.test.js +4 -12
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestions.js +7 -10
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +77 -102
- package/text-input/TextInput.stories.tsx +1 -1
- package/text-input/TextInput.test.js +96 -79
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +10 -16
- package/textarea/Textarea.stories.tsx +0 -1
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +1 -4
- package/typography/Typography.accessibility.test.js +339 -0
- package/useTheme.d.ts +29 -133
- package/utils/FocusLock.js +15 -5
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/types.d.ts +1 -1
- package/common/OpenSans.css +0 -69
- 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/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -56
- /package/{layout → sidenav}/SidenavContext.d.ts +0 -0
- /package/{layout → sidenav}/SidenavContext.js +0 -0
package/text-input/TextInput.js
CHANGED
|
@@ -15,13 +15,14 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
15
15
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
16
16
|
var _variables = require("../common/variables");
|
|
17
17
|
var _utils = require("../common/utils");
|
|
18
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
19
|
-
var _NumberInput = require("../number-input/NumberInput");
|
|
20
18
|
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
|
21
19
|
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
22
|
-
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
23
20
|
var _uuid = require("uuid");
|
|
24
|
-
var
|
|
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;
|
|
25
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); }
|
|
26
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; }
|
|
27
28
|
var sizes = {
|
|
@@ -166,8 +167,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
166
167
|
var width = useWidth(inputContainerRef.current);
|
|
167
168
|
var colorsTheme = (0, _useTheme["default"])();
|
|
168
169
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
169
|
-
var
|
|
170
|
-
var numberInputContext = (0, _react.useContext)(_NumberInput.NumberInputContext);
|
|
170
|
+
var numberInputContext = (0, _react.useContext)(_NumberInputContext.NumberInputContext);
|
|
171
171
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
172
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);
|
|
173
173
|
};
|
|
@@ -199,6 +199,30 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
199
199
|
value: formattedValue
|
|
200
200
|
});
|
|
201
201
|
};
|
|
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
|
+
};
|
|
202
226
|
var handleInputContainerOnClick = function handleInputContainerOnClick() {
|
|
203
227
|
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
204
228
|
};
|
|
@@ -271,6 +295,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
271
295
|
break;
|
|
272
296
|
}
|
|
273
297
|
};
|
|
298
|
+
var handleNumberInputWheel = function handleNumberInputWheel(event) {
|
|
299
|
+
if (document.activeElement === inputRef.current) event.deltaY < 0 ? incrementNumber(inputRef.current.value) : decrementNumber(inputRef.current.value);
|
|
300
|
+
};
|
|
274
301
|
var handleClearActionOnClick = function handleClearActionOnClick() {
|
|
275
302
|
changeValue("");
|
|
276
303
|
inputRef.current.focus();
|
|
@@ -291,26 +318,6 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
291
318
|
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("step", step);
|
|
292
319
|
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("type", type);
|
|
293
320
|
};
|
|
294
|
-
var decrementNumber = function decrementNumber() {
|
|
295
|
-
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
296
|
-
var numberValue = Number(currentValue);
|
|
297
|
-
var steppedValue = Math.round((numberValue - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
298
|
-
if (currentValue !== "") {
|
|
299
|
-
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);
|
|
300
|
-
} else {
|
|
301
|
-
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);
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
var incrementNumber = function incrementNumber() {
|
|
305
|
-
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
306
|
-
var numberValue = Number(currentValue);
|
|
307
|
-
var steppedValue = Math.round((numberValue + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) + Number.EPSILON) * 100) / 100;
|
|
308
|
-
if (currentValue !== "") {
|
|
309
|
-
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);
|
|
310
|
-
} else {
|
|
311
|
-
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);
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
321
|
(0, _react.useEffect)(function () {
|
|
315
322
|
if (typeof suggestions === "function") {
|
|
316
323
|
changeIsSearching(true);
|
|
@@ -347,11 +354,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
347
354
|
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
348
355
|
htmlFor: inputId,
|
|
349
356
|
disabled: disabled,
|
|
350
|
-
backgroundType: backgroundType,
|
|
351
357
|
hasHelperText: helperText ? true : false
|
|
352
358
|
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
353
|
-
disabled: disabled
|
|
354
|
-
backgroundType: backgroundType
|
|
359
|
+
disabled: disabled
|
|
355
360
|
}, helperText), /*#__PURE__*/_react["default"].createElement(AutosuggestWrapper, {
|
|
356
361
|
condition: hasSuggestions(suggestions),
|
|
357
362
|
wrapper: function wrapper(children) {
|
|
@@ -394,14 +399,16 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
394
399
|
error: error ? true : false,
|
|
395
400
|
disabled: disabled,
|
|
396
401
|
readOnly: readOnly,
|
|
397
|
-
backgroundType: backgroundType,
|
|
398
402
|
onClick: handleInputContainerOnClick,
|
|
399
403
|
onMouseDown: handleInputContainerOnMouseDown,
|
|
400
404
|
ref: inputContainerRef
|
|
401
405
|
}, prefix && /*#__PURE__*/_react["default"].createElement(Prefix, {
|
|
402
|
-
disabled: disabled
|
|
403
|
-
|
|
404
|
-
|
|
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, {
|
|
405
412
|
id: inputId,
|
|
406
413
|
name: name,
|
|
407
414
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
@@ -413,10 +420,10 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
413
420
|
onMouseDown: function onMouseDown(event) {
|
|
414
421
|
event.stopPropagation();
|
|
415
422
|
},
|
|
423
|
+
onWheel: (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? handleNumberInputWheel : undefined,
|
|
416
424
|
disabled: disabled,
|
|
417
425
|
readOnly: readOnly,
|
|
418
426
|
ref: inputRef,
|
|
419
|
-
backgroundType: backgroundType,
|
|
420
427
|
pattern: pattern,
|
|
421
428
|
minLength: minLength,
|
|
422
429
|
maxLength: maxLength,
|
|
@@ -433,62 +440,39 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
433
440
|
"aria-errormessage": error ? errorId : undefined,
|
|
434
441
|
"aria-required": !disabled && !optional
|
|
435
442
|
}), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
436
|
-
backgroundType: backgroundType,
|
|
437
443
|
"aria-label": "Error"
|
|
438
|
-
},
|
|
439
|
-
"
|
|
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"], {
|
|
440
447
|
onClick: handleClearActionOnClick,
|
|
441
|
-
|
|
442
|
-
event.stopPropagation();
|
|
443
|
-
},
|
|
448
|
+
icon: "close",
|
|
444
449
|
tabIndex: tabIndex,
|
|
445
|
-
title: translatedLabels.textInput.clearFieldActionTitle
|
|
446
|
-
|
|
447
|
-
backgroundType: backgroundType
|
|
448
|
-
}, _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, {
|
|
449
|
-
"aria-label": translatedLabels.numberInput.decrementValueTitle,
|
|
450
|
-
disabled: disabled,
|
|
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"], {
|
|
451
452
|
onClick: !readOnly ? handleDecrementActionOnClick : undefined,
|
|
452
|
-
|
|
453
|
-
event.stopPropagation();
|
|
454
|
-
},
|
|
455
|
-
ref: actionRef,
|
|
453
|
+
icon: "remove",
|
|
456
454
|
tabIndex: tabIndex,
|
|
455
|
+
ref: actionRef,
|
|
457
456
|
title: translatedLabels.numberInput.decrementValueTitle,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}, _Icons["default"].decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
461
|
-
"aria-label": translatedLabels.numberInput.incrementValueTitle,
|
|
462
|
-
disabled: disabled,
|
|
457
|
+
disabled: disabled
|
|
458
|
+
}), /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
463
459
|
onClick: !readOnly ? handleIncrementActionOnClick : undefined,
|
|
464
|
-
|
|
465
|
-
event.stopPropagation();
|
|
466
|
-
},
|
|
467
|
-
ref: actionRef,
|
|
460
|
+
icon: "add",
|
|
468
461
|
tabIndex: tabIndex,
|
|
462
|
+
ref: actionRef,
|
|
469
463
|
title: translatedLabels.numberInput.incrementValueTitle,
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}, _Icons["default"].increment)), action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
473
|
-
"aria-label": action.title,
|
|
474
|
-
disabled: disabled,
|
|
464
|
+
disabled: disabled
|
|
465
|
+
})), action && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
475
466
|
onClick: !readOnly ? action.onClick : undefined,
|
|
476
|
-
|
|
477
|
-
event.stopPropagation();
|
|
478
|
-
},
|
|
479
|
-
ref: actionRef,
|
|
467
|
+
icon: action.icon,
|
|
480
468
|
tabIndex: tabIndex,
|
|
469
|
+
ref: actionRef,
|
|
481
470
|
title: action.title,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
src: action.icon
|
|
486
|
-
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
487
|
-
disabled: disabled,
|
|
488
|
-
backgroundType: backgroundType
|
|
471
|
+
disabled: disabled
|
|
472
|
+
})), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
473
|
+
disabled: disabled
|
|
489
474
|
}, suffix))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
490
475
|
id: errorId,
|
|
491
|
-
backgroundType: backgroundType,
|
|
492
476
|
"aria-live": error ? "assertive" : "off"
|
|
493
477
|
}, error)));
|
|
494
478
|
});
|
|
@@ -506,7 +490,7 @@ var TextInputContainer = _styledComponents["default"].div(_templateObject || (_t
|
|
|
506
490
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
507
491
|
});
|
|
508
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) {
|
|
509
|
-
return props.disabled ? props.
|
|
493
|
+
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
510
494
|
}, function (props) {
|
|
511
495
|
return props.theme.fontFamily;
|
|
512
496
|
}, function (props) {
|
|
@@ -523,8 +507,8 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
|
|
|
523
507
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
524
508
|
return props.theme.optionalLabelFontWeight;
|
|
525
509
|
});
|
|
526
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n
|
|
527
|
-
return props.disabled ? props.
|
|
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;
|
|
528
512
|
}, function (props) {
|
|
529
513
|
return props.theme.fontFamily;
|
|
530
514
|
}, function (props) {
|
|
@@ -537,16 +521,16 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
537
521
|
return props.theme.helperTextLineHeight;
|
|
538
522
|
});
|
|
539
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) {
|
|
540
|
-
if (props.disabled) return
|
|
524
|
+
if (props.disabled) return "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
541
525
|
}, function (props) {
|
|
542
|
-
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;
|
|
543
527
|
}, function (props) {
|
|
544
|
-
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 ");
|
|
545
529
|
}, function (props) {
|
|
546
|
-
return !props.disabled ? "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.readOnly ? props.theme.hoverReadOnlyBorderColor : props.
|
|
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;";
|
|
547
531
|
});
|
|
548
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) {
|
|
549
|
-
return props.disabled ? props.
|
|
533
|
+
return props.disabled ? props.theme.disabledValueFontColor : props.theme.valueFontColor;
|
|
550
534
|
}, function (props) {
|
|
551
535
|
return props.theme.fontFamily;
|
|
552
536
|
}, function (props) {
|
|
@@ -558,34 +542,25 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
|
|
|
558
542
|
}, function (props) {
|
|
559
543
|
return props.disabled && "cursor: not-allowed;";
|
|
560
544
|
}, function (props) {
|
|
561
|
-
return props.disabled ? props.
|
|
562
|
-
});
|
|
563
|
-
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) {
|
|
564
|
-
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
565
|
-
}, function (props) {
|
|
566
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
|
|
567
|
-
}, function (props) {
|
|
568
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
569
|
-
}, function (props) {
|
|
570
|
-
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 ");
|
|
545
|
+
return props.disabled ? props.theme.disabledPlaceholderFontColor : props.theme.placeholderFontColor;
|
|
571
546
|
});
|
|
572
|
-
var Prefix = _styledComponents["default"].span(
|
|
573
|
-
var color = props.disabled ? props.
|
|
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;
|
|
574
549
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
575
550
|
}, function (props) {
|
|
576
551
|
return props.theme.fontFamily;
|
|
577
552
|
});
|
|
578
|
-
var Suffix = _styledComponents["default"].span(
|
|
579
|
-
var color = props.disabled ? props.
|
|
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;
|
|
580
555
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
581
556
|
}, function (props) {
|
|
582
557
|
return props.theme.fontFamily;
|
|
583
558
|
});
|
|
584
|
-
var ErrorIcon = _styledComponents["default"].span(
|
|
585
|
-
return props.
|
|
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;
|
|
586
561
|
});
|
|
587
|
-
var Error = _styledComponents["default"].span(
|
|
588
|
-
return props.
|
|
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;
|
|
589
564
|
}, function (props) {
|
|
590
565
|
return props.theme.fontFamily;
|
|
591
566
|
});
|