@dxc-technology/halstack-react 0.0.0-8d998c7 → 0.0.0-9005464

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 (88) hide show
  1. package/accordion/types.d.ts +1 -1
  2. package/accordion-group/types.d.ts +1 -1
  3. package/alert/Alert.stories.tsx +170 -0
  4. package/box/Box.d.ts +4 -0
  5. package/box/Box.js +9 -32
  6. package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
  7. package/box/types.d.ts +47 -0
  8. package/box/types.js +5 -0
  9. package/button/Button.d.ts +1 -1
  10. package/button/Button.js +7 -12
  11. package/button/Button.stories.tsx +217 -234
  12. package/button/types.d.ts +10 -10
  13. package/checkbox/Checkbox.stories.tsx +192 -0
  14. package/common/variables.js +29 -21
  15. package/date-input/DateInput.stories.tsx +138 -0
  16. package/dialog/Dialog.d.ts +4 -0
  17. package/dialog/Dialog.js +4 -23
  18. package/dialog/types.d.ts +43 -0
  19. package/dialog/types.js +5 -0
  20. package/footer/Footer.stories.jsx +151 -0
  21. package/header/Header.d.ts +7 -0
  22. package/header/Header.js +26 -28
  23. package/header/Icons.js +2 -27
  24. package/header/types.d.ts +45 -0
  25. package/header/types.js +5 -0
  26. package/link/Link.d.ts +3 -0
  27. package/link/Link.js +1 -23
  28. package/link/Link.stories.tsx +70 -0
  29. package/link/types.d.ts +74 -0
  30. package/link/types.js +5 -0
  31. package/number-input/NumberInput.d.ts +4 -0
  32. package/number-input/NumberInput.js +2 -44
  33. package/number-input/NumberInput.stories.tsx +115 -0
  34. package/number-input/types.d.ts +117 -0
  35. package/number-input/types.js +5 -0
  36. package/package.json +1 -1
  37. package/paginator/Paginator.stories.tsx +63 -0
  38. package/password-input/PasswordInput.d.ts +4 -0
  39. package/password-input/PasswordInput.js +0 -37
  40. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  41. package/password-input/types.d.ts +100 -0
  42. package/password-input/types.js +5 -0
  43. package/progress-bar/ProgressBar.js +1 -1
  44. package/progress-bar/ProgressBar.stories.jsx +58 -0
  45. package/radio/Radio.stories.tsx +192 -0
  46. package/select/Select.stories.tsx +572 -0
  47. package/select/index.d.ts +2 -2
  48. package/sidenav/Sidenav.d.ts +9 -0
  49. package/sidenav/Sidenav.js +4 -13
  50. package/sidenav/types.d.ts +50 -0
  51. package/sidenav/types.js +5 -0
  52. package/slider/Slider.d.ts +1 -1
  53. package/slider/Slider.js +39 -28
  54. package/slider/Slider.stories.tsx +172 -0
  55. package/slider/types.d.ts +2 -7
  56. package/spinner/Spinner.d.ts +4 -0
  57. package/spinner/Spinner.js +6 -23
  58. package/spinner/Spinner.stories.jsx +102 -0
  59. package/spinner/types.d.ts +32 -0
  60. package/spinner/types.js +5 -0
  61. package/switch/Switch.js +2 -2
  62. package/switch/Switch.stories.tsx +160 -0
  63. package/table/Table.d.ts +4 -0
  64. package/table/Table.stories.jsx +276 -0
  65. package/table/types.d.ts +21 -0
  66. package/table/types.js +5 -0
  67. package/tag/Tag.d.ts +4 -0
  68. package/tag/Tag.js +20 -35
  69. package/tag/Tag.stories.tsx +145 -0
  70. package/tag/types.d.ts +60 -0
  71. package/tag/types.js +5 -0
  72. package/text-input/index.d.ts +2 -2
  73. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  74. package/wizard/Wizard.d.ts +4 -0
  75. package/wizard/Wizard.js +11 -51
  76. package/wizard/types.d.ts +64 -0
  77. package/wizard/types.js +5 -0
  78. package/box/index.d.ts +0 -25
  79. package/dialog/index.d.ts +0 -18
  80. package/header/index.d.ts +0 -25
  81. package/link/index.d.ts +0 -23
  82. package/number-input/index.d.ts +0 -113
  83. package/password-input/index.d.ts +0 -94
  84. package/sidenav/index.d.ts +0 -13
  85. package/spinner/index.d.ts +0 -17
  86. package/table/index.d.ts +0 -13
  87. package/tag/index.d.ts +0 -24
  88. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,151 @@
