@q1travel/design-system 0.26.1 → 0.27.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.
@@ -1,4 +1,5 @@
1
1
  import { AnchorHTMLAttributes } from 'react';
2
+ import { AriaRole } from 'react';
2
3
  import { ButtonHTMLAttributes } from 'react';
3
4
  import { ComponentProps } from 'react';
4
5
  import { ComponentPropsWithoutRef } from 'react';
@@ -47,6 +48,29 @@ export declare interface AuthCardProps {
47
48
 
48
49
  export declare function Avatar({ title, src, letter, glyph, placeholder, icon, iconColor, size, className }: AvatarProps): JSX.Element;
49
50
 
51
+ export declare function AvatarButton({ label, src, children, size, href, onClick, editIndicator, className, ref, ...rest }: AvatarButtonProps): JSX.Element;
52
+
53
+ export declare type AvatarButtonProps = {
54
+ /** 可访问名,必填,如「更换组织图标」。 */
55
+ label: string;
56
+ /** 图块图片;与 children 二选一,同时提供时以 src 为准。 */
57
+ src?: string;
58
+ /** 图块内容(字母、图标或 Avatar)。 */
59
+ children?: ReactNode;
60
+ /** 图块边长像素;缺省 32。 */
61
+ size?: number;
62
+ /** 提供时渲染为链接。 */
63
+ href?: string;
64
+ onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
65
+ /** 悬停 / 焦点时显示铅笔徽标;缺省 true。 */
66
+ editIndicator?: boolean;
67
+ className?: string;
68
+ role?: AriaRole;
69
+ tabIndex?: number;
70
+ ref?: Ref<HTMLAnchorElement | HTMLButtonElement>;
71
+ [dataAttribute: `data-${string}`]: string | number | boolean | null | undefined;
72
+ };
73
+
50
74
  export declare function AvatarGroup({ members, label, size, limit, overlap, reverse, className, }: {
51
75
  members: AvatarMember[];
52
76
  /** 可选整组名;传入则套 role=group 作整组增强,不传则默认逐个头像标注(读屏念每个成员名)。 */
@@ -749,6 +773,15 @@ export declare type ContextSwitcherAction = {
749
773
  textValue: string;
750
774
  icon?: ReactNode;
751
775
  disabled?: boolean;
776
+ /** 单层子菜单;带 children 的动作本身不触发回调,只有叶子触发。 */
777
+ children?: ContextSwitcherAction[];
778
+ };
779
+
780
+ export declare type ContextSwitcherAvatarAction = {
781
+ /** 可访问名,如「更换组织图标」。 */
782
+ label: string;
783
+ href?: string;
784
+ onSelect?: () => void;
752
785
  };
753
786
 
754
787
  export declare type ContextSwitcherCurrent = {
@@ -774,6 +807,11 @@ export declare type ContextSwitcherGroup = {
774
807
  divider?: boolean;
775
808
  };
776
809
 
810
+ export declare type ContextSwitcherHeader = ContextSwitcherCurrent & {
811
+ /** 提供时头部头像渲染为可编辑的 AvatarButton,并成为头部第一个菜单项。 */
812
+ avatarAction?: ContextSwitcherAvatarAction;
813
+ };
814
+
777
815
  export declare type ContextSwitcherItem = {
778
816
  id: string;
779
817
  label: ReactNode;
@@ -784,12 +822,19 @@ export declare type ContextSwitcherItem = {
784
822
  disabled?: boolean;
785
823
  depth?: 0 | 1;
786
824
  kind?: 'context' | 'action';
825
+ /** 行尾附注(如计数),仅视觉呈现;读屏文本由 metaLabel 提供。 */
826
+ meta?: ReactNode;
827
+ /** meta 的可读文本,并入该项的 aria-describedby。 */
828
+ metaLabel?: string;
829
+ /** 仅 kind 为 action 时可用:单层子菜单,叶子项通过 onFooterAction 通知。 */
830
+ children?: ContextSwitcherAction[];
787
831
  };
788
832
 
789
833
  export declare type ContextSwitcherPresentation = {
790
834
  type?: 'grouped';
791
835
  } | {
792
836
  type: 'stacked';
837
+ nesting?: 'indent' | 'flush';
793
838
  } | {
794
839
  type: 'drilldown';
795
840
  primaryGroupId: string;
@@ -806,7 +851,7 @@ export declare type ContextSwitcherProps = {
806
851
  pendingId?: string;
807
852
  errorMessage?: ReactNode;
808
853
  footerActions?: ContextSwitcherAction[];
809
- header?: ContextSwitcherCurrent;
854
+ header?: ContextSwitcherHeader;
810
855
  headerActions?: ContextSwitcherAction[];
811
856
  onFooterAction?: (action: ContextSwitcherAction) => void;
812
857
  label?: string;
@@ -990,6 +1035,14 @@ declare type FieldBareProps = {
990
1035
  error?: never;
991
1036
  };
992
1037
 
1038
+ export declare type FieldLabelHintProps = {
1039
+ label: string;
1040
+ labelHint?: ReactNode;
1041
+ } | {
1042
+ label?: never;
1043
+ labelHint?: never;
1044
+ };
1045
+
993
1046
  export declare type FieldLabelVisibilityProps = {
994
1047
  label: string;
995
1048
  labelHidden?: boolean;
@@ -1081,9 +1134,11 @@ export declare type FilterOptionPanelProps = {
1081
1134
  onQueryChange?: (query: string) => void;
1082
1135
  };
1083
1136
 
1084
- export declare function FormField({ controlId, label, labelHidden, description, error, wide, children, }: {
1137
+ export declare function FormField({ controlId, label, labelHidden, labelHint, description, error, wide, children, }: {
1085
1138
  controlId: string;
1086
1139
  label?: string;
1140
+ /** 规则释义/字段注解:渲染为标签旁的 InfoTip,不在字段下占位;标签隐藏时不渲染。 */
1141
+ labelHint?: ReactNode;
1087
1142
  description?: string;
1088
1143
  error?: string;
1089
1144
  wide?: boolean;
@@ -1157,7 +1212,16 @@ export declare type IconButtonProps = IconButtonAccessibleName & IconButtonBaseP
1157
1212
  ref?: Ref<HTMLButtonElement>;
1158
1213
  };
1159
1214
 
1160
- export declare function Input({ id, label, labelHidden, description, error, invalid, errorId, ref, prefix, suffix, prefixStyling, suffixStyling, rounded, wide, size, className, revealable, revealed, onRevealedChange, revealLabel, hideLabel, disabled, ...rest }: {
1215
+ export declare function InfoTip({ label, content }: InfoTipProps): JSX.Element;
1216
+
1217
+ export declare type InfoTipProps = {
1218
+ /** 被说明对象的名称;可访问名为「{label}说明」。 */
1219
+ label: string;
1220
+ /** 说明内容:一句规则释义或字段注解。 */
1221
+ content: ReactNode;
1222
+ };
1223
+
1224
+ export declare function Input({ id, label, labelHidden, labelHint, description, error, invalid, errorId, ref, prefix, suffix, prefixStyling, suffixStyling, rounded, wide, size, className, revealable, revealed, onRevealedChange, revealLabel, hideLabel, disabled, ...rest }: {
1161
1225
  /** 可选:未传时内部 useId 兜底(对齐 Combobox);显式传入时行为同 0.3.0。 */
1162
1226
  id?: string;
1163
1227
  /** 置 aria-invalid 的业务校验态,不渲染文案;与壳模式 error 并轨(invalid || Boolean(error))。 */
@@ -1194,9 +1258,9 @@ export declare function Input({ id, label, labelHidden, description, error, inva
1194
1258
  rounded?: boolean;
1195
1259
  wide?: boolean;
1196
1260
  size?: FieldSize;
1197
- } & (FieldShellProps | FieldBareProps) & FieldLabelVisibilityProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size' | 'prefix'>): JSX.Element;
1261
+ } & (FieldShellProps | FieldBareProps) & FieldLabelVisibilityProps & FieldLabelHintProps & Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size' | 'prefix'>): JSX.Element;
1198
1262
 
1199
- export declare function InputOTP({ id, name, value, onValueChange, disabled, readOnly, required, invalid, errorId, size, separator, ref, label, labelHidden, description, error, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': describedBy, }: InputOTPProps): JSX.Element;
1263
+ export declare function InputOTP({ id, name, value, onValueChange, disabled, readOnly, required, invalid, errorId, size, separator, ref, label, labelHidden, labelHint, description, error, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': describedBy, }: InputOTPProps): JSX.Element;
1200
1264
 
1201
1265
  export declare type InputOTPProps = {
1202
1266
  id?: string;
@@ -1214,7 +1278,7 @@ export declare type InputOTPProps = {
1214
1278
  separator?: boolean;
1215
1279
  ref?: Ref<HTMLInputElement>;
1216
1280
  'aria-describedby'?: string;
1217
- } & FieldLabelVisibilityProps & ((FieldShellProps & {
1281
+ } & FieldLabelVisibilityProps & FieldLabelHintProps & ((FieldShellProps & {
1218
1282
  'aria-label'?: never;
1219
1283
  'aria-labelledby'?: never;
1220
1284
  }) | (FieldBareProps & ({
@@ -1267,9 +1331,10 @@ export declare type KnownTotalPaginationProps = PaginationCommonProps & ({
1267
1331
  showPageNumbers?: boolean;
1268
1332
  });
1269
1333
 
1270
- export declare function Label({ htmlFor, required, children, }: {
1334
+ export declare function Label({ htmlFor, required, hint, children, }: {
1271
1335
  htmlFor?: string;
1272
1336
  required?: boolean;
1337
+ hint?: ReactNode;
1273
1338
  children: string;
1274
1339
  }): JSX.Element;
1275
1340
 
@@ -1790,6 +1855,14 @@ export declare function RangeField(props: CalendarSelectionProps & {
1790
1855
  today?: Date;
1791
1856
  /** 显式启用本地 24 小时时间编辑;默认仅选择日期。 */
1792
1857
  withTime?: boolean;
1858
+ /** 透传到触发器按钮,供外部 `<label htmlFor>` 关联或表单定位。 */
1859
+ id?: string;
1860
+ /** 触发器的可访问名称;未提供时读出触发器上的可见文字。 */
1861
+ 'aria-label'?: string;
1862
+ /** 用页面上已有元素命名触发器。 */
1863
+ 'aria-labelledby'?: string;
1864
+ /** 禁用触发器与清除操作,弹层不可打开。 */
1865
+ disabled?: boolean;
1793
1866
  }): JSX.Element;
1794
1867
 
1795
1868
  export declare function RangeInputs(props: (CalendarSelectionProps | {
@@ -1906,7 +1979,7 @@ export declare type SearchInputProps = {
1906
1979
  ref?: Ref<HTMLInputElement>;
1907
1980
  } & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'aria-label' | 'defaultValue' | 'id' | 'onChange' | 'ref' | 'type' | 'value'>;
1908
1981
 
1909
- export declare function Select({ id, label, labelHidden, description, error, ref, wide, size, prefix, suffix, className, children, value, defaultValue, multiple, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...rest }: {
1982
+ export declare function Select({ id, label, labelHidden, labelHint, description, error, ref, wide, size, prefix, suffix, className, children, value, defaultValue, multiple, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...rest }: {
1910
1983
  id: string;
1911
1984
  label?: string;
1912
1985
  description?: string;
@@ -1925,7 +1998,7 @@ export declare function Select({ id, label, labelHidden, description, error, ref
1925
1998
  defaultValue?: string | number;
1926
1999
  /** Select 是单选字段;多值选择使用 MultiSelect。 */
1927
2000
  multiple?: never;
1928
- } & FieldLabelVisibilityProps & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'id' | 'children' | 'size' | 'prefix' | 'multiple' | 'value' | 'defaultValue'>): JSX.Element;
2001
+ } & FieldLabelVisibilityProps & FieldLabelHintProps & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'id' | 'children' | 'size' | 'prefix' | 'multiple' | 'value' | 'defaultValue'>): JSX.Element;
1929
2002
 
1930
2003
  export declare function Separator({ orientation, decorative, className, }: {
1931
2004
  orientation?: SeparatorOrientation;
@@ -2125,7 +2198,10 @@ export declare type SwitchOption = {
2125
2198
  export declare type TabItem = {
2126
2199
  id: string;
2127
2200
  label: string;
2128
- content: ReactNode;
2201
+ /** 组件内面板内容;省略且未给 panelId 时不渲染面板。 */
2202
+ content?: ReactNode;
2203
+ /** 页面内由您自己渲染的区块 id;提供时 aria-controls 指向它,组件不再渲染自带面板。 */
2204
+ panelId?: string;
2129
2205
  icon?: ReactNode;
2130
2206
  disabled?: boolean;
2131
2207
  /** 禁用原因;在 tablist 下方常显,并通过 aria-describedby 与禁用标签关联。 */
@@ -2210,13 +2286,13 @@ export declare type TableSortDirection = 'asc' | 'desc';
2210
2286
  export declare function Tabs({ tabs, ariaLabel, variant, value, defaultValue, onValueChange, }: {
2211
2287
  tabs: TabItem[];
2212
2288
  ariaLabel: string;
2213
- variant?: 'default' | 'secondary';
2289
+ variant?: 'default' | 'secondary' | 'line';
2214
2290
  value?: string;
2215
2291
  defaultValue?: string;
2216
2292
  onValueChange?: (id: string) => void;
2217
2293
  }): JSX.Element | null;
2218
2294
 
2219
- export declare function Textarea({ id, label, labelHidden, description, error, invalid, errorId, ref, wide, size, className, maxLength, onInput, ...rest }: TextareaProps): JSX.Element;
2295
+ export declare function Textarea({ id, label, labelHidden, labelHint, description, error, invalid, errorId, ref, wide, size, className, maxLength, onInput, ...rest }: TextareaProps): JSX.Element;
2220
2296
 
2221
2297
  /** Textarea 的完整 props。消费方包一层时用它标注,无需知道内部由哪几块组合而成。 */
2222
2298
  export declare type TextareaProps = {
@@ -2230,7 +2306,7 @@ export declare type TextareaProps = {
2230
2306
  ref?: Ref<HTMLTextAreaElement>;
2231
2307
  wide?: boolean;
2232
2308
  size?: FieldSize;
2233
- } & (FieldShellProps | FieldBareProps) & FieldLabelVisibilityProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'>;
2309
+ } & (FieldShellProps | FieldBareProps) & FieldLabelVisibilityProps & FieldLabelHintProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'>;
2234
2310
 
2235
2311
  export declare function TextWithCopyButton({ text, copyValue, successMessage, size, }: {
2236
2312
  text: string;