@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-efa7c74

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 (92) hide show
  1. package/alert/Alert.stories.tsx +170 -0
  2. package/alert/types.d.ts +1 -1
  3. package/box/Box.d.ts +1 -1
  4. package/box/Box.js +2 -5
  5. package/box/types.d.ts +0 -4
  6. package/button/Button.d.ts +1 -1
  7. package/button/Button.js +4 -2
  8. package/button/Button.stories.tsx +216 -233
  9. package/button/types.d.ts +2 -2
  10. package/card/Card.js +4 -5
  11. package/card/Card.stories.tsx +201 -0
  12. package/card/ice-cream.jpg +0 -0
  13. package/card/types.d.ts +4 -6
  14. package/checkbox/types.d.ts +1 -1
  15. package/chip/Chip.stories.tsx +121 -0
  16. package/common/variables.js +13 -5
  17. package/date-input/DateInput.stories.tsx +138 -0
  18. package/dialog/Dialog.stories.tsx +212 -0
  19. package/file-input/FileInput.d.ts +4 -0
  20. package/file-input/FileInput.js +7 -28
  21. package/file-input/FileItem.d.ts +14 -0
  22. package/file-input/FileItem.js +4 -15
  23. package/file-input/types.d.ts +87 -0
  24. package/file-input/types.js +5 -0
  25. package/footer/types.d.ts +1 -1
  26. package/header/Header.stories.tsx +162 -0
  27. package/header/types.d.ts +4 -2
  28. package/heading/Heading.d.ts +4 -0
  29. package/heading/Heading.js +6 -23
  30. package/heading/Heading.stories.tsx +53 -0
  31. package/heading/types.d.ts +33 -0
  32. package/heading/types.js +5 -0
  33. package/link/Link.js +2 -2
  34. package/link/Link.stories.tsx +146 -0
  35. package/number-input/NumberInput.d.ts +4 -0
  36. package/number-input/NumberInput.js +2 -44
  37. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  38. package/number-input/NumberInputContext.d.ts +4 -0
  39. package/number-input/NumberInputContext.js +5 -2
  40. package/number-input/numberInputContextTypes.d.ts +19 -0
  41. package/number-input/numberInputContextTypes.js +5 -0
  42. package/number-input/types.d.ts +117 -0
  43. package/number-input/types.js +5 -0
  44. package/package.json +1 -1
  45. package/password-input/types.d.ts +13 -8
  46. package/radio/types.d.ts +2 -2
  47. package/resultsetTable/ResultsetTable.d.ts +4 -0
  48. package/resultsetTable/ResultsetTable.js +0 -25
  49. package/resultsetTable/types.d.ts +63 -0
  50. package/resultsetTable/types.js +5 -0
  51. package/select/Select.stories.tsx +572 -0
  52. package/sidenav/Sidenav.d.ts +9 -0
  53. package/sidenav/Sidenav.js +4 -13
  54. package/sidenav/Sidenav.stories.tsx +165 -0
  55. package/sidenav/types.d.ts +50 -0
  56. package/sidenav/types.js +5 -0
  57. package/slider/Slider.d.ts +1 -1
  58. package/slider/Slider.js +41 -30
  59. package/slider/Slider.stories.tsx +177 -0
  60. package/slider/types.d.ts +2 -7
  61. package/table/Table.js +1 -1
  62. package/tabs/Tabs.js +3 -1
  63. package/tabs/Tabs.stories.tsx +121 -0
  64. package/tabs/types.d.ts +2 -3
  65. package/tag/Tag.d.ts +4 -0
  66. package/tag/Tag.js +3 -24
  67. package/tag/{Tag.stories.jsx → Tag.stories.tsx} +0 -0
  68. package/tag/types.d.ts +60 -0
  69. package/tag/types.js +5 -0
  70. package/text-input/TextInput.d.ts +4 -0
  71. package/text-input/TextInput.js +4 -44
  72. package/text-input/types.d.ts +157 -0
  73. package/text-input/types.js +5 -0
  74. package/toggle-group/ToggleGroup.d.ts +4 -0
  75. package/toggle-group/ToggleGroup.js +5 -31
  76. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  77. package/toggle-group/types.d.ts +84 -0
  78. package/toggle-group/types.js +5 -0
  79. package/wizard/Wizard.d.ts +4 -0
  80. package/wizard/Wizard.js +11 -51
  81. package/wizard/Wizard.stories.jsx +224 -0
  82. package/wizard/types.d.ts +64 -0
  83. package/wizard/types.js +5 -0
  84. package/file-input/index.d.ts +0 -81
  85. package/heading/index.d.ts +0 -17
  86. package/number-input/index.d.ts +0 -113
  87. package/resultsetTable/index.d.ts +0 -19
  88. package/sidenav/index.d.ts +0 -13
  89. package/tag/index.d.ts +0 -24
  90. package/text-input/index.d.ts +0 -135
  91. package/toggle-group/index.d.ts +0 -21
  92. package/wizard/index.d.ts +0 -18
