@helsenorge/designsystem-react 6.5.0 → 6.6.2
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/CHANGELOG.md +24 -0
- package/components/AnchorLink/AnchorLink.d.ts +1 -1
- package/components/AnchorLink/AnchorLink.js.map +1 -1
- package/components/AnchorLink/AnchorLink.stories.d.ts +31 -0
- package/components/Avatar/Avatar.stories.d.ts +35 -0
- package/components/Badge/Badge.stories.d.ts +29 -0
- package/components/Button/Button.stories.d.ts +55 -0
- package/components/Checkbox/Checkbox.stories.d.ts +54 -0
- package/components/Close/Close.stories.d.ts +29 -0
- package/components/DictionaryTrigger/DictionaryTrigger.d.ts +1 -1
- package/components/DictionaryTrigger/DictionaryTrigger.js.map +1 -1
- package/components/DictionaryTrigger/DictionaryTrigger.stories.d.ts +30 -0
- package/components/Dropdown/Dropdown.d.ts +2 -0
- package/components/Dropdown/Dropdown.js +32 -31
- package/components/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.stories.d.ts +63 -0
- package/components/Duolist/Duolist.d.ts +2 -2
- package/components/Duolist/Duolist.js.map +1 -1
- package/components/Duolist/Duolist.stories.d.ts +32 -0
- package/components/EmptyState/EmptyState.d.ts +1 -1
- package/components/EmptyState/EmptyState.js.map +1 -1
- package/components/EmptyState/EmptyState.stories.d.ts +26 -0
- package/components/Expander/Expander.d.ts +3 -1
- package/components/Expander/Expander.js +30 -29
- package/components/Expander/Expander.js.map +1 -1
- package/components/Expander/Expander.stories.d.ts +60 -0
- package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +43 -0
- package/components/ExpanderHierarchy/expander.module.scss +0 -20
- package/components/ExpanderHierarchy/expander.module.scss.d.ts +0 -1
- package/components/ExpanderList/ExpanderList.d.ts +4 -0
- package/components/ExpanderList/ExpanderList.js +79 -76
- package/components/ExpanderList/ExpanderList.js.map +1 -1
- package/components/ExpanderList/ExpanderList.stories.d.ts +58 -0
- package/components/FormExample/FormExample.d.ts +1 -1
- package/components/FormExample/FormExample.js.map +1 -1
- package/components/FormGroup/FormGroup.stories.d.ts +49 -0
- package/components/FormLayout/FormLayout.stories.d.ts +32 -0
- package/components/HelpBubble/HelpBubble.stories.d.ts +42 -0
- package/components/HelpPanel/HelpPanel.d.ts +1 -1
- package/components/HelpPanel/HelpPanel.js.map +1 -1
- package/components/HelpPanel/HelpPanel.stories.d.ts +31 -0
- package/components/HelpQuestion/HelpQuestion.d.ts +1 -1
- package/components/HelpQuestion/HelpQuestion.js.map +1 -1
- package/components/HelpQuestion/HelpQuestion.stories.d.ts +29 -0
- package/components/HighlightBox/HighlightBox.d.ts +1 -1
- package/components/HighlightBox/HighlightBox.js.map +1 -1
- package/components/HighlightBox/HighlightBox.stories.d.ts +42 -0
- package/components/Icon/Icon.stories.d.ts +38 -0
- package/components/Illustration/Illustration.stories.d.ts +34 -0
- package/components/Illustration/Illustrations.stories.d.ts +41 -0
- package/components/Input/Input.stories.d.ts +94 -0
- package/components/Label/Label.stories.d.ts +25 -0
- package/components/LazyIcon/LazyIcon.js.map +1 -1
- package/components/LazyIcon/LazyIcon.stories.d.ts +25 -0
- package/components/LazyIllustration/LazyIllustration.js.map +1 -1
- package/components/LazyIllustration/LazyIllustration.stories.d.ts +38 -0
- package/components/LinkList/LinkList.stories.d.ts +47 -0
- package/components/List/List.stories.d.ts +36 -0
- package/components/Loader/Loader.stories.d.ts +31 -0
- package/components/Logo/Logo.d.ts +1 -1
- package/components/Logo/Logo.js.map +1 -1
- package/components/Logo/Logo.stories.d.ts +37 -0
- package/components/Modal/Modal.stories.d.ts +73 -0
- package/components/NotificationPanel/NotificationPanel.stories.d.ts +54 -0
- package/components/Panel/Panel.stories.d.ts +89 -0
- package/components/PanelList/PanelList.d.ts +1 -1
- package/components/PanelList/PanelList.js.map +1 -1
- package/components/PanelList/PanelList.stories.d.ts +27 -0
- package/components/PopMenu/PopMenu.js +73 -61
- package/components/PopMenu/PopMenu.js.map +1 -1
- package/components/PopMenu/PopMenu.stories.d.ts +29 -0
- package/components/PopOver/PopOver.d.ts +2 -0
- package/components/PopOver/PopOver.js +37 -36
- package/components/PopOver/PopOver.js.map +1 -1
- package/components/PopOver/PopOver.stories.d.ts +34 -0
- package/components/PromoPanel/PromoPanel.d.ts +1 -1
- package/components/PromoPanel/PromoPanel.js.map +1 -1
- package/components/PromoPanel/PromoPanel.stories.d.ts +44 -0
- package/components/RadioButton/RadioButton.stories.d.ts +57 -0
- package/components/Select/Select.stories.d.ts +38 -0
- package/components/ServiceMessage/ServiceMessage.stories.d.ts +71 -0
- package/components/SharingStatus/SharingStatus.stories.d.ts +31 -0
- package/components/Slider/Slider.d.ts +1 -1
- package/components/Slider/Slider.js.map +1 -1
- package/components/Slider/Slider.stories.d.ts +52 -0
- package/components/Spacer/Spacer.d.ts +1 -1
- package/components/Spacer/Spacer.js.map +1 -1
- package/components/Spacer/Spacer.stories.d.ts +17 -0
- package/components/StatusDot/StatusDot.stories.d.ts +31 -0
- package/components/Step/Step.stories.d.ts +32 -0
- package/components/StepButtons/StepButtons.stories.d.ts +19 -0
- package/components/Stepper/Stepper.stories.d.ts +38 -0
- package/components/Table/Table.stories.d.ts +90 -0
- package/components/Tag/Tag.d.ts +1 -1
- package/components/Tag/Tag.js.map +1 -1
- package/components/Tag/Tag.stories.d.ts +48 -0
- package/components/TagList/TagList.d.ts +1 -1
- package/components/TagList/TagList.js.map +1 -1
- package/components/TagList/TagList.stories.d.ts +17 -0
- package/components/Textarea/Textarea.d.ts +1 -1
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.stories.d.ts +94 -0
- package/components/Tile/Tile.stories.d.ts +40 -0
- package/components/Title/Title.stories.d.ts +40 -0
- package/components/Tooltip/Tooltip.stories.d.ts +30 -0
- package/components/Trigger/Trigger.stories.d.ts +52 -0
- package/components/Validation/Validation.stories.d.ts +37 -0
- package/constants.d.ts +1 -0
- package/constants.js +1 -1
- package/constants.js.map +1 -1
- package/hoc/withBreakpoint/withBreakpoint.stories.d.ts +18 -0
- package/hooks/useBreakpoint.stories.d.ts +17 -0
- package/hooks/useDelayedState.stories.d.ts +28 -0
- package/hooks/useElementList.stories.d.ts +17 -0
- package/hooks/useFocusToggle.stories.d.ts +17 -0
- package/hooks/useFocusTrap.stories.d.ts +17 -0
- package/hooks/useFocusableElements.stories.d.ts +17 -0
- package/hooks/useHover.stories.d.ts +17 -0
- package/hooks/useIntersectionObserver.stories.d.ts +17 -0
- package/hooks/useInterval.stories.d.ts +17 -0
- package/hooks/useIsVisible.stories.d.ts +28 -0
- package/hooks/useKeyboardEvent.stories.d.ts +17 -0
- package/hooks/useLayoutEvent.stories.d.ts +17 -0
- package/hooks/useOutsideEvent.stories.d.ts +17 -0
- package/hooks/usePseudoClasses.stories.d.ts +17 -0
- package/hooks/useResizeObserver.stories.d.ts +17 -0
- package/hooks/useSize.stories.d.ts +17 -0
- package/hooks/useSticky.stories.d.ts +17 -0
- package/hooks/useUuid.stories.d.ts +17 -0
- package/package.json +1 -1
- package/__mocks__/IntersectionObserver.d.ts.map +0 -1
- package/__mocks__/MutationObserver.d.ts.map +0 -1
- package/__mocks__/ResizeObserver.d.ts.map +0 -1
- package/__mocks__/matchMedia.d.ts.map +0 -1
- package/__mocks__/useHover.d.ts.map +0 -1
- package/__mocks__/useLayoutEvent.d.ts.map +0 -1
- package/__mocks__/useOutsideEvent.d.ts.map +0 -1
- package/__mocks__/useSize.d.ts.map +0 -1
- package/__mocks__/uuid.d.ts.map +0 -1
- package/components/AnchorLink/AnchorLink.d.ts.map +0 -1
- package/components/AnchorLink/index.d.ts.map +0 -1
- package/components/Avatar/Avatar.d.ts.map +0 -1
- package/components/Avatar/index.d.ts.map +0 -1
- package/components/Badge/Badge.d.ts.map +0 -1
- package/components/Badge/index.d.ts.map +0 -1
- package/components/Button/Button.d.ts.map +0 -1
- package/components/Button/index.d.ts.map +0 -1
- package/components/ButtonWithModal/ButtonWithModal.d.ts.map +0 -1
- package/components/ButtonWithModal/index.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/components/Checkbox/index.d.ts.map +0 -1
- package/components/Close/Close.d.ts.map +0 -1
- package/components/Close/index.d.ts.map +0 -1
- package/components/DictionaryTrigger/DictionaryTrigger.d.ts.map +0 -1
- package/components/DictionaryTrigger/index.d.ts.map +0 -1
- package/components/Dropdown/Dropdown.d.ts.map +0 -1
- package/components/Dropdown/index.d.ts.map +0 -1
- package/components/Duolist/Duolist.d.ts.map +0 -1
- package/components/Duolist/index.d.ts.map +0 -1
- package/components/EmptyState/EmptyState.d.ts.map +0 -1
- package/components/EmptyState/NobodyHome.d.ts.map +0 -1
- package/components/EmptyState/index.d.ts.map +0 -1
- package/components/ErrorWrapper/ErrorWrapper.d.ts.map +0 -1
- package/components/ErrorWrapper/index.d.ts.map +0 -1
- package/components/Expander/Expander.d.ts.map +0 -1
- package/components/Expander/index.d.ts.map +0 -1
- package/components/ExpanderHierarchy/Expander.d.ts.map +0 -1
- package/components/ExpanderHierarchy/ExpanderButton.d.ts.map +0 -1
- package/components/ExpanderHierarchy/ExpanderHierarchy.d.ts.map +0 -1
- package/components/ExpanderHierarchy/index.d.ts.map +0 -1
- package/components/ExpanderHierarchy/utils.d.ts.map +0 -1
- package/components/ExpanderList/ExpanderList.d.ts.map +0 -1
- package/components/ExpanderList/index.d.ts.map +0 -1
- package/components/FormExample/FormExample.d.ts.map +0 -1
- package/components/FormExample/index.d.ts.map +0 -1
- package/components/FormGroup/FormGroup.d.ts.map +0 -1
- package/components/FormGroup/index.d.ts.map +0 -1
- package/components/FormLayout/FormLayout.d.ts.map +0 -1
- package/components/FormLayout/index.d.ts.map +0 -1
- package/components/GridExample/GridExample.d.ts.map +0 -1
- package/components/GridExample/index.d.ts.map +0 -1
- package/components/HelpBubble/HelpBubble.d.ts.map +0 -1
- package/components/HelpBubble/index.d.ts.map +0 -1
- package/components/HelpBubbleExample/HelpBubbleExample.d.ts.map +0 -1
- package/components/HelpBubbleExample/index.d.ts.map +0 -1
- package/components/HelpPanel/HelpPanel.d.ts.map +0 -1
- package/components/HelpPanel/index.d.ts.map +0 -1
- package/components/HelpQuestion/HelpQuestion.d.ts.map +0 -1
- package/components/HelpQuestion/index.d.ts.map +0 -1
- package/components/HighlightBox/HighlightBox.d.ts.map +0 -1
- package/components/HighlightBox/index.d.ts.map +0 -1
- package/components/HorizontalScroll/HorizontalScroll.d.ts.map +0 -1
- package/components/HorizontalScroll/index.d.ts.map +0 -1
- package/components/Icon/Icon.d.ts.map +0 -1
- package/components/Icon/index.d.ts.map +0 -1
- package/components/Icons/ActiveMonitoring.d.ts.map +0 -1
- package/components/Icons/AcupunctureBack.d.ts.map +0 -1
- package/components/Icons/AdditionalIconInformation.d.ts.map +0 -1
- package/components/Icons/AlarmClock.d.ts.map +0 -1
- package/components/Icons/AlertSignFill.d.ts.map +0 -1
- package/components/Icons/AlertSignStroke.d.ts.map +0 -1
- package/components/Icons/Amputation.d.ts.map +0 -1
- package/components/Icons/Anxiety.d.ts.map +0 -1
- package/components/Icons/Apple.d.ts.map +0 -1
- package/components/Icons/Archive.d.ts.map +0 -1
- package/components/Icons/ArmFlexing.d.ts.map +0 -1
- package/components/Icons/ArrowDown.d.ts.map +0 -1
- package/components/Icons/ArrowLeft.d.ts.map +0 -1
- package/components/Icons/ArrowRight.d.ts.map +0 -1
- package/components/Icons/ArrowUp.d.ts.map +0 -1
- package/components/Icons/ArrowUpRight.d.ts.map +0 -1
- package/components/Icons/Attachment.d.ts.map +0 -1
- package/components/Icons/Atv.d.ts.map +0 -1
- package/components/Icons/Avatar.d.ts.map +0 -1
- package/components/Icons/AwakePersonOnPillow.d.ts.map +0 -1
- package/components/Icons/Baby.d.ts.map +0 -1
- package/components/Icons/BandAid.d.ts.map +0 -1
- package/components/Icons/BeerAndPills.d.ts.map +0 -1
- package/components/Icons/Bell.d.ts.map +0 -1
- package/components/Icons/Bike.d.ts.map +0 -1
- package/components/Icons/BirthControl.d.ts.map +0 -1
- package/components/Icons/BirthdayCake.d.ts.map +0 -1
- package/components/Icons/Boat.d.ts.map +0 -1
- package/components/Icons/Body.d.ts.map +0 -1
- package/components/Icons/Braille.d.ts.map +0 -1
- package/components/Icons/Brain.d.ts.map +0 -1
- package/components/Icons/BreastReconstruction.d.ts.map +0 -1
- package/components/Icons/BreastRemoval.d.ts.map +0 -1
- package/components/Icons/Breasts.d.ts.map +0 -1
- package/components/Icons/BrokenHeart.d.ts.map +0 -1
- package/components/Icons/BrokenPuzzle.d.ts.map +0 -1
- package/components/Icons/Bus.d.ts.map +0 -1
- package/components/Icons/Calendar.d.ts.map +0 -1
- package/components/Icons/CalendarChange.d.ts.map +0 -1
- package/components/Icons/CalendarCheck.d.ts.map +0 -1
- package/components/Icons/CalendarEvent.d.ts.map +0 -1
- package/components/Icons/CalendarSave.d.ts.map +0 -1
- package/components/Icons/Cancer.d.ts.map +0 -1
- package/components/Icons/Candle.d.ts.map +0 -1
- package/components/Icons/Car.d.ts.map +0 -1
- package/components/Icons/Change.d.ts.map +0 -1
- package/components/Icons/Check.d.ts.map +0 -1
- package/components/Icons/CheckFill.d.ts.map +0 -1
- package/components/Icons/CheckOutline.d.ts.map +0 -1
- package/components/Icons/Chest.d.ts.map +0 -1
- package/components/Icons/ChevronDown.d.ts.map +0 -1
- package/components/Icons/ChevronLeft.d.ts.map +0 -1
- package/components/Icons/ChevronRight.d.ts.map +0 -1
- package/components/Icons/ChevronUp.d.ts.map +0 -1
- package/components/Icons/ChevronsDown.d.ts.map +0 -1
- package/components/Icons/ChevronsUp.d.ts.map +0 -1
- package/components/Icons/ChildPlaying.d.ts.map +0 -1
- package/components/Icons/Cigarette.d.ts.map +0 -1
- package/components/Icons/Coins.d.ts.map +0 -1
- package/components/Icons/Contacts.d.ts.map +0 -1
- package/components/Icons/Copy.d.ts.map +0 -1
- package/components/Icons/CoronaCertificate.d.ts.map +0 -1
- package/components/Icons/Coronavirus.d.ts.map +0 -1
- package/components/Icons/Cough.d.ts.map +0 -1
- package/components/Icons/CriticalHealthInfo.d.ts.map +0 -1
- package/components/Icons/Cross.d.ts.map +0 -1
- package/components/Icons/DataExchange.d.ts.map +0 -1
- package/components/Icons/DataReceived.d.ts.map +0 -1
- package/components/Icons/DataSent.d.ts.map +0 -1
- package/components/Icons/Depression.d.ts.map +0 -1
- package/components/Icons/DigestiveSystem.d.ts.map +0 -1
- package/components/Icons/Dizzy.d.ts.map +0 -1
- package/components/Icons/Documents.d.ts.map +0 -1
- package/components/Icons/Dog.d.ts.map +0 -1
- package/components/Icons/DonorCard.d.ts.map +0 -1
- package/components/Icons/Download.d.ts.map +0 -1
- package/components/Icons/Draft.d.ts.map +0 -1
- package/components/Icons/EChat.d.ts.map +0 -1
- package/components/Icons/Ear.d.ts.map +0 -1
- package/components/Icons/EarDeaf.d.ts.map +0 -1
- package/components/Icons/EarHearingAid.d.ts.map +0 -1
- package/components/Icons/EarNoseThroat.d.ts.map +0 -1
- package/components/Icons/EarVolume.d.ts.map +0 -1
- package/components/Icons/ElderlyPerson.d.ts.map +0 -1
- package/components/Icons/Embolization.d.ts.map +0 -1
- package/components/Icons/EmergencyCall.d.ts.map +0 -1
- package/components/Icons/EmoticonAnnoyed.d.ts.map +0 -1
- package/components/Icons/EmoticonDelighted.d.ts.map +0 -1
- package/components/Icons/EmoticonDisappointed.d.ts.map +0 -1
- package/components/Icons/EmoticonHappy.d.ts.map +0 -1
- package/components/Icons/EmoticonMeh.d.ts.map +0 -1
- package/components/Icons/EnterFullScreen.d.ts.map +0 -1
- package/components/Icons/Envelope.d.ts.map +0 -1
- package/components/Icons/Epilepsy.d.ts.map +0 -1
- package/components/Icons/Eraser.d.ts.map +0 -1
- package/components/Icons/ErrorSignFill.d.ts.map +0 -1
- package/components/Icons/ErrorSignStroke.d.ts.map +0 -1
- package/components/Icons/EuropeanHealthCard.d.ts.map +0 -1
- package/components/Icons/ExitFullScreen.d.ts.map +0 -1
- package/components/Icons/Eye.d.ts.map +0 -1
- package/components/Icons/Facebook.d.ts.map +0 -1
- package/components/Icons/FallingLeaf.d.ts.map +0 -1
- package/components/Icons/Female.d.ts.map +0 -1
- package/components/Icons/FemaleDoctor.d.ts.map +0 -1
- package/components/Icons/Ferry.d.ts.map +0 -1
- package/components/Icons/File.d.ts.map +0 -1
- package/components/Icons/Filter.d.ts.map +0 -1
- package/components/Icons/FingerBleed.d.ts.map +0 -1
- package/components/Icons/FirstAidKit.d.ts.map +0 -1
- package/components/Icons/FloppyDisk.d.ts.map +0 -1
- package/components/Icons/Football.d.ts.map +0 -1
- package/components/Icons/Form.d.ts.map +0 -1
- package/components/Icons/Forward.d.ts.map +0 -1
- package/components/Icons/Gallery.d.ts.map +0 -1
- package/components/Icons/Garden.d.ts.map +0 -1
- package/components/Icons/GasCan.d.ts.map +0 -1
- package/components/Icons/GenderIdentity.d.ts.map +0 -1
- package/components/Icons/Glasses.d.ts.map +0 -1
- package/components/Icons/Globe.d.ts.map +0 -1
- package/components/Icons/Graph.d.ts.map +0 -1
- package/components/Icons/Group.d.ts.map +0 -1
- package/components/Icons/GroupTwins.d.ts.map +0 -1
- package/components/Icons/HTMLFile.d.ts.map +0 -1
- package/components/Icons/HandWaving.d.ts.map +0 -1
- package/components/Icons/HandWithDisease.d.ts.map +0 -1
- package/components/Icons/HandsAndHeart.d.ts.map +0 -1
- package/components/Icons/HealthClinic.d.ts.map +0 -1
- package/components/Icons/HealthWarning.d.ts.map +0 -1
- package/components/Icons/HealthcarePerson.d.ts.map +0 -1
- package/components/Icons/HealthcarePersonell.d.ts.map +0 -1
- package/components/Icons/HearingProtection.d.ts.map +0 -1
- package/components/Icons/Heart.d.ts.map +0 -1
- package/components/Icons/HeartHands.d.ts.map +0 -1
- package/components/Icons/HelpSign.d.ts.map +0 -1
- package/components/Icons/HelpingHand.d.ts.map +0 -1
- package/components/Icons/Hemodialysis.d.ts.map +0 -1
- package/components/Icons/Hiker.d.ts.map +0 -1
- package/components/Icons/Hipprosthesis.d.ts.map +0 -1
- package/components/Icons/History.d.ts.map +0 -1
- package/components/Icons/HivAndAids.d.ts.map +0 -1
- package/components/Icons/Home.d.ts.map +0 -1
- package/components/Icons/Hormone.d.ts.map +0 -1
- package/components/Icons/Hospital.d.ts.map +0 -1
- package/components/Icons/Hourglass.d.ts.map +0 -1
- package/components/Icons/IconNames.d.ts.map +0 -1
- package/components/Icons/ImgFile.d.ts.map +0 -1
- package/components/Icons/Inbox.d.ts.map +0 -1
- package/components/Icons/InfoSignFill.d.ts.map +0 -1
- package/components/Icons/InfoSignStroke.d.ts.map +0 -1
- package/components/Icons/Instagram.d.ts.map +0 -1
- package/components/Icons/Intravenous.d.ts.map +0 -1
- package/components/Icons/JointPain.d.ts.map +0 -1
- package/components/Icons/Journal.d.ts.map +0 -1
- package/components/Icons/JpgFile.d.ts.map +0 -1
- package/components/Icons/Kidney.d.ts.map +0 -1
- package/components/Icons/KitchenScale.d.ts.map +0 -1
- package/components/Icons/Kjernejournal.d.ts.map +0 -1
- package/components/Icons/Laboratory.d.ts.map +0 -1
- package/components/Icons/LaptopBlog.d.ts.map +0 -1
- package/components/Icons/LawBook.d.ts.map +0 -1
- package/components/Icons/LegalDocument.d.ts.map +0 -1
- package/components/Icons/LightBulb.d.ts.map +0 -1
- package/components/Icons/List.d.ts.map +0 -1
- package/components/Icons/Location.d.ts.map +0 -1
- package/components/Icons/Lock.d.ts.map +0 -1
- package/components/Icons/Login.d.ts.map +0 -1
- package/components/Icons/Logout.d.ts.map +0 -1
- package/components/Icons/Lungs.d.ts.map +0 -1
- package/components/Icons/Makeup.d.ts.map +0 -1
- package/components/Icons/MaleDoctor.d.ts.map +0 -1
- package/components/Icons/MaleDoctorAndPerson.d.ts.map +0 -1
- package/components/Icons/MaleGenitalia.d.ts.map +0 -1
- package/components/Icons/Medicine.d.ts.map +0 -1
- package/components/Icons/MedicineWarning.d.ts.map +0 -1
- package/components/Icons/MentalHealthAdult.d.ts.map +0 -1
- package/components/Icons/MentalHealthChild.d.ts.map +0 -1
- package/components/Icons/Menu.d.ts.map +0 -1
- package/components/Icons/Microscope.d.ts.map +0 -1
- package/components/Icons/Minus.d.ts.map +0 -1
- package/components/Icons/Mirror.d.ts.map +0 -1
- package/components/Icons/MobilePhone.d.ts.map +0 -1
- package/components/Icons/MotherHoldingBaby.d.ts.map +0 -1
- package/components/Icons/MuscleBack.d.ts.map +0 -1
- package/components/Icons/MuscleLeg.d.ts.map +0 -1
- package/components/Icons/Mushroom.d.ts.map +0 -1
- package/components/Icons/Music.d.ts.map +0 -1
- package/components/Icons/MusselsAndSalt.d.ts.map +0 -1
- package/components/Icons/NoAccess.d.ts.map +0 -1
- package/components/Icons/NoEye.d.ts.map +0 -1
- package/components/Icons/NoFilter.d.ts.map +0 -1
- package/components/Icons/Notepad.d.ts.map +0 -1
- package/components/Icons/Osteotomy.d.ts.map +0 -1
- package/components/Icons/PaintRoller.d.ts.map +0 -1
- package/components/Icons/PaperPlane.d.ts.map +0 -1
- package/components/Icons/PatientAndPerson.d.ts.map +0 -1
- package/components/Icons/Pause.d.ts.map +0 -1
- package/components/Icons/PdfFile.d.ts.map +0 -1
- package/components/Icons/Pencil.d.ts.map +0 -1
- package/components/Icons/PeopleTalking.d.ts.map +0 -1
- package/components/Icons/Peritonealdialysis.d.ts.map +0 -1
- package/components/Icons/Person.d.ts.map +0 -1
- package/components/Icons/PersonAndPatient.d.ts.map +0 -1
- package/components/Icons/PersonCancel.d.ts.map +0 -1
- package/components/Icons/PersonInXRayMachine.d.ts.map +0 -1
- package/components/Icons/PersonOverweight.d.ts.map +0 -1
- package/components/Icons/PersonRelaxing.d.ts.map +0 -1
- package/components/Icons/PersonWithBrain.d.ts.map +0 -1
- package/components/Icons/PersonWithBrokenArm.d.ts.map +0 -1
- package/components/Icons/PersonWithCrutches.d.ts.map +0 -1
- package/components/Icons/PersonWithJaw.d.ts.map +0 -1
- package/components/Icons/PersonWithMagnifyingGlass.d.ts.map +0 -1
- package/components/Icons/PersonWithSenses.d.ts.map +0 -1
- package/components/Icons/PersonWorking.d.ts.map +0 -1
- package/components/Icons/PersonalPlan.d.ts.map +0 -1
- package/components/Icons/PizzaSlice.d.ts.map +0 -1
- package/components/Icons/Plane.d.ts.map +0 -1
- package/components/Icons/Plant.d.ts.map +0 -1
- package/components/Icons/Play.d.ts.map +0 -1
- package/components/Icons/PlusLarge.d.ts.map +0 -1
- package/components/Icons/PlusSmall.d.ts.map +0 -1
- package/components/Icons/PngFile.d.ts.map +0 -1
- package/components/Icons/Podcast.d.ts.map +0 -1
- package/components/Icons/PoisonInformation.d.ts.map +0 -1
- package/components/Icons/Pregnant.d.ts.map +0 -1
- package/components/Icons/Printer.d.ts.map +0 -1
- package/components/Icons/Psychosis.d.ts.map +0 -1
- package/components/Icons/Publication.d.ts.map +0 -1
- package/components/Icons/Puzzle.d.ts.map +0 -1
- package/components/Icons/QrCode.d.ts.map +0 -1
- package/components/Icons/Quarrel.d.ts.map +0 -1
- package/components/Icons/RadioTherapy.d.ts.map +0 -1
- package/components/Icons/RadioactiveTreatment.d.ts.map +0 -1
- package/components/Icons/Radioiodine.d.ts.map +0 -1
- package/components/Icons/Receipt.d.ts.map +0 -1
- package/components/Icons/Receptionist.d.ts.map +0 -1
- package/components/Icons/Recovery.d.ts.map +0 -1
- package/components/Icons/Referral.d.ts.map +0 -1
- package/components/Icons/Refresh.d.ts.map +0 -1
- package/components/Icons/Refund.d.ts.map +0 -1
- package/components/Icons/Reply.d.ts.map +0 -1
- package/components/Icons/Rocket.d.ts.map +0 -1
- package/components/Icons/RtfFile.d.ts.map +0 -1
- package/components/Icons/STDs.d.ts.map +0 -1
- package/components/Icons/Save.d.ts.map +0 -1
- package/components/Icons/Scale.d.ts.map +0 -1
- package/components/Icons/ScreenReader.d.ts.map +0 -1
- package/components/Icons/Search.d.ts.map +0 -1
- package/components/Icons/SectionSign.d.ts.map +0 -1
- package/components/Icons/Settings.d.ts.map +0 -1
- package/components/Icons/Sexualorientation.d.ts.map +0 -1
- package/components/Icons/ShakingHand.d.ts.map +0 -1
- package/components/Icons/Share.d.ts.map +0 -1
- package/components/Icons/Shield.d.ts.map +0 -1
- package/components/Icons/ShuntOperation.d.ts.map +0 -1
- package/components/Icons/Skeleton.d.ts.map +0 -1
- package/components/Icons/Skin.d.ts.map +0 -1
- package/components/Icons/Snake.d.ts.map +0 -1
- package/components/Icons/Snapchat.d.ts.map +0 -1
- package/components/Icons/SortDown.d.ts.map +0 -1
- package/components/Icons/SortUp.d.ts.map +0 -1
- package/components/Icons/SpeechBubble.d.ts.map +0 -1
- package/components/Icons/Spray.d.ts.map +0 -1
- package/components/Icons/Stopwatch.d.ts.map +0 -1
- package/components/Icons/Sun.d.ts.map +0 -1
- package/components/Icons/SupportingPerson.d.ts.map +0 -1
- package/components/Icons/Surgery.d.ts.map +0 -1
- package/components/Icons/Syringe.d.ts.map +0 -1
- package/components/Icons/Taxi.d.ts.map +0 -1
- package/components/Icons/TeddyBear.d.ts.map +0 -1
- package/components/Icons/Teenagers.d.ts.map +0 -1
- package/components/Icons/ThinkingAboutBaby.d.ts.map +0 -1
- package/components/Icons/Ticket.d.ts.map +0 -1
- package/components/Icons/TimePassing.d.ts.map +0 -1
- package/components/Icons/Tombstone.d.ts.map +0 -1
- package/components/Icons/Toolbox.d.ts.map +0 -1
- package/components/Icons/Tooth.d.ts.map +0 -1
- package/components/Icons/TotalKneeProsthesis.d.ts.map +0 -1
- package/components/Icons/Train.d.ts.map +0 -1
- package/components/Icons/Transplantation.d.ts.map +0 -1
- package/components/Icons/TrashCan.d.ts.map +0 -1
- package/components/Icons/TravelRoute.d.ts.map +0 -1
- package/components/Icons/TriangleX.d.ts.map +0 -1
- package/components/Icons/Twitter.d.ts.map +0 -1
- package/components/Icons/Undo.d.ts.map +0 -1
- package/components/Icons/UniProsthesis.d.ts.map +0 -1
- package/components/Icons/Upload.d.ts.map +0 -1
- package/components/Icons/UserOrganization.d.ts.map +0 -1
- package/components/Icons/Vaccine.d.ts.map +0 -1
- package/components/Icons/VerticalDots.d.ts.map +0 -1
- package/components/Icons/VideoCamera.d.ts.map +0 -1
- package/components/Icons/VideoChat.d.ts.map +0 -1
- package/components/Icons/Wallet.d.ts.map +0 -1
- package/components/Icons/Watch.d.ts.map +0 -1
- package/components/Icons/Website.d.ts.map +0 -1
- package/components/Icons/Wheelchair.d.ts.map +0 -1
- package/components/Icons/WheelchairActive.d.ts.map +0 -1
- package/components/Icons/Window.d.ts.map +0 -1
- package/components/Icons/WordDocument.d.ts.map +0 -1
- package/components/Icons/WorkSuitcase.d.ts.map +0 -1
- package/components/Icons/X.d.ts.map +0 -1
- package/components/Icons/XOutline.d.ts.map +0 -1
- package/components/Icons/XmlFile.d.ts.map +0 -1
- package/components/Icons/YouTube.d.ts.map +0 -1
- package/components/Icons/Zoom.d.ts.map +0 -1
- package/components/Illustration/Illustration.d.ts.map +0 -1
- package/components/Illustration/index.d.ts.map +0 -1
- package/components/Illustration/utils.d.ts.map +0 -1
- package/components/Illustrations/Doctor.d.ts.map +0 -1
- package/components/Illustrations/DoctorMedium.d.ts.map +0 -1
- package/components/Illustrations/DoctorSmall.d.ts.map +0 -1
- package/components/Illustrations/HealthcarePersonnel.d.ts.map +0 -1
- package/components/Illustrations/HealthcarePersonnelMedium.d.ts.map +0 -1
- package/components/Illustrations/HealthcarePersonnelSmall.d.ts.map +0 -1
- package/components/Illustrations/IllustrationNames.d.ts.map +0 -1
- package/components/Input/Input.d.ts.map +0 -1
- package/components/Input/index.d.ts.map +0 -1
- package/components/Label/Label.d.ts.map +0 -1
- package/components/Label/SubLabel.d.ts.map +0 -1
- package/components/Label/index.d.ts.map +0 -1
- package/components/LazyIcon/ErrorBoundary.d.ts.map +0 -1
- package/components/LazyIcon/LazyIcon.d.ts.map +0 -1
- package/components/LazyIcon/index.d.ts.map +0 -1
- package/components/LazyIcon/utils.d.ts.map +0 -1
- package/components/LazyIllustration/LazyIllustration.d.ts.map +0 -1
- package/components/LazyIllustration/index.d.ts.map +0 -1
- package/components/LinkList/LinkList.d.ts.map +0 -1
- package/components/LinkList/index.d.ts.map +0 -1
- package/components/List/List.d.ts.map +0 -1
- package/components/List/index.d.ts.map +0 -1
- package/components/ListHeader/ListHeader.d.ts.map +0 -1
- package/components/ListHeader/ListHeaderText/ListHeaderText.d.ts.map +0 -1
- package/components/ListHeader/ListHeaderText/index.d.ts.map +0 -1
- package/components/ListHeader/index.d.ts.map +0 -1
- package/components/Loader/Loader.d.ts.map +0 -1
- package/components/Loader/index.d.ts.map +0 -1
- package/components/Logo/Logo.d.ts.map +0 -1
- package/components/Logo/index.d.ts.map +0 -1
- package/components/MaxCharacters/MaxCharacters.d.ts.map +0 -1
- package/components/Modal/Modal.d.ts.map +0 -1
- package/components/Modal/index.d.ts.map +0 -1
- package/components/NotificationPanel/DetailButton/DetailButton.d.ts.map +0 -1
- package/components/NotificationPanel/NotificationPanel.d.ts.map +0 -1
- package/components/NotificationPanel/index.d.ts.map +0 -1
- package/components/Panel/Panel.d.ts.map +0 -1
- package/components/Panel/index.d.ts.map +0 -1
- package/components/PanelList/PanelList.d.ts.map +0 -1
- package/components/PanelList/index.d.ts.map +0 -1
- package/components/PopMenu/PopMenu.d.ts.map +0 -1
- package/components/PopMenu/index.d.ts.map +0 -1
- package/components/PopOver/PopOver.d.ts.map +0 -1
- package/components/PopOver/index.d.ts.map +0 -1
- package/components/PopOver/utils.d.ts.map +0 -1
- package/components/Portal/index.d.ts.map +0 -1
- package/components/PromoPanel/PromoPanel.d.ts.map +0 -1
- package/components/PromoPanel/index.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.d.ts.map +0 -1
- package/components/RadioButton/index.d.ts.map +0 -1
- package/components/Select/Select.d.ts.map +0 -1
- package/components/Select/index.d.ts.map +0 -1
- package/components/ServiceMessage/ServiceMessage.d.ts.map +0 -1
- package/components/ServiceMessage/index.d.ts.map +0 -1
- package/components/SharingStatus/SharingStatus.d.ts.map +0 -1
- package/components/SharingStatus/index.d.ts.map +0 -1
- package/components/Slider/Slider.d.ts.map +0 -1
- package/components/Slider/index.d.ts.map +0 -1
- package/components/Spacer/Spacer.d.ts.map +0 -1
- package/components/Spacer/index.d.ts.map +0 -1
- package/components/StatusDot/StatusDot.d.ts.map +0 -1
- package/components/StatusDot/index.d.ts.map +0 -1
- package/components/Step/Step.d.ts.map +0 -1
- package/components/Step/index.d.ts.map +0 -1
- package/components/StepButtons/StepButtons.d.ts.map +0 -1
- package/components/StepButtons/index.d.ts.map +0 -1
- package/components/Stepper/Dot.d.ts.map +0 -1
- package/components/Stepper/DotList.d.ts.map +0 -1
- package/components/Stepper/Stepper.d.ts.map +0 -1
- package/components/Stepper/index.d.ts.map +0 -1
- package/components/Stepper/utils.d.ts.map +0 -1
- package/components/Table/Table.d.ts.map +0 -1
- package/components/Table/TableBody/TableBody.d.ts.map +0 -1
- package/components/Table/TableBody/index.d.ts.map +0 -1
- package/components/Table/TableCell/TableCell.d.ts.map +0 -1
- package/components/Table/TableCell/index.d.ts.map +0 -1
- package/components/Table/TableExpandedRow/TableExpandedRow.d.ts.map +0 -1
- package/components/Table/TableExpandedRow/index.d.ts.map +0 -1
- package/components/Table/TableExpanderCell/TableExpanderCell.d.ts.map +0 -1
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.d.ts.map +0 -1
- package/components/Table/TableExpanderCell/index.d.ts.map +0 -1
- package/components/Table/TableHead/TableHead.d.ts.map +0 -1
- package/components/Table/TableHead/index.d.ts.map +0 -1
- package/components/Table/TableHeadCell/TableHeadCell.d.ts.map +0 -1
- package/components/Table/TableHeadCell/index.d.ts.map +0 -1
- package/components/Table/TableRow/TableRow.d.ts.map +0 -1
- package/components/Table/TableRow/index.d.ts.map +0 -1
- package/components/Table/index.d.ts.map +0 -1
- package/components/Table/utils.d.ts.map +0 -1
- package/components/Tag/Tag.d.ts.map +0 -1
- package/components/Tag/index.d.ts.map +0 -1
- package/components/TagList/TagList.d.ts.map +0 -1
- package/components/TagList/index.d.ts.map +0 -1
- package/components/Textarea/Textarea.d.ts.map +0 -1
- package/components/Textarea/index.d.ts.map +0 -1
- package/components/Tile/Tile.d.ts.map +0 -1
- package/components/Tile/index.d.ts.map +0 -1
- package/components/Title/Title.d.ts.map +0 -1
- package/components/Title/index.d.ts.map +0 -1
- package/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/components/Tooltip/TooltipWord/TooltipWord.d.ts.map +0 -1
- package/components/Tooltip/TooltipWord/index.d.ts.map +0 -1
- package/components/Tooltip/index.d.ts.map +0 -1
- package/components/TooltipExample/TooltipExample.d.ts.map +0 -1
- package/components/TooltipExample/index.d.ts.map +0 -1
- package/components/Trigger/HelpSign.d.ts.map +0 -1
- package/components/Trigger/InfoSignStroke.d.ts.map +0 -1
- package/components/Trigger/Trigger.d.ts.map +0 -1
- package/components/Trigger/index.d.ts.map +0 -1
- package/components/Validation/Validation.d.ts.map +0 -1
- package/components/Validation/index.d.ts.map +0 -1
- package/constants.d.ts.map +0 -1
- package/hoc/withBreakpoint/index.d.ts.map +0 -1
- package/hoc/withBreakpoint/withBreakpoint.d.ts.map +0 -1
- package/hooks/useBreakpoint.d.ts.map +0 -1
- package/hooks/useDelayedState.d.ts.map +0 -1
- package/hooks/useElementList.d.ts.map +0 -1
- package/hooks/useEventListenerState.d.ts.map +0 -1
- package/hooks/useExpand.d.ts.map +0 -1
- package/hooks/useFocusToggle.d.ts.map +0 -1
- package/hooks/useFocusTrap.d.ts.map +0 -1
- package/hooks/useFocusableElements.d.ts.map +0 -1
- package/hooks/useHover.d.ts.map +0 -1
- package/hooks/useIcons.d.ts.map +0 -1
- package/hooks/useIntersectionObserver.d.ts.map +0 -1
- package/hooks/useInterval.d.ts.map +0 -1
- package/hooks/useIsVisible.d.ts.map +0 -1
- package/hooks/useKeyboardEvent.d.ts.map +0 -1
- package/hooks/useLayoutEvent.d.ts.map +0 -1
- package/hooks/useOutsideEvent.d.ts.map +0 -1
- package/hooks/usePrevious.d.ts.map +0 -1
- package/hooks/usePseudoClasses.d.ts.map +0 -1
- package/hooks/useResizeObserver.d.ts.map +0 -1
- package/hooks/useSize.d.ts.map +0 -1
- package/hooks/useSticky.d.ts.map +0 -1
- package/hooks/useToggle.d.ts.map +0 -1
- package/hooks/useUuid.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/theme/currys/color.d.ts.map +0 -1
- package/theme/currys/index.d.ts.map +0 -1
- package/theme/currys/spacing.d.ts.map +0 -1
- package/theme/grid.d.ts.map +0 -1
- package/theme/index.d.ts.map +0 -1
- package/theme/palette.d.ts.map +0 -1
- package/theme/spacers.d.ts.map +0 -1
- package/utils/accessibility.d.ts.map +0 -1
- package/utils/component.d.ts.map +0 -1
- package/utils/debounce.d.ts.map +0 -1
- package/utils/device.d.ts.map +0 -1
- package/utils/environment.d.ts.map +0 -1
- package/utils/focus.d.ts.map +0 -1
- package/utils/loremtext.d.ts.map +0 -1
- package/utils/mobile.d.ts.map +0 -1
- package/utils/refs.d.ts.map +0 -1
- package/utils/uuid.d.ts.map +0 -1
- package/utils/viewport.d.ts.map +0 -1
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import t, { useRef as
|
|
2
|
-
import
|
|
3
|
-
import { getVerticalPosition as
|
|
4
|
-
import { AnalyticsId as
|
|
5
|
-
import { useInterval as
|
|
6
|
-
import { useIsVisible as
|
|
7
|
-
import { useLayoutEvent as
|
|
8
|
-
import { useSize as
|
|
9
|
-
import { mergeRefs as
|
|
1
|
+
import t, { useRef as v, useState as A, useEffect as B } from "react";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import { getVerticalPosition as F, getBubbleStyle as L, getArrowStyle as T } from "./utils.js";
|
|
4
|
+
import { ZIndex as V, AnalyticsId as Z } from "../../constants.js";
|
|
5
|
+
import { useInterval as $ } from "../../hooks/useInterval.js";
|
|
6
|
+
import { useIsVisible as j } from "../../hooks/useIsVisible.js";
|
|
7
|
+
import { useLayoutEvent as k } from "../../hooks/useLayoutEvent.js";
|
|
8
|
+
import { useSize as q } from "../../hooks/useSize.js";
|
|
9
|
+
import { mergeRefs as D } from "../../utils/refs.js";
|
|
10
10
|
import r from "./styles.module.scss";
|
|
11
|
-
var
|
|
12
|
-
const
|
|
11
|
+
var G = /* @__PURE__ */ ((e) => (e.positionautomatic = "positionautomatic", e.positionbelow = "positionbelow", e.positionabove = "positionabove", e))(G || {});
|
|
12
|
+
const d = t.forwardRef((e, w) => {
|
|
13
13
|
const {
|
|
14
|
-
id:
|
|
15
|
-
children:
|
|
14
|
+
id: y,
|
|
15
|
+
children: S,
|
|
16
16
|
controllerRef: n,
|
|
17
|
-
popOverRef:
|
|
18
|
-
show:
|
|
19
|
-
className:
|
|
17
|
+
popOverRef: R,
|
|
18
|
+
show: _ = !1,
|
|
19
|
+
className: g = "",
|
|
20
20
|
variant: p = "positionautomatic",
|
|
21
21
|
role: c,
|
|
22
|
-
testId:
|
|
23
|
-
arrowClassName:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
testId: z,
|
|
23
|
+
arrowClassName: C,
|
|
24
|
+
zIndex: m = V.PopOver
|
|
25
|
+
} = e, u = R || v(null), I = v(null), s = q(u), [o, N] = A(), E = j(n, 0), l = () => {
|
|
26
|
+
var f;
|
|
27
|
+
N((f = n.current) == null ? void 0 : f.getBoundingClientRect());
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
+
$(l, 500), k(l, ["scroll", "resize"], 10), B(() => {
|
|
29
30
|
l();
|
|
30
31
|
}, []);
|
|
31
|
-
const
|
|
32
|
+
const O = c === "tooltip", P = b(r.popover, { [r["popover--visible"]]: O ? _ : E }, g), i = o && s && F(o, s, p), x = b(r.popover__arrow, C, {
|
|
32
33
|
[r["popover__arrow--over"]]: i === "positionbelow",
|
|
33
34
|
[r["popover__arrow--under"]]: i === "positionabove"
|
|
34
35
|
/* positionabove */
|
|
35
|
-
}), a =
|
|
36
|
+
}), a = o && s && L(o, s, p), h = a && o && i && T(a, o, i);
|
|
36
37
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
37
38
|
"div",
|
|
38
39
|
{
|
|
39
|
-
id:
|
|
40
|
-
ref:
|
|
41
|
-
className:
|
|
42
|
-
style: a,
|
|
43
|
-
"data-testid":
|
|
44
|
-
"data-analyticsid":
|
|
40
|
+
id: y,
|
|
41
|
+
ref: D([w, u]),
|
|
42
|
+
className: P,
|
|
43
|
+
style: { ...a, zIndex: m },
|
|
44
|
+
"data-testid": z,
|
|
45
|
+
"data-analyticsid": Z.PopOver,
|
|
45
46
|
role: c
|
|
46
47
|
},
|
|
47
|
-
|
|
48
|
-
), /* @__PURE__ */ t.createElement("div", { ref:
|
|
48
|
+
S
|
|
49
|
+
), /* @__PURE__ */ t.createElement("div", { ref: I, className: x, style: { ...h, zIndex: m } }));
|
|
49
50
|
});
|
|
50
|
-
|
|
51
|
-
const
|
|
51
|
+
d.displayName = "PopOver";
|
|
52
|
+
const oe = d;
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
G as PopOverVariant,
|
|
55
|
+
oe as default
|
|
55
56
|
};
|
|
56
57
|
//# sourceMappingURL=PopOver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopOver.js","sources":["../../../src/components/PopOver/PopOver.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getArrowStyle, getBubbleStyle, getVerticalPosition } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { useInterval } from '../../hooks/useInterval';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useLayoutEvent } from '../../hooks/useLayoutEvent';\nimport { useSize } from '../../hooks/useSize';\nimport { mergeRefs } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport enum PopOverVariant {\n positionautomatic = 'positionautomatic',\n positionbelow = 'positionbelow',\n positionabove = 'positionabove',\n}\n\nexport type PopOverRole = 'tooltip';\n\nexport interface PopOverProps {\n /** Id of the PopOver */\n id?: string;\n /** Content shown inside PopOver. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the PopOver is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Ref for the element the PopOver is placed upon */\n popOverRef?: React.RefObject<HTMLDivElement>;\n /** Show the popover. Only applies when role=tooltip. Default: false. */\n show?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the arrow element. */\n arrowClassName?: string;\n /** Determines the placement of the popover. Default: automatic positioning. */\n variant?: keyof typeof PopOverVariant;\n /** Sets role of the PopOver element */\n role?: PopOverRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst PopOver = React.forwardRef<HTMLDivElement | SVGSVGElement, PopOverProps>((props, ref) => {\n const {\n id,\n children,\n controllerRef,\n popOverRef,\n show = false,\n className = '',\n variant = PopOverVariant.positionautomatic,\n role,\n testId,\n arrowClassName,\n } = props;\n\n const bubbleRef = popOverRef || useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const bubbleSize = useSize(bubbleRef);\n const [controllerSize, setControllerSize] = useState<DOMRect>();\n const controllerisVisible = useIsVisible(controllerRef, 0);\n\n const updateControllerSize = (): void => {\n setControllerSize(controllerRef.current?.getBoundingClientRect());\n };\n\n useInterval(updateControllerSize, 500);\n useLayoutEvent(updateControllerSize, ['scroll', 'resize'], 10);\n\n useEffect(() => {\n updateControllerSize();\n }, []);\n\n const isTooltip = role === 'tooltip';\n\n const popOverClasses = classNames(styles.popover, { [styles['popover--visible']]: isTooltip ? show : controllerisVisible }, className);\n const verticalPosition = controllerSize && bubbleSize && getVerticalPosition(controllerSize, bubbleSize, variant);\n const arrowClasses = classNames(styles.popover__arrow, arrowClassName, {\n [styles['popover__arrow--over']]: verticalPosition === PopOverVariant.positionbelow,\n [styles['popover__arrow--under']]: verticalPosition === PopOverVariant.positionabove,\n });\n\n const bubbleStyle = controllerSize && bubbleSize && getBubbleStyle(controllerSize, bubbleSize, variant);\n const arrowStyle = bubbleStyle && controllerSize && verticalPosition && getArrowStyle(bubbleStyle, controllerSize, verticalPosition);\n\n return (\n <>\n <div\n id={id}\n ref={mergeRefs([ref, bubbleRef])}\n className={popOverClasses}\n style={bubbleStyle}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PopOver}\n role={role}\n >\n {children}\n </div>\n <div ref={arrowRef} className={arrowClasses} style={arrowStyle} />\n </>\n );\n});\n\nPopOver.displayName = 'PopOver';\n\nexport default PopOver;\n"],"names":["PopOverVariant","PopOver","React","props","ref","id","children","controllerRef","popOverRef","show","className","variant","role","testId","arrowClassName","bubbleRef","useRef","arrowRef","bubbleSize","useSize","controllerSize","setControllerSize","useState","controllerisVisible","useIsVisible","updateControllerSize","_a","useInterval","useLayoutEvent","useEffect","isTooltip","popOverClasses","classNames","styles","verticalPosition","getVerticalPosition","arrowClasses","bubbleStyle","getBubbleStyle","arrowStyle","getArrowStyle","mergeRefs","AnalyticsId","PopOver$1"],"mappings":";;;;;;;;;;AAcY,IAAAA,sBAAAA,OACVA,EAAA,oBAAoB,qBACpBA,EAAA,gBAAgB,iBAChBA,EAAA,gBAAgB,iBAHNA,IAAAA,KAAA,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"PopOver.js","sources":["../../../src/components/PopOver/PopOver.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getArrowStyle, getBubbleStyle, getVerticalPosition } from './utils';\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useInterval } from '../../hooks/useInterval';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useLayoutEvent } from '../../hooks/useLayoutEvent';\nimport { useSize } from '../../hooks/useSize';\nimport { mergeRefs } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport enum PopOverVariant {\n positionautomatic = 'positionautomatic',\n positionbelow = 'positionbelow',\n positionabove = 'positionabove',\n}\n\nexport type PopOverRole = 'tooltip';\n\nexport interface PopOverProps {\n /** Id of the PopOver */\n id?: string;\n /** Content shown inside PopOver. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the PopOver is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Ref for the element the PopOver is placed upon */\n popOverRef?: React.RefObject<HTMLDivElement>;\n /** Show the popover. Only applies when role=tooltip. Default: false. */\n show?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the arrow element. */\n arrowClassName?: string;\n /** Determines the placement of the popover. Default: automatic positioning. */\n variant?: keyof typeof PopOverVariant;\n /** Sets role of the PopOver element */\n role?: PopOverRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Overrides the default z-index of PopOver */\n zIndex?: number;\n}\n\nconst PopOver = React.forwardRef<HTMLDivElement | SVGSVGElement, PopOverProps>((props, ref) => {\n const {\n id,\n children,\n controllerRef,\n popOverRef,\n show = false,\n className = '',\n variant = PopOverVariant.positionautomatic,\n role,\n testId,\n arrowClassName,\n zIndex = ZIndex.PopOver,\n } = props;\n\n const bubbleRef = popOverRef || useRef<HTMLDivElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const bubbleSize = useSize(bubbleRef);\n const [controllerSize, setControllerSize] = useState<DOMRect>();\n const controllerisVisible = useIsVisible(controllerRef, 0);\n\n const updateControllerSize = (): void => {\n setControllerSize(controllerRef.current?.getBoundingClientRect());\n };\n\n useInterval(updateControllerSize, 500);\n useLayoutEvent(updateControllerSize, ['scroll', 'resize'], 10);\n\n useEffect(() => {\n updateControllerSize();\n }, []);\n\n const isTooltip = role === 'tooltip';\n\n const popOverClasses = classNames(styles.popover, { [styles['popover--visible']]: isTooltip ? show : controllerisVisible }, className);\n const verticalPosition = controllerSize && bubbleSize && getVerticalPosition(controllerSize, bubbleSize, variant);\n const arrowClasses = classNames(styles.popover__arrow, arrowClassName, {\n [styles['popover__arrow--over']]: verticalPosition === PopOverVariant.positionbelow,\n [styles['popover__arrow--under']]: verticalPosition === PopOverVariant.positionabove,\n });\n\n const bubbleStyle = controllerSize && bubbleSize && getBubbleStyle(controllerSize, bubbleSize, variant);\n const arrowStyle = bubbleStyle && controllerSize && verticalPosition && getArrowStyle(bubbleStyle, controllerSize, verticalPosition);\n\n return (\n <>\n <div\n id={id}\n ref={mergeRefs([ref, bubbleRef])}\n className={popOverClasses}\n style={{ ...bubbleStyle, zIndex }}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PopOver}\n role={role}\n >\n {children}\n </div>\n <div ref={arrowRef} className={arrowClasses} style={{ ...arrowStyle, zIndex }} />\n </>\n );\n});\n\nPopOver.displayName = 'PopOver';\n\nexport default PopOver;\n"],"names":["PopOverVariant","PopOver","React","props","ref","id","children","controllerRef","popOverRef","show","className","variant","role","testId","arrowClassName","zIndex","ZIndex","bubbleRef","useRef","arrowRef","bubbleSize","useSize","controllerSize","setControllerSize","useState","controllerisVisible","useIsVisible","updateControllerSize","_a","useInterval","useLayoutEvent","useEffect","isTooltip","popOverClasses","classNames","styles","verticalPosition","getVerticalPosition","arrowClasses","bubbleStyle","getBubbleStyle","arrowStyle","getArrowStyle","mergeRefs","AnalyticsId","PopOver$1"],"mappings":";;;;;;;;;;AAcY,IAAAA,sBAAAA,OACVA,EAAA,oBAAoB,qBACpBA,EAAA,gBAAgB,iBAChBA,EAAA,gBAAgB,iBAHNA,IAAAA,KAAA,CAAA,CAAA;AAiCZ,MAAMC,IAAUC,EAAM,WAAyD,CAACC,GAAOC,MAAQ;AACvF,QAAA;AAAA,IACJ,IAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU;AAAA,IACV,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC,IAASC,EAAO;AAAA,EACd,IAAAb,GAEEc,IAAYT,KAAcU,EAAuB,IAAI,GACrDC,IAAWD,EAAuB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AAA,cAAC,OAAI,EAAA,KAAKiB,GAAU,WAAWmB,GAAc,OAAO,EAAE,GAAGG,GAAY,QAAA1B,KAAU,CACjF;AAEJ,CAAC;AAEDd,EAAQ,cAAc;AAEtB,MAAA4C,KAAe5C;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { PopOverVariant } from './PopOver';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: React.ForwardRefExoticComponent<import("./PopOver").PopOverProps & React.RefAttributes<HTMLDivElement | SVGSVGElement>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
controllerRef: undefined;
|
|
16
|
+
children: string;
|
|
17
|
+
variant: PopOverVariant.positionautomatic;
|
|
18
|
+
};
|
|
19
|
+
argTypes: {
|
|
20
|
+
children: {
|
|
21
|
+
control: string;
|
|
22
|
+
};
|
|
23
|
+
variant: {
|
|
24
|
+
control: string;
|
|
25
|
+
options: typeof PopOverVariant;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
export declare const Default: Story;
|
|
32
|
+
export declare const Toggle: Story;
|
|
33
|
+
export declare const HorizontalScroll: Story;
|
|
34
|
+
//# sourceMappingURL=PopOver.stories.d.ts.map
|
|
@@ -3,7 +3,7 @@ import { PaletteNames } from '../../theme/palette';
|
|
|
3
3
|
import { AnchorLinkTags, AnchorLinkTargets } from '../AnchorLink';
|
|
4
4
|
import { TitleTags } from '../Title';
|
|
5
5
|
export type PromoPanelColors = Extract<PaletteNames, 'neutral' | 'blueberry' | 'cherry'>;
|
|
6
|
-
interface PromoPanelProps {
|
|
6
|
+
export interface PromoPanelProps {
|
|
7
7
|
/** Used as the link text if set. title or children must be set for the link to have accessible text. */
|
|
8
8
|
title?: string;
|
|
9
9
|
/** Used as the link text if title is not set. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromoPanel.js","sources":["../../../src/components/PromoPanel/PromoPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys/color';\nimport { PaletteNames } from '../../theme/palette';\nimport { AnchorLinkTags, AnchorLinkTargets } from '../AnchorLink';\nimport Icon from '../Icon';\nimport ArrowRight from '../Icons/ArrowRight';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\nimport LazyIllustration from '../LazyIllustration';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type PromoPanelColors = Extract<PaletteNames, 'neutral' | 'blueberry' | 'cherry'>;\n\
|
|
1
|
+
{"version":3,"file":"PromoPanel.js","sources":["../../../src/components/PromoPanel/PromoPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys/color';\nimport { PaletteNames } from '../../theme/palette';\nimport { AnchorLinkTags, AnchorLinkTargets } from '../AnchorLink';\nimport Icon from '../Icon';\nimport ArrowRight from '../Icons/ArrowRight';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\nimport LazyIllustration from '../LazyIllustration';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type PromoPanelColors = Extract<PaletteNames, 'neutral' | 'blueberry' | 'cherry'>;\n\nexport interface PromoPanelProps {\n /** Used as the link text if set. title or children must be set for the link to have accessible text. */\n title?: string;\n /** Used as the link text if title is not set. */\n children?: string;\n /** Illustration element */\n illustration?: 'Doctor' | 'HealthcarePersonnel';\n /** Changes the underlying element of the title. */\n titleHtmlMarkup?: TitleTags;\n /** Changes the background color. Default: white */\n color?: PromoPanelColors;\n /** Not used if linkComponent is set */\n href?: string;\n /** Anchor link target. If linkComponent is set, this prop is only used to display the right icon for external links. */\n target?: AnchorLinkTargets;\n /** HTML markup for anchor link. Not used if linkComponent is set. Default: a */\n linkHtmlMarkup?: AnchorLinkTags;\n /** Function that is called when clicked. Not used if linkComponent is set. */\n linkOnClick?: () => void;\n /** Custom link component. Must be \"a\" a or \"button\" element with no styling. */\n linkComponent?: React.ReactElement;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface PromoPanelLinkProps {\n children?: string;\n href?: string;\n target?: AnchorLinkTargets;\n linkComponent?: React.ReactElement;\n linkHtmlMarkup?: AnchorLinkTags;\n linkOnClick?: () => void;\n}\n\nconst PromoPanelLink: React.FC<PromoPanelLinkProps> = props => {\n if (props.linkComponent) {\n return React.cloneElement(props.linkComponent, { children: props.children });\n }\n\n if (props.linkHtmlMarkup === 'button') {\n return (\n <button type={'button'} onClick={props.linkOnClick}>\n {props.children}\n </button>\n );\n }\n return (\n <a href={props.href} target={props.target} onClick={props.linkOnClick}>\n {props.children}\n </a>\n );\n};\n\nconst PromoPanel: React.FC<PromoPanelProps> = props => {\n const { isHovered, hoverRef } = useHover<HTMLDivElement>();\n\n const { color = 'neutral', titleHtmlMarkup = 'h2', linkHtmlMarkup = 'a' } = props;\n\n const breakpoint = useBreakpoint();\n\n const promoPanelClasses = classNames(\n styles.promopanel,\n styles[`promopanel--${color}`],\n !props.illustration && styles['promopanel--no-illustration']\n );\n\n const promoPanelLink = (\n <PromoPanelLink\n href={props.href}\n target={props.target}\n linkComponent={props.linkComponent}\n linkHtmlMarkup={linkHtmlMarkup}\n linkOnClick={props.linkOnClick}\n >\n {props.title || props.children}\n </PromoPanelLink>\n );\n\n const illustrationSize = ((): number => {\n if (breakpoint >= Breakpoint.md) {\n return 156;\n }\n\n return 110;\n })();\n\n return (\n <div className={promoPanelClasses} data-testid={props.testId} data-analyticsid={AnalyticsId.PromoPanel} ref={hoverRef}>\n {props.illustration && (\n <LazyIllustration\n illustrationName={props.illustration}\n size={illustrationSize}\n color={color}\n className={styles.promopanel__illustration}\n />\n )}\n <div className={styles.promopanel__content}>\n {props.title && (\n <Title htmlMarkup={titleHtmlMarkup} appearance={'title3'}>\n {promoPanelLink}\n </Title>\n )}\n {!props.title ? promoPanelLink : props.children}\n </div>\n <Icon\n className={styles.promopanel__icon}\n svgIcon={props.target === '_blank' ? ArrowUpRight : ArrowRight}\n size={breakpoint >= Breakpoint.md ? IconSize.Small : IconSize.XSmall}\n isHovered={isHovered}\n color={getColor('blueberry', 500)}\n hoverColor={getColor('blueberry', 600)}\n />\n </div>\n );\n};\n\nexport default PromoPanel;\n"],"names":["PromoPanelLink","props","React","PromoPanel","isHovered","hoverRef","useHover","color","titleHtmlMarkup","linkHtmlMarkup","breakpoint","useBreakpoint","promoPanelClasses","classNames","styles","promoPanelLink","illustrationSize","Breakpoint","AnalyticsId","LazyIllustration","Title","Icon","ArrowUpRight","ArrowRight","IconSize","getColor","PromoPanel$1"],"mappings":";;;;;;;;;;;;AAsDA,MAAMA,IAAgD,CAASC,MACzDA,EAAM,gBACDC,EAAM,aAAaD,EAAM,eAAe,EAAE,UAAUA,EAAM,UAAU,IAGzEA,EAAM,mBAAmB,WAEzBC,gBAAAA,EAAA,cAAC,YAAO,MAAM,UAAU,SAASD,EAAM,YAAA,GACpCA,EAAM,QACT,IAIDC,gBAAAA,EAAA,cAAA,KAAA,EAAE,MAAMD,EAAM,MAAM,QAAQA,EAAM,QAAQ,SAASA,EAAM,YACvD,GAAAA,EAAM,QACT,GAIEE,IAAwC,CAASF,MAAA;AACrD,QAAM,EAAE,WAAAG,GAAW,UAAAC,EAAS,IAAIC,EAAyB,GAEnD,EAAE,OAAAC,IAAQ,WAAW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EzC;AAEJ,GAEAC,IAAevB;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<import("./PromoPanel").PromoPanelProps>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
title: string;
|
|
15
|
+
children: string;
|
|
16
|
+
href: string;
|
|
17
|
+
color: "neutral";
|
|
18
|
+
illustration: "Doctor";
|
|
19
|
+
};
|
|
20
|
+
argTypes: {
|
|
21
|
+
title: {
|
|
22
|
+
control: string;
|
|
23
|
+
};
|
|
24
|
+
children: {
|
|
25
|
+
control: string;
|
|
26
|
+
};
|
|
27
|
+
href: {
|
|
28
|
+
control: string;
|
|
29
|
+
};
|
|
30
|
+
color: {
|
|
31
|
+
control: string;
|
|
32
|
+
options: string[];
|
|
33
|
+
};
|
|
34
|
+
illustration: {
|
|
35
|
+
control: string;
|
|
36
|
+
options: string[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
export declare const Default: Story;
|
|
43
|
+
export declare const CustomLinkComponent: Story;
|
|
44
|
+
//# sourceMappingURL=PromoPanel.stories.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { FormMode, FormSize } from '../../constants';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: React.ForwardRefExoticComponent<import("./RadioButton").RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
label: string;
|
|
16
|
+
defaultChecked: false;
|
|
17
|
+
disabled: false;
|
|
18
|
+
mode: FormMode.onwhite;
|
|
19
|
+
size: FormSize.medium;
|
|
20
|
+
name: string;
|
|
21
|
+
value: string;
|
|
22
|
+
required: false;
|
|
23
|
+
};
|
|
24
|
+
argTypes: {
|
|
25
|
+
label: {
|
|
26
|
+
control: string;
|
|
27
|
+
};
|
|
28
|
+
defaultChecked: {
|
|
29
|
+
control: string;
|
|
30
|
+
};
|
|
31
|
+
disabled: {
|
|
32
|
+
control: string;
|
|
33
|
+
};
|
|
34
|
+
mode: {
|
|
35
|
+
control: string;
|
|
36
|
+
options: typeof FormMode;
|
|
37
|
+
};
|
|
38
|
+
size: {
|
|
39
|
+
control: string;
|
|
40
|
+
options: typeof FormSize;
|
|
41
|
+
};
|
|
42
|
+
name: {
|
|
43
|
+
control: string;
|
|
44
|
+
};
|
|
45
|
+
value: {
|
|
46
|
+
control: string;
|
|
47
|
+
};
|
|
48
|
+
required: {
|
|
49
|
+
control: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
export declare const Default: Story;
|
|
56
|
+
export declare const Large: Story;
|
|
57
|
+
//# sourceMappingURL=RadioButton.stories.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("./Select").SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
children: React.JSX.Element;
|
|
15
|
+
label: React.JSX.Element;
|
|
16
|
+
name: string;
|
|
17
|
+
onChange: import("@storybook/addon-actions").HandlerFunction;
|
|
18
|
+
disabled: false;
|
|
19
|
+
autoComplete: string;
|
|
20
|
+
};
|
|
21
|
+
argTypes: {
|
|
22
|
+
disabled: {
|
|
23
|
+
control: string;
|
|
24
|
+
};
|
|
25
|
+
autoComplete: {
|
|
26
|
+
control: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
export declare const Default: Story;
|
|
33
|
+
export declare const DefaultValue: Story;
|
|
34
|
+
export declare const Disabled: Story;
|
|
35
|
+
export declare const Concepts: Story;
|
|
36
|
+
export declare const Modes: Story;
|
|
37
|
+
export declare const Width: Story;
|
|
38
|
+
//# sourceMappingURL=Select.stories.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<import("./ServiceMessage").ServiceMessageProps>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
label: string;
|
|
15
|
+
info: string;
|
|
16
|
+
extraInfo: string;
|
|
17
|
+
dismissable: true;
|
|
18
|
+
expanderOpenFromStart: true;
|
|
19
|
+
urlTitle: string;
|
|
20
|
+
url: string;
|
|
21
|
+
target: "_self";
|
|
22
|
+
closeBtnText: string;
|
|
23
|
+
variant: "alert";
|
|
24
|
+
testId: string;
|
|
25
|
+
};
|
|
26
|
+
argTypes: {
|
|
27
|
+
label: {
|
|
28
|
+
control: string;
|
|
29
|
+
};
|
|
30
|
+
info: {
|
|
31
|
+
control: string;
|
|
32
|
+
};
|
|
33
|
+
extraInfo: {
|
|
34
|
+
control: string;
|
|
35
|
+
};
|
|
36
|
+
dismissable: {
|
|
37
|
+
control: string;
|
|
38
|
+
};
|
|
39
|
+
expanderOpenFromStart: {
|
|
40
|
+
control: string;
|
|
41
|
+
};
|
|
42
|
+
urlTitle: {
|
|
43
|
+
control: string;
|
|
44
|
+
};
|
|
45
|
+
url: {
|
|
46
|
+
control: string;
|
|
47
|
+
};
|
|
48
|
+
target: {
|
|
49
|
+
control: string;
|
|
50
|
+
options: string[];
|
|
51
|
+
};
|
|
52
|
+
closeBtnText: {
|
|
53
|
+
control: string;
|
|
54
|
+
};
|
|
55
|
+
variant: {
|
|
56
|
+
control: string;
|
|
57
|
+
options: string[];
|
|
58
|
+
};
|
|
59
|
+
testId: {
|
|
60
|
+
control: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export default meta;
|
|
65
|
+
type Story = StoryObj<typeof meta>;
|
|
66
|
+
export declare const Default: Story;
|
|
67
|
+
export declare const ReadMore: Story;
|
|
68
|
+
export declare const DismissableWithContent: Story;
|
|
69
|
+
export declare const DismissableLabelOnly: Story;
|
|
70
|
+
export declare const LabelOnly: Story;
|
|
71
|
+
//# sourceMappingURL=ServiceMessage.stories.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<import("./SharingStatus").SharingStatusProps>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
children: string;
|
|
15
|
+
};
|
|
16
|
+
argTypes: {
|
|
17
|
+
children: {
|
|
18
|
+
control: string;
|
|
19
|
+
};
|
|
20
|
+
wrapText: {
|
|
21
|
+
control: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
export declare const Default: Story;
|
|
28
|
+
export declare const WrapText: Story;
|
|
29
|
+
export declare const DifferentIcons: Story;
|
|
30
|
+
export declare const AllColors: Story;
|
|
31
|
+
//# sourceMappingURL=SharingStatus.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","sources":["../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useSize } from '../../hooks/useSize';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\nconst useSafeNumberValue = (initial: number, min: number, max: number): [number, (value: number) => void] => {\n const [value, setValue] = useState(initial);\n\n const setSafeValue = (newValue: number): void => {\n if (newValue > max) {\n setValue(max);\n } else if (newValue < min) {\n setValue(min);\n } else {\n setValue(newValue);\n }\n };\n\n useEffect(() => {\n setSafeValue(initial);\n }, [min, max]);\n\n return [value, setSafeValue];\n};\n\nexport type SliderStep = {\n label?: number | string;\n emojiUniCode?: string;\n};\n\ninterface SliderProps {\n /**\tSets the title of the slider. */\n title?: string;\n /** Adds the left hand label to the element. */\n labelLeft?: string;\n /** Adds the right hand label to the element. */\n labelRight?: string;\n /**\tSets aria-label of the slider. */\n ariaLabel?: string;\n /** Disables the slider element. */\n disabled?: boolean;\n /** Sets the minimum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n minValue?: number;\n /** Sets the maximum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n maxValue?: number;\n /** Function to be called when the value state has changed. */\n onChange?: (value: number) => void;\n /** If set to false will only trigger onChange once a user interaction has been made, updates to this prop will be taken into account - true by default */\n selected?: boolean;\n /** Sets the steps data for the slider */\n steps?: SliderStep[];\n /** Sets the step to move per point in the slider */\n step?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the value of the slider */\n value?: number;\n}\n\nexport const Slider: React.FC<SliderProps> = ({\n title,\n ariaLabel,\n labelLeft,\n labelRight,\n disabled = false,\n onChange,\n steps,\n step = 1,\n minValue = 0,\n maxValue = steps ? steps.length - 1 : 100,\n selected = true,\n testId,\n value,\n}) => {\n const [isMoving, setIsMoving] = useState(false);\n const [selectedState, setSelectedState] = useState(typeof value === 'undefined' ? selected : true);\n const [valueState, setValueState] = useSafeNumberValue(\n typeof value === 'undefined' ? (maxValue - minValue) / 2 + minValue : value,\n minValue,\n maxValue\n );\n\n const titleId = useUuid();\n const labelLeftId = useUuid();\n const labelRightId = useUuid();\n const trackRef = useRef<HTMLDivElement>(null);\n const markerRef = useRef<HTMLDivElement>(null);\n const { width: trackWidth } = useSize(trackRef) || { width: 0 };\n const largeStep = maxValue / 10;\n\n useEffect(() => {\n const handlePointerUp = (): void => {\n setIsMoving(false);\n };\n\n document.addEventListener('pointerup', handlePointerUp);\n\n return () => {\n document.removeEventListener('pointerup', handlePointerUp);\n };\n }, []);\n\n const getValueBasedOnMarkerPosition = (markerPosition: number): number => {\n const trackPosition = trackRef.current?.getBoundingClientRect().x ?? 0;\n\n // Calculate the normalized position (0 to 1) of the marker along the track\n const normalizedPosition = (markerPosition - trackPosition) / trackWidth;\n const valueRange = maxValue - minValue;\n // Calculate the value without considering the step\n let value = normalizedPosition * valueRange + minValue;\n // Adjust the value to account for the step increment\n const stepCount = Math.round(value / step);\n value = stepCount * step;\n value = Math.max(minValue, Math.min(maxValue, value));\n\n return value;\n };\n\n useEffect(() => {\n const handlePointerMove = (e: PointerEvent): void => {\n if (!disabled && isMoving) {\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n }\n };\n\n document.addEventListener('pointermove', handlePointerMove);\n\n return () => {\n document.removeEventListener('pointermove', handlePointerMove);\n };\n }, [isMoving]);\n\n useEffect(() => {\n if (value !== valueState && typeof value !== 'undefined') {\n handleSelected();\n setValueState(value);\n }\n }, [value]);\n\n useEffect(() => {\n if (!disabled && selectedState && onChange) {\n onChange(valueState);\n }\n }, [valueState, selectedState]);\n\n useEffect(() => {\n if (typeof value === 'undefined' && selected !== selectedState) {\n setSelectedState(selected);\n }\n }, [selected]);\n\n const handleSelected = (): void => {\n if (selectedState === false) {\n setSelectedState(true);\n }\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n let flag = false;\n\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n setValueState(valueState - step);\n flag = true;\n break;\n case 'PageDown':\n setValueState(valueState - largeStep);\n flag = true;\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n setValueState(valueState + step);\n flag = true;\n break;\n case 'PageUp':\n setValueState(valueState + largeStep);\n flag = true;\n break;\n case 'Home':\n setValueState(minValue);\n flag = true;\n break;\n case 'End':\n setValueState(maxValue);\n flag = true;\n break;\n default:\n break;\n }\n\n if (flag) {\n handleSelected();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleTrackClick: React.MouseEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n markerRef.current?.focus();\n };\n\n const handlePointerDown: React.PointerEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n setIsMoving(true);\n handleSelected();\n\n e.preventDefault();\n e.stopPropagation();\n\n markerRef.current?.focus();\n };\n\n const markerXPos = maxValue !== minValue ? (trackWidth / (maxValue - minValue)) * (valueState - minValue) : 0;\n\n const getAriaValueText = (): string | undefined => {\n const stepIndex = steps ? Math.round((valueState - minValue) / step) : null;\n\n if (steps && stepIndex !== null && stepIndex >= 0 && stepIndex < steps.length) {\n const step = steps[stepIndex];\n const emojiCode = step.emojiUniCode;\n const label = typeof step.label !== 'undefined' ? step.label.toString() : undefined;\n\n return emojiCode && label ? `${emojiCode} ${label}` : emojiCode || label;\n }\n\n return undefined;\n };\n\n const getAriaLabeledById = (): string | undefined => {\n if (title && labelLeft && labelRight) {\n return [titleId, labelLeftId, labelRightId].join(' ');\n }\n if (title && labelLeft) {\n return [titleId, labelLeftId].join(' ');\n }\n if (title && labelRight) {\n return [titleId, labelRightId].join(' ');\n }\n if (title) {\n return titleId;\n }\n };\n\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: ariaLabel,\n id: getAriaLabeledById(),\n prefer: 'label',\n });\n\n const getXPositionStyling = (index: number, stepsLength: number): { left: string } => {\n return { left: `${(index / (stepsLength - 1)) * 100}%` };\n };\n\n const renderEmojies = (): React.ReactNode => {\n return (\n <div className={styles['slider__emoji-container']}>\n {steps?.map((step, index) => {\n return (\n step.emojiUniCode && (\n <div\n aria-hidden={true}\n key={'emoji' + index}\n className={styles['slider__emoji']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.emojiUniCode}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n const renderSteps = (): React.ReactNode => {\n return steps?.map((_step, index) => {\n return <div key={'step' + index} className={styles['slider__track__step']} style={getXPositionStyling(index, steps.length)} />;\n });\n };\n\n const renderStepLabels = (): React.ReactNode => {\n return (\n <div className={styles['slider__value-container']}>\n {steps?.map((step, index) => {\n return (\n typeof step.label !== 'undefined' && (\n <div\n aria-hidden={true}\n key={'label' + index}\n className={styles['slider__value']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.label}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n return (\n <div className={styles.slider} data-testid={testId} data-analyticsid={AnalyticsId.Slider}>\n {title && (\n <Title className={styles['slider__title']} htmlMarkup={'h3'} margin={0} appearance={'title3'} id={titleId}>\n {title}\n </Title>\n )}\n <div className={styles['slider__content-container']}>\n {renderEmojies()}\n {/* Komponenten er tilgjengelig for mus/keyboard gjennom bruk av slideren */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n ref={trackRef}\n className={classNames(styles['slider__track-wrapper'], disabled && styles['slider__track-wrapper--disabled'])}\n onClick={handleTrackClick}\n onPointerDown={handlePointerDown}\n >\n <div className={classNames(styles.slider__track, disabled && styles['slider__track--disabled'])}>{renderSteps()}</div>\n <div\n role={disabled ? undefined : 'slider'}\n ref={markerRef}\n className={classNames(styles.slider__marker, {\n [styles['slider__marker--disabled']]: disabled,\n [styles['slider__marker--selected']]: selectedState,\n })}\n style={{\n left: `${markerXPos}px`,\n }}\n onKeyDown={handleKeyDown}\n aria-valuenow={valueState}\n aria-valuetext={getAriaValueText()}\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n tabIndex={disabled ? undefined : 0}\n aria-disabled={disabled}\n {...ariaLabelAttributes}\n />\n </div>\n {renderStepLabels()}\n </div>\n {(labelLeft || labelRight) && (\n <span className={styles.slider__options}>\n <span id={labelLeftId}>{labelLeft}</span>\n <span id={labelRightId}>{labelRight}</span>\n </span>\n )}\n </div>\n );\n};\n\nexport default Slider;\n"],"names":["useSafeNumberValue","initial","min","max","value","setValue","useState","setSafeValue","newValue","useEffect","Slider","title","ariaLabel","labelLeft","labelRight","disabled","onChange","steps","step","minValue","maxValue","selected","testId","isMoving","setIsMoving","selectedState","setSelectedState","valueState","setValueState","titleId","useUuid","labelLeftId","labelRightId","trackRef","useRef","markerRef","trackWidth","useSize","largeStep","handlePointerUp","getValueBasedOnMarkerPosition","markerPosition","trackPosition","_a","normalizedPosition","valueRange","handlePointerMove","handleSelected","handleKeyDown","e","flag","handleTrackClick","handlePointerDown","markerXPos","getAriaValueText","stepIndex","emojiCode","label","ariaLabelAttributes","getAriaLabelAttributes","getXPositionStyling","index","stepsLength","renderEmojies","React","styles","renderSteps","_step","renderStepLabels","AnalyticsId","Title","classNames","Slider$1"],"mappings":";;;;;;;;AAYA,MAAMA,KAAqB,CAACC,GAAiBC,GAAaC,MAAm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gB2B,EAAiB;AAAA,QACjC,iBAAenC;AAAA,QACf,iBAAeC;AAAA,QACf,UAAUL,IAAW,SAAY;AAAA,QACjC,iBAAeA;AAAA,QACd,GAAG2C;AAAA,MAAA;AAAA,IACN;AAAA,EACF,GACCU,GACH,IACEvD,KAAaC,MACbkD,gBAAAA,EAAA,cAAC,QAAK,EAAA,WAAWC,EAAO,gBAAA,mCACrB,QAAK,EAAA,IAAIlC,EAAc,GAAAlB,CAAU,GAClCmD,gBAAAA,EAAA,cAAC,UAAK,IAAIhC,EAAA,GAAelB,CAAW,CACtC,CAEJ;AAEJ,GAEA0D,KAAe9D;"}
|
|
1
|
+
{"version":3,"file":"Slider.js","sources":["../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useSize } from '../../hooks/useSize';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\nconst useSafeNumberValue = (initial: number, min: number, max: number): [number, (value: number) => void] => {\n const [value, setValue] = useState(initial);\n\n const setSafeValue = (newValue: number): void => {\n if (newValue > max) {\n setValue(max);\n } else if (newValue < min) {\n setValue(min);\n } else {\n setValue(newValue);\n }\n };\n\n useEffect(() => {\n setSafeValue(initial);\n }, [min, max]);\n\n return [value, setSafeValue];\n};\n\nexport type SliderStep = {\n label?: number | string;\n emojiUniCode?: string;\n};\n\nexport interface SliderProps {\n /**\tSets the title of the slider. */\n title?: string;\n /** Adds the left hand label to the element. */\n labelLeft?: string;\n /** Adds the right hand label to the element. */\n labelRight?: string;\n /**\tSets aria-label of the slider. */\n ariaLabel?: string;\n /** Disables the slider element. */\n disabled?: boolean;\n /** Sets the minimum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n minValue?: number;\n /** Sets the maximum allowed value on the slider - this overrides the use of steps prop for minValue/maxValue. */\n maxValue?: number;\n /** Function to be called when the value state has changed. */\n onChange?: (value: number) => void;\n /** If set to false will only trigger onChange once a user interaction has been made, updates to this prop will be taken into account - true by default */\n selected?: boolean;\n /** Sets the steps data for the slider */\n steps?: SliderStep[];\n /** Sets the step to move per point in the slider */\n step?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the value of the slider */\n value?: number;\n}\n\nexport const Slider: React.FC<SliderProps> = ({\n title,\n ariaLabel,\n labelLeft,\n labelRight,\n disabled = false,\n onChange,\n steps,\n step = 1,\n minValue = 0,\n maxValue = steps ? steps.length - 1 : 100,\n selected = true,\n testId,\n value,\n}) => {\n const [isMoving, setIsMoving] = useState(false);\n const [selectedState, setSelectedState] = useState(typeof value === 'undefined' ? selected : true);\n const [valueState, setValueState] = useSafeNumberValue(\n typeof value === 'undefined' ? (maxValue - minValue) / 2 + minValue : value,\n minValue,\n maxValue\n );\n\n const titleId = useUuid();\n const labelLeftId = useUuid();\n const labelRightId = useUuid();\n const trackRef = useRef<HTMLDivElement>(null);\n const markerRef = useRef<HTMLDivElement>(null);\n const { width: trackWidth } = useSize(trackRef) || { width: 0 };\n const largeStep = maxValue / 10;\n\n useEffect(() => {\n const handlePointerUp = (): void => {\n setIsMoving(false);\n };\n\n document.addEventListener('pointerup', handlePointerUp);\n\n return () => {\n document.removeEventListener('pointerup', handlePointerUp);\n };\n }, []);\n\n const getValueBasedOnMarkerPosition = (markerPosition: number): number => {\n const trackPosition = trackRef.current?.getBoundingClientRect().x ?? 0;\n\n // Calculate the normalized position (0 to 1) of the marker along the track\n const normalizedPosition = (markerPosition - trackPosition) / trackWidth;\n const valueRange = maxValue - minValue;\n // Calculate the value without considering the step\n let value = normalizedPosition * valueRange + minValue;\n // Adjust the value to account for the step increment\n const stepCount = Math.round(value / step);\n value = stepCount * step;\n value = Math.max(minValue, Math.min(maxValue, value));\n\n return value;\n };\n\n useEffect(() => {\n const handlePointerMove = (e: PointerEvent): void => {\n if (!disabled && isMoving) {\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n }\n };\n\n document.addEventListener('pointermove', handlePointerMove);\n\n return () => {\n document.removeEventListener('pointermove', handlePointerMove);\n };\n }, [isMoving]);\n\n useEffect(() => {\n if (value !== valueState && typeof value !== 'undefined') {\n handleSelected();\n setValueState(value);\n }\n }, [value]);\n\n useEffect(() => {\n if (!disabled && selectedState && onChange) {\n onChange(valueState);\n }\n }, [valueState, selectedState]);\n\n useEffect(() => {\n if (typeof value === 'undefined' && selected !== selectedState) {\n setSelectedState(selected);\n }\n }, [selected]);\n\n const handleSelected = (): void => {\n if (selectedState === false) {\n setSelectedState(true);\n }\n };\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n let flag = false;\n\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowDown':\n setValueState(valueState - step);\n flag = true;\n break;\n case 'PageDown':\n setValueState(valueState - largeStep);\n flag = true;\n break;\n case 'ArrowRight':\n case 'ArrowUp':\n setValueState(valueState + step);\n flag = true;\n break;\n case 'PageUp':\n setValueState(valueState + largeStep);\n flag = true;\n break;\n case 'Home':\n setValueState(minValue);\n flag = true;\n break;\n case 'End':\n setValueState(maxValue);\n flag = true;\n break;\n default:\n break;\n }\n\n if (flag) {\n handleSelected();\n e.preventDefault();\n e.stopPropagation();\n }\n };\n\n const handleTrackClick: React.MouseEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n const newValue = getValueBasedOnMarkerPosition(e.clientX);\n setValueState(newValue);\n markerRef.current?.focus();\n };\n\n const handlePointerDown: React.PointerEventHandler<HTMLDivElement> = e => {\n if (disabled) return;\n\n setIsMoving(true);\n handleSelected();\n\n e.preventDefault();\n e.stopPropagation();\n\n markerRef.current?.focus();\n };\n\n const markerXPos = maxValue !== minValue ? (trackWidth / (maxValue - minValue)) * (valueState - minValue) : 0;\n\n const getAriaValueText = (): string | undefined => {\n const stepIndex = steps ? Math.round((valueState - minValue) / step) : null;\n\n if (steps && stepIndex !== null && stepIndex >= 0 && stepIndex < steps.length) {\n const step = steps[stepIndex];\n const emojiCode = step.emojiUniCode;\n const label = typeof step.label !== 'undefined' ? step.label.toString() : undefined;\n\n return emojiCode && label ? `${emojiCode} ${label}` : emojiCode || label;\n }\n\n return undefined;\n };\n\n const getAriaLabeledById = (): string | undefined => {\n if (title && labelLeft && labelRight) {\n return [titleId, labelLeftId, labelRightId].join(' ');\n }\n if (title && labelLeft) {\n return [titleId, labelLeftId].join(' ');\n }\n if (title && labelRight) {\n return [titleId, labelRightId].join(' ');\n }\n if (title) {\n return titleId;\n }\n };\n\n const ariaLabelAttributes = getAriaLabelAttributes({\n label: ariaLabel,\n id: getAriaLabeledById(),\n prefer: 'label',\n });\n\n const getXPositionStyling = (index: number, stepsLength: number): { left: string } => {\n return { left: `${(index / (stepsLength - 1)) * 100}%` };\n };\n\n const renderEmojies = (): React.ReactNode => {\n return (\n <div className={styles['slider__emoji-container']}>\n {steps?.map((step, index) => {\n return (\n step.emojiUniCode && (\n <div\n aria-hidden={true}\n key={'emoji' + index}\n className={styles['slider__emoji']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.emojiUniCode}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n const renderSteps = (): React.ReactNode => {\n return steps?.map((_step, index) => {\n return <div key={'step' + index} className={styles['slider__track__step']} style={getXPositionStyling(index, steps.length)} />;\n });\n };\n\n const renderStepLabels = (): React.ReactNode => {\n return (\n <div className={styles['slider__value-container']}>\n {steps?.map((step, index) => {\n return (\n typeof step.label !== 'undefined' && (\n <div\n aria-hidden={true}\n key={'label' + index}\n className={styles['slider__value']}\n style={getXPositionStyling(index, steps.length)}\n >\n {step.label}\n </div>\n )\n );\n })}\n </div>\n );\n };\n\n return (\n <div className={styles.slider} data-testid={testId} data-analyticsid={AnalyticsId.Slider}>\n {title && (\n <Title className={styles['slider__title']} htmlMarkup={'h3'} margin={0} appearance={'title3'} id={titleId}>\n {title}\n </Title>\n )}\n <div className={styles['slider__content-container']}>\n {renderEmojies()}\n {/* Komponenten er tilgjengelig for mus/keyboard gjennom bruk av slideren */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div\n ref={trackRef}\n className={classNames(styles['slider__track-wrapper'], disabled && styles['slider__track-wrapper--disabled'])}\n onClick={handleTrackClick}\n onPointerDown={handlePointerDown}\n >\n <div className={classNames(styles.slider__track, disabled && styles['slider__track--disabled'])}>{renderSteps()}</div>\n <div\n role={disabled ? undefined : 'slider'}\n ref={markerRef}\n className={classNames(styles.slider__marker, {\n [styles['slider__marker--disabled']]: disabled,\n [styles['slider__marker--selected']]: selectedState,\n })}\n style={{\n left: `${markerXPos}px`,\n }}\n onKeyDown={handleKeyDown}\n aria-valuenow={valueState}\n aria-valuetext={getAriaValueText()}\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n tabIndex={disabled ? undefined : 0}\n aria-disabled={disabled}\n {...ariaLabelAttributes}\n />\n </div>\n {renderStepLabels()}\n </div>\n {(labelLeft || labelRight) && (\n <span className={styles.slider__options}>\n <span id={labelLeftId}>{labelLeft}</span>\n <span id={labelRightId}>{labelRight}</span>\n </span>\n )}\n </div>\n );\n};\n\nexport default Slider;\n"],"names":["useSafeNumberValue","initial","min","max","value","setValue","useState","setSafeValue","newValue","useEffect","Slider","title","ariaLabel","labelLeft","labelRight","disabled","onChange","steps","step","minValue","maxValue","selected","testId","isMoving","setIsMoving","selectedState","setSelectedState","valueState","setValueState","titleId","useUuid","labelLeftId","labelRightId","trackRef","useRef","markerRef","trackWidth","useSize","largeStep","handlePointerUp","getValueBasedOnMarkerPosition","markerPosition","trackPosition","_a","normalizedPosition","valueRange","handlePointerMove","handleSelected","handleKeyDown","e","flag","handleTrackClick","handlePointerDown","markerXPos","getAriaValueText","stepIndex","emojiCode","label","ariaLabelAttributes","getAriaLabelAttributes","getXPositionStyling","index","stepsLength","renderEmojies","React","styles","renderSteps","_step","renderStepLabels","Analytic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AM,GAAG4B,CAAU;AAAA,QACrB;AAAA,QACA,WAAWL;AAAA,QACX,iBAAerB;AAAA,QACf,kBAAgB2B,EAAiB;AAAA,QACjC,iBAAenC;AAAA,QACf,iBAAeC;AAAA,QACf,UAAUL,IAAW,SAAY;AAAA,QACjC,iBAAeA;AAAA,QACd,GAAG2C;AAAA,MAAA;AAAA,IACN;AAAA,EACF,GACCU,GACH,IACEvD,KAAaC,MACbkD,gBAAAA,EAAA,cAAC,QAAK,EAAA,WAAWC,EAAO,gBAAA,mCACrB,QAAK,EAAA,IAAIlC,EAAc,GAAAlB,CAAU,GAClCmD,gBAAAA,EAAA,cAAC,UAAK,IAAIhC,EAAA,GAAelB,CAAW,CACtC,CAEJ;AAEJ,GAEA0D,KAAe9D;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<import("./Slider").SliderProps>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
title: string;
|
|
15
|
+
disabled: false;
|
|
16
|
+
};
|
|
17
|
+
argTypes: {
|
|
18
|
+
title: {
|
|
19
|
+
control: string;
|
|
20
|
+
};
|
|
21
|
+
labelLeft: {
|
|
22
|
+
control: string;
|
|
23
|
+
};
|
|
24
|
+
labelRight: {
|
|
25
|
+
control: string;
|
|
26
|
+
};
|
|
27
|
+
ariaLabel: {
|
|
28
|
+
control: string;
|
|
29
|
+
};
|
|
30
|
+
disabled: {
|
|
31
|
+
control: string;
|
|
32
|
+
};
|
|
33
|
+
selected: {
|
|
34
|
+
control: string;
|
|
35
|
+
};
|
|
36
|
+
step: {
|
|
37
|
+
control: string;
|
|
38
|
+
};
|
|
39
|
+
value: {
|
|
40
|
+
control: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default meta;
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
export declare const Default: Story;
|
|
47
|
+
export declare const NotSelected: Story;
|
|
48
|
+
export declare const Steps: Story;
|
|
49
|
+
export declare const StepLabel: Story;
|
|
50
|
+
export declare const StepEmoji: Story;
|
|
51
|
+
export declare const CombinedData: Story;
|
|
52
|
+
//# sourceMappingURL=Slider.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spacer.js","sources":["../../../src/components/Spacer/Spacer.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { SpacerSizes } from './../../theme/spacers';\nimport { AnalyticsId } from '../../constants';\n\nimport spacerStyles from './styles.module.scss';\n\
|
|
1
|
+
{"version":3,"file":"Spacer.js","sources":["../../../src/components/Spacer/Spacer.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { SpacerSizes } from './../../theme/spacers';\nimport { AnalyticsId } from '../../constants';\n\nimport spacerStyles from './styles.module.scss';\n\nexport interface SpacerProps {\n /** Sets the size of the spacer. */\n size?: SpacerSizes;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst Spacer = React.forwardRef(function SpacerForwardedRef(props: SpacerProps, ref: React.ForwardedRef<HTMLElement>) {\n const { size = 's', className, testId } = props;\n const spacerClasses = classNames(\n spacerStyles.spacer,\n {\n [spacerStyles['spacer--4xs']]: size === '4xs',\n [spacerStyles['spacer--3xs']]: size === '3xs',\n [spacerStyles['spacer--2xs']]: size === '2xs',\n [spacerStyles['spacer--xs']]: size === 'xs',\n [spacerStyles['spacer--s']]: size === 's',\n [spacerStyles['spacer--m']]: size === 'm',\n [spacerStyles['spacer--l']]: size === 'l',\n [spacerStyles['spacer--xl']]: size === 'xl',\n [spacerStyles['spacer--2xl']]: size === '2xl',\n [spacerStyles['spacer--3xl']]: size === '3xl',\n [spacerStyles['spacer--4xl']]: size === '4xl',\n [spacerStyles['spacer--5xl']]: size === '5xl',\n [spacerStyles['spacer--6xl']]: size === '6xl',\n },\n className\n );\n\n return <span className={spacerClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Spacer}></span>;\n});\n\nexport default Spacer;\n"],"names":["Spacer","React","props","ref","size","className","testId","spacerClasses","classNames","spacerStyles","AnalyticsId","Spacer$1"],"mappings":";;;;AAkBA,MAAMA,IAASC,EAAM,WAAW,SAA4BC,GAAoBC,GAAsC;AACpH,QAAM,EAAE,MAAAC,IAAO,KAAK,WAAAC,GAAW,QAAAC,MAAWJ,GACpCK,IAAgBC;AAAA,IACpBC,EAAa;AAAA,IACb;AAAA,MACE,CAACA,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,YAAY,CAAC,GAAGL,MAAS;AAAA,MACvC,CAACK,EAAa,WAAW,CAAC,GAAGL,MAAS;AAAA,MACtC,CAACK,EAAa,WAAW,CAAC,GAAGL,MAAS;AAAA,MACtC,CAACK,EAAa,WAAW,CAAC,GAAGL,MAAS;AAAA,MACtC,CAACK,EAAa,YAAY,CAAC,GAAGL,MAAS;AAAA,MACvC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,MACxC,CAACK,EAAa,aAAa,CAAC,GAAGL,MAAS;AAAA,IAC1C;AAAA,IACAC;AAAA,EAAA;AAGK,SAAAJ,gBAAAA,EAAA,cAAC,UAAK,WAAWM,GAAe,KAAAJ,GAAU,eAAaG,GAAQ,oBAAkBI,EAAY,OAAQ,CAAA;AAC9G,CAAC,GAEDC,IAAeX;"}
|