@dxc-technology/halstack-react 0.0.0-efa7c74 → 0.0.0-f00a97a
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 +10 -0
- package/BackgroundColorContext.js +1 -4
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +15 -47
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +8 -8
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +16 -17
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +8 -8
- package/alert/Alert.js +6 -3
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +6 -4
- package/badge/types.d.ts +5 -0
- package/{radio → badge}/types.js +0 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +51 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +24 -34
- package/box/Box.test.js +18 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +59 -82
- package/button/Button.stories.tsx +15 -8
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +8 -12
- package/card/Card.js +25 -28
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +45 -41
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +6 -8
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +282 -355
- package/date-input/DateInput.js +66 -55
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +50 -53
- package/dialog/Dialog.stories.tsx +1 -2
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +242 -272
- package/dropdown/Dropdown.stories.tsx +312 -0
- package/dropdown/Dropdown.test.js +591 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +30 -19
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +165 -83
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +12 -8
- package/file-input/types.d.ts +32 -7
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +32 -113
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +4 -4
- package/footer/types.d.ts +21 -17
- package/header/Header.js +97 -116
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +3 -2
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +71 -135
- package/layout/ApplicationLayout.stories.tsx +161 -0
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +42 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +61 -86
- package/link/Link.stories.tsx +99 -52
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +9 -29
- package/main.d.ts +12 -12
- package/main.js +64 -58
- package/number-input/NumberInput.js +14 -24
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +14 -10
- package/paginator/Paginator.js +19 -46
- package/paginator/Paginator.test.js +308 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +23 -19
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +26 -21
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +59 -53
- package/progress-bar/ProgressBar.stories.jsx +13 -11
- package/progress-bar/ProgressBar.test.js +110 -0
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +118 -0
- package/quick-nav/QuickNav.stories.tsx +264 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +141 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +281 -0
- package/radio-group/RadioGroup.stories.tsx +100 -0
- package/radio-group/RadioGroup.test.js +695 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +1 -1
- package/resultsetTable/ResultsetTable.js +9 -4
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/resultsetTable/types.d.ts +6 -2
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +199 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +158 -380
- package/select/Select.stories.tsx +231 -176
- package/select/Select.test.js +2175 -0
- package/select/types.d.ts +210 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +186 -54
- package/sidenav/Sidenav.stories.tsx +154 -139
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +7 -6
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +187 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +3 -3
- package/spinner/Spinner.stories.jsx +1 -0
- package/spinner/Spinner.test.js +64 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +129 -57
- package/switch/Switch.stories.tsx +21 -43
- package/switch/Switch.test.js +212 -0
- package/switch/types.d.ts +9 -6
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +17 -19
- package/tabs/Tabs.stories.tsx +7 -16
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +27 -15
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +18 -28
- package/tag/Tag.stories.tsx +26 -29
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +23 -14
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +100 -124
- package/text-input/TextInput.stories.tsx +473 -0
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +44 -23
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +39 -79
- package/textarea/Textarea.stories.jsx +37 -15
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +15 -17
- package/toggle-group/ToggleGroup.stories.tsx +27 -32
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +47 -26
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +112 -58
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +33 -24
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +13 -12
- package/ThemeContext.js +0 -246
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
package/date-input/DateInput.js
CHANGED
|
@@ -11,6 +11,8 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
17
|
|
|
16
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -23,13 +25,15 @@ var _ClickAwayListener = _interopRequireDefault(require("@material-ui/core/Click
|
|
|
23
25
|
|
|
24
26
|
var _Popover = _interopRequireDefault(require("@material-ui/core/Popover"));
|
|
25
27
|
|
|
26
|
-
var
|
|
28
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
27
29
|
|
|
28
|
-
var
|
|
30
|
+
var _dayjs2 = _interopRequireDefault(require("@date-io/dayjs"));
|
|
29
31
|
|
|
30
32
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
31
33
|
|
|
32
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
34
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
35
|
+
|
|
36
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
33
37
|
|
|
34
38
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
35
39
|
|
|
@@ -39,37 +43,37 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
39
43
|
|
|
40
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
45
|
|
|
46
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
+
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
|
+
|
|
50
|
+
var getValueForPicker = function getValueForPicker(value, format) {
|
|
51
|
+
return (0, _dayjs["default"])(value, format.toUpperCase(), true).format();
|
|
52
|
+
};
|
|
53
|
+
|
|
42
54
|
var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
_ref$
|
|
46
|
-
|
|
55
|
+
var label = _ref.label,
|
|
56
|
+
name = _ref.name,
|
|
57
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
58
|
+
defaultValue = _ref$defaultValue === void 0 ? "" : _ref$defaultValue,
|
|
47
59
|
value = _ref.value,
|
|
48
60
|
_ref$format = _ref.format,
|
|
49
61
|
format = _ref$format === void 0 ? "dd-MM-yyyy" : _ref$format,
|
|
50
|
-
|
|
51
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
62
|
+
helperText = _ref.helperText,
|
|
52
63
|
_ref$placeholder = _ref.placeholder,
|
|
53
64
|
placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
58
|
-
_ref$optional = _ref.optional,
|
|
59
|
-
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
65
|
+
clearable = _ref.clearable,
|
|
66
|
+
disabled = _ref.disabled,
|
|
67
|
+
optional = _ref.optional,
|
|
60
68
|
onChange = _ref.onChange,
|
|
61
69
|
onBlur = _ref.onBlur,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
_ref$autocomplete = _ref.autocomplete,
|
|
65
|
-
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
70
|
+
error = _ref.error,
|
|
71
|
+
autocomplete = _ref.autocomplete,
|
|
66
72
|
margin = _ref.margin,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
70
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
73
|
+
size = _ref.size,
|
|
74
|
+
tabIndex = _ref.tabIndex;
|
|
71
75
|
|
|
72
|
-
var _useState = (0, _react.useState)(
|
|
76
|
+
var _useState = (0, _react.useState)(defaultValue),
|
|
73
77
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
74
78
|
innerValue = _useState2[0],
|
|
75
79
|
setInnerValue = _useState2[1];
|
|
@@ -85,11 +89,13 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
85
89
|
setAnchorEl = _useState6[1];
|
|
86
90
|
|
|
87
91
|
var colorsTheme = (0, _useTheme["default"])();
|
|
92
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
93
|
+
var refDate = ref || (0, _react.useRef)(null);
|
|
88
94
|
|
|
89
95
|
var handleCalendarOnKeyDown = function handleCalendarOnKeyDown(event) {
|
|
90
|
-
switch (event.
|
|
91
|
-
case
|
|
92
|
-
|
|
96
|
+
switch (event.key) {
|
|
97
|
+
case "Esc":
|
|
98
|
+
case "Escape":
|
|
93
99
|
event.preventDefault();
|
|
94
100
|
setIsOpen(false);
|
|
95
101
|
break;
|
|
@@ -97,12 +103,13 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
97
103
|
};
|
|
98
104
|
|
|
99
105
|
var handleCalendarOnClick = function handleCalendarOnClick(newDate) {
|
|
100
|
-
var newValue = (0,
|
|
106
|
+
var newValue = (0, _dayjs["default"])(newDate).format(format.toUpperCase());
|
|
101
107
|
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
102
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
108
|
+
newDate !== null && newDate !== void 0 && newDate.toJSON() ? onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
103
109
|
value: newValue,
|
|
104
|
-
|
|
105
|
-
|
|
110
|
+
date: newDate
|
|
111
|
+
}) : onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
112
|
+
value: newValue
|
|
106
113
|
});
|
|
107
114
|
};
|
|
108
115
|
|
|
@@ -110,36 +117,39 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
110
117
|
var newValue = _ref2.value,
|
|
111
118
|
inputError = _ref2.error;
|
|
112
119
|
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
113
|
-
var
|
|
114
|
-
var invalidDateMessage = newValue !== "" && !
|
|
115
|
-
|
|
120
|
+
var dayjsDate = (0, _dayjs["default"])(newValue, format.toUpperCase(), true);
|
|
121
|
+
var invalidDateMessage = newValue !== "" && !dayjsDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
122
|
+
var callbackParams = inputError || invalidDateMessage ? {
|
|
116
123
|
value: newValue,
|
|
117
|
-
error: inputError || invalidDateMessage
|
|
118
|
-
|
|
119
|
-
|
|
124
|
+
error: inputError || invalidDateMessage
|
|
125
|
+
} : {
|
|
126
|
+
value: newValue
|
|
127
|
+
};
|
|
128
|
+
dayjsDate.isValid() ? onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, callbackParams), {}, {
|
|
129
|
+
date: dayjsDate.toDate()
|
|
130
|
+
})) : onChange === null || onChange === void 0 ? void 0 : onChange(callbackParams);
|
|
120
131
|
};
|
|
121
132
|
|
|
122
133
|
var handleIOnBlur = function handleIOnBlur(_ref3) {
|
|
123
134
|
var value = _ref3.value,
|
|
124
135
|
inputError = _ref3.error;
|
|
125
|
-
var
|
|
126
|
-
var invalidDateMessage = value !== "" && !
|
|
127
|
-
|
|
136
|
+
var dayjsDate = (0, _dayjs["default"])(value, format.toUpperCase(), true);
|
|
137
|
+
var invalidDateMessage = value !== "" && !dayjsDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
138
|
+
var callbackParams = inputError || invalidDateMessage ? {
|
|
128
139
|
value: value,
|
|
129
|
-
error: inputError || invalidDateMessage
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
error: inputError || invalidDateMessage
|
|
141
|
+
} : {
|
|
142
|
+
value: value
|
|
143
|
+
};
|
|
144
|
+
dayjsDate.isValid() ? onBlur === null || onBlur === void 0 ? void 0 : onBlur(_objectSpread(_objectSpread({}, callbackParams), {}, {
|
|
145
|
+
date: dayjsDate.toDate()
|
|
146
|
+
})) : onBlur === null || onBlur === void 0 ? void 0 : onBlur(callbackParams);
|
|
132
147
|
};
|
|
133
148
|
|
|
134
|
-
var
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var openCalendar = function openCalendar(event) {
|
|
139
|
-
if (event) {
|
|
140
|
-
setIsOpen(!isOpen);
|
|
141
|
-
setAnchorEl(event.currentTarget);
|
|
142
|
-
}
|
|
149
|
+
var openCalendar = function openCalendar() {
|
|
150
|
+
var dateBtn = refDate.current.getElementsByTagName("button")[0];
|
|
151
|
+
setIsOpen(!isOpen);
|
|
152
|
+
setAnchorEl(dateBtn);
|
|
143
153
|
};
|
|
144
154
|
|
|
145
155
|
var closeCalendar = function closeCalendar() {
|
|
@@ -303,10 +313,11 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
303
313
|
}, /*#__PURE__*/_react["default"].createElement(_core.MuiThemeProvider, {
|
|
304
314
|
theme: dateTheme
|
|
305
315
|
}, /*#__PURE__*/_react["default"].createElement(_pickers.MuiPickersUtilsProvider, {
|
|
306
|
-
utils:
|
|
316
|
+
utils: _dayjs2["default"]
|
|
307
317
|
}, /*#__PURE__*/_react["default"].createElement(StyledDPicker, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
308
318
|
label: label,
|
|
309
319
|
name: name,
|
|
320
|
+
defaultValue: defaultValue,
|
|
310
321
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
311
322
|
helperText: helperText,
|
|
312
323
|
placeholder: placeholder ? format.toUpperCase() : null,
|
|
@@ -321,7 +332,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
321
332
|
margin: margin,
|
|
322
333
|
size: size,
|
|
323
334
|
tabIndex: tabIndex,
|
|
324
|
-
ref:
|
|
335
|
+
ref: refDate
|
|
325
336
|
}), /*#__PURE__*/_react["default"].createElement(_Popover["default"], {
|
|
326
337
|
onKeyDown: handleCalendarOnKeyDown,
|
|
327
338
|
open: isOpen,
|
|
@@ -346,7 +357,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
346
357
|
"aria-modal": "true"
|
|
347
358
|
}, /*#__PURE__*/_react["default"].createElement(_pickers.DatePicker, {
|
|
348
359
|
variant: "static",
|
|
349
|
-
value: getValueForPicker(),
|
|
360
|
+
value: getValueForPicker(value !== null && value !== void 0 ? value : innerValue, format),
|
|
350
361
|
onChange: function onChange(date) {
|
|
351
362
|
return handleCalendarOnClick(date);
|
|
352
363
|
},
|
|
@@ -19,7 +19,7 @@ export const Chromatic = () => (
|
|
|
19
19
|
</ExampleContainer>
|
|
20
20
|
<ExampleContainer>
|
|
21
21
|
<Title title="Disabled" theme="light" level={4} />
|
|
22
|
-
<DxcDateInput label="Disabled date input" helperText="Help message"
|
|
22
|
+
<DxcDateInput label="Disabled date input" helperText="Help message" defaultValue="06-04-2027" clearable disabled />
|
|
23
23
|
</ExampleContainer>
|
|
24
24
|
<ExampleContainer>
|
|
25
25
|
<Title title="Invalid" theme="light" level={4} />
|
|
@@ -27,7 +27,7 @@ export const Chromatic = () => (
|
|
|
27
27
|
</ExampleContainer>
|
|
28
28
|
<ExampleContainer>
|
|
29
29
|
<Title title="Relation between icons" theme="light" level={4} />
|
|
30
|
-
<DxcDateInput label="Error date input" error="Error message."
|
|
30
|
+
<DxcDateInput label="Error date input" error="Error message." defaultValue="06-04-2027" clearable />
|
|
31
31
|
</ExampleContainer>
|
|
32
32
|
<BackgroundColorProvider color="#333333">
|
|
33
33
|
<DarkContainer>
|
|
@@ -38,7 +38,7 @@ export const Chromatic = () => (
|
|
|
38
38
|
</ExampleContainer>
|
|
39
39
|
<ExampleContainer>
|
|
40
40
|
<Title title="Disabled" theme="dark" level={4} />
|
|
41
|
-
<DxcDateInput label="Disabled Date input" helperText="Help message"
|
|
41
|
+
<DxcDateInput label="Disabled Date input" helperText="Help message" defaultValue="06-04-2027" clearable disabled />
|
|
42
42
|
</ExampleContainer>
|
|
43
43
|
<ExampleContainer>
|
|
44
44
|
<Title title="Invalid" theme="dark" level={4} />
|
|
@@ -46,7 +46,7 @@ export const Chromatic = () => (
|
|
|
46
46
|
</ExampleContainer>
|
|
47
47
|
<ExampleContainer>
|
|
48
48
|
<Title title="Relation between icons" theme="dark" level={4} />
|
|
49
|
-
<DxcDateInput label="Error date input"
|
|
49
|
+
<DxcDateInput label="Error date input" defaultValue="06-04-2027" error="Error message." clearable />
|
|
50
50
|
</ExampleContainer>
|
|
51
51
|
</DarkContainer>
|
|
52
52
|
</BackgroundColorProvider>
|
|
@@ -98,7 +98,7 @@ export const Chromatic = () => (
|
|
|
98
98
|
const DatePicker = () => (
|
|
99
99
|
<ExampleContainer expanded>
|
|
100
100
|
<Title title="Show date input" theme="light" level={4} />
|
|
101
|
-
<DxcDateInput label="Date input"
|
|
101
|
+
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
102
102
|
</ExampleContainer>
|
|
103
103
|
);
|
|
104
104
|
|
|
@@ -113,7 +113,7 @@ ShowDatePicker.play = async ({ canvasElement }) => {
|
|
|
113
113
|
const YearPicker = () => (
|
|
114
114
|
<ExampleContainer expanded>
|
|
115
115
|
<Title title="Show date input" theme="light" level={4} />
|
|
116
|
-
<DxcDateInput label="Date input"
|
|
116
|
+
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
117
117
|
</ExampleContainer>
|
|
118
118
|
);
|
|
119
119
|
|
|
@@ -126,7 +126,7 @@ ShowYearPicker.play = async () => {
|
|
|
126
126
|
const YearPickerFocus = () => (
|
|
127
127
|
<ExampleContainer expanded>
|
|
128
128
|
<Title title="Show date input" theme="light" level={4} />
|
|
129
|
-
<DxcDateInput label="Date input"
|
|
129
|
+
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
130
130
|
</ExampleContainer>
|
|
131
131
|
);
|
|
132
132
|
|