UNPKG

design-react-kit

Version:

Componenti React per Bootstrap 5

1 lines 19.5 kB
{"version":3,"sources":["../../src/Pager/Pager.tsx","../../src/index.ts","../../src/track-focus.js"],"sourcesContent":["import React, { FC, HTMLAttributes, ElementType } from 'react';\nimport classNames from 'classnames';\nimport { PagerItem } from '..';\n\nexport interface PagerProps extends HTMLAttributes<HTMLElement> {\n /** Etichetta di descrizione del contenuto del componente Pager */\n 'aria-label': string;\n /** Utilizzarlo in caso di utilizzo di componenti personalizzati */\n tag?: ElementType;\n /** Utilizzarlo in caso di utilizzo di componenti personalizzati per la l'elemento lista interno */\n listTag?: ElementType;\n /** Classi aggiuntive da usare per il componente Pager */\n className?: string;\n /** Classi aggiuntive da usare per il componente di lista interno Pager */\n listClassName?: string;\n /** Utilizzare questo attributo per indicare il numero totale di pagine */\n total?: { ariaLabel: string; label: string };\n testId?: string;\n}\n\nexport const Pager: FC<PagerProps> = ({\n className,\n tag = 'nav',\n listTag: ListTag = 'ul',\n listClassName,\n children,\n total,\n testId,\n ...attributes\n}) => {\n const Tag = tag;\n const classes = classNames(className, 'pagination-wrapper', {\n 'pagination-total': total\n });\n const listClasses = classNames(listClassName, 'pagination');\n const { ariaLabel, label } = total || {};\n const totalAriaLabel = ariaLabel ? <span className='visually-hidden'>{ariaLabel}</span> : null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const listChildren = React.Children.toArray(children).filter((child: any) => child.type === PagerItem);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const extraChildren = React.Children.toArray(children).filter((child: any)=> child.type !== PagerItem);\n\n // listChildren?.forEach(child => {\n // console.log(child)\n // })\n\n return (\n <Tag className={classes} {...attributes} data-testid={testId}>\n <ListTag className={listClasses}>{listChildren}</ListTag>\n {extraChildren}\n {total ? (\n <p>\n {totalAriaLabel}\n {label}\n </p>\n ) : null}\n </Tag>\n );\n};\n","export {\n BreadcrumbItem,\n ButtonGroup,\n ButtonToolbar,\n CardColumns,\n CardDeck,\n CardFooter,\n CardGroup,\n CardHeader,\n CardImg,\n CardImgOverlay,\n CardLink,\n CardSubtitle,\n Col,\n Container,\n Fade,\n Form,\n FormFeedback,\n FormGroup,\n FormText,\n InputGroup,\n InputGroupText,\n Label,\n ListGroup,\n ListGroupItem,\n ListGroupItemHeading,\n ListGroupItemText,\n Media,\n Navbar,\n NavbarBrand,\n NavbarToggler,\n NavItem,\n NavLink,\n PaginationItem as PagerItem,\n PaginationLink as PagerLink,\n Popover,\n PopoverBody,\n PopoverHeader,\n Row,\n Table,\n Tooltip,\n UncontrolledAlert,\n UncontrolledCollapse,\n UncontrolledTooltip,\n Util\n} from 'reactstrap';\n\nexport { TabContainer, TabContent, TabPane } from 'react-bootstrap';\nexport { Accordion } from './Accordion/Accordion';\nexport { AccordionBody } from './Accordion/AccordionBody';\nexport { AccordionHeader } from './Accordion/AccordionHeader';\nexport { AccordionItem } from './Accordion/AccordionItem';\nexport { Alert } from './Alert/Alert';\nexport { Autocomplete } from './Autocomplete/Autocomplete';\nexport { AvatarContainer } from './Avatar/AvatarContainer';\nexport { AvatarExtraText } from './Avatar/AvatarExtraText';\nexport { AvatarGroupContainer } from './Avatar/AvatarGroupContainer';\nexport { AvatarIcon } from './Avatar/AvatarIcon';\nexport { AvatarPresence } from './Avatar/AvatarPresence';\nexport { AvatarStatus } from './Avatar/AvatarStatus';\nexport { AvatarWrapper } from './Avatar/AvatarWrapper';\nexport { BackToTop } from './BackToTop/BackToTop';\nexport { Badge } from './Badge/Badge';\nexport { BottomNav } from './BottomNav/BottomNav';\nexport { BottomNavItem } from './BottomNav/BottomNavItem';\nexport { Breadcrumb } from './Breadcrumb/Breadcrumb';\nexport { Button } from './Button/Button';\nexport { Callout } from './Callout/Callout';\nexport { CalloutMoreFooter } from './Callout/CalloutMoreFooter';\nexport { CalloutText } from './Callout/CalloutText';\nexport { CalloutTitle } from './Callout/CalloutTitle';\nexport { Card } from './Card/Card';\nexport { CardBody } from './Card/CardBody';\nexport { CardCategory } from './Card/CardCategory';\nexport { CardFooterCTA } from './Card/CardFooterCTA';\nexport { CardReadMore } from './Card/CardReadMore';\nexport { CardSignature } from './Card/CardSignature';\nexport { CardTag } from './Card/CardTag';\nexport { CardTagsHeader } from './Card/CardTagsHeader';\nexport { CardText } from './Card/CardText';\nexport { CardTitle } from './Card/CardTitle';\nexport { Carousel } from './Carousel/Carousel';\nexport { CarouselSlide } from './Carousel/CarouselSlide';\nexport { Chip } from './Chips/Chip';\nexport { ChipLabel } from './Chips/ChipLabel';\nexport { Collapse } from './Collapse/Collapse';\nexport { Dimmer } from './Dimmer/Dimmer';\nexport { DimmerButtons } from './Dimmer/DimmerButtons';\nexport { Dropdown } from './Dropdown/Dropdown';\nexport { DropdownMenu } from './Dropdown/DropdownMenu';\nexport { DropdownToggle } from './Dropdown/DropdownToggle';\nexport { FontLoader, useFontLoader } from './FontLoader/FontLoader';\nexport { Forward } from './Forward/Forward';\nexport { GoBack } from './GoBack/GoBack';\nexport { GridItem, GridItemText, GridItemTextWrapper, GridList, GridRow } from './Grid/index';\nexport { Header } from './Header/Header';\nexport { HeaderBrand } from './Header/HeaderBrand';\nexport { HeaderContent } from './Header/HeaderContent';\nexport { HeaderLinkZone } from './Header/HeaderLinkZone';\nexport { HeaderRightZone } from './Header/HeaderRightZone';\nexport { Headers } from './Header/Headers';\nexport { HeaderSearch } from './Header/HeaderSearch';\nexport { HeaderSocialsZone } from './Header/HeaderSocialsZone';\nexport { HeaderToggler } from './Header/HeaderToggler';\nexport { Hero, HeroBackground, HeroBody, HeroButton, HeroCategory, HeroTitle } from './Hero/index';\nexport { clearIconCache, Icon, iconsList as icons, preloadIcons } from './Icon/Icon';\nexport { Input } from './Input/Input';\nexport { InputContainer } from './Input/InputContainer';\nexport { TextArea } from './Input/TextArea';\nexport { LinkList } from './LinkList/LinkList';\nexport { LinkListItem } from './LinkList/LinkListItem';\nexport { List } from './List/List';\nexport { ListItem } from './List/ListItem';\nexport { MegamenuFooter } from './Megamenu/MegamenuFooter';\nexport { MegamenuHighlightColumn } from './Megamenu/MegamenuHighlightColumn';\nexport { MegamenuItem } from './Megamenu/MegamenuItem';\nexport { Modal } from './Modal/Modal';\nexport { ModalBody } from './Modal/ModalBody';\nexport { ModalFooter } from './Modal/ModalFooter';\nexport { ModalHeader } from './Modal/ModalHeader';\nexport { Nav } from './Nav/Nav';\nexport { useNavScroll } from './NavScroll/index';\nexport { createNotification, NotificationManager, notify } from './Notification/index';\nexport { Pager } from './Pager/Pager';\nexport { Progress } from './Progress/Progress';\nexport { Rating } from './Rating/Rating';\nexport { ResponsiveImage } from './ResponsiveImage/ResponsiveImage';\nexport { Section } from './Section/Section';\nexport { Select } from './Select/Select';\nexport { Sidebar } from './Sidebar/Sidebar';\nexport { Skiplink } from './Skiplink/Skiplink';\nexport { SkiplinkItem } from './Skiplink/SkiplinkItem';\nexport { Spinner } from './Spinner/Spinner';\nexport { StepperContainer } from './Stepper/StepperContainer';\nexport { StepperContent } from './Stepper/StepperContent';\nexport { StepperDots } from './Stepper/StepperDots';\nexport { StepperHeader } from './Stepper/StepperHeader';\nexport { StepperHeaderElement } from './Stepper/StepperHeaderElement';\nexport { StepperNav } from './Stepper/StepperNav';\nexport { TabNav } from './Tab/TabNav';\nexport { TabNavItem } from './Tab/TabNavItem';\nexport { TabNavLink } from './Tab/TabNavLink';\nexport { ThumbNav } from './ThumbNav/ThumbNav';\nexport { ThumbNavItem } from './ThumbNav/ThumbNavItem';\nexport { TimelinePin } from './Timeline/TimelinePin';\nexport { Timeline } from './Timeline/TimelineWrapper';\nexport { Toggle } from './Toggle/Toggle';\nexport { Toolbar } from './Toolbar/Toolbar';\nexport { ToolbarDividerItem } from './Toolbar/ToolbarDividerItem';\nexport { ToolbarItem } from './Toolbar/ToolbarItem';\nexport { Transfer } from './Transfer/Transfer';\nexport { Upload } from './Upload/Upload';\nexport { UploadDragNdrop } from './Upload/UploadDragNdrop';\nexport { UploadList } from './Upload/UploadList';\nexport { UploadListItem } from './Upload/UploadListItem';\nexport { Video } from './Video/Video';\n\n// Types\nexport type { AccordionProps } from './Accordion/Accordion';\nexport type { AccordionBodyProps } from './Accordion/AccordionBody';\nexport type { AccordionHeaderProps } from './Accordion/AccordionHeader';\nexport type { AlertProps } from './Alert/Alert';\nexport type { AvatarContainerProps } from './Avatar/AvatarContainer';\nexport type { AvatarExtraTextProps } from './Avatar/AvatarExtraText';\nexport type { AvatarGroupContainerProps } from './Avatar/AvatarGroupContainer';\nexport type { AvatarIconProps } from './Avatar/AvatarIcon';\nexport type { AvatarPresenceProps } from './Avatar/AvatarPresence';\nexport type { AvatarStatusProps } from './Avatar/AvatarStatus';\nexport type { AvatarWrapperProps } from './Avatar/AvatarWrapper';\nexport type { BadgeProps } from './Badge/Badge';\nexport type { BottomNavProps } from './BottomNav/BottomNav';\nexport type { BottomNavItemProps } from './BottomNav/BottomNavItem';\nexport type { BreadcrumbProps } from './Breadcrumb/Breadcrumb';\nexport type { ButtonProps } from './Button/Button';\nexport type { CalloutProps } from './Callout/Callout';\nexport type { CalloutTextProps } from './Callout/CalloutText';\nexport type { CalloutTitleProps } from './Callout/CalloutTitle';\nexport type { CardProps } from './Card/Card';\nexport type { CardBodyProps } from './Card/CardBody';\nexport type { CardCategoryProps } from './Card/CardCategory';\nexport type { CardFooterCTAProps } from './Card/CardFooterCTA';\nexport type { CardReadMoreProps } from './Card/CardReadMore';\nexport type { CardSignatureProps } from './Card/CardSignature';\nexport type { CardTagProps } from './Card/CardTag';\nexport type { CardTagsHeaderProps } from './Card/CardTagsHeader';\nexport type { CardTextProps } from './Card/CardText';\nexport type { CardTitleProps } from './Card/CardTitle';\nexport type { CarouselProps } from './Carousel/Carousel';\nexport type { ChipProps } from './Chips/Chip';\nexport type { ChipLabelProps } from './Chips/ChipLabel';\nexport type { DimmerProps } from './Dimmer/Dimmer';\nexport type { DimmerButtonsProps } from './Dimmer/DimmerButtons';\nexport type { DropdownProps } from './Dropdown/Dropdown';\nexport type { DropdownMenuProps } from './Dropdown/DropdownMenu';\nexport type { DropdownToggleProps } from './Dropdown/DropdownToggle';\nexport type { FontLoaderProps } from './FontLoader/FontLoader';\nexport type { ForwardProps } from './Forward/Forward';\nexport type {\n GridItemProps,\n GridItemTextProps,\n GridItemTextWrapperProps,\n GridListProps,\n GridRowProps\n} from './Grid/index';\nexport type { HeaderProps } from './Header/Header';\nexport type { HeaderBrandProps } from './Header/HeaderBrand';\nexport type { HeaderContentProps } from './Header/HeaderContent';\nexport type { HeaderLinkZoneProps } from './Header/HeaderLinkZone';\nexport type { HeaderRightZoneProps } from './Header/HeaderRightZone';\nexport type { HeadersProps } from './Header/Headers';\nexport type { HeaderSearchProps } from './Header/HeaderSearch';\nexport type { HeaderSocialsZoneProps } from './Header/HeaderSocialsZone';\nexport type { HeaderTogglerProps } from './Header/HeaderToggler';\nexport type {\n HeroBackgroundProps,\n HeroBodyProps,\n HeroButtonProps,\n HeroCategoryProps,\n HeroProps,\n HeroTitleProps\n} from './Hero/index';\nexport type { IconName, IconProps } from './Icon/Icon';\nexport type { InputProps } from './Input/Input';\nexport type { InputContainerProps } from './Input/InputContainer';\nexport type { TextAreaProps } from './Input/TextArea';\nexport type { LinkListProps } from './LinkList/LinkList';\nexport type { LinkListItemProps } from './LinkList/LinkListItem';\nexport type { ListProps } from './List/List';\nexport type { ListItemProps } from './List/ListItem';\nexport type { MegamenuFooterProps } from './Megamenu/MegamenuFooter';\nexport type { MegamenuHCProps } from './Megamenu/MegamenuHighlightColumn';\nexport type { MegamenuItemProps } from './Megamenu/MegamenuItem';\nexport type { ModalProps } from './Modal/Modal';\nexport type { ModalBodyProps } from './Modal/ModalBody';\nexport type { ModalFooterProps } from './Modal/ModalFooter';\nexport type { ModalHeaderProps } from './Modal/ModalHeader';\nexport type { NavProps } from './Nav/Nav';\nexport type { ChangesType, RegisterOptions, useNavScrollArgs, useNavScrollResult } from './NavScroll';\nexport type { NotificationId, NotificationManagerProps, NotificationOptions, NotificationProps } from './Notification';\nexport type { PagerProps } from './Pager/Pager';\nexport type { ProgressProps } from './Progress/Progress';\nexport type { RatingProps } from './Rating/Rating';\nexport type { ResponsiveImageProps } from './ResponsiveImage/ResponsiveImage';\nexport type { SectionProps } from './Section/Section';\nexport type { SelectProps } from './Select/Select';\nexport type { SidebarProps } from './Sidebar/Sidebar';\nexport type { SkiplinkProps } from './Skiplink/Skiplink';\nexport type { SkiplinkItemProps } from './Skiplink/SkiplinkItem';\nexport type { SpinnerProps } from './Spinner/Spinner';\nexport type { StepperContainerProps } from './Stepper/StepperContainer';\nexport type { StepperContentProps } from './Stepper/StepperContent';\nexport type { StepperDotsProps } from './Stepper/StepperDots';\nexport type { StepperHeaderProps } from './Stepper/StepperHeader';\nexport type { StepperHeaderElementProps } from './Stepper/StepperHeaderElement';\nexport type { StepperNavProps } from './Stepper/StepperNav';\nexport type { TabNavProps } from './Tab/TabNav';\nexport type { TabNavItemProps } from './Tab/TabNavItem';\nexport type { TabNavLinkProps } from './Tab/TabNavLink';\nexport type { ThumbNavProps } from './ThumbNav/ThumbNav';\nexport type { ThumbNavItemProps } from './ThumbNav/ThumbNavItem';\nexport type { TimelinePinProps } from './Timeline/TimelinePin';\nexport type { TimelineProps } from './Timeline/TimelineWrapper';\nexport type { ToggleProps } from './Toggle/Toggle';\nexport type { ToolbarProps } from './Toolbar/Toolbar';\nexport type { ToolbarItemBadge, ToolbarItemProps } from './Toolbar/ToolbarItem';\nexport type { UploadProps } from './Upload/Upload';\nexport type { VideoProps, VideoSource, VideoTrackSource, VideoYouTube } from './Video/Video';\n\nexport type {\n BreadcrumbItemProps,\n ButtonDropdownProps,\n ButtonGroupProps,\n ButtonToolbarProps,\n CardColumnsProps,\n CardDeckProps,\n CardFooterProps,\n CardGroupProps,\n CardHeaderProps,\n CardImgOverlayProps,\n CardImgProps,\n CardLinkProps,\n CardSubtitleProps,\n ColProps,\n ContainerProps,\n FadeProps,\n FormFeedbackProps,\n FormGroupProps,\n FormProps,\n FormTextProps,\n InputGroupProps,\n InputGroupTextProps,\n LabelProps,\n ListGroupItemHeadingProps,\n ListGroupItemProps,\n ListGroupItemTextProps,\n ListGroupProps,\n MediaProps,\n NavbarBrandProps,\n NavbarProps,\n NavbarTogglerProps,\n NavItemProps,\n NavLinkProps,\n PaginationItem as PagerItemProps,\n PaginationLink as PagerLinkProps,\n PopoverBodyProps,\n PopoverHeaderProps,\n PopoverProps,\n RowProps,\n TableProps,\n TooltipProps,\n UncontrolledAlertProps,\n UncontrolledCollapseProps,\n UncontrolledTooltipProps\n} from 'reactstrap';\n\nexport type { SplideProps } from '@splidejs/react-splide';\nexport type { TabContainerProps, TabContentProps, TabPaneProps } from 'react-bootstrap';\nimport './track-focus.js';\n","// Focus Management\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap Italia (https://italia.github.io/bootstrap-italia/)\n * Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS\n * Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst DATA_MOUSE_FOCUS = 'data-focus-mouse';\nconst CLASS_NAME_MOUSE_FOCUS = 'focus--mouse';\n\nclass TrackFocus {\n constructor() {\n this._usingMouse = false;\n\n this._bindEvents();\n }\n\n _bindEvents() {\n if (typeof document === 'undefined') {\n return;\n }\n const events = ['keydown', 'mousedown'];\n events.forEach((evtName) => {\n document.addEventListener(evtName, (evt) => {\n this._usingMouse = evt.type === 'mousedown';\n });\n });\n document.addEventListener('focusin', (evt) => {\n if (this._usingMouse) {\n if (evt.target) {\n evt.target.classList.add(CLASS_NAME_MOUSE_FOCUS);\n evt.target.setAttribute(DATA_MOUSE_FOCUS, 'true');\n }\n }\n });\n document.addEventListener('focusout', (evt) => {\n if (evt.target) {\n evt.target.classList.remove(CLASS_NAME_MOUSE_FOCUS);\n evt.target.setAttribute(DATA_MOUSE_FOCUS, 'false');\n }\n });\n }\n}\n\nnew TrackFocus();\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,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,QAAQX,CAAQ,EAAE,OAAQa,GAAcA,EAAM,OAAS,gBAAS,EAMrG,OACE,EAAAF,QAAA,cAACP,EAAA,CAAI,UAAWC,EAAU,GAAGF,EAAY,cAAaD,GACpD,EAAAS,QAAA,cAACb,EAAA,CAAQ,UAAWS,GAAcK,CAAa,EAC9CE,EACAb,EACC,EAAAU,QAAA,cAAC,SACED,EACAD,CACH,EACE,IACN,CAEJ","names":["Pager_exports","__export","Pager","__toCommonJS","import_react","import_classnames","import_reactstrap","import_react_bootstrap","DATA_MOUSE_FOCUS","CLASS_NAME_MOUSE_FOCUS","TrackFocus","evtName","evt","Pager","className","tag","ListTag","listClassName","children","total","testId","attributes","Tag","classes","classNames","listClasses","ariaLabel","label","totalAriaLabel","React","listChildren","child","extraChildren"]}