design-react-kit 3.3.1 → 4.0.1

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.EN.md +35 -17
  2. package/README.md +34 -18
  3. package/package.json +152 -120
  4. package/src/Accordion/Accordion.tsx +30 -0
  5. package/src/Accordion/AccordionBody.tsx +127 -0
  6. package/src/Accordion/AccordionHeader.tsx +42 -0
  7. package/src/Alert/Alert.tsx +39 -0
  8. package/src/Avatar/AvatarContainer.tsx +22 -0
  9. package/src/Avatar/AvatarExtraText.tsx +19 -0
  10. package/src/Avatar/AvatarGroupContainer.tsx +23 -0
  11. package/src/Avatar/AvatarIcon.tsx +57 -0
  12. package/src/Avatar/AvatarPresence.tsx +24 -0
  13. package/src/Avatar/AvatarStatus.tsx +24 -0
  14. package/src/Avatar/AvatarWrapper.tsx +24 -0
  15. package/src/Badge/Badge.tsx +40 -0
  16. package/src/BottomNav/BottomNav.tsx +20 -0
  17. package/src/BottomNav/BottomNavItem.tsx +75 -0
  18. package/src/Breadcrumb/Breadcrumb.tsx +40 -0
  19. package/src/Button/Button.tsx +55 -0
  20. package/src/Callout/Callout.tsx +35 -0
  21. package/src/Callout/CalloutText.tsx +29 -0
  22. package/src/Callout/CalloutTitle.tsx +24 -0
  23. package/src/Card/Card.tsx +49 -0
  24. package/src/Card/CardBody.tsx +21 -0
  25. package/src/Card/CardCategory.tsx +48 -0
  26. package/src/Card/CardFooterCTA.tsx +19 -0
  27. package/src/Card/CardReadMore.tsx +35 -0
  28. package/src/Card/CardSignature.tsx +19 -0
  29. package/src/Card/CardTag.tsx +19 -0
  30. package/src/Card/CardTagsHeader.tsx +28 -0
  31. package/src/Card/CardText.tsx +19 -0
  32. package/src/Card/CardTitle.tsx +17 -0
  33. package/src/Chips/Chip.tsx +37 -0
  34. package/src/Chips/ChipLabel.tsx +19 -0
  35. package/src/Collapse/Collapse.tsx +100 -0
  36. package/src/CookieBar/CookieBar.tsx +19 -0
  37. package/src/CookieBar/CookieBarButton.tsx +27 -0
  38. package/src/CookieBar/CookieBarButtons.tsx +19 -0
  39. package/src/Dimmer/Dimmer.tsx +51 -0
  40. package/src/Dimmer/DimmerButtons.tsx +35 -0
  41. package/src/FontLoader/FontLoader.tsx +32 -0
  42. package/src/Forward/Forward.tsx +40 -0
  43. package/src/Grid/GridItem.tsx +23 -0
  44. package/src/Grid/GridItemText.tsx +20 -0
  45. package/src/Grid/GridItemTextWrapper.tsx +21 -0
  46. package/src/Grid/GridList.tsx +20 -0
  47. package/src/Grid/GridRow.tsx +20 -0
  48. package/src/Grid/index.ts +11 -0
  49. package/src/{components/Header/Header.js → Header/Header.tsx} +19 -24
  50. package/src/Header/HeaderBrand.tsx +90 -0
  51. package/src/Header/HeaderContent.tsx +42 -0
  52. package/src/Header/HeaderContext.tsx +9 -0
  53. package/src/Header/HeaderLinkZone.tsx +19 -0
  54. package/src/Header/HeaderRightZone.tsx +26 -0
  55. package/src/Header/HeaderSearch.tsx +33 -0
  56. package/src/Header/HeaderSocialsZone.tsx +26 -0
  57. package/src/Header/HeaderToggler.tsx +46 -0
  58. package/src/{components/Header/Headers.js → Header/Headers.tsx} +17 -22
  59. package/src/Hero/Hero.tsx +34 -0
  60. package/src/Hero/HeroBackground.tsx +25 -0
  61. package/src/Hero/HeroBody.tsx +21 -0
  62. package/src/Hero/HeroButton.tsx +19 -0
  63. package/src/Hero/HeroCategory.tsx +15 -0
  64. package/src/Hero/HeroTitle.tsx +16 -0
  65. package/src/Hero/index.ts +13 -0
  66. package/src/Icon/EmptyIcon.tsx +7 -0
  67. package/src/Icon/Icon.tsx +116 -0
  68. package/src/Icon/assets/ItArrowDown.tsx +9 -0
  69. package/src/Icon/assets/ItArrowDownCircle.tsx +9 -0
  70. package/src/Icon/assets/ItArrowDownTriangle.tsx +9 -0
  71. package/src/Icon/assets/ItArrowLeft.tsx +9 -0
  72. package/src/Icon/assets/ItArrowLeftCircle.tsx +9 -0
  73. package/src/Icon/assets/ItArrowLeftTriangle.tsx +9 -0
  74. package/src/Icon/assets/ItArrowRight.tsx +9 -0
  75. package/src/Icon/assets/ItArrowRightCircle.tsx +9 -0
  76. package/src/Icon/assets/ItArrowRightTriangle.tsx +9 -0
  77. package/src/Icon/assets/ItArrowUp.tsx +9 -0
  78. package/src/Icon/assets/ItArrowUpCircle.tsx +9 -0
  79. package/src/Icon/assets/ItArrowUpTriangle.tsx +9 -0
  80. package/src/Icon/assets/ItBan.tsx +9 -0
  81. package/src/Icon/assets/ItBehance.tsx +9 -0
  82. package/src/Icon/assets/ItBookmark.tsx +9 -0
  83. package/src/Icon/assets/ItBox.tsx +12 -0
  84. package/src/Icon/assets/ItBurger.tsx +9 -0
  85. package/src/Icon/assets/ItCalendar.tsx +9 -0
  86. package/src/Icon/assets/ItCamera.tsx +9 -0
  87. package/src/Icon/assets/ItCard.tsx +9 -0
  88. package/src/Icon/assets/ItChartLine.tsx +12 -0
  89. package/src/Icon/assets/ItCheck.tsx +9 -0
  90. package/src/Icon/assets/ItCheckCircle.tsx +9 -0
  91. package/src/Icon/assets/ItChevronLeft.tsx +8 -0
  92. package/src/Icon/assets/ItChevronRight.tsx +8 -0
  93. package/src/Icon/assets/ItClip.tsx +9 -0
  94. package/src/Icon/assets/ItClock.tsx +9 -0
  95. package/src/Icon/assets/ItClose.tsx +9 -0
  96. package/src/Icon/assets/ItCloseBig.tsx +9 -0
  97. package/src/Icon/assets/ItCloseCircle.tsx +9 -0
  98. package/src/Icon/assets/ItCodeCircle.tsx +9 -0
  99. package/src/Icon/assets/ItCollapse.tsx +8 -0
  100. package/src/Icon/assets/ItComment.tsx +9 -0
  101. package/src/Icon/assets/ItCopy.tsx +9 -0
  102. package/src/Icon/assets/ItDelete.tsx +12 -0
  103. package/src/Icon/assets/ItDesignersItalia.tsx +9 -0
  104. package/src/Icon/assets/ItDownload.tsx +9 -0
  105. package/src/Icon/assets/ItError.tsx +9 -0
  106. package/src/Icon/assets/ItExchangeCircle.tsx +9 -0
  107. package/src/Icon/assets/ItExpand.tsx +8 -0
  108. package/src/Icon/assets/ItExternalLink.tsx +9 -0
  109. package/src/Icon/assets/ItFacebook.tsx +9 -0
  110. package/src/Icon/assets/ItFacebookSquare.tsx +9 -0
  111. package/src/Icon/assets/ItFile.tsx +9 -0
  112. package/src/Icon/assets/ItFiles.tsx +9 -0
  113. package/src/Icon/assets/ItFlag.tsx +9 -0
  114. package/src/Icon/assets/ItFlickr.tsx +10 -0
  115. package/src/Icon/assets/ItFlickrSquare.tsx +9 -0
  116. package/src/Icon/assets/ItFolder.tsx +9 -0
  117. package/src/Icon/assets/ItFullscreen.tsx +11 -0
  118. package/src/Icon/assets/ItFunnel.tsx +9 -0
  119. package/src/Icon/assets/ItGithub.tsx +9 -0
  120. package/src/Icon/assets/ItHearing.tsx +9 -0
  121. package/src/Icon/assets/ItHelp.tsx +9 -0
  122. package/src/Icon/assets/ItHelpCircle.tsx +9 -0
  123. package/src/Icon/assets/ItHorn.tsx +9 -0
  124. package/src/Icon/assets/ItInbox.tsx +12 -0
  125. package/src/Icon/assets/ItInfoCircle.tsx +9 -0
  126. package/src/Icon/assets/ItInstagram.tsx +9 -0
  127. package/src/Icon/assets/ItKey.tsx +9 -0
  128. package/src/Icon/assets/ItLessCircle.tsx +12 -0
  129. package/src/Icon/assets/ItLink.tsx +9 -0
  130. package/src/Icon/assets/ItLinkedin.tsx +9 -0
  131. package/src/Icon/assets/ItLinkedinSquare.tsx +9 -0
  132. package/src/Icon/assets/ItList.tsx +9 -0
  133. package/src/Icon/assets/ItLock.tsx +12 -0
  134. package/src/Icon/assets/ItLocked.tsx +9 -0
  135. package/src/Icon/assets/ItMail.tsx +9 -0
  136. package/src/Icon/assets/ItMapMarker.tsx +9 -0
  137. package/src/Icon/assets/ItMapMarkerCircle.tsx +12 -0
  138. package/src/Icon/assets/ItMapMarkerMinus.tsx +9 -0
  139. package/src/Icon/assets/ItMapMarkerPlus.tsx +12 -0
  140. package/src/Icon/assets/ItMaximize.tsx +11 -0
  141. package/src/Icon/assets/ItMaximizeAlt.tsx +11 -0
  142. package/src/Icon/assets/ItMedium.tsx +9 -0
  143. package/src/Icon/assets/ItMediumSquare.tsx +9 -0
  144. package/src/Icon/assets/ItMinimize.tsx +11 -0
  145. package/src/Icon/assets/ItMinus.tsx +9 -0
  146. package/src/Icon/assets/ItMinusCircle.tsx +9 -0
  147. package/src/Icon/assets/ItMoreActions.tsx +9 -0
  148. package/src/Icon/assets/ItMoreItems.tsx +9 -0
  149. package/src/Icon/assets/ItNote.tsx +9 -0
  150. package/src/Icon/assets/ItOpenSource.tsx +9 -0
  151. package/src/Icon/assets/ItPa.tsx +9 -0
  152. package/src/Icon/assets/ItPasswordInvisible.tsx +9 -0
  153. package/src/Icon/assets/ItPasswordVisible.tsx +9 -0
  154. package/src/Icon/assets/ItPencil.tsx +9 -0
  155. package/src/Icon/assets/ItPiattaforme.tsx +10 -0
  156. package/src/Icon/assets/ItPin.tsx +9 -0
  157. package/src/Icon/assets/ItPlug.tsx +9 -0
  158. package/src/Icon/assets/ItPlus.tsx +9 -0
  159. package/src/Icon/assets/ItPlusCircle.tsx +9 -0
  160. package/src/Icon/assets/ItPresentation.tsx +9 -0
  161. package/src/Icon/assets/ItPrint.tsx +9 -0
  162. package/src/Icon/assets/ItRefresh.tsx +9 -0
  163. package/src/Icon/assets/ItRestore.tsx +9 -0
  164. package/src/Icon/assets/ItRss.tsx +11 -0
  165. package/src/Icon/assets/ItRssSquare.tsx +9 -0
  166. package/src/Icon/assets/ItSearch.tsx +9 -0
  167. package/src/Icon/assets/ItSettings.tsx +9 -0
  168. package/src/Icon/assets/ItShare.tsx +9 -0
  169. package/src/Icon/assets/ItSoftware.tsx +10 -0
  170. package/src/Icon/assets/ItStarFull.tsx +9 -0
  171. package/src/Icon/assets/ItStarOutline.tsx +9 -0
  172. package/src/Icon/assets/ItTeamDigitale.tsx +8 -0
  173. package/src/Icon/assets/ItTelegram.tsx +11 -0
  174. package/src/Icon/assets/ItTelephone.tsx +9 -0
  175. package/src/Icon/assets/ItTool.tsx +9 -0
  176. package/src/Icon/assets/ItTwitter.tsx +9 -0
  177. package/src/Icon/assets/ItTwitterSquare.tsx +9 -0
  178. package/src/Icon/assets/ItUnlocked.tsx +9 -0
  179. package/src/Icon/assets/ItUpload.tsx +9 -0
  180. package/src/Icon/assets/ItUser.tsx +9 -0
  181. package/src/Icon/assets/ItVideo.tsx +9 -0
  182. package/src/Icon/assets/ItWarning.tsx +9 -0
  183. package/src/Icon/assets/ItWarningCircle.tsx +9 -0
  184. package/src/Icon/assets/ItWhatsapp.tsx +9 -0
  185. package/src/Icon/assets/ItWhatsappSquare.tsx +10 -0
  186. package/src/Icon/assets/ItWifi.tsx +12 -0
  187. package/src/Icon/assets/ItYoutube.tsx +9 -0
  188. package/src/Icon/assets/ItZoomIn.tsx +9 -0
  189. package/src/Icon/assets/ItZoomOut.tsx +9 -0
  190. package/src/Icon/assets/index.tsx +504 -0
  191. package/src/Input/Input.tsx +342 -0
  192. package/src/Input/InputContainer.tsx +34 -0
  193. package/src/Input/TextArea.tsx +184 -0
  194. package/src/Input/TimeInput.tsx +303 -0
  195. package/src/Input/utils.tsx +166 -0
  196. package/src/LinkList/LinkList.tsx +65 -0
  197. package/src/LinkList/LinkListItem.tsx +98 -0
  198. package/src/Megamenu/Megamenu.tsx +37 -0
  199. package/src/Megamenu/MegamenuFooter.tsx +20 -0
  200. package/src/Megamenu/MegamenuHighlightColumn.tsx +33 -0
  201. package/src/Megamenu/MegamenuItem.tsx +27 -0
  202. package/src/Modal/Modal.tsx +79 -0
  203. package/src/Modal/ModalBody.tsx +11 -0
  204. package/src/Modal/ModalFooter.tsx +11 -0
  205. package/src/Modal/ModalHeader.tsx +70 -0
  206. package/src/Nav/Nav.tsx +56 -0
  207. package/src/Notification/Notification.tsx +60 -0
  208. package/src/Notification/NotificationContent.tsx +135 -0
  209. package/src/Notification/NotificationManager.tsx +65 -0
  210. package/src/Notification/core.tsx +46 -0
  211. package/src/Notification/index.ts +9 -0
  212. package/src/Notification/types.ts +12 -0
  213. package/src/Notification/usePosition.tsx +11 -0
  214. package/src/Pager/Pager.tsx +48 -0
  215. package/src/PasswordInput/PasswordInput.tsx +43 -0
  216. package/src/Progress/Progress.tsx +94 -0
  217. package/src/Rating/Rating.tsx +130 -0
  218. package/src/ResponsiveImage/ResponsiveImage.tsx +25 -0
  219. package/src/Section/Section.tsx +86 -0
  220. package/src/Select/Select.tsx +97 -0
  221. package/src/Select/shared.tsx +45 -0
  222. package/src/Sidebar/Sidebar.tsx +46 -0
  223. package/src/Skiplink/Skiplink.tsx +20 -0
  224. package/src/Skiplink/SkiplinkItem.tsx +29 -0
  225. package/src/Spinner/Spinner.tsx +55 -0
  226. package/src/Stepper/StepperContainer.tsx +30 -0
  227. package/src/Stepper/StepperContent.tsx +51 -0
  228. package/src/Stepper/StepperDots.tsx +21 -0
  229. package/src/Stepper/StepperHeader.tsx +19 -0
  230. package/src/Stepper/StepperHeaderElement.tsx +77 -0
  231. package/src/Stepper/StepperNav.tsx +19 -0
  232. package/src/ThumbNav/ThumbNav.tsx +37 -0
  233. package/src/ThumbNav/ThumbNavItem.tsx +35 -0
  234. package/src/Timeline/TimelinePin.tsx +67 -0
  235. package/src/Timeline/TimelineWrapper.tsx +19 -0
  236. package/src/Toggle/Toggle.tsx +29 -0
  237. package/src/Toolbar/Toolbar.tsx +28 -0
  238. package/src/Toolbar/ToolbarDividerItem.tsx +5 -0
  239. package/src/Toolbar/ToolbarItem.tsx +95 -0
  240. package/src/assets.d.ts +4 -0
  241. package/src/index.tsx +350 -0
  242. package/src/utils.tsx +26 -0
  243. package/.editorconfig +0 -18
  244. package/.eslintrc +0 -65
  245. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
  246. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  247. package/.github/PULL_REQUEST_TEMPLATE.md +0 -24
  248. package/AUTHORS +0 -3
  249. package/CODE_OF_CONDUCT.EN.md +0 -77
  250. package/CODE_OF_CONDUCT.md +0 -69
  251. package/dist/design-react-kit.cjs.js +0 -3698
  252. package/dist/design-react-kit.cjs.js.map +0 -1
  253. package/dist/design-react-kit.d.ts +0 -1704
  254. package/dist/design-react-kit.es.js +0 -3188
  255. package/dist/design-react-kit.es.js.map +0 -1
  256. package/dist/design-react-kit.full.js +0 -17596
  257. package/dist/design-react-kit.full.js.map +0 -1
  258. package/dist/design-react-kit.full.min.js +0 -2
  259. package/dist/design-react-kit.full.min.js.map +0 -1
  260. package/dist/design-react-kit.js +0 -13394
  261. package/dist/design-react-kit.js.map +0 -1
  262. package/dist/design-react-kit.min.js +0 -2
  263. package/dist/design-react-kit.min.js.map +0 -1
  264. package/src/Storyshots.test.js +0 -9
  265. package/src/components/Accordion/Accordion.js +0 -22
  266. package/src/components/Accordion/AccordionBody.js +0 -118
  267. package/src/components/Accordion/AccordionHeader.js +0 -37
  268. package/src/components/Autocomplete/Autocomplete.js +0 -255
  269. package/src/components/Avatar/AvatarContainer.js +0 -24
  270. package/src/components/Avatar/AvatarExtraText.js +0 -22
  271. package/src/components/Avatar/AvatarGroupContainer.js +0 -23
  272. package/src/components/Avatar/AvatarIcon.js +0 -32
  273. package/src/components/Avatar/AvatarPresence.js +0 -25
  274. package/src/components/Avatar/AvatarStatus.js +0 -25
  275. package/src/components/Avatar/AvatarWrapper.js +0 -25
  276. package/src/components/Badge/Badge.js +0 -28
  277. package/src/components/BottomNav/BottomNav.js +0 -27
  278. package/src/components/BottomNav/BottomNavItem.js +0 -69
  279. package/src/components/Button/Button.js +0 -26
  280. package/src/components/Callout/Callout.js +0 -33
  281. package/src/components/Callout/CalloutText.js +0 -37
  282. package/src/components/Callout/CalloutTitle.js +0 -27
  283. package/src/components/Card/Card.js +0 -50
  284. package/src/components/Card/CardCategory.js +0 -43
  285. package/src/components/Card/CardFooterCTA.js +0 -17
  286. package/src/components/Card/CardReadMore.js +0 -45
  287. package/src/components/Card/CardSignature.js +0 -17
  288. package/src/components/Card/CardTag.js +0 -23
  289. package/src/components/Card/CardTagsHeader.js +0 -21
  290. package/src/components/Chips/Chip.js +0 -50
  291. package/src/components/Chips/ChipLabel.js +0 -25
  292. package/src/components/Collapse/Collapse.js +0 -66
  293. package/src/components/CookieBar/CookieBar.js +0 -22
  294. package/src/components/CookieBar/CookieBarButton.js +0 -25
  295. package/src/components/CookieBar/CookieBarButtons.js +0 -23
  296. package/src/components/Dimmer/Dimmer.js +0 -38
  297. package/src/components/Dimmer/DimmerButtons.js +0 -35
  298. package/src/components/FontLoader/FontLoader.js +0 -22
  299. package/src/components/FormGroup/FormGroup.js +0 -137
  300. package/src/components/Forward/Forward.js +0 -32
  301. package/src/components/Header/HeaderBrand.js +0 -86
  302. package/src/components/Header/HeaderContent.js +0 -49
  303. package/src/components/Header/HeaderContext.js +0 -14
  304. package/src/components/Header/HeaderLinkZone.js +0 -24
  305. package/src/components/Header/HeaderRightZone.js +0 -33
  306. package/src/components/Header/HeaderSearch.js +0 -36
  307. package/src/components/Header/HeaderSocialsZone.js +0 -30
  308. package/src/components/Header/HeaderToggler.js +0 -50
  309. package/src/components/Hero/Hero.js +0 -10
  310. package/src/components/Icon/Icon.js +0 -42
  311. package/src/components/Input/Input.js +0 -261
  312. package/src/components/Input/InputContainer.js +0 -39
  313. package/src/components/Input/utils.js +0 -126
  314. package/src/components/LinkList/LinkList.js +0 -65
  315. package/src/components/LinkList/LinkListItem.js +0 -88
  316. package/src/components/Nav/Nav.js +0 -37
  317. package/src/components/Notification/Notification.js +0 -78
  318. package/src/components/Offcanvas/Offcanvas.js +0 -101
  319. package/src/components/Pager/Pager.js +0 -32
  320. package/src/components/PagerList/PagerList.js +0 -28
  321. package/src/components/PasswordInput/PasswordInput.js +0 -41
  322. package/src/components/PasswordMeter/PasswordMeter.js +0 -80
  323. package/src/components/Progress/Progress.js +0 -88
  324. package/src/components/Rating/Rating.js +0 -130
  325. package/src/components/Section/Section.js +0 -49
  326. package/src/components/Separator/Separator.js +0 -34
  327. package/src/components/Sidebar/Sidebar.js +0 -53
  328. package/src/components/Skiplink/Skiplink.js +0 -25
  329. package/src/components/Skiplink/SkiplinkItem.js +0 -25
  330. package/src/components/Spinner/Spinner.js +0 -65
  331. package/src/components/Stepper/StepperContainer.js +0 -33
  332. package/src/components/Stepper/StepperContent.js +0 -54
  333. package/src/components/Stepper/StepperDots.js +0 -27
  334. package/src/components/Stepper/StepperHeader.js +0 -27
  335. package/src/components/Stepper/StepperHeaderElement.js +0 -45
  336. package/src/components/Stepper/StepperNav.js +0 -27
  337. package/src/components/Table/Table.js +0 -68
  338. package/src/components/Timeline/TimelinePin.js +0 -59
  339. package/src/components/Timeline/TimelineWrapper.js +0 -21
  340. package/src/components/Toggle/Toggle.js +0 -27
  341. package/src/components/utils.js +0 -1
  342. package/src/index.js +0 -144
  343. package/static/favicons/android-chrome-192x192.png +0 -0
  344. package/static/favicons/android-chrome-512x512.png +0 -0
  345. package/static/favicons/apple-touch-icon.png +0 -0
  346. package/static/favicons/browserconfig.xml +0 -9
  347. package/static/favicons/favicon-16x16.png +0 -0
  348. package/static/favicons/favicon-32x32.png +0 -0
  349. package/static/favicons/favicon.ico +0 -0
  350. package/static/favicons/manifest.webmanifest +0 -21
  351. package/static/favicons/mstile-150x150.png +0 -0
  352. package/static/favicons/safari-pinned-tab.svg +0 -23