1
+ import React from "react";
2
+ import DxcFooter from "./Footer";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ const social = [
7
+ {
8
+ href: "https://www.linkedin.com/company/dxctechnology",
9
+ logo: (
10
+ <svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 438.536 438.536" fill="currentColor">
11
+ <g>
12
+ <path
13
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
14
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
15
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
16
+ C438.532,59.576,430.49,40.204,414.41,24.123z M133.618,367.157H67.666V169.016h65.952V367.157z M127.626,132.332
17
+ c-6.851,6.567-15.893,9.851-27.124,9.851h-0.288c-10.848,0-19.648-3.284-26.407-9.851c-6.76-6.567-10.138-14.703-10.138-24.41
18
+ c0-9.897,3.476-18.083,10.421-24.556c6.95-6.471,15.942-9.708,26.98-9.708c11.039,0,19.89,3.237,26.553,9.708
19
+ c6.661,6.473,10.088,14.659,10.277,24.556C137.899,117.625,134.477,125.761,127.626,132.332z M370.873,367.157h-65.952v-105.92
20
+ c0-29.879-11.036-44.823-33.116-44.823c-8.374,0-15.42,2.331-21.128,6.995c-5.715,4.661-9.996,10.324-12.847,16.991
21
+ c-1.335,3.422-1.999,8.75-1.999,15.981v110.775h-65.952c0.571-119.529,0.571-185.579,0-198.142h65.952v27.974
22
+ c13.867-21.681,33.558-32.544,59.101-32.544c22.84,0,41.21,7.52,55.104,22.554c13.895,15.037,20.841,37.214,20.841,66.519v113.64
23
+ H370.873z"
24
+ />
25
+ </g>
26
+ </svg>
27
+ ),
28
+ },
29
+ {
30
+ href: "https://twitter.com/dxctechnology",
31
+ logo: (
32
+ <svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 438.536 438.536" fill="currentColor">
33
+ <g>
34
+ <path
35
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
36
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
37
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
38
+ C438.532,59.576,430.49,40.204,414.41,24.123z M335.471,168.735c0.191,1.713,0.288,4.278,0.288,7.71
39
+ c0,15.989-2.334,32.025-6.995,48.104c-4.661,16.087-11.8,31.504-21.416,46.254c-9.606,14.749-21.074,27.791-34.396,39.115
40
+ c-13.325,11.32-29.311,20.365-47.968,27.117c-18.648,6.762-38.637,10.143-59.953,10.143c-33.116,0-63.76-8.952-91.931-26.836
41
+ c4.568,0.568,9.329,0.855,14.275,0.855c27.6,0,52.439-8.565,74.519-25.7c-12.941-0.185-24.506-4.179-34.688-11.991
42
+ c-10.185-7.803-17.273-17.699-21.271-29.691c4.947,0.76,8.658,1.137,11.132,1.137c4.187,0,9.042-0.76,14.56-2.279
43
+ c-13.894-2.669-25.598-9.562-35.115-20.697c-9.519-11.136-14.277-23.84-14.277-38.114v-0.571
44
+ c10.085,4.755,19.602,7.229,28.549,7.422c-17.321-11.613-25.981-28.265-25.981-49.963c0-10.66,2.758-20.747,8.278-30.264
45
+ c15.035,18.464,33.311,33.213,54.816,44.252c21.507,11.038,44.54,17.227,69.092,18.558c-0.95-3.616-1.427-8.186-1.427-13.704
46
+ c0-16.562,5.853-30.692,17.56-42.399c11.703-11.706,25.837-17.561,42.394-17.561c17.515,0,32.079,6.283,43.688,18.846
47
+ c13.134-2.474,25.892-7.33,38.26-14.56c-4.757,14.652-13.613,25.788-26.55,33.402c12.368-1.716,23.88-4.95,34.537-9.708
48
+ C357.458,149.793,347.462,160.166,335.471,168.735z"
49
+ />
50
+ </g>
51
+ </svg>
52
+ ),
53
+ },
54
+ {
55
+ href: "https://www.facebook.com/DXCTechnology/",
56
+ logo: (
57
+ <svg
58
+ version="1.1"
59
+ id="Capa_1"
60
+ x="0px"
61
+ y="0px"
62
+ viewBox="0 0 438.536 438.536"
63
+ fill="currentColor"
64
+ width="1000px"
65
+ height="500px"
66
+ >
67
+ <g>
68
+ <path
69
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
70
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
71
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
72
+ C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
73
+ c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
74
+ c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
75
+ />
76
+ </g>
77
+ </svg>
78
+ ),
79
+ },
80
+ ];
81
+
82
+ const bottom = [
83
+ {
84
+ href: "https://www.linkedin.com/company/dxctechnology",
85
+ text: "Linkedin",
86
+ },
87
+ {
88
+ href: "https://twitter.com/dxctechnology",
89
+ text: "Twitter",
90
+ },
91
+ {
92
+ href: "https://www.facebook.com/DXCTechnology/",
93
+ text: "Facebook",
94
+ },
95
+ ];
96
+
97
+ export default {
98
+ title: "Footer",
99
+ component: DxcFooter,
100
+ };
101
+
102
+ export const Chromatic = () => (
103
+ <>
104
+ <ExampleContainer>
105
+ <Title title="Default" theme="light" level={4} />
106
+ <DxcFooter />
107
+ </ExampleContainer>
108
+ <ExampleContainer>
109
+ <Title title="With children, copyright, bottom links and social links" theme="light" level={4} />
110
+ <DxcFooter copyright="Copyright" socialLinks={social} bottomLinks={bottom}>
111
+ <div>
112
+ <a href="https://www.linkedin.com/company/dxctechnology">Linkedin</a>
113
+ </div>
114
+ </DxcFooter>
115
+ </ExampleContainer>
116
+ <Title title="Margins" theme="light" level={2} />
117
+ <ExampleContainer>
118
+ <Title title="Xxsmall margin" theme="light" level={4} />
119
+ <DxcFooter margin="xxsmall"></DxcFooter>
120
+ <Title title="Xsmall margin" theme="light" level={4} />
121
+ <DxcFooter margin="xsmall"></DxcFooter>
122
+ <Title title="Small margin" theme="light" level={4} />
123
+ <DxcFooter margin="small"></DxcFooter>
124
+ <Title title="Medium margin" theme="light" level={4} />
125
+ <DxcFooter margin="medium"></DxcFooter>
126
+ <Title title="Large margin" theme="light" level={4} />
127
+ <DxcFooter margin="large"></DxcFooter>
128
+ <Title title="Xlarge margin" theme="light" level={4} />
129
+ <DxcFooter margin="xlarge"></DxcFooter>
130
+ <Title title="Xxlarge margin" theme="light" level={4} />
131
+ <DxcFooter margin="xxlarge"></DxcFooter>
132
+ </ExampleContainer>
133
+ <Title title="Padding" theme="light" level={2} />
134
+ <ExampleContainer>
135
+ <Title title="Xxsmall padding" theme="light" level={4} />
136
+ <DxcFooter padding="xxsmall"></DxcFooter>
137
+ <Title title="Xsmall padding" theme="light" level={4} />
138
+ <DxcFooter padding="xsmall"></DxcFooter>
139
+ <Title title="Small padding" theme="light" level={4} />
140
+ <DxcFooter padding="small"></DxcFooter>
141
+ <Title title="Medium padding" theme="light" level={4} />
142
+ <DxcFooter padding="medium"></DxcFooter>
143
+ <Title title="Large padding" theme="light" level={4} />
144
+ <DxcFooter padding="large"></DxcFooter>
145
+ <Title title="Xlarge padding" theme="light" level={4} />
146
+ <DxcFooter padding="xlarge"></DxcFooter>
147
+ <Title title="Xxlarge padding" theme="light" level={4} />
148
+ <DxcFooter padding="xxlarge"></DxcFooter>
149
+ </ExampleContainer>
150
+ </>
151
+ );
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import HeaderPropsType from "./types";
3
+ declare const DxcHeader: {
4
+ ({ underlined, content, responsiveContent, onClick, margin, padding, tabIndex, }: HeaderPropsType): JSX.Element;
5
+ Dropdown: (props: any) => JSX.Element;
6
+ };
7
+ export default DxcHeader;
package/header/Header.js CHANGED
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
13
 
