@helsenorge/designsystem-react 1.0.0-beta103 → 1.0.0-beta107
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/Button-7e82091f.js +2 -0
- package/Button-7e82091f.js.map +1 -0
- package/CHANGELOG.md +52 -52
- package/Checkbox-f2418dc5.js +2 -0
- package/Checkbox-f2418dc5.js.map +1 -0
- package/Close-d81081c8.js +2 -0
- package/Close-d81081c8.js.map +1 -0
- package/FormGroup-af33981a.js +2 -0
- package/FormGroup-af33981a.js.map +1 -0
- package/Input-31d7accc.js +2 -0
- package/Input-31d7accc.js.map +1 -0
- package/{Loader-fa16a352.js → Loader-bc13d060.js} +2 -2
- package/Loader-bc13d060.js.map +1 -0
- package/Modal-ff546be0.js +2 -0
- package/Modal-ff546be0.js.map +1 -0
- package/README.md +69 -69
- package/{RadioButton-fe4bbd36.js → RadioButton-c173d440.js} +2 -2
- package/RadioButton-c173d440.js.map +1 -0
- package/{Textarea-e1d1144c.js → Textarea-78e20c9a.js} +2 -2
- package/Textarea-78e20c9a.js.map +1 -0
- package/{Title-af53f589.js → Title-9df559dd.js} +2 -2
- package/Title-9df559dd.js.map +1 -0
- package/{Validation-fd3f7f58.js → Validation-4041c083.js} +2 -2
- package/Validation-4041c083.js.map +1 -0
- package/components/AnchorLink/AnchorLink.d.ts +18 -18
- package/components/AnchorLink/index.d.ts +3 -3
- package/components/AnchorLink/index.js +1 -1
- package/components/AnchorLink/styles.module.scss +63 -63
- package/components/AnchorLink/styles.module.scss.d.ts +10 -10
- package/components/Avatar/Avatar.d.ts +15 -15
- package/components/Avatar/index.d.ts +3 -3
- package/components/Avatar/index.js +1 -1
- package/components/Avatar/styles.module.scss +22 -22
- package/components/Avatar/styles.module.scss.d.ts +11 -11
- package/components/Badge/Badge.d.ts +16 -16
- package/components/Badge/index.d.ts +3 -3
- package/components/Badge/index.js +1 -1
- package/components/Badge/styles.module.scss +41 -41
- package/components/Badge/styles.module.scss.d.ts +17 -17
- package/components/Button/Button.d.ts +41 -39
- package/components/Button/Button.d.ts.map +1 -1
- package/components/Button/componentdata.json +19 -0
- package/components/Button/index.d.ts +3 -3
- package/components/Button/index.js +1 -1
- package/components/Button/styles.module.scss +434 -434
- package/components/Button/styles.module.scss.d.ts +34 -34
- package/components/ButtonWithModal/ButtonWithModal.d.ts +10 -10
- package/components/ButtonWithModal/index.d.ts +3 -3
- package/components/ButtonWithModal/index.js +1 -1
- package/components/Checkbox/Checkbox.d.ts +30 -30
- package/components/Checkbox/index.d.ts +3 -3
- package/components/Checkbox/index.js +1 -1
- package/components/Checkbox/styles.module.scss +204 -204
- package/components/Checkbox/styles.module.scss.d.ts +26 -26
- package/components/Close/Close.d.ts +11 -11
- package/components/Close/index.d.ts +3 -3
- package/components/Close/index.js +1 -1
- package/components/Close/styles.module.scss +32 -32
- package/components/Close/styles.module.scss.d.ts +9 -9
- package/components/Expander/Expander.d.ts +32 -32
- package/components/Expander/Expander.d.ts.map +1 -1
- package/components/Expander/index.d.ts +3 -3
- package/components/Expander/index.js +1 -1
- package/components/Expander/styles.module.scss +165 -165
- package/components/Expander/styles.module.scss.d.ts +42 -42
- package/components/ExpanderList/ExpanderList.d.ts +47 -45
- package/components/ExpanderList/ExpanderList.d.ts.map +1 -1
- package/components/ExpanderList/index.d.ts +3 -3
- package/components/ExpanderList/index.js +1 -1
- package/components/ExpanderList/styles.module.scss +160 -155
- package/components/ExpanderList/styles.module.scss.d.ts +28 -27
- package/components/FormExample/FormExample.d.ts +15 -15
- package/components/FormExample/index.d.ts +3 -3
- package/components/FormExample/index.js +1 -1
- package/components/FormExample/index.js.map +1 -1
- package/components/FormGroup/FormGroup.d.ts +24 -24
- package/components/FormGroup/index.d.ts +3 -3
- package/components/FormGroup/index.js +1 -1
- package/components/FormGroup/styles.module.scss +67 -67
- package/components/FormGroup/styles.module.scss.d.ts +16 -16
- package/components/HighlightBox/HighlightBox.d.ts +26 -23
- package/components/HighlightBox/HighlightBox.d.ts.map +1 -1
- package/components/HighlightBox/componentdata.json +19 -0
- package/components/HighlightBox/index.d.ts +3 -3
- package/components/HighlightBox/index.js +1 -1
- package/components/HighlightBox/styles.module.scss +174 -89
- package/components/Icons/ActiveMonitoring.d.ts +4 -4
- package/components/Icons/AcupunctureBack.d.ts +4 -4
- package/components/Icons/AcupunctureBack.js +1 -1
- package/components/Icons/AdditionalIconInformation.js +263 -263
- package/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/components/Icons/AlarmClock.d.ts +4 -4
- package/components/Icons/AlertSignFill.d.ts +4 -4
- package/components/Icons/AlertSignStroke.d.ts +4 -4
- package/components/Icons/Amputation.d.ts +4 -4
- package/components/Icons/Anxiety.d.ts +4 -4
- package/components/Icons/Apple.d.ts +4 -4
- package/components/Icons/Archive.d.ts +4 -4
- package/components/Icons/ArmFlexing.d.ts +4 -4
- package/components/Icons/ArrowLeft.d.ts +4 -4
- package/components/Icons/ArrowRight.d.ts +4 -4
- package/components/Icons/ArrowUpRight.d.ts +4 -4
- package/components/Icons/Attachment.d.ts +4 -4
- package/components/Icons/Atv.d.ts +4 -4
- package/components/Icons/Avatar.d.ts +4 -4
- package/components/Icons/AwakePersonOnPillow.d.ts +4 -4
- package/components/Icons/Baby.d.ts +4 -4
- package/components/Icons/BandAid.d.ts +4 -4
- package/components/Icons/BeerAndPills.d.ts +4 -4
- package/components/Icons/Bell.d.ts +4 -4
- package/components/Icons/Bike.d.ts +4 -4
- package/components/Icons/BirthControl.d.ts +4 -4
- package/components/Icons/BirthdayCake.d.ts +4 -4
- package/components/Icons/Boat.d.ts +4 -4
- package/components/Icons/Body.d.ts +4 -4
- package/components/Icons/Brain.d.ts +4 -4
- package/components/Icons/BreastReconstruction.d.ts +4 -4
- package/components/Icons/BreastRemoval.d.ts +4 -4
- package/components/Icons/Breasts.d.ts +4 -4
- package/components/Icons/BrokenHeart.d.ts +4 -4
- package/components/Icons/BrokenPuzzle.d.ts +4 -4
- package/components/Icons/Bus.d.ts +4 -4
- package/components/Icons/Calendar.d.ts +4 -4
- package/components/Icons/CalendarChange.d.ts +4 -4
- package/components/Icons/CalendarCheck.d.ts +4 -4
- package/components/Icons/CalendarEvent.d.ts +4 -4
- package/components/Icons/CalendarSave.d.ts +4 -4
- package/components/Icons/Cancer.d.ts +4 -4
- package/components/Icons/Car.d.ts +4 -4
- package/components/Icons/Change.d.ts +4 -4
- package/components/Icons/Check.d.ts +4 -4
- package/components/Icons/CheckOutline.d.ts +4 -4
- package/components/Icons/Chest.d.ts +4 -4
- package/components/Icons/ChevronDown.d.ts +4 -4
- package/components/Icons/ChevronLeft.d.ts +4 -4
- package/components/Icons/ChevronRight.d.ts +4 -4
- package/components/Icons/ChevronUp.d.ts +4 -4
- package/components/Icons/ChevronsDown.d.ts +4 -4
- package/components/Icons/ChevronsUp.d.ts +4 -4
- package/components/Icons/ChildPlaying.d.ts +4 -4
- package/components/Icons/Cigarette.d.ts +4 -4
- package/components/Icons/Contacts.d.ts +4 -4
- package/components/Icons/Copy.d.ts +4 -4
- package/components/Icons/CoronaCertificate.d.ts +4 -4
- package/components/Icons/Coronavirus.d.ts +4 -4
- package/components/Icons/Cough.d.ts +4 -4
- package/components/Icons/CriticalHealthInfo.d.ts +4 -4
- package/components/Icons/Cross.d.ts +4 -4
- package/components/Icons/DataExchange.d.ts +4 -4
- package/components/Icons/DataReceived.d.ts +4 -4
- package/components/Icons/DataSent.d.ts +4 -4
- package/components/Icons/Depression.d.ts +4 -4
- package/components/Icons/DigestiveSystem.d.ts +4 -4
- package/components/Icons/Dizzy.d.ts +4 -4
- package/components/Icons/Documents.d.ts +4 -4
- package/components/Icons/Dog.d.ts +4 -4
- package/components/Icons/DonorCard.d.ts +4 -4
- package/components/Icons/Download.d.ts +4 -4
- package/components/Icons/Draft.d.ts +4 -4
- package/components/Icons/EChat.d.ts +4 -4
- package/components/Icons/EarNoseThroat.d.ts +4 -4
- package/components/Icons/ElderlyPerson.d.ts +4 -4
- package/components/Icons/Embolization.d.ts +4 -4
- package/components/Icons/EnterFullScreen.d.ts +4 -4
- package/components/Icons/Envelope.d.ts +4 -4
- package/components/Icons/Epilepsy.d.ts +4 -4
- package/components/Icons/Eraser.d.ts +4 -4
- package/components/Icons/ErrorSignFill.d.ts +4 -4
- package/components/Icons/ErrorSignStroke.d.ts +4 -4
- package/components/Icons/EuropeanHealthCard.d.ts +4 -4
- package/components/Icons/ExitFullScreen.d.ts +4 -4
- package/components/Icons/Eye.d.ts +4 -4
- package/components/Icons/Facebook.d.ts +4 -4
- package/components/Icons/Female.d.ts +4 -4
- package/components/Icons/FemaleDoctor.d.ts +4 -4
- package/components/Icons/Ferry.d.ts +4 -4
- package/components/Icons/FingerBleed.d.ts +4 -4
- package/components/Icons/FirstAidKit.d.ts +4 -4
- package/components/Icons/FloppyDisk.d.ts +4 -4
- package/components/Icons/Football.d.ts +4 -4
- package/components/Icons/Form.d.ts +4 -4
- package/components/Icons/Forward.d.ts +4 -4
- package/components/Icons/Gallery.d.ts +4 -4
- package/components/Icons/Garden.d.ts +4 -4
- package/components/Icons/GasCan.d.ts +4 -4
- package/components/Icons/GenderIdentity.d.ts +4 -4
- package/components/Icons/Globe.d.ts +4 -4
- package/components/Icons/HandWaving.d.ts +4 -4
- package/components/Icons/HandWithDisease.d.ts +4 -4
- package/components/Icons/HealthClinic.d.ts +4 -4
- package/components/Icons/HealthWarning.d.ts +4 -4
- package/components/Icons/Heart.d.ts +4 -4
- package/components/Icons/HelpSign.d.ts +4 -4
- package/components/Icons/HelpingHand.d.ts +4 -4
- package/components/Icons/Hemodialysis.d.ts +4 -4
- package/components/Icons/Hiker.d.ts +4 -4
- package/components/Icons/Hipprosthesis.d.ts +4 -4
- package/components/Icons/History.d.ts +4 -4
- package/components/Icons/HivAndAids.d.ts +4 -4
- package/components/Icons/Home.d.ts +4 -4
- package/components/Icons/Hormone.d.ts +4 -4
- package/components/Icons/Hospital.d.ts +4 -4
- package/components/Icons/Hourglass.d.ts +4 -4
- package/components/Icons/Icon.d.ts +22 -22
- package/components/Icons/Icon.js +1 -1
- package/components/Icons/ImgFile.d.ts +4 -4
- package/components/Icons/Inbox.d.ts +4 -4
- package/components/Icons/InfoSignFill.d.ts +4 -4
- package/components/Icons/InfoSignStroke.d.ts +4 -4
- package/components/Icons/Instagram.d.ts +4 -4
- package/components/Icons/Intravenous.d.ts +4 -4
- package/components/Icons/JointPain.d.ts +4 -4
- package/components/Icons/Journal.d.ts +4 -4
- package/components/Icons/JpgFile.d.ts +4 -4
- package/components/Icons/Kidney.d.ts +4 -4
- package/components/Icons/KitchenScale.d.ts +4 -4
- package/components/Icons/Kjernejournal.d.ts +4 -4
- package/components/Icons/Laboratory.d.ts +4 -4
- package/components/Icons/LaptopBlog.d.ts +4 -4
- package/components/Icons/LawBook.d.ts +4 -4
- package/components/Icons/LightBulb.d.ts +4 -4
- package/components/Icons/List.d.ts +4 -4
- package/components/Icons/Location.d.ts +4 -4
- package/components/Icons/Lock.d.ts +4 -4
- package/components/Icons/Lungs.d.ts +4 -4
- package/components/Icons/Makeup.d.ts +4 -4
- package/components/Icons/MaleDoctor.d.ts +4 -4
- package/components/Icons/MaleDoctorAndPerson.d.ts +4 -4
- package/components/Icons/MaleGenitalia.d.ts +4 -4
- package/components/Icons/Medicine.d.ts +4 -4
- package/components/Icons/MedicineWarning.d.ts +4 -4
- package/components/Icons/MentalHealthAdult.d.ts +4 -4
- package/components/Icons/MentalHealthChild.d.ts +4 -4
- package/components/Icons/Menu.d.ts +4 -4
- package/components/Icons/Microscope.d.ts +4 -4
- package/components/Icons/Minus.d.ts +4 -4
- package/components/Icons/Mirror.d.ts +4 -4
- package/components/Icons/MobilePhone.d.ts +4 -4
- package/components/Icons/MotherHoldingBaby.d.ts +4 -4
- package/components/Icons/MuscleBack.d.ts +4 -4
- package/components/Icons/MuscleLeg.d.ts +4 -4
- package/components/Icons/Mushroom.d.ts +4 -4
- package/components/Icons/Music.d.ts +4 -4
- package/components/Icons/MusselsAndSalt.d.ts +4 -4
- package/components/Icons/NoEye.d.ts +4 -4
- package/components/Icons/NoEye.js +1 -1
- package/components/Icons/NoFilter.d.ts +4 -4
- package/components/Icons/Notepad.d.ts +4 -4
- package/components/Icons/Osteotomy.d.ts +4 -4
- package/components/Icons/PaintRoller.d.ts +4 -4
- package/components/Icons/PaperPlane.d.ts +4 -4
- package/components/Icons/PatientAndPerson.d.ts +4 -4
- package/components/Icons/Pause.d.ts +4 -4
- package/components/Icons/PdfFile.d.ts +4 -4
- package/components/Icons/Pencil.d.ts +4 -4
- package/components/Icons/PeopleTalking.d.ts +4 -4
- package/components/Icons/Peritonealdialysis.d.ts +4 -4
- package/components/Icons/Person.d.ts +4 -4
- package/components/Icons/PersonAndPatient.d.ts +4 -4
- package/components/Icons/PersonInXRayMachine.d.ts +4 -4
- package/components/Icons/PersonOverweight.d.ts +4 -4
- package/components/Icons/PersonRelaxing.d.ts +4 -4
- package/components/Icons/PersonWithBrain.d.ts +4 -4
- package/components/Icons/PersonWithBrokenArm.d.ts +4 -4
- package/components/Icons/PersonWithCrutches.d.ts +4 -4
- package/components/Icons/PersonWithJaw.d.ts +4 -4
- package/components/Icons/PersonWithMagnifyingGlass.d.ts +4 -4
- package/components/Icons/PersonWithSenses.d.ts +4 -4
- package/components/Icons/PersonWorking.d.ts +4 -4
- package/components/Icons/PizzaSlice.d.ts +4 -4
- package/components/Icons/Plane.d.ts +4 -4
- package/components/Icons/Plant.d.ts +4 -4
- package/components/Icons/Play.d.ts +4 -4
- package/components/Icons/PlusLarge.d.ts +4 -4
- package/components/Icons/PlusSmall.d.ts +4 -4
- package/components/Icons/PngFile.d.ts +4 -4
- package/components/Icons/Podcast.d.ts +4 -4
- package/components/Icons/PoisonInformation.d.ts +4 -4
- package/components/Icons/Pregnant.d.ts +4 -4
- package/components/Icons/Printer.d.ts +4 -4
- package/components/Icons/Psychosis.d.ts +4 -4
- package/components/Icons/Publication.d.ts +4 -4
- package/components/Icons/Puzzle.d.ts +4 -4
- package/components/Icons/QrCode.d.ts +4 -4
- package/components/Icons/Quarrel.d.ts +4 -4
- package/components/Icons/RadioTherapy.d.ts +4 -4
- package/components/Icons/RadioactiveTreatment.d.ts +4 -4
- package/components/Icons/Radioiodine.d.ts +4 -4
- package/components/Icons/Receipt.d.ts +4 -4
- package/components/Icons/Receptionist.d.ts +4 -4
- package/components/Icons/Recovery.d.ts +4 -4
- package/components/Icons/Referral.d.ts +4 -4
- package/components/Icons/Refresh.d.ts +4 -4
- package/components/Icons/Refund.d.ts +4 -4
- package/components/Icons/Reply.d.ts +4 -4
- package/components/Icons/Rocket.d.ts +4 -4
- package/components/Icons/RtfFile.d.ts +4 -4
- package/components/Icons/STDs.d.ts +4 -4
- package/components/Icons/Save.d.ts +4 -4
- package/components/Icons/Scale.d.ts +4 -4
- package/components/Icons/Search.d.ts +4 -4
- package/components/Icons/SectionSign.d.ts +4 -4
- package/components/Icons/SectionSign.js +1 -1
- package/components/Icons/Settings.d.ts +4 -4
- package/components/Icons/Sexualorientation.d.ts +4 -4
- package/components/Icons/ShakingHand.d.ts +4 -4
- package/components/Icons/Share.d.ts +4 -4
- package/components/Icons/Shield.d.ts +4 -4
- package/components/Icons/ShuntOperation.d.ts +4 -4
- package/components/Icons/Skeleton.d.ts +4 -4
- package/components/Icons/Skin.d.ts +4 -4
- package/components/Icons/Snake.d.ts +4 -4
- package/components/Icons/Snapchat.d.ts +4 -4
- package/components/Icons/SpeechBubble.d.ts +4 -4
- package/components/Icons/SpeechBubble.js +1 -1
- package/components/Icons/Spray.d.ts +4 -4
- package/components/Icons/Stopwatch.d.ts +4 -4
- package/components/Icons/SupportingPerson.d.ts +4 -4
- package/components/Icons/SupportingPerson.js +1 -1
- package/components/Icons/Surgery.d.ts +4 -4
- package/components/Icons/Syringe.d.ts +4 -4
- package/components/Icons/Syringe.js +1 -1
- package/components/Icons/Taxi.d.ts +4 -4
- package/components/Icons/TeddyBear.d.ts +4 -4
- package/components/Icons/Teenagers.d.ts +4 -4
- package/components/Icons/ThinkingAboutBaby.d.ts +4 -4
- package/components/Icons/Ticket.d.ts +4 -4
- package/components/Icons/TimePassing.d.ts +4 -4
- package/components/Icons/Toolbox.d.ts +4 -4
- package/components/Icons/Tooth.d.ts +4 -4
- package/components/Icons/TotalKneeProsthesis.d.ts +4 -4
- package/components/Icons/Train.d.ts +4 -4
- package/components/Icons/Transplantation.d.ts +4 -4
- package/components/Icons/TrashCan.d.ts +4 -4
- package/components/Icons/Twitter.d.ts +4 -4
- package/components/Icons/Undo.d.ts +4 -4
- package/components/Icons/UniProsthesis.d.ts +4 -4
- package/components/Icons/Upload.d.ts +4 -4
- package/components/Icons/UserOrganization.d.ts +4 -4
- package/components/Icons/Vaccine.d.ts +4 -4
- package/components/Icons/VerticalDots.d.ts +4 -4
- package/components/Icons/VideoCamera.d.ts +4 -4
- package/components/Icons/VideoChat.d.ts +4 -4
- package/components/Icons/Wallet.d.ts +4 -4
- package/components/Icons/Watch.d.ts +4 -4
- package/components/Icons/Website.d.ts +4 -4
- package/components/Icons/Wheelchair.d.ts +4 -4
- package/components/Icons/WheelchairActive.d.ts +4 -4
- package/components/Icons/Window.d.ts +4 -4
- package/components/Icons/WordDocument.d.ts +4 -4
- package/components/Icons/WorkSuitcase.d.ts +4 -4
- package/components/Icons/X.d.ts +4 -4
- package/components/Icons/XOutline.d.ts +4 -4
- package/components/Icons/XmlFile.d.ts +4 -4
- package/components/Icons/YouTube.d.ts +4 -4
- package/components/Icons/Zoom.d.ts +4 -4
- package/components/Icons/index.d.ts +4 -4
- package/components/Icons/index.js +1 -1
- package/components/Input/Input.d.ts +54 -54
- package/components/Input/index.d.ts +3 -3
- package/components/Input/index.js +1 -1
- package/components/Input/styles.module.scss +59 -59
- package/components/Input/styles.module.scss.d.ts +23 -23
- package/components/LinkList/LinkList.d.ts +41 -41
- package/components/LinkList/index.d.ts +3 -3
- package/components/LinkList/index.js +1 -1
- package/components/LinkList/styles.module.scss +147 -147
- package/components/LinkList/styles.module.scss.d.ts +26 -26
- package/components/List/List.d.ts +9 -9
- package/components/List/index.d.ts +3 -3
- package/components/List/index.js +1 -1
- package/components/List/styles.module.scss +11 -11
- package/components/List/styles.module.scss.d.ts +10 -10
- package/components/Loader/Loader.d.ts +32 -32
- package/components/Loader/index.d.ts +3 -3
- package/components/Loader/index.js +1 -1
- package/components/Loader/styles.module.scss +194 -194
- package/components/Logo/Logo.d.ts +17 -17
- package/components/Logo/index.d.ts +3 -3
- package/components/Logo/index.js +1 -1
- package/components/Modal/Modal.d.ts +69 -69
- package/components/Modal/__mocks__/IntersectionObserver.d.ts +5 -5
- package/components/Modal/index.d.ts +3 -3
- package/components/Modal/index.js +1 -1
- package/components/Modal/styles.module.scss +243 -243
- package/components/Modal/styles.module.scss.d.ts +41 -41
- package/components/NotificationPanel/NotificationPanel.d.ts +47 -47
- package/components/NotificationPanel/NotificationPanel.d.ts.map +1 -1
- package/components/NotificationPanel/componentdata.json +1 -1
- package/components/NotificationPanel/index.d.ts +3 -3
- package/components/NotificationPanel/index.js +1 -1
- package/components/NotificationPanel/styles.module.scss +153 -138
- package/components/NotificationPanel/styles.module.scss.d.ts +33 -34
- package/components/Portal/index.d.ts +12 -12
- package/components/Portal/index.js +1 -1
- package/components/RadioButton/RadioButton.d.ts +30 -30
- package/components/RadioButton/index.d.ts +3 -3
- package/components/RadioButton/index.js +1 -1
- package/components/RadioButton/styles.module.scss +236 -236
- package/components/RadioButton/styles.module.scss.d.ts +23 -23
- package/components/Slider/Slider.d.ts +19 -19
- package/components/Slider/SliderUtils.d.ts +40 -40
- package/components/Slider/index.d.ts +3 -3
- package/components/Slider/index.js +1 -1
- package/components/Slider/styles.module.scss +85 -85
- package/components/Slider/styles.module.scss.d.ts +19 -19
- package/components/Spacer/Spacer.d.ts +12 -12
- package/components/Spacer/index.d.ts +3 -3
- package/components/Spacer/index.js +1 -1
- package/components/Spacer/styles.module.scss +47 -47
- package/components/Spacer/styles.module.scss.d.ts +22 -22
- package/components/Textarea/Textarea.d.ts +36 -36
- package/components/Textarea/index.d.ts +3 -3
- package/components/Textarea/index.js +1 -1
- package/components/Textarea/styles.module.scss +57 -57
- package/components/Textarea/styles.module.scss.d.ts +26 -26
- package/components/Tile/Tile.d.ts +33 -33
- package/components/Tile/index.d.ts +3 -3
- package/components/Tile/index.js +1 -1
- package/components/Tile/styles.module.scss +115 -115
- package/components/Tile/styles.module.scss.d.ts +18 -18
- package/components/Title/Title.d.ts +25 -25
- package/components/Title/index.d.ts +3 -3
- package/components/Title/index.js +1 -1
- package/components/Title/styles.module.scss +27 -27
- package/components/Title/styles.module.scss.d.ts +15 -15
- package/components/Validation/Validation.d.ts +16 -16
- package/components/Validation/index.d.ts +3 -3
- package/components/Validation/index.js +1 -1
- package/components/Validation/styles.module.scss +18 -18
- package/components/Validation/styles.module.scss.d.ts +10 -10
- package/constants-eb74321e.js +2 -0
- package/constants-eb74321e.js.map +1 -0
- package/constants.d.ts +91 -90
- package/constants.d.ts.map +1 -1
- package/hooks/focus-utils.d.ts +6 -6
- package/hooks/useBreakpoint.d.ts +12 -12
- package/hooks/useFocusToggle.d.ts +13 -13
- package/hooks/useFocusTrap.d.ts +3 -3
- package/hooks/useHover.d.ts +11 -11
- package/hooks/useIcons.d.ts +3 -3
- package/hooks/useIntersectionObserver.d.ts +10 -10
- package/hooks/useIsVisible.d.ts +9 -9
- package/hooks/useLayoutEvent.d.ts +8 -8
- package/hooks/usePrevious.d.ts +7 -0
- package/hooks/usePrevious.d.ts.map +1 -0
- package/hooks/useSize.d.ts +9 -0
- package/hooks/useSize.d.ts.map +1 -0
- package/hooks/useSticky.d.ts +20 -20
- package/hooks/useWindowSize.d.ts +4 -4
- package/index.d.ts +13 -11
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +2 -6
- package/scss/_body.scss +11 -11
- package/scss/_breakpoints.scss +16 -16
- package/scss/_font-settings.scss +8 -8
- package/scss/_fonts.scss +112 -112
- package/scss/_grid.scss +1 -1
- package/scss/_input.scss +176 -175
- package/scss/_palette.scss +136 -136
- package/scss/_print.scss +176 -176
- package/scss/_reset.scss +13 -13
- package/scss/_spacers.scss +40 -40
- package/scss/_title.scss +59 -59
- package/scss/helsenorge.scss +8 -8
- package/scss/typography.module.scss +154 -154
- package/theme/currys/color.d.ts +3 -3
- package/theme/currys/index.d.ts +2 -2
- package/theme/currys/spacing.d.ts +3 -3
- package/theme/grid.d.ts +20 -20
- package/theme/index.d.ts +98 -98
- package/theme/palette.d.ts +67 -67
- package/theme/spacers.d.ts +18 -18
- package/usePrevious-ae293b10.js +2 -0
- package/usePrevious-ae293b10.js.map +1 -0
- package/useSticky-d61d1f0b.js +2 -0
- package/useSticky-d61d1f0b.js.map +1 -0
- package/utils/debounce.d.ts +7 -7
- package/utils/uuid.d.ts +2 -2
- package/utils/viewport.d.ts +1 -1
- package/AlertSignFill-e607ff43.js +0 -2
- package/AlertSignFill-e607ff43.js.map +0 -1
- package/Button-d5147e38.js +0 -2
- package/Button-d5147e38.js.map +0 -1
- package/Check-6291ad09.js +0 -2
- package/Check-6291ad09.js.map +0 -1
- package/Checkbox-798282e4.js +0 -2
- package/Checkbox-798282e4.js.map +0 -1
- package/ChevronUp-4b6797ef.js +0 -2
- package/ChevronUp-4b6797ef.js.map +0 -1
- package/Close-35ad7d35.js +0 -2
- package/Close-35ad7d35.js.map +0 -1
- package/FormGroup-0577b07f.js +0 -2
- package/FormGroup-0577b07f.js.map +0 -1
- package/Icon-89da8de4.js +0 -2
- package/Icon-89da8de4.js.map +0 -1
- package/Input-19650c24.js +0 -2
- package/Input-19650c24.js.map +0 -1
- package/Loader-fa16a352.js.map +0 -1
- package/Modal-ad02991b.js +0 -2
- package/Modal-ad02991b.js.map +0 -1
- package/RadioButton-fe4bbd36.js.map +0 -1
- package/Textarea-e1d1144c.js.map +0 -1
- package/Title-af53f589.js.map +0 -1
- package/Validation-fd3f7f58.js.map +0 -1
- package/constants-ad6c82db.js +0 -2
- package/constants-ad6c82db.js.map +0 -1
- package/useSticky-194f2b78.js +0 -2
- package/useSticky-194f2b78.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r,{createContext as e,useCallback as t,useRef as n,useState as i,useEffect as a,useMemo as u,isValidElement as o}from"react";import{V as s}from"../../Validation-fd3f7f58.js";import{F as c}from"../../FormGroup-0577b07f.js";import{C as l}from"../../Checkbox-798282e4.js";import{B as f}from"../../Button-d5147e38.js";import{R as v}from"../../RadioButton-fe4bbd36.js";import{T as d}from"../../Textarea-e1d1144c.js";import{I as m}from"../../Input-19650c24.js";import"../../index-9b84fabc.js";import"../Validation/styles.module.scss";import"../../constants-ad6c82db.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"../FormGroup/styles.module.scss";import"../../Title-af53f589.js";import"../Title/styles.module.scss";import"../../uuid-fe7442b7.js";import"../../Check-6291ad09.js";import"../../Icon-89da8de4.js";import"../../_tslib-51c8a283.js";import"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../Checkbox/styles.module.scss";import"../../Loader-fa16a352.js";import"../Loader/styles.module.scss";import"../../useHover-9710204a.js";import"../../useWindowSize-750f9b68.js";import"../Button/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../../useBreakpoint-552af2b9.js";import"../Input/styles.module.scss";var h=function(r){return r instanceof HTMLElement},g="blur",p="change",b="input",y="onBlur",V="onChange",O="onSubmit",j="onTouched",k="all",E="max",A="min",x="maxLength",S="minLength",z="pattern",w="required",D="validate";var F=function(r){return null==r},R=function(r){return"object"==typeof r},C=function(r){return!F(r)&&!Array.isArray(r)&&R(r)&&!(r instanceof Date)},H=function(r){return/^\w*$/.test(r)},N=function(r){return r.filter(Boolean)},B=function(r){return N(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function I(r,e,t){for(var n=-1,i=H(e)?[e]:B(e),a=i.length,u=a-1;++n<a;){var o=i[n],s=t;if(n!==u){var c=r[o];s=C(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}r[o]=s,r=r[o]}return r}var L=function(r,e){for(var t in void 0===e&&(e={}),r)H(t)?e[t]=r[t]:I(e,t,r[t]);return e},M=function(r){return void 0===r},T=function(r,e,t){void 0===r&&(r={});var n=N(e.split(/[,[\].]+?/)).reduce((function(r,e){return F(r)?r:r[e]}),r);return M(n)||n===r?M(r[e])?t:r[e]:n},q=function(r,e){h(r)&&r.removeEventListener&&(r.removeEventListener(b,e),r.removeEventListener(p,e),r.removeEventListener(g,e))},W={isValid:!1,value:null},_=function(r){return Array.isArray(r)?r.reduce((function(r,e){return e&&e.ref.checked?{isValid:!0,value:e.ref.value}:r}),W):W},P=function(r){return"radio"===r.type},U=function(r){return"file"===r.type},$=function(r){return"checkbox"===r.type},G=function(r){return"select-multiple"===r.type},J={value:!1,isValid:!1},K={value:!0,isValid:!0},Q=function(r){if(Array.isArray(r)){if(r.length>1){var e=r.filter((function(r){return r&&r.ref.checked})).map((function(r){return r.ref.value}));return{value:e,isValid:!!e.length}}var t=r[0].ref,n=t.checked,i=t.value,a=t.attributes;return n?a&&!M(a.value)?M(i)||""===i?K:{value:i,isValid:!0}:K:J}return J};function X(r,e,t,n,i){var a,u=r.current[e];if(u){var o=u.ref,s=o.value,c=o.disabled,l=u.ref,f=u.valueAsNumber,v=u.valueAsDate,d=u.setValueAs;if(c&&n)return;return U(l)?l.files:P(l)?_(u.options).value:G(l)?(a=l.options,[].concat(a).filter((function(r){return r.selected})).map((function(r){return r.value}))):$(l)?Q(u.options).value:i?s:f?""===s?NaN:+s:v?l.valueAsDate:d?d(s):s}if(t)return T(t.current,e)}function Y(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&Y(r.parentNode)}var Z=function(r){return C(r)&&!Object.keys(r).length},rr=function(r){return"boolean"==typeof r};function er(r,e){var t,n=H(e)?[e]:B(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=M(r)?n++:r[e[n++]];return r}(r,n),a=n[n.length-1];i&&delete i[a];for(var u=0;u<n.slice(0,-1).length;u++){var o=-1,s=void 0,c=n.slice(0,-(u+1)),l=c.length-1;for(u>0&&(t=r);++o<c.length;){var f=c[o];s=s?s[f]:r[f],l===o&&(C(s)&&Z(s)||Array.isArray(s)&&!s.filter((function(r){return C(r)&&!Z(r)||rr(r)})).length)&&(t?delete t[f]:delete r[f]),t=s}}return r}var tr=function(r,e){return r&&r.ref===e};var nr=function(r){return F(r)||!R(r)};function ir(r,e){if(nr(r)||nr(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=C(n)&&C(i)||Array.isArray(n)&&Array.isArray(i)?ir(n,i):i}catch(r){}}return r}function ar(r,e,t){if(nr(r)||nr(e)||r instanceof Date||e instanceof Date)return r===e;if(!o(r)){var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var a=0,u=n;a<u.length;a+=1){var s=u[a],c=r[s];if(!t||"ref"!==s){var l=e[s];if((C(c)||Array.isArray(c))&&(C(l)||Array.isArray(l))?!ar(c,l,t):c!==l)return!1}}}return!0}function ur(r,e,t,n,i){for(var a,u=-1;++u<r.length;){for(var o in r[u])Array.isArray(r[u][o])?(!t[u]&&(t[u]={}),t[u][o]=[],ur(r[u][o],T(e[u]||{},o,[]),t[u][o],t[u],o)):ar(T(e[u]||{},o),r[u][o])?I(t[u]||{},o):t[u]=Object.assign(Object.assign({},t[u]),((a={})[o]=!0,a));n&&!t.length&&delete n[i]}return t}var or=function(r){return"string"==typeof r},sr=function(r,e,t,n,i){var a={},u=function(e){(M(i)||(or(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(a[e]=X(r,e,void 0,n))};for(var o in r.current)u(o);return t?L(a):ir(e,L(a))},cr=function(r){return r instanceof RegExp},lr=function(r){return C(r)&&!cr(r)?r:{value:r,message:""}},fr=function(r){return"function"==typeof r},vr=function(r){return or(r)||o(r)};function dr(r,e,t){if(void 0===t&&(t="validate"),vr(r)||rr(r)&&!r)return{type:t,message:vr(r)?r:"",ref:e}}var mr=function(r,e,t,n,i){var a;return e?Object.assign(Object.assign({},t[r]),{types:Object.assign(Object.assign({},t[r]&&t[r].types?t[r].types:{}),(a={},a[n]=i||!0,a))}):{}},hr=async function(r,e,t,n){var i=t.ref,a=t.ref.value,u=t.options,o=t.required,s=t.maxLength,c=t.minLength,l=t.min,f=t.max,v=t.pattern,d=t.validate,m=i.name,h={},g=P(i),p=$(i),b=g||p,y=""===a,V=mr.bind(null,m,e,h),O=function(r,e,t,n,a){void 0===n&&(n=x),void 0===a&&(a=S);var u=r?e:t;h[m]=Object.assign({type:r?n:a,message:u,ref:i},V(r?n:a,u))};if(o&&(!g&&!p&&(y||F(a))||rr(a)&&!a||p&&!Q(u).isValid||g&&!_(u).isValid)){var j=vr(o)?{value:!!o,message:o}:lr(o),k=j.value,R=j.message;if(k&&(h[m]=Object.assign({type:w,message:R,ref:b?((r.current[m].options||[])[0]||{}).ref:i},V(w,R)),!e))return h}if(!(F(l)&&F(f)||""===a)){var H,N,B=lr(f),I=lr(l);if(isNaN(a)){var L=i.valueAsDate||new Date(a);or(B.value)&&(H=L>new Date(B.value)),or(I.value)&&(N=L<new Date(I.value))}else{var M=i.valueAsNumber||parseFloat(a);F(B.value)||(H=M>B.value),F(I.value)||(N=M<I.value)}if((H||N)&&(O(!!H,B.message,I.message,E,A),!e))return h}if(or(a)&&!y&&(s||c)){var T=lr(s),q=lr(c),W=!F(T.value)&&a.length>T.value,U=!F(q.value)&&a.length<q.value;if((W||U)&&(O(W,T.message,q.message),!e))return h}if(or(a)&&v&&!y){var G=lr(v),J=G.value,K=G.message;if(cr(J)&&!J.test(a)&&(h[m]=Object.assign({type:z,message:K,ref:i},V(z,K)),!e))return h}if(d){var Y=X(r,m,n,!1,!0),er=b&&u?u[0].ref:i;if(fr(d)){var tr=dr(await d(Y),er);if(tr&&(h[m]=Object.assign(Object.assign({},tr),V(D,tr.message)),!e))return h}else if(C(d)){for(var nr={},ir=0,ar=Object.entries(d);ir<ar.length;ir+=1){var ur=ar[ir],sr=ur[0],hr=ur[1];if(!Z(nr)&&!e)break;var gr=dr(await hr(Y),er,sr);gr&&(nr=Object.assign(Object.assign({},gr),V(sr,gr.message)),e&&(h[m]=nr))}if(!Z(nr)&&(h[m]=Object.assign({ref:er},nr),!e))return h}}return h},gr=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(C(e)?"."+n:"["+n+"]");nr(e[n])?t.push(i):gr(i,e[n],t)}return t},pr=function(r,e,t,n,i){var a=void 0;return t.add(e),Z(r)||(a=T(r,e),(C(a)||Array.isArray(a))&&gr(e,a).forEach((function(r){return t.add(r)}))),M(a)?i?n:T(n,e):a},br=function(r){return r.substring(0,r.indexOf("["))},yr=function(r,e){return[].concat(r).some((function(r){return function(r,e){return RegExp(("^"+e+"([|.)\\d+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r)}(e,r)}))};var Vr="undefined"!=typeof window&&"undefined"!=typeof document;function Or(r){var e,t;if(nr(r)||Vr&&(r instanceof File||h(r)))return r;if(!["Set","Map","Object","Date","Array"].includes(null===(e=r.constructor)||void 0===e?void 0:e.name))return r;if(r instanceof Date)return t=new Date(r.getTime());if(r instanceof Set){t=new Set;for(var n=0,i=r;n<i.length;n+=1){var a=i[n];t.add(a)}return t}if(r instanceof Map){t=new Map;for(var u=0,o=r.keys();u<o.length;u+=1){var s=o[u];t.set(s,Or(r.get(s)))}return t}for(var c in t=Array.isArray(r)?[]:{},r)t[c]=Or(r[c]);return t}var jr=function(r){return{isOnSubmit:!r||r===O,isOnBlur:r===y,isOnChange:r===V,isOnAll:r===k,isOnTouch:r===j}},kr=function(r){return P(r)||$(r)},Er="undefined"==typeof window,Ar=Vr?"Proxy"in window:"undefined"!=typeof Proxy;function xr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=O);var o=r.reValidateMode;void 0===o&&(o=V);var s=r.resolver,c=r.context,l=r.defaultValues;void 0===l&&(l={});var f=r.shouldFocusError;void 0===f&&(f=!0);var v=r.shouldUnregister;void 0===v&&(v=!0);var d=r.criteriaMode,m=n({}),y=n({}),j=n({}),E=n(new Set),A=n({}),x=n({}),S=n({}),z=n({}),w=n(l),D=n(!1),R=n(!1),B=n(),W=n({}),_=n({}),J=n(c),K=n(s),Q=n(new Set),rr=n(jr(e)),cr=rr.current,lr=cr.isOnSubmit,vr=cr.isOnTouch,dr=d===k,mr=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!lr,errors:{}}),xr=mr[0],Sr=mr[1],zr=n({isDirty:!Ar,dirtyFields:!Ar,touched:!Ar||vr,isValidating:!Ar,isSubmitting:!Ar,isValid:!Ar}),wr=n(xr),Dr=n(),Fr=n(jr(o)).current,Rr=Fr.isOnBlur,Cr=Fr.isOnChange;J.current=c,K.current=s,wr.current=xr,W.current=v?{}:Z(W.current)?Or(l):W.current;var Hr=t((function(r){void 0===r&&(r={}),D.current||(wr.current=Object.assign(Object.assign({},wr.current),r),Sr(wr.current))}),[]),Nr=function(){return zr.current.isValidating&&Hr({isValidating:!0})},Br=t((function(r,e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n={});var a=t||function(r){var e=r.errors,t=r.name,n=r.error,i=r.validFields,a=r.fieldsWithValidation,u=M(n),o=T(e,t);return u&&!!o||!u&&!ar(o,n,!0)||u&&T(a,t)&&!T(i,t)}({errors:wr.current.errors,error:e,name:r,validFields:z.current,fieldsWithValidation:S.current}),u=T(wr.current.errors,r);e?(er(z.current,r),a=a||!u||!ar(u,e,!0),I(wr.current.errors,r,e)):((T(S.current,r)||K.current)&&(I(z.current,r,!0),a=a||u),er(wr.current.errors,r)),(a&&!F(t)||!Z(n)||zr.current.isValidating)&&Hr(Object.assign(Object.assign(Object.assign({},n),K.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Ir=t((function(r,e){var t=m.current[r],n=t.ref,i=t.options,a=Vr&&h(n)&&F(e)?"":e;P(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===a})):U(n)&&!or(a)?n.files=a:G(n)?[].concat(n.options).forEach((function(r){return r.selected=a.includes(r.value)})):$(n)&&i?i.length>1?i.forEach((function(r){var e=r.ref;return e.checked=Array.isArray(a)?!!a.find((function(r){return r===e.value})):a===e.value})):i[0].ref.checked=!!a:n.value=a}),[]),Lr=t((function(r,e){if(zr.current.isDirty){var t=Jr();return r&&e&&I(t,r,e),!ar(t,w.current)}return!1}),[]),Mr=t((function(r,e){if(void 0===e&&(e=!0),zr.current.isDirty||zr.current.dirtyFields){var t=!ar(T(w.current,r),X(m,r,W)),n=T(wr.current.dirtyFields,r),i=wr.current.isDirty;t?I(wr.current.dirtyFields,r,!0):er(wr.current.dirtyFields,r);var a={isDirty:Lr(),dirtyFields:wr.current.dirtyFields},u=zr.current.isDirty&&i!==a.isDirty||zr.current.dirtyFields&&n!==T(wr.current.dirtyFields,r);return u&&e&&Hr(a),u?a:{}}return{}}),[]),Tr=t((async function(r,e){if("production"!==process.env.NODE_ENV&&!m.current[r])return console.warn("📋 Field is missing with `name` attribute: ",r),!1;var t=(await hr(m,dr,m.current[r],W))[r];return Br(r,t,e),M(t)}),[Br,dr]),qr=t((async function(r){var e=(await K.current(Jr(),J.current,dr)).errors,t=wr.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=T(e,r);return t?I(wr.current.errors,r,t):er(wr.current.errors,r),!t})).every(Boolean);return Hr({isValid:Z(e),isValidating:!1}),n}var i=T(e,r);return Br(r,i,t!==Z(e),{},Z(e)),!i}),[Br,dr]),Wr=t((async function(r){var e=r||Object.keys(m.current);if(Nr(),K.current)return qr(e);if(Array.isArray(e)){!r&&(wr.current.errors={});var t=await Promise.all(e.map((async function(r){return await Tr(r,null)})));return Hr({isValidating:!1}),t.every(Boolean)}return await Tr(e)}),[qr,Tr]),_r=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,a={};I(a,r,e);for(var u=0,o=gr(r,e);u<o.length;u+=1){var s=o[u];m.current[s]&&(Ir(s,T(a,s)),n&&Mr(s),i&&Wr(s))}}),[Wr,Ir,Mr]),Pr=t((function(r,e,t){var n,i;if(!v&&!nr(e)&&I(W.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),m.current[r])Ir(r,e),t.shouldDirty&&Mr(r),t.shouldValidate&&Wr(r);else if(!nr(e)&&(_r(r,e,t),Q.current.has(r))){var a=br(r)||r;I(y.current,r,e),_.current[a](((n={})[a]=T(y.current,a),n)),(zr.current.isDirty||zr.current.dirtyFields)&&t.shouldDirty&&(I(wr.current.dirtyFields,r,function(r,e,t){return ir(ur(r,e,t.slice(0,r.length)),ur(e,r,t.slice(0,r.length)))}(e,T(w.current,r,[]),T(wr.current.dirtyFields,r,[]))),Hr({isDirty:!ar(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),w.current)}))}!v&&I(W.current,r,e)}),[Mr,Ir,_r]),Ur=function(r){return R.current||E.current.has(r)||E.current.has((r.match(/\w+/)||[])[0])},$r=function(r){var e=!0;if(!Z(A.current))for(var t in A.current)r&&A.current[t].size&&!A.current[t].has(r)&&!A.current[t].has(br(r))||(x.current[t](),e=!1);return e};function Gr(r){var e;if(!v){for(var t=Or(r),n=0,i=Q.current;n<i.length;n+=1){var a=i[n];H(a)&&!t[a]&&(t=Object.assign(Object.assign({},t),((e={})[a]=[],e)))}return t}return r}function Jr(r){if(or(r))return X(m,r,W);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];I(e,i,X(m,i,W))}return e}return Gr(sr(m,Or(W.current),v))}B.current=B.current?B.current:async function(r){var e,t,n=r.type,i=r.target,a=i.name,u=m.current[a];if(u){var o=n===g,s=function(r){var e=r.isOnBlur,t=r.isOnChange,n=r.isOnTouch,i=r.isTouched,a=r.isReValidateOnBlur,u=r.isReValidateOnChange,o=r.isBlurEvent,s=r.isSubmitted;return!r.isOnAll&&(!s&&n?!(i||o):(s?a:e)?!o:!(s?u:t)||o)}(Object.assign({isBlurEvent:o,isReValidateOnChange:Cr,isReValidateOnBlur:Rr,isTouched:!!T(wr.current.touched,a),isSubmitted:wr.current.isSubmitted},rr.current)),c=Mr(a,!1),l=!Z(c)||!o&&Ur(a);if(o&&!T(wr.current.touched,a)&&zr.current.touched&&(I(wr.current.touched,a,!0),c=Object.assign(Object.assign({},c),{touched:wr.current.touched})),!v&&$(i)&&I(W.current,a,X(m,a)),s)return!o&&$r(a),(!Z(c)||l&&Z(c))&&Hr(c);if(Nr(),K.current){var f=(await K.current(Jr(),J.current,dr)).errors,d=wr.current.isValid;if(e=T(f,a),$(i)&&!e&&K.current){var h=br(a),p=T(f,h,{});p.type&&p.message&&(e=p),h&&(p||T(wr.current.errors,h))&&(a=h)}d!==(t=Z(f))&&(l=!0)}else e=(await hr(m,dr,u,W))[a];!o&&$r(a),Br(a,e,l,c,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=Z(m.current)?w.current:{},t=(await K.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),J.current,dr)||{}).errors,n=Z(t);wr.current.isValid!==n&&Hr({isValid:n})}),[dr]),Qr=t((function(r,e){!function(r,e,t,n,i,a){var u=t.ref,o=t.ref.name,s=r.current[o];if(!i){var c=X(r,o,n);!M(c)&&I(n.current,o,c)}u.type&&s?P(u)||$(u)?Array.isArray(s.options)&&s.options.length?(N(s.options).forEach((function(r,t){void 0===r&&(r={}),(Y(r.ref)&&tr(r,r.ref)||a)&&(q(r.ref,e),er(s.options,"["+t+"]"))})),s.options&&!N(s.options).length&&delete r.current[o]):delete r.current[o]:(Y(u)&&tr(s,u)||a)&&(q(u,e),delete r.current[o]):delete r.current[o]}(m,B.current,r,W,v,e),v&&(er(z.current,r.ref.name),er(S.current,r.ref.name))}),[v]),Xr=t((function(r){if(R.current)Hr();else{for(var e=0,t=E.current;e<t.length;e+=1){if(t[e].startsWith(r)){Hr();break}}$r(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),v&&!N(r.options||[]).length&&(er(wr.current.errors,r.ref.name),I(wr.current.dirtyFields,r.ref.name,!0),Hr({isDirty:Lr()}),zr.current.isValid&&K.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?A.current[t]:E.current,i=sr(m,Or(W.current),v,!1,r);if(or(r)){var a=br(r)||r;return Q.current.has(a)&&(i=Object.assign(Object.assign({},j.current),i)),pr(i,r,n,M(T(w.current,r))?e:T(w.current,r),!0)}var u=M(e)?w.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=pr(i,e,n,u),t))}),{}):(R.current=M(t),L(!Z(i)&&i||u))}),[]);function re(r,e){if(void 0===e&&(e={}),"production"!==process.env.NODE_ENV){if(!r.name)return console.warn("📋 Field is missing `name` attribute",r,"https://react-hook-form.com/api#useForm");if(Q.current.has(r.name.split(/\[\d+\]$/)[0])&&!RegExp(("^"+r.name.split(/\[\d+\]$/)[0]+"[\\d+].\\w+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r.name))return console.warn('📋 `name` prop should be in object shape: name="test[index].name"',r,"https://react-hook-form.com/api#useFieldArray")}var t,n=r.name,i=r.type,a=r.value,u=Object.assign({ref:r},e),o=m.current,s=kr(r),c=yr(Q.current,n),l=function(e){return Vr&&(!h(r)||e===r)},f=o[n],d=!0;if(f&&(s?Array.isArray(f.options)&&N(f.options).find((function(r){return a===r.ref.value&&l(r.ref)})):l(f.ref)))o[n]=Object.assign(Object.assign({},f),e);else{f=i?s?Object.assign({options:N(f&&f.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},u):u,o[n]=f;var y=M(T(W.current,n));Z(w.current)&&y||(t=T(y?w.current:W.current,n),(d=M(t))||c||Ir(n,t)),Z(e)||(I(S.current,n,!0),!lr&&zr.current.isValid&&hr(m,dr,f,W).then((function(r){var e=wr.current.isValid;Z(r)?I(z.current,n,!0):er(z.current,n),e!==Z(r)&&Hr()}))),!v||c&&d||!c&&er(wr.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;h(n)&&t&&(n.addEventListener(e?p:b,t),n.addEventListener(g,t))}(s&&f.options?f.options[f.options.length-1]:f,s||"select-one"===r.type,B.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=Gr(sr(m,Or(W.current),v,!0));zr.current.isSubmitting&&Hr({isSubmitting:!0});try{if(K.current){var a=await K.current(i,J.current,dr),u=a.errors,o=a.values;wr.current.errors=n=u,i=o}else for(var s=0,c=Object.values(m.current);s<c.length;s+=1){var l=c[s];if(l){var d=l.ref.name,h=await hr(m,dr,l,W);h[d]?(I(n,d,h[d]),er(z.current,d)):T(S.current,d)&&(er(wr.current.errors,d),I(z.current,d,!0))}}Z(n)&&Object.keys(wr.current.errors).every((function(r){return r in m.current}))?(Hr({errors:{},isSubmitting:!0}),await r(i,t)):(wr.current.errors=Object.assign(Object.assign({},wr.current.errors),n),e&&await e(wr.current.errors,t),f&&function(r,e){for(var t in r)if(T(e,t)){var n=r[t];if(n){if(n.ref.focus&&M(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(m.current,wr.current.errors))}finally{wr.current.isSubmitting=!1,Hr({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(wr.current.errors),submitCount:wr.current.submitCount+1})}}}),[f,dr]);a((function(){s&&zr.current.isValid&&Kr(),Dr.current=Dr.current||!Vr?Dr.current:function(r,e){var t=new MutationObserver((function(){for(var t=0,n=Object.values(r.current);t<n.length;t+=1){var i=n[t];if(i&&i.options)for(var a=0,u=i.options;a<u.length;a+=1){var o=u[a];o&&o.ref&&Y(o.ref)&&e(i)}else i&&Y(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(m,Yr)}),[Yr,w.current]),a((function(){return function(){Dr.current&&Dr.current.disconnect(),D.current=!0,"production"===process.env.NODE_ENV&&Object.values(m.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!s&&zr.current.isValid&&(xr.isValid=ar(z.current,S.current)&&Z(wr.current.errors));var te={trigger:Wr,setValue:t((function(r,e,t){Pr(r,e,t||{}),Ur(r)&&Hr(),$r(r)}),[Pr,Wr]),getValues:t(Jr,[]),register:t((function(r,e){if(!Er)if(or(r))re({name:r},e);else{if(!C(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[w.current]),unregister:t((function(r){for(var e=0,t=Array.isArray(r)?r:[r];e<t.length;e+=1){var n=t[e];Yr(m.current[n],!0)}}),[]),formState:Ar?new Proxy(xr,{get:function(r,e){if("production"!==process.env.NODE_ENV&&"isValid"===e&&lr&&console.warn("📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState"),e in r)return zr.current[e]=!0,r[e]}}):xr},ne=u((function(){return Object.assign({isFormDirty:Lr,updateWatchedValue:Xr,shouldUnregister:v,updateFormState:Hr,removeFieldEventListener:Qr,watchInternal:Zr,mode:rr.current,reValidateMode:{isReValidateOnBlur:Rr,isReValidateOnChange:Cr},validateResolver:s?Kr:void 0,fieldsRef:m,resetFieldArrayFunctionRef:_,useWatchFieldsRef:A,useWatchRenderFunctionsRef:x,fieldArrayDefaultValuesRef:y,validFieldsRef:z,fieldsWithValidationRef:S,fieldArrayNamesRef:Q,readFormStateRef:zr,formStateRef:wr,defaultValuesRef:w,shallowFieldsStateRef:W,fieldArrayValuesRef:j},te)}),[w.current,Xr,v,Qr,Zr]);return Object.assign({watch:function(r,e){return Zr(r,e)},control:ne,handleSubmit:ee,reset:t((function(r,e){if(void 0===e&&(e={}),Vr)for(var t=0,n=Object.values(m.current);t<n.length;t+=1){var i=n[t];if(i){var a=i.ref,u=i.options,o=kr(a)&&Array.isArray(u)?u[0].ref:a;if(h(o))try{o.closest("form").reset();break}catch(r){}}}m.current={},w.current=Object.assign({},r||w.current),r&&$r(""),Object.values(_.current).forEach((function(r){return fr(r)&&r()})),W.current=v?{}:Or(r||w.current),function(r){var e=r.errors,t=r.isDirty,n=r.isSubmitted,i=r.touched,a=r.isValid,u=r.submitCount,o=r.dirtyFields;a||(z.current={},S.current={}),y.current={},E.current=new Set,R.current=!1,Hr({submitCount:u?wr.current.submitCount:0,isDirty:!!t&&wr.current.isDirty,isSubmitted:!!n&&wr.current.isSubmitted,isValid:!!a&&wr.current.isValid,dirtyFields:o?wr.current.dirtyFields:{},touched:i?wr.current.touched:{},errors:e?wr.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return m.current[r]&&H(r)?delete wr.current.errors[r]:er(wr.current.errors,r)})),Hr({errors:r?wr.current.errors:{}})}),[]),setError:t((function(r,e){var t=(m.current[r]||{}).ref;I(wr.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Hr({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:xr.errors},te)}e(null).displayName="RHFContext";var Sr,zr=function(e){var t=e.isExtraSmall,n=e.isHovered,i=r.createElement("path",{fillRule:"evenodd",d:"M13.554 28.445h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm5.986-16.908h1v-3.158h3.159v-1H19.54v-3.159h-1v3.159h-3.159v1h3.159v3.158zM30.791 39.72h8.37V20.682h-8.37V39.72zm-22.202 0h20.903V10.547H8.589V39.72zm22.203-20.338V9.247H7.289V41.02h33.173V19.382h-9.67zm-9.139 9.063h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zM10.869 7.702h16.343v-1.3H10.869v1.3z"}),a=r.createElement("path",{fillRule:"evenodd",d:"M13.554 28.445h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm5.986-15.908h1v-4.158h4.159v-1H19.54v-4.159h-1v4.159h-4.159v1h4.159v4.158zM30.791 39.72h8.37V20.682h-8.37V39.72zm-22.202 0h20.903V10.547H8.589V39.72zm22.203-20.338V9.247H7.289V41.02h33.173V19.382h-9.67zm-9.139 9.063h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zm1 6.312h2.873v-3.243h-2.873v3.243zm-1 1h4.873v-5.243h-4.873v5.243zM10.869 7.702h16.343v-1.3H10.869v1.3z"}),u=r.createElement("path",{fillRule:"evenodd",d:"M21.527 35.62h2.862v-3.233h-2.862v3.234zm-1.01 1.01H25.4v-5.254h-4.884v5.254zm-7.09-1.01h2.863v-3.233h-2.863v3.234zm-1.01 1.01H17.3v-5.254h-4.883v5.254zm9.11-8.322h2.862v-3.232h-2.862v3.232zm-1.01 1.01H25.4v-5.254h-4.884v5.254zm-7.09-1.01h2.863v-3.232h-2.863v3.232zm-1.01 1.01H17.3v-5.253h-4.883v5.254zm5.86-9.6h1.264V16.69h3.027v-1.263H19.54V12.4h-1.263v3.027H15.25v1.263h3.028v3.028zm12.365 19.888h8.406V20.53h-8.406v19.075zm-22.204 0h20.94V9.132H8.439v30.474zm22.204-20.338V7.87H7.175v33H40.31V19.267h-9.67z"});return t?n?r.createElement("path",{fillRule:"evenodd",d:"M22.158 35.62h2.863v-3.233h-2.863v3.234zm-1.01 1.01h4.883v-5.254h-4.883v5.254zm-7.09-1.01h2.863v-3.233H14.06v3.234zm-1.01 1.01h4.884v-5.254h-4.884v5.254zm9.11-8.322h2.863v-3.232h-2.863v3.232zm-1.01 1.01h4.883v-5.254h-4.883v5.254zm-7.09-1.01h2.863v-3.232H14.06v3.232zm-1.01 1.01h4.884v-5.253h-4.884v5.254zm5.861-9.6h1.264V16.69h3.026v-1.263h-3.026V12.4h-1.264v3.027h-3.027v1.263h3.027v3.028zm12.364 19.888h8.407V20.53h-8.407v19.075zm-22.204 0H30.01V9.132H9.07v30.474zm22.204-20.338V7.87H7.806v33h33.137V19.267h-9.67z"}):u:n?a:i};!function(r){r.formgroup="formgroup",r.checkbox="checkbox",r.radiobutton="radiobutton",r.textarea="textarea",r.input="input"}(Sr||(Sr={}));var wr=function(e){var t=e.exampleType,n=void 0===t?Sr.formgroup:t,i=xr(),a=i.register,u=i.handleSubmit,o=i.errors,h=o.formgroup1||o.formgroup2||o.formgroup3||o.formgroup4||o.formgroup5,g="Du må velge et alternativ",p=function(r){return r.length>=2||"Du må velge to alternativ"};return r.createElement("form",{onSubmit:u((function(r){console.log(r)}))},r.createElement(s,{variant:e.variant,errorSummary:h?"Sjekk at alt er riktig utfylt":void 0},n===Sr.formgroup?[r.createElement(c,{key:0,title:"One amazing title",legend:"Check out these checkboxes!",error:o.formgroup1?o.formgroup1.message:void 0,variant:e.variant,name:"formgroup1"},r.createElement(l,{inputId:"checkbox1",label:"Checkbox 1",ref:a({required:g})}),r.createElement(l,{inputId:"checkbox2",label:"Checkbox 2",ref:a({required:g})}),r.createElement(l,{inputId:"checkbox3",label:"Checkbox 3",ref:a({required:g})})),r.createElement(c,{key:1,legend:"Select two options!",error:o.formgroup2?o.formgroup2.message:void 0,variant:e.variant,name:"formgroup2"},r.createElement(l,{inputId:"checkbox4",label:"Checkbox 4",ref:a({validate:p})}),r.createElement(l,{inputId:"checkbox5",label:"Checkbox 5",ref:a({validate:p})}),r.createElement(l,{inputId:"checkbox6",label:"Checkbox 6",ref:a({validate:p})})),r.createElement(c,{key:2,legend:"Select two options!",error:o.formgroup3?o.formgroup3.message:void 0,variant:e.variant,name:"formgroup3"},r.createElement(v,{inputId:"radiobutton1",label:"Radiobutton 1",ref:a({required:g})}),r.createElement(v,{inputId:"radiobutton2",label:"Radiobutton 2",ref:a({required:g})}),r.createElement(v,{inputId:"radiobutton3",label:"Radiobutton 3",ref:a({required:g})})),r.createElement(c,{key:3,error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(d,{defaultValue:"Dette er en test \n\n Hello \n\n test \n\n test test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})),r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:zr,ref:a({required:"Du må skrive noe her"})}))]:n===Sr.checkbox?r.createElement(c,{name:"formgroup1",error:o.formgroup1?o.formgroup1.message:void 0},r.createElement(l,{name:"formgroup1",inputId:"checkbox1",label:"Checkbox 1",error:o.formgroup1,variant:e.variant,ref:a({required:g})})):n===Sr.radiobutton?r.createElement(c,{name:"formgroup3",error:o.formgroup3?o.formgroup3.message:void 0},r.createElement(v,{name:"formgroup3",inputId:"radiobutton1",label:"Radiobutton 1",error:o.formgroup3,variant:e.variant,ref:a({required:g})})):n===Sr.textarea?r.createElement(c,{error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(d,{defaultValue:"Dette er min historie \n\n Hello \n\n test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})):n===Sr.input?r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{inputId:"input1",label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:zr,ref:a({required:"Du må skrive noe her"})})):void 0),r.createElement(f,null,"Submit"))};export default wr;export{wr as FormExample,Sr as FormExampleVariants};
|
|
1
|
+
import r,{createContext as e,useCallback as t,useRef as n,useState as i,useEffect as a,useMemo as u,isValidElement as o}from"react";import{V as s}from"../../Validation-4041c083.js";import{F as c}from"../../FormGroup-af33981a.js";import{C as l}from"../../Checkbox-f2418dc5.js";import{B as f}from"../../Button-7e82091f.js";import{R as d}from"../../RadioButton-c173d440.js";import{T as v}from"../../Textarea-78e20c9a.js";import{I as m}from"../../Input-31d7accc.js";import g from"../Icons/Hospital.js";import"../../index-9b84fabc.js";import"../Validation/styles.module.scss";import"../../constants-eb74321e.js";import"../../_rollupPluginBabelHelpers-b8ef6dd9.js";import"../FormGroup/styles.module.scss";import"../../Title-9df559dd.js";import"../Title/styles.module.scss";import"../../uuid-fe7442b7.js";import"../Icons/Check.js";import"../Icons/Icon.js";import"../../_tslib-51c8a283.js";import"../../color-a10c7892.js";import"../../index-0e78dfa0.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../Checkbox/styles.module.scss";import"../../Loader-bc13d060.js";import"../Loader/styles.module.scss";import"../../useHover-9710204a.js";import"../../useWindowSize-750f9b68.js";import"../Button/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../../useBreakpoint-552af2b9.js";import"../Input/styles.module.scss";var p=function(r){return r instanceof HTMLElement},b="blur",h="change",y="input",O="onBlur",j="onChange",k="onSubmit",V="onTouched",A="all",E="max",x="min",S="maxLength",w="minLength",D="pattern",F="required",R="validate";var C=function(r){return null==r},I=function(r){return"object"==typeof r},N=function(r){return!C(r)&&!Array.isArray(r)&&I(r)&&!(r instanceof Date)},B=function(r){return/^\w*$/.test(r)},L=function(r){return r.filter(Boolean)},T=function(r){return L(r.replace(/["|']/g,"").replace(/\[/g,".").replace(/\]/g,"").split("."))};function q(r,e,t){for(var n=-1,i=B(e)?[e]:T(e),a=i.length,u=a-1;++n<a;){var o=i[n],s=t;if(n!==u){var c=r[o];s=N(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}r[o]=s,r=r[o]}return r}var M=function(r,e){for(var t in void 0===e&&(e={}),r)B(t)?e[t]=r[t]:q(e,t,r[t]);return e},W=function(r){return void 0===r},H=function(r,e,t){void 0===r&&(r={});var n=L(e.split(/[,[\].]+?/)).reduce((function(r,e){return C(r)?r:r[e]}),r);return W(n)||n===r?W(r[e])?t:r[e]:n},_=function(r,e){p(r)&&r.removeEventListener&&(r.removeEventListener(y,e),r.removeEventListener(h,e),r.removeEventListener(b,e))},P={isValid:!1,value:null},z=function(r){return Array.isArray(r)?r.reduce((function(r,e){return e&&e.ref.checked?{isValid:!0,value:e.ref.value}:r}),P):P},U=function(r){return"radio"===r.type},$=function(r){return"file"===r.type},G=function(r){return"checkbox"===r.type},J=function(r){return"select-multiple"===r.type},K={value:!1,isValid:!1},Q={value:!0,isValid:!0},X=function(r){if(Array.isArray(r)){if(r.length>1){var e=r.filter((function(r){return r&&r.ref.checked})).map((function(r){return r.ref.value}));return{value:e,isValid:!!e.length}}var t=r[0].ref,n=t.checked,i=t.value,a=t.attributes;return n?a&&!W(a.value)?W(i)||""===i?Q:{value:i,isValid:!0}:Q:K}return K};function Y(r,e,t,n,i){var a,u=r.current[e];if(u){var o=u.ref,s=o.value,c=o.disabled,l=u.ref,f=u.valueAsNumber,d=u.valueAsDate,v=u.setValueAs;if(c&&n)return;return $(l)?l.files:U(l)?z(u.options).value:J(l)?(a=l.options,[].concat(a).filter((function(r){return r.selected})).map((function(r){return r.value}))):G(l)?X(u.options).value:i?s:f?""===s?NaN:+s:d?l.valueAsDate:v?v(s):s}if(t)return H(t.current,e)}function Z(r){return!r||r instanceof HTMLElement&&r.nodeType!==Node.DOCUMENT_NODE&&Z(r.parentNode)}var rr=function(r){return N(r)&&!Object.keys(r).length},er=function(r){return"boolean"==typeof r};function tr(r,e){var t,n=B(e)?[e]:T(e),i=1==n.length?r:function(r,e){for(var t=e.slice(0,-1).length,n=0;n<t;)r=W(r)?n++:r[e[n++]];return r}(r,n),a=n[n.length-1];i&&delete i[a];for(var u=0;u<n.slice(0,-1).length;u++){var o=-1,s=void 0,c=n.slice(0,-(u+1)),l=c.length-1;for(u>0&&(t=r);++o<c.length;){var f=c[o];s=s?s[f]:r[f],l===o&&(N(s)&&rr(s)||Array.isArray(s)&&!s.filter((function(r){return N(r)&&!rr(r)||er(r)})).length)&&(t?delete t[f]:delete r[f]),t=s}}return r}var nr=function(r,e){return r&&r.ref===e};var ir=function(r){return C(r)||!I(r)};function ar(r,e){if(ir(r)||ir(e))return e;for(var t in e){var n=r[t],i=e[t];try{r[t]=N(n)&&N(i)||Array.isArray(n)&&Array.isArray(i)?ar(n,i):i}catch(r){}}return r}function ur(r,e,t){if(ir(r)||ir(e)||r instanceof Date||e instanceof Date)return r===e;if(!o(r)){var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var a=0,u=n;a<u.length;a+=1){var s=u[a],c=r[s];if(!t||"ref"!==s){var l=e[s];if((N(c)||Array.isArray(c))&&(N(l)||Array.isArray(l))?!ur(c,l,t):c!==l)return!1}}}return!0}function or(r,e,t,n,i){for(var a,u=-1;++u<r.length;){for(var o in r[u])Array.isArray(r[u][o])?(!t[u]&&(t[u]={}),t[u][o]=[],or(r[u][o],H(e[u]||{},o,[]),t[u][o],t[u],o)):ur(H(e[u]||{},o),r[u][o])?q(t[u]||{},o):t[u]=Object.assign(Object.assign({},t[u]),((a={})[o]=!0,a));n&&!t.length&&delete n[i]}return t}var sr=function(r){return"string"==typeof r},cr=function(r,e,t,n,i){var a={},u=function(e){(W(i)||(sr(i)?e.startsWith(i):Array.isArray(i)&&i.find((function(r){return e.startsWith(r)}))))&&(a[e]=Y(r,e,void 0,n))};for(var o in r.current)u(o);return t?M(a):ar(e,M(a))},lr=function(r){return r instanceof RegExp},fr=function(r){return N(r)&&!lr(r)?r:{value:r,message:""}},dr=function(r){return"function"==typeof r},vr=function(r){return sr(r)||o(r)};function mr(r,e,t){if(void 0===t&&(t="validate"),vr(r)||er(r)&&!r)return{type:t,message:vr(r)?r:"",ref:e}}var gr=function(r,e,t,n,i){var a;return e?Object.assign(Object.assign({},t[r]),{types:Object.assign(Object.assign({},t[r]&&t[r].types?t[r].types:{}),(a={},a[n]=i||!0,a))}):{}},pr=async function(r,e,t,n){var i=t.ref,a=t.ref.value,u=t.options,o=t.required,s=t.maxLength,c=t.minLength,l=t.min,f=t.max,d=t.pattern,v=t.validate,m=i.name,g={},p=U(i),b=G(i),h=p||b,y=""===a,O=gr.bind(null,m,e,g),j=function(r,e,t,n,a){void 0===n&&(n=S),void 0===a&&(a=w);var u=r?e:t;g[m]=Object.assign({type:r?n:a,message:u,ref:i},O(r?n:a,u))};if(o&&(!p&&!b&&(y||C(a))||er(a)&&!a||b&&!X(u).isValid||p&&!z(u).isValid)){var k=vr(o)?{value:!!o,message:o}:fr(o),V=k.value,A=k.message;if(V&&(g[m]=Object.assign({type:F,message:A,ref:h?((r.current[m].options||[])[0]||{}).ref:i},O(F,A)),!e))return g}if(!(C(l)&&C(f)||""===a)){var I,B,L=fr(f),T=fr(l);if(isNaN(a)){var q=i.valueAsDate||new Date(a);sr(L.value)&&(I=q>new Date(L.value)),sr(T.value)&&(B=q<new Date(T.value))}else{var M=i.valueAsNumber||parseFloat(a);C(L.value)||(I=M>L.value),C(T.value)||(B=M<T.value)}if((I||B)&&(j(!!I,L.message,T.message,E,x),!e))return g}if(sr(a)&&!y&&(s||c)){var W=fr(s),H=fr(c),_=!C(W.value)&&a.length>W.value,P=!C(H.value)&&a.length<H.value;if((_||P)&&(j(_,W.message,H.message),!e))return g}if(sr(a)&&d&&!y){var $=fr(d),J=$.value,K=$.message;if(lr(J)&&!J.test(a)&&(g[m]=Object.assign({type:D,message:K,ref:i},O(D,K)),!e))return g}if(v){var Q=Y(r,m,n,!1,!0),Z=h&&u?u[0].ref:i;if(dr(v)){var tr=mr(await v(Q),Z);if(tr&&(g[m]=Object.assign(Object.assign({},tr),O(R,tr.message)),!e))return g}else if(N(v)){for(var nr={},ir=0,ar=Object.entries(v);ir<ar.length;ir+=1){var ur=ar[ir],or=ur[0],cr=ur[1];if(!rr(nr)&&!e)break;var pr=mr(await cr(Q),Z,or);pr&&(nr=Object.assign(Object.assign({},pr),O(or,pr.message)),e&&(g[m]=nr))}if(!rr(nr)&&(g[m]=Object.assign({ref:Z},nr),!e))return g}}return g},br=function(r,e,t){for(var n in void 0===t&&(t=[]),e){var i=r+(N(e)?"."+n:"["+n+"]");ir(e[n])?t.push(i):br(i,e[n],t)}return t},hr=function(r,e,t,n,i){var a=void 0;return t.add(e),rr(r)||(a=H(r,e),(N(a)||Array.isArray(a))&&br(e,a).forEach((function(r){return t.add(r)}))),W(a)?i?n:H(n,e):a},yr=function(r){return r.substring(0,r.indexOf("["))},Or=function(r,e){return[].concat(r).some((function(r){return function(r,e){return RegExp(("^"+e+"([|.)\\d+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r)}(e,r)}))};var jr="undefined"!=typeof window&&"undefined"!=typeof document;function kr(r){var e,t;if(ir(r)||jr&&(r instanceof File||p(r)))return r;if(!["Set","Map","Object","Date","Array"].includes(null===(e=r.constructor)||void 0===e?void 0:e.name))return r;if(r instanceof Date)return t=new Date(r.getTime());if(r instanceof Set){t=new Set;for(var n=0,i=r;n<i.length;n+=1){var a=i[n];t.add(a)}return t}if(r instanceof Map){t=new Map;for(var u=0,o=r.keys();u<o.length;u+=1){var s=o[u];t.set(s,kr(r.get(s)))}return t}for(var c in t=Array.isArray(r)?[]:{},r)t[c]=kr(r[c]);return t}var Vr,Ar=function(r){return{isOnSubmit:!r||r===k,isOnBlur:r===O,isOnChange:r===j,isOnAll:r===A,isOnTouch:r===V}},Er=function(r){return U(r)||G(r)},xr="undefined"==typeof window,Sr=jr?"Proxy"in window:"undefined"!=typeof Proxy;function wr(r){void 0===r&&(r={});var e=r.mode;void 0===e&&(e=k);var o=r.reValidateMode;void 0===o&&(o=j);var s=r.resolver,c=r.context,l=r.defaultValues;void 0===l&&(l={});var f=r.shouldFocusError;void 0===f&&(f=!0);var d=r.shouldUnregister;void 0===d&&(d=!0);var v=r.criteriaMode,m=n({}),g=n({}),O=n({}),V=n(new Set),E=n({}),x=n({}),S=n({}),w=n({}),D=n(l),F=n(!1),R=n(!1),I=n(),T=n({}),P=n({}),z=n(c),K=n(s),Q=n(new Set),X=n(Ar(e)),er=X.current,lr=er.isOnSubmit,fr=er.isOnTouch,vr=v===A,mr=i({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touched:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!lr,errors:{}}),gr=mr[0],Vr=mr[1],wr=n({isDirty:!Sr,dirtyFields:!Sr,touched:!Sr||fr,isValidating:!Sr,isSubmitting:!Sr,isValid:!Sr}),Dr=n(gr),Fr=n(),Rr=n(Ar(o)).current,Cr=Rr.isOnBlur,Ir=Rr.isOnChange;z.current=c,K.current=s,Dr.current=gr,T.current=d?{}:rr(T.current)?kr(l):T.current;var Nr=t((function(r){void 0===r&&(r={}),F.current||(Dr.current=Object.assign(Object.assign({},Dr.current),r),Vr(Dr.current))}),[]),Br=function(){return wr.current.isValidating&&Nr({isValidating:!0})},Lr=t((function(r,e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n={});var a=t||function(r){var e=r.errors,t=r.name,n=r.error,i=r.validFields,a=r.fieldsWithValidation,u=W(n),o=H(e,t);return u&&!!o||!u&&!ur(o,n,!0)||u&&H(a,t)&&!H(i,t)}({errors:Dr.current.errors,error:e,name:r,validFields:w.current,fieldsWithValidation:S.current}),u=H(Dr.current.errors,r);e?(tr(w.current,r),a=a||!u||!ur(u,e,!0),q(Dr.current.errors,r,e)):((H(S.current,r)||K.current)&&(q(w.current,r,!0),a=a||u),tr(Dr.current.errors,r)),(a&&!C(t)||!rr(n)||wr.current.isValidating)&&Nr(Object.assign(Object.assign(Object.assign({},n),K.current?{isValid:!!i}:{}),{isValidating:!1}))}),[]),Tr=t((function(r,e){var t=m.current[r],n=t.ref,i=t.options,a=jr&&p(n)&&C(e)?"":e;U(n)?(i||[]).forEach((function(r){var e=r.ref;return e.checked=e.value===a})):$(n)&&!sr(a)?n.files=a:J(n)?[].concat(n.options).forEach((function(r){return r.selected=a.includes(r.value)})):G(n)&&i?i.length>1?i.forEach((function(r){var e=r.ref;return e.checked=Array.isArray(a)?!!a.find((function(r){return r===e.value})):a===e.value})):i[0].ref.checked=!!a:n.value=a}),[]),qr=t((function(r,e){if(wr.current.isDirty){var t=Jr();return r&&e&&q(t,r,e),!ur(t,D.current)}return!1}),[]),Mr=t((function(r,e){if(void 0===e&&(e=!0),wr.current.isDirty||wr.current.dirtyFields){var t=!ur(H(D.current,r),Y(m,r,T)),n=H(Dr.current.dirtyFields,r),i=Dr.current.isDirty;t?q(Dr.current.dirtyFields,r,!0):tr(Dr.current.dirtyFields,r);var a={isDirty:qr(),dirtyFields:Dr.current.dirtyFields},u=wr.current.isDirty&&i!==a.isDirty||wr.current.dirtyFields&&n!==H(Dr.current.dirtyFields,r);return u&&e&&Nr(a),u?a:{}}return{}}),[]),Wr=t((async function(r,e){if("production"!==process.env.NODE_ENV&&!m.current[r])return console.warn("📋 Field is missing with `name` attribute: ",r),!1;var t=(await pr(m,vr,m.current[r],T))[r];return Lr(r,t,e),W(t)}),[Lr,vr]),Hr=t((async function(r){var e=(await K.current(Jr(),z.current,vr)).errors,t=Dr.current.isValid;if(Array.isArray(r)){var n=r.map((function(r){var t=H(e,r);return t?q(Dr.current.errors,r,t):tr(Dr.current.errors,r),!t})).every(Boolean);return Nr({isValid:rr(e),isValidating:!1}),n}var i=H(e,r);return Lr(r,i,t!==rr(e),{},rr(e)),!i}),[Lr,vr]),_r=t((async function(r){var e=r||Object.keys(m.current);if(Br(),K.current)return Hr(e);if(Array.isArray(e)){!r&&(Dr.current.errors={});var t=await Promise.all(e.map((async function(r){return await Wr(r,null)})));return Nr({isValidating:!1}),t.every(Boolean)}return await Wr(e)}),[Hr,Wr]),Pr=t((function(r,e,t){var n=t.shouldDirty,i=t.shouldValidate,a={};q(a,r,e);for(var u=0,o=br(r,e);u<o.length;u+=1){var s=o[u];m.current[s]&&(Tr(s,H(a,s)),n&&Mr(s),i&&_r(s))}}),[_r,Tr,Mr]),zr=t((function(r,e,t){var n,i;if(!d&&!ir(e)&&q(T.current,r,Array.isArray(e)?[].concat(e):Object.assign({},e)),m.current[r])Tr(r,e),t.shouldDirty&&Mr(r),t.shouldValidate&&_r(r);else if(!ir(e)&&(Pr(r,e,t),Q.current.has(r))){var a=yr(r)||r;q(g.current,r,e),P.current[a](((n={})[a]=H(g.current,a),n)),(wr.current.isDirty||wr.current.dirtyFields)&&t.shouldDirty&&(q(Dr.current.dirtyFields,r,function(r,e,t){return ar(or(r,e,t.slice(0,r.length)),or(e,r,t.slice(0,r.length)))}(e,H(D.current,r,[]),H(Dr.current.dirtyFields,r,[]))),Nr({isDirty:!ur(Object.assign(Object.assign({},Jr()),(i={},i[r]=e,i)),D.current)}))}!d&&q(T.current,r,e)}),[Mr,Tr,Pr]),Ur=function(r){return R.current||V.current.has(r)||V.current.has((r.match(/\w+/)||[])[0])},$r=function(r){var e=!0;if(!rr(E.current))for(var t in E.current)r&&E.current[t].size&&!E.current[t].has(r)&&!E.current[t].has(yr(r))||(x.current[t](),e=!1);return e};function Gr(r){var e;if(!d){for(var t=kr(r),n=0,i=Q.current;n<i.length;n+=1){var a=i[n];B(a)&&!t[a]&&(t=Object.assign(Object.assign({},t),((e={})[a]=[],e)))}return t}return r}function Jr(r){if(sr(r))return Y(m,r,T);if(Array.isArray(r)){for(var e={},t=0,n=r;t<n.length;t+=1){var i=n[t];q(e,i,Y(m,i,T))}return e}return Gr(cr(m,kr(T.current),d))}I.current=I.current?I.current:async function(r){var e,t,n=r.type,i=r.target,a=i.name,u=m.current[a];if(u){var o=n===b,s=function(r){var e=r.isOnBlur,t=r.isOnChange,n=r.isOnTouch,i=r.isTouched,a=r.isReValidateOnBlur,u=r.isReValidateOnChange,o=r.isBlurEvent,s=r.isSubmitted;return!r.isOnAll&&(!s&&n?!(i||o):(s?a:e)?!o:!(s?u:t)||o)}(Object.assign({isBlurEvent:o,isReValidateOnChange:Ir,isReValidateOnBlur:Cr,isTouched:!!H(Dr.current.touched,a),isSubmitted:Dr.current.isSubmitted},X.current)),c=Mr(a,!1),l=!rr(c)||!o&&Ur(a);if(o&&!H(Dr.current.touched,a)&&wr.current.touched&&(q(Dr.current.touched,a,!0),c=Object.assign(Object.assign({},c),{touched:Dr.current.touched})),!d&&G(i)&&q(T.current,a,Y(m,a)),s)return!o&&$r(a),(!rr(c)||l&&rr(c))&&Nr(c);if(Br(),K.current){var f=(await K.current(Jr(),z.current,vr)).errors,v=Dr.current.isValid;if(e=H(f,a),G(i)&&!e&&K.current){var g=yr(a),p=H(f,g,{});p.type&&p.message&&(e=p),g&&(p||H(Dr.current.errors,g))&&(a=g)}v!==(t=rr(f))&&(l=!0)}else e=(await pr(m,vr,u,T))[a];!o&&$r(a),Lr(a,e,l,c,t)}};var Kr=t((async function(r){void 0===r&&(r={});var e=rr(m.current)?D.current:{},t=(await K.current(Object.assign(Object.assign(Object.assign({},e),Jr()),r),z.current,vr)||{}).errors,n=rr(t);Dr.current.isValid!==n&&Nr({isValid:n})}),[vr]),Qr=t((function(r,e){!function(r,e,t,n,i,a){var u=t.ref,o=t.ref.name,s=r.current[o];if(!i){var c=Y(r,o,n);!W(c)&&q(n.current,o,c)}u.type&&s?U(u)||G(u)?Array.isArray(s.options)&&s.options.length?(L(s.options).forEach((function(r,t){void 0===r&&(r={}),(Z(r.ref)&&nr(r,r.ref)||a)&&(_(r.ref,e),tr(s.options,"["+t+"]"))})),s.options&&!L(s.options).length&&delete r.current[o]):delete r.current[o]:(Z(u)&&nr(s,u)||a)&&(_(u,e),delete r.current[o]):delete r.current[o]}(m,I.current,r,T,d,e),d&&(tr(w.current,r.ref.name),tr(S.current,r.ref.name))}),[d]),Xr=t((function(r){if(R.current)Nr();else{for(var e=0,t=V.current;e<t.length;e+=1){if(t[e].startsWith(r)){Nr();break}}$r(r)}}),[]),Yr=t((function(r,e){r&&(Qr(r,e),d&&!L(r.options||[]).length&&(tr(Dr.current.errors,r.ref.name),q(Dr.current.dirtyFields,r.ref.name,!0),Nr({isDirty:qr()}),wr.current.isValid&&K.current&&Kr(),Xr(r.ref.name)))}),[Kr,Qr]);var Zr=t((function(r,e,t){var n=t?E.current[t]:V.current,i=cr(m,kr(T.current),d,!1,r);if(sr(r)){var a=yr(r)||r;return Q.current.has(a)&&(i=Object.assign(Object.assign({},O.current),i)),hr(i,r,n,W(H(D.current,r))?e:H(D.current,r),!0)}var u=W(e)?D.current:e;return Array.isArray(r)?r.reduce((function(r,e){var t;return Object.assign(Object.assign({},r),((t={})[e]=hr(i,e,n,u),t))}),{}):(R.current=W(t),M(!rr(i)&&i||u))}),[]);function re(r,e){if(void 0===e&&(e={}),"production"!==process.env.NODE_ENV){if(!r.name)return console.warn("📋 Field is missing `name` attribute",r,"https://react-hook-form.com/api#useForm");if(Q.current.has(r.name.split(/\[\d+\]$/)[0])&&!RegExp(("^"+r.name.split(/\[\d+\]$/)[0]+"[\\d+].\\w+").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(r.name))return console.warn('📋 `name` prop should be in object shape: name="test[index].name"',r,"https://react-hook-form.com/api#useFieldArray")}var t,n=r.name,i=r.type,a=r.value,u=Object.assign({ref:r},e),o=m.current,s=Er(r),c=Or(Q.current,n),l=function(e){return jr&&(!p(r)||e===r)},f=o[n],v=!0;if(f&&(s?Array.isArray(f.options)&&L(f.options).find((function(r){return a===r.ref.value&&l(r.ref)})):l(f.ref)))o[n]=Object.assign(Object.assign({},f),e);else{f=i?s?Object.assign({options:L(f&&f.options||[]).concat([{ref:r}]),ref:{type:i,name:n}},e):Object.assign({},u):u,o[n]=f;var g=W(H(T.current,n));rr(D.current)&&g||(t=H(g?D.current:T.current,n),(v=W(t))||c||Tr(n,t)),rr(e)||(q(S.current,n,!0),!lr&&wr.current.isValid&&pr(m,vr,f,T).then((function(r){var e=Dr.current.isValid;rr(r)?q(w.current,n,!0):tr(w.current,n),e!==rr(r)&&Nr()}))),!d||c&&v||!c&&tr(Dr.current.dirtyFields,n),i&&function(r,e,t){var n=r.ref;p(n)&&t&&(n.addEventListener(e?h:y,t),n.addEventListener(b,t))}(s&&f.options?f.options[f.options.length-1]:f,s||"select-one"===r.type,I.current)}}var ee=t((function(r,e){return async function(t){t&&t.preventDefault&&(t.preventDefault(),t.persist());var n={},i=Gr(cr(m,kr(T.current),d,!0));wr.current.isSubmitting&&Nr({isSubmitting:!0});try{if(K.current){var a=await K.current(i,z.current,vr),u=a.errors,o=a.values;Dr.current.errors=n=u,i=o}else for(var s=0,c=Object.values(m.current);s<c.length;s+=1){var l=c[s];if(l){var v=l.ref.name,g=await pr(m,vr,l,T);g[v]?(q(n,v,g[v]),tr(w.current,v)):H(S.current,v)&&(tr(Dr.current.errors,v),q(w.current,v,!0))}}rr(n)&&Object.keys(Dr.current.errors).every((function(r){return r in m.current}))?(Nr({errors:{},isSubmitting:!0}),await r(i,t)):(Dr.current.errors=Object.assign(Object.assign({},Dr.current.errors),n),e&&await e(Dr.current.errors,t),f&&function(r,e){for(var t in r)if(H(e,t)){var n=r[t];if(n){if(n.ref.focus&&W(n.ref.focus()))break;if(n.options){n.options[0].ref.focus();break}}}}(m.current,Dr.current.errors))}finally{Dr.current.isSubmitting=!1,Nr({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:rr(Dr.current.errors),submitCount:Dr.current.submitCount+1})}}}),[f,vr]);a((function(){s&&wr.current.isValid&&Kr(),Fr.current=Fr.current||!jr?Fr.current:function(r,e){var t=new MutationObserver((function(){for(var t=0,n=Object.values(r.current);t<n.length;t+=1){var i=n[t];if(i&&i.options)for(var a=0,u=i.options;a<u.length;a+=1){var o=u[a];o&&o.ref&&Z(o.ref)&&e(i)}else i&&Z(i.ref)&&e(i)}}));return t.observe(window.document,{childList:!0,subtree:!0}),t}(m,Yr)}),[Yr,D.current]),a((function(){return function(){Fr.current&&Fr.current.disconnect(),F.current=!0,"production"===process.env.NODE_ENV&&Object.values(m.current).forEach((function(r){return Yr(r,!0)}))}}),[]),!s&&wr.current.isValid&&(gr.isValid=ur(w.current,S.current)&&rr(Dr.current.errors));var te={trigger:_r,setValue:t((function(r,e,t){zr(r,e,t||{}),Ur(r)&&Nr(),$r(r)}),[zr,_r]),getValues:t(Jr,[]),register:t((function(r,e){if(!xr)if(sr(r))re({name:r},e);else{if(!N(r)||!("name"in r))return function(e){return e&&re(e,r)};re(r,e)}}),[D.current]),unregister:t((function(r){for(var e=0,t=Array.isArray(r)?r:[r];e<t.length;e+=1){var n=t[e];Yr(m.current[n],!0)}}),[]),formState:Sr?new Proxy(gr,{get:function(r,e){if("production"!==process.env.NODE_ENV&&"isValid"===e&&lr&&console.warn("📋 `formState.isValid` is applicable with `onTouched`, `onChange` or `onBlur` mode. https://react-hook-form.com/api#formState"),e in r)return wr.current[e]=!0,r[e]}}):gr},ne=u((function(){return Object.assign({isFormDirty:qr,updateWatchedValue:Xr,shouldUnregister:d,updateFormState:Nr,removeFieldEventListener:Qr,watchInternal:Zr,mode:X.current,reValidateMode:{isReValidateOnBlur:Cr,isReValidateOnChange:Ir},validateResolver:s?Kr:void 0,fieldsRef:m,resetFieldArrayFunctionRef:P,useWatchFieldsRef:E,useWatchRenderFunctionsRef:x,fieldArrayDefaultValuesRef:g,validFieldsRef:w,fieldsWithValidationRef:S,fieldArrayNamesRef:Q,readFormStateRef:wr,formStateRef:Dr,defaultValuesRef:D,shallowFieldsStateRef:T,fieldArrayValuesRef:O},te)}),[D.current,Xr,d,Qr,Zr]);return Object.assign({watch:function(r,e){return Zr(r,e)},control:ne,handleSubmit:ee,reset:t((function(r,e){if(void 0===e&&(e={}),jr)for(var t=0,n=Object.values(m.current);t<n.length;t+=1){var i=n[t];if(i){var a=i.ref,u=i.options,o=Er(a)&&Array.isArray(u)?u[0].ref:a;if(p(o))try{o.closest("form").reset();break}catch(r){}}}m.current={},D.current=Object.assign({},r||D.current),r&&$r(""),Object.values(P.current).forEach((function(r){return dr(r)&&r()})),T.current=d?{}:kr(r||D.current),function(r){var e=r.errors,t=r.isDirty,n=r.isSubmitted,i=r.touched,a=r.isValid,u=r.submitCount,o=r.dirtyFields;a||(w.current={},S.current={}),g.current={},V.current=new Set,R.current=!1,Nr({submitCount:u?Dr.current.submitCount:0,isDirty:!!t&&Dr.current.isDirty,isSubmitted:!!n&&Dr.current.isSubmitted,isValid:!!a&&Dr.current.isValid,dirtyFields:o?Dr.current.dirtyFields:{},touched:i?Dr.current.touched:{},errors:e?Dr.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}(e)}),[]),clearErrors:t((function(r){r&&(Array.isArray(r)?r:[r]).forEach((function(r){return m.current[r]&&B(r)?delete Dr.current.errors[r]:tr(Dr.current.errors,r)})),Nr({errors:r?Dr.current.errors:{}})}),[]),setError:t((function(r,e){var t=(m.current[r]||{}).ref;q(Dr.current.errors,r,Object.assign(Object.assign({},e),{ref:t})),Nr({isValid:!1}),e.shouldFocus&&t&&t.focus&&t.focus()}),[]),errors:gr.errors},te)}e(null).displayName="RHFContext",function(r){r.formgroup="formgroup",r.checkbox="checkbox",r.radiobutton="radiobutton",r.textarea="textarea",r.input="input"}(Vr||(Vr={}));var Dr=function(e){var t=e.exampleType,n=void 0===t?Vr.formgroup:t,i=wr(),a=i.register,u=i.handleSubmit,o=i.errors,p=o.formgroup1||o.formgroup2||o.formgroup3||o.formgroup4||o.formgroup5,b="Du må velge et alternativ",h=function(r){return r.length>=2||"Du må velge to alternativ"};return r.createElement("form",{onSubmit:u((function(r){console.log(r)}))},r.createElement(s,{variant:e.variant,errorSummary:p?"Sjekk at alt er riktig utfylt":void 0},n===Vr.formgroup?[r.createElement(c,{key:0,title:"One amazing title",legend:"Check out these checkboxes!",error:o.formgroup1?o.formgroup1.message:void 0,variant:e.variant,name:"formgroup1"},r.createElement(l,{inputId:"checkbox1",label:"Checkbox 1",ref:a({required:b})}),r.createElement(l,{inputId:"checkbox2",label:"Checkbox 2",ref:a({required:b})}),r.createElement(l,{inputId:"checkbox3",label:"Checkbox 3",ref:a({required:b})})),r.createElement(c,{key:1,legend:"Select two options!",error:o.formgroup2?o.formgroup2.message:void 0,variant:e.variant,name:"formgroup2"},r.createElement(l,{inputId:"checkbox4",label:"Checkbox 4",ref:a({validate:h})}),r.createElement(l,{inputId:"checkbox5",label:"Checkbox 5",ref:a({validate:h})}),r.createElement(l,{inputId:"checkbox6",label:"Checkbox 6",ref:a({validate:h})})),r.createElement(c,{key:2,legend:"Select two options!",error:o.formgroup3?o.formgroup3.message:void 0,variant:e.variant,name:"formgroup3"},r.createElement(d,{inputId:"radiobutton1",label:"Radiobutton 1",ref:a({required:b})}),r.createElement(d,{inputId:"radiobutton2",label:"Radiobutton 2",ref:a({required:b})}),r.createElement(d,{inputId:"radiobutton3",label:"Radiobutton 3",ref:a({required:b})})),r.createElement(c,{key:3,error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(v,{defaultValue:"Dette er en test \n\n Hello \n\n test \n\n test test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})),r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:g,ref:a({required:"Du må skrive noe her"})}))]:n===Vr.checkbox?r.createElement(c,{name:"formgroup1",error:o.formgroup1?o.formgroup1.message:void 0},r.createElement(l,{name:"formgroup1",inputId:"checkbox1",label:"Checkbox 1",error:o.formgroup1,variant:e.variant,ref:a({required:b})})):n===Vr.radiobutton?r.createElement(c,{name:"formgroup3",error:o.formgroup3?o.formgroup3.message:void 0},r.createElement(d,{name:"formgroup3",inputId:"radiobutton1",label:"Radiobutton 1",error:o.formgroup3,variant:e.variant,ref:a({required:b})})):n===Vr.textarea?r.createElement(c,{error:o.formgroup4?o.formgroup4.message:void 0},r.createElement(v,{defaultValue:"Dette er min historie \n\n Hello \n\n test",grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",name:"formgroup4",ref:a({maxLength:{value:40,message:"Det kan ikke legges inn mer enn 40 tegn"}})})):n===Vr.input?r.createElement(c,{name:"formgroup5",key:4,variant:e.variant,error:o.formgroup5?o.formgroup5.message:void 0},r.createElement(m,{inputId:"input1",label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:g,ref:a({required:"Du må skrive noe her"})})):void 0),r.createElement(f,null,"Submit"))};export default Dr;export{Dr as FormExample,Vr as FormExampleVariants};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|