@weichenlin/swell-ui 0.3.0 → 0.4.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 +68 -2
- package/dist/index.d.ts +318 -39
- package/dist/index.js +2491 -420
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# swell-ui
|
|
2
2
|
|
|
3
|
-
Hand-built React 19 components styled with Tailwind CSS v4: Badge, Button, Card, Checkbox,
|
|
3
|
+
Hand-built React 19 components styled with Tailwind CSS v4: Accordion, Badge, Button, Card, Checkbox,
|
|
4
4
|
CheckboxGroup, Dialog, Drawer, Input (plus Search, Password and Copy), Meter, Select, Sidebar,
|
|
5
|
-
Switch, Table, Tabs, TabNav, ThemeSwitcher, Toast and Tooltip.
|
|
5
|
+
Slider, RangeSlider, Switch, Table, Tabs, TabNav, ThemeSwitcher, Toast and Tooltip.
|
|
6
6
|
|
|
7
7
|
The package ships ESM, type declarations and two CSS files. Your app compiles the CSS with its own
|
|
8
8
|
Tailwind v4, so the design tokens become your utilities too (`bg-primary`, `text-fg`, ...).
|
|
@@ -38,6 +38,72 @@ export function App() {
|
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
### Accordion
|
|
42
|
+
|
|
43
|
+
Compose `Accordion`, `AccordionItem`, `AccordionTrigger`, and `AccordionContent`. Item values must
|
|
44
|
+
be unique and non-empty; triggers contain non-interactive content and include their own heading.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@weichenlin/swell-ui'
|
|
48
|
+
|
|
49
|
+
;<Accordion defaultValue="project" variant="line" headingLevel={3}>
|
|
50
|
+
<AccordionItem value="project">
|
|
51
|
+
<AccordionTrigger description="Name and identity">Project</AccordionTrigger>
|
|
52
|
+
<AccordionContent>Project settings</AccordionContent>
|
|
53
|
+
</AccordionItem>
|
|
54
|
+
</Accordion>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Single mode uses `string | null`; `type="multiple"` uses `readonly string[]`. Use `value` with
|
|
58
|
+
`onValueChange` for controlled state, or `defaultValue` for uncontrolled state. Single mode allows
|
|
59
|
+
all panels to close by default; `collapsible={false}` prevents closing the open item. Change mode
|
|
60
|
+
with a new React key. `variant="outline"` adds individual borders and a surface background.
|
|
61
|
+
|
|
62
|
+
Content stays mounted while closed. `keepMounted={false}` unmounts children after the closing
|
|
63
|
+
animation; `region` opts in to a named landmark. Hidden mounted fields still participate in native
|
|
64
|
+
validation and FormData: expand the first invalid section before focusing its field. Storybook's
|
|
65
|
+
**UI / Accordion / Form Validation** demonstrates that flow. Arrow keys move header focus without
|
|
66
|
+
expanding, Enter/Space toggles, and reduced motion disables transitions.
|
|
67
|
+
|
|
68
|
+
### Slider
|
|
69
|
+
|
|
70
|
+
`Slider` uses a number; `RangeSlider` uses a `readonly [number, number]` and requires a name for
|
|
71
|
+
each thumb. Both use native range inputs for accessibility and form submission.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { Slider, RangeSlider } from '@weichenlin/swell-ui'
|
|
75
|
+
|
|
76
|
+
;<Slider label="Volume" defaultValue={40} formatValue={(value) => `${value}%`} />
|
|
77
|
+
|
|
78
|
+
;<RangeSlider
|
|
79
|
+
label="Price range"
|
|
80
|
+
thumbLabels={['Minimum price', 'Maximum price']}
|
|
81
|
+
defaultValue={[200, 800]}
|
|
82
|
+
min={0}
|
|
83
|
+
max={1000}
|
|
84
|
+
step={50}
|
|
85
|
+
minStepsBetweenThumbs={2}
|
|
86
|
+
name={['priceMin', 'priceMax']}
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use `value` and `onValueChange` for controlled state, or `defaultValue` for uncontrolled state.
|
|
91
|
+
Controlled owners must accept preview changes immediately. `onValueCommit` runs once after a
|
|
92
|
+
changed pointer or keyboard gesture ends; put expensive work there. Cancellation restores the
|
|
93
|
+
starting value with `onValueChange` reason `cancel`, without committing. Thumbs never swap or push.
|
|
94
|
+
|
|
95
|
+
Defaults are `min=0`, `max=100`, `step=1`, `showValue=true`, and `minStepsBetweenThumbs=0`. Without
|
|
96
|
+
an initial value, single starts at `min` and range starts at `[min,max]`. Bounds must be finite,
|
|
97
|
+
`min < max`, and `(max-min)` must be a whole number of positive steps. External values must be on
|
|
98
|
+
that grid, ordered, and satisfy the gap. `marks` are visual only, not a restricted list of values.
|
|
99
|
+
|
|
100
|
+
`formatValue` formats both the visible and spoken value; `getValueText` overrides only the spoken
|
|
101
|
+
text. Use `aria-label` when omitting a visible `label`. `className` and `ref` target the outer div.
|
|
102
|
+
`name` enables native FormData; range accepts two explicit names. `form` supports an external
|
|
103
|
+
form. Native reset restores uncontrolled defaults; controlled reset remains the owner's choice.
|
|
104
|
+
Keyboard, RTL, cancellation, forms, exact input composition and theme examples live in
|
|
105
|
+
**UI / Slider** in Storybook. Touch screen reader interaction requires device acceptance.
|
|
106
|
+
|
|
41
107
|
### Table
|
|
42
108
|
|
|
43
109
|
Pass the current rows, column definitions, and a stable row ID. Add `search`, `sorting`, `pagination`,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
|
+
import { ChangeEvent, ComponentProps, MouseEvent, MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
1
2
|
import { ClassValue } from "clsx";
|
|
2
3
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
|
|
4
|
+
//#region src/components/accordion/accordion.d.ts
|
|
5
|
+
type AccordionVariant = 'line' | 'outline';
|
|
6
|
+
type Selection$1<T> = {
|
|
7
|
+
value: T;
|
|
8
|
+
defaultValue?: never;
|
|
9
|
+
onValueChange?: (value: T) => void;
|
|
10
|
+
} | {
|
|
11
|
+
value?: undefined;
|
|
12
|
+
defaultValue?: T;
|
|
13
|
+
onValueChange?: (value: T) => void;
|
|
14
|
+
};
|
|
15
|
+
type AccordionProps = Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange'> & ((Selection$1<string | null> & {
|
|
16
|
+
type?: 'single';
|
|
17
|
+
collapsible?: boolean;
|
|
18
|
+
}) | (Selection$1<readonly string[]> & {
|
|
19
|
+
type: 'multiple';
|
|
20
|
+
collapsible?: never;
|
|
21
|
+
})) & {
|
|
22
|
+
variant?: AccordionVariant;
|
|
23
|
+
/** Native heading level around each trigger. */
|
|
24
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
25
|
+
/** Disables triggers, without changing values or disabling content fields. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/** Vertical disclosure group. Changing type requires a new React key. */
|
|
29
|
+
export declare function Accordion({ type, value, defaultValue, onValueChange, collapsible, variant, headingLevel, disabled, className, children, ref, onKeyDown, ...props }: AccordionProps): import("react").JSX.Element;
|
|
30
|
+
type AccordionItemProps = ComponentProps<'div'> & {
|
|
31
|
+
/** Unique, non-empty value in this group. */
|
|
32
|
+
value: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare function AccordionItem({ value, disabled, className, children, ref, ...props }: AccordionItemProps): import("react").JSX.Element;
|
|
36
|
+
type AccordionTriggerProps = Omit<ComponentProps<'button'>, 'id' | 'type' | 'disabled' | 'aria-expanded' | 'aria-controls' | 'aria-disabled' | 'aria-labelledby'> & {
|
|
37
|
+
/** Supplementary text, announced as the description rather than the title. */
|
|
38
|
+
description?: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
export declare function AccordionTrigger({ children, description, className, onClick, 'aria-describedby': describedBy, ...props }: AccordionTriggerProps): import("react").JSX.Element;
|
|
41
|
+
type AccordionContentProps = Omit<ComponentProps<'div'>, 'id' | 'hidden' | 'inert' | 'role' | 'aria-hidden' | 'aria-labelledby'> & {
|
|
42
|
+
/** Defaults to true. false unmounts children after closing, but keeps the ARIA target. */
|
|
43
|
+
keepMounted?: boolean;
|
|
44
|
+
/** Opt in to a named landmark for complex content; avoid excessive regions. */
|
|
45
|
+
region?: boolean;
|
|
46
|
+
/** Outer height wrapper classes. className styles the inner padded content. */
|
|
47
|
+
contentClassName?: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function AccordionContent({ keepMounted, region, className, contentClassName, children, ref, ...props }: AccordionContentProps): import("react").JSX.Element;
|
|
50
|
+
//#endregion
|
|
4
51
|
//#region src/components/alert/alert.d.ts
|
|
5
52
|
type AlertTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
6
53
|
type AlertProps = Omit<ComponentProps<'div'>, 'title'> & {
|
|
@@ -34,7 +81,7 @@ type BadgeProps = Omit<ComponentProps<'span'>, 'onClick'> & {
|
|
|
34
81
|
export declare function Badge({ tone, variant, size, icon, busy, context, className, children, ...props }: BadgeProps): import("react").JSX.Element;
|
|
35
82
|
//#endregion
|
|
36
83
|
//#region src/components/tooltip.d.ts
|
|
37
|
-
type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
84
|
+
type Side$1 = 'top' | 'bottom' | 'left' | 'right';
|
|
38
85
|
type TriggerProps = {
|
|
39
86
|
'aria-describedby'?: string;
|
|
40
87
|
};
|
|
@@ -42,7 +89,7 @@ type TooltipProps = {
|
|
|
42
89
|
/** Nothing renders (and no aria-describedby is added) when empty. */
|
|
43
90
|
content?: ReactNode;
|
|
44
91
|
/** Preferred side; flips to the opposite one when it doesn't fit the viewport. */
|
|
45
|
-
side?: Side;
|
|
92
|
+
side?: Side$1;
|
|
46
93
|
/**
|
|
47
94
|
* Link the tooltip to the trigger via aria-describedby. Turn off when the
|
|
48
95
|
* tooltip only repeats the trigger's accessible name (e.g. icon button labels).
|
|
@@ -189,6 +236,123 @@ type CheckboxGroupProps = Omit<ComponentProps<'fieldset'>, 'children'> & {
|
|
|
189
236
|
/** A `<fieldset>` + `<legend>` around related checkboxes; holds no value of its own. */
|
|
190
237
|
export declare function CheckboxGroup({ legend, description, error, orientation, className, 'aria-describedby': describedByProp, children, ...props }: CheckboxGroupProps): import("react").JSX.Element;
|
|
191
238
|
//#endregion
|
|
239
|
+
//#region src/components/input/field.d.ts
|
|
240
|
+
type FieldSize = 'sm' | 'md' | 'lg';
|
|
241
|
+
type NativeInputProps = Omit<ComponentProps<'input'>, 'size' | 'children'>;
|
|
242
|
+
/** Props every input in the family shares. */
|
|
243
|
+
type FieldProps = NativeInputProps & {
|
|
244
|
+
/** Visible label, rendered as a real `<label>` above the field. */
|
|
245
|
+
label: string;
|
|
246
|
+
/** Outlined floating label: rests inside the field and moves onto the top border. */
|
|
247
|
+
floating?: boolean;
|
|
248
|
+
helperText?: ReactNode;
|
|
249
|
+
/** Truthy puts the field in the error state; the text replaces helperText. */
|
|
250
|
+
error?: ReactNode;
|
|
251
|
+
size?: FieldSize;
|
|
252
|
+
/** Decorative leading icon (aria-hidden) or plain text prefix such as `https://`. */
|
|
253
|
+
start?: ReactNode;
|
|
254
|
+
/** Decorative trailing icon (aria-hidden) or plain text suffix. */
|
|
255
|
+
end?: ReactNode;
|
|
256
|
+
/** Monospace with spellcheck/autocorrect off, for tags, SHAs and hostnames. */
|
|
257
|
+
mono?: boolean;
|
|
258
|
+
/** Shows a spinner and announces validatingText; the field stays editable. */
|
|
259
|
+
validating?: boolean;
|
|
260
|
+
validatingText?: string;
|
|
261
|
+
/** Classes for the `<input>`; `className` goes to the outer wrapper. */
|
|
262
|
+
inputClassName?: string;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Either a visible label, or only an aria-label when the context already names the field
|
|
266
|
+
* (a table cell, a toolbar filter). Floating needs a visible label.
|
|
267
|
+
*/
|
|
268
|
+
type FieldLabelProps = {
|
|
269
|
+
label: string;
|
|
270
|
+
floating?: boolean;
|
|
271
|
+
} | {
|
|
272
|
+
label?: never;
|
|
273
|
+
floating?: never;
|
|
274
|
+
'aria-label': string;
|
|
275
|
+
};
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/components/combobox/types.d.ts
|
|
278
|
+
type ComboboxOption = {
|
|
279
|
+
/** Stable, unique, non-empty submitted ID. Labels need not be unique. */
|
|
280
|
+
value: string;
|
|
281
|
+
label: string;
|
|
282
|
+
description?: ReactNode;
|
|
283
|
+
/** Decorative; hidden from assistive technology. */
|
|
284
|
+
icon?: ReactNode;
|
|
285
|
+
keywords?: readonly string[];
|
|
286
|
+
disabled?: boolean;
|
|
287
|
+
};
|
|
288
|
+
type ComboboxGroup = {
|
|
289
|
+
label: string;
|
|
290
|
+
options: readonly ComboboxOption[];
|
|
291
|
+
};
|
|
292
|
+
type ComboboxValueChangeDetails = {
|
|
293
|
+
reason: 'select' | 'clear';
|
|
294
|
+
option: ComboboxOption | null;
|
|
295
|
+
};
|
|
296
|
+
type ComboboxInputChangeDetails = {
|
|
297
|
+
reason: 'input' | 'selection' | 'clear' | 'revert' | 'reset';
|
|
298
|
+
};
|
|
299
|
+
type ComboboxOpenChangeDetails = {
|
|
300
|
+
reason: 'input' | 'trigger' | 'keyboard' | 'select' | 'escape' | 'blur' | 'outside' | 'clear';
|
|
301
|
+
};
|
|
302
|
+
type NativeProps = Omit<ComponentProps<'input'>, 'size' | 'type' | 'children' | 'value' | 'defaultValue' | 'onChange' | 'list' | 'role' | 'aria-autocomplete' | 'aria-controls' | 'aria-expanded' | 'aria-activedescendant'>;
|
|
303
|
+
type Selection = {
|
|
304
|
+
value: string | null;
|
|
305
|
+
defaultValue?: never;
|
|
306
|
+
} | {
|
|
307
|
+
value?: undefined;
|
|
308
|
+
defaultValue?: string | null;
|
|
309
|
+
};
|
|
310
|
+
type Disclosure = {
|
|
311
|
+
open: boolean;
|
|
312
|
+
defaultOpen?: never;
|
|
313
|
+
} | {
|
|
314
|
+
open?: undefined;
|
|
315
|
+
defaultOpen?: boolean;
|
|
316
|
+
};
|
|
317
|
+
type ComboboxProps = NativeProps & FieldLabelProps & Selection & Disclosure & {
|
|
318
|
+
options: readonly (ComboboxOption | ComboboxGroup)[];
|
|
319
|
+
onValueChange?: (value: string | null, details: ComboboxValueChangeDetails) => void;
|
|
320
|
+
inputValue?: string;
|
|
321
|
+
/** Only reason="input" should issue a search request. */
|
|
322
|
+
onInputValueChange?: (text: string, details: ComboboxInputChangeDetails) => void;
|
|
323
|
+
onOpenChange?: (open: boolean, details: ComboboxOpenChangeDetails) => void;
|
|
324
|
+
/** false for externally filtered results. Default: label + keywords, case/accent insensitive. */
|
|
325
|
+
filter?: false | ((option: ComboboxOption, query: string) => boolean);
|
|
326
|
+
/** Supplies a label when the selected ID is not in the current search results. */
|
|
327
|
+
selectedOption?: ComboboxOption | null;
|
|
328
|
+
loading?: boolean;
|
|
329
|
+
loadingText?: string;
|
|
330
|
+
searchError?: ReactNode;
|
|
331
|
+
onRetry?: () => void;
|
|
332
|
+
retryText?: string;
|
|
333
|
+
emptyText?: ReactNode;
|
|
334
|
+
clearable?: boolean;
|
|
335
|
+
openOnFocus?: boolean;
|
|
336
|
+
clearLabel?: string;
|
|
337
|
+
openLabel?: string;
|
|
338
|
+
closeLabel?: string;
|
|
339
|
+
/** Native constraint-validation message: selection is required, not just typed text. */
|
|
340
|
+
requiredText?: string;
|
|
341
|
+
unresolvedText?: string;
|
|
342
|
+
/** Localize the polite result-count announcement. */
|
|
343
|
+
getResultsText?: (count: number) => string;
|
|
344
|
+
helperText?: ReactNode;
|
|
345
|
+
error?: ReactNode;
|
|
346
|
+
size?: FieldSize;
|
|
347
|
+
start?: ReactNode;
|
|
348
|
+
mono?: boolean;
|
|
349
|
+
inputClassName?: string;
|
|
350
|
+
contentClassName?: string;
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/components/combobox/combobox.d.ts
|
|
354
|
+
export declare function Combobox({ options, value, defaultValue, onValueChange, inputValue, onInputValueChange, open: openProp, defaultOpen, onOpenChange, filter, selectedOption, loading, loadingText, searchError, onRetry, retryText, emptyText, clearable, openOnFocus, clearLabel, openLabel, closeLabel, requiredText, unresolvedText, getResultsText, label, floating, helperText, error, size, start, mono, inputClassName, contentClassName, className, name, form, disabled, readOnly, required, ref, id: idProp, onClick, onFocus, onBlur, onKeyDown, onCompositionStart, onCompositionEnd, onInvalid, ...props }: ComboboxProps): import("react").JSX.Element;
|
|
355
|
+
//#endregion
|
|
192
356
|
//#region src/components/modal/modal-shell.d.ts
|
|
193
357
|
/**
|
|
194
358
|
* Why the modal asks to close. `programmatic` is never sent by the modal itself; it is there for
|
|
@@ -274,43 +438,38 @@ type DrawerCloseProps = Omit<ComponentProps<'button'>, 'children' | 'type' | 'ar
|
|
|
274
438
|
/** A ghost icon button that closes the drawer, for custom headers. */
|
|
275
439
|
export declare function DrawerClose({ size, icon, ...props }: DrawerCloseProps): import("react").JSX.Element;
|
|
276
440
|
//#endregion
|
|
277
|
-
//#region src/components/
|
|
278
|
-
type
|
|
279
|
-
type
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
/** Outlined floating label: rests inside the field and moves onto the top border. */
|
|
285
|
-
floating?: boolean;
|
|
286
|
-
helperText?: ReactNode;
|
|
287
|
-
/** Truthy puts the field in the error state; the text replaces helperText. */
|
|
288
|
-
error?: ReactNode;
|
|
289
|
-
size?: FieldSize;
|
|
290
|
-
/** Decorative leading icon (aria-hidden) or plain text prefix such as `https://`. */
|
|
291
|
-
start?: ReactNode;
|
|
292
|
-
/** Decorative trailing icon (aria-hidden) or plain text suffix. */
|
|
293
|
-
end?: ReactNode;
|
|
294
|
-
/** Monospace with spellcheck/autocorrect off, for tags, SHAs and hostnames. */
|
|
295
|
-
mono?: boolean;
|
|
296
|
-
/** Shows a spinner and announces validatingText; the field stays editable. */
|
|
297
|
-
validating?: boolean;
|
|
298
|
-
validatingText?: string;
|
|
299
|
-
/** Classes for the `<input>`; `className` goes to the outer wrapper. */
|
|
300
|
-
inputClassName?: string;
|
|
441
|
+
//#region src/components/dropdown-menu/dropdown-menu.d.ts
|
|
442
|
+
type DropdownMenuChangeReason = 'trigger' | 'item-select' | 'escape' | 'outside' | 'tab';
|
|
443
|
+
type DropdownMenuProps = {
|
|
444
|
+
children: ReactNode;
|
|
445
|
+
open?: boolean;
|
|
446
|
+
defaultOpen?: boolean;
|
|
447
|
+
onOpenChange?: (open: boolean, reason: DropdownMenuChangeReason) => void;
|
|
301
448
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
*/
|
|
306
|
-
type FieldLabelProps = {
|
|
307
|
-
label: string;
|
|
308
|
-
floating?: boolean;
|
|
309
|
-
} | {
|
|
310
|
-
label?: never;
|
|
311
|
-
floating?: never;
|
|
312
|
-
'aria-label': string;
|
|
449
|
+
export declare function DropdownMenu({ children, open: controlled, defaultOpen, onOpenChange }: DropdownMenuProps): import("react").JSX.Element;
|
|
450
|
+
type DropdownMenuTriggerProps = ComponentProps<'button'> & {
|
|
451
|
+
asChild?: boolean;
|
|
313
452
|
};
|
|
453
|
+
export declare function DropdownMenuTrigger({ asChild, ref, onClick, onClickCapture, onKeyDown, disabled, ...props }: DropdownMenuTriggerProps): import("react").JSX.Element;
|
|
454
|
+
type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
455
|
+
type DropdownMenuContentProps = ComponentProps<'div'> & {
|
|
456
|
+
side?: Side;
|
|
457
|
+
align?: 'start' | 'center' | 'end';
|
|
458
|
+
sideOffset?: number;
|
|
459
|
+
};
|
|
460
|
+
export declare function DropdownMenuContent(props: DropdownMenuContentProps): import("react").JSX.Element | null;
|
|
461
|
+
type DropdownMenuItemProps = Omit<ComponentProps<'button'>, 'onSelect'> & {
|
|
462
|
+
asChild?: boolean;
|
|
463
|
+
iconLeft?: ReactNode;
|
|
464
|
+
tone?: 'default' | 'danger';
|
|
465
|
+
textValue?: string;
|
|
466
|
+
/** Runs for pointer and keyboard activation. Call preventDefault() to keep the menu open. */
|
|
467
|
+
onSelect?: (event: Event) => void;
|
|
468
|
+
};
|
|
469
|
+
export declare function DropdownMenuItem({ asChild, iconLeft, tone, textValue, disabled, onSelect, onClick, onClickCapture, onAuxClickCapture, onKeyDown, onPointerMove, children, className, ...props }: DropdownMenuItemProps): import("react").JSX.Element;
|
|
470
|
+
export declare function DropdownMenuGroup({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
471
|
+
export declare function DropdownMenuLabel({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
472
|
+
export declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<'hr'>): import("react").JSX.Element;
|
|
314
473
|
//#endregion
|
|
315
474
|
//#region src/components/input/copy-input.d.ts
|
|
316
475
|
type CopyInputProps = Omit<FieldProps, 'type' | 'value' | 'defaultValue' | 'readOnly' | 'onChange'> & {
|
|
@@ -368,6 +527,39 @@ type MeterProps = Omit<ComponentProps<'div'>, 'children'> & {
|
|
|
368
527
|
*/
|
|
369
528
|
export declare function Meter({ label, summary, segments, className, ...props }: MeterProps): import("react").JSX.Element;
|
|
370
529
|
//#endregion
|
|
530
|
+
//#region src/components/radio-group/radio-group.d.ts
|
|
531
|
+
type SelectionProps = {
|
|
532
|
+
value: string | null;
|
|
533
|
+
defaultValue?: never;
|
|
534
|
+
} | {
|
|
535
|
+
value?: undefined;
|
|
536
|
+
defaultValue?: string;
|
|
537
|
+
};
|
|
538
|
+
type RadioGroupProps = Omit<ComponentProps<'fieldset'>, 'name' | 'onChange' | 'defaultValue' | 'children'> & SelectionProps & {
|
|
539
|
+
/** Native group and submitted field name. Independent groups need different names. */
|
|
540
|
+
name: string;
|
|
541
|
+
legend: ReactNode;
|
|
542
|
+
description?: ReactNode;
|
|
543
|
+
/** Shows one group message; marks the group invalid. `true` omits the message. */
|
|
544
|
+
error?: ReactNode;
|
|
545
|
+
required?: boolean;
|
|
546
|
+
onValueChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
|
|
547
|
+
variant?: 'default' | 'card';
|
|
548
|
+
/** Layout only; both orientations keep native radio keyboard behavior. */
|
|
549
|
+
orientation?: 'vertical' | 'horizontal';
|
|
550
|
+
itemsClassName?: string;
|
|
551
|
+
children: ReactNode;
|
|
552
|
+
};
|
|
553
|
+
export declare function RadioGroup({ name, legend, description, error, value, defaultValue, onValueChange, variant, orientation, itemsClassName, children, className, disabled, required, form, ref, 'aria-invalid': ariaInvalid, 'aria-describedby': describedByProp, ...props }: RadioGroupProps): import("react").JSX.Element;
|
|
554
|
+
type RadioProps = Omit<ComponentProps<'input'>, 'type' | 'size' | 'children' | 'value' | 'readOnly' | 'name' | 'checked' | 'defaultChecked' | 'required' | 'form' | 'aria-label' | 'aria-invalid'> & ChoiceLabelProps & {
|
|
555
|
+
/** A unique, non-empty value within the parent RadioGroup. */
|
|
556
|
+
value: string;
|
|
557
|
+
description?: ReactNode;
|
|
558
|
+
/** Classes for the native input; className belongs to the row or card. */
|
|
559
|
+
inputClassName?: string;
|
|
560
|
+
};
|
|
561
|
+
export declare function Radio({ value, label, description, disabled, className, inputClassName, ref, onChange, 'aria-describedby': describedBy, ...props }: RadioProps): import("react").JSX.Element;
|
|
562
|
+
//#endregion
|
|
371
563
|
//#region src/components/select/select.d.ts
|
|
372
564
|
/** `value` must be non-empty: `''` is reserved for "nothing chosen". */
|
|
373
565
|
type SelectOption = {
|
|
@@ -469,6 +661,66 @@ export declare function SidebarIcon({ className, ...props }: ComponentProps<'spa
|
|
|
469
661
|
/** Count at the end of a SidebarItem, as a small neutral Badge; part of the name ("Projects 8"). */
|
|
470
662
|
export declare function SidebarBadge({ className, ...props }: BadgeProps): import("react").JSX.Element;
|
|
471
663
|
//#endregion
|
|
664
|
+
//#region src/components/slider/types.d.ts
|
|
665
|
+
type RangeSliderValue = readonly [number, number];
|
|
666
|
+
type SliderChangeDetails = {
|
|
667
|
+
thumbIndex: 0 | 1;
|
|
668
|
+
reason: 'pointer' | 'keyboard' | 'input' | 'cancel';
|
|
669
|
+
};
|
|
670
|
+
type SliderCommitDetails = Omit<SliderChangeDetails, 'reason'> & {
|
|
671
|
+
reason: 'pointer' | 'keyboard' | 'input';
|
|
672
|
+
};
|
|
673
|
+
type SliderMark = {
|
|
674
|
+
value: number;
|
|
675
|
+
label?: ReactNode;
|
|
676
|
+
};
|
|
677
|
+
type ValueProps<T> = ({
|
|
678
|
+
value: T;
|
|
679
|
+
defaultValue?: never;
|
|
680
|
+
} | {
|
|
681
|
+
value?: undefined;
|
|
682
|
+
defaultValue?: T;
|
|
683
|
+
}) & {
|
|
684
|
+
onValueChange?: (value: T, details: SliderChangeDetails) => void;
|
|
685
|
+
onValueCommit?: (value: T, details: SliderCommitDetails) => void;
|
|
686
|
+
};
|
|
687
|
+
type LabelProps = {
|
|
688
|
+
label: ReactNode;
|
|
689
|
+
'aria-label'?: string;
|
|
690
|
+
} | {
|
|
691
|
+
label?: never;
|
|
692
|
+
'aria-label': string;
|
|
693
|
+
};
|
|
694
|
+
type SliderCommonProps = Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange' | 'children' | 'aria-label' | 'role'> & LabelProps & {
|
|
695
|
+
min?: number;
|
|
696
|
+
max?: number;
|
|
697
|
+
/** Positive step; (max - min) must be a whole number of steps. */
|
|
698
|
+
step?: number;
|
|
699
|
+
disabled?: boolean;
|
|
700
|
+
helperText?: ReactNode;
|
|
701
|
+
error?: ReactNode;
|
|
702
|
+
showValue?: boolean;
|
|
703
|
+
/** Formats both visible output and spoken value by default. */
|
|
704
|
+
formatValue?: (value: number) => string;
|
|
705
|
+
getValueText?: (value: number, thumbIndex: 0 | 1) => string;
|
|
706
|
+
/** Visual markers only; all step-aligned values remain selectable. */
|
|
707
|
+
marks?: readonly SliderMark[];
|
|
708
|
+
form?: string;
|
|
709
|
+
};
|
|
710
|
+
type SliderProps = SliderCommonProps & ValueProps<number> & {
|
|
711
|
+
name?: string;
|
|
712
|
+
};
|
|
713
|
+
type RangeSliderProps = SliderCommonProps & ValueProps<RangeSliderValue> & {
|
|
714
|
+
thumbLabels: readonly [string, string];
|
|
715
|
+
name?: readonly [string, string];
|
|
716
|
+
/** Thumbs stop at this distance; they never swap or push each other. */
|
|
717
|
+
minStepsBetweenThumbs?: number;
|
|
718
|
+
};
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/components/slider/slider.d.ts
|
|
721
|
+
export declare function Slider({ value, defaultValue, name, onValueChange, onValueCommit, ...props }: SliderProps): import("react").JSX.Element;
|
|
722
|
+
export declare function RangeSlider({ value, defaultValue, name, onValueChange, onValueCommit, ...props }: RangeSliderProps): import("react").JSX.Element;
|
|
723
|
+
//#endregion
|
|
472
724
|
//#region src/components/switch/switch.d.ts
|
|
473
725
|
type SwitchSize = 'sm' | 'md';
|
|
474
726
|
type NativeSwitchProps = Omit<ComponentProps<'input'>, 'type' | 'size' | 'children' | 'role' | 'aria-checked' | 'aria-label'>;
|
|
@@ -649,6 +901,33 @@ type TabPanelProps = Omit<ComponentProps<'div'>, 'role' | 'hidden'> & {
|
|
|
649
901
|
};
|
|
650
902
|
export declare function TabPanel({ value, keepMounted, className, ...props }: TabPanelProps): import("react").JSX.Element | null;
|
|
651
903
|
//#endregion
|
|
904
|
+
//#region src/components/textarea/textarea.d.ts
|
|
905
|
+
type HeightProps = {
|
|
906
|
+
autoResize?: false;
|
|
907
|
+
rows?: number;
|
|
908
|
+
resize?: 'vertical' | 'none';
|
|
909
|
+
minRows?: never;
|
|
910
|
+
maxRows?: never;
|
|
911
|
+
} | {
|
|
912
|
+
autoResize: true;
|
|
913
|
+
minRows?: number;
|
|
914
|
+
maxRows?: number;
|
|
915
|
+
rows?: never;
|
|
916
|
+
resize?: never;
|
|
917
|
+
};
|
|
918
|
+
type TextareaProps = Omit<ComponentProps<'textarea'>, 'children' | 'rows'> & FieldLabelProps & HeightProps & {
|
|
919
|
+
helperText?: ReactNode;
|
|
920
|
+
/** Replaces helperText and marks the field invalid. `true` shows only the error outline. */
|
|
921
|
+
error?: ReactNode;
|
|
922
|
+
size?: FieldSize;
|
|
923
|
+
/** UTF-16 length, matching native maxLength. Never truncates controlled values. */
|
|
924
|
+
showCount?: boolean;
|
|
925
|
+
mono?: boolean;
|
|
926
|
+
/** Classes for the textarea; className belongs to the outer field. */
|
|
927
|
+
textareaClassName?: string;
|
|
928
|
+
};
|
|
929
|
+
export declare function Textarea({ label, floating, helperText, error, size, autoResize, rows, minRows, maxRows, resize, showCount, mono, className, textareaClassName, ref, id, required, disabled, readOnly, placeholder, value, defaultValue, maxLength, onChange, 'aria-describedby': describedBy, 'aria-invalid': ariaInvalid, ...props }: TextareaProps): import("react").JSX.Element;
|
|
930
|
+
//#endregion
|
|
652
931
|
//#region src/components/theme-switcher/use-theme.d.ts
|
|
653
932
|
type Theme = 'system' | 'light' | 'dark';
|
|
654
933
|
type UseThemeOptions = {
|
|
@@ -756,4 +1035,4 @@ export declare function Toaster(props: ToasterProps): import("react").ReactPorta
|
|
|
756
1035
|
//#region src/lib/cn.d.ts
|
|
757
1036
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
758
1037
|
//#endregion
|
|
759
|
-
export type { AlertProps, AlertTone, BadgeProps, BadgeTone, ButtonProps, CardHeaderProps, CardProps, CheckboxGroupProps, CheckboxProps, CopyInputProps, DialogCloseReason, DialogHeaderProps, DialogProps, DialogSize, DrawerCloseProps, DrawerCloseReason, DrawerHeaderProps, DrawerProps, DrawerSide, DrawerSize, InputProps, MeterProps, MeterSegment, MeterTone, PasswordInputProps, SearchInputProps, SelectGroup, SelectOption, SelectProps, SidebarGroupProps, SidebarItemProps, SidebarProps, SidebarTriggerProps, SwitchProps, SwitchSize, TabListProps, TabNavLinkProps, TabNavProps, TabPanelProps, TabProps, TableColumn, TableProps, TableSort, TabsActivationMode, TabsProps, TabsSize, TabsVariant, Theme, ThemeSwitcherProps, ToastActionButton, ToastOptions, ToastPatch, ToastPosition, ToastPromiseOptions, ToastType, ToasterProps, TooltipProps, UseThemeOptions };
|
|
1038
|
+
export type { AccordionContentProps, AccordionItemProps, AccordionProps, AccordionTriggerProps, AccordionVariant, AlertProps, AlertTone, BadgeProps, BadgeTone, ButtonProps, CardHeaderProps, CardProps, CheckboxGroupProps, CheckboxProps, ComboboxGroup, ComboboxInputChangeDetails, ComboboxOpenChangeDetails, ComboboxOption, ComboboxProps, ComboboxValueChangeDetails, CopyInputProps, DialogCloseReason, DialogHeaderProps, DialogProps, DialogSize, DrawerCloseProps, DrawerCloseReason, DrawerHeaderProps, DrawerProps, DrawerSide, DrawerSize, DropdownMenuChangeReason, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuProps, DropdownMenuTriggerProps, InputProps, MeterProps, MeterSegment, MeterTone, PasswordInputProps, RadioGroupProps, RadioProps, RangeSliderProps, RangeSliderValue, SearchInputProps, SelectGroup, SelectOption, SelectProps, SidebarGroupProps, SidebarItemProps, SidebarProps, SidebarTriggerProps, SliderChangeDetails, SliderCommitDetails, SliderCommonProps, SliderMark, SliderProps, SwitchProps, SwitchSize, TabListProps, TabNavLinkProps, TabNavProps, TabPanelProps, TabProps, TableColumn, TableProps, TableSort, TabsActivationMode, TabsProps, TabsSize, TabsVariant, TextareaProps, Theme, ThemeSwitcherProps, ToastActionButton, ToastOptions, ToastPatch, ToastPosition, ToastPromiseOptions, ToastType, ToasterProps, TooltipProps, UseThemeOptions };
|