@helsenorge/designsystem-react 15.3.0 → 15.4.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 (34) hide show
  1. package/lib/CHANGELOG.md +12 -0
  2. package/lib/Drawer.js +53 -36
  3. package/lib/Drawer.js.map +1 -1
  4. package/lib/DrawerNavigation.js +106 -8
  5. package/lib/DrawerNavigation.js.map +1 -1
  6. package/lib/InfoTeaser.js +10 -9
  7. package/lib/InfoTeaser.js.map +1 -1
  8. package/lib/LazyIcon.js +2 -0
  9. package/lib/LazyIcon.js.map +1 -1
  10. package/lib/components/Drawer/Drawer.d.ts +3 -1
  11. package/lib/components/Drawer/DrawerHeaderContent.d.ts +22 -0
  12. package/lib/components/Drawer/DrawerHeaderContent.module.scss +51 -0
  13. package/lib/components/Drawer/DrawerHeaderContent.module.scss.d.ts +12 -0
  14. package/lib/components/Drawer/styles.module.scss +0 -14
  15. package/lib/components/Drawer/styles.module.scss.d.ts +0 -2
  16. package/lib/components/Filter/DrawerNavigation/styles.module.scss +15 -0
  17. package/lib/components/Filter/DrawerNavigation/styles.module.scss.d.ts +11 -0
  18. package/lib/components/Highlighter/styles.module.scss +1 -1
  19. package/lib/components/Icons/AdditionalIconInformation.d.ts +12 -0
  20. package/lib/components/Icons/AdditionalIconInformation.js +13 -1
  21. package/lib/components/Icons/AdditionalIconInformation.js.map +1 -1
  22. package/lib/components/Icons/IconNames.d.ts +1 -1
  23. package/lib/components/Icons/IconNames.js +2 -0
  24. package/lib/components/Icons/IconNames.js.map +1 -1
  25. package/lib/components/Icons/ThumbsDown.d.ts +4 -0
  26. package/lib/components/Icons/ThumbsDown.js +15 -0
  27. package/lib/components/Icons/ThumbsDown.js.map +1 -0
  28. package/lib/components/Icons/ThumbsUp.d.ts +4 -0
  29. package/lib/components/Icons/ThumbsUp.js +15 -0
  30. package/lib/components/Icons/ThumbsUp.js.map +1 -0
  31. package/lib/components/InfoTeaser/InfoTeaser.d.ts +4 -0
  32. package/lib/hooks/useFocusTrap.js +4 -2
  33. package/lib/hooks/useFocusTrap.js.map +1 -1
  34. package/package.json +1 -1