@@ -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 _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
@@ -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"));
@@ -37,8 +33,7 @@ var DxcHeading = function DxcHeading(_ref) {
37
33
  _ref$text = _ref.text,
38
34
  text = _ref$text === void 0 ? "" : _ref$text,
39
35
  as = _ref.as,
40
- _ref$weight = _ref.weight,
41
- weight = _ref$weight === void 0 ? "" : _ref$weight,
36
+ weight = _ref.weight,
42
37
  margin = _ref.margin;
43
38
  var colorsTheme = (0, _useTheme["default"])();
44
39
 
@@ -51,19 +46,19 @@ var DxcHeading = function DxcHeading(_ref) {
51
46
  }, /*#__PURE__*/_react["default"].createElement(HeadingContainer, {
52
47
  margin: margin
53
48
  }, level === 1 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel1, {
54
- as: checkValidAs(as),
49
+ as: checkValidAs(),
55
50
  weight: weight
56
51
  }, text) : level === 2 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel2, {
57
- as: checkValidAs(as),
52
+ as: checkValidAs(),
58
53
  weight: weight
59
54
  }, text) : level === 3 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel3, {
60
- as: checkValidAs(as),
55
+ as: checkValidAs(),
61
56
  weight: weight
62
57
  }, text) : level === 4 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel4, {
63
- as: checkValidAs(as),
58
+ as: checkValidAs(),
64
59
  weight: weight
65
60
  }, text) : /*#__PURE__*/_react["default"].createElement(HeadingLevel5, {
66
- as: checkValidAs(as),
61
+ as: checkValidAs(),
67
62
  weight: weight
68
63
  }, text)));
69
64
  };
@@ -160,17 +155,5 @@ var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6 || (_templa
160
155
  return props.theme.level5FontColor;
161
156
  });
162
157
 
163
- DxcHeading.propTypes = {
164
- level: _propTypes["default"].number,
165
- text: _propTypes["default"].string,
166
- as: _propTypes["default"].oneOf(["h1", "h2", "h3", "h4", "h5"]),
167
- weight: _propTypes["default"].oneOf(["light", "normal", "bold", ""]),
168
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
169
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
170
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
171
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
172
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
173
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
174
- };
175
158
  var _default = DxcHeading;
