@dxc-technology/halstack-react 0.0.0-4a5e7d8 → 0.0.0-4a67e25
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.js +0 -1
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +294 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +122 -135
- package/accordion/Accordion.stories.tsx +20 -14
- package/accordion/Accordion.test.js +71 -0
- package/accordion/types.d.ts +11 -10
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +15 -36
- package/accordion-group/AccordionGroup.stories.tsx +28 -2
- package/accordion-group/AccordionGroup.test.js +126 -0
- package/accordion-group/types.d.ts +16 -9
- package/alert/Alert.js +5 -2
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +5 -3
- 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 +23 -33
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +1 -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 +57 -80
- 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 +24 -27
- package/card/Card.stories.tsx +1 -1
- package/card/Card.test.js +50 -0
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +106 -109
- package/checkbox/Checkbox.stories.tsx +146 -130
- package/checkbox/Checkbox.test.js +155 -0
- package/checkbox/types.d.ts +14 -6
- package/chip/Chip.d.ts +1 -1
- package/chip/Chip.js +14 -52
- package/chip/Chip.stories.tsx +6 -8
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +5 -13
- package/common/variables.js +274 -340
- package/date-input/DateInput.js +62 -48
- package/date-input/DateInput.stories.tsx +19 -8
- package/date-input/DateInput.test.js +543 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +48 -51
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -273
- package/dropdown/Dropdown.stories.tsx +144 -79
- package/dropdown/Dropdown.test.js +585 -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 +29 -18
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +159 -129
- package/file-input/FileInput.stories.tsx +535 -0
- package/file-input/FileInput.test.js +498 -0
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +43 -66
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/flex/types.js +5 -0
- package/footer/Footer.js +24 -99
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +95 -114
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- 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 +16 -6
- package/layout/ApplicationLayout.js +71 -125
- package/layout/ApplicationLayout.stories.tsx +84 -93
- 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 +18 -33
- 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 +11 -15
- package/main.js +53 -79
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +542 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +22 -16
- package/paginator/Paginator.js +17 -38
- 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 +7 -4
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/PasswordInput.test.js +181 -0
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +57 -51
- 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 +117 -0
- package/quick-nav/QuickNav.stories.tsx +342 -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 +156 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +283 -0
- package/radio-group/RadioGroup.stories.tsx +101 -0
- package/radio-group/RadioGroup.test.js +722 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.js +6 -5
- package/resultsetTable/ResultsetTable.stories.tsx +7 -8
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +198 -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 +148 -366
- package/select/Select.stories.tsx +231 -176
- package/select/Select.test.js +2233 -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 +184 -52
- 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 +2 -2
- package/slider/Slider.js +122 -96
- package/slider/Slider.stories.tsx +15 -9
- package/slider/Slider.test.js +250 -0
- package/slider/types.d.ts +10 -2
- package/spinner/Spinner.js +1 -1
- 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 +150 -67
- package/switch/Switch.stories.tsx +21 -43
- package/switch/Switch.test.js +225 -0
- package/switch/types.d.ts +12 -4
- package/table/Table.js +1 -1
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +364 -110
- package/tabs/Tabs.stories.tsx +81 -16
- package/tabs/Tabs.test.js +351 -0
- package/tabs/types.d.ts +39 -17
- 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/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +57 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +213 -322
- package/text-input/TextInput.stories.tsx +218 -193
- package/text-input/TextInput.test.js +1624 -0
- package/text-input/types.d.ts +51 -13
- package/textarea/Textarea.js +20 -27
- package/textarea/Textarea.stories.jsx +37 -15
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +9 -1
- 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.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 +58 -54
- package/wizard/Wizard.stories.tsx +33 -24
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +10 -5
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -243
- 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/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/list/List.d.ts +0 -8
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -85
- 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/row/Row.d.ts +0 -11
- package/row/Row.js +0 -124
- package/row/Row.stories.tsx +0 -223
- package/select/index.d.ts +0 -131
- package/stack/Stack.d.ts +0 -10
- package/stack/Stack.js +0 -94
- package/stack/Stack.stories.tsx +0 -150
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- 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/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,14 +25,16 @@ 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
34
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
33
35
|
|
|
36
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
37
|
+
|
|
34
38
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
35
39
|
|
|
36
40
|
var _templateObject;
|
|
@@ -39,34 +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
55
|
var label = _ref.label,
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
name = _ref.name,
|
|
57
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
58
|
+
defaultValue = _ref$defaultValue === void 0 ? "" : _ref$defaultValue,
|
|
46
59
|
value = _ref.value,
|
|
47
60
|
_ref$format = _ref.format,
|
|
48
61
|
format = _ref$format === void 0 ? "dd-MM-yyyy" : _ref$format,
|
|
49
62
|
helperText = _ref.helperText,
|
|
50
63
|
_ref$placeholder = _ref.placeholder,
|
|
51
64
|
placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
56
|
-
_ref$optional = _ref.optional,
|
|
57
|
-
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
65
|
+
clearable = _ref.clearable,
|
|
66
|
+
disabled = _ref.disabled,
|
|
67
|
+
optional = _ref.optional,
|
|
58
68
|
onChange = _ref.onChange,
|
|
59
69
|
onBlur = _ref.onBlur,
|
|
60
70
|
error = _ref.error,
|
|
61
|
-
|
|
62
|
-
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
71
|
+
autocomplete = _ref.autocomplete,
|
|
63
72
|
margin = _ref.margin,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
67
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
73
|
+
size = _ref.size,
|
|
74
|
+
tabIndex = _ref.tabIndex;
|
|
68
75
|
|
|
69
|
-
var _useState = (0, _react.useState)(
|
|
76
|
+
var _useState = (0, _react.useState)(defaultValue),
|
|
70
77
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
71
78
|
innerValue = _useState2[0],
|
|
72
79
|
setInnerValue = _useState2[1];
|
|
@@ -82,11 +89,13 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
82
89
|
setAnchorEl = _useState6[1];
|
|
83
90
|
|
|
84
91
|
var colorsTheme = (0, _useTheme["default"])();
|
|
92
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
93
|
+
var refDate = ref || (0, _react.useRef)(null);
|
|
85
94
|
|
|
86
95
|
var handleCalendarOnKeyDown = function handleCalendarOnKeyDown(event) {
|
|
87
|
-
switch (event.
|
|
88
|
-
case
|
|
89
|
-
|
|
96
|
+
switch (event.key) {
|
|
97
|
+
case "Esc":
|
|
98
|
+
case "Escape":
|
|
90
99
|
event.preventDefault();
|
|
91
100
|
setIsOpen(false);
|
|
92
101
|
break;
|
|
@@ -94,12 +103,13 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
94
103
|
};
|
|
95
104
|
|
|
96
105
|
var handleCalendarOnClick = function handleCalendarOnClick(newDate) {
|
|
97
|
-
var newValue = (0,
|
|
106
|
+
var newValue = (0, _dayjs["default"])(newDate).format(format.toUpperCase());
|
|
98
107
|
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
99
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
108
|
+
newDate !== null && newDate !== void 0 && newDate.toJSON() ? onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
100
109
|
value: newValue,
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
date: newDate
|
|
111
|
+
}) : onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
112
|
+
value: newValue
|
|
103
113
|
});
|
|
104
114
|
};
|
|
105
115
|
|
|
@@ -107,36 +117,39 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
107
117
|
var newValue = _ref2.value,
|
|
108
118
|
inputError = _ref2.error;
|
|
109
119
|
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
110
|
-
var
|
|
111
|
-
var invalidDateMessage = newValue !== "" && !
|
|
112
|
-
|
|
120
|
+
var dayjsDate = (0, _dayjs["default"])(newValue, format.toUpperCase(), true);
|
|
121
|
+
var invalidDateMessage = newValue !== "" && !dayjsDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
122
|
+
var callbackParams = inputError || invalidDateMessage ? {
|
|
113
123
|
value: newValue,
|
|
114
|
-
error: inputError || invalidDateMessage
|
|
115
|
-
|
|
116
|
-
|
|
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);
|
|
117
131
|
};
|
|
118
132
|
|
|
119
133
|
var handleIOnBlur = function handleIOnBlur(_ref3) {
|
|
120
134
|
var value = _ref3.value,
|
|
121
135
|
inputError = _ref3.error;
|
|
122
|
-
var
|
|
123
|
-
var invalidDateMessage = value !== "" && !
|
|
124
|
-
|
|
136
|
+
var dayjsDate = (0, _dayjs["default"])(value, format.toUpperCase(), true);
|
|
137
|
+
var invalidDateMessage = value !== "" && !dayjsDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
138
|
+
var callbackParams = inputError || invalidDateMessage ? {
|
|
125
139
|
value: value,
|
|
126
|
-
error: inputError || invalidDateMessage
|
|
127
|
-
|
|
128
|
-
|
|
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);
|
|
129
147
|
};
|
|
130
148
|
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var openCalendar = function openCalendar(event) {
|
|
136
|
-
if (event) {
|
|
137
|
-
setIsOpen(!isOpen);
|
|
138
|
-
setAnchorEl(event.currentTarget);
|
|
139
|
-
}
|
|
149
|
+
var openCalendar = function openCalendar() {
|
|
150
|
+
var dateBtn = refDate.current.getElementsByTagName("button")[0];
|
|
151
|
+
setIsOpen(!isOpen);
|
|
152
|
+
setAnchorEl(dateBtn);
|
|
140
153
|
};
|
|
141
154
|
|
|
142
155
|
var closeCalendar = function closeCalendar() {
|
|
@@ -300,10 +313,11 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
300
313
|
}, /*#__PURE__*/_react["default"].createElement(_core.MuiThemeProvider, {
|
|
301
314
|
theme: dateTheme
|
|
302
315
|
}, /*#__PURE__*/_react["default"].createElement(_pickers.MuiPickersUtilsProvider, {
|
|
303
|
-
utils:
|
|
316
|
+
utils: _dayjs2["default"]
|
|
304
317
|
}, /*#__PURE__*/_react["default"].createElement(StyledDPicker, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
305
318
|
label: label,
|
|
306
319
|
name: name,
|
|
320
|
+
defaultValue: defaultValue,
|
|
307
321
|
value: value !== null && value !== void 0 ? value : innerValue,
|
|
308
322
|
helperText: helperText,
|
|
309
323
|
placeholder: placeholder ? format.toUpperCase() : null,
|
|
@@ -318,7 +332,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
318
332
|
margin: margin,
|
|
319
333
|
size: size,
|
|
320
334
|
tabIndex: tabIndex,
|
|
321
|
-
ref:
|
|
335
|
+
ref: refDate
|
|
322
336
|
}), /*#__PURE__*/_react["default"].createElement(_Popover["default"], {
|
|
323
337
|
onKeyDown: handleCalendarOnKeyDown,
|
|
324
338
|
open: isOpen,
|
|
@@ -343,7 +357,7 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
343
357
|
"aria-modal": "true"
|
|
344
358
|
}, /*#__PURE__*/_react["default"].createElement(_pickers.DatePicker, {
|
|
345
359
|
variant: "static",
|
|
346
|
-
value: getValueForPicker(),
|
|
360
|
+
value: getValueForPicker(value !== null && value !== void 0 ? value : innerValue, format),
|
|
347
361
|
onChange: function onChange(date) {
|
|
348
362
|
return handleCalendarOnClick(date);
|
|
349
363
|
},
|
|
@@ -19,7 +19,13 @@ export const Chromatic = () => (
|
|
|
19
19
|
</ExampleContainer>
|
|
20
20
|
<ExampleContainer>
|
|
21
21
|
<Title title="Disabled" theme="light" level={4} />
|
|
22
|
-
<DxcDateInput
|
|
22
|
+
<DxcDateInput
|
|
23
|
+
label="Disabled date input"
|
|
24
|
+
helperText="Help message"
|
|
25
|
+
defaultValue="06-04-2027"
|
|
26
|
+
clearable
|
|
27
|
+
disabled
|
|
28
|
+
/>
|
|
23
29
|
</ExampleContainer>
|
|
24
30
|
<ExampleContainer>
|
|
25
31
|
<Title title="Invalid" theme="light" level={4} />
|
|
@@ -27,7 +33,7 @@ export const Chromatic = () => (
|
|
|
27
33
|
</ExampleContainer>
|
|
28
34
|
<ExampleContainer>
|
|
29
35
|
<Title title="Relation between icons" theme="light" level={4} />
|
|
30
|
-
<DxcDateInput label="Error date input" error="Error message."
|
|
36
|
+
<DxcDateInput label="Error date input" error="Error message." defaultValue="06-04-2027" clearable />
|
|
31
37
|
</ExampleContainer>
|
|
32
38
|
<BackgroundColorProvider color="#333333">
|
|
33
39
|
<DarkContainer>
|
|
@@ -38,7 +44,13 @@ export const Chromatic = () => (
|
|
|
38
44
|
</ExampleContainer>
|
|
39
45
|
<ExampleContainer>
|
|
40
46
|
<Title title="Disabled" theme="dark" level={4} />
|
|
41
|
-
<DxcDateInput
|
|
47
|
+
<DxcDateInput
|
|
48
|
+
label="Disabled Date input"
|
|
49
|
+
helperText="Help message"
|
|
50
|
+
defaultValue="06-04-2027"
|
|
51
|
+
clearable
|
|
52
|
+
disabled
|
|
53
|
+
/>
|
|
42
54
|
</ExampleContainer>
|
|
43
55
|
<ExampleContainer>
|
|
44
56
|
<Title title="Invalid" theme="dark" level={4} />
|
|
@@ -46,7 +58,7 @@ export const Chromatic = () => (
|
|
|
46
58
|
</ExampleContainer>
|
|
47
59
|
<ExampleContainer>
|
|
48
60
|
<Title title="Relation between icons" theme="dark" level={4} />
|
|
49
|
-
<DxcDateInput label="Error date input"
|
|
61
|
+
<DxcDateInput label="Error date input" defaultValue="06-04-2027" error="Error message." clearable />
|
|
50
62
|
</ExampleContainer>
|
|
51
63
|
</DarkContainer>
|
|
52
64
|
</BackgroundColorProvider>
|
|
@@ -98,7 +110,7 @@ export const Chromatic = () => (
|
|
|
98
110
|
const DatePicker = () => (
|
|
99
111
|
<ExampleContainer expanded>
|
|
100
112
|
<Title title="Show date input" theme="light" level={4} />
|
|
101
|
-
<DxcDateInput label="Date input"
|
|
113
|
+
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
102
114
|
</ExampleContainer>
|
|
103
115
|
);
|
|
104
116
|
|
|
@@ -107,13 +119,12 @@ ShowDatePicker.play = async ({ canvasElement }) => {
|
|
|
107
119
|
const canvas = within(canvasElement);
|
|
108
120
|
const dateBtn = canvas.getByRole("button");
|
|
109
121
|
await userEvent.click(dateBtn);
|
|
110
|
-
await userEvent.tab();
|
|
111
122
|
};
|
|
112
123
|
|
|
113
124
|
const YearPicker = () => (
|
|
114
125
|
<ExampleContainer expanded>
|
|
115
126
|
<Title title="Show date input" theme="light" level={4} />
|
|
116
|
-
<DxcDateInput label="Date input"
|
|
127
|
+
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
117
128
|
</ExampleContainer>
|
|
118
129
|
);
|
|
119
130
|
|
|
@@ -126,7 +137,7 @@ ShowYearPicker.play = async () => {
|
|
|
126
137
|
const YearPickerFocus = () => (
|
|
127
138
|
<ExampleContainer expanded>
|
|
128
139
|
<Title title="Show date input" theme="light" level={4} />
|
|
129
|
-
<DxcDateInput label="Date input"
|
|
140
|
+
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
130
141
|
</ExampleContainer>
|
|
131
142
|
);
|
|
132
143
|
|