@opensite/ui 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/registry.cjs CHANGED
@@ -33,6 +33,7 @@ var PopoverPrimitive = require('@radix-ui/react-popover');
33
33
  var SwitchPrimitive = require('@radix-ui/react-switch');
34
34
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
35
35
  var pdfViewer = require('@page-speed/pdf-viewer');
36
+ var reactDom = require('react-dom');
36
37
 
37
38
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
38
39
 
@@ -81631,6 +81632,19 @@ function ResourceDetailWhitepaperSidebar({
81631
81632
  patternOpacity
81632
81633
  }) {
81633
81634
  const [showFullViewer, setShowFullViewer] = React11.useState(false);
81635
+ const [isMounted, setIsMounted] = React11.useState(false);
81636
+ React11.useEffect(() => {
81637
+ setIsMounted(true);
81638
+ }, []);
81639
+ React11.useEffect(() => {
81640
+ if (!showFullViewer) return;
81641
+ if (typeof document === "undefined") return;
81642
+ const previousOverflow = document.body.style.overflow;
81643
+ document.body.style.overflow = "hidden";
81644
+ return () => {
81645
+ document.body.style.overflow = previousOverflow;
81646
+ };
81647
+ }, [showFullViewer]);
81634
81648
  const handleOpenFullViewer = React11.useCallback(() => {
81635
81649
  setShowFullViewer(true);
81636
81650
  }, []);
@@ -81759,36 +81773,47 @@ function ResourceDetailWhitepaperSidebar({
81759
81773
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "order-last md:order-0 md:col-span-4 lg:col-span-3", children: renderSidebar() }),
81760
81774
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "md:col-span-7 md:col-start-5 lg:col-start-6", children: renderArticle() })
81761
81775
  ] }),
81762
- showFullViewer && sidebar?.pdfUrl && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-black/90", children: [
81763
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
81764
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
81765
- /* @__PURE__ */ jsxRuntime.jsx(
81766
- "button",
81767
- {
81768
- type: "button",
81769
- onClick: handleCloseFullViewer,
81770
- className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
81771
- "aria-label": "Close viewer",
81772
- children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/x", size: 20 })
81773
- }
81774
- )
81775
- ] }),
81776
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
81777
- pdfViewer.PDFViewer,
81776
+ showFullViewer && sidebar?.pdfUrl && isMounted && typeof document !== "undefined" && reactDom.createPortal(
81777
+ /* @__PURE__ */ jsxRuntime.jsxs(
81778
+ "div",
81778
81779
  {
81779
- url: sidebar.pdfUrl,
81780
- height: "100%",
81781
- config: {
81782
- showControls: true,
81783
- showThumbnails: true,
81784
- enableDownload: true,
81785
- enablePrint: true,
81786
- enableFullscreen: true,
81787
- initialZoom: "page-width"
81788
- }
81780
+ className: "fixed inset-0 z-[9999] flex flex-col bg-black/90",
81781
+ role: "dialog",
81782
+ "aria-modal": "true",
81783
+ children: [
81784
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
81785
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
81786
+ /* @__PURE__ */ jsxRuntime.jsx(
81787
+ "button",
81788
+ {
81789
+ type: "button",
81790
+ onClick: handleCloseFullViewer,
81791
+ className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
81792
+ "aria-label": "Close viewer",
81793
+ children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/x", size: 20 })
81794
+ }
81795
+ )
81796
+ ] }),
81797
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
81798
+ pdfViewer.PDFViewer,
81799
+ {
81800
+ url: sidebar.pdfUrl,
81801
+ height: "100%",
81802
+ config: {
81803
+ showControls: true,
81804
+ showThumbnails: true,
81805
+ enableDownload: true,
81806
+ enablePrint: true,
81807
+ enableFullscreen: true,
81808
+ initialZoom: "page-fit"
81809
+ }
81810
+ }
81811
+ ) })
81812
+ ]
81789
81813
  }
81790
- ) })
81791
- ] })
81814
+ ),
81815
+ document.body
81816
+ )
81792
81817
  ]
81793
81818
  }
81794
81819
  );
package/dist/registry.js CHANGED
@@ -32,6 +32,7 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
32
32
  import * as SwitchPrimitive from '@radix-ui/react-switch';
