@chaos_team/chaos-ui 1.0.5

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +286 -0
  2. package/LICENSE +21 -0
  3. package/README.md +295 -0
  4. package/THIRD_PARTY_NOTICES.md +22 -0
  5. package/dist/business.cjs +26 -0
  6. package/dist/business.d.cts +10311 -0
  7. package/dist/business.d.ts +10311 -0
  8. package/dist/business.js +26 -0
  9. package/dist/format-BUpOzeCo.d.cts +8 -0
  10. package/dist/format-BUpOzeCo.d.ts +8 -0
  11. package/dist/hooks.cjs +8 -0
  12. package/dist/hooks.d.cts +1148 -0
  13. package/dist/hooks.d.ts +1148 -0
  14. package/dist/hooks.js +8 -0
  15. package/dist/index.cjs +6 -0
  16. package/dist/index.d.cts +5616 -0
  17. package/dist/index.d.ts +5616 -0
  18. package/dist/index.js +6 -0
  19. package/dist/lib.cjs +42 -0
  20. package/dist/lib.d.cts +804 -0
  21. package/dist/lib.d.ts +804 -0
  22. package/dist/lib.js +42 -0
  23. package/dist/message-KJli9tvf.d.cts +71 -0
  24. package/dist/message-KJli9tvf.d.ts +71 -0
  25. package/dist/message-provider-BI-P3CNq.d.cts +11 -0
  26. package/dist/message-provider-BI-P3CNq.d.ts +11 -0
  27. package/dist/next.cjs +6 -0
  28. package/dist/next.d.cts +103 -0
  29. package/dist/next.d.ts +103 -0
  30. package/dist/next.js +6 -0
  31. package/dist/theme-toggle-JL_jZE-w.d.cts +81 -0
  32. package/dist/theme-toggle-JL_jZE-w.d.ts +81 -0
  33. package/dist/time-picker-H1AaecnE.d.cts +452 -0
  34. package/dist/time-picker-H1AaecnE.d.ts +452 -0
  35. package/dist/ui/icons.cjs +6 -0
  36. package/dist/ui/icons.d.cts +3 -0
  37. package/dist/ui/icons.d.ts +3 -0
  38. package/dist/ui/icons.js +6 -0
  39. package/dist/ui-icons.cjs +6 -0
  40. package/dist/ui-icons.d.cts +205 -0
  41. package/dist/ui-icons.d.ts +205 -0
  42. package/dist/ui-icons.js +6 -0
  43. package/dist/ui.cjs +6 -0
  44. package/dist/ui.d.cts +39 -0
  45. package/dist/ui.d.ts +39 -0
  46. package/dist/ui.js +6 -0
  47. package/package.json +265 -0
  48. package/styles.css +1300 -0
  49. package/styles.css.d.ts +11 -0