16
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -23,8 +21,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
21
 
24
22
  var _AppBar = _interopRequireDefault(require("@material-ui/core/AppBar"));
25
23
 
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
24
  var _Dropdown = _interopRequireDefault(require("../dropdown/Dropdown"));
29
25
 
30
26
  var _Icons = require("./Icons");
@@ -41,6 +37,27 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
41
37
 
42
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
43
39
 
40
+ var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ height: "24",
43
+ viewBox: "0 0 24 24",
44
+ width: "24"
45
+ }, /*#__PURE__*/_react["default"].createElement("path", {
46
+ 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"
47
+ }), /*#__PURE__*/_react["default"].createElement("path", {
48
+ d: "M0 0h24v24H0z",
49
+ fill: "none"
50
+ }));
51
+
52
+ var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
53
+ xmlns: "http://www.w3.org/2000/svg",
54
+ viewBox: "0 0 24 24",
55
+ width: "24",
56
+ height: "24"
57
+ }, /*#__PURE__*/_react["default"].createElement("path", {
58
+ d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
59
+ }));
60
+
44
61
  var Dropdown = function Dropdown(props) {
45
62
  return /*#__PURE__*/_react["default"].createElement(HeaderDropdown, null, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], props));
46
63
  };
@@ -65,9 +82,9 @@ var getLogoElement = function getLogoElement(themeInput) {
65
82
  var DxcHeader = function DxcHeader(_ref) {
66
83
  var _ref$underlined = _ref.underlined,
67
84
  underlined = _ref$underlined === void 0 ? false : _ref$underlined,
68
- onClick = _ref.onClick,
69
85
  content = _ref.content,
70
86
  responsiveContent = _ref.responsiveContent,
87
+ onClick = _ref.onClick,
71
88
  margin = _ref.margin,
72
89
  padding = _ref.padding,
73
90
  _ref$tabIndex = _ref.tabIndex,
@@ -80,7 +97,7 @@ var DxcHeader = function DxcHeader(_ref) {
80
97
  refSize = _useState2[0],
81
98
  setRefSize = _useState2[1];
82
99
 
83
- var _useState3 = (0, _react.useState)(),
100
+ var _useState3 = (0, _react.useState)(false),
84
101
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
85
102
  isResponsive = _useState4[0],
86
103
  setIsResponsive = _useState4[1];
@@ -158,16 +175,16 @@ var DxcHeader = function DxcHeader(_ref) {
158
175
  tabIndex: tabIndex,
159
176
  underlined: underlined,
160
177
  onClick: handleMenu
161
- }, _Icons.hamburgerIcon, /*#__PURE__*/_react["default"].createElement(HamburguerTitle, null, "Menu"))), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(ResponsiveMenu, {
178
+ }, hamburgerIcon, /*#__PURE__*/_react["default"].createElement(HamburguerTitle, null, "Menu"))), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(ResponsiveMenu, {
162
179
  hasVisibility: isMenuVisible,
163
180
  refSize: refSize
164
181
  }, /*#__PURE__*/_react["default"].createElement(ResponsiveLogoContainer, null, headerResponsiveLogo), /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
165
182
  color: colorsTheme.header.menuBackgroundColor
166
- }, /*#__PURE__*/_react["default"].createElement(ContentContainerComponent, null, responsiveContent(handleMenu))), /*#__PURE__*/_react["default"].createElement(CloseContainer, {
183
+ }, /*#__PURE__*/_react["default"].createElement(ContentContainerComponent, null)), /*#__PURE__*/_react["default"].createElement(CloseContainer, {
167
184
  tabIndex: tabIndex,
168
185
  onClick: handleMenu,
169
186
  className: "closeIcon"
170
- }, _Icons.closeIcon)), /*#__PURE__*/_react["default"].createElement(Overlay, {
187
+ }, closeIcon)), /*#__PURE__*/_react["default"].createElement(Overlay, {
171
188
  onClick: handleMenu,
172
189
  hasVisibility: isMenuVisible,
173
190
  refSize: refSize
@@ -303,24 +320,5 @@ var Overlay = _styledComponents["default"].div(_templateObject15 || (_templateOb
303
320
  return props.theme.overlayZindex;
304
321
  });
305
322
 
306
- DxcHeader.propTypes = {
307
- underlined: _propTypes["default"].bool,
308
- onClick: _propTypes["default"].func,
309
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
310
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
311
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
312
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
313
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
314
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
315
- padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
316
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
317
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
318
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
319
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
320
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
321
- content: _propTypes["default"].object,
322
- responsiveContent: _propTypes["default"].func,
323
- tabIndex: _propTypes["default"].number
324
- };
325
323
  var _default = DxcHeader;
326
324
  exports["default"] = _default;
package/header/Icons.js CHANGED
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.hamburgerIcon = exports.dxcLogo = exports.closeIcon = void 0;
8
+ exports.dxcLogo = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
@@ -31,29 +31,4 @@ var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
31
31
  fill: "#100f0d"
32
32
  }))));
