@helsenorge/designsystem-react 2.16.1 → 3.0.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 -1
- package/AnchorLink.js.map +1 -1
- package/Avatar.js +1 -1
- package/Avatar.js.map +1 -1
- package/Badge.js +1 -1
- package/Badge.js.map +1 -1
- package/Button.js +1 -1
- package/Button.js.map +1 -1
- package/CHANGELOG.md +679 -326
- package/Checkbox.js +1 -1
- package/Checkbox.js.map +1 -1
- package/Close.js +1 -1
- package/Close.js.map +1 -1
- package/ErrorWrapper.js +1 -1
- package/ErrorWrapper.js.map +1 -1
- package/FormGroup.js +1 -1
- package/FormGroup.js.map +1 -1
- package/FormLayout.js +1 -1
- package/FormLayout.js.map +1 -1
- package/HelpBubble.js +1 -1
- package/HelpBubble.js.map +1 -1
- package/HorizontalScroll.js +1 -1
- package/HorizontalScroll.js.map +1 -1
- package/Input.js +1 -1
- package/Input.js.map +1 -1
- package/ListHeader.js +1 -1
- package/ListHeader.js.map +1 -1
- package/ListHeaderText.js +1 -1
- package/ListHeaderText.js.map +1 -1
- package/MaxCharacters.js +1 -1
- package/MaxCharacters.js.map +1 -1
- package/Modal.js +1 -1
- package/Modal.js.map +1 -1
- package/Panel.js +1 -1
- package/Panel.js.map +1 -1
- package/PopOver.js +2 -0
- package/PopOver.js.map +1 -0
- package/RadioButton.js +1 -1
- package/RadioButton.js.map +1 -1
- package/Select.js +1 -1
- package/Select.js.map +1 -1
- package/Spacer.js +1 -1
- package/Spacer.js.map +1 -1
- package/StatusDot.js +1 -1
- package/StatusDot.js.map +1 -1
- package/TableBody.js +1 -1
- package/TableBody.js.map +1 -1
- package/TableCell.js +1 -1
- package/TableCell.js.map +1 -1
- package/TableExpandedRow.js +1 -1
- package/TableExpandedRow.js.map +1 -1
- package/TableExpanderCell.js +1 -1
- package/TableExpanderCell.js.map +1 -1
- package/TableHead.js +1 -1
- package/TableHead.js.map +1 -1
- package/TableHeadCell.js +1 -1
- package/TableHeadCell.js.map +1 -1
- package/TableRow.js +1 -1
- package/TableRow.js.map +1 -1
- package/Textarea.js +1 -1
- package/Textarea.js.map +1 -1
- package/Title.js +1 -1
- package/Title.js.map +1 -1
- package/Tooltip.js +1 -1
- package/Tooltip.js.map +1 -1
- package/TooltipWord.js +1 -1
- package/TooltipWord.js.map +1 -1
- package/Validation.js +1 -1
- package/Validation.js.map +1 -1
- package/__mocks__/matchMedia.d.ts +1 -1
- package/__mocks__/matchMedia.d.ts.map +1 -1
- package/components/AnchorLink/AnchorLink.d.ts +2 -2
- package/components/AnchorLink/AnchorLink.d.ts.map +1 -1
- package/components/AnchorLink/index.js +1 -1
- package/components/AnchorLink/styles.module.scss +8 -5
- package/components/Avatar/Avatar.d.ts +1 -1
- package/components/Avatar/Avatar.d.ts.map +1 -1
- package/components/Avatar/index.js +1 -1
- package/components/Badge/Badge.d.ts +3 -3
- package/components/Badge/Badge.d.ts.map +1 -1
- package/components/Badge/index.js +1 -1
- package/components/Button/Button.d.ts +7 -7
- package/components/Button/Button.d.ts.map +1 -1
- package/components/Button/componentdata.json +1 -1
- package/components/Button/index.js +1 -1
- package/components/ButtonWithModal/ButtonWithModal.d.ts.map +1 -1
- package/components/ButtonWithModal/index.js +1 -1
- package/components/ButtonWithModal/index.js.map +1 -1
- package/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/components/Checkbox/componentdata.json +1 -1
- package/components/Checkbox/index.js +1 -1
- package/components/Close/Close.d.ts +8 -2
- package/components/Close/Close.d.ts.map +1 -1
- package/components/Close/componentdata.json +1 -1
- package/components/Close/index.js +1 -1
- package/components/Close/styles.module.scss +1 -1
- package/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/components/Dropdown/componentdata.json +1 -1
- package/components/Dropdown/index.js +1 -1
- package/components/Dropdown/index.js.map +1 -1
- package/components/Duolist/Duolist.d.ts +4 -4
- package/components/Duolist/Duolist.d.ts.map +1 -1
- package/components/Duolist/index.js +1 -1
- package/components/Duolist/index.js.map +1 -1
- package/components/ErrorWrapper/ErrorWrapper.d.ts.map +1 -1
- package/components/ErrorWrapper/componentdata.json +1 -1
- package/components/ErrorWrapper/index.js +1 -1
- package/components/Expander/Expander.d.ts +2 -2
- package/components/Expander/Expander.d.ts.map +1 -1
- package/components/Expander/componentdata.json +1 -1
- package/components/Expander/index.js +1 -1
- package/components/Expander/index.js.map +1 -1
- package/components/ExpanderHierarchy/Expander.d.ts +18 -0
- package/components/ExpanderHierarchy/Expander.d.ts.map +1 -0
- package/components/ExpanderHierarchy/ExpanderButton.d.ts +11 -0
- package/components/ExpanderHierarchy/ExpanderButton.d.ts.map +1 -0
- package/components/ExpanderHierarchy/ExpanderHierarchy.d.ts +22 -0
- package/components/ExpanderHierarchy/ExpanderHierarchy.d.ts.map +1 -0
- package/components/ExpanderHierarchy/componentdata.json +1 -0
- package/components/ExpanderHierarchy/expander.module.scss +147 -0
- package/components/ExpanderHierarchy/expander.module.scss.d.ts +25 -0
- package/components/ExpanderHierarchy/index.d.ts +4 -0
- package/components/ExpanderHierarchy/index.d.ts.map +1 -0
- package/components/ExpanderHierarchy/index.js +2 -0
- package/components/ExpanderHierarchy/index.js.map +1 -0
- package/components/ExpanderHierarchy/styles.module.scss +17 -0
- package/components/ExpanderHierarchy/styles.module.scss.d.ts +11 -0
- package/components/ExpanderHierarchy/utils.d.ts +3 -0
- package/components/ExpanderHierarchy/utils.d.ts.map +1 -0
- package/components/ExpanderList/ExpanderList.d.ts +4 -4
- package/components/ExpanderList/ExpanderList.d.ts.map +1 -1
- package/components/ExpanderList/index.js +1 -1
- package/components/ExpanderList/index.js.map +1 -1
- package/components/FormExample/FormExample.d.ts.map +1 -1
- package/components/FormExample/index.js +3 -3
- package/components/FormExample/index.js.map +1 -1
- package/components/FormGroup/FormGroup.d.ts +1 -1
- package/components/FormGroup/FormGroup.d.ts.map +1 -1
- package/components/FormGroup/index.js +1 -1
- package/components/FormLayout/FormLayout.d.ts.map +1 -1
- package/components/FormLayout/index.js +1 -1
- package/components/GridExample/index.js +1 -1
- package/components/GridExample/index.js.map +1 -1
- package/components/HelpBubble/HelpBubble.d.ts +4 -7
- package/components/HelpBubble/HelpBubble.d.ts.map +1 -1
- package/components/HelpBubble/index.js +1 -1
- package/components/HelpBubble/styles.module.scss +0 -41
- package/components/HelpBubble/styles.module.scss.d.ts +0 -3
- package/components/HelpBubbleExample/componentdata.json +1 -1
- package/components/HelpBubbleExample/index.js +1 -1
- package/components/HelpBubbleExample/index.js.map +1 -1
- package/components/HighlightBox/HighlightBox.d.ts +2 -2
- package/components/HighlightBox/HighlightBox.d.ts.map +1 -1
- package/components/HighlightBox/componentdata.json +1 -1
- package/components/HighlightBox/index.js +1 -1
- package/components/HighlightBox/index.js.map +1 -1
- package/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/components/HorizontalScroll/index.js +1 -1
- package/components/Icons/ActiveMonitoring.d.ts.map +1 -1
- package/components/Icons/ActiveMonitoring.js.map +1 -1
- package/components/Icons/AcupunctureBack.d.ts.map +1 -1
- package/components/Icons/AcupunctureBack.js.map +1 -1
- package/components/Icons/AlarmClock.d.ts.map +1 -1
- package/components/Icons/AlarmClock.js.map +1 -1
- package/components/Icons/AlertSignFill.d.ts.map +1 -1
- package/components/Icons/AlertSignFill.js.map +1 -1
- package/components/Icons/AlertSignStroke.d.ts.map +1 -1
- package/components/Icons/AlertSignStroke.js.map +1 -1
- package/components/Icons/Amputation.d.ts.map +1 -1
- package/components/Icons/Amputation.js.map +1 -1
- package/components/Icons/Anxiety.d.ts.map +1 -1
- package/components/Icons/Anxiety.js.map +1 -1
- package/components/Icons/Apple.d.ts.map +1 -1
- package/components/Icons/Apple.js.map +1 -1
- package/components/Icons/Archive.d.ts.map +1 -1
- package/components/Icons/Archive.js.map +1 -1
- package/components/Icons/ArmFlexing.d.ts.map +1 -1
- package/components/Icons/ArmFlexing.js.map +1 -1
- package/components/Icons/ArrowDown.d.ts.map +1 -1
- package/components/Icons/ArrowDown.js.map +1 -1
- package/components/Icons/ArrowLeft.d.ts.map +1 -1
- package/components/Icons/ArrowLeft.js.map +1 -1
- package/components/Icons/ArrowRight.d.ts.map +1 -1
- package/components/Icons/ArrowRight.js.map +1 -1
- package/components/Icons/ArrowUp.d.ts.map +1 -1
- package/components/Icons/ArrowUp.js.map +1 -1
- package/components/Icons/ArrowUpRight.d.ts.map +1 -1
- package/components/Icons/ArrowUpRight.js.map +1 -1
- package/components/Icons/Attachment.d.ts.map +1 -1
- package/components/Icons/Attachment.js.map +1 -1
- package/components/Icons/Atv.d.ts.map +1 -1
- package/components/Icons/Atv.js.map +1 -1
- package/components/Icons/Avatar.d.ts.map +1 -1
- package/components/Icons/Avatar.js.map +1 -1
- package/components/Icons/AwakePersonOnPillow.d.ts.map +1 -1
- package/components/Icons/AwakePersonOnPillow.js.map +1 -1
- package/components/Icons/Baby.d.ts.map +1 -1
- package/components/Icons/Baby.js.map +1 -1
- package/components/Icons/BandAid.d.ts.map +1 -1
- package/components/Icons/BandAid.js.map +1 -1
- package/components/Icons/BeerAndPills.d.ts.map +1 -1
- package/components/Icons/BeerAndPills.js.map +1 -1
- package/components/Icons/Bell.d.ts.map +1 -1
- package/components/Icons/Bell.js.map +1 -1
- package/components/Icons/Bike.d.ts.map +1 -1
- package/components/Icons/Bike.js.map +1 -1
- package/components/Icons/BirthControl.d.ts.map +1 -1
- package/components/Icons/BirthControl.js.map +1 -1
- package/components/Icons/BirthdayCake.d.ts.map +1 -1
- package/components/Icons/BirthdayCake.js.map +1 -1
- package/components/Icons/Boat.d.ts.map +1 -1
- package/components/Icons/Boat.js.map +1 -1
- package/components/Icons/Body.d.ts.map +1 -1
- package/components/Icons/Body.js.map +1 -1
- package/components/Icons/Brain.d.ts.map +1 -1
- package/components/Icons/Brain.js.map +1 -1
- package/components/Icons/BreastReconstruction.d.ts.map +1 -1
- package/components/Icons/BreastReconstruction.js.map +1 -1
- package/components/Icons/BreastRemoval.d.ts.map +1 -1
- package/components/Icons/BreastRemoval.js.map +1 -1
- package/components/Icons/Breasts.d.ts.map +1 -1
- package/components/Icons/Breasts.js.map +1 -1
- package/components/Icons/BrokenHeart.d.ts.map +1 -1
- package/components/Icons/BrokenHeart.js.map +1 -1
- package/components/Icons/BrokenPuzzle.d.ts.map +1 -1
- package/components/Icons/BrokenPuzzle.js.map +1 -1
- package/components/Icons/Bus.d.ts.map +1 -1
- package/components/Icons/Bus.js.map +1 -1
- package/components/Icons/Calendar.d.ts.map +1 -1
- package/components/Icons/Calendar.js.map +1 -1
- package/components/Icons/CalendarChange.d.ts.map +1 -1
- package/components/Icons/CalendarChange.js.map +1 -1
- package/components/Icons/CalendarCheck.d.ts.map +1 -1
- package/components/Icons/CalendarCheck.js.map +1 -1
- package/components/Icons/CalendarEvent.d.ts.map +1 -1
- package/components/Icons/CalendarEvent.js.map +1 -1
- package/components/Icons/CalendarSave.d.ts.map +1 -1
- package/components/Icons/CalendarSave.js.map +1 -1
- package/components/Icons/Cancer.d.ts.map +1 -1
- package/components/Icons/Cancer.js.map +1 -1
- package/components/Icons/Car.d.ts.map +1 -1
- package/components/Icons/Car.js.map +1 -1
- package/components/Icons/Change.d.ts.map +1 -1
- package/components/Icons/Change.js.map +1 -1
- package/components/Icons/Check.d.ts.map +1 -1
- package/components/Icons/Check.js.map +1 -1
- package/components/Icons/CheckFill.d.ts.map +1 -1
- package/components/Icons/CheckFill.js.map +1 -1
- package/components/Icons/CheckOutline.d.ts.map +1 -1
- package/components/Icons/CheckOutline.js.map +1 -1
- package/components/Icons/Chest.d.ts.map +1 -1
- package/components/Icons/Chest.js.map +1 -1
- package/components/Icons/ChevronDown.d.ts.map +1 -1
- package/components/Icons/ChevronDown.js.map +1 -1
- package/components/Icons/ChevronLeft.d.ts.map +1 -1
- package/components/Icons/ChevronLeft.js.map +1 -1
- package/components/Icons/ChevronRight.d.ts.map +1 -1
- package/components/Icons/ChevronRight.js.map +1 -1
- package/components/Icons/ChevronUp.d.ts.map +1 -1
- package/components/Icons/ChevronUp.js.map +1 -1
- package/components/Icons/ChevronsDown.d.ts.map +1 -1
- package/components/Icons/ChevronsDown.js.map +1 -1
- package/components/Icons/ChevronsUp.d.ts.map +1 -1
- package/components/Icons/ChevronsUp.js.map +1 -1
- package/components/Icons/ChildPlaying.d.ts.map +1 -1
- package/components/Icons/ChildPlaying.js.map +1 -1
- package/components/Icons/Cigarette.d.ts.map +1 -1
- package/components/Icons/Cigarette.js.map +1 -1
- package/components/Icons/Coins.d.ts.map +1 -1
- package/components/Icons/Coins.js.map +1 -1
- package/components/Icons/Contacts.d.ts.map +1 -1
- package/components/Icons/Contacts.js.map +1 -1
- package/components/Icons/Copy.d.ts.map +1 -1
- package/components/Icons/Copy.js.map +1 -1
- package/components/Icons/CoronaCertificate.d.ts.map +1 -1
- package/components/Icons/CoronaCertificate.js.map +1 -1
- package/components/Icons/Coronavirus.d.ts.map +1 -1
- package/components/Icons/Coronavirus.js.map +1 -1
- package/components/Icons/Cough.d.ts.map +1 -1
- package/components/Icons/Cough.js.map +1 -1
- package/components/Icons/CriticalHealthInfo.d.ts.map +1 -1
- package/components/Icons/CriticalHealthInfo.js.map +1 -1
- package/components/Icons/Cross.d.ts.map +1 -1
- package/components/Icons/Cross.js.map +1 -1
- package/components/Icons/DataExchange.d.ts.map +1 -1
- package/components/Icons/DataExchange.js.map +1 -1
- package/components/Icons/DataReceived.d.ts.map +1 -1
- package/components/Icons/DataReceived.js.map +1 -1
- package/components/Icons/DataSent.d.ts.map +1 -1
- package/components/Icons/DataSent.js.map +1 -1
- package/components/Icons/Depression.d.ts.map +1 -1
- package/components/Icons/Depression.js.map +1 -1
- package/components/Icons/DigestiveSystem.d.ts.map +1 -1
- package/components/Icons/DigestiveSystem.js.map +1 -1
- package/components/Icons/Dizzy.d.ts.map +1 -1
- package/components/Icons/Dizzy.js.map +1 -1
- package/components/Icons/Documents.d.ts.map +1 -1
- package/components/Icons/Documents.js.map +1 -1
- package/components/Icons/Dog.d.ts.map +1 -1
- package/components/Icons/Dog.js.map +1 -1
- package/components/Icons/DonorCard.d.ts.map +1 -1
- package/components/Icons/DonorCard.js.map +1 -1
- package/components/Icons/Download.d.ts.map +1 -1
- package/components/Icons/Download.js.map +1 -1
- package/components/Icons/Draft.d.ts.map +1 -1
- package/components/Icons/Draft.js.map +1 -1
- package/components/Icons/EChat.d.ts.map +1 -1
- package/components/Icons/EChat.js.map +1 -1
- package/components/Icons/EarNoseThroat.d.ts.map +1 -1
- package/components/Icons/EarNoseThroat.js.map +1 -1
- package/components/Icons/ElderlyPerson.d.ts.map +1 -1
- package/components/Icons/ElderlyPerson.js.map +1 -1
- package/components/Icons/Embolization.d.ts.map +1 -1
- package/components/Icons/Embolization.js.map +1 -1
- package/components/Icons/EmoticonAnnoyed.d.ts.map +1 -1
- package/components/Icons/EmoticonAnnoyed.js.map +1 -1
- package/components/Icons/EmoticonDelighted.d.ts.map +1 -1
- package/components/Icons/EmoticonDelighted.js.map +1 -1
- package/components/Icons/EmoticonDisappointed.d.ts.map +1 -1
- package/components/Icons/EmoticonDisappointed.js.map +1 -1
- package/components/Icons/EmoticonHappy.d.ts.map +1 -1
- package/components/Icons/EmoticonHappy.js.map +1 -1
- package/components/Icons/EmoticonMeh.d.ts.map +1 -1
- package/components/Icons/EmoticonMeh.js.map +1 -1
- package/components/Icons/EnterFullScreen.d.ts.map +1 -1
- package/components/Icons/EnterFullScreen.js.map +1 -1
- package/components/Icons/Envelope.d.ts.map +1 -1
- package/components/Icons/Envelope.js.map +1 -1
- package/components/Icons/Epilepsy.d.ts.map +1 -1
- package/components/Icons/Epilepsy.js.map +1 -1
- package/components/Icons/Eraser.d.ts.map +1 -1
- package/components/Icons/Eraser.js.map +1 -1
- package/components/Icons/ErrorSignFill.d.ts.map +1 -1
- package/components/Icons/ErrorSignFill.js.map +1 -1
- package/components/Icons/ErrorSignStroke.d.ts.map +1 -1
- package/components/Icons/ErrorSignStroke.js.map +1 -1
- package/components/Icons/EuropeanHealthCard.d.ts.map +1 -1
- package/components/Icons/EuropeanHealthCard.js.map +1 -1
- package/components/Icons/ExitFullScreen.d.ts.map +1 -1
- package/components/Icons/ExitFullScreen.js.map +1 -1
- package/components/Icons/Eye.d.ts.map +1 -1
- package/components/Icons/Eye.js.map +1 -1
- package/components/Icons/Facebook.d.ts.map +1 -1
- package/components/Icons/Facebook.js.map +1 -1
- package/components/Icons/Female.d.ts.map +1 -1
- package/components/Icons/Female.js.map +1 -1
- package/components/Icons/FemaleDoctor.d.ts.map +1 -1
- package/components/Icons/FemaleDoctor.js.map +1 -1
- package/components/Icons/Ferry.d.ts.map +1 -1
- package/components/Icons/Ferry.js.map +1 -1
- package/components/Icons/File.d.ts +5 -0
- package/components/Icons/File.d.ts.map +1 -0
- package/components/Icons/File.js +2 -0
- package/components/Icons/File.js.map +1 -0
- package/components/Icons/Filter.d.ts.map +1 -1
- package/components/Icons/Filter.js.map +1 -1
- package/components/Icons/FingerBleed.d.ts.map +1 -1
- package/components/Icons/FingerBleed.js.map +1 -1
- package/components/Icons/FirstAidKit.d.ts.map +1 -1
- package/components/Icons/FirstAidKit.js.map +1 -1
- package/components/Icons/FloppyDisk.d.ts.map +1 -1
- package/components/Icons/FloppyDisk.js.map +1 -1
- package/components/Icons/Football.d.ts.map +1 -1
- package/components/Icons/Football.js.map +1 -1
- package/components/Icons/Form.d.ts.map +1 -1
- package/components/Icons/Form.js.map +1 -1
- package/components/Icons/Forward.d.ts.map +1 -1
- package/components/Icons/Forward.js.map +1 -1
- package/components/Icons/Gallery.d.ts.map +1 -1
- package/components/Icons/Gallery.js.map +1 -1
- package/components/Icons/Garden.d.ts.map +1 -1
- package/components/Icons/Garden.js.map +1 -1
- package/components/Icons/GasCan.d.ts.map +1 -1
- package/components/Icons/GasCan.js.map +1 -1
- package/components/Icons/GenderIdentity.d.ts.map +1 -1
- package/components/Icons/GenderIdentity.js.map +1 -1
- package/components/Icons/Globe.d.ts.map +1 -1
- package/components/Icons/Globe.js.map +1 -1
- package/components/Icons/Group.d.ts.map +1 -1
- package/components/Icons/Group.js.map +1 -1
- package/components/Icons/HandWaving.d.ts.map +1 -1
- package/components/Icons/HandWaving.js.map +1 -1
- package/components/Icons/HandWithDisease.d.ts.map +1 -1
- package/components/Icons/HandWithDisease.js.map +1 -1
- package/components/Icons/HealthClinic.d.ts.map +1 -1
- package/components/Icons/HealthClinic.js.map +1 -1
- package/components/Icons/HealthWarning.d.ts.map +1 -1
- package/components/Icons/HealthWarning.js.map +1 -1
- package/components/Icons/Heart.d.ts.map +1 -1
- package/components/Icons/Heart.js.map +1 -1
- package/components/Icons/HeartHands.d.ts.map +1 -1
- package/components/Icons/HeartHands.js.map +1 -1
- package/components/Icons/HelpSign.d.ts.map +1 -1
- package/components/Icons/HelpSign.js.map +1 -1
- package/components/Icons/HelpingHand.d.ts.map +1 -1
- package/components/Icons/HelpingHand.js.map +1 -1
- package/components/Icons/Hemodialysis.d.ts.map +1 -1
- package/components/Icons/Hemodialysis.js.map +1 -1
- package/components/Icons/Hiker.d.ts.map +1 -1
- package/components/Icons/Hiker.js.map +1 -1
- package/components/Icons/Hipprosthesis.d.ts.map +1 -1
- package/components/Icons/Hipprosthesis.js.map +1 -1
- package/components/Icons/History.d.ts.map +1 -1
- package/components/Icons/History.js.map +1 -1
- package/components/Icons/HivAndAids.d.ts.map +1 -1
- package/components/Icons/HivAndAids.js.map +1 -1
- package/components/Icons/Home.d.ts.map +1 -1
- package/components/Icons/Home.js.map +1 -1
- package/components/Icons/Hormone.d.ts.map +1 -1
- package/components/Icons/Hormone.js.map +1 -1
- package/components/Icons/Hospital.d.ts.map +1 -1
- package/components/Icons/Hospital.js.map +1 -1
- package/components/Icons/Hourglass.d.ts.map +1 -1
- package/components/Icons/Hourglass.js.map +1 -1
- package/components/Icons/Icon.d.ts +1 -1
- package/components/Icons/Icon.d.ts.map +1 -1
- package/components/Icons/Icon.js +1 -1
- package/components/Icons/Icon.js.map +1 -1
- package/components/Icons/ImgFile.d.ts.map +1 -1
- package/components/Icons/ImgFile.js.map +1 -1
- package/components/Icons/Inbox.d.ts.map +1 -1
- package/components/Icons/Inbox.js.map +1 -1
- package/components/Icons/InfoSignFill.d.ts.map +1 -1
- package/components/Icons/InfoSignFill.js.map +1 -1
- package/components/Icons/InfoSignStroke.d.ts.map +1 -1
- package/components/Icons/InfoSignStroke.js.map +1 -1
- package/components/Icons/Instagram.d.ts.map +1 -1
- package/components/Icons/Instagram.js.map +1 -1
- package/components/Icons/Intravenous.d.ts.map +1 -1
- package/components/Icons/Intravenous.js.map +1 -1
- package/components/Icons/JointPain.d.ts.map +1 -1
- package/components/Icons/JointPain.js.map +1 -1
- package/components/Icons/Journal.d.ts.map +1 -1
- package/components/Icons/Journal.js.map +1 -1
- package/components/Icons/JpgFile.d.ts.map +1 -1
- package/components/Icons/JpgFile.js.map +1 -1
- package/components/Icons/Kidney.d.ts.map +1 -1
- package/components/Icons/Kidney.js.map +1 -1
- package/components/Icons/KitchenScale.d.ts.map +1 -1
- package/components/Icons/KitchenScale.js.map +1 -1
- package/components/Icons/Kjernejournal.d.ts.map +1 -1
- package/components/Icons/Kjernejournal.js.map +1 -1
- package/components/Icons/Laboratory.d.ts.map +1 -1
- package/components/Icons/Laboratory.js.map +1 -1
- package/components/Icons/LaptopBlog.d.ts.map +1 -1
- package/components/Icons/LaptopBlog.js.map +1 -1
- package/components/Icons/LawBook.d.ts.map +1 -1
- package/components/Icons/LawBook.js.map +1 -1
- package/components/Icons/LightBulb.d.ts.map +1 -1
- package/components/Icons/LightBulb.js.map +1 -1
- package/components/Icons/List.d.ts.map +1 -1
- package/components/Icons/List.js.map +1 -1
- package/components/Icons/Location.d.ts.map +1 -1
- package/components/Icons/Location.js.map +1 -1
- package/components/Icons/Lock.d.ts.map +1 -1
- package/components/Icons/Lock.js.map +1 -1
- package/components/Icons/Login.d.ts.map +1 -1
- package/components/Icons/Login.js.map +1 -1
- package/components/Icons/Logout.d.ts.map +1 -1
- package/components/Icons/Logout.js.map +1 -1
- package/components/Icons/Lungs.d.ts.map +1 -1
- package/components/Icons/Lungs.js.map +1 -1
- package/components/Icons/Makeup.d.ts.map +1 -1
- package/components/Icons/Makeup.js.map +1 -1
- package/components/Icons/MaleDoctor.d.ts.map +1 -1
- package/components/Icons/MaleDoctor.js.map +1 -1
- package/components/Icons/MaleDoctorAndPerson.d.ts.map +1 -1
- package/components/Icons/MaleDoctorAndPerson.js.map +1 -1
- package/components/Icons/MaleGenitalia.d.ts.map +1 -1
- package/components/Icons/MaleGenitalia.js.map +1 -1
- package/components/Icons/Medicine.d.ts.map +1 -1
- package/components/Icons/Medicine.js.map +1 -1
- package/components/Icons/MedicineWarning.d.ts.map +1 -1
- package/components/Icons/MedicineWarning.js.map +1 -1
- package/components/Icons/MentalHealthAdult.d.ts.map +1 -1
- package/components/Icons/MentalHealthAdult.js.map +1 -1
- package/components/Icons/MentalHealthChild.d.ts.map +1 -1
- package/components/Icons/MentalHealthChild.js.map +1 -1
- package/components/Icons/Menu.d.ts.map +1 -1
- package/components/Icons/Menu.js.map +1 -1
- package/components/Icons/Microscope.d.ts.map +1 -1
- package/components/Icons/Microscope.js.map +1 -1
- package/components/Icons/Minus.d.ts.map +1 -1
- package/components/Icons/Minus.js.map +1 -1
- package/components/Icons/Mirror.d.ts.map +1 -1
- package/components/Icons/Mirror.js.map +1 -1
- package/components/Icons/MobilePhone.d.ts.map +1 -1
- package/components/Icons/MobilePhone.js.map +1 -1
- package/components/Icons/MotherHoldingBaby.d.ts.map +1 -1
- package/components/Icons/MotherHoldingBaby.js.map +1 -1
- package/components/Icons/MuscleBack.d.ts.map +1 -1
- package/components/Icons/MuscleBack.js.map +1 -1
- package/components/Icons/MuscleLeg.d.ts.map +1 -1
- package/components/Icons/MuscleLeg.js.map +1 -1
- package/components/Icons/Mushroom.d.ts.map +1 -1
- package/components/Icons/Mushroom.js.map +1 -1
- package/components/Icons/Music.d.ts.map +1 -1
- package/components/Icons/Music.js.map +1 -1
- package/components/Icons/MusselsAndSalt.d.ts.map +1 -1
- package/components/Icons/MusselsAndSalt.js.map +1 -1
- package/components/Icons/NoAccess.d.ts.map +1 -1
- package/components/Icons/NoAccess.js.map +1 -1
- package/components/Icons/NoEye.d.ts.map +1 -1
- package/components/Icons/NoEye.js.map +1 -1
- package/components/Icons/NoFilter.d.ts.map +1 -1
- package/components/Icons/NoFilter.js.map +1 -1
- package/components/Icons/Notepad.d.ts.map +1 -1
- package/components/Icons/Notepad.js.map +1 -1
- package/components/Icons/Osteotomy.d.ts.map +1 -1
- package/components/Icons/Osteotomy.js.map +1 -1
- package/components/Icons/PaintRoller.d.ts.map +1 -1
- package/components/Icons/PaintRoller.js.map +1 -1
- package/components/Icons/PaperPlane.d.ts.map +1 -1
- package/components/Icons/PaperPlane.js.map +1 -1
- package/components/Icons/PatientAndPerson.d.ts.map +1 -1
- package/components/Icons/PatientAndPerson.js.map +1 -1
- package/components/Icons/Pause.d.ts.map +1 -1
- package/components/Icons/Pause.js.map +1 -1
- package/components/Icons/PdfFile.d.ts.map +1 -1
- package/components/Icons/PdfFile.js.map +1 -1
- package/components/Icons/Pencil.d.ts.map +1 -1
- package/components/Icons/Pencil.js.map +1 -1
- package/components/Icons/PeopleTalking.d.ts.map +1 -1
- package/components/Icons/PeopleTalking.js.map +1 -1
- package/components/Icons/Peritonealdialysis.d.ts.map +1 -1
- package/components/Icons/Peritonealdialysis.js.map +1 -1
- package/components/Icons/Person.d.ts.map +1 -1
- package/components/Icons/Person.js.map +1 -1
- package/components/Icons/PersonAndPatient.d.ts.map +1 -1
- package/components/Icons/PersonAndPatient.js.map +1 -1
- package/components/Icons/PersonCancel.d.ts.map +1 -1
- package/components/Icons/PersonCancel.js.map +1 -1
- package/components/Icons/PersonInXRayMachine.d.ts.map +1 -1
- package/components/Icons/PersonInXRayMachine.js.map +1 -1
- package/components/Icons/PersonOverweight.d.ts.map +1 -1
- package/components/Icons/PersonOverweight.js.map +1 -1
- package/components/Icons/PersonRelaxing.d.ts.map +1 -1
- package/components/Icons/PersonRelaxing.js.map +1 -1
- package/components/Icons/PersonWithBrain.d.ts.map +1 -1
- package/components/Icons/PersonWithBrain.js.map +1 -1
- package/components/Icons/PersonWithBrokenArm.d.ts.map +1 -1
- package/components/Icons/PersonWithBrokenArm.js.map +1 -1
- package/components/Icons/PersonWithCrutches.d.ts.map +1 -1
- package/components/Icons/PersonWithCrutches.js.map +1 -1
- package/components/Icons/PersonWithJaw.d.ts.map +1 -1
- package/components/Icons/PersonWithJaw.js.map +1 -1
- package/components/Icons/PersonWithMagnifyingGlass.d.ts.map +1 -1
- package/components/Icons/PersonWithMagnifyingGlass.js.map +1 -1
- package/components/Icons/PersonWithSenses.d.ts.map +1 -1
- package/components/Icons/PersonWithSenses.js.map +1 -1
- package/components/Icons/PersonWorking.d.ts.map +1 -1
- package/components/Icons/PersonWorking.js.map +1 -1
- package/components/Icons/PersonalPlan.d.ts.map +1 -1
- package/components/Icons/PersonalPlan.js.map +1 -1
- package/components/Icons/PizzaSlice.d.ts.map +1 -1
- package/components/Icons/PizzaSlice.js.map +1 -1
- package/components/Icons/Plane.d.ts.map +1 -1
- package/components/Icons/Plane.js.map +1 -1
- package/components/Icons/Plant.d.ts.map +1 -1
- package/components/Icons/Plant.js.map +1 -1
- package/components/Icons/Play.d.ts.map +1 -1
- package/components/Icons/Play.js.map +1 -1
- package/components/Icons/PlusLarge.d.ts.map +1 -1
- package/components/Icons/PlusLarge.js.map +1 -1
- package/components/Icons/PlusSmall.d.ts.map +1 -1
- package/components/Icons/PlusSmall.js.map +1 -1
- package/components/Icons/PngFile.d.ts.map +1 -1
- package/components/Icons/PngFile.js.map +1 -1
- package/components/Icons/Podcast.d.ts.map +1 -1
- package/components/Icons/Podcast.js.map +1 -1
- package/components/Icons/PoisonInformation.d.ts.map +1 -1
- package/components/Icons/PoisonInformation.js.map +1 -1
- package/components/Icons/Pregnant.d.ts.map +1 -1
- package/components/Icons/Pregnant.js.map +1 -1
- package/components/Icons/Printer.d.ts.map +1 -1
- package/components/Icons/Printer.js.map +1 -1
- package/components/Icons/Psychosis.d.ts.map +1 -1
- package/components/Icons/Psychosis.js.map +1 -1
- package/components/Icons/Publication.d.ts.map +1 -1
- package/components/Icons/Publication.js.map +1 -1
- package/components/Icons/Puzzle.d.ts.map +1 -1
- package/components/Icons/Puzzle.js.map +1 -1
- package/components/Icons/QrCode.d.ts.map +1 -1
- package/components/Icons/QrCode.js.map +1 -1
- package/components/Icons/Quarrel.d.ts.map +1 -1
- package/components/Icons/Quarrel.js.map +1 -1
- package/components/Icons/RadioTherapy.d.ts.map +1 -1
- package/components/Icons/RadioTherapy.js.map +1 -1
- package/components/Icons/RadioactiveTreatment.d.ts.map +1 -1
- package/components/Icons/RadioactiveTreatment.js.map +1 -1
- package/components/Icons/Radioiodine.d.ts.map +1 -1
- package/components/Icons/Radioiodine.js.map +1 -1
- package/components/Icons/Receipt.d.ts.map +1 -1
- package/components/Icons/Receipt.js.map +1 -1
- package/components/Icons/Receptionist.d.ts.map +1 -1
- package/components/Icons/Receptionist.js.map +1 -1
- package/components/Icons/Recovery.d.ts.map +1 -1
- package/components/Icons/Recovery.js.map +1 -1
- package/components/Icons/Referral.d.ts.map +1 -1
- package/components/Icons/Referral.js.map +1 -1
- package/components/Icons/Refresh.d.ts.map +1 -1
- package/components/Icons/Refresh.js.map +1 -1
- package/components/Icons/Refund.d.ts.map +1 -1
- package/components/Icons/Refund.js.map +1 -1
- package/components/Icons/Reply.d.ts.map +1 -1
- package/components/Icons/Reply.js.map +1 -1
- package/components/Icons/Rocket.d.ts.map +1 -1
- package/components/Icons/Rocket.js.map +1 -1
- package/components/Icons/RtfFile.d.ts.map +1 -1
- package/components/Icons/RtfFile.js.map +1 -1
- package/components/Icons/STDs.d.ts.map +1 -1
- package/components/Icons/STDs.js.map +1 -1
- package/components/Icons/Save.d.ts.map +1 -1
- package/components/Icons/Save.js.map +1 -1
- package/components/Icons/Scale.d.ts.map +1 -1
- package/components/Icons/Scale.js.map +1 -1
- package/components/Icons/Search.d.ts.map +1 -1
- package/components/Icons/Search.js.map +1 -1
- package/components/Icons/SectionSign.d.ts.map +1 -1
- package/components/Icons/SectionSign.js.map +1 -1
- package/components/Icons/Settings.d.ts.map +1 -1
- package/components/Icons/Settings.js.map +1 -1
- package/components/Icons/Sexualorientation.d.ts.map +1 -1
- package/components/Icons/Sexualorientation.js.map +1 -1
- package/components/Icons/ShakingHand.d.ts.map +1 -1
- package/components/Icons/ShakingHand.js.map +1 -1
- package/components/Icons/Share.d.ts.map +1 -1
- package/components/Icons/Share.js.map +1 -1
- package/components/Icons/Shield.d.ts.map +1 -1
- package/components/Icons/Shield.js.map +1 -1
- package/components/Icons/ShuntOperation.d.ts.map +1 -1
- package/components/Icons/ShuntOperation.js.map +1 -1
- package/components/Icons/Skeleton.d.ts.map +1 -1
- package/components/Icons/Skeleton.js.map +1 -1
- package/components/Icons/Skin.d.ts.map +1 -1
- package/components/Icons/Skin.js.map +1 -1
- package/components/Icons/Snake.d.ts.map +1 -1
- package/components/Icons/Snake.js.map +1 -1
- package/components/Icons/Snapchat.d.ts.map +1 -1
- package/components/Icons/Snapchat.js.map +1 -1
- package/components/Icons/SortDown.d.ts.map +1 -1
- package/components/Icons/SortDown.js.map +1 -1
- package/components/Icons/SortUp.d.ts.map +1 -1
- package/components/Icons/SortUp.js.map +1 -1
- package/components/Icons/SpeechBubble.d.ts.map +1 -1
- package/components/Icons/SpeechBubble.js.map +1 -1
- package/components/Icons/Spray.d.ts.map +1 -1
- package/components/Icons/Spray.js.map +1 -1
- package/components/Icons/Stopwatch.d.ts.map +1 -1
- package/components/Icons/Stopwatch.js.map +1 -1
- package/components/Icons/SupportingPerson.js +1 -1
- package/components/Icons/SupportingPerson.js.map +1 -1
- package/components/Icons/Surgery.d.ts.map +1 -1
- package/components/Icons/Surgery.js.map +1 -1
- package/components/Icons/Syringe.d.ts.map +1 -1
- package/components/Icons/Syringe.js.map +1 -1
- package/components/Icons/Taxi.d.ts.map +1 -1
- package/components/Icons/Taxi.js.map +1 -1
- package/components/Icons/TeddyBear.d.ts.map +1 -1
- package/components/Icons/TeddyBear.js.map +1 -1
- package/components/Icons/Teenagers.d.ts.map +1 -1
- package/components/Icons/Teenagers.js.map +1 -1
- package/components/Icons/ThinkingAboutBaby.d.ts.map +1 -1
- package/components/Icons/ThinkingAboutBaby.js.map +1 -1
- package/components/Icons/Ticket.d.ts.map +1 -1
- package/components/Icons/Ticket.js.map +1 -1
- package/components/Icons/TimePassing.d.ts.map +1 -1
- package/components/Icons/TimePassing.js.map +1 -1
- package/components/Icons/Toolbox.d.ts.map +1 -1
- package/components/Icons/Toolbox.js.map +1 -1
- package/components/Icons/Tooth.d.ts.map +1 -1
- package/components/Icons/Tooth.js.map +1 -1
- package/components/Icons/TotalKneeProsthesis.d.ts.map +1 -1
- package/components/Icons/TotalKneeProsthesis.js.map +1 -1
- package/components/Icons/Train.d.ts.map +1 -1
- package/components/Icons/Train.js.map +1 -1
- package/components/Icons/Transplantation.d.ts.map +1 -1
- package/components/Icons/Transplantation.js.map +1 -1
- package/components/Icons/TrashCan.d.ts.map +1 -1
- package/components/Icons/TrashCan.js.map +1 -1
- package/components/Icons/TravelRoute.d.ts.map +1 -1
- package/components/Icons/TravelRoute.js.map +1 -1
- package/components/Icons/TriangleX.d.ts.map +1 -1
- package/components/Icons/TriangleX.js.map +1 -1
- package/components/Icons/Twitter.d.ts.map +1 -1
- package/components/Icons/Twitter.js.map +1 -1
- package/components/Icons/Undo.d.ts.map +1 -1
- package/components/Icons/Undo.js.map +1 -1
- package/components/Icons/UniProsthesis.d.ts.map +1 -1
- package/components/Icons/UniProsthesis.js.map +1 -1
- package/components/Icons/Upload.d.ts.map +1 -1
- package/components/Icons/Upload.js.map +1 -1
- package/components/Icons/UserOrganization.d.ts.map +1 -1
- package/components/Icons/UserOrganization.js.map +1 -1
- package/components/Icons/Vaccine.d.ts.map +1 -1
- package/components/Icons/Vaccine.js.map +1 -1
- package/components/Icons/VerticalDots.d.ts.map +1 -1
- package/components/Icons/VerticalDots.js.map +1 -1
- package/components/Icons/VideoCamera.d.ts.map +1 -1
- package/components/Icons/VideoCamera.js.map +1 -1
- package/components/Icons/VideoChat.d.ts.map +1 -1
- package/components/Icons/VideoChat.js.map +1 -1
- package/components/Icons/Wallet.d.ts.map +1 -1
- package/components/Icons/Wallet.js.map +1 -1
- package/components/Icons/Watch.d.ts.map +1 -1
- package/components/Icons/Watch.js.map +1 -1
- package/components/Icons/Website.d.ts.map +1 -1
- package/components/Icons/Website.js.map +1 -1
- package/components/Icons/Wheelchair.d.ts.map +1 -1
- package/components/Icons/Wheelchair.js.map +1 -1
- package/components/Icons/WheelchairActive.d.ts.map +1 -1
- package/components/Icons/WheelchairActive.js.map +1 -1
- package/components/Icons/Window.d.ts.map +1 -1
- package/components/Icons/Window.js.map +1 -1
- package/components/Icons/WordDocument.d.ts.map +1 -1
- package/components/Icons/WordDocument.js.map +1 -1
- package/components/Icons/WorkSuitcase.d.ts.map +1 -1
- package/components/Icons/WorkSuitcase.js.map +1 -1
- package/components/Icons/X.d.ts.map +1 -1
- package/components/Icons/X.js.map +1 -1
- package/components/Icons/XOutline.d.ts.map +1 -1
- package/components/Icons/XOutline.js.map +1 -1
- package/components/Icons/XmlFile.d.ts.map +1 -1
- package/components/Icons/XmlFile.js.map +1 -1
- package/components/Icons/YouTube.d.ts.map +1 -1
- package/components/Icons/YouTube.js.map +1 -1
- package/components/Icons/Zoom.d.ts.map +1 -1
- package/components/Icons/Zoom.js.map +1 -1
- package/components/Icons/index.js +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/componentdata.json +1 -1
- package/components/Input/index.js +1 -1
- package/components/LinkList/LinkList.d.ts +8 -8
- package/components/LinkList/LinkList.d.ts.map +1 -1
- package/components/LinkList/index.js +1 -1
- package/components/LinkList/index.js.map +1 -1
- package/components/List/List.d.ts +17 -3
- package/components/List/List.d.ts.map +1 -1
- package/components/List/componentdata.json +1 -1
- package/components/List/index.js +1 -1
- package/components/List/index.js.map +1 -1
- package/components/List/styles.module.scss +51 -5
- package/components/List/styles.module.scss.d.ts +5 -0
- package/components/ListHeader/ListHeader.d.ts +3 -3
- package/components/ListHeader/ListHeader.d.ts.map +1 -1
- package/components/ListHeader/ListHeaderText/ListHeaderText.d.ts +1 -1
- package/components/ListHeader/ListHeaderText/ListHeaderText.d.ts.map +1 -1
- package/components/ListHeader/ListHeaderText/index.js +1 -1
- package/components/ListHeader/index.js +1 -1
- package/components/Loader/Loader.d.ts +2 -2
- package/components/Loader/Loader.d.ts.map +1 -1
- package/components/Loader/index.js +1 -1
- package/components/Loader/index.js.map +1 -1
- package/components/Logo/Logo.d.ts +1 -1
- package/components/Logo/Logo.d.ts.map +1 -1
- package/components/Logo/index.js +1 -1
- package/components/Logo/index.js.map +1 -1
- package/components/MaxCharacters/MaxCharacters.d.ts.map +1 -1
- package/components/Modal/Modal.d.ts.map +1 -1
- package/components/Modal/index.js +1 -1
- package/components/NotificationPanel/DetailButton/DetailButton.d.ts +10 -0
- package/components/NotificationPanel/DetailButton/DetailButton.d.ts.map +1 -0
- package/components/NotificationPanel/DetailButton/componentdata.json +1 -0
- package/components/NotificationPanel/DetailButton/styles.module.scss +34 -0
- package/components/NotificationPanel/DetailButton/styles.module.scss.d.ts +13 -0
- package/components/NotificationPanel/NotificationPanel.d.ts +16 -7
- package/components/NotificationPanel/NotificationPanel.d.ts.map +1 -1
- package/components/NotificationPanel/componentdata.json +1 -1
- package/components/NotificationPanel/index.js +1 -1
- package/components/NotificationPanel/index.js.map +1 -1
- package/components/NotificationPanel/styles.module.scss +92 -91
- package/components/NotificationPanel/styles.module.scss.d.ts +10 -10
- package/components/Panel/Panel.d.ts +2 -2
- package/components/Panel/Panel.d.ts.map +1 -1
- package/components/Panel/index.js +1 -1
- package/components/Panel/styles.module.scss +2 -0
- package/components/PanelList/PanelList.d.ts.map +1 -1
- package/components/PanelList/index.js +1 -1
- package/components/PanelList/index.js.map +1 -1
- package/components/PopMenu/PopMenu.d.ts +30 -0
- package/components/PopMenu/PopMenu.d.ts.map +1 -0
- package/components/PopMenu/componentdata.json +1 -0
- package/components/PopMenu/story.module.scss +5 -0
- package/components/PopMenu/story.module.scss.d.ts +9 -0
- package/components/PopMenu/styles.module.scss +117 -0
- package/components/PopMenu/styles.module.scss.d.ts +14 -0
- package/components/PopOver/PopOver.d.ts +32 -0
- package/components/PopOver/PopOver.d.ts.map +1 -0
- package/components/PopOver/componentdata.json +1 -0
- package/components/PopOver/index.d.ts +4 -0
- package/components/PopOver/index.d.ts.map +1 -0
- package/components/PopOver/index.js +2 -0
- package/components/PopOver/index.js.map +1 -0
- package/components/PopOver/styles.module.scss +63 -0
- package/components/PopOver/styles.module.scss.d.ts +16 -0
- package/components/{HelpBubble → PopOver}/utils.d.ts +4 -4
- package/components/PopOver/utils.d.ts.map +1 -0
- package/components/Portal/index.d.ts.map +1 -1
- package/components/Portal/index.js +1 -1
- package/components/Portal/index.js.map +1 -1
- package/components/RadioButton/RadioButton.d.ts.map +1 -1
- package/components/RadioButton/componentdata.json +1 -1
- package/components/RadioButton/index.js +1 -1
- package/components/Select/Select.d.ts +1 -1
- package/components/Select/Select.d.ts.map +1 -1
- package/components/Select/componentdata.json +1 -1
- package/components/Select/index.js +1 -1
- package/components/Slider/Slider.d.ts.map +1 -1
- package/components/Slider/index.js +1 -1
- package/components/Slider/index.js.map +1 -1
- package/components/Slider/styles.module.scss +1 -0
- package/components/Spacer/Spacer.d.ts.map +1 -1
- package/components/Spacer/index.js +1 -1
- package/components/StatusDot/index.js +1 -1
- package/components/Stepper/Dot.d.ts.map +1 -0
- package/components/Stepper/DotList.d.ts.map +1 -0
- package/components/{Progressbar/Progressbar.d.ts → Stepper/Stepper.d.ts} +6 -6
- package/components/Stepper/Stepper.d.ts.map +1 -0
- package/components/Stepper/componentdata.json +1 -0
- package/components/Stepper/index.d.ts +4 -0
- package/components/Stepper/index.d.ts.map +1 -0
- package/components/Stepper/index.js +2 -0
- package/components/Stepper/index.js.map +1 -0
- package/components/{Progressbar → Stepper}/styles.module.scss +20 -14
- package/components/Stepper/styles.module.scss.d.ts +16 -0
- package/components/{Progressbar → Stepper}/utils.d.ts +7 -7
- package/components/Stepper/utils.d.ts.map +1 -0
- package/components/Table/Table.d.ts +7 -6
- package/components/Table/Table.d.ts.map +1 -1
- package/components/Table/TableBody/index.js +1 -1
- package/components/Table/TableCell/TableCell.d.ts.map +1 -1
- package/components/Table/TableCell/index.js +1 -1
- package/components/Table/TableExpandedRow/TableExpandedRow.d.ts.map +1 -1
- package/components/Table/TableExpandedRow/index.js +1 -1
- package/components/Table/TableExpanderCell/TableExpanderCell.d.ts.map +1 -1
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.d.ts +2 -2
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.d.ts.map +1 -1
- package/components/Table/TableExpanderCell/index.js +1 -1
- package/components/Table/TableHead/TableHead.d.ts.map +1 -1
- package/components/Table/TableHead/index.js +1 -1
- package/components/Table/TableHeadCell/TableHeadCell.d.ts.map +1 -1
- package/components/Table/TableHeadCell/index.js +1 -1
- package/components/Table/TableRow/TableRow.d.ts.map +1 -1
- package/components/Table/TableRow/componentdata.json +1 -1
- package/components/Table/TableRow/index.js +1 -1
- package/components/Table/index.js +1 -1
- package/components/Table/index.js.map +1 -1
- package/components/Table/utils.d.ts +3 -7
- package/components/Table/utils.d.ts.map +1 -1
- package/components/Tag/Tag.d.ts +2 -2
- package/components/Tag/Tag.d.ts.map +1 -1
- package/components/Tag/componentdata.json +1 -1
- package/components/Tag/index.js +1 -1
- package/components/Tag/index.js.map +1 -1
- package/components/Tag/styles.module.scss +1 -0
- package/components/TagList/index.js +1 -1
- package/components/TagList/index.js.map +1 -1
- package/components/Textarea/Textarea.d.ts.map +1 -1
- package/components/Textarea/componentdata.json +1 -1
- package/components/Textarea/index.js +1 -1
- package/components/Tile/Tile.d.ts +2 -2
- package/components/Tile/Tile.d.ts.map +1 -1
- package/components/Tile/index.js +1 -1
- package/components/Tile/index.js.map +1 -1
- package/components/Title/Title.d.ts +2 -2
- package/components/Title/Title.d.ts.map +1 -1
- package/components/Title/index.js +1 -1
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/components/Tooltip/TooltipWord/index.js +1 -1
- package/components/Tooltip/componentdata.json +1 -1
- package/components/Tooltip/index.js +1 -1
- package/components/TooltipExample/TooltipExample.d.ts.map +1 -1
- package/components/TooltipExample/componentdata.json +1 -1
- package/components/TooltipExample/index.js +1 -1
- package/components/TooltipExample/index.js.map +1 -1
- package/components/Validation/Validation.d.ts.map +1 -1
- package/components/Validation/index.js +1 -1
- package/constants.d.ts +7 -3
- package/constants.d.ts.map +1 -1
- package/constants.js +1 -1
- package/constants.js.map +1 -1
- package/hoc/withBreakpoint/index.js +1 -1
- package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
- package/hooks/useBreakpoint.d.ts.map +1 -1
- package/hooks/useBreakpoint.js +1 -1
- package/hooks/useBreakpoint.js.map +1 -1
- package/hooks/useExpand.d.ts +3 -0
- package/hooks/useExpand.d.ts.map +1 -0
- package/hooks/useExpand.js +2 -0
- package/hooks/useExpand.js.map +1 -0
- package/hooks/useFocusToggle.d.ts.map +1 -1
- package/hooks/useFocusToggle.js.map +1 -1
- package/hooks/useFocusTrap.d.ts.map +1 -1
- package/hooks/useFocusTrap.js +1 -1
- package/hooks/useFocusTrap.js.map +1 -1
- package/hooks/useIcons.js.map +1 -1
- package/hooks/useIsVisible.d.ts.map +1 -1
- package/hooks/useIsVisible.js.map +1 -1
- package/hooks/useKeyboardEvent.d.ts +1 -1
- package/hooks/useKeyboardEvent.d.ts.map +1 -1
- package/hooks/useOutsideEvent.d.ts +1 -1
- package/hooks/useOutsideEvent.d.ts.map +1 -1
- package/hooks/useResizeObserver.js.map +1 -1
- package/hooks/useSize.d.ts.map +1 -1
- package/hooks/useSize.js.map +1 -1
- package/hooks/useSticky.d.ts.map +1 -1
- package/hooks/useSticky.js +1 -1
- package/hooks/useSticky.js.map +1 -1
- package/hooks/useToggle.d.ts.map +1 -1
- package/hooks/useToggle.js.map +1 -1
- package/hooks/useUuid.d.ts.map +1 -1
- package/hooks/useUuid.js.map +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/scss/_palette.scss +4 -4
- package/theme/currys/color.d.ts.map +1 -1
- package/theme/currys/color.js +1 -1
- package/theme/currys/color.js.map +1 -1
- package/theme/currys/index.js +1 -1
- package/theme/currys/spacing.js.map +1 -1
- package/theme/index.js +1 -1
- package/theme/index.js.map +1 -1
- package/theme/palette.d.ts +3 -3
- package/theme/palette.d.ts.map +1 -1
- package/theme/palette.js +1 -1
- package/theme/palette.js.map +1 -1
- package/theme/spacers.d.ts +1 -1
- package/theme/spacers.d.ts.map +1 -1
- package/utils/accessibility.d.ts +1 -1
- package/utils/accessibility.d.ts.map +1 -1
- package/utils/component.d.ts +1 -1
- package/utils/component.d.ts.map +1 -1
- package/utils/component.js.map +1 -1
- package/utils/environment.js.map +1 -1
- package/utils/focus.js +1 -1
- package/utils/focus.js.map +1 -1
- package/utils/viewport.js +1 -1
- package/utils/viewport.js.map +1 -1
- package/uuid.js +1 -1
- package/components/HelpBubble/utils.d.ts.map +0 -1
- package/components/Progressbar/Dot.d.ts.map +0 -1
- package/components/Progressbar/DotList.d.ts.map +0 -1
- package/components/Progressbar/Progressbar.d.ts.map +0 -1
- package/components/Progressbar/componentdata.json +0 -1
- package/components/Progressbar/index.d.ts +0 -4
- package/components/Progressbar/index.d.ts.map +0 -1
- package/components/Progressbar/index.js +0 -2
- package/components/Progressbar/index.js.map +0 -1
- package/components/Progressbar/styles.module.scss.d.ts +0 -16
- package/components/Progressbar/utils.d.ts.map +0 -1
- /package/components/{Progressbar → Stepper}/Dot.d.ts +0 -0
- /package/components/{Progressbar → Stepper}/DotList.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport { PaletteNames } from '../../theme/palette';\nimport { useHover } from '../../hooks/useHover';\nimport { usePrevious } from '../../hooks/usePrevious';\nimport { isElementInViewport } from '../../utils/viewport';\n\nimport classNames from 'classnames';\n\nimport expanderListStyles from './styles.module.scss';\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { useSticky } from '../../hooks/useSticky';\n\nimport { mergeRefs } from '../../utils/refs';\nimport { ListHeaderType, renderListHeader } from '../ListHeader/ListHeader';\nimport ChevronUp from '../Icons/ChevronUp';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { TitleTags } from '../Title';\n\nexport type ExpanderListColors = PaletteNames;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ListHeader?: ListHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** @deprecated Skal fases ut - Brukes ikke lenger. */\n bottomBorder?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the link list background color on hover. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Opens the first item in the list. */\n /** @deprecated Skal fases ut til fordel for å bruke expanded-prop på første ExpanderList.Expander */\n isOpen?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** @deprecated Skal fases ut - Brukes ikke lenger. */\n topBorder?: boolean;\n /** Stick expander trigger to top of screen while scrolling down */\n sticky?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'sticky' | 'variant'>;\n\nconst Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n sticky,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n } = props;\n const [isExpanded, setIsExpanded] = useState<boolean>(expanded);\n const previousIsExpanded = usePrevious(isExpanded);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered } = useHover(triggerRef);\n\n const { isOutsideWindow, isLeavingWindow, offsetHeight, contentWidth } = useSticky(expanderRef, triggerRef);\n const isSticky = sticky && isExpanded && isOutsideWindow;\n const isJsxTitle = typeof title === 'object';\n\n const itemClasses = classNames(className, {\n [expanderListStyles['expander-list__item--' + variant]]: variant,\n [expanderListStyles['expander-list__item--jsx']]: isJsxTitle,\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles['expander-list-link--fill']]: variant === 'fill',\n [expanderListStyles['expander-list-link--closed']]: !isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles['expander-list-link--jsx']]: isJsxTitle,\n [expanderListStyles['expander-list-link--sticky']]: isSticky && !isLeavingWindow,\n [expanderListStyles['expander-list-link--absolute']]: isSticky && isLeavingWindow,\n });\n\n useEffect(() => {\n if (expanded !== isExpanded) {\n setIsExpanded(expanded);\n }\n }, [expanded]);\n\n useEffect(() => {\n if (onExpand && isExpanded !== !!previousIsExpanded) {\n onExpand(isExpanded);\n }\n }, [isExpanded, onExpand]);\n\n const renderContent = () => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(\n expanderListStyles['expander-list-link__main-content'],\n isExpanded && expanderListStyles['expander-list-link__main-content--expanded'],\n padding ? expanderListStyles['expander-list-link__main-content--padding'] : ''\n );\n\n return <div className={mainContentClasses}>{children}</div>;\n };\n\n return (\n <li\n className={itemClasses}\n ref={mergeRefs([ref, expanderRef])}\n style={{ paddingTop: isSticky && offsetHeight ? `${offsetHeight}px` : undefined }}\n >\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isHovered || isSticky ? ZIndex.ExpanderTrigger : undefined,\n width: isSticky && contentWidth ? `${contentWidth}px` : undefined,\n }}\n >\n {renderListHeader(title, titleHtmlMarkup, isExpanded ? ChevronUp : ChevronDown, isHovered, large ? 'large' : 'medium', icon)}\n </button>\n {renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: {} | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n isOpen = false,\n renderChildrenWhenClosed = false,\n color,\n className = '',\n accordion = false,\n topBorder = true,\n bottomBorder = true,\n sticky = false,\n testId,\n variant,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const uuid = useUuid();\n const childCount = React.Children.count(children);\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className);\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n /** Returns the class modifier top when we want to show the top border and no-bottom when we don't want to show the bottom border */\n const getExpanderItemClass = (index: number) => {\n return classNames(expanderListStyles['expander-list__item'], {\n [expanderListStyles['expander-list__item--top']]: index === 0 && topBorder,\n [expanderListStyles['expander-list__item--no-bottom']]: index === childCount - 1 && !bottomBorder,\n });\n };\n\n const getExpanderId = (index: number) => `${uuid}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n if (isOpen) {\n const id = getExpanderId(0);\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n }\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n const expanderItemClass = getExpanderItemClass(index);\n\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n sticky,\n 'aria-expanded': expanded,\n className: expanderItemClass,\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${uuid}-${index}`),\n renderChildrenWhenClosed,\n variant,\n });\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n"],"names":["Expander","React","props","ref","id","children","padding","color","className","icon","large","title","titleHtmlMarkup","expanded","sticky","testId","handleExpanderClick","onExpand","renderChildrenWhenClosed","variant","isExpanded","setIsExpanded","useState","previousIsExpanded","usePrevious","expanderRef","useRef","triggerRef","isHovered","useHover","isOutsideWindow","isLeavingWindow","offsetHeight","contentWidth","useSticky","isSticky","isJsxTitle","itemClasses","classNames","expanderListStyles","expanderClasses","useEffect","renderContent","mainContentClasses","mergeRefs","AnalyticsId","ZIndex","renderListHeader","ChevronUp","ChevronDown","isExpanderComponent","element","ExpanderList","childPadding","isOpen","accordion","topBorder","bottomBorder","activeExpander","setActiveExpander","latestExpander","setLatestExpander","uuid","useUuid","childCount","expanderListClasses","event","prevState","getExpanderItemClass","index","getExpanderId","isElementInViewport","newActiveExpander","_a","child","acc","expanderItemClass"],"mappings":"o3CAqFA,MAAMA,EAAyBC,EAAM,WAAyC,CAACC,EAAOC,IAAQ,CACtF,KAAA,CACJ,GAAAC,EACA,SAAAC,EACA,QAAAC,EAAU,GACV,MAAAC,EAAQ,UACR,UAAAC,EAAY,GACZ,KAAAC,EACA,MAAAC,EAAQ,GACR,MAAAC,EACA,gBAAAC,EAAkB,OAClB,SAAAC,EAAW,GACX,OAAAC,EACA,OAAAC,EACA,oBAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,QAAAC,EAAU,MACR,EAAAjB,EACE,CAACkB,EAAYC,CAAa,EAAIC,EAAkBT,CAAQ,EACxDU,EAAqBC,EAAYJ,CAAU,EAC3CK,EAAcC,EAAsB,IAAI,EACxCC,EAAaD,EAA0B,IAAI,EAC3C,CAAE,UAAAE,CAAA,EAAcC,EAASF,CAAU,EAEnC,CAAE,gBAAAG,EAAiB,gBAAAC,EAAiB,aAAAC,EAAc,aAAAC,GAAiBC,EAAUT,EAAaE,CAAU,EACpGQ,EAAWrB,GAAUM,GAAcU,EACnCM,EAAa,OAAOzB,GAAU,SAE9B0B,EAAcC,EAAW9B,EAAW,CACxC,CAAC+B,EAAmB,wBAA0BpB,IAAWA,EACzD,CAACoB,EAAmB,6BAA8BH,CAAA,CACnD,EAEKI,EAAkBF,EAAWC,EAAmB,sBAAuBA,EAAmB,uBAAuBhC,KAAU,CAC/H,CAACgC,EAAmB,6BAA8BpB,IAAY,OAC9D,CAACoB,EAAmB,+BAAgC,CAACnB,EACrD,CAACmB,EAAmB,8BAA+B7B,EACnD,CAAC6B,EAAmB,4BAA6BH,EACjD,CAACG,EAAmB,+BAAgCJ,GAAY,CAACJ,EACjE,CAACQ,EAAmB,iCAAkCJ,GAAYJ,CAAA,CACnE,EAEDU,EAAU,IAAM,CACV5B,IAAaO,GACfC,EAAcR,CAAQ,CACxB,EACC,CAACA,CAAQ,CAAC,EAEb4B,EAAU,IAAM,CACVxB,GAAYG,IAAe,CAAC,CAACG,GAC/BN,EAASG,CAAU,CACrB,EACC,CAACA,EAAYH,CAAQ,CAAC,EAEzB,MAAMyB,EAAgB,IAAM,CACtB,GAAA,CAACxB,GAA4B,CAACE,EACzB,OAAA,KAGT,MAAMuB,EAAqBL,EACzBC,EAAmB,oCACnBnB,GAAcmB,EAAmB,8CACjCjC,EAAUiC,EAAmB,6CAA+C,EAAA,EAG9E,OAAQtC,EAAA,cAAA,MAAA,CAAI,UAAW0C,CAAA,EAAqBtC,CAAS,CAAA,EAGvD,OACGJ,EAAA,cAAA,KAAA,CACC,UAAWoC,EACX,IAAKO,EAAU,CAACzC,EAAKsB,CAAW,CAAC,EACjC,MAAO,CAAE,WAAYU,GAAYH,EAAe,GAAGA,MAAmB,MAAU,CAAA,EAE/E/B,EAAA,cAAA,SAAA,CACC,KAAK,SACL,GAAAG,EACA,QAASY,EACT,cAAaD,EACb,mBAAkB8B,EAAY,qBAC9B,UAAWL,EACX,IAAKb,EACL,gBAAeP,EACf,MAAO,CACL,OAAQQ,GAAaO,EAAWW,EAAO,gBAAkB,OACzD,MAAOX,GAAYF,EAAe,GAAGA,MAAmB,MAC1D,CAAA,EAECc,EAAiBpC,EAAOC,EAAiBQ,EAAa4B,EAAYC,EAAarB,EAAWlB,EAAQ,QAAU,SAAUD,CAAI,CAC7H,EACCiC,EACH,CAAA,CAEJ,CAAC,EAIKQ,EAAuBC,GAC3BlD,EAAM,eAA8BkD,CAAO,GAAMA,EAA+B,OAASnD,EAE9EoD,EAAenD,EAAM,WAAW,CAACC,EAA0BC,IAAqC,CACrG,KAAA,CACJ,SAAAE,EACA,aAAAgD,EAAe,GACf,MAAA3C,EACA,OAAA4C,EAAS,GACT,yBAAApC,EAA2B,GAC3B,MAAAX,EACA,UAAAC,EAAY,GACZ,UAAA+C,EAAY,GACZ,UAAAC,EAAY,GACZ,aAAAC,EAAe,GACf,OAAA3C,EAAS,GACT,OAAAC,EACA,QAAAI,CACE,EAAAjB,EACE,CAACwD,EAAgBC,CAAiB,EAAIrC,EAAyB,EAC/D,CAACsC,EAAgBC,CAAiB,EAAIvC,EAAsB,EAC5DwC,EAAOC,IACPC,EAAa/D,EAAM,SAAS,MAAMI,CAAQ,EAC1C4D,EAAsB3B,EAAWC,EAAmB,iBAAkB/B,CAAS,EAE5E,SAAAQ,EAAoBkD,EAAkD9D,EAAkB,CAC/FuD,KAAgCJ,EAAY,CAAE,CAACnD,GAAK,EAAC+D,GAAA,MAAAA,EAAY/D,GAAQ,EAAA,CAAE,GAAG+D,EAAW,CAAC/D,GAAK,EAAC+D,GAAA,MAAAA,EAAY/D,IAAM,EAClHyD,EAAkBK,EAAM,aAAa,CACvC,CAGM,MAAAE,EAAwBC,GACrB/B,EAAWC,EAAmB,uBAAwB,CAC3D,CAACA,EAAmB,6BAA8B8B,IAAU,GAAKb,EACjE,CAACjB,EAAmB,mCAAoC8B,IAAUL,EAAa,GAAK,CAACP,CAAA,CACtF,EAGGa,EAAiBD,GAAkB,GAAGP,KAAQO,IAEpD,OAAA5B,EAAU,IAAM,CACVc,GAAaK,GAAkB,CAACW,EAAoBX,CAAc,GACpEA,EAAe,eAAe,CAChC,EACC,CAACL,EAAWK,CAAc,CAAC,EAE9BnB,EAAU,IAAM,CACd,GAAIa,EAAQ,CACJ,MAAAlD,EAAKkE,EAAc,CAAC,EAC1BX,KAAgCJ,EAAY,CAAE,CAACnD,GAAK,EAAC+D,GAAA,MAAAA,EAAY/D,GAAQ,EAAA,CAAE,GAAG+D,EAAW,CAAC/D,GAAK,EAAC+D,GAAA,MAAAA,EAAY/D,IAAM,CACpH,CAAA,EACC,CAACkD,CAAM,CAAC,EAEXb,EAAU,IAAM,OACd,GAAI,CAACa,EAAQ,CACX,MAAMkB,GAAoBC,EAAAxE,EAAM,SAAS,IAAII,EAAmBqE,GAAA,CAC1D,GAAAxB,EAAoBwB,CAAK,EACpB,OAAAA,CAEV,CAAA,IAJyB,YAAAD,EAItB,OAAO,CAACE,EAAKD,EAAOL,KAElB,OAAOK,EAAM,MAAM,SAAa,MAClCC,EAAIL,EAAcD,CAAK,GAAKK,EAAM,MAAM,UAEnCC,GACN,CAAoB,GAEvBhB,EAAkB,CAAE,GAAGD,EAAgB,GAAGc,CAAmB,CAAA,CAC/D,CAAA,EACC,CAACnE,CAAQ,CAAC,EAGVJ,EAAA,cAAA,KAAA,CAAG,UAAWgE,EAAqB,IAAA9D,EAAU,cAAaY,EAAQ,mBAAkB8B,EAAY,YAAA,EAC9F5C,EAAM,SAAS,IAAII,EAAU,CAACqE,EAAOL,IAAU,CAC1C,GAAAnB,EAAoBwB,CAAK,EAAG,CACxB,MAAAtE,EAAKkE,EAAcD,CAAK,EACxBxD,EAAW6C,GAAA,YAAAA,EAAiBtD,GAC5BwE,EAAoBR,EAAqBC,CAAK,EAE7C,OAAApE,EAAM,aAAayE,EAA4C,CACpE,GAAAtE,EACA,IAAKiE,EACL,SAAAxD,EACA,QAASwC,EACT,MAAA9C,EACA,MAAAG,EACA,OAAAI,EACA,gBAAiBD,EACjB,UAAW+D,EACX,oBAAsBV,GAAyClD,EAAoBkD,EAAO,GAAGJ,KAAQO,GAAO,EAC5G,yBAAAnD,EACA,QAAAC,CAAA,CACD,CACH,CACO,OAAAuD,CACR,CAAA,CACH,CAEJ,CAAC,EAEDtB,EAAa,SAAWpD,EACxBA,EAAS,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, ZIndex } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useHover } from '../../hooks/useHover';\nimport { useSticky } from '../../hooks/useSticky';\nimport { useUuid } from '../../hooks/useUuid';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { ListHeaderType, renderListHeader } from '../ListHeader/ListHeader';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = PaletteNames;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ListHeader?: ListHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** @deprecated Skal fases ut - Brukes ikke lenger. */\n bottomBorder?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the link list background color on hover. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Opens the first item in the list. */\n /** @deprecated Skal fases ut til fordel for å bruke expanded-prop på første ExpanderList.Expander */\n isOpen?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** @deprecated Skal fases ut - Brukes ikke lenger. */\n topBorder?: boolean;\n /** Stick expander trigger to top of screen while scrolling down */\n sticky?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'sticky' | 'variant'>;\n\nconst Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n sticky,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered } = useHover(triggerRef);\n\n const { isOutsideWindow, isLeavingWindow, offsetHeight, contentWidth } = useSticky(expanderRef, triggerRef);\n const isSticky = sticky && isExpanded && isOutsideWindow;\n const isJsxTitle = typeof title === 'object';\n\n const itemClasses = classNames(className, {\n [expanderListStyles['expander-list__item--' + variant]]: variant,\n [expanderListStyles['expander-list__item--jsx']]: isJsxTitle,\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles['expander-list-link--fill']]: variant === 'fill',\n [expanderListStyles['expander-list-link--closed']]: !isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n [expanderListStyles['expander-list-link--jsx']]: isJsxTitle,\n [expanderListStyles['expander-list-link--sticky']]: isSticky && !isLeavingWindow,\n [expanderListStyles['expander-list-link--absolute']]: isSticky && isLeavingWindow,\n });\n\n const renderContent = () => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(\n expanderListStyles['expander-list-link__main-content'],\n isExpanded && expanderListStyles['expander-list-link__main-content--expanded'],\n padding ? expanderListStyles['expander-list-link__main-content--padding'] : ''\n );\n\n return <div className={mainContentClasses}>{children}</div>;\n };\n\n return (\n <li\n className={itemClasses}\n ref={mergeRefs([ref, expanderRef])}\n style={{ paddingTop: isSticky && offsetHeight ? `${offsetHeight}px` : undefined }}\n >\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isHovered || isSticky ? ZIndex.ExpanderTrigger : undefined,\n width: isSticky && contentWidth ? `${contentWidth}px` : undefined,\n }}\n >\n {renderListHeader(title, titleHtmlMarkup, isHovered, large ? 'large' : 'medium', isExpanded ? ChevronUp : ChevronDown, icon)}\n </button>\n {renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: {} | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n isOpen = false,\n renderChildrenWhenClosed = false,\n color,\n className = '',\n accordion = false,\n topBorder = true,\n bottomBorder = true,\n sticky = false,\n testId,\n variant,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const uuid = useUuid();\n const childCount = React.Children.count(children);\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className);\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n /** Returns the class modifier top when we want to show the top border and no-bottom when we don't want to show the bottom border */\n const getExpanderItemClass = (index: number) => {\n return classNames(expanderListStyles['expander-list__item'], {\n [expanderListStyles['expander-list__item--top']]: index === 0 && topBorder,\n [expanderListStyles['expander-list__item--no-bottom']]: index === childCount - 1 && !bottomBorder,\n });\n };\n\n const getExpanderId = (index: number) => `${uuid}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n if (isOpen) {\n const id = getExpanderId(0);\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n }\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n const expanderItemClass = getExpanderItemClass(index);\n\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n sticky,\n 'aria-expanded': expanded,\n className: expanderItemClass,\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${uuid}-${index}`),\n renderChildrenWhenClosed,\n variant,\n });\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n"],"names":["Expander","React","props","ref","id","children","padding","color","className","icon","large","title","titleHtmlMarkup","expanded","sticky","testId","handleExpanderClick","onExpand","renderChildrenWhenClosed","variant","isExpanded","useExpand","expanderRef","useRef","triggerRef","isHovered","useHover","isOutsideWindow","isLeavingWindow","offsetHeight","contentWidth","useSticky","isSticky","isJsxTitle","itemClasses","classNames","expanderListStyles","expanderClasses","renderContent","mainContentClasses","mergeRefs","AnalyticsId","ZIndex","renderListHeader","ChevronUp","ChevronDown","isExpanderComponent","element","ExpanderList","childPadding","isOpen","accordion","topBorder","bottomBorder","activeExpander","setActiveExpander","useState","latestExpander","setLatestExpander","uuid","useUuid","childCount","expanderListClasses","event","prevState","getExpanderItemClass","index","getExpanderId","useEffect","isElementInViewport","newActiveExpander","_a","child","acc","expanderItemClass","ExpanderList$1"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormExample.d.ts","sourceRoot":"","sources":["../../../src/components/FormExample/FormExample.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FormExample.d.ts","sourceRoot":"","sources":["../../../src/components/FormExample/FormExample.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAe9C,UAAU,gBAAgB;IACxB,WAAW,EAAE,mBAAmB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,OAAO,WAAW,CAAC;CACpC;AAED,oBAAY,mBAAmB;IAC7B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,WAAW,UAAW,gBAAgB,KAAG,WAyQrD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import h from"react";import{V as mt}from"../../Validation.js";import{F as Y}from"../../FormGroup.js";import{C as ee}from"../../Checkbox.js";import{B as yt}from"../../Button.js";import{R as ye}from"../../RadioButton.js";import{T as Be}from"../../Textarea.js";import{I as le}from"../../Input.js";import Ue from"../Icons/Hospital.js";import{F as gt,a as ht}from"../../FormLayout.js";import{isTest as vt}from"../../utils/environment.js";import{S as Pe}from"../../Select.js";import ge from"./styles.module.scss";import"classnames";import"../Validation/styles.module.scss";import"../../constants.js";import"../FormGroup/styles.module.scss";import"../../Title.js";import"../Title/styles.module.scss";import"../../ErrorWrapper.js";import"../ErrorWrapper/styles.module.scss";import"../../utils/component.js";import"../../uuid.js";import"../Icons/Check.js";import"../Icons/Icon.js";import"../../hooks/useUuid.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../../theme/grid.js";import"../Checkbox/styles.module.scss";import"../../hooks/useHover.js";import"../../hooks/useIcons.js";import"../../hooks/useBreakpoint.js";import"../Button/styles.module.scss";import"../Icons/ArrowRight.js";import"../../hooks/useSize.js";import"../../utils/debounce.js";import"../RadioButton/styles.module.scss";import"../Textarea/styles.module.scss";import"../../MaxCharacters.js";import"../MaxCharacters/styles.module.scss";import"../Input/styles.module.scss";import"../FormLayout/styles.module.scss";import"../Select/styles.module.scss";import"../Icons/ChevronDown.js";var de=e=>e.type==="checkbox",ne=e=>e instanceof Date,N=e=>e==null;const Xe=e=>typeof e=="object";var L=e=>!N(e)&&!Array.isArray(e)&&Xe(e)&&!ne(e),bt=e=>L(e)&&e.target?de(e.target)?e.target.checked:e.target.value:e,xt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,kt=(e,i)=>e.has(xt(i)),fe=e=>Array.isArray(e)?e.filter(Boolean):[],T=e=>e===void 0,f=(e,i,t)=>{if(!i||!L(e))return t;const a=fe(i.split(/[,[\].]+?/)).reduce((s,l)=>N(s)?s:s[l],e);return T(a)||a===e?T(e[i])?t:e[i]:a};const He={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},j={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};h.createContext(null);var pt=(e,i,t,a=!0)=>{const s={defaultValues:i._defaultValues};for(const l in e)Object.defineProperty(s,l,{get:()=>{const y=l;return i._proxyFormState[y]!==$.all&&(i._proxyFormState[y]=!a||$.all),t&&(t[y]=!0),e[y]}});return s},B=e=>L(e)&&!Object.keys(e).length,Et=(e,i,t)=>{const{name:a,...s}=e;return B(s)||Object.keys(s).length>=Object.keys(i).length||Object.keys(s).find(l=>i[l]===(!t||$.all))},_e=e=>Array.isArray(e)?e:[e];function wt(e){const i=h.useRef(e);i.current=e,h.useEffect(()=>{const t=!e.disabled&&i.current.subject.subscribe({next:i.current.callback});return()=>{t&&t.unsubscribe()}},[e.disabled])}var W=e=>typeof e=="string",_t=(e,i,t,a)=>{const s=Array.isArray(e);return W(e)?(a&&i.watch.add(e),f(t,e)):s?e.map(l=>(a&&i.watch.add(l),f(t,l))):(a&&(i.watchAll=!0),t)},ve=e=>typeof e=="function",Ye=e=>{for(const i in e)if(ve(e[i]))return!0;return!1},At=(e,i,t,a,s)=>i?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[a]:s||!0}}:{},Le=e=>/^\w*$/.test(e),Ze=e=>fe(e.replace(/["|']|\]/g,"").split(/\.|\[/));function _(e,i,t){let a=-1;const s=Le(i)?[i]:Ze(i),l=s.length,y=l-1;for(;++a<l;){const g=s[a];let E=t;if(a!==y){const V=e[g];E=L(V)||Array.isArray(V)?V:isNaN(+s[a+1])?{}:[]}e[g]=E,e=e[g]}return e}const Ve=(e,i,t)=>{for(const a of t||Object.keys(e)){const s=f(e,a);if(s){const{_f:l,...y}=s;if(l&&i(l.name)){if(l.ref.focus){l.ref.focus();break}else if(l.refs&&l.refs[0].focus){l.refs[0].focus();break}}else L(y)&&Ve(y,i)}}};var $e=(e,i,t)=>!t&&(i.watchAll||i.watch.has(e)||[...i.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length)))),Dt=(e,i,t)=>{const a=fe(f(e,t));return _(a,"root",i[t]),_(e,t,a),e},ce=e=>typeof e=="boolean",Oe=e=>e.type==="file",he=e=>W(e)||h.isValidElement(e),Re=e=>e.type==="radio",be=e=>e instanceof RegExp;const We={value:!1,isValid:!1},Ge={value:!0,isValid:!0};var et=e=>{if(Array.isArray(e)){if(e.length>1){const i=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:i,isValid:!!i.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!T(e[0].attributes.value)?T(e[0].value)||e[0].value===""?Ge:{value:e[0].value,isValid:!0}:Ge:We}return We};const Ke={isValid:!1,value:null};var tt=e=>Array.isArray(e)?e.reduce((i,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:i,Ke):Ke;function je(e,i,t="validate"){if(he(e)||Array.isArray(e)&&e.every(he)||ce(e)&&!e)return{type:t,message:he(e)?e:"",ref:i}}var se=e=>L(e)&&!be(e)?e:{value:e,message:""},ze=async(e,i,t,a,s)=>{const{ref:l,refs:y,required:g,maxLength:E,minLength:V,min:O,max:p,pattern:b,validate:U,name:q,valueAsNumber:re,mount:ae,disabled:P}=e._f;if(!ae||P)return{};const C=y?y[0]:l,H=v=>{a&&W(v)&&(C.setCustomValidity(v),C.reportValidity())},A={},z=Re(l),ie=de(l),K=z||ie,J=(re||Oe(l))&&!l.value||i===""||Array.isArray(i)&&!i.length,R=At.bind(null,q,t,A),Z=(v,x,D,k=j.maxLength,w=j.minLength)=>{const S=v?x:D;A[q]={type:v?k:w,message:S,ref:l,...R(v?k:w,S)}};if(s?!Array.isArray(i)||!i.length:g&&(!K&&(J||N(i))||ce(i)&&!i||ie&&!et(y).isValid||z&&!tt(y).isValid)){const{value:v,message:x}=he(g)?{value:!!g,message:g}:se(g);if(v&&(A[q]={type:j.required,message:x,ref:C,...R(j.required,x)},!t))return H(x),A}if(!J&&(!N(O)||!N(p))){let v,x;const D=se(p),k=se(O);if(!N(i)&&!isNaN(i)){const w=l.valueAsNumber||i&&+i;N(D.value)||(v=w>D.value),N(k.value)||(x=w<k.value)}else{const w=l.valueAsDate||new Date(i),S=X=>new Date(new Date().toDateString()+" "+X),G=l.type=="time",Q=l.type=="week";W(D.value)&&i&&(v=G?S(i)>S(D.value):Q?i>D.value:w>new Date(D.value)),W(k.value)&&i&&(x=G?S(i)<S(k.value):Q?i<k.value:w<new Date(k.value))}if((v||x)&&(Z(!!v,D.message,k.message,j.max,j.min),!t))return H(A[q].message),A}if((E||V)&&!J&&(W(i)||s&&Array.isArray(i))){const v=se(E),x=se(V),D=!N(v.value)&&i.length>v.value,k=!N(x.value)&&i.length<x.value;if((D||k)&&(Z(D,v.message,x.message),!t))return H(A[q].message),A}if(b&&!J&&W(i)){const{value:v,message:x}=se(b);if(be(v)&&!i.match(v)&&(A[q]={type:j.pattern,message:x,ref:l,...R(j.pattern,x)},!t))return H(x),A}if(U){if(ve(U)){const v=await U(i),x=je(v,C);if(x&&(A[q]={...x,...R(j.validate,x.message)},!t))return H(x.message),A}else if(L(U)){let v={};for(const x in U){if(!B(v)&&!t)break;const D=je(await U[x](i),C,x);D&&(v={...D,...R(x,D.message)},H(D.message),t&&(A[q]=v))}if(!B(v)&&(A[q]={ref:C,...v},!t))return A}}return H(!0),A},St=e=>{const i=e.constructor&&e.constructor.prototype;return L(i)&&i.hasOwnProperty("isPrototypeOf")},Te=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function te(e){let i;const t=Array.isArray(e);if(e instanceof Date)i=new Date(e);else if(e instanceof Set)i=new Set(e);else if(!(Te&&(e instanceof Blob||e instanceof FileList))&&(t||L(e)))if(i=t?[]:{},!Array.isArray(e)&&!St(e))i=e;else for(const a in e)i[a]=te(e[a]);else return e;return i}var Je=e=>({isOnSubmit:!e||e===$.onSubmit,isOnBlur:e===$.onBlur,isOnChange:e===$.onChange,isOnAll:e===$.all,isOnTouch:e===$.onTouched});function Ft(e,i){const t=i.slice(0,-1).length;let a=0;for(;a<t;)e=T(e)?a++:e[i[a++]];return e}function Vt(e){for(const i in e)if(!T(e[i]))return!1;return!0}function I(e,i){const t=Le(i)?[i]:Ze(i),a=t.length==1?e:Ft(e,t),s=t[t.length-1];let l;a&&delete a[s];for(let y=0;y<t.slice(0,-1).length;y++){let g=-1,E;const V=t.slice(0,-(y+1)),O=V.length-1;for(y>0&&(l=e);++g<V.length;){const p=V[g];E=E?E[p]:e[p],O===g&&(L(E)&&B(E)||Array.isArray(E)&&Vt(E))&&(l?delete l[p]:delete e[p]),l=E}}return e}function Ae(){let e=[];return{get observers(){return e},next:s=>{for(const l of e)l.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(l=>l!==s)}}),unsubscribe:()=>{e=[]}}}var xe=e=>N(e)||!Xe(e);function oe(e,i){if(xe(e)||xe(i))return e===i;if(ne(e)&&ne(i))return e.getTime()===i.getTime();const t=Object.keys(e),a=Object.keys(i);if(t.length!==a.length)return!1;for(const s of t){const l=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const y=i[s];if(ne(l)&&ne(y)||L(l)&&L(y)||Array.isArray(l)&&Array.isArray(y)?!oe(l,y):l!==y)return!1}}return!0}var Ce=e=>{const i=e?e.ownerDocument:0,t=i&&i.defaultView?i.defaultView.HTMLElement:HTMLElement;return e instanceof t},rt=e=>e.type==="select-multiple",Tt=e=>Re(e)||de(e),De=e=>Ce(e)&&e.isConnected;function ke(e,i={}){const t=Array.isArray(e);if(L(e)||t)for(const a in e)Array.isArray(e[a])||L(e[a])&&!Ye(e[a])?(i[a]=Array.isArray(e[a])?[]:{},ke(e[a],i[a])):N(e[a])||(i[a]=!0);return i}function it(e,i,t){const a=Array.isArray(e);if(L(e)||a)for(const s in e)Array.isArray(e[s])||L(e[s])&&!Ye(e[s])?T(i)||xe(t[s])?t[s]=Array.isArray(e[s])?ke(e[s],[]):{...ke(e[s])}:it(e[s],N(i)?{}:i[s],t[s]):oe(e[s],i[s])?delete t[s]:t[s]=!0;return t}var Se=(e,i)=>it(e,i,ke(i)),st=(e,{valueAsNumber:i,valueAsDate:t,setValueAs:a})=>T(e)?e:i?e===""?NaN:e&&+e:t&&W(e)?new Date(e):a?a(e):e;function Fe(e){const i=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):i.disabled))return Oe(i)?i.files:Re(i)?tt(e.refs).value:rt(i)?[...i.selectedOptions].map(({value:t})=>t):de(i)?et(e.refs).value:st(T(i.value)?e.ref.value:i.value,e)}var Ct=(e,i,t,a)=>{const s={};for(const l of e){const y=f(i,l);y&&_(s,l,y._f)}return{criteriaMode:t,names:[...e],fields:s,shouldUseNativeValidation:a}},ue=e=>T(e)?void 0:be(e)?e.source:L(e)?be(e.value)?e.value.source:e.value:e,Lt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Qe(e,i,t){const a=f(e,t);if(a||Le(t))return{error:a,name:t};const s=t.split(".");for(;s.length;){const l=s.join("."),y=f(i,l),g=f(e,l);if(y&&!Array.isArray(y)&&t!==l)return{name:t};if(g&&g.type)return{name:l,error:g};s.pop()}return{name:t}}var Ot=(e,i,t,a,s)=>s.isOnAll?!1:!t&&s.isOnTouch?!(i||e):(t?a.isOnBlur:s.isOnBlur)?!e:(t?a.isOnChange:s.isOnChange)?e:!0,Rt=(e,i)=>!fe(f(e,i)).length&&I(e,i);const Mt={mode:$.onSubmit,reValidateMode:$.onChange,shouldFocusError:!0};function It(e={}){let i={...Mt,...e},t={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},s=te(i.defaultValues)||{},l=i.shouldUnregister?{}:te(s),y={action:!1,mount:!1,watch:!1},g={mount:new Set,unMount:new Set,array:new Set,watch:new Set},E,V=0,O={};const p={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={watch:Ae(),array:Ae(),state:Ae()},U=Je(i.mode),q=Je(i.reValidateMode),re=i.criteriaMode===$.all,ae=r=>n=>{clearTimeout(V),V=window.setTimeout(r,n)},P=async()=>{let r=!1;return p.isValid&&(r=i.resolver?B((await K()).errors):await R(a,!0),r!==t.isValid&&(t.isValid=r,b.state.next({isValid:r}))),r},C=(r,n=[],o,c,d=!0,u=!0)=>{if(c&&o){if(y.action=!0,u&&Array.isArray(f(a,r))){const m=o(f(a,r),c.argA,c.argB);d&&_(a,r,m)}if(p.errors&&u&&Array.isArray(f(t.errors,r))){const m=o(f(t.errors,r),c.argA,c.argB);d&&_(t.errors,r,m),Rt(t.errors,r)}if(p.touchedFields&&u&&Array.isArray(f(t.touchedFields,r))){const m=o(f(t.touchedFields,r),c.argA,c.argB);d&&_(t.touchedFields,r,m)}p.dirtyFields&&(t.dirtyFields=Se(s,l)),b.state.next({isDirty:v(r,n),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else _(l,r,n)},H=(r,n)=>{_(t.errors,r,n),b.state.next({errors:t.errors})},A=(r,n,o,c)=>{const d=f(a,r);if(d){const u=f(l,r,T(o)?f(s,r):o);T(u)||c&&c.defaultChecked||n?_(l,r,n?u:Fe(d._f)):k(r,u),y.mount&&P()}},z=(r,n,o,c,d)=>{let u=!1;const m={name:r},F=f(t.touchedFields,r);if(p.isDirty){const M=t.isDirty;t.isDirty=m.isDirty=v(),u=M!==m.isDirty}if(p.dirtyFields&&(!o||c)){const M=f(t.dirtyFields,r);oe(f(s,r),n)?I(t.dirtyFields,r):_(t.dirtyFields,r,!0),m.dirtyFields=t.dirtyFields,u=u||M!==f(t.dirtyFields,r)}return o&&!F&&(_(t.touchedFields,r,o),m.touchedFields=t.touchedFields,u=u||p.touchedFields&&F!==o),u&&d&&b.state.next(m),u?m:{}},ie=(r,n,o,c)=>{const d=f(t.errors,r),u=p.isValid&&ce(n)&&t.isValid!==n;if(e.delayError&&o?(E=ae(()=>H(r,o)),E(e.delayError)):(clearTimeout(V),E=null,o?_(t.errors,r,o):I(t.errors,r)),(o?!oe(d,o):d)||!B(c)||u){const m={...c,...u&&ce(n)?{isValid:n}:{},errors:t.errors,name:r};t={...t,...m},b.state.next(m)}O[r]--,p.isValidating&&!Object.values(O).some(m=>m)&&(b.state.next({isValidating:!1}),O={})},K=async r=>i.resolver?await i.resolver({...l},i.context,Ct(r||g.mount,a,i.criteriaMode,i.shouldUseNativeValidation)):{},J=async r=>{const{errors:n}=await K();if(r)for(const o of r){const c=f(n,o);c?_(t.errors,o,c):I(t.errors,o)}else t.errors=n;return n},R=async(r,n,o={valid:!0})=>{for(const c in r){const d=r[c];if(d){const{_f:u,...m}=d;if(u){const F=g.array.has(u.name),M=await ze(d,f(l,u.name),re,i.shouldUseNativeValidation,F);if(M[u.name]&&(o.valid=!1,n))break;!n&&(f(M,u.name)?F?Dt(t.errors,M,u.name):_(t.errors,u.name,M[u.name]):I(t.errors,u.name))}m&&await R(m,n,o)}}return o.valid},Z=()=>{for(const r of g.unMount){const n=f(a,r);n&&(n._f.refs?n._f.refs.every(o=>!De(o)):!De(n._f.ref))&&pe(r)}g.unMount=new Set},v=(r,n)=>(r&&n&&_(l,r,n),!oe(X(),s)),x=(r,n,o)=>{const c={...y.mount?l:T(n)?s:W(r)?{[r]:n}:n};return _t(r,g,c,o)},D=r=>fe(f(y.mount?l:s,r,e.shouldUnregister?f(s,r,[]):[])),k=(r,n,o={})=>{const c=f(a,r);let d=n;if(c){const u=c._f;u&&(!u.disabled&&_(l,r,st(n,u)),d=Te&&Ce(u.ref)&&N(n)?"":n,rt(u.ref)?[...u.ref.options].forEach(m=>m.selected=d.includes(m.value)):u.refs?de(u.ref)?u.refs.length>1?u.refs.forEach(m=>(!m.defaultChecked||!m.disabled)&&(m.checked=Array.isArray(d)?!!d.find(F=>F===m.value):d===m.value)):u.refs[0]&&(u.refs[0].checked=!!d):u.refs.forEach(m=>m.checked=m.value===d):Oe(u.ref)?u.ref.value="":(u.ref.value=d,u.ref.type||b.watch.next({name:r})))}(o.shouldDirty||o.shouldTouch)&&z(r,d,o.shouldTouch,o.shouldDirty,!0),o.shouldValidate&&Q(r)},w=(r,n,o)=>{for(const c in n){const d=n[c],u=`${r}.${c}`,m=f(a,u);(g.array.has(r)||!xe(d)||m&&!m._f)&&!ne(d)?w(u,d,o):k(u,d,o)}},S=(r,n,o={})=>{const c=f(a,r),d=g.array.has(r),u=te(n);_(l,r,u),d?(b.array.next({name:r,values:l}),(p.isDirty||p.dirtyFields)&&o.shouldDirty&&(t.dirtyFields=Se(s,l),b.state.next({name:r,dirtyFields:t.dirtyFields,isDirty:v(r,u)}))):c&&!c._f&&!N(u)?w(r,u,o):k(r,u,o),$e(r,g)&&b.state.next({}),b.watch.next({name:r})},G=async r=>{const n=r.target;let o=n.name;const c=f(a,o);if(c){let d,u;const m=n.type?Fe(c._f):bt(r),F=r.type===He.BLUR||r.type===He.FOCUS_OUT,M=!Lt(c._f)&&!i.resolver&&!f(t.errors,o)&&!c._f.deps||Ot(F,f(t.touchedFields,o),t.isSubmitted,q,U),me=$e(o,g,F);_(l,o,m),F?(c._f.onBlur&&c._f.onBlur(r),E&&E(0)):c._f.onChange&&c._f.onChange(r);const we=z(o,m,F,!1),dt=!B(we)||me;if(!F&&b.watch.next({name:o,type:r.type}),M)return p.isValid&&P(),dt&&b.state.next({name:o,...me?{}:we});if(!F&&me&&b.state.next({}),O[o]=O[o]?O[o]+1:1,b.state.next({isValidating:!0}),i.resolver){const{errors:Ne}=await K([o]),ft=Qe(t.errors,a,o),qe=Qe(Ne,a,ft.name||o);d=qe.error,o=qe.name,u=B(Ne)}else d=(await ze(c,f(l,o),re,i.shouldUseNativeValidation))[o],P();c._f.deps&&Q(c._f.deps),ie(o,u,d,we)}},Q=async(r,n={})=>{let o,c;const d=_e(r);if(b.state.next({isValidating:!0}),i.resolver){const u=await J(T(r)?r:d);o=B(u),c=r?!d.some(m=>f(u,m)):o}else r?(c=(await Promise.all(d.map(async u=>{const m=f(a,u);return await R(m&&m._f?{[u]:m}:m)}))).every(Boolean),!(!c&&!t.isValid)&&P()):c=o=await R(a);return b.state.next({...!W(r)||p.isValid&&o!==t.isValid?{}:{name:r},...i.resolver||!r?{isValid:o}:{},errors:t.errors,isValidating:!1}),n.shouldFocus&&!c&&Ve(a,u=>u&&f(t.errors,u),r?d:g.mount),c},X=r=>{const n={...s,...y.mount?l:{}};return T(r)?n:W(r)?f(n,r):r.map(o=>f(n,o))},Me=(r,n)=>({invalid:!!f((n||t).errors,r),isDirty:!!f((n||t).dirtyFields,r),isTouched:!!f((n||t).touchedFields,r),error:f((n||t).errors,r)}),nt=r=>{r?_e(r).forEach(n=>I(t.errors,n)):t.errors={},b.state.next({errors:t.errors})},ot=(r,n,o)=>{const c=(f(a,r,{_f:{}})._f||{}).ref;_(t.errors,r,{...n,ref:c}),b.state.next({name:r,errors:t.errors,isValid:!1}),o&&o.shouldFocus&&c&&c.focus&&c.focus()},at=(r,n)=>ve(r)?b.watch.subscribe({next:o=>r(x(void 0,n),o)}):x(r,n,!0),pe=(r,n={})=>{for(const o of r?_e(r):g.mount)g.mount.delete(o),g.array.delete(o),f(a,o)&&(n.keepValue||(I(a,o),I(l,o)),!n.keepError&&I(t.errors,o),!n.keepDirty&&I(t.dirtyFields,o),!n.keepTouched&&I(t.touchedFields,o),!i.shouldUnregister&&!n.keepDefaultValue&&I(s,o));b.watch.next({}),b.state.next({...t,...n.keepDirty?{isDirty:v()}:{}}),!n.keepIsValid&&P()},Ee=(r,n={})=>{let o=f(a,r);const c=ce(n.disabled);return _(a,r,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:r}},name:r,mount:!0,...n}}),g.mount.add(r),o?c&&_(l,r,n.disabled?void 0:f(l,r,Fe(o._f))):A(r,!0,n.value),{...c?{disabled:n.disabled}:{},...i.shouldUseNativeValidation?{required:!!n.required,min:ue(n.min),max:ue(n.max),minLength:ue(n.minLength),maxLength:ue(n.maxLength),pattern:ue(n.pattern)}:{},name:r,onChange:G,onBlur:G,ref:d=>{if(d){Ee(r,n),o=f(a,r);const u=T(d.value)&&d.querySelectorAll&&d.querySelectorAll("input,select,textarea")[0]||d,m=Tt(u),F=o._f.refs||[];if(m?F.find(M=>M===u):u===o._f.ref)return;_(a,r,{_f:{...o._f,...m?{refs:[...F.filter(De),u,...Array.isArray(f(s,r))?[{}]:[]],ref:{type:u.type,name:r}}:{ref:u}}}),A(r,!1,void 0,u)}else o=f(a,r,{}),o._f&&(o._f.mount=!1),(i.shouldUnregister||n.shouldUnregister)&&!(kt(g.array,r)&&y.action)&&g.unMount.add(r)}}},Ie=()=>i.shouldFocusError&&Ve(a,r=>r&&f(t.errors,r),g.mount),lt=(r,n)=>async o=>{o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let c=!0,d=te(l);b.state.next({isSubmitting:!0});try{if(i.resolver){const{errors:u,values:m}=await K();t.errors=u,d=m}else await R(a);B(t.errors)?(b.state.next({errors:{},isSubmitting:!0}),await r(d,o)):(n&&await n({...t.errors},o),Ie())}catch(u){throw c=!1,u}finally{t.isSubmitted=!0,b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:B(t.errors)&&c,submitCount:t.submitCount+1,errors:t.errors})}},ut=(r,n={})=>{f(a,r)&&(T(n.defaultValue)?S(r,f(s,r)):(S(r,n.defaultValue),_(s,r,n.defaultValue)),n.keepTouched||I(t.touchedFields,r),n.keepDirty||(I(t.dirtyFields,r),t.isDirty=n.defaultValue?v(r,f(s,r)):v()),n.keepError||(I(t.errors,r),p.isValid&&P()),b.state.next({...t}))},ct=(r,n={})=>{const o=r||s,c=te(o),d=r&&!B(r)?c:s;if(n.keepDefaultValues||(s=o),!n.keepValues){if(n.keepDirtyValues)for(const u of g.mount)f(t.dirtyFields,u)?_(d,u,f(l,u)):S(u,f(d,u));else{if(Te&&T(r))for(const u of g.mount){const m=f(a,u);if(m&&m._f){const F=Array.isArray(m._f.refs)?m._f.refs[0]:m._f.ref;if(Ce(F)){const M=F.closest("form");if(M){M.reset();break}}}}a={}}l=e.shouldUnregister?n.keepDefaultValues?te(s):{}:c,b.array.next({values:d}),b.watch.next({values:d})}g={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},y.mount=!p.isValid||!!n.keepIsValid,y.watch=!!e.shouldUnregister,b.state.next({submitCount:n.keepSubmitCount?t.submitCount:0,isDirty:n.keepDirty||n.keepDirtyValues?t.isDirty:!!(n.keepDefaultValues&&!oe(r,s)),isSubmitted:n.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:n.keepDirty||n.keepDirtyValues?t.dirtyFields:n.keepDefaultValues&&r?Se(s,r):{},touchedFields:n.keepTouched?t.touchedFields:{},errors:n.keepErrors?t.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})};return{control:{register:Ee,unregister:pe,getFieldState:Me,_executeSchema:K,_focusError:Ie,_getWatch:x,_getDirty:v,_updateValid:P,_removeUnmounted:Z,_updateFieldArray:C,_getFieldArray:D,_subjects:b,_proxyFormState:p,get _fields(){return a},get _formValues(){return l},get _stateFlags(){return y},set _stateFlags(r){y=r},get _defaultValues(){return s},get _names(){return g},set _names(r){g=r},get _formState(){return t},set _formState(r){t=r},get _options(){return i},set _options(r){i={...i,...r}}},trigger:Q,register:Ee,handleSubmit:lt,watch:at,setValue:S,getValues:X,reset:(r,n)=>ct(ve(r)?r(l):r,n),resetField:ut,clearErrors:nt,unregister:pe,setError:ot,setFocus:(r,n={})=>{const o=f(a,r),c=o&&o._f;if(c){const d=c.refs?c.refs[0]:c.ref;d.focus&&(d.focus(),n.shouldSelect&&d.select())}},getFieldState:Me}}function Nt(e={}){const i=h.useRef(),[t,a]=h.useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});i.current||(i.current={...It(e),formState:t});const s=i.current.control;return s._options=e,wt({subject:s._subjects.state,callback:h.useCallback(l=>{Et(l,s._proxyFormState,!0)&&(s._formState={...s._formState,...l},a({...s._formState}))},[s])}),h.useEffect(()=>{s._stateFlags.mount||(s._proxyFormState.isValid&&s._updateValid(),s._stateFlags.mount=!0),s._stateFlags.watch&&(s._stateFlags.watch=!1,s._subjects.state.next({})),s._removeUnmounted()}),h.useEffect(()=>{t.submitCount&&s._focusError()},[s,t.submitCount]),i.current.formState=pt(t,s),i.current}var qt=(e=>(e.formgroup="formgroup",e.checkbox="checkbox",e.radiobutton="radiobutton",e.textarea="textarea",e.input="input",e.select="select",e.date="date",e))(qt||{});const Rr=e=>{const{exampleType:i="formgroup"}=e,{register:t,handleSubmit:a,formState:{errors:s}}=Nt(),l=new Date;l.setHours(0),l.setMinutes(0),l.setSeconds(0);const y=new Date;y.setDate(l.getDate()-5),y.setHours(6),y.setMinutes(10),y.setSeconds(0);const g=new Date;g.setDate(l.getDate()+5),g.setHours(22),g.setMinutes(0),g.setSeconds(0);const E="field1",V="field2",O="field3",p="field4",b="field5",U="field6",q="field7",re="field8",ae="field9",P=s.field1||s.field2||s.field3||s.field4||s.field5||s.field6||s.field7||s.field8||s.field9,C="Du m\xE5 velge et alternativ",H="Du m\xE5 velge to alternativ",A="Det kan ikke legges inn mer enn 40 tegn",z="Du m\xE5 skrive noe her",ie='Du m\xE5 velge "Option 2"',K=`Du m\xE5 velge dato mellom ${y.toLocaleDateString("nb")} og ${g.toLocaleDateString("nb")}`,J=`Du m\xE5 skrive inn tidspunkt mellom ${y.toLocaleTimeString("nb",{hour:"2-digit",minute:"2-digit"})} og ${g.toLocaleTimeString("nb",{hour:"2-digit",minute:"2-digit"})}`,R=k=>k.length>=2||H,Z=k=>k.toString()==="Option 2"||ie,v=(k,w,S)=>{const G=new Date(k);return!!k&&G.getTime()>=w.getTime()&&G.getTime()<=S.getTime()||K},x=(k,w)=>{const S=new Date;S.setHours(k),S.setMinutes(w),S.setSeconds(0);const G=y.toLocaleTimeString("nb"),Q=g.toLocaleTimeString("nb"),X=S.toLocaleTimeString("nb");return console.log("value",X),!!S&&X>=G&&X<=Q||J},D=()=>{if(i==="formgroup"){const k=[h.createElement(ee,{key:0,inputId:"checkbox1",label:"Checkbox 1",...t(E,{required:C})}),h.createElement(ee,{key:1,inputId:"checkbox2",label:"Checkbox 2",...t(E,{required:C})}),h.createElement(ee,{key:2,inputId:"checkbox3",label:"Checkbox 3",...t(E,{required:C})})];return[h.createElement(Y,{key:0,title:"Gruppe tittel",legend:"Velg minst en",error:s.field1?s.field1.message:void 0,variant:e.variant},h.createElement(gt,{maxColumns:ht.two},k.map(w=>w))),h.createElement(Y,{key:1,legend:"Velg minst to",error:s.field2?s.field2.message:void 0,variant:e.variant},h.createElement(ee,{inputId:"checkbox4",label:"Checkbox 4",...t(V,{validate:R})}),h.createElement(ee,{inputId:"checkbox5",label:"Checkbox 5",...t(V,{validate:R})}),h.createElement(ee,{inputId:"checkbox6",label:"Checkbox 6",...t(V,{validate:R})})),h.createElement(Y,{key:2,legend:"Velg en",error:s.field3?s.field3.message:void 0,variant:e.variant},h.createElement(ye,{inputId:"radiobutton1",label:"Radiobutton 1",...t(O,{required:C})}),h.createElement(ye,{inputId:"radiobutton2",label:"Radiobutton 2",...t(O,{required:C})}),h.createElement(ye,{inputId:"radiobutton3",label:"Radiobutton 3",...t(O,{required:C})})),h.createElement(Y,{key:3,error:s.field4?s.field4.message:void 0},h.createElement(Be,{defaultValue:`Dette er en test
|
|
1
|
+
import g from"react";import{isTest as pt}from"../../utils/environment.js";import{B as xt}from"../../Button.js";import{C as Z}from"../../Checkbox.js";import{F as Q}from"../../FormGroup.js";import{F as kt,a as _t}from"../../FormLayout.js";import $e from"../Icons/Hospital.js";import{I as de}from"../../Input.js";import{R as ge}from"../../RadioButton.js";import{S as We}from"../../Select.js";import{T as Ge}from"../../Textarea.js";import{V as Vt}from"../../Validation.js";import ve from"./styles.module.scss";import"classnames";import"../Icons/Icon.js";import"../../constants.js";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../hooks/useBreakpoint.js";import"../../theme/grid.js";import"../../hooks/useHover.js";import"../../hooks/useIcons.js";import"../../hooks/useSize.js";import"../../utils/debounce.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../Icons/ArrowRight.js";import"../Button/styles.module.scss";import"../Icons/Check.js";import"../Checkbox/styles.module.scss";import"../../utils/component.js";import"../../ErrorWrapper.js";import"../ErrorWrapper/styles.module.scss";import"../../Title.js";import"../Title/styles.module.scss";import"../FormGroup/styles.module.scss";import"../FormLayout/styles.module.scss";import"../../MaxCharacters.js";import"../MaxCharacters/styles.module.scss";import"../Input/styles.module.scss";import"../RadioButton/styles.module.scss";import"../Icons/ChevronDown.js";import"../Select/styles.module.scss";import"../Textarea/styles.module.scss";import"../Validation/styles.module.scss";var ye=e=>e.type==="checkbox",se=e=>e instanceof Date,R=e=>e==null;const tt=e=>typeof e=="object";var O=e=>!R(e)&&!Array.isArray(e)&&tt(e)&&!se(e),At=e=>O(e)&&e.target?ye(e.target)?e.target.checked:e.target.value:e,Dt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Et=(e,n)=>e.has(Dt(n)),St=e=>{const n=e.constructor&&e.constructor.prototype;return O(n)&&n.hasOwnProperty("isPrototypeOf")},Ce=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ee(e){let n;const i=Array.isArray(e);if(e instanceof Date)n=new Date(e);else if(e instanceof Set)n=new Set(e);else if(!(Ce&&(e instanceof Blob||e instanceof FileList))&&(i||O(e)))if(n=i?[]:{},!Array.isArray(e)&&!St(e))n=e;else for(const r in e)n[r]=ee(e[r]);else return e;return n}var me=e=>Array.isArray(e)?e.filter(Boolean):[],T=e=>e===void 0,f=(e,n,i)=>{if(!n||!O(e))return i;const r=me(n.split(/[,[\].]+?/)).reduce((s,o)=>R(s)?s:s[o],e);return T(r)||r===e?T(e[n])?i:e[n]:r};const Ke={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},W={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},J={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};g.createContext(null);var wt=(e,n,i,r=!0)=>{const s={defaultValues:n._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const c=o;return n._proxyFormState[c]!==W.all&&(n._proxyFormState[c]=!r||W.all),i&&(i[c]=!0),e[c]}});return s},B=e=>O(e)&&!Object.keys(e).length,Ft=(e,n,i,r)=>{i(e);const{name:s,...o}=e;return B(o)||Object.keys(o).length>=Object.keys(n).length||Object.keys(o).find(c=>n[c]===(!r||W.all))},Ee=e=>Array.isArray(e)?e:[e];function Tt(e){const n=g.useRef(e);n.current=e,g.useEffect(()=>{const i=!e.disabled&&n.current.subject&&n.current.subject.subscribe({next:n.current.next});return()=>{i&&i.unsubscribe()}},[e.disabled])}var K=e=>typeof e=="string",Ot=(e,n,i,r,s)=>K(e)?(r&&n.watch.add(e),f(i,e,s)):Array.isArray(e)?e.map(o=>(r&&n.watch.add(o),f(i,o))):(r&&(n.watchAll=!0),i),Le=e=>/^\w*$/.test(e),rt=e=>me(e.replace(/["|']|\]/g,"").split(/\.|\[/));function A(e,n,i){let r=-1;const s=Le(n)?[n]:rt(n),o=s.length,c=o-1;for(;++r<o;){const b=s[r];let k=i;if(r!==c){const L=e[b];k=O(L)||Array.isArray(L)?L:isNaN(+s[r+1])?{}:[]}e[b]=k,e=e[b]}return e}var Ct=(e,n,i,r,s)=>n?{...i[e],types:{...i[e]&&i[e].types?i[e].types:{},[r]:s||!0}}:{};const Oe=(e,n,i)=>{for(const r of i||Object.keys(e)){const s=f(e,r);if(s){const{_f:o,...c}=s;if(o&&n(o.name)){if(o.ref.focus){o.ref.focus();break}else if(o.refs&&o.refs[0].focus){o.refs[0].focus();break}}else O(c)&&Oe(c,n)}}};var je=e=>({isOnSubmit:!e||e===W.onSubmit,isOnBlur:e===W.onBlur,isOnChange:e===W.onChange,isOnAll:e===W.all,isOnTouch:e===W.onTouched}),ze=(e,n,i)=>!i&&(n.watchAll||n.watch.has(e)||[...n.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),Lt=(e,n,i)=>{const r=me(f(e,i));return A(r,"root",n[i]),A(e,i,r),e},ne=e=>typeof e=="boolean",Me=e=>e.type==="file",ae=e=>typeof e=="function",be=e=>{if(!Ce)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},he=e=>K(e),Re=e=>e.type==="radio",pe=e=>e instanceof RegExp;const Je={value:!1,isValid:!1},Qe={value:!0,isValid:!0};var it=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(i=>i&&i.checked&&!i.disabled).map(i=>i.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!T(e[0].attributes.value)?T(e[0].value)||e[0].value===""?Qe:{value:e[0].value,isValid:!0}:Qe:Je}return Je};const Xe={isValid:!1,value:null};var st=e=>Array.isArray(e)?e.reduce((n,i)=>i&&i.checked&&!i.disabled?{isValid:!0,value:i.value}:n,Xe):Xe;function Ye(e,n,i="validate"){if(he(e)||Array.isArray(e)&&e.every(he)||ne(e)&&!e)return{type:i,message:he(e)?e:"",ref:n}}var ie=e=>O(e)&&!pe(e)?e:{value:e,message:""},Ze=async(e,n,i,r,s)=>{const{ref:o,refs:c,required:b,maxLength:k,minLength:L,min:P,max:D,pattern:x,validate:H,name:I,valueAsNumber:le,mount:re,disabled:oe}=e._f,v=f(n,I);if(!re||oe)return{};const q=c?c[0]:o,U=_=>{r&&q.reportValidity&&(q.setCustomValidity(ne(_)?"":_||""),q.reportValidity())},S={},X=Re(o),Y=ye(o),ue=X||Y,N=(le||Me(o))&&T(o.value)&&T(v)||be(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,G=Ct.bind(null,I,i,S),$=(_,p,h,V=J.maxLength,w=J.minLength)=>{const M=_?p:h;S[I]={type:_?V:w,message:M,ref:o,...G(_?V:w,M)}};if(s?!Array.isArray(v)||!v.length:b&&(!ue&&(N||R(v))||ne(v)&&!v||Y&&!it(c).isValid||X&&!st(c).isValid)){const{value:_,message:p}=he(b)?{value:!!b,message:b}:ie(b);if(_&&(S[I]={type:J.required,message:p,ref:q,...G(J.required,p)},!i))return U(p),S}if(!N&&(!R(P)||!R(D))){let _,p;const h=ie(D),V=ie(P);if(!R(v)&&!isNaN(v)){const w=o.valueAsNumber||v&&+v;R(h.value)||(_=w>h.value),R(V.value)||(p=w<V.value)}else{const w=o.valueAsDate||new Date(v),M=ce=>new Date(new Date().toDateString()+" "+ce),j=o.type=="time",z=o.type=="week";K(h.value)&&v&&(_=j?M(v)>M(h.value):z?v>h.value:w>new Date(h.value)),K(V.value)&&v&&(p=j?M(v)<M(V.value):z?v<V.value:w<new Date(V.value))}if((_||p)&&($(!!_,h.message,V.message,J.max,J.min),!i))return U(S[I].message),S}if((k||L)&&!N&&(K(v)||s&&Array.isArray(v))){const _=ie(k),p=ie(L),h=!R(_.value)&&v.length>_.value,V=!R(p.value)&&v.length<p.value;if((h||V)&&($(h,_.message,p.message),!i))return U(S[I].message),S}if(x&&!N&&K(v)){const{value:_,message:p}=ie(x);if(pe(_)&&!v.match(_)&&(S[I]={type:J.pattern,message:p,ref:o,...G(J.pattern,p)},!i))return U(p),S}if(H){if(ae(H)){const _=await H(v,n),p=Ye(_,q);if(p&&(S[I]={...p,...G(J.validate,p.message)},!i))return U(p.message),S}else if(O(H)){let _={};for(const p in H){if(!B(_)&&!i)break;const h=Ye(await H[p](v,n),q,p);h&&(_={...h,...G(p,h.message)},U(h.message),i&&(S[I]=_))}if(!B(_)&&(S[I]={ref:q,..._},!i))return S}}return U(!0),S};function Mt(e,n){const i=n.slice(0,-1).length;let r=0;for(;r<i;)e=T(e)?r++:e[n[r++]];return e}function Rt(e){for(const n in e)if(!T(e[n]))return!1;return!0}function C(e,n){const i=Array.isArray(n)?n:Le(n)?[n]:rt(n),r=i.length===1?e:Mt(e,i),s=i.length-1,o=i[s];return r&&delete r[o],s!==0&&(O(r)&&B(r)||Array.isArray(r)&&Rt(r))&&C(e,i.slice(0,-1)),e}function Se(){let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}}var xe=e=>R(e)||!tt(e);function te(e,n){if(xe(e)||xe(n))return e===n;if(se(e)&&se(n))return e.getTime()===n.getTime();const i=Object.keys(e),r=Object.keys(n);if(i.length!==r.length)return!1;for(const s of i){const o=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const c=n[s];if(se(o)&&se(c)||O(o)&&O(c)||Array.isArray(o)&&Array.isArray(c)?!te(o,c):o!==c)return!1}}return!0}var nt=e=>e.type==="select-multiple",It=e=>Re(e)||ye(e),we=e=>be(e)&&e.isConnected,at=e=>{for(const n in e)if(ae(e[n]))return!0;return!1};function ke(e,n={}){const i=Array.isArray(e);if(O(e)||i)for(const r in e)Array.isArray(e[r])||O(e[r])&&!at(e[r])?(n[r]=Array.isArray(e[r])?[]:{},ke(e[r],n[r])):R(e[r])||(n[r]=!0);return n}function lt(e,n,i){const r=Array.isArray(e);if(O(e)||r)for(const s in e)Array.isArray(e[s])||O(e[s])&&!at(e[s])?T(n)||xe(i[s])?i[s]=Array.isArray(e[s])?ke(e[s],[]):{...ke(e[s])}:lt(e[s],R(n)?{}:n[s],i[s]):i[s]=!te(e[s],n[s]);return i}var Fe=(e,n)=>lt(e,n,ke(n)),ot=(e,{valueAsNumber:n,valueAsDate:i,setValueAs:r})=>T(e)?e:n?e===""?NaN:e&&+e:i&&K(e)?new Date(e):r?r(e):e;function Te(e){const n=e.ref;if(!(e.refs?e.refs.every(i=>i.disabled):n.disabled))return Me(n)?n.files:Re(n)?st(e.refs).value:nt(n)?[...n.selectedOptions].map(({value:i})=>i):ye(n)?it(e.refs).value:ot(T(n.value)?e.ref.value:n.value,e)}var Nt=(e,n,i,r)=>{const s={};for(const o of e){const c=f(n,o);c&&A(s,o,c._f)}return{criteriaMode:i,names:[...e],fields:s,shouldUseNativeValidation:r}},fe=e=>T(e)?e:pe(e)?e.source:O(e)?pe(e.value)?e.value.source:e.value:e,qt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function et(e,n,i){const r=f(e,i);if(r||Le(i))return{error:r,name:i};const s=i.split(".");for(;s.length;){const o=s.join("."),c=f(n,o),b=f(e,o);if(c&&!Array.isArray(c)&&i!==o)return{name:i};if(b&&b.type)return{name:o,error:b};s.pop()}return{name:i}}var Ut=(e,n,i,r,s)=>s.isOnAll?!1:!i&&s.isOnTouch?!(n||e):(i?r.isOnBlur:s.isOnBlur)?!e:(i?r.isOnChange:s.isOnChange)?e:!0,Bt=(e,n)=>!me(f(e,n)).length&&C(e,n);const Pt={mode:W.onSubmit,reValidateMode:W.onChange,shouldFocusError:!0};function Ht(e={},n){let i={...Pt,...e},r={submitCount:0,isDirty:!1,isLoading:!0,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},s={},o=O(i.defaultValues)||O(i.values)?ee(i.defaultValues||i.values)||{}:{},c=i.shouldUnregister?{}:ee(o),b={action:!1,mount:!1,watch:!1},k={mount:new Set,unMount:new Set,array:new Set,watch:new Set},L,P=0;const D={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},x={values:Se(),array:Se(),state:Se()},H=e.resetOptions&&e.resetOptions.keepDirtyValues,I=je(i.mode),le=je(i.reValidateMode),re=i.criteriaMode===W.all,oe=t=>a=>{clearTimeout(P),P=setTimeout(t,a)},v=async t=>{if(D.isValid||t){const a=i.resolver?B((await N()).errors):await $(s,!0);a!==r.isValid&&x.state.next({isValid:a})}},q=t=>D.isValidating&&x.state.next({isValidating:t}),U=(t,a=[],l,d,y=!0,u=!0)=>{if(d&&l){if(b.action=!0,u&&Array.isArray(f(s,t))){const m=l(f(s,t),d.argA,d.argB);y&&A(s,t,m)}if(u&&Array.isArray(f(r.errors,t))){const m=l(f(r.errors,t),d.argA,d.argB);y&&A(r.errors,t,m),Bt(r.errors,t)}if(D.touchedFields&&u&&Array.isArray(f(r.touchedFields,t))){const m=l(f(r.touchedFields,t),d.argA,d.argB);y&&A(r.touchedFields,t,m)}D.dirtyFields&&(r.dirtyFields=Fe(o,c)),x.state.next({name:t,isDirty:p(t,a),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else A(c,t,a)},S=(t,a)=>{A(r.errors,t,a),x.state.next({errors:r.errors})},X=(t,a,l,d)=>{const y=f(s,t);if(y){const u=f(c,t,T(l)?f(o,t):l);T(u)||d&&d.defaultChecked||a?A(c,t,a?u:Te(y._f)):w(t,u),b.mount&&v()}},Y=(t,a,l,d,y)=>{let u=!1,m=!1;const F={name:t};if(!l||d){D.isDirty&&(m=r.isDirty,r.isDirty=F.isDirty=p(),u=m!==F.isDirty);const E=te(f(o,t),a);m=f(r.dirtyFields,t),E?C(r.dirtyFields,t):A(r.dirtyFields,t,!0),F.dirtyFields=r.dirtyFields,u=u||D.dirtyFields&&m!==!E}if(l){const E=f(r.touchedFields,t);E||(A(r.touchedFields,t,l),F.touchedFields=r.touchedFields,u=u||D.touchedFields&&E!==l)}return u&&y&&x.state.next(F),u?F:{}},ue=(t,a,l,d)=>{const y=f(r.errors,t),u=D.isValid&&ne(a)&&r.isValid!==a;if(e.delayError&&l?(L=oe(()=>S(t,l)),L(e.delayError)):(clearTimeout(P),L=null,l?A(r.errors,t,l):C(r.errors,t)),(l?!te(y,l):y)||!B(d)||u){const m={...d,...u&&ne(a)?{isValid:a}:{},errors:r.errors,name:t};r={...r,...m},x.state.next(m)}q(!1)},N=async t=>i.resolver(c,i.context,Nt(t||k.mount,s,i.criteriaMode,i.shouldUseNativeValidation)),G=async t=>{const{errors:a}=await N();if(t)for(const l of t){const d=f(a,l);d?A(r.errors,l,d):C(r.errors,l)}else r.errors=a;return a},$=async(t,a,l={valid:!0})=>{for(const d in t){const y=t[d];if(y){const{_f:u,...m}=y;if(u){const F=k.array.has(u.name),E=await Ze(y,c,re,i.shouldUseNativeValidation,F);if(E[u.name]&&(l.valid=!1,a))break;!a&&(f(E,u.name)?F?Lt(r.errors,E,u.name):A(r.errors,u.name,E[u.name]):C(r.errors,u.name))}m&&await $(m,a,l)}}return l.valid},_=()=>{for(const t of k.unMount){const a=f(s,t);a&&(a._f.refs?a._f.refs.every(l=>!we(l)):!we(a._f.ref))&&_e(t)}k.unMount=new Set},p=(t,a)=>(t&&a&&A(c,t,a),!te(Ie(),o)),h=(t,a,l)=>Ot(t,k,{...b.mount?c:T(a)?o:K(t)?{[t]:a}:a},l,a),V=t=>me(f(b.mount?c:o,t,e.shouldUnregister?f(o,t,[]):[])),w=(t,a,l={})=>{const d=f(s,t);let y=a;if(d){const u=d._f;u&&(!u.disabled&&A(c,t,ot(a,u)),y=be(u.ref)&&R(a)?"":a,nt(u.ref)?[...u.ref.options].forEach(m=>m.selected=y.includes(m.value)):u.refs?ye(u.ref)?u.refs.length>1?u.refs.forEach(m=>(!m.defaultChecked||!m.disabled)&&(m.checked=Array.isArray(y)?!!y.find(F=>F===m.value):y===m.value)):u.refs[0]&&(u.refs[0].checked=!!y):u.refs.forEach(m=>m.checked=m.value===y):Me(u.ref)?u.ref.value="":(u.ref.value=y,u.ref.type||x.values.next({name:t,values:{...c}})))}(l.shouldDirty||l.shouldTouch)&&Y(t,y,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&ce(t)},M=(t,a,l)=>{for(const d in a){const y=a[d],u=`${t}.${d}`,m=f(s,u);(k.array.has(t)||!xe(y)||m&&!m._f)&&!se(y)?M(u,y,l):w(u,y,l)}},j=(t,a,l={})=>{const d=f(s,t),y=k.array.has(t),u=ee(a);A(c,t,u),y?(x.array.next({name:t,values:{...c}}),(D.isDirty||D.dirtyFields)&&l.shouldDirty&&x.state.next({name:t,dirtyFields:Fe(o,c),isDirty:p(t,u)})):d&&!d._f&&!R(u)?M(t,u,l):w(t,u,l),ze(t,k)&&x.state.next({...r}),x.values.next({name:t,values:{...c}}),!b.mount&&n()},z=async t=>{const a=t.target;let l=a.name;const d=f(s,l),y=()=>a.type?Te(d._f):At(t);if(d){let u,m;const F=y(),E=t.type===Ke.BLUR||t.type===Ke.FOCUS_OUT,vt=!qt(d._f)&&!i.resolver&&!f(r.errors,l)&&!d._f.deps||Ut(E,f(r.touchedFields,l),r.isSubmitted,le,I),Ae=ze(l,k,E);A(c,l,F),E?(d._f.onBlur&&d._f.onBlur(t),L&&L(0)):d._f.onChange&&d._f.onChange(t);const De=Y(l,F,E,!1),ht=!B(De)||Ae;if(!E&&x.values.next({name:l,type:t.type,values:{...c}}),vt)return D.isValid&&v(),ht&&x.state.next({name:l,...Ae?{}:De});if(!E&&Ae&&x.state.next({...r}),q(!0),i.resolver){const{errors:Pe}=await N([l]),bt=et(r.errors,s,l),He=et(Pe,s,bt.name||l);u=He.error,l=He.name,m=B(Pe)}else u=(await Ze(d,c,re,i.shouldUseNativeValidation))[l],u?m=!1:D.isValid&&(m=await $(s,!0));d._f.deps&&ce(d._f.deps),ue(l,m,u,De)}},ce=async(t,a={})=>{let l,d;const y=Ee(t);if(q(!0),i.resolver){const u=await G(T(t)?t:y);l=B(u),d=t?!y.some(m=>f(u,m)):l}else t?(d=(await Promise.all(y.map(async u=>{const m=f(s,u);return await $(m&&m._f?{[u]:m}:m)}))).every(Boolean),!(!d&&!r.isValid)&&v()):d=l=await $(s);return x.state.next({...!K(t)||D.isValid&&l!==r.isValid?{}:{name:t},...i.resolver||!t?{isValid:l}:{},errors:r.errors,isValidating:!1}),a.shouldFocus&&!d&&Oe(s,u=>u&&f(r.errors,u),t?y:k.mount),d},Ie=t=>{const a={...o,...b.mount?c:{}};return T(t)?a:K(t)?f(a,t):t.map(l=>f(a,l))},Ne=(t,a)=>({invalid:!!f((a||r).errors,t),isDirty:!!f((a||r).dirtyFields,t),isTouched:!!f((a||r).touchedFields,t),error:f((a||r).errors,t)}),ut=t=>{t&&Ee(t).forEach(a=>C(r.errors,a)),x.state.next({errors:t?r.errors:{}})},ct=(t,a,l)=>{const d=(f(s,t,{_f:{}})._f||{}).ref;A(r.errors,t,{...a,ref:d}),x.state.next({name:t,errors:r.errors,isValid:!1}),l&&l.shouldFocus&&d&&d.focus&&d.focus()},dt=(t,a)=>ae(t)?x.values.subscribe({next:l=>t(h(void 0,a),l)}):h(t,a,!0),_e=(t,a={})=>{for(const l of t?Ee(t):k.mount)k.mount.delete(l),k.array.delete(l),f(s,l)&&(a.keepValue||(C(s,l),C(c,l)),!a.keepError&&C(r.errors,l),!a.keepDirty&&C(r.dirtyFields,l),!a.keepTouched&&C(r.touchedFields,l),!i.shouldUnregister&&!a.keepDefaultValue&&C(o,l));x.values.next({values:{...c}}),x.state.next({...r,...a.keepDirty?{isDirty:p()}:{}}),!a.keepIsValid&&v()},Ve=(t,a={})=>{let l=f(s,t);const d=ne(a.disabled);return A(s,t,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:t}},name:t,mount:!0,...a}}),k.mount.add(t),l?d&&A(c,t,a.disabled?void 0:f(c,t,Te(l._f))):X(t,!0,a.value),{...d?{disabled:a.disabled}:{},...i.shouldUseNativeValidation?{required:!!a.required,min:fe(a.min),max:fe(a.max),minLength:fe(a.minLength),maxLength:fe(a.maxLength),pattern:fe(a.pattern)}:{},name:t,onChange:z,onBlur:z,ref:y=>{if(y){Ve(t,a),l=f(s,t);const u=T(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,m=It(u),F=l._f.refs||[];if(m?F.find(E=>E===u):u===l._f.ref)return;A(s,t,{_f:{...l._f,...m?{refs:[...F.filter(we),u,...Array.isArray(f(o,t))?[{}]:[]],ref:{type:u.type,name:t}}:{ref:u}}}),X(t,!1,void 0,u)}else l=f(s,t,{}),l._f&&(l._f.mount=!1),(i.shouldUnregister||a.shouldUnregister)&&!(Et(k.array,t)&&b.action)&&k.unMount.add(t)}}},qe=()=>i.shouldFocusError&&Oe(s,t=>t&&f(r.errors,t),k.mount),ft=(t,a)=>async l=>{l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let d=ee(c);if(x.state.next({isSubmitting:!0}),i.resolver){const{errors:y,values:u}=await N();r.errors=y,d=u}else await $(s);C(r.errors,"root"),B(r.errors)?(x.state.next({errors:{}}),await t(d,l)):(a&&await a({...r.errors},l),qe(),setTimeout(qe)),x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:B(r.errors),submitCount:r.submitCount+1,errors:r.errors})},yt=(t,a={})=>{f(s,t)&&(T(a.defaultValue)?j(t,f(o,t)):(j(t,a.defaultValue),A(o,t,a.defaultValue)),a.keepTouched||C(r.touchedFields,t),a.keepDirty||(C(r.dirtyFields,t),r.isDirty=a.defaultValue?p(t,f(o,t)):p()),a.keepError||(C(r.errors,t),D.isValid&&v()),x.state.next({...r}))},Ue=(t,a={})=>{const l=t||o,d=ee(l),y=t&&!B(t)?d:o;if(a.keepDefaultValues||(o=l),!a.keepValues){if(a.keepDirtyValues||H)for(const u of k.mount)f(r.dirtyFields,u)?A(y,u,f(c,u)):j(u,f(y,u));else{if(Ce&&T(t))for(const u of k.mount){const m=f(s,u);if(m&&m._f){const F=Array.isArray(m._f.refs)?m._f.refs[0]:m._f.ref;if(be(F)){const E=F.closest("form");if(E){E.reset();break}}}}s={}}c=e.shouldUnregister?a.keepDefaultValues?ee(o):{}:d,x.array.next({values:{...y}}),x.values.next({values:{...y}})}k={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!b.mount&&n(),b.mount=!D.isValid||!!a.keepIsValid,b.watch=!!e.shouldUnregister,x.state.next({submitCount:a.keepSubmitCount?r.submitCount:0,isDirty:a.keepDirty?r.isDirty:!!(a.keepDefaultValues&&!te(t,o)),isSubmitted:a.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:a.keepDirtyValues?r.dirtyFields:a.keepDefaultValues&&t?Fe(o,t):{},touchedFields:a.keepTouched?r.touchedFields:{},errors:a.keepErrors?r.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},Be=(t,a)=>Ue(ae(t)?t(c):t,a),mt=(t,a={})=>{const l=f(s,t),d=l&&l._f;if(d){const y=d.refs?d.refs[0]:d.ref;y.focus&&(y.focus(),a.shouldSelect&&y.select())}},gt=t=>{r={...r,...t}};return ae(i.defaultValues)&&i.defaultValues().then(t=>{Be(t,i.resetOptions),x.state.next({isLoading:!1})}),{control:{register:Ve,unregister:_e,getFieldState:Ne,_executeSchema:N,_getWatch:h,_getDirty:p,_updateValid:v,_removeUnmounted:_,_updateFieldArray:U,_getFieldArray:V,_reset:Ue,_updateFormState:gt,_subjects:x,_proxyFormState:D,get _fields(){return s},get _formValues(){return c},get _state(){return b},set _state(t){b=t},get _defaultValues(){return o},get _names(){return k},set _names(t){k=t},get _formState(){return r},set _formState(t){r=t},get _options(){return i},set _options(t){i={...i,...t}}},trigger:ce,register:Ve,handleSubmit:ft,watch:dt,setValue:j,getValues:Ie,reset:Be,resetField:yt,clearErrors:ut,unregister:_e,setError:ct,setFocus:mt,getFieldState:Ne}}function $t(e={}){const n=g.useRef(),[i,r]=g.useState({isDirty:!1,isValidating:!1,isLoading:!0,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:ae(e.defaultValues)?void 0:e.defaultValues});n.current||(n.current={...Ht(e,()=>r(o=>({...o}))),formState:i});const s=n.current.control;return s._options=e,Tt({subject:s._subjects.state,next:o=>{Ft(o,s._proxyFormState,s._updateFormState,!0)&&r({...s._formState})}}),g.useEffect(()=>{e.values&&!te(e.values,s._defaultValues)&&s._reset(e.values,s._options.resetOptions)},[e.values,s]),g.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),n.current.formState=wt(i,s),n.current}var Wt=(e=>(e.formgroup="formgroup",e.checkbox="checkbox",e.radiobutton="radiobutton",e.textarea="textarea",e.input="input",e.select="select",e.date="date",e))(Wt||{});const Gt=e=>{const{exampleType:n="formgroup"}=e,{register:i,handleSubmit:r,formState:{errors:s}}=$t(),o=new Date;o.setHours(0),o.setMinutes(0),o.setSeconds(0);const c=new Date;c.setDate(o.getDate()-5),c.setHours(6),c.setMinutes(10),c.setSeconds(0);const b=new Date;b.setDate(o.getDate()+5),b.setHours(22),b.setMinutes(0),b.setSeconds(0);const k="field1",L="field2",P="field3",D="field4",x="field5",H="field6",I="field7",le="field8",re="field9",oe=s.field1||s.field2||s.field3||s.field4||s.field5||s.field6||s.field7||s.field8||s.field9,v="Du må velge et alternativ",q="Du må velge to alternativ",U="Det kan ikke legges inn mer enn 40 tegn",S="Du må skrive noe her",X='Du må velge "Option 2"',Y=`Du må velge dato mellom ${c.toLocaleDateString("nb")} og ${b.toLocaleDateString("nb")}`,ue=`Du må skrive inn tidspunkt mellom ${c.toLocaleTimeString("nb",{hour:"2-digit",minute:"2-digit"})} og ${b.toLocaleTimeString("nb",{hour:"2-digit",minute:"2-digit"})}`,N=h=>h.length>=2||q,G=h=>h.toString()==="Option 2"||X,$=(h,V,w)=>{const M=new Date(h);return!!h&&M.getTime()>=V.getTime()&&M.getTime()<=w.getTime()||Y},_=(h,V)=>{const w=new Date;w.setHours(h),w.setMinutes(V),w.setSeconds(0);const M=c.toLocaleTimeString("nb"),j=b.toLocaleTimeString("nb"),z=w.toLocaleTimeString("nb");return console.log("value",z),!!w&&z>=M&&z<=j||ue},p=()=>{if(n==="formgroup"){const h=[g.createElement(Z,{key:0,inputId:"checkbox1",label:"Checkbox 1",...i(k,{required:v})}),g.createElement(Z,{key:1,inputId:"checkbox2",label:"Checkbox 2",...i(k,{required:v})}),g.createElement(Z,{key:2,inputId:"checkbox3",label:"Checkbox 3",...i(k,{required:v})})];return[g.createElement(Q,{key:0,title:"Gruppe tittel",legend:"Velg minst en",error:s.field1?s.field1.message:void 0,variant:e.variant},g.createElement(kt,{maxColumns:_t.two},h.map(V=>V))),g.createElement(Q,{key:1,legend:"Velg minst to",error:s.field2?s.field2.message:void 0,variant:e.variant},g.createElement(Z,{inputId:"checkbox4",label:"Checkbox 4",...i(L,{validate:N})}),g.createElement(Z,{inputId:"checkbox5",label:"Checkbox 5",...i(L,{validate:N})}),g.createElement(Z,{inputId:"checkbox6",label:"Checkbox 6",...i(L,{validate:N})})),g.createElement(Q,{key:2,legend:"Velg en",error:s.field3?s.field3.message:void 0,variant:e.variant},g.createElement(ge,{inputId:"radiobutton1",label:"Radiobutton 1",...i(P,{required:v})}),g.createElement(ge,{inputId:"radiobutton2",label:"Radiobutton 2",...i(P,{required:v})}),g.createElement(ge,{inputId:"radiobutton3",label:"Radiobutton 3",...i(P,{required:v})})),g.createElement(Q,{key:3,error:s.field4?s.field4.message:void 0},g.createElement(Ge,{defaultValue:`Dette er en test
|
|
2
2
|
|
|
3
3
|
Hello
|
|
4
4
|
|
|
5
5
|
test
|
|
6
6
|
|
|
7
|
-
test test`,grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",...
|
|
7
|
+
test test`,grow:!0,maxCharacters:40,minRows:5,label:"Skriv din historie her",textareaId:"textarea1",...i(D,{maxLength:{value:40,message:U}})})),g.createElement(Q,{key:4,variant:e.variant,error:s.field5?s.field5.message:void 0},g.createElement(de,{label:"Skriv inn din tekst",placeholder:"Skriv noe!",icon:$e,...i(x,{required:S})})),g.createElement(Q,{key:5,variant:e.variant,error:s.field6?s.field6.message:void 0},g.createElement(We,{label:"Skriv inn din tekst",...i(H,{validate:G})},g.createElement("option",{value:"Option 1"},"Option 1"),g.createElement("option",{value:"Option 2"},"Option 2"),g.createElement("option",{value:"Option 3"},"Option 3")))]}else{if(n==="checkbox")return g.createElement(Z,{inputId:"checkbox1",label:"Checkbox 1",errorText:s.field1?s.field1.message:void 0,variant:e.variant,...i(k,{required:v})});if(n==="radiobutton")return g.createElement(ge,{inputId:"radiobutton1",label:"Radiobutton 1",errorText:s.field3?s.field3.message:void 0,variant:e.variant,...i(P,{required:v})});if(n==="textarea")return g.createElement(Ge,{defaultValue:`Dette er min historie
|
|
8
8
|
|
|
9
9
|
Hello
|
|
10
10
|
|
|
11
|
-
test`,grow:!0,maxCharacters:40,minRows:5,errorText:s.field4?s.field4.message:void 0,label:"Skriv din historie her",textareaId:"textarea1",...
|
|
11
|
+
test`,grow:!0,maxCharacters:40,minRows:5,errorText:s.field4?s.field4.message:void 0,label:"Skriv din historie her",textareaId:"textarea1",...i(D,{maxLength:{value:40,message:U}})});if(n==="input")return g.createElement(de,{inputId:"input1",label:"Skriv inn din tekst",placeholder:"Skriv noe!",errorText:s.field5?s.field5.message:void 0,icon:$e,...i(x,{required:S})});if(n==="select")return g.createElement(We,{errorText:s.field6?s.field6.message:void 0,label:"Skriv inn din tekst",...i(H,{validate:G})},g.createElement("option",{value:"Option 1"},"Option 1"),g.createElement("option",{value:"Option 2"},"Option 2"),g.createElement("option",{value:"Option 3"},"Option 3"));if(n==="date"){const h=s.field7||s.field8||s.field9;return g.createElement(g.Fragment,null,g.createElement(Q,{legend:"Velg en dato og et klokkeslett",fieldsetClassName:ve["date-time"],error:h?h.message:void 0},g.createElement(de,{className:ve["date-time__date-picker"],label:"dato",width:20,type:"date",defaultValue:o.toLocaleDateString("en-CA"),min:c.toLocaleDateString("en-CA"),max:b.toLocaleDateString("en-CA"),...i(I,{validate:V=>$(V,c,b)})}),g.createElement(Q,{htmlMarkup:"div",fieldsetClassName:ve["date-time__time-wrapper"]},g.createElement(de,{labelId:"time-label-id",label:"klokke",width:4,type:"number",defaultValue:o.toLocaleTimeString("nb",{hour:"2-digit"}),max:23,min:0,...i(le,{validate:V=>_(V,V)})}),g.createElement("span",{className:ve["date-time__time-separator"]},":"),g.createElement(de,{"aria-labelledby":"time-label-id",width:4,type:"number",defaultValue:o.toLocaleTimeString("nb",{minute:"2-digit"}),max:59,min:0,...i(re,{validate:V=>_(7,V)})}))))}}};return g.createElement("form",{noValidate:!0,onSubmit:r(h=>{!pt()&&console.log(h)})},g.createElement(Vt,{variant:e.variant,errorSummary:oe?"Sjekk at alt er riktig utfylt":void 0},p()),g.createElement(xt,{type:"submit"},"Send inn"))},Ur=Gt;export{Gt as FormExample,Wt as FormExampleVariants,Ur as default};
|
|
12
12
|
//# sourceMappingURL=index.js.map
|