33
33
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
34
34
  import { PDFViewer } from '@page-speed/pdf-viewer';
35
+ import { createPortal } from 'react-dom';
35
36
 
36
37
  // lib/utils.ts
37
38
  function cn(...inputs) {
@@ -81591,6 +81592,19 @@ function ResourceDetailWhitepaperSidebar({
81591
81592
  patternOpacity
81592
81593
  }) {
81593
81594
  const [showFullViewer, setShowFullViewer] = useState(false);
81595
+ const [isMounted, setIsMounted] = useState(false);
81596
+ useEffect(() => {
81597
+ setIsMounted(true);
81598
+ }, []);
81599
+ useEffect(() => {
81600
+ if (!showFullViewer) return;
81601
+ if (typeof document === "undefined") return;
81602
+ const previousOverflow = document.body.style.overflow;
81603
+ document.body.style.overflow = "hidden";
81604
+ return () => {
81605
+ document.body.style.overflow = previousOverflow;
81606
+ };
81607
+ }, [showFullViewer]);
81594
81608
  const handleOpenFullViewer = useCallback(() => {
81595
81609
  setShowFullViewer(true);
81596
81610
  }, []);
@@ -81719,36 +81733,47 @@ function ResourceDetailWhitepaperSidebar({
81719
81733
  /* @__PURE__ */ jsx("div", { className: "order-last md:order-0 md:col-span-4 lg:col-span-3", children: renderSidebar() }),
81720
81734
  /* @__PURE__ */ jsx("div", { className: "md:col-span-7 md:col-start-5 lg:col-start-6", children: renderArticle() })
81721
81735
  ] }),
81722
- showFullViewer && sidebar?.pdfUrl && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-black/90", children: [
81723
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
81724
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
81725
- /* @__PURE__ */ jsx(
81726
- "button",
81727
- {
81728
- type: "button",
81729
- onClick: handleCloseFullViewer,
81730
- className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
81731
- "aria-label": "Close viewer",
81732
- children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", size: 20 })
81733
- }
81734
- )
81735
- ] }),
81736
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
81737
- PDFViewer,
81736
+ showFullViewer && sidebar?.pdfUrl && isMounted && typeof document !== "undefined" && createPortal(
81737
+ /* @__PURE__ */ jsxs(
81738
+ "div",
81738
81739
  {
81739
- url: sidebar.pdfUrl,
81740
- height: "100%",
81741
- config: {
81742
- showControls: true,
81743
- showThumbnails: true,
81744
- enableDownload: true,
81745
- enablePrint: true,
81746
- enableFullscreen: true,
81747
- initialZoom: "page-width"
81748
- }
81740
+ className: "fixed inset-0 z-[9999] flex flex-col bg-black/90",
81741
+ role: "dialog",
81742
+ "aria-modal": "true",
81743
+ children: [
81744
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
81745
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
81746
+ /* @__PURE__ */ jsx(
81747
+ "button",
81748
+ {
81749
+ type: "button",
81750
+ onClick: handleCloseFullViewer,
81751
+ className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
81752
+ "aria-label": "Close viewer",
81753
+ children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", size: 20 })
81754
+ }
81755
+ )
81756
+ ] }),
81757
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
81758
+ PDFViewer,
81759
+ {
81760
+ url: sidebar.pdfUrl,
81761
+ height: "100%",
81762
+ config: {
81763
+ showControls: true,
81764
+ showThumbnails: true,
81765
+ enableDownload: true,
81766
+ enablePrint: true,
81767
+ enableFullscreen: true,
81768
+ initialZoom: "page-fit"
81769
+ }
81770
+ }
81771
+ ) })
81772
+ ]
81749
81773
  }
81750
- ) })
81751
- ] })
81774
+ ),
81775
+ document.body
81776
+ )
81752
81777
  ]
81753
81778
  }
81754
81779
  );
@@ -2,6 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
5
+ var reactDom = require('react-dom');
5
6
  var clsx = require('clsx');
6
7
  var tailwindMerge = require('tailwind-merge');
7
8
  var classVarianceAuthority = require('class-variance-authority');
