@helsenorge/designsystem-react 11.2.0-beta.0 → 11.2.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.
Files changed (137) hide show
  1. package/Button.js +6 -8
  2. package/Button.js.map +1 -1
  3. package/CHANGELOG.md +64 -16
  4. package/Close.js +21 -6
  5. package/Close.js.map +1 -1
  6. package/Drawer.js +362 -0
  7. package/Drawer.js.map +1 -0
  8. package/HelpBubble.js +78 -0
  9. package/HelpBubble.js.map +1 -0
  10. package/InfoTeaser.js +75 -0
  11. package/InfoTeaser.js.map +1 -0
  12. package/LazyIcon.js +1 -1
  13. package/LazyIcon.js.map +1 -1
  14. package/LazyIllustration.js +1 -1
  15. package/LazyIllustration.js.map +1 -1
  16. package/Panel.js +38 -5
  17. package/Panel.js.map +1 -1
  18. package/PopOver.js +141 -3589
  19. package/PopOver.js.map +1 -1
  20. package/components/ArticleTeaser/ArticleTeaser.d.ts +23 -0
  21. package/components/ArticleTeaser/ArticleTeaser.test.d.ts +1 -0
  22. package/components/ArticleTeaser/index.d.ts +3 -0
  23. package/components/ArticleTeaser/index.js +67 -0
  24. package/components/ArticleTeaser/index.js.map +1 -0
  25. package/components/ArticleTeaser/resourceHelper.d.ts +3 -0
  26. package/components/ArticleTeaser/styles.module.scss +79 -0
  27. package/components/ArticleTeaser/styles.module.scss.d.ts +13 -0
  28. package/components/Close/Close.d.ts +1 -1
  29. package/components/Close/styles.module.scss +46 -20
  30. package/components/Close/styles.module.scss.d.ts +2 -0
  31. package/components/Drawer/Drawer.d.ts +6 -0
  32. package/components/Drawer/index.js +1 -348
  33. package/components/Drawer/index.js.map +1 -1
  34. package/components/Drawer/styles.module.scss +4 -0
  35. package/components/Drawer/styles.module.scss.d.ts +1 -0
  36. package/components/Dropdown/index.js +1 -3
  37. package/components/Dropdown/index.js.map +1 -1
  38. package/components/HelpBubble/HelpBubble.d.ts +9 -7
  39. package/components/HelpBubble/index.js +3 -47
  40. package/components/HelpBubble/index.js.map +1 -1
  41. package/components/HelpBubble/styles.module.scss +7 -5
  42. package/components/HelpBubble/styles.module.scss.d.ts +1 -0
  43. package/components/HelpDrawer/HelpDrawer.d.ts +8 -0
  44. package/components/HelpDrawer/HelpDrawer.test.d.ts +1 -0
  45. package/components/HelpDrawer/index.d.ts +3 -0
  46. package/components/HelpDrawer/index.js +10 -0
  47. package/components/HelpDrawer/index.js.map +1 -0
  48. package/components/HelpDrawer/styles.module.scss +16 -0
  49. package/components/HelpDrawer/styles.module.scss.d.ts +10 -0
  50. package/components/HelpPanel/styles.module.scss +2 -3
  51. package/components/HelpTeaser/HelpTeaser.d.ts +20 -0
  52. package/components/HelpTeaser/HelpTeaser.test.d.ts +1 -0
  53. package/components/HelpTeaser/index.d.ts +3 -0
  54. package/components/HelpTeaser/index.js +25 -0
  55. package/components/HelpTeaser/index.js.map +1 -0
  56. package/components/HelpTeaser/styles.module.scss +22 -0
  57. package/components/HelpTeaser/styles.module.scss.d.ts +10 -0
  58. package/components/HelpTooltip/index.js +2 -2
  59. package/components/HelpTooltip/index.js.map +1 -1
  60. package/components/HighlightPanel/styles.module.scss +0 -1
  61. package/components/Icons/AdditionalIconInformation.d.ts +1 -1
  62. package/components/Icons/AdditionalIconInformation.js +1 -1
  63. package/components/Icons/AdditionalIconInformation.js.map +1 -1
  64. package/components/Icons/IconNames.d.ts +1 -1
  65. package/components/Icons/IconNames.js +1 -0
  66. package/components/Icons/IconNames.js.map +1 -1
  67. package/components/Icons/Toddler.d.ts +4 -0
  68. package/components/Icons/Toddler.js +10 -0
  69. package/components/Icons/Toddler.js.map +1 -0
  70. package/components/Illustrations/BabyMobile.d.ts +8 -0
  71. package/components/Illustrations/BabyMobile.js +11 -0
  72. package/components/Illustrations/BabyMobile.js.map +1 -0
  73. package/components/Illustrations/BabyMobileMedium.d.ts +4 -0
  74. package/components/Illustrations/BabyMobileMedium.js +424 -0
  75. package/components/Illustrations/BabyMobileMedium.js.map +1 -0
  76. package/components/Illustrations/Child.d.ts +12 -0
  77. package/components/Illustrations/Child.js +11 -0
  78. package/components/Illustrations/Child.js.map +1 -0
  79. package/components/Illustrations/ChildMedium.d.ts +4 -0
  80. package/components/Illustrations/ChildMedium.js +185 -0
  81. package/components/Illustrations/ChildMedium.js.map +1 -0
  82. package/components/Illustrations/GiveBabyFood.d.ts +11 -0
  83. package/components/Illustrations/GiveBabyFood.js +11 -0
  84. package/components/Illustrations/GiveBabyFood.js.map +1 -0
  85. package/components/Illustrations/GiveBabyFoodMedium.d.ts +4 -0
  86. package/components/Illustrations/GiveBabyFoodMedium.js +377 -0
  87. package/components/Illustrations/GiveBabyFoodMedium.js.map +1 -0
  88. package/components/Illustrations/IllustrationNames.d.ts +1 -1
  89. package/components/Illustrations/IllustrationNames.js +15 -1
  90. package/components/Illustrations/IllustrationNames.js.map +1 -1
  91. package/components/Illustrations/Stroller.d.ts +12 -0
  92. package/components/Illustrations/Stroller.js +11 -0
  93. package/components/Illustrations/Stroller.js.map +1 -0
  94. package/components/Illustrations/StrollerMedium.d.ts +4 -0
  95. package/components/Illustrations/StrollerMedium.js +236 -0
  96. package/components/Illustrations/StrollerMedium.js.map +1 -0
  97. package/components/InfoTeaser/InfoTeaser.d.ts +28 -0
  98. package/components/InfoTeaser/InfoTeaser.test.d.ts +1 -0
  99. package/components/InfoTeaser/index.d.ts +3 -0
  100. package/components/InfoTeaser/index.js +5 -0
  101. package/components/InfoTeaser/index.js.map +1 -0
  102. package/components/InfoTeaser/resourceHelper.d.ts +3 -0
  103. package/components/InfoTeaser/styles.module.scss +98 -0
  104. package/components/InfoTeaser/styles.module.scss.d.ts +15 -0
  105. package/components/Panel/Panel.d.ts +3 -0
  106. package/components/Panel/resourceHelper.d.ts +3 -0
  107. package/components/Panel/styles.module.scss +6 -6
  108. package/components/PopMenu/index.js +24 -15
  109. package/components/PopMenu/index.js.map +1 -1
  110. package/components/PopMenu/styles.module.scss +10 -9
  111. package/components/PopMenu/styles.module.scss.d.ts +1 -0
  112. package/components/PopOver/PopOver.d.ts +5 -9
  113. package/components/PopOver/index.js +3 -3
  114. package/components/PopOver/styles.module.scss +53 -11
  115. package/components/PopOver/styles.module.scss.d.ts +5 -0
  116. package/constants.d.ts +2 -0
  117. package/constants.js +2 -0
  118. package/constants.js.map +1 -1
  119. package/designsystem-react.css +3 -1
  120. package/hooks/useBreakpoint.js +10 -28
  121. package/hooks/useBreakpoint.js.map +1 -1
  122. package/hooks/useIsMobileBreakpoint.d.ts +1 -0
  123. package/hooks/useIsMobileBreakpoint.js +10 -0
  124. package/hooks/useIsMobileBreakpoint.js.map +1 -0
  125. package/package.json +1 -1
  126. package/resources/HN.Designsystem.ArticleTeaser.en-GB.json.d.ts +7 -0
  127. package/resources/HN.Designsystem.ArticleTeaser.nb-NO.json.d.ts +7 -0
  128. package/resources/HN.Designsystem.Dropdown.nb-NO.json.d.ts +1 -2
  129. package/resources/HN.Designsystem.InfoTeaser.en-GB.json.d.ts +7 -0
  130. package/resources/HN.Designsystem.InfoTeaser.nb-NO.json.d.ts +7 -0
  131. package/resources/HN.Designsystem.Panel.en-GB.json.d.ts +7 -0
  132. package/resources/HN.Designsystem.Panel.nb-NO.json.d.ts +7 -0
  133. package/scss/_font-mixins.scss +0 -22
  134. package/scss/supernova/styles/colors.css +3 -1
  135. package/scss/typography.module.scss +0 -8
  136. package/scss/typography.module.scss.d.ts +0 -2
  137. package/scss/typography.stories.tsx +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/PopMenu/PopMenu.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { getColor } from '../../theme/currys';\nimport { breakpoints } from '../../theme/grid';\nimport { isComponent } from '../../utils/component';\nimport Icon, { SvgIcon } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport VerticalDots from '../Icons/VerticalDots';\nimport X from '../Icons/X';\nimport LazyIcon from '../LazyIcon';\nimport LinkList, { LinkListProps, LinkProps } from '../LinkList';\nimport PopOver from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport enum PopMenuVariant {\n onWhite = 'on-white',\n onGray = 'on-gray',\n onBlueberry = 'on-blueberry',\n}\n\nexport enum PopMenuLabelPosition {\n right = 'right',\n left = 'left',\n}\n\nexport interface PopMenuProps {\n /** Content shown inside PopOver. Can only be a LinkList */\n children: React.ReactElement<LinkListProps>;\n /** Adds custom classes to the popover element. */\n popOverClassName?: string;\n /** Adds custom classes to the element. */\n popMenuClassName?: string;\n /** Changes responsive design for the trigger buttons. */\n popMenuVariant?: PopMenuVariant;\n /** Sets the data-testid attribute for the button that opens. */\n openButtonTestId?: string;\n /** Sets the data-testid attribute for the button that closes. */\n closeButtonTestId?: string;\n /** Sets the data-testid attribute for the popover. */\n popOverTestId?: string;\n /** Sets the arial-label attribute for the openButton. */\n openButtonAriaLabel?: string;\n /** Sets the arial-label attribute for the closeButton. */\n closeButtonAriaLabel?: string;\n /** Sets the icon on the trigger button. */\n svgIcon?: SvgIcon | IconName;\n /** Optional text next to the trigger button. */\n labelText?: string;\n /** Placement of the label text relative to the trigger button. */\n labelTextPosition?: PopMenuLabelPosition;\n}\n\nexport const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {\n const triggerButtonRef = useRef<HTMLButtonElement>(null);\n const iconRef = useRef<HTMLDivElement>(null);\n const outerRef = useRef<HTMLDivElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const {\n children,\n popOverClassName,\n popMenuClassName,\n openButtonTestId,\n closeButtonTestId,\n popOverTestId,\n popMenuVariant = PopMenuVariant.onWhite,\n openButtonAriaLabel,\n closeButtonAriaLabel,\n svgIcon,\n labelText,\n labelTextPosition = PopMenuLabelPosition.right,\n } = props;\n const buttonClasses = classNames(styles['pop-menu-button'], {\n [styles[`pop-menu-button--${popMenuVariant}`]]: popMenuVariant,\n });\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n\n useOutsideEvent(outerRef, () => {\n setIsOpen(false);\n });\n\n const { isHovered: triggerButtonIsHovered } = useHover(triggerButtonRef);\n const mobileIconSize = mobile ? IconSize.XSmall : IconSize.Small;\n\n const handleClick = (cb?: () => void): void => {\n setIsOpen(false);\n cb && cb();\n };\n\n const renderChildren = (): React.ReactElement | undefined => {\n if (isComponent<LinkListProps>(children, LinkList)) {\n return (\n <PopOver testId={popOverTestId} className={classNames(styles['pop-menu__pop-over'], popOverClassName)} controllerRef={iconRef}>\n {React.Children.map(children, child =>\n React.cloneElement(child, {\n children: React.Children.map(child.props.children, child =>\n isComponent<LinkProps>(child, LinkList.Link)\n ? React.cloneElement(child, {\n onClick: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) =>\n handleClick(() => child.props.onClick && child.props.onClick(event)),\n })\n : child\n ),\n })\n )}\n </PopOver>\n );\n }\n };\n\n const toggleOpenOnClick = (e?: React.MouseEvent<HTMLElement, MouseEvent>): void => {\n e && e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const iconComponent =\n svgIcon && typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n ) : (\n svgIcon && <Icon svgIcon={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n );\n\n const openIcon = svgIcon ? (\n iconComponent\n ) : (\n <Icon svgIcon={svgIcon ?? VerticalDots} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />\n );\n\n const closeIcon = <Icon svgIcon={X} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />;\n\n const triggerButton = (\n <button\n ref={triggerButtonRef}\n data-testid={isOpen ? closeButtonTestId : openButtonTestId}\n className={buttonClasses}\n aria-label={isOpen ? closeButtonAriaLabel : openButtonAriaLabel}\n aria-expanded={isOpen}\n onClick={toggleOpenOnClick}\n type=\"button\"\n >\n {labelText && labelTextPosition == PopMenuLabelPosition.left && <span>{labelText}</span>}\n {<div ref={iconRef}>{isOpen ? closeIcon : openIcon}</div>}\n {labelText && labelTextPosition == PopMenuLabelPosition.right && <span>{labelText}</span>}\n </button>\n );\n\n return (\n <div ref={outerRef} className={classNames(styles['pop-menu-button'], popMenuClassName)} data-analyticsid={AnalyticsId.PopMenu}>\n {triggerButton}\n {isOpen && renderChildren()}\n </div>\n );\n};\n\nexport default PopMenu;\n"],"names":["PopMenuVariant","PopMenuLabelPosition","React","child"],"mappings":";;;;;;;;;;;;;;;;;AAqBY,IAAA,mCAAAA,oBAAL;AACLA,kBAAA,SAAU,IAAA;AACVA,kBAAA,QAAS,IAAA;AACTA,kBAAA,aAAc,IAAA;AAHJA,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAMA,IAAA,yCAAAC,0BAAL;AACLA,wBAAA,OAAQ,IAAA;AACRA,wBAAA,MAAO,IAAA;AAFGA,SAAAA;AAAA,GAAA,wBAAA,CAAA,CAAA;AAgCC,MAAA,UAAkC,CAAC,UAAwB;AAChE,QAAA,mBAAmB,OAA0B,IAAI;AACjD,QAAA,UAAU,OAAuB,IAAI;AACrC,QAAA,WAAW,OAAuB,IAAI;AAC5C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AACpC,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA;AAAA,EAAA,IAClB;AACJ,QAAM,gBAAgB,WAAW,OAAO,iBAAiB,GAAG;AAAA,IAC1D,CAAC,OAAO,oBAAoB,cAAc,EAAE,CAAC,GAAG;AAAA,EAAA,CACjD;AACD,QAAM,aAAa,cAAc;AAC3B,QAAA,SAAS,aAAa,YAAY;AAExC,kBA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AAG,OAAO,SAAS,OAAO,GAAG,MAAM,gBAAgB,WAAW,uBAAwB,CAAA;AAEvH,QAAM,gBACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAa,SAAS,oBAAoB;AAAA,MAC1C,WAAW;AAAA,MACX,cAAY,SAAS,uBAAuB;AAAA,MAC5C,iBAAe;AAAA,MACf,SAAS;AAAA,MACT,MAAK;AAAA,MAEJ,UAAA;AAAA,QAAA,aAAa,qBAAqB,UAA8B,oBAAA,QAAA,EAAM,UAAU,WAAA;AAAA,4BAC/E,OAAI,EAAA,KAAK,SAAU,UAAA,SAAS,YAAY,UAAS;AAAA,QAClD,aAAa,qBAAqB,WAA8B,oBAAC,UAAM,UAAU,UAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpF;AAGF,SACG,qBAAA,OAAA,EAAI,KAAK,UAAU,WAAW,WAAW,OAAO,iBAAiB,GAAG,gBAAgB,GAAG,oBAAkB,YAAY,SACnH,UAAA;AAAA,IAAA;AAAA,IACA,UAAU,eAAe;AAAA,EAAA,GAC5B;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/PopMenu/PopMenu.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { getColor } from '../../theme/currys';\nimport { isComponent } from '../../utils/component';\nimport Icon, { SvgIcon } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport VerticalDots from '../Icons/VerticalDots';\nimport X from '../Icons/X';\nimport LazyIcon from '../LazyIcon';\nimport LinkList, { LinkListProps, LinkProps } from '../LinkList';\nimport PopOver from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport enum PopMenuVariant {\n onWhite = 'on-white',\n onGray = 'on-gray',\n onBlueberry = 'on-blueberry',\n}\n\nexport enum PopMenuLabelPosition {\n right = 'right',\n left = 'left',\n}\n\nexport interface PopMenuProps {\n /** Content shown inside PopOver. Can only be a LinkList */\n children: React.ReactElement<LinkListProps>;\n /** Adds custom classes to the popover element. */\n popOverClassName?: string;\n /** Adds custom classes to the element. */\n popMenuClassName?: string;\n /** Changes responsive design for the trigger buttons. */\n popMenuVariant?: PopMenuVariant;\n /** Sets the data-testid attribute for the button that opens. */\n openButtonTestId?: string;\n /** Sets the data-testid attribute for the button that closes. */\n closeButtonTestId?: string;\n /** Sets the data-testid attribute for the popover. */\n popOverTestId?: string;\n /** Sets the arial-label attribute for the openButton. */\n openButtonAriaLabel?: string;\n /** Sets the arial-label attribute for the closeButton. */\n closeButtonAriaLabel?: string;\n /** Sets the icon on the trigger button. */\n svgIcon?: SvgIcon | IconName;\n /** Optional text next to the trigger button. */\n labelText?: string;\n /** Placement of the label text relative to the trigger button. */\n labelTextPosition?: PopMenuLabelPosition;\n}\n\nexport const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {\n const triggerButtonRef = useRef<HTMLButtonElement>(null);\n const iconRef = useRef<HTMLDivElement>(null);\n const popOverRef = useRef<HTMLDivElement>(null);\n const outerRef = useRef<HTMLDivElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const {\n children,\n popOverClassName,\n popMenuClassName,\n openButtonTestId,\n closeButtonTestId,\n popOverTestId,\n popMenuVariant = PopMenuVariant.onWhite,\n openButtonAriaLabel,\n closeButtonAriaLabel,\n svgIcon,\n labelText,\n labelTextPosition = PopMenuLabelPosition.right,\n } = props;\n const buttonClasses = classNames(styles['pop-menu-button'], {\n [styles[`pop-menu-button--${popMenuVariant}`]]: popMenuVariant,\n });\n const isMobile = useIsMobileBreakpoint();\n\n useOutsideEvent(outerRef, () => {\n setIsOpen(false);\n });\n\n const { isHovered: triggerButtonIsHovered } = useHover(triggerButtonRef);\n const mobileIconSize = isMobile ? IconSize.XSmall : IconSize.Small;\n\n const handleClick = (cb?: () => void): void => {\n setIsOpen(false);\n cb && cb();\n };\n\n const renderChildren = (): React.ReactElement | undefined => {\n if (isComponent<LinkListProps>(children, LinkList)) {\n return (\n <PopOver\n testId={popOverTestId}\n className={classNames(styles['pop-menu__pop-over'], popOverClassName)}\n arrowClassName={styles['pop-menu__pop-over-arrow']}\n controllerRef={iconRef}\n popOverRef={popOverRef}\n >\n {React.Children.map(children, child =>\n React.cloneElement(child, {\n children: React.Children.map(child.props.children, child =>\n isComponent<LinkProps>(child, LinkList.Link)\n ? React.cloneElement(child, {\n onClick: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) =>\n handleClick(() => child.props.onClick && child.props.onClick(event)),\n })\n : child\n ),\n })\n )}\n </PopOver>\n );\n }\n };\n\n const toggleOpenOnClick = (e?: React.MouseEvent<HTMLElement, MouseEvent>): void => {\n e && e.stopPropagation();\n setIsOpen(!isOpen);\n };\n\n const iconComponent =\n svgIcon && typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n ) : (\n svgIcon && <Icon svgIcon={svgIcon} size={IconSize.XSmall} isHovered={triggerButtonIsHovered} />\n );\n\n const openIcon = svgIcon ? (\n iconComponent\n ) : (\n <Icon svgIcon={svgIcon ?? VerticalDots} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />\n );\n\n const closeIcon = <Icon svgIcon={X} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />;\n\n const triggerButton = (\n <button\n ref={triggerButtonRef}\n data-testid={isOpen ? closeButtonTestId : openButtonTestId}\n className={buttonClasses}\n aria-label={isOpen ? closeButtonAriaLabel : openButtonAriaLabel}\n aria-expanded={isOpen}\n onClick={toggleOpenOnClick}\n type=\"button\"\n >\n {labelText && labelTextPosition == PopMenuLabelPosition.left && <span>{labelText}</span>}\n {<div ref={iconRef}>{isOpen ? closeIcon : openIcon}</div>}\n {labelText && labelTextPosition == PopMenuLabelPosition.right && <span>{labelText}</span>}\n </button>\n );\n\n return (\n <div ref={outerRef} className={classNames(styles['pop-menu-button'], popMenuClassName)} data-analyticsid={AnalyticsId.PopMenu}>\n {triggerButton}\n {isOpen && renderChildren()}\n </div>\n );\n};\n\nexport default PopMenu;\n"],"names":["PopMenuVariant","PopMenuLabelPosition","React","child"],"mappings":";;;;;;;;;;;;;;;;AAoBY,IAAA,mCAAAA,oBAAL;AACLA,kBAAA,SAAU,IAAA;AACVA,kBAAA,QAAS,IAAA;AACTA,kBAAA,aAAc,IAAA;AAHJA,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAMA,IAAA,yCAAAC,0BAAL;AACLA,wBAAA,OAAQ,IAAA;AACRA,wBAAA,MAAO,IAAA;AAFGA,SAAAA;AAAA,GAAA,wBAAA,CAAA,CAAA;AAgCC,MAAA,UAAkC,CAAC,UAAwB;AAChE,QAAA,mBAAmB,OAA0B,IAAI;AACjD,QAAA,UAAU,OAAuB,IAAI;AACrC,QAAA,aAAa,OAAuB,IAAI;AACxC,QAAA,WAAW,OAAuB,IAAI;AAC5C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AACpC,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA;AAAA,EAAA,IAClB;AACJ,QAAM,gBAAgB,WAAW,OAAO,iBAAiB,GAAG;AAAA,IAC1D,CAAC,OAAO,oBAAoB,cAAc,EAAE,CAAC,GAAG;AAAA,EAAA,CACjD;AACD,QAAM,WAAW,sBAAsB;AAEvC,kBAAgB,UAAU,MAAM;AAC9B,cAAU,KAAK;AAAA,EAAA,CAChB;AAED,QAAM,EAAE,WAAW,2BAA2B,SAAS,gBAAgB;AACvE,QAAM,iBAAiB,WAAW,SAAS,SAAS,SAAS;AA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AW,uBAAwB,CAAA;AAEvH,QAAM,gBACJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAa,SAAS,oBAAoB;AAAA,MAC1C,WAAW;AAAA,MACX,cAAY,SAAS,uBAAuB;AAAA,MAC5C,iBAAe;AAAA,MACf,SAAS;AAAA,MACT,MAAK;AAAA,MAEJ,UAAA;AAAA,QAAA,aAAa,qBAAqB,UAA8B,oBAAA,QAAA,EAAM,UAAU,WAAA;AAAA,4BAC/E,OAAI,EAAA,KAAK,SAAU,UAAA,SAAS,YAAY,UAAS;AAAA,QAClD,aAAa,qBAAqB,WAA8B,oBAAC,UAAM,UAAU,UAAA,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpF;AAGF,SACG,qBAAA,OAAA,EAAI,KAAK,UAAU,WAAW,WAAW,OAAO,iBAAiB,GAAG,gBAAgB,GAAG,oBAAkB,YAAY,SACnH,UAAA;AAAA,IAAA;AAAA,IACA,UAAU,eAAe;AAAA,EAAA,GAC5B;AAEJ;"}
