@dxc-technology/halstack-react 0.0.0-b39a2d8 → 0.0.0-b3e1a2f
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 -4
- 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/Accordion.stories.tsx +307 -0
- 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/badge/Badge.js +1 -1
- 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/box/Box.js +2 -2
- package/button/Button.d.ts +1 -1
- package/button/Button.js +13 -19
- package/button/Button.stories.tsx +6 -8
- package/button/types.d.ts +5 -9
- package/card/Card.js +1 -1
- package/card/Card.stories.tsx +1 -1
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +5 -27
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +57 -22
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +10 -13
- package/dialog/Dialog.js +4 -3
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/Dropdown.stories.tsx +247 -0
- package/dropdown/types.d.ts +1 -1
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +160 -81
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.js +8 -6
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +12 -18
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +21 -17
- package/header/Header.js +2 -2
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +54 -0
- package/input-text/InputText.js +2 -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.d.ts +10 -0
- package/layout/ApplicationLayout.js +9 -19
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +1 -1
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.js +3 -6
- 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/package.json +4 -2
- package/paginator/Paginator.js +2 -8
- package/password-input/PasswordInput.js +19 -18
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/types.d.ts +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/radio/Radio.js +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +130 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +268 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +5 -28
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +20 -22
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.js +2 -2
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/slider/Slider.js +4 -4
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +11 -9
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +23 -15
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +1 -1
- 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 +54 -85
- 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.d.ts +4 -0
- package/textarea/Textarea.js +27 -60
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/types.d.ts +97 -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.js +59 -9
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/types.d.ts +3 -7
- package/chip/index.d.ts +0 -22
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle-group/index.d.ts +0 -21
- package/wizard/Icons.js +0 -65
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcRow from "./Row";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Row",
|
|
8
|
+
component: DxcRow,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" theme="light" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcRow>
|
|
16
|
+
<Placeholder></Placeholder>
|
|
17
|
+
<Placeholder></Placeholder>
|
|
18
|
+
<Placeholder></Placeholder>
|
|
19
|
+
</DxcRow>
|
|
20
|
+
</Container>
|
|
21
|
+
<Title title="Justify = center" theme="light" level={4} />
|
|
22
|
+
<Container>
|
|
23
|
+
<DxcRow justify="center">
|
|
24
|
+
<Placeholder></Placeholder>
|
|
25
|
+
<Placeholder></Placeholder>
|
|
26
|
+
<Placeholder></Placeholder>
|
|
27
|
+
</DxcRow>
|
|
28
|
+
</Container>
|
|
29
|
+
<Title title="Justify = end" theme="light" level={4} />
|
|
30
|
+
<Container>
|
|
31
|
+
<DxcRow justify="end">
|
|
32
|
+
<Placeholder></Placeholder>
|
|
33
|
+
<Placeholder></Placeholder>
|
|
34
|
+
<Placeholder></Placeholder>
|
|
35
|
+
</DxcRow>
|
|
36
|
+
</Container>
|
|
37
|
+
<Title title="Justify = spaceAround" theme="light" level={4} />
|
|
38
|
+
<Container>
|
|
39
|
+
<DxcRow justify="spaceAround">
|
|
40
|
+
<Placeholder></Placeholder>
|
|
41
|
+
<Placeholder></Placeholder>
|
|
42
|
+
<Placeholder></Placeholder>
|
|
43
|
+
</DxcRow>
|
|
44
|
+
</Container>
|
|
45
|
+
<Title title="Justify = spaceBetween" theme="light" level={4} />
|
|
46
|
+
<Container>
|
|
47
|
+
<DxcRow justify="spaceBetween">
|
|
48
|
+
<Placeholder></Placeholder>
|
|
49
|
+
<Placeholder></Placeholder>
|
|
50
|
+
<Placeholder></Placeholder>
|
|
51
|
+
</DxcRow>
|
|
52
|
+
</Container>
|
|
53
|
+
<Title title="Justify = spaceEvenly" theme="light" level={4} />
|
|
54
|
+
<Container>
|
|
55
|
+
<DxcRow justify="spaceEvenly">
|
|
56
|
+
<Placeholder></Placeholder>
|
|
57
|
+
<Placeholder></Placeholder>
|
|
58
|
+
<Placeholder></Placeholder>
|
|
59
|
+
</DxcRow>
|
|
60
|
+
</Container>
|
|
61
|
+
<Title title="Justify = start" theme="light" level={4} />
|
|
62
|
+
<Container>
|
|
63
|
+
<DxcRow justify="start">
|
|
64
|
+
<Placeholder></Placeholder>
|
|
65
|
+
<Placeholder></Placeholder>
|
|
66
|
+
<Placeholder></Placeholder>
|
|
67
|
+
</DxcRow>
|
|
68
|
+
</Container>
|
|
69
|
+
<Title title="Align = baseline" theme="light" level={4} />
|
|
70
|
+
<Container>
|
|
71
|
+
<DxcRow align="baseline">
|
|
72
|
+
<Placeholder paddingTop={20}>test</Placeholder>
|
|
73
|
+
<Placeholder>test</Placeholder>
|
|
74
|
+
<Placeholder paddingBottom={60}>test</Placeholder>
|
|
75
|
+
</DxcRow>
|
|
76
|
+
</Container>
|
|
77
|
+
<Title title="Align = center" theme="light" level={4} />
|
|
78
|
+
<Container>
|
|
79
|
+
<DxcRow align="center">
|
|
80
|
+
<Placeholder paddingTop={20}></Placeholder>
|
|
81
|
+
<Placeholder></Placeholder>
|
|
82
|
+
<Placeholder paddingTop={60}></Placeholder>
|
|
83
|
+
</DxcRow>
|
|
84
|
+
</Container>
|
|
85
|
+
<Title title="Align = end" theme="light" level={4} />
|
|
86
|
+
<Container>
|
|
87
|
+
<DxcRow align="end">
|
|
88
|
+
<Placeholder paddingTop={20}></Placeholder>
|
|
89
|
+
<Placeholder></Placeholder>
|
|
90
|
+
<Placeholder paddingTop={60}></Placeholder>
|
|
91
|
+
</DxcRow>
|
|
92
|
+
</Container>
|
|
93
|
+
<Title title="Align = start" theme="light" level={4} />
|
|
94
|
+
<Container>
|
|
95
|
+
<DxcRow align="start">
|
|
96
|
+
<Placeholder paddingTop={20}></Placeholder>
|
|
97
|
+
<Placeholder></Placeholder>
|
|
98
|
+
<Placeholder paddingTop={60}></Placeholder>
|
|
99
|
+
</DxcRow>
|
|
100
|
+
</Container>
|
|
101
|
+
<Title title="Align = stretch" theme="light" level={4} />
|
|
102
|
+
<Container>
|
|
103
|
+
<DxcRow align="stretch">
|
|
104
|
+
<Placeholder paddingTop={20}></Placeholder>
|
|
105
|
+
<Placeholder></Placeholder>
|
|
106
|
+
<Placeholder paddingTop={60}></Placeholder>
|
|
107
|
+
</DxcRow>
|
|
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>
|
|
117
|
+
<Title title="gutter = xxsmall" theme="light" level={4} />
|
|
118
|
+
<Container>
|
|
119
|
+
<DxcRow gutter="xxsmall">
|
|
120
|
+
<Placeholder></Placeholder>
|
|
121
|
+
<Placeholder></Placeholder>
|
|
122
|
+
<Placeholder></Placeholder>
|
|
123
|
+
</DxcRow>
|
|
124
|
+
</Container>
|
|
125
|
+
<Title title="gutter = xsmall" theme="light" level={4} />
|
|
126
|
+
<Container>
|
|
127
|
+
<DxcRow gutter="xsmall">
|
|
128
|
+
<Placeholder></Placeholder>
|
|
129
|
+
<Placeholder></Placeholder>
|
|
130
|
+
<Placeholder></Placeholder>
|
|
131
|
+
</DxcRow>
|
|
132
|
+
</Container>
|
|
133
|
+
<Title title="gutter = small" theme="light" level={4} />
|
|
134
|
+
<Container>
|
|
135
|
+
<DxcRow gutter="small">
|
|
136
|
+
<Placeholder></Placeholder>
|
|
137
|
+
<Placeholder></Placeholder>
|
|
138
|
+
<Placeholder></Placeholder>
|
|
139
|
+
</DxcRow>
|
|
140
|
+
</Container>
|
|
141
|
+
<Title title="gutter = medium" theme="light" level={4} />
|
|
142
|
+
<Container>
|
|
143
|
+
<DxcRow gutter="medium">
|
|
144
|
+
<Placeholder></Placeholder>
|
|
145
|
+
<Placeholder></Placeholder>
|
|
146
|
+
<Placeholder></Placeholder>
|
|
147
|
+
</DxcRow>
|
|
148
|
+
</Container>
|
|
149
|
+
<Title title="gutter = large" theme="light" level={4} />
|
|
150
|
+
<Container>
|
|
151
|
+
<DxcRow gutter="large">
|
|
152
|
+
<Placeholder></Placeholder>
|
|
153
|
+
<Placeholder></Placeholder>
|
|
154
|
+
<Placeholder></Placeholder>
|
|
155
|
+
</DxcRow>
|
|
156
|
+
</Container>
|
|
157
|
+
<Title title="gutter = xlarge" theme="light" level={4} />
|
|
158
|
+
<Container>
|
|
159
|
+
<DxcRow gutter="xlarge">
|
|
160
|
+
<Placeholder></Placeholder>
|
|
161
|
+
<Placeholder></Placeholder>
|
|
162
|
+
<Placeholder></Placeholder>
|
|
163
|
+
</DxcRow>
|
|
164
|
+
</Container>
|
|
165
|
+
<Title title="gutter = xxlarge" theme="light" level={4} />
|
|
166
|
+
<Container>
|
|
167
|
+
<DxcRow gutter="xxlarge">
|
|
168
|
+
<Placeholder></Placeholder>
|
|
169
|
+
<Placeholder></Placeholder>
|
|
170
|
+
<Placeholder></Placeholder>
|
|
171
|
+
</DxcRow>
|
|
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>
|
|
181
|
+
<Title title="gutter = none" theme="light" level={4} />
|
|
182
|
+
<Container>
|
|
183
|
+
<DxcRow gutter="none">
|
|
184
|
+
<Placeholder></Placeholder>
|
|
185
|
+
<Placeholder></Placeholder>
|
|
186
|
+
<Placeholder></Placeholder>
|
|
187
|
+
</DxcRow>
|
|
188
|
+
</Container>
|
|
189
|
+
<Title title="reverse = false" theme="light" level={4} />
|
|
190
|
+
<Container>
|
|
191
|
+
<DxcRow reverse={false}>
|
|
192
|
+
<Placeholder>1</Placeholder>
|
|
193
|
+
<Placeholder>2</Placeholder>
|
|
194
|
+
<Placeholder>3</Placeholder>
|
|
195
|
+
</DxcRow>
|
|
196
|
+
</Container>
|
|
197
|
+
<Title title="reverse = true" theme="light" level={4} />
|
|
198
|
+
<Container>
|
|
199
|
+
<DxcRow reverse={true}>
|
|
200
|
+
<Placeholder>1</Placeholder>
|
|
201
|
+
<Placeholder>2</Placeholder>
|
|
202
|
+
<Placeholder>3</Placeholder>
|
|
203
|
+
</DxcRow>
|
|
204
|
+
</Container>
|
|
205
|
+
<Title title="wrap = true" theme="light" level={4} />
|
|
206
|
+
<Container width={300}>
|
|
207
|
+
<DxcRow wrap={true}>
|
|
208
|
+
<Placeholder>1</Placeholder>
|
|
209
|
+
<Placeholder>2</Placeholder>
|
|
210
|
+
<Placeholder>3</Placeholder>
|
|
211
|
+
</DxcRow>
|
|
212
|
+
</Container>
|
|
213
|
+
<Title title="wrap = false" theme="light" level={4} />
|
|
214
|
+
<Container width={300}>
|
|
215
|
+
<DxcRow wrap={false}>
|
|
216
|
+
<Placeholder>1</Placeholder>
|
|
217
|
+
<Placeholder>2</Placeholder>
|
|
218
|
+
<Placeholder>3</Placeholder>
|
|
219
|
+
</DxcRow>
|
|
220
|
+
</Container>
|
|
221
|
+
</>
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
const Container = styled.div`
|
|
225
|
+
background: #f2eafa;
|
|
226
|
+
padding: 10px;
|
|
227
|
+
width: ${({ width }) => (width ? `${width}px` : "unset")};
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
const Placeholder = styled.div`
|
|
231
|
+
min-height: 40px;
|
|
232
|
+
min-width: 120px;
|
|
233
|
+
border: 1px solid #a46ede;
|
|
234
|
+
background-color: #e5d5f6;
|
|
235
|
+
padding-top: ${({ paddingTop }) => `${paddingTop ?? 0}px`};
|
|
236
|
+
padding-bottom: ${({ paddingBottom }) => `${paddingBottom ?? 0}px`};
|
|
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
|
@@ -21,7 +21,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
26
|
var _variables = require("../common/variables.js");
|
|
27
27
|
|
|
@@ -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) {
|
|
@@ -201,14 +201,12 @@ var getSelectedOption = function getSelectedOption(options, multiple, optional,
|
|
|
201
201
|
var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
202
202
|
var _selectedOption$label;
|
|
203
203
|
|
|
204
|
-
var
|
|
205
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
204
|
+
var label = _ref.label,
|
|
206
205
|
_ref$name = _ref.name,
|
|
207
206
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
208
207
|
value = _ref.value,
|
|
209
208
|
options = _ref.options,
|
|
210
|
-
|
|
211
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
209
|
+
helperText = _ref.helperText,
|
|
212
210
|
_ref$placeholder = _ref.placeholder,
|
|
213
211
|
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
214
212
|
_ref$disabled = _ref.disabled,
|
|
@@ -221,8 +219,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
221
219
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
222
220
|
onChange = _ref.onChange,
|
|
223
221
|
onBlur = _ref.onBlur,
|
|
224
|
-
|
|
225
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
222
|
+
error = _ref.error,
|
|
226
223
|
margin = _ref.margin,
|
|
227
224
|
_ref$size = _ref.size,
|
|
228
225
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
@@ -549,13 +546,14 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
549
546
|
margin: margin,
|
|
550
547
|
size: size,
|
|
551
548
|
ref: ref
|
|
552
|
-
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
549
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
553
550
|
id: selectLabelId,
|
|
554
551
|
disabled: disabled,
|
|
555
552
|
onClick: function onClick() {
|
|
556
553
|
selectContainerRef.current.focus();
|
|
557
|
-
}
|
|
558
|
-
|
|
554
|
+
},
|
|
555
|
+
helperText: helperText
|
|
556
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
559
557
|
disabled: disabled
|
|
560
558
|
}, helperText), /*#__PURE__*/_react["default"].createElement(Select, {
|
|
561
559
|
id: selectId,
|
|
@@ -585,8 +583,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
585
583
|
},
|
|
586
584
|
onClick: handleClearOptionsActionOnClick,
|
|
587
585
|
tabIndex: -1,
|
|
588
|
-
title: "Clear
|
|
589
|
-
"aria-label": "Clear
|
|
586
|
+
title: "Clear selection",
|
|
587
|
+
"aria-label": "Clear selection"
|
|
590
588
|
}, selectIcons.clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
591
589
|
name: name,
|
|
592
590
|
value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(", ") : value !== null && value !== void 0 ? value : innerValue,
|
|
@@ -615,8 +613,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
615
613
|
},
|
|
616
614
|
onClick: handleClearSearchActionOnClick,
|
|
617
615
|
tabIndex: -1,
|
|
618
|
-
title: "Clear search
|
|
619
|
-
"aria-label": "Clear search
|
|
616
|
+
title: "Clear search",
|
|
617
|
+
"aria-label": "Clear search"
|
|
620
618
|
}, selectIcons.clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
621
619
|
disabled: disabled
|
|
622
620
|
}, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && /*#__PURE__*/_react["default"].createElement(OptionsList, {
|
|
@@ -633,7 +631,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
633
631
|
}, 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, {
|
|
634
632
|
option: optionalEmptyOption,
|
|
635
633
|
index: 0
|
|
636
|
-
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
|
|
634
|
+
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
|
|
637
635
|
});
|
|
638
636
|
|
|
639
637
|
var sizes = {
|
|
@@ -661,7 +659,7 @@ var SelectContainer = _styledComponents["default"].div(_templateObject || (_temp
|
|
|
661
659
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
662
660
|
});
|
|
663
661
|
|
|
664
|
-
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n"])), function (props) {
|
|
662
|
+
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n ", "\n"])), function (props) {
|
|
665
663
|
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
666
664
|
}, function (props) {
|
|
667
665
|
return props.theme.fontFamily;
|
|
@@ -673,13 +671,15 @@ var Label = _styledComponents["default"].span(_templateObject2 || (_templateObje
|
|
|
673
671
|
return props.theme.labelFontWeight;
|
|
674
672
|
}, function (props) {
|
|
675
673
|
return props.theme.labelLineHeight;
|
|
674
|
+
}, function (props) {
|
|
675
|
+
return !props.helperText && "margin-bottom: 0.25rem";
|
|
676
676
|
});
|
|
677
677
|
|
|
678
678
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
679
679
|
return props.theme.optionalLabelFontWeight;
|
|
680
680
|
});
|
|
681
681
|
|
|
682
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
682
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
683
683
|
return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
|
|
684
684
|
}, function (props) {
|
|
685
685
|
return props.theme.fontFamily;
|
|
@@ -693,9 +693,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
693
693
|
return props.theme.helperTextLineHeight;
|
|
694
694
|
});
|
|
695
695
|
|
|
696
|
-
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n
|
|
697
|
-
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
698
|
-
}, function (props) {
|
|
696
|
+
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n outline: none;\n ", ";\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
699
697
|
return props.disabled && "background-color: ".concat(props.theme.disabledInputBackgroundColor);
|
|
700
698
|
}, function (props) {
|
|
701
699
|
return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
|
|
@@ -773,7 +771,7 @@ var ErrorIcon = _styledComponents["default"].span(_templateObject13 || (_templat
|
|
|
773
771
|
return props.theme.errorIconColor;
|
|
774
772
|
});
|
|
775
773
|
|
|
776
|
-
var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n"])), function (props) {
|
|
774
|
+
var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
777
775
|
return props.theme.errorMessageColor;
|
|
778
776
|
}, function (props) {
|
|
779
777
|
return props.theme.fontFamily;
|
|
@@ -0,0 +1,170 @@
|
|
|
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 SVG = React.SVGProps<SVGSVGElement>;
|
|
10
|
+
declare type OptionGroup = {
|
|
11
|
+
/**
|
|
12
|
+
* Label of the group to be shown in the select's listbox.
|
|
13
|
+
*/
|
|
14
|
+
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of the grouped options.
|
|
17
|
+
*/
|
|
18
|
+
options: Option[];
|
|
19
|
+
};
|
|
20
|
+
declare type Option = {
|
|
21
|
+
/**
|
|
22
|
+
* Element used as the icon that will be placed before the option label.
|
|
23
|
+
* It can be a url of an image or an inline SVG. If the url option
|
|
24
|
+
* is the chosen one, take into account that the component's
|
|
25
|
+
* color styling tokens will not be applied to the image.
|
|
26
|
+
*/
|
|
27
|
+
icon?: string | SVG;
|
|
28
|
+
/**
|
|
29
|
+
* Label of the option to be shown in the select's listbox.
|
|
30
|
+
*/
|
|
31
|
+
label: string;
|
|
32
|
+
/**
|
|
33
|
+
* Value of the option. It should be unique and
|
|
34
|
+
* not an empty string, which is reserved to the empty option added
|
|
35
|
+
* by optional prop.
|
|
36
|
+
*/
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
declare type CommonProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Text to be placed above the select.
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Name attribute of the input element. This attribute will allow users
|
|
46
|
+
* to find the component's value during the submit event. In this event,
|
|
47
|
+
* the component's value will always be a regular string, for both single
|
|
48
|
+
* and multiple selection modes, been in the first one a single option
|
|
49
|
+
* value and in the multiple variant more than one option value,
|
|
50
|
+
* separated by commas.
|
|
51
|
+
*/
|
|
52
|
+
name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* An array of objects representing the selectable options.
|
|
55
|
+
*/
|
|
56
|
+
options?: Option[] | OptionGroup[];
|
|
57
|
+
/**
|
|
58
|
+
* Helper text to be placed above the select.
|
|
59
|
+
*/
|
|
60
|
+
helperText?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Text to be put as placeholder of the select.
|
|
63
|
+
*/
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
/**
|
|
66
|
+
* If true, the component will be disabled.
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If true, the select will be optional, showing '(Optional)'
|
|
71
|
+
* next to the label and adding a default first option with an empty string as value,
|
|
72
|
+
* been the placeholder (if defined) its label. Otherwise, the field will be
|
|
73
|
+
* considered required and an error will be passed as a parameter to the
|
|
74
|
+
* OnBlur and onChange functions if an option wasn't selected.
|
|
75
|
+
*/
|
|
76
|
+
optional?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* If true, enables search functionality.
|
|
79
|
+
*/
|
|
80
|
+
searchable?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* If it is defined, the component will change its appearance, showing
|
|
83
|
+
* the error below the select component. If it is not defined, the error
|
|
84
|
+
* messages will be managed internally, but never displayed on its own.
|
|
85
|
+
*/
|
|
86
|
+
error?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
89
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
90
|
+
*/
|
|
91
|
+
margin?: Space | Margin;
|
|
92
|
+
/**
|
|
93
|
+
* Size of the component.
|
|
94
|
+
*/
|
|
95
|
+
size?: "small" | "medium" | "large" | "fillParent";
|
|
96
|
+
/**
|
|
97
|
+
* Value of the tabindex attribute.
|
|
98
|
+
*/
|
|
99
|
+
tabIndex?: number;
|
|
100
|
+
};
|
|
101
|
+
declare type SingleSelect = CommonProps & {
|
|
102
|
+
/**
|
|
103
|
+
* If true, the select component will support multiple selected options.
|
|
104
|
+
* In that case, value will be an array of strings with each selected
|
|
105
|
+
* option value.
|
|
106
|
+
*/
|
|
107
|
+
multiple?: false;
|
|
108
|
+
/**
|
|
109
|
+
* Value of the select. If undefined, the component will be uncontrolled
|
|
110
|
+
* and the value will be managed internally by the component.
|
|
111
|
+
*/
|
|
112
|
+
value?: string;
|
|
113
|
+
/**
|
|
114
|
+
* This function will be called when the user selects an option.
|
|
115
|
+
* An object including the current value and the error (if the value entered is not valid)
|
|
116
|
+
* will be passed to this function. If there is no error, error will be null.
|
|
117
|
+
*/
|
|
118
|
+
onChange?: (val: {
|
|
119
|
+
value: string;
|
|
120
|
+
error: string;
|
|
121
|
+
}) => void;
|
|
122
|
+
/**
|
|
123
|
+
* This function will be called when the select loses the focus. An
|
|
124
|
+
* object including the value and the error (if the value
|
|
125
|
+
* selected is not valid) will be passed to this function. If there is no error,
|
|
126
|
+
* error will be null.
|
|
127
|
+
*/
|
|
128
|
+
onBlur?: (val: {
|
|
129
|
+
value: string;
|
|
130
|
+
error: string;
|
|
131
|
+
}) => void;
|
|
132
|
+
};
|
|
133
|
+
declare type MultipleSelect = CommonProps & {
|
|
134
|
+
/**
|
|
135
|
+
* If true, the select component will support multiple selected options.
|
|
136
|
+
* In that case, value will be an array of strings with each selected
|
|
137
|
+
* option value.
|
|
138
|
+
*/
|
|
139
|
+
multiple: true;
|
|
140
|
+
/**
|
|
141
|
+
* Value of the select. If undefined, the component will be uncontrolled
|
|
142
|
+
* and the value will be managed internally by the component.
|
|
143
|
+
*/
|
|
144
|
+
value?: string[];
|
|
145
|
+
/**
|
|
146
|
+
* This function will be called when the user selects an option.
|
|
147
|
+
* An object including the current selected values and the error (if the value entered is not valid)
|
|
148
|
+
* will be passed to this function. If there is no error, error will be null.
|
|
149
|
+
*/
|
|
150
|
+
onChange?: (val: {
|
|
151
|
+
value: string[];
|
|
152
|
+
error: string;
|
|
153
|
+
}) => void;
|
|
154
|
+
/**
|
|
155
|
+
* This function will be called when the select loses the focus. An
|
|
156
|
+
* object including the selected values and the error (if the value
|
|
157
|
+
* selected is not valid) will be passed to this function. If there is no error,
|
|
158
|
+
* error will be null.
|
|
159
|
+
*/
|
|
160
|
+
onBlur?: (val: {
|
|
161
|
+
value: string[];
|
|
162
|
+
error: string;
|
|
163
|
+
}) => void;
|
|
164
|
+
};
|
|
165
|
+
declare type Props = SingleSelect | MultipleSelect;
|
|
166
|
+
/**
|
|
167
|
+
* Reference to the component.
|
|
168
|
+
*/
|
|
169
|
+
export declare type RefType = HTMLDivElement;
|
|
170
|
+
export default Props;
|
package/select/types.js
ADDED
package/sidenav/Sidenav.js
CHANGED
|
@@ -17,9 +17,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
17
17
|
|
|
18
18
|
var _variables = require("../common/variables.js");
|
|
19
19
|
|
|
20
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
20
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
21
21
|
|
|
22
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
22
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
23
23
|
|
|
24
24
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
25
|
|