@dxc-technology/halstack-react 0.0.0-e30cba6 → 0.0.0-e832ef8
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/dist/ThemeContext.js +69 -61
- package/dist/V3Textarea/V3Textarea.js +264 -0
- package/dist/alert/Alert.js +5 -5
- package/dist/alert/index.d.ts +51 -0
- package/dist/button/Button.js +1 -1
- package/dist/common/variables.js +341 -139
- package/dist/date/Date.js +10 -12
- package/dist/{new-date/NewDate.js → date-input/DateInput.js} +69 -72
- package/dist/date-input/index.d.ts +95 -0
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +44 -18
- package/dist/footer/Icons.js +77 -0
- package/dist/header/Header.js +80 -49
- package/dist/header/Icons.js +59 -0
- package/dist/input-text/Icons.js +22 -0
- package/dist/input-text/InputText.js +7 -9
- package/dist/layout/ApplicationLayout.js +5 -9
- package/dist/layout/Icons.js +55 -0
- package/dist/link/Link.js +4 -8
- package/dist/main.d.ts +8 -0
- package/dist/main.js +37 -21
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/{number/Number.js → number-input/NumberInput.js} +9 -11
- package/dist/{number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
- package/dist/number-input/index.d.ts +113 -0
- package/dist/paginator/Icons.js +66 -0
- package/dist/paginator/Paginator.js +5 -11
- package/dist/{password/Password.js → password-input/PasswordInput.js} +11 -13
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +1 -1
- package/dist/select/Select.js +122 -158
- package/dist/sidenav/Sidenav.js +6 -4
- package/dist/slider/Slider.js +104 -19
- package/dist/spinner/Spinner.js +217 -54
- package/dist/tag/Tag.js +26 -32
- package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +180 -170
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +227 -122
- package/dist/textarea/index.d.ts +117 -0
- package/dist/toggle-group/ToggleGroup.js +132 -28
- package/dist/upload/Upload.js +3 -3
- package/dist/upload/buttons-upload/ButtonsUpload.js +7 -11
- package/dist/upload/buttons-upload/Icons.js +40 -0
- package/dist/upload/file-upload/FileToUpload.js +26 -21
- package/dist/upload/file-upload/Icons.js +66 -0
- package/dist/upload/readme.md +2 -2
- package/dist/upload/transaction/Icons.js +160 -0
- package/dist/upload/transaction/Transaction.js +11 -38
- package/dist/wizard/Icons.js +65 -0
- package/dist/wizard/Wizard.js +3 -9
- package/package.json +2 -1
- package/test/Date.test.js +48 -44
- package/test/{NewDate.test.js → DateInput.test.js} +66 -27
- package/test/FileInput.test.js +201 -0
- package/test/Footer.test.js +2 -7
- package/test/Header.test.js +5 -10
- package/test/InputText.test.js +24 -16
- package/test/{Number.test.js → NumberInput.test.js} +84 -66
- package/test/Paginator.test.js +1 -1
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +1 -2
- package/test/Select.test.js +40 -17
- package/test/Slider.test.js +9 -17
- package/test/Spinner.test.js +5 -0
- package/test/{NewInputText.test.js → TextInput.test.js} +146 -231
- package/test/Textarea.test.js +193 -0
- package/test/ToggleGroup.test.js +5 -1
- package/test/Upload.test.js +5 -5
- package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo.svg +0 -15
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.svg +0 -8
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/new-textarea/NewTextarea.js +0 -346
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/password/styles.css +0 -3
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/wizard/invalid_icon.svg +0 -5
- package/dist/wizard/valid_icon.svg +0 -5
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/NewTextarea.test.js +0 -201
- package/test/Password.test.js +0 -76
package/dist/select/readme.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# DXC Select Component
|
|
2
|
-
|
|
3
|
-
## Props
|
|
4
|
-
|
|
5
|
-
<table>
|
|
6
|
-
<tr style="background-color: grey">
|
|
7
|
-
<td>Name</td>
|
|
8
|
-
<td>Default</td>
|
|
9
|
-
<td>Description</td>
|
|
10
|
-
</tr>
|
|
11
|
-
<tr>
|
|
12
|
-
<td>options: object[]</td>
|
|
13
|
-
<td><code>[]</code></td>
|
|
14
|
-
<td>An array of objects representing the selectable options. Each object has the following properties:
|
|
15
|
-
<ul>
|
|
16
|
-
<li><b>value</b>: Option inner value</li>
|
|
17
|
-
<li><b>label</b>: Option display value</li>
|
|
18
|
-
<li><b>iconSrc</b>: URL of the icon that will be placed next to the option label</li>
|
|
19
|
-
</ul>
|
|
20
|
-
</td>
|
|
21
|
-
</tr>
|
|
22
|
-
<tr>
|
|
23
|
-
<td>iconPosition: 'before' | 'after'</td>
|
|
24
|
-
<td><code>'before'</code></td>
|
|
25
|
-
<td>In case options include an icon, whether the icon should appear after or before the label.</td>
|
|
26
|
-
</tr>
|
|
27
|
-
<tr>
|
|
28
|
-
<td>value: string | string[]</td>
|
|
29
|
-
<td><code>[]</code></td>
|
|
30
|
-
<td>The key of the selected value/values. If the select component doesn't allow multiple selection, value must be a string. If the select component allows multiple selection, value must be an array of strings</td>
|
|
31
|
-
</tr>
|
|
32
|
-
<tr>
|
|
33
|
-
<td>multiple: boolean</td>
|
|
34
|
-
<td><code>false</code></td>
|
|
35
|
-
<td>If true, the select component will support multiple selection. In that case, value must be an array of strings with the keys of the selected values, otherwise value must be a string.</td>
|
|
36
|
-
</tr>
|
|
37
|
-
<tr>
|
|
38
|
-
<td>label: string</td>
|
|
39
|
-
<td></td>
|
|
40
|
-
<td>Text to be placed next to the select.</td>
|
|
41
|
-
</tr>
|
|
42
|
-
<tr>
|
|
43
|
-
<td>theme: 'light' | 'dark'</td>
|
|
44
|
-
<td><code>'light'</code></td>
|
|
45
|
-
<td>Uses one of the available component themes.</td>
|
|
46
|
-
</tr>
|
|
47
|
-
<tr>
|
|
48
|
-
<td>name: string</td>
|
|
49
|
-
<td></td>
|
|
50
|
-
<td>Name attribute of the input element.</td>
|
|
51
|
-
</tr>
|
|
52
|
-
<tr>
|
|
53
|
-
<td>disabled: boolean</td>
|
|
54
|
-
<td><code>false</code></td>
|
|
55
|
-
<td>If true, the component will be disabled.</td>
|
|
56
|
-
</tr>
|
|
57
|
-
<tr>
|
|
58
|
-
<td>required: boolean</td>
|
|
59
|
-
<td><code>false</code></td>
|
|
60
|
-
<td>If true, a red asterisk will appear before the label to indicate to the user that the field is required.</td>
|
|
61
|
-
</tr>
|
|
62
|
-
<tr>
|
|
63
|
-
<td>disableRipple: boolean</td>
|
|
64
|
-
<td><code>false</code></td>
|
|
65
|
-
<td>If true, the ripple effect will be disabled.</td>
|
|
66
|
-
</tr>
|
|
67
|
-
<tr>
|
|
68
|
-
<td>onChange: function</td>
|
|
69
|
-
<td></td>
|
|
70
|
-
<td>This function will be called every time the selection changes. The string with the key of the selected value will be passed as a parameter to this function. If multiple selection is allowed, an array of keys will be passed</td>
|
|
71
|
-
</tr>
|
|
72
|
-
</table>
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
6
|
-
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
|
|
9
|
-
var _react2 = require("@storybook/react");
|
|
10
|
-
|
|
11
|
-
var _addonActions = require("@storybook/addon-actions");
|
|
12
|
-
|
|
13
|
-
var _addonKnobs = require("@storybook/addon-knobs");
|
|
14
|
-
|
|
15
|
-
var _readme = _interopRequireDefault(require("./readme.md"));
|
|
16
|
-
|
|
17
|
-
var _Slider = _interopRequireDefault(require("./Slider"));
|
|
18
|
-
|
|
19
|
-
var onChange = (0, _addonActions.action)("onChange");
|
|
20
|
-
|
|
21
|
-
onChange.toString = function () {
|
|
22
|
-
return "onChangeHandler";
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var onDragEnd = (0, _addonActions.action)("onDragEnd");
|
|
26
|
-
|
|
27
|
-
onDragEnd.toString = function () {
|
|
28
|
-
return "onDragEnd";
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var onChangeInput = (0, _addonActions.action)("onChangeInput");
|
|
32
|
-
|
|
33
|
-
onChangeInput.toString = function () {
|
|
34
|
-
return "onChangeInputHandler";
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
(0, _react2.storiesOf)("Form Components|Slider", module).add("Component", function () {
|
|
38
|
-
return _react["default"].createElement("div", null, _react["default"].createElement("h3", null, "Light"), _react["default"].createElement("div", null, _react["default"].createElement("p", null, "Slider"), _react["default"].createElement("div", null, _react["default"].createElement(_Slider["default"], {
|
|
39
|
-
minValue: 0,
|
|
40
|
-
maxValue: 100,
|
|
41
|
-
showLimitsValues: true,
|
|
42
|
-
showInput: false,
|
|
43
|
-
name: "input",
|
|
44
|
-
disabled: false,
|
|
45
|
-
required: true,
|
|
46
|
-
theme: "light",
|
|
47
|
-
step: 1,
|
|
48
|
-
marks: false,
|
|
49
|
-
onChange: onChange,
|
|
50
|
-
onDragEnd: onDragEnd,
|
|
51
|
-
onChangeInput: onChangeInput
|
|
52
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", null, "Slider with marks"), _react["default"].createElement(_Slider["default"], {
|
|
53
|
-
minValue: 0,
|
|
54
|
-
maxValue: 50,
|
|
55
|
-
showLimitsValues: true,
|
|
56
|
-
showInput: false,
|
|
57
|
-
name: "input",
|
|
58
|
-
disabled: false,
|
|
59
|
-
required: true,
|
|
60
|
-
theme: "light",
|
|
61
|
-
step: 10,
|
|
62
|
-
marks: true,
|
|
63
|
-
onChange: onChange,
|
|
64
|
-
onDragEnd: onDragEnd,
|
|
65
|
-
onChangeInput: onChangeInput
|
|
66
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", null, "Slider without limit values"), _react["default"].createElement(_Slider["default"], {
|
|
67
|
-
minValue: 0,
|
|
68
|
-
maxValue: 50,
|
|
69
|
-
showLimitsValues: false,
|
|
70
|
-
showInput: false,
|
|
71
|
-
name: "input",
|
|
72
|
-
disabled: false,
|
|
73
|
-
required: true,
|
|
74
|
-
theme: "light",
|
|
75
|
-
step: 10,
|
|
76
|
-
marks: false,
|
|
77
|
-
onChange: onChange,
|
|
78
|
-
onDragEnd: onDragEnd,
|
|
79
|
-
onChangeInput: onChangeInput
|
|
80
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", null, "Slider with limits, input and marks"), _react["default"].createElement(_Slider["default"], {
|
|
81
|
-
minValue: 0,
|
|
82
|
-
maxValue: 50,
|
|
83
|
-
showLimitsValues: true,
|
|
84
|
-
showInput: true,
|
|
85
|
-
name: "input",
|
|
86
|
-
disabled: false,
|
|
87
|
-
required: true,
|
|
88
|
-
theme: "light",
|
|
89
|
-
step: 5,
|
|
90
|
-
marks: true,
|
|
91
|
-
onChange: onChange,
|
|
92
|
-
onDragEnd: onDragEnd,
|
|
93
|
-
onChangeInput: onChangeInput
|
|
94
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", null, "Slider with limits, input, marks and disabled"), _react["default"].createElement(_Slider["default"], {
|
|
95
|
-
minValue: 0,
|
|
96
|
-
maxValue: 50,
|
|
97
|
-
showLimitsValues: true,
|
|
98
|
-
showInput: true,
|
|
99
|
-
name: "input",
|
|
100
|
-
disabled: true,
|
|
101
|
-
required: true,
|
|
102
|
-
theme: "light",
|
|
103
|
-
step: 5,
|
|
104
|
-
marks: true,
|
|
105
|
-
onChange: onChange,
|
|
106
|
-
onDragEnd: onDragEnd,
|
|
107
|
-
onChangeInput: onChangeInput
|
|
108
|
-
}))), _react["default"].createElement("h3", null, "Dark"), _react["default"].createElement("div", {
|
|
109
|
-
style: {
|
|
110
|
-
background: "black"
|
|
111
|
-
}
|
|
112
|
-
}, _react["default"].createElement("p", {
|
|
113
|
-
style: {
|
|
114
|
-
color: "white"
|
|
115
|
-
}
|
|
116
|
-
}, "Slider"), _react["default"].createElement("div", null, _react["default"].createElement(_Slider["default"], {
|
|
117
|
-
minValue: 0,
|
|
118
|
-
maxValue: 100,
|
|
119
|
-
showLimitsValues: true,
|
|
120
|
-
showInput: false,
|
|
121
|
-
name: "input",
|
|
122
|
-
disabled: false,
|
|
123
|
-
required: true,
|
|
124
|
-
theme: "dark",
|
|
125
|
-
step: 1,
|
|
126
|
-
marks: false,
|
|
127
|
-
onChange: onChange,
|
|
128
|
-
onDragEnd: onDragEnd,
|
|
129
|
-
onChangeInput: onChangeInput
|
|
130
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", {
|
|
131
|
-
style: {
|
|
132
|
-
color: "white"
|
|
133
|
-
}
|
|
134
|
-
}, "Slider with marks"), _react["default"].createElement(_Slider["default"], {
|
|
135
|
-
minValue: 0,
|
|
136
|
-
maxValue: 50,
|
|
137
|
-
showLimitsValues: true,
|
|
138
|
-
showInput: false,
|
|
139
|
-
name: "input",
|
|
140
|
-
disabled: false,
|
|
141
|
-
required: true,
|
|
142
|
-
theme: "dark",
|
|
143
|
-
step: 10,
|
|
144
|
-
marks: true,
|
|
145
|
-
onChange: onChange,
|
|
146
|
-
onDragEnd: onDragEnd,
|
|
147
|
-
onChangeInput: onChangeInput
|
|
148
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", {
|
|
149
|
-
style: {
|
|
150
|
-
color: "white"
|
|
151
|
-
}
|
|
152
|
-
}, "Slider without limit values"), _react["default"].createElement(_Slider["default"], {
|
|
153
|
-
minValue: 0,
|
|
154
|
-
maxValue: 50,
|
|
155
|
-
showLimitsValues: false,
|
|
156
|
-
showInput: false,
|
|
157
|
-
name: "input",
|
|
158
|
-
disabled: false,
|
|
159
|
-
required: true,
|
|
160
|
-
theme: "dark",
|
|
161
|
-
step: 10,
|
|
162
|
-
marks: false,
|
|
163
|
-
onChange: onChange,
|
|
164
|
-
onDragEnd: onDragEnd,
|
|
165
|
-
onChangeInput: onChangeInput
|
|
166
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", {
|
|
167
|
-
style: {
|
|
168
|
-
color: "white"
|
|
169
|
-
}
|
|
170
|
-
}, "Slider with limits, input and marks"), _react["default"].createElement(_Slider["default"], {
|
|
171
|
-
minValue: 0,
|
|
172
|
-
maxValue: 50,
|
|
173
|
-
showLimitsValues: true,
|
|
174
|
-
showInput: true,
|
|
175
|
-
name: "input",
|
|
176
|
-
disabled: false,
|
|
177
|
-
required: true,
|
|
178
|
-
theme: "dark",
|
|
179
|
-
step: 5,
|
|
180
|
-
marks: true,
|
|
181
|
-
onChange: onChange,
|
|
182
|
-
onDragEnd: onDragEnd,
|
|
183
|
-
onChangeInput: onChangeInput
|
|
184
|
-
})), _react["default"].createElement("div", null, _react["default"].createElement("p", {
|
|
185
|
-
style: {
|
|
186
|
-
color: "white"
|
|
187
|
-
}
|
|
188
|
-
}, "Slider with limits, input, marks and disabled"), _react["default"].createElement(_Slider["default"], {
|
|
189
|
-
minValue: 0,
|
|
190
|
-
maxValue: 50,
|
|
191
|
-
showLimitsValues: true,
|
|
192
|
-
showInput: true,
|
|
193
|
-
name: "input",
|
|
194
|
-
disabled: true,
|
|
195
|
-
required: true,
|
|
196
|
-
theme: "dark",
|
|
197
|
-
step: 5,
|
|
198
|
-
marks: true,
|
|
199
|
-
onChange: onChange,
|
|
200
|
-
onDragEnd: onDragEnd,
|
|
201
|
-
onChangeInput: onChangeInput
|
|
202
|
-
}))));
|
|
203
|
-
}, {
|
|
204
|
-
notes: {
|
|
205
|
-
markdown: _readme["default"]
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
var knobProps = function knobProps() {
|
|
210
|
-
return {
|
|
211
|
-
minValue: (0, _addonKnobs.number)("minvalue", 0),
|
|
212
|
-
maxValue: (0, _addonKnobs.number)("maxvalue", 100),
|
|
213
|
-
showLimitsValues: (0, _addonKnobs["boolean"])("showLimits", true),
|
|
214
|
-
showInput: (0, _addonKnobs["boolean"])("showInput", true),
|
|
215
|
-
disabled: (0, _addonKnobs["boolean"])("disabled", false),
|
|
216
|
-
theme: (0, _addonKnobs.select)("theme", {
|
|
217
|
-
light: "light",
|
|
218
|
-
dark: "dark"
|
|
219
|
-
}, "light"),
|
|
220
|
-
step: (0, _addonKnobs.number)("step", 1),
|
|
221
|
-
marks: (0, _addonKnobs["boolean"])("marks", false)
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
(0, _react2.storiesOf)("Form Components|Slider", module).add("Knobs example", function () {
|
|
226
|
-
var props = knobProps();
|
|
227
|
-
return _react["default"].createElement("div", {
|
|
228
|
-
style: {
|
|
229
|
-
background: props.theme === "dark" && "black" || "transparent"
|
|
230
|
-
}
|
|
231
|
-
}, _react["default"].createElement(_Slider["default"], (0, _extends2["default"])({}, props, {
|
|
232
|
-
onChange: onChange,
|
|
233
|
-
onDragEnd: onDragEnd,
|
|
234
|
-
onChangeInput: onChangeInput,
|
|
235
|
-
name: "sliderImput"
|
|
236
|
-
})));
|
|
237
|
-
}, {
|
|
238
|
-
notes: {
|
|
239
|
-
markdown: _readme["default"]
|
|
240
|
-
}
|
|
241
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#666666">
|
|
2
|
-
<path fill="none" d="M0 0h24v24H0V0z"/>
|
|
3
|
-
<path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"/>
|
|
4
|
-
</svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"/></svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
2
|
-
<path fill="none" d="M0 0h24v24H0V0z"/>
|
|
3
|
-
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
|
|
2
|
-
<path fill="none" d="M0 0h24v24H0V0z"/>
|
|
3
|
-
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D9D9D9">
|
|
2
|
-
<path fill="none" d="M0 0h24v24H0V0z"/>
|
|
3
|
-
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
|
|
2
|
-
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
|
|
3
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D9D9D9">
|
|
2
|
-
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
|
|
3
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
4
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg id="highlight_off_black_18dp" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
|
|
2
|
-
<path id="Path_2943" data-name="Path 2943" d="M0,0H18V18H0Z" fill="none"/>
|
|
3
|
-
<path id="Path_2944" data-name="Path 2944" d="M10,4a6,6,0,1,0,6,6A6.01,6.01,0,0,0,10,4Zm3,7.945L11.945,13,10,11.06,8.059,13,7,11.945,8.944,10,7,8.059,8.059,7,10,8.944,11.945,7,13,8.059,11.06,10Z" transform="translate(-1.002 -1.002)" fill="#ffe6e9"/>
|
|
4
|
-
<path id="Path_2945" data-name="Path 2945" d="M11.444,6.5,9.5,8.443,7.558,6.5,6.5,7.558,8.443,9.5,6.5,11.444,7.558,12.5,9.5,10.558,11.444,12.5,12.5,11.444,10.558,9.5,12.5,7.558ZM9.5,2A7.5,7.5,0,1,0,17,9.5,7.494,7.494,0,0,0,9.5,2Zm0,13.5a6,6,0,1,1,6-6A6.009,6.009,0,0,1,9.5,15.5Z" transform="translate(-0.501 -0.501)" fill="#d0011b"/>
|
|
5
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg id="check_circle_black_18dp" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
|
|
2
|
-
<path id="Path_2946" data-name="Path 2946" d="M0,0H18V18H0Z" fill="none"/>
|
|
3
|
-
<path id="Path_2947" data-name="Path 2947" d="M9.986,4a5.986,5.986,0,1,0,5.986,5.986A5.994,5.994,0,0,0,9.986,4Zm-1.5,9.727L5.5,10.734,6.551,9.679l1.938,1.93L13.42,6.679l1.055,1.063Z" transform="translate(-0.986 -0.986)" fill="#eafaef" opacity="0.999"/>
|
|
4
|
-
<path id="Path_2948" data-name="Path 2948" d="M9.493,2a7.493,7.493,0,1,0,7.493,7.493A7.5,7.5,0,0,0,9.493,2Zm0,13.487a5.994,5.994,0,1,1,5.994-5.994A6,6,0,0,1,9.493,15.487Zm3.439-9.306L7.994,11.119,6.054,9.186,5,10.242l3,3,5.994-5.994Z" transform="translate(-0.493 -0.493)" fill="#24a148"/>
|
|
5
|
-
</svg>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="496" height="496" viewBox="0 0 496 496">
|
|
2
|
-
<g id="Group_2913" data-name="Group 2913" transform="translate(5286 3925)">
|
|
3
|
-
<path id="Path_2821" data-name="Path 2821" d="M240,0C372.548,0,480,107.452,480,240S372.548,480,240,480,0,372.548,0,240,107.452,0,240,0Z" transform="translate(-5278 -3917)" fill="#f9cfcf"/>
|
|
4
|
-
<path id="times-circle-regular" d="M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm0,448A200,200,0,1,1,456,256,199.945,199.945,0,0,1,256,456ZM357.8,193.8,295.6,256l62.2,62.2a12.011,12.011,0,0,1,0,17l-22.6,22.6a12.011,12.011,0,0,1-17,0L256,295.6l-62.2,62.2a12.011,12.011,0,0,1-17,0l-22.6-22.6a12.011,12.011,0,0,1,0-17L216.4,256l-62.2-62.2a12.011,12.011,0,0,1,0-17l22.6-22.6a12.011,12.011,0,0,1,17,0L256,216.4l62.2-62.2a12.011,12.011,0,0,1,17,0l22.6,22.6a12.011,12.011,0,0,1,0,17Z" transform="translate(-5294 -3933)" fill="#e22"/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/test/NewTextarea.test.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
|
|
4
|
-
import DxcNewTextarea from "../src/new-textarea/NewTextarea";
|
|
5
|
-
|
|
6
|
-
describe("NewTextarea component tests", () => {
|
|
7
|
-
test("Renders with correct label", () => {
|
|
8
|
-
const { getByText } = render(<DxcNewTextarea label="Example label" />);
|
|
9
|
-
expect(getByText("Example label")).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
test("Renders with correct label and helper text", () => {
|
|
12
|
-
const { getByText } = render(<DxcNewTextarea label="Example label" helperText="Example helper text" />);
|
|
13
|
-
expect(getByText("Example label")).toBeTruthy();
|
|
14
|
-
expect(getByText("Example helper text")).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
test("Renders with correct label and optional", () => {
|
|
17
|
-
const { getByText } = render(<DxcNewTextarea label="Example label" helperText="Example helper text" optional />);
|
|
18
|
-
expect(getByText("Example label")).toBeTruthy();
|
|
19
|
-
expect(getByText("(Optional)")).toBeTruthy();
|
|
20
|
-
expect(getByText("Example helper text")).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
test("Renders with correct placeholder", () => {
|
|
23
|
-
const { getByRole } = render(<DxcNewTextarea placeholder="Placeholder" />);
|
|
24
|
-
const input = getByRole("textbox");
|
|
25
|
-
expect(input.getAttribute("placeholder")).toBe("Placeholder");
|
|
26
|
-
});
|
|
27
|
-
test("Renders with error message", () => {
|
|
28
|
-
const { getByText } = render(<DxcNewTextarea error="Error message." />);
|
|
29
|
-
expect(getByText("Error message.")).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
test("Renders with correct default rows", () => {
|
|
32
|
-
const { getByLabelText } = render(<DxcNewTextarea label="Example label" rows={10} />);
|
|
33
|
-
const textarea = getByLabelText("Example label");
|
|
34
|
-
expect(textarea.rows).toBe(10);
|
|
35
|
-
});
|
|
36
|
-
test("Strict mode - Pattern constraint", () => {
|
|
37
|
-
const onChange = jest.fn();
|
|
38
|
-
const onBlur = jest.fn();
|
|
39
|
-
const { getByLabelText, getByText, queryByText } = render(
|
|
40
|
-
<DxcNewTextarea
|
|
41
|
-
label="Example label"
|
|
42
|
-
placeholder="Placeholder"
|
|
43
|
-
onChange={onChange}
|
|
44
|
-
onBlur={onBlur}
|
|
45
|
-
margin={{ left: "medium", right: "medium" }}
|
|
46
|
-
pattern='^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[!&$%&? "]).*$'
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
const textarea = getByLabelText("Example label");
|
|
50
|
-
fireEvent.change(textarea, { target: { value: "pattern test" } });
|
|
51
|
-
fireEvent.blur(textarea);
|
|
52
|
-
expect(getByText("Please match the format requested.")).toBeTruthy();
|
|
53
|
-
fireEvent.change(textarea, { target: { value: "pattern4&" } });
|
|
54
|
-
fireEvent.blur(textarea);
|
|
55
|
-
expect(queryByText("Please match the format requested.")).toBeFalsy();
|
|
56
|
-
});
|
|
57
|
-
test("Strict mode - Length constraint", () => {
|
|
58
|
-
const onChange = jest.fn();
|
|
59
|
-
const onBlur = jest.fn();
|
|
60
|
-
const { getByLabelText, getByText, queryByText } = render(
|
|
61
|
-
<DxcNewTextarea
|
|
62
|
-
label="Example label"
|
|
63
|
-
placeholder="Placeholder"
|
|
64
|
-
onChange={onChange}
|
|
65
|
-
onBlur={onBlur}
|
|
66
|
-
margin={{ left: "medium", right: "medium" }}
|
|
67
|
-
length={{ min: 5, max: 10 }}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
const textarea = getByLabelText("Example label");
|
|
71
|
-
fireEvent.change(textarea, { target: { value: "test" } });
|
|
72
|
-
fireEvent.blur(textarea);
|
|
73
|
-
expect(getByText("Min length 5, max length 10.")).toBeTruthy();
|
|
74
|
-
fireEvent.change(textarea, { target: { value: "test " } });
|
|
75
|
-
fireEvent.blur(textarea);
|
|
76
|
-
expect(queryByText(/Min length /)).toBeFalsy();
|
|
77
|
-
});
|
|
78
|
-
test("Strict mode - Pattern and length constraints", () => {
|
|
79
|
-
const onChange = jest.fn();
|
|
80
|
-
const onBlur = jest.fn();
|
|
81
|
-
const { getByLabelText, getByText, queryByText } = render(
|
|
82
|
-
<DxcNewTextarea
|
|
83
|
-
label="Example label"
|
|
84
|
-
placeholder="Placeholder"
|
|
85
|
-
onChange={onChange}
|
|
86
|
-
onBlur={onBlur}
|
|
87
|
-
margin={{ left: "medium", right: "medium" }}
|
|
88
|
-
pattern='^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[!&$%&? "]).*$'
|
|
89
|
-
length={{ min: 5, max: 10 }}
|
|
90
|
-
/>
|
|
91
|
-
);
|
|
92
|
-
const textarea = getByLabelText("Example label");
|
|
93
|
-
fireEvent.change(textarea, { target: { value: "test" } });
|
|
94
|
-
fireEvent.blur(textarea);
|
|
95
|
-
expect(getByText("Min length 5, max length 10.")).toBeTruthy();
|
|
96
|
-
fireEvent.change(textarea, { target: { value: "test " } });
|
|
97
|
-
fireEvent.blur(textarea);
|
|
98
|
-
expect(getByText("Please match the format requested.")).toBeTruthy();
|
|
99
|
-
fireEvent.change(textarea, { target: { value: "test 4" } });
|
|
100
|
-
fireEvent.blur(textarea);
|
|
101
|
-
expect(queryByText("Please match the format requested.")).toBeFalsy();
|
|
102
|
-
});
|
|
103
|
-
test("Non Strict mode - Pattern constraint", () => {
|
|
104
|
-
const onChange = jest.fn((value) => {
|
|
105
|
-
expect(value).toBe("Example value");
|
|
106
|
-
});
|
|
107
|
-
const onBlur = jest.fn(({ value, error }) => {
|
|
108
|
-
expect(value).toBe("Example value");
|
|
109
|
-
expect(error).toBe("Please match the format requested.");
|
|
110
|
-
});
|
|
111
|
-
const { getByLabelText } = render(
|
|
112
|
-
<DxcNewTextarea
|
|
113
|
-
label="Example label"
|
|
114
|
-
placeholder="Placeholder"
|
|
115
|
-
onChange={onChange}
|
|
116
|
-
onBlur={onBlur}
|
|
117
|
-
margin={{ left: "medium", right: "medium" }}
|
|
118
|
-
pattern='^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[!&$%&? "]).*$'
|
|
119
|
-
/>
|
|
120
|
-
);
|
|
121
|
-
const textarea = getByLabelText("Example label");
|
|
122
|
-
fireEvent.change(textarea, { target: { value: "Example value" } });
|
|
123
|
-
fireEvent.blur(textarea);
|
|
124
|
-
});
|
|
125
|
-
test("Non Strict mode - Length constraint", () => {
|
|
126
|
-
const onChange = jest.fn((value) => {
|
|
127
|
-
expect(value).toBe("Example value");
|
|
128
|
-
});
|
|
129
|
-
const onBlur = jest.fn(({ value, error }) => {
|
|
130
|
-
expect(value).toBe("Example value");
|
|
131
|
-
expect(error).toBe("Min length 5, max length 10.");
|
|
132
|
-
});
|
|
133
|
-
const { getByLabelText } = render(
|
|
134
|
-
<DxcNewTextarea
|
|
135
|
-
label="Example label"
|
|
136
|
-
placeholder="Placeholder"
|
|
137
|
-
onChange={onChange}
|
|
138
|
-
onBlur={onBlur}
|
|
139
|
-
margin={{ left: "medium", right: "medium" }}
|
|
140
|
-
length={{ min: 5, max: 10 }}
|
|
141
|
-
/>
|
|
142
|
-
);
|
|
143
|
-
const textarea = getByLabelText("Example label");
|
|
144
|
-
fireEvent.change(textarea, { target: { value: "Example value" } });
|
|
145
|
-
fireEvent.blur(textarea);
|
|
146
|
-
});
|
|
147
|
-
test("Non Strict mode - Pattern and length constraints", () => {
|
|
148
|
-
const onChange = jest.fn((value) => {
|
|
149
|
-
expect(value).toBe("Example value");
|
|
150
|
-
});
|
|
151
|
-
const onBlur = jest.fn(({ value, error }) => {
|
|
152
|
-
expect(value).toBe("Example value");
|
|
153
|
-
expect(error).toBe("Min length 5, max length 10.");
|
|
154
|
-
});
|
|
155
|
-
const { getByLabelText } = render(
|
|
156
|
-
<DxcNewTextarea
|
|
157
|
-
label="Example label"
|
|
158
|
-
placeholder="Placeholder"
|
|
159
|
-
onChange={onChange}
|
|
160
|
-
onBlur={onBlur}
|
|
161
|
-
margin={{ left: "medium", right: "medium" }}
|
|
162
|
-
length={{ min: 5, max: 10 }}
|
|
163
|
-
/>
|
|
164
|
-
);
|
|
165
|
-
const textarea = getByLabelText("Example label");
|
|
166
|
-
fireEvent.change(textarea, { target: { value: "Example value" } });
|
|
167
|
-
fireEvent.blur(textarea);
|
|
168
|
-
});
|
|
169
|
-
test("onBlur function is called correctly", () => {
|
|
170
|
-
const onBlur = jest.fn();
|
|
171
|
-
const { getByLabelText } = render(<DxcNewTextarea label="Example label" onBlur={onBlur} />);
|
|
172
|
-
const textarea = getByLabelText("Example label");
|
|
173
|
-
fireEvent.change(textarea, { target: { value: "Blur test" } });
|
|
174
|
-
fireEvent.blur(textarea);
|
|
175
|
-
expect(onBlur).toHaveBeenCalled();
|
|
176
|
-
expect(onBlur).toHaveBeenCalledWith({ value: "Blur test", error: null });
|
|
177
|
-
});
|
|
178
|
-
test("Controlled textarea", () => {
|
|
179
|
-
const onChange = jest.fn();
|
|
180
|
-
const onBlur = jest.fn();
|
|
181
|
-
const { getByLabelText } = render(
|
|
182
|
-
<DxcNewTextarea label="Example label" value="Test value" onChange={onChange} onBlur={onBlur} />
|
|
183
|
-
);
|
|
184
|
-
const textarea = getByLabelText("Example label");
|
|
185
|
-
fireEvent.change(textarea, { target: { value: "Controlled test" } });
|
|
186
|
-
expect(onChange).toHaveBeenCalled();
|
|
187
|
-
expect(textarea.value).toBe("Test value");
|
|
188
|
-
fireEvent.blur(textarea);
|
|
189
|
-
expect(onBlur).toHaveBeenCalled();
|
|
190
|
-
expect(onBlur).toHaveBeenCalledWith({ value: "Test value", error: null });
|
|
191
|
-
});
|
|
192
|
-
test("Uncontrolled input", () => {
|
|
193
|
-
const onChange = jest.fn();
|
|
194
|
-
const { getByLabelText } = render(<DxcNewTextarea label="Example label" onChange={onChange} />);
|
|
195
|
-
const textarea = getByLabelText("Example label");
|
|
196
|
-
fireEvent.change(textarea, { target: { value: "Uncontrolled test" } });
|
|
197
|
-
expect(onChange).toHaveBeenCalled();
|
|
198
|
-
expect(onChange).toHaveBeenCalledWith("Uncontrolled test");
|
|
199
|
-
expect(textarea.value).toBe("Uncontrolled test");
|
|
200
|
-
});
|
|
201
|
-
});
|