@dxc-technology/halstack-react 0.0.0-9005464 → 0.0.0-9179a3a

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 (143) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -3
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.js +2 -2
  8. package/accordion/Accordion.stories.tsx +300 -0
  9. package/accordion/types.d.ts +1 -1
  10. package/accordion-group/AccordionGroup.js +2 -2
  11. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  12. package/accordion-group/types.d.ts +1 -1
  13. package/alert/Alert.js +2 -2
  14. package/alert/types.d.ts +1 -1
  15. package/badge/Badge.js +1 -1
  16. package/box/Box.d.ts +1 -1
  17. package/box/Box.js +4 -7
  18. package/box/types.d.ts +0 -4
  19. package/button/Button.d.ts +1 -1
  20. package/button/Button.js +6 -4
  21. package/button/types.d.ts +2 -2
  22. package/card/Card.js +5 -6
  23. package/card/Card.stories.tsx +201 -0
  24. package/card/ice-cream.jpg +0 -0
  25. package/card/types.d.ts +4 -6
  26. package/checkbox/Checkbox.js +2 -2
  27. package/checkbox/types.d.ts +1 -1
  28. package/chip/Chip.d.ts +4 -0
  29. package/chip/Chip.js +5 -27
  30. package/chip/Chip.stories.tsx +121 -0
  31. package/chip/types.d.ts +53 -0
  32. package/chip/types.js +5 -0
  33. package/common/variables.js +19 -22
  34. package/date/Date.js +1 -1
  35. package/date-input/DateInput.js +4 -7
  36. package/dialog/Dialog.js +2 -2
  37. package/dialog/Dialog.stories.tsx +212 -0
  38. package/dropdown/Dropdown.js +1 -1
  39. package/dropdown/types.d.ts +1 -1
  40. package/file-input/FileInput.d.ts +4 -0
  41. package/file-input/FileInput.js +65 -76
  42. package/file-input/FileItem.d.ts +14 -0
  43. package/file-input/FileItem.js +12 -21
  44. package/file-input/types.d.ts +112 -0
  45. package/file-input/types.js +5 -0
  46. package/footer/Footer.d.ts +1 -1
  47. package/footer/Footer.js +12 -18
  48. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  49. package/footer/Icons.d.ts +2 -0
  50. package/footer/Icons.js +3 -3
  51. package/footer/types.d.ts +22 -18
  52. package/header/Header.js +2 -2
  53. package/header/Header.stories.tsx +162 -0
  54. package/header/Icons.d.ts +2 -0
  55. package/header/types.d.ts +4 -2
  56. package/heading/Heading.d.ts +4 -0
  57. package/heading/Heading.js +7 -24
  58. package/heading/Heading.stories.tsx +53 -0
  59. package/heading/types.d.ts +33 -0
  60. package/heading/types.js +5 -0
  61. package/input-text/InputText.js +2 -2
  62. package/layout/ApplicationLayout.d.ts +10 -0
  63. package/layout/ApplicationLayout.js +8 -18
  64. package/layout/ApplicationLayout.stories.tsx +171 -0
  65. package/layout/types.d.ts +57 -0
  66. package/layout/types.js +5 -0
  67. package/link/Link.js +3 -3
  68. package/link/Link.stories.tsx +76 -0
  69. package/list/List.d.ts +7 -0
  70. package/list/List.js +37 -0
  71. package/list/List.stories.tsx +70 -0
  72. package/main.d.ts +7 -3
  73. package/main.js +34 -2
  74. package/number-input/NumberInput.js +3 -6
  75. package/number-input/NumberInputContext.d.ts +4 -0
  76. package/number-input/NumberInputContext.js +5 -2
  77. package/number-input/numberInputContextTypes.d.ts +19 -0
  78. package/number-input/numberInputContextTypes.js +5 -0
  79. package/package.json +1 -1
  80. package/paginator/Paginator.js +2 -8
  81. package/password-input/PasswordInput.js +19 -18
  82. package/password-input/types.d.ts +17 -10
  83. package/progress-bar/ProgressBar.js +2 -2
  84. package/radio/Radio.js +2 -2
  85. package/radio/types.d.ts +2 -2
  86. package/resultsetTable/ResultsetTable.d.ts +4 -0
  87. package/resultsetTable/ResultsetTable.js +4 -27
  88. package/resultsetTable/ResultsetTable.stories.tsx +276 -0
  89. package/resultsetTable/types.d.ts +67 -0
  90. package/resultsetTable/types.js +5 -0
  91. package/row/Row.d.ts +11 -0
  92. package/row/Row.js +124 -0
  93. package/row/Row.stories.tsx +223 -0
  94. package/select/Select.js +15 -17
  95. package/sidenav/Sidenav.js +2 -2
  96. package/sidenav/Sidenav.stories.tsx +165 -0
  97. package/slider/Slider.js +8 -8
  98. package/slider/Slider.stories.tsx +6 -1
  99. package/spinner/Spinner.js +2 -2
  100. package/stack/Stack.d.ts +10 -0
  101. package/stack/Stack.js +94 -0
  102. package/stack/Stack.stories.tsx +150 -0
  103. package/switch/Switch.js +2 -2
  104. package/table/Table.js +3 -3
  105. package/tabs/Tabs.js +4 -2
  106. package/tabs/Tabs.stories.tsx +121 -0
  107. package/tabs/types.d.ts +3 -4
  108. package/tag/Tag.js +1 -1
  109. package/text/Text.d.ts +7 -0
  110. package/text/Text.js +30 -0
  111. package/text/Text.stories.tsx +19 -0
  112. package/text-input/TextInput.d.ts +4 -0
  113. package/text-input/TextInput.js +42 -81
  114. package/text-input/TextInput.stories.tsx +456 -0
  115. package/text-input/types.d.ts +159 -0
  116. package/text-input/types.js +5 -0
  117. package/textarea/Textarea.d.ts +4 -0
  118. package/textarea/Textarea.js +27 -60
  119. package/textarea/types.d.ts +130 -0
  120. package/textarea/types.js +5 -0
  121. package/toggle/Toggle.js +1 -1
  122. package/toggle-group/ToggleGroup.d.ts +4 -0
  123. package/toggle-group/ToggleGroup.js +8 -34
  124. package/toggle-group/types.d.ts +84 -0
  125. package/toggle-group/types.js +5 -0
  126. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  127. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  128. package/upload/file-upload/FileToUpload.js +1 -1
  129. package/upload/files-upload/FilesToUpload.js +1 -1
  130. package/upload/transaction/Transaction.js +2 -2
  131. package/upload/transactions/Transactions.js +1 -1
  132. package/useTheme.d.ts +2 -0
  133. package/useTheme.js +1 -1
  134. package/wizard/Wizard.js +2 -2
  135. package/wizard/Wizard.stories.jsx +224 -0
  136. package/wizard/types.d.ts +1 -1
  137. package/chip/index.d.ts +0 -22
  138. package/file-input/index.d.ts +0 -81
  139. package/heading/index.d.ts +0 -17
  140. package/resultsetTable/index.d.ts +0 -19
  141. package/text-input/index.d.ts +0 -135
  142. package/textarea/index.d.ts +0 -117
  143. package/toggle-group/index.d.ts +0 -21
