@oslokommune/punkt-react 19.10.0 → 19.11.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.
@@ -4565,7 +4565,7 @@ var Kr = null, qr = () => Kr || (Kr = new Promise((e, t) => {
4565
4565
  hotjarId: i,
4566
4566
  googleAnalyticsId: a
4567
4567
  };
4568
- let g = p(() => {}), v = Object.hasOwn(we.i18n, o) ? o : "nb", y = l ?? we.i18n[v].contentPresentation.buttons.settings;
4568
+ let g = p(() => {}), v = Object.prototype.hasOwnProperty.call(we.i18n, o) ? o : "nb", y = l ?? we.i18n[v].contentPresentation.buttons.settings;
4569
4569
  c(() => {
4570
4570
  let e = !1, t, n, r = h.current;
4571
4571
  window.cookieBanner_googleAnalyticsId = r.googleAnalyticsId, window.cookieBanner_hotjarId = r.hotjarId, r.cookieDomain && (window.cookieBanner_cookieDomain = r.cookieDomain), r.cookieSecure && (window.cookieBanner_cookieSecure = r.cookieSecure), r.cookieExpiryDays && (window.cookieBanner_cookieExpiryDays = r.cookieExpiryDays), r.devMode && (window.cookieBanner_devMode = r.devMode);
@@ -5900,7 +5900,10 @@ var oa = "is-scroll-locked", sa = 0, ca = 0, la = () => typeof document < "u" &&
5900
5900
  n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${ca}px`, e.style.left = "0", e.style.right = "0", e.style.width = "100%", e.style.overflow = "hidden", t.classList.add(oa);
5901
5901
  }, da = () => {
5902
5902
  let e = document.body, t = document.documentElement;
5903
- e.style.removeProperty("position"), e.style.removeProperty("top"), e.style.removeProperty("left"), e.style.removeProperty("right"), e.style.removeProperty("width"), e.style.removeProperty("overflow"), e.style.removeProperty("padding-right"), t.classList.remove(oa), typeof window.scrollTo == "function" && window.scrollTo({ top: ca });
5903
+ e.style.removeProperty("position"), e.style.removeProperty("top"), e.style.removeProperty("left"), e.style.removeProperty("right"), e.style.removeProperty("width"), e.style.removeProperty("overflow"), e.style.removeProperty("padding-right"), t.classList.remove(oa), typeof window.scrollTo == "function" && window.scrollTo({
5904
+ top: ca,
5905
+ behavior: "instant"
5906
+ });
5904
5907
  }, fa = () => {
5905
5908
  la() && (sa += 1, sa === 1 && ua());
5906
5909
  }, pa = () => {
@@ -0,0 +1,12 @@
1
+ export interface ITocHeading {
2
+ id: string;
3
+ text: string;
4
+ level: number;
5
+ }
6
+ export declare const ensureHeadingIds: (root: ParentNode, selector?: string) => ITocHeading[];
7
+ export declare const getTocHeadings: (root: ParentNode) => ITocHeading[];
8
+ export declare const scrollToHash: (behavior?: ScrollBehavior) => void;
9
+ export declare const watchActiveHeading: (ids: string[], onChange: (id: string) => void, offset?: number) => {
10
+ update: () => void;
11
+ stop: () => void;
12
+ };
@@ -5,7 +5,9 @@
5
5
  * Strategy: an iOS-safe `position: fixed` lock — `overflow: hidden` alone is
6
6
  * ignored by iOS Safari. The current scroll position is saved, the body is
7
7
  * pinned, scrollbar width is reserved to avoid a layout shift, and the scroll
8
- * position is restored on release.
8
+ * position is restored on release. The restore is always instant, so a page
9
+ * with `scroll-behavior: smooth` does not animate from the top back to where
10
+ * it was when the overlay closes.
9
11
  *
10
12
  * Reference-counted so several open overlays don't unlock the page when one of
11
13
  * them closes. Each caller holds a token (see {@link createScrollLockToken}) so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-react",
3
- "version": "19.10.0",
3
+ "version": "19.11.0",
4
4
  "description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo kommune",
@@ -41,7 +41,7 @@
41
41
  "@eslint/eslintrc": "^3.3.5",
42
42
  "@eslint/js": "^10.0.1",
43
43
  "@oslokommune/punkt-assets": "^19.0.4",
44
- "@oslokommune/punkt-css": "^19.9.1",
44
+ "@oslokommune/punkt-css": "^19.10.2",
45
45
  "@testing-library/jest-dom": "^6.9.1",
46
46
  "@testing-library/react": "^16.3.2",
47
47
  "@testing-library/user-event": "^14.6.1",
@@ -101,5 +101,5 @@
101
101
  "url": "https://github.com/oslokommune/punkt/issues"
102
102
  },
103
103
  "license": "MIT",
104
- "gitHead": "e7b45bcbcce849fbbb59cc06934a1cb57ae7473a"
104
+ "gitHead": "d83cbdb71c65b51c7eb5270970a287c4eff8f19a"
105
105
  }
@@ -118,7 +118,9 @@ export const PktConsent = forwardRef<HTMLElement, IPktConsent>(function PktConse
118
118
 
119
119
  const triggerInitRef = useRef<() => void>(() => {})
120
120
 
121
- const language = (Object.hasOwn(consentStrings.i18n, i18nLanguage) ? i18nLanguage : 'nb') as keyof typeof consentStrings.i18n
121
+ const language = (
122
+ Object.prototype.hasOwnProperty.call(consentStrings.i18n, i18nLanguage) ? i18nLanguage : 'nb'
123
+ ) as keyof typeof consentStrings.i18n
122
124
  const resolvedTriggerText = triggerText ?? consentStrings.i18n[language].contentPresentation.buttons.settings
123
125
 
124
126
  useEffect(() => {