176
159
  exports["default"] = _default;
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import DxcHeading from "./Heading";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ export default {
7
+ title: "Heading",
8
+ component: DxcHeading,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <Title title="Levels" theme="light" level={2} />
14
+ <ExampleContainer>
15
+ <Title title="Level 1" theme="light" level={4} />
16
+ <DxcHeading text="Heading for sections within the page" />
17
+ <Title title="Level 2" theme="light" level={4} />
18
+ <DxcHeading text="Heading for sections within the page" level={2} />
19
+ <Title title="Level 3" theme="light" level={4} />
20
+ <DxcHeading text="Heading for sections within the page" level={3} />
21
+ <Title title="Level 4" theme="light" level={4} />
22
+ <DxcHeading text="Heading for sections within the page" level={4} />
23
+ <Title title="Level 5" theme="light" level={4} />
24
+ <DxcHeading text="Heading for sections within the page" level={5} />
25
+ </ExampleContainer>
26
+ <Title title="Weights" theme="light" level={2} />
27
+ <ExampleContainer>
28
+ <Title title="'light' Weight" theme="light" level={4} />
29
+ <DxcHeading text="Heading for sections within the page" level={2} weight="light" />
30
+ <Title title="'normal' Weight" theme="light" level={4} />
31
+ <DxcHeading text="Heading for sections within the page" level={4} weight="normal" />
32
+ <Title title="'bold' Weight" theme="light" level={4} />
33
+ <DxcHeading text="Heading for sections within the page" weight="bold" />
34
+ </ExampleContainer>
35
+ <Title title="Margins" theme="light" level={2} />
36
+ <ExampleContainer>
37
+ <Title title="Xxsmall" theme="light" level={4} />
38
+ <DxcHeading text="Xxsmall" margin="xxsmall" />
39
+ <Title title="Xsmall" theme="light" level={4} />
40
+ <DxcHeading text="Xsmall" margin="xsmall" />
41
+ <Title title="Small" theme="light" level={4} />
42
+ <DxcHeading text="Small" margin="small" />
43
+ <Title title="Medium" theme="light" level={4} />
44
+ <DxcHeading text="Medium" margin="medium" />
45
+ <Title title="Large" theme="light" level={4} />
46
+ <DxcHeading text="Large" margin="large" />
47
+ <Title title="Xlarge" theme="light" level={4} />
48
+ <DxcHeading text="Xlarge" margin="xlarge" />
49
+ <Title title="Xxlarge" theme="light" level={4} />
50
+ <DxcHeading text="Xxlarge" margin="xxlarge" />
51
+ </ExampleContainer>
52
+ </>
53
+ );
@@ -0,0 +1,33 @@
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
+ * Defines the heading level from 1 to 5. The styles of the heading are applied according to the level.
11
+ * The html tag of the heading will be the one specified in the 'as' prop.
12
+ * If 'as' is not specified, the html tag of the heading is the one specified in the 'level' prop.
13
+ */
14
+ level?: 1 | 2 | 3 | 4 | 5;
15
+ /**
16
+ * Heading text.
17
+ */
18
+ text: string;
19
+ /**
20
+ * Specifies the html tag of the heading.
21
+ */
22
+ as?: "h1" | "h2" | "h3" | "h4" | "h5";
23
+ /**
24
+ * Modifies the default weight of the heading.
25
+ */
26
+ weight?: "light" | "normal" | "bold";
27
+ /**
28
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
29
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
30
+ */
31
+ margin?: Space | Margin;
32
+ };
33
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/link/Link.js CHANGED
@@ -89,7 +89,7 @@ var DxcLinkContainer = _styledComponents["default"].div(_templateObject || (_tem
89
89
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
90
90
  });
91
91
 
92
- var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n\n text-decoration-color: transparent;\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n outline-color: ", ";\n outline-width: 2px;\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
92
+ var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n\n text-decoration-color: transparent;\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
93
93
  return props.inheritColor ? "inherit" : !props.disabled ? props.theme.fontColor : props.theme.disabledColor;
94
94
  }, function (props) {
95
95
  return props.disabled ? "pointer-events: none;" : "";
@@ -109,7 +109,7 @@ var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateOb
109
109
  return "color: ".concat(props.theme.activeFontColor, " !important;\n border-bottom-color: ").concat(props.theme.activeUnderlineColor, " !important;");
110
110
  });
111
111
 