package/stack/Stack.js ADDED
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = Stack;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _templateObject, _templateObject2;
17
+
18
+ function Stack(_ref) {
19
+ var gutter = _ref.gutter,
20
+ divider = _ref.divider,
21
+ align = _ref.align,
22
+ _ref$as = _ref.as,
23
+ as = _ref$as === void 0 ? "div" : _ref$as,
24
+ children = _ref.children;
25
+ return /*#__PURE__*/_react["default"].createElement(StyledStack, {
26
+ gutter: gutter,
27
+ divider: divider,
28
+ align: align,
29
+ as: as
30
+ }, _react["default"].Children.map(children, function (child, index) {
31
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, divider && index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
32
+ }));
33
+ }
34
+
35
+ var Divider = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n height: 1px;\n background-color: #999999;\n"])));
36
+
37
+ var StyledStack = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: ", "};\n gap: ", ";\n margin: 0;\n padding: 0;\n"])), function (_ref2) {
38
+ var align = _ref2.align;
39
+
40
+ switch (align) {
41
+ case "start":
42
+ return "flex-start";
43
+
44
+ case "center":
45
+ return "center";
46
+
47
+ case "end":
48
+ return "flex-end";
49
+
50
+ case "baseline":
51
+ return "baseline";
52
+
53
+ case "stretch":
54
+ return "stretch";
55
+
56
+ default:
57
+ return "initial";
58
+ }
59
+ }, function (_ref3) {
60
+ var gutter = _ref3.gutter,
61
+ divider = _ref3.divider;
62
+
63
+ switch (gutter) {
64
+ case "none":
65
+ return "0";
66
+
67
+ case "xxsmall":
68
+ return "calc(0.125rem / ".concat(divider ? 2 : 1, ")");
69
+
70
+ case "xsmall":
71
+ return "calc(0.25rem / ".concat(divider ? 2 : 1, ")");
72
+
73
+ case "small":
74
+ return "calc(0.5rem / ".concat(divider ? 2 : 1, ")");
75
+
76
+ case "medium":
77
+ return "calc(1rem / ".concat(divider ? 2 : 1, ")");
78
+
79
+ case "large":
80
+ return "calc(1.5rem / ".concat(divider ? 2 : 1, ")");
81
+
82
+ case "xlarge":
83
+ return "calc(2rem / ".concat(divider ? 2 : 1, ")");
84
+
85
+ case "xxlarge":
86
+ return "calc(3rem / ".concat(divider ? 2 : 1, ")");
87
+
88
+ case "xxxlarge":
89
+ return "calc(4rem / ".concat(divider ? 2 : 1, ")");
90
+
91
+ default:
92
+ return "0";
93
+ }
94
+ });
@@ -0,0 +1,150 @@
1
+ import React from "react";
2
+ import Title from "../../.storybook/components/Title";
3
+ import styled from "styled-components";
4
+ import DxcStack from "./Stack";
5
+
6
+ export default {
7
+ title: "Stack",
8
+ component: DxcStack,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <Title title="Default" theme="light" level={4} />
14
+ <Container>
15
+ <DxcStack>
16
+ <Placeholder></Placeholder>
17
+ <Placeholder></Placeholder>
18
+ <Placeholder></Placeholder>
19
+ </DxcStack>
20
+ </Container>
21
+ <Title title="Align = baseline" theme="light" level={4} />
22
+ <Container>
23
+ <DxcStack align="baseline">
24
+ <Placeholder paddingLeft={20}></Placeholder>
25
+ <Placeholder></Placeholder>
26
+ <Placeholder paddingRight={60}></Placeholder>
27
+ </DxcStack>
28
+ </Container>
29
+ <Title title="Align = center" theme="light" level={4} />
30
+ <Container>
31
+ <DxcStack align="center">
32
+ <Placeholder paddingLeft={20}></Placeholder>
33
+ <Placeholder></Placeholder>
34
+ <Placeholder paddingLeft={60}></Placeholder>
35
+ </DxcStack>
36
+ </Container>
37
+ <Title title="Align = end" theme="light" level={4} />
38
+ <Container>
39
+ <DxcStack align="end">
40
+ <Placeholder paddingLeft={20}></Placeholder>
41
+ <Placeholder></Placeholder>
42
+ <Placeholder paddingLeft={60}></Placeholder>
43
+ </DxcStack>
44
+ </Container>
45
+ <Title title="Align = start" theme="light" level={4} />
46
+ <Container>
47
+ <DxcStack align="start">
48
+ <Placeholder paddingLeft={20}></Placeholder>
49
+ <Placeholder></Placeholder>
50
+ <Placeholder paddingLeft={60}></Placeholder>
51
+ </DxcStack>
52
+ </Container>
53
+ <Title title="Align = stretch" theme="light" level={4} />
54
+ <Container>
55
+ <DxcStack align="stretch">
56
+ <Placeholder paddingLeft={20}></Placeholder>
57
+ <Placeholder></Placeholder>
58
+ <Placeholder paddingLeft={60}></Placeholder>
59
+ </DxcStack>
60
+ </Container>
61
+ <Title title="gutter = xxsmall" theme="light" level={4} />
62
+ <Container>
63
+ <DxcStack gutter="xxsmall">
64
+ <Placeholder></Placeholder>
65
+ <Placeholder></Placeholder>
66
+ <Placeholder></Placeholder>
67
+ </DxcStack>
68
+ </Container>
69
+ <Title title="gutter = xsmall" theme="light" level={4} />
70
+ <Container>
71
+ <DxcStack gutter="xsmall">
72
+ <Placeholder></Placeholder>
73
+ <Placeholder></Placeholder>
74
+ <Placeholder></Placeholder>
75
+ </DxcStack>
76
+ </Container>
77
+ <Title title="gutter = small" theme="light" level={4} />
78
+ <Container>
79
+ <DxcStack gutter="small">
80
+ <Placeholder></Placeholder>
81
+ <Placeholder></Placeholder>
82
+ <Placeholder></Placeholder>
83
+ </DxcStack>
84
+ </Container>
85
+ <Title title="gutter = medium" theme="light" level={4} />
86
+ <Container>
87
+ <DxcStack gutter="medium">
88
+ <Placeholder></Placeholder>
89
+ <Placeholder></Placeholder>
90
+ <Placeholder></Placeholder>
91
+ </DxcStack>
92
+ </Container>
93
+ <Title title="gutter = large" theme="light" level={4} />
94
+ <Container>
95
+ <DxcStack gutter="large">
96
+ <Placeholder></Placeholder>
97
+ <Placeholder></Placeholder>
98
+ <Placeholder></Placeholder>
99
+ </DxcStack>
100
+ </Container>
101
+ <Title title="gutter = xlarge" theme="light" level={4} />
102
+ <Container>
103
+ <DxcStack gutter="xlarge">
104
+ <Placeholder></Placeholder>
105
+ <Placeholder></Placeholder>
106
+ <Placeholder></Placeholder>
107
+ </DxcStack>
108
+ </Container>
109
+ <Title title="gutter = xxlarge" theme="light" level={4} />
110
+ <Container>
111
+ <DxcStack gutter="xxlarge">
112
+ <Placeholder></Placeholder>
113
+ <Placeholder></Placeholder>
114
+ <Placeholder></Placeholder>
115
+ </DxcStack>
116
+ </Container>
117
+ <Title title="gutter = xxlarge && divider" theme="light" level={4} />
118
+ <Container>
119
+ <DxcStack gutter="xxlarge" divider>
120
+ <Placeholder></Placeholder>
121
+ <Placeholder></Placeholder>
122
+ <Placeholder></Placeholder>
123
+ </DxcStack>
124
+ </Container>
125
+ <Title title="gutter = none" theme="light" level={4} />
126
+ <Container>
127
+ <DxcStack gutter="none">
128
+ <Placeholder></Placeholder>
129
+ <Placeholder></Placeholder>
130
+ <Placeholder></Placeholder>
131
+ </DxcStack>
132
+ </Container>
133
+ </>
134
+ );
135
+
136
+ const Container = styled.div`
137
+ background: #d0d0d0;
138
+ padding: 10px;
139
+ border-radius: 10px;
140
+ `;
141
+
142
+ const Placeholder = styled.div`
143
+ min-height: 80px;
144
+ min-width: 120px;
145
+ border: 1px solid #fabada;
146
+ background-color: #fff7fb;
147
+ border-radius: 5px;
148
+ padding-left: ${({ paddingLeft }) => `${paddingLeft ?? 0}px`};
149
+ padding-right: ${({ paddingRight }) => `${paddingRight ?? 0}px`};
150
+ `;
package/switch/Switch.js CHANGED
@@ -27,9 +27,9 @@ var _variables = require("../common/variables.js");
27
27
 
