@kjaniec-dev/ui 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/README.md +89 -0
- package/dist/index.cjs +976 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +281 -0
- package/dist/index.d.ts +281 -0
- package/dist/index.js +895 -0
- package/dist/index.js.map +1 -0
- package/dist/ui.css +26 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Merge class names with Tailwind-aware conflict resolution.
|
|
9
|
+
* `cn("px-2", condition && "px-4")` → keeps the last conflicting utility.
|
|
10
|
+
*/
|
|
11
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
12
|
+
|
|
13
|
+
declare const buttonVariants: (props?: ({
|
|
14
|
+
variant?: "primary" | "secondary" | "outline" | "ghost" | "danger" | null | undefined;
|
|
15
|
+
size?: "sm" | "md" | "lg" | "icon" | "icon-sm" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
18
|
+
/** Shows a spinner and disables interaction. */
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
/** Icon rendered before the label. */
|
|
21
|
+
leadingIcon?: React.ReactNode;
|
|
22
|
+
/** Icon rendered after the label. */
|
|
23
|
+
trailingIcon?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
26
|
+
|
|
27
|
+
declare const badgeVariants: (props?: ({
|
|
28
|
+
variant?: "primary" | "danger" | "neutral" | "success" | "warning" | "info" | "solid" | null | undefined;
|
|
29
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
30
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
31
|
+
/** Render a leading status dot. */
|
|
32
|
+
dot?: boolean;
|
|
33
|
+
}
|
|
34
|
+
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
35
|
+
|
|
36
|
+
declare const alertVariants: (props?: ({
|
|
37
|
+
variant?: "danger" | "success" | "warning" | "info" | null | undefined;
|
|
38
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
39
|
+
interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof alertVariants> {
|
|
40
|
+
/** Optional leading icon (e.g. an SVG). Inherits the variant color. */
|
|
41
|
+
icon?: React.ReactNode;
|
|
42
|
+
title?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
|
|
46
|
+
interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
47
|
+
/** Diameter in px. Default 24. */
|
|
48
|
+
size?: number;
|
|
49
|
+
}
|
|
50
|
+
declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
51
|
+
|
|
52
|
+
interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
53
|
+
/** 0–100. */
|
|
54
|
+
value?: number;
|
|
55
|
+
tone?: "primary" | "secondary";
|
|
56
|
+
}
|
|
57
|
+
declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
|
|
59
|
+
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
60
|
+
/** Visual error state (red border + ring). */
|
|
61
|
+
error?: boolean;
|
|
62
|
+
/** Icon shown inside the field, leading edge. */
|
|
63
|
+
leadingIcon?: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
66
|
+
interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
67
|
+
error?: boolean;
|
|
68
|
+
}
|
|
69
|
+
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
70
|
+
|
|
71
|
+
interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
72
|
+
/** Append a red required marker. */
|
|
73
|
+
required?: boolean;
|
|
74
|
+
}
|
|
75
|
+
declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
76
|
+
interface HintProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
77
|
+
error?: boolean;
|
|
78
|
+
}
|
|
79
|
+
declare const Hint: React.ForwardRefExoticComponent<HintProps & React.RefAttributes<HTMLSpanElement>>;
|
|
80
|
+
/** Vertical label + control + hint group. */
|
|
81
|
+
declare const Field: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
82
|
+
|
|
83
|
+
interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
84
|
+
error?: boolean;
|
|
85
|
+
}
|
|
86
|
+
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
87
|
+
|
|
88
|
+
interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
89
|
+
label?: React.ReactNode;
|
|
90
|
+
}
|
|
91
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
92
|
+
interface RadioProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
93
|
+
label?: React.ReactNode;
|
|
94
|
+
}
|
|
95
|
+
declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
96
|
+
|
|
97
|
+
interface SwitchProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
98
|
+
label?: React.ReactNode;
|
|
99
|
+
}
|
|
100
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
101
|
+
|
|
102
|
+
type SliderProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
103
|
+
/**
|
|
104
|
+
* Range slider styled with the kit's primary token. Thumb styling lives in a
|
|
105
|
+
* scoped <style> tag because pseudo-elements (::-webkit-slider-thumb) can't be
|
|
106
|
+
* expressed as Tailwind utilities.
|
|
107
|
+
*/
|
|
108
|
+
declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLInputElement>>;
|
|
109
|
+
/** Inject once near the app root (or rely on the package stylesheet). */
|
|
110
|
+
declare const sliderThumbCSS = "\n.kj-slider::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:9999px;background:var(--kj-primary);border:3px solid var(--kj-surface);box-shadow:var(--kj-shadow-sm);cursor:pointer}\n.kj-slider::-moz-range-thumb{width:18px;height:18px;border-radius:9999px;background:var(--kj-primary);border:3px solid var(--kj-surface);box-shadow:var(--kj-shadow-sm);cursor:pointer}\n";
|
|
111
|
+
|
|
112
|
+
interface SegmentedOption<T extends string> {
|
|
113
|
+
value: T;
|
|
114
|
+
label: React.ReactNode;
|
|
115
|
+
}
|
|
116
|
+
interface SegmentedProps<T extends string> {
|
|
117
|
+
options: SegmentedOption<T>[];
|
|
118
|
+
value: T;
|
|
119
|
+
onChange: (value: T) => void;
|
|
120
|
+
className?: string;
|
|
121
|
+
"aria-label"?: string;
|
|
122
|
+
}
|
|
123
|
+
/** Segmented control / single-select toggle group. Controlled. */
|
|
124
|
+
declare function Segmented<T extends string>({ options, value, onChange, className, ...props }: SegmentedProps<T>): react_jsx_runtime.JSX.Element;
|
|
125
|
+
|
|
126
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
127
|
+
/** Drop the border + heavier shadow for a floating look. */
|
|
128
|
+
elevated?: boolean;
|
|
129
|
+
}
|
|
130
|
+
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
131
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
132
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
133
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
134
|
+
/** Body region with default padding. */
|
|
135
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
136
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
+
|
|
138
|
+
interface StatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
139
|
+
label: React.ReactNode;
|
|
140
|
+
value: React.ReactNode;
|
|
141
|
+
/** e.g. "+12.3% mdm" */
|
|
142
|
+
delta?: React.ReactNode;
|
|
143
|
+
trend?: "up" | "down";
|
|
144
|
+
}
|
|
145
|
+
declare const Stat: React.ForwardRefExoticComponent<StatProps & React.RefAttributes<HTMLDivElement>>;
|
|
146
|
+
|
|
147
|
+
declare const avatarVariants: (props?: ({
|
|
148
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
149
|
+
tone?: "primary" | "secondary" | "info" | "muted" | null | undefined;
|
|
150
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
151
|
+
interface AvatarProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof avatarVariants> {
|
|
152
|
+
/** Image URL; falls back to initials/children when absent. */
|
|
153
|
+
src?: string;
|
|
154
|
+
alt?: string;
|
|
155
|
+
/** Show an online status dot. */
|
|
156
|
+
status?: boolean;
|
|
157
|
+
}
|
|
158
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
159
|
+
/** Overlapping cluster of avatars. */
|
|
160
|
+
declare const AvatarGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
161
|
+
|
|
162
|
+
interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
163
|
+
/** Controlled active value. */
|
|
164
|
+
value?: string;
|
|
165
|
+
/** Uncontrolled initial value. */
|
|
166
|
+
defaultValue?: string;
|
|
167
|
+
onValueChange?: (value: string) => void;
|
|
168
|
+
}
|
|
169
|
+
declare function Tabs({ value, defaultValue, onValueChange, className, children, ...props }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
170
|
+
declare const TabsList: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
171
|
+
interface TabsTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
172
|
+
value: string;
|
|
173
|
+
}
|
|
174
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<TabsTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
175
|
+
interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
176
|
+
value: string;
|
|
177
|
+
}
|
|
178
|
+
declare const TabsContent: React.ForwardRefExoticComponent<TabsContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
179
|
+
|
|
180
|
+
interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
181
|
+
/** "single" closes others when one opens. */
|
|
182
|
+
type?: "single" | "multiple";
|
|
183
|
+
defaultValue?: string[];
|
|
184
|
+
}
|
|
185
|
+
declare function Accordion({ type, defaultValue, className, children, ...props }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
186
|
+
interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
187
|
+
value: string;
|
|
188
|
+
}
|
|
189
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
190
|
+
declare const AccordionTrigger: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
191
|
+
declare const AccordionContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
192
|
+
|
|
193
|
+
declare function DropdownMenu({ children, className }: {
|
|
194
|
+
children: React.ReactNode;
|
|
195
|
+
className?: string;
|
|
196
|
+
}): react_jsx_runtime.JSX.Element;
|
|
197
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
198
|
+
asChild?: boolean;
|
|
199
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
200
|
+
interface DropdownMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
201
|
+
align?: "start" | "end";
|
|
202
|
+
}
|
|
203
|
+
declare function DropdownMenuContent({ className, align, children, ...props }: DropdownMenuContentProps): react_jsx_runtime.JSX.Element | null;
|
|
204
|
+
interface DropdownMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
205
|
+
danger?: boolean;
|
|
206
|
+
icon?: React.ReactNode;
|
|
207
|
+
}
|
|
208
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<DropdownMenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
209
|
+
declare function DropdownMenuSeparator({ className }: {
|
|
210
|
+
className?: string;
|
|
211
|
+
}): react_jsx_runtime.JSX.Element;
|
|
212
|
+
|
|
213
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
|
|
214
|
+
interface BreadcrumbItemProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
215
|
+
/** Marks the trailing current page (non-link, emphasized). */
|
|
216
|
+
current?: boolean;
|
|
217
|
+
}
|
|
218
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<BreadcrumbItemProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
219
|
+
declare function BreadcrumbSeparator(): react_jsx_runtime.JSX.Element;
|
|
220
|
+
|
|
221
|
+
interface PaginationProps {
|
|
222
|
+
page: number;
|
|
223
|
+
pageCount: number;
|
|
224
|
+
onPageChange: (page: number) => void;
|
|
225
|
+
/** How many numbered buttons to show around the edges. Default 5. */
|
|
226
|
+
siblingCount?: number;
|
|
227
|
+
className?: string;
|
|
228
|
+
}
|
|
229
|
+
declare function Pagination({ page, pageCount, onPageChange, className }: PaginationProps): react_jsx_runtime.JSX.Element;
|
|
230
|
+
|
|
231
|
+
/** Rounded, bordered wrapper around a <Table>. */
|
|
232
|
+
declare const TableWrap: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
233
|
+
declare const Table: React.ForwardRefExoticComponent<React.TableHTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
234
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
235
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
236
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
237
|
+
interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
238
|
+
/** Right-align with tabular numerals. */
|
|
239
|
+
numeric?: boolean;
|
|
240
|
+
}
|
|
241
|
+
declare const TableHead: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
242
|
+
declare const TableCell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
243
|
+
|
|
244
|
+
interface TooltipProps {
|
|
245
|
+
content: React.ReactNode;
|
|
246
|
+
children: React.ReactNode;
|
|
247
|
+
className?: string;
|
|
248
|
+
}
|
|
249
|
+
/** CSS-only hover/focus tooltip positioned above the trigger. */
|
|
250
|
+
declare function Tooltip({ content, children, className }: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
251
|
+
|
|
252
|
+
interface ModalProps {
|
|
253
|
+
open: boolean;
|
|
254
|
+
onClose: () => void;
|
|
255
|
+
children: React.ReactNode;
|
|
256
|
+
/** Max width of the panel. Default 440px. */
|
|
257
|
+
width?: number;
|
|
258
|
+
className?: string;
|
|
259
|
+
}
|
|
260
|
+
/** Centered overlay dialog. Closes on backdrop click and Escape. */
|
|
261
|
+
declare function Modal({ open, onClose, children, width, className }: ModalProps): react_jsx_runtime.JSX.Element;
|
|
262
|
+
declare function ModalTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): react_jsx_runtime.JSX.Element;
|
|
263
|
+
declare function ModalDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): react_jsx_runtime.JSX.Element;
|
|
264
|
+
declare function ModalActions({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
265
|
+
|
|
266
|
+
type ToastTone = "default" | "success" | "danger";
|
|
267
|
+
interface ToastOptions {
|
|
268
|
+
message: React.ReactNode;
|
|
269
|
+
tone?: ToastTone;
|
|
270
|
+
/** Auto-dismiss after ms. Default 3200. Pass 0 to keep open. */
|
|
271
|
+
duration?: number;
|
|
272
|
+
}
|
|
273
|
+
interface ToastCtx {
|
|
274
|
+
toast: (opts: ToastOptions) => void;
|
|
275
|
+
}
|
|
276
|
+
declare function useToast(): ToastCtx;
|
|
277
|
+
declare function ToastProvider({ children }: {
|
|
278
|
+
children: React.ReactNode;
|
|
279
|
+
}): react_jsx_runtime.JSX.Element;
|
|
280
|
+
|
|
281
|
+
export { Accordion, AccordionContent, AccordionItem, type AccordionItemProps, type AccordionProps, AccordionTrigger, Alert, type AlertProps, Avatar, AvatarGroup, type AvatarProps, Badge, type BadgeProps, Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbSeparator, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuSeparator, DropdownMenuTrigger, Field, Hint, type HintProps, Input, type InputProps, Label, type LabelProps, Modal, ModalActions, ModalDescription, type ModalProps, ModalTitle, Pagination, type PaginationProps, Progress, type ProgressProps, Radio, type RadioProps, Segmented, type SegmentedOption, type SegmentedProps, Select, type SelectProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stat, type StatProps, Switch, type SwitchProps, Table, TableBody, TableCell, type TableCellProps, TableHead, TableHeader, TableRow, TableWrap, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastOptions, ToastProvider, type ToastTone, Tooltip, type TooltipProps, badgeVariants, buttonVariants, cn, sliderThumbCSS, useToast };
|