@@ -0,0 +1,303 @@
1
+ import React, { HTMLAttributes, ReactNode, useState } from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import { noop } from '../utils';
5
+ import { Input, InputProps } from './Input';
6
+ import { Icon } from '../Icon/Icon';
7
+ import { getClasses, getInfoTextControlClass } from './utils';
8
+
9
+ export const addTime = (value: string, maxValue: number): string => {
10
+ const currTime = Number(value);
11
+ return currTime >= maxValue ? value : (currTime + 1).toString();
12
+ };
13
+
14
+ export const subtractTime = (value: string, minValue: number): string => {
15
+ const currTime = Number(value);
16
+ return currTime <= minValue ? value : (currTime - 1).toString();
17
+ };
18
+
19
+ export const formatTime = (value: number | string): string =>
20
+ `0${value}`.substr(-2);
21
+
22
+ interface TimeInputContainerProps extends HTMLAttributes<HTMLElement> {
23
+ wrapperClass: string;
24
+ infoTextClass: string;
25
+ label: string | ReactNode | undefined;
26
+ infoText: string | undefined;
27
+ invalid: boolean;
28
+ id: string;
29
+ button: ReactNode;
30
+ children: ReactNode;
31
+ }
32
+
33
+ const TimeInputContainer = ({
34
+ wrapperClass,
35
+ children,
36
+ label,
37
+ id,
38
+ infoText,
39
+ button,
40
+ infoTextClass,
41
+ invalid
42
+ }: TimeInputContainerProps) => {
43
+ const infoId = id ? `${id}Description` : undefined;
44
+ const activeClass = 'active';
45
+
46
+ return (
47
+ <div className={classNames(wrapperClass)}>
48
+ <div className='input-group'>
49
+ {children}
50
+ <label
51
+ htmlFor={id}
52
+ className={classNames(activeClass, { 'error-label': invalid })}
53
+ >
54
+ {label}
55
+ </label>
56
+ <small id={infoId} className={infoTextClass}>
57
+ {infoText}
58
+ </small>
59
+ <div className='input-group-append'>{button}</div>
60
+ </div>
61
+ </div>
62
+ );
63
+ };
64
+
65
+ type UnusedProps = 'plaintext' | 'onBlur' | 'value' | 'type';
66
+
67
+ export interface TimeInputProps extends Omit<InputProps, UnusedProps> {
68
+ id: string;
69
+ /** Etichetta della sezione per il controllo delle ore e dei minuti - non visibile a schermo */
70
+ controlsLabel?: string;
71
+ /** Determina l'uso del tema scuro per la sezione di selezione di ore e minuti */
72
+ dark?: boolean;
73
+ /** Il valore del campo */
74
+ value?: string;
75
+ /** Funzione callback */
76
+ onBlur?: (time: string) => void;
77
+ /** Testo esplicativo per dispositivi screen reader */
78
+ srText?: string;
79
+ /** Etichetta del campo per la selezione delle ore - non visibile a schermo */
80
+ hoursLabel?: string;
81
+ /** Etichetta del campo per la selezione dei minuti - non visibile a schermo */
82
+ minutesLabel?: string;
83
+ /** Etichetta del bottone per incrementare le ore - non visibile a schermo */
84
+ increaseHoursLabel?: string;
85
+ /** Etichetta del bottone per incrementare i minuti - non visibile a schermo */
86
+ increaseMinutesLabel?: string;
87
+ /** Etichetta del bottone per diminuire le ore - non visibile a schermo */
88
+ decreaseHoursLabel?: string;
89
+ /** Etichetta del bottone per diminuire i minuti - non visibile a schermo */
90
+ decreaseMinutesLabel?: string;
91
+ }
92
+
93
+ export const TimeInput = ({
94
+ dark = false,
95
+ onBlur = noop,
96
+ label,
97
+ controlsLabel,
98
+ invalid = false,
99
+ value = '',
100
+ id,
101
+ placeholder,
102
+ srText,
103
+ hoursLabel,
104
+ minutesLabel,
105
+ increaseHoursLabel,
106
+ increaseMinutesLabel,
107
+ decreaseHoursLabel,
108
+ decreaseMinutesLabel,
109
+ ...attributes
110
+ }: TimeInputProps) => {
111
+ const [initialHours, initialMinutes] = value.split(':');
112
+ const [isOpen, setIsOpen] = useState(false);
113
+ const [hours, setHours] = useState(initialHours || '00');
114
+ const [minutes, setMinutes] = useState(initialMinutes || '00');
115
+ const [time, setTime] = useState(
116
+ initialHours && initialMinutes ? `${initialHours}:${initialMinutes}` : ''
117
+ );
118
+ const [isFocused, toggleFocus] = useState(false);
119
+
120
+ const button = (
121
+ <button
122
+ className='btn-time'
123
+ onClick={() => {
124
+ setIsOpen(!isOpen);
125
+ if (isOpen) onBlur(time);
126
+ }}
127
+ >
128
+ <Icon icon='it-clock' />
129
+ </button>
130
+ );
131
+
132
+ const onHoursChange = (value: string) => {
133
+ const formattedValue = formatTime(value);
134
+ setHours(isNaN(Number(formattedValue)) ? `00` : formattedValue);
135
+ setTime(`${formattedValue}:${minutes}`);
136
+ };
137
+
138
+ const onMinutesChange = (value: string) => {
139
+ const formattedValue = formatTime(value);
140
+ setMinutes(isNaN(Number(formattedValue)) ? `00` : formattedValue);
141
+ setTime(`${hours}:${formattedValue}`);
142
+ };
143
+
144
+ const onTimeChange = (value: string) => {
145
+ const [hours, minutes] = value.split(':');
146
+ onHoursChange(hours?.trim());
147
+ onMinutesChange(minutes?.trim());
148
+ setTime(value);
149
+ };
150
+
151
+ const infoTextControlClass = getInfoTextControlClass(
152
+ attributes,
153
+ attributes.cssModule
154
+ );
155
+
156
+ const { infoTextClass, wrapperClass } = getClasses(
157
+ attributes.className,
158
+ {
159
+ ...attributes,
160
+ normalized: Boolean(attributes.normalized),
161
+ inputPassword: false,
162
+ formControlClass: 'form-control',
163
+ infoTextControlClass,
164
+ isFocused,
165
+ originalWrapperClass:
166
+ attributes.wrapperClassName || attributes.wrapperClass
167
+ },
168
+ attributes.cssModule
169
+ );
170
+
171
+ return (
172
+ <div
173
+ className={classNames('it-timepicker-wrapper', {
174
+ 'theme-dark': dark
175
+ })}
176
+ >
177
+ <section className='time-spinner'>
178
+ <div className='error_container' role='alert' aria-atomic='true'></div>
179
+ <fieldset>
180
+ <legend>
181
+ <span className='sr-only'>{srText}</span>
182
+ </legend>
183
+ <div>
184
+ <div className='calendar-input-container'>
185
+ <TimeInputContainer
186
+ wrapperClass={wrapperClass}
187
+ infoTextClass={infoTextClass}
188
+ label={label}
189
+ infoText={attributes.infoText}
190
+ id={id}
191
+ button={button}
192
+ invalid={invalid}
193
+ >
194
+ <Input
195
+ {...attributes}
196
+ type='text'
197
+ label={label}
198
+ id={id}
199
+ placeholder={placeholder}
200
+ value={time}
201
+ onFocus={() => {
202
+ setIsOpen(false);
203
+ toggleFocus(true);
204
+ }}
205
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
206
+ onTimeChange(e.target.value)
207
+ }
208
+ invalid={invalid}
209
+ onBlur={() => {
210
+ toggleFocus(false);
211
+ onBlur(time);
212
+ }}
213
+ noWrapper
214
+ />
215
+ </TimeInputContainer>
216
+ </div>
217
+ </div>
218
+ </fieldset>
219
+ <div
220
+ className='spinner-control'
221
+ aria-hidden='true'
222
+ role='region'
223
+ aria-label={controlsLabel}
224
+ tabIndex={-1}
225
+ style={{ display: isOpen ? 'block' : 'none' }}
226
+ >
227
+ <div className='spinner-hour spinner'>
228
+ <Input
229
+ className='spinnerHour form-control'
230
+ aria-label={hoursLabel}
231
+ type='number'
232
+ value={hours}
233
+ role='spinbutton'
234
+ maxLength={2}
235
+ aria-valuenow={Number(hours)}
236
+ aria-valuemax={23}
237
+ aria-valuemin={0}
238
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
239
+ onHoursChange(e.target.value)
240
+ }
241
+ />
242
+ <div className='button-wrapper'>
243
+ <button
244
+ className='button-hour btnHourUp'
245
+ aria-label={increaseHoursLabel}
246
+ aria-hidden='true'
247
+ tabIndex={-1}
248
+ onClick={() => onHoursChange(addTime(hours, 23))}
249
+ >
250
+ <span className='icon-up'></span>
251
+ </button>
252
+ <button
253
+ className='button-hour btnHourDown'
254
+ aria-label={decreaseHoursLabel}
255
+ aria-hidden='true'
256
+ tabIndex={-1}
257
+ onClick={() => onHoursChange(subtractTime(hours, 0))}
258
+ >
259
+ <span className='icon-down'></span>
260
+ </button>
261
+ </div>
262
+ </div>
263
+ <div className='spinner-min spinner'>
264
+ <Input
265
+ className='spinnerMin form-control'
266
+ aria-label={minutesLabel}
267
+ type='number'
268
+ value={minutes}
269
+ role='spinbutton'
270
+ maxLength={2}
271
+ aria-valuenow={Number(minutes)}
272
+ aria-valuemax={59}
273
+ aria-valuemin={0}
274
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
275
+ onMinutesChange(e.target.value)
276
+ }
277
+ />
278
+ <div className='button-wrapper'>
279
+ <button
280
+ className='btnMinUp button-minute'
281
+ aria-label={increaseMinutesLabel}
282
+ aria-hidden='true'
283
+ tabIndex={-1}
284
+ onClick={() => onMinutesChange(addTime(minutes, 59))}
285
+ >
286
+ <span className='icon-up'></span>
287
+ </button>
288
+ <button
289
+ className='btnMinDown button-minute'
290
+ aria-label={decreaseMinutesLabel}
291
+ aria-hidden='true'
292
+ tabIndex={-1}
293
+ onClick={() => onMinutesChange(subtractTime(minutes, 0))}
294
+ >
295
+ <span className='icon-down'></span>
296
+ </button>
297
+ </div>
298
+ </div>
299
+ </div>
300
+ </section>
301
+ </div>
302
+ );
303
+ };
@@ -0,0 +1,166 @@
1
+ import classNames from 'classnames';
2
+ import { Util } from 'reactstrap';
3
+ import type { CSSModule } from 'reactstrap';
4
+ import type { InputProps } from './Input';
5
+ // @ts-ignore
6
+ const { mapToCssModules } = Util;
7
+
8
+ type ValidationProps = Pick<InputProps, 'valid' | 'invalid'>;
9
+ type TypeProps = Pick<InputProps, 'plaintext' | 'type'> & {
10
+ staticInput?: boolean;
11
+ };
12
+ type FormControlProps = Pick<InputProps, 'addon' | 'normalized'> & TypeProps;
13
+
14
+ function getFormControlClassInternal({
15
+ plaintext,
16
+ staticInput,
17
+ type = 'text',
18
+ addon,
19
+ normalized
20
+ }: FormControlProps) {
21
+ const formControlClass = 'form-control';
22
+ if (plaintext || staticInput || normalized) {
23
+ return `${formControlClass}-plaintext`;
24
+ }
25
+ if (type === 'file') {
26
+ return `${formControlClass}-file`;
27
+ }
28
+ if (['radio', 'checkbox'].indexOf(type) > -1) {
29
+ if (addon) {
30
+ return null;
31
+ }
32
+ }
33
+ return formControlClass;
34
+ }
35
+
36
+ export function getFormControlClass(
37
+ props: FormControlProps,
38
+ cssModule?: CSSModule
39
+ ) {
40
+ return mapToCssModules(getFormControlClassInternal(props), cssModule);
41
+ }
42
+
43
+ export function getInfoTextControlClass(
44
+ { valid, invalid }: ValidationProps,
45
+ cssModule?: CSSModule
46
+ ) {
47
+ return mapToCssModules(
48
+ classNames({
49
+ 'form-text': valid || invalid,
50
+ 'text-muted': !valid || invalid
51
+ }),
52
+ cssModule
53
+ );
54
+ }
55
+
56
+ export function getTag({
57
+ tag,
58
+ plaintext,
59
+ staticInput,
60
+ type = 'text'
61
+ }: Pick<InputProps, 'tag'> & TypeProps) {
62
+ if (tag) {
63
+ return tag;
64
+ }
65
+ if (['radio', 'checkbox'].indexOf(type) > -1) {
66
+ return 'input';
67
+ }
68
+ if (plaintext || staticInput) {
69
+ return 'p';
70
+ }
71
+ return 'input';
72
+ }
73
+
74
+ type InputClassesParams = ValidationProps &
75
+ Pick<
76
+ InputProps,
77
+ 'bsSize' | 'placeholder' | 'value' | 'label' | 'infoText' | 'normalized'
78
+ > & {
79
+ isFocused: boolean;
80
+ inputPassword?: boolean;
81
+ formControlClass?: string;
82
+ infoTextControlClass: string;
83
+ originalWrapperClass: InputProps['wrapperClassName'];
84
+ };
85
+
86
+ export function getClasses(
87
+ className: string | undefined,
88
+ {
89
+ isFocused,
90
+ valid,
91
+ invalid,
92
+ bsSize,
93
+ placeholder,
94
+ value,
95
+ label,
96
+ infoText,
97
+ normalized,
98
+ inputPassword,
99
+ formControlClass,
100
+ infoTextControlClass,
101
+ originalWrapperClass
102
+ }: InputClassesParams,
103
+ cssModule?: CSSModule
104
+ ) {
105
+ const hasPlainCondition = placeholder || label || infoText;
106
+ const baseCondition = hasPlainCondition && !normalized && !inputPassword;
107
+ const passwordOnlyCondition =
108
+ inputPassword && !hasPlainCondition && !normalized;
109
+ const normalizedOnlyCondition =
110
+ normalized && !hasPlainCondition && !inputPassword;
111
+
112
+ const classes = mapToCssModules(
113
+ classNames(
114
+ className,
115
+ {
116
+ 'is-invalid': invalid,
117
+ 'is-valid': valid,
118
+ [`form-control-${bsSize}`]: bsSize
119
+ },
120
+ formControlClass
121
+ ),
122
+ cssModule
123
+ );
124
+ const wrapperClass = mapToCssModules(
125
+ classNames(className, originalWrapperClass, 'form-group'),
126
+ cssModule
127
+ );
128
+ const infoTextClass = mapToCssModules(
129
+ classNames(
130
+ {
131
+ 'valid-feedback': valid,
132
+ 'invalid-feedback': invalid
133
+ },
134
+ infoTextControlClass
135
+ ),
136
+ cssModule
137
+ );
138
+
139
+ const inputClasses = mapToCssModules(
140
+ classNames(
141
+ classes,
142
+ !baseCondition && {
143
+ // we can model here only if stylings
144
+ 'form-control-plaintext': normalizedOnlyCondition,
145
+ 'form-control': passwordOnlyCondition,
146
+ 'input-password': passwordOnlyCondition,
147
+ 'focus--mouse': passwordOnlyCondition || normalizedOnlyCondition
148
+ }
149
+ ),
150
+ cssModule
151
+ );
152
+
153
+ const activeClass = mapToCssModules(
154
+ classNames({
155
+ active: isFocused || placeholder || value
156
+ }),
157
+ cssModule
158
+ );
159
+
160
+ return {
161
+ wrapperClass,
162
+ inputClasses,
163
+ activeClass,
164
+ infoTextClass
165
+ };
166
+ }
@@ -0,0 +1,65 @@
1
+ import React, { FC, HTMLAttributes, ElementType, ReactNode } from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ export interface LinkListProps extends HTMLAttributes<HTMLUListElement> {
5
+ /** Da utilizzare in caso di titolo principale della lista. Passare una componente React da mostrare come titolo */
6
+ header?: ReactNode;
7
+ /** Classi aggiuntive da usare per il componente lista del LinkList */
8
+ className?: string;
9
+ /** Classi aggiuntive da usare per il componente wrapper del LinkList */
10
+ wrapperClassName?: string;
11
+ /**
12
+ * Utilizzarlo in caso di utilizzo di componenti personalizzati per il wrapper della lista.
13
+ * Nota: viene ignorato quando usato in lista annidate.
14
+ * */
15
+ tag?: ElementType;
16
+ /** Quando abilitato gestisce una lista in cui ciascun elemento è composto da più componenti/elementi. */
17
+ multiline?: boolean;
18
+ /** Da utilizzare per una lista annidata */
19
+ sublist?: boolean;
20
+ /** Da utilizzare per una lista di avatar */
21
+ avatar?: boolean;
22
+ /** Quando attivo rimuove il componente contenitore della ListList. Utile per alcuni tipi di liste annidate. */
23
+ noWrapper?: boolean;
24
+ }
25
+
26
+ export const LinkList: FC<LinkListProps> = ({
27
+ className,
28
+ wrapperClassName,
29
+ tag = 'div',
30
+ multiline,
31
+ header,
32
+ sublist,
33
+ avatar,
34
+ noWrapper,
35
+ ...attributes
36
+ }) => {
37
+ const Tag = tag;
38
+ const wrapperClasses = classNames('link-list-wrapper', wrapperClassName, {
39
+ multiline: multiline
40
+ });
41
+ const classes = classNames(className, {
42
+ 'link-list': !sublist,
43
+ 'link-sublist': sublist,
44
+ 'avatar-group': avatar
45
+ });
46
+
47
+ if (noWrapper) {
48
+ return <ul {...attributes} className={classes} />;
49
+ }
50
+
51
+ if (sublist) {
52
+ return (
53
+ <>
54
+ {header}
55
+ <ul {...attributes} className={classes} />
56
+ </>
57
+ );
58
+ }
59
+ return (
60
+ <Tag className={wrapperClasses}>
61
+ {header}
62
+ <ul {...attributes} className={classes} />
63
+ </Tag>
64
+ );
65
+ };
@@ -0,0 +1,98 @@
1
+ import React, {
2
+ FC,
3
+ AnchorHTMLAttributes,
4
+ ElementType,
5
+ MouseEvent,
6
+ MouseEventHandler
7
+ } from 'react';
8
+ import classNames from 'classnames';
9
+
10
+ export interface LinkListItemProps
11
+ extends AnchorHTMLAttributes<HTMLAnchorElement> {
12
+ /** Indica se l'elemento è attivo o no */
13
+ active?: boolean;
14
+ /** Indica se l'elemento è disabilitato o no */
15
+ disabled?: boolean;
16
+ /** Indica se l'elemento è un titolo. */
17
+ header?: boolean;
18
+ /** Indica se l'elemento è un divisore */
19
+ divider?: boolean;
20
+ /** Utilizzarlo in caso di utilizzo di componenti personalizzati */
21
+ tag?: ElementType;
22
+ /** Classi aggiuntive da usare per il componente LinkListItem */
23
+ className?: string;
24
+ /** Classi aggiuntive da usare per l'elemento contenitore dell'item */
25
+ wrapperClassName?: string;
26
+ /** Indica il link a cui l'elemento deve puntare. */
27
+ href?: string;
28
+ /** Utilizzato per aumentare taglia/grandezza dell'elemento: può essere "medium" o "large". */
29
+ size?: 'medium' | 'large';
30
+ }
31
+
32
+ const handleDisabledOnClick = (e: MouseEvent<HTMLAnchorElement>) => {
33
+ e.preventDefault();
34
+ };
35
+
36
+ export const LinkListItem: FC<LinkListItemProps> = ({
37
+ className,
38
+ active,
39
+ disabled,
40
+ header,
41
+ divider,
42
+ href,
43
+ size,
44
+ tag = 'a',
45
+ wrapperClassName,
46
+ children,
47
+ ...attributes
48
+ }) => {
49
+ let Tag = tag;
50
+ const classes = classNames(
51
+ className,
52
+ {
53
+ active,
54
+ disabled,
55
+ header,
56
+ divider,
57
+ size
58
+ },
59
+ 'list-item'
60
+ );
61
+
62
+ // Prevent click event when disabled.
63
+ const handlers: { onClick?: MouseEventHandler<HTMLAnchorElement> } = {};
64
+ if (disabled) {
65
+ handlers.onClick = handleDisabledOnClick;
66
+ }
67
+
68
+ if (header) {
69
+ Tag = 'h3';
70
+ } else if (divider) {
71
+ Tag = 'span';
72
+ }
73
+
74
+ if (header && href) {
75
+ return (
76
+ <li className={wrapperClassName}>
77
+ <Tag>
78
+ <a
79
+ href={href || '#'}
80
+ {...attributes}
81
+ className={classes}
82
+ {...handlers}
83
+ >
84
+ {children}
85
+ </a>
86
+ </Tag>
87
+ </li>
88
+ );
89
+ }
90
+
91
+ return (
92
+ <li className={wrapperClassName}>
93
+ <Tag {...attributes} className={classes} href={href} {...handlers}>
94
+ {children}
95
+ </Tag>
96
+ </li>
97
+ );
98
+ };
@@ -0,0 +1,37 @@
1
+ import React, { FC, HTMLAttributes, useState } from 'react';
2
+ import { Navbar, NavbarBrand, NavbarToggler } from 'reactstrap';
3
+ import classNames from 'classnames';
4
+ import { Collapse } from '../Collapse/Collapse';
5
+ import { Icon } from '../Icon/Icon';
6
+ import { Nav } from '../Nav/Nav';
7
+
8
+ export interface MegamenuProps extends HTMLAttributes<HTMLDivElement> {
9
+ /** Eventuale brand da inserire sulla navbar */
10
+ brand?: NavbarBrand;
11
+ /** Classi aggiuntive da usare per il componente Nav */
12
+ className?: string;
13
+ }
14
+
15
+ export const Megamenu: FC<MegamenuProps> = ({
16
+ brand,
17
+ className,
18
+ children,
19
+ ...attributes
20
+ }) => {
21
+ const [openNav, setOpenNav] = useState(false);
22
+ const toggle = () => {
23
+ setOpenNav(!openNav);
24
+ };
25
+ const classes = classNames(className, 'has-megamenu');
26
+ return (
27
+ <Navbar className={classes} {...attributes}>
28
+ <NavbarToggler className='custom-navbar-toggler' onClick={toggle}>
29
+ <Icon icon='it-list' size='sm' />
30
+ </NavbarToggler>
31
+ {brand}
32
+ <Collapse isOpen={openNav} megamenu>
33
+ <Nav navbar>{children}</Nav>
34
+ </Collapse>
35
+ </Navbar>
36
+ );
37
+ };
@@ -0,0 +1,20 @@
1
+ import React, { FC, HTMLAttributes } from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ export interface MegamenuFooterProps extends HTMLAttributes<HTMLDivElement> {
5
+ /** Classi aggiuntive da usare per il componente Megamenu Footer */
6
+ className?: string;
7
+ }
8
+
9
+ export const MegamenuFooter: FC<MegamenuFooterProps> = ({
10
+ className,
11
+ children,
12
+ ...attributes
13
+ }) => {
14
+ const classes = classNames(className, 'it-megamenu-footer');
15
+ return (
16
+ <div className={classes} {...attributes}>
17
+ {children}
18
+ </div>
19
+ );
20
+ };