33
33
 
34
- exports.dxcLogo = dxcLogo;
35
-
36
- var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
37
- xmlns: "http://www.w3.org/2000/svg",
38
- height: "24",
39
- viewBox: "0 0 24 24",
40
- width: "24"
41
- }, /*#__PURE__*/_react["default"].createElement("path", {
42
- 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"
43
- }), /*#__PURE__*/_react["default"].createElement("path", {
44
- d: "M0 0h24v24H0z",
45
- fill: "none"
46
- }));
47
-
48
- exports.closeIcon = closeIcon;
49
-
50
- var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
51
- xmlns: "http://www.w3.org/2000/svg",
52
- viewBox: "0 0 24 24",
53
- width: "24",
54
- height: "24"
55
- }, /*#__PURE__*/_react["default"].createElement("path", {
56
- d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
57
- }));
58
-
59
- exports.hamburgerIcon = hamburgerIcon;
34
+ exports.dxcLogo = dxcLogo;
@@ -0,0 +1,45 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Padding = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type Props = {
10
+ /**
11
+ * Wether a contrast line should appear at the bottom of the header.
12
+ */
13
+ underlined?: boolean;
14
+ /**
15
+ * Content showed in the header. Take into account that the component applies styles
16
+ * for the first child in the content, so we recommend the use of React.Fragment
17
+ * to be applied correctly. Otherwise, the styles can be modified.
18
+ */
19
+ content?: React.ReactNode;
20
+ /**
21
+ * Content showed in responsive version. It receives the close menu handler that can
22
+ * be used to add that functionality when a element is clicked.
23
+ */
24
+ responsiveContent?: (closeHandler: () => void) => React.ReactNode;
25
+ /**
26
+ * This function will be called when the user clicks the header logo.
27
+ */
28
+ onClick?: () => void;
29
+ /**
30
+ * Size of the bottom margin to be applied to the header.
31
+ */
32
+ margin?: Space;
33
+ /**
34
+ * Size of the padding to be applied to the custom area of the component.
35
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
36
+ * order to specify different padding sizes.
37
+ */
38
+ padding?: Space | Padding;
39
+ /**
40
+ * Value of the tabindex for all interactuable elements, except those inside the
41
+ * custom area.
42
+ */
43
+ tabIndex?: number;
44
+ };
45
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/link/Link.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import Overload from "./types";
2
+ declare const DxcLink: Overload;
3
+ export default DxcLink;
package/link/Link.js CHANGED
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
13
 
