@zohodesk/components 1.0.0-temp-229.1 → 1.0.0-temp-230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/propValidation_report.html +1 -1
- package/README.md +67 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +23 -11
- package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +5 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +21 -9
- package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +5 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +23 -11
- package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +5 -0
- package/es/Accordion/Accordion.js +1 -1
- package/es/AppContainer/AppContainer.js +1 -1
- package/es/Button/Button.js +14 -7
- package/es/Button/css/Button.module.css +54 -16
- package/es/Button/css/cssJSLogic.js +6 -1
- package/es/Button/props/propTypes.js +1 -0
- package/es/Card/Card.js +23 -18
- package/es/Card/__tests__/Card.spec.js +81 -2
- package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +44 -0
- package/es/Card/props/defaultProps.js +1 -1
- package/es/Card/props/propTypes.js +1 -1
- package/es/ColorSelect/ColorMultiSelect.js +36 -0
- package/es/ColorSelect/ColorSingleSelect.js +50 -0
- package/es/ColorSelect/__tests__/ColorMultiSelect.spec.js +59 -0
- package/es/ColorSelect/__tests__/ColorSingleSelect.spec.js +59 -0
- package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +547 -0
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +178 -0
- package/es/ColorSelect/common/ColorIndicator/ColorIndicator.js +27 -0
- package/es/ColorSelect/common/ColorIndicator/ColorIndicator.module.css +18 -0
- package/es/ColorSelect/common/ColorIndicator/__tests__/ColorSingleSelect.spec.js +60 -0
- package/es/ColorSelect/common/ColorIndicator/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +95 -0
- package/es/ColorSelect/common/ColorIndicator/props/defaultProps.js +7 -0
- package/es/ColorSelect/common/ColorIndicator/props/propTypes.js +9 -0
- package/es/ColorSelect/common/ColoredTag/ColoredTag.js +33 -0
- package/es/ColorSelect/common/ColoredTag/__tests__/ColoredTag.spec.js +50 -0
- package/es/ColorSelect/common/ColoredTag/__tests__/__snapshots__/ColoredTag.spec.js.snap +101 -0
- package/es/ColorSelect/common/ColoredTag/props/propTypes.js +9 -0
- package/es/ColorSelect/common/helpers.js +35 -0
- package/es/ColorSelect/props/defaultProps.js +13 -0
- package/es/ColorSelect/props/propTypes.js +14 -0
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +9 -18
- package/es/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +3 -6
- package/es/DateTime/__tests__/__snapshots__/Time.spec.js.snap +9 -18
- package/es/DropBox/DropBox.js +3 -3
- package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +7 -0
- package/es/InputFieldLine/InputFieldLine.js +39 -0
- package/es/InputFieldLine/InputFieldLine.module.css +90 -0
- package/es/InputFieldLine/__tests__/InputFieldLine.spec.js +114 -0
- package/es/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +194 -0
- package/es/InputFieldLine/props/defaultProps.js +14 -0
- package/es/InputFieldLine/props/propTypes.js +19 -0
- package/es/ListItem/ListItem.js +17 -3
- package/es/ListItem/ListItem.module.css +15 -0
- package/es/ListItem/__tests__/ListItem.spec.js +8 -0
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +62 -1
- package/es/ListItem/props/propTypes.js +3 -1
- package/es/Modal/Modal.js +35 -14
- package/es/Modal/Portal/Portal.js +33 -0
- package/es/Modal/Portal/__tests__/Portal.spec.js +28 -0
- package/es/Modal/Portal/__tests__/__snapshots__/Portal.spec.js.snap +30 -0
- package/es/Modal/Portal/props/defaultProps.js +3 -0
- package/es/Modal/Portal/props/propTypes.js +5 -0
- package/es/MultiSelect/MultiSelect.js +14 -4
- package/es/MultiSelect/SelectedOptions.js +24 -1
- package/es/MultiSelect/Suggestions.js +3 -1
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +38 -0
- package/es/MultiSelect/__tests__/SelectedOptions.spec.js +13 -0
- package/es/MultiSelect/__tests__/Suggestions.spec.js +12 -0
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +89 -19
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +88 -3
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +3 -3
- package/es/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +15 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +66 -0
- package/es/MultiSelect/props/propTypes.js +9 -3
- package/es/Popup/Popup.js +238 -106
- package/es/Popup/Registry.js +36 -0
- package/es/Popup/viewPort.js +15 -16
- package/es/Provider/Config.js +4 -1
- package/es/Provider/LibraryContext.js +7 -3
- package/es/RippleEffect/RippleEffect.module.css +3 -2
- package/es/Select/ArrowIcon/ArrowIcon.js +48 -0
- package/es/Select/ArrowIcon/ArrowIcon.module.css +22 -0
- package/es/Select/Select.js +33 -4
- package/es/Select/__tests__/Select.spec.js +25 -0
- package/es/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +3 -6
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +1028 -483
- package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +3 -6
- package/es/Select/props/propTypes.js +2 -1
- package/es/TextBoxIcon/TextBoxIcon.js +18 -12
- package/es/TextBoxIcon/TextBoxIcon.module.css +3 -38
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +1 -2
- package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +116 -225
- package/es/TextBoxIcon/props/propTypes.js +1 -2
- package/es/common/basic.module.css +0 -2
- package/es/components_layer.module.css +1 -0
- package/es/utils/Common.js +3 -1
- package/es/utils/dropDownUtils.js +8 -2
- package/es/v1/Button/props/propTypes.js +2 -1
- package/es/v1/Popup/Popup.js +1 -1
- package/es/v1/Select/Select.js +1 -1
- package/es/v1/Switch/useSwitch.js +1 -1
- package/lib/Accordion/Accordion.js +2 -2
- package/lib/AppContainer/AppContainer.js +1 -1
- package/lib/Button/Button.js +12 -5
- package/lib/Button/css/Button.module.css +54 -16
- package/lib/Button/css/cssJSLogic.js +6 -2
- package/lib/Button/props/propTypes.js +1 -0
- package/lib/Card/Card.js +24 -19
- package/lib/Card/__tests__/Card.spec.js +118 -1
- package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +44 -0
- package/lib/Card/props/defaultProps.js +1 -1
- package/lib/Card/props/propTypes.js +1 -1
- package/lib/ColorSelect/ColorMultiSelect.js +65 -0
- package/lib/ColorSelect/ColorSingleSelect.js +78 -0
- package/lib/ColorSelect/__tests__/ColorMultiSelect.spec.js +70 -0
- package/lib/ColorSelect/__tests__/ColorSingleSelect.spec.js +70 -0
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +547 -0
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +178 -0
- package/lib/ColorSelect/common/ColorIndicator/ColorIndicator.js +40 -0
- package/lib/ColorSelect/common/ColorIndicator/ColorIndicator.module.css +18 -0
- package/lib/ColorSelect/common/ColorIndicator/__tests__/ColorSingleSelect.spec.js +67 -0
- package/lib/ColorSelect/common/ColorIndicator/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +95 -0
- package/lib/ColorSelect/common/ColorIndicator/props/defaultProps.js +14 -0
- package/lib/ColorSelect/common/ColorIndicator/props/propTypes.js +20 -0
- package/lib/ColorSelect/common/ColoredTag/ColoredTag.js +61 -0
- package/lib/ColorSelect/common/ColoredTag/__tests__/ColoredTag.spec.js +58 -0
- package/lib/ColorSelect/common/ColoredTag/__tests__/__snapshots__/ColoredTag.spec.js.snap +101 -0
- package/lib/ColorSelect/common/ColoredTag/props/propTypes.js +28 -0
- package/lib/ColorSelect/common/helpers.js +53 -0
- package/lib/ColorSelect/props/defaultProps.js +31 -0
- package/lib/ColorSelect/props/propTypes.js +35 -0
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +9 -18
- package/lib/DateTime/__tests__/__snapshots__/DateWidget.spec.js.snap +3 -6
- package/lib/DateTime/__tests__/__snapshots__/Time.spec.js.snap +9 -18
- package/lib/DropBox/DropBox.js +3 -3
- package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +7 -0
- package/lib/InputFieldLine/InputFieldLine.js +53 -0
- package/lib/InputFieldLine/InputFieldLine.module.css +90 -0
- package/lib/InputFieldLine/__tests__/InputFieldLine.spec.js +122 -0
- package/lib/InputFieldLine/__tests__/__snapshots__/InputFieldLine.spec.js.snap +194 -0
- package/lib/InputFieldLine/props/defaultProps.js +21 -0
- package/lib/InputFieldLine/props/propTypes.js +36 -0
- package/lib/ListItem/ListItem.js +17 -3
- package/lib/ListItem/ListItem.module.css +15 -0
- package/lib/ListItem/__tests__/ListItem.spec.js +8 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +62 -1
- package/lib/ListItem/props/propTypes.js +3 -1
- package/lib/Modal/Modal.js +40 -16
- package/lib/Modal/Portal/Portal.js +46 -0
- package/lib/Modal/Portal/__tests__/Portal.spec.js +37 -0
- package/lib/Modal/Portal/__tests__/__snapshots__/Portal.spec.js.snap +30 -0
- package/lib/Modal/Portal/props/defaultProps.js +10 -0
- package/lib/Modal/Portal/props/propTypes.js +16 -0
- package/lib/MultiSelect/MultiSelect.js +14 -6
- package/lib/MultiSelect/SelectedOptions.js +24 -1
- package/lib/MultiSelect/Suggestions.js +3 -1
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +40 -0
- package/lib/MultiSelect/__tests__/SelectedOptions.spec.js +15 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +14 -0
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +89 -19
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +88 -3
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectWithAvatar.spec.js.snap +3 -3
- package/lib/MultiSelect/__tests__/__snapshots__/SelectedOptions.spec.js.snap +15 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +66 -0
- package/lib/MultiSelect/props/propTypes.js +9 -3
- package/lib/Popup/Popup.js +316 -162
- package/lib/Popup/Registry.js +46 -0
- package/lib/Popup/viewPort.js +15 -16
- package/lib/Provider/Config.js +4 -1
- package/lib/Provider/LibraryContext.js +7 -3
- package/lib/RippleEffect/RippleEffect.module.css +3 -2
- package/lib/Select/ArrowIcon/ArrowIcon.js +62 -0
- package/lib/Select/ArrowIcon/ArrowIcon.module.css +22 -0
- package/lib/Select/Select.js +34 -4
- package/lib/Select/__tests__/Select.spec.js +177 -148
- package/lib/Select/__tests__/__snapshots__/GroupSelect.spec.js.snap +3 -6
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +1028 -483
- package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +3 -6
- package/lib/Select/props/propTypes.js +2 -1
- package/lib/TextBoxIcon/TextBoxIcon.js +19 -13
- package/lib/TextBoxIcon/TextBoxIcon.module.css +3 -38
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +1 -2
- package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +116 -225
- package/lib/TextBoxIcon/props/propTypes.js +1 -2
- package/lib/common/basic.module.css +0 -2
- package/lib/components_layer.module.css +1 -0
- package/lib/utils/Common.js +9 -3
- package/lib/utils/dropDownUtils.js +10 -1
- package/lib/v1/Button/props/propTypes.js +2 -1
- package/lib/v1/Popup/Popup.js +2 -2
- package/lib/v1/Select/Select.js +2 -2
- package/lib/v1/Switch/useSwitch.js +1 -1
- package/package.json +30 -20
- package/css_error.log +0 -1
- package/install.md +0 -10
- package/postPublish.js +0 -8
- package/prePublish.js +0 -70
- package/react-cli.config.js +0 -24
- package/result.json +0 -1
- /package/.cli/{stringContains.js → themeValidate/stringContains.js} +0 -0
|
@@ -40,8 +40,7 @@ export const propTypes = { ...TextBox_propTypes,
|
|
|
40
40
|
customClass: PropTypes.shape({
|
|
41
41
|
customTBoxWrap: PropTypes.string,
|
|
42
42
|
customTextBox: PropTypes.string,
|
|
43
|
-
customTBoxIcon: PropTypes.string
|
|
44
|
-
customTBoxLine: PropTypes.string
|
|
43
|
+
customTBoxIcon: PropTypes.string
|
|
45
44
|
}),
|
|
46
45
|
iconOnHover: PropTypes.bool,
|
|
47
46
|
isFocus: PropTypes.bool,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer dot-components, dot-components.theme, dot-components.core, dot-components.reset, dot-components.base, dot-components.animation, dot-components.transition, dot-components.utility, dot-components.layout, dot-components.semantic, dot-components.atom, dot-components.molecule, dot-components.organism, dot-components.page, dot-components.effect;
|
package/es/utils/Common.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/***** Libraries *****/
|
|
2
2
|
import { createSelector } from 'reselect';
|
|
3
|
-
import { getIsEmptyValue, getSearchString } from "./Common";
|
|
3
|
+
import { DUMMY_ARRAY, getIsEmptyValue, getSearchString } from "./Common";
|
|
4
|
+
import selectn from 'selectn';
|
|
4
5
|
export const dummyArray = [];
|
|
5
6
|
export const dummyObj = {};
|
|
6
7
|
export const getOptions = props => props.options || dummyArray;
|
|
@@ -150,7 +151,8 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
150
151
|
let id = typeof option === 'object' ? option[impValueField || valueField] : option;
|
|
151
152
|
const value = typeof option === 'object' ? option[impTextField || textField] : allowValueFallback ? option : '';
|
|
152
153
|
const secondaryValue = typeof option === 'object' ? option[impSecondaryField || secondaryField] : '';
|
|
153
|
-
const photoURL = typeof option === 'object' ? option[impImageField || imageField] : '';
|
|
154
|
+
const photoURL = typeof option === 'object' ? option[impImageField || imageField] : '';
|
|
155
|
+
const colorCode = selectn('colorCode', option); // grouping options (group select/MultiSelect)
|
|
154
156
|
|
|
155
157
|
id = !getIsEmptyValue(id) ? optionIdGrouping(id, prefixText) : '';
|
|
156
158
|
const additionalSearchFieldData = searchFields.reduce((value, item) => {
|
|
@@ -191,6 +193,10 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
191
193
|
optionDetails.listItemProps = listStyle || listItemProps;
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
if (colorCode) {
|
|
197
|
+
optionDetails.colorCode = colorCode;
|
|
198
|
+
}
|
|
199
|
+
|
|
194
200
|
normalizedFormatOptions[id] = optionDetails;
|
|
195
201
|
normalizedAllOptions[id] = { ...option,
|
|
196
202
|
groupId: prefixText
|
package/es/v1/Popup/Popup.js
CHANGED
package/es/v1/Select/Select.js
CHANGED
|
@@ -119,7 +119,7 @@ export class SelectComponent extends Component {
|
|
|
119
119
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
123
123
|
let {
|
|
124
124
|
selectedValue,
|
|
125
125
|
isDefaultSelectValue,
|
|
@@ -69,8 +69,8 @@ var Accordion = /*#__PURE__*/function (_React$Component) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}, {
|
|
72
|
-
key: "
|
|
73
|
-
value: function
|
|
72
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
73
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
74
74
|
if (this.props.selectedItem !== nextProps.selectedItem && !this.props.disableInternalState) {
|
|
75
75
|
this.setState({
|
|
76
76
|
selectedItem: nextProps.selectedItem
|
|
@@ -27,7 +27,7 @@ require("@zohodesk/variables/assets/sizeVariables.module.css");
|
|
|
27
27
|
|
|
28
28
|
require("@zohodesk/variables/assets/fontsizeVariables.module.css");
|
|
29
29
|
|
|
30
|
-
require("@zohodesk/variables/
|
|
30
|
+
require("@zohodesk/variables/es/fontFamilyVariables.module.css");
|
|
31
31
|
|
|
32
32
|
require("@zohodesk/variables/assets/transitionVariables.module.css");
|
|
33
33
|
|
package/lib/Button/Button.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] =
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -15,6 +15,8 @@ var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
|
15
15
|
|
|
16
16
|
var _utils = require("@zohodesk/utils");
|
|
17
17
|
|
|
18
|
+
var _ComponentRegistry = require("@zohodesk/dotkit/es/react/ComponentRegistry");
|
|
19
|
+
|
|
18
20
|
var _ButtonModule = _interopRequireDefault(require("./css/Button.module.css"));
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -26,8 +28,6 @@ Button text and children props?
|
|
|
26
28
|
use children for both cases
|
|
27
29
|
toLowerCase check needed?
|
|
28
30
|
*/
|
|
29
|
-
|
|
30
|
-
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['small','medium','large','xlarge','button_medium','button_small','primary','primaryfilled','danger','dangerfilled','plainprimary', 'plainsecondary', 'secondary', 'secondaryfilled', 'successFilled','tertiaryFilled'] }] */
|
|
31
31
|
function Button(props) {
|
|
32
32
|
var text = props.text,
|
|
33
33
|
disabled = props.disabled,
|
|
@@ -76,9 +76,16 @@ function Button(props) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
Button.defaultProps = _defaultProps.defaultProps;
|
|
79
|
-
Button.propTypes = _propTypes.propTypes;
|
|
79
|
+
Button.propTypes = _propTypes.propTypes;
|
|
80
|
+
|
|
81
|
+
var _default = (0, _ComponentRegistry.withComponentRegistrar)(Button, {
|
|
82
|
+
name: 'ZDC_Button'
|
|
83
|
+
}); // if (__DOCS__) {
|
|
80
84
|
// Button.docs = {
|
|
81
85
|
// componentGroup: 'Form Elements',
|
|
82
86
|
// folderName: 'Style Guide'
|
|
83
87
|
// };
|
|
84
|
-
// }
|
|
88
|
+
// }
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
exports["default"] = _default;
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.native:disabled {
|
|
42
|
-
pointer-events: none;
|
|
43
42
|
--button_cursor: not-allowed;
|
|
44
43
|
--button_opacity: 0.4;
|
|
45
44
|
}
|
|
@@ -144,7 +143,7 @@
|
|
|
144
143
|
--button_text_color: var(--zdt_button_default_text);
|
|
145
144
|
}
|
|
146
145
|
|
|
147
|
-
.plainprimary:hover {
|
|
146
|
+
.plainprimary:not(:disabled):hover {
|
|
148
147
|
--button_text_color: var(--zdt_button_plainprimary_hover_text);
|
|
149
148
|
}
|
|
150
149
|
|
|
@@ -152,7 +151,7 @@
|
|
|
152
151
|
--button_text_color: var(--zdt_button_danger_text);
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
.plaindanger:hover {
|
|
154
|
+
.plaindanger:not(:disabled):hover {
|
|
156
155
|
--button_text_color: var(--zdt_button_danger_hover_text);
|
|
157
156
|
}
|
|
158
157
|
|
|
@@ -160,7 +159,7 @@
|
|
|
160
159
|
--button_text_color: var(--zdt_button_success_text);
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
.plainsuccess:hover {
|
|
162
|
+
.plainsuccess:not(:disabled):hover {
|
|
164
163
|
--button_text_color: var(--zdt_button_success_hover_text);
|
|
165
164
|
}
|
|
166
165
|
|
|
@@ -168,7 +167,7 @@
|
|
|
168
167
|
--button_text_color: var(--zdt_button_secondary_text);
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
.plainsecondary:hover {
|
|
170
|
+
.plainsecondary:not(:disabled):hover {
|
|
172
171
|
--button_text_color: var(--zdt_button_secondary_hover_text);
|
|
173
172
|
}
|
|
174
173
|
|
|
@@ -184,7 +183,7 @@
|
|
|
184
183
|
--button_border_width: 1px;
|
|
185
184
|
}
|
|
186
185
|
|
|
187
|
-
.primary:hover {
|
|
186
|
+
.primary:not(:disabled):hover {
|
|
188
187
|
--button_border_color: var(--zdt_button_primary_hover_border);
|
|
189
188
|
--button_text_color: var(--zdt_button_primary_hover_text);
|
|
190
189
|
}
|
|
@@ -195,7 +194,7 @@
|
|
|
195
194
|
--button_text_color: var(--zdt_button_primaryfill_text);
|
|
196
195
|
}
|
|
197
196
|
|
|
198
|
-
.primaryfilled:hover {
|
|
197
|
+
.primaryfilled:not(:disabled):hover {
|
|
199
198
|
--button_bg_color: var(--zdt_button_primaryfill_hover_bg);
|
|
200
199
|
}
|
|
201
200
|
|
|
@@ -205,7 +204,7 @@
|
|
|
205
204
|
--button_text_color: var(--zdt_button_danger_text);
|
|
206
205
|
}
|
|
207
206
|
|
|
208
|
-
.danger:hover {
|
|
207
|
+
.danger:not(:disabled):hover {
|
|
209
208
|
--button_border_color: var(--zdt_button_danger_hover_border);
|
|
210
209
|
--button_text_color: var(--zdt_button_danger_hover_text);
|
|
211
210
|
}
|
|
@@ -216,7 +215,7 @@
|
|
|
216
215
|
--button_text_color: var(--zdt_button_success_text);
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
.success:hover {
|
|
218
|
+
.success:not(:disabled):hover {
|
|
220
219
|
--button_border_color: var(--zdt_button_success_hover_border);
|
|
221
220
|
--button_text_color: var(--zdt_button_success_hover_text);
|
|
222
221
|
}
|
|
@@ -227,7 +226,7 @@
|
|
|
227
226
|
--button_text_color: var(--zdt_button_dangerfill_text);
|
|
228
227
|
}
|
|
229
228
|
|
|
230
|
-
.dangerfilled:hover {
|
|
229
|
+
.dangerfilled:not(:disabled):hover {
|
|
231
230
|
--button_bg_color: var(--zdt_button_dangerfill_hover_bg);
|
|
232
231
|
}
|
|
233
232
|
|
|
@@ -237,7 +236,7 @@
|
|
|
237
236
|
--button_text_color: var(--zdt_button_secondary_text);
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
.secondary:hover {
|
|
239
|
+
.secondary:not(:disabled):hover {
|
|
241
240
|
--button_border_color: var(--zdt_button_secondary_hover_border);
|
|
242
241
|
--button_text_color: var(--zdt_button_secondary_hover_text);
|
|
243
242
|
}
|
|
@@ -248,18 +247,17 @@
|
|
|
248
247
|
--button_text_color: var(--zdt_button_secondary_text);
|
|
249
248
|
}
|
|
250
249
|
|
|
251
|
-
.secondaryfilled:hover {
|
|
250
|
+
.secondaryfilled:not(:disabled):hover {
|
|
252
251
|
--button_text_color: var(--zdt_button_secondary_hover_text);
|
|
253
252
|
}
|
|
254
253
|
|
|
255
254
|
.successfilled {
|
|
256
|
-
--button_border_color: var(--
|
|
255
|
+
--button_border_color: var(--zdt_button_primaryfill_border);
|
|
257
256
|
--button_bg_color: var(--zdt_button_successfill_bg);
|
|
258
257
|
--button_text_color: var(--zdt_button_dangerfill_text);
|
|
259
258
|
}
|
|
260
259
|
|
|
261
|
-
.successfilled:hover {
|
|
262
|
-
--button_border_color: var(--zdt_button_successfill_hover_border);
|
|
260
|
+
.successfilled:not(:disabled):hover {
|
|
263
261
|
--button_bg_color: var(--zdt_button_successfill_hover_bg);
|
|
264
262
|
}
|
|
265
263
|
|
|
@@ -269,7 +267,7 @@
|
|
|
269
267
|
--button_text_color: var(--zdt_button_dangerfill_text);
|
|
270
268
|
}
|
|
271
269
|
|
|
272
|
-
.tertiaryfilled:hover {
|
|
270
|
+
.tertiaryfilled:not(:disabled):hover {
|
|
273
271
|
--button_bg_color: var(--zdt_button_tertiaryfill_hover_bg);
|
|
274
272
|
}
|
|
275
273
|
|
|
@@ -572,4 +570,44 @@
|
|
|
572
570
|
|
|
573
571
|
.loader {
|
|
574
572
|
color: var(--dot_mirror)
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
[dir=ltr] .strike {
|
|
576
|
+
background-image: repeating-linear-gradient(120deg, var(--button_strike_color) 0 1px, transparent 1px 8px);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
[dir=rtl] .strike {
|
|
580
|
+
background-image: repeating-linear-gradient(-120deg, var(--button_strike_color) 0 1px, transparent 1px 8px);
|
|
581
|
+
}
|
|
582
|
+
.primaryStrike {
|
|
583
|
+
--button_strike_color: var(--zdt_button_primary_strike);
|
|
584
|
+
}
|
|
585
|
+
.primaryfilledStrike {
|
|
586
|
+
--button_strike_color: var(--zdt_button_primaryFilled_strike);
|
|
587
|
+
--button_border_color: var(--zdt_button_primaryfill_bg);
|
|
588
|
+
}
|
|
589
|
+
.dangerStrike {
|
|
590
|
+
--button_strike_color: var(--zdt_button_danger_strike);
|
|
591
|
+
}
|
|
592
|
+
.dangerfilledStrike {
|
|
593
|
+
--button_strike_color: var(--zdt_button_dangerFilled_strike);
|
|
594
|
+
--button_border_color: var(--zdt_button_dangerfill_bg);
|
|
595
|
+
}
|
|
596
|
+
.secondaryStrike {
|
|
597
|
+
--button_strike_color: var(--zdt_button_secondary_border);
|
|
598
|
+
}
|
|
599
|
+
.secondaryfilledStrike {
|
|
600
|
+
--button_strike_color: var(--zdt_button_secondaryFilled_strike);
|
|
601
|
+
--button_border_color: var(--zdt_button_secondaryfill_bg);
|
|
602
|
+
}
|
|
603
|
+
.tertiaryfilledStrike {
|
|
604
|
+
--button_strike_color: var(--zdt_button_tertiaryFilled_strike);
|
|
605
|
+
--button_border_color: var(--zdt_button_tertiaryfill_bg);
|
|
606
|
+
}
|
|
607
|
+
.successStrike {
|
|
608
|
+
--button_strike_color: var(--zdt_button_success_strike);
|
|
609
|
+
}
|
|
610
|
+
.successfilledStrike {
|
|
611
|
+
--button_strike_color: var(--zdt_button_successFilled_strike);
|
|
612
|
+
--button_border_color: var(--zdt_button_successfill_bg);
|
|
575
613
|
}
|
|
@@ -21,16 +21,20 @@ function cssJSLogic(_ref) {
|
|
|
21
21
|
size = props.size,
|
|
22
22
|
children = props.children,
|
|
23
23
|
palette = props.palette,
|
|
24
|
-
status = props.status
|
|
24
|
+
status = props.status,
|
|
25
|
+
disabled = props.disabled,
|
|
26
|
+
shouldStrikeThroughDisabled = props.shouldStrikeThroughDisabled;
|
|
25
27
|
var _customClass$customBu = customClass.customButton,
|
|
26
28
|
customButton = _customClass$customBu === void 0 ? '' : _customClass$customBu,
|
|
27
29
|
_customClass$customSt = customClass.customStatus,
|
|
28
30
|
customStatus = _customClass$customSt === void 0 ? '' : _customClass$customSt,
|
|
29
31
|
_customClass$customSt2 = customClass.customStatusSize,
|
|
30
32
|
customStatusSize = _customClass$customSt2 === void 0 ? '' : _customClass$customSt2;
|
|
33
|
+
var strikeExcludedPalettes = ['plainprimary', 'plainsecondary', 'plainDanger', 'plainSuccess'];
|
|
31
34
|
var paletteLower = palette.toLowerCase();
|
|
32
35
|
var statusLower = status.toLowerCase();
|
|
33
|
-
var
|
|
36
|
+
var canStrikeThrough = !strikeExcludedPalettes.includes(paletteLower);
|
|
37
|
+
var buttonClass = (0, _utils.compileClassNames)((_compileClassNames = {}, _defineProperty(_compileClassNames, customButton, !!customButton), _defineProperty(_compileClassNames, style.bold, isBold), _defineProperty(_compileClassNames, style["default"], !needAppearance), _defineProperty(_compileClassNames, style[paletteLower], needAppearance), _defineProperty(_compileClassNames, style.rounded, needAppearance && rounded), _defineProperty(_compileClassNames, style[size.toLowerCase()], needAppearance && !children), _defineProperty(_compileClassNames, style["".concat(size, "Btn")], needAppearance && children), _defineProperty(_compileClassNames, style["".concat(size, "Btn").concat(paletteLower)], needAppearance && children && rounded), _defineProperty(_compileClassNames, "".concat(style["".concat(paletteLower, "Strike")], " ").concat(style.strike), disabled && canStrikeThrough && shouldStrikeThroughDisabled), _defineProperty(_compileClassNames, style.loader, !!needAppearance && statusLower !== 'none'), _compileClassNames));
|
|
34
38
|
var loaderParentClass = (0, _utils.compileClassNames)((_compileClassNames2 = {}, _defineProperty(_compileClassNames2, customStatusSize, !!customStatusSize), _defineProperty(_compileClassNames2, style.loading, statusLower === 'loading'), _defineProperty(_compileClassNames2, style["".concat(size, "loading")], statusLower === 'loading'), _defineProperty(_compileClassNames2, style.successstate, statusLower != 'loading'), _compileClassNames2));
|
|
35
39
|
var loaderChildClass = (0, _utils.compileClassNames)((_compileClassNames3 = {}, _defineProperty(_compileClassNames3, customStatus, !!customStatus), _defineProperty(_compileClassNames3, style.loadingelement, statusLower === 'loading'), _defineProperty(_compileClassNames3, style["".concat(paletteLower, "element")], statusLower === 'loading'), _defineProperty(_compileClassNames3, style.successelement, statusLower != 'loading'), _defineProperty(_compileClassNames3, style["".concat(paletteLower, "success")], statusLower != 'loading'), _compileClassNames3));
|
|
36
40
|
return {
|
|
@@ -24,6 +24,7 @@ var propTypes = {
|
|
|
24
24
|
status: _propTypes["default"].oneOf(['loading', 'success', 'none']),
|
|
25
25
|
text: _propTypes["default"].string,
|
|
26
26
|
title: _propTypes["default"].string,
|
|
27
|
+
shouldStrikeThroughDisabled: _propTypes["default"].bool,
|
|
27
28
|
customClass: _propTypes["default"].shape({
|
|
28
29
|
customButton: _propTypes["default"].string,
|
|
29
30
|
customStatus: _propTypes["default"].string,
|
package/lib/Card/Card.js
CHANGED
|
@@ -184,8 +184,8 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
_createClass(Card, [{
|
|
187
|
-
key: "
|
|
188
|
-
value: function
|
|
187
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
188
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
189
189
|
if (this.from !== nextProps.from) {
|
|
190
190
|
this.from = nextProps.from;
|
|
191
191
|
}
|
|
@@ -207,29 +207,34 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
207
207
|
scrollAt = _this$props3.scrollAt,
|
|
208
208
|
noNeedUpScroll = _this$props3.noNeedUpScroll,
|
|
209
209
|
isPercentageScroll = _this$props3.isPercentageScroll,
|
|
210
|
-
|
|
210
|
+
scrollDirection = _this$props3.scrollDirection;
|
|
211
211
|
var scrollLimitHeight = scrollHeight - scrollAt;
|
|
212
212
|
var currentVisibleBottom = scrollTop + offsetHeight;
|
|
213
213
|
|
|
214
214
|
if (scrollTop > this.lastScrollTop) {
|
|
215
|
-
this.
|
|
215
|
+
this.scrollingDirection = 'down';
|
|
216
216
|
} else {
|
|
217
|
-
this.
|
|
217
|
+
this.scrollingDirection = 'up';
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
this.lastScrollTop = scrollTop;
|
|
221
221
|
|
|
222
222
|
if (fetchData && !this.isFetching) {
|
|
223
|
-
var fetchDirection =
|
|
223
|
+
var fetchDirection = scrollDirection === 'bottomToTop' ? 'up' : 'down';
|
|
224
224
|
|
|
225
|
-
if (this.
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
if (this.scrollingDirection === fetchDirection && !noMoreData) {
|
|
226
|
+
var prefetch = false;
|
|
227
|
+
|
|
228
|
+
if (isPercentageScroll) {
|
|
229
|
+
var scrollingPercentage = scrollDirection === 'bottomToTop' ? (scrollHeight - scrollTop) / scrollLimitHeight * 100 : currentVisibleBottom / scrollLimitHeight * 100;
|
|
230
|
+
prefetch = scrollingPercentage >= (0, _Config.getLibraryConfig)('scrollFetchLimit');
|
|
231
|
+
} else {
|
|
232
|
+
prefetch = scrollDirection === 'bottomToTop' ? scrollTop <= scrollAt : scrollLimitHeight <= currentVisibleBottom;
|
|
233
|
+
}
|
|
229
234
|
|
|
230
235
|
if (prefetch) {
|
|
231
236
|
this.isFetching = true;
|
|
232
|
-
fetchData(this.from + this.limit, this.limit + this.to, this.
|
|
237
|
+
fetchData(this.from + this.limit, this.limit + this.to, this.scrollingDirection).then(function () {
|
|
233
238
|
_this3.to = _this3.limit + _this3.to;
|
|
234
239
|
_this3.isFetching = false;
|
|
235
240
|
}, function () {
|
|
@@ -237,11 +242,11 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
237
242
|
});
|
|
238
243
|
}
|
|
239
244
|
} else {
|
|
240
|
-
var _prefetch =
|
|
245
|
+
var _prefetch = scrollDirection === 'bottomToTop' ? scrollLimitHeight <= currentVisibleBottom : 0 >= scrollTop - scrollAt;
|
|
241
246
|
|
|
242
247
|
if (_prefetch && this.from !== 0 && !noNeedUpScroll) {
|
|
243
248
|
this.isFetching = true;
|
|
244
|
-
fetchData(this.from - this.limit, this.to - this.limit, this.
|
|
249
|
+
fetchData(this.from - this.limit, this.to - this.limit, this.scrollingDirection).then(function () {
|
|
245
250
|
_this3.to = _this3.to - _this3.limit;
|
|
246
251
|
_this3.isFetching = false;
|
|
247
252
|
}, function () {
|
|
@@ -252,11 +257,11 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
252
257
|
}
|
|
253
258
|
|
|
254
259
|
if (fetchData && !noNeedUpScroll) {
|
|
255
|
-
var topFetch =
|
|
256
|
-
var bottomFetch =
|
|
260
|
+
var topFetch = scrollDirection === 'bottomToTop' ? !noMoreData : !noNeedUpScroll && this.from !== 0;
|
|
261
|
+
var bottomFetch = scrollDirection === 'bottomToTop' ? !noNeedUpScroll && this.from !== 0 : !noMoreData;
|
|
257
262
|
|
|
258
|
-
if (
|
|
259
|
-
scrollContainerObj.scrollTop =
|
|
263
|
+
if (scrollTop === 0 && topFetch) {
|
|
264
|
+
scrollContainerObj.scrollTop = scrollTop + offsetHeight / 3;
|
|
260
265
|
} else if (scrollHeight === currentVisibleBottom && bottomFetch) {
|
|
261
266
|
scrollContainerObj.scrollTop = scrollTop - offsetHeight / 2;
|
|
262
267
|
}
|
|
@@ -280,9 +285,9 @@ var Card = /*#__PURE__*/function (_Component3) {
|
|
|
280
285
|
value: function setScrollRef(el) {
|
|
281
286
|
var _this$props4 = this.props,
|
|
282
287
|
scrollAt = _this$props4.scrollAt,
|
|
283
|
-
|
|
288
|
+
scrollDirection = _this$props4.scrollDirection;
|
|
284
289
|
|
|
285
|
-
if (el &&
|
|
290
|
+
if (el && scrollDirection === 'bottomToTop') {
|
|
286
291
|
requestAnimationFrame(function () {
|
|
287
292
|
el.scrollTop = el.scrollHeight + Number(scrollAt);
|
|
288
293
|
});
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
+
|
|
3
5
|
var _react = _interopRequireDefault(require("react"));
|
|
4
6
|
|
|
5
7
|
var _react2 = require("@testing-library/react");
|
|
6
8
|
|
|
7
|
-
var _Card =
|
|
9
|
+
var _Card = _interopRequireWildcard(require("../Card"));
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
8
14
|
|
|
9
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
16
|
|
|
17
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
18
|
+
|
|
19
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
20
|
+
|
|
21
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
22
|
+
|
|
11
23
|
describe('Card', function () {
|
|
12
24
|
test('rendering the defult props', function () {
|
|
13
25
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], null)),
|
|
@@ -15,4 +27,109 @@ describe('Card', function () {
|
|
|
15
27
|
|
|
16
28
|
expect(asFragment()).toMatchSnapshot();
|
|
17
29
|
});
|
|
30
|
+
test('should trigger fetch, when scroll to the bottom of the card while isRecentOnBottom = false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
31
|
+
var mockGetNextOptions, _render2, getByTestId, asFragment, cardContent;
|
|
32
|
+
|
|
33
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
|
+
while (1) {
|
|
35
|
+
switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
mockGetNextOptions = jest.fn(function () {
|
|
38
|
+
return new Promise(function (resolve) {
|
|
39
|
+
resolve();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
43
|
+
from: 0,
|
|
44
|
+
limit: 10,
|
|
45
|
+
fetchData: mockGetNextOptions
|
|
46
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
47
|
+
dataId: "scrollToBottomCardContent"
|
|
48
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId = _render2.getByTestId, asFragment = _render2.asFragment;
|
|
49
|
+
cardContent = getByTestId('scrollToBottomCardContent');
|
|
50
|
+
Object.defineProperty(cardContent, 'scrollHeight', {
|
|
51
|
+
value: 1000,
|
|
52
|
+
writable: true
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(cardContent, 'clientHeight', {
|
|
55
|
+
value: 600,
|
|
56
|
+
writable: true
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(cardContent, 'offsetHeight', {
|
|
59
|
+
value: 600,
|
|
60
|
+
writable: true
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
_react2.fireEvent.scroll(cardContent, {
|
|
64
|
+
target: {
|
|
65
|
+
scrollTop: 401
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
_context.next = 9;
|
|
70
|
+
return (0, _react2.waitFor)(function () {
|
|
71
|
+
expect(asFragment()).toMatchSnapshot();
|
|
72
|
+
expect(mockGetNextOptions).toHaveBeenCalledWith(10, 40, 'down');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
case 9:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, _callee);
|
|
81
|
+
})));
|
|
82
|
+
test('should trigger fetch, when scroll to the top of the card while scrollDirection = bottomToTop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
83
|
+
var mockGetNextOptions, _render3, getByTestId, asFragment, cardContent;
|
|
84
|
+
|
|
85
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
86
|
+
while (1) {
|
|
87
|
+
switch (_context2.prev = _context2.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
mockGetNextOptions = jest.fn(function () {
|
|
90
|
+
return new Promise(function (resolve) {
|
|
91
|
+
resolve();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
95
|
+
from: 0,
|
|
96
|
+
limit: 10,
|
|
97
|
+
scrollDirection: "bottomToTop",
|
|
98
|
+
fetchData: mockGetNextOptions
|
|
99
|
+
}, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
100
|
+
dataId: "scrollToTopCardContent"
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "Hello Zam")))), getByTestId = _render3.getByTestId, asFragment = _render3.asFragment;
|
|
102
|
+
cardContent = getByTestId('scrollToTopCardContent');
|
|
103
|
+
Object.defineProperty(cardContent, 'scrollHeight', {
|
|
104
|
+
value: 1000,
|
|
105
|
+
writable: true
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(cardContent, 'clientHeight', {
|
|
108
|
+
value: 600,
|
|
109
|
+
writable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(cardContent, 'offsetHeight', {
|
|
112
|
+
value: 600,
|
|
113
|
+
writable: true
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
_react2.fireEvent.scroll(cardContent, {
|
|
117
|
+
target: {
|
|
118
|
+
scrollTop: 0
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
_context2.next = 9;
|
|
123
|
+
return (0, _react2.waitFor)(function () {
|
|
124
|
+
expect(asFragment()).toMatchSnapshot();
|
|
125
|
+
expect(mockGetNextOptions).toHaveBeenCalledWith(10, 40, 'up');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
case 9:
|
|
129
|
+
case "end":
|
|
130
|
+
return _context2.stop();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, _callee2);
|
|
134
|
+
})));
|
|
18
135
|
});
|