@yuhuanowo/yunui 0.2.15 → 0.2.17
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/README.md +11 -0
- package/README.zh-CN.md +9 -0
- package/README.zh-TW.md +9 -0
- package/dist/adapters.js +1 -1
- package/dist/ai.d.ts +94 -6
- package/dist/ai.js +466 -76
- package/dist/ai.js.map +1 -1
- package/dist/chat.d.ts +152 -0
- package/dist/chat.js +321 -0
- package/dist/chat.js.map +1 -0
- package/dist/{chunk-U2LNRVMI.js → chunk-3RT24MSH.js} +4 -3
- package/dist/chunk-3RT24MSH.js.map +1 -0
- package/dist/{chunk-6MZN3GOP.js → chunk-BCOKFWXC.js} +326 -891
- package/dist/chunk-BCOKFWXC.js.map +1 -0
- package/dist/{chunk-N53PNMPJ.js → chunk-DDUP7GAX.js} +14 -7
- package/dist/chunk-DDUP7GAX.js.map +1 -0
- package/dist/{chunk-LLNTUA5K.js → chunk-F2HG4TOQ.js} +44 -67
- package/dist/chunk-F2HG4TOQ.js.map +1 -0
- package/dist/chunk-HH3JBHRP.js +1211 -0
- package/dist/chunk-HH3JBHRP.js.map +1 -0
- package/dist/chunk-N4QO7RN5.js +98 -0
- package/dist/chunk-N4QO7RN5.js.map +1 -0
- package/dist/chunk-QEIBYOG2.js +188 -0
- package/dist/chunk-QEIBYOG2.js.map +1 -0
- package/dist/content.d.ts +178 -0
- package/dist/content.js +1064 -0
- package/dist/content.js.map +1 -0
- package/dist/index.d.ts +237 -12
- package/dist/index.js +5 -3
- package/dist/patterns.d.ts +176 -7
- package/dist/patterns.js +745 -69
- package/dist/patterns.js.map +1 -1
- package/icons/apps/aistudio.webp +0 -0
- package/icons/apps/application.png +0 -0
- package/icons/apps/baixiaoying.webp +0 -0
- package/icons/apps/coze.webp +0 -0
- package/icons/apps/dify.webp +0 -0
- package/icons/apps/doubao.webp +0 -0
- package/icons/apps/flowith.webp +0 -0
- package/icons/apps/gemini.webp +0 -0
- package/icons/apps/github-copilot.webp +0 -0
- package/icons/apps/google.webp +0 -0
- package/icons/apps/grok.webp +0 -0
- package/icons/apps/kimi.webp +0 -0
- package/icons/apps/longcat.webp +0 -0
- package/icons/apps/metaso.webp +0 -0
- package/icons/apps/monica.webp +0 -0
- package/icons/apps/n8n.webp +0 -0
- package/icons/apps/nm-search.webp +0 -0
- package/icons/apps/notebooklm.webp +0 -0
- package/icons/apps/perplexity.webp +0 -0
- package/icons/apps/poe.webp +0 -0
- package/icons/apps/qingyan.webp +0 -0
- package/icons/apps/stepfun.webp +0 -0
- package/icons/apps/tiangong.webp +0 -0
- package/icons/apps/xiaoyi.webp +0 -0
- package/icons/apps/yuanbao.webp +0 -0
- package/icons/apps/zai.webp +0 -0
- package/icons/models/ai21.webp +0 -0
- package/icons/models/aimass.webp +0 -0
- package/icons/models/anthropic.webp +0 -0
- package/icons/models/baichuan.webp +0 -0
- package/icons/models/byte_dance.webp +0 -0
- package/icons/models/chatglm.webp +0 -0
- package/icons/models/claude.webp +0 -0
- package/icons/models/codegeex.webp +0 -0
- package/icons/models/cogview3flash.webp +0 -0
- package/icons/models/cohere.webp +0 -0
- package/icons/models/copilot.webp +0 -0
- package/icons/models/dalle.webp +0 -0
- package/icons/models/dbrx.webp +0 -0
- package/icons/models/deepseek.webp +0 -0
- package/icons/models/doubao.webp +0 -0
- package/icons/models/flux.webp +0 -0
- package/icons/models/gemini.webp +0 -0
- package/icons/models/gemma.webp +0 -0
- package/icons/models/google.webp +0 -0
- package/icons/models/grok.webp +0 -0
- package/icons/models/hailuo.webp +0 -0
- package/icons/models/huggingface.webp +0 -0
- package/icons/models/hunyuan.webp +0 -0
- package/icons/models/ibm.webp +0 -0
- package/icons/models/ideogram.webp +0 -0
- package/icons/models/internlm.webp +0 -0
- package/icons/models/jina.webp +0 -0
- package/icons/models/llava.webp +0 -0
- package/icons/models/luma.webp +0 -0
- package/icons/models/magic.webp +0 -0
- package/icons/models/microsoft.webp +0 -0
- package/icons/models/midjourney.webp +0 -0
- package/icons/models/minimax.webp +0 -0
- package/icons/models/mistral.webp +0 -0
- package/icons/models/moonshot.webp +0 -0
- package/icons/models/nousresearch.webp +0 -0
- package/icons/models/nvidia.webp +0 -0
- package/icons/models/o3.webp +0 -0
- package/icons/models/openai.webp +0 -0
- package/icons/models/palm.webp +0 -0
- package/icons/models/perplexity.webp +0 -0
- package/icons/models/qwen.webp +0 -0
- package/icons/models/stability.webp +0 -0
- package/icons/models/step.webp +0 -0
- package/icons/models/suno.webp +0 -0
- package/icons/models/upstage.webp +0 -0
- package/icons/models/vidu.webp +0 -0
- package/icons/models/volcengine.webp +0 -0
- package/icons/models/voyageai.webp +0 -0
- package/icons/models/wenxin.webp +0 -0
- package/icons/models/xirang.png +0 -0
- package/icons/models/xirang_dark.png +0 -0
- package/icons/models/yi.webp +0 -0
- package/icons/models/zai.webp +0 -0
- package/icons/models/zero-one.webp +0 -0
- package/icons/models/zhipu.webp +0 -0
- package/icons/providers/302ai.webp +0 -0
- package/icons/providers/DMXAPI-to-img.webp +0 -0
- package/icons/providers/Tesseract.js.png +0 -0
- package/icons/providers/ace.webp +0 -0
- package/icons/providers/adobe.webp +0 -0
- package/icons/providers/adobefirefly.webp +0 -0
- package/icons/providers/agentvoice.webp +0 -0
- package/icons/providers/agui.webp +0 -0
- package/icons/providers/ai2.webp +0 -0
- package/icons/providers/ai21.webp +0 -0
- package/icons/providers/ai302.webp +0 -0
- package/icons/providers/ai360.webp +0 -0
- package/icons/providers/aiOnly.webp +0 -0
- package/icons/providers/aihubmix.webp +0 -0
- package/icons/providers/aimass.webp +0 -0
- package/icons/providers/aionlabs.webp +0 -0
- package/icons/providers/airjelly.webp +0 -0
- package/icons/providers/aistudio.webp +0 -0
- package/icons/providers/akashchat.webp +0 -0
- package/icons/providers/alephalpha.webp +0 -0
- package/icons/providers/alibaba.webp +0 -0
- package/icons/providers/alibabacloud.webp +0 -0
- package/icons/providers/amp.webp +0 -0
- package/icons/providers/antgroup.webp +0 -0
- package/icons/providers/anthropic.webp +0 -0
- package/icons/providers/antigravity.webp +0 -0
- package/icons/providers/anyscale.webp +0 -0
- package/icons/providers/apertis.webp +0 -0
- package/icons/providers/apple.webp +0 -0
- package/icons/providers/arcee.webp +0 -0
- package/icons/providers/askverdict.webp +0 -0
- package/icons/providers/assemblyai.webp +0 -0
- package/icons/providers/atlascloud.webp +0 -0
- package/icons/providers/automatic.webp +0 -0
- package/icons/providers/aws-bedrock.webp +0 -0
- package/icons/providers/aws.webp +0 -0
- package/icons/providers/aya.webp +0 -0
- package/icons/providers/azure.webp +0 -0
- package/icons/providers/azureai.webp +0 -0
- package/icons/providers/baai.webp +0 -0
- package/icons/providers/baichuan.webp +0 -0
- package/icons/providers/baidu-cloud.webp +0 -0
- package/icons/providers/baidu.webp +0 -0
- package/icons/providers/baiducloud.webp +0 -0
- package/icons/providers/bailian.webp +0 -0
- package/icons/providers/baseten.webp +0 -0
- package/icons/providers/bedrock.webp +0 -0
- package/icons/providers/bfl.webp +0 -0
- package/icons/providers/bigModel.webp +0 -0
- package/icons/providers/bilibili.webp +0 -0
- package/icons/providers/bilibiliindex.webp +0 -0
- package/icons/providers/bing.webp +0 -0
- package/icons/providers/briaai.webp +0 -0
- package/icons/providers/burncloud.webp +0 -0
- package/icons/providers/bytedance.webp +0 -0
- package/icons/providers/capcut.webp +0 -0
- package/icons/providers/centml.webp +0 -0
- package/icons/providers/cephalon.jpeg +0 -0
- package/icons/providers/cerebras.webp +0 -0
- package/icons/providers/chatglm.webp +0 -0
- package/icons/providers/cherryin.png +0 -0
- package/icons/providers/cherrystudio.webp +0 -0
- package/icons/providers/civitai.webp +0 -0
- package/icons/providers/claude.webp +0 -0
- package/icons/providers/claudecode.webp +0 -0
- package/icons/providers/cline.webp +0 -0
- package/icons/providers/clipdrop.webp +0 -0
- package/icons/providers/cloudflare.webp +0 -0
- package/icons/providers/codebuddy.webp +0 -0
- package/icons/providers/codeflicker.webp +0 -0
- package/icons/providers/codegeex.webp +0 -0
- package/icons/providers/codex.webp +0 -0
- package/icons/providers/cogvideo.webp +0 -0
- package/icons/providers/cogview.webp +0 -0
- package/icons/providers/cogview3flash.webp +0 -0
- package/icons/providers/cohere.webp +0 -0
- package/icons/providers/colab.webp +0 -0
- package/icons/providers/cometapi.webp +0 -0
- package/icons/providers/comfyui.webp +0 -0
- package/icons/providers/commanda.webp +0 -0
- package/icons/providers/copilot.webp +0 -0
- package/icons/providers/copilotkit.webp +0 -0
- package/icons/providers/coqui.webp +0 -0
- package/icons/providers/coze.webp +0 -0
- package/icons/providers/crewai.webp +0 -0
- package/icons/providers/crusoe.webp +0 -0
- package/icons/providers/cursor.webp +0 -0
- package/icons/providers/cybercut.webp +0 -0
- package/icons/providers/dalle.webp +0 -0
- package/icons/providers/dbrx.webp +0 -0
- package/icons/providers/deepai.webp +0 -0
- package/icons/providers/deepcogito.webp +0 -0
- package/icons/providers/deepinfra.webp +0 -0
- package/icons/providers/deepl.webp +0 -0
- package/icons/providers/deepmind.webp +0 -0
- package/icons/providers/deepseek.webp +0 -0
- package/icons/providers/devin.webp +0 -0
- package/icons/providers/dify.webp +0 -0
- package/icons/providers/dmxapi-logo-dark.webp +0 -0
- package/icons/providers/dmxapi-logo.webp +0 -0
- package/icons/providers/doc2x.webp +0 -0
- package/icons/providers/docsearch.webp +0 -0
- package/icons/providers/dolphin.webp +0 -0
- package/icons/providers/doubao.webp +0 -0
- package/icons/providers/dreammachine.webp +0 -0
- package/icons/providers/elevenlabs.webp +0 -0
- package/icons/providers/elevenx.webp +0 -0
- package/icons/providers/essentialai.webp +0 -0
- package/icons/providers/exa.webp +0 -0
- package/icons/providers/fal.webp +0 -0
- package/icons/providers/fastgpt.webp +0 -0
- package/icons/providers/featherless.webp +0 -0
- package/icons/providers/figma.webp +0 -0
- package/icons/providers/fireworks.webp +0 -0
- package/icons/providers/fishaudio.webp +0 -0
- package/icons/providers/flora.webp +0 -0
- package/icons/providers/flowith.webp +0 -0
- package/icons/providers/flux.webp +0 -0
- package/icons/providers/friendli.webp +0 -0
- package/icons/providers/gemini.webp +0 -0
- package/icons/providers/geminicli.webp +0 -0
- package/icons/providers/gemma.webp +0 -0
- package/icons/providers/gitee-ai.webp +0 -0
- package/icons/providers/giteeai.webp +0 -0
- package/icons/providers/github.webp +0 -0
- package/icons/providers/githubcopilot.webp +0 -0
- package/icons/providers/glama.webp +0 -0
- package/icons/providers/glif.webp +0 -0
- package/icons/providers/glmv.webp +0 -0
- package/icons/providers/google.webp +0 -0
- package/icons/providers/googlecloud.webp +0 -0
- package/icons/providers/goose.webp +0 -0
- package/icons/providers/gradio.webp +0 -0
- package/icons/providers/greptile.webp +0 -0
- package/icons/providers/grok.webp +0 -0
- package/icons/providers/groq.webp +0 -0
- package/icons/providers/hailuo.webp +0 -0
- package/icons/providers/haiper.webp +0 -0
- package/icons/providers/hedra.webp +0 -0
- package/icons/providers/hermesagent.webp +0 -0
- package/icons/providers/higress.webp +0 -0
- package/icons/providers/huawei.webp +0 -0
- package/icons/providers/huaweicloud.webp +0 -0
- package/icons/providers/huggingface.webp +0 -0
- package/icons/providers/hunyuan.webp +0 -0
- package/icons/providers/hyperbolic.webp +0 -0
- package/icons/providers/ibm.webp +0 -0
- package/icons/providers/ideogram.webp +0 -0
- package/icons/providers/iflytekcloud.webp +0 -0
- package/icons/providers/inception.webp +0 -0
- package/icons/providers/inference.webp +0 -0
- package/icons/providers/infermatic.webp +0 -0
- package/icons/providers/infini.webp +0 -0
- package/icons/providers/infinigence.webp +0 -0
- package/icons/providers/inflection.webp +0 -0
- package/icons/providers/internlm.webp +0 -0
- package/icons/providers/jimeng.webp +0 -0
- package/icons/providers/jina.webp +0 -0
- package/icons/providers/junie.webp +0 -0
- package/icons/providers/kilocode.webp +0 -0
- package/icons/providers/kimi.webp +0 -0
- package/icons/providers/kiro.webp +0 -0
- package/icons/providers/kling.webp +0 -0
- package/icons/providers/kluster.webp +0 -0
- package/icons/providers/kolors.webp +0 -0
- package/icons/providers/krea.webp +0 -0
- package/icons/providers/kwaikat.webp +0 -0
- package/icons/providers/kwaipilot.webp +0 -0
- package/icons/providers/lambda.webp +0 -0
- package/icons/providers/langchain.webp +0 -0
- package/icons/providers/langfuse.webp +0 -0
- package/icons/providers/langgraph.webp +0 -0
- package/icons/providers/langsmith.webp +0 -0
- package/icons/providers/leptonai.webp +0 -0
- package/icons/providers/lg.webp +0 -0
- package/icons/providers/lightricks.webp +0 -0
- package/icons/providers/liquid.webp +0 -0
- package/icons/providers/livekit.webp +0 -0
- package/icons/providers/llamaindex.webp +0 -0
- package/icons/providers/llava.webp +0 -0
- package/icons/providers/llmapi.webp +0 -0
- package/icons/providers/lmstudio.webp +0 -0
- package/icons/providers/lobehub.webp +0 -0
- package/icons/providers/longcat.webp +0 -0
- package/icons/providers/lovable.webp +0 -0
- package/icons/providers/lovart.webp +0 -0
- package/icons/providers/luma.webp +0 -0
- package/icons/providers/magic.webp +0 -0
- package/icons/providers/make.webp +0 -0
- package/icons/providers/manus.webp +0 -0
- package/icons/providers/mastra.webp +0 -0
- package/icons/providers/mcp.webp +0 -0
- package/icons/providers/mcpso.webp +0 -0
- package/icons/providers/menlo.webp +0 -0
- package/icons/providers/meshy.webp +0 -0
- package/icons/providers/meta.webp +0 -0
- package/icons/providers/metaai.webp +0 -0
- package/icons/providers/metagpt.webp +0 -0
- package/icons/providers/microsoft.webp +0 -0
- package/icons/providers/midjourney.webp +0 -0
- package/icons/providers/minimax.webp +0 -0
- package/icons/providers/mistral.webp +0 -0
- package/icons/providers/modelscope.webp +0 -0
- package/icons/providers/monica.webp +0 -0
- package/icons/providers/moonshot.webp +0 -0
- package/icons/providers/morph.webp +0 -0
- package/icons/providers/moxt.webp +0 -0
- package/icons/providers/myshell.webp +0 -0
- package/icons/providers/n8n.webp +0 -0
- package/icons/providers/nanobanana.webp +0 -0
- package/icons/providers/nebius.webp +0 -0
- package/icons/providers/newapi.webp +0 -0
- package/icons/providers/notebooklm.webp +0 -0
- package/icons/providers/notion.webp +0 -0
- package/icons/providers/nousresearch.webp +0 -0
- package/icons/providers/nova.webp +0 -0
- package/icons/providers/novelai.webp +0 -0
- package/icons/providers/novita.webp +0 -0
- package/icons/providers/nplcloud.webp +0 -0
- package/icons/providers/nvidia.webp +0 -0
- package/icons/providers/o3.webp +0 -0
- package/icons/providers/obsidian.webp +0 -0
- package/icons/providers/ollama.webp +0 -0
- package/icons/providers/openai.webp +0 -0
- package/icons/providers/openchat.webp +0 -0
- package/icons/providers/openclaw.webp +0 -0
- package/icons/providers/opencode.webp +0 -0
- package/icons/providers/openhands.webp +0 -0
- package/icons/providers/openhuman.webp +0 -0
- package/icons/providers/openrouter.webp +0 -0
- package/icons/providers/openwebui.webp +0 -0
- package/icons/providers/paddleocr.webp +0 -0
- package/icons/providers/palm.webp +0 -0
- package/icons/providers/parasail.webp +0 -0
- package/icons/providers/perplexity.webp +0 -0
- package/icons/providers/phidata.webp +0 -0
- package/icons/providers/phind.webp +0 -0
- package/icons/providers/pika.webp +0 -0
- package/icons/providers/pixverse.webp +0 -0
- package/icons/providers/player2.webp +0 -0
- package/icons/providers/poe.webp +0 -0
- package/icons/providers/pollinations.webp +0 -0
- package/icons/providers/ppio.webp +0 -0
- package/icons/providers/prunaai.webp +0 -0
- package/icons/providers/pydanticai.webp +0 -0
- package/icons/providers/qingyan.webp +0 -0
- package/icons/providers/qiniu.webp +0 -0
- package/icons/providers/qoder.webp +0 -0
- package/icons/providers/qwen.webp +0 -0
- package/icons/providers/railway.webp +0 -0
- package/icons/providers/recraft.webp +0 -0
- package/icons/providers/relace.webp +0 -0
- package/icons/providers/replicate.webp +0 -0
- package/icons/providers/replit.webp +0 -0
- package/icons/providers/reve.webp +0 -0
- package/icons/providers/roocode.webp +0 -0
- package/icons/providers/rsshub.webp +0 -0
- package/icons/providers/runway.webp +0 -0
- package/icons/providers/rwkv.webp +0 -0
- package/icons/providers/sambanova.webp +0 -0
- package/icons/providers/search1api.webp +0 -0
- package/icons/providers/searchapi.webp +0 -0
- package/icons/providers/sensenova.webp +0 -0
- package/icons/providers/silicon.webp +0 -0
- package/icons/providers/siliconcloud.webp +0 -0
- package/icons/providers/sillytavern.webp +0 -0
- package/icons/providers/skywork.webp +0 -0
- package/icons/providers/slock.webp +0 -0
- package/icons/providers/smithery.webp +0 -0
- package/icons/providers/snowflake.webp +0 -0
- package/icons/providers/sophnet.webp +0 -0
- package/icons/providers/sora.webp +0 -0
- package/icons/providers/spark.webp +0 -0
- package/icons/providers/speedai.webp +0 -0
- package/icons/providers/stability.webp +0 -0
- package/icons/providers/statecloud.webp +0 -0
- package/icons/providers/step.webp +0 -0
- package/icons/providers/stepfun.webp +0 -0
- package/icons/providers/straico.webp +0 -0
- package/icons/providers/streamlake.webp +0 -0
- package/icons/providers/submodel.webp +0 -0
- package/icons/providers/suno.webp +0 -0
- package/icons/providers/sync.webp +0 -0
- package/icons/providers/targon.webp +0 -0
- package/icons/providers/tavily.webp +0 -0
- package/icons/providers/tencent-cloud-ti.webp +0 -0
- package/icons/providers/tencent.webp +0 -0
- package/icons/providers/tencentcloud.webp +0 -0
- package/icons/providers/tiangong.webp +0 -0
- package/icons/providers/tii.webp +0 -0
- package/icons/providers/together.webp +0 -0
- package/icons/providers/tokenrouter.png +0 -0
- package/icons/providers/topazlabs.webp +0 -0
- package/icons/providers/trae.webp +0 -0
- package/icons/providers/tripo.webp +0 -0
- package/icons/providers/turix.webp +0 -0
- package/icons/providers/udio.webp +0 -0
- package/icons/providers/unstructured.webp +0 -0
- package/icons/providers/upstage.webp +0 -0
- package/icons/providers/v0.webp +0 -0
- package/icons/providers/vectorizerai.webp +0 -0
- package/icons/providers/venice.webp +0 -0
- package/icons/providers/vercel.webp +0 -0
- package/icons/providers/vertexai.webp +0 -0
- package/icons/providers/vidu.webp +0 -0
- package/icons/providers/viggle.webp +0 -0
- package/icons/providers/vllm.webp +0 -0
- package/icons/providers/volcengine.webp +0 -0
- package/icons/providers/voyage.webp +0 -0
- package/icons/providers/voyageai.webp +0 -0
- package/icons/providers/wenxin.webp +0 -0
- package/icons/providers/windsurf.webp +0 -0
- package/icons/providers/workersai.webp +0 -0
- package/icons/providers/worldrouter.webp +0 -0
- package/icons/providers/xai.webp +0 -0
- package/icons/providers/xiaomimimo.webp +0 -0
- package/icons/providers/xinference.webp +0 -0
- package/icons/providers/xirang.png +0 -0
- package/icons/providers/xpay.webp +0 -0
- package/icons/providers/xuanyuan.webp +0 -0
- package/icons/providers/yandex.webp +0 -0
- package/icons/providers/yi.webp +0 -0
- package/icons/providers/youmind.webp +0 -0
- package/icons/providers/yuanbao.webp +0 -0
- package/icons/providers/zai.webp +0 -0
- package/icons/providers/zapier.webp +0 -0
- package/icons/providers/zeabur.webp +0 -0
- package/icons/providers/zencoder.webp +0 -0
- package/icons/providers/zenmux.webp +0 -0
- package/icons/providers/zero-one.webp +0 -0
- package/icons/providers/zeroone.webp +0 -0
- package/icons/providers/zhipu.webp +0 -0
- package/package.json +105 -32
- package/styles/content.css +129 -0
- package/styles/yunui.css +185 -21
- package/dist/chunk-6MZN3GOP.js.map +0 -1
- package/dist/chunk-LLNTUA5K.js.map +0 -1
- package/dist/chunk-N53PNMPJ.js.map +0 -1
- package/dist/chunk-U2LNRVMI.js.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn, useAnchoredPosition } from './chunk-
|
|
3
|
-
import { useYunUI } from './chunk-
|
|
2
|
+
import { cn, useAnchoredPosition } from './chunk-N4QO7RN5.js';
|
|
3
|
+
import { useYunUI } from './chunk-3RT24MSH.js';
|
|
4
4
|
import * as React7 from 'react';
|
|
5
|
-
import { forwardRef,
|
|
5
|
+
import { forwardRef, useRef, useCallback, useEffect, useState, useId } from 'react';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
7
|
+
import { Minus, Check, ChevronDown, ChevronUp, ChevronsUpDown, ChevronLeft, ChevronRight, Loader2, AlertCircle, EyeOff, Eye, Plus, Search, X, CheckCircle2, CheckCircle, Info, RefreshCw, Trash2, AlertTriangle } from 'lucide-react';
|
|
6
8
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
7
9
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
8
10
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -11,15 +13,10 @@ import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
|
11
13
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
12
14
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
13
15
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
14
|
-
import { motion, AnimatePresence
|
|
15
|
-
import { Minus, Check, ChevronDown, ChevronLeft, ChevronRight, Loader2, AlertCircle, EyeOff, Eye, Plus, Search, X, CheckCircle2, CheckCircle, Info, RefreshCw, Trash2, ArrowRight, AlertTriangle } from 'lucide-react';
|
|
16
|
-
import { createPortal } from 'react-dom';
|
|
16
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
17
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
18
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
19
19
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
20
|
-
import * as Primitive from '@radix-ui/react-collapsible';
|
|
21
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
22
|
-
import { Toaster as Toaster$1, toast as toast$1 } from 'sonner';
|
|
23
20
|
|
|
24
21
|
function useEscapeKey(onEscape, enabled = true) {
|
|
25
22
|
const onEscapeRef = useRef(onEscape);
|
|
@@ -152,163 +149,6 @@ var SIZE_CLASSES = {
|
|
|
152
149
|
var ANIMATION_DURATION = 150;
|
|
153
150
|
var DEFAULT_MAX_HEIGHT = "85vh";
|
|
154
151
|
var closeIdCounter = 0;
|
|
155
|
-
function Modal({
|
|
156
|
-
isOpen,
|
|
157
|
-
onClose,
|
|
158
|
-
title,
|
|
159
|
-
subtitle,
|
|
160
|
-
children,
|
|
161
|
-
footer,
|
|
162
|
-
size = "lg",
|
|
163
|
-
className,
|
|
164
|
-
showCloseButton = true,
|
|
165
|
-
isClosing: externalIsClosing,
|
|
166
|
-
setIsClosing: externalSetIsClosing,
|
|
167
|
-
showUnsavedBadge = false,
|
|
168
|
-
maxHeight = DEFAULT_MAX_HEIGHT,
|
|
169
|
-
onBackdropClick
|
|
170
|
-
}) {
|
|
171
|
-
const t = useYunUI().useT("components.modal");
|
|
172
|
-
const modalRef = useRef(null);
|
|
173
|
-
const timeoutRef = useRef(null);
|
|
174
|
-
const closeIdRef = useRef(0);
|
|
175
|
-
const [internalIsClosing, setInternalIsClosing] = useState(false);
|
|
176
|
-
const [mounted, setMounted] = useState(false);
|
|
177
|
-
const isClosing = externalIsClosing ?? internalIsClosing;
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
setMounted(true);
|
|
180
|
-
return () => setMounted(false);
|
|
181
|
-
}, []);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
return () => {
|
|
184
|
-
if (timeoutRef.current) {
|
|
185
|
-
clearTimeout(timeoutRef.current);
|
|
186
|
-
timeoutRef.current = null;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}, []);
|
|
190
|
-
const isClosingRef = useRef(isClosing);
|
|
191
|
-
isClosingRef.current = isClosing;
|
|
192
|
-
const onCloseRef = useRef(onClose);
|
|
193
|
-
onCloseRef.current = onClose;
|
|
194
|
-
const externalSetIsClosingRef = useRef(externalSetIsClosing);
|
|
195
|
-
externalSetIsClosingRef.current = externalSetIsClosing;
|
|
196
|
-
const handleClose = useCallback(() => {
|
|
197
|
-
if (isClosingRef.current) return;
|
|
198
|
-
if (timeoutRef.current) {
|
|
199
|
-
clearTimeout(timeoutRef.current);
|
|
200
|
-
timeoutRef.current = null;
|
|
201
|
-
}
|
|
202
|
-
const currentCloseId = ++closeIdCounter;
|
|
203
|
-
closeIdRef.current = currentCloseId;
|
|
204
|
-
const executeClose = () => {
|
|
205
|
-
if (closeIdRef.current === currentCloseId) {
|
|
206
|
-
onCloseRef.current();
|
|
207
|
-
if (externalSetIsClosingRef.current) {
|
|
208
|
-
externalSetIsClosingRef.current(false);
|
|
209
|
-
} else {
|
|
210
|
-
setInternalIsClosing(false);
|
|
211
|
-
}
|
|
212
|
-
timeoutRef.current = null;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
if (externalSetIsClosingRef.current) {
|
|
216
|
-
externalSetIsClosingRef.current(true);
|
|
217
|
-
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
218
|
-
} else {
|
|
219
|
-
setInternalIsClosing(true);
|
|
220
|
-
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
221
|
-
}
|
|
222
|
-
}, []);
|
|
223
|
-
useEscapeKey(handleClose, isOpen);
|
|
224
|
-
useBodyScrollLock(isOpen);
|
|
225
|
-
useFocusTrap(modalRef, isOpen);
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
if (isOpen && internalIsClosing) {
|
|
228
|
-
setInternalIsClosing(false);
|
|
229
|
-
}
|
|
230
|
-
}, [isOpen, internalIsClosing]);
|
|
231
|
-
const handleBackdropClick = useCallback((e) => {
|
|
232
|
-
if (e.target === e.currentTarget) {
|
|
233
|
-
if (onBackdropClick) {
|
|
234
|
-
onBackdropClick();
|
|
235
|
-
} else {
|
|
236
|
-
handleClose();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}, [onBackdropClick, handleClose]);
|
|
240
|
-
if (!isOpen || !mounted) return null;
|
|
241
|
-
const sizeClass = SIZE_CLASSES[size] ?? SIZE_CLASSES.lg;
|
|
242
|
-
const modalContent = /* @__PURE__ */ jsxs(
|
|
243
|
-
"div",
|
|
244
|
-
{
|
|
245
|
-
className: cn(
|
|
246
|
-
"fixed inset-0 flex items-center justify-center p-4 transition-opacity",
|
|
247
|
-
isClosing ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
248
|
-
),
|
|
249
|
-
style: { zIndex: Z_INDEX.MODAL },
|
|
250
|
-
onClick: handleBackdropClick,
|
|
251
|
-
role: "dialog",
|
|
252
|
-
"aria-modal": "true",
|
|
253
|
-
"aria-labelledby": "modal-title",
|
|
254
|
-
children: [
|
|
255
|
-
/* @__PURE__ */ jsx(
|
|
256
|
-
"div",
|
|
257
|
-
{
|
|
258
|
-
className: cn(
|
|
259
|
-
"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity",
|
|
260
|
-
isClosing ? "opacity-0" : "opacity-100"
|
|
261
|
-
),
|
|
262
|
-
onClick: handleClose,
|
|
263
|
-
"aria-hidden": "true"
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
/* @__PURE__ */ jsxs(
|
|
267
|
-
"div",
|
|
268
|
-
{
|
|
269
|
-
ref: modalRef,
|
|
270
|
-
className: cn(
|
|
271
|
-
// Glassy surface (not the solid .card) to match Sheet/Dialog/navbar.
|
|
272
|
-
"relative w-full rounded-2xl border border-border bg-background/95 backdrop-blur-xl shadow-2xl flex flex-col transition-all",
|
|
273
|
-
sizeClass,
|
|
274
|
-
isClosing ? "scale-95 opacity-0" : "scale-100 opacity-100",
|
|
275
|
-
className
|
|
276
|
-
),
|
|
277
|
-
style: { maxHeight },
|
|
278
|
-
onClick: (e) => e.stopPropagation(),
|
|
279
|
-
tabIndex: -1,
|
|
280
|
-
children: [
|
|
281
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b border-border shrink-0", children: [
|
|
282
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1 min-w-0", children: [
|
|
283
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
284
|
-
/* @__PURE__ */ jsx("h2", { id: "modal-title", className: "text-lg font-semibold truncate", children: title }),
|
|
285
|
-
showUnsavedBadge && /* @__PURE__ */ jsx("span", { className: "badge-warning shrink-0", children: t("unsaved") })
|
|
286
|
-
] }),
|
|
287
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground truncate", children: subtitle })
|
|
288
|
-
] }),
|
|
289
|
-
showCloseButton && /* @__PURE__ */ jsx(
|
|
290
|
-
Button,
|
|
291
|
-
{
|
|
292
|
-
variant: "ghost",
|
|
293
|
-
size: "sm",
|
|
294
|
-
onClick: handleClose,
|
|
295
|
-
className: "p-2 shrink-0",
|
|
296
|
-
"aria-label": t("close"),
|
|
297
|
-
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
298
|
-
}
|
|
299
|
-
)
|
|
300
|
-
] }),
|
|
301
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-6", children }),
|
|
302
|
-
footer && /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-border bg-muted/20 shrink-0", children: footer })
|
|
303
|
-
]
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
]
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
return createPortal(modalContent, document.body);
|
|
310
|
-
}
|
|
311
|
-
var closeIdCounter2 = 0;
|
|
312
152
|
var variantConfig = {
|
|
313
153
|
danger: {
|
|
314
154
|
iconBg: "bg-error-soft",
|
|
@@ -384,7 +224,7 @@ function ConfirmModal({
|
|
|
384
224
|
clearTimeout(timeoutRef.current);
|
|
385
225
|
timeoutRef.current = null;
|
|
386
226
|
}
|
|
387
|
-
const currentCloseId = ++
|
|
227
|
+
const currentCloseId = ++closeIdCounter;
|
|
388
228
|
closeIdRef.current = currentCloseId;
|
|
389
229
|
setIsClosing(true);
|
|
390
230
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -416,7 +256,7 @@ function ConfirmModal({
|
|
|
416
256
|
"div",
|
|
417
257
|
{
|
|
418
258
|
className: cn(
|
|
419
|
-
"fixed inset-0 flex items-center justify-center p-4 transition-opacity",
|
|
259
|
+
"fixed inset-0 pointer-events-auto flex items-center justify-center p-4 transition-opacity",
|
|
420
260
|
isClosing ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
421
261
|
),
|
|
422
262
|
style: { zIndex: Z_INDEX.CONFIRM_DIALOG },
|
|
@@ -592,7 +432,7 @@ function Sheet({ open, onClose, children, title, mobileOnly = false }) {
|
|
|
592
432
|
}
|
|
593
433
|
)
|
|
594
434
|
] }),
|
|
595
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children })
|
|
435
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto px-5 py-4", children })
|
|
596
436
|
]
|
|
597
437
|
},
|
|
598
438
|
"sheet-panel"
|
|
@@ -635,6 +475,7 @@ function Combobox({
|
|
|
635
475
|
placeholder,
|
|
636
476
|
className = "",
|
|
637
477
|
disabled = false,
|
|
478
|
+
clearable = true,
|
|
638
479
|
allowCustom = true,
|
|
639
480
|
creatableText,
|
|
640
481
|
creatableFilter,
|
|
@@ -650,22 +491,24 @@ function Combobox({
|
|
|
650
491
|
const containerRef = useRef(null);
|
|
651
492
|
const inputRef = useRef(null);
|
|
652
493
|
const panelRef = useRef(null);
|
|
653
|
-
const { shift, maxHeight } = useAnchoredPosition(isOpen, panelRef);
|
|
494
|
+
const { shift, maxHeight, placement } = useAnchoredPosition(isOpen, panelRef);
|
|
654
495
|
const listboxId = useId();
|
|
655
496
|
const optionId = (i) => `${listboxId}-opt-${i}`;
|
|
497
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
498
|
+
const selectedDisplayValue = selectedOption?.label || value || "";
|
|
656
499
|
useEffect(() => {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}, [value, options]);
|
|
500
|
+
setInputValue(selectedDisplayValue);
|
|
501
|
+
}, [selectedDisplayValue]);
|
|
660
502
|
useEffect(() => {
|
|
661
503
|
const handleClickOutside = (e) => {
|
|
662
504
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
663
505
|
setIsOpen(false);
|
|
506
|
+
setInputValue(selectedDisplayValue);
|
|
664
507
|
}
|
|
665
508
|
};
|
|
666
509
|
document.addEventListener("mousedown", handleClickOutside);
|
|
667
510
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
668
|
-
}, []);
|
|
511
|
+
}, [selectedDisplayValue]);
|
|
669
512
|
useEffect(() => {
|
|
670
513
|
setHighlighted(-1);
|
|
671
514
|
}, [inputValue, isOpen]);
|
|
@@ -676,6 +519,8 @@ function Combobox({
|
|
|
676
519
|
(o) => o.value.toLowerCase() === inputValue.toLowerCase() || o.label.toLowerCase() === inputValue.toLowerCase()
|
|
677
520
|
) && (!creatableFilter || creatableFilter(inputValue));
|
|
678
521
|
const handleSelect = (selectedValue) => {
|
|
522
|
+
const option = options.find((o) => o.value === selectedValue);
|
|
523
|
+
setInputValue(option?.label || selectedValue);
|
|
679
524
|
onChange(selectedValue);
|
|
680
525
|
setIsOpen(false);
|
|
681
526
|
};
|
|
@@ -719,7 +564,7 @@ function Combobox({
|
|
|
719
564
|
break;
|
|
720
565
|
case "Escape":
|
|
721
566
|
setIsOpen(false);
|
|
722
|
-
setInputValue(
|
|
567
|
+
setInputValue(selectedDisplayValue);
|
|
723
568
|
break;
|
|
724
569
|
}
|
|
725
570
|
};
|
|
@@ -728,15 +573,15 @@ function Combobox({
|
|
|
728
573
|
setInputValue("");
|
|
729
574
|
inputRef.current?.focus();
|
|
730
575
|
};
|
|
731
|
-
const
|
|
732
|
-
const selectedIconPath = selectedOption?.iconUrl ?? null;
|
|
576
|
+
const selectedIconPath = inputValue === selectedDisplayValue ? selectedOption?.iconUrl ?? null : null;
|
|
733
577
|
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative ${className}`, children: [
|
|
734
578
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
735
579
|
selectedIconPath && selectedOption && /* @__PURE__ */ jsx("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-linear-to-br from-black/2 to-black/5", style: { width: 16, height: 16 }, children: /* @__PURE__ */ jsx(
|
|
736
580
|
Image2,
|
|
737
581
|
{
|
|
738
582
|
src: selectedIconPath,
|
|
739
|
-
alt:
|
|
583
|
+
alt: "",
|
|
584
|
+
"aria-hidden": "true",
|
|
740
585
|
width: 16,
|
|
741
586
|
height: 16,
|
|
742
587
|
className: "object-cover",
|
|
@@ -765,13 +610,13 @@ function Combobox({
|
|
|
765
610
|
rounded-xl border border-(--border-default) bg-(--bg-elevated)
|
|
766
611
|
hover:border-(--border-strong) hover:bg-(--bg-hover)
|
|
767
612
|
focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary
|
|
768
|
-
transition-all duration-200 text-sm
|
|
613
|
+
truncate transition-all duration-200 text-sm
|
|
769
614
|
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
770
615
|
${selectedIconPath ? "pl-10 pr-20" : "px-3 pr-20"}
|
|
771
616
|
`
|
|
772
617
|
}
|
|
773
618
|
),
|
|
774
|
-
inputValue && !disabled && /* @__PURE__ */ jsx(
|
|
619
|
+
clearable && inputValue && !disabled && /* @__PURE__ */ jsx(
|
|
775
620
|
"button",
|
|
776
621
|
{
|
|
777
622
|
type: "button",
|
|
@@ -785,7 +630,11 @@ function Combobox({
|
|
|
785
630
|
"button",
|
|
786
631
|
{
|
|
787
632
|
type: "button",
|
|
788
|
-
onClick: () =>
|
|
633
|
+
onClick: () => {
|
|
634
|
+
if (disabled) return;
|
|
635
|
+
if (isOpen) setInputValue(selectedDisplayValue);
|
|
636
|
+
setIsOpen(!isOpen);
|
|
637
|
+
},
|
|
789
638
|
disabled,
|
|
790
639
|
"aria-label": "Toggle options",
|
|
791
640
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 disabled:opacity-50 outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
@@ -798,7 +647,7 @@ function Combobox({
|
|
|
798
647
|
{
|
|
799
648
|
ref: panelRef,
|
|
800
649
|
style: { marginLeft: shift, maxHeight },
|
|
801
|
-
className:
|
|
650
|
+
className: `absolute z-50 w-full ${placement === "top" ? "bottom-full mb-2 origin-bottom" : "top-full mt-2 origin-top"} p-1 rounded-2xl border border-border bg-popover text-popover-foreground shadow-lg shadow-black/5 overflow-hidden flex flex-col animate-in fade-in-0 zoom-in-95 duration-200`,
|
|
802
651
|
children: /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 max-h-60 overflow-y-auto", role: "listbox", id: listboxId, children: filteredOptions.length === 0 && !canCreateNew ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: t("noResults") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
803
652
|
filteredOptions.map((option, i) => {
|
|
804
653
|
const isSelected = option.value === value;
|
|
@@ -820,7 +669,8 @@ function Combobox({
|
|
|
820
669
|
Image2,
|
|
821
670
|
{
|
|
822
671
|
src: optionIconPath,
|
|
823
|
-
alt:
|
|
672
|
+
alt: "",
|
|
673
|
+
"aria-hidden": "true",
|
|
824
674
|
width: 16,
|
|
825
675
|
height: 16,
|
|
826
676
|
className: "object-cover",
|
|
@@ -1167,17 +1017,52 @@ var TableRow = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1167
1017
|
}
|
|
1168
1018
|
));
|
|
1169
1019
|
TableRow.displayName = "TableRow";
|
|
1170
|
-
var TableHead = React7.forwardRef(({ className, ...props }, ref) =>
|
|
1171
|
-
"
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1020
|
+
var TableHead = React7.forwardRef(({ className, onSort, sortDirection, align = "left", children, ...props }, ref) => {
|
|
1021
|
+
const alignClass = align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left";
|
|
1022
|
+
const head = cn(
|
|
1023
|
+
// whitespace-nowrap: header labels are short and must never wrap — CJK labels in
|
|
1024
|
+
// particular would otherwise break mid-word (能力 → 能/力) in narrow columns / WebKit.
|
|
1025
|
+
"h-10 whitespace-nowrap px-4 align-middle text-[11px] font-medium uppercase tracking-wider text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
1026
|
+
alignClass,
|
|
1027
|
+
className
|
|
1028
|
+
);
|
|
1029
|
+
if (!onSort) {
|
|
1030
|
+
return /* @__PURE__ */ jsx("th", { ref, className: head, ...props, children });
|
|
1179
1031
|
}
|
|
1180
|
-
|
|
1032
|
+
const Icon2 = sortDirection === "asc" ? ChevronUp : sortDirection === "desc" ? ChevronDown : ChevronsUpDown;
|
|
1033
|
+
const justify = align === "right" ? "justify-end" : align === "center" ? "justify-center" : "justify-start";
|
|
1034
|
+
return /* @__PURE__ */ jsx(
|
|
1035
|
+
"th",
|
|
1036
|
+
{
|
|
1037
|
+
ref,
|
|
1038
|
+
"aria-sort": sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none",
|
|
1039
|
+
className: head,
|
|
1040
|
+
...props,
|
|
1041
|
+
children: /* @__PURE__ */ jsxs(
|
|
1042
|
+
"button",
|
|
1043
|
+
{
|
|
1044
|
+
type: "button",
|
|
1045
|
+
onClick: onSort,
|
|
1046
|
+
className: cn(
|
|
1047
|
+
"inline-flex w-full items-center gap-1 uppercase tracking-wider transition-colors hover:text-foreground",
|
|
1048
|
+
justify
|
|
1049
|
+
),
|
|
1050
|
+
children: [
|
|
1051
|
+
children,
|
|
1052
|
+
/* @__PURE__ */ jsx(
|
|
1053
|
+
Icon2,
|
|
1054
|
+
{
|
|
1055
|
+
size: 12,
|
|
1056
|
+
"aria-hidden": true,
|
|
1057
|
+
className: cn("shrink-0", sortDirection ? "text-primary" : "opacity-40")
|
|
1058
|
+
}
|
|
1059
|
+
)
|
|
1060
|
+
]
|
|
1061
|
+
}
|
|
1062
|
+
)
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
});
|
|
1181
1066
|
TableHead.displayName = "TableHead";
|
|
1182
1067
|
var TableCell = React7.forwardRef(({ className, label, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1183
1068
|
"td",
|
|
@@ -1432,27 +1317,29 @@ var Input = React7.forwardRef(
|
|
|
1432
1317
|
const fieldId = id ?? reactId;
|
|
1433
1318
|
const errorId = error ? `${fieldId}-error` : void 0;
|
|
1434
1319
|
const describedByIds = [describedBy, errorId].filter(Boolean).join(" ") || void 0;
|
|
1435
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1320
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1321
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1322
|
+
icon && /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: icon }),
|
|
1323
|
+
/* @__PURE__ */ jsx(
|
|
1324
|
+
"input",
|
|
1325
|
+
{
|
|
1326
|
+
ref,
|
|
1327
|
+
id: fieldId,
|
|
1328
|
+
"aria-invalid": error ? true : void 0,
|
|
1329
|
+
"aria-describedby": describedByIds,
|
|
1330
|
+
className: cn(
|
|
1331
|
+
"w-full h-10 px-4 bg-background border border-border rounded-xl text-sm outline-none transition-colors",
|
|
1332
|
+
"placeholder:text-muted-foreground",
|
|
1333
|
+
"focus:border-ring focus:ring-2 focus:ring-ring/20",
|
|
1334
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1335
|
+
icon && "pl-10",
|
|
1336
|
+
error ? "border-(--error) focus:border-(--error)" : "border-border",
|
|
1337
|
+
className
|
|
1338
|
+
),
|
|
1339
|
+
...props
|
|
1340
|
+
}
|
|
1341
|
+
)
|
|
1342
|
+
] }),
|
|
1456
1343
|
error && /* @__PURE__ */ jsxs("p", { id: errorId, className: "mt-1.5 text-xs text-error flex items-center gap-1", children: [
|
|
1457
1344
|
/* @__PURE__ */ jsx(AlertCircle, { "aria-hidden": "true", className: "w-3 h-3" }),
|
|
1458
1345
|
error
|
|
@@ -1476,7 +1363,7 @@ var Textarea = React7.forwardRef(
|
|
|
1476
1363
|
"aria-invalid": error ? true : void 0,
|
|
1477
1364
|
"aria-describedby": describedByIds,
|
|
1478
1365
|
className: cn(
|
|
1479
|
-
"w-full px-4 py-3 bg-background border rounded-xl text-sm outline-none transition-colors resize-none",
|
|
1366
|
+
"w-full px-4 py-3 bg-background border border-border rounded-xl text-sm outline-none transition-colors resize-none",
|
|
1480
1367
|
"placeholder:text-muted-foreground",
|
|
1481
1368
|
"focus:border-ring focus:ring-2 focus:ring-ring/20",
|
|
1482
1369
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -1506,7 +1393,7 @@ var PasswordInput = React7.forwardRef(
|
|
|
1506
1393
|
"div",
|
|
1507
1394
|
{
|
|
1508
1395
|
className: cn(
|
|
1509
|
-
"flex items-center h-10 rounded-xl border bg-background transition-colors",
|
|
1396
|
+
"flex items-center h-10 rounded-xl border border-border bg-background transition-colors",
|
|
1510
1397
|
"focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
1511
1398
|
error ? "border-(--error) focus:border-(--error)" : "border-border",
|
|
1512
1399
|
disabled && "opacity-50",
|
|
@@ -1567,7 +1454,7 @@ var NumberInput = React7.forwardRef(
|
|
|
1567
1454
|
"div",
|
|
1568
1455
|
{
|
|
1569
1456
|
className: cn(
|
|
1570
|
-
"relative flex items-stretch rounded-xl border bg-background transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
1457
|
+
"relative flex items-stretch rounded-xl border border-border bg-background transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
1571
1458
|
error ? "border-(--error) focus:border-(--error)" : "border-border",
|
|
1572
1459
|
disabled && "opacity-50",
|
|
1573
1460
|
className
|
|
@@ -1723,13 +1610,27 @@ var Card = React7.forwardRef(
|
|
|
1723
1610
|
}
|
|
1724
1611
|
);
|
|
1725
1612
|
Card.displayName = "Card";
|
|
1613
|
+
var CardHeader = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props }));
|
|
1614
|
+
CardHeader.displayName = "CardHeader";
|
|
1615
|
+
var CardTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props }));
|
|
1616
|
+
CardTitle.displayName = "CardTitle";
|
|
1617
|
+
var CardDescription = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
1618
|
+
CardDescription.displayName = "CardDescription";
|
|
1619
|
+
var CardContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
1620
|
+
CardContent.displayName = "CardContent";
|
|
1621
|
+
var CardFooter = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props }));
|
|
1622
|
+
CardFooter.displayName = "CardFooter";
|
|
1726
1623
|
function Badge({ className, variant = "default", ...props }) {
|
|
1727
1624
|
const variants = {
|
|
1728
1625
|
default: "bg-muted text-foreground/80",
|
|
1729
1626
|
success: "bg-success-soft text-success",
|
|
1730
1627
|
warning: "bg-warning-soft text-warning",
|
|
1731
1628
|
error: "bg-error-soft text-error",
|
|
1732
|
-
info: "bg-info-soft text-info"
|
|
1629
|
+
info: "bg-info-soft text-info",
|
|
1630
|
+
// Structural (shadcn-compatible) variants:
|
|
1631
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
1632
|
+
outline: "border border-border text-foreground",
|
|
1633
|
+
destructive: "bg-error-soft text-error"
|
|
1733
1634
|
};
|
|
1734
1635
|
return /* @__PURE__ */ jsx(
|
|
1735
1636
|
"span",
|
|
@@ -1743,7 +1644,7 @@ function Badge({ className, variant = "default", ...props }) {
|
|
|
1743
1644
|
}
|
|
1744
1645
|
);
|
|
1745
1646
|
}
|
|
1746
|
-
function
|
|
1647
|
+
function Separator3({
|
|
1747
1648
|
className,
|
|
1748
1649
|
orientation = "horizontal",
|
|
1749
1650
|
decorative = false,
|
|
@@ -1768,13 +1669,15 @@ function Alert({ className, variant = "info", title, icon, children, ...props })
|
|
|
1768
1669
|
info: "bg-info-soft text-info border-info-soft",
|
|
1769
1670
|
success: "bg-success-soft text-success border-success-soft",
|
|
1770
1671
|
warning: "bg-warning-soft text-warning border-warning-soft",
|
|
1771
|
-
error: "bg-error-soft text-error border-error-soft"
|
|
1672
|
+
error: "bg-error-soft text-error border-error-soft",
|
|
1673
|
+
accent: "bg-accent-soft text-accent border-accent-soft"
|
|
1772
1674
|
};
|
|
1773
1675
|
const defaultIcon = {
|
|
1774
1676
|
info: /* @__PURE__ */ jsx(Info, { className: "h-4 w-4" }),
|
|
1775
1677
|
success: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4" }),
|
|
1776
1678
|
warning: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4" }),
|
|
1777
|
-
error: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" })
|
|
1679
|
+
error: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
1680
|
+
accent: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" })
|
|
1778
1681
|
};
|
|
1779
1682
|
const resolvedIcon = icon === void 0 ? defaultIcon[variant] : icon;
|
|
1780
1683
|
const role = variant === "error" || variant === "warning" ? "alert" : "status";
|
|
@@ -1782,7 +1685,7 @@ function Alert({ className, variant = "info", title, icon, children, ...props })
|
|
|
1782
1685
|
"div",
|
|
1783
1686
|
{
|
|
1784
1687
|
role,
|
|
1785
|
-
className: cn("flex gap-3 rounded-xl border p-3 text-sm", styles[variant], className),
|
|
1688
|
+
className: cn("flex gap-3 rounded-xl border border-border p-3 text-sm", styles[variant], className),
|
|
1786
1689
|
...props,
|
|
1787
1690
|
children: [
|
|
1788
1691
|
resolvedIcon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "mt-0.5 shrink-0", children: resolvedIcon }),
|
|
@@ -1885,7 +1788,7 @@ function Steps({ steps, current = 0, className, ...props }) {
|
|
|
1885
1788
|
{
|
|
1886
1789
|
"aria-hidden": "true",
|
|
1887
1790
|
className: cn(
|
|
1888
|
-
"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-xs font-medium",
|
|
1791
|
+
"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border text-xs font-medium",
|
|
1889
1792
|
state === "done" && "border-transparent bg-primary text-primary-foreground",
|
|
1890
1793
|
state === "active" && "border-primary text-primary",
|
|
1891
1794
|
state === "upcoming" && "border-border text-muted-foreground"
|
|
@@ -1944,8 +1847,9 @@ var DialogContent = React7.forwardRef(({ className, children, ...props }, ref) =
|
|
|
1944
1847
|
ref,
|
|
1945
1848
|
className: cn(
|
|
1946
1849
|
"fixed left-[50%] top-[50%] z-50 w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%]",
|
|
1947
|
-
//
|
|
1948
|
-
|
|
1850
|
+
// Dialogs may be nested above another modal. Keep the content
|
|
1851
|
+
// surface opaque so labels and controls below never bleed through.
|
|
1852
|
+
"bg-background border border-border rounded-2xl shadow-2xl p-6",
|
|
1949
1853
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1950
1854
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1951
1855
|
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
@@ -1956,7 +1860,7 @@ var DialogContent = React7.forwardRef(({ className, children, ...props }, ref) =
|
|
|
1956
1860
|
...props,
|
|
1957
1861
|
children: [
|
|
1958
1862
|
children,
|
|
1959
|
-
/* @__PURE__ */ jsx(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-lg p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) })
|
|
1863
|
+
/* @__PURE__ */ jsx(DialogPrimitive.Close, { "aria-label": "Close", className: "absolute right-4 top-4 rounded-lg p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) })
|
|
1960
1864
|
]
|
|
1961
1865
|
}
|
|
1962
1866
|
)
|
|
@@ -2014,7 +1918,7 @@ var SelectContent = React7.forwardRef(({ className, children, position = "popper
|
|
|
2014
1918
|
ref,
|
|
2015
1919
|
position,
|
|
2016
1920
|
className: cn(
|
|
2017
|
-
"relative z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-
|
|
1921
|
+
"relative z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-popover text-popover-foreground shadow-lg shadow-black/5",
|
|
2018
1922
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
2019
1923
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
2020
1924
|
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
@@ -2050,14 +1954,52 @@ var SelectItem = React7.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
2050
1954
|
}
|
|
2051
1955
|
));
|
|
2052
1956
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1957
|
+
var SelectLabel = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1958
|
+
SelectPrimitive.Label,
|
|
1959
|
+
{
|
|
1960
|
+
ref,
|
|
1961
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
|
|
1962
|
+
...props
|
|
1963
|
+
}
|
|
1964
|
+
));
|
|
1965
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1966
|
+
var SelectSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1967
|
+
SelectPrimitive.Separator,
|
|
1968
|
+
{
|
|
1969
|
+
ref,
|
|
1970
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
1971
|
+
...props
|
|
1972
|
+
}
|
|
1973
|
+
));
|
|
1974
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1975
|
+
var SelectScrollUpButton = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1976
|
+
SelectPrimitive.ScrollUpButton,
|
|
1977
|
+
{
|
|
1978
|
+
ref,
|
|
1979
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1980
|
+
...props,
|
|
1981
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4" })
|
|
1982
|
+
}
|
|
1983
|
+
));
|
|
1984
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1985
|
+
var SelectScrollDownButton = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1986
|
+
SelectPrimitive.ScrollDownButton,
|
|
1987
|
+
{
|
|
1988
|
+
ref,
|
|
1989
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1990
|
+
...props,
|
|
1991
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
1992
|
+
}
|
|
1993
|
+
));
|
|
1994
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
2053
1995
|
var Slider = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
2054
1996
|
SliderPrimitive.Root,
|
|
2055
1997
|
{
|
|
2056
1998
|
ref,
|
|
2057
|
-
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
1999
|
+
className: cn("relative flex w-full touch-none select-none items-center px-2.5", className),
|
|
2058
2000
|
...props,
|
|
2059
2001
|
children: [
|
|
2060
|
-
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-
|
|
2002
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-border", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-foreground yunui-accent-bg" }) }),
|
|
2061
2003
|
/* @__PURE__ */ jsx(
|
|
2062
2004
|
SliderPrimitive.Thumb,
|
|
2063
2005
|
{
|
|
@@ -2090,7 +2032,10 @@ var TabsList = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
2090
2032
|
{
|
|
2091
2033
|
ref,
|
|
2092
2034
|
className: cn(
|
|
2093
|
-
|
|
2035
|
+
// max-w-full: inline-flex sizes to content, so without it a long tab
|
|
2036
|
+
// strip grows past its parent and drags the page sideways on narrow
|
|
2037
|
+
// screens instead of engaging its own overflow-x-auto.
|
|
2038
|
+
"inline-flex h-11 max-w-full items-center justify-center rounded-xl bg-muted p-1 flex-nowrap overflow-x-auto overflow-y-hidden overscroll-x-contain",
|
|
2094
2039
|
className
|
|
2095
2040
|
),
|
|
2096
2041
|
...props
|
|
@@ -2102,11 +2047,14 @@ var TabsTrigger = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2102
2047
|
{
|
|
2103
2048
|
ref,
|
|
2104
2049
|
className: cn(
|
|
2105
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-lg px-4 py-2 text-sm font-medium transition-all",
|
|
2050
|
+
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg px-4 py-2 text-sm font-medium transition-all",
|
|
2106
2051
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2107
2052
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
2108
2053
|
"data-[state=active]:bg-card data-[state=active]:shadow-sm",
|
|
2109
|
-
|
|
2054
|
+
// Inactive tabs sit on bg-muted. The general muted-foreground token
|
|
2055
|
+
// is intentionally subtle and can fall just below WCAG AA on that
|
|
2056
|
+
// tinted surface, so tabs use a stronger foreground blend.
|
|
2057
|
+
"data-[state=inactive]:text-foreground/70 data-[state=inactive]:hover:text-foreground",
|
|
2110
2058
|
"yunui-tab-trigger",
|
|
2111
2059
|
className
|
|
2112
2060
|
),
|
|
@@ -2179,11 +2127,12 @@ function AvatarGroup({ className, max, children, ...props }) {
|
|
|
2179
2127
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2180
2128
|
var Tooltip = TooltipPrimitive.Root;
|
|
2181
2129
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2182
|
-
var TooltipContent = React7.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
2130
|
+
var TooltipContent = React7.forwardRef(({ className, sideOffset = 4, collisionPadding = 8, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
2183
2131
|
TooltipPrimitive.Content,
|
|
2184
2132
|
{
|
|
2185
2133
|
ref,
|
|
2186
2134
|
sideOffset,
|
|
2135
|
+
collisionPadding,
|
|
2187
2136
|
className: cn(
|
|
2188
2137
|
"z-50 overflow-hidden rounded-lg bg-foreground px-3 py-1.5 text-xs text-background shadow-lg",
|
|
2189
2138
|
"animate-in fade-in-0 zoom-in-95",
|
|
@@ -2191,7 +2140,7 @@ var TooltipContent = React7.forwardRef(({ className, sideOffset = 4, ...props },
|
|
|
2191
2140
|
),
|
|
2192
2141
|
...props
|
|
2193
2142
|
}
|
|
2194
|
-
));
|
|
2143
|
+
) }));
|
|
2195
2144
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
2196
2145
|
function Skeleton({ className, ...props }) {
|
|
2197
2146
|
return /* @__PURE__ */ jsx(
|
|
@@ -2277,7 +2226,7 @@ var IconButton = React7.forwardRef(
|
|
|
2277
2226
|
}
|
|
2278
2227
|
);
|
|
2279
2228
|
IconButton.displayName = "IconButton";
|
|
2280
|
-
function
|
|
2229
|
+
function Label3({ className, ...props }) {
|
|
2281
2230
|
return /* @__PURE__ */ jsx(
|
|
2282
2231
|
"label",
|
|
2283
2232
|
{
|
|
@@ -2317,7 +2266,7 @@ var DropdownMenuSubContent = React7.forwardRef(({ className, ...props }, ref) =>
|
|
|
2317
2266
|
{
|
|
2318
2267
|
ref,
|
|
2319
2268
|
className: cn(
|
|
2320
|
-
"z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-
|
|
2269
|
+
"z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-popover/85 backdrop-blur-2xl p-1 text-popover-foreground shadow-lg shadow-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
2321
2270
|
className
|
|
2322
2271
|
),
|
|
2323
2272
|
...props
|
|
@@ -2330,7 +2279,7 @@ var DropdownMenuContent = React7.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
2330
2279
|
ref,
|
|
2331
2280
|
sideOffset,
|
|
2332
2281
|
className: cn(
|
|
2333
|
-
"z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-
|
|
2282
|
+
"z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-popover p-1 text-popover-foreground shadow-lg shadow-black/5",
|
|
2334
2283
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
2335
2284
|
className
|
|
2336
2285
|
),
|
|
@@ -2420,678 +2369,164 @@ var DropdownMenuShortcut = ({
|
|
|
2420
2369
|
);
|
|
2421
2370
|
};
|
|
2422
2371
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
const
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2443
|
-
const
|
|
2444
|
-
const
|
|
2445
|
-
const
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2448
|
-
(
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2372
|
+
var closeIdCounter2 = 0;
|
|
2373
|
+
function Modal({
|
|
2374
|
+
isOpen,
|
|
2375
|
+
onClose,
|
|
2376
|
+
title,
|
|
2377
|
+
subtitle,
|
|
2378
|
+
children,
|
|
2379
|
+
footer,
|
|
2380
|
+
size = "lg",
|
|
2381
|
+
className,
|
|
2382
|
+
showCloseButton = true,
|
|
2383
|
+
isClosing: externalIsClosing,
|
|
2384
|
+
setIsClosing: externalSetIsClosing,
|
|
2385
|
+
showUnsavedBadge = false,
|
|
2386
|
+
maxHeight = DEFAULT_MAX_HEIGHT,
|
|
2387
|
+
onBackdropClick
|
|
2388
|
+
}) {
|
|
2389
|
+
const t = useYunUI().useT("components.modal");
|
|
2390
|
+
const modalRef = useRef(null);
|
|
2391
|
+
const timeoutRef = useRef(null);
|
|
2392
|
+
const closeIdRef = useRef(0);
|
|
2393
|
+
const [internalIsClosing, setInternalIsClosing] = useState(false);
|
|
2394
|
+
const [mounted, setMounted] = useState(false);
|
|
2395
|
+
const isClosing = externalIsClosing ?? internalIsClosing;
|
|
2396
|
+
useEffect(() => {
|
|
2397
|
+
setMounted(true);
|
|
2398
|
+
return () => setMounted(false);
|
|
2399
|
+
}, []);
|
|
2400
|
+
useEffect(() => {
|
|
2401
|
+
return () => {
|
|
2402
|
+
if (timeoutRef.current) {
|
|
2403
|
+
clearTimeout(timeoutRef.current);
|
|
2404
|
+
timeoutRef.current = null;
|
|
2455
2405
|
}
|
|
2456
2406
|
};
|
|
2457
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
2458
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2459
2407
|
}, []);
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2408
|
+
const isClosingRef = useRef(isClosing);
|
|
2409
|
+
isClosingRef.current = isClosing;
|
|
2410
|
+
const onCloseRef = useRef(onClose);
|
|
2411
|
+
onCloseRef.current = onClose;
|
|
2412
|
+
const externalSetIsClosingRef = useRef(externalSetIsClosing);
|
|
2413
|
+
externalSetIsClosingRef.current = externalSetIsClosing;
|
|
2414
|
+
const handleClose = useCallback(() => {
|
|
2415
|
+
if (isClosingRef.current) return;
|
|
2416
|
+
if (timeoutRef.current) {
|
|
2417
|
+
clearTimeout(timeoutRef.current);
|
|
2418
|
+
timeoutRef.current = null;
|
|
2471
2419
|
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
const close = () => {
|
|
2482
|
-
setIsOpen(false);
|
|
2483
|
-
setSearchQuery("");
|
|
2484
|
-
triggerRef.current?.focus();
|
|
2485
|
-
};
|
|
2486
|
-
const handleSelect = (optionValue) => {
|
|
2487
|
-
onChange(optionValue);
|
|
2488
|
-
setIsOpen(false);
|
|
2489
|
-
setSearchQuery("");
|
|
2490
|
-
triggerRef.current?.focus();
|
|
2491
|
-
};
|
|
2492
|
-
const handleKeyDown = (e) => {
|
|
2493
|
-
if (disabled) return;
|
|
2494
|
-
switch (e.key) {
|
|
2495
|
-
case "ArrowDown":
|
|
2496
|
-
e.preventDefault();
|
|
2497
|
-
if (!isOpen) return open();
|
|
2498
|
-
setHighlighted((h) => Math.min(h + 1, filteredOptions.length - 1));
|
|
2499
|
-
break;
|
|
2500
|
-
case "ArrowUp":
|
|
2501
|
-
e.preventDefault();
|
|
2502
|
-
if (!isOpen) return open();
|
|
2503
|
-
setHighlighted((h) => Math.max(h - 1, 0));
|
|
2504
|
-
break;
|
|
2505
|
-
case "Home":
|
|
2506
|
-
if (isOpen) {
|
|
2507
|
-
e.preventDefault();
|
|
2508
|
-
setHighlighted(0);
|
|
2509
|
-
}
|
|
2510
|
-
break;
|
|
2511
|
-
case "End":
|
|
2512
|
-
if (isOpen) {
|
|
2513
|
-
e.preventDefault();
|
|
2514
|
-
setHighlighted(filteredOptions.length - 1);
|
|
2515
|
-
}
|
|
2516
|
-
break;
|
|
2517
|
-
case "Enter":
|
|
2518
|
-
if (isOpen && filteredOptions[highlighted]) {
|
|
2519
|
-
e.preventDefault();
|
|
2520
|
-
handleSelect(filteredOptions[highlighted].value);
|
|
2521
|
-
} else if (!isOpen) {
|
|
2522
|
-
e.preventDefault();
|
|
2523
|
-
open();
|
|
2524
|
-
}
|
|
2525
|
-
break;
|
|
2526
|
-
case " ":
|
|
2527
|
-
if (!isOpen && !searchable) {
|
|
2528
|
-
e.preventDefault();
|
|
2529
|
-
open();
|
|
2530
|
-
}
|
|
2531
|
-
break;
|
|
2532
|
-
case "Escape":
|
|
2533
|
-
if (isOpen) {
|
|
2534
|
-
e.preventDefault();
|
|
2535
|
-
close();
|
|
2420
|
+
const currentCloseId = ++closeIdCounter2;
|
|
2421
|
+
closeIdRef.current = currentCloseId;
|
|
2422
|
+
const executeClose = () => {
|
|
2423
|
+
if (closeIdRef.current === currentCloseId) {
|
|
2424
|
+
onCloseRef.current();
|
|
2425
|
+
if (externalSetIsClosingRef.current) {
|
|
2426
|
+
externalSetIsClosingRef.current(false);
|
|
2427
|
+
} else {
|
|
2428
|
+
setInternalIsClosing(false);
|
|
2536
2429
|
}
|
|
2537
|
-
|
|
2538
|
-
case "Tab":
|
|
2539
|
-
if (isOpen) setIsOpen(false);
|
|
2540
|
-
break;
|
|
2541
|
-
}
|
|
2542
|
-
};
|
|
2543
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative ${className}`, onKeyDown: handleKeyDown, children: [
|
|
2544
|
-
/* @__PURE__ */ jsxs(
|
|
2545
|
-
"button",
|
|
2546
|
-
{
|
|
2547
|
-
ref: triggerRef,
|
|
2548
|
-
type: "button",
|
|
2549
|
-
onClick: () => !disabled && setIsOpen(!isOpen),
|
|
2550
|
-
disabled,
|
|
2551
|
-
"aria-haspopup": "listbox",
|
|
2552
|
-
"aria-expanded": isOpen,
|
|
2553
|
-
"aria-controls": isOpen ? listboxId : void 0,
|
|
2554
|
-
"aria-activedescendant": isOpen && !searchable && highlighted >= 0 ? optionId(highlighted) : void 0,
|
|
2555
|
-
className: `
|
|
2556
|
-
w-full flex items-center justify-between gap-2 px-3 py-2
|
|
2557
|
-
rounded-xl border border-(--border-default) bg-(--bg-elevated)
|
|
2558
|
-
hover:border-(--border-strong) hover:bg-(--bg-hover)
|
|
2559
|
-
transition-all duration-200 text-sm
|
|
2560
|
-
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
2561
|
-
${isOpen ? "border-primary ring-2 ring-primary/20" : ""}
|
|
2562
|
-
`,
|
|
2563
|
-
children: [
|
|
2564
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
2565
|
-
selectedOption?.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: selectedOption.icon }),
|
|
2566
|
-
/* @__PURE__ */ jsx("span", { className: `truncate ${!selectedOption ? "text-muted-foreground" : ""}`, children: selectedOption ? selectedOption.label : resolvedPlaceholder })
|
|
2567
|
-
] }),
|
|
2568
|
-
/* @__PURE__ */ jsx(
|
|
2569
|
-
ChevronDown,
|
|
2570
|
-
{
|
|
2571
|
-
size: 16,
|
|
2572
|
-
className: `shrink-0 text-muted-foreground transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
2573
|
-
}
|
|
2574
|
-
)
|
|
2575
|
-
]
|
|
2576
|
-
}
|
|
2577
|
-
),
|
|
2578
|
-
isOpen && /* @__PURE__ */ jsxs(
|
|
2579
|
-
"div",
|
|
2580
|
-
{
|
|
2581
|
-
ref: panelRef,
|
|
2582
|
-
style: { marginLeft: shift, maxHeight },
|
|
2583
|
-
className: "\n absolute z-50 w-full mt-2\n rounded-2xl border border-border\n bg-background/60 backdrop-blur-2xl text-popover-foreground\n shadow-lg shadow-black/5\n max-h-64 overflow-hidden flex flex-col\n animate-in fade-in-0 zoom-in-95 duration-200\n ",
|
|
2584
|
-
children: [
|
|
2585
|
-
searchable && /* @__PURE__ */ jsx("div", { className: "px-2.5 pb-2 pt-1.5 border-b border-(--border-subtle)", children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2586
|
-
/* @__PURE__ */ jsx(Search, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }),
|
|
2587
|
-
/* @__PURE__ */ jsx(
|
|
2588
|
-
"input",
|
|
2589
|
-
{
|
|
2590
|
-
ref: inputRef,
|
|
2591
|
-
type: "text",
|
|
2592
|
-
role: "combobox",
|
|
2593
|
-
"aria-expanded": isOpen,
|
|
2594
|
-
"aria-controls": listboxId,
|
|
2595
|
-
"aria-activedescendant": highlighted >= 0 ? optionId(highlighted) : void 0,
|
|
2596
|
-
"aria-autocomplete": "list",
|
|
2597
|
-
value: searchQuery,
|
|
2598
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
2599
|
-
placeholder: t("search"),
|
|
2600
|
-
"aria-label": t("search"),
|
|
2601
|
-
className: "w-full pl-9 pr-8 py-1.5 text-sm rounded-lg\n bg-(--bg-muted) border border-transparent\n focus:border-primary focus:outline-none focus:bg-(--bg-elevated) transition-colors"
|
|
2602
|
-
}
|
|
2603
|
-
),
|
|
2604
|
-
searchQuery && /* @__PURE__ */ jsx(
|
|
2605
|
-
"button",
|
|
2606
|
-
{
|
|
2607
|
-
type: "button",
|
|
2608
|
-
onClick: () => setSearchQuery(""),
|
|
2609
|
-
"aria-label": t("clearSearch"),
|
|
2610
|
-
className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded-md hover:bg-(--bg-hover)",
|
|
2611
|
-
title: t("clearSearch"),
|
|
2612
|
-
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
2613
|
-
}
|
|
2614
|
-
)
|
|
2615
|
-
] }) }),
|
|
2616
|
-
/* @__PURE__ */ jsx(
|
|
2617
|
-
"div",
|
|
2618
|
-
{
|
|
2619
|
-
ref: listRef,
|
|
2620
|
-
role: "listbox",
|
|
2621
|
-
id: listboxId,
|
|
2622
|
-
className: "flex-1 min-h-0 max-h-52 overflow-y-auto overscroll-contain p-1",
|
|
2623
|
-
children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-muted-foreground text-center whitespace-nowrap", children: t("noOptions") }) : filteredOptions.map((option, i) => {
|
|
2624
|
-
const isSelected = option.value === value;
|
|
2625
|
-
const isHigh = i === highlighted;
|
|
2626
|
-
return /* @__PURE__ */ jsxs(
|
|
2627
|
-
"button",
|
|
2628
|
-
{
|
|
2629
|
-
id: optionId(i),
|
|
2630
|
-
type: "button",
|
|
2631
|
-
role: "option",
|
|
2632
|
-
"aria-selected": isSelected,
|
|
2633
|
-
"data-highlighted": isHigh ? "" : void 0,
|
|
2634
|
-
onClick: () => handleSelect(option.value),
|
|
2635
|
-
onMouseEnter: () => setHighlighted(i),
|
|
2636
|
-
className: `dropdown-item w-full text-left outline-none ${isSelected ? "active" : ""}`,
|
|
2637
|
-
children: [
|
|
2638
|
-
option.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 w-5 h-5 flex items-center justify-center", children: option.icon }),
|
|
2639
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2640
|
-
/* @__PURE__ */ jsx("div", { className: "truncate", children: option.label }),
|
|
2641
|
-
option.description && /* @__PURE__ */ jsx("div", { className: "text-xs font-normal text-muted-foreground truncate", children: option.description })
|
|
2642
|
-
] })
|
|
2643
|
-
]
|
|
2644
|
-
},
|
|
2645
|
-
option.value
|
|
2646
|
-
);
|
|
2647
|
-
})
|
|
2648
|
-
}
|
|
2649
|
-
)
|
|
2650
|
-
]
|
|
2430
|
+
timeoutRef.current = null;
|
|
2651
2431
|
}
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
className,
|
|
2660
|
-
disabled = false
|
|
2661
|
-
}) {
|
|
2662
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex gap-1 flex-wrap", className), children: options.map((opt) => {
|
|
2663
|
-
const Icon2 = opt.icon;
|
|
2664
|
-
return /* @__PURE__ */ jsxs(
|
|
2665
|
-
"button",
|
|
2666
|
-
{
|
|
2667
|
-
type: "button",
|
|
2668
|
-
onClick: () => !disabled && onChange(opt.value),
|
|
2669
|
-
disabled,
|
|
2670
|
-
"aria-pressed": value === opt.value,
|
|
2671
|
-
title: opt.desc,
|
|
2672
|
-
className: cn(
|
|
2673
|
-
"inline-flex items-center justify-center gap-2 px-3 py-1.5 text-xs font-medium border rounded-lg whitespace-nowrap transition-all duration-150 ease cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
2674
|
-
value === opt.value ? "text-foreground border-(--border-strong) bg-accent-subtle hover:bg-accent-muted hover:shadow-xs" : "text-muted-foreground border-(--border-default) bg-muted/50 hover:text-foreground hover:border-(--border-strong) hover:bg-muted",
|
|
2675
|
-
disabled && "opacity-50 cursor-not-allowed pointer-events-none"
|
|
2676
|
-
),
|
|
2677
|
-
children: [
|
|
2678
|
-
Icon2 && /* @__PURE__ */ jsx(Icon2, { size: 14 }),
|
|
2679
|
-
opt.label
|
|
2680
|
-
]
|
|
2681
|
-
},
|
|
2682
|
-
String(opt.value)
|
|
2683
|
-
);
|
|
2684
|
-
}) });
|
|
2685
|
-
}
|
|
2686
|
-
function NavTabs({ tabs, activeKey, onChange, className = "", ariaLabel }) {
|
|
2687
|
-
const { Link } = useYunUI();
|
|
2688
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain", "aria-label": ariaLabel, children: tabs.map((tab) => {
|
|
2689
|
-
const active = tab.key === activeKey;
|
|
2690
|
-
const cls = `nav-tab ${active ? "active" : ""}`;
|
|
2691
|
-
return tab.href ? /* @__PURE__ */ jsx(Link, { href: tab.href, className: cls, "aria-current": active ? "page" : void 0, children: tab.label }, tab.key) : /* @__PURE__ */ jsx(
|
|
2692
|
-
"button",
|
|
2693
|
-
{
|
|
2694
|
-
type: "button",
|
|
2695
|
-
onClick: () => onChange?.(tab.key),
|
|
2696
|
-
className: cls,
|
|
2697
|
-
"aria-current": active ? "true" : void 0,
|
|
2698
|
-
children: tab.label
|
|
2699
|
-
},
|
|
2700
|
-
tab.key
|
|
2701
|
-
);
|
|
2702
|
-
}) }) });
|
|
2703
|
-
}
|
|
2704
|
-
function ShinyButton({
|
|
2705
|
-
children,
|
|
2706
|
-
className,
|
|
2707
|
-
href,
|
|
2708
|
-
onClick
|
|
2709
|
-
}) {
|
|
2710
|
-
const { Link } = useYunUI();
|
|
2711
|
-
const ButtonContent = /* @__PURE__ */ jsxs(
|
|
2712
|
-
"div",
|
|
2713
|
-
{
|
|
2714
|
-
className: cn(
|
|
2715
|
-
"group relative flex items-center justify-center gap-2 overflow-hidden rounded-xl bg-(--text-primary) px-8 py-3 font-semibold text-background transition-all hover:ring-2 hover:ring-(--accent) hover:ring-offset-2 hover:ring-offset-background",
|
|
2716
|
-
className
|
|
2717
|
-
),
|
|
2718
|
-
children: [
|
|
2719
|
-
/* @__PURE__ */ jsxs("span", { className: "relative z-10 flex items-center gap-2", children: [
|
|
2720
|
-
children,
|
|
2721
|
-
/* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4 transition-transform group-hover:translate-x-1" })
|
|
2722
|
-
] }),
|
|
2723
|
-
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 -z-10 block animate-shimmer bg-linear-to-r from-transparent via-(--text-primary)/10 to-transparent bg-size-[200%_100%]" })
|
|
2724
|
-
]
|
|
2432
|
+
};
|
|
2433
|
+
if (externalSetIsClosingRef.current) {
|
|
2434
|
+
externalSetIsClosingRef.current(true);
|
|
2435
|
+
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
2436
|
+
} else {
|
|
2437
|
+
setInternalIsClosing(true);
|
|
2438
|
+
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
2725
2439
|
}
|
|
2726
|
-
);
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
function Marquee({
|
|
2734
|
-
className,
|
|
2735
|
-
reverse,
|
|
2736
|
-
pauseOnHover = false,
|
|
2737
|
-
children,
|
|
2738
|
-
vertical = false,
|
|
2739
|
-
repeat = 4,
|
|
2740
|
-
...props
|
|
2741
|
-
}) {
|
|
2742
|
-
return /* @__PURE__ */ jsx(
|
|
2743
|
-
"div",
|
|
2744
|
-
{
|
|
2745
|
-
...props,
|
|
2746
|
-
className: cn(
|
|
2747
|
-
"group flex overflow-hidden p-2 [--duration:40s] [--gap:1rem] gap-(--gap)",
|
|
2748
|
-
{
|
|
2749
|
-
"flex-row": !vertical,
|
|
2750
|
-
"flex-col": vertical
|
|
2751
|
-
},
|
|
2752
|
-
className
|
|
2753
|
-
),
|
|
2754
|
-
children: Array(repeat).fill(0).map((_, i) => /* @__PURE__ */ jsx(
|
|
2755
|
-
"div",
|
|
2756
|
-
{
|
|
2757
|
-
className: cn("flex shrink-0 justify-around gap-(--gap)", {
|
|
2758
|
-
"animate-marquee flex-row": !vertical,
|
|
2759
|
-
"animate-marquee-vertical flex-col": vertical,
|
|
2760
|
-
"group-hover:[animation-play-state:paused]": pauseOnHover,
|
|
2761
|
-
"[animation-direction:reverse]": reverse
|
|
2762
|
-
}),
|
|
2763
|
-
children
|
|
2764
|
-
},
|
|
2765
|
-
i
|
|
2766
|
-
))
|
|
2440
|
+
}, []);
|
|
2441
|
+
useEscapeKey(handleClose, isOpen);
|
|
2442
|
+
useBodyScrollLock(isOpen);
|
|
2443
|
+
useFocusTrap(modalRef, isOpen);
|
|
2444
|
+
useEffect(() => {
|
|
2445
|
+
if (isOpen && internalIsClosing) {
|
|
2446
|
+
setInternalIsClosing(false);
|
|
2767
2447
|
}
|
|
2768
|
-
);
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
{
|
|
2777
|
-
className: cn(
|
|
2778
|
-
"grid grid-cols-1 md:grid-cols-3 gap-6 max-w-7xl mx-auto",
|
|
2779
|
-
className
|
|
2780
|
-
),
|
|
2781
|
-
children
|
|
2448
|
+
}, [isOpen, internalIsClosing]);
|
|
2449
|
+
const handleBackdropClick = useCallback((e) => {
|
|
2450
|
+
if (e.target === e.currentTarget) {
|
|
2451
|
+
if (onBackdropClick) {
|
|
2452
|
+
onBackdropClick();
|
|
2453
|
+
} else {
|
|
2454
|
+
handleClose();
|
|
2455
|
+
}
|
|
2782
2456
|
}
|
|
2783
|
-
);
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
title,
|
|
2788
|
-
description,
|
|
2789
|
-
header,
|
|
2790
|
-
icon
|
|
2791
|
-
}) => {
|
|
2792
|
-
return /* @__PURE__ */ jsxs(
|
|
2457
|
+
}, [onBackdropClick, handleClose]);
|
|
2458
|
+
if (!isOpen || !mounted) return null;
|
|
2459
|
+
const sizeClass = SIZE_CLASSES[size] ?? SIZE_CLASSES.lg;
|
|
2460
|
+
const modalContent = /* @__PURE__ */ jsxs(
|
|
2793
2461
|
"div",
|
|
2794
2462
|
{
|
|
2795
2463
|
className: cn(
|
|
2796
|
-
"
|
|
2797
|
-
|
|
2464
|
+
"fixed inset-0 pointer-events-auto flex items-center justify-center p-4 transition-opacity",
|
|
2465
|
+
isClosing ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
2798
2466
|
),
|
|
2467
|
+
style: { zIndex: Z_INDEX.MODAL },
|
|
2468
|
+
onClick: handleBackdropClick,
|
|
2469
|
+
role: "dialog",
|
|
2470
|
+
"aria-modal": "true",
|
|
2471
|
+
"aria-labelledby": "modal-title",
|
|
2799
2472
|
children: [
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
/* @__PURE__ */ jsx("div", { className: "mb-2 text-[var(--text-primary)]", children: icon }),
|
|
2803
|
-
/* @__PURE__ */ jsx("div", { className: "font-semibold text-[var(--text-primary)] text-lg mb-2 mt-2", children: title }),
|
|
2804
|
-
/* @__PURE__ */ jsx("div", { className: "font-normal text-[var(--text-secondary)] text-sm leading-relaxed", children: description })
|
|
2805
|
-
] })
|
|
2806
|
-
]
|
|
2807
|
-
}
|
|
2808
|
-
);
|
|
2809
|
-
};
|
|
2810
|
-
var Collapsible = Primitive.Root;
|
|
2811
|
-
var CollapsibleTrigger2 = Primitive.CollapsibleTrigger;
|
|
2812
|
-
var CollapsibleContent2 = forwardRef(({ children, ...props }, ref) => {
|
|
2813
|
-
const [mounted, setMounted] = useState(false);
|
|
2814
|
-
useEffect(() => {
|
|
2815
|
-
setMounted(true);
|
|
2816
|
-
}, []);
|
|
2817
|
-
return /* @__PURE__ */ jsx(
|
|
2818
|
-
Primitive.CollapsibleContent,
|
|
2819
|
-
{
|
|
2820
|
-
ref,
|
|
2821
|
-
...props,
|
|
2822
|
-
className: cn(
|
|
2823
|
-
"overflow-hidden",
|
|
2824
|
-
mounted && "data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down",
|
|
2825
|
-
props.className
|
|
2826
|
-
),
|
|
2827
|
-
children
|
|
2828
|
-
}
|
|
2829
|
-
);
|
|
2830
|
-
});
|
|
2831
|
-
CollapsibleContent2.displayName = Primitive.CollapsibleContent.displayName;
|
|
2832
|
-
var Popover = PopoverPrimitive.Root;
|
|
2833
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
2834
|
-
var PopoverContent = React7.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
2835
|
-
PopoverPrimitive.Content,
|
|
2836
|
-
{
|
|
2837
|
-
ref,
|
|
2838
|
-
align,
|
|
2839
|
-
sideOffset,
|
|
2840
|
-
side: "bottom",
|
|
2841
|
-
className: cn(
|
|
2842
|
-
"z-50 origin-(--radix-popover-content-transform-origin) overflow-y-auto max-h-(--radix-popover-content-available-height) min-w-[240px] max-w-[98vw] rounded-2xl border border-border bg-background/60 backdrop-blur-2xl p-2 text-sm text-popover-foreground shadow-lg shadow-black/5 focus-visible:outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
2843
|
-
className
|
|
2844
|
-
),
|
|
2845
|
-
...props
|
|
2846
|
-
}
|
|
2847
|
-
) }));
|
|
2848
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2849
|
-
var PopoverClose2 = PopoverPrimitive.PopoverClose;
|
|
2850
|
-
var sizeClasses = {
|
|
2851
|
-
sm: {
|
|
2852
|
-
track: "w-8 h-4",
|
|
2853
|
-
thumb: "w-2.5 h-2.5",
|
|
2854
|
-
thumbTranslate: "translate-x-3.5"
|
|
2855
|
-
},
|
|
2856
|
-
md: {
|
|
2857
|
-
track: "w-11 h-6",
|
|
2858
|
-
thumb: "w-4 h-4",
|
|
2859
|
-
thumbTranslate: "translate-x-5"
|
|
2860
|
-
}
|
|
2861
|
-
};
|
|
2862
|
-
var variantClasses = {
|
|
2863
|
-
default: {
|
|
2864
|
-
checkedTrack: "border-primary bg-primary/10",
|
|
2865
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2866
|
-
checkedThumb: "bg-primary",
|
|
2867
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2868
|
-
},
|
|
2869
|
-
success: {
|
|
2870
|
-
checkedTrack: "border-(--success) bg-success-soft",
|
|
2871
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2872
|
-
checkedThumb: "bg-(--success)",
|
|
2873
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2874
|
-
},
|
|
2875
|
-
warning: {
|
|
2876
|
-
checkedTrack: "border-(--warning) bg-warning-soft",
|
|
2877
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2878
|
-
checkedThumb: "bg-(--warning)",
|
|
2879
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2880
|
-
},
|
|
2881
|
-
danger: {
|
|
2882
|
-
checkedTrack: "border-(--error) bg-error-soft",
|
|
2883
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2884
|
-
checkedThumb: "bg-(--error)",
|
|
2885
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2886
|
-
}
|
|
2887
|
-
};
|
|
2888
|
-
var Switch = forwardRef(
|
|
2889
|
-
({ checked, onCheckedChange, disabled = false, size = "sm", variant = "default", className = "", id }, ref) => {
|
|
2890
|
-
const sizeClass = sizeClasses[size];
|
|
2891
|
-
const variantClass = variantClasses[variant];
|
|
2892
|
-
return /* @__PURE__ */ jsx(
|
|
2893
|
-
"button",
|
|
2894
|
-
{
|
|
2895
|
-
ref,
|
|
2896
|
-
type: "button",
|
|
2897
|
-
role: "switch",
|
|
2898
|
-
"aria-checked": checked,
|
|
2899
|
-
id,
|
|
2900
|
-
onClick: () => !disabled && onCheckedChange(!checked),
|
|
2901
|
-
disabled,
|
|
2902
|
-
className: `
|
|
2903
|
-
${sizeClass.track} rounded-full border-2 flex items-center px-0.5
|
|
2904
|
-
transition-all duration-200 ease-in-out
|
|
2905
|
-
outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background
|
|
2906
|
-
${checked ? variantClass.checkedTrack : variantClass.uncheckedTrack}
|
|
2907
|
-
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
2908
|
-
${className}
|
|
2909
|
-
`,
|
|
2910
|
-
children: /* @__PURE__ */ jsx(
|
|
2911
|
-
"span",
|
|
2473
|
+
/* @__PURE__ */ jsx(
|
|
2474
|
+
"div",
|
|
2912
2475
|
{
|
|
2913
|
-
className:
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2476
|
+
className: cn(
|
|
2477
|
+
"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity",
|
|
2478
|
+
isClosing ? "opacity-0" : "opacity-100"
|
|
2479
|
+
),
|
|
2480
|
+
onClick: handleClose,
|
|
2481
|
+
"aria-hidden": "true"
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
/* @__PURE__ */ jsxs(
|
|
2485
|
+
"div",
|
|
2486
|
+
{
|
|
2487
|
+
ref: modalRef,
|
|
2488
|
+
className: cn(
|
|
2489
|
+
// Glassy surface (not the solid .card) to match Sheet/Dialog/navbar.
|
|
2490
|
+
"relative w-full rounded-2xl border border-border bg-background/95 backdrop-blur-xl shadow-2xl flex flex-col transition-all",
|
|
2491
|
+
sizeClass,
|
|
2492
|
+
isClosing ? "scale-95 opacity-0" : "scale-100 opacity-100",
|
|
2493
|
+
className
|
|
2494
|
+
),
|
|
2495
|
+
style: { maxHeight },
|
|
2496
|
+
onClick: (e) => e.stopPropagation(),
|
|
2497
|
+
tabIndex: -1,
|
|
2498
|
+
children: [
|
|
2499
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b border-border shrink-0", children: [
|
|
2500
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 min-w-0", children: [
|
|
2501
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2502
|
+
/* @__PURE__ */ jsx("h2", { id: "modal-title", className: "text-lg font-semibold truncate", children: title }),
|
|
2503
|
+
showUnsavedBadge && /* @__PURE__ */ jsx("span", { className: "badge-warning shrink-0", children: t("unsaved") })
|
|
2504
|
+
] }),
|
|
2505
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground truncate", children: subtitle })
|
|
2506
|
+
] }),
|
|
2507
|
+
showCloseButton && /* @__PURE__ */ jsx(
|
|
2508
|
+
Button,
|
|
2509
|
+
{
|
|
2510
|
+
variant: "ghost",
|
|
2511
|
+
size: "sm",
|
|
2512
|
+
onClick: handleClose,
|
|
2513
|
+
className: "p-2 shrink-0",
|
|
2514
|
+
"aria-label": t("close"),
|
|
2515
|
+
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
2516
|
+
}
|
|
2517
|
+
)
|
|
2518
|
+
] }),
|
|
2519
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-6", children }),
|
|
2520
|
+
footer && /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-border bg-muted/20 shrink-0", children: footer })
|
|
2521
|
+
]
|
|
2918
2522
|
}
|
|
2919
2523
|
)
|
|
2920
|
-
|
|
2921
|
-
);
|
|
2922
|
-
}
|
|
2923
|
-
);
|
|
2924
|
-
Switch.displayName = "Switch";
|
|
2925
|
-
function AnimatedNumber({ value, suffix = "", decimals = 0 }) {
|
|
2926
|
-
const animatedValue = useSpring(0, { stiffness: 50, damping: 15 });
|
|
2927
|
-
const displayValue = useTransform(animatedValue, (latest) => {
|
|
2928
|
-
const numStr = decimals > 0 ? latest.toFixed(decimals) : Math.round(latest).toString();
|
|
2929
|
-
return Number(numStr).toString() + suffix;
|
|
2930
|
-
});
|
|
2931
|
-
useEffect(() => {
|
|
2932
|
-
animatedValue.set(value);
|
|
2933
|
-
}, [animatedValue, value]);
|
|
2934
|
-
return /* @__PURE__ */ jsx(motion.span, { children: displayValue });
|
|
2935
|
-
}
|
|
2936
|
-
function Toaster() {
|
|
2937
|
-
return /* @__PURE__ */ jsx(
|
|
2938
|
-
Toaster$1,
|
|
2939
|
-
{
|
|
2940
|
-
position: "bottom-right",
|
|
2941
|
-
toastOptions: {
|
|
2942
|
-
classNames: {
|
|
2943
|
-
toast: "bg-card border border-border rounded-xl shadow-lg p-4",
|
|
2944
|
-
title: "text-sm font-medium",
|
|
2945
|
-
description: "text-xs text-muted-foreground",
|
|
2946
|
-
actionButton: "bg-foreground text-background text-xs px-3 py-1.5 rounded-lg",
|
|
2947
|
-
cancelButton: "text-muted-foreground text-xs px-3 py-1.5 rounded-lg hover:bg-muted"
|
|
2948
|
-
}
|
|
2949
|
-
}
|
|
2524
|
+
]
|
|
2950
2525
|
}
|
|
2951
2526
|
);
|
|
2952
|
-
|
|
2953
|
-
var toast = {
|
|
2954
|
-
success: (message, description) => {
|
|
2955
|
-
toast$1.success(message, {
|
|
2956
|
-
description,
|
|
2957
|
-
icon: /* @__PURE__ */ jsx(CheckCircle2, { className: "w-5 h-5 text-success" })
|
|
2958
|
-
});
|
|
2959
|
-
},
|
|
2960
|
-
error: (message, description) => {
|
|
2961
|
-
toast$1.error(message, {
|
|
2962
|
-
description,
|
|
2963
|
-
icon: /* @__PURE__ */ jsx(AlertCircle, { className: "w-5 h-5 text-error" })
|
|
2964
|
-
});
|
|
2965
|
-
},
|
|
2966
|
-
info: (message, description) => {
|
|
2967
|
-
toast$1.info(message, {
|
|
2968
|
-
description,
|
|
2969
|
-
icon: /* @__PURE__ */ jsx(Info, { className: "w-5 h-5 text-info" })
|
|
2970
|
-
});
|
|
2971
|
-
},
|
|
2972
|
-
warning: (message, description) => {
|
|
2973
|
-
toast$1.warning(message, {
|
|
2974
|
-
description,
|
|
2975
|
-
icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "w-5 h-5 text-warning" })
|
|
2976
|
-
});
|
|
2977
|
-
},
|
|
2978
|
-
loading: (message) => {
|
|
2979
|
-
return toast$1.loading(message, {
|
|
2980
|
-
icon: /* @__PURE__ */ jsx(Loader2, { className: "w-5 h-5 animate-spin" })
|
|
2981
|
-
});
|
|
2982
|
-
},
|
|
2983
|
-
dismiss: (id) => {
|
|
2984
|
-
toast$1.dismiss(id);
|
|
2985
|
-
},
|
|
2986
|
-
promise: (promise, messages) => {
|
|
2987
|
-
return toast$1.promise(promise, {
|
|
2988
|
-
loading: messages.loading,
|
|
2989
|
-
success: messages.success,
|
|
2990
|
-
error: messages.error
|
|
2991
|
-
});
|
|
2992
|
-
}
|
|
2993
|
-
};
|
|
2994
|
-
var YUNUI_PALETTES = [
|
|
2995
|
-
"gray",
|
|
2996
|
-
"sand",
|
|
2997
|
-
"slate",
|
|
2998
|
-
"mint",
|
|
2999
|
-
"rose",
|
|
3000
|
-
"dusk",
|
|
3001
|
-
"red",
|
|
3002
|
-
"orange",
|
|
3003
|
-
"amber",
|
|
3004
|
-
"yellow",
|
|
3005
|
-
"lime",
|
|
3006
|
-
"moss",
|
|
3007
|
-
"green",
|
|
3008
|
-
"emerald",
|
|
3009
|
-
"teal",
|
|
3010
|
-
"aqua",
|
|
3011
|
-
"cyan",
|
|
3012
|
-
"blue",
|
|
3013
|
-
"indigo",
|
|
3014
|
-
"violet",
|
|
3015
|
-
"plum",
|
|
3016
|
-
"magenta",
|
|
3017
|
-
"fuchsia",
|
|
3018
|
-
"pink"
|
|
3019
|
-
];
|
|
3020
|
-
var YUNUI_THEME_PRESETS = {
|
|
3021
|
-
aurora: { label: "Aurora", brand: "blue", accent: "violet", neutral: "slate" },
|
|
3022
|
-
sunset: { label: "Sunset", brand: "orange", accent: "pink", neutral: "sand" },
|
|
3023
|
-
forest: { label: "Forest", brand: "green", accent: "lime", neutral: "gray" },
|
|
3024
|
-
ocean: { label: "Ocean", brand: "cyan", accent: "teal", neutral: "slate" },
|
|
3025
|
-
grape: { label: "Grape", brand: "violet", accent: "magenta", neutral: "dusk" },
|
|
3026
|
-
ember: { label: "Ember", brand: "red", accent: "amber", neutral: "sand" },
|
|
3027
|
-
lagoon: { label: "Lagoon", brand: "teal", accent: "emerald", neutral: "mint" },
|
|
3028
|
-
blossom: { label: "Blossom", brand: "pink", accent: "fuchsia", neutral: "rose" },
|
|
3029
|
-
royal: { label: "Royal", brand: "indigo", accent: "blue", neutral: "slate" },
|
|
3030
|
-
citrus: { label: "Citrus", brand: "lime", accent: "yellow", neutral: "sand" },
|
|
3031
|
-
orchid: { label: "Orchid", brand: "plum", accent: "violet", neutral: "dusk" },
|
|
3032
|
-
mono: { label: "Mono", brand: "gray", accent: "gray", neutral: "gray" }
|
|
3033
|
-
};
|
|
3034
|
-
var ATTR = {
|
|
3035
|
-
brand: "data-brand",
|
|
3036
|
-
accent: "data-accent",
|
|
3037
|
-
neutral: "data-neutral",
|
|
3038
|
-
solid: "data-solid",
|
|
3039
|
-
surface: "data-surface",
|
|
3040
|
-
theme: "data-theme",
|
|
3041
|
-
accentSource: "data-accent-source"
|
|
3042
|
-
};
|
|
3043
|
-
function resolveTarget(el) {
|
|
3044
|
-
if (el) return el;
|
|
3045
|
-
return typeof document !== "undefined" ? document.documentElement : null;
|
|
3046
|
-
}
|
|
3047
|
-
function applyTheme(theme, el) {
|
|
3048
|
-
const target = resolveTarget(el);
|
|
3049
|
-
if (!target) return;
|
|
3050
|
-
for (const key of Object.keys(theme)) {
|
|
3051
|
-
const value = theme[key];
|
|
3052
|
-
const attr = ATTR[key];
|
|
3053
|
-
if (!attr) continue;
|
|
3054
|
-
if (value == null) target.removeAttribute(attr);
|
|
3055
|
-
else target.setAttribute(attr, value);
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
function readTheme(el) {
|
|
3059
|
-
const target = resolveTarget(el);
|
|
3060
|
-
const out = {};
|
|
3061
|
-
if (!target) return out;
|
|
3062
|
-
for (const key of Object.keys(ATTR)) {
|
|
3063
|
-
const v = target.getAttribute(ATTR[key]);
|
|
3064
|
-
if (v != null) out[key] = v;
|
|
3065
|
-
}
|
|
3066
|
-
return out;
|
|
3067
|
-
}
|
|
3068
|
-
var STORAGE_KEY = "yunui-theme";
|
|
3069
|
-
function useYunUITheme(defaults = {}) {
|
|
3070
|
-
const [theme, setTheme] = React7.useState(defaults);
|
|
3071
|
-
React7.useEffect(() => {
|
|
3072
|
-
let stored = {};
|
|
3073
|
-
try {
|
|
3074
|
-
stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}");
|
|
3075
|
-
} catch {
|
|
3076
|
-
}
|
|
3077
|
-
const merged = { ...defaults, ...stored };
|
|
3078
|
-
setTheme(merged);
|
|
3079
|
-
applyTheme(merged);
|
|
3080
|
-
}, []);
|
|
3081
|
-
const update = React7.useCallback((patch) => {
|
|
3082
|
-
setTheme((prev) => {
|
|
3083
|
-
const next = { ...prev, ...patch };
|
|
3084
|
-
applyTheme(next);
|
|
3085
|
-
try {
|
|
3086
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
|
|
3087
|
-
} catch {
|
|
3088
|
-
}
|
|
3089
|
-
return next;
|
|
3090
|
-
});
|
|
3091
|
-
}, []);
|
|
3092
|
-
return [theme, update];
|
|
2527
|
+
return createPortal(modalContent, document.body);
|
|
3093
2528
|
}
|
|
3094
2529
|
|
|
3095
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert,
|
|
3096
|
-
//# sourceMappingURL=chunk-
|
|
3097
|
-
//# sourceMappingURL=chunk-
|
|
2530
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Column, Combobox, ConfirmModal, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, InlineStatus, Input, Kbd, Label3 as Label, Modal, MotionDiv, MotionSpan, NumberInput, PageLoader, Pagination, PasswordInput, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, fadeIn, staggerContainer, staggerItem, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior };
|
|
2531
|
+
//# sourceMappingURL=chunk-BCOKFWXC.js.map
|
|
2532
|
+
//# sourceMappingURL=chunk-BCOKFWXC.js.map
|