@zohodesk/components 1.0.0-temp-252.3 → 1.0.0-temp-252.4
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/README.md +4 -3
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +0 -3
- package/assets/Appearance/light/mode/Component_LightMode.module.css +0 -3
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +0 -3
- package/es/Select/Select.js +77 -88
- package/es/Select/Select.module.css +10 -37
- package/es/Select/props/defaultProps.js +1 -2
- package/es/Select/props/propTypes.js +2 -4
- package/es/v1/Button/Button.js +5 -3
- package/es/v1/Button/__tests__/Button.spec.js +5 -2
- package/es/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +8 -1
- package/es/v1/Button/css/cssJSLogic.js +7 -2
- package/es/v1/helpers/colorHelpers/colorHelper.js +8 -5
- package/es/v1/helpers/colorHelpers/paletteUtilities.README.md +30 -30
- package/es/v1/{Button/_shared → shared}/Loader/Loader.js +3 -3
- package/es/v1/{Button/_shared → shared}/Loader/__tests__/Loader.spec.js +1 -1
- package/es/v1/shared/Loader/props/defaultProps.js +5 -0
- package/es/v1/{Button/_shared → shared}/Loader/props/propTypes.js +1 -1
- package/es/v1/{Button/_shared → shared}/SuccessTick/SuccessTick.js +3 -3
- package/es/v1/{Button/_shared → shared}/SuccessTick/__tests__/SuccessTick.spec.js +1 -1
- package/es/v1/shared/SuccessTick/props/defaultProps.js +5 -0
- package/es/v1/{Button/_shared → shared}/SuccessTick/props/propTypes.js +1 -1
- package/lib/Select/Select.js +77 -89
- package/lib/Select/Select.module.css +10 -37
- package/lib/Select/props/defaultProps.js +1 -2
- package/lib/Select/props/propTypes.js +2 -4
- package/lib/v1/Button/Button.js +5 -3
- package/lib/v1/Button/__tests__/Button.spec.js +5 -2
- package/lib/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +8 -1
- package/lib/v1/Button/css/cssJSLogic.js +9 -5
- package/lib/v1/helpers/colorHelpers/colorHelper.js +8 -5
- package/lib/v1/helpers/colorHelpers/paletteUtilities.README.md +30 -30
- package/lib/v1/{Button/_shared → shared}/Loader/Loader.js +5 -5
- package/lib/v1/{Button/_shared → shared}/Loader/__tests__/Loader.spec.js +1 -1
- package/lib/v1/{Button/_shared/SuccessTick → shared/Loader}/props/defaultProps.js +4 -1
- package/lib/v1/{Button/_shared → shared}/Loader/props/propTypes.js +1 -1
- package/lib/v1/{Button/_shared → shared}/SuccessTick/SuccessTick.js +5 -5
- package/lib/v1/{Button/_shared → shared}/SuccessTick/__tests__/SuccessTick.spec.js +1 -1
- package/lib/v1/{Button/_shared/Loader → shared/SuccessTick}/props/defaultProps.js +4 -1
- package/lib/v1/{Button/_shared → shared}/SuccessTick/props/propTypes.js +1 -1
- package/package.json +4 -4
- package/es/v1/Button/_shared/Loader/props/defaultProps.js +0 -4
- package/es/v1/Button/_shared/SuccessTick/props/defaultProps.js +0 -4
- /package/es/v1/{Button/_shared → shared}/Loader/Loader_v1.module.css +0 -0
- /package/es/v1/{Button/_shared → shared}/Loader/__tests__/__snapshots__/Loader.spec.js.snap +0 -0
- /package/es/v1/{Button/_shared → shared}/SuccessTick/SuccessTick_v1.module.css +0 -0
- /package/es/v1/{Button/_shared → shared}/SuccessTick/__tests__/__snapshots__/SuccessTick.spec.js.snap +0 -0
- /package/lib/v1/{Button/_shared → shared}/Loader/Loader_v1.module.css +0 -0
- /package/lib/v1/{Button/_shared → shared}/Loader/__tests__/__snapshots__/Loader.spec.js.snap +0 -0
- /package/lib/v1/{Button/_shared → shared}/SuccessTick/SuccessTick_v1.module.css +0 -0
- /package/lib/v1/{Button/_shared → shared}/SuccessTick/__tests__/__snapshots__/SuccessTick.spec.js.snap +0 -0
package/README.md
CHANGED
|
@@ -4,9 +4,10 @@ Dot UI is a customizable React component library built to deliver a clean, acces
|
|
|
4
4
|
|
|
5
5
|
# 1.6.14
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
-
|
|
9
|
-
|
|
7
|
+
- **v1/Button**
|
|
8
|
+
- `Loader` and `SuccessTick` components moved from `v1/Button/_shared/` to new `v1/shared/` to make them reusable across v1.
|
|
9
|
+
- **colorHelper**
|
|
10
|
+
- Updated `colorHelper` logic to fix text color issues in bg on `onHover` and `isSelected` state combinations.
|
|
10
11
|
|
|
11
12
|
# 1.6.13
|
|
12
13
|
|
|
@@ -258,9 +258,6 @@
|
|
|
258
258
|
/* select */
|
|
259
259
|
--zdt_select_emptystate_text:hsla(217, calc(var(--zd-saturation, 1) * 13.73%), calc(70.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
260
260
|
--zdt_select_disable_text:var(--dot_inputDisable);
|
|
261
|
-
--zdt_select_wrapper_container_border:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.2 + var(--zdc_alpha_low)));
|
|
262
|
-
--zdt_select_wrapper_container_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), 100.00%, 0.03);
|
|
263
|
-
--zdt_select_wrapper_dropdown_bg:hsla(217, calc(var(--zd-saturation, 1) * 23.08%), calc(17.84% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
264
261
|
|
|
265
262
|
/* multiselect */
|
|
266
263
|
--zdt_multiselect_default_border:var(--dot_inputLine);
|
|
@@ -258,9 +258,6 @@
|
|
|
258
258
|
/* select */
|
|
259
259
|
--zdt_select_emptystate_text:hsla(220, calc(var(--zd-saturation, 1) * 10.45%), calc(39.41% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
260
260
|
--zdt_select_disable_text:var(--dot_inputDisable);
|
|
261
|
-
--zdt_select_wrapper_container_border:hsla(218, calc(var(--zd-saturation, 1) * 42.22%), calc(91.18% + var(--zdc_default_inverse_low)), calc(1 + var(--zdc_alpha_low)));
|
|
262
|
-
--zdt_select_wrapper_container_bg:hsla(216, calc(var(--zd-saturation, 1) * 38.46%), 97.45%, 1);
|
|
263
|
-
--zdt_select_wrapper_dropdown_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
264
261
|
|
|
265
262
|
/* multiselect */
|
|
266
263
|
--zdt_multiselect_default_border:var(--dot_inputLine);
|
|
@@ -258,9 +258,6 @@
|
|
|
258
258
|
/* select */
|
|
259
259
|
--zdt_select_emptystate_text:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(60.00% + var(--zdc_default_inverse)), calc(1 + var(--zdc_alpha_high)));
|
|
260
260
|
--zdt_select_disable_text:var(--dot_inputDisable);
|
|
261
|
-
--zdt_select_wrapper_container_border:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(100.00% + var(--zdc_default_inverse_low)), calc( 0.2 + var(--zdc_alpha_low)));
|
|
262
|
-
--zdt_select_wrapper_container_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), 100.00%, 0.03);
|
|
263
|
-
--zdt_select_wrapper_dropdown_bg:hsla(0, calc(var(--zd-saturation, 1) * 0.00%), calc(12.94% + var(--zdc_default)), calc(1 + var(--zdc_alpha_high)));
|
|
264
261
|
|
|
265
262
|
/* multiselect */
|
|
266
263
|
--zdt_multiselect_default_border:var(--dot_inputLine);
|
package/es/Select/Select.js
CHANGED
|
@@ -813,8 +813,7 @@ export class SelectComponent extends Component {
|
|
|
813
813
|
renderCustomSearchClearComponent,
|
|
814
814
|
renderCustomSelectedValue,
|
|
815
815
|
inputFieldLineA11y,
|
|
816
|
-
customClass
|
|
817
|
-
renderCustomDropBoxHeader
|
|
816
|
+
customClass
|
|
818
817
|
} = this.props;
|
|
819
818
|
let {
|
|
820
819
|
TextBoxIcon_i18n,
|
|
@@ -845,8 +844,7 @@ export class SelectComponent extends Component {
|
|
|
845
844
|
} = customProps;
|
|
846
845
|
const {
|
|
847
846
|
dropBox: dropBoxClass = '',
|
|
848
|
-
cardContent: cardContentClass = ''
|
|
849
|
-
customDropBoxHeader: customDropBoxHeaderClass = ''
|
|
847
|
+
cardContent: cardContentClass = ''
|
|
850
848
|
} = customClass;
|
|
851
849
|
const inputFieldLineA11yAttributes = this.getInputFieldLineA11y({
|
|
852
850
|
setAriaId,
|
|
@@ -1023,92 +1021,83 @@ export class SelectComponent extends Component {
|
|
|
1023
1021
|
isRestrictScroll: isRestrictScroll,
|
|
1024
1022
|
portalId: dropBoxPortalId,
|
|
1025
1023
|
customClass: {
|
|
1026
|
-
customDropBox:
|
|
1024
|
+
customDropBox: dropBoxClass
|
|
1027
1025
|
}
|
|
1028
|
-
}, (
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
customClass: `
|
|
1026
|
+
}, isLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
1027
|
+
align: "both",
|
|
1028
|
+
className: style.loader
|
|
1029
|
+
}, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, !getChildren ? /*#__PURE__*/React.createElement(Box, {
|
|
1030
|
+
flexible: true
|
|
1031
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
1032
|
+
onScroll: this.handleScroll
|
|
1033
|
+
}, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
|
|
1034
|
+
className: `${style.search} ${style[size]}`
|
|
1035
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, {
|
|
1036
|
+
a11y: {
|
|
1037
|
+
ariaControls: setAriaId,
|
|
1038
|
+
ariaAutocomplete: 'list',
|
|
1039
|
+
ariaDescribedby: ariaErrorId
|
|
1040
|
+
},
|
|
1041
|
+
inputRef: this.searchInputRef,
|
|
1042
|
+
maxLength: maxLength,
|
|
1043
|
+
onChange: this.handleSearch,
|
|
1044
|
+
onKeyDown: this.handleKeyDown,
|
|
1045
|
+
placeHolder: searchBoxPlaceHolder,
|
|
1046
|
+
size: searchBoxSize,
|
|
1047
|
+
value: searchStr,
|
|
1048
|
+
onClear: this.handleClearSearch,
|
|
1049
|
+
dataId: `${dataId}_search`,
|
|
1050
|
+
i18nKeys: TextBoxIcon_i18n,
|
|
1051
|
+
autoComplete: autoComplete,
|
|
1052
|
+
customProps: {
|
|
1053
|
+
TextBoxProps: DropdownSearchTextBoxProps
|
|
1054
|
+
},
|
|
1055
|
+
renderCustomClearComponent: renderCustomSearchClearComponent
|
|
1056
|
+
}))) : null, /*#__PURE__*/React.createElement(CardContent, {
|
|
1057
|
+
shrink: true,
|
|
1058
|
+
customClass: `
|
|
1062
1059
|
${!tabletMode && dropBoxSize ? style[dropBoxSize] : ''} ${cardContentClass}`,
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1105
|
-
className: `${customDropBoxHeaderClass} ${style.customDropBoxHeaderContainer}`
|
|
1106
|
-
}, renderNode(renderCustomDropBoxHeader, {
|
|
1107
|
-
closePopup: this.handlePopupClose
|
|
1108
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
1109
|
-
className: style.dropdownOptions
|
|
1110
|
-
}, dropdownContent)) : dropdownContent;
|
|
1111
|
-
})());
|
|
1060
|
+
eleRef: this.suggestionContainerRef
|
|
1061
|
+
}, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
|
|
1062
|
+
key: searchStr.trim(),
|
|
1063
|
+
activeId: selectedId,
|
|
1064
|
+
isVirtualizerEnabled: isVirtualizerEnabled,
|
|
1065
|
+
getVirtualizerPublicMethods: this.getVirtualizerPublicMethods,
|
|
1066
|
+
setVirtualizerContainerRefFunction: this.setSuggestionsVirtualizerContainerRefFunction,
|
|
1067
|
+
suggestions: suggestions,
|
|
1068
|
+
getRef: this.suggestionItemRef,
|
|
1069
|
+
hoverOption: hoverIndex,
|
|
1070
|
+
onClick: this.handleChange,
|
|
1071
|
+
onMouseEnter: this.handleMouseEnter,
|
|
1072
|
+
dataId: `${dataId}_Options`,
|
|
1073
|
+
needTick: needTick,
|
|
1074
|
+
needBorder: needListBorder,
|
|
1075
|
+
selectedOptions: [selectedId],
|
|
1076
|
+
className: `${tabletMode ? style.responsivelistItemContainer : style.listItemContainer}`,
|
|
1077
|
+
listItemSize: listItemSize,
|
|
1078
|
+
htmlId: setAriaId,
|
|
1079
|
+
a11y: {
|
|
1080
|
+
ariaParentRole: 'listbox',
|
|
1081
|
+
role: 'option'
|
|
1082
|
+
}
|
|
1083
|
+
}, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
|
|
1084
|
+
isLoading: isFetchingOptions,
|
|
1085
|
+
options: options,
|
|
1086
|
+
searchString: searchStr,
|
|
1087
|
+
suggestions: suggestions,
|
|
1088
|
+
dataId: dataId,
|
|
1089
|
+
renderCustomEmptyState: renderCustomEmptyState,
|
|
1090
|
+
getCustomEmptyState: getCustomEmptyState ? this.handleGetAddNewOptionText : null,
|
|
1091
|
+
i18nKeys: i18nKeys,
|
|
1092
|
+
htmlId: ariaErrorId
|
|
1093
|
+
}), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
|
|
1094
|
+
isCover: false,
|
|
1095
|
+
align: "both"
|
|
1096
|
+
}, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter({
|
|
1097
|
+
closePopup: this.handlePopupClose
|
|
1098
|
+
})) : null)) : /*#__PURE__*/React.createElement(Box, {
|
|
1099
|
+
flexible: true
|
|
1100
|
+
}, getChildren())));
|
|
1112
1101
|
}) : null);
|
|
1113
1102
|
}
|
|
1114
1103
|
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
|
|
23
23
|
.box_small .emptyState {
|
|
24
24
|
padding-block: var(--zd_size12) ;
|
|
25
|
-
padding-inline:
|
|
25
|
+
padding-inline:var(--zd_size6) ;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.box_medium .emptyState {
|
|
29
29
|
padding-block: var(--zd_size12) ;
|
|
30
|
-
padding-inline:
|
|
30
|
+
padding-inline:var(--zd_size15) ;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.hide {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
|
|
46
46
|
.small.search {
|
|
47
47
|
padding-block: 0 ;
|
|
48
|
-
padding-inline:
|
|
48
|
+
padding-inline:var(--zd_size5) ;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.medium.search {
|
|
52
52
|
padding-block: var(--zd_size3) 0 ;
|
|
53
|
-
padding-inline:
|
|
53
|
+
padding-inline:var(--zd_size20) ;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.title {
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
|
|
60
60
|
.groupTitle {
|
|
61
61
|
margin-block: var(--zd_size6) ;
|
|
62
|
-
margin-inline:
|
|
62
|
+
margin-inline:0 ;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.listItemContainer {
|
|
66
66
|
padding-block: var(--zd_size10) ;
|
|
67
|
-
padding-inline:
|
|
67
|
+
padding-inline:0 ;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.responsivelistItemContainer {
|
|
71
71
|
padding-block: var(--zd_size10) 0 ;
|
|
72
|
-
padding-inline:
|
|
72
|
+
padding-inline:0 ;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.readonly {
|
|
@@ -111,19 +111,18 @@
|
|
|
111
111
|
|
|
112
112
|
.dropBoxList {
|
|
113
113
|
padding-block: var(--zd_size10) ;
|
|
114
|
-
padding-inline:
|
|
114
|
+
padding-inline:0 ;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.responsivedropBoxList {
|
|
118
118
|
padding-block: var(--zd_size10) 0 ;
|
|
119
|
-
padding-inline:
|
|
119
|
+
padding-inline:0 ;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
.rotate {
|
|
123
123
|
transform: rotateX(180deg);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
.rightPlaceholder {
|
|
125
|
+
.rightPlaceholder{
|
|
127
126
|
height: 100% ;
|
|
128
127
|
}
|
|
129
128
|
|
|
@@ -142,29 +141,3 @@
|
|
|
142
141
|
.loader {
|
|
143
142
|
padding: var(--zd_size10) ;
|
|
144
143
|
}
|
|
145
|
-
|
|
146
|
-
.dropBoxWithCustomHeader {
|
|
147
|
-
border-radius: 7px;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.dropBoxListContainer {
|
|
151
|
-
width: 100% ;
|
|
152
|
-
border-radius: 7px;
|
|
153
|
-
padding: var(--zd_size10) ;
|
|
154
|
-
border: 1px solid var(--zdt_select_wrapper_container_border);
|
|
155
|
-
background: var(--zdt_select_wrapper_container_bg);
|
|
156
|
-
box-shadow: var(--zd_bs_statusdropdown_wrapper_container);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.dropdownOptions {
|
|
160
|
-
padding-inline: var(--zd_size1) ;
|
|
161
|
-
padding-block: var(--zd_size1) ;
|
|
162
|
-
background-color: var(--zdt_select_wrapper_dropdown_bg);
|
|
163
|
-
border: 1px solid var(--zdt_select_wrapper_container_border);
|
|
164
|
-
border-radius: 7px;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.customDropBoxHeaderContainer {
|
|
168
|
-
margin-block-end: var(--zd_size6) ;
|
|
169
|
-
margin-inline: var(--zd_size1) ;
|
|
170
|
-
}
|
|
@@ -38,8 +38,7 @@ export const Select_defaultProps = {
|
|
|
38
38
|
isAbsolutePositioningNeeded: true,
|
|
39
39
|
allowValueFallback: true,
|
|
40
40
|
inputFieldLineA11y: {},
|
|
41
|
-
customClass: {}
|
|
42
|
-
renderCustomDropBoxHeader: null
|
|
41
|
+
customClass: {}
|
|
43
42
|
};
|
|
44
43
|
export const GroupSelect_defaultProps = {
|
|
45
44
|
animationStyle: 'bounce',
|
|
@@ -107,10 +107,8 @@ export const Select_propTypes = {
|
|
|
107
107
|
inputFieldLineA11y: PropTypes.object,
|
|
108
108
|
customClass: PropTypes.shape({
|
|
109
109
|
dropBox: PropTypes.string,
|
|
110
|
-
cardContent: PropTypes.string
|
|
111
|
-
|
|
112
|
-
}),
|
|
113
|
-
renderCustomDropBoxHeader: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
|
|
110
|
+
cardContent: PropTypes.string
|
|
111
|
+
})
|
|
114
112
|
};
|
|
115
113
|
export const GroupSelect_propTypes = {
|
|
116
114
|
groupedOptions: PropTypes.arrayOf(PropTypes.shape({
|
package/es/v1/Button/Button.js
CHANGED
|
@@ -11,8 +11,8 @@ import propTypes from "./props/propTypes";
|
|
|
11
11
|
import defaultProps from "./props/defaultProps";
|
|
12
12
|
import { DUMMY_OBJECT } from '@zohodesk/dotkit/es/utils/constants';
|
|
13
13
|
import { ICON_PLACEMENT, LOADER_PLACEMENT, STATUS, TYPOGRAPHY_SIZE_MAP, VARIANT } from "./constants";
|
|
14
|
-
import Loader from "
|
|
15
|
-
import SuccessTick from "
|
|
14
|
+
import Loader from "../shared/Loader/Loader";
|
|
15
|
+
import SuccessTick from "../shared/SuccessTick/SuccessTick";
|
|
16
16
|
import cssJSLogic from "./css/cssJSLogic";
|
|
17
17
|
|
|
18
18
|
const getTypographySize = size => TYPOGRAPHY_SIZE_MAP[size] || '13';
|
|
@@ -70,7 +70,8 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
70
70
|
successOverlayClass,
|
|
71
71
|
contentWrapperClass,
|
|
72
72
|
textClassName,
|
|
73
|
-
buttonClassName
|
|
73
|
+
buttonClassName,
|
|
74
|
+
iconClassName
|
|
74
75
|
} = classes;
|
|
75
76
|
const showIcon = variant !== VARIANT.TEXT && (renderIcon || iconName);
|
|
76
77
|
|
|
@@ -134,6 +135,7 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
return /*#__PURE__*/React.createElement(Icon, _extends({}, iconProps, {
|
|
138
|
+
iconClass: iconClassName,
|
|
137
139
|
name: iconName,
|
|
138
140
|
size: iconSize,
|
|
139
141
|
tagAttributes: iconTagAttributes,
|
|
@@ -218,13 +218,16 @@ describe('Button - Component', () => {
|
|
|
218
218
|
}));
|
|
219
219
|
expect(asFragment()).toMatchSnapshot();
|
|
220
220
|
});
|
|
221
|
-
test('Should apply customClass to wrapper and
|
|
221
|
+
test('Should apply customClass to wrapper, text and icon', () => {
|
|
222
222
|
const {
|
|
223
223
|
asFragment
|
|
224
224
|
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
225
|
+
variant: "iconWithText",
|
|
226
|
+
iconName: "ZD-plus",
|
|
225
227
|
customClass: {
|
|
226
228
|
wrapper: 'customButtonClass',
|
|
227
|
-
text: 'customTextClass'
|
|
229
|
+
text: 'customTextClass',
|
|
230
|
+
icon: 'customIconClass'
|
|
228
231
|
}
|
|
229
232
|
}, "Button"));
|
|
230
233
|
expect(asFragment()).toMatchSnapshot();
|
|
@@ -27,7 +27,7 @@ exports[`Button - Component Should apply a11yAttributes to the button 1`] = `
|
|
|
27
27
|
</DocumentFragment>
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
|
-
exports[`Button - Component Should apply customClass to wrapper and
|
|
30
|
+
exports[`Button - Component Should apply customClass to wrapper, text and icon 1`] = `
|
|
31
31
|
<DocumentFragment>
|
|
32
32
|
<button
|
|
33
33
|
aria-busy="false"
|
|
@@ -42,6 +42,13 @@ exports[`Button - Component Should apply customClass to wrapper and text 1`] = `
|
|
|
42
42
|
data-id="flex"
|
|
43
43
|
data-test-id="flex"
|
|
44
44
|
>
|
|
45
|
+
<i
|
|
46
|
+
aria-hidden="true"
|
|
47
|
+
class="zd_font_icons basic icon-plus customIconClass "
|
|
48
|
+
data-id="fontIcon"
|
|
49
|
+
data-selector-id="fontIcon"
|
|
50
|
+
style="--zd-iconfont-size: var(--zd_font_size16);"
|
|
51
|
+
/>
|
|
45
52
|
<div
|
|
46
53
|
class="dotted size13 customTextClass"
|
|
47
54
|
>
|
|
@@ -31,7 +31,8 @@ export default function cssJSLogic(_ref) {
|
|
|
31
31
|
} = props;
|
|
32
32
|
const {
|
|
33
33
|
wrapper: wrapperClass = '',
|
|
34
|
-
text: textClassCustom = ''
|
|
34
|
+
text: textClassCustom = '',
|
|
35
|
+
icon: iconClassCustom = ''
|
|
35
36
|
} = customClass;
|
|
36
37
|
const isLoading = status === STATUS.LOADING;
|
|
37
38
|
const isSuccess = status === STATUS.SUCCESS;
|
|
@@ -86,11 +87,15 @@ export default function cssJSLogic(_ref) {
|
|
|
86
87
|
const textClassName = compileClassNames({
|
|
87
88
|
[textClassCustom]: !!textClassCustom
|
|
88
89
|
});
|
|
90
|
+
const iconClassName = compileClassNames({
|
|
91
|
+
[iconClassCustom]: !!iconClassCustom
|
|
92
|
+
});
|
|
89
93
|
return {
|
|
90
94
|
buttonClassName,
|
|
91
95
|
textClassName,
|
|
92
96
|
contentWrapperClass: overlayActive ? style.overlayHidden : style.contentWrapper,
|
|
93
97
|
loaderOverlayClass: style.loaderOverlay,
|
|
94
|
-
successOverlayClass: style.successOverlay
|
|
98
|
+
successOverlayClass: style.successOverlay,
|
|
99
|
+
iconClassName
|
|
95
100
|
};
|
|
96
101
|
}
|
|
@@ -117,7 +117,7 @@ const buildPaletteClasses = (config, _ref4) => {
|
|
|
117
117
|
}) : '',
|
|
118
118
|
text: isSelected ? getTextClass({
|
|
119
119
|
state: 'selected',
|
|
120
|
-
textTone: baseTextTone
|
|
120
|
+
textTone: hasBgState ? stateTextTone : baseTextTone
|
|
121
121
|
}) : getTextClass({
|
|
122
122
|
textTone: baseTextTone
|
|
123
123
|
}),
|
|
@@ -133,11 +133,14 @@ const buildPaletteClasses = (config, _ref4) => {
|
|
|
133
133
|
state: 'active',
|
|
134
134
|
textTone: stateTextTone
|
|
135
135
|
}),
|
|
136
|
-
border: isSelected ? getBorderClass({
|
|
136
|
+
border: isSelected ? !hasBorderState ? getBorderClass({
|
|
137
|
+
tone: 'transparent'
|
|
138
|
+
}) : getBorderClass({
|
|
137
139
|
state: 'selected',
|
|
138
|
-
tone
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
tone
|
|
141
|
+
}) : hasTransparentBorder ? getBorderClass({
|
|
142
|
+
tone: 'transparent'
|
|
143
|
+
}) : getBorderClass({
|
|
141
144
|
tone,
|
|
142
145
|
isLighter
|
|
143
146
|
}),
|
|
@@ -71,7 +71,7 @@ Per color (`default`, `grey`, `blue`, `green`, `orange`, `red`, `yellow`):
|
|
|
71
71
|
| `.active\:text-{color}:active` | Active state |
|
|
72
72
|
| `.selected\:text-{color}` | Selected state |
|
|
73
73
|
|
|
74
|
-
**Special:** `.text-
|
|
74
|
+
**Special:** `.text-brand-filled` (+ hover/focus/active/selected) — uses `--zdt_v1_palette_default_filled_text` for filled default backgrounds.
|
|
75
75
|
|
|
76
76
|
**Utility classes:** `.text-transparent`, `.text-white`, `.text-black`
|
|
77
77
|
|
|
@@ -204,7 +204,7 @@ Returns a text CSS class from `textColor.module.css`.
|
|
|
204
204
|
|
|
205
205
|
| Parameter | Type | Required | Description |
|
|
206
206
|
|-----------|------|----------|-------------|
|
|
207
|
-
| `textTone` | `string` | Yes | Text tone (`
|
|
207
|
+
| `textTone` | `string` | Yes | Text tone (`brand`, `grey`, `blue`, `green`, `orange`, `red`, `yellow`, `white`, `black`, `brand-filled`) |
|
|
208
208
|
| `state` | `string` | No | State prefix (`hover`, `focus`, `active`, `selected`). Omit for base class. |
|
|
209
209
|
|
|
210
210
|
> **Note:** `textTone` has no `isLighter` equivalent. Use `filledTextTone` (e.g. `white`) directly when needed.
|
|
@@ -214,7 +214,7 @@ Returns a text CSS class from `textColor.module.css`.
|
|
|
214
214
|
```javascript
|
|
215
215
|
getTextClass({ textTone: 'green' }) // → paletteTextStyle['text-green']
|
|
216
216
|
getTextClass({ state: 'hover', textTone: 'white' }) // → paletteTextStyle['hover:text-white']
|
|
217
|
-
getTextClass({ textTone: '
|
|
217
|
+
getTextClass({ textTone: 'brand-filled' }) // → paletteTextStyle['text-brand-filled']
|
|
218
218
|
```
|
|
219
219
|
|
|
220
220
|
#### `getBorderClass({ state?, tone, isLighter? })`
|
|
@@ -254,7 +254,7 @@ import getPaletteClasses from './colorHelper';
|
|
|
254
254
|
|
|
255
255
|
| Palette | Tone (bg/border) | Text Tone | Filled Text Tone |
|
|
256
256
|
|---------|-------------------|-----------|-------------------|
|
|
257
|
-
| `default` | `
|
|
257
|
+
| `default` | `brand` | `brand` | `brand-filled` |
|
|
258
258
|
| `primary` | `blue` | `blue` | `white` |
|
|
259
259
|
| `secondary` | `grey` | `grey` | `white` |
|
|
260
260
|
| `danger` | `red` | `red` | `white` |
|
|
@@ -267,7 +267,8 @@ Unknown palettes return `DUMMY_OBJECT` (empty frozen object).
|
|
|
267
267
|
| Parameter | Values | Effect |
|
|
268
268
|
|-----------|--------|--------|
|
|
269
269
|
| `palette` | `default` \| `primary` \| `secondary` \| `danger` \| `success` | Selects the color tone config from `PALETTE_CONFIG` |
|
|
270
|
-
| `bgAppearance` | `'none'` \| `'
|
|
270
|
+
| `bgAppearance` | `'none'` \| `'default'` \| other | `'default'` → base bg + state bg; `'none'` → no bg, no state bg, no filled text logic; other → no base bg but state bg + filled text logic |
|
|
271
|
+
| `isSelected` | `boolean` | `true` → folds selected-state classes into `bg`, `text`, and `border` (replaces their resting values with the `selected` state class) |
|
|
271
272
|
| `borderAppearance` | `'none'` \| `'onHover'` \| other | `'none'` → transparent base, no state borders; `'onHover'` → transparent base, with state borders; other → visible base + state borders |
|
|
272
273
|
| `paletteShade` | `'lighter'` \| other | `'lighter'` → `-light` variant for bg and base border; also keeps text as `textTone` instead of `filledTextTone` |
|
|
273
274
|
|
|
@@ -277,33 +278,30 @@ The text color depends on both `bgAppearance` and `paletteShade`:
|
|
|
277
278
|
|
|
278
279
|
| Condition | Base text (`text`) | State text (`hoverText`, etc.) |
|
|
279
280
|
|---|---|---|
|
|
280
|
-
| `bgAppearance: '
|
|
281
|
-
| `bgAppearance: '
|
|
281
|
+
| `bgAppearance: 'default'` + default shade | `filledTextTone` (e.g. `white`) | `filledTextTone` |
|
|
282
|
+
| `bgAppearance: 'default'` + `'lighter'` shade | `textTone` (e.g. `blue`) | `textTone` |
|
|
282
283
|
| `bgAppearance:` other (not `'none'`) + default shade | `textTone` | `filledTextTone` |
|
|
283
284
|
| `bgAppearance:` other (not `'none'`) + `'lighter'` shade | `textTone` | `textTone` |
|
|
284
285
|
| `bgAppearance: 'none'` | `textTone` | `textTone` |
|
|
285
286
|
|
|
286
|
-
> **Key insight:** `baseTextTone = isFilledBg && !isLighter ? filledTextTone : textTone`. `stateTextTone = hasBgState && !isLighter ? filledTextTone : textTone`. This means state text can differ from base text when `bgAppearance` is not `'
|
|
287
|
+
> **Key insight:** `baseTextTone = isFilledBg && !isLighter ? filledTextTone : textTone`. `stateTextTone = hasBgState && !isLighter ? filledTextTone : textTone`. This means state text can differ from base text when `bgAppearance` is not `'default'` but also not `'none'`.
|
|
287
288
|
|
|
288
289
|
#### Return Value
|
|
289
290
|
|
|
290
291
|
```javascript
|
|
291
292
|
{
|
|
292
|
-
bg,
|
|
293
|
-
hoverBg,
|
|
294
|
-
focusBg,
|
|
295
|
-
activeBg,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
focusBorder, // getBorderClass({ state: 'focus', tone }) — if borderAppearance !== 'none'
|
|
305
|
-
activeBorder, // getBorderClass({ state: 'active', tone }) — if borderAppearance !== 'none'
|
|
306
|
-
selectedBorder // getBorderClass({ state: 'selected', tone }) — if borderAppearance !== 'none'
|
|
293
|
+
bg, // isSelected → selected bg (if bgAppearance !== 'none'); else base bg (only if bgAppearance === 'default')
|
|
294
|
+
hoverBg, // getBgClass({ state: 'hover', tone, isLighter }) — if bgAppearance !== 'none'
|
|
295
|
+
focusBg, // getBgClass({ state: 'focus', tone, isLighter }) — if bgAppearance !== 'none'
|
|
296
|
+
activeBg, // getBgClass({ state: 'active', tone, isLighter }) — if bgAppearance !== 'none'
|
|
297
|
+
text, // isSelected → selected text class; else getTextClass({ textTone: baseTextTone })
|
|
298
|
+
hoverText, // getTextClass({ state: 'hover', textTone: stateTextTone })
|
|
299
|
+
focusText, // getTextClass({ state: 'focus', textTone: stateTextTone })
|
|
300
|
+
activeText, // getTextClass({ state: 'active', textTone: stateTextTone })
|
|
301
|
+
border, // isSelected → selected border (if borderAppearance !== 'none'); else resting border
|
|
302
|
+
hoverBorder, // getBorderClass({ state: 'hover', tone }) — if borderAppearance !== 'none'
|
|
303
|
+
focusBorder, // getBorderClass({ state: 'focus', tone }) — if borderAppearance !== 'none'
|
|
304
|
+
activeBorder // getBorderClass({ state: 'active', tone }) — if borderAppearance !== 'none'
|
|
307
305
|
}
|
|
308
306
|
```
|
|
309
307
|
|
|
@@ -314,13 +312,13 @@ The text color depends on both `bgAppearance` and `paletteShade`:
|
|
|
314
312
|
```javascript
|
|
315
313
|
const classes = getPaletteClasses({
|
|
316
314
|
palette: 'primary',
|
|
317
|
-
bgAppearance: '
|
|
315
|
+
bgAppearance: 'default',
|
|
318
316
|
borderAppearance: 'visible',
|
|
319
317
|
paletteShade: 'default',
|
|
320
318
|
});
|
|
321
|
-
// classes.bg → 'bg-blue' (
|
|
319
|
+
// classes.bg → 'bg-blue' (bgAppearance: 'default' + default shade)
|
|
322
320
|
// classes.hoverBg → 'hover:bg-blue'
|
|
323
|
-
// classes.text → 'text-white' (filledTextTone —
|
|
321
|
+
// classes.text → 'text-white' (filledTextTone — bgAppearance: 'default' + not lighter)
|
|
324
322
|
// classes.hoverText → 'hover:text-white' (filledTextTone — hasBgState + not lighter)
|
|
325
323
|
// classes.border → 'border-blue' (visible appearance)
|
|
326
324
|
// classes.hoverBorder → 'hover:border-blue'
|
|
@@ -331,11 +329,11 @@ const classes = getPaletteClasses({
|
|
|
331
329
|
```javascript
|
|
332
330
|
const classes = getPaletteClasses({
|
|
333
331
|
palette: 'danger',
|
|
334
|
-
bgAppearance: '
|
|
332
|
+
bgAppearance: 'default',
|
|
335
333
|
borderAppearance: 'none',
|
|
336
334
|
paletteShade: 'lighter',
|
|
337
335
|
});
|
|
338
|
-
// classes.bg → 'bg-red-light' (
|
|
336
|
+
// classes.bg → 'bg-red-light' (bgAppearance: 'default' + lighter shade)
|
|
339
337
|
// classes.hoverBg → 'hover:bg-red-light'
|
|
340
338
|
// classes.text → 'text-red' (textTone — lighter shade overrides filledTextTone)
|
|
341
339
|
// classes.hoverText → 'hover:text-red' (textTone — lighter shade)
|
|
@@ -365,11 +363,11 @@ const classes = getPaletteClasses({
|
|
|
365
363
|
```javascript
|
|
366
364
|
const classes = getPaletteClasses({
|
|
367
365
|
palette: 'primary',
|
|
368
|
-
bgAppearance: 'hover-fill', // any value that isn't 'none' or '
|
|
366
|
+
bgAppearance: 'hover-fill', // any value that isn't 'none' or 'default'
|
|
369
367
|
borderAppearance: 'visible',
|
|
370
368
|
paletteShade: 'default',
|
|
371
369
|
});
|
|
372
|
-
// classes.bg → undefined (not '
|
|
370
|
+
// classes.bg → undefined (not 'default' → no base bg)
|
|
373
371
|
// classes.hoverBg → 'hover:bg-blue' (not 'none' → state bg present)
|
|
374
372
|
// classes.text → 'text-blue' (baseTextTone — not filled, so textTone)
|
|
375
373
|
// classes.hoverText → 'hover:text-white' (stateTextTone — hasBgState + not lighter → filledTextTone!)
|
|
@@ -379,6 +377,8 @@ const classes = getPaletteClasses({
|
|
|
379
377
|
|
|
380
378
|
> This shows a key behavior: the base text is the normal tone, but **state text switches to `filledTextTone`** because the hover/state background will be filled (dark).
|
|
381
379
|
|
|
380
|
+
> **Note on `isSelected`:** Pass `isSelected: true` to fold the selected state into `bg`, `text`, and `border`. Instead of the resting class, each returns its `selected:` variant class. There are no separate `selectedBg`/`selectedText`/`selectedBorder` return keys.
|
|
381
|
+
|
|
382
382
|
---
|
|
383
383
|
|
|
384
384
|
## Behavior Summary
|