@zohodesk/components 1.6.25 → 1.6.26
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/CHANGELOG.md +2042 -0
- package/README.md +16 -2031
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +5 -20
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +5 -20
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +5 -20
- package/es/Accordion/Accordion.js +1 -6
- package/es/Accordion/AccordionItem.js +1 -6
- package/es/Animation/Animation.js +1 -8
- package/es/AppContainer/AppContainer.js +1 -6
- package/es/AppContainer/__tests__/__snapshots__/AppContainer.spec.js.snap +16 -16
- package/es/Avatar/Avatar.js +1 -6
- package/es/AvatarTeam/AvatarTeam.js +1 -7
- package/es/Button/Button.js +1 -6
- package/es/Buttongroup/Buttongroup.js +1 -14
- package/es/Card/Card.js +1 -9
- package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +17 -17
- package/es/Card/__tests__/__snapshots__/CardContent.spec.js.snap +12 -12
- package/es/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +4 -4
- package/es/CheckBox/CheckBox.js +1 -6
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +88 -88
- package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +48 -48
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +30 -30
- package/es/DateTime/DateWidget.js +0 -10
- package/es/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +49 -49
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +93 -93
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +8 -8
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +7 -7
- package/es/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +28 -28
- package/es/DropDown/DropDownHeading.js +1 -6
- package/es/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +2 -2
- package/es/Heading/Heading.js +1 -6
- package/es/Label/Label.js +1 -6
- package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +4 -4
- package/es/ListItem/ListContainer.js +1 -6
- package/es/ListItem/ListItem.js +1 -6
- package/es/ListItem/ListItemWithAvatar.js +1 -6
- package/es/ListItem/ListItemWithCheckBox.js +1 -6
- package/es/ListItem/ListItemWithIcon.js +1 -6
- package/es/ListItem/ListItemWithRadio.js +1 -6
- package/es/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +2 -2
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +16 -16
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +41 -41
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +62 -62
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +41 -41
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +62 -62
- package/es/Modal/Modal.js +1 -8
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +1 -7
- package/es/MultiSelect/AdvancedMultiSelect.js +1 -9
- package/es/MultiSelect/MobileHeader/__tests__/__snapshots__/MobileHeader.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +6 -6
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +50 -50
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +35 -35
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +7 -7
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +8 -8
- package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +4 -4
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +47 -47
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +94 -94
- package/es/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1 -1
- package/es/RippleEffect/RippleEffect.js +1 -6
- package/es/Select/GroupSelect.js +1 -8
- package/es/Select/Select.js +1 -10
- package/es/Select/SelectWithAvatar.js +1 -9
- package/es/Select/SelectWithIcon.js +1 -7
- package/es/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +7 -7
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +831 -831
- package/es/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +2 -2
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +10 -10
- package/es/Switch/Switch.js +1 -6
- package/es/Switch/__tests__/__snapshots__/Switch.spec.js.snap +44 -44
- package/es/Tab/Tab.js +1 -6
- package/es/Tab/__tests__/__snapshots__/Tab.spec.js.snap +2 -2
- package/es/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +40 -40
- package/es/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +4 -4
- package/es/Tag/Tag.js +1 -6
- package/es/Tag/__tests__/__snapshots__/Tag.spec.js.snap +94 -94
- package/es/TextBox/TextBox.js +1 -8
- package/es/TextBoxIcon/TextBoxIcon.js +1 -8
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +167 -167
- package/es/Textarea/Textarea.js +1 -8
- package/es/Tooltip/Tooltip.js +1 -8
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +1 -5
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -5
- package/es/semantic/Button/Button.js +1 -6
- package/es/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +20 -20
- package/es/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +19 -19
- package/es/v1/Button/Button.js +197 -113
- package/es/v1/Button/README.md +110 -44
- package/es/v1/Button/__tests__/Button.spec.js +139 -48
- package/es/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1236 -340
- package/es/v1/Button/constants/index.js +29 -23
- package/es/v1/Button/constants/presets.js +160 -0
- package/es/v1/Button/css/Button_v1.module.css +33 -16
- package/es/v1/Button/css/cssJSLogic.js +56 -29
- package/es/v1/Button/props/defaultProps.js +5 -6
- package/es/v1/Button/props/propTypes.js +26 -8
- package/es/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +24 -24
- package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +14 -14
- package/es/v1/helpers/colorHelpers/__tests__/colorHelper.spec.js +357 -0
- package/es/v1/helpers/colorHelpers/background/backgroundColor.module.css +38 -534
- package/es/v1/helpers/colorHelpers/border/borderColor.module.css +28 -412
- package/es/v1/helpers/colorHelpers/colorHelper.js +120 -139
- package/es/v1/helpers/colorHelpers/constants/index.js +45 -4
- package/es/v1/helpers/colorHelpers/index.js +0 -1
- package/es/v1/helpers/colorHelpers/paletteUtilities.README.md +141 -336
- package/es/v1/helpers/colorHelpers/text/textColor.module.css +79 -295
- package/lib/Accordion/Accordion.js +1 -6
- package/lib/Accordion/AccordionItem.js +1 -6
- package/lib/Animation/Animation.js +1 -8
- package/lib/AppContainer/AppContainer.js +1 -6
- package/lib/AppContainer/__tests__/__snapshots__/AppContainer.spec.js.snap +16 -16
- package/lib/Avatar/Avatar.js +1 -6
- package/lib/AvatarTeam/AvatarTeam.js +1 -7
- package/lib/Button/Button.js +1 -7
- package/lib/Buttongroup/Buttongroup.js +1 -14
- package/lib/Card/Card.js +1 -8
- package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +17 -17
- package/lib/Card/__tests__/__snapshots__/CardContent.spec.js.snap +12 -12
- package/lib/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +4 -4
- package/lib/CheckBox/CheckBox.js +1 -6
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +88 -88
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +48 -48
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +30 -30
- package/lib/DateTime/DateWidget.js +0 -10
- package/lib/DateTime/__tests__/__snapshots__/CalendarView.spec.js.snap +49 -49
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +93 -93
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupFooter.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +8 -8
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +7 -7
- package/lib/DateTime/__tests__/__snapshots__/DaysRow.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +28 -28
- package/lib/DropDown/DropDownHeading.js +1 -6
- package/lib/DropDown/__tests__/__snapshots__/DropDown.spec.js.snap +2 -2
- package/lib/Heading/Heading.js +1 -6
- package/lib/Label/Label.js +1 -6
- package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +4 -4
- package/lib/ListItem/ListContainer.js +1 -7
- package/lib/ListItem/ListItem.js +1 -6
- package/lib/ListItem/ListItemWithAvatar.js +1 -6
- package/lib/ListItem/ListItemWithCheckBox.js +1 -6
- package/lib/ListItem/ListItemWithIcon.js +1 -6
- package/lib/ListItem/ListItemWithRadio.js +1 -6
- package/lib/ListItem/__tests__/__snapshots__/ListContainer.spec.js.snap +2 -2
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +16 -16
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +41 -41
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +62 -62
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +41 -41
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +62 -62
- package/lib/Modal/Modal.js +1 -8
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +1 -7
- package/lib/MultiSelect/AdvancedMultiSelect.js +1 -9
- package/lib/MultiSelect/MobileHeader/__tests__/__snapshots__/MobileHeader.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +6 -6
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +50 -50
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +35 -35
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +7 -7
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +8 -8
- package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +4 -4
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +47 -47
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +94 -94
- package/lib/ResponsiveDropBox/__tests__/__snapshots__/ResponsiveDropBox.spec.js.snap +1 -1
- package/lib/RippleEffect/RippleEffect.js +1 -6
- package/lib/Select/GroupSelect.js +1 -9
- package/lib/Select/Select.js +1 -11
- package/lib/Select/SelectWithAvatar.js +1 -9
- package/lib/Select/SelectWithIcon.js +1 -7
- package/lib/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +7 -7
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +831 -831
- package/lib/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +2 -2
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +10 -10
- package/lib/Switch/Switch.js +1 -6
- package/lib/Switch/__tests__/__snapshots__/Switch.spec.js.snap +44 -44
- package/lib/Tab/Tab.js +1 -6
- package/lib/Tab/__tests__/__snapshots__/Tab.spec.js.snap +2 -2
- package/lib/Tab/__tests__/__snapshots__/TabContent.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/TabContentWrapper.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +40 -40
- package/lib/Tab/__tests__/__snapshots__/TabWrapper.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/Tabs.spec.js.snap +4 -4
- package/lib/Tag/Tag.js +1 -6
- package/lib/Tag/__tests__/__snapshots__/Tag.spec.js.snap +94 -94
- package/lib/TextBox/TextBox.js +1 -8
- package/lib/TextBoxIcon/TextBoxIcon.js +1 -8
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +167 -167
- package/lib/Textarea/Textarea.js +1 -8
- package/lib/Tooltip/Tooltip.js +1 -8
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +1 -5
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -5
- package/lib/semantic/Button/Button.js +1 -6
- package/lib/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +20 -20
- package/lib/shared/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +19 -19
- package/lib/v1/Button/Button.js +207 -123
- package/lib/v1/Button/README.md +110 -44
- package/lib/v1/Button/__tests__/Button.spec.js +195 -88
- package/lib/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +1236 -340
- package/lib/v1/Button/constants/index.js +34 -31
- package/lib/v1/Button/constants/presets.js +179 -0
- package/lib/v1/Button/css/Button_v1.module.css +33 -16
- package/lib/v1/Button/css/cssJSLogic.js +45 -25
- package/lib/v1/Button/props/defaultProps.js +4 -5
- package/lib/v1/Button/props/propTypes.js +41 -7
- package/lib/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +24 -24
- package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +14 -14
- package/lib/v1/helpers/colorHelpers/__tests__/colorHelper.spec.js +363 -0
- package/lib/v1/helpers/colorHelpers/background/backgroundColor.module.css +38 -534
- package/lib/v1/helpers/colorHelpers/border/borderColor.module.css +28 -412
- package/lib/v1/helpers/colorHelpers/colorHelper.js +130 -153
- package/lib/v1/helpers/colorHelpers/constants/index.js +45 -4
- package/lib/v1/helpers/colorHelpers/index.js +2 -24
- package/lib/v1/helpers/colorHelpers/paletteUtilities.README.md +141 -336
- package/lib/v1/helpers/colorHelpers/text/textColor.module.css +79 -295
- package/package.json +16 -16
package/lib/v1/Button/Button.js
CHANGED
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = void 0;
|
|
8
|
+
exports["default"] = exports.ButtonPresentational = void 0;
|
|
9
9
|
|
|
10
10
|
var _cssUtility = require("@dot-system/css-utility");
|
|
11
11
|
|
|
@@ -17,24 +17,24 @@ var _Icon = _interopRequireDefault(require("@zohodesk/icons/es/Icon"));
|
|
|
17
17
|
|
|
18
18
|
var _Flex = _interopRequireDefault(require("@zohodesk/layout/es/Flex/Flex"));
|
|
19
19
|
|
|
20
|
-
var _Typography = _interopRequireDefault(require("../../Typography/Typography"));
|
|
21
|
-
|
|
22
20
|
var _renderNode = _interopRequireWildcard(require("@zohodesk/utils/es/renderNode"));
|
|
23
21
|
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("./props/propTypes"));
|
|
25
|
-
|
|
26
|
-
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
27
|
-
|
|
28
22
|
var _constants = require("@zohodesk/dotkit/es/utils/constants");
|
|
29
23
|
|
|
30
24
|
var _constants2 = require("./constants");
|
|
31
25
|
|
|
26
|
+
var _Typography = _interopRequireDefault(require("../../Typography/Typography"));
|
|
27
|
+
|
|
32
28
|
var _Spinner = _interopRequireDefault(require("../shared/Spinner/Spinner"));
|
|
33
29
|
|
|
34
30
|
var _SuccessTick = _interopRequireDefault(require("../shared/SuccessTick/SuccessTick"));
|
|
35
31
|
|
|
36
32
|
var _cssJSLogic = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
37
33
|
|
|
34
|
+
var _propTypes = _interopRequireDefault(require("./props/propTypes"));
|
|
35
|
+
|
|
36
|
+
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
37
|
+
|
|
38
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
39
39
|
|
|
40
40
|
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); }
|
|
@@ -53,17 +53,18 @@ var getTypographySize = function getTypographySize(size) {
|
|
|
53
53
|
return _constants2.TYPOGRAPHY_SIZE_MAP[size] || '13';
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
var ButtonPresentational = /*#__PURE__*/(0, _react.forwardRef)(function ButtonPresentational(props, ref) {
|
|
57
|
+
var isLoading = props.isLoading,
|
|
58
|
+
isSuccess = props.isSuccess,
|
|
59
|
+
isDisabled = props.isDisabled,
|
|
60
|
+
isDisabledState = props.isDisabledState,
|
|
61
|
+
overlayActive = props.overlayActive,
|
|
60
62
|
variant = props.variant,
|
|
61
|
-
|
|
63
|
+
iconPlacement = props.iconPlacement,
|
|
62
64
|
loaderPlacement = props.loaderPlacement,
|
|
63
65
|
size = props.size,
|
|
64
66
|
iconName = props.iconName,
|
|
65
67
|
iconSize = props.iconSize,
|
|
66
|
-
iconPlacement = props.iconPlacement,
|
|
67
68
|
renderIcon = props.renderIcon,
|
|
68
69
|
renderBefore = props.renderBefore,
|
|
69
70
|
renderAfter = props.renderAfter,
|
|
@@ -71,132 +72,111 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function Button(props, ref) {
|
|
|
71
72
|
renderSuccess = props.renderSuccess,
|
|
72
73
|
children = props.children,
|
|
73
74
|
type = props.type,
|
|
74
|
-
onClick = props.onClick,
|
|
75
|
-
isDisabled = props.isDisabled,
|
|
76
|
-
isReadOnly = props.isReadOnly,
|
|
77
75
|
isSelected = props.isSelected,
|
|
78
|
-
shape = props.shape,
|
|
79
|
-
paletteShade = props.paletteShade,
|
|
80
|
-
disabledAppearance = props.disabledAppearance,
|
|
81
76
|
title = props.title,
|
|
82
77
|
customProps = props.customProps,
|
|
83
78
|
customAttributes = props.customAttributes,
|
|
84
79
|
a11yAttributes = props.a11yAttributes,
|
|
85
80
|
customId = props.customId,
|
|
86
|
-
testId = props.testId
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
81
|
+
testId = props.testId,
|
|
82
|
+
dataSelectorId = props.dataSelectorId,
|
|
83
|
+
handleClick = props.handleClick,
|
|
84
|
+
classNames = props.classNames;
|
|
85
|
+
var loaderOverlayClass = classNames.loaderOverlayClass,
|
|
86
|
+
successOverlayClass = classNames.successOverlayClass,
|
|
87
|
+
contentWrapperClass = classNames.contentWrapperClass,
|
|
88
|
+
textClassName = classNames.textClassName,
|
|
89
|
+
buttonClassName = classNames.buttonClassName,
|
|
90
|
+
iconClassName = classNames.iconClassName,
|
|
91
|
+
loaderClassName = classNames.loaderClassName,
|
|
92
|
+
successClassName = classNames.successClassName;
|
|
93
|
+
|
|
94
|
+
var _ref = customProps || _constants.DUMMY_OBJECT,
|
|
95
|
+
_ref$text = _ref.text,
|
|
96
|
+
contentProps = _ref$text === void 0 ? _constants.DUMMY_OBJECT : _ref$text,
|
|
97
|
+
_ref$icon = _ref.icon,
|
|
98
|
+
iconProps = _ref$icon === void 0 ? _constants.DUMMY_OBJECT : _ref$icon;
|
|
99
|
+
|
|
100
|
+
var _ref2 = customAttributes || _constants.DUMMY_OBJECT,
|
|
101
|
+
_ref2$button = _ref2.button,
|
|
102
|
+
buttonAttributes = _ref2$button === void 0 ? _constants.DUMMY_OBJECT : _ref2$button,
|
|
103
|
+
_ref2$contentWrapper = _ref2.contentWrapper,
|
|
104
|
+
contentWrapperAttributes = _ref2$contentWrapper === void 0 ? _constants.DUMMY_OBJECT : _ref2$contentWrapper,
|
|
105
|
+
_ref2$loader = _ref2.loader,
|
|
106
|
+
loaderAttributes = _ref2$loader === void 0 ? _constants.DUMMY_OBJECT : _ref2$loader,
|
|
107
|
+
_ref2$success = _ref2.success,
|
|
108
|
+
successAttributes = _ref2$success === void 0 ? _constants.DUMMY_OBJECT : _ref2$success,
|
|
109
|
+
_ref2$icon = _ref2.icon,
|
|
110
|
+
iconAttributes = _ref2$icon === void 0 ? _constants.DUMMY_OBJECT : _ref2$icon,
|
|
111
|
+
_ref2$text = _ref2.text,
|
|
112
|
+
textAttributes = _ref2$text === void 0 ? _constants.DUMMY_OBJECT : _ref2$text;
|
|
113
|
+
|
|
114
|
+
var iconTagAttributes = _objectSpread(_objectSpread({}, iconAttributes), testId && {
|
|
115
|
+
'data-test-id': "".concat(testId, "_icon")
|
|
116
|
+
});
|
|
121
117
|
|
|
122
118
|
var _renderLoader = function _renderLoader() {
|
|
123
|
-
if (!isLoading)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
status: status
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
var loaderClassName = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY ? loaderOverlayClass : '';
|
|
119
|
+
if (!isLoading) return null;
|
|
120
|
+
var isOverlay = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY;
|
|
121
|
+
var hasCustomLoader = (0, _renderNode.isRenderable)(renderLoader);
|
|
122
|
+
if (hasCustomLoader && !isOverlay) return (0, _renderNode["default"])(renderLoader, {
|
|
123
|
+
status: _constants2.STATUS.LOADING
|
|
124
|
+
});
|
|
134
125
|
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
135
126
|
$ui_displayMode: "flex",
|
|
136
127
|
$ui_alignItems: "center",
|
|
137
128
|
$ui_justifyContent: "center",
|
|
138
|
-
$ui_className:
|
|
139
|
-
testId: testId ? "".concat(testId, "_loader") : undefined
|
|
140
|
-
|
|
129
|
+
$ui_className: isOverlay ? loaderOverlayClass : '',
|
|
130
|
+
testId: testId ? "".concat(testId, "_loader") : undefined,
|
|
131
|
+
customId: customId ? "".concat(customId, "_loader") : undefined,
|
|
132
|
+
$tagAttributes_container: hasCustomLoader ? undefined : loaderAttributes
|
|
133
|
+
}, hasCustomLoader ? (0, _renderNode["default"])(renderLoader, {
|
|
134
|
+
status: _constants2.STATUS.LOADING
|
|
135
|
+
}) : /*#__PURE__*/_react["default"].createElement(_Spinner["default"], {
|
|
136
|
+
customClass: loaderClassName
|
|
137
|
+
}));
|
|
141
138
|
};
|
|
142
139
|
|
|
143
140
|
var _renderSuccess = function _renderSuccess() {
|
|
144
|
-
if (!isSuccess)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
status: status
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
var successClassName = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY ? successOverlayClass : '';
|
|
141
|
+
if (!isSuccess) return null;
|
|
142
|
+
var isOverlay = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY;
|
|
143
|
+
var hasCustomSuccess = (0, _renderNode.isRenderable)(renderSuccess);
|
|
144
|
+
if (hasCustomSuccess && !isOverlay) return (0, _renderNode["default"])(renderSuccess, {
|
|
145
|
+
status: _constants2.STATUS.SUCCESS
|
|
146
|
+
});
|
|
155
147
|
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
156
148
|
$ui_displayMode: "flex",
|
|
157
149
|
$ui_alignItems: "center",
|
|
158
150
|
$ui_justifyContent: "center",
|
|
159
|
-
$ui_className:
|
|
160
|
-
testId: testId ? "".concat(testId, "_success") : undefined
|
|
161
|
-
|
|
151
|
+
$ui_className: isOverlay ? successOverlayClass : '',
|
|
152
|
+
testId: testId ? "".concat(testId, "_success") : undefined,
|
|
153
|
+
customId: customId ? "".concat(customId, "_success") : undefined,
|
|
154
|
+
$tagAttributes_container: hasCustomSuccess ? undefined : successAttributes
|
|
155
|
+
}, hasCustomSuccess ? (0, _renderNode["default"])(renderSuccess, {
|
|
156
|
+
status: _constants2.STATUS.SUCCESS
|
|
157
|
+
}) : /*#__PURE__*/_react["default"].createElement(_SuccessTick["default"], {
|
|
158
|
+
customClass: successClassName
|
|
159
|
+
}));
|
|
162
160
|
};
|
|
163
161
|
|
|
164
162
|
var _renderIconNode = function _renderIconNode() {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
163
|
+
var showIcon = variant !== _constants2.VARIANT.TEXT && (renderIcon || iconName);
|
|
164
|
+
if (!showIcon) return null;
|
|
165
|
+
if ((0, _renderNode.isRenderable)(renderIcon)) return (0, _renderNode["default"])(renderIcon, {
|
|
166
|
+
iconName: iconName,
|
|
167
|
+
iconSize: iconSize
|
|
168
|
+
});
|
|
173
169
|
return /*#__PURE__*/_react["default"].createElement(_Icon["default"], _extends({}, iconProps, {
|
|
174
170
|
iconClass: iconClassName,
|
|
175
171
|
name: iconName,
|
|
176
172
|
size: iconSize,
|
|
177
173
|
tagAttributes: iconTagAttributes,
|
|
178
|
-
dataId:
|
|
174
|
+
dataId: customId ? "".concat(customId, "_icon") : undefined
|
|
179
175
|
}));
|
|
180
176
|
};
|
|
181
177
|
|
|
182
|
-
var _renderBeforeNode = function _renderBeforeNode() {
|
|
183
|
-
if (!(0, _renderNode.isRenderable)(renderBefore)) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return (0, _renderNode["default"])(renderBefore, props);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
var _renderAfterNode = function _renderAfterNode() {
|
|
191
|
-
if (!(0, _renderNode.isRenderable)(renderAfter)) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return (0, _renderNode["default"])(renderAfter, props);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
178
|
var _renderContent = function _renderContent() {
|
|
199
|
-
var shouldShowText = variant !== _constants2.VARIANT.ICON && children
|
|
179
|
+
var shouldShowText = variant !== _constants2.VARIANT.ICON && children != null && (typeof children !== 'string' || children.trim() !== '');
|
|
200
180
|
var showLoaderStart = isLoading && loaderPlacement === _constants2.LOADER_PLACEMENT.START;
|
|
201
181
|
var showLoaderAfter = isLoading && loaderPlacement === _constants2.LOADER_PLACEMENT.END;
|
|
202
182
|
var showSuccessStart = isSuccess && loaderPlacement === _constants2.LOADER_PLACEMENT.START;
|
|
@@ -207,31 +187,135 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function Button(props, ref) {
|
|
|
207
187
|
$flag_shrink: true,
|
|
208
188
|
$ui_alignItems: "center",
|
|
209
189
|
$ui_justifyContent: "center",
|
|
210
|
-
$ui_className: contentWrapperClass
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
190
|
+
$ui_className: contentWrapperClass,
|
|
191
|
+
$tagAttributes_container: contentWrapperAttributes
|
|
192
|
+
}, showLoaderStart ? _renderLoader() : null, showSuccessStart ? _renderSuccess() : null, (0, _renderNode.isRenderable)(renderBefore) ? (0, _renderNode["default"])(renderBefore, props) : null, iconPlacement === _constants2.ICON_PLACEMENT.START ? _renderIconNode() : null, shouldShowText ? typeof children === 'string' ? /*#__PURE__*/_react["default"].createElement(_Typography["default"], _extends({
|
|
193
|
+
size: getTypographySize(size)
|
|
194
|
+
}, contentProps, {
|
|
195
|
+
tagAttributes: textAttributes,
|
|
196
|
+
customClass: textClassName,
|
|
197
|
+
isDotted: true
|
|
198
|
+
}), children) : children : null, iconPlacement === _constants2.ICON_PLACEMENT.END ? _renderIconNode() : null, (0, _renderNode.isRenderable)(renderAfter) ? (0, _renderNode["default"])(renderAfter, props) : null, showLoaderAfter ? _renderLoader() : null, showSuccessAfter ? _renderSuccess() : null);
|
|
216
199
|
};
|
|
217
200
|
|
|
218
|
-
var containerAttributes = _objectSpread(_objectSpread({},
|
|
219
|
-
'data-id': customId,
|
|
220
|
-
|
|
201
|
+
var containerAttributes = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, buttonAttributes), customId && {
|
|
202
|
+
'data-id': isDisabled ? "".concat(customId, "_disabled") : customId
|
|
203
|
+
}), testId && {
|
|
204
|
+
'data-test-id': isDisabled ? "".concat(testId, "_disabled") : testId
|
|
205
|
+
}), dataSelectorId && {
|
|
206
|
+
'data-selector-id': dataSelectorId
|
|
207
|
+
}), title && {
|
|
221
208
|
'data-title': title
|
|
222
209
|
});
|
|
223
210
|
|
|
224
|
-
return /*#__PURE__*/_react["default"].createElement("button", _extends({}, containerAttributes,
|
|
211
|
+
return /*#__PURE__*/_react["default"].createElement("button", _extends({}, containerAttributes, {
|
|
212
|
+
"aria-busy": isLoading,
|
|
213
|
+
"aria-disabled": isDisabledState,
|
|
214
|
+
"aria-pressed": isSelected
|
|
215
|
+
}, a11yAttributes, {
|
|
225
216
|
ref: ref,
|
|
226
217
|
type: type,
|
|
227
218
|
className: (0, _cssUtility.cn)(buttonClassName),
|
|
228
|
-
|
|
229
|
-
"aria-disabled": isDisabledState,
|
|
230
|
-
"aria-readonly": isReadOnly,
|
|
231
|
-
"aria-pressed": isSelected,
|
|
232
|
-
onClick: _handleClick
|
|
219
|
+
onClick: handleClick
|
|
233
220
|
}), _renderContent(), overlayActive ? isLoading ? _renderLoader() : _renderSuccess() : null);
|
|
234
221
|
});
|
|
222
|
+
exports.ButtonPresentational = ButtonPresentational;
|
|
223
|
+
ButtonPresentational.displayName = 'ButtonPresentational';
|
|
224
|
+
var Button = /*#__PURE__*/(0, _react.forwardRef)(function Button(props, ref) {
|
|
225
|
+
var palette = props.palette,
|
|
226
|
+
appearance = props.appearance,
|
|
227
|
+
hoverAppearance = props.hoverAppearance,
|
|
228
|
+
selectedAppearance = props.selectedAppearance,
|
|
229
|
+
variant = props.variant,
|
|
230
|
+
status = props.status,
|
|
231
|
+
loaderPlacement = props.loaderPlacement,
|
|
232
|
+
size = props.size,
|
|
233
|
+
iconName = props.iconName,
|
|
234
|
+
iconSize = props.iconSize,
|
|
235
|
+
iconPlacement = props.iconPlacement,
|
|
236
|
+
renderIcon = props.renderIcon,
|
|
237
|
+
renderBefore = props.renderBefore,
|
|
238
|
+
renderAfter = props.renderAfter,
|
|
239
|
+
renderLoader = props.renderLoader,
|
|
240
|
+
renderSuccess = props.renderSuccess,
|
|
241
|
+
children = props.children,
|
|
242
|
+
type = props.type,
|
|
243
|
+
onClick = props.onClick,
|
|
244
|
+
isDisabled = props.isDisabled,
|
|
245
|
+
isSelected = props.isSelected,
|
|
246
|
+
shape = props.shape,
|
|
247
|
+
disabledAppearance = props.disabledAppearance,
|
|
248
|
+
title = props.title,
|
|
249
|
+
customProps = props.customProps,
|
|
250
|
+
customAttributes = props.customAttributes,
|
|
251
|
+
a11yAttributes = props.a11yAttributes,
|
|
252
|
+
customId = props.customId,
|
|
253
|
+
testId = props.testId,
|
|
254
|
+
dataSelectorId = props.dataSelectorId,
|
|
255
|
+
customClass = props.customClass;
|
|
256
|
+
var isLoading = status === _constants2.STATUS.LOADING;
|
|
257
|
+
var isSuccess = status === _constants2.STATUS.SUCCESS;
|
|
258
|
+
var isDisabledState = isDisabled || isLoading;
|
|
259
|
+
var overlayActive = (isLoading || isSuccess) && loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY;
|
|
260
|
+
var classNames = (0, _react.useMemo)(function () {
|
|
261
|
+
return (0, _cssJSLogic["default"])({
|
|
262
|
+
props: {
|
|
263
|
+
palette: palette,
|
|
264
|
+
appearance: appearance,
|
|
265
|
+
hoverAppearance: hoverAppearance,
|
|
266
|
+
selectedAppearance: selectedAppearance,
|
|
267
|
+
size: size,
|
|
268
|
+
variant: variant,
|
|
269
|
+
status: status,
|
|
270
|
+
isDisabled: isDisabled,
|
|
271
|
+
isSelected: isSelected,
|
|
272
|
+
shape: shape,
|
|
273
|
+
loaderPlacement: loaderPlacement,
|
|
274
|
+
disabledAppearance: disabledAppearance,
|
|
275
|
+
customClass: customClass
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}, [palette, appearance, hoverAppearance, selectedAppearance, size, variant, status, isDisabled, isSelected, shape, loaderPlacement, disabledAppearance, customClass]);
|
|
279
|
+
|
|
280
|
+
var handleClick = function handleClick(event) {
|
|
281
|
+
if (isDisabledState) return;
|
|
282
|
+
onClick(event);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
var essentials = {
|
|
286
|
+
isLoading: isLoading,
|
|
287
|
+
isSuccess: isSuccess,
|
|
288
|
+
isDisabled: isDisabled,
|
|
289
|
+
isDisabledState: isDisabledState,
|
|
290
|
+
overlayActive: overlayActive,
|
|
291
|
+
variant: variant,
|
|
292
|
+
iconPlacement: iconPlacement,
|
|
293
|
+
loaderPlacement: loaderPlacement,
|
|
294
|
+
size: size,
|
|
295
|
+
iconName: iconName,
|
|
296
|
+
iconSize: iconSize,
|
|
297
|
+
renderIcon: renderIcon,
|
|
298
|
+
renderBefore: renderBefore,
|
|
299
|
+
renderAfter: renderAfter,
|
|
300
|
+
renderLoader: renderLoader,
|
|
301
|
+
renderSuccess: renderSuccess,
|
|
302
|
+
children: children,
|
|
303
|
+
type: type,
|
|
304
|
+
isSelected: isSelected,
|
|
305
|
+
title: title,
|
|
306
|
+
customProps: customProps,
|
|
307
|
+
customAttributes: customAttributes,
|
|
308
|
+
a11yAttributes: a11yAttributes,
|
|
309
|
+
customId: customId,
|
|
310
|
+
testId: testId,
|
|
311
|
+
dataSelectorId: dataSelectorId,
|
|
312
|
+
handleClick: handleClick
|
|
313
|
+
};
|
|
314
|
+
return /*#__PURE__*/_react["default"].createElement(ButtonPresentational, _extends({}, essentials, {
|
|
315
|
+
classNames: classNames,
|
|
316
|
+
ref: ref
|
|
317
|
+
}));
|
|
318
|
+
});
|
|
235
319
|
Button.propTypes = _propTypes["default"];
|
|
236
320
|
Button.defaultProps = _defaultProps["default"];
|
|
237
321
|
Button.displayName = 'Button';
|
package/lib/v1/Button/README.md
CHANGED
|
@@ -18,93 +18,159 @@ import Button from '@zohodesk/components/es/v1/Button/Button';
|
|
|
18
18
|
</Button>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
### With Palette
|
|
21
|
+
### With Palette
|
|
22
22
|
|
|
23
23
|
```jsx
|
|
24
|
-
<Button palette="
|
|
24
|
+
<Button palette="brand">Save</Button>
|
|
25
25
|
<Button palette="danger">Delete</Button>
|
|
26
26
|
<Button palette="success">Confirm</Button>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
### With Appearance
|
|
30
|
+
|
|
31
|
+
`appearance`, `hoverAppearance`, and `selectedAppearance` are objects with optional `bg`, `border`, and `text` keys. Each key accepts `true` (use palette color), `false` (suppress), or a palette name string.
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
<Button palette="brand" appearance={{ bg: false, border: true }}>
|
|
35
|
+
Ghost
|
|
36
|
+
</Button>
|
|
37
|
+
|
|
38
|
+
<Button
|
|
39
|
+
palette="brand"
|
|
40
|
+
appearance={{ bg: false, border: true }}
|
|
41
|
+
hoverAppearance={{ bg: false, border: true }}
|
|
42
|
+
selectedAppearance={{ bg: false, border: true }}
|
|
43
|
+
>
|
|
44
|
+
Ghost with states
|
|
45
|
+
</Button>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Using Presets
|
|
49
|
+
|
|
50
|
+
```jsx
|
|
51
|
+
import {
|
|
52
|
+
BRAND_GHOST,
|
|
53
|
+
BRAND_TEXT_ONLY,
|
|
54
|
+
SECONDARY_GHOST_BRAND_TINTED_ONSELECT,
|
|
55
|
+
SECONDARY_GHOST_CANCEL,
|
|
56
|
+
BRAND_TINTED_OUTLINE,
|
|
57
|
+
BRAND_TEXT_TINTED_HOVER
|
|
58
|
+
} from '@zohodesk/components/es/v1/Button/constants/presets';
|
|
59
|
+
|
|
60
|
+
<Button {...BRAND_GHOST}>Brand Ghost</Button>
|
|
61
|
+
<Button {...BRAND_TEXT_ONLY}>Brand Text Only</Button>
|
|
62
|
+
<Button {...SECONDARY_GHOST_BRAND_TINTED_ONSELECT}>Secondary Ghost</Button>
|
|
63
|
+
```
|
|
64
|
+
|
|
29
65
|
### With Icon
|
|
30
66
|
|
|
31
67
|
```jsx
|
|
32
68
|
<Button variant="icon" iconName="ZD-plus" iconSize={20} />
|
|
33
69
|
|
|
34
|
-
<Button variant="iconWithText" iconName="ZD-plus" iconPlacement="
|
|
70
|
+
<Button variant="iconWithText" iconName="ZD-plus" iconPlacement="start">
|
|
35
71
|
Add Item
|
|
36
72
|
</Button>
|
|
37
73
|
```
|
|
38
74
|
|
|
39
|
-
### Loading State
|
|
75
|
+
### Loading / Success State
|
|
40
76
|
|
|
41
77
|
```jsx
|
|
42
|
-
<Button status="loading" loaderPlacement="overlay">
|
|
43
|
-
|
|
44
|
-
</Button>
|
|
45
|
-
|
|
46
|
-
<Button status="loading" loaderPlacement="start">
|
|
47
|
-
Loading
|
|
48
|
-
</Button>
|
|
78
|
+
<Button status="loading" loaderPlacement="overlay">Saving...</Button>
|
|
79
|
+
<Button status="loading" loaderPlacement="start">Loading</Button>
|
|
80
|
+
<Button status="success">Done</Button>
|
|
49
81
|
```
|
|
50
82
|
|
|
51
|
-
### Disabled
|
|
83
|
+
### Disabled
|
|
52
84
|
|
|
53
85
|
```jsx
|
|
54
86
|
<Button isDisabled>Disabled</Button>
|
|
55
|
-
<Button
|
|
87
|
+
<Button isDisabled disabledAppearance="strike">Disabled Strike</Button>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Shape
|
|
91
|
+
|
|
92
|
+
```jsx
|
|
93
|
+
<Button shape="pill">Pill</Button>
|
|
94
|
+
<Button shape="rectangle">Rectangle</Button>
|
|
95
|
+
<Button shape="roundedRectangle">Rounded</Button>
|
|
56
96
|
```
|
|
57
97
|
|
|
58
98
|
## Props
|
|
59
99
|
|
|
60
100
|
| Prop | Type | Default | Description |
|
|
61
101
|
|---|---|---|---|
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `borderAppearance` | `oneOf: default, onHover, none` | `default` | Border behavior |
|
|
102
|
+
| `palette` | `oneOf: brand, brandLighter, info, infoLighter, secondary, secondaryLighter, danger, dangerLighter, success, successLighter, warning, warningLighter` | `''` | Color palette |
|
|
103
|
+
| `appearance` | `{ bg?, border?, text? }` | `{ bg: true, text: true }` | Color treatments at rest. Values: `true`, `false`, or a palette name |
|
|
104
|
+
| `hoverAppearance` | `{ bg?, border?, text? }` | `{ bg: true, text: true }` | Color treatments on hover/focus/active |
|
|
105
|
+
| `selectedAppearance` | `{ bg?, border?, text? }` | `{ bg: true, text: true }` | Color treatments when `isSelected` is true |
|
|
67
106
|
| `variant` | `oneOf: text, icon, iconWithText` | `text` | Display variant |
|
|
68
107
|
| `size` | `oneOf: small, medium, large, full` | `medium` | Size variant |
|
|
69
108
|
| `status` | `oneOf: default, loading, success` | `default` | Status state |
|
|
70
|
-
| `loaderPlacement` | `oneOf: start, end, overlay` | `overlay` | Where loader appears |
|
|
109
|
+
| `loaderPlacement` | `oneOf: start, end, overlay` | `overlay` | Where the loader appears |
|
|
110
|
+
| `shape` | `oneOf: pill, rectangle, roundedRectangle` | `roundedRectangle` | Border shape |
|
|
71
111
|
| `iconName` | `string` | — | Icon name from `@zohodesk/icons` |
|
|
72
112
|
| `iconSize` | `number` | `16` | Icon size in pixels |
|
|
73
|
-
| `iconPlacement` | `oneOf:
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
113
|
+
| `iconPlacement` | `oneOf: start, end` | `start` | Icon position relative to text |
|
|
114
|
+
| `disabledAppearance` | `oneOf: none, dull, strike` | `dull` | Visual style when disabled |
|
|
115
|
+
| `isDisabled` | `bool` | `false` | Disables the button |
|
|
116
|
+
| `isSelected` | `bool` | `false` | Selected/pressed state (`aria-pressed`) |
|
|
117
|
+
| `type` | `oneOf: button, submit, reset` | `button` | HTML button type |
|
|
118
|
+
| `onClick` | `func` | — | Click handler (suppressed when disabled or loading) |
|
|
119
|
+
| `title` | `string` | — | Tooltip / `data-title` attribute |
|
|
120
|
+
| `children` | `node` | — | Button label content |
|
|
76
121
|
| `renderIcon` | `node \| func` | — | Custom icon render slot |
|
|
77
122
|
| `renderBefore` | `node \| func` | — | Slot before main content |
|
|
78
123
|
| `renderAfter` | `node \| func` | — | Slot after main content |
|
|
79
124
|
| `renderLoader` | `node \| func` | — | Custom loader render slot |
|
|
80
125
|
| `renderSuccess` | `node \| func` | — | Custom success render slot |
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
|
|
126
|
+
| `customId` | `string` | — | `data-id` attribute |
|
|
127
|
+
| `testId` | `string` | — | `data-test-id` attribute |
|
|
128
|
+
| `dataSelectorId` | `string` | — | `data-selector-id` attribute |
|
|
129
|
+
| `a11yAttributes` | `object` | `{}` | Extra ARIA/accessibility attributes spread onto `<button>` |
|
|
130
|
+
| `customClass` | `{ wrapper?, text?, icon?, loader?, success? }` | `{}` | CSS class overrides per part |
|
|
131
|
+
| `customProps` | `{ text?, icon? }` | `{}` | Extra props forwarded to text/icon sub-elements |
|
|
132
|
+
| `customAttributes` | `{ button?, contentWrapper?, loader?, success?, icon?, text? }` | `{}` | Extra HTML attributes per internal element |
|
|
133
|
+
|
|
134
|
+
## Presets
|
|
135
|
+
|
|
136
|
+
Ready-made palette + appearance combinations exported from `constants/presets`:
|
|
137
|
+
|
|
138
|
+
| Name | Palette | Appearance | Description |
|
|
139
|
+
|---|---|---|---|
|
|
140
|
+
| `BRAND_GHOST` | `brand` | `{ bg: false, border: true }` | Transparent bg, brand border |
|
|
141
|
+
| `BRAND_TEXT_ONLY` | `brand` | `{ bg: false }` | Text only, no border |
|
|
142
|
+
| `BRAND_TINTED_OUTLINE` | `brandLighter` | `{ border: true }` | Tinted fill, brand border |
|
|
143
|
+
| `SUCCESS_GHOST` | `success` | `{ bg: false, border: true }` | Transparent bg, success border |
|
|
144
|
+
| `SUCCESS_TEXT_ONLY` | `success` | `{ bg: false }` | Text only, no border |
|
|
145
|
+
| `SUCCESS_TINTED_OUTLINE` | `successLighter` | `{ border: true }` | Tinted fill, success border |
|
|
146
|
+
| `SECONDARY_GHOST_BRAND_TINTED_ONSELECT` | `secondary` | `{ bg: false, border: true }` | Secondary ghost; selected state switches to brand tint |
|
|
147
|
+
| `SECONDARY_GHOST_CANCEL` | `secondary` | `{ bg: false, border: true }` | Secondary ghost without a selected state; cancel / dismiss buttons |
|
|
148
|
+
| `BLACK_TEXT_BRAND_ONHOVER` | `brand` | `{ bg: false, text: 'black' }` | Black text, brand color on hover |
|
|
149
|
+
| `BRAND_BG_ONSELECT` | `brand` | `{ bg: false, border: true }` | Ghost without a defined selected state |
|
|
150
|
+
| `BRAND_TEXT_TINTED_HOVER` | `brandLighter` | `{ bg: false }` | Ghost that becomes tinted on hover |
|
|
151
|
+
| `BRAND_TEXT_TINTED_DANGER_HOVER` | `brandLighter` | `{ bg: false }` | Ghost that becomes danger-tinted on hover |
|
|
89
152
|
|
|
90
153
|
## Customization
|
|
91
154
|
|
|
92
155
|
### Parts
|
|
93
156
|
|
|
94
|
-
| Part | Element | Description |
|
|
157
|
+
| Part key | Element | Description |
|
|
95
158
|
|---|---|---|
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
|
|
99
|
-
|
|
159
|
+
| `button` | `<button>` | Outermost button element |
|
|
160
|
+
| `contentWrapper` | Inner `<Flex>` | Wraps icon + text content |
|
|
161
|
+
| `text` | `<Typography>` | Text label |
|
|
162
|
+
| `icon` | `<Icon>` | Icon element |
|
|
163
|
+
| `loader` | `<Flex>` | Loader wrapper |
|
|
164
|
+
| `success` | `<Flex>` | Success tick wrapper |
|
|
100
165
|
|
|
101
|
-
|
|
166
|
+
Pass class overrides via `customClass`, extra props via `customProps`, or arbitrary HTML attributes via `customAttributes`.
|
|
102
167
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
168
|
+
```jsx
|
|
169
|
+
<Button
|
|
170
|
+
customClass={{ wrapper: 'myBtn', text: 'myBtnText' }}
|
|
171
|
+
customAttributes={{ button: { 'data-analytics': 'save' } }}
|
|
172
|
+
a11yAttributes={{ 'aria-label': 'Save document' }}
|
|
173
|
+
>
|
|
174
|
+
Save
|
|
175
|
+
</Button>
|
|
176
|
+
```
|