@dxc-technology/halstack-react 0.0.0-d618bea → 0.0.0-d80caba

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.
Files changed (243) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6734 -0
  3. package/dist/index.d.ts +6734 -0
  4. package/dist/index.js +14279 -0
  5. package/dist/index.mjs +14190 -0
  6. package/package.json +69 -68
  7. package/BackgroundColorContext.d.ts +0 -10
  8. package/BackgroundColorContext.js +0 -48
  9. package/ThemeContext.d.ts +0 -15
  10. package/ThemeContext.js +0 -243
  11. package/V3Select/V3Select.js +0 -455
  12. package/V3Select/index.d.ts +0 -27
  13. package/V3Textarea/V3Textarea.js +0 -260
  14. package/V3Textarea/index.d.ts +0 -27
  15. package/accordion/Accordion.d.ts +0 -4
  16. package/accordion/Accordion.js +0 -258
  17. package/accordion/types.d.ts +0 -68
  18. package/accordion/types.js +0 -5
  19. package/accordion-group/AccordionGroup.d.ts +0 -7
  20. package/accordion-group/AccordionGroup.js +0 -170
  21. package/accordion-group/AccordionGroup.stories.tsx +0 -225
  22. package/accordion-group/types.d.ts +0 -72
  23. package/accordion-group/types.js +0 -5
  24. package/alert/Alert.d.ts +0 -4
  25. package/alert/Alert.js +0 -290
  26. package/alert/Alert.stories.tsx +0 -170
  27. package/alert/types.d.ts +0 -49
  28. package/alert/types.js +0 -5
  29. package/badge/Badge.js +0 -59
  30. package/box/Box.d.ts +0 -4
  31. package/box/Box.js +0 -126
  32. package/box/Box.stories.tsx +0 -132
  33. package/box/types.d.ts +0 -43
  34. package/box/types.js +0 -5
  35. package/button/Button.d.ts +0 -4
  36. package/button/Button.js +0 -179
  37. package/button/Button.stories.tsx +0 -276
  38. package/button/types.d.ts +0 -57
  39. package/button/types.js +0 -5
  40. package/card/Card.d.ts +0 -4
  41. package/card/Card.js +0 -164
  42. package/card/Card.stories.tsx +0 -201
  43. package/card/ice-cream.jpg +0 -0
  44. package/card/types.d.ts +0 -67
  45. package/card/types.js +0 -5
  46. package/checkbox/Checkbox.d.ts +0 -4
  47. package/checkbox/Checkbox.js +0 -253
  48. package/checkbox/Checkbox.stories.tsx +0 -192
  49. package/checkbox/types.d.ts +0 -60
  50. package/checkbox/types.js +0 -5
  51. package/chip/Chip.d.ts +0 -4
  52. package/chip/Chip.js +0 -199
  53. package/chip/Chip.stories.tsx +0 -121
  54. package/chip/types.d.ts +0 -53
  55. package/chip/types.js +0 -5
  56. package/common/OpenSans.css +0 -81
  57. package/common/RequiredComponent.js +0 -32
  58. package/common/fonts/OpenSans-Bold.ttf +0 -0
  59. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  60. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  61. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  62. package/common/fonts/OpenSans-Italic.ttf +0 -0
  63. package/common/fonts/OpenSans-Light.ttf +0 -0
  64. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  65. package/common/fonts/OpenSans-Regular.ttf +0 -0
  66. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  67. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  68. package/common/utils.js +0 -22
  69. package/common/variables.js +0 -1576
  70. package/date/Date.js +0 -373
  71. package/date/index.d.ts +0 -27
  72. package/date-input/DateInput.d.ts +0 -4
  73. package/date-input/DateInput.js +0 -358
  74. package/date-input/DateInput.stories.tsx +0 -138
  75. package/date-input/types.d.ts +0 -100
  76. package/date-input/types.js +0 -5
  77. package/dialog/Dialog.d.ts +0 -4
  78. package/dialog/Dialog.js +0 -165
  79. package/dialog/Dialog.stories.tsx +0 -212
  80. package/dialog/types.d.ts +0 -43
  81. package/dialog/types.js +0 -5
  82. package/dropdown/Dropdown.d.ts +0 -4
  83. package/dropdown/Dropdown.js +0 -417
  84. package/dropdown/types.d.ts +0 -89
  85. package/dropdown/types.js +0 -5
  86. package/file-input/FileInput.d.ts +0 -4
  87. package/file-input/FileInput.js +0 -521
  88. package/file-input/FileItem.d.ts +0 -14
  89. package/file-input/FileItem.js +0 -184
  90. package/file-input/types.d.ts +0 -112
  91. package/file-input/types.js +0 -5
  92. package/footer/Footer.d.ts +0 -4
  93. package/footer/Footer.js +0 -266
  94. package/footer/Footer.stories.tsx +0 -151
  95. package/footer/Icons.js +0 -77
  96. package/footer/types.d.ts +0 -65
  97. package/footer/types.js +0 -5
  98. package/header/Header.d.ts +0 -7
  99. package/header/Header.js +0 -324
  100. package/header/Header.stories.tsx +0 -162
  101. package/header/Icons.js +0 -34
  102. package/header/types.d.ts +0 -47
  103. package/header/types.js +0 -5
  104. package/heading/Heading.d.ts +0 -4
  105. package/heading/Heading.js +0 -159
  106. package/heading/Heading.stories.tsx +0 -53
  107. package/heading/types.d.ts +0 -33
  108. package/heading/types.js +0 -5
  109. package/input-text/Icons.js +0 -22
  110. package/input-text/InputText.js +0 -611
  111. package/input-text/index.d.ts +0 -36
  112. package/layout/ApplicationLayout.d.ts +0 -10
  113. package/layout/ApplicationLayout.js +0 -225
  114. package/layout/ApplicationLayout.stories.tsx +0 -171
  115. package/layout/Icons.js +0 -55
  116. package/layout/types.d.ts +0 -57
  117. package/layout/types.js +0 -5
  118. package/link/Link.d.ts +0 -3
  119. package/link/Link.js +0 -161
  120. package/link/Link.stories.tsx +0 -146
  121. package/link/types.d.ts +0 -74
  122. package/link/types.js +0 -5
  123. package/list/List.d.ts +0 -7
  124. package/list/List.js +0 -37
  125. package/list/List.stories.tsx +0 -70
  126. package/main.d.ts +0 -48
  127. package/main.js +0 -395
  128. package/number-input/NumberInput.d.ts +0 -4
  129. package/number-input/NumberInput.js +0 -83
  130. package/number-input/NumberInput.stories.tsx +0 -115
  131. package/number-input/NumberInputContext.d.ts +0 -4
  132. package/number-input/NumberInputContext.js +0 -19
  133. package/number-input/numberInputContextTypes.d.ts +0 -19
  134. package/number-input/numberInputContextTypes.js +0 -5
  135. package/number-input/types.d.ts +0 -117
  136. package/number-input/types.js +0 -5
  137. package/paginator/Icons.js +0 -66
  138. package/paginator/Paginator.d.ts +0 -4
  139. package/paginator/Paginator.js +0 -192
  140. package/paginator/Paginator.stories.tsx +0 -63
  141. package/paginator/types.d.ts +0 -38
  142. package/paginator/types.js +0 -5
  143. package/password-input/PasswordInput.d.ts +0 -4
  144. package/password-input/PasswordInput.js +0 -163
  145. package/password-input/PasswordInput.stories.tsx +0 -131
  146. package/password-input/types.d.ts +0 -107
  147. package/password-input/types.js +0 -5
  148. package/progress-bar/ProgressBar.d.ts +0 -4
  149. package/progress-bar/ProgressBar.js +0 -170
  150. package/progress-bar/ProgressBar.stories.jsx +0 -58
  151. package/progress-bar/types.d.ts +0 -37
  152. package/progress-bar/types.js +0 -5
  153. package/radio/Radio.d.ts +0 -4
  154. package/radio/Radio.js +0 -174
  155. package/radio/Radio.stories.tsx +0 -192
  156. package/radio/types.d.ts +0 -54
  157. package/radio/types.js +0 -5
  158. package/resultsetTable/ResultsetTable.d.ts +0 -4
  159. package/resultsetTable/ResultsetTable.js +0 -251
  160. package/resultsetTable/types.d.ts +0 -67
  161. package/resultsetTable/types.js +0 -5
  162. package/row/Row.d.ts +0 -11
  163. package/row/Row.js +0 -124
  164. package/row/Row.stories.tsx +0 -223
  165. package/select/Select.js +0 -863
  166. package/select/Select.stories.tsx +0 -572
  167. package/select/index.d.ts +0 -131
  168. package/sidenav/Sidenav.d.ts +0 -9
  169. package/sidenav/Sidenav.js +0 -136
  170. package/sidenav/Sidenav.stories.tsx +0 -165
  171. package/sidenav/types.d.ts +0 -50
  172. package/sidenav/types.js +0 -5
  173. package/slider/Slider.d.ts +0 -4
  174. package/slider/Slider.js +0 -317
  175. package/slider/Slider.stories.tsx +0 -177
  176. package/slider/types.d.ts +0 -78
  177. package/slider/types.js +0 -5
  178. package/spinner/Spinner.d.ts +0 -4
  179. package/spinner/Spinner.js +0 -250
  180. package/spinner/Spinner.stories.jsx +0 -102
  181. package/spinner/types.d.ts +0 -32
  182. package/spinner/types.js +0 -5
  183. package/stack/Stack.d.ts +0 -10
  184. package/stack/Stack.js +0 -94
  185. package/stack/Stack.stories.tsx +0 -150
  186. package/switch/Switch.d.ts +0 -4
  187. package/switch/Switch.js +0 -179
  188. package/switch/Switch.stories.tsx +0 -160
  189. package/switch/types.d.ts +0 -58
  190. package/switch/types.js +0 -5
  191. package/table/Table.d.ts +0 -4
  192. package/table/Table.js +0 -118
  193. package/table/Table.stories.jsx +0 -276
  194. package/table/types.d.ts +0 -21
  195. package/table/types.js +0 -5
  196. package/tabs/Tabs.d.ts +0 -4
  197. package/tabs/Tabs.js +0 -213
  198. package/tabs/Tabs.stories.tsx +0 -121
  199. package/tabs/types.d.ts +0 -70
  200. package/tabs/types.js +0 -5
  201. package/tag/Tag.d.ts +0 -4
  202. package/tag/Tag.js +0 -193
  203. package/tag/Tag.stories.tsx +0 -145
  204. package/tag/types.d.ts +0 -60
  205. package/tag/types.js +0 -5
  206. package/text/Text.d.ts +0 -7
  207. package/text/Text.js +0 -30
  208. package/text/Text.stories.tsx +0 -19
  209. package/text-input/TextInput.d.ts +0 -4
  210. package/text-input/TextInput.js +0 -786
  211. package/text-input/TextInput.stories.tsx +0 -456
  212. package/text-input/types.d.ts +0 -159
  213. package/text-input/types.js +0 -5
  214. package/textarea/Textarea.js +0 -314
  215. package/textarea/Textarea.stories.jsx +0 -135
  216. package/textarea/index.d.ts +0 -127
  217. package/toggle/Toggle.js +0 -186
  218. package/toggle/index.d.ts +0 -21
  219. package/toggle-group/ToggleGroup.d.ts +0 -4
  220. package/toggle-group/ToggleGroup.js +0 -217
  221. package/toggle-group/ToggleGroup.stories.tsx +0 -178
  222. package/toggle-group/types.d.ts +0 -84
  223. package/toggle-group/types.js +0 -5
  224. package/upload/Upload.js +0 -201
  225. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  226. package/upload/buttons-upload/Icons.js +0 -40
  227. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  228. package/upload/dragAndDropArea/Icons.js +0 -39
  229. package/upload/file-upload/FileToUpload.js +0 -115
  230. package/upload/file-upload/Icons.js +0 -66
  231. package/upload/files-upload/FilesToUpload.js +0 -109
  232. package/upload/index.d.ts +0 -15
  233. package/upload/transaction/Icons.js +0 -160
  234. package/upload/transaction/Transaction.js +0 -104
  235. package/upload/transactions/Transactions.js +0 -94
  236. package/useTheme.d.ts +0 -2
  237. package/useTheme.js +0 -22
  238. package/wizard/Icons.js +0 -65
  239. package/wizard/Wizard.d.ts +0 -4
  240. package/wizard/Wizard.js +0 -231
  241. package/wizard/Wizard.stories.jsx +0 -224
  242. package/wizard/types.d.ts +0 -64
  243. package/wizard/types.js +0 -5
