@q1travel/design-system 0.7.2 → 0.8.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.
@@ -204,6 +204,10 @@ declare type ButtonBaseProps = {
204
204
  loading?: boolean;
205
205
  /** loading 时 role=status 播报的文案,默认"加载中…";仅供屏幕阅读器,不影响可见文案。 */
206
206
  loadingLabel?: string;
207
+ /** 已提交忙态:原生禁用 + aria-busy,阻止重复提交。 */
208
+ busy?: boolean;
209
+ /** busy 时的可见状态文案;为空时保留原始 children,并用 loadingLabel 或固定 fallback 播报。 */
210
+ busyLabel?: string;
207
211
  disabled?: boolean;
208
212
  type?: 'button' | 'submit' | 'reset';
209
213
  shortcut?: string;
@@ -238,6 +242,7 @@ export declare type ButtonLinkProps = Omit<ButtonBaseProps, 'type'> & {
238
242
  onFocus?: FocusEventHandler<HTMLAnchorElement>;
239
243
  onBlur?: FocusEventHandler<HTMLAnchorElement>;
240
244
  onKeyDown?: KeyboardEventHandler<HTMLAnchorElement>;
245
+ 'aria-keyshortcuts'?: string;
241
246
  ref?: Ref<HTMLAnchorElement>;
242
247
  };
243
248
 
@@ -630,7 +635,19 @@ export declare function DestructiveActionModal({ open, onClose, title, descripti
630
635
  /** 提交进行中:双按钮禁用、主操作显示加载指示;open 由调用方控制,加载中模态保持打开。 */
631
636
  loading?: boolean;
632
637
  onConfirm: () => string | null;
633
- }): JSX.Element | null;
638
+ }): ReactNode;
639
+
640
+ export declare type DocsPageLink = {
641
+ title: string;
642
+ href: string;
643
+ };
644
+
645
+ export declare function DocsPagination({ previous, next }: DocsPaginationProps): JSX.Element;
646
+
647
+ export declare type DocsPaginationProps = {
648
+ previous?: DocsPageLink;
649
+ next?: DocsPageLink;
650
+ };
634
651
 
635
652
  export declare function DotsMenu({ entries, size, disabled, align, }: {
636
653
  entries: DotsMenuEntry[];
@@ -653,7 +670,7 @@ export declare function Drawer({ open, onClose, title, children, footer, height,
653
670
  footer: ReactNode;
654
671
  /** 面板最大高度(px),覆盖默认 60vh;仅当默认高度会裁切主操作时使用。 */
655
672
  height?: number;
656
- }): JSX.Element | null;
673
+ }): ReactNode;
657
674
 
