@dxc-technology/halstack-react 0.0.0-8d998c7 → 0.0.0-90ad27e
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.
- package/accordion/types.d.ts +1 -1
- package/accordion-group/types.d.ts +1 -1
- package/button/Button.d.ts +1 -1
- package/button/Button.js +7 -12
- package/button/Button.stories.tsx +1 -1
- package/button/types.d.ts +10 -10
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +4 -23
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/footer/Footer.stories.jsx +151 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +26 -28
- package/header/Icons.js +2 -27
- package/header/types.d.ts +45 -0
- package/header/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +1 -23
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/number-input/NumberInput.stories.jsx +115 -0
- package/package.json +1 -1
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.stories.jsx +1 -1
- package/progress-bar/ProgressBar.js +1 -1
- package/radio/Radio.stories.tsx +192 -0
- package/select/index.d.ts +2 -2
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +6 -23
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tag/Tag.js +17 -11
- package/tag/Tag.stories.jsx +145 -0
- package/text-input/index.d.ts +2 -2
- package/dialog/index.d.ts +0 -18
- package/header/index.d.ts +0 -25
- package/link/index.d.ts +0 -23
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcTable from "./Table";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Table",
|
|
8
|
+
component: DxcTable,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<ExampleContainer>
|
|
14
|
+
<Title title="Default" theme="light" level={4} />
|
|
15
|
+
<DxcTable>
|
|
16
|
+
<tr>
|
|
17
|
+
<th>header 1</th>
|
|
18
|
+
<th>header 2</th>
|
|
19
|
+
<th>header 3</th>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr>
|
|
22
|
+
<td>cell 1</td>
|
|
23
|
+
<td>cell 2</td>
|
|
24
|
+
<td>cell 3</td>
|
|
25
|
+
</tr>
|
|
26
|
+
<tr>
|
|
27
|
+
<td>cell 4</td>
|
|
28
|
+
<td>cell 5</td>
|
|
29
|
+
<td>cell 6</td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td>cell 7</td>
|
|
33
|
+
<td>cell 8</td>
|
|
34
|
+
<td>Cell 9</td>
|
|
35
|
+
</tr>
|
|
36
|
+
</DxcTable>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<ExampleContainer>
|
|
39
|
+
<Title title="With scrollbar" theme="light" level={4} />
|
|
40
|
+
<div
|
|
41
|
+
style={{ height: 200 + "px", display: "flex", flexDirection: "row", width: 100 + "%", marginBottom: 50 + "px" }}
|
|
42
|
+
>
|
|
43
|
+
<DxcTable>
|
|
44
|
+
<tr>
|
|
45
|
+
<th>
|
|
46
|
+
header<br></br>subheader
|
|
47
|
+
</th>
|
|
48
|
+
<th>
|
|
49
|
+
header<br></br>subheader
|
|
50
|
+
</th>
|
|
51
|
+
<th>
|
|
52
|
+
header<br></br>subheader
|
|
53
|
+
</th>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td>
|
|
57
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
|
58
|
+
dolore magna aliqua.
|
|
59
|
+
</td>
|
|
60
|
+
<td>
|
|
61
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
62
|
+
consequat.
|
|
63
|
+
</td>
|
|
64
|
+
<td>
|
|
65
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
<tr>
|
|
69
|
+
<td>cell data</td>
|
|
70
|
+
<td>cell data</td>
|
|
71
|
+
<td>cell data</td>
|
|
72
|
+
</tr>
|
|
73
|
+
<tr>
|
|
74
|
+
<td>cell data</td>
|
|
75
|
+
<td>cell data</td>
|
|
76
|
+
<td>cell data</td>
|
|
77
|
+
</tr>
|
|
78
|
+
<tr>
|
|
79
|
+
<td>cell data</td>
|
|
80
|
+
<td>cell data</td>
|
|
81
|
+
<td>cell data</td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td>cell data</td>
|
|
85
|
+
<td>cell data</td>
|
|
86
|
+
<td>cell data</td>
|
|
87
|
+
</tr>
|
|
88
|
+
<tr>
|
|
89
|
+
<td>cell data</td>
|
|
90
|
+
<td>cell data</td>
|
|
91
|
+
<td>cell data</td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr>
|
|
94
|
+
<td>cell data</td>
|
|
95
|
+
<td>cell data</td>
|
|
96
|
+
<td>cell data</td>
|
|
97
|
+
</tr>
|
|
98
|
+
<tr>
|
|
99
|
+
<td>cell data</td>
|
|
100
|
+
<td>cell data</td>
|
|
101
|
+
<td>cell data</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<tr>
|
|
104
|
+
<td>cell data</td>
|
|
105
|
+
<td>cell data</td>
|
|
106
|
+
<td>cell data</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</DxcTable>
|
|
109
|
+
</div>
|
|
110
|
+
</ExampleContainer>
|
|
111
|
+
<Title title="Margins" theme="light" level={2} />
|
|
112
|
+
<ExampleContainer>
|
|
113
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
114
|
+
<DxcTable margin="xxsmall">
|
|
115
|
+
<tr>
|
|
116
|
+
<th>header 1</th>
|
|
117
|
+
<th>header 2</th>
|
|
118
|
+
<th>header 3</th>
|
|
119
|
+
</tr>
|
|
120
|
+
<tr>
|
|
121
|
+
<td>cell 1</td>
|
|
122
|
+
<td>cell 2</td>
|
|
123
|
+
<td>cell 3</td>
|
|
124
|
+
</tr>
|
|
125
|
+
<tr>
|
|
126
|
+
<td>cell 4</td>
|
|
127
|
+
<td>cell 5</td>
|
|
128
|
+
<td>cell 6</td>
|
|
129
|
+
</tr>
|
|
130
|
+
<tr>
|
|
131
|
+
<td>cell 7</td>
|
|
132
|
+
<td>cell 8</td>
|
|
133
|
+
<td>Cell 9</td>
|
|
134
|
+
</tr>
|
|
135
|
+
</DxcTable>
|
|
136
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
137
|
+
<DxcTable margin="xsmall">
|
|
138
|
+
<tr>
|
|
139
|
+
<th>header 1</th>
|
|
140
|
+
<th>header 2</th>
|
|
141
|
+
<th>header 3</th>
|
|
142
|
+
</tr>
|
|
143
|
+
<tr>
|
|
144
|
+
<td>cell 1</td>
|
|
145
|
+
<td>cell 2</td>
|
|
146
|
+
<td>cell 3</td>
|
|
147
|
+
</tr>
|
|
148
|
+
<tr>
|
|
149
|
+
<td>cell 4</td>
|
|
150
|
+
<td>cell 5</td>
|
|
151
|
+
<td>cell 6</td>
|
|
152
|
+
</tr>
|
|
153
|
+
<tr>
|
|
154
|
+
<td>cell 7</td>
|
|
155
|
+
<td>cell 8</td>
|
|
156
|
+
<td>Cell 9</td>
|
|
157
|
+
</tr>
|
|
158
|
+
</DxcTable>
|
|
159
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
160
|
+
<DxcTable margin="small">
|
|
161
|
+
<tr>
|
|
162
|
+
<th>header 1</th>
|
|
163
|
+
<th>header 2</th>
|
|
164
|
+
<th>header 3</th>
|
|
165
|
+
</tr>
|
|
166
|
+
<tr>
|
|
167
|
+
<td>cell 1</td>
|
|
168
|
+
<td>cell 2</td>
|
|
169
|
+
<td>cell 3</td>
|
|
170
|
+
</tr>
|
|
171
|
+
<tr>
|
|
172
|
+
<td>cell 4</td>
|
|
173
|
+
<td>cell 5</td>
|
|
174
|
+
<td>cell 6</td>
|
|
175
|
+
</tr>
|
|
176
|
+
<tr>
|
|
177
|
+
<td>cell 7</td>
|
|
178
|
+
<td>cell 8</td>
|
|
179
|
+
<td>Cell 9</td>
|
|
180
|
+
</tr>
|
|
181
|
+
</DxcTable>
|
|
182
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
183
|
+
<DxcTable margin="medium">
|
|
184
|
+
<tr>
|
|
185
|
+
<th>header 1</th>
|
|
186
|
+
<th>header 2</th>
|
|
187
|
+
<th>header 3</th>
|
|
188
|
+
</tr>
|
|
189
|
+
<tr>
|
|
190
|
+
<td>cell 1</td>
|
|
191
|
+
<td>cell 2</td>
|
|
192
|
+
<td>cell 3</td>
|
|
193
|
+
</tr>
|
|
194
|
+
<tr>
|
|
195
|
+
<td>cell 4</td>
|
|
196
|
+
<td>cell 5</td>
|
|
197
|
+
<td>cell 6</td>
|
|
198
|
+
</tr>
|
|
199
|
+
<tr>
|
|
200
|
+
<td>cell 7</td>
|
|
201
|
+
<td>cell 8</td>
|
|
202
|
+
<td>Cell 9</td>
|
|
203
|
+
</tr>
|
|
204
|
+
</DxcTable>
|
|
205
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
206
|
+
<DxcTable margin="large">
|
|
207
|
+
<tr>
|
|
208
|
+
<th>header 1</th>
|
|
209
|
+
<th>header 2</th>
|
|
210
|
+
<th>header 3</th>
|
|
211
|
+
</tr>
|
|
212
|
+
<tr>
|
|
213
|
+
<td>cell 1</td>
|
|
214
|
+
<td>cell 2</td>
|
|
215
|
+
<td>cell 3</td>
|
|
216
|
+
</tr>
|
|
217
|
+
<tr>
|
|
218
|
+
<td>cell 4</td>
|
|
219
|
+
<td>cell 5</td>
|
|
220
|
+
<td>cell 6</td>
|
|
221
|
+
</tr>
|
|
222
|
+
<tr>
|
|
223
|
+
<td>cell 7</td>
|
|
224
|
+
<td>cell 8</td>
|
|
225
|
+
<td>Cell 9</td>
|
|
226
|
+
</tr>
|
|
227
|
+
</DxcTable>
|
|
228
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
229
|
+
<DxcTable margin="xlarge">
|
|
230
|
+
<tr>
|
|
231
|
+
<th>header 1</th>
|
|
232
|
+
<th>header 2</th>
|
|
233
|
+
<th>header 3</th>
|
|
234
|
+
</tr>
|
|
235
|
+
<tr>
|
|
236
|
+
<td>cell 1</td>
|
|
237
|
+
<td>cell 2</td>
|
|
238
|
+
<td>cell 3</td>
|
|
239
|
+
</tr>
|
|
240
|
+
<tr>
|
|
241
|
+
<td>cell 4</td>
|
|
242
|
+
<td>cell 5</td>
|
|
243
|
+
<td>cell 6</td>
|
|
244
|
+
</tr>
|
|
245
|
+
<tr>
|
|
246
|
+
<td>cell 7</td>
|
|
247
|
+
<td>cell 8</td>
|
|
248
|
+
<td>Cell 9</td>
|
|
249
|
+
</tr>
|
|
250
|
+
</DxcTable>
|
|
251
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
252
|
+
<DxcTable margin="xxlarge">
|
|
253
|
+
<tr>
|
|
254
|
+
<th>header 1</th>
|
|
255
|
+
<th>header 2</th>
|
|
256
|
+
<th>header 3</th>
|
|
257
|
+
</tr>
|
|
258
|
+
<tr>
|
|
259
|
+
<td>cell 1</td>
|
|
260
|
+
<td>cell 2</td>
|
|
261
|
+
<td>cell 3</td>
|
|
262
|
+
</tr>
|
|
263
|
+
<tr>
|
|
264
|
+
<td>cell 4</td>
|
|
265
|
+
<td>cell 5</td>
|
|
266
|
+
<td>cell 6</td>
|
|
267
|
+
</tr>
|
|
268
|
+
<tr>
|
|
269
|
+
<td>cell 7</td>
|
|
270
|
+
<td>cell 8</td>
|
|
271
|
+
<td>Cell 9</td>
|
|
272
|
+
</tr>
|
|
273
|
+
</DxcTable>
|
|
274
|
+
</ExampleContainer>
|
|
275
|
+
</>
|
|
276
|
+
);
|
package/table/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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 Props = {
|
|
10
|
+
/**
|
|
11
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
12
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
13
|
+
*/
|
|
14
|
+
margin?: Space | Margin;
|
|
15
|
+
/**
|
|
16
|
+
* The center section of the table. Can be used to render custom
|
|
17
|
+
* content in this area.
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export default Props;
|
package/table/types.js
ADDED
package/tag/Tag.js
CHANGED
|
@@ -27,6 +27,8 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
29
29
|
|
|
30
|
+
var _utils = require("../common/utils.js");
|
|
31
|
+
|
|
30
32
|
var _Box = _interopRequireDefault(require("../box/Box"));
|
|
31
33
|
|
|
32
34
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
@@ -67,8 +69,7 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
67
69
|
size: size,
|
|
68
70
|
shadowDepth: isHovered && (onClick || linkHref) && 2 || 1
|
|
69
71
|
}, /*#__PURE__*/_react["default"].createElement(TagContent, {
|
|
70
|
-
labelPosition: labelPosition
|
|
71
|
-
size: size
|
|
72
|
+
labelPosition: labelPosition
|
|
72
73
|
}, /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
73
74
|
iconBgColor: iconBgColor
|
|
74
75
|
}, icon ? /*#__PURE__*/_react["default"].createElement(TagIconContainer, null, (0, _typeof2["default"])(icon) === "object" ? icon : /*#__PURE__*/_react["default"].createElement(icon)) : /*#__PURE__*/_react["default"].createElement(TagIcon, {
|
|
@@ -79,6 +80,7 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
79
80
|
theme: colorsTheme.tag
|
|
80
81
|
}, /*#__PURE__*/_react["default"].createElement(StyledDxcTag, {
|
|
81
82
|
margin: margin,
|
|
83
|
+
size: size,
|
|
82
84
|
onMouseEnter: function onMouseEnter() {
|
|
83
85
|
return changeIsHovered(true);
|
|
84
86
|
},
|
|
@@ -104,11 +106,11 @@ var sizes = {
|
|
|
104
106
|
fitContent: "unset"
|
|
105
107
|
};
|
|
106
108
|
|
|
107
|
-
var calculateWidth = function calculateWidth(size) {
|
|
108
|
-
return sizes[size];
|
|
109
|
+
var calculateWidth = function calculateWidth(margin, size) {
|
|
110
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
109
111
|
};
|
|
110
112
|
|
|
111
|
-
var StyledDxcTag = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (_ref2) {
|
|
113
|
+
var StyledDxcTag = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n cursor: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n height: ", ";\n"])), function (_ref2) {
|
|
112
114
|
var hasAction = _ref2.hasAction;
|
|
113
115
|
return hasAction && "pointer" || "unset";
|
|
114
116
|
}, function (_ref3) {
|
|
@@ -126,22 +128,24 @@ var StyledDxcTag = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
126
128
|
}, function (_ref7) {
|
|
127
129
|
var margin = _ref7.margin;
|
|
128
130
|
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
131
|
+
}, function (props) {
|
|
132
|
+
return calculateWidth(props.margin, props.size);
|
|
133
|
+
}, function (props) {
|
|
134
|
+
return props.theme.height;
|
|
129
135
|
});
|
|
130
136
|
|
|
131
|
-
var TagContent = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n width:
|
|
137
|
+
var TagContent = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n flex-direction: ", ";\n width: 100%;\n height: ", ";\n"])), function (_ref8) {
|
|
132
138
|
var labelPosition = _ref8.labelPosition;
|
|
133
139
|
return labelPosition === "before" && "row-reverse" || "row";
|
|
134
|
-
}, function (props) {
|
|
135
|
-
return calculateWidth(props.size);
|
|
136
140
|
}, function (props) {
|
|
137
141
|
return props.theme.height;
|
|
138
142
|
});
|
|
139
143
|
|
|
140
|
-
var StyledLink = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n border-radius: 4px;\n
|
|
144
|
+
var StyledLink = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n border-radius: 4px;\n width: 100%;\n :focus {\n outline: 2px solid ", ";\n outline-offset: 0px;\n }\n"])), function (props) {
|
|
141
145
|
return props.theme.focusColor;
|
|
142
146
|
});
|
|
143
147
|
|
|
144
|
-
var StyledButton = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border-radius: 4px;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n
|
|
148
|
+
var StyledButton = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border-radius: 4px;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n width: 100%;\n :focus {\n outline: 2px solid ", ";\n }\n"])), function (props) {
|
|
145
149
|
return props.theme.focusColor;
|
|
146
150
|
});
|
|
147
151
|
|
|
@@ -157,13 +161,15 @@ var TagIconContainer = _styledComponents["default"].div(_templateObject6 || (_te
|
|
|
157
161
|
return props.theme.iconHeight;
|
|
158
162
|
});
|
|
159
163
|
|
|
160
|
-
var IconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n background: ", ";\n width: ", ";\n height: 100%;\n justify-content: center;\n align-items: center;\n color: ", ";\n"])), function (_ref9) {
|
|
164
|
+
var IconContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n background: ", ";\n width: ", ";\n height: 100%;\n justify-content: center;\n align-items: center;\n color: ", ";\n min-width: ", ";\n"])), function (_ref9) {
|
|
161
165
|
var iconBgColor = _ref9.iconBgColor;
|
|
162
166
|
return iconBgColor;
|
|
163
167
|
}, function (props) {
|
|
164
168
|
return props.theme.iconSectionWidth;
|
|
165
169
|
}, function (props) {
|
|
166
170
|
return props.theme.iconColor;
|
|
171
|
+
}, function (props) {
|
|
172
|
+
return props.theme.iconSectionWidth;
|
|
167
173
|
});
|
|
168
174
|
|
|
169
175
|
var TagLabel = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n flex-grow: 1;\n text-align: center;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n"])), function (props) {
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import DxcTag from "./Tag";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Tag",
|
|
9
|
+
component: DxcTag,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const icon = () => {
|
|
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
|
+
const largeIcon = () => {
|
|
21
|
+
return (
|
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
23
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
24
|
+
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Chromatic = () => (
|
|
30
|
+
<>
|
|
31
|
+
<ExampleContainer>
|
|
32
|
+
<Title title="Without label" theme="light" level={4} />
|
|
33
|
+
<DxcTag />
|
|
34
|
+
</ExampleContainer>
|
|
35
|
+
<ExampleContainer>
|
|
36
|
+
<Title title="With icon" theme="light" level={4} />
|
|
37
|
+
<DxcTag icon={icon} />
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="With large icon" theme="light" level={4} />
|
|
41
|
+
<DxcTag icon={largeIcon} />
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="With label" theme="light" level={4} />
|
|
45
|
+
<DxcTag label="Tag" />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="With label and icon" theme="light" level={4} />
|
|
49
|
+
<DxcTag label="Tag" icon={icon} />
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
<ExampleContainer>
|
|
52
|
+
<Title title="With right icon" theme="light" level={4} />
|
|
53
|
+
<DxcTag label="Tag" icon={icon} labelPosition="before" />
|
|
54
|
+
</ExampleContainer>
|
|
55
|
+
<ExampleContainer>
|
|
56
|
+
<Title title="Icon background color" theme="light" level={4} />
|
|
57
|
+
<DxcTag label="Tag" icon={icon} iconBgColor="#fabada" />
|
|
58
|
+
</ExampleContainer>
|
|
59
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
60
|
+
<Title title="With link focused" theme="light" level={4} />
|
|
61
|
+
<DxcTag icon={icon} label="Tag" linkHref="https://www.dxc.com" />
|
|
62
|
+
</ExampleContainer>
|
|
63
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
64
|
+
<Title title="With action focused" theme="light" level={4} />
|
|
65
|
+
<DxcTag
|
|
66
|
+
icon={icon}
|
|
67
|
+
label="Tag"
|
|
68
|
+
onClick={() => {
|
|
69
|
+
console.log("click");
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</ExampleContainer>
|
|
73
|
+
<Title title="Margins" theme="light" level={2} />
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcTag label="Xxsmall" margin="xxsmall" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
80
|
+
<DxcTag label="Xsmall" margin="xsmall" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer>
|
|
83
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
84
|
+
<DxcTag label="Small" margin="small" />
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
88
|
+
<DxcTag label="Medium" margin="medium" />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer>
|
|
91
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
92
|
+
<DxcTag label="Large" margin="large" />
|
|
93
|
+
</ExampleContainer>
|
|
94
|
+
<ExampleContainer>
|
|
95
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
96
|
+
<DxcTag label="Xlarge" margin="xlarge" />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
100
|
+
<DxcTag label="Xxlarge" margin="xxlarge" />
|
|
101
|
+
</ExampleContainer>
|
|
102
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
103
|
+
<ExampleContainer>
|
|
104
|
+
<Title title="Small size" theme="light" level={4} />
|
|
105
|
+
<DxcTag label="Small" size="small" />
|
|
106
|
+
</ExampleContainer>
|
|
107
|
+
<ExampleContainer>
|
|
108
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
109
|
+
<DxcTag label="Medium size medium s" size="medium" />
|
|
110
|
+
</ExampleContainer>
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<Title title="Medium size with ellipsis" theme="light" level={4} />
|
|
113
|
+
<DxcTag label="Medium size medium si medium" size="medium" />
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Large size" theme="light" level={4} />
|
|
117
|
+
<DxcTag label="Large size large size large size large size large size" size="large" />
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Large size with ellipsis" theme="light" level={4} />
|
|
121
|
+
<DxcTag label="Large size large size large size large size large size large size" size="large" />
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
125
|
+
<DxcTag label="FillParent" size="fillParent" />
|
|
126
|
+
</ExampleContainer>
|
|
127
|
+
<ExampleContainer>
|
|
128
|
+
<Title title="FitContent size" theme="light" level={4} />
|
|
129
|
+
<DxcTag label="FitContent" size="fitContent" />
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
</>
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const LinkTag = () => (
|
|
135
|
+
<ExampleContainer>
|
|
136
|
+
<Title title="Hover link tag" theme="light" level={4} />
|
|
137
|
+
<DxcTag label="Tag" icon={icon} linkHref="https://www.dxc.com" />
|
|
138
|
+
</ExampleContainer>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
export const HoverLinkTag = LinkTag.bind({});
|
|
142
|
+
HoverLinkTag.play = async ({ canvasElement }) => {
|
|
143
|
+
const canvas = within(canvasElement);
|
|
144
|
+
await userEvent.hover(canvas.getByText("Tag"));
|
|
145
|
+
};
|
package/text-input/index.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
type SVG =
|
|
9
|
+
type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
10
|
type Action = {
|
|
11
11
|
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
12
|
-
icon: SVG;
|
|
12
|
+
icon: string | SVG;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
type Props = {
|
package/dialog/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Padding = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
isCloseVisible?: boolean;
|
|
11
|
-
onCloseClick?: void;
|
|
12
|
-
overlay?: boolean;
|
|
13
|
-
onBackgroundClick?: void;
|
|
14
|
-
padding?: Padding,
|
|
15
|
-
tabIndex?: number;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default function DxcDialog(props: Props): JSX.Element;
|
package/header/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
type Padding = {
|
|
9
|
-
top?: Space;
|
|
10
|
-
bottom?: Space;
|
|
11
|
-
left?: Space;
|
|
12
|
-
right?: Space;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type Props = {
|
|
16
|
-
underlined?: boolean;
|
|
17
|
-
onClick?: void;
|
|
18
|
-
content?: any;
|
|
19
|
-
responsiveContent?: any;
|
|
20
|
-
margin?: Space | Margin;
|
|
21
|
-
padding?: Space | Padding;
|
|
22
|
-
tabIndex?: number;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default function DxcHeader(props: Props): JSX.Element;
|
package/link/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
inheritColor?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
iconSrc?: string;
|
|
13
|
-
icon?: any;
|
|
14
|
-
iconPosition?: "before" | "after";
|
|
15
|
-
href?: string;
|
|
16
|
-
newWindow?: boolean;
|
|
17
|
-
onClick?: void;
|
|
18
|
-
text?: string;
|
|
19
|
-
margin?: Space | Margin;
|
|
20
|
-
tabIndex?: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default function DxcLink(props: Props): JSX.Element;
|
package/spinner/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
label?: string;
|
|
11
|
-
value?: number;
|
|
12
|
-
showValue?: boolean;
|
|
13
|
-
mode?: "large" | "small" | "overlay";
|
|
14
|
-
margin?: Space | Margin;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default function DxcSpinner(props: Props): JSX.Element;
|
package/table/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
margin?: Space | Margin;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default function DxcTable(props: Props): JSX.Element;
|