@dxc-technology/halstack-react 0.0.0-e1c85bf → 0.0.0-e3e5511
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/{dist/BackgroundColorContext.js → BackgroundColorContext.js} +0 -0
- package/{dist/ThemeContext.js → ThemeContext.js} +44 -42
- package/{dist/select/Select.js → V3Select/V3Select.js} +5 -5
- package/V3Select/index.d.ts +27 -0
- package/{dist/textarea/Textarea.js → V3Textarea/V3Textarea.js} +4 -4
- package/V3Textarea/index.d.ts +27 -0
- package/{dist/accordion → accordion}/Accordion.js +0 -0
- package/accordion/index.d.ts +28 -0
- package/{dist/accordion-group → accordion-group}/AccordionGroup.js +0 -0
- package/accordion-group/index.d.ts +16 -0
- package/{dist/alert → alert}/Alert.js +5 -5
- package/{dist/alert → alert}/index.d.ts +0 -0
- package/{dist/badge → badge}/Badge.js +0 -0
- package/{dist/box → box}/Box.js +0 -0
- package/box/index.d.ts +25 -0
- package/{dist/button → button}/Button.js +3 -3
- package/button/Button.stories.js +27 -0
- package/button/index.d.ts +24 -0
- package/{dist/card → card}/Card.js +0 -0
- package/card/index.d.ts +22 -0
- package/{dist/checkbox → checkbox}/Checkbox.js +4 -5
- package/checkbox/index.d.ts +24 -0
- package/{dist/chip → chip}/Chip.js +0 -0
- package/chip/index.d.ts +22 -0
- package/{dist/common → common}/OpenSans.css +0 -0
- package/{dist/common → common}/RequiredComponent.js +0 -0
- package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/{dist/common → common}/utils.js +0 -0
- package/{dist/common → common}/variables.js +223 -90
- package/{dist/date → date}/Date.js +0 -0
- package/date/index.d.ts +27 -0
- package/{dist/new-date/NewDate.js → date-input/DateInput.js} +36 -36
- package/{dist/new-date → date-input}/index.d.ts +3 -3
- package/{dist/dialog → dialog}/Dialog.js +0 -0
- package/dialog/index.d.ts +18 -0
- package/{dist/dropdown → dropdown}/Dropdown.js +0 -0
- package/dropdown/index.d.ts +26 -0
- package/{dist/file-input → file-input}/FileInput.js +6 -3
- package/{dist/file-input → file-input}/FileItem.js +26 -4
- package/{dist/file-input → file-input}/index.d.ts +1 -1
- package/{dist/footer → footer}/Footer.js +44 -18
- package/footer/Icons.js +77 -0
- package/footer/index.d.ts +25 -0
- package/{dist/header → header}/Header.js +122 -55
- package/header/Icons.js +59 -0
- package/header/index.d.ts +25 -0
- package/{dist/heading → heading}/Heading.js +12 -0
- package/heading/index.d.ts +17 -0
- package/input-text/Icons.js +22 -0
- package/{dist/input-text → input-text}/InputText.js +4 -6
- package/input-text/index.d.ts +36 -0
- package/{dist/layout → layout}/ApplicationLayout.js +4 -8
- package/layout/Icons.js +55 -0
- package/{dist/link → link}/Link.js +0 -0
- package/link/index.d.ts +23 -0
- package/main.d.ts +40 -0
- package/{dist/main.js → main.js} +30 -30
- package/{dist/number/Number.js → number-input/NumberInput.js} +9 -11
- package/{dist/number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
- package/{dist/number → number-input}/index.d.ts +3 -3
- package/package.json +21 -17
- package/paginator/Icons.js +66 -0
- package/{dist/paginator → paginator}/Paginator.js +53 -37
- package/paginator/index.d.ts +20 -0
- package/{dist/password/Password.js → password-input/PasswordInput.js} +14 -11
- package/{dist/password → password-input}/index.d.ts +5 -5
- package/{dist/progress-bar → progress-bar}/ProgressBar.js +0 -0
- package/progress-bar/index.d.ts +18 -0
- package/{dist/radio → radio}/Radio.js +0 -0
- package/radio/index.d.ts +23 -0
- package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +0 -0
- package/resultsetTable/index.d.ts +19 -0
- package/select/Select.js +1137 -0
- package/select/index.d.ts +131 -0
- package/{dist/sidenav → sidenav}/Sidenav.js +0 -0
- package/sidenav/index.d.ts +13 -0
- package/{dist/slider → slider}/Slider.js +104 -19
- package/slider/index.d.ts +29 -0
- package/{dist/spinner → spinner}/Spinner.js +0 -0
- package/spinner/index.d.ts +17 -0
- package/{dist/switch → switch}/Switch.js +0 -0
- package/switch/index.d.ts +24 -0
- package/{dist/table → table}/Table.js +0 -0
- package/table/index.d.ts +13 -0
- package/{dist/tabs → tabs}/Tabs.js +0 -0
- package/tabs/index.d.ts +19 -0
- package/{dist/tag → tag}/Tag.js +0 -0
- package/tag/index.d.ts +24 -0
- package/{dist/new-input-text/NewInputText.js → text-input/TextInput.js} +51 -59
- package/{dist/new-input-text → text-input}/index.d.ts +1 -1
- package/{dist/new-textarea/NewTextarea.js → textarea/Textarea.js} +16 -9
- package/{dist/new-textarea → textarea}/index.d.ts +1 -1
- package/{dist/toggle → toggle}/Toggle.js +0 -0
- package/toggle/index.d.ts +21 -0
- package/{dist/toggle-group → toggle-group}/ToggleGroup.js +132 -28
- package/toggle-group/index.d.ts +21 -0
- package/{dist/upload → upload}/Upload.js +0 -0
- package/{dist/upload → upload}/buttons-upload/ButtonsUpload.js +7 -11
- package/upload/buttons-upload/Icons.js +40 -0
- package/{dist/upload → upload}/dragAndDropArea/DragAndDropArea.js +14 -14
- package/upload/dragAndDropArea/Icons.js +39 -0
- package/{dist/upload → upload}/file-upload/FileToUpload.js +26 -21
- package/upload/file-upload/Icons.js +66 -0
- package/{dist/upload → upload}/files-upload/FilesToUpload.js +0 -0
- package/upload/index.d.ts +15 -0
- package/upload/transaction/Icons.js +160 -0
- package/{dist/upload → upload}/transaction/Transaction.js +11 -38
- package/{dist/upload → upload}/transactions/Transactions.js +0 -0
- package/{dist/useTheme.js → useTheme.js} +0 -0
- package/wizard/Icons.js +65 -0
- package/{dist/wizard → wizard}/Wizard.js +3 -9
- package/wizard/index.d.ts +18 -0
- package/README.md +0 -66
- package/babel.config.js +0 -8
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/readme.md +0 -73
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo.svg +0 -15
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.svg +0 -8
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/link/readme.md +0 -51
- package/dist/main.d.ts +0 -7
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/password/styles.css +0 -3
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/wizard/invalid_icon.svg +0 -5
- package/dist/wizard/valid_icon.svg +0 -5
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -393
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -145
- package/test/FileInput.test.js +0 -201
- package/test/Footer.test.js +0 -99
- package/test/Header.test.js +0 -39
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -240
- package/test/Link.test.js +0 -43
- package/test/NewDate.test.js +0 -232
- package/test/NewInputText.test.js +0 -734
- package/test/NewTextarea.test.js +0 -195
- package/test/Number.test.js +0 -257
- package/test/Paginator.test.js +0 -177
- package/test/Password.test.js +0 -83
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -329
- package/test/Select.test.js +0 -212
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -32
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextArea.test.js +0 -52
- package/test/ToggleGroup.test.js +0 -81
- package/test/Upload.test.js +0 -60
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
|
@@ -33,7 +33,7 @@ var _uuid = require("uuid");
|
|
|
33
33
|
|
|
34
34
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext.js"));
|
|
37
37
|
|
|
38
38
|
function _templateObject17() {
|
|
39
39
|
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n align-items: center;\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
|
|
@@ -126,7 +126,7 @@ function _templateObject9() {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
function _templateObject8() {
|
|
129
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius:
|
|
129
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: calc(1rem * 0.25);\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
|
|
130
130
|
|
|
131
131
|
_templateObject8 = function _templateObject8() {
|
|
132
132
|
return data;
|
|
@@ -166,7 +166,7 @@ function _templateObject5() {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
function _templateObject4() {
|
|
169
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height:
|
|
169
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
170
170
|
|
|
171
171
|
_templateObject4 = function _templateObject4() {
|
|
172
172
|
return data;
|
|
@@ -186,7 +186,7 @@ function _templateObject3() {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
function _templateObject2() {
|
|
189
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height:
|
|
189
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
190
190
|
|
|
191
191
|
_templateObject2 = function _templateObject2() {
|
|
192
192
|
return data;
|
|
@@ -242,7 +242,9 @@ var patternMatch = function patternMatch(pattern, value) {
|
|
|
242
242
|
return new RegExp(pattern).test(value);
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
-
var
|
|
245
|
+
var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
246
|
+
var _action$title;
|
|
247
|
+
|
|
246
248
|
var _ref$label = _ref.label,
|
|
247
249
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
248
250
|
_ref$name = _ref.name,
|
|
@@ -318,30 +320,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
318
320
|
visualFocusedSuggIndex = _useState16[0],
|
|
319
321
|
changeVisualFocusedSuggIndex = _useState16[1];
|
|
320
322
|
|
|
321
|
-
var _useState17 = (0, _react.useState)(
|
|
322
|
-
_useState18 = (0, _slicedToArray2["default"])(_useState17,
|
|
323
|
-
|
|
324
|
-
setMinNumber = _useState18[1];
|
|
325
|
-
|
|
326
|
-
var _useState19 = (0, _react.useState)(null),
|
|
327
|
-
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
328
|
-
maxNumber = _useState20[0],
|
|
329
|
-
setMaxNumber = _useState20[1];
|
|
330
|
-
|
|
331
|
-
var _useState21 = (0, _react.useState)(null),
|
|
332
|
-
_useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
|
|
333
|
-
stepNumber = _useState22[0],
|
|
334
|
-
setStepNumber = _useState22[1];
|
|
323
|
+
var _useState17 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
324
|
+
_useState18 = (0, _slicedToArray2["default"])(_useState17, 1),
|
|
325
|
+
inputId = _useState18[0];
|
|
335
326
|
|
|
336
327
|
var suggestionsRef = (0, _react.useRef)(null);
|
|
337
328
|
var inputRef = (0, _react.useRef)(null);
|
|
338
329
|
var actionRef = (0, _react.useRef)(null);
|
|
339
330
|
var colorsTheme = (0, _useTheme["default"])();
|
|
340
331
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
341
|
-
var inputId = "input-".concat((0, _uuid.v4)());
|
|
342
332
|
var autosuggestId = "".concat(inputId, "-listBox");
|
|
343
333
|
var errorId = "error-message-".concat(inputId);
|
|
344
|
-
var
|
|
334
|
+
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
345
335
|
|
|
346
336
|
var isNotOptional = function isNotOptional(value) {
|
|
347
337
|
return value === "" && !optional;
|
|
@@ -352,7 +342,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
352
342
|
};
|
|
353
343
|
|
|
354
344
|
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
355
|
-
return minNumber && parseInt(value) < minNumber || maxNumber && parseInt(value) > maxNumber;
|
|
345
|
+
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);
|
|
356
346
|
};
|
|
357
347
|
|
|
358
348
|
var isTextInputType = function isTextInputType() {
|
|
@@ -362,7 +352,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
362
352
|
};
|
|
363
353
|
|
|
364
354
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
365
|
-
if (minNumber && parseInt(value) < minNumber) return "Value must be greater than or equal to ".concat(minNumber, ".");else if (maxNumber && parseInt(value) > maxNumber) return "Value must be less than or equal to ".concat(maxNumber, ".");
|
|
355
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return "Value must be greater than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, ".");else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return "Value must be less than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber, ".");
|
|
366
356
|
};
|
|
367
357
|
|
|
368
358
|
var hasInputSuggestions = function hasInputSuggestions() {
|
|
@@ -440,7 +430,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
440
430
|
switch (event.keyCode) {
|
|
441
431
|
case 40:
|
|
442
432
|
// Arrow Down
|
|
443
|
-
if (
|
|
433
|
+
if (numberInputContext) {
|
|
444
434
|
decrementNumber();
|
|
445
435
|
event.preventDefault();
|
|
446
436
|
} else {
|
|
@@ -460,7 +450,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
460
450
|
|
|
461
451
|
case 38:
|
|
462
452
|
// Arrow Up
|
|
463
|
-
if (
|
|
453
|
+
if (numberInputContext) {
|
|
464
454
|
incrementNumber();
|
|
465
455
|
event.preventDefault();
|
|
466
456
|
} else {
|
|
@@ -508,9 +498,6 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
508
498
|
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("min", min));
|
|
509
499
|
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("max", max));
|
|
510
500
|
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
|
|
511
|
-
setMinNumber(min);
|
|
512
|
-
setMaxNumber(max);
|
|
513
|
-
setStepNumber(step);
|
|
514
501
|
};
|
|
515
502
|
|
|
516
503
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -547,7 +534,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
547
534
|
changeVisualFocusedSuggIndex(-1);
|
|
548
535
|
}
|
|
549
536
|
|
|
550
|
-
|
|
537
|
+
numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
551
538
|
}, [value, innerValue, suggestions]);
|
|
552
539
|
var defaultClearAction = {
|
|
553
540
|
onClick: function onClick() {
|
|
@@ -580,18 +567,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
580
567
|
}));
|
|
581
568
|
|
|
582
569
|
var decrementNumber = function decrementNumber() {
|
|
583
|
-
var numberValue = value
|
|
570
|
+
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
584
571
|
|
|
585
|
-
if (minNumber && parseInt(numberValue) < minNumber) {
|
|
572
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) {
|
|
586
573
|
changeValue(parseInt(numberValue));
|
|
587
|
-
} else if (maxNumber && parseInt(numberValue) > maxNumber) {
|
|
588
|
-
changeValue(maxNumber);
|
|
589
|
-
} else if (minNumber && (parseInt(numberValue) === minNumber || numberValue === "" || stepNumber && parseInt(numberValue) - stepNumber < minNumber)) {
|
|
590
|
-
changeValue(minNumber);
|
|
591
|
-
} else if (stepNumber && minNumber && parseInt(numberValue) - stepNumber >= minNumber || stepNumber && numberValue !== "") {
|
|
592
|
-
changeValue(parseInt(numberValue) - stepNumber);
|
|
593
|
-
} else if (stepNumber && numberValue == "") {
|
|
594
|
-
changeValue(-stepNumber);
|
|
574
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
575
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
576
|
+
} 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))) {
|
|
577
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
578
|
+
} 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 !== "") {
|
|
579
|
+
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
580
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
581
|
+
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
595
582
|
} else if (numberValue === "") {
|
|
596
583
|
changeValue(-1);
|
|
597
584
|
} else {
|
|
@@ -600,18 +587,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
600
587
|
};
|
|
601
588
|
|
|
602
589
|
var incrementNumber = function incrementNumber() {
|
|
603
|
-
var numberValue = value
|
|
590
|
+
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
604
591
|
|
|
605
|
-
if (maxNumber && parseInt(numberValue) > maxNumber) {
|
|
592
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
606
593
|
changeValue(parseInt(numberValue));
|
|
607
|
-
} else if (minNumber && (parseInt(numberValue) < minNumber || numberValue === "")) {
|
|
608
|
-
changeValue(minNumber);
|
|
609
|
-
} else if (maxNumber && (parseInt(numberValue) === maxNumber || stepNumber && parseInt(numberValue) + stepNumber > maxNumber)) {
|
|
610
|
-
changeValue(maxNumber);
|
|
611
|
-
} else if (stepNumber && maxNumber && parseInt(numberValue) + stepNumber <= maxNumber || stepNumber && numberValue !== "") {
|
|
612
|
-
changeValue(parseInt(numberValue) + stepNumber);
|
|
613
|
-
} else if (stepNumber && numberValue == "") {
|
|
614
|
-
changeValue(stepNumber);
|
|
594
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "")) {
|
|
595
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
596
|
+
} 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))) {
|
|
597
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
598
|
+
} 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 !== "") {
|
|
599
|
+
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
600
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
601
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
615
602
|
} else if (numberValue === "") {
|
|
616
603
|
changeValue(1);
|
|
617
604
|
} else {
|
|
@@ -664,11 +651,11 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
664
651
|
var noMatchedWords = suggestion.replace(regEx, "");
|
|
665
652
|
return _react["default"].createElement(Suggestion, {
|
|
666
653
|
id: "suggestion-".concat(index),
|
|
667
|
-
onMouseDown: function onMouseDown() {
|
|
668
|
-
changeIsActiveSuggestion(true);
|
|
654
|
+
onMouseDown: function onMouseDown(event) {
|
|
655
|
+
event.button === 0 && changeIsActiveSuggestion(true);
|
|
669
656
|
},
|
|
670
|
-
onMouseUp: function onMouseUp() {
|
|
671
|
-
if (isActiveSuggestion) {
|
|
657
|
+
onMouseUp: function onMouseUp(event) {
|
|
658
|
+
if (event.button === 0 && isActiveSuggestion) {
|
|
672
659
|
changeValue(suggestion);
|
|
673
660
|
changeIsActiveSuggestion(false);
|
|
674
661
|
closeSuggestions();
|
|
@@ -688,7 +675,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
688
675
|
};
|
|
689
676
|
|
|
690
677
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
691
|
-
theme: colorsTheme.
|
|
678
|
+
theme: colorsTheme.textInput
|
|
692
679
|
}, _react["default"].createElement(DxcInput, {
|
|
693
680
|
margin: margin,
|
|
694
681
|
ref: ref,
|
|
@@ -728,7 +715,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
728
715
|
tabIndex: tabIndex,
|
|
729
716
|
role: isTextInputType() && hasInputSuggestions() ? "combobox" : "textbox",
|
|
730
717
|
"aria-autocomplete": isTextInputType() && hasInputSuggestions() ? "list" : undefined,
|
|
731
|
-
"aria-controls": isTextInputType() && hasInputSuggestions() ?
|
|
718
|
+
"aria-controls": isTextInputType() && hasInputSuggestions() ? autosuggestId : undefined,
|
|
732
719
|
"aria-expanded": isTextInputType() && hasInputSuggestions() ? isOpen ? "true" : "false" : undefined,
|
|
733
720
|
"aria-activedescendant": isTextInputType() && hasInputSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
|
|
734
721
|
"aria-invalid": error ? "true" : "false",
|
|
@@ -742,7 +729,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
742
729
|
backgroundType: backgroundType,
|
|
743
730
|
tabIndex: tabIndex,
|
|
744
731
|
"aria-label": "Clear"
|
|
745
|
-
}, defaultClearAction.icon), (
|
|
732
|
+
}, defaultClearAction.icon), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Action, {
|
|
746
733
|
ref: actionRef,
|
|
747
734
|
disabled: disabled,
|
|
748
735
|
onClick: decrementAction.onClick,
|
|
@@ -760,6 +747,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
760
747
|
ref: actionRef,
|
|
761
748
|
disabled: disabled,
|
|
762
749
|
onClick: action.onClick,
|
|
750
|
+
title: (_action$title = action.title) !== null && _action$title !== void 0 ? _action$title : action.title,
|
|
763
751
|
backgroundType: backgroundType,
|
|
764
752
|
tabIndex: tabIndex
|
|
765
753
|
}, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
|
|
@@ -828,6 +816,8 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
|
|
|
828
816
|
return props.theme.labelFontStyle;
|
|
829
817
|
}, function (props) {
|
|
830
818
|
return props.theme.labelFontWeight;
|
|
819
|
+
}, function (props) {
|
|
820
|
+
return props.theme.labelLineHeight;
|
|
831
821
|
});
|
|
832
822
|
|
|
833
823
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
@@ -844,6 +834,8 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
|
|
|
844
834
|
return props.theme.helperTextFontStyle;
|
|
845
835
|
}, function (props) {
|
|
846
836
|
return props.theme.helperTextFontWeight;
|
|
837
|
+
}, function (props) {
|
|
838
|
+
return props.theme.helperTextLineHeight;
|
|
847
839
|
});
|
|
848
840
|
|
|
849
841
|
var InputContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
@@ -885,7 +877,7 @@ var Action = _styledComponents["default"].button(_templateObject8(), function (p
|
|
|
885
877
|
}, function (props) {
|
|
886
878
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
887
879
|
}, function (props) {
|
|
888
|
-
return !props.disabled && "\n &:
|
|
880
|
+
return !props.disabled && "\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
|
|
889
881
|
});
|
|
890
882
|
|
|
891
883
|
var Prefix = _styledComponents["default"].span(_templateObject9(), function (props) {
|
|
@@ -942,7 +934,7 @@ var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject16()
|
|
|
942
934
|
|
|
943
935
|
var SuggestionsError = _styledComponents["default"].span(_templateObject17());
|
|
944
936
|
|
|
945
|
-
|
|
937
|
+
DxcTextInput.propTypes = {
|
|
946
938
|
label: _propTypes["default"].string,
|
|
947
939
|
name: _propTypes["default"].string,
|
|
948
940
|
value: _propTypes["default"].string,
|
|
@@ -978,5 +970,5 @@ DxcNewInputText.propTypes = {
|
|
|
978
970
|
}),
|
|
979
971
|
tabIndex: _propTypes["default"].number
|
|
980
972
|
};
|
|
981
|
-
var _default =
|
|
973
|
+
var _default = DxcTextInput;
|
|
982
974
|
exports["default"] = _default;
|
|
@@ -54,7 +54,7 @@ function _templateObject5() {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function _templateObject4() {
|
|
57
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height:
|
|
57
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
58
58
|
|
|
59
59
|
_templateObject4 = function _templateObject4() {
|
|
60
60
|
return data;
|
|
@@ -74,7 +74,7 @@ function _templateObject3() {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function _templateObject2() {
|
|
77
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height:
|
|
77
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
78
78
|
|
|
79
79
|
_templateObject2 = function _templateObject2() {
|
|
80
80
|
return data;
|
|
@@ -109,7 +109,7 @@ var patternMatch = function patternMatch(pattern, value) {
|
|
|
109
109
|
return new RegExp(pattern).test(value);
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
var
|
|
112
|
+
var DxcTextarea = _react["default"].forwardRef(function (_ref, ref) {
|
|
113
113
|
var _ref$label = _ref.label,
|
|
114
114
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
115
115
|
_ref$name = _ref.name,
|
|
@@ -146,10 +146,13 @@ var DxcNewTextarea = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
146
146
|
innerValue = _useState2[0],
|
|
147
147
|
setInnerValue = _useState2[1];
|
|
148
148
|
|
|
149
|
+
var _useState3 = (0, _react.useState)("textarea-".concat((0, _uuid.v4)())),
|
|
150
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
151
|
+
textareaId = _useState4[0];
|
|
152
|
+
|
|
149
153
|
var colorsTheme = (0, _useTheme["default"])();
|
|
150
154
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
151
155
|
var textareaRef = (0, _react.useRef)(null);
|
|
152
|
-
var textareaId = "textarea-".concat((0, _uuid.v4)());
|
|
153
156
|
var errorId = "error-message-".concat(textareaId);
|
|
154
157
|
|
|
155
158
|
var isNotOptional = function isNotOptional(value) {
|
|
@@ -207,8 +210,8 @@ var DxcNewTextarea = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
207
210
|
}
|
|
208
211
|
}, [value, verticalGrow, rows, innerValue]);
|
|
209
212
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
210
|
-
theme: colorsTheme.
|
|
211
|
-
}, _react["default"].createElement(
|
|
213
|
+
theme: colorsTheme.textarea
|
|
214
|
+
}, _react["default"].createElement(TextareaContainer, {
|
|
212
215
|
margin: margin,
|
|
213
216
|
size: size,
|
|
214
217
|
ref: ref
|
|
@@ -256,7 +259,7 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
256
259
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
257
260
|
};
|
|
258
261
|
|
|
259
|
-
var
|
|
262
|
+
var TextareaContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
260
263
|
return calculateWidth(props.margin, props.size);
|
|
261
264
|
}, function (props) {
|
|
262
265
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -280,6 +283,8 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
|
|
|
280
283
|
return props.theme.labelFontStyle;
|
|
281
284
|
}, function (props) {
|
|
282
285
|
return props.theme.labelFontWeight;
|
|
286
|
+
}, function (props) {
|
|
287
|
+
return props.theme.labelLineHeight;
|
|
283
288
|
});
|
|
284
289
|
|
|
285
290
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
@@ -296,6 +301,8 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
|
|
|
296
301
|
return props.theme.helperTextFontStyle;
|
|
297
302
|
}, function (props) {
|
|
298
303
|
return props.theme.helperTextFontWeight;
|
|
304
|
+
}, function (props) {
|
|
305
|
+
return props.theme.helperTextLineHeight;
|
|
299
306
|
});
|
|
300
307
|
|
|
301
308
|
var Textarea = _styledComponents["default"].textarea(_templateObject5(), function (props) {
|
|
@@ -330,7 +337,7 @@ var Error = _styledComponents["default"].span(_templateObject6(), function (prop
|
|
|
330
337
|
return props.theme.fontFamily;
|
|
331
338
|
});
|
|
332
339
|
|
|
333
|
-
|
|
340
|
+
DxcTextarea.propTypes = {
|
|
334
341
|
label: _propTypes["default"].string,
|
|
335
342
|
name: _propTypes["default"].string,
|
|
336
343
|
value: _propTypes["default"].string,
|
|
@@ -358,5 +365,5 @@ DxcNewTextarea.propTypes = {
|
|
|
358
365
|
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
359
366
|
tabIndex: _propTypes["default"].number
|
|
360
367
|
};
|
|
361
|
-
var _default =
|
|
368
|
+
var _default = DxcTextarea;
|
|
362
369
|
exports["default"] = _default;
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
label?: string;
|
|
11
|
+
helperText?: string;
|
|
12
|
+
value?: any;
|
|
13
|
+
onChange?: void;
|
|
14
|
+
disabled?: boolean,
|
|
15
|
+
options?: any;
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
margin?: Space | Margin;
|
|
18
|
+
tabIndex?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default function DxcToggle(props: Props): JSX.Element;
|