@windrun-huaiin/third-ui 15.1.0 → 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/hero-media.d.ts +14 -0
- package/dist/main/hero-media.js +12 -0
- package/dist/main/hero-media.mjs +10 -0
- package/dist/main/hero-section.d.ts +10 -0
- package/dist/main/hero-section.js +11 -0
- package/dist/main/hero-section.mjs +9 -0
- package/dist/main/index.d.ts +3 -0
- package/dist/main/index.js +6 -0
- package/dist/main/index.mjs +3 -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/hero-media.tsx +53 -0
- package/src/main/hero-section.tsx +36 -0
- package/src/main/index.ts +5 -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
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import { useClerk } from '@clerk/nextjs';
|
|
4
4
|
import { GradientButton } from '@third-ui/fuma/mdx/gradient-button';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
BellIcon,
|
|
7
|
+
ChevronDownIcon,
|
|
8
|
+
ChevronUpIcon,
|
|
9
|
+
CircleQuestionMarkIcon,
|
|
10
|
+
GemIcon,
|
|
11
|
+
Settings2Icon,
|
|
12
|
+
ShoppingCartIcon,
|
|
13
|
+
} from '@windrun-huaiin/base-ui/icons';
|
|
6
14
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
15
|
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
8
16
|
import { redirectToCustomerPortal } from '../money-price/customer-portal';
|
|
@@ -369,7 +377,7 @@ export function CreditOverviewClient({
|
|
|
369
377
|
<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">
|
|
370
378
|
<div className="flex flex-col gap-2 sm:gap-3">
|
|
371
379
|
<div className="flex items-center justify-start rounded-full ">
|
|
372
|
-
<
|
|
380
|
+
<GemIcon aria-hidden className="mr-2 h-6 w-6 sm:h-8 sm:w-8" />
|
|
373
381
|
<span className="text-base sm:text-lg">{translations.totalLabel}</span>
|
|
374
382
|
</div>
|
|
375
383
|
<div className="flex justify-center text-3xl font-semibold leading-tight sm:text-4xl">
|
|
@@ -387,7 +395,7 @@ export function CreditOverviewClient({
|
|
|
387
395
|
<GradientButton
|
|
388
396
|
title={subscription ? translations.subscriptionManage : translations.subscribePay}
|
|
389
397
|
align="center"
|
|
390
|
-
icon={subscription ? <
|
|
398
|
+
icon={subscription ? <Settings2Icon /> : <BellIcon />}
|
|
391
399
|
openInNewTab={false}
|
|
392
400
|
className="w-full"
|
|
393
401
|
onClick={subscription ? handleManageAction : handleSubscribeAction}
|
|
@@ -417,9 +425,9 @@ export function CreditOverviewClient({
|
|
|
417
425
|
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)]"
|
|
418
426
|
>
|
|
419
427
|
{bucketExpanded ? (
|
|
420
|
-
<
|
|
428
|
+
<ChevronUpIcon className="h-4 w-4" />
|
|
421
429
|
) : (
|
|
422
|
-
<
|
|
430
|
+
<ChevronDownIcon className="h-4 w-4" />
|
|
423
431
|
)}
|
|
424
432
|
</button>
|
|
425
433
|
) : null}
|
|
@@ -476,7 +484,7 @@ export function CreditOverviewClient({
|
|
|
476
484
|
)}
|
|
477
485
|
<GradientButton
|
|
478
486
|
title={translations.onetimeBuy}
|
|
479
|
-
icon={<
|
|
487
|
+
icon={<ShoppingCartIcon />}
|
|
480
488
|
align="center"
|
|
481
489
|
className="w-full text-sm sm:text-base"
|
|
482
490
|
onClick={handleOnetimeAction}
|
|
@@ -537,7 +545,7 @@ function HoverInfo({ description, variant = 'default' }: HoverInfoProps) {
|
|
|
537
545
|
: '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)]',
|
|
538
546
|
)}
|
|
539
547
|
>
|
|
540
|
-
<
|
|
548
|
+
<CircleQuestionMarkIcon className="h-3.5 w-3.5" />
|
|
541
549
|
</button>
|
|
542
550
|
<span
|
|
543
551
|
role="tooltip"
|
package/src/main/features.tsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { getTranslations } from 'next-intl/server';
|
|
2
2
|
import { getGlobalIcon } from '@windrun-huaiin/base-ui/components/server';
|
|
3
|
-
import { globalLucideIcons
|
|
3
|
+
import type { globalLucideIcons } from '@windrun-huaiin/base-ui/icons';
|
|
4
4
|
import { themeIconColor } from '@windrun-huaiin/base-ui/lib';
|
|
5
5
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
6
6
|
import { richText } from './rich-text-expert';
|
|
7
7
|
import { responsiveSection } from './section-layout';
|
|
8
8
|
|
|
9
|
+
type GlobalIconKey = Extract<keyof typeof globalLucideIcons, string>;
|
|
10
|
+
|
|
9
11
|
interface FeaturesData {
|
|
10
12
|
title: string;
|
|
11
13
|
eyesOn: string;
|
|
@@ -14,7 +16,7 @@ interface FeaturesData {
|
|
|
14
16
|
id: string;
|
|
15
17
|
title: string;
|
|
16
18
|
description: string;
|
|
17
|
-
iconKey:
|
|
19
|
+
iconKey: GlobalIconKey;
|
|
18
20
|
}>;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -31,7 +33,7 @@ export async function Features({
|
|
|
31
33
|
const featureItems = t.raw('items') as Array<{
|
|
32
34
|
title: string;
|
|
33
35
|
description: string;
|
|
34
|
-
iconKey:
|
|
36
|
+
iconKey: GlobalIconKey;
|
|
35
37
|
}>;
|
|
36
38
|
|
|
37
39
|
const data: FeaturesData = {
|
package/src/main/footer.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTranslations } from 'next-intl/server';
|
|
2
|
-
import {
|
|
2
|
+
import { MailIcon, ReceiptTextIcon, ShieldUserIcon } from '@windrun-huaiin/base-ui/icons';
|
|
3
3
|
import Link from "next/link";
|
|
4
4
|
import { FooterEmail } from './footer-email';
|
|
5
5
|
import { safeT } from '../lib/t-intl';
|
|
@@ -47,15 +47,15 @@ export async function Footer({ locale, localePrefixAsNeeded = true, defaultLocal
|
|
|
47
47
|
<div className="w-full flex flex-col items-center justify-center px-4 py-8 space-y-3">
|
|
48
48
|
<div className="flex flex-wrap items-center justify-center gap-x-2 gap-y-2 text-xs sm:text-sm sm:gap-x-6">
|
|
49
49
|
<Link href={getAsNeededLocalizedUrl(locale, "/legal/terms", localePrefixAsNeeded, defaultLocale)} className="flex items-center space-x-1 hover:underline">
|
|
50
|
-
<
|
|
50
|
+
<ReceiptTextIcon className="h-3.5 w-3.5"/>
|
|
51
51
|
<span>{data.terms}</span>
|
|
52
52
|
</Link>
|
|
53
53
|
<Link href={getAsNeededLocalizedUrl(locale, "/legal/privacy", localePrefixAsNeeded, defaultLocale)} className="flex items-center space-x-1 hover:underline">
|
|
54
|
-
<
|
|
54
|
+
<ShieldUserIcon className="h-3.5 w-3.5"/>
|
|
55
55
|
<span>{data.privacy}</span>
|
|
56
56
|
</Link>
|
|
57
57
|
<FooterEmail email={data.email} clickToCopyText={data.clickToCopyText} copiedText={data.copiedText}>
|
|
58
|
-
<
|
|
58
|
+
<MailIcon className="h-3.5 w-3.5"/>
|
|
59
59
|
<span>{data.contactUs}</span>
|
|
60
60
|
</FooterEmail>
|
|
61
61
|
</div>
|
|
@@ -67,4 +67,3 @@ export async function Footer({ locale, localePrefixAsNeeded = true, defaultLocal
|
|
|
67
67
|
</div>
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
|
package/src/main/go-to-top.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
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
|
export function GoToTop() {
|
|
@@ -37,7 +37,7 @@ export function GoToTop() {
|
|
|
37
37
|
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`}
|
|
38
38
|
aria-label="Go to top"
|
|
39
39
|
>
|
|
40
|
-
<
|
|
40
|
+
<ArrowUpIcon size={20} className="text-white" />
|
|
41
41
|
</button>
|
|
42
42
|
)}
|
|
43
43
|
</>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { DelayedImg } from "./delayed-img";
|
|
4
|
+
import { cn } from '@windrun-huaiin/lib/utils';
|
|
5
|
+
|
|
6
|
+
interface HeroMediaProps {
|
|
7
|
+
src: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
sizes?: string;
|
|
12
|
+
maxWidthClassName?: string;
|
|
13
|
+
wrapperClassName?: string;
|
|
14
|
+
imageClassName?: string;
|
|
15
|
+
placeholderClassName?: string;
|
|
16
|
+
preload?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function HeroMedia({
|
|
20
|
+
src,
|
|
21
|
+
alt,
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
sizes = "(max-width: 768px) 90vw, (max-width: 1200px) 45vw, 35vw",
|
|
25
|
+
maxWidthClassName = "max-w-[500px]",
|
|
26
|
+
wrapperClassName,
|
|
27
|
+
imageClassName,
|
|
28
|
+
placeholderClassName,
|
|
29
|
+
preload = true,
|
|
30
|
+
}: HeroMediaProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn("w-full", maxWidthClassName)}>
|
|
33
|
+
<div
|
|
34
|
+
className={cn(
|
|
35
|
+
"group relative overflow-hidden rounded-lg shadow-purple-500/20",
|
|
36
|
+
wrapperClassName,
|
|
37
|
+
)}
|
|
38
|
+
style={{ aspectRatio: `${width} / ${height}` }}
|
|
39
|
+
>
|
|
40
|
+
<DelayedImg
|
|
41
|
+
src={src}
|
|
42
|
+
alt={alt}
|
|
43
|
+
fill
|
|
44
|
+
preload={preload}
|
|
45
|
+
sizes={sizes}
|
|
46
|
+
className={cn("rounded-lg object-cover group-hover:scale-105", imageClassName)}
|
|
47
|
+
wrapperClassName="h-full w-full"
|
|
48
|
+
placeholderClassName={cn("rounded-lg", placeholderClassName)}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { cn } from '@windrun-huaiin/lib/utils';
|
|
5
|
+
|
|
6
|
+
interface HeroSectionProps {
|
|
7
|
+
content: ReactNode;
|
|
8
|
+
media: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
mediaClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function HeroSection({
|
|
15
|
+
content,
|
|
16
|
+
media,
|
|
17
|
+
className,
|
|
18
|
+
contentClassName,
|
|
19
|
+
mediaClassName,
|
|
20
|
+
}: HeroSectionProps) {
|
|
21
|
+
return (
|
|
22
|
+
<section
|
|
23
|
+
className={cn(
|
|
24
|
+
"mx-auto mt-12 flex max-w-6xl flex-col gap-10 px-6 py-8 md:min-w-[calc(100vw-22rem)] md:px-4 md:flex-row md:items-center md:gap-12",
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
>
|
|
28
|
+
<div className={cn("flex-1 space-y-6", contentClassName)}>
|
|
29
|
+
{content}
|
|
30
|
+
</div>
|
|
31
|
+
<div className={cn("relative flex flex-1 justify-center md:justify-end", mediaClassName)}>
|
|
32
|
+
{media}
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
35
|
+
);
|
|
36
|
+
}
|
package/src/main/index.ts
CHANGED
|
@@ -21,3 +21,8 @@ export { MoneyPriceButton } from './money-price/money-price-button';
|
|
|
21
21
|
|
|
22
22
|
export { CreditOverviewClient } from './credit/credit-overview-client';
|
|
23
23
|
export { CreditNavButton } from './credit/credit-nav-button';
|
|
24
|
+
|
|
25
|
+
export { HeroMedia } from './hero-media';
|
|
26
|
+
export { HeroSection } from './hero-section';
|
|
27
|
+
|
|
28
|
+
export { InfoTooltip } from './info-tooltip';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { CircleQuestionMarkIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
|
+
import { themeBorderColor, themeIconColor, themeRingColor } from '@windrun-huaiin/base-ui/lib';
|
|
6
|
+
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
|
+
|
|
8
|
+
type InfoTooltipProps = {
|
|
9
|
+
content: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
align?: 'start' | 'end';
|
|
12
|
+
desktopSide?: 'right' | 'bottom';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function InfoTooltip({
|
|
16
|
+
content,
|
|
17
|
+
className,
|
|
18
|
+
align = 'end',
|
|
19
|
+
desktopSide = 'right',
|
|
20
|
+
}: InfoTooltipProps) {
|
|
21
|
+
const normalizedContent = content.trim();
|
|
22
|
+
const containerRef = useRef<HTMLSpanElement | null>(null);
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
function handlePointerDown(event: MouseEvent | TouchEvent) {
|
|
27
|
+
if (!containerRef.current) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const target = event.target;
|
|
32
|
+
if (target instanceof Node && !containerRef.current.contains(target)) {
|
|
33
|
+
setOpen(false);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
document.addEventListener('mousedown', handlePointerDown);
|
|
38
|
+
document.addEventListener('touchstart', handlePointerDown);
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
document.removeEventListener('mousedown', handlePointerDown);
|
|
42
|
+
document.removeEventListener('touchstart', handlePointerDown);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
if (!normalizedContent) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<span
|
|
52
|
+
ref={containerRef}
|
|
53
|
+
className={cn('relative inline-flex h-5 w-5 shrink-0 align-middle', className)}
|
|
54
|
+
onMouseLeave={() => setOpen(false)}
|
|
55
|
+
>
|
|
56
|
+
<button
|
|
57
|
+
type="button"
|
|
58
|
+
onMouseEnter={() => setOpen(true)}
|
|
59
|
+
onPointerDown={(event) => {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
}}
|
|
62
|
+
onClick={(event) => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
setOpen((value) => !value);
|
|
65
|
+
}}
|
|
66
|
+
className={cn(
|
|
67
|
+
'inline-flex h-5 w-5 items-center justify-center rounded-full text-slate-400 transition',
|
|
68
|
+
'hover:bg-black/5 hover:dark:bg-white/5',
|
|
69
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-slate-950',
|
|
70
|
+
'hover:text-slate-700 dark:hover:text-white focus-visible:text-slate-700 dark:focus-visible:text-white',
|
|
71
|
+
themeIconColor,
|
|
72
|
+
themeRingColor,
|
|
73
|
+
)}
|
|
74
|
+
aria-label={normalizedContent}
|
|
75
|
+
aria-expanded={open}
|
|
76
|
+
>
|
|
77
|
+
<CircleQuestionMarkIcon className="h-4 w-4" />
|
|
78
|
+
</button>
|
|
79
|
+
<span
|
|
80
|
+
className={cn(
|
|
81
|
+
'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',
|
|
82
|
+
align === 'start' ? 'left-0 right-auto' : 'right-0 left-auto',
|
|
83
|
+
desktopSide === 'right'
|
|
84
|
+
? align === 'start'
|
|
85
|
+
? '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'
|
|
86
|
+
: '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'
|
|
87
|
+
: align === 'start'
|
|
88
|
+
? 'md:left-0 md:right-auto md:top-full md:mt-2 md:ml-0 md:translate-y-0'
|
|
89
|
+
: 'md:right-0 md:left-auto md:top-full md:mt-2 md:ml-0 md:translate-y-0',
|
|
90
|
+
open ? 'block' : 'hidden',
|
|
91
|
+
themeBorderColor,
|
|
92
|
+
)}
|
|
93
|
+
role="tooltip"
|
|
94
|
+
>
|
|
95
|
+
{normalizedContent}
|
|
96
|
+
</span>
|
|
97
|
+
</span>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* MIT License
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 D8ger
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
'use client'
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { XIcon } from "@windrun-huaiin/base-ui/icons"
|
|
12
12
|
import { useLocale, useTranslations } from 'next-intl'
|
|
13
13
|
import { useRouter } from 'next/navigation'
|
|
14
14
|
import { useEffect, useState } from 'react'
|
|
@@ -149,7 +149,7 @@ export function LanguageDetector({ i18nConfig }: LanguageDetectorProps) {
|
|
|
149
149
|
onClick={handleClose}
|
|
150
150
|
className="text-gray-500 hover:text-gray-700"
|
|
151
151
|
>
|
|
152
|
-
<
|
|
152
|
+
<XIcon className="h-5 w-5" />
|
|
153
153
|
</button>
|
|
154
154
|
</div>
|
|
155
155
|
<div className="flex items-center gap-3">
|
|
@@ -172,4 +172,4 @@ export function LanguageDetector({ i18nConfig }: LanguageDetectorProps) {
|
|
|
172
172
|
</div>
|
|
173
173
|
</div>
|
|
174
174
|
)
|
|
175
|
-
}
|
|
175
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronDownIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
5
|
import { themeBgColor, themeBorderColor, themeIconColor } from '@windrun-huaiin/base-ui/lib';
|
|
6
6
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
7
|
|
|
@@ -285,7 +285,7 @@ export function XPillSelect(props: XPillSelectProps) {
|
|
|
285
285
|
</span>
|
|
286
286
|
)}
|
|
287
287
|
</div>
|
|
288
|
-
<
|
|
288
|
+
<ChevronDownIcon
|
|
289
289
|
className={cn(
|
|
290
290
|
compact ? 'h-3.5 w-3.5' : 'h-4 w-4',
|
|
291
291
|
'shrink-0 text-slate-500 transition-transform dark:text-slate-400',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { XIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
5
|
import { themeBgColor, themeBorderColor, themeIconColor, themeRingColor } from '@windrun-huaiin/base-ui/lib';
|
|
6
6
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
7
|
|
|
@@ -118,7 +118,7 @@ export function XTokenInput({
|
|
|
118
118
|
disabled && 'cursor-not-allowed'
|
|
119
119
|
)}
|
|
120
120
|
>
|
|
121
|
-
<
|
|
121
|
+
<XIcon className={cn(compact ? 'h-2 w-2' : 'h-2.5 w-2.5')} />
|
|
122
122
|
</button>
|
|
123
123
|
</span>
|
|
124
124
|
</li>
|
package/src/main/x-button.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import React, { useState, useRef, useEffect, ReactNode } from 'react'
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronDownIcon, Loader2Icon } from '@windrun-huaiin/base-ui/icons'
|
|
5
5
|
import { themeBgColor, themeBorderColor, themeIconColor, themeMainBgColor } from '@windrun-huaiin/base-ui/lib'
|
|
6
6
|
import { cn } from '@windrun-huaiin/lib/utils'
|
|
7
7
|
|
|
@@ -175,7 +175,7 @@ export function XButton(props: xButtonProps) {
|
|
|
175
175
|
>
|
|
176
176
|
{isLoading ? (
|
|
177
177
|
<>
|
|
178
|
-
<
|
|
178
|
+
<Loader2Icon className={loadingIconClass} />
|
|
179
179
|
<span>{actualLoadingText}</span>
|
|
180
180
|
</>
|
|
181
181
|
) : (
|
|
@@ -221,7 +221,7 @@ export function XButton(props: xButtonProps) {
|
|
|
221
221
|
>
|
|
222
222
|
{isLoading ? (
|
|
223
223
|
<>
|
|
224
|
-
<
|
|
224
|
+
<Loader2Icon className={loadingIconClass} />
|
|
225
225
|
<span>{actualLoadingText}</span>
|
|
226
226
|
</>
|
|
227
227
|
) : (
|
|
@@ -244,7 +244,7 @@ export function XButton(props: xButtonProps) {
|
|
|
244
244
|
aria-label="More actions"
|
|
245
245
|
aria-expanded={menuOpen}
|
|
246
246
|
>
|
|
247
|
-
<
|
|
247
|
+
<ChevronDownIcon className={chevronIconClass} />
|
|
248
248
|
</button>
|
|
249
249
|
|
|
250
250
|
{/* dropdown menu */}
|