@windrun-huaiin/third-ui 14.0.2 → 14.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,8 +8,9 @@ export interface GradientButtonProps {
|
|
|
8
8
|
iconClassName?: string;
|
|
9
9
|
href?: string;
|
|
10
10
|
openInNewTab?: boolean;
|
|
11
|
+
preserveReferrer?: boolean;
|
|
11
12
|
onClick?: () => void | Promise<void>;
|
|
12
13
|
loadingText?: React.ReactNode;
|
|
13
14
|
preventDoubleClick?: boolean;
|
|
14
15
|
}
|
|
15
|
-
export declare function GradientButton({ title, icon, align, disabled, className, href, openInNewTab, onClick, loadingText, preventDoubleClick, iconClassName, }: GradientButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function GradientButton({ title, icon, align, disabled, className, href, openInNewTab, preserveReferrer, onClick, loadingText, preventDoubleClick, iconClassName, }: GradientButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ var lib = require('@windrun-huaiin/base-ui/lib');
|
|
|
9
9
|
var Link = require('next/link');
|
|
10
10
|
var React = require('react');
|
|
11
11
|
|
|
12
|
-
function GradientButton({ title, icon, align = 'left', disabled = false, className = "", href, openInNewTab = true, onClick, loadingText, preventDoubleClick = true, iconClassName, }) {
|
|
12
|
+
function GradientButton({ title, icon, align = 'left', disabled = false, className = "", href, openInNewTab = true, preserveReferrer = false, onClick, loadingText, preventDoubleClick = true, iconClassName, }) {
|
|
13
13
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
14
14
|
const actualLoadingText = loadingText || (title === null || title === void 0 ? void 0 : title.toString().trim()) || 'Loading...';
|
|
15
15
|
const defaultIconClass = "h-4 w-4";
|
|
@@ -84,7 +84,7 @@ function GradientButton({ title, icon, align = 'left', disabled = false, classNa
|
|
|
84
84
|
// for click
|
|
85
85
|
jsxRuntime.jsx("button", { type: "button", className: buttonClassName, onClick: handleClick, disabled: isDisabled, children: buttonContent })) : (
|
|
86
86
|
// for Link
|
|
87
|
-
jsxRuntime.jsx(Link, Object.assign({ href: href || "#", className: utils.cn(buttonClassName, "no-underline hover:no-underline") }, (openInNewTab ? { target: "_blank", rel:
|
|
87
|
+
jsxRuntime.jsx(Link, Object.assign({ href: href || "#", className: utils.cn(buttonClassName, "no-underline hover:no-underline") }, (openInNewTab ? { target: "_blank", rel: preserveReferrer ? 'noopener' : 'noopener noreferrer' } : {}), { onClick: isDisabled ? (e) => e.preventDefault() : undefined, "aria-disabled": isDisabled, children: buttonContent }))) }));
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
exports.GradientButton = GradientButton;
|
|
@@ -7,7 +7,7 @@ import { themeButtonGradientClass, themeButtonGradientHoverClass } from '@windru
|
|
|
7
7
|
import Link from 'next/link';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
|
-
function GradientButton({ title, icon, align = 'left', disabled = false, className = "", href, openInNewTab = true, onClick, loadingText, preventDoubleClick = true, iconClassName, }) {
|
|
10
|
+
function GradientButton({ title, icon, align = 'left', disabled = false, className = "", href, openInNewTab = true, preserveReferrer = false, onClick, loadingText, preventDoubleClick = true, iconClassName, }) {
|
|
11
11
|
const [isLoading, setIsLoading] = useState(false);
|
|
12
12
|
const actualLoadingText = loadingText || (title === null || title === void 0 ? void 0 : title.toString().trim()) || 'Loading...';
|
|
13
13
|
const defaultIconClass = "h-4 w-4";
|
|
@@ -82,7 +82,7 @@ function GradientButton({ title, icon, align = 'left', disabled = false, classNa
|
|
|
82
82
|
// for click
|
|
83
83
|
jsx("button", { type: "button", className: buttonClassName, onClick: handleClick, disabled: isDisabled, children: buttonContent })) : (
|
|
84
84
|
// for Link
|
|
85
|
-
jsx(Link, Object.assign({ href: href || "#", className: cn(buttonClassName, "no-underline hover:no-underline") }, (openInNewTab ? { target: "_blank", rel:
|
|
85
|
+
jsx(Link, Object.assign({ href: href || "#", className: cn(buttonClassName, "no-underline hover:no-underline") }, (openInNewTab ? { target: "_blank", rel: preserveReferrer ? 'noopener' : 'noopener noreferrer' } : {}), { onClick: isDisabled ? (e) => e.preventDefault() : undefined, "aria-disabled": isDisabled, children: buttonContent }))) }));
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export { GradientButton };
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ export interface GradientButtonProps {
|
|
|
16
16
|
// for Link
|
|
17
17
|
href?: string;
|
|
18
18
|
openInNewTab?: boolean;
|
|
19
|
+
preserveReferrer?: boolean;
|
|
19
20
|
|
|
20
21
|
// for click
|
|
21
22
|
onClick?: () => void | Promise<void>;
|
|
@@ -31,6 +32,7 @@ export function GradientButton({
|
|
|
31
32
|
className = "",
|
|
32
33
|
href,
|
|
33
34
|
openInNewTab = true,
|
|
35
|
+
preserveReferrer = false,
|
|
34
36
|
onClick,
|
|
35
37
|
loadingText,
|
|
36
38
|
preventDoubleClick = true,
|
|
@@ -157,7 +159,7 @@ export function GradientButton({
|
|
|
157
159
|
<Link
|
|
158
160
|
href={href || "#"}
|
|
159
161
|
className={cn(buttonClassName, "no-underline hover:no-underline")}
|
|
160
|
-
{...(openInNewTab ? { target: "_blank", rel:
|
|
162
|
+
{...(openInNewTab ? { target: "_blank", rel: preserveReferrer ? 'noopener' : 'noopener noreferrer' } : {})}
|
|
161
163
|
onClick={isDisabled ? (e) => e.preventDefault() : undefined}
|
|
162
164
|
aria-disabled={isDisabled}
|
|
163
165
|
>
|