112
- var StyledButton = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n text-decoration-color: transparent;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:hover {\n ", "\n }\n &:focus {\n outline-color: ", ";\n outline-width: 2px;\n outline-offset: 1px;\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
112
+ var StyledButton = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n text-decoration-color: transparent;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
113
113
  return "padding-bottom: ".concat(props.theme.underlineSpacing, ";\n border-bottom: ").concat(props.theme.underlineThickness, " ").concat(props.theme.underlineStyle, " transparent;");
114
114
  }, function (props) {
115
115
  return props.disabled && "cursor: default;";
@@ -0,0 +1,146 @@
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
+ <Title title="With anchor" theme="light" level={2} />
25
+ <ExampleContainer>
26
+ <Title title="Disabled" theme="light" level={4} />
27
+ <DxcLink text="Test" disabled></DxcLink>
28
+ <Title title="Icon before" theme="light" level={4} />
29
+ <DxcLink text="Test" href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
30
+ <Title title="Icon after" theme="light" level={4} />
31
+ <DxcLink text="Test" href="https://www.youtube.com/" icon={icon} iconPosition="after"></DxcLink>
32
+ </ExampleContainer>
33
+ <ExampleContainer pseudoState="pseudo-hover">
34
+ <Title title="With link hovered" theme="light" level={4} />
35
+ <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
36
+ </ExampleContainer>
37
+ <ExampleContainer pseudoState="pseudo-focus">
38
+ <Title title="With link focused" theme="light" level={4} />
39
+ <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
40
+ </ExampleContainer>
41
+ <ExampleContainer pseudoState="pseudo-active">
42
+ <Title title="With link active" theme="light" level={4} />
43
+ <DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
44
+ </ExampleContainer>
45
+ <ExampleContainer pseudoState="pseudo-visited">
46
+ <Title title="With link visited" theme="light" level={4} />
47
+ <DxcLink text="Test" href="https://www.amazon.com"></DxcLink>
48
+ </ExampleContainer>
49
+ <ExampleContainer>
50
+ <Title title="Inherit color" theme="light" level={4} />
51
+ This is a <DxcLink text="Test" inheritColor={true}></DxcLink>.
52
+ </ExampleContainer>
53
+ <ExampleContainer pseudoState="pseudo-focus">
54
+ <Title title="With brackets and focus" theme="light" level={4} />
55
+ This is a (<DxcLink text="Test" inheritColor={true}></DxcLink>).
56
+ </ExampleContainer>
57
+ <ExampleContainer pseudoState="pseudo-hover">
58
+ <Title title="Long text with hover" theme="light" level={4} />
59
+ Lorem <DxcLink text="Test" href="https://www.google.com"></DxcLink> ipsum dolor sit amet, consectetur adipiscing
60
+ elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
61
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
62
+ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
63
+ in culpa qui officia deserunt mollit anim id est laborum.
64
+ </ExampleContainer>
65
+ <ExampleContainer pseudoState="pseudo-focus">
66
+ <Title title="Long text with focus" theme="light" level={4} />
67
+ Lorem <DxcLink text="Test" href="https://www.google.com"></DxcLink> ipsum dolor sit amet, consectetur adipiscing
68
+ elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
69
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
70
+ voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
71
+ in culpa qui officia deserunt mollit anim id est laborum.
72
+ </ExampleContainer>
73
+ <Title title="With button" theme="light" level={2} />
74
+ <ExampleContainer>
75
+ <Title title="Disabled" theme="light" level={4} />
76
+ <DxcLink text="Test" onClick={() => {}} disabled></DxcLink>
77
+ <Title title="Icon before" theme="light" level={4} />
78
+ <DxcLink text="Test" onClick={() => {}} href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
79
+ <Title title="Icon after" theme="light" level={4} />
80
+ <DxcLink
81
+ text="Test"
82
+ onClick={() => {}}
83
+ href="https://www.youtube.com/"
84
+ icon={icon}
85
+ iconPosition="after"
86
+ ></DxcLink>
87
+ </ExampleContainer>
88
+ <ExampleContainer pseudoState="pseudo-hover">
89
+ <Title title="With link hovered" theme="light" level={4} />
90
+ <DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
91
+ </ExampleContainer>
92
+ <ExampleContainer pseudoState="pseudo-focus">
93
+ <Title title="With link focused" theme="light" level={4} />
94
+ <DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
95
+ </ExampleContainer>
96
+ <ExampleContainer pseudoState="pseudo-active">
97
+ <Title title="With link active" theme="light" level={4} />
98
+ <DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
99
+ </ExampleContainer>
100
+ <ExampleContainer pseudoState="pseudo-visited">
101
+ <Title title="With link visited" theme="light" level={4} />
102
+ <DxcLink text="Test" onClick={() => {}} href="https://www.amazon.com"></DxcLink>
103
+ </ExampleContainer>
104
+ <ExampleContainer>
105
+ <Title title="Inherit color" theme="light" level={4} />
106
+ This is a <DxcLink text="Test" onClick={() => {}} inheritColor={true}></DxcLink>.
107
+ </ExampleContainer>
108
+ <ExampleContainer pseudoState="pseudo-focus">
109
+ <Title title="With brackets and focus" theme="light" level={4} />
110
+ This is a (<DxcLink text="Test" onClick={() => {}} inheritColor={true}></DxcLink>).
111
+ </ExampleContainer>
112
+ <ExampleContainer pseudoState="pseudo-hover">
113
+ <Title title="Long text with hover" theme="light" level={4} />
114
+ Lorem <DxcLink text="Test" onClick={() => {}} href="https://www.google.com"></DxcLink> ipsum dolor sit amet,
115
+ consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
116
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
117
+ in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
118
+ non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
119
+ </ExampleContainer>
120
+ <ExampleContainer pseudoState="pseudo-focus">
121
+ <Title title="Long text with focus" theme="light" level={4} />
122
+ Lorem <DxcLink text="Test" onClick={() => {}} href="https://www.google.com"></DxcLink> ipsum dolor sit amet,
123
+ consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
124
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
125
+ in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
126
+ non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
127
+ </ExampleContainer>
128
+ <Title title="Margins" theme="light" level={2} />
129
+ <ExampleContainer>
130
+ <Title title="Xxsmall margin" theme="light" level={4} />
131
+ <DxcLink text="Test" margin="xxsmall" href="https://www.facebook.com/"></DxcLink>
132
+ <Title title="Xsmall margin" theme="light" level={4} />
133
+ <DxcLink text="Test" margin="xsmall" href="https://www.linkedin.com/"></DxcLink>
134
+ <Title title="Small margin" theme="light" level={4} />
135
+ <DxcLink text="Test" margin="small" href="https://www.linkedin.com/"></DxcLink>
136
+ <Title title="Medium margin" theme="light" level={4} />
137
+ <DxcLink text="Test" margin="medium" href="https://www.linkedin.com/"></DxcLink>
138
+ <Title title="Large margin" theme="light" level={4} />
139
+ <DxcLink text="Test" margin="large" href="https://www.linkedin.com/"></DxcLink>
140
+ <Title title="Xlarge margin" theme="light" level={4} />
141
+ <DxcLink text="Test" margin="xlarge" href="https://www.linkedin.com/"></DxcLink>
142
+ <Title title="Xxlarge margin" theme="light" level={4} />
143
+ <DxcLink text="Test" margin="xxlarge" href="https://www.linkedin.com/"></DxcLink>
144
+ </ExampleContainer>
145
+ </>
146
+ );
@@ -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;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import NumberInputContextPropsType from "./numberInputContextTypes";
3
+ declare const NumberInputContext: React.Context<NumberInputContextPropsType>;
4
+ export default NumberInputContext;
@@ -9,8 +9,11 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- /* eslint-disable prefer-template */
13
- var NumberInputContext = /*#__PURE__*/_react["default"].createContext();
12
+ var defaultState = {
13
+ stepNumber: 1
14
+ };
15
+
16
+ var NumberInputContext = /*#__PURE__*/_react["default"].createContext(defaultState);
14
17
 