package/lib/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [15.4.0](https://github.com/helsenorge/designsystem/compare/v15.3.0...v15.4.0) (2026-07-03)
2
+
3
+ ### Features
4
+
5
+ * drawernavigation får animasjon under navigering ([746b378](https://github.com/helsenorge/designsystem/commit/746b378675bb6b04b7d214a90443fcee92cb751c)), closes [#376680](https://github.com/helsenorge/designsystem/issues/376680)
6
+ * nye ikoner thumbsup og thumbsdown ([44b7b56](https://github.com/helsenorge/designsystem/commit/44b7b56254d1bca10d5ed05c6d98be5a76b732a2)), closes [#381474](https://github.com/helsenorge/designsystem/issues/381474)
7
+ * **infoteaser:** nye props expanded og onexpanded ([6e088be](https://github.com/helsenorge/designsystem/commit/6e088be16ae0a8e3f90e174d3b299da177df5370)), closes [#381641](https://github.com/helsenorge/designsystem/issues/381641)
8
+
9
+ ### Bug Fixes
10
+
11
+ * **highlighter:** lysere bakgrunnsfarge ([740aea9](https://github.com/helsenorge/designsystem/commit/740aea961562a78d0ae26da7ba59de35081f9752)), closes [#381583](https://github.com/helsenorge/designsystem/issues/381583)
12
+
1
13
  ## [15.3.0](https://github.com/helsenorge/designsystem/compare/v15.2.0...v15.3.0) (2026-06-30)
2
14
 
3
15
  ### Features
package/lib/Drawer.js CHANGED
@@ -13,14 +13,15 @@ import { useOutsideEvent } from "./hooks/useOutsideEvent.js";
13
13
  import { t as Close_default } from "./Close.js";
14
14
  import { useReturnFocusOnUnmount } from "./hooks/useReturnFocusOnUnmount.js";
15
15
  import { disableBodyScroll, enableBodyScroll } from "./utils/scroll.js";
16
- import Title_default from "./components/Title/index.js";
17
16
  import ChevronLeft from "./components/Icons/ChevronLeft.js";
17
+ import Title_default from "./components/Title/index.js";
18
18
  import cn from "classnames";
19
19
  import React, { useEffect, useRef } from "react";
20
20
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
21
  import { AnimatePresence, useAnimate, usePresence } from "motion/react";
22
22
  import styles from "./components/Drawer/DrawerBackButton.module.scss";
23
- import styles$1 from "./components/Drawer/styles.module.scss";
23
+ import styles$1 from "./components/Drawer/DrawerHeaderContent.module.scss";
24
+ import styles$2 from "./components/Drawer/styles.module.scss";
24
25
  var HN_Designsystem_Drawer_en_GB_default = {
25
26
  ariaLabelCloseBtn: "Close",
26
27
  ariaLabelBackButton: "Go back"
@@ -72,6 +73,29 @@ var DrawerBackButton = (props) => {
72
73
  });
73
74
  };
74
75
  //#endregion
76
+ //#region src/components/Drawer/DrawerHeaderContent.tsx
77
+ var DrawerHeaderContent = (props) => {
78
+ const { title, titleId, titleRef, titleHtmlMarkup = "h3", withBackButton, onRequestBack, backButtonAriaLabel, className } = props;
79
+ return /* @__PURE__ */ jsxs("div", {
80
+ className: cn(styles$1["header-content"], className),
81
+ children: [/* @__PURE__ */ jsx("span", {
82
+ className: cn(styles$1["header-content__title"], { [styles$1["header-content__title--centered"]]: withBackButton }),
83
+ children: /* @__PURE__ */ jsx(Title_default, {
84
+ id: titleId,
85
+ ref: titleRef,
86
+ tabIndex: -1,
87
+ htmlMarkup: titleHtmlMarkup,
88
+ appearance: "title3",
89
+ children: title
90
+ })
91
+ }), withBackButton && /* @__PURE__ */ jsx(DrawerBackButton, {
92
+ ariaLabel: backButtonAriaLabel,
93
+ onClick: onRequestBack,
94
+ className: styles$1["header-content__back-button"]
95
+ })]
96
+ });
97
+ };
98
+ //#endregion
75
99
  //#region src/components/Drawer/Drawer.tsx
76
100
  var Drawer = (props) => {
77
101
  const { isOpen, ...rest } = props;
@@ -82,7 +106,7 @@ var Drawer = (props) => {
82
106
  }) });
83
107
  };
84
108
  var InnerDrawer = (props) => {
85
- const { ariaLabel, ariaLabelledBy, children, closeColor = "blueberry", desktopDirection = "left", footerContent, headerClasses, noCloseButton = false, onPrimaryAction, onRequestClose, onSecondaryAction, primaryActionText, secondaryActionText, title, titleHtmlMarkup = "h3", titleId = uuid(), zIndex = ZIndex.OverlayScreen, resources, isMobile, withBackButton, onRequestBack, contentClassName, paddingSize = "normal" } = props;
109
+ const { ariaLabel, ariaLabelledBy, children, closeColor = "blueberry", desktopDirection = "left", footerContent, headerClasses, headerContent, noCloseButton = false, onPrimaryAction, onRequestClose, onSecondaryAction, primaryActionText, secondaryActionText, title, titleHtmlMarkup = "h3", titleId = uuid(), zIndex = ZIndex.OverlayScreen, resources, isMobile, withBackButton, onRequestBack, contentClassName, paddingSize = "normal" } = props;
86
110
  const ariaLabelAttributes = getAriaLabelAttributes({
87
111
  label: ariaLabel,
88
112
  id: ariaLabelledBy,
@@ -108,7 +132,7 @@ var InnerDrawer = (props) => {
108
132
  ...resources
109
133
  };
110
134
  const contentIsScrollable = contentRef.current && contentRef.current.scrollHeight > contentRef.current.clientHeight;
111
- const headerStyling = cn(styles$1.drawer__header, { [styles$1["drawer__header--padding-extra"]]: paddingSize === "extra" }, headerClasses);
135
+ const headerStyling = cn(styles$2.drawer__header, { [styles$2["drawer__header--padding-extra"]]: paddingSize === "extra" }, headerClasses);
112
136
  const hasFooterContent = typeof footerContent !== "undefined" && footerContent || onPrimaryAction || onSecondaryAction;
113
137
  useFocusTrap(containerRef, true);
114
138
  useReturnFocusOnUnmount(containerRef);
@@ -188,60 +212,53 @@ var InnerDrawer = (props) => {
188
212
  useEffect(() => {
189
213
  titleRef.current?.focus();
190
214
  }, [title]);
215
+ const headerMain = /* @__PURE__ */ jsx(DrawerHeaderContent, {
216
+ title,
217
+ titleId: ariaLabelAttributes?.["aria-labelledby"],
218
+ titleRef,
219
+ titleHtmlMarkup,
220
+ withBackButton: withBackButton && onRequestBack !== void 0,
221
+ onRequestBack,
222
+ backButtonAriaLabel: mergedResources.ariaLabelBackButton
223
+ });
191
224
  return /* @__PURE__ */ jsxs("div", {
192
- className: styles$1.drawer,
225
+ className: styles$2.drawer,
193
226
  ref: scope,
194
227
  style: { zIndex },
195
228
  "data-analyticsid": AnalyticsId.Drawer,
196
229
  children: [/* @__PURE__ */ jsx("div", {
197
- className: styles$1.drawer__overlay,
230
+ className: styles$2.drawer__overlay,
198
231
  ref: overlayRef,
199
232
  "aria-hidden": "true"
200
233
  }), /* @__PURE__ */ jsxs("div", {
201
- className: cn(styles$1.drawer__container, { [styles$1["drawer__container--right"]]: desktopDirection === "right" }),
234
+ className: cn(styles$2.drawer__container, { [styles$2["drawer__container--right"]]: desktopDirection === "right" }),
202
235
  ref: containerRef,
203
236
  role: "dialog",
204
237
  "aria-modal": "true",
205
238
  tabIndex: -1,
206
239
  ...ariaLabelAttributes,
207
240
  children: [/* @__PURE__ */ jsxs("div", {
208
- className: styles$1.drawer__container__inner,
241
+ className: styles$2.drawer__container__inner,
209
242
  children: [
210
243
  /* @__PURE__ */ jsxs("div", {
211
244
  className: headerStyling,
212
245
  ref: headerRef,
213
- children: [
214
- /* @__PURE__ */ jsx(Title_default, {
215
- id: ariaLabelAttributes?.["aria-labelledby"],
216
- className: styles$1["drawer__header__title"],
217
- htmlMarkup: titleHtmlMarkup,
218
- appearance: "title3",
219
- ref: titleRef,
220
- tabIndex: -1,
221
- children: title
222
- }),
223
- withBackButton && onRequestBack !== void 0 && /* @__PURE__ */ jsx(DrawerBackButton, {
224
- ariaLabel: mergedResources.ariaLabelBackButton,
225
- onClick: onRequestBack,
226
- className: styles$1["drawer__header__back-button"]
227
- }),
228
- !noCloseButton && onRequestClose != void 0 && /* @__PURE__ */ jsx(Close_default, {
229
- ariaLabel: mergedResources.ariaLabelCloseBtn,
230
- color: closeColor,
231
- onClick: onRequestClose,
232
- className: styles$1["drawer__header__close-button"]
233
- })
234
- ]
246
+ children: [headerContent ?? headerMain, !noCloseButton && onRequestClose != void 0 && /* @__PURE__ */ jsx(Close_default, {
247
+ ariaLabel: mergedResources.ariaLabelCloseBtn,
248
+ color: closeColor,
249
+ onClick: onRequestClose,
250
+ className: styles$2["drawer__header__close-button"]
251
+ })]
235
252
  }),
236
253
  /* @__PURE__ */ jsx("div", {
237
- className: cn(styles$1["drawer__content__shadow"], styles$1["drawer__content__shadow--top"]),
254
+ className: cn(styles$2["drawer__content__shadow"], styles$2["drawer__content__shadow--top"]),
238
255
  style: {
239
256
  opacity: !topContentVisible && contentIsScrollable ? 1 : 0,
240
257
  top: headerHeight
241
258
  }
242
259
  }),
243
260
  /* @__PURE__ */ jsxs("div", {
244
- className: cn(styles$1.drawer__content, contentClassName),
261
+ className: cn(styles$2.drawer__content, contentClassName),
245
262
  tabIndex: contentIsScrollable ? 0 : void 0,
246
263
  role: contentIsScrollable ? "region" : void 0,
247
264
  ...contentIsScrollable ? ariaLabelAttributes : {},
@@ -249,7 +266,7 @@ var InnerDrawer = (props) => {
249
266
  children: [
250
267
  /* @__PURE__ */ jsx("div", { ref: topContent }),
251
268
  /* @__PURE__ */ jsx("div", {
252
- className: cn(styles$1["drawer__content__children"], { [styles$1["drawer__content__children--padding-extra"]]: paddingSize === "extra" }),
269
+ className: cn(styles$2["drawer__content__children"], { [styles$2["drawer__content__children--padding-extra"]]: paddingSize === "extra" }),
253
270
  children
254
271
  }),
255
272
  /* @__PURE__ */ jsx("div", {
@@ -259,7 +276,7 @@ var InnerDrawer = (props) => {
259
276
  ]
260
277
  }),
261
278
  /* @__PURE__ */ jsx("div", {
262
- className: cn(styles$1["drawer__content__shadow"], styles$1["drawer__content__shadow--bottom"]),
279
+ className: cn(styles$2["drawer__content__shadow"], styles$2["drawer__content__shadow--bottom"]),
263
280
  style: {
264
281
  opacity: !bottomContentVisible && contentIsScrollable ? 1 : 0,
265
282
  bottom: hasFooterContent ? footerHeight : 0
@@ -267,7 +284,7 @@ var InnerDrawer = (props) => {
267
284
  })
268
285
  ]
269
286
  }), hasFooterContent && /* @__PURE__ */ jsx("div", {
270
- className: cn(styles$1.drawer__footer, { [styles$1["drawer__footer--padding-extra"]]: paddingSize === "extra" }),
287
+ className: cn(styles$2.drawer__footer, { [styles$2["drawer__footer--padding-extra"]]: paddingSize === "extra" }),
271
288
  ref: footerRef,
272
289
  children: footerContent ? footerContent : /* @__PURE__ */ jsxs(Fragment, { children: [onPrimaryAction && /* @__PURE__ */ jsx(Button_default, {
273
290
  onClick: () => handleCTA(onPrimaryAction),
@@ -285,6 +302,6 @@ var InnerDrawer = (props) => {
285
302
  //#region src/components/Drawer/index.ts
286
303
  var Drawer_default = Drawer;
287
304
  //#endregion
288
- export { Drawer_default as t };
305
+ export { DrawerHeaderContent as n, Drawer_default as t };
289
306
 
290
307
  //# sourceMappingURL=Drawer.js.map
package/lib/Drawer.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","names":[],"sources":["../src/resources/HN.Designsystem.Drawer.en-GB.json","../src/resources/HN.Designsystem.Drawer.nb-NO.json","../src/resources/HN.Designsystem.Drawer.nn-NO.json","../src/resources/HN.Designsystem.Drawer.se-NO.json","../src/components/Drawer/resourceHelper.ts","../src/components/Drawer/DrawerBackButton.tsx","../src/components/Drawer/Drawer.tsx","../src/components/Drawer/index.ts"],"sourcesContent":["{\n \"ariaLabelCloseBtn\": \"Close\",\n \"ariaLabelBackButton\": \"Go back\"\n}\n","{\n \"ariaLabelBackButton\": \"Gå tilbake\",\n \"ariaLabelCloseBtn\": \"Lukk\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Lukk\",\n \"ariaLabelBackButton\": \"Gå tilbake\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Gidde\",\n \"ariaLabelBackButton\": \"Mana ruovttoluotta\"\n}\n","import type { HNDesignsystemDrawer } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Drawer.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Drawer.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.Drawer.nn-NO.json';\nimport seNO from '../../resources/HN.Designsystem.Drawer.se-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDrawer => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.SAMI_NORTHERN:\n return seNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport Icon from '../Icon';\nimport ChevronLeft from '../Icons/ChevronLeft';\n\nimport styles from './DrawerBackButton.module.scss';\n\nexport interface DrawerBackButtonProps {\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Adds custom classes to the element. */\n className?: string;\n}\n\nconst DrawerBackButton: React.FC<DrawerBackButtonProps> = props => {\n const { ariaLabel = 'Tilbake', onClick, className } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n\n const iconSize = useIsMobileBreakpoint() ? 38 : 48;\n\n return (\n <button ref={refObject} className={classNames(styles['back-button'], className)} aria-label={ariaLabel} onClick={onClick} type=\"button\">\n <span className={classNames(styles['back-button__inner-container'])}>\n <Icon svgIcon={ChevronLeft} color={'var(--color-action-graphics-onlight'} size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n};\n\nexport default DrawerBackButton;\n","import React, { useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\nimport { AnimatePresence, useAnimate, usePresence } from 'motion/react';\n\nimport type { HNDesignsystemDrawer } from '../../resources/Resources';\nimport type { TitleTags } from '../Title';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, KeyboardEventKey, LanguageLocales, ZIndex } from '../../constants';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useKeyboardEvent } from '../../hooks/useKeyboardEvent';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { useReturnFocusOnUnmount } from '../../hooks/useReturnFocusOnUnmount';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { disableBodyScroll, enableBodyScroll } from '../../utils/scroll';\nimport uuid from '../../utils/uuid';\nimport Button from '../Button';\nimport Close from '../Close';\nimport Title from '../Title';\nimport DrawerBackButton from './DrawerBackButton';\n\nimport styles from './styles.module.scss';\n\ntype DesktopDirections = 'left' | 'right';\ntype PaddingSizes = 'normal' | 'extra';\n\nexport interface DrawerProps extends InnerDrawerProps {\n /** Opens and closes the drawer */\n isOpen: boolean;\n}\n\nexport interface InnerDrawerProps {\n /** Sets the aria-label of the drawer */\n ariaLabel?: string;\n /** Sets the aria-labelledby of the drawer */\n ariaLabelledBy?: string;\n /** Sets the style of the Drawer Close button. Meant for use by HelpDrawer */\n closeColor?: 'blueberry' | 'plum';\n /** Direction of the drawer on desktop. Default: left */\n desktopDirection?: DesktopDirections;\n /** Sets the style of the Drawer header */\n headerClasses?: string;\n /** Title to display in the header of the drawer */\n title: string;\n /** id of the drawer title */\n titleId?: string;\n /** Changes the underlying element of the title. Default: h3 */\n titleHtmlMarkup?: TitleTags;\n /** Callback that triggers when clicking on close button or outside the drawer, update isOpen state when this triggers */\n onRequestClose?: () => void;\n /** Optional footer content that can be rendered instead of default CTA(s) */\n footerContent?: React.ReactNode;\n /** Main content of the drawer */\n children?: React.ReactNode;\n /** Hides the close button */\n noCloseButton?: boolean;\n /** Primary CTA callback */\n onPrimaryAction?: () => void;\n /** Text for primary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n primaryActionText?: string;\n /** Text for secondary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n secondaryActionText?: string;\n /** Secondary CTA callback */\n onSecondaryAction?: () => void;\n /** Customize the z-index of the drawer */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDrawer>;\n /** Sets mobile styling and animation from outer level Drawer */\n isMobile?: boolean;\n /** Shows a back button to the left of title */\n withBackButton?: boolean;\n /** Callback for the back button */\n onRequestBack?: () => void;\n /** Sets classname for content part in Drawer */\n contentClassName?: string;\n /** Sets the content padding of the Drawer */\n paddingSize?: PaddingSizes;\n}\n\nconst Drawer: React.FC<DrawerProps> = props => {\n const { isOpen, ...rest } = props;\n const isMobile = useIsMobileBreakpoint();\n\n return <AnimatePresence>{isOpen && <InnerDrawer {...rest} isMobile={isMobile} />}</AnimatePresence>;\n};\n\nconst InnerDrawer: React.FC<InnerDrawerProps> = props => {\n const {\n ariaLabel,\n ariaLabelledBy,\n children,\n closeColor = 'blueberry',\n desktopDirection = 'left',\n footerContent,\n headerClasses,\n noCloseButton = false,\n onPrimaryAction,\n onRequestClose,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n titleHtmlMarkup = 'h3',\n titleId = uuid(),\n zIndex = ZIndex.OverlayScreen,\n resources,\n isMobile,\n withBackButton,\n onRequestBack,\n contentClassName,\n paddingSize = 'normal',\n } = props;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledBy, fallbackId: titleId });\n const overlayRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n // topContent and bottomContent are used to detect scroll position for shadow effects\n const topContent = useRef<HTMLDivElement>(null);\n const bottomContent = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const titleRef = useRef<HTMLHeadingElement>(null);\n const [scope, animate] = useAnimate();\n const [isPresent, safeToRemove] = usePresence();\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const topContentVisible = useIsVisible(topContent);\n const bottomContentVisible = useIsVisible(bottomContent, 0);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDrawer = {\n ...defaultResources,\n ...resources,\n };\n\n // eslint-disable-next-line react-hooks/refs\n const contentIsScrollable = contentRef.current && contentRef.current.scrollHeight > contentRef.current.clientHeight;\n const headerStyling = classNames(\n styles.drawer__header,\n { [styles['drawer__header--padding-extra']]: paddingSize === 'extra' },\n headerClasses\n );\n const hasFooterContent = (typeof footerContent !== 'undefined' && footerContent) || onPrimaryAction || onSecondaryAction;\n\n useFocusTrap(containerRef, true);\n useReturnFocusOnUnmount(containerRef);\n useOutsideEvent(containerRef, () => {\n if (onRequestClose) onRequestClose();\n });\n useKeyboardEvent(containerRef, () => onRequestClose && onRequestClose(), [KeyboardEventKey.Escape]);\n\n // Close animasjon, vi kaller `onClose()` til slutt\n const closeDrawer = (): void => {\n if (!overlayRef.current || !containerRef.current) return;\n\n animate(overlayRef.current, { opacity: 0, pointerEvents: 'none' }, { duration: 0.3, ease: 'easeInOut' });\n\n if (isMobile) {\n animate(\n containerRef.current,\n { y: '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n } else {\n animate(\n containerRef.current,\n { x: desktopDirection === 'left' ? '-100%' : '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n }\n };\n\n useEffect(() => {\n containerRef.current?.focus();\n disableBodyScroll();\n\n return (): void => {\n enableBodyScroll();\n };\n }, []);\n\n // Measure header and footer heights\n useEffect(() => {\n const updateHeights = (): void => {\n if (headerRef.current) {\n setHeaderHeight(headerRef.current.offsetHeight);\n }\n if (footerRef.current) {\n setFooterHeight(footerRef.current.offsetHeight);\n }\n };\n\n updateHeights();\n\n // Update heights when content changes\n const resizeObserver = new ResizeObserver(updateHeights);\n if (headerRef.current) {\n resizeObserver.observe(headerRef.current);\n }\n if (footerRef.current) {\n resizeObserver.observe(footerRef.current);\n }\n\n return (): void => {\n resizeObserver.disconnect();\n };\n }, [hasFooterContent]);\n\n // Open animation.\n useEffect(() => {\n if (!overlayRef.current || !containerRef.current) return;\n\n if (!isPresent) {\n closeDrawer();\n return;\n }\n\n if (isMobile) {\n animate(containerRef.current, { y: '0' }, { duration: 0.3, ease: 'easeInOut' });\n } else {\n animate(containerRef.current, { x: '0' }, { duration: 0.3, ease: 'easeInOut' });\n }\n\n animate(overlayRef.current, { opacity: 1, pointerEvents: 'auto' }, { duration: 0.3, ease: 'easeInOut' });\n }, [isPresent]);\n\n const handleCTA = (callback?: () => void): void => {\n if (callback) {\n callback();\n }\n };\n\n useEffect(() => {\n titleRef.current?.focus();\n }, [title]);\n\n return (\n <div className={styles.drawer} ref={scope} style={{ zIndex }} data-analyticsid={AnalyticsId.Drawer}>\n <div className={styles.drawer__overlay} ref={overlayRef} aria-hidden=\"true\" />\n <div\n className={classNames(styles.drawer__container, {\n [styles['drawer__container--right']]: desktopDirection === 'right',\n })}\n ref={containerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n {...ariaLabelAttributes}\n >\n <div className={styles.drawer__container__inner}>\n <div className={headerStyling} ref={headerRef}>\n <Title\n id={ariaLabelAttributes?.['aria-labelledby']}\n className={styles['drawer__header__title']}\n htmlMarkup={titleHtmlMarkup}\n appearance=\"title3\"\n ref={titleRef}\n tabIndex={-1}\n >\n {title}\n </Title>\n {withBackButton && onRequestBack !== undefined && (\n <DrawerBackButton\n ariaLabel={mergedResources.ariaLabelBackButton}\n onClick={onRequestBack}\n className={styles['drawer__header__back-button']}\n />\n )}\n {!noCloseButton && onRequestClose != undefined && (\n <Close\n ariaLabel={mergedResources.ariaLabelCloseBtn}\n color={closeColor}\n onClick={onRequestClose}\n className={styles['drawer__header__close-button']}\n />\n )}\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--top'])}\n style={{\n opacity: !topContentVisible && contentIsScrollable ? 1 : 0,\n top: headerHeight,\n }}\n />\n <div\n className={classNames(styles.drawer__content, contentClassName)}\n tabIndex={contentIsScrollable ? 0 : undefined}\n role={contentIsScrollable ? 'region' : undefined}\n {...(contentIsScrollable ? ariaLabelAttributes : {})}\n ref={contentRef}\n >\n <div ref={topContent} />\n <div\n className={classNames(styles['drawer__content__children'], {\n [styles['drawer__content__children--padding-extra']]: paddingSize === 'extra',\n })}\n >\n {children}\n </div>\n <div ref={bottomContent} style={{ height: '1px' }} />\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--bottom'])}\n style={{\n opacity: !bottomContentVisible && contentIsScrollable ? 1 : 0,\n bottom: hasFooterContent ? footerHeight : 0,\n }}\n />\n </div>\n {hasFooterContent && (\n <div\n className={classNames(styles.drawer__footer, { [styles['drawer__footer--padding-extra']]: paddingSize === 'extra' })}\n ref={footerRef}\n >\n {footerContent ? (\n footerContent\n ) : (\n <>\n {onPrimaryAction && <Button onClick={() => handleCTA(onPrimaryAction)}>{primaryActionText}</Button>}\n {onSecondaryAction && (\n <Button variant=\"borderless\" onClick={() => handleCTA(onSecondaryAction)}>\n {secondaryActionText}\n </Button>\n )}\n </>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Drawer;\n","import Drawer from './Drawer';\nexport * from './Drawer';\nexport default Drawer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIQA,IAAa,gBAAgB,aAAoD;CAC/E,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB,mBACnB,OAAO;EACT,KAAK,gBAAgB,eACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACFA,IAAM,oBAAoD,UAAS;CACjE,MAAM,EAAE,YAAY,WAAW,SAAS,cAAc;CACtD,MAAM,EAAE,WAAW,cAAc,iBAAoC;CAErE,MAAM,WAAW,sBAAsB,IAAI,KAAK;CAEhD,OACE,oBAAC,UAAD;EAAQ,KAAK;EAAW,WAAW,GAAW,OAAO,gBAAgB,SAAS;EAAG,cAAY;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AAD;KAAQ,SAAQ;KAAa,eAAe,UAAU,iBAAiB;eACpE;IACK,CAAA,CAEV,EAAA,CAAA;GAED,CAAA,CAEJ;IACF;;AAET;;;AC5VA,IAAA,iBAAe"}
1
+ {"version":3,"file":"Drawer.js","names":[],"sources":["../src/resources/HN.Designsystem.Drawer.en-GB.json","../src/resources/HN.Designsystem.Drawer.nb-NO.json","../src/resources/HN.Designsystem.Drawer.nn-NO.json","../src/resources/HN.Designsystem.Drawer.se-NO.json","../src/components/Drawer/resourceHelper.ts","../src/components/Drawer/DrawerBackButton.tsx","../src/components/Drawer/DrawerHeaderContent.tsx","../src/components/Drawer/Drawer.tsx","../src/components/Drawer/index.ts"],"sourcesContent":["{\n \"ariaLabelCloseBtn\": \"Close\",\n \"ariaLabelBackButton\": \"Go back\"\n}\n","{\n \"ariaLabelBackButton\": \"Gå tilbake\",\n \"ariaLabelCloseBtn\": \"Lukk\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Lukk\",\n \"ariaLabelBackButton\": \"Gå tilbake\"\n}\n","{\n \"ariaLabelCloseBtn\": \"Gidde\",\n \"ariaLabelBackButton\": \"Mana ruovttoluotta\"\n}\n","import type { HNDesignsystemDrawer } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Drawer.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Drawer.nb-NO.json';\nimport nnNO from '../../resources/HN.Designsystem.Drawer.nn-NO.json';\nimport seNO from '../../resources/HN.Designsystem.Drawer.se-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemDrawer => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN_NYNORSK:\n return nnNO;\n case LanguageLocales.SAMI_NORTHERN:\n return seNO;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport Icon from '../Icon';\nimport ChevronLeft from '../Icons/ChevronLeft';\n\nimport styles from './DrawerBackButton.module.scss';\n\nexport interface DrawerBackButtonProps {\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Adds custom classes to the element. */\n className?: string;\n}\n\nconst DrawerBackButton: React.FC<DrawerBackButtonProps> = props => {\n const { ariaLabel = 'Tilbake', onClick, className } = props;\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>();\n\n const iconSize = useIsMobileBreakpoint() ? 38 : 48;\n\n return (\n <button ref={refObject} className={classNames(styles['back-button'], className)} aria-label={ariaLabel} onClick={onClick} type=\"button\">\n <span className={classNames(styles['back-button__inner-container'])}>\n <Icon svgIcon={ChevronLeft} color={'var(--color-action-graphics-onlight'} size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n};\n\nexport default DrawerBackButton;\n","import type React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { TitleTags } from '../Title';\n\nimport DrawerBackButton from './DrawerBackButton';\nimport Title from '../Title';\n\nimport styles from './DrawerHeaderContent.module.scss';\n\nexport interface DrawerHeaderContentProps {\n /** Title shown in the header */\n title?: React.ReactNode;\n /** id of the title element */\n titleId?: string;\n /** Ref passed to the title heading element */\n titleRef?: React.Ref<HTMLHeadingElement | null>;\n /** Changes the underlying element of the title. Default: h3 */\n titleHtmlMarkup?: TitleTags;\n /** Shows a back button before the title. When present the title is centered. */\n withBackButton?: boolean;\n /** Callback for the back button */\n onRequestBack?: () => void;\n /** Sets the aria-label of the back button */\n backButtonAriaLabel?: string;\n /** Adds custom classes to the root element. */\n className?: string;\n}\n\nconst DrawerHeaderContent: React.FC<DrawerHeaderContentProps> = props => {\n const { title, titleId, titleRef, titleHtmlMarkup = 'h3', withBackButton, onRequestBack, backButtonAriaLabel, className } = props;\n\n return (\n <div className={classNames(styles['header-content'], className)}>\n <span\n className={classNames(styles['header-content__title'], {\n [styles['header-content__title--centered']]: withBackButton,\n })}\n >\n <Title id={titleId} ref={titleRef} tabIndex={-1} htmlMarkup={titleHtmlMarkup} appearance=\"title3\">\n {title}\n </Title>\n </span>\n {withBackButton && (\n <DrawerBackButton ariaLabel={backButtonAriaLabel} onClick={onRequestBack} className={styles['header-content__back-button']} />\n )}\n </div>\n );\n};\n\nexport default DrawerHeaderContent;\n","import React, { useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\nimport { AnimatePresence, useAnimate, usePresence } from 'motion/react';\n\nimport type { HNDesignsystemDrawer } from '../../resources/Resources';\nimport type { TitleTags } from '../Title';\n\nimport { getResources } from './resourceHelper';\nimport { AnalyticsId, KeyboardEventKey, LanguageLocales, ZIndex } from '../../constants';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { useIsVisible } from '../../hooks/useIsVisible';\nimport { useKeyboardEvent } from '../../hooks/useKeyboardEvent';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport { useOutsideEvent } from '../../hooks/useOutsideEvent';\nimport { useReturnFocusOnUnmount } from '../../hooks/useReturnFocusOnUnmount';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { disableBodyScroll, enableBodyScroll } from '../../utils/scroll';\nimport uuid from '../../utils/uuid';\nimport Button from '../Button';\nimport Close from '../Close';\nimport DrawerHeaderContent from './DrawerHeaderContent';\n\nimport styles from './styles.module.scss';\n\ntype DesktopDirections = 'left' | 'right';\ntype PaddingSizes = 'normal' | 'extra';\n\nexport interface DrawerProps extends InnerDrawerProps {\n /** Opens and closes the drawer */\n isOpen: boolean;\n}\n\nexport interface InnerDrawerProps {\n /** Sets the aria-label of the drawer */\n ariaLabel?: string;\n /** Sets the aria-labelledby of the drawer */\n ariaLabelledBy?: string;\n /** Sets the style of the Drawer Close button. Meant for use by HelpDrawer */\n closeColor?: 'blueberry' | 'plum';\n /** Direction of the drawer on desktop. Default: left */\n desktopDirection?: DesktopDirections;\n /** Sets the style of the Drawer header */\n headerClasses?: string;\n /** Optional content that replaces the default title (and back button) in the header. The close button is still rendered. */\n headerContent?: React.ReactNode;\n /** Title to display in the header of the drawer */\n title?: string;\n /** id of the drawer title */\n titleId?: string;\n /** Changes the underlying element of the title. Default: h3 */\n titleHtmlMarkup?: TitleTags;\n /** Callback that triggers when clicking on close button or outside the drawer, update isOpen state when this triggers */\n onRequestClose?: () => void;\n /** Optional footer content that can be rendered instead of default CTA(s) */\n footerContent?: React.ReactNode;\n /** Main content of the drawer */\n children?: React.ReactNode;\n /** Hides the close button */\n noCloseButton?: boolean;\n /** Primary CTA callback */\n onPrimaryAction?: () => void;\n /** Text for primary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n primaryActionText?: string;\n /** Text for secondary CTA button if you want a default CTA button rendered (instead of `footerContent`) */\n secondaryActionText?: string;\n /** Secondary CTA callback */\n onSecondaryAction?: () => void;\n /** Customize the z-index of the drawer */\n zIndex?: number;\n /** Resources for component */\n resources?: Partial<HNDesignsystemDrawer>;\n /** Sets mobile styling and animation from outer level Drawer */\n isMobile?: boolean;\n /** Shows a back button to the left of title */\n withBackButton?: boolean;\n /** Callback for the back button */\n onRequestBack?: () => void;\n /** Sets classname for content part in Drawer */\n contentClassName?: string;\n /** Sets the content padding of the Drawer */\n paddingSize?: PaddingSizes;\n}\n\nconst Drawer: React.FC<DrawerProps> = props => {\n const { isOpen, ...rest } = props;\n const isMobile = useIsMobileBreakpoint();\n\n return <AnimatePresence>{isOpen && <InnerDrawer {...rest} isMobile={isMobile} />}</AnimatePresence>;\n};\n\nconst InnerDrawer: React.FC<InnerDrawerProps> = props => {\n const {\n ariaLabel,\n ariaLabelledBy,\n children,\n closeColor = 'blueberry',\n desktopDirection = 'left',\n footerContent,\n headerClasses,\n headerContent,\n noCloseButton = false,\n onPrimaryAction,\n onRequestClose,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n titleHtmlMarkup = 'h3',\n titleId = uuid(),\n zIndex = ZIndex.OverlayScreen,\n resources,\n isMobile,\n withBackButton,\n onRequestBack,\n contentClassName,\n paddingSize = 'normal',\n } = props;\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledBy, fallbackId: titleId });\n const overlayRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n // topContent and bottomContent are used to detect scroll position for shadow effects\n const topContent = useRef<HTMLDivElement>(null);\n const bottomContent = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const titleRef = useRef<HTMLHeadingElement>(null);\n const [scope, animate] = useAnimate();\n const [isPresent, safeToRemove] = usePresence();\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const topContentVisible = useIsVisible(topContent);\n const bottomContentVisible = useIsVisible(bottomContent, 0);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemDrawer = {\n ...defaultResources,\n ...resources,\n };\n\n // eslint-disable-next-line react-hooks/refs\n const contentIsScrollable = contentRef.current && contentRef.current.scrollHeight > contentRef.current.clientHeight;\n const headerStyling = classNames(\n styles.drawer__header,\n { [styles['drawer__header--padding-extra']]: paddingSize === 'extra' },\n headerClasses\n );\n const hasFooterContent = (typeof footerContent !== 'undefined' && footerContent) || onPrimaryAction || onSecondaryAction;\n\n useFocusTrap(containerRef, true);\n useReturnFocusOnUnmount(containerRef);\n useOutsideEvent(containerRef, () => {\n if (onRequestClose) onRequestClose();\n });\n useKeyboardEvent(containerRef, () => onRequestClose && onRequestClose(), [KeyboardEventKey.Escape]);\n\n // Close animasjon, vi kaller `onClose()` til slutt\n const closeDrawer = (): void => {\n if (!overlayRef.current || !containerRef.current) return;\n\n animate(overlayRef.current, { opacity: 0, pointerEvents: 'none' }, { duration: 0.3, ease: 'easeInOut' });\n\n if (isMobile) {\n animate(\n containerRef.current,\n { y: '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n } else {\n animate(\n containerRef.current,\n { x: desktopDirection === 'left' ? '-100%' : '100%' },\n {\n duration: 0.3,\n ease: 'easeInOut',\n onComplete: () => {\n if (safeToRemove) safeToRemove();\n },\n }\n );\n }\n };\n\n useEffect(() => {\n containerRef.current?.focus();\n disableBodyScroll();\n\n return (): void => {\n enableBodyScroll();\n };\n }, []);\n\n // Measure header and footer heights\n useEffect(() => {\n const updateHeights = (): void => {\n if (headerRef.current) {\n setHeaderHeight(headerRef.current.offsetHeight);\n }\n if (footerRef.current) {\n setFooterHeight(footerRef.current.offsetHeight);\n }\n };\n\n updateHeights();\n\n // Update heights when content changes\n const resizeObserver = new ResizeObserver(updateHeights);\n if (headerRef.current) {\n resizeObserver.observe(headerRef.current);\n }\n if (footerRef.current) {\n resizeObserver.observe(footerRef.current);\n }\n\n return (): void => {\n resizeObserver.disconnect();\n };\n }, [hasFooterContent]);\n\n // Open animation.\n useEffect(() => {\n if (!overlayRef.current || !containerRef.current) return;\n\n if (!isPresent) {\n closeDrawer();\n return;\n }\n\n if (isMobile) {\n animate(containerRef.current, { y: '0' }, { duration: 0.3, ease: 'easeInOut' });\n } else {\n animate(containerRef.current, { x: '0' }, { duration: 0.3, ease: 'easeInOut' });\n }\n\n animate(overlayRef.current, { opacity: 1, pointerEvents: 'auto' }, { duration: 0.3, ease: 'easeInOut' });\n }, [isPresent]);\n\n const handleCTA = (callback?: () => void): void => {\n if (callback) {\n callback();\n }\n };\n\n useEffect(() => {\n titleRef.current?.focus();\n }, [title]);\n\n const headerMain = (\n <DrawerHeaderContent\n title={title}\n titleId={ariaLabelAttributes?.['aria-labelledby']}\n titleRef={titleRef}\n titleHtmlMarkup={titleHtmlMarkup}\n withBackButton={withBackButton && onRequestBack !== undefined}\n onRequestBack={onRequestBack}\n backButtonAriaLabel={mergedResources.ariaLabelBackButton}\n />\n );\n\n return (\n <div className={styles.drawer} ref={scope} style={{ zIndex }} data-analyticsid={AnalyticsId.Drawer}>\n <div className={styles.drawer__overlay} ref={overlayRef} aria-hidden=\"true\" />\n <div\n className={classNames(styles.drawer__container, {\n [styles['drawer__container--right']]: desktopDirection === 'right',\n })}\n ref={containerRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n {...ariaLabelAttributes}\n >\n <div className={styles.drawer__container__inner}>\n <div className={headerStyling} ref={headerRef}>\n {headerContent ?? headerMain}\n {!noCloseButton && onRequestClose != undefined && (\n <Close\n ariaLabel={mergedResources.ariaLabelCloseBtn}\n color={closeColor}\n onClick={onRequestClose}\n className={styles['drawer__header__close-button']}\n />\n )}\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--top'])}\n style={{\n opacity: !topContentVisible && contentIsScrollable ? 1 : 0,\n top: headerHeight,\n }}\n />\n <div\n className={classNames(styles.drawer__content, contentClassName)}\n tabIndex={contentIsScrollable ? 0 : undefined}\n role={contentIsScrollable ? 'region' : undefined}\n {...(contentIsScrollable ? ariaLabelAttributes : {})}\n ref={contentRef}\n >\n <div ref={topContent} />\n <div\n className={classNames(styles['drawer__content__children'], {\n [styles['drawer__content__children--padding-extra']]: paddingSize === 'extra',\n })}\n >\n {children}\n </div>\n <div ref={bottomContent} style={{ height: '1px' }} />\n </div>\n <div\n className={classNames(styles['drawer__content__shadow'], styles['drawer__content__shadow--bottom'])}\n style={{\n opacity: !bottomContentVisible && contentIsScrollable ? 1 : 0,\n bottom: hasFooterContent ? footerHeight : 0,\n }}\n />\n </div>\n {hasFooterContent && (\n <div\n className={classNames(styles.drawer__footer, { [styles['drawer__footer--padding-extra']]: paddingSize === 'extra' })}\n ref={footerRef}\n >\n {footerContent ? (\n footerContent\n ) : (\n <>\n {onPrimaryAction && <Button onClick={() => handleCTA(onPrimaryAction)}>{primaryActionText}</Button>}\n {onSecondaryAction && (\n <Button variant=\"borderless\" onClick={() => handleCTA(onSecondaryAction)}>\n {secondaryActionText}\n </Button>\n )}\n </>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Drawer;\n","import Drawer from './Drawer';\nexport * from './Drawer';\nexport default Drawer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIQA,IAAa,gBAAgB,aAAoD;CAC/E,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB,mBACnB,OAAO;EACT,KAAK,gBAAgB,eACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACFA,IAAM,oBAAoD,UAAS;CACjE,MAAM,EAAE,YAAY,WAAW,SAAS,cAAc;CACtD,MAAM,EAAE,WAAW,cAAc,iBAAoC;CAErE,MAAM,WAAW,sBAAsB,IAAI,KAAK;CAEhD,OACE,oBAAC,UAAD;EAAQ,KAAK;EAAW,WAAW,GAAW,OAAO,gBAAgB,SAAS;EAAG,cAAY;EAAoB;EAAS,MAAK;YAC7H,oBAAC,QAAD;GAAM,WAAW,GAAW,OAAO,+BAA+B;aAChE,oBAAC,cAAD;IAAM,SAAS;IAAa,OAAO;IAAuC,MAAM;IAAqB;GAAY,CAAA;EAC7G,CAAA;CACA,CAAA;AAEZ;;;ACDA,IAAM,uBAA0D,UAAS;CACvE,MAAM,EAAE,OAAO,SAAS,UAAU,kBAAkB,MAAM,gBAAgB,eAAe,qBAAqB,cAAc;CAE5H,OACE,qBAAC,OAAD;EAAK,WAAW,GAAW,SAAO,mBAAmB,SAAS;YAA9D,CACE,oBAAC,QAAD;GACE,WAAW,GAAW,SAAO,0BAA0B,GACpD,SAAO,qCAAqC,eAC/C,CAAC;aAED,oBAAC,eAAD;IAAO,IAAI;IAAS,KAAK;IAAU,UAAU;IAAI,YAAY;I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;;AC1VA,IAAA,iBAAe"}
@@ -1,6 +1,9 @@
1
- import { t as Drawer_default } from "./Drawer.js";
2
- import { Children, createContext, isValidElement, useCallback, useContext, useMemo, useState } from "react";
1
+ import { t as uuid } from "./uuid.js";
2
+ import { n as DrawerHeaderContent, t as Drawer_default } from "./Drawer.js";
3
+ import { Children, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { animate, useReducedMotion } from "motion/react";
6
+ import styles from "./components/Filter/DrawerNavigation/styles.module.scss";
4
7
  //#region src/components/Filter/DrawerNavigation/useDrawerNavigation.ts
5
8
  var DrawerNavigationContext = createContext(null);
6
9
  function useDrawerNavigation() {
@@ -37,8 +40,20 @@ function parseChildren(children) {
37
40
  }
38
41
  function DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer }) {
39
42
  const { views, other } = useMemo(() => parseChildren(children), [children]);
43
+ const incomingContentRef = useRef(null);
44
+ const outgoingContentRef = useRef(null);
45
+ const incomingHeaderRef = useRef(null);
46
+ const outgoingHeaderRef = useRef(null);
47
+ const titleRef = useRef(null);
48
+ const titleId = useMemo(() => uuid(), []);
40
49
  const homeView = views.find((v) => v.home) ?? views[0];
41
50
  const [viewStack, setViewStack] = useState([homeView?.id]);
51
+ const prevStackLength = useRef(viewStack.length);
52
+ const prevView = useRef(void 0);
53
+ const reducedMotion = useReducedMotion();
54
+ const currentViewId = viewStack[viewStack.length - 1];
55
+ const currentView = views.find((v) => v.id === currentViewId);
56
+ const [outgoing, setOutgoing] = useState(null);
42
57
  const goToView = useCallback((id) => {
43
58
  if (views.some((v) => v.id === id)) setViewStack((stack) => [...stack, id]);
44
59
  }, [views]);
@@ -48,8 +63,48 @@ function DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer
48
63
  const goToViewAndClearStack = useCallback((id) => {
49
64
  if (views.some((v) => v.id === id)) setViewStack(id === homeView?.id ? [homeView.id] : [homeView?.id, id]);
50
65
  }, [views, homeView]);
51
- const currentViewId = viewStack[viewStack.length - 1];
52
- const currentView = views.find((v) => v.id === currentViewId);
66
+ useEffect(() => {
67
+ if (!isOpen) {
68
+ prevView.current = void 0;
69
+ return;
70
+ }
71
+ const previous = prevView.current;
72
+ prevView.current = currentView;
73
+ const previousStackLength = prevStackLength.current;
74
+ const dir = viewStack.length >= previousStackLength ? "left" : "right";
75
+ prevStackLength.current = viewStack.length;
76
+ if (isOpen && !reducedMotion && previous && currentView && previous.id !== currentView.id) setOutgoing({
77
+ view: previous,
78
+ dir,
79
+ withBackButton: previousStackLength > 1
80
+ });
81
+ }, [
82
+ viewStack,
83
+ currentView,
84
+ isOpen
85
+ ]);
86
+ useLayoutEffect(() => {
87
+ if (!outgoing || !incomingContentRef.current || !outgoingContentRef.current) return;
88
+ const incomingFrom = outgoing.dir === "left" ? "100%" : "-100%";
89
+ const outgoingTo = outgoing.dir === "left" ? "-100%" : "100%";
90
+ const options = {
91
+ duration: .3,
92
+ ease: "easeInOut"
93
+ };
94
+ animate(incomingContentRef.current, { x: [incomingFrom, "0%"] }, options);
95
+ if (incomingHeaderRef.current) animate(incomingHeaderRef.current, { x: [incomingFrom, "0%"] }, options);
96
+ if (outgoingHeaderRef.current) animate(outgoingHeaderRef.current, { x: ["0%", outgoingTo] }, options);
97
+ const leaving = animate(outgoingContentRef.current, { x: ["0%", outgoingTo] }, {
98
+ ...options,
99
+ onComplete: () => setOutgoing(null)
100
+ });
101
+ return () => {
102
+ leaving.stop();
103
+ };
104
+ }, [outgoing]);
105
+ useEffect(() => {
106
+ if (isOpen) titleRef.current?.focus();
107
+ }, [currentViewId, isOpen]);
53
108
  const navigate = useMemo(() => ({
54
109
  goBack,
55
110
  goToView,
@@ -65,18 +120,61 @@ function DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer
65
120
  if (!isOpen) setViewStack([homeView?.id]);
66
121
  else if (initialView && views.some((v) => v.id === initialView)) setViewStack(initialView === homeView?.id ? [homeView.id] : [homeView?.id, initialView]);
67
122
  }
123
+ const headerContent = /* @__PURE__ */ jsxs("div", {
124
+ className: styles.header,
125
+ style: { overflow: outgoing ? "hidden" : "visible" },
126
+ children: [outgoing && /* @__PURE__ */ jsx("div", {
127
+ ref: outgoingHeaderRef,
128
+ "aria-hidden": true,
129
+ inert: true,
130
+ className: styles["header__layer"],
131
+ style: {
132
+ position: "absolute",
133
+ inset: 0
134
+ },
135
+ children: /* @__PURE__ */ jsx(DrawerHeaderContent, {
136
+ title: outgoing.view.title,
137
+ withBackButton: outgoing.withBackButton,
138
+ onRequestBack: () => void 0
139
+ })
140
+ }), /* @__PURE__ */ jsx("div", {
141
+ ref: incomingHeaderRef,
142
+ className: styles["header__layer"],
143
+ children: /* @__PURE__ */ jsx(DrawerHeaderContent, {
144
+ title: currentView?.title,
145
+ titleId,
146
+ titleRef,
147
+ withBackButton: viewStack.length > 1,
148
+ onRequestBack: goBack
149
+ })
150
+ })]
151
+ });
68
152
  return /* @__PURE__ */ jsxs(DrawerNavigationContext.Provider, {
69
153
  value: navigate,
70
154
  children: [/* @__PURE__ */ jsx(Drawer_default, {
71
155
  isOpen,
72
- title: currentView?.title ?? "Filter",
73
- withBackButton: viewStack.length > 1,
74
- onRequestBack: goBack,
75
156
  onRequestClose: currentView?.onCloseButton ?? onCloseButton,
76
157
  footerContent: currentView?.footer ?? footer,
77
158
  contentClassName: currentView?.drawerContentClassname,
78
159
  paddingSize: "extra",
79
- children: currentView?.children
160
+ headerContent,
161
+ children: /* @__PURE__ */ jsxs("div", {
162
+ className: styles["content"],
163
+ style: { overflow: outgoing ? "hidden" : "visible" },
164
+ children: [outgoing && /* @__PURE__ */ jsx("div", {
165
+ ref: outgoingContentRef,
166
+ "aria-hidden": true,
167
+ inert: true,
168
+ style: {
169
+ position: "absolute",
170
+ width: "100%"
171
+ },
172
+ children: outgoing.view.children
173
+ }), /* @__PURE__ */ jsx("div", {
174
+ ref: incomingContentRef,
175
+ children: currentView?.children
176
+ })]
177
+ })
80
178
  }), other]
81
179
  });
82
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerNavigation.js","names":[],"sources":["../src/components/Filter/DrawerNavigation/useDrawerNavigation.ts","../src/components/Filter/DrawerNavigation/DrawerNavigation.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface NavigateProps<ViewId extends string = string> {\n goToView: (id: ViewId) => void;\n goBack: () => void;\n goToViewAndClearStack: (id: ViewId) => void;\n}\n\nexport const DrawerNavigationContext = createContext<NavigateProps | null>(null);\n\nexport function useDrawerNavigation<ViewId extends string = string>(): NavigateProps<ViewId> {\n const context = useContext(DrawerNavigationContext);\n if (!context) {\n throw new Error('useDrawerNavigation must be used inside a <DrawerNavigation> component');\n }\n return context as NavigateProps<ViewId>;\n}\n","import type React from 'react';\nimport { Children, isValidElement, useCallback, useMemo, useState } from 'react';\n\nimport { type NavigateProps, DrawerNavigationContext } from './useDrawerNavigation';\nimport Drawer from '../../Drawer';\n\nexport interface DrawerViewProps<ViewId extends string = string> {\n /** Id for the view. Important for navigation */\n id: ViewId;\n /** Title used for Drawer in current view */\n title: string;\n /** Mark this view as the home/default view */\n home?: boolean;\n /** Content inside the drawer for this view */\n children: React.ReactNode;\n /** Default onClose callback for drawer. Will override onCloseButton on parent */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. Will override footer on parent */\n footer?: React.ReactNode;\n /** Classname set on the content inside Drawer */\n drawerContentClassname?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction DrawerView<ViewId extends string>(_props: DrawerViewProps<ViewId>): React.ReactNode {\n // DrawerView is never rendered directly — DrawerNavigation reads its props\n return null;\n}\n\nexport interface DrawerNavigationProps {\n /** Views and other children components inside the Drawer navigation. Views are put in stack */\n children: React.ReactNode;\n /** Is drawer open or closed */\n isOpen: boolean;\n /** Navigate to this view when the drawer opens. Defaults to home view. */\n initialView?: string;\n /** Default onClose callback for drawer. View onCloseButton callback will override this. */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. View footer will override this */\n footer?: React.ReactNode;\n}\n\nfunction parseChildren(children: React.ReactNode): { views: DrawerViewProps[]; other: React.ReactNode[] } {\n const views: DrawerViewProps[] = [];\n const other: React.ReactNode[] = [];\n Children.forEach(children, child => {\n if (isValidElement<DrawerViewProps>(child) && child.type === DrawerView) {\n views.push({\n id: child.props.id,\n title: child.props.title,\n home: child.props.home,\n children: child.props.children,\n onCloseButton: child.props.onCloseButton,\n footer: child.props.footer,\n drawerContentClassname: child.props.drawerContentClassname,\n });\n } else {\n /** Added possibility of other children to support Modals that need navigation context */\n other.push(child);\n }\n });\n return { views, other };\n}\n\nfunction DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer }: DrawerNavigationProps): React.ReactNode {\n const { views, other } = useMemo(() => parseChildren(children), [children]);\n\n const homeView = views.find(v => v.home) ?? views[0];\n const [viewStack, setViewStack] = useState<string[]>([homeView?.id]);\n\n const goToView = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(stack => [...stack, id]);\n }\n },\n [views]\n );\n\n const goBack = useCallback((): void => {\n setViewStack(stack => (stack.length > 1 ? stack.slice(0, -1) : stack));\n }, []);\n\n const goToViewAndClearStack = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(id === homeView?.id ? [homeView.id] : [homeView?.id, id]);\n }\n },\n [views, homeView]\n );\n\n const currentViewId = viewStack[viewStack.length - 1];\n const currentView = views.find(v => v.id === currentViewId);\n\n const navigate = useMemo<NavigateProps>(() => ({ goBack, goToView, goToViewAndClearStack }), [goBack, goToView, goToViewAndClearStack]);\n\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setViewStack([homeView?.id]);\n } else if (initialView && views.some(v => v.id === initialView)) {\n setViewStack(initialView === homeView?.id ? [homeView.id] : [homeView?.id, initialView]);\n }\n }\n\n return (\n <DrawerNavigationContext.Provider value={navigate}>\n <Drawer\n isOpen={isOpen}\n title={currentView?.title ?? 'Filter'}\n withBackButton={viewStack.length > 1}\n onRequestBack={goBack}\n onRequestClose={currentView?.onCloseButton ?? onCloseButton}\n footerContent={currentView?.footer ?? footer}\n contentClassName={currentView?.drawerContentClassname}\n paddingSize={'extra'}\n >\n {currentView?.children}\n </Drawer>\n {other}\n </DrawerNavigationContext.Provider>\n );\n}\n\nDrawerNavigation.View = DrawerView;\n\nexport default DrawerNavigation;\n"],"mappings":";;;;AAQA,IAAa,0BAA0B,cAAoC,IAAI;AAE/E,SAAgB,sBAA6E;CAC3F,MAAM,UAAU,WAAW,uBAAuB;CAClD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,wEAAwE;CAE1F,OAAO;AACT;;;ACQA,SAAS,WAAkC,QAAkD;CAE3F,OAAO;AACT;AAeA,SAAS,cAAc,UAAmF;CACxG,MAAM,QAA2B,CAAC;CAClC,MAAM,QAA2B,CAAC;CAClC,SAAS,QAAQ,WAAU,UAAS;EAClC,IAAI,eAAgC,KAAK,KAAK,MAAM,SAAS,YAC3D,MAAM,KAAK;GACT,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM,MAAM;GACnB,MAAM,MAAM,MAAM;GAClB,UAAU,MAAM,MAAM;GACtB,eAAe,MAAM,MAAM;GAC3B,QAAQ,MAAM,MAAM;GACpB,wBAAwB,MAAM,MAAM;EACtC,CAAC;;;EAGD,MAAM,KAAK,KAAK;CAEpB,CAAC;CACD,OAAO;EAAE;EAAO;CAAM;AACxB;AAEA,SAAS,iBAAiB,EAAE,UAAU,QAAQ,aAAa,eAAe,UAAkD;CAC1H,MAAM,EAAE,OAAO,UAAU,cAAc,cAAc,QAAQ,GAAG,CAAC,QAAQ,CAAC;CAE1E,MAAM,WAAW,MAAM,MAAK,MAAK,EAAE,IAAI,KAAK,MAAM;CAClD,MAAM,CAAC,WAAW,gBAAgB,SAAmB,CAAC,UAAU,EAAE,CAAC;CAEnE,MAAM,W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OAAO"}
1
+ {"version":3,"file":"DrawerNavigation.js","names":[],"sources":["../src/components/Filter/DrawerNavigation/useDrawerNavigation.ts","../src/components/Filter/DrawerNavigation/DrawerNavigation.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface NavigateProps<ViewId extends string = string> {\n goToView: (id: ViewId) => void;\n goBack: () => void;\n goToViewAndClearStack: (id: ViewId) => void;\n}\n\nexport const DrawerNavigationContext = createContext<NavigateProps | null>(null);\n\nexport function useDrawerNavigation<ViewId extends string = string>(): NavigateProps<ViewId> {\n const context = useContext(DrawerNavigationContext);\n if (!context) {\n throw new Error('useDrawerNavigation must be used inside a <DrawerNavigation> component');\n }\n return context as NavigateProps<ViewId>;\n}\n","import type React from 'react';\nimport { Children, isValidElement, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { animate, useReducedMotion } from 'motion/react';\n\nimport { type NavigateProps, DrawerNavigationContext } from './useDrawerNavigation';\nimport uuid from '../../../utils/uuid';\nimport Drawer from '../../Drawer';\nimport DrawerHeaderContent from '../../Drawer/DrawerHeaderContent';\n\nimport styles from './styles.module.scss';\n\nexport interface DrawerViewProps<ViewId extends string = string> {\n /** Id for the view. Important for navigation */\n id: ViewId;\n /** Title used for Drawer in current view */\n title: string;\n /** Mark this view as the home/default view */\n home?: boolean;\n /** Content inside the drawer for this view */\n children: React.ReactNode;\n /** Default onClose callback for drawer. Will override onCloseButton on parent */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. Will override footer on parent */\n footer?: React.ReactNode;\n /** Classname set on the content inside Drawer */\n drawerContentClassname?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction DrawerView<ViewId extends string>(_props: DrawerViewProps<ViewId>): React.ReactNode {\n // DrawerView is never rendered directly — DrawerNavigation reads its props\n return null;\n}\n\nexport interface DrawerNavigationProps {\n /** Views and other children components inside the Drawer navigation. Views are put in stack */\n children: React.ReactNode;\n /** Is drawer open or closed */\n isOpen: boolean;\n /** Navigate to this view when the drawer opens. Defaults to home view. */\n initialView?: string;\n /** Default onClose callback for drawer. View onCloseButton callback will override this. */\n onCloseButton?: () => void;\n /** Content sent to footer section of Drawer. View footer will override this */\n footer?: React.ReactNode;\n}\n\nfunction parseChildren(children: React.ReactNode): { views: DrawerViewProps[]; other: React.ReactNode[] } {\n const views: DrawerViewProps[] = [];\n const other: React.ReactNode[] = [];\n Children.forEach(children, child => {\n if (isValidElement<DrawerViewProps>(child) && child.type === DrawerView) {\n views.push({\n id: child.props.id,\n title: child.props.title,\n home: child.props.home,\n children: child.props.children,\n onCloseButton: child.props.onCloseButton,\n footer: child.props.footer,\n drawerContentClassname: child.props.drawerContentClassname,\n });\n } else {\n /** Added possibility of other children to support Modals that need navigation context */\n other.push(child);\n }\n });\n return { views, other };\n}\n\nfunction DrawerNavigation({ children, isOpen, initialView, onCloseButton, footer }: DrawerNavigationProps): React.ReactNode {\n const { views, other } = useMemo(() => parseChildren(children), [children]);\n\n const incomingContentRef = useRef<HTMLDivElement>(null);\n const outgoingContentRef = useRef<HTMLDivElement>(null);\n const incomingHeaderRef = useRef<HTMLDivElement>(null);\n const outgoingHeaderRef = useRef<HTMLDivElement>(null);\n const titleRef = useRef<HTMLHeadingElement>(null);\n const titleId = useMemo(() => uuid(), []);\n const homeView = views.find(v => v.home) ?? views[0];\n const [viewStack, setViewStack] = useState<string[]>([homeView?.id]);\n const prevStackLength = useRef<number>(viewStack.length);\n const prevView = useRef<DrawerViewProps | undefined>(undefined);\n const reducedMotion = useReducedMotion();\n\n const currentViewId = viewStack[viewStack.length - 1];\n const currentView = views.find(v => v.id === currentViewId);\n\n // The previous view, kept mounted as an overlay while it slides out during a navigation transition\n const [outgoing, setOutgoing] = useState<{ view: DrawerViewProps; dir: 'left' | 'right'; withBackButton: boolean } | null>(null);\n\n const goToView = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(stack => [...stack, id]);\n }\n },\n [views]\n );\n\n const goBack = useCallback((): void => {\n setViewStack(stack => (stack.length > 1 ? stack.slice(0, -1) : stack));\n }, []);\n\n const goToViewAndClearStack = useCallback(\n (id: string): void => {\n if (views.some(v => v.id === id)) {\n setViewStack(id === homeView?.id ? [homeView.id] : [homeView?.id, id]);\n }\n },\n [views, homeView]\n );\n\n // Detect a navigation and capture the outgoing view + direction\n useEffect(() => {\n if (!isOpen) {\n prevView.current = undefined;\n return;\n }\n\n const previous = prevView.current;\n prevView.current = currentView;\n\n const previousStackLength = prevStackLength.current;\n const dir: 'left' | 'right' = viewStack.length >= previousStackLength ? 'left' : 'right';\n prevStackLength.current = viewStack.length;\n\n if (isOpen && !reducedMotion && previous && currentView && previous.id !== currentView.id) {\n setOutgoing({ view: previous, dir, withBackButton: previousStackLength > 1 });\n }\n }, [viewStack, currentView, isOpen]);\n\n // Animates the incoming and outgoing views\n useLayoutEffect(() => {\n if (!outgoing || !incomingContentRef.current || !outgoingContentRef.current) {\n return;\n }\n\n const incomingFrom = outgoing.dir === 'left' ? '100%' : '-100%';\n const outgoingTo = outgoing.dir === 'left' ? '-100%' : '100%';\n const options = { duration: 0.3, ease: 'easeInOut' } as const;\n\n animate(incomingContentRef.current, { x: [incomingFrom, '0%'] }, options);\n if (incomingHeaderRef.current) {\n animate(incomingHeaderRef.current, { x: [incomingFrom, '0%'] }, options);\n }\n if (outgoingHeaderRef.current) {\n animate(outgoingHeaderRef.current, { x: ['0%', outgoingTo] }, options);\n }\n const leaving = animate(outgoingContentRef.current, { x: ['0%', outgoingTo] }, { ...options, onComplete: () => setOutgoing(null) });\n\n return (): void => {\n leaving.stop();\n };\n }, [outgoing]);\n\n // Moves focus between incoming and outgoing view\n useEffect(() => {\n if (isOpen) {\n titleRef.current?.focus();\n }\n }, [currentViewId, isOpen]);\n\n const navigate = useMemo<NavigateProps>(() => ({ goBack, goToView, goToViewAndClearStack }), [goBack, goToView, goToViewAndClearStack]);\n\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setViewStack([homeView?.id]);\n } else if (initialView && views.some(v => v.id === initialView)) {\n setViewStack(initialView === homeView?.id ? [homeView.id] : [homeView?.id, initialView]);\n }\n }\n\n const headerContent = (\n <div className={styles.header} style={{ overflow: outgoing ? 'hidden' : 'visible' }}>\n {outgoing && (\n <div ref={outgoingHeaderRef} aria-hidden inert className={styles['header__layer']} style={{ position: 'absolute', inset: 0 }}>\n <DrawerHeaderContent title={outgoing.view.title} withBackButton={outgoing.withBackButton} onRequestBack={() => undefined} />\n </div>\n )}\n <div ref={incomingHeaderRef} className={styles['header__layer']}>\n <DrawerHeaderContent\n title={currentView?.title}\n titleId={titleId}\n titleRef={titleRef}\n withBackButton={viewStack.length > 1}\n onRequestBack={goBack}\n />\n </div>\n </div>\n );\n\n return (\n <DrawerNavigationContext.Provider value={navigate}>\n <Drawer\n isOpen={isOpen}\n onRequestClose={currentView?.onCloseButton ?? onCloseButton}\n footerContent={currentView?.footer ?? footer}\n contentClassName={currentView?.drawerContentClassname}\n paddingSize={'extra'}\n headerContent={headerContent}\n >\n <div className={styles['content']} style={{ overflow: outgoing ? 'hidden' : 'visible' }}>\n {outgoing && (\n <div ref={outgoingContentRef} aria-hidden inert style={{ position: 'absolute', width: '100%' }}>\n {outgoing.view.children}\n </div>\n )}\n <div ref={incomingContentRef}>{currentView?.children}</div>\n </div>\n </Drawer>\n {other}\n </DrawerNavigationContext.Provider>\n );\n}\n\nDrawerNavigation.View = DrawerView;\n\nexport default DrawerNavigation;\n"],"mappings":";;;;;;;AAQA,IAAa,0BAA0B,cAAoC,IAAI;AAE/E,SAAgB,sBAA6E;CAC3F,MAAM,UAAU,WAAW,uBAAuB;CAClD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,wEAAwE;CAE1F,OAAO;AACT;;;ACcA,SAAS,WAAkC,QAAkD;CAE3F,OAAO;AACT;AAeA,SAAS,cAAc,UAAmF;CACxG,MAAM,QAA2B,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C,gBAAD;GACU;GACR,gBAAgB,aAAa,iBAAiB;GAC9C,eAAe,aAAa,UAAU;GACtC,kBAAkB,aAAa;GAC/B,aAAa;GACE;aAEf,qBAAC,OAAD;IAAK,WAAW,OAAO;IAAY,OAAO,EAAE,UAAU,WAAW,WAAW,UAAU;cAAtF,CACG,YACC,oBAAC,OAAD;KAAK,KAAK;KAAoB,eAAA;KAAY,OAAA;KAAM,OAAO;MAAE,UAAU;MAAY,OAAO;KAAO;eAC1F,SAAS,KAAK;IACZ,CAAA,GAEP,oBAAC,OAAD;KAAK,KAAK;eAAqB,aAAa;IAAc,CAAA,CACvD;;EACC,CAAA,GACP,KAC+B;;AAEtC;AAEA,iBAAiB,OAAO"}
package/lib/InfoTeaser.js CHANGED
@@ -3,8 +3,9 @@ import { t as Icon_default } from "./Icon.js";
3
3
  import { useLanguage } from "./hooks/useLanguage.js";
4
4
  import { t as LazyIcon_default } from "./LazyIcon.js";
5
5
  import Title_default from "./components/Title/index.js";
6
+ import { useExpand } from "./hooks/useExpand.js";
6
7
  import cn from "classnames";
7
- import { useId, useState } from "react";
8
+ import { useId } from "react";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import styles from "./components/InfoTeaser/styles.module.scss";
10
11
  var HN_Designsystem_InfoTeaser_en_GB_default = {
@@ -27,8 +28,8 @@ var getResources = (language) => {
27
28
  //#endregion
28
29
  //#region src/components/InfoTeaser/InfoTeaser.tsx
29
30
  var InfoTeaser = (props) => {
30
- const { buttonClassName, children, className, htmlMarkup = "div", resources, svgIcon, testId, title, titleHtmlMarkup = "h2", collapsedMaxHeight } = props;
31
- const [expanded, setExpanded] = useState(false);
31
+ const { buttonClassName, children, className, expanded = false, htmlMarkup = "div", onExpand, resources, svgIcon, testId, title, titleHtmlMarkup = "h2", collapsedMaxHeight } = props;
32
+ const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);
32
33
  const { language } = useLanguage(LanguageLocales.NORWEGIAN);
33
34
  const defaultResources = getResources(language);
34
35
  const infoteaserTextId = useId();
@@ -41,8 +42,8 @@ var InfoTeaser = (props) => {
41
42
  "data-testid": testId,
42
43
  "data-analyticsid": AnalyticsId.InfoTeaser,
43
44
  children: [/* @__PURE__ */ jsxs("div", {
44
- className: cn(styles.infoteaser, className, { [styles["infoteaser--collapsed"]]: !expanded }),
45
- style: { maxHeight: !expanded ? collapsedMaxHeight ? collapsedMaxHeight : "12.25rem" : void 0 },
45
+ className: cn(styles.infoteaser, className, { [styles["infoteaser--collapsed"]]: !isExpanded }),
46
+ style: { maxHeight: !isExpanded ? collapsedMaxHeight ? collapsedMaxHeight : "12.25rem" : void 0 },
46
47
  children: [
47
48
  svgIcon && (typeof svgIcon === "string" ? /* @__PURE__ */ jsx(LazyIcon_default, {
48
49
  iconName: svgIcon,
@@ -62,7 +63,7 @@ var InfoTeaser = (props) => {
62
63
  }),
63
64
  /* @__PURE__ */ jsx("div", {
64
65
  className: styles.infoteaser__text,
65
- "aria-hidden": expanded ? false : true,
66
+ "aria-hidden": isExpanded ? false : true,
66
67
  id: infoteaserTextId,
67
68
  children
68
69
  })
@@ -71,11 +72,11 @@ var InfoTeaser = (props) => {
71
72
  type: "button",
72
73
  className: cn(styles.infoteaser__button, buttonClassName),
73
74
  onClick: () => {
74
- setExpanded(!expanded);
75
+ setIsExpanded(!isExpanded);
75
76
  },
76
- "aria-expanded": expanded,
77
+ "aria-expanded": isExpanded,
77
78
  "aria-controls": infoteaserTextId,
78
- children: expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose
79
+ children: isExpanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose
79
80
  })]
80
81
  });
81
82
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InfoTeaser.js","names":[],"sources":["../src/resources/HN.Designsystem.InfoTeaser.en-GB.json","../src/resources/HN.Designsystem.InfoTeaser.nb-NO.json","../src/components/InfoTeaser/resourceHelper.ts","../src/components/InfoTeaser/InfoTeaser.tsx","../src/components/InfoTeaser/index.ts"],"sourcesContent":["{\n \"expandButtonOpen\": \"Show less\",\n \"expandButtonClose\": \"Show more\"\n}\n","{\n \"expandButtonOpen\": \"Vis mindre\",\n \"expandButtonClose\": \"Vis mer\"\n}\n","import type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.InfoTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.InfoTeaser.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemInfoTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useId, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\nimport type { SvgIcon } from '../Icon';\nimport type { IconName } from '../Icons/IconNames';\nimport type { TitleTags } from '../Title';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport Icon, { IconSize } from '../Icon';\nimport LazyIcon from '../LazyIcon';\nimport Title from '../Title';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport type InfoTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface InfoTeaserProps {\n /** For overriding styling on the button */\n buttonClassName?: string;\n /** What's in the box? */\n children: React.ReactNode;\n /** Override the default max height for collapsed teaser. Default is 12.25rem */\n collapsedMaxHeight?: string;\n /** For overriding styling on infoteaser box */\n className?: string;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: InfoTeaserTags;\n /** Resources for component */\n resources?: Partial<HNDesignsystemInfoTeaser>;\n /** Adds an icon */\n svgIcon?: SvgIcon | IconName;\n /** Sets the data-testid attribute */\n testId?: string;\n /** Title on top of the component */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\nconst InfoTeaser: React.FC<InfoTeaserProps> = props => {\n const {\n buttonClassName,\n children,\n className,\n htmlMarkup = 'div',\n resources,\n svgIcon,\n testId,\n title,\n titleHtmlMarkup = 'h2',\n collapsedMaxHeight,\n } = props;\n const [expanded, setExpanded] = useState(false);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const infoteaserTextId = useId();\n\n const mergedResources: HNDesignsystemInfoTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n const WrapperTag = htmlMarkup;\n\n return (\n <WrapperTag className={styles.wrapper} data-testid={testId} data-analyticsid={AnalyticsId.InfoTeaser}>\n <div\n className={classNames(styles.infoteaser, className, {\n [styles['infoteaser--collapsed']]: !expanded,\n })}\n style={{ maxHeight: !expanded ? (collapsedMaxHeight ? collapsedMaxHeight : '12.25rem') : undefined }}\n >\n {svgIcon &&\n (typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.Small} className={styles.infoteaser__icon} />\n ) : (\n <Icon svgIcon={svgIcon} size={IconSize.Small} className={styles.infoteaser__icon} />\n ))}\n {title && typeof title !== 'undefined' && (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\" className={styles.infoteaser__title}>\n {title}\n </Title>\n )}\n <div className={styles.infoteaser__text} aria-hidden={expanded ? false : true} id={infoteaserTextId}>\n {children}\n </div>\n </div>\n <button\n type=\"button\"\n className={classNames(styles.infoteaser__button, buttonClassName)}\n onClick={() => {\n setExpanded(!expanded);\n }}\n aria-expanded={expanded}\n aria-controls={infoteaserTextId}\n >\n {expanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default InfoTeaser;\n","import InfoTeaser from './InfoTeaser';\nexport * from './InfoTeaser';\nexport default InfoTeaser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AEMA,IAAa,gBAAgB,aAAwD;CACnF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SAC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ources":["../src/resources/HN.Designsystem.InfoTeaser.en-GB.json","../src/resources/HN.Designsystem.InfoTeaser.nb-NO.json","../src/components/InfoTeaser/resourceHelper.ts","../src/components/InfoTeaser/InfoTeaser.tsx","../src/components/InfoTeaser/index.ts"],"sourcesContent":["{\n \"expandButtonOpen\": \"Show less\",\n \"expandButtonClose\": \"Show more\"\n}\n","{\n \"expandButtonOpen\": \"Vis mindre\",\n \"expandButtonClose\": \"Vis mer\"\n}\n","import type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.InfoTeaser.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.InfoTeaser.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemInfoTeaser => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { HNDesignsystemInfoTeaser } from '../../resources/Resources';\nimport type { SvgIcon } from '../Icon';\nimport type { IconName } from '../Icons/IconNames';\nimport type { TitleTags } from '../Title';\n\nimport { AnalyticsId, LanguageLocales } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useLanguage } from '../../hooks/useLanguage';\nimport Icon, { IconSize } from '../Icon';\nimport LazyIcon from '../LazyIcon';\nimport Title from '../Title';\nimport { getResources } from './resourceHelper';\n\nimport styles from './styles.module.scss';\n\nexport type InfoTeaserTags = 'div' | 'section' | 'aside' | 'article';\n\nexport interface InfoTeaserProps {\n /** For overriding styling on the button */\n buttonClassName?: string;\n /** What's in the box? */\n children: React.ReactNode;\n /** Override the default max height for collapsed teaser. Default is 12.25rem */\n collapsedMaxHeight?: string;\n /** For overriding styling on infoteaser box */\n className?: string;\n /** Opens or closes the teaser */\n expanded?: boolean;\n /** Changes the underlying element of the wrapper */\n htmlMarkup?: InfoTeaserTags;\n /** Called when the teaser is expanded/collapsed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemInfoTeaser>;\n /** Adds an icon */\n svgIcon?: SvgIcon | IconName;\n /** Sets the data-testid attribute */\n testId?: string;\n /** Title on top of the component */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\nconst InfoTeaser: React.FC<InfoTeaserProps> = props => {\n const {\n buttonClassName,\n children,\n className,\n expanded = false,\n htmlMarkup = 'div',\n onExpand,\n resources,\n svgIcon,\n testId,\n title,\n titleHtmlMarkup = 'h2',\n collapsedMaxHeight,\n } = props;\n const [isExpanded, setIsExpanded] = useExpand(expanded, onExpand);\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n const infoteaserTextId = useId();\n\n const mergedResources: HNDesignsystemInfoTeaser = {\n ...defaultResources,\n ...resources,\n };\n\n const WrapperTag = htmlMarkup;\n\n return (\n <WrapperTag className={styles.wrapper} data-testid={testId} data-analyticsid={AnalyticsId.InfoTeaser}>\n <div\n className={classNames(styles.infoteaser, className, {\n [styles['infoteaser--collapsed']]: !isExpanded,\n })}\n style={{ maxHeight: !isExpanded ? (collapsedMaxHeight ? collapsedMaxHeight : '12.25rem') : undefined }}\n >\n {svgIcon &&\n (typeof svgIcon === 'string' ? (\n <LazyIcon iconName={svgIcon} size={IconSize.Small} className={styles.infoteaser__icon} />\n ) : (\n <Icon svgIcon={svgIcon} size={IconSize.Small} className={styles.infoteaser__icon} />\n ))}\n {title && typeof title !== 'undefined' && (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\" className={styles.infoteaser__title}>\n {title}\n </Title>\n )}\n <div className={styles.infoteaser__text} aria-hidden={isExpanded ? false : true} id={infoteaserTextId}>\n {children}\n </div>\n </div>\n <button\n type=\"button\"\n className={classNames(styles.infoteaser__button, buttonClassName)}\n onClick={() => {\n setIsExpanded(!isExpanded);\n }}\n aria-expanded={isExpanded}\n aria-controls={infoteaserTextId}\n >\n {isExpanded ? mergedResources.expandButtonOpen : mergedResources.expandButtonClose}\n </button>\n </WrapperTag>\n );\n};\n\nexport default InfoTeaser;\n","import InfoTeaser from './InfoTeaser';\nexport * from './InfoTeaser';\nexport default InfoTeaser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AEMA,IAAa,gBAAgB,aAAwD;CACnF,QAAQ,UAAR;EACE,KAAK,gBAAgB,SACnB,OAAO;EACT,KAAK,gBAAgB;EACrB,SACE,OAAO;CACX;AACF;;;ACkCA,IAAM,cAAwC,UAAS;CACrD,MAAM,EACJ,iBACA,UACA,WACA,WAAW,OACX,aAAa,OACb,UACA,WACA,SACA,QACA,OACA,kBAAkB,MAClB,uBACE;CACJ,MAAM,CAAC,YAAY,iBAAiB,UAAU,UAAU,QAAQ;CAChE,MAAM,EAAE,aAAa,YAA6B,gBAAgB,SAAS;CAC3E,MAAM,mBAAmB,aAAa,QAAQ;CAC9C,MAAM,mBAAmB,MAAM;CAE/B,MAAM,kBAA4C;EAChD,GAAG;EACH,GAAG;CACL;CAIA,OACE,qBAAC,YAAD;EAAY,WAAW,OAAO;EAAS,eAAa;EAAQ,oBAAkB,YAAY;YAA1F,CACE,qBAAC,OAAD;GACE,WAAW,GAAW,OAAO,YAAY,WAAW,GACjD,OAAO,2BAA2B,CAAC,WACtC,CAAC;GACD,OAAO,EAAE,WAAW,CAAC,aAAc,qBAAqB,qBAAqB,aAAc,KAAA,EAAU;aAJvG;IAMG,YACE,OAAO,YAAY,WAClB,oBAAC,kBAAD;KAAU,UAAU;KAAS,MAAM,SAAS;KAAO,WAAW,OAAO;IAAmB,CAAA,IAExF,oBAAC,cAAD;KAAe;KAAS,MAAM,SAAS;KAAO,WAAW,OAAO;IAAmB,CAAA;IAEtF,SAAS,OAAO,UAAU,eACzB,oBAAC,eAAD;KAAO,QAAO;KAAU,YAAY;KAAiB,YAAW;KAAS,WAAW,OAAO;eACxF;IACI,CAAA;IAET,oBAAC,OAAD;KAAK,WAAW,OAAO;KAAkB,eAAa,aAAa,QAAQ;KAAM,IAAI;KAClF;IACE,CAAA;GACF;MACL,oBAAC,UAAD;GACE,MAAK;GACL,WAAW,GAAW,OAAO,oBAAoB,eAAe;GAChE,eAAe;IACb,cAAc,CAAC,UAAU;GAC3B;GACA,iBAAe;GACf,iBAAe;aAEd,aAAa,gBAAgB,mBAAmB,gBAAgB;EAC3D,CAAA,CACE;;AAEhB;;;AC7GA,IAAA,qBAAe"}
package/lib/LazyIcon.js CHANGED
@@ -320,6 +320,8 @@ var LazyIcon = ({ iconName, size = IconSize.Small, ...rest }) => {
320
320
  "../Icons/TeddyBear.tsx": () => import("./components/Icons/TeddyBear.js"),
321
321
  "../Icons/Teenagers.tsx": () => import("./components/Icons/Teenagers.js"),
322
322
  "../Icons/ThinkingAboutBaby.tsx": () => import("./components/Icons/ThinkingAboutBaby.js"),
323
+ "../Icons/ThumbsDown.tsx": () => import("./components/Icons/ThumbsDown.js"),
324
+ "../Icons/ThumbsUp.tsx": () => import("./components/Icons/ThumbsUp.js"),
323
325
  "../Icons/Ticket.tsx": () => import("./components/Icons/Ticket.js"),
324
326
  "../Icons/TimePassing.tsx": () => import("./components/Icons/TimePassing.js"),
325
327
  "../Icons/Toddler.tsx": () => import("./components/Icons/Toddler.js"),