@dxc-technology/halstack-react 0.0.0-f54247d → 0.0.0-f6d6be5
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 +113 -72
- package/README.md +47 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +14 -37
- package/accordion/Accordion.stories.tsx +104 -113
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +2 -14
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +23 -44
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +7 -17
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +2 -14
- package/alert/Alert.js +4 -8
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +7 -26
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.js +1 -1
- package/box/types.d.ts +0 -12
- package/bulleted-list/BulletedList.js +4 -2
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +31 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +48 -60
- package/button/Button.stories.tsx +151 -9
- package/button/Button.test.js +12 -1
- package/button/types.d.ts +7 -3
- 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 -7
- package/checkbox/Checkbox.js +3 -3
- package/checkbox/Checkbox.stories.tsx +52 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.js +28 -49
- package/chip/Chip.stories.tsx +121 -26
- package/chip/Chip.test.js +3 -5
- 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 +984 -1127
- package/date-input/Calendar.d.ts +1 -1
- package/date-input/Calendar.js +45 -45
- package/date-input/DateInput.js +74 -32
- package/date-input/DateInput.stories.tsx +183 -30
- package/date-input/DateInput.test.js +120 -37
- package/date-input/DatePicker.js +38 -52
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +1 -1
- package/date-input/YearPicker.js +23 -12
- package/date-input/types.d.ts +6 -8
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +55 -86
- package/dialog/Dialog.stories.tsx +145 -217
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +0 -13
- package/dropdown/Dropdown.js +5 -8
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +3 -2
- package/dropdown/DropdownMenu.js +12 -18
- package/dropdown/DropdownMenuItem.js +4 -17
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.js +4 -8
- package/file-input/FileInput.stories.tsx +85 -2
- package/file-input/FileInput.test.js +1 -42
- package/file-input/FileItem.js +3 -2
- package/file-input/types.d.ts +1 -1
- package/flex/Flex.js +4 -2
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +70 -5
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +44 -64
- package/footer/Footer.stories.tsx +36 -21
- package/footer/Footer.test.js +16 -26
- package/footer/types.d.ts +10 -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 +20 -49
- package/header/Header.stories.tsx +115 -36
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +1 -15
- 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 +2 -1
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +15 -12
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +7 -4
- package/layout/Icons.js +52 -56
- package/layout/types.d.ts +2 -3
- package/link/Link.js +3 -3
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +4 -2
- package/main.js +17 -1
- package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
- package/{tabs-nav → nav-tabs}/NavTabs.js +8 -11
- 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 +48 -32
- package/{tabs-nav → nav-tabs}/types.d.ts +8 -9
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +6 -4
- package/number-input/NumberInput.test.js +279 -96
- package/package.json +3 -3
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +7 -15
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +57 -47
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- 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 +28 -35
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/Radio.js +10 -10
- package/radio-group/RadioGroup.js +8 -10
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +1 -1
- package/resultsetTable/ResultsetTable.js +2 -2
- package/resultsetTable/ResultsetTable.test.js +18 -23
- package/resultsetTable/types.d.ts +3 -3
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +56 -35
- package/select/Select.stories.tsx +495 -148
- package/select/Select.test.js +80 -85
- package/select/types.d.ts +2 -2
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +66 -96
- package/sidenav/Sidenav.stories.tsx +165 -63
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.js +6 -7
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +2 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.js +3 -3
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +2 -2
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +34 -7
- package/text-input/TextInput.js +71 -91
- package/text-input/TextInput.stories.tsx +93 -5
- package/text-input/TextInput.test.js +125 -26
- 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 +48 -3
- package/toggle-group/ToggleGroup.test.js +38 -24
- package/toggle-group/types.d.ts +22 -13
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- 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 +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- package/card/ice-cream.jpg +0 -0
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- /package/{tabs-nav → grid}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
package/text-input/TextInput.js
CHANGED
|
@@ -23,13 +23,13 @@ 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
|
|
28
|
+
var _utils = require("../common/utils");
|
|
29
29
|
|
|
30
30
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _NumberInput = require("../number-input/NumberInput");
|
|
33
33
|
|
|
34
34
|
var _Suggestions = _interopRequireDefault(require("./Suggestions"));
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ var _Icons = _interopRequireDefault(require("./Icons"));
|
|
|
39
39
|
|
|
40
40
|
var _uuid = require("uuid");
|
|
41
41
|
|
|
42
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11
|
|
42
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
43
43
|
|
|
44
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); }
|
|
45
45
|
|
|
@@ -88,20 +88,20 @@ var hasSuggestions = function hasSuggestions(suggestions) {
|
|
|
88
88
|
return typeof suggestions === "function" || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0;
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
var
|
|
91
|
+
var isRequired = function isRequired(value, optional) {
|
|
92
92
|
return value === "" && !optional;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
var isLengthIncorrect = function isLengthIncorrect(value, minLength, maxLength) {
|
|
96
|
-
return value
|
|
96
|
+
return value != null && (value.length < minLength || value.length > maxLength);
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
var isNumberIncorrect = function isNumberIncorrect(value, minNumber, maxNumber) {
|
|
100
|
-
return
|
|
100
|
+
return value < minNumber || value > maxNumber;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
var
|
|
104
|
-
return pattern && !new RegExp(pattern).test(value);
|
|
103
|
+
var patternMismatch = function patternMismatch(pattern, value) {
|
|
104
|
+
return pattern != null && !new RegExp(pattern).test(value);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
@@ -182,10 +182,10 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
182
182
|
var colorsTheme = (0, _useTheme["default"])();
|
|
183
183
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
184
184
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
185
|
-
var numberInputContext = (0, _react.useContext)(
|
|
185
|
+
var numberInputContext = (0, _react.useContext)(_NumberInput.NumberInputContext);
|
|
186
186
|
|
|
187
187
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
188
|
-
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);
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
var getTextInputWidth = (0, _react.useCallback)(function () {
|
|
@@ -207,22 +207,22 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
var changeValue = function changeValue(newValue) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
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,
|
|
214
214
|
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
215
|
-
});else if (isLengthIncorrect(
|
|
216
|
-
value:
|
|
215
|
+
});else if (isLengthIncorrect(formattedValue, minLength, maxLength)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
216
|
+
value: formattedValue,
|
|
217
217
|
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
218
|
-
});else if (
|
|
219
|
-
value:
|
|
218
|
+
});else if (patternMismatch(pattern, formattedValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
219
|
+
value: formattedValue,
|
|
220
220
|
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
221
|
-
});else if (isNumberIncorrect(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:
|
|
223
|
-
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))
|
|
224
224
|
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
225
|
-
value:
|
|
225
|
+
value: formattedValue
|
|
226
226
|
});
|
|
227
227
|
};
|
|
228
228
|
|
|
@@ -242,18 +242,18 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
242
242
|
|
|
243
243
|
var handleInputOnBlur = function handleInputOnBlur(event) {
|
|
244
244
|
closeSuggestions();
|
|
245
|
-
if (
|
|
245
|
+
if (isRequired(event.target.value, optional)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
246
246
|
value: event.target.value,
|
|
247
247
|
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
248
248
|
});else if (isLengthIncorrect(event.target.value, minLength, maxLength)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
249
249
|
value: event.target.value,
|
|
250
250
|
error: translatedLabels.formFields.lengthErrorMessage(minLength, maxLength)
|
|
251
|
-
});else if (
|
|
251
|
+
});else if (patternMismatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
252
252
|
value: event.target.value,
|
|
253
253
|
error: translatedLabels.formFields.formatRequestedErrorMessage
|
|
254
|
-
});else if (isNumberIncorrect(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({
|
|
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({
|
|
255
255
|
value: event.target.value,
|
|
256
|
-
error: getNumberErrorMessage(event.target.value)
|
|
256
|
+
error: getNumberErrorMessage(Number(event.target.value))
|
|
257
257
|
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
258
258
|
value: event.target.value
|
|
259
259
|
});
|
|
@@ -338,49 +338,33 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
338
338
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
339
339
|
var _inputRef$current2, _inputRef$current3, _inputRef$current4, _inputRef$current5;
|
|
340
340
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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);
|
|
345
345
|
};
|
|
346
346
|
|
|
347
347
|
var decrementNumber = function decrementNumber() {
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
354
|
-
} 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))) {
|
|
355
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
356
|
-
} 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 !== "") {
|
|
357
|
-
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
358
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
359
|
-
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
360
|
-
} else if (numberValue === "") {
|
|
361
|
-
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);
|
|
362
354
|
} else {
|
|
363
|
-
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);
|
|
364
356
|
}
|
|
365
357
|
};
|
|
366
358
|
|
|
367
359
|
var incrementNumber = function incrementNumber() {
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
374
|
-
} 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))) {
|
|
375
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
376
|
-
} 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 !== "") {
|
|
377
|
-
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
378
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
379
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
380
|
-
} else if (numberValue === "") {
|
|
381
|
-
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);
|
|
382
366
|
} else {
|
|
383
|
-
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);
|
|
384
368
|
}
|
|
385
369
|
};
|
|
386
370
|
|
|
@@ -410,7 +394,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
410
394
|
changeVisualFocusIndex(-1);
|
|
411
395
|
}
|
|
412
396
|
|
|
413
|
-
|
|
397
|
+
numberInputContext != null && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
414
398
|
}, [value, innerValue, suggestions, numberInputContext]);
|
|
415
399
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
416
400
|
theme: colorsTheme.textInput
|
|
@@ -502,52 +486,52 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
502
486
|
backgroundType: backgroundType,
|
|
503
487
|
"aria-label": "Error"
|
|
504
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,
|
|
505
490
|
onClick: handleClearActionOnClick,
|
|
506
491
|
onMouseDown: function onMouseDown(event) {
|
|
507
492
|
event.stopPropagation();
|
|
508
493
|
},
|
|
509
|
-
backgroundType: backgroundType,
|
|
510
494
|
tabIndex: tabIndex,
|
|
511
495
|
title: translatedLabels.textInput.clearFieldActionTitle,
|
|
512
|
-
"
|
|
513
|
-
|
|
496
|
+
type: "button",
|
|
497
|
+
backgroundType: backgroundType
|
|
514
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, {
|
|
515
|
-
|
|
499
|
+
"aria-label": translatedLabels.numberInput.decrementValueTitle,
|
|
516
500
|
disabled: disabled,
|
|
517
501
|
onClick: handleDecrementActionOnClick,
|
|
518
502
|
onMouseDown: function onMouseDown(event) {
|
|
519
503
|
event.stopPropagation();
|
|
520
504
|
},
|
|
521
|
-
|
|
505
|
+
ref: actionRef,
|
|
522
506
|
tabIndex: tabIndex,
|
|
523
507
|
title: translatedLabels.numberInput.decrementValueTitle,
|
|
524
|
-
"
|
|
525
|
-
|
|
508
|
+
type: "button",
|
|
509
|
+
backgroundType: backgroundType
|
|
526
510
|
}, _Icons["default"].decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
527
|
-
|
|
511
|
+
"aria-label": translatedLabels.numberInput.incrementValueTitle,
|
|
528
512
|
disabled: disabled,
|
|
529
513
|
onClick: handleIncrementActionOnClick,
|
|
530
514
|
onMouseDown: function onMouseDown(event) {
|
|
531
515
|
event.stopPropagation();
|
|
532
516
|
},
|
|
533
|
-
|
|
517
|
+
ref: actionRef,
|
|
534
518
|
tabIndex: tabIndex,
|
|
535
519
|
title: translatedLabels.numberInput.incrementValueTitle,
|
|
536
|
-
"
|
|
537
|
-
|
|
520
|
+
type: "button",
|
|
521
|
+
backgroundType: backgroundType
|
|
538
522
|
}, _Icons["default"].increment)), action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
539
|
-
|
|
523
|
+
"aria-label": action.title,
|
|
540
524
|
disabled: disabled,
|
|
541
525
|
onClick: action.onClick,
|
|
542
526
|
onMouseDown: function onMouseDown(event) {
|
|
543
527
|
event.stopPropagation();
|
|
544
528
|
},
|
|
545
|
-
|
|
546
|
-
"aria-label": action.title,
|
|
547
|
-
backgroundType: backgroundType,
|
|
529
|
+
ref: actionRef,
|
|
548
530
|
tabIndex: tabIndex,
|
|
549
|
-
|
|
550
|
-
|
|
531
|
+
title: action.title,
|
|
532
|
+
type: "button",
|
|
533
|
+
backgroundType: backgroundType
|
|
534
|
+
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
551
535
|
src: action.icon
|
|
552
536
|
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
553
537
|
disabled: disabled,
|
|
@@ -559,7 +543,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
559
543
|
}, error)));
|
|
560
544
|
});
|
|
561
545
|
|
|
562
|
-
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n
|
|
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) {
|
|
563
547
|
return calculateWidth(props.margin, props.size);
|
|
564
548
|
}, function (props) {
|
|
565
549
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -607,7 +591,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
607
591
|
return props.theme.helperTextLineHeight;
|
|
608
592
|
});
|
|
609
593
|
|
|
610
|
-
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) {
|
|
611
595
|
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
612
596
|
}, function (props) {
|
|
613
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;
|
|
@@ -635,39 +619,35 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
|
|
|
635
619
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
636
620
|
});
|
|
637
621
|
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
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) {
|
|
641
|
-
return props.theme.fontFamily;
|
|
642
|
-
}, 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) {
|
|
643
623
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
644
624
|
}, function (props) {
|
|
645
625
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
|
|
646
626
|
}, function (props) {
|
|
647
627
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
648
628
|
}, function (props) {
|
|
649
|
-
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 ");
|
|
650
630
|
});
|
|
651
631
|
|
|
652
|
-
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) {
|
|
653
633
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
|
|
654
634
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
655
635
|
}, function (props) {
|
|
656
636
|
return props.theme.fontFamily;
|
|
657
637
|
});
|
|
658
638
|
|
|
659
|
-
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) {
|
|
660
640
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
|
|
661
641
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
662
642
|
}, function (props) {
|
|
663
643
|
return props.theme.fontFamily;
|
|
664
644
|
});
|
|
665
645
|
|
|
666
|
-
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) {
|
|
667
647
|
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
668
648
|
});
|
|
669
649
|
|
|
670
|
-
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) {
|
|
671
651
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
672
652
|
}, function (props) {
|
|
673
653
|
return props.theme.fontFamily;
|
|
@@ -11,6 +11,7 @@ import DxcFlex from "../flex/Flex";
|
|
|
11
11
|
import Suggestions from "./Suggestions";
|
|
12
12
|
import { ThemeProvider } from "styled-components";
|
|
13
13
|
import useTheme from "../useTheme";
|
|
14
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
14
15
|
|
|
15
16
|
export default {
|
|
16
17
|
title: "Text input",
|
|
@@ -27,7 +28,7 @@ const action = {
|
|
|
27
28
|
),
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const actionLargeIconSVG = {
|
|
31
32
|
onClick: () => {},
|
|
32
33
|
icon: (
|
|
33
34
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
@@ -37,6 +38,11 @@ const actionLargeIcon = {
|
|
|
37
38
|
),
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
const actionLargeIconURL = {
|
|
42
|
+
onClick: () => {},
|
|
43
|
+
icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
44
|
+
};
|
|
45
|
+
|
|
40
46
|
const country = ["Afghanistan"];
|
|
41
47
|
const countries = [
|
|
42
48
|
"Afghanistan",
|
|
@@ -61,8 +67,16 @@ const countries = [
|
|
|
61
67
|
"Dominica",
|
|
62
68
|
"Denmark",
|
|
63
69
|
"Djibouti",
|
|
70
|
+
"*",
|
|
64
71
|
];
|
|
65
72
|
|
|
73
|
+
const opinionatedTheme = {
|
|
74
|
+
textInput: {
|
|
75
|
+
fontColor: "#000000",
|
|
76
|
+
hoverBorderColor: "#a46ede",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
66
80
|
export const Chromatic = () => (
|
|
67
81
|
<>
|
|
68
82
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
@@ -98,12 +112,21 @@ export const Chromatic = () => (
|
|
|
98
112
|
<DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
|
|
99
113
|
</ExampleContainer>
|
|
100
114
|
<ExampleContainer>
|
|
101
|
-
<Title title="Clearable and large icon action" theme="light" level={4} />
|
|
115
|
+
<Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
|
|
102
116
|
<DxcTextInput
|
|
103
117
|
label="Text input"
|
|
104
118
|
defaultValue="Text text text text text text text text text text"
|
|
105
119
|
clearable
|
|
106
|
-
action={
|
|
120
|
+
action={actionLargeIconSVG}
|
|
121
|
+
/>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="Clearable and large icon action (URL)" theme="light" level={4} />
|
|
125
|
+
<DxcTextInput
|
|
126
|
+
label="Text input"
|
|
127
|
+
defaultValue="Text text text text text text text text text text"
|
|
128
|
+
clearable
|
|
129
|
+
action={actionLargeIconURL}
|
|
107
130
|
/>
|
|
108
131
|
</ExampleContainer>
|
|
109
132
|
<ExampleContainer>
|
|
@@ -297,6 +320,66 @@ export const Chromatic = () => (
|
|
|
297
320
|
<Title title="FillParent size" theme="light" level={4} />
|
|
298
321
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
299
322
|
</ExampleContainer>
|
|
323
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
324
|
+
<ExampleContainer>
|
|
325
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
326
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
327
|
+
<Title title="Hovered input" theme="light" level={4} />
|
|
328
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
329
|
+
</ExampleContainer>
|
|
330
|
+
<ExampleContainer pseudoState="pseudo-focus-within">
|
|
331
|
+
<Title title="Focused input" theme="light" level={4} />
|
|
332
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
333
|
+
</ExampleContainer>
|
|
334
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
335
|
+
<Title title="Hovered action" theme="light" level={4} />
|
|
336
|
+
<DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
|
|
337
|
+
</ExampleContainer>
|
|
338
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
339
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
340
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
341
|
+
</ExampleContainer>
|
|
342
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
343
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
344
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
345
|
+
</ExampleContainer>
|
|
346
|
+
<ExampleContainer>
|
|
347
|
+
<Title title="Prefix" theme="light" level={4} />
|
|
348
|
+
<DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
|
|
349
|
+
</ExampleContainer>
|
|
350
|
+
<ExampleContainer>
|
|
351
|
+
<Title title="Suffix and action" theme="light" level={4} />
|
|
352
|
+
<DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
|
|
353
|
+
</ExampleContainer>
|
|
354
|
+
<ExampleContainer>
|
|
355
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
356
|
+
<DxcTextInput
|
|
357
|
+
label="Error text input"
|
|
358
|
+
helperText="Help message"
|
|
359
|
+
error="Error message."
|
|
360
|
+
defaultValue="Text"
|
|
361
|
+
clearable
|
|
362
|
+
optional
|
|
363
|
+
action={action}
|
|
364
|
+
/>
|
|
365
|
+
</ExampleContainer>
|
|
366
|
+
<ExampleContainer>
|
|
367
|
+
<Title title="Disabled and placeholder" theme="light" level={4} />
|
|
368
|
+
<DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
|
|
369
|
+
</ExampleContainer>
|
|
370
|
+
<ExampleContainer>
|
|
371
|
+
<Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
|
|
372
|
+
<DxcTextInput
|
|
373
|
+
label="Disabled text input"
|
|
374
|
+
helperText="Help message"
|
|
375
|
+
disabled
|
|
376
|
+
optional
|
|
377
|
+
defaultValue="Text"
|
|
378
|
+
action={action}
|
|
379
|
+
/>
|
|
380
|
+
</ExampleContainer>
|
|
381
|
+
</HalstackProvider>
|
|
382
|
+
</ExampleContainer>
|
|
300
383
|
</>
|
|
301
384
|
);
|
|
302
385
|
|
|
@@ -308,7 +391,11 @@ const AutosuggestListbox = () => {
|
|
|
308
391
|
<ExampleContainer>
|
|
309
392
|
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
310
393
|
<ExampleContainer>
|
|
311
|
-
<Title
|
|
394
|
+
<Title
|
|
395
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
396
|
+
theme="light"
|
|
397
|
+
level={3}
|
|
398
|
+
/>
|
|
312
399
|
<div
|
|
313
400
|
style={{
|
|
314
401
|
display: "flex",
|
|
@@ -322,6 +409,7 @@ const AutosuggestListbox = () => {
|
|
|
322
409
|
borderRadius: "4px",
|
|
323
410
|
overflow: "auto",
|
|
324
411
|
zIndex: "1300",
|
|
412
|
+
position: "relative",
|
|
325
413
|
}}
|
|
326
414
|
>
|
|
327
415
|
<DxcTextInput
|
|
@@ -434,7 +522,7 @@ const DarkAutosuggestListbox = () => {
|
|
|
434
522
|
<Title title="Dark theme" theme="dark" level={2} />
|
|
435
523
|
<ExampleContainer>
|
|
436
524
|
<Title title="Default with opened suggestions" theme="dark" level={3} />
|
|
437
|
-
<DxcFlex direction="column" gap="
|
|
525
|
+
<DxcFlex direction="column" gap="5rem">
|
|
438
526
|
<DxcTextInput label="Label" suggestions={countries} optional placeholder="Choose an option" />
|
|
439
527
|
<DxcCheckbox
|
|
440
528
|
label="You understand the selection and give your consent"
|