@windrun-huaiin/third-ui 5.13.5 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "5.13.5",
3
+ "version": "5.14.0",
4
4
  "description": "Third-party integrated UI components for windrun-huaiin projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -54,7 +54,7 @@
54
54
  "mermaid": "^11.6.0",
55
55
  "react-medium-image-zoom": "^5.2.14",
56
56
  "zod": "^3.22.4",
57
- "@windrun-huaiin/base-ui": "^6.0.2"
57
+ "@windrun-huaiin/base-ui": "^6.0.3"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "19.1.0",
@@ -1,11 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { globalLucideIcons as icons } from '@base-ui/components/global-icon';
4
- import {
5
- AlertDialog,
6
- AlertDialogContent,
7
- AlertDialogTitle,
8
- } from '@base-ui/ui/alert-dialog';
4
+ // 注意:不使用外部对话框库,避免第三方应用构建时的 React 上下文冲突
9
5
  import type { MermaidConfig } from 'mermaid';
10
6
  import { useTheme } from 'next-themes';
11
7
  import { useCallback, useEffect, useId, useRef, useState } from 'react';
@@ -133,11 +129,16 @@ export function Mermaid({ chart, title, watermarkEnabled, watermarkText, enableP
133
129
  </div>
134
130
  )}
135
131
 
136
- {/* Preview Dialog */}
137
- {enablePreview && (
138
- <AlertDialog open={open} onOpenChange={(o) => { setOpen(o); if (!o) resetTransform(); }}>
139
- <AlertDialogContent className="z-50 max-w-[95vw] w-[95vw] h-[88vh] p-0 bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-700">
140
- <AlertDialogTitle className="sr-only">{title ?? 'Mermaid Preview'}</AlertDialogTitle>
132
+ {/* Preview Dialog (custom minimal dialog) */}
133
+ {enablePreview && open && (
134
+ <div
135
+ role="dialog"
136
+ aria-modal="true"
137
+ aria-label={typeof title === 'string' ? title : 'Mermaid Preview'}
138
+ className="fixed inset-0 z-[9999] flex items-center justify-center"
139
+ >
140
+ <div className="absolute inset-0 bg-black/60" onClick={() => { setOpen(false); resetTransform(); }} />
141
+ <div className="relative z-[1] max-w-[95vw] w-[95vw] h-[88vh] p-0 bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-700 rounded-md shadow-2xl overflow-hidden">
141
142
  {/* Top bar */}
142
143
  <div className="flex items-center justify-between px-3 py-2 border-b border-neutral-200 dark:border-neutral-700">
143
144
  <div className="flex items-center gap-2 text-sm text-neutral-600 dark:text-neutral-300">
@@ -170,7 +171,7 @@ export function Mermaid({ chart, title, watermarkEnabled, watermarkText, enableP
170
171
  <button
171
172
  aria-label="Close"
172
173
  className="ml-1 flex h-6 w-6 items-center justify-center rounded text-purple-500 hover:text-purple-600"
173
- onClick={() => setOpen(false)}
174
+ onClick={() => { setOpen(false); resetTransform(); }}
174
175
  >
175
176
  <icons.X className="h-3.5 w-3.5" />
176
177
  </button>
@@ -199,8 +200,8 @@ export function Mermaid({ chart, title, watermarkEnabled, watermarkText, enableP
199
200
  Drag to pan, hold Cmd/Ctrl + scroll to zoom
200
201
  </div>
201
202
  </div>
202
- </AlertDialogContent>
203
- </AlertDialog>
203
+ </div>
204
+ </div>
204
205
  )}
205
206
  </div>
206
207
  );