@@ -0,0 +1,452 @@
1
+ import * as React from 'react';
2
+ import * as Lucide from 'lucide-react';
3
+ import * as class_variance_authority_types from 'class-variance-authority/types';
4
+ import { Button as Button$1 } from '@base-ui/react/button';
5
+ import { VariantProps } from 'class-variance-authority';
6
+
7
+ /**
8
+ * @component Transfer
9
+ * @category ui/data-entry
10
+ * @since 0.2.0
11
+ * @description Dual-panel shuttle component for moving items between source and target lists. Supports search, select-all, one-way mode, i18n, disabled state, and custom render functions. / 双栏穿梭框,支持搜索、全选、单向模式、国际化、禁用状态和自定义渲染。
12
+ * @keywords transfer, shuttle, dual-panel, selection, move, assign
13
+ * @example
14
+ * <Transfer
15
+ * dataSource={items}
16
+ * targetKeys={selected}
17
+ * onChange={setSelected}
18
+ * titles={["Available", "Selected"]}
19
+ * />
20
+ */
21
+ interface TransferItem {
22
+ key: string;
23
+ label: string;
24
+ description?: string;
25
+ disabled?: boolean;
26
+ }
27
+ interface TransferProps {
28
+ dataSource: TransferItem[];
29
+ targetKeys?: string[];
30
+ onChange?: (targetKeys: string[]) => void;
31
+ titles?: [string, string];
32
+ searchable?: boolean;
33
+ filterOption?: (input: string, item: TransferItem) => boolean;
34
+ render?: (item: TransferItem) => React.ReactNode;
35
+ disabled?: boolean;
36
+ className?: string;
37
+ oneWay?: boolean;
38
+ }
39
+ declare function Transfer({ dataSource, targetKeys, onChange, titles: titlesProp, searchable, filterOption, render, disabled, className, oneWay, }: TransferProps): React.JSX.Element;
40
+
41
+ declare const buttonVariants: (props?: ({
42
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
43
+ size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
44
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
45
+ type ButtonProps = Button$1.Props & VariantProps<typeof buttonVariants> & {
46
+ /** Leading icon, rendered before children / 前置图标 */
47
+ icon?: React.ReactNode;
48
+ /** Trailing icon, rendered after children / 后置图标 */
49
+ iconRight?: React.ReactNode;
50
+ };
51
+ /**
52
+ * @component Button
53
+ * @category ui/primitives
54
+ * @since 0.2.0
55
+ * @description Interactive button with multiple variants, sizes, and icon support / 交互按钮,支持多种变体、尺寸和图标
56
+ * @keywords button, action, submit, click, icon
57
+ * @example
58
+ * <Button variant="default" size="default">Click me</Button>
59
+ * <Button variant="outline" icon={<SettingsIcon />}>Settings</Button>
60
+ */
61
+ declare function Button({ className, variant, size, icon, iconRight, children, ...props }: ButtonProps): React.JSX.Element;
62
+
63
+ interface ComboboxOption {
64
+ value: string;
65
+ label: string;
66
+ description?: string;
67
+ disabled?: boolean;
68
+ keywords?: string[];
69
+ group?: string;
70
+ }
71
+ interface ComboboxProps {
72
+ options: ComboboxOption[];
73
+ value?: string;
74
+ onChange?: (value: string | undefined) => void;
75
+ placeholder?: string;
76
+ searchPlaceholder?: string;
77
+ emptyText?: string;
78
+ disabled?: boolean;
79
+ className?: string;
80
+ align?: "start" | "center" | "end";
81
+ clearable?: boolean;
82
+ searchable?: boolean;
83
+ renderOption?: (option: ComboboxOption) => React.ReactNode;
84
+ }
85
+ /**
86
+ * @component Combobox
87
+ * @category ui/data-entry
88
+ * @since 0.2.0
89
+ * @description Searchable select dropdown with keyboard navigation and clearable selection / 带搜索、键盘导航和可清除选择的下拉选择框
90
+ * @keywords combobox, select, search, autocomplete, dropdown
91
+ * @example
92
+ * <Combobox
93
+ * options={[{ value: "react", label: "React" }]}
94
+ * value={selected}
95
+ * onChange={setSelected}
96
+ * />
97
+ */
98
+ declare function Combobox({ options, value, onChange, placeholder, searchPlaceholder, emptyText, disabled, className, align, clearable, searchable, renderOption, }: ComboboxProps): React.JSX.Element;
99
+
100
+ declare const variantConfig: {
101
+ default: {
102
+ icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
103
+ };
104
+ search: {
105
+ icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
106
+ };
107
+ error: {
108
+ icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
109
+ };
110
+ network: {
111
+ icon: React.ForwardRefExoticComponent<Omit<Lucide.LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
112
+ };
113
+ };
114
+ interface EmptyStateTexts {
115
+ title?: string;
116
+ description?: string;
117
+ }
118
+ interface EmptyStateProps {
119
+ variant?: string;
120
+ icon?: React.ElementType;
121
+ title?: string;
122
+ description?: string;
123
+ action?: React.ReactNode;
124
+ className?: string;
125
+ centered?: boolean;
126
+ fullPage?: boolean;
127
+ /**
128
+ * Override i18n strings. When provided, useTranslation is skipped.
129
+ * / 覆盖 i18n 字符串,传入后跳过 useTranslation
130
+ */
131
+ texts?: EmptyStateTexts;
132
+ }
133
+ /**
134
+ * @component EmptyState
135
+ * @category ui/feedback
136
+ * @since 0.2.0
137
+ * @description Placeholder displayed when data is empty, with icon, title, description, and optional action / 数据为空时显示的占位符,含图标、标题、描述和可选操作
138
+ * @keywords empty, state, placeholder, no-data, feedback, zero-state
139
+ * @example
140
+ * <EmptyState variant="search" title="No results" description="Try a different query" />
141
+ */
142
+ declare function EmptyState({ variant, icon: iconProp, title: titleProp, description: descProp, action, className, centered, fullPage, texts: textsProp, }: EmptyStateProps): React.JSX.Element;
143
+
144
+ interface FabProps extends React.ComponentProps<typeof Button> {
145
+ icon?: React.ReactNode;
146
+ label?: string;
147
+ position?: "bottom-right" | "bottom-left" | "bottom-center";
148
+ offset?: number;
149
+ }
150
+ /**
151
+ * @component Fab
152
+ * @category ui/primitives
153
+ * @since 0.2.0
154
+ * @description Floating Action Button fixed to the screen edge for primary actions / 固定在屏幕边缘的浮动操作按钮,用于主要操作
155
+ * @keywords fab, floating, action, button, fixed
156
+ * @example
157
+ * <Fab icon={<PlusIcon />} position="bottom-right" />
158
+ */
159
+ declare function Fab({ icon, label, position, offset, className, ...props }: FabProps): React.JSX.Element;
160
+ interface FabSpeedDialAction {
161
+ icon: React.ReactNode;
162
+ label: string;
163
+ onClick?: () => void;
164
+ }
165
+ interface FabSpeedDialProps {
166
+ icon: React.ReactNode;
167
+ actions: FabSpeedDialAction[];
168
+ position?: "bottom-right" | "bottom-left";
169
+ }
170
+ /**
171
+ * @component FabSpeedDial
172
+ * @category ui/primitives
173
+ * @since 0.2.0
174
+ * @description Floating action button that expands into a radial menu of speed-dial actions / 展开为放射状快捷菜单的浮动操作按钮
175
+ * @keywords fab, speed-dial, radial, menu, floating, actions
176
+ * @example
177
+ * <FabSpeedDial icon={<PlusIcon />} actions={[{ icon: <EditIcon />, label: "Edit", onClick: () => {} }]} />
178
+ */
179
+ declare function FabSpeedDial({ icon, actions, position, }: FabSpeedDialProps): React.JSX.Element;
180
+ interface BackTopProps {
181
+ threshold?: number;
182
+ target?: React.RefObject<HTMLElement | null>;
183
+ className?: string;
184
+ }
185
+ /**
186
+ * @component BackTop
187
+ * @category ui/primitives
188
+ * @since 0.2.0
189
+ * @description Button that appears after scrolling past a threshold, scrolls back to top / 滚动超过阈值后出现的返回顶部按钮
190
+ * @keywords back-top, scroll, top, button, navigation
191
+ * @example
192
+ * <BackTop threshold={300} />
193
+ */
194
+ declare function BackTop({ threshold, target, className }: BackTopProps): React.JSX.Element | null;
195
+
196
+ /**
197
+ * @component Card
198
+ * @category ui/shell
199
+ * @since 0.2.0
200
+ * @description A container component with header, content, and footer slots for structured content / 带有标题、内容和底部插槽的结构化容器组件
201
+ * @keywords card, container, panel, shell
202
+ * @example
203
+ * <Card>
204
+ * <CardHeader><CardTitle>Title</CardTitle></CardHeader>
205
+ * <CardContent>Content</CardContent>
206
+ * </Card>
207
+ */
208
+ declare function Card({ className, size, flush, ...props }: React.ComponentProps<"div"> & {
209
+ size?: "default" | "sm";
210
+ /** Remove padding on CardContent for edge-to-edge tables / 内容通栏 */
211
+ flush?: boolean;
212
+ }): React.JSX.Element;
213
+ /**
214
+ * @component CardHeader
215
+ * @category ui/shell
216
+ * @since 0.2.0
217
+ * @description Top section of a Card, typically containing title, description, and actions / 卡片顶部区域,通常包含标题、描述和操作按钮
218
+ * @keywords card, header, title
219
+ * @example
220
+ * <CardHeader>
221
+ * <CardTitle>Title</CardTitle>
222
+ * <CardDescription>Description text</CardDescription>
223
+ * </CardHeader>
224
+ */
225
+ declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
226
+ /**
227
+ * @component CardTitle
228
+ * @category ui/shell
229
+ * @since 0.2.0
230
+ * @description The heading text inside a CardHeader / 卡片标题文字
231
+ * @keywords card, title, heading
232
+ * @example
233
+ * <CardTitle>Section Title</CardTitle>
234
+ */
235
+ declare function CardTitle({ className, size, ...props }: React.ComponentProps<"div"> & {
236
+ /** Explicit size override independent of Card size / 独立于 Card 的尺寸 */
237
+ size?: "sm" | "default";
238
+ }): React.JSX.Element;
239
+ /**
240
+ * @component CardDescription
241
+ * @category ui/shell
242
+ * @since 0.2.0
243
+ * @description Supplementary text below the CardTitle / 卡片标题下方的补充说明文字
244
+ * @keywords card, description, subtitle
245
+ * @example
246
+ * <CardDescription>Additional context about this card.</CardDescription>
247
+ */
248
+ declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
249
+ /**
250
+ * @component CardAction
251
+ * @category ui/shell
252
+ * @since 0.2.0
253
+ * @description An action area placed in the top-right corner of a CardHeader / 卡片头部右上角的操作区域
254
+ * @keywords card, action, button, header
255
+ * @example
256
+ * <CardAction>
257
+ * <Button size="sm">Action</Button>
258
+ * </CardAction>
259
+ */
260
+ declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
261
+ /**
262
+ * @component CardContent
263
+ * @category ui/shell
264
+ * @since 0.2.0
265
+ * @description The main body area of a Card, with optional flush padding for edge-to-edge content / 卡片主体内容区,支持通栏模式
266
+ * @keywords card, content, body
267
+ * @example
268
+ * <CardContent>Main card content goes here.</CardContent>
269
+ */
270
+ declare function CardContent({ className, flush, ...props }: React.ComponentProps<"div"> & {
271
+ /** Remove horizontal padding for edge-to-edge content like tables / 内容通栏,去掉水平内边距 */
272
+ flush?: boolean;
273
+ }): React.JSX.Element;
274
+ /**
275
+ * @component CardFooter
276
+ * @category ui/shell
277
+ * @since 0.2.0
278
+ * @description Bottom section of a Card, typically for action buttons or summary / 卡片底部区域,通常放置操作按钮或摘要信息
279
+ * @keywords card, footer, actions
280
+ * @example
281
+ * <CardFooter>
282
+ * <Button>Save</Button>
283
+ * </CardFooter>
284
+ */
285
+ declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
286
+ /**
287
+ * @component CardSection
288
+ * @category ui/shell
289
+ * @since 0.2.0
290
+ * @description Titled section within a Card with optional header actions / 卡片中的带标题分区,支持可选的头部操作按钮
291
+ * @keywords card, section, divider, partition
292
+ * @example
293
+ * <CardSection title="Details" actions={<Button size="sm">Edit</Button>}>
294
+ * Content here
295
+ * </CardSection>
296
+ *
297
+ * Supports `title` and `actions` props to replace the repeated 3 inline
298
+ * patterns (CardHeader+CardTitle / Tailwind div / Flex+title+Button).
299
+ * Render as a header row when `title` or `actions` is provided;
300
+ * otherwise renders as a plain bordered partition div.
301
+ */
302
+ declare function CardSection({ className, title, actions, children, ...props }: React.ComponentProps<"div"> & {
303
+ /** Section title text / 区块标题 */
304
+ title?: React.ReactNode;
305
+ /** Right-side action area / 右侧操作区 */
306
+ actions?: React.ReactNode;
307
+ }): React.JSX.Element;
308
+
309
+ type InputProps = React.ComponentProps<"input">;
310
+ /**
311
+ * @component Input
312
+ * @category ui/data-entry
313
+ * @since 0.2.0
314
+ * @description A styled text input built on @base-ui/react Input primitive with focus, disabled, and invalid states / 基于 @base-ui/react Input 的样式化文本输入框,支持聚焦、禁用和无效状态
315
+ * @keywords input, text-input, form, base-ui
316
+ * @example
317
+ * <Input type="email" placeholder="Enter your email" />
318
+ */
319
+ declare function Input({ className, type, ...props }: InputProps): React.JSX.Element;
320
+
321
+ interface RatingProps extends Omit<React.ComponentProps<"div">, "onChange"> {
322
+ value?: number;
323
+ defaultValue?: number;
324
+ onChange?: (value: number) => void;
325
+ max?: number;
326
+ size?: "sm" | "default" | "lg";
327
+ readonly?: boolean;
328
+ allowHalf?: boolean;
329
+ className?: string;
330
+ iconClassName?: string;
331
+ }
332
+ /**
333
+ * @component Rating
334
+ * @category ui/data-entry
335
+ * @since 0.2.0
336
+ * @description Star rating component with half-star and read-only support / 星级评分组件,支持半星和只读模式
337
+ * @keywords rating, star, score, review, half-star, evaluation
338
+ * @example
339
+ * <Rating defaultValue={3.5} max={5} allowHalf onChange={(v) => console.log(v)} />
340
+ */
341
+ declare function Rating({ value, defaultValue, onChange, max, size, readonly, allowHalf, className, iconClassName, ...props }: RatingProps): React.JSX.Element;
342
+
343
+ interface SegmentedControlOption<T extends string> {
344
+ value: T;
345
+ label: string;
346
+ icon?: React.ReactNode;
347
+ disabled?: boolean;
348
+ }
349
+ interface SegmentedControlProps<T extends string> {
350
+ options: SegmentedControlOption<T>[];
351
+ value?: T;
352
+ defaultValue?: T;
353
+ onChange?: (value: T) => void;
354
+ size?: "sm" | "default" | "lg";
355
+ disabled?: boolean;
356
+ className?: string;
357
+ orientation?: "horizontal" | "vertical";
358
+ }
359
+ /**
360
+ * @component SegmentedControl
361
+ * @category ui/data-entry
362
+ * @since 0.2.0
363
+ * @description A toggle-based segmented control for selecting one option from a set / 分段控制器,基于切换按钮从一组选项中选择一个
364
+ * @keywords segmented, control, toggle, switch, tabs, options, select
365
+ * @example
366
+ * <SegmentedControl
367
+ * options={[{ value: "day", label: "Day" }, { value: "week", label: "Week" }]}
368
+ * defaultValue="day"
369
+ * onChange={(v) => console.log(v)}
370
+ * />
371
+ */
372
+ declare function SegmentedControl<T extends string>({ options, value, defaultValue, onChange, size, disabled, className, orientation, }: SegmentedControlProps<T>): React.JSX.Element;
373
+
374
+ interface TourStep {
375
+ target: string | (() => HTMLElement | null);
376
+ title: string;
377
+ description?: React.ReactNode;
378
+ placement?: "top" | "bottom" | "left" | "right";
379
+ offset?: number;
380
+ }
381
+ interface TourProps {
382
+ steps: TourStep[];
383
+ open?: boolean;
384
+ onOpenChange?: (open: boolean) => void;
385
+ onComplete?: () => void;
386
+ onSkip?: () => void;
387
+ storageKey?: string;
388
+ className?: string;
389
+ }
390
+ /**
391
+ * @component Tour
392
+ * @category ui/overlay
393
+ * @since 0.2.0
394
+ * @description Step-by-step guided product tour overlay with spotlight, navigation, and localStorage persistence / 逐步引导式产品导览覆盖层,带有聚焦高亮、导航和 localStorage 持久化
395
+ * @keywords tour, onboarding, guide, walkthrough, spotlight, 导览, 引导
396
+ * @example
397
+ * <Tour
398
+ * steps={[
399
+ * { target: "#dashboard", title: "Dashboard", description: "Your overview" },
400
+ * ]}
401
+ * onComplete={() => console.log("tour done")}
402
+ * />
403
+ */
404
+ declare function Tour({ steps, open, onOpenChange, onComplete, onSkip, storageKey, className, }: TourProps): React.JSX.Element | null;
405
+
406
+ interface WatermarkProps {
407
+ text?: string;
408
+ image?: string;
409
+ rotate?: number;
410
+ gap?: [number, number];
411
+ fontSize?: number;
412
+ className?: string;
413
+ fullPage?: boolean;
414
+ zIndex?: number;
415
+ opacity?: number;
416
+ color?: string;
417
+ }
418
+ /**
419
+ * @component Watermark
420
+ * @category ui/feedback
421
+ * @since 0.2.0
422
+ * @description Tiled watermark overlay with text or image, supporting full-page and container modes / 平铺水印覆盖层,支持文本或图片,可全页面或容器内显示
423
+ * @keywords watermark, overlay, tiled, security, 水印
424
+ * @example
425
+ * <Watermark text="Confidential" />
426
+ * <Watermark image="/logo.png" fullPage={false} />
427
+ */
428
+ declare function Watermark({ text, image, rotate, gap, fontSize, className, fullPage, zIndex, opacity, color, }: WatermarkProps): React.JSX.Element;
429
+
430
+ /**
431
+ * @component TimePicker
432
+ * @category ui/data-entry
433
+ * @since 0.2.0
434
+ * @description Time selection component with 12h/24h format, configurable minute step, and Popover-based hour/minute dropdowns. / 时间选择器,支持12/24小时制、可配置分钟步长,基于 Popover 的小时/分钟下拉选择。
435
+ * @keywords time, picker, clock, hour, minute, 12h, 24h
436
+ * @example
437
+ * <TimePicker value="09:30" onChange={setTime} step={15} />
438
+ * <TimePicker value="02:30 PM" format="12h" step={30} />
439
+ */
440
+ interface TimePickerProps {
441
+ value?: string;
442
+ onChange?: (value: string) => void;
443
+ step?: 1 | 5 | 10 | 15 | 30 | 60;
444
+ format?: "12h" | "24h";
445
+ disabled?: boolean;
446
+ placeholder?: string;
447
+ className?: string;
448
+ }
449
+ declare function TimePicker({ value, onChange, step, format, disabled, placeholder, className, }: TimePickerProps): React.JSX.Element;
450
+ declare function formatTimeInput(h: number, m: number, format?: "12h" | "24h"): string;
451
+
452
+ export { type ButtonProps as B, Card as C, EmptyState as E, Fab as F, Input as I, Rating as R, SegmentedControl as S, type TransferItem as T, Watermark as W, Button as a, BackTop as b, Combobox as c, type ComboboxOption as d, type EmptyStateTexts as e, FabSpeedDial as f, TimePicker as g, Tour as h, type TourStep as i, Transfer as j, formatTimeInput as k, CardAction as l, CardContent as m, CardDescription as n, CardFooter as o, CardHeader as p, CardSection as q, CardTitle as r, type InputProps as s, buttonVariants as t, variantConfig as v };