@dxc-technology/halstack-react 0.0.0-c593452 → 0.0.0-c680086

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 (237) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  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.d.ts +1 -1
  8. package/accordion/Accordion.js +11 -22
  9. package/accordion/Accordion.stories.tsx +307 -0
  10. package/accordion/types.d.ts +4 -8
  11. package/accordion-group/AccordionGroup.js +2 -2
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/types.d.ts +4 -8
  14. package/alert/Alert.js +2 -2
  15. package/alert/Alert.stories.tsx +170 -0
  16. package/alert/types.d.ts +1 -1
  17. package/badge/Badge.js +1 -1
  18. package/bleed/Bleed.d.ts +3 -0
  19. package/bleed/Bleed.js +84 -0
  20. package/bleed/Bleed.stories.tsx +342 -0
  21. package/bleed/types.d.ts +13 -0
  22. package/bleed/types.js +5 -0
  23. package/box/Box.d.ts +4 -0
  24. package/box/Box.js +6 -32
  25. package/box/Box.stories.tsx +132 -0
  26. package/box/types.d.ts +43 -0
  27. package/box/types.js +5 -0
  28. package/button/Button.d.ts +1 -1
  29. package/button/Button.js +15 -26
  30. package/button/Button.stories.tsx +223 -242
  31. package/button/types.d.ts +9 -13
  32. package/card/Card.js +5 -6
  33. package/card/Card.stories.tsx +201 -0
  34. package/card/ice-cream.jpg +0 -0
  35. package/card/types.d.ts +4 -6
  36. package/checkbox/Checkbox.js +2 -2
  37. package/checkbox/Checkbox.stories.tsx +192 -0
  38. package/checkbox/types.d.ts +2 -2
  39. package/chip/Chip.d.ts +4 -0
  40. package/chip/Chip.js +16 -76
  41. package/chip/Chip.stories.tsx +119 -0
  42. package/chip/types.d.ts +45 -0
  43. package/chip/types.js +5 -0
  44. package/common/variables.js +86 -44
  45. package/date/Date.js +1 -1
  46. package/date-input/DateInput.js +10 -13
  47. package/date-input/DateInput.stories.tsx +138 -0
  48. package/dialog/Dialog.d.ts +4 -0
  49. package/dialog/Dialog.js +8 -26
  50. package/dialog/Dialog.stories.tsx +212 -0
  51. package/dialog/types.d.ts +43 -0
  52. package/dialog/types.js +5 -0
  53. package/dropdown/Dropdown.d.ts +1 -1
  54. package/dropdown/Dropdown.js +13 -35
  55. package/dropdown/Dropdown.stories.tsx +249 -0
  56. package/dropdown/types.d.ts +6 -15
  57. package/file-input/FileInput.d.ts +4 -0
  58. package/file-input/FileInput.js +167 -109
  59. package/file-input/FileInput.stories.tsx +507 -0
  60. package/file-input/FileItem.d.ts +14 -0
  61. package/file-input/FileItem.js +12 -21
  62. package/file-input/types.d.ts +112 -0
  63. package/file-input/types.js +5 -0
  64. package/footer/Footer.d.ts +4 -0
  65. package/footer/Footer.js +31 -70
  66. package/footer/Footer.stories.tsx +130 -0
  67. package/footer/Icons.d.ts +2 -0
  68. package/footer/Icons.js +3 -3
  69. package/footer/types.d.ts +65 -0
  70. package/footer/types.js +5 -0
  71. package/header/Header.d.ts +7 -0
  72. package/header/Header.js +28 -30
  73. package/header/Header.stories.tsx +162 -0
  74. package/header/Icons.d.ts +2 -0
  75. package/header/Icons.js +2 -27
  76. package/header/types.d.ts +47 -0
  77. package/header/types.js +5 -0
  78. package/heading/Heading.d.ts +4 -0
  79. package/heading/Heading.js +7 -24
  80. package/heading/Heading.stories.tsx +54 -0
  81. package/heading/types.d.ts +33 -0
  82. package/heading/types.js +5 -0
  83. package/input-text/InputText.js +2 -2
  84. package/inset/Inset.d.ts +3 -0
  85. package/inset/Inset.js +84 -0
  86. package/inset/Inset.stories.tsx +229 -0
  87. package/inset/types.d.ts +13 -0
  88. package/inset/types.js +5 -0
  89. package/layout/ApplicationLayout.d.ts +10 -0
  90. package/layout/ApplicationLayout.js +9 -19
  91. package/layout/ApplicationLayout.stories.tsx +171 -0
  92. package/layout/types.d.ts +57 -0
  93. package/layout/types.js +5 -0
  94. package/link/Link.d.ts +3 -0
  95. package/link/Link.js +10 -40
  96. package/link/Link.stories.tsx +151 -0
  97. package/link/types.d.ts +70 -0
  98. package/link/types.js +5 -0
  99. package/list/List.d.ts +4 -0
  100. package/list/List.js +47 -0
  101. package/list/List.stories.tsx +95 -0
  102. package/list/types.d.ts +7 -0
  103. package/list/types.js +5 -0
  104. package/main.d.ts +8 -3
  105. package/main.js +42 -2
  106. package/number-input/NumberInput.d.ts +4 -0
  107. package/number-input/NumberInput.js +5 -50
  108. package/number-input/NumberInput.stories.tsx +115 -0
  109. package/number-input/NumberInputContext.d.ts +4 -0
  110. package/number-input/NumberInputContext.js +5 -2
  111. package/number-input/numberInputContextTypes.d.ts +19 -0
  112. package/number-input/numberInputContextTypes.js +5 -0
  113. package/number-input/types.d.ts +117 -0
  114. package/number-input/types.js +5 -0
  115. package/package.json +4 -2
  116. package/paginator/Paginator.js +2 -8
  117. package/paginator/Paginator.stories.tsx +63 -0
  118. package/password-input/PasswordInput.d.ts +4 -0
  119. package/password-input/PasswordInput.js +19 -55
  120. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +4 -4
  121. package/password-input/types.d.ts +107 -0
  122. package/password-input/types.js +5 -0
  123. package/progress-bar/ProgressBar.js +5 -5
  124. package/progress-bar/ProgressBar.stories.jsx +58 -0
  125. package/radio/Radio.js +2 -2
  126. package/radio/Radio.stories.tsx +192 -0
  127. package/radio/types.d.ts +2 -2
  128. package/radio-group/Radio.d.ts +4 -0
  129. package/radio-group/Radio.js +140 -0
  130. package/radio-group/RadioGroup.d.ts +4 -0
  131. package/radio-group/RadioGroup.js +273 -0
  132. package/radio-group/RadioGroup.stories.tsx +79 -0
  133. package/radio-group/RadioGroup.test.js +248 -0
  134. package/radio-group/types.d.ts +36 -0
  135. package/radio-group/types.js +5 -0
  136. package/resultsetTable/ResultsetTable.d.ts +4 -0
  137. package/resultsetTable/ResultsetTable.js +9 -29
  138. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  139. package/resultsetTable/types.d.ts +67 -0
  140. package/resultsetTable/types.js +5 -0
  141. package/row/Row.d.ts +3 -0
  142. package/row/Row.js +127 -0
  143. package/row/Row.stories.tsx +237 -0
  144. package/row/types.d.ts +10 -0
  145. package/row/types.js +5 -0
  146. package/select/Select.d.ts +4 -0
  147. package/select/Select.js +20 -22
  148. package/select/Select.stories.tsx +572 -0
  149. package/select/types.d.ts +170 -0
  150. package/select/types.js +5 -0
  151. package/sidenav/Sidenav.d.ts +9 -0
  152. package/sidenav/Sidenav.js +6 -15
  153. package/sidenav/Sidenav.stories.tsx +182 -0
  154. package/sidenav/types.d.ts +50 -0
  155. package/sidenav/types.js +5 -0
  156. package/slider/Slider.d.ts +1 -1
  157. package/slider/Slider.js +43 -32
  158. package/slider/Slider.stories.tsx +177 -0
  159. package/slider/types.d.ts +2 -7
  160. package/spinner/Spinner.d.ts +4 -0
  161. package/spinner/Spinner.js +8 -25
  162. package/spinner/Spinner.stories.jsx +103 -0
  163. package/spinner/types.d.ts +32 -0
  164. package/spinner/types.js +5 -0
  165. package/stack/Stack.d.ts +3 -0
  166. package/stack/Stack.js +97 -0
  167. package/stack/Stack.stories.tsx +164 -0
  168. package/stack/types.d.ts +9 -0
  169. package/stack/types.js +5 -0
  170. package/switch/Switch.js +4 -4
  171. package/switch/Switch.stories.tsx +160 -0
  172. package/table/Table.d.ts +4 -0
  173. package/table/Table.js +3 -3
  174. package/table/Table.stories.jsx +277 -0
  175. package/table/types.d.ts +21 -0
  176. package/table/types.js +5 -0
  177. package/tabs/Tabs.js +11 -9
  178. package/tabs/Tabs.stories.tsx +120 -0
  179. package/tabs/types.d.ts +25 -18
  180. package/tag/Tag.d.ts +4 -0
  181. package/tag/Tag.js +26 -46
  182. package/tag/Tag.stories.tsx +138 -0
  183. package/tag/types.d.ts +69 -0
  184. package/tag/types.js +5 -0
  185. package/text/Text.d.ts +7 -0
  186. package/text/Text.js +30 -0
  187. package/text/Text.stories.tsx +19 -0
  188. package/text-input/TextInput.d.ts +4 -0
  189. package/text-input/TextInput.js +54 -85
  190. package/text-input/TextInput.stories.tsx +456 -0
  191. package/text-input/types.d.ts +159 -0
  192. package/text-input/types.js +5 -0
  193. package/textarea/Textarea.d.ts +4 -0
  194. package/textarea/Textarea.js +27 -60
  195. package/textarea/Textarea.stories.jsx +4 -3
  196. package/textarea/types.d.ts +130 -0
  197. package/textarea/types.js +5 -0
  198. package/toggle/Toggle.js +1 -1
  199. package/toggle-group/ToggleGroup.d.ts +4 -0
  200. package/toggle-group/ToggleGroup.js +16 -45
  201. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  202. package/toggle-group/types.d.ts +97 -0
  203. package/toggle-group/types.js +5 -0
  204. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  205. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  206. package/upload/file-upload/FileToUpload.js +1 -1
  207. package/upload/files-upload/FilesToUpload.js +1 -1
  208. package/upload/transaction/Transaction.js +2 -2
  209. package/upload/transactions/Transactions.js +1 -1
  210. package/useTheme.d.ts +2 -0
  211. package/useTheme.js +1 -1
  212. package/wizard/Wizard.d.ts +4 -0
  213. package/wizard/Wizard.js +69 -59
  214. package/wizard/Wizard.stories.tsx +224 -0
  215. package/wizard/types.d.ts +60 -0
  216. package/wizard/types.js +5 -0
  217. package/box/index.d.ts +0 -25
  218. package/chip/index.d.ts +0 -22
  219. package/dialog/index.d.ts +0 -18
  220. package/file-input/index.d.ts +0 -81
  221. package/footer/index.d.ts +0 -25
  222. package/header/index.d.ts +0 -25
  223. package/heading/index.d.ts +0 -17
  224. package/link/index.d.ts +0 -23
  225. package/number-input/index.d.ts +0 -113
  226. package/password-input/index.d.ts +0 -94
  227. package/resultsetTable/index.d.ts +0 -19
  228. package/select/index.d.ts +0 -131
  229. package/sidenav/index.d.ts +0 -13
  230. package/spinner/index.d.ts +0 -17
  231. package/table/index.d.ts +0 -13
  232. package/tag/index.d.ts +0 -24
  233. package/text-input/index.d.ts +0 -135
  234. package/textarea/index.d.ts +0 -117
  235. package/toggle-group/index.d.ts +0 -21
  236. package/wizard/Icons.js +0 -65
  237. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,164 @@
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 = xxxsmall" theme="light" level={4} />
62
+ <Container>
63
+ <DxcStack gutter="xxxsmall">
64
+ <Placeholder></Placeholder>
65
+ <Placeholder></Placeholder>
66
+ <Placeholder></Placeholder>
67
+ </DxcStack>
68
+ </Container>
69
+ <Title title="gutter = xxsmall" theme="light" level={4} />
70
+ <Container>
71
+ <DxcStack gutter="xxsmall">
72
+ <Placeholder></Placeholder>
73
+ <Placeholder></Placeholder>
74
+ <Placeholder></Placeholder>
75
+ </DxcStack>
76
+ </Container>
77
+ <Title title="gutter = xsmall" theme="light" level={4} />
78
+ <Container>
79
+ <DxcStack gutter="xsmall">
80
+ <Placeholder></Placeholder>
81
+ <Placeholder></Placeholder>
82
+ <Placeholder></Placeholder>
83
+ </DxcStack>
84
+ </Container>
85
+ <Title title="gutter = small" theme="light" level={4} />
86
+ <Container>
87
+ <DxcStack gutter="small">
88
+ <Placeholder></Placeholder>
89
+ <Placeholder></Placeholder>
90
+ <Placeholder></Placeholder>
91
+ </DxcStack>
92
+ </Container>
93
+ <Title title="gutter = medium" theme="light" level={4} />
94
+ <Container>
95
+ <DxcStack gutter="medium">
96
+ <Placeholder></Placeholder>
97
+ <Placeholder></Placeholder>
98
+ <Placeholder></Placeholder>
99
+ </DxcStack>
100
+ </Container>
101
+ <Title title="gutter = large" theme="light" level={4} />
102
+ <Container>
103
+ <DxcStack gutter="large">
104
+ <Placeholder></Placeholder>
105
+ <Placeholder></Placeholder>
106
+ <Placeholder></Placeholder>
107
+ </DxcStack>
108
+ </Container>
109
+ <Title title="gutter = xlarge" theme="light" level={4} />
110
+ <Container>
111
+ <DxcStack gutter="xlarge">
112
+ <Placeholder></Placeholder>
113
+ <Placeholder></Placeholder>
114
+ <Placeholder></Placeholder>
115
+ </DxcStack>
116
+ </Container>
117
+ <Title title="gutter = xxlarge" theme="light" level={4} />
118
+ <Container>
119
+ <DxcStack gutter="xxlarge">
120
+ <Placeholder></Placeholder>
121
+ <Placeholder></Placeholder>
122
+ <Placeholder></Placeholder>
123
+ </DxcStack>
124
+ </Container>
125
+ <Title title="gutter = xxxlarge" theme="light" level={4} />
126
+ <Container>
127
+ <DxcStack gutter="xxxlarge">
128
+ <Placeholder></Placeholder>
129
+ <Placeholder></Placeholder>
130
+ <Placeholder></Placeholder>
131
+ </DxcStack>
132
+ </Container>
133
+ <Title title="gutter = xxlarge && divider" theme="light" level={4} />
134
+ <Container>
135
+ <DxcStack gutter="xxlarge" divider>
136
+ <Placeholder></Placeholder>
137
+ <Placeholder></Placeholder>
138
+ <Placeholder></Placeholder>
139
+ </DxcStack>
140
+ </Container>
141
+ <Title title="gutter = none" theme="light" level={4} />
142
+ <Container>
143
+ <DxcStack gutter="none">
144
+ <Placeholder></Placeholder>
145
+ <Placeholder></Placeholder>
146
+ <Placeholder></Placeholder>
147
+ </DxcStack>
148
+ </Container>
149
+ </>
150
+ );
151
+
152
+ const Container = styled.div`
153
+ background: #f2eafa;
154
+ padding: 10px;
155
+ `;
156
+
157
+ const Placeholder = styled.div`
158
+ min-height: 40px;
159
+ min-width: 120px;
160
+ border: 1px solid #a46ede;
161
+ background-color: #e5d5f6;
162
+ padding-left: ${({ paddingLeft }) => `${paddingLeft ?? 0}px`};
163
+ padding-right: ${({ paddingRight }) => `${paddingRight ?? 0}px`};
164
+ `;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ gutter?: "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
4
+ divider?: boolean;
5
+ align?: "start" | "center" | "end" | "baseline" | "stretch";
6
+ as?: React.ElementType;
7
+ children: React.ReactNode;
8
+ };
9
+ export default Props;
package/stack/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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
 
