@windrun-huaiin/third-ui 15.1.1 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/ai/ai-chat-composer.d.ts +2 -0
- package/dist/ai/ai-chat-composer.js +47 -0
- package/dist/ai/ai-chat-composer.mjs +45 -0
- package/dist/ai/ai-markdown.d.ts +2 -0
- package/dist/ai/ai-markdown.js +36 -0
- package/dist/ai/ai-markdown.mjs +34 -0
- package/dist/ai/ai-message-actions.d.ts +2 -0
- package/dist/ai/ai-message-actions.js +14 -0
- package/dist/ai/ai-message-actions.mjs +12 -0
- package/dist/ai/ai-message-bubble.d.ts +2 -0
- package/dist/ai/ai-message-bubble.js +66 -0
- package/dist/ai/ai-message-bubble.mjs +64 -0
- package/dist/ai/ai-message-content.d.ts +2 -0
- package/dist/ai/ai-message-content.js +63 -0
- package/dist/ai/ai-message-content.mjs +61 -0
- package/dist/ai/ai-message-list.d.ts +2 -0
- package/dist/ai/ai-message-list.js +24 -0
- package/dist/ai/ai-message-list.mjs +22 -0
- package/dist/ai/ai-message-meta.d.ts +2 -0
- package/dist/ai/ai-message-meta.js +38 -0
- package/dist/ai/ai-message-meta.mjs +36 -0
- package/dist/ai/ai-status-indicator.d.ts +2 -0
- package/dist/ai/ai-status-indicator.js +51 -0
- package/dist/ai/ai-status-indicator.mjs +49 -0
- package/dist/ai/index.d.ts +11 -0
- package/dist/ai/index.js +33 -0
- package/dist/ai/index.mjs +11 -0
- package/dist/ai/types.d.ts +110 -0
- package/dist/ai/use-ai-conversation.d.ts +13 -0
- package/dist/ai/use-ai-conversation.js +276 -0
- package/dist/ai/use-ai-conversation.mjs +274 -0
- package/dist/clerk/clerk-organization-client.js +2 -2
- package/dist/clerk/clerk-organization-client.mjs +2 -2
- package/dist/clerk/clerk-page-generator.d.ts +1 -1
- package/dist/clerk/clerk-user-client.js +2 -2
- package/dist/clerk/clerk-user-client.mjs +2 -2
- package/dist/clerk/fingerprint/fingerprint-provider.js +9 -9
- package/dist/clerk/fingerprint/fingerprint-provider.mjs +9 -9
- package/dist/fuma/base/custom-header.js +4 -4
- package/dist/fuma/base/custom-header.mjs +4 -4
- package/dist/fuma/mdx/banner.js +3 -3
- package/dist/fuma/mdx/banner.mjs +3 -3
- package/dist/fuma/mdx/fuma-github-info.js +3 -3
- package/dist/fuma/mdx/fuma-github-info.mjs +3 -3
- package/dist/fuma/mdx/gradient-button.js +3 -3
- package/dist/fuma/mdx/gradient-button.mjs +3 -3
- package/dist/fuma/mdx/index.d.ts +1 -0
- package/dist/fuma/mdx/index.js +2 -0
- package/dist/fuma/mdx/index.mjs +1 -0
- package/dist/fuma/mdx/markdown-component-map.d.ts +3 -0
- package/dist/fuma/mdx/markdown-component-map.js +73 -0
- package/dist/fuma/mdx/markdown-component-map.mjs +71 -0
- package/dist/fuma/mdx/mermaid.d.ts +2 -1
- package/dist/fuma/mdx/mermaid.js +130 -6
- package/dist/fuma/mdx/mermaid.mjs +130 -6
- package/dist/fuma/mdx/toc-base.js +4 -4
- package/dist/fuma/mdx/toc-base.mjs +4 -4
- package/dist/fuma/mdx/trophy-card.js +2 -2
- package/dist/fuma/mdx/trophy-card.mjs +2 -2
- package/dist/fuma/mdx/zia-card.js +3 -3
- package/dist/fuma/mdx/zia-card.mjs +3 -3
- package/dist/fuma/mdx/zia-file.js +3 -3
- package/dist/fuma/mdx/zia-file.mjs +3 -3
- package/dist/main/ads-alert-dialog.js +2 -2
- package/dist/main/ads-alert-dialog.mjs +2 -2
- package/dist/main/credit/credit-nav-button.js +2 -2
- package/dist/main/credit/credit-nav-button.mjs +2 -2
- package/dist/main/credit/credit-overview-client.js +4 -4
- package/dist/main/credit/credit-overview-client.mjs +4 -4
- package/dist/main/footer.js +2 -2
- package/dist/main/footer.mjs +2 -2
- package/dist/main/go-to-top.js +2 -2
- package/dist/main/go-to-top.mjs +2 -2
- package/dist/main/index.d.ts +1 -0
- package/dist/main/index.js +2 -0
- package/dist/main/index.mjs +1 -0
- package/dist/main/info-tooltip.d.ts +8 -0
- package/dist/main/info-tooltip.js +48 -0
- package/dist/main/info-tooltip.mjs +46 -0
- package/dist/main/pill-select/x-pill-select.js +2 -2
- package/dist/main/pill-select/x-pill-select.mjs +2 -2
- package/dist/main/pill-select/x-token-input.js +2 -2
- package/dist/main/pill-select/x-token-input.mjs +2 -2
- package/dist/main/x-button.js +3 -3
- package/dist/main/x-button.mjs +3 -3
- package/package.json +16 -3
- package/src/ai/ai-chat-composer.tsx +187 -0
- package/src/ai/ai-markdown.tsx +45 -0
- package/src/ai/ai-message-actions.tsx +16 -0
- package/src/ai/ai-message-bubble.tsx +138 -0
- package/src/ai/ai-message-content.tsx +149 -0
- package/src/ai/ai-message-list.tsx +59 -0
- package/src/ai/ai-message-meta.tsx +56 -0
- package/src/ai/ai-status-indicator.tsx +61 -0
- package/src/ai/index.ts +13 -0
- package/src/ai/types.ts +131 -0
- package/src/ai/use-ai-conversation.ts +422 -0
- package/src/clerk/clerk-organization-client.tsx +5 -5
- package/src/clerk/clerk-page-generator.tsx +1 -1
- package/src/clerk/clerk-user-client.tsx +4 -4
- package/src/clerk/fingerprint/fingerprint-provider.tsx +34 -22
- package/src/fuma/base/custom-header.tsx +5 -5
- package/src/fuma/mdx/banner.tsx +3 -3
- package/src/fuma/mdx/fuma-github-info.tsx +4 -4
- package/src/fuma/mdx/gradient-button.tsx +3 -3
- package/src/fuma/mdx/index.ts +2 -1
- package/src/fuma/mdx/markdown-component-map.tsx +174 -0
- package/src/fuma/mdx/mermaid.tsx +145 -10
- package/src/fuma/mdx/toc-base.tsx +5 -5
- package/src/fuma/mdx/trophy-card.tsx +2 -2
- package/src/fuma/mdx/zia-card.tsx +3 -3
- package/src/fuma/mdx/zia-file.tsx +3 -3
- package/src/main/ads-alert-dialog.tsx +5 -5
- package/src/main/credit/credit-nav-button.tsx +3 -3
- package/src/main/credit/credit-overview-client.tsx +15 -7
- package/src/main/features.tsx +5 -3
- package/src/main/footer.tsx +4 -5
- package/src/main/go-to-top.tsx +2 -2
- package/src/main/index.ts +2 -0
- package/src/main/info-tooltip.tsx +99 -0
- package/src/main/language-detector.tsx +4 -4
- package/src/main/pill-select/x-pill-select.tsx +2 -2
- package/src/main/pill-select/x-token-input.tsx +2 -2
- package/src/main/x-button.tsx +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { FileIcon, FolderOpenIcon, FolderIcon } from '@windrun-huaiin/base-ui/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
6
6
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from 'fumadocs-ui/components/ui/collapsible';
|
|
@@ -9,7 +9,7 @@ import Link from 'next/link';
|
|
|
9
9
|
const itemVariants = 'flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4';
|
|
10
10
|
const anotionClass = 'ms-2 px-2 py-0.5 rounded text-xs font-semibold bg-fd-accent/80 text-fd-accent-foreground dark:bg-white/20 dark:text-white';
|
|
11
11
|
function ZiaFile(_a) {
|
|
12
|
-
var { name, icon = jsx(
|
|
12
|
+
var { name, icon = jsx(FileIcon, {}), className, anotion, href } = _a, rest = __rest(_a, ["name", "icon", "className", "anotion", "href"]);
|
|
13
13
|
const validHref = typeof href === 'string' && href.trim() !== '';
|
|
14
14
|
const validAnotion = typeof anotion === 'string' && anotion.trim() !== '';
|
|
15
15
|
if (validHref) {
|
|
@@ -21,7 +21,7 @@ function ZiaFolder(_a) {
|
|
|
21
21
|
var { name, anotion, defaultOpen = false, className, children } = _a, props = __rest(_a, ["name", "anotion", "defaultOpen", "className", "children"]);
|
|
22
22
|
const [open, setOpen] = useState(defaultOpen);
|
|
23
23
|
const validAnotion = typeof anotion === 'string' && anotion.trim() !== '';
|
|
24
|
-
return (jsxs(Collapsible, Object.assign({ open: open, onOpenChange: setOpen }, props, { children: [jsxs(CollapsibleTrigger, { className: cn(itemVariants, className, 'w-full'), children: [open ? jsx(
|
|
24
|
+
return (jsxs(Collapsible, Object.assign({ open: open, onOpenChange: setOpen }, props, { children: [jsxs(CollapsibleTrigger, { className: cn(itemVariants, className, 'w-full'), children: [open ? jsx(FolderOpenIcon, {}) : jsx(FolderIcon, {}), jsx("span", { children: name }), validAnotion && (jsx("span", { className: anotionClass, children: anotion }))] }), jsx(CollapsibleContent, { children: jsx("div", { className: "ms-2 flex flex-col border-l ps-2", children: children }) })] })));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { ZiaFile, ZiaFolder };
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var Image = require('next/image');
|
|
7
|
-
var
|
|
7
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
8
8
|
var ui = require('@windrun-huaiin/base-ui/ui');
|
|
9
9
|
|
|
10
10
|
function AdsAlertDialog({ open, onOpenChange, title, description, imgSrc, imgHref, cancelText, onCancel, confirmText, onConfirm, }) {
|
|
11
11
|
const [imgError, setImgError] = React.useState(false);
|
|
12
|
-
return (jsxRuntime.jsx(ui.AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(ui.AlertDialogContent, { className: "fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl border border-neutral-200 dark:border-neutral-700 max-w-md w-full min-w-[320px] p-4 flex flex-col items-stretch", children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-between mb-2", children: [jsxRuntime.jsx(ui.AlertDialogTitle, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1 min-w-0 text-xl font-semibold", children: [jsxRuntime.jsx(
|
|
12
|
+
return (jsxRuntime.jsx(ui.AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(ui.AlertDialogContent, { className: "fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl border border-neutral-200 dark:border-neutral-700 max-w-md w-full min-w-[320px] p-4 flex flex-col items-stretch", children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-between mb-2", children: [jsxRuntime.jsx(ui.AlertDialogTitle, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1 min-w-0 text-xl font-semibold", children: [jsxRuntime.jsx(icons.InfoIcon, { className: "w-5 h-5" }), jsxRuntime.jsx("span", { className: "truncate", children: title })] }) }), jsxRuntime.jsx("button", { className: "text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 text-xl ml-4", onClick: () => onOpenChange(false), "aria-label": "Close", tabIndex: 0, children: jsxRuntime.jsx(icons.XIcon, { className: "w-5 h-5" }) })] }), jsxRuntime.jsx(ui.AlertDialogDescription, { className: "text-base font-medium text-neutral-800 dark:text-neutral-100 mb-2", children: description }), imgSrc && (jsxRuntime.jsx("div", { className: "w-full max-w-[400px] h-[220px] relative flex items-center justify-center mb-2", children: imgError ? (jsxRuntime.jsxs("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-gray-100 dark:bg-neutral-800 border border-dashed border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-400 text-sm", children: [jsxRuntime.jsx(icons.ImageOffIcon, { className: "w-12 h-12 mb-2" }), jsxRuntime.jsx("span", { children: "Image loading failed" })] })) : imgHref ? (jsxRuntime.jsx("a", { href: imgHref, target: "_blank", rel: "noopener noreferrer", className: "block w-full h-full", children: jsxRuntime.jsx(Image, { src: imgSrc, alt: "image", fill: true, className: "object-contain rounded-lg", priority: false, placeholder: "empty", unoptimized: true, onError: () => setImgError(true), sizes: "(max-width: 400px) 100vw, 400px" }) })) : (jsxRuntime.jsx(Image, { src: imgSrc, alt: "image", fill: true, className: "object-contain rounded-lg", priority: false, placeholder: "empty", unoptimized: true, onError: () => setImgError(true), sizes: "(max-width: 400px) 100vw, 400px" })) })), (cancelText || confirmText) && (jsxRuntime.jsxs("div", { className: "flex justify-end gap-2 mt-2", children: [cancelText && (jsxRuntime.jsx("button", { onClick: () => {
|
|
13
13
|
onOpenChange(false);
|
|
14
14
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
15
15
|
}, className: "px-6 py-2 rounded-lg border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 font-semibold hover:bg-neutral-100 dark:hover:bg-neutral-700 transition", children: cancelText })), confirmText && (jsxRuntime.jsx(ui.AlertDialogAction, { onClick: () => {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import Image from 'next/image';
|
|
5
|
-
import {
|
|
5
|
+
import { InfoIcon, XIcon, ImageOffIcon } from '@windrun-huaiin/base-ui/icons';
|
|
6
6
|
import { AlertDialog, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction } from '@windrun-huaiin/base-ui/ui';
|
|
7
7
|
|
|
8
8
|
function AdsAlertDialog({ open, onOpenChange, title, description, imgSrc, imgHref, cancelText, onCancel, confirmText, onConfirm, }) {
|
|
9
9
|
const [imgError, setImgError] = useState(false);
|
|
10
|
-
return (jsx(AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxs(AlertDialogContent, { className: "fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl border border-neutral-200 dark:border-neutral-700 max-w-md w-full min-w-[320px] p-4 flex flex-col items-stretch", children: [jsxs("div", { className: "flex flex-row items-center justify-between mb-2", children: [jsx(AlertDialogTitle, { asChild: true, children: jsxs("div", { className: "flex flex-row items-center gap-1 min-w-0 text-xl font-semibold", children: [jsx(
|
|
10
|
+
return (jsx(AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxs(AlertDialogContent, { className: "fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl border border-neutral-200 dark:border-neutral-700 max-w-md w-full min-w-[320px] p-4 flex flex-col items-stretch", children: [jsxs("div", { className: "flex flex-row items-center justify-between mb-2", children: [jsx(AlertDialogTitle, { asChild: true, children: jsxs("div", { className: "flex flex-row items-center gap-1 min-w-0 text-xl font-semibold", children: [jsx(InfoIcon, { className: "w-5 h-5" }), jsx("span", { className: "truncate", children: title })] }) }), jsx("button", { className: "text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 text-xl ml-4", onClick: () => onOpenChange(false), "aria-label": "Close", tabIndex: 0, children: jsx(XIcon, { className: "w-5 h-5" }) })] }), jsx(AlertDialogDescription, { className: "text-base font-medium text-neutral-800 dark:text-neutral-100 mb-2", children: description }), imgSrc && (jsx("div", { className: "w-full max-w-[400px] h-[220px] relative flex items-center justify-center mb-2", children: imgError ? (jsxs("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-gray-100 dark:bg-neutral-800 border border-dashed border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-400 text-sm", children: [jsx(ImageOffIcon, { className: "w-12 h-12 mb-2" }), jsx("span", { children: "Image loading failed" })] })) : imgHref ? (jsx("a", { href: imgHref, target: "_blank", rel: "noopener noreferrer", className: "block w-full h-full", children: jsx(Image, { src: imgSrc, alt: "image", fill: true, className: "object-contain rounded-lg", priority: false, placeholder: "empty", unoptimized: true, onError: () => setImgError(true), sizes: "(max-width: 400px) 100vw, 400px" }) })) : (jsx(Image, { src: imgSrc, alt: "image", fill: true, className: "object-contain rounded-lg", priority: false, placeholder: "empty", unoptimized: true, onError: () => setImgError(true), sizes: "(max-width: 400px) 100vw, 400px" })) })), (cancelText || confirmText) && (jsxs("div", { className: "flex justify-end gap-2 mt-2", children: [cancelText && (jsx("button", { onClick: () => {
|
|
11
11
|
onOpenChange(false);
|
|
12
12
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
13
13
|
}, className: "px-6 py-2 rounded-lg border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 font-semibold hover:bg-neutral-100 dark:hover:bg-neutral-700 transition", children: cancelText })), confirmText && (jsx(AlertDialogAction, { onClick: () => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var utils = require('@windrun-huaiin/lib/utils');
|
|
6
|
-
var
|
|
6
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
7
7
|
var ui = require('@windrun-huaiin/base-ui/ui');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var moneyPriceInteractive = require('../money-price/money-price-interactive.js');
|
|
@@ -106,7 +106,7 @@ function CreditNavButton({ locale, totalBalance, totalLabel, children, }) {
|
|
|
106
106
|
closePricingModal,
|
|
107
107
|
}), [closeMenu, isMobile, openPricingModal, closePricingModal]);
|
|
108
108
|
const isOnetimeModal = pricingModal.mode === 'onetime';
|
|
109
|
-
return (jsxRuntime.jsxs(CreditNavPopoverContext.Provider, { value: contextValue, children: [jsxRuntime.jsxs(ui.DropdownMenu, { modal: false, open: open, onOpenChange: setOpen, children: [jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs("button", { type: "button", "aria-label": `${formattedBalance} ${totalLabel}`, className: utils.cn('group relative mx-2 sm:mx-1 inline-flex items-center gap-2 overflow-hidden rounded-full border border-slate-200 bg-white pl-2 pr-4 py-1.5 text-sm font-semibold text-slate-700 shadow-sm transition-all duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100', 'hover:-translate-y-0.5 hover:scale-[1.02] hover:border-transparent hover:text-white hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-slate-400 dark:focus-visible:ring-slate-500'), ref: triggerRef, children: [jsxRuntime.jsx("span", { className: "pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100 bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50", "aria-hidden": "true" }), jsxRuntime.jsx("span", { className: "relative z-10 flex h-6 w-6 items-center justify-center rounded-full bg-slate-100 text-slate-600 transition-transform duration-200 group-hover:scale-110 group-hover:bg-white/20 group-hover:text-white dark:bg-slate-800 dark:text-slate-200 dark:group-hover:bg-white/20 dark:group-hover:text-white", children: jsxRuntime.jsx(
|
|
109
|
+
return (jsxRuntime.jsxs(CreditNavPopoverContext.Provider, { value: contextValue, children: [jsxRuntime.jsxs(ui.DropdownMenu, { modal: false, open: open, onOpenChange: setOpen, children: [jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs("button", { type: "button", "aria-label": `${formattedBalance} ${totalLabel}`, className: utils.cn('group relative mx-2 sm:mx-1 inline-flex items-center gap-2 overflow-hidden rounded-full border border-slate-200 bg-white pl-2 pr-4 py-1.5 text-sm font-semibold text-slate-700 shadow-sm transition-all duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100', 'hover:-translate-y-0.5 hover:scale-[1.02] hover:border-transparent hover:text-white hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-slate-400 dark:focus-visible:ring-slate-500'), ref: triggerRef, children: [jsxRuntime.jsx("span", { className: "pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100 bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50", "aria-hidden": "true" }), jsxRuntime.jsx("span", { className: "relative z-10 flex h-6 w-6 items-center justify-center rounded-full bg-slate-100 text-slate-600 transition-transform duration-200 group-hover:scale-110 group-hover:bg-white/20 group-hover:text-white dark:bg-slate-800 dark:text-slate-200 dark:group-hover:bg-white/20 dark:group-hover:text-white", children: jsxRuntime.jsx(icons.GemIcon, { className: "h-3.5 w-3.5" }) }), jsxRuntime.jsxs("span", { className: "relative z-10 flex items-center", children: [jsxRuntime.jsx("span", { className: "text-base font-semibold leading-none", children: formattedBalance }), jsxRuntime.jsx("span", { className: "sr-only", children: ` ${totalLabel}` })] })] }) }), jsxRuntime.jsx(ui.DropdownMenuContent, { forceMount: true, sideOffset: 12, align: "end", className: "z-50 border-0 bg-transparent p-0 shadow-none mx-4 sm:mx-2 md:mx-1", children: jsxRuntime.jsx("div", { className: "w-[90vw] max-w-[90vw] max-h-[80vh] overflow-y-auto overflow-x-hidden rounded-3xl bg-transparent sm:w-[410px] sm:max-h-[90vh] sm:max-w-[95vw]", ref: contentRef, children: children }) })] }), pricingModal.modalMoneyPriceData && pricingModal.pricingContext ? (jsxRuntime.jsx(ui.AlertDialog, { open: pricingModal.open, onOpenChange: (open) => setPricingModal((prev) => (Object.assign(Object.assign({}, prev), { open }))), children: jsxRuntime.jsxs(ui.AlertDialogContent, { className: "mt-5 sm:mt-6 md:mt-10 lg:mt-15 w-[95vw] max-w-[1200px] overflow-hidden border border-slate-200 bg-white p-0 shadow-[0_32px_90px_rgba(15,23,42,0.25)] ring-1 ring-black/5 dark:border-white/12 dark:bg-[#0f1222] dark:shadow-[0_40px_120px_rgba(0,0,0,0.6)] dark:ring-white/10", children: [jsxRuntime.jsxs(ui.AlertDialogHeader, { className: "flex flex-row items-center justify-between border-b border-slate-200 px-6 pt-4 pb-1 dark:border-slate-800", children: [jsxRuntime.jsx(ui.AlertDialogTitle, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex flex-wrap items-baseline gap-3 text-slate-900 dark:text-white", children: [jsxRuntime.jsx("span", { className: "text-2xl font-semibold leading-tight", children: pricingModal.modalMoneyPriceData.title }), pricingModal.modalMoneyPriceData.subtitle ? (jsxRuntime.jsx("span", { className: "text-sm font-medium text-slate-500 dark:text-slate-300", children: pricingModal.modalMoneyPriceData.subtitle })) : null] }) }), jsxRuntime.jsx("button", { type: "button", className: "rounded-full p-2 text-gray-400 transition hover:bg-gray-400 hover:text-gray-400 dark:text-white/80 dark:hover:bg-white/80 dark:hover:text-white/80", onClick: closePricingModal, children: jsxRuntime.jsx(icons.XIcon, { className: "h-6 w-6" }) })] }), jsxRuntime.jsx("div", { className: "max-h-[60vh] sm:max-h-[80vh] overflow-y-auto px-4 pt-2 pb-6", children: jsxRuntime.jsx("div", { className: "mx-auto w-full", children: jsxRuntime.jsx(moneyPriceInteractive.MoneyPriceInteractive, { data: pricingModal.modalMoneyPriceData, config: pricingModal.pricingContext.moneyPriceConfig, checkoutApiEndpoint: pricingModal.pricingContext.checkoutApiEndpoint, customerPortalApiEndpoint: pricingModal.pricingContext.customerPortalApiEndpoint, enableSubscriptionUpgrade: pricingModal.pricingContext.enableSubscriptionUpgrade, initialBillingType: isOnetimeModal ? 'onetime' : undefined, disableAutoDetectBilling: isOnetimeModal, initUserContext: pricingModal.pricingContext.initUserContext }, pricingModal.mode) }) })] }) })) : null] }));
|
|
110
110
|
}
|
|
111
111
|
const CreditNavPopoverContext = React.createContext(null);
|
|
112
112
|
function useCreditNavPopover() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { GemIcon, XIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
5
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle } from '@windrun-huaiin/base-ui/ui';
|
|
6
6
|
import { createContext, useState, useRef, useCallback, useMemo, useEffect, useContext } from 'react';
|
|
7
7
|
import { MoneyPriceInteractive } from '../money-price/money-price-interactive.mjs';
|
|
@@ -104,7 +104,7 @@ function CreditNavButton({ locale, totalBalance, totalLabel, children, }) {
|
|
|
104
104
|
closePricingModal,
|
|
105
105
|
}), [closeMenu, isMobile, openPricingModal, closePricingModal]);
|
|
106
106
|
const isOnetimeModal = pricingModal.mode === 'onetime';
|
|
107
|
-
return (jsxs(CreditNavPopoverContext.Provider, { value: contextValue, children: [jsxs(DropdownMenu, { modal: false, open: open, onOpenChange: setOpen, children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsxs("button", { type: "button", "aria-label": `${formattedBalance} ${totalLabel}`, className: cn('group relative mx-2 sm:mx-1 inline-flex items-center gap-2 overflow-hidden rounded-full border border-slate-200 bg-white pl-2 pr-4 py-1.5 text-sm font-semibold text-slate-700 shadow-sm transition-all duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100', 'hover:-translate-y-0.5 hover:scale-[1.02] hover:border-transparent hover:text-white hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-slate-400 dark:focus-visible:ring-slate-500'), ref: triggerRef, children: [jsx("span", { className: "pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100 bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50", "aria-hidden": "true" }), jsx("span", { className: "relative z-10 flex h-6 w-6 items-center justify-center rounded-full bg-slate-100 text-slate-600 transition-transform duration-200 group-hover:scale-110 group-hover:bg-white/20 group-hover:text-white dark:bg-slate-800 dark:text-slate-200 dark:group-hover:bg-white/20 dark:group-hover:text-white", children: jsx(
|
|
107
|
+
return (jsxs(CreditNavPopoverContext.Provider, { value: contextValue, children: [jsxs(DropdownMenu, { modal: false, open: open, onOpenChange: setOpen, children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsxs("button", { type: "button", "aria-label": `${formattedBalance} ${totalLabel}`, className: cn('group relative mx-2 sm:mx-1 inline-flex items-center gap-2 overflow-hidden rounded-full border border-slate-200 bg-white pl-2 pr-4 py-1.5 text-sm font-semibold text-slate-700 shadow-sm transition-all duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100', 'hover:-translate-y-0.5 hover:scale-[1.02] hover:border-transparent hover:text-white hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-slate-400 dark:focus-visible:ring-slate-500'), ref: triggerRef, children: [jsx("span", { className: "pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100 bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50", "aria-hidden": "true" }), jsx("span", { className: "relative z-10 flex h-6 w-6 items-center justify-center rounded-full bg-slate-100 text-slate-600 transition-transform duration-200 group-hover:scale-110 group-hover:bg-white/20 group-hover:text-white dark:bg-slate-800 dark:text-slate-200 dark:group-hover:bg-white/20 dark:group-hover:text-white", children: jsx(GemIcon, { className: "h-3.5 w-3.5" }) }), jsxs("span", { className: "relative z-10 flex items-center", children: [jsx("span", { className: "text-base font-semibold leading-none", children: formattedBalance }), jsx("span", { className: "sr-only", children: ` ${totalLabel}` })] })] }) }), jsx(DropdownMenuContent, { forceMount: true, sideOffset: 12, align: "end", className: "z-50 border-0 bg-transparent p-0 shadow-none mx-4 sm:mx-2 md:mx-1", children: jsx("div", { className: "w-[90vw] max-w-[90vw] max-h-[80vh] overflow-y-auto overflow-x-hidden rounded-3xl bg-transparent sm:w-[410px] sm:max-h-[90vh] sm:max-w-[95vw]", ref: contentRef, children: children }) })] }), pricingModal.modalMoneyPriceData && pricingModal.pricingContext ? (jsx(AlertDialog, { open: pricingModal.open, onOpenChange: (open) => setPricingModal((prev) => (Object.assign(Object.assign({}, prev), { open }))), children: jsxs(AlertDialogContent, { className: "mt-5 sm:mt-6 md:mt-10 lg:mt-15 w-[95vw] max-w-[1200px] overflow-hidden border border-slate-200 bg-white p-0 shadow-[0_32px_90px_rgba(15,23,42,0.25)] ring-1 ring-black/5 dark:border-white/12 dark:bg-[#0f1222] dark:shadow-[0_40px_120px_rgba(0,0,0,0.6)] dark:ring-white/10", children: [jsxs(AlertDialogHeader, { className: "flex flex-row items-center justify-between border-b border-slate-200 px-6 pt-4 pb-1 dark:border-slate-800", children: [jsx(AlertDialogTitle, { asChild: true, children: jsxs("div", { className: "flex flex-wrap items-baseline gap-3 text-slate-900 dark:text-white", children: [jsx("span", { className: "text-2xl font-semibold leading-tight", children: pricingModal.modalMoneyPriceData.title }), pricingModal.modalMoneyPriceData.subtitle ? (jsx("span", { className: "text-sm font-medium text-slate-500 dark:text-slate-300", children: pricingModal.modalMoneyPriceData.subtitle })) : null] }) }), jsx("button", { type: "button", className: "rounded-full p-2 text-gray-400 transition hover:bg-gray-400 hover:text-gray-400 dark:text-white/80 dark:hover:bg-white/80 dark:hover:text-white/80", onClick: closePricingModal, children: jsx(XIcon, { className: "h-6 w-6" }) })] }), jsx("div", { className: "max-h-[60vh] sm:max-h-[80vh] overflow-y-auto px-4 pt-2 pb-6", children: jsx("div", { className: "mx-auto w-full", children: jsx(MoneyPriceInteractive, { data: pricingModal.modalMoneyPriceData, config: pricingModal.pricingContext.moneyPriceConfig, checkoutApiEndpoint: pricingModal.pricingContext.checkoutApiEndpoint, customerPortalApiEndpoint: pricingModal.pricingContext.customerPortalApiEndpoint, enableSubscriptionUpgrade: pricingModal.pricingContext.enableSubscriptionUpgrade, initialBillingType: isOnetimeModal ? 'onetime' : undefined, disableAutoDetectBilling: isOnetimeModal, initUserContext: pricingModal.pricingContext.initUserContext }, pricingModal.mode) }) })] }) })) : null] }));
|
|
108
108
|
}
|
|
109
109
|
const CreditNavPopoverContext = createContext(null);
|
|
110
110
|
function useCreditNavPopover() {
|
|
@@ -5,7 +5,7 @@ var tslib = require('tslib');
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var nextjs = require('@clerk/nextjs');
|
|
7
7
|
var gradientButton = require('../../fuma/mdx/gradient-button.js');
|
|
8
|
-
var
|
|
8
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
9
9
|
var utils = require('@windrun-huaiin/lib/utils');
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var customerPortal = require('../money-price/customer-portal.js');
|
|
@@ -231,10 +231,10 @@ function CreditOverviewClient({ data, locale, translations, className, expiringS
|
|
|
231
231
|
userToggledRef.current = true;
|
|
232
232
|
setBucketExpanded(true);
|
|
233
233
|
}, []);
|
|
234
|
-
return (jsxRuntime.jsxs("section", { className: utils.cn("flex flex-col gap-2 p-2 shadow-inner rounded-xl bg-white dark:bg-slate-900", className), children: [jsxRuntime.jsxs("header", { className: "relative rounded-2xl bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 p-4 shadow-inner dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50 sm:p-6", children: [jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 sm:gap-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-start rounded-full ", children: [jsxRuntime.jsx(
|
|
234
|
+
return (jsxRuntime.jsxs("section", { className: utils.cn("flex flex-col gap-2 p-2 shadow-inner rounded-xl bg-white dark:bg-slate-900", className), children: [jsxRuntime.jsxs("header", { className: "relative rounded-2xl bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 p-4 shadow-inner dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50 sm:p-6", children: [jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 sm:gap-3", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-start rounded-full ", children: [jsxRuntime.jsx(icons.GemIcon, { "aria-hidden": true, className: "mr-2 h-6 w-6 sm:h-8 sm:w-8" }), jsxRuntime.jsx("span", { className: "text-base sm:text-lg", children: translations.totalLabel })] }), jsxRuntime.jsx("div", { className: "flex justify-center text-3xl font-semibold leading-tight sm:text-4xl", children: formatNumber(locale, data.totalBalance) }), jsxRuntime.jsxs("div", { className: "flex-1 flex-col gap-1", children: [jsxRuntime.jsx("p", { className: "text-xs text-gray-700 dark:text-slate-100 sm:text-sm", children: translations.subscriptionPeriodLabel }), jsxRuntime.jsx("h4", { className: "text-xl font-semibold sm:text-2xl", children: subscription ? subscription.planName : translations.subscriptionInactive })] }), jsxRuntime.jsx("div", { className: "pt-2 sm:pt-0", children: jsxRuntime.jsx(gradientButton.GradientButton, { title: subscription ? translations.subscriptionManage : translations.subscribePay, align: "center", icon: subscription ? jsxRuntime.jsx(icons.Settings2Icon, {}) : jsxRuntime.jsx(icons.BellIcon, {}), openInNewTab: false, className: "w-full", onClick: subscription ? handleManageAction : handleSubscribeAction }) })] }), jsxRuntime.jsx("div", { className: "absolute right-3 top-3 sm:right-6 sm:top-6", children: jsxRuntime.jsx(HoverInfo, { label: translations.totalLabel, description: translations.summaryDescription }) })] }), jsxRuntime.jsxs("section", { className: "relative flex flex-col gap-3 rounded-2xl border p-4 shadow-inner sm:gap-2 sm:p-5", children: [jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [jsxRuntime.jsx("h3", { className: "text-base text-gray-500 dark:text-slate-100 sm:text-lg", children: translations.bucketsTitle }), hasBuckets ? (jsxRuntime.jsx("button", { type: "button", "aria-expanded": bucketExpanded, "aria-label": bucketExpanded ? translations.hiddenDetail : translations.expandDetail, onClick: toggleBucketExpanded, className: "flex h-7 w-7 items-center justify-center rounded-full border border-transparent bg-white text-purple-600 shadow-[0_6px_20px_rgba(99,102,241,0.25)] transition-colors hover:text-purple-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-purple-500 dark:bg-[#1b1541] dark:text-purple-100 dark:hover:text-purple-50 dark:shadow-[0_6px_22px_rgba(112,86,255,0.35)]", children: bucketExpanded ? (jsxRuntime.jsx(icons.ChevronUpIcon, { className: "h-4 w-4" })) : (jsxRuntime.jsx(icons.ChevronDownIcon, { className: "h-4 w-4" })) })) : null] }), hasBuckets ? (bucketExpanded ? (jsxRuntime.jsx("ul", { className: "flex flex-col gap-2", children: buckets.map((bucket) => {
|
|
235
235
|
const balanceDisplay = formatNumber(locale, bucket.balance);
|
|
236
236
|
return (jsxRuntime.jsxs("li", { "data-credit-kind": bucket.kind, className: "rounded-2xl border border-slate-200/70 bg-white/85 px-3 py-3 text-sm shadow-sm transition-transform hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800/60 dark:bg-slate-900/60 sm:px-4", children: [jsxRuntime.jsxs("div", { className: "grid grid-cols-[1fr_auto] items-center gap-3 text-xs sm:text-sm", children: [jsxRuntime.jsx("span", { className: "flex min-w-0 items-center gap-2", children: jsxRuntime.jsx("span", { className: "max-w-full truncate rounded-full bg-purple-50 px-2 py-1 text-xs text-purple-600 shadow-sm dark:bg-purple-500/20 dark:text-purple-100 sm:text-sm", children: bucket.computedLabel }) }), jsxRuntime.jsx("span", { className: "flex min-w-0 justify-end", children: jsxRuntime.jsx("span", { className: "text-right text-base font-semibold leading-tight text-gray-500 dark:text-slate-100 sm:text-lg", title: balanceDisplay, children: balanceDisplay }) })] }), jsxRuntime.jsx("div", { className: "mt-3 flex justify-end gap-2", children: jsxRuntime.jsxs("span", { className: "text-[11px] text-gray-500 dark:text-slate-100 sm:text-xs", children: [translations.expiredAtLabel, ": ", bucket.expiresAt] }) })] }, bucket.kind));
|
|
237
|
-
}) })) : (jsxRuntime.jsx("button", { type: "button", onClick: expandBuckets, className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800/60 dark:bg-slate-900/60 hover:text-purple-500", children: translations.expandDetail }))) : (jsxRuntime.jsx("div", { className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform dark:border-slate-800/60 dark:bg-slate-900/60 text-center", children: translations.bucketsEmpty })), jsxRuntime.jsx(gradientButton.GradientButton, { title: translations.onetimeBuy, icon: jsxRuntime.jsx(
|
|
237
|
+
}) })) : (jsxRuntime.jsx("button", { type: "button", onClick: expandBuckets, className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800/60 dark:bg-slate-900/60 hover:text-purple-500", children: translations.expandDetail }))) : (jsxRuntime.jsx("div", { className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform dark:border-slate-800/60 dark:bg-slate-900/60 text-center", children: translations.bucketsEmpty })), jsxRuntime.jsx(gradientButton.GradientButton, { title: translations.onetimeBuy, icon: jsxRuntime.jsx(icons.ShoppingCartIcon, {}), align: "center", className: "w-full text-sm sm:text-base", onClick: handleOnetimeAction })] })] }));
|
|
238
238
|
}
|
|
239
239
|
function deriveStatus(expiresAt, thresholdDays = 7) {
|
|
240
240
|
if (!expiresAt) {
|
|
@@ -263,7 +263,7 @@ function HoverInfo({ description, variant = 'default' }) {
|
|
|
263
263
|
}
|
|
264
264
|
return (jsxRuntime.jsxs("span", { className: "group relative inline-flex shrink-0", children: [jsxRuntime.jsx("button", { type: "button", "aria-label": description, className: utils.cn('flex h-7 w-7 items-center justify-center rounded-full border text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-purple-500', variant === 'muted'
|
|
265
265
|
? 'border-transparent bg-slate-100 text-slate-500 hover:text-slate-700 dark:bg-slate-800/70 dark:text-slate-100 dark:hover:text-slate-100'
|
|
266
|
-
: 'border-transparent bg-white text-purple-600 shadow-[0_6px_20px_rgba(99,102,241,0.25)] hover:text-purple-700 dark:bg-[#1b1541] dark:text-purple-100 dark:hover:text-purple-50 dark:shadow-[0_6px_22px_rgba(112,86,255,0.35)]'), children: jsxRuntime.jsx(
|
|
266
|
+
: 'border-transparent bg-white text-purple-600 shadow-[0_6px_20px_rgba(99,102,241,0.25)] hover:text-purple-700 dark:bg-[#1b1541] dark:text-purple-100 dark:hover:text-purple-50 dark:shadow-[0_6px_22px_rgba(112,86,255,0.35)]'), children: jsxRuntime.jsx(icons.CircleQuestionMarkIcon, { className: "h-3.5 w-3.5" }) }), jsxRuntime.jsx("span", { role: "tooltip", className: "pointer-events-none absolute top-full right-full z-50 mt-3 w-max max-w-[260px] translate-x-4 rounded-xl border border-slate-200/70 bg-slate-900/95 px-3 py-2 text-xs leading-relaxed text-white opacity-0 shadow-xl ring-1 ring-black/30 transition-all duration-150 ease-out group-hover:-translate-y-1 group-hover:opacity-100 group-focus-within:-translate-y-1 group-focus-within:opacity-100 dark:border-slate-700/60 dark:bg-slate-800/95", children: jsxRuntime.jsx("span", { className: "mt-1 block text-white dark:text-slate-100", children: description }) })] }));
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
exports.CreditOverviewClient = CreditOverviewClient;
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from 'tslib';
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useClerk } from '@clerk/nextjs';
|
|
5
5
|
import { GradientButton } from '../../fuma/mdx/gradient-button.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { GemIcon, Settings2Icon, BellIcon, ChevronUpIcon, ChevronDownIcon, ShoppingCartIcon, CircleQuestionMarkIcon } from '@windrun-huaiin/base-ui/icons';
|
|
7
7
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
8
8
|
import { useState, useRef, useCallback, useMemo, useLayoutEffect } from 'react';
|
|
9
9
|
import { redirectToCustomerPortal } from '../money-price/customer-portal.mjs';
|
|
@@ -229,10 +229,10 @@ function CreditOverviewClient({ data, locale, translations, className, expiringS
|
|
|
229
229
|
userToggledRef.current = true;
|
|
230
230
|
setBucketExpanded(true);
|
|
231
231
|
}, []);
|
|
232
|
-
return (jsxs("section", { className: cn("flex flex-col gap-2 p-2 shadow-inner rounded-xl bg-white dark:bg-slate-900", className), children: [jsxs("header", { className: "relative rounded-2xl bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 p-4 shadow-inner dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50 sm:p-6", children: [jsxs("div", { className: "flex flex-col gap-2 sm:gap-3", children: [jsxs("div", { className: "flex items-center justify-start rounded-full ", children: [jsx(
|
|
232
|
+
return (jsxs("section", { className: cn("flex flex-col gap-2 p-2 shadow-inner rounded-xl bg-white dark:bg-slate-900", className), children: [jsxs("header", { className: "relative rounded-2xl bg-linear-to-bl from-indigo-200/60 via-indigo-400/90 to-purple-200/50 p-4 shadow-inner dark:from-indigo-300/20 dark:via-slate-400 dark:to-slate-500/50 sm:p-6", children: [jsxs("div", { className: "flex flex-col gap-2 sm:gap-3", children: [jsxs("div", { className: "flex items-center justify-start rounded-full ", children: [jsx(GemIcon, { "aria-hidden": true, className: "mr-2 h-6 w-6 sm:h-8 sm:w-8" }), jsx("span", { className: "text-base sm:text-lg", children: translations.totalLabel })] }), jsx("div", { className: "flex justify-center text-3xl font-semibold leading-tight sm:text-4xl", children: formatNumber(locale, data.totalBalance) }), jsxs("div", { className: "flex-1 flex-col gap-1", children: [jsx("p", { className: "text-xs text-gray-700 dark:text-slate-100 sm:text-sm", children: translations.subscriptionPeriodLabel }), jsx("h4", { className: "text-xl font-semibold sm:text-2xl", children: subscription ? subscription.planName : translations.subscriptionInactive })] }), jsx("div", { className: "pt-2 sm:pt-0", children: jsx(GradientButton, { title: subscription ? translations.subscriptionManage : translations.subscribePay, align: "center", icon: subscription ? jsx(Settings2Icon, {}) : jsx(BellIcon, {}), openInNewTab: false, className: "w-full", onClick: subscription ? handleManageAction : handleSubscribeAction }) })] }), jsx("div", { className: "absolute right-3 top-3 sm:right-6 sm:top-6", children: jsx(HoverInfo, { label: translations.totalLabel, description: translations.summaryDescription }) })] }), jsxs("section", { className: "relative flex flex-col gap-3 rounded-2xl border p-4 shadow-inner sm:gap-2 sm:p-5", children: [jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [jsx("h3", { className: "text-base text-gray-500 dark:text-slate-100 sm:text-lg", children: translations.bucketsTitle }), hasBuckets ? (jsx("button", { type: "button", "aria-expanded": bucketExpanded, "aria-label": bucketExpanded ? translations.hiddenDetail : translations.expandDetail, onClick: toggleBucketExpanded, className: "flex h-7 w-7 items-center justify-center rounded-full border border-transparent bg-white text-purple-600 shadow-[0_6px_20px_rgba(99,102,241,0.25)] transition-colors hover:text-purple-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-purple-500 dark:bg-[#1b1541] dark:text-purple-100 dark:hover:text-purple-50 dark:shadow-[0_6px_22px_rgba(112,86,255,0.35)]", children: bucketExpanded ? (jsx(ChevronUpIcon, { className: "h-4 w-4" })) : (jsx(ChevronDownIcon, { className: "h-4 w-4" })) })) : null] }), hasBuckets ? (bucketExpanded ? (jsx("ul", { className: "flex flex-col gap-2", children: buckets.map((bucket) => {
|
|
233
233
|
const balanceDisplay = formatNumber(locale, bucket.balance);
|
|
234
234
|
return (jsxs("li", { "data-credit-kind": bucket.kind, className: "rounded-2xl border border-slate-200/70 bg-white/85 px-3 py-3 text-sm shadow-sm transition-transform hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800/60 dark:bg-slate-900/60 sm:px-4", children: [jsxs("div", { className: "grid grid-cols-[1fr_auto] items-center gap-3 text-xs sm:text-sm", children: [jsx("span", { className: "flex min-w-0 items-center gap-2", children: jsx("span", { className: "max-w-full truncate rounded-full bg-purple-50 px-2 py-1 text-xs text-purple-600 shadow-sm dark:bg-purple-500/20 dark:text-purple-100 sm:text-sm", children: bucket.computedLabel }) }), jsx("span", { className: "flex min-w-0 justify-end", children: jsx("span", { className: "text-right text-base font-semibold leading-tight text-gray-500 dark:text-slate-100 sm:text-lg", title: balanceDisplay, children: balanceDisplay }) })] }), jsx("div", { className: "mt-3 flex justify-end gap-2", children: jsxs("span", { className: "text-[11px] text-gray-500 dark:text-slate-100 sm:text-xs", children: [translations.expiredAtLabel, ": ", bucket.expiresAt] }) })] }, bucket.kind));
|
|
235
|
-
}) })) : (jsx("button", { type: "button", onClick: expandBuckets, className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800/60 dark:bg-slate-900/60 hover:text-purple-500", children: translations.expandDetail }))) : (jsx("div", { className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform dark:border-slate-800/60 dark:bg-slate-900/60 text-center", children: translations.bucketsEmpty })), jsx(GradientButton, { title: translations.onetimeBuy, icon: jsx(
|
|
235
|
+
}) })) : (jsx("button", { type: "button", onClick: expandBuckets, className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800/60 dark:bg-slate-900/60 hover:text-purple-500", children: translations.expandDetail }))) : (jsx("div", { className: "w-full rounded-2xl border border-slate-200/70 bg-white/85 p-6 sm:px-4 text-sm shadow-sm transition-transform dark:border-slate-800/60 dark:bg-slate-900/60 text-center", children: translations.bucketsEmpty })), jsx(GradientButton, { title: translations.onetimeBuy, icon: jsx(ShoppingCartIcon, {}), align: "center", className: "w-full text-sm sm:text-base", onClick: handleOnetimeAction })] })] }));
|
|
236
236
|
}
|
|
237
237
|
function deriveStatus(expiresAt, thresholdDays = 7) {
|
|
238
238
|
if (!expiresAt) {
|
|
@@ -261,7 +261,7 @@ function HoverInfo({ description, variant = 'default' }) {
|
|
|
261
261
|
}
|
|
262
262
|
return (jsxs("span", { className: "group relative inline-flex shrink-0", children: [jsx("button", { type: "button", "aria-label": description, className: cn('flex h-7 w-7 items-center justify-center rounded-full border text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-purple-500', variant === 'muted'
|
|
263
263
|
? 'border-transparent bg-slate-100 text-slate-500 hover:text-slate-700 dark:bg-slate-800/70 dark:text-slate-100 dark:hover:text-slate-100'
|
|
264
|
-
: 'border-transparent bg-white text-purple-600 shadow-[0_6px_20px_rgba(99,102,241,0.25)] hover:text-purple-700 dark:bg-[#1b1541] dark:text-purple-100 dark:hover:text-purple-50 dark:shadow-[0_6px_22px_rgba(112,86,255,0.35)]'), children: jsx(
|
|
264
|
+
: 'border-transparent bg-white text-purple-600 shadow-[0_6px_20px_rgba(99,102,241,0.25)] hover:text-purple-700 dark:bg-[#1b1541] dark:text-purple-100 dark:hover:text-purple-50 dark:shadow-[0_6px_22px_rgba(112,86,255,0.35)]'), children: jsx(CircleQuestionMarkIcon, { className: "h-3.5 w-3.5" }) }), jsx("span", { role: "tooltip", className: "pointer-events-none absolute top-full right-full z-50 mt-3 w-max max-w-[260px] translate-x-4 rounded-xl border border-slate-200/70 bg-slate-900/95 px-3 py-2 text-xs leading-relaxed text-white opacity-0 shadow-xl ring-1 ring-black/30 transition-all duration-150 ease-out group-hover:-translate-y-1 group-hover:opacity-100 group-focus-within:-translate-y-1 group-focus-within:opacity-100 dark:border-slate-700/60 dark:bg-slate-800/95", children: jsx("span", { className: "mt-1 block text-white dark:text-slate-100", children: description }) })] }));
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
export { CreditOverviewClient };
|
package/dist/main/footer.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var server = require('next-intl/server');
|
|
6
|
-
var
|
|
6
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
7
7
|
var Link = require('next/link');
|
|
8
8
|
var footerEmail = require('./footer-email.js');
|
|
9
9
|
var tIntl = require('../lib/t-intl.js');
|
|
@@ -23,7 +23,7 @@ function Footer(_a) {
|
|
|
23
23
|
clickToCopyText: tIntl.safeT(tFooter, 'clickToCopy', 'Click to copy'),
|
|
24
24
|
copiedText: tIntl.safeT(tFooter, 'copied', 'Copied!'),
|
|
25
25
|
};
|
|
26
|
-
return (jsxRuntime.jsxs("div", { className: "mb-10 w-full mx-auto", children: [jsxRuntime.jsx("div", { className: lib.cn("w-full border-current border-t", lib$1.themeIconColor) }), jsxRuntime.jsx("footer", { children: jsxRuntime.jsxs("div", { className: "w-full flex flex-col items-center justify-center px-4 py-8 space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-center gap-x-2 gap-y-2 text-xs sm:text-sm sm:gap-x-6", children: [jsxRuntime.jsxs(Link, { href: lib.getAsNeededLocalizedUrl(locale, "/legal/terms", localePrefixAsNeeded, defaultLocale), className: "flex items-center space-x-1 hover:underline", children: [jsxRuntime.jsx(
|
|
26
|
+
return (jsxRuntime.jsxs("div", { className: "mb-10 w-full mx-auto", children: [jsxRuntime.jsx("div", { className: lib.cn("w-full border-current border-t", lib$1.themeIconColor) }), jsxRuntime.jsx("footer", { children: jsxRuntime.jsxs("div", { className: "w-full flex flex-col items-center justify-center px-4 py-8 space-y-3", children: [jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-center gap-x-2 gap-y-2 text-xs sm:text-sm sm:gap-x-6", children: [jsxRuntime.jsxs(Link, { href: lib.getAsNeededLocalizedUrl(locale, "/legal/terms", localePrefixAsNeeded, defaultLocale), className: "flex items-center space-x-1 hover:underline", children: [jsxRuntime.jsx(icons.ReceiptTextIcon, { className: "h-3.5 w-3.5" }), jsxRuntime.jsx("span", { children: data.terms })] }), jsxRuntime.jsxs(Link, { href: lib.getAsNeededLocalizedUrl(locale, "/legal/privacy", localePrefixAsNeeded, defaultLocale), className: "flex items-center space-x-1 hover:underline", children: [jsxRuntime.jsx(icons.ShieldUserIcon, { className: "h-3.5 w-3.5" }), jsxRuntime.jsx("span", { children: data.privacy })] }), jsxRuntime.jsxs(footerEmail.FooterEmail, { email: data.email, clickToCopyText: data.clickToCopyText, copiedText: data.copiedText, children: [jsxRuntime.jsx(icons.MailIcon, { className: "h-3.5 w-3.5" }), jsxRuntime.jsx("span", { children: data.contactUs })] })] }), jsxRuntime.jsx("div", { className: "text-xs sm:text-sm text-center", children: jsxRuntime.jsx("span", { children: data.copyright }) })] }) })] }));
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
package/dist/main/footer.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { getTranslations } from 'next-intl/server';
|
|
4
|
-
import {
|
|
4
|
+
import { ReceiptTextIcon, ShieldUserIcon, MailIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
5
|
import Link from 'next/link';
|
|
6
6
|
import { FooterEmail } from './footer-email.mjs';
|
|
7
7
|
import { safeT } from '../lib/t-intl.mjs';
|
|
@@ -21,7 +21,7 @@ function Footer(_a) {
|
|
|
21
21
|
clickToCopyText: safeT(tFooter, 'clickToCopy', 'Click to copy'),
|
|
22
22
|
copiedText: safeT(tFooter, 'copied', 'Copied!'),
|
|
23
23
|
};
|
|
24
|
-
return (jsxs("div", { className: "mb-10 w-full mx-auto", children: [jsx("div", { className: cn("w-full border-current border-t", themeIconColor) }), jsx("footer", { children: jsxs("div", { className: "w-full flex flex-col items-center justify-center px-4 py-8 space-y-3", children: [jsxs("div", { className: "flex flex-wrap items-center justify-center gap-x-2 gap-y-2 text-xs sm:text-sm sm:gap-x-6", children: [jsxs(Link, { href: getAsNeededLocalizedUrl(locale, "/legal/terms", localePrefixAsNeeded, defaultLocale), className: "flex items-center space-x-1 hover:underline", children: [jsx(
|
|
24
|
+
return (jsxs("div", { className: "mb-10 w-full mx-auto", children: [jsx("div", { className: cn("w-full border-current border-t", themeIconColor) }), jsx("footer", { children: jsxs("div", { className: "w-full flex flex-col items-center justify-center px-4 py-8 space-y-3", children: [jsxs("div", { className: "flex flex-wrap items-center justify-center gap-x-2 gap-y-2 text-xs sm:text-sm sm:gap-x-6", children: [jsxs(Link, { href: getAsNeededLocalizedUrl(locale, "/legal/terms", localePrefixAsNeeded, defaultLocale), className: "flex items-center space-x-1 hover:underline", children: [jsx(ReceiptTextIcon, { className: "h-3.5 w-3.5" }), jsx("span", { children: data.terms })] }), jsxs(Link, { href: getAsNeededLocalizedUrl(locale, "/legal/privacy", localePrefixAsNeeded, defaultLocale), className: "flex items-center space-x-1 hover:underline", children: [jsx(ShieldUserIcon, { className: "h-3.5 w-3.5" }), jsx("span", { children: data.privacy })] }), jsxs(FooterEmail, { email: data.email, clickToCopyText: data.clickToCopyText, copiedText: data.copiedText, children: [jsx(MailIcon, { className: "h-3.5 w-3.5" }), jsx("span", { children: data.contactUs })] })] }), jsx("div", { className: "text-xs sm:text-sm text-center", children: jsx("span", { children: data.copyright }) })] }) })] }));
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
package/dist/main/go-to-top.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
7
7
|
var lib = require('@windrun-huaiin/base-ui/lib');
|
|
8
8
|
|
|
9
9
|
function GoToTop() {
|
|
@@ -28,7 +28,7 @@ function GoToTop() {
|
|
|
28
28
|
behavior: 'smooth'
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isVisible && (jsxRuntime.jsx("button", { onClick: scrollToTop, className: `fixed bottom-6 right-6 p-3 ${lib.themeButtonGradientClass} ${lib.themeButtonGradientHoverClass} text-white rounded-full shadow-lg hover:shadow-xl transition-all duration-300 z-50`, "aria-label": "Go to top", children: jsxRuntime.jsx(
|
|
31
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isVisible && (jsxRuntime.jsx("button", { onClick: scrollToTop, className: `fixed bottom-6 right-6 p-3 ${lib.themeButtonGradientClass} ${lib.themeButtonGradientHoverClass} text-white rounded-full shadow-lg hover:shadow-xl transition-all duration-300 z-50`, "aria-label": "Go to top", children: jsxRuntime.jsx(icons.ArrowUpIcon, { size: 20, className: "text-white" }) })) }));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
exports.GoToTop = GoToTop;
|
package/dist/main/go-to-top.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { ArrowUpIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
5
|
import { themeButtonGradientClass, themeButtonGradientHoverClass } from '@windrun-huaiin/base-ui/lib';
|
|
6
6
|
|
|
7
7
|
function GoToTop() {
|
|
@@ -26,7 +26,7 @@ function GoToTop() {
|
|
|
26
26
|
behavior: 'smooth'
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
return (jsx(Fragment, { children: isVisible && (jsx("button", { onClick: scrollToTop, className: `fixed bottom-6 right-6 p-3 ${themeButtonGradientClass} ${themeButtonGradientHoverClass} text-white rounded-full shadow-lg hover:shadow-xl transition-all duration-300 z-50`, "aria-label": "Go to top", children: jsx(
|
|
29
|
+
return (jsx(Fragment, { children: isVisible && (jsx("button", { onClick: scrollToTop, className: `fixed bottom-6 right-6 p-3 ${themeButtonGradientClass} ${themeButtonGradientHoverClass} text-white rounded-full shadow-lg hover:shadow-xl transition-all duration-300 z-50`, "aria-label": "Go to top", children: jsx(ArrowUpIcon, { size: 20, className: "text-white" }) })) }));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export { GoToTop };
|
package/dist/main/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export { CreditOverviewClient } from './credit/credit-overview-client';
|
|
|
18
18
|
export { CreditNavButton } from './credit/credit-nav-button';
|
|
19
19
|
export { HeroMedia } from './hero-media';
|
|
20
20
|
export { HeroSection } from './hero-section';
|
|
21
|
+
export { InfoTooltip } from './info-tooltip';
|
package/dist/main/index.js
CHANGED
|
@@ -24,6 +24,7 @@ var creditOverviewClient = require('./credit/credit-overview-client.js');
|
|
|
24
24
|
var creditNavButton = require('./credit/credit-nav-button.js');
|
|
25
25
|
var heroMedia = require('./hero-media.js');
|
|
26
26
|
var heroSection = require('./hero-section.js');
|
|
27
|
+
var infoTooltip = require('./info-tooltip.js');
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
@@ -53,3 +54,4 @@ exports.CreditOverviewClient = creditOverviewClient.CreditOverviewClient;
|
|
|
53
54
|
exports.CreditNavButton = creditNavButton.CreditNavButton;
|
|
54
55
|
exports.HeroMedia = heroMedia.HeroMedia;
|
|
55
56
|
exports.HeroSection = heroSection.HeroSection;
|
|
57
|
+
exports.InfoTooltip = infoTooltip.InfoTooltip;
|
package/dist/main/index.mjs
CHANGED
|
@@ -22,3 +22,4 @@ export { CreditOverviewClient } from './credit/credit-overview-client.mjs';
|
|
|
22
22
|
export { CreditNavButton } from './credit/credit-nav-button.mjs';
|
|
23
23
|
export { HeroMedia } from './hero-media.mjs';
|
|
24
24
|
export { HeroSection } from './hero-section.mjs';
|
|
25
|
+
export { InfoTooltip } from './info-tooltip.mjs';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type InfoTooltipProps = {
|
|
2
|
+
content: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
align?: 'start' | 'end';
|
|
5
|
+
desktopSide?: 'right' | 'bottom';
|
|
6
|
+
};
|
|
7
|
+
export declare function InfoTooltip({ content, className, align, desktopSide, }: InfoTooltipProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
7
|
+
var lib = require('@windrun-huaiin/base-ui/lib');
|
|
8
|
+
var utils = require('@windrun-huaiin/lib/utils');
|
|
9
|
+
|
|
10
|
+
function InfoTooltip({ content, className, align = 'end', desktopSide = 'right', }) {
|
|
11
|
+
const normalizedContent = content.trim();
|
|
12
|
+
const containerRef = React.useRef(null);
|
|
13
|
+
const [open, setOpen] = React.useState(false);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
function handlePointerDown(event) {
|
|
16
|
+
if (!containerRef.current) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const target = event.target;
|
|
20
|
+
if (target instanceof Node && !containerRef.current.contains(target)) {
|
|
21
|
+
setOpen(false);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
document.addEventListener('mousedown', handlePointerDown);
|
|
25
|
+
document.addEventListener('touchstart', handlePointerDown);
|
|
26
|
+
return () => {
|
|
27
|
+
document.removeEventListener('mousedown', handlePointerDown);
|
|
28
|
+
document.removeEventListener('touchstart', handlePointerDown);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
if (!normalizedContent) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return (jsxRuntime.jsxs("span", { ref: containerRef, className: utils.cn('relative inline-flex h-5 w-5 shrink-0 align-middle', className), onMouseLeave: () => setOpen(false), children: [jsxRuntime.jsx("button", { type: "button", onMouseEnter: () => setOpen(true), onPointerDown: (event) => {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
}, onClick: (event) => {
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
setOpen((value) => !value);
|
|
39
|
+
}, className: utils.cn('inline-flex h-5 w-5 items-center justify-center rounded-full text-slate-400 transition', 'hover:bg-black/5 hover:dark:bg-white/5', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-slate-950', 'hover:text-slate-700 dark:hover:text-white focus-visible:text-slate-700 dark:focus-visible:text-white', lib.themeIconColor, lib.themeRingColor), "aria-label": normalizedContent, "aria-expanded": open, children: jsxRuntime.jsx(icons.CircleQuestionMarkIcon, { className: "h-4 w-4" }) }), jsxRuntime.jsx("span", { className: utils.cn('pointer-events-none absolute top-full z-50 mt-2 w-[min(18rem,calc(100vw-2rem))] rounded-2xl border bg-white/95 px-3 py-2 text-xs leading-5 text-slate-600 shadow-xl backdrop-blur-sm dark:bg-slate-950/95 dark:text-slate-300', align === 'start' ? 'left-0 right-auto' : 'right-0 left-auto', desktopSide === 'right'
|
|
40
|
+
? align === 'start'
|
|
41
|
+
? 'sm:left-0 sm:right-auto md:left-full md:right-auto md:top-1/2 md:mt-0 md:ml-2 md:-translate-y-1/2'
|
|
42
|
+
: 'sm:right-0 sm:left-auto md:left-full md:right-auto md:top-1/2 md:mt-0 md:ml-2 md:-translate-y-1/2'
|
|
43
|
+
: align === 'start'
|
|
44
|
+
? 'md:left-0 md:right-auto md:top-full md:mt-2 md:ml-0 md:translate-y-0'
|
|
45
|
+
: 'md:right-0 md:left-auto md:top-full md:mt-2 md:ml-0 md:translate-y-0', open ? 'block' : 'hidden', lib.themeBorderColor), role: "tooltip", children: normalizedContent })] }));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.InfoTooltip = InfoTooltip;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useState, useEffect } from 'react';
|
|
4
|
+
import { CircleQuestionMarkIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
|
+
import { themeIconColor, themeRingColor, themeBorderColor } from '@windrun-huaiin/base-ui/lib';
|
|
6
|
+
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
|
+
|
|
8
|
+
function InfoTooltip({ content, className, align = 'end', desktopSide = 'right', }) {
|
|
9
|
+
const normalizedContent = content.trim();
|
|
10
|
+
const containerRef = useRef(null);
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
function handlePointerDown(event) {
|
|
14
|
+
if (!containerRef.current) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const target = event.target;
|
|
18
|
+
if (target instanceof Node && !containerRef.current.contains(target)) {
|
|
19
|
+
setOpen(false);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
document.addEventListener('mousedown', handlePointerDown);
|
|
23
|
+
document.addEventListener('touchstart', handlePointerDown);
|
|
24
|
+
return () => {
|
|
25
|
+
document.removeEventListener('mousedown', handlePointerDown);
|
|
26
|
+
document.removeEventListener('touchstart', handlePointerDown);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
if (!normalizedContent) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return (jsxs("span", { ref: containerRef, className: cn('relative inline-flex h-5 w-5 shrink-0 align-middle', className), onMouseLeave: () => setOpen(false), children: [jsx("button", { type: "button", onMouseEnter: () => setOpen(true), onPointerDown: (event) => {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
}, onClick: (event) => {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
setOpen((value) => !value);
|
|
37
|
+
}, className: cn('inline-flex h-5 w-5 items-center justify-center rounded-full text-slate-400 transition', 'hover:bg-black/5 hover:dark:bg-white/5', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-slate-950', 'hover:text-slate-700 dark:hover:text-white focus-visible:text-slate-700 dark:focus-visible:text-white', themeIconColor, themeRingColor), "aria-label": normalizedContent, "aria-expanded": open, children: jsx(CircleQuestionMarkIcon, { className: "h-4 w-4" }) }), jsx("span", { className: cn('pointer-events-none absolute top-full z-50 mt-2 w-[min(18rem,calc(100vw-2rem))] rounded-2xl border bg-white/95 px-3 py-2 text-xs leading-5 text-slate-600 shadow-xl backdrop-blur-sm dark:bg-slate-950/95 dark:text-slate-300', align === 'start' ? 'left-0 right-auto' : 'right-0 left-auto', desktopSide === 'right'
|
|
38
|
+
? align === 'start'
|
|
39
|
+
? 'sm:left-0 sm:right-auto md:left-full md:right-auto md:top-1/2 md:mt-0 md:ml-2 md:-translate-y-1/2'
|
|
40
|
+
: 'sm:right-0 sm:left-auto md:left-full md:right-auto md:top-1/2 md:mt-0 md:ml-2 md:-translate-y-1/2'
|
|
41
|
+
: align === 'start'
|
|
42
|
+
? 'md:left-0 md:right-auto md:top-full md:mt-2 md:ml-0 md:translate-y-0'
|
|
43
|
+
: 'md:right-0 md:left-auto md:top-full md:mt-2 md:ml-0 md:translate-y-0', open ? 'block' : 'hidden', themeBorderColor), role: "tooltip", children: normalizedContent })] }));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { InfoTooltip };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
7
7
|
var lib = require('@windrun-huaiin/base-ui/lib');
|
|
8
8
|
var utils = require('@windrun-huaiin/lib/utils');
|
|
9
9
|
|
|
@@ -126,7 +126,7 @@ function XPillSelect(props) {
|
|
|
126
126
|
event.stopPropagation();
|
|
127
127
|
removeValue(selectedValue);
|
|
128
128
|
}, disabled: disabled, className: utils.cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'gap-1 px-2.5 py-0.5 text-[11px]' : 'gap-1.5 px-3 py-1 text-xs', lib.themeBgColor, lib.themeIconColor, 'hover:brightness-95 dark:hover:brightness-110', disabled && 'cursor-not-allowed opacity-60'), title: optionLabel, children: jsxRuntime.jsx("span", { className: utils.cn('truncate', maxPillWidthClassName), children: optionLabel }) }, selectedValue));
|
|
129
|
-
}), hiddenSelectedCount > 0 ? (jsxRuntime.jsxs("span", { className: utils.cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'px-2.5 py-0.5 text-[11px]' : 'px-3 py-1 text-xs', 'bg-neutral-200 text-neutral-700 dark:bg-neutral-800 dark:text-white'), title: `还有 ${hiddenSelectedCount} 项未展开`, children: ["+", hiddenSelectedCount] })) : null] }))) : (jsxRuntime.jsx("span", { className: utils.cn(compact ? 'text-xs' : 'text-sm', 'text-slate-500 dark:text-slate-400'), children: emptyLabel })) }), jsxRuntime.jsx(
|
|
129
|
+
}), hiddenSelectedCount > 0 ? (jsxRuntime.jsxs("span", { className: utils.cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'px-2.5 py-0.5 text-[11px]' : 'px-3 py-1 text-xs', 'bg-neutral-200 text-neutral-700 dark:bg-neutral-800 dark:text-white'), title: `还有 ${hiddenSelectedCount} 项未展开`, children: ["+", hiddenSelectedCount] })) : null] }))) : (jsxRuntime.jsx("span", { className: utils.cn(compact ? 'text-xs' : 'text-sm', 'text-slate-500 dark:text-slate-400'), children: emptyLabel })) }), jsxRuntime.jsx(icons.ChevronDownIcon, { className: utils.cn(compact ? 'h-3.5 w-3.5' : 'h-4 w-4', 'shrink-0 text-slate-500 transition-transform dark:text-slate-400', open && 'rotate-180') })] }), open ? (jsxRuntime.jsxs("div", { role: "listbox", "aria-multiselectable": props.mode === 'multiple' ? true : undefined, className: utils.cn('absolute left-0 right-0 top-[calc(100%+0.375rem)] z-50 rounded-3xl border border-black/10 bg-neutral-100 shadow-xl dark:border-white/10 dark:bg-neutral-900', compact ? 'space-y-2.5 p-3' : 'space-y-3 p-4', open && lib.themeBorderColor), children: [inputEnabled ? (jsxRuntime.jsx("input", { value: draftValue, onChange: (event) => setDraftValue(event.target.value.replaceAll(',', '')), onKeyDown: (event) => {
|
|
130
130
|
if (event.key !== 'Enter') {
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useRef, useMemo, useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronDownIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
5
|
import { themeBgColor, themeIconColor, themeBorderColor } from '@windrun-huaiin/base-ui/lib';
|
|
6
6
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
7
|
|
|
@@ -124,7 +124,7 @@ function XPillSelect(props) {
|
|
|
124
124
|
event.stopPropagation();
|
|
125
125
|
removeValue(selectedValue);
|
|
126
126
|
}, disabled: disabled, className: cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'gap-1 px-2.5 py-0.5 text-[11px]' : 'gap-1.5 px-3 py-1 text-xs', themeBgColor, themeIconColor, 'hover:brightness-95 dark:hover:brightness-110', disabled && 'cursor-not-allowed opacity-60'), title: optionLabel, children: jsx("span", { className: cn('truncate', maxPillWidthClassName), children: optionLabel }) }, selectedValue));
|
|
127
|
-
}), hiddenSelectedCount > 0 ? (jsxs("span", { className: cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'px-2.5 py-0.5 text-[11px]' : 'px-3 py-1 text-xs', 'bg-neutral-200 text-neutral-700 dark:bg-neutral-800 dark:text-white'), title: `还有 ${hiddenSelectedCount} 项未展开`, children: ["+", hiddenSelectedCount] })) : null] }))) : (jsx("span", { className: cn(compact ? 'text-xs' : 'text-sm', 'text-slate-500 dark:text-slate-400'), children: emptyLabel })) }), jsx(
|
|
127
|
+
}), hiddenSelectedCount > 0 ? (jsxs("span", { className: cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'px-2.5 py-0.5 text-[11px]' : 'px-3 py-1 text-xs', 'bg-neutral-200 text-neutral-700 dark:bg-neutral-800 dark:text-white'), title: `还有 ${hiddenSelectedCount} 项未展开`, children: ["+", hiddenSelectedCount] })) : null] }))) : (jsx("span", { className: cn(compact ? 'text-xs' : 'text-sm', 'text-slate-500 dark:text-slate-400'), children: emptyLabel })) }), jsx(ChevronDownIcon, { className: cn(compact ? 'h-3.5 w-3.5' : 'h-4 w-4', 'shrink-0 text-slate-500 transition-transform dark:text-slate-400', open && 'rotate-180') })] }), open ? (jsxs("div", { role: "listbox", "aria-multiselectable": props.mode === 'multiple' ? true : undefined, className: cn('absolute left-0 right-0 top-[calc(100%+0.375rem)] z-50 rounded-3xl border border-black/10 bg-neutral-100 shadow-xl dark:border-white/10 dark:bg-neutral-900', compact ? 'space-y-2.5 p-3' : 'space-y-3 p-4', open && themeBorderColor), children: [inputEnabled ? (jsx("input", { value: draftValue, onChange: (event) => setDraftValue(event.target.value.replaceAll(',', '')), onKeyDown: (event) => {
|
|
128
128
|
if (event.key !== 'Enter') {
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var icons = require('@windrun-huaiin/base-ui/icons');
|
|
7
7
|
var lib = require('@windrun-huaiin/base-ui/lib');
|
|
8
8
|
var utils = require('@windrun-huaiin/lib/utils');
|
|
9
9
|
|
|
@@ -50,7 +50,7 @@ function XTokenInput({ value, onChange, placeholder, emptyLabel, disabled = fals
|
|
|
50
50
|
}, className: utils.cn('w-full min-w-0 rounded-3xl border border-black/10 transition dark:border-white/10', compact ? 'min-h-9 px-3 py-1.5' : 'min-h-11 px-4 py-2.5', focused && lib.themeBorderColor), children: jsxRuntime.jsxs("div", { className: utils.cn('flex w-full min-w-0 flex-wrap items-center', compact ? 'gap-1.5' : 'gap-2'), children: [tokens.length > 0 ? (jsxRuntime.jsx("ul", { className: "contents", role: "list", children: tokens.map((token) => (jsxRuntime.jsx("li", { className: "max-w-full list-none", children: jsxRuntime.jsxs("span", { className: utils.cn('inline-flex max-w-full items-center rounded-full font-semibold transition', compact ? 'gap-1 px-2.5 py-0.5 text-[11px]' : 'gap-1 px-3 py-1 text-xs', lib.themeBgColor, lib.themeIconColor, disabled && 'opacity-60'), title: token, children: [jsxRuntime.jsx("span", { className: utils.cn('truncate', maxPillWidthClassName), children: token }), jsxRuntime.jsx("button", { type: "button", onClick: (event) => {
|
|
51
51
|
event.stopPropagation();
|
|
52
52
|
removeToken(token);
|
|
53
|
-
}, disabled: disabled, "aria-label": `Remove ${token}`, className: utils.cn('inline-flex shrink-0 items-center justify-center rounded-full transition', compact ? 'h-3.5 w-3.5' : 'h-4 w-4', 'hover:bg-black/10 dark:hover:bg-white/10', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1', lib.themeRingColor, disabled && 'cursor-not-allowed'), children: jsxRuntime.jsx(
|
|
53
|
+
}, disabled: disabled, "aria-label": `Remove ${token}`, className: utils.cn('inline-flex shrink-0 items-center justify-center rounded-full transition', compact ? 'h-3.5 w-3.5' : 'h-4 w-4', 'hover:bg-black/10 dark:hover:bg-white/10', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1', lib.themeRingColor, disabled && 'cursor-not-allowed'), children: jsxRuntime.jsx(icons.XIcon, { className: utils.cn(compact ? 'h-2 w-2' : 'h-2.5 w-2.5') }) })] }) }, token))) })) : null, jsxRuntime.jsx("div", { className: utils.cn('min-w-0 overflow-hidden', tokens.length === 0
|
|
54
54
|
? 'flex-1 min-w-[160px]'
|
|
55
55
|
: draftValue || focused
|
|
56
56
|
? 'flex-1 min-w-[120px]'
|