@dxc-technology/halstack-react 0.0.0-4a5e7d8 → 0.0.0-4b95ba0
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.js +0 -1
- package/ThemeContext.js +23 -31
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +9 -20
- package/accordion/Accordion.stories.tsx +9 -2
- package/accordion/types.d.ts +3 -7
- package/accordion-group/types.d.ts +3 -7
- package/badge/Badge.d.ts +4 -0
- package/badge/types.d.ts +4 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +7 -15
- package/button/Button.stories.tsx +6 -8
- package/button/types.d.ts +3 -7
- package/card/Card.stories.tsx +1 -1
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +1 -1
- package/chip/Chip.js +14 -52
- package/chip/Chip.stories.tsx +6 -8
- package/chip/types.d.ts +5 -13
- package/common/variables.js +38 -234
- package/date-input/DateInput.js +6 -6
- package/dialog/Dialog.js +2 -1
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +12 -34
- package/dropdown/Dropdown.stories.tsx +25 -23
- package/dropdown/types.d.ts +5 -14
- package/file-input/FileInput.js +102 -33
- package/file-input/FileInput.stories.tsx +507 -0
- package/footer/Footer.js +18 -20
- package/heading/Heading.stories.tsx +3 -2
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.js +9 -3
- package/link/Link.js +7 -15
- package/link/Link.stories.tsx +6 -1
- package/link/types.d.ts +5 -9
- package/list/List.d.ts +3 -7
- package/list/List.js +4 -4
- package/list/List.stories.tsx +10 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +4 -6
- package/main.js +20 -36
- package/package.json +4 -2
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/progress-bar/ProgressBar.js +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +140 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +273 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/RadioGroup.test.js +248 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.js +5 -2
- package/resultsetTable/ResultsetTable.stories.tsx +7 -8
- package/row/Row.d.ts +3 -11
- package/row/Row.js +12 -9
- package/row/Row.stories.tsx +20 -6
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +12 -6
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.stories.tsx +18 -1
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +3 -10
- package/stack/Stack.js +12 -9
- package/stack/Stack.stories.tsx +20 -6
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +7 -7
- package/tabs/Tabs.stories.tsx +7 -8
- package/tabs/types.d.ts +23 -15
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +6 -11
- package/tag/Tag.stories.tsx +15 -22
- package/tag/types.d.ts +23 -14
- package/text/Text.js +1 -1
- package/text-input/TextInput.js +17 -7
- package/text-input/TextInput.stories.tsx +4 -4
- package/text-input/types.d.ts +1 -1
- package/textarea/Textarea.js +5 -3
- package/textarea/Textarea.stories.jsx +4 -3
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/select/index.d.ts +0 -131
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import DxcRadioGroup from "./RadioGroup";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Radio Group",
|
|
7
|
+
component: DxcRadioGroup,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const options = [
|
|
11
|
+
{ label: "Option 1", value: "1" },
|
|
12
|
+
{ label: "Option 2", value: "2" },
|
|
13
|
+
{ label: "Option 3", value: "3" },
|
|
14
|
+
{ label: "Option 4", value: "4" },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const single_disabled_options = [
|
|
18
|
+
{ label: "Option 1", value: "1" },
|
|
19
|
+
{ label: "Option 2", value: "2", disabled: true },
|
|
20
|
+
{ label: "Option 3", value: "3" },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export const Chromatic = () => (
|
|
24
|
+
<>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Label only" theme="light" level={4} />
|
|
27
|
+
<DxcRadioGroup label="Example of a label only" options={options} />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Column" theme="light" level={4} />
|
|
31
|
+
<DxcRadioGroup label="Example" helperText="Helper text" options={options} defaultValue="3" />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Row" theme="light" level={4} />
|
|
35
|
+
<DxcRadioGroup label="Example" helperText="Helper text" options={options} stacking="row" />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer>
|
|
38
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
39
|
+
<DxcRadioGroup
|
|
40
|
+
label="Disabled"
|
|
41
|
+
error="Error message"
|
|
42
|
+
helperText="Helper text"
|
|
43
|
+
options={options}
|
|
44
|
+
disabled
|
|
45
|
+
optional
|
|
46
|
+
defaultValue="2"
|
|
47
|
+
/>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Single disabled" theme="light" level={4} />
|
|
51
|
+
<DxcRadioGroup label="Disabled" helperText="Helper text" options={single_disabled_options} defaultValue="3" />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Optional" theme="light" level={4} />
|
|
55
|
+
<DxcRadioGroup
|
|
56
|
+
label="Example"
|
|
57
|
+
optionalItemLabel="No selection"
|
|
58
|
+
optional
|
|
59
|
+
helperText="Helper text"
|
|
60
|
+
options={options}
|
|
61
|
+
stacking="row"
|
|
62
|
+
/>
|
|
63
|
+
</ExampleContainer>
|
|
64
|
+
<ExampleContainer>
|
|
65
|
+
<Title title="Error" theme="light" level={4} />
|
|
66
|
+
<DxcRadioGroup
|
|
67
|
+
label="Example"
|
|
68
|
+
error="Error message"
|
|
69
|
+
helperText="Helper text"
|
|
70
|
+
options={options}
|
|
71
|
+
defaultValue="2"
|
|
72
|
+
/>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Readonly" theme="light" level={4} />
|
|
76
|
+
<DxcRadioGroup label="Example" readonly helperText="Helper text" options={options} defaultValue="2" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _RadioGroup = _interopRequireDefault(require("./RadioGroup"));
|
|
8
|
+
|
|
9
|
+
var _react2 = require("@testing-library/react");
|
|
10
|
+
|
|
11
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
12
|
+
|
|
13
|
+
var single_options = [{
|
|
14
|
+
label: "Option 01",
|
|
15
|
+
value: "1"
|
|
16
|
+
}, {
|
|
17
|
+
label: "Option 02",
|
|
18
|
+
value: "2"
|
|
19
|
+
}, {
|
|
20
|
+
label: "Option 03",
|
|
21
|
+
value: "3"
|
|
22
|
+
}, {
|
|
23
|
+
label: "Option 04",
|
|
24
|
+
value: "4"
|
|
25
|
+
}, {
|
|
26
|
+
label: "Option 05",
|
|
27
|
+
value: "5"
|
|
28
|
+
}, {
|
|
29
|
+
label: "Option 06",
|
|
30
|
+
value: "6"
|
|
31
|
+
}, {
|
|
32
|
+
label: "Option 07",
|
|
33
|
+
value: "7"
|
|
34
|
+
}, {
|
|
35
|
+
label: "Option 08",
|
|
36
|
+
value: "8"
|
|
37
|
+
}, {
|
|
38
|
+
label: "Option 09",
|
|
39
|
+
value: "9"
|
|
40
|
+
}, {
|
|
41
|
+
label: "Option 10",
|
|
42
|
+
value: "10"
|
|
43
|
+
}];
|
|
44
|
+
describe("Radio Group component tests", function () {
|
|
45
|
+
test("Controlled - Not optional constraint - undefined", function () {
|
|
46
|
+
var onChange = jest.fn();
|
|
47
|
+
var onBlur = jest.fn();
|
|
48
|
+
|
|
49
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
50
|
+
label: "test-select-label",
|
|
51
|
+
options: single_options,
|
|
52
|
+
onChange: onChange,
|
|
53
|
+
onBlur: onBlur
|
|
54
|
+
})),
|
|
55
|
+
getByRole = _render.getByRole,
|
|
56
|
+
getAllByRole = _render.getAllByRole;
|
|
57
|
+
|
|
58
|
+
var radioGroup = getByRole("radiogroup");
|
|
59
|
+
expect(radioGroup.getAttribute("aria-required")).toBe("true");
|
|
60
|
+
|
|
61
|
+
_react2.fireEvent.focus(radioGroup);
|
|
62
|
+
|
|
63
|
+
_react2.fireEvent.blur(radioGroup);
|
|
64
|
+
|
|
65
|
+
expect(onBlur).toHaveBeenCalled();
|
|
66
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
67
|
+
error: "This field is required. Please, choose an option."
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_userEvent["default"].click(radioGroup);
|
|
71
|
+
|
|
72
|
+
_userEvent["default"].click(getAllByRole("radio")[0]);
|
|
73
|
+
|
|
74
|
+
expect(onChange).toHaveBeenCalled();
|
|
75
|
+
expect(onChange).toHaveBeenCalledWith("1");
|
|
76
|
+
|
|
77
|
+
_react2.fireEvent.focus(radioGroup);
|
|
78
|
+
|
|
79
|
+
_react2.fireEvent.blur(radioGroup);
|
|
80
|
+
|
|
81
|
+
expect(onBlur).toHaveBeenCalled();
|
|
82
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
83
|
+
value: "1"
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
test("Controlled - Not optional constraint - empty string", function () {
|
|
87
|
+
var onChange = jest.fn();
|
|
88
|
+
var onBlur = jest.fn();
|
|
89
|
+
|
|
90
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
91
|
+
label: "test-select-label",
|
|
92
|
+
value: "",
|
|
93
|
+
options: single_options,
|
|
94
|
+
onChange: onChange,
|
|
95
|
+
onBlur: onBlur
|
|
96
|
+
})),
|
|
97
|
+
getByRole = _render2.getByRole,
|
|
98
|
+
getAllByRole = _render2.getAllByRole;
|
|
99
|
+
|
|
100
|
+
var radioGroup = getByRole("radiogroup");
|
|
101
|
+
expect(radioGroup.getAttribute("aria-required")).toBe("true");
|
|
102
|
+
|
|
103
|
+
_react2.fireEvent.focus(radioGroup);
|
|
104
|
+
|
|
105
|
+
_react2.fireEvent.blur(radioGroup);
|
|
106
|
+
|
|
107
|
+
expect(onBlur).toHaveBeenCalled();
|
|
108
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
109
|
+
value: "",
|
|
110
|
+
error: "This field is required. Please, choose an option."
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
_userEvent["default"].click(getAllByRole("radio")[0]);
|
|
114
|
+
|
|
115
|
+
expect(onChange).toHaveBeenCalled();
|
|
116
|
+
expect(onChange).toHaveBeenCalledWith("1");
|
|
117
|
+
});
|
|
118
|
+
test("Controlled - Optional constraint", function () {
|
|
119
|
+
var onChange = jest.fn();
|
|
120
|
+
var onBlur = jest.fn();
|
|
121
|
+
|
|
122
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
123
|
+
label: "test-radio-group-label",
|
|
124
|
+
helperText: "test-radio-group-helper-text",
|
|
125
|
+
options: single_options,
|
|
126
|
+
onChange: onChange,
|
|
127
|
+
onBlur: onBlur,
|
|
128
|
+
optional: true
|
|
129
|
+
})),
|
|
130
|
+
getByRole = _render3.getByRole;
|
|
131
|
+
|
|
132
|
+
var radioGroup = getByRole("radiogroup");
|
|
133
|
+
expect(radioGroup.getAttribute("aria-required")).toBe("false");
|
|
134
|
+
|
|
135
|
+
_react2.fireEvent.focus(radioGroup);
|
|
136
|
+
|
|
137
|
+
_react2.fireEvent.blur(radioGroup);
|
|
138
|
+
|
|
139
|
+
expect(onBlur).toHaveBeenCalled();
|
|
140
|
+
expect(onBlur).toHaveBeenCalledWith({});
|
|
141
|
+
expect(radioGroup.getAttribute("aria-invalid")).toBe("false");
|
|
142
|
+
});
|
|
143
|
+
test("Select an option - Click on radio input label", function () {
|
|
144
|
+
var onChange = jest.fn();
|
|
145
|
+
|
|
146
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
147
|
+
label: "test-radio-group-label",
|
|
148
|
+
helperText: "test-radio-group-helper-text",
|
|
149
|
+
options: single_options,
|
|
150
|
+
onChange: onChange
|
|
151
|
+
})),
|
|
152
|
+
getByText = _render4.getByText,
|
|
153
|
+
getAllByRole = _render4.getAllByRole;
|
|
154
|
+
|
|
155
|
+
var radio = getByText("Option 10");
|
|
156
|
+
|
|
157
|
+
_userEvent["default"].click(radio);
|
|
158
|
+
|
|
159
|
+
expect(onChange).toHaveBeenCalled();
|
|
160
|
+
expect(onChange).toHaveBeenCalledWith("10");
|
|
161
|
+
expect(getAllByRole("radio")[9].getAttribute("aria-checked")).toBe("true");
|
|
162
|
+
});
|
|
163
|
+
test("Select an option - Click on radio input", function () {
|
|
164
|
+
var onChange = jest.fn();
|
|
165
|
+
|
|
166
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
167
|
+
label: "test-radio-group-label",
|
|
168
|
+
helperText: "test-radio-group-helper-text",
|
|
169
|
+
options: single_options,
|
|
170
|
+
onChange: onChange
|
|
171
|
+
})),
|
|
172
|
+
getAllByRole = _render5.getAllByRole;
|
|
173
|
+
|
|
174
|
+
var radio = getAllByRole("radio")[6];
|
|
175
|
+
|
|
176
|
+
_userEvent["default"].click(radio);
|
|
177
|
+
|
|
178
|
+
expect(onChange).toHaveBeenCalled();
|
|
179
|
+
expect(onChange).toHaveBeenCalledWith("7");
|
|
180
|
+
expect(radio.getAttribute("aria-checked")).toBe("true");
|
|
181
|
+
});
|
|
182
|
+
test("Select an option - Tab and Enter key", function () {
|
|
183
|
+
var onChange = jest.fn();
|
|
184
|
+
|
|
185
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
186
|
+
label: "test-radio-group-label",
|
|
187
|
+
helperText: "test-radio-group-helper-text",
|
|
188
|
+
options: single_options,
|
|
189
|
+
onChange: onChange
|
|
190
|
+
})),
|
|
191
|
+
getByRole = _render6.getByRole,
|
|
192
|
+
getAllByRole = _render6.getAllByRole;
|
|
193
|
+
|
|
194
|
+
var radioGroup = getByRole("radiogroup");
|
|
195
|
+
var radio = getAllByRole("radio")[0];
|
|
196
|
+
|
|
197
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
198
|
+
key: "Tab",
|
|
199
|
+
code: "Tab",
|
|
200
|
+
keyCode: 9,
|
|
201
|
+
charCode: 9
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
205
|
+
key: "Enter",
|
|
206
|
+
code: "Enter",
|
|
207
|
+
keyCode: 13,
|
|
208
|
+
charCode: 13
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
expect(onChange).toHaveBeenCalled();
|
|
212
|
+
expect(onChange).toHaveBeenCalledWith("1");
|
|
213
|
+
expect(radio.getAttribute("aria-checked")).toBe("true");
|
|
214
|
+
});
|
|
215
|
+
test("Select an option - Tab and Space key", function () {
|
|
216
|
+
var onChange = jest.fn();
|
|
217
|
+
|
|
218
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
219
|
+
label: "test-radio-group-label",
|
|
220
|
+
helperText: "test-radio-group-helper-text",
|
|
221
|
+
options: single_options,
|
|
222
|
+
onChange: onChange
|
|
223
|
+
})),
|
|
224
|
+
getByRole = _render7.getByRole,
|
|
225
|
+
getAllByRole = _render7.getAllByRole;
|
|
226
|
+
|
|
227
|
+
var radioGroup = getByRole("radiogroup");
|
|
228
|
+
var radio = getAllByRole("radio")[0];
|
|
229
|
+
|
|
230
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
231
|
+
key: "Tab",
|
|
232
|
+
code: "Tab",
|
|
233
|
+
keyCode: 9,
|
|
234
|
+
charCode: 9
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
238
|
+
key: "Space",
|
|
239
|
+
code: "Space",
|
|
240
|
+
keyCode: 32,
|
|
241
|
+
charCode: 32
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
expect(onChange).toHaveBeenCalled();
|
|
245
|
+
expect(onChange).toHaveBeenCalledWith("1");
|
|
246
|
+
expect(radio.getAttribute("aria-checked")).toBe("true");
|
|
247
|
+
});
|
|
248
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type Option = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare type RadioGroupProps = {
|
|
7
|
+
label: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
options: Option[];
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
optional?: boolean;
|
|
13
|
+
optionalItemLabel?: string;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
stacking?: "row" | "column";
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
onChange?: (value?: string) => void;
|
|
19
|
+
onBlur?: (val: {
|
|
20
|
+
value?: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
error?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare type RefType = HTMLDivElement;
|
|
26
|
+
export declare type RadioProps = {
|
|
27
|
+
option: Option;
|
|
28
|
+
currentValue?: string;
|
|
29
|
+
onClick: () => void;
|
|
30
|
+
onFocus: () => void;
|
|
31
|
+
error?: string;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
focused: boolean;
|
|
34
|
+
readonly: boolean;
|
|
35
|
+
};
|
|
36
|
+
export default RadioGroupProps;
|
|
@@ -185,7 +185,8 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
185
185
|
onClick: function onClick() {
|
|
186
186
|
return column.isSortable && changeSorting(index);
|
|
187
187
|
},
|
|
188
|
-
tabIndex: column.isSortable ? tabIndex : -1
|
|
188
|
+
tabIndex: column.isSortable ? tabIndex : -1,
|
|
189
|
+
isSortable: column.isSortable
|
|
189
190
|
}, /*#__PURE__*/_react["default"].createElement(TitleDiv, {
|
|
190
191
|
isSortable: column.isSortable
|
|
191
192
|
}, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, getIconForSortableColumn(index))));
|
|
@@ -227,8 +228,10 @@ var TitleDiv = _styledComponents["default"].div(_templateObject5 || (_templateOb
|
|
|
227
228
|
|
|
228
229
|
var TableHeader = _styledComponents["default"].th(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
229
230
|
|
|
230
|
-
var HeaderContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width:
|
|
231
|
+
var HeaderContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: fit-content;\n :focus {\n ", "\n }\n"])), function (props) {
|
|
231
232
|
return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
|
|
233
|
+
}, function (props) {
|
|
234
|
+
return props.isSortable && "outline: #0095ff solid 2px; \n outline-offset: 4px;";
|
|
232
235
|
});
|
|
233
236
|
|
|
234
237
|
var HeaderRow = _styledComponents["default"].thead(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 60px;\n"])));
|
|
@@ -10,14 +10,12 @@ export default {
|
|
|
10
10
|
component: DxcResultsetTable,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const deleteIcon = (
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
20
|
-
};
|
|
13
|
+
const deleteIcon = (
|
|
14
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
15
|
+
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
|
|
16
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
21
19
|
|
|
22
20
|
const columns = [{ displayValue: "Id" }, { displayValue: "Name" }, { displayValue: "City" }];
|
|
23
21
|
|
|
@@ -216,6 +214,7 @@ export const Chromatic = () => (
|
|
|
216
214
|
<ExampleContainer>
|
|
217
215
|
<Title title="Xxlarge" theme="light" level={4} />
|
|
218
216
|
<DxcResultsetTable columns={columns} rows={rows} margin={"xxlarge"}></DxcResultsetTable>
|
|
217
|
+
<hr />
|
|
219
218
|
</ExampleContainer>
|
|
220
219
|
</>
|
|
221
220
|
);
|
package/row/Row.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import RowPropsType from "./types";
|
|
3
|
+
export default function Row({ gutter, align, justify, wrap, reverse, children, }: RowPropsType): JSX.Element;
|
package/row/Row.js
CHANGED
|
@@ -34,7 +34,7 @@ function Row(_ref) {
|
|
|
34
34
|
}, children);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
var StyledRow = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n flex-wrap: ", ";\n align-items: ", "
|
|
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
38
|
var reverse = _ref2.reverse;
|
|
39
39
|
return reverse ? "row-reverse" : "row";
|
|
40
40
|
}, function (_ref3) {
|
|
@@ -94,30 +94,33 @@ var StyledRow = _styledComponents["default"].div(_templateObject || (_templateOb
|
|
|
94
94
|
case "none":
|
|
95
95
|
return "0";
|
|
96
96
|
|
|
97
|
-
case "
|
|
97
|
+
case "xxxsmall":
|
|
98
98
|
return "0.125rem";
|
|
99
99
|
|
|
100
|
-
case "
|
|
100
|
+
case "xxsmall":
|
|
101
101
|
return "0.25rem";
|
|
102
102
|
|
|
103
|
-
case "
|
|
103
|
+
case "xsmall":
|
|
104
104
|
return "0.5rem";
|
|
105
105
|
|
|
106
|
-
case "
|
|
106
|
+
case "small":
|
|
107
107
|
return "1rem";
|
|
108
108
|
|
|
109
|
-
case "
|
|
109
|
+
case "medium":
|
|
110
110
|
return "1.5rem";
|
|
111
111
|
|
|
112
|
-
case "
|
|
112
|
+
case "large":
|
|
113
113
|
return "2rem";
|
|
114
114
|
|
|
115
|
-
case "
|
|
115
|
+
case "xlarge":
|
|
116
116
|
return "3rem";
|
|
117
117
|
|
|
118
|
-
case "
|
|
118
|
+
case "xxlarge":
|
|
119
119
|
return "4rem";
|
|
120
120
|
|
|
121
|
+
case "xxxlarge":
|
|
122
|
+
return "5rem";
|
|
123
|
+
|
|
121
124
|
default:
|
|
122
125
|
return "0";
|
|
123
126
|
}
|
package/row/Row.stories.tsx
CHANGED
|
@@ -106,6 +106,14 @@ export const Chromatic = () => (
|
|
|
106
106
|
<Placeholder paddingTop={60}></Placeholder>
|
|
107
107
|
</DxcRow>
|
|
108
108
|
</Container>
|
|
109
|
+
<Title title="gutter = xxxsmall" theme="light" level={4} />
|
|
110
|
+
<Container>
|
|
111
|
+
<DxcRow gutter="xxxsmall">
|
|
112
|
+
<Placeholder></Placeholder>
|
|
113
|
+
<Placeholder></Placeholder>
|
|
114
|
+
<Placeholder></Placeholder>
|
|
115
|
+
</DxcRow>
|
|
116
|
+
</Container>
|
|
109
117
|
<Title title="gutter = xxsmall" theme="light" level={4} />
|
|
110
118
|
<Container>
|
|
111
119
|
<DxcRow gutter="xxsmall">
|
|
@@ -162,6 +170,14 @@ export const Chromatic = () => (
|
|
|
162
170
|
<Placeholder></Placeholder>
|
|
163
171
|
</DxcRow>
|
|
164
172
|
</Container>
|
|
173
|
+
<Title title="gutter = xxxlarge" theme="light" level={4} />
|
|
174
|
+
<Container>
|
|
175
|
+
<DxcRow gutter="xxxlarge">
|
|
176
|
+
<Placeholder></Placeholder>
|
|
177
|
+
<Placeholder></Placeholder>
|
|
178
|
+
<Placeholder></Placeholder>
|
|
179
|
+
</DxcRow>
|
|
180
|
+
</Container>
|
|
165
181
|
<Title title="gutter = none" theme="light" level={4} />
|
|
166
182
|
<Container>
|
|
167
183
|
<DxcRow gutter="none">
|
|
@@ -206,18 +222,16 @@ export const Chromatic = () => (
|
|
|
206
222
|
);
|
|
207
223
|
|
|
208
224
|
const Container = styled.div`
|
|
209
|
-
background: #
|
|
225
|
+
background: #f2eafa;
|
|
210
226
|
padding: 10px;
|
|
211
|
-
border-radius: 10px;
|
|
212
227
|
width: ${({ width }) => (width ? `${width}px` : "unset")};
|
|
213
228
|
`;
|
|
214
229
|
|
|
215
230
|
const Placeholder = styled.div`
|
|
216
|
-
min-height:
|
|
231
|
+
min-height: 40px;
|
|
217
232
|
min-width: 120px;
|
|
218
|
-
border: 1px solid #
|
|
219
|
-
background-color: #
|
|
220
|
-
border-radius: 5px;
|
|
233
|
+
border: 1px solid #a46ede;
|
|
234
|
+
background-color: #e5d5f6;
|
|
221
235
|
padding-top: ${({ paddingTop }) => `${paddingTop ?? 0}px`};
|
|
222
236
|
padding-bottom: ${({ paddingBottom }) => `${paddingBottom ?? 0}px`};
|
|
223
237
|
`;
|
package/row/types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
gutter?: "none" | "xxxsmall" | "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 Props;
|
package/row/types.js
ADDED
package/select/Select.js
CHANGED
|
@@ -153,7 +153,7 @@ var getLastOptionIndex = function getLastOptionIndex(options, filteredOptions, s
|
|
|
153
153
|
|
|
154
154
|
var getSelectedOption = function getSelectedOption(options, multiple, optional, optionalEmptyOption, value, innerValue) {
|
|
155
155
|
var val = value !== null && value !== void 0 ? value : innerValue;
|
|
156
|
-
var selectedOption = multiple ? [] :
|
|
156
|
+
var selectedOption = multiple ? [] : {};
|
|
157
157
|
var singleSelectionIndex;
|
|
158
158
|
|
|
159
159
|
if (multiple) {
|
|
@@ -231,6 +231,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
231
231
|
selectId = _useState2[0];
|
|
232
232
|
|
|
233
233
|
var selectLabelId = "label-".concat(selectId);
|
|
234
|
+
var errorId = "error-".concat(selectId);
|
|
234
235
|
var optionsListId = "".concat(selectId, "-listbox");
|
|
235
236
|
|
|
236
237
|
var _useState3 = (0, _react.useState)(multiple ? [] : ""),
|
|
@@ -567,11 +568,13 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
567
568
|
tabIndex: tabIndex,
|
|
568
569
|
role: "combobox",
|
|
569
570
|
"aria-controls": optionsListId,
|
|
571
|
+
"aria-disabled": disabled,
|
|
570
572
|
"aria-expanded": isOpen,
|
|
571
573
|
"aria-haspopup": "listbox",
|
|
572
574
|
"aria-labelledby": selectLabelId,
|
|
573
575
|
"aria-activedescendant": visualFocusIndex >= 0 ? "option-".concat(visualFocusIndex) : undefined,
|
|
574
576
|
"aria-invalid": error ? "true" : "false",
|
|
577
|
+
"aria-errormessage": error ? errorId : undefined,
|
|
575
578
|
"aria-required": !optional
|
|
576
579
|
}, multiple && selectedOption.length > 0 && /*#__PURE__*/_react["default"].createElement(SelectionIndicator, null, /*#__PURE__*/_react["default"].createElement(SelectionNumber, {
|
|
577
580
|
disabled: disabled
|
|
@@ -583,8 +586,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
583
586
|
},
|
|
584
587
|
onClick: handleClearOptionsActionOnClick,
|
|
585
588
|
tabIndex: -1,
|
|
586
|
-
title: "Clear
|
|
587
|
-
"aria-label": "Clear
|
|
589
|
+
title: "Clear selection",
|
|
590
|
+
"aria-label": "Clear selection"
|
|
588
591
|
}, selectIcons.clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
589
592
|
name: name,
|
|
590
593
|
value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(", ") : value !== null && value !== void 0 ? value : innerValue,
|
|
@@ -613,8 +616,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
613
616
|
},
|
|
614
617
|
onClick: handleClearSearchActionOnClick,
|
|
615
618
|
tabIndex: -1,
|
|
616
|
-
title: "Clear search
|
|
617
|
-
"aria-label": "Clear search
|
|
619
|
+
title: "Clear search",
|
|
620
|
+
"aria-label": "Clear search"
|
|
618
621
|
}, selectIcons.clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
619
622
|
disabled: disabled
|
|
620
623
|
}, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && /*#__PURE__*/_react["default"].createElement(OptionsList, {
|
|
@@ -631,7 +634,10 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
631
634
|
}, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, selectIcons.searchOff), "No matches found") : optional && !multiple && /*#__PURE__*/_react["default"].createElement(Option, {
|
|
632
635
|
option: optionalEmptyOption,
|
|
633
636
|
index: 0
|
|
634
|
-
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error,
|
|
637
|
+
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
638
|
+
id: errorId,
|
|
639
|
+
"aria-live": error ? "assertive" : "off"
|
|
640
|
+
}, error)));
|
|
635
641
|
});
|
|
636
642
|
|
|
637
643
|
var sizes = {
|