@@ -113,7 +113,7 @@ var calculateWidth = function calculateWidth(margin, size) {
113
113
  return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
114
114
  };
115
115
 
116
- var SwitchContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n\n .MuiSwitch-root {\n align-items: center;\n width: ", ";\n height: 45px;\n margin: 3px;\n\n .Mui-focusVisible {\n border: ", ";\n padding: 7px;\n }\n\n .MuiSwitch-track {\n /*Enabled and unchecked bar*/\n background-color: ", ";\n height: ", ";\n }\n\n .MuiSwitch-switchBase + .MuiSwitch-track {\n opacity: 1;\n }\n\n .MuiIconButton-root {\n /*Enabled and unchecked*/\n top: unset;\n .MuiSwitch-thumb {\n /*Only for thumb in all states*/\n width: ", ";\n height: ", ";\n }\n color: ", ";\n &:hover {\n background-color: transparent;\n }\n &.Mui-disabled {\n /*Disabled and unchecked*/\n color: ", ";\n + .MuiSwitch-track {\n /*Disabled and unchecked bar*/\n background-color: ", ";\n }\n }\n &.Mui-disabled.Mui-checked {\n /*Disabled and checked*/\n color: ", ";\n + .MuiSwitch-track {\n /*Disabled and checked bar*/\n background-color: ", ";\n }\n }\n &.Mui-checked {\n /*Enabled and checked*/\n color: ", ";\n transform: translateX(", ");\n &:hover {\n background-color: transparent;\n }\n + .MuiSwitch-track {\n /*Enabled and checked bar*/\n background-color: ", ";\n }\n }\n }\n }\n"])), function (props) {
116
+ var SwitchContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n \n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n\n .MuiSwitch-root {\n align-items: center;\n width: ", ";\n height: 45px;\n margin: 3px;\n\n .Mui-focusVisible {\n outline: ", ";\n outline-offset: -3px;\n }\n\n .MuiSwitch-track {\n /*Enabled and unchecked bar*/\n background-color: ", ";\n height: ", ";\n }\n\n .MuiSwitch-switchBase + .MuiSwitch-track {\n opacity: 1;\n }\n\n .MuiIconButton-root {\n /*Enabled and unchecked*/\n top: unset;\n .MuiSwitch-thumb {\n /*Only for thumb in all states*/\n width: ", ";\n height: ", ";\n }\n color: ", ";\n &:hover {\n background-color: transparent;\n }\n &.Mui-disabled {\n /*Disabled and unchecked*/\n color: ", ";\n + .MuiSwitch-track {\n /*Disabled and unchecked bar*/\n background-color: ", ";\n }\n }\n &.Mui-disabled.Mui-checked {\n /*Disabled and checked*/\n color: ", ";\n + .MuiSwitch-track {\n /*Disabled and checked bar*/\n background-color: ", ";\n }\n }\n &.Mui-checked {\n /*Enabled and checked*/\n color: ", ";\n transform: translateX(", ");\n &:hover {\n background-color: transparent;\n }\n + .MuiSwitch-track {\n /*Enabled and checked bar*/\n background-color: ", ";\n }\n }\n }\n }\n"])), function (props) {
117
117
  return calculateWidth(props.margin, props.size);
