@q1travel/design-system 0.1.0 → 0.2.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/dist/design-system.d.ts +36 -26
- package/dist/design-system.js +221 -215
- package/package.json +1 -1
package/dist/design-system.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { KeyboardEventHandler } from 'react';
|
|
|
7
7
|
import { MouseEventHandler } from 'react';
|
|
8
8
|
import { ReactElement } from 'react';
|
|
9
9
|
import { ReactNode } from 'react';
|
|
10
|
+
import { Ref } from 'react';
|
|
10
11
|
import { RefObject } from 'react';
|
|
11
12
|
import { SelectHTMLAttributes } from 'react';
|
|
12
13
|
import { TextareaHTMLAttributes } from 'react';
|
|
@@ -17,13 +18,13 @@ export declare function Avatar({ title, src, letter, glyph, placeholder, icon, i
|
|
|
17
18
|
|
|
18
19
|
export declare function AvatarGroup({ members, label, size, limit, overlap, reverse, className, }: {
|
|
19
20
|
members: AvatarMember[];
|
|
20
|
-
/** 可选整组名;传入则套 role=group
|
|
21
|
+
/** 可选整组名;传入则套 role=group 作整组增强,不传则默认逐个头像标注(读屏念每个成员名)。 */
|
|
21
22
|
label?: string;
|
|
22
23
|
/** 成员统一直径;缺省 32。 */
|
|
23
24
|
size?: number;
|
|
24
25
|
/** 显示上限,超出收纳为 +N;非法值(负数/NaN)忽略。 */
|
|
25
26
|
limit?: number;
|
|
26
|
-
/** 重叠像素;'auto' = 尺寸的 30%
|
|
27
|
+
/** 重叠像素;'auto' = 尺寸的 30% 取整(例:16→5 / 24→7 / 32→10 / 48→14);负数按 0 处理。 */
|
|
27
28
|
overlap?: number | 'auto';
|
|
28
29
|
/** 翻转堆叠顺序。 */
|
|
29
30
|
reverse?: boolean;
|
|
@@ -43,7 +44,7 @@ export declare type AvatarProps = {
|
|
|
43
44
|
glyph?: ReactNode;
|
|
44
45
|
/** 加载占位骨架;只用于加载态,不作长期缺省。 */
|
|
45
46
|
placeholder?: boolean;
|
|
46
|
-
/**
|
|
47
|
+
/** 右下角标图标;纯装饰,语义信息由调用方文字承载。 */
|
|
47
48
|
icon?: ReactNode;
|
|
48
49
|
/** 角标底色(任意 CSS color,建议用语义 token);缺省中性灰盘。 */
|
|
49
50
|
iconColor?: string;
|
|
@@ -63,7 +64,7 @@ export declare type BadgeProps = {
|
|
|
63
64
|
subtle?: boolean;
|
|
64
65
|
/** 反转高对比形态;设置后忽略 tone/subtle。 */
|
|
65
66
|
inverted?: boolean;
|
|
66
|
-
/** 尺寸档 20/24/32
|
|
67
|
+
/** 尺寸档 20/24/32。 */
|
|
67
68
|
size?: BadgeSize;
|
|
68
69
|
/** 前置图标;纯装饰(组件自动 aria-hidden),宽高随档位 12/14/16 由样式钉死。 */
|
|
69
70
|
icon?: ReactNode;
|
|
@@ -88,12 +89,12 @@ export declare type BannerProps = {
|
|
|
88
89
|
tone?: BannerTone;
|
|
89
90
|
/** 卡条形态的前缀图标;纯装饰(组件自动 aria-hidden)。公告形态与进度形态不渲染图标。 */
|
|
90
91
|
icon?: ReactNode;
|
|
91
|
-
/** 主操作:公告形态渲染恒深药丸(无 chevron
|
|
92
|
+
/** 主操作:公告形态渲染恒深药丸(无 chevron);卡条形态渲染描边药丸 + chevron。进度形态忽略 action——任务进行中不挂主跳转,完成后换普通卡条。 */
|
|
92
93
|
action?: {
|
|
93
94
|
label: string;
|
|
94
95
|
href: string;
|
|
95
96
|
};
|
|
96
|
-
/**
|
|
97
|
+
/** 关闭回调;设置后渲染关闭按钮。公告形态无关闭;进度形态渲染在进度头右侧。 */
|
|
97
98
|
onDismiss?: () => void;
|
|
98
99
|
/** 进度形态(自有扩展):value 为 0–100 的百分比(非法值归 0),label 供读屏。进度恒为卡条形态。 */
|
|
99
100
|
progress?: {
|
|
@@ -111,11 +112,11 @@ export declare function Book({ title, variant, color, bandColor, textColor, icon
|
|
|
111
112
|
export declare type BookProps = {
|
|
112
113
|
/** 封面标题;语义由标题承载,封面其余元素均为装饰。 */
|
|
113
114
|
title: string;
|
|
114
|
-
/** stripe
|
|
115
|
+
/** stripe=顶部色带+下方标签区(默认);simple=纯封面、标题置顶。 */
|
|
115
116
|
variant?: 'stripe' | 'simple';
|
|
116
|
-
/** 封面底色;建议传设计 token(var(--q1-color-…)),勿用裸 hex
|
|
117
|
+
/** 封面底色;建议传设计 token(var(--q1-color-…)),勿用裸 hex。 */
|
|
117
118
|
color?: string;
|
|
118
|
-
/** stripe
|
|
119
|
+
/** stripe 色带颜色;缺省琥珀。 */
|
|
119
120
|
bandColor?: string;
|
|
120
121
|
/** 标题颜色;自定义封面色时务必保证对比可读。 */
|
|
121
122
|
textColor?: string;
|
|
@@ -123,7 +124,7 @@ export declare type BookProps = {
|
|
|
123
124
|
icon?: ReactNode;
|
|
124
125
|
/** 整幅插画:铺满封面、裁切;标题浮于其上;aria-hidden。 */
|
|
125
126
|
illustration?: ReactNode;
|
|
126
|
-
/**
|
|
127
|
+
/** 细密交叉纹理(自有配方);只提供单一纹理样式,未做多纹理体系(记 non-goal)。仅用于主视觉,成排书架勿用。 */
|
|
127
128
|
textured?: boolean;
|
|
128
129
|
/** 数字按 px;字符串原样透传(如 clamp(...) 做响应式宽度)。内部排版随宽度等比缩放。
|
|
129
130
|
* width 是唯一尺寸入口:用 style.width 改宽会与内部缩放脱节。 */
|
|
@@ -188,7 +189,7 @@ declare type ButtonProps = {
|
|
|
188
189
|
iconOnly?: boolean;
|
|
189
190
|
/** 圆形——仅用于 icon-only 按钮。与 rounded 互斥(同传时 circle 优先)。 */
|
|
190
191
|
circle?: boolean;
|
|
191
|
-
/** 药丸形(full radius)+
|
|
192
|
+
/** 药丸形(full radius)+ 柔和抬起阴影,营销页/落地页文字 CTA 用。与 circle 互斥。 */
|
|
192
193
|
rounded?: boolean;
|
|
193
194
|
loading?: boolean;
|
|
194
195
|
disabled?: boolean;
|
|
@@ -205,6 +206,8 @@ declare type ButtonProps = {
|
|
|
205
206
|
onFocus?: FocusEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
206
207
|
onBlur?: FocusEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
207
208
|
onKeyDown?: KeyboardEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
209
|
+
/** 渲染为 <button> 或 <a>(取决于是否传 href),供 focus 管理、测量、浮层定位等场景使用。 */
|
|
210
|
+
ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
208
211
|
};
|
|
209
212
|
|
|
210
213
|
export declare type ButtonSize = 'sm' | 'md' | 'lg';
|
|
@@ -245,13 +248,13 @@ declare type CardOwnProps = {
|
|
|
245
248
|
hover?: boolean;
|
|
246
249
|
/** 次要表面:更弱的底色,与主卡片区分层级。 */
|
|
247
250
|
secondary?: boolean;
|
|
248
|
-
/**
|
|
251
|
+
/** 分段:用分隔线把卡片切成几段。 */
|
|
249
252
|
divided?: boolean;
|
|
250
253
|
/** 分段方向:column 竖排(默认)/ row 横排。与 divided 正交——单传 row 只横向铺开,配 divided 才加分隔线。 */
|
|
251
254
|
direction?: CardDirection;
|
|
252
|
-
/**
|
|
255
|
+
/** 常驻柔和投影:让卡片浮于背景,用于落地/营销卡片。 */
|
|
253
256
|
shadow?: boolean;
|
|
254
|
-
/** 是否带边框,默认 true。传 false
|
|
257
|
+
/** 是否带边框,默认 true。传 false 得无框卡片(靠底色/投影表达边界)。 */
|
|
255
258
|
bordered?: boolean;
|
|
256
259
|
className?: string;
|
|
257
260
|
children: ReactNode;
|
|
@@ -345,7 +348,8 @@ export declare function CodeTokens({ tokens }: {
|
|
|
345
348
|
}): JSX.Element;
|
|
346
349
|
|
|
347
350
|
export declare function Collapse({ title, defaultOpen, small, children, }: {
|
|
348
|
-
|
|
351
|
+
/** 固定文案传字符串;随展开/收起切换文案(如"显示代码"/"收起代码")传函数,入参为当前 open 状态。 */
|
|
352
|
+
title: string | ((open: boolean) => string);
|
|
349
353
|
defaultOpen?: boolean;
|
|
350
354
|
small?: boolean;
|
|
351
355
|
children: ReactNode;
|
|
@@ -404,7 +408,7 @@ declare type CommandMenuProps = {
|
|
|
404
408
|
};
|
|
405
409
|
|
|
406
410
|
export declare type CommandMenuSection = {
|
|
407
|
-
/**
|
|
411
|
+
/** 段标题;缺省时该段以无标题分隔线与上文分隔。 */
|
|
408
412
|
heading?: string;
|
|
409
413
|
items: CommandMenuItem[];
|
|
410
414
|
};
|
|
@@ -548,7 +552,7 @@ export declare type ErrorMessageSize = 'sm' | 'md' | 'lg';
|
|
|
548
552
|
export declare function Feedback({ label, prompt, placeholder, inline, topics, }: {
|
|
549
553
|
label?: string;
|
|
550
554
|
prompt?: string;
|
|
551
|
-
/** textarea
|
|
555
|
+
/** textarea 占位:换成更具体的引导,帮助用户知道从哪里说起。 */
|
|
552
556
|
placeholder?: string;
|
|
553
557
|
inline?: boolean;
|
|
554
558
|
topics?: string[];
|
|
@@ -610,11 +614,11 @@ export declare function Input({ id, label, description, error, prefix, suffix, p
|
|
|
610
614
|
error?: string;
|
|
611
615
|
prefix?: ReactNode;
|
|
612
616
|
suffix?: ReactNode;
|
|
613
|
-
/** 置 false
|
|
617
|
+
/** 置 false 去掉前缀的灰块底色与分隔线,变成纯文本/裸图标。 */
|
|
614
618
|
prefixStyling?: boolean;
|
|
615
|
-
/** 置 false
|
|
619
|
+
/** 置 false 去掉后缀的灰块底色与分隔线。 */
|
|
616
620
|
suffixStyling?: boolean;
|
|
617
|
-
/**
|
|
621
|
+
/** 药丸形全圆角外框(9999px 级 pill 半径)。 */
|
|
618
622
|
rounded?: boolean;
|
|
619
623
|
wide?: boolean;
|
|
620
624
|
size?: FieldSize;
|
|
@@ -714,8 +718,8 @@ declare type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'id'
|
|
|
714
718
|
|
|
715
719
|
declare type NativeInputProps_2 = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
|
|
716
720
|
|
|
717
|
-
export declare function Note({
|
|
718
|
-
|
|
721
|
+
export declare function Note({ tone, size, filled, disabled, label, action, children, }: {
|
|
722
|
+
tone?: NoteTone;
|
|
719
723
|
size?: NoteSize;
|
|
720
724
|
filled?: boolean;
|
|
721
725
|
disabled?: boolean;
|
|
@@ -726,7 +730,7 @@ export declare function Note({ type, size, filled, disabled, label, action, chil
|
|
|
726
730
|
|
|
727
731
|
declare type NoteSize = 'small' | 'default' | 'large';
|
|
728
732
|
|
|
729
|
-
declare type
|
|
733
|
+
export declare type NoteTone = 'info' | 'success' | 'warning' | 'error' | 'secondary';
|
|
730
734
|
|
|
731
735
|
declare type PageLink = {
|
|
732
736
|
title: string;
|
|
@@ -749,7 +753,7 @@ export declare function Phone({ screenLabel }: {
|
|
|
749
753
|
|
|
750
754
|
export declare function Pill({ href, size, icon, title, className, children, ...rest }: PillProps): JSX.Element;
|
|
751
755
|
|
|
752
|
-
declare type PillProps = {
|
|
756
|
+
export declare type PillProps = {
|
|
753
757
|
href: string;
|
|
754
758
|
size?: BadgeSize;
|
|
755
759
|
/** 前置图标;纯装饰(组件自动 aria-hidden)。 */
|
|
@@ -799,7 +803,7 @@ export declare function RangeInputs({ value, withTime, onApply, pinnedTimezone,
|
|
|
799
803
|
value: RangeValue;
|
|
800
804
|
withTime: boolean;
|
|
801
805
|
onApply: () => void;
|
|
802
|
-
/**
|
|
806
|
+
/** 固定时区:传入时时区从可选 select 变只读文本、不可切换。 */
|
|
803
807
|
pinnedTimezone?: string;
|
|
804
808
|
}): JSX.Element;
|
|
805
809
|
|
|
@@ -914,7 +918,7 @@ export declare function Snippet({ text, prompt, inverted, tone, copyText, onCopy
|
|
|
914
918
|
prompt?: boolean;
|
|
915
919
|
inverted?: boolean;
|
|
916
920
|
tone?: SnippetTone;
|
|
917
|
-
/**
|
|
921
|
+
/** 显示与复制内容分离:传了就复制它,不传复制显示内容。 */
|
|
918
922
|
copyText?: string;
|
|
919
923
|
/** 复制触发后调用,供外部消费复制事件(如埋点);不代表剪贴板写入一定成功。 */
|
|
920
924
|
onCopy?: () => void;
|
|
@@ -1089,6 +1093,12 @@ export declare function useCopy(): {
|
|
|
1089
1093
|
reset: () => void;
|
|
1090
1094
|
};
|
|
1091
1095
|
|
|
1096
|
+
export declare function useRadio({ id, ...rest }: {
|
|
1097
|
+
id: string;
|
|
1098
|
+
} & NativeInputProps): {
|
|
1099
|
+
component: JSX.Element;
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1092
1102
|
export declare function useToast(): ToastContextValue;
|
|
1093
1103
|
|
|
1094
1104
|
export declare function Video({ controls, loop }: {
|