@diwauhris/ui 1.7.4 → 1.7.7
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 +24 -64
- package/lib/assets/ui.css +189 -7
- package/lib/index.cjs +935 -340
- package/lib/index.mjs +935 -340
- package/lib/types/lib/composeRefs.d.ts +9 -0
- package/lib/types/ui-library/gallery/accordion/Accordion.d.ts +1 -1
- package/lib/types/ui-library/gallery/breadcrumb/Breadcrumb.d.ts +2 -1
- package/lib/types/ui-library/gallery/button/Button.d.ts +7 -1
- package/lib/types/ui-library/gallery/card/Card.d.ts +4 -3
- package/lib/types/ui-library/gallery/checkbox/Checkbox.d.ts +3 -1
- package/lib/types/ui-library/gallery/column-manager/ColumnManager.d.ts +2 -1
- package/lib/types/ui-library/gallery/combobox/Combobox.d.ts +14 -7
- package/lib/types/ui-library/gallery/command-palette/CommandPalette.d.ts +3 -1
- package/lib/types/ui-library/gallery/confirm-action/ConfirmAction.d.ts +3 -1
- package/lib/types/ui-library/gallery/confirm-dialog/ConfirmDialog.d.ts +3 -1
- package/lib/types/ui-library/gallery/date-picker/DatePicker.d.ts +3 -1
- package/lib/types/ui-library/gallery/dialog/Dialog.d.ts +9 -1
- package/lib/types/ui-library/gallery/drawer/Drawer.d.ts +3 -1
- package/lib/types/ui-library/gallery/field/Field.d.ts +2 -1
- package/lib/types/ui-library/gallery/field-input/FieldInput.d.ts +3 -1
- package/lib/types/ui-library/gallery/file-upload/FileUpload.d.ts +7 -1
- package/lib/types/ui-library/gallery/icon-button/IconButton.d.ts +6 -1
- package/lib/types/ui-library/gallery/input/Input.d.ts +3 -1
- package/lib/types/ui-library/gallery/menu/Menu.d.ts +7 -1
- package/lib/types/ui-library/gallery/modal/Modal.d.ts +11 -1
- package/lib/types/ui-library/gallery/pagination/Pagination.d.ts +2 -1
- package/lib/types/ui-library/gallery/popover/Popover.d.ts +3 -2
- package/lib/types/ui-library/gallery/radio-group/RadioGroup.d.ts +2 -1
- package/lib/types/ui-library/gallery/search/Search.d.ts +23 -0
- package/lib/types/ui-library/gallery/select/Select.d.ts +13 -1
- package/lib/types/ui-library/gallery/skeleton/Skeleton.d.ts +19 -9
- package/lib/types/ui-library/gallery/stat-card/Statistic.d.ts +2 -1
- package/lib/types/ui-library/gallery/stepper/Stepper.d.ts +3 -1
- package/lib/types/ui-library/gallery/switch/Switch.d.ts +6 -3
- package/lib/types/ui-library/gallery/textarea/Textarea.d.ts +3 -1
- package/lib/types/ui-library/gallery/timeline/Timeline.d.ts +4 -2
- package/lib/types/ui-library/gallery/tooltip/Tooltip.d.ts +8 -6
- package/lib/types/ui-library/index.d.ts +4 -2
- package/package.json +2 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Composes multiple React refs into one callback ref.
|
|
4
|
+
* Used when a component needs both an internal ref and a forwarded external ref.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* <input ref={composeRefs(internalRef, forwardedRef)} />
|
|
8
|
+
*/
|
|
9
|
+
export declare function composeRefs<T>(...refs: Array<React.Ref<T> | undefined>): React.RefCallback<T>;
|
|
@@ -54,4 +54,4 @@ export interface AccordionContentProps {
|
|
|
54
54
|
children: ReactNode;
|
|
55
55
|
className?: string;
|
|
56
56
|
}
|
|
57
|
-
export declare function AccordionContent({ children, className }: AccordionContentProps): import("react").JSX.Element
|
|
57
|
+
export declare function AccordionContent({ children, className }: AccordionContentProps): import("react").JSX.Element;
|
|
@@ -27,5 +27,6 @@ export interface BreadcrumbProps {
|
|
|
27
27
|
showHome?: boolean;
|
|
28
28
|
/** aria-label for the <nav> element (default: "Breadcrumb") */
|
|
29
29
|
ariaLabel?: string;
|
|
30
|
+
className?: string;
|
|
30
31
|
}
|
|
31
|
-
export declare function Breadcrumb({ items, showHome, ariaLabel, }: BreadcrumbProps): import("react").JSX.Element | null;
|
|
32
|
+
export declare function Breadcrumb({ items, showHome, ariaLabel, className, }: BreadcrumbProps): import("react").JSX.Element | null;
|
|
@@ -64,5 +64,11 @@ export interface ButtonProps extends React.ComponentProps<'button'> {
|
|
|
64
64
|
rightIcon?: ReactNode;
|
|
65
65
|
fullWidth?: boolean;
|
|
66
66
|
children?: ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* When true, renders the button as a child component (via Radix Slot).
|
|
69
|
+
* Use this to render a Link or anchor as a button visually while preserving
|
|
70
|
+
* its native semantics. The type and disabled props are ignored when asChild is true.
|
|
71
|
+
*/
|
|
72
|
+
asChild?: boolean;
|
|
67
73
|
}
|
|
68
|
-
export declare function Button({ variant, size, loading, leftIcon, rightIcon, fullWidth, children, className, disabled, ...props }: ButtonProps): import("react").JSX.Element;
|
|
74
|
+
export declare function Button({ variant, size, loading, leftIcon, rightIcon, fullWidth, children, className, disabled, asChild, ...props }: ButtonProps): import("react").JSX.Element;
|
|
@@ -22,10 +22,11 @@ export interface CardProps {
|
|
|
22
22
|
onClick?: () => void;
|
|
23
23
|
}
|
|
24
24
|
export interface CardHeaderProps {
|
|
25
|
-
title:
|
|
26
|
-
description?:
|
|
25
|
+
title: ReactNode;
|
|
26
|
+
description?: ReactNode;
|
|
27
27
|
/** Optional content aligned to the right (badge, menu, button) */
|
|
28
28
|
actions?: ReactNode;
|
|
29
|
+
className?: string;
|
|
29
30
|
}
|
|
30
31
|
export interface CardContentProps {
|
|
31
32
|
children: ReactNode;
|
|
@@ -36,6 +37,6 @@ export interface CardFooterProps {
|
|
|
36
37
|
className?: string;
|
|
37
38
|
}
|
|
38
39
|
export declare function Card({ variant, children, className, onClick }: CardProps): import("react").JSX.Element;
|
|
39
|
-
export declare function CardHeader({ title, description, actions }: CardHeaderProps): import("react").JSX.Element;
|
|
40
|
+
export declare function CardHeader({ title, description, actions, className }: CardHeaderProps): import("react").JSX.Element;
|
|
40
41
|
export declare function CardContent({ children, className }: CardContentProps): import("react").JSX.Element;
|
|
41
42
|
export declare function CardFooter({ children, className }: CardFooterProps): import("react").JSX.Element;
|
|
@@ -20,4 +20,6 @@ export interface CheckboxProps extends Omit<React.ComponentProps<'input'>, 'type
|
|
|
20
20
|
/** Error message shown below */
|
|
21
21
|
helper?: string;
|
|
22
22
|
}
|
|
23
|
-
export declare function Checkbox({ label, description, indeterminate, error, helper, disabled, checked, id: externalId, className, ...props }: CheckboxProps
|
|
23
|
+
export declare function Checkbox({ label, description, indeterminate, error, helper, disabled, checked, id: externalId, className, ref, ...props }: CheckboxProps & {
|
|
24
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
@@ -51,6 +51,7 @@ export interface ColumnManagerProps {
|
|
|
51
51
|
onReset: () => void;
|
|
52
52
|
/** Label for the trigger button. Default: "Columns" */
|
|
53
53
|
triggerLabel?: string;
|
|
54
|
+
className?: string;
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Apply a stored column order to the runtime column array.
|
|
@@ -63,4 +64,4 @@ export interface ColumnManagerProps {
|
|
|
63
64
|
* - When `order` is null the original array is returned unchanged.
|
|
64
65
|
*/
|
|
65
66
|
export declare function applyColumnOrder(columns: ColumnManagerColumn[], order: string[] | null): ColumnManagerColumn[];
|
|
66
|
-
export declare function ColumnManager({ columns, hiddenColumnKeys, columnOrder, onHiddenColumnKeysChange, onColumnOrderChange, onReset, triggerLabel, }: ColumnManagerProps): import("react").JSX.Element;
|
|
67
|
+
export declare function ColumnManager({ columns, hiddenColumnKeys, columnOrder, onHiddenColumnKeysChange, onColumnOrderChange, onReset, triggerLabel, className, }: ColumnManagerProps): import("react").JSX.Element;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface ComboboxOption {
|
|
2
2
|
value: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ComboboxProps {
|
|
7
|
+
/** Controlled value. When provided, pair with onChange. */
|
|
8
|
+
value?: string;
|
|
9
|
+
/** Uncontrolled initial value. */
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onChange?: (value: string) => void;
|
|
12
|
+
options: ComboboxOption[];
|
|
8
13
|
placeholder?: string;
|
|
9
14
|
className?: string;
|
|
10
15
|
disabled?: boolean;
|
|
11
16
|
loading?: boolean;
|
|
12
17
|
error?: string;
|
|
13
18
|
'aria-label'?: string;
|
|
19
|
+
onBlur?: () => void;
|
|
20
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
14
21
|
}
|
|
15
|
-
export declare function Combobox({ value, onChange, options, placeholder, className, disabled, loading, error, 'aria-label': ariaLabel }: ComboboxProps): import("react").JSX.Element;
|
|
22
|
+
export declare function Combobox({ value: controlledValue, defaultValue, onChange, options, placeholder, className, disabled, loading, error, 'aria-label': ariaLabel, onBlur, ref }: ComboboxProps): import("react").JSX.Element;
|
|
@@ -37,5 +37,7 @@ export interface CommandPaletteProps {
|
|
|
37
37
|
placeholder?: string;
|
|
38
38
|
/** aria-label for the dialog. Default: "Command palette" */
|
|
39
39
|
'aria-label'?: string;
|
|
40
|
+
/** Additional class on the floating panel card. */
|
|
41
|
+
panelClassName?: string;
|
|
40
42
|
}
|
|
41
|
-
export declare function CommandPalette({ open, onClose, items, query, onQueryChange, placeholder, 'aria-label': ariaLabel, }: CommandPaletteProps): import("react").ReactPortal | null;
|
|
43
|
+
export declare function CommandPalette({ open, onClose, items, query, onQueryChange, placeholder, 'aria-label': ariaLabel, panelClassName, }: CommandPaletteProps): import("react").ReactPortal | null;
|
|
@@ -21,6 +21,8 @@ interface ConfirmActionProps {
|
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
onConfirm: () => Promise<void> | void;
|
|
23
23
|
children: ((props: ConfirmActionRenderProps) => ReactNode) | ReactNode;
|
|
24
|
+
/** Additional class on the inline trigger wrapper span. */
|
|
25
|
+
className?: string;
|
|
24
26
|
}
|
|
25
|
-
export declare function ConfirmAction({ title, message, label, description, confirmLabel, tone, disabled, onConfirm, children, }: ConfirmActionProps): import("react").JSX.Element;
|
|
27
|
+
export declare function ConfirmAction({ title, message, label, description, confirmLabel, tone, disabled, onConfirm, children, className, }: ConfirmActionProps): import("react").JSX.Element;
|
|
26
28
|
export {};
|
|
@@ -51,5 +51,7 @@ export interface ConfirmDialogProps {
|
|
|
51
51
|
* Default: "danger"
|
|
52
52
|
*/
|
|
53
53
|
tone?: ConfirmDialogTone;
|
|
54
|
+
/** Additional class forwarded to the DialogBody wrapper. */
|
|
55
|
+
className?: string;
|
|
54
56
|
}
|
|
55
|
-
export declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, tone, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
57
|
+
export declare function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel, cancelLabel, tone, className, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
@@ -6,10 +6,12 @@ interface DatePickerProps {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
error?: string;
|
|
8
8
|
minDate?: Date;
|
|
9
|
+
/** Upper bound for selectable dates. Defaults to no limit when omitted. */
|
|
10
|
+
maxDate?: Date;
|
|
9
11
|
id?: string;
|
|
10
12
|
'aria-label'?: string;
|
|
11
13
|
'aria-labelledby'?: string;
|
|
12
14
|
required?: boolean;
|
|
13
15
|
}
|
|
14
|
-
export declare function DatePicker({ value, onChange, placeholder, className, disabled, error, minDate, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, required, }: DatePickerProps): import("react").JSX.Element;
|
|
16
|
+
export declare function DatePicker({ value, onChange, placeholder, className, disabled, error, minDate, maxDate, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, required, }: DatePickerProps): import("react").JSX.Element;
|
|
15
17
|
export {};
|
|
@@ -38,6 +38,14 @@ export interface DialogProps {
|
|
|
38
38
|
preventClose?: boolean;
|
|
39
39
|
size?: DialogSize;
|
|
40
40
|
children?: ReactNode;
|
|
41
|
+
/** Called when focus moves into the content after opening. */
|
|
42
|
+
onOpenAutoFocus?: (e: Event) => void;
|
|
43
|
+
/** Called when focus moves to the trigger after closing. */
|
|
44
|
+
onCloseAutoFocus?: (e: Event) => void;
|
|
45
|
+
/** Called when the Escape key is pressed. Return e.preventDefault() to suppress close. */
|
|
46
|
+
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
|
47
|
+
/** Called when a pointer-down event occurs outside the content. Return e.preventDefault() to suppress close. */
|
|
48
|
+
onInteractOutside?: (e: Event) => void;
|
|
41
49
|
}
|
|
42
50
|
export interface DialogBodyProps {
|
|
43
51
|
children: ReactNode;
|
|
@@ -49,4 +57,4 @@ export interface DialogFooterProps {
|
|
|
49
57
|
}
|
|
50
58
|
export declare function DialogBody({ children, className }: DialogBodyProps): import("react").JSX.Element;
|
|
51
59
|
export declare function DialogFooter({ children, className }: DialogFooterProps): import("react").JSX.Element;
|
|
52
|
-
export declare function Dialog({ open, onClose, title, description, preventClose, size, children, }: DialogProps): import("react").JSX.Element;
|
|
60
|
+
export declare function Dialog({ open, onClose, title, description, preventClose, size, children, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onInteractOutside, }: DialogProps): import("react").JSX.Element;
|
|
@@ -20,5 +20,7 @@ export interface DrawerProps {
|
|
|
20
20
|
maxHeight?: string;
|
|
21
21
|
closeLabel?: string;
|
|
22
22
|
children: ReactNode;
|
|
23
|
+
/** Additional class on the drawer panel. */
|
|
24
|
+
className?: string;
|
|
23
25
|
}
|
|
24
|
-
export declare function Drawer({ open, onClose, title, description, placement, width, maxHeight, closeLabel, children, }: DrawerProps): import("react").ReactPortal | null;
|
|
26
|
+
export declare function Drawer({ open, onClose, title, description, placement, width, maxHeight, closeLabel, children, className, }: DrawerProps): import("react").ReactPortal | null;
|
|
@@ -9,6 +9,7 @@ interface FieldProps {
|
|
|
9
9
|
error?: string;
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
inputId?: string;
|
|
12
|
+
className?: string;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Form field wrapper: label + control + inline error.
|
|
@@ -17,5 +18,5 @@ interface FieldProps {
|
|
|
17
18
|
* FieldInput inside this wrapper automatically receive the correct id,
|
|
18
19
|
* aria-required, aria-invalid, and aria-describedby — with no prop threading.
|
|
19
20
|
*/
|
|
20
|
-
export declare function Field({ label, required, error, children, inputId }: FieldProps): import("react").JSX.Element;
|
|
21
|
+
export declare function Field({ label, required, error, children, inputId, className }: FieldProps): import("react").JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
type FieldInputProps = React.ComponentProps<'input'>;
|
|
2
|
-
export declare function FieldInput({ id, 'aria-required': ariaRequired, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, className, disabled, ...rest }: FieldInputProps
|
|
2
|
+
export declare function FieldInput({ id, 'aria-required': ariaRequired, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, className, disabled, ref, ...rest }: FieldInputProps & {
|
|
3
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
3
5
|
export {};
|
|
@@ -25,5 +25,11 @@ export interface FileUploadProps {
|
|
|
25
25
|
'aria-label'?: string;
|
|
26
26
|
/** Additional class on the root element. */
|
|
27
27
|
className?: string;
|
|
28
|
+
/** Controlled selected files. When provided, component uses this instead of internal state. */
|
|
29
|
+
value?: File[];
|
|
30
|
+
/** Called when files change in controlled mode. */
|
|
31
|
+
onChange?: (files: File[]) => void;
|
|
32
|
+
/** Ref forwarded to the hidden <input type="file"> element. */
|
|
33
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
28
34
|
}
|
|
29
|
-
export declare function FileUpload({ onFiles, accept, multiple, disabled, 'aria-label': ariaLabel, className, }: FileUploadProps): import("react").JSX.Element;
|
|
35
|
+
export declare function FileUpload({ onFiles, accept, multiple, disabled, 'aria-label': ariaLabel, className, value, onChange, ref, }: FileUploadProps): import("react").JSX.Element;
|
|
@@ -23,5 +23,10 @@ export interface IconButtonProps extends React.ComponentProps<'button'> {
|
|
|
23
23
|
icon: ReactNode;
|
|
24
24
|
/** Visual variant. Default: "default" (slate hover) */
|
|
25
25
|
variant?: IconButtonVariant;
|
|
26
|
+
/**
|
|
27
|
+
* When true, renders as a child component (via Radix Slot).
|
|
28
|
+
* Useful for rendering a Link as an icon button visually.
|
|
29
|
+
*/
|
|
30
|
+
asChild?: boolean;
|
|
26
31
|
}
|
|
27
|
-
export declare function IconButton({ icon, variant, className, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
32
|
+
export declare function IconButton({ icon, variant, className, asChild, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
@@ -21,4 +21,6 @@ export interface InputProps extends Omit<React.ComponentProps<'input'>, 'prefix'
|
|
|
21
21
|
/** Element rendered inside the input on the right (e.g. a unit label or clear button) */
|
|
22
22
|
suffix?: ReactNode;
|
|
23
23
|
}
|
|
24
|
-
export declare function Input({ status, helper, prefix, suffix, disabled, className, ...props }: InputProps
|
|
24
|
+
export declare function Input({ status, helper, prefix, suffix, disabled, className, ref, ...props }: InputProps & {
|
|
25
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
@@ -42,5 +42,11 @@ export interface MenuProps {
|
|
|
42
42
|
* 'right' — panel right edge aligns with trigger right edge (default)
|
|
43
43
|
*/
|
|
44
44
|
align?: 'left' | 'right';
|
|
45
|
+
/** Controlled open state. When provided, the caller manages open/close. */
|
|
46
|
+
open?: boolean;
|
|
47
|
+
/** Called when the menu should open or close. */
|
|
48
|
+
onOpenChange?: (open: boolean) => void;
|
|
49
|
+
/** Additional class on the floating panel. */
|
|
50
|
+
panelClassName?: string;
|
|
45
51
|
}
|
|
46
|
-
export declare function Menu({ trigger, items, ariaLabel, align, }: MenuProps): import("react").JSX.Element;
|
|
52
|
+
export declare function Menu({ trigger, items, ariaLabel, align, open: controlledOpen, onOpenChange, panelClassName, }: MenuProps): import("react").JSX.Element;
|
|
@@ -42,5 +42,15 @@ export interface ModalProps {
|
|
|
42
42
|
error?: string;
|
|
43
43
|
maxWidth?: string;
|
|
44
44
|
closeLabel?: string;
|
|
45
|
+
/** When true, Escape key and outside click will not close the modal. */
|
|
46
|
+
preventClose?: boolean;
|
|
47
|
+
/** Called when focus moves into the content after opening. */
|
|
48
|
+
onOpenAutoFocus?: (e: Event) => void;
|
|
49
|
+
/** Called when focus moves to the trigger after closing. */
|
|
50
|
+
onCloseAutoFocus?: (e: Event) => void;
|
|
51
|
+
/** Called when the Escape key is pressed. Return e.preventDefault() to suppress close. */
|
|
52
|
+
onEscapeKeyDown?: (e: KeyboardEvent) => void;
|
|
53
|
+
/** Called when a pointer-down event occurs outside the content. Return e.preventDefault() to suppress close. */
|
|
54
|
+
onInteractOutside?: (e: Event) => void;
|
|
45
55
|
}
|
|
46
|
-
export default function Modal({ isOpen, onClose, title, children, icon, subtitle, headerMeta, footer, onSubmit, submitLabel, submittingLabel, submitting, danger, error, maxWidth, closeLabel, }: ModalProps): import("react").JSX.Element;
|
|
56
|
+
export default function Modal({ isOpen, onClose, title, children, icon, subtitle, headerMeta, footer, onSubmit, submitLabel, submittingLabel, submitting, danger, error, maxWidth, closeLabel, preventClose, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onInteractOutside, }: ModalProps): import("react").JSX.Element;
|
|
@@ -39,5 +39,6 @@ export interface PaginationProps {
|
|
|
39
39
|
* Default: "items"
|
|
40
40
|
*/
|
|
41
41
|
itemLabel?: string;
|
|
42
|
+
className?: string;
|
|
42
43
|
}
|
|
43
|
-
export declare function Pagination({ page, totalPages, onPageChange, ariaLabel, totalItems, pageSize, itemLabel, }: PaginationProps): import("react").JSX.Element | null;
|
|
44
|
+
export declare function Pagination({ page, totalPages, onPageChange, ariaLabel, totalItems, pageSize, itemLabel, className, }: PaginationProps): import("react").JSX.Element | null;
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* - Tooltip shows text-only hints on hover/focus without interaction.
|
|
38
38
|
*/
|
|
39
39
|
import { type ReactNode } from 'react';
|
|
40
|
-
export type PopoverPlacement = 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end';
|
|
40
|
+
export type PopoverPlacement = 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end' | 'left-start' | 'left' | 'left-end' | 'right-start' | 'right' | 'right-end';
|
|
41
41
|
export interface PopoverProps {
|
|
42
42
|
/** Controlled open state */
|
|
43
43
|
open?: boolean;
|
|
@@ -51,8 +51,9 @@ export interface PopoverProps {
|
|
|
51
51
|
export declare function Popover({ open, onOpenChange, defaultOpen, placement, children, }: PopoverProps): import("react").JSX.Element;
|
|
52
52
|
export interface PopoverTriggerProps {
|
|
53
53
|
children: ReactNode;
|
|
54
|
+
className?: string;
|
|
54
55
|
}
|
|
55
|
-
export declare function PopoverTrigger({ children }: PopoverTriggerProps): import("react").JSX.Element;
|
|
56
|
+
export declare function PopoverTrigger({ children, className }: PopoverTriggerProps): import("react").JSX.Element;
|
|
56
57
|
export interface PopoverContentProps {
|
|
57
58
|
/** Optional title rendered in the popover header */
|
|
58
59
|
title?: string;
|
|
@@ -45,5 +45,6 @@ export interface RadioItemProps {
|
|
|
45
45
|
description?: string;
|
|
46
46
|
disabled?: boolean;
|
|
47
47
|
className?: string;
|
|
48
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
48
49
|
}
|
|
49
|
-
export declare function RadioItem({ value, label, description, disabled: itemDisabled, className, }: RadioItemProps): import("react").JSX.Element;
|
|
50
|
+
export declare function RadioItem({ value, label, description, disabled: itemDisabled, className, ref, }: RadioItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search — Design System Component
|
|
3
|
+
*
|
|
4
|
+
* A search input with a built-in search icon prefix and optional clear button.
|
|
5
|
+
* Built for filtering and discovery use cases — not for form submission fields
|
|
6
|
+
* (use Input for those).
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Search icon in prefix by default
|
|
10
|
+
* - Optional × clear button when value is non-empty (pass onClear)
|
|
11
|
+
* - Controlled via value + onChange (standard input event)
|
|
12
|
+
* - Forwards ref to the underlying <input>
|
|
13
|
+
* - All native <input> attributes are forwarded
|
|
14
|
+
*/
|
|
15
|
+
export interface SearchProps extends Omit<React.ComponentProps<'input'>, 'type'> {
|
|
16
|
+
/** Called when the × clear button is clicked. When provided, shows the × button if value is non-empty. */
|
|
17
|
+
onClear?: () => void;
|
|
18
|
+
/** Override className on the outer wrapper div */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Ref forwarded to the underlying <input> element */
|
|
21
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
22
|
+
}
|
|
23
|
+
export declare function Search({ value, onChange, onClear, placeholder, disabled, className, ref, ...props }: SearchProps): import("react").JSX.Element;
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
* - For searchable/multi-select use cases, use Combobox (Phase 3).
|
|
13
13
|
*
|
|
14
14
|
* The label is NOT included. The consuming feature pairs a <label>.
|
|
15
|
+
*
|
|
16
|
+
* When renderOption is provided, a custom dropdown is rendered instead
|
|
17
|
+
* of the native <select>. Only use this when native option rendering
|
|
18
|
+
* is insufficient (e.g., icons, avatars, multi-line content).
|
|
15
19
|
*/
|
|
16
20
|
import { type FieldStatus } from '../shared/fieldStatus';
|
|
17
21
|
export type SelectStatus = FieldStatus;
|
|
@@ -32,5 +36,13 @@ export interface SelectProps extends Omit<React.ComponentProps<'select'>, 'child
|
|
|
32
36
|
placeholder?: string;
|
|
33
37
|
status?: SelectStatus;
|
|
34
38
|
helper?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Custom renderer for each option row. When provided, renders a custom
|
|
41
|
+
* dropdown instead of the native <select>. Only flat SelectOption items
|
|
42
|
+
* are passed — group labels are rendered as non-interactive dividers.
|
|
43
|
+
*/
|
|
44
|
+
renderOption?: (item: SelectOption) => React.ReactNode;
|
|
45
|
+
/** Ref forwarded to the native <select> element (ignored when renderOption is provided). */
|
|
46
|
+
ref?: React.Ref<HTMLSelectElement>;
|
|
35
47
|
}
|
|
36
|
-
export declare function Select({ items, placeholder, status, helper, disabled, className, ...props }: SelectProps): import("react").JSX.Element;
|
|
48
|
+
export declare function Select({ items, placeholder, status, helper, disabled, className, renderOption, ref, ...props }: SelectProps): import("react").JSX.Element;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Skeleton — Design System Component
|
|
3
3
|
*
|
|
4
|
-
* Animated loading placeholder
|
|
4
|
+
* Animated loading placeholder. Supports two animation variants:
|
|
5
|
+
* - 'pulse' (default) — Tailwind animate-pulse opacity fade
|
|
6
|
+
* - 'shimmer' — horizontal shimmer sweep via .skeleton-shimmer CSS class
|
|
7
|
+
*
|
|
5
8
|
* Purely presentational — no state, no API calls, no domain logic.
|
|
6
9
|
*
|
|
7
10
|
* Usage:
|
|
8
11
|
* // Generic block
|
|
9
12
|
* <Skeleton className="h-4 w-32 rounded-lg" />
|
|
13
|
+
* <Skeleton variant="shimmer" className="h-4 w-32 rounded-lg" />
|
|
10
14
|
*
|
|
11
15
|
* // Composed patterns
|
|
12
|
-
* <SkeletonText lines={3} />
|
|
13
|
-
* <SkeletonAvatar />
|
|
14
|
-
* <SkeletonTableRow columns={['w-32', 'w-24', 'w-16']} />
|
|
16
|
+
* <SkeletonText lines={3} variant="shimmer" />
|
|
17
|
+
* <SkeletonAvatar variant="shimmer" />
|
|
18
|
+
* <SkeletonTableRow columns={['w-32', 'w-24', 'w-16']} variant="shimmer" />
|
|
15
19
|
*
|
|
16
20
|
* Accessibility:
|
|
17
21
|
* Skeleton elements are aria-hidden by default.
|
|
@@ -19,30 +23,36 @@
|
|
|
19
23
|
* on the parent container when screen-reader announcements are needed.
|
|
20
24
|
*/
|
|
21
25
|
import type { ReactNode } from 'react';
|
|
26
|
+
export type SkeletonVariant = 'pulse' | 'shimmer';
|
|
22
27
|
export interface SkeletonProps {
|
|
23
28
|
className?: string;
|
|
29
|
+
variant?: SkeletonVariant;
|
|
24
30
|
}
|
|
25
|
-
export declare function Skeleton({ className }: SkeletonProps): import("react").JSX.Element;
|
|
31
|
+
export declare function Skeleton({ className, variant }: SkeletonProps): import("react").JSX.Element;
|
|
26
32
|
export interface SkeletonTextProps {
|
|
27
33
|
/** Number of lines to render */
|
|
28
34
|
lines?: number;
|
|
29
35
|
className?: string;
|
|
36
|
+
variant?: SkeletonVariant;
|
|
30
37
|
}
|
|
31
|
-
export declare function SkeletonText({ lines, className }: SkeletonTextProps): import("react").JSX.Element;
|
|
38
|
+
export declare function SkeletonText({ lines, className, variant }: SkeletonTextProps): import("react").JSX.Element;
|
|
32
39
|
export interface SkeletonAvatarProps {
|
|
33
40
|
size?: 'sm' | 'md' | 'lg';
|
|
34
41
|
className?: string;
|
|
42
|
+
variant?: SkeletonVariant;
|
|
35
43
|
}
|
|
36
|
-
export declare function SkeletonAvatar({ size, className }: SkeletonAvatarProps): import("react").JSX.Element;
|
|
44
|
+
export declare function SkeletonAvatar({ size, className, variant }: SkeletonAvatarProps): import("react").JSX.Element;
|
|
37
45
|
export interface SkeletonCardProps {
|
|
38
46
|
className?: string;
|
|
39
47
|
children?: ReactNode;
|
|
48
|
+
variant?: SkeletonVariant;
|
|
40
49
|
}
|
|
41
|
-
export declare function SkeletonCard({ className, children }: SkeletonCardProps): import("react").JSX.Element;
|
|
50
|
+
export declare function SkeletonCard({ className, children, variant }: SkeletonCardProps): import("react").JSX.Element;
|
|
42
51
|
export interface SkeletonTableRowProps {
|
|
43
52
|
/** Number of rows to render */
|
|
44
53
|
rows?: number;
|
|
45
54
|
/** Tailwind width classes per column (e.g. ['w-32', 'w-24', 'w-16']) */
|
|
46
55
|
columns?: string[];
|
|
56
|
+
variant?: SkeletonVariant;
|
|
47
57
|
}
|
|
48
|
-
export declare function SkeletonTableRow({ rows, columns }: SkeletonTableRowProps): import("react").JSX.Element;
|
|
58
|
+
export declare function SkeletonTableRow({ rows, columns, variant }: SkeletonTableRowProps): import("react").JSX.Element;
|
|
@@ -25,5 +25,6 @@ export interface StatisticProps {
|
|
|
25
25
|
trendLabel?: string;
|
|
26
26
|
/** Visual variant */
|
|
27
27
|
variant?: StatisticVariant;
|
|
28
|
+
className?: string;
|
|
28
29
|
}
|
|
29
|
-
export declare function Statistic({ label, value, helper, icon: Icon, trend, trendLabel, variant, }: StatisticProps): import("react").JSX.Element;
|
|
30
|
+
export declare function Statistic({ label, value, helper, icon: Icon, trend, trendLabel, variant, className, }: StatisticProps): import("react").JSX.Element;
|
|
@@ -38,6 +38,8 @@ export interface StepperProps {
|
|
|
38
38
|
/** IDs of steps that are disabled */
|
|
39
39
|
disabledSteps?: string[];
|
|
40
40
|
orientation?: 'horizontal' | 'vertical';
|
|
41
|
+
/** Use "dark" when rendering on a dark/navy background */
|
|
42
|
+
theme?: 'light' | 'dark';
|
|
41
43
|
className?: string;
|
|
42
44
|
}
|
|
43
|
-
export declare function Stepper({ steps, currentStep, completedSteps, disabledSteps, orientation, className, }: StepperProps): import("react").JSX.Element;
|
|
45
|
+
export declare function Stepper({ steps, currentStep, completedSteps, disabledSteps, orientation, theme, className, }: StepperProps): import("react").JSX.Element;
|
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { ReactNode } from 'react';
|
|
11
11
|
export interface SwitchProps {
|
|
12
|
-
checked
|
|
13
|
-
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
onChange?: (checked: boolean) => void;
|
|
14
15
|
label?: ReactNode;
|
|
15
16
|
description?: string;
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
/** Show a loading spinner in place of the thumb */
|
|
18
19
|
loading?: boolean;
|
|
19
20
|
id?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
20
23
|
}
|
|
21
|
-
export declare function Switch({ checked, onChange, label, description, disabled, loading, id: externalId, }: SwitchProps): import("react").JSX.Element;
|
|
24
|
+
export declare function Switch({ checked: controlledChecked, defaultChecked, onChange, label, description, disabled, loading, id: externalId, className, ref, }: SwitchProps): import("react").JSX.Element;
|
|
@@ -14,4 +14,6 @@ export interface TextareaProps extends Omit<React.ComponentProps<'textarea'>, 's
|
|
|
14
14
|
maxLength?: number;
|
|
15
15
|
resize?: TextareaResize;
|
|
16
16
|
}
|
|
17
|
-
export declare function Textarea({ status, helper, maxLength, resize, disabled, value, defaultValue, onChange, className, ...props }: TextareaProps
|
|
17
|
+
export declare function Textarea({ status, helper, maxLength, resize, disabled, value, defaultValue, onChange, className, ref, ...props }: TextareaProps & {
|
|
18
|
+
ref?: React.Ref<HTMLTextAreaElement>;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
@@ -36,8 +36,9 @@ export interface TimelineItemProps {
|
|
|
36
36
|
/** True for the last visible item — hides the connector line. */
|
|
37
37
|
isLast: boolean;
|
|
38
38
|
children: ReactNode;
|
|
39
|
+
className?: string;
|
|
39
40
|
}
|
|
40
|
-
export declare function TimelineItem({ isFirst, isLast, children }: TimelineItemProps): import("react").JSX.Element;
|
|
41
|
+
export declare function TimelineItem({ isFirst, isLast, children, className }: TimelineItemProps): import("react").JSX.Element;
|
|
41
42
|
export interface TimelineValueCardProps {
|
|
42
43
|
/** Label above the "before" block. Default: "Previous" */
|
|
43
44
|
beforeLabel?: string;
|
|
@@ -64,5 +65,6 @@ export interface TimelineEmptyStateProps {
|
|
|
64
65
|
icon?: ReactNode;
|
|
65
66
|
title: string;
|
|
66
67
|
description?: string;
|
|
68
|
+
className?: string;
|
|
67
69
|
}
|
|
68
|
-
export declare function TimelineEmptyState({ icon, title, description }: TimelineEmptyStateProps): import("react").JSX.Element;
|
|
70
|
+
export declare function TimelineEmptyState({ icon, title, description, className }: TimelineEmptyStateProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tooltip — Design System Component
|
|
3
3
|
*
|
|
4
|
-
* A short
|
|
5
|
-
* an element.
|
|
4
|
+
* A short label or non-interactive formatted content that appears on hover
|
|
5
|
+
* or focus to describe an element.
|
|
6
6
|
*
|
|
7
7
|
* Behavior is provided by @radix-ui/react-tooltip, which handles:
|
|
8
8
|
* - Trigger scoping (fires only on the direct trigger, not descendants)
|
|
@@ -19,21 +19,23 @@
|
|
|
19
19
|
* - Typography and spacing
|
|
20
20
|
*
|
|
21
21
|
* Rules:
|
|
22
|
-
* - Tooltip content must be
|
|
22
|
+
* - Tooltip content must be non-interactive. Interactive elements (links,
|
|
23
|
+
* buttons) inside `content` will be unclickable due to `pointer-events-none`
|
|
24
|
+
* on the tooltip panel.
|
|
23
25
|
* - Do not put ESSENTIAL information only in a tooltip.
|
|
24
26
|
* - Use for supplementary descriptions: icon button labels, abbrev. meanings.
|
|
25
27
|
*
|
|
26
28
|
* Placement: 'top' | 'bottom' | 'left' | 'right'
|
|
27
29
|
*
|
|
28
30
|
* Difference from Popover:
|
|
29
|
-
* - Tooltip is
|
|
31
|
+
* - Tooltip is for non-interactive content, triggered by hover/focus.
|
|
30
32
|
* - Popover contains interactive content, triggered by explicit click.
|
|
31
33
|
*/
|
|
32
34
|
import { type ReactNode } from 'react';
|
|
33
35
|
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
34
36
|
export interface TooltipProps {
|
|
35
|
-
/** The
|
|
36
|
-
content:
|
|
37
|
+
/** The content shown in the tooltip. Accepts any ReactNode — string, formatted text, or JSX. */
|
|
38
|
+
content: ReactNode;
|
|
37
39
|
/** Placement relative to the trigger */
|
|
38
40
|
placement?: TooltipPlacement;
|
|
39
41
|
/** Delay before showing the tooltip, in ms */
|
|
@@ -41,7 +41,7 @@ export type { RadioGroupProps, RadioItemProps } from './gallery/radio-group/Radi
|
|
|
41
41
|
export { Switch } from './gallery/switch/Switch';
|
|
42
42
|
export type { SwitchProps } from './gallery/switch/Switch';
|
|
43
43
|
export { Combobox } from './gallery/combobox/Combobox';
|
|
44
|
-
export type { ComboboxProps } from './gallery/combobox/Combobox';
|
|
44
|
+
export type { ComboboxProps, ComboboxOption } from './gallery/combobox/Combobox';
|
|
45
45
|
export { DatePicker } from './gallery/date-picker/DatePicker';
|
|
46
46
|
export { OtpInput } from './gallery/otp-input/OtpInput';
|
|
47
47
|
export type { OtpInputProps } from './gallery/otp-input/OtpInput';
|
|
@@ -49,6 +49,8 @@ export { FileUpload } from './gallery/file-upload/FileUpload';
|
|
|
49
49
|
export type { FileUploadProps } from './gallery/file-upload/FileUpload';
|
|
50
50
|
export { FilterChip } from './gallery/filter-chip/FilterChip';
|
|
51
51
|
export type { FilterChipProps } from './gallery/filter-chip/FilterChip';
|
|
52
|
+
export { Search } from './gallery/search/Search';
|
|
53
|
+
export type { SearchProps } from './gallery/search/Search';
|
|
52
54
|
export { SegmentedControl } from './gallery/segmented-control/SegmentedControl';
|
|
53
55
|
export type { SegmentedControlProps, SegmentedControlOption } from './gallery/segmented-control/SegmentedControl';
|
|
54
56
|
export { ValidationSummary } from './gallery/validation-summary/ValidationSummary';
|
|
@@ -60,7 +62,7 @@ export type { ErrorBannerProps, ErrorBannerTone } from './gallery/error-banner/E
|
|
|
60
62
|
export { Progress } from './gallery/progress/Progress';
|
|
61
63
|
export type { ProgressProps } from './gallery/progress/Progress';
|
|
62
64
|
export { Skeleton, SkeletonText, SkeletonAvatar, SkeletonCard, SkeletonTableRow } from './gallery/skeleton/Skeleton';
|
|
63
|
-
export type { SkeletonProps, SkeletonTextProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonTableRowProps } from './gallery/skeleton/Skeleton';
|
|
65
|
+
export type { SkeletonProps, SkeletonTextProps, SkeletonAvatarProps, SkeletonCardProps, SkeletonTableRowProps, SkeletonVariant } from './gallery/skeleton/Skeleton';
|
|
64
66
|
export { StatusBadge } from './gallery/status-badge/StatusBadge';
|
|
65
67
|
export type { StatusBadgeProps, StatusBadgeTone } from './gallery/status-badge/StatusBadge';
|
|
66
68
|
export { default as Modal } from './gallery/modal/Modal';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diwauhris/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "DIWA UHRIS UI component library — React + Tailwind CSS",
|
|
7
7
|
"keywords": [
|
|
@@ -84,11 +84,10 @@
|
|
|
84
84
|
"jest-environment-jsdom": "^30.4.1",
|
|
85
85
|
"postcss": "^8.5.15",
|
|
86
86
|
"tailwindcss": "^3.4.17",
|
|
87
|
+
"tailwindcss-animate": "^1.0.7",
|
|
87
88
|
"typescript": "~6.0.2",
|
|
88
89
|
"typescript-eslint": "^8.65.0",
|
|
89
90
|
"vite": "^8.2.0",
|
|
90
91
|
"vite-plugin-dts": "^5.0.3"
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
-
|