16
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -19,8 +17,6 @@ var _react = _interopRequireDefault(require("react"));
19
17
 
20
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
19
 
22
- var _propTypes = _interopRequireDefault(require("prop-types"));
23
-
24
20
  var _variables = require("../common/variables.js");
25
21
 
26
22
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
@@ -153,7 +149,7 @@ var LinkIcon = _styledComponents["default"].img(_templateObject5 || (_templateOb
153
149
  return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
154
150
  });
155
151
 
156
- var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n \n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
152
+ var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
157
153
  return props.theme.iconSize;
158
154
  }, function (props) {
159
155
  return props.theme.iconSize;
@@ -161,23 +157,5 @@ var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_t
161
157
  return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
162
158
  });
163
159
 
164
- DxcLink.propTypes = {
165
- inheritColor: _propTypes["default"].bool,
166
- disabled: _propTypes["default"].bool,
167
- icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
168
- iconSrc: _propTypes["default"].string,
169
- iconPosition: _propTypes["default"].oneOf(["after", "before"]),
170
- href: _propTypes["default"].string,
171
- onClick: _propTypes["default"].func,
172
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
173
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
174
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
175
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
176
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
177
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
178
- newWindow: _propTypes["default"].bool,
179
- text: _propTypes["default"].string,
180
- tabIndex: _propTypes["default"].number
181
- };
182
160
  var _default = DxcLink;
