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,43 @@
|
|
|
1
|
+
import React, { Component, Fragment, HTMLAttributes } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Input } from '../Input/Input';
|
|
4
|
+
|
|
5
|
+
export interface PasswordInputProps extends HTMLAttributes<HTMLInputElement> {
|
|
6
|
+
type: 'password' | HTMLInputElement['type'];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface PasswordInputState {
|
|
10
|
+
showPassword: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class PasswordInput extends Component<
|
|
14
|
+
PasswordInputProps,
|
|
15
|
+
PasswordInputState
|
|
16
|
+
> {
|
|
17
|
+
state = {
|
|
18
|
+
showPassword: false
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
onPasswordToggle = () => {
|
|
22
|
+
this.setState((prevState) => ({
|
|
23
|
+
showPassword: !prevState.showPassword
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
render() {
|
|
28
|
+
const { showPassword } = this.state;
|
|
29
|
+
const { type = 'password', ...rest } = this.props;
|
|
30
|
+
|
|
31
|
+
const className = classNames('btn-eye', {
|
|
32
|
+
'eye-off': showPassword,
|
|
33
|
+
'eye-on': !showPassword
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Fragment>
|
|
38
|
+
<span className={className} onClick={this.onPasswordToggle} />
|
|
39
|
+
<Input {...rest} type={showPassword ? 'text' : (type as 'password')} />
|
|
40
|
+
</Fragment>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import isNumber from 'is-number';
|
|
4
|
+
import { logError } from '../utils';
|
|
5
|
+
|
|
6
|
+
export interface ProgressProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
8
|
+
tag?: ElementType;
|
|
9
|
+
/**
|
|
10
|
+
* Classi aggiuntive da usare per il componente contenitore del Progress
|
|
11
|
+
* Per replicare il comportamento precedente, in cui `className` veniva applicato anche al wrapper,
|
|
12
|
+
* passare `true`.
|
|
13
|
+
* */
|
|
14
|
+
wrapperClassName?: string | true;
|
|
15
|
+
/** Classi aggiuntive da usare per il componente interno del Progress */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Valore corrente (numerico) */
|
|
18
|
+
value?: number | string;
|
|
19
|
+
/** Etichetta con testo per indicare il progresso corrente da mostrare ai dispositivi screen reader */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Quando non è possibile stabilire una percentuale di progressione utilizzare una Progress Bar di tipo indeterminato */
|
|
22
|
+
indeterminate?: boolean;
|
|
23
|
+
/** Le varianti di colore definite in Bootstrap Italia */
|
|
24
|
+
color?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Progress: FC<ProgressProps> = ({
|
|
28
|
+
wrapperClassName,
|
|
29
|
+
className,
|
|
30
|
+
tag = 'div',
|
|
31
|
+
value,
|
|
32
|
+
label,
|
|
33
|
+
indeterminate = false,
|
|
34
|
+
color,
|
|
35
|
+
role = 'progressbar',
|
|
36
|
+
...attributes
|
|
37
|
+
}) => {
|
|
38
|
+
const Tag = tag;
|
|
39
|
+
if (!isNumber(value) && !indeterminate) {
|
|
40
|
+
logError(`The passed "value" is not a valid number. You passed "${value}"`);
|
|
41
|
+
}
|
|
42
|
+
const numericValue = Number(value);
|
|
43
|
+
const wrapperClasses = classNames('progress-bar-wrapper');
|
|
44
|
+
const secondaryWrapperClasses = classNames(
|
|
45
|
+
wrapperClassName === true ? className : wrapperClassName,
|
|
46
|
+
'progress',
|
|
47
|
+
{
|
|
48
|
+
'progress-indeterminate': indeterminate,
|
|
49
|
+
'progress-color': color
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
const classes = classNames(className, 'progress-bar', {
|
|
53
|
+
[`bg-${color}`]: color
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (label && numericValue) {
|
|
57
|
+
return (
|
|
58
|
+
<Tag className={wrapperClasses}>
|
|
59
|
+
<div className='progress-bar-label'>
|
|
60
|
+
<span className='sr-only'>{label}</span>
|
|
61
|
+
{numericValue + '%'}
|
|
62
|
+
</div>
|
|
63
|
+
<Tag className={secondaryWrapperClasses}>
|
|
64
|
+
<div
|
|
65
|
+
{...attributes}
|
|
66
|
+
className={classes}
|
|
67
|
+
role='progressbar'
|
|
68
|
+
style={{ width: numericValue + '%' }}
|
|
69
|
+
aria-valuenow={numericValue}
|
|
70
|
+
aria-valuemin={0}
|
|
71
|
+
aria-valuemax={100}
|
|
72
|
+
/>
|
|
73
|
+
</Tag>
|
|
74
|
+
</Tag>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Tag className={secondaryWrapperClasses}>
|
|
80
|
+
<div className='progress-bar-label'>
|
|
81
|
+
<span className='sr-only'>{label}</span>
|
|
82
|
+
</div>
|
|
83
|
+
<div
|
|
84
|
+
{...attributes}
|
|
85
|
+
className={classes}
|
|
86
|
+
role='progressbar'
|
|
87
|
+
style={{ width: numericValue + '%' }}
|
|
88
|
+
aria-valuenow={numericValue}
|
|
89
|
+
aria-valuemin={0}
|
|
90
|
+
aria-valuemax={100}
|
|
91
|
+
/>
|
|
92
|
+
</Tag>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React, { Fragment, FC, ReactNode } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { FormGroup, Label } from 'reactstrap';
|
|
5
|
+
import { Input } from '../Input/Input';
|
|
6
|
+
import type { InputProps } from '../Input/Input';
|
|
7
|
+
import { Icon } from '../Icon/Icon';
|
|
8
|
+
import { noop } from '../utils';
|
|
9
|
+
|
|
10
|
+
type UnusedProps =
|
|
11
|
+
| 'bsSize'
|
|
12
|
+
| 'size'
|
|
13
|
+
| 'static'
|
|
14
|
+
| 'plaintext'
|
|
15
|
+
| 'normalized'
|
|
16
|
+
| 'addon'
|
|
17
|
+
| 'placeholder'
|
|
18
|
+
| 'label'
|
|
19
|
+
| 'value'
|
|
20
|
+
| 'type';
|
|
21
|
+
export interface RatingProps extends Omit<InputProps, UnusedProps> {
|
|
22
|
+
/** La lista di 5 id, per ciascun elemento intero del Rating. La lista deve essere ordinata dal rating 1 al rating 5. */
|
|
23
|
+
inputs: string[];
|
|
24
|
+
/** Il campo "label" è impostato di default su "Valuta ${n} stelle su 5", ma può essere personalizzato con questa funzione che riceve il numero input come argomento `function (n: number) => string`. */
|
|
25
|
+
labelTemplate?: (value: 1 | 2 | 3 | 4 | 5) => string;
|
|
26
|
+
/** Da utilizzare in caso legenda principale del Rating. Passare una componente React da mostrare come legenda (all'interno del tag `<legend>`). È possibile mostrare la leggenda solo ai dispositivi screen reader */
|
|
27
|
+
legend?: ReactNode | { content: ReactNode; srOnly: boolean };
|
|
28
|
+
/** Parametro name da dare all'input */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Classi aggiuntive da usare per il componente wrapper del Rating */
|
|
31
|
+
wrapperClassName?: string;
|
|
32
|
+
/** Classi aggiuntive da usare per ciascun elemento all'interno del componente Rating */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Callback chiamata ad ogni cambio di valore di rating. Il nuovo valore ed il name verranno passati: `function (n, name) => void` */
|
|
35
|
+
onChangeRating?: (value: 1 | 2 | 3 | 4 | 5 | number, name: string) => void;
|
|
36
|
+
/** Rende il componente read-only */
|
|
37
|
+
readOnly?: boolean;
|
|
38
|
+
/** Il valore corrente del componente: deve essere compreso tra 1 e 5 */
|
|
39
|
+
value?: 1 | 2 | 3 | 4 | 5 | number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const isCustomLegendObject = (
|
|
43
|
+
legend: ReactNode | { content: ReactNode; srOnly: boolean }
|
|
44
|
+
): legend is { content: ReactNode; srOnly: boolean } => {
|
|
45
|
+
return legend != null && typeof legend === 'object' && 'content' in legend;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Rating: FC<RatingProps> = ({
|
|
49
|
+
className,
|
|
50
|
+
inputs,
|
|
51
|
+
legend,
|
|
52
|
+
name,
|
|
53
|
+
readOnly,
|
|
54
|
+
value,
|
|
55
|
+
wrapperClassName,
|
|
56
|
+
labelTemplate = (value: 1 | 2 | 3 | 4 | 5) => `Valuta ${value} stelle su 5`,
|
|
57
|
+
onChangeRating = noop,
|
|
58
|
+
...attributes
|
|
59
|
+
}) => {
|
|
60
|
+
// Input data
|
|
61
|
+
// On the DOM we have to go from 5 to 1
|
|
62
|
+
const safeInputs = (inputs || []).reverse();
|
|
63
|
+
|
|
64
|
+
// Fields
|
|
65
|
+
const labelFn = labelTemplate;
|
|
66
|
+
|
|
67
|
+
const onChange = readOnly ? noop : onChangeRating;
|
|
68
|
+
|
|
69
|
+
const wrapperClasses = classNames(wrapperClassName, {
|
|
70
|
+
'rating-read-only': readOnly,
|
|
71
|
+
'rating-label': legend
|
|
72
|
+
});
|
|
73
|
+
const fieldClasses = classNames(className);
|
|
74
|
+
const extraFieldAttrs = readOnly ? { 'aria-hidden': true } : {};
|
|
75
|
+
|
|
76
|
+
// Legend
|
|
77
|
+
const isLegendString = typeof legend === 'string';
|
|
78
|
+
|
|
79
|
+
let legendClass: string = '';
|
|
80
|
+
let legendText: ReactNode = legend as string;
|
|
81
|
+
|
|
82
|
+
if (isCustomLegendObject(legend)) {
|
|
83
|
+
legendClass = classNames({
|
|
84
|
+
'sr-only': legend.srOnly
|
|
85
|
+
});
|
|
86
|
+
legendText = legend.content;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const legendContent =
|
|
90
|
+
isCustomLegendObject(legend) || isLegendString ? (
|
|
91
|
+
<legend className={legendClass}>{legendText}</legend>
|
|
92
|
+
) : (
|
|
93
|
+
legend
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<FormGroup
|
|
98
|
+
cssModule={{ 'form-group': 'rating' }}
|
|
99
|
+
tag='fieldset'
|
|
100
|
+
className={wrapperClasses}
|
|
101
|
+
{...attributes}
|
|
102
|
+
>
|
|
103
|
+
{legend && legendContent}
|
|
104
|
+
{safeInputs.map((id, i) => {
|
|
105
|
+
const currentValue = (5 - i) as 1 | 2 | 3 | 4 | 5;
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Fragment key={id}>
|
|
109
|
+
<Input
|
|
110
|
+
type='radio'
|
|
111
|
+
id={id}
|
|
112
|
+
name={name}
|
|
113
|
+
value={String(currentValue)}
|
|
114
|
+
cssModule={{ 'form-control': ' ' }}
|
|
115
|
+
className={fieldClasses}
|
|
116
|
+
onChange={() => onChange(currentValue, name)}
|
|
117
|
+
checked={value === currentValue}
|
|
118
|
+
disabled={readOnly}
|
|
119
|
+
{...extraFieldAttrs}
|
|
120
|
+
/>
|
|
121
|
+
<Label className='full' for={id}>
|
|
122
|
+
<Icon icon='it-star-full' size='sm' />
|
|
123
|
+
<span className='sr-only'>{labelFn(currentValue)}</span>
|
|
124
|
+
</Label>
|
|
125
|
+
</Fragment>
|
|
126
|
+
);
|
|
127
|
+
})}
|
|
128
|
+
</FormGroup>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ResponsiveImageProps extends HTMLAttributes<HTMLImageElement> {
|
|
4
|
+
/** Un testo alternativo per descrivere l'immagine mostrata */
|
|
5
|
+
alt: string;
|
|
6
|
+
/** L'URI dell'immagine da mostrare */
|
|
7
|
+
src: string;
|
|
8
|
+
/** Il titolo dell'immagine */
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ResponsiveImage: FC<ResponsiveImageProps> = ({
|
|
13
|
+
alt,
|
|
14
|
+
...attributes
|
|
15
|
+
}) => {
|
|
16
|
+
return (
|
|
17
|
+
<div className='img-responsive-wrapper'>
|
|
18
|
+
<div className='img-responsive'>
|
|
19
|
+
<div className='img-wrapper'>
|
|
20
|
+
<img {...attributes} alt={alt} />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ReactChild } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { notifyDeprecation } from '../utils';
|
|
4
|
+
|
|
5
|
+
export interface SectionProps extends HTMLAttributes<HTMLElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Classi aggiuntive da usare per il contenitore più esterno
|
|
8
|
+
* Per replicare il comportamento precedente, in cui `className` veniva applicato anche al wrapper,
|
|
9
|
+
* passare `true`.
|
|
10
|
+
* */
|
|
11
|
+
wrapperClassName?: string | true;
|
|
12
|
+
/** Classi aggiuntive da usare per il contenitore più interno */
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Colore utilizzato per lo sfondo del componente Section.
|
|
16
|
+
* In caso di `primary` o `neutral` si consiglia di applicare la classe `.white-color` al contenuto per garantire la leggibilità dei testi.
|
|
17
|
+
* */
|
|
18
|
+
color?: 'primary' | 'neutral' | 'muted' | string;
|
|
19
|
+
/**
|
|
20
|
+
* Indicare l'URL dell'immagine da utilizzare come sfondo della sezione.
|
|
21
|
+
*/
|
|
22
|
+
image?: string;
|
|
23
|
+
/** Il contenuto della sezione */
|
|
24
|
+
children?: ReactChild | ReactChild[];
|
|
25
|
+
/** Quando abilitato applica lo sfondo di tipo "neutral" al componente.
|
|
26
|
+
* @deprecated. Utilizzare `color="neutral"`
|
|
27
|
+
*/
|
|
28
|
+
neutral?: boolean;
|
|
29
|
+
/** Quando abilitato applica lo sfondo di tipo "muted" al componente.
|
|
30
|
+
* @deprecated. Utilizzare `color="muted"`
|
|
31
|
+
*/
|
|
32
|
+
muted?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Section: FC<SectionProps> = ({
|
|
36
|
+
color,
|
|
37
|
+
image,
|
|
38
|
+
wrapperClassName,
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
neutral,
|
|
42
|
+
muted,
|
|
43
|
+
...rest
|
|
44
|
+
}) => {
|
|
45
|
+
const classes = classNames(
|
|
46
|
+
'section',
|
|
47
|
+
wrapperClassName === true ? className : wrapperClassName,
|
|
48
|
+
{
|
|
49
|
+
[`section-${color}`]: color,
|
|
50
|
+
'section-image': image
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (neutral || muted) {
|
|
55
|
+
notifyDeprecation(
|
|
56
|
+
`Please use the prop "color" instead of the "${
|
|
57
|
+
neutral ? 'neutral' : 'muted'
|
|
58
|
+
}" for the Section component.`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// have them separated from the classes above or these will conflict with the color prop
|
|
63
|
+
// concatenate them at the end. Worst case a duplicate class will appear
|
|
64
|
+
const deprecatedClasses = classNames({
|
|
65
|
+
'section-neutral': neutral,
|
|
66
|
+
'section-muted': muted
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const innerClasses = classNames('section-content', className);
|
|
70
|
+
|
|
71
|
+
const styleClass = {
|
|
72
|
+
backgroundImageClass: image ? { backgroundImage: `url(${image})` } : {}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
className={`${classes}${
|
|
78
|
+
deprecatedClasses ? ' ' + deprecatedClasses : ''
|
|
79
|
+
}`}
|
|
80
|
+
style={styleClass.backgroundImageClass}
|
|
81
|
+
{...rest}
|
|
82
|
+
>
|
|
83
|
+
<div className={innerClasses}>{children}</div>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { FC, ReactElement } from 'react';
|
|
2
|
+
import SelectBase, { components } from 'react-select';
|
|
3
|
+
import { Icon } from '../Icon/Icon';
|
|
4
|
+
import type {
|
|
5
|
+
Props as SelectBaseProps,
|
|
6
|
+
IndicatorProps,
|
|
7
|
+
OptionTypeBase,
|
|
8
|
+
GroupTypeBase,
|
|
9
|
+
OptionProps
|
|
10
|
+
} from 'react-select';
|
|
11
|
+
import { styles } from './shared';
|
|
12
|
+
|
|
13
|
+
export interface SelectProps<
|
|
14
|
+
OptionType extends OptionTypeBase,
|
|
15
|
+
IsMulti extends boolean,
|
|
16
|
+
GroupType extends GroupTypeBase<OptionType>
|
|
17
|
+
> extends SelectBaseProps<OptionType, IsMulti, GroupType> {
|
|
18
|
+
icon?: boolean;
|
|
19
|
+
clearText?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const DropdownIndicator = <
|
|
23
|
+
OptionType extends OptionTypeBase,
|
|
24
|
+
IsMulti extends boolean,
|
|
25
|
+
GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
|
|
26
|
+
>(
|
|
27
|
+
props: IndicatorProps<OptionType, IsMulti, GroupType>
|
|
28
|
+
) => {
|
|
29
|
+
return (
|
|
30
|
+
<components.DropdownIndicator {...props}>
|
|
31
|
+
<Icon icon='it-arrow-down-triangle' aria-hidden />
|
|
32
|
+
</components.DropdownIndicator>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const Option = <
|
|
37
|
+
OptionType extends OptionTypeBase,
|
|
38
|
+
IsMulti extends boolean,
|
|
39
|
+
GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
|
|
40
|
+
>(
|
|
41
|
+
props: OptionProps<OptionType, IsMulti, GroupType>
|
|
42
|
+
) => {
|
|
43
|
+
return (
|
|
44
|
+
<div className='select-pill text-primary'>
|
|
45
|
+
<components.Option {...props} />
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const CustomClearText: FC<{ clearText: string }> = ({ clearText }) => (
|
|
51
|
+
<>{clearText}</>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export const Select = <
|
|
55
|
+
OptionType extends OptionTypeBase = { label: string; value: string },
|
|
56
|
+
IsMulti extends boolean = false,
|
|
57
|
+
GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
|
|
58
|
+
>({
|
|
59
|
+
clearText = 'Annulla',
|
|
60
|
+
icon = false,
|
|
61
|
+
...props
|
|
62
|
+
}: SelectProps<OptionType, IsMulti, GroupType>): ReactElement<
|
|
63
|
+
SelectProps<OptionType, IsMulti, GroupType>
|
|
64
|
+
> => {
|
|
65
|
+
// @TODO: move it outside when migrating to hooks
|
|
66
|
+
const ClearIndicator = <
|
|
67
|
+
OptionType extends OptionTypeBase,
|
|
68
|
+
IsMulti extends boolean,
|
|
69
|
+
GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
|
|
70
|
+
>(
|
|
71
|
+
clearIndicatorProps: IndicatorProps<OptionType, IsMulti, GroupType>
|
|
72
|
+
) => {
|
|
73
|
+
const {
|
|
74
|
+
children = <CustomClearText clearText={clearText} />,
|
|
75
|
+
innerProps: { ref, ...restInnerProps }
|
|
76
|
+
} = clearIndicatorProps;
|
|
77
|
+
return (
|
|
78
|
+
<div className='select-pill text-primary' {...restInnerProps} ref={ref}>
|
|
79
|
+
<div style={{ padding: '0px 5px' }}>{children}</div>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const selectComponents = {
|
|
85
|
+
...props.components,
|
|
86
|
+
Option,
|
|
87
|
+
DropdownIndicator,
|
|
88
|
+
IndicatorSeparator: null
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
if (props.isClearable) {
|
|
92
|
+
selectComponents.ClearIndicator = ClearIndicator;
|
|
93
|
+
}
|
|
94
|
+
return (
|
|
95
|
+
<SelectBase {...props} components={selectComponents} styles={styles} />
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const black = '#000';
|
|
2
|
+
const primary = '#06c';
|
|
3
|
+
const primaryDark = '#435a70';
|
|
4
|
+
const primaryDarker = '#17324d';
|
|
5
|
+
|
|
6
|
+
// Types here depend of react-select internal emotion dep + more parametric stuff
|
|
7
|
+
// @TODO: fix it this way for now, will review later on
|
|
8
|
+
export const styles = {
|
|
9
|
+
container: (provided: any) => ({ ...provided, height: '2.5rem' }),
|
|
10
|
+
control: (provided: any) => ({
|
|
11
|
+
...provided,
|
|
12
|
+
height: '2.5rem',
|
|
13
|
+
borderRadius: '0',
|
|
14
|
+
borderLeft: 'none',
|
|
15
|
+
borderRight: 'none',
|
|
16
|
+
borderTop: 'none',
|
|
17
|
+
borderBottom: `solid ${primaryDark} 1px`,
|
|
18
|
+
boxShadow: 'none',
|
|
19
|
+
'&:hover': { borderBottom: `solid ${primaryDark} 1.25px` } // border style on hover
|
|
20
|
+
}),
|
|
21
|
+
dropdownIndicator: (provided: any) => ({
|
|
22
|
+
...provided,
|
|
23
|
+
fill: primaryDark
|
|
24
|
+
}),
|
|
25
|
+
option: (provided: any, { isDisabled, isFocused, isSelected }: any) => ({
|
|
26
|
+
...provided,
|
|
27
|
+
background: 'white',
|
|
28
|
+
textDecoration: isFocused || isSelected ? 'underline' : 'none',
|
|
29
|
+
color: isSelected ? primaryDarker : primary,
|
|
30
|
+
cursor: isDisabled ? 'not-allowed' : 'pointer'
|
|
31
|
+
}),
|
|
32
|
+
placeholder: (provided: any) => ({
|
|
33
|
+
...provided,
|
|
34
|
+
fill: primaryDark
|
|
35
|
+
}),
|
|
36
|
+
singleValue: (provided: any) => ({
|
|
37
|
+
...provided,
|
|
38
|
+
color: black,
|
|
39
|
+
fontWeight: 'bold'
|
|
40
|
+
}),
|
|
41
|
+
valueContainer: (provided: any) => ({
|
|
42
|
+
...provided,
|
|
43
|
+
height: '2.5rem'
|
|
44
|
+
})
|
|
45
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface SidebarProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
6
|
+
tag?: ElementType;
|
|
7
|
+
/** Classi aggiuntive da usare per il componente Sidebar */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Indica se il componente Sideebar corrente è di tipo annidato o no */
|
|
10
|
+
secondary?: boolean;
|
|
11
|
+
/** Quando attivo aggiunge una linea separatrice a sinistra */
|
|
12
|
+
left?: boolean;
|
|
13
|
+
/** Quando attivo aggiunge una linea separatrice a destra */
|
|
14
|
+
right?: boolean;
|
|
15
|
+
/** Quando attivo cambia il tema del componente Sidebar rendendola scura */
|
|
16
|
+
dark?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Sidebar: FC<SidebarProps> = ({
|
|
20
|
+
className,
|
|
21
|
+
tag = 'div',
|
|
22
|
+
secondary = false,
|
|
23
|
+
left = false,
|
|
24
|
+
right = false,
|
|
25
|
+
dark = false,
|
|
26
|
+
...attributes
|
|
27
|
+
}) => {
|
|
28
|
+
const Tag = tag;
|
|
29
|
+
const wrapperClasses = classNames('sidebar-wrapper', className, {
|
|
30
|
+
'it-line-left-side': left,
|
|
31
|
+
'it-line-right-side': right,
|
|
32
|
+
'theme-dark': dark
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const wrapperClassesLinkList = classNames('sidebar-linklist-wrapper', {
|
|
36
|
+
'linklist-secondary': secondary
|
|
37
|
+
});
|
|
38
|
+
if (secondary) {
|
|
39
|
+
return <Tag {...attributes} className={wrapperClassesLinkList} />;
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
|
+
<Tag className={wrapperClasses}>
|
|
43
|
+
<Tag {...attributes} className={wrapperClassesLinkList} />
|
|
44
|
+
</Tag>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface SkiplinkProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
6
|
+
tag?: ElementType;
|
|
7
|
+
/** Classi aggiuntive da usare per il componente Skiplink */
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Skiplink: FC<SkiplinkProps> = ({
|
|
12
|
+
className,
|
|
13
|
+
tag = 'div',
|
|
14
|
+
...attributes
|
|
15
|
+
}) => {
|
|
16
|
+
const Tag = tag;
|
|
17
|
+
const classes = classNames(className, 'skiplinks');
|
|
18
|
+
|
|
19
|
+
return <Tag className={classes} {...attributes} />;
|
|
20
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { FC, ElementType, AnchorHTMLAttributes } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface SkiplinkItemProps
|
|
5
|
+
extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
7
|
+
tag?: ElementType;
|
|
8
|
+
/** Classi aggiuntive da usare per il componente Skiplink */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Abilitare questo attributo per renderizzare lo SkipLinkItem al focus */
|
|
11
|
+
focusable?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SkiplinkItem: FC<SkiplinkItemProps> = ({
|
|
15
|
+
className,
|
|
16
|
+
tag = 'a',
|
|
17
|
+
focusable = true,
|
|
18
|
+
...attributes
|
|
19
|
+
}) => {
|
|
20
|
+
const Tag = tag;
|
|
21
|
+
const classes = classNames(className, 'sr-only', {
|
|
22
|
+
'sr-only-focusable': focusable
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Add an extra href for focusable if the user passes an onClick rather than href prop
|
|
26
|
+
const extraHref = attributes.onClick ? { href: '#' } : {};
|
|
27
|
+
|
|
28
|
+
return <Tag className={classes} {...attributes} {...extraHref} />;
|
|
29
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface SpinnerProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
6
|
+
tag?: ElementType;
|
|
7
|
+
/** Classi aggiuntive da usare per il componente Spinner */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Utilizzato per indicare lo stato attivo di caricamento (animato) */
|
|
10
|
+
active?: boolean;
|
|
11
|
+
/** Utilizzato per ottenere la versione ridotta del componente Spinner */
|
|
12
|
+
small?: boolean;
|
|
13
|
+
/** Utilizzato per ottenere una animazione alternativa in fase di caricamento */
|
|
14
|
+
double?: boolean;
|
|
15
|
+
/** Etichetta con testo da mostrare ai dispositivi screen reader */
|
|
16
|
+
label?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Spinner: FC<SpinnerProps> = ({
|
|
20
|
+
className,
|
|
21
|
+
tag = 'span',
|
|
22
|
+
active = false,
|
|
23
|
+
small = false,
|
|
24
|
+
double = false,
|
|
25
|
+
label = 'Caricamento',
|
|
26
|
+
...attributes
|
|
27
|
+
}) => {
|
|
28
|
+
const Tag = tag;
|
|
29
|
+
const wrapperClasses = classNames('progress-spinner', {
|
|
30
|
+
'progress-spinner-active': active,
|
|
31
|
+
'size-sm': small,
|
|
32
|
+
'progress-spinner-double': double
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const classes = classNames(className, 'sr-only');
|
|
36
|
+
if (double) {
|
|
37
|
+
return (
|
|
38
|
+
<Tag className={wrapperClasses}>
|
|
39
|
+
<div className='progress-spinner-inner' />
|
|
40
|
+
<div className='progress-spinner-inner' />
|
|
41
|
+
<Tag {...attributes} className={classes}>
|
|
42
|
+
{label}
|
|
43
|
+
</Tag>
|
|
44
|
+
</Tag>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Tag className={wrapperClasses}>
|
|
50
|
+
<Tag {...attributes} className={classes}>
|
|
51
|
+
{label}
|
|
52
|
+
</Tag>
|
|
53
|
+
</Tag>
|
|
54
|
+
);
|
|
55
|
+
};
|