@helsenorge/designsystem-react 15.3.0 → 15.5.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 +4 -4
- package/lib/AnchorLink.js.map +1 -1
- package/lib/AsChildSlot.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 +29 -0
- package/lib/Checkbox.js +6 -6
- package/lib/Checkbox.js.map +1 -1
- package/lib/Checkbox2.js +2 -2
- package/lib/Checkbox2.js.map +1 -1
- package/lib/CheckboxMarker.js +2 -2
- package/lib/CheckboxMarker.js.map +1 -1
- package/lib/Chip.js +4 -4
- package/lib/Chip.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 +57 -40
- package/lib/Drawer.js.map +1 -1
- package/lib/DrawerNavigation.js +106 -8
- package/lib/DrawerNavigation.js.map +1 -1
- package/lib/Duolist.js +5 -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 +8 -8
- package/lib/Expander.js.map +1 -1
- package/lib/FilterButton.js +2 -2
- package/lib/FilterButton.js.map +1 -1
- package/lib/FilterButtonAndChipsWrapper.js +2 -2
- package/lib/FilterButtonAndChipsWrapper.js.map +1 -1
- package/lib/FilterLinkList.js +4 -4
- package/lib/FilterLinkList.js.map +1 -1
- package/lib/FilterOverviewSearch.js +2 -2
- package/lib/FilterOverviewSearch.js.map +1 -1
- package/lib/FilterSearch.js +31 -18
- package/lib/FilterSearch.js.map +1 -1
- package/lib/FormFieldTag.js +2 -2
- package/lib/FormFieldTag.js.map +1 -1
- package/lib/FormGroup.js +5 -5
- package/lib/FormGroup.js.map +1 -1
- package/lib/FormLayout.js +3 -3
- package/lib/FormLayout.js.map +1 -1
- package/lib/HelpDetails.js +5 -4
- 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 +4 -4
- package/lib/HighlightPanel.js.map +1 -1
- package/lib/Highlighter.js +1 -1
- package/lib/Highlighter.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 +12 -11
- package/lib/InfoTeaser.js.map +1 -1
- package/lib/Input.js +12 -6
- package/lib/Input.js.map +1 -1
- package/lib/LazyIcon.js +3 -0
- package/lib/LazyIcon.js.map +1 -1
- package/lib/LinkList.js +6 -6
- 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/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/Radio.js +2 -2
- package/lib/Radio.js.map +1 -1
- package/lib/RadioButton.js +5 -5
- package/lib/RadioButton.js.map +1 -1
- package/lib/RadioMarker.js +2 -2
- package/lib/RadioMarker.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 +10 -6
- 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/TableBody.js +3 -3
- package/lib/TableBody.js.map +1 -1
- package/lib/TableCell.js +3 -3
- package/lib/TableCell.js.map +1 -1
- package/lib/TableExpandedRow.js +5 -5
- package/lib/TableExpandedRow.js.map +1 -1
- package/lib/TableExpanderCell.js +3 -3
- package/lib/TableExpanderCell.js.map +1 -1
- package/lib/TableHead.js +7 -7
- package/lib/TableHead.js.map +1 -1
- package/lib/TableHeadCell.js +6 -6
- package/lib/TableHeadCell.js.map +1 -1
- package/lib/TableRow.js +6 -6
- package/lib/TableRow.js.map +1 -1
- package/lib/Textarea.js +6 -6
- 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/VisualCheckbox.js +3 -3
- package/lib/VisualCheckbox.js.map +1 -1
- package/lib/VisualRadio.js +3 -3
- package/lib/VisualRadio.js.map +1 -1
- package/lib/__mocks__/matchMedia.js.map +1 -1
- package/lib/__mocks__/usePseudoClasses.js.map +1 -1
- package/lib/__mocks__/useSize.js.map +1 -1
- package/lib/__mocks__/uuid.js +1 -1
- package/lib/__mocks__/uuid.js.map +1 -1
- package/lib/components/ArticleTeaser/index.js +4 -4
- package/lib/components/ArticleTeaser/index.js.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts +3 -1
- package/lib/components/Drawer/DrawerHeaderContent.d.ts +22 -0
- package/lib/components/Drawer/DrawerHeaderContent.module.scss +51 -0
- package/lib/components/Drawer/DrawerHeaderContent.module.scss.d.ts +12 -0
- package/lib/components/Drawer/styles.module.scss +0 -14
- package/lib/components/Drawer/styles.module.scss.d.ts +0 -2
- package/lib/components/Dropdown/index.js +5 -5
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/DropdownOld/index.js +3 -3
- package/lib/components/DropdownOld/index.js.map +1 -1
- package/lib/components/EmptyState/index.js +2 -2
- package/lib/components/EmptyState/index.js.map +1 -1
- package/lib/components/ExpanderHierarchy/index.js +7 -7
- package/lib/components/ExpanderHierarchy/index.js.map +1 -1
- package/lib/components/ExpanderList/index.js +6 -6
- package/lib/components/ExpanderList/index.js.map +1 -1
- package/lib/components/FavoriteButton/index.js +2 -2
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/Filter/DrawerNavigation/styles.module.scss +15 -0
- package/lib/components/Filter/DrawerNavigation/styles.module.scss.d.ts +11 -0
- package/lib/components/Filter/FilterSearch/FilterSearch.d.ts +2 -0
- package/lib/components/Filter/FilterSearch/styles.module.scss +32 -7
- package/lib/components/Filter/FilterSearch/styles.module.scss.d.ts +2 -0
- package/lib/components/Filter/index.js.map +1 -1
- package/lib/components/HelpBubble/index.js +3 -3
- package/lib/components/HelpBubble/index.js.map +1 -1
- package/lib/components/HelpPanel/index.js +2 -2
- package/lib/components/HelpPanel/index.js.map +1 -1
- package/lib/components/HelpTriggerInline/index.js +2 -2
- package/lib/components/HelpTriggerInline/index.js.map +1 -1
- package/lib/components/Highlighter/styles.module.scss +1 -1
- package/lib/components/Icons/AdditionalIconInformation.d.ts +12 -0
- package/lib/components/Icons/AdditionalIconInformation.js +13 -1
- package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/lib/components/Icons/ArrowUpRight.js +4 -4
- package/lib/components/Icons/ArrowUpRight.js.map +1 -1
- package/lib/components/Icons/ArrowUpRightLight.d.ts +3 -0
- package/lib/components/Icons/ArrowUpRightLight.js +17 -0
- package/lib/components/Icons/ArrowUpRightLight.js.map +1 -0
- package/lib/components/Icons/IconNames.d.ts +1 -1
- package/lib/components/Icons/IconNames.js +3 -0
- package/lib/components/Icons/IconNames.js.map +1 -1
- package/lib/components/Icons/ThumbsDown.d.ts +4 -0
- package/lib/components/Icons/ThumbsDown.js +15 -0
- package/lib/components/Icons/ThumbsDown.js.map +1 -0
- package/lib/components/Icons/ThumbsUp.d.ts +4 -0
- package/lib/components/Icons/ThumbsUp.js +15 -0
- package/lib/components/Icons/ThumbsUp.js.map +1 -0
- package/lib/components/Illustrations/BabyMobileMedium.js.map +1 -1
- package/lib/components/Illustrations/ChildMedium.js.map +1 -1
- package/lib/components/Illustrations/DoctorMedium.js.map +1 -1
- package/lib/components/Illustrations/DoctorSmall.js.map +1 -1
- package/lib/components/Illustrations/EyeContactMedium.js.map +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFoodMedium.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnelMedium.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnelSmall.js.map +1 -1
- package/lib/components/Illustrations/ReadLettersMedium.js.map +1 -1
- package/lib/components/Illustrations/SkinToSkinMedium.js.map +1 -1
- package/lib/components/Illustrations/StorkMedium.js.map +1 -1
- package/lib/components/Illustrations/StrollerMedium.js.map +1 -1
- package/lib/components/Illustrations/Support2Medium.js.map +1 -1
- package/lib/components/Illustrations/ThinkingMedium.js.map +1 -1
- package/lib/components/InfoTeaser/InfoTeaser.d.ts +4 -0
- package/lib/components/Loader/index.js +5 -5
- package/lib/components/Loader/index.js.map +1 -1
- package/lib/components/Modal/index.js +10 -10
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/NotificationPanel/index.js +6 -6
- package/lib/components/NotificationPanel/index.js.map +1 -1
- package/lib/components/Panel/index.js +12 -12
- package/lib/components/Panel/index.js.map +1 -1
- package/lib/components/PanelList/index.js +3 -3
- package/lib/components/PanelList/index.js.map +1 -1
- package/lib/components/PopMenu/index.js +3 -3
- package/lib/components/PopMenu/index.js.map +1 -1
- package/lib/components/Portal/index.js.map +1 -1
- package/lib/components/Progressbar/index.js +2 -2
- package/lib/components/Progressbar/index.js.map +1 -1
- package/lib/components/PromoPanel/PromoPanel.d.ts +2 -2
- package/lib/components/PromoPanel/index.js +13 -9
- package/lib/components/PromoPanel/index.js.map +1 -1
- package/lib/components/RadioButton/RadioMarker/styles.module.scss +3 -9
- package/lib/components/ServiceMessage/index.js +5 -5
- 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/Step/index.js +2 -2
- package/lib/components/Step/index.js.map +1 -1
- package/lib/components/Stepper/index.js +2 -2
- package/lib/components/Stepper/index.js.map +1 -1
- package/lib/components/StickyNote/index.js +8 -8
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/components/Table/index.js +3 -3
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/Tabs/index.js +4 -4
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/Tag/index.js +2 -2
- package/lib/components/Tag/index.js.map +1 -1
- package/lib/components/Tile/index.js +4 -4
- package/lib/components/Tile/index.js.map +1 -1
- package/lib/components/ToastList/index.js +1 -1
- package/lib/components/ToastList/index.js.map +1 -1
- package/lib/components/Toggle/index.js +7 -7
- package/lib/components/Toggle/index.js.map +1 -1
- package/lib/components/Validation/index.js +2 -2
- package/lib/components/Validation/index.js.map +1 -1
- package/lib/components/VisualCheckboxCloud/index.js +2 -2
- package/lib/components/VisualCheckboxCloud/index.js.map +1 -1
- package/lib/components/VisualCheckboxGroup/index.js +3 -3
- package/lib/components/VisualCheckboxGroup/index.js.map +1 -1
- package/lib/components/VisualContentgroupWithImage/index.js +2 -2
- package/lib/components/VisualContentgroupWithImage/index.js.map +1 -1
- package/lib/components/VisualRadioCloud/index.js +2 -2
- package/lib/components/VisualRadioCloud/index.js.map +1 -1
- package/lib/components/VisualRadioGroup/index.js +3 -3
- package/lib/components/VisualRadioGroup/index.js.map +1 -1
- package/lib/floating-ui.react.js +9 -6
- package/lib/floating-ui.react.js.map +1 -1
- package/lib/getFilterChips.js.map +1 -1
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useFocusTrap.js +4 -2
- package/lib/hooks/useFocusTrap.js.map +1 -1
- package/lib/hooks/useFocusableElements.js.map +1 -1
- package/lib/hooks/useIsVisible.js.map +1 -1
- package/lib/hooks/useOutsideEvent.js.map +1 -1
- package/lib/hooks/useResizeObserver.js.map +1 -1
- package/lib/hooks/useRovingFocus.js.map +1 -1
- package/lib/hooks/useSize.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/focus.js.map +1 -1
- package/lib/utils/mobile.js.map +1 -1
- package/lib/utils/uuid.js +29 -2
- package/lib/utils/uuid.js.map +1 -0
- package/lib/utils2.js +7 -7
- package/lib/utils2.js.map +1 -1
- package/lib/utils5.js +2 -2
- package/lib/utils5.js.map +1 -1
- package/package.json +1 -1
- package/lib/uuid.js +0 -29
- package/lib/uuid.js.map +0 -1
package/lib/TableRow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.js","names":[],"sources":["../src/components/Table/TableExpanderCell/TableExpanderCellMobile.tsx","../src/components/Table/TableRow/TableRow.tsx","../src/components/Table/TableRow/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport type { Props } from '../TableRow/TableRow';\n\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport ChevronDown from '../../Icons/ChevronDown';\nimport ChevronUp from '../../Icons/ChevronUp';\nimport { ModeType } from '../constants';\nimport tableStyles from '../styles.module.scss';\n\ntype TableExpanderCellMobileProps = Pick<Props, 'expanded' | 'onClick' | 'hideDetailsText' | 'showDetailsText' | 'mode'>;\n\nconst TableExpanderCellMobile: React.FC<TableExpanderCellMobileProps> = ({\n expanded,\n onClick,\n hideDetailsText,\n showDetailsText,\n mode = ModeType.normal,\n}) => {\n const cellClass = classNames(tableStyles.table__cell, tableStyles['table__expander-cell-mobile'], {\n [tableStyles['table__expander-cell-mobile--expanded']]: expanded,\n [tableStyles['table__cell--compact']]: mode === ModeType.compact,\n });\n\n return (\n <td className={cellClass}>\n <Button aria-expanded={expanded} variant=\"borderless\" onClick={onClick}>\n <Icon svgIcon={expanded ? ChevronUp : ChevronDown} /> {expanded ? hideDetailsText : showDetailsText}\n </Button>\n </td>\n );\n};\n\nexport default TableExpanderCellMobile;\n","import classNames from 'classnames';\n\nimport { ModeType } from '../constants';\nimport tableStyles from '../styles.module.scss';\nimport TableExpanderCellMobile from '../TableExpanderCell/TableExpanderCellMobile';\nimport { mapChildrenWithMode } from '../utils';\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'tr'>, 'style'> {\n /** Sets if expanded row can be expanded */\n expandable?: boolean;\n /** Sets if expanded row is expanded */\n expanded?: boolean;\n /** When hide/show button for expanded row is clicked. */\n onClick?: () => void;\n /** Text for expanded row hide button. */\n hideDetailsText?: string;\n /** Text for expanded row show button. */\n showDetailsText?: string;\n /** Key attribute for row */\n rowKey?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the cells of the table row element. */\n children?: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableRow: React.FC<Props> = ({\n rowKey,\n hideDetailsText,\n showDetailsText,\n expandable,\n expanded,\n onClick,\n className,\n children,\n mode = ModeType.normal,\n ...rest\n}) => {\n const tableRowClass = classNames(\n tableStyles['table-row'],\n {\n [tableStyles['table__row--expandable']]: expandable,\n },\n className\n );\n\n return (\n <tr className={tableRowClass} onClick={onClick} key={rowKey} {...rest}>\n {mapChildrenWithMode(children, mode)}\n {expandable && (\n <TableExpanderCellMobile\n expanded={expanded}\n onClick={onClick}\n hideDetailsText={hideDetailsText}\n showDetailsText={showDetailsText}\n mode={mode}\n />\n )}\n </tr>\n );\n};\n\nexport default TableRow;\n","import TableRow from './TableRow';\nexport * from './TableRow';\nexport default TableRow;\n"],"mappings":";;;;;;;;;;AAaA,IAAM,2BAAmE,EACvE,UACA,SACA,iBACA,iBACA,OAAO,SAAS,aACZ;CAMJ,OACE,oBAAC,MAAD;EAAI,WANY,
|
|
1
|
+
{"version":3,"file":"TableRow.js","names":[],"sources":["../src/components/Table/TableExpanderCell/TableExpanderCellMobile.tsx","../src/components/Table/TableRow/TableRow.tsx","../src/components/Table/TableRow/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport type { Props } from '../TableRow/TableRow';\n\nimport Button from '../../Button';\nimport Icon from '../../Icon';\nimport ChevronDown from '../../Icons/ChevronDown';\nimport ChevronUp from '../../Icons/ChevronUp';\nimport { ModeType } from '../constants';\nimport tableStyles from '../styles.module.scss';\n\ntype TableExpanderCellMobileProps = Pick<Props, 'expanded' | 'onClick' | 'hideDetailsText' | 'showDetailsText' | 'mode'>;\n\nconst TableExpanderCellMobile: React.FC<TableExpanderCellMobileProps> = ({\n expanded,\n onClick,\n hideDetailsText,\n showDetailsText,\n mode = ModeType.normal,\n}) => {\n const cellClass = classNames(tableStyles.table__cell, tableStyles['table__expander-cell-mobile'], {\n [tableStyles['table__expander-cell-mobile--expanded']]: expanded,\n [tableStyles['table__cell--compact']]: mode === ModeType.compact,\n });\n\n return (\n <td className={cellClass}>\n <Button aria-expanded={expanded} variant=\"borderless\" onClick={onClick}>\n <Icon svgIcon={expanded ? ChevronUp : ChevronDown} /> {expanded ? hideDetailsText : showDetailsText}\n </Button>\n </td>\n );\n};\n\nexport default TableExpanderCellMobile;\n","import classNames from 'classnames';\n\nimport { ModeType } from '../constants';\nimport tableStyles from '../styles.module.scss';\nimport TableExpanderCellMobile from '../TableExpanderCell/TableExpanderCellMobile';\nimport { mapChildrenWithMode } from '../utils';\n\nexport interface Props extends Omit<React.ComponentPropsWithoutRef<'tr'>, 'style'> {\n /** Sets if expanded row can be expanded */\n expandable?: boolean;\n /** Sets if expanded row is expanded */\n expanded?: boolean;\n /** When hide/show button for expanded row is clicked. */\n onClick?: () => void;\n /** Text for expanded row hide button. */\n hideDetailsText?: string;\n /** Text for expanded row show button. */\n showDetailsText?: string;\n /** Key attribute for row */\n rowKey?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the cells of the table row element. */\n children?: React.ReactNode;\n /** For display with less space. Discouraged to use together with interactive elements. */\n mode?: ModeType;\n}\n\nexport const TableRow: React.FC<Props> = ({\n rowKey,\n hideDetailsText,\n showDetailsText,\n expandable,\n expanded,\n onClick,\n className,\n children,\n mode = ModeType.normal,\n ...rest\n}) => {\n const tableRowClass = classNames(\n tableStyles['table-row'],\n {\n [tableStyles['table__row--expandable']]: expandable,\n },\n className\n );\n\n return (\n <tr className={tableRowClass} onClick={onClick} key={rowKey} {...rest}>\n {mapChildrenWithMode(children, mode)}\n {expandable && (\n <TableExpanderCellMobile\n expanded={expanded}\n onClick={onClick}\n hideDetailsText={hideDetailsText}\n showDetailsText={showDetailsText}\n mode={mode}\n />\n )}\n </tr>\n );\n};\n\nexport default TableRow;\n","import TableRow from './TableRow';\nexport * from './TableRow';\nexport default TableRow;\n"],"mappings":";;;;;;;;;;AAaA,IAAM,2BAAmE,EACvE,UACA,SACA,iBACA,iBACA,OAAO,SAAS,aACZ;CAMJ,OACE,oBAAC,MAAD;EAAI,WANY,WAAW,OAAY,aAAa,OAAY,gCAAgC;IAC/F,OAAY,2CAA2C;IACvD,OAAY,0BAA0B,SAAS,SAAS;EAC3D,CAGiB;YACb,qBAAC,gBAAD;GAAQ,iBAAe;GAAU,SAAQ;GAAsB;aAA/D;IACE,oBAAC,cAAD,EAAM,SAAS,WAAW,YAAY,YAAc,CAAA;IAAC;IAAE,WAAW,kBAAkB;GAC9E;;CACN,CAAA;AAER;;;ACJA,IAAa,YAA6B,EACxC,QACA,iBACA,iBACA,YACA,UACA,SACA,WACA,UACA,OAAO,SAAS,QAChB,GAAG,WACC;CASJ,OACE,qBAAC,MAAD;EAAI,WATgB,WACpB,OAAY,cACZ,GACG,OAAY,4BAA4B,WAC3C,GACA,SAIe;EAAwB;EAAsB,GAAI;YAAjE,CACG,oBAAoB,UAAU,IAAI,GAClC,cACC,oBAAC,yBAAD;GACY;GACD;GACQ;GACA;GACX;EACP,CAAA,CAED;IAXiD,MAWjD;AAER;;;AC5DA,IAAA,mBAAe"}
|
package/lib/Textarea.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import uuid from "./utils/uuid.js";
|
|
2
2
|
import { AnalyticsId, FormOnColor, LanguageLocales } from "./constants.js";
|
|
3
3
|
import { useLanguage } from "./hooks/useLanguage.js";
|
|
4
4
|
import { useIdWithFallback } from "./hooks/useIdWithFallback.js";
|
|
@@ -6,7 +6,7 @@ import { getAriaDescribedBy } from "./utils/accessibility.js";
|
|
|
6
6
|
import { t as ErrorWrapper_default } from "./ErrorWrapper.js";
|
|
7
7
|
import { n as renderLabel } from "./utils2.js";
|
|
8
8
|
import { t as MaxCharacters } from "./MaxCharacters.js";
|
|
9
|
-
import
|
|
9
|
+
import classNames from "classnames";
|
|
10
10
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import styles from "./components/Textarea/styles.module.scss";
|
|
@@ -46,7 +46,7 @@ var Textarea = (props) => {
|
|
|
46
46
|
}
|
|
47
47
|
if (value !== prevValue) {
|
|
48
48
|
setPrevValue(value);
|
|
49
|
-
if (value) setTextareaInput(value);
|
|
49
|
+
if (value !== void 0) setTextareaInput(value);
|
|
50
50
|
}
|
|
51
51
|
const resizeHeight = (target) => {
|
|
52
52
|
const textareaLineHeight = 28;
|
|
@@ -61,15 +61,15 @@ var Textarea = (props) => {
|
|
|
61
61
|
const onBlueberry = onColor === FormOnColor.onblueberry;
|
|
62
62
|
const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;
|
|
63
63
|
const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;
|
|
64
|
-
const textareaWrapperClass =
|
|
65
|
-
const contentWrapperClass =
|
|
64
|
+
const textareaWrapperClass = classNames(styles.textarea, { [styles["textarea--gutterBottom"]]: gutterBottom });
|
|
65
|
+
const contentWrapperClass = classNames(styles["input-container"], {
|
|
66
66
|
[styles["input-container--transparent"]]: transparent,
|
|
67
67
|
[styles["input-container--on-blueberry"]]: onBlueberry,
|
|
68
68
|
[styles["input-container--on-dark"]]: onDark,
|
|
69
69
|
[styles["input-container--invalid"]]: onError,
|
|
70
70
|
[styles["input-container--disabled"]]: props.disabled
|
|
71
71
|
});
|
|
72
|
-
const textareaClass =
|
|
72
|
+
const textareaClass = classNames(styles["input-container__input"], { [styles[`input-container__input--disabled`]]: props.disabled });
|
|
73
73
|
useLayoutEffect(() => {
|
|
74
74
|
if (grow && referanse.current?.children && referanse.current?.children[0]) {
|
|
75
75
|
const textarea = referanse.current?.children[0];
|
package/lib/Textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","names":[],"sources":["../src/resources/HN.Designsystem.TextArea.en-GB.json","../src/resources/HN.Designsystem.TextArea.nb-NO.json","../src/resources/HN.Designsystem.TextArea.nn-NO.json","../src/components/Textarea/resourceHelper.ts","../src/components/Textarea/Textarea.tsx","../src/components/Textarea/index.ts"],"sourcesContent":["{\n \"characters\": \"characters\"\n}\n","{\n \"characters\": \"tegn\"\n}\n","{\n \"characters\": \"teikn\"\n}\n","import type { HNDesignsystemTextArea } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.TextArea.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.TextArea.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.TextArea.nn-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemTextArea => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useState, useRef, useLayoutEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport type { HNDesignsystemTextArea } from '../../resources/Resources';\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor, LanguageLocales } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper from '../ErrorWrapper';\nimport { renderLabel } from '../Label/utils';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends\n ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemTextArea>;\n /** Ref passed to the component */\n ref?: React.Ref<HTMLTextAreaElement | null>;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea: React.FC<TextareaProps> = props => {\n const {\n maxCharacters,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n resources,\n ref,\n ...rest\n } = props;\n\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const [prevDefaultValue, setPrevDefaultValue] = useState(defaultValue);\n const [prevValue, setPrevValue] = useState(value);\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useIdWithFallback(errorTextIdProp);\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemTextArea = {\n ...defaultResources,\n ...resources,\n };\n\n if (defaultValue !== prevDefaultValue) {\n setPrevDefaultValue(defaultValue);\n setTextareaInput(defaultValue || '');\n }\n\n if (value !== prevValue) {\n setPrevValue(value);\n\n if (value) {\n setTextareaInput(value);\n }\n }\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n } else {\n target.rows = currentRows;\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useLayoutEffect(() => {\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel({ label: label, inputId: textareaId, onColor: onColor as FormOnColor })}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={minRows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={mergedResources.characters}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n};\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n","import Textarea from './Textarea';\nexport * from './Textarea';\nexport default Textarea;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Textarea.js","names":[],"sources":["../src/resources/HN.Designsystem.TextArea.en-GB.json","../src/resources/HN.Designsystem.TextArea.nb-NO.json","../src/resources/HN.Designsystem.TextArea.nn-NO.json","../src/components/Textarea/resourceHelper.ts","../src/components/Textarea/Textarea.tsx","../src/components/Textarea/index.ts"],"sourcesContent":["{\n \"characters\": \"characters\"\n}\n","{\n \"characters\": \"tegn\"\n}\n","{\n \"characters\": \"teikn\"\n}\n","import type { HNDesignsystemTextArea } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.TextArea.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.TextArea.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.TextArea.nn-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemTextArea => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useState, useRef, useLayoutEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport type { HNDesignsystemTextArea } from '../../resources/Resources';\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor, LanguageLocales } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper from '../ErrorWrapper';\nimport { renderLabel } from '../Label/utils';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends\n ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Resources for component */\n resources?: Partial<HNDesignsystemTextArea>;\n /** Ref passed to the component */\n ref?: React.Ref<HTMLTextAreaElement | null>;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea: React.FC<TextareaProps> = props => {\n const {\n maxCharacters,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n resources,\n ref,\n ...rest\n } = props;\n\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const [prevDefaultValue, setPrevDefaultValue] = useState(defaultValue);\n const [prevValue, setPrevValue] = useState(value);\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useIdWithFallback(errorTextIdProp);\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemTextArea = {\n ...defaultResources,\n ...resources,\n };\n\n if (defaultValue !== prevDefaultValue) {\n setPrevDefaultValue(defaultValue);\n setTextareaInput(defaultValue || '');\n }\n\n if (value !== prevValue) {\n setPrevValue(value);\n\n if (value !== undefined) {\n setTextareaInput(value);\n }\n }\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n } else {\n target.rows = currentRows;\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useLayoutEffect(() => {\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel({ label: label, inputId: textareaId, onColor: onColor as FormOnColor })}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={minRows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={mergedResources.characters}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n};\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n","import Textarea from './Textarea';\nexport * from './Textarea';\nexport default Textarea;\n"],"mappings":"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"}
|
package/lib/Title.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnalyticsId } from "./constants.js";
|
|
2
|
-
import
|
|
2
|
+
import classNames from "classnames";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import titleStyles from "./components/Title/styles.module.scss";
|
|
5
5
|
//#region src/components/Title/utils.ts
|
|
@@ -12,7 +12,7 @@ var Title = (props) => {
|
|
|
12
12
|
const { id, children, className, htmlMarkup = "h1", appearance = "title1", margin = 0, tabIndex, testId, ref } = props;
|
|
13
13
|
return /* @__PURE__ */ jsx(htmlMarkup, {
|
|
14
14
|
id,
|
|
15
|
-
className:
|
|
15
|
+
className: classNames(titleStyles.title, {
|
|
16
16
|
[titleStyles["title--feature"]]: appearance === "titleFeature",
|
|
17
17
|
[titleStyles["title--title1"]]: appearance === "title1",
|
|
18
18
|
[titleStyles["title--title2"]]: appearance === "title2",
|
package/lib/Title.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.js","names":[],"sources":["../src/components/Title/utils.ts","../src/components/Title/Title.tsx"],"sourcesContent":["import type { TitleMargin } from './Title';\n\nexport const instanceOfTitleMargin = (margin: unknown): margin is TitleMargin => {\n return Object.prototype.hasOwnProperty.call(margin, 'marginTop') && Object.prototype.hasOwnProperty.call(margin, 'marginBottom');\n};\n","import classNames from 'classnames';\n\nimport { instanceOfTitleMargin } from './utils';\nimport { AnalyticsId } from '../../constants';\n\nimport titleStyles from './styles.module.scss';\n\nexport type TitleTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';\nexport type TitleAppearances = 'titleFeature' | 'title1' | 'title2' | 'title3' | 'title4' | 'title5' | 'title6';\n\nexport interface TitleProps {\n children: React.ReactNode;\n /** Gives a unique id to the title */\n id?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds top and bottom margin in rem. */\n margin?: number | TitleMargin;\n /** Changes the underlying element of the title. */\n htmlMarkup?: TitleTags;\n /** Changes the appearance of the title. */\n appearance?: TitleAppearances;\n /** Sets the tabIndex. Use this with caution. */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the heading element */\n ref?: React.Ref<HTMLHeadingElement | null>;\n}\n\nexport const Title: React.FC<TitleProps> = (props: TitleProps) => {\n const { id, children, className, htmlMarkup = 'h1', appearance = 'title1', margin = 0, tabIndex, testId, ref } = props;\n const titleClasses = classNames(\n titleStyles.title,\n {\n [titleStyles['title--feature']]: appearance === 'titleFeature',\n [titleStyles['title--title1']]: appearance === 'title1',\n [titleStyles['title--title2']]: appearance === 'title2',\n [titleStyles['title--title3']]: appearance === 'title3',\n [titleStyles['title--title4']]: appearance === 'title4',\n [titleStyles['title--title5']]: appearance === 'title5',\n [titleStyles['title--title6']]: appearance === 'title6',\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n const inlineStyle = instanceOfTitleMargin(margin)\n ? { marginTop: `${margin.marginTop}rem`, marginBottom: `${margin.marginBottom}rem` }\n : { marginTop: `${margin}rem`, marginBottom: `${margin}rem` };\n\n return (\n <CustomTag\n id={id}\n className={titleClasses}\n style={inlineStyle}\n ref={ref}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Title}\n tabIndex={tabIndex}\n >\n {children}\n </CustomTag>\n );\n};\n\nexport interface TitleMargin {\n marginTop: number;\n marginBottom: number;\n}\n\nexport default Title;\n"],"mappings":";;;;;AAEA,IAAa,yBAAyB,WAA2C;CAC/E,OAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,WAAW,KAAK,OAAO,UAAU,eAAe,KAAK,QAAQ,cAAc;AACjI;;;AC0BA,IAAa,SAA+B,UAAsB;CAChE,MAAM,EAAE,IAAI,UAAU,WAAW,aAAa,MAAM,aAAa,UAAU,SAAS,GAAG,UAAU,QAAQ,QAAQ;CAoBjH,OACE,oBAAC,YAAD;EACM;EACJ,WAtBiB,
|
|
1
|
+
{"version":3,"file":"Title.js","names":[],"sources":["../src/components/Title/utils.ts","../src/components/Title/Title.tsx"],"sourcesContent":["import type { TitleMargin } from './Title';\n\nexport const instanceOfTitleMargin = (margin: unknown): margin is TitleMargin => {\n return Object.prototype.hasOwnProperty.call(margin, 'marginTop') && Object.prototype.hasOwnProperty.call(margin, 'marginBottom');\n};\n","import classNames from 'classnames';\n\nimport { instanceOfTitleMargin } from './utils';\nimport { AnalyticsId } from '../../constants';\n\nimport titleStyles from './styles.module.scss';\n\nexport type TitleTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';\nexport type TitleAppearances = 'titleFeature' | 'title1' | 'title2' | 'title3' | 'title4' | 'title5' | 'title6';\n\nexport interface TitleProps {\n children: React.ReactNode;\n /** Gives a unique id to the title */\n id?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds top and bottom margin in rem. */\n margin?: number | TitleMargin;\n /** Changes the underlying element of the title. */\n htmlMarkup?: TitleTags;\n /** Changes the appearance of the title. */\n appearance?: TitleAppearances;\n /** Sets the tabIndex. Use this with caution. */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref passed to the heading element */\n ref?: React.Ref<HTMLHeadingElement | null>;\n}\n\nexport const Title: React.FC<TitleProps> = (props: TitleProps) => {\n const { id, children, className, htmlMarkup = 'h1', appearance = 'title1', margin = 0, tabIndex, testId, ref } = props;\n const titleClasses = classNames(\n titleStyles.title,\n {\n [titleStyles['title--feature']]: appearance === 'titleFeature',\n [titleStyles['title--title1']]: appearance === 'title1',\n [titleStyles['title--title2']]: appearance === 'title2',\n [titleStyles['title--title3']]: appearance === 'title3',\n [titleStyles['title--title4']]: appearance === 'title4',\n [titleStyles['title--title5']]: appearance === 'title5',\n [titleStyles['title--title6']]: appearance === 'title6',\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n const inlineStyle = instanceOfTitleMargin(margin)\n ? { marginTop: `${margin.marginTop}rem`, marginBottom: `${margin.marginBottom}rem` }\n : { marginTop: `${margin}rem`, marginBottom: `${margin}rem` };\n\n return (\n <CustomTag\n id={id}\n className={titleClasses}\n style={inlineStyle}\n ref={ref}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Title}\n tabIndex={tabIndex}\n >\n {children}\n </CustomTag>\n );\n};\n\nexport interface TitleMargin {\n marginTop: number;\n marginBottom: number;\n}\n\nexport default Title;\n"],"mappings":";;;;;AAEA,IAAa,yBAAyB,WAA2C;CAC/E,OAAO,OAAO,UAAU,eAAe,KAAK,QAAQ,WAAW,KAAK,OAAO,UAAU,eAAe,KAAK,QAAQ,cAAc;AACjI;;;AC0BA,IAAa,SAA+B,UAAsB;CAChE,MAAM,EAAE,IAAI,UAAU,WAAW,aAAa,MAAM,aAAa,UAAU,SAAS,GAAG,UAAU,QAAQ,QAAQ;CAoBjH,OACE,oBAAC,YAAD;EACM;EACJ,WAtBiB,WACnB,YAAY,OACZ;IACG,YAAY,oBAAoB,eAAe;IAC/C,YAAY,mBAAmB,eAAe;IAC9C,YAAY,mBAAmB,eAAe;IAC9C,YAAY,mBAAmB,eAAe;IAC9C,YAAY,mBAAmB,eAAe;IAC9C,YAAY,mBAAmB,eAAe;IAC9C,YAAY,mBAAmB,eAAe;EACjD,GACA,SAWa;EACX,OARgB,sBAAsB,MAAM,IAC5C;GAAE,WAAW,GAAG,OAAO,UAAU;GAAM,cAAc,GAAG,OAAO,aAAa;EAAK,IACjF;GAAE,WAAW,GAAG,OAAO;GAAM,cAAc,GAAG,OAAO;EAAK;EAOrD;EACL,eAAa;EACb,oBAAkB,YAAY;EACpB;EAET;CACQ,CAAA;AAEf"}
|
package/lib/Toast.js
CHANGED
|
@@ -3,7 +3,7 @@ import { t as Icon_default } from "./Icon.js";
|
|
|
3
3
|
import CheckFill from "./components/Icons/CheckFill.js";
|
|
4
4
|
import { useIsMobileBreakpoint } from "./hooks/useIsMobileBreakpoint.js";
|
|
5
5
|
import { t as Close_default } from "./Close.js";
|
|
6
|
-
import
|
|
6
|
+
import classNames from "classnames";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import styles from "./components/Toast/styles.module.scss";
|
|
9
9
|
//#region src/components/Toast/Toast.tsx
|
|
@@ -19,7 +19,7 @@ var Toast = ({ testId, title, message, onClose }) => {
|
|
|
19
19
|
/* @__PURE__ */ jsx(Icon_default, {
|
|
20
20
|
size: isMobile ? IconSize.XSmall : IconSize.Small,
|
|
21
21
|
svgIcon: CheckFill,
|
|
22
|
-
className:
|
|
22
|
+
className: classNames(styles["toast__icon"], styles["toast__icon--check"])
|
|
23
23
|
}),
|
|
24
24
|
/* @__PURE__ */ jsxs("div", {
|
|
25
25
|
className: styles["toast__text-container"],
|
|
@@ -34,7 +34,7 @@ var Toast = ({ testId, title, message, onClose }) => {
|
|
|
34
34
|
/* @__PURE__ */ jsx(Close_default, {
|
|
35
35
|
onClick: handleClose,
|
|
36
36
|
color: "black",
|
|
37
|
-
className:
|
|
37
|
+
className: classNames(styles["toast__icon"], styles["toast__icon--close"]),
|
|
38
38
|
testId: `${testId}-close`
|
|
39
39
|
})
|
|
40
40
|
]
|
package/lib/Toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","names":[],"sources":["../src/components/Toast/Toast.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport Close from '../Close';\nimport Icon, { IconSize } from '../Icon';\nimport CheckFill from '../Icons/CheckFill';\n\nimport styles from './styles.module.scss';\n\nexport interface ToastProps {\n /** Sets the data-testid attribute. */\n testId?: string;\n /** The title to display in the toast */\n title: string;\n /** The message to display in the toast */\n message?: string;\n /** Callback when toast is closed */\n onClose?: () => void;\n}\n\nconst Toast: React.FC<ToastProps> = ({ testId, title, message, onClose }) => {\n const isMobile = useIsMobileBreakpoint();\n\n const handleClose = (): void => {\n if (onClose) {\n onClose();\n }\n };\n\n return (\n <output className={styles['toast']} data-testid={testId}>\n <Icon\n size={isMobile ? IconSize.XSmall : IconSize.Small}\n svgIcon={CheckFill}\n className={classNames(styles['toast__icon'], styles['toast__icon--check'])}\n />\n <div className={styles['toast__text-container']}>\n <span className={styles['toast__title']}>{title}</span>\n {message && <span className={styles['toast__description']}>{message}</span>}\n </div>\n <Close\n onClick={handleClose}\n color=\"black\"\n className={classNames(styles['toast__icon'], styles['toast__icon--close'])}\n testId={`${testId}-close`}\n />\n </output>\n );\n};\n\nexport default Toast;\n"],"mappings":";;;;;;;;;AAoBA,IAAM,SAA+B,EAAE,QAAQ,OAAO,SAAS,cAAc;CAC3E,MAAM,WAAW,sBAAsB;CAEvC,MAAM,oBAA0B;EAC9B,IAAI,SACF,QAAQ;CAEZ;CAEA,OACE,qBAAC,UAAD;EAAQ,WAAW,OAAO;EAAU,eAAa;YAAjD;GACE,oBAAC,cAAD;IACE,MAAM,WAAW,SAAS,SAAS,SAAS;IAC5C,SAAS;IACT,WAAW,
|
|
1
|
+
{"version":3,"file":"Toast.js","names":[],"sources":["../src/components/Toast/Toast.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport Close from '../Close';\nimport Icon, { IconSize } from '../Icon';\nimport CheckFill from '../Icons/CheckFill';\n\nimport styles from './styles.module.scss';\n\nexport interface ToastProps {\n /** Sets the data-testid attribute. */\n testId?: string;\n /** The title to display in the toast */\n title: string;\n /** The message to display in the toast */\n message?: string;\n /** Callback when toast is closed */\n onClose?: () => void;\n}\n\nconst Toast: React.FC<ToastProps> = ({ testId, title, message, onClose }) => {\n const isMobile = useIsMobileBreakpoint();\n\n const handleClose = (): void => {\n if (onClose) {\n onClose();\n }\n };\n\n return (\n <output className={styles['toast']} data-testid={testId}>\n <Icon\n size={isMobile ? IconSize.XSmall : IconSize.Small}\n svgIcon={CheckFill}\n className={classNames(styles['toast__icon'], styles['toast__icon--check'])}\n />\n <div className={styles['toast__text-container']}>\n <span className={styles['toast__title']}>{title}</span>\n {message && <span className={styles['toast__description']}>{message}</span>}\n </div>\n <Close\n onClick={handleClose}\n color=\"black\"\n className={classNames(styles['toast__icon'], styles['toast__icon--close'])}\n testId={`${testId}-close`}\n />\n </output>\n );\n};\n\nexport default Toast;\n"],"mappings":";;;;;;;;;AAoBA,IAAM,SAA+B,EAAE,QAAQ,OAAO,SAAS,cAAc;CAC3E,MAAM,WAAW,sBAAsB;CAEvC,MAAM,oBAA0B;EAC9B,IAAI,SACF,QAAQ;CAEZ;CAEA,OACE,qBAAC,UAAD;EAAQ,WAAW,OAAO;EAAU,eAAa;YAAjD;GACE,oBAAC,cAAD;IACE,MAAM,WAAW,SAAS,SAAS,SAAS;IAC5C,SAAS;IACT,WAAW,WAAW,OAAO,gBAAgB,OAAO,qBAAqB;GAC1E,CAAA;GACD,qBAAC,OAAD;IAAK,WAAW,OAAO;cAAvB,CACE,oBAAC,QAAD;KAAM,WAAW,OAAO;eAAkB;IAAY,CAAA,GACrD,WAAW,oBAAC,QAAD;KAAM,WAAW,OAAO;eAAwB;IAAc,CAAA,CACvE;;GACL,oBAAC,eAAD;IACE,SAAS;IACT,OAAM;IACN,WAAW,WAAW,OAAO,gBAAgB,OAAO,qBAAqB;IACzE,QAAQ,GAAG,OAAO;GACnB,CAAA;EACK;;AAEZ"}
|
package/lib/VisualCheckbox.js
CHANGED
|
@@ -3,7 +3,7 @@ import { t as CheckboxMarker } from "./CheckboxMarker.js";
|
|
|
3
3
|
import { useIdWithFallback } from "./hooks/useIdWithFallback.js";
|
|
4
4
|
import { getAriaDescribedBy } from "./utils/accessibility.js";
|
|
5
5
|
import { t as ErrorWrapper_default } from "./ErrorWrapper.js";
|
|
6
|
-
import
|
|
6
|
+
import classNames from "classnames";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import styles from "./components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss";
|
|
@@ -11,7 +11,7 @@ import styles from "./components/VisualCheckboxGroup/VisualCheckbox/styles.modul
|
|
|
11
11
|
var VisualContent = (props) => {
|
|
12
12
|
const { children, className, testId } = props;
|
|
13
13
|
return /* @__PURE__ */ jsx("span", {
|
|
14
|
-
className:
|
|
14
|
+
className: classNames(styles["visual-checkbox__visual-content"], className),
|
|
15
15
|
"data-testid": testId,
|
|
16
16
|
"aria-hidden": "true",
|
|
17
17
|
children
|
|
@@ -38,7 +38,7 @@ var VisualCheckbox = (props) => {
|
|
|
38
38
|
errorText,
|
|
39
39
|
errorTextId,
|
|
40
40
|
children: /* @__PURE__ */ jsxs("label", {
|
|
41
|
-
className:
|
|
41
|
+
className: classNames(styles["visual-checkbox"], styles[`visual-checkbox--variant-${variant}`], {
|
|
42
42
|
[styles["visual-checkbox--checked"]]: isChecked,
|
|
43
43
|
[styles["visual-checkbox--invalid"]]: error
|
|
44
44
|
}, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualCheckbox.js","names":[],"sources":["../src/components/VisualCheckboxGroup/VisualCheckbox/VisualContent.tsx","../src/components/VisualCheckboxGroup/VisualCheckbox/VisualCheckbox.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualContentProps {\n /** Content rendered inside the circular area – typically an <img> or illustration component. */\n children: React.ReactNode;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const VisualContent: React.FC<VisualContentProps> = props => {\n const { children, className, testId } = props;\n\n return (\n <span className={classNames(styles['visual-checkbox__visual-content'], className)} data-testid={testId} aria-hidden=\"true\">\n {children}\n </span>\n );\n};\n\nexport default VisualContent;\n","import { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../../ErrorWrapper';\n\nimport VisualContent from './VisualContent';\nimport { AnalyticsId } from '../../../constants';\nimport { useIdWithFallback } from '../../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../../utils/accessibility';\nimport CheckboxMarker from '../../Checkbox/CheckboxMarker/CheckboxMarker';\nimport ErrorWrapper from '../../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport type VisualCheckboxVariant = 'line' | 'rectangle';\n\nexport interface VisualCheckboxProps\n extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size'> {\n /** Adds custom classes to the root element. */\n className?: string;\n /** Label rendered inside the checkbox frame. */\n children: string;\n /** Content rendered inside the circular visual slot. */\n visualContent: React.ReactNode;\n /** Layout variant. `line` is a thin horizontal pill, `rectangle` is a vertical card. */\n variant?: VisualCheckboxVariant;\n /** input id of the underlying checkbox */\n inputId?: string;\n /** Activates error styling. Can be true while errorText is empty (e.g. when used in a FormGroup). */\n error?: boolean;\n /** Error text to show above the component. */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref forwarded to the underlying input element. */\n ref?: React.Ref<HTMLInputElement | null>;\n}\n\nconst VisualCheckbox: React.FC<VisualCheckboxProps> = props => {\n const {\n className,\n checked,\n defaultChecked,\n children,\n visualContent,\n variant = 'line',\n inputId: inputIdProp,\n errorText,\n error = !!errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n testId,\n onChange,\n ref,\n ...rest\n } = props;\n\n const inputId = useIdWithFallback(inputIdProp);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const [isChecked, setIsChecked] = useState<boolean>(!!(checked ?? defaultChecked));\n const [prevChecked, setPrevChecked] = useState<boolean | undefined>(checked);\n if (prevChecked !== checked) {\n setPrevChecked(checked);\n if (checked !== undefined && checked !== isChecked) {\n setIsChecked(checked);\n }\n }\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>): void => {\n setIsChecked(e.target.checked);\n onChange?.(e);\n };\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <label\n className={classNames(\n styles['visual-checkbox'],\n styles[`visual-checkbox--variant-${variant}`],\n {\n [styles['visual-checkbox--checked']]: isChecked,\n [styles['visual-checkbox--invalid']]: error,\n },\n className\n )}\n htmlFor={inputId}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Checkbox}\n >\n <VisualContent>{visualContent}</VisualContent>\n <input\n {...rest}\n id={inputId}\n ref={ref}\n className={styles['visual-checkbox__input']}\n type=\"checkbox\"\n checked={isChecked}\n aria-invalid={error}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n onChange={handleChange}\n />\n <span className={styles['visual-checkbox__frame']}>\n <span className={styles['visual-checkbox__label']}>{children}</span>\n <CheckboxMarker checked={isChecked} error={error} size={'large'} />\n </span>\n </label>\n </ErrorWrapper>\n );\n};\n\nexport default VisualCheckbox;\n"],"mappings":";;;;;;;;;;AAaA,IAAa,iBAA8C,UAAS;CAClE,MAAM,EAAE,UAAU,WAAW,WAAW;CAExC,OACE,oBAAC,QAAD;EAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"VisualCheckbox.js","names":[],"sources":["../src/components/VisualCheckboxGroup/VisualCheckbox/VisualContent.tsx","../src/components/VisualCheckboxGroup/VisualCheckbox/VisualCheckbox.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualContentProps {\n /** Content rendered inside the circular area – typically an <img> or illustration component. */\n children: React.ReactNode;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const VisualContent: React.FC<VisualContentProps> = props => {\n const { children, className, testId } = props;\n\n return (\n <span className={classNames(styles['visual-checkbox__visual-content'], className)} data-testid={testId} aria-hidden=\"true\">\n {children}\n </span>\n );\n};\n\nexport default VisualContent;\n","import { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../../ErrorWrapper';\n\nimport VisualContent from './VisualContent';\nimport { AnalyticsId } from '../../../constants';\nimport { useIdWithFallback } from '../../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../../utils/accessibility';\nimport CheckboxMarker from '../../Checkbox/CheckboxMarker/CheckboxMarker';\nimport ErrorWrapper from '../../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport type VisualCheckboxVariant = 'line' | 'rectangle';\n\nexport interface VisualCheckboxProps\n extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size'> {\n /** Adds custom classes to the root element. */\n className?: string;\n /** Label rendered inside the checkbox frame. */\n children: string;\n /** Content rendered inside the circular visual slot. */\n visualContent: React.ReactNode;\n /** Layout variant. `line` is a thin horizontal pill, `rectangle` is a vertical card. */\n variant?: VisualCheckboxVariant;\n /** input id of the underlying checkbox */\n inputId?: string;\n /** Activates error styling. Can be true while errorText is empty (e.g. when used in a FormGroup). */\n error?: boolean;\n /** Error text to show above the component. */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref forwarded to the underlying input element. */\n ref?: React.Ref<HTMLInputElement | null>;\n}\n\nconst VisualCheckbox: React.FC<VisualCheckboxProps> = props => {\n const {\n className,\n checked,\n defaultChecked,\n children,\n visualContent,\n variant = 'line',\n inputId: inputIdProp,\n errorText,\n error = !!errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n testId,\n onChange,\n ref,\n ...rest\n } = props;\n\n const inputId = useIdWithFallback(inputIdProp);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const [isChecked, setIsChecked] = useState<boolean>(!!(checked ?? defaultChecked));\n const [prevChecked, setPrevChecked] = useState<boolean | undefined>(checked);\n if (prevChecked !== checked) {\n setPrevChecked(checked);\n if (checked !== undefined && checked !== isChecked) {\n setIsChecked(checked);\n }\n }\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>): void => {\n setIsChecked(e.target.checked);\n onChange?.(e);\n };\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <label\n className={classNames(\n styles['visual-checkbox'],\n styles[`visual-checkbox--variant-${variant}`],\n {\n [styles['visual-checkbox--checked']]: isChecked,\n [styles['visual-checkbox--invalid']]: error,\n },\n className\n )}\n htmlFor={inputId}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Checkbox}\n >\n <VisualContent>{visualContent}</VisualContent>\n <input\n {...rest}\n id={inputId}\n ref={ref}\n className={styles['visual-checkbox__input']}\n type=\"checkbox\"\n checked={isChecked}\n aria-invalid={error}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n onChange={handleChange}\n />\n <span className={styles['visual-checkbox__frame']}>\n <span className={styles['visual-checkbox__label']}>{children}</span>\n <CheckboxMarker checked={isChecked} error={error} size={'large'} />\n </span>\n </label>\n </ErrorWrapper>\n );\n};\n\nexport default VisualCheckbox;\n"],"mappings":";;;;;;;;;;AAaA,IAAa,iBAA8C,UAAS;CAClE,MAAM,EAAE,UAAU,WAAW,WAAW;CAExC,OACE,oBAAC,QAAD;EAAM,WAAW,WAAW,OAAO,oCAAoC,SAAS;EAAG,eAAa;EAAQ,eAAY;EACjH;CACG,CAAA;AAEV;;;ACoBA,IAAM,kBAAgD,UAAS;CAC7D,MAAM,EACJ,WACA,SACA,gBACA,UACA,eACA,UAAU,QACV,SAAS,aACT,WACA,QAAQ,CAAC,CAAC,WACV,aAAa,iBACb,uBACA,QACA,UACA,KACA,GAAG,SACD;CAEJ,MAAM,UAAU,kBAAkB,WAAW;CAC7C,MAAM,cAAc,kBAAkB,eAAe;CACrD,MAAM,CAAC,WAAW,gBAAgB,SAAkB,CAAC,EAAE,WAAW,eAAe;CACjF,MAAM,CAAC,aAAa,kBAAkB,SAA8B,OAAO;CAC3E,IAAI,gBAAgB,SAAS;EAC3B,eAAe,OAAO;EACtB,IAAI,YAAY,KAAA,KAAa,YAAY,WACvC,aAAa,OAAO;CAExB;CAEA,MAAM,gBAAgB,MAAiD;EACrE,aAAa,EAAE,OAAO,OAAO;EAC7B,WAAW,CAAC;CACd;CAEA,OACE,oBAAC,sBAAD;EAAc,WAAW;EAAkC;EAAwB;YACjF,qBAAC,SAAD;GACE,WAAW,WACT,OAAO,oBACP,OAAO,4BAA4B,YACnC;KACG,OAAO,8BAA8B;KACrC,OAAO,8BAA8B;GACxC,GACA,SACF;GACA,SAAS;GACT,eAAa;GACb,oBAAkB,YAAY;aAZhC;IAcE,oBAAC,eAAD,EAAA,UAAgB,cAA6B,CAAA;IAC7C,oBAAC,SAAD;KACE,GAAI;KACJ,IAAI;KACC;KACL,WAAW,OAAO;KAClB,MAAK;KACL,SAAS;KACT,gBAAc;KACd,oBAAkB,mBAAmB,OAAO,WAAW;KACvD,UAAU;IACX,CAAA;IACD,qBAAC,QAAD;KAAM,WAAW,OAAO;eAAxB,CACE,oBAAC,QAAD;MAAM,WAAW,OAAO;MAA4B;KAAe,CAAA,GACnE,oBAAC,gBAAD;MAAgB,SAAS;MAAkB;MAAO,MAAM;KAAU,CAAA,CAC9D;;GACD;;CACK,CAAA;AAElB"}
|
package/lib/VisualRadio.js
CHANGED
|
@@ -3,14 +3,14 @@ import { useIdWithFallback } from "./hooks/useIdWithFallback.js";
|
|
|
3
3
|
import { getAriaDescribedBy } from "./utils/accessibility.js";
|
|
4
4
|
import { t as ErrorWrapper_default } from "./ErrorWrapper.js";
|
|
5
5
|
import { t as RadioMarker } from "./RadioMarker.js";
|
|
6
|
-
import
|
|
6
|
+
import classNames from "classnames";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import styles from "./components/VisualRadioGroup/VisualRadio/styles.module.scss";
|
|
9
9
|
//#region src/components/VisualRadioGroup/VisualRadio/VisualContent.tsx
|
|
10
10
|
var VisualContent = (props) => {
|
|
11
11
|
const { children, className, testId } = props;
|
|
12
12
|
return /* @__PURE__ */ jsx("span", {
|
|
13
|
-
className:
|
|
13
|
+
className: classNames(styles["visual-radio__visual-content"], className),
|
|
14
14
|
"data-testid": testId,
|
|
15
15
|
"aria-hidden": "true",
|
|
16
16
|
children
|
|
@@ -27,7 +27,7 @@ var VisualRadio = (props) => {
|
|
|
27
27
|
errorText,
|
|
28
28
|
errorTextId,
|
|
29
29
|
children: /* @__PURE__ */ jsxs("label", {
|
|
30
|
-
className:
|
|
30
|
+
className: classNames(styles["visual-radio"], styles[`visual-radio--variant-${variant}`], { [styles["visual-radio--invalid"]]: error }, className),
|
|
31
31
|
htmlFor: inputId,
|
|
32
32
|
"data-testid": testId,
|
|
33
33
|
"data-analyticsid": AnalyticsId.RadioButton,
|
package/lib/VisualRadio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualRadio.js","names":[],"sources":["../src/components/VisualRadioGroup/VisualRadio/VisualContent.tsx","../src/components/VisualRadioGroup/VisualRadio/VisualRadio.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualContentProps {\n /** Content rendered inside the circular area – typically an <img> or illustration component. */\n children: React.ReactNode;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const VisualContent: React.FC<VisualContentProps> = props => {\n const { children, className, testId } = props;\n\n return (\n <span className={classNames(styles['visual-radio__visual-content'], className)} data-testid={testId} aria-hidden=\"true\">\n {children}\n </span>\n );\n};\n\nexport default VisualContent;\n","import classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../../ErrorWrapper';\n\nimport VisualContent from './VisualContent';\nimport { AnalyticsId } from '../../../constants';\nimport { useIdWithFallback } from '../../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../../utils/accessibility';\nimport ErrorWrapper from '../../ErrorWrapper';\nimport RadioMarker from '../../RadioButton/RadioMarker/RadioMarker';\n\nimport styles from './styles.module.scss';\n\nexport type VisualRadioVariant = 'line' | 'rectangle';\n\nexport interface VisualRadioProps\n extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size'> {\n /** Adds custom classes to the root element. */\n className?: string;\n /** Label rendered inside the radio frame. */\n children: string;\n /** Content rendered inside the circular visual slot. */\n visualContent?: React.ReactNode;\n /** Layout variant. `line` is a thin horizontal pill, `rectangle` is a vertical card. */\n variant?: VisualRadioVariant;\n /** input id of the underlying radio */\n inputId?: string;\n /** Activates error styling. Can be true while errorText is empty (e.g. when used in a FormGroup). */\n error?: boolean;\n /** Error text to show above the component. */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref forwarded to the underlying input element. */\n ref?: React.Ref<HTMLInputElement | null>;\n}\n\nconst VisualRadio: React.FC<VisualRadioProps> = props => {\n const {\n className,\n children,\n visualContent,\n variant = 'line',\n inputId: inputIdProp,\n errorText,\n error = !!errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n testId,\n ref,\n ...rest\n } = props;\n\n const inputId = useIdWithFallback(inputIdProp);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <label\n className={classNames(\n styles['visual-radio'],\n styles[`visual-radio--variant-${variant}`],\n { [styles['visual-radio--invalid']]: error },\n className\n )}\n htmlFor={inputId}\n data-testid={testId}\n data-analyticsid={AnalyticsId.RadioButton}\n >\n {visualContent !== undefined && <VisualContent>{visualContent}</VisualContent>}\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- aria-invalid is a global ARIA state, valid on radio inputs */}\n <input\n {...rest}\n id={inputId}\n ref={ref}\n className={styles['visual-radio__input']}\n type=\"radio\"\n checked={rest.checked}\n aria-invalid={error}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n onChange={rest.onChange}\n />\n <span className={styles['visual-radio__frame']}>\n <span className={styles['visual-radio__label']}>{children}</span>\n <RadioMarker error={error} size={'large'} />\n </span>\n </label>\n </ErrorWrapper>\n );\n};\n\nexport default VisualRadio;\n"],"mappings":";;;;;;;;;AAaA,IAAa,iBAA8C,UAAS;CAClE,MAAM,EAAE,UAAU,WAAW,WAAW;CAExC,OACE,oBAAC,QAAD;EAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"VisualRadio.js","names":[],"sources":["../src/components/VisualRadioGroup/VisualRadio/VisualContent.tsx","../src/components/VisualRadioGroup/VisualRadio/VisualRadio.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualContentProps {\n /** Content rendered inside the circular area – typically an <img> or illustration component. */\n children: React.ReactNode;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const VisualContent: React.FC<VisualContentProps> = props => {\n const { children, className, testId } = props;\n\n return (\n <span className={classNames(styles['visual-radio__visual-content'], className)} data-testid={testId} aria-hidden=\"true\">\n {children}\n </span>\n );\n};\n\nexport default VisualContent;\n","import classNames from 'classnames';\n\nimport type { ErrorWrapperClassNameProps } from '../../ErrorWrapper';\n\nimport VisualContent from './VisualContent';\nimport { AnalyticsId } from '../../../constants';\nimport { useIdWithFallback } from '../../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../../utils/accessibility';\nimport ErrorWrapper from '../../ErrorWrapper';\nimport RadioMarker from '../../RadioButton/RadioMarker/RadioMarker';\n\nimport styles from './styles.module.scss';\n\nexport type VisualRadioVariant = 'line' | 'rectangle';\n\nexport interface VisualRadioProps\n extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size'> {\n /** Adds custom classes to the root element. */\n className?: string;\n /** Label rendered inside the radio frame. */\n children: string;\n /** Content rendered inside the circular visual slot. */\n visualContent?: React.ReactNode;\n /** Layout variant. `line` is a thin horizontal pill, `rectangle` is a vertical card. */\n variant?: VisualRadioVariant;\n /** input id of the underlying radio */\n inputId?: string;\n /** Activates error styling. Can be true while errorText is empty (e.g. when used in a FormGroup). */\n error?: boolean;\n /** Error text to show above the component. */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Ref forwarded to the underlying input element. */\n ref?: React.Ref<HTMLInputElement | null>;\n}\n\nconst VisualRadio: React.FC<VisualRadioProps> = props => {\n const {\n className,\n children,\n visualContent,\n variant = 'line',\n inputId: inputIdProp,\n errorText,\n error = !!errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n testId,\n ref,\n ...rest\n } = props;\n\n const inputId = useIdWithFallback(inputIdProp);\n const errorTextId = useIdWithFallback(errorTextIdProp);\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextId}>\n <label\n className={classNames(\n styles['visual-radio'],\n styles[`visual-radio--variant-${variant}`],\n { [styles['visual-radio--invalid']]: error },\n className\n )}\n htmlFor={inputId}\n data-testid={testId}\n data-analyticsid={AnalyticsId.RadioButton}\n >\n {visualContent !== undefined && <VisualContent>{visualContent}</VisualContent>}\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- aria-invalid is a global ARIA state, valid on radio inputs */}\n <input\n {...rest}\n id={inputId}\n ref={ref}\n className={styles['visual-radio__input']}\n type=\"radio\"\n checked={rest.checked}\n aria-invalid={error}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n onChange={rest.onChange}\n />\n <span className={styles['visual-radio__frame']}>\n <span className={styles['visual-radio__label']}>{children}</span>\n <RadioMarker error={error} size={'large'} />\n </span>\n </label>\n </ErrorWrapper>\n );\n};\n\nexport default VisualRadio;\n"],"mappings":";;;;;;;;;AAaA,IAAa,iBAA8C,UAAS;CAClE,MAAM,EAAE,UAAU,WAAW,WAAW;CAExC,OACE,oBAAC,QAAD;EAAM,WAAW,WAAW,OAAO,iCAAiC,SAAS;EAAG,eAAa;EAAQ,eAAY;EAC9G;CACG,CAAA;AAEV;;;ACkBA,IAAM,eAA0C,UAAS;CACvD,MAAM,EACJ,WACA,UACA,eACA,UAAU,QACV,SAAS,aACT,WACA,QAAQ,CAAC,CAAC,WACV,aAAa,iBACb,uBACA,QACA,KACA,GAAG,SACD;CAEJ,MAAM,UAAU,kBAAkB,WAAW;CAC7C,MAAM,cAAc,kBAAkB,eAAe;CAErD,OACE,oBAAC,sBAAD;EAAc,WAAW;EAAkC;EAAwB;YACjF,qBAAC,SAAD;GACE,WAAW,WACT,OAAO,iBACP,OAAO,yBAAyB,YAChC,GAAG,OAAO,2BAA2B,MAAM,GAC3C,SACF;GACA,SAAS;GACT,eAAa;GACb,oBAAkB,YAAY;aAThC;IAWG,kBAAkB,KAAA,KAAa,oBAAC,eAAD,EAAA,UAAgB,cAA6B,CAAA;IAE7E,oBAAC,SAAD;KACE,GAAI;KACJ,IAAI;KACC;KACL,WAAW,OAAO;KAClB,MAAK;KACL,SAAS,KAAK;KACd,gBAAc;KACd,oBAAkB,mBAAmB,OAAO,WAAW;KACvD,UAAU,KAAK;IAChB,CAAA;IACD,qBAAC,QAAD;KAAM,WAAW,OAAO;eAAxB,CACE,oBAAC,QAAD;MAAM,WAAW,OAAO;MAAyB;KAAe,CAAA,GAChE,oBAAC,aAAD;MAAoB;MAAO,MAAM;KAAU,CAAA,CACvC;;GACD;;CACK,CAAA;AAElB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchMedia.js","names":[],"sources":["../../src/__mocks__/matchMedia.ts"],"sourcesContent":["import { vi, type Mock } from 'vitest';\n\nexport const mockWindowMatchMedia: Mock = vi.fn().mockImplementation((query: string) => ({\n matches: !/prefers-reduced-motion/.test(query),\n media: query,\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n}));\n\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: mockWindowMatchMedia,\n});\n"],"mappings":";;AAEA,IAAa,uBAA6B,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"matchMedia.js","names":[],"sources":["../../src/__mocks__/matchMedia.ts"],"sourcesContent":["import { vi, type Mock } from 'vitest';\n\nexport const mockWindowMatchMedia: Mock = vi.fn().mockImplementation((query: string) => ({\n matches: !/prefers-reduced-motion/.test(query),\n media: query,\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n}));\n\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: mockWindowMatchMedia,\n});\n"],"mappings":";;AAEA,IAAa,uBAA6B,GAAG,GAAG,CAAC,CAAC,oBAAoB,WAAmB;CACvF,SAAS,CAAC,yBAAyB,KAAK,KAAK;CAC7C,OAAO;CACP,kBAAkB,GAAG,GAAG;CACxB,qBAAqB,GAAG,GAAG;AAC7B,EAAE;AAEF,OAAO,eAAe,QAAQ,cAAc;CAC1C,UAAU;CACV,OAAO;AACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePseudoClasses.js","names":[],"sources":["../../src/__mocks__/usePseudoClasses.ts"],"sourcesContent":["vi.mock('../hooks/usePseudoClasses', () => ({\n usePseudoClasses: vi.fn().mockImplementation(ref => {\n return { refObject: ref || { current: undefined }, isHovered: false, isFocused: false };\n }),\n}));\n\nexport {};\n"],"mappings":";AAAA,GAAG,KAAK,oCAAoC,EAC1C,kBAAkB,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"usePseudoClasses.js","names":[],"sources":["../../src/__mocks__/usePseudoClasses.ts"],"sourcesContent":["vi.mock('../hooks/usePseudoClasses', () => ({\n usePseudoClasses: vi.fn().mockImplementation(ref => {\n return { refObject: ref || { current: undefined }, isHovered: false, isFocused: false };\n }),\n}));\n\nexport {};\n"],"mappings":";AAAA,GAAG,KAAK,oCAAoC,EAC1C,kBAAkB,GAAG,GAAG,CAAC,CAAC,oBAAmB,QAAO;CAClD,OAAO;EAAE,WAAW,OAAO,EAAE,SAAS,KAAA,EAAU;EAAG,WAAW;EAAO,WAAW;CAAM;AACxF,CAAC,EACH,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSize.js","names":[],"sources":["../../src/__mocks__/useSize.ts"],"sourcesContent":["vi.mock('../hooks/useSize', () => ({\n useSize: vi.fn().mockReturnValue({\n height: 100,\n width: 100,\n top: 0,\n left: 0,\n right: 100,\n bottom: 100,\n }),\n}));\n\nexport {};\n"],"mappings":";AAAA,GAAG,KAAK,2BAA2B,EACjC,SAAS,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"useSize.js","names":[],"sources":["../../src/__mocks__/useSize.ts"],"sourcesContent":["vi.mock('../hooks/useSize', () => ({\n useSize: vi.fn().mockReturnValue({\n height: 100,\n width: 100,\n top: 0,\n left: 0,\n right: 100,\n bottom: 100,\n }),\n}));\n\nexport {};\n"],"mappings":";AAAA,GAAG,KAAK,2BAA2B,EACjC,SAAS,GAAG,GAAG,CAAC,CAAC,gBAAgB;CAC/B,QAAQ;CACR,OAAO;CACP,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ;AACV,CAAC,EACH,EAAE"}
|
package/lib/__mocks__/uuid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","names":[],"sources":["../../src/__mocks__/uuid.ts"],"sourcesContent":["import * as uuidUtils from '../utils/uuid';\n\nconst testId = {\n id: 0,\n};\n\n/**\n * Returnerer en unik, forutsigbar id hver gang uuid() kalles\n */\nvi.spyOn(uuidUtils, 'uuid').mockImplementation(() => {\n testId.id++;\n return `testid-${testId.id}`;\n});\n"],"mappings":";;AAEA,IAAM,SAAS,EACb,IAAI,EACN;;;;AAKA,GAAG,MAAM,cAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"uuid.js","names":[],"sources":["../../src/__mocks__/uuid.ts"],"sourcesContent":["import * as uuidUtils from '../utils/uuid';\n\nconst testId = {\n id: 0,\n};\n\n/**\n * Returnerer en unik, forutsigbar id hver gang uuid() kalles\n */\nvi.spyOn(uuidUtils, 'uuid').mockImplementation(() => {\n testId.id++;\n return `testid-${testId.id}`;\n});\n"],"mappings":";;AAEA,IAAM,SAAS,EACb,IAAI,EACN;;;;AAKA,GAAG,MAAM,cAAW,MAAM,CAAC,CAAC,yBAAyB;CACnD,OAAO;CACP,OAAO,UAAU,OAAO;AAC1B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalyticsId, LanguageLocales } from "../../constants.js";
|
|
2
2
|
import { useLanguage } from "../../hooks/useLanguage.js";
|
|
3
|
-
import
|
|
3
|
+
import classNames from "classnames";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import styles from "./styles.module.scss";
|
|
6
6
|
var HN_Designsystem_ArticleTeaser_en_GB_default = {
|
|
@@ -31,16 +31,16 @@ var ArticleTeaser = (props) => {
|
|
|
31
31
|
...resources
|
|
32
32
|
};
|
|
33
33
|
return /* @__PURE__ */ jsxs(WrapperTag, {
|
|
34
|
-
className:
|
|
34
|
+
className: classNames(styles.articleteaser),
|
|
35
35
|
"data-testid": testId,
|
|
36
36
|
"data-analyticsid": AnalyticsId.ArticleTeaser,
|
|
37
37
|
children: [/* @__PURE__ */ jsx("div", {
|
|
38
|
-
className:
|
|
38
|
+
className: classNames(styles["articleteaser__content"], { [styles["articleteaser__content--collapsed"]]: !expanded }),
|
|
39
39
|
style: { maxHeight: expanded ? "none" : props.heightCollapsed },
|
|
40
40
|
children
|
|
41
41
|
}), /* @__PURE__ */ jsx("button", {
|
|
42
42
|
type: "button",
|
|
43
|
-
className:
|
|
43
|
+
className: classNames(styles["articleteaser__button"], { [styles["articleteaser__button--expanded"]]: expanded }),
|
|
44
44
|
onClick: onExpand,
|
|
45
45
|
"aria-expanded": expanded,
|
|
46
46
|
"aria-controls": contentId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/resources/HN.Designsystem.ArticleTeaser.en-GB.json","../../../src/resources/HN.Designsystem.ArticleTeaser.nb-NO.json","../../../src/components/ArticleTeaser/resourceHelper.ts","../../../src/components/ArticleTeaser/ArticleTeaser.tsx","../../../src/components/ArticleTeaser/index.ts"],"sourcesContent":["{\n \"expandButtonClose\": \"Show more\",\n \"expandButtonOpen\": \"Show less\"\n}\n","{\n \"expandButtonClose\": \"Vis mer\",\n \"expandButtonOpen\": \"Vis mindre\"\n}\n","import type { HNDesignsystemArticleTeaser } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.ArticleTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.ArticleTeaser.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemArticleTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport type { HNDesignsystemArticleTeaser } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\n\nimport styles from './styles.module.scss';\n\nexport type ArticleTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface ArticleTeaserProps {\n /** Callback for the button. Should be used for setting the expanded boolean */\n onExpand: () => void;\n /** What's in the box? */\n children: React.ReactNode;\n /** Id of the content, used to set aria-controls */\n contentId: string;\n /** If the component is expanded or not */\n expanded: boolean;\n /** For overriding the height of the collapsed teaser */\n heightCollapsed?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: ArticleTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemArticleTeaser>;\n /** Sets the data-testid attribute */\n testId?: string;\n}\n\nconst ArticleTeaser: React.FC<ArticleTeaserProps> = props => {\n const { onExpand, children, contentId, expanded, htmlMarkup = 'div', resources, testId } = props;\n const WrapperTag = htmlMarkup;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemArticleTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n return (\n <WrapperTag className={classNames(styles.articleteaser)} data-testid={testId} data-analyticsid={AnalyticsId.ArticleTeaser}>\n <div\n className={classNames(styles['articleteaser__content'], {\n [styles['articleteaser__content--collapsed']]: !expanded,\n })}\n style={{\n maxHeight: expanded ? 'none' : props.heightCollapsed,\n }}\n >\n {children}\n </div>\n <button\n type=\"button\"\n className={classNames(styles['articleteaser__button'], {\n [styles['articleteaser__button--expanded']]: expanded,\n })}\n onClick={onExpand}\n aria-expanded={expanded}\n aria-controls={contentId}\n >\n {expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default ArticleTeaser;\n","import ArticleTeaser from './ArticleTeaser';\nexport * from './ArticleTeaser';\nexport default ArticleTeaser;\n"],"mappings":";;;;;;;;;;;;;;;AEMA,IAAa,gBAAgB,aAA2D;CACtF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACiBA,IAAM,iBAA8C,UAAS;CAC3D,MAAM,EAAE,UAAU,UAAU,WAAW,UAAU,aAAa,OAAO,WAAW,WAAW;CAC3F,MAAM,aAAa;CAEnB,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAG3E,MAAM,kBAA+C;EACnD,GAHuB,aAAa,QAGjC;EACH,GAAG;CACL;CAEA,OACE,qBAAC,YAAD;EAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/resources/HN.Designsystem.ArticleTeaser.en-GB.json","../../../src/resources/HN.Designsystem.ArticleTeaser.nb-NO.json","../../../src/components/ArticleTeaser/resourceHelper.ts","../../../src/components/ArticleTeaser/ArticleTeaser.tsx","../../../src/components/ArticleTeaser/index.ts"],"sourcesContent":["{\n \"expandButtonClose\": \"Show more\",\n \"expandButtonOpen\": \"Show less\"\n}\n","{\n \"expandButtonClose\": \"Vis mer\",\n \"expandButtonOpen\": \"Vis mindre\"\n}\n","import type { HNDesignsystemArticleTeaser } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.ArticleTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.ArticleTeaser.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemArticleTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport type { HNDesignsystemArticleTeaser } from '../../resources/Resources';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\n\nimport styles from './styles.module.scss';\n\nexport type ArticleTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface ArticleTeaserProps {\n /** Callback for the button. Should be used for setting the expanded boolean */\n onExpand: () => void;\n /** What's in the box? */\n children: React.ReactNode;\n /** Id of the content, used to set aria-controls */\n contentId: string;\n /** If the component is expanded or not */\n expanded: boolean;\n /** For overriding the height of the collapsed teaser */\n heightCollapsed?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: ArticleTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemArticleTeaser>;\n /** Sets the data-testid attribute */\n testId?: string;\n}\n\nconst ArticleTeaser: React.FC<ArticleTeaserProps> = props => {\n const { onExpand, children, contentId, expanded, htmlMarkup = 'div', resources, testId } = props;\n const WrapperTag = htmlMarkup;\n\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemArticleTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n return (\n <WrapperTag className={classNames(styles.articleteaser)} data-testid={testId} data-analyticsid={AnalyticsId.ArticleTeaser}>\n <div\n className={classNames(styles['articleteaser__content'], {\n [styles['articleteaser__content--collapsed']]: !expanded,\n })}\n style={{\n maxHeight: expanded ? 'none' : props.heightCollapsed,\n }}\n >\n {children}\n </div>\n <button\n type=\"button\"\n className={classNames(styles['articleteaser__button'], {\n [styles['articleteaser__button--expanded']]: expanded,\n })}\n onClick={onExpand}\n aria-expanded={expanded}\n aria-controls={contentId}\n >\n {expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default ArticleTeaser;\n","import ArticleTeaser from './ArticleTeaser';\nexport * from './ArticleTeaser';\nexport default ArticleTeaser;\n"],"mappings":";;;;;;;;;;;;;;;AEMA,IAAa,gBAAgB,aAA2D;CACtF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACiBA,IAAM,iBAA8C,UAAS;CAC3D,MAAM,EAAE,UAAU,UAAU,WAAW,UAAU,aAAa,OAAO,WAAW,WAAW;CAC3F,MAAM,aAAa;CAEnB,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAG3E,MAAM,kBAA+C;EACnD,GAHuB,aAAa,QAGjC;EACH,GAAG;CACL;CAEA,OACE,qBAAC,YAAD;EAAY,WAAW,WAAW,OAAO,aAAa;EAAG,eAAa;EAAQ,oBAAkB,YAAY;YAA5G,CACE,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,2BAA2B,GACrD,OAAO,uCAAuC,CAAC,SAClD,CAAC;GACD,OAAO,EACL,WAAW,WAAW,SAAS,MAAM,gBACvC;GAEC;EACE,CAAA,GACL,oBAAC,UAAD;GACE,MAAK;GACL,WAAW,WAAW,OAAO,0BAA0B,GACpD,OAAO,qCAAqC,SAC/C,CAAC;GACD,SAAS;GACT,iBAAe;GACf,iBAAe;aAEd,WAAW,gBAAgB,mBAAmB,gBAAgB;EACzD,CAAA,CACE;;AAEhB;;;AClEA,IAAA,wBAAe"}
|
|
@@ -18,8 +18,10 @@ export interface InnerDrawerProps {
|
|
|
18
18
|
desktopDirection?: DesktopDirections;
|
|
19
19
|
/** Sets the style of the Drawer header */
|
|
20
20
|
headerClasses?: string;
|
|
21
|
+
/** Optional content that replaces the default title (and back button) in the header. The close button is still rendered. */
|
|
22
|
+
headerContent?: React.ReactNode;
|
|
21
23
|
/** Title to display in the header of the drawer */
|
|
22
|
-
title
|
|
24
|
+
title?: string;
|
|
23
25
|
/** id of the drawer title */
|
|
24
26
|
titleId?: string;
|
|
25
27
|
/** Changes the underlying element of the title. Default: h3 */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TitleTags } from '../Title';
|
|
3
|
+
export interface DrawerHeaderContentProps {
|
|
4
|
+
/** Title shown in the header */
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
/** id of the title element */
|
|
7
|
+
titleId?: string;
|
|
8
|
+
/** Ref passed to the title heading element */
|
|
9
|
+
titleRef?: React.Ref<HTMLHeadingElement | null>;
|
|
10
|
+
/** Changes the underlying element of the title. Default: h3 */
|
|
11
|
+
titleHtmlMarkup?: TitleTags;
|
|
12
|
+
/** Shows a back button before the title. When present the title is centered. */
|
|
13
|
+
withBackButton?: boolean;
|
|
14
|
+
/** Callback for the back button */
|
|
15
|
+
onRequestBack?: () => void;
|
|
16
|
+
/** Sets the aria-label of the back button */
|
|
17
|
+
backButtonAriaLabel?: string;
|
|
18
|
+
/** Adds custom classes to the root element. */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const DrawerHeaderContent: React.FC<DrawerHeaderContentProps>;
|
|
22
|
+
export default DrawerHeaderContent;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@use '../../scss/breakpoints' as breakpoints;
|
|
2
|
+
|
|
3
|
+
.header-content {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex: 1;
|
|
7
|
+
align-items: center;
|
|
8
|
+
min-width: 0;
|
|
9
|
+
min-height: 100%;
|
|
10
|
+
|
|
11
|
+
@include breakpoints.tiny-screens-media-query {
|
|
12
|
+
flex-direction: column-reverse;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__title {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-self: flex-start;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
margin-top: 0.5rem;
|
|
22
|
+
|
|
23
|
+
&--centered {
|
|
24
|
+
position: relative;
|
|
25
|
+
inset: 0;
|
|
26
|
+
align-items: flex-start;
|
|
27
|
+
margin: 0.5rem auto 0;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
|
|
30
|
+
@include breakpoints.tiny-screens-media-query {
|
|
31
|
+
position: static;
|
|
32
|
+
inset: auto;
|
|
33
|
+
justify-content: flex-start;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:focus,
|
|
38
|
+
:focus-visible {
|
|
39
|
+
outline: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__back-button {
|
|
44
|
+
// Moves the button visually to the left but keeps it in the DOM order for screen readers and keyboard navigation
|
|
45
|
+
order: -1;
|
|
46
|
+
|
|
47
|
+
@include breakpoints.tiny-screens-media-query {
|
|
48
|
+
order: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'header-content': string;
|
|
3
|
+
'header-content__back-button': string;
|
|
4
|
+
'header-content__title': string;
|
|
5
|
+
'header-content__title--centered': string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ClassNames = keyof Styles;
|
|
9
|
+
|
|
10
|
+
declare const styles: Styles;
|
|
11
|
+
|
|
12
|
+
export default styles;
|
|
@@ -90,23 +90,9 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
&__title {
|
|
94
|
-
margin-top: 0.5rem !important;
|
|
95
|
-
|
|
96
|
-
&:focus,
|
|
97
|
-
&:focus-visible {
|
|
98
|
-
outline: none;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
93
|
&__close-button {
|
|
103
94
|
align-self: flex-start;
|
|
104
95
|
}
|
|
105
|
-
|
|
106
|
-
&__back-button {
|
|
107
|
-
// Moves the button visually to the left but keeps it in the DOM order for screen readers and keyboard navigation
|
|
108
|
-
order: -1;
|
|
109
|
-
}
|
|
110
96
|
}
|
|
111
97
|
|
|
112
98
|
&__content {
|
|
@@ -13,9 +13,7 @@ export type Styles = {
|
|
|
13
13
|
drawer__footer: string;
|
|
14
14
|
'drawer__footer--padding-extra': string;
|
|
15
15
|
drawer__header: string;
|
|
16
|
-
'drawer__header__back-button': string;
|
|
17
16
|
'drawer__header__close-button': string;
|
|
18
|
-
drawer__header__title: string;
|
|
19
17
|
'drawer__header--padding-extra': string;
|
|
20
18
|
drawer__overlay: string;
|
|
21
19
|
};
|
|
@@ -18,7 +18,7 @@ import ChevronDown from "../Icons/ChevronDown.js";
|
|
|
18
18
|
import ChevronUp from "../Icons/ChevronUp.js";
|
|
19
19
|
import PlusSmall from "../Icons/PlusSmall.js";
|
|
20
20
|
import Label_default from "../Label/index.js";
|
|
21
|
-
import
|
|
21
|
+
import classNames from "classnames";
|
|
22
22
|
import React, { useEffect, useId, useRef } from "react";
|
|
23
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { clamp } from "motion/react";
|
|
@@ -86,14 +86,14 @@ var DropdownBase = (props) => {
|
|
|
86
86
|
...getResources(language),
|
|
87
87
|
...resources
|
|
88
88
|
};
|
|
89
|
-
const toggleClasses =
|
|
89
|
+
const toggleClasses = classNames(styles.dropdown__toggle, {
|
|
90
90
|
[styles["dropdown__toggle--open"]]: isOpen && !disabled,
|
|
91
91
|
[styles["dropdown__toggle--with-icon"]]: typeof svgIcon !== "undefined",
|
|
92
92
|
[styles["dropdown__toggle--transparent"]]: variant === "transparent",
|
|
93
93
|
[styles["dropdown__toggle--borderless"]]: variant === "borderless"
|
|
94
94
|
});
|
|
95
|
-
const contentClasses =
|
|
96
|
-
const listItemClasses =
|
|
95
|
+
const contentClasses = classNames(styles.dropdown__content, isOpen && styles["dropdown__content--open"]);
|
|
96
|
+
const listItemClasses = classNames(styles["dropdown__list-item"], { [styles["dropdown__list-item--single-select"]]: isSingleSelect });
|
|
97
97
|
const { refs, floatingStyles } = useFloating({
|
|
98
98
|
strategy: "fixed",
|
|
99
99
|
placement: "bottom-start",
|
|
@@ -190,7 +190,7 @@ var DropdownBase = (props) => {
|
|
|
190
190
|
const label = element.props.label;
|
|
191
191
|
if (React.isValidElement(label) && isComponent(label, Label_default)) return React.cloneElement(element, {
|
|
192
192
|
ref: mergeRefs([element.props.ref, childrenRefList.current[index]]),
|
|
193
|
-
label: React.cloneElement(label, { labelClassName:
|
|
193
|
+
label: React.cloneElement(label, { labelClassName: classNames(label.props?.labelClassName, styles["dropdown__multiselect-item"]) })
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
return React.cloneElement(child, { ref: mergeRefs([element.props.ref, childrenRefList.current[index]]) });
|