@dxc-technology/halstack-react 0.0.0-d20b360 → 0.0.0-d238e47

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 (110) hide show
  1. package/alert/Alert.stories.tsx +170 -0
  2. package/alert/types.d.ts +1 -1
  3. package/box/Box.d.ts +4 -0
  4. package/box/Box.js +4 -30
  5. package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
  6. package/box/types.d.ts +43 -0
  7. package/box/types.js +5 -0
  8. package/button/Button.d.ts +1 -1
  9. package/button/Button.js +7 -10
  10. package/button/Button.stories.tsx +217 -234
  11. package/button/types.d.ts +11 -11
  12. package/card/Card.js +4 -5
  13. package/card/Card.stories.tsx +201 -0
  14. package/card/ice-cream.jpg +0 -0
  15. package/card/types.d.ts +4 -6
  16. package/checkbox/types.d.ts +1 -1
  17. package/chip/Chip.stories.tsx +121 -0
  18. package/common/variables.js +29 -21
  19. package/date-input/DateInput.stories.tsx +138 -0
  20. package/dialog/Dialog.stories.tsx +212 -0
  21. package/file-input/FileInput.d.ts +4 -0
  22. package/file-input/FileInput.js +7 -28
  23. package/file-input/FileItem.d.ts +14 -0
  24. package/file-input/FileItem.js +4 -15
  25. package/file-input/types.d.ts +87 -0
  26. package/file-input/types.js +5 -0
  27. package/footer/types.d.ts +1 -1
  28. package/header/Header.stories.tsx +162 -0
  29. package/header/types.d.ts +4 -2
  30. package/heading/Heading.d.ts +4 -0
  31. package/heading/Heading.js +6 -23
  32. package/heading/Heading.stories.tsx +53 -0
  33. package/heading/types.d.ts +33 -0
  34. package/heading/types.js +5 -0
  35. package/link/Link.d.ts +3 -0
  36. package/link/Link.js +3 -25
  37. package/link/Link.stories.tsx +146 -0
  38. package/link/types.d.ts +74 -0
  39. package/link/types.js +5 -0
  40. package/number-input/NumberInput.d.ts +4 -0
  41. package/number-input/NumberInput.js +2 -44
  42. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  43. package/number-input/NumberInputContext.d.ts +4 -0
  44. package/number-input/NumberInputContext.js +5 -2
  45. package/number-input/numberInputContextTypes.d.ts +19 -0
  46. package/number-input/numberInputContextTypes.js +5 -0
  47. package/number-input/types.d.ts +117 -0
  48. package/number-input/types.js +5 -0
  49. package/package.json +1 -1
  50. package/password-input/PasswordInput.d.ts +4 -0
  51. package/password-input/PasswordInput.js +0 -37
  52. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  53. package/password-input/types.d.ts +105 -0
  54. package/password-input/types.js +5 -0
  55. package/progress-bar/ProgressBar.stories.jsx +58 -0
  56. package/radio/types.d.ts +2 -2
  57. package/resultsetTable/ResultsetTable.d.ts +4 -0
  58. package/resultsetTable/ResultsetTable.js +0 -25
  59. package/resultsetTable/types.d.ts +63 -0
  60. package/resultsetTable/types.js +5 -0
  61. package/select/Select.stories.tsx +572 -0
  62. package/sidenav/Sidenav.d.ts +9 -0
  63. package/sidenav/Sidenav.js +4 -13
  64. package/sidenav/Sidenav.stories.tsx +165 -0
  65. package/sidenav/types.d.ts +50 -0
  66. package/sidenav/types.js +5 -0
  67. package/slider/Slider.d.ts +1 -1
  68. package/slider/Slider.js +41 -30
  69. package/slider/Slider.stories.tsx +177 -0
  70. package/slider/types.d.ts +2 -7
  71. package/spinner/Spinner.d.ts +4 -0
  72. package/spinner/Spinner.js +0 -17
  73. package/spinner/types.d.ts +32 -0
  74. package/spinner/types.js +5 -0
  75. package/switch/Switch.js +2 -2
  76. package/switch/Switch.stories.tsx +160 -0
  77. package/table/Table.d.ts +4 -0
  78. package/table/Table.js +1 -1
  79. package/table/types.d.ts +21 -0
  80. package/table/types.js +5 -0
  81. package/tabs/Tabs.js +3 -1
  82. package/tabs/types.d.ts +2 -3
  83. package/tag/Tag.d.ts +4 -0
  84. package/tag/Tag.js +20 -35
  85. package/tag/Tag.stories.tsx +145 -0
  86. package/tag/types.d.ts +60 -0
  87. package/tag/types.js +5 -0
  88. package/text-input/TextInput.d.ts +4 -0
  89. package/text-input/TextInput.js +4 -44
  90. package/text-input/types.d.ts +157 -0
  91. package/text-input/types.js +5 -0
  92. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  93. package/wizard/Wizard.d.ts +4 -0
  94. package/wizard/Wizard.js +11 -51
  95. package/wizard/Wizard.stories.jsx +224 -0
  96. package/wizard/types.d.ts +64 -0
  97. package/wizard/types.js +5 -0
  98. package/box/index.d.ts +0 -25
  99. package/file-input/index.d.ts +0 -81
  100. package/heading/index.d.ts +0 -17
  101. package/link/index.d.ts +0 -23
  102. package/number-input/index.d.ts +0 -113
  103. package/password-input/index.d.ts +0 -94
  104. package/resultsetTable/index.d.ts +0 -19
  105. package/sidenav/index.d.ts +0 -13
  106. package/spinner/index.d.ts +0 -17
  107. package/table/index.d.ts +0 -13
  108. package/tag/index.d.ts +0 -24
  109. package/text-input/index.d.ts +0 -135
  110. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,170 @@