658
675
  export declare function EmptyState({ icon, title, description, actions, headingLevel, }: {
659
676
  icon?: ReactNode;
@@ -824,6 +841,18 @@ export declare function Kbd({ meta, shift, alt, ctrl, small, children, }: {
824
841
  children?: ReactNode;
825
842
  }): JSX.Element;
826
843
 
844
+ export declare type KnownTotalPaginationProps = PaginationCommonProps & ({
845
+ total: number;
846
+ totalPages?: never;
847
+ hasNextPage?: never;
848
+ showPageNumbers?: boolean;
849
+ } | {
850
+ total?: never;
851
+ totalPages: number;
852
+ hasNextPage?: never;
853
+ showPageNumbers?: boolean;
854
+ });
855
+
827
856
  export declare function Label({ htmlFor, required, children, }: {
828
857
  htmlFor?: string;
829
858
  required?: boolean;
@@ -892,7 +921,7 @@ export declare function Modal({ open, onClose, title, children, footer, initialF
892
921
  dismissable?: boolean;
893
922
  /** 头尾固定、只有正文区域滚动;用于正文可能超出视口高度的场景(长列表、长条款)。 */
894
923
  sticky?: boolean;
895
- }): JSX.Element | null;
924
+ }): ReactNode;
896
925
 
897
926
  export declare function ModalInset({ children }: {
898
927
  children: ReactNode;
@@ -992,14 +1021,31 @@ declare type NoteSize = 'small' | 'default' | 'large';
992
1021
 
993
1022
  export declare type NoteTone = 'info' | 'success' | 'warning' | 'error' | 'secondary';
994
1023
 
995
- declare type PageLink = {
996
- title: string;
1024
+ export declare function Pagination({ page, pageSize: pageSizeProp, total, totalPages: totalPagesProp, hasNextPage, onChange, loading, showPageNumbers, summary, pageSizeSlot, prevLabel, nextLabel, compact, className, }: PaginationProps): JSX.Element;
1025
+
1026
+ declare type PaginationCommonProps = {
1027
+ page: number;
1028
+ pageSize?: number;
1029
+ onChange: (page: number) => void;
1030
+ loading?: boolean;
1031
+ summary?: ReactNode | ((args: PaginationSummaryArgs) => ReactNode);
1032
+ pageSizeSlot?: ReactNode;
1033
+ prevLabel?: string;
1034
+ nextLabel?: string;
1035
+ compact?: boolean;
1036
+ className?: string;
997
1037
  };
998
1038
 
999
- export declare function Pagination({ previous, next }: {
1000
- previous?: PageLink;
1001
- next?: PageLink;
1002
- }): JSX.Element;
1039
+ export declare type PaginationProps = KnownTotalPaginationProps | UnknownTailPaginationProps;
1040
+
1041
+ export declare type PaginationSummaryArgs = {
1042
+ page: number;
1043
+ totalPages?: number;
1044
+ total?: number;
1045
+ pageSize: number;
1046
+ start: number;
1047
+ end: number;
1048
+ };
1003
1049
 
1004
1050
  export declare function PeriodCombobox({ presets, activeLabel, onPick, }: {
1005
1051
  presets: CalendarPreset[];
@@ -1179,7 +1225,7 @@ export declare function Sheet({ open, onClose, title, side, children, footer }:
1179
1225
  side?: SheetSide;
1180
1226
  children: ReactNode;
1181
1227
  footer?: ReactNode;
1182
- }): JSX.Element | null;
1228
+ }): ReactNode;
1183
1229
 
1184
1230
  export declare type SheetSide = 'top' | 'right' | 'bottom' | 'left';
1185
1231
 
@@ -1280,11 +1326,12 @@ export declare function StatusDot({ tone, label, animated, showLabel, titlePrefi
1280
1326
 
1281
1327
  export declare type StatusDotTone = 'neutral' | 'warning' | 'success' | 'danger';
1282
1328
 
1283
- export declare function Switch({ options, ariaLabel, name, defaultValue, onChange, size, fullWidth, iconOnly, }: {
1329
+ export declare function Switch({ options, ariaLabel, name, defaultValue, value, onChange, size, fullWidth, iconOnly, }: {
1284
1330
  options: SwitchOption[];
1285
1331
  ariaLabel: string;
1286
1332
  name?: string;
1287
1333
  defaultValue?: string;
1334
+ value?: string;
1288
1335
  onChange?: (value: string) => void;
1289
1336
  size?: 'sm' | 'md' | 'lg';
1290
1337
  fullWidth?: boolean;
@@ -1296,8 +1343,9 @@ export declare type SwitchOption = {
1296
1343
  value: string;
1297
1344
  label: string;
1298
1345
  icon?: ReactNode;
1346
+ meta?: ReactNode;
1299
1347
  disabled?: boolean;
1300
- /** 补充说明(原生 title,桌面端悬浮显示);用于图标模式下文字看不出来的额外上下文。 */
1348
+ /** 补充说明;用于在标签旁提供低强调度的上下文。 */
1301
1349
  tooltip?: string;
1302
1350
  };
1303
1351
 
@@ -1365,7 +1413,7 @@ export declare function ToastProvider({ children }: {
1365
1413
 
1366
1414
  export declare type ToastTone = 'default' | 'success' | 'warning' | 'error';
1367
1415
 
1368
- export declare function Toggle({ checked, defaultOn, onChange, disabled, size, onColor, label, description, labelSide, ariaLabel, }: {
1416
+ export declare function Toggle({ checked, defaultOn, onChange, disabled, size, onColor, label, description, labelSide, 'aria-label': canonicalAriaLabel, 'aria-labelledby': ariaLabelledBy, ariaLabel, }: {
1369
1417
  /** 受控值;提供后内部状态失效,显示值以外部回写的 checked 为准。 */
1370
1418
  checked?: boolean;
1371
1419
  /** 非受控模式的初始值;与 checked 同传时以 checked 为准。 */
@@ -1378,6 +1426,9 @@ export declare function Toggle({ checked, defaultOn, onChange, disabled, size, o
1378
1426
  label?: string;
1379
1427
  description?: string;
1380
1428
  labelSide?: 'left' | 'right';
1429
+ 'aria-label'?: string;
1430
+ 'aria-labelledby'?: string;
1431
+ /** @deprecated 使用 aria-label。 */
1381
1432
  ariaLabel?: string;
1382
1433
  }): JSX.Element;
1383
1434
 
@@ -1414,6 +1465,13 @@ declare type TooltipTriggerProps = {
1414
1465
 
1415
1466
  export declare type TriggerKind = 'default' | 'compact';
1416
1467
 
1468
+ export declare type UnknownTailPaginationProps = PaginationCommonProps & {
1469
+ total?: never;
1470
+ totalPages?: never;
1471
+ hasNextPage: boolean;
1472
+ showPageNumbers?: false;
1473
+ };
1474
+
1417
1475
  export declare function useCopy(): {
1418
1476
  copied: boolean;
1419
1477
  copy: (value: string, successMessage?: string) => Promise<void>;