28
28
  var _utils = require("../common/utils.js");
29
29
 
30
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
30
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
31
31
 
32
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
32
+ var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
33
33
 
34
34
  var _templateObject, _templateObject2;
35
35
 
package/table/Table.js CHANGED
@@ -21,9 +21,9 @@ var _variables = require("../common/variables.js");
21
21
 
22
22
  var _utils = require("../common/utils.js");
23
23
 
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
25
25
 
26
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
26
+ var _BackgroundColorContext = require("../BackgroundColorContext");
27
27
 
28
28
  var _templateObject, _templateObject2;
29
29
 
@@ -48,7 +48,7 @@ var calculateWidth = function calculateWidth(margin) {
48
48
  return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
49
49
  };
50
50
 
51
- var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: hidden auto;\n &::-webkit-scrollbar {\n width: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"])), function (props) {
51
+ var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: auto;\n &::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"])), function (props) {
52
52
  return calculateWidth(props.margin);
53
53
  }, function (props) {
54
54
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
package/tabs/Tabs.js CHANGED
@@ -27,7 +27,7 @@ var _variables = require("../common/variables.js");
27
27
 
28
28
  var _Badge = _interopRequireDefault(require("../badge/Badge"));
29
29
 
30
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
30
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
31
31
 
32
32
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
33
33
 
@@ -135,7 +135,7 @@ var Underline = _styledComponents["default"].div(_templateObject6 || (_templateO
135
135
  return props.theme.dividerColor;
136
136
  });
137
137
 
138
- var DxCTabs = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n .MuiTabs-root {\n background: white;\n min-height: ", ";\n\n .MuiTabs-scroller {\n .MuiTabs-flexContainer + span {\n z-index: 4;\n }\n }\n .MuiTab-root {\n text-transform: ", " !important;\n }\n .MuiButtonBase-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n\n padding: ", ";\n height: ", ";\n min-width: 90px;\n max-width: 360px;\n min-height: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n font-weight: ", ";\n }\n &:not(.Mui-selected) {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-selected {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-disabled {\n cursor: not-allowed !important;\n pointer-events: all;\n color: ", ";\n font-style: ", ";\n svg {\n color: ", ";\n }\n }\n &:focus {\n outline: ", " auto 1px;\n }\n }\n .MuiTabs-indicator {\n background-color: ", ";\n height: ", ";\n }\n .MuiTabs-scrollButtons {\n min-width: ", ";\n width: ", ";\n padding: 0;\n }\n @media (max-width: 599.95px) {\n .MuiTabs-scrollButtonsDesktop {\n display: flex;\n }\n }\n }\n"])), function (props) {
138
+ var DxCTabs = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n .MuiTabs-root {\n background: white;\n min-height: ", ";\n\n .MuiTabs-scroller {\n .MuiTabs-flexContainer + span {\n z-index: 4;\n }\n }\n .MuiTab-root {\n text-transform: ", " !important;\n }\n .MuiButtonBase-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n\n padding: ", ";\n height: ", ";\n min-width: 90px;\n max-width: 360px;\n min-height: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n font-weight: ", ";\n }\n &:not(.Mui-selected) {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-selected {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-disabled {\n background-color: ", " !important;\n cursor: not-allowed !important;\n pointer-events: all;\n color: ", ";\n font-style: ", ";\n svg {\n color: ", ";\n }\n outline: none !important;\n }\n &:focus {\n outline: ", " auto 1px;\n }\n }\n .MuiTabs-indicator {\n background-color: ", ";\n height: ", ";\n }\n .MuiTabs-scrollButtons {\n min-width: ", ";\n width: ", ";\n padding: 0;\n }\n @media (max-width: 599.95px) {\n .MuiTabs-scrollButtonsDesktop {\n display: flex;\n }\n }\n }\n"])), function (props) {
139
139
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
140
140
  }, function (props) {
141
141
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -181,6 +181,8 @@ var DxCTabs = _styledComponents["default"].div(_templateObject7 || (_templateObj
181
181
  return props.theme.selectedFontColor;
182
182
  }, function (props) {
183
183
  return props.theme.selectedIconColor;
184
+ }, function (props) {
185
+ return props.theme.unselectedBackgroundColor;
184
186
  }, function (props) {
185
187
  return props.theme.disabledFontColor;
186
188
  }, function (props) {
@@ -0,0 +1,121 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import DxcTabs from "./Tabs";
4
+ import Title from "../../.storybook/components/Title";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+
7
+ export default {
8
+ title: "Tabs",
9
+ component: DxcTabs,
10
+ };
11
+
12
+ const iconSVG = () => {
13
+ return (
14
+ <svg viewBox="0 0 24 24" fill="currentColor">
15
+ <path d="M0 0h24v24H0z" fill="none" />
16
+ <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
17
+ </svg>
18
+ );
19
+ };
20
+
21
+ const tabs: any = [
22
+ {
23
+ label: "Tab 1",
24
+ },
25
+ {
26
+ label: "Tab 2",
27
+ },
28
+ {
29
+ label: "Tab 3",
30
+ isDisabled: true,
31
+ },
32
+ {
33
+ label: "Tab 4",
34
+ },
35
+ ];
36
+
37
+ const tabsNotification = tabs.map((tab, index) => ({
38
+ ...tab,
39
+ notificationNumber: (index === 0 && true) || (index === 1 && 5) || (index === 2 && 200),
40
+ }));
41
+
42
+ const tabsIcon = tabs.map((tab) => ({ ...tab, icon: iconSVG }));
43
+
44
+ const tabsNotificationIcon = tabsNotification.map((tab) => ({ ...tab, icon: iconSVG }));
45
+
46
+ export const Chromatic = () => (
47
+ <>
48
+ <ExampleContainer>
49
+ <Title title="Only label" theme="light" level={4} />
50
+ <DxcTabs tabs={tabs} />
51
+ </ExampleContainer>
52
+ <ExampleContainer pseudoState="pseudo-hover">
53
+ <Title title="Hovered tabs" theme="light" level={4} />
54
+ <DxcTabs tabs={tabs} />
55
+ </ExampleContainer>
56
+ <ExampleContainer pseudoState="pseudo-focus">
57
+ <Title title="Focused tabs" theme="light" level={4} />
58
+ <DxcTabs tabs={tabs} />
59
+ </ExampleContainer>
60
+ <ExampleContainer pseudoState="pseudo-active">
61
+ <Title title="Actived tabs" theme="light" level={4} />
62
+ <DxcTabs tabs={tabs} />
63
+ </ExampleContainer>
64
+ <ExampleContainer>
65
+ <Title title="With notification number" theme="light" level={4} />
66
+ <DxcTabs tabs={tabsNotification} />
67
+ </ExampleContainer>
68
+ <ExampleContainer>
69
+ <Title title="With icon position top" theme="light" level={4} />
70
+ <DxcTabs tabs={tabsIcon} />
71
+ </ExampleContainer>
72
+ <ExampleContainer>
73
+ <Title title="With icon position left" theme="light" level={4} />
74
+ <DxcTabs tabs={tabsIcon} iconPosition="left" />
75
+ </ExampleContainer>
76
+ <ExampleContainer>
77
+ <Title title="With icon and notification number" theme="light" level={4} />
78
+ <DxcTabs tabs={tabsNotificationIcon} />
79
+ </ExampleContainer>
80
+ <ExampleContainer>
81
+ <Title title="With icon on the left and notification number" theme="light" level={4} />
82
+ <DxcTabs tabs={tabsNotificationIcon} iconPosition="left" />
83
+ </ExampleContainer>
84
+ <ExampleContainer>
85
+ <Title title="Scrollable" theme="light" level={4} />
86
+ <div style={{ width: "400px" }}>
87
+ <DxcTabs tabs={tabsNotificationIcon} iconPosition="left" activeTabIndex={1} />
88
+ </div>
89
+ </ExampleContainer>
90
+
91
+ <Title title="Margins" theme="light" level={2} />
92
+ <ExampleContainer>
93
+ <Title title="Xxsmall margin" theme="light" level={4} />
94
+ <DxcTabs tabs={tabs} margin="xxsmall" />
95
+ </ExampleContainer>
96
+ <ExampleContainer>
97
+ <Title title="Xsmall margin" theme="light" level={4} />
98
+ <DxcTabs tabs={tabs} margin="xsmall" />
99
+ </ExampleContainer>
100
+ <ExampleContainer>
101
+ <Title title="Small margin" theme="light" level={4} />
102
+ <DxcTabs tabs={tabs} margin="small" />
103
+ </ExampleContainer>
104
+ <ExampleContainer>
105
+ <Title title="Medium margin" theme="light" level={4} />
106
+ <DxcTabs tabs={tabs} margin="medium" />
107
+ </ExampleContainer>
108
+ <ExampleContainer>
109
+ <Title title="Large margin" theme="light" level={4} />
110
+ <DxcTabs tabs={tabs} margin="large" />
111
+ </ExampleContainer>
112
+ <ExampleContainer>
113
+ <Title title="Xlarge margin" theme="light" level={4} />
114
+ <DxcTabs tabs={tabs} margin="xlarge" />
115
+ </ExampleContainer>
116
+ <ExampleContainer>
117
+ <Title title="Xxlarge margin" theme="light" level={4} />
118
+ <DxcTabs tabs={tabs} margin="xxlarge" />
119
+ </ExampleContainer>
120
+ </>
121
+ );
package/tabs/types.d.ts CHANGED
@@ -37,7 +37,7 @@ declare type Props = {
37
37
  /**
38
38
  * An array of objects representing the tabs.
39
39
  */
40
- tabs: [Tab, ...Tab[]];
40
+ tabs: Tab[];
41
41
  /**
42
42
  * Whether the icon should appear above or to the left of the label.
43
43
  */
@@ -58,9 +58,8 @@ declare type Props = {
58
58
  */
59
59
  onTabHover?: (tabIndex: number) => void;
60
60
  /**
61
- * Size of the margin to be applied to the component. You can pass an object
62
- * with 'top', 'bottom', 'left' and 'right' properties in order to specify
63
- * different margin sizes.
61
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
62
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
64
63
  */
65
64
  margin?: Space | Margin;
66
65
  /**
package/tag/Tag.js CHANGED
@@ -21,7 +21,7 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
21
 
22
22
  var _variables = require("../common/variables.js");
23
23
 
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
25
25
 
26
26
  var _utils = require("../common/utils.js");
27
27
 
package/text/Text.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ declare type TextProps = {
3
+ as?: "p" | "span";
4
+ children: React.ReactNode;
5
+ };
6
+ declare function Text({ as, children }: TextProps): JSX.Element;
7
+ export default Text;
package/text/Text.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _templateObject;
17
+
18
+ function Text(_ref) {
19
+ var _ref$as = _ref.as,
20
+ as = _ref$as === void 0 ? "span" : _ref$as,
21
+ children = _ref.children;
22
+ return /*#__PURE__*/_react["default"].createElement(StyledText, {
23
+ as: as
24
+ }, children);
25
+ }
26
+
27
+ var StyledText = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n font-family: Open Sans, sans-serif;\n"])));
28
+
29
+ var _default = Text;
30
+ exports["default"] = _default;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import Title from "../../.storybook/components/Title";
3
+ import DxcText from "./Text";
4
+
5
+ export default {
6
+ title: "Text",
7
+ component: DxcText,
8
+ };
9
+
10
+ export const Chromatic = () => (
11
+ <>
12
+ <Title title="Two texts as span" theme="light" level={4} />
13
+ <DxcText>Text 1.</DxcText>
14
+ <DxcText>Text 2.</DxcText>
15
+ <Title title="Two texts as p" theme="light" level={4} />
16
+ <DxcText as="p">Text 1.</DxcText>
17
+ <DxcText as="p">Text 2.</DxcText>
18
+ </>
19
+ );
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import TextInputPropsType from "./types";
3
+ declare const DxcTextInput: React.ForwardRefExoticComponent<TextInputPropsType & React.RefAttributes<HTMLDivElement>>;
4
+ export default DxcTextInput;