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.
- package/README.EN.md +35 -17
- package/README.md +34 -18
- package/package.json +152 -120
- package/src/Accordion/Accordion.tsx +30 -0
- package/src/Accordion/AccordionBody.tsx +127 -0
- package/src/Accordion/AccordionHeader.tsx +42 -0
- package/src/Alert/Alert.tsx +39 -0
- package/src/Avatar/AvatarContainer.tsx +22 -0
- package/src/Avatar/AvatarExtraText.tsx +19 -0
- package/src/Avatar/AvatarGroupContainer.tsx +23 -0
- package/src/Avatar/AvatarIcon.tsx +57 -0
- package/src/Avatar/AvatarPresence.tsx +24 -0
- package/src/Avatar/AvatarStatus.tsx +24 -0
- package/src/Avatar/AvatarWrapper.tsx +24 -0
- package/src/Badge/Badge.tsx +40 -0
- package/src/BottomNav/BottomNav.tsx +20 -0
- package/src/BottomNav/BottomNavItem.tsx +75 -0
- package/src/Breadcrumb/Breadcrumb.tsx +40 -0
- package/src/Button/Button.tsx +55 -0
- package/src/Callout/Callout.tsx +35 -0
- package/src/Callout/CalloutText.tsx +29 -0
- package/src/Callout/CalloutTitle.tsx +24 -0
- package/src/Card/Card.tsx +49 -0
- package/src/Card/CardBody.tsx +21 -0
- package/src/Card/CardCategory.tsx +48 -0
- package/src/Card/CardFooterCTA.tsx +19 -0
- package/src/Card/CardReadMore.tsx +35 -0
- package/src/Card/CardSignature.tsx +19 -0
- package/src/Card/CardTag.tsx +19 -0
- package/src/Card/CardTagsHeader.tsx +28 -0
- package/src/Card/CardText.tsx +19 -0
- package/src/Card/CardTitle.tsx +17 -0
- package/src/Chips/Chip.tsx +37 -0
- package/src/Chips/ChipLabel.tsx +19 -0
- package/src/Collapse/Collapse.tsx +100 -0
- package/src/CookieBar/CookieBar.tsx +19 -0
- package/src/CookieBar/CookieBarButton.tsx +27 -0
- package/src/CookieBar/CookieBarButtons.tsx +19 -0
- package/src/Dimmer/Dimmer.tsx +51 -0
- package/src/Dimmer/DimmerButtons.tsx +35 -0
- package/src/FontLoader/FontLoader.tsx +32 -0
- package/src/Forward/Forward.tsx +40 -0
- package/src/Grid/GridItem.tsx +23 -0
- package/src/Grid/GridItemText.tsx +20 -0
- package/src/Grid/GridItemTextWrapper.tsx +21 -0
- package/src/Grid/GridList.tsx +20 -0
- package/src/Grid/GridRow.tsx +20 -0
- package/src/Grid/index.ts +11 -0
- package/src/{components/Header/Header.js → Header/Header.tsx} +19 -24
- package/src/Header/HeaderBrand.tsx +90 -0
- package/src/Header/HeaderContent.tsx +42 -0
- package/src/Header/HeaderContext.tsx +9 -0
- package/src/Header/HeaderLinkZone.tsx +19 -0
- package/src/Header/HeaderRightZone.tsx +26 -0
- package/src/Header/HeaderSearch.tsx +33 -0
- package/src/Header/HeaderSocialsZone.tsx +26 -0
- package/src/Header/HeaderToggler.tsx +46 -0
- package/src/{components/Header/Headers.js → Header/Headers.tsx} +17 -22
- package/src/Hero/Hero.tsx +34 -0
- package/src/Hero/HeroBackground.tsx +25 -0
- package/src/Hero/HeroBody.tsx +21 -0
- package/src/Hero/HeroButton.tsx +19 -0
- package/src/Hero/HeroCategory.tsx +15 -0
- package/src/Hero/HeroTitle.tsx +16 -0
- package/src/Hero/index.ts +13 -0
- package/src/Icon/EmptyIcon.tsx +7 -0
- package/src/Icon/Icon.tsx +116 -0
- package/src/Icon/assets/ItArrowDown.tsx +9 -0
- package/src/Icon/assets/ItArrowDownCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowDownTriangle.tsx +9 -0
- package/src/Icon/assets/ItArrowLeft.tsx +9 -0
- package/src/Icon/assets/ItArrowLeftCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowLeftTriangle.tsx +9 -0
- package/src/Icon/assets/ItArrowRight.tsx +9 -0
- package/src/Icon/assets/ItArrowRightCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowRightTriangle.tsx +9 -0
- package/src/Icon/assets/ItArrowUp.tsx +9 -0
- package/src/Icon/assets/ItArrowUpCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowUpTriangle.tsx +9 -0
- package/src/Icon/assets/ItBan.tsx +9 -0
- package/src/Icon/assets/ItBehance.tsx +9 -0
- package/src/Icon/assets/ItBookmark.tsx +9 -0
- package/src/Icon/assets/ItBox.tsx +12 -0
- package/src/Icon/assets/ItBurger.tsx +9 -0
- package/src/Icon/assets/ItCalendar.tsx +9 -0
- package/src/Icon/assets/ItCamera.tsx +9 -0
- package/src/Icon/assets/ItCard.tsx +9 -0
- package/src/Icon/assets/ItChartLine.tsx +12 -0
- package/src/Icon/assets/ItCheck.tsx +9 -0
- package/src/Icon/assets/ItCheckCircle.tsx +9 -0
- package/src/Icon/assets/ItChevronLeft.tsx +8 -0
- package/src/Icon/assets/ItChevronRight.tsx +8 -0
- package/src/Icon/assets/ItClip.tsx +9 -0
- package/src/Icon/assets/ItClock.tsx +9 -0
- package/src/Icon/assets/ItClose.tsx +9 -0
- package/src/Icon/assets/ItCloseBig.tsx +9 -0
- package/src/Icon/assets/ItCloseCircle.tsx +9 -0
- package/src/Icon/assets/ItCodeCircle.tsx +9 -0
- package/src/Icon/assets/ItCollapse.tsx +8 -0
- package/src/Icon/assets/ItComment.tsx +9 -0
- package/src/Icon/assets/ItCopy.tsx +9 -0
- package/src/Icon/assets/ItDelete.tsx +12 -0
- package/src/Icon/assets/ItDesignersItalia.tsx +9 -0
- package/src/Icon/assets/ItDownload.tsx +9 -0
- package/src/Icon/assets/ItError.tsx +9 -0
- package/src/Icon/assets/ItExchangeCircle.tsx +9 -0
- package/src/Icon/assets/ItExpand.tsx +8 -0
- package/src/Icon/assets/ItExternalLink.tsx +9 -0
- package/src/Icon/assets/ItFacebook.tsx +9 -0
- package/src/Icon/assets/ItFacebookSquare.tsx +9 -0
- package/src/Icon/assets/ItFile.tsx +9 -0
- package/src/Icon/assets/ItFiles.tsx +9 -0
- package/src/Icon/assets/ItFlag.tsx +9 -0
- package/src/Icon/assets/ItFlickr.tsx +10 -0
- package/src/Icon/assets/ItFlickrSquare.tsx +9 -0
- package/src/Icon/assets/ItFolder.tsx +9 -0
- package/src/Icon/assets/ItFullscreen.tsx +11 -0
- package/src/Icon/assets/ItFunnel.tsx +9 -0
- package/src/Icon/assets/ItGithub.tsx +9 -0
- package/src/Icon/assets/ItHearing.tsx +9 -0
- package/src/Icon/assets/ItHelp.tsx +9 -0
- package/src/Icon/assets/ItHelpCircle.tsx +9 -0
- package/src/Icon/assets/ItHorn.tsx +9 -0
- package/src/Icon/assets/ItInbox.tsx +12 -0
- package/src/Icon/assets/ItInfoCircle.tsx +9 -0
- package/src/Icon/assets/ItInstagram.tsx +9 -0
- package/src/Icon/assets/ItKey.tsx +9 -0
- package/src/Icon/assets/ItLessCircle.tsx +12 -0
- package/src/Icon/assets/ItLink.tsx +9 -0
- package/src/Icon/assets/ItLinkedin.tsx +9 -0
- package/src/Icon/assets/ItLinkedinSquare.tsx +9 -0
- package/src/Icon/assets/ItList.tsx +9 -0
- package/src/Icon/assets/ItLock.tsx +12 -0
- package/src/Icon/assets/ItLocked.tsx +9 -0
- package/src/Icon/assets/ItMail.tsx +9 -0
- package/src/Icon/assets/ItMapMarker.tsx +9 -0
- package/src/Icon/assets/ItMapMarkerCircle.tsx +12 -0
- package/src/Icon/assets/ItMapMarkerMinus.tsx +9 -0
- package/src/Icon/assets/ItMapMarkerPlus.tsx +12 -0
- package/src/Icon/assets/ItMaximize.tsx +11 -0
- package/src/Icon/assets/ItMaximizeAlt.tsx +11 -0
- package/src/Icon/assets/ItMedium.tsx +9 -0
- package/src/Icon/assets/ItMediumSquare.tsx +9 -0
- package/src/Icon/assets/ItMinimize.tsx +11 -0
- package/src/Icon/assets/ItMinus.tsx +9 -0
- package/src/Icon/assets/ItMinusCircle.tsx +9 -0
- package/src/Icon/assets/ItMoreActions.tsx +9 -0
- package/src/Icon/assets/ItMoreItems.tsx +9 -0
- package/src/Icon/assets/ItNote.tsx +9 -0
- package/src/Icon/assets/ItOpenSource.tsx +9 -0
- package/src/Icon/assets/ItPa.tsx +9 -0
- package/src/Icon/assets/ItPasswordInvisible.tsx +9 -0
- package/src/Icon/assets/ItPasswordVisible.tsx +9 -0
- package/src/Icon/assets/ItPencil.tsx +9 -0
- package/src/Icon/assets/ItPiattaforme.tsx +10 -0
- package/src/Icon/assets/ItPin.tsx +9 -0
- package/src/Icon/assets/ItPlug.tsx +9 -0
- package/src/Icon/assets/ItPlus.tsx +9 -0
- package/src/Icon/assets/ItPlusCircle.tsx +9 -0
- package/src/Icon/assets/ItPresentation.tsx +9 -0
- package/src/Icon/assets/ItPrint.tsx +9 -0
- package/src/Icon/assets/ItRefresh.tsx +9 -0
- package/src/Icon/assets/ItRestore.tsx +9 -0
- package/src/Icon/assets/ItRss.tsx +11 -0
- package/src/Icon/assets/ItRssSquare.tsx +9 -0
- package/src/Icon/assets/ItSearch.tsx +9 -0
- package/src/Icon/assets/ItSettings.tsx +9 -0
- package/src/Icon/assets/ItShare.tsx +9 -0
- package/src/Icon/assets/ItSoftware.tsx +10 -0
- package/src/Icon/assets/ItStarFull.tsx +9 -0
- package/src/Icon/assets/ItStarOutline.tsx +9 -0
- package/src/Icon/assets/ItTeamDigitale.tsx +8 -0
- package/src/Icon/assets/ItTelegram.tsx +11 -0
- package/src/Icon/assets/ItTelephone.tsx +9 -0
- package/src/Icon/assets/ItTool.tsx +9 -0
- package/src/Icon/assets/ItTwitter.tsx +9 -0
- package/src/Icon/assets/ItTwitterSquare.tsx +9 -0
- package/src/Icon/assets/ItUnlocked.tsx +9 -0
- package/src/Icon/assets/ItUpload.tsx +9 -0
- package/src/Icon/assets/ItUser.tsx +9 -0
- package/src/Icon/assets/ItVideo.tsx +9 -0
- package/src/Icon/assets/ItWarning.tsx +9 -0
- package/src/Icon/assets/ItWarningCircle.tsx +9 -0
- package/src/Icon/assets/ItWhatsapp.tsx +9 -0
- package/src/Icon/assets/ItWhatsappSquare.tsx +10 -0
- package/src/Icon/assets/ItWifi.tsx +12 -0
- package/src/Icon/assets/ItYoutube.tsx +9 -0
- package/src/Icon/assets/ItZoomIn.tsx +9 -0
- package/src/Icon/assets/ItZoomOut.tsx +9 -0
- package/src/Icon/assets/index.tsx +504 -0
- package/src/Input/Input.tsx +342 -0
- package/src/Input/InputContainer.tsx +34 -0
- package/src/Input/TextArea.tsx +184 -0
- package/src/Input/TimeInput.tsx +303 -0
- package/src/Input/utils.tsx +166 -0
- package/src/LinkList/LinkList.tsx +65 -0
- package/src/LinkList/LinkListItem.tsx +98 -0
- package/src/Megamenu/Megamenu.tsx +37 -0
- package/src/Megamenu/MegamenuFooter.tsx +20 -0
- package/src/Megamenu/MegamenuHighlightColumn.tsx +33 -0
- package/src/Megamenu/MegamenuItem.tsx +27 -0
- package/src/Modal/Modal.tsx +79 -0
- package/src/Modal/ModalBody.tsx +11 -0
- package/src/Modal/ModalFooter.tsx +11 -0
- package/src/Modal/ModalHeader.tsx +70 -0
- package/src/Nav/Nav.tsx +56 -0
- package/src/Notification/Notification.tsx +60 -0
- package/src/Notification/NotificationContent.tsx +135 -0
- package/src/Notification/NotificationManager.tsx +65 -0
- package/src/Notification/core.tsx +46 -0
- package/src/Notification/index.ts +9 -0
- package/src/Notification/types.ts +12 -0
- package/src/Notification/usePosition.tsx +11 -0
- package/src/Pager/Pager.tsx +48 -0
- package/src/PasswordInput/PasswordInput.tsx +43 -0
- package/src/Progress/Progress.tsx +94 -0
- package/src/Rating/Rating.tsx +130 -0
- package/src/ResponsiveImage/ResponsiveImage.tsx +25 -0
- package/src/Section/Section.tsx +86 -0
- package/src/Select/Select.tsx +97 -0
- package/src/Select/shared.tsx +45 -0
- package/src/Sidebar/Sidebar.tsx +46 -0
- package/src/Skiplink/Skiplink.tsx +20 -0
- package/src/Skiplink/SkiplinkItem.tsx +29 -0
- package/src/Spinner/Spinner.tsx +55 -0
- package/src/Stepper/StepperContainer.tsx +30 -0
- package/src/Stepper/StepperContent.tsx +51 -0
- package/src/Stepper/StepperDots.tsx +21 -0
- package/src/Stepper/StepperHeader.tsx +19 -0
- package/src/Stepper/StepperHeaderElement.tsx +77 -0
- package/src/Stepper/StepperNav.tsx +19 -0
- package/src/ThumbNav/ThumbNav.tsx +37 -0
- package/src/ThumbNav/ThumbNavItem.tsx +35 -0
- package/src/Timeline/TimelinePin.tsx +67 -0
- package/src/Timeline/TimelineWrapper.tsx +19 -0
- package/src/Toggle/Toggle.tsx +29 -0
- package/src/Toolbar/Toolbar.tsx +28 -0
- package/src/Toolbar/ToolbarDividerItem.tsx +5 -0
- package/src/Toolbar/ToolbarItem.tsx +95 -0
- package/src/assets.d.ts +4 -0
- package/src/index.tsx +350 -0
- package/src/utils.tsx +26 -0
- package/.editorconfig +0 -18
- package/.eslintrc +0 -65
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -24
- package/AUTHORS +0 -3
- package/CODE_OF_CONDUCT.EN.md +0 -77
- package/CODE_OF_CONDUCT.md +0 -69
- package/dist/design-react-kit.cjs.js +0 -3698
- package/dist/design-react-kit.cjs.js.map +0 -1
- package/dist/design-react-kit.d.ts +0 -1704
- package/dist/design-react-kit.es.js +0 -3188
- package/dist/design-react-kit.es.js.map +0 -1
- package/dist/design-react-kit.full.js +0 -17596
- package/dist/design-react-kit.full.js.map +0 -1
- package/dist/design-react-kit.full.min.js +0 -2
- package/dist/design-react-kit.full.min.js.map +0 -1
- package/dist/design-react-kit.js +0 -13394
- package/dist/design-react-kit.js.map +0 -1
- package/dist/design-react-kit.min.js +0 -2
- package/dist/design-react-kit.min.js.map +0 -1
- package/src/Storyshots.test.js +0 -9
- package/src/components/Accordion/Accordion.js +0 -22
- package/src/components/Accordion/AccordionBody.js +0 -118
- package/src/components/Accordion/AccordionHeader.js +0 -37
- package/src/components/Autocomplete/Autocomplete.js +0 -255
- package/src/components/Avatar/AvatarContainer.js +0 -24
- package/src/components/Avatar/AvatarExtraText.js +0 -22
- package/src/components/Avatar/AvatarGroupContainer.js +0 -23
- package/src/components/Avatar/AvatarIcon.js +0 -32
- package/src/components/Avatar/AvatarPresence.js +0 -25
- package/src/components/Avatar/AvatarStatus.js +0 -25
- package/src/components/Avatar/AvatarWrapper.js +0 -25
- package/src/components/Badge/Badge.js +0 -28
- package/src/components/BottomNav/BottomNav.js +0 -27
- package/src/components/BottomNav/BottomNavItem.js +0 -69
- package/src/components/Button/Button.js +0 -26
- package/src/components/Callout/Callout.js +0 -33
- package/src/components/Callout/CalloutText.js +0 -37
- package/src/components/Callout/CalloutTitle.js +0 -27
- package/src/components/Card/Card.js +0 -50
- package/src/components/Card/CardCategory.js +0 -43
- package/src/components/Card/CardFooterCTA.js +0 -17
- package/src/components/Card/CardReadMore.js +0 -45
- package/src/components/Card/CardSignature.js +0 -17
- package/src/components/Card/CardTag.js +0 -23
- package/src/components/Card/CardTagsHeader.js +0 -21
- package/src/components/Chips/Chip.js +0 -50
- package/src/components/Chips/ChipLabel.js +0 -25
- package/src/components/Collapse/Collapse.js +0 -66
- package/src/components/CookieBar/CookieBar.js +0 -22
- package/src/components/CookieBar/CookieBarButton.js +0 -25
- package/src/components/CookieBar/CookieBarButtons.js +0 -23
- package/src/components/Dimmer/Dimmer.js +0 -38
- package/src/components/Dimmer/DimmerButtons.js +0 -35
- package/src/components/FontLoader/FontLoader.js +0 -22
- package/src/components/FormGroup/FormGroup.js +0 -137
- package/src/components/Forward/Forward.js +0 -32
- package/src/components/Header/HeaderBrand.js +0 -86
- package/src/components/Header/HeaderContent.js +0 -49
- package/src/components/Header/HeaderContext.js +0 -14
- package/src/components/Header/HeaderLinkZone.js +0 -24
- package/src/components/Header/HeaderRightZone.js +0 -33
- package/src/components/Header/HeaderSearch.js +0 -36
- package/src/components/Header/HeaderSocialsZone.js +0 -30
- package/src/components/Header/HeaderToggler.js +0 -50
- package/src/components/Hero/Hero.js +0 -10
- package/src/components/Icon/Icon.js +0 -42
- package/src/components/Input/Input.js +0 -261
- package/src/components/Input/InputContainer.js +0 -39
- package/src/components/Input/utils.js +0 -126
- package/src/components/LinkList/LinkList.js +0 -65
- package/src/components/LinkList/LinkListItem.js +0 -88
- package/src/components/Nav/Nav.js +0 -37
- package/src/components/Notification/Notification.js +0 -78
- package/src/components/Offcanvas/Offcanvas.js +0 -101
- package/src/components/Pager/Pager.js +0 -32
- package/src/components/PagerList/PagerList.js +0 -28
- package/src/components/PasswordInput/PasswordInput.js +0 -41
- package/src/components/PasswordMeter/PasswordMeter.js +0 -80
- package/src/components/Progress/Progress.js +0 -88
- package/src/components/Rating/Rating.js +0 -130
- package/src/components/Section/Section.js +0 -49
- package/src/components/Separator/Separator.js +0 -34
- package/src/components/Sidebar/Sidebar.js +0 -53
- package/src/components/Skiplink/Skiplink.js +0 -25
- package/src/components/Skiplink/SkiplinkItem.js +0 -25
- package/src/components/Spinner/Spinner.js +0 -65
- package/src/components/Stepper/StepperContainer.js +0 -33
- package/src/components/Stepper/StepperContent.js +0 -54
- package/src/components/Stepper/StepperDots.js +0 -27
- package/src/components/Stepper/StepperHeader.js +0 -27
- package/src/components/Stepper/StepperHeaderElement.js +0 -45
- package/src/components/Stepper/StepperNav.js +0 -27
- package/src/components/Table/Table.js +0 -68
- package/src/components/Timeline/TimelinePin.js +0 -59
- package/src/components/Timeline/TimelineWrapper.js +0 -21
- package/src/components/Toggle/Toggle.js +0 -27
- package/src/components/utils.js +0 -1
- package/src/index.js +0 -144
- package/static/favicons/android-chrome-192x192.png +0 -0
- package/static/favicons/android-chrome-512x512.png +0 -0
- package/static/favicons/apple-touch-icon.png +0 -0
- package/static/favicons/browserconfig.xml +0 -9
- package/static/favicons/favicon-16x16.png +0 -0
- package/static/favicons/favicon-32x32.png +0 -0
- package/static/favicons/favicon.ico +0 -0
- package/static/favicons/manifest.webmanifest +0 -21
- package/static/favicons/mstile-150x150.png +0 -0
- package/static/favicons/safari-pinned-tab.svg +0 -23
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { Col, Row } from 'reactstrap';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface MegamenuHCProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** Quanto abilitato gestisce il contenuto della colonna come una sezione che può contentere immagini, testo, ect. */
|
|
7
|
+
description?: boolean;
|
|
8
|
+
/** Classi aggiuntive da usare per il componente Megamenu Highlight Column */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export const MegamenuHighlightColumn: FC<MegamenuHCProps> = ({
|
|
12
|
+
description,
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
...attributes
|
|
16
|
+
}) => {
|
|
17
|
+
const classes = classNames(className, 'it-vertical', {
|
|
18
|
+
'it-description': description
|
|
19
|
+
});
|
|
20
|
+
return (
|
|
21
|
+
<Col {...attributes}>
|
|
22
|
+
<Row className='max-height-col'>
|
|
23
|
+
<Col className={classes}>
|
|
24
|
+
{description ? (
|
|
25
|
+
<div className='description-content'>{children}</div>
|
|
26
|
+
) : (
|
|
27
|
+
<>{children}</>
|
|
28
|
+
)}
|
|
29
|
+
</Col>
|
|
30
|
+
</Row>
|
|
31
|
+
</Col>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface MegamenuItemProps extends HTMLAttributes<HTMLUListElement> {
|
|
6
|
+
/** Etichetta del megamenu visibile all'interno della barra di navigazione */
|
|
7
|
+
itemName: string;
|
|
8
|
+
/** Classi aggiuntive da usare per il componente UncontrolledDropdown */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const MegamenuItem: FC<MegamenuItemProps> = ({
|
|
13
|
+
itemName,
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
...attributes
|
|
17
|
+
}) => {
|
|
18
|
+
const classes = classNames(className, 'megamenu');
|
|
19
|
+
return (
|
|
20
|
+
<UncontrolledDropdown nav tag='li' className={classes} {...attributes}>
|
|
21
|
+
<DropdownToggle caret nav>
|
|
22
|
+
{itemName}
|
|
23
|
+
</DropdownToggle>
|
|
24
|
+
<DropdownMenu positionFixed>{children}</DropdownMenu>
|
|
25
|
+
</UncontrolledDropdown>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { CSSModule, FadeProps, Modal as InnerModal } from 'reactstrap';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface ModalProps extends HTMLAttributes<HTMLElement> {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
/** Indica lo stato del modale. Valore di default: undefined. */
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
size?: string;
|
|
11
|
+
/** Funzione da chiamare quando l'utente clicca sul backdrop. Valore di default: undefined. */
|
|
12
|
+
toggle?: React.KeyboardEventHandler<any> | React.MouseEventHandler<any>;
|
|
13
|
+
keyboard?: boolean;
|
|
14
|
+
backdrop?: boolean | 'static';
|
|
15
|
+
/**
|
|
16
|
+
* Abilitare quando si vuole che solo il contenuto della modale sia scrollabile.
|
|
17
|
+
* Valore di default: undefined.
|
|
18
|
+
* */
|
|
19
|
+
scrollable?: boolean;
|
|
20
|
+
onEnter?: () => void;
|
|
21
|
+
onExit?: () => void;
|
|
22
|
+
onOpened?: () => void;
|
|
23
|
+
onClosed?: () => void;
|
|
24
|
+
cssModule?: CSSModule;
|
|
25
|
+
wrapClassName?: string;
|
|
26
|
+
modalClassName?: string;
|
|
27
|
+
backdropClassName?: string;
|
|
28
|
+
contentClassName?: string;
|
|
29
|
+
zIndex?: number | string;
|
|
30
|
+
fade?: boolean;
|
|
31
|
+
backdropTransition?: FadeProps;
|
|
32
|
+
modalTransition?: FadeProps;
|
|
33
|
+
centered?: boolean;
|
|
34
|
+
external?: React.ReactNode;
|
|
35
|
+
labelledBy?: string;
|
|
36
|
+
unmountOnClose?: boolean;
|
|
37
|
+
returnFocusAfterClose?: boolean;
|
|
38
|
+
container?: string | HTMLElement | React.RefObject<HTMLElement>;
|
|
39
|
+
innerRef?: React.Ref<HTMLElement>;
|
|
40
|
+
/** Abilitare quando si utilizza una icona nell'intestazione, al fine di formattare correttamente il modale. Valore di default: undefined. */
|
|
41
|
+
withIcon?: boolean;
|
|
42
|
+
/** Abilitare quando si utilizza una LinkList nell'intestazione, al fine di formattare correttamente il modale. Valore di default: undefined. */
|
|
43
|
+
withLinkList?: boolean;
|
|
44
|
+
/** Abilitare quando si vuole mostrare un breve messaggio di conferma. Valore di default: undefined. */
|
|
45
|
+
popConfirm?: boolean;
|
|
46
|
+
/** Abilitare quando si vuole mostrare un modale allineato a sinistra. Valore di default: undefined. */
|
|
47
|
+
align?: 'left' | 'right';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const Modal: FC<ModalProps> = ({
|
|
51
|
+
withIcon,
|
|
52
|
+
withLinkList,
|
|
53
|
+
popConfirm,
|
|
54
|
+
modalClassName,
|
|
55
|
+
align,
|
|
56
|
+
scrollable,
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}) => {
|
|
60
|
+
const isAligned = align != null && ['left', 'right'].includes(align);
|
|
61
|
+
const modalDialogClassnames = classnames(modalClassName, {
|
|
62
|
+
'alert-modal': withIcon,
|
|
63
|
+
'it-dialog-link-list': withLinkList,
|
|
64
|
+
'popconfirm-modal': popConfirm,
|
|
65
|
+
'it-dialog-scrollable': scrollable && isAligned
|
|
66
|
+
});
|
|
67
|
+
const modalClassnames = classnames(className, {
|
|
68
|
+
'modal-dialog-left': align === 'left',
|
|
69
|
+
'modal-dialog-right': align === 'right'
|
|
70
|
+
});
|
|
71
|
+
return (
|
|
72
|
+
<InnerModal
|
|
73
|
+
{...props}
|
|
74
|
+
scrollable={!isAligned && scrollable}
|
|
75
|
+
className={modalClassnames}
|
|
76
|
+
modalClassName={modalDialogClassnames}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { CSSModule, ModalBody as InnerModalBody } from 'reactstrap';
|
|
3
|
+
|
|
4
|
+
export interface ModalBodyProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
tag?: React.ElementType;
|
|
6
|
+
cssModule?: CSSModule;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ModalBody: FC<ModalBodyProps> = (props) => (
|
|
10
|
+
<InnerModalBody {...props} />
|
|
11
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { CSSModule, ModalFooter as InnerModalFooter } from 'reactstrap';
|
|
3
|
+
|
|
4
|
+
export interface ModalFooterProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
tag?: React.ElementType;
|
|
6
|
+
cssModule?: CSSModule;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ModalFooter: FC<ModalFooterProps> = (props) => (
|
|
10
|
+
<InnerModalFooter {...props} />
|
|
11
|
+
);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import { CSSModule, Util } from 'reactstrap';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Icon } from '../Icon/Icon';
|
|
5
|
+
// @ts-expect-error
|
|
6
|
+
const { mapToCssModules } = Util;
|
|
7
|
+
|
|
8
|
+
export interface ModalHeaderProps extends HTMLAttributes<HTMLElement> {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
cssModule?: CSSModule;
|
|
11
|
+
/** Componente che conterrà il nodo titolo. Valore di default: h5 */
|
|
12
|
+
tag?: React.ElementType;
|
|
13
|
+
/** Componente che contenitore per l'header. Valore di default: div. */
|
|
14
|
+
wrapTag?: React.ElementType;
|
|
15
|
+
/** Funzione da passare al tasto di chiusura nell'intestazione. Quando questa funzione non è presente il tasto di chiusura non viene mostrato. Valore di default: undefined */
|
|
16
|
+
toggle?: React.MouseEventHandler<any>;
|
|
17
|
+
/** Indica il nome dell'icona da utilizzare nel titolo. */
|
|
18
|
+
icon?: string;
|
|
19
|
+
/** Classi da aggiungere al nodo contenitore. */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Utilizzato per personalizzare il messaggio peer screen reader per il bottone di chiusura del modale. Valore di default: 'Close' */
|
|
22
|
+
closeAriaLabel?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const ModalHeader: FC<ModalHeaderProps> = ({
|
|
26
|
+
icon,
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
Util,
|
|
30
|
+
toggle,
|
|
31
|
+
tag: Tag = 'h5',
|
|
32
|
+
wrapTag: WrapTag = 'div',
|
|
33
|
+
closeAriaLabel = 'Close',
|
|
34
|
+
close,
|
|
35
|
+
charCode = 215,
|
|
36
|
+
cssModule,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
39
|
+
const classes = mapToCssModules(
|
|
40
|
+
classNames(className, 'modal-header'),
|
|
41
|
+
cssModule
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
let CloseButton;
|
|
45
|
+
|
|
46
|
+
if (!close && toggle) {
|
|
47
|
+
var closeIcon =
|
|
48
|
+
typeof charCode === 'number' ? String.fromCharCode(charCode) : charCode;
|
|
49
|
+
CloseButton = (
|
|
50
|
+
<button
|
|
51
|
+
type='button'
|
|
52
|
+
onClick={toggle}
|
|
53
|
+
className={mapToCssModules('close', cssModule)}
|
|
54
|
+
aria-label={closeAriaLabel}
|
|
55
|
+
>
|
|
56
|
+
<span aria-hidden>{closeIcon}</span>
|
|
57
|
+
</button>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<WrapTag {...props} className={classes}>
|
|
63
|
+
{icon != null ? <Icon icon={icon} /> : null}
|
|
64
|
+
<Tag className={mapToCssModules('modal-title', cssModule)}>
|
|
65
|
+
{children}
|
|
66
|
+
</Tag>
|
|
67
|
+
{close || CloseButton}
|
|
68
|
+
</WrapTag>
|
|
69
|
+
);
|
|
70
|
+
};
|
package/src/Nav/Nav.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import { Nav as NavBase } from 'reactstrap';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface NavProps extends HTMLAttributes<HTMLUListElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Renderizza i componenti NavItem al suo interno come tab.
|
|
8
|
+
*/
|
|
9
|
+
tabs?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Renderizza i componenti NavItem al suo interno come pills.
|
|
12
|
+
*/
|
|
13
|
+
pills?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Renderizza i componenti NavItem al suo interno come card.
|
|
16
|
+
*/
|
|
17
|
+
card?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Se utilizzata all'interno di una navbar, impostarlo su `true`. In caso di Header Nav, impostarlo a `true`.
|
|
20
|
+
*/
|
|
21
|
+
navbar?: boolean;
|
|
22
|
+
/** Se abilitato tutti i NavItem all'interno avranno la stessa larghezza */
|
|
23
|
+
justified?: boolean;
|
|
24
|
+
/** Se abilitato i NavItem all'intero occuperanno tutto lo spazio disponibile */
|
|
25
|
+
fill?: boolean;
|
|
26
|
+
/** Da utilizzare per rendere il componente Nav verticale. Viene abilitato automaticamente in versione mobile. Valori possibili sono `true`, `false` o `"xs"` */
|
|
27
|
+
vertical?: boolean | 'xs';
|
|
28
|
+
/** Da utilizzare per cambiare l'allineamento all'interno della Nav. Valori possibili sono `"center"` o `"end"` per posizionare il contenuto a centro o sulla destra. */
|
|
29
|
+
horizontal?: 'center' | 'end';
|
|
30
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
31
|
+
tag?: ElementType;
|
|
32
|
+
/** Classi aggiuntive da usare per il componente Nav */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Adds ability to incorporate secondary nav items */
|
|
35
|
+
secondary?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Nav: FC<NavProps> = ({
|
|
39
|
+
className,
|
|
40
|
+
tag = 'ul',
|
|
41
|
+
vertical = false,
|
|
42
|
+
secondary,
|
|
43
|
+
...attributes
|
|
44
|
+
}) => {
|
|
45
|
+
const classes = classNames(className, {
|
|
46
|
+
'navbar-secondary': secondary
|
|
47
|
+
});
|
|
48
|
+
return (
|
|
49
|
+
<NavBase
|
|
50
|
+
className={classes}
|
|
51
|
+
tag={tag}
|
|
52
|
+
vertical={vertical}
|
|
53
|
+
{...attributes}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { CSSProperties, FC, useEffect } from 'react';
|
|
2
|
+
import { ToastProps, useToast, cssTransition } from 'react-toastify';
|
|
3
|
+
import { NotificationToastProps } from './NotificationContent';
|
|
4
|
+
import { NotificationCommonProps } from './types';
|
|
5
|
+
|
|
6
|
+
export type NotificationProps = Omit<ToastProps, 'transition'> &
|
|
7
|
+
NotificationCommonProps &
|
|
8
|
+
NotificationToastProps;
|
|
9
|
+
|
|
10
|
+
const dummyTransition = cssTransition({ enter: '', exit: '' });
|
|
11
|
+
|
|
12
|
+
export const Notification: FC<NotificationProps> = (props) => {
|
|
13
|
+
const { toastRef, eventHandlers } = useToast({
|
|
14
|
+
...props,
|
|
15
|
+
transition: dummyTransition
|
|
16
|
+
});
|
|
17
|
+
const {
|
|
18
|
+
children,
|
|
19
|
+
autoClose,
|
|
20
|
+
onClick,
|
|
21
|
+
role,
|
|
22
|
+
toastId,
|
|
23
|
+
deleteToast,
|
|
24
|
+
closeToast,
|
|
25
|
+
isIn
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const customStyle: CSSProperties = {
|
|
29
|
+
display: isIn ? 'block' : 'none'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!isIn) deleteToast();
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [isIn]);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let timer: NodeJS.Timeout | number;
|
|
39
|
+
if (autoClose) {
|
|
40
|
+
timer = setTimeout(() => closeToast(), autoClose);
|
|
41
|
+
}
|
|
42
|
+
return () => {
|
|
43
|
+
if (timer != null) {
|
|
44
|
+
clearTimeout(Number(timer));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, [autoClose, closeToast]);
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
id={toastId as string}
|
|
51
|
+
onClick={onClick}
|
|
52
|
+
{...eventHandlers}
|
|
53
|
+
style={customStyle}
|
|
54
|
+
ref={toastRef}
|
|
55
|
+
{...(isIn && { role: role })}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactChild } from 'react';
|
|
2
|
+
import { Button } from '../Button/Button';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Icon } from '../Icon/Icon';
|
|
5
|
+
import { usePosition } from './usePosition';
|
|
6
|
+
import { NotificationCommonProps } from './types';
|
|
7
|
+
|
|
8
|
+
export interface NotificationToastProps {
|
|
9
|
+
/** Indica quale icona affiancare al titolo. */
|
|
10
|
+
icon?: string;
|
|
11
|
+
/** Lo stato corrente della notifica (modifica il colore delle icone e bordo) */
|
|
12
|
+
state?: 'success' | 'error' | 'info' | 'warning';
|
|
13
|
+
/** Il titolo della notifica */
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type NotificationElementProps = {
|
|
18
|
+
closeToast?: () => void;
|
|
19
|
+
toastProps?: any;
|
|
20
|
+
title: string;
|
|
21
|
+
body?: ReactChild;
|
|
22
|
+
options: NotificationOptions;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getBorderStyleFix = (fix: NotificationCommonProps['fix']) => {
|
|
26
|
+
const borderReset = ['top', 'bottom', 'right', 'left']
|
|
27
|
+
.filter((curPosition) =>
|
|
28
|
+
fix === 'left' ? curPosition !== 'right' : curPosition !== 'left'
|
|
29
|
+
)
|
|
30
|
+
.map(
|
|
31
|
+
(borderPosition) =>
|
|
32
|
+
`border${
|
|
33
|
+
borderPosition[0].toUpperCase() + borderPosition.substring(1)
|
|
34
|
+
}` as 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight'
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const customStyle: CSSProperties = {};
|
|
38
|
+
for (const borderPos of borderReset) {
|
|
39
|
+
customStyle[borderPos] = 'none';
|
|
40
|
+
}
|
|
41
|
+
return customStyle;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type NotificationOptions = NotificationCommonProps &
|
|
45
|
+
Pick<NotificationToastProps, 'icon' | 'state'> & {
|
|
46
|
+
/* Quando abilitato mostra un pulsante per la chiusura del toast prima della chiusura naturale. Default: `false`. */
|
|
47
|
+
dismissable?: boolean;
|
|
48
|
+
/* Una funzione invocata all'apertura della notifica */
|
|
49
|
+
onOpen?: <T = NotificationElementProps>(props: T) => void;
|
|
50
|
+
/* Una funziona invocata alla chiusura nella notifica */
|
|
51
|
+
onClose?: <T = NotificationElementProps>(props: T) => void;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
function pickIcon(state: NotificationToastProps['state']) {
|
|
55
|
+
switch (state) {
|
|
56
|
+
case 'error':
|
|
57
|
+
return 'it-close-circle';
|
|
58
|
+
case 'info':
|
|
59
|
+
return 'it-info-circle';
|
|
60
|
+
case 'warning':
|
|
61
|
+
return 'it-error';
|
|
62
|
+
case 'success':
|
|
63
|
+
return 'it-check-circle';
|
|
64
|
+
default:
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function NotificationElement({
|
|
70
|
+
closeToast,
|
|
71
|
+
toastProps,
|
|
72
|
+
title,
|
|
73
|
+
body,
|
|
74
|
+
options
|
|
75
|
+
}: NotificationElementProps) {
|
|
76
|
+
const globalFix = usePosition();
|
|
77
|
+
const { icon: userIcon, state, fix: localFix, dismissable } = options;
|
|
78
|
+
const fixPosition =
|
|
79
|
+
localFix == null && globalFix ? globalFix : localFix || globalFix;
|
|
80
|
+
const { autoClose, style } = toastProps;
|
|
81
|
+
const content = typeof body === 'string' ? <p>{body}</p> : body;
|
|
82
|
+
const icon = userIcon || pickIcon(state);
|
|
83
|
+
|
|
84
|
+
const borderFixes = getBorderStyleFix(fixPosition);
|
|
85
|
+
|
|
86
|
+
const wrapperClass = classNames('notification', state, {
|
|
87
|
+
[`${fixPosition}-fix`]: fixPosition,
|
|
88
|
+
'with-icon': icon,
|
|
89
|
+
dismissable: dismissable || !autoClose
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Need to override some toast styling here
|
|
93
|
+
const customStyle: CSSProperties = {
|
|
94
|
+
...style,
|
|
95
|
+
...borderFixes,
|
|
96
|
+
// force a display as the notification class has a "display: none" set
|
|
97
|
+
display: 'block'
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className={wrapperClass} style={customStyle}>
|
|
102
|
+
<h5>
|
|
103
|
+
{title}
|
|
104
|
+
{icon ? <Icon icon={icon} /> : null}
|
|
105
|
+
</h5>
|
|
106
|
+
{content}
|
|
107
|
+
{(!autoClose || dismissable) && (
|
|
108
|
+
<Button className='notification-close' onClick={closeToast}>
|
|
109
|
+
<Icon icon='it-close' />
|
|
110
|
+
<span className='sr-only'>Chiudi notifica: {title}</span>
|
|
111
|
+
</Button>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Internal use only. Exported for documentation purposes.
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
export const createNotification = (
|
|
122
|
+
title: string,
|
|
123
|
+
body: ReactChild | undefined,
|
|
124
|
+
options: NotificationOptions,
|
|
125
|
+
closeToast?: () => void,
|
|
126
|
+
toastProps?: any
|
|
127
|
+
) => (
|
|
128
|
+
<NotificationElement
|
|
129
|
+
title={title}
|
|
130
|
+
body={body}
|
|
131
|
+
options={options}
|
|
132
|
+
closeToast={closeToast}
|
|
133
|
+
toastProps={toastProps}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { cssTransition, useToastContainer } from 'react-toastify';
|
|
3
|
+
import { Notification } from './Notification';
|
|
4
|
+
import { getBorderStyleFix } from './NotificationContent';
|
|
5
|
+
import { NotificationCommonProps } from './types';
|
|
6
|
+
import { PositionContext } from './usePosition';
|
|
7
|
+
|
|
8
|
+
const KitTransition = cssTransition({
|
|
9
|
+
enter: `d-block`,
|
|
10
|
+
exit: `d-none`,
|
|
11
|
+
appendPosition: false
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export interface NotificationManagerProps extends NotificationCommonProps {
|
|
15
|
+
/* Stili inline da applicare al container */
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const NotificationManager = (props: NotificationManagerProps) => {
|
|
20
|
+
const customStyle: CSSProperties = {
|
|
21
|
+
...props.style,
|
|
22
|
+
...getBorderStyleFix(props.fix)
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const hookProps = {
|
|
26
|
+
autoClose: props.duration ?? 6000,
|
|
27
|
+
closeOnClick: props.closeOnClick ?? true,
|
|
28
|
+
hideProgressBar: true,
|
|
29
|
+
transition: KitTransition,
|
|
30
|
+
rtl: false,
|
|
31
|
+
pauseOnHover: true,
|
|
32
|
+
pauseOnFocusLoss: true,
|
|
33
|
+
newestOnTop: false, // TODO: sort this out
|
|
34
|
+
draggable: false,
|
|
35
|
+
role: 'alert',
|
|
36
|
+
style: customStyle,
|
|
37
|
+
enableMultiContainer: props.containerId != null // enable multi container when an explicit id is passed
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const { getToastToRender, containerRef, isToastActive } = useToastContainer(
|
|
41
|
+
hookProps
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const { containerId, style, fix } = props;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<PositionContext.Provider value={fix}>
|
|
48
|
+
<div ref={containerRef} id={containerId as string} style={style}>
|
|
49
|
+
{getToastToRender((_, toastList) => {
|
|
50
|
+
return toastList.map(({ content, props: toastProps }) => {
|
|
51
|
+
return (
|
|
52
|
+
<Notification
|
|
53
|
+
{...toastProps}
|
|
54
|
+
isIn={isToastActive(toastProps.toastId)}
|
|
55
|
+
key={`notification-${toastProps.key}`}
|
|
56
|
+
>
|
|
57
|
+
{content}
|
|
58
|
+
</Notification>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
})}
|
|
62
|
+
</div>
|
|
63
|
+
</PositionContext.Provider>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ReactChild } from 'react';
|
|
2
|
+
import { toast } from 'react-toastify';
|
|
3
|
+
import { createNotification } from './NotificationContent';
|
|
4
|
+
import type { NotificationOptions } from './NotificationContent';
|
|
5
|
+
import { NotificationId } from './types';
|
|
6
|
+
|
|
7
|
+
export function notify(
|
|
8
|
+
title: string,
|
|
9
|
+
options?: NotificationOptions
|
|
10
|
+
): NotificationId;
|
|
11
|
+
|
|
12
|
+
export function notify(
|
|
13
|
+
title: string,
|
|
14
|
+
body: ReactChild,
|
|
15
|
+
options?: NotificationOptions
|
|
16
|
+
): NotificationId;
|
|
17
|
+
|
|
18
|
+
export function notify(
|
|
19
|
+
title: string,
|
|
20
|
+
bodyOrOptions?: ReactChild | NotificationOptions,
|
|
21
|
+
options?: NotificationOptions
|
|
22
|
+
): NotificationId {
|
|
23
|
+
let body: ReactChild | undefined = isReactChild(bodyOrOptions)
|
|
24
|
+
? bodyOrOptions
|
|
25
|
+
: undefined;
|
|
26
|
+
const safeOptions = isReactChild(bodyOrOptions)
|
|
27
|
+
? { ...options }
|
|
28
|
+
: bodyOrOptions || {};
|
|
29
|
+
const NotificationContent = createNotification(title, body, safeOptions);
|
|
30
|
+
const internalOptions = {
|
|
31
|
+
...safeOptions,
|
|
32
|
+
autoClose: safeOptions.duration
|
|
33
|
+
};
|
|
34
|
+
return toast(NotificationContent, internalOptions) as NotificationId;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isReactChild(
|
|
38
|
+
el: ReactChild | NotificationOptions | undefined
|
|
39
|
+
): el is ReactChild {
|
|
40
|
+
return (
|
|
41
|
+
el != null &&
|
|
42
|
+
(typeof el === 'string' || typeof el === 'number' || 'type' in el)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
notify.dismiss = (id?: NotificationId) => toast.dismiss(id);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @internal */
|
|
2
|
+
export { createNotification } from './NotificationContent';
|
|
3
|
+
export { NotificationManager } from './NotificationManager';
|
|
4
|
+
export { notify } from './core';
|
|
5
|
+
|
|
6
|
+
export type { NotificationProps } from './Notification';
|
|
7
|
+
export type { NotificationManagerProps } from './NotificationManager';
|
|
8
|
+
export type { NotificationOptions } from './NotificationContent';
|
|
9
|
+
export type { NotificationId } from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface NotificationCommonProps {
|
|
2
|
+
/* Utilizzare questo attributo per gestire più container */
|
|
3
|
+
containerId?: string | number;
|
|
4
|
+
/* Indica per quanto tempo la notifica rimarrà visibile prima di sparire. Quanto impostato a 0ms la notifica rimarrà aperta a tempo indefinito e verrà mostrato anche il tasto di chiusura. Il valore di default è 6000 ms. */
|
|
5
|
+
duration?: number;
|
|
6
|
+
/* Indica il posizionamento fisso della notifica. Non è abilitato di default. */
|
|
7
|
+
fix?: 'top' | 'bottom' | 'right' | 'left';
|
|
8
|
+
/* Quando abilitato permette di chiudere la notifica con un click. Default: `true`. */
|
|
9
|
+
closeOnClick?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type NotificationId = string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import { NotificationCommonProps } from './types';
|
|
3
|
+
|
|
4
|
+
export const PositionContext = createContext<NotificationCommonProps['fix']>(
|
|
5
|
+
undefined
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export function usePosition() {
|
|
9
|
+
const context = useContext(PositionContext);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface PagerProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Etichetta di descrizione del contenuto del componente Pager */
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
8
|
+
tag?: ElementType;
|
|
9
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati per la l'elemento lista interno */
|
|
10
|
+
listTag?: ElementType;
|
|
11
|
+
/** Classi aggiuntive da usare per il componente Pager */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Classi aggiuntive da usare per il componente di lista interno Pager */
|
|
14
|
+
listClassName?: string;
|
|
15
|
+
/** Utilizzare questo attributo per indicare il numero totale di pagine */
|
|
16
|
+
total?: { ariaLabel: string; label: string };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Pager: FC<PagerProps> = ({
|
|
20
|
+
className,
|
|
21
|
+
tag = 'nav',
|
|
22
|
+
listTag: ListTag = 'ul',
|
|
23
|
+
listClassName,
|
|
24
|
+
children,
|
|
25
|
+
total,
|
|
26
|
+
...attributes
|
|
27
|
+
}) => {
|
|
28
|
+
const Tag = tag;
|
|
29
|
+
const classes = classNames(className, 'pagination-wrapper', {
|
|
30
|
+
'pagination-total': total
|
|
31
|
+
});
|
|
32
|
+
const listClasses = classNames(listClassName, 'pagination');
|
|
33
|
+
const { ariaLabel, label } = total || {};
|
|
34
|
+
const totalAriaLabel = ariaLabel ? (
|
|
35
|
+
<span className='sr-only'>{ariaLabel}</span>
|
|
36
|
+
) : null;
|
|
37
|
+
return (
|
|
38
|
+
<Tag className={classes} {...attributes}>
|
|
39
|
+
<ListTag className={listClasses}>{children}</ListTag>
|
|
40
|
+
{total ? (
|
|
41
|
+
<p>
|
|
42
|
+
{totalAriaLabel}
|
|
43
|
+
{label}
|
|
44
|
+
</p>
|
|
45
|
+
) : null}
|
|
46
|
+
</Tag>
|
|
47
|
+
);
|
|
48
|
+
};
|