@helsenorge/designsystem-react 13.5.0 → 13.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AnchorLink.js +2 -2
- package/lib/AnchorLink.js.map +1 -1
- package/lib/Avatar.js +2 -2
- package/lib/Avatar.js.map +1 -1
- package/lib/Badge.js +2 -2
- package/lib/Badge.js.map +1 -1
- package/lib/Button.js +6 -6
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +36 -1
- package/lib/Checkbox.js +6 -6
- package/lib/Checkbox.js.map +1 -1
- package/lib/Close.js +3 -3
- package/lib/Close.js.map +1 -1
- package/lib/DictionaryTrigger.js +2 -2
- package/lib/DictionaryTrigger.js.map +1 -1
- package/lib/Drawer.js +5 -5
- package/lib/Drawer.js.map +1 -1
- package/lib/Duolist.js +8 -5
- package/lib/Duolist.js.map +1 -1
- package/lib/ElementHeader.js +9 -9
- package/lib/ElementHeader.js.map +1 -1
- package/lib/ElementHeaderText.js +4 -4
- package/lib/ElementHeaderText.js.map +1 -1
- package/lib/ErrorWrapper.js +2 -2
- package/lib/ErrorWrapper.js.map +1 -1
- package/lib/Expander.js +12 -8
- package/lib/Expander.js.map +1 -1
- package/lib/FormFieldTag.js +2 -2
- package/lib/FormFieldTag.js.map +1 -1
- package/lib/FormGroup.js +9 -8
- package/lib/FormGroup.js.map +1 -1
- package/lib/FormLayout.js +3 -3
- package/lib/FormLayout.js.map +1 -1
- package/lib/HelpDetails.js +3 -3
- package/lib/HelpDetails.js.map +1 -1
- package/lib/HelpTriggerIcon.js +2 -2
- package/lib/HelpTriggerIcon.js.map +1 -1
- package/lib/HelpTriggerStandalone.js +2 -2
- package/lib/HelpTriggerStandalone.js.map +1 -1
- package/lib/HighlightPanel.js +3 -3
- package/lib/HighlightPanel.js.map +1 -1
- package/lib/HorizontalScroll.js +4 -4
- package/lib/HorizontalScroll.js.map +1 -1
- package/lib/Icon.js +2 -2
- package/lib/Icon.js.map +1 -1
- package/lib/InfoTeaser.js +5 -4
- package/lib/InfoTeaser.js.map +1 -1
- package/lib/Input.js +4 -4
- package/lib/Input.js.map +1 -1
- package/lib/Label.js +5 -5
- package/lib/Label.js.map +1 -1
- package/lib/LinkList.js +5 -5
- package/lib/LinkList.js.map +1 -1
- package/lib/List.js +2 -2
- package/lib/List.js.map +1 -1
- package/lib/ListEditMode.js +4 -4
- package/lib/ListEditMode.js.map +1 -1
- package/lib/MaxCharacters.js +2 -2
- package/lib/MaxCharacters.js.map +1 -1
- package/lib/Panel.js +63 -39
- package/lib/Panel.js.map +1 -1
- package/lib/PanelOld.js +14 -14
- package/lib/PanelOld.js.map +1 -1
- package/lib/PanelTitle.js +2 -2
- package/lib/PanelTitle.js.map +1 -1
- package/lib/PopOver.js +2 -2
- package/lib/PopOver.js.map +1 -1
- package/lib/RadioButton.js +5 -5
- package/lib/RadioButton.js.map +1 -1
- package/lib/Select.js +4 -4
- package/lib/Select.js.map +1 -1
- package/lib/SingleSelectItem.js +3 -3
- package/lib/SingleSelectItem.js.map +1 -1
- package/lib/Slider.js +4 -4
- package/lib/Slider.js.map +1 -1
- package/lib/Spacer.js +2 -2
- package/lib/Spacer.js.map +1 -1
- package/lib/StatusDot.js +4 -4
- package/lib/StatusDot.js.map +1 -1
- package/lib/StatusDotList.js +2 -2
- package/lib/StatusDotList.js.map +1 -1
- package/lib/StepButtons.js +5 -5
- package/lib/StepButtons.js.map +1 -1
- package/lib/TabList.js +8 -8
- package/lib/TabList.js.map +1 -1
- package/lib/TabPanel.js +2 -2
- package/lib/TabPanel.js.map +1 -1
- package/lib/Table.js +2 -2
- package/lib/Table.js.map +1 -1
- package/lib/TableBody.js +2 -2
- package/lib/TableBody.js.map +1 -1
- package/lib/TableCell.js +2 -2
- package/lib/TableCell.js.map +1 -1
- package/lib/TableExpandedRow.js +4 -4
- package/lib/TableExpandedRow.js.map +1 -1
- package/lib/TableExpanderCell.js +2 -2
- package/lib/TableExpanderCell.js.map +1 -1
- package/lib/TableHead.js +2 -2
- package/lib/TableHead.js.map +1 -1
- package/lib/TableHeadCell.js +3 -3
- package/lib/TableHeadCell.js.map +1 -1
- package/lib/TableRow.js +3 -3
- package/lib/TableRow.js.map +1 -1
- package/lib/Textarea.js +4 -4
- package/lib/Textarea.js.map +1 -1
- package/lib/Title.js +2 -2
- package/lib/Title.js.map +1 -1
- package/lib/Toast.js +3 -3
- package/lib/Toast.js.map +1 -1
- package/lib/__mocks__/uuid.js +0 -1
- package/lib/__mocks__/uuid.js.map +1 -1
- package/lib/components/AnchorLink/index.js +0 -13
- package/lib/components/ArticleTeaser/index.js +4 -4
- package/lib/components/ArticleTeaser/index.js.map +1 -1
- package/lib/components/AsChildSlot/index.js +0 -1
- package/lib/components/Avatar/index.js +0 -4
- package/lib/components/Badge/index.js +0 -8
- package/lib/components/Button/index.js +0 -17
- package/lib/components/Checkbox/index.js +0 -44
- package/lib/components/Chip/index.js +2 -2
- package/lib/components/Chip/index.js.map +1 -1
- package/lib/components/Close/index.js +0 -8
- package/lib/components/DictionaryTrigger/index.js +0 -1
- package/lib/components/Drawer/index.js +0 -37
- package/lib/components/Drawer/styles.module.scss +6 -0
- package/lib/components/Dropdown/SingleSelect/index.js +0 -2
- package/lib/components/Dropdown/SingleSelect/index.js.map +1 -1
- package/lib/components/Dropdown/index.js +5 -42
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/DropdownOld/index.js +3 -31
- package/lib/components/DropdownOld/index.js.map +1 -1
- package/lib/components/Duolist/Duolist.d.ts +3 -1
- package/lib/components/Duolist/index.js +0 -4
- package/lib/components/ElementHeader/ElementHeaderText/index.js +0 -9
- package/lib/components/ElementHeader/ElementHeaderText/index.js.map +1 -1
- package/lib/components/ElementHeader/StatusDotList/index.js +0 -34
- package/lib/components/ElementHeader/index.js +0 -48
- package/lib/components/ElementHeader/index.js.map +1 -1
- package/lib/components/EmptyState/index.js +2 -4
- package/lib/components/EmptyState/index.js.map +1 -1
- package/lib/components/Expander/index.js +0 -24
- package/lib/components/Expander/styles.module.scss +16 -7
- package/lib/components/Expander/styles.module.scss.d.ts +2 -1
- package/lib/components/ExpanderHierarchy/index.js +7 -8
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js +6 -52
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/EyebrowHeader/index.js +0 -1
- package/lib/components/EyebrowHeader/index.js.map +1 -1
- package/lib/components/FavoriteButton/index.js +2 -3
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/FormFieldTag/index.js +0 -2
- package/lib/components/FormGroup/FormGroup.d.ts +5 -0
- package/lib/components/FormGroup/index.js +0 -55
- package/lib/components/FormGroup/index.js.map +1 -1
- package/lib/components/FormLayout/index.js +0 -1
- package/lib/components/HelpBubble/index.js +3 -20
- package/lib/components/HelpBubble/index.js.map +1 -1
- package/lib/components/HelpDrawer/index.js +0 -36
- package/lib/components/HelpDrawer/index.js.map +1 -1
- package/lib/components/HelpExpanderInline/index.js +0 -2
- package/lib/components/HelpExpanderInline/index.js.map +1 -1
- package/lib/components/HelpExpanderStandalone/index.js +0 -6
- package/lib/components/HelpExpanderStandalone/index.js.map +1 -1
- package/lib/components/HelpPanel/index.js +2 -34
- package/lib/components/HelpPanel/index.js.map +1 -1
- package/lib/components/HelpTeaser/HelpTeaser.d.ts +2 -0
- package/lib/components/HelpTeaser/index.js +2 -9
- package/lib/components/HelpTeaser/index.js.map +1 -1
- package/lib/components/HelpTooltip/index.js +0 -2
- package/lib/components/HelpTooltip/index.js.map +1 -1
- package/lib/components/HelpTriggerIcon/index.js +0 -4
- package/lib/components/HelpTriggerInline/index.js +2 -2
- package/lib/components/HelpTriggerInline/index.js.map +1 -1
- package/lib/components/HelpTriggerStandalone/index.js +0 -8
- package/lib/components/HighlightPanel/index.js +0 -32
- package/lib/components/Highlighter/index.js +0 -8
- package/lib/components/HorizontalScroll/index.js +0 -5
- package/lib/components/Icons/AlarmClock.js +0 -1
- package/lib/components/Icons/AlarmClock.js.map +1 -1
- package/lib/components/Icons/AlertSignFill.js +0 -2
- package/lib/components/Icons/AlertSignStroke.js +0 -2
- package/lib/components/Icons/Archive.js +0 -1
- package/lib/components/Icons/Archive.js.map +1 -1
- package/lib/components/Icons/ArrowDown.js +0 -2
- package/lib/components/Icons/ArrowLeft.js +0 -1
- package/lib/components/Icons/ArrowLeft.js.map +1 -1
- package/lib/components/Icons/ArrowRight.js +0 -2
- package/lib/components/Icons/ArrowUp.js +0 -2
- package/lib/components/Icons/ArrowUpRight.js +0 -2
- package/lib/components/Icons/Attachment.js +0 -1
- package/lib/components/Icons/Attachment.js.map +1 -1
- package/lib/components/Icons/Avatar.js +0 -1
- package/lib/components/Icons/Avatar.js.map +1 -1
- package/lib/components/Icons/Braille.js +0 -1
- package/lib/components/Icons/Braille.js.map +1 -1
- package/lib/components/Icons/Bus.js +0 -1
- package/lib/components/Icons/Bus.js.map +1 -1
- package/lib/components/Icons/Calendar.js +0 -2
- package/lib/components/Icons/CalendarChange.js +0 -1
- package/lib/components/Icons/CalendarChange.js.map +1 -1
- package/lib/components/Icons/CalendarCheck.js +0 -1
- package/lib/components/Icons/CalendarCheck.js.map +1 -1
- package/lib/components/Icons/CalendarSave.js +0 -1
- package/lib/components/Icons/CalendarSave.js.map +1 -1
- package/lib/components/Icons/Candle.js +0 -1
- package/lib/components/Icons/Candle.js.map +1 -1
- package/lib/components/Icons/Change.js +0 -1
- package/lib/components/Icons/Change.js.map +1 -1
- package/lib/components/Icons/Check.js +0 -2
- package/lib/components/Icons/CheckFill.js +0 -2
- package/lib/components/Icons/ChevronDown.js +0 -2
- package/lib/components/Icons/ChevronLeft.js +0 -2
- package/lib/components/Icons/ChevronRight.js +0 -2
- package/lib/components/Icons/ChevronUp.js +0 -2
- package/lib/components/Icons/ChevronsDown.js +0 -1
- package/lib/components/Icons/ChevronsDown.js.map +1 -1
- package/lib/components/Icons/ChevronsUp.js +0 -1
- package/lib/components/Icons/ChevronsUp.js.map +1 -1
- package/lib/components/Icons/Contacts.js +0 -1
- package/lib/components/Icons/Contacts.js.map +1 -1
- package/lib/components/Icons/Copy.js +0 -1
- package/lib/components/Icons/Copy.js.map +1 -1
- package/lib/components/Icons/DotActive.js +0 -1
- package/lib/components/Icons/DotActive.js.map +1 -1
- package/lib/components/Icons/DotAlert.js +0 -1
- package/lib/components/Icons/DotAlert.js.map +1 -1
- package/lib/components/Icons/DotCancelled.js +0 -1
- package/lib/components/Icons/DotCancelled.js.map +1 -1
- package/lib/components/Icons/DotHalfDisc.js +0 -1
- package/lib/components/Icons/DotHalfDisc.js.map +1 -1
- package/lib/components/Icons/DotInactive.js +0 -1
- package/lib/components/Icons/DotInactive.js.map +1 -1
- package/lib/components/Icons/DotInfo.js +0 -1
- package/lib/components/Icons/DotInfo.js.map +1 -1
- package/lib/components/Icons/DotLookingGlass.js +0 -1
- package/lib/components/Icons/DotLookingGlass.js.map +1 -1
- package/lib/components/Icons/DotPending.js +0 -1
- package/lib/components/Icons/DotPending.js.map +1 -1
- package/lib/components/Icons/DotQuestionMark.js +0 -1
- package/lib/components/Icons/DotQuestionMark.js.map +1 -1
- package/lib/components/Icons/DotSuccess.js +0 -1
- package/lib/components/Icons/DotSuccess.js.map +1 -1
- package/lib/components/Icons/DotTransparent.js +0 -1
- package/lib/components/Icons/DotTransparent.js.map +1 -1
- package/lib/components/Icons/DotWarningTriangle.js +0 -1
- package/lib/components/Icons/DotWarningTriangle.js.map +1 -1
- package/lib/components/Icons/Download.js +0 -1
- package/lib/components/Icons/Download.js.map +1 -1
- package/lib/components/Icons/Drag.js +0 -1
- package/lib/components/Icons/Drag.js.map +1 -1
- package/lib/components/Icons/EChat.js +0 -1
- package/lib/components/Icons/EChat.js.map +1 -1
- package/lib/components/Icons/Ear.js +0 -1
- package/lib/components/Icons/Ear.js.map +1 -1
- package/lib/components/Icons/EarDeaf.js +0 -1
- package/lib/components/Icons/EarDeaf.js.map +1 -1
- package/lib/components/Icons/EarHearingAid.js +0 -1
- package/lib/components/Icons/EarHearingAid.js.map +1 -1
- package/lib/components/Icons/EarVolume.js +0 -1
- package/lib/components/Icons/EarVolume.js.map +1 -1
- package/lib/components/Icons/Edit.js +0 -1
- package/lib/components/Icons/Edit.js.map +1 -1
- package/lib/components/Icons/EmergencyCall.js +0 -1
- package/lib/components/Icons/EmergencyCall.js.map +1 -1
- package/lib/components/Icons/EmoticonAnnoyed.js +0 -1
- package/lib/components/Icons/EmoticonAnnoyed.js.map +1 -1
- package/lib/components/Icons/EmoticonDelighted.js +0 -1
- package/lib/components/Icons/EmoticonDelighted.js.map +1 -1
- package/lib/components/Icons/EmoticonDisappointed.js +0 -1
- package/lib/components/Icons/EmoticonDisappointed.js.map +1 -1
- package/lib/components/Icons/EmoticonHappy.js +0 -1
- package/lib/components/Icons/EmoticonHappy.js.map +1 -1
- package/lib/components/Icons/EmoticonMeh.js +0 -1
- package/lib/components/Icons/EmoticonMeh.js.map +1 -1
- package/lib/components/Icons/EnterFullScreen.js +0 -1
- package/lib/components/Icons/EnterFullScreen.js.map +1 -1
- package/lib/components/Icons/Envelope.js +0 -1
- package/lib/components/Icons/Envelope.js.map +1 -1
- package/lib/components/Icons/Eraser.js +0 -1
- package/lib/components/Icons/Eraser.js.map +1 -1
- package/lib/components/Icons/ErrorSignFill.js +0 -2
- package/lib/components/Icons/ErrorSignStroke.js +0 -1
- package/lib/components/Icons/ErrorSignStroke.js.map +1 -1
- package/lib/components/Icons/ExitFullScreen.js +0 -1
- package/lib/components/Icons/ExitFullScreen.js.map +1 -1
- package/lib/components/Icons/Eye.js +0 -1
- package/lib/components/Icons/Eye.js.map +1 -1
- package/lib/components/Icons/FallingLeaf.js +0 -1
- package/lib/components/Icons/FallingLeaf.js.map +1 -1
- package/lib/components/Icons/File.js +0 -1
- package/lib/components/Icons/File.js.map +1 -1
- package/lib/components/Icons/Filter.js +0 -1
- package/lib/components/Icons/Filter.js.map +1 -1
- package/lib/components/Icons/Form.js +0 -1
- package/lib/components/Icons/Form.js.map +1 -1
- package/lib/components/Icons/Forward.js +0 -2
- package/lib/components/Icons/Gallery.js +0 -1
- package/lib/components/Icons/Gallery.js.map +1 -1
- package/lib/components/Icons/Glasses.js +0 -1
- package/lib/components/Icons/Glasses.js.map +1 -1
- package/lib/components/Icons/Globe.js +0 -1
- package/lib/components/Icons/Globe.js.map +1 -1
- package/lib/components/Icons/Graph.js +0 -1
- package/lib/components/Icons/Graph.js.map +1 -1
- package/lib/components/Icons/Group.js +0 -1
- package/lib/components/Icons/Group.js.map +1 -1
- package/lib/components/Icons/GroupTwins.js +0 -1
- package/lib/components/Icons/GroupTwins.js.map +1 -1
- package/lib/components/Icons/HTMLFile.js +0 -1
- package/lib/components/Icons/HTMLFile.js.map +1 -1
- package/lib/components/Icons/HandsAndHeart.js +0 -1
- package/lib/components/Icons/HandsAndHeart.js.map +1 -1
- package/lib/components/Icons/HealthcarePerson.js +0 -1
- package/lib/components/Icons/HealthcarePerson.js.map +1 -1
- package/lib/components/Icons/HealthcarePersonell.js +0 -1
- package/lib/components/Icons/HealthcarePersonell.js.map +1 -1
- package/lib/components/Icons/HearingProtection.js +0 -1
- package/lib/components/Icons/HearingProtection.js.map +1 -1
- package/lib/components/Icons/Heart.js +0 -1
- package/lib/components/Icons/Heart.js.map +1 -1
- package/lib/components/Icons/HelpSign.js +0 -1
- package/lib/components/Icons/HelpSign.js.map +1 -1
- package/lib/components/Icons/History.js +0 -1
- package/lib/components/Icons/History.js.map +1 -1
- package/lib/components/Icons/Home.js +0 -1
- package/lib/components/Icons/Home.js.map +1 -1
- package/lib/components/Icons/HomeFill.js +0 -1
- package/lib/components/Icons/HomeFill.js.map +1 -1
- package/lib/components/Icons/Hospital.js +0 -1
- package/lib/components/Icons/Hospital.js.map +1 -1
- package/lib/components/Icons/Hourglass.js +0 -1
- package/lib/components/Icons/Hourglass.js.map +1 -1
- package/lib/components/Icons/InfoSignFill.js +0 -2
- package/lib/components/Icons/InfoSignStroke.js +0 -1
- package/lib/components/Icons/InfoSignStroke.js.map +1 -1
- package/lib/components/Icons/Journal.js +0 -1
- package/lib/components/Icons/Journal.js.map +1 -1
- package/lib/components/Icons/LegalDocument.js +0 -1
- package/lib/components/Icons/LegalDocument.js.map +1 -1
- package/lib/components/Icons/List.js +0 -1
- package/lib/components/Icons/List.js.map +1 -1
- package/lib/components/Icons/Location.js +0 -1
- package/lib/components/Icons/Location.js.map +1 -1
- package/lib/components/Icons/LocationFill.js +0 -1
- package/lib/components/Icons/LocationFill.js.map +1 -1
- package/lib/components/Icons/Lock.js +0 -1
- package/lib/components/Icons/Lock.js.map +1 -1
- package/lib/components/Icons/Login.js +0 -1
- package/lib/components/Icons/Login.js.map +1 -1
- package/lib/components/Icons/Logout.js +0 -1
- package/lib/components/Icons/Logout.js.map +1 -1
- package/lib/components/Icons/MaleDoctorCompact.js +0 -1
- package/lib/components/Icons/MaleDoctorCompact.js.map +1 -1
- package/lib/components/Icons/MaleDoctorCompactFill.js +0 -1
- package/lib/components/Icons/MaleDoctorCompactFill.js.map +1 -1
- package/lib/components/Icons/Medicine.js +0 -1
- package/lib/components/Icons/Medicine.js.map +1 -1
- package/lib/components/Icons/Menu.js +0 -1
- package/lib/components/Icons/Menu.js.map +1 -1
- package/lib/components/Icons/Minus.js +0 -1
- package/lib/components/Icons/Minus.js.map +1 -1
- package/lib/components/Icons/MobilePhone.js +0 -1
- package/lib/components/Icons/MobilePhone.js.map +1 -1
- package/lib/components/Icons/NoAccess.js +0 -1
- package/lib/components/Icons/NoAccess.js.map +1 -1
- package/lib/components/Icons/NoEye.js +0 -1
- package/lib/components/Icons/NoEye.js.map +1 -1
- package/lib/components/Icons/NoFilter.js +0 -1
- package/lib/components/Icons/NoFilter.js.map +1 -1
- package/lib/components/Icons/PaperPlane.js +0 -1
- package/lib/components/Icons/PaperPlane.js.map +1 -1
- package/lib/components/Icons/Pause.js +0 -1
- package/lib/components/Icons/Pause.js.map +1 -1
- package/lib/components/Icons/Pencil.js +0 -2
- package/lib/components/Icons/PersonCancel.js +0 -1
- package/lib/components/Icons/PersonCancel.js.map +1 -1
- package/lib/components/Icons/PersonalPlan.js +0 -1
- package/lib/components/Icons/PersonalPlan.js.map +1 -1
- package/lib/components/Icons/Play.js +0 -1
- package/lib/components/Icons/Play.js.map +1 -1
- package/lib/components/Icons/PlusLarge.js +0 -1
- package/lib/components/Icons/PlusLarge.js.map +1 -1
- package/lib/components/Icons/PlusSmall.js +0 -2
- package/lib/components/Icons/Printer.js +0 -1
- package/lib/components/Icons/Printer.js.map +1 -1
- package/lib/components/Icons/QrCode.js +0 -1
- package/lib/components/Icons/QrCode.js.map +1 -1
- package/lib/components/Icons/Receptionist.js +0 -1
- package/lib/components/Icons/Receptionist.js.map +1 -1
- package/lib/components/Icons/Referral.js +0 -1
- package/lib/components/Icons/Referral.js.map +1 -1
- package/lib/components/Icons/Refresh.js +0 -1
- package/lib/components/Icons/Refresh.js.map +1 -1
- package/lib/components/Icons/Reply.js +0 -1
- package/lib/components/Icons/Reply.js.map +1 -1
- package/lib/components/Icons/Save.js +0 -1
- package/lib/components/Icons/Save.js.map +1 -1
- package/lib/components/Icons/ScreenReader.js +0 -1
- package/lib/components/Icons/ScreenReader.js.map +1 -1
- package/lib/components/Icons/Search.js +0 -1
- package/lib/components/Icons/Search.js.map +1 -1
- package/lib/components/Icons/SectionSign.js +0 -1
- package/lib/components/Icons/SectionSign.js.map +1 -1
- package/lib/components/Icons/Settings.js +0 -1
- package/lib/components/Icons/Settings.js.map +1 -1
- package/lib/components/Icons/SettingsFill.js +0 -1
- package/lib/components/Icons/SettingsFill.js.map +1 -1
- package/lib/components/Icons/Share.js +0 -1
- package/lib/components/Icons/Share.js.map +1 -1
- package/lib/components/Icons/SortDown.js +0 -1
- package/lib/components/Icons/SortDown.js.map +1 -1
- package/lib/components/Icons/SortUp.js +0 -1
- package/lib/components/Icons/SortUp.js.map +1 -1
- package/lib/components/Icons/SpeechBubble.js +0 -1
- package/lib/components/Icons/SpeechBubble.js.map +1 -1
- package/lib/components/Icons/Stopwatch.js +0 -1
- package/lib/components/Icons/Stopwatch.js.map +1 -1
- package/lib/components/Icons/Sun.js +0 -1
- package/lib/components/Icons/Sun.js.map +1 -1
- package/lib/components/Icons/SupportingPerson.js +0 -1
- package/lib/components/Icons/SupportingPerson.js.map +1 -1
- package/lib/components/Icons/TimePassing.js +0 -1
- package/lib/components/Icons/TimePassing.js.map +1 -1
- package/lib/components/Icons/Tombstone.js +0 -1
- package/lib/components/Icons/Tombstone.js.map +1 -1
- package/lib/components/Icons/Toolbox.js +0 -1
- package/lib/components/Icons/Toolbox.js.map +1 -1
- package/lib/components/Icons/TrashCan.js +0 -1
- package/lib/components/Icons/TrashCan.js.map +1 -1
- package/lib/components/Icons/TreatmentAids.js +0 -1
- package/lib/components/Icons/TreatmentAids.js.map +1 -1
- package/lib/components/Icons/TriangleX.js +0 -2
- package/lib/components/Icons/Undo.js +0 -2
- package/lib/components/Icons/Upload.js +0 -1
- package/lib/components/Icons/Upload.js.map +1 -1
- package/lib/components/Icons/Vaccine.js +0 -1
- package/lib/components/Icons/Vaccine.js.map +1 -1
- package/lib/components/Icons/VerticalDots.js +0 -2
- package/lib/components/Icons/VideoCamera.js +0 -1
- package/lib/components/Icons/VideoCamera.js.map +1 -1
- package/lib/components/Icons/VideoChat.js +0 -1
- package/lib/components/Icons/VideoChat.js.map +1 -1
- package/lib/components/Icons/Wallet.js +0 -1
- package/lib/components/Icons/Wallet.js.map +1 -1
- package/lib/components/Icons/Watch.js +0 -2
- package/lib/components/Icons/X.js +0 -2
- package/lib/components/Icons/Zoom.js +0 -1
- package/lib/components/Icons/Zoom.js.map +1 -1
- package/lib/components/Icons/ZoomInLeft.js +0 -1
- package/lib/components/Icons/ZoomInLeft.js.map +1 -1
- package/lib/components/Icons/ZoomOutLeft.js +0 -1
- package/lib/components/Icons/ZoomOutLeft.js.map +1 -1
- package/lib/components/Illustration/index.js +0 -2
- package/lib/components/Illustrations/BabyMobile.js +0 -2
- package/lib/components/Illustrations/BabyMobile.js.map +1 -1
- package/lib/components/Illustrations/BabyMobileMedium.js +0 -3
- package/lib/components/Illustrations/Child.js +0 -2
- package/lib/components/Illustrations/Child.js.map +1 -1
- package/lib/components/Illustrations/ChildMedium.js +0 -3
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js +0 -2
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js +0 -3
- package/lib/components/Illustrations/GiveBabyFood.js +0 -2
- package/lib/components/Illustrations/GiveBabyFood.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFoodMedium.js +0 -3
- package/lib/components/Illustrations/ReadLetters.js +0 -2
- package/lib/components/Illustrations/ReadLetters.js.map +1 -1
- package/lib/components/Illustrations/ReadLettersMedium.js +0 -3
- package/lib/components/Illustrations/Stroller.js +0 -2
- package/lib/components/Illustrations/Stroller.js.map +1 -1
- package/lib/components/Illustrations/StrollerMedium.js +0 -3
- package/lib/components/Illustrations/Support2.js +0 -2
- package/lib/components/Illustrations/Support2.js.map +1 -1
- package/lib/components/Illustrations/Support2Medium.js +0 -3
- package/lib/components/InfoTeaser/InfoTeaser.d.ts +2 -0
- package/lib/components/InfoTeaser/index.js +0 -8
- package/lib/components/InfoTeaser/styles.module.scss +0 -2
- package/lib/components/Input/Input.d.ts +2 -2
- package/lib/components/Input/index.js +0 -44
- package/lib/components/Label/index.js +0 -38
- package/lib/components/LazyIcon/index.js +0 -4
- package/lib/components/LazyIllustration/index.js +0 -6
- package/lib/components/LinkList/index.js +0 -54
- package/lib/components/List/index.js +0 -1
- package/lib/components/ListEditMode/index.js +0 -4
- package/lib/components/Loader/index.js +4 -5
- package/lib/components/Loader/index.js.map +1 -1
- package/lib/components/Logo/index.js +0 -4
- package/lib/components/Logo/index.js.map +1 -1
- package/lib/components/Modal/index.js +9 -30
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/NotificationPanel/index.js +6 -34
- package/lib/components/NotificationPanel/index.js.map +1 -1
- package/lib/components/Panel/PanelTitle/index.js +0 -11
- package/lib/components/Panel/index.js +0 -31
- package/lib/components/Panel/index.js.map +1 -1
- package/lib/components/PanelList/PanelList.d.ts +6 -0
- package/lib/components/PanelList/index.js +3 -53
- package/lib/components/PanelList/index.js.map +1 -1
- package/lib/components/PanelListOld/index.js +2 -36
- package/lib/components/PanelListOld/index.js.map +1 -1
- package/lib/components/PanelOld/index.js +0 -35
- package/lib/components/PopMenu/index.js +3 -54
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/PopOver/index.js +0 -3
- package/lib/components/Portal/index.js +0 -1
- package/lib/components/Progressbar/index.js +2 -2
- package/lib/components/Progressbar/index.js.map +1 -1
- package/lib/components/PromoPanel/index.js +2 -12
- package/lib/components/PromoPanel/index.js.map +1 -1
- package/lib/components/RadioButton/index.js +0 -43
- package/lib/components/Select/index.js +0 -43
- package/lib/components/Select/styles.module.scss +2 -0
- package/lib/components/ServiceMessage/index.js +5 -48
- package/lib/components/ServiceMessage/index.js.map +1 -1
- package/lib/components/SharingStatus/index.js +4 -4
- package/lib/components/SharingStatus/index.js.map +1 -1
- package/lib/components/Slider/index.js +0 -10
- package/lib/components/Spacer/index.js +0 -1
- package/lib/components/StatusDot/index.js +0 -33
- package/lib/components/Step/index.js +2 -2
- package/lib/components/Step/index.js.map +1 -1
- package/lib/components/StepButtons/index.js +0 -1
- package/lib/components/Stepper/index.js +2 -3
- package/lib/components/Stepper/index.js.map +1 -1
- package/lib/components/StickyNote/index.js +8 -11
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/components/Table/TableBody/index.js +0 -13
- package/lib/components/Table/TableCell/index.js +0 -13
- package/lib/components/Table/TableExpandedRow/index.js +0 -29
- package/lib/components/Table/TableExpanderCell/index.js +0 -30
- package/lib/components/Table/TableHead/index.js +0 -13
- package/lib/components/Table/TableHeadCell/index.js +0 -16
- package/lib/components/Table/TableRow/index.js +0 -30
- package/lib/components/Table/index.js +0 -31
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/Tabs/TabList/index.js +0 -14
- package/lib/components/Tabs/index.js +4 -17
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/Tag/index.js +2 -4
- package/lib/components/Tag/index.js.map +1 -1
- package/lib/components/Textarea/Textarea.d.ts +1 -1
- package/lib/components/Textarea/index.js +0 -43
- package/lib/components/Tile/index.js +4 -6
- package/lib/components/Tile/index.js.map +1 -1
- package/lib/components/Title/index.js +0 -1
- package/lib/components/Toast/index.js +0 -10
- package/lib/components/Toast/index.js.map +1 -1
- package/lib/components/ToastList/index.js +0 -9
- package/lib/components/ToastList/index.js.map +1 -1
- package/lib/components/Toggle/index.js +10 -10
- package/lib/components/Toggle/index.js.map +1 -1
- package/lib/components/Validation/index.js +2 -53
- package/lib/components/Validation/index.js.map +1 -1
- package/lib/floating-ui.react.js +65 -61
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/hoc/withBreakpoint/index.js +0 -2
- package/lib/hoc/withBreakpoint/index.js.map +1 -1
- package/lib/hoc/withBreakpoint/withBreakpoint.js +0 -2
- package/lib/hooks/useBreakpoint.js +0 -1
- package/lib/hooks/useExpand.js +0 -1
- package/lib/hooks/useFocusToggle.js +0 -2
- package/lib/hooks/useFocusTrap.js +0 -3
- package/lib/hooks/useFocusableElements.js +0 -1
- package/lib/hooks/useIcons.js +0 -6
- package/lib/hooks/useIsMobileBreakpoint.js +0 -2
- package/lib/hooks/useIsVisible.js +0 -1
- package/lib/hooks/useLayoutEvent.js +0 -1
- package/lib/hooks/useReturnFocusOnUnmount.js +0 -2
- package/lib/hooks/useRovingFocus.js +0 -2
- package/lib/hooks/useSize.js +0 -1
- package/lib/hooks/useToggle.js +0 -1
- package/lib/index.js +0 -9
- package/lib/theme/currys/color.js +0 -4
- package/lib/theme/currys/index.js +0 -5
- package/lib/theme/currys/spacing.js +0 -1
- package/lib/theme/index.js +0 -3
- package/lib/useElementList.js +15 -2
- package/lib/useElementList.js.map +1 -1
- package/lib/utils/uuid.js +0 -1
- package/lib/uuid.js +1 -1
- package/package.json +3 -8
- package/lib/scss/_figma-tokens.scss +0 -68
- package/scss/_figma-tokens.scss +0 -68
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tile/Tile.tsx","../../../src/components/Tile/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { TitleTags } from './../Title/Title';\nimport { useBreakpoint, Breakpoint } from '../../hooks/useBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport { IconSize } from '../Icon';\n\nimport tileStyles from './styles.module.scss';\n\nexport type TileVariants = 'normal' | 'compact';\n\ninterface TileProps extends Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick' | 'rel'> {\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /**\tSets the icon to be displayed inside the tile. */\n icon: React.ReactElement;\n /**\tSets the title to be displayed inside the tile. */\n title: React.ReactElement;\n /** Toggles the highlighted style of the tile. */\n highlighted?: boolean;\n /** Sets the description to be displayed inside the tile. */\n description?: string;\n /** Sets a fixed max and min width for the tile. */\n fixed?: boolean;\n /** Sets the visual variant of the component */\n variant?: TileVariants;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface TileTitleProps {\n children: React.ReactNode;\n className?: string;\n htmlMarkup?: TitleTags;\n highlighted?: boolean;\n compact?: boolean;\n}\n\nexport interface TileCompound extends React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLAnchorElement>> {\n Title: React.ForwardRefExoticComponent<TileTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n}\n\nconst Title = React.forwardRef<HTMLHeadingElement, TileTitleProps>((props, ref) => {\n const { compact, children, className, htmlMarkup = 'span', highlighted } = props;\n const titleClasses = classNames(\n tileStyles['tile__title'],\n {\n [tileStyles['tile__title--highlighted']]: highlighted,\n [tileStyles['tile__title--compact']]: compact,\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n return (\n <CustomTag className={titleClasses} ref={ref}>\n {children}\n </CustomTag>\n );\n});\n\nTitle.displayName = 'Title';\n\nexport const Tile = React.forwardRef<HTMLAnchorElement, TileProps>((props, ref) => {\n const {\n children,\n icon,\n title,\n className = '',\n description,\n fixed = false,\n highlighted = false,\n testId,\n target,\n rel,\n variant = 'normal',\n href,\n onClick,\n } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLAnchorElement>();\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < Breakpoint.md;\n const compact = variant === 'compact';\n const tileClasses = classNames(\n tileStyles.tile,\n {\n [tileStyles['tile--fixed']]: fixed,\n [tileStyles['tile--compact']]: compact,\n [tileStyles['tile--highlighted']]: highlighted,\n },\n className\n );\n const tileTitleWrapperClasses = classNames(tileStyles['title-wrapper'], {\n [tileStyles['title-wrapper--compact']]: compact,\n });\n\n return (\n <a\n ref={mergeRefs([ref, refObject])}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : rel}\n className={tileClasses}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Tile}\n onClick={onClick}\n >\n <div className={tileTitleWrapperClasses}>\n {React.cloneElement(icon, { size: mobile ? IconSize.Small : IconSize.Medium, isHovered, color: highlighted ? 'white' : 'black' })}\n {React.cloneElement(title, { highlighted: highlighted, compact: compact })}\n </div>\n {!compact && !mobile && <p className={tileStyles.tile__description}>{description}</p>}\n {children && <div className={tileStyles.tile__children}>{children}</div>}\n </a>\n );\n}) as TileCompound;\n\nTile.displayName = 'Tile';\nTile.Title = Title;\n\nexport default Tile;\n","import Tile from './Tile';\nexport * from './Tile';\nexport default Tile;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Tile/Tile.tsx","../../../src/components/Tile/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { TitleTags } from './../Title/Title';\nimport { useBreakpoint, Breakpoint } from '../../hooks/useBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { mergeRefs } from '../../utils/refs';\nimport { IconSize } from '../Icon';\n\nimport tileStyles from './styles.module.scss';\n\nexport type TileVariants = 'normal' | 'compact';\n\ninterface TileProps extends Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick' | 'rel'> {\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /**\tSets the icon to be displayed inside the tile. */\n icon: React.ReactElement;\n /**\tSets the title to be displayed inside the tile. */\n title: React.ReactElement;\n /** Toggles the highlighted style of the tile. */\n highlighted?: boolean;\n /** Sets the description to be displayed inside the tile. */\n description?: string;\n /** Sets a fixed max and min width for the tile. */\n fixed?: boolean;\n /** Sets the visual variant of the component */\n variant?: TileVariants;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface TileTitleProps {\n children: React.ReactNode;\n className?: string;\n htmlMarkup?: TitleTags;\n highlighted?: boolean;\n compact?: boolean;\n}\n\nexport interface TileCompound extends React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLAnchorElement>> {\n Title: React.ForwardRefExoticComponent<TileTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n}\n\nconst Title = React.forwardRef<HTMLHeadingElement, TileTitleProps>((props, ref) => {\n const { compact, children, className, htmlMarkup = 'span', highlighted } = props;\n const titleClasses = classNames(\n tileStyles['tile__title'],\n {\n [tileStyles['tile__title--highlighted']]: highlighted,\n [tileStyles['tile__title--compact']]: compact,\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n return (\n <CustomTag className={titleClasses} ref={ref}>\n {children}\n </CustomTag>\n );\n});\n\nTitle.displayName = 'Title';\n\nexport const Tile = React.forwardRef<HTMLAnchorElement, TileProps>((props, ref) => {\n const {\n children,\n icon,\n title,\n className = '',\n description,\n fixed = false,\n highlighted = false,\n testId,\n target,\n rel,\n variant = 'normal',\n href,\n onClick,\n } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLAnchorElement>();\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < Breakpoint.md;\n const compact = variant === 'compact';\n const tileClasses = classNames(\n tileStyles.tile,\n {\n [tileStyles['tile--fixed']]: fixed,\n [tileStyles['tile--compact']]: compact,\n [tileStyles['tile--highlighted']]: highlighted,\n },\n className\n );\n const tileTitleWrapperClasses = classNames(tileStyles['title-wrapper'], {\n [tileStyles['title-wrapper--compact']]: compact,\n });\n\n return (\n <a\n ref={mergeRefs([ref, refObject])}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : rel}\n className={tileClasses}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Tile}\n onClick={onClick}\n >\n <div className={tileTitleWrapperClasses}>\n {React.cloneElement(icon, { size: mobile ? IconSize.Small : IconSize.Medium, isHovered, color: highlighted ? 'white' : 'black' })}\n {React.cloneElement(title, { highlighted: highlighted, compact: compact })}\n </div>\n {!compact && !mobile && <p className={tileStyles.tile__description}>{description}</p>}\n {children && <div className={tileStyles.tile__children}>{children}</div>}\n </a>\n );\n}) as TileCompound;\n\nTile.displayName = 'Tile';\nTile.Title = Title;\n\nexport default Tile;\n","import Tile from './Tile';\nexport * from './Tile';\nexport default Tile;\n"],"mappings":";;;;;;;;AA+CA,IAAM,QAAQ,MAAM,YAAgD,OAAO,QAAQ;CACjF,MAAM,EAAE,SAAS,UAAU,WAAW,aAAa,QAAQ,gBAAgB;AAW3E,QACE,oBAHgB,YAGf;EAAU,WAXQ,WACnB,WAAW,gBACX;IACG,WAAW,8BAA8B;IACzC,WAAW,0BAA0B;GACvC,EACD,UACD;EAI0C;EACtC;GACS;EAEd;AAEF,MAAM,cAAc;AAEpB,MAAa,OAAO,MAAM,YAA0C,OAAO,QAAQ;CACjF,MAAM,EACJ,UACA,MACA,OACA,YAAY,IACZ,aACA,QAAQ,OACR,cAAc,OACd,QACA,QACA,KACA,UAAU,UACV,MACA,YACE;CACJ,MAAM,EAAE,WAAW,cAAc,kBAAqC;CAEtE,MAAM,SADa,eAAe,GACN,WAAW;CACvC,MAAM,UAAU,YAAY;CAC5B,MAAM,cAAc,WAClB,WAAW,MACX;GACG,WAAW,iBAAiB;GAC5B,WAAW,mBAAmB;GAC9B,WAAW,uBAAuB;EACpC,EACD,UACD;CACD,MAAM,0BAA0B,WAAW,WAAW,kBAAkB,GACrE,WAAW,4BAA4B,SACzC,CAAC;AAEF,QACE,qBAAC,KAAA;EACC,KAAK,UAAU,CAAC,KAAK,UAAU,CAAC;EAC1B;EACE;EACR,KAAK,WAAW,WAAW,wBAAwB;EACnD,WAAW;EACX,eAAa;EACb,oBAAkB,YAAY;EACrB;;GAET,qBAAC,OAAA;IAAI,WAAW;eACb,MAAM,aAAa,MAAM;KAAE,MAAM,SAAS,SAAS,QAAQ,SAAS;KAAQ;KAAW,OAAO,cAAc,UAAU;KAAS,CAAC,EAChI,MAAM,aAAa,OAAO;KAAe;KAAsB;KAAS,CAAC,CAAA;KACtE;GACL,CAAC,WAAW,CAAC,UAAU,oBAAC,KAAA;IAAE,WAAW,WAAW;cAAoB;KAAgB;GACpF,YAAY,oBAAC,OAAA;IAAI,WAAW,WAAW;IAAiB;KAAe;;GACtE;EAEN;AAEF,KAAK,cAAc;AACnB,KAAK,QAAQ;ACzHb,IAAA,eD2He"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import "../../constants2.js";
|
|
2
|
-
import "../../usePseudoClasses.js";
|
|
3
|
-
import "../../grid.js";
|
|
4
|
-
import "../../refs.js";
|
|
5
|
-
import "../../Icon.js";
|
|
6
|
-
import "../../CheckFill.js";
|
|
7
|
-
import "../../useBreakpoint.js";
|
|
8
|
-
import "../../useIsMobileBreakpoint.js";
|
|
9
|
-
import "../../X.js";
|
|
10
|
-
import "../../Close.js";
|
|
11
1
|
import { t as Toast_default$1 } from "../../Toast.js";
|
|
12
2
|
var Toast_default = Toast_default$1;
|
|
13
3
|
export { Toast_default as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Toast/index.ts"],"sourcesContent":["import Toast from './Toast';\nexport * from './Toast';\nexport default Toast;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Toast/index.ts"],"sourcesContent":["import Toast from './Toast';\nexport * from './Toast';\nexport default Toast;\n"],"mappings":";AAEA,IAAA,gBAAe"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import "../../constants2.js";
|
|
2
|
-
import "../../usePseudoClasses.js";
|
|
3
|
-
import "../../grid.js";
|
|
4
1
|
import { n as mergeRefs } from "../../refs.js";
|
|
5
|
-
import "../../Icon.js";
|
|
6
|
-
import "../../CheckFill.js";
|
|
7
|
-
import "../../useBreakpoint.js";
|
|
8
|
-
import "../../useIsMobileBreakpoint.js";
|
|
9
|
-
import "../../X.js";
|
|
10
|
-
import "../../Close.js";
|
|
11
2
|
import { t as Toast_default } from "../../Toast.js";
|
|
12
3
|
import React from "react";
|
|
13
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ToastList/ToastList.tsx","../../../src/components/ToastList/index.ts"],"sourcesContent":["import React from 'react';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { mergeRefs } from '../../utils/refs';\nimport Toast from '../Toast/Toast';\n\nimport styles from './styles.module.scss';\n\nexport interface ToastData {\n id: string;\n title: string;\n message?: string;\n}\n\nexport interface ToastListProps {\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Array of toast data to display */\n toasts?: ToastData[];\n}\n\nconst DURATION = 8000;\n\nconst ToastList = React.forwardRef<HTMLElement, ToastListProps>((props, ref) => {\n const { testId, toasts = [] } = props;\n const internalRef = React.useRef<HTMLElement | null>(null);\n const [visibleToasts, setVisibleToasts] = React.useState<ToastData[]>([]);\n const [removedToastIds, setRemovedToastIds] = React.useState<Set<string>>(new Set());\n const timeoutRefs = React.useRef<Map<string, NodeJS.Timeout>>(new Map());\n\n React.useEffect(() => {\n const newToasts = toasts.filter(toast => !visibleToasts.some(vt => vt.id === toast.id) && !removedToastIds.has(toast.id));\n if (newToasts.length > 0) {\n setVisibleToasts(prev => [...prev, ...newToasts]);\n }\n }, [toasts, visibleToasts, removedToastIds]);\n\n // Handles removal of a toast\n const handleRemoveToast = React.useCallback((id: string): void => {\n setVisibleToasts(prev => prev.filter(t => t.id !== id));\n // Add to removed IDs to prevent re-appearance\n setRemovedToastIds(prev => new Set([...prev, id]));\n\n // Clear timeout if exists\n const timeout = timeoutRefs.current.get(id);\n if (timeout) {\n clearTimeout(timeout);\n timeoutRefs.current.delete(id);\n }\n }, []);\n\n // Handle auto-removal of toasts after duration\n React.useEffect(() => {\n const timeouts = timeoutRefs.current;\n\n // Set up timeouts for new visible toasts that don't have timeout yet\n visibleToasts.forEach(toast => {\n if (!timeouts.has(toast.id)) {\n const timeout = setTimeout(() => {\n handleRemoveToast(toast.id);\n }, DURATION);\n\n timeouts.set(toast.id, timeout);\n }\n });\n }, [visibleToasts, handleRemoveToast]);\n\n // Cleanup timeouts for removed toasts\n React.useEffect(() => {\n const timeouts = timeoutRefs.current;\n const currentToastIds = new Set(visibleToasts.map(t => t.id));\n\n timeouts.forEach((timeout, id) => {\n if (!currentToastIds.has(id)) {\n clearTimeout(timeout);\n timeouts.delete(id);\n }\n });\n }, [visibleToasts]);\n\n // Cleanup all timeouts on unmount\n React.useEffect(() => {\n return (): void => {\n timeoutRefs.current.forEach(timeout => clearTimeout(timeout));\n timeoutRefs.current.clear();\n };\n }, []);\n\n const setRefs = mergeRefs([internalRef, ref]);\n\n return (\n <section ref={setRefs} className={styles['toast-list']} data-testid={testId}>\n <AnimatePresence mode=\"popLayout\">\n {visibleToasts.map(toast => (\n <motion.div\n key={toast.id}\n layout\n initial={{ opacity: 0, y: 50 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -20 }}\n transition={{\n layout: { type: 'spring', duration: 0.4, bounce: 0.1 },\n }}\n >\n <Toast\n testId={`${testId}-${toast.id}`}\n title={toast.title}\n message={toast.message}\n onClose={() => handleRemoveToast(toast.id)}\n />\n </motion.div>\n ))}\n </AnimatePresence>\n </section>\n );\n});\n\nToastList.displayName = 'ToastList';\n\nexport default ToastList;\n","import ToastList from './ToastList';\nexport * from './ToastList';\nexport default ToastList;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ToastList/ToastList.tsx","../../../src/components/ToastList/index.ts"],"sourcesContent":["import React from 'react';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { mergeRefs } from '../../utils/refs';\nimport Toast from '../Toast/Toast';\n\nimport styles from './styles.module.scss';\n\nexport interface ToastData {\n id: string;\n title: string;\n message?: string;\n}\n\nexport interface ToastListProps {\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Array of toast data to display */\n toasts?: ToastData[];\n}\n\nconst DURATION = 8000;\n\nconst ToastList = React.forwardRef<HTMLElement, ToastListProps>((props, ref) => {\n const { testId, toasts = [] } = props;\n const internalRef = React.useRef<HTMLElement | null>(null);\n const [visibleToasts, setVisibleToasts] = React.useState<ToastData[]>([]);\n const [removedToastIds, setRemovedToastIds] = React.useState<Set<string>>(new Set());\n const timeoutRefs = React.useRef<Map<string, NodeJS.Timeout>>(new Map());\n\n React.useEffect(() => {\n const newToasts = toasts.filter(toast => !visibleToasts.some(vt => vt.id === toast.id) && !removedToastIds.has(toast.id));\n if (newToasts.length > 0) {\n setVisibleToasts(prev => [...prev, ...newToasts]);\n }\n }, [toasts, visibleToasts, removedToastIds]);\n\n // Handles removal of a toast\n const handleRemoveToast = React.useCallback((id: string): void => {\n setVisibleToasts(prev => prev.filter(t => t.id !== id));\n // Add to removed IDs to prevent re-appearance\n setRemovedToastIds(prev => new Set([...prev, id]));\n\n // Clear timeout if exists\n const timeout = timeoutRefs.current.get(id);\n if (timeout) {\n clearTimeout(timeout);\n timeoutRefs.current.delete(id);\n }\n }, []);\n\n // Handle auto-removal of toasts after duration\n React.useEffect(() => {\n const timeouts = timeoutRefs.current;\n\n // Set up timeouts for new visible toasts that don't have timeout yet\n visibleToasts.forEach(toast => {\n if (!timeouts.has(toast.id)) {\n const timeout = setTimeout(() => {\n handleRemoveToast(toast.id);\n }, DURATION);\n\n timeouts.set(toast.id, timeout);\n }\n });\n }, [visibleToasts, handleRemoveToast]);\n\n // Cleanup timeouts for removed toasts\n React.useEffect(() => {\n const timeouts = timeoutRefs.current;\n const currentToastIds = new Set(visibleToasts.map(t => t.id));\n\n timeouts.forEach((timeout, id) => {\n if (!currentToastIds.has(id)) {\n clearTimeout(timeout);\n timeouts.delete(id);\n }\n });\n }, [visibleToasts]);\n\n // Cleanup all timeouts on unmount\n React.useEffect(() => {\n return (): void => {\n timeoutRefs.current.forEach(timeout => clearTimeout(timeout));\n timeoutRefs.current.clear();\n };\n }, []);\n\n const setRefs = mergeRefs([internalRef, ref]);\n\n return (\n <section ref={setRefs} className={styles['toast-list']} data-testid={testId}>\n <AnimatePresence mode=\"popLayout\">\n {visibleToasts.map(toast => (\n <motion.div\n key={toast.id}\n layout\n initial={{ opacity: 0, y: 50 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -20 }}\n transition={{\n layout: { type: 'spring', duration: 0.4, bounce: 0.1 },\n }}\n >\n <Toast\n testId={`${testId}-${toast.id}`}\n title={toast.title}\n message={toast.message}\n onClose={() => handleRemoveToast(toast.id)}\n />\n </motion.div>\n ))}\n </AnimatePresence>\n </section>\n );\n});\n\nToastList.displayName = 'ToastList';\n\nexport default ToastList;\n","import ToastList from './ToastList';\nexport * from './ToastList';\nexport default ToastList;\n"],"mappings":";;;;;;AAsBA,IAAM,WAAW;AAEjB,IAAM,YAAY,MAAM,YAAyC,OAAO,QAAQ;CAC9E,MAAM,EAAE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AO;AAChC,OAAI,CAAC,gBAAgB,IAAI,GAAG,EAAE;AAC5B,iBAAa,QAAQ;AACrB,aAAS,OAAO,GAAG;;IAErB;IACD,CAAC,cAAc,CAAC;AAGnB,OAAM,gBAAgB;AACpB,eAAmB;AACjB,eAAY,QAAQ,SAAQ,YAAW,aAAa,QAAQ,CAAC;AAC7D,eAAY,QAAQ,OAAO;;IAE5B,EAAE,CAAC;AAIN,QACE,oBAAC,WAAA;EAAQ,KAHK,UAAU,CAAC,aAAa,IAAI,CAAC;EAGpB,WAAW,OAAO;EAAe,eAAa;YACnE,oBAAC,iBAAA;GAAgB,MAAK;aACnB,cAAc,KAAI,UACjB,oBAAC,OAAO,KAAA;IAEN,QAAA;IACA,SAAS;KAAE,SAAS;KAAG,GAAG;KAAI;IAC9B,SAAS;KAAE,SAAS;KAAG,GAAG;KAAG;IAC7B,MAAM;KAAE,SAAS;KAAG,GAAG;KAAK;IAC5B,YAAY,EACV,QAAQ;KAAE,MAAM;KAAU,UAAU;KAAK,QAAQ;KAAK,EACvD;cAED,oBAAC,eAAA;KACC,QAAQ,GAAG,OAAO,GAAG,MAAM;KAC3B,OAAO,MAAM;KACb,SAAS,MAAM;KACf,eAAe,kBAAkB,MAAM,GAAG;MAC1C;MAdG,MAAM,GAeA,CACb;IACc;GACV;EAEZ;AAEF,UAAU,cAAc;ACpHxB,IAAA,oBDsHe"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as AnalyticsId } from "../../constants2.js";
|
|
2
2
|
import { t as usePseudoClasses } from "../../usePseudoClasses.js";
|
|
3
3
|
import React, { useEffect, useId, useState } from "react";
|
|
4
|
-
import
|
|
4
|
+
import classNames from "classnames";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useAnimate } from "motion/react";
|
|
7
7
|
import styles from "./styles.module.scss";
|
|
@@ -75,22 +75,22 @@ var Toggle = ({ checked = false, label, onChange, onColor = ToggleOnColor.onwhit
|
|
|
75
75
|
setShowToggleAnimation(true);
|
|
76
76
|
onChange?.(event);
|
|
77
77
|
};
|
|
78
|
-
const toggleContainerClassNames =
|
|
78
|
+
const toggleContainerClassNames = classNames(styles["toggle-container"], {
|
|
79
79
|
[styles["toggle-container--position-right"]]: togglePosition === TogglePosition.right,
|
|
80
80
|
[styles["toggle-container--with-status"]]: statusText !== void 0 && statusText !== null
|
|
81
81
|
});
|
|
82
|
-
const subLabelClassNames =
|
|
83
|
-
const statusTextClassNames =
|
|
84
|
-
const toggleClassNames =
|
|
82
|
+
const subLabelClassNames = classNames(styles["toggle-container__sublabel"]);
|
|
83
|
+
const statusTextClassNames = classNames(styles["toggle-container__status"], { [styles["toggle-container__status--checked"]]: checkedState });
|
|
84
|
+
const toggleClassNames = classNames(styles["toggle-container__toggle"], {
|
|
85
85
|
[styles["toggle-container__toggle--ignore-hover"]]: showToggleAnimation,
|
|
86
86
|
[styles["toggle-container__toggle--on-white"]]: onColor === ToggleOnColor.onwhite
|
|
87
87
|
});
|
|
88
|
-
const toggleDotClassNames =
|
|
88
|
+
const toggleDotClassNames = classNames(styles["toggle-container__toggle__dot"], { [styles["toggle-container__toggle__dot--ignore-hover"]]: showToggleAnimation });
|
|
89
89
|
const renderToggle = () => /* @__PURE__ */ jsxs("div", {
|
|
90
90
|
className: styles["toggle-container__outer-toggle"],
|
|
91
91
|
children: [/* @__PURE__ */ jsxs("label", {
|
|
92
92
|
ref: refObject,
|
|
93
|
-
className:
|
|
93
|
+
className: classNames(styles["toggle-container__toggle-group"]),
|
|
94
94
|
children: [/* @__PURE__ */ jsx("input", {
|
|
95
95
|
id: inputId,
|
|
96
96
|
type: "checkbox",
|
|
@@ -98,7 +98,7 @@ var Toggle = ({ checked = false, label, onChange, onColor = ToggleOnColor.onwhit
|
|
|
98
98
|
onChange: handleChange,
|
|
99
99
|
className: styles["toggle-container__input"],
|
|
100
100
|
"aria-label": label.map((l) => l.text).join(" "),
|
|
101
|
-
"aria-describedby":
|
|
101
|
+
"aria-describedby": [subLabel ? subLabelId : null, statusText ? toggleId + "-status" : null].filter(Boolean).join(" ") || void 0,
|
|
102
102
|
role: "switch"
|
|
103
103
|
}), /* @__PURE__ */ jsx("span", {
|
|
104
104
|
id: toggleId,
|
|
@@ -134,10 +134,10 @@ var Toggle = ({ checked = false, label, onChange, onColor = ToggleOnColor.onwhit
|
|
|
134
134
|
className: styles["toggle-container__outer-label"],
|
|
135
135
|
children: [/* @__PURE__ */ jsx("span", {
|
|
136
136
|
id: labelId,
|
|
137
|
-
className:
|
|
137
|
+
className: classNames(styles["toggle-container__label"]),
|
|
138
138
|
children: label.map((labelText) => {
|
|
139
139
|
return /* @__PURE__ */ jsx("span", {
|
|
140
|
-
className:
|
|
140
|
+
className: classNames({ [styles["toggle-container__label__text--subdued"]]: labelText.type === "subdued" }),
|
|
141
141
|
children: labelText.text
|
|
142
142
|
}, labelId + labelText.text);
|
|
143
143
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Toggle: React.FC<ToggleProps>"],"sources":["../../../src/components/Toggle/Toggle.tsx","../../../src/components/Toggle/index.ts"],"sourcesContent":["import React, { useState, useEffect, useId } from 'react';\n\nimport classNames from 'classnames';\nimport { useAnimate } from 'motion/react';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\n\nimport styles from './styles.module.scss';\nimport '../../scss/supernova/styles/colors.css';\n\nexport type LabelText = {\n text: string;\n type?: 'subdued' | 'normal';\n};\n\nexport type StatusTextType = {\n checked: string;\n unchecked: string;\n};\n\nexport enum TogglePosition {\n left = 'left',\n right = 'right',\n}\n\nexport enum ToggleOnColor {\n onwhite = 'onwhite',\n onneutral = 'onneutral',\n onblueberry = 'onblueberry',\n}\n\nexport interface ToggleProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n /** Determines if the Toggle is checked */\n checked?: boolean;\n /** Sets the label of the Toggle */\n label: LabelText[];\n /** Defines the color of the toggle */\n onColor?: keyof typeof ToggleOnColor;\n /** A text that is shown under the Toggle switch */\n statusText?: StatusTextType;\n /** Sets the sublabel of the Toggle */\n subLabel?: string;\n /** Sets the position of the toggle relative to the label */\n togglePosition?: keyof typeof TogglePosition;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst Toggle: React.FC<ToggleProps> = ({\n checked = false,\n label,\n onChange,\n onColor = ToggleOnColor.onwhite,\n statusText,\n subLabel,\n togglePosition = TogglePosition.left,\n testId,\n}: ToggleProps) => {\n const [checkedState, setCheckedState] = useState(checked);\n const [showToggleAnimation, setShowToggleAnimation] = useState(false);\n const [scope, animate] = useAnimate();\n const baseId = useId();\n const toggleId = 'toggle-' + baseId;\n const inputId = 'input-' + baseId;\n const labelId = 'label-' + baseId;\n const subLabelId = 'sublabel-' + baseId;\n const toggleRef = React.useRef<HTMLSpanElement>(null);\n const toggleDotRef = React.useRef<HTMLSpanElement>(null);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLLabelElement>(scope);\n const showHoveredStyling = isHovered && !showToggleAnimation;\n const isOnWhite = onColor === ToggleOnColor.onwhite;\n\n useEffect(() => {\n if (showToggleAnimation) {\n const timer = setTimeout(() => setShowToggleAnimation(false), 300);\n return (): void => clearTimeout(timer);\n }\n }, [showToggleAnimation]);\n\n useEffect(() => {\n setCheckedState(checked);\n }, [checked]);\n\n useEffect(() => {\n if (!toggleRef.current || !toggleDotRef.current) return;\n animate(toggleRef.current, { background: getBackgroundColor() }, { duration: 0.2, ease: 'easeInOut' });\n animate(\n toggleDotRef.current,\n { background: checkedState ? 'var(--color-action-graphics-ondark)' : 'var(--core-color-neutral-700)' },\n { duration: 0.2, ease: 'easeInOut' }\n );\n animate(toggleDotRef.current, { x: showHoveredStyling ? 9 : checkedState ? 18 : 0 }, { duration: 0.2, ease: 'easeInOut' });\n animate('svg', { opacity: checkedState ? 1 : 0 }, { duration: 0.2, ease: 'easeInOut' });\n }, [checkedState, showHoveredStyling, isActive]);\n\n const getBackgroundColor = (): string => {\n if (checkedState && isActive) {\n return 'var(--core-color-blueberry-800)';\n } else if (checkedState) {\n return showHoveredStyling ? 'var(--color-action-graphics-onlight-hover)' : 'var(--color-action-graphics-onlight)';\n } else if (isOnWhite && isActive) {\n return 'var(--core-color-neutral-400)';\n } else if (isOnWhite) {\n return showHoveredStyling ? 'var(--core-color-neutral-200)' : 'var(--core-color-neutral-50)';\n } else if (isActive) {\n return 'var(--core-color-neutral-200)';\n } else {\n return showHoveredStyling ? 'var(--core-color-neutral-50)' : 'var(--core-color-white)';\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setCheckedState(event.target.checked);\n setShowToggleAnimation(true);\n onChange?.(event);\n };\n\n const toggleContainerClassNames = classNames(styles['toggle-container'], {\n [styles['toggle-container--position-right']]: togglePosition === TogglePosition.right,\n [styles['toggle-container--with-status']]: statusText !== undefined && statusText !== null,\n });\n\n const subLabelClassNames = classNames(styles['toggle-container__sublabel']);\n\n const statusTextClassNames = classNames(styles['toggle-container__status'], {\n [styles['toggle-container__status--checked']]: checkedState,\n });\n\n const toggleClassNames = classNames(styles['toggle-container__toggle'], {\n [styles['toggle-container__toggle--ignore-hover']]: showToggleAnimation,\n [styles['toggle-container__toggle--on-white']]: onColor === ToggleOnColor.onwhite,\n });\n\n const toggleDotClassNames = classNames(styles['toggle-container__toggle__dot'], {\n [styles['toggle-container__toggle__dot--ignore-hover']]: showToggleAnimation,\n });\n\n const renderToggle = (): React.ReactElement => (\n <div className={styles['toggle-container__outer-toggle']}>\n <label ref={refObject} className={classNames(styles['toggle-container__toggle-group'])}>\n <input\n id={inputId}\n type=\"checkbox\"\n checked={checkedState}\n onChange={handleChange}\n className={styles['toggle-container__input']}\n aria-label={label.map(l => l.text).join(' ')}\n aria-describedby={`${subLabel ? subLabelId + ' ' : undefined} ${statusText ? toggleId + '-status' : undefined}`}\n role=\"switch\"\n />\n <span id={toggleId} ref={toggleRef} className={toggleClassNames} aria-hidden=\"true\">\n <span ref={toggleDotRef} className={toggleDotClassNames} aria-hidden=\"true\">\n <svg\n width=\"17\"\n height=\"13\"\n viewBox=\"0 0 17 13\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={styles['toggle-container__toggle__dot__icon']}\n >\n <path d=\"M15 2L6.80839 10.548L2 5.53145\" fill=\"none\" strokeWidth=\"3\" />\n </svg>\n </span>\n </span>\n </label>\n {statusText && (\n <span className={statusTextClassNames} id={toggleId + '-status'}>\n {checkedState ? statusText.checked : statusText.unchecked}\n </span>\n )}\n </div>\n );\n\n const renderLabelText = (): React.ReactElement => {\n return (\n <div className={styles['toggle-container__outer-label']}>\n <span id={labelId} className={classNames(styles['toggle-container__label'])}>\n {label.map(labelText => {\n const labelClassNames = classNames({\n [styles['toggle-container__label__text--subdued']]: labelText.type === 'subdued',\n });\n\n return (\n <span key={labelId + labelText.text} className={labelClassNames}>\n {labelText.text}\n </span>\n );\n })}\n </span>\n {subLabel && (\n <div id={subLabelId} className={subLabelClassNames}>\n {subLabel}\n </div>\n )}\n </div>\n );\n };\n\n return (\n <div className={toggleContainerClassNames} data-testid={testId} data-analyticsid={AnalyticsId.Toggle}>\n {togglePosition === TogglePosition.left && (\n <>\n {renderToggle()}\n {renderLabelText()}\n </>\n )}\n {togglePosition === TogglePosition.right && (\n <>\n {renderLabelText()}\n {renderToggle()}\n </>\n )}\n </div>\n );\n};\n\nexport default Toggle;\n","import Toggle from './Toggle';\nexport * from './Toggle';\nexport default Toggle;\n"],"mappings":";;;;;;;AAqBA,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,UAAA;AACA,kBAAA,WAAA;;;AAGF,IAAY,gBAAA,yBAAA,iBAAL;AACL,iBAAA,aAAA;AACA,iBAAA,eAAA;AACA,iBAAA,iBAAA;;;AAoBF,IAAMA,UAAiC,EACrC,UAAU,OACV,OACA,UACA,UAAU,cAAc,SACxB,YACA,UACA,iBAAiB,eAAe,MAChC,aACiB;CACjB,MAAM,CAAC,cAAc,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AM;OACnE;MACD;KACF,CAAA;IACD,EACP,cACC,oBAAC,QAAA;GAAK,WAAW;GAAsB,IAAI,WAAW;aACnD,eAAe,WAAW,UAAU,WAAW;IAC3C,CAAA;GAEL;CAGR,MAAM,wBAA4C;AAChD,SACE,qBAAC,OAAA;GAAI,WAAW,OAAO;cACrB,oBAAC,QAAA;IAAK,IAAI;IAAS,WAAW,GAAW,OAAO,2BAA2B;cACxE,MAAM,KAAI,cAAa;AAKtB,YACE,oBAAC,QAAA;MAAoC,WALf,GAAW,GAChC,OAAO,4CAA4C,UAAU,SAAS,WACxE,CAAC;gBAIG,UAAU;QADF,UAAU,UAAU,KAExB;MAET;KACG,EACN,YACC,oBAAC,OAAA;IAAI,IAAI;IAAY,WAAW;cAC7B;KACG,CAAA;IAEJ;;AAIV,QACE,qBAAC,OAAA;EAAI,WAAW;EAA2B,eAAa;EAAQ,oBAAkB,YAAY;aAC3F,mBAAmB,eAAe,QACjC,qBAAA,UAAA,EAAA,UAAA,CACG,cAAc,EACd,iBAAiB,CAAA,EAAA,CACjB,EAEJ,mBAAmB,eAAe,SACjC,qBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,EACjB,cAAc,CAAA,EAAA,CACd,CAAA;GAED;;AClNV,IAAA,iBDsNe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Toggle: React.FC<ToggleProps>"],"sources":["../../../src/components/Toggle/Toggle.tsx","../../../src/components/Toggle/index.ts"],"sourcesContent":["import React, { useState, useEffect, useId } from 'react';\n\nimport classNames from 'classnames';\nimport { useAnimate } from 'motion/react';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\n\nimport styles from './styles.module.scss';\nimport '../../scss/supernova/styles/colors.css';\n\nexport type LabelText = {\n text: string;\n type?: 'subdued' | 'normal';\n};\n\nexport type StatusTextType = {\n checked: string;\n unchecked: string;\n};\n\nexport enum TogglePosition {\n left = 'left',\n right = 'right',\n}\n\nexport enum ToggleOnColor {\n onwhite = 'onwhite',\n onneutral = 'onneutral',\n onblueberry = 'onblueberry',\n}\n\nexport interface ToggleProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n /** Determines if the Toggle is checked */\n checked?: boolean;\n /** Sets the label of the Toggle */\n label: LabelText[];\n /** Defines the color of the toggle */\n onColor?: keyof typeof ToggleOnColor;\n /** A text that is shown under the Toggle switch */\n statusText?: StatusTextType;\n /** Sets the sublabel of the Toggle */\n subLabel?: string;\n /** Sets the position of the toggle relative to the label */\n togglePosition?: keyof typeof TogglePosition;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst Toggle: React.FC<ToggleProps> = ({\n checked = false,\n label,\n onChange,\n onColor = ToggleOnColor.onwhite,\n statusText,\n subLabel,\n togglePosition = TogglePosition.left,\n testId,\n}: ToggleProps) => {\n const [checkedState, setCheckedState] = useState(checked);\n const [showToggleAnimation, setShowToggleAnimation] = useState(false);\n const [scope, animate] = useAnimate();\n const baseId = useId();\n const toggleId = 'toggle-' + baseId;\n const inputId = 'input-' + baseId;\n const labelId = 'label-' + baseId;\n const subLabelId = 'sublabel-' + baseId;\n const toggleRef = React.useRef<HTMLSpanElement>(null);\n const toggleDotRef = React.useRef<HTMLSpanElement>(null);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLLabelElement>(scope);\n const showHoveredStyling = isHovered && !showToggleAnimation;\n const isOnWhite = onColor === ToggleOnColor.onwhite;\n\n useEffect(() => {\n if (showToggleAnimation) {\n const timer = setTimeout(() => setShowToggleAnimation(false), 300);\n return (): void => clearTimeout(timer);\n }\n }, [showToggleAnimation]);\n\n useEffect(() => {\n setCheckedState(checked);\n }, [checked]);\n\n useEffect(() => {\n if (!toggleRef.current || !toggleDotRef.current) return;\n animate(toggleRef.current, { background: getBackgroundColor() }, { duration: 0.2, ease: 'easeInOut' });\n animate(\n toggleDotRef.current,\n { background: checkedState ? 'var(--color-action-graphics-ondark)' : 'var(--core-color-neutral-700)' },\n { duration: 0.2, ease: 'easeInOut' }\n );\n animate(toggleDotRef.current, { x: showHoveredStyling ? 9 : checkedState ? 18 : 0 }, { duration: 0.2, ease: 'easeInOut' });\n animate('svg', { opacity: checkedState ? 1 : 0 }, { duration: 0.2, ease: 'easeInOut' });\n }, [checkedState, showHoveredStyling, isActive]);\n\n const getBackgroundColor = (): string => {\n if (checkedState && isActive) {\n return 'var(--core-color-blueberry-800)';\n } else if (checkedState) {\n return showHoveredStyling ? 'var(--color-action-graphics-onlight-hover)' : 'var(--color-action-graphics-onlight)';\n } else if (isOnWhite && isActive) {\n return 'var(--core-color-neutral-400)';\n } else if (isOnWhite) {\n return showHoveredStyling ? 'var(--core-color-neutral-200)' : 'var(--core-color-neutral-50)';\n } else if (isActive) {\n return 'var(--core-color-neutral-200)';\n } else {\n return showHoveredStyling ? 'var(--core-color-neutral-50)' : 'var(--core-color-white)';\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setCheckedState(event.target.checked);\n setShowToggleAnimation(true);\n onChange?.(event);\n };\n\n const toggleContainerClassNames = classNames(styles['toggle-container'], {\n [styles['toggle-container--position-right']]: togglePosition === TogglePosition.right,\n [styles['toggle-container--with-status']]: statusText !== undefined && statusText !== null,\n });\n\n const subLabelClassNames = classNames(styles['toggle-container__sublabel']);\n\n const statusTextClassNames = classNames(styles['toggle-container__status'], {\n [styles['toggle-container__status--checked']]: checkedState,\n });\n\n const toggleClassNames = classNames(styles['toggle-container__toggle'], {\n [styles['toggle-container__toggle--ignore-hover']]: showToggleAnimation,\n [styles['toggle-container__toggle--on-white']]: onColor === ToggleOnColor.onwhite,\n });\n\n const toggleDotClassNames = classNames(styles['toggle-container__toggle__dot'], {\n [styles['toggle-container__toggle__dot--ignore-hover']]: showToggleAnimation,\n });\n\n const renderToggle = (): React.ReactElement => (\n <div className={styles['toggle-container__outer-toggle']}>\n <label ref={refObject} className={classNames(styles['toggle-container__toggle-group'])}>\n <input\n id={inputId}\n type=\"checkbox\"\n checked={checkedState}\n onChange={handleChange}\n className={styles['toggle-container__input']}\n aria-label={label.map(l => l.text).join(' ')}\n aria-describedby={[subLabel ? subLabelId : null, statusText ? toggleId + '-status' : null].filter(Boolean).join(' ') || undefined}\n role=\"switch\"\n />\n <span id={toggleId} ref={toggleRef} className={toggleClassNames} aria-hidden=\"true\">\n <span ref={toggleDotRef} className={toggleDotClassNames} aria-hidden=\"true\">\n <svg\n width=\"17\"\n height=\"13\"\n viewBox=\"0 0 17 13\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={styles['toggle-container__toggle__dot__icon']}\n >\n <path d=\"M15 2L6.80839 10.548L2 5.53145\" fill=\"none\" strokeWidth=\"3\" />\n </svg>\n </span>\n </span>\n </label>\n {statusText && (\n <span className={statusTextClassNames} id={toggleId + '-status'}>\n {checkedState ? statusText.checked : statusText.unchecked}\n </span>\n )}\n </div>\n );\n\n const renderLabelText = (): React.ReactElement => {\n return (\n <div className={styles['toggle-container__outer-label']}>\n <span id={labelId} className={classNames(styles['toggle-container__label'])}>\n {label.map(labelText => {\n const labelClassNames = classNames({\n [styles['toggle-container__label__text--subdued']]: labelText.type === 'subdued',\n });\n\n return (\n <span key={labelId + labelText.text} className={labelClassNames}>\n {labelText.text}\n </span>\n );\n })}\n </span>\n {subLabel && (\n <div id={subLabelId} className={subLabelClassNames}>\n {subLabel}\n </div>\n )}\n </div>\n );\n };\n\n return (\n <div className={toggleContainerClassNames} data-testid={testId} data-analyticsid={AnalyticsId.Toggle}>\n {togglePosition === TogglePosition.left && (\n <>\n {renderToggle()}\n {renderLabelText()}\n </>\n )}\n {togglePosition === TogglePosition.right && (\n <>\n {renderLabelText()}\n {renderToggle()}\n </>\n )}\n </div>\n );\n};\n\nexport default Toggle;\n","import Toggle from './Toggle';\nexport * from './Toggle';\nexport default Toggle;\n"],"mappings":";;;;;;;AAqBA,IAAY,iBAAA,yBAAA,kBAAL;AACL,kBAAA,UAAA;AACA,kBAAA,WAAA;;;AAGF,IAAY,gBAAA,y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AAK;IAAW,WAAW;IAAkB,eAAY;cAC3E,oBAAC,QAAA;KAAK,KAAK;KAAc,WAAW;KAAqB,eAAY;eACnE,oBAAC,OAAA;MACC,OAAM;MACN,QAAO;MACP,SAAQ;MACR,OAAM;MACN,WAAW,OAAO;gBAElB,oBAAC,QAAA;OAAK,GAAE;OAAiC,MAAK;OAAO,aAAY;QAAM;OACnE;MACD;KACF,CAAA;IACD,EACP,cACC,oBAAC,QAAA;GAAK,WAAW;GAAsB,IAAI,WAAW;aACnD,eAAe,WAAW,UAAU,WAAW;IAC3C,CAAA;GAEL;CAGR,MAAM,wBAA4C;AAChD,SACE,qBAAC,OAAA;GAAI,WAAW,OAAO;cACrB,oBAAC,QAAA;IAAK,IAAI;IAAS,WAAW,WAAW,OAAO,2BAA2B;cACxE,MAAM,KAAI,cAAa;AAKtB,YACE,oBAAC,QAAA;MAAoC,WALf,WAAW,GAChC,OAAO,4CAA4C,UAAU,SAAS,WACxE,CAAC;gBAIG,UAAU;QADF,UAAU,UAAU,KAExB;MAET;KACG,EACN,YACC,oBAAC,OAAA;IAAI,IAAI;IAAY,WAAW;cAC7B;KACG,CAAA;IAEJ;;AAIV,QACE,qBAAC,OAAA;EAAI,WAAW;EAA2B,eAAa;EAAQ,oBAAkB,YAAY;aAC3F,mBAAmB,eAAe,QACjC,qBAAA,UAAA,EAAA,UAAA,CACG,cAAc,EACd,iBAAiB,CAAA,EAAA,CACjB,EAEJ,mBAAmB,eAAe,SACjC,qBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,EACjB,cAAc,CAAA,EAAA,CACd,CAAA;GAED;;AClNV,IAAA,iBDsNe"}
|
|
@@ -1,59 +1,8 @@
|
|
|
1
|
-
import "../../uuid.js";
|
|
2
|
-
import "../../environment.js";
|
|
3
1
|
import { n as AnalyticsId } from "../../constants2.js";
|
|
4
|
-
import "../../usePseudoClasses.js";
|
|
5
|
-
import "../../grid.js";
|
|
6
|
-
import "../../palette.js";
|
|
7
|
-
import "../../spacers.js";
|
|
8
|
-
import "../../theme.js";
|
|
9
|
-
import "../../color.js";
|
|
10
|
-
import "../../spacing.js";
|
|
11
|
-
import "../../currys.js";
|
|
12
|
-
import "../../refs.js";
|
|
13
|
-
import "../../AsChildSlot.js";
|
|
14
|
-
import "../../Icon.js";
|
|
15
|
-
import "../../ArrowUpRight.js";
|
|
16
2
|
import { t as AnchorLink_default } from "../../AnchorLink.js";
|
|
17
|
-
import "../../language.js";
|
|
18
|
-
import "../../Check.js";
|
|
19
|
-
import "../../_rolldown_dynamic_import_helper.js";
|
|
20
|
-
import "../../useIsServerSide.js";
|
|
21
|
-
import "../../LazyIcon.js";
|
|
22
3
|
import { r as isComponentWithDisplayName, t as isComponent } from "../../component.js";
|
|
23
|
-
import "../../useBreakpoint.js";
|
|
24
|
-
import "../../useIdWithFallback.js";
|
|
25
|
-
import "../../accessibility.js";
|
|
26
|
-
import "../../ErrorWrapper.js";
|
|
27
|
-
import "../../Spacer.js";
|
|
28
|
-
import "../../Label.js";
|
|
29
|
-
import "../../FormFieldTag.js";
|
|
30
|
-
import "../../useElementList.js";
|
|
31
|
-
import "../../useFocusableElements.js";
|
|
32
|
-
import "../../useFocusToggle.js";
|
|
33
|
-
import "../../focus.js";
|
|
34
|
-
import "../../useFocusTrap.js";
|
|
35
|
-
import "../../useIntersectionObserver.js";
|
|
36
|
-
import "../../useIsVisible.js";
|
|
37
|
-
import "../../debounce.js";
|
|
38
|
-
import "../../useLayoutEvent.js";
|
|
39
|
-
import "../../usePrevious.js";
|
|
40
|
-
import "../../useSize.js";
|
|
41
|
-
import "../../useResizeObserver.js";
|
|
42
|
-
import "../../useToggle.js";
|
|
43
|
-
import "../../useKeyboardEvent.js";
|
|
44
|
-
import "../../useOutsideEvent.js";
|
|
45
|
-
import "../../mobile.js";
|
|
46
|
-
import "../../src.js";
|
|
47
|
-
import "../../StatusDot.js";
|
|
48
|
-
import "../../Checkbox.js";
|
|
49
4
|
import { t as Checkbox_default } from "../../Checkbox2.js";
|
|
50
|
-
import "../../Title.js";
|
|
51
5
|
import { t as Title_default } from "../../Title2.js";
|
|
52
|
-
import "../../ChevronDown.js";
|
|
53
|
-
import "../../FormLayout.js";
|
|
54
|
-
import "../../Input.js";
|
|
55
|
-
import "../../MaxCharacters.js";
|
|
56
|
-
import "../../RadioButton.js";
|
|
57
6
|
import { t as Select_default } from "../../Select.js";
|
|
58
7
|
import { t as Slider_default } from "../../Slider.js";
|
|
59
8
|
import { t as Textarea_default } from "../../Textarea.js";
|
|
@@ -62,7 +11,7 @@ import { t as Input_default } from "../../Input2.js";
|
|
|
62
11
|
import { t as List_default } from "../../List.js";
|
|
63
12
|
import { t as RadioButton_default } from "../../RadioButton2.js";
|
|
64
13
|
import React, { useId } from "react";
|
|
65
|
-
import
|
|
14
|
+
import classNames from "classnames";
|
|
66
15
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
67
16
|
import styles from "./styles.module.scss";
|
|
68
17
|
var ErrorListItem = (props) => {
|
|
@@ -88,7 +37,7 @@ var ValidationSummary = (props) => {
|
|
|
88
37
|
const titleId = useId();
|
|
89
38
|
const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;
|
|
90
39
|
const visuallyHidden = props.visuallyHidden;
|
|
91
|
-
const summaryClasses =
|
|
40
|
+
const summaryClasses = classNames(styles["validation__summary"], {
|
|
92
41
|
[styles["validation__summary--visible"]]: hasErrors && !visuallyHidden,
|
|
93
42
|
[styles["validation__summary--sr-only"]]: visuallyHidden
|
|
94
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ErrorListItem: React.FC<ErrorElementProps>","ErrorList: React.FC<ErrorListProps>","ValidationSummary: React.FC<ValidationSummaryProps>"],"sources":["../../../src/components/Validation/ErrorListItem.tsx","../../../src/components/Validation/ErrorList.tsx","../../../src/components/Validation/ValidationSummary.tsx","../../../src/components/Validation/Validation.tsx","../../../src/components/Validation/index.ts"],"sourcesContent":["import React from 'react';\n\nimport { ErrorDetails, FocusableElement } from './types';\nimport AnchorLink, { AnchorLinkOnClickEvent } from '../AnchorLink';\n\ninterface ErrorElementProps {\n name: string;\n error: ErrorDetails;\n}\n\nconst ErrorListItem: React.FC<ErrorElementProps> = props => {\n const handleClick = (event?: AnchorLinkOnClickEvent, element?: FocusableElement): void => {\n event?.preventDefault();\n if (element?.focus) element?.focus();\n };\n\n if (props.error.ref) {\n return (\n <AnchorLink href={`#${props.name}`} onClick={(e): void => handleClick(e, props.error.ref)}>\n {props.error.message}\n </AnchorLink>\n );\n }\n\n return <>{props.error.message}</>;\n};\n\nexport default ErrorListItem;\n","import React from 'react';\n\nimport ErrorListItem from './ErrorListItem';\nimport { ValidationErrors } from './types';\nimport List from '../List';\n\ninterface ErrorListProps {\n errors: ValidationErrors;\n}\n\nconst ErrorList: React.FC<ErrorListProps> = props => (\n <List>\n {Object.entries(props.errors).map(([name, error]) => (\n <List.Item key={name}>\n <ErrorListItem name={name} error={error} />\n </List.Item>\n ))}\n </List>\n);\n\nexport default ErrorList;\n","import React, { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport ErrorList from './ErrorList';\nimport { ValidationErrors } from './types';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationSummaryProps {\n /** Error summary title */\n errorTitle?: string;\n /** Error list */\n errors?: ValidationErrors;\n /** Markup props for error summary title. Default: h2 */\n errorTitleHtmlMarkup?: TitleTags;\n /** Will be shown last */\n children?: React.ReactNode;\n /** Hides the list visually - summary is still announced by screen readers */\n visuallyHidden?: boolean;\n}\n\nconst ValidationSummary: React.FC<ValidationSummaryProps> = props => {\n const { errorTitleHtmlMarkup = 'h2' } = props;\n const titleId = useId();\n\n const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;\n const visuallyHidden = props.visuallyHidden;\n\n const summaryClasses = classNames(styles['validation__summary'], {\n [styles['validation__summary--visible']]: hasErrors && !visuallyHidden,\n [styles['validation__summary--sr-only']]: visuallyHidden,\n });\n\n return (\n <div\n role={'status'}\n aria-atomic={'true'}\n aria-live={'polite'}\n aria-relevant={'all'}\n aria-labelledby={hasErrors && props.errorTitle ? titleId : undefined}\n className={summaryClasses}\n >\n {hasErrors && (\n <>\n {props.errorTitle && (\n <Title appearance=\"title4\" id={titleId} htmlMarkup={errorTitleHtmlMarkup} margin={{ marginTop: 0, marginBottom: 1 }}>\n {props.errorTitle}\n </Title>\n )}\n <ErrorList errors={props.errors!} />\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default ValidationSummary;\n","import React from 'react';\n\nimport { ValidationErrors } from './types';\nimport ValidationSummary from './ValidationSummary';\nimport { AnalyticsId, FormSize } from '../../constants';\nimport { isComponent, isComponentWithDisplayName } from '../../utils/component';\nimport Checkbox, { CheckboxProps } from '../Checkbox';\nimport { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport FormGroup, { FormGroupProps } from '../FormGroup/FormGroup';\nimport Input, { InputProps } from '../Input';\nimport RadioButton, { RadioButtonProps } from '../RadioButton';\nimport Select, { SelectProps } from '../Select';\nimport Slider, { SliderProps } from '../Slider';\nimport Textarea, { TextareaProps } from '../Textarea';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationProps {\n /** Error summary title */\n errorTitle?: string;\n /** Validation errors. If errors include references to HTML elements, the errors will be rendered as links with an onClick handler to focus the element. */\n errors?: ValidationErrors;\n /** Items in the Validation compontent */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Hides the ValidationSummary list visually - summary is still announced by screen readers */\n visuallyHiddenSummary?: boolean;\n}\n\nexport const Validation = React.forwardRef((props: ValidationProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const validationErrorClass = styles['validation__error-wrapper'];\n\n const cloneFormElement = <T extends ErrorWrapperClassNameProps>(child: React.ReactElement<T>): React.ReactElement<T> => {\n return React.cloneElement(child, {\n ...child.props,\n errorWrapperClassName: validationErrorClass,\n });\n };\n\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (\n isComponent<FormGroupProps>(child, FormGroup) ||\n isComponent<CheckboxProps>(child, Checkbox) ||\n isComponent<RadioButtonProps>(child, RadioButton) ||\n isComponent<TextareaProps>(child, Textarea) ||\n isComponent<InputProps>(child, Input) ||\n isComponent<SelectProps>(child, Select) ||\n isComponent<SliderProps>(child, Slider) ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTimePickerWrapper') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DatePicker') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTime')\n ) {\n return cloneFormElement<ErrorWrapperClassNameProps>(child);\n }\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return React.Children.map(child.props.children, (child: React.ReactNode) => {\n return renderChild(child);\n });\n }\n\n return child;\n };\n\n return (\n <>\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.Validation} className={props.className} ref={ref}>\n {React.Children.map(props.children, (child: React.ReactNode) => renderChild(child))}\n </div>\n <ValidationSummary errorTitle={props.errorTitle} errors={props.errors} visuallyHidden={props.visuallyHiddenSummary} />\n </>\n );\n});\n\nValidation.displayName = 'Validation';\n\nexport default Validation;\n","import Validation from './Validation';\nexport * from './Validation';\nexport default Validation;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ErrorListItem: React.FC<ErrorElementProps>","ErrorList: React.FC<ErrorListProps>","ValidationSummary: React.FC<ValidationSummaryProps>"],"sources":["../../../src/components/Validation/ErrorListItem.tsx","../../../src/components/Validation/ErrorList.tsx","../../../src/components/Validation/ValidationSummary.tsx","../../../src/components/Validation/Validation.tsx","../../../src/components/Validation/index.ts"],"sourcesContent":["import React from 'react';\n\nimport { ErrorDetails, FocusableElement } from './types';\nimport AnchorLink, { AnchorLinkOnClickEvent } from '../AnchorLink';\n\ninterface ErrorElementProps {\n name: string;\n error: ErrorDetails;\n}\n\nconst ErrorListItem: React.FC<ErrorElementProps> = props => {\n const handleClick = (event?: AnchorLinkOnClickEvent, element?: FocusableElement): void => {\n event?.preventDefault();\n if (element?.focus) element?.focus();\n };\n\n if (props.error.ref) {\n return (\n <AnchorLink href={`#${props.name}`} onClick={(e): void => handleClick(e, props.error.ref)}>\n {props.error.message}\n </AnchorLink>\n );\n }\n\n return <>{props.error.message}</>;\n};\n\nexport default ErrorListItem;\n","import React from 'react';\n\nimport ErrorListItem from './ErrorListItem';\nimport { ValidationErrors } from './types';\nimport List from '../List';\n\ninterface ErrorListProps {\n errors: ValidationErrors;\n}\n\nconst ErrorList: React.FC<ErrorListProps> = props => (\n <List>\n {Object.entries(props.errors).map(([name, error]) => (\n <List.Item key={name}>\n <ErrorListItem name={name} error={error} />\n </List.Item>\n ))}\n </List>\n);\n\nexport default ErrorList;\n","import React, { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport ErrorList from './ErrorList';\nimport { ValidationErrors } from './types';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationSummaryProps {\n /** Error summary title */\n errorTitle?: string;\n /** Error list */\n errors?: ValidationErrors;\n /** Markup props for error summary title. Default: h2 */\n errorTitleHtmlMarkup?: TitleTags;\n /** Will be shown last */\n children?: React.ReactNode;\n /** Hides the list visually - summary is still announced by screen readers */\n visuallyHidden?: boolean;\n}\n\nconst ValidationSummary: React.FC<ValidationSummaryProps> = props => {\n const { errorTitleHtmlMarkup = 'h2' } = props;\n const titleId = useId();\n\n const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;\n const visuallyHidden = props.visuallyHidden;\n\n const summaryClasses = classNames(styles['validation__summary'], {\n [styles['validation__summary--visible']]: hasErrors && !visuallyHidden,\n [styles['validation__summary--sr-only']]: visuallyHidden,\n });\n\n return (\n <div\n role={'status'}\n aria-atomic={'true'}\n aria-live={'polite'}\n aria-relevant={'all'}\n aria-labelledby={hasErrors && props.errorTitle ? titleId : undefined}\n className={summaryClasses}\n >\n {hasErrors && (\n <>\n {props.errorTitle && (\n <Title appearance=\"title4\" id={titleId} htmlMarkup={errorTitleHtmlMarkup} margin={{ marginTop: 0, marginBottom: 1 }}>\n {props.errorTitle}\n </Title>\n )}\n <ErrorList errors={props.errors!} />\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default ValidationSummary;\n","import React from 'react';\n\nimport { ValidationErrors } from './types';\nimport ValidationSummary from './ValidationSummary';\nimport { AnalyticsId, FormSize } from '../../constants';\nimport { isComponent, isComponentWithDisplayName } from '../../utils/component';\nimport Checkbox, { CheckboxProps } from '../Checkbox';\nimport { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport FormGroup, { FormGroupProps } from '../FormGroup/FormGroup';\nimport Input, { InputProps } from '../Input';\nimport RadioButton, { RadioButtonProps } from '../RadioButton';\nimport Select, { SelectProps } from '../Select';\nimport Slider, { SliderProps } from '../Slider';\nimport Textarea, { TextareaProps } from '../Textarea';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationProps {\n /** Error summary title */\n errorTitle?: string;\n /** Validation errors. If errors include references to HTML elements, the errors will be rendered as links with an onClick handler to focus the element. */\n errors?: ValidationErrors;\n /** Items in the Validation compontent */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Hides the ValidationSummary list visually - summary is still announced by screen readers */\n visuallyHiddenSummary?: boolean;\n}\n\nexport const Validation = React.forwardRef((props: ValidationProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const validationErrorClass = styles['validation__error-wrapper'];\n\n const cloneFormElement = <T extends ErrorWrapperClassNameProps>(child: React.ReactElement<T>): React.ReactElement<T> => {\n return React.cloneElement(child, {\n ...child.props,\n errorWrapperClassName: validationErrorClass,\n });\n };\n\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (\n isComponent<FormGroupProps>(child, FormGroup) ||\n isComponent<CheckboxProps>(child, Checkbox) ||\n isComponent<RadioButtonProps>(child, RadioButton) ||\n isComponent<TextareaProps>(child, Textarea) ||\n isComponent<InputProps>(child, Input) ||\n isComponent<SelectProps>(child, Select) ||\n isComponent<SliderProps>(child, Slider) ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTimePickerWrapper') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DatePicker') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTime')\n ) {\n return cloneFormElement<ErrorWrapperClassNameProps>(child);\n }\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return React.Children.map(child.props.children, (child: React.ReactNode) => {\n return renderChild(child);\n });\n }\n\n return child;\n };\n\n return (\n <>\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.Validation} className={props.className} ref={ref}>\n {React.Children.map(props.children, (child: React.ReactNode) => renderChild(child))}\n </div>\n <ValidationSummary errorTitle={props.errorTitle} errors={props.errors} visuallyHidden={props.visuallyHiddenSummary} />\n </>\n );\n});\n\nValidation.displayName = 'Validation';\n\nexport default Validation;\n","import Validation from './Validation';\nexport * from './Validation';\nexport default Validation;\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,IAAMA,iBAA6C,UAAS;CAC1D,MAAM,eAAe,OAAgC,YAAqC;AACxF,SAAO,gBAAgB;AACvB,MAAI,SAAS,MAAO,UAAS,OAAO;;AAGtC,KAAI,MAAM,MAAM,IACd,QACE,oBAAC,oBAAA;EAAW,MAAM,IAAI,MAAM;EAAQ,UAAU,MAAY,YAAY,GAAG,MAAM,MAAM,IAAI;YACtF,MAAM,MAAM;GACF;AAIjB,QAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,MAAM,SAAA,CAAW;;AAGnC,IAAA,wBAAe;ACjBf,IAAMC,aAAsC,UAC1C,oBAAC,cAAA,EAAA,UACE,OAAO,QAAQ,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,WACxC,oBAAC,aAAK,MA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B,IACtF,2BAAuD,OAAO,aAAa,IAC3E,2BAAuD,OAAO,WAAW,CAEzE,QAAO,iBAA6C,MAAM;AAE5D,MAAI,MAAM,eAAe,MAAM,IAAI,MAAM,SAAS,MAAM,SACtD,QAAO,MAAM,SAAS,IAAI,MAAM,MAAM,WAAW,YAA2B;AAC1E,UAAO,YAAY,QAAM;IACzB;AAGJ,SAAO;;AAGT,QACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,OAAA;EAAI,eAAa,MAAM;EAAQ,oBAAkB,YAAY;EAAY,WAAW,MAAM;EAAgB;YACxG,MAAM,SAAS,IAAI,MAAM,WAAW,UAA2B,YAAY,MAAM,CAAC;GAC/E,EACN,oBAAC,2BAAA;EAAkB,YAAY,MAAM;EAAY,QAAQ,MAAM;EAAQ,gBAAgB,MAAM;GAAyB,CAAA,EAAA,CACrH;EAEL;AAEF,WAAW,cAAc;AC5EzB,IAAA,qBD8Ee"}
|
package/lib/floating-ui.react.js
CHANGED
|
@@ -270,17 +270,17 @@ function rectToClientRect(rect) {
|
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
var candidateSelector = /* @__PURE__ */ [
|
|
273
|
-
"input:not([inert])",
|
|
274
|
-
"select:not([inert])",
|
|
275
|
-
"textarea:not([inert])",
|
|
276
|
-
"a[href]:not([inert])",
|
|
277
|
-
"button:not([inert])",
|
|
278
|
-
"[tabindex]:not(slot):not([inert])",
|
|
279
|
-
"audio[controls]:not([inert])",
|
|
280
|
-
"video[controls]:not([inert])",
|
|
281
|
-
"[contenteditable]:not([contenteditable=\"false\"]):not([inert])",
|
|
282
|
-
"details>summary:first-of-type:not([inert])",
|
|
283
|
-
"details:not([inert])"
|
|
273
|
+
"input:not([inert]):not([inert] *)",
|
|
274
|
+
"select:not([inert]):not([inert] *)",
|
|
275
|
+
"textarea:not([inert]):not([inert] *)",
|
|
276
|
+
"a[href]:not([inert]):not([inert] *)",
|
|
277
|
+
"button:not([inert]):not([inert] *)",
|
|
278
|
+
"[tabindex]:not(slot):not([inert]):not([inert] *)",
|
|
279
|
+
"audio[controls]:not([inert]):not([inert] *)",
|
|
280
|
+
"video[controls]:not([inert]):not([inert] *)",
|
|
281
|
+
"[contenteditable]:not([contenteditable=\"false\"]):not([inert]):not([inert] *)",
|
|
282
|
+
"details>summary:first-of-type:not([inert]):not([inert] *)",
|
|
283
|
+
"details:not([inert]):not([inert] *)"
|
|
284
284
|
].join(",");
|
|
285
285
|
var NoElement = typeof Element === "undefined";
|
|
286
286
|
var matches = NoElement ? function() {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
@@ -294,7 +294,7 @@ var _isInert = function isInert(node, lookUp) {
|
|
|
294
294
|
var _node$getAttribute;
|
|
295
295
|
if (lookUp === void 0) lookUp = true;
|
|
296
296
|
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
|
|
297
|
-
return inertAtt === "" || inertAtt === "true" || lookUp && node && _isInert(node.parentNode);
|
|
297
|
+
return inertAtt === "" || inertAtt === "true" || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode));
|
|
298
298
|
};
|
|
299
299
|
var isContentEditable = function isContentEditable$1(node) {
|
|
300
300
|
var _node$getAttribute2;
|
|
@@ -463,7 +463,7 @@ var isDisabledFromFieldset = function isDisabledFromFieldset$1(node) {
|
|
|
463
463
|
return false;
|
|
464
464
|
};
|
|
465
465
|
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable$1(options, node) {
|
|
466
|
-
if (node.disabled ||
|
|
466
|
+
if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) return false;
|
|
467
467
|
return true;
|
|
468
468
|
};
|
|
469
469
|
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable$1(options, node) {
|
|
@@ -745,6 +745,46 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
745
745
|
}
|
|
746
746
|
return coords;
|
|
747
747
|
}
|
|
748
|
+
async function detectOverflow$1(state, options) {
|
|
749
|
+
var _await$platform$isEle;
|
|
750
|
+
if (options === void 0) options = {};
|
|
751
|
+
const { x, y, platform: platform$1, rects, elements, strategy } = state;
|
|
752
|
+
const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
|
|
753
|
+
const paddingObject = getPaddingObject(padding);
|
|
754
|
+
const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
|
|
755
|
+
const clippingClientRect = rectToClientRect(await platform$1.getClippingRect({
|
|
756
|
+
element: ((_await$platform$isEle = await (platform$1.isElement == null ? void 0 : platform$1.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform$1.getDocumentElement == null ? void 0 : platform$1.getDocumentElement(elements.floating)),
|
|
757
|
+
boundary,
|
|
758
|
+
rootBoundary,
|
|
759
|
+
strategy
|
|
760
|
+
}));
|
|
761
|
+
const rect = elementContext === "floating" ? {
|
|
762
|
+
x,
|
|
763
|
+
y,
|
|
764
|
+
width: rects.floating.width,
|
|
765
|
+
height: rects.floating.height
|
|
766
|
+
} : rects.reference;
|
|
767
|
+
const offsetParent = await (platform$1.getOffsetParent == null ? void 0 : platform$1.getOffsetParent(elements.floating));
|
|
768
|
+
const offsetScale = await (platform$1.isElement == null ? void 0 : platform$1.isElement(offsetParent)) ? await (platform$1.getScale == null ? void 0 : platform$1.getScale(offsetParent)) || {
|
|
769
|
+
x: 1,
|
|
770
|
+
y: 1
|
|
771
|
+
} : {
|
|
772
|
+
x: 1,
|
|
773
|
+
y: 1
|
|
774
|
+
};
|
|
775
|
+
const elementClientRect = rectToClientRect(platform$1.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform$1.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
776
|
+
elements,
|
|
777
|
+
rect,
|
|
778
|
+
offsetParent,
|
|
779
|
+
strategy
|
|
780
|
+
}) : rect);
|
|
781
|
+
return {
|
|
782
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
783
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
784
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
785
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
786
|
+
};
|
|
787
|
+
}
|
|
748
788
|
var computePosition$1 = async (reference, floating, config) => {
|
|
749
789
|
const { placement = "bottom", strategy = "absolute", middleware = [], platform: platform$1 } = config;
|
|
750
790
|
const validMiddleware = middleware.filter(Boolean);
|
|
@@ -759,6 +799,7 @@ var computePosition$1 = async (reference, floating, config) => {
|
|
|
759
799
|
let middlewareData = {};
|
|
760
800
|
let resetCount = 0;
|
|
761
801
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
802
|
+
var _platform$detectOverf;
|
|
762
803
|
const { name, fn } = validMiddleware[i];
|
|
763
804
|
const { x: nextX, y: nextY, data, reset } = await fn({
|
|
764
805
|
x,
|
|
@@ -768,7 +809,10 @@ var computePosition$1 = async (reference, floating, config) => {
|
|
|
768
809
|
strategy,
|
|
769
810
|
middlewareData,
|
|
770
811
|
rects,
|
|
771
|
-
platform:
|
|
812
|
+
platform: {
|
|
813
|
+
...platform$1,
|
|
814
|
+
detectOverflow: (_platform$detectOverf = platform$1.detectOverflow) != null ? _platform$detectOverf : detectOverflow$1
|
|
815
|
+
},
|
|
772
816
|
elements: {
|
|
773
817
|
reference,
|
|
774
818
|
floating
|
|
@@ -805,46 +849,6 @@ var computePosition$1 = async (reference, floating, config) => {
|
|
|
805
849
|
middlewareData
|
|
806
850
|
};
|
|
807
851
|
};
|
|
808
|
-
async function detectOverflow$1(state, options) {
|
|
809
|
-
var _await$platform$isEle;
|
|
810
|
-
if (options === void 0) options = {};
|
|
811
|
-
const { x, y, platform: platform$1, rects, elements, strategy } = state;
|
|
812
|
-
const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
|
|
813
|
-
const paddingObject = getPaddingObject(padding);
|
|
814
|
-
const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
|
|
815
|
-
const clippingClientRect = rectToClientRect(await platform$1.getClippingRect({
|
|
816
|
-
element: ((_await$platform$isEle = await (platform$1.isElement == null ? void 0 : platform$1.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform$1.getDocumentElement == null ? void 0 : platform$1.getDocumentElement(elements.floating)),
|
|
817
|
-
boundary,
|
|
818
|
-
rootBoundary,
|
|
819
|
-
strategy
|
|
820
|
-
}));
|
|
821
|
-
const rect = elementContext === "floating" ? {
|
|
822
|
-
x,
|
|
823
|
-
y,
|
|
824
|
-
width: rects.floating.width,
|
|
825
|
-
height: rects.floating.height
|
|
826
|
-
} : rects.reference;
|
|
827
|
-
const offsetParent = await (platform$1.getOffsetParent == null ? void 0 : platform$1.getOffsetParent(elements.floating));
|
|
828
|
-
const offsetScale = await (platform$1.isElement == null ? void 0 : platform$1.isElement(offsetParent)) ? await (platform$1.getScale == null ? void 0 : platform$1.getScale(offsetParent)) || {
|
|
829
|
-
x: 1,
|
|
830
|
-
y: 1
|
|
831
|
-
} : {
|
|
832
|
-
x: 1,
|
|
833
|
-
y: 1
|
|
834
|
-
};
|
|
835
|
-
const elementClientRect = rectToClientRect(platform$1.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform$1.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
836
|
-
elements,
|
|
837
|
-
rect,
|
|
838
|
-
offsetParent,
|
|
839
|
-
strategy
|
|
840
|
-
}) : rect);
|
|
841
|
-
return {
|
|
842
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
843
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
844
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
845
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
852
|
var arrow$2 = (options) => ({
|
|
849
853
|
name: "arrow",
|
|
850
854
|
options,
|
|
@@ -908,7 +912,7 @@ var flip$2 = function(options) {
|
|
|
908
912
|
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
909
913
|
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
910
914
|
const placements$1 = [initialPlacement, ...fallbackPlacements];
|
|
911
|
-
const overflow = await
|
|
915
|
+
const overflow = await platform$1.detectOverflow(state, detectOverflowOptions);
|
|
912
916
|
const overflows = [];
|
|
913
917
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
914
918
|
if (checkMainAxis) overflows.push(overflow[side]);
|
|
@@ -974,11 +978,11 @@ var hide$2 = function(options) {
|
|
|
974
978
|
name: "hide",
|
|
975
979
|
options,
|
|
976
980
|
async fn(state) {
|
|
977
|
-
const { rects } = state;
|
|
981
|
+
const { rects, platform: platform$1 } = state;
|
|
978
982
|
const { strategy = "referenceHidden", ...detectOverflowOptions } = evaluate(options, state);
|
|
979
983
|
switch (strategy) {
|
|
980
984
|
case "referenceHidden": {
|
|
981
|
-
const offsets = getSideOffsets(await
|
|
985
|
+
const offsets = getSideOffsets(await platform$1.detectOverflow(state, {
|
|
982
986
|
...detectOverflowOptions,
|
|
983
987
|
elementContext: "reference"
|
|
984
988
|
}), rects.reference);
|
|
@@ -988,7 +992,7 @@ var hide$2 = function(options) {
|
|
|
988
992
|
} };
|
|
989
993
|
}
|
|
990
994
|
case "escaped": {
|
|
991
|
-
const offsets = getSideOffsets(await
|
|
995
|
+
const offsets = getSideOffsets(await platform$1.detectOverflow(state, {
|
|
992
996
|
...detectOverflowOptions,
|
|
993
997
|
altBoundary: true
|
|
994
998
|
}), rects.floating);
|
|
@@ -1057,7 +1061,7 @@ var shift$2 = function(options) {
|
|
|
1057
1061
|
name: "shift",
|
|
1058
1062
|
options,
|
|
1059
1063
|
async fn(state) {
|
|
1060
|
-
const { x, y, placement } = state;
|
|
1064
|
+
const { x, y, placement, platform: platform$1 } = state;
|
|
1061
1065
|
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
|
|
1062
1066
|
let { x: x$1, y: y$1 } = _ref;
|
|
1063
1067
|
return {
|
|
@@ -1069,7 +1073,7 @@ var shift$2 = function(options) {
|
|
|
1069
1073
|
x,
|
|
1070
1074
|
y
|
|
1071
1075
|
};
|
|
1072
|
-
const overflow = await
|
|
1076
|
+
const overflow = await platform$1.detectOverflow(state, detectOverflowOptions);
|
|
1073
1077
|
const crossAxis = getSideAxis(getSide(placement));
|
|
1074
1078
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
1075
1079
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -1116,7 +1120,7 @@ var size$2 = function(options) {
|
|
|
1116
1120
|
var _state$middlewareData, _state$middlewareData2;
|
|
1117
1121
|
const { placement, rects, platform: platform$1, elements } = state;
|
|
1118
1122
|
const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
|
|
1119
|
-
const overflow = await
|
|
1123
|
+
const overflow = await platform$1.detectOverflow(state, detectOverflowOptions);
|
|
1120
1124
|
const side = getSide(placement);
|
|
1121
1125
|
const alignment = getAlignment(placement);
|
|
1122
1126
|
const isYAxis = getSideAxis(placement) === "y";
|