@sia.soul/sia-react-ui 0.1.164 → 0.1.166
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/{chunk-WR5YBY2A.js → chunk-T2F6X3LA.js} +31 -21
- package/dist/{core-r-smfiNN.d.cts → core-Cnt8r6pj.d.cts} +5 -3
- package/dist/{core-XtqUDbbD.d.ts → core-Dy8NWJ1b.d.ts} +5 -3
- package/dist/core.cjs +210 -200
- package/dist/core.css +3 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +552 -554
- package/dist/index.css +3 -0
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -27
- package/package.json +1 -1
|
@@ -196,7 +196,15 @@ function Card({
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
// src/components/Tag.tsx
|
|
199
|
+
import { Children, Fragment as Fragment2, isValidElement } from "react";
|
|
199
200
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
201
|
+
function hasTagContent(content) {
|
|
202
|
+
return Children.toArray(content).some((node) => {
|
|
203
|
+
if (typeof node === "string") return node.trim().length > 0;
|
|
204
|
+
if (isValidElement(node) && node.type === Fragment2) return hasTagContent(node.props.children);
|
|
205
|
+
return true;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
200
208
|
function Tag({
|
|
201
209
|
size: sizeProp,
|
|
202
210
|
color,
|
|
@@ -214,6 +222,8 @@ function Tag({
|
|
|
214
222
|
...props
|
|
215
223
|
}) {
|
|
216
224
|
const size = useControlSize(sizeProp ?? (compact ? "small" : void 0));
|
|
225
|
+
const hasIcon = hasTagContent(icon);
|
|
226
|
+
if (!hasTagContent(children) && !hasIcon) return null;
|
|
217
227
|
const customColor = color?.trim() ? variant === "outlined" ? { borderColor: color, color, backgroundColor: "transparent" } : variant === "filled" ? { backgroundColor: color, color: "#fff", borderColor: "transparent" } : { color, backgroundColor: `color-mix(in srgb, ${color} 10%, transparent)`, borderColor: `color-mix(in srgb, ${color} 35%, transparent)` } : void 0;
|
|
218
228
|
return /* @__PURE__ */ jsxs3(
|
|
219
229
|
"span",
|
|
@@ -223,7 +233,7 @@ function Tag({
|
|
|
223
233
|
style: customColor ? { ...customColor, ...style } : style,
|
|
224
234
|
...withTitleTooltip(props),
|
|
225
235
|
children: [
|
|
226
|
-
|
|
236
|
+
hasIcon ? /* @__PURE__ */ jsx3("span", { className: "sia-tag__icon", children: icon }) : null,
|
|
227
237
|
/* @__PURE__ */ jsx3("span", { children }),
|
|
228
238
|
closable ? /* @__PURE__ */ jsx3(
|
|
229
239
|
"button",
|
|
@@ -563,7 +573,7 @@ function Tabs({
|
|
|
563
573
|
import { cloneElement, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
564
574
|
import { createPortal } from "react-dom";
|
|
565
575
|
import { createRoot } from "react-dom/client";
|
|
566
|
-
import { Fragment as
|
|
576
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
567
577
|
function Popconfirm({
|
|
568
578
|
children,
|
|
569
579
|
title,
|
|
@@ -690,7 +700,7 @@ function Progress({
|
|
|
690
700
|
}
|
|
691
701
|
const height = Array.isArray(size) ? size[1] : typeof size === "number" ? size : size === "small" ? 6 : strokeWidth;
|
|
692
702
|
return /* @__PURE__ */ jsxs5("div", { className: `sia-progress sia-progress--line sia-progress--${resolved} ${className}`.trim(), style, ...withTitleTooltip(props), children: [
|
|
693
|
-
/* @__PURE__ */ jsx5("div", { className: "sia-progress__outer", style: { height, backgroundColor: trailColor }, children: steps ? /* @__PURE__ */ jsx5("div", { className: "sia-progress__steps", children: Array.from({ length: steps }, (_, index) => /* @__PURE__ */ jsx5("span", { className: index < Math.round(steps * safe / 100) ? "is-active" : "", style: { background: index < Math.round(steps * safe / 100) ? background : trailColor } }, index)) }) : /* @__PURE__ */ jsxs5(
|
|
703
|
+
/* @__PURE__ */ jsx5("div", { className: "sia-progress__outer", style: { height, backgroundColor: trailColor }, children: steps ? /* @__PURE__ */ jsx5("div", { className: "sia-progress__steps", children: Array.from({ length: steps }, (_, index) => /* @__PURE__ */ jsx5("span", { className: index < Math.round(steps * safe / 100) ? "is-active" : "", style: { background: index < Math.round(steps * safe / 100) ? background : trailColor } }, index)) }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
694
704
|
/* @__PURE__ */ jsx5("span", { className: "sia-progress__bar", style: { width: `${safe}%`, background } }),
|
|
695
705
|
success?.percent ? /* @__PURE__ */ jsx5("span", { className: "sia-progress__success", style: { width: `${success.percent}%`, background: success.strokeColor } }) : null
|
|
696
706
|
] }) }),
|
|
@@ -790,7 +800,7 @@ function NotificationHost() {
|
|
|
790
800
|
};
|
|
791
801
|
}, []);
|
|
792
802
|
const placements = ["topLeft", "topRight", "bottomLeft", "bottomRight"];
|
|
793
|
-
return /* @__PURE__ */ jsx5(
|
|
803
|
+
return /* @__PURE__ */ jsx5(Fragment3, { children: placements.map((placement) => /* @__PURE__ */ jsx5("div", { className: `sia-notification sia-notification--${placement}`, children: entries.filter((item) => (item.placement ?? "topRight") === placement).map((item) => /* @__PURE__ */ jsx5(NotificationNotice, { item }, item.key)) }, placement)) });
|
|
794
804
|
}
|
|
795
805
|
function ensureNotificationHost() {
|
|
796
806
|
if (typeof document === "undefined" || notificationHost) return;
|
|
@@ -878,9 +888,9 @@ function Tour({ open = false, steps, current, defaultCurrent = 0, mask = true, c
|
|
|
878
888
|
}
|
|
879
889
|
|
|
880
890
|
// src/components/DataDisplay.tsx
|
|
881
|
-
import { Children, createContext, useContext, useEffect as useEffect3, useId as useId2, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
891
|
+
import { Children as Children2, createContext, useContext, useEffect as useEffect3, useId as useId2, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
882
892
|
import { createPortal as createPortal2 } from "react-dom";
|
|
883
|
-
import { Fragment as
|
|
893
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
884
894
|
function Rate({ value, size: sizeProp, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
|
|
885
895
|
const size = useControlSize(sizeProp);
|
|
886
896
|
const [current, setCurrent] = useControllableState({ value, defaultValue, onChange });
|
|
@@ -981,7 +991,7 @@ function Calendar({ value, defaultValue, mode = "month", fullscreen = true, vali
|
|
|
981
991
|
}
|
|
982
992
|
const headerConfig = { value: formatDate(panel), mode: panelMode, onChange: (next) => setPanelValue(parseDate(next)), onTypeChange: setMode };
|
|
983
993
|
return /* @__PURE__ */ jsxs6("div", { className: `sia-calendar${fullscreen ? " sia-calendar--fullscreen" : " sia-calendar--mini"} ${className}`.trim(), ...withTitleTooltip(props), children: [
|
|
984
|
-
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__header", children: headerRender ? headerRender(headerConfig) : /* @__PURE__ */ jsxs6(
|
|
994
|
+
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__header", children: headerRender ? headerRender(headerConfig) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
985
995
|
/* @__PURE__ */ jsx6("button", { type: "button", "aria-label": "\u4E0A\u4E00\u9875", onClick: () => setPanelValue(new Date(panel.getFullYear() - (panelMode === "year" ? 1 : 0), panel.getMonth() - (panelMode === "month" ? 1 : 0), 1)), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-left" }) }),
|
|
986
996
|
/* @__PURE__ */ jsxs6("strong", { children: [
|
|
987
997
|
panel.getFullYear(),
|
|
@@ -997,13 +1007,13 @@ function Calendar({ value, defaultValue, mode = "month", fullscreen = true, vali
|
|
|
997
1007
|
panelMode === "year" ? /* @__PURE__ */ jsx6("div", { className: "sia-calendar__months", children: MONTHS.map((month, index) => /* @__PURE__ */ jsx6("button", { className: panel.getMonth() === index ? "is-selected" : "", onClick: () => {
|
|
998
1008
|
setPanelValue(new Date(panel.getFullYear(), index, 1));
|
|
999
1009
|
setMode("month");
|
|
1000
|
-
}, children: month }, month)) }) : /* @__PURE__ */ jsxs6(
|
|
1010
|
+
}, children: month }, month)) }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1001
1011
|
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__week", children: WEEK.map((day) => /* @__PURE__ */ jsx6("span", { children: day }, day)) }),
|
|
1002
1012
|
/* @__PURE__ */ jsx6("div", { className: "sia-calendar__grid", children: grid.map((date) => {
|
|
1003
1013
|
const key = formatDate(date);
|
|
1004
1014
|
const outside = date.getMonth() !== panel.getMonth();
|
|
1005
1015
|
const disabled = Boolean(disabledDate?.(key) || validRange && (key < validRange[0] || key > validRange[1]));
|
|
1006
|
-
const origin = /* @__PURE__ */ jsxs6(
|
|
1016
|
+
const origin = /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1007
1017
|
/* @__PURE__ */ jsx6("span", { children: date.getDate() }),
|
|
1008
1018
|
dateCellRender?.(key)
|
|
1009
1019
|
] });
|
|
@@ -1017,7 +1027,7 @@ function Calendar({ value, defaultValue, mode = "month", fullscreen = true, vali
|
|
|
1017
1027
|
] });
|
|
1018
1028
|
}
|
|
1019
1029
|
function Carousel({ autoplay = false, autoplaySpeed = 3e3, arrows = false, dots = true, effect = "scroll", infinite = true, initialSlide = 0, pauseOnHover = true, beforeChange, afterChange, className = "", children, ...props }) {
|
|
1020
|
-
const slides =
|
|
1030
|
+
const slides = Children2.toArray(children);
|
|
1021
1031
|
const [current, setCurrent] = useState5(Math.min(initialSlide, Math.max(0, slides.length - 1)));
|
|
1022
1032
|
const [paused, setPaused] = useState5(false);
|
|
1023
1033
|
function go(next) {
|
|
@@ -1035,7 +1045,7 @@ function Carousel({ autoplay = false, autoplaySpeed = 3e3, arrows = false, dots
|
|
|
1035
1045
|
}, [autoplay, autoplaySpeed, current, paused, slides.length]);
|
|
1036
1046
|
return /* @__PURE__ */ jsxs6("div", { className: `sia-carousel sia-carousel--${effect} ${className}`.trim(), onMouseEnter: pauseOnHover ? () => setPaused(true) : void 0, onMouseLeave: pauseOnHover ? () => setPaused(false) : void 0, ...withTitleTooltip(props), children: [
|
|
1037
1047
|
/* @__PURE__ */ jsx6("div", { className: "sia-carousel__viewport", children: /* @__PURE__ */ jsx6("div", { className: "sia-carousel__track", style: effect === "scroll" ? { transform: `translateX(-${current * 100}%)` } : void 0, children: slides.map((slide, index) => /* @__PURE__ */ jsx6("div", { className: `sia-carousel__slide${index === current ? " is-active" : ""}`, "aria-hidden": index !== current, children: slide }, index)) }) }),
|
|
1038
|
-
arrows ? /* @__PURE__ */ jsxs6(
|
|
1048
|
+
arrows ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1039
1049
|
/* @__PURE__ */ jsx6("button", { className: "sia-carousel__arrow sia-carousel__arrow--prev", disabled: !infinite && current === 0, "aria-label": "\u4E0A\u4E00\u5F20", onClick: () => go(current - 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-left" }) }),
|
|
1040
1050
|
/* @__PURE__ */ jsx6("button", { className: "sia-carousel__arrow sia-carousel__arrow--next", disabled: !infinite && current === slides.length - 1, "aria-label": "\u4E0B\u4E00\u5F20", onClick: () => go(current + 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-right" }) })
|
|
1041
1051
|
] }) : null,
|
|
@@ -1223,7 +1233,7 @@ function ImagePreview({ open, src, originalSrc, alt = "", onOpenChange, current
|
|
|
1223
1233
|
displaySrc
|
|
1224
1234
|
) }),
|
|
1225
1235
|
/* @__PURE__ */ jsxs6("div", { className: "sia-image-preview__toolbar", role: "toolbar", "aria-label": "\u56FE\u7247\u64CD\u4F5C", onClick: (event) => event.stopPropagation(), children: [
|
|
1226
|
-
count > 1 && onCurrentChange ? /* @__PURE__ */ jsxs6(
|
|
1236
|
+
count > 1 && onCurrentChange ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1227
1237
|
/* @__PURE__ */ jsx6(Button, { variant: "text", "aria-label": "\u4E0A\u4E00\u5F20", disabled: current === 0, onClick: () => onCurrentChange(current - 1), children: /* @__PURE__ */ jsx6(Icon, { name: "chevron-left" }) }),
|
|
1228
1238
|
/* @__PURE__ */ jsxs6("output", { "aria-label": "\u56FE\u7247\u5E8F\u53F7", children: [
|
|
1229
1239
|
current + 1,
|
|
@@ -1325,7 +1335,7 @@ function Image({ fallback, placeholder, preview = true, rootClassName = "", clas
|
|
|
1325
1335
|
if (!failed && fallback) setFailed(true);
|
|
1326
1336
|
onError?.(event);
|
|
1327
1337
|
} }),
|
|
1328
|
-
preview ? /* @__PURE__ */ jsx6("button", { type: "button", className: "sia-image__mask", "aria-label": "\u9884\u89C8\u56FE\u7247", onClick: () => setOpen(true), children: config.mask ?? /* @__PURE__ */ jsxs6(
|
|
1338
|
+
preview ? /* @__PURE__ */ jsx6("button", { type: "button", className: "sia-image__mask", "aria-label": "\u9884\u89C8\u56FE\u7247", onClick: () => setOpen(true), children: config.mask ?? /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1329
1339
|
/* @__PURE__ */ jsx6(Icon, { name: "eye" }),
|
|
1330
1340
|
"\u9884\u89C8"
|
|
1331
1341
|
] }) }) : null,
|
|
@@ -1588,7 +1598,7 @@ function isUploadImage(file, accept) {
|
|
|
1588
1598
|
}
|
|
1589
1599
|
|
|
1590
1600
|
// src/components/Upload.tsx
|
|
1591
|
-
import { Fragment as
|
|
1601
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1592
1602
|
var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
|
|
1593
1603
|
function useThumbnail(file, accept) {
|
|
1594
1604
|
const [local, setLocal] = useState6();
|
|
@@ -1642,7 +1652,7 @@ function UploadItem({ file, files, props, actions }) {
|
|
|
1642
1652
|
file.status === "error" && /* @__PURE__ */ jsx8("span", { className: "sia-upload__error", children: "\u4E0A\u4F20\u5931\u8D25" }),
|
|
1643
1653
|
props.listType === "text" && (file.status === void 0 || file.status === "ready" || file.status === "done") && /* @__PURE__ */ jsx8("span", { className: "sia-upload__status", children: file.status === "done" ? "\u4E0A\u4F20\u5B8C\u6210" : "\u5DF2\u9009\u62E9" })
|
|
1644
1654
|
] });
|
|
1645
|
-
return /* @__PURE__ */ jsx8(
|
|
1655
|
+
return /* @__PURE__ */ jsx8(Fragment5, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
|
|
1646
1656
|
}
|
|
1647
1657
|
var UploadRoot = forwardRef(function UploadRoot2({
|
|
1648
1658
|
accept,
|
|
@@ -1875,10 +1885,10 @@ var UploadRoot = forwardRef(function UploadRoot2({
|
|
|
1875
1885
|
}
|
|
1876
1886
|
const trigger = !full && /* @__PURE__ */ jsx8("div", { className: "sia-upload__trigger", children: /* @__PURE__ */ jsx8(Button, { className: "sia-upload__choose", "aria-label": compactCard ? directory ? "\u9009\u62E9\u6587\u4EF6\u5939" : "\u9009\u62E9\u6587\u4EF6" : void 0, disabled: disabled || full, onClick: () => {
|
|
1877
1887
|
if (!disabled && !full && onChoose?.() !== false) inputRef.current?.click();
|
|
1878
|
-
}, children: children ?? (listType === "picture-card" ? /* @__PURE__ */ jsxs8(
|
|
1888
|
+
}, children: children ?? (listType === "picture-card" ? /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
1879
1889
|
/* @__PURE__ */ jsx8(Icon, { name: "plus", size: 24 }),
|
|
1880
1890
|
/* @__PURE__ */ jsx8("span", { children: "\u4E0A\u4F20\u56FE\u7247" })
|
|
1881
|
-
] }) : /* @__PURE__ */ jsxs8(
|
|
1891
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
1882
1892
|
/* @__PURE__ */ jsx8(Icon, { name: "upload", size: 16 }),
|
|
1883
1893
|
directory ? "\u9009\u62E9\u6587\u4EF6\u5939" : "\u9009\u62E9\u6587\u4EF6"
|
|
1884
1894
|
] })) }) });
|
|
@@ -1969,11 +1979,11 @@ var Upload = Object.assign(UploadRoot, {
|
|
|
1969
1979
|
});
|
|
1970
1980
|
|
|
1971
1981
|
// src/components/Breadcrumb.tsx
|
|
1972
|
-
import { Fragment as
|
|
1982
|
+
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1973
1983
|
function Breadcrumb({ items, separator = "/", itemRender, className = "", ...props }) {
|
|
1974
1984
|
return /* @__PURE__ */ jsx9("nav", { "aria-label": "\u9762\u5305\u5C51\u5BFC\u822A", ...withTitleTooltip(props), className: `sia-breadcrumb ${className}`.trim(), children: /* @__PURE__ */ jsx9("ol", { className: "sia-breadcrumb__list", children: items.map((item, index) => {
|
|
1975
1985
|
const current = index === items.length - 1;
|
|
1976
|
-
const content = /* @__PURE__ */ jsxs9(
|
|
1986
|
+
const content = /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
1977
1987
|
item.icon ? /* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__icon", "aria-hidden": "true", children: item.icon }) : null,
|
|
1978
1988
|
/* @__PURE__ */ jsx9("span", { className: "sia-breadcrumb__title", children: item.title })
|
|
1979
1989
|
] });
|
|
@@ -1991,7 +2001,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
|
|
|
1991
2001
|
|
|
1992
2002
|
// src/components/Typography.tsx
|
|
1993
2003
|
import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef7, useState as useState7 } from "react";
|
|
1994
|
-
import { Fragment as
|
|
2004
|
+
import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1995
2005
|
function TypographyContent({
|
|
1996
2006
|
as: Tag2 = "span",
|
|
1997
2007
|
type,
|
|
@@ -2094,7 +2104,7 @@ function TypographyContent({
|
|
|
2094
2104
|
/* @__PURE__ */ jsx10(Button, { size: "small", onClick: () => finish(false), children: "\u53D6\u6D88" }),
|
|
2095
2105
|
/* @__PURE__ */ jsx10(Button, { size: "small", variant: "primary", onClick: () => finish(true), children: "\u4FDD\u5B58" })
|
|
2096
2106
|
] })
|
|
2097
|
-
] }) : /* @__PURE__ */ jsxs10(
|
|
2107
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
2098
2108
|
/* @__PURE__ */ jsx10("span", { ref: contentRef, className: ellipsis && !expanded ? "sia-typography__ellipsis" : void 0, style: ellipsis && !expanded ? { "--sia-typography-rows": rows } : void 0, children: formatted }),
|
|
2099
2109
|
expandable && (overflow || expanded) ? /* @__PURE__ */ jsx10(Button, { variant: "link", size: "small", className: "sia-typography__action", "aria-expanded": expanded, disabled, onClick: () => setExpanded(!expanded), children: expanded ? "\u6536\u8D77" : "\u5C55\u5F00" }) : null,
|
|
2100
2110
|
editable ? /* @__PURE__ */ jsx10(Button, { ref: editRef, variant: "text", size: "small", className: "sia-typography__action", "aria-label": "\u7F16\u8F91\u6587\u672C", title: "\u7F16\u8F91", disabled, icon: /* @__PURE__ */ jsx10(Icon, { name: "edit", size: 14 }), onClick: () => {
|
|
@@ -463,6 +463,8 @@ type TagVariant = "soft" | "outlined" | "filled";
|
|
|
463
463
|
type TagSize = ControlSize;
|
|
464
464
|
/** 标签的属性配置。 */
|
|
465
465
|
interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
466
|
+
/** 标签内容;null、undefined、布尔值、空字符串、纯空白及仅包含这些值的数组或 Fragment 不显示。有效图标可单独显示,数值 0 保留;自定义 React 元素视为有效内容,不执行其内部渲染判断。 */
|
|
467
|
+
children?: ReactNode;
|
|
466
468
|
/**
|
|
467
469
|
* 标签尺寸,small / medium / large 的最小高度为 20 / 24 / 32 像素,字号为 12 / 12 / 14 像素。显式 size 优先于 compact;未设置时 compact=true 使用 small,否则继承 Form 的尺寸,无 Form 时为 medium。
|
|
468
470
|
* @defaultValue "medium"(未指定且无 Form 上下文、未开启 compact 时)
|
|
@@ -485,7 +487,7 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
485
487
|
* @defaultValue "soft"
|
|
486
488
|
*/
|
|
487
489
|
variant?: TagVariant;
|
|
488
|
-
/**
|
|
490
|
+
/** 标签前置图标;有有效图标时允许内容为空,图标和内容同时为空时整个标签不渲染。 */
|
|
489
491
|
icon?: ReactNode;
|
|
490
492
|
/**
|
|
491
493
|
* 是否显示关闭入口。
|
|
@@ -505,8 +507,8 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
505
507
|
/** 请求关闭时触发的回调。 */
|
|
506
508
|
onClose?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
507
509
|
}
|
|
508
|
-
/**
|
|
509
|
-
declare function Tag({ size: sizeProp, color, status, compact, variant, icon, closable, closeOnHover, disabled, onClose, className, children, style, ...props }: TagProps): react.JSX.Element;
|
|
510
|
+
/** 标记状态或筛选条件的标签;内容与图标均为空时不渲染,数值 0 正常显示,支持语义配色及关闭操作。 */
|
|
511
|
+
declare function Tag({ size: sizeProp, color, status, compact, variant, icon, closable, closeOnHover, disabled, onClose, className, children, style, ...props }: TagProps): react.JSX.Element | null;
|
|
510
512
|
|
|
511
513
|
/** 菜单排列模式;vertical 为纵向列表,horizontal 为横向菜单,inline 为内嵌子菜单,grid 为双列圆角卡片(图标在上、名称在下,子菜单以弹层展开)。 */
|
|
512
514
|
type MenuMode = "vertical" | "horizontal" | "inline" | "grid";
|
|
@@ -463,6 +463,8 @@ type TagVariant = "soft" | "outlined" | "filled";
|
|
|
463
463
|
type TagSize = ControlSize;
|
|
464
464
|
/** 标签的属性配置。 */
|
|
465
465
|
interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
466
|
+
/** 标签内容;null、undefined、布尔值、空字符串、纯空白及仅包含这些值的数组或 Fragment 不显示。有效图标可单独显示,数值 0 保留;自定义 React 元素视为有效内容,不执行其内部渲染判断。 */
|
|
467
|
+
children?: ReactNode;
|
|
466
468
|
/**
|
|
467
469
|
* 标签尺寸,small / medium / large 的最小高度为 20 / 24 / 32 像素,字号为 12 / 12 / 14 像素。显式 size 优先于 compact;未设置时 compact=true 使用 small,否则继承 Form 的尺寸,无 Form 时为 medium。
|
|
468
470
|
* @defaultValue "medium"(未指定且无 Form 上下文、未开启 compact 时)
|
|
@@ -485,7 +487,7 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
485
487
|
* @defaultValue "soft"
|
|
486
488
|
*/
|
|
487
489
|
variant?: TagVariant;
|
|
488
|
-
/**
|
|
490
|
+
/** 标签前置图标;有有效图标时允许内容为空,图标和内容同时为空时整个标签不渲染。 */
|
|
489
491
|
icon?: ReactNode;
|
|
490
492
|
/**
|
|
491
493
|
* 是否显示关闭入口。
|
|
@@ -505,8 +507,8 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
505
507
|
/** 请求关闭时触发的回调。 */
|
|
506
508
|
onClose?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
507
509
|
}
|
|
508
|
-
/**
|
|
509
|
-
declare function Tag({ size: sizeProp, color, status, compact, variant, icon, closable, closeOnHover, disabled, onClose, className, children, style, ...props }: TagProps): react.JSX.Element;
|
|
510
|
+
/** 标记状态或筛选条件的标签;内容与图标均为空时不渲染,数值 0 正常显示,支持语义配色及关闭操作。 */
|
|
511
|
+
declare function Tag({ size: sizeProp, color, status, compact, variant, icon, closable, closeOnHover, disabled, onClose, className, children, style, ...props }: TagProps): react.JSX.Element | null;
|
|
510
512
|
|
|
511
513
|
/** 菜单排列模式;vertical 为纵向列表,horizontal 为横向菜单,inline 为内嵌子菜单,grid 为双列圆角卡片(图标在上、名称在下,子菜单以弹层展开)。 */
|
|
512
514
|
type MenuMode = "vertical" | "horizontal" | "inline" | "grid";
|