@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,25 +1,48 @@
|
|
|
1
1
|
import { ErrorInfo, ReactNode } from 'react';
|
|
2
2
|
import { ErrorBoundaryVariants } from './variants';
|
|
3
3
|
export interface ErrorBoundaryProps {
|
|
4
|
-
/** The id
|
|
4
|
+
/** The HTML id attribute for the error boundary */
|
|
5
5
|
id?: string;
|
|
6
|
-
/** The variant of the
|
|
6
|
+
/** The visual style variant of the error boundary */
|
|
7
7
|
variant?: ErrorBoundaryVariants;
|
|
8
|
-
/** Whether to show a retry button
|
|
8
|
+
/** Whether to show a retry button in the error fallback UI */
|
|
9
9
|
showRetry?: boolean;
|
|
10
|
-
/** Custom error message to display
|
|
10
|
+
/** Custom error message to display in the fallback UI */
|
|
11
11
|
fallbackMessage?: string;
|
|
12
|
-
/** Custom fallback UI to render on error
|
|
12
|
+
/** Custom fallback UI to render on error instead of the default error display */
|
|
13
13
|
fallback?: ReactNode;
|
|
14
|
-
/** Callback function when retry is clicked
|
|
14
|
+
/** Callback function executed when the retry button is clicked */
|
|
15
15
|
onRetry?: () => void;
|
|
16
|
-
/** Callback function when error occurs
|
|
16
|
+
/** Callback function when error occurs */
|
|
17
17
|
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
18
|
-
/** Additional classes to apply to the ErrorBoundary container
|
|
18
|
+
/** Additional classes to apply to the ErrorBoundary container */
|
|
19
19
|
className?: string;
|
|
20
|
-
/** The children to render inside the ErrorBoundary
|
|
20
|
+
/** The children to render inside the ErrorBoundary */
|
|
21
21
|
children: ReactNode;
|
|
22
22
|
/** Flag to indicate if the app is in development mode. For showing error details in development mode */
|
|
23
23
|
inDevEnv?: boolean;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A React error boundary component that catches JavaScript errors in child components
|
|
27
|
+
* and displays a fallback UI instead of crashing the entire application.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // Basic error boundary
|
|
32
|
+
* <ErrorBoundary>
|
|
33
|
+
* <MyComponent />
|
|
34
|
+
* </ErrorBoundary>
|
|
35
|
+
*
|
|
36
|
+
* // With custom error handling and retry
|
|
37
|
+
* <ErrorBoundary
|
|
38
|
+
* variant="warning"
|
|
39
|
+
* fallbackMessage="Failed to load user profile"
|
|
40
|
+
* onError={(error) => logError(error)}
|
|
41
|
+
* onRetry={() => refetchUserData()}
|
|
42
|
+
* inDevEnv={process.env.NODE_ENV === 'development'}
|
|
43
|
+
* >
|
|
44
|
+
* <UserProfile />
|
|
45
|
+
* </ErrorBoundary>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
25
48
|
export declare function ErrorBoundary({ id, variant, showRetry, fallbackMessage, fallback, onRetry, onError, className, children, inDevEnv, }: ErrorBoundaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FormData, FormProps } from './types';
|
|
2
|
+
import { FormVariants } from './variants';
|
|
3
|
+
export interface FormComponentProps<T extends FormData = FormData> extends FormProps<T>, Partial<FormVariants> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A comprehensive form component with built-in validation, responsive layouts,
|
|
7
|
+
* and support for various field types (input, textarea, select, checkbox, radio).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // Define form fields - should be stable (memoized or declared outside component)
|
|
12
|
+
* const userForm = [
|
|
13
|
+
* { __type: 'input', name: 'name', label: 'Full Name', required: true },
|
|
14
|
+
* { __type: 'input', name: 'email', type: 'email', label: 'Email', required: true },
|
|
15
|
+
* { __type: 'textarea', name: 'bio', label: 'Bio', rows: 4 },
|
|
16
|
+
* { __type: 'checkbox', name: 'subscribe', text: 'Subscribe to newsletter' }
|
|
17
|
+
* ];
|
|
18
|
+
*
|
|
19
|
+
* // Usage
|
|
20
|
+
* <Form
|
|
21
|
+
* form={userForm}
|
|
22
|
+
* columns={2}
|
|
23
|
+
* onSubmit={(data) => saveUser(data)}
|
|
24
|
+
* submitButton={<Button type="submit">Save User</Button>}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function Form<T extends FormData = FormData>({ form, initialData, onDataChange, onSubmit, submitButton, columns, responsive, spacing, className, id, ref, }: FormComponentProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormInputField, FormTextareaField, FormSelectField, FormCheckboxField, FormRadioField } from './types';
|
|
2
|
+
export declare const FormFactories: {
|
|
3
|
+
input: (field: Omit<FormInputField, '__type'>) => FormInputField;
|
|
4
|
+
textarea: (field: Omit<FormTextareaField, '__type'>) => FormTextareaField;
|
|
5
|
+
select: (field: Omit<FormSelectField, '__type'>) => FormSelectField;
|
|
6
|
+
checkbox: (field: Omit<FormCheckboxField, '__type'>) => FormCheckboxField;
|
|
7
|
+
radio: (field: Omit<FormRadioField, '__type'>) => FormRadioField;
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormField, FormData, FormErrors } from './types';
|
|
2
|
+
export declare function useFormValidation(fields: FormField[], data: FormData): {
|
|
3
|
+
errors: FormErrors;
|
|
4
|
+
hasErrors: boolean;
|
|
5
|
+
isFormValid: boolean;
|
|
6
|
+
validateForm: (currentData?: FormData) => boolean;
|
|
7
|
+
validateSingleField: (fieldName: string, value: any) => boolean | undefined;
|
|
8
|
+
clearErrors: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { FormFactories } from './factories';
|
|
2
|
+
export { Form, type FormComponentProps } from './Form';
|
|
3
|
+
export type { FormCheckboxField, FormData, FormErrors, FormField, FormFieldType, FormInputField, FormProps, FormRadioField, FormSelectField, FormTextareaField, } from './types';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type FormFieldType = 'input' | 'textarea' | 'select' | 'checkbox' | 'radio';
|
|
3
|
+
interface ValidationResult {
|
|
4
|
+
valid: boolean;
|
|
5
|
+
message?: string;
|
|
6
|
+
}
|
|
7
|
+
export type IsValidFunc<T> = (value: T) => ValidationResult;
|
|
8
|
+
export interface BaseFormField {
|
|
9
|
+
__type: FormFieldType;
|
|
10
|
+
name: string;
|
|
11
|
+
label: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
colSpan?: 1 | 2 | 3 | 4 | 'full';
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FormInputField extends BaseFormField {
|
|
19
|
+
__type: 'input';
|
|
20
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
variant?: 'base' | 'default' | 'underline' | 'outline';
|
|
23
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
24
|
+
isValid?: IsValidFunc<string>;
|
|
25
|
+
}
|
|
26
|
+
export interface FormTextareaField extends BaseFormField {
|
|
27
|
+
__type: 'textarea';
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
variant?: 'base' | 'left-line' | 'outline';
|
|
30
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
31
|
+
rows?: number;
|
|
32
|
+
autoExpand?: boolean;
|
|
33
|
+
characterLimit?: number;
|
|
34
|
+
isValid?: IsValidFunc<string>;
|
|
35
|
+
}
|
|
36
|
+
export interface FormSelectField extends BaseFormField {
|
|
37
|
+
__type: 'select';
|
|
38
|
+
options: Array<{
|
|
39
|
+
value: string;
|
|
40
|
+
label: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
searchable?: boolean;
|
|
45
|
+
clearable?: boolean;
|
|
46
|
+
isValid?: IsValidFunc<string | undefined>;
|
|
47
|
+
}
|
|
48
|
+
export interface FormCheckboxField extends BaseFormField {
|
|
49
|
+
__type: 'checkbox';
|
|
50
|
+
text?: string;
|
|
51
|
+
isValid?: IsValidFunc<boolean>;
|
|
52
|
+
}
|
|
53
|
+
export interface FormRadioField extends BaseFormField {
|
|
54
|
+
__type: 'radio';
|
|
55
|
+
options: Array<{
|
|
56
|
+
value: string;
|
|
57
|
+
label: string;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
isValid?: IsValidFunc<string>;
|
|
61
|
+
}
|
|
62
|
+
export type FormField = FormInputField | FormTextareaField | FormSelectField | FormCheckboxField | FormRadioField;
|
|
63
|
+
export interface FormData {
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
}
|
|
66
|
+
export interface FormErrors {
|
|
67
|
+
[key: string]: string;
|
|
68
|
+
}
|
|
69
|
+
export interface FormProps<T extends FormData = FormData> {
|
|
70
|
+
/** Array of form fields created using FormFactories. */
|
|
71
|
+
form: FormField[];
|
|
72
|
+
/** Initial data to populate the form fields. */
|
|
73
|
+
initialData?: T;
|
|
74
|
+
/** Callback fired when form data changes. */
|
|
75
|
+
onDataChange?: (data: T) => void;
|
|
76
|
+
/** Callback fired when form is submitted with valid data. */
|
|
77
|
+
onSubmit?: (data: T) => void;
|
|
78
|
+
/** Submit button element to render at the bottom of the form. */
|
|
79
|
+
submitButton?: React.ReactNode;
|
|
80
|
+
/** Additional CSS classes to apply to the form. */
|
|
81
|
+
className?: string;
|
|
82
|
+
/** The HTML id attribute for the form. */
|
|
83
|
+
id?: string;
|
|
84
|
+
/** Reference to the form element. */
|
|
85
|
+
ref?: React.Ref<HTMLFormElement>;
|
|
86
|
+
/** Number of columns in the form grid layout. */
|
|
87
|
+
columns?: 1 | 2 | 3 | 4;
|
|
88
|
+
/** Whether to collapse to single column on mobile devices. */
|
|
89
|
+
responsive?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const formVariants: {
|
|
2
|
+
readonly spacing: {
|
|
3
|
+
readonly tight: "gap-3";
|
|
4
|
+
readonly normal: "gap-4";
|
|
5
|
+
readonly loose: "gap-6";
|
|
6
|
+
};
|
|
7
|
+
readonly columns: {
|
|
8
|
+
readonly 1: "grid-cols-1";
|
|
9
|
+
readonly 2: "grid-cols-1 md:grid-cols-2";
|
|
10
|
+
readonly 3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3";
|
|
11
|
+
readonly 4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4";
|
|
12
|
+
};
|
|
13
|
+
readonly colSpan: {
|
|
14
|
+
readonly 1: "col-span-1";
|
|
15
|
+
readonly 2: "col-span-1 md:col-span-2";
|
|
16
|
+
readonly 3: "col-span-1 md:col-span-2 lg:col-span-3";
|
|
17
|
+
readonly 4: "col-span-1 md:col-span-2 lg:col-span-4";
|
|
18
|
+
readonly full: "col-span-full";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type FormSpacing = keyof typeof formVariants.spacing;
|
|
22
|
+
export type FormColumns = keyof typeof formVariants.columns;
|
|
23
|
+
export type FormColSpan = keyof typeof formVariants.colSpan;
|
|
24
|
+
export interface FormVariants {
|
|
25
|
+
/** Spacing between form fields. */
|
|
26
|
+
spacing: FormSpacing;
|
|
27
|
+
/** Number of columns in the form grid layout. */
|
|
28
|
+
columns?: FormColumns;
|
|
29
|
+
/** Whether to collapse to single column on mobile devices. */
|
|
30
|
+
responsive?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const formDefaults: FormVariants;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TooltipProps } from '../tooltip';
|
|
3
|
+
export interface HelpIconProps extends Omit<TooltipProps, 'children'> {
|
|
4
|
+
/** HTML id attribute for the help icon. */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Ref for the icon element. */
|
|
7
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
+
/** The design variant of the help icon. */
|
|
9
|
+
design?: 'filled' | 'outlined';
|
|
10
|
+
/** The size of the help icon. */
|
|
11
|
+
iconSize?: number;
|
|
12
|
+
/** Additional CSS classes to apply to the icon container. */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A help icon component that combines the InfoCircled icon with a tooltip for displaying contextual help information.
|
|
17
|
+
* Supports both filled and outlined design variants with multiple size options.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Basic help icon with tooltip
|
|
22
|
+
* <HelpIcon message="This field is required for account verification" />
|
|
23
|
+
*
|
|
24
|
+
* // Custom design and size
|
|
25
|
+
* <HelpIcon
|
|
26
|
+
* message="Click here for more information about pricing"
|
|
27
|
+
* design="outlined"
|
|
28
|
+
* iconSize={20}
|
|
29
|
+
* placement="bottom"
|
|
30
|
+
* />
|
|
31
|
+
*
|
|
32
|
+
* // Rich content tooltip
|
|
33
|
+
* <HelpIcon
|
|
34
|
+
* message={
|
|
35
|
+
* <div>
|
|
36
|
+
* <p className="font-semibold mb-1">Password Requirements</p>
|
|
37
|
+
* <ul className="text-xs space-y-1">
|
|
38
|
+
* <li>• At least 8 characters</li>
|
|
39
|
+
* <li>• One uppercase letter</li>
|
|
40
|
+
* <li>• One number or symbol</li>
|
|
41
|
+
* </ul>
|
|
42
|
+
* </div>
|
|
43
|
+
* }
|
|
44
|
+
* className="ml-2"
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function HelpIcon({ id, ref, design, iconSize, className, ...tooltipProps }: HelpIconProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HelpIcon, type HelpIconProps } from './HelpIcon';
|
|
@@ -3,6 +3,7 @@ export * from './actionmodal';
|
|
|
3
3
|
export * from './avatar';
|
|
4
4
|
export * from './badge';
|
|
5
5
|
export * from './button';
|
|
6
|
+
export * from './calendar';
|
|
6
7
|
export * from './callout';
|
|
7
8
|
export * from './card';
|
|
8
9
|
export * from './carousel';
|
|
@@ -13,7 +14,10 @@ export * from './code-block';
|
|
|
13
14
|
export * from './disclosure';
|
|
14
15
|
export * from './drawer';
|
|
15
16
|
export * from './dropdown-menu';
|
|
17
|
+
export * from './dynamic-list';
|
|
16
18
|
export * from './error-boundary';
|
|
19
|
+
export * from './form';
|
|
20
|
+
export * from './help-icon';
|
|
17
21
|
export * from './input';
|
|
18
22
|
export * from './label';
|
|
19
23
|
export * from './modal';
|
|
@@ -26,7 +30,7 @@ export * from './select';
|
|
|
26
30
|
export * from './separator';
|
|
27
31
|
export * from './skeleton';
|
|
28
32
|
export * from './slider';
|
|
29
|
-
export * from './
|
|
33
|
+
export * from './table';
|
|
30
34
|
export * from './tabs';
|
|
31
35
|
export * from './textarea';
|
|
32
36
|
export * from './toast';
|
|
@@ -2,9 +2,39 @@ import { Ref } from 'react';
|
|
|
2
2
|
import './styles.css';
|
|
3
3
|
import { InputVariants } from './variants';
|
|
4
4
|
export interface InputProps extends Partial<InputVariants>, React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
+
/** Reference to the input element. */
|
|
5
6
|
ref?: Ref<HTMLInputElement>;
|
|
7
|
+
/** Whether the input is in read-only display mode. */
|
|
6
8
|
displayOnlyMode?: boolean;
|
|
9
|
+
/** Error message to display below the input when invalid. */
|
|
7
10
|
errorMessage?: string;
|
|
11
|
+
/** Success message to display below the input when valid. */
|
|
8
12
|
successMessage?: string;
|
|
9
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A versatile input component with support for various types, validation states,
|
|
16
|
+
* and password visibility toggle. Includes error/success message display.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Basic input
|
|
21
|
+
* <Input
|
|
22
|
+
* placeholder="Enter your name"
|
|
23
|
+
* value={name}
|
|
24
|
+
* onChange={(e) => setName(e.target.value)}
|
|
25
|
+
* />
|
|
26
|
+
*
|
|
27
|
+
* // Password input with validation
|
|
28
|
+
* <Input
|
|
29
|
+
* type="password"
|
|
30
|
+
* placeholder="Enter password"
|
|
31
|
+
* errorMessage={passwordError}
|
|
32
|
+
* variant="outline"
|
|
33
|
+
* rounded="lg"
|
|
34
|
+
* />
|
|
35
|
+
*
|
|
36
|
+
* // Read-only display mode
|
|
37
|
+
* <Input value="John Doe" displayOnlyMode />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
10
40
|
export declare function Input({ variant, rounded, displayOnlyMode, errorMessage, successMessage, type, className, ...rest }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,9 @@ export declare const roundedVariants: {
|
|
|
14
14
|
};
|
|
15
15
|
export type InputRounded = keyof typeof roundedVariants;
|
|
16
16
|
export interface InputVariants {
|
|
17
|
+
/** The visual style variant of the input. */
|
|
17
18
|
variant: InputVariant;
|
|
19
|
+
/** The border radius of the input. */
|
|
18
20
|
rounded: InputRounded;
|
|
19
21
|
}
|
|
20
22
|
export declare const inputDefaults: InputVariants;
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
3
|
+
/** The display type of the label. */
|
|
3
4
|
display?: 'block' | 'inline';
|
|
5
|
+
/** The width of the label element. */
|
|
4
6
|
width?: React.CSSProperties['width'];
|
|
7
|
+
/** Whether to show a required indicator (*) next to the label. */
|
|
5
8
|
required?: boolean;
|
|
9
|
+
/** Help text to display in a tooltip next to the label. */
|
|
6
10
|
helpMessage?: string;
|
|
11
|
+
/** Additional content to display after the label text. */
|
|
7
12
|
suffix?: React.ReactNode;
|
|
13
|
+
/** Description text to display below the label. */
|
|
8
14
|
description?: string;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A form label component with support for required indicators, help tooltips,
|
|
18
|
+
* and description text. Provides accessibility features for form elements.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Basic label
|
|
23
|
+
* <Label htmlFor="email">Email Address</Label>
|
|
24
|
+
*
|
|
25
|
+
* // Required field with description
|
|
26
|
+
* <Label
|
|
27
|
+
* htmlFor="password"
|
|
28
|
+
* required
|
|
29
|
+
* description="Must be at least 8 characters"
|
|
30
|
+
* >
|
|
31
|
+
* Password
|
|
32
|
+
* </Label>
|
|
33
|
+
*
|
|
34
|
+
* // With help tooltip
|
|
35
|
+
* <Label
|
|
36
|
+
* htmlFor="username"
|
|
37
|
+
* helpMessage="Username will be visible to other users"
|
|
38
|
+
* >
|
|
39
|
+
* Display Name
|
|
40
|
+
* </Label>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
10
43
|
export declare function Label({ display, width, className, required, helpMessage, suffix, htmlFor, children, description, ...props }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,68 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../button';
|
|
3
3
|
interface ModalAction extends Omit<ButtonProps, 'children'> {
|
|
4
|
+
/** The text label for the action button. */
|
|
4
5
|
label: string;
|
|
5
6
|
}
|
|
6
7
|
export interface ModalProps {
|
|
8
|
+
/** Optional ID for the modal element. */
|
|
7
9
|
id?: string;
|
|
10
|
+
/** Whether the modal is open. */
|
|
8
11
|
isOpen: boolean;
|
|
12
|
+
/** Callback fired when the modal should close. */
|
|
9
13
|
onClose: () => void;
|
|
14
|
+
/** Optional title for the modal header. */
|
|
10
15
|
title?: React.ReactNode;
|
|
16
|
+
/** The content to display inside the modal. */
|
|
11
17
|
children: React.ReactNode;
|
|
18
|
+
/** When true, renders only the children with no default modal styling. */
|
|
12
19
|
contentOnly?: boolean;
|
|
20
|
+
/** Additional CSS classes to apply to the modal content. */
|
|
13
21
|
className?: string;
|
|
22
|
+
/** Additional CSS classes to apply to the backdrop overlay. */
|
|
14
23
|
overlayClassName?: string;
|
|
24
|
+
/** Additional CSS classes to apply to the modal container. */
|
|
25
|
+
containerClassName?: string;
|
|
26
|
+
/** Whether to hide the X close button in the top-right corner. */
|
|
15
27
|
hideCloseButton?: boolean;
|
|
28
|
+
/** Array of action buttons to display at the bottom of the modal. */
|
|
16
29
|
actions?: ModalAction[];
|
|
30
|
+
/** Whether clicking the backdrop/overlay closes the modal. */
|
|
17
31
|
disableCloseOnOverlayClick?: boolean;
|
|
32
|
+
/** ID of an element that labels the modal. */
|
|
18
33
|
ariaLabelledBy?: string;
|
|
34
|
+
/** ID of an element that describes the modal. */
|
|
19
35
|
ariaDescribedBy?: string;
|
|
20
36
|
}
|
|
21
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A flexible modal dialog component with focus management, animation, and action buttons.
|
|
39
|
+
* Supports both styled and content-only modes with comprehensive accessibility features.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // Basic modal
|
|
44
|
+
* <Modal
|
|
45
|
+
* isOpen={showModal}
|
|
46
|
+
* onClose={() => setShowModal(false)}
|
|
47
|
+
* title="Confirm Action"
|
|
48
|
+
* >
|
|
49
|
+
* <p>Are you sure you want to proceed?</p>
|
|
50
|
+
* </Modal>
|
|
51
|
+
*
|
|
52
|
+
* // Modal with actions
|
|
53
|
+
* <Modal
|
|
54
|
+
* isOpen={showDeleteModal}
|
|
55
|
+
* onClose={handleClose}
|
|
56
|
+
* title="Delete Item"
|
|
57
|
+
* actions={[
|
|
58
|
+
* { label: "Cancel", variant: "secondary", onClick: handleClose },
|
|
59
|
+
* { label: "Delete", variant: "destructive", onClick: handleDelete }
|
|
60
|
+
* ]}
|
|
61
|
+
* disableCloseOnOverlayClick
|
|
62
|
+
* >
|
|
63
|
+
* <p>This action cannot be undone.</p>
|
|
64
|
+
* </Modal>
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function Modal({ id, isOpen, onClose, title, children, contentOnly, className, overlayClassName, containerClassName, hideCloseButton, actions, disableCloseOnOverlayClick, ariaLabelledBy, ariaDescribedBy, }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
22
68
|
export {};
|
|
@@ -1,23 +1,55 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PaginationSize, PaginationVariant } from './variants';
|
|
3
3
|
export interface PaginationProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** The current page
|
|
4
|
+
/** The current active page (1-indexed) */
|
|
5
5
|
page: number;
|
|
6
6
|
/** Total number of pages. Use Infinity for infinite pagination */
|
|
7
7
|
pageCount?: number;
|
|
8
8
|
/** Maximum number of page buttons to show */
|
|
9
9
|
maxVisiblePages?: number;
|
|
10
|
-
/**
|
|
10
|
+
/** Whether to show first and last page buttons */
|
|
11
11
|
showFirstLast?: boolean;
|
|
12
12
|
/** Button variant style */
|
|
13
13
|
variant?: PaginationVariant;
|
|
14
14
|
/** Button size */
|
|
15
15
|
size?: PaginationSize;
|
|
16
|
-
/** Callback when page changes */
|
|
16
|
+
/** Callback fired when the page changes */
|
|
17
17
|
onPageChange: (page: number) => void;
|
|
18
18
|
/** Ref for the pagination container */
|
|
19
19
|
ref?: React.Ref<HTMLDivElement>;
|
|
20
|
-
/** Additional
|
|
20
|
+
/** Additional CSS classes for the button elements */
|
|
21
21
|
buttonsClassName?: string;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A pagination component for navigating through multiple pages of content.
|
|
25
|
+
* Supports both finite and infinite pagination with customizable appearance.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Basic pagination
|
|
30
|
+
* <Pagination
|
|
31
|
+
* page={currentPage}
|
|
32
|
+
* pageCount={totalPages}
|
|
33
|
+
* onPageChange={setCurrentPage}
|
|
34
|
+
* />
|
|
35
|
+
*
|
|
36
|
+
* // Infinite pagination
|
|
37
|
+
* <Pagination
|
|
38
|
+
* page={currentPage}
|
|
39
|
+
* pageCount={Infinity}
|
|
40
|
+
* onPageChange={handlePageChange}
|
|
41
|
+
* showFirstLast={false}
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* // Customized appearance
|
|
45
|
+
* <Pagination
|
|
46
|
+
* page={currentPage}
|
|
47
|
+
* pageCount={100}
|
|
48
|
+
* maxVisiblePages={7}
|
|
49
|
+
* variant="outline"
|
|
50
|
+
* size="lg"
|
|
51
|
+
* onPageChange={setCurrentPage}
|
|
52
|
+
* />
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
23
55
|
export declare function Pagination({ page, pageCount, maxVisiblePages, showFirstLast, onPageChange, size, variant, className, ref, buttonsClassName, ...rest }: PaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,70 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopoverAlignment, PopoverPlacement } from './variants';
|
|
3
3
|
export interface PopoverProps {
|
|
4
|
+
/** Unique identifier for the popover */
|
|
4
5
|
id?: string;
|
|
6
|
+
/** Reference to the popover element */
|
|
5
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
|
+
/** Whether the popover is open (controlled) */
|
|
6
9
|
isOpen?: boolean;
|
|
10
|
+
/** Callback fired when the open state changes */
|
|
7
11
|
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
/** The content to display in the popover */
|
|
8
13
|
children: React.ReactNode;
|
|
14
|
+
/** The element that triggers the popover */
|
|
9
15
|
trigger: React.ReactElement;
|
|
16
|
+
/** The preferred side of the trigger to render against */
|
|
10
17
|
placement?: PopoverPlacement;
|
|
18
|
+
/** The preferred alignment against the trigger */
|
|
11
19
|
alignment?: PopoverAlignment;
|
|
20
|
+
/** Additional CSS classes to apply to the popover content */
|
|
12
21
|
className?: string;
|
|
22
|
+
/** Whether to close popover when clicking outside */
|
|
13
23
|
closeOnOverlayClick?: boolean;
|
|
24
|
+
/** Whether to close popover when clicking the trigger again */
|
|
14
25
|
closeOnTriggerClick?: boolean;
|
|
15
|
-
/** Offset of the popover from the trigger element in
|
|
26
|
+
/** Offset of the popover from the trigger element in pixels */
|
|
16
27
|
offset?: number;
|
|
17
|
-
/** Automatically switch placement to opposite side if there is not enough space
|
|
28
|
+
/** Automatically switch placement to opposite side if there is not enough space */
|
|
18
29
|
autoSwitchPlacement?: boolean;
|
|
30
|
+
/** Enable hover behavior - shows on hover, hides 200ms after mouse leaves */
|
|
31
|
+
hoverable?: boolean;
|
|
19
32
|
}
|
|
20
|
-
|
|
33
|
+
/**
|
|
34
|
+
* A floating content container that appears relative to a trigger element.
|
|
35
|
+
* Supports hover and click interactions with intelligent positioning and focus management.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Basic popover
|
|
40
|
+
* <Popover
|
|
41
|
+
* trigger={<Button>Click me</Button>}
|
|
42
|
+
* placement="bottom"
|
|
43
|
+
* >
|
|
44
|
+
* <div className="p-4">
|
|
45
|
+
* <h3>Popover Content</h3>
|
|
46
|
+
* <p>This is the popover content.</p>
|
|
47
|
+
* </div>
|
|
48
|
+
* </Popover>
|
|
49
|
+
*
|
|
50
|
+
* // Hover popover
|
|
51
|
+
* <Popover
|
|
52
|
+
* trigger={<span>Hover me</span>}
|
|
53
|
+
* hoverable
|
|
54
|
+
* placement="top"
|
|
55
|
+
* alignment="start"
|
|
56
|
+
* >
|
|
57
|
+
* <div className="p-2 text-sm">Tooltip-like content</div>
|
|
58
|
+
* </Popover>
|
|
59
|
+
*
|
|
60
|
+
* // Controlled popover
|
|
61
|
+
* <Popover
|
|
62
|
+
* trigger={<Button>Controlled</Button>}
|
|
63
|
+
* isOpen={showPopover}
|
|
64
|
+
* onOpenChange={setShowPopover}
|
|
65
|
+
* >
|
|
66
|
+
* <PopoverMenu />
|
|
67
|
+
* </Popover>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function Popover({ id, ref, isOpen, onOpenChange, children, className, closeOnOverlayClick, trigger, placement, alignment, closeOnTriggerClick, offset, autoSwitchPlacement, hoverable, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,13 +7,46 @@ export type RadioOption = {
|
|
|
7
7
|
description?: string;
|
|
8
8
|
};
|
|
9
9
|
export type RadioGroupProps = {
|
|
10
|
+
/** Array of option objects or strings. RadioOption: { label: string, value: string, disabled?: boolean, description?: string } */
|
|
10
11
|
options?: (string | RadioOption)[];
|
|
12
|
+
/** The current selected value (controlled). */
|
|
11
13
|
value: string | undefined;
|
|
14
|
+
/** Callback fired when the selected value changes. */
|
|
12
15
|
onChange: (value: string) => void;
|
|
16
|
+
/** The id for the radio group element. */
|
|
13
17
|
id?: string;
|
|
18
|
+
/** RadioGroupItem components when using the component approach. */
|
|
14
19
|
children?: React.ReactElement<RadioGroupItemProps>[] | React.ReactElement<RadioGroupItemProps>;
|
|
20
|
+
/** Additional CSS classes to apply to the radio group. */
|
|
15
21
|
className?: string;
|
|
22
|
+
/** Additional CSS classes to apply to each radio item. */
|
|
16
23
|
childrenClassName?: string;
|
|
24
|
+
/** Whether to hide the native radio input elements. */
|
|
17
25
|
hideInputs?: boolean;
|
|
18
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* A radio button group component for selecting one option from multiple choices.
|
|
29
|
+
* Supports both array-based options and RadioGroupItem child components.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Using options array
|
|
34
|
+
* <RadioGroup
|
|
35
|
+
* options={[
|
|
36
|
+
* { label: 'Small', value: 's', description: 'Perfect for personal use' },
|
|
37
|
+
* { label: 'Medium', value: 'm' },
|
|
38
|
+
* { label: 'Large', value: 'l', disabled: true }
|
|
39
|
+
* ]}
|
|
40
|
+
* value={selectedSize}
|
|
41
|
+
* onChange={setSelectedSize}
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* // Using child components
|
|
45
|
+
* <RadioGroup value={color} onChange={setColor}>
|
|
46
|
+
* <RadioGroupItem value="red">Red</RadioGroupItem>
|
|
47
|
+
* <RadioGroupItem value="blue">Blue</RadioGroupItem>
|
|
48
|
+
* <RadioGroupItem value="green">Green</RadioGroupItem>
|
|
49
|
+
* </RadioGroup>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
19
52
|
export declare function RadioGroup({ options, value, onChange, id, children, className, childrenClassName, hideInputs, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|