@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,134 +1,137 @@
|
|
|
1
|
-
import i, { useRef as
|
|
2
|
-
import
|
|
3
|
-
import { AnalyticsId as U, ZIndex as
|
|
4
|
-
import { useExpand as
|
|
5
|
-
import { useHover as
|
|
6
|
-
import { useSticky as
|
|
7
|
-
import { useUuid as
|
|
8
|
-
import { mergeRefs as
|
|
9
|
-
import { isElementInViewport as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { renderListHeader as
|
|
1
|
+
import i, { useRef as z, useState as A, useEffect as V } from "react";
|
|
2
|
+
import C from "classnames";
|
|
3
|
+
import { AnalyticsId as U, ZIndex as P } from "../../constants.js";
|
|
4
|
+
import { useExpand as Z } from "../../hooks/useExpand.js";
|
|
5
|
+
import { useHover as q } from "../../hooks/useHover.js";
|
|
6
|
+
import { useSticky as B } from "../../hooks/useSticky.js";
|
|
7
|
+
import { useUuid as F } from "../../hooks/useUuid.js";
|
|
8
|
+
import { mergeRefs as G } from "../../utils/refs.js";
|
|
9
|
+
import { isElementInViewport as K } from "../../utils/viewport.js";
|
|
10
|
+
import Q from "../Icons/ChevronDown.js";
|
|
11
|
+
import X from "../Icons/ChevronUp.js";
|
|
12
|
+
import { renderListHeader as Y } from "../ListHeader/ListHeader.js";
|
|
13
13
|
import n from "./styles.module.scss";
|
|
14
|
-
const
|
|
14
|
+
const W = i.forwardRef((d, g) => {
|
|
15
15
|
const {
|
|
16
|
-
id:
|
|
17
|
-
children:
|
|
18
|
-
padding:
|
|
19
|
-
color:
|
|
20
|
-
className:
|
|
21
|
-
icon:
|
|
16
|
+
id: x,
|
|
17
|
+
children: y,
|
|
18
|
+
padding: _ = !0,
|
|
19
|
+
color: h = "neutral",
|
|
20
|
+
className: L = "",
|
|
21
|
+
icon: I,
|
|
22
22
|
large: l = !1,
|
|
23
23
|
title: E,
|
|
24
|
-
titleHtmlMarkup:
|
|
25
|
-
expanded:
|
|
26
|
-
sticky:
|
|
27
|
-
testId:
|
|
28
|
-
handleExpanderClick:
|
|
29
|
-
onExpand:
|
|
30
|
-
renderChildrenWhenClosed:
|
|
31
|
-
variant:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
[n["expander-list__item--
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
titleHtmlMarkup: N = "span",
|
|
25
|
+
expanded: w = !1,
|
|
26
|
+
sticky: $,
|
|
27
|
+
testId: o,
|
|
28
|
+
handleExpanderClick: k,
|
|
29
|
+
onExpand: p,
|
|
30
|
+
renderChildrenWhenClosed: R,
|
|
31
|
+
variant: c = "line",
|
|
32
|
+
zIndex: H
|
|
33
|
+
} = d, [r] = Z(w, p), f = z(null), s = z(null), { isHovered: t } = q(s), { isOutsideWindow: e, isLeavingWindow: a, offsetHeight: m, contentWidth: T } = B(f, s), u = $ && r && e, j = typeof E == "object", D = C(L, {
|
|
34
|
+
[n["expander-list__item--" + c]]: c,
|
|
35
|
+
[n["expander-list__item--jsx"]]: j
|
|
36
|
+
}), J = C(n["expander-list-link"], n[`expander-list-link--${h}`], {
|
|
37
|
+
[n["expander-list-link--fill"]]: c === "fill",
|
|
37
38
|
[n["expander-list-link--closed"]]: !r,
|
|
38
39
|
[n["expander-list-link--large"]]: l,
|
|
39
|
-
[n["expander-list-link--jsx"]]:
|
|
40
|
+
[n["expander-list-link--jsx"]]: j,
|
|
40
41
|
[n["expander-list-link--sticky"]]: u && !a,
|
|
41
42
|
[n["expander-list-link--absolute"]]: u && a
|
|
42
|
-
}),
|
|
43
|
-
if (!
|
|
43
|
+
}), M = () => {
|
|
44
|
+
if (!R && !r)
|
|
44
45
|
return null;
|
|
45
|
-
const
|
|
46
|
+
const O = C(
|
|
46
47
|
n["expander-list-link__main-content"],
|
|
47
48
|
r && n["expander-list-link__main-content--expanded"],
|
|
48
|
-
|
|
49
|
+
_ ? n["expander-list-link__main-content--padding"] : ""
|
|
49
50
|
);
|
|
50
|
-
return /* @__PURE__ */ i.createElement("div", { className:
|
|
51
|
+
return /* @__PURE__ */ i.createElement("div", { className: O }, y);
|
|
51
52
|
};
|
|
52
53
|
return /* @__PURE__ */ i.createElement(
|
|
53
54
|
"li",
|
|
54
55
|
{
|
|
55
|
-
className:
|
|
56
|
-
ref:
|
|
57
|
-
style: { paddingTop: u &&
|
|
56
|
+
className: D,
|
|
57
|
+
ref: G([g, f]),
|
|
58
|
+
style: { paddingTop: u && m ? `${m}px` : void 0 }
|
|
58
59
|
},
|
|
59
60
|
/* @__PURE__ */ i.createElement(
|
|
60
61
|
"button",
|
|
61
62
|
{
|
|
62
63
|
type: "button",
|
|
63
|
-
id:
|
|
64
|
-
onClick:
|
|
65
|
-
"data-testid":
|
|
64
|
+
id: x,
|
|
65
|
+
onClick: k,
|
|
66
|
+
"data-testid": o,
|
|
66
67
|
"data-analyticsid": U.ExpanderListExpander,
|
|
67
|
-
className:
|
|
68
|
+
className: J,
|
|
68
69
|
ref: s,
|
|
69
70
|
"aria-expanded": r,
|
|
70
71
|
style: {
|
|
71
|
-
zIndex: t || u ?
|
|
72
|
-
width: u &&
|
|
72
|
+
zIndex: t || u ? H : void 0,
|
|
73
|
+
width: u && T ? `${T}px` : void 0
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
|
-
|
|
76
|
+
Y(E, N, t, l ? "large" : "medium", r ? X : Q, I)
|
|
76
77
|
),
|
|
77
|
-
|
|
78
|
+
M()
|
|
78
79
|
);
|
|
79
|
-
}), v = (d) => i.isValidElement(d) && d.type ===
|
|
80
|
+
}), v = (d) => i.isValidElement(d) && d.type === W, b = i.forwardRef((d, g) => {
|
|
80
81
|
const {
|
|
81
|
-
children:
|
|
82
|
-
childPadding:
|
|
83
|
-
large:
|
|
84
|
-
renderChildrenWhenClosed:
|
|
85
|
-
color:
|
|
86
|
-
className:
|
|
82
|
+
children: x,
|
|
83
|
+
childPadding: y = !0,
|
|
84
|
+
large: _,
|
|
85
|
+
renderChildrenWhenClosed: h = !1,
|
|
86
|
+
color: L,
|
|
87
|
+
className: I = "",
|
|
87
88
|
accordion: l = !1,
|
|
88
89
|
sticky: E = !1,
|
|
89
|
-
testId:
|
|
90
|
-
variant:
|
|
91
|
-
|
|
90
|
+
testId: N,
|
|
91
|
+
variant: w,
|
|
92
|
+
zIndex: $ = P.ExpanderTrigger
|
|
93
|
+
} = d, [o, k] = A(), [p, R] = A(), c = F(), H = C(n["expander-list"], I);
|
|
92
94
|
function r(s, t) {
|
|
93
95
|
k((e) => l ? { [t]: !(e != null && e[t]) } : { ...e, [t]: !(e != null && e[t]) }), R(s.currentTarget);
|
|
94
96
|
}
|
|
95
|
-
const f = (s) => `${
|
|
97
|
+
const f = (s) => `${c}-${s}`;
|
|
96
98
|
return V(() => {
|
|
97
|
-
l && p && !
|
|
99
|
+
l && p && !K(p) && p.scrollIntoView();
|
|
98
100
|
}, [l, p]), V(() => {
|
|
99
101
|
var t;
|
|
100
|
-
const s = (t = i.Children.map(
|
|
102
|
+
const s = (t = i.Children.map(x, (e) => {
|
|
101
103
|
if (v(e))
|
|
102
104
|
return e;
|
|
103
|
-
})) == null ? void 0 : t.reduce((e, a,
|
|
105
|
+
})) == null ? void 0 : t.reduce((e, a, m) => (typeof a.props.expanded < "u" && (e[f(m)] = a.props.expanded), e), {});
|
|
104
106
|
k({ ...o, ...s });
|
|
105
|
-
}, [
|
|
107
|
+
}, [x]), /* @__PURE__ */ i.createElement("ul", { className: H, ref: g, "data-testid": N, "data-analyticsid": U.ExpanderList }, i.Children.map(x, (s, t) => {
|
|
106
108
|
if (v(s)) {
|
|
107
109
|
const e = f(t), a = o == null ? void 0 : o[e];
|
|
108
110
|
return i.cloneElement(s, {
|
|
109
111
|
id: e,
|
|
110
112
|
key: t,
|
|
111
113
|
expanded: a,
|
|
112
|
-
padding:
|
|
113
|
-
color:
|
|
114
|
-
large:
|
|
114
|
+
padding: y,
|
|
115
|
+
color: L,
|
|
116
|
+
large: _,
|
|
115
117
|
sticky: E,
|
|
116
118
|
"aria-expanded": a,
|
|
117
119
|
className: n["expander-list__item"],
|
|
118
|
-
handleExpanderClick: (
|
|
119
|
-
renderChildrenWhenClosed:
|
|
120
|
-
variant:
|
|
120
|
+
handleExpanderClick: (m) => r(m, `${c}-${t}`),
|
|
121
|
+
renderChildrenWhenClosed: h,
|
|
122
|
+
variant: w,
|
|
123
|
+
zIndex: $
|
|
121
124
|
});
|
|
122
125
|
}
|
|
123
126
|
return s;
|
|
124
127
|
}));
|
|
125
128
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
129
|
+
b.displayName = "ExpanderList";
|
|
130
|
+
b.Expander = W;
|
|
131
|
+
W.displayName = "ExpanderList.Expander";
|
|
132
|
+
const me = b;
|
|
130
133
|
export {
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
b as ExpanderList,
|
|
135
|
+
me as default
|
|
133
136
|
};
|
|
134
137
|
//# sourceMappingURL=ExpanderList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpanderList.js","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useHover } from '../../hooks/useHover';\nimport { useSticky } from '../../hooks/useSticky';\nimport { useUuid } from '../../hooks/useUuid';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { ListHeaderType, renderListHeader } from '../ListHeader/ListHeader';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = PaletteNames;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ListHeader?: ListHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the link list background color on hover. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Stick expander trigger to top of screen while scrolling down */\n sticky?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'sticky' | 'variant'>;\n\nconst Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n sticky,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered } = useHover(triggerRef);\n\n const { isOutsideWindow, isLeavingWindow, offsetHeight, contentWidth } = useSticky(expanderRef, triggerRef);\n const isSticky = sticky && isExpanded && isOutsideWindow;\n const isJsxTitle = typeof title === 'object';\n\n const itemClasses = classNames(className, {\n [expanderListStyles['expander-list__item--' + variant]]: variant,\n [expanderListStyles['expander-list__item--jsx']]: isJsxTitle,\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles['expander-list-link--fill']]: variant === 'fill',\n [expanderListStyles['expander-list-link--closed']]: !isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles['expander-list-link--jsx']]: isJsxTitle,\n [expanderListStyles['expander-list-link--sticky']]: isSticky && !isLeavingWindow,\n [expanderListStyles['expander-list-link--absolute']]: isSticky && isLeavingWindow,\n });\n\n const renderContent = () => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(\n expanderListStyles['expander-list-link__main-content'],\n isExpanded && expanderListStyles['expander-list-link__main-content--expanded'],\n padding ? expanderListStyles['expander-list-link__main-content--padding'] : ''\n );\n\n return <div className={mainContentClasses}>{children}</div>;\n };\n\n return (\n <li\n className={itemClasses}\n ref={mergeRefs([ref, expanderRef])}\n style={{ paddingTop: isSticky && offsetHeight ? `${offsetHeight}px` : undefined }}\n >\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isHovered || isSticky ? ZIndex.ExpanderTrigger : undefined,\n width: isSticky && contentWidth ? `${contentWidth}px` : undefined,\n }}\n >\n {renderListHeader(title, titleHtmlMarkup, isHovered, large ? 'large' : 'medium', isExpanded ? ChevronUp : ChevronDown, icon)}\n </button>\n {renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: {} | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color,\n className = '',\n accordion = false,\n sticky = false,\n testId,\n variant,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const uuid = useUuid();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className);\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number) => `${uuid}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n sticky,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${uuid}-${index}`),\n renderChildrenWhenClosed,\n variant,\n });\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n"],"names":["Expander","React","props","ref","id","children","padding","color","className","icon","large","title","titleHtmlMarkup","expanded","sticky","testId","handleExpanderClick","onExpand","renderChildrenWhenClosed","variant","isExpanded","useExpand","expanderRef","useRef","triggerRef","isHovered","useHover","isOutsideWindow","isLeavingWindow","offsetHeight","contentWidth","useSticky","isSticky","isJsxTitle","itemClasses","classNames","expanderListStyles","expanderClasses","renderContent","mainContentClasses","mergeRefs","AnalyticsId","ZIndex","renderListHeader","ChevronUp","ChevronDown","isExpanderComponent","element","ExpanderList","childPadding","accordion","activeExpander","setActiveExpander","useState","latestExpander","setLatestExpander","uuid","useUuid","expanderListClasses","event","prevState","getExpanderId","index","useEffect","isElementInViewport","newActiveExpander","child","acc","Ex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AAGD,GAAgB,GAAGc,EAAmB,CAAA;AAAA,EAAA,GAC5D,CAAC5D,CAAQ,CAAC,mCAGV,MAAG,EAAA,WAAWqD,GAAqB,KAAAvD,GAAU,eAAaY,GAAQ,oBAAkB0B,EAAY,aAAA,GAC9FxC,EAAM,SAAS,IAAII,GAAU,CAAC6D,GAAOJ,MAAU;AAC1C,QAAAhB,EAAoBoB,CAAK,GAAG;AACxB,YAAA9D,IAAKyD,EAAcC,CAAK,GACxBjD,IAAWsC,KAAA,gBAAAA,EAAiB/C;AAE3B,aAAAH,EAAM,aAAaiE,GAA4C;AAAA,QACpE,IAAA9D;AAAA,QACA,KAAK0D;AAAA,QACL,UAAAjD;AAAA,QACA,SAASoC;AAAA,QACT,OAAA1C;AAAA,QACA,OAAAG;AAAA,QACA,QAAAI;AAAA,QACA,iBAAiBD;AAAA,QACjB,WAAWuB,EAAmB,qBAAqB;AAAA,QACnD,qBAAqB,CAACuB,MAAyC3C,EAAoB2C,GAAO,GAAGH,CAAI,IAAIM,CAAK,EAAE;AAAA,QAC5G,0BAAA5C;AAAA,QACA,SAAAC;AAAA,MAAA,CACD;AAAA,IACH;AACO,WAAA+C;AAAA,EACR,CAAA,CACH;AAEJ,CAAC;AAEDlB,EAAa,cAAc;AAC3BA,EAAa,WAAWhD;AACxBA,EAAS,cAAc;AAEvB,MAAAoE,KAAepB;"}
|
|
1
|
+
{"version":3,"file":"ExpanderList.js","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useHover } from '../../hooks/useHover';\nimport { useSticky } from '../../hooks/useSticky';\nimport { useUuid } from '../../hooks/useUuid';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { ListHeaderType, renderListHeader } from '../ListHeader/ListHeader';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = PaletteNames;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ListHeader?: ListHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the link list background color on hover. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Stick expander trigger to top of screen while scrolling down */\n sticky?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'sticky' | 'variant'>;\n\nconst Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n sticky,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered } = useHover(triggerRef);\n\n const { isOutsideWindow, isLeavingWindow, offsetHeight, contentWidth } = useSticky(expanderRef, triggerRef);\n const isSticky = sticky && isExpanded && isOutsideWindow;\n const isJsxTitle = typeof title === 'object';\n\n const itemClasses = classNames(className, {\n [expanderListStyles['expander-list__item--' + variant]]: variant,\n [expanderListStyles['expander-list__item--jsx']]: isJsxTitle,\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles['expander-list-link--fill']]: variant === 'fill',\n [expanderListStyles['expander-list-link--closed']]: !isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles['expander-list-link--jsx']]: isJsxTitle,\n [expanderListStyles['expander-list-link--sticky']]: isSticky && !isLeavingWindow,\n [expanderListStyles['expander-list-link--absolute']]: isSticky && isLeavingWindow,\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(\n expanderListStyles['expander-list-link__main-content'],\n isExpanded && expanderListStyles['expander-list-link__main-content--expanded'],\n padding ? expanderListStyles['expander-list-link__main-content--padding'] : ''\n );\n\n return <div className={mainContentClasses}>{children}</div>;\n };\n\n return (\n <li\n className={itemClasses}\n ref={mergeRefs([ref, expanderRef])}\n style={{ paddingTop: isSticky && offsetHeight ? `${offsetHeight}px` : undefined }}\n >\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isHovered || isSticky ? zIndex : undefined,\n width: isSticky && contentWidth ? `${contentWidth}px` : undefined,\n }}\n >\n {renderListHeader(title, titleHtmlMarkup, isHovered, large ? 'large' : 'medium', isExpanded ? ChevronUp : ChevronDown, icon)}\n </button>\n {renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: {} | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color,\n className = '',\n accordion = false,\n sticky = false,\n testId,\n variant,\n zIndex = ZIndex.ExpanderTrigger,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const uuid = useUuid();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className);\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${uuid}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n sticky,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${uuid}-${index}`),\n renderChildrenWhenClosed,\n variant,\n zIndex: zIndex,\n });\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n"],"names":["Expander","React","props","ref","id","children","padding","color","className","icon","large","title","titleHtmlMarkup","expanded","sticky","testId","handleExpanderClick","onExpand","renderChildrenWhenClosed","variant","zIndex","isExpanded","useExpand","expanderRef","useRef","triggerRef","isHovered","useHover","isOutsideWindow","isLeavingWindow","offsetHeight","contentWidth","useSticky","isSticky","isJsxTitle","itemClasses","classNames","expanderListStyles","expanderClasses","renderContent","mainContentClasses","mergeRefs","AnalyticsId","renderListHeader","ChevronUp","ChevronDown","isExpanderComponent","element","ExpanderList","childPadding","accordion","ZIndex","activeExpander","setActiveExpander","useState","latestExpander","setLatestExpander","uuid","useUuid","expanderListClasses","event","prevState","getExpanderId","index","useEffect","isElementInViewport","newActiveExpander","child","acc","ExpanderList$1"],"mappings":";;;;;;;;;;;;;AAiFA,MAAMA,IAAyBC,EAAM,WAAyC,CAACC,GAAOC,MAAQ;AACtF,QAAA;AAAA,IACJ,IAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,OAAAC,IAA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AkB2B,EAAY,aAAA,GAC9FzC,EAAM,SAAS,IAAII,GAAU,CAAC8D,GAAOJ,MAAU;AAC1C,QAAAjB,EAAoBqB,CAAK,GAAG;AACxB,YAAA/D,IAAK0D,EAAcC,CAAK,GACxBlD,IAAWuC,KAAA,gBAAAA,EAAiBhD;AAE3B,aAAAH,EAAM,aAAakE,GAA4C;AAAA,QACpE,IAAA/D;AAAA,QACA,KAAK2D;AAAA,QACL,UAAAlD;AAAA,QACA,SAASoC;AAAA,QACT,OAAA1C;AAAA,QACA,OAAAG;AAAA,QACA,QAAAI;AAAA,QACA,iBAAiBD;AAAA,QACjB,WAAWwB,EAAmB,qBAAqB;AAAA,QACnD,qBAAqB,CAACuB,MAAyC5C,EAAoB4C,GAAO,GAAGH,CAAI,IAAIM,CAAK,EAAE;AAAA,QAC5G,0BAAA7C;AAAA,QACA,SAAAC;AAAA,QACA,QAAAC;AAAA,MAAA,CACD;AAAA,IACH;AACO,WAAA+C;AAAA,EACR,CAAA,CACH;AAEJ,CAAC;AAEDnB,EAAa,cAAc;AAC3BA,EAAa,WAAWhD;AACxBA,EAAS,cAAc;AAEvB,MAAAqE,KAAerB;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("./ExpanderList").ExpanderListCompound;
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
description: {
|
|
8
|
+
component: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
args: {
|
|
13
|
+
children: string;
|
|
14
|
+
renderChildrenWhenClosed: false;
|
|
15
|
+
accordion: false;
|
|
16
|
+
childPadding: true;
|
|
17
|
+
color: "blueberry";
|
|
18
|
+
sticky: false;
|
|
19
|
+
large: false;
|
|
20
|
+
};
|
|
21
|
+
argTypes: {
|
|
22
|
+
renderChildrenWhenClosed: {
|
|
23
|
+
control: string;
|
|
24
|
+
};
|
|
25
|
+
accordion: {
|
|
26
|
+
control: string;
|
|
27
|
+
};
|
|
28
|
+
childPadding: {
|
|
29
|
+
control: string;
|
|
30
|
+
};
|
|
31
|
+
color: {
|
|
32
|
+
control: string;
|
|
33
|
+
options: import("../../theme/palette").PaletteNames[];
|
|
34
|
+
};
|
|
35
|
+
sticky: {
|
|
36
|
+
control: string;
|
|
37
|
+
};
|
|
38
|
+
large: {
|
|
39
|
+
control: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default meta;
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
export declare const Default: Story;
|
|
46
|
+
export declare const VariantLine: Story;
|
|
47
|
+
export declare const VariantOutline: Story;
|
|
48
|
+
export declare const VariantFill: Story;
|
|
49
|
+
export declare const WithListHeaderComp: Story;
|
|
50
|
+
export declare const WithAvatarAndBadge: Story;
|
|
51
|
+
export declare const MultipleOpenExpanders: Story;
|
|
52
|
+
export declare const WithIcon: Story;
|
|
53
|
+
export declare const WithLinkList: Story;
|
|
54
|
+
export declare const AsAccordion: Story;
|
|
55
|
+
export declare const WithCallback: Story;
|
|
56
|
+
export declare const InteractiveChildren: Story;
|
|
57
|
+
export declare const JsxTitle: Story;
|
|
58
|
+
//# sourceMappingURL=ExpanderList.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormExample.js","sources":["../../../src/components/FormExample/FormExample.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useForm } from 'react-hook-form';\n\nimport { FormSize } from '../../constants';\nimport { isTest } from '../../utils/environment';\nimport Button from '../Button';\nimport Checkbox from '../Checkbox';\nimport FormGroup from '../FormGroup/FormGroup';\nimport FormLayout, { FormLayoutColumns } from '../FormLayout';\nimport Hospital from '../Icons/Hospital';\nimport Input from '../Input';\nimport Label from '../Label';\nimport RadioButton from '../RadioButton';\nimport Select from '../Select';\nimport Spacer from '../Spacer';\nimport Textarea from '../Textarea';\nimport Validation from '../Validation';\n\ninterface FormExampleProps {\n exampleType: FormExampleVariants;\n size?: keyof typeof FormSize;\n}\n\nexport enum FormExampleVariants {\n formgroup = 'formgroup',\n checkbox = 'checkbox',\n radiobutton = 'radiobutton',\n textarea = 'textarea',\n input = 'input',\n select = 'select',\n}\n\nexport const FormExample = (props: FormExampleProps): JSX.Element => {\n const { exampleType = FormExampleVariants.formgroup } = props;\n const {\n register,\n handleSubmit,\n formState: { errors },\n } = useForm();\n\n const defaultDate = new Date();\n defaultDate.setHours(0);\n defaultDate.setMinutes(0);\n defaultDate.setSeconds(0);\n const minDate = new Date();\n minDate.setDate(defaultDate.getDate() - 5);\n minDate.setHours(6);\n minDate.setMinutes(10);\n minDate.setSeconds(0);\n const maxDate = new Date();\n maxDate.setDate(defaultDate.getDate() + 5);\n maxDate.setHours(22);\n maxDate.setMinutes(0);\n maxDate.setSeconds(0);\n\n const field1 = 'field1';\n const field2 = 'field2';\n const field3 = 'field3';\n const field4 = 'field4';\n const field5 = 'field5';\n const field6 = 'field6';\n const allErrors =\n errors.field1 ||\n errors.field2 ||\n errors.field3 ||\n errors.field4 ||\n errors.field5 ||\n errors.field6 ||\n errors.field7 ||\n errors.field8 ||\n errors.field9;\n const errorMessage = 'Du må velge et alternativ';\n const errorMessage2 = 'Du må velge to alternativ';\n const errorMessage3 = 'Det kan ikke legges inn mer enn 40 tegn';\n const errorMessage4 = 'Du må skrive noe her';\n const errorMessage5 = 'Du må velge \"Option 2\"';\n const errorMessage6 = `Du må velge dato mellom ${minDate.toLocaleDateString('nb')} og ${maxDate.toLocaleDateString('nb')}`;\n const errorMessage7 = `Du må skrive inn tidspunkt mellom ${minDate.toLocaleTimeString('nb', {\n hour: '2-digit',\n minute: '2-digit',\n })} og ${maxDate.toLocaleTimeString('nb', {\n hour: '2-digit',\n minute: '2-digit',\n })}`;\n\n const requireTwo = (value: Array<string>): true | string => {\n return value.length >= 2 || errorMessage2;\n };\n const requireSelect = (value: Array<string>): true | string => {\n return value.toString() === 'Option 2' || errorMessage5;\n };\n\n const getFormExample = () => {\n if (exampleType === FormExampleVariants.formgroup) {\n const allCheckBoxes = [\n <Checkbox\n key={0}\n inputId=\"checkbox1\"\n label={<Label labelTexts={[{ text: 'Checkbox 1' }]} />}\n {...register(field1, { required: errorMessage })}\n />,\n <Checkbox\n key={1}\n inputId=\"checkbox2\"\n label={<Label labelTexts={[{ text: 'Checkbox 2' }]} />}\n {...register(field1, { required: errorMessage })}\n />,\n <Checkbox\n key={2}\n inputId=\"checkbox3\"\n label={<Label labelTexts={[{ text: 'Checkbox 3' }]} />}\n {...register(field1, { required: errorMessage })}\n />,\n ];\n\n return [\n <FormGroup\n key={0}\n title={'Gruppe tittel'}\n legend={'Velg minst en'}\n error={errors.field1 ? (errors.field1.message as string) : undefined}\n size={props.size}\n >\n <FormLayout maxColumns={FormLayoutColumns.two}>\n {allCheckBoxes.map(check => {\n return check;\n })}\n </FormLayout>\n </FormGroup>,\n <FormGroup key={1} legend={'Velg minst to'} error={errors.field2 ? (errors.field2.message as string) : undefined} size={props.size}>\n <Checkbox\n inputId=\"checkbox4\"\n label={<Label labelTexts={[{ text: 'Checkbox 4' }]} />}\n {...register(field2, { validate: requireTwo })}\n />\n <Checkbox\n inputId=\"checkbox5\"\n label={<Label labelTexts={[{ text: 'Checkbox 5' }]} />}\n {...register(field2, { validate: requireTwo })}\n />\n <Checkbox\n inputId=\"checkbox6\"\n label={<Label labelTexts={[{ text: 'Checkbox 6' }]} />}\n {...register(field2, { validate: requireTwo })}\n />\n </FormGroup>,\n <FormGroup key={2} legend={'Velg en'} error={errors.field3 ? (errors.field3.message as string) : undefined} size={props.size}>\n <RadioButton\n inputId=\"radiobutton1\"\n label={<Label labelTexts={[{ text: 'Radiobutton 1' }]} />}\n {...register(field3, { required: errorMessage })}\n />\n <RadioButton\n inputId=\"radiobutton2\"\n label={<Label labelTexts={[{ text: 'Radiobutton 2' }]} />}\n {...register(field3, { required: errorMessage })}\n />\n <RadioButton\n inputId=\"radiobutton3\"\n label={<Label labelTexts={[{ text: 'Radiobutton 3' }]} />}\n {...register(field3, { required: errorMessage })}\n />\n </FormGroup>,\n <FormGroup key={3} error={errors.field4 ? (errors.field4.message as string) : undefined}>\n <Textarea\n defaultValue={`Dette er en test \\n\\n Hello \\n\\n test \\n\\n test test`}\n grow\n maxCharacters={40}\n minRows={5}\n label={<Label labelTexts={[{ text: 'Skriv din historie her', type: 'semibold' }]} />}\n textareaId=\"textarea1\"\n {...register(field4, { maxLength: { value: 40, message: errorMessage3 } })}\n />\n </FormGroup>,\n <FormGroup key={4} size={props.size} error={errors.field5 ? (errors.field5.message as string) : undefined}>\n <Input\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n placeholder={'Skriv noe!'}\n icon={Hospital}\n {...register(field5, { required: errorMessage4 })}\n />\n </FormGroup>,\n <FormGroup key={5} size={props.size} error={errors.field6 ? (errors.field6.message as string) : undefined}>\n <Select\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n {...register(field6, { validate: requireSelect })}\n >\n <option value={'Option 1'}>{'Option 1'}</option>\n <option value={'Option 2'}>{'Option 2'}</option>\n <option value={'Option 3'}>{'Option 3'}</option>\n </Select>\n </FormGroup>,\n ];\n } else if (exampleType === FormExampleVariants.checkbox) {\n return (\n <Checkbox\n inputId=\"checkbox1\"\n label={<Label labelTexts={[{ text: 'Checkbox 1' }]} />}\n errorText={errors.field1 ? (errors.field1.message as string) : undefined}\n size={props.size}\n {...register(field1, { required: errorMessage })}\n />\n );\n } else if (exampleType === FormExampleVariants.radiobutton) {\n return (\n <RadioButton\n inputId=\"radiobutton1\"\n label={<Label labelTexts={[{ text: 'Radiobutton 1' }]} />}\n errorText={errors.field3 ? (errors.field3.message as string) : undefined}\n size={props.size}\n {...register(field3, { required: errorMessage })}\n />\n );\n } else if (exampleType === FormExampleVariants.textarea) {\n return (\n <Textarea\n defaultValue={`Dette er min historie \\n\\n Hello \\n\\n test`}\n grow\n maxCharacters={40}\n minRows={5}\n errorText={errors.field4 ? (errors.field4.message as string) : undefined}\n label={<Label labelTexts={[{ text: 'Skriv din historie her', type: 'semibold' }]} />}\n textareaId=\"textarea1\"\n {...register(field4, { maxLength: { value: 40, message: errorMessage3 } })}\n />\n );\n } else if (exampleType === FormExampleVariants.input) {\n return (\n <Input\n inputId={'input1'}\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n placeholder={'Skriv noe!'}\n errorText={errors.field5 ? (errors.field5.message as string) : undefined}\n icon={Hospital}\n {...register(field5, { required: errorMessage4 })}\n />\n );\n } else if (exampleType === FormExampleVariants.select) {\n return (\n <Select\n errorText={errors.field6 ? (errors.field6.message as string) : undefined}\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n {...register(field6, { validate: requireSelect })}\n >\n <option value={'Option 1'}>{'Option 1'}</option>\n <option value={'Option 2'}>{'Option 2'}</option>\n <option value={'Option 3'}>{'Option 3'}</option>\n </Select>\n );\n }\n };\n\n return (\n <form\n noValidate\n onSubmit={handleSubmit(data => {\n // eslint-disable-next-line no-console\n !isTest() && console.log(data);\n })}\n >\n <Validation size={props.size} errorSummary={allErrors ? 'Sjekk at alt er riktig utfylt' : undefined}>\n {getFormExample()}\n </Validation>\n <Spacer />\n <Button type=\"submit\">{'Send inn'}</Button>\n </form>\n );\n};\n\nexport default FormExample;\n"],"names":["FormExampleVariants","FormExample","props","exampleType","register","handleSubmit","errors","useForm","defaultDate","minDate","maxDate","field1","field2","field3","field4","field5","field6","allErrors","errorMessage","errorMessage2","errorMessage3","errorMessage4","errorMessage5","requireTwo","value","requireSelect","getFormExample","allCheckBoxes","React","Checkbox","Label","FormGroup","FormLayout","FormLayoutColumns","check","RadioButton","Textarea","Input","Hospital","Select","data","isTest","Validation","Spacer","Button","FormExample$1"],"mappings":";;;;;;;;;;;;;;;AAwBY,IAAAA,sBAAAA,OACVA,EAAA,YA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A,GAAa,UAAW;AAAA,UACtCA,gBAAAA,EAAA,cAAA,UAAA,EAAO,OAAO,WAAA,GAAa,UAAW;AAAA,UACtCA,gBAAAA,EAAA,cAAA,UAAA,EAAO,OAAO,WAAA,GAAa,UAAW;AAAA,QAAA;AAAA;AAAA,EAG7C;AAIA,SAAAA,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,YAAU;AAAA,MACV,UAAUvB,EAAa,CAAQmC,MAAA;AAE7B,SAACC,EAAO,KAAK,QAAQ,IAAID,CAAI;AAAA,MAAA,CAC9B;AAAA,IAAA;AAAA,IAEDZ,gBAAAA,EAAA,cAACc,GAAW,EAAA,MAAMxC,EAAM,MAAM,cAAce,IAAY,kCAAkC,OACvF,GAAAS,EAAA,CACH;AAAA,oCACCiB,GAAO,IAAA;AAAA,IACPf,gBAAAA,EAAA,cAAAgB,GAAA,EAAO,MAAK,SAAA,GAAU,UAAW;AAAA,EAAA;AAGxC,GAEAC,KAAe5C;"}
|
|
1
|
+
{"version":3,"file":"FormExample.js","sources":["../../../src/components/FormExample/FormExample.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useForm } from 'react-hook-form';\n\nimport { FormSize } from '../../constants';\nimport { isTest } from '../../utils/environment';\nimport Button from '../Button';\nimport Checkbox from '../Checkbox';\nimport FormGroup from '../FormGroup/FormGroup';\nimport FormLayout, { FormLayoutColumns } from '../FormLayout';\nimport Hospital from '../Icons/Hospital';\nimport Input from '../Input';\nimport Label from '../Label';\nimport RadioButton from '../RadioButton';\nimport Select from '../Select';\nimport Spacer from '../Spacer';\nimport Textarea from '../Textarea';\nimport Validation from '../Validation';\n\nexport interface FormExampleProps {\n exampleType: FormExampleVariants;\n size?: keyof typeof FormSize;\n}\n\nexport enum FormExampleVariants {\n formgroup = 'formgroup',\n checkbox = 'checkbox',\n radiobutton = 'radiobutton',\n textarea = 'textarea',\n input = 'input',\n select = 'select',\n}\n\nexport const FormExample = (props: FormExampleProps): JSX.Element => {\n const { exampleType = FormExampleVariants.formgroup } = props;\n const {\n register,\n handleSubmit,\n formState: { errors },\n } = useForm();\n\n const defaultDate = new Date();\n defaultDate.setHours(0);\n defaultDate.setMinutes(0);\n defaultDate.setSeconds(0);\n const minDate = new Date();\n minDate.setDate(defaultDate.getDate() - 5);\n minDate.setHours(6);\n minDate.setMinutes(10);\n minDate.setSeconds(0);\n const maxDate = new Date();\n maxDate.setDate(defaultDate.getDate() + 5);\n maxDate.setHours(22);\n maxDate.setMinutes(0);\n maxDate.setSeconds(0);\n\n const field1 = 'field1';\n const field2 = 'field2';\n const field3 = 'field3';\n const field4 = 'field4';\n const field5 = 'field5';\n const field6 = 'field6';\n const allErrors =\n errors.field1 ||\n errors.field2 ||\n errors.field3 ||\n errors.field4 ||\n errors.field5 ||\n errors.field6 ||\n errors.field7 ||\n errors.field8 ||\n errors.field9;\n const errorMessage = 'Du må velge et alternativ';\n const errorMessage2 = 'Du må velge to alternativ';\n const errorMessage3 = 'Det kan ikke legges inn mer enn 40 tegn';\n const errorMessage4 = 'Du må skrive noe her';\n const errorMessage5 = 'Du må velge \"Option 2\"';\n const errorMessage6 = `Du må velge dato mellom ${minDate.toLocaleDateString('nb')} og ${maxDate.toLocaleDateString('nb')}`;\n const errorMessage7 = `Du må skrive inn tidspunkt mellom ${minDate.toLocaleTimeString('nb', {\n hour: '2-digit',\n minute: '2-digit',\n })} og ${maxDate.toLocaleTimeString('nb', {\n hour: '2-digit',\n minute: '2-digit',\n })}`;\n\n const requireTwo = (value: Array<string>): true | string => {\n return value.length >= 2 || errorMessage2;\n };\n const requireSelect = (value: Array<string>): true | string => {\n return value.toString() === 'Option 2' || errorMessage5;\n };\n\n const getFormExample = () => {\n if (exampleType === FormExampleVariants.formgroup) {\n const allCheckBoxes = [\n <Checkbox\n key={0}\n inputId=\"checkbox1\"\n label={<Label labelTexts={[{ text: 'Checkbox 1' }]} />}\n {...register(field1, { required: errorMessage })}\n />,\n <Checkbox\n key={1}\n inputId=\"checkbox2\"\n label={<Label labelTexts={[{ text: 'Checkbox 2' }]} />}\n {...register(field1, { required: errorMessage })}\n />,\n <Checkbox\n key={2}\n inputId=\"checkbox3\"\n label={<Label labelTexts={[{ text: 'Checkbox 3' }]} />}\n {...register(field1, { required: errorMessage })}\n />,\n ];\n\n return [\n <FormGroup\n key={0}\n title={'Gruppe tittel'}\n legend={'Velg minst en'}\n error={errors.field1 ? (errors.field1.message as string) : undefined}\n size={props.size}\n >\n <FormLayout maxColumns={FormLayoutColumns.two}>\n {allCheckBoxes.map(check => {\n return check;\n })}\n </FormLayout>\n </FormGroup>,\n <FormGroup key={1} legend={'Velg minst to'} error={errors.field2 ? (errors.field2.message as string) : undefined} size={props.size}>\n <Checkbox\n inputId=\"checkbox4\"\n label={<Label labelTexts={[{ text: 'Checkbox 4' }]} />}\n {...register(field2, { validate: requireTwo })}\n />\n <Checkbox\n inputId=\"checkbox5\"\n label={<Label labelTexts={[{ text: 'Checkbox 5' }]} />}\n {...register(field2, { validate: requireTwo })}\n />\n <Checkbox\n inputId=\"checkbox6\"\n label={<Label labelTexts={[{ text: 'Checkbox 6' }]} />}\n {...register(field2, { validate: requireTwo })}\n />\n </FormGroup>,\n <FormGroup key={2} legend={'Velg en'} error={errors.field3 ? (errors.field3.message as string) : undefined} size={props.size}>\n <RadioButton\n inputId=\"radiobutton1\"\n label={<Label labelTexts={[{ text: 'Radiobutton 1' }]} />}\n {...register(field3, { required: errorMessage })}\n />\n <RadioButton\n inputId=\"radiobutton2\"\n label={<Label labelTexts={[{ text: 'Radiobutton 2' }]} />}\n {...register(field3, { required: errorMessage })}\n />\n <RadioButton\n inputId=\"radiobutton3\"\n label={<Label labelTexts={[{ text: 'Radiobutton 3' }]} />}\n {...register(field3, { required: errorMessage })}\n />\n </FormGroup>,\n <FormGroup key={3} error={errors.field4 ? (errors.field4.message as string) : undefined}>\n <Textarea\n defaultValue={`Dette er en test \\n\\n Hello \\n\\n test \\n\\n test test`}\n grow\n maxCharacters={40}\n minRows={5}\n label={<Label labelTexts={[{ text: 'Skriv din historie her', type: 'semibold' }]} />}\n textareaId=\"textarea1\"\n {...register(field4, { maxLength: { value: 40, message: errorMessage3 } })}\n />\n </FormGroup>,\n <FormGroup key={4} size={props.size} error={errors.field5 ? (errors.field5.message as string) : undefined}>\n <Input\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n placeholder={'Skriv noe!'}\n icon={Hospital}\n {...register(field5, { required: errorMessage4 })}\n />\n </FormGroup>,\n <FormGroup key={5} size={props.size} error={errors.field6 ? (errors.field6.message as string) : undefined}>\n <Select\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n {...register(field6, { validate: requireSelect })}\n >\n <option value={'Option 1'}>{'Option 1'}</option>\n <option value={'Option 2'}>{'Option 2'}</option>\n <option value={'Option 3'}>{'Option 3'}</option>\n </Select>\n </FormGroup>,\n ];\n } else if (exampleType === FormExampleVariants.checkbox) {\n return (\n <Checkbox\n inputId=\"checkbox1\"\n label={<Label labelTexts={[{ text: 'Checkbox 1' }]} />}\n errorText={errors.field1 ? (errors.field1.message as string) : undefined}\n size={props.size}\n {...register(field1, { required: errorMessage })}\n />\n );\n } else if (exampleType === FormExampleVariants.radiobutton) {\n return (\n <RadioButton\n inputId=\"radiobutton1\"\n label={<Label labelTexts={[{ text: 'Radiobutton 1' }]} />}\n errorText={errors.field3 ? (errors.field3.message as string) : undefined}\n size={props.size}\n {...register(field3, { required: errorMessage })}\n />\n );\n } else if (exampleType === FormExampleVariants.textarea) {\n return (\n <Textarea\n defaultValue={`Dette er min historie \\n\\n Hello \\n\\n test`}\n grow\n maxCharacters={40}\n minRows={5}\n errorText={errors.field4 ? (errors.field4.message as string) : undefined}\n label={<Label labelTexts={[{ text: 'Skriv din historie her', type: 'semibold' }]} />}\n textareaId=\"textarea1\"\n {...register(field4, { maxLength: { value: 40, message: errorMessage3 } })}\n />\n );\n } else if (exampleType === FormExampleVariants.input) {\n return (\n <Input\n inputId={'input1'}\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n placeholder={'Skriv noe!'}\n errorText={errors.field5 ? (errors.field5.message as string) : undefined}\n icon={Hospital}\n {...register(field5, { required: errorMessage4 })}\n />\n );\n } else if (exampleType === FormExampleVariants.select) {\n return (\n <Select\n errorText={errors.field6 ? (errors.field6.message as string) : undefined}\n label={<Label labelTexts={[{ text: 'Skriv inn din tekst', type: 'semibold' }]} />}\n {...register(field6, { validate: requireSelect })}\n >\n <option value={'Option 1'}>{'Option 1'}</option>\n <option value={'Option 2'}>{'Option 2'}</option>\n <option value={'Option 3'}>{'Option 3'}</option>\n </Select>\n );\n }\n };\n\n return (\n <form\n noValidate\n onSubmit={handleSubmit(data => {\n // eslint-disable-next-line no-console\n !isTest() && console.log(data);\n })}\n >\n <Validation size={props.size} errorSummary={allErrors ? 'Sjekk at alt er riktig utfylt' : undefined}>\n {getFormExample()}\n </Validation>\n <Spacer />\n <Button type=\"submit\">{'Send inn'}</Button>\n </form>\n );\n};\n\nexport default FormExample;\n"],"names":["FormExampleVariants","FormExample","props","exampleType","register","handleSubmit","errors","useForm","defaultDate","minDate","maxDate","field1","field2","field3","field4","field5","field6","allErrors","errorMessage","errorMessage2","errorMessage3","errorMessage4","errorMessage5","requireTwo","value","requireSelect","getFormExample","allCheckBoxes","React","Checkbox","Label","FormGroup","FormLayout","FormLayoutColumns","check","RadioButton","Textarea","Input","Hospital","Select","data","isTest","Validation","Spacer","Button","FormExample$1"],"mappings":";;;;;;;;;;;;;;;AAwBY,IAAAA,sBAAAA,OACVA,EAAA,YAAY,aACZA,EAAA,WAAW,YACXA,EAAA,cAAc,eACdA,EAAA,WAAW,YACXA,EAAA,QAAQ,SACRA,EAAA,SAAS,UANCA,IAAAA,KAAA,CAAA,CAAA;AASC,MAAAC,IAAc,CAACC,MAAyC;AAC7D,QAAA;AAAA,IAAE,aAAAC,IAAc;AAAA;AAAA,EAAkC,IAAAD,GAClD;AAAA,I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;AAAA,MACC,YAAU;AAAA,MACV,UAAUvB,EAAa,CAAQmC,MAAA;AAE7B,SAACC,EAAO,KAAK,QAAQ,IAAID,CAAI;AAAA,MAAA,CAC9B;AAAA,IAAA;AAAA,IAEDZ,gBAAAA,EAAA,cAACc,GAAW,EAAA,MAAMxC,EAAM,MAAM,cAAce,IAAY,kCAAkC,OACvF,GAAAS,EAAA,CACH;AAAA,oCACCiB,GAAO,IAAA;AAAA,IACPf,gBAAAA,EAAA,cAAAgB,GAAA,EAAO,MAAK,SAAA,GAAU,UAAW;AAAA,EAAA;AAGxC,GAEAC,KAAe5C;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { FormMode, FormSize } from '../../constants';
|
|
4
|
+
import './formGroup.stories.scss';
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: React.ForwardRefExoticComponent<import("./FormGroup").FormGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
args: {
|
|
16
|
+
title: string;
|
|
17
|
+
legend: string;
|
|
18
|
+
mode: FormMode.onwhite;
|
|
19
|
+
size: FormSize.medium;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
argTypes: {
|
|
23
|
+
title: {
|
|
24
|
+
control: string;
|
|
25
|
+
};
|
|
26
|
+
legend: {
|
|
27
|
+
control: string;
|
|
28
|
+
};
|
|
29
|
+
mode: {
|
|
30
|
+
control: string;
|
|
31
|
+
options: typeof FormMode;
|
|
32
|
+
};
|
|
33
|
+
size: {
|
|
34
|
+
control: string;
|
|
35
|
+
options: typeof FormSize;
|
|
36
|
+
};
|
|
37
|
+
name: {
|
|
38
|
+
control: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export default meta;
|
|
43
|
+
type Story = StoryObj<typeof meta>;
|
|
44
|
+
export declare const CheckboxChildren: Story;
|
|
45
|
+
export declare const RadioButtonChildren: Story;
|
|
46
|
+
export declare const InputChildren: Story;
|
|
47
|
+
export declare const DivTagTrue: Story;
|
|
48
|
+
export declare const CustomErrorWrapperClass: Story;
|
|
49
|
+
//# sourceMappingURL=FormGroup.stories.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
import { FormLayoutColumns } from './FormLayout';
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: React.ForwardRefExoticComponent<import("./FormLayout").FormLayoutProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
maxColumns: FormLayoutColumns.three;
|
|
16
|
+
colMinWidth: number;
|
|
17
|
+
};
|
|
18
|
+
argTypes: {
|
|
19
|
+
maxColumns: {
|
|
20
|
+
control: string;
|
|
21
|
+
options: typeof FormLayoutColumns;
|
|
22
|
+
};
|
|
23
|
+
colMinWidth: {
|
|
24
|
+
control: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
export declare const CheckboxChildren: Story;
|
|
31
|
+
export declare const RadioButtonChildren: Story;
|
|
32
|
+
//# sourceMappingURL=FormLayout.stories.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("./HelpBubble").HelpBubbleProps & React.RefAttributes<HTMLDivElement | SVGSVGElement>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
controllerRef: undefined;
|
|
15
|
+
children: string;
|
|
16
|
+
showBubble: true;
|
|
17
|
+
variant: import("../PopOver").PopOverVariant.positionautomatic;
|
|
18
|
+
};
|
|
19
|
+
argTypes: {
|
|
20
|
+
children: {
|
|
21
|
+
control: string;
|
|
22
|
+
};
|
|
23
|
+
showBubble: {
|
|
24
|
+
control: string;
|
|
25
|
+
};
|
|
26
|
+
variant: {
|
|
27
|
+
control: string;
|
|
28
|
+
options: typeof import("../PopOver").PopOverVariant;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof meta>;
|
|
34
|
+
export declare const Default: Story;
|
|
35
|
+
export declare const Link: Story;
|
|
36
|
+
export declare const Toggle: Story;
|
|
37
|
+
export declare const OnText: Story;
|
|
38
|
+
export declare const AsTooltip: Story;
|
|
39
|
+
export declare const WithHelpQuestion: Story;
|
|
40
|
+
export declare const HorizontalScroll: Story;
|
|
41
|
+
export declare const CenteredOverflow: Story;
|
|
42
|
+
//# sourceMappingURL=HelpBubble.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpPanel.js","sources":["../../../src/components/HelpPanel/HelpPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightBox, { HighlightBoxSize } from '../HighlightBox';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\
|
|
1
|
+
{"version":3,"file":"HelpPanel.js","sources":["../../../src/components/HelpPanel/HelpPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightBox, { HighlightBoxSize } from '../HighlightBox';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightBoxSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, testId, size, children, title }) => {\n const helpPanelClassName = classNames(styles['help-panel'], className);\n\n return (\n <HighlightBox\n className={helpPanelClassName}\n contentWrapperClassName={styles['help-panel']}\n testId={testId}\n size={size}\n svgIcon={HandWaving}\n title={title}\n >\n {children}\n </HighlightBox>\n );\n};\n\nexport default HelpPanel;\n"],"names":["HelpPanel","className","testId","size","children","title","helpPanelClassName","classNames","styles","React","HighlightBox","HandWaving","HelpPanel$1"],"mappings":";;;;;AAsBA,MAAMA,IAAsC,CAAC,EAAE,WAAAC,GAAW,QAAAC,GAAQ,MAAAC,GAAM,UAAAC,GAAU,OAAAC,QAAY;AAC5F,QAAMC,IAAqBC,EAAWC,EAAO,YAAY,GAAGP,CAAS;AAGnE,SAAAQ,gBAAAA,EAAA;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ;AAAA,MACX,yBAAyBE,EAAO,YAAY;AAAA,MAC5C,QAAAN;AAAA,MACA,MAAAC;AAAA,MACA,SAASQ;AAAA,MACT,OAAAN;AAAA,IAAA;AAAA,IAECD;AAAA,EAAA;AAGP,GAEAQ,IAAeZ;"}
|
|
@@ -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("./HelpPanel").HelpPanelProps>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
args: {
|
|
14
|
+
children: string;
|
|
15
|
+
size: "medium";
|
|
16
|
+
};
|
|
17
|
+
argTypes: {
|
|
18
|
+
children: {
|
|
19
|
+
control: string;
|
|
20
|
+
};
|
|
21
|
+
size: {
|
|
22
|
+
control: string;
|
|
23
|
+
options: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
export declare const Default: Story;
|
|
30
|
+
export declare const WithoutTitle: Story;
|
|
31
|
+
//# sourceMappingURL=HelpPanel.stories.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface HelpQuestionProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-controls'> {
|
|
2
|
+
export interface HelpQuestionProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-controls'> {
|
|
3
3
|
/**
|
|
4
4
|
* Help question contents
|
|
5
5
|
*/
|