@dxc-technology/halstack-react 0.0.0-eca8a89 → 0.0.0-ecc45e2
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 +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +13 -45
- package/accordion/Accordion.stories.tsx +20 -13
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +7 -7
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +14 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +7 -7
- package/alert/Alert.js +4 -1
- 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 +22 -32
- 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 +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/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- 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 +1 -1
- package/chip/Chip.js +16 -54
- package/chip/Chip.stories.tsx +6 -8
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +7 -15
- package/common/variables.js +267 -337
- package/date-input/DateInput.js +62 -48
- 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 +48 -51
- 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 +29 -18
- package/file-input/FileInput.js +111 -39
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +7 -5
- 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.js +24 -99
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +1 -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 +2 -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 +83 -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 +60 -85
- 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 +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +14 -10
- 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 +180 -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 +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.js +5 -2
- 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 +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 +146 -366
- 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 +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 +1 -1
- package/slider/Slider.js +5 -4
- 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 +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 +127 -55
- package/switch/Switch.stories.tsx +21 -43
- package/switch/Switch.test.js +212 -0
- package/switch/types.d.ts +9 -6
- 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 +16 -18
- 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 +17 -27
- 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 +80 -105
- package/text-input/TextInput.stories.tsx +35 -18
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +32 -13
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +19 -56
- 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 +12 -14
- package/toggle-group/ToggleGroup.stories.tsx +27 -32
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +46 -25
- 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 +111 -57
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +33 -24
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +12 -11
- 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 -7
- package/list/List.js +0 -37
- package/list/List.stories.tsx +0 -70
- 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/textarea/index.d.ts +0 -127
- 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,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,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
|
|