15
18
  var _default = NumberInputContext;
16
19
  exports["default"] = _default;
@@ -0,0 +1,19 @@
1
+ declare type Props = {
2
+ /**
3
+ * Type of the input.
4
+ */
5
+ typeNumber?: string;
6
+ /**
7
+ * Minimum value allowed by the number input.
8
+ */
9
+ minNumber?: number;
10
+ /**
11
+ * Maximum value allowed by the number input.
12
+ */
13
+ maxNumber?: number;
14
+ /**
15
+ * The step interval to use when using the up and down arrows to adjust the value.
16
+ */
17
+ stepNumber?: number;
18
+ };
19
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,117 @@
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 number.
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
+ * Helper text to be placed above the number.
23
+ */
24
+ helperText?: string;
25
+ /**
26
+ * Text to be put as placeholder of the number.
27
+ */
28
+ placeholder?: string;
29
+ /**
30
+ * If true, the component will be disabled.
31
+ */
32
+ disabled?: boolean;
33
+ /**
34
+ * If true, the number will be optional, showing '(Optional)'
35
+ * next to the label. Otherwise, the field will be considered required
36
+ * and an error will be passed as a parameter to the OnBlur and onChange
37
+ * functions when it has not been filled.
38
+ */
39
+ optional?: boolean;
40
+ /**
41
+ * Prefix to be placed before the number value.
42
+ */
43
+ prefix?: string;
44
+ /**
45
+ * Suffix to be placed after the number value.
46
+ */
47
+ suffix?: string;
48
+ /**
49
+ * Minimum value allowed by the number input. If the typed value by the user is
50
+ * lower than min, the onBlur and onChange functions will be called with
51
+ * the current value and an internal error informing that the current
52
+ * value is not correct. If a valid state is reached, the error parameter
53
+ * will be null in both events.
54
+ */
55
+ min?: number;
56
+ /**
57
+ * Maximum value allowed by the number input. If the typed value by the user
58
+ * surpasses max, the onBlur and onChange functions will be called with
59
+ * the current value and an internal error informing that the current
60
+ * value is not correct. If a valid state is reached, the error parameter
61
+ * will be null in both events.
62
+ */
63
+ max?: number;
64
+ /**
65
+ * The step interval to use when using the up and down arrows to adjust the value.
66
+ */
67
+ step?: number;
68
+ /**
69
+ * This function will be called when the user types within the input
70
+ * element of the component. An object including the current value and
71
+ * the error (if the value entered is not valid) will be passed to this
72
+ * function. If there is no error, error will be null.
73
+ */
74
+ onChange?: (val: {
75
+ value: string;
76
+ error: string | null;
77
+ }) => void;
78
+ /**
79
+ * This function will be called when the input element loses the focus.
80
+ * An object including the input value and the error (if the value
81
+ * entered is not valid) will be passed to this function. If there is no error,
82
+ * error will be null.
83
+ */
84
+ onBlur?: (val: {
85
+ value: string;
86
+ error: string | null;
87
+ }) => void;
88
+ /**
89
+ * If it is defined, the component will change its appearance, showing
90
+ * the error below the input component. If it is not defined, the error
91
+ * messages will be managed internally, but never displayed on its own.
92
+ */
93
+ error?: string;
94
+ /**
95
+ * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
96
+ * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
97
+ */
98
+ autocomplete?: string;
99
+ /**
100
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
101
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
102
+ */
103
+ margin?: Space | Margin;
104
+ /**
105
+ * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
106
+ */
107
+ size?: "small" | "medium" | "large" | "fillParent";
108
+ /**
109
+ * Value of the tabindex attribute.
110
+ */
111
+ tabIndex?: number;
112
+ };
113
+ /**
114
+ * Reference to the component.
115
+ */
116
+ export declare type RefType = HTMLDivElement;
117
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxc-technology/halstack-react",
3
- "version": "0.0.0-ee92231",
3
+ "version": "0.0.0-efa7c74",
4
4
  "description": "DXC Halstack React components library",
