@zohodesk/components 1.0.0-temp-259.3 → 1.0.0-temp-259.5
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/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +3 -3
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +6 -6
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +6 -6
- package/es/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +3 -3
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +1 -1
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +4 -4
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +1 -1
- package/es/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +1 -1
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +75 -75
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +1 -1
- package/es/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +4 -4
- package/es/Tag/__tests__/__snapshots__/Tag.spec.js.snap +48 -48
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +3 -3
- package/es/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +10 -10
- package/es/v1/Button/Button.js +56 -25
- package/es/v1/Button/README.md +4 -2
- package/es/v1/Button/__tests__/Button.spec.js +3 -3
- package/es/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +144 -21
- package/es/v1/Button/constants/index.js +3 -3
- package/es/v1/Button/constants/presets.js +11 -0
- package/es/v1/Button/css/cssJSLogic.js +5 -6
- package/es/v1/Button/props/defaultProps.js +3 -0
- package/es/v1/helpers/colorHelpers/background/backgroundColor.module.css +31 -527
- package/es/v1/helpers/colorHelpers/border/borderColor.module.css +24 -408
- package/es/v1/helpers/colorHelpers/colorHelper.js +8 -5
- package/es/v1/helpers/colorHelpers/paletteUtilities.README.md +141 -336
- package/es/v1/helpers/colorHelpers/text/textColor.module.css +72 -288
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +3 -3
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +6 -6
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +6 -6
- package/lib/DateTime/__tests__/__snapshots__/DateTimePopupHeader.spec.js.snap +3 -3
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +1 -1
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +4 -4
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +1 -1
- package/lib/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +1 -1
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +75 -75
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +1 -1
- package/lib/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +4 -4
- package/lib/Tag/__tests__/__snapshots__/Tag.spec.js.snap +48 -48
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +3 -3
- package/lib/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +10 -10
- package/lib/v1/Button/Button.js +49 -25
- package/lib/v1/Button/README.md +4 -2
- package/lib/v1/Button/__tests__/Button.spec.js +2 -2
- package/lib/v1/Button/__tests__/__snapshots__/Button.spec.js.snap +144 -21
- package/lib/v1/Button/constants/index.js +3 -3
- package/lib/v1/Button/constants/presets.js +13 -1
- package/lib/v1/Button/css/cssJSLogic.js +10 -13
- package/lib/v1/Button/props/defaultProps.js +3 -0
- package/lib/v1/helpers/colorHelpers/background/backgroundColor.module.css +31 -527
- package/lib/v1/helpers/colorHelpers/border/borderColor.module.css +24 -408
- package/lib/v1/helpers/colorHelpers/colorHelper.js +8 -5
- package/lib/v1/helpers/colorHelpers/paletteUtilities.README.md +141 -336
- package/lib/v1/helpers/colorHelpers/text/textColor.module.css +72 -288
- package/package.json +7 -7
package/lib/v1/Button/Button.js
CHANGED
|
@@ -111,12 +111,10 @@ var ButtonPresentational = /*#__PURE__*/(0, _react.forwardRef)(function ButtonPr
|
|
|
111
111
|
_ref2$text = _ref2.text,
|
|
112
112
|
textAttributes = _ref2$text === void 0 ? _constants.DUMMY_OBJECT : _ref2$text;
|
|
113
113
|
|
|
114
|
-
var iconTagAttributes = _objectSpread(_objectSpread({}, iconAttributes),
|
|
115
|
-
'data-test-id':
|
|
114
|
+
var iconTagAttributes = _objectSpread(_objectSpread({}, iconAttributes), testId && {
|
|
115
|
+
'data-test-id': "".concat(testId, "_icon")
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
var showIcon = variant !== _constants2.VARIANT.TEXT && (renderIcon || iconName);
|
|
119
|
-
|
|
120
118
|
var _renderLoader = function _renderLoader() {
|
|
121
119
|
if (!isLoading) return null;
|
|
122
120
|
var isOverlay = loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY;
|
|
@@ -124,13 +122,15 @@ var ButtonPresentational = /*#__PURE__*/(0, _react.forwardRef)(function ButtonPr
|
|
|
124
122
|
if (hasCustomLoader && !isOverlay) return (0, _renderNode["default"])(renderLoader, {
|
|
125
123
|
status: _constants2.STATUS.LOADING
|
|
126
124
|
});
|
|
127
|
-
return /*#__PURE__*/_react["default"].createElement(_Flex["default"],
|
|
125
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
128
126
|
$ui_displayMode: "flex",
|
|
129
127
|
$ui_alignItems: "center",
|
|
130
128
|
$ui_justifyContent: "center",
|
|
131
129
|
$ui_className: isOverlay ? loaderOverlayClass : '',
|
|
132
|
-
testId: testId ? "".concat(testId, "_loader") : undefined
|
|
133
|
-
|
|
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
134
|
status: _constants2.STATUS.LOADING
|
|
135
135
|
}) : /*#__PURE__*/_react["default"].createElement(_Spinner["default"], {
|
|
136
136
|
customClass: loaderClassName
|
|
@@ -144,13 +144,15 @@ var ButtonPresentational = /*#__PURE__*/(0, _react.forwardRef)(function ButtonPr
|
|
|
144
144
|
if (hasCustomSuccess && !isOverlay) return (0, _renderNode["default"])(renderSuccess, {
|
|
145
145
|
status: _constants2.STATUS.SUCCESS
|
|
146
146
|
});
|
|
147
|
-
return /*#__PURE__*/_react["default"].createElement(_Flex["default"],
|
|
147
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
148
148
|
$ui_displayMode: "flex",
|
|
149
149
|
$ui_alignItems: "center",
|
|
150
150
|
$ui_justifyContent: "center",
|
|
151
151
|
$ui_className: isOverlay ? successOverlayClass : '',
|
|
152
|
-
testId: testId ? "".concat(testId, "_success") : undefined
|
|
153
|
-
|
|
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, {
|
|
154
156
|
status: _constants2.STATUS.SUCCESS
|
|
155
157
|
}) : /*#__PURE__*/_react["default"].createElement(_SuccessTick["default"], {
|
|
156
158
|
customClass: successClassName
|
|
@@ -158,14 +160,18 @@ var ButtonPresentational = /*#__PURE__*/(0, _react.forwardRef)(function ButtonPr
|
|
|
158
160
|
};
|
|
159
161
|
|
|
160
162
|
var _renderIconNode = function _renderIconNode() {
|
|
163
|
+
var showIcon = variant !== _constants2.VARIANT.TEXT && (renderIcon || iconName);
|
|
161
164
|
if (!showIcon) return null;
|
|
162
|
-
if ((0, _renderNode.isRenderable)(renderIcon)) return (0, _renderNode["default"])(renderIcon
|
|
165
|
+
if ((0, _renderNode.isRenderable)(renderIcon)) return (0, _renderNode["default"])(renderIcon, {
|
|
166
|
+
iconName: iconName,
|
|
167
|
+
iconSize: iconSize
|
|
168
|
+
});
|
|
163
169
|
return /*#__PURE__*/_react["default"].createElement(_Icon["default"], _extends({}, iconProps, {
|
|
164
170
|
iconClass: iconClassName,
|
|
165
171
|
name: iconName,
|
|
166
172
|
size: iconSize,
|
|
167
173
|
tagAttributes: iconTagAttributes,
|
|
168
|
-
dataId:
|
|
174
|
+
dataId: customId ? "".concat(customId, "_icon") : undefined
|
|
169
175
|
}));
|
|
170
176
|
};
|
|
171
177
|
|
|
@@ -175,32 +181,36 @@ var ButtonPresentational = /*#__PURE__*/(0, _react.forwardRef)(function ButtonPr
|
|
|
175
181
|
var showLoaderAfter = isLoading && loaderPlacement === _constants2.LOADER_PLACEMENT.END;
|
|
176
182
|
var showSuccessStart = isSuccess && loaderPlacement === _constants2.LOADER_PLACEMENT.START;
|
|
177
183
|
var showSuccessAfter = isSuccess && loaderPlacement === _constants2.LOADER_PLACEMENT.END;
|
|
178
|
-
return /*#__PURE__*/_react["default"].createElement(_Flex["default"],
|
|
184
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
179
185
|
$ui_displayMode: "flex",
|
|
180
186
|
$ui_direction: "row",
|
|
181
187
|
$flag_shrink: true,
|
|
182
188
|
$ui_alignItems: "center",
|
|
183
189
|
$ui_justifyContent: "center",
|
|
184
|
-
$ui_className: contentWrapperClass
|
|
185
|
-
|
|
186
|
-
|
|
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)
|
|
187
194
|
}, contentProps, {
|
|
188
195
|
tagAttributes: textAttributes,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}), children) : children : null, iconPlacement === _constants2.ICON_PLACEMENT.
|
|
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);
|
|
192
199
|
};
|
|
193
200
|
|
|
194
|
-
var containerAttributes = _objectSpread(_objectSpread({}, buttonAttributes),
|
|
195
|
-
'data-id': isDisabled ? "".concat(customId, "_disabled") : customId
|
|
196
|
-
|
|
197
|
-
'data-
|
|
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 && {
|
|
198
208
|
'data-title': title
|
|
199
209
|
});
|
|
200
210
|
|
|
201
211
|
return /*#__PURE__*/_react["default"].createElement("button", _extends({}, containerAttributes, {
|
|
202
212
|
"aria-busy": isLoading,
|
|
203
|
-
disabled: isDisabledState,
|
|
213
|
+
"aria-disabled": isDisabledState,
|
|
204
214
|
"aria-pressed": isSelected
|
|
205
215
|
}, a11yAttributes, {
|
|
206
216
|
ref: ref,
|
|
@@ -249,7 +259,21 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function Button(props, ref) {
|
|
|
249
259
|
var overlayActive = (isLoading || isSuccess) && loaderPlacement === _constants2.LOADER_PLACEMENT.OVERLAY;
|
|
250
260
|
var classNames = (0, _react.useMemo)(function () {
|
|
251
261
|
return (0, _cssJSLogic["default"])({
|
|
252
|
-
props:
|
|
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
|
+
}
|
|
253
277
|
});
|
|
254
278
|
}, [palette, appearance, hoverAppearance, selectedAppearance, size, variant, status, isDisabled, isSelected, shape, loaderPlacement, disabledAppearance, customClass]);
|
|
255
279
|
|
package/lib/v1/Button/README.md
CHANGED
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
BRAND_GHOST,
|
|
53
53
|
BRAND_TEXT_ONLY,
|
|
54
54
|
SECONDARY_GHOST_BRAND_TINTED_ONSELECT,
|
|
55
|
+
SECONDARY_GHOST_CANCEL,
|
|
55
56
|
BRAND_TINTED_OUTLINE,
|
|
56
57
|
BRAND_TEXT_TINTED_HOVER
|
|
57
58
|
} from '@zohodesk/components/es/v1/Button/constants/presets';
|
|
@@ -66,7 +67,7 @@ import {
|
|
|
66
67
|
```jsx
|
|
67
68
|
<Button variant="icon" iconName="ZD-plus" iconSize={20} />
|
|
68
69
|
|
|
69
|
-
<Button variant="iconWithText" iconName="ZD-plus" iconPlacement="
|
|
70
|
+
<Button variant="iconWithText" iconName="ZD-plus" iconPlacement="start">
|
|
70
71
|
Add Item
|
|
71
72
|
</Button>
|
|
72
73
|
```
|
|
@@ -109,7 +110,7 @@ import {
|
|
|
109
110
|
| `shape` | `oneOf: pill, rectangle, roundedRectangle` | `roundedRectangle` | Border shape |
|
|
110
111
|
| `iconName` | `string` | — | Icon name from `@zohodesk/icons` |
|
|
111
112
|
| `iconSize` | `number` | `16` | Icon size in pixels |
|
|
112
|
-
| `iconPlacement` | `oneOf:
|
|
113
|
+
| `iconPlacement` | `oneOf: start, end` | `start` | Icon position relative to text |
|
|
113
114
|
| `disabledAppearance` | `oneOf: none, dull, strike` | `dull` | Visual style when disabled |
|
|
114
115
|
| `isDisabled` | `bool` | `false` | Disables the button |
|
|
115
116
|
| `isSelected` | `bool` | `false` | Selected/pressed state (`aria-pressed`) |
|
|
@@ -143,6 +144,7 @@ Ready-made palette + appearance combinations exported from `constants/presets`:
|
|
|
143
144
|
| `SUCCESS_TEXT_ONLY` | `success` | `{ bg: false }` | Text only, no border |
|
|
144
145
|
| `SUCCESS_TINTED_OUTLINE` | `successLighter` | `{ border: true }` | Tinted fill, success border |
|
|
145
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 |
|
|
146
148
|
| `BLACK_TEXT_BRAND_ONHOVER` | `brand` | `{ bg: false, text: 'black' }` | Black text, brand color on hover |
|
|
147
149
|
| `BRAND_BG_ONSELECT` | `brand` | `{ bg: false, border: true }` | Ghost without a defined selected state |
|
|
148
150
|
| `BRAND_TEXT_TINTED_HOVER` | `brandLighter` | `{ bg: false }` | Ghost that becomes tinted on hover |
|
|
@@ -134,7 +134,7 @@ describe('Button', function () {
|
|
|
134
134
|
var _render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
135
135
|
variant: "iconWithText",
|
|
136
136
|
iconName: "ZD-plus",
|
|
137
|
-
iconPlacement: "
|
|
137
|
+
iconPlacement: "end"
|
|
138
138
|
}, "Button")),
|
|
139
139
|
asFragment = _render12.asFragment;
|
|
140
140
|
|
|
@@ -384,7 +384,7 @@ describe('Button', function () {
|
|
|
384
384
|
expect(asFragment()).toMatchSnapshot();
|
|
385
385
|
});
|
|
386
386
|
describe('Presets', function () {
|
|
387
|
-
var presets = [['BRAND_GHOST', _presets.BRAND_GHOST], ['BRAND_TEXT_ONLY', _presets.BRAND_TEXT_ONLY], ['BRAND_TINTED_OUTLINE', _presets.BRAND_TINTED_OUTLINE], ['SUCCESS_GHOST', _presets.SUCCESS_GHOST], ['SUCCESS_TEXT_ONLY', _presets.SUCCESS_TEXT_ONLY], ['SUCCESS_TINTED_OUTLINE', _presets.SUCCESS_TINTED_OUTLINE], ['SECONDARY_GHOST_BRAND_TINTED_ONSELECT', _presets.SECONDARY_GHOST_BRAND_TINTED_ONSELECT], ['BLACK_TEXT_BRAND_ONHOVER', _presets.BLACK_TEXT_BRAND_ONHOVER], ['BRAND_BG_ONSELECT', _presets.BRAND_BG_ONSELECT], ['BRAND_TEXT_TINTED_HOVER', _presets.BRAND_TEXT_TINTED_HOVER], ['BRAND_TEXT_TINTED_DANGER_HOVER', _presets.BRAND_TEXT_TINTED_DANGER_HOVER]];
|
|
387
|
+
var presets = [['BRAND_GHOST', _presets.BRAND_GHOST], ['BRAND_TEXT_ONLY', _presets.BRAND_TEXT_ONLY], ['BRAND_TINTED_OUTLINE', _presets.BRAND_TINTED_OUTLINE], ['SUCCESS_GHOST', _presets.SUCCESS_GHOST], ['SUCCESS_TEXT_ONLY', _presets.SUCCESS_TEXT_ONLY], ['SUCCESS_TINTED_OUTLINE', _presets.SUCCESS_TINTED_OUTLINE], ['SECONDARY_GHOST_BRAND_TINTED_ONSELECT', _presets.SECONDARY_GHOST_BRAND_TINTED_ONSELECT], ['SECONDARY_GHOST_CANCEL', _presets.SECONDARY_GHOST_CANCEL], ['BLACK_TEXT_BRAND_ONHOVER', _presets.BLACK_TEXT_BRAND_ONHOVER], ['BRAND_BG_ONSELECT', _presets.BRAND_BG_ONSELECT], ['BRAND_TEXT_TINTED_HOVER', _presets.BRAND_TEXT_TINTED_HOVER], ['BRAND_TEXT_TINTED_DANGER_HOVER', _presets.BRAND_TEXT_TINTED_DANGER_HOVER]];
|
|
388
388
|
test.each(presets)('Should render preset %s', function (_name, preset) {
|
|
389
389
|
var _render36 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], preset, "Button")),
|
|
390
390
|
asFragment = _render36.asFragment;
|