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