@@ -1086,6 +1087,19 @@ function ResourceDetailWhitepaperSidebar({
1086
1087
  patternOpacity
1087
1088
  }) {
1088
1089
  const [showFullViewer, setShowFullViewer] = React.useState(false);
1090
+ const [isMounted, setIsMounted] = React.useState(false);
1091
+ React.useEffect(() => {
1092
+ setIsMounted(true);
1093
+ }, []);
1094
+ React.useEffect(() => {
1095
+ if (!showFullViewer) return;
1096
+ if (typeof document === "undefined") return;
1097
+ const previousOverflow = document.body.style.overflow;
1098
+ document.body.style.overflow = "hidden";
1099
+ return () => {
1100
+ document.body.style.overflow = previousOverflow;
1101
+ };
1102
+ }, [showFullViewer]);
1089
1103
  const handleOpenFullViewer = React.useCallback(() => {
1090
1104
  setShowFullViewer(true);
1091
1105
  }, []);
@@ -1214,36 +1228,47 @@ function ResourceDetailWhitepaperSidebar({
1214
1228
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "order-last md:order-0 md:col-span-4 lg:col-span-3", children: renderSidebar() }),
1215
1229
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "md:col-span-7 md:col-start-5 lg:col-start-6", children: renderArticle() })
1216
1230
  ] }),
1217
- showFullViewer && sidebar?.pdfUrl && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-black/90", children: [
1218
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
1219
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
1220
- /* @__PURE__ */ jsxRuntime.jsx(
1221
- "button",
1222
- {
1223
- type: "button",
1224
- onClick: handleCloseFullViewer,
1225
- className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
1226
- "aria-label": "Close viewer",
1227
- children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/x", size: 20 })
1228
- }
1229
- )
1230
- ] }),
1231
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
1232
- pdfViewer.PDFViewer,
1231
+ showFullViewer && sidebar?.pdfUrl && isMounted && typeof document !== "undefined" && reactDom.createPortal(
1232
+ /* @__PURE__ */ jsxRuntime.jsxs(
1233
+ "div",
1233
1234
  {
1234
- url: sidebar.pdfUrl,
1235
- height: "100%",
1236
- config: {
1237
- showControls: true,
1238
- showThumbnails: true,
1239
- enableDownload: true,
1240
- enablePrint: true,
1241
- enableFullscreen: true,
1242
- initialZoom: "page-width"
1243
- }
1235
+ className: "fixed inset-0 z-[9999] flex flex-col bg-black/90",
1236
+ role: "dialog",
1237
+ "aria-modal": "true",
1238
+ children: [
1239
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
1240
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
1241
+ /* @__PURE__ */ jsxRuntime.jsx(
1242
+ "button",
1243
+ {
1244
+ type: "button",
1245
+ onClick: handleCloseFullViewer,
1246
+ className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
1247
+ "aria-label": "Close viewer",
1248
+ children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/x", size: 20 })
1249
+ }
1250
+ )
1251
+ ] }),
1252
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
1253
+ pdfViewer.PDFViewer,
1254
+ {
1255
+ url: sidebar.pdfUrl,
1256
+ height: "100%",
1257
+ config: {
1258
+ showControls: true,
1259
+ showThumbnails: true,
1260
+ enableDownload: true,
1261
+ enablePrint: true,
1262
+ enableFullscreen: true,
1263
+ initialZoom: "page-fit"
1264
+ }
1265
+ }
1266
+ ) })
1267
+ ]
1244
1268
  }
1245
- ) })
1246
- ] })
1269
+ ),
1270
+ document.body
1271
+ )
1247
1272
  ]
1248
1273
  }
1249
1274
  );
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import * as React from 'react';
3
- import React__default, { useState, useCallback } from 'react';
3
+ import React__default, { useState, useEffect, useCallback } from 'react';
4
+ import { createPortal } from 'react-dom';
4
5
  import { clsx } from 'clsx';
5
6
  import { twMerge } from 'tailwind-merge';
6
7
  import { cva } from 'class-variance-authority';
