@helsenorge/designsystem-react 15.0.0-beta.1 → 15.1.0
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/lib/AnchorLink.js.map +1 -1
- package/lib/AsChildSlot.js.map +1 -1
- package/lib/Avatar.js.map +1 -1
- package/lib/Badge.js.map +1 -1
- package/lib/Button.js +24 -19
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +46 -0
- package/lib/Checkbox.js +25 -48
- package/lib/Checkbox.js.map +1 -1
- package/lib/Checkbox2.js +69 -0
- package/lib/Checkbox2.js.map +1 -0
- package/lib/CheckboxMarker.js +64 -0
- package/lib/CheckboxMarker.js.map +1 -0
- package/lib/Chip.js.map +1 -1
- package/lib/Close.js.map +1 -1
- package/lib/DictionaryTrigger.js.map +1 -1
- package/lib/Drawer.js +46 -18
- package/lib/Drawer.js.map +1 -1
- package/lib/DrawerNavigation.js.map +1 -1
- package/lib/Duolist.js.map +1 -1
- package/lib/ElementHeader.js.map +1 -1
- package/lib/ElementHeaderText.js.map +1 -1
- package/lib/ErrorBoundary.js.map +1 -1
- package/lib/ErrorWrapper.js.map +1 -1
- package/lib/Expander.js.map +1 -1
- package/lib/FilterButton.js.map +1 -1
- package/lib/FilterButtonAndChipsWrapper.js.map +1 -1
- package/lib/FilterDrawer.js +20 -10
- package/lib/FilterDrawer.js.map +1 -1
- package/lib/FilterLinkList.js.map +1 -1
- package/lib/FilterOverviewLinkList.js.map +1 -1
- package/lib/FilterOverviewSearch.js.map +1 -1
- package/lib/FilterResultCountAndSortWrapper.js.map +1 -1
- package/lib/FilterSearch.js.map +1 -1
- package/lib/FilterSort.js.map +1 -1
- package/lib/FilterStateWrapper.js.map +1 -1
- package/lib/FormFieldTag.js.map +1 -1
- package/lib/FormGroup.js +5 -5
- package/lib/FormGroup.js.map +1 -1
- package/lib/FormLayout.js.map +1 -1
- package/lib/HelpDetails.js.map +1 -1
- package/lib/HelpTriggerIcon.js.map +1 -1
- package/lib/HelpTriggerStandalone.js.map +1 -1
- package/lib/HighlightPanel.js.map +1 -1
- package/lib/Highlighter.js.map +1 -1
- package/lib/HorizontalScroll.js.map +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Illustration.js +1 -1
- package/lib/Illustration.js.map +1 -1
- package/lib/InfoTeaser.js.map +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/LazyIcon.js +1 -1
- package/lib/LazyIcon.js.map +1 -1
- package/lib/LazyIllustration.js +6 -2
- package/lib/LazyIllustration.js.map +1 -1
- package/lib/LinkList.js.map +1 -1
- package/lib/List.js.map +1 -1
- package/lib/ListEditMode.js.map +1 -1
- package/lib/LoaderSpinner.js +61 -0
- package/lib/LoaderSpinner.js.map +1 -0
- package/lib/MaxCharacters.js.map +1 -1
- package/lib/NotificationBadge.js.map +1 -1
- package/lib/PanelTitle.js.map +1 -1
- package/lib/PopOver.js.map +1 -1
- package/lib/Radio.js +74 -0
- package/lib/Radio.js.map +1 -0
- package/lib/RadioButton.js +84 -0
- package/lib/RadioButton.js.map +1 -0
- package/lib/RadioMarker.js +35 -0
- package/lib/RadioMarker.js.map +1 -0
- package/lib/Select.js.map +1 -1
- package/lib/SingleSelectItem.js.map +1 -1
- package/lib/Slider.js.map +1 -1
- package/lib/Spacer.js.map +1 -1
- package/lib/StatusDot.js.map +1 -1
- package/lib/StatusDotList.js.map +1 -1
- package/lib/StepButtons.js.map +1 -1
- package/lib/TabList.js.map +1 -1
- package/lib/TabPanel.js.map +1 -1
- package/lib/TableBody.js +3 -3
- package/lib/TableBody.js.map +1 -1
- package/lib/TableCell.js +2 -2
- package/lib/TableCell.js.map +1 -1
- package/lib/TableExpandedRow.js +4 -4
- package/lib/TableExpandedRow.js.map +1 -1
- package/lib/TableExpanderCell.js +2 -2
- package/lib/TableExpanderCell.js.map +1 -1
- package/lib/TableHead.js +7 -7
- package/lib/TableHead.js.map +1 -1
- package/lib/TableHeadCell.js +5 -5
- package/lib/TableHeadCell.js.map +1 -1
- package/lib/TableRow.js +6 -6
- package/lib/TableRow.js.map +1 -1
- package/lib/Textarea.js.map +1 -1
- package/lib/Title.js.map +1 -1
- package/lib/Toast.js.map +1 -1
- package/lib/VisualCheckbox.js +79 -0
- package/lib/VisualCheckbox.js.map +1 -0
- package/lib/VisualRadio.js +64 -0
- package/lib/VisualRadio.js.map +1 -0
- package/lib/__mocks__/IntersectionObserver.js.map +1 -1
- package/lib/__mocks__/MutationObserver.js.map +1 -1
- package/lib/__mocks__/ResizeObserver.js.map +1 -1
- package/lib/__mocks__/matchMedia.js +3 -2
- package/lib/__mocks__/matchMedia.js.map +1 -1
- package/lib/__mocks__/useLayoutEvent.js.map +1 -1
- package/lib/__mocks__/useOutsideEvent.js.map +1 -1
- package/lib/__mocks__/usePseudoClasses.js.map +1 -1
- package/lib/__mocks__/useSize.js.map +1 -1
- package/lib/__mocks__/uuid.js.map +1 -1
- package/lib/components/ArticleTeaser/index.js.map +1 -1
- package/lib/components/Button/styles.module.scss +39 -16
- package/lib/components/Button/styles.module.scss.d.ts +3 -2
- package/lib/components/Checkbox/CheckboxMarker/CheckboxMarker.d.ts +20 -0
- package/lib/components/Checkbox/CheckboxMarker/styles.module.scss +309 -0
- package/lib/components/Checkbox/CheckboxMarker/styles.module.scss.d.ts +25 -0
- package/lib/components/Checkbox/styles.module.scss +9 -269
- package/lib/components/Checkbox/styles.module.scss.d.ts +1 -17
- package/lib/components/Drawer/DrawerBackButton.d.ts +10 -0
- package/lib/components/Drawer/DrawerBackButton.module.scss +52 -0
- package/lib/components/Drawer/DrawerBackButton.module.scss.d.ts +10 -0
- package/lib/components/Drawer/styles.module.scss +0 -9
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/DropdownOld/index.js.map +1 -1
- package/lib/components/EmptyState/index.js.map +1 -1
- package/lib/components/Expander/styles.module.scss.d.ts +3 -2
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/EyebrowHeader/index.js.map +1 -1
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/Filter/FilterDrawer/FilterDrawer.d.ts +4 -2
- package/lib/components/Filter/FilterDrawer/styles.module.scss +7 -0
- package/lib/components/Filter/FilterDrawer/styles.module.scss.d.ts +1 -0
- package/lib/components/Filter/LoaderSpinner/LoaderSpinner.d.ts +9 -0
- package/lib/components/Filter/LoaderSpinner/index.d.ts +3 -0
- package/lib/components/Filter/LoaderSpinner/index.js +7 -0
- package/lib/components/Filter/LoaderSpinner/index.js.map +1 -0
- package/lib/components/Filter/LoaderSpinner/styles.module.scss +27 -0
- package/lib/components/Filter/LoaderSpinner/styles.module.scss.d.ts +11 -0
- package/lib/components/Filter/index.d.ts +2 -0
- package/lib/components/Filter/index.js +2 -1
- package/lib/components/Filter/index.js.map +1 -1
- package/lib/components/HelpBubble/index.js.map +1 -1
- package/lib/components/HelpDrawer/index.js.map +1 -1
- package/lib/components/HelpExpanderInline/index.js.map +1 -1
- package/lib/components/HelpExpanderStandalone/index.js.map +1 -1
- package/lib/components/HelpPanel/index.js.map +1 -1
- package/lib/components/HelpTeaser/index.js.map +1 -1
- package/lib/components/HelpTooltip/index.js.map +1 -1
- package/lib/components/HelpTriggerInline/index.js.map +1 -1
- package/lib/components/Icons/ActiveMonitoring.js.map +1 -1
- package/lib/components/Icons/AcupunctureBack.js.map +1 -1
- package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/lib/components/Icons/AlarmClock.js.map +1 -1
- package/lib/components/Icons/AlertSignFill.js.map +1 -1
- package/lib/components/Icons/AlertSignStroke.js.map +1 -1
- package/lib/components/Icons/Amputation.js.map +1 -1
- package/lib/components/Icons/Anxiety.js.map +1 -1
- package/lib/components/Icons/Apple.js.map +1 -1
- package/lib/components/Icons/Archive.js.map +1 -1
- package/lib/components/Icons/ArmFlexing.js.map +1 -1
- package/lib/components/Icons/ArrowDown.js.map +1 -1
- package/lib/components/Icons/ArrowLeft.js.map +1 -1
- package/lib/components/Icons/ArrowRight.js.map +1 -1
- package/lib/components/Icons/ArrowUp.js.map +1 -1
- package/lib/components/Icons/ArrowUpRight.js.map +1 -1
- package/lib/components/Icons/Attachment.js.map +1 -1
- package/lib/components/Icons/Atv.js.map +1 -1
- package/lib/components/Icons/Avatar.js.map +1 -1
- package/lib/components/Icons/AwakePersonOnPillow.js.map +1 -1
- package/lib/components/Icons/Baby.js.map +1 -1
- package/lib/components/Icons/BandAid.js.map +1 -1
- package/lib/components/Icons/BeerAndPills.js.map +1 -1
- package/lib/components/Icons/Bell.js.map +1 -1
- package/lib/components/Icons/Bike.js.map +1 -1
- package/lib/components/Icons/BirthControl.js.map +1 -1
- package/lib/components/Icons/BirthdayCake.js.map +1 -1
- package/lib/components/Icons/Boat.js.map +1 -1
- package/lib/components/Icons/Body.js.map +1 -1
- package/lib/components/Icons/Braille.js.map +1 -1
- package/lib/components/Icons/Brain.js.map +1 -1
- package/lib/components/Icons/BreastReconstruction.js.map +1 -1
- package/lib/components/Icons/BreastRemoval.js.map +1 -1
- package/lib/components/Icons/Breasts.js.map +1 -1
- package/lib/components/Icons/BrokenHeart.js.map +1 -1
- package/lib/components/Icons/BrokenPuzzle.js.map +1 -1
- package/lib/components/Icons/Bus.js.map +1 -1
- package/lib/components/Icons/Calendar.js.map +1 -1
- package/lib/components/Icons/CalendarChange.js.map +1 -1
- package/lib/components/Icons/CalendarCheck.js.map +1 -1
- package/lib/components/Icons/CalendarEvent.js.map +1 -1
- package/lib/components/Icons/CalendarSave.js.map +1 -1
- package/lib/components/Icons/Cancer.js.map +1 -1
- package/lib/components/Icons/Candle.js.map +1 -1
- package/lib/components/Icons/Car.js.map +1 -1
- package/lib/components/Icons/Carton.js.map +1 -1
- package/lib/components/Icons/Change.js.map +1 -1
- package/lib/components/Icons/Check.js.map +1 -1
- package/lib/components/Icons/CheckFill.js.map +1 -1
- package/lib/components/Icons/CheckOutline.js.map +1 -1
- package/lib/components/Icons/Chest.js.map +1 -1
- package/lib/components/Icons/ChevronDown.js.map +1 -1
- package/lib/components/Icons/ChevronLeft.js.map +1 -1
- package/lib/components/Icons/ChevronRight.js.map +1 -1
- package/lib/components/Icons/ChevronUp.js.map +1 -1
- package/lib/components/Icons/ChevronsDown.js.map +1 -1
- package/lib/components/Icons/ChevronsUp.js.map +1 -1
- package/lib/components/Icons/ChildPlaying.js.map +1 -1
- package/lib/components/Icons/Cigarette.js.map +1 -1
- package/lib/components/Icons/Coins.js.map +1 -1
- package/lib/components/Icons/Contacts.js.map +1 -1
- package/lib/components/Icons/Copy.js.map +1 -1
- package/lib/components/Icons/CoronaCertificate.js.map +1 -1
- package/lib/components/Icons/Coronavirus.js.map +1 -1
- package/lib/components/Icons/Cough.js.map +1 -1
- package/lib/components/Icons/CreditCard.js.map +1 -1
- package/lib/components/Icons/CriticalHealthInfo.js.map +1 -1
- package/lib/components/Icons/Cross.js.map +1 -1
- package/lib/components/Icons/DataExchange.js.map +1 -1
- package/lib/components/Icons/DataReceived.js.map +1 -1
- package/lib/components/Icons/DataSent.js.map +1 -1
- package/lib/components/Icons/Depression.js.map +1 -1
- package/lib/components/Icons/DigestiveSystem.js.map +1 -1
- package/lib/components/Icons/Dizzy.js.map +1 -1
- package/lib/components/Icons/Documents.js.map +1 -1
- package/lib/components/Icons/Dog.js.map +1 -1
- package/lib/components/Icons/DonorCard.js.map +1 -1
- package/lib/components/Icons/DotAttachment.js.map +1 -1
- package/lib/components/Icons/DotCheckmark.js.map +1 -1
- package/lib/components/Icons/DotCircleArrows.js.map +1 -1
- package/lib/components/Icons/DotDot.js.map +1 -1
- package/lib/components/Icons/DotExclamationMark.js.map +1 -1
- package/lib/components/Icons/DotFill.js.map +1 -1
- package/lib/components/Icons/DotGroup.js.map +1 -1
- package/lib/components/Icons/DotHalfDisc.js.map +1 -1
- package/lib/components/Icons/DotInfo.js.map +1 -1
- package/lib/components/Icons/DotLogin.js.map +1 -1
- package/lib/components/Icons/DotLookingGlass.js.map +1 -1
- package/lib/components/Icons/DotNoAccess.js.map +1 -1
- package/lib/components/Icons/DotNoEye.js.map +1 -1
- package/lib/components/Icons/DotOutline.js.map +1 -1
- package/lib/components/Icons/DotPencil.js.map +1 -1
- package/lib/components/Icons/DotQuestionMark.js.map +1 -1
- package/lib/components/Icons/DotTriangle.js.map +1 -1
- package/lib/components/Icons/DotX.js.map +1 -1
- package/lib/components/Icons/Download.js.map +1 -1
- package/lib/components/Icons/Draft.js.map +1 -1
- package/lib/components/Icons/Drag.js.map +1 -1
- package/lib/components/Icons/EChat.js.map +1 -1
- package/lib/components/Icons/Ear.js.map +1 -1
- package/lib/components/Icons/EarDeaf.js.map +1 -1
- package/lib/components/Icons/EarHearingAid.js.map +1 -1
- package/lib/components/Icons/EarNoseThroat.js.map +1 -1
- package/lib/components/Icons/EarVolume.js.map +1 -1
- package/lib/components/Icons/Edit.js.map +1 -1
- package/lib/components/Icons/ElderlyPerson.js.map +1 -1
- package/lib/components/Icons/Embolization.js.map +1 -1
- package/lib/components/Icons/EmergencyCall.js.map +1 -1
- package/lib/components/Icons/EmoticonAnnoyed.js.map +1 -1
- package/lib/components/Icons/EmoticonDelighted.js.map +1 -1
- package/lib/components/Icons/EmoticonDisappointed.js.map +1 -1
- package/lib/components/Icons/EmoticonHappy.js.map +1 -1
- package/lib/components/Icons/EmoticonMeh.js.map +1 -1
- package/lib/components/Icons/EmptyBox.js.map +1 -1
- package/lib/components/Icons/EnterFullScreen.js.map +1 -1
- package/lib/components/Icons/Envelope.js.map +1 -1
- package/lib/components/Icons/Epilepsy.js.map +1 -1
- package/lib/components/Icons/Eraser.js.map +1 -1
- package/lib/components/Icons/ErrorSignFill.js.map +1 -1
- package/lib/components/Icons/ErrorSignStroke.js.map +1 -1
- package/lib/components/Icons/EuropeanHealthCard.js.map +1 -1
- package/lib/components/Icons/ExitFullScreen.js.map +1 -1
- package/lib/components/Icons/Eye.js.map +1 -1
- package/lib/components/Icons/Facebook.js.map +1 -1
- package/lib/components/Icons/FallingLeaf.js.map +1 -1
- package/lib/components/Icons/Feedback.js.map +1 -1
- package/lib/components/Icons/Female.js.map +1 -1
- package/lib/components/Icons/FemaleDoctor.js.map +1 -1
- package/lib/components/Icons/Ferry.js.map +1 -1
- package/lib/components/Icons/File.js.map +1 -1
- package/lib/components/Icons/Filter.js +12 -12
- package/lib/components/Icons/Filter.js.map +1 -1
- package/lib/components/Icons/FingerBleed.js.map +1 -1
- package/lib/components/Icons/FirstAidKit.js.map +1 -1
- package/lib/components/Icons/Fish.js.map +1 -1
- package/lib/components/Icons/FloppyDisk.js.map +1 -1
- package/lib/components/Icons/Football.js.map +1 -1
- package/lib/components/Icons/Form.js.map +1 -1
- package/lib/components/Icons/Forward.js.map +1 -1
- package/lib/components/Icons/Gallery.js.map +1 -1
- package/lib/components/Icons/Garden.js.map +1 -1
- package/lib/components/Icons/GasCan.js.map +1 -1
- package/lib/components/Icons/GenderIdentity.js.map +1 -1
- package/lib/components/Icons/GlassWater.js.map +1 -1
- package/lib/components/Icons/Glasses.js.map +1 -1
- package/lib/components/Icons/Globe.js.map +1 -1
- package/lib/components/Icons/Grain.js.map +1 -1
- package/lib/components/Icons/Graph.js.map +1 -1
- package/lib/components/Icons/Group.js.map +1 -1
- package/lib/components/Icons/GroupTwins.js.map +1 -1
- package/lib/components/Icons/HTMLFile.js.map +1 -1
- package/lib/components/Icons/HandWaving.js.map +1 -1
- package/lib/components/Icons/HandWithDisease.js.map +1 -1
- package/lib/components/Icons/HandsAndHeart.js.map +1 -1
- package/lib/components/Icons/HealthClinic.js.map +1 -1
- package/lib/components/Icons/HealthMeasurements.js.map +1 -1
- package/lib/components/Icons/HealthWarning.js.map +1 -1
- package/lib/components/Icons/HealthcarePerson.js.map +1 -1
- package/lib/components/Icons/HealthcarePersonell.js.map +1 -1
- package/lib/components/Icons/HearingProtection.js.map +1 -1
- package/lib/components/Icons/Heart.js.map +1 -1
- package/lib/components/Icons/HeartHands.js.map +1 -1
- package/lib/components/Icons/HelpSign.js.map +1 -1
- package/lib/components/Icons/HelpingHand.js.map +1 -1
- package/lib/components/Icons/Hemodialysis.js.map +1 -1
- package/lib/components/Icons/Hiker.js.map +1 -1
- package/lib/components/Icons/Hipprosthesis.js.map +1 -1
- package/lib/components/Icons/History.js.map +1 -1
- package/lib/components/Icons/HivAndAids.js.map +1 -1
- package/lib/components/Icons/Home.js.map +1 -1
- package/lib/components/Icons/HomeFill.js.map +1 -1
- package/lib/components/Icons/Hormone.js.map +1 -1
- package/lib/components/Icons/Hospital.js.map +1 -1
- package/lib/components/Icons/Hourglass.js.map +1 -1
- package/lib/components/Icons/IconNames.js.map +1 -1
- package/lib/components/Icons/ImgFile.js.map +1 -1
- package/lib/components/Icons/Inbox.js.map +1 -1
- package/lib/components/Icons/InfoSignFill.js.map +1 -1
- package/lib/components/Icons/InfoSignStroke.js.map +1 -1
- package/lib/components/Icons/Instagram.js.map +1 -1
- package/lib/components/Icons/Intravenous.js.map +1 -1
- package/lib/components/Icons/JointPain.js.map +1 -1
- package/lib/components/Icons/Journal.js.map +1 -1
- package/lib/components/Icons/JpgFile.js.map +1 -1
- package/lib/components/Icons/Kidney.js.map +1 -1
- package/lib/components/Icons/KitchenScale.js.map +1 -1
- package/lib/components/Icons/Kjernejournal.js.map +1 -1
- package/lib/components/Icons/Laboratory.js.map +1 -1
- package/lib/components/Icons/LaptopBlog.js.map +1 -1
- package/lib/components/Icons/LawBook.js.map +1 -1
- package/lib/components/Icons/LegalDocument.js.map +1 -1
- package/lib/components/Icons/LightBulb.js.map +1 -1
- package/lib/components/Icons/List.js.map +1 -1
- package/lib/components/Icons/Location.js.map +1 -1
- package/lib/components/Icons/LocationFill.js.map +1 -1
- package/lib/components/Icons/Lock.js.map +1 -1
- package/lib/components/Icons/Login.js.map +1 -1
- package/lib/components/Icons/Logout.js.map +1 -1
- package/lib/components/Icons/Lungs.js.map +1 -1
- package/lib/components/Icons/Makeup.js.map +1 -1
- package/lib/components/Icons/MaleDoctor.js.map +1 -1
- package/lib/components/Icons/MaleDoctorAndPerson.js.map +1 -1
- package/lib/components/Icons/MaleDoctorCompact.js.map +1 -1
- package/lib/components/Icons/MaleDoctorCompactFill.js.map +1 -1
- package/lib/components/Icons/MaleGenitalia.js.map +1 -1
- package/lib/components/Icons/MeasuringTape.js.map +1 -1
- package/lib/components/Icons/Medicine.js.map +1 -1
- package/lib/components/Icons/MedicineWarning.js.map +1 -1
- package/lib/components/Icons/MentalHealthAdult.js.map +1 -1
- package/lib/components/Icons/MentalHealthChild.js.map +1 -1
- package/lib/components/Icons/Menu.js.map +1 -1
- package/lib/components/Icons/Microscope.js.map +1 -1
- package/lib/components/Icons/Minus.js.map +1 -1
- package/lib/components/Icons/Mirror.js.map +1 -1
- package/lib/components/Icons/MobilePhone.js.map +1 -1
- package/lib/components/Icons/MotherHoldingBaby.js.map +1 -1
- package/lib/components/Icons/MuscleBack.js.map +1 -1
- package/lib/components/Icons/MuscleLeg.js.map +1 -1
- package/lib/components/Icons/Mushroom.js.map +1 -1
- package/lib/components/Icons/Music.js.map +1 -1
- package/lib/components/Icons/MusselsAndSalt.js.map +1 -1
- package/lib/components/Icons/NoAccess.js.map +1 -1
- package/lib/components/Icons/NoEye.js.map +1 -1
- package/lib/components/Icons/NoFilter.js.map +1 -1
- package/lib/components/Icons/Notepad.js.map +1 -1
- package/lib/components/Icons/Osteotomy.js.map +1 -1
- package/lib/components/Icons/PaintRoller.js.map +1 -1
- package/lib/components/Icons/PaperPlane.js.map +1 -1
- package/lib/components/Icons/PatientAndPerson.js.map +1 -1
- package/lib/components/Icons/Pause.js.map +1 -1
- package/lib/components/Icons/PdfFile.js.map +1 -1
- package/lib/components/Icons/Pencil.js.map +1 -1
- package/lib/components/Icons/PeopleTalking.js.map +1 -1
- package/lib/components/Icons/Peritonealdialysis.js.map +1 -1
- package/lib/components/Icons/Person.js.map +1 -1
- package/lib/components/Icons/PersonAndPatient.js.map +1 -1
- package/lib/components/Icons/PersonCancel.js.map +1 -1
- package/lib/components/Icons/PersonInXRayMachine.js.map +1 -1
- package/lib/components/Icons/PersonOverweight.js.map +1 -1
- package/lib/components/Icons/PersonRelaxing.js.map +1 -1
- package/lib/components/Icons/PersonWithBrain.js.map +1 -1
- package/lib/components/Icons/PersonWithBrokenArm.js.map +1 -1
- package/lib/components/Icons/PersonWithCrutches.js.map +1 -1
- package/lib/components/Icons/PersonWithJaw.js.map +1 -1
- package/lib/components/Icons/PersonWithMagnifyingGlass.js.map +1 -1
- package/lib/components/Icons/PersonWithSenses.js.map +1 -1
- package/lib/components/Icons/PersonWorking.js.map +1 -1
- package/lib/components/Icons/PersonalPlan.js.map +1 -1
- package/lib/components/Icons/PizzaSlice.js.map +1 -1
- package/lib/components/Icons/Plane.js.map +1 -1
- package/lib/components/Icons/Plant.js.map +1 -1
- package/lib/components/Icons/PlateKnifeFork.js.map +1 -1
- package/lib/components/Icons/Play.js.map +1 -1
- package/lib/components/Icons/PlusLarge.js.map +1 -1
- package/lib/components/Icons/PlusSmall.js.map +1 -1
- package/lib/components/Icons/PngFile.js.map +1 -1
- package/lib/components/Icons/Podcast.js.map +1 -1
- package/lib/components/Icons/PoisonInformation.js.map +1 -1
- package/lib/components/Icons/Pregnant.js.map +1 -1
- package/lib/components/Icons/Printer.js.map +1 -1
- package/lib/components/Icons/Psychosis.js.map +1 -1
- package/lib/components/Icons/Publication.js.map +1 -1
- package/lib/components/Icons/Puzzle.js.map +1 -1
- package/lib/components/Icons/QrCode.js.map +1 -1
- package/lib/components/Icons/Quarrel.js.map +1 -1
- package/lib/components/Icons/RadioTherapy.js.map +1 -1
- package/lib/components/Icons/RadioactiveTreatment.js.map +1 -1
- package/lib/components/Icons/Radioiodine.js.map +1 -1
- package/lib/components/Icons/Receipt.js.map +1 -1
- package/lib/components/Icons/Receptionist.js.map +1 -1
- package/lib/components/Icons/Recovery.js.map +1 -1
- package/lib/components/Icons/Referral.js.map +1 -1
- package/lib/components/Icons/Refresh.js.map +1 -1
- package/lib/components/Icons/Refund.js.map +1 -1
- package/lib/components/Icons/Reminder.js.map +1 -1
- package/lib/components/Icons/Reply.js.map +1 -1
- package/lib/components/Icons/Rocket.js.map +1 -1
- package/lib/components/Icons/RtfFile.js.map +1 -1
- package/lib/components/Icons/STDs.js.map +1 -1
- package/lib/components/Icons/Save.js.map +1 -1
- package/lib/components/Icons/Scale.js.map +1 -1
- package/lib/components/Icons/ScreenReader.js.map +1 -1
- package/lib/components/Icons/Search.js +4 -4
- package/lib/components/Icons/Search.js.map +1 -1
- package/lib/components/Icons/SectionSign.js.map +1 -1
- package/lib/components/Icons/Settings.js.map +1 -1
- package/lib/components/Icons/SettingsFill.js.map +1 -1
- package/lib/components/Icons/Sexualorientation.js.map +1 -1
- package/lib/components/Icons/ShakingHand.js.map +1 -1
- package/lib/components/Icons/Share.js.map +1 -1
- package/lib/components/Icons/SharedHealthData.js.map +1 -1
- package/lib/components/Icons/SharedHealthMeasurements.js.map +1 -1
- package/lib/components/Icons/Shield.js.map +1 -1
- package/lib/components/Icons/ShuntOperation.js.map +1 -1
- package/lib/components/Icons/Skeleton.js.map +1 -1
- package/lib/components/Icons/Skin.js.map +1 -1
- package/lib/components/Icons/Snake.js.map +1 -1
- package/lib/components/Icons/Snapchat.js.map +1 -1
- package/lib/components/Icons/Sort.js +12 -12
- package/lib/components/Icons/Sort.js.map +1 -1
- package/lib/components/Icons/SortDown.js.map +1 -1
- package/lib/components/Icons/SortUp.js.map +1 -1
- package/lib/components/Icons/SpeechBubble.js.map +1 -1
- package/lib/components/Icons/Spray.js.map +1 -1
- package/lib/components/Icons/StarFill.js.map +1 -1
- package/lib/components/Icons/StarStroke.js.map +1 -1
- package/lib/components/Icons/StickyNote.js.map +1 -1
- package/lib/components/Icons/StickyNotes.js.map +1 -1
- package/lib/components/Icons/Stopwatch.js.map +1 -1
- package/lib/components/Icons/Sun.js.map +1 -1
- package/lib/components/Icons/SupportingPerson.js.map +1 -1
- package/lib/components/Icons/Surgery.js.map +1 -1
- package/lib/components/Icons/Sweets.js.map +1 -1
- package/lib/components/Icons/Syringe.js.map +1 -1
- package/lib/components/Icons/Taxi.js.map +1 -1
- package/lib/components/Icons/TeddyBear.js.map +1 -1
- package/lib/components/Icons/Teenagers.js.map +1 -1
- package/lib/components/Icons/ThinkingAboutBaby.js.map +1 -1
- package/lib/components/Icons/Ticket.js.map +1 -1
- package/lib/components/Icons/TimePassing.js.map +1 -1
- package/lib/components/Icons/Toddler.js.map +1 -1
- package/lib/components/Icons/Tombstone.js.map +1 -1
- package/lib/components/Icons/Toolbox.js.map +1 -1
- package/lib/components/Icons/Tooth.js.map +1 -1
- package/lib/components/Icons/TotalKneeProsthesis.js.map +1 -1
- package/lib/components/Icons/Train.js.map +1 -1
- package/lib/components/Icons/Transplantation.js.map +1 -1
- package/lib/components/Icons/TrashCan.js.map +1 -1
- package/lib/components/Icons/TravelRoute.js.map +1 -1
- package/lib/components/Icons/TreatmentAids.js.map +1 -1
- package/lib/components/Icons/TriangleX.js.map +1 -1
- package/lib/components/Icons/Twitter.js.map +1 -1
- package/lib/components/Icons/Undo.js.map +1 -1
- package/lib/components/Icons/UniProsthesis.js.map +1 -1
- package/lib/components/Icons/Upload.js.map +1 -1
- package/lib/components/Icons/UserOrganization.js.map +1 -1
- package/lib/components/Icons/Vaccine.js.map +1 -1
- package/lib/components/Icons/VerticalDots.js.map +1 -1
- package/lib/components/Icons/VideoCamera.js.map +1 -1
- package/lib/components/Icons/VideoChat.js.map +1 -1
- package/lib/components/Icons/Wallet.js.map +1 -1
- package/lib/components/Icons/Watch.js.map +1 -1
- package/lib/components/Icons/Website.js.map +1 -1
- package/lib/components/Icons/Wheelchair.js.map +1 -1
- package/lib/components/Icons/WheelchairActive.js.map +1 -1
- package/lib/components/Icons/Window.js.map +1 -1
- package/lib/components/Icons/WordDocument.js.map +1 -1
- package/lib/components/Icons/WorkSuitcase.js.map +1 -1
- package/lib/components/Icons/X.js.map +1 -1
- package/lib/components/Icons/XOutline.js.map +1 -1
- package/lib/components/Icons/XmlFile.js.map +1 -1
- package/lib/components/Icons/YouTube.js.map +1 -1
- package/lib/components/Icons/Zoom.js.map +1 -1
- package/lib/components/Icons/ZoomInLeft.js.map +1 -1
- package/lib/components/Icons/ZoomOutLeft.js.map +1 -1
- package/lib/components/Illustration/index.js +1 -1
- package/lib/components/Illustrations/BabyMobile.js +1 -1
- package/lib/components/Illustrations/BabyMobile.js.map +1 -1
- package/lib/components/Illustrations/BabyMobileMedium.js +1 -1
- package/lib/components/Illustrations/BabyMobileMedium.js.map +1 -1
- package/lib/components/Illustrations/Child.js +1 -1
- package/lib/components/Illustrations/Child.js.map +1 -1
- package/lib/components/Illustrations/ChildMedium.js +1 -1
- package/lib/components/Illustrations/ChildMedium.js.map +1 -1
- package/lib/components/Illustrations/Doctor.js +1 -1
- package/lib/components/Illustrations/Doctor.js.map +1 -1
- package/lib/components/Illustrations/DoctorMedium.js.map +1 -1
- package/lib/components/Illustrations/DoctorSmall.js.map +1 -1
- package/lib/components/Illustrations/EyeContact.d.ts +8 -0
- package/lib/components/Illustrations/EyeContact.js +17 -0
- package/lib/components/Illustrations/EyeContact.js.map +1 -0
- package/lib/components/Illustrations/EyeContactMedium.d.ts +3 -0
- package/lib/components/Illustrations/EyeContactMedium.js +80 -0
- package/lib/components/Illustrations/EyeContactMedium.js.map +1 -0
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFood.js +1 -1
- package/lib/components/Illustrations/GiveBabyFood.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFoodMedium.js +1 -1
- package/lib/components/Illustrations/GiveBabyFoodMedium.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnel.js +1 -1
- package/lib/components/Illustrations/HealthcarePersonnel.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnelMedium.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnelSmall.js.map +1 -1
- package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
- package/lib/components/Illustrations/IllustrationNames.js +4 -0
- package/lib/components/Illustrations/IllustrationNames.js.map +1 -1
- package/lib/components/Illustrations/ReadLetters.js +1 -1
- package/lib/components/Illustrations/ReadLetters.js.map +1 -1
- package/lib/components/Illustrations/ReadLettersMedium.js +1 -1
- package/lib/components/Illustrations/ReadLettersMedium.js.map +1 -1
- package/lib/components/Illustrations/SkinToSkin.d.ts +8 -0
- package/lib/components/Illustrations/SkinToSkin.js +17 -0
- package/lib/components/Illustrations/SkinToSkin.js.map +1 -0
- package/lib/components/Illustrations/SkinToSkinMedium.d.ts +3 -0
- package/lib/components/Illustrations/SkinToSkinMedium.js +107 -0
- package/lib/components/Illustrations/SkinToSkinMedium.js.map +1 -0
- package/lib/components/Illustrations/Stork.js +1 -1
- package/lib/components/Illustrations/Stork.js.map +1 -1
- package/lib/components/Illustrations/StorkMedium.js +1 -1
- package/lib/components/Illustrations/StorkMedium.js.map +1 -1
- package/lib/components/Illustrations/Stroller.js +1 -1
- package/lib/components/Illustrations/Stroller.js.map +1 -1
- package/lib/components/Illustrations/StrollerMedium.js +1 -1
- package/lib/components/Illustrations/StrollerMedium.js.map +1 -1
- package/lib/components/Illustrations/Support2.js +1 -1
- package/lib/components/Illustrations/Support2.js.map +1 -1
- package/lib/components/Illustrations/Support2Medium.js +1 -1
- package/lib/components/Illustrations/Support2Medium.js.map +1 -1
- package/lib/components/Illustrations/Thinking.js +1 -1
- package/lib/components/Illustrations/Thinking.js.map +1 -1
- package/lib/components/Illustrations/ThinkingMedium.js +1 -1
- package/lib/components/Illustrations/ThinkingMedium.js.map +1 -1
- package/lib/components/Loader/index.js.map +1 -1
- package/lib/components/Logo/index.js.map +1 -1
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/NotificationPanel/index.js.map +1 -1
- package/lib/components/Panel/index.js +1 -1
- package/lib/components/Panel/index.js.map +1 -1
- package/lib/components/Panel/styles.module.scss.d.ts +3 -2
- package/lib/components/PanelList/index.js +1 -1
- package/lib/components/PanelList/index.js.map +1 -1
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/Portal/index.js.map +1 -1
- package/lib/components/Progressbar/index.js.map +1 -1
- package/lib/components/PromoPanel/index.js.map +1 -1
- package/lib/components/RadioButton/RadioMarker/RadioMarker.d.ts +20 -0
- package/lib/components/RadioButton/RadioMarker/styles.module.scss +288 -0
- package/lib/components/RadioButton/RadioMarker/styles.module.scss.d.ts +20 -0
- package/lib/components/RadioButton/index.d.ts +0 -1
- package/lib/components/RadioButton/index.js +2 -2
- package/lib/components/RadioButton/index.js.map +1 -1
- package/lib/components/RadioButton/styles.module.scss +13 -275
- package/lib/components/RadioButton/styles.module.scss.d.ts +2 -12
- package/lib/components/ServiceMessage/index.js.map +1 -1
- package/lib/components/SharingStatus/index.js.map +1 -1
- package/lib/components/Step/index.js.map +1 -1
- package/lib/components/Stepper/index.js +1 -5
- package/lib/components/Stepper/index.js.map +1 -1
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/components/Table/index.js +3 -3
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/Tabs/index.js +5 -0
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/Tag/index.js.map +1 -1
- package/lib/components/TagList/index.js.map +1 -1
- package/lib/components/Tile/index.js.map +1 -1
- package/lib/components/ToastList/index.js.map +1 -1
- package/lib/components/Toggle/index.js.map +1 -1
- package/lib/components/Validation/index.js.map +1 -1
- package/lib/components/VisualCheckboxCloud/Checkbox/Checkbox.d.ts +21 -0
- package/lib/components/VisualCheckboxCloud/Checkbox/index.d.ts +3 -0
- package/lib/components/VisualCheckboxCloud/Checkbox/index.js +7 -0
- package/lib/components/VisualCheckboxCloud/Checkbox/index.js.map +1 -0
- package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss +10 -0
- package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss.d.ts +15 -0
- package/lib/components/VisualCheckboxCloud/VisualCheckboxCloud.d.ts +29 -0
- package/lib/components/VisualCheckboxCloud/index.d.ts +3 -0
- package/lib/components/VisualCheckboxCloud/index.js +42 -0
- package/lib/components/VisualCheckboxCloud/index.js.map +1 -0
- package/lib/components/VisualCheckboxCloud/styles.module.scss +6 -0
- package/lib/components/VisualCheckboxCloud/styles.module.scss.d.ts +9 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/VisualCheckbox.d.ts +26 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/VisualContent.d.ts +10 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.d.ts +3 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.js +7 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.js.map +1 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss +7 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss.d.ts +18 -0
- package/lib/components/VisualCheckboxGroup/VisualCheckboxGroup.d.ts +33 -0
- package/lib/components/VisualCheckboxGroup/index.d.ts +3 -0
- package/lib/components/VisualCheckboxGroup/index.js +47 -0
- package/lib/components/VisualCheckboxGroup/index.js.map +1 -0
- package/lib/components/VisualCheckboxGroup/styles.module.scss +6 -0
- package/lib/components/VisualCheckboxGroup/styles.module.scss.d.ts +10 -0
- package/lib/components/VisualRadioCloud/Radio/Radio.d.ts +23 -0
- package/lib/components/VisualRadioCloud/Radio/index.d.ts +3 -0
- package/lib/components/VisualRadioCloud/Radio/index.js +7 -0
- package/lib/components/VisualRadioCloud/Radio/index.js.map +1 -0
- package/lib/components/VisualRadioCloud/Radio/styles.module.scss +7 -0
- package/lib/components/VisualRadioCloud/Radio/styles.module.scss.d.ts +15 -0
- package/lib/components/VisualRadioCloud/VisualRadioCloud.d.ts +39 -0
- package/lib/components/VisualRadioCloud/index.d.ts +3 -0
- package/lib/components/VisualRadioCloud/index.js +62 -0
- package/lib/components/VisualRadioCloud/index.js.map +1 -0
- package/lib/components/VisualRadioCloud/styles.module.scss +6 -0
- package/lib/components/VisualRadioCloud/styles.module.scss.d.ts +9 -0
- package/lib/components/VisualRadioGroup/VisualRadio/VisualContent.d.ts +10 -0
- package/lib/components/VisualRadioGroup/VisualRadio/VisualRadio.d.ts +26 -0
- package/lib/components/VisualRadioGroup/VisualRadio/index.d.ts +3 -0
- package/lib/components/VisualRadioGroup/VisualRadio/index.js +7 -0
- package/lib/components/VisualRadioGroup/VisualRadio/index.js.map +1 -0
- package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss +7 -0
- package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss.d.ts +18 -0
- package/lib/components/VisualRadioGroup/VisualRadioGroup.d.ts +39 -0
- package/lib/components/VisualRadioGroup/index.d.ts +3 -0
- package/lib/components/VisualRadioGroup/index.js +67 -0
- package/lib/components/VisualRadioGroup/index.js.map +1 -0
- package/lib/components/VisualRadioGroup/styles.module.scss +6 -0
- package/lib/components/VisualRadioGroup/styles.module.scss.d.ts +10 -0
- package/lib/constants.js.map +1 -1
- package/lib/constants2.js +6 -6
- package/lib/constants2.js.map +1 -1
- package/lib/floating-ui.react.js +30 -30
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/getFilterChips.js.map +1 -1
- package/lib/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useElementList.js.map +1 -1
- package/lib/hooks/useEventListenerState.js.map +1 -1
- package/lib/hooks/useExpand.js.map +1 -1
- package/lib/hooks/useFocusToggle.js.map +1 -1
- package/lib/hooks/useFocusTrap.js.map +1 -1
- package/lib/hooks/useFocusableElements.js.map +1 -1
- package/lib/hooks/useIcons.js.map +1 -1
- package/lib/hooks/useIdWithFallback.js.map +1 -1
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useInterval.js.map +1 -1
- package/lib/hooks/useIsMobileBreakpoint.js.map +1 -1
- package/lib/hooks/useIsServerSide.js.map +1 -1
- package/lib/hooks/useIsVisible.js.map +1 -1
- package/lib/hooks/useKeyboardEvent.js.map +1 -1
- package/lib/hooks/useLanguage.js.map +1 -1
- package/lib/hooks/useLayoutEvent.js.map +1 -1
- package/lib/hooks/useOutsideEvent.js.map +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/usePseudoClasses.js.map +1 -1
- package/lib/hooks/useResizeObserver.js.map +1 -1
- package/lib/hooks/useReturnFocusOnUnmount.js.map +1 -1
- package/lib/hooks/useRovingFocus.js.map +1 -1
- package/lib/hooks/useSize.js.map +1 -1
- package/lib/hooks/useToggle.js.map +1 -1
- package/lib/hooks/usestopPropagation.js.map +1 -1
- package/lib/resourceHelper.js +42 -8
- package/lib/resourceHelper.js.map +1 -1
- package/lib/resources/HN.Designsystem.Drawer.se-NO.json.d.ts +7 -0
- package/lib/resources/HN.Designsystem.Filter.en-GB.json.d.ts +7 -4
- package/lib/resources/HN.Designsystem.Filter.nb-NO.json.d.ts +7 -4
- package/lib/resources/HN.Designsystem.Filter.nn-NO.json.d.ts +16 -0
- package/lib/resources/HN.Designsystem.Filter.se-NO.json.d.ts +16 -0
- package/lib/resources/HN.Designsystem.Tabs.se-NO.json.d.ts +7 -0
- package/lib/resources/Resources.d.ts +15 -3
- package/lib/scss/_visual-form.scss +357 -0
- package/lib/theme/currys/color.js.map +1 -1
- package/lib/theme/currys/spacing.js.map +1 -1
- package/lib/theme/grid.js.map +1 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/palette.js.map +1 -1
- package/lib/theme/spacers.js.map +1 -1
- package/lib/utils/accessibility.js.map +1 -1
- package/lib/utils/component.js.map +1 -1
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/deepContains.js.map +1 -1
- package/lib/utils/device.js.map +1 -1
- package/lib/utils/focus.js.map +1 -1
- package/lib/utils/language.js.map +1 -1
- package/lib/utils/mobile.js.map +1 -1
- package/lib/utils/refs.js.map +1 -1
- package/lib/utils/resource.js.map +1 -1
- package/lib/utils/scroll.js.map +1 -1
- package/lib/utils/viewport.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/lib/utils2.js.map +1 -1
- package/lib/utils3.js +11 -100
- package/lib/utils3.js.map +1 -1
- package/lib/utils4.js +31 -12
- package/lib/utils4.js.map +1 -1
- package/lib/utils5.js +112 -31
- package/lib/utils5.js.map +1 -1
- package/lib/uuid.js.map +1 -1
- package/package.json +133 -3
- package/scss/_visual-form.scss +357 -0
- package/lib/components/RadioButton/utils.d.ts +0 -2
- package/lib/utils6.js +0 -115
- package/lib/utils6.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxMarker.js","names":[],"sources":["../src/components/Checkbox/CheckboxMarker/CheckboxMarker.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { FormOnColor, FormSize } from '../../../constants';\nimport { getColor } from '../../../theme/currys/color';\n\nimport styles from './styles.module.scss';\n\nexport interface CheckboxMarkerProps {\n /** Whether the checkbox is checked. Controls the checkmark visibility. */\n checked?: boolean;\n /** Disables the visual state of the marker. */\n disabled?: boolean;\n /** Activates error styling. */\n error?: boolean;\n /** Background context the marker is rendered on. */\n onColor?: keyof typeof FormOnColor;\n /** Size variant of the marker. */\n size?: keyof typeof FormSize;\n /** Adds custom classes to the marker wrapper. */\n className?: string;\n}\n\n/**\n * Does not render an <input>; consumers render this on their end.\n */\nexport const CheckboxMarker: React.FC<CheckboxMarkerProps> = props => {\n const { checked = false, disabled = false, error = false, onColor = FormOnColor.onwhite, size, className } = props;\n\n const onWhite = onColor === FormOnColor.onwhite;\n const onGrey = onColor === FormOnColor.ongrey;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const onInvalid = error || onColor === FormOnColor.oninvalid;\n const onDark = onColor === FormOnColor.ondark;\n const large = size === FormSize.large;\n\n const markerClasses = classNames(\n styles['checkbox__marker'],\n {\n [styles['checkbox__marker--on-white']]: onWhite,\n [styles['checkbox__marker--on-grey']]: onGrey,\n [styles['checkbox__marker--on-invalid']]: onInvalid,\n [styles['checkbox__marker--disabled']]: disabled,\n [styles['checkbox__marker__regular--checked']]: !large && checked,\n [styles['checkbox__marker__regular--invalid']]: !large && checked && onInvalid,\n [styles['checkbox__marker__regular--on-dark']]: !large && checked && onDark,\n [styles['checkbox__marker__large--checked']]: large && checked,\n [styles['checkbox__marker__large--invalid']]: large && onInvalid,\n [styles['checkbox__marker--on-dark']]: onDark,\n [styles['checkbox__marker--on-blueberry']]: onBlueberry,\n [styles['checkbox__marker--invalid']]: onInvalid,\n [styles['checkbox__marker__large--invalid']]: large && checked && onInvalid,\n [styles['checkbox__marker__large--disabled']]: disabled && large && checked,\n [styles['checkbox__marker__large--checked--invalid']]: large && checked && onInvalid,\n [styles['checkbox__marker__large--checked--disabled']]: disabled && large && checked,\n },\n className\n );\n\n const getIconColor = (): string => {\n if (disabled) {\n return getColor('neutral', 700);\n }\n if (large && checked && onInvalid) {\n return getColor('white');\n }\n if (onDark || (large && checked)) {\n return getColor('blueberry', 900);\n }\n return getColor('white');\n };\n const iconColor = getIconColor();\n\n return (\n <span className={markerClasses}>\n {checked && (\n <span className={styles['checkbox__marker-icon']} aria-hidden=\"true\">\n <svg\n strokeWidth=\"2.75\"\n width=\"18\"\n height=\"16\"\n viewBox=\"0 0 16 12\"\n fill=\"none\"\n stroke={iconColor}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M1 6 L6 11 L15 1\" />\n </svg>\n </span>\n )}\n </span>\n );\n};\n\nexport default CheckboxMarker;\n"],"mappings":";;;;;;;;;AAyBA,IAAa,kBAAgD,UAAS;CACpE,MAAM,EAAE,UAAU,OAAO,WAAW,OAAO,QAAQ,OAAO,UAAU,YAAY,SAAS,MAAM,cAAc;CAE7G,MAAM,UAAU,YAAY,YAAY;CACxC,MAAM,SAAS,YAAY,YAAY;CACvC,MAAM,cAAc,YAAY,YAAY;CAC5C,MAAM,YAAY,SAAS,YAAY,YAAY;CACnD,MAAM,SAAS,YAAY,YAAY;CACvC,MAAM,QAAQ,SAAS,SAAS;CAEhC,MAAM,gBAAgB,WACpB,OAAO,qBACP;GACG,OAAO,gCAAgC;GACvC,OAAO,+BAA+B;GACtC,OAAO,kCAAkC;GACzC,OAAO,gCAAgC;GACvC,OAAO,wCAAwC,CAAC,SAAS;GACzD,OAAO,wCAAwC,CAAC,SAAS,WAAW;GACpE,OAAO,wCAAwC,CAAC,SAAS,WAAW;GACpE,OAAO,sCAAsC,SAAS;GACtD,OAAO,sCAAsC,SAAS;GACtD,OAAO,+BAA+B;GACtC,OAAO,oCAAoC;GAC3C,OAAO,+BAA+B;GACtC,OAAO,sCAAsC,SAAS,WAAW;GACjE,OAAO,uCAAuC,YAAY,SAAS;GACnE,OAAO,+CAA+C,SAAS,WAAW;GAC1E,OAAO,gDAAgD,YAAY,SAAS;CAC/E,GACA,SACF;CAEA,MAAM,qBAA6B;EACjC,IAAI,UACF,OAAO,SAAS,WAAW,GAAG;EAEhC,IAAI,SAAS,WAAW,WACtB,OAAO,SAAS,OAAO;EAEzB,IAAI,UAAW,SAAS,SACtB,OAAO,SAAS,aAAa,GAAG;EAElC,OAAO,SAAS,OAAO;CACzB;CACA,MAAM,YAAY,aAAa;CAE/B,OACE,oBAAC,QAAD;EAAM,WAAW;YACd,WACC,oBAAC,QAAD;GAAM,WAAW,OAAO;GAA0B,eAAY;aAC5D,oBAAC,OAAD;IACE,aAAY;IACZ,OAAM;IACN,QAAO;IACP,SAAQ;IACR,MAAK;IACL,QAAQ;IACR,OAAM;cAEN,oBAAC,QAAD,EAAM,GAAE,mBAAoB,CAAA;GACzB,CAAA;EACD,CAAA;CAEJ,CAAA;AAEV"}
|
package/lib/Chip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.js","names":[],"sources":["../src/resources/HN.Designsystem.Chip.en-GB.json","../src/resources/HN.Designsystem.Chip.nb-NO.json","../src/components/Chip/resourceHelper.ts","../src/components/Chip/Chip.tsx","../src/components/Chip/index.ts"],"sourcesContent":["{\n \"removeAriaLabel\": \"Remove\"\n}\n","{\n \"removeAriaLabel\": \"Fjern\"\n}\n","import type { HNDesignsystemChip } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Chip.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Chip.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemChip => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport type { HNDesignsystemChip } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport Icon, { IconSize } from '../Icon';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport interface ChipProps {\n /** Sets the text of the chip */\n children: string;\n /** Wether or not to have a close button */\n withCloseButton?: boolean;\n /** onClick handler for text-part of the chip */\n onChipClick?: () => void;\n /** Button props for main chip button */\n chipButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n /** onClick handler for close button */\n onCloseClick?: () => void;\n /** Button props for the close button */\n closeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Sets the data-testid attribute on the expander button. */\n testId?: string;\n /** Resources for the component */\n resources?: Partial<HNDesignsystemChip>;\n}\n\nconst Chip: React.FC<ChipProps> = props => {\n const { children, onChipClick, onCloseClick, chipButtonProps, closeButtonProps, testId, withCloseButton = true, resources } = props;\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemChip = {\n ...defaultResources,\n ...resources,\n removeAriaLabel: closeButtonProps?.['aria-label'] || resources?.removeAriaLabel || `${defaultResources.removeAriaLabel} ${children}`,\n };\n\n return (\n <div className={styles['chip']}>\n <button\n {...chipButtonProps}\n className={classNames(styles['chip__chip'])}\n onClick={onChipClick}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.Tag}\n >\n <span\n className={classNames(styles['chip__chip__inner'], {\n [styles['chip__chip__inner--without-close']]: !withCloseButton,\n })}\n >\n {children}\n </span>\n </button>\n {withCloseButton && (\n <button\n {...closeButtonProps}\n aria-label={mergedResources.removeAriaLabel}\n className={classNames(styles['chip__close'])}\n onClick={onCloseClick}\n type=\"button\"\n data-testid={`${testId}-close`}\n data-analyticsid={AnalyticsId.Tag}\n >\n <span className={styles['chip__close__inner']}>\n <Icon svgIcon={X} size={IconSize.XXSmall} />\n </span>\n </button>\n )}\n </div>\n );\n};\n\nexport default Chip;\n","import Chip from './Chip';\nexport * from './Chip';\nexport default Chip;\n"],"mappings":";;;;;;;;;;;AEMA,IAAa,gBAAgB,aAAkD;CAC7E,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO
|
|
1
|
+
{"version":3,"file":"Chip.js","names":[],"sources":["../src/resources/HN.Designsystem.Chip.en-GB.json","../src/resources/HN.Designsystem.Chip.nb-NO.json","../src/components/Chip/resourceHelper.ts","../src/components/Chip/Chip.tsx","../src/components/Chip/index.ts"],"sourcesContent":["{\n \"removeAriaLabel\": \"Remove\"\n}\n","{\n \"removeAriaLabel\": \"Fjern\"\n}\n","import type { HNDesignsystemChip } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Chip.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Chip.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemChip => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport type { HNDesignsystemChip } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport Icon, { IconSize } from '../Icon';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport interface ChipProps {\n /** Sets the text of the chip */\n children: string;\n /** Wether or not to have a close button */\n withCloseButton?: boolean;\n /** onClick handler for text-part of the chip */\n onChipClick?: () => void;\n /** Button props for main chip button */\n chipButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n /** onClick handler for close button */\n onCloseClick?: () => void;\n /** Button props for the close button */\n closeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n /** Sets the data-testid attribute on the expander button. */\n testId?: string;\n /** Resources for the component */\n resources?: Partial<HNDesignsystemChip>;\n}\n\nconst Chip: React.FC<ChipProps> = props => {\n const { children, onChipClick, onCloseClick, chipButtonProps, closeButtonProps, testId, withCloseButton = true, resources } = props;\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const mergedResources: HNDesignsystemChip = {\n ...defaultResources,\n ...resources,\n removeAriaLabel: closeButtonProps?.['aria-label'] || resources?.removeAriaLabel || `${defaultResources.removeAriaLabel} ${children}`,\n };\n\n return (\n <div className={styles['chip']}>\n <button\n {...chipButtonProps}\n className={classNames(styles['chip__chip'])}\n onClick={onChipClick}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.Tag}\n >\n <span\n className={classNames(styles['chip__chip__inner'], {\n [styles['chip__chip__inner--without-close']]: !withCloseButton,\n })}\n >\n {children}\n </span>\n </button>\n {withCloseButton && (\n <button\n {...closeButtonProps}\n aria-label={mergedResources.removeAriaLabel}\n className={classNames(styles['chip__close'])}\n onClick={onCloseClick}\n type=\"button\"\n data-testid={`${testId}-close`}\n data-analyticsid={AnalyticsId.Tag}\n >\n <span className={styles['chip__close__inner']}>\n <Icon svgIcon={X} size={IconSize.XXSmall} />\n </span>\n </button>\n )}\n </div>\n );\n};\n\nexport default Chip;\n","import Chip from './Chip';\nexport * from './Chip';\nexport default Chip;\n"],"mappings":";;;;;;;;;;;AEMA,IAAa,gBAAgB,aAAkD;CAC7E,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACiBA,IAAM,QAA4B,UAAS;CACzC,MAAM,EAAE,UAAU,aAAa,cAAc,iBAAiB,kBAAkB,QAAQ,kBAAkB,MAAM,cAAc;CAC9H,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAC3E,MAAM,mBAAmB,aAAa,QAAQ;CAC9C,MAAM,kBAAsC;EAC1C,GAAG;EACH,GAAG;EACH,iBAAiB,mBAAmB,iBAAiB,WAAW,mBAAmB,GAAG,iBAAiB,gBAAgB,GAAG;CAC5H;CAEA,OACE,qBAAC,OAAD;EAAK,WAAW,OAAO;YAAvB,CACE,oBAAC,UAAD;GACE,GAAI;GACJ,WAAW,WAAW,OAAO,aAAa;GAC1C,SAAS;GACT,MAAK;GACL,eAAa;GACb,oBAAkB,YAAY;aAE9B,oBAAC,QAAD;IACE,WAAW,WAAW,OAAO,sBAAsB,GAChD,OAAO,sCAAsC,CAAC,gBACjD,CAAC;IAEA;GACG,CAAA;EACA,CAAA,GACP,mBACC,oBAAC,UAAD;GACE,GAAI;GACJ,cAAY,gBAAgB;GAC5B,WAAW,WAAW,OAAO,cAAc;GAC3C,SAAS;GACT,MAAK;GACL,eAAa,GAAG,OAAO;GACvB,oBAAkB,YAAY;aAE9B,oBAAC,QAAD;IAAM,WAAW,OAAO;cACtB,oBAAC,cAAD;KAAM,SAAS;KAAG,MAAM,SAAS;IAAU,CAAA;GACvC,CAAA;EACA,CAAA,CAEP;;AAET;;;AC1EA,IAAA,eAAe"}
|
package/lib/Close.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Close.js","names":[],"sources":["../src/components/Close/Close.tsx","../src/components/Close/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon from '../Icon';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport interface CloseProps {\n /** Keeps the icon small for all screen sizes */\n small?: boolean;\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Gives color to the svg */\n color?: 'blueberry' | 'black' | 'plum';\n /** Ref that is passed to the component */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nconst Close: React.FC<CloseProps> = props => {\n const { small, testId, ariaLabel = 'Lukk', onClick, className, color = 'blueberry', ref } = props;\n const { refObject, isHovered } = usePseudoClasses();\n\n const iconSize = useIsMobileBreakpoint() || small ? 38 : 48;\n\n let iconColor;\n if (color === 'black') {\n iconColor = 'black';\n } else if (color === 'plum') {\n iconColor = 'var(--core-color-plum-700)';\n } else {\n iconColor = 'var(--color-action-graphics-onlight)';\n }\n\n const closeClasses = classNames(styles.close, { [styles['close--small']]: small }, className);\n\n return (\n <button\n ref={mergeRefs([ref, refObject])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Close}\n className={closeClasses}\n aria-label={ariaLabel}\n onClick={onClick}\n type=\"button\"\n >\n <span\n className={classNames(styles['close__inner-container'], {\n [styles['close__inner-container--small']]: small,\n [styles['close__inner-container--plum']]: color == 'plum',\n })}\n >\n <Icon svgIcon={X} color={iconColor} size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n};\n\nexport default Close;\n","import Close from './Close';\nexport * from './Close';\nexport default Close;\n"],"mappings":";;;;;;;;;;AA4BA,IAAM,SAA8B,UAAS;CAC3C,MAAM,EAAE,OAAO,QAAQ,YAAY,QAAQ,SAAS,WAAW,QAAQ,aAAa,QAAQ;CAC5F,MAAM,EAAE,WAAW,cAAc,
|
|
1
|
+
{"version":3,"file":"Close.js","names":[],"sources":["../src/components/Close/Close.tsx","../src/components/Close/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon from '../Icon';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport interface CloseProps {\n /** Keeps the icon small for all screen sizes */\n small?: boolean;\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Gives color to the svg */\n color?: 'blueberry' | 'black' | 'plum';\n /** Ref that is passed to the component */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nconst Close: React.FC<CloseProps> = props => {\n const { small, testId, ariaLabel = 'Lukk', onClick, className, color = 'blueberry', ref } = props;\n const { refObject, isHovered } = usePseudoClasses();\n\n const iconSize = useIsMobileBreakpoint() || small ? 38 : 48;\n\n let iconColor;\n if (color === 'black') {\n iconColor = 'black';\n } else if (color === 'plum') {\n iconColor = 'var(--core-color-plum-700)';\n } else {\n iconColor = 'var(--color-action-graphics-onlight)';\n }\n\n const closeClasses = classNames(styles.close, { [styles['close--small']]: small }, className);\n\n return (\n <button\n ref={mergeRefs([ref, refObject])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Close}\n className={closeClasses}\n aria-label={ariaLabel}\n onClick={onClick}\n type=\"button\"\n >\n <span\n className={classNames(styles['close__inner-container'], {\n [styles['close__inner-container--small']]: small,\n [styles['close__inner-container--plum']]: color == 'plum',\n })}\n >\n <Icon svgIcon={X} color={iconColor} size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n};\n\nexport default Close;\n","import Close from './Close';\nexport * from './Close';\nexport default Close;\n"],"mappings":";;;;;;;;;;AA4BA,IAAM,SAA8B,UAAS;CAC3C,MAAM,EAAE,OAAO,QAAQ,YAAY,QAAQ,SAAS,WAAW,QAAQ,aAAa,QAAQ;CAC5F,MAAM,EAAE,WAAW,cAAc,iBAAiB;CAElD,MAAM,WAAW,sBAAsB,KAAK,QAAQ,KAAK;CAEzD,IAAI;CACJ,IAAI,UAAU,SACZ,YAAY;MACP,IAAI,UAAU,QACnB,YAAY;MAEZ,YAAY;CAGd,MAAM,eAAe,WAAW,OAAO,OAAO,GAAG,OAAO,kBAAkB,MAAM,GAAG,SAAS;CAE5F,OACE,oBAAC,UAAD;EACE,KAAK,UAAU,CAAC,KAAK,SAAS,CAAC;EAC/B,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,cAAY;EACH;EACT,MAAK;YAEL,oBAAC,QAAD;GACE,WAAW,WAAW,OAAO,2BAA2B;KACrD,OAAO,mCAAmC;KAC1C,OAAO,kCAAkC,SAAS;GACrD,CAAC;aAED,oBAAC,cAAD;IAAM,SAAS;IAAG,OAAO;IAAW,MAAM;IAAqB;GAAY,CAAA;EACvE,CAAA;CACA,CAAA;AAEZ;;;AC/DA,IAAA,gBAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryTrigger.js","names":[],"sources":["../src/components/DictionaryTrigger/DictionaryTrigger.tsx","../src/components/DictionaryTrigger/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport interface DictionaryTriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onFocus' | 'onBlur'> {\n /**\n * Sets the content of the trigger.\n */\n children: React.ReactNode;\n /**\n * Indicates that the trigger is in use.\n */\n selected?: boolean;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Sets the data-testid attribute.\n */\n testId?: string;\n /**\n * ref that is passed to the component\n */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nconst DictionaryTrigger: React.FC<DictionaryTriggerProps> = (props: DictionaryTriggerProps) => {\n const { children, selected = false, className, testId, ref, ...rest } = props;\n const triggerClasses = classNames(styles.dictionarytrigger, className);\n\n return (\n <button\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.DictionaryTrigger}\n className={triggerClasses}\n aria-expanded={selected}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nDictionaryTrigger.displayName = 'DictionaryTrigger';\n\nexport default DictionaryTrigger;\n","import DictionaryTrigger from './DictionaryTrigger';\nexport * from './DictionaryTrigger';\nexport default DictionaryTrigger;\n"],"mappings":";;;;;AA6BA,IAAM,qBAAuD,UAAkC;CAC7F,MAAM,EAAE,UAAU,WAAW,OAAO,WAAW,QAAQ,KAAK,GAAG,SAAS;CACxE,MAAM,iBAAiB,WAAW,OAAO,mBAAmB,
|
|
1
|
+
{"version":3,"file":"DictionaryTrigger.js","names":[],"sources":["../src/components/DictionaryTrigger/DictionaryTrigger.tsx","../src/components/DictionaryTrigger/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport interface DictionaryTriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onFocus' | 'onBlur'> {\n /**\n * Sets the content of the trigger.\n */\n children: React.ReactNode;\n /**\n * Indicates that the trigger is in use.\n */\n selected?: boolean;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Sets the data-testid attribute.\n */\n testId?: string;\n /**\n * ref that is passed to the component\n */\n ref?: React.Ref<HTMLButtonElement | null>;\n}\n\nconst DictionaryTrigger: React.FC<DictionaryTriggerProps> = (props: DictionaryTriggerProps) => {\n const { children, selected = false, className, testId, ref, ...rest } = props;\n const triggerClasses = classNames(styles.dictionarytrigger, className);\n\n return (\n <button\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.DictionaryTrigger}\n className={triggerClasses}\n aria-expanded={selected}\n ref={ref}\n {...rest}\n >\n {children}\n </button>\n );\n};\n\nDictionaryTrigger.displayName = 'DictionaryTrigger';\n\nexport default DictionaryTrigger;\n","import DictionaryTrigger from './DictionaryTrigger';\nexport * from './DictionaryTrigger';\nexport default DictionaryTrigger;\n"],"mappings":";;;;;AA6BA,IAAM,qBAAuD,UAAkC;CAC7F,MAAM,EAAE,UAAU,WAAW,OAAO,WAAW,QAAQ,KAAK,GAAG,SAAS;CACxE,MAAM,iBAAiB,WAAW,OAAO,mBAAmB,SAAS;CAErE,OACE,oBAAC,UAAD;EACE,MAAK;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,iBAAe;EACV;EACL,GAAI;EAEH;CACK,CAAA;AAEZ;AAEA,kBAAkB,cAAc;;;AC9ChC,IAAA,4BAAe"}
|
package/lib/Drawer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as uuid } from "./uuid.js";
|
|
2
2
|
import { AnalyticsId, KeyboardEventKey, LanguageLocales, ZIndex } from "./constants.js";
|
|
3
|
+
import { usePseudoClasses } from "./hooks/usePseudoClasses.js";
|
|
3
4
|
import { t as Icon_default } from "./Icon.js";
|
|
4
5
|
import { useLanguage } from "./hooks/useLanguage.js";
|
|
5
6
|
import { useIsMobileBreakpoint } from "./hooks/useIsMobileBreakpoint.js";
|
|
@@ -12,13 +13,14 @@ import { useOutsideEvent } from "./hooks/useOutsideEvent.js";
|
|
|
12
13
|
import { t as Close_default } from "./Close.js";
|
|
13
14
|
import { useReturnFocusOnUnmount } from "./hooks/useReturnFocusOnUnmount.js";
|
|
14
15
|
import { disableBodyScroll, enableBodyScroll } from "./utils/scroll.js";
|
|
15
|
-
import ChevronLeft from "./components/Icons/ChevronLeft.js";
|
|
16
16
|
import Title_default from "./components/Title/index.js";
|
|
17
|
+
import ChevronLeft from "./components/Icons/ChevronLeft.js";
|
|
17
18
|
import classNames from "classnames";
|
|
18
19
|
import React, { useEffect, useRef } from "react";
|
|
19
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
20
21
|
import { AnimatePresence, useAnimate, usePresence } from "motion/react";
|
|
21
|
-
import styles from "./components/Drawer/
|
|
22
|
+
import styles from "./components/Drawer/DrawerBackButton.module.scss";
|
|
23
|
+
import styles$1 from "./components/Drawer/styles.module.scss";
|
|
22
24
|
var HN_Designsystem_Drawer_en_GB_default = {
|
|
23
25
|
ariaLabelCloseBtn: "Close",
|
|
24
26
|
ariaLabelBackButton: "Go back"
|
|
@@ -31,17 +33,45 @@ var HN_Designsystem_Drawer_nn_NO_default = {
|
|
|
31
33
|
ariaLabelCloseBtn: "Lukk",
|
|
32
34
|
ariaLabelBackButton: "Gå tilbake"
|
|
33
35
|
};
|
|
36
|
+
var HN_Designsystem_Drawer_se_NO_default = {
|
|
37
|
+
ariaLabelCloseBtn: "Gidde",
|
|
38
|
+
ariaLabelBackButton: "Mana ruovttoluotta"
|
|
39
|
+
};
|
|
34
40
|
//#endregion
|
|
35
41
|
//#region src/components/Drawer/resourceHelper.ts
|
|
36
42
|
var getResources = (language) => {
|
|
37
43
|
switch (language) {
|
|
38
44
|
case LanguageLocales.ENGLISH: return HN_Designsystem_Drawer_en_GB_default;
|
|
39
45
|
case LanguageLocales.NORWEGIAN_NYNORSK: return HN_Designsystem_Drawer_nn_NO_default;
|
|
46
|
+
case LanguageLocales.SAMI_NORTHERN: return HN_Designsystem_Drawer_se_NO_default;
|
|
40
47
|
case LanguageLocales.NORWEGIAN:
|
|
41
48
|
default: return HN_Designsystem_Drawer_nb_NO_default;
|
|
42
49
|
}
|
|
43
50
|
};
|
|
44
51
|
//#endregion
|
|
52
|
+
//#region src/components/Drawer/DrawerBackButton.tsx
|
|
53
|
+
var DrawerBackButton = (props) => {
|
|
54
|
+
const { ariaLabel = "Tilbake", onClick, className } = props;
|
|
55
|
+
const { refObject, isHovered } = usePseudoClasses();
|
|
56
|
+
const iconSize = useIsMobileBreakpoint() ? 38 : 48;
|
|
57
|
+
return /* @__PURE__ */ jsx("button", {
|
|
58
|
+
ref: refObject,
|
|
59
|
+
className: classNames(styles["back-button"], className),
|
|
60
|
+
"aria-label": ariaLabel,
|
|
61
|
+
onClick,
|
|
62
|
+
type: "button",
|
|
63
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: classNames(styles["back-button__inner-container"]),
|
|
65
|
+
children: /* @__PURE__ */ jsx(Icon_default, {
|
|
66
|
+
svgIcon: ChevronLeft,
|
|
67
|
+
color: "var(--color-action-graphics-onlight",
|
|
68
|
+
size: iconSize,
|
|
69
|
+
isHovered
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
45
75
|
//#region src/components/Drawer/Drawer.tsx
|
|
46
76
|
var Drawer = (props) => {
|
|
47
77
|
const { isOpen, ...rest } = props;
|
|
@@ -78,7 +108,7 @@ var InnerDrawer = (props) => {
|
|
|
78
108
|
...resources
|
|
79
109
|
};
|
|
80
110
|
const contentIsScrollable = contentRef.current && contentRef.current.scrollHeight > contentRef.current.clientHeight;
|
|
81
|
-
const headerStyling = classNames(styles.drawer__header, headerClasses);
|
|
111
|
+
const headerStyling = classNames(styles$1.drawer__header, headerClasses);
|
|
82
112
|
const hasFooterContent = typeof footerContent !== "undefined" && footerContent || onPrimaryAction || onSecondaryAction;
|
|
83
113
|
useFocusTrap(containerRef, true);
|
|
84
114
|
useReturnFocusOnUnmount(containerRef);
|
|
@@ -159,23 +189,23 @@ var InnerDrawer = (props) => {
|
|
|
159
189
|
titleRef.current?.focus();
|
|
160
190
|
}, [title]);
|
|
161
191
|
return /* @__PURE__ */ jsxs("div", {
|
|
162
|
-
className: styles.drawer,
|
|
192
|
+
className: styles$1.drawer,
|
|
163
193
|
ref: scope,
|
|
164
194
|
style: { zIndex },
|
|
165
195
|
"data-analyticsid": AnalyticsId.Drawer,
|
|
166
196
|
children: [/* @__PURE__ */ jsx("div", {
|
|
167
|
-
className: styles.drawer__overlay,
|
|
197
|
+
className: styles$1.drawer__overlay,
|
|
168
198
|
ref: overlayRef,
|
|
169
199
|
"aria-hidden": "true"
|
|
170
200
|
}), /* @__PURE__ */ jsxs("div", {
|
|
171
|
-
className: classNames(styles.drawer__container, { [styles["drawer__container--right"]]: desktopDirection === "right" }),
|
|
201
|
+
className: classNames(styles$1.drawer__container, { [styles$1["drawer__container--right"]]: desktopDirection === "right" }),
|
|
172
202
|
ref: containerRef,
|
|
173
203
|
role: "dialog",
|
|
174
204
|
"aria-modal": "true",
|
|
175
205
|
tabIndex: -1,
|
|
176
206
|
...ariaLabelAttributes,
|
|
177
207
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
178
|
-
className: styles.drawer__container__inner,
|
|
208
|
+
className: styles$1.drawer__container__inner,
|
|
179
209
|
children: [
|
|
180
210
|
/* @__PURE__ */ jsxs("div", {
|
|
181
211
|
className: headerStyling,
|
|
@@ -183,37 +213,35 @@ var InnerDrawer = (props) => {
|
|
|
183
213
|
children: [
|
|
184
214
|
/* @__PURE__ */ jsx(Title_default, {
|
|
185
215
|
id: ariaLabelAttributes?.["aria-labelledby"],
|
|
186
|
-
className: styles["drawer__header__title"],
|
|
216
|
+
className: styles$1["drawer__header__title"],
|
|
187
217
|
htmlMarkup: titleHtmlMarkup,
|
|
188
218
|
appearance: "title3",
|
|
189
219
|
ref: titleRef,
|
|
190
220
|
tabIndex: -1,
|
|
191
221
|
children: title
|
|
192
222
|
}),
|
|
193
|
-
withBackButton && onRequestBack !== void 0 && /* @__PURE__ */ jsx(
|
|
223
|
+
withBackButton && onRequestBack !== void 0 && /* @__PURE__ */ jsx(DrawerBackButton, {
|
|
194
224
|
ariaLabel: mergedResources.ariaLabelBackButton,
|
|
195
225
|
onClick: onRequestBack,
|
|
196
|
-
|
|
197
|
-
wrapperClassName: styles["drawer__header__back-button"],
|
|
198
|
-
children: /* @__PURE__ */ jsx(Icon_default, { svgIcon: ChevronLeft })
|
|
226
|
+
className: styles$1["drawer__header__back-button"]
|
|
199
227
|
}),
|
|
200
228
|
!noCloseButton && onRequestClose != void 0 && /* @__PURE__ */ jsx(Close_default, {
|
|
201
229
|
ariaLabel: mergedResources.ariaLabelCloseBtn,
|
|
202
230
|
color: closeColor,
|
|
203
231
|
onClick: onRequestClose,
|
|
204
|
-
className: styles["drawer__header__close-button"]
|
|
232
|
+
className: styles$1["drawer__header__close-button"]
|
|
205
233
|
})
|
|
206
234
|
]
|
|
207
235
|
}),
|
|
208
236
|
/* @__PURE__ */ jsx("div", {
|
|
209
|
-
className: classNames(styles["drawer__content__shadow"], styles["drawer__content__shadow--top"]),
|
|
237
|
+
className: classNames(styles$1["drawer__content__shadow"], styles$1["drawer__content__shadow--top"]),
|
|
210
238
|
style: {
|
|
211
239
|
opacity: !topContentVisible && contentIsScrollable ? 1 : 0,
|
|
212
240
|
top: headerHeight
|
|
213
241
|
}
|
|
214
242
|
}),
|
|
215
243
|
/* @__PURE__ */ jsxs("div", {
|
|
216
|
-
className: classNames(styles.drawer__content, contentClassName),
|
|
244
|
+
className: classNames(styles$1.drawer__content, contentClassName),
|
|
217
245
|
tabIndex: contentIsScrollable ? 0 : void 0,
|
|
218
246
|
role: contentIsScrollable ? "region" : void 0,
|
|
219
247
|
...contentIsScrollable ? ariaLabelAttributes : {},
|
|
@@ -221,7 +249,7 @@ var InnerDrawer = (props) => {
|
|
|
221
249
|
children: [
|
|
222
250
|
/* @__PURE__ */ jsx("div", { ref: topContent }),
|
|
223
251
|
/* @__PURE__ */ jsx("div", {
|
|
224
|
-
className: styles["drawer__content__children"],
|
|
252
|
+
className: styles$1["drawer__content__children"],
|
|
225
253
|
children
|
|
226
254
|
}),
|
|
227
255
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -231,7 +259,7 @@ var InnerDrawer = (props) => {
|
|
|
231
259
|
]
|
|
232
260
|
}),
|
|
233
261
|
/* @__PURE__ */ jsx("div", {
|
|
234
|
-
className: classNames(styles["drawer__content__shadow"], styles["drawer__content__shadow--bottom"]),
|
|
262
|
+
className: classNames(styles$1["drawer__content__shadow"], styles$1["drawer__content__shadow--bottom"]),
|
|
235
263
|
style: {
|
|
236
264
|
opacity: !bottomContentVisible && contentIsScrollable ? 1 : 0,
|
|
237
265
|
bottom: hasFooterContent ? footerHeight : 0
|
|
@@ -239,7 +267,7 @@ var InnerDrawer = (props) => {
|
|
|
239
267
|
})
|
|
240
268
|
]
|
|
241
269
|
}), hasFooterContent && /* @__PURE__ */ jsx("div", {
|
|
242
|
-
className: styles.drawer__footer,
|
|
270
|
+
className: styles$1.drawer__footer,
|
|
243
271
|
ref: footerRef,
|
|
244
272
|
children: footerContent ? footerContent : /* @__PURE__ */ jsxs(Fragment, { children: [onPrimaryAction && /* @__PURE__ */ jsx(Button_default, {
|
|
245
273
|
onClick: () => handleCTA(onPrimaryAction),
|
package/lib/Drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","names":[],"sources":["../src/resources/HN.Designsystem.Drawer.en-GB.json","../src/resources/HN.Designsystem.Drawer.nb-NO.json","../src/resources/HN.Designsystem.Drawer.nn-NO.json","../src/components/Drawer/resourceHelper.ts","../src/components/Drawer/Drawer.tsx","../src/components/Drawer/index.ts"],"sourcesContent":["{\n \"ariaLabelCloseBtn\": \"Close\",\n \"ariaLabelBackButton\": \"Go back\"\n}\n","{\n \"ariaLabelBackButton\": \"Gå tilbake\",\n \"ariaLabelCloseBtn\": \"Lukk\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Lukk\",\n \"ariaLabelBackButton\": \"Gå tilbake\"\n}\n","import type { HNDesignsystemDrawer } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Drawer.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Drawer.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.Drawer.nn-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDrawer => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\nimport { AnimatePresence, useAnimate, usePresence } from 'motion/react';\n\nimport type { HNDesignsystemDrawer } from '../../resources/Resources';\nimport type { TitleTags } from '../Title';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, KeyboardEventKey, LanguageLocales, ZIndex } from '../../constants';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useKeyboardEvent } from '../../hooks/useKeyboardEvent';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { useReturnFocusOnUnmount } from '../../hooks/useReturnFocusOnUnmount';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { disableBodyScroll, enableBodyScroll } from '../../utils/scroll';\nimport uuid from '../../utils/uuid';\nimport Button from '../Button';\nimport Close from '../Close';\nimport Icon from '../Icon';\nimport ChevronLeft from '../Icons/ChevronLeft';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\ntype DesktopDirections = 'left' | 'right';\n\nexport interface DrawerProps extends InnerDrawerProps {\n /** Opens and closes the drawer */\n isOpen: boolean;\n}\n\nexport interface InnerDrawerProps {\n /** Sets the aria-label of the drawer */\n ariaLabel?: string;\n /** Sets the aria-labelledby of the drawer */\n ariaLabelledBy?: string;\n /** Sets the style of the Drawer Close button. Meant for use by HelpDrawer */\n closeColor?: 'blueberry' | 'plum';\n /** Direction of the drawer on desktop. Default: left */\n desktopDirection?: DesktopDirections;\n /** Sets the style of the Drawer header */\n headerClasses?: string;\n /** Title to display in the header of the drawer */\n title: string;\n /** id of the drawer title */\n titleId?: string;\n /** Changes the underlying element of the title. Default: h3 */\n titleHtmlMarkup?: TitleTags;\n /** Callback that triggers when clicking on close button or outside the drawer, update isOpen state when this triggers */\n onRequestClose?: () => void;\n /** Optional footer content that can be rendered instead of default CTA(s) */\n footerContent?: React.ReactNode;\n /** Main content of the drawer */\n children?: React.ReactNode;\n /** Hides the close button */\n noCloseButton?: boolean;\n /** Primary CTA callback */\n onPrimaryAction?: () => void;\n /** Text for primary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n primaryActionText?: string;\n /** Text for secondary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n secondaryActionText?: string;\n /** Secondary CTA callback */\n onSecondaryAction?: () => void;\n /** Customize the z-index of the drawer */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDrawer>;\n /** Sets mobile styling and animation from outer level Drawer */\n isMobile?: boolean;\n /** Shows a back button to the left of title */\n withBackButton?: boolean;\n /** Callback for the back button */\n onRequestBack?: () => void;\n /** Sets classname for content part in Drawer */\n contentClassName?: string;\n}\n\nconst Drawer: React.FC<DrawerProps> = props => {\n const { isOpen, ...rest } = props;\n const isMobile = useIsMobileBreakpoint();\n\n return <AnimatePresence>{isOpen && <InnerDrawer {...rest} isMobile={isMobile} />}</AnimatePresence>;\n};\n\nconst InnerDrawer: React.FC<InnerDrawerProps> = props => {\n const {\n ariaLabel,\n ariaLabelledBy,\n children,\n closeColor = 'blueberry',\n desktopDirection = 'left',\n footerContent,\n headerClasses,\n noCloseButton = false,\n onPrimaryAction,\n onRequestClose,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n titleHtmlMarkup = 'h3',\n titleId = uuid(),\n zIndex = ZIndex.OverlayScreen,\n resources,\n isMobile,\n withBackButton,\n onRequestBack,\n contentClassName,\n } = props;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledBy, fallbackId: titleId });\n const overlayRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n // topContent and bottomContent are used to detect scroll position for shadow effects\n const topContent = useRef<HTMLDivElement>(null);\n const bottomContent = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const titleRef = useRef<HTMLHeadingElement>(null);\n const [scope, animate] = useAnimate();\n const [isPresent, safeToRemove] = usePresence();\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const topContentVisible = useIsVisible(topContent);\n const bottomContentVisible = useIsVisible(bottomContent, 0);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDrawer = {\n ...defaultResources,\n ...resources,\n };\n\n // eslint-disable-next-line react-hooks/refs\n const contentIsScrollable = contentRef.current && contentRef.current.scrollHeight > contentRef.current.clientHeight;\n const headerStyling = classNames(styles.drawer__header, headerClasses);\n const hasFooterContent = (typeof footerContent !== 'undefined' && footerContent) || onPrimaryAction || onSecondaryAction;\n\n useFocusTrap(containerRef, true);\n useReturnFocusOnUnmount(containerRef);\n useOutsideEvent(containerRef, () => {\n if (onRequestClose) onRequestClose();\n });\n useKeyboardEvent(containerRef, () => onRequestClose && onRequestClose(), [KeyboardEventKey.Escape]);\n\n // Close animasjon, vi kaller `onClose()` til slutt\n const closeDrawer = (): void => {\n if (!overlayRef.current || !containerRef.current) return;\n\n animate(overlayRef.current, { opacity: 0, pointerEvents: 'none' }, { duration: 0.3, ease: 'easeInOut' });\n\n if (isMobile) {\n animate(\n containerRef.current,\n { y: '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n } else {\n animate(\n containerRef.current,\n { x: desktopDirection === 'left' ? '-100%' : '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n }\n };\n\n useEffect(() => {\n containerRef.current?.focus();\n disableBodyScroll();\n\n return (): void => {\n enableBodyScroll();\n };\n }, []);\n\n // Measure header and footer heights\n useEffect(() => {\n const updateHeights = (): void => {\n if (headerRef.current) {\n setHeaderHeight(headerRef.current.offsetHeight);\n }\n if (footerRef.current) {\n setFooterHeight(footerRef.current.offsetHeight);\n }\n };\n\n updateHeights();\n\n // Update heights when content changes\n const resizeObserver = new ResizeObserver(updateHeights);\n if (headerRef.current) {\n resizeObserver.observe(headerRef.current);\n }\n if (footerRef.current) {\n resizeObserver.observe(footerRef.current);\n }\n\n return (): void => {\n resizeObserver.disconnect();\n };\n }, [hasFooterContent]);\n\n // Open animation.\n useEffect(() => {\n if (!overlayRef.current || !containerRef.current) return;\n\n if (!isPresent) {\n closeDrawer();\n return;\n }\n\n if (isMobile) {\n animate(containerRef.current, { y: '0' }, { duration: 0.3, ease: 'easeInOut' });\n } else {\n animate(containerRef.current, { x: '0' }, { duration: 0.3, ease: 'easeInOut' });\n }\n\n animate(overlayRef.current, { opacity: 1, pointerEvents: 'auto' }, { duration: 0.3, ease: 'easeInOut' });\n }, [isPresent]);\n\n const handleCTA = (callback?: () => void): void => {\n if (callback) {\n callback();\n }\n };\n\n useEffect(() => {\n titleRef.current?.focus();\n }, [title]);\n\n return (\n <div className={styles.drawer} ref={scope} style={{ zIndex }} data-analyticsid={AnalyticsId.Drawer}>\n <div className={styles.drawer__overlay} ref={overlayRef} aria-hidden=\"true\" />\n <div\n className={classNames(styles.drawer__container, {\n [styles['drawer__container--right']]: desktopDirection === 'right',\n })}\n ref={containerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n {...ariaLabelAttributes}\n >\n <div className={styles.drawer__container__inner}>\n <div className={headerStyling} ref={headerRef}>\n <Title\n id={ariaLabelAttributes?.['aria-labelledby']}\n className={styles['drawer__header__title']}\n htmlMarkup={titleHtmlMarkup}\n appearance=\"title3\"\n ref={titleRef}\n tabIndex={-1}\n >\n {title}\n </Title>\n {withBackButton && onRequestBack !== undefined && (\n <Button\n ariaLabel={mergedResources.ariaLabelBackButton}\n onClick={onRequestBack}\n variant=\"borderless\"\n wrapperClassName={styles['drawer__header__back-button']}\n >\n <Icon svgIcon={ChevronLeft} />\n </Button>\n )}\n {!noCloseButton && onRequestClose != undefined && (\n <Close\n ariaLabel={mergedResources.ariaLabelCloseBtn}\n color={closeColor}\n onClick={onRequestClose}\n className={styles['drawer__header__close-button']}\n />\n )}\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--top'])}\n style={{\n opacity: !topContentVisible && contentIsScrollable ? 1 : 0,\n top: headerHeight,\n }}\n />\n <div\n className={classNames(styles.drawer__content, contentClassName)}\n tabIndex={contentIsScrollable ? 0 : undefined}\n role={contentIsScrollable ? 'region' : undefined}\n {...(contentIsScrollable ? ariaLabelAttributes : {})}\n ref={contentRef}\n >\n <div ref={topContent} />\n <div className={styles['drawer__content__children']}>{children}</div>\n <div ref={bottomContent} style={{ height: '1px' }} />\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--bottom'])}\n style={{\n opacity: !bottomContentVisible && contentIsScrollable ? 1 : 0,\n bottom: hasFooterContent ? footerHeight : 0,\n }}\n />\n </div>\n {hasFooterContent && (\n <div className={styles.drawer__footer} ref={footerRef}>\n {footerContent ? (\n footerContent\n ) : (\n <>\n {onPrimaryAction && <Button onClick={() => handleCTA(onPrimaryAction)}>{primaryActionText}</Button>}\n {onSecondaryAction && (\n <Button variant=\"borderless\" onClick={() => handleCTA(onSecondaryAction)}>\n {secondaryActionText}\n </Button>\n )}\n </>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Drawer;\n","import Drawer from './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;KACF;;;;;AC7UV,IAAA,iBAAe"}
|
|
1
|
+
{"version":3,"file":"Drawer.js","names":[],"sources":["../src/resources/HN.Designsystem.Drawer.en-GB.json","../src/resources/HN.Designsystem.Drawer.nb-NO.json","../src/resources/HN.Designsystem.Drawer.nn-NO.json","../src/resources/HN.Designsystem.Drawer.se-NO.json","../src/components/Drawer/resourceHelper.ts","../src/components/Drawer/DrawerBackButton.tsx","../src/components/Drawer/Drawer.tsx","../src/components/Drawer/index.ts"],"sourcesContent":["{\n \"ariaLabelCloseBtn\": \"Close\",\n \"ariaLabelBackButton\": \"Go back\"\n}\n","{\n \"ariaLabelBackButton\": \"Gå tilbake\",\n \"ariaLabelCloseBtn\": \"Lukk\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Lukk\",\n \"ariaLabelBackButton\": \"Gå tilbake\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Gidde\",\n \"ariaLabelBackButton\": \"Mana ruovttoluotta\"\n}\n","import type { HNDesignsystemDrawer } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Drawer.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Drawer.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.Drawer.nn-NO.json';\nimport seNO from '../../resources/HN.Designsystem.Drawer.se-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDrawer => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.SAMI_NORTHERN:\n return seNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport Icon from '../Icon';\nimport ChevronLeft from '../Icons/ChevronLeft';\n\nimport styles from './DrawerBackButton.module.scss';\n\nexport interface DrawerBackButtonProps {\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Adds custom classes to the element. */\n className?: string;\n}\n\nconst DrawerBackButton: React.FC<DrawerBackButtonProps> = props => {\n const { ariaLabel = 'Tilbake', onClick, className } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n\n const iconSize = useIsMobileBreakpoint() ? 38 : 48;\n\n return (\n <button ref={refObject} className={classNames(styles['back-button'], className)} aria-label={ariaLabel} onClick={onClick} type=\"button\">\n <span className={classNames(styles['back-button__inner-container'])}>\n <Icon svgIcon={ChevronLeft} color={'var(--color-action-graphics-onlight'} size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n};\n\nexport default DrawerBackButton;\n","import React, { useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\nimport { AnimatePresence, useAnimate, usePresence } from 'motion/react';\n\nimport type { HNDesignsystemDrawer } from '../../resources/Resources';\nimport type { TitleTags } from '../Title';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, KeyboardEventKey, LanguageLocales, ZIndex } from '../../constants';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useKeyboardEvent } from '../../hooks/useKeyboardEvent';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { useReturnFocusOnUnmount } from '../../hooks/useReturnFocusOnUnmount';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { disableBodyScroll, enableBodyScroll } from '../../utils/scroll';\nimport uuid from '../../utils/uuid';\nimport Button from '../Button';\nimport Close from '../Close';\nimport Title from '../Title';\nimport DrawerBackButton from './DrawerBackButton';\n\nimport styles from './styles.module.scss';\n\ntype DesktopDirections = 'left' | 'right';\n\nexport interface DrawerProps extends InnerDrawerProps {\n /** Opens and closes the drawer */\n isOpen: boolean;\n}\n\nexport interface InnerDrawerProps {\n /** Sets the aria-label of the drawer */\n ariaLabel?: string;\n /** Sets the aria-labelledby of the drawer */\n ariaLabelledBy?: string;\n /** Sets the style of the Drawer Close button. Meant for use by HelpDrawer */\n closeColor?: 'blueberry' | 'plum';\n /** Direction of the drawer on desktop. Default: left */\n desktopDirection?: DesktopDirections;\n /** Sets the style of the Drawer header */\n headerClasses?: string;\n /** Title to display in the header of the drawer */\n title: string;\n /** id of the drawer title */\n titleId?: string;\n /** Changes the underlying element of the title. Default: h3 */\n titleHtmlMarkup?: TitleTags;\n /** Callback that triggers when clicking on close button or outside the drawer, update isOpen state when this triggers */\n onRequestClose?: () => void;\n /** Optional footer content that can be rendered instead of default CTA(s) */\n footerContent?: React.ReactNode;\n /** Main content of the drawer */\n children?: React.ReactNode;\n /** Hides the close button */\n noCloseButton?: boolean;\n /** Primary CTA callback */\n onPrimaryAction?: () => void;\n /** Text for primary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n primaryActionText?: string;\n /** Text for secondary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n secondaryActionText?: string;\n /** Secondary CTA callback */\n onSecondaryAction?: () => void;\n /** Customize the z-index of the drawer */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDrawer>;\n /** Sets mobile styling and animation from outer level Drawer */\n isMobile?: boolean;\n /** Shows a back button to the left of title */\n withBackButton?: boolean;\n /** Callback for the back button */\n onRequestBack?: () => void;\n /** Sets classname for content part in Drawer */\n contentClassName?: string;\n}\n\nconst Drawer: React.FC<DrawerProps> = props => {\n const { isOpen, ...rest } = props;\n const isMobile = useIsMobileBreakpoint();\n\n return <AnimatePresence>{isOpen && <InnerDrawer {...rest} isMobile={isMobile} />}</AnimatePresence>;\n};\n\nconst InnerDrawer: React.FC<InnerDrawerProps> = props => {\n const {\n ariaLabel,\n ariaLabelledBy,\n children,\n closeColor = 'blueberry',\n desktopDirection = 'left',\n footerContent,\n headerClasses,\n noCloseButton = false,\n onPrimaryAction,\n onRequestClose,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n titleHtmlMarkup = 'h3',\n titleId = uuid(),\n zIndex = ZIndex.OverlayScreen,\n resources,\n isMobile,\n withBackButton,\n onRequestBack,\n contentClassName,\n } = props;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledBy, fallbackId: titleId });\n const overlayRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n // topContent and bottomContent are used to detect scroll position for shadow effects\n const topContent = useRef<HTMLDivElement>(null);\n const bottomContent = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const titleRef = useRef<HTMLHeadingElement>(null);\n const [scope, animate] = useAnimate();\n const [isPresent, safeToRemove] = usePresence();\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const topContentVisible = useIsVisible(topContent);\n const bottomContentVisible = useIsVisible(bottomContent, 0);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDrawer = {\n ...defaultResources,\n ...resources,\n };\n\n // eslint-disable-next-line react-hooks/refs\n const contentIsScrollable = contentRef.current && contentRef.current.scrollHeight > contentRef.current.clientHeight;\n const headerStyling = classNames(styles.drawer__header, headerClasses);\n const hasFooterContent = (typeof footerContent !== 'undefined' && footerContent) || onPrimaryAction || onSecondaryAction;\n\n useFocusTrap(containerRef, true);\n useReturnFocusOnUnmount(containerRef);\n useOutsideEvent(containerRef, () => {\n if (onRequestClose) onRequestClose();\n });\n useKeyboardEvent(containerRef, () => onRequestClose && onRequestClose(), [KeyboardEventKey.Escape]);\n\n // Close animasjon, vi kaller `onClose()` til slutt\n const closeDrawer = (): void => {\n if (!overlayRef.current || !containerRef.current) return;\n\n animate(overlayRef.current, { opacity: 0, pointerEvents: 'none' }, { duration: 0.3, ease: 'easeInOut' });\n\n if (isMobile) {\n animate(\n containerRef.current,\n { y: '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n } else {\n animate(\n containerRef.current,\n { x: desktopDirection === 'left' ? '-100%' : '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n }\n };\n\n useEffect(() => {\n containerRef.current?.focus();\n disableBodyScroll();\n\n return (): void => {\n enableBodyScroll();\n };\n }, []);\n\n // Measure header and footer heights\n useEffect(() => {\n const updateHeights = (): void => {\n if (headerRef.current) {\n setHeaderHeight(headerRef.current.offsetHeight);\n }\n if (footerRef.current) {\n setFooterHeight(footerRef.current.offsetHeight);\n }\n };\n\n updateHeights();\n\n // Update heights when content changes\n const resizeObserver = new ResizeObserver(updateHeights);\n if (headerRef.current) {\n resizeObserver.observe(headerRef.current);\n }\n if (footerRef.current) {\n resizeObserver.observe(footerRef.current);\n }\n\n return (): void => {\n resizeObserver.disconnect();\n };\n }, [hasFooterContent]);\n\n // Open animation.\n useEffect(() => {\n if (!overlayRef.current || !containerRef.current) return;\n\n if (!isPresent) {\n closeDrawer();\n return;\n }\n\n if (isMobile) {\n animate(containerRef.current, { y: '0' }, { duration: 0.3, ease: 'easeInOut' });\n } else {\n animate(containerRef.current, { x: '0' }, { duration: 0.3, ease: 'easeInOut' });\n }\n\n animate(overlayRef.current, { opacity: 1, pointerEvents: 'auto' }, { duration: 0.3, ease: 'easeInOut' });\n }, [isPresent]);\n\n const handleCTA = (callback?: () => void): void => {\n if (callback) {\n callback();\n }\n };\n\n useEffect(() => {\n titleRef.current?.focus();\n }, [title]);\n\n return (\n <div className={styles.drawer} ref={scope} style={{ zIndex }} data-analyticsid={AnalyticsId.Drawer}>\n <div className={styles.drawer__overlay} ref={overlayRef} aria-hidden=\"true\" />\n <div\n className={classNames(styles.drawer__container, {\n [styles['drawer__container--right']]: desktopDirection === 'right',\n })}\n ref={containerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n {...ariaLabelAttributes}\n >\n <div className={styles.drawer__container__inner}>\n <div className={headerStyling} ref={headerRef}>\n <Title\n id={ariaLabelAttributes?.['aria-labelledby']}\n className={styles['drawer__header__title']}\n htmlMarkup={titleHtmlMarkup}\n appearance=\"title3\"\n ref={titleRef}\n tabIndex={-1}\n >\n {title}\n </Title>\n {withBackButton && onRequestBack !== undefined && (\n <DrawerBackButton\n ariaLabel={mergedResources.ariaLabelBackButton}\n onClick={onRequestBack}\n className={styles['drawer__header__back-button']}\n />\n )}\n {!noCloseButton && onRequestClose != undefined && (\n <Close\n ariaLabel={mergedResources.ariaLabelCloseBtn}\n color={closeColor}\n onClick={onRequestClose}\n className={styles['drawer__header__close-button']}\n />\n )}\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--top'])}\n style={{\n opacity: !topContentVisible && contentIsScrollable ? 1 : 0,\n top: headerHeight,\n }}\n />\n <div\n className={classNames(styles.drawer__content, contentClassName)}\n tabIndex={contentIsScrollable ? 0 : undefined}\n role={contentIsScrollable ? 'region' : undefined}\n {...(contentIsScrollable ? ariaLabelAttributes : {})}\n ref={contentRef}\n >\n <div ref={topContent} />\n <div className={styles['drawer__content__children']}>{children}</div>\n <div ref={bottomContent} style={{ height: '1px' }} />\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--bottom'])}\n style={{\n opacity: !bottomContentVisible && contentIsScrollable ? 1 : 0,\n bottom: hasFooterContent ? footerHeight : 0,\n }}\n />\n </div>\n {hasFooterContent && (\n <div className={styles.drawer__footer} ref={footerRef}>\n {footerContent ? (\n footerContent\n ) : (\n <>\n {onPrimaryAction && <Button onClick={() => handleCTA(onPrimaryAction)}>{primaryActionText}</Button>}\n {onSecondaryAction && (\n <Button variant=\"borderless\" onClick={() => handleCTA(onSecondaryAction)}>\n {secondaryActionText}\n </Button>\n )}\n </>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Drawer;\n","import Drawer from './Drawer';\nexport * from './Drawer';\nexport default Drawer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIQA,IAAa,gBAAgB,aAAoD;CAC/E,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB,mBACnB,OAAO;EACT,KAAK,gBAAgB,eACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACFA,IAAM,oBAAoD,UAAS;CACjE,MAAM,EAAE,YAAY,WAAW,SAAS,cAAc;CACtD,MAAM,EAAE,WAAW,cAAc,iBAAoC;CAErE,MAAM,WAAW,sBAAsB,IAAI,KAAK;CAEhD,OACE,oBAAC,UAAD;EAAQ,KAAK;EAAW,WAAW,WAAW,OAAO,gBAAgB,SAAS;EAAG,cAAY;EAAoB;EAAS,MAAK;YAC7H,oBAAC,QAAD;GAAM,WAAW,WAAW,OAAO,+BAA+B;aAChE,oBAAC,cAAD;IAAM,SAAS;IAAa,OAAO;IAAuC,MAAM;IAAqB;GAAY,CAAA;EAC7G,CAAA;CACA,CAAA;AAEZ;;;ACkDA,IAAM,UAAgC,UAAS;CAC7C,MAAM,EAAE,QAAQ,GAAG,SAAS;CAC5B,MAAM,WAAW,sBAAsB;CAEvC,OAAO,oBAAC,iBAAD,EAAA,UAAkB,UAAU,oBAAC,aAAD;EAAa,GAAI;EAAgB;CAAW,CAAA,EAAmB,CAAA;AACpG;AAEA,IAAM,eAA0C,UAAS;CACvD,MAAM,EACJ,WACA,gBACA,UACA,aAAa,aACb,mBAAmB,QACnB,eACA,eACA,gBAAgB,OAChB,iBACA,gBACA,mBACA,mBACA,qBACA,OACA,kBAAkB,MAClB,UAAU,KAAK,GACf,S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AK,WAAa,CAAA;OACvB,oBAAC,OAAD;QAAK,WAAW,SAAO;QAA+B;OAAc,CAAA;OACpE,oBAAC,OAAD;QAAK,KAAK;QAAe,OAAO,EAAE,QAAQ,MAAM;OAAI,CAAA;MACjD;;KACL,oBAAC,OAAD;MACE,WAAW,WAAW,SAAO,4BAA4B,SAAO,kCAAkC;MAClG,OAAO;OACL,SAAS,CAAC,wBAAwB,sBAAsB,IAAI;OAC5D,QAAQ,mBAAmB,eAAe;MAC5C;KACD,CAAA;IACE;OACJ,oBACC,oBAAC,OAAD;IAAK,WAAW,SAAO;IAAgB,KAAK;cACzC,gBACC,gBAEA,qBAAA,UAAA,EAAA,UAAA,CACG,mBAAmB,oBAAC,gBAAD;KAAQ,eAAe,UAAU,eAAe;eAAI;IAA0B,CAAA,GACjG,qBACC,oBAAC,gBAAD;KAAQ,SAAQ;KAAa,eAAe,UAAU,iBAAiB;eACpE;IACK,CAAA,CAEV,EAAA,CAAA;GAED,CAAA,CAEJ;IACF;;AAET;;;AC3UA,IAAA,iBAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerNavigation.js","names":[],"sources":["../src/components/Filter/DrawerNavigation/useDrawerNavigation.ts","../src/components/Filter/DrawerNavigation/DrawerNavigation.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface NavigateProps<ViewId extends string = string> {\n goToView: (id: ViewId) => void;\n goBack: () => void;\n goToViewAndClearStack: (id: ViewId) => void;\n}\n\nexport const DrawerNavigationContext = createContext<NavigateProps | null>(null);\n\nexport function useDrawerNavigation<ViewId extends string = string>(): NavigateProps<ViewId> {\n const context = useContext(DrawerNavigationContext);\n if (!context) {\n throw new Error('useDrawerNavigation must be used inside a <DrawerNavigation> component');\n }\n return context as NavigateProps<ViewId>;\n}\n","import type React from 'react';\nimport { Children, isValidElement, useCallback, useMemo, useState } from 'react';\n\nimport { type NavigateProps, DrawerNavigationContext } from './useDrawerNavigation';\nimport Drawer from '../../Drawer';\n\nexport interface DrawerViewProps<ViewId extends string = string> {\n /** Id for the view. Important for navigation */\n id: ViewId;\n /** Title used for Drawer in current view */\n title: string;\n /** Mark this view as the home/default view */\n home?: boolean;\n /** Content inside the drawer for this view */\n children: React.ReactNode;\n /** Default onClose callback for drawer. Will override onCloseButton on parent */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. Will override footer on parent */\n footer?: React.ReactNode;\n /** Classname set on the content inside Drawer */\n drawerContentClassname?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction DrawerView<ViewId extends string>(_props: DrawerViewProps<ViewId>): React.ReactNode {\n // DrawerView is never rendered directly — DrawerNavigation reads its props\n return null;\n}\n\nexport interface DrawerNavigationProps {\n /** Views and other children components inside the Drawer navigation. Views are put in stack */\n children: React.ReactNode;\n /** Is drawer open or closed */\n isOpen: boolean;\n /** Navigate to this view when the drawer opens. Defaults to home view. */\n initialView?: string;\n /** Default onClose callback for drawer. View onCloseButton callback will override this. */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. View footer will override this */\n footer?: React.ReactNode;\n}\n\nfunction parseChildren(children: React.ReactNode): { views: DrawerViewProps[]; other: React.ReactNode[] } {\n const views: DrawerViewProps[] = [];\n const other: React.ReactNode[] = [];\n Children.forEach(children, child => {\n if (isValidElement<DrawerViewProps>(child) && child.type === DrawerView) {\n views.push({\n id: child.props.id,\n title: child.props.title,\n home: child.props.home,\n children: child.props.children,\n onCloseButton: child.props.onCloseButton,\n footer: child.props.footer,\n drawerContentClassname: child.props.drawerContentClassname,\n });\n } else {\n /** Added possibility of other children to support Modals that need navigation context */\n other.push(child);\n }\n });\n return { views, other };\n}\n\nfunction DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer }: DrawerNavigationProps): React.ReactNode {\n const { views, other } = useMemo(() => parseChildren(children), [children]);\n\n const homeView = views.find(v => v.home) ?? views[0];\n const [viewStack, setViewStack] = useState<string[]>([homeView?.id]);\n\n const goToView = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(stack => [...stack, id]);\n }\n },\n [views]\n );\n\n const goBack = useCallback((): void => {\n setViewStack(stack => (stack.length > 1 ? stack.slice(0, -1) : stack));\n }, []);\n\n const goToViewAndClearStack = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(id === homeView?.id ? [homeView.id] : [homeView?.id, id]);\n }\n },\n [views, homeView]\n );\n\n const currentViewId = viewStack[viewStack.length - 1];\n const currentView = views.find(v => v.id === currentViewId);\n\n const navigate = useMemo<NavigateProps>(() => ({ goBack, goToView, goToViewAndClearStack }), [goBack, goToView, goToViewAndClearStack]);\n\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setViewStack([homeView?.id]);\n } else if (initialView && views.some(v => v.id === initialView)) {\n setViewStack(initialView === homeView?.id ? [homeView.id] : [homeView?.id, initialView]);\n }\n }\n\n return (\n <DrawerNavigationContext.Provider value={navigate}>\n <Drawer\n isOpen={isOpen}\n title={currentView?.title ?? 'Filter'}\n withBackButton={viewStack.length > 1}\n onRequestBack={goBack}\n onRequestClose={currentView?.onCloseButton ?? onCloseButton}\n footerContent={currentView?.footer ?? footer}\n contentClassName={currentView?.drawerContentClassname}\n >\n {currentView?.children}\n </Drawer>\n {other}\n </DrawerNavigationContext.Provider>\n );\n}\n\nDrawerNavigation.View = DrawerView;\n\nexport default DrawerNavigation;\n"],"mappings":";;;;AAQA,IAAa,0BAA0B,cAAoC,
|
|
1
|
+
{"version":3,"file":"DrawerNavigation.js","names":[],"sources":["../src/components/Filter/DrawerNavigation/useDrawerNavigation.ts","../src/components/Filter/DrawerNavigation/DrawerNavigation.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface NavigateProps<ViewId extends string = string> {\n goToView: (id: ViewId) => void;\n goBack: () => void;\n goToViewAndClearStack: (id: ViewId) => void;\n}\n\nexport const DrawerNavigationContext = createContext<NavigateProps | null>(null);\n\nexport function useDrawerNavigation<ViewId extends string = string>(): NavigateProps<ViewId> {\n const context = useContext(DrawerNavigationContext);\n if (!context) {\n throw new Error('useDrawerNavigation must be used inside a <DrawerNavigation> component');\n }\n return context as NavigateProps<ViewId>;\n}\n","import type React from 'react';\nimport { Children, isValidElement, useCallback, useMemo, useState } from 'react';\n\nimport { type NavigateProps, DrawerNavigationContext } from './useDrawerNavigation';\nimport Drawer from '../../Drawer';\n\nexport interface DrawerViewProps<ViewId extends string = string> {\n /** Id for the view. Important for navigation */\n id: ViewId;\n /** Title used for Drawer in current view */\n title: string;\n /** Mark this view as the home/default view */\n home?: boolean;\n /** Content inside the drawer for this view */\n children: React.ReactNode;\n /** Default onClose callback for drawer. Will override onCloseButton on parent */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. Will override footer on parent */\n footer?: React.ReactNode;\n /** Classname set on the content inside Drawer */\n drawerContentClassname?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction DrawerView<ViewId extends string>(_props: DrawerViewProps<ViewId>): React.ReactNode {\n // DrawerView is never rendered directly — DrawerNavigation reads its props\n return null;\n}\n\nexport interface DrawerNavigationProps {\n /** Views and other children components inside the Drawer navigation. Views are put in stack */\n children: React.ReactNode;\n /** Is drawer open or closed */\n isOpen: boolean;\n /** Navigate to this view when the drawer opens. Defaults to home view. */\n initialView?: string;\n /** Default onClose callback for drawer. View onCloseButton callback will override this. */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. View footer will override this */\n footer?: React.ReactNode;\n}\n\nfunction parseChildren(children: React.ReactNode): { views: DrawerViewProps[]; other: React.ReactNode[] } {\n const views: DrawerViewProps[] = [];\n const other: React.ReactNode[] = [];\n Children.forEach(children, child => {\n if (isValidElement<DrawerViewProps>(child) && child.type === DrawerView) {\n views.push({\n id: child.props.id,\n title: child.props.title,\n home: child.props.home,\n children: child.props.children,\n onCloseButton: child.props.onCloseButton,\n footer: child.props.footer,\n drawerContentClassname: child.props.drawerContentClassname,\n });\n } else {\n /** Added possibility of other children to support Modals that need navigation context */\n other.push(child);\n }\n });\n return { views, other };\n}\n\nfunction DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer }: DrawerNavigationProps): React.ReactNode {\n const { views, other } = useMemo(() => parseChildren(children), [children]);\n\n const homeView = views.find(v => v.home) ?? views[0];\n const [viewStack, setViewStack] = useState<string[]>([homeView?.id]);\n\n const goToView = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(stack => [...stack, id]);\n }\n },\n [views]\n );\n\n const goBack = useCallback((): void => {\n setViewStack(stack => (stack.length > 1 ? stack.slice(0, -1) : stack));\n }, []);\n\n const goToViewAndClearStack = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(id === homeView?.id ? [homeView.id] : [homeView?.id, id]);\n }\n },\n [views, homeView]\n );\n\n const currentViewId = viewStack[viewStack.length - 1];\n const currentView = views.find(v => v.id === currentViewId);\n\n const navigate = useMemo<NavigateProps>(() => ({ goBack, goToView, goToViewAndClearStack }), [goBack, goToView, goToViewAndClearStack]);\n\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setViewStack([homeView?.id]);\n } else if (initialView && views.some(v => v.id === initialView)) {\n setViewStack(initialView === homeView?.id ? [homeView.id] : [homeView?.id, initialView]);\n }\n }\n\n return (\n <DrawerNavigationContext.Provider value={navigate}>\n <Drawer\n isOpen={isOpen}\n title={currentView?.title ?? 'Filter'}\n withBackButton={viewStack.length > 1}\n onRequestBack={goBack}\n onRequestClose={currentView?.onCloseButton ?? onCloseButton}\n footerContent={currentView?.footer ?? footer}\n contentClassName={currentView?.drawerContentClassname}\n >\n {currentView?.children}\n </Drawer>\n {other}\n </DrawerNavigationContext.Provider>\n );\n}\n\nDrawerNavigation.View = DrawerView;\n\nexport default DrawerNavigation;\n"],"mappings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AAK,MAAK,EAAE,OAAO,EAAE,GAC7B,aAAa,OAAO,UAAU,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;CAEzE,GACA,CAAC,OAAO,QAAQ,CAClB;CAEA,MAAM,gBAAgB,UAAU,UAAU,SAAS;CACnD,MAAM,cAAc,MAAM,MAAK,MAAK,EAAE,OAAO,aAAa;CAE1D,MAAM,WAAW,eAA8B;EAAE;EAAQ;EAAU;CAAsB,IAAI;EAAC;EAAQ;EAAU;CAAqB,CAAC;CAEtI,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CACnD,IAAI,eAAe,QAAQ;EACzB,cAAc,MAAM;EACpB,IAAI,CAAC,QACH,aAAa,CAAC,UAAU,EAAE,CAAC;OACtB,IAAI,eAAe,MAAM,MAAK,MAAK,EAAE,OAAO,WAAW,GAC5D,aAAa,gBAAgB,UAAU,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,IAAI,WAAW,CAAC;CAE3F;CAEA,OACE,qBAAC,wBAAwB,UAAzB;EAAkC,OAAO;YAAzC,CACE,oBAAC,gBAAD;GACU;GACR,OAAO,aAAa,SAAS;GAC7B,gBAAgB,UAAU,SAAS;GACnC,eAAe;GACf,gBAAgB,aAAa,iBAAiB;GAC9C,eAAe,aAAa,UAAU;GACtC,kBAAkB,aAAa;aAE9B,aAAa;EACR,CAAA,GACP,KAC+B;;AAEtC;AAEA,iBAAiB,OAAO"}
|
package/lib/Duolist.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Duolist.js","names":[],"sources":["../src/components/Duolist/Duolist.tsx","../src/components/Duolist/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { TitleProps } from '../Title';\n\nimport { AnalyticsId } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport Spacer from '../Spacer';\n\nimport duolistStyles from './styles.module.scss';\n\nexport type DuolistVariants = 'normal' | 'line';\nexport type BoldColumn = 'first' | 'second' | 'none';\nexport type Border = 'no-border' | 'border';\nexport type Formats = 'formatted' | 'non-formatted';\n\nexport interface DuolistProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Label of the Duolist */\n border?: Border;\n /** Label of the Duolist */\n label?: React.ReactElement<TitleProps>;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets the visual variant of the Duolist. */\n variant?: DuolistVariants;\n /** Sets the content of the Duolist. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Width of the description column in percentage */\n descriptionWidth?: number;\n /** Use collapsed mode on columns from chosen breakpoint and below. */\n useCollapsedFromAndBelowBreakpoint?: keyof typeof Breakpoint;\n}\n\nexport interface DuolistGroupProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Sets content of the <dd> tag. */\n description: React.ReactNode;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets content of the <dt> tag. */\n term: React.ReactNode;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const DuolistGroup: React.FC<DuolistGroupProps> = props => {\n const { format = 'formatted', boldColumn = format === 'non-formatted' ? 'none' : 'first', description, separator = ': ', term } = props;\n\n const firstBold = boldColumn === 'first';\n const secondBold = boldColumn === 'second';\n const nonFormatted = format === 'non-formatted';\n\n const dtClassNames = classNames(duolistStyles['duolist__dt'], {\n [duolistStyles['duolist__dt--bold']]: firstBold,\n [duolistStyles['duolist__dt--non-formatted']]: nonFormatted,\n });\n const ddClassNames = classNames(duolistStyles['duolist__dd'], {\n [duolistStyles['duolist__dd--bold']]: secondBold,\n [duolistStyles['duolist__dd--non-formatted']]: nonFormatted,\n });\n\n const renderContent = () => {\n return (\n <>\n <dt\n data-separator={nonFormatted ? separator : undefined}\n className={dtClassNames}\n data-testid={props.testId && `${props.testId}-term`}\n >\n {term}\n </dt>\n <dd className={ddClassNames} data-testid={props.testId && `${props.testId}-description`}>\n {description}\n </dd>\n </>\n );\n };\n\n return nonFormatted ? <div>{renderContent()}</div> : <>{renderContent()}</>;\n};\n\nexport const Duolist: React.FC<DuolistProps> = props => {\n const {\n boldColumn,\n border = 'no-border',\n descriptionWidth,\n label,\n format = 'formatted',\n separator,\n variant = 'normal',\n children,\n className,\n testId,\n useCollapsedFromAndBelowBreakpoint,\n } = props;\n\n const hasBorder = border === 'border';\n const hasLines = variant === 'line';\n const extraPaddingTop = hasBorder && (label || hasLines);\n const nonFormatted = format === 'non-formatted';\n const breakpoint = useBreakpoint();\n const useCollapsedMode = useCollapsedFromAndBelowBreakpoint && breakpoint <= Breakpoint[useCollapsedFromAndBelowBreakpoint];\n\n const duolistWrapperClasses = classNames(\n {\n [duolistStyles['duolist-wrapper--border']]: hasBorder,\n [duolistStyles['duolist-wrapper--extra-padding-top']]: extraPaddingTop,\n },\n className\n );\n\n const duolistClasses = classNames(duolistStyles.duolist, {\n [duolistStyles['duolist--line']]: hasLines,\n [duolistStyles['duolist--non-formatted']]: nonFormatted,\n [duolistStyles['duolist--collapsed']]: useCollapsedMode,\n [duolistStyles['duolist--not-collapsed']]: !useCollapsedMode,\n });\n\n const duolistColumnStyle = descriptionWidth ? descriptionWidth + '%' : 'minmax(60%, 1fr)';\n\n return (\n <div className={duolistWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.Duolist}>\n {label && (\n <>\n {label}\n <Spacer />\n </>\n )}\n <dl\n style={!nonFormatted ? { gridTemplateColumns: useCollapsedMode ? `1fr` : `auto ${duolistColumnStyle}` } : undefined}\n className={duolistClasses}\n >\n {React.Children.map(children, (child: React.ReactNode | React.ReactElement<DuolistGroupProps>) => {\n if (child === null || typeof child === 'undefined') return;\n const duolistGroup = child as React.ReactElement<DuolistGroupProps>;\n if (duolistGroup.type === DuolistGroup) {\n return React.cloneElement(child as React.ReactElement<DuolistGroupProps>, {\n ...duolistGroup.props,\n boldColumn: duolistGroup.props.boldColumn ?? boldColumn,\n format: duolistGroup.props.format ?? format,\n separator: duolistGroup.props.separator ?? separator,\n });\n }\n })}\n </dl>\n </div>\n );\n};\n\nexport default Duolist;\n","import Duolist from './Duolist';\nexport * from './Duolist';\nexport default Duolist;\n"],"mappings":";;;;;;;;AAyDA,IAAa,gBAA4C,UAAS;CAChE,MAAM,EAAE,SAAS,aAAa,aAAa,WAAW,kBAAkB,SAAS,SAAS,aAAa,YAAY,MAAM,SAAS;CAElI,MAAM,YAAY,eAAe;CACjC,MAAM,aAAa,eAAe;CAClC,MAAM,eAAe,WAAW;CAEhC,MAAM,eAAe,WAAW,cAAc,gBAAgB;GAC3D,cAAc,uBAAuB;GACrC,cAAc,gCAAgC;
|
|
1
|
+
{"version":3,"file":"Duolist.js","names":[],"sources":["../src/components/Duolist/Duolist.tsx","../src/components/Duolist/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { TitleProps } from '../Title';\n\nimport { AnalyticsId } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport Spacer from '../Spacer';\n\nimport duolistStyles from './styles.module.scss';\n\nexport type DuolistVariants = 'normal' | 'line';\nexport type BoldColumn = 'first' | 'second' | 'none';\nexport type Border = 'no-border' | 'border';\nexport type Formats = 'formatted' | 'non-formatted';\n\nexport interface DuolistProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Label of the Duolist */\n border?: Border;\n /** Label of the Duolist */\n label?: React.ReactElement<TitleProps>;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets the visual variant of the Duolist. */\n variant?: DuolistVariants;\n /** Sets the content of the Duolist. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Width of the description column in percentage */\n descriptionWidth?: number;\n /** Use collapsed mode on columns from chosen breakpoint and below. */\n useCollapsedFromAndBelowBreakpoint?: keyof typeof Breakpoint;\n}\n\nexport interface DuolistGroupProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Sets content of the <dd> tag. */\n description: React.ReactNode;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets content of the <dt> tag. */\n term: React.ReactNode;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const DuolistGroup: React.FC<DuolistGroupProps> = props => {\n const { format = 'formatted', boldColumn = format === 'non-formatted' ? 'none' : 'first', description, separator = ': ', term } = props;\n\n const firstBold = boldColumn === 'first';\n const secondBold = boldColumn === 'second';\n const nonFormatted = format === 'non-formatted';\n\n const dtClassNames = classNames(duolistStyles['duolist__dt'], {\n [duolistStyles['duolist__dt--bold']]: firstBold,\n [duolistStyles['duolist__dt--non-formatted']]: nonFormatted,\n });\n const ddClassNames = classNames(duolistStyles['duolist__dd'], {\n [duolistStyles['duolist__dd--bold']]: secondBold,\n [duolistStyles['duolist__dd--non-formatted']]: nonFormatted,\n });\n\n const renderContent = () => {\n return (\n <>\n <dt\n data-separator={nonFormatted ? separator : undefined}\n className={dtClassNames}\n data-testid={props.testId && `${props.testId}-term`}\n >\n {term}\n </dt>\n <dd className={ddClassNames} data-testid={props.testId && `${props.testId}-description`}>\n {description}\n </dd>\n </>\n );\n };\n\n return nonFormatted ? <div>{renderContent()}</div> : <>{renderContent()}</>;\n};\n\nexport const Duolist: React.FC<DuolistProps> = props => {\n const {\n boldColumn,\n border = 'no-border',\n descriptionWidth,\n label,\n format = 'formatted',\n separator,\n variant = 'normal',\n children,\n className,\n testId,\n useCollapsedFromAndBelowBreakpoint,\n } = props;\n\n const hasBorder = border === 'border';\n const hasLines = variant === 'line';\n const extraPaddingTop = hasBorder && (label || hasLines);\n const nonFormatted = format === 'non-formatted';\n const breakpoint = useBreakpoint();\n const useCollapsedMode = useCollapsedFromAndBelowBreakpoint && breakpoint <= Breakpoint[useCollapsedFromAndBelowBreakpoint];\n\n const duolistWrapperClasses = classNames(\n {\n [duolistStyles['duolist-wrapper--border']]: hasBorder,\n [duolistStyles['duolist-wrapper--extra-padding-top']]: extraPaddingTop,\n },\n className\n );\n\n const duolistClasses = classNames(duolistStyles.duolist, {\n [duolistStyles['duolist--line']]: hasLines,\n [duolistStyles['duolist--non-formatted']]: nonFormatted,\n [duolistStyles['duolist--collapsed']]: useCollapsedMode,\n [duolistStyles['duolist--not-collapsed']]: !useCollapsedMode,\n });\n\n const duolistColumnStyle = descriptionWidth ? descriptionWidth + '%' : 'minmax(60%, 1fr)';\n\n return (\n <div className={duolistWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.Duolist}>\n {label && (\n <>\n {label}\n <Spacer />\n </>\n )}\n <dl\n style={!nonFormatted ? { gridTemplateColumns: useCollapsedMode ? `1fr` : `auto ${duolistColumnStyle}` } : undefined}\n className={duolistClasses}\n >\n {React.Children.map(children, (child: React.ReactNode | React.ReactElement<DuolistGroupProps>) => {\n if (child === null || typeof child === 'undefined') return;\n const duolistGroup = child as React.ReactElement<DuolistGroupProps>;\n if (duolistGroup.type === DuolistGroup) {\n return React.cloneElement(child as React.ReactElement<DuolistGroupProps>, {\n ...duolistGroup.props,\n boldColumn: duolistGroup.props.boldColumn ?? boldColumn,\n format: duolistGroup.props.format ?? format,\n separator: duolistGroup.props.separator ?? separator,\n });\n }\n })}\n </dl>\n </div>\n );\n};\n\nexport default Duolist;\n","import Duolist from './Duolist';\nexport * from './Duolist';\nexport default Duolist;\n"],"mappings":";;;;;;;;AAyDA,IAAa,gBAA4C,UAAS;CAChE,MAAM,EAAE,SAAS,aAAa,aAAa,WAAW,kBAAkB,SAAS,SAAS,aAAa,YAAY,MAAM,SAAS;CAElI,MAAM,YAAY,eAAe;CACjC,MAAM,aAAa,eAAe;CAClC,MAAM,eAAe,WAAW;CAEhC,MAAM,eAAe,WAAW,cAAc,gBAAgB;GAC3D,cAAc,uB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AAD,CAAS,CAAA,CACT,EAAA,CAAA,GAEJ,oBAAC,MAAD;GACE,OAAO,CAAC,eAAe,EAAE,qBAAqB,mBAAmB,QAAQ,QAAQ,qBAAqB,IAAI,KAAA;GAC1G,WAAW;aAEV,MAAM,SAAS,IAAI,WAAW,UAAmE;IAChG,IAAI,UAAU,QAAQ,OAAO,UAAU,aAAa;IACpD,MAAM,eAAe;IACrB,IAAI,aAAa,SAAS,cACxB,OAAO,MAAM,aAAa,OAAgD;KACxE,GAAG,aAAa;KAChB,YAAY,aAAa,MAAM,cAAc;KAC7C,QAAQ,aAAa,MAAM,UAAU;KACrC,WAAW,aAAa,MAAM,aAAa;IAC7C,CAAC;GAEL,CAAC;EACC,CAAA,CACD;;AAET;;;AC7JA,IAAA,kBAAe"}
|
package/lib/ElementHeader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementHeader.js","names":[],"sources":["../src/components/ElementHeader/utils.tsx","../src/components/ElementHeader/ElementHeader.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { AvatarProps } from '../Avatar';\nimport type { BadgeProps } from '../Badge';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport ElementHeader, { type ElementHeaderChildren, type ElementHeaderProps } from './ElementHeader';\nimport { ElementHeaderText, type ElementHeaderTextProps } from './ElementHeaderText';\nimport { StatusDotList, type StatusDotListProps } from './StatusDotList';\nimport { isComponent, isComponentWithChildren } from '../../utils/component';\nimport Avatar from '../Avatar';\nimport Badge from '../Badge';\nimport StatusDot from '../StatusDot';\n\ntype ChildrenMapper = (children: React.ReactNode, isJsxChild?: boolean) => ElementHeaderChildren | undefined;\n\nexport const mapChildren: ChildrenMapper = (children, isJsxChild = false) => {\n let avatarChild: React.ReactElement<AvatarProps> | undefined;\n const badgeChildren: React.ReactElement<BadgeProps>[] = [];\n const statusDotChildren: React.ReactElement<StatusDotProps>[] = [];\n let statusDotMCChild: React.ReactElement<StatusDotListProps> | undefined;\n const elementHeaderTextChildren: React.ReactElement<ElementHeaderTextProps>[] = [];\n const stringChildren: string[] = [];\n const remainingChildren: React.ReactNode[] = [];\n\n React.Children.forEach(children, child => {\n if (child === null || typeof child === 'undefined') return;\n if (isComponent<AvatarProps>(child, Avatar)) {\n avatarChild = child;\n } else if (isComponent<ElementHeaderTextProps>(child, ElementHeaderText)) {\n elementHeaderTextChildren.push(child);\n } else if (isComponent<BadgeProps>(child, Badge)) {\n badgeChildren.push(child);\n } else if (isComponent<StatusDotListProps>(child, StatusDotList)) {\n statusDotMCChild = child;\n } else if (isComponent<StatusDotProps>(child, StatusDot)) {\n statusDotChildren.push(child);\n } else if (typeof child === 'string') {\n stringChildren.push(child);\n } else {\n remainingChildren.push(child);\n }\n });\n\n // Dette og recursive mapChildren under(gjøres en gang) er for å passe på at jsx children også sjekkes for Avatar og liknende innhold.\n // Slik opprettholder vi stylingen i tilfeller hvor vertikaler har wrappet elementer i en parent span eller div.\n const hasSpecialChildren =\n avatarChild !== undefined ||\n elementHeaderTextChildren.length > 0 ||\n statusDotChildren.length > 0 ||\n statusDotMCChild !== undefined ||\n (badgeChildren !== undefined && stringChildren.length > 0);\n const noRemainingRecursiveChildren =\n remainingChildren.length === 0 ||\n (isComponentWithChildren(remainingChildren[0]) && typeof remainingChildren[0]?.props?.children === 'undefined');\n\n if (isJsxChild || hasSpecialChildren || noRemainingRecursiveChildren) {\n return {\n avatarChild,\n elementHeaderTextChildren: elementHeaderTextChildren,\n badgeChildren,\n statusDotChildren,\n statusDotMCChild,\n stringChildren,\n remainingChildren,\n };\n }\n\n if (isComponentWithChildren(remainingChildren[0])) {\n return mapChildren(remainingChildren[0]?.props?.children, true);\n }\n};\n\nexport const renderElementHeader = (\n element: React.ReactNode,\n options: Pick<\n ElementHeaderProps,\n 'titleHtmlMarkup' | 'isHovered' | 'size' | 'parentType' | 'chevronIcon' | 'icon' | 'highlightText' | 'closeButton'\n >\n): React.ReactElement | undefined => {\n const { titleHtmlMarkup, isHovered, size, parentType, chevronIcon, icon, highlightText, closeButton } = options;\n\n if (isComponent<ElementHeaderProps>(element, ElementHeader)) {\n return React.cloneElement(element, {\n chevronIcon,\n icon,\n isHovered,\n size,\n parentType,\n highlightText,\n closeButton,\n });\n }\n if (element) {\n return (\n <ElementHeader\n highlightText={highlightText}\n titleHtmlMarkup={titleHtmlMarkup}\n parentType={parentType}\n chevronIcon={chevronIcon}\n icon={icon}\n isHovered={isHovered}\n size={size}\n closeButton={closeButton}\n >\n {element}\n </ElementHeader>\n );\n }\n};\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { AvatarProps, AvatarType } from '../Avatar';\nimport type { BadgeProps, BadgeType } from '../Badge';\nimport type { IconProps, SvgIcon } from '../Icon';\nimport type { LazyIconProps } from '../LazyIcon';\nimport type { StatusDotProps, StatusDotType } from '../StatusDot';\nimport type { TitleTags } from '../Title';\nimport type { ElementHeaderTextProps, ElementHeaderTextType } from './ElementHeaderText/ElementHeaderText';\nimport type { StatusDotListProps, StatusDotListType } from './StatusDotList/StatusDotList';\n\nimport ElementHeaderText from './ElementHeaderText/ElementHeaderText';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { isComponent } from '../../utils/component';\nimport { AvatarSize } from '../Avatar';\nimport Icon, { IconSize } from '../Icon';\nimport StatusDotList from './StatusDotList';\nimport Highlighter from '../Highlighter';\nimport LazyIcon from '../LazyIcon';\nimport { mapChildren } from './utils';\n\nimport styles from './styles.module.scss';\n\nexport type ElementHeaderSize = 'compact' | 'small' | 'medium' | 'large';\nexport type ParentType = 'linklist' | 'expanderlist';\n\nexport interface ElementHeaderType extends React.FC<ElementHeaderProps> {\n Avatar?: AvatarType;\n Badge?: BadgeType;\n ElementHeaderText?: ElementHeaderTextType;\n StatusDot?: StatusDotType;\n StatusDotList?: StatusDotListType;\n}\n\nexport interface ElementHeaderProps {\n /** Adds custom classes to the ElementHeader element. */\n className?: string;\n /** Chevron to render inside of the ElementHeader */\n chevronIcon?: SvgIcon;\n /** Close button to be rendered inside of ElementHeader. This renders in place of chevronIcon */\n closeButton?: React.ReactElement;\n /** Children to be rendered inside of ElementHeader */\n children: React.ReactNode;\n /** Changes the underlying element of the title. Default: h2*/\n titleHtmlMarkup?: TitleTags;\n /** icon to be rendered inside of ElementHeader */\n icon?: React.ReactElement;\n /** whether or not the parent is hovered */\n isHovered?: boolean;\n /** Adjusts styling based on parent */\n parentType?: ParentType;\n /** Changes size of the ElementHeader. */\n size?: ElementHeaderSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text in title. Used for search results */\n highlightText?: string;\n}\n\nexport interface ElementHeaderChildren {\n avatarChild?: React.ReactElement<AvatarProps>;\n elementHeaderTextChildren: React.ReactElement<ElementHeaderTextProps>[];\n badgeChildren?: React.ReactElement<BadgeProps>[];\n statusDotChildren?: React.ReactElement<StatusDotProps>[];\n statusDotMCChild?: React.ReactElement<StatusDotListProps>;\n elementChild?: React.ReactElement;\n stringChildren: string[];\n remainingChildren: React.ReactNode[];\n}\n\nexport const ElementHeaderRoot: ElementHeaderType = props => {\n const {\n className = '',\n titleHtmlMarkup = 'h2',\n parentType = 'linklist',\n chevronIcon,\n closeButton,\n children,\n icon,\n isHovered,\n size,\n testId,\n highlightText,\n } = props;\n const breakpoint = useBreakpoint();\n const showIcon = size !== 'small' && !!icon;\n const contentIsString = typeof children === 'string';\n const mappedChildren = mapChildren(children);\n const hasStatusDots = !!mappedChildren?.statusDotChildren?.length || !!mappedChildren?.statusDotMCChild;\n\n const listLabelClasses = cn(styles['element-header'], { [styles['element-header--compact']]: size === 'compact' }, className);\n const badgeContainerClasses = cn(styles['element-header__badge-container']);\n const badgeClasses = cn(styles['element-header__badge']);\n const statusdotContainerClasses = cn(styles['element-header__statusdot-container']);\n const chevronClasses = cn(styles['element-header__chevron']);\n const contentClasses = cn(styles['element-header__content'], {\n [styles['element-header__content--element']]: !contentIsString,\n [styles['element-header__content--compact']]: size === 'compact',\n });\n const iconClasses = cn(styles['element-header__icon'], { [styles['element-header__icon--with-statusdot']]: hasStatusDots });\n const avatarClasses = cn(styles['element-header__avatar'], {});\n const CustomTag = titleHtmlMarkup;\n const iconPropIsIconComponent = isComponent<IconProps>(icon, Icon);\n const iconPropIsLazyIconComponent = !iconPropIsIconComponent && isComponent<LazyIconProps>(icon, LazyIcon);\n\n let iconComponent;\n if (iconPropIsIconComponent) {\n iconComponent = React.cloneElement(icon as React.ReactElement<IconProps>, {\n size: breakpoint < Breakpoint.md ? IconSize.XSmall : IconSize.Small,\n isHovered,\n });\n } else if (iconPropIsLazyIconComponent) {\n iconComponent = React.cloneElement(icon as React.ReactElement<LazyIconProps>, {\n size: breakpoint < Breakpoint.md ? IconSize.XSmall : IconSize.Small,\n isHovered,\n });\n } else {\n iconComponent = icon;\n }\n\n return (\n <span data-testid={testId} className={listLabelClasses}>\n {showIcon && icon && <span className={iconClasses}>{iconComponent}</span>}\n {size !== 'small' && mappedChildren?.avatarChild && (\n <span className={avatarClasses}>{React.cloneElement(mappedChildren.avatarChild, { size: AvatarSize.xsmall })}</span>\n )}\n\n <span className={contentClasses} data-hasstatusdots={hasStatusDots}>\n {mappedChildren?.elementHeaderTextChildren}\n {!!mappedChildren?.stringChildren.length && (\n <CustomTag className={styles['element-header__title']}>\n <Highlighter searchText={highlightText}>{mappedChildren.stringChildren}</Highlighter>\n </CustomTag>\n )}\n <Highlighter searchText={highlightText}>{mappedChildren?.remainingChildren}</Highlighter>\n </span>\n\n {hasStatusDots && (\n <span className={statusdotContainerClasses}>\n {!!mappedChildren?.statusDotChildren && <StatusDotList>{mappedChildren.statusDotChildren}</StatusDotList>}\n {!!mappedChildren?.statusDotMCChild && mappedChildren?.statusDotMCChild}\n </span>\n )}\n\n <span className={badgeContainerClasses}>\n {mappedChildren?.badgeChildren &&\n mappedChildren.badgeChildren.map((badgeChild, index) => {\n return (\n <span key={index} className={badgeClasses} data-parenttype={parentType}>\n {badgeChild}\n </span>\n );\n })}\n </span>\n {chevronIcon && typeof closeButton === 'undefined' && (\n <span className={chevronClasses} data-parenttype={parentType}>\n <Icon svgIcon={chevronIcon} isHovered={isHovered} size={IconSize.XSmall} />\n </span>\n )}\n {closeButton && (\n <span className={chevronClasses} data-parenttype={parentType}>\n {closeButton}\n </span>\n )}\n </span>\n );\n};\n\ntype ElementHeaderComponent = typeof ElementHeaderRoot & {\n Text: React.FC<ElementHeaderTextProps>;\n StatusDotList: React.FC<StatusDotListProps>;\n};\nElementHeaderRoot.displayName = 'ElementHeader';\nconst ElementHeader = ElementHeaderRoot as ElementHeaderComponent;\nElementHeader.Text = ElementHeaderText;\nElementHeader.Text.displayName = 'ElementHeader.Text';\nElementHeader.StatusDotList = StatusDotList;\nElementHeader.StatusDotList.displayName = 'ElementHeader.StatusDotList';\n\nexport default ElementHeader;\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAa,eAA+B,UAAU,aAAa,UAAU;CAC3E,IAAI;CACJ,MAAM,gBAAkD,EAAE;CAC1D,MAAM,oBAA0D,EAAE;CAClE,IAAI;CACJ,MAAM,4BAA0E,EAAE;CAClF,MAAM,iBAA2B,EAAE;CACnC,MAAM,oBAAuC,EAAE;CAE/C,MAAM,SAAS,QAAQ,WAAU,UAAS;EACxC,IAAI,UAAU,QAAQ,OAAO,UAAU,aAAa;EACpD,IAAI,YAAyB,OAAO,eAAO,EACzC,cAAc;OACT,IAAI,YAAoC,OAAO,kBAAkB,EACtE,0BAA0B,KAAK,MAAM;OAChC,IAAI,YAAwB,OAAO,cAAM,EAC9C,cAAc,KAAK,MAAM;OACpB,IAAI,YAAgC,OAAO,cAAc,EAC9D,mBAAmB;OACd,IAAI,YAA4B,OAAO,kBAAU,EACtD,kBAAkB,KAAK,MAAM;OACxB,IAAI,OAAO,UAAU,UAC1B,eAAe,KAAK,MAAM;OAE1B,kBAAkB,KAAK,MAAM;GAE/B;CAIF,MAAM,qBACJ,gBAAgB,KAAA,KAChB,0BAA0B,SAAS,KACnC,kBAAkB,SAAS,KAC3B,qBAAqB,KAAA,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ACxG,CAAC,CAAC,gBAAgB,oBAAoB,gBAAgB,iBAClD;;GAGT,oBAAC,QAAD;IAAM,WAAW;cACd,gBAAgB,iBACf,eAAe,cAAc,KAAK,YAAY,UAAU;KACtD,OACE,oBAAC,QAAD;MAAkB,WAAW;MAAc,mBAAiB;gBACzD;MACI,EAFI,MAEJ;MAET;IACC,CAAA;GACN,eAAe,OAAO,gBAAgB,eACrC,oBAAC,QAAD;IAAM,WAAW;IAAgB,mBAAiB;cAChD,oBAAC,cAAD;KAAM,SAAS;KAAwB;KAAW,MAAM,SAAS;KAAU,CAAA;IACtE,CAAA;GAER,eACC,oBAAC,QAAD;IAAM,WAAW;IAAgB,mBAAiB;cAC/C;IACI,CAAA;GAEJ;;;AAQX,kBAAkB,cAAc;AAChC,IAAM,gBAAgB;AACtB,cAAc,OAAO;AACrB,cAAc,KAAK,cAAc;AACjC,cAAc,gBAAgB;AAC9B,cAAc,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"ElementHeader.js","names":[],"sources":["../src/components/ElementHeader/utils.tsx","../src/components/ElementHeader/ElementHeader.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { AvatarProps } from '../Avatar';\nimport type { BadgeProps } from '../Badge';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport ElementHeader, { type ElementHeaderChildren, type ElementHeaderProps } from './ElementHeader';\nimport { ElementHeaderText, type ElementHeaderTextProps } from './ElementHeaderText';\nimport { StatusDotList, type StatusDotListProps } from './StatusDotList';\nimport { isComponent, isComponentWithChildren } from '../../utils/component';\nimport Avatar from '../Avatar';\nimport Badge from '../Badge';\nimport StatusDot from '../StatusDot';\n\ntype ChildrenMapper = (children: React.ReactNode, isJsxChild?: boolean) => ElementHeaderChildren | undefined;\n\nexport const mapChildren: ChildrenMapper = (children, isJsxChild = false) => {\n let avatarChild: React.ReactElement<AvatarProps> | undefined;\n const badgeChildren: React.ReactElement<BadgeProps>[] = [];\n const statusDotChildren: React.ReactElement<StatusDotProps>[] = [];\n let statusDotMCChild: React.ReactElement<StatusDotListProps> | undefined;\n const elementHeaderTextChildren: React.ReactElement<ElementHeaderTextProps>[] = [];\n const stringChildren: string[] = [];\n const remainingChildren: React.ReactNode[] = [];\n\n React.Children.forEach(children, child => {\n if (child === null || typeof child === 'undefined') return;\n if (isComponent<AvatarProps>(child, Avatar)) {\n avatarChild = child;\n } else if (isComponent<ElementHeaderTextProps>(child, ElementHeaderText)) {\n elementHeaderTextChildren.push(child);\n } else if (isComponent<BadgeProps>(child, Badge)) {\n badgeChildren.push(child);\n } else if (isComponent<StatusDotListProps>(child, StatusDotList)) {\n statusDotMCChild = child;\n } else if (isComponent<StatusDotProps>(child, StatusDot)) {\n statusDotChildren.push(child);\n } else if (typeof child === 'string') {\n stringChildren.push(child);\n } else {\n remainingChildren.push(child);\n }\n });\n\n // Dette og recursive mapChildren under(gjøres en gang) er for å passe på at jsx children også sjekkes for Avatar og liknende innhold.\n // Slik opprettholder vi stylingen i tilfeller hvor vertikaler har wrappet elementer i en parent span eller div.\n const hasSpecialChildren =\n avatarChild !== undefined ||\n elementHeaderTextChildren.length > 0 ||\n statusDotChildren.length > 0 ||\n statusDotMCChild !== undefined ||\n (badgeChildren !== undefined && stringChildren.length > 0);\n const noRemainingRecursiveChildren =\n remainingChildren.length === 0 ||\n (isComponentWithChildren(remainingChildren[0]) && typeof remainingChildren[0]?.props?.children === 'undefined');\n\n if (isJsxChild || hasSpecialChildren || noRemainingRecursiveChildren) {\n return {\n avatarChild,\n elementHeaderTextChildren: elementHeaderTextChildren,\n badgeChildren,\n statusDotChildren,\n statusDotMCChild,\n stringChildren,\n remainingChildren,\n };\n }\n\n if (isComponentWithChildren(remainingChildren[0])) {\n return mapChildren(remainingChildren[0]?.props?.children, true);\n }\n};\n\nexport const renderElementHeader = (\n element: React.ReactNode,\n options: Pick<\n ElementHeaderProps,\n 'titleHtmlMarkup' | 'isHovered' | 'size' | 'parentType' | 'chevronIcon' | 'icon' | 'highlightText' | 'closeButton'\n >\n): React.ReactElement | undefined => {\n const { titleHtmlMarkup, isHovered, size, parentType, chevronIcon, icon, highlightText, closeButton } = options;\n\n if (isComponent<ElementHeaderProps>(element, ElementHeader)) {\n return React.cloneElement(element, {\n chevronIcon,\n icon,\n isHovered,\n size,\n parentType,\n highlightText,\n closeButton,\n });\n }\n if (element) {\n return (\n <ElementHeader\n highlightText={highlightText}\n titleHtmlMarkup={titleHtmlMarkup}\n parentType={parentType}\n chevronIcon={chevronIcon}\n icon={icon}\n isHovered={isHovered}\n size={size}\n closeButton={closeButton}\n >\n {element}\n </ElementHeader>\n );\n }\n};\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { AvatarProps, AvatarType } from '../Avatar';\nimport type { BadgeProps, BadgeType } from '../Badge';\nimport type { IconProps, SvgIcon } from '../Icon';\nimport type { LazyIconProps } from '../LazyIcon';\nimport type { StatusDotProps, StatusDotType } from '../StatusDot';\nimport type { TitleTags } from '../Title';\nimport type { ElementHeaderTextProps, ElementHeaderTextType } from './ElementHeaderText/ElementHeaderText';\nimport type { StatusDotListProps, StatusDotListType } from './StatusDotList/StatusDotList';\n\nimport ElementHeaderText from './ElementHeaderText/ElementHeaderText';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { isComponent } from '../../utils/component';\nimport { AvatarSize } from '../Avatar';\nimport Icon, { IconSize } from '../Icon';\nimport StatusDotList from './StatusDotList';\nimport Highlighter from '../Highlighter';\nimport LazyIcon from '../LazyIcon';\nimport { mapChildren } from './utils';\n\nimport styles from './styles.module.scss';\n\nexport type ElementHeaderSize = 'compact' | 'small' | 'medium' | 'large';\nexport type ParentType = 'linklist' | 'expanderlist';\n\nexport interface ElementHeaderType extends React.FC<ElementHeaderProps> {\n Avatar?: AvatarType;\n Badge?: BadgeType;\n ElementHeaderText?: ElementHeaderTextType;\n StatusDot?: StatusDotType;\n StatusDotList?: StatusDotListType;\n}\n\nexport interface ElementHeaderProps {\n /** Adds custom classes to the ElementHeader element. */\n className?: string;\n /** Chevron to render inside of the ElementHeader */\n chevronIcon?: SvgIcon;\n /** Close button to be rendered inside of ElementHeader. This renders in place of chevronIcon */\n closeButton?: React.ReactElement;\n /** Children to be rendered inside of ElementHeader */\n children: React.ReactNode;\n /** Changes the underlying element of the title. Default: h2*/\n titleHtmlMarkup?: TitleTags;\n /** icon to be rendered inside of ElementHeader */\n icon?: React.ReactElement;\n /** whether or not the parent is hovered */\n isHovered?: boolean;\n /** Adjusts styling based on parent */\n parentType?: ParentType;\n /** Changes size of the ElementHeader. */\n size?: ElementHeaderSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text in title. Used for search results */\n highlightText?: string;\n}\n\nexport interface ElementHeaderChildren {\n avatarChild?: React.ReactElement<AvatarProps>;\n elementHeaderTextChildren: React.ReactElement<ElementHeaderTextProps>[];\n badgeChildren?: React.ReactElement<BadgeProps>[];\n statusDotChildren?: React.ReactElement<StatusDotProps>[];\n statusDotMCChild?: React.ReactElement<StatusDotListProps>;\n elementChild?: React.ReactElement;\n stringChildren: string[];\n remainingChildren: React.ReactNode[];\n}\n\nexport const ElementHeaderRoot: ElementHeaderType = props => {\n const {\n className = '',\n titleHtmlMarkup = 'h2',\n parentType = 'linklist',\n chevronIcon,\n closeButton,\n children,\n icon,\n isHovered,\n size,\n testId,\n highlightText,\n } = props;\n const breakpoint = useBreakpoint();\n const showIcon = size !== 'small' && !!icon;\n const contentIsString = typeof children === 'string';\n const mappedChildren = mapChildren(children);\n const hasStatusDots = !!mappedChildren?.statusDotChildren?.length || !!mappedChildren?.statusDotMCChild;\n\n const listLabelClasses = cn(styles['element-header'], { [styles['element-header--compact']]: size === 'compact' }, className);\n const badgeContainerClasses = cn(styles['element-header__badge-container']);\n const badgeClasses = cn(styles['element-header__badge']);\n const statusdotContainerClasses = cn(styles['element-header__statusdot-container']);\n const chevronClasses = cn(styles['element-header__chevron']);\n const contentClasses = cn(styles['element-header__content'], {\n [styles['element-header__content--element']]: !contentIsString,\n [styles['element-header__content--compact']]: size === 'compact',\n });\n const iconClasses = cn(styles['element-header__icon'], { [styles['element-header__icon--with-statusdot']]: hasStatusDots });\n const avatarClasses = cn(styles['element-header__avatar'], {});\n const CustomTag = titleHtmlMarkup;\n const iconPropIsIconComponent = isComponent<IconProps>(icon, Icon);\n const iconPropIsLazyIconComponent = !iconPropIsIconComponent && isComponent<LazyIconProps>(icon, LazyIcon);\n\n let iconComponent;\n if (iconPropIsIconComponent) {\n iconComponent = React.cloneElement(icon as React.ReactElement<IconProps>, {\n size: breakpoint < Breakpoint.md ? IconSize.XSmall : IconSize.Small,\n isHovered,\n });\n } else if (iconPropIsLazyIconComponent) {\n iconComponent = React.cloneElement(icon as React.ReactElement<LazyIconProps>, {\n size: breakpoint < Breakpoint.md ? IconSize.XSmall : IconSize.Small,\n isHovered,\n });\n } else {\n iconComponent = icon;\n }\n\n return (\n <span data-testid={testId} className={listLabelClasses}>\n {showIcon && icon && <span className={iconClasses}>{iconComponent}</span>}\n {size !== 'small' && mappedChildren?.avatarChild && (\n <span className={avatarClasses}>{React.cloneElement(mappedChildren.avatarChild, { size: AvatarSize.xsmall })}</span>\n )}\n\n <span className={contentClasses} data-hasstatusdots={hasStatusDots}>\n {mappedChildren?.elementHeaderTextChildren}\n {!!mappedChildren?.stringChildren.length && (\n <CustomTag className={styles['element-header__title']}>\n <Highlighter searchText={highlightText}>{mappedChildren.stringChildren}</Highlighter>\n </CustomTag>\n )}\n <Highlighter searchText={highlightText}>{mappedChildren?.remainingChildren}</Highlighter>\n </span>\n\n {hasStatusDots && (\n <span className={statusdotContainerClasses}>\n {!!mappedChildren?.statusDotChildren && <StatusDotList>{mappedChildren.statusDotChildren}</StatusDotList>}\n {!!mappedChildren?.statusDotMCChild && mappedChildren?.statusDotMCChild}\n </span>\n )}\n\n <span className={badgeContainerClasses}>\n {mappedChildren?.badgeChildren &&\n mappedChildren.badgeChildren.map((badgeChild, index) => {\n return (\n <span key={index} className={badgeClasses} data-parenttype={parentType}>\n {badgeChild}\n </span>\n );\n })}\n </span>\n {chevronIcon && typeof closeButton === 'undefined' && (\n <span className={chevronClasses} data-parenttype={parentType}>\n <Icon svgIcon={chevronIcon} isHovered={isHovered} size={IconSize.XSmall} />\n </span>\n )}\n {closeButton && (\n <span className={chevronClasses} data-parenttype={parentType}>\n {closeButton}\n </span>\n )}\n </span>\n );\n};\n\ntype ElementHeaderComponent = typeof ElementHeaderRoot & {\n Text: React.FC<ElementHeaderTextProps>;\n StatusDotList: React.FC<StatusDotListProps>;\n};\nElementHeaderRoot.displayName = 'ElementHeader';\nconst ElementHeader = ElementHeaderRoot as ElementHeaderComponent;\nElementHeader.Text = ElementHeaderText;\nElementHeader.Text.displayName = 'ElementHeader.Text';\nElementHeader.StatusDotList = StatusDotList;\nElementHeader.StatusDotList.displayName = 'ElementHeader.StatusDotList';\n\nexport default ElementHeader;\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAa,eAA+B,UAAU,aAAa,UAAU;CAC3E,IAAI;CACJ,MAAM,gBAAkD,CAAC;CACzD,MAAM,oBAA0D,CAAC;CACjE,IAAI;CACJ,MAAM,4BAA0E,CAAC;CACjF,MAAM,iBAA2B,CAAC;CAClC,MAAM,oBAAuC,CAAC;CAE9C,MAAM,SAAS,QAAQ,WAAU,UAAS;EACxC,IAAI,UAAU,QAAQ,OAAO,UAAU,aAAa;EACpD,IAAI,YAAyB,OAAO,cAAM,GACxC,cAAc;OACT,IAAI,YAAoC,OAAO,iBAAiB,GACrE,0BAA0B,KAAK,KAAK;OAC/B,IAAI,YAAwB,OAAO,aAAK,GAC7C,cAAc,KAAK,KAAK;OACnB,IAAI,YAAgC,OAAO,aAAa,GAC7D,mBAAmB;OACd,IAAI,YAA4B,OAAO,iBAAS,GACrD,kBAAkB,KAAK,KAAK;OACvB,IAAI,OAAO,UAAU,UAC1B,eAAe,KAAK,KAAK;OAEzB,kBAAkB,KAAK,KAAK;CAEhC,CAAC;CAID,MAAM,qBACJ,gBAAgB,KAAA,KAChB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,gBAAgB,qBAAqB,oBAAC,uBAAD,EAAA,UAAgB,eAAe,kBAAiC,CAAA,GACvG,CAAC,CAAC,gBAAgB,oBAAoB,gBAAgB,gBACnD;;GAGR,oBAAC,QAAD;IAAM,WAAW;cACd,gBAAgB,iBACf,eAAe,cAAc,KAAK,YAAY,UAAU;KACtD,OACE,oBAAC,QAAD;MAAkB,WAAW;MAAc,mBAAiB;gBACzD;KACG,GAFK,KAEL;IAEV,CAAC;GACC,CAAA;GACL,eAAe,OAAO,gBAAgB,eACrC,oBAAC,QAAD;IAAM,WAAW;IAAgB,mBAAiB;cAChD,oBAAC,cAAD;KAAM,SAAS;KAAwB;KAAW,MAAM,SAAS;IAAS,CAAA;GACtE,CAAA;GAEP,eACC,oBAAC,QAAD;IAAM,WAAW;IAAgB,mBAAiB;cAC/C;GACG,CAAA;EAEJ;;AAEV;AAMA,kBAAkB,cAAc;AAChC,IAAM,gBAAgB;AACtB,cAAc,OAAO;AACrB,cAAc,KAAK,cAAc;AACjC,cAAc,gBAAgB;AAC9B,cAAc,cAAc,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementHeaderText.js","names":[],"sources":["../src/components/ElementHeader/ElementHeaderText/ElementHeaderText.tsx","../src/components/ElementHeader/ElementHeaderText/index.ts"],"sourcesContent":["import cn from 'classnames';\n\nimport type { TitleTags } from '../../Title';\n\nimport Highlighter from '../../Highlighter';\nimport styles from '../styles.module.scss';\n\nexport type ElementHeaderTextType = typeof ElementHeaderText;\n\nexport interface ElementHeaderTextProps {\n /** The first text in the ElementHeaderText Component */\n firstText: string;\n /** Will style the first text as bold */\n firstTextEmphasised?: boolean;\n /** The second text in the ElementHeaderText Component */\n secondText?: string;\n /** Will style the second text as bold */\n secondTextEmphasised?: boolean;\n /** Whether or not this ElementHeaderText is a sub text */\n subText?: boolean;\n /** Adds custom classes to the ElementHeaderText component. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Changes the underlying element of the text. Default: span*/\n titleHtmlMarkup?: TitleTags;\n /** Highlights text. Used for search results */\n highlightText?: string;\n}\n\nexport const ElementHeaderText: React.FC<ElementHeaderTextProps> = props => {\n const {\n firstText,\n firstTextEmphasised = false,\n secondText = undefined,\n secondTextEmphasised = false,\n subText = false,\n className = '',\n testId,\n titleHtmlMarkup = 'span',\n highlightText,\n } = props;\n\n const headerTextWrapperClasses = cn(className, styles['text-wrapper'], {\n [styles['text-wrapper--sub-level']]: subText,\n });\n const firstHeaderTextSegmentClasses = cn({\n [styles['text-wrapper__text--emphasised']]: firstTextEmphasised,\n });\n const secondHeaderTextSegmentClasses = cn({\n [styles['text-wrapper__text--emphasised']]: secondTextEmphasised,\n });\n const CustomTag = titleHtmlMarkup;\n\n return (\n <span data-testid={testId} className={headerTextWrapperClasses}>\n <CustomTag className={styles['element-header__title']}>\n <Highlighter searchText={highlightText}>\n <span className={firstHeaderTextSegmentClasses}>{firstText}</span>\n {secondText && <span className={secondHeaderTextSegmentClasses}>{secondText}</span>}\n </Highlighter>\n </CustomTag>\n </span>\n );\n};\n\nexport default ElementHeaderText;\n","import ElementHeaderText from './ElementHeaderText';\nexport * from './ElementHeaderText';\nexport default ElementHeaderText;\n"],"mappings":";;;;;AA8BA,IAAa,qBAAsD,UAAS;CAC1E,MAAM,EACJ,WACA,sBAAsB,OACtB,aAAa,KAAA,GACb,uBAAuB,OACvB,UAAU,OACV,YAAY,IACZ,QACA,kBAAkB,QAClB,kBACE;CAEJ,MAAM,2BAA2B,WAAG,WAAW,OAAO,iBAAiB,GACpE,OAAO,6BAA6B,
|
|
1
|
+
{"version":3,"file":"ElementHeaderText.js","names":[],"sources":["../src/components/ElementHeader/ElementHeaderText/ElementHeaderText.tsx","../src/components/ElementHeader/ElementHeaderText/index.ts"],"sourcesContent":["import cn from 'classnames';\n\nimport type { TitleTags } from '../../Title';\n\nimport Highlighter from '../../Highlighter';\nimport styles from '../styles.module.scss';\n\nexport type ElementHeaderTextType = typeof ElementHeaderText;\n\nexport interface ElementHeaderTextProps {\n /** The first text in the ElementHeaderText Component */\n firstText: string;\n /** Will style the first text as bold */\n firstTextEmphasised?: boolean;\n /** The second text in the ElementHeaderText Component */\n secondText?: string;\n /** Will style the second text as bold */\n secondTextEmphasised?: boolean;\n /** Whether or not this ElementHeaderText is a sub text */\n subText?: boolean;\n /** Adds custom classes to the ElementHeaderText component. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Changes the underlying element of the text. Default: span*/\n titleHtmlMarkup?: TitleTags;\n /** Highlights text. Used for search results */\n highlightText?: string;\n}\n\nexport const ElementHeaderText: React.FC<ElementHeaderTextProps> = props => {\n const {\n firstText,\n firstTextEmphasised = false,\n secondText = undefined,\n secondTextEmphasised = false,\n subText = false,\n className = '',\n testId,\n titleHtmlMarkup = 'span',\n highlightText,\n } = props;\n\n const headerTextWrapperClasses = cn(className, styles['text-wrapper'], {\n [styles['text-wrapper--sub-level']]: subText,\n });\n const firstHeaderTextSegmentClasses = cn({\n [styles['text-wrapper__text--emphasised']]: firstTextEmphasised,\n });\n const secondHeaderTextSegmentClasses = cn({\n [styles['text-wrapper__text--emphasised']]: secondTextEmphasised,\n });\n const CustomTag = titleHtmlMarkup;\n\n return (\n <span data-testid={testId} className={headerTextWrapperClasses}>\n <CustomTag className={styles['element-header__title']}>\n <Highlighter searchText={highlightText}>\n <span className={firstHeaderTextSegmentClasses}>{firstText}</span>\n {secondText && <span className={secondHeaderTextSegmentClasses}>{secondText}</span>}\n </Highlighter>\n </CustomTag>\n </span>\n );\n};\n\nexport default ElementHeaderText;\n","import ElementHeaderText from './ElementHeaderText';\nexport * from './ElementHeaderText';\nexport default ElementHeaderText;\n"],"mappings":";;;;;AA8BA,IAAa,qBAAsD,UAAS;CAC1E,MAAM,EACJ,WACA,sBAAsB,OACtB,aAAa,KAAA,GACb,uBAAuB,OACvB,UAAU,OACV,YAAY,IACZ,QACA,kBAAkB,QAClB,kBACE;CAEJ,MAAM,2BAA2B,WAAG,WAAW,OAAO,iBAAiB,GACpE,OAAO,6BAA6B,QACvC,CAAC;CACD,MAAM,gCAAgC,WAAG,GACtC,OAAO,oCAAoC,oBAC9C,CAAC;CACD,MAAM,iCAAiC,WAAG,GACvC,OAAO,oCAAoC,qBAC9C,CAAC;CAGD,OACE,oBAAC,QAAD;EAAM,eAAa;EAAQ,WAAW;YACpC,oBAAC,iBAAD;GAAW,WAAW,OAAO;aAC3B,qBAAC,qBAAD;IAAa,YAAY;cAAzB,CACE,oBAAC,QAAD;KAAM,WAAW;eAAgC;IAAgB,CAAA,GAChE,cAAc,oBAAC,QAAD;KAAM,WAAW;eAAiC;IAAiB,CAAA,CACvE;;EACJ,CAAA;CACP,CAAA;AAEV;;;AC9DA,IAAA,4BAAe"}
|
package/lib/ErrorBoundary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","names":[],"sources":["../src/components/LazyIcon/ErrorBoundary.tsx"],"sourcesContent":["import React from 'react';\n\ninterface ErrorBoundaryProps<T> {\n fallback: React.ReactNode;\n children: React.ReactNode;\n reset: T;\n}\n\ninterface ErrorBoundaryState {\n error: boolean;\n}\n\nclass ErrorBoundary<T> extends React.Component<ErrorBoundaryProps<T>, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps<T>) {\n super(props);\n this.state = {\n error: false,\n };\n }\n\n componentDidCatch(): void {\n this.setState({ error: true });\n }\n\n componentDidUpdate(prevProps: Readonly<ErrorBoundaryProps<T>>): void {\n if (prevProps.reset !== this.props.reset) {\n this.setState({ error: false });\n }\n }\n\n render(): React.ReactNode {\n return this.state.error ? this.props.fallback : this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,gBAAN,cAA+B,MAAM,UAAqD;CACxF,YAAY,OAA8B;EACxC,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","names":[],"sources":["../src/components/LazyIcon/ErrorBoundary.tsx"],"sourcesContent":["import React from 'react';\n\ninterface ErrorBoundaryProps<T> {\n fallback: React.ReactNode;\n children: React.ReactNode;\n reset: T;\n}\n\ninterface ErrorBoundaryState {\n error: boolean;\n}\n\nclass ErrorBoundary<T> extends React.Component<ErrorBoundaryProps<T>, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps<T>) {\n super(props);\n this.state = {\n error: false,\n };\n }\n\n componentDidCatch(): void {\n this.setState({ error: true });\n }\n\n componentDidUpdate(prevProps: Readonly<ErrorBoundaryProps<T>>): void {\n if (prevProps.reset !== this.props.reset) {\n this.setState({ error: false });\n }\n }\n\n render(): React.ReactNode {\n return this.state.error ? this.props.fallback : this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,gBAAN,cAA+B,MAAM,UAAqD;CACxF,YAAY,OAA8B;EACxC,MAAM,KAAK;EACX,KAAK,QAAQ,EACX,OAAO,MACT;CACF;CAEA,oBAA0B;EACxB,KAAK,SAAS,EAAE,OAAO,KAAK,CAAC;CAC/B;CAEA,mBAAmB,WAAkD;EACnE,IAAI,UAAU,UAAU,KAAK,MAAM,OACjC,KAAK,SAAS,EAAE,OAAO,MAAM,CAAC;CAElC;CAEA,SAA0B;EACxB,OAAO,KAAK,MAAM,QAAQ,KAAK,MAAM,WAAW,KAAK,MAAM;CAC7D;AACF"}
|
package/lib/ErrorWrapper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorWrapper.js","names":[],"sources":["../src/components/ErrorWrapper/ErrorWrapper.tsx","../src/components/ErrorWrapper/index.ts"],"sourcesContent":["import cn from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface ErrorWrapperClassNameProps {\n errorWrapperClassName?: string;\n}\n\nexport interface ErrorWrapperProps {\n /** Form component */\n children?: React.ReactNode;\n /** Error message */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds a ref to the error message p tag */\n errorMessageRef?: React.Ref<HTMLDivElement>;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const ErrorWrapper: React.FC<ErrorWrapperProps> = props => {\n const { renderError = true } = props;\n\n const errorWrapperClasses = cn(props.errorText && renderError && styles[`error-wrapper--with-error`], props.className);\n\n return (\n <div className={errorWrapperClasses} data-testid={props.testId}>\n <span ref={props.errorMessageRef} tabIndex={-1}>\n {props.errorText && (\n <p className={styles['error-wrapper__errors']} id={props.errorTextId}>\n {props.errorText}\n </p>\n )}\n </span>\n {props.children}\n </div>\n );\n};\n\nexport default ErrorWrapper;\n","import ErrorWrapper from './ErrorWrapper';\nexport * from './ErrorWrapper';\nexport default ErrorWrapper;\n"],"mappings":";;;;AAyBA,IAAa,gBAA4C,UAAS;CAChE,MAAM,EAAE,cAAc,SAAS;CAI/B,OACE,qBAAC,OAAD;EAAK,WAHqB,WAAG,MAAM,aAAa,eAAe,OAAO,8BAA8B,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorWrapper.js","names":[],"sources":["../src/components/ErrorWrapper/ErrorWrapper.tsx","../src/components/ErrorWrapper/index.ts"],"sourcesContent":["import cn from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface ErrorWrapperClassNameProps {\n errorWrapperClassName?: string;\n}\n\nexport interface ErrorWrapperProps {\n /** Form component */\n children?: React.ReactNode;\n /** Error message */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds a ref to the error message p tag */\n errorMessageRef?: React.Ref<HTMLDivElement>;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const ErrorWrapper: React.FC<ErrorWrapperProps> = props => {\n const { renderError = true } = props;\n\n const errorWrapperClasses = cn(props.errorText && renderError && styles[`error-wrapper--with-error`], props.className);\n\n return (\n <div className={errorWrapperClasses} data-testid={props.testId}>\n <span ref={props.errorMessageRef} tabIndex={-1}>\n {props.errorText && (\n <p className={styles['error-wrapper__errors']} id={props.errorTextId}>\n {props.errorText}\n </p>\n )}\n </span>\n {props.children}\n </div>\n );\n};\n\nexport default ErrorWrapper;\n","import ErrorWrapper from './ErrorWrapper';\nexport * from './ErrorWrapper';\nexport default ErrorWrapper;\n"],"mappings":";;;;AAyBA,IAAa,gBAA4C,UAAS;CAChE,MAAM,EAAE,cAAc,SAAS;CAI/B,OACE,qBAAC,OAAD;EAAK,WAHqB,WAAG,MAAM,aAAa,eAAe,OAAO,8BAA8B,MAAM,SAG1F;EAAqB,eAAa,MAAM;YAAxD,CACE,oBAAC,QAAD;GAAM,KAAK,MAAM;GAAiB,UAAU;aACzC,MAAM,aACL,oBAAC,KAAD;IAAG,WAAW,OAAO;IAA0B,IAAI,MAAM;cACtD,MAAM;GACN,CAAA;EAED,CAAA,GACL,MAAM,QACJ;;AAET;;;ACxCA,IAAA,uBAAe"}
|