1
+ import React from "react";
2
+ import DxcAlert from "./Alert";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ export default {
7
+ title: "Alert",
8
+ component: DxcAlert,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <ExampleContainer>
14
+ <Title title="Info" theme="light" level={4} />
15
+ <DxcAlert inlineText="Info type alert with inline text." />
16
+ </ExampleContainer>
17
+ <ExampleContainer>
18
+ <Title title="Confirm" theme="light" level={4} />
19
+ <DxcAlert type="confirm" inlineText="Confirm type alert with inline text." />
20
+ </ExampleContainer>
21
+ <ExampleContainer>
22
+ <Title title="Warning" theme="light" level={4} />
23
+ <DxcAlert type="warning" inlineText="Warning type alert with inline text." />
24
+ </ExampleContainer>
25
+ <ExampleContainer>
26
+ <Title title="Error" theme="light" level={4} />
27
+ <DxcAlert type="error" inlineText="Error type alert with inline text." />
28
+ </ExampleContainer>
29
+ <ExampleContainer>
30
+ <Title title="With close button" theme="light" level={4} />
31
+ <DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
32
+ </ExampleContainer>
33
+ <ExampleContainer pseudoState="pseudo-hover">
34
+ <Title title="With hovered close button" theme="light" level={4} />
35
+ <DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
36
+ </ExampleContainer>
37
+ <ExampleContainer pseudoState="pseudo-focus">
38
+ <Title title="With focused close button" theme="light" level={4} />
39
+ <DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
40
+ </ExampleContainer>
41
+ <ExampleContainer pseudoState="pseudo-active">
42
+ <Title title="With actived close button" theme="light" level={4} />
43
+ <DxcAlert inlineText="Info type alert with inline text and close button." onClose={() => {}} />
44
+ </ExampleContainer>
45
+ <ExampleContainer>
46
+ <Title title="With children" theme="light" level={4} />
47
+ <DxcAlert>
48
+ <div>
49
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
50
+ lobortis eget.
51
+ </div>
52
+ </DxcAlert>
53
+ </ExampleContainer>
54
+ <ExampleContainer>
55
+ <Title title="With inline text and children" theme="light" level={4} />
56
+ <DxcAlert inlineText="Info type alert with inline text.">
57
+ <div>
58
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
59
+ lobortis eget.
60
+ </div>
61
+ </DxcAlert>
62
+ </ExampleContainer>
63
+ <Title title="Margins" theme="light" level={2} />
64
+ <ExampleContainer>
65
+ <Title title="Xxsmall" theme="light" level={4} />
66
+ <DxcAlert margin="xxsmall" inlineText="Info type alert with inline text and xxsmall margin." />
67
+ </ExampleContainer>
68
+ <ExampleContainer>
69
+ <Title title="Xsmall" theme="light" level={4} />
70
+ <DxcAlert margin="xsmall" inlineText="Info type alert with inline text and xsmall margin." />
71
+ </ExampleContainer>
72
+ <ExampleContainer>
73
+ <Title title="Small" theme="light" level={4} />
74
+ <DxcAlert margin="small" inlineText="Info type alert with inline text and small margin." />
75
+ </ExampleContainer>
76
+ <ExampleContainer>
77
+ <Title title="Medium" theme="light" level={4} />
78
+ <DxcAlert margin="medium" inlineText="Info type alert with inline text and medium margin." />
79
+ </ExampleContainer>
80
+ <ExampleContainer>
81
+ <Title title="Large" theme="light" level={4} />
82
+ <DxcAlert margin="large" inlineText="Info type alert with inline text and large margin." />
83
+ </ExampleContainer>
84
+ <ExampleContainer>
85
+ <Title title="Xlarge" theme="light" level={4} />
86
+ <DxcAlert margin="xlarge" inlineText="Info type alert with inline text and xlarge margin." />
87
+ </ExampleContainer>
88
+ <ExampleContainer>
89
+ <Title title="Xxlarge" theme="light" level={4} />
90
+ <DxcAlert margin="xxlarge" inlineText="Info type alert with inline text and xxlarge margin." />
91
+ </ExampleContainer>
92
+ <Title title="Sizes" theme="light" level={2} />
93
+ <ExampleContainer>
94
+ <Title title="FitContent" theme="light" level={4} />
95
+ <DxcAlert
96
+ size="fitContent"
97
+ inlineText="Info type alert with inline text, children, close button and fitContent size."
98
+ onClose={() => {}}
99
+ >
100
+ <div>
101
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
102
+ lobortis eget.
103
+ </div>
104
+ </DxcAlert>
105
+ </ExampleContainer>
106
+ <ExampleContainer>
107
+ <Title title="Small" theme="light" level={4} />
108
+ <DxcAlert
109
+ size="small"
110
+ inlineText="Info type alert with inline text, children, close button and small size."
111
+ onClose={() => {}}
112
+ >
113
+ <div>
114
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
115
+ lobortis eget.
116
+ </div>
117
+ </DxcAlert>
118
+ </ExampleContainer>
119
+ <ExampleContainer>
120
+ <Title title="Medium" theme="light" level={4} />
121
+ <DxcAlert
122
+ size="medium"
123
+ inlineText="Info type alert with inline text, children, close button and medium size."
124
+ onClose={() => {}}
125
+ >
126
+ <div>
127
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
128
+ lobortis eget.
129
+ </div>
130
+ </DxcAlert>
131
+ </ExampleContainer>
132
+ <ExampleContainer>
133
+ <Title title="Large" theme="light" level={4} />
134
+ <DxcAlert
135
+ size="large"
136
+ inlineText="Info type alert with inline text, children, close button and large size."
137
+ onClose={() => {}}
138
+ >
139
+ <div>
140
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
141
+ lobortis eget.
142
+ </div>
143
+ </DxcAlert>
144
+ </ExampleContainer>
145
+ <ExampleContainer>
146
+ <Title title="FillParent" theme="light" level={4} />
147
+ <DxcAlert
148
+ size="fillParent"
149
+ inlineText="Info type alert with inline text, children, close button and fillParent size."
150
+ onClose={() => {}}
151
+ >
152
+ <div>
153
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
154
+ lobortis eget.
155
+ </div>
156
+ </DxcAlert>
157
+ </ExampleContainer>
158
+ </>
159
+ );
160
+
161
+ export const ModalAlert = () => (
162
+ <ExampleContainer>
163
+ <DxcAlert inlineText="Modal alert." mode="modal" onClose={() => {}}>
164
+ <div>
165
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
166
+ lobortis eget.
167
+ </div>
168
+ </DxcAlert>
169
+ </ExampleContainer>
170
+ );
package/alert/types.d.ts CHANGED
@@ -38,7 +38,7 @@ declare type Props = {
38
38
  */
39
39
  margin?: Space | Margin;
40
40
  /**
41
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent' | 'fitContent').
41
+ * Size of the component.
42
42
  */
43
43
  size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
44
44
  /**
package/box/Box.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import BoxPropsType from "./types";
3
+ declare const DxcBox: ({ shadowDepth, display, children, margin, padding, size, }: BoxPropsType) => JSX.Element;
4
+ export default DxcBox;
package/box/Box.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 _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 _utils = require("../common/utils.js");
@@ -36,12 +32,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
36
32
  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; }
37
33
 
38
34
  var DxcBox = function DxcBox(_ref) {
39
- var shadowDepth = _ref.shadowDepth,
40
- margin = _ref.margin,
41
- padding = _ref.padding,
35
+ var _ref$shadowDepth = _ref.shadowDepth,
36
+ shadowDepth = _ref$shadowDepth === void 0 ? 2 : _ref$shadowDepth,
42
37
  _ref$display = _ref.display,
43
38
  display = _ref$display === void 0 ? "inline-flex" : _ref$display,
44
39
  children = _ref.children,
40
+ margin = _ref.margin,
41
+ padding = _ref.padding,
45
42
  _ref$size = _ref.size,
46
43
  size = _ref$size === void 0 ? "fitContent" : _ref$size;
47
44
  var colorsTheme = (0, _useTheme["default"])();
@@ -125,28 +122,5 @@ var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templat
125
122
  return padding && padding.left ? _variables.spaces[padding.left] : "";
126
123
  });
127
124
 
128
- DxcBox.propTypes = {
129
- size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
130
- display: _propTypes["default"].string,
131
- shadowDepth: _propTypes["default"].oneOf([0, 1, 2]),
132
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
133
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
134
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
135
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
136
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
137
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
138
- padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
139
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
140
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
141
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
142
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
143
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
144
- };
145
- DxcBox.defaultProps = {
146
- shadowDepth: 2,
147
- display: "inline-flex",
148
- margin: null,
149
- padding: null
150
- };
151
125
  var _default = DxcBox;
152
126
  exports["default"] = _default;
File without changes
package/box/types.d.ts ADDED
@@ -0,0 +1,43 @@
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 Padding = {
10
+ top?: Space;
11
+ bottom?: Space;
12
+ left?: Space;
13
+ right?: Space;
14
+ };
15
+ declare type Props = {
16
+ /**
17
+ * The size of the shadow to be displayed around the box.
18
+ */
19
+ shadowDepth?: 0 | 1 | 2;
20
+ /**
21
+ * Changes the display CSS property of the box div.
22
+ */
23
+ display?: string;
24
+ /**
25
+ * Custom content that will be placed in the box component.
26
+ */
27
+ children: React.ReactNode;
28
+ /**
29
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
30
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
31
+ */
32
+ margin?: Space | Margin;
33
+ /**
34
+ * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
35
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
36
+ */
37
+ padding?: Space | Padding;
38
+ /**
39
+ * Size of the component.
40
+ */
41
+ size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
42
+ };
43
+ export default Props;
package/box/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import ButtonPropsType from "./types";
3
- declare const DxcButton: ({ label, mode, disabled, iconPosition, type, iconSrc, icon, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
3
+ declare const DxcButton: ({ label, mode, disabled, iconPosition, type, icon, iconSrc, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
4
4
  export default DxcButton;
package/button/Button.js CHANGED
@@ -44,16 +44,15 @@ var DxcButton = function DxcButton(_ref) {
44
44
  iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
45
45
  _ref$type = _ref.type,
46
46
  type = _ref$type === void 0 ? "button" : _ref$type,
47
+ icon = _ref.icon,
47
48
  _ref$iconSrc = _ref.iconSrc,
48
49
  iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
49
- icon = _ref.icon,
50
- _ref$onClick = _ref.onClick,
51
- _onClick = _ref$onClick === void 0 ? "" : _ref$onClick,
50
+ _onClick = _ref.onClick,
52
51
  margin = _ref.margin,
53
- size = _ref.size,
52
+ _ref$size = _ref.size,
53
+ size = _ref$size === void 0 ? "fitContent" : _ref$size,
54
54
  _ref$tabIndex = _ref.tabIndex,
55
55
  tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
56
-
57
56
  var colorsTheme = (0, _useTheme["default"])();
58
57
  var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
59
58
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
@@ -68,15 +67,13 @@ var DxcButton = function DxcButton(_ref) {
68
67
  backgroundType: backgroundType,
69
68
  icon: icon
70
69
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
71
- disabled: disabled,
72
70
  type: type,
71
+ disabled: disabled,
73
72
  disableRipple: true,
74
- "aria-disabled": disabled ? true : false,
73
+ "aria-disabled": disabled,
75
74
  tabIndex: disabled ? -1 : tabIndex,
76
75
  onClick: function onClick() {
77
- if (_onClick) {
78
- _onClick();
79
- }
76
+ _onClick();
80
77
  }
81
78
  }, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
82
79
  icon: icon,