183
161
  exports["default"] = _default;
@@ -0,0 +1,70 @@
1
+ import React from "react";
2
+ import DxcLink from "./Link";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ export default {
7
+ title: "Link",
8
+ component: DxcLink,
9
+ };
10
+
11
+ const icon = (
12
+ <svg viewBox="0 0 24 24" enable-background="new 0 0 24 24" fill="currentColor">
13
+ <g id="Bounding_Box">
14
+ <rect fill="none" width="24" height="24" />
15
+ </g>
16
+ <g id="Master">
17
+ <path d="M19,9.3V4h-3v2.6L12,3L2,12h3v8h5v-6h4v6h5v-8h3L19,9.3z M10,10c0-1.1,0.9-2,2-2s2,0.9,2,2H10z" />
18
+ </g>
19
+ </svg>
20
+ );
21
+
22
+ export const Chromatic = () => (
23
+ <>
24
+ <ExampleContainer>
25
+ <Title title="Disabled" theme="light" level={4} />
26
+ <DxcLink text="Test" disabled></DxcLink>
27
+ <Title title="Icon before" theme="light" level={4} />
28
+ <DxcLink text="Test" href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
29
+ <Title title="Icon after" theme="light" level={4} />
30
+ <DxcLink text="Test" href="https://www.youtube.com/" icon={icon} iconPosition="after"></DxcLink>
31
+ </ExampleContainer>
32
+ <ExampleContainer pseudoState="pseudo-hover">
33
+ <Title title="With link hovered" theme="light" level={4} />
34
+ <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
35
+ </ExampleContainer>
36
+ <ExampleContainer pseudoState="pseudo-focus">
37
+ <Title title="With link focused" theme="light" level={4} />
38
+ <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
39
+ </ExampleContainer>
40
+ <ExampleContainer pseudoState="pseudo-active">
41
+ <Title title="With link active" theme="light" level={4} />
42
+ <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
43
+ </ExampleContainer>
44
+ <ExampleContainer pseudoState="pseudo-visited">
45
+ <Title title="With link visited" theme="light" level={4} />
46
+ <DxcLink text="Test" href="https://www.amazon.com"></DxcLink>
47
+ </ExampleContainer>
48
+ <ExampleContainer>
49
+ <Title title="Inherit color" theme="light" level={4} />
50
+ This is a <DxcLink text="Test" inheritColor={true}></DxcLink>.
51
+ </ExampleContainer>
52
+ <Title title="Margins" theme="light" level={2} />
53
+ <ExampleContainer>
54
+ <Title title="Xxsmall margin" theme="light" level={4} />
55
+ <DxcLink text="Test" margin="xxsmall" href="https://www.facebook.com/"></DxcLink>
56
+ <Title title="Xsmall margin" theme="light" level={4} />
57
+ <DxcLink text="Test" margin="xsmall" href="https://www.linkedin.com/"></DxcLink>
58
+ <Title title="Small margin" theme="light" level={4} />
59
+ <DxcLink text="Test" margin="small" href="https://www.linkedin.com/"></DxcLink>
60
+ <Title title="Medium margin" theme="light" level={4} />
61
+ <DxcLink text="Test" margin="medium" href="https://www.linkedin.com/"></DxcLink>
62
+ <Title title="Large margin" theme="light" level={4} />
63
+ <DxcLink text="Test" margin="large" href="https://www.linkedin.com/"></DxcLink>
64
+ <Title title="Xlarge margin" theme="light" level={4} />
65
+ <DxcLink text="Test" margin="xlarge" href="https://www.linkedin.com/"></DxcLink>
66
+ <Title title="Xxlarge margin" theme="light" level={4} />
67
+ <DxcLink text="Test" margin="xxlarge" href="https://www.linkedin.com/"></DxcLink>
68
+ </ExampleContainer>
69
+ </>
70
+ );
@@ -0,0 +1,74 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type LinkCommonProps = {
10
+ /**
11
+ * If true, the color is inherited from parent.
12
+ */
13
+ inheritColor?: boolean;
14
+ /**
15
+ * If true, the link is disabled.
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * @Deprecated Source of the icon.
20
+ */
21
+ iconSrc?: string;
22
+ /**
23
+ * Indicates the position of the icon in the component.
24
+ */
25
+ iconPosition?: "before" | "after";
26
+ /**
27
+ * Page to be opened when the user clicks on the link.
28
+ */
29
+ href?: string;
30
+ /**
31
+ * If true, the page is opened in a new browser tab.
32
+ */
33
+ newWindow?: boolean;
34
+ /**
35
+ * If defined, the link will be displayed as a button. This
36
+ * function will be called when the user clicks the link.
37
+ */
38
+ onClick?: () => void;
39
+ /**
40
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
41
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
42
+ */
43
+ margin?: Space | Margin;
44
+ /**
45
+ * Value of the tabindex.
46
+ */
47
+ tabIndex?: number;
48
+ };
49
+ export declare type LinkTextProps = LinkCommonProps & {
50
+ /**
51
+ * Link text.
52
+ */
53
+ text: string;
54
+ /**
55
+ * Element used as the icon that will be placed next to the link text.
56
+ */
57
+ icon?: SVG;
58
+ };
59
+ export declare type LinkIconProps = LinkCommonProps & {
60
+ /**
61
+ * Link text.
62
+ */
63
+ text?: string;
64
+ /**
65
+ * Element used as the icon that will be placed next to the link text.
66
+ */
67
+ icon: SVG;
68
+ };
69
+ declare type Overload = {
70
+ (props: LinkTextProps): JSX.Element;
71
+ (props: LinkIconProps): JSX.Element;
72
+ };
73
+ declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
74
+ export default Overload;
package/link/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import NumberInputPropsType from "./types";
3
+ declare const DxcNumberInput: React.ForwardRefExoticComponent<NumberInputPropsType & React.RefAttributes<HTMLDivElement>>;
4
+ export default DxcNumberInput;
@@ -7,22 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
11
 
