@dxc-technology/halstack-react 0.0.0-feed711 → 0.0.0-ff13db1
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/README.md +46 -0
- package/dist/index.d.mts +6670 -0
- package/dist/index.d.ts +6670 -0
- package/dist/index.js +14451 -0
- package/dist/index.mjs +14394 -0
- package/package.json +69 -72
- package/BackgroundColorContext.d.ts +0 -10
- package/BackgroundColorContext.js +0 -47
- package/HalstackContext.d.ts +0 -12
- package/HalstackContext.js +0 -295
- package/accordion/Accordion.d.ts +0 -4
- package/accordion/Accordion.js +0 -226
- package/accordion/Accordion.stories.tsx +0 -307
- package/accordion/Accordion.test.js +0 -72
- package/accordion/types.d.ts +0 -68
- package/accordion/types.js +0 -5
- package/accordion-group/AccordionGroup.d.ts +0 -7
- package/accordion-group/AccordionGroup.js +0 -169
- package/accordion-group/AccordionGroup.stories.tsx +0 -225
- package/accordion-group/AccordionGroup.test.js +0 -151
- package/accordion-group/types.d.ts +0 -72
- package/accordion-group/types.js +0 -5
- package/alert/Alert.d.ts +0 -4
- package/alert/Alert.js +0 -293
- package/alert/Alert.stories.tsx +0 -170
- package/alert/Alert.test.js +0 -92
- package/alert/types.d.ts +0 -49
- package/alert/types.js +0 -5
- package/badge/Badge.d.ts +0 -4
- package/badge/Badge.js +0 -61
- package/badge/types.d.ts +0 -5
- package/badge/types.js +0 -5
- package/bleed/Bleed.d.ts +0 -3
- package/bleed/Bleed.js +0 -51
- package/bleed/Bleed.stories.tsx +0 -341
- package/bleed/types.d.ts +0 -37
- package/bleed/types.js +0 -5
- package/box/Box.d.ts +0 -4
- package/box/Box.js +0 -116
- package/box/Box.stories.tsx +0 -132
- package/box/Box.test.js +0 -18
- package/box/types.d.ts +0 -43
- package/box/types.js +0 -5
- package/bulleted-list/BulletedList.d.ts +0 -7
- package/bulleted-list/BulletedList.js +0 -123
- package/bulleted-list/BulletedList.stories.tsx +0 -200
- package/bulleted-list/types.d.ts +0 -11
- package/bulleted-list/types.js +0 -5
- package/button/Button.d.ts +0 -4
- package/button/Button.js +0 -156
- package/button/Button.stories.tsx +0 -283
- package/button/Button.test.js +0 -35
- package/button/types.d.ts +0 -53
- package/button/types.js +0 -5
- package/card/Card.d.ts +0 -4
- package/card/Card.js +0 -161
- package/card/Card.stories.tsx +0 -201
- package/card/Card.test.js +0 -50
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +0 -67
- package/card/types.js +0 -5
- package/checkbox/Checkbox.d.ts +0 -4
- package/checkbox/Checkbox.js +0 -257
- package/checkbox/Checkbox.stories.tsx +0 -188
- package/checkbox/Checkbox.test.js +0 -78
- package/checkbox/types.d.ts +0 -64
- package/checkbox/types.js +0 -5
- package/chip/Chip.d.ts +0 -4
- package/chip/Chip.js +0 -161
- package/chip/Chip.stories.tsx +0 -119
- package/chip/Chip.test.js +0 -56
- package/chip/types.d.ts +0 -45
- package/chip/types.js +0 -5
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -32
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/common/utils.js +0 -22
- package/common/variables.js +0 -1504
- package/date-input/DateInput.d.ts +0 -4
- package/date-input/DateInput.js +0 -372
- package/date-input/DateInput.stories.tsx +0 -138
- package/date-input/DateInput.test.js +0 -479
- package/date-input/types.d.ts +0 -107
- package/date-input/types.js +0 -5
- package/dialog/Dialog.d.ts +0 -4
- package/dialog/Dialog.js +0 -162
- package/dialog/Dialog.stories.tsx +0 -211
- package/dialog/Dialog.test.js +0 -70
- package/dialog/types.d.ts +0 -43
- package/dialog/types.js +0 -5
- package/dropdown/Dropdown.d.ts +0 -4
- package/dropdown/Dropdown.js +0 -387
- package/dropdown/Dropdown.stories.tsx +0 -312
- package/dropdown/Dropdown.test.js +0 -591
- package/dropdown/DropdownMenu.d.ts +0 -4
- package/dropdown/DropdownMenu.js +0 -80
- package/dropdown/DropdownMenuItem.d.ts +0 -4
- package/dropdown/DropdownMenuItem.js +0 -92
- package/dropdown/types.d.ts +0 -100
- package/dropdown/types.js +0 -5
- package/file-input/FileInput.d.ts +0 -4
- package/file-input/FileInput.js +0 -593
- package/file-input/FileInput.stories.tsx +0 -507
- package/file-input/FileInput.test.js +0 -457
- package/file-input/FileItem.d.ts +0 -14
- package/file-input/FileItem.js +0 -186
- package/file-input/types.d.ts +0 -112
- package/file-input/types.js +0 -5
- package/flex/Flex.d.ts +0 -4
- package/flex/Flex.js +0 -57
- package/flex/Flex.stories.tsx +0 -103
- package/flex/types.d.ts +0 -21
- package/flex/types.js +0 -5
- package/footer/Footer.d.ts +0 -4
- package/footer/Footer.js +0 -185
- package/footer/Footer.stories.tsx +0 -130
- package/footer/Footer.test.js +0 -109
- package/footer/Icons.d.ts +0 -2
- package/footer/Icons.js +0 -77
- package/footer/types.d.ts +0 -65
- package/footer/types.js +0 -5
- package/header/Header.d.ts +0 -7
- package/header/Header.js +0 -305
- package/header/Header.stories.tsx +0 -172
- package/header/Header.test.js +0 -79
- package/header/Icons.d.ts +0 -2
- package/header/Icons.js +0 -34
- package/header/types.d.ts +0 -47
- package/header/types.js +0 -5
- package/heading/Heading.d.ts +0 -4
- package/heading/Heading.js +0 -159
- package/heading/Heading.stories.tsx +0 -54
- package/heading/Heading.test.js +0 -186
- package/heading/types.d.ts +0 -33
- package/heading/types.js +0 -5
- package/inset/Inset.d.ts +0 -3
- package/inset/Inset.js +0 -51
- package/inset/Inset.stories.tsx +0 -229
- package/inset/types.d.ts +0 -37
- package/inset/types.js +0 -5
- package/layout/ApplicationLayout.d.ts +0 -20
- package/layout/ApplicationLayout.js +0 -171
- package/layout/ApplicationLayout.stories.tsx +0 -161
- package/layout/Icons.d.ts +0 -5
- package/layout/Icons.js +0 -66
- package/layout/SidenavContext.d.ts +0 -5
- package/layout/SidenavContext.js +0 -19
- package/layout/types.d.ts +0 -42
- package/layout/types.js +0 -5
- package/link/Link.d.ts +0 -4
- package/link/Link.js +0 -136
- package/link/Link.stories.tsx +0 -193
- package/link/Link.test.js +0 -83
- package/link/types.d.ts +0 -54
- package/link/types.js +0 -5
- package/main.d.ts +0 -44
- package/main.js +0 -369
- package/number-input/NumberInput.d.ts +0 -4
- package/number-input/NumberInput.js +0 -76
- package/number-input/NumberInput.stories.tsx +0 -115
- package/number-input/NumberInput.test.js +0 -506
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/number-input/numberInputContextTypes.js +0 -5
- package/number-input/types.d.ts +0 -124
- package/number-input/types.js +0 -5
- package/paginator/Icons.js +0 -66
- package/paginator/Paginator.d.ts +0 -4
- package/paginator/Paginator.js +0 -171
- package/paginator/Paginator.stories.tsx +0 -63
- package/paginator/Paginator.test.js +0 -308
- package/paginator/types.d.ts +0 -38
- package/paginator/types.js +0 -5
- package/paragraph/Paragraph.d.ts +0 -6
- package/paragraph/Paragraph.js +0 -38
- package/paragraph/Paragraph.stories.tsx +0 -44
- package/password-input/PasswordInput.d.ts +0 -4
- package/password-input/PasswordInput.js +0 -166
- package/password-input/PasswordInput.stories.tsx +0 -131
- package/password-input/PasswordInput.test.js +0 -180
- package/password-input/types.d.ts +0 -110
- package/password-input/types.js +0 -5
- package/progress-bar/ProgressBar.d.ts +0 -4
- package/progress-bar/ProgressBar.js +0 -176
- package/progress-bar/ProgressBar.stories.jsx +0 -60
- package/progress-bar/ProgressBar.test.js +0 -110
- package/progress-bar/types.d.ts +0 -36
- package/progress-bar/types.js +0 -5
- package/quick-nav/QuickNav.d.ts +0 -4
- package/quick-nav/QuickNav.js +0 -118
- package/quick-nav/QuickNav.stories.tsx +0 -264
- package/quick-nav/types.d.ts +0 -21
- package/quick-nav/types.js +0 -5
- package/radio-group/Radio.d.ts +0 -4
- package/radio-group/Radio.js +0 -141
- package/radio-group/RadioGroup.d.ts +0 -4
- package/radio-group/RadioGroup.js +0 -281
- package/radio-group/RadioGroup.stories.tsx +0 -100
- package/radio-group/RadioGroup.test.js +0 -695
- package/radio-group/types.d.ts +0 -114
- package/radio-group/types.js +0 -5
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/resultsetTable/ResultsetTable.stories.tsx +0 -275
- package/resultsetTable/ResultsetTable.test.js +0 -348
- package/resultsetTable/types.d.ts +0 -67
- package/resultsetTable/types.js +0 -5
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -93
- package/select/Listbox.d.ts +0 -4
- package/select/Listbox.js +0 -199
- package/select/Option.d.ts +0 -4
- package/select/Option.js +0 -110
- package/select/Select.d.ts +0 -4
- package/select/Select.js +0 -643
- package/select/Select.stories.tsx +0 -627
- package/select/Select.test.js +0 -2175
- package/select/types.d.ts +0 -210
- package/select/types.js +0 -5
- package/sidenav/Sidenav.d.ts +0 -10
- package/sidenav/Sidenav.js +0 -268
- package/sidenav/Sidenav.stories.tsx +0 -180
- package/sidenav/Sidenav.test.js +0 -44
- package/sidenav/types.d.ts +0 -73
- package/sidenav/types.js +0 -5
- package/slider/Slider.d.ts +0 -4
- package/slider/Slider.js +0 -318
- package/slider/Slider.stories.tsx +0 -177
- package/slider/Slider.test.js +0 -187
- package/slider/types.d.ts +0 -82
- package/slider/types.js +0 -5
- package/spinner/Spinner.d.ts +0 -4
- package/spinner/Spinner.js +0 -250
- package/spinner/Spinner.stories.jsx +0 -103
- package/spinner/Spinner.test.js +0 -64
- package/spinner/types.d.ts +0 -32
- package/spinner/types.js +0 -5
- package/switch/Switch.d.ts +0 -4
- package/switch/Switch.js +0 -251
- package/switch/Switch.stories.tsx +0 -138
- package/switch/Switch.test.js +0 -212
- package/switch/types.d.ts +0 -61
- package/switch/types.js +0 -5
- package/table/Table.d.ts +0 -4
- package/table/Table.js +0 -118
- package/table/Table.stories.jsx +0 -277
- package/table/Table.test.js +0 -26
- package/table/types.d.ts +0 -21
- package/table/types.js +0 -5
- package/tabs/Tabs.d.ts +0 -4
- package/tabs/Tabs.js +0 -211
- package/tabs/Tabs.stories.tsx +0 -112
- package/tabs/Tabs.test.js +0 -140
- package/tabs/types.d.ts +0 -82
- package/tabs/types.js +0 -5
- package/tabs-nav/NavTabs.d.ts +0 -8
- package/tabs-nav/NavTabs.js +0 -125
- package/tabs-nav/NavTabs.stories.tsx +0 -170
- package/tabs-nav/NavTabs.test.js +0 -82
- package/tabs-nav/Tab.d.ts +0 -4
- package/tabs-nav/Tab.js +0 -130
- package/tabs-nav/types.d.ts +0 -53
- package/tabs-nav/types.js +0 -5
- package/tag/Tag.d.ts +0 -4
- package/tag/Tag.js +0 -183
- package/tag/Tag.stories.tsx +0 -142
- package/tag/Tag.test.js +0 -60
- package/tag/types.d.ts +0 -69
- package/tag/types.js +0 -5
- package/text-input/Suggestion.d.ts +0 -4
- package/text-input/Suggestion.js +0 -55
- package/text-input/TextInput.d.ts +0 -4
- package/text-input/TextInput.js +0 -761
- package/text-input/TextInput.stories.tsx +0 -473
- package/text-input/TextInput.test.js +0 -1712
- package/text-input/types.d.ts +0 -178
- package/text-input/types.js +0 -5
- package/textarea/Textarea.d.ts +0 -4
- package/textarea/Textarea.js +0 -277
- package/textarea/Textarea.stories.jsx +0 -157
- package/textarea/Textarea.test.js +0 -437
- package/textarea/types.d.ts +0 -137
- package/textarea/types.js +0 -5
- package/toggle-group/ToggleGroup.d.ts +0 -4
- package/toggle-group/ToggleGroup.js +0 -215
- package/toggle-group/ToggleGroup.stories.tsx +0 -173
- package/toggle-group/ToggleGroup.test.js +0 -156
- package/toggle-group/types.d.ts +0 -105
- package/toggle-group/types.js +0 -5
- package/typography/Typography.d.ts +0 -4
- package/typography/Typography.js +0 -131
- package/typography/Typography.stories.tsx +0 -198
- package/typography/types.d.ts +0 -18
- package/typography/types.js +0 -5
- package/useTheme.d.ts +0 -2
- package/useTheme.js +0 -22
- package/useTranslatedLabels.d.ts +0 -2
- package/useTranslatedLabels.js +0 -20
- package/wizard/Wizard.d.ts +0 -4
- package/wizard/Wizard.js +0 -285
- package/wizard/Wizard.stories.tsx +0 -233
- package/wizard/Wizard.test.js +0 -141
- package/wizard/types.d.ts +0 -65
- package/wizard/types.js +0 -5
package/date-input/DateInput.js
DELETED
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
|
-
var _pickers = require("@material-ui/pickers");
|
|
21
|
-
|
|
22
|
-
var _core = require("@material-ui/core");
|
|
23
|
-
|
|
24
|
-
var _ClickAwayListener = _interopRequireDefault(require("@material-ui/core/ClickAwayListener"));
|
|
25
|
-
|
|
26
|
-
var _Popover = _interopRequireDefault(require("@material-ui/core/Popover"));
|
|
27
|
-
|
|
28
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
29
|
-
|
|
30
|
-
var _dayjs2 = _interopRequireDefault(require("@date-io/dayjs"));
|
|
31
|
-
|
|
32
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
33
|
-
|
|
34
|
-
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
35
|
-
|
|
36
|
-
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
37
|
-
|
|
38
|
-
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
39
|
-
|
|
40
|
-
var _templateObject;
|
|
41
|
-
|
|
42
|
-
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); }
|
|
43
|
-
|
|
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; }
|
|
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
|
-
|
|
54
|
-
var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
55
|
-
var label = _ref.label,
|
|
56
|
-
name = _ref.name,
|
|
57
|
-
_ref$defaultValue = _ref.defaultValue,
|
|
58
|
-
defaultValue = _ref$defaultValue === void 0 ? "" : _ref$defaultValue,
|
|
59
|
-
value = _ref.value,
|
|
60
|
-
_ref$format = _ref.format,
|
|
61
|
-
format = _ref$format === void 0 ? "dd-MM-yyyy" : _ref$format,
|
|
62
|
-
helperText = _ref.helperText,
|
|
63
|
-
_ref$placeholder = _ref.placeholder,
|
|
64
|
-
placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
|
|
65
|
-
clearable = _ref.clearable,
|
|
66
|
-
disabled = _ref.disabled,
|
|
67
|
-
optional = _ref.optional,
|
|
68
|
-
onChange = _ref.onChange,
|
|
69
|
-
onBlur = _ref.onBlur,
|
|
70
|
-
error = _ref.error,
|
|
71
|
-
autocomplete = _ref.autocomplete,
|
|
72
|
-
margin = _ref.margin,
|
|
73
|
-
size = _ref.size,
|
|
74
|
-
tabIndex = _ref.tabIndex;
|
|
75
|
-
|
|
76
|
-
var _useState = (0, _react.useState)(defaultValue),
|
|
77
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
78
|
-
innerValue = _useState2[0],
|
|
79
|
-
setInnerValue = _useState2[1];
|
|
80
|
-
|
|
81
|
-
var _useState3 = (0, _react.useState)(false),
|
|
82
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
83
|
-
isOpen = _useState4[0],
|
|
84
|
-
setIsOpen = _useState4[1];
|
|
85
|
-
|
|
86
|
-
var _useState5 = (0, _react.useState)(null),
|
|
87
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
88
|
-
anchorEl = _useState6[0],
|
|
89
|
-
setAnchorEl = _useState6[1];
|
|
90
|
-
|
|
91
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
92
|
-
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
93
|
-
var refDate = ref || (0, _react.useRef)(null);
|
|
94
|
-
|
|
95
|
-
var handleCalendarOnKeyDown = function handleCalendarOnKeyDown(event) {
|
|
96
|
-
switch (event.key) {
|
|
97
|
-
case "Esc":
|
|
98
|
-
case "Escape":
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
setIsOpen(false);
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
var handleCalendarOnClick = function handleCalendarOnClick(newDate) {
|
|
106
|
-
var newValue = (0, _dayjs["default"])(newDate).format(format.toUpperCase());
|
|
107
|
-
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
108
|
-
newDate !== null && newDate !== void 0 && newDate.toJSON() ? onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
109
|
-
value: newValue,
|
|
110
|
-
date: newDate
|
|
111
|
-
}) : onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
112
|
-
value: newValue
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
var handleIOnChange = function handleIOnChange(_ref2) {
|
|
117
|
-
var newValue = _ref2.value,
|
|
118
|
-
inputError = _ref2.error;
|
|
119
|
-
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
120
|
-
var dayjsDate = (0, _dayjs["default"])(newValue, format.toUpperCase(), true);
|
|
121
|
-
var invalidDateMessage = newValue !== "" && !dayjsDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
122
|
-
var callbackParams = inputError || invalidDateMessage ? {
|
|
123
|
-
value: newValue,
|
|
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);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
var handleIOnBlur = function handleIOnBlur(_ref3) {
|
|
134
|
-
var value = _ref3.value,
|
|
135
|
-
inputError = _ref3.error;
|
|
136
|
-
var dayjsDate = (0, _dayjs["default"])(value, format.toUpperCase(), true);
|
|
137
|
-
var invalidDateMessage = value !== "" && !dayjsDate.isValid() && translatedLabels.dateInput.invalidDateErrorMessage;
|
|
138
|
-
var callbackParams = inputError || invalidDateMessage ? {
|
|
139
|
-
value: value,
|
|
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);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
var openCalendar = function openCalendar() {
|
|
150
|
-
var dateBtn = refDate.current.getElementsByTagName("button")[0];
|
|
151
|
-
setIsOpen(!isOpen);
|
|
152
|
-
setAnchorEl(dateBtn);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
var closeCalendar = function closeCalendar() {
|
|
156
|
-
setIsOpen(false);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
var calendarAction = {
|
|
160
|
-
onClick: openCalendar,
|
|
161
|
-
icon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
162
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
163
|
-
height: "24",
|
|
164
|
-
viewBox: "0 0 24 24",
|
|
165
|
-
width: "24",
|
|
166
|
-
fill: "currentColor"
|
|
167
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
168
|
-
d: "M0 0h24v24H0z",
|
|
169
|
-
fill: "none"
|
|
170
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
171
|
-
d: "M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z"
|
|
172
|
-
}))
|
|
173
|
-
};
|
|
174
|
-
var dateTheme = (0, _core.createMuiTheme)({
|
|
175
|
-
overrides: {
|
|
176
|
-
MuiTypography: {
|
|
177
|
-
root: {
|
|
178
|
-
fontFamily: "".concat(colorsTheme.dateInput.pickerFontFamily, " !important")
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
MuiPickersYearSelection: {
|
|
182
|
-
container: {
|
|
183
|
-
color: colorsTheme.dateInput.pickerYearFontColor,
|
|
184
|
-
"&::-webkit-scrollbar": {
|
|
185
|
-
width: "3px"
|
|
186
|
-
},
|
|
187
|
-
"&::-webkit-scrollbar-track": {
|
|
188
|
-
backgroundColor: "#D9D9D9",
|
|
189
|
-
borderRadius: "3px"
|
|
190
|
-
},
|
|
191
|
-
"&::-webkit-scrollbar-thumb": {
|
|
192
|
-
backgroundColor: "#666666",
|
|
193
|
-
borderRadius: "3px"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
MuiPickersToolbar: {
|
|
198
|
-
toolbar: {
|
|
199
|
-
backgroundColor: colorsTheme.dateInput.pickerBackgroundColor,
|
|
200
|
-
color: colorsTheme.dateInput.pickerDayFontColor
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
MuiIconButton: {
|
|
204
|
-
root: {
|
|
205
|
-
height: "36px",
|
|
206
|
-
width: "36px",
|
|
207
|
-
padding: "0px"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
MuiTouchRipple: {
|
|
211
|
-
child: {
|
|
212
|
-
opacity: "0"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
MuiButtonBase: {
|
|
216
|
-
root: {
|
|
217
|
-
"&:focus": {
|
|
218
|
-
outline: colorsTheme.dateInput.pickerFocusColor + " solid 2px"
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
MuiPickersBasePicker: {
|
|
223
|
-
pickerView: {
|
|
224
|
-
minWidth: "unset",
|
|
225
|
-
maxWidth: "unset",
|
|
226
|
-
minHeight: "unset",
|
|
227
|
-
padding: "0px 10px",
|
|
228
|
-
height: colorsTheme.dateInput.pickerHeight,
|
|
229
|
-
width: colorsTheme.dateInput.pickerWidth,
|
|
230
|
-
backgroundColor: colorsTheme.dateInput.pickerBackgroundColor,
|
|
231
|
-
fontFamily: colorsTheme.dateInput.pickerFontFamily
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
MuiPickersToolbarText: {
|
|
235
|
-
toolbarTxt: {
|
|
236
|
-
color: colorsTheme.dateInput.pickerActualDateFontColor,
|
|
237
|
-
fontFamily: colorsTheme.dateInput.pickerFontFamily,
|
|
238
|
-
fontSize: "2rem"
|
|
239
|
-
},
|
|
240
|
-
toolbarBtnSelected: {
|
|
241
|
-
color: colorsTheme.dateInput.pickerActualDateFontColor
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
MuiPickersCalendarHeader: {
|
|
245
|
-
transitionContainer: {
|
|
246
|
-
color: colorsTheme.dateInput.pickerMonthFontColor
|
|
247
|
-
},
|
|
248
|
-
dayLabel: {
|
|
249
|
-
color: colorsTheme.dateInput.pickerWeekFontColor,
|
|
250
|
-
fontFamily: colorsTheme.dateInput.pickerFontFamily
|
|
251
|
-
},
|
|
252
|
-
switchHeader: {
|
|
253
|
-
backgroundColor: "#ffffff",
|
|
254
|
-
color: colorsTheme.dateInput.pickerDayFontColor
|
|
255
|
-
},
|
|
256
|
-
iconButton: {
|
|
257
|
-
backgroundColor: colorsTheme.dateInput.pickerMonthArrowsBackgroundColor,
|
|
258
|
-
"&:hover": {
|
|
259
|
-
backgroundColor: colorsTheme.dateInput.pickerMonthArrowsBackgroundColor
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
MuiPickersCalendar: {
|
|
264
|
-
week: {
|
|
265
|
-
marginBottom: "2px"
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
MuiPickersDay: {
|
|
269
|
-
current: {
|
|
270
|
-
color: colorsTheme.dateInput.pickerDayFontColor
|
|
271
|
-
},
|
|
272
|
-
day: {
|
|
273
|
-
fontFamily: colorsTheme.dateInput.pickerFontFamily,
|
|
274
|
-
color: colorsTheme.dateInput.pickerDayFontColor,
|
|
275
|
-
"&:hover": {
|
|
276
|
-
backgroundColor: colorsTheme.dateInput.pickerHoverDateBackgroundColor,
|
|
277
|
-
color: colorsTheme.dateInput.pickerHoverDateFontColor
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
daySelected: {
|
|
281
|
-
backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
|
|
282
|
-
color: colorsTheme.dateInput.pickerSelectedDateColor,
|
|
283
|
-
"&:hover": {
|
|
284
|
-
backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
|
|
285
|
-
color: colorsTheme.dateInput.pickerSelectedDateColor,
|
|
286
|
-
opacity: "1"
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
MuiPickersYear: {
|
|
291
|
-
yearSelected: {
|
|
292
|
-
color: colorsTheme.dateInput.pickerSelectedDateColor,
|
|
293
|
-
backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
|
|
294
|
-
margin: "0px 100px",
|
|
295
|
-
borderRadius: "20px"
|
|
296
|
-
},
|
|
297
|
-
root: {
|
|
298
|
-
"&:focus": {
|
|
299
|
-
color: colorsTheme.dateInput.pickerHoverDateFontColor,
|
|
300
|
-
backgroundColor: colorsTheme.dateInput.pickerHoverDateBackgroundColor
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
MuiPickersModal: {
|
|
305
|
-
dialogAction: {
|
|
306
|
-
color: "pink"
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
312
|
-
theme: colorsTheme
|
|
313
|
-
}, /*#__PURE__*/_react["default"].createElement(_core.MuiThemeProvider, {
|
|
314
|
-
theme: dateTheme
|
|
315
|
-
}, /*#__PURE__*/_react["default"].createElement(_pickers.MuiPickersUtilsProvider, {
|
|
316
|
-
utils: _dayjs2["default"]
|
|
317
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledDPicker, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
318
|
-
label: label,
|
|
319
|
-
name: name,
|
|
320
|
-
defaultValue: defaultValue,
|
|
321
|
-
value: value !== null && value !== void 0 ? value : innerValue,
|
|
322
|
-
helperText: helperText,
|
|
323
|
-
placeholder: placeholder ? format.toUpperCase() : null,
|
|
324
|
-
action: calendarAction,
|
|
325
|
-
clearable: clearable,
|
|
326
|
-
disabled: disabled,
|
|
327
|
-
optional: optional,
|
|
328
|
-
onChange: handleIOnChange,
|
|
329
|
-
onBlur: handleIOnBlur,
|
|
330
|
-
error: error,
|
|
331
|
-
autocomplete: autocomplete,
|
|
332
|
-
margin: margin,
|
|
333
|
-
size: size,
|
|
334
|
-
tabIndex: tabIndex,
|
|
335
|
-
ref: refDate
|
|
336
|
-
}), /*#__PURE__*/_react["default"].createElement(_Popover["default"], {
|
|
337
|
-
onKeyDown: handleCalendarOnKeyDown,
|
|
338
|
-
open: isOpen,
|
|
339
|
-
anchorEl: anchorEl,
|
|
340
|
-
anchorOrigin: {
|
|
341
|
-
vertical: "bottom",
|
|
342
|
-
horizontal: "left"
|
|
343
|
-
},
|
|
344
|
-
transformOrigin: {
|
|
345
|
-
vertical: "top",
|
|
346
|
-
horizontal: "center"
|
|
347
|
-
},
|
|
348
|
-
PaperProps: {
|
|
349
|
-
style: {
|
|
350
|
-
marginTop: "10px"
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}, /*#__PURE__*/_react["default"].createElement(_ClickAwayListener["default"], {
|
|
354
|
-
onClickAway: closeCalendar
|
|
355
|
-
}, /*#__PURE__*/_react["default"].createElement(_core.Paper, {
|
|
356
|
-
role: "dialog",
|
|
357
|
-
"aria-modal": "true"
|
|
358
|
-
}, /*#__PURE__*/_react["default"].createElement(_pickers.DatePicker, {
|
|
359
|
-
variant: "static",
|
|
360
|
-
value: getValueForPicker(value !== null && value !== void 0 ? value : innerValue, format),
|
|
361
|
-
onChange: function onChange(date) {
|
|
362
|
-
return handleCalendarOnClick(date);
|
|
363
|
-
},
|
|
364
|
-
format: format,
|
|
365
|
-
disabled: disabled
|
|
366
|
-
}))))))));
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
var StyledDPicker = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
370
|
-
|
|
371
|
-
var _default = DxcDateInput;
|
|
372
|
-
exports["default"] = _default;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { userEvent, within, fireEvent, screen } from "@storybook/testing-library";
|
|
3
|
-
import DxcDateInput from "./DateInput";
|
|
4
|
-
import Title from "../../.storybook/components/Title";
|
|
5
|
-
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
-
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
7
|
-
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: "Date input",
|
|
11
|
-
component: DxcDateInput,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const Chromatic = () => (
|
|
15
|
-
<>
|
|
16
|
-
<ExampleContainer>
|
|
17
|
-
<Title title="Complete date input" theme="light" level={4} />
|
|
18
|
-
<DxcDateInput label="Date input" helperText="Help message" format="dd/mm/yy" placeholder optional />
|
|
19
|
-
</ExampleContainer>
|
|
20
|
-
<ExampleContainer>
|
|
21
|
-
<Title title="Disabled" theme="light" level={4} />
|
|
22
|
-
<DxcDateInput label="Disabled date input" helperText="Help message" defaultValue="06-04-2027" clearable disabled />
|
|
23
|
-
</ExampleContainer>
|
|
24
|
-
<ExampleContainer>
|
|
25
|
-
<Title title="Invalid" theme="light" level={4} />
|
|
26
|
-
<DxcDateInput label="Error date input" error="Error message." placeholder />
|
|
27
|
-
</ExampleContainer>
|
|
28
|
-
<ExampleContainer>
|
|
29
|
-
<Title title="Relation between icons" theme="light" level={4} />
|
|
30
|
-
<DxcDateInput label="Error date input" error="Error message." defaultValue="06-04-2027" clearable />
|
|
31
|
-
</ExampleContainer>
|
|
32
|
-
<BackgroundColorProvider color="#333333">
|
|
33
|
-
<DarkContainer>
|
|
34
|
-
<Title title="Dark" theme="dark" level={2} />
|
|
35
|
-
<ExampleContainer>
|
|
36
|
-
<Title title="Complete date input" theme="dark" level={4} />
|
|
37
|
-
<DxcDateInput label="Date input" helperText="Help message" format="yyyy/dd/mm" placeholder optional />
|
|
38
|
-
</ExampleContainer>
|
|
39
|
-
<ExampleContainer>
|
|
40
|
-
<Title title="Disabled" theme="dark" level={4} />
|
|
41
|
-
<DxcDateInput label="Disabled Date input" helperText="Help message" defaultValue="06-04-2027" clearable disabled />
|
|
42
|
-
</ExampleContainer>
|
|
43
|
-
<ExampleContainer>
|
|
44
|
-
<Title title="Invalid" theme="dark" level={4} />
|
|
45
|
-
<DxcDateInput label="Error date input" error="Error message." placeholder />
|
|
46
|
-
</ExampleContainer>
|
|
47
|
-
<ExampleContainer>
|
|
48
|
-
<Title title="Relation between icons" theme="dark" level={4} />
|
|
49
|
-
<DxcDateInput label="Error date input" defaultValue="06-04-2027" error="Error message." clearable />
|
|
50
|
-
</ExampleContainer>
|
|
51
|
-
</DarkContainer>
|
|
52
|
-
</BackgroundColorProvider>
|
|
53
|
-
<Title title="Margins" theme="light" level={2} />
|
|
54
|
-
<ExampleContainer>
|
|
55
|
-
<Title title="Xxsmall" theme="light" level={4} />
|
|
56
|
-
<DxcDateInput label="Xxsmall" margin="xxsmall" />
|
|
57
|
-
</ExampleContainer>
|
|
58
|
-
<ExampleContainer>
|
|
59
|
-
<Title title="Xsmall" theme="light" level={4} />
|
|
60
|
-
<DxcDateInput label="Xsmall" margin="xsmall" />
|
|
61
|
-
</ExampleContainer>
|
|
62
|
-
<ExampleContainer>
|
|
63
|
-
<Title title="Small" theme="light" level={4} />
|
|
64
|
-
<DxcDateInput label="Small" margin="small" />
|
|
65
|
-
</ExampleContainer>
|
|
66
|
-
<ExampleContainer>
|
|
67
|
-
<Title title="Medium" theme="light" level={4} />
|
|
68
|
-
<DxcDateInput label="Medium" margin="medium" />
|
|
69
|
-
</ExampleContainer>
|
|
70
|
-
<ExampleContainer>
|
|
71
|
-
<Title title="Large" theme="light" level={4} />
|
|
72
|
-
<DxcDateInput label="Large" margin="large" />
|
|
73
|
-
</ExampleContainer>
|
|
74
|
-
<ExampleContainer>
|
|
75
|
-
<Title title="Xlarge" theme="light" level={4} />
|
|
76
|
-
<DxcDateInput label="Xlarge" margin="xlarge" />
|
|
77
|
-
</ExampleContainer>
|
|
78
|
-
<ExampleContainer>
|
|
79
|
-
<Title title="Xxlarge" theme="light" level={4} />
|
|
80
|
-
<DxcDateInput label="Xxlarge" margin="xxlarge" />
|
|
81
|
-
</ExampleContainer>
|
|
82
|
-
<Title title="Sizes" theme="light" level={2} />
|
|
83
|
-
<ExampleContainer>
|
|
84
|
-
<Title title="Medium size" theme="light" level={4} />
|
|
85
|
-
<DxcDateInput label="Medium" size="medium" />
|
|
86
|
-
</ExampleContainer>
|
|
87
|
-
<ExampleContainer>
|
|
88
|
-
<Title title="Large size" theme="light" level={4} />
|
|
89
|
-
<DxcDateInput label="Large" size="large" />
|
|
90
|
-
</ExampleContainer>
|
|
91
|
-
<ExampleContainer>
|
|
92
|
-
<Title title="FillParent size" theme="light" level={4} />
|
|
93
|
-
<DxcDateInput label="FillParent" size="fillParent" />
|
|
94
|
-
</ExampleContainer>
|
|
95
|
-
</>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
const DatePicker = () => (
|
|
99
|
-
<ExampleContainer expanded>
|
|
100
|
-
<Title title="Show date input" theme="light" level={4} />
|
|
101
|
-
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
102
|
-
</ExampleContainer>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
export const ShowDatePicker = DatePicker.bind({});
|
|
106
|
-
ShowDatePicker.play = async ({ canvasElement }) => {
|
|
107
|
-
const canvas = within(canvasElement);
|
|
108
|
-
const dateBtn = canvas.getByRole("button");
|
|
109
|
-
await userEvent.click(dateBtn);
|
|
110
|
-
await userEvent.tab();
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const YearPicker = () => (
|
|
114
|
-
<ExampleContainer expanded>
|
|
115
|
-
<Title title="Show date input" theme="light" level={4} />
|
|
116
|
-
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
117
|
-
</ExampleContainer>
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
export const ShowYearPicker = YearPicker.bind({});
|
|
121
|
-
ShowYearPicker.play = async () => {
|
|
122
|
-
await fireEvent.click(screen.getByRole("button"));
|
|
123
|
-
await fireEvent.click(screen.getByText("2023"));
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const YearPickerFocus = () => (
|
|
127
|
-
<ExampleContainer expanded>
|
|
128
|
-
<Title title="Show date input" theme="light" level={4} />
|
|
129
|
-
<DxcDateInput label="Date input" defaultValue="10-06-2023" />
|
|
130
|
-
</ExampleContainer>
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
export const ShowYearPickerFocus = YearPickerFocus.bind({});
|
|
134
|
-
ShowYearPickerFocus.play = async () => {
|
|
135
|
-
await fireEvent.click(screen.getByRole("button"));
|
|
136
|
-
await fireEvent.click(screen.getByText("2023"));
|
|
137
|
-
await screen.getByText("2021").focus();
|
|
138
|
-
};
|