@zohodesk/components 1.0.0-temp-158 → 1.0.0-temp-160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Accordion/Accordion.js +3 -7
- package/es/Accordion/AccordionItem.js +2 -4
- package/es/Animation/Animation.js +3 -3
- package/es/AppContainer/AppContainer.js +5 -13
- package/es/Avatar/Avatar.js +11 -23
- package/es/AvatarTeam/AvatarTeam.js +3 -3
- package/es/Button/Button.js +3 -4
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Card/Card.js +10 -21
- package/es/CheckBox/CheckBox.js +3 -5
- package/es/DateTime/CalendarView.js +20 -32
- package/es/DateTime/DateTime.js +6 -67
- package/es/DateTime/DateTimePopupFooter.js +2 -4
- package/es/DateTime/DateTimePopupHeader.js +2 -8
- package/es/DateTime/DateWidget.js +35 -98
- package/es/DateTime/DaysRow.js +2 -4
- package/es/DateTime/Time.js +2 -10
- package/es/DateTime/YearView.js +4 -28
- package/es/DateTime/__tests__/CalendarView.spec.js +0 -1
- package/es/DateTime/__tests__/DateTime.spec.js +0 -1
- package/es/DateTime/__tests__/DateWidget.spec.js +3 -2
- package/es/DateTime/common.js +0 -3
- package/es/DateTime/constants.js +0 -1
- package/es/DateTime/dateFormatUtils/dateFormat.js +30 -63
- package/es/DateTime/dateFormatUtils/dateFormats.js +1 -0
- package/es/DateTime/dateFormatUtils/dayChange.js +4 -13
- package/es/DateTime/dateFormatUtils/index.js +2 -32
- package/es/DateTime/dateFormatUtils/monthChange.js +0 -8
- package/es/DateTime/dateFormatUtils/timeChange.js +6 -22
- package/es/DateTime/dateFormatUtils/yearChange.js +2 -11
- package/es/DateTime/objectUtils.js +20 -14
- package/es/DateTime/typeChecker.js +0 -3
- package/es/DateTime/validator.js +6 -58
- package/es/DropBox/DropBox.js +2 -6
- package/es/DropBox/DropBoxElement/DropBoxElement.js +0 -7
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +3 -5
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +0 -3
- package/es/DropBox/props/defaultProps.js +2 -1
- package/es/DropBox/props/propTypes.js +2 -1
- package/es/DropDown/DropDown.js +4 -8
- package/es/DropDown/DropDownHeading.js +5 -4
- package/es/DropDown/DropDownItem.js +0 -6
- package/es/DropDown/DropDownSearch.js +0 -4
- package/es/DropDown/DropDownSeparator.js +0 -1
- package/es/DropDown/__tests__/DropDown.spec.js +2 -1
- package/es/Heading/Heading.js +3 -2
- package/es/Label/Label.js +3 -2
- package/es/Layout/Box.js +0 -13
- package/es/Layout/Container.js +1 -12
- package/es/Layout/index.js +2 -1
- package/es/ListItem/ListContainer.js +3 -8
- package/es/ListItem/ListItem.js +3 -9
- package/es/ListItem/ListItemWithAvatar.js +3 -9
- package/es/ListItem/ListItemWithCheckBox.js +2 -7
- package/es/ListItem/ListItemWithIcon.js +3 -8
- package/es/ListItem/ListItemWithRadio.js +3 -7
- package/es/Modal/Modal.js +11 -28
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +13 -89
- package/es/MultiSelect/AdvancedMultiSelect.js +9 -32
- package/es/MultiSelect/EmptyState.js +0 -2
- package/es/MultiSelect/MultiSelect.js +32 -99
- package/es/MultiSelect/MultiSelectHeader.js +0 -3
- package/es/MultiSelect/MultiSelectWithAvatar.js +6 -12
- package/es/MultiSelect/SelectedOptions.js +3 -6
- package/es/MultiSelect/Suggestions.js +3 -7
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +6 -4
- package/es/MultiSelect/props/propTypes.js +0 -2
- package/es/PopOver/PopOver.js +2 -18
- package/es/PopOver/__tests__/PopOver.spec.js +1 -2
- package/es/Popup/Popup.js +24 -77
- package/es/Popup/__tests__/Popup.spec.js +5 -17
- package/es/Popup/viewPort.js +4 -16
- package/es/Provider/IdProvider.js +5 -10
- package/es/Provider/LibraryContext.js +4 -6
- package/es/Provider/NumberGenerator/NumberGenerator.js +7 -21
- package/es/Provider/ZindexProvider.js +2 -9
- package/es/Radio/Radio.js +2 -4
- package/es/Responsive/CustomResponsive.js +18 -30
- package/es/Responsive/RefWrapper.js +7 -6
- package/es/Responsive/ResizeComponent.js +25 -35
- package/es/Responsive/ResizeObserver.js +6 -26
- package/es/Responsive/Responsive.js +20 -34
- package/es/Responsive/index.js +3 -1
- package/es/Responsive/sizeObservers.js +7 -28
- package/es/Responsive/utils/index.js +5 -7
- package/es/Responsive/utils/shallowCompare.js +2 -7
- package/es/Responsive/windowResizeObserver.js +0 -7
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +0 -4
- package/es/Ribbon/Ribbon.js +2 -3
- package/es/RippleEffect/RippleEffect.js +3 -1
- package/es/Select/GroupSelect.js +14 -58
- package/es/Select/Select.js +33 -79
- package/es/Select/SelectWithAvatar.js +4 -17
- package/es/Select/SelectWithIcon.js +5 -46
- package/es/Select/__tests__/Select.spec.js +8 -6
- package/es/Select/props/propTypes.js +0 -1
- package/es/Stencils/Stencils.js +3 -3
- package/es/Switch/Switch.js +3 -5
- package/es/Tab/Tab.js +4 -4
- package/es/Tab/TabContent.js +0 -1
- package/es/Tab/TabContentWrapper.js +0 -2
- package/es/Tab/TabWrapper.js +2 -5
- package/es/Tab/Tabs.js +7 -54
- package/es/Tab/__tests__/Tab.spec.js +3 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +0 -1
- package/es/Tag/Tag.js +3 -6
- package/es/TextBox/TextBox.js +3 -15
- package/es/TextBox/__tests__/TextBox.spec.js +4 -1
- package/es/TextBoxIcon/TextBoxIcon.js +2 -9
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +7 -2
- package/es/Textarea/Textarea.js +3 -12
- package/es/Textarea/__tests__/Textarea.spec.js +2 -2
- package/es/Tooltip/Tooltip.js +14 -58
- package/es/Tooltip/__tests__/Tooltip.spec.js +0 -5
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +2 -3
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +5 -7
- package/es/deprecated/PortalLayer/PortalLayer.js +20 -25
- package/es/semantic/Button/Button.js +2 -3
- package/es/utils/Common.js +9 -54
- package/es/utils/ContextOptimizer.js +5 -4
- package/es/utils/__tests__/debounce.spec.js +2 -2
- package/es/utils/constructFullName.js +0 -2
- package/es/utils/css/compileClassNames.js +0 -5
- package/es/utils/css/mergeStyle.js +6 -7
- package/es/utils/css/utils.js +0 -1
- package/es/utils/datetime/common.js +5 -16
- package/es/utils/debounce.js +1 -5
- package/es/utils/dropDownUtils.js +11 -68
- package/es/utils/getInitial.js +0 -4
- package/es/utils/shallowEqual.js +0 -6
- package/lib/Accordion/Accordion.js +18 -42
- package/lib/Accordion/AccordionItem.js +18 -40
- package/lib/Accordion/__tests__/Accordion.spec.js +0 -3
- package/lib/Accordion/index.js +0 -3
- package/lib/Accordion/props/propTypes.js +0 -3
- package/lib/Animation/Animation.js +18 -38
- package/lib/Animation/__tests__/Animation.spec.js +7 -11
- package/lib/Animation/props/propTypes.js +0 -3
- package/lib/AppContainer/AppContainer.js +21 -56
- package/lib/AppContainer/props/propTypes.js +0 -3
- package/lib/Avatar/Avatar.js +38 -78
- package/lib/Avatar/__tests__/Avatar.spec.js +0 -44
- package/lib/Avatar/props/propTypes.js +0 -3
- package/lib/AvatarTeam/AvatarTeam.js +30 -52
- package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +0 -13
- package/lib/AvatarTeam/props/propTypes.js +0 -3
- package/lib/Button/Button.js +20 -31
- package/lib/Button/css/cssJSLogic.js +17 -18
- package/lib/Button/index.js +0 -3
- package/lib/Button/props/defaultProps.js +0 -2
- package/lib/Button/props/propTypes.js +0 -3
- package/lib/Buttongroup/Buttongroup.js +12 -32
- package/lib/Buttongroup/__test__/Buttongroup.spec.js +0 -10
- package/lib/Buttongroup/props/propTypes.js +0 -3
- package/lib/Card/Card.js +46 -102
- package/lib/Card/__tests__/Card.spec.js +1 -10
- package/lib/Card/index.js +0 -4
- package/lib/Card/props/propTypes.js +0 -3
- package/lib/CheckBox/CheckBox.js +47 -71
- package/lib/CheckBox/__tests__/CheckBox.spec.js +0 -3
- package/lib/CheckBox/props/propTypes.js +0 -3
- package/lib/DateTime/CalendarView.js +42 -82
- package/lib/DateTime/DateTime.js +156 -240
- package/lib/DateTime/DateTimePopupFooter.js +8 -31
- package/lib/DateTime/DateTimePopupHeader.js +17 -48
- package/lib/DateTime/DateWidget.js +250 -352
- package/lib/DateTime/DaysRow.js +5 -27
- package/lib/DateTime/Time.js +32 -73
- package/lib/DateTime/YearView.js +28 -77
- package/lib/DateTime/__tests__/CalendarView.spec.js +5 -13
- package/lib/DateTime/__tests__/DateTime.spec.js +37 -51
- package/lib/DateTime/__tests__/DateWidget.spec.js +8 -10
- package/lib/DateTime/common.js +0 -6
- package/lib/DateTime/constants.js +0 -1
- package/lib/DateTime/dateFormatUtils/dateFormat.js +122 -184
- package/lib/DateTime/dateFormatUtils/dateFormats.js +1 -0
- package/lib/DateTime/dateFormatUtils/dayChange.js +7 -14
- package/lib/DateTime/dateFormatUtils/index.js +16 -74
- package/lib/DateTime/dateFormatUtils/monthChange.js +9 -19
- package/lib/DateTime/dateFormatUtils/timeChange.js +22 -54
- package/lib/DateTime/dateFormatUtils/yearChange.js +11 -22
- package/lib/DateTime/index.js +0 -2
- package/lib/DateTime/objectUtils.js +20 -24
- package/lib/DateTime/props/propTypes.js +1 -11
- package/lib/DateTime/typeChecker.js +0 -4
- package/lib/DateTime/validator.js +10 -73
- package/lib/DropBox/DropBox.js +10 -34
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +37 -58
- package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +33 -41
- package/lib/DropBox/DropBoxElement/props/propTypes.js +0 -3
- package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +9 -14
- package/lib/DropBox/__tests__/DropBox.spec.js +2 -6
- package/lib/DropBox/css/cssJSLogic.js +1 -3
- package/lib/DropBox/props/defaultProps.js +4 -8
- package/lib/DropBox/props/propTypes.js +4 -10
- package/lib/DropDown/DropDown.js +8 -52
- package/lib/DropDown/DropDownHeading.js +20 -39
- package/lib/DropDown/DropDownItem.js +20 -42
- package/lib/DropDown/DropDownSearch.js +17 -40
- package/lib/DropDown/DropDownSeparator.js +4 -24
- package/lib/DropDown/__tests__/DropDown.spec.js +9 -15
- package/lib/DropDown/__tests__/DropDownItem.spec.js +4 -9
- package/lib/DropDown/__tests__/DropDownSearch.spec.js +0 -3
- package/lib/DropDown/index.js +0 -9
- package/lib/DropDown/props/propTypes.js +4 -6
- package/lib/Heading/Heading.js +15 -37
- package/lib/Heading/props/propTypes.js +0 -3
- package/lib/Label/Label.js +19 -39
- package/lib/Label/__tests__/Label.spec.js +1 -14
- package/lib/Label/props/propTypes.js +0 -3
- package/lib/Layout/Box.js +11 -31
- package/lib/Layout/Container.js +10 -29
- package/lib/Layout/__tests__/Box.spec.js +49 -65
- package/lib/Layout/__tests__/Container.spec.js +50 -67
- package/lib/Layout/index.js +0 -3
- package/lib/Layout/props/propTypes.js +0 -3
- package/lib/Layout/utils.js +0 -10
- package/lib/ListItem/ListContainer.js +27 -48
- package/lib/ListItem/ListItem.js +45 -69
- package/lib/ListItem/ListItemWithAvatar.js +48 -75
- package/lib/ListItem/ListItemWithCheckBox.js +39 -64
- package/lib/ListItem/ListItemWithIcon.js +44 -68
- package/lib/ListItem/ListItemWithRadio.js +41 -65
- package/lib/ListItem/index.js +0 -7
- package/lib/ListItem/props/propTypes.js +4 -6
- package/lib/Modal/Modal.js +10 -45
- package/lib/Modal/props/propTypes.js +0 -3
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +166 -294
- package/lib/MultiSelect/AdvancedMultiSelect.js +125 -202
- package/lib/MultiSelect/EmptyState.js +24 -45
- package/lib/MultiSelect/MultiSelect.js +206 -323
- package/lib/MultiSelect/MultiSelectHeader.js +8 -30
- package/lib/MultiSelect/MultiSelectWithAvatar.js +63 -105
- package/lib/MultiSelect/SelectedOptions.js +17 -43
- package/lib/MultiSelect/Suggestions.js +32 -64
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +75 -86
- package/lib/MultiSelect/index.js +0 -5
- package/lib/MultiSelect/props/defaultProps.js +0 -2
- package/lib/MultiSelect/props/propTypes.js +0 -5
- package/lib/PopOver/PopOver.js +49 -95
- package/lib/PopOver/__tests__/PopOver.spec.js +1 -4
- package/lib/PopOver/index.js +0 -4
- package/lib/PopOver/props/propTypes.js +0 -3
- package/lib/Popup/Popup.js +81 -158
- package/lib/Popup/__tests__/Popup.spec.js +8 -43
- package/lib/Popup/viewPort.js +14 -28
- package/lib/Provider/AvatarSize.js +0 -4
- package/lib/Provider/Config.js +0 -2
- package/lib/Provider/CssProvider.js +0 -4
- package/lib/Provider/IdProvider.js +6 -17
- package/lib/Provider/LibraryContext.js +15 -35
- package/lib/Provider/LibraryContextInit.js +0 -4
- package/lib/Provider/NumberGenerator/NumberGenerator.js +15 -44
- package/lib/Provider/ZindexProvider.js +3 -15
- package/lib/Provider/index.js +0 -5
- package/lib/Radio/Radio.js +38 -61
- package/lib/Radio/__tests__/Radiospec.js +5 -9
- package/lib/Radio/props/propTypes.js +0 -3
- package/lib/Responsive/CustomResponsive.js +29 -73
- package/lib/Responsive/RefWrapper.js +11 -17
- package/lib/Responsive/ResizeComponent.js +36 -62
- package/lib/Responsive/ResizeObserver.js +10 -24
- package/lib/Responsive/Responsive.js +30 -80
- package/lib/Responsive/index.js +0 -4
- package/lib/Responsive/props/propTypes.js +0 -3
- package/lib/Responsive/sizeObservers.js +17 -53
- package/lib/Responsive/utils/index.js +3 -11
- package/lib/Responsive/utils/shallowCompare.js +2 -11
- package/lib/Responsive/windowResizeObserver.js +0 -8
- package/lib/ResponsiveDropBox/ResponsiveDropBox.js +17 -45
- package/lib/ResponsiveDropBox/props/propTypes.js +0 -3
- package/lib/Ribbon/Ribbon.js +13 -33
- package/lib/Ribbon/__tests__/Ribbon.spec.js +0 -22
- package/lib/Ribbon/props/propTypes.js +0 -3
- package/lib/RippleEffect/RippleEffect.js +10 -18
- package/lib/RippleEffect/props/propTypes.js +0 -3
- package/lib/Select/GroupSelect.js +130 -229
- package/lib/Select/Select.js +209 -290
- package/lib/Select/SelectWithAvatar.js +56 -102
- package/lib/Select/SelectWithIcon.js +76 -132
- package/lib/Select/__tests__/Select.spec.js +91 -133
- package/lib/Select/index.js +0 -5
- package/lib/Select/props/defaultProps.js +4 -5
- package/lib/Select/props/propTypes.js +0 -4
- package/lib/Stencils/Stencils.js +10 -29
- package/lib/Stencils/__tests__/Stencils.spec.js +0 -12
- package/lib/Stencils/props/propTypes.js +0 -3
- package/lib/Switch/Switch.js +34 -57
- package/lib/Switch/props/propTypes.js +0 -3
- package/lib/Tab/Tab.js +27 -40
- package/lib/Tab/TabContent.js +5 -12
- package/lib/Tab/TabContentWrapper.js +6 -13
- package/lib/Tab/TabWrapper.js +19 -37
- package/lib/Tab/Tabs.js +91 -171
- package/lib/Tab/__tests__/Tab.spec.js +58 -67
- package/lib/Tab/__tests__/TabContent.spec.js +6 -10
- package/lib/Tab/__tests__/TabContentWrapper.spec.js +20 -28
- package/lib/Tab/__tests__/TabWrapper.spec.js +0 -12
- package/lib/Tab/__tests__/Tabs.spec.js +39 -53
- package/lib/Tab/index.js +0 -6
- package/lib/Tab/props/propTypes.js +0 -3
- package/lib/Tag/Tag.js +43 -72
- package/lib/Tag/__tests__/Tag.spec.js +8 -14
- package/lib/Tag/props/propTypes.js +0 -3
- package/lib/TextBox/TextBox.js +59 -85
- package/lib/TextBox/__tests__/TextBox.spec.js +4 -14
- package/lib/TextBox/props/propTypes.js +4 -6
- package/lib/TextBoxIcon/TextBoxIcon.js +52 -79
- package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +5 -14
- package/lib/TextBoxIcon/props/propTypes.js +0 -3
- package/lib/Textarea/Textarea.js +29 -54
- package/lib/Textarea/__tests__/Textarea.spec.js +2 -14
- package/lib/Textarea/props/propTypes.js +0 -3
- package/lib/Tooltip/Tooltip.js +31 -94
- package/lib/Tooltip/__tests__/Tooltip.spec.js +3 -24
- package/lib/Tooltip/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +16 -40
- package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +25 -53
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +0 -3
- package/lib/VelocityAnimation/index.js +0 -3
- package/lib/css.js +0 -40
- package/lib/deprecated/PortalLayer/PortalLayer.js +23 -46
- package/lib/deprecated/PortalLayer/props/propTypes.js +0 -3
- package/lib/index.js +0 -57
- package/lib/semantic/Button/Button.js +22 -42
- package/lib/semantic/Button/props/propTypes.js +0 -3
- package/lib/semantic/index.js +0 -2
- package/lib/utils/Common.js +18 -108
- package/lib/utils/ContextOptimizer.js +10 -16
- package/lib/utils/__tests__/constructFullName.spec.js +0 -1
- package/lib/utils/__tests__/debounce.spec.js +2 -3
- package/lib/utils/__tests__/getInitial.spec.js +0 -1
- package/lib/utils/constructFullName.js +4 -13
- package/lib/utils/css/compileClassNames.js +0 -6
- package/lib/utils/css/mergeStyle.js +7 -10
- package/lib/utils/css/utils.js +0 -8
- package/lib/utils/datetime/common.js +5 -34
- package/lib/utils/debounce.js +1 -6
- package/lib/utils/dropDownUtils.js +59 -175
- package/lib/utils/dummyFunction.js +0 -2
- package/lib/utils/getHTMLFontSize.js +0 -1
- package/lib/utils/getInitial.js +0 -6
- package/lib/utils/index.js +0 -4
- package/lib/utils/scrollTo.js +0 -2
- package/lib/utils/shallowEqual.js +0 -8
- package/package.json +2 -2
package/es/Tab/Tabs.js
CHANGED
|
@@ -1,7 +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
|
-
|
|
3
2
|
/* eslint-disable react/forbid-component-props */
|
|
4
|
-
|
|
5
3
|
/* eslint css-modules/no-unused-class: [2, {
|
|
6
4
|
markAsUsed: [
|
|
7
5
|
'hidden','alpha','gamma','beta','delta','special','text','maxWidth','widgetList','menuContainer','border','tabText','block','tabAlpha','alphaActive','gammaActive','betaActive','deltaActive','tabGamma','tabBeta','tabDelta','specialActive','tabSpecial',
|
|
@@ -23,7 +21,6 @@ import Popup from '../Popup/Popup';
|
|
|
23
21
|
import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
|
|
24
22
|
import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
|
|
25
23
|
import btnstyle from '../semantic/Button/semanticButton.module.css';
|
|
26
|
-
|
|
27
24
|
class Tabs extends React.Component {
|
|
28
25
|
constructor(props) {
|
|
29
26
|
super(props);
|
|
@@ -38,7 +35,6 @@ class Tabs extends React.Component {
|
|
|
38
35
|
this.tabsObserver = new ResizeObserver(this.onResize);
|
|
39
36
|
this.tabObserver = {};
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
onTabResize(size, target) {
|
|
43
39
|
let {
|
|
44
40
|
align
|
|
@@ -48,16 +44,13 @@ class Tabs extends React.Component {
|
|
|
48
44
|
} = this.state;
|
|
49
45
|
let newDim = Object.assign({}, tabDimensions);
|
|
50
46
|
let elemDim = getTotalDimension(target, align);
|
|
51
|
-
|
|
52
47
|
if (elemDim !== 0) {
|
|
53
48
|
newDim[target.dataset.key] = elemDim;
|
|
54
49
|
}
|
|
55
|
-
|
|
56
50
|
this.setState({
|
|
57
51
|
tabDimensions: newDim
|
|
58
52
|
});
|
|
59
53
|
}
|
|
60
|
-
|
|
61
54
|
componentDidMount() {
|
|
62
55
|
let {
|
|
63
56
|
children,
|
|
@@ -88,13 +81,11 @@ class Tabs extends React.Component {
|
|
|
88
81
|
this.moveHighlight();
|
|
89
82
|
});
|
|
90
83
|
}
|
|
91
|
-
|
|
92
84
|
componentWillUnmount() {
|
|
93
85
|
if (this.tabsObserver) {
|
|
94
86
|
this.tabsObserver.disconnect();
|
|
95
87
|
this.tabsObserver = null;
|
|
96
88
|
}
|
|
97
|
-
|
|
98
89
|
if (this.tabObserver) {
|
|
99
90
|
Object.keys(this.tabObserver).forEach(observer => {
|
|
100
91
|
this.tabObserver[observer] && this.tabObserver[observer].disconnect();
|
|
@@ -102,16 +93,15 @@ class Tabs extends React.Component {
|
|
|
102
93
|
this.tabObserver = null;
|
|
103
94
|
}
|
|
104
95
|
}
|
|
105
|
-
|
|
106
96
|
setMaxDim() {
|
|
107
97
|
let totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
108
98
|
let {
|
|
109
99
|
selectedTab
|
|
110
|
-
} = this.props;
|
|
100
|
+
} = this.props;
|
|
101
|
+
// let actual = Object.keys(tabDimensions).reduce(
|
|
111
102
|
// (sum, tab) => sum + (tabDimensions[tab] || 0),
|
|
112
103
|
// 0
|
|
113
104
|
// );
|
|
114
|
-
|
|
115
105
|
if (totalDimension && this[selectedTab]) {
|
|
116
106
|
let {
|
|
117
107
|
align
|
|
@@ -120,14 +110,12 @@ class Tabs extends React.Component {
|
|
|
120
110
|
align === 'vertical' ? this[selectedTab].style.maxWidth = newDim : this[selectedTab].style.maxHeight = newDim;
|
|
121
111
|
}
|
|
122
112
|
}
|
|
123
|
-
|
|
124
113
|
getHighlightDim() {
|
|
125
114
|
let {
|
|
126
115
|
align
|
|
127
116
|
} = this.props;
|
|
128
117
|
return align === 'vertical' ? this.highlight.offsetLeft : this.highlight.offsetTop;
|
|
129
118
|
}
|
|
130
|
-
|
|
131
119
|
componentDidUpdate(prevProps) {
|
|
132
120
|
let {
|
|
133
121
|
children,
|
|
@@ -139,12 +127,12 @@ class Tabs extends React.Component {
|
|
|
139
127
|
totalDimension,
|
|
140
128
|
tabKeys
|
|
141
129
|
} = this.state;
|
|
142
|
-
|
|
143
130
|
if (prevProps.children && children) {
|
|
144
131
|
/**
|
|
145
132
|
* To recalculate the dimensions of tabs we are checking the children length.
|
|
146
133
|
* and also checking the tab id and their order.
|
|
147
134
|
*/
|
|
135
|
+
|
|
148
136
|
let newTabKeys = [];
|
|
149
137
|
React.Children.toArray(children).forEach(child => {
|
|
150
138
|
if (child && child.props.id && child.type === childType) {
|
|
@@ -152,7 +140,6 @@ class Tabs extends React.Component {
|
|
|
152
140
|
}
|
|
153
141
|
});
|
|
154
142
|
let isSameTabKeys = newTabKeys.every((current, index) => tabKeys[index] === current);
|
|
155
|
-
|
|
156
143
|
if (newTabKeys.length !== tabKeys.length || !isSameTabKeys) {
|
|
157
144
|
this.setState({
|
|
158
145
|
renderVirtualTabs: true,
|
|
@@ -167,13 +154,11 @@ class Tabs extends React.Component {
|
|
|
167
154
|
});
|
|
168
155
|
});
|
|
169
156
|
}
|
|
170
|
-
|
|
171
157
|
if (prevProps.selectedTab !== selectedTab || newTabKeys.length === 1) {
|
|
172
158
|
this.moveHighlight();
|
|
173
159
|
}
|
|
174
160
|
}
|
|
175
161
|
}
|
|
176
|
-
|
|
177
162
|
moveHighlight() {
|
|
178
163
|
let {
|
|
179
164
|
isAnimate,
|
|
@@ -185,13 +170,10 @@ class Tabs extends React.Component {
|
|
|
185
170
|
highlightInitialDimension
|
|
186
171
|
} = this.state;
|
|
187
172
|
let node = this.highlight;
|
|
188
|
-
|
|
189
173
|
if (isAnimate && needTabBorder && node) {
|
|
190
174
|
let tabActive = this[selectedTab];
|
|
191
|
-
|
|
192
175
|
if (tabActive) {
|
|
193
176
|
let position, dimension;
|
|
194
|
-
|
|
195
177
|
if (align === 'vertical') {
|
|
196
178
|
position = tabActive.offsetLeft;
|
|
197
179
|
dimension = tabActive.offsetWidth;
|
|
@@ -206,21 +188,17 @@ class Tabs extends React.Component {
|
|
|
206
188
|
}
|
|
207
189
|
}
|
|
208
190
|
}
|
|
209
|
-
|
|
210
191
|
getHighlightRef(ele) {
|
|
211
192
|
this.highlight = ele;
|
|
212
193
|
}
|
|
213
|
-
|
|
214
194
|
getTabsRef(ele) {
|
|
215
195
|
this.tabsEle = ele;
|
|
216
|
-
|
|
217
196
|
if (ele) {
|
|
218
197
|
this.tabsObserver.observe(ele);
|
|
219
198
|
} else {
|
|
220
199
|
this.tabsObserver && this.tabsObserver.disconnect();
|
|
221
200
|
}
|
|
222
201
|
}
|
|
223
|
-
|
|
224
202
|
onSizeChange() {
|
|
225
203
|
let totalDimension = this.getTotalDimension();
|
|
226
204
|
this.setState({
|
|
@@ -232,12 +210,10 @@ class Tabs extends React.Component {
|
|
|
232
210
|
this.moveHighlight();
|
|
233
211
|
});
|
|
234
212
|
}
|
|
235
|
-
|
|
236
213
|
onResize(timer) {
|
|
237
214
|
let {
|
|
238
215
|
isResponsive
|
|
239
216
|
} = this.props;
|
|
240
|
-
|
|
241
217
|
if (this.tabsEle && isResponsive) {
|
|
242
218
|
if (!timer) {
|
|
243
219
|
this.onSizeChange();
|
|
@@ -248,7 +224,6 @@ class Tabs extends React.Component {
|
|
|
248
224
|
}
|
|
249
225
|
}
|
|
250
226
|
}
|
|
251
|
-
|
|
252
227
|
getTotalDimension() {
|
|
253
228
|
let {
|
|
254
229
|
align
|
|
@@ -256,7 +231,6 @@ class Tabs extends React.Component {
|
|
|
256
231
|
let totalDimension = this.tabsEle && getTotalDimension(this.tabsEle, align);
|
|
257
232
|
return totalDimension;
|
|
258
233
|
}
|
|
259
|
-
|
|
260
234
|
getTabDimensions() {
|
|
261
235
|
let {
|
|
262
236
|
children,
|
|
@@ -269,7 +243,6 @@ class Tabs extends React.Component {
|
|
|
269
243
|
}));
|
|
270
244
|
return tabDimensions;
|
|
271
245
|
}
|
|
272
|
-
|
|
273
246
|
responsiveTab(totalDimension, tabDimensions) {
|
|
274
247
|
let {
|
|
275
248
|
children,
|
|
@@ -278,9 +251,8 @@ class Tabs extends React.Component {
|
|
|
278
251
|
isResponsive
|
|
279
252
|
} = this.props;
|
|
280
253
|
let mainTabs = [],
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
254
|
+
moreTabs = [],
|
|
255
|
+
otherTabs = [];
|
|
284
256
|
if (totalDimension && isResponsive) {
|
|
285
257
|
let {
|
|
286
258
|
childType,
|
|
@@ -295,7 +267,6 @@ class Tabs extends React.Component {
|
|
|
295
267
|
const elemDimension = tabDimensions[child.props.id];
|
|
296
268
|
let isMaxCountExceeded = maxTabsTobeVisible <= 0 ? true : false;
|
|
297
269
|
let isMinCountNotExceeded = minTabsToBeVisible < minTabsCount ? true : false;
|
|
298
|
-
|
|
299
270
|
if (child.props.id === selectedTab) {
|
|
300
271
|
mainTabs.push(child);
|
|
301
272
|
} else if (isMinCountNotExceeded) {
|
|
@@ -314,7 +285,6 @@ class Tabs extends React.Component {
|
|
|
314
285
|
otherTabs.push(child);
|
|
315
286
|
}
|
|
316
287
|
});
|
|
317
|
-
|
|
318
288
|
if (selectedTabDimension > totalDimension) {
|
|
319
289
|
/* let { align } = this.props;
|
|
320
290
|
let newDim = `${remConvert(totalDimension)}rem`;
|
|
@@ -341,18 +311,15 @@ class Tabs extends React.Component {
|
|
|
341
311
|
} else {
|
|
342
312
|
moreTabs = children;
|
|
343
313
|
}
|
|
344
|
-
|
|
345
314
|
return {
|
|
346
315
|
mainTabs,
|
|
347
316
|
moreTabs,
|
|
348
317
|
otherTabs
|
|
349
318
|
};
|
|
350
319
|
}
|
|
351
|
-
|
|
352
320
|
getTabRef(refName, ele, isVirtual) {
|
|
353
321
|
this[refName] = ele;
|
|
354
322
|
let key = isVirtual ? `virtual_${refName}` : refName;
|
|
355
|
-
|
|
356
323
|
if (ele) {
|
|
357
324
|
this.tabObserver[key] = new ResizeObserver(this.onTabResize);
|
|
358
325
|
this.tabObserver[key].observe(ele);
|
|
@@ -362,21 +329,17 @@ class Tabs extends React.Component {
|
|
|
362
329
|
}
|
|
363
330
|
}
|
|
364
331
|
}
|
|
365
|
-
|
|
366
332
|
moreTabSelect(tab, value, index, e) {
|
|
367
333
|
let {
|
|
368
334
|
onSelect
|
|
369
335
|
} = this.props;
|
|
370
|
-
|
|
371
336
|
if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
|
|
372
337
|
cancelBubblingEffect(e);
|
|
373
338
|
return;
|
|
374
339
|
}
|
|
375
|
-
|
|
376
340
|
e.preventDefault();
|
|
377
341
|
onSelect(tab);
|
|
378
342
|
}
|
|
379
|
-
|
|
380
343
|
onScroll(e) {
|
|
381
344
|
e.persist();
|
|
382
345
|
let {
|
|
@@ -384,7 +347,6 @@ class Tabs extends React.Component {
|
|
|
384
347
|
} = this.props;
|
|
385
348
|
onScroll && throttle(onScroll, 100, e);
|
|
386
349
|
}
|
|
387
|
-
|
|
388
350
|
togglePopup(e) {
|
|
389
351
|
let {
|
|
390
352
|
boxPosition,
|
|
@@ -397,7 +359,6 @@ class Tabs extends React.Component {
|
|
|
397
359
|
boxPosition = boxPosition ? boxPosition : popupPosition;
|
|
398
360
|
togglePopup(e, boxPosition);
|
|
399
361
|
}
|
|
400
|
-
|
|
401
362
|
responsiveFunc(_ref) {
|
|
402
363
|
let {
|
|
403
364
|
mediaQueryOR
|
|
@@ -408,7 +369,6 @@ class Tabs extends React.Component {
|
|
|
408
369
|
}])
|
|
409
370
|
};
|
|
410
371
|
}
|
|
411
|
-
|
|
412
372
|
renderTabs(mainTabs, moreTabs, isVirtual) {
|
|
413
373
|
let {
|
|
414
374
|
selectedTab,
|
|
@@ -447,18 +407,14 @@ class Tabs extends React.Component {
|
|
|
447
407
|
if (!child) {
|
|
448
408
|
return null;
|
|
449
409
|
}
|
|
450
|
-
|
|
451
410
|
let MainTab = child.type;
|
|
452
411
|
let classProps = {};
|
|
453
|
-
|
|
454
412
|
if (itemActiveClass) {
|
|
455
413
|
classProps.activeClass = itemActiveClass;
|
|
456
414
|
}
|
|
457
|
-
|
|
458
415
|
if (itemClass) {
|
|
459
416
|
classProps.className = itemClass;
|
|
460
417
|
}
|
|
461
|
-
|
|
462
418
|
return /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.createElement(MainTab, _extends({}, child.props, {
|
|
463
419
|
key: child.props.id,
|
|
464
420
|
getTabRef: this.getTabRef,
|
|
@@ -520,7 +476,6 @@ class Tabs extends React.Component {
|
|
|
520
476
|
if (!child) {
|
|
521
477
|
return null;
|
|
522
478
|
}
|
|
523
|
-
|
|
524
479
|
let {
|
|
525
480
|
text,
|
|
526
481
|
id,
|
|
@@ -549,7 +504,6 @@ class Tabs extends React.Component {
|
|
|
549
504
|
})));
|
|
550
505
|
})) : null);
|
|
551
506
|
}
|
|
552
|
-
|
|
553
507
|
render() {
|
|
554
508
|
let {
|
|
555
509
|
style,
|
|
@@ -601,11 +555,10 @@ class Tabs extends React.Component {
|
|
|
601
555
|
"data-id": dataId
|
|
602
556
|
})));
|
|
603
557
|
}
|
|
604
|
-
|
|
605
558
|
}
|
|
606
|
-
|
|
607
559
|
Tabs.propTypes = Tabs_propTypes;
|
|
608
|
-
Tabs.defaultProps = {
|
|
560
|
+
Tabs.defaultProps = {
|
|
561
|
+
...Tabs_defaultProps,
|
|
609
562
|
childType: Tab
|
|
610
563
|
};
|
|
611
564
|
export default Popup(Tabs);
|
|
@@ -44,9 +44,11 @@ describe('Tab Component', () => {
|
|
|
44
44
|
getActiveRef: () => {}
|
|
45
45
|
});
|
|
46
46
|
expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tabDelta')).toBe(true);
|
|
47
|
-
});
|
|
47
|
+
});
|
|
48
|
+
// it('Is Contains zeta class', () => {
|
|
48
49
|
// const { props, renderedDOM } = setup(Tab, { type: 'zeta', needAppearance: true, getActiveRef: () => { } });
|
|
49
50
|
// expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'tabMenu_Tab').className.contains('tab')).toBe(true);
|
|
51
|
+
|
|
50
52
|
// });
|
|
51
53
|
// it('Is Contains special class', () => {
|
|
52
54
|
// const { props, renderedDOM } = setup(Tab, { type: 'special', getActiveRef: () => {} });
|
package/es/Tag/Tag.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Container } from '../Layout';
|
|
|
7
7
|
import Button from '../semantic/Button/Button';
|
|
8
8
|
import { getUniqueId } from '../Provider/IdProvider';
|
|
9
9
|
import style from './Tag.module.css';
|
|
10
|
+
|
|
10
11
|
/*
|
|
11
12
|
* eslint css-modules/no-unused-class: [2, { markAsUsed: ['small', 'medium',
|
|
12
13
|
* 'closedanger', 'closeprimary', 'default', 'danger', 'secondary',
|
|
@@ -27,7 +28,6 @@ export default class Tag extends PureComponent {
|
|
|
27
28
|
this.getRef = this.getRef.bind(this);
|
|
28
29
|
this.getNextAriaId = getUniqueId(this);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
31
|
handleSelect(e) {
|
|
32
32
|
let {
|
|
33
33
|
id,
|
|
@@ -38,7 +38,6 @@ export default class Tag extends PureComponent {
|
|
|
38
38
|
e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
|
|
39
39
|
onSelectTag && onSelectTag(id, e);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
41
|
handleRemove(e) {
|
|
43
42
|
let {
|
|
44
43
|
onRemove,
|
|
@@ -49,7 +48,6 @@ export default class Tag extends PureComponent {
|
|
|
49
48
|
e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
|
|
50
49
|
onRemove && onRemove(id);
|
|
51
50
|
}
|
|
52
|
-
|
|
53
51
|
getRef(el) {
|
|
54
52
|
let {
|
|
55
53
|
getRef,
|
|
@@ -57,7 +55,6 @@ export default class Tag extends PureComponent {
|
|
|
57
55
|
} = this.props;
|
|
58
56
|
getRef && getRef(el, id);
|
|
59
57
|
}
|
|
60
|
-
|
|
61
58
|
render() {
|
|
62
59
|
let {
|
|
63
60
|
imageURL,
|
|
@@ -142,10 +139,10 @@ export default class Tag extends PureComponent {
|
|
|
142
139
|
size: "8"
|
|
143
140
|
}))));
|
|
144
141
|
}
|
|
145
|
-
|
|
146
142
|
}
|
|
147
143
|
Tag.defaultProps = defaultProps;
|
|
148
|
-
Tag.propTypes = propTypes;
|
|
144
|
+
Tag.propTypes = propTypes;
|
|
145
|
+
// if (__DOCS__) {
|
|
149
146
|
// Tag.docs = {
|
|
150
147
|
// componentGroup: 'Molecule',
|
|
151
148
|
// folderName: 'Style Guide'
|
package/es/TextBox/TextBox.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
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
|
-
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { defaultProps } from './props/defaultProps';
|
|
5
4
|
import { propTypes } from './props/propTypes';
|
|
6
5
|
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['xmedium', 'medium', 'small', 'default', 'primary', 'secondary'] }] */
|
|
7
|
-
|
|
8
6
|
import style from './TextBox.module.css';
|
|
9
7
|
export default class Textbox extends React.PureComponent {
|
|
10
8
|
constructor(props) {
|
|
@@ -15,7 +13,6 @@ export default class Textbox extends React.PureComponent {
|
|
|
15
13
|
this.handleFocus = this.handleFocus.bind(this);
|
|
16
14
|
this.handleBlur = this.handleBlur.bind(this);
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
handleFocus() {
|
|
20
17
|
let {
|
|
21
18
|
id,
|
|
@@ -25,7 +22,6 @@ export default class Textbox extends React.PureComponent {
|
|
|
25
22
|
} = this.props;
|
|
26
23
|
onFocus && onFocus(id, value, name);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
handleBlur() {
|
|
30
26
|
let {
|
|
31
27
|
id,
|
|
@@ -35,7 +31,6 @@ export default class Textbox extends React.PureComponent {
|
|
|
35
31
|
} = this.props;
|
|
36
32
|
onBlur && onBlur(id, value, name);
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
inputRef(ref) {
|
|
40
35
|
let {
|
|
41
36
|
inputRef
|
|
@@ -43,7 +38,6 @@ export default class Textbox extends React.PureComponent {
|
|
|
43
38
|
this.inputEle = ref;
|
|
44
39
|
inputRef && inputRef(ref);
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
setFocus() {
|
|
48
42
|
if (this.inputEle) {
|
|
49
43
|
this.inputEle.focus({
|
|
@@ -51,7 +45,6 @@ export default class Textbox extends React.PureComponent {
|
|
|
51
45
|
});
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
onChange(e) {
|
|
56
49
|
e.preventDefault();
|
|
57
50
|
let {
|
|
@@ -63,7 +56,6 @@ export default class Textbox extends React.PureComponent {
|
|
|
63
56
|
} = this.props;
|
|
64
57
|
onChange && !isReadOnly && onChange(value, e);
|
|
65
58
|
}
|
|
66
|
-
|
|
67
59
|
render() {
|
|
68
60
|
let {
|
|
69
61
|
type,
|
|
@@ -114,23 +106,18 @@ export default class Textbox extends React.PureComponent {
|
|
|
114
106
|
ariaMultiselectable
|
|
115
107
|
} = a11y;
|
|
116
108
|
let options = {};
|
|
117
|
-
|
|
118
109
|
if (isReadOnly) {
|
|
119
110
|
options.readOnly = true;
|
|
120
111
|
}
|
|
121
|
-
|
|
122
112
|
if (isDisabled) {
|
|
123
113
|
options.disabled = true;
|
|
124
114
|
}
|
|
125
|
-
|
|
126
115
|
if (autofocus) {
|
|
127
116
|
options.autoFocus = true;
|
|
128
117
|
}
|
|
129
|
-
|
|
130
118
|
if (!autoComplete) {
|
|
131
119
|
options.autoComplete = 'off';
|
|
132
120
|
}
|
|
133
|
-
|
|
134
121
|
let classList = needAppearance ? `${style.container} ${style[size]} ${style[variant]} ${needBorder ? style.border : ''} ${isDisabled && !needEffect || isReadOnly && !needEffect ? '' : style.effect} ${isFocus ? style.focus : ''}` : `${style.basic}`;
|
|
135
122
|
value = value === null || value === undefined ? '' : value;
|
|
136
123
|
return /*#__PURE__*/React.createElement("input", _extends({
|
|
@@ -168,10 +155,11 @@ export default class Textbox extends React.PureComponent {
|
|
|
168
155
|
onMouseDown: onMouseDown
|
|
169
156
|
}, options, customProps));
|
|
170
157
|
}
|
|
171
|
-
|
|
172
158
|
}
|
|
173
159
|
Textbox.defaultProps = defaultProps;
|
|
174
|
-
Textbox.propTypes = propTypes;
|
|
160
|
+
Textbox.propTypes = propTypes;
|
|
161
|
+
|
|
162
|
+
// if (__DOCS__) {
|
|
175
163
|
// Textbox.docs = {
|
|
176
164
|
// componentGroup: 'Form Elements',
|
|
177
165
|
// folderName: 'Style Guide',
|
|
@@ -111,7 +111,9 @@ describe('TextBox component', () => {
|
|
|
111
111
|
text: "Text Box Working"
|
|
112
112
|
}));
|
|
113
113
|
expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'textBox').getAttribute('placeholder')).toMatch(/Text Box/);
|
|
114
|
-
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// it('Check disabled works', () => {
|
|
115
117
|
// let renderedDOM = TestUtils.renderIntoDocument(
|
|
116
118
|
// <TextBox maxLength='100' placeHolder='Text Box' size='medium' variant='primary' value='Text Box Working' disabled />
|
|
117
119
|
// );
|
|
@@ -127,6 +129,7 @@ describe('TextBox component', () => {
|
|
|
127
129
|
// pass
|
|
128
130
|
// ).toBe(true);
|
|
129
131
|
// });
|
|
132
|
+
|
|
130
133
|
// it('Check readOnly works', () => {
|
|
131
134
|
// let renderedDOM = TestUtils.renderIntoDocument(
|
|
132
135
|
// <TextBox maxLength='100' placeHolder='Text Box' size='medium' variant='primary' value='Text Box Working' readOnly />
|
|
@@ -1,5 +1,4 @@
|
|
|
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
|
-
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { defaultProps } from './props/defaultProps';
|
|
5
4
|
import { propTypes } from './props/propTypes';
|
|
@@ -21,7 +20,6 @@ export default class TextBoxIcon extends React.Component {
|
|
|
21
20
|
this.handleRef = this.handleRef.bind(this);
|
|
22
21
|
this.handleClear = this.handleClear.bind(this);
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
handleRef(ele) {
|
|
26
24
|
let {
|
|
27
25
|
inputRef
|
|
@@ -29,7 +27,6 @@ export default class TextBoxIcon extends React.Component {
|
|
|
29
27
|
this.inputEle = ele;
|
|
30
28
|
inputRef && inputRef(ele);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
handleClear() {
|
|
34
31
|
let {
|
|
35
32
|
onClear
|
|
@@ -39,14 +36,12 @@ export default class TextBoxIcon extends React.Component {
|
|
|
39
36
|
preventScroll: true
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
handleFocus(e) {
|
|
44
40
|
const {
|
|
45
41
|
onFocus,
|
|
46
42
|
needReadOnlyStyle,
|
|
47
43
|
isReadOnly
|
|
48
44
|
} = this.props;
|
|
49
|
-
|
|
50
45
|
if (!needReadOnlyStyle || !isReadOnly && needReadOnlyStyle) {
|
|
51
46
|
this.setState({
|
|
52
47
|
isActive: true
|
|
@@ -54,7 +49,6 @@ export default class TextBoxIcon extends React.Component {
|
|
|
54
49
|
onFocus && onFocus(e);
|
|
55
50
|
}
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
handleBlur(e) {
|
|
59
53
|
const {
|
|
60
54
|
onBlur
|
|
@@ -64,7 +58,6 @@ export default class TextBoxIcon extends React.Component {
|
|
|
64
58
|
});
|
|
65
59
|
onBlur && onBlur(e);
|
|
66
60
|
}
|
|
67
|
-
|
|
68
61
|
render() {
|
|
69
62
|
const {
|
|
70
63
|
type,
|
|
@@ -176,10 +169,10 @@ export default class TextBoxIcon extends React.Component {
|
|
|
176
169
|
className: `${style.line} ${style[`borderColor_${borderColor}`]} ${customTBoxLine}`
|
|
177
170
|
}));
|
|
178
171
|
}
|
|
179
|
-
|
|
180
172
|
}
|
|
181
173
|
TextBoxIcon.defaultProps = defaultProps;
|
|
182
|
-
TextBoxIcon.propTypes = propTypes;
|
|
174
|
+
TextBoxIcon.propTypes = propTypes;
|
|
175
|
+
// if (__DOCS__) {
|
|
183
176
|
// TextBoxIcon.docs = {
|
|
184
177
|
// componentGroup: 'Form Elements',
|
|
185
178
|
// folderName: 'Style Guide',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import TextBoxIcon from '../TextBoxIcon';
|
|
3
|
-
import renderer from 'react-test-renderer';
|
|
3
|
+
import renderer from 'react-test-renderer';
|
|
4
|
+
|
|
5
|
+
// children: PropTypes.node,
|
|
4
6
|
// disabled: PropTypes.bool,
|
|
5
7
|
// iconRotated: PropTypes.bool,
|
|
6
8
|
// id: PropTypes.string,
|
|
@@ -134,7 +136,9 @@ describe('TextBoxIcon component', () => {
|
|
|
134
136
|
text: "Text Box Working"
|
|
135
137
|
}));
|
|
136
138
|
expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'textBoxIcon').getAttribute('placeholder')).toMatch(/Text Box/);
|
|
137
|
-
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// it('Check disabled works', () => {
|
|
138
142
|
// let renderedDOM = TestUtils.renderIntoDocument(
|
|
139
143
|
// <TextBoxIcon maxLength='100' placeHolder='Text Box' size='medium' variant='primary' value='Text Box Working' disabled />
|
|
140
144
|
// );
|
|
@@ -150,6 +154,7 @@ describe('TextBoxIcon component', () => {
|
|
|
150
154
|
// pass
|
|
151
155
|
// ).toBe(true);
|
|
152
156
|
// });
|
|
157
|
+
|
|
153
158
|
// it('Check readOnly works', () => {
|
|
154
159
|
// let renderedDOM = TestUtils.renderIntoDocument(
|
|
155
160
|
// <TextBoxIcon maxLength='100' placeHolder='Text Box' size='medium' variant='primary' value='Text Box Working' readOnly />
|
package/es/Textarea/Textarea.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
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
|
-
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { defaultProps } from './props/defaultProps';
|
|
5
4
|
import { propTypes } from './props/propTypes';
|
|
6
5
|
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['resizeX', 'resizeY', 'noresize', 'resizeboth', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'default', 'primary'] }] */
|
|
7
|
-
|
|
8
6
|
import style from './Textarea.module.css';
|
|
9
7
|
export default class Textarea extends React.Component {
|
|
10
8
|
constructor(props) {
|
|
@@ -13,7 +11,6 @@ export default class Textarea extends React.Component {
|
|
|
13
11
|
this.onKeyDown = this.onKeyDown.bind(this);
|
|
14
12
|
this.onBlur = this.onBlur.bind(this);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
onChange(e) {
|
|
18
15
|
e && e.preventDefault();
|
|
19
16
|
let {
|
|
@@ -21,7 +18,6 @@ export default class Textarea extends React.Component {
|
|
|
21
18
|
} = this.props;
|
|
22
19
|
onChange && onChange(e.target.value, e);
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
onBlur(e) {
|
|
26
22
|
e && e.preventDefault();
|
|
27
23
|
let {
|
|
@@ -29,14 +25,12 @@ export default class Textarea extends React.Component {
|
|
|
29
25
|
} = this.props;
|
|
30
26
|
onBlur && onBlur(e.target.value, e);
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
onKeyDown(e) {
|
|
34
29
|
let {
|
|
35
30
|
onKeyDown
|
|
36
31
|
} = this.props;
|
|
37
32
|
onKeyDown && onKeyDown(e);
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
render() {
|
|
41
35
|
let {
|
|
42
36
|
size,
|
|
@@ -73,19 +67,15 @@ export default class Textarea extends React.Component {
|
|
|
73
67
|
none: 'noresize'
|
|
74
68
|
};
|
|
75
69
|
let options = {};
|
|
76
|
-
|
|
77
70
|
if (isReadOnly) {
|
|
78
71
|
options.readOnly = 'readOnly';
|
|
79
72
|
}
|
|
80
|
-
|
|
81
73
|
if (isDisabled) {
|
|
82
74
|
options.disabled = 'disabled';
|
|
83
75
|
}
|
|
84
|
-
|
|
85
76
|
if (autoFocus) {
|
|
86
77
|
options.autoFocus = true;
|
|
87
78
|
}
|
|
88
|
-
|
|
89
79
|
let classList = needAppearance ? `${style.container} ${style[size]} ${style[variant]} ${needBorder ? style.needBorder : style.noBorder} ${resize ? style[resizes[resize]] : style[resizes.none]} ${animated ? `${style[`${size}animated`]}` : ''} ${isDisabled && !needEffect || isReadOnly && !needEffect ? '' : style.effect}` : `${style.basic}`;
|
|
90
80
|
return /*#__PURE__*/React.createElement("textarea", _extends({
|
|
91
81
|
"aria-label": ariaLabel,
|
|
@@ -105,10 +95,11 @@ export default class Textarea extends React.Component {
|
|
|
105
95
|
"data-selector-id": dataSelectorId
|
|
106
96
|
}));
|
|
107
97
|
}
|
|
108
|
-
|
|
109
98
|
}
|
|
110
99
|
Textarea.defaultProps = defaultProps;
|
|
111
|
-
Textarea.propTypes = propTypes;
|
|
100
|
+
Textarea.propTypes = propTypes;
|
|
101
|
+
|
|
102
|
+
// if (__DOCS__) {
|
|
112
103
|
// Textarea.docs = {
|
|
113
104
|
// componentGroup: 'Form Elements',
|
|
114
105
|
// folderName: 'Style Guide',
|