@@ -108,14 +108,11 @@ html :focus > .pop-menu-button {
108
108
 
109
109
  .pop-menu__pop-over {
110
110
  width: 20.875rem;
111
+ border: 0.125rem solid rgb(24 128 151);
112
+ box-shadow: 0 0 0.3125rem 0 rgb(0 0 0 / 50%);
111
113
 
112
114
  @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
113
115
  width: 26.125rem;
114
- max-width: 27rem;
115
- }
116
-
117
- ul {
118
- width: calc(100% - 0.5px);
119
116
  }
120
117
 
121
118
  li:first-of-type {
@@ -123,8 +120,8 @@ html :focus > .pop-menu-button {
123
120
 
124
121
  a,
125
122
  button {
126
- border-top-left-radius: 4px;
127
- border-top-right-radius: 4px;
123
+ border-top-left-radius: 0.5625rem;
124
+ border-top-right-radius: 0.5625rem;
128
125
  }
129
126
  }
130
127
 
@@ -133,8 +130,12 @@ html :focus > .pop-menu-button {
133
130
 
134
131
  a,
135
132
  button {
136
- border-bottom-left-radius: 4px;
137
- border-bottom-right-radius: 4px;
133
+ border-bottom-left-radius: 0.5625rem;
134
+ border-bottom-right-radius: 0.5625rem;
138
135
  }
139
136
  }
140
137
  }
138
+
139
+ .pop-menu__pop-over-arrow {
140
+ --drop-shadow-color: rgb(24 128 151);
141
+ }
@@ -1,5 +1,6 @@
1
1
  export type Styles = {
2
2
  'pop-menu__pop-over': string;
3
+ 'pop-menu__pop-over-arrow': string;
3
4
  'pop-menu-button': string;
4
5
  'pop-menu-button--on-blueberry': string;
5
6
  'pop-menu-button--on-gray': string;
@@ -1,31 +1,27 @@
1
1
  import { default as React } from 'react';
2
- import { Placement } from '@floating-ui/react';
3
2
  export declare enum PopOverVariant {
4
3
  positionautomatic = "positionautomatic",
5
4
  positionbelow = "positionbelow",
6
5
  positionabove = "positionabove"
7
6
  }
8
- export type PopOverRole = 'dialog' | 'tooltip';
9
- export type PopOverPlacement = Placement;
7
+ export type PopOverRole = 'tooltip';
10
8
  export interface PopOverProps {
11
9
  /** Id of the PopOver */
12
10
  id?: string;
13
- /** Content shown inside PopOver. */
11
+ /** Content shown inside PopOver. Note that if role="tooltip", you must not include interactive/focusable elements. */
14
12
  children: React.ReactNode;
15
13
  /** Ref for the element the PopOver is placed upon */
16
14
  controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;
17
15
  /** Ref for the element the PopOver is placed upon */
18
16
  popOverRef?: React.RefObject<HTMLDivElement>;
19
- /** @deprecated Show the popover. Only applies when role=tooltip. Default: false. */
17
+ /** Show the popover. Only applies when role=tooltip. Default: false. */
20
18
  show?: boolean;
21
19
  /** Adds custom classes to the element. */
22
20
  className?: string;
23
- /** @deprecated Adds custom classes to the arrow element. */
21
+ /** Adds custom classes to the arrow element. */
24
22
  arrowClassName?: string;
25
- /** @deprecated Determines the placement of the popover. Default: automatic positioning. */
23
+ /** Determines the placement of the popover. Default: automatic positioning. */
26
24
  variant?: keyof typeof PopOverVariant;
27
- /** Sets the placement of the popover relative to the trigger. */
28
- placement?: PopOverPlacement;
29
25
  /** Sets role of the PopOver element */
30
26
  role?: PopOverRole;
31
27
  /** Sets the data-testid attribute. */
@@ -1,7 +1,7 @@
1
- import { P as PopOver } from "../../PopOver.js";
2
- import { a } from "../../PopOver.js";
1
+ import { a as PopOver } from "../../PopOver.js";
2
+ import { P } from "../../PopOver.js";
3
3
  export {
4
- a as PopOverVariant,
4
+ P as PopOverVariant,
5
5
  PopOver as default
6
6
  };
7
7
  //# sourceMappingURL=index.js.map
@@ -1,21 +1,63 @@
1
1
  @use 'sass:map';
2
2
  @use '../../scss/spacers' as spacers;
3
- @use '../../scss/font-mixins' as fonts;
4
- @import '../../scss/supernova/styles/colors.css';
5
- @import '../../scss/supernova/styles/spacers.css';
3
+ @use '../../scss/palette' as palette;
4
+ @use '../../scss/font-settings' as font-settings;
5
+ @use '../../scss/breakpoints' as breakpoints;
6
6
 
7
7
  .popover {
8
8
  $popover: &;
9
9
 
10
- width: max-content;
11
- max-width: min(23.3125rem, 100vw);
10
+ display: flex;
11
+ position: fixed;
12
+ align-items: flex-start !important;
13
+ max-width: 23.3125rem;
12
14
  text-align: start;
13
- background-color: var(--core-color-white);
15
+ font-family: inherit;
16
+ font-size: font-settings.$font-size-sm;
17
+ line-height: font-settings.$lineheight-size-sm;
18
+ background-color: palette.$white;
14
19
  z-index: 3;
15
- border: 1px solid var(--color-base-border-onlight);
16
- border-radius: 4px;
17
- filter: drop-shadow(0 4px 16px rgba(0 0 0 / 30%));
18
- padding: var(--core-space-s);
20
+ visibility: hidden;
21
+ border: spacers.getSpacer(4xs) solid palette.$plum600;
22
+ border-radius: 0.5625rem;
23
+ box-shadow: 0 0.125rem 1.125rem 0 rgb(0 0 0 / 15%);
19
24
 
20
- @include fonts.help-text;
25
+ @media (min-width: map.get(breakpoints.$grid-breakpoints, lg)) {
26
+ font-size: font-settings.$font-size-md;
27
+ line-height: font-settings.$lineheight-size-md;
28
+ }
29
+
30
+ &--visible {
31
+ visibility: visible;
32
+ }
33
+
34
+ &__arrow {
35
+ --drop-shadow-color: #{palette.$plum600};
36
+
37
+ width: 0;
38
+ height: 0;
39
+ position: fixed;
40
+ border-style: solid;
41
+ border-color: transparent;
42
+ z-index: 3;
43
+ visibility: hidden;
44
+
45
+ &--over {
46
+ border-width: 0.625rem;
47
+ border-bottom-color: palette.$white;
48
+ filter: drop-shadow(var(--drop-shadow-color) 0 0.125rem 0.375rem 0.125rem);
49
+ filter: drop-shadow(0 -0.185rem 0 var(--drop-shadow-color));
50
+ }
51
+
52
+ &--under {
53
+ border-width: 0.625rem;
54
+ border-top-color: palette.$white;
55
+ filter: drop-shadow(var(--drop-shadow-color) 0 0.125rem 0.375rem 0.125rem);
56
+ filter: drop-shadow(0 0.2rem 0 var(--drop-shadow-color));
57
+ }
58
+
59
+ &--visible {
60
+ visibility: visible;
61
+ }
62
+ }
21
63
  }
@@ -1,5 +1,10 @@
1
1
  export type Styles = {
2
2
  popover: string;
3
+ popover__arrow: string;
4
+ 'popover__arrow--over': string;
5
+ 'popover__arrow--under': string;
6
+ 'popover__arrow--visible': string;
7
+ 'popover--visible': string;
3
8
  };
4
9
 
5
10
  export type ClassNames = keyof Styles;
package/constants.d.ts CHANGED
@@ -51,6 +51,7 @@ export declare enum FormSize {
51
51
  }
52
52
  export declare enum AnalyticsId {
53
53
  AnchorLink = "anchor-link",
54
+ ArticleTeaser = "article-teaser",
54
55
  Avatar = "avatar",
55
56
  Badge = "badge",
56
57
  Button = "button",
@@ -76,6 +77,7 @@ export declare enum AnalyticsId {
76
77
  HighlightPanel = "highlight-panel",
77
78
  Icon = "icon",
78
79
  Illustration = "Illustration",
80
+ InfoTeaser = "info-teaser",
79
81
  Input = "input",
80
82
  Label = "label",
81
83
  Link = "link",
package/constants.js CHANGED
@@ -29,6 +29,7 @@ var FormSize = /* @__PURE__ */ ((FormSize2) => {
29
29
  })(FormSize || {});
30
30
  var AnalyticsId = /* @__PURE__ */ ((AnalyticsId2) => {
31
31
  AnalyticsId2["AnchorLink"] = "anchor-link";
32
+ AnalyticsId2["ArticleTeaser"] = "article-teaser";
32
33
  AnalyticsId2["Avatar"] = "avatar";
33
34
  AnalyticsId2["Badge"] = "badge";
34
35
  AnalyticsId2["Button"] = "button";
@@ -54,6 +55,7 @@ var AnalyticsId = /* @__PURE__ */ ((AnalyticsId2) => {
54
55
  AnalyticsId2["HighlightPanel"] = "highlight-panel";
55
56
  AnalyticsId2["Icon"] = "icon";
56
57
  AnalyticsId2["Illustration"] = "Illustration";
58
+ AnalyticsId2["InfoTeaser"] = "info-teaser";
57
59
  AnalyticsId2["Input"] = "input";
58
60
  AnalyticsId2["Label"] = "label";
59
61
  AnalyticsId2["Link"] = "link";
package/constants.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n OverlayScreen = 1300000,\n PopOver = 11000,\n LightBoxButtons = 1000,\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Chip = 'chip',\n Close = 'close',\n DictionaryTrigger = 'dictionary-trigger',\n Drawer = 'Drawer',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n EmptyState = 'empty-state',\n Expander = 'expander',\n ExpanderHierarchy = 'expander-hierarchy',\n ExpanderHierarchyExpander = 'expander-hierarchy-expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n EyebrowHeader = 'eyebrow-header',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HelpQuestion = 'help-question',\n HelpTooltip = 'help-tooltip',\n HighlightPanel = 'highlight-panel',\n Icon = 'icon',\n Illustration = 'Illustration',\n Input = 'input',\n Label = 'label',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n PanelOld = 'panel',\n PanelList = 'panel-list',\n PopMenu = 'pop-menu',\n PopOver = 'pop-over',\n Portal = 'portal',\n PromoPanel = 'promo-panel',\n RadioButton = 'radio-button',\n Select = 'select',\n SharingStatus = 'sharing-status',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Step = 'step',\n StepButtons = 'step-buttons',\n Stepper = 'stepper',\n Sublabel = 'sublabel',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Toggle = 'toggle',\n Trigger = 'trigger',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n ArrowRight = 'ArrowRight',\n ArrowLeft = 'ArrowLeft',\n Home = 'Home',\n End = 'End',\n Space = ' ',\n Tab = 'Tab',\n}\n\nexport enum LanguageLocales {\n NORWEGIAN = 'nb-NO',\n NORWEGIAN_NYNORSK = 'nn-NO',\n ENGLISH = 'en-GB',\n SAMI_NORTHERN = 'se-NO',\n}\n"],"names":["IconSize","ZIndex","FormOnColor","FormSize","AnalyticsId","KeyboardEventKey","LanguageLocales"],"mappings":"AAAY,IAAA,6BAAAA,cAAL;AACLA,YAAAA,UAAA,aAAU,EAAV,IAAA;AACAA,YAAAA,UAAA,YAAS,EAAT,IAAA;AACAA,YAAAA,UAAA,WAAQ,EAAR,IAAA;AACAA,YAAAA,UAAA,YAAS,EAAT,IAAA;AACAA,YAAAA,UAAA,WAAQ,EAAR,IAAA;AACAA,YAAAA,UAAA,YAAS,GAAT,IAAA;AANUA,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AASA,IAAA,2BAAAC,YAAL;AACLA,UAAAA,QAAA,mBAAgB,IAAhB,IAAA;AACAA,UAAAA,QAAA,aAAU,IAAV,IAAA;AACAA,UAAAA,QAAA,qBAAkB,GAAlB,IAAA;AAHUA,SAAAA;AAAA,GAAA,UAAA,CAAA,CAAA;AAML,MAAM,6BAA6B;AAyC9B,IAAA,gCAAAC,iBAAL;AACLA,eAAA,SAAU,IAAA;AACVA,eAAA,QAAS,IAAA;AACTA,eAAA,aAAc,IAAA;AACdA,eAAA,QAAS,IAAA;AACTA,eAAA,WAAY,IAAA;AALFA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAQA,IAAA,6BAAAC,cAAL;AACLA,YAAA,QAAS,IAAA;AACTA,YAAA,OAAQ,IAAA;AAFEA,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AAKA,IAAA,gCAAAC,iBAAL;AACLA,eAAA,YAAa,IAAA;AACbA,eAAA,QAAS,IAAA;AACTA,eAAA,OAAQ,IAAA;AACRA,eAAA,Q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AA,SAAU,IAAA;AACVA,eAAA,UAAW,IAAA;AACXA,eAAA,MAAO,IAAA;AACPA,eAAA,OAAQ,IAAA;AACRA,eAAA,QAAS,IAAA;AACTA,eAAA,SAAU,IAAA;AACVA,eAAA,YAAa,IAAA;AA5DHA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AA+DA,IAAA,qCAAAC,sBAAL;AACLA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,QAAS,IAAA;AACTA,oBAAA,WAAY,IAAA;AACZA,oBAAA,SAAU,IAAA;AACVA,oBAAA,YAAa,IAAA;AACbA,oBAAA,WAAY,IAAA;AACZA,oBAAA,MAAO,IAAA;AACPA,oBAAA,KAAM,IAAA;AACNA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,KAAM,IAAA;AAVIA,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAaA,IAAA,oCAAAC,qBAAL;AACLA,mBAAA,WAAY,IAAA;AACZA,mBAAA,mBAAoB,IAAA;AACpBA,mBAAA,SAAU,IAAA;AACVA,mBAAA,eAAgB,IAAA;AAJNA,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n OverlayScreen = 1300000,\n PopOver = 11000,\n LightBoxButtons = 1000,\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n ArticleTeaser = 'article-teaser',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Chip = 'chip',\n Close = 'close',\n DictionaryTrigger = 'dictionary-trigger',\n Drawer = 'Drawer',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n EmptyState = 'empty-state',\n Expander = 'expander',\n ExpanderHierarchy = 'expander-hierarchy',\n ExpanderHierarchyExpander = 'expander-hierarchy-expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n EyebrowHeader = 'eyebrow-header',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HelpQuestion = 'help-question',\n HelpTooltip = 'help-tooltip',\n HighlightPanel = 'highlight-panel',\n Icon = 'icon',\n Illustration = 'Illustration',\n InfoTeaser = 'info-teaser',\n Input = 'input',\n Label = 'label',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n PanelOld = 'panel',\n PanelList = 'panel-list',\n PopMenu = 'pop-menu',\n PopOver = 'pop-over',\n Portal = 'portal',\n PromoPanel = 'promo-panel',\n RadioButton = 'radio-button',\n Select = 'select',\n SharingStatus = 'sharing-status',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Step = 'step',\n StepButtons = 'step-buttons',\n Stepper = 'stepper',\n Sublabel = 'sublabel',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Toggle = 'toggle',\n Trigger = 'trigger',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n ArrowRight = 'ArrowRight',\n ArrowLeft = 'ArrowLeft',\n Home = 'Home',\n End = 'End',\n Space = ' ',\n Tab = 'Tab',\n}\n\nexport enum LanguageLocales {\n NORWEGIAN = 'nb-NO',\n NORWEGIAN_NYNORSK = 'nn-NO',\n ENGLISH = 'en-GB',\n SAMI_NORTHERN = 'se-NO',\n}\n"],"names":["IconSize","ZIndex","FormOnColor","FormSize","AnalyticsId","KeyboardEventKey","LanguageLocales"],"mappings":"AAAY,IAAA,6BAAAA,cAAL;AACLA,YAAAA,UAAA,aAAU,EAAV,IAAA;AACAA,YAAAA,UAAA,YAAS,EAAT,IAAA;AACAA,YAAAA,UAAA,WAAQ,EAAR,IAAA;AACAA,YAAAA,UAAA,YAAS,EAAT,IAAA;AACAA,YAAAA,UAAA,WAAQ,EAAR,IAAA;AACAA,YAAAA,UAAA,YAAS,GAAT,IAAA;AANUA,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AASA,IAAA,2BAAAC,YAAL;AACLA,UAAAA,QAAA,mBAAgB,IAAhB,IAAA;AACAA,UAAAA,QAAA,aAAU,IAAV,IAAA;AACAA,UAAAA,QAAA,qBAAkB,GAAlB,IAAA;AAHUA,SAAAA;AAAA,GAAA,UAAA,CAAA,CAAA;AAML,MAAM,6BAA6B;AAyC9B,IAAA,gCAAAC,iBAAL;AACLA,eAAA,SAAU,IAAA;AACVA,eAAA,QAAS,IAAA;AACTA,eAAA,aAAc,IAAA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AAA;AACVA,eAAA,SAAU,IAAA;AACVA,eAAA,QAAS,IAAA;AACTA,eAAA,YAAa,IAAA;AACbA,eAAA,aAAc,IAAA;AACdA,eAAA,QAAS,IAAA;AACTA,eAAA,eAAgB,IAAA;AAChBA,eAAA,QAAS,IAAA;AACTA,eAAA,QAAS,IAAA;AACTA,eAAA,WAAY,IAAA;AACZA,eAAA,MAAO,IAAA;AACPA,eAAA,aAAc,IAAA;AACdA,eAAA,SAAU,IAAA;AACVA,eAAA,UAAW,IAAA;AACXA,eAAA,OAAQ,IAAA;AACRA,eAAA,KAAM,IAAA;AACNA,eAAA,SAAU,IAAA;AACVA,eAAA,UAAW,IAAA;AACXA,eAAA,MAAO,IAAA;AACPA,eAAA,OAAQ,IAAA;AACRA,eAAA,QAAS,IAAA;AACTA,eAAA,SAAU,IAAA;AACVA,eAAA,YAAa,IAAA;AA9DHA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAiEA,IAAA,qCAAAC,sBAAL;AACLA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,QAAS,IAAA;AACTA,oBAAA,WAAY,IAAA;AACZA,oBAAA,SAAU,IAAA;AACVA,oBAAA,YAAa,IAAA;AACbA,oBAAA,WAAY,IAAA;AACZA,oBAAA,MAAO,IAAA;AACPA,oBAAA,KAAM,IAAA;AACNA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,KAAM,IAAA;AAVIA,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAaA,IAAA,oCAAAC,qBAAL;AACLA,mBAAA,WAAY,IAAA;AACZA,mBAAA,mBAAoB,IAAA;AACpBA,mBAAA,SAAU,IAAA;AACVA,mBAAA,eAAgB,IAAA;AAJNA,SAAAA;AAAA,GAAA,mBAAA,CAAA,CAAA;"}
@@ -73,7 +73,7 @@
73
73
  --color-base-background-dark-cherry: #c83521;
74
74
  --color-base-graphics-onlight: #000000;
75
75
  --color-base-border-ondark: #d6d4d3;
76
- --color-base-border-onlight: #989693;
76
+ --color-base-border-onlight: #7d7c79;
77
77
  --color-base-border-onlight-emphasized: #62625f;
78
78
  --color-help-background: #efe4fd;
79
79
  --color-help-graphics: #5b22a6;
@@ -184,4 +184,6 @@
184
184
  /* In a few cases where coloured text is required to stress the semantics of an error notification text */
185
185
  --color-notification-text-error: #a31f0e;
186
186
  --color-notification-text-success: #078141;
187
+ --color-base-border-neutral-emphasized: #bdbab9;
188
+ --color-notification-status-draft: #7d7c79;
187
189
  }
@@ -24,42 +24,24 @@ const useBreakpoint = () => {
24
24
  typeof window.matchMedia !== "undefined" ? getCurrentBreakpoint() : Breakpoint.xxs
25
25
  );
26
26
  useEffect(() => {
27
- const handleMediaQueryEvent = (event) => {
28
- switch (event.media) {
29
- case screen.xl:
30
- setBreakpoint(event.matches ? Breakpoint.xl : Breakpoint.lg);
31
- return;
32
- case screen.lg:
33
- setBreakpoint(event.matches ? Breakpoint.lg : Breakpoint.md);
34
- return;
35
- case screen.md:
36
- setBreakpoint(event.matches ? Breakpoint.md : Breakpoint.sm);
37
- return;
38
- case screen.sm:
39
- setBreakpoint(event.matches ? Breakpoint.sm : Breakpoint.xs);
40
- return;
41
- case screen.xs:
42
- setBreakpoint(event.matches ? Breakpoint.xs : Breakpoint.xxs);
43
- return;
44
- default:
45
- setBreakpoint(Breakpoint.xxs);
46
- }
47
- };
48
- const mediaQueryList = Object.entries(screen).map(([_size, mediaQuery]) => {
27
+ const mediaQueryList = Object.values(screen).map((mediaQuery) => {
49
28
  const mq = window.matchMedia(mediaQuery);
29
+ const handler = () => {
30
+ setBreakpoint(getCurrentBreakpoint());
31
+ };
50
32
  if (mq.addEventListener) {
51
- mq.addEventListener("change", handleMediaQueryEvent);
33
+ mq.addEventListener("change", handler);
52
34
  } else if (mq.addListener) {
53
- mq.addListener(handleMediaQueryEvent);
35
+ mq.addListener(handler);
54
36
  }
55
- return mq;
37
+ return { mq, handler };
56
38
  });
57
39
  return () => {
58
- mediaQueryList.forEach((mq) => {
40
+ mediaQueryList.forEach(({ mq, handler }) => {
59
41
  if (mq.removeEventListener) {
60
- mq.removeEventListener("change", handleMediaQueryEvent);
42
+ mq.removeEventListener("change", handler);
61
43
  } else if (mq.removeListener) {
62
- mq.removeListener(handleMediaQueryEvent);
44
+ mq.removeListener(handler);
63
45
  }
64
46
  });
65
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(\n typeof window.matchMedia !== 'undefined' ? getCurrentBreakpoint() : Breakpoint.xxs\n );\n\n useEffect(() => {\n const handleMediaQueryEvent = (event: MediaQueryListEvent): void => {\n switch (event.media) {\n case screen.xl:\n setBreakpoint(event.matches ? Breakpoint.xl : Breakpoint.lg);\n return;\n case screen.lg:\n setBreakpoint(event.matches ? Breakpoint.lg : Breakpoint.md);\n return;\n case screen.md:\n setBreakpoint(event.matches ? Breakpoint.md : Breakpoint.sm);\n return;\n case screen.sm:\n setBreakpoint(event.matches ? Breakpoint.sm : Breakpoint.xs);\n return;\n case screen.xs:\n setBreakpoint(event.matches ? Breakpoint.xs : Breakpoint.xxs);\n return;\n default:\n setBreakpoint(Breakpoint.xxs);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const mediaQueryList = Object.entries(screen).map(([_size, mediaQuery]) => {\n const mq = window.matchMedia(mediaQuery);\n // iOS <=13 har ikke støtte for addEventListener/removeEventListener på MediaQueryList,\n // men har støtte for addListener\n if (mq.addEventListener) {\n mq.addEventListener('change', handleMediaQueryEvent);\n } else if (mq.addListener) {\n mq.addListener(handleMediaQueryEvent);\n }\n return mq;\n });\n\n return (): void => {\n mediaQueryList.forEach(mq => {\n if (mq.removeEventListener) {\n mq.removeEventListener('change', handleMediaQueryEvent);\n } else if (mq.removeListener) {\n mq.removeListener(handleMediaQueryEvent);\n }\n });\n };\n }, []);\n\n return breakpoint;\n};\n"],"names":["Breakpoint"],"mappings":";;AAIY,IAAA,cAAL,CAAKA,gBAAL;AACLA,cAAAA,YAAA,KAAM,IAAA,YAAY,GAAlB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AANUA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AASZ,SAAS,uBAAmC;AAG1C,QAAM,iBAAiB,OAAO,QAAQ,MAAM,EACzC,QACA,EAAA,IAAI,CAAC,CAAC,MAAM,UAAU,MAAM;AACpB,WAAA;AAAA,MACL,YAAY,WAAW,IAA+B;AAAA,MACtD,IAAI,OAAO,WAAW,UAAU;AAAA,IAClC;AAAA,EAAA,CACD;AAEH,QAAM,UAAU,eAAe,KAAK,CAAS,UAAA,MAAM,GAAG,OAAO;AACtD,UAAA,mCAAS,eAAc,WAAW;AAC3C;AAEO,MAAM,gBAAgB,MAAkB;AACvC,QAAA,C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ffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(\n typeof window.matchMedia !== 'undefined' ? getCurrentBreakpoint() : Breakpoint.xxs\n );\n\n useEffect(() => {\n const mediaQueryList = Object.values(screen).map(mediaQuery => {\n const mq = window.matchMedia(mediaQuery);\n // iOS <=13 har ikke støtte for addEventListener/removeEventListener på MediaQueryList,\n // men har støtte for addListener\n const handler = (): void => {\n setBreakpoint(getCurrentBreakpoint());\n };\n\n if (mq.addEventListener) {\n mq.addEventListener('change', handler);\n } else if (mq.addListener) {\n mq.addListener(handler);\n }\n return { mq, handler };\n });\n\n return (): void => {\n mediaQueryList.forEach(({ mq, handler }) => {\n if (mq.removeEventListener) {\n mq.removeEventListener('change', handler);\n } else if (mq.removeListener) {\n mq.removeListener(handler);\n }\n });\n };\n }, []);\n\n return breakpoint;\n};\n"],"names":["Breakpoint"],"mappings":";;AAIY,IAAA,cAAL,CAAKA,gBAAL;AACLA,cAAAA,YAAA,KAAM,IAAA,YAAY,GAAlB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YA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E,SAAA;AACT;"}
@@ -0,0 +1 @@
1
+ export declare const useIsMobileBreakpoint: () => boolean;
@@ -0,0 +1,10 @@
1
+ import { useBreakpoint } from "./useBreakpoint.js";
2
+ import { breakpoints } from "../theme/grid.js";
3
+ const useIsMobileBreakpoint = () => {
4
+ const breakpoint = useBreakpoint();
5
+ return breakpoint < breakpoints.md;
6
+ };
7
+ export {
8
+ useIsMobileBreakpoint
9
+ };
10
+ //# sourceMappingURL=useIsMobileBreakpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsMobileBreakpoint.js","sources":["../../src/hooks/useIsMobileBreakpoint.ts"],"sourcesContent":["import { useBreakpoint } from './useBreakpoint';\nimport { breakpoints } from '../theme/grid';\n\nexport const useIsMobileBreakpoint = (): boolean => {\n const breakpoint = useBreakpoint();\n return breakpoint < breakpoints.md;\n};\n"],"names":[],"mappings":";;AAGO,MAAM,wBAAwB,MAAe;AAClD,QAAM,aAAa,cAAc;AACjC,SAAO,aAAa,YAAY;AAClC;"}
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/helsenorge/designsystem.git"
8
8
  },
9
9
  "homepage": "https://helsenorge.design",
10
- "version": "11.2.0-beta.0",
10
+ "version": "11.2.0",
11
11
  "author": "Helsenorge",
12
12
  "license": "MIT",
13
13
  "dependencies": {
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonClose": "Show more",
3
+ "expandButtonOpen": "Show less"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonClose": "Vis mer",
3
+ "expandButtonOpen": "Vis mindre"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -1,6 +1,5 @@
1
1
  declare const _default: {
2
- "closeText": "Lukk",
3
- "testtest": "testtest"
2
+ "closeText": "Lukk"
4
3
  }
5
4
  ;
6
5
 
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "Show less",
3
+ "expandButtonClose": "Show more"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "Vis mindre",
3
+ "expandButtonClose": "Vis mer"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "See details",
3
+ "expandButtonClose": "Hide details"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ "expandButtonOpen": "Se detaljer",
3
+ "expandButtonClose": "Skjul detaljer"
4
+ }
5
+ ;
6
+
7
+ export default _default;
@@ -238,25 +238,3 @@
238
238
  line-height: 1.625rem;
239
239
  }
240
240
  }
241
-
242
- @mixin help-text {
243
- font-size: 1rem;
244
- line-height: 1.5rem;
245
- font-weight: 400;
246
-
247
- @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
248
- font-size: 1.125rem;
249
- line-height: 1.575rem;
250
- }
251
- }
252
-
253
- @mixin help-trigger-text {
254
- font-size: 1rem;
255
- line-height: 1.2rem;
256
- font-weight: 600;
257
-
258
- @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
259
- font-size: 1.125rem;
260
- line-height: 1.463rem;
261
- }
262
- }
@@ -73,7 +73,7 @@
73
73
  --color-base-background-dark-cherry: #c83521;
74
74
  --color-base-graphics-onlight: #000000;
75
75
  --color-base-border-ondark: #d6d4d3;
76
- --color-base-border-onlight: #989693;
76
+ --color-base-border-onlight: #7d7c79;
77
77
  --color-base-border-onlight-emphasized: #62625f;
78
78
  --color-help-background: #efe4fd;
79
79
  --color-help-graphics: #5b22a6;
@@ -184,4 +184,6 @@
184
184
  /* In a few cases where coloured text is required to stress the semantics of an error notification text */
185
185
  --color-notification-text-error: #a31f0e;
186
186
  --color-notification-text-success: #078141;
187
+ --color-base-border-neutral-emphasized: #bdbab9;
188
+ --color-notification-status-draft: #7d7c79;
187
189
  }
@@ -132,14 +132,6 @@ import designsystemtypography from './scss/typography.scss'
132
132
  @include fonts.definition-list-data;
133
133
  }
134
134
 
135
- .help-text {
136
- @include fonts.help-text;
137
- }
138
-
139
- .help-trigger-text {
140
- @include fonts.help-trigger-text;
141
- }
142
-
143
135
  .anchorlink-wrapper {
144
136
  a {
145
137
  display: inline;
@@ -6,8 +6,6 @@ export type Styles = {
6
6
  'definition-list-type': string;
7
7
  'focused-content': string;
8
8
  form: string;
9
- 'help-text': string;
10
- 'help-trigger-text': string;
11
9
  'image-caption': string;
12
10
  'image-credit': string;
13
11
  'input-text': string;
@@ -121,14 +121,6 @@ export const DefinitionListData: Story = {
121
121
  render: args => <div className={designsystemtypography['definition-list-data']}>{args.tekst}</div>,
122
122
  };
123
123
 
124
- export const HelpText: Story = {
125
- render: args => <div className={designsystemtypography['help-text']}>{args.tekst}</div>,
126
- };
127
-
128
- export const HelpTriggerText: Story = {
129
- render: args => <div className={designsystemtypography['help-trigger-text']}>{args.tekst}</div>,
130
- };
131
-
132
124
  export const AnchorlinkWrapper: Story = {
133
125
  render: args => (
134
126
  <div className={designsystemtypography['anchorlink-wrapper']}>