@helsenorge/designsystem-react 13.5.0 → 13.6.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 +24 -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/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
package/lib/Label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { LabelText } from './Label';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import React, { FunctionComponent } from 'react';\n\nimport cn from 'classnames';\n\nimport { Sublabel, SublabelProps } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag, { FormFieldTagProps } from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot, { StatusDotProps } from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\nexport const renderLabel = (label: React.ReactNode, inputId: string, onColor: FormOnColor, markup?: LabelTags): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n htmlMarkup: markup || 'label',\n onColor,\n })\n : typeof label === 'string' && <Label labelTexts={[{ text: label, type: 'normal' }]} htmlFor={inputId} onColor={onColor} />}\n </>\n );\n};\n\nexport const renderLabelAsParent = (\n label: React.ReactNode,\n children: React.ReactNode,\n inputId: string,\n onColor: FormOnColor,\n labelClassName?: string,\n labelTextClassName?: string,\n sublabelWrapperClassName?: string,\n large?: boolean,\n markup?: LabelTags\n): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n onColor,\n children: children,\n labelClassName: cn(labelClassName, label.props.labelClassName),\n labelTextClassName: labelTextClassName,\n htmlMarkup: markup || 'label',\n sublabelWrapperClassName: sublabelWrapperClassName,\n sublabel: large ? undefined : label.props.sublabel,\n statusDot: large ? undefined : label.props.statusDot,\n })\n : typeof label === 'string' && (\n <Label\n labelTexts={[{ text: label, type: 'subdued' }]}\n htmlFor={inputId}\n onColor={onColor}\n htmlMarkup={markup || 'label'}\n labelClassName={labelClassName}\n labelTextClassName={labelTextClassName}\n sublabelWrapperClassName={sublabelWrapperClassName}\n >\n {children}\n </Label>\n )}\n </>\n );\n};\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(\n styles['label-wrapper'],\n { [styles['label-wrapper--no-bottom-margin']]: hasChildren, [styles['label-wrapper--after-label-children']]: afterLabelChildren },\n className\n );\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n {afterLabelChildren && <div className={styles['after-label-children']}>{afterLabelChildren}</div>}\n </div>\n );\n};\n\nexport default Label;\n","import Label from './Label';\nexport { Sublabel } from './SubLabel';\nexport * from './Label';\nexport default Label;\n"],"mappings":";;;;;;;;;AAyBA,MAAaA,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;AACxE,SACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,GAAG,OAAO,OAAO,OAAO,aAAa;KACvD,OAAO,uBAAuB,aAAa,SAAS;KACpD,OAAO,uBAAuB,YAAY,YAAY;IACxD,CAAC;AACF,UACE,yBAAyB,aAAa,wBACpC,oB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AS,EACtB,MAAM,aAAa,WAAW,EAC7B,SAAS,YAAY,YAAY,SAAS,WAAW,WACtD,CAAC,CAAA,EAAA,CACD;;IAED,CAAA,EAAA,CAEJ,EACL,sBAAsB,oBAAC,OAAA;GAAI,WAAW,OAAO;aAA0B;IAAyB,CAAA;GAC7F;;ACjMV,IAAA,kBDqMe"}
|
|
1
|
+
{"version":3,"file":"Label.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport cn from 'classnames';\n\nimport { LabelText } from './Label';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import React, { FunctionComponent } from 'react';\n\nimport cn from 'classnames';\n\nimport { Sublabel, SublabelProps } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag, { FormFieldTagProps } from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot, { StatusDotProps } from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\nexport const renderLabel = (label: React.ReactNode, inputId: string, onColor: FormOnColor, markup?: LabelTags): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n htmlMarkup: markup || 'label',\n onColor,\n })\n : typeof label === 'string' && <Label labelTexts={[{ text: label, type: 'normal' }]} htmlFor={inputId} onColor={onColor} />}\n </>\n );\n};\n\nexport const renderLabelAsParent = (\n label: React.ReactNode,\n children: React.ReactNode,\n inputId: string,\n onColor: FormOnColor,\n labelClassName?: string,\n labelTextClassName?: string,\n sublabelWrapperClassName?: string,\n large?: boolean,\n markup?: LabelTags\n): React.ReactNode => {\n return (\n <>\n {label && isComponent<LabelProps>(label, Label)\n ? React.cloneElement(label, {\n htmlFor: inputId,\n onColor,\n children: children,\n labelClassName: cn(labelClassName, label.props.labelClassName),\n labelTextClassName: labelTextClassName,\n htmlMarkup: markup || 'label',\n sublabelWrapperClassName: sublabelWrapperClassName,\n sublabel: large ? undefined : label.props.sublabel,\n statusDot: large ? undefined : label.props.statusDot,\n })\n : typeof label === 'string' && (\n <Label\n labelTexts={[{ text: label, type: 'subdued' }]}\n htmlFor={inputId}\n onColor={onColor}\n htmlMarkup={markup || 'label'}\n labelClassName={labelClassName}\n labelTextClassName={labelTextClassName}\n sublabelWrapperClassName={sublabelWrapperClassName}\n >\n {children}\n </Label>\n )}\n </>\n );\n};\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(\n styles['label-wrapper'],\n { [styles['label-wrapper--no-bottom-margin']]: hasChildren, [styles['label-wrapper--after-label-children']]: afterLabelChildren },\n className\n );\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n {afterLabelChildren && <div className={styles['after-label-children']}>{afterLabelChildren}</div>}\n </div>\n );\n};\n\nexport default Label;\n","import Label from './Label';\nexport { Sublabel } from './SubLabel';\nexport * from './Label';\nexport default Label;\n"],"mappings":";;;;;;;;;AAyBA,MAAaA,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;AACxE,SACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,WAAG,OAAO,OAAO,OAAO,aAAa;KACvD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C;IACH,aAAa,YAA4B,WAAW,kBAAU,IAC7D,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,gBAAA,EAAO,MAAM,OAAA,CAAS,EACtB,MAAM,aAAa,WAAW,EAC7B,SAAS,YAAY,YAAY,SAAS,WAAW,WACtD,CAAC,CAAA,EAAA,CACD;;IAED,CAAA,EAAA,CAEJ,EACL,sBAAsB,oBAAC,OAAA;GAAI,WAAW,OAAO;aAA0B;IAAyB,CAAA;GAC7F;;ACjMV,IAAA,kBDqMe"}
|
package/lib/LinkList.js
CHANGED
|
@@ -6,7 +6,7 @@ import { i as renderElementHeader } from "./ElementHeader.js";
|
|
|
6
6
|
import { i as listEditModeWrapperClassnames, t as ListEditMode_default } from "./ListEditMode.js";
|
|
7
7
|
import { t as ChevronRight_default } from "./ChevronRight.js";
|
|
8
8
|
import React from "react";
|
|
9
|
-
import
|
|
9
|
+
import classNames from "classnames";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import LinkListStyles from "./components/LinkList/styles.module.scss";
|
|
12
12
|
var HN_Designsystem_LinkList_en_GB_default = { editMode_deleteButtonAriaLabel: "Delete" };
|
|
@@ -25,12 +25,12 @@ const Link = React.forwardRef((props, ref) => {
|
|
|
25
25
|
const isFillNegative = variant === "fill-negative";
|
|
26
26
|
const isOutline = variant === "outline";
|
|
27
27
|
const isLine = variant === "line";
|
|
28
|
-
const liClasses =
|
|
28
|
+
const liClasses = classNames(LinkListStyles["link-list"], {
|
|
29
29
|
[LinkListStyles["link-list__list-item--line"]]: isLine,
|
|
30
30
|
[LinkListStyles["link-list__list-item--outline"]]: isOutline,
|
|
31
31
|
[LinkListStyles[`link-list__list-item--outline--${color}`]]: isOutline
|
|
32
32
|
});
|
|
33
|
-
const linkClasses =
|
|
33
|
+
const linkClasses = classNames(LinkListStyles["link-list__anchor"], LinkListStyles[`link-list__anchor--${color}`], {
|
|
34
34
|
[LinkListStyles[`link-list__anchor--line--${color}`]]: isLine,
|
|
35
35
|
[LinkListStyles["link-list__anchor--fill"]]: isFill,
|
|
36
36
|
[LinkListStyles[`link-list__anchor--fill--${color}`]]: isFill,
|
|
@@ -42,7 +42,7 @@ const Link = React.forwardRef((props, ref) => {
|
|
|
42
42
|
[LinkListStyles["link-list__anchor--button"]]: htmlMarkup === "button",
|
|
43
43
|
[LinkListStyles["link-list__anchor--new"]]: status === "new"
|
|
44
44
|
}, className);
|
|
45
|
-
const statusMarkerClasses =
|
|
45
|
+
const statusMarkerClasses = classNames(LinkListStyles["link-list__status-marker"], { [LinkListStyles["link-list__status-marker--new"]]: status === "new" });
|
|
46
46
|
const imageContainer = /* @__PURE__ */ jsx("span", {
|
|
47
47
|
className: LinkListStyles["link-list__image-container"],
|
|
48
48
|
children: image
|
|
@@ -112,7 +112,7 @@ const LinkList = React.forwardRef(function LinkListForwardedRef(props, ref) {
|
|
|
112
112
|
};
|
|
113
113
|
return /* @__PURE__ */ jsx("ul", {
|
|
114
114
|
ref,
|
|
115
|
-
className:
|
|
115
|
+
className: classNames(LinkListStyles["link-list"], className, {
|
|
116
116
|
[LinkListStyles[`link-list--outline--${color}`]]: variant === "outline",
|
|
117
117
|
[listEditModeWrapperClassnames]: editMode
|
|
118
118
|
}),
|
package/lib/LinkList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkList.js","names":["Link: LinkType","mergedResources: HNDesignsystemLinkList"],"sources":["../src/resources/HN.Designsystem.LinkList.en-GB.json","../src/resources/HN.Designsystem.LinkList.nb-NO.json","../src/components/LinkList/resourceHelper.ts","../src/components/LinkList/LinkList.tsx","../src/components/LinkList/index.ts"],"sourcesContent":["{\n \"editMode_deleteButtonAriaLabel\": \"Delete\"\n}\n","{\n \"editMode_deleteButtonAriaLabel\": \"Slett\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.LinkList.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.LinkList.nb-NO.json';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemLinkList => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\nimport { PaletteNames } from '../../theme/palette';\nimport { useLanguage } from '../../utils/language';\nimport { ElementHeaderType, renderElementHeader } from '../ElementHeader/ElementHeader';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ListEditModeItem, { ListEditModeItemProps, listEditModeWrapperClassnames } from '../ListEditMode';\nimport { getResources } from './resourceHelper';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\n\nimport LinkListStyles from './styles.module.scss';\n\nexport type LinkListSize = 'small' | 'medium' | 'large';\n\nexport type LinkListStatus = 'none' | 'new';\n\nexport type LinkAnchorTargets = '_self' | '_blank' | '_parent';\n\nexport type LinkListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport type LinkListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport interface LinkType extends React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLLIElement>> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport type LinkTags = 'button' | 'a';\nexport interface CompoundComponent extends React.ForwardRefExoticComponent<LinkListProps & React.RefAttributes<HTMLUListElement>> {\n Link: LinkType;\n}\n\nexport interface LinkListProps {\n /** Items in the LinkList */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: LinkListColors;\n /** Toggles chevron icon on or off. */\n chevron?: boolean;\n /** Changes size of the LinkList. */\n size?: LinkListSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: LinkListVariant;\n /** Highlights text. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\nexport type LinkProps = Modify<\n React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,\n {\n children: React.ReactNode;\n /** @private Turns chevron icon on/off. Overwritten by LinkList so not possible to set on LinkList.Link */\n chevron?: boolean;\n className?: string;\n icon?: React.ReactElement;\n /** Renders the image in the LinkList header */\n image?: React.ReactElement;\n /** Displays a status on the left side: default none */\n status?: LinkListStatus;\n href?: string;\n target?: LinkAnchorTargets;\n /** HTML markup for link. Default: a */\n htmlMarkup?: LinkTags;\n /** Ref for lenke/knapp */\n linkRef?: React.RefObject<HTMLButtonElement | HTMLAnchorElement> | null;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text. Override if different from list */\n highlightText?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n /** @experimental id for content (only used in edit mode for aria-describedby) */\n contentId?: string;\n /** Replaces the chevron with an arrow up right which is used for indicating external links */\n external?: boolean;\n }\n> &\n Pick<LinkListProps, 'color' | 'size' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Link: LinkType = React.forwardRef((props: LinkProps, ref: React.Ref<HTMLLIElement>) => {\n const {\n children,\n className = '',\n color = 'white',\n icon,\n image,\n size = 'medium',\n chevron = false,\n linkRef,\n status = 'none',\n testId,\n target,\n variant,\n htmlMarkup = 'a',\n highlightText,\n editMode = false,\n contentId,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n resources, // used by ListEditModeItem in LinkList\n external = false,\n ...restProps\n } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement | HTMLAnchorElement>(linkRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const liClasses = cn(LinkListStyles['link-list'], {\n [LinkListStyles['link-list__list-item--line']]: isLine,\n [LinkListStyles['link-list__list-item--outline']]: isOutline,\n [LinkListStyles[`link-list__list-item--outline--${color}`]]: isOutline,\n });\n const linkClasses = cn(\n LinkListStyles['link-list__anchor'],\n LinkListStyles[`link-list__anchor--${color}`],\n {\n [LinkListStyles[`link-list__anchor--line--${color}`]]: isLine,\n [LinkListStyles['link-list__anchor--fill']]: isFill,\n [LinkListStyles[`link-list__anchor--fill--${color}`]]: isFill,\n [LinkListStyles['link-list__anchor--outline']]: isOutline,\n [LinkListStyles[`link-list__anchor--outline--${color}`]]: isOutline,\n [LinkListStyles['link-list__anchor--fill-negative']]: isFillNegative,\n [LinkListStyles[`link-list__anchor--fill-negative--${color}`]]: isFillNegative,\n [LinkListStyles[`link-list__anchor--${size}`]]: size,\n [LinkListStyles['link-list__anchor--button']]: htmlMarkup === 'button',\n [LinkListStyles['link-list__anchor--new']]: status === 'new',\n },\n className\n );\n\n const statusMarkerClasses = cn(LinkListStyles['link-list__status-marker'], {\n [LinkListStyles['link-list__status-marker--new']]: status === 'new',\n });\n\n const imageContainer = <span className={LinkListStyles['link-list__image-container']}>{image}</span>;\n\n let chevronIcon = undefined;\n if (external) {\n chevronIcon = ArrowUpRight;\n } else if (chevron) {\n chevronIcon = ChevronRight;\n }\n\n return editMode ? (\n <div id={contentId} className={liClasses} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n <div className={linkClasses}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={liClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n {htmlMarkup === 'a' ? (\n <a\n className={linkClasses}\n ref={refObject as React.RefObject<HTMLAnchorElement>}\n rel={target === '_blank' ? 'noopener noreferrer' : undefined}\n target={target}\n {...restProps}\n >\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </a>\n ) : (\n htmlMarkup === 'button' && (\n <button className={linkClasses} ref={refObject as React.RefObject<HTMLButtonElement>} type=\"button\" {...restProps}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </button>\n )\n )}\n </li>\n );\n});\n\nexport const LinkList = React.forwardRef(function LinkListForwardedRef(props: LinkListProps, ref: React.Ref<HTMLUListElement>) {\n const {\n children,\n className = '',\n chevron = false,\n size = 'medium',\n color = 'white',\n testId,\n variant = 'line',\n highlightText,\n editMode = false,\n resources,\n } = props;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemLinkList = {\n ...defaultResources,\n ...resources,\n };\n\n const listClassNames = cn(LinkListStyles['link-list'], className, {\n [LinkListStyles[`link-list--outline--${color}`]]: variant === 'outline',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n return (\n <ul ref={ref} className={listClassNames} data-testid={testId} data-analyticsid={AnalyticsId.LinkList}>\n {React.Children.map(children, (child: React.ReactNode, index) => {\n if (React.isValidElement<LinkProps>(child) && child.type === Link) {\n if (editMode) {\n const childResources = child.props.resources;\n const deleteAriaLabel = childResources?.editMode_deleteButtonAriaLabel ?? mergedResources.editMode_deleteButtonAriaLabel;\n const itemId = `linklist-item-${index}`;\n\n return (\n <ListEditModeItem\n color={color}\n variant={variant}\n onDelete={child.props.onDelete}\n contentId={itemId}\n deleteButtonAriaLabel={deleteAriaLabel}\n >\n {React.cloneElement(child, {\n color,\n size,\n chevron: false,\n variant,\n highlightText: highlightText,\n editMode: true,\n contentId: itemId,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child, {\n color,\n size,\n chevron,\n variant,\n highlightText: highlightText,\n editMode: false,\n });\n }\n }\n return null;\n })}\n </ul>\n );\n}) as CompoundComponent;\n\nLinkList.displayName = 'LinkList';\nLinkList.Link = Link;\nLink.displayName = 'LinkList.Link';\n\nexport default LinkList;\n","import LinkList from './LinkList';\nexport * from './LinkList';\nexport default LinkList;\n"],"mappings":";;;;;;;;;;;;;AEKA,MAAa,gBAAgB,aAAsD;AACjF,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACqFb,MAAaA,OAAiB,MAAM,YAAY,OAAkB,QAAkC;CAClG,MAAM,EACJ,UACA,YAAY,IACZ,QAAQ,SACR,MACA,OACA,OAAO,UACP,UAAU,OACV,SACA,SAAS,QACT,QACA,QACA,SACA,aAAa,KACb,eACA,WAAW,OACX,WAEA,WACA,WAAW,OACX,GAAG,cACD;CACJ,MAAM,EAAE,WAAW,cAAc,iBAAwD,QAAQ;CAEjG,MAAM,SAAS,YAAY;CAC3B,MAAM,iBAAiB,YAAY;CACnC,MAAM,YAAY,YAAY;CAC9B,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAY,GAAG,eAAe,cAAc;GAC/C,eAAe,gCAAgC;GAC/C,eAAe,mCAAmC;GAClD,eAAe,kCAAkC,WAAW;EAC9D,CAAC;CACF,MAAM,cAAc,GAClB,eAAe,sBACf,eAAe,sBAAsB,UACrC;GACG,eAAe,4BAA4B,WAAW;GACtD,eAAe,6BAA6B;GAC5C,eAAe,4BAA4B,WAAW;GACtD,eAAe,gCAAgC;GAC/C,eAAe,+BAA+B,WAAW;GACzD,eAAe,sCAAsC;GACrD,eAAe,qCAAqC,WAAW;GAC/D,eAAe,sBAAsB,UAAU;GAC/C,eAAe,+BAA+B,eAAe;GAC7D,eAAe,4BAA4B,WAAW;EACxD,EACD,UACD;CAED,MAAM,sBAAs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AAa,YAA6B,gBAAgB,UAAU;CAG5E,MAAMC,kBAA0C;EAC9C,GAHuB,aAAa,SAAS;EAI7C,GAAG;EACJ;AAOD,QACE,oBAAC,MAAA;EAAQ;EAAK,WANO,GAAG,eAAe,cAAc,WAAW;IAC/D,eAAe,uBAAuB,WAAW,YAAY;IAC7D,gCAAgC;GAClC,CAAC;EAGyC,eAAa;EAAQ,oBAAkB,YAAY;YACzF,MAAM,SAAS,IAAI,WAAW,OAAwB,UAAU;AAC/D,OAAI,MAAM,eAA0B,MAAM,IAAI,MAAM,SAAS,KAC3D,KAAI,UAAU;IAEZ,MAAM,kBADiB,MAAM,MAAM,WACK,kCAAkC,gBAAgB;IAC1F,MAAM,SAAS,iBAAiB;AAEhC,WACE,oBAAC,sBAAA;KACQ;KACE;KACT,UAAU,MAAM,MAAM;KACtB,WAAW;KACX,uBAAuB;eAEtB,MAAM,aAAa,OAAO;MACzB;MACA;MACA,SAAS;MACT;MACe;MACf,UAAU;MACV,WAAW;MACZ,CAAC;MACe;SAGrB,QAAO,MAAM,aAAa,OAAO;IAC/B;IACA;IACA;IACA;IACe;IACf,UAAU;IACX,CAAC;AAGN,UAAO;IACP;GACC;EAEP;AAEF,SAAS,cAAc;AACvB,SAAS,OAAO;AAChB,KAAK,cAAc;ACjSnB,IAAA,qBDmSe"}
|
|
1
|
+
{"version":3,"file":"LinkList.js","names":["Link: LinkType","mergedResources: HNDesignsystemLinkList"],"sources":["../src/resources/HN.Designsystem.LinkList.en-GB.json","../src/resources/HN.Designsystem.LinkList.nb-NO.json","../src/components/LinkList/resourceHelper.ts","../src/components/LinkList/LinkList.tsx","../src/components/LinkList/index.ts"],"sourcesContent":["{\n \"editMode_deleteButtonAriaLabel\": \"Delete\"\n}\n","{\n \"editMode_deleteButtonAriaLabel\": \"Slett\"\n}\n","import { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.LinkList.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.LinkList.nb-NO.json';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemLinkList => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemLinkList } from '../../resources/Resources';\nimport { PaletteNames } from '../../theme/palette';\nimport { useLanguage } from '../../utils/language';\nimport { ElementHeaderType, renderElementHeader } from '../ElementHeader/ElementHeader';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ListEditModeItem, { ListEditModeItemProps, listEditModeWrapperClassnames } from '../ListEditMode';\nimport { getResources } from './resourceHelper';\nimport ArrowUpRight from '../Icons/ArrowUpRight';\n\nimport LinkListStyles from './styles.module.scss';\n\nexport type LinkListSize = 'small' | 'medium' | 'large';\n\nexport type LinkListStatus = 'none' | 'new';\n\nexport type LinkAnchorTargets = '_self' | '_blank' | '_parent';\n\nexport type LinkListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport type LinkListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\nexport interface LinkType extends React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLLIElement>> {\n ElementHeader?: ElementHeaderType;\n}\n\nexport type LinkTags = 'button' | 'a';\nexport interface CompoundComponent extends React.ForwardRefExoticComponent<LinkListProps & React.RefAttributes<HTMLUListElement>> {\n Link: LinkType;\n}\n\nexport interface LinkListProps {\n /** Items in the LinkList */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: LinkListColors;\n /** Toggles chevron icon on or off. */\n chevron?: boolean;\n /** Changes size of the LinkList. */\n size?: LinkListSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: LinkListVariant;\n /** Highlights text. Used for search results */\n highlightText?: string;\n /**\n * @experimental This prop is experimental and may change in the future.\n * Enables ListEditMode\n */\n editMode?: boolean;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\nexport type LinkProps = Modify<\n React.HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,\n {\n children: React.ReactNode;\n /** @private Turns chevron icon on/off. Overwritten by LinkList so not possible to set on LinkList.Link */\n chevron?: boolean;\n className?: string;\n icon?: React.ReactElement;\n /** Renders the image in the LinkList header */\n image?: React.ReactElement;\n /** Displays a status on the left side: default none */\n status?: LinkListStatus;\n href?: string;\n target?: LinkAnchorTargets;\n /** HTML markup for link. Default: a */\n htmlMarkup?: LinkTags;\n /** Ref for lenke/knapp */\n linkRef?: React.RefObject<HTMLButtonElement | HTMLAnchorElement> | null;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Highlights text. Override if different from list */\n highlightText?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemLinkList>;\n /** @experimental id for content (only used in edit mode for aria-describedby) */\n contentId?: string;\n /** Replaces the chevron with an arrow up right which is used for indicating external links */\n external?: boolean;\n }\n> &\n Pick<LinkListProps, 'color' | 'size' | 'variant'> &\n ListEditModeItemProps;\n\nexport const Link: LinkType = React.forwardRef((props: LinkProps, ref: React.Ref<HTMLLIElement>) => {\n const {\n children,\n className = '',\n color = 'white',\n icon,\n image,\n size = 'medium',\n chevron = false,\n linkRef,\n status = 'none',\n testId,\n target,\n variant,\n htmlMarkup = 'a',\n highlightText,\n editMode = false,\n contentId,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n resources, // used by ListEditModeItem in LinkList\n external = false,\n ...restProps\n } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement | HTMLAnchorElement>(linkRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const liClasses = cn(LinkListStyles['link-list'], {\n [LinkListStyles['link-list__list-item--line']]: isLine,\n [LinkListStyles['link-list__list-item--outline']]: isOutline,\n [LinkListStyles[`link-list__list-item--outline--${color}`]]: isOutline,\n });\n const linkClasses = cn(\n LinkListStyles['link-list__anchor'],\n LinkListStyles[`link-list__anchor--${color}`],\n {\n [LinkListStyles[`link-list__anchor--line--${color}`]]: isLine,\n [LinkListStyles['link-list__anchor--fill']]: isFill,\n [LinkListStyles[`link-list__anchor--fill--${color}`]]: isFill,\n [LinkListStyles['link-list__anchor--outline']]: isOutline,\n [LinkListStyles[`link-list__anchor--outline--${color}`]]: isOutline,\n [LinkListStyles['link-list__anchor--fill-negative']]: isFillNegative,\n [LinkListStyles[`link-list__anchor--fill-negative--${color}`]]: isFillNegative,\n [LinkListStyles[`link-list__anchor--${size}`]]: size,\n [LinkListStyles['link-list__anchor--button']]: htmlMarkup === 'button',\n [LinkListStyles['link-list__anchor--new']]: status === 'new',\n },\n className\n );\n\n const statusMarkerClasses = cn(LinkListStyles['link-list__status-marker'], {\n [LinkListStyles['link-list__status-marker--new']]: status === 'new',\n });\n\n const imageContainer = <span className={LinkListStyles['link-list__image-container']}>{image}</span>;\n\n let chevronIcon = undefined;\n if (external) {\n chevronIcon = ArrowUpRight;\n } else if (chevron) {\n chevronIcon = ChevronRight;\n }\n\n return editMode ? (\n <div id={contentId} className={liClasses} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n <div className={linkClasses}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </div>\n </div>\n ) : (\n <li className={liClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Link}>\n {htmlMarkup === 'a' ? (\n <a\n className={linkClasses}\n ref={refObject as React.RefObject<HTMLAnchorElement>}\n rel={target === '_blank' ? 'noopener noreferrer' : undefined}\n target={target}\n {...restProps}\n >\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </a>\n ) : (\n htmlMarkup === 'button' && (\n <button className={linkClasses} ref={refObject as React.RefObject<HTMLButtonElement>} type=\"button\" {...restProps}>\n <div className={statusMarkerClasses}></div>\n {renderElementHeader(children, {\n titleHtmlMarkup: 'span',\n isHovered,\n size,\n parentType: 'linklist',\n chevronIcon: chevronIcon,\n icon: icon ?? imageContainer,\n highlightText,\n })}\n </button>\n )\n )}\n </li>\n );\n});\n\nexport const LinkList = React.forwardRef(function LinkListForwardedRef(props: LinkListProps, ref: React.Ref<HTMLUListElement>) {\n const {\n children,\n className = '',\n chevron = false,\n size = 'medium',\n color = 'white',\n testId,\n variant = 'line',\n highlightText,\n editMode = false,\n resources,\n } = props;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemLinkList = {\n ...defaultResources,\n ...resources,\n };\n\n const listClassNames = cn(LinkListStyles['link-list'], className, {\n [LinkListStyles[`link-list--outline--${color}`]]: variant === 'outline',\n [listEditModeWrapperClassnames]: editMode,\n });\n\n return (\n <ul ref={ref} className={listClassNames} data-testid={testId} data-analyticsid={AnalyticsId.LinkList}>\n {React.Children.map(children, (child: React.ReactNode, index) => {\n if (React.isValidElement<LinkProps>(child) && child.type === Link) {\n if (editMode) {\n const childResources = child.props.resources;\n const deleteAriaLabel = childResources?.editMode_deleteButtonAriaLabel ?? mergedResources.editMode_deleteButtonAriaLabel;\n const itemId = `linklist-item-${index}`;\n\n return (\n <ListEditModeItem\n color={color}\n variant={variant}\n onDelete={child.props.onDelete}\n contentId={itemId}\n deleteButtonAriaLabel={deleteAriaLabel}\n >\n {React.cloneElement(child, {\n color,\n size,\n chevron: false,\n variant,\n highlightText: highlightText,\n editMode: true,\n contentId: itemId,\n })}\n </ListEditModeItem>\n );\n } else {\n return React.cloneElement(child, {\n color,\n size,\n chevron,\n variant,\n highlightText: highlightText,\n editMode: false,\n });\n }\n }\n return null;\n })}\n </ul>\n );\n}) as CompoundComponent;\n\nLinkList.displayName = 'LinkList';\nLinkList.Link = Link;\nLink.displayName = 'LinkList.Link';\n\nexport default LinkList;\n","import LinkList from './LinkList';\nexport * from './LinkList';\nexport default LinkList;\n"],"mappings":";;;;;;;;;;;;;AEKA,MAAa,gBAAgB,aAAsD;AACjF,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACqFb,MAAaA,OAAiB,MAAM,YAAY,OAAkB,QAAkC;CAClG,MAAM,EACJ,UACA,YAAY,IACZ,QAAQ,SACR,MACA,OACA,OAAO,UACP,UAAU,OACV,SACA,SAAS,QACT,QACA,QACA,SACA,aAAa,KACb,eACA,WAAW,OACX,WAEA,WACA,WAAW,OACX,GAAG,cACD;CACJ,MAAM,EAAE,WAAW,cAAc,iBAAwD,QAAQ;CAEjG,MAAM,SAAS,YAAY;CAC3B,MAAM,iBAAiB,YAAY;CACnC,MAAM,YAAY,YAAY;CAC9B,MAAM,SAAS,YAAY;CAE3B,MAAM,YAAY,WAAG,eAAe,cAAc;GAC/C,eAAe,gCAAgC;GAC/C,eAAe,mCAAmC;GAClD,eAAe,kCAAkC,WAAW;EAC9D,CAAC;CACF,MAAM,cAAc,WAClB,eAAe,sBACf,eAAe,sBAAsB,UACrC;GACG,eAAe,4BAA4B,WAAW;GACtD,eAAe,6BAA6B;GAC5C,eAAe,4BAA4B,WAAW;GACtD,eAAe,gCAAgC;GAC/C,eAAe,+BAA+B,WAAW;GACzD,eAAe,sCAAsC;GACrD,eAAe,qCAAqC,WAAW;GAC/D,eAAe,sBAAsB,UAAU;GAC/C,eAAe,+BAA+B,eAAe;GAC7D,eAAe,4BAA4B,WAAW;EACxD,EACD,UACD;CAED,MAA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,EAAE,aAAa,YAA6B,gBAAgB,UAAU;CAG5E,MAAMC,kBAA0C;EAC9C,GAHuB,aAAa,SAAS;EAI7C,GAAG;EACJ;AAOD,QACE,oBAAC,MAAA;EAAQ;EAAK,WANO,WAAG,eAAe,cAAc,WAAW;IAC/D,eAAe,uBAAuB,WAAW,YAAY;IAC7D,gCAAgC;GAClC,CAAC;EAGyC,eAAa;EAAQ,oBAAkB,YAAY;YACzF,MAAM,SAAS,IAAI,WAAW,OAAwB,UAAU;AAC/D,OAAI,MAAM,eAA0B,MAAM,IAAI,MAAM,SAAS,KAC3D,KAAI,UAAU;IAEZ,MAAM,kBADiB,MAAM,MAAM,WACK,kCAAkC,gBAAgB;IAC1F,MAAM,SAAS,iBAAiB;AAEhC,WACE,oBAAC,sBAAA;KACQ;KACE;KACT,UAAU,MAAM,MAAM;KACtB,WAAW;KACX,uBAAuB;eAEtB,MAAM,aAAa,OAAO;MACzB;MACA;MACA,SAAS;MACT;MACe;MACf,UAAU;MACV,WAAW;MACZ,CAAC;MACe;SAGrB,QAAO,MAAM,aAAa,OAAO;IAC/B;IACA;IACA;IACA;IACe;IACf,UAAU;IACX,CAAC;AAGN,UAAO;IACP;GACC;EAEP;AAEF,SAAS,cAAc;AACvB,SAAS,OAAO;AAChB,KAAK,cAAc;ACjSnB,IAAA,qBDmSe"}
|
package/lib/List.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as AnalyticsId } from "./constants2.js";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import
|
|
3
|
+
import classNames from "classnames";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import styles from "./components/List/styles.module.scss";
|
|
6
6
|
var Item = ({ children }) => /* @__PURE__ */ jsx("li", {
|
|
@@ -9,7 +9,7 @@ var Item = ({ children }) => /* @__PURE__ */ jsx("li", {
|
|
|
9
9
|
});
|
|
10
10
|
var List = ({ children, className, testId, variant = "bullet", margin }) => {
|
|
11
11
|
return /* @__PURE__ */ jsx(["numbered", "alphabetical"].includes(variant) ? "ol" : "ul", {
|
|
12
|
-
className:
|
|
12
|
+
className: classNames(styles.list, styles[`list--${variant}`], margin && styles["list--margin"], className),
|
|
13
13
|
"data-testid": testId,
|
|
14
14
|
"data-analyticsid": AnalyticsId.List,
|
|
15
15
|
children
|
package/lib/List.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","names":["Item: ItemType","List: ListCompound"],"sources":["../src/components/List/List.tsx","../src/components/List/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport type ListVariant = 'bullet' | 'dashed' | 'numbered' | 'alphabetical';\n\nexport interface ItemProps {\n children: React.ReactNode;\n}\n\ntype ItemType = React.FC<ItemProps>;\n\nconst Item: ItemType = ({ children }: ItemProps) => <li className={styles.list__item}>{children}</li>;\n\nexport interface ListProps {\n /** List contents */\n children: React.ReactNode;\n /** Changes the visual representation of the list. */\n variant?: ListVariant;\n /** Adds margin above/below list */\n margin?: boolean;\n /** Adds className to list element */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface ListCompound extends React.FC<ListProps> {\n Item: ItemType;\n}\n\nconst List: ListCompound = ({ children, className, testId, variant = 'bullet', margin }: ListProps) => {\n const CustomTag = ['numbered', 'alphabetical'].includes(variant) ? 'ol' : 'ul';\n\n const listClasses = classNames(styles.list, styles[`list--${variant}`], margin && styles['list--margin'], className);\n\n return (\n <CustomTag className={listClasses} data-testid={testId} data-analyticsid={AnalyticsId.List}>\n {children}\n </CustomTag>\n );\n};\n\nList.Item = Item;\n\nexport default List;\n","import List from './List';\nexport * from './List';\nexport default List;\n"],"mappings":";;;;;AAgBA,IAAMA,QAAkB,EAAE,eAA0B,oBAAC,MAAA;CAAG,WAAW,OAAO;CAAa;EAAc;AAmBrG,IAAMC,QAAsB,EAAE,UAAU,WAAW,QAAQ,UAAU,UAAU,aAAwB;AAKrG,QACE,oBALgB,CAAC,YAAY,eAAe,CAAC,SAAS,QAAQ,GAAG,OAAO,MAKvE;EAAU,WAHO,
|
|
1
|
+
{"version":3,"file":"List.js","names":["Item: ItemType","List: ListCompound"],"sources":["../src/components/List/List.tsx","../src/components/List/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\n\nimport styles from './styles.module.scss';\n\nexport type ListVariant = 'bullet' | 'dashed' | 'numbered' | 'alphabetical';\n\nexport interface ItemProps {\n children: React.ReactNode;\n}\n\ntype ItemType = React.FC<ItemProps>;\n\nconst Item: ItemType = ({ children }: ItemProps) => <li className={styles.list__item}>{children}</li>;\n\nexport interface ListProps {\n /** List contents */\n children: React.ReactNode;\n /** Changes the visual representation of the list. */\n variant?: ListVariant;\n /** Adds margin above/below list */\n margin?: boolean;\n /** Adds className to list element */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface ListCompound extends React.FC<ListProps> {\n Item: ItemType;\n}\n\nconst List: ListCompound = ({ children, className, testId, variant = 'bullet', margin }: ListProps) => {\n const CustomTag = ['numbered', 'alphabetical'].includes(variant) ? 'ol' : 'ul';\n\n const listClasses = classNames(styles.list, styles[`list--${variant}`], margin && styles['list--margin'], className);\n\n return (\n <CustomTag className={listClasses} data-testid={testId} data-analyticsid={AnalyticsId.List}>\n {children}\n </CustomTag>\n );\n};\n\nList.Item = Item;\n\nexport default List;\n","import List from './List';\nexport * from './List';\nexport default List;\n"],"mappings":";;;;;AAgBA,IAAMA,QAAkB,EAAE,eAA0B,oBAAC,MAAA;CAAG,WAAW,OAAO;CAAa;EAAc;AAmBrG,IAAMC,QAAsB,EAAE,UAAU,WAAW,QAAQ,UAAU,UAAU,aAAwB;AAKrG,QACE,oBALgB,CAAC,YAAY,eAAe,CAAC,SAAS,QAAQ,GAAG,OAAO,MAKvE;EAAU,WAHO,WAAW,OAAO,MAAM,OAAO,SAAS,YAAY,UAAU,OAAO,iBAAiB,UAAU;EAG/E,eAAa;EAAQ,oBAAkB,YAAY;EACnF;GACS;;AAIhB,KAAK,OAAO;AC7CZ,IAAA,iBD+Ce"}
|
package/lib/ListEditMode.js
CHANGED
|
@@ -3,17 +3,17 @@ import { t as usePseudoClasses } from "./usePseudoClasses.js";
|
|
|
3
3
|
import { t as Icon_default } from "./Icon.js";
|
|
4
4
|
import { t as X_default } from "./X.js";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import
|
|
6
|
+
import classNames from "classnames";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import styles from "./components/ListEditMode/styles.module.scss";
|
|
9
|
-
const listEditModeWrapperClassnames =
|
|
9
|
+
const listEditModeWrapperClassnames = classNames([styles[`list-edit-mode`]]);
|
|
10
10
|
const IconButton = ({ icon, color, onClick, ariaLabel, ariaDescribedby }) => {
|
|
11
11
|
const { refObject, isHovered } = usePseudoClasses();
|
|
12
12
|
return /* @__PURE__ */ jsx("button", {
|
|
13
13
|
ref: refObject,
|
|
14
14
|
onClick,
|
|
15
15
|
type: "button",
|
|
16
|
-
className:
|
|
16
|
+
className: classNames(styles["list-edit-mode__icon-button"]),
|
|
17
17
|
"aria-label": ariaLabel,
|
|
18
18
|
"aria-describedby": ariaDescribedby,
|
|
19
19
|
children: /* @__PURE__ */ jsx(Icon_default, {
|
|
@@ -27,7 +27,7 @@ const IconButton = ({ icon, color, onClick, ariaLabel, ariaDescribedby }) => {
|
|
|
27
27
|
const ListEditModeItem = (props) => {
|
|
28
28
|
const { children, variant = "line", color = "neutral", onDelete, deleteButtonAriaLabel, contentId } = props;
|
|
29
29
|
return /* @__PURE__ */ jsxs("li", {
|
|
30
|
-
className:
|
|
30
|
+
className: classNames(styles["list-edit-mode__item"], color && styles[`list-edit-mode__item--${color}`], {
|
|
31
31
|
[styles["list-edit-mode__item--line"]]: variant === "line",
|
|
32
32
|
[styles["list-edit-mode__item--fill"]]: variant === "fill" || variant === "fill-negative"
|
|
33
33
|
}),
|
package/lib/ListEditMode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListEditMode.js","names":[],"sources":["../src/components/ListEditMode/ListEditMode.tsx","../src/components/ListEditMode/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { IconSize } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { ExpanderListColors, ExpanderListVariant } from '../ExpanderList';\nimport Icon, { SvgIcon } from '../Icon';\nimport X from '../Icons/X';\nimport { LinkListColors, LinkListVariant } from '../LinkList';\n\nimport styles from './styles.module.scss';\n\nexport interface ListEditModeProps extends ListEditModeItemProps {\n /** Items in the ListEditMode */\n children: React.ReactNode;\n /** Sets visual priority */\n variant?: LinkListVariant | ExpanderListVariant;\n /** Sets color */\n color?: LinkListColors | ExpanderListColors;\n /** Aria label for delete button */\n deleteButtonAriaLabel?: string;\n}\n\nexport interface ListEditModeItemProps {\n /** Enables ListEditMode */\n editMode?: boolean;\n /** Callback for delete button */\n onDelete?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n contentId?: string;\n}\n\nexport const listEditModeWrapperClassnames = classNames([styles[`list-edit-mode`]]);\n\nexport const IconButton = ({\n icon,\n color,\n onClick,\n ariaLabel,\n ariaDescribedby,\n}: {\n icon: SvgIcon;\n color: 'red' | 'blue';\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n ariaLabel?: string;\n ariaDescribedby?: string;\n}): React.JSX.Element => {\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n\n return (\n <button\n ref={refObject}\n onClick={onClick}\n type=\"button\"\n className={classNames(styles['list-edit-mode__icon-button'])}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n >\n <Icon\n isHovered={isHovered}\n svgIcon={icon}\n size={IconSize.Small}\n color={color === 'blue' ? 'var(--color-action-graphics-onlight)' : 'var(--color-destructive-graphics-normal'}\n />\n </button>\n );\n};\n\nexport const ListEditModeItem = (props: ListEditModeProps): React.JSX.Element => {\n const { children, variant = 'line', color = 'neutral', onDelete, deleteButtonAriaLabel, contentId } = props;\n\n const listClassNames = classNames(styles['list-edit-mode__item'], color && styles[`list-edit-mode__item--${color}`], {\n [styles['list-edit-mode__item--line']]: variant === 'line',\n [styles['list-edit-mode__item--fill']]: variant === 'fill' || variant === 'fill-negative',\n });\n\n return (\n <li className={listClassNames}>\n {children}\n {onDelete && <IconButton icon={X} onClick={onDelete} color=\"red\" ariaLabel={deleteButtonAriaLabel} ariaDescribedby={contentId} />}\n </li>\n );\n};\n\nListEditModeItem.displayName = 'ListEditModeItem';\n\nexport default ListEditModeItem;\n","import ListEditModeItem from './ListEditMode';\nexport * from './ListEditMode';\nexport default ListEditModeItem;\n"],"mappings":";;;;;;;;AAgCA,MAAa,gCAAgC,
|
|
1
|
+
{"version":3,"file":"ListEditMode.js","names":[],"sources":["../src/components/ListEditMode/ListEditMode.tsx","../src/components/ListEditMode/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { IconSize } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { ExpanderListColors, ExpanderListVariant } from '../ExpanderList';\nimport Icon, { SvgIcon } from '../Icon';\nimport X from '../Icons/X';\nimport { LinkListColors, LinkListVariant } from '../LinkList';\n\nimport styles from './styles.module.scss';\n\nexport interface ListEditModeProps extends ListEditModeItemProps {\n /** Items in the ListEditMode */\n children: React.ReactNode;\n /** Sets visual priority */\n variant?: LinkListVariant | ExpanderListVariant;\n /** Sets color */\n color?: LinkListColors | ExpanderListColors;\n /** Aria label for delete button */\n deleteButtonAriaLabel?: string;\n}\n\nexport interface ListEditModeItemProps {\n /** Enables ListEditMode */\n editMode?: boolean;\n /** Callback for delete button */\n onDelete?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n contentId?: string;\n}\n\nexport const listEditModeWrapperClassnames = classNames([styles[`list-edit-mode`]]);\n\nexport const IconButton = ({\n icon,\n color,\n onClick,\n ariaLabel,\n ariaDescribedby,\n}: {\n icon: SvgIcon;\n color: 'red' | 'blue';\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n ariaLabel?: string;\n ariaDescribedby?: string;\n}): React.JSX.Element => {\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n\n return (\n <button\n ref={refObject}\n onClick={onClick}\n type=\"button\"\n className={classNames(styles['list-edit-mode__icon-button'])}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedby}\n >\n <Icon\n isHovered={isHovered}\n svgIcon={icon}\n size={IconSize.Small}\n color={color === 'blue' ? 'var(--color-action-graphics-onlight)' : 'var(--color-destructive-graphics-normal'}\n />\n </button>\n );\n};\n\nexport const ListEditModeItem = (props: ListEditModeProps): React.JSX.Element => {\n const { children, variant = 'line', color = 'neutral', onDelete, deleteButtonAriaLabel, contentId } = props;\n\n const listClassNames = classNames(styles['list-edit-mode__item'], color && styles[`list-edit-mode__item--${color}`], {\n [styles['list-edit-mode__item--line']]: variant === 'line',\n [styles['list-edit-mode__item--fill']]: variant === 'fill' || variant === 'fill-negative',\n });\n\n return (\n <li className={listClassNames}>\n {children}\n {onDelete && <IconButton icon={X} onClick={onDelete} color=\"red\" ariaLabel={deleteButtonAriaLabel} ariaDescribedby={contentId} />}\n </li>\n );\n};\n\nListEditModeItem.displayName = 'ListEditModeItem';\n\nexport default ListEditModeItem;\n","import ListEditModeItem from './ListEditMode';\nexport * from './ListEditMode';\nexport default ListEditModeItem;\n"],"mappings":";;;;;;;;AAgCA,MAAa,gCAAgC,WAAW,CAAC,OAAO,kBAAkB,CAAC;AAEnF,MAAa,cAAc,EACzB,MACA,OACA,SACA,WACA,sBAOuB;CACvB,MAAM,EAAE,WAAW,cAAc,kBAAqC;AAEtE,QACE,oBAAC,UAAA;EACC,KAAK;EACI;EACT,MAAK;EACL,WAAW,WAAW,OAAO,+BAA+B;EAC5D,cAAY;EACZ,oBAAkB;YAElB,oBAAC,cAAA;GACY;GACX,SAAS;GACT,MAAM,SAAS;GACf,OAAO,UAAU,SAAS,yCAAyC;IACnE;GACK;;AAIb,MAAa,oBAAoB,UAAgD;CAC/E,MAAM,EAAE,UAAU,UAAU,QAAQ,QAAQ,WAAW,UAAU,uBAAuB,cAAc;AAOtG,QACE,qBAAC,MAAA;EAAG,WANiB,WAAW,OAAO,yBAAyB,SAAS,OAAO,yBAAyB,UAAU;IAClH,OAAO,gCAAgC,YAAY;IACnD,OAAO,gCAAgC,YAAY,UAAU,YAAY;GAC3E,CAAC;aAIG,UACA,YAAY,oBAAC,YAAA;GAAW,MAAM;GAAG,SAAS;GAAU,OAAM;GAAM,WAAW;GAAuB,iBAAiB;IAAa,CAAA;GAC9H;;AAIT,iBAAiB,cAAc;AClF/B,IAAA,yBDoFe"}
|
package/lib/MaxCharacters.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as FormOnColor } from "./constants2.js";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import
|
|
3
|
+
import classNames from "classnames";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import styles from "./components/MaxCharacters/styles.module.scss";
|
|
6
6
|
var MaxCharacters = ({ maxCharacters, maxText, length, onColor, maxWidth }) => {
|
|
7
7
|
const progress = length / maxCharacters;
|
|
8
|
-
const counterTextClass =
|
|
8
|
+
const counterTextClass = classNames(styles["max-characters"], {
|
|
9
9
|
[styles[`max-characters--on-dark`]]: onColor === FormOnColor.ondark,
|
|
10
10
|
[styles[`max-characters--invalid`]]: progress > 1
|
|
11
11
|
});
|
package/lib/MaxCharacters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaxCharacters.js","names":["MaxCharacters: React.FC<MaxCharactersProps>"],"sources":["../src/components/MaxCharacters/MaxCharacters.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { FormOnColor } from '../../constants';\n\nimport styles from './styles.module.scss';\n\ninterface MaxCharactersProps {\n /** Current input length */\n length: number;\n /** max character limit in textarea */\n maxCharacters: number;\n /** The text is displayed in the end of the text-counter */\n maxText: string;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Max width of the component */\n maxWidth?: string;\n}\n\nconst MaxCharacters: React.FC<MaxCharactersProps> = ({ maxCharacters, maxText, length, onColor, maxWidth }) => {\n const progress = length / maxCharacters;\n\n const counterTextClass = classNames(styles['max-characters'], {\n [styles[`max-characters--on-dark`]]: onColor === FormOnColor.ondark,\n [styles[`max-characters--invalid`]]: progress > 1,\n });\n\n const ariaLevel = progress > 0.95 ? 'polite' : 'off';\n\n return (\n <div aria-live={ariaLevel} aria-atomic={'true'} className={counterTextClass} style={{ maxWidth }}>\n {`${length}/${maxCharacters} ${maxText}`}\n </div>\n );\n};\n\nexport default MaxCharacters;\n"],"mappings":";;;;;AAqBA,IAAMA,iBAA+C,EAAE,eAAe,SAAS,QAAQ,SAAS,eAAe;CAC7G,MAAM,WAAW,SAAS;CAE1B,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"MaxCharacters.js","names":["MaxCharacters: React.FC<MaxCharactersProps>"],"sources":["../src/components/MaxCharacters/MaxCharacters.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { FormOnColor } from '../../constants';\n\nimport styles from './styles.module.scss';\n\ninterface MaxCharactersProps {\n /** Current input length */\n length: number;\n /** max character limit in textarea */\n maxCharacters: number;\n /** The text is displayed in the end of the text-counter */\n maxText: string;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Max width of the component */\n maxWidth?: string;\n}\n\nconst MaxCharacters: React.FC<MaxCharactersProps> = ({ maxCharacters, maxText, length, onColor, maxWidth }) => {\n const progress = length / maxCharacters;\n\n const counterTextClass = classNames(styles['max-characters'], {\n [styles[`max-characters--on-dark`]]: onColor === FormOnColor.ondark,\n [styles[`max-characters--invalid`]]: progress > 1,\n });\n\n const ariaLevel = progress > 0.95 ? 'polite' : 'off';\n\n return (\n <div aria-live={ariaLevel} aria-atomic={'true'} className={counterTextClass} style={{ maxWidth }}>\n {`${length}/${maxCharacters} ${maxText}`}\n </div>\n );\n};\n\nexport default MaxCharacters;\n"],"mappings":";;;;;AAqBA,IAAMA,iBAA+C,EAAE,eAAe,SAAS,QAAQ,SAAS,eAAe;CAC7G,MAAM,WAAW,SAAS;CAE1B,MAAM,mBAAmB,WAAW,OAAO,mBAAmB;GAC3D,OAAO,6BAA6B,YAAY,YAAY;GAC5D,OAAO,6BAA6B,WAAW;EACjD,CAAC;CAEF,MAAM,YAAY,WAAW,MAAO,WAAW;AAE/C,QACE,oBAAC,OAAA;EAAI,aAAW;EAAW,eAAa;EAAQ,WAAW;EAAkB,OAAO,EAAE,UAAU;YAC7F,GAAG,OAAO,GAAG,cAAc,GAAG;GAC3B;;AAIV,IAAA,wBAAe"}
|
package/lib/Panel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as IconSize, s as LanguageLocales } from "./constants2.js";
|
|
1
|
+
import { a as IconSize, n as AnalyticsId, s as LanguageLocales } from "./constants2.js";
|
|
2
2
|
import { t as Icon_default } from "./Icon.js";
|
|
3
3
|
import { r as useLanguage } from "./language.js";
|
|
4
4
|
import { t as Button_default } from "./Button.js";
|
|
@@ -9,9 +9,10 @@ import { t as useExpand } from "./useExpand.js";
|
|
|
9
9
|
import { t as ChevronRight_default } from "./ChevronRight.js";
|
|
10
10
|
import { t as PanelTitle_default } from "./PanelTitle.js";
|
|
11
11
|
import React from "react";
|
|
12
|
-
import
|
|
12
|
+
import classNames from "classnames";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
import styles from "./components/
|
|
14
|
+
import styles from "./components/PanelList/styles.module.scss";
|
|
15
|
+
import styles$1 from "./components/Panel/styles.module.scss";
|
|
15
16
|
var HN_Designsystem_Panel_en_GB_default = {
|
|
16
17
|
expandButtonOpen: "See details",
|
|
17
18
|
expandButtonClose: "Hide details"
|
|
@@ -27,6 +28,25 @@ const getResources = (language) => {
|
|
|
27
28
|
default: return HN_Designsystem_Panel_nb_NO_default;
|
|
28
29
|
}
|
|
29
30
|
};
|
|
31
|
+
const PanelListContext = React.createContext(null);
|
|
32
|
+
var PanelList_default = React.forwardRef(function BadgeForwardedRef(props, ref) {
|
|
33
|
+
const { testId, children, variant = PanelVariant.fill, highlightText } = props;
|
|
34
|
+
const contextValue = React.useMemo(() => ({
|
|
35
|
+
variant,
|
|
36
|
+
highlightText,
|
|
37
|
+
applyPanelClassName: (existingClassName) => classNames(existingClassName, styles[`panel-list__panel--${variant}`])
|
|
38
|
+
}), [variant, highlightText]);
|
|
39
|
+
return /* @__PURE__ */ jsx(PanelListContext.Provider, {
|
|
40
|
+
value: contextValue,
|
|
41
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
42
|
+
ref,
|
|
43
|
+
"data-testid": testId,
|
|
44
|
+
"data-analyticsid": AnalyticsId.PanelList,
|
|
45
|
+
className: classNames({ [styles["panel-list--outline"]]: variant === PanelVariant.outline }),
|
|
46
|
+
children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
});
|
|
30
50
|
let PanelLayout = /* @__PURE__ */ function(PanelLayout$1) {
|
|
31
51
|
PanelLayout$1["vertical"] = "vertical";
|
|
32
52
|
PanelLayout$1["horizontal"] = "horizontal";
|
|
@@ -53,10 +73,10 @@ let PanelStatus = /* @__PURE__ */ function(PanelStatus$1) {
|
|
|
53
73
|
return PanelStatus$1;
|
|
54
74
|
}({});
|
|
55
75
|
var ExpandButton = ({ onClick, isExpanded, resources }) => {
|
|
56
|
-
const buttonClassName =
|
|
76
|
+
const buttonClassName = classNames(styles$1["expander__button"], isExpanded && styles$1["expander__button--expanded"]);
|
|
57
77
|
return /* @__PURE__ */ jsxs(Button_default, {
|
|
58
78
|
variant: "borderless",
|
|
59
|
-
textClassName: styles["expander__button__text"],
|
|
79
|
+
textClassName: styles$1["expander__button__text"],
|
|
60
80
|
wrapperClassName: buttonClassName,
|
|
61
81
|
"aria-expanded": isExpanded,
|
|
62
82
|
onClick,
|
|
@@ -67,6 +87,7 @@ var ExpandButton = ({ onClick, isExpanded, resources }) => {
|
|
|
67
87
|
});
|
|
68
88
|
};
|
|
69
89
|
var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayout.vertical, variant = PanelVariant.fill, color = "neutral", stacking = PanelStacking.default, testId, children, expanded = false, focusable, status = PanelStatus.none, buttonBottomAriaLabel, buttonBottomOnClick, buttonBottomText, className, resources, onExpand, highlightText }, ref) {
|
|
90
|
+
const panelListContext = React.useContext(PanelListContext);
|
|
70
91
|
const [preContainer, setPreContainer] = React.useState([]);
|
|
71
92
|
const [title, setTitle] = React.useState([]);
|
|
72
93
|
const [content, setContent] = React.useState([]);
|
|
@@ -77,6 +98,9 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
77
98
|
const panelRef = ref ?? localRef;
|
|
78
99
|
const expandedContentRef = React.useRef(null);
|
|
79
100
|
const defaultScroll = 100;
|
|
101
|
+
const effectiveVariant = panelListContext?.variant ?? variant;
|
|
102
|
+
const effectiveHighlightText = panelListContext?.highlightText ?? highlightText;
|
|
103
|
+
const effectiveClassName = panelListContext?.applyPanelClassName(className) ?? className;
|
|
80
104
|
const { language } = useLanguage(LanguageLocales.NORWEGIAN);
|
|
81
105
|
const mergedResources = {
|
|
82
106
|
...getResources(language),
|
|
@@ -96,7 +120,7 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
96
120
|
else if (child.type === PanelTitle_default) {
|
|
97
121
|
newTitle.push(React.cloneElement(child, {
|
|
98
122
|
key,
|
|
99
|
-
highlightText: child.props.highlightText ||
|
|
123
|
+
highlightText: child.props.highlightText || effectiveHighlightText
|
|
100
124
|
}));
|
|
101
125
|
if (child.props.icon) localHasIcon = true;
|
|
102
126
|
} else if (child.type === A || child.type === B || child.type === C) newContent.push(React.cloneElement(child, { key }));
|
|
@@ -126,26 +150,26 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
126
150
|
}
|
|
127
151
|
}
|
|
128
152
|
}, [isExpanded]);
|
|
129
|
-
const colorScheme =
|
|
130
|
-
const outerClassnames =
|
|
131
|
-
[styles["panel__border--outline--outer"]]:
|
|
132
|
-
[styles["panel__border--line"]]:
|
|
133
|
-
[styles["panel__border--fill--neutral"]]:
|
|
134
|
-
[styles["panel__border--fill--new"]]:
|
|
135
|
-
[styles["panel__border--fill--status"]]:
|
|
153
|
+
const colorScheme = effectiveVariant === PanelVariant.fill ? color : "white";
|
|
154
|
+
const outerClassnames = classNames(effectiveClassName, {
|
|
155
|
+
[styles$1["panel__border--outline--outer"]]: effectiveVariant === PanelVariant.outline,
|
|
156
|
+
[styles$1["panel__border--line"]]: effectiveVariant === PanelVariant.line,
|
|
157
|
+
[styles$1["panel__border--fill--neutral"]]: effectiveVariant === PanelVariant.fill && colorScheme === "neutral",
|
|
158
|
+
[styles$1["panel__border--fill--new"]]: effectiveVariant === PanelVariant.fill && status === PanelStatus.new,
|
|
159
|
+
[styles$1["panel__border--fill--status"]]: effectiveVariant === PanelVariant.fill && status !== PanelStatus.none
|
|
136
160
|
});
|
|
137
|
-
const panelClassnames =
|
|
138
|
-
[styles["panel--line"]]:
|
|
139
|
-
[styles["panel--new"]]: status === PanelStatus.new,
|
|
140
|
-
[styles["panel--draft"]]: status === PanelStatus.draft,
|
|
141
|
-
[styles["panel--error"]]: status === PanelStatus.error,
|
|
142
|
-
[styles["panel--icon"]]: hasIcon
|
|
161
|
+
const panelClassnames = classNames(styles$1["panel"], styles$1[`panel--${colorScheme}`], styles$1["panel--status"], {
|
|
162
|
+
[styles$1["panel--line"]]: effectiveVariant === PanelVariant.line,
|
|
163
|
+
[styles$1["panel--new"]]: status === PanelStatus.new,
|
|
164
|
+
[styles$1["panel--draft"]]: status === PanelStatus.draft,
|
|
165
|
+
[styles$1["panel--error"]]: status === PanelStatus.error,
|
|
166
|
+
[styles$1["panel--icon"]]: hasIcon
|
|
143
167
|
});
|
|
144
|
-
const contentContainerLayout =
|
|
145
|
-
const expanderBorderLayout =
|
|
146
|
-
[styles["panel__expander__border--expanded"]]: isExpanded && status === PanelStatus.none,
|
|
147
|
-
[styles[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,
|
|
148
|
-
[styles[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === PanelStatus.none &&
|
|
168
|
+
const contentContainerLayout = classNames(styles$1["panel__content"], styles$1[`panel__content--${layout}`], { [styles$1[`panel__content--b-first`]]: stacking === PanelStacking.bFirst });
|
|
169
|
+
const expanderBorderLayout = classNames({
|
|
170
|
+
[styles$1["panel__expander__border--expanded"]]: isExpanded && status === PanelStatus.none,
|
|
171
|
+
[styles$1[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,
|
|
172
|
+
[styles$1[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === PanelStatus.none && effectiveVariant === PanelVariant.line
|
|
149
173
|
});
|
|
150
174
|
const handleExpandClick = () => {
|
|
151
175
|
setIsExpanded(!isExpanded);
|
|
@@ -153,7 +177,7 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
153
177
|
return expandableContent.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
154
178
|
className: outerClassnames,
|
|
155
179
|
children: /* @__PURE__ */ jsx("div", {
|
|
156
|
-
className:
|
|
180
|
+
className: classNames({ [styles$1["panel__border--outline--inner"]]: effectiveVariant === PanelVariant.outline }),
|
|
157
181
|
children: /* @__PURE__ */ jsx("div", {
|
|
158
182
|
className: expanderBorderLayout,
|
|
159
183
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -163,13 +187,13 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
163
187
|
tabIndex: focusable ? -1 : void 0,
|
|
164
188
|
children: [
|
|
165
189
|
/* @__PURE__ */ jsxs(Highlighter_default, {
|
|
166
|
-
searchText:
|
|
190
|
+
searchText: effectiveHighlightText,
|
|
167
191
|
children: [preContainer, title]
|
|
168
192
|
}),
|
|
169
193
|
/* @__PURE__ */ jsx("div", {
|
|
170
194
|
className: contentContainerLayout,
|
|
171
195
|
children: /* @__PURE__ */ jsx(Highlighter_default, {
|
|
172
|
-
searchText:
|
|
196
|
+
searchText: effectiveHighlightText,
|
|
173
197
|
children: content
|
|
174
198
|
})
|
|
175
199
|
}),
|
|
@@ -181,8 +205,8 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
181
205
|
isExpanded && /* @__PURE__ */ jsxs("div", {
|
|
182
206
|
ref: expandedContentRef,
|
|
183
207
|
"data-testid": testId + "-details",
|
|
184
|
-
children: [/* @__PURE__ */ jsx("div", { className: styles["panel__expander__separator"] }), /* @__PURE__ */ jsx(Highlighter_default, {
|
|
185
|
-
searchText:
|
|
208
|
+
children: [/* @__PURE__ */ jsx("div", { className: styles$1["panel__expander__separator"] }), /* @__PURE__ */ jsx(Highlighter_default, {
|
|
209
|
+
searchText: effectiveHighlightText,
|
|
186
210
|
children: expandableContent
|
|
187
211
|
})]
|
|
188
212
|
})
|
|
@@ -193,7 +217,7 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
193
217
|
}) : /* @__PURE__ */ jsx("div", {
|
|
194
218
|
className: outerClassnames,
|
|
195
219
|
children: /* @__PURE__ */ jsx("div", {
|
|
196
|
-
className:
|
|
220
|
+
className: classNames({ [styles$1["panel__border--outline--inner"]]: effectiveVariant === PanelVariant.outline }),
|
|
197
221
|
children: /* @__PURE__ */ jsxs("div", {
|
|
198
222
|
className: panelClassnames,
|
|
199
223
|
"data-testid": testId,
|
|
@@ -201,18 +225,18 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
201
225
|
tabIndex: focusable ? -1 : void 0,
|
|
202
226
|
children: [
|
|
203
227
|
/* @__PURE__ */ jsxs(Highlighter_default, {
|
|
204
|
-
searchText:
|
|
228
|
+
searchText: effectiveHighlightText,
|
|
205
229
|
children: [preContainer, title]
|
|
206
230
|
}),
|
|
207
231
|
/* @__PURE__ */ jsx("div", {
|
|
208
232
|
className: contentContainerLayout,
|
|
209
233
|
children: /* @__PURE__ */ jsx(Highlighter_default, {
|
|
210
|
-
searchText:
|
|
234
|
+
searchText: effectiveHighlightText,
|
|
211
235
|
children: content
|
|
212
236
|
})
|
|
213
237
|
}),
|
|
214
238
|
buttonBottomText && buttonBottomOnClick && /* @__PURE__ */ jsx("div", {
|
|
215
|
-
className: styles["panel__button-bottom"],
|
|
239
|
+
className: styles$1["panel__button-bottom"],
|
|
216
240
|
children: /* @__PURE__ */ jsxs(Button_default, {
|
|
217
241
|
variant: "borderless",
|
|
218
242
|
type: "button",
|
|
@@ -232,31 +256,31 @@ var PanelRoot = React.forwardRef(function PanelForwardedRef({ layout = PanelLayo
|
|
|
232
256
|
});
|
|
233
257
|
const PreContainer = ({ children }) => {
|
|
234
258
|
return /* @__PURE__ */ jsx("div", {
|
|
235
|
-
className: styles["panel__pre-container"],
|
|
259
|
+
className: styles$1["panel__pre-container"],
|
|
236
260
|
children
|
|
237
261
|
});
|
|
238
262
|
};
|
|
239
263
|
const A = ({ children }) => {
|
|
240
264
|
return /* @__PURE__ */ jsx("div", {
|
|
241
|
-
className:
|
|
265
|
+
className: classNames(styles$1["panel__content__item"], styles$1["panel__content__item--a"]),
|
|
242
266
|
children
|
|
243
267
|
});
|
|
244
268
|
};
|
|
245
269
|
const B = ({ children }) => {
|
|
246
270
|
return /* @__PURE__ */ jsx("div", {
|
|
247
|
-
className:
|
|
271
|
+
className: classNames(styles$1["panel__content__item"], styles$1["panel__content__item--b"]),
|
|
248
272
|
children
|
|
249
273
|
});
|
|
250
274
|
};
|
|
251
275
|
const C = ({ children }) => {
|
|
252
276
|
return /* @__PURE__ */ jsx("div", {
|
|
253
|
-
className:
|
|
277
|
+
className: classNames(styles$1["panel__content__item"], styles$1["panel__content__item--c"]),
|
|
254
278
|
children
|
|
255
279
|
});
|
|
256
280
|
};
|
|
257
281
|
const ExpandedContent = ({ children }) => {
|
|
258
282
|
return /* @__PURE__ */ jsx("div", {
|
|
259
|
-
className:
|
|
283
|
+
className: classNames(styles$1["panel__expander__content"]),
|
|
260
284
|
children
|
|
261
285
|
});
|
|
262
286
|
};
|
|
@@ -269,6 +293,6 @@ Panel.B = B;
|
|
|
269
293
|
Panel.C = C;
|
|
270
294
|
Panel.ExpandedContent = ExpandedContent;
|
|
271
295
|
var Panel_default = Panel;
|
|
272
|
-
export { PanelLayout as a, PanelVariant as c, ExpandedContent as i, Panel_default as l, B as n, PanelStacking as o, C as r, PanelStatus as s, A as t, PreContainer as u };
|
|
296
|
+
export { PanelLayout as a, PanelVariant as c, PanelListContext as d, PanelList_default as f, ExpandedContent as i, Panel_default as l, B as n, PanelStacking as o, C as r, PanelStatus as s, A as t, PreContainer as u };
|
|
273
297
|
|
|
274
298
|
//# sourceMappingURL=Panel.js.map
|