@zohodesk/dot 1.0.0-temp-187.3 → 1.0.0-temp-201
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/.cli/propValidation_report.html +1 -1
- package/README.md +10 -0
- package/es/form/fields/Fields.module.css +1 -1
- package/es/form/fields/RadioField/RadioField.js +69 -6
- package/es/form/fields/RadioField/props/defaultProps.js +1 -0
- package/es/form/fields/RadioField/props/propTypes.js +3 -0
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
- package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
- package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
- package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/es/lookup/header/Search/LookupSearch.module.css +33 -27
- package/es/lookup/header/Search/Search.js +58 -40
- package/es/lookup/header/Search/__tests__/Search.spec.js +67 -1
- package/es/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/es/lookup/header/Search/props/defaultProps.js +3 -1
- package/es/lookup/header/Search/props/propTypes.js +6 -1
- package/es/v1/form/fields/RadioField/RadioField.js +3 -2
- package/lib/form/fields/Fields.module.css +1 -1
- package/lib/form/fields/RadioField/RadioField.js +100 -31
- package/lib/form/fields/RadioField/props/defaultProps.js +1 -0
- package/lib/form/fields/RadioField/props/propTypes.js +3 -0
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
- package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
- package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/lib/lookup/header/Search/LookupSearch.module.css +33 -27
- package/lib/lookup/header/Search/Search.js +76 -66
- package/lib/lookup/header/Search/__tests__/Search.spec.js +65 -0
- package/lib/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/lib/lookup/header/Search/props/defaultProps.js +3 -1
- package/lib/lookup/header/Search/props/propTypes.js +6 -1
- package/lib/v1/form/fields/RadioField/RadioField.js +3 -2
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, cleanup, fireEvent } from '@testing-library/react';
|
|
3
3
|
import Search from "../Search";
|
|
4
|
+
afterEach(cleanup);
|
|
4
5
|
describe('Search', () => {
|
|
5
6
|
test('rendering the defult props', () => {
|
|
6
7
|
const {
|
|
@@ -8,4 +9,69 @@ describe('Search', () => {
|
|
|
8
9
|
} = render( /*#__PURE__*/React.createElement(Search, null));
|
|
9
10
|
expect(asFragment()).toMatchSnapshot();
|
|
10
11
|
});
|
|
12
|
+
test('rendering the search active', () => {
|
|
13
|
+
const {
|
|
14
|
+
asFragment,
|
|
15
|
+
getByRole
|
|
16
|
+
} = render( /*#__PURE__*/React.createElement(Search, null));
|
|
17
|
+
fireEvent.focus(getByRole('textbox'));
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
test('rendering the prop hasSeparator is true', () => {
|
|
21
|
+
const {
|
|
22
|
+
asFragment
|
|
23
|
+
} = render( /*#__PURE__*/React.createElement(Search, {
|
|
24
|
+
hasSeparator: true
|
|
25
|
+
}));
|
|
26
|
+
expect(asFragment()).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
test('rendering the prop hasSeparator is false', () => {
|
|
29
|
+
const {
|
|
30
|
+
asFragment
|
|
31
|
+
} = render( /*#__PURE__*/React.createElement(Search, {
|
|
32
|
+
hasSeparator: false
|
|
33
|
+
}));
|
|
34
|
+
expect(asFragment()).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
test('rendering the renderChildren props via function', () => {
|
|
37
|
+
const options = [{
|
|
38
|
+
value: 'All Fields',
|
|
39
|
+
id: '1'
|
|
40
|
+
}, {
|
|
41
|
+
value: 'Account',
|
|
42
|
+
id: '3'
|
|
43
|
+
}, {
|
|
44
|
+
value: 'Customer Place',
|
|
45
|
+
id: '4'
|
|
46
|
+
}, {
|
|
47
|
+
value: 'Conatct ID',
|
|
48
|
+
id: '5'
|
|
49
|
+
}];
|
|
50
|
+
|
|
51
|
+
function renderChildren(_ref) {
|
|
52
|
+
let {
|
|
53
|
+
value
|
|
54
|
+
} = _ref;
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", null, value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const {
|
|
59
|
+
asFragment
|
|
60
|
+
} = render( /*#__PURE__*/React.createElement(Search, {
|
|
61
|
+
value: "All Fields",
|
|
62
|
+
renderChildren: renderChildren,
|
|
63
|
+
options: options
|
|
64
|
+
}));
|
|
65
|
+
expect(asFragment()).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
test('rendering the customized style search', () => {
|
|
68
|
+
const {
|
|
69
|
+
asFragment
|
|
70
|
+
} = render( /*#__PURE__*/React.createElement(Search, {
|
|
71
|
+
customStyle: {
|
|
72
|
+
wrapper: "searchWrapperClass"
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
expect(asFragment()).toMatchSnapshot();
|
|
76
|
+
});
|
|
11
77
|
});
|
|
@@ -1,13 +1,196 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Search rendering the customized style search 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="wrapper searchWrapperClass borderType
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
flex rowdir vCenter"
|
|
10
|
+
data-id="containerComponent"
|
|
11
|
+
data-selector-id="container"
|
|
12
|
+
data-test-id="containerComponent"
|
|
13
|
+
>
|
|
14
|
+
<div
|
|
15
|
+
class="grow basis shrinkOff"
|
|
16
|
+
data-id="boxComponent"
|
|
17
|
+
data-selector-id="box"
|
|
18
|
+
data-test-id="boxComponent"
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
class="container effect flex rowdir"
|
|
22
|
+
data-id="containerComponent"
|
|
23
|
+
data-selector-id="textBoxIcon"
|
|
24
|
+
data-test-id="containerComponent"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="grow basis shrinkOff"
|
|
28
|
+
data-id="boxComponent"
|
|
29
|
+
data-selector-id="box"
|
|
30
|
+
data-test-id="boxComponent"
|
|
31
|
+
>
|
|
32
|
+
<input
|
|
33
|
+
class=" container small default effect borderColor_default "
|
|
34
|
+
data-a11y-autofocus="true"
|
|
35
|
+
data-id="textBoxIcon"
|
|
36
|
+
data-selector-id="textBoxIcon"
|
|
37
|
+
data-test-id="textBoxIcon"
|
|
38
|
+
maxlength="250"
|
|
39
|
+
type="text"
|
|
40
|
+
value=""
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<div
|
|
44
|
+
class="iconContainer shrinkOff"
|
|
45
|
+
data-id="boxComponent"
|
|
46
|
+
data-selector-id="box"
|
|
47
|
+
data-test-id="boxComponent"
|
|
48
|
+
>
|
|
49
|
+
<div
|
|
50
|
+
class="flex cover rowdir"
|
|
51
|
+
data-id="containerComponent"
|
|
52
|
+
data-selector-id="container"
|
|
53
|
+
data-test-id="containerComponent"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</DocumentFragment>
|
|
60
|
+
`;
|
|
61
|
+
|
|
3
62
|
exports[`Search rendering the defult props 1`] = `
|
|
4
63
|
<DocumentFragment>
|
|
5
64
|
<div
|
|
6
|
-
class="
|
|
65
|
+
class="wrapper borderType
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
flex rowdir vCenter"
|
|
69
|
+
data-id="containerComponent"
|
|
70
|
+
data-selector-id="container"
|
|
71
|
+
data-test-id="containerComponent"
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
class="grow basis shrinkOff"
|
|
75
|
+
data-id="boxComponent"
|
|
76
|
+
data-selector-id="box"
|
|
77
|
+
data-test-id="boxComponent"
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
class="container effect flex rowdir"
|
|
81
|
+
data-id="containerComponent"
|
|
82
|
+
data-selector-id="textBoxIcon"
|
|
83
|
+
data-test-id="containerComponent"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
class="grow basis shrinkOff"
|
|
87
|
+
data-id="boxComponent"
|
|
88
|
+
data-selector-id="box"
|
|
89
|
+
data-test-id="boxComponent"
|
|
90
|
+
>
|
|
91
|
+
<input
|
|
92
|
+
class=" container small default effect borderColor_default "
|
|
93
|
+
data-a11y-autofocus="true"
|
|
94
|
+
data-id="textBoxIcon"
|
|
95
|
+
data-selector-id="textBoxIcon"
|
|
96
|
+
data-test-id="textBoxIcon"
|
|
97
|
+
maxlength="250"
|
|
98
|
+
type="text"
|
|
99
|
+
value=""
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
<div
|
|
103
|
+
class="iconContainer shrinkOff"
|
|
104
|
+
data-id="boxComponent"
|
|
105
|
+
data-selector-id="box"
|
|
106
|
+
data-test-id="boxComponent"
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
class="flex cover rowdir"
|
|
110
|
+
data-id="containerComponent"
|
|
111
|
+
data-selector-id="container"
|
|
112
|
+
data-test-id="containerComponent"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</DocumentFragment>
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
exports[`Search rendering the prop hasSeparator is false 1`] = `
|
|
122
|
+
<DocumentFragment>
|
|
123
|
+
<div
|
|
124
|
+
class="wrapper borderType
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
flex rowdir vCenter"
|
|
128
|
+
data-id="containerComponent"
|
|
129
|
+
data-selector-id="container"
|
|
130
|
+
data-test-id="containerComponent"
|
|
131
|
+
>
|
|
132
|
+
<div
|
|
133
|
+
class="grow basis shrinkOff"
|
|
134
|
+
data-id="boxComponent"
|
|
135
|
+
data-selector-id="box"
|
|
136
|
+
data-test-id="boxComponent"
|
|
137
|
+
>
|
|
138
|
+
<div
|
|
139
|
+
class="container effect flex rowdir"
|
|
140
|
+
data-id="containerComponent"
|
|
141
|
+
data-selector-id="textBoxIcon"
|
|
142
|
+
data-test-id="containerComponent"
|
|
143
|
+
>
|
|
144
|
+
<div
|
|
145
|
+
class="grow basis shrinkOff"
|
|
146
|
+
data-id="boxComponent"
|
|
147
|
+
data-selector-id="box"
|
|
148
|
+
data-test-id="boxComponent"
|
|
149
|
+
>
|
|
150
|
+
<input
|
|
151
|
+
class=" container small default effect borderColor_default "
|
|
152
|
+
data-a11y-autofocus="true"
|
|
153
|
+
data-id="textBoxIcon"
|
|
154
|
+
data-selector-id="textBoxIcon"
|
|
155
|
+
data-test-id="textBoxIcon"
|
|
156
|
+
maxlength="250"
|
|
157
|
+
type="text"
|
|
158
|
+
value=""
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
<div
|
|
162
|
+
class="iconContainer shrinkOff"
|
|
163
|
+
data-id="boxComponent"
|
|
164
|
+
data-selector-id="box"
|
|
165
|
+
data-test-id="boxComponent"
|
|
166
|
+
>
|
|
167
|
+
<div
|
|
168
|
+
class="flex cover rowdir"
|
|
169
|
+
data-id="containerComponent"
|
|
170
|
+
data-selector-id="container"
|
|
171
|
+
data-test-id="containerComponent"
|
|
172
|
+
/>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</DocumentFragment>
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
exports[`Search rendering the prop hasSeparator is true 1`] = `
|
|
181
|
+
<DocumentFragment>
|
|
182
|
+
<div
|
|
183
|
+
class="wrapper borderType
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
flex rowdir vCenter"
|
|
7
187
|
data-id="containerComponent"
|
|
8
188
|
data-selector-id="container"
|
|
9
189
|
data-test-id="containerComponent"
|
|
10
190
|
>
|
|
191
|
+
<div
|
|
192
|
+
class="separator"
|
|
193
|
+
/>
|
|
11
194
|
<div
|
|
12
195
|
class="grow basis shrinkOff"
|
|
13
196
|
data-id="boxComponent"
|
|
@@ -50,9 +233,139 @@ exports[`Search rendering the defult props 1`] = `
|
|
|
50
233
|
data-test-id="containerComponent"
|
|
51
234
|
/>
|
|
52
235
|
</div>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</DocumentFragment>
|
|
240
|
+
`;
|
|
241
|
+
|
|
242
|
+
exports[`Search rendering the renderChildren props via function 1`] = `
|
|
243
|
+
<DocumentFragment>
|
|
244
|
+
<div
|
|
245
|
+
class="wrapper"
|
|
246
|
+
data-selector-id="toggleDropdown"
|
|
247
|
+
>
|
|
248
|
+
<div
|
|
249
|
+
class="flex rowdir vCenter"
|
|
250
|
+
data-id="containerComponent"
|
|
251
|
+
data-selector-id="container"
|
|
252
|
+
data-test-id="containerComponent"
|
|
253
|
+
>
|
|
254
|
+
<div
|
|
255
|
+
class="wrapper borderType
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
flex rowdir vCenter"
|
|
259
|
+
data-id="containerComponent"
|
|
260
|
+
data-selector-id="container"
|
|
261
|
+
data-test-id="containerComponent"
|
|
262
|
+
>
|
|
263
|
+
<div>
|
|
264
|
+
All Fields
|
|
265
|
+
</div>
|
|
53
266
|
<div
|
|
54
|
-
class="
|
|
55
|
-
|
|
267
|
+
class="grow basis shrinkOff"
|
|
268
|
+
data-id="boxComponent"
|
|
269
|
+
data-selector-id="box"
|
|
270
|
+
data-test-id="boxComponent"
|
|
271
|
+
>
|
|
272
|
+
<div
|
|
273
|
+
class="container effect flex rowdir"
|
|
274
|
+
data-id="containerComponent"
|
|
275
|
+
data-selector-id="textBoxIcon"
|
|
276
|
+
data-test-id="containerComponent"
|
|
277
|
+
>
|
|
278
|
+
<div
|
|
279
|
+
class="grow basis shrinkOff"
|
|
280
|
+
data-id="boxComponent"
|
|
281
|
+
data-selector-id="box"
|
|
282
|
+
data-test-id="boxComponent"
|
|
283
|
+
>
|
|
284
|
+
<input
|
|
285
|
+
class=" container small default effect borderColor_default "
|
|
286
|
+
data-a11y-autofocus="true"
|
|
287
|
+
data-id="textBoxIcon"
|
|
288
|
+
data-selector-id="textBoxIcon"
|
|
289
|
+
data-test-id="textBoxIcon"
|
|
290
|
+
maxlength="250"
|
|
291
|
+
type="text"
|
|
292
|
+
value=""
|
|
293
|
+
/>
|
|
294
|
+
</div>
|
|
295
|
+
<div
|
|
296
|
+
class="iconContainer shrinkOff"
|
|
297
|
+
data-id="boxComponent"
|
|
298
|
+
data-selector-id="box"
|
|
299
|
+
data-test-id="boxComponent"
|
|
300
|
+
>
|
|
301
|
+
<div
|
|
302
|
+
class="flex cover rowdir"
|
|
303
|
+
data-id="containerComponent"
|
|
304
|
+
data-selector-id="container"
|
|
305
|
+
data-test-id="containerComponent"
|
|
306
|
+
/>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
</DocumentFragment>
|
|
314
|
+
`;
|
|
315
|
+
|
|
316
|
+
exports[`Search rendering the search active 1`] = `
|
|
317
|
+
<DocumentFragment>
|
|
318
|
+
<div
|
|
319
|
+
class="wrapper borderType
|
|
320
|
+
active
|
|
321
|
+
focusWidth
|
|
322
|
+
flex rowdir vCenter"
|
|
323
|
+
data-id="containerComponent"
|
|
324
|
+
data-selector-id="container"
|
|
325
|
+
data-test-id="containerComponent"
|
|
326
|
+
>
|
|
327
|
+
<div
|
|
328
|
+
class="grow basis shrinkOff"
|
|
329
|
+
data-id="boxComponent"
|
|
330
|
+
data-selector-id="box"
|
|
331
|
+
data-test-id="boxComponent"
|
|
332
|
+
>
|
|
333
|
+
<div
|
|
334
|
+
class="container effect effectFocused flex rowdir"
|
|
335
|
+
data-id="containerComponent"
|
|
336
|
+
data-selector-id="textBoxIcon"
|
|
337
|
+
data-test-id="containerComponent"
|
|
338
|
+
>
|
|
339
|
+
<div
|
|
340
|
+
class="grow basis shrinkOff"
|
|
341
|
+
data-id="boxComponent"
|
|
342
|
+
data-selector-id="box"
|
|
343
|
+
data-test-id="boxComponent"
|
|
344
|
+
>
|
|
345
|
+
<input
|
|
346
|
+
class=" container small default effect borderColor_default "
|
|
347
|
+
data-a11y-autofocus="true"
|
|
348
|
+
data-id="textBoxIcon"
|
|
349
|
+
data-selector-id="textBoxIcon"
|
|
350
|
+
data-test-id="textBoxIcon"
|
|
351
|
+
maxlength="250"
|
|
352
|
+
type="text"
|
|
353
|
+
value=""
|
|
354
|
+
/>
|
|
355
|
+
</div>
|
|
356
|
+
<div
|
|
357
|
+
class="iconContainer shrinkOff"
|
|
358
|
+
data-id="boxComponent"
|
|
359
|
+
data-selector-id="box"
|
|
360
|
+
data-test-id="boxComponent"
|
|
361
|
+
>
|
|
362
|
+
<div
|
|
363
|
+
class="flex cover rowdir"
|
|
364
|
+
data-id="containerComponent"
|
|
365
|
+
data-selector-id="container"
|
|
366
|
+
data-test-id="containerComponent"
|
|
367
|
+
/>
|
|
368
|
+
</div>
|
|
56
369
|
</div>
|
|
57
370
|
</div>
|
|
58
371
|
</div>
|
|
@@ -6,6 +6,7 @@ export const Search_propTypes = {
|
|
|
6
6
|
onSelect: PropTypes.func,
|
|
7
7
|
options: PropTypes.array,
|
|
8
8
|
selectedId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
9
|
+
renderChildren: PropTypes.func,
|
|
9
10
|
value: PropTypes.string
|
|
10
11
|
};
|
|
11
12
|
export const SearchUI_propTypes = {
|
|
@@ -24,5 +25,9 @@ export const SearchUI_propTypes = {
|
|
|
24
25
|
options: PropTypes.array,
|
|
25
26
|
placeHolder: PropTypes.string,
|
|
26
27
|
searchStr: PropTypes.string,
|
|
27
|
-
title: PropTypes.string
|
|
28
|
+
title: PropTypes.string,
|
|
29
|
+
isActive: PropTypes.bool,
|
|
30
|
+
hasSeparator: PropTypes.bool,
|
|
31
|
+
renderChildren: PropTypes.func,
|
|
32
|
+
customStyle: PropTypes.object
|
|
28
33
|
};
|
|
@@ -81,6 +81,7 @@ const RadioField = props => {
|
|
|
81
81
|
tooltip,
|
|
82
82
|
infoTooltip
|
|
83
83
|
} = option;
|
|
84
|
+
let isDisabledState = disabled || isDisabled;
|
|
84
85
|
let isChecked = selectedValue == value;
|
|
85
86
|
return /*#__PURE__*/React.createElement("span", {
|
|
86
87
|
key: index,
|
|
@@ -93,7 +94,7 @@ const RadioField = props => {
|
|
|
93
94
|
labelPalette: labelPalette,
|
|
94
95
|
labelSize: labelSize,
|
|
95
96
|
active: isActive || isBoxStyle && isChecked,
|
|
96
|
-
disabled:
|
|
97
|
+
disabled: isDisabledState,
|
|
97
98
|
disabledTitle: tooltip,
|
|
98
99
|
title: tooltip,
|
|
99
100
|
onChange: handleChange,
|
|
@@ -109,7 +110,7 @@ const RadioField = props => {
|
|
|
109
110
|
...RadioProps.a11y
|
|
110
111
|
},
|
|
111
112
|
customClass: {
|
|
112
|
-
customRadioWrap:
|
|
113
|
+
customRadioWrap: isBoxStyle ? `${style.radioBox} ${!isDisabledState ? style.hoverableRadioBox : ''} ${isChecked ? style.radioBoxActive : ''}` : '',
|
|
113
114
|
...RadioProps.customClass
|
|
114
115
|
}
|
|
115
116
|
}, !!infoTooltip ? /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -29,6 +29,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
29
|
|
|
30
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
31
|
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
32
38
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
33
39
|
|
|
34
40
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -62,45 +68,98 @@ var RadioField = /*#__PURE__*/function (_PureComponent) {
|
|
|
62
68
|
_classCallCheck(this, RadioField);
|
|
63
69
|
|
|
64
70
|
_this = _super.call(this, props);
|
|
71
|
+
_this.data = {
|
|
72
|
+
radios: {},
|
|
73
|
+
focus: _this.handleFocus
|
|
74
|
+
};
|
|
65
75
|
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
76
|
+
_this.updateData = _this.updateData.bind(_assertThisInitialized(_this));
|
|
77
|
+
_this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
|
|
66
78
|
return _this;
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
_createClass(RadioField, [{
|
|
82
|
+
key: "componentDidMount",
|
|
83
|
+
value: function componentDidMount() {
|
|
84
|
+
var _this$props = this.props,
|
|
85
|
+
getRef = _this$props.getRef,
|
|
86
|
+
id = _this$props.id;
|
|
87
|
+
getRef && getRef(this.data, id);
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "componentDidUpdate",
|
|
91
|
+
value: function componentDidUpdate(prevProps) {
|
|
92
|
+
var _this$props2 = this.props,
|
|
93
|
+
getRef = _this$props2.getRef,
|
|
94
|
+
id = _this$props2.id;
|
|
95
|
+
|
|
96
|
+
if (getRef !== prevProps.getRef) {
|
|
97
|
+
getRef && getRef(this.data, id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "componentWillUnmount",
|
|
102
|
+
value: function componentWillUnmount() {
|
|
103
|
+
var _this$props3 = this.props,
|
|
104
|
+
getRef = _this$props3.getRef,
|
|
105
|
+
id = _this$props3.id;
|
|
106
|
+
getRef && getRef(null, id);
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
70
109
|
key: "handleChange",
|
|
71
110
|
value: function handleChange(value) {
|
|
72
|
-
var _this$
|
|
73
|
-
id = _this$
|
|
74
|
-
onChange = _this$
|
|
111
|
+
var _this$props4 = this.props,
|
|
112
|
+
id = _this$props4.id,
|
|
113
|
+
onChange = _this$props4.onChange;
|
|
75
114
|
onChange && onChange(id, value);
|
|
76
115
|
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "updateData",
|
|
118
|
+
value: function updateData(ele, val) {
|
|
119
|
+
this.data.radios[val] = ele;
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "handleFocus",
|
|
123
|
+
value: function handleFocus() {
|
|
124
|
+
var _this$props5 = this.props,
|
|
125
|
+
selectedValue = _this$props5.selectedValue,
|
|
126
|
+
options = _this$props5.options;
|
|
127
|
+
var firstRadioValue = options[0].value;
|
|
128
|
+
|
|
129
|
+
if (selectedValue) {
|
|
130
|
+
this.data.radios[selectedValue].focus();
|
|
131
|
+
} else {
|
|
132
|
+
this.data.radios[firstRadioValue].focus();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
77
135
|
}, {
|
|
78
136
|
key: "render",
|
|
79
137
|
value: function render() {
|
|
80
138
|
var _this2 = this;
|
|
81
139
|
|
|
82
|
-
var _this$
|
|
83
|
-
labelName = _this$
|
|
84
|
-
id = _this$
|
|
85
|
-
isMandatory = _this$
|
|
86
|
-
options = _this$
|
|
87
|
-
validationMessage = _this$
|
|
88
|
-
validationPalette = _this$
|
|
89
|
-
errorType = _this$
|
|
90
|
-
isDisabled = _this$
|
|
91
|
-
title = _this$
|
|
92
|
-
labelPalette = _this$
|
|
93
|
-
labelSize = _this$
|
|
94
|
-
size = _this$
|
|
95
|
-
selectedValue = _this$
|
|
96
|
-
isActive = _this$
|
|
97
|
-
dataId = _this$
|
|
98
|
-
dataSelectorId = _this$
|
|
99
|
-
validationRuleMessage = _this$
|
|
100
|
-
validationRulePalette = _this$
|
|
101
|
-
isReadOnly = _this$
|
|
102
|
-
|
|
103
|
-
|
|
140
|
+
var _this$props6 = this.props,
|
|
141
|
+
labelName = _this$props6.labelName,
|
|
142
|
+
id = _this$props6.id,
|
|
143
|
+
isMandatory = _this$props6.isMandatory,
|
|
144
|
+
options = _this$props6.options,
|
|
145
|
+
validationMessage = _this$props6.validationMessage,
|
|
146
|
+
validationPalette = _this$props6.validationPalette,
|
|
147
|
+
errorType = _this$props6.errorType,
|
|
148
|
+
isDisabled = _this$props6.isDisabled,
|
|
149
|
+
title = _this$props6.title,
|
|
150
|
+
labelPalette = _this$props6.labelPalette,
|
|
151
|
+
labelSize = _this$props6.labelSize,
|
|
152
|
+
size = _this$props6.size,
|
|
153
|
+
selectedValue = _this$props6.selectedValue,
|
|
154
|
+
isActive = _this$props6.isActive,
|
|
155
|
+
dataId = _this$props6.dataId,
|
|
156
|
+
dataSelectorId = _this$props6.dataSelectorId,
|
|
157
|
+
validationRuleMessage = _this$props6.validationRuleMessage,
|
|
158
|
+
validationRulePalette = _this$props6.validationRulePalette,
|
|
159
|
+
isReadOnly = _this$props6.isReadOnly,
|
|
160
|
+
isBoxStyle = _this$props6.isBoxStyle,
|
|
161
|
+
variant = _this$props6.variant,
|
|
162
|
+
customProps = _this$props6.customProps;
|
|
104
163
|
var _customProps$LabelPro = customProps.LabelProps,
|
|
105
164
|
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro,
|
|
106
165
|
_customProps$RadioPro = customProps.RadioProps,
|
|
@@ -123,7 +182,7 @@ var RadioField = /*#__PURE__*/function (_PureComponent) {
|
|
|
123
182
|
customClass: "".concat(_FieldsModule["default"].fieldLabel, " ").concat(isMandatory ? _FieldsModule["default"].labelMandatory : ''),
|
|
124
183
|
dataId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label")
|
|
125
184
|
}, LabelProps)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
126
|
-
className: "".concat(_FieldsModule["default"].fieldContainer, " ").concat(labelName ? _FieldsModule["default"].fieldMargin_medium : '', " ").concat(_FieldsModule["default"].radioContainer)
|
|
185
|
+
className: "".concat(_FieldsModule["default"].fieldContainer, " ").concat(isBoxStyle ? _FieldsModule["default"].radiosWrapper : '', " ").concat(labelName ? _FieldsModule["default"].fieldMargin_medium : '', " ").concat(_FieldsModule["default"].radioContainer)
|
|
127
186
|
}, options.map(function (option, index) {
|
|
128
187
|
var text = option.text,
|
|
129
188
|
value = option.value,
|
|
@@ -131,9 +190,11 @@ var RadioField = /*#__PURE__*/function (_PureComponent) {
|
|
|
131
190
|
disabled = _option$disabled === void 0 ? false : _option$disabled,
|
|
132
191
|
tooltip = option.tooltip,
|
|
133
192
|
infoTooltip = option.infoTooltip;
|
|
193
|
+
var isDisabledState = disabled || isDisabled;
|
|
194
|
+
var isChecked = selectedValue == value;
|
|
134
195
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
135
196
|
key: index,
|
|
136
|
-
className: "".concat(_FieldsModule["default"].radio)
|
|
197
|
+
className: "".concat(!isBoxStyle ? _FieldsModule["default"].radio : '', " ").concat(_FieldsModule["default"].radioWrap)
|
|
137
198
|
}, /*#__PURE__*/_react["default"].createElement(_Radio["default"], _extends({
|
|
138
199
|
id: index,
|
|
139
200
|
value: value,
|
|
@@ -141,17 +202,25 @@ var RadioField = /*#__PURE__*/function (_PureComponent) {
|
|
|
141
202
|
text: text,
|
|
142
203
|
labelPalette: labelPalette,
|
|
143
204
|
labelSize: labelSize,
|
|
144
|
-
active: isActive,
|
|
145
|
-
disabled:
|
|
205
|
+
active: isActive || isBoxStyle && isChecked,
|
|
206
|
+
disabled: isDisabledState,
|
|
146
207
|
disabledTitle: tooltip,
|
|
147
208
|
title: tooltip,
|
|
148
209
|
onChange: _this2.handleChange,
|
|
210
|
+
getRef: _this2.updateData,
|
|
149
211
|
size: size,
|
|
150
|
-
checked:
|
|
212
|
+
checked: isChecked,
|
|
151
213
|
dataId: dataId,
|
|
152
214
|
isReadOnly: isReadOnly,
|
|
153
215
|
variant: variant
|
|
154
|
-
}, RadioProps
|
|
216
|
+
}, RadioProps, {
|
|
217
|
+
a11y: _objectSpread({
|
|
218
|
+
tabIndex: !!selectedValue ? isChecked ? '0' : '-1' : index === 0 ? '0' : '-1'
|
|
219
|
+
}, RadioProps.a11y),
|
|
220
|
+
customClass: _objectSpread({
|
|
221
|
+
customRadioWrap: isBoxStyle ? "".concat(_FieldsModule["default"].radioBox, " ").concat(!isDisabledState ? _FieldsModule["default"].hoverableRadioBox : '', " ").concat(isChecked ? _FieldsModule["default"].radioBoxActive : '') : ''
|
|
222
|
+
}, RadioProps.customClass)
|
|
223
|
+
}), !!infoTooltip ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], _extends({
|
|
155
224
|
name: "ZD-GN-info",
|
|
156
225
|
size: "16",
|
|
157
226
|
title: infoTooltip,
|