@zohodesk/components 1.0.0-alpha-271 → 1.0.0-alpha-272
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/es/Accordion/Accordion.js +7 -3
- package/es/Accordion/AccordionItem.js +4 -2
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +13 -5
- package/es/Avatar/Avatar.js +23 -11
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/Button/Button.js +4 -3
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Card/Card.js +21 -10
- package/es/CheckBox/CheckBox.js +5 -3
- package/es/DateTime/CalendarView.js +32 -20
- package/es/DateTime/DateTime.js +75 -10
- package/es/DateTime/DateTimePopupFooter.js +4 -2
- package/es/DateTime/DateTimePopupHeader.js +8 -2
- package/es/DateTime/DateWidget.js +98 -35
- package/es/DateTime/DaysRow.js +4 -2
- package/es/DateTime/Time.js +10 -2
- package/es/DateTime/YearView.js +28 -4
- package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
- package/es/DateTime/__tests__/DateTime.spec.js +1 -0
- package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
- package/es/DateTime/common.js +3 -0
- package/es/DateTime/constants.js +1 -0
- package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
- package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
- package/es/DateTime/dateFormatUtils/index.js +32 -2
- package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
- package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
- package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
- package/es/DateTime/objectUtils.js +14 -20
- package/es/DateTime/props/defaultProps.js +2 -1
- package/es/DateTime/typeChecker.js +3 -0
- package/es/DateTime/validator.js +58 -6
- package/es/DropBox/DropBox.js +6 -2
- package/es/DropBox/DropBoxElement/DropBoxElement.js +7 -0
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -3
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
- package/es/DropBox/props/defaultProps.js +1 -2
- package/es/DropBox/props/propTypes.js +1 -2
- package/es/DropDown/DropDown.js +8 -4
- package/es/DropDown/DropDownHeading.js +4 -5
- package/es/DropDown/DropDownItem.js +6 -0
- package/es/DropDown/DropDownSearch.js +4 -0
- package/es/DropDown/DropDownSeparator.js +1 -0
- package/es/DropDown/__tests__/DropDown.spec.js +1 -2
- package/es/Heading/Heading.js +2 -3
- package/es/Label/Label.js +2 -3
- package/es/Layout/Box.js +13 -0
- package/es/Layout/Container.js +12 -1
- package/es/Layout/index.js +1 -2
- package/es/ListItem/ListContainer.js +8 -3
- package/es/ListItem/ListItem.js +9 -3
- package/es/ListItem/ListItemWithAvatar.js +9 -3
- package/es/ListItem/ListItemWithCheckBox.js +7 -2
- package/es/ListItem/ListItemWithIcon.js +8 -3
- package/es/ListItem/ListItemWithRadio.js +7 -3
- package/es/Modal/Modal.js +28 -11
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +89 -13
- package/es/MultiSelect/AdvancedMultiSelect.js +32 -9
- package/es/MultiSelect/EmptyState.js +2 -0
- package/es/MultiSelect/MultiSelect.js +99 -32
- package/es/MultiSelect/MultiSelectHeader.js +3 -0
- package/es/MultiSelect/MultiSelectWithAvatar.js +12 -6
- package/es/MultiSelect/SelectedOptions.js +6 -3
- package/es/MultiSelect/Suggestions.js +7 -3
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
- package/es/MultiSelect/props/propTypes.js +2 -0
- package/es/PopOver/PopOver.js +18 -2
- package/es/PopOver/__tests__/PopOver.spec.js +2 -1
- package/es/Popup/Popup.js +77 -24
- package/es/Popup/__tests__/Popup.spec.js +17 -5
- package/es/Popup/viewPort.js +16 -4
- package/es/Provider/IdProvider.js +10 -5
- package/es/Provider/LibraryContext.js +6 -4
- package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
- package/es/Provider/ZindexProvider.js +9 -2
- package/es/Radio/Radio.js +4 -2
- package/es/Responsive/CustomResponsive.js +30 -18
- package/es/Responsive/RefWrapper.js +6 -7
- package/es/Responsive/ResizeComponent.js +35 -25
- package/es/Responsive/ResizeObserver.js +26 -6
- package/es/Responsive/Responsive.js +34 -20
- package/es/Responsive/index.js +1 -3
- package/es/Responsive/sizeObservers.js +28 -7
- package/es/Responsive/utils/index.js +7 -5
- package/es/Responsive/utils/shallowCompare.js +7 -2
- package/es/Responsive/windowResizeObserver.js +7 -0
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
- package/es/Ribbon/Ribbon.js +3 -2
- package/es/RippleEffect/RippleEffect.js +1 -3
- package/es/Select/GroupSelect.js +58 -14
- package/es/Select/Select.js +79 -33
- package/es/Select/SelectWithAvatar.js +17 -4
- package/es/Select/SelectWithIcon.js +46 -5
- package/es/Select/__tests__/Select.spec.js +6 -8
- package/es/Select/props/propTypes.js +1 -0
- package/es/Stencils/Stencils.js +3 -3
- package/es/Switch/Switch.js +5 -3
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/TabContent.js +1 -0
- package/es/Tab/TabContentWrapper.js +2 -0
- package/es/Tab/TabWrapper.js +5 -2
- package/es/Tab/Tabs.js +54 -7
- package/es/Tab/__tests__/Tab.spec.js +1 -3
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
- package/es/Tag/Tag.js +6 -3
- package/es/TextBox/TextBox.js +15 -3
- package/es/TextBox/__tests__/TextBox.spec.js +1 -4
- package/es/TextBoxIcon/TextBoxIcon.js +9 -2
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
- package/es/Textarea/Textarea.js +12 -3
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +58 -14
- package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
- package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
- package/es/semantic/Button/Button.js +3 -2
- package/es/utils/Common.js +54 -9
- package/es/utils/ContextOptimizer.js +4 -5
- package/es/utils/__tests__/debounce.spec.js +2 -2
- package/es/utils/constructFullName.js +2 -0
- package/es/utils/css/compileClassNames.js +5 -0
- package/es/utils/css/mergeStyle.js +7 -6
- package/es/utils/css/utils.js +1 -0
- package/es/utils/datetime/GMTZones.js +48 -0
- package/es/utils/datetime/common.js +31 -7
- package/es/utils/debounce.js +5 -1
- package/es/utils/dropDownUtils.js +68 -11
- package/es/utils/getInitial.js +4 -0
- package/es/utils/shallowEqual.js +6 -0
- package/lib/Accordion/Accordion.js +42 -18
- package/lib/Accordion/AccordionItem.js +40 -18
- package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
- package/lib/Accordion/index.js +3 -0
- package/lib/Accordion/props/propTypes.js +3 -0
- package/lib/Animation/Animation.js +38 -18
- package/lib/Animation/__tests__/Animation.spec.js +11 -7
- package/lib/Animation/props/propTypes.js +3 -0
- package/lib/AppContainer/AppContainer.js +56 -21
- package/lib/AppContainer/props/propTypes.js +3 -0
- package/lib/Avatar/Avatar.js +78 -38
- package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
- package/lib/Avatar/props/propTypes.js +3 -0
- package/lib/AvatarTeam/AvatarTeam.js +52 -30
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
- package/lib/AvatarTeam/props/propTypes.js +3 -0
- package/lib/Button/Button.js +31 -20
- package/lib/Button/css/cssJSLogic.js +18 -17
- package/lib/Button/index.js +3 -0
- package/lib/Button/props/defaultProps.js +2 -0
- package/lib/Button/props/propTypes.js +3 -0
- package/lib/Buttongroup/Buttongroup.js +32 -12
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
- package/lib/Buttongroup/props/propTypes.js +3 -0
- package/lib/Card/Card.js +102 -46
- package/lib/Card/__tests__/Card.spec.js +10 -1
- package/lib/Card/index.js +4 -0
- package/lib/Card/props/propTypes.js +3 -0
- package/lib/CheckBox/CheckBox.js +71 -47
- package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
- package/lib/CheckBox/props/propTypes.js +3 -0
- package/lib/DateTime/CalendarView.js +82 -42
- package/lib/DateTime/DateTime.js +246 -158
- package/lib/DateTime/DateTimePopupFooter.js +31 -8
- package/lib/DateTime/DateTimePopupHeader.js +48 -17
- package/lib/DateTime/DateWidget.js +352 -250
- package/lib/DateTime/DaysRow.js +27 -5
- package/lib/DateTime/Time.js +73 -32
- package/lib/DateTime/YearView.js +77 -28
- package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
- package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
- package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
- package/lib/DateTime/common.js +6 -0
- package/lib/DateTime/constants.js +1 -0
- package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
- package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
- package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
- package/lib/DateTime/dateFormatUtils/index.js +74 -16
- package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
- package/lib/DateTime/dateFormatUtils/timeChange.js +54 -22
- package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
- package/lib/DateTime/index.js +2 -0
- package/lib/DateTime/objectUtils.js +24 -20
- package/lib/DateTime/props/defaultProps.js +2 -1
- package/lib/DateTime/props/propTypes.js +11 -1
- package/lib/DateTime/typeChecker.js +4 -0
- package/lib/DateTime/validator.js +73 -10
- package/lib/DropBox/DropBox.js +34 -10
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +59 -38
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +42 -34
- package/lib/DropBox/DropBoxElement/props/propTypes.js +3 -0
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
- package/lib/DropBox/__tests__/DropBox.spec.js +6 -2
- package/lib/DropBox/css/cssJSLogic.js +3 -1
- package/lib/DropBox/props/defaultProps.js +8 -4
- package/lib/DropBox/props/propTypes.js +10 -4
- package/lib/DropDown/DropDown.js +52 -8
- package/lib/DropDown/DropDownHeading.js +39 -20
- package/lib/DropDown/DropDownItem.js +42 -20
- package/lib/DropDown/DropDownSearch.js +40 -17
- package/lib/DropDown/DropDownSeparator.js +24 -4
- package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
- package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
- package/lib/DropDown/index.js +9 -0
- package/lib/DropDown/props/propTypes.js +6 -4
- package/lib/Heading/Heading.js +37 -15
- package/lib/Heading/props/propTypes.js +3 -0
- package/lib/Label/Label.js +39 -19
- package/lib/Label/__tests__/Label.spec.js +14 -1
- package/lib/Label/props/propTypes.js +3 -0
- package/lib/Layout/Box.js +31 -11
- package/lib/Layout/Container.js +29 -10
- package/lib/Layout/__tests__/Box.spec.js +65 -49
- package/lib/Layout/__tests__/Container.spec.js +67 -50
- package/lib/Layout/index.js +3 -0
- package/lib/Layout/props/propTypes.js +3 -0
- package/lib/Layout/utils.js +10 -0
- package/lib/ListItem/ListContainer.js +48 -27
- package/lib/ListItem/ListItem.js +69 -45
- package/lib/ListItem/ListItemWithAvatar.js +75 -48
- package/lib/ListItem/ListItemWithCheckBox.js +64 -39
- package/lib/ListItem/ListItemWithIcon.js +68 -44
- package/lib/ListItem/ListItemWithRadio.js +65 -41
- package/lib/ListItem/index.js +7 -0
- package/lib/ListItem/props/propTypes.js +6 -4
- package/lib/Modal/Modal.js +45 -10
- package/lib/Modal/props/propTypes.js +3 -0
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +294 -166
- package/lib/MultiSelect/AdvancedMultiSelect.js +202 -125
- package/lib/MultiSelect/EmptyState.js +45 -24
- package/lib/MultiSelect/MultiSelect.js +323 -206
- package/lib/MultiSelect/MultiSelectHeader.js +30 -8
- package/lib/MultiSelect/MultiSelectWithAvatar.js +105 -63
- package/lib/MultiSelect/SelectedOptions.js +43 -17
- package/lib/MultiSelect/Suggestions.js +64 -32
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
- package/lib/MultiSelect/index.js +5 -0
- package/lib/MultiSelect/props/defaultProps.js +2 -0
- package/lib/MultiSelect/props/propTypes.js +5 -0
- package/lib/PopOver/PopOver.js +95 -49
- package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
- package/lib/PopOver/index.js +4 -0
- package/lib/PopOver/props/propTypes.js +3 -0
- package/lib/Popup/Popup.js +158 -81
- package/lib/Popup/__tests__/Popup.spec.js +43 -8
- package/lib/Popup/viewPort.js +28 -14
- package/lib/Provider/AvatarSize.js +4 -0
- package/lib/Provider/Config.js +2 -0
- package/lib/Provider/CssProvider.js +4 -0
- package/lib/Provider/IdProvider.js +17 -6
- package/lib/Provider/LibraryContext.js +35 -15
- package/lib/Provider/LibraryContextInit.js +4 -0
- package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
- package/lib/Provider/ZindexProvider.js +15 -3
- package/lib/Provider/index.js +5 -0
- package/lib/Radio/Radio.js +61 -38
- package/lib/Radio/__tests__/Radiospec.js +9 -5
- package/lib/Radio/props/propTypes.js +3 -0
- package/lib/Responsive/CustomResponsive.js +73 -29
- package/lib/Responsive/RefWrapper.js +17 -11
- package/lib/Responsive/ResizeComponent.js +62 -36
- package/lib/Responsive/ResizeObserver.js +24 -10
- package/lib/Responsive/Responsive.js +80 -30
- package/lib/Responsive/index.js +4 -0
- package/lib/Responsive/props/propTypes.js +3 -0
- package/lib/Responsive/sizeObservers.js +53 -17
- package/lib/Responsive/utils/index.js +11 -3
- package/lib/Responsive/utils/shallowCompare.js +11 -2
- package/lib/Responsive/windowResizeObserver.js +8 -0
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
- package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
- package/lib/Ribbon/Ribbon.js +33 -13
- package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
- package/lib/Ribbon/props/propTypes.js +3 -0
- package/lib/RippleEffect/RippleEffect.js +18 -10
- package/lib/RippleEffect/props/propTypes.js +3 -0
- package/lib/Select/GroupSelect.js +229 -130
- package/lib/Select/Select.js +290 -209
- package/lib/Select/SelectWithAvatar.js +102 -56
- package/lib/Select/SelectWithIcon.js +132 -76
- package/lib/Select/__tests__/Select.spec.js +133 -91
- package/lib/Select/index.js +5 -0
- package/lib/Select/props/defaultProps.js +5 -4
- package/lib/Select/props/propTypes.js +4 -0
- package/lib/Stencils/Stencils.js +29 -10
- package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
- package/lib/Stencils/props/propTypes.js +3 -0
- package/lib/Switch/Switch.js +57 -34
- package/lib/Switch/props/propTypes.js +3 -0
- package/lib/Tab/Tab.js +40 -27
- package/lib/Tab/TabContent.js +12 -5
- package/lib/Tab/TabContentWrapper.js +13 -6
- package/lib/Tab/TabWrapper.js +37 -19
- package/lib/Tab/Tabs.js +171 -91
- package/lib/Tab/__tests__/Tab.spec.js +67 -58
- package/lib/Tab/__tests__/TabContent.spec.js +10 -6
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
- package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
- package/lib/Tab/__tests__/Tabs.spec.js +53 -39
- package/lib/Tab/index.js +6 -0
- package/lib/Tab/props/propTypes.js +3 -0
- package/lib/Tag/Tag.js +72 -43
- package/lib/Tag/__tests__/Tag.spec.js +14 -8
- package/lib/Tag/props/propTypes.js +3 -0
- package/lib/TextBox/TextBox.js +85 -59
- package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
- package/lib/TextBox/props/propTypes.js +6 -4
- package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -5
- package/lib/TextBoxIcon/props/propTypes.js +3 -0
- package/lib/Textarea/Textarea.js +54 -29
- package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
- package/lib/Textarea/props/propTypes.js +3 -0
- package/lib/Tooltip/Tooltip.js +94 -31
- package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
- package/lib/Tooltip/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
- package/lib/VelocityAnimation/index.js +3 -0
- package/lib/css.js +40 -0
- package/lib/deprecated/PortalLayer/PortalLayer.js +46 -23
- package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
- package/lib/index.js +57 -0
- package/lib/semantic/Button/Button.js +42 -22
- package/lib/semantic/Button/props/propTypes.js +3 -0
- package/lib/semantic/index.js +2 -0
- package/lib/utils/Common.js +110 -18
- package/lib/utils/ContextOptimizer.js +16 -10
- package/lib/utils/__tests__/constructFullName.spec.js +1 -0
- package/lib/utils/__tests__/debounce.spec.js +3 -2
- package/lib/utils/__tests__/getInitial.spec.js +1 -0
- package/lib/utils/constructFullName.js +13 -4
- package/lib/utils/css/compileClassNames.js +6 -0
- package/lib/utils/css/mergeStyle.js +10 -7
- package/lib/utils/css/utils.js +8 -0
- package/lib/utils/datetime/GMTZones.js +55 -0
- package/lib/utils/datetime/common.js +52 -7
- package/lib/utils/debounce.js +6 -1
- package/lib/utils/dropDownUtils.js +175 -59
- package/lib/utils/dummyFunction.js +2 -0
- package/lib/utils/getHTMLFontSize.js +1 -0
- package/lib/utils/getInitial.js +6 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/scrollTo.js +2 -0
- package/lib/utils/shallowEqual.js +8 -0
- package/package.json +1 -1
package/es/DateTime/validator.js
CHANGED
|
@@ -11,17 +11,21 @@ const validator = {
|
|
|
11
11
|
let newValidationRules = validationRules ? validationRules : {};
|
|
12
12
|
let checkPropsRules = defaultCheckPropsRules;
|
|
13
13
|
let checkPropsOrder = [];
|
|
14
|
+
|
|
14
15
|
for (let i = 0; i < checkPropsRules.length; i++) {
|
|
15
16
|
let prop = checkPropsRules[i];
|
|
17
|
+
|
|
16
18
|
if (Object.prototype.hasOwnProperty.call(currentProps, prop)) {
|
|
17
19
|
if (newValidationRulesOrder.indexOf(prop) === -1) {
|
|
18
20
|
checkPropsOrder.push(prop);
|
|
19
21
|
}
|
|
22
|
+
|
|
20
23
|
if (!Object.prototype.hasOwnProperty.call(newValidationRules, prop)) {
|
|
21
24
|
newValidationRules[prop] = currentProps[prop];
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
28
|
+
|
|
25
29
|
newValidationRulesOrder = !Object.prototype.hasOwnProperty.call(newValidation, 'rulesOrder') ? checkPropsOrder.concat(newValidationRulesOrder) : validationRulesOrder;
|
|
26
30
|
let isRulesFound = Object.keys(newValidationRules).length;
|
|
27
31
|
newValidationRules = isRulesFound ? validator.composeRulesForValidation(newType, defaultValidateRules, newValidationRules) : newValidationRules;
|
|
@@ -47,22 +51,28 @@ const validator = {
|
|
|
47
51
|
onFailValidation
|
|
48
52
|
} = validationObj;
|
|
49
53
|
let skipIfEmptyField = null;
|
|
54
|
+
|
|
50
55
|
if (validationRules.required === false && (fieldType !== 'radio' || fieldType !== 'checkbox')) {
|
|
51
56
|
skipIfEmptyField = val => {
|
|
52
57
|
if (fieldType === 'onegroup' || fieldType === 'multigroup') {
|
|
53
58
|
return !val || !(val.length > 0);
|
|
54
59
|
}
|
|
60
|
+
|
|
55
61
|
let value = (val || '').trim();
|
|
56
62
|
return value.length < 1;
|
|
57
63
|
};
|
|
58
64
|
}
|
|
65
|
+
|
|
59
66
|
if (skipIfEmptyField === null || skipIfEmptyField(text) === false) {
|
|
60
67
|
for (let i = 0, len = validationRulesOrder.length; i < len; i++) {
|
|
61
68
|
let rule = validationRulesOrder[i];
|
|
69
|
+
|
|
62
70
|
if (!validationRules[rule] || !typeChecker.isFunction(validationRules[rule])) {
|
|
63
71
|
continue;
|
|
64
72
|
}
|
|
73
|
+
|
|
65
74
|
let isInValid = validationRules[rule](text, inputTag);
|
|
75
|
+
|
|
66
76
|
if (isInValid) {
|
|
67
77
|
let message = validationMessages[rule] && typeChecker.isFunction(validationMessages[rule]) ? validationMessages[rule](text, inputTag) : validationMessages[rule];
|
|
68
78
|
onFailValidation && onFailValidation(rule, message, inputTag);
|
|
@@ -70,52 +80,66 @@ const validator = {
|
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
}
|
|
83
|
+
|
|
73
84
|
onPassValidation && onPassValidation(text, inputTag);
|
|
74
85
|
},
|
|
75
86
|
composeRulesForValidation: (type, defaultValidateRules, newValidationRules) => {
|
|
76
87
|
let defaultPatterns = validator.regexs;
|
|
88
|
+
|
|
77
89
|
for (let i = 0, len = defaultValidateRules.length; i < len; i++) {
|
|
78
90
|
let rule = defaultValidateRules[i];
|
|
79
91
|
let ruleInfo = newValidationRules[rule] || '';
|
|
92
|
+
|
|
80
93
|
if (ruleInfo && !typeChecker.isFunction(ruleInfo)) {
|
|
81
94
|
if (rule === 'required' && ruleInfo === true) {
|
|
82
95
|
newValidationRules[rule] = (val, el) => {
|
|
83
96
|
if (el.willValidate && el.validity.valueMissing) {
|
|
84
97
|
return true;
|
|
85
98
|
}
|
|
99
|
+
|
|
86
100
|
if (type === 'radio' || type === 'checkbox') {
|
|
87
101
|
return el.checked === false;
|
|
88
102
|
}
|
|
103
|
+
|
|
89
104
|
if (type === 'onegroup' || type === 'multigroup') {
|
|
90
105
|
return !val || val.length < 1;
|
|
91
106
|
}
|
|
107
|
+
|
|
92
108
|
let value = (val || '').replace(/\s{2,}/g, ' ').trim();
|
|
93
109
|
return value.length < 1;
|
|
94
110
|
};
|
|
95
111
|
} else if (rule === 'maxLength' && !Number.isNaN(ruleInfo) && Number.isFinite(ruleInfo)) {
|
|
96
112
|
let maxLength = Number(ruleInfo);
|
|
113
|
+
|
|
97
114
|
newValidationRules[rule] = (val, el) => {
|
|
98
115
|
if (el.willValidate && el.validity.tooLong) {
|
|
99
116
|
return true;
|
|
100
117
|
}
|
|
118
|
+
|
|
101
119
|
let value = val || '';
|
|
120
|
+
|
|
102
121
|
if (type !== 'multigroup') {
|
|
103
122
|
value = val.trim();
|
|
104
123
|
}
|
|
124
|
+
|
|
105
125
|
return !(value.length <= maxLength);
|
|
106
126
|
};
|
|
107
127
|
} else if (rule === 'minLength' && !Number.isNaN(ruleInfo) && Number.isFinite(ruleInfo)) {
|
|
108
128
|
let minLength = Number(ruleInfo);
|
|
129
|
+
|
|
109
130
|
newValidationRules[rule] = val => {
|
|
110
131
|
let value = val || '';
|
|
132
|
+
|
|
111
133
|
if (type !== 'multigroup') {
|
|
112
134
|
value = val.trim();
|
|
113
135
|
}
|
|
136
|
+
|
|
114
137
|
return !(value.length >= minLength);
|
|
115
138
|
};
|
|
116
139
|
} else if (rule === 'rangeLength' && /^([-+\d]+)*([,]{1,1}([-+\d]+))$/.test(ruleInfo) === true) {
|
|
117
140
|
let rangeLength = ruleInfo;
|
|
118
141
|
rangeLength = rangeLength.split(',').map(a => Number(a));
|
|
142
|
+
|
|
119
143
|
newValidationRules[rule] = val => {
|
|
120
144
|
let value = (val || '').trim();
|
|
121
145
|
return !(value.length >= rangeLength[0] && value.length <= rangeLength[1]);
|
|
@@ -123,119 +147,146 @@ const validator = {
|
|
|
123
147
|
} else if (rule === 'step' && ruleInfo) {
|
|
124
148
|
let step = Number(ruleInfo);
|
|
125
149
|
let stepTypes = ['number', 'range', 'date', 'datetime', 'datetime-local', 'month', 'time', 'week'];
|
|
150
|
+
|
|
126
151
|
newValidationRules[rule] = (val, el) => {
|
|
127
152
|
if (stepTypes.indexOf(type) !== -1) {
|
|
128
153
|
if (el.willValidate && el.validity.stepMismatch) {
|
|
129
154
|
return true;
|
|
130
155
|
}
|
|
156
|
+
|
|
131
157
|
return false;
|
|
132
158
|
}
|
|
159
|
+
|
|
133
160
|
let value = (val || '').trim();
|
|
134
161
|
value = Number(value);
|
|
162
|
+
|
|
135
163
|
if (Number.isNaN(value) || !Number.isFinite(value) || Number.isNaN(step) || !Number.isFinite(step)) {
|
|
136
164
|
return true;
|
|
137
165
|
}
|
|
166
|
+
|
|
138
167
|
return !(value % step === 0);
|
|
139
168
|
};
|
|
140
169
|
} else if (rule === 'max') {
|
|
141
170
|
let max = Number(ruleInfo);
|
|
142
171
|
let maxTypes = ['number', 'range', 'date', 'datetime', 'datetime-local', 'month', 'time', 'week'];
|
|
172
|
+
|
|
143
173
|
newValidationRules[rule] = (val, el) => {
|
|
144
174
|
if (maxTypes.indexOf(type) !== -1) {
|
|
145
175
|
if (el.willValidate && el.validity.rangeOverflow) {
|
|
146
176
|
return true;
|
|
147
177
|
}
|
|
178
|
+
|
|
148
179
|
return false;
|
|
149
180
|
}
|
|
181
|
+
|
|
150
182
|
let value = (val || '').trim();
|
|
151
183
|
value = Number(value);
|
|
184
|
+
|
|
152
185
|
if (Number.isNaN(value) || !Number.isFinite(value) || Number.isNaN(max) || !Number.isFinite(max)) {
|
|
153
186
|
return true;
|
|
154
187
|
}
|
|
188
|
+
|
|
155
189
|
return !(value <= max);
|
|
156
190
|
};
|
|
157
191
|
} else if (rule === 'min') {
|
|
158
192
|
let min = Number(ruleInfo);
|
|
159
193
|
let minTypes = ['number', 'range', 'date', 'datetime', 'datetime-local', 'month', 'time', 'week'];
|
|
194
|
+
|
|
160
195
|
newValidationRules[rule] = (val, el) => {
|
|
161
196
|
if (minTypes.indexOf(type) !== -1) {
|
|
162
197
|
if (el.willValidate && el.validity.rangeUnderflow) {
|
|
163
198
|
return true;
|
|
164
199
|
}
|
|
200
|
+
|
|
165
201
|
return false;
|
|
166
202
|
}
|
|
203
|
+
|
|
167
204
|
let value = (val || '').trim();
|
|
168
205
|
value = Number(value);
|
|
206
|
+
|
|
169
207
|
if (Number.isNaN(value) || !Number.isFinite(value) || Number.isNaN(min) || !Number.isFinite(min)) {
|
|
170
208
|
return true;
|
|
171
209
|
}
|
|
210
|
+
|
|
172
211
|
return !(value >= min);
|
|
173
212
|
};
|
|
174
213
|
} else if (rule === 'range' && /^([-+\d]+)*([,]{1,1}([-+\d]+))$/.test(ruleInfo) === true) {
|
|
175
214
|
let ranges;
|
|
176
215
|
ranges = ranges.split(',').map(a => Number(a));
|
|
216
|
+
|
|
177
217
|
newValidationRules[rule] = val => {
|
|
178
218
|
let value = (val || '').trim();
|
|
179
219
|
value = Number(value);
|
|
220
|
+
|
|
180
221
|
if (Number.isNaN(value) || !Number.isFinite(value)) {
|
|
181
222
|
return true;
|
|
182
223
|
}
|
|
224
|
+
|
|
183
225
|
return !(value >= ranges[0] && value <= ranges[1]);
|
|
184
226
|
};
|
|
185
227
|
} else if ((rule === 'digits' || rule === 'integer' || rule === 'double') && ruleInfo === true) {
|
|
186
228
|
newValidationRules[rule] = val => {
|
|
187
229
|
let value = (val || '').trim();
|
|
188
230
|
value = Number(value);
|
|
231
|
+
|
|
189
232
|
if (Number.isNaN(value) || !Number.isFinite(value)) {
|
|
190
233
|
return true;
|
|
191
234
|
}
|
|
235
|
+
|
|
192
236
|
let condition = true;
|
|
237
|
+
|
|
193
238
|
if (rule === 'integer') {
|
|
194
239
|
condition = Number.isSafeInteger(value);
|
|
195
240
|
}
|
|
241
|
+
|
|
196
242
|
if (rule === 'double') {
|
|
197
243
|
condition = -Number.MAX_VALUE <= value && Number.MAX_VALUE >= value;
|
|
198
244
|
}
|
|
245
|
+
|
|
199
246
|
return !defaultPatterns[rule].test(value) && condition;
|
|
200
247
|
};
|
|
201
248
|
} else if ((rule === 'timezonedate' || rule === 'datetimezone' || rule === 'date' || rule === 'datetime') && ruleInfo === true) {
|
|
202
249
|
newValidationRules[rule] = val => {
|
|
203
250
|
let value = (val || '').trim();
|
|
251
|
+
|
|
204
252
|
if (!defaultPatterns[rule].test(value)) {
|
|
205
253
|
return true;
|
|
206
254
|
}
|
|
255
|
+
|
|
207
256
|
if (rule === 'datetime') {
|
|
208
257
|
let index = 0;
|
|
209
|
-
value = value.split('T')[index];
|
|
210
|
-
//let timings = value[1].replace("Z","").split(":")
|
|
258
|
+
value = value.split('T')[index]; //let timings = value[1].replace("Z","").split(":")
|
|
211
259
|
//let
|
|
212
260
|
//if( !defaultPatterns[rule].test(value); )
|
|
213
261
|
}
|
|
214
262
|
|
|
215
263
|
value = value.replace('/', '-');
|
|
216
264
|
value = value.replace(':', '-');
|
|
217
|
-
let values = value.split('-');
|
|
265
|
+
let values = value.split('-'); // Extract the string into month, date and year
|
|
218
266
|
|
|
219
|
-
// Extract the string into month, date and year
|
|
220
267
|
let yy = parseInt(values[0]);
|
|
221
268
|
let mm = parseInt(values[1]);
|
|
222
|
-
let dd = parseInt(values[2]);
|
|
269
|
+
let dd = parseInt(values[2]); // Create list of days of a month [assume there is no leap year by default]
|
|
223
270
|
|
|
224
|
-
// Create list of days of a month [assume there is no leap year by default]
|
|
225
271
|
let ListofDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
272
|
+
|
|
226
273
|
if (mm === 1 || mm > 2) {
|
|
227
274
|
if (dd > ListofDays[mm - 1]) {
|
|
228
275
|
return true;
|
|
229
276
|
}
|
|
230
277
|
}
|
|
278
|
+
|
|
231
279
|
if (mm === 2) {
|
|
232
280
|
let lyear = false;
|
|
281
|
+
|
|
233
282
|
if (!(yy % 4) && yy % 100 || !(yy % 400)) {
|
|
234
283
|
lyear = true;
|
|
235
284
|
}
|
|
285
|
+
|
|
236
286
|
if (lyear === false && dd >= 29) {
|
|
237
287
|
return true;
|
|
238
288
|
}
|
|
289
|
+
|
|
239
290
|
if (lyear === true && dd > 29) {
|
|
240
291
|
return true;
|
|
241
292
|
}
|
|
@@ -254,6 +305,7 @@ const validator = {
|
|
|
254
305
|
}
|
|
255
306
|
}
|
|
256
307
|
}
|
|
308
|
+
|
|
257
309
|
return newValidationRules;
|
|
258
310
|
},
|
|
259
311
|
regexs: {
|
package/es/DropBox/DropBox.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
2
3
|
import React, { useRef, Fragment, useContext } from 'react';
|
|
3
4
|
import FocusScope from '@zohodesk/a11y/es/FocusScope/FocusScope';
|
|
4
5
|
import Modal from '../Modal/Modal';
|
|
@@ -26,14 +27,17 @@ export default function DropBox(props) {
|
|
|
26
27
|
direction
|
|
27
28
|
} = DropBoxContext || {};
|
|
28
29
|
let windowWidth,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
mobileWidth = getLibraryConfig('mobileWidth'),
|
|
31
|
+
isModel = false;
|
|
32
|
+
|
|
31
33
|
if (needResponsive) {
|
|
32
34
|
windowWidth = window.innerWidth;
|
|
35
|
+
|
|
33
36
|
if (windowWidth <= mobileWidth) {
|
|
34
37
|
isModel = true;
|
|
35
38
|
}
|
|
36
39
|
}
|
|
40
|
+
|
|
37
41
|
const {
|
|
38
42
|
zIndexStyle
|
|
39
43
|
} = cssJSLogic(props);
|
|
@@ -30,6 +30,7 @@ export default function DropBoxElement(props) {
|
|
|
30
30
|
animationStyle
|
|
31
31
|
} = props;
|
|
32
32
|
let isAbsolute = isAbsolutePositioningNeeded;
|
|
33
|
+
|
|
33
34
|
const FireOnAnimationEnd = () => {
|
|
34
35
|
let eleClassList = subContainerRef && subContainerRef.current.classList;
|
|
35
36
|
let animationStyles = animationStyle == 'default' ? style.fadeInScale : style[animationStyle];
|
|
@@ -39,19 +40,23 @@ export default function DropBoxElement(props) {
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
};
|
|
43
|
+
|
|
42
44
|
const getRef = ele => {
|
|
43
45
|
const {
|
|
44
46
|
getRef,
|
|
45
47
|
forwardRef
|
|
46
48
|
} = props;
|
|
47
49
|
getRef && getRef(ele);
|
|
50
|
+
|
|
48
51
|
if (forwardRef) {
|
|
49
52
|
forwardRef.current = ele;
|
|
50
53
|
}
|
|
51
54
|
};
|
|
55
|
+
|
|
52
56
|
if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
|
|
53
57
|
isAbsolute = true;
|
|
54
58
|
}
|
|
59
|
+
|
|
55
60
|
const {
|
|
56
61
|
role,
|
|
57
62
|
ariaMultiselectable,
|
|
@@ -59,12 +64,14 @@ export default function DropBoxElement(props) {
|
|
|
59
64
|
} = a11y;
|
|
60
65
|
boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
|
|
61
66
|
const boxDirection = positionMapping[boxPosition].direction;
|
|
67
|
+
|
|
62
68
|
if (isAbsolute) {
|
|
63
69
|
arrowPosition = arrowPosition ? arrowPosition : positionMapping[boxPosition].arrowPosition;
|
|
64
70
|
boxPosition = positionMapping[boxPosition].positionStyle;
|
|
65
71
|
} else {
|
|
66
72
|
arrowPosition = positionMapping[boxPosition].arrowPosition;
|
|
67
73
|
}
|
|
74
|
+
|
|
68
75
|
const {
|
|
69
76
|
arrowstyle,
|
|
70
77
|
boxstyle,
|
|
@@ -40,9 +40,7 @@ export default function cssJSLogic(_ref) {
|
|
|
40
40
|
customDropBoxWrap = '',
|
|
41
41
|
customMobileDropBoxWrap = ''
|
|
42
42
|
} = customClass;
|
|
43
|
-
const animationValue = animationStyle === 'default' ? 'fadeInScale' : animationStyle;
|
|
44
|
-
|
|
45
|
-
// const {needBoxStyle,boxstyle} = useDropboxPosCalc(props)
|
|
43
|
+
const animationValue = animationStyle === 'default' ? 'fadeInScale' : animationStyle; // const {needBoxStyle,boxstyle} = useDropboxPosCalc(props)
|
|
46
44
|
|
|
47
45
|
let boxClassName = compileClassNames({
|
|
48
46
|
[style.main]: true,
|
|
@@ -70,17 +68,21 @@ export default function cssJSLogic(_ref) {
|
|
|
70
68
|
[style[animationValue]]: !isModel && isAnimate && !isReducedMotion && isActive && !!animationStyle
|
|
71
69
|
});
|
|
72
70
|
let inlineStyle = !isModel ? isAbsolute ? needBoxStyle && boxstyle : positionsOffset && positionsOffset[boxPosition] || {} : {};
|
|
71
|
+
|
|
73
72
|
if (zIndexStyle) {
|
|
74
73
|
inlineStyle = Object.assign({}, inlineStyle, zIndexStyle);
|
|
75
74
|
}
|
|
75
|
+
|
|
76
76
|
if (!isModel && !isAbsolute && size === 'default' && targetOffset && isActive) {
|
|
77
77
|
inlineStyle = Object.assign({}, inlineStyle, {
|
|
78
78
|
width: targetOffset.width
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
|
|
81
82
|
if (customInlineStyle) {
|
|
82
83
|
inlineStyle = Object.assign({}, inlineStyle, customInlineStyle);
|
|
83
84
|
}
|
|
85
|
+
|
|
84
86
|
return {
|
|
85
87
|
boxClassName,
|
|
86
88
|
subContainerClass,
|
|
@@ -17,6 +17,7 @@ export default function useDropboxPosCalc(props) {
|
|
|
17
17
|
let arrowstyle = {};
|
|
18
18
|
const needBoxStyle = right || left || top || bottom;
|
|
19
19
|
const needArrowStyle = arrowLeft || arrowRight || arrowTop || arrowBottom;
|
|
20
|
+
|
|
20
21
|
if (needBoxStyle) {
|
|
21
22
|
boxstyle = !isModel ? direction === 'rtl' ? {
|
|
22
23
|
right: [remConvert(left)] + unit,
|
|
@@ -30,6 +31,7 @@ export default function useDropboxPosCalc(props) {
|
|
|
30
31
|
bottom: [remConvert(bottom)] + unit
|
|
31
32
|
} : {};
|
|
32
33
|
}
|
|
34
|
+
|
|
33
35
|
if (needArrowStyle) {
|
|
34
36
|
arrowstyle = !isModel ? direction === 'rtl' ? {
|
|
35
37
|
right: [remConvert(arrowLeft)] + unit,
|
|
@@ -43,6 +45,7 @@ export default function useDropboxPosCalc(props) {
|
|
|
43
45
|
bottom: [remConvert(arrowBottom)] + unit
|
|
44
46
|
} : {};
|
|
45
47
|
}
|
|
48
|
+
|
|
46
49
|
return {
|
|
47
50
|
needBoxStyle,
|
|
48
51
|
boxstyle,
|
package/es/DropDown/DropDown.js
CHANGED
|
@@ -3,7 +3,6 @@ import { DropDown_propTypes, DropDownTarget_propTypes, DropDownContainer_propTyp
|
|
|
3
3
|
import { DropDownItemContainer_defaultProps } from './props/defaultProps';
|
|
4
4
|
import style from './DropDown.module.css';
|
|
5
5
|
import PopOver, { PopOverTarget, PopOverContainer } from '../PopOver/PopOver';
|
|
6
|
-
|
|
7
6
|
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['dropdown', 'shadow', 'target', 'menu', 'header', 'headertext', 'list', 'padding', 'listHover', 'active', 'children', 'user', 'footer', 'separator', 'small', 'search', 'medium', 'heading'] }] */
|
|
8
7
|
|
|
9
8
|
export default class DropDown extends React.Component {
|
|
@@ -13,10 +12,9 @@ export default class DropDown extends React.Component {
|
|
|
13
12
|
} = this.props;
|
|
14
13
|
return /*#__PURE__*/React.createElement(PopOver, this.props, /*#__PURE__*/React.createElement(PopOverTarget, null, children[0]), /*#__PURE__*/React.createElement(PopOverContainer, null, children[1]));
|
|
15
14
|
}
|
|
16
|
-
}
|
|
17
|
-
DropDown.propTypes = DropDown_propTypes;
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
}
|
|
17
|
+
DropDown.propTypes = DropDown_propTypes; // if (__DOCS__) {
|
|
20
18
|
// DropDown.docs = {
|
|
21
19
|
// componentGroup: 'Form Elements',
|
|
22
20
|
// folderName: 'Style Guide'
|
|
@@ -30,6 +28,7 @@ export class DropDownTarget extends React.Component {
|
|
|
30
28
|
} = this.props;
|
|
31
29
|
return /*#__PURE__*/React.createElement("div", null, children);
|
|
32
30
|
}
|
|
31
|
+
|
|
33
32
|
}
|
|
34
33
|
DropDownTarget.propTypes = DropDownTarget_propTypes;
|
|
35
34
|
export class DropDownContainer extends React.Component {
|
|
@@ -39,6 +38,7 @@ export class DropDownContainer extends React.Component {
|
|
|
39
38
|
} = this.props;
|
|
40
39
|
return /*#__PURE__*/React.createElement("div", null, " ", children, " ");
|
|
41
40
|
}
|
|
41
|
+
|
|
42
42
|
}
|
|
43
43
|
DropDownContainer.propTypes = DropDownContainer_propTypes;
|
|
44
44
|
export class DropDownItemContainer extends React.Component {
|
|
@@ -47,18 +47,21 @@ export class DropDownItemContainer extends React.Component {
|
|
|
47
47
|
this.getRef = this.getRef.bind(this);
|
|
48
48
|
this.onScroll = this.onScroll.bind(this);
|
|
49
49
|
}
|
|
50
|
+
|
|
50
51
|
onScroll(e) {
|
|
51
52
|
let {
|
|
52
53
|
onScroll
|
|
53
54
|
} = this.props;
|
|
54
55
|
onScroll && onScroll(e);
|
|
55
56
|
}
|
|
57
|
+
|
|
56
58
|
getRef(ele) {
|
|
57
59
|
let {
|
|
58
60
|
getRef
|
|
59
61
|
} = this.props;
|
|
60
62
|
getRef && getRef(ele);
|
|
61
63
|
}
|
|
64
|
+
|
|
62
65
|
render() {
|
|
63
66
|
let {
|
|
64
67
|
children,
|
|
@@ -71,6 +74,7 @@ export class DropDownItemContainer extends React.Component {
|
|
|
71
74
|
"data-id": dataId
|
|
72
75
|
}, children);
|
|
73
76
|
}
|
|
77
|
+
|
|
74
78
|
}
|
|
75
79
|
DropDownItemContainer.propTypes = DropDownItemContainer_propTypes;
|
|
76
80
|
DropDownItemContainer.defaultProps = DropDownItemContainer_defaultProps;
|
|
@@ -28,15 +28,14 @@ export default class DropDownHeading extends React.Component {
|
|
|
28
28
|
"aria-label": ariaLabel,
|
|
29
29
|
id: htmlId,
|
|
30
30
|
"data-id": dataId,
|
|
31
|
-
"data-selector-id": dataSelectorId
|
|
32
|
-
|
|
31
|
+
"data-selector-id": dataSelectorId // tabindex='0'
|
|
32
|
+
|
|
33
33
|
}, text, children);
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
}
|
|
36
37
|
DropDownHeading.propTypes = DropDownHeading_propTypes;
|
|
37
|
-
DropDownHeading.defaultProps = DropDownHeading_defaultProps;
|
|
38
|
-
|
|
39
|
-
// if (__DOCS__) {
|
|
38
|
+
DropDownHeading.defaultProps = DropDownHeading_defaultProps; // if (__DOCS__) {
|
|
40
39
|
// DropDownHeading.docs = {
|
|
41
40
|
// componentGroup: 'Form Elements',
|
|
42
41
|
// folderName: 'Style Guide'
|
|
@@ -10,6 +10,7 @@ export default class DropDownItem extends React.Component {
|
|
|
10
10
|
this.getSelectedElement = this.getSelectedElement.bind(this);
|
|
11
11
|
this.onHover = this.onHover.bind(this);
|
|
12
12
|
}
|
|
13
|
+
|
|
13
14
|
getRef(ele) {
|
|
14
15
|
this.ele = ele;
|
|
15
16
|
let {
|
|
@@ -18,9 +19,11 @@ export default class DropDownItem extends React.Component {
|
|
|
18
19
|
} = this.props;
|
|
19
20
|
getRef && getRef(ele, index);
|
|
20
21
|
}
|
|
22
|
+
|
|
21
23
|
getSelectedElement() {
|
|
22
24
|
return this.ele ? this.ele : null;
|
|
23
25
|
}
|
|
26
|
+
|
|
24
27
|
onClick(e) {
|
|
25
28
|
let {
|
|
26
29
|
onClick,
|
|
@@ -30,6 +33,7 @@ export default class DropDownItem extends React.Component {
|
|
|
30
33
|
} = this.props;
|
|
31
34
|
onClick && onClick(id, value, index, e);
|
|
32
35
|
}
|
|
36
|
+
|
|
33
37
|
onHover(e) {
|
|
34
38
|
let {
|
|
35
39
|
onHover,
|
|
@@ -39,6 +43,7 @@ export default class DropDownItem extends React.Component {
|
|
|
39
43
|
} = this.props;
|
|
40
44
|
onHover && onHover(id, value, index, e);
|
|
41
45
|
}
|
|
46
|
+
|
|
42
47
|
render() {
|
|
43
48
|
let {
|
|
44
49
|
value,
|
|
@@ -64,6 +69,7 @@ export default class DropDownItem extends React.Component {
|
|
|
64
69
|
className: style.user
|
|
65
70
|
}, " ", children[1], " ") : '');
|
|
66
71
|
}
|
|
72
|
+
|
|
67
73
|
}
|
|
68
74
|
DropDownItem.propTypes = DropDownItem_propTypes;
|
|
69
75
|
DropDownItem.defaultProps = DropDownItem_defaultProps;
|
|
@@ -10,11 +10,13 @@ export default class DropDownSearch extends React.Component {
|
|
|
10
10
|
super(props);
|
|
11
11
|
this.getRef = this.getRef.bind(this);
|
|
12
12
|
}
|
|
13
|
+
|
|
13
14
|
componentDidMount() {
|
|
14
15
|
this.input && this.input.focus({
|
|
15
16
|
preventScroll: true
|
|
16
17
|
});
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
getRef(ele) {
|
|
19
21
|
let {
|
|
20
22
|
getRef
|
|
@@ -22,6 +24,7 @@ export default class DropDownSearch extends React.Component {
|
|
|
22
24
|
this.input = ele;
|
|
23
25
|
getRef && getRef(ele);
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
render() {
|
|
26
29
|
let {
|
|
27
30
|
name,
|
|
@@ -56,6 +59,7 @@ export default class DropDownSearch extends React.Component {
|
|
|
56
59
|
customClass: customTextBox
|
|
57
60
|
}));
|
|
58
61
|
}
|
|
62
|
+
|
|
59
63
|
}
|
|
60
64
|
DropDownSearch.defaultProps = DropDownSearch_defaultProps;
|
|
61
65
|
DropDownSearch.propTypes = DropDownSearch_propTypes;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DropDownItemContainer, DropDownContainer, DropDownTarget } from '../DropDown';
|
|
3
|
-
// import renderer from 'react-test-renderer';
|
|
2
|
+
import { DropDownItemContainer, DropDownContainer, DropDownTarget } from '../DropDown'; // import renderer from 'react-test-renderer';
|
|
4
3
|
|
|
5
4
|
const defaultProps = {
|
|
6
5
|
onScroll: jest.fn(),
|
package/es/Heading/Heading.js
CHANGED
|
@@ -23,11 +23,10 @@ export default class Heading extends React.Component {
|
|
|
23
23
|
...a11y
|
|
24
24
|
}, title);
|
|
25
25
|
}
|
|
26
|
+
|
|
26
27
|
}
|
|
27
28
|
Heading.propTypes = propTypes;
|
|
28
|
-
Heading.defaultProps = defaultProps;
|
|
29
|
-
|
|
30
|
-
// if (__DOCS__) {
|
|
29
|
+
Heading.defaultProps = defaultProps; // if (__DOCS__) {
|
|
31
30
|
// Heading.docs = {
|
|
32
31
|
// folderName: 'Style Guide',
|
|
33
32
|
// componentGroup: 'Accessibility'
|
package/es/Label/Label.js
CHANGED
|
@@ -34,11 +34,10 @@ export default class Label extends React.Component {
|
|
|
34
34
|
id: id
|
|
35
35
|
}, text);
|
|
36
36
|
}
|
|
37
|
+
|
|
37
38
|
}
|
|
38
39
|
Label.defaultProps = defaultProps;
|
|
39
|
-
Label.propTypes = propTypes;
|
|
40
|
-
|
|
41
|
-
// if (__DOCS__) {
|
|
40
|
+
Label.propTypes = propTypes; // if (__DOCS__) {
|
|
42
41
|
// Label.docs = {
|
|
43
42
|
// componentGroup: 'Form Elements',
|
|
44
43
|
// folderName: 'Style Guide'
|