@dxc-technology/halstack-react 0.0.0-011babe → 0.0.0-0355f44

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 (122) hide show
  1. package/dist/BackgroundColorContext.js +46 -0
  2. package/dist/ThemeContext.js +168 -105
  3. package/dist/accordion/Accordion.js +127 -48
  4. package/dist/accordion-group/AccordionGroup.js +34 -4
  5. package/dist/alert/Alert.js +178 -82
  6. package/dist/alert/index.d.ts +51 -0
  7. package/dist/badge/Badge.js +28 -7
  8. package/dist/box/Box.js +28 -19
  9. package/dist/button/Button.js +50 -21
  10. package/dist/card/Card.js +72 -35
  11. package/dist/checkbox/Checkbox.js +95 -26
  12. package/dist/chip/Chip.js +88 -32
  13. package/dist/common/utils.js +2 -22
  14. package/dist/common/variables.js +1376 -238
  15. package/dist/date/Date.js +70 -43
  16. package/dist/date-input/DateInput.js +400 -0
  17. package/dist/date-input/index.d.ts +95 -0
  18. package/dist/dialog/Dialog.js +51 -34
  19. package/dist/dropdown/Dropdown.js +169 -79
  20. package/dist/file-input/FileInput.js +644 -0
  21. package/dist/file-input/FileItem.js +280 -0
  22. package/dist/file-input/index.d.ts +81 -0
  23. package/dist/footer/Footer.js +70 -47
  24. package/dist/footer/dxc_logo.svg +15 -0
  25. package/dist/header/Header.js +89 -58
  26. package/dist/header/dxc_logo_black.svg +8 -0
  27. package/dist/heading/Heading.js +86 -23
  28. package/dist/input-text/InputText.js +234 -104
  29. package/dist/layout/ApplicationLayout.js +11 -10
  30. package/dist/link/Link.js +84 -36
  31. package/dist/main.d.ts +8 -0
  32. package/dist/main.js +68 -4
  33. package/dist/new-select/NewSelect.js +836 -0
  34. package/dist/new-select/index.d.ts +53 -0
  35. package/dist/new-textarea/NewTextarea.js +369 -0
  36. package/dist/new-textarea/index.d.ts +117 -0
  37. package/dist/number-input/NumberInput.js +136 -0
  38. package/dist/number-input/NumberInputContext.js +16 -0
  39. package/dist/number-input/index.d.ts +113 -0
  40. package/dist/paginator/Paginator.js +56 -18
  41. package/dist/password-input/PasswordInput.js +198 -0
  42. package/dist/password-input/index.d.ts +94 -0
  43. package/dist/progress-bar/ProgressBar.js +89 -37
  44. package/dist/radio/Radio.js +28 -11
  45. package/dist/resultsetTable/ResultsetTable.js +76 -44
  46. package/dist/select/Select.js +215 -151
  47. package/dist/sidenav/Sidenav.js +64 -12
  48. package/dist/slider/Slider.js +190 -63
  49. package/dist/spinner/Spinner.js +245 -60
  50. package/dist/switch/Switch.js +50 -20
  51. package/dist/table/Table.js +46 -10
  52. package/dist/tabs/Tabs.js +47 -15
  53. package/dist/tag/Tag.js +64 -33
  54. package/dist/text-input/TextInput.js +971 -0
  55. package/dist/text-input/index.d.ts +135 -0
  56. package/dist/textarea/Textarea.js +68 -36
  57. package/dist/toggle/Toggle.js +0 -2
  58. package/dist/toggle-group/ToggleGroup.js +148 -34
  59. package/dist/upload/Upload.js +16 -13
  60. package/dist/upload/buttons-upload/ButtonsUpload.js +28 -12
  61. package/dist/upload/dragAndDropArea/DragAndDropArea.js +63 -20
  62. package/dist/upload/file-upload/FileToUpload.js +43 -19
  63. package/dist/upload/files-upload/FilesToUpload.js +9 -8
  64. package/dist/upload/readme.md +2 -2
  65. package/dist/upload/transaction/Transaction.js +39 -18
  66. package/dist/upload/transactions/Transactions.js +27 -11
  67. package/dist/wizard/Wizard.js +120 -48
  68. package/dist/wizard/invalid_icon.svg +4 -5
  69. package/dist/wizard/valid_icon.svg +4 -5
  70. package/package.json +6 -4
  71. package/test/AccordionGroup.test.js +16 -0
  72. package/test/Date.test.js +49 -45
  73. package/test/DateInput.test.js +242 -0
  74. package/test/Dropdown.test.js +15 -0
  75. package/test/FileInput.test.js +201 -0
  76. package/test/InputText.test.js +24 -16
  77. package/test/Link.test.js +3 -2
  78. package/test/NewTextarea.test.js +195 -0
  79. package/test/NumberInput.test.js +259 -0
  80. package/test/Paginator.test.js +1 -1
  81. package/test/PasswordInput.test.js +83 -0
  82. package/test/ResultsetTable.test.js +1 -2
  83. package/test/Select.test.js +44 -24
  84. package/test/Spinner.test.js +5 -0
  85. package/test/TextInput.test.js +732 -0
  86. package/test/ToggleGroup.test.js +5 -1
  87. package/test/Upload.test.js +5 -5
  88. package/dist/accordion/Accordion.stories.js +0 -207
  89. package/dist/accordion/readme.md +0 -96
  90. package/dist/accordion-group/AccordionGroup.stories.js +0 -207
  91. package/dist/accordion-group/readme.md +0 -70
  92. package/dist/alert/Alert.stories.js +0 -158
  93. package/dist/alert/close.svg +0 -4
  94. package/dist/alert/error.svg +0 -4
  95. package/dist/alert/info.svg +0 -4
  96. package/dist/alert/readme.md +0 -43
  97. package/dist/alert/success.svg +0 -4
  98. package/dist/alert/warning.svg +0 -4
  99. package/dist/button/Button.stories.js +0 -224
  100. package/dist/button/readme.md +0 -93
  101. package/dist/common/services/example-service.js +0 -10
  102. package/dist/common/services/example-service.test.js +0 -12
  103. package/dist/date/calendar.svg +0 -1
  104. package/dist/date/calendar_dark.svg +0 -1
  105. package/dist/dialog/Dialog.stories.js +0 -217
  106. package/dist/dialog/readme.md +0 -32
  107. package/dist/dropdown/Dropdown.stories.js +0 -249
  108. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  109. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  110. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  111. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  112. package/dist/dropdown/readme.md +0 -69
  113. package/dist/footer/Footer.stories.js +0 -94
  114. package/dist/footer/dxc_logo_wht.png +0 -0
  115. package/dist/header/dxc_logo_black.png +0 -0
  116. package/dist/header/dxc_logo_blk_rgb.svg +0 -6
  117. package/dist/header/dxc_logo_white.png +0 -0
  118. package/dist/input-text/InputText.stories.js +0 -209
  119. package/dist/select/Select.stories.js +0 -235
  120. package/dist/select/readme.md +0 -72
  121. package/dist/slider/Slider.stories.js +0 -241
  122. package/dist/toggle-group/readme.md +0 -82
