klun-ui 0.7.0 → 0.7.2

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.
@@ -0,0 +1,877 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd';
4
+ import 'antd/es/checkbox/Group.js';
5
+ import 'antd/es/date-picker/index.js';
6
+ import 'antd/es/input/TextArea.js';
7
+
8
+ interface Locale {
9
+ /** BCP-47 language tag, e.g. `"en-US"`. */
10
+ locale: string;
11
+ datePicker: {
12
+ /** 12 month names (or numeric forms), January-first — as shown in the header. */
13
+ months: string[];
14
+ /** 7 short weekday labels, Monday-first. */
15
+ weekdaysShort: string[];
16
+ /** Calendar header template with `{month}` and `{year}` placeholders. */
17
+ title: string;
18
+ };
19
+ timePicker: {
20
+ am: string;
21
+ pm: string;
22
+ };
23
+ pagination: {
24
+ previous: string;
25
+ next: string;
26
+ };
27
+ modal: {
28
+ close: string;
29
+ maximize?: string;
30
+ restore?: string;
31
+ };
32
+ drawer: {
33
+ close: string;
34
+ };
35
+ alert: {
36
+ dismiss: string;
37
+ };
38
+ banner: {
39
+ dismiss: string;
40
+ };
41
+ toast: {
42
+ dismiss: string;
43
+ };
44
+ fileUpload: {
45
+ clickToUpload: string;
46
+ orDragAndDrop: string;
47
+ };
48
+ imageUpload: {
49
+ label: string;
50
+ remove: string;
51
+ hint: string;
52
+ };
53
+ passwordStrength: {
54
+ weak: string;
55
+ fair: string;
56
+ good: string;
57
+ strong: string;
58
+ };
59
+ /** `noResults` contains a `{query}` placeholder. */
60
+ commandMenu: {
61
+ placeholder: string;
62
+ esc: string;
63
+ noResults: string;
64
+ };
65
+ selectMenu: {
66
+ placeholder: string;
67
+ };
68
+ chip: {
69
+ remove: string;
70
+ };
71
+ tag: {
72
+ remove: string;
73
+ };
74
+ /** `star` contains a `{count}` placeholder. */
75
+ rating: {
76
+ star: string;
77
+ };
78
+ spinner: {
79
+ loading: string;
80
+ };
81
+ richEditorToolbar: {
82
+ bold: string;
83
+ italic: string;
84
+ underline: string;
85
+ strike: string;
86
+ h1: string;
87
+ h2: string;
88
+ quote: string;
89
+ code: string;
90
+ ul: string;
91
+ ol: string;
92
+ link: string;
93
+ image: string;
94
+ };
95
+ list: {
96
+ noData: string;
97
+ loading: string;
98
+ };
99
+ autoComplete: {
100
+ noResults: string;
101
+ };
102
+ cascader: {
103
+ placeholder: string;
104
+ };
105
+ popconfirm: {
106
+ title: string;
107
+ confirm: string;
108
+ cancel: string;
109
+ };
110
+ /** `goToSlide` has an `{n}` placeholder. */
111
+ carousel: {
112
+ previous: string;
113
+ next: string;
114
+ goToSlide: string;
115
+ };
116
+ input: {
117
+ clear: string;
118
+ };
119
+ notification: {
120
+ close: string;
121
+ };
122
+ /** Accessible name for a Select trigger that shows neither a value nor a visible placeholder. */
123
+ select?: {
124
+ placeholder?: string;
125
+ };
126
+ /** Accessible names for the CounterInput stepper buttons. */
127
+ counterInput?: {
128
+ decrease?: string;
129
+ increase?: string;
130
+ };
131
+ /** `minChars`/`maxChars` have `{min}`/`{max}`; `exactChars` has `{len}`; `oneOf` has `{values}`; `min`/`max` have `{min}`/`{max}`. */
132
+ form: {
133
+ required: string;
134
+ empty: string;
135
+ minChars: string;
136
+ maxChars: string;
137
+ exactChars: string;
138
+ oneOf: string;
139
+ invalidFormat: string;
140
+ email: string;
141
+ url: string;
142
+ number: string;
143
+ integer: string;
144
+ min: string;
145
+ max: string;
146
+ };
147
+ /** 多步流程的底栏按钮。此前 Wizard 把这三个词**硬编码成英文**,locale 里也没有对应键。 */
148
+ wizard: {
149
+ back: string;
150
+ next: string;
151
+ finish: string;
152
+ };
153
+ /**
154
+ * 组件内建的**无障碍名称**。
155
+ * 这些此前是硬编码英文 `aria-label`——消费方**无法覆盖**,读屏会直接念英文,
156
+ * 与「可被 props 覆盖的默认值」是两回事。
157
+ */
158
+ a11y: {
159
+ zoomIn: string;
160
+ zoomOut: string;
161
+ rotate: string;
162
+ collapseStart: string;
163
+ collapseEnd: string;
164
+ bulkActions: string;
165
+ clearSelection: string;
166
+ back: string;
167
+ };
168
+ /** 富文本编辑器的空态占位与编辑区无障碍名(此前是英文默认值)。 */
169
+ richEditor: {
170
+ placeholder: string;
171
+ editorLabel: string;
172
+ };
173
+ /** 复制按钮的默认提示。 */
174
+ copy: {
175
+ label: string;
176
+ };
177
+ /** 表情选择器:搜索占位、空态、以及触发按钮的名称。 */
178
+ emojiPicker: {
179
+ searchPlaceholder: string;
180
+ emptyText: string;
181
+ addReaction: string;
182
+ };
183
+ /** 侧边栏:搜索框占位与导航地标名(此前 `aria-label="Primary"` 是硬编码)。 */
184
+ sidebar: {
185
+ searchPlaceholder: string;
186
+ primary: string;
187
+ };
188
+ /**
189
+ * 图片查看器。仅 `reset`/`download` 需要新键;
190
+ * `previous`/`next` 复用 `pagination`,`close` 复用 `modal`——语义与文案一致,避免重复。
191
+ */
192
+ imageViewer: {
193
+ reset: string;
194
+ download: string;
195
+ };
196
+ /** `pageRange` has `{from}`/`{to}`/`{total}`; `perPage` has `{size}`. */
197
+ table: {
198
+ noData: string;
199
+ columns: string;
200
+ copy: string;
201
+ copyRow: string;
202
+ exportCsv: string;
203
+ filter: string;
204
+ expand: string;
205
+ collapse: string;
206
+ dragToReorder: string;
207
+ dragToResize: string;
208
+ editHint: string;
209
+ previous: string;
210
+ next: string;
211
+ pageRange: string;
212
+ perPage: string;
213
+ /** Accessible names for the built-in row-selection controls. */
214
+ selectRow?: string;
215
+ selectAll?: string;
216
+ };
217
+ }
218
+ /** Fill a `{placeholder}` template, e.g. `fmt(locale.rating.star, { count: 3 })`. */
219
+ declare function fmt(template: string, vars: Record<string, string | number>): string;
220
+ /** English (US) — the default locale used when no ConfigProvider is present. */
221
+ declare const enUS: Locale;
222
+ /** 简体中文 (Simplified Chinese). */
223
+ declare const zhCN: Locale;
224
+ /** 繁體中文 (Traditional Chinese). */
225
+ declare const zhTW: Locale;
226
+ /** 日本語 (Japanese). */
227
+ declare const jaJP: Locale;
228
+ /** 한국어 (Korean). */
229
+ declare const koKR: Locale;
230
+ /** Français (French). */
231
+ declare const frFR: Locale;
232
+ /** Deutsch (German). */
233
+ declare const deDE: Locale;
234
+ /** Español (Spanish). */
235
+ declare const esES: Locale;
236
+ /** Português (Brasil) (Brazilian Portuguese). */
237
+ declare const ptBR: Locale;
238
+ /** Русский (Russian). */
239
+ declare const ruRU: Locale;
240
+ /** العربية (Arabic). Pairs with `dir="rtl"` on the ConfigProvider. */
241
+ declare const arSA: Locale;
242
+ /** Italiano (Italian). */
243
+ declare const itIT: Locale;
244
+ /** Nederlands (Dutch). */
245
+ declare const nlNL: Locale;
246
+ /** Polski (Polish). */
247
+ declare const plPL: Locale;
248
+ /** Türkçe (Turkish). */
249
+ declare const trTR: Locale;
250
+ /** Tiếng Việt (Vietnamese). */
251
+ declare const viVN: Locale;
252
+ /** Bahasa Indonesia (Indonesian). */
253
+ declare const idID: Locale;
254
+ /** All built-in locales, keyed by their export name. */
255
+ declare const locales: {
256
+ enUS: Locale;
257
+ zhCN: Locale;
258
+ zhTW: Locale;
259
+ jaJP: Locale;
260
+ koKR: Locale;
261
+ frFR: Locale;
262
+ deDE: Locale;
263
+ esES: Locale;
264
+ ptBR: Locale;
265
+ ruRU: Locale;
266
+ arSA: Locale;
267
+ itIT: Locale;
268
+ nlNL: Locale;
269
+ plPL: Locale;
270
+ trTR: Locale;
271
+ viVN: Locale;
272
+ idID: Locale;
273
+ };
274
+
275
+ /**
276
+ * KDS 尺寸契约(size contract)——**每个组件尺寸的唯一来源**。
277
+ *
278
+ * 背景(KDS `01-foundations.md` §1.5 / `02-components.md` §2.2):
279
+ * 库在 0.6.0 之前有 **20 套互不相同的 size 取值集合**,全局 `ConfigProvider size`
280
+ * 只覆盖 25/137 个组件,于是「每个组件每一档多高」既无法一处定义,也无法机器校验。
281
+ * 本文件把这件事收成一张表:
282
+ *
283
+ * - `SIZE_CONTRACTS[组件名]` 声明该组件的自有档位、默认档位、以及
284
+ * **全局档位 → 自有档位**的映射;
285
+ * - 不跟随全局档位的组件必须写 `exempt`(理由),不允许"沉默地不跟随";
286
+ * - `resolveSize()` 是唯一的解析函数:**显式 prop > 全局档位 > 默认值**;
287
+ * - `scripts/kds-size-contract.mjs` 以本表为准做门禁:新增 size prop 而未登记、
288
+ * 登记了却不接解析器、或类型里出现未登记的档位值,都会失败。
289
+ *
290
+ * 规范档位(KDS §1.5 的控件阶梯)是 `SizeType`;全局档位 `GlobalSize` 少一档
291
+ * `xsmall`——`xsmall` 是"附属尺寸"(tiny / compact 动作),不做整库默认。
292
+ */
293
+ /** KDS §1.5 规范控件档位(由小到大)。 */
294
+ type SizeType = "xsmall" | "small" | "medium" | "large";
295
+ /** `ConfigProvider size` 的取值:全局默认档位(无 xsmall,见文件头说明)。 */
296
+ type GlobalSize = "small" | "medium" | "large";
297
+ /** 一条尺寸契约。 */
298
+ interface SizeContract<S extends string = string> {
299
+ /** 组件自有档位(由小到大),必须与组件 TS 里的 size 取值集合完全一致。 */
300
+ readonly scale: readonly S[];
301
+ /** 没有 prop、也没有全局档位时使用的档位;必须与组件此前的默认值一致。 */
302
+ readonly fallback: S;
303
+ /** 全局档位 → 自有档位。与 `exempt` 二选一。 */
304
+ readonly fromGlobal?: Readonly<Record<GlobalSize, S>>;
305
+ /** 不跟随全局档位时的理由(门禁要求非空)。与 `fromGlobal` 二选一。 */
306
+ readonly exempt?: string;
307
+ /**
308
+ * 本组件把尺寸**原样转发**给另一个已登记组件(如 CheckboxGroup → Checkbox),
309
+ * 由被转发方解析全局档位。门禁接受这种形态,但要求实现里确有该转发。
310
+ * (用 string 而非 SizeContractName,避免与 `keyof typeof SIZE_CONTRACTS` 形成循环。)
311
+ */
312
+ readonly inherits?: string;
313
+ /** 规范档位视图,供规格文档使用;不填则由 `fromGlobal` 反推。 */
314
+ readonly tiers?: Readonly<Partial<Record<SizeType, S>>>;
315
+ /**
316
+ * 同一个文件里**其它**组件的尺寸刻度(如 `Button.tsx` 的 fancy/compact/link 变体)。
317
+ * 它们不参与全局档位解析,但门禁要求显式登记——避免"文件里还藏着第二套刻度"。
318
+ */
319
+ readonly extraScales?: ReadonlyArray<readonly S[]>;
320
+ }
321
+ declare const SIZE_CONTRACTS: {
322
+ readonly Button: {
323
+ readonly scale: readonly ["tiny", "xsmall", "small", "medium", "large"];
324
+ readonly fallback: "medium";
325
+ readonly fromGlobal: {
326
+ readonly small: "small";
327
+ readonly medium: "medium";
328
+ readonly large: "large";
329
+ };
330
+ readonly tiers: {
331
+ readonly xsmall: "xsmall";
332
+ readonly small: "small";
333
+ readonly medium: "medium";
334
+ readonly large: "large";
335
+ };
336
+ readonly extraScales: readonly [readonly ["small", "medium", "large"], readonly ["small", "medium"]];
337
+ };
338
+ readonly ButtonGroup: {
339
+ readonly scale: readonly ["small", "medium", "large"];
340
+ readonly fallback: "medium";
341
+ readonly fromGlobal: {
342
+ readonly small: "small";
343
+ readonly medium: "medium";
344
+ readonly large: "large";
345
+ };
346
+ };
347
+ readonly Input: {
348
+ readonly scale: readonly ["xsmall", "small", "medium", "large"];
349
+ readonly fallback: "medium";
350
+ readonly fromGlobal: {
351
+ readonly small: "small";
352
+ readonly medium: "medium";
353
+ readonly large: "large";
354
+ };
355
+ readonly tiers: {
356
+ readonly xsmall: "xsmall";
357
+ readonly small: "small";
358
+ readonly medium: "medium";
359
+ readonly large: "large";
360
+ };
361
+ };
362
+ readonly Select: {
363
+ readonly scale: readonly ["xsmall", "small", "medium", "large"];
364
+ readonly fallback: "medium";
365
+ readonly fromGlobal: {
366
+ readonly small: "small";
367
+ readonly medium: "medium";
368
+ readonly large: "large";
369
+ };
370
+ readonly tiers: {
371
+ readonly xsmall: "xsmall";
372
+ readonly small: "small";
373
+ readonly medium: "medium";
374
+ readonly large: "large";
375
+ };
376
+ };
377
+ readonly Textarea: {
378
+ readonly scale: readonly ["xsmall", "small", "medium", "large"];
379
+ readonly fallback: "medium";
380
+ readonly fromGlobal: {
381
+ readonly small: "small";
382
+ readonly medium: "medium";
383
+ readonly large: "large";
384
+ };
385
+ };
386
+ readonly AutoComplete: {
387
+ readonly scale: readonly ["small", "medium", "large"];
388
+ readonly fallback: "medium";
389
+ readonly fromGlobal: {
390
+ readonly small: "small";
391
+ readonly medium: "medium";
392
+ readonly large: "large";
393
+ };
394
+ };
395
+ readonly Cascader: {
396
+ readonly scale: readonly ["small", "medium", "large"];
397
+ readonly fallback: "medium";
398
+ readonly fromGlobal: {
399
+ readonly small: "small";
400
+ readonly medium: "medium";
401
+ readonly large: "large";
402
+ };
403
+ };
404
+ readonly SelectMenu: {
405
+ readonly scale: readonly ["small", "medium", "large"];
406
+ readonly fallback: "medium";
407
+ readonly fromGlobal: {
408
+ readonly small: "small";
409
+ readonly medium: "medium";
410
+ readonly large: "large";
411
+ };
412
+ };
413
+ readonly CounterInput: {
414
+ readonly scale: readonly ["small", "medium", "large"];
415
+ readonly fallback: "medium";
416
+ readonly fromGlobal: {
417
+ readonly small: "small";
418
+ readonly medium: "medium";
419
+ readonly large: "large";
420
+ };
421
+ };
422
+ readonly DigitInput: {
423
+ readonly scale: readonly ["small", "medium", "large"];
424
+ readonly fallback: "medium";
425
+ readonly fromGlobal: {
426
+ readonly small: "small";
427
+ readonly medium: "medium";
428
+ readonly large: "large";
429
+ };
430
+ };
431
+ readonly CronEditor: {
432
+ readonly scale: readonly ["small", "medium"];
433
+ readonly fallback: "medium";
434
+ readonly fromGlobal: {
435
+ readonly small: "small";
436
+ readonly medium: "medium";
437
+ readonly large: "medium";
438
+ };
439
+ };
440
+ readonly Checkbox: {
441
+ readonly scale: readonly ["small", "medium", "large"];
442
+ readonly fallback: "medium";
443
+ readonly fromGlobal: {
444
+ readonly small: "small";
445
+ readonly medium: "medium";
446
+ readonly large: "large";
447
+ };
448
+ };
449
+ readonly Radio: {
450
+ readonly scale: readonly ["small", "medium", "large"];
451
+ readonly fallback: "medium";
452
+ readonly fromGlobal: {
453
+ readonly small: "small";
454
+ readonly medium: "medium";
455
+ readonly large: "large";
456
+ };
457
+ };
458
+ readonly Switch: {
459
+ readonly scale: readonly ["small", "medium", "large"];
460
+ readonly fallback: "medium";
461
+ readonly fromGlobal: {
462
+ readonly small: "small";
463
+ readonly medium: "medium";
464
+ readonly large: "large";
465
+ };
466
+ };
467
+ readonly Slider: {
468
+ readonly scale: readonly ["small", "medium", "large"];
469
+ readonly fallback: "medium";
470
+ readonly fromGlobal: {
471
+ readonly small: "small";
472
+ readonly medium: "medium";
473
+ readonly large: "large";
474
+ };
475
+ };
476
+ readonly RangeSlider: {
477
+ readonly scale: readonly ["sm", "md", "lg"];
478
+ readonly fallback: "md";
479
+ readonly fromGlobal: {
480
+ readonly small: "sm";
481
+ readonly medium: "md";
482
+ readonly large: "lg";
483
+ };
484
+ readonly tiers: {
485
+ readonly small: "sm";
486
+ readonly medium: "md";
487
+ readonly large: "lg";
488
+ };
489
+ };
490
+ readonly ColorSlider: {
491
+ readonly scale: readonly ["small", "medium", "large"];
492
+ readonly fallback: "medium";
493
+ readonly fromGlobal: {
494
+ readonly small: "small";
495
+ readonly medium: "medium";
496
+ readonly large: "large";
497
+ };
498
+ };
499
+ readonly HorizontalFilter: {
500
+ readonly scale: readonly ["small", "medium"];
501
+ readonly fallback: "medium";
502
+ readonly fromGlobal: {
503
+ readonly small: "small";
504
+ readonly medium: "medium";
505
+ readonly large: "medium";
506
+ };
507
+ };
508
+ readonly CompactSelect: {
509
+ readonly scale: readonly ["xsmall", "small", "medium"];
510
+ readonly fallback: "small";
511
+ readonly fromGlobal: {
512
+ readonly small: "small";
513
+ readonly medium: "medium";
514
+ readonly large: "medium";
515
+ };
516
+ };
517
+ readonly CompactSelectForInput: {
518
+ readonly scale: readonly ["small", "medium", "large"];
519
+ readonly fallback: "small";
520
+ readonly fromGlobal: {
521
+ readonly small: "small";
522
+ readonly medium: "medium";
523
+ readonly large: "large";
524
+ };
525
+ };
526
+ readonly ColorDot: {
527
+ readonly scale: readonly ["sm", "md", "lg"];
528
+ readonly fallback: "md";
529
+ readonly fromGlobal: {
530
+ readonly small: "sm";
531
+ readonly medium: "md";
532
+ readonly large: "lg";
533
+ };
534
+ readonly tiers: {
535
+ readonly small: "sm";
536
+ readonly medium: "md";
537
+ readonly large: "lg";
538
+ };
539
+ };
540
+ readonly Badge: {
541
+ readonly scale: readonly ["small", "medium"];
542
+ readonly fallback: "medium";
543
+ readonly fromGlobal: {
544
+ readonly small: "small";
545
+ readonly medium: "medium";
546
+ readonly large: "medium";
547
+ };
548
+ readonly tiers: {
549
+ readonly xsmall: "small";
550
+ readonly small: "small";
551
+ readonly medium: "medium";
552
+ readonly large: "medium";
553
+ };
554
+ };
555
+ readonly StatusBadge: {
556
+ readonly scale: readonly ["small", "medium"];
557
+ readonly fallback: "medium";
558
+ readonly fromGlobal: {
559
+ readonly small: "small";
560
+ readonly medium: "medium";
561
+ readonly large: "medium";
562
+ };
563
+ };
564
+ readonly ChartLegend: {
565
+ readonly scale: readonly ["sm", "md"];
566
+ readonly fallback: "md";
567
+ readonly fromGlobal: {
568
+ readonly small: "sm";
569
+ readonly medium: "md";
570
+ readonly large: "md";
571
+ };
572
+ };
573
+ readonly ContentLabel: {
574
+ readonly scale: readonly ["sm", "md"];
575
+ readonly fallback: "md";
576
+ readonly fromGlobal: {
577
+ readonly small: "sm";
578
+ readonly medium: "md";
579
+ readonly large: "md";
580
+ };
581
+ };
582
+ readonly GaugeBar: {
583
+ readonly scale: readonly ["sm", "md", "lg"];
584
+ readonly fallback: "md";
585
+ readonly fromGlobal: {
586
+ readonly small: "sm";
587
+ readonly medium: "md";
588
+ readonly large: "lg";
589
+ };
590
+ };
591
+ readonly KeyIcon: {
592
+ readonly scale: readonly ["xs", "sm", "md", "lg", "xl"];
593
+ readonly fallback: "md";
594
+ readonly fromGlobal: {
595
+ readonly small: "sm";
596
+ readonly medium: "md";
597
+ readonly large: "lg";
598
+ };
599
+ };
600
+ readonly Money: {
601
+ readonly scale: readonly ["sm", "md", "lg", "big"];
602
+ readonly fallback: "md";
603
+ readonly fromGlobal: {
604
+ readonly small: "sm";
605
+ readonly medium: "md";
606
+ readonly large: "lg";
607
+ };
608
+ };
609
+ readonly StatusDot: {
610
+ readonly scale: readonly ["xs", "sm", "md", "lg"];
611
+ readonly fallback: "sm";
612
+ readonly fromGlobal: {
613
+ readonly small: "sm";
614
+ readonly medium: "md";
615
+ readonly large: "lg";
616
+ };
617
+ };
618
+ readonly Item: {
619
+ readonly scale: readonly ["default", "small", "xsmall"];
620
+ readonly fallback: "default";
621
+ readonly fromGlobal: {
622
+ readonly small: "small";
623
+ readonly medium: "default";
624
+ readonly large: "default";
625
+ };
626
+ };
627
+ readonly Toggle: {
628
+ readonly scale: readonly ["small", "medium", "large"];
629
+ readonly fallback: "medium";
630
+ readonly fromGlobal: {
631
+ readonly small: "small";
632
+ readonly medium: "medium";
633
+ readonly large: "large";
634
+ };
635
+ };
636
+ readonly CopyButton: {
637
+ readonly scale: readonly ["sm", "md", "lg"];
638
+ readonly fallback: "md";
639
+ readonly fromGlobal: {
640
+ readonly small: "sm";
641
+ readonly medium: "md";
642
+ readonly large: "lg";
643
+ };
644
+ };
645
+ readonly CheckboxGroup: {
646
+ readonly scale: readonly ["small", "medium", "large"];
647
+ readonly fallback: "medium";
648
+ readonly fromGlobal: {
649
+ readonly small: "small";
650
+ readonly medium: "medium";
651
+ readonly large: "large";
652
+ };
653
+ readonly inherits: "Checkbox";
654
+ };
655
+ readonly Statistic: {
656
+ readonly scale: readonly ["small", "medium", "large"];
657
+ readonly fallback: "medium";
658
+ readonly fromGlobal: {
659
+ readonly small: "small";
660
+ readonly medium: "medium";
661
+ readonly large: "large";
662
+ };
663
+ };
664
+ readonly Descriptions: {
665
+ readonly scale: readonly ["small", "medium", "large"];
666
+ readonly fallback: "medium";
667
+ readonly fromGlobal: {
668
+ readonly small: "small";
669
+ readonly medium: "medium";
670
+ readonly large: "large";
671
+ };
672
+ };
673
+ readonly List: {
674
+ readonly scale: readonly ["small", "medium", "large"];
675
+ readonly fallback: "medium";
676
+ readonly fromGlobal: {
677
+ readonly small: "small";
678
+ readonly medium: "medium";
679
+ readonly large: "large";
680
+ };
681
+ };
682
+ readonly Avatar: {
683
+ readonly scale: readonly ["20", "24", "32", "40", "48", "56", "64", "72", "80"];
684
+ readonly fallback: "40";
685
+ readonly exempt: string;
686
+ };
687
+ readonly ActorAvatar: {
688
+ readonly scale: readonly ["20", "24", "32", "40", "56"];
689
+ readonly fallback: "24";
690
+ readonly exempt: "同 Avatar:像素刻度,不是控件档位。";
691
+ };
692
+ readonly AvatarGroup: {
693
+ readonly scale: readonly ["24", "32", "40", "48"];
694
+ readonly fallback: "40";
695
+ readonly exempt: "同 Avatar:像素刻度(决定叠加头像与 +N 徽标的直径)。";
696
+ };
697
+ readonly Space: {
698
+ readonly scale: readonly ["none", "xs", "sm", "md", "lg", "xl", "2xl"];
699
+ readonly fallback: "md";
700
+ readonly exempt: "这是**间距刻度**(gap),不是控件尺寸;KDS §1.4 的空间阶与控件档位是两条轴。";
701
+ };
702
+ readonly InputGroup: {
703
+ readonly scale: readonly ["xsmall", "icon-xsmall", "icon-small"];
704
+ readonly fallback: "xsmall";
705
+ readonly exempt: "该 size 描述的是组内嵌按钮的变体(含 icon-* 形态),不是控件高度档位。";
706
+ };
707
+ readonly Drawer: {
708
+ readonly scale: readonly ["default", "large"];
709
+ readonly fallback: "default";
710
+ readonly exempt: "宽度档位(480/640/800 口径),不是控件尺寸;浮层宽度由任务决定,不随全局 size 漂移。";
711
+ };
712
+ readonly CircularProgress: {
713
+ readonly scale: readonly ["number"];
714
+ readonly fallback: "number";
715
+ readonly exempt: "数值直径(px),由调用方按容器给定。";
716
+ };
717
+ readonly ImageUpload: {
718
+ readonly scale: readonly ["number"];
719
+ readonly fallback: "number";
720
+ readonly exempt: "数值边长(px),由调用方按容器给定。";
721
+ };
722
+ readonly Rating: {
723
+ readonly scale: readonly ["number"];
724
+ readonly fallback: "number";
725
+ readonly exempt: "数值星标字号(px)。";
726
+ };
727
+ readonly Spinner: {
728
+ readonly scale: readonly ["number"];
729
+ readonly fallback: "number";
730
+ readonly exempt: "数值直径(px);命名档位见 SpinnerSize,由调用方按容器选定。";
731
+ };
732
+ readonly Splitter: {
733
+ readonly scale: readonly ["number"];
734
+ readonly fallback: "number";
735
+ readonly exempt: "分割条厚度/尺寸,接受数值或 CSS 长度,属布局量而非控件档位。";
736
+ };
737
+ };
738
+ type SizeContractName = keyof typeof SIZE_CONTRACTS;
739
+ /** 取某个组件契约里的档位联合类型。 */
740
+ type ContractSize<K extends SizeContractName> = (typeof SIZE_CONTRACTS)[K] extends SizeContract<infer S> ? S : never;
741
+ /**
742
+ * 唯一的尺寸解析入口:**显式 prop > 全局档位 > 组件默认值**。
743
+ * 组件实现不应该再自己写 `size ?? "medium"`。
744
+ */
745
+ declare function resolveSize<K extends SizeContractName>(name: K, explicit: ContractSize<K> | undefined, global: GlobalSize | undefined): ContractSize<K>;
746
+ /** 规格文档用:组件在某规范档位下的自有档位(无对应档位返回 undefined)。 */
747
+ declare function tierOf<K extends SizeContractName>(name: K, tier: SizeType): ContractSize<K> | undefined;
748
+
749
+ /** Global default size for components whose scale includes these values. */
750
+ type ComponentSize = GlobalSize;
751
+ type AntdConfig = Omit<ConfigProviderProps$1, "children">;
752
+ type PickerDefaults = Pick<AntdConfig, "treeSelect" | "colorPicker" | "datePicker" | "rangePicker" | "getPopupContainer" | "prefixCls">;
753
+ /** Text direction. */
754
+ type Direction = "ltr" | "rtl";
755
+ /** Color scheme. */
756
+ type Theme = "light" | "dark";
757
+ /**
758
+ * Accent / primary color ramp (maps to the design system's `data-mode`).
759
+ * `"metronic"` is a full Metronic 9.0 skin — it re-points the whole semantic
760
+ * palette (surfaces, text, strokes, intents, radii) onto Metronic colors, not
761
+ * just the primary ramp. Orthogonal to `theme`, so it works in light and dark.
762
+ */
763
+ type Accent = "blue" | "purple" | "orange" | "green" | "slate" | "metronic" | "kk";
764
+ /**
765
+ * Global corner-radius scale (maps to `data-radius`). `"square"` = 0-radius
766
+ * (sharp) corners, `"sharp"` = tight, `"rounded"` = soft. The functional pill
767
+ * radius (round avatars / switches / pill badges) is always preserved.
768
+ */
769
+ type Radius = "default" | "sharp" | "square" | "rounded";
770
+ /**
771
+ * Global control density (maps to `data-density`).
772
+ *
773
+ * - `"compact"` 把每条控件尺寸 token 下移一档,用于密集后台/工具栏/数据表;
774
+ * - `"kk"` 是 kk 控制台的紧凑尺度(2xs…xl = 18/20/24/28/32/36),第 62 批从
775
+ * `[data-mode="kk"]` 皮肤里搬出来成为**显式密度轴**——皮肤不再顺带改几何,
776
+ * `size` 因此成为跨皮肤稳定的契约。
777
+ *
778
+ * `size` props 在这两条密度上照常生效。
779
+ */
780
+ type Density = "default" | "compact" | "kk";
781
+ interface KlunConfig extends PickerDefaults {
782
+ /** Active locale dictionary. */
783
+ locale: Locale;
784
+ /** Default size applied to components that receive no explicit `size` prop. */
785
+ size?: ComponentSize;
786
+ /** Text direction. */
787
+ dir: Direction;
788
+ /** Color scheme. `undefined` inherits the document/default (light) theme. */
789
+ theme?: Theme;
790
+ /** Accent (primary) color ramp. `undefined` inherits the default (blue). */
791
+ accent?: Accent;
792
+ /** Global corner-radius scale. `undefined` inherits the default. */
793
+ radius?: Radius;
794
+ /** Control density. `"compact"` shrinks every control one tier. */
795
+ density?: Density;
796
+ /** Custom primary color (e.g. a hex). Overrides `accent`; a shade/tint ramp is derived. */
797
+ primaryColor?: string;
798
+ /** Native Ant Design defaults and theme overrides. */
799
+ antd?: AntdConfig;
800
+ }
801
+ /**
802
+ * Derive the `--klun-primary-*` token ramp from a single base color. A hex input
803
+ * produces the full shade/tint ramp + alpha tints; any other CSS color sets just
804
+ * the base. Used by ConfigProvider's `primaryColor`, exported for manual use.
805
+ */
806
+ declare function primaryColorVars(color: string): Record<string, string>;
807
+ interface ConfigProviderProps extends PickerDefaults {
808
+ /** Locale dictionary. Defaults to `enUS` (or the nearest parent provider's). */
809
+ locale?: Locale;
810
+ /** Global default component size. */
811
+ size?: ComponentSize;
812
+ /** Text direction. Default `"ltr"`. */
813
+ dir?: Direction;
814
+ /** Color scheme applied to the subtree (`light` | `dark`). */
815
+ theme?: Theme;
816
+ /** Accent (primary) color ramp applied to the subtree. */
817
+ accent?: Accent;
818
+ /** Global corner-radius scale applied to the subtree. */
819
+ radius?: Radius;
820
+ /** Control density applied to the subtree (`"compact"` shrinks controls one tier). */
821
+ density?: Density;
822
+ /** Custom primary color (e.g. a hex). Overrides `accent`; a ramp is derived. */
823
+ primaryColor?: string;
824
+ /** Native Ant Design defaults and theme overrides. */
825
+ antd?: AntdConfig;
826
+ children?: ReactNode;
827
+ }
828
+ /**
829
+ * ConfigProvider — supplies a global locale, default size, text direction and
830
+ * theme/accent to the klun-ui components rendered below it. Values are inherited
831
+ * from a parent provider when present, so providers can be nested to scope
832
+ * overrides. `theme`/`accent`/`radius`/`density` set
833
+ * `data-theme`/`data-mode`/`data-radius`/`data-density` on the wrapper, which
834
+ * re-points the design tokens for the whole subtree; `primaryColor` overrides the
835
+ * accent with a ramp derived from any hex. Without any provider, components fall
836
+ * back to en-US / ltr / default theme, so usage is fully optional.
837
+ */
838
+ declare function ConfigProvider({ locale, size, dir, theme, accent, radius, density, primaryColor, antd, treeSelect, colorPicker, datePicker, rangePicker, prefixCls, getPopupContainer, children, }: ConfigProviderProps): react.JSX.Element;
839
+ declare namespace ConfigProvider {
840
+ var displayName: string;
841
+ }
842
+ /** Read the full klun-ui config from the nearest provider (or built-in defaults). */
843
+ declare function useConfig(): KlunConfig;
844
+ /** Read the active locale dictionary. */
845
+ declare function useLocale(): Locale;
846
+ /**
847
+ * Resolve a component's size: explicit prop wins, then the provider's global
848
+ * `size`, then `"medium"`. Returns the explicit prop's own size type.
849
+ */
850
+ declare function useSize<S extends string = ComponentSize>(explicit?: S): S;
851
+ /**
852
+ * Resolve a size for a component whose own scale differs from the global one —
853
+ * it lacks a tier (e.g. no `large`) or uses different names (`sm`/`md`/`lg`).
854
+ * `explicit` wins; otherwise the provider's global size is translated through
855
+ * `map` (which clamps/renames each global tier to a value this component
856
+ * supports); with no provider size it returns `fallback`.
857
+ */
858
+ declare function useMappedSize<S extends string>(explicit: S | undefined, map: Record<ComponentSize, S>, fallback: S): S;
859
+ /**
860
+ * 按 **KDS 尺寸契约**解析组件档位(映射表在 `./size.ts` 的 `SIZE_CONTRACTS`)。
861
+ *
862
+ * 与 `useSize` / `useMappedSize` 的区别:后两者的映射散落在每个组件里,且只覆盖
863
+ * 25 个组件;`useScaleSize` 把映射收进一张表,由 `scripts/kds-size-contract.mjs`
864
+ * 门禁保证「每个 size prop 都被登记、每个登记的组件都真的走这里」。
865
+ *
866
+ * 解析顺序:**显式 prop > 全局 `ConfigProvider size` > 组件默认值**。
867
+ */
868
+ declare function useScaleSize<K extends SizeContractName>(name: K, explicit?: ContractSize<K>): ContractSize<K>;
869
+ /**
870
+ * 解析当前生效的控件密度:**Provider 优先 > 文档根 `data-density` > `"default"`**。
871
+ *
872
+ * JS 侧需要知道密度的组件(目前是 Table 的密度继承)必须用这个 hook,
873
+ * 不要直接读 `useConfig().density`——那会漏掉 `<html data-density="…">` 这条通道。
874
+ */
875
+ declare function useDensity(): Density;
876
+
877
+ export { type Accent as A, trTR as B, type ComponentSize as C, type Density as D, useConfig as E, useDensity as F, type GlobalSize as G, useLocale as H, useMappedSize as I, useScaleSize as J, type KlunConfig as K, type Locale as L, useSize as M, viVN as N, zhCN as O, zhTW as P, type Radius as R, SIZE_CONTRACTS as S, type Theme as T, type AntdConfig as a, ConfigProvider as b, type ConfigProviderProps as c, type ContractSize as d, type Direction as e, type SizeContract as f, type SizeContractName as g, type SizeType as h, arSA as i, deDE as j, enUS as k, esES as l, fmt as m, frFR as n, idID as o, itIT as p, jaJP as q, koKR as r, locales as s, nlNL as t, plPL as u, primaryColorVars as v, ptBR as w, resolveSize as x, ruRU as y, tierOf as z };