@zohodesk/components 1.6.7 → 1.6.11-exp-6
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 +15 -0
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +68 -0
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +68 -0
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +68 -0
- package/es/Buttongroup/Buttongroup.module.css +10 -30
- package/es/CheckBox/CheckBox.module.css +3 -10
- package/es/DateTime/DateTime.module.css +22 -35
- package/es/DateTime/YearView.module.css +8 -10
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +3 -2
- package/es/DropDown/DropDown.module.css +2 -1
- package/es/DropDown/DropDownItem.module.css +1 -8
- package/es/DropDown/DropDownSeparator.module.css +2 -1
- package/es/ListItem/ListItem.module.css +4 -15
- package/es/MultiSelect/MobileHeader/MobileHeader.module.css +3 -2
- package/es/MultiSelect/MultiSelect.module.css +21 -34
- package/es/MultiSelect/SelectedOptions.module.css +6 -10
- package/es/Radio/Radio.module.css +3 -3
- package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +1 -1
- package/es/Ribbon/Ribbon.module.css +9 -12
- package/es/Select/Select.module.css +22 -17
- package/es/Switch/Switch.module.css +1 -8
- package/es/Tab/Tab.module.css +8 -15
- package/es/Tab/Tabs.module.css +12 -22
- package/es/Tag/Tag.module.css +4 -3
- package/es/Tooltip/Tooltip.module.css +3 -2
- package/es/Typography/Typography.js +18 -8
- package/es/Typography/__tests__/Typography.spec.js +198 -6
- package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1235 -2
- package/es/Typography/css/Typography.module.css +4 -0
- package/es/Typography/css/cssJSLogic.js +53 -21
- package/es/Typography/props/defaultProps.js +4 -3
- package/es/Typography/props/propTypes.js +68 -26
- package/es/Typography/utils/textHighlighter.js +4 -2
- package/es/shared/ArrowIcon/ArrowIcon.module.css +3 -2
- package/es/v1/Button/Button.js +201 -0
- package/es/v1/Button/README.md +110 -0
- package/es/v1/Button/__tests__/Button.spec.js +272 -0
- package/es/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1160 -0
- package/es/v1/Button/_shared/Loader/Loader.js +33 -0
- package/es/v1/Button/_shared/Loader/Loader.module.css +42 -0
- package/es/v1/Button/_shared/Loader/__tests__/Loader.spec.js +21 -0
- package/es/v1/Button/_shared/Loader/__tests__/__snapshots__/Loader.spec.js.snap +49 -0
- package/es/v1/Button/_shared/Loader/props/defaultProps.js +4 -0
- package/es/v1/Button/_shared/Loader/props/propTypes.js +7 -0
- package/es/v1/Button/_shared/SuccessTick/SuccessTick.js +25 -0
- package/es/v1/Button/_shared/SuccessTick/SuccessTick.module.css +21 -0
- package/es/v1/Button/_shared/SuccessTick/__tests__/SuccessTick.spec.js +21 -0
- package/es/v1/Button/_shared/SuccessTick/__tests__/__snapshots__/SuccessTick.spec.js.snap +31 -0
- package/es/v1/Button/_shared/SuccessTick/props/defaultProps.js +4 -0
- package/es/v1/Button/_shared/SuccessTick/props/propTypes.js +7 -0
- package/es/v1/Button/constants/index.js +82 -0
- package/es/v1/Button/css/Button_v1.module.css +119 -0
- package/es/v1/Button/css/cssJSLogic.js +96 -0
- package/es/v1/Button/index.js +2 -0
- package/es/v1/Button/props/defaultProps.js +26 -0
- package/es/v1/Button/props/propTypes.js +43 -0
- package/es/v1/helpers/colorHelpers/background/backgroundColor.module.css +629 -0
- package/es/v1/helpers/colorHelpers/border/borderColor.module.css +489 -0
- package/es/v1/helpers/colorHelpers/colorHelper.js +176 -0
- package/es/v1/helpers/colorHelpers/constants/index.js +79 -0
- package/es/v1/helpers/colorHelpers/index.js +4 -0
- package/es/v1/helpers/colorHelpers/paletteUtilities.README.md +415 -0
- package/es/v1/helpers/colorHelpers/text/textColor.module.css +368 -0
- package/lib/Buttongroup/Buttongroup.module.css +10 -30
- package/lib/CheckBox/CheckBox.module.css +3 -10
- package/lib/DateTime/DateTime.module.css +22 -35
- package/lib/DateTime/YearView.module.css +8 -10
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +3 -2
- package/lib/DropDown/DropDown.module.css +2 -1
- package/lib/DropDown/DropDownItem.module.css +1 -8
- package/lib/DropDown/DropDownSeparator.module.css +2 -1
- package/lib/ListItem/ListItem.module.css +4 -15
- package/lib/MultiSelect/MobileHeader/MobileHeader.module.css +3 -2
- package/lib/MultiSelect/MultiSelect.module.css +21 -34
- package/lib/MultiSelect/SelectedOptions.module.css +6 -10
- package/lib/Radio/Radio.module.css +3 -3
- package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +1 -1
- package/lib/Ribbon/Ribbon.module.css +9 -12
- package/lib/Select/Select.module.css +22 -17
- package/lib/Switch/Switch.module.css +1 -8
- package/lib/Tab/Tab.module.css +8 -15
- package/lib/Tab/Tabs.module.css +12 -22
- package/lib/Tag/Tag.module.css +4 -3
- package/lib/Tooltip/Tooltip.module.css +3 -2
- package/lib/Typography/Typography.js +15 -5
- package/lib/Typography/__tests__/Typography.spec.js +284 -92
- package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1235 -2
- package/lib/Typography/css/Typography.module.css +4 -0
- package/lib/Typography/css/cssJSLogic.js +38 -6
- package/lib/Typography/props/defaultProps.js +6 -3
- package/lib/Typography/props/propTypes.js +67 -23
- package/lib/Typography/utils/textHighlighter.js +6 -3
- package/lib/shared/ArrowIcon/ArrowIcon.module.css +3 -2
- package/lib/v1/Button/Button.js +239 -0
- package/lib/v1/Button/README.md +110 -0
- package/lib/v1/Button/__tests__/Button.spec.js +293 -0
- package/lib/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1160 -0
- package/lib/v1/Button/_shared/Loader/Loader.js +43 -0
- package/lib/v1/Button/_shared/Loader/Loader.module.css +42 -0
- package/lib/v1/Button/_shared/Loader/__tests__/Loader.spec.js +28 -0
- package/lib/v1/Button/_shared/Loader/__tests__/__snapshots__/Loader.spec.js.snap +49 -0
- package/lib/v1/Button/_shared/Loader/props/defaultProps.js +11 -0
- package/lib/v1/Button/_shared/Loader/props/propTypes.js +18 -0
- package/lib/v1/Button/_shared/SuccessTick/SuccessTick.js +35 -0
- package/lib/v1/Button/_shared/SuccessTick/SuccessTick.module.css +21 -0
- package/lib/v1/Button/_shared/SuccessTick/__tests__/SuccessTick.spec.js +28 -0
- package/lib/v1/Button/_shared/SuccessTick/__tests__/__snapshots__/SuccessTick.spec.js.snap +31 -0
- package/lib/v1/Button/_shared/SuccessTick/props/defaultProps.js +11 -0
- package/lib/v1/Button/_shared/SuccessTick/props/propTypes.js +18 -0
- package/lib/v1/Button/constants/index.js +114 -0
- package/lib/v1/Button/css/Button_v1.module.css +119 -0
- package/lib/v1/Button/css/cssJSLogic.js +88 -0
- package/lib/v1/Button/index.js +21 -0
- package/lib/v1/Button/props/defaultProps.js +36 -0
- package/lib/v1/Button/props/propTypes.js +56 -0
- package/lib/v1/helpers/colorHelpers/background/backgroundColor.module.css +629 -0
- package/lib/v1/helpers/colorHelpers/border/borderColor.module.css +489 -0
- package/lib/v1/helpers/colorHelpers/colorHelper.js +190 -0
- package/lib/v1/helpers/colorHelpers/constants/index.js +87 -0
- package/lib/v1/helpers/colorHelpers/index.js +57 -0
- package/lib/v1/helpers/colorHelpers/paletteUtilities.README.md +415 -0
- package/lib/v1/helpers/colorHelpers/text/textColor.module.css +368 -0
- package/package.json +9 -9
|
@@ -17,31 +17,63 @@ function cssJSLogic(_ref) {
|
|
|
17
17
|
var props = _ref.props,
|
|
18
18
|
style = _ref.style;
|
|
19
19
|
var $flag_reset = props.$flag_reset,
|
|
20
|
+
shouldReset = props.shouldReset,
|
|
20
21
|
$flag_dotted = props.$flag_dotted,
|
|
22
|
+
isDotted = props.isDotted,
|
|
21
23
|
$ui_size = props.$ui_size,
|
|
24
|
+
size = props.size,
|
|
22
25
|
$ui_lineClamp = props.$ui_lineClamp,
|
|
26
|
+
lineClamp = props.lineClamp,
|
|
23
27
|
$ui_lineHeight = props.$ui_lineHeight,
|
|
28
|
+
lineHeight = props.lineHeight,
|
|
24
29
|
$ui_display = props.$ui_display,
|
|
30
|
+
display = props.display,
|
|
25
31
|
$ui_weight = props.$ui_weight,
|
|
32
|
+
weight = props.weight,
|
|
26
33
|
$ui_typeFace = props.$ui_typeFace,
|
|
34
|
+
typeFace = props.typeFace,
|
|
27
35
|
$ui_textAlign = props.$ui_textAlign,
|
|
36
|
+
textAlign = props.textAlign,
|
|
28
37
|
$ui_letterSpacing = props.$ui_letterSpacing,
|
|
38
|
+
letterSpacing = props.letterSpacing,
|
|
29
39
|
$ui_transform = props.$ui_transform,
|
|
40
|
+
transform = props.transform,
|
|
30
41
|
$ui_decoration = props.$ui_decoration,
|
|
42
|
+
decoration = props.decoration,
|
|
31
43
|
$ui_className = props.$ui_className,
|
|
44
|
+
customClass = props.customClass,
|
|
32
45
|
$ui_wordBreak = props.$ui_wordBreak,
|
|
46
|
+
wordBreak = props.wordBreak,
|
|
33
47
|
$ui_wordWrap = props.$ui_wordWrap,
|
|
34
|
-
|
|
48
|
+
wordWrap = props.wordWrap,
|
|
49
|
+
$ui_whiteSpace = props.$ui_whiteSpace,
|
|
50
|
+
whiteSpace = props.whiteSpace;
|
|
51
|
+
var finalReset = shouldReset !== undefined ? shouldReset : $flag_reset;
|
|
52
|
+
var finalDotted = isDotted !== undefined ? isDotted : $flag_dotted;
|
|
53
|
+
var finalSize = size !== undefined ? size : $ui_size;
|
|
54
|
+
var finalLineClamp = lineClamp !== undefined ? lineClamp : $ui_lineClamp;
|
|
55
|
+
var finalDisplay = display !== undefined ? display : $ui_display;
|
|
56
|
+
var finalWeight = weight !== undefined ? weight : $ui_weight;
|
|
57
|
+
var finalTypeFace = typeFace !== undefined ? typeFace : $ui_typeFace;
|
|
58
|
+
var finalTextAlign = textAlign !== undefined ? textAlign : $ui_textAlign;
|
|
59
|
+
var finalTransform = transform !== undefined ? transform : $ui_transform;
|
|
60
|
+
var finalDecoration = decoration !== undefined ? decoration : $ui_decoration;
|
|
61
|
+
var finalClassName = customClass !== undefined ? customClass : $ui_className;
|
|
62
|
+
var finalWordBreak = wordBreak !== undefined ? wordBreak : $ui_wordBreak;
|
|
63
|
+
var finalWordWrap = wordWrap !== undefined ? wordWrap : $ui_wordWrap;
|
|
64
|
+
var finalWhiteSpace = whiteSpace !== undefined ? whiteSpace : $ui_whiteSpace;
|
|
65
|
+
var finalLineHeight = lineHeight !== undefined ? lineHeight : $ui_lineHeight;
|
|
66
|
+
var finalLetterSpacing = letterSpacing !== undefined ? letterSpacing : $ui_letterSpacing;
|
|
35
67
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
68
|
+
if (finalLetterSpacing) {
|
|
69
|
+
finalLetterSpacing = _utils2.letterspacingMapping[finalLetterSpacing];
|
|
38
70
|
}
|
|
39
71
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
72
|
+
if (finalLineHeight) {
|
|
73
|
+
finalLineHeight = _utils2.lineheightMapping[finalLineHeight];
|
|
42
74
|
}
|
|
43
75
|
|
|
44
|
-
var typographyClass = (0, _utils.compileClassNames)((_compileClassNames = {}, _defineProperty(_compileClassNames, style.reset,
|
|
76
|
+
var typographyClass = (0, _utils.compileClassNames)((_compileClassNames = {}, _defineProperty(_compileClassNames, style.reset, finalReset), _defineProperty(_compileClassNames, style.dotted, finalDotted), _defineProperty(_compileClassNames, style["size".concat(finalSize)], !!finalSize), _defineProperty(_compileClassNames, style["lineclamp_".concat(finalLineClamp)], !!finalLineClamp), _defineProperty(_compileClassNames, style["lineheight_".concat(finalLineHeight)], !!finalLineHeight), _defineProperty(_compileClassNames, style["display_".concat(finalDisplay)], !!finalDisplay), _defineProperty(_compileClassNames, style["font_".concat(finalWeight)], !!finalWeight), _defineProperty(_compileClassNames, style["fontStyles_".concat(finalTypeFace)], !!finalTypeFace), _defineProperty(_compileClassNames, style["textalign_".concat(finalTextAlign)], !!finalTextAlign), _defineProperty(_compileClassNames, style["letterspacing_".concat(finalLetterSpacing)], !!finalLetterSpacing), _defineProperty(_compileClassNames, style["transform_".concat(finalTransform)], !!finalTransform), _defineProperty(_compileClassNames, style["decoration_".concat(finalDecoration)], !!finalDecoration), _defineProperty(_compileClassNames, finalClassName, !!finalClassName), _defineProperty(_compileClassNames, style["wordBreak_".concat(finalWordBreak)], !!finalWordBreak), _defineProperty(_compileClassNames, style["wordWrap_".concat(finalWordWrap)], !!finalWordWrap), _defineProperty(_compileClassNames, style["whiteSpace_".concat(finalWhiteSpace)], !!finalWhiteSpace), _compileClassNames));
|
|
45
77
|
return {
|
|
46
78
|
typographyClass: typographyClass
|
|
47
79
|
};
|
|
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.defaultProps = void 0;
|
|
7
|
+
|
|
8
|
+
var _constants = require("@zohodesk/dotkit/es/utils/constants");
|
|
9
|
+
|
|
7
10
|
var defaultProps = {
|
|
8
11
|
$ui_className: '',
|
|
9
12
|
$ui_tagName: 'div',
|
|
10
13
|
$flag_reset: false,
|
|
11
14
|
$flag_dotted: false,
|
|
12
|
-
$tagAttributes_text:
|
|
13
|
-
$a11yAttributes_text:
|
|
14
|
-
$ui_highlightConfig:
|
|
15
|
+
$tagAttributes_text: _constants.DUMMY_OBJECT,
|
|
16
|
+
$a11yAttributes_text: _constants.DUMMY_OBJECT,
|
|
17
|
+
$ui_highlightConfig: _constants.DUMMY_OBJECT
|
|
15
18
|
};
|
|
16
19
|
exports.defaultProps = defaultProps;
|
|
@@ -15,49 +15,93 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
15
|
|
|
16
16
|
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; }
|
|
17
17
|
|
|
18
|
+
// Define prop types once to avoid duplication
|
|
19
|
+
var propTypeDefinitions = {
|
|
20
|
+
shouldReset: _propTypes["default"].bool,
|
|
21
|
+
display: _propTypes["default"].oneOf(['block', 'inlineBlock', 'inline', 'initial']),
|
|
22
|
+
weight: _propTypes["default"].oneOf(['regular', 'light', 'semibold', 'bold']),
|
|
23
|
+
isDotted: _propTypes["default"].bool,
|
|
24
|
+
textAlign: _propTypes["default"].oneOf(['left', 'right', 'center', 'justify']),
|
|
25
|
+
transform: _propTypes["default"].oneOf(['default', 'upper', 'lower', 'capital']),
|
|
26
|
+
lineClamp: _propTypes["default"].oneOf(['1', '2', '3', '4', '5']),
|
|
27
|
+
typeFace: _propTypes["default"].oneOf(['normal', 'italic']),
|
|
28
|
+
decoration: _propTypes["default"].oneOf(['default', 'underline', 'strike', 'overline']),
|
|
29
|
+
size: _propTypes["default"].oneOf(['7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '24', '25', '26', '28', '29', '30', '32', '34', '35', '36', '40', '50', 'inherit']),
|
|
30
|
+
lineHeight: _propTypes["default"].oneOf(['0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '2', 'normal', 'initial', 'inherit']),
|
|
31
|
+
letterSpacing: _propTypes["default"].oneOf(['0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1', '1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '2', 'inherit']),
|
|
32
|
+
wordBreak: _propTypes["default"].oneOf(['breakAll', 'keepAll', 'breakWord']),
|
|
33
|
+
wordWrap: _propTypes["default"].oneOf(['normal', 'break']),
|
|
34
|
+
whiteSpace: _propTypes["default"].oneOf(['normal', 'noWrap', 'pre', 'preLine', 'preWrap', 'breakSpaces']),
|
|
35
|
+
customClass: _propTypes["default"].string
|
|
36
|
+
};
|
|
18
37
|
var typoStyleProps = {
|
|
19
|
-
$flag_reset:
|
|
20
|
-
|
|
21
|
-
$
|
|
22
|
-
|
|
23
|
-
$
|
|
24
|
-
|
|
25
|
-
$
|
|
26
|
-
|
|
27
|
-
$
|
|
28
|
-
|
|
29
|
-
$
|
|
30
|
-
|
|
31
|
-
$
|
|
32
|
-
|
|
33
|
-
$
|
|
34
|
-
|
|
38
|
+
$flag_reset: propTypeDefinitions.shouldReset,
|
|
39
|
+
shouldReset: propTypeDefinitions.shouldReset,
|
|
40
|
+
$flag_dotted: propTypeDefinitions.isDotted,
|
|
41
|
+
isDotted: propTypeDefinitions.isDotted,
|
|
42
|
+
$ui_display: propTypeDefinitions.display,
|
|
43
|
+
display: propTypeDefinitions.display,
|
|
44
|
+
$ui_weight: propTypeDefinitions.weight,
|
|
45
|
+
weight: propTypeDefinitions.weight,
|
|
46
|
+
$ui_textAlign: propTypeDefinitions.textAlign,
|
|
47
|
+
textAlign: propTypeDefinitions.textAlign,
|
|
48
|
+
$ui_transform: propTypeDefinitions.transform,
|
|
49
|
+
transform: propTypeDefinitions.transform,
|
|
50
|
+
$ui_lineClamp: propTypeDefinitions.lineClamp,
|
|
51
|
+
lineClamp: propTypeDefinitions.lineClamp,
|
|
52
|
+
$ui_typeFace: propTypeDefinitions.typeFace,
|
|
53
|
+
typeFace: propTypeDefinitions.typeFace,
|
|
54
|
+
$ui_decoration: propTypeDefinitions.decoration,
|
|
55
|
+
decoration: propTypeDefinitions.decoration,
|
|
56
|
+
$ui_size: propTypeDefinitions.size,
|
|
57
|
+
size: propTypeDefinitions.size,
|
|
58
|
+
$ui_lineHeight: propTypeDefinitions.lineHeight,
|
|
59
|
+
lineHeight: propTypeDefinitions.lineHeight,
|
|
60
|
+
$ui_letterSpacing: propTypeDefinitions.letterSpacing,
|
|
61
|
+
letterSpacing: propTypeDefinitions.letterSpacing,
|
|
62
|
+
$ui_wordBreak: propTypeDefinitions.wordBreak,
|
|
63
|
+
wordBreak: propTypeDefinitions.wordBreak,
|
|
64
|
+
$ui_wordWrap: propTypeDefinitions.wordWrap,
|
|
65
|
+
wordWrap: propTypeDefinitions.wordWrap,
|
|
66
|
+
$ui_whiteSpace: propTypeDefinitions.whiteSpace,
|
|
67
|
+
whiteSpace: propTypeDefinitions.whiteSpace,
|
|
68
|
+
$ui_className: propTypeDefinitions.customClass,
|
|
69
|
+
customClass: propTypeDefinitions.customClass
|
|
35
70
|
};
|
|
36
71
|
var highlightProps = {
|
|
37
72
|
customStyle: _propTypes["default"].object,
|
|
38
73
|
shouldExcludeIndices: _propTypes["default"].bool,
|
|
39
74
|
isCaseSensitive: _propTypes["default"].bool,
|
|
40
75
|
isWholeWord: _propTypes["default"].bool,
|
|
41
|
-
|
|
76
|
+
as: _propTypes["default"].string,
|
|
42
77
|
renderHighlight: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].node]),
|
|
43
78
|
styleConfiguration: _propTypes["default"].shape(typoStyleProps)
|
|
44
79
|
};
|
|
45
80
|
|
|
81
|
+
var highlightDataItemShape = _propTypes["default"].shape(_objectSpread({
|
|
82
|
+
text: _propTypes["default"].string,
|
|
83
|
+
index: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].number), _propTypes["default"].number])
|
|
84
|
+
}, highlightProps));
|
|
85
|
+
|
|
86
|
+
var highlightConfigShape = _propTypes["default"].shape(_objectSpread({
|
|
87
|
+
data: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, highlightDataItemShape]))
|
|
88
|
+
}, highlightProps));
|
|
89
|
+
|
|
46
90
|
var propTypes = _objectSpread(_objectSpread({}, typoStyleProps), {}, {
|
|
47
91
|
children: _propTypes["default"].node,
|
|
48
92
|
$ui_tagName: _propTypes["default"].string,
|
|
93
|
+
as: _propTypes["default"].string,
|
|
49
94
|
$i18n_dataTitle: _propTypes["default"].string,
|
|
95
|
+
dataTitle: _propTypes["default"].string,
|
|
50
96
|
testId: _propTypes["default"].string,
|
|
51
97
|
customId: _propTypes["default"].string,
|
|
52
98
|
customStyle: _propTypes["default"].object,
|
|
53
99
|
$a11yAttributes_text: _propTypes["default"].object,
|
|
100
|
+
a11yAttributes: _propTypes["default"].object,
|
|
54
101
|
$tagAttributes_text: _propTypes["default"].object,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
index: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].number), _propTypes["default"].number])
|
|
59
|
-
}, highlightProps))]))
|
|
60
|
-
}, highlightProps))
|
|
102
|
+
tagAttributes: _propTypes["default"].object,
|
|
103
|
+
$ui_highlightConfig: highlightConfigShape,
|
|
104
|
+
highlightConfig: highlightConfigShape
|
|
61
105
|
});
|
|
62
106
|
|
|
63
107
|
exports.propTypes = propTypes;
|
|
@@ -24,6 +24,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
24
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
25
|
|
|
26
26
|
function highlightText(config) {
|
|
27
|
+
var _ref;
|
|
28
|
+
|
|
27
29
|
var sourceText = config.text,
|
|
28
30
|
highlightData = config.data,
|
|
29
31
|
_config$styleConfigur = config.styleConfiguration,
|
|
@@ -34,9 +36,10 @@ function highlightText(config) {
|
|
|
34
36
|
enableCaseSensitiveMatch = _config$isCaseSensiti === void 0 ? false : _config$isCaseSensiti,
|
|
35
37
|
_config$isWholeWord = config.isWholeWord,
|
|
36
38
|
matchWholeWordOnly = _config$isWholeWord === void 0 ? false : _config$isWholeWord,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
asTag = config.as,
|
|
40
|
+
tagNameLegacy = config.tagName,
|
|
39
41
|
customRenderer = config.renderHighlight;
|
|
42
|
+
var wrapperTagName = (_ref = asTag !== null && asTag !== void 0 ? asTag : tagNameLegacy) !== null && _ref !== void 0 ? _ref : 'span';
|
|
40
43
|
|
|
41
44
|
if (!sourceText || !(highlightData !== null && highlightData !== void 0 && highlightData.length)) {
|
|
42
45
|
return sourceText;
|
|
@@ -78,7 +81,7 @@ function highlightText(config) {
|
|
|
78
81
|
shouldExcludeIndices: itemConfiguration.shouldExcludeIndices !== undefined ? itemConfiguration.shouldExcludeIndices : shouldExcludeIndices,
|
|
79
82
|
isCaseSensitive: itemConfiguration.isCaseSensitive !== undefined ? itemConfiguration.isCaseSensitive : enableCaseSensitiveMatch,
|
|
80
83
|
matchWholeWordOnly: itemConfiguration.isWholeWord !== undefined ? itemConfiguration.isWholeWord : matchWholeWordOnly,
|
|
81
|
-
wrapperTagName: itemConfiguration.tagName !== undefined ? itemConfiguration.tagName : wrapperTagName,
|
|
84
|
+
wrapperTagName: itemConfiguration.as !== undefined ? itemConfiguration.as : itemConfiguration.tagName !== undefined ? itemConfiguration.tagName : wrapperTagName,
|
|
82
85
|
customStyle: customStyle,
|
|
83
86
|
customRenderer: itemConfiguration.renderHighlight !== undefined ? itemConfiguration.renderHighlight : customRenderer,
|
|
84
87
|
highlightClasses: typographyClass,
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
.arrowIcon {
|
|
6
6
|
composes: varClass;
|
|
7
|
+
margin-block:0 ;
|
|
8
|
+
margin-inline: var(--zd_size5) ;
|
|
7
9
|
color: var(--local-arrowIcon-color);
|
|
8
10
|
transition: transform var(--zd_transition3);
|
|
9
|
-
margin: 0 var(--zd_size5) ;
|
|
10
11
|
}
|
|
11
12
|
.transparentContainer .arrowIcon {
|
|
12
13
|
opacity: 0;
|
|
@@ -39,4 +40,4 @@
|
|
|
39
40
|
|
|
40
41
|
.readonly {
|
|
41
42
|
composes: curdefault from '../../common/common.module.css';
|
|
42
|
-
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ComponentRegistry = require("@zohodesk/dotkit/es/react/ComponentRegistry");
|
|
13
|
+
|
|
14
|
+
var _Icon = _interopRequireDefault(require("@zohodesk/icons/es/Icon"));
|
|
15
|
+
|
|
16
|
+
var _Flex = _interopRequireDefault(require("@zohodesk/layout/es/Flex/Flex"));
|
|
17
|
+
|
|
18
|
+
var _Typography = _interopRequireDefault(require("../../Typography/Typography"));
|
|
19
|
+
|
|
20
|
+
var _renderNode = _interopRequireWildcard(require("@zohodesk/utils/es/renderNode"));
|
|
21
|
+
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("./props/propTypes"));
|
|
23
|
+
|
|
24
|
+
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
25
|
+
|
|
26
|
+
var _constants = require("@zohodesk/dotkit/es/utils/constants");
|
|
27
|
+
|
|
28
|
+
var _constants2 = require("./constants");
|
|
29
|
+
|
|
30
|
+
var _Loader = _interopRequireDefault(require("./_shared/Loader/Loader"));
|
|
31
|
+
|
|
32
|
+
var _SuccessTick = _interopRequireDefault(require("./_shared/SuccessTick/SuccessTick"));
|
|
33
|
+
|
|
34
|
+
var _cssJSLogic = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
35
|
+
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
|
+
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
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); }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
var getTypographySize = function getTypographySize(size) {
|
|
51
|
+
return _constants2.TYPOGRAPHY_SIZE_MAP[size] || '13';
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var Button = /*#__PURE__*/(0, _react.forwardRef)(function Button(props, ref) {
|
|
55
|
+
var palette = props.palette,
|
|
56
|
+
bgAppearance = props.bgAppearance,
|
|
57
|
+
borderAppearance = props.borderAppearance,
|
|
58
|
+
variant = props.variant,
|
|
59
|
+
status = props.status,
|
|
60
|
+
loaderPlacement = props.loaderPlacement,
|
|
61
|
+
size = props.size,
|
|
62
|
+
iconName = props.iconName,
|
|
63
|
+
iconSize = props.iconSize,
|
|
64
|
+
iconPlacement = props.iconPlacement,
|
|
65
|
+
renderIcon = props.renderIcon,
|
|
66
|
+
renderBefore = props.renderBefore,
|
|
67
|
+
renderAfter = props.renderAfter,
|
|
68
|
+
renderLoader = props.renderLoader,
|
|
69
|
+
renderSuccess = props.renderSuccess,
|
|
70
|
+
children = props.children,
|
|
71
|
+
type = props.type,
|
|
72
|
+
onClick = props.onClick,
|
|
73
|
+
isDisabled = props.isDisabled,
|
|
74
|
+
isReadOnly = props.isReadOnly,
|
|
75
|
+
isSelected = props.isSelected,
|
|
76
|
+
shape = props.shape,
|
|
77
|
+
paletteShade = props.paletteShade,
|
|
78
|
+
disabledAppearance = props.disabledAppearance,
|
|
79
|
+
title = props.title,
|
|
80
|
+
customProps = props.customProps,
|
|
81
|
+
customAttributes = props.customAttributes,
|
|
82
|
+
a11yAttributes = props.a11yAttributes,
|
|
83
|
+
customId = props.customId,
|
|
84
|
+
testId = props.testId;
|
|
85
|
+
var isLoading = status === _constants2.STATUS.LOADING;
|
|
86
|
+
var isSuccess = status === _constants2.STATUS.SUCCESS;
|
|
87
|
+
var isDisabledState = isDisabled || isLoading;
|
|
88
|
+
var isInteractionDisabled = isDisabledState || isReadOnly;
|
|
89
|
+
var overlayActive = (isLoading || isSuccess) && loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY;
|
|
90
|
+
var _customProps$text = customProps.text,
|
|
91
|
+
contentProps = _customProps$text === void 0 ? _constants.DUMMY_OBJECT : _customProps$text,
|
|
92
|
+
_customProps$icon = customProps.icon,
|
|
93
|
+
iconProps = _customProps$icon === void 0 ? _constants.DUMMY_OBJECT : _customProps$icon;
|
|
94
|
+
var iconTagAttributes = (0, _react.useMemo)(function () {
|
|
95
|
+
return _objectSpread(_objectSpread({}, iconProps.tagAttributes || _constants.DUMMY_OBJECT), {}, {
|
|
96
|
+
'data-test-id': testId ? "".concat(testId, "_icon") : undefined
|
|
97
|
+
});
|
|
98
|
+
}, [iconProps.tagAttributes, testId]);
|
|
99
|
+
var classes = (0, _react.useMemo)(function () {
|
|
100
|
+
return (0, _cssJSLogic["default"])({
|
|
101
|
+
props: props
|
|
102
|
+
});
|
|
103
|
+
}, [palette, bgAppearance, borderAppearance, paletteShade, size, variant, status, isDisabled, isReadOnly, isSelected, shape, loaderPlacement, disabledAppearance, props.customClass]);
|
|
104
|
+
var loaderOverlayClass = classes.loaderOverlayClass,
|
|
105
|
+
successOverlayClass = classes.successOverlayClass,
|
|
106
|
+
contentWrapperClass = classes.contentWrapperClass,
|
|
107
|
+
textClassName = classes.textClassName,
|
|
108
|
+
buttonClassName = classes.buttonClassName;
|
|
109
|
+
var showIcon = variant !== _constants2.VARIANT.TEXT && (renderIcon || iconName);
|
|
110
|
+
|
|
111
|
+
var _handleClick = function _handleClick(event) {
|
|
112
|
+
if (isInteractionDisabled) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
onClick(event);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
var _renderLoader = function _renderLoader() {
|
|
120
|
+
if (!isLoading) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if ((0, _renderNode.isRenderable)(renderLoader)) {
|
|
125
|
+
return (0, _renderNode["default"])(renderLoader, {
|
|
126
|
+
status: status
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
var loaderClassName = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY ? loaderOverlayClass : '';
|
|
131
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
132
|
+
$ui_displayMode: "flex",
|
|
133
|
+
$ui_alignItems: "center",
|
|
134
|
+
$ui_justifyContent: "center",
|
|
135
|
+
$ui_className: loaderClassName,
|
|
136
|
+
testId: testId ? "".concat(testId, "_loader") : undefined
|
|
137
|
+
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
var _renderSuccess = function _renderSuccess() {
|
|
141
|
+
if (!isSuccess) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if ((0, _renderNode.isRenderable)(renderSuccess)) {
|
|
146
|
+
return (0, _renderNode["default"])(renderSuccess, {
|
|
147
|
+
status: status
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
var successClassName = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY ? successOverlayClass : '';
|
|
152
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
153
|
+
$ui_displayMode: "flex",
|
|
154
|
+
$ui_alignItems: "center",
|
|
155
|
+
$ui_justifyContent: "center",
|
|
156
|
+
$ui_className: successClassName,
|
|
157
|
+
testId: testId ? "".concat(testId, "_success") : undefined
|
|
158
|
+
}, /*#__PURE__*/_react["default"].createElement(_SuccessTick["default"], null));
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
var _renderIconNode = function _renderIconNode() {
|
|
162
|
+
if (!showIcon) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if ((0, _renderNode.isRenderable)(renderIcon)) {
|
|
167
|
+
return (0, _renderNode["default"])(renderIcon);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return /*#__PURE__*/_react["default"].createElement(_Icon["default"], _extends({}, iconProps, {
|
|
171
|
+
name: iconName,
|
|
172
|
+
size: iconSize,
|
|
173
|
+
tagAttributes: iconTagAttributes,
|
|
174
|
+
dataId: testId ? "".concat(testId, "_icon") : undefined
|
|
175
|
+
}));
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
var _renderBeforeNode = function _renderBeforeNode() {
|
|
179
|
+
if (!(0, _renderNode.isRenderable)(renderBefore)) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return (0, _renderNode["default"])(renderBefore, props);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var _renderAfterNode = function _renderAfterNode() {
|
|
187
|
+
if (!(0, _renderNode.isRenderable)(renderAfter)) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return (0, _renderNode["default"])(renderAfter, props);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var _renderContent = function _renderContent() {
|
|
195
|
+
var shouldShowText = variant !== _constants2.VARIANT.ICON && children !== undefined && children !== null;
|
|
196
|
+
var showLoaderStart = isLoading && loaderPlacement === _constants2.LOADER_PLACEMENT.START;
|
|
197
|
+
var showLoaderAfter = isLoading && loaderPlacement === _constants2.LOADER_PLACEMENT.END;
|
|
198
|
+
var showSuccessStart = isSuccess && loaderPlacement === _constants2.LOADER_PLACEMENT.START;
|
|
199
|
+
var showSuccessAfter = isSuccess && loaderPlacement === _constants2.LOADER_PLACEMENT.END;
|
|
200
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
201
|
+
$ui_displayMode: "flex",
|
|
202
|
+
$ui_direction: "row",
|
|
203
|
+
$flag_shrink: true,
|
|
204
|
+
$ui_alignItems: "center",
|
|
205
|
+
$ui_justifyContent: "center",
|
|
206
|
+
$ui_className: contentWrapperClass
|
|
207
|
+
}, showLoaderStart ? _renderLoader() : null, showSuccessStart ? _renderSuccess() : null, _renderBeforeNode(), iconPlacement === _constants2.ICON_PLACEMENT.LEFT ? _renderIconNode() : null, shouldShowText ? /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({}, contentProps, {
|
|
208
|
+
$ui_className: textClassName,
|
|
209
|
+
$ui_size: getTypographySize(size),
|
|
210
|
+
$flag_dotted: variant !== _constants2.VARIANT.ICON
|
|
211
|
+
}), children) : null, iconPlacement === _constants2.ICON_PLACEMENT.RIGHT ? _renderIconNode() : null, _renderAfterNode(), showLoaderAfter ? _renderLoader() : null, showSuccessAfter ? _renderSuccess() : null);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
var containerAttributes = _objectSpread(_objectSpread({}, customAttributes), {}, {
|
|
215
|
+
'data-id': customId,
|
|
216
|
+
'data-test-id': testId,
|
|
217
|
+
'data-title': title
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
return /*#__PURE__*/_react["default"].createElement("button", _extends({}, containerAttributes, a11yAttributes, {
|
|
221
|
+
ref: ref,
|
|
222
|
+
type: type,
|
|
223
|
+
className: buttonClassName,
|
|
224
|
+
"aria-busy": isLoading,
|
|
225
|
+
"aria-disabled": isDisabledState,
|
|
226
|
+
"aria-readonly": isReadOnly,
|
|
227
|
+
"aria-pressed": isSelected,
|
|
228
|
+
onClick: _handleClick
|
|
229
|
+
}), _renderContent(), overlayActive ? isLoading ? _renderLoader() : _renderSuccess() : null);
|
|
230
|
+
});
|
|
231
|
+
Button.propTypes = _propTypes["default"];
|
|
232
|
+
Button.defaultProps = _defaultProps["default"];
|
|
233
|
+
Button.displayName = 'Button';
|
|
234
|
+
|
|
235
|
+
var _default = (0, _ComponentRegistry.withComponentRegistrar)( /*#__PURE__*/(0, _react.memo)(Button), {
|
|
236
|
+
name: 'ZDC_V1_Button'
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
A composable button component with palette-based theming, loading/success status states, and flexible icon/content slots.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import Button from '@zohodesk/components/es/v1/Button/Button';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Default
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
<Button customId="saveBtn" testId="saveBtn">
|
|
17
|
+
Save changes
|
|
18
|
+
</Button>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### With Palette Variants
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<Button palette="primary">Save</Button>
|
|
25
|
+
<Button palette="danger">Delete</Button>
|
|
26
|
+
<Button palette="success">Confirm</Button>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### With Icon
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
<Button variant="icon" iconName="ZD-plus" iconSize={20} />
|
|
33
|
+
|
|
34
|
+
<Button variant="iconWithText" iconName="ZD-plus" iconPlacement="left">
|
|
35
|
+
Add Item
|
|
36
|
+
</Button>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Loading State
|
|
40
|
+
|
|
41
|
+
```jsx
|
|
42
|
+
<Button status="loading" loaderPlacement="overlay">
|
|
43
|
+
Saving...
|
|
44
|
+
</Button>
|
|
45
|
+
|
|
46
|
+
<Button status="loading" loaderPlacement="start">
|
|
47
|
+
Loading
|
|
48
|
+
</Button>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Disabled / Read Only
|
|
52
|
+
|
|
53
|
+
```jsx
|
|
54
|
+
<Button isDisabled>Disabled</Button>
|
|
55
|
+
<Button isReadOnly>Read Only</Button>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Props
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Default | Description |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| `customId` | `string` | — | `data-id` attribute for automation |
|
|
63
|
+
| `testId` | `string` | — | `data-test-id` attribute for testing |
|
|
64
|
+
| `palette` | `oneOf: default, primary, secondary, danger, success` | `default` | Color palette |
|
|
65
|
+
| `bgAppearance` | `oneOf: filled, onHover, none` | `filled` | Background behavior |
|
|
66
|
+
| `borderAppearance` | `oneOf: default, onHover, none` | `default` | Border behavior |
|
|
67
|
+
| `variant` | `oneOf: text, icon, iconWithText` | `text` | Display variant |
|
|
68
|
+
| `size` | `oneOf: small, medium, large, full` | `medium` | Size variant |
|
|
69
|
+
| `status` | `oneOf: default, loading, success` | `default` | Status state |
|
|
70
|
+
| `loaderPlacement` | `oneOf: start, end, overlay` | `overlay` | Where loader appears |
|
|
71
|
+
| `iconName` | `string` | — | Icon name from `@zohodesk/icons` |
|
|
72
|
+
| `iconSize` | `number` | `16` | Icon size in pixels |
|
|
73
|
+
| `iconPlacement` | `oneOf: left, right` | `left` | Icon position relative to text |
|
|
74
|
+
| `paletteShade` | `oneOf: default, lighter` | `default` | Shade variant |
|
|
75
|
+
| `disabledAppearance` | `oneOf: none, dull, strike` | `dull` | Disabled visual style |
|
|
76
|
+
| `renderIcon` | `node \| func` | — | Custom icon render slot |
|
|
77
|
+
| `renderBefore` | `node \| func` | — | Slot before main content |
|
|
78
|
+
| `renderAfter` | `node \| func` | — | Slot after main content |
|
|
79
|
+
| `renderLoader` | `node \| func` | — | Custom loader render slot |
|
|
80
|
+
| `renderSuccess` | `node \| func` | — | Custom success render slot |
|
|
81
|
+
| `children` | `node` | — | Button text content |
|
|
82
|
+
| `type` | `oneOf: button, submit, reset` | `button` | HTML button type |
|
|
83
|
+
| `onClick` | `func` | — | Click event handler |
|
|
84
|
+
| `isDisabled` | `bool` | `false` | Disables the button |
|
|
85
|
+
| `isReadOnly` | `bool` | `false` | Read-only state |
|
|
86
|
+
| `isSelected` | `bool` | `false` | Selected/pressed state |
|
|
87
|
+
| `isRounded` | `bool` | `false` | Rounded border radius |
|
|
88
|
+
| `title` | `string` | — | Title/tooltip text |
|
|
89
|
+
|
|
90
|
+
## Customization
|
|
91
|
+
|
|
92
|
+
### Parts
|
|
93
|
+
|
|
94
|
+
| Part | Element | Description |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `wrapper` | `<button>` root | The outermost button element |
|
|
97
|
+
| `text` | Typography | The text label |
|
|
98
|
+
|
|
99
|
+
### CSS Custom Properties
|
|
100
|
+
|
|
101
|
+
The `.varClass` block in `Button.module.css` defines local custom properties that size variants override:
|
|
102
|
+
|
|
103
|
+
| Property | Default | Description |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `--local-Button-radius` | `4px` | Border radius |
|
|
106
|
+
| `--local-Button-gap` | `8px` | Content gap |
|
|
107
|
+
| `--local-Button-padding-block` | `6px` | Block padding |
|
|
108
|
+
| `--local-Button-padding-inline` | `15px` | Inline padding |
|
|
109
|
+
| `--local-Button-min-width` | `90px` | Minimum width |
|
|
110
|
+
| `--local-Button-spinner-size` | `16px` | Spinner/tick size |
|