@moondreamsdev/dreamer-ui 1.7.10-test.99 → 1.7.12
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 +2 -11
- package/dist/Toast-DUpf_XxS.js +754 -0
- package/dist/Toast-DUpf_XxS.js.map +1 -0
- package/dist/Toast-Dj3X8g0Q.cjs +2 -0
- package/dist/Toast-Dj3X8g0Q.cjs.map +1 -0
- package/dist/Window-U9c7lCJ4.cjs +2 -0
- package/dist/Window-U9c7lCJ4.cjs.map +1 -0
- package/dist/{Window-uX5BuBwi.js → Window-bavT8vOT.js} +141 -21
- package/dist/Window-bavT8vOT.js.map +1 -0
- package/dist/components.cjs.js +2 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.esm.js +4250 -2867
- package/dist/components.esm.js.map +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.esm.js +6 -4
- package/dist/hooks.esm.js.map +1 -1
- package/dist/providers.cjs.js +1 -1
- package/dist/providers.esm.js +2 -2
- package/dist/src/components/accordion/Accordion.d.ts +36 -0
- package/dist/src/components/accordion/AccordionItem.d.ts +20 -0
- package/dist/src/components/actionmodal/ActionModal.d.ts +34 -0
- package/dist/src/components/avatar/Avatar.d.ts +24 -8
- package/dist/src/components/badge/Badge.d.ts +24 -2
- package/dist/src/components/button/Button.d.ts +22 -1
- package/dist/src/components/button/LoadingDots.d.ts +9 -0
- package/dist/src/components/button/variants.d.ts +4 -1
- package/dist/src/components/calendar/Calendar.d.ts +105 -0
- package/dist/src/components/calendar/hooks.d.ts +40 -0
- package/dist/src/components/calendar/index.d.ts +2 -0
- package/dist/src/components/calendar/variants.d.ts +41 -0
- package/dist/src/components/callout/Callout.d.ts +31 -10
- package/dist/src/components/card/Card.d.ts +29 -7
- package/dist/src/components/carousel/Carousel.d.ts +24 -1
- package/dist/src/components/checkbox/Checkbox.d.ts +37 -1
- package/dist/src/components/clickable/Clickable.d.ts +28 -0
- package/dist/src/components/code/Code.d.ts +18 -0
- package/dist/src/components/code-block/CodeBlock.d.ts +35 -10
- package/dist/src/components/code-block/classes.d.ts +2 -1
- package/dist/src/components/code-block/format.d.ts +2 -1
- package/dist/src/components/code-block/index.d.ts +1 -1
- package/dist/src/components/code-block/tokenize.d.ts +6 -2
- package/dist/src/components/code-block/types.d.ts +24 -1
- package/dist/src/components/disclosure/Disclosure.d.ts +30 -9
- package/dist/src/components/drawer/Drawer.d.ts +35 -10
- package/dist/src/components/dropdown-menu/DropdownMenu.d.ts +34 -0
- package/dist/src/components/dynamic-list/DynamicList.d.ts +68 -0
- package/dist/src/components/dynamic-list/hooks.d.ts +19 -0
- package/dist/src/components/dynamic-list/index.d.ts +2 -0
- package/dist/src/components/dynamic-list/markers.d.ts +8 -0
- package/dist/src/components/dynamic-list/variants.d.ts +4 -0
- package/dist/src/components/error-boundary/ErrorBoundary.d.ts +32 -9
- package/dist/src/components/form/Form.d.ts +28 -0
- package/dist/src/components/form/factories.d.ts +8 -0
- package/dist/src/components/form/hooks.d.ts +9 -0
- package/dist/src/components/form/index.d.ts +3 -0
- package/dist/src/components/form/types.d.ts +91 -0
- package/dist/src/components/form/variants.d.ts +32 -0
- package/dist/src/components/help-icon/HelpIcon.d.ts +48 -0
- package/dist/src/components/help-icon/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +5 -1
- package/dist/src/components/input/Input.d.ts +30 -0
- package/dist/src/components/input/variants.d.ts +2 -0
- package/dist/src/components/label/Label.d.ts +33 -0
- package/dist/src/components/modal/Modal.d.ts +47 -1
- package/dist/src/components/pagination/Pagination.d.ts +36 -4
- package/dist/src/components/popover/Popover.d.ts +53 -3
- package/dist/src/components/radiogroup/RadioGroup.d.ts +33 -0
- package/dist/src/components/radiogroup/RadioGroupItem.d.ts +9 -0
- package/dist/src/components/scroll-area/ScrollArea.d.ts +25 -0
- package/dist/src/components/select/Select.d.ts +49 -0
- package/dist/src/components/separator/Separator.d.ts +23 -5
- package/dist/src/components/skeleton/Skeleton.d.ts +22 -2
- package/dist/src/components/skeleton/variants.d.ts +2 -0
- package/dist/src/components/slider/Slider.d.ts +46 -10
- package/dist/src/components/table/Table.d.ts +96 -0
- package/dist/src/components/table/hooks.d.ts +28 -0
- package/dist/src/components/table/index.d.ts +2 -0
- package/dist/src/components/table/variants.d.ts +14 -0
- package/dist/src/components/tabs/Tabs.d.ts +34 -9
- package/dist/src/components/textarea/Textarea.d.ts +37 -0
- package/dist/src/components/textarea/variants.d.ts +2 -0
- package/dist/src/components/toast/Toast.d.ts +39 -0
- package/dist/src/components/toggle/Toggle.d.ts +29 -0
- package/dist/src/components/tooltip/Tooltip.d.ts +42 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/{components/carousel → hooks}/useScreenSize.d.ts +4 -4
- package/dist/src/symbols/ChevronUp.d.ts +2 -0
- package/dist/src/symbols/GripVertical.d.ts +2 -0
- package/dist/src/symbols/InfoCircledFilled.d.ts +2 -0
- package/dist/src/symbols/Plus.d.ts +2 -0
- package/dist/src/symbols/Trash.d.ts +2 -0
- package/dist/src/symbols/index.d.ts +5 -0
- package/dist/src/symbols/props.d.ts +2 -2
- package/dist/symbols.cjs.js +1 -1
- package/dist/symbols.esm.js +21 -16
- package/dist/theme.css +4 -1
- package/dist/useScreenSize-DiuQZBHb.js +32 -0
- package/dist/useScreenSize-DiuQZBHb.js.map +1 -0
- package/dist/useScreenSize-UGyolnfn.cjs +2 -0
- package/dist/useScreenSize-UGyolnfn.cjs.map +1 -0
- package/package.json +5 -1
- package/dist/Toast-CRG3g8vr.js +0 -512
- package/dist/Toast-CRG3g8vr.js.map +0 -1
- package/dist/Toast-wRAL8PRi.cjs +0 -2
- package/dist/Toast-wRAL8PRi.cjs.map +0 -1
- package/dist/Window-5IZnBJt9.cjs +0 -2
- package/dist/Window-5IZnBJt9.cjs.map +0 -1
- package/dist/Window-uX5BuBwi.js.map +0 -1
- package/dist/src/components/slot/Slot.d.ts +0 -7
- package/dist/src/components/slot/index.d.ts +0 -1
- package/dist/src/components/tooltip/hooks.d.ts +0 -31
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface RadioGroupItemProps {
|
|
3
|
+
/** The value associated with this radio item. */
|
|
3
4
|
value: string;
|
|
5
|
+
/** The content to display for this radio item. */
|
|
4
6
|
children: React.ReactNode;
|
|
7
|
+
/** Additional CSS classes to apply to this radio item. */
|
|
5
8
|
className?: string;
|
|
9
|
+
/** Whether this radio item is currently selected. */
|
|
6
10
|
isSelected?: boolean;
|
|
11
|
+
/** Callback fired when this radio item is selected. */
|
|
7
12
|
onChange?: (value: string) => void;
|
|
13
|
+
/** Whether this radio item is disabled. */
|
|
8
14
|
disabled?: boolean;
|
|
15
|
+
/** The name attribute for the radio input group. */
|
|
9
16
|
name?: string;
|
|
17
|
+
/** Whether to hide the native radio input element. */
|
|
10
18
|
hideInput?: boolean;
|
|
19
|
+
/** Optional description text for this radio item. */
|
|
11
20
|
description?: string;
|
|
12
21
|
}
|
|
13
22
|
export declare function RadioGroupItem({ value, children, className, isSelected, onChange, disabled, hideInput, description, name, }: RadioGroupItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,4 +17,29 @@ export interface ScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
17
17
|
/** Reference to the root element */
|
|
18
18
|
ref?: React.Ref<HTMLDivElement>;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A custom scrollable area component with styled scrollbars that appear on hover/scroll.
|
|
22
|
+
* Provides cross-browser consistent scrolling experience with customizable appearance.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Basic scroll area
|
|
27
|
+
* <ScrollArea className="h-64 w-full border rounded">
|
|
28
|
+
* <div className="p-4 space-y-2">
|
|
29
|
+
* {Array.from({length: 50}).map((_, i) => (
|
|
30
|
+
* <div key={i}>Item {i + 1}</div>
|
|
31
|
+
* ))}
|
|
32
|
+
* </div>
|
|
33
|
+
* </ScrollArea>
|
|
34
|
+
*
|
|
35
|
+
* // Customized scrollbars
|
|
36
|
+
* <ScrollArea
|
|
37
|
+
* className="h-96 w-80"
|
|
38
|
+
* scrollbarThickness={12}
|
|
39
|
+
* thumbClassName="bg-primary/60 hover:bg-primary/80"
|
|
40
|
+
* >
|
|
41
|
+
* <LongContent />
|
|
42
|
+
* </ScrollArea>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
20
45
|
export declare function ScrollArea({ className, thumbClassName, viewportClassName, scrollbarClassName, scrollbarThickness, children, id, ref, ...props }: ScrollAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,20 +3,69 @@ import { SelectOption } from './hooks';
|
|
|
3
3
|
import { SelectSize } from './variants';
|
|
4
4
|
export type { SelectOption };
|
|
5
5
|
export interface SelectProps {
|
|
6
|
+
/** Array of option objects. SelectOption: { text: string, value: string, disabled?: boolean, description?: string } */
|
|
6
7
|
options: SelectOption[];
|
|
8
|
+
/** The current value of the select (controlled). */
|
|
7
9
|
value?: string;
|
|
10
|
+
/** Placeholder text to show when no option is selected. */
|
|
8
11
|
placeholder?: string;
|
|
12
|
+
/** Whether the select is searchable (combobox mode). */
|
|
9
13
|
searchable?: boolean;
|
|
14
|
+
/** Whether the entire select is disabled. */
|
|
10
15
|
disabled?: boolean;
|
|
16
|
+
/** Whether to show a clear button to reset selection. */
|
|
11
17
|
clearable?: boolean;
|
|
18
|
+
/** The size variant of the select. */
|
|
12
19
|
size?: SelectSize;
|
|
20
|
+
/** Additional CSS classes to apply to the select container. */
|
|
13
21
|
className?: string;
|
|
22
|
+
/** Additional CSS classes to apply to the trigger button. */
|
|
14
23
|
triggerClassName?: string;
|
|
24
|
+
/** Additional CSS classes to apply to the dropdown menu. */
|
|
15
25
|
dropdownClassName?: string;
|
|
26
|
+
/** The HTML id attribute for the select. */
|
|
16
27
|
id?: string;
|
|
28
|
+
/** Reference to the select container element. */
|
|
17
29
|
ref?: React.Ref<HTMLDivElement>;
|
|
30
|
+
/** Callback fired when the selection changes. */
|
|
18
31
|
onChange?: (value: string) => void;
|
|
32
|
+
/** Callback fired when search input changes (searchable mode). */
|
|
19
33
|
onSearch?: (searchTerm: string) => void;
|
|
34
|
+
/** Placeholder text for the search input (searchable mode). */
|
|
20
35
|
searchPlaceholder?: string;
|
|
21
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A feature-rich select component with search, keyboard navigation, and accessibility.
|
|
39
|
+
* Supports both simple selection and searchable combobox functionality.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Basic select
|
|
44
|
+
* const options = [
|
|
45
|
+
* { text: 'Apple', value: 'apple' },
|
|
46
|
+
* { text: 'Banana', value: 'banana' },
|
|
47
|
+
* { text: 'Orange', value: 'orange' }
|
|
48
|
+
* ];
|
|
49
|
+
*
|
|
50
|
+
* <Select
|
|
51
|
+
* options={options}
|
|
52
|
+
* value={selectedFruit}
|
|
53
|
+
* onChange={setSelectedFruit}
|
|
54
|
+
* placeholder="Choose a fruit"
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* // Searchable select with descriptions
|
|
58
|
+
* <Select
|
|
59
|
+
* options={[
|
|
60
|
+
* { text: 'React', value: 'react', description: 'A library for building UIs' },
|
|
61
|
+
* { text: 'Vue', value: 'vue', description: 'The progressive framework' }
|
|
62
|
+
* ]}
|
|
63
|
+
* searchable
|
|
64
|
+
* clearable
|
|
65
|
+
* placeholder="Select framework..."
|
|
66
|
+
* searchPlaceholder="Search frameworks..."
|
|
67
|
+
* onChange={setFramework}
|
|
68
|
+
* />
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
22
71
|
export declare function Select({ options, value, placeholder, searchable, disabled, clearable, size, className, triggerClassName, dropdownClassName, id, ref, onChange, onSearch, searchPlaceholder, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,14 +2,32 @@ import React, { Ref } from 'react';
|
|
|
2
2
|
import { Thickness } from './variants';
|
|
3
3
|
export type Orientation = 'horizontal' | 'vertical';
|
|
4
4
|
export interface SeparatorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'role'> {
|
|
5
|
+
/** Reference to the separator element */
|
|
5
6
|
ref?: Ref<HTMLDivElement>;
|
|
7
|
+
/** The orientation of the separator */
|
|
6
8
|
orientation?: Orientation;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the separator is decorative only or serves a semantic purpose.
|
|
9
|
-
* When decorative=true, it's hidden from screen readers.
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
9
|
+
/** Whether the separator is decorative only. When true, it's hidden from screen readers */
|
|
12
10
|
decorative?: boolean;
|
|
11
|
+
/** The thickness variant of the separator */
|
|
13
12
|
thickness?: Thickness;
|
|
14
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A visual separator component for dividing content sections.
|
|
16
|
+
* Supports both horizontal and vertical orientations with customizable thickness.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Horizontal separator
|
|
21
|
+
* <Separator />
|
|
22
|
+
*
|
|
23
|
+
* // Vertical separator
|
|
24
|
+
* <Separator orientation="vertical" className="h-6" />
|
|
25
|
+
*
|
|
26
|
+
* // Thick separator
|
|
27
|
+
* <Separator thickness="thick" />
|
|
28
|
+
*
|
|
29
|
+
* // Decorative separator (hidden from screen readers)
|
|
30
|
+
* <Separator decorative />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
15
33
|
export declare function Separator({ orientation, decorative, thickness, className, ...props }: SeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type SkeletonVariants } from './variants';
|
|
3
3
|
export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement>, SkeletonVariants {
|
|
4
|
-
/**
|
|
4
|
+
/** Additional CSS classes to apply to the skeleton */
|
|
5
5
|
className?: string;
|
|
6
6
|
/** Number of skeleton lines to render (for text-like skeletons) */
|
|
7
7
|
lines?: number;
|
|
8
|
-
/** Whether the skeleton should animate */
|
|
8
|
+
/** Whether the skeleton should animate with a pulse effect */
|
|
9
9
|
animate?: boolean;
|
|
10
10
|
/** Ref to be passed to the skeleton element */
|
|
11
11
|
ref?: React.Ref<HTMLDivElement>;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* A loading placeholder component that mimics the structure of content being loaded.
|
|
15
|
+
* Provides visual feedback during data fetching with customizable shapes and animations.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // Basic skeleton
|
|
20
|
+
* <Skeleton className="h-4 w-48" />
|
|
21
|
+
*
|
|
22
|
+
* // Multiple text lines
|
|
23
|
+
* <Skeleton lines={3} lineSpacing="md" />
|
|
24
|
+
*
|
|
25
|
+
* // Different shapes
|
|
26
|
+
* <Skeleton shape="circle" className="h-12 w-12" />
|
|
27
|
+
* <Skeleton shape="rounded" className="h-32 w-full" />
|
|
28
|
+
*
|
|
29
|
+
* // Without animation
|
|
30
|
+
* <Skeleton animate={false} className="h-6 w-32" />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
13
33
|
export declare function Skeleton({ shape, lineSpacing, className, lines, animate, ref, ...props }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,6 +13,8 @@ export declare const skeletonVariants: {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
export interface SkeletonVariants {
|
|
16
|
+
/** The shape of the skeleton element */
|
|
16
17
|
shape?: keyof typeof skeletonVariants.shape;
|
|
18
|
+
/** Spacing between skeleton lines when multiple lines are used */
|
|
17
19
|
lineSpacing?: keyof typeof skeletonVariants.lineSpacing;
|
|
18
20
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface SliderProps {
|
|
3
3
|
id?: string;
|
|
4
|
-
/**
|
|
4
|
+
/** The controlled value of the slider */
|
|
5
5
|
value?: number;
|
|
6
|
-
/**
|
|
6
|
+
/** The initial value of the slider (uncontrolled) */
|
|
7
7
|
defaultValue?: number;
|
|
8
|
-
/** Callback fired when the value changes */
|
|
8
|
+
/** Callback fired when the slider value changes */
|
|
9
9
|
onValueChange?: (value: number) => void;
|
|
10
|
-
/**
|
|
10
|
+
/** The minimum value of the slider */
|
|
11
11
|
min?: number;
|
|
12
|
-
/**
|
|
12
|
+
/** The maximum value of the slider */
|
|
13
13
|
max?: number;
|
|
14
|
-
/**
|
|
14
|
+
/** The step increment of the slider */
|
|
15
15
|
step?: number;
|
|
16
16
|
/** Whether the slider is disabled */
|
|
17
17
|
disabled?: boolean;
|
|
18
|
-
/**
|
|
18
|
+
/** Additional CSS classes to apply to the track element */
|
|
19
19
|
trackClassName?: string;
|
|
20
|
-
/**
|
|
20
|
+
/** Additional CSS classes to apply to the filled range element */
|
|
21
21
|
rangeClassName?: string;
|
|
22
|
-
/**
|
|
22
|
+
/** Additional CSS classes to apply to the thumb element */
|
|
23
23
|
thumbClassName?: string;
|
|
24
|
-
/**
|
|
24
|
+
/** Additional CSS classes to apply to the slider */
|
|
25
25
|
className?: string;
|
|
26
26
|
/** Ref to the root element */
|
|
27
27
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -30,4 +30,40 @@ export interface SliderProps {
|
|
|
30
30
|
/** ARIA labelledby for accessibility */
|
|
31
31
|
ariaLabelledBy?: string;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A horizontal slider component for selecting numeric values within a specified range.
|
|
35
|
+
* Supports both controlled and uncontrolled modes with keyboard navigation and touch support.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Basic slider
|
|
40
|
+
* <Slider
|
|
41
|
+
* min={0}
|
|
42
|
+
* max={100}
|
|
43
|
+
* value={volume}
|
|
44
|
+
* onValueChange={setVolume}
|
|
45
|
+
* ariaLabel="Volume control"
|
|
46
|
+
* />
|
|
47
|
+
*
|
|
48
|
+
* // Uncontrolled with custom step
|
|
49
|
+
* <Slider
|
|
50
|
+
* defaultValue={50}
|
|
51
|
+
* min={0}
|
|
52
|
+
* max={200}
|
|
53
|
+
* step={5}
|
|
54
|
+
* onValueChange={(value) => console.log('Price:', value)}
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* // Customized appearance
|
|
58
|
+
* <Slider
|
|
59
|
+
* value={opacity}
|
|
60
|
+
* onValueChange={setOpacity}
|
|
61
|
+
* min={0}
|
|
62
|
+
* max={1}
|
|
63
|
+
* step={0.1}
|
|
64
|
+
* rangeClassName="bg-blue-500"
|
|
65
|
+
* thumbClassName="bg-blue-600 border-2 border-white"
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
33
69
|
export declare function Slider({ id, value, defaultValue, onValueChange, min, max, step, disabled, trackClassName, rangeClassName, thumbClassName, className, ref, ariaLabel, ariaLabelledBy, ...props }: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableSize } from './variants';
|
|
3
|
+
export interface TableColumn<T extends object, U = unknown> {
|
|
4
|
+
/** Unique key for the column. Used for cell value if no `accessor` is provided */
|
|
5
|
+
key: Extract<keyof T, string>;
|
|
6
|
+
/** Column header label */
|
|
7
|
+
header: string;
|
|
8
|
+
/** Accessor function or property name to get cell value */
|
|
9
|
+
accessor?: keyof T | ((item: T) => U);
|
|
10
|
+
/** Custom cell renderer */
|
|
11
|
+
cell?: (item: T, value: U) => React.ReactNode;
|
|
12
|
+
/** Whether the column is sortable */
|
|
13
|
+
sortable?: boolean;
|
|
14
|
+
/** Custom sort function. Negative result indicates descending order */
|
|
15
|
+
sortFunction?: (a: T, b: T) => number;
|
|
16
|
+
/** Column width */
|
|
17
|
+
width?: string | number;
|
|
18
|
+
/** Column alignment */
|
|
19
|
+
align?: 'left' | 'center' | 'right';
|
|
20
|
+
/** Additional header class names */
|
|
21
|
+
headerClassName?: string;
|
|
22
|
+
/** Additional cell class names */
|
|
23
|
+
cellClassName?: string;
|
|
24
|
+
/** Additional column class names */
|
|
25
|
+
columnClassName?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TableProps<T extends object> {
|
|
28
|
+
/** Unique identifier for the table */
|
|
29
|
+
id?: string;
|
|
30
|
+
/** Custom CSS classes */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** React ref for the table container */
|
|
33
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
34
|
+
/** Size variant affecting padding and font sizes */
|
|
35
|
+
size?: TableSize;
|
|
36
|
+
/** Array of data objects to display in the table */
|
|
37
|
+
data: T[];
|
|
38
|
+
/** Column definitions specifying headers, accessors, and rendering options */
|
|
39
|
+
columns: TableColumn<T>[];
|
|
40
|
+
/** Whether to show row selection checkboxes */
|
|
41
|
+
selectable?: boolean;
|
|
42
|
+
/** Function to get unique row ID */
|
|
43
|
+
getRowId?: (item: T, index: number) => string | number;
|
|
44
|
+
/** Initial selected row IDs */
|
|
45
|
+
initialSelected?: (string | number)[];
|
|
46
|
+
/** Callback fired when row selection changes */
|
|
47
|
+
onSelectionChange?: (selectedIds: (string | number)[]) => void;
|
|
48
|
+
/** Whether to show table header */
|
|
49
|
+
showHeader?: boolean;
|
|
50
|
+
/** Whether to add striped row styling */
|
|
51
|
+
striped?: boolean;
|
|
52
|
+
/** Whether to add hover effects */
|
|
53
|
+
hoverable?: boolean;
|
|
54
|
+
/** Empty state content */
|
|
55
|
+
emptyState?: React.ReactNode;
|
|
56
|
+
/** Whether to show loading state */
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
/** Loading content */
|
|
59
|
+
loadingContent?: React.ReactNode;
|
|
60
|
+
/** Table caption for accessibility */
|
|
61
|
+
caption?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A feature-rich table component with sorting, selection, and accessibility features.
|
|
65
|
+
* Supports custom cell rendering, row selection, and responsive design.
|
|
66
|
+
*
|
|
67
|
+
* **Important:** The `data` prop should be stable (either declared outside the component or memoized)
|
|
68
|
+
* to prevent unnecessary re-renders and maintain performance.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```tsx
|
|
72
|
+
* // Define stable data and columns outside component or use useMemo
|
|
73
|
+
* const tableData = [
|
|
74
|
+
* { id: 1, name: 'John Doe', email: 'john@example.com' },
|
|
75
|
+
* { id: 2, name: 'Jane Smith', email: 'jane@example.com' }
|
|
76
|
+
* ];
|
|
77
|
+
*
|
|
78
|
+
* const columns = [
|
|
79
|
+
* { key: 'name', header: 'Name', sortable: true },
|
|
80
|
+
* { key: 'email', header: 'Email', sortable: true },
|
|
81
|
+
* {
|
|
82
|
+
* key: 'actions',
|
|
83
|
+
* header: 'Actions',
|
|
84
|
+
* cell: (item) => <Button onClick={() => edit(item.id)}>Edit</Button>
|
|
85
|
+
* }
|
|
86
|
+
* ];
|
|
87
|
+
*
|
|
88
|
+
* <Table
|
|
89
|
+
* data={tableData}
|
|
90
|
+
* columns={columns}
|
|
91
|
+
* selectable
|
|
92
|
+
* onSelectionChange={(selected) => setSelectedIds(selected)}
|
|
93
|
+
* />
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function Table<T extends object>({ id, className, ref, size, data, columns, selectable, getRowId, initialSelected, onSelectionChange, showHeader, striped, hoverable, emptyState, loading, loadingContent, caption, ...props }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type TableSortDirection = 'asc' | 'desc' | null;
|
|
2
|
+
export interface SortConfig<T> {
|
|
3
|
+
key: keyof T | null;
|
|
4
|
+
direction: TableSortDirection;
|
|
5
|
+
}
|
|
6
|
+
export interface UseTableSortOptions<T> {
|
|
7
|
+
data: T[];
|
|
8
|
+
initialSort?: SortConfig<T>;
|
|
9
|
+
}
|
|
10
|
+
export interface UseTableSortResult<T> {
|
|
11
|
+
sortedData: T[];
|
|
12
|
+
sortConfig: SortConfig<T>;
|
|
13
|
+
handleSort: (key: keyof T, customSorter?: (a: T, b: T) => number) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useTableSort<T>({ data, initialSort, }: UseTableSortOptions<T>): UseTableSortResult<T>;
|
|
16
|
+
export interface UseTableSelectionOptions {
|
|
17
|
+
initialSelected?: (string | number)[];
|
|
18
|
+
}
|
|
19
|
+
export declare function useTableSelection({ initialSelected }?: UseTableSelectionOptions): {
|
|
20
|
+
selectedRows: Set<string | number>;
|
|
21
|
+
isRowSelected: (id: string | number) => boolean;
|
|
22
|
+
selectRow: (id: string | number) => void;
|
|
23
|
+
deselectRow: (id: string | number) => void;
|
|
24
|
+
selectAll: (ids: (string | number)[]) => void;
|
|
25
|
+
deselectAll: () => void;
|
|
26
|
+
isAllSelected: (ids: (string | number)[]) => boolean;
|
|
27
|
+
isPartiallySelected: (ids: (string | number)[]) => boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface TableVariantStyles {
|
|
2
|
+
container: string;
|
|
3
|
+
table: string;
|
|
4
|
+
header: string;
|
|
5
|
+
headerCell: string;
|
|
6
|
+
sortButton: string;
|
|
7
|
+
cell: string;
|
|
8
|
+
selectedRow: string;
|
|
9
|
+
checkbox: string;
|
|
10
|
+
checkboxSize: number;
|
|
11
|
+
}
|
|
12
|
+
export type TableSize = 'sm' | 'md' | 'lg';
|
|
13
|
+
export declare const TableSizes: Record<TableSize, TableVariantStyles>;
|
|
14
|
+
export {};
|
|
@@ -2,25 +2,50 @@ import React from 'react';
|
|
|
2
2
|
import { TabsVariant, TabsWidth } from './variants';
|
|
3
3
|
export interface TabsProps {
|
|
4
4
|
id?: string;
|
|
5
|
-
/** The
|
|
5
|
+
/** The value of the tab that should be active when initially rendered */
|
|
6
6
|
defaultValue?: string;
|
|
7
|
-
/** The
|
|
7
|
+
/** The controlled value of the tab to activate */
|
|
8
8
|
value?: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Event handler called when the value changes */
|
|
10
10
|
onValueChange?: (value: string) => void;
|
|
11
|
-
/** How the tabs should be sized */
|
|
11
|
+
/** How the tabs should be sized. "fit" sizes tabs to content, "full" makes them equal width */
|
|
12
12
|
tabsWidth?: TabsWidth;
|
|
13
|
-
/** The visual style variant */
|
|
13
|
+
/** The visual style variant of the tabs */
|
|
14
14
|
variant?: TabsVariant;
|
|
15
|
-
/** Additional
|
|
15
|
+
/** Additional CSS classes to apply to the tabs container */
|
|
16
16
|
className?: string;
|
|
17
|
-
/** The tab
|
|
17
|
+
/** The tab list and content elements */
|
|
18
18
|
children?: React.ReactNode;
|
|
19
19
|
/** Ref to the tabs container */
|
|
20
20
|
ref?: React.Ref<HTMLDivElement>;
|
|
21
|
-
/** Additional
|
|
21
|
+
/** Additional CSS classes to apply to the tab triggers */
|
|
22
22
|
triggersClassName?: string;
|
|
23
|
-
/** Additional
|
|
23
|
+
/** Additional CSS classes to apply to the tab content */
|
|
24
24
|
contentClassName?: string;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A tabs component for organizing content into switchable sections.
|
|
28
|
+
* Works with TabsList, TabsTrigger, and TabsContent child components.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Tabs defaultValue="tab1" variant="underline">
|
|
33
|
+
* <TabsList>
|
|
34
|
+
* <TabsTrigger value="tab1">Overview</TabsTrigger>
|
|
35
|
+
* <TabsTrigger value="tab2">Details</TabsTrigger>
|
|
36
|
+
* <TabsTrigger value="tab3">Settings</TabsTrigger>
|
|
37
|
+
* </TabsList>
|
|
38
|
+
*
|
|
39
|
+
* <TabsContent value="tab1">
|
|
40
|
+
* <h3>Overview Content</h3>
|
|
41
|
+
* </TabsContent>
|
|
42
|
+
* <TabsContent value="tab2">
|
|
43
|
+
* <h3>Details Content</h3>
|
|
44
|
+
* </TabsContent>
|
|
45
|
+
* <TabsContent value="tab3">
|
|
46
|
+
* <h3>Settings Content</h3>
|
|
47
|
+
* </TabsContent>
|
|
48
|
+
* </Tabs>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
26
51
|
export declare function Tabs({ defaultValue, value, onValueChange, tabsWidth, variant, className, children, ref, id, triggersClassName, contentClassName, }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,12 +2,49 @@ import { Ref } from 'react';
|
|
|
2
2
|
import './styles.css';
|
|
3
3
|
import { TextareaVariants } from './variants';
|
|
4
4
|
export interface TextareaProps extends Partial<TextareaVariants>, React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
5
|
+
/** Reference to the textarea element. */
|
|
5
6
|
ref?: Ref<HTMLTextAreaElement>;
|
|
7
|
+
/** Read-only mode for displaying text content without interaction styling. */
|
|
6
8
|
displayOnlyMode?: boolean;
|
|
9
|
+
/** Error message to display below the textarea. */
|
|
7
10
|
errorMessage?: string;
|
|
11
|
+
/** Success message to display below the textarea. */
|
|
8
12
|
successMessage?: string;
|
|
13
|
+
/** Whether to hide the resize handle (Webkit browsers only). */
|
|
9
14
|
hideResizeHandle?: boolean;
|
|
15
|
+
/** Whether the textarea should automatically expand based on content. */
|
|
10
16
|
autoExpand?: boolean;
|
|
17
|
+
/** Maximum number of characters allowed. Shows character count when > 0. */
|
|
11
18
|
characterLimit?: number;
|
|
12
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A versatile textarea component with auto-expand, character counting, and validation states.
|
|
22
|
+
* Supports both interactive and display-only modes with various styling options.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Basic textarea
|
|
27
|
+
* <Textarea
|
|
28
|
+
* placeholder="Enter your message..."
|
|
29
|
+
* rows={4}
|
|
30
|
+
* value={message}
|
|
31
|
+
* onChange={(e) => setMessage(e.target.value)}
|
|
32
|
+
* />
|
|
33
|
+
*
|
|
34
|
+
* // Auto-expanding with character limit
|
|
35
|
+
* <Textarea
|
|
36
|
+
* autoExpand
|
|
37
|
+
* characterLimit={500}
|
|
38
|
+
* placeholder="Write your bio..."
|
|
39
|
+
* errorMessage={bioError}
|
|
40
|
+
* variant="outline"
|
|
41
|
+
* />
|
|
42
|
+
*
|
|
43
|
+
* // Display-only mode
|
|
44
|
+
* <Textarea
|
|
45
|
+
* displayOnlyMode
|
|
46
|
+
* value="Read-only content display"
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
13
50
|
export declare function Textarea({ variant, rounded, displayOnlyMode, errorMessage, successMessage, hideResizeHandle, autoExpand, characterLimit, className, ...rest }: TextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,9 @@ export declare const roundedVariants: {
|
|
|
13
13
|
};
|
|
14
14
|
export type TextareaRounded = keyof typeof roundedVariants;
|
|
15
15
|
export interface TextareaVariants {
|
|
16
|
+
/** Visual style variant of the textarea. */
|
|
16
17
|
variant: TextareaVariant;
|
|
18
|
+
/** Border radius of the textarea. */
|
|
17
19
|
rounded: TextareaRounded;
|
|
18
20
|
}
|
|
19
21
|
export declare const textareaDefaults: TextareaVariants;
|
|
@@ -6,12 +6,19 @@ export interface ToastAction {
|
|
|
6
6
|
}
|
|
7
7
|
/** Data for a toast notification */
|
|
8
8
|
export interface ToastData {
|
|
9
|
+
/** Unique identifier for the toast */
|
|
9
10
|
id: string;
|
|
11
|
+
/** The main message text for the toast */
|
|
10
12
|
title: string;
|
|
13
|
+
/** Optional secondary message text */
|
|
11
14
|
description?: string;
|
|
15
|
+
/** The type of toast which determines styling and icon. Can be extended with customTypes */
|
|
12
16
|
type?: ToastType;
|
|
17
|
+
/** Optional action button configuration */
|
|
13
18
|
action?: ToastAction;
|
|
19
|
+
/** Duration in milliseconds before auto-dismiss. Set to 0 to disable auto-dismiss */
|
|
14
20
|
duration?: number;
|
|
21
|
+
/** Callback fired when the toast is removed */
|
|
15
22
|
onRemove?: (id: string) => void;
|
|
16
23
|
}
|
|
17
24
|
interface ToastProps extends ToastData {
|
|
@@ -21,5 +28,37 @@ interface ToastProps extends ToastData {
|
|
|
21
28
|
}>;
|
|
22
29
|
customComponent?: React.ComponentType<ToastData>;
|
|
23
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* A notification toast component for displaying temporary messages to users.
|
|
33
|
+
* Supports different types, actions, and auto-dismissal with customizable styling.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Basic toast
|
|
38
|
+
* <Toast
|
|
39
|
+
* id="notification-1"
|
|
40
|
+
* title="Success!"
|
|
41
|
+
* description="Your changes have been saved."
|
|
42
|
+
* type="info"
|
|
43
|
+
* />
|
|
44
|
+
*
|
|
45
|
+
* // Toast with action button
|
|
46
|
+
* <Toast
|
|
47
|
+
* id="undo-toast"
|
|
48
|
+
* title="Item deleted"
|
|
49
|
+
* action={{ label: "Undo", onClick: restoreItem }}
|
|
50
|
+
* duration={5000}
|
|
51
|
+
* />
|
|
52
|
+
*
|
|
53
|
+
* // Warning toast with custom duration
|
|
54
|
+
* <Toast
|
|
55
|
+
* id="warning-toast"
|
|
56
|
+
* title="Connection lost"
|
|
57
|
+
* description="Trying to reconnect..."
|
|
58
|
+
* type="warning"
|
|
59
|
+
* duration={0}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
24
63
|
export declare function Toast({ id, title, description, type, action, duration, onRemove, customTypes, customComponent: CustomComponent, }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
25
64
|
export {};
|
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
import React, { Ref } from 'react';
|
|
2
2
|
import { ToggleBackgroundClasses, ToggleSize, ToggleVariant } from './variants';
|
|
3
3
|
export interface ToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
|
|
4
|
+
/** Reference to the toggle button element. */
|
|
4
5
|
ref?: Ref<HTMLButtonElement>;
|
|
6
|
+
/** The size of the toggle switch. */
|
|
5
7
|
size?: ToggleSize;
|
|
8
|
+
/** The color variant of the toggle switch. */
|
|
6
9
|
variant?: ToggleVariant;
|
|
10
|
+
/** Whether the toggle is checked. If not provided, the toggle will be uncontrolled. */
|
|
7
11
|
checked?: boolean;
|
|
12
|
+
/** Callback fired when the toggle state changes. */
|
|
8
13
|
onCheckedChange?: (checked: boolean) => void;
|
|
14
|
+
/** Whether the toggle is disabled. */
|
|
9
15
|
disabled?: boolean;
|
|
16
|
+
/** Additional CSS classes to apply to the toggle thumb. */
|
|
10
17
|
thumbClassName?: string;
|
|
18
|
+
/** Custom background CSS classes for different toggle states. */
|
|
11
19
|
backgroundClassNames?: ToggleBackgroundClasses;
|
|
12
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* A toggle switch component for binary on/off states with smooth animations.
|
|
23
|
+
* Supports both controlled and uncontrolled modes with keyboard navigation.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // Uncontrolled toggle
|
|
28
|
+
* <Toggle onCheckedChange={(checked) => console.log('Toggled:', checked)} />
|
|
29
|
+
*
|
|
30
|
+
* // Controlled toggle
|
|
31
|
+
* <Toggle
|
|
32
|
+
* checked={isEnabled}
|
|
33
|
+
* onCheckedChange={setIsEnabled}
|
|
34
|
+
* size="lg"
|
|
35
|
+
* variant="success"
|
|
36
|
+
* />
|
|
37
|
+
*
|
|
38
|
+
* // Disabled state
|
|
39
|
+
* <Toggle disabled checked />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
13
42
|
export declare function Toggle({ ref, id, size, variant, checked, onCheckedChange, disabled, className, thumbClassName, backgroundClassNames, ...props }: ToggleProps): import("react/jsx-runtime").JSX.Element;
|