@aloudata/aloudata-design 3.0.6 → 3.0.7
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/dist/TextLink/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SizeType } from '../ConfigProvider/sizeContext';
|
|
3
3
|
type TextLinkType = 'primary' | 'secondary';
|
|
4
|
-
interface TextLinkProps {
|
|
4
|
+
interface TextLinkProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'type'> {
|
|
5
5
|
className?: string;
|
|
6
6
|
/**
|
|
7
7
|
* @description 类型
|
|
@@ -30,10 +30,6 @@ interface TextLinkProps {
|
|
|
30
30
|
* @description 设置按钮的图标组件
|
|
31
31
|
*/
|
|
32
32
|
icon?: React.ReactNode;
|
|
33
|
-
/**
|
|
34
|
-
* @description 点击按钮时的回调
|
|
35
|
-
*/
|
|
36
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
37
33
|
/**
|
|
38
34
|
* @description 链接地址
|
|
39
35
|
*/
|
|
@@ -42,11 +38,6 @@ interface TextLinkProps {
|
|
|
42
38
|
* @description 链接打开方式
|
|
43
39
|
*/
|
|
44
40
|
target?: string;
|
|
45
|
-
/**
|
|
46
|
-
* @description 设置按钮进入载入状态
|
|
47
|
-
* @default false
|
|
48
|
-
*/
|
|
49
|
-
children?: React.ReactNode;
|
|
50
41
|
}
|
|
51
|
-
declare
|
|
42
|
+
declare const TextLink: React.ForwardRefExoticComponent<TextLinkProps & React.RefAttributes<HTMLSpanElement>>;
|
|
52
43
|
export default TextLink;
|
package/dist/TextLink/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
|
-
import "react";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
//#region src/TextLink/index.tsx
|
|
@@ -30,21 +30,23 @@ var textLinkVariants = cva("ald-text-link tw-inline-flex tw-cursor-pointer tw-it
|
|
|
30
30
|
underline: false
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
const { size: propsSize, type = "primary", underline, disabled, icon: propsIcon = null, children,
|
|
33
|
+
var TextLink = React.forwardRef((props, ref) => {
|
|
34
|
+
const { size: propsSize, type = "primary", underline, disabled, icon: propsIcon = null, children, className, ...restProps } = props;
|
|
35
35
|
const size = propsSize || "middle";
|
|
36
36
|
const icon = underline ? null : propsIcon;
|
|
37
37
|
return /* @__PURE__ */ jsxs("span", {
|
|
38
|
+
ref,
|
|
38
39
|
className: cn(textLinkVariants({
|
|
39
40
|
size,
|
|
40
41
|
type,
|
|
41
42
|
disabled: !!disabled,
|
|
42
43
|
underline: !!underline
|
|
43
44
|
}), className),
|
|
44
|
-
|
|
45
|
+
...restProps,
|
|
45
46
|
children: [icon, children]
|
|
46
47
|
});
|
|
47
|
-
}
|
|
48
|
+
});
|
|
49
|
+
TextLink.displayName = "TextLink";
|
|
48
50
|
//#endregion
|
|
49
51
|
export { TextLink as default };
|
|
50
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/TextLink/index.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport React from 'react';\nimport { SizeType } from '../ConfigProvider/sizeContext';\nimport { cn } from '../lib/utils';\n\ntype TextLinkType = 'primary' | 'secondary';\ninterface TextLinkProps {\n className?: string;\n /**\n * @description 类型\n * @type 'primary' | 'secondary'\n * @default primary\n */\n type?: TextLinkType;\n /**\n * @description 显示下划线\n * @type boolean\n * @default false\n */\n underline?: boolean;\n /**\n * @description 尺寸\n * @type 'small' | 'middle' | 'large'| undefined\n * @default large\n */\n size?: SizeType;\n /**\n * @description 是否禁用\n * @default false\n */\n disabled?: boolean;\n /**\n * @description 设置按钮的图标组件\n */\n icon?: React.ReactNode;\n /**\n * @description
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/TextLink/index.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport React from 'react';\nimport { SizeType } from '../ConfigProvider/sizeContext';\nimport { cn } from '../lib/utils';\n\ntype TextLinkType = 'primary' | 'secondary';\ninterface TextLinkProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'type'> {\n className?: string;\n /**\n * @description 类型\n * @type 'primary' | 'secondary'\n * @default primary\n */\n type?: TextLinkType;\n /**\n * @description 显示下划线\n * @type boolean\n * @default false\n */\n underline?: boolean;\n /**\n * @description 尺寸\n * @type 'small' | 'middle' | 'large'| undefined\n * @default large\n */\n size?: SizeType;\n /**\n * @description 是否禁用\n * @default false\n */\n disabled?: boolean;\n /**\n * @description 设置按钮的图标组件\n */\n icon?: React.ReactNode;\n /**\n * @description 链接地址\n */\n href?: string;\n /**\n * @description 链接打开方式\n */\n target?: string;\n}\n\nconst textLinkVariants = cva(\n 'ald-text-link tw-inline-flex tw-cursor-pointer tw-items-center tw-gap-1',\n {\n variants: {\n size: {\n small: 'ald-text-link-small tw-text-xs tw-leading-4',\n middle: 'ald-text-link-middle tw-text-sm tw-leading-5',\n large: 'ald-text-link-large tw-text-base tw-leading-6',\n },\n type: {\n primary:\n 'ald-text-link-primary tw-text-[var(--alias-colors-link-default)] hover:tw-text-[var(--alias-colors-link-hover)]',\n secondary:\n 'ald-text-link-secondary tw-text-[var(--alias-colors-text-default)] hover:tw-text-[var(--alias-colors-text-selected)]',\n },\n disabled: {\n true: 'ald-text-link-disabled tw-pointer-events-none tw-cursor-default tw-opacity-50',\n false: '',\n },\n underline: {\n true: 'ald-text-link-show-underline tw-font-normal hover:tw-underline active:tw-underline',\n false: 'tw-font-medium',\n },\n },\n defaultVariants: {\n size: 'middle',\n type: 'primary',\n disabled: false,\n underline: false,\n },\n },\n);\n\nconst TextLink = React.forwardRef<HTMLSpanElement, TextLinkProps>(\n (props, ref) => {\n const {\n size: propsSize,\n type = 'primary',\n underline,\n disabled,\n icon: propsIcon = null,\n children,\n className,\n ...restProps\n } = props;\n const size = propsSize || 'middle';\n const icon = underline ? null : propsIcon;\n return (\n <span\n ref={ref}\n className={cn(\n textLinkVariants({\n size,\n type,\n disabled: !!disabled,\n underline: !!underline,\n }),\n className,\n )}\n {...restProps}\n >\n {icon}\n {children}\n </span>\n );\n },\n);\n\nTextLink.displayName = 'TextLink';\n\nexport default TextLink;\n"],"mappings":";;;;;AA8CA,IAAM,mBAAmB,IACvB,2EACA;CACE,UAAU;EACR,MAAM;GACJ,OAAO;GACP,QAAQ;GACR,OAAO;GACR;EACD,MAAM;GACJ,SACE;GACF,WACE;GACH;EACD,UAAU;GACR,MAAM;GACN,OAAO;GACR;EACD,WAAW;GACT,MAAM;GACN,OAAO;GACR;EACF;CACD,iBAAiB;EACf,MAAM;EACN,MAAM;EACN,UAAU;EACV,WAAW;EACZ;CACF,CACF;AAED,IAAM,WAAW,MAAM,YACpB,OAAO,QAAQ;CACd,MAAM,EACJ,MAAM,WACN,OAAO,WACP,WACA,UACA,MAAM,YAAY,MAClB,UACA,WACA,GAAG,cACD;CACJ,MAAM,OAAO,aAAa;CAC1B,MAAM,OAAO,YAAY,OAAO;AAChC,QACE,qBAAC,QAAD;EACO;EACL,WAAW,GACT,iBAAiB;GACf;GACA;GACA,UAAU,CAAC,CAAC;GACZ,WAAW,CAAC,CAAC;GACd,CAAC,EACF,UACD;EACD,GAAI;YAXN,CAaG,MACA,SACI;;EAGZ;AAED,SAAS,cAAc"}
|