@zohodesk/components 1.0.0-temp-231 → 1.0.0-temp-232
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 +11 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +2 -2
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +3 -0
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +1 -1
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +1 -1
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +1 -1
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +1 -1
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +1 -1
- package/assets/Appearance/light/mode/Component_LightMode.module.css +2 -2
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +3 -0
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +1 -1
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +1 -1
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +1 -1
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +1 -1
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +1 -1
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +2 -2
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +3 -0
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +1 -1
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +1 -1
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +1 -1
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +1 -1
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +1 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +16 -8
- package/es/MultiSelect/AdvancedMultiSelect.js +13 -6
- package/es/MultiSelect/EmptyState.js +2 -1
- package/es/MultiSelect/MultiSelect.js +26 -15
- package/es/MultiSelect/MultiSelectWithAvatar.js +9 -2
- package/es/MultiSelect/SelectedOptions.js +4 -2
- package/es/MultiSelect/Suggestions.js +10 -2
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
- package/es/MultiSelect/__tests__/Suggestions.spec.js +58 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
- package/es/MultiSelect/constants.js +6 -0
- package/es/MultiSelect/props/propTypes.js +15 -55
- package/es/Select/SelectWithIcon.js +1 -1
- package/es/utils/Common.js +1 -1
- package/es/utils/dropDownUtils.js +25 -6
- package/es/v1/Label/Label.js +82 -33
- package/es/v1/Label/css/Label_v1.module.css +47 -0
- package/es/v1/Label/css/cssJSLogic.js +29 -0
- package/es/v1/Label/props/defaultProps.js +8 -10
- package/es/v1/Label/props/propTypes.js +22 -14
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +94 -83
- package/lib/MultiSelect/AdvancedMultiSelect.js +16 -7
- package/lib/MultiSelect/EmptyState.js +3 -1
- package/lib/MultiSelect/MultiSelect.js +28 -15
- package/lib/MultiSelect/MultiSelectWithAvatar.js +11 -3
- package/lib/MultiSelect/SelectedOptions.js +4 -2
- package/lib/MultiSelect/Suggestions.js +10 -2
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +58 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
- package/lib/MultiSelect/constants.js +13 -0
- package/lib/MultiSelect/props/propTypes.js +14 -55
- package/lib/Select/SelectWithIcon.js +1 -1
- package/lib/utils/Common.js +1 -1
- package/lib/utils/dropDownUtils.js +24 -3
- package/lib/v1/Label/Label.js +90 -35
- package/lib/v1/Label/css/Label_v1.module.css +47 -0
- package/lib/v1/Label/css/cssJSLogic.js +31 -0
- package/lib/v1/Label/props/defaultProps.js +10 -12
- package/lib/v1/Label/props/propTypes.js +24 -16
- package/package.json +8 -12
|
@@ -37,11 +37,13 @@ export const MultiSelect_propTypes = {
|
|
|
37
37
|
getRef: PropTypes.func,
|
|
38
38
|
getTargetRef: PropTypes.func,
|
|
39
39
|
i18nKeys: PropTypes.shape({
|
|
40
|
+
searchText: PropTypes.string,
|
|
40
41
|
clearText: PropTypes.string,
|
|
41
42
|
loadingText: PropTypes.string,
|
|
42
43
|
emptyText: PropTypes.string,
|
|
43
44
|
noMoreText: PropTypes.string,
|
|
44
|
-
searchEmptyText: PropTypes.string
|
|
45
|
+
searchEmptyText: PropTypes.string,
|
|
46
|
+
limitReachedMessage: PropTypes.string
|
|
45
47
|
}),
|
|
46
48
|
a11y: PropTypes.shape({
|
|
47
49
|
clearLabel: PropTypes.string
|
|
@@ -116,7 +118,8 @@ export const MultiSelect_propTypes = {
|
|
|
116
118
|
isFocus: PropTypes.bool,
|
|
117
119
|
allowValueFallback: PropTypes.bool,
|
|
118
120
|
renderCustomClearComponent: PropTypes.func,
|
|
119
|
-
renderCustomToggleIndicator: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
|
|
121
|
+
renderCustomToggleIndicator: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
122
|
+
limit: PropTypes.number
|
|
120
123
|
};
|
|
121
124
|
export const MultiSelectHeader_propTypes = {
|
|
122
125
|
dataId: PropTypes.string,
|
|
@@ -153,7 +156,8 @@ export const SelectedOptions_propTypes = {
|
|
|
153
156
|
})),
|
|
154
157
|
size: PropTypes.oneOf(['medium', 'xmedium']),
|
|
155
158
|
palette: PropTypes.string,
|
|
156
|
-
dataId: PropTypes.string
|
|
159
|
+
dataId: PropTypes.string,
|
|
160
|
+
limit: PropTypes.number
|
|
157
161
|
};
|
|
158
162
|
export const Suggestions_propTypes = {
|
|
159
163
|
a11y: PropTypes.shape({
|
|
@@ -183,7 +187,9 @@ export const Suggestions_propTypes = {
|
|
|
183
187
|
logo: PropTypes.string,
|
|
184
188
|
optionType: PropTypes.string,
|
|
185
189
|
listItemProps: PropTypes.object
|
|
186
|
-
}))
|
|
190
|
+
})),
|
|
191
|
+
limit: PropTypes.number,
|
|
192
|
+
limitReachedMessage: PropTypes.string
|
|
187
193
|
};
|
|
188
194
|
export const AdvancedGroupMultiSelect_propTypes = {
|
|
189
195
|
animationStyle: PropTypes.string,
|
|
@@ -201,7 +207,8 @@ export const AdvancedGroupMultiSelect_propTypes = {
|
|
|
201
207
|
loadingText: PropTypes.string,
|
|
202
208
|
emptyText: PropTypes.string,
|
|
203
209
|
noMoreText: PropTypes.string,
|
|
204
|
-
searchEmptyText: PropTypes.string
|
|
210
|
+
searchEmptyText: PropTypes.string,
|
|
211
|
+
limitReachedMessage: PropTypes.string
|
|
205
212
|
}),
|
|
206
213
|
a11y: PropTypes.shape({
|
|
207
214
|
clearLabel: PropTypes.string
|
|
@@ -255,7 +262,8 @@ export const AdvancedGroupMultiSelect_propTypes = {
|
|
|
255
262
|
children: PropTypes.node,
|
|
256
263
|
dataSelectorId: PropTypes.string,
|
|
257
264
|
isFocus: PropTypes.bool,
|
|
258
|
-
allowValueFallback: PropTypes.bool
|
|
265
|
+
allowValueFallback: PropTypes.bool,
|
|
266
|
+
limit: PropTypes.number
|
|
259
267
|
};
|
|
260
268
|
export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
261
269
|
selectedOptionDetails: PropTypes.string,
|
|
@@ -269,68 +277,20 @@ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
|
269
277
|
selectedOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])).isRequired,
|
|
270
278
|
selectedOptionsLimit: PropTypes.number,
|
|
271
279
|
getSelectedOptionDetails: PropTypes.func,
|
|
272
|
-
emptyMessage: PropTypes.string.isRequired,
|
|
273
|
-
isDisabled: PropTypes.bool,
|
|
274
|
-
isReadOnly: PropTypes.bool,
|
|
275
|
-
needLocalSearch: PropTypes.bool,
|
|
276
|
-
needSelectAll: PropTypes.bool,
|
|
277
|
-
onChange: PropTypes.func.isRequired,
|
|
278
|
-
searchEmptyMessage: PropTypes.string,
|
|
279
|
-
placeHolder: PropTypes.string,
|
|
280
|
-
selectAllText: PropTypes.string,
|
|
281
|
-
textField: PropTypes.string,
|
|
282
|
-
valueField: PropTypes.string,
|
|
283
280
|
imageField: PropTypes.string,
|
|
284
281
|
iconName: PropTypes.string,
|
|
285
282
|
prefixText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
286
283
|
//For grouping multiSelect
|
|
287
284
|
optionType: PropTypes.oneOf(['default', 'avatar', 'icon']),
|
|
288
|
-
needEffect: PropTypes.bool,
|
|
289
285
|
secondaryField: PropTypes.string,
|
|
290
|
-
animationStyle: PropTypes.string,
|
|
291
|
-
defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
|
|
292
|
-
dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
293
|
-
isAnimate: PropTypes.bool,
|
|
294
|
-
size: PropTypes.oneOf(['medium', 'xmedium']),
|
|
295
|
-
textBoxSize: PropTypes.oneOf(['small', 'medium', 'xmedium']),
|
|
296
|
-
title: PropTypes.string,
|
|
297
|
-
variant: PropTypes.string,
|
|
298
286
|
dataIdClearIcon: PropTypes.string,
|
|
299
287
|
dataIdLoading: PropTypes.string,
|
|
300
288
|
dataIdMultiSelectComp: PropTypes.string,
|
|
301
289
|
dataIdSelectAllEle: PropTypes.string,
|
|
302
|
-
|
|
303
|
-
/**** Popup Props ****/
|
|
304
|
-
isPopupOpen: PropTypes.bool,
|
|
305
|
-
isPopupReady: PropTypes.bool,
|
|
306
|
-
togglePopup: PropTypes.func,
|
|
307
|
-
getContainerRef: PropTypes.func,
|
|
308
|
-
position: PropTypes.string,
|
|
309
|
-
removeClose: PropTypes.func,
|
|
310
290
|
listItemSize: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
311
|
-
needBorder: PropTypes.bool,
|
|
312
|
-
htmlId: PropTypes.string,
|
|
313
|
-
i18nKeys: PropTypes.shape({
|
|
314
|
-
clearText: PropTypes.string,
|
|
315
|
-
loadingText: PropTypes.string,
|
|
316
|
-
emptyText: PropTypes.string,
|
|
317
|
-
noMoreText: PropTypes.string,
|
|
318
|
-
searchEmptyText: PropTypes.string
|
|
319
|
-
}),
|
|
320
|
-
a11y: PropTypes.shape({
|
|
321
|
-
clearLabel: PropTypes.string
|
|
322
|
-
}),
|
|
323
|
-
borderColor: PropTypes.oneOf(['transparent', 'default', 'dark']),
|
|
324
|
-
isBoxPaddingNeed: PropTypes.bool,
|
|
325
|
-
isSearchClearOnSelect: PropTypes.bool,
|
|
326
|
-
disabledOptions: PropTypes.arrayOf(PropTypes.string),
|
|
327
|
-
getFooter: PropTypes.func,
|
|
328
291
|
customProps: PropTypes.shape({
|
|
329
292
|
SuggestionsProps: PropTypes.object,
|
|
330
293
|
DropBoxProps: PropTypes.object
|
|
331
294
|
}),
|
|
332
|
-
|
|
333
|
-
dataSelectorId: PropTypes.string,
|
|
334
|
-
customClass: PropTypes.object,
|
|
335
|
-
isFocus: PropTypes.bool
|
|
295
|
+
customClass: PropTypes.object
|
|
336
296
|
};
|
|
@@ -193,7 +193,7 @@ class SelectWithIcon extends Component {
|
|
|
193
193
|
} = this.props;
|
|
194
194
|
|
|
195
195
|
if (options.length) {
|
|
196
|
-
datas = options.filter(obj => obj[valueKey].toLowerCase().includes(searchValue.toLowerCase()));
|
|
196
|
+
datas = options.filter(obj => obj[valueKey].toLowerCase().includes(searchValue.toLowerCase().trim()));
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
return datas;
|
package/es/utils/Common.js
CHANGED
|
@@ -376,7 +376,7 @@ export function getElementSpace(elementRef) {
|
|
|
376
376
|
}
|
|
377
377
|
export function getSearchString() {
|
|
378
378
|
let charachers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
379
|
-
return (charachers || '').toString().toLowerCase(); //.replace(/\s+/g, '');
|
|
379
|
+
return (charachers || '').toString().toLowerCase().trim(); //.replace(/\s+/g, '');
|
|
380
380
|
}
|
|
381
381
|
export function findScrollEnd(element) {
|
|
382
382
|
let {
|
|
@@ -7,6 +7,8 @@ export const getOptions = props => props.options || dummyArray;
|
|
|
7
7
|
|
|
8
8
|
const getOptionsOrder = props => props.optionsOrder || dummyArray;
|
|
9
9
|
|
|
10
|
+
const getLimit = props => props.limit || 0;
|
|
11
|
+
|
|
10
12
|
const getSelectedOptionsSel = props => props.selectedOptions || dummyArray;
|
|
11
13
|
|
|
12
14
|
const getSearchStr = props => props.searchStr || '';
|
|
@@ -206,10 +208,10 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
206
208
|
optionsOrder: remvampOptionIds
|
|
207
209
|
};
|
|
208
210
|
});
|
|
209
|
-
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength, getAllowValueFallback], (selectedOptions, normalizedFormatOptions, selectedOptionsLength, allowValueFallback) => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength, getAllowValueFallback, getLimit], (selectedOptions, normalizedFormatOptions, selectedOptionsLength, allowValueFallback, limit) => {
|
|
212
|
+
let output = [];
|
|
213
|
+
let revampSelectedOptions = [];
|
|
214
|
+
let normalizedSelectedOptions = {};
|
|
213
215
|
selectedOptionsLength = !getIsEmptyValue(selectedOptionsLength) ? selectedOptionsLength : selectedOptions.length;
|
|
214
216
|
|
|
215
217
|
for (let i = 0; i < selectedOptionsLength; i++) {
|
|
@@ -234,6 +236,12 @@ export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelect
|
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
238
|
|
|
239
|
+
if (limit && limit > 0) {
|
|
240
|
+
output = output.slice(0, limit);
|
|
241
|
+
revampSelectedOptions = revampSelectedOptions.slice(0, limit);
|
|
242
|
+
normalizedSelectedOptions = Object.fromEntries(Object.entries(normalizedSelectedOptions).slice(0, limit));
|
|
243
|
+
}
|
|
244
|
+
|
|
237
245
|
return {
|
|
238
246
|
formatSelectedOptions: output,
|
|
239
247
|
normalizedSelectedOptions,
|
|
@@ -423,7 +431,8 @@ export const filterSelectedOptions = function () {
|
|
|
423
431
|
let {
|
|
424
432
|
selectedOptions = dummyArray,
|
|
425
433
|
propSelectedOptions = dummyArray,
|
|
426
|
-
disabledOptions = dummyArray
|
|
434
|
+
disabledOptions = dummyArray,
|
|
435
|
+
limit
|
|
427
436
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
428
437
|
// eslint-disable-next-line no-param-reassign
|
|
429
438
|
selectedOptions = selectedOptions || dummyArray; // eslint-disable-next-line no-param-reassign
|
|
@@ -445,8 +454,18 @@ export const filterSelectedOptions = function () {
|
|
|
445
454
|
|
|
446
455
|
return true;
|
|
447
456
|
});
|
|
457
|
+
const totalSelectedOptions = [...oldValidSelectedOptions, ...newlyAddedOptions];
|
|
458
|
+
|
|
459
|
+
if (limit && limit > 0) {
|
|
460
|
+
if (totalSelectedOptions.length > limit) {
|
|
461
|
+
return {
|
|
462
|
+
newSelectedOptions: totalSelectedOptions.slice(0, limit)
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
448
467
|
return {
|
|
449
|
-
newSelectedOptions:
|
|
468
|
+
newSelectedOptions: totalSelectedOptions
|
|
450
469
|
};
|
|
451
470
|
};
|
|
452
471
|
export const makeGetIsShowClearIcon = () => createSelector([getSelectedOptionsSel, getDisabledOptions], (selectedOptions, disabledOptions) => {
|
package/es/v1/Label/Label.js
CHANGED
|
@@ -1,40 +1,89 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react'; // props
|
|
2
|
+
|
|
3
|
+
import defaultProps from "./props/defaultProps";
|
|
4
|
+
import { propTypes } from "./props/propTypes"; // methods
|
|
5
|
+
|
|
6
|
+
import cssJSLogic from "./css/cssJSLogic";
|
|
7
|
+
import { mergeStyle } from '@zohodesk/utils'; // component registry
|
|
8
|
+
|
|
9
|
+
import { withComponentRegistrar } from '@zohodesk/dotkit/es/react/ComponentRegistry'; // components
|
|
10
|
+
|
|
11
|
+
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
12
|
+
import Typography from "../../Typography/Typography"; // css
|
|
13
|
+
|
|
14
|
+
import defaultStyle from "./css/Label_v1.module.css";
|
|
15
|
+
|
|
16
|
+
const Label = props => {
|
|
7
17
|
const {
|
|
8
|
-
text,
|
|
9
|
-
type,
|
|
10
|
-
palette,
|
|
11
|
-
size,
|
|
12
|
-
clipped,
|
|
13
18
|
htmlFor,
|
|
14
|
-
title,
|
|
15
19
|
onClick,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
text,
|
|
21
|
+
customId,
|
|
22
|
+
testId,
|
|
23
|
+
customStyle,
|
|
24
|
+
tagAttributes,
|
|
25
|
+
a11yAttributes,
|
|
26
|
+
customProps,
|
|
27
|
+
isRequired,
|
|
28
|
+
isInlineField,
|
|
29
|
+
requiredType,
|
|
30
|
+
shouldHighlightRequired
|
|
22
31
|
} = props;
|
|
23
32
|
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
container: tagAttributes_container,
|
|
34
|
+
label: tagAttributes_label
|
|
35
|
+
} = tagAttributes;
|
|
36
|
+
const {
|
|
37
|
+
container: a11yAttributes_container,
|
|
38
|
+
label: a11yAttributes_label
|
|
39
|
+
} = a11yAttributes;
|
|
40
|
+
const {
|
|
41
|
+
container: customProps_container,
|
|
42
|
+
label: customProps_label
|
|
43
|
+
} = customProps;
|
|
44
|
+
const style = mergeStyle(defaultStyle, customStyle);
|
|
45
|
+
const {
|
|
46
|
+
labelClass,
|
|
47
|
+
requiredClass
|
|
48
|
+
} = cssJSLogic({
|
|
49
|
+
props: { ...props,
|
|
50
|
+
requiredType,
|
|
51
|
+
shouldHighlightRequired,
|
|
52
|
+
isRequired,
|
|
53
|
+
isInlineField
|
|
54
|
+
},
|
|
55
|
+
style
|
|
56
|
+
});
|
|
57
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
58
|
+
$ui_displayMode: "inline",
|
|
59
|
+
$ui_alignItems: "center",
|
|
60
|
+
$tagAttributes_container: {
|
|
61
|
+
'data-selector-id': customId,
|
|
62
|
+
...tagAttributes_container
|
|
63
|
+
},
|
|
64
|
+
$a11yAttributes_container: a11yAttributes_container,
|
|
65
|
+
testId: testId,
|
|
66
|
+
customId: customId,
|
|
67
|
+
...customProps_container
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
69
|
+
$ui_tagName: "label",
|
|
70
|
+
$ui_className: labelClass,
|
|
71
|
+
$i18n_dataTitle: text,
|
|
72
|
+
$tagAttributes_text: {
|
|
73
|
+
htmlFor: htmlFor,
|
|
74
|
+
onClick: onClick,
|
|
75
|
+
...tagAttributes_label
|
|
76
|
+
},
|
|
77
|
+
$a11yAttributes_text: a11yAttributes_label,
|
|
78
|
+
...customProps_label
|
|
79
|
+
}, text), isRequired && requiredType === 'text' ? /*#__PURE__*/React.createElement(Typography, {
|
|
80
|
+
$ui_tagName: "span",
|
|
81
|
+
$ui_className: requiredClass
|
|
82
|
+
}, "(Required)") : '');
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default withComponentRegistrar(Label, {
|
|
86
|
+
name: 'ZDC_Label'
|
|
87
|
+
});
|
|
39
88
|
Label.defaultProps = defaultProps;
|
|
40
89
|
Label.propTypes = propTypes;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.label {
|
|
2
|
+
font-size: var(--zd_font_size14) ;
|
|
3
|
+
color: var(--zdt_v1_label_text);
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dotted {
|
|
8
|
+
composes: dotted from '../../../common/common.module.css';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.required {
|
|
12
|
+
color: var(--zdt_v1_label_mandatory_text);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.asterisk:after {
|
|
16
|
+
content: "*";
|
|
17
|
+
color: var(--zdt_v1_label_mandatory_text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[dir=ltr] .asterisk:after {
|
|
21
|
+
padding-left: var(--zd_size2) ;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[dir=rtl] .asterisk:after {
|
|
25
|
+
padding-right: var(--zd_size2) ;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.requiredTxt {
|
|
29
|
+
color: var(--zdt_v1_label_mandatory_text);
|
|
30
|
+
font-size: var(--zd_font_size14) ;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[dir=ltr] .requiredTxt {
|
|
34
|
+
margin-left: var(--zd_size5) ;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[dir=rtl] .requiredTxt {
|
|
38
|
+
margin-right: var(--zd_size5) ;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[dir=ltr] .inlineField {
|
|
42
|
+
margin-left: var(--zd_size5) ;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[dir=rtl] .inlineField {
|
|
46
|
+
margin-right: var(--zd_size5) ;
|
|
47
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import compileClassNames from '@zohodesk/utils/es/compileClassNames';
|
|
2
|
+
export default function cssJSLogic(_ref) {
|
|
3
|
+
let {
|
|
4
|
+
props,
|
|
5
|
+
style
|
|
6
|
+
} = _ref;
|
|
7
|
+
const {
|
|
8
|
+
clipped,
|
|
9
|
+
requiredType,
|
|
10
|
+
shouldHighlightRequired,
|
|
11
|
+
isRequired,
|
|
12
|
+
isInlineField
|
|
13
|
+
} = props; // const shouldHighlightMandatory = localStorage?.getItem('mandatoryAppearance') === 'true';
|
|
14
|
+
|
|
15
|
+
let labelClass = compileClassNames({
|
|
16
|
+
[style.label]: true,
|
|
17
|
+
[style.dotted]: clipped,
|
|
18
|
+
[style.asterisk]: isRequired && requiredType === 'asterisk',
|
|
19
|
+
[style.required]: isRequired && shouldHighlightRequired,
|
|
20
|
+
[style.inlineField]: isInlineField
|
|
21
|
+
});
|
|
22
|
+
let requiredClass = compileClassNames({
|
|
23
|
+
[style.requiredTxt]: true
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
labelClass,
|
|
27
|
+
requiredClass
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
customClass: '',
|
|
10
|
-
dataSelectorId: 'label'
|
|
1
|
+
export default {
|
|
2
|
+
customProps: {},
|
|
3
|
+
tagAttributes: {},
|
|
4
|
+
a11yAttributes: {},
|
|
5
|
+
customStyle: {},
|
|
6
|
+
shouldHighlightRequired: false,
|
|
7
|
+
isInlineField: false // clipped: true
|
|
8
|
+
|
|
11
9
|
};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
export
|
|
3
|
-
clipped: PropTypes.bool,
|
|
4
|
-
dataId: PropTypes.string,
|
|
5
|
-
dataSelectorId: PropTypes.string,
|
|
2
|
+
export default {
|
|
6
3
|
htmlFor: PropTypes.string,
|
|
7
|
-
onClick: PropTypes.func,
|
|
8
|
-
palette: PropTypes.oneOf(['default', 'primary', 'secondary', 'danger', 'mandatory', 'disable', 'dark']),
|
|
9
|
-
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large']),
|
|
10
4
|
text: PropTypes.string,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
onClick: PropTypes.func,
|
|
6
|
+
// tabIndex: PropTypes.number,
|
|
7
|
+
a11yAttributes: PropTypes.shape({
|
|
8
|
+
container: PropTypes.object,
|
|
9
|
+
label: PropTypes.object
|
|
10
|
+
}),
|
|
11
|
+
tagAttributes: PropTypes.shape({
|
|
12
|
+
container: PropTypes.object,
|
|
13
|
+
label: PropTypes.object
|
|
14
|
+
}),
|
|
15
|
+
customProps: PropTypes.shape({
|
|
16
|
+
container: PropTypes.object,
|
|
17
|
+
label: PropTypes.object
|
|
17
18
|
}),
|
|
18
|
-
|
|
19
|
+
customId: PropTypes.string,
|
|
20
|
+
testId: PropTypes.string,
|
|
21
|
+
customStyle: PropTypes.object,
|
|
22
|
+
requiredType: PropTypes.oneOf(['asterisk', 'text']),
|
|
23
|
+
shouldHighlightRequired: PropTypes.bool,
|
|
24
|
+
// clipped: PropTypes.bool,
|
|
25
|
+
isRequired: PropTypes.bool,
|
|
26
|
+
isInlineField: PropTypes.bool
|
|
19
27
|
};
|