@@ -1065,6 +1066,19 @@ function ResourceDetailWhitepaperSidebar({
1065
1066
  patternOpacity
1066
1067
  }) {
1067
1068
  const [showFullViewer, setShowFullViewer] = useState(false);
1069
+ const [isMounted, setIsMounted] = useState(false);
1070
+ useEffect(() => {
1071
+ setIsMounted(true);
1072
+ }, []);
1073
+ useEffect(() => {
1074
+ if (!showFullViewer) return;
1075
+ if (typeof document === "undefined") return;
1076
+ const previousOverflow = document.body.style.overflow;
1077
+ document.body.style.overflow = "hidden";
1078
+ return () => {
1079
+ document.body.style.overflow = previousOverflow;
1080
+ };
1081
+ }, [showFullViewer]);
1068
1082
  const handleOpenFullViewer = useCallback(() => {
1069
1083
  setShowFullViewer(true);
1070
1084
  }, []);
@@ -1193,36 +1207,47 @@ function ResourceDetailWhitepaperSidebar({
1193
1207
  /* @__PURE__ */ jsx("div", { className: "order-last md:order-0 md:col-span-4 lg:col-span-3", children: renderSidebar() }),
1194
1208
  /* @__PURE__ */ jsx("div", { className: "md:col-span-7 md:col-start-5 lg:col-start-6", children: renderArticle() })
1195
1209
  ] }),
1196
- showFullViewer && sidebar?.pdfUrl && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-black/90", children: [
1197
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
1198
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
1199
- /* @__PURE__ */ jsx(
1200
- "button",
1201
- {
1202
- type: "button",
1203
- onClick: handleCloseFullViewer,
1204
- className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
1205
- "aria-label": "Close viewer",
1206
- children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", size: 20 })
1207
- }
1208
- )
1209
- ] }),
1210
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
1211
- PDFViewer,
1210
+ showFullViewer && sidebar?.pdfUrl && isMounted && typeof document !== "undefined" && createPortal(
1211
+ /* @__PURE__ */ jsxs(
1212
+ "div",
1212
1213
  {
1213
- url: sidebar.pdfUrl,
1214
- height: "100%",
1215
- config: {
1216
- showControls: true,
1217
- showThumbnails: true,
1218
- enableDownload: true,
1219
- enablePrint: true,
1220
- enableFullscreen: true,
1221
- initialZoom: "page-width"
1222
- }
1214
+ className: "fixed inset-0 z-[9999] flex flex-col bg-black/90",
1215
+ role: "dialog",
1216
+ "aria-modal": "true",
1217
+ children: [
1218
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-border bg-background px-6 py-4", children: [
1219
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: typeof sidebar.resourceTitle === "string" ? sidebar.resourceTitle : "Document Viewer" }),
1220
+ /* @__PURE__ */ jsx(
1221
+ "button",
1222
+ {
1223
+ type: "button",
1224
+ onClick: handleCloseFullViewer,
1225
+ className: "flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
1226
+ "aria-label": "Close viewer",
1227
+ children: /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", size: 20 })
1228
+ }
1229
+ )
1230
+ ] }),
1231
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
1232
+ PDFViewer,
1233
+ {
1234
+ url: sidebar.pdfUrl,
1235
+ height: "100%",
1236
+ config: {
1237
+ showControls: true,
1238
+ showThumbnails: true,
1239
+ enableDownload: true,
1240
+ enablePrint: true,
1241
+ enableFullscreen: true,
1242
+ initialZoom: "page-fit"
1243
+ }
1244
+ }
1245
+ ) })
1246
+ ]
1223
1247
  }
1224
- ) })
1225
- ] })
1248
+ ),
1249
+ document.body
1250
+ )
1226
1251
  ]
1227
1252
  }
1228
1253
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensite/ui",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Foundational UI component library for OpenSite Semantic Site Builder with tree-shakable exports and abstract styling",
5
5
  "keywords": [
6
6
  "react",
@@ -3304,8 +3304,8 @@
3304
3304
  "@opensite/hooks": "^0.1.1",
3305
3305
  "@page-speed/forms": "0.3.4",
3306
3306
  "@page-speed/img": "0.4.3",
3307
- "@page-speed/lightbox": "0.1.9",
3308
- "@page-speed/pdf-viewer": "0.1.7",
3307
+ "@page-speed/lightbox": "0.2.0",
3308
+ "@page-speed/pdf-viewer": "0.1.8",
3309
3309
  "@radix-ui/react-accordion": "^1.2.12",
3310
3310
  "@radix-ui/react-aspect-ratio": "^1.1.8",
3311
3311
  "@radix-ui/react-avatar": "^1.1.11",