@zohodesk/components 1.2.4 → 1.2.6
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 +8 -0
- package/coverage/Button/Button.js.html +1 -1
- package/coverage/Button/css/Button.module.css.html +1 -1
- package/coverage/Button/css/cssJSLogic.js.html +1 -1
- package/coverage/Button/css/index.html +1 -1
- package/coverage/Button/index.html +1 -1
- package/coverage/Button/props/defaultProps.js.html +1 -1
- package/coverage/Button/props/index.html +1 -1
- package/coverage/Button/props/propTypes.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
- package/coverage/Buttongroup/index.html +1 -1
- package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
- package/coverage/Buttongroup/props/index.html +1 -1
- package/coverage/Buttongroup/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/AppContainer/AppContainer.js +3 -0
- package/es/v1/Accordion/Accordion.js +65 -0
- package/es/v1/Accordion/AccordionItem.js +57 -0
- package/es/v1/Accordion/index.js +2 -0
- package/es/v1/Animation/Animation.js +127 -0
- package/es/v1/AppContainer/AppContainer.js +137 -0
- package/es/v1/Avatar/Avatar.js +189 -0
- package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
- package/es/v1/Button/Button.js +68 -0
- package/es/v1/Buttongroup/Buttongroup.js +31 -0
- package/es/v1/Card/Card.js +271 -0
- package/es/v1/CheckBox/CheckBox.js +155 -0
- package/es/v1/DateTime/CalendarView.js +218 -0
- package/es/v1/DateTime/DateTime.js +783 -0
- package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
- package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
- package/es/v1/DateTime/DateWidget.js +1098 -0
- package/es/v1/DateTime/DaysRow.js +31 -0
- package/es/v1/DateTime/Time.js +166 -0
- package/es/v1/DateTime/YearView.js +264 -0
- package/es/v1/DateTime/index.js +1 -0
- package/es/v1/DropBox/DropBox.js +91 -0
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
- package/es/v1/DropDown/DropDown.js +73 -0
- package/es/v1/DropDown/DropDownHeading.js +44 -0
- package/es/v1/DropDown/DropDownItem.js +76 -0
- package/es/v1/DropDown/DropDownSearch.js +63 -0
- package/es/v1/DropDown/DropDownSeparator.js +15 -0
- package/es/v1/Heading/Heading.js +32 -0
- package/es/v1/Label/Label.js +40 -0
- package/es/v1/Layout/Box.js +115 -0
- package/es/v1/Layout/Container.js +132 -0
- package/es/v1/Layout/index.js +2 -0
- package/es/v1/ListItem/ListContainer.js +102 -0
- package/es/v1/ListItem/ListItem.js +124 -0
- package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
- package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
- package/es/v1/ListItem/ListItemWithIcon.js +127 -0
- package/es/v1/ListItem/ListItemWithRadio.js +105 -0
- package/es/v1/ListItem/index.js +6 -0
- package/es/v1/Modal/Modal.js +154 -0
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
- package/es/v1/MultiSelect/EmptyState.js +64 -0
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/v1/MultiSelect/MultiSelect.js +1120 -0
- package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
- package/es/v1/MultiSelect/SelectedOptions.js +82 -0
- package/es/v1/MultiSelect/Suggestions.js +142 -0
- package/es/v1/MultiSelect/index.js +4 -0
- package/es/v1/PopOver/PopOver.js +211 -0
- package/es/v1/Popup/Popup.js +645 -0
- package/es/v1/Radio/Radio.js +115 -0
- package/es/v1/Responsive/CustomResponsive.js +195 -0
- package/es/v1/Responsive/RefWrapper.js +39 -0
- package/es/v1/Responsive/ResizeComponent.js +197 -0
- package/es/v1/Responsive/ResizeObserver.js +140 -0
- package/es/v1/Responsive/Responsive.js +194 -0
- package/es/v1/Responsive/index.js +9 -0
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
- package/es/v1/Ribbon/Ribbon.js +33 -0
- package/es/v1/RippleEffect/RippleEffect.js +24 -0
- package/es/v1/Select/GroupSelect.js +803 -0
- package/es/v1/Select/Select.js +969 -0
- package/es/v1/Select/SelectWithAvatar.js +344 -0
- package/es/v1/Select/SelectWithIcon.js +535 -0
- package/es/v1/Select/index.js +4 -0
- package/es/v1/Stencils/Stencils.js +26 -0
- package/es/v1/Switch/Switch.js +94 -0
- package/es/v1/Tab/Tab.js +108 -0
- package/es/v1/Tab/TabContent.js +30 -0
- package/es/v1/Tab/TabContentWrapper.js +29 -0
- package/es/v1/Tab/TabWrapper.js +57 -0
- package/es/v1/Tab/Tabs.js +612 -0
- package/es/v1/Tab/index.js +5 -0
- package/es/v1/Tag/Tag.js +134 -0
- package/es/v1/TextBox/TextBox.js +154 -0
- package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
- package/es/v1/Textarea/Textarea.js +102 -0
- package/es/v1/Tooltip/Tooltip.js +518 -0
- package/es/v1/Typography/Typography.js +38 -0
- package/es/v1/Typography/css/Typography.module.css +376 -0
- package/es/v1/Typography/css/cssJSLogic.js +46 -0
- package/es/v1/Typography/css/letterSpacingMap.js +12 -0
- package/es/v1/Typography/props/defaultProps.js +8 -0
- package/es/v1/Typography/props/propTypes.js +24 -0
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
- package/es/v1/semantic/Button/Button.js +53 -0
- package/es/v1/semantic/index.js +1 -0
- package/lib/AppContainer/AppContainer.js +5 -0
- package/lib/v1/Accordion/Accordion.js +96 -0
- package/lib/v1/Accordion/AccordionItem.js +68 -0
- package/lib/v1/Accordion/index.js +23 -0
- package/lib/v1/Animation/Animation.js +143 -0
- package/lib/v1/AppContainer/AppContainer.js +209 -0
- package/lib/v1/Avatar/Avatar.js +246 -0
- package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
- package/lib/v1/Button/Button.js +82 -0
- package/lib/v1/Buttongroup/Buttongroup.js +44 -0
- package/lib/v1/Card/Card.js +365 -0
- package/lib/v1/CheckBox/CheckBox.js +166 -0
- package/lib/v1/DateTime/CalendarView.js +285 -0
- package/lib/v1/DateTime/DateTime.js +872 -0
- package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
- package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
- package/lib/v1/DateTime/DateWidget.js +1125 -0
- package/lib/v1/DateTime/DaysRow.js +80 -0
- package/lib/v1/DateTime/Time.js +254 -0
- package/lib/v1/DateTime/YearView.js +325 -0
- package/lib/v1/DateTime/index.js +15 -0
- package/lib/v1/DropBox/DropBox.js +119 -0
- package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
- package/lib/v1/DropDown/DropDown.js +170 -0
- package/lib/v1/DropDown/DropDownHeading.js +93 -0
- package/lib/v1/DropDown/DropDownItem.js +127 -0
- package/lib/v1/DropDown/DropDownSearch.js +113 -0
- package/lib/v1/DropDown/DropDownSeparator.js +64 -0
- package/lib/v1/Heading/Heading.js +49 -0
- package/lib/v1/Label/Label.js +51 -0
- package/lib/v1/Layout/Box.js +128 -0
- package/lib/v1/Layout/Container.js +145 -0
- package/lib/v1/Layout/index.js +23 -0
- package/lib/v1/ListItem/ListContainer.js +120 -0
- package/lib/v1/ListItem/ListItem.js +138 -0
- package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
- package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
- package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
- package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
- package/lib/v1/ListItem/index.js +55 -0
- package/lib/v1/Modal/Modal.js +212 -0
- package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
- package/lib/v1/MultiSelect/EmptyState.js +112 -0
- package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
- package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
- package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
- package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
- package/lib/v1/MultiSelect/Suggestions.js +195 -0
- package/lib/v1/MultiSelect/index.js +39 -0
- package/lib/v1/PopOver/PopOver.js +293 -0
- package/lib/v1/Popup/Popup.js +715 -0
- package/lib/v1/Radio/Radio.js +126 -0
- package/lib/v1/Responsive/CustomResponsive.js +242 -0
- package/lib/v1/Responsive/RefWrapper.js +57 -0
- package/lib/v1/Responsive/ResizeComponent.js +268 -0
- package/lib/v1/Responsive/ResizeObserver.js +168 -0
- package/lib/v1/Responsive/Responsive.js +274 -0
- package/lib/v1/Responsive/index.js +55 -0
- package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
- package/lib/v1/Ribbon/Ribbon.js +44 -0
- package/lib/v1/RippleEffect/RippleEffect.js +39 -0
- package/lib/v1/Select/GroupSelect.js +877 -0
- package/lib/v1/Select/Select.js +1013 -0
- package/lib/v1/Select/SelectWithAvatar.js +394 -0
- package/lib/v1/Select/SelectWithIcon.js +597 -0
- package/lib/v1/Select/index.js +39 -0
- package/lib/v1/Stencils/Stencils.js +43 -0
- package/lib/v1/Switch/Switch.js +108 -0
- package/lib/v1/Tab/Tab.js +132 -0
- package/lib/v1/Tab/TabContent.js +42 -0
- package/lib/v1/Tab/TabContentWrapper.js +42 -0
- package/lib/v1/Tab/TabWrapper.js +89 -0
- package/lib/v1/Tab/Tabs.js +680 -0
- package/lib/v1/Tab/index.js +47 -0
- package/lib/v1/Tag/Tag.js +154 -0
- package/lib/v1/TextBox/TextBox.js +168 -0
- package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
- package/lib/v1/Textarea/Textarea.js +118 -0
- package/lib/v1/Tooltip/Tooltip.js +586 -0
- package/lib/v1/Typography/Typography.js +56 -0
- package/lib/v1/Typography/css/Typography.module.css +376 -0
- package/lib/v1/Typography/css/cssJSLogic.js +41 -0
- package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
- package/lib/v1/Typography/props/defaultProps.js +15 -0
- package/lib/v1/Typography/props/propTypes.js +35 -0
- package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
- package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
- package/lib/v1/semantic/Button/Button.js +63 -0
- package/lib/v1/semantic/index.js +15 -0
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable react/forbid-component-props */
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React, { PureComponent } from 'react';
|
|
5
|
+
import { DaysRow_propTypes } from '../../DateTime/props/propTypes';
|
|
6
|
+
/** ** CSS *** */
|
|
7
|
+
|
|
8
|
+
import style from '../../DateTime/DateTime.module.css';
|
|
9
|
+
/** ** Components *** */
|
|
10
|
+
|
|
11
|
+
import { Container, Box } from '../Layout';
|
|
12
|
+
export default class DaysRow extends PureComponent {
|
|
13
|
+
render() {
|
|
14
|
+
const {
|
|
15
|
+
dayNames,
|
|
16
|
+
dayNamesShort
|
|
17
|
+
} = this.props;
|
|
18
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
19
|
+
alignBox: "row",
|
|
20
|
+
align: "center",
|
|
21
|
+
className: style.days
|
|
22
|
+
}, dayNames.map((dayName, index) => /*#__PURE__*/React.createElement(Box, {
|
|
23
|
+
key: dayName,
|
|
24
|
+
className: `${style.daysStr} ${style.grid} ${index === 0 ? style.sunday : ''}`,
|
|
25
|
+
"data-title": dayName,
|
|
26
|
+
"aria-label": dayName
|
|
27
|
+
}, dayNamesShort[index])));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
DaysRow.propTypes = DaysRow_propTypes;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/* eslint-disable react/forbid-component-props */
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React, { PureComponent } from 'react';
|
|
5
|
+
import { Time_propTypes } from '../../DateTime/props/propTypes';
|
|
6
|
+
import { Time_defaultProps } from '../../DateTime/props/defaultProps';
|
|
7
|
+
/**** Components ****/
|
|
8
|
+
|
|
9
|
+
import { Container, Box } from '../Layout';
|
|
10
|
+
import Select from '../Select/Select';
|
|
11
|
+
/** ** CSS *** */
|
|
12
|
+
|
|
13
|
+
import style from '../../DateTime/DateTime.module.css';
|
|
14
|
+
export default class Time extends PureComponent {
|
|
15
|
+
render() {
|
|
16
|
+
const {
|
|
17
|
+
timeText,
|
|
18
|
+
dataId,
|
|
19
|
+
hourSuggestions,
|
|
20
|
+
onHourSelect,
|
|
21
|
+
hours,
|
|
22
|
+
hourEmptyText,
|
|
23
|
+
needResponsive,
|
|
24
|
+
minSuggestions,
|
|
25
|
+
onMinutesSelect,
|
|
26
|
+
mins,
|
|
27
|
+
minuteEmptyText,
|
|
28
|
+
ampmSuggestions,
|
|
29
|
+
onAmPmSelect,
|
|
30
|
+
amPm,
|
|
31
|
+
is24Hour
|
|
32
|
+
} = this.props;
|
|
33
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
className: style.text
|
|
35
|
+
}, timeText), /*#__PURE__*/React.createElement(Container, {
|
|
36
|
+
alignBox: "row",
|
|
37
|
+
align: "vertical",
|
|
38
|
+
className: style.timesection,
|
|
39
|
+
isCover: false,
|
|
40
|
+
dataId: `${dataId}_timeContainer`
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
42
|
+
flexible: true,
|
|
43
|
+
className: style.dropDownContainer
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Hour, {
|
|
45
|
+
hourSuggestions: hourSuggestions,
|
|
46
|
+
onHourSelect: onHourSelect,
|
|
47
|
+
hours: hours,
|
|
48
|
+
needResponsive: needResponsive,
|
|
49
|
+
hourEmptyText: hourEmptyText
|
|
50
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
51
|
+
flexible: true,
|
|
52
|
+
className: style.dropDownContainer
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Minute, {
|
|
54
|
+
minSuggestions: minSuggestions,
|
|
55
|
+
onMinutesSelect: onMinutesSelect,
|
|
56
|
+
mins: mins,
|
|
57
|
+
minuteEmptyText: minuteEmptyText,
|
|
58
|
+
needResponsive: needResponsive
|
|
59
|
+
})), !is24Hour ? /*#__PURE__*/React.createElement(Box, {
|
|
60
|
+
flexible: true,
|
|
61
|
+
className: style.dropDownContainer
|
|
62
|
+
}, /*#__PURE__*/React.createElement(AmPm, {
|
|
63
|
+
ampmSuggestions: ampmSuggestions,
|
|
64
|
+
onAmPmSelect: onAmPmSelect,
|
|
65
|
+
amPm: amPm,
|
|
66
|
+
needResponsive: needResponsive
|
|
67
|
+
})) : null));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
Time.propTypes = Time_propTypes;
|
|
72
|
+
Time.defaultProps = Time_defaultProps;
|
|
73
|
+
|
|
74
|
+
class Hour extends React.PureComponent {
|
|
75
|
+
render() {
|
|
76
|
+
const {
|
|
77
|
+
hourSuggestions,
|
|
78
|
+
onHourSelect,
|
|
79
|
+
hours,
|
|
80
|
+
needResponsive,
|
|
81
|
+
hourEmptyText
|
|
82
|
+
} = this.props;
|
|
83
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
84
|
+
options: hourSuggestions,
|
|
85
|
+
onChange: onHourSelect,
|
|
86
|
+
selectedValue: hours,
|
|
87
|
+
needSearch: true,
|
|
88
|
+
emptyMessage: hourEmptyText,
|
|
89
|
+
animationStyle: "bounce",
|
|
90
|
+
textBoxSize: "xmedium",
|
|
91
|
+
textBoxVariant: "primary",
|
|
92
|
+
searchBoxSize: "xmedium",
|
|
93
|
+
searchBoxPlaceHolder: "",
|
|
94
|
+
maxLength: "2",
|
|
95
|
+
popupGroup: "calender",
|
|
96
|
+
size: "small",
|
|
97
|
+
dataId: "hourField",
|
|
98
|
+
needResponsive: needResponsive,
|
|
99
|
+
needListBorder: true,
|
|
100
|
+
needTick: false,
|
|
101
|
+
listItemSize: "small"
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class Minute extends React.PureComponent {
|
|
108
|
+
render() {
|
|
109
|
+
const {
|
|
110
|
+
minSuggestions,
|
|
111
|
+
onMinutesSelect,
|
|
112
|
+
mins,
|
|
113
|
+
minuteEmptyText,
|
|
114
|
+
needResponsive
|
|
115
|
+
} = this.props;
|
|
116
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
117
|
+
options: minSuggestions,
|
|
118
|
+
onChange: onMinutesSelect,
|
|
119
|
+
selectedValue: mins,
|
|
120
|
+
needSearch: true,
|
|
121
|
+
emptyMessage: minuteEmptyText,
|
|
122
|
+
animationStyle: "bounce",
|
|
123
|
+
textBoxSize: "xmedium",
|
|
124
|
+
textBoxVariant: "primary",
|
|
125
|
+
searchBoxSize: "xmedium",
|
|
126
|
+
searchBoxPlaceHolder: "",
|
|
127
|
+
maxLength: "2",
|
|
128
|
+
popupGroup: "calender",
|
|
129
|
+
size: "small",
|
|
130
|
+
dataId: "minuteField",
|
|
131
|
+
needResponsive: needResponsive,
|
|
132
|
+
needListBorder: true,
|
|
133
|
+
needTick: false,
|
|
134
|
+
listItemSize: "small"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
class AmPm extends React.PureComponent {
|
|
141
|
+
render() {
|
|
142
|
+
const {
|
|
143
|
+
ampmSuggestions,
|
|
144
|
+
onAmPmSelect,
|
|
145
|
+
amPm,
|
|
146
|
+
needResponsive
|
|
147
|
+
} = this.props;
|
|
148
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
149
|
+
options: ampmSuggestions,
|
|
150
|
+
onChange: onAmPmSelect,
|
|
151
|
+
selectedValue: amPm,
|
|
152
|
+
animationStyle: "bounce",
|
|
153
|
+
textBoxSize: "xmedium",
|
|
154
|
+
textBoxVariant: "primary",
|
|
155
|
+
maxLength: "2",
|
|
156
|
+
popupGroup: "calender",
|
|
157
|
+
size: "small",
|
|
158
|
+
dataId: "ampmField",
|
|
159
|
+
needResponsive: needResponsive,
|
|
160
|
+
needListBorder: true,
|
|
161
|
+
needTick: false,
|
|
162
|
+
listItemSize: "small"
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**** Libraries ****/
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { YearView_propTypes } from '../../DateTime/props/propTypes';
|
|
4
|
+
import { YearView_defaultProps } from '../../DateTime/props/defaultProps';
|
|
5
|
+
/**** Components ****/
|
|
6
|
+
|
|
7
|
+
import { Virtualizer } from '@zohodesk/virtualizer';
|
|
8
|
+
import { Container, Box } from '../Layout';
|
|
9
|
+
import { Icon } from '@zohodesk/icons';
|
|
10
|
+
import Heading from '../Heading/Heading';
|
|
11
|
+
/**** CSS ****/
|
|
12
|
+
|
|
13
|
+
import style from '../../DateTime/YearView.module.css';
|
|
14
|
+
/**** Methods ****/
|
|
15
|
+
|
|
16
|
+
import { getYearDetails } from '../../DateTime/dateFormatUtils';
|
|
17
|
+
const monthNamesData = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
18
|
+
|
|
19
|
+
function getYears() {
|
|
20
|
+
const years = [];
|
|
21
|
+
const {
|
|
22
|
+
startPoint,
|
|
23
|
+
endPoint
|
|
24
|
+
} = getYearDetails();
|
|
25
|
+
|
|
26
|
+
for (let i = startPoint; i <= endPoint; i++) {
|
|
27
|
+
years.push(i);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return years;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class Year extends React.PureComponent {
|
|
34
|
+
constructor(props) {
|
|
35
|
+
super(props);
|
|
36
|
+
this.handleClick = this.handleClick.bind(this);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
handleClick() {
|
|
40
|
+
const {
|
|
41
|
+
year,
|
|
42
|
+
onClick
|
|
43
|
+
} = this.props;
|
|
44
|
+
onClick && onClick(year);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
const {
|
|
49
|
+
year,
|
|
50
|
+
isActive,
|
|
51
|
+
isOpen
|
|
52
|
+
} = this.props;
|
|
53
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
54
|
+
className: `${style.year} ${isActive ? style.isActive : ''}`,
|
|
55
|
+
onClick: this.handleClick,
|
|
56
|
+
dataId: isActive ? `yearAtv_${year}` : `year_${year}`
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
58
|
+
alignBox: "row",
|
|
59
|
+
align: "vertical"
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
61
|
+
flexible: true
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
63
|
+
className: style.yearText,
|
|
64
|
+
title: year,
|
|
65
|
+
a11y: {
|
|
66
|
+
tabindex: '0'
|
|
67
|
+
},
|
|
68
|
+
tagName: "h4"
|
|
69
|
+
})), /*#__PURE__*/React.createElement(Icon, {
|
|
70
|
+
name: "ZD-arrowDownSingle",
|
|
71
|
+
size: "7",
|
|
72
|
+
isBold: true,
|
|
73
|
+
iconClass: isOpen ? `${style.arrow} ${style.arrowActive}` : style.arrow
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class Month extends React.PureComponent {
|
|
80
|
+
constructor(props) {
|
|
81
|
+
super(props);
|
|
82
|
+
this.handleClick = this.handleClick.bind(this);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
handleClick() {
|
|
86
|
+
const {
|
|
87
|
+
month,
|
|
88
|
+
onClick
|
|
89
|
+
} = this.props;
|
|
90
|
+
let monthIndex = monthNamesData.indexOf(month);
|
|
91
|
+
monthIndex = monthIndex === -1 ? 0 : monthIndex;
|
|
92
|
+
onClick && onClick(monthIndex);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
render() {
|
|
96
|
+
const {
|
|
97
|
+
month,
|
|
98
|
+
isActive,
|
|
99
|
+
displayText,
|
|
100
|
+
hoverText
|
|
101
|
+
} = this.props;
|
|
102
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
103
|
+
dataId: `month_${month}`,
|
|
104
|
+
className: `${style.month} ${isActive ? style.currentMonth : ''}`,
|
|
105
|
+
onClick: this.handleClick,
|
|
106
|
+
"data-title": hoverText,
|
|
107
|
+
"aria-label": month
|
|
108
|
+
}, displayText);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default class YearView extends React.PureComponent {
|
|
114
|
+
constructor(props) {
|
|
115
|
+
super(props);
|
|
116
|
+
this.renderListItem = this.renderListItem.bind(this);
|
|
117
|
+
this.handleMonthClick = this.handleMonthClick.bind(this);
|
|
118
|
+
this.handleYearClick = this.handleYearClick.bind(this);
|
|
119
|
+
this.getPublicMethods = this.getPublicMethods.bind(this);
|
|
120
|
+
this.handleScrollToYear = this.handleScrollToYear.bind(this);
|
|
121
|
+
this.handleUpdateLocalYear = this.handleUpdateLocalYear.bind(this);
|
|
122
|
+
this.years = getYears();
|
|
123
|
+
this.state = {
|
|
124
|
+
localYear: ''
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
componentDidMount() {
|
|
129
|
+
this.handleScrollToYear(this.props);
|
|
130
|
+
this.handleUpdateLocalYear(this.props);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
componentDidUpdate(prevProps) {
|
|
134
|
+
let {
|
|
135
|
+
viewedYear
|
|
136
|
+
} = this.props;
|
|
137
|
+
viewedYear = parseInt(viewedYear) || 0;
|
|
138
|
+
let {
|
|
139
|
+
viewedYear: oldViewedYear
|
|
140
|
+
} = prevProps;
|
|
141
|
+
oldViewedYear = parseInt(oldViewedYear) || 0;
|
|
142
|
+
|
|
143
|
+
if (viewedYear !== oldViewedYear) {
|
|
144
|
+
this.handleScrollToYear(this.props);
|
|
145
|
+
this.handleUpdateLocalYear(this.props);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
handleUpdateLocalYear(props) {
|
|
150
|
+
let {
|
|
151
|
+
viewedYear
|
|
152
|
+
} = props;
|
|
153
|
+
viewedYear = parseInt(viewedYear) || 0;
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
this.setState({
|
|
156
|
+
localYear: viewedYear
|
|
157
|
+
});
|
|
158
|
+
}, 150);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
handleScrollToYear(props) {
|
|
162
|
+
const {
|
|
163
|
+
years = [],
|
|
164
|
+
scrollToIndex
|
|
165
|
+
} = this;
|
|
166
|
+
let {
|
|
167
|
+
viewedYear
|
|
168
|
+
} = props;
|
|
169
|
+
viewedYear = parseInt(viewedYear) || 0;
|
|
170
|
+
const yearIndex = years.indexOf(viewedYear);
|
|
171
|
+
yearIndex >= 0 && scrollToIndex && scrollToIndex(yearIndex, 0, {
|
|
172
|
+
duration: 0
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
getPublicMethods(methods) {
|
|
177
|
+
const {
|
|
178
|
+
scrollToIndex
|
|
179
|
+
} = methods;
|
|
180
|
+
this.scrollToIndex = scrollToIndex;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
handleMonthClick(month) {
|
|
184
|
+
const {
|
|
185
|
+
onSelectMonth
|
|
186
|
+
} = this.props;
|
|
187
|
+
onSelectMonth && onSelectMonth(month);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
handleYearClick(year) {
|
|
191
|
+
const {
|
|
192
|
+
onSelectYear
|
|
193
|
+
} = this.props;
|
|
194
|
+
onSelectYear && onSelectYear(year);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
renderListItem(_ref) {
|
|
198
|
+
let {
|
|
199
|
+
index,
|
|
200
|
+
style: virtualizerStyle,
|
|
201
|
+
ref
|
|
202
|
+
} = _ref;
|
|
203
|
+
const {
|
|
204
|
+
years
|
|
205
|
+
} = this;
|
|
206
|
+
const year = years[index];
|
|
207
|
+
let {
|
|
208
|
+
viewedYear,
|
|
209
|
+
viewedMonth,
|
|
210
|
+
monthNamesShort,
|
|
211
|
+
isMonthOpen
|
|
212
|
+
} = this.props;
|
|
213
|
+
viewedYear = parseInt(viewedYear) || 0;
|
|
214
|
+
let {
|
|
215
|
+
localYear
|
|
216
|
+
} = this.state;
|
|
217
|
+
localYear = parseInt(localYear) || 0;
|
|
218
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
219
|
+
isCover: false,
|
|
220
|
+
className: style.yearBox,
|
|
221
|
+
eleRef: ref,
|
|
222
|
+
style: virtualizerStyle
|
|
223
|
+
}, /*#__PURE__*/React.createElement(Year, {
|
|
224
|
+
year: year,
|
|
225
|
+
onClick: this.handleYearClick,
|
|
226
|
+
isActive: viewedYear === year,
|
|
227
|
+
isOpen: isMonthOpen
|
|
228
|
+
}), viewedYear === year && isMonthOpen ? /*#__PURE__*/React.createElement(Box, {
|
|
229
|
+
flexible: true
|
|
230
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
231
|
+
alignBox: "row",
|
|
232
|
+
wrap: "wrap",
|
|
233
|
+
align: "between",
|
|
234
|
+
className: `${style.yearContainer} ${viewedYear !== localYear && viewedYear === year ? style.toggleYear : ''}`
|
|
235
|
+
}, monthNamesData.map((month, index) => {
|
|
236
|
+
const monthIndex = monthNamesData.indexOf(month);
|
|
237
|
+
return /*#__PURE__*/React.createElement(Month, {
|
|
238
|
+
key: month,
|
|
239
|
+
month: month,
|
|
240
|
+
onClick: this.handleMonthClick,
|
|
241
|
+
isActive: monthIndex === viewedMonth,
|
|
242
|
+
displayText: monthNamesShort[index] // hoverText={monthNames[index]}
|
|
243
|
+
|
|
244
|
+
});
|
|
245
|
+
}))) : null);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
render() {
|
|
249
|
+
const {
|
|
250
|
+
years = []
|
|
251
|
+
} = this;
|
|
252
|
+
return /*#__PURE__*/React.createElement(Virtualizer, {
|
|
253
|
+
elementRenderer: this.renderListItem,
|
|
254
|
+
elementsCount: years.length,
|
|
255
|
+
className: style.container,
|
|
256
|
+
getExposedPublicMethods: this.getPublicMethods,
|
|
257
|
+
isElementsFixedHeight: false,
|
|
258
|
+
dataId: "yearList"
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
}
|
|
263
|
+
YearView.propTypes = YearView_propTypes;
|
|
264
|
+
YearView.defaultProps = YearView_defaultProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DateWidget } from './DateWidget';
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
import React, { useRef, Fragment, useContext } from 'react';
|
|
4
|
+
import FocusScope from '@zohodesk/a11y/es/FocusScope/FocusScope';
|
|
5
|
+
import Modal from '../Modal/Modal';
|
|
6
|
+
import { getLibraryConfig } from '../../Provider/Config';
|
|
7
|
+
import LibraryContext from '../../Provider/LibraryContextInit';
|
|
8
|
+
import cssJSLogic from '../../DropBox/css/cssJSLogic';
|
|
9
|
+
import DropBoxElement from './DropBoxElement/DropBoxElement';
|
|
10
|
+
import { DropBoxDefaultProps } from '../../DropBox/props/defaultProps';
|
|
11
|
+
import { DropBoxPropTypes } from '../../DropBox/props/propTypes';
|
|
12
|
+
import { stopPropagation } from '../../utils/Common';
|
|
13
|
+
import style from '../../DropBox/css/DropBox.module.css';
|
|
14
|
+
export default function DropBox(props) {
|
|
15
|
+
const dropBoxRef = useRef(null);
|
|
16
|
+
const DropBoxContext = useContext(LibraryContext);
|
|
17
|
+
const {
|
|
18
|
+
needResponsive,
|
|
19
|
+
portalId,
|
|
20
|
+
isActive,
|
|
21
|
+
isAbsolutePositioningNeeded,
|
|
22
|
+
isRestrictScroll,
|
|
23
|
+
needFocusScope,
|
|
24
|
+
onClose,
|
|
25
|
+
customProps
|
|
26
|
+
} = props;
|
|
27
|
+
const {
|
|
28
|
+
focusScopeProps = {}
|
|
29
|
+
} = customProps;
|
|
30
|
+
const {
|
|
31
|
+
autoFocus = true,
|
|
32
|
+
restoreFocus = true,
|
|
33
|
+
needArrowLoop = true,
|
|
34
|
+
needTabLoop = false,
|
|
35
|
+
enableEnterAction = true
|
|
36
|
+
} = focusScopeProps;
|
|
37
|
+
const {
|
|
38
|
+
direction
|
|
39
|
+
} = DropBoxContext || {};
|
|
40
|
+
let windowWidth,
|
|
41
|
+
mobileWidth = getLibraryConfig('mobileWidth'),
|
|
42
|
+
isModel = false;
|
|
43
|
+
|
|
44
|
+
if (needResponsive) {
|
|
45
|
+
windowWidth = window.innerWidth;
|
|
46
|
+
|
|
47
|
+
if (windowWidth <= mobileWidth) {
|
|
48
|
+
isModel = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
zIndexStyle
|
|
54
|
+
} = cssJSLogic(props);
|
|
55
|
+
const dropBoxEle = needFocusScope ? /*#__PURE__*/React.createElement(FocusScope, _extends({
|
|
56
|
+
onClose: onClose,
|
|
57
|
+
elementRef: dropBoxRef,
|
|
58
|
+
autoFocus: autoFocus,
|
|
59
|
+
restoreFocus: restoreFocus,
|
|
60
|
+
needArrowLoop: needArrowLoop,
|
|
61
|
+
needTabLoop: needTabLoop,
|
|
62
|
+
enableEnterAction: enableEnterAction
|
|
63
|
+
}, focusScopeProps), /*#__PURE__*/React.createElement(DropBoxElement, _extends({
|
|
64
|
+
isModel: isModel,
|
|
65
|
+
direction: direction
|
|
66
|
+
}, props, {
|
|
67
|
+
zIndexStyle: zIndexStyle,
|
|
68
|
+
subContainerRef: dropBoxRef
|
|
69
|
+
}))) : /*#__PURE__*/React.createElement(DropBoxElement, _extends({
|
|
70
|
+
isModel: isModel,
|
|
71
|
+
subContainerRef: dropBoxRef,
|
|
72
|
+
direction: direction
|
|
73
|
+
}, props, {
|
|
74
|
+
zIndexStyle: zIndexStyle
|
|
75
|
+
}));
|
|
76
|
+
return isModel && isActive ? /*#__PURE__*/React.createElement(Modal, {
|
|
77
|
+
portalId: portalId
|
|
78
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: `${style.freezeLayer} ${style.freeze}`,
|
|
80
|
+
style: zIndexStyle,
|
|
81
|
+
onClick: stopPropagation
|
|
82
|
+
}), dropBoxEle)) : !isAbsolutePositioningNeeded && isActive ? /*#__PURE__*/React.createElement(Modal, {
|
|
83
|
+
portalId: portalId
|
|
84
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, isRestrictScroll ? /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: style.freezeLayer,
|
|
86
|
+
style: zIndexStyle,
|
|
87
|
+
onClick: stopPropagation
|
|
88
|
+
}) : null, dropBoxEle)) : dropBoxEle;
|
|
89
|
+
}
|
|
90
|
+
DropBox.propTypes = DropBoxPropTypes;
|
|
91
|
+
DropBox.defaultProps = DropBoxDefaultProps;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useDropboxPosCalc from '../../../DropBox/DropBoxElement/useDropboxPosCalc';
|
|
3
|
+
import cssJSLogic from '../../../DropBox/DropBoxElement/css/cssJSLogic';
|
|
4
|
+
import { positionMapping } from '../../../DropBox/DropBoxPositionMapping.json';
|
|
5
|
+
import { DropBoxElementDefaultProps } from '../../../DropBox/DropBoxElement/props/defaultProps';
|
|
6
|
+
import { DropBoxElementPropTypes } from '../../../DropBox/DropBoxElement/props/propTypes';
|
|
7
|
+
import { mergeStyle } from '@zohodesk/utils';
|
|
8
|
+
import style from '../../../DropBox/DropBoxElement/css/DropBoxElement.module.css';
|
|
9
|
+
export default function DropBoxElement(props) {
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
isAnimate,
|
|
13
|
+
isArrow,
|
|
14
|
+
arrowPosition,
|
|
15
|
+
boxPosition,
|
|
16
|
+
size,
|
|
17
|
+
onClick,
|
|
18
|
+
isActive,
|
|
19
|
+
dataId,
|
|
20
|
+
dataSelectorId,
|
|
21
|
+
isModel,
|
|
22
|
+
isAbsolutePositioningNeeded,
|
|
23
|
+
tourId,
|
|
24
|
+
htmlId,
|
|
25
|
+
a11y,
|
|
26
|
+
tabIndex,
|
|
27
|
+
palette,
|
|
28
|
+
subContainerRef,
|
|
29
|
+
customStyle,
|
|
30
|
+
animationStyle
|
|
31
|
+
} = props;
|
|
32
|
+
let isAbsolute = isAbsolutePositioningNeeded;
|
|
33
|
+
|
|
34
|
+
const FireOnAnimationEnd = () => {
|
|
35
|
+
let eleClassList = subContainerRef && subContainerRef.current.classList;
|
|
36
|
+
let animationStyles = animationStyle == 'default' ? style.fadeInScale : style[animationStyle];
|
|
37
|
+
animationStyles.split(' ').map(rmStyle => {
|
|
38
|
+
if (eleClassList && eleClassList.contains(rmStyle)) {
|
|
39
|
+
eleClassList.remove(rmStyle);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getRef = ele => {
|
|
45
|
+
const {
|
|
46
|
+
getRef,
|
|
47
|
+
forwardRef
|
|
48
|
+
} = props;
|
|
49
|
+
getRef && getRef(ele);
|
|
50
|
+
|
|
51
|
+
if (forwardRef) {
|
|
52
|
+
forwardRef.current = ele;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
if (!isAbsolutePositioningNeeded && size === 'default' && !isActive) {
|
|
57
|
+
isAbsolute = true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
role,
|
|
62
|
+
ariaMultiselectable,
|
|
63
|
+
ariaLabelledby
|
|
64
|
+
} = a11y;
|
|
65
|
+
boxPosition = boxPosition && boxPosition != 'undefined' ? boxPosition : 'bottomCenter';
|
|
66
|
+
const boxDirection = positionMapping[boxPosition].direction;
|
|
67
|
+
|
|
68
|
+
if (isAbsolute) {
|
|
69
|
+
arrowPosition = arrowPosition ? arrowPosition : positionMapping[boxPosition].arrowPosition;
|
|
70
|
+
boxPosition = positionMapping[boxPosition].positionStyle;
|
|
71
|
+
} else {
|
|
72
|
+
arrowPosition = positionMapping[boxPosition].arrowPosition;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const {
|
|
76
|
+
arrowstyle,
|
|
77
|
+
boxstyle,
|
|
78
|
+
needBoxStyle
|
|
79
|
+
} = useDropboxPosCalc(props);
|
|
80
|
+
const mergedStyle = mergeStyle(style, customStyle);
|
|
81
|
+
const {
|
|
82
|
+
boxClassName,
|
|
83
|
+
subContainerClass,
|
|
84
|
+
inlineStyle
|
|
85
|
+
} = cssJSLogic({
|
|
86
|
+
props,
|
|
87
|
+
style: mergedStyle,
|
|
88
|
+
customState: {
|
|
89
|
+
boxPosition,
|
|
90
|
+
boxDirection,
|
|
91
|
+
boxstyle,
|
|
92
|
+
needBoxStyle,
|
|
93
|
+
isAbsolute
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: boxClassName,
|
|
98
|
+
"data-id": `${dataId}`,
|
|
99
|
+
"data-test-id": `${dataId}`,
|
|
100
|
+
"data-selector-id": dataSelectorId,
|
|
101
|
+
ref: getRef,
|
|
102
|
+
style: inlineStyle,
|
|
103
|
+
"data-tour": tourId,
|
|
104
|
+
"data-position": boxPosition,
|
|
105
|
+
id: htmlId,
|
|
106
|
+
role: role,
|
|
107
|
+
"aria-multiselectable": ariaMultiselectable,
|
|
108
|
+
"aria-labelledby": ariaLabelledby,
|
|
109
|
+
tabIndex: tabIndex,
|
|
110
|
+
onAnimationEnd: isAnimate && FireOnAnimationEnd
|
|
111
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
tabIndex: "-1",
|
|
113
|
+
className: `${subContainerClass} ${style[`${palette}Palette`]}`,
|
|
114
|
+
onClick: onClick,
|
|
115
|
+
"data-id": `${dataId}_subcontainer`,
|
|
116
|
+
"data-test-id": `${dataId}_subcontainer`,
|
|
117
|
+
"data-selector-id": `${dataSelectorId}_subcontainer`,
|
|
118
|
+
ref: subContainerRef
|
|
119
|
+
}, isModel ? /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: style.closeBar
|
|
121
|
+
}) : null, isArrow && !isModel && /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: style[arrowPosition],
|
|
123
|
+
style: arrowstyle,
|
|
124
|
+
"data-id": `${dataId}_arrow`,
|
|
125
|
+
"data-test-id": `${dataId}_arrow`,
|
|
126
|
+
"data-selector-id": `${dataSelectorId}_arrow`
|
|
127
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
+
className: style.arrowShape
|
|
129
|
+
})), children));
|
|
130
|
+
}
|
|
131
|
+
DropBoxElement.propTypes = DropBoxElementPropTypes;
|
|
132
|
+
DropBoxElement.defaultProps = DropBoxElementDefaultProps;
|