118
118
  }, function (props) {
119
119
  return props.labelPosition === "after" ? "row" : "row-reverse";
@@ -159,7 +159,7 @@ var SwitchContainer = _styledComponents["default"].div(_templateObject || (_temp
159
159
  return props.backgroundType === "dark" ? props.theme.checkedTrackBackgroundColorOnDark : props.theme.checkedTrackBackgroundColor;
160
160
  });
161
161
 
162
- var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n cursor: ", ";\n ", "\n"])), function (props) {
162
+ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n opacity: 1;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n cursor: ", ";\n ", "\n"])), function (props) {
163
163
  return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
164
164
  }, function (props) {
165
165
  return props.theme.labelFontFamily;
@@ -0,0 +1,160 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import DxcSwitch from "./Switch";
4
+ import { BackgroundColorProvider } from "../BackgroundColorContext";
5
+ import Title from "../../.storybook/components/Title";
6
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
7
+ import DarkContainer from "../../.storybook/components/DarkSection";
8
+
9
+ export default {
10
+ title: "Switch",
11
+ component: DxcSwitch,
12
+ };
13
+
14
+ export const Chromatic = () => (
15
+ <>
16
+ <ExampleContainer>
17
+ <Title title="With label after" theme="light" level={4} />
18
+ <DxcSwitch label="Switch" labelPosition="after" />
19
+ </ExampleContainer>
20
+ <ExampleContainer>
21
+ <Title title="Without label" theme="light" level={4} />
22
+ <DxcSwitch />
23
+ </ExampleContainer>
24
+ <ExampleContainer>
25
+ <Title title="Checked" theme="light" level={4} />
26
+ <DxcSwitch label="Switch" checked />
27
+ </ExampleContainer>
28
+ <ExampleContainer>
29
+ <Title title="Required" theme="light" level={4} />
30
+ <DxcSwitch label="Switch" required />
31
+ </ExampleContainer>
32
+ <ExampleContainer>
33
+ <Title title="Disabled" theme="light" level={4} />
34
+ <DxcSwitch label="Switch" disabled />
35
+ </ExampleContainer>
36
+ <ExampleContainer>
37
+ <Title title="Disabled required" theme="light" level={4} />
38
+ <DxcSwitch label="Switch" disabled required labelPosition="after" />
39
+ </ExampleContainer>
40
+ <ExampleContainer>
41
+ <Title title="Disabled checked" theme="light" level={4} />
42
+ <DxcSwitch label="Switch" disabled checked labelPosition="after" />
43
+ </ExampleContainer>
44
+ <BackgroundColorProvider color="#333333">
45
+ <DarkContainer>
46
+ <ExampleContainer>
47
+ <Title title="With label" theme="dark" level={4} />
48
+ <DxcSwitch label="Switch" />
49
+ </ExampleContainer>
50
+ <ExampleContainer>
51
+ <Title title="Checked" theme="dark" level={4} />
52
+ <DxcSwitch label="Switch" checked />
53
+ </ExampleContainer>
54
+ <ExampleContainer>
55
+ <Title title="Required" theme="dark" level={4} />
56
+ <DxcSwitch label="Switch" required />
57
+ </ExampleContainer>
58
+ <ExampleContainer>
59
+ <Title title="Disabled" theme="dark" level={4} />
60
+ <DxcSwitch label="Switch" disabled />
61
+ </ExampleContainer>
62
+ <ExampleContainer>
63
+ <Title title="Disabled required" theme="dark" level={4} />
64
+ <DxcSwitch label="Switch" disabled required labelPosition="after" />
65
+ </ExampleContainer>
66
+ <ExampleContainer>
67
+ <Title title="Disabled checked" theme="dark" level={4} />
68
+ <DxcSwitch label="Switch" disabled checked labelPosition="after" />
69
+ </ExampleContainer>
70
+ </DarkContainer>
71
+ </BackgroundColorProvider>
72
+ <Title title="Margins" theme="light" level={2} />
73
+ <ExampleContainer>
74
+ <Title title="Xxsmall margin" theme="light" level={4} />
75
+ <DxcSwitch label="Xxsmall" margin="xxsmall" />
76
+ </ExampleContainer>
77
+ <ExampleContainer>
78
+ <Title title="Xsmall margin" theme="light" level={4} />
79
+ <DxcSwitch label="Xsmall" margin="xsmall" />
80
+ </ExampleContainer>
81
+ <ExampleContainer>
82
+ <Title title="Small margin" theme="light" level={4} />
83
+ <DxcSwitch label="Small" margin="small" />
84
+ </ExampleContainer>
85
+ <ExampleContainer>
86
+ <Title title="Medium margin" theme="light" level={4} />
87
+ <DxcSwitch label="Medium" margin="medium" />
88
+ </ExampleContainer>
89
+ <ExampleContainer>
90
+ <Title title="Large margin" theme="light" level={4} />
91
+ <DxcSwitch label="Large" margin="large" />
92
+ </ExampleContainer>
93
+ <ExampleContainer>
94
+ <Title title="Xlarge margin" theme="light" level={4} />
95
+ <DxcSwitch label="Xlarge" margin="xlarge" />
96
+ </ExampleContainer>
97
+ <ExampleContainer>
98
+ <Title title="Xxlarge margin" theme="light" level={4} />
99
+ <DxcSwitch label="Xxlarge" margin="xxlarge" />
100
+ </ExampleContainer>
101
+ <Title title="Sizes" theme="light" level={2} />
102
+ <ExampleContainer>
103
+ <Title title="Small size" theme="light" level={4} />
104
+ <DxcSwitch label="Small" size="small" />
105
+ </ExampleContainer>
106
+ <ExampleContainer>
107
+ <Title title="Medium size (with large label)" theme="light" level={4} />
108
+ <DxcSwitch label="Very very very large label or even huge" size="medium" />
109
+ </ExampleContainer>
110
+ <ExampleContainer>
111
+ <Title title="Medium size (with long label)" theme="light" level={4} />
112
+ <DxcSwitch
113
+ label="Large texttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"
114
+ labelPosition="after"
115
+ size="medium"
116
+ />
117
+ </ExampleContainer>
118
+ <ExampleContainer>
119
+ <Title title="Large size" theme="light" level={4} />
120
+ <DxcSwitch label="Large" size="large" />
121
+ </ExampleContainer>
122
+ <ExampleContainer>
123
+ <Title title="FillParent size" theme="light" level={4} />
124
+ <DxcSwitch label="FillParent" size="fillParent" />
125
+ </ExampleContainer>
126
+ <ExampleContainer>
127
+ <Title title="FitContent size" theme="light" level={4} />
128
+ <DxcSwitch label="FitContent" size="fitContent" />
129
+ </ExampleContainer>
130
+ </>
131
+ );
132
+
133
+ const Switch = () => (
134
+ <ExampleContainer>
135
+ <Title title="Focused" theme="light" level={4} />
136
+ <DxcSwitch label="Switch" />
137
+ </ExampleContainer>
138
+ );
139
+ export const FocusedSwitch = Switch.bind({});
140
+ FocusedSwitch.play = async ({ canvasElement }) => {
141
+ const canvas = within(canvasElement);
142
+ canvas.getByRole("checkbox").focus();
143
+ };
144
+
145
+ const DarkSwitch = () => (
146
+ <BackgroundColorProvider color="#333333">
147
+ <DarkContainer>
148
+ <ExampleContainer>
149
+ <Title title="Focused" theme="dark" level={4} />
150
+ <DxcSwitch label="Switch" />
151
+ </ExampleContainer>
152
+ </DarkContainer>
153
+ </BackgroundColorProvider>
154
+ );
155
+
156
+ export const FocusedSwitchOnDark = DarkSwitch.bind({});
157
+ FocusedSwitchOnDark.play = async ({ canvasElement }) => {
158
+ const canvas = within(canvasElement);
159
+ canvas.getByRole("checkbox").focus();
160
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import TablePropsType from "./types";
3
+ declare const DxcTable: ({ children, margin }: TablePropsType) => JSX.Element;
4
+ export default DxcTable;
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";