5
5
  "repository": "dxc-technology/halstack-react",
6
6
  "homepage": "http://developer.dxc.com/tools/react",
@@ -5,6 +5,14 @@ declare type Margin = {
5
5
  left?: Space;
6
6
  right?: Space;
7
7
  };
8
+ declare type RequiredMinLength = {
9
+ min: number;
10
+ max?: number;
11
+ };
12
+ declare type RequiredMaxLength = {
13
+ min?: number;
14
+ max: number;
15
+ };
8
16
  declare type Props = {
9
17
  /**
10
18
  * Text to be placed above the password.
@@ -37,10 +45,10 @@ declare type Props = {
37
45
  error: string | null;
38
46
  }) => void;
39
47
  /**
40
- * This function will be called when the input element loses the focus.
41
- * An object including the input value and the error (if the value entered is
42
- * not valid) will be passed to this function. If there is no error, error will be null.
43
- */
48
+ * This function will be called when the input element loses the focus.
49
+ * An object including the input value and the error (if the value entered is
50
+ * not valid) will be passed to this function. If there is no error, error will be null.
51
+ */
44
52
  onBlur?: (val: {
45
53
  value: string;
46
54
  error: string | null;
@@ -70,10 +78,7 @@ declare type Props = {
70
78
  * length does not comply the specified range. If a valid length is
71
79
  * reached, the error parameter of both events will be null.
72
80
  */
73
- length?: {
74
- min?: number;
75
- max?: number;
76
- };
81
+ length?: RequiredMinLength | RequiredMaxLength;
77
82
  /**
78
83
  * 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
84
  * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...