@dxc-technology/halstack-react 0.0.0-c709eea → 0.0.0-c796a1b
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/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -3
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +5 -8
- package/V3Select/V3Select.js +2 -2
- package/V3Textarea/V3Textarea.js +2 -2
- package/accordion/Accordion.js +2 -2
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +1 -1
- package/alert/Alert.js +2 -2
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.js +1 -1
- package/box/Box.d.ts +4 -0
- package/box/Box.js +6 -32
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +9 -12
- package/button/Button.stories.tsx +217 -234
- package/button/types.d.ts +11 -11
- package/card/Card.js +5 -6
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +1 -23
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +48 -43
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +4 -7
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +6 -25
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +8 -41
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +65 -76
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +15 -52
- package/footer/Footer.stories.tsx +130 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +65 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +28 -30
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +2 -27
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/InputText.js +2 -2
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +8 -18
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +4 -26
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/list/List.d.ts +7 -0
- package/list/List.js +37 -0
- package/list/List.stories.tsx +70 -0
- package/main.d.ts +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +5 -50
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/paginator/Paginator.js +2 -8
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +19 -55
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +5 -23
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.js +2 -2
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +4 -27
- package/resultsetTable/ResultsetTable.stories.tsx +276 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +11 -0
- package/row/Row.js +124 -0
- package/row/Row.stories.tsx +223 -0
- package/select/Select.js +15 -17
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +2 -2
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +61 -84
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +8 -25
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/stack/Stack.d.ts +10 -0
- package/stack/Stack.js +94 -0
- package/stack/Stack.stories.tsx +150 -0
- package/switch/Switch.js +4 -4
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +9 -55
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +21 -36
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +42 -81
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.js +29 -32
- package/textarea/index.d.ts +18 -8
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +8 -34
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/upload/buttons-upload/ButtonsUpload.js +2 -2
- package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
- package/upload/file-upload/FileToUpload.js +1 -1
- package/upload/files-upload/FilesToUpload.js +1 -1
- package/upload/transaction/Transaction.js +2 -2
- package/upload/transactions/Transactions.js +1 -1
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +13 -53
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/box/index.d.ts +0 -25
- package/chip/index.d.ts +0 -22
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/toggle-group/index.d.ts +0 -21
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcResultsetTable from "./ResultsetTable";
|
|
3
|
+
import DxcButton from "../button/Button";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Resultset Table",
|
|
10
|
+
component: DxcResultsetTable,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const deleteIcon = () => {
|
|
14
|
+
return (
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
16
|
+
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
|
|
17
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const columns = [{ displayValue: "Id" }, { displayValue: "Name" }, { displayValue: "City" }];
|
|
23
|
+
|
|
24
|
+
const rows = [
|
|
25
|
+
[{ displayValue: "001" }, { displayValue: "Peter" }, { displayValue: "Miami" }],
|
|
26
|
+
[{ displayValue: "002" }, { displayValue: "Louis" }, { displayValue: "London" }],
|
|
27
|
+
[{ displayValue: "003" }, { displayValue: "Lana" }, { displayValue: "Amsterdam" }],
|
|
28
|
+
[{ displayValue: "004" }, { displayValue: "Rick" }, { displayValue: "London" }],
|
|
29
|
+
[{ displayValue: "005" }, { displayValue: "Mark" }, { displayValue: "Miami" }],
|
|
30
|
+
[{ displayValue: "006" }, { displayValue: "Cris" }, { displayValue: "Paris" }],
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const rowsIcon = [
|
|
34
|
+
[
|
|
35
|
+
{ displayValue: "001", sortValue: "001" },
|
|
36
|
+
{ displayValue: "Peter" },
|
|
37
|
+
{ displayValue: <DxcButton icon={deleteIcon} /> },
|
|
38
|
+
],
|
|
39
|
+
[{ displayValue: "002", sortValue: "002" }, { displayValue: "Louis" }, { displayValue: "" }],
|
|
40
|
+
[
|
|
41
|
+
{ displayValue: "003", sortValue: "003" },
|
|
42
|
+
{ displayValue: "Mark" },
|
|
43
|
+
{ displayValue: <DxcButton icon={deleteIcon} /> },
|
|
44
|
+
],
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const columnsSortable = [
|
|
48
|
+
{ displayValue: "Id", isSortable: true },
|
|
49
|
+
{ displayValue: "Name", isSortable: true },
|
|
50
|
+
{ displayValue: "City", isSortable: false },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const rowsSortable = [
|
|
54
|
+
[
|
|
55
|
+
{ displayValue: "001", sortValue: "001" },
|
|
56
|
+
{ displayValue: "Peter", sortValue: "Peter" },
|
|
57
|
+
{ displayValue: "Miami", sortValue: "Miami" },
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
{ displayValue: "002", sortValue: "002" },
|
|
61
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
62
|
+
{ displayValue: "London", sortValue: "London" },
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
{ displayValue: "003", sortValue: "003" },
|
|
66
|
+
{ displayValue: "Aida", sortValue: "Aida" },
|
|
67
|
+
{ displayValue: "Wroclaw", sortValue: "Wroclaw" },
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
{ displayValue: "004", sortValue: "004" },
|
|
71
|
+
{ displayValue: "Lana", sortValue: "Lana" },
|
|
72
|
+
{ displayValue: "Amsterdam", sortValue: "Amsterdam" },
|
|
73
|
+
],
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const longColumns = [
|
|
77
|
+
{ displayValue: "Column1" },
|
|
78
|
+
{ displayValue: "Column2" },
|
|
79
|
+
{ displayValue: "Column3" },
|
|
80
|
+
{ displayValue: "Column4" },
|
|
81
|
+
{ displayValue: "Column5" },
|
|
82
|
+
{ displayValue: "Column6" },
|
|
83
|
+
{ displayValue: "Column7" },
|
|
84
|
+
{ displayValue: "Column8" },
|
|
85
|
+
{ displayValue: "Column9" },
|
|
86
|
+
{ displayValue: "Column10" },
|
|
87
|
+
{ displayValue: "Column11" },
|
|
88
|
+
{ displayValue: "Column12" },
|
|
89
|
+
{ displayValue: "Column13" },
|
|
90
|
+
{ displayValue: "Column14" },
|
|
91
|
+
{ displayValue: "Column15" },
|
|
92
|
+
{ displayValue: "Column16" },
|
|
93
|
+
{ displayValue: "Column17" },
|
|
94
|
+
{ displayValue: "Column18" },
|
|
95
|
+
{ displayValue: "Column19" },
|
|
96
|
+
{ displayValue: "Column20" },
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const longRows = [
|
|
100
|
+
[
|
|
101
|
+
{ displayValue: "001", sortValue: "001" },
|
|
102
|
+
{ displayValue: "Peter", sortValue: "Peter" },
|
|
103
|
+
{ displayValue: "Miami", sortValue: "Miami" },
|
|
104
|
+
{ displayValue: "001", sortValue: "001" },
|
|
105
|
+
{ displayValue: "Peter", sortValue: "Peter" },
|
|
106
|
+
{ displayValue: "Miami", sortValue: "Miami" },
|
|
107
|
+
{ displayValue: "Miami", sortValue: "Miami" },
|
|
108
|
+
{ displayValue: "001", sortValue: "001" },
|
|
109
|
+
{ displayValue: "Peter", sortValue: "Peter" },
|
|
110
|
+
{ displayValue: "Miami", sortValue: "Miami" },
|
|
111
|
+
{ displayValue: "002", sortValue: "002" },
|
|
112
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
113
|
+
{ displayValue: "London", sortValue: "London" },
|
|
114
|
+
{ displayValue: "002", sortValue: "002" },
|
|
115
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
116
|
+
{ displayValue: "London", sortValue: "London" },
|
|
117
|
+
{ displayValue: "002", sortValue: "002" },
|
|
118
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
119
|
+
{ displayValue: "London", sortValue: "London" },
|
|
120
|
+
{ displayValue: "London", sortValue: "London" },
|
|
121
|
+
],
|
|
122
|
+
[
|
|
123
|
+
{ displayValue: "002", sortValue: "002" },
|
|
124
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
125
|
+
{ displayValue: "London", sortValue: "London" },
|
|
126
|
+
{ displayValue: "002", sortValue: "002" },
|
|
127
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
128
|
+
{ displayValue: "London", sortValue: "London" },
|
|
129
|
+
{ displayValue: "002", sortValue: "002" },
|
|
130
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
131
|
+
{ displayValue: "London", sortValue: "London" },
|
|
132
|
+
{ displayValue: "London", sortValue: "London" },
|
|
133
|
+
{ displayValue: "002", sortValue: "002" },
|
|
134
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
135
|
+
{ displayValue: "London", sortValue: "London" },
|
|
136
|
+
{ displayValue: "002", sortValue: "002" },
|
|
137
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
138
|
+
{ displayValue: "London", sortValue: "London" },
|
|
139
|
+
{ displayValue: "002", sortValue: "002" },
|
|
140
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
141
|
+
{ displayValue: "London", sortValue: "London" },
|
|
142
|
+
{ displayValue: "London", sortValue: "London" },
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
{ displayValue: "002", sortValue: "002" },
|
|
146
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
147
|
+
{ displayValue: "London", sortValue: "London" },
|
|
148
|
+
{ displayValue: "002", sortValue: "002" },
|
|
149
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
150
|
+
{ displayValue: "London", sortValue: "London" },
|
|
151
|
+
{ displayValue: "002", sortValue: "002" },
|
|
152
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
153
|
+
{ displayValue: "London", sortValue: "London" },
|
|
154
|
+
{ displayValue: "London", sortValue: "London" },
|
|
155
|
+
{ displayValue: "002", sortValue: "002" },
|
|
156
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
157
|
+
{ displayValue: "London", sortValue: "London" },
|
|
158
|
+
{ displayValue: "002", sortValue: "002" },
|
|
159
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
160
|
+
{ displayValue: "London", sortValue: "London" },
|
|
161
|
+
{ displayValue: "002", sortValue: "002" },
|
|
162
|
+
{ displayValue: "Louis", sortValue: "Louis" },
|
|
163
|
+
{ displayValue: "London", sortValue: "London" },
|
|
164
|
+
{ displayValue: "London", sortValue: "London" },
|
|
165
|
+
],
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
export const Chromatic = () => (
|
|
169
|
+
<>
|
|
170
|
+
<ExampleContainer>
|
|
171
|
+
<Title title="Sortable table" theme="light" level={4} />
|
|
172
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable}></DxcResultsetTable>
|
|
173
|
+
</ExampleContainer>
|
|
174
|
+
<ExampleContainer>
|
|
175
|
+
<Title title="With action" theme="light" level={4} />
|
|
176
|
+
<DxcResultsetTable columns={columns} rows={rowsIcon}></DxcResultsetTable>
|
|
177
|
+
</ExampleContainer>
|
|
178
|
+
<ExampleContainer>
|
|
179
|
+
<Title title="With items per page option" theme="light" level={4} />
|
|
180
|
+
<DxcResultsetTable
|
|
181
|
+
columns={columns}
|
|
182
|
+
rows={rows}
|
|
183
|
+
itemsPerPage={2}
|
|
184
|
+
itemsPerPageOptions={[2, 3]}
|
|
185
|
+
></DxcResultsetTable>
|
|
186
|
+
</ExampleContainer>
|
|
187
|
+
<ExampleContainer>
|
|
188
|
+
<Title title="Scroll resultset table" theme="light" level={4} />
|
|
189
|
+
<DxcResultsetTable columns={longColumns} rows={longRows}></DxcResultsetTable>
|
|
190
|
+
</ExampleContainer>
|
|
191
|
+
<Title title="Margins" theme="light" level={2} />
|
|
192
|
+
<ExampleContainer>
|
|
193
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
194
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xxsmall"}></DxcResultsetTable>
|
|
195
|
+
</ExampleContainer>
|
|
196
|
+
<ExampleContainer>
|
|
197
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
198
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xsmall"}></DxcResultsetTable>
|
|
199
|
+
</ExampleContainer>
|
|
200
|
+
<ExampleContainer>
|
|
201
|
+
<Title title="Small" theme="light" level={4} />
|
|
202
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"small"}></DxcResultsetTable>
|
|
203
|
+
</ExampleContainer>
|
|
204
|
+
<ExampleContainer>
|
|
205
|
+
<Title title="Medium" theme="light" level={4} />
|
|
206
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"medium"}></DxcResultsetTable>
|
|
207
|
+
</ExampleContainer>
|
|
208
|
+
<ExampleContainer>
|
|
209
|
+
<Title title="Large" theme="light" level={4} />
|
|
210
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"large"}></DxcResultsetTable>
|
|
211
|
+
</ExampleContainer>
|
|
212
|
+
<ExampleContainer>
|
|
213
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
214
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xlarge"}></DxcResultsetTable>
|
|
215
|
+
</ExampleContainer>
|
|
216
|
+
<ExampleContainer>
|
|
217
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
218
|
+
<DxcResultsetTable columns={columns} rows={rows} margin={"xxlarge"}></DxcResultsetTable>
|
|
219
|
+
</ExampleContainer>
|
|
220
|
+
</>
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
const ResultsetTableAsc = () => (
|
|
224
|
+
<ExampleContainer>
|
|
225
|
+
<Title title="Ascendant sorting" theme="light" level={4} />
|
|
226
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable}></DxcResultsetTable>
|
|
227
|
+
</ExampleContainer>
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
export const AscendentSorting = ResultsetTableAsc.bind({});
|
|
231
|
+
AscendentSorting.play = async ({ canvasElement }) => {
|
|
232
|
+
const canvas = within(canvasElement);
|
|
233
|
+
await userEvent.click(canvas.queryByText("Name"));
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const ResultsetTableDesc = () => (
|
|
237
|
+
<ExampleContainer>
|
|
238
|
+
<Title title="Descendant sorting" theme="light" level={4} />
|
|
239
|
+
<DxcResultsetTable columns={columnsSortable} rows={rowsSortable}></DxcResultsetTable>
|
|
240
|
+
</ExampleContainer>
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
export const DescendantSorting = ResultsetTableDesc.bind({});
|
|
244
|
+
DescendantSorting.play = async ({ canvasElement }) => {
|
|
245
|
+
const canvas = within(canvasElement);
|
|
246
|
+
await userEvent.click(canvas.queryByText("Name"));
|
|
247
|
+
await userEvent.click(canvas.queryByText("Name"));
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const ResultsetTableMiddle = () => (
|
|
251
|
+
<ExampleContainer>
|
|
252
|
+
<Title title="Middle page" theme="light" level={4} />
|
|
253
|
+
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2}></DxcResultsetTable>
|
|
254
|
+
</ExampleContainer>
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
export const MiddlePage = ResultsetTableMiddle.bind({});
|
|
258
|
+
MiddlePage.play = async ({ canvasElement }) => {
|
|
259
|
+
const canvas = within(canvasElement);
|
|
260
|
+
const nextButton = canvas.getAllByRole("button")[2];
|
|
261
|
+
await userEvent.click(nextButton);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const ResultsetTableLast = () => (
|
|
265
|
+
<ExampleContainer>
|
|
266
|
+
<Title title="Last page" theme="light" level={4} />
|
|
267
|
+
<DxcResultsetTable columns={columns} rows={rows} itemsPerPage={2}></DxcResultsetTable>
|
|
268
|
+
</ExampleContainer>
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
export const LastPage = ResultsetTableLast.bind({});
|
|
272
|
+
LastPage.play = async ({ canvasElement }) => {
|
|
273
|
+
const canvas = within(canvasElement);
|
|
274
|
+
const nextButton = canvas.getAllByRole("button")[3];
|
|
275
|
+
await userEvent.click(nextButton);
|
|
276
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
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 Column = {
|
|
10
|
+
/**
|
|
11
|
+
* Column display value.
|
|
12
|
+
*/
|
|
13
|
+
displayValue: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Boolean value to indicate whether the column is sortable or not.
|
|
16
|
+
*/
|
|
17
|
+
isSortable?: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare type Row = {
|
|
20
|
+
/**
|
|
21
|
+
* Value to be displayed in the cell.
|
|
22
|
+
*/
|
|
23
|
+
displayValue: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Value to be used when sorting the table by that
|
|
26
|
+
* column. If not indicated displayValue will be used for sorting.
|
|
27
|
+
*/
|
|
28
|
+
sortValue?: string;
|
|
29
|
+
};
|
|
30
|
+
declare type Props = {
|
|
31
|
+
/**
|
|
32
|
+
* An array of objects representing the columns of the table.
|
|
33
|
+
*/
|
|
34
|
+
columns: Column[];
|
|
35
|
+
/**
|
|
36
|
+
* An array of objects representing the rows of the table, you will have
|
|
37
|
+
* as many objects as columns in the table.
|
|
38
|
+
*/
|
|
39
|
+
rows: Row[][];
|
|
40
|
+
/**
|
|
41
|
+
* If true, a select component for navigation between pages will be displayed.
|
|
42
|
+
*/
|
|
43
|
+
showGoToPage?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Number of items per page.
|
|
46
|
+
*/
|
|
47
|
+
itemsPerPage?: number;
|
|
48
|
+
/**
|
|
49
|
+
* An array of numbers representing the items per page options.
|
|
50
|
+
*/
|
|
51
|
+
itemsPerPageOptions?: number[];
|
|
52
|
+
/**
|
|
53
|
+
* This function will be called when the user selects an item per page
|
|
54
|
+
* option. The value selected will be passed as a parameter.
|
|
55
|
+
*/
|
|
56
|
+
itemsPerPageFunction?: (newValue: number) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Size of the margin to be applied to the component. You can pass an object with 'top',
|
|
59
|
+
* 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
60
|
+
*/
|
|
61
|
+
margin?: Space | Margin;
|
|
62
|
+
/**
|
|
63
|
+
* Value of the tabindex attribute given to the sortable icon.
|
|
64
|
+
*/
|
|
65
|
+
tabIndex?: number;
|
|
66
|
+
};
|
|
67
|
+
export default Props;
|
package/row/Row.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type RowProps = {
|
|
3
|
+
gutter?: "none" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
4
|
+
align?: "start" | "center" | "end" | "baseline" | "stretch";
|
|
5
|
+
justify?: "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
|
|
6
|
+
wrap?: boolean;
|
|
7
|
+
reverse?: boolean;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export default function Row({ gutter, align, justify, wrap, reverse, children }: RowProps): JSX.Element;
|
|
11
|
+
export {};
|
package/row/Row.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
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"] = Row;
|
|
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 Row(_ref) {
|
|
19
|
+
var _ref$gutter = _ref.gutter,
|
|
20
|
+
gutter = _ref$gutter === void 0 ? "none" : _ref$gutter,
|
|
21
|
+
align = _ref.align,
|
|
22
|
+
justify = _ref.justify,
|
|
23
|
+
_ref$wrap = _ref.wrap,
|
|
24
|
+
wrap = _ref$wrap === void 0 ? true : _ref$wrap,
|
|
25
|
+
_ref$reverse = _ref.reverse,
|
|
26
|
+
reverse = _ref$reverse === void 0 ? false : _ref$reverse,
|
|
27
|
+
children = _ref.children;
|
|
28
|
+
return /*#__PURE__*/_react["default"].createElement(StyledRow, {
|
|
29
|
+
gutter: gutter,
|
|
30
|
+
align: align,
|
|
31
|
+
justify: justify,
|
|
32
|
+
wrap: wrap,
|
|
33
|
+
reverse: reverse
|
|
34
|
+
}, children);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var StyledRow = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n flex-wrap: ", ";\n align-items: ", "};\n justify-content: ", ";\n gap: ", ";\n"])), function (_ref2) {
|
|
38
|
+
var reverse = _ref2.reverse;
|
|
39
|
+
return reverse ? "row-reverse" : "row";
|
|
40
|
+
}, function (_ref3) {
|
|
41
|
+
var wrap = _ref3.wrap;
|
|
42
|
+
return wrap ? "wrap" : "nowrap";
|
|
43
|
+
}, function (_ref4) {
|
|
44
|
+
var align = _ref4.align;
|
|
45
|
+
|
|
46
|
+
switch (align) {
|
|
47
|
+
case "start":
|
|
48
|
+
return "flex-start";
|
|
49
|
+
|
|
50
|
+
case "center":
|
|
51
|
+
return "center";
|
|
52
|
+
|
|
53
|
+
case "end":
|
|
54
|
+
return "flex-end";
|
|
55
|
+
|
|
56
|
+
case "baseline":
|
|
57
|
+
return "baseline";
|
|
58
|
+
|
|
59
|
+
case "stretch":
|
|
60
|
+
return "stretch";
|
|
61
|
+
|
|
62
|
+
default:
|
|
63
|
+
return "initial";
|
|
64
|
+
}
|
|
65
|
+
}, function (_ref5) {
|
|
66
|
+
var justify = _ref5.justify;
|
|
67
|
+
|
|
68
|
+
switch (justify) {
|
|
69
|
+
case "spaceBetween":
|
|
70
|
+
return "space-between";
|
|
71
|
+
|
|
72
|
+
case "spaceAround":
|
|
73
|
+
return "space-around";
|
|
74
|
+
|
|
75
|
+
case "spaceEvenly":
|
|
76
|
+
return "space-evenly";
|
|
77
|
+
|
|
78
|
+
case "start":
|
|
79
|
+
return "flex-start";
|
|
80
|
+
|
|
81
|
+
case "center":
|
|
82
|
+
return "center";
|
|
83
|
+
|
|
84
|
+
case "end":
|
|
85
|
+
return "flex-end";
|
|
86
|
+
|
|
87
|
+
default:
|
|
88
|
+
return "initial";
|
|
89
|
+
}
|
|
90
|
+
}, function (_ref6) {
|
|
91
|
+
var gutter = _ref6.gutter;
|
|
92
|
+
|
|
93
|
+
switch (gutter) {
|
|
94
|
+
case "none":
|
|
95
|
+
return "0";
|
|
96
|
+
|
|
97
|
+
case "xxsmall":
|
|
98
|
+
return "0.125rem";
|
|
99
|
+
|
|
100
|
+
case "xsmall":
|
|
101
|
+
return "0.25rem";
|
|
102
|
+
|
|
103
|
+
case "small":
|
|
104
|
+
return "0.5rem";
|
|
105
|
+
|
|
106
|
+
case "medium":
|
|
107
|
+
return "1rem";
|
|
108
|
+
|
|
109
|
+
case "large":
|
|
110
|
+
return "1.5rem";
|
|
111
|
+
|
|
112
|
+
case "xlarge":
|
|
113
|
+
return "2rem";
|
|
114
|
+
|
|
115
|
+
case "xxlarge":
|
|
116
|
+
return "3rem";
|
|
117
|
+
|
|
118
|
+
case "xxxlarge":
|
|
119
|
+
return "4rem";
|
|
120
|
+
|
|
121
|
+
default:
|
|
122
|
+
return "0";
|
|
123
|
+
}
|
|
124
|
+
});
|