@@ -1,358 +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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
-
16
- var _react = _interopRequireWildcard(require("react"));
17
-
18
- var _pickers = require("@material-ui/pickers");
19
-
20
- var _core = require("@material-ui/core");
21
-
22
- var _ClickAwayListener = _interopRequireDefault(require("@material-ui/core/ClickAwayListener"));
23
-
24
- var _Popover = _interopRequireDefault(require("@material-ui/core/Popover"));
25
-
26
- var _moment = _interopRequireDefault(require("moment"));
27
-
28
- var _dateFns = _interopRequireDefault(require("@date-io/date-fns"));
29
-
30
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
31
-
32
- var _useTheme = _interopRequireDefault(require("../useTheme"));
33
-
34
- var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
35
-
36
- var _templateObject;
37
-
38
- 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); }
39
-
40
- 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
-
42
- var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
43
- var label = _ref.label,
44
- _ref$name = _ref.name,
45
- name = _ref$name === void 0 ? "" : _ref$name,
46
- value = _ref.value,
47
- _ref$format = _ref.format,
48
- format = _ref$format === void 0 ? "dd-MM-yyyy" : _ref$format,
49
- helperText = _ref.helperText,
50
- _ref$placeholder = _ref.placeholder,
51
- placeholder = _ref$placeholder === void 0 ? false : _ref$placeholder,
52
- _ref$clearable = _ref.clearable,
53
- clearable = _ref$clearable === void 0 ? false : _ref$clearable,
54
- _ref$disabled = _ref.disabled,
55
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
56
- _ref$optional = _ref.optional,
57
- optional = _ref$optional === void 0 ? false : _ref$optional,
58
- onChange = _ref.onChange,
59
- onBlur = _ref.onBlur,
60
- error = _ref.error,
61
- _ref$autocomplete = _ref.autocomplete,
62
- autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
63
- margin = _ref.margin,
64
- _ref$size = _ref.size,
65
- size = _ref$size === void 0 ? "medium" : _ref$size,
66
- _ref$tabIndex = _ref.tabIndex,
67
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
68
-
69
- var _useState = (0, _react.useState)(""),
70
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
71
- innerValue = _useState2[0],
72
- setInnerValue = _useState2[1];
73
-
74
- var _useState3 = (0, _react.useState)(false),
75
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
76
- isOpen = _useState4[0],
77
- setIsOpen = _useState4[1];
78
-
79
- var _useState5 = (0, _react.useState)(null),
80
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
81
- anchorEl = _useState6[0],
82
- setAnchorEl = _useState6[1];
83
-
84
- var colorsTheme = (0, _useTheme["default"])();
85
-
86
- var handleCalendarOnKeyDown = function handleCalendarOnKeyDown(event) {
87
- switch (event.keyCode) {
88
- case 27:
89
- // Esc
90
- event.preventDefault();
91
- setIsOpen(false);
92
- break;
93
- }
94
- };
95
-
96
- var handleCalendarOnClick = function handleCalendarOnClick(newDate) {
97
- var newValue = (0, _moment["default"])(newDate).format(format.toUpperCase());
98
- value !== null && value !== void 0 ? value : setInnerValue(newValue);
99
- onChange === null || onChange === void 0 ? void 0 : onChange({
100
- value: newValue,
101
- error: null,
102
- date: newDate !== null && newDate !== void 0 && newDate.toJSON() ? newDate : null
103
- });
104
- };
105
-
106
- var handleIOnChange = function handleIOnChange(_ref2) {
107
- var newValue = _ref2.value,
108
- inputError = _ref2.error;
109
- value !== null && value !== void 0 ? value : setInnerValue(newValue);
110
- var momentDate = (0, _moment["default"])(newValue, format.toUpperCase(), true);
111
- var invalidDateMessage = newValue !== "" && !momentDate.isValid() ? "Invalid date." : null;
112
- onChange === null || onChange === void 0 ? void 0 : onChange({
113
- value: newValue,
114
- error: inputError || invalidDateMessage,
115
- date: momentDate.isValid() ? momentDate.toDate() : null
116
- });
117
- };
118
-
119
- var handleIOnBlur = function handleIOnBlur(_ref3) {
120
- var value = _ref3.value,
121
- inputError = _ref3.error;
122
- var momentDate = (0, _moment["default"])(value, format.toUpperCase(), true);
123
- var invalidDateMessage = value !== "" && !momentDate.isValid() ? "Invalid date." : null;
124
- onBlur === null || onBlur === void 0 ? void 0 : onBlur({
125
- value: value,
126
- error: inputError || invalidDateMessage,
127
- date: momentDate.isValid() ? momentDate.toDate() : null
128
- });
129
- };
130
-
131
- var getValueForPicker = function getValueForPicker() {
132
- return (0, _moment["default"])(value !== null && value !== void 0 ? value : innerValue, format.toUpperCase(), true).format();
133
- };
134
-
135
- var openCalendar = function openCalendar(event) {
136
- if (event) {
137
- setIsOpen(!isOpen);
138
- setAnchorEl(event.currentTarget);
139
- }
140
- };
141
-
142
- var closeCalendar = function closeCalendar() {
143
- setIsOpen(false);
144
- };
145
-
146
- var calendarAction = {
147
- onClick: openCalendar,
148
- icon: /*#__PURE__*/_react["default"].createElement("svg", {
149
- xmlns: "http://www.w3.org/2000/svg",
150
- height: "24",
151
- viewBox: "0 0 24 24",
152
- width: "24",
153
- fill: "currentColor"
154
- }, /*#__PURE__*/_react["default"].createElement("path", {
155
- d: "M0 0h24v24H0z",
156
- fill: "none"
157
- }), /*#__PURE__*/_react["default"].createElement("path", {
158
- 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"
159
- }))
160
- };
161
- var dateTheme = (0, _core.createMuiTheme)({
162
- overrides: {
163
- MuiTypography: {
164
- root: {
165
- fontFamily: "".concat(colorsTheme.dateInput.pickerFontFamily, " !important")
166
- }
167
- },
168
- MuiPickersYearSelection: {
169
- container: {
170
- color: colorsTheme.dateInput.pickerYearFontColor,
171
- "&::-webkit-scrollbar": {
172
- width: "3px"
173
- },
174
- "&::-webkit-scrollbar-track": {
175
- backgroundColor: "#D9D9D9",
176
- borderRadius: "3px"
177
- },
178
- "&::-webkit-scrollbar-thumb": {
179
- backgroundColor: "#666666",
180
- borderRadius: "3px"
181
- }
182
- }
183
- },
184
- MuiPickersToolbar: {
185
- toolbar: {
186
- backgroundColor: colorsTheme.dateInput.pickerBackgroundColor,
187
- color: colorsTheme.dateInput.pickerDayFontColor
188
- }
189
- },
190
- MuiIconButton: {
191
- root: {
192
- height: "36px",
193
- width: "36px",
194
- padding: "0px"
195
- }
196
- },
197
- MuiTouchRipple: {
198
- child: {
199
- opacity: "0"
200
- }
201
- },
202
- MuiButtonBase: {
203
- root: {
204
- "&:focus": {
205
- outline: colorsTheme.dateInput.pickerFocusColor + " solid 2px"
206
- }
207
- }
208
- },
209
- MuiPickersBasePicker: {
210
- pickerView: {
211
- minWidth: "unset",
212
- maxWidth: "unset",
213
- minHeight: "unset",
214
- padding: "0px 10px",
215
- height: colorsTheme.dateInput.pickerHeight,
216
- width: colorsTheme.dateInput.pickerWidth,
217
- backgroundColor: colorsTheme.dateInput.pickerBackgroundColor,
218
- fontFamily: colorsTheme.dateInput.pickerFontFamily
219
- }
220
- },
221
- MuiPickersToolbarText: {
222
- toolbarTxt: {
223
- color: colorsTheme.dateInput.pickerActualDateFontColor,
224
- fontFamily: colorsTheme.dateInput.pickerFontFamily,
225
- fontSize: "2rem"
226
- },
227
- toolbarBtnSelected: {
228
- color: colorsTheme.dateInput.pickerActualDateFontColor
229
- }
230
- },
231
- MuiPickersCalendarHeader: {
232
- transitionContainer: {
233
- color: colorsTheme.dateInput.pickerMonthFontColor
234
- },
235
- dayLabel: {
236
- color: colorsTheme.dateInput.pickerWeekFontColor,
237
- fontFamily: colorsTheme.dateInput.pickerFontFamily
238
- },
239
- switchHeader: {
240
- backgroundColor: "#ffffff",
241
- color: colorsTheme.dateInput.pickerDayFontColor
242
- },
243
- iconButton: {
244
- backgroundColor: colorsTheme.dateInput.pickerMonthArrowsBackgroundColor,
245
- "&:hover": {
246
- backgroundColor: colorsTheme.dateInput.pickerMonthArrowsBackgroundColor
247
- }
248
- }
249
- },
250
- MuiPickersCalendar: {
251
- week: {
252
- marginBottom: "2px"
253
- }
254
- },
255
- MuiPickersDay: {
256
- current: {
257
- color: colorsTheme.dateInput.pickerDayFontColor
258
- },
259
- day: {
260
- fontFamily: colorsTheme.dateInput.pickerFontFamily,
261
- color: colorsTheme.dateInput.pickerDayFontColor,
262
- "&:hover": {
263
- backgroundColor: colorsTheme.dateInput.pickerHoverDateBackgroundColor,
264
- color: colorsTheme.dateInput.pickerHoverDateFontColor
265
- }
266
- },
267
- daySelected: {
268
- backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
269
- color: colorsTheme.dateInput.pickerSelectedDateColor,
270
- "&:hover": {
271
- backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
272
- color: colorsTheme.dateInput.pickerSelectedDateColor,
273
- opacity: "1"
274
- }
275
- }
276
- },
277
- MuiPickersYear: {
278
- yearSelected: {
279
- color: colorsTheme.dateInput.pickerSelectedDateColor,
280
- backgroundColor: colorsTheme.dateInput.pickerSelectedDateBackgroundColor,
281
- margin: "0px 100px",
282
- borderRadius: "20px"
283
- },
284
- root: {
285
- "&:focus": {
286
- color: colorsTheme.dateInput.pickerHoverDateFontColor,
287
- backgroundColor: colorsTheme.dateInput.pickerHoverDateBackgroundColor
288
- }
289
- }
290
- },
291
- MuiPickersModal: {
292
- dialogAction: {
293
- color: "pink"
294
- }
295
- }
296
- }
297
- });
298
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
299
- theme: colorsTheme
300
- }, /*#__PURE__*/_react["default"].createElement(_core.MuiThemeProvider, {
301
- theme: dateTheme
302
- }, /*#__PURE__*/_react["default"].createElement(_pickers.MuiPickersUtilsProvider, {
303
- utils: _dateFns["default"]
304
- }, /*#__PURE__*/_react["default"].createElement(StyledDPicker, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
305
- label: label,
306
- name: name,
307
- value: value !== null && value !== void 0 ? value : innerValue,
308
- helperText: helperText,
309
- placeholder: placeholder ? format.toUpperCase() : null,
310
- action: calendarAction,
311
- clearable: clearable,
312
- disabled: disabled,
313
- optional: optional,
314
- onChange: handleIOnChange,
315
- onBlur: handleIOnBlur,
316
- error: error,
317
- autocomplete: autocomplete,
318
- margin: margin,
319
- size: size,
320
- tabIndex: tabIndex,
321
- ref: ref
322
- }), /*#__PURE__*/_react["default"].createElement(_Popover["default"], {
323
- onKeyDown: handleCalendarOnKeyDown,
324
- open: isOpen,
325
- anchorEl: anchorEl,
326
- anchorOrigin: {
327
- vertical: "bottom",
328
- horizontal: "left"
329
- },
330
- transformOrigin: {
331
- vertical: "top",
332
- horizontal: "center"
333
- },
334
- PaperProps: {
335
- style: {
336
- marginTop: "10px"
337
- }
338
- }
339
- }, /*#__PURE__*/_react["default"].createElement(_ClickAwayListener["default"], {
340
- onClickAway: closeCalendar
341
- }, /*#__PURE__*/_react["default"].createElement(_core.Paper, {
342
- role: "dialog",
343
- "aria-modal": "true"
344
- }, /*#__PURE__*/_react["default"].createElement(_pickers.DatePicker, {
345
- variant: "static",
346
- value: getValueForPicker(),
347
- onChange: function onChange(date) {
348
- return handleCalendarOnClick(date);
349
- },
350
- format: format,
351
- disabled: disabled
352
- }))))))));
353
- });
354
-
355
- var StyledDPicker = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
356
-
357
- var _default = DxcDateInput;
358
- 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" value="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." value="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" value="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" value="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" value="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" value="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" value="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
- };
@@ -1,100 +0,0 @@
1
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
- declare type Margin = {
3
- top?: Space;
4
- bottom?: Space;
5
- left?: Space;
6
- right?: Space;
7
- };
8
- declare type Props = {
9
- /**
10
- * Text to be placed above the date.
11
- */
12
- label?: string;
13
- /**
14
- * Name attribute of the input element.
15
- */
16
- name?: string;
17
- /**
18
- * Value of the input element. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
19
- */
20
- value?: string;
21
- /**
22
- * The format in which the date value will be displayed. User must use this format when editing the value or it will be considered as an invalid date.
23
- */
24
- format?: string;
25
- /**
26
- * Helper text to be placed above the date.
27
- */
28
- helperText?: string;
29
- /**
30
- * If true, the date format will appear as placeholder in the field.
31
- */
32
- placeholder?: boolean;
33
- /**
34
- * If true, the date input will have an action to clear the entered value.
35
- */
36
- clearable?: boolean;
37
- /**
38
- * If true, the component will be disabled.
39
- */
40
- disabled?: boolean;
41
- /**
42
- * If true, the date will be optional, showing '(Optional)'
43
- * next to the label. Otherwise, the field will be considered required and an error will be
44
- * passed as a parameter to the OnBlur and onChange functions when it has
45
- * not been filled.
46
- */
47
- optional?: boolean;
48
- /**
49
- * This function will be called when the user types within the input
50
- * element of the component. An object including the string value, the
51
- * error and the date value will be passed to this function.
52
- * If the string value is a valid date, error will
53
- * be null. Also, if the string value is not a valid date, date will be null.
54
- */
55
- onChange?: (val: {
56
- value: string;
57
- error: string | null;
58
- date: Date | null;
59
- }) => void;
60
- /**
61
- * This function will be called when the input element loses the focus.
62
- * An object including the string value, the error and the date value
63
- * will be passed to this function. If the string value is a valid date, error will
64
- * be null. Also, if the string value is not a valid date, date will be null.
65
- */
66
- onBlur?: (val: {
67
- value: string;
68
- error: string | null;
69
- date: Date | null;
70
- }) => void;
71
- /**
72
- * If it is defined, the component will change its appearance, showing
73
- * the error below the date input component. If it is not defined, the error
74
- * messages will be managed internally, but never displayed on its own.
75
- */
76
- error?: string;
77
- /**
78
- * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
79
- * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
80
- */
81
- autocomplete?: string;
82
- /**
83
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
84
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
85
- */
86
- margin?: Space | Margin;
87
- /**
88
- * Size of the component.
89
- */
90
- size?: "medium" | "large" | "fillParent";
91
- /**
92
- * Value of the tabindex attribute.
93
- */
94
- tabIndex?: number;
95
- };
96
- /**
97
- * Reference to the component.
98
- */
99
- export declare type RefType = HTMLDivElement;
100
- export default Props;
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import DialogPropsType from "./types";
3
- declare const DxcDialog: ({ isCloseVisible, onCloseClick, children, overlay, onBackgroundClick, padding, tabIndex, }: DialogPropsType) => JSX.Element;
4
- export default DxcDialog;