14
12
  var _react = _interopRequireDefault(require("react"));
15
13
 
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
14
  var _styledComponents = _interopRequireDefault(require("styled-components"));
19
15
 
20
16
  var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
21
17
 
22
18
  var _NumberInputContext = _interopRequireDefault(require("./NumberInputContext"));
23
19
 
24
- var _variables = require("../common/variables.js");
25
-
26
20
  var _templateObject;
27
21
 
28
22
  var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
@@ -45,7 +39,8 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
45
39
  suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
46
40
  min = _ref.min,
47
41
  max = _ref.max,
48
- step = _ref.step,
42
+ _ref$step = _ref.step,
43
+ step = _ref$step === void 0 ? 1 : _ref$step,
49
44
  onChange = _ref.onChange,
50
45
  onBlur = _ref.onBlur,
51
46
  _ref$error = _ref.error,
@@ -85,44 +80,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
85
80
  })));
86
81
  });
87
82
 
88
- var sizes = {
89
- small: "240px",
90
- medium: "360px",
91
- large: "480px",
92
- fillParent: "100%"
93
- };
94
-
95
83
  var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])));
96
84
 
97
- DxcNumberInput.propTypes = {
98
- label: _propTypes["default"].string,
99
- name: _propTypes["default"].string,
100
- value: _propTypes["default"].string,
101
- helperText: _propTypes["default"].string,
102
- placeholder: _propTypes["default"].string,
103
- error: _propTypes["default"].string,
104
- disabled: _propTypes["default"].bool,
105
- optional: _propTypes["default"].bool,
106
- prefix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
107
- type: _propTypes["default"].oneOf(["svg"])
108
- })]),
109
- suffix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
110
- type: _propTypes["default"].oneOf(["svg"])
111
- })]),
112
- min: _propTypes["default"].number,
113
- max: _propTypes["default"].number,
114
- step: _propTypes["default"].number,
115
- onChange: _propTypes["default"].func,
116
- onBlur: _propTypes["default"].func,
117
- autocomplete: _propTypes["default"].string,
118
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
119
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
120
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
121
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
122
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
123
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
124
- size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
125
- tabIndex: _propTypes["default"].number
126
- };
127
85
  var _default = DxcNumberInput;
128
86
  exports["default"] = _default;