@helsenorge/designsystem-react 12.0.0-beta.2 → 12.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/AnchorLink.js +1 -0
- package/AnchorLink.js.map +1 -1
- package/Avatar.js.map +1 -1
- package/Badge.js.map +1 -1
- package/Button.js +1 -1
- package/Button.js.map +1 -1
- package/CHANGELOG.md +1793 -969
- package/Checkbox.js.map +1 -1
- package/Close.js.map +1 -1
- package/DictionaryTrigger.js.map +1 -1
- package/Drawer.js +3 -3
- package/Drawer.js.map +1 -1
- package/Duolist.js.map +1 -1
- package/ElementHeader.js +10 -10
- package/ElementHeader.js.map +1 -1
- package/ElementHeaderText.js.map +1 -1
- package/ErrorBoundary.js.map +1 -1
- package/ErrorWrapper.js +3 -2
- package/ErrorWrapper.js.map +1 -1
- package/Expander.js +3 -0
- package/Expander.js.map +1 -1
- package/FormGroup.js +16 -4
- package/FormGroup.js.map +1 -1
- package/FormLayout.js.map +1 -1
- package/HelpDetails.js.map +1 -1
- package/HelpTriggerIcon.js.map +1 -1
- package/HelpTriggerStandalone.js +4 -4
- package/HelpTriggerStandalone.js.map +1 -1
- package/HighlightPanel.js.map +1 -1
- package/Highlighter.js.map +1 -1
- package/HorizontalScroll.js.map +1 -1
- package/Icon.js.map +1 -1
- package/Illustration.js.map +1 -1
- package/InfoTeaser.js.map +1 -1
- package/Input.js +2 -2
- package/Input.js.map +1 -1
- package/Label.js.map +1 -1
- package/LazyIcon.js.map +1 -1
- package/LazyIllustration.js.map +1 -1
- package/LinkList.js +4 -2
- package/LinkList.js.map +1 -1
- package/List.js.map +1 -1
- package/MaxCharacters.js.map +1 -1
- package/NotificationBadge.js.map +1 -1
- package/Panel.js +7 -2
- package/Panel.js.map +1 -1
- package/PanelOld.js.map +1 -1
- package/PanelTitle.js.map +1 -1
- package/PopOver.js.map +1 -1
- package/RadioButton.js +1 -1
- package/RadioButton.js.map +1 -1
- package/Select.js.map +1 -1
- package/Slider.js.map +1 -1
- package/Spacer.js.map +1 -1
- package/StatusDot.js.map +1 -1
- package/{StatusDotMultiComposition.js → StatusDotList.js} +7 -7
- package/StatusDotList.js.map +1 -0
- package/StepButtons.js.map +1 -1
- package/TabList.js +5 -6
- package/TabList.js.map +1 -1
- package/TabPanel.js.map +1 -1
- package/Table.js.map +1 -1
- package/TableBody.js.map +1 -1
- package/TableCell.js.map +1 -1
- package/TableExpandedRow.js.map +1 -1
- package/TableExpanderCell.js.map +1 -1
- package/TableHead.js.map +1 -1
- package/TableHeadCell.js.map +1 -1
- package/TableRow.js.map +1 -1
- package/Textarea.js +1 -1
- package/Textarea.js.map +1 -1
- package/Title.js.map +1 -1
- package/__mocks__/IntersectionObserver.js.map +1 -1
- package/__mocks__/MutationObserver.js.map +1 -1
- package/__mocks__/ResizeObserver.js.map +1 -1
- package/__mocks__/matchMedia.js.map +1 -1
- package/__mocks__/useHover.js.map +1 -1
- package/__mocks__/useLayoutEvent.js.map +1 -1
- package/__mocks__/useOutsideEvent.js.map +1 -1
- package/__mocks__/usePseudoClasses.js.map +1 -1
- package/__mocks__/useSize.js.map +1 -1
- package/__mocks__/uuid.js.map +1 -1
- package/components/AnchorLink/AnchorLink.d.ts +1 -1
- package/components/AnchorLink/styles.module.scss +1 -1
- package/components/ArticleTeaser/index.js.map +1 -1
- package/components/Button/Button.d.ts +1 -1
- package/components/Chip/index.js.map +1 -1
- package/components/Drawer/styles.module.scss +4 -4
- package/components/Dropdown/index.js +26 -35
- package/components/Dropdown/index.js.map +1 -1
- package/components/ElementHeader/ElementHeader.d.ts +4 -4
- package/components/ElementHeader/{StatusDotMultiComposition/StatusDotMultiComposition.d.ts → StatusDotList/StatusDotList.d.ts} +4 -4
- package/components/ElementHeader/StatusDotList/index.d.ts +3 -0
- package/components/ElementHeader/StatusDotList/index.js +6 -0
- package/components/ElementHeader/{StatusDotMultiComposition → StatusDotList}/styles.module.scss +1 -1
- package/components/ElementHeader/StatusDotList/styles.module.scss.d.ts +11 -0
- package/components/ElementHeader/styles.module.scss +29 -19
- package/components/ElementHeader/styles.module.scss.d.ts +1 -0
- package/components/EmptyState/index.js.map +1 -1
- package/components/ErrorWrapper/ErrorWrapper.d.ts +4 -0
- package/components/Expander/Expander.d.ts +1 -0
- package/components/ExpanderHierarchy/index.js.map +1 -1
- package/components/ExpanderList/index.js.map +1 -1
- package/components/ExpanderList/styles.module.scss +2 -2
- package/components/EyebrowHeader/index.js +1 -1
- package/components/EyebrowHeader/index.js.map +1 -1
- package/components/FormGroup/FormGroup.d.ts +2 -0
- package/components/HelpBubble/index.js +1 -1
- package/components/HelpBubble/index.js.map +1 -1
- package/components/HelpDetails/styles.module.scss +0 -2
- package/components/HelpDrawer/index.js.map +1 -1
- package/components/HelpExpanderInline/index.js.map +1 -1
- package/components/HelpExpanderStandalone/index.js.map +1 -1
- package/components/HelpExpanderStandalone/styles.module.scss +5 -0
- package/components/HelpPanel/index.js.map +1 -1
- package/components/HelpTeaser/index.js.map +1 -1
- package/components/HelpTooltip/index.js.map +1 -1
- package/components/HelpTriggerInline/index.js.map +1 -1
- package/components/HelpTriggerStandalone/styles.module.scss +28 -35
- package/components/HelpTriggerStandalone/styles.module.scss.d.ts +0 -1
- package/components/Icons/ActiveMonitoring.js.map +1 -1
- package/components/Icons/AcupunctureBack.js.map +1 -1
- package/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/components/Icons/AlarmClock.js.map +1 -1
- package/components/Icons/AlertSignFill.js.map +1 -1
- package/components/Icons/AlertSignStroke.js.map +1 -1
- package/components/Icons/Amputation.js.map +1 -1
- package/components/Icons/Anxiety.js.map +1 -1
- package/components/Icons/Apple.js.map +1 -1
- package/components/Icons/Archive.js.map +1 -1
- package/components/Icons/ArmFlexing.js.map +1 -1
- package/components/Icons/ArrowDown.js.map +1 -1
- package/components/Icons/ArrowLeft.js.map +1 -1
- package/components/Icons/ArrowRight.js.map +1 -1
- package/components/Icons/ArrowUp.js.map +1 -1
- package/components/Icons/ArrowUpRight.js.map +1 -1
- package/components/Icons/Attachment.js.map +1 -1
- package/components/Icons/Atv.js.map +1 -1
- package/components/Icons/Avatar.js.map +1 -1
- package/components/Icons/AwakePersonOnPillow.js.map +1 -1
- package/components/Icons/Baby.js.map +1 -1
- package/components/Icons/BandAid.js.map +1 -1
- package/components/Icons/BeerAndPills.js.map +1 -1
- package/components/Icons/Bell.js.map +1 -1
- package/components/Icons/Bike.js.map +1 -1
- package/components/Icons/BirthControl.js.map +1 -1
- package/components/Icons/BirthdayCake.js.map +1 -1
- package/components/Icons/Boat.js.map +1 -1
- package/components/Icons/Body.js.map +1 -1
- package/components/Icons/Braille.js.map +1 -1
- package/components/Icons/Brain.js.map +1 -1
- package/components/Icons/BreastReconstruction.js.map +1 -1
- package/components/Icons/BreastRemoval.js.map +1 -1
- package/components/Icons/Breasts.js.map +1 -1
- package/components/Icons/BrokenHeart.js.map +1 -1
- package/components/Icons/BrokenPuzzle.js.map +1 -1
- package/components/Icons/Bus.js.map +1 -1
- package/components/Icons/Calendar.js.map +1 -1
- package/components/Icons/CalendarChange.js.map +1 -1
- package/components/Icons/CalendarCheck.js.map +1 -1
- package/components/Icons/CalendarEvent.js.map +1 -1
- package/components/Icons/CalendarSave.js.map +1 -1
- package/components/Icons/Cancer.js.map +1 -1
- package/components/Icons/Candle.js.map +1 -1
- package/components/Icons/Car.js.map +1 -1
- package/components/Icons/Carton.js.map +1 -1
- package/components/Icons/Change.js.map +1 -1
- package/components/Icons/Check.js.map +1 -1
- package/components/Icons/CheckFill.js.map +1 -1
- package/components/Icons/CheckOutline.js.map +1 -1
- package/components/Icons/Chest.js.map +1 -1
- package/components/Icons/ChevronDown.js.map +1 -1
- package/components/Icons/ChevronLeft.js.map +1 -1
- package/components/Icons/ChevronRight.js.map +1 -1
- package/components/Icons/ChevronUp.js.map +1 -1
- package/components/Icons/ChevronsDown.js.map +1 -1
- package/components/Icons/ChevronsUp.js.map +1 -1
- package/components/Icons/ChildPlaying.js.map +1 -1
- package/components/Icons/Cigarette.js.map +1 -1
- package/components/Icons/Coins.js.map +1 -1
- package/components/Icons/Contacts.js.map +1 -1
- package/components/Icons/Copy.js.map +1 -1
- package/components/Icons/CoronaCertificate.js.map +1 -1
- package/components/Icons/Coronavirus.js.map +1 -1
- package/components/Icons/Cough.js.map +1 -1
- package/components/Icons/CreditCard.js.map +1 -1
- package/components/Icons/CriticalHealthInfo.js.map +1 -1
- package/components/Icons/Cross.js.map +1 -1
- package/components/Icons/DataExchange.js.map +1 -1
- package/components/Icons/DataReceived.js.map +1 -1
- package/components/Icons/DataSent.js.map +1 -1
- package/components/Icons/Depression.js.map +1 -1
- package/components/Icons/DigestiveSystem.js.map +1 -1
- package/components/Icons/Dizzy.js.map +1 -1
- package/components/Icons/Documents.js.map +1 -1
- package/components/Icons/Dog.js.map +1 -1
- package/components/Icons/DonorCard.js.map +1 -1
- package/components/Icons/DotActive.js.map +1 -1
- package/components/Icons/DotAlert.js.map +1 -1
- package/components/Icons/DotCancelled.js.map +1 -1
- package/components/Icons/DotHalfDisc.js.map +1 -1
- package/components/Icons/DotInactive.js.map +1 -1
- package/components/Icons/DotInfo.js.map +1 -1
- package/components/Icons/DotLookingGlass.js.map +1 -1
- package/components/Icons/DotPending.js.map +1 -1
- package/components/Icons/DotQuestionMark.js.map +1 -1
- package/components/Icons/DotSuccess.js.map +1 -1
- package/components/Icons/DotTransparent.js.map +1 -1
- package/components/Icons/DotWarningTriangle.js.map +1 -1
- package/components/Icons/Download.js.map +1 -1
- package/components/Icons/Draft.js.map +1 -1
- package/components/Icons/EChat.js.map +1 -1
- package/components/Icons/Ear.js.map +1 -1
- package/components/Icons/EarDeaf.js.map +1 -1
- package/components/Icons/EarHearingAid.js.map +1 -1
- package/components/Icons/EarNoseThroat.js.map +1 -1
- package/components/Icons/EarVolume.js.map +1 -1
- package/components/Icons/ElderlyPerson.js.map +1 -1
- package/components/Icons/Embolization.js.map +1 -1
- package/components/Icons/EmergencyCall.js.map +1 -1
- package/components/Icons/EmoticonAnnoyed.js.map +1 -1
- package/components/Icons/EmoticonDelighted.js.map +1 -1
- package/components/Icons/EmoticonDisappointed.js.map +1 -1
- package/components/Icons/EmoticonHappy.js.map +1 -1
- package/components/Icons/EmoticonMeh.js.map +1 -1
- package/components/Icons/EmptyBox.js.map +1 -1
- package/components/Icons/EnterFullScreen.js.map +1 -1
- package/components/Icons/Envelope.js.map +1 -1
- package/components/Icons/Epilepsy.js.map +1 -1
- package/components/Icons/Eraser.js.map +1 -1
- package/components/Icons/ErrorSignFill.js.map +1 -1
- package/components/Icons/ErrorSignStroke.js.map +1 -1
- package/components/Icons/EuropeanHealthCard.js.map +1 -1
- package/components/Icons/ExitFullScreen.js.map +1 -1
- package/components/Icons/Eye.js.map +1 -1
- package/components/Icons/Facebook.js.map +1 -1
- package/components/Icons/FallingLeaf.js.map +1 -1
- package/components/Icons/Female.js.map +1 -1
- package/components/Icons/FemaleDoctor.js.map +1 -1
- package/components/Icons/Ferry.js.map +1 -1
- package/components/Icons/File.js.map +1 -1
- package/components/Icons/Filter.js.map +1 -1
- package/components/Icons/FingerBleed.js.map +1 -1
- package/components/Icons/FirstAidKit.js.map +1 -1
- package/components/Icons/Fish.js.map +1 -1
- package/components/Icons/FloppyDisk.js.map +1 -1
- package/components/Icons/Football.js.map +1 -1
- package/components/Icons/Form.js.map +1 -1
- package/components/Icons/Forward.js.map +1 -1
- package/components/Icons/Gallery.js.map +1 -1
- package/components/Icons/Garden.js.map +1 -1
- package/components/Icons/GasCan.js.map +1 -1
- package/components/Icons/GenderIdentity.js.map +1 -1
- package/components/Icons/GlassWater.js.map +1 -1
- package/components/Icons/Glasses.js.map +1 -1
- package/components/Icons/Globe.js.map +1 -1
- package/components/Icons/Grain.js.map +1 -1
- package/components/Icons/Graph.js.map +1 -1
- package/components/Icons/Group.js.map +1 -1
- package/components/Icons/GroupTwins.js.map +1 -1
- package/components/Icons/HTMLFile.js.map +1 -1
- package/components/Icons/HandWaving.js.map +1 -1
- package/components/Icons/HandWithDisease.js.map +1 -1
- package/components/Icons/HandsAndHeart.js.map +1 -1
- package/components/Icons/HealthClinic.js.map +1 -1
- package/components/Icons/HealthMeasurements.js.map +1 -1
- package/components/Icons/HealthWarning.js.map +1 -1
- package/components/Icons/HealthcarePerson.js.map +1 -1
- package/components/Icons/HealthcarePersonell.js.map +1 -1
- package/components/Icons/HearingProtection.js.map +1 -1
- package/components/Icons/Heart.js.map +1 -1
- package/components/Icons/HeartHands.js.map +1 -1
- package/components/Icons/HelpSign.js.map +1 -1
- package/components/Icons/HelpingHand.js.map +1 -1
- package/components/Icons/Hemodialysis.js.map +1 -1
- package/components/Icons/Hiker.js.map +1 -1
- package/components/Icons/Hipprosthesis.js.map +1 -1
- package/components/Icons/History.js.map +1 -1
- package/components/Icons/HivAndAids.js.map +1 -1
- package/components/Icons/Home.js.map +1 -1
- package/components/Icons/HomeFill.js.map +1 -1
- package/components/Icons/Hormone.js.map +1 -1
- package/components/Icons/Hospital.js.map +1 -1
- package/components/Icons/Hourglass.js.map +1 -1
- package/components/Icons/ImgFile.js.map +1 -1
- package/components/Icons/Inbox.js.map +1 -1
- package/components/Icons/InfoSignFill.js.map +1 -1
- package/components/Icons/InfoSignStroke.js.map +1 -1
- package/components/Icons/Instagram.js.map +1 -1
- package/components/Icons/Intravenous.js.map +1 -1
- package/components/Icons/JointPain.js.map +1 -1
- package/components/Icons/Journal.js.map +1 -1
- package/components/Icons/JpgFile.js.map +1 -1
- package/components/Icons/Kidney.js.map +1 -1
- package/components/Icons/KitchenScale.js.map +1 -1
- package/components/Icons/Kjernejournal.js.map +1 -1
- package/components/Icons/Laboratory.js.map +1 -1
- package/components/Icons/LaptopBlog.js.map +1 -1
- package/components/Icons/LawBook.js.map +1 -1
- package/components/Icons/LegalDocument.js.map +1 -1
- package/components/Icons/LightBulb.js.map +1 -1
- package/components/Icons/List.js.map +1 -1
- package/components/Icons/Location.js.map +1 -1
- package/components/Icons/LocationFill.js.map +1 -1
- package/components/Icons/Lock.js.map +1 -1
- package/components/Icons/Login.js.map +1 -1
- package/components/Icons/Logout.js.map +1 -1
- package/components/Icons/Lungs.js.map +1 -1
- package/components/Icons/Makeup.js.map +1 -1
- package/components/Icons/MaleDoctor.js.map +1 -1
- package/components/Icons/MaleDoctorAndPerson.js.map +1 -1
- package/components/Icons/MaleDoctorCompact.js.map +1 -1
- package/components/Icons/MaleDoctorCompactFill.js.map +1 -1
- package/components/Icons/MaleGenitalia.js.map +1 -1
- package/components/Icons/Medicine.js.map +1 -1
- package/components/Icons/MedicineWarning.js.map +1 -1
- package/components/Icons/MentalHealthAdult.js.map +1 -1
- package/components/Icons/MentalHealthChild.js.map +1 -1
- package/components/Icons/Menu.js.map +1 -1
- package/components/Icons/Microscope.js.map +1 -1
- package/components/Icons/Minus.js.map +1 -1
- package/components/Icons/Mirror.js.map +1 -1
- package/components/Icons/MobilePhone.js.map +1 -1
- package/components/Icons/MotherHoldingBaby.js.map +1 -1
- package/components/Icons/MuscleBack.js.map +1 -1
- package/components/Icons/MuscleLeg.js.map +1 -1
- package/components/Icons/Mushroom.js.map +1 -1
- package/components/Icons/Music.js.map +1 -1
- package/components/Icons/MusselsAndSalt.js.map +1 -1
- package/components/Icons/NoAccess.js.map +1 -1
- package/components/Icons/NoEye.js.map +1 -1
- package/components/Icons/NoFilter.js.map +1 -1
- package/components/Icons/Notepad.js.map +1 -1
- package/components/Icons/Osteotomy.js.map +1 -1
- package/components/Icons/PaintRoller.js.map +1 -1
- package/components/Icons/PaperPlane.js.map +1 -1
- package/components/Icons/PatientAndPerson.js.map +1 -1
- package/components/Icons/Pause.js.map +1 -1
- package/components/Icons/PdfFile.js.map +1 -1
- package/components/Icons/Pencil.js.map +1 -1
- package/components/Icons/PeopleTalking.js.map +1 -1
- package/components/Icons/Peritonealdialysis.js.map +1 -1
- package/components/Icons/Person.js.map +1 -1
- package/components/Icons/PersonAndPatient.js.map +1 -1
- package/components/Icons/PersonCancel.js.map +1 -1
- package/components/Icons/PersonInXRayMachine.js.map +1 -1
- package/components/Icons/PersonOverweight.js.map +1 -1
- package/components/Icons/PersonRelaxing.js.map +1 -1
- package/components/Icons/PersonWithBrain.js.map +1 -1
- package/components/Icons/PersonWithBrokenArm.js.map +1 -1
- package/components/Icons/PersonWithCrutches.js.map +1 -1
- package/components/Icons/PersonWithJaw.js.map +1 -1
- package/components/Icons/PersonWithMagnifyingGlass.js.map +1 -1
- package/components/Icons/PersonWithSenses.js.map +1 -1
- package/components/Icons/PersonWorking.js.map +1 -1
- package/components/Icons/PersonalPlan.js.map +1 -1
- package/components/Icons/PizzaSlice.js.map +1 -1
- package/components/Icons/Plane.js.map +1 -1
- package/components/Icons/Plant.js.map +1 -1
- package/components/Icons/PlateKnifeFork.js.map +1 -1
- package/components/Icons/Play.js.map +1 -1
- package/components/Icons/PlusLarge.js.map +1 -1
- package/components/Icons/PlusSmall.js.map +1 -1
- package/components/Icons/PngFile.js.map +1 -1
- package/components/Icons/Podcast.js.map +1 -1
- package/components/Icons/PoisonInformation.js.map +1 -1
- package/components/Icons/Pregnant.js.map +1 -1
- package/components/Icons/Printer.js.map +1 -1
- package/components/Icons/Psychosis.js.map +1 -1
- package/components/Icons/Publication.js.map +1 -1
- package/components/Icons/Puzzle.js.map +1 -1
- package/components/Icons/QrCode.js.map +1 -1
- package/components/Icons/Quarrel.js.map +1 -1
- package/components/Icons/RadioTherapy.js.map +1 -1
- package/components/Icons/RadioactiveTreatment.js.map +1 -1
- package/components/Icons/Radioiodine.js.map +1 -1
- package/components/Icons/Receipt.js.map +1 -1
- package/components/Icons/Receptionist.js.map +1 -1
- package/components/Icons/Recovery.js.map +1 -1
- package/components/Icons/Referral.js.map +1 -1
- package/components/Icons/Refresh.js.map +1 -1
- package/components/Icons/Refund.js.map +1 -1
- package/components/Icons/Reminder.js.map +1 -1
- package/components/Icons/Reply.js.map +1 -1
- package/components/Icons/Rocket.js.map +1 -1
- package/components/Icons/RtfFile.js.map +1 -1
- package/components/Icons/STDs.js.map +1 -1
- package/components/Icons/Save.js.map +1 -1
- package/components/Icons/Scale.js.map +1 -1
- package/components/Icons/ScreenReader.js.map +1 -1
- package/components/Icons/Search.js.map +1 -1
- package/components/Icons/SectionSign.js.map +1 -1
- package/components/Icons/Settings.js.map +1 -1
- package/components/Icons/SettingsFill.js.map +1 -1
- package/components/Icons/Sexualorientation.js.map +1 -1
- package/components/Icons/ShakingHand.js.map +1 -1
- package/components/Icons/Share.js.map +1 -1
- package/components/Icons/SharedHealthData.js.map +1 -1
- package/components/Icons/SharedHealthMeasurements.js.map +1 -1
- package/components/Icons/Shield.js.map +1 -1
- package/components/Icons/ShuntOperation.js.map +1 -1
- package/components/Icons/Skeleton.js.map +1 -1
- package/components/Icons/Skin.js.map +1 -1
- package/components/Icons/Snake.js.map +1 -1
- package/components/Icons/Snapchat.js.map +1 -1
- package/components/Icons/SortDown.js.map +1 -1
- package/components/Icons/SortUp.js.map +1 -1
- package/components/Icons/SpeechBubble.js.map +1 -1
- package/components/Icons/Spray.js.map +1 -1
- package/components/Icons/StickyNote.js.map +1 -1
- package/components/Icons/StickyNotes.js.map +1 -1
- package/components/Icons/Stopwatch.js.map +1 -1
- package/components/Icons/Sun.js.map +1 -1
- package/components/Icons/SupportingPerson.js.map +1 -1
- package/components/Icons/Surgery.js.map +1 -1
- package/components/Icons/Sweets.js.map +1 -1
- package/components/Icons/Syringe.js.map +1 -1
- package/components/Icons/Taxi.js.map +1 -1
- package/components/Icons/TeddyBear.js.map +1 -1
- package/components/Icons/Teenagers.js.map +1 -1
- package/components/Icons/ThinkingAboutBaby.js.map +1 -1
- package/components/Icons/Ticket.js.map +1 -1
- package/components/Icons/TimePassing.js.map +1 -1
- package/components/Icons/Toddler.js.map +1 -1
- package/components/Icons/Tombstone.js.map +1 -1
- package/components/Icons/Toolbox.js.map +1 -1
- package/components/Icons/Tooth.js.map +1 -1
- package/components/Icons/TotalKneeProsthesis.js.map +1 -1
- package/components/Icons/Train.js.map +1 -1
- package/components/Icons/Transplantation.js.map +1 -1
- package/components/Icons/TrashCan.js.map +1 -1
- package/components/Icons/TravelRoute.js.map +1 -1
- package/components/Icons/TreatmentAids.js.map +1 -1
- package/components/Icons/TriangleX.js.map +1 -1
- package/components/Icons/Twitter.js.map +1 -1
- package/components/Icons/Undo.js.map +1 -1
- package/components/Icons/UniProsthesis.js.map +1 -1
- package/components/Icons/Upload.js.map +1 -1
- package/components/Icons/UserOrganization.js.map +1 -1
- package/components/Icons/Vaccine.js.map +1 -1
- package/components/Icons/VerticalDots.js.map +1 -1
- package/components/Icons/VideoCamera.js.map +1 -1
- package/components/Icons/VideoChat.js.map +1 -1
- package/components/Icons/Wallet.js.map +1 -1
- package/components/Icons/Watch.js.map +1 -1
- package/components/Icons/Website.js.map +1 -1
- package/components/Icons/Wheelchair.js.map +1 -1
- package/components/Icons/WheelchairActive.js.map +1 -1
- package/components/Icons/Window.js.map +1 -1
- package/components/Icons/WordDocument.js.map +1 -1
- package/components/Icons/WorkSuitcase.js.map +1 -1
- package/components/Icons/X.js.map +1 -1
- package/components/Icons/XOutline.js.map +1 -1
- package/components/Icons/XmlFile.js.map +1 -1
- package/components/Icons/YouTube.js.map +1 -1
- package/components/Icons/Zoom.js.map +1 -1
- package/components/Illustrations/BabyMobile.js.map +1 -1
- package/components/Illustrations/BabyMobileMedium.js.map +1 -1
- package/components/Illustrations/Child.js.map +1 -1
- package/components/Illustrations/ChildMedium.js.map +1 -1
- package/components/Illustrations/Doctor.js.map +1 -1
- package/components/Illustrations/DoctorMedium.js.map +1 -1
- package/components/Illustrations/DoctorSmall.js.map +1 -1
- package/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
- package/components/Illustrations/FacialRecognitionFingerprintMedium.js.map +1 -1
- package/components/Illustrations/GiveBabyFood.js.map +1 -1
- package/components/Illustrations/GiveBabyFoodMedium.js.map +1 -1
- package/components/Illustrations/HealthcarePersonnel.js.map +1 -1
- package/components/Illustrations/HealthcarePersonnelMedium.js.map +1 -1
- package/components/Illustrations/HealthcarePersonnelSmall.js.map +1 -1
- package/components/Illustrations/IllustrationNames.js.map +1 -1
- package/components/Illustrations/ReadLetters.js.map +1 -1
- package/components/Illustrations/ReadLettersMedium.js.map +1 -1
- package/components/Illustrations/Stroller.js.map +1 -1
- package/components/Illustrations/StrollerMedium.js.map +1 -1
- package/components/Illustrations/Support2.js.map +1 -1
- package/components/Illustrations/Support2Medium.js.map +1 -1
- package/components/LinkList/LinkList.d.ts +2 -0
- package/components/LinkList/styles.module.scss +23 -6
- package/components/LinkList/styles.module.scss.d.ts +1 -0
- package/components/Loader/index.js.map +1 -1
- package/components/Logo/index.js.map +1 -1
- package/components/Modal/index.js.map +1 -1
- package/components/NotificationPanel/NotificationPanel.d.ts +1 -1
- package/components/NotificationPanel/index.js +2 -3
- package/components/NotificationPanel/index.js.map +1 -1
- package/components/NotificationPanel/styles.module.scss +0 -6
- package/components/NotificationPanel/styles.module.scss.d.ts +0 -3
- package/components/Panel/Panel.d.ts +2 -0
- package/components/PanelList/index.js.map +1 -1
- package/components/PanelListOld/index.js.map +1 -1
- package/components/PopMenu/index.js +2 -2
- package/components/PopMenu/index.js.map +1 -1
- package/components/PopOver/styles.module.scss +1 -1
- package/components/Portal/index.js.map +1 -1
- package/components/Progressbar/index.js.map +1 -1
- package/components/PromoPanel/index.js.map +1 -1
- package/components/RadioButton/styles.module.scss +6 -1
- package/components/ServiceMessage/index.js +1 -1
- package/components/ServiceMessage/index.js.map +1 -1
- package/components/SharingStatus/index.js.map +1 -1
- package/components/Step/index.js.map +1 -1
- package/components/Stepper/index.js.map +1 -1
- package/components/StickyNote/index.js +2 -2
- package/components/StickyNote/index.js.map +1 -1
- package/components/Tabs/TabList/styles.module.scss +14 -4
- package/components/Tabs/TabList/styles.module.scss.d.ts +1 -0
- package/components/Tabs/index.js.map +1 -1
- package/components/Tabs/styles.module.scss +4 -2
- package/components/Tag/index.js.map +1 -1
- package/components/TagList/index.js.map +1 -1
- package/components/Tile/index.js.map +1 -1
- package/components/Tile/styles.module.scss +1 -2
- package/components/Toggle/index.js.map +1 -1
- package/components/Validation/index.js +1 -1
- package/components/Validation/index.js.map +1 -1
- package/constants.js.map +1 -1
- package/floating-ui.react.js +142 -88
- package/floating-ui.react.js.map +1 -1
- package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
- package/hooks/useBreakpoint.js +4 -3
- package/hooks/useBreakpoint.js.map +1 -1
- package/hooks/useElementList.js.map +1 -1
- package/hooks/useEventListenerState.js.map +1 -1
- package/hooks/useExpand.js.map +1 -1
- package/hooks/useFocusToggle.js.map +1 -1
- package/hooks/useFocusTrap.js.map +1 -1
- package/hooks/useFocusableElements.js.map +1 -1
- package/hooks/useHover.js.map +1 -1
- package/hooks/useIcons.js.map +1 -1
- package/hooks/useIntersectionObserver.js.map +1 -1
- package/hooks/useInterval.js.map +1 -1
- package/hooks/useIsMobileBreakpoint.js.map +1 -1
- package/hooks/useIsServerSide.js.map +1 -1
- package/hooks/useIsVisible.js.map +1 -1
- package/hooks/useKeyboardEvent.js.map +1 -1
- package/hooks/useLayoutEvent.js.map +1 -1
- package/hooks/useOutsideEvent.js.map +1 -1
- package/hooks/usePrevious.js.map +1 -1
- package/hooks/usePseudoClasses.js +2 -1
- package/hooks/usePseudoClasses.js.map +1 -1
- package/hooks/useResizeObserver.js.map +1 -1
- package/hooks/useReturnFocusOnUnmount.js.map +1 -1
- package/hooks/useRovingFocus.js.map +1 -1
- package/hooks/useSize.js +1 -1
- package/hooks/useSize.js.map +1 -1
- package/hooks/useToggle.js.map +1 -1
- package/hooks/useUuid.js.map +1 -1
- package/hooks/usestopPropagation.js.map +1 -1
- package/package.json +1 -1
- package/scss/bootstrap/scss/_variables.scss +1 -1
- package/scss/typography.module.scss +1 -1
- package/scss/typography.stories.tsx +2 -4
- package/theme/currys/color.js.map +1 -1
- package/theme/currys/spacing.js.map +1 -1
- package/use-animate.js +1 -1
- package/use-animate.js.map +1 -1
- package/utils/accessibility.js.map +1 -1
- package/utils/component.d.ts +2 -2
- package/utils/component.js.map +1 -1
- package/utils/debounce.js +1 -1
- package/utils/debounce.js.map +1 -1
- package/utils/device.js.map +1 -1
- package/utils/environment.js.map +1 -1
- package/utils/focus.js.map +1 -1
- package/utils/language.js.map +1 -1
- package/utils/mobile.js.map +1 -1
- package/utils/refs.js.map +1 -1
- package/utils/scroll.js.map +1 -1
- package/utils/viewport.js.map +1 -1
- package/utils.js.map +1 -1
- package/uuid.js.map +1 -1
- package/StatusDotMultiComposition.js.map +0 -1
- package/components/ElementHeader/StatusDotMultiComposition/index.d.ts +0 -3
- package/components/ElementHeader/StatusDotMultiComposition/index.js +0 -6
- package/components/ElementHeader/StatusDotMultiComposition/styles.module.scss.d.ts +0 -11
- /package/components/ElementHeader/{StatusDotMultiComposition → StatusDotList}/index.js.map +0 -0
package/TableExpanderCell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableExpanderCell.js","sources":["../src/components/Table/TableExpanderCell/TableExpanderCell.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport ChevronDown from '../../Icons/ChevronDown';\nimport ChevronUp from '../../Icons/ChevronUp';\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\n\nexport interface Props {\n /** Adds custom classes to the element. */\n className?: string;\n /** Row is expanded. */\n expanded: boolean;\n /** Id for expanded row. */\n expandableRowId: string;\n /** Text for hide button used for aria label. */\n hideDetailsText: string;\n /** Text for show button used for aria label. */\n showDetailsText: string;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableExpanderCell = ({\n expandableRowId,\n hideDetailsText,\n showDetailsText,\n expanded,\n className,\n mode = ModeType.normal,\n}: Props): React.JSX.Element => {\n const tableCellClass = classNames(tableStyles['table__cell'], tableStyles['table__cell-expander'], className, {\n [tableStyles['table__cell--compact']]: mode === ModeType.compact,\n });\n const icon = expanded ? ChevronUp : ChevronDown;\n\n return (\n <td className={tableCellClass}>\n <Button\n variant=\"borderless\"\n aria-expanded={expanded}\n aria-controls={expandableRowId}\n ariaLabel={expanded ? hideDetailsText : showDetailsText}\n >\n <Icon svgIcon={icon} />\n </Button>\n </td>\n );\n};\n\nexport default TableExpanderCell;\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,SAAS;AAClB,MAAgC;
|
|
1
|
+
{"version":3,"file":"TableExpanderCell.js","sources":["../src/components/Table/TableExpanderCell/TableExpanderCell.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport ChevronDown from '../../Icons/ChevronDown';\nimport ChevronUp from '../../Icons/ChevronUp';\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\n\nexport interface Props {\n /** Adds custom classes to the element. */\n className?: string;\n /** Row is expanded. */\n expanded: boolean;\n /** Id for expanded row. */\n expandableRowId: string;\n /** Text for hide button used for aria label. */\n hideDetailsText: string;\n /** Text for show button used for aria label. */\n showDetailsText: string;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableExpanderCell = ({\n expandableRowId,\n hideDetailsText,\n showDetailsText,\n expanded,\n className,\n mode = ModeType.normal,\n}: Props): React.JSX.Element => {\n const tableCellClass = classNames(tableStyles['table__cell'], tableStyles['table__cell-expander'], className, {\n [tableStyles['table__cell--compact']]: mode === ModeType.compact,\n });\n const icon = expanded ? ChevronUp : ChevronDown;\n\n return (\n <td className={tableCellClass}>\n <Button\n variant=\"borderless\"\n aria-expanded={expanded}\n aria-controls={expandableRowId}\n ariaLabel={expanded ? hideDetailsText : showDetailsText}\n >\n <Icon svgIcon={icon} />\n </Button>\n </td>\n );\n};\n\nexport default TableExpanderCell;\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,SAAS;AAClB,MAAgC;AAC9B,QAAM,iBAAiB,WAAW,YAAY,aAAa,GAAG,YAAY,sBAAsB,GAAG,WAAW;AAAA,IAC5G,CAAC,YAAY,sBAAsB,CAAC,GAAG,SAAS,SAAS;AAAA,EAAA,CAC1D;AACD,QAAM,OAAO,WAAW,YAAY;AAEpC,SACE,oBAAC,MAAA,EAAG,WAAW,gBACb,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,WAAW,kBAAkB;AAAA,MAExC,UAAA,oBAAC,MAAA,EAAK,SAAS,KAAA,CAAM;AAAA,IAAA;AAAA,EAAA,GAEzB;AAEJ;"}
|
package/TableHead.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHead.js","sources":["../src/components/Table/TableHead/TableHead.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\n\nexport enum HeaderCategory {\n normal = 'normal',\n transparent = 'transparent',\n sortable = 'sortable',\n}\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'thead'>, 'style'> {\n /** Header category for styling. Default: normal */\n category?: HeaderCategory;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the thead. Add table rows */\n children: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableHead: React.FC<Props> = ({ category = HeaderCategory.normal, className, children, mode, ...rest }) => {\n const tableHeadClass = classNames(\n tableStyles['table__head'],\n {\n [tableStyles['table__head--normal']]: category === HeaderCategory.normal,\n [tableStyles['table__head--transparent']]: category === HeaderCategory.transparent,\n [tableStyles['table__head--sortable']]: category == HeaderCategory.sortable,\n [tableStyles['table__head--compact']]: mode == ModeType.compact,\n },\n className\n );\n\n return (\n <thead className={tableHeadClass} {...rest}>\n {React.Children.map(children, child => React.isValidElement<{ mode?: ModeType }>(child) && React.cloneElement(child, { mode }))}\n </thead>\n );\n};\n\nexport default TableHead;\n"],"names":["HeaderCategory","React"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"TableHead.js","sources":["../src/components/Table/TableHead/TableHead.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\n\nexport enum HeaderCategory {\n normal = 'normal',\n transparent = 'transparent',\n sortable = 'sortable',\n}\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'thead'>, 'style'> {\n /** Header category for styling. Default: normal */\n category?: HeaderCategory;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the thead. Add table rows */\n children: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableHead: React.FC<Props> = ({ category = HeaderCategory.normal, className, children, mode, ...rest }) => {\n const tableHeadClass = classNames(\n tableStyles['table__head'],\n {\n [tableStyles['table__head--normal']]: category === HeaderCategory.normal,\n [tableStyles['table__head--transparent']]: category === HeaderCategory.transparent,\n [tableStyles['table__head--sortable']]: category == HeaderCategory.sortable,\n [tableStyles['table__head--compact']]: mode == ModeType.compact,\n },\n className\n );\n\n return (\n <thead className={tableHeadClass} {...rest}>\n {React.Children.map(children, child => React.isValidElement<{ mode?: ModeType }>(child) && React.cloneElement(child, { mode }))}\n </thead>\n );\n};\n\nexport default TableHead;\n"],"names":["HeaderCategory","React"],"mappings":";;;;;AAOO,IAAK,mCAAAA,oBAAL;AACLA,kBAAA,QAAA,IAAS;AACTA,kBAAA,aAAA,IAAc;AACdA,kBAAA,UAAA,IAAW;AAHD,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAiBL,MAAM,YAA6B,CAAC,EAAE,WAAW,UAAuB,WAAW,UAAU,MAAM,GAAG,WAAW;AACtH,QAAM,iBAAiB;AAAA,IACrB,YAAY,aAAa;AAAA,IACzB;AAAA,MACE,CAAC,YAAY,qBAAqB,CAAC,GAAG,aAAa;AAAA,MACnD,CAAC,YAAY,0BAA0B,CAAC,GAAG,aAAa;AAAA,MACxD,CAAC,YAAY,uBAAuB,CAAC,GAAG,YAAY;AAAA,MACpD,CAAC,YAAY,sBAAsB,CAAC,GAAG,QAAQ,SAAS;AAAA,IAAA;AAAA,IAE1D;AAAA,EAAA;AAGF,SACE,oBAAC,WAAM,WAAW,gBAAiB,GAAG,MACnC,UAAAC,eAAM,SAAS,IAAI,UAAU,CAAA,UAASA,eAAM,eAAoC,KAAK,KAAKA,eAAM,aAAa,OAAO,EAAE,KAAA,CAAM,CAAC,EAAA,CAChI;AAEJ;"}
|
package/TableHeadCell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeadCell.js","sources":["../src/components/Table/TableHeadCell/TableHeadCell.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Icon, { IconSize } from '../../Icon';\nimport ArrowDown from '../../Icons/ArrowDown';\nimport ArrowUp from '../../Icons/ArrowUp';\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\n\nexport enum SortDirection {\n asc = 'asc',\n desc = 'desc',\n}\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'th'>, 'style'> {\n /** Sets if column for head cell should be sortable*/\n sortable?: boolean;\n /** Sort direction */\n sortDir?: SortDirection;\n /** Function that is called when clicked */\n onClick?: () => void;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the td element. */\n children?: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableHeadCell: React.FC<Props> = ({\n sortable,\n onClick,\n className,\n children,\n sortDir,\n mode = ModeType.normal,\n scope = 'col',\n ...rest\n}) => {\n const tableHeadCellDefaultClass = classNames(tableStyles['table__head-cell'], className, {\n [tableStyles['table__head-cell--compact']]: mode === ModeType.compact,\n });\n\n if (!sortable && !children) {\n return <td className={tableHeadCellDefaultClass}></td>;\n }\n\n if (!sortable) {\n return (\n <th scope={scope} className={tableHeadCellDefaultClass} {...rest}>\n {children}\n </th>\n );\n }\n\n const sortableClasses = classNames(tableHeadCellDefaultClass, tableStyles['table__head-cell--sortable'], className);\n\n const renderSortIcon = (): React.JSX.Element | undefined =>\n sortDir && (\n <div className={tableStyles['table__head-cell-sort-icon-wrapper']}>\n <Icon svgIcon={sortDir == SortDirection.asc ? ArrowDown : ArrowUp} size={IconSize.XXSmall} />\n </div>\n );\n\n const getSortDirection = (): React.AriaAttributes['aria-sort'] => {\n switch (sortDir) {\n case SortDirection.asc:\n return 'ascending';\n case SortDirection.desc:\n return 'descending';\n }\n };\n\n return (\n <th scope={scope} className={sortableClasses} aria-sort={getSortDirection()} {...rest}>\n <button type=\"button\" onClick={onClick} className={tableStyles['table__sort-button']} aria-pressed={sortDir ? !!sortDir : undefined}>\n {renderSortIcon()}\n {children}\n </button>\n </th>\n );\n};\n\nexport default TableHeadCell;\n"],"names":["SortDirection"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableHeadCell.js","sources":["../src/components/Table/TableHeadCell/TableHeadCell.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Icon, { IconSize } from '../../Icon';\nimport ArrowDown from '../../Icons/ArrowDown';\nimport ArrowUp from '../../Icons/ArrowUp';\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\n\nexport enum SortDirection {\n asc = 'asc',\n desc = 'desc',\n}\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'th'>, 'style'> {\n /** Sets if column for head cell should be sortable*/\n sortable?: boolean;\n /** Sort direction */\n sortDir?: SortDirection;\n /** Function that is called when clicked */\n onClick?: () => void;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the td element. */\n children?: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableHeadCell: React.FC<Props> = ({\n sortable,\n onClick,\n className,\n children,\n sortDir,\n mode = ModeType.normal,\n scope = 'col',\n ...rest\n}) => {\n const tableHeadCellDefaultClass = classNames(tableStyles['table__head-cell'], className, {\n [tableStyles['table__head-cell--compact']]: mode === ModeType.compact,\n });\n\n if (!sortable && !children) {\n return <td className={tableHeadCellDefaultClass}></td>;\n }\n\n if (!sortable) {\n return (\n <th scope={scope} className={tableHeadCellDefaultClass} {...rest}>\n {children}\n </th>\n );\n }\n\n const sortableClasses = classNames(tableHeadCellDefaultClass, tableStyles['table__head-cell--sortable'], className);\n\n const renderSortIcon = (): React.JSX.Element | undefined =>\n sortDir && (\n <div className={tableStyles['table__head-cell-sort-icon-wrapper']}>\n <Icon svgIcon={sortDir == SortDirection.asc ? ArrowDown : ArrowUp} size={IconSize.XXSmall} />\n </div>\n );\n\n const getSortDirection = (): React.AriaAttributes['aria-sort'] => {\n switch (sortDir) {\n case SortDirection.asc:\n return 'ascending';\n case SortDirection.desc:\n return 'descending';\n }\n };\n\n return (\n <th scope={scope} className={sortableClasses} aria-sort={getSortDirection()} {...rest}>\n <button type=\"button\" onClick={onClick} className={tableStyles['table__sort-button']} aria-pressed={sortDir ? !!sortDir : undefined}>\n {renderSortIcon()}\n {children}\n </button>\n </th>\n );\n};\n\nexport default TableHeadCell;\n"],"names":["SortDirection"],"mappings":";;;;;;;;AAUO,IAAK,kCAAAA,mBAAL;AACLA,iBAAA,KAAA,IAAM;AACNA,iBAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAoBL,MAAM,gBAAiC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,SAAS;AAAA,EAChB,QAAQ;AAAA,EACR,GAAG;AACL,MAAM;AACJ,QAAM,4BAA4B,WAAW,YAAY,kBAAkB,GAAG,WAAW;AAAA,IACvF,CAAC,YAAY,2BAA2B,CAAC,GAAG,SAAS,SAAS;AAAA,EAAA,CAC/D;AAED,MAAI,CAAC,YAAY,CAAC,UAAU;AAC1B,WAAO,oBAAC,MAAA,EAAG,WAAW,0BAAA,CAA2B;AAAA,EACnD;AAEA,MAAI,CAAC,UAAU;AACb,+BACG,MAAA,EAAG,OAAc,WAAW,2BAA4B,GAAG,MACzD,UACH;AAAA,EAEJ;AAEA,QAAM,kBAAkB,WAAW,2BAA2B,YAAY,4BAA4B,GAAG,SAAS;AAElH,QAAM,iBAAiB,MACrB,+BACG,OAAA,EAAI,WAAW,YAAY,oCAAoC,GAC9D,8BAAC,MAAA,EAAK,SAAS,WAAW,QAAoB,YAAY,SAAS,MAAM,SAAS,SAAS,GAC7F;AAGJ,QAAM,mBAAmB,MAAyC;AAChE,YAAQ,SAAA;AAAA,MACN,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,IAAA;AAAA,EAEb;AAEA,SACE,oBAAC,MAAA,EAAG,OAAc,WAAW,iBAAiB,aAAW,iBAAA,GAAqB,GAAG,MAC/E,UAAA,qBAAC,UAAA,EAAO,MAAK,UAAS,SAAkB,WAAW,YAAY,oBAAoB,GAAG,gBAAc,UAAU,CAAC,CAAC,UAAU,QACvH,UAAA;AAAA,IAAA,eAAA;AAAA,IACA;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ;"}
|
package/TableRow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.js","sources":["../src/components/Table/TableExpanderCell/TableExpanderCellMobile.tsx","../src/components/Table/TableRow/TableRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport ChevronDown from '../../Icons/ChevronDown';\nimport ChevronUp from '../../Icons/ChevronUp';\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\nimport { Props } from '../TableRow/TableRow';\n\ntype TableExpanderCellMobileProps = Pick<Props, 'expanded' | 'onClick' | 'hideDetailsText' | 'showDetailsText' | 'mode'>;\n\nconst TableExpanderCellMobile: React.FC<TableExpanderCellMobileProps> = ({\n expanded,\n onClick,\n hideDetailsText,\n showDetailsText,\n mode = ModeType.normal,\n}) => {\n const cellClass = classNames(tableStyles.table__cell, tableStyles['table__expander-cell-mobile'], {\n [tableStyles['table__expander-cell-mobile--expanded']]: expanded,\n [tableStyles['table__cell--compact']]: mode === ModeType.compact,\n });\n\n return (\n <td className={cellClass}>\n <Button aria-expanded={expanded} variant=\"borderless\" onClick={onClick}>\n <Icon svgIcon={expanded ? ChevronUp : ChevronDown} /> {expanded ? hideDetailsText : showDetailsText}\n </Button>\n </td>\n );\n};\n\nexport default TableExpanderCellMobile;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\nimport TableExpanderCellMobile from '../TableExpanderCell/TableExpanderCellMobile';\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'tr'>, 'style'> {\n /** Sets if expanded row can be expanded */\n expandable?: boolean;\n /** Sets if expanded row is expanded */\n expanded?: boolean;\n /** When hide/show button for expanded row is clicked. */\n onClick?: () => void;\n /** Text for expanded row hide button. */\n hideDetailsText?: string;\n /** Text for expanded row show button. */\n showDetailsText?: string;\n /** Key attribute for row */\n rowKey?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the cells of the table row element. */\n children?: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableRow: React.FC<Props> = ({\n rowKey,\n hideDetailsText,\n showDetailsText,\n expandable,\n expanded,\n onClick,\n className,\n children,\n mode = ModeType.normal,\n ...rest\n}) => {\n const tableRowClass = classNames(\n tableStyles['table-row'],\n {\n [tableStyles['table__row--expandable']]: expandable,\n },\n className\n );\n\n return (\n <tr className={tableRowClass} onClick={onClick} key={rowKey} {...rest}>\n {React.Children.map(children, child => React.isValidElement<{ mode?: ModeType }>(child) && React.cloneElement(child, { mode }))}\n {expandable && (\n <TableExpanderCellMobile\n expanded={expanded}\n onClick={onClick}\n hideDetailsText={hideDetailsText}\n showDetailsText={showDetailsText}\n mode={mode}\n />\n )}\n </tr>\n );\n};\n\nexport default TableRow;\n"],"names":["React"],"mappings":";;;;;;;;;AAcA,MAAM,0BAAkE,CAAC;AAAA,EACvE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,SAAS;AAClB,MAAM;AACJ,QAAM,YAAY,WAAW,YAAY,aAAa,YAAY,6BAA6B,GAAG;AAAA,IAChG,CAAC,YAAY,uCAAuC,CAAC,GAAG;AAAA,IACxD,CAAC,YAAY,sBAAsB,CAAC,GAAG,SAAS,SAAS;AAAA,EAAA,CAC1D;
|
|
1
|
+
{"version":3,"file":"TableRow.js","sources":["../src/components/Table/TableExpanderCell/TableExpanderCellMobile.tsx","../src/components/Table/TableRow/TableRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport ChevronDown from '../../Icons/ChevronDown';\nimport ChevronUp from '../../Icons/ChevronUp';\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\nimport { Props } from '../TableRow/TableRow';\n\ntype TableExpanderCellMobileProps = Pick<Props, 'expanded' | 'onClick' | 'hideDetailsText' | 'showDetailsText' | 'mode'>;\n\nconst TableExpanderCellMobile: React.FC<TableExpanderCellMobileProps> = ({\n expanded,\n onClick,\n hideDetailsText,\n showDetailsText,\n mode = ModeType.normal,\n}) => {\n const cellClass = classNames(tableStyles.table__cell, tableStyles['table__expander-cell-mobile'], {\n [tableStyles['table__expander-cell-mobile--expanded']]: expanded,\n [tableStyles['table__cell--compact']]: mode === ModeType.compact,\n });\n\n return (\n <td className={cellClass}>\n <Button aria-expanded={expanded} variant=\"borderless\" onClick={onClick}>\n <Icon svgIcon={expanded ? ChevronUp : ChevronDown} /> {expanded ? hideDetailsText : showDetailsText}\n </Button>\n </td>\n );\n};\n\nexport default TableExpanderCellMobile;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport tableStyles from '../styles.module.scss';\nimport { ModeType } from '../Table';\nimport TableExpanderCellMobile from '../TableExpanderCell/TableExpanderCellMobile';\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'tr'>, 'style'> {\n /** Sets if expanded row can be expanded */\n expandable?: boolean;\n /** Sets if expanded row is expanded */\n expanded?: boolean;\n /** When hide/show button for expanded row is clicked. */\n onClick?: () => void;\n /** Text for expanded row hide button. */\n hideDetailsText?: string;\n /** Text for expanded row show button. */\n showDetailsText?: string;\n /** Key attribute for row */\n rowKey?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the cells of the table row element. */\n children?: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableRow: React.FC<Props> = ({\n rowKey,\n hideDetailsText,\n showDetailsText,\n expandable,\n expanded,\n onClick,\n className,\n children,\n mode = ModeType.normal,\n ...rest\n}) => {\n const tableRowClass = classNames(\n tableStyles['table-row'],\n {\n [tableStyles['table__row--expandable']]: expandable,\n },\n className\n );\n\n return (\n <tr className={tableRowClass} onClick={onClick} key={rowKey} {...rest}>\n {React.Children.map(children, child => React.isValidElement<{ mode?: ModeType }>(child) && React.cloneElement(child, { mode }))}\n {expandable && (\n <TableExpanderCellMobile\n expanded={expanded}\n onClick={onClick}\n hideDetailsText={hideDetailsText}\n showDetailsText={showDetailsText}\n mode={mode}\n />\n )}\n </tr>\n );\n};\n\nexport default TableRow;\n"],"names":["React"],"mappings":";;;;;;;;;AAcA,MAAM,0BAAkE,CAAC;AAAA,EACvE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,SAAS;AAClB,MAAM;AACJ,QAAM,YAAY,WAAW,YAAY,aAAa,YAAY,6BAA6B,GAAG;AAAA,IAChG,CAAC,YAAY,uCAAuC,CAAC,GAAG;AAAA,IACxD,CAAC,YAAY,sBAAsB,CAAC,GAAG,SAAS,SAAS;AAAA,EAAA,CAC1D;AAED,SACE,oBAAC,MAAA,EAAG,WAAW,WACb,UAAA,qBAAC,UAAO,iBAAe,UAAU,SAAQ,cAAa,SACpD,UAAA;AAAA,IAAA,oBAAC,MAAA,EAAK,SAAS,WAAW,YAAY,aAAa;AAAA,IAAE;AAAA,IAAE,WAAW,kBAAkB;AAAA,EAAA,EAAA,CACtF,EAAA,CACF;AAEJ;ACJO,MAAM,WAA4B,CAAC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,SAAS;AAAA,EAChB,GAAG;AACL,MAAM;AACJ,QAAM,gBAAgB;AAAA,IACpB,YAAY,WAAW;AAAA,IACvB;AAAA,MACE,CAAC,YAAY,wBAAwB,CAAC,GAAG;AAAA,IAAA;AAAA,IAE3C;AAAA,EAAA;AAGF,8BACG,MAAA,EAAG,WAAW,eAAe,SAAgC,GAAG,MAC9D,UAAA;AAAA,IAAAA,eAAM,SAAS,IAAI,UAAU,CAAA,UAASA,eAAM,eAAoC,KAAK,KAAKA,eAAM,aAAa,OAAO,EAAE,KAAA,CAAM,CAAC;AAAA,IAC7H,cACC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,GATiD,MAWrD;AAEJ;"}
|
package/Textarea.js
CHANGED
|
@@ -89,7 +89,7 @@ const Textarea = React__default.forwardRef((props, ref) => {
|
|
|
89
89
|
});
|
|
90
90
|
useEffect(() => {
|
|
91
91
|
var _a, _b, _c;
|
|
92
|
-
value
|
|
92
|
+
if (value) setTextareaInput(value);
|
|
93
93
|
if (grow && ((_a = referanse.current) == null ? void 0 : _a.children) && ((_b = referanse.current) == null ? void 0 : _b.children[0])) {
|
|
94
94
|
const textarea = (_c = referanse.current) == null ? void 0 : _c.children[0];
|
|
95
95
|
resizeHeight(textarea);
|
package/Textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { renderLabel } from '../Label';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** The text is displayed in the end of the text-counter */\n maxText?: string;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea = React.forwardRef((props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => {\n const {\n maxCharacters,\n maxText,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n ...rest\n } = props;\n\n const [rows, setRows] = useState(minRows);\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useUuid(errorTextId);\n\n useEffect(() => {\n setTextareaInput(defaultValue || '');\n }, [defaultValue]);\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n const previousRows = target.rows;\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows === previousRows) {\n target.rows = currentRows;\n }\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n }\n\n if (currentRows < maxRows) {\n setRows(currentRows);\n } else {\n setRows(maxRows);\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useEffect(() => {\n value
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { renderLabel } from '../Label';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** The text is displayed in the end of the text-counter */\n maxText?: string;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea = React.forwardRef((props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => {\n const {\n maxCharacters,\n maxText,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n ...rest\n } = props;\n\n const [rows, setRows] = useState(minRows);\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useUuid(errorTextId);\n\n useEffect(() => {\n setTextareaInput(defaultValue || '');\n }, [defaultValue]);\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n const previousRows = target.rows;\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows === previousRows) {\n target.rows = currentRows;\n }\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n }\n\n if (currentRows < maxRows) {\n setRows(currentRows);\n } else {\n setRows(maxRows);\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useEffect(() => {\n if (value) setTextareaInput(value);\n\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel(label, textareaId, onColor as FormOnColor)}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={rows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={maxText}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n"],"names":["React","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AAEtD,SACE,oBAAC,cAAA,EAAa,WAAW,uBAAuB,WAAsB,aAAa,eACjF,UAAA,qBAAC,OAAA,EAAI,eAAa,QAAQ,oBAAkB,YAAY,UAAU,WAAW,sBAC1E,UAAA;AAAA,IAAA,YAAY,OAAO,YAAY,OAAsB;AAAA,IACtD,oBAAC,SAAI,WAAW,qBAAqB,KAAK,WAAW,OAAO,EAAE,SAAA,GAC5D,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,IAAI;AAAA,QACJ,WAAW;AAAA,QACX;AAAA,QACA,oBAAkB,mBAAmB,OAAO,aAAa;AAAA,QACzD,gBAAc,CAAC,CAAC;AAAA,QAEhB;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAc,eAAe,eAAe;AAAA,QAC5C;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IACC,iBACC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,QAAQ,cAAc,SAAA,EAAW;AAAA,QACjC;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CAEJ,EAAA,CACF;AAEJ,CAAC;AAED,SAAS,cAAc;"}
|
package/Title.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.js","sources":["../src/components/Title/Title.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport titleStyles from './styles.module.scss';\n\nexport type TitleTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';\nexport type TitleAppearances = 'titleFeature' | 'title1' | 'title2' | 'title3' | 'title4' | 'title5' | 'title6';\n\nexport interface TitleProps {\n children: React.ReactNode;\n /** Gives a unique id to the title */\n id?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds top and bottom margin in rem. */\n margin?: number | TitleMargin;\n /** Changes the underlying element of the title. */\n htmlMarkup?: TitleTags;\n /** Changes the appearance of the title. */\n appearance?: TitleAppearances;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Title = React.forwardRef(function TitleForwardedRef(props: TitleProps, ref: React.ForwardedRef<HTMLHeadingElement>) {\n const { id, children, className, htmlMarkup = 'h1', appearance = 'title1', margin = 0, testId } = props;\n const titleClasses = classNames(\n titleStyles.title,\n {\n [titleStyles['title--feature']]: appearance === 'titleFeature',\n [titleStyles['title--title1']]: appearance === 'title1',\n [titleStyles['title--title2']]: appearance === 'title2',\n [titleStyles['title--title3']]: appearance === 'title3',\n [titleStyles['title--title4']]: appearance === 'title4',\n [titleStyles['title--title5']]: appearance === 'title5',\n [titleStyles['title--title6']]: appearance === 'title6',\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n const inlineStyle = instanceOfTitleMargin(margin)\n ? { marginTop: `${margin.marginTop}rem`, marginBottom: `${margin.marginBottom}rem` }\n : { marginTop: `${margin}rem`, marginBottom: `${margin}rem` };\n\n return (\n <CustomTag id={id} className={titleClasses} style={inlineStyle} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Title}>\n {children}\n </CustomTag>\n );\n});\n\nexport interface TitleMargin {\n marginTop: number;\n marginBottom: number;\n}\n\nexport const instanceOfTitleMargin = (margin: unknown): margin is TitleMargin => {\n return Object.prototype.hasOwnProperty.call(margin, 'marginTop') && Object.prototype.hasOwnProperty.call(margin, 'marginBottom');\n};\n\nexport default Title;\n"],"names":["React"],"mappings":";;;;;AA2BO,MAAM,QAAQA,eAAM,WAAW,SAAS,kBAAkB,OAAmB,KAA6C;
|
|
1
|
+
{"version":3,"file":"Title.js","sources":["../src/components/Title/Title.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport titleStyles from './styles.module.scss';\n\nexport type TitleTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';\nexport type TitleAppearances = 'titleFeature' | 'title1' | 'title2' | 'title3' | 'title4' | 'title5' | 'title6';\n\nexport interface TitleProps {\n children: React.ReactNode;\n /** Gives a unique id to the title */\n id?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds top and bottom margin in rem. */\n margin?: number | TitleMargin;\n /** Changes the underlying element of the title. */\n htmlMarkup?: TitleTags;\n /** Changes the appearance of the title. */\n appearance?: TitleAppearances;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Title = React.forwardRef(function TitleForwardedRef(props: TitleProps, ref: React.ForwardedRef<HTMLHeadingElement>) {\n const { id, children, className, htmlMarkup = 'h1', appearance = 'title1', margin = 0, testId } = props;\n const titleClasses = classNames(\n titleStyles.title,\n {\n [titleStyles['title--feature']]: appearance === 'titleFeature',\n [titleStyles['title--title1']]: appearance === 'title1',\n [titleStyles['title--title2']]: appearance === 'title2',\n [titleStyles['title--title3']]: appearance === 'title3',\n [titleStyles['title--title4']]: appearance === 'title4',\n [titleStyles['title--title5']]: appearance === 'title5',\n [titleStyles['title--title6']]: appearance === 'title6',\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n const inlineStyle = instanceOfTitleMargin(margin)\n ? { marginTop: `${margin.marginTop}rem`, marginBottom: `${margin.marginBottom}rem` }\n : { marginTop: `${margin}rem`, marginBottom: `${margin}rem` };\n\n return (\n <CustomTag id={id} className={titleClasses} style={inlineStyle} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Title}>\n {children}\n </CustomTag>\n );\n});\n\nexport interface TitleMargin {\n marginTop: number;\n marginBottom: number;\n}\n\nexport const instanceOfTitleMargin = (margin: unknown): margin is TitleMargin => {\n return Object.prototype.hasOwnProperty.call(margin, 'marginTop') && Object.prototype.hasOwnProperty.call(margin, 'marginBottom');\n};\n\nexport default Title;\n"],"names":["React"],"mappings":";;;;;AA2BO,MAAM,QAAQA,eAAM,WAAW,SAAS,kBAAkB,OAAmB,KAA6C;AAC/H,QAAM,EAAE,IAAI,UAAU,WAAW,aAAa,MAAM,aAAa,UAAU,SAAS,GAAG,OAAA,IAAW;AAClG,QAAM,eAAe;AAAA,IACnB,YAAY;AAAA,IACZ;AAAA,MACE,CAAC,YAAY,gBAAgB,CAAC,GAAG,eAAe;AAAA,MAChD,CAAC,YAAY,eAAe,CAAC,GAAG,eAAe;AAAA,MAC/C,CAAC,YAAY,eAAe,CAAC,GAAG,eAAe;AAAA,MAC/C,CAAC,YAAY,eAAe,CAAC,GAAG,eAAe;AAAA,MAC/C,CAAC,YAAY,eAAe,CAAC,GAAG,eAAe;AAAA,MAC/C,CAAC,YAAY,eAAe,CAAC,GAAG,eAAe;AAAA,MAC/C,CAAC,YAAY,eAAe,CAAC,GAAG,eAAe;AAAA,IAAA;AAAA,IAEjD;AAAA,EAAA;AAEF,QAAM,YAAY;AAElB,QAAM,cAAc,sBAAsB,MAAM,IAC5C,EAAE,WAAW,GAAG,OAAO,SAAS,OAAO,cAAc,GAAG,OAAO,YAAY,MAAA,IAC3E,EAAE,WAAW,GAAG,MAAM,OAAO,cAAc,GAAG,MAAM,MAAA;AAExD,SACE,oBAAC,WAAA,EAAU,IAAQ,WAAW,cAAc,OAAO,aAAa,KAAU,eAAa,QAAQ,oBAAkB,YAAY,OAC1H,UACH;AAEJ,CAAC;AAOM,MAAM,wBAAwB,CAAC,WAA2C;AAC/E,SAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,WAAW,KAAK,OAAO,UAAU,eAAe,KAAK,QAAQ,cAAc;AACjI;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntersectionObserver.js","sources":["../../src/__mocks__/IntersectionObserver.ts"],"sourcesContent":["class IntersectionObserver {\n observe(): void {\n // do nothing\n }\n unobserve(): void {\n // do nothing\n }\n disconnect(): void {\n // do nothing\n }\n}\n\nObject.defineProperty(window, 'IntersectionObserver', {\n value: IntersectionObserver,\n});\n\nexport default IntersectionObserver;\n"],"names":[],"mappings":"AAAA,MAAM,qBAAqB;AAAA,EACzB,UAAgB;AAAA,
|
|
1
|
+
{"version":3,"file":"IntersectionObserver.js","sources":["../../src/__mocks__/IntersectionObserver.ts"],"sourcesContent":["class IntersectionObserver {\n observe(): void {\n // do nothing\n }\n unobserve(): void {\n // do nothing\n }\n disconnect(): void {\n // do nothing\n }\n}\n\nObject.defineProperty(window, 'IntersectionObserver', {\n value: IntersectionObserver,\n});\n\nexport default IntersectionObserver;\n"],"names":[],"mappings":"AAAA,MAAM,qBAAqB;AAAA,EACzB,UAAgB;AAAA,EAEhB;AAAA,EACA,YAAkB;AAAA,EAElB;AAAA,EACA,aAAmB;AAAA,EAEnB;AACF;AAEA,OAAO,eAAe,QAAQ,wBAAwB;AAAA,EACpD,OAAO;AACT,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationObserver.js","sources":["../../src/__mocks__/MutationObserver.ts"],"sourcesContent":["class MutationObserver {\n observe(): void {\n // do nothing\n }\n disconnect(): void {\n // do nothing\n }\n}\n\nObject.defineProperty(window, 'MutationObserver', {\n value: MutationObserver,\n});\n\nexport default MutationObserver;\n"],"names":[],"mappings":"AAAA,MAAM,iBAAiB;AAAA,EACrB,UAAgB;AAAA,
|
|
1
|
+
{"version":3,"file":"MutationObserver.js","sources":["../../src/__mocks__/MutationObserver.ts"],"sourcesContent":["class MutationObserver {\n observe(): void {\n // do nothing\n }\n disconnect(): void {\n // do nothing\n }\n}\n\nObject.defineProperty(window, 'MutationObserver', {\n value: MutationObserver,\n});\n\nexport default MutationObserver;\n"],"names":[],"mappings":"AAAA,MAAM,iBAAiB;AAAA,EACrB,UAAgB;AAAA,EAEhB;AAAA,EACA,aAAmB;AAAA,EAEnB;AACF;AAEA,OAAO,eAAe,QAAQ,oBAAoB;AAAA,EAChD,OAAO;AACT,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizeObserver.js","sources":["../../src/__mocks__/ResizeObserver.ts"],"sourcesContent":["class ResizeObserver {\n observe() {\n // do nothing\n }\n unobserve() {\n // do nothing\n }\n disconnect() {\n // do nothing\n }\n}\n\nObject.defineProperty(window, 'ResizeObserver', {\n value: ResizeObserver,\n});\n\nexport default ResizeObserver;\n"],"names":[],"mappings":"AAAA,MAAM,eAAe;AAAA,EACnB,
|
|
1
|
+
{"version":3,"file":"ResizeObserver.js","sources":["../../src/__mocks__/ResizeObserver.ts"],"sourcesContent":["class ResizeObserver {\n observe(): void {\n // do nothing\n }\n unobserve(): void {\n // do nothing\n }\n disconnect(): void {\n // do nothing\n }\n}\n\nObject.defineProperty(window, 'ResizeObserver', {\n value: ResizeObserver,\n});\n\nexport default ResizeObserver;\n"],"names":[],"mappings":"AAAA,MAAM,eAAe;AAAA,EACnB,UAAgB;AAAA,EAEhB;AAAA,EACA,YAAkB;AAAA,EAElB;AAAA,EACA,aAAmB;AAAA,EAEnB;AACF;AAEA,OAAO,eAAe,QAAQ,kBAAkB;AAAA,EAC9C,OAAO;AACT,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchMedia.js","sources":["../../src/__mocks__/matchMedia.ts"],"sourcesContent":["import { vi } from 'vitest';\n\nexport const mockWindowMatchMedia = vi.fn().mockImplementation(() => ({\n matches: true,\n addListener: vi.fn(),\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n}));\n\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: mockWindowMatchMedia,\n});\n"],"names":[],"mappings":";AAEO,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"matchMedia.js","sources":["../../src/__mocks__/matchMedia.ts"],"sourcesContent":["import { vi } from 'vitest';\n\nexport const mockWindowMatchMedia = vi.fn().mockImplementation(() => ({\n matches: true,\n addListener: vi.fn(),\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n}));\n\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: mockWindowMatchMedia,\n});\n"],"names":[],"mappings":";AAEO,MAAM,uBAAuB,GAAG,GAAA,EAAK,mBAAmB,OAAO;AAAA,EACpE,SAAS;AAAA,EACT,aAAa,GAAG,GAAA;AAAA,EAChB,kBAAkB,GAAG,GAAA;AAAA,EACrB,qBAAqB,GAAG,GAAA;AAC1B,EAAE;AAEF,OAAO,eAAe,QAAQ,cAAc;AAAA,EAC1C,UAAU;AAAA,EACV,OAAO;AACT,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHover.js","sources":["../../src/__mocks__/useHover.ts"],"sourcesContent":["vi.mock('../hooks/useHover', () => ({\n useHover: vi.fn().mockImplementation(ref => {\n return { hoverRef: ref || { current: undefined }, isHovered: false };\n }),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,qBAAqB,OAAO;AAAA,EAClC,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"useHover.js","sources":["../../src/__mocks__/useHover.ts"],"sourcesContent":["vi.mock('../hooks/useHover', () => ({\n useHover: vi.fn().mockImplementation(ref => {\n return { hoverRef: ref || { current: undefined }, isHovered: false };\n }),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,qBAAqB,OAAO;AAAA,EAClC,UAAU,GAAG,GAAA,EAAK,mBAAmB,CAAA,QAAO;AAC1C,WAAO,EAAE,UAAU,OAAO,EAAE,SAAS,OAAA,GAAa,WAAW,MAAA;AAAA,EAC/D,CAAC;AACH,EAAE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayoutEvent.js","sources":["../../src/__mocks__/useLayoutEvent.ts"],"sourcesContent":["vi.mock('../hooks/useLayoutEvent', () => ({\n useLayoutEvent: vi.fn(),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,2BAA2B,OAAO;AAAA,EACxC,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"file":"useLayoutEvent.js","sources":["../../src/__mocks__/useLayoutEvent.ts"],"sourcesContent":["vi.mock('../hooks/useLayoutEvent', () => ({\n useLayoutEvent: vi.fn(),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,2BAA2B,OAAO;AAAA,EACxC,gBAAgB,GAAG,GAAA;AACrB,EAAE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOutsideEvent.js","sources":["../../src/__mocks__/useOutsideEvent.ts"],"sourcesContent":["vi.mock('../hooks/useOutsideEvent', () => ({\n useOutsideEvent: vi.fn(),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,4BAA4B,OAAO;AAAA,EACzC,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"useOutsideEvent.js","sources":["../../src/__mocks__/useOutsideEvent.ts"],"sourcesContent":["vi.mock('../hooks/useOutsideEvent', () => ({\n useOutsideEvent: vi.fn(),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,4BAA4B,OAAO;AAAA,EACzC,iBAAiB,GAAG,GAAA;AACtB,EAAE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePseudoClasses.js","sources":["../../src/__mocks__/usePseudoClasses.ts"],"sourcesContent":["vi.mock('../hooks/usePseudoClasses', () => ({\n usePseudoClasses: vi.fn().mockImplementation(ref => {\n return { refObject: ref, isHovered: false, isFocused: false };\n }),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,6BAA6B,OAAO;AAAA,EAC1C,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"usePseudoClasses.js","sources":["../../src/__mocks__/usePseudoClasses.ts"],"sourcesContent":["vi.mock('../hooks/usePseudoClasses', () => ({\n usePseudoClasses: vi.fn().mockImplementation(ref => {\n return { refObject: ref, isHovered: false, isFocused: false };\n }),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,6BAA6B,OAAO;AAAA,EAC1C,kBAAkB,GAAG,GAAA,EAAK,mBAAmB,CAAA,QAAO;AAClD,WAAO,EAAE,WAAW,KAAK,WAAW,OAAO,WAAW,MAAA;AAAA,EACxD,CAAC;AACH,EAAE;"}
|
package/__mocks__/useSize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSize.js","sources":["../../src/__mocks__/useSize.ts"],"sourcesContent":["vi.mock('../hooks/useSize', () => ({\n useSize: vi.fn().mockReturnValue({\n height: 100,\n width: 100,\n top: 0,\n left: 0,\n right: 100,\n bottom: 100,\n }),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,oBAAoB,OAAO;AAAA,EACjC,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"useSize.js","sources":["../../src/__mocks__/useSize.ts"],"sourcesContent":["vi.mock('../hooks/useSize', () => ({\n useSize: vi.fn().mockReturnValue({\n height: 100,\n width: 100,\n top: 0,\n left: 0,\n right: 100,\n bottom: 100,\n }),\n}));\n\nexport {};\n"],"names":[],"mappings":"AAAA,GAAG,KAAK,oBAAoB,OAAO;AAAA,EACjC,SAAS,GAAG,GAAA,EAAK,gBAAgB;AAAA,IAC/B,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,EAAA,CACT;AACH,EAAE;"}
|
package/__mocks__/uuid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","sources":["../../src/__mocks__/uuid.ts"],"sourcesContent":["import * as uuidUtils from '../utils/uuid';\n\nconst testId = {\n id: 0,\n};\n\n/**\n * Returnerer en unik, forutsigbar id hver gang uuid() kalles\n */\nvi.spyOn(uuidUtils, 'uuid').mockImplementation(() => {\n testId.id++;\n return `testid-${testId.id}`;\n});\n"],"names":[],"mappings":";AAEA,MAAM,SAAS;AAAA,EACb,IAAI;AACN;AAKA,GAAG,MAAM,WAAW,MAAM,EAAE,mBAAmB,MAAM;
|
|
1
|
+
{"version":3,"file":"uuid.js","sources":["../../src/__mocks__/uuid.ts"],"sourcesContent":["import * as uuidUtils from '../utils/uuid';\n\nconst testId = {\n id: 0,\n};\n\n/**\n * Returnerer en unik, forutsigbar id hver gang uuid() kalles\n */\nvi.spyOn(uuidUtils, 'uuid').mockImplementation(() => {\n testId.id++;\n return `testid-${testId.id}`;\n});\n"],"names":[],"mappings":";AAEA,MAAM,SAAS;AAAA,EACb,IAAI;AACN;AAKA,GAAG,MAAM,WAAW,MAAM,EAAE,mBAAmB,MAAM;AACnD,SAAO;AACP,SAAO,UAAU,OAAO,EAAE;AAC5B,CAAC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export type AnchorLinkTargets = '_self' | '_blank' | '_parent';
|
|
3
3
|
export type AnchorLinkTags = 'a' | 'button';
|
|
4
|
-
export type AnchorLinkOnClickEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<
|
|
4
|
+
export type AnchorLinkOnClickEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<unknown> | React.KeyboardEvent<HTMLUListElement> | null;
|
|
5
5
|
export interface AnchorLinkProps {
|
|
6
6
|
/** Sets the content of the <a> tag */
|
|
7
7
|
children: React.ReactNode;
|
|
@@ -20,7 +20,7 @@ $focus-width: 0.15rem;
|
|
|
20
20
|
display: inline;
|
|
21
21
|
box-decoration-break: clone;
|
|
22
22
|
overflow-wrap: break-word;
|
|
23
|
-
word-break:
|
|
23
|
+
word-break: normal;
|
|
24
24
|
text-align: left;
|
|
25
25
|
color: var(--color-action-text-onlight);
|
|
26
26
|
border: $focus-width solid transparent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/ArticleTeaser/resourceHelper.ts","../../../src/components/ArticleTeaser/ArticleTeaser.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.ArticleTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.ArticleTeaser.nb-NO.json';\nimport { HNDesignsystemArticleTeaser } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemArticleTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { HNDesignsystemArticleTeaser } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\n\nimport styles from './styles.module.scss';\n\nexport type ArticleTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface ArticleTeaserProps {\n /** Callback for the button. Should be used for setting the expanded boolean */\n onExpand: () => void;\n /** What's in the box? */\n children: React.ReactNode;\n /** Id of the content, used to set aria-controls */\n contentId: string;\n /** If the component is expanded or not */\n expanded: boolean;\n /** For overriding the height of the collapsed teaser */\n heightCollapsed?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: ArticleTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemArticleTeaser>;\n /** Sets the data-testid attribute */\n testId?: string;\n}\n\nconst ArticleTeaser: React.FC<ArticleTeaserProps> = props => {\n const { onExpand, children, contentId, expanded, htmlMarkup = 'div', resources, testId } = props;\n const WrapperTag = htmlMarkup;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemArticleTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n return (\n <WrapperTag className={classNames(styles.articleteaser)} data-testid={testId} data-analyticsid={AnalyticsId.ArticleTeaser}>\n <div\n className={classNames(styles['articleteaser__content'], {\n [styles['articleteaser__content--collapsed']]: !expanded,\n })}\n style={{\n maxHeight: expanded ? 'none' : props.heightCollapsed,\n }}\n >\n {children}\n </div>\n <button\n type=\"button\"\n className={classNames(styles['articleteaser__button'], {\n [styles['articleteaser__button--expanded']]: expanded,\n })}\n onClick={onExpand}\n aria-expanded={expanded}\n aria-controls={contentId}\n >\n {expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default ArticleTeaser;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ArticleTeaser/resourceHelper.ts","../../../src/components/ArticleTeaser/ArticleTeaser.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.ArticleTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.ArticleTeaser.nb-NO.json';\nimport { HNDesignsystemArticleTeaser } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemArticleTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { HNDesignsystemArticleTeaser } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\n\nimport styles from './styles.module.scss';\n\nexport type ArticleTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface ArticleTeaserProps {\n /** Callback for the button. Should be used for setting the expanded boolean */\n onExpand: () => void;\n /** What's in the box? */\n children: React.ReactNode;\n /** Id of the content, used to set aria-controls */\n contentId: string;\n /** If the component is expanded or not */\n expanded: boolean;\n /** For overriding the height of the collapsed teaser */\n heightCollapsed?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: ArticleTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemArticleTeaser>;\n /** Sets the data-testid attribute */\n testId?: string;\n}\n\nconst ArticleTeaser: React.FC<ArticleTeaserProps> = props => {\n const { onExpand, children, contentId, expanded, htmlMarkup = 'div', resources, testId } = props;\n const WrapperTag = htmlMarkup;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemArticleTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n return (\n <WrapperTag className={classNames(styles.articleteaser)} data-testid={testId} data-analyticsid={AnalyticsId.ArticleTeaser}>\n <div\n className={classNames(styles['articleteaser__content'], {\n [styles['articleteaser__content--collapsed']]: !expanded,\n })}\n style={{\n maxHeight: expanded ? 'none' : props.heightCollapsed,\n }}\n >\n {children}\n </div>\n <button\n type=\"button\"\n className={classNames(styles['articleteaser__button'], {\n [styles['articleteaser__button--expanded']]: expanded,\n })}\n onClick={onExpand}\n aria-expanded={expanded}\n aria-controls={contentId}\n >\n {expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default ArticleTeaser;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAKO,MAAM,eAAe,CAAC,aAA2D;AACtF,UAAQ,UAAA;AAAA,IACN,KAAK,gBAAgB;AACnB,aAAO;AAAA,IACT,KAAK,gBAAgB;AAAA,IACrB;AACE,aAAO;AAAA,EAAA;AAEb;ACmBA,MAAM,gBAA8C,CAAA,UAAS;AAC3D,QAAM,EAAE,UAAU,UAAU,WAAW,UAAU,aAAa,OAAO,WAAW,OAAA,IAAW;AAC3F,QAAM,aAAa;AAEnB,QAAM,EAAE,SAAA,IAAa,YAA6B,gBAAgB,SAAS;AAC3E,QAAM,mBAAmB,aAAa,QAAQ;AAE9C,QAAM,kBAA+C;AAAA,IACnD,GAAG;AAAA,IACH,GAAG;AAAA,EAAA;AAGL,SACE,qBAAC,YAAA,EAAW,WAAW,WAAW,OAAO,aAAa,GAAG,eAAa,QAAQ,oBAAkB,YAAY,eAC1G,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,WAAW,OAAO,wBAAwB,GAAG;AAAA,UACtD,CAAC,OAAO,mCAAmC,CAAC,GAAG,CAAC;AAAA,QAAA,CACjD;AAAA,QACD,OAAO;AAAA,UACL,WAAW,WAAW,SAAS,MAAM;AAAA,QAAA;AAAA,QAGtC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,WAAW,WAAW,OAAO,uBAAuB,GAAG;AAAA,UACrD,CAAC,OAAO,iCAAiC,CAAC,GAAG;AAAA,QAAA,CAC9C;AAAA,QACD,SAAS;AAAA,QACT,iBAAe;AAAA,QACf,iBAAe;AAAA,QAEd,UAAA,WAAW,gBAAgB,mBAAmB,gBAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,EACjE,GACF;AAEJ;"}
|
|
@@ -33,7 +33,7 @@ export interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttri
|
|
|
33
33
|
/** Function that is called when the Button loses focus */
|
|
34
34
|
onBlur?: () => void;
|
|
35
35
|
/** Function that is called when clicked */
|
|
36
|
-
onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<
|
|
36
|
+
onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<unknown> | React.KeyboardEvent<HTMLUListElement> | null) => void;
|
|
37
37
|
/** Changes the button colors for different backgrounds. (Large not available in borderless variant) */
|
|
38
38
|
size?: ButtonSize;
|
|
39
39
|
/** Changes the visual representation of the button. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { palette, PaletteNames } from '../../theme/palette';\nimport Icon, { IconSize, SvgIcon } from '../Icon';\nimport Undo from '../Icons/Undo';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport enum ChipSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum ChipAction {\n remove = 'remove',\n undo = 'undo',\n}\n\nexport enum ChipVariant {\n normal = 'normal',\n oncolor = 'oncolor',\n emphasised = 'emphasised',\n}\n\nexport type ChipColors = Extract<PaletteNames, 'blueberry' | 'neutral' | 'cherry' | 'banana' | 'kiwi' | 'plum'>;\n\nexport interface ChipProps {\n /** Sets the text of the chip */\n children: string;\n /** Sets the size of the chip. Default: medium */\n size?: keyof typeof ChipSize;\n /** Sets the background of the chip. Not used if action is \"undo\". Default: blueberry */\n color?: ChipColors;\n /* Changes the appearance of the chip. Not used if action is \"undo\". Default: normal */\n variant?: keyof typeof ChipVariant;\n /* Makes the chip a clickable button that performs an action. onClick must also be set. */\n action: keyof typeof ChipAction;\n /* Called when action is set and the chip is clicked on. action must also be set. */\n onClick: () => void;\n /** Sets the data-testid attribute on the expander button. */\n testId?: string;\n}\n\nconst Chip: React.FC<ChipProps> = props => {\n const { children, size = ChipSize.medium, color = 'blueberry', variant = 'normal', action, onClick, testId } = props;\n\n const { hoverRef, isHovered } = useHover<HTMLButtonElement>();\n\n const chipClasses = cn(styles.chip, styles[`chip--${size}`], styles[`chip--${color}`], styles[`chip--${variant}`], {\n [styles[`chip--undo`]]: action === 'undo',\n });\n\n const getActionIcon = (): SvgIcon => {\n switch (action) {\n case 'undo':\n return Undo;\n case 'remove':\n return X;\n }\n };\n\n return (\n <button className={chipClasses} onClick={onClick} ref={hoverRef} type=\"button\" data-testid={testId} data-analyticsid={AnalyticsId.Tag}>\n {children}\n <Icon svgIcon={getActionIcon()} size={IconSize.XXSmall} color={palette[`${color}800`]} isHovered={isHovered} />\n </button>\n );\n};\n\nexport default Chip;\n"],"names":["ChipSize","ChipAction","ChipVariant","cn"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Chip/Chip.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { palette, PaletteNames } from '../../theme/palette';\nimport Icon, { IconSize, SvgIcon } from '../Icon';\nimport Undo from '../Icons/Undo';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport enum ChipSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum ChipAction {\n remove = 'remove',\n undo = 'undo',\n}\n\nexport enum ChipVariant {\n normal = 'normal',\n oncolor = 'oncolor',\n emphasised = 'emphasised',\n}\n\nexport type ChipColors = Extract<PaletteNames, 'blueberry' | 'neutral' | 'cherry' | 'banana' | 'kiwi' | 'plum'>;\n\nexport interface ChipProps {\n /** Sets the text of the chip */\n children: string;\n /** Sets the size of the chip. Default: medium */\n size?: keyof typeof ChipSize;\n /** Sets the background of the chip. Not used if action is \"undo\". Default: blueberry */\n color?: ChipColors;\n /* Changes the appearance of the chip. Not used if action is \"undo\". Default: normal */\n variant?: keyof typeof ChipVariant;\n /* Makes the chip a clickable button that performs an action. onClick must also be set. */\n action: keyof typeof ChipAction;\n /* Called when action is set and the chip is clicked on. action must also be set. */\n onClick: () => void;\n /** Sets the data-testid attribute on the expander button. */\n testId?: string;\n}\n\nconst Chip: React.FC<ChipProps> = props => {\n const { children, size = ChipSize.medium, color = 'blueberry', variant = 'normal', action, onClick, testId } = props;\n\n const { hoverRef, isHovered } = useHover<HTMLButtonElement>();\n\n const chipClasses = cn(styles.chip, styles[`chip--${size}`], styles[`chip--${color}`], styles[`chip--${variant}`], {\n [styles[`chip--undo`]]: action === 'undo',\n });\n\n const getActionIcon = (): SvgIcon => {\n switch (action) {\n case 'undo':\n return Undo;\n case 'remove':\n return X;\n }\n };\n\n return (\n <button className={chipClasses} onClick={onClick} ref={hoverRef} type=\"button\" data-testid={testId} data-analyticsid={AnalyticsId.Tag}>\n {children}\n <Icon svgIcon={getActionIcon()} size={IconSize.XXSmall} color={palette[`${color}800`]} isHovered={isHovered} />\n </button>\n );\n};\n\nexport default Chip;\n"],"names":["Ch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
|
10
10
|
// Inspired by: https://css-tricks.com/books/greatest-css-tricks/scroll-shadows/
|
|
11
11
|
background:
|
|
12
|
-
linear-gradient(white 30%,
|
|
13
|
-
linear-gradient(
|
|
14
|
-
linear-gradient(
|
|
15
|
-
linear-gradient(
|
|
12
|
+
linear-gradient(white 30%, rgb(255 255 255 / 0%)) center top,
|
|
13
|
+
linear-gradient(rgb(255 255 255 / 0%), white 70%) center bottom,
|
|
14
|
+
linear-gradient(rgb(0 0 0 / 46%), rgb(0 0 0 / 0%)) center top,
|
|
15
|
+
linear-gradient(rgb(0 0 0 / 0%), rgb(0 0 0 / 46%)) center bottom;
|
|
16
16
|
background-repeat: no-repeat;
|
|
17
17
|
background-size:
|
|
18
18
|
100% 40px,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useRef,
|
|
2
|
+
import React__default, { useRef, useId, useEffect } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { theme } from "../../theme/index.js";
|
|
5
5
|
import "../../hooks/useBreakpoint.js";
|
|
@@ -7,16 +7,12 @@ import { useHover } from "../../hooks/useHover.js";
|
|
|
7
7
|
import { useToggle } from "../../hooks/useToggle.js";
|
|
8
8
|
import { useKeyboardEvent } from "../../hooks/useKeyboardEvent.js";
|
|
9
9
|
import { useOutsideEvent } from "../../hooks/useOutsideEvent.js";
|
|
10
|
-
import { useUuid } from "../../hooks/useUuid.js";
|
|
11
10
|
import { LanguageLocales, ZIndex, KeyboardEventKey, AnalyticsId, IconSize } from "../../constants.js";
|
|
12
|
-
import { isComponent } from "../../utils/component.js";
|
|
13
11
|
import { useLanguage } from "../../utils/language.js";
|
|
14
12
|
import { mergeRefs } from "../../utils/refs.js";
|
|
15
13
|
import { B as Button } from "../../Button.js";
|
|
16
|
-
import { C as Checkbox } from "../../Checkbox.js";
|
|
17
14
|
import { I as Icon } from "../../Icon.js";
|
|
18
15
|
import PlusSmall from "../Icons/PlusSmall.js";
|
|
19
|
-
import { R as RadioButton } from "../../RadioButton.js";
|
|
20
16
|
import styles from "./styles.module.scss";
|
|
21
17
|
const closeText$1 = "Close";
|
|
22
18
|
const enGB = {
|
|
@@ -65,10 +61,10 @@ const Dropdown = (props) => {
|
|
|
65
61
|
const openedByKeyboard = useRef(false);
|
|
66
62
|
const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);
|
|
67
63
|
const inputRefList = useRef(React__default.Children.map(children, () => React__default.createRef()));
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
64
|
+
const labelId = useId();
|
|
65
|
+
const toggleLabelId = useId();
|
|
66
|
+
const optionIdPrefix = useId();
|
|
67
|
+
const contentId = useId();
|
|
72
68
|
const { language } = useLanguage(LanguageLocales.NORWEGIAN);
|
|
73
69
|
const defaultResources = getResources(language);
|
|
74
70
|
const mergedResources = {
|
|
@@ -86,14 +82,11 @@ const Dropdown = (props) => {
|
|
|
86
82
|
(_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
87
83
|
};
|
|
88
84
|
useEffect(() => {
|
|
89
|
-
var _a, _b
|
|
85
|
+
var _a, _b;
|
|
90
86
|
if (isOpen && openedByKeyboard.current) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
})) == null ? void 0 : _b.current) == null ? void 0 : _c.focus();
|
|
87
|
+
const firstEnabled = (_a = inputRefList.current) == null ? void 0 : _a.find((r) => r.current && !r.current.hasAttribute("disabled"));
|
|
88
|
+
(_b = firstEnabled == null ? void 0 : firstEnabled.current) == null ? void 0 : _b.focus();
|
|
89
|
+
openedByKeyboard.current = false;
|
|
97
90
|
}
|
|
98
91
|
}, [isOpen]);
|
|
99
92
|
const handleKeyboardNavigation = (event) => {
|
|
@@ -126,7 +119,6 @@ const Dropdown = (props) => {
|
|
|
126
119
|
if (nextIndex !== -1 && event.key !== KeyboardEventKey.Space) {
|
|
127
120
|
event.preventDefault();
|
|
128
121
|
(_a = inputRefList.current[nextIndex].current) == null ? void 0 : _a.focus();
|
|
129
|
-
setCurrentIndex(nextIndex);
|
|
130
122
|
}
|
|
131
123
|
};
|
|
132
124
|
useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [
|
|
@@ -153,8 +145,9 @@ const Dropdown = (props) => {
|
|
|
153
145
|
);
|
|
154
146
|
const contentClasses = classNames(styles.dropdown__content, isOpen && styles["dropdown__content--open"]);
|
|
155
147
|
const renderChildren = React__default.Children.map(children, (child, index) => {
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
return /* @__PURE__ */ jsx("li", { className: styles.dropdown__input, id: `${optionIdPrefix}-${index}`, children: React__default.isValidElement(child) && inputRefList.current && inputRefList.current[index] ? React__default.cloneElement(child, {
|
|
149
|
+
ref: mergeRefs([child.props.ref, inputRefList.current[index]])
|
|
150
|
+
}) : child });
|
|
158
151
|
});
|
|
159
152
|
return /* @__PURE__ */ jsxs("div", { className: styles.dropdown, ref: dropdownRef, children: [
|
|
160
153
|
/* @__PURE__ */ jsx("span", { id: labelId, className: styles.dropdown__label, children: label }),
|
|
@@ -169,7 +162,8 @@ const Dropdown = (props) => {
|
|
|
169
162
|
"data-analyticsid": AnalyticsId.Dropdown,
|
|
170
163
|
disabled,
|
|
171
164
|
"aria-labelledby": toggleLabelId,
|
|
172
|
-
"aria-haspopup":
|
|
165
|
+
"aria-haspopup": true,
|
|
166
|
+
"aria-controls": contentId,
|
|
173
167
|
"aria-expanded": isOpen,
|
|
174
168
|
children: [
|
|
175
169
|
/* @__PURE__ */ jsx("span", { id: toggleLabelId, className: styles.dropdown__toggle__label, children: placeholder }),
|
|
@@ -186,21 +180,18 @@ const Dropdown = (props) => {
|
|
|
186
180
|
]
|
|
187
181
|
}
|
|
188
182
|
),
|
|
189
|
-
/* @__PURE__ */ jsxs(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
tabIndex: -1,
|
|
197
|
-
"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
),
|
|
202
|
-
!noCloseButton && /* @__PURE__ */ jsx("div", { className: styles.dropdown__close, children: /* @__PURE__ */ jsx(Button, { onClick: handleClose, "aria-expanded": isOpen, children: mergedResources.closeText }) })
|
|
203
|
-
] })
|
|
183
|
+
/* @__PURE__ */ jsxs(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
id: contentId,
|
|
187
|
+
className: contentClasses,
|
|
188
|
+
style: { width: fluid ? "100%" : `auto`, minWidth: dropdownMinWidth ?? "auto", zIndex },
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsx("ul", { className: styles.dropdown__options, role: "group", "aria-labelledby": labelId, tabIndex: -1, ref: optionsRef, children: renderChildren }),
|
|
191
|
+
!noCloseButton && /* @__PURE__ */ jsx("div", { className: styles.dropdown__close, children: /* @__PURE__ */ jsx(Button, { onClick: handleClose, children: mergedResources.closeText }) })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
)
|
|
204
195
|
] });
|
|
205
196
|
};
|
|
206
197
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Dropdown/resourceHelper.ts","../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Dropdown.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Dropdown.nb-NO.json';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDropdown => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n LanguageLocales,\n ZIndex,\n theme,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n useUuid,\n} from '../..';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\nimport { isComponent } from '../../utils/component';\nimport { useLanguage } from '../../utils/language';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Checkbox, { CheckboxProps } from '../Checkbox';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\nimport RadioButton, { RadioButtonProps } from '../RadioButton';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** @deprecated Close button text */\n closeText?: string;\n /** Minimum width for the dropdown in pixels. Does not affect trigger button */\n dropdownMinWidth?: number;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n onColor?: keyof typeof DropdownOnColor;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDropdown>;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n noCloseButton = false,\n onToggle,\n dropdownMinWidth,\n open = false,\n children,\n onColor = DropdownOnColor.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n resources,\n } = props;\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const openedByKeyboard = useRef<boolean>(false);\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const [currentIndex, setCurrentIndex] = useState<number>();\n const labelId = useUuid();\n const toggleLabelId = useUuid();\n const optionIdPrefix = useUuid();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDropdown = {\n ...defaultResources,\n ...resources,\n closeText: props.closeText ?? resources?.closeText ?? defaultResources.closeText,\n };\n\n const handleOpen = (isKeyboard: boolean): void => {\n openedByKeyboard.current = isKeyboard;\n toggleIsOpen();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n useEffect(() => {\n if (isOpen && openedByKeyboard.current) {\n inputRefList.current\n ?.find((inputRef, index) => {\n if (inputRef.current && !inputRef.current.hasAttribute('disabled')) {\n setCurrentIndex(index);\n return true;\n }\n })\n ?.current?.focus();\n }\n }, [isOpen]);\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (!inputRefList.current) {\n return;\n }\n\n if (event.key === KeyboardEventKey.Escape) {\n if (isOpen) handleClose();\n return;\n }\n\n if (!isOpen) {\n handleOpen(true);\n event.preventDefault();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n\n if (nextIndex !== -1 && event.key !== KeyboardEventKey.Space) {\n event.preventDefault();\n\n inputRefList.current[nextIndex].current?.focus();\n setCurrentIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n KeyboardEventKey.Space,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: onColor === DropdownOnColor.onwhite,\n [styles['dropdown__toggle--on-grey']]: onColor === DropdownOnColor.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: onColor === DropdownOnColor.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: onColor === DropdownOnColor.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => {\n const role = isComponent<RadioButtonProps>(child, RadioButton)\n ? 'menuitemradio'\n : isComponent<CheckboxProps>(child, Checkbox)\n ? 'menuitemcheckbox'\n : 'menuitem';\n\n return (\n <li className={styles.dropdown__input} role={role} id={`${optionIdPrefix}-${index}`}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, { ref: mergeRefs([child.props.ref, inputRefList.current[index]]) })\n : child}\n </li>\n );\n });\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => handleOpen(false)}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup=\"menu\"\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div className={contentClasses} style={{ width: fluid ? '100%' : `auto`, minWidth: dropdownMinWidth ?? 'auto', zIndex: zIndex }}>\n <ul\n className={styles.dropdown__options}\n role=\"menu\"\n aria-labelledby={labelId}\n tabIndex={-1}\n aria-activedescendant={typeof currentIndex !== 'undefined' ? `${optionIdPrefix}-${currentIndex}` : undefined}\n ref={optionsRef}\n >\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose} aria-expanded={isOpen}>\n {mergedResources.closeText}\n </Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownOnColor","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKa,MAAA,eAAe,CAAC,aAAsD;AACjF,UAAQ,UAAU;AAAA,IAChB,KAAK,gBAAgB;AACZ,aAAA;AAAA,IACT,KAAK,gBAAgB;AAAA,IACrB;AACS,aAAA;AAAA,EAAA;AAEb;ACiBY,IAAA,oCAAAA,qBAAL;AACLA,mBAAA,SAAU,IAAA;AACVA,mBAAA,QAAS,IAAA;AACTA,mBAAA,aAAc,IAAA;AACdA,mBAAA,UAAW,IAAA;AAJDA,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAwCZ,MAAM,WAAoC,CAAS,UAAA;AAC3C,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,UAAU;AAAA,IACV,cAAc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AC;AAAA,YAAA;AAAA,cACC,OAAO,WAAW,MAAM,QAAQ,aAAa,MAAM,QAAQ;AAAA,cAC3D,SAAS;AAAA,cACT,WAAW,OAAO;AAAA,cAClB,WAAW,CAAC,YAAY;AAAA,cACxB,MAAM,SAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IACF;AAAA,IACC,qBAAA,OAAA,EAAI,WAAW,gBAAgB,OAAO,EAAE,OAAO,QAAQ,SAAS,QAAQ,UAAU,oBAAoB,QAAQ,OAC7G,GAAA,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,OAAO;AAAA,UAClB,MAAK;AAAA,UACL,mBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,yBAAuB,OAAO,iBAAiB,cAAc,GAAG,cAAc,IAAI,YAAY,KAAK;AAAA,UACnG,KAAK;AAAA,UAEJ,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,MACC,CAAC,iBACC,oBAAA,OAAA,EAAI,WAAW,OAAO,iBACrB,UAAC,oBAAA,QAAA,EAAO,SAAS,aAAa,iBAAe,QAC1C,UAAA,gBAAgB,WACnB,EACF,CAAA;AAAA,IAAA,EAEJ,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Dropdown/resourceHelper.ts","../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Dropdown.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Dropdown.nb-NO.json';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDropdown => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React, { useEffect, useRef, useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n LanguageLocales,\n ZIndex,\n theme,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n} from '../..';\nimport { getResources } from './resourceHelper';\nimport { HNDesignsystemDropdown } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** @deprecated Close button text */\n closeText?: string;\n /** Minimum width for the dropdown in pixels. Does not affect trigger button */\n dropdownMinWidth?: number;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n onColor?: keyof typeof DropdownOnColor;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDropdown>;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n noCloseButton = false,\n onToggle,\n dropdownMinWidth,\n open = false,\n children,\n onColor = DropdownOnColor.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n resources,\n } = props;\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const openedByKeyboard = useRef<boolean>(false);\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const labelId = useId();\n const toggleLabelId = useId();\n const optionIdPrefix = useId();\n const contentId = useId();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDropdown = {\n ...defaultResources,\n ...resources,\n closeText: props.closeText ?? resources?.closeText ?? defaultResources.closeText,\n };\n\n const handleOpen = (isKeyboard: boolean): void => {\n openedByKeyboard.current = isKeyboard;\n toggleIsOpen();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n useEffect(() => {\n if (isOpen && openedByKeyboard.current) {\n const firstEnabled = inputRefList.current?.find(r => r.current && !r.current.hasAttribute('disabled'));\n firstEnabled?.current?.focus();\n openedByKeyboard.current = false;\n }\n }, [isOpen]);\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (!inputRefList.current) {\n return;\n }\n\n if (event.key === KeyboardEventKey.Escape) {\n if (isOpen) handleClose();\n return;\n }\n\n if (!isOpen) {\n handleOpen(true);\n event.preventDefault();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n\n if (nextIndex !== -1 && event.key !== KeyboardEventKey.Space) {\n event.preventDefault();\n\n inputRefList.current[nextIndex].current?.focus();\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n KeyboardEventKey.Space,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: onColor === DropdownOnColor.onwhite,\n [styles['dropdown__toggle--on-grey']]: onColor === DropdownOnColor.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: onColor === DropdownOnColor.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: onColor === DropdownOnColor.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => {\n return (\n <li className={styles.dropdown__input} id={`${optionIdPrefix}-${index}`}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, {\n ref: mergeRefs([child.props.ref, inputRefList.current[index]]),\n })\n : child}\n </li>\n );\n });\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => handleOpen(false)}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup={true}\n aria-controls={contentId}\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div\n id={contentId}\n className={contentClasses}\n style={{ width: fluid ? '100%' : `auto`, minWidth: dropdownMinWidth ?? 'auto', zIndex: zIndex }}\n >\n <ul className={styles.dropdown__options} role=\"group\" aria-labelledby={labelId} tabIndex={-1} ref={optionsRef}>\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose}>{mergedResources.closeText}</Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownOnColor","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,eAAe,CAAC,aAAsD;AACjF,UAAQ,UAAA;AAAA,IACN,KAAK,gBAAgB;AACnB,aAAO;AAAA,IACT,KAAK,gBAAgB;AAAA,IACrB;AACE,aAAO;AAAA,EAAA;AAEb;ACaO,IAAK,oCAAAA,qBAAL;AACLA,mBAAA,SAAA,IAAU;AACVA,mBAAA,QAAA,IAAS;AACTA,mBAAA,aAAA,IAAc;AACdA,mBAAA,UAAA,IAAW;AAJD,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;AAwCZ,MAAM,WAAoC,CAAA,UAAS;AACjD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,IACd,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,SAAS,OAAO;AAAA,IAChB;AAAA,EAAA,IACE;AAEJ,QAAM,cAAc,OAAuB,IAAI;AAC/C,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,EAAE,UAAU,WAAW,UAAA,IAAc,SAAA;AAC3C,QAAM,mBAAmB,OAAgB,KAAK;AAC9C,QAAM,EAAE,OAAO,QAAQ,aAAa,iBAAiB,UAAU,CAAC,YAAY,MAAM,QAAQ;AAC1F,QAAM,eAAe,OA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U,IAAI,KAAK,YAChG,UAAA,gBACH;AAAA,UACC,CAAC,iBACA,oBAAC,OAAA,EAAI,WAAW,OAAO,iBACrB,UAAA,oBAAC,QAAA,EAAO,SAAS,aAAc,UAAA,gBAAgB,WAAU,EAAA,CAC3D;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;"}
|
|
@@ -5,7 +5,7 @@ import { BadgeProps, BadgeType } from '../Badge';
|
|
|
5
5
|
import { SvgIcon } from '../Icon';
|
|
6
6
|
import { StatusDotProps, StatusDotType } from '../StatusDot';
|
|
7
7
|
import { TitleTags } from '../Title';
|
|
8
|
-
import {
|
|
8
|
+
import { StatusDotListProps, StatusDotListType } from './StatusDotList/StatusDotList';
|
|
9
9
|
export type ElementHeaderSize = 'small' | 'medium' | 'large';
|
|
10
10
|
export type ParentType = 'linklist' | 'expanderlist';
|
|
11
11
|
export interface ElementHeaderType extends React.FC<ElementHeaderProps> {
|
|
@@ -13,7 +13,7 @@ export interface ElementHeaderType extends React.FC<ElementHeaderProps> {
|
|
|
13
13
|
Badge?: BadgeType;
|
|
14
14
|
ElementHeaderText?: ElementHeaderTextType;
|
|
15
15
|
StatusDot?: StatusDotType;
|
|
16
|
-
|
|
16
|
+
StatusDotList?: StatusDotListType;
|
|
17
17
|
}
|
|
18
18
|
export declare const renderElementHeader: (element: React.ReactNode, options: Pick<ElementHeaderProps, "titleHtmlMarkup" | "isHovered" | "size" | "parentType" | "chevronIcon" | "icon" | "highlightText">) => React.ReactElement | undefined;
|
|
19
19
|
export interface ElementHeaderProps {
|
|
@@ -43,7 +43,7 @@ interface ElementHeaderChildren {
|
|
|
43
43
|
elementHeaderTextChildren: React.ReactElement<ElementHeaderTextProps>[];
|
|
44
44
|
badgeChildren?: React.ReactElement<BadgeProps>[];
|
|
45
45
|
statusDotChildren?: React.ReactElement<StatusDotProps>[];
|
|
46
|
-
statusDotMCChild?: React.ReactElement<
|
|
46
|
+
statusDotMCChild?: React.ReactElement<StatusDotListProps>;
|
|
47
47
|
elementChild?: React.ReactElement;
|
|
48
48
|
stringChildren: string[];
|
|
49
49
|
remainingChildren: React.ReactNode[];
|
|
@@ -53,7 +53,7 @@ export declare const mapChildren: ChildrenMapper;
|
|
|
53
53
|
export declare const ElementHeaderRoot: ElementHeaderType;
|
|
54
54
|
type ElementHeaderComponent = typeof ElementHeaderRoot & {
|
|
55
55
|
Text: React.FC<ElementHeaderTextProps>;
|
|
56
|
-
|
|
56
|
+
StatusDotList: React.FC<StatusDotListProps>;
|
|
57
57
|
};
|
|
58
58
|
declare const ElementHeader: ElementHeaderComponent;
|
|
59
59
|
export default ElementHeader;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { StatusDotProps } from '../../StatusDot';
|
|
3
|
-
export type
|
|
4
|
-
export interface
|
|
3
|
+
export type StatusDotListType = React.FC<StatusDotListProps>;
|
|
4
|
+
export interface StatusDotListProps {
|
|
5
5
|
/** Additional text to the bottom statusdot */
|
|
6
6
|
additionalText?: string;
|
|
7
7
|
/** StatusDot that is under the others and outside the stacking */
|
|
@@ -19,5 +19,5 @@ export interface StatusDotMultiCompositionProps {
|
|
|
19
19
|
/** StatusDot that is over the others and outside the stacking */
|
|
20
20
|
topStatusDot?: React.ReactElement<StatusDotProps>;
|
|
21
21
|
}
|
|
22
|
-
export declare const
|
|
23
|
-
export default
|
|
22
|
+
export declare const StatusDotList: StatusDotListType;
|
|
23
|
+
export default StatusDotList;
|