@@ -0,0 +1,95 @@
1
+ type Size = "small" | "medium" | "large" | "fillParent";
2
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+
10
+ type Props = {
11
+ /**
12
+ * Text to be placed above the date.
13
+ */
14
+ label?: string;
15
+ /**
16
+ * Name attribute of the input element.
17
+ */
18
+ name?: string;
19
+ /**
20
+ * Value of the input element. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
21
+ */
22
+ value?: string;
23
+ /**
24
+ * 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.
25
+ */
26
+ format?: string;
27
+ /**
28
+ * Helper text to be placed above the date.
29
+ */
30
+ helperText?: string;
31
+ /**
32
+ * If true, the date format will appear as placeholder in the field.
33
+ */
34
+ placeholder?: boolean;
35
+ /**
36
+ * If true, the date input will have an action to clear the entered value.
37
+ */
38
+ clearable?: boolean;
39
+ /**
40
+ * If true, the component will be disabled.
41
+ */
42
+ disabled?: boolean;
43
+ /**
44
+ * If true, the date will be optional, showing '(Optional)'
45
+ * next to the label. Otherwise, the field will be considered required and an error will be
46
+ * passed as a parameter to the OnBlur and onChange functions when it has
47
+ * not been filled.
48
+ */
49
+ optional?: boolean;
50
+ /**
51
+ * This function will be called when the user types within the input
52
+ * element of the component. An object including the string value, the
53
+ * error and the date value will be passed to this function.
54
+ * If the string value is a valid date, error will
55
+ * be null. Also, if the string value is not a valid date, date will be null.
56
+ */
57
+ onChange?: (val: { value: string; error: string; date: Date }) => void;
58
+ /**
59
+ * This function will be called when the input element loses the focus.
60
+ * An object including the string value, the error and the date value
61
+ * will be passed to this function. If the string value is a valid date, error will
62
+ * be null. Also, if the string value is not a valid date, date will be null.
63
+ */
64
+ onBlur?: (val: { value: string; error: string; date: Date }) => void;
65
+ /**
66
+ * If it is defined, the component will change its appearance, showing
67
+ * the error below the date input component. If it is not defined, the error
68
+ * messages will be managed internally, but never displayed on its own.
69
+ */
70
+ error?: string;
71
+ /**
72
+ * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
73
+ * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
74
+ */
75
+ autocomplete?: string;
76
+ /**
77
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
78
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
79
+ */
80
+ margin?: Space | Margin;
81
+ /**
82
+ * Size of the component ('medium' | 'large' | 'fillParent').
83
+ */
84
+ size?: Size;
85
+ /**
86
+ * Value of the tabindex attribute.
87
+ */
88
+ tabIndex?: number;
89
+ /**
90
+ * Reference to the component.
91
+ */
92
+ ref?: React.RefObject<HTMLDivElement>;
93
+ };
94
+
95
+ export default function DxcDateInput(props: Props): JSX.Element;
@@ -25,14 +25,14 @@ var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
25
25
 
26
26
  var _propTypes = _interopRequireDefault(require("prop-types"));
27
27
 
28
- require("../common/OpenSans.css");
29
-
30
28
  var _variables = require("../common/variables.js");
31
29
 
32
30
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
33
31
 
32
+ var _BackgroundColorContext = require("../BackgroundColorContext.js");
33
+
34
34
  function _templateObject4() {
35
- var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 34px;\n height: 34px;\n"]);
35
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n"]);
36
36
 
37
37
  _templateObject4 = function _templateObject4() {
38
38
  return data;
@@ -42,7 +42,7 @@ function _templateObject4() {
42
42
  }
43
43
 
44
44
  function _templateObject3() {
45
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: flex-end;\n position: absolute;\n top: 20px;\n right: 20px;\n cursor: pointer;\n padding: 0;\n margin: 0;\n background: none;\n border: none;\n width: 34px;\n height: 34px;\n"]);
45
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: flex-end;\n position: absolute;\n top: ", ";\n right: ", ";\n cursor: pointer;\n padding: 0;\n margin: 0;\n background: none;\n color: ", ";\n width: ", ";\n height: ", ";\n border: none;\n"]);
46
46
 
47
47
  _templateObject3 = function _templateObject3() {
48
48
  return data;
@@ -52,7 +52,7 @@ function _templateObject3() {
52
52
  }
53
53
 
54
54
  function _templateObject2() {
55
- var data = (0, _taggedTemplateLiteral2["default"])(["\n overflow-y: auto;\n font-family: ", ";\n\n ::-webkit-scrollbar {\n width: 3px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n\n & * {\n ::-webkit-scrollbar {\n width: 3px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n }\n"]);
55
+ var data = (0, _taggedTemplateLiteral2["default"])([""]);
56
56
 
57
57
  _templateObject2 = function _templateObject2() {
58
58
  return data;
@@ -62,7 +62,7 @@ function _templateObject2() {
62
62
  }
63
63
 
64
64
  function _templateObject() {
65
- var data = (0, _taggedTemplateLiteral2["default"])(["\n overflow: unset;\n font-family: ", ";\n .MuiBackdrop-root {\n background-color: ", ";\n opacity: ", " !important;\n }\n .MuiDialog-paperWidthSm {\n background-color: ", ";\n max-width: ", ";\n min-width: ", ";\n box-sizing: border-box;\n min-height: ", ";\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2);\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n }\n"]);
65
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n overflow: unset;\n font-family: ", ";\n\n .MuiBackdrop-root {\n background-color: ", ";\n opacity: ", " !important;\n }\n .MuiDialog-paperWidthSm {\n background-color: ", ";\n max-width: ", ";\n min-width: ", ";\n box-sizing: border-box;\n min-height: ", ";\n box-shadow: ", ";\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n }\n"]);
66
66
 
67
67
  _templateObject = function _templateObject() {
68
68
  return data;
@@ -79,7 +79,9 @@ var DxcDialog = function DxcDialog(_ref) {
79
79
  _ref$overlay = _ref.overlay,
80
80
  overlay = _ref$overlay === void 0 ? true : _ref$overlay,
81
81
  onBackgroundClick = _ref.onBackgroundClick,
82
- padding = _ref.padding;
82
+ padding = _ref.padding,
83
+ _ref$tabIndex = _ref.tabIndex,
84
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
83
85
 
84
86
  var _useState = (0, _react.useState)(),
85
87
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -89,21 +91,15 @@ var DxcDialog = function DxcDialog(_ref) {
89
91
  var colorsTheme = (0, _useTheme["default"])();
90
92
 
91
93
  var handleClose = function handleClose() {
92
- if (typeof onCloseClick === "function") {
93
- onCloseClick();
94
- }
94
+ typeof onCloseClick === "function" && onCloseClick();
95
95
  };
96
96
 
97
97
  var handleOverlayClick = function handleOverlayClick() {
98
- if (typeof onBackgroundClick === "function") {
99
- onBackgroundClick();
100
- }
98
+ typeof onBackgroundClick === "function" && onBackgroundClick();
101
99
  };
102
100
 
103
101
  var handleResize = function handleResize(width) {
104
- if (width) {
105
- if (width <= _variables.responsiveSizes.tablet ? setIsResponsive(true) : setIsResponsive(false)) ;
106
- }
102
+ width && width <= _variables.responsiveSizes.tablet ? setIsResponsive(true) : setIsResponsive(false);
107
103
  };
108
104
 
109
105
  var handleEventListener = function handleEventListener() {
@@ -127,18 +123,22 @@ var DxcDialog = function DxcDialog(_ref) {
127
123
  padding: padding,
128
124
  isResponsive: isResponsive
129
125
  }, isCloseVisible && _react["default"].createElement(CloseIconContainer, {
130
- onClick: handleClose
126
+ onClick: handleClose,
127
+ tabIndex: tabIndex
131
128
  }, _react["default"].createElement(CloseIcon, {
132
129
  xmlns: "http://www.w3.org/2000/svg",
133
130
  width: "24",
134
131
  height: "24",
135
- viewBox: "0 0 24 24"
132
+ viewBox: "0 0 24 24",
133
+ fill: "currentColor"
136
134
  }, _react["default"].createElement("path", {
137
- d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
138
- }), _react["default"].createElement("path", {
139
- d: "M0 0h24v24H0z",
135
+ d: "M0 0h24v24H0V0z",
140
136
  fill: "none"
141
- }))), _react["default"].createElement(Children, null, children)));
137
+ }), _react["default"].createElement("path", {
138
+ d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
139
+ }))), _react["default"].createElement(Children, null, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
140
+ color: colorsTheme.dialog.backgroundColor
141
+ }, children))));
142
142
  };
143
143
 
144
144
  var DialogContainer = (0, _styledComponents["default"])(_Dialog["default"])(_templateObject(), function (props) {
@@ -146,7 +146,7 @@ var DialogContainer = (0, _styledComponents["default"])(_Dialog["default"])(_tem
146
146
  }, function (props) {
147
147
  return props.overlay === true ? props.theme.overlayColor : "transparent";
148
148
  }, function (props) {
149
- return props.overlay === true && "0.8";
149
+ return props.overlay === true && props.theme.overlayOpacity;
150
150
  }, function (props) {
151
151
  return props.theme.backgroundColor;
152
152
  }, function (props) {
@@ -156,7 +156,9 @@ var DialogContainer = (0, _styledComponents["default"])(_Dialog["default"])(_tem
156
156
  }, function (props) {
157
157
  return props.isCloseVisible ? "72px" : "";
158
158
  }, function (props) {
159
- return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
159
+ return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
160
+ }, function (props) {
161
+ return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : _variables.spaces["small"];
160
162
  }, function (props) {
161
163
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
162
164
  }, function (props) {
@@ -167,21 +169,35 @@ var DialogContainer = (0, _styledComponents["default"])(_Dialog["default"])(_tem
167
169
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
168
170
  });
169
171
 
170
- var Children = _styledComponents["default"].div(_templateObject2(), function (props) {
171
- return props.theme.fontFamily;
172
+ var Children = _styledComponents["default"].div(_templateObject2());
173
+
174
+ var CloseIconContainer = _styledComponents["default"].button(_templateObject3(), function (props) {
175
+ return props.theme.closeIconTopPosition;
172
176
  }, function (props) {
173
- return props.theme.scrollBarTrackColor;
177
+ return props.theme.closeIconRightPosition;
174
178
  }, function (props) {
175
- return props.theme.scrollBarThumbColor;
179
+ return props.theme.closeIconColor;
176
180
  }, function (props) {
177
- return props.theme.scrollBarTrackColor;
181
+ return props.theme.closeIconWidth;
178
182
  }, function (props) {
179
- return props.theme.scrollBarThumbColor;
183
+ return props.theme.closeIconHeight;
180
184
  });
181
185
 
182
- var CloseIconContainer = _styledComponents["default"].button(_templateObject3());
183
-
184
- var CloseIcon = _styledComponents["default"].svg(_templateObject4());
186
+ var CloseIcon = _styledComponents["default"].svg(_templateObject4(), function (props) {
187
+ return props.theme.closeIconBackgroundColor;
188
+ }, function (props) {
189
+ return props.theme.closeIconWidth;
190
+ }, function (props) {
191
+ return props.theme.closeIconHeight;
192
+ }, function (props) {
193
+ return props.theme.closeIconBorderRadius;
194
+ }, function (props) {
195
+ return props.theme.closeIconBorderThickness;
196
+ }, function (props) {
197
+ return props.theme.closeIconBorderStyle;
198
+ }, function (props) {
199
+ return props.theme.closeIconBorderColor;
200
+ });
185
201
 
186
202
  DxcDialog.propTypes = {
187
203
  padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
@@ -195,7 +211,8 @@ DxcDialog.propTypes = {
195
211
  onClose: _propTypes["default"].func,
196
212
  onCloseClick: _propTypes["default"].func,
197
213
  onBackgroundClick: _propTypes["default"].func,
198
- overlay: _propTypes["default"].bool
214
+ overlay: _propTypes["default"].bool,
215
+ tabIndex: _propTypes["default"].number
199
216
  };
200
217
  var _default = DxcDialog;
201
218
  exports["default"] = _default;