@ufoui/core 0.0.5 → 0.0.40
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/assets/icons.d.ts +8 -2
- package/components/accordion/accordion.d.ts +31 -3
- package/components/accordion/accordionItem.d.ts +31 -3
- package/components/badge/badge.d.ts +2 -2
- package/components/base/boxBase.d.ts +14 -36
- package/components/base/buttonBase.d.ts +4 -4
- package/components/base/checkboxBase.d.ts +2 -2
- package/components/base/dialogBase.d.ts +111 -13
- package/components/base/fieldBase.d.ts +1 -2
- package/components/base/textBase.d.ts +1 -2
- package/components/breadcrumbs/breadcrumbs.d.ts +48 -0
- package/components/calendar/calendar.d.ts +23 -0
- package/components/calendar/calendarUtils.d.ts +18 -0
- package/components/card/card.d.ts +2 -2
- package/components/collapse/collapse.d.ts +15 -20
- package/components/dialogs/dialog.d.ts +1 -1
- package/components/dialogs/dialogActions.d.ts +19 -7
- package/components/dialogs/dialogActions.guards.d.ts +15 -0
- package/components/dialogs/dialogContent.d.ts +7 -1
- package/components/dialogs/dialogHeader.d.ts +60 -0
- package/components/dialogs/dialogTitle.d.ts +9 -5
- package/components/dialogs/drawer.d.ts +1 -1
- package/components/dialogs/index.d.ts +1 -0
- package/components/fieldset/fieldset.d.ts +1 -1
- package/components/link/link.d.ts +58 -0
- package/components/list/list.d.ts +1 -1
- package/components/menu/menu.d.ts +2 -2
- package/components/rating/rating.d.ts +68 -0
- package/components/slider/slider.d.ts +11 -0
- package/components/switch/switch.d.ts +2 -10
- package/components/themeProvider/themeProvider.d.ts +10 -15
- package/components/toast/toast.d.ts +18 -4
- package/components/toast/toastViewport.d.ts +4 -3
- package/components/tooltip/tooltip.d.ts +2 -2
- package/context/selectionContext.d.ts +18 -17
- package/hooks/index.d.ts +3 -1
- package/hooks/useAnimate.d.ts +36 -16
- package/hooks/useFocusTrap.d.ts +32 -0
- package/hooks/useFocusVisible.d.ts +16 -14
- package/hooks/useResizeObserver.d.ts +7 -3
- package/hooks/useRovingFocus.d.ts +30 -0
- package/hooks/useSelection.d.ts +10 -7
- package/hooks/useSelectionState.d.ts +29 -0
- package/hooks/useSliderKeys.d.ts +41 -0
- package/index.css +1 -1
- package/index.d.ts +4 -8
- package/index.js +4782 -0
- package/internal/controlGrid/controlGrid.d.ts +32 -0
- package/internal/controlLabel/controlLabel.d.ts +31 -0
- package/internal/description/description.d.ts +18 -0
- package/internal/icon/icon.d.ts +28 -0
- package/internal/index.d.ts +7 -0
- package/internal/inlineTooltip/index.d.ts +1 -0
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +3 -3
- package/internal/slots/slot.d.ts +44 -0
- package/internal/stateLayer/stateLayer.d.ts +33 -0
- package/package.json +12 -3
- package/types/dialog.d.ts +37 -0
- package/types/index.d.ts +1 -0
- package/types/motion.d.ts +2 -2
- package/types/theme.d.ts +0 -30
- package/utils/applyThemeTokens.d.ts +10 -0
- package/utils/calculateFloatingPosition.d.ts +3 -3
- package/utils/color.d.ts +61 -216
- package/utils/colorRegistry.d.ts +44 -0
- package/utils/controlStyle.d.ts +8 -8
- package/utils/flatChildren.d.ts +17 -0
- package/utils/generateMaterialColors.d.ts +7 -7
- package/utils/getWrapperStyle.d.ts +53 -0
- package/utils/index.d.ts +5 -1
- package/utils/renderPortal.d.ts +30 -0
- package/utils/toasts/ensureViewport.d.ts +6 -1
- package/utils/toasts/toast.d.ts +66 -10
- package/utils/toasts/toastStore.d.ts +55 -1
- package/utils/utils.d.ts +67 -55
- package/hooks/useFocusState.d.ts +0 -16
- package/index.mjs +0 -4649
- package/internal/inlineTooltip/inlineTooltip.d.ts +0 -11
- package/internal/inlineTooltip/inlineTooltip2.d.ts +0 -10
- package/utils/generateSchemes.d.ts +0 -32
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
/** Slot contract for components that can act as dialog actions. */
|
|
3
|
+
export interface DialogActionProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
'aria-label'?: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
leading?: ReactNode;
|
|
8
|
+
trailing?: ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
3
11
|
export interface DialogActionsProps {
|
|
4
|
-
|
|
12
|
+
actions?: ReactNode;
|
|
13
|
+
placement?: 'top' | 'subtitle' | 'bottom' | 'inline';
|
|
14
|
+
align?: 'start' | 'center' | 'end';
|
|
15
|
+
stack?: boolean;
|
|
5
16
|
className?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
/** Maximum number of visible actions before the rest collapse into an overflow menu. */
|
|
18
|
+
maxActions?: number;
|
|
19
|
+
/** Accessible label for the overflow actions button. Default: "More actions" */
|
|
20
|
+
moreLabel?: string;
|
|
21
|
+
moreIcon?: ReactNode;
|
|
10
22
|
}
|
|
11
23
|
export declare const DialogActions: {
|
|
12
|
-
({
|
|
24
|
+
({ actions, className, placement, align, stack, maxActions, moreLabel, }: DialogActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
25
|
displayName: string;
|
|
14
26
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { DialogActionProps } from './dialogActions';
|
|
3
|
+
export declare const IS_DIALOG_ACTION: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Type guard that checks whether a React node is a dialog action component.
|
|
6
|
+
*
|
|
7
|
+
* Identifies dialog action elements by the internal {@link IS_DIALOG_ACTION} symbol
|
|
8
|
+
* attached to the component type.
|
|
9
|
+
*
|
|
10
|
+
* @param el - React node to test.
|
|
11
|
+
* @returns `true` if the node is a dialog action element.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function isDialogAction(el: ReactNode): el is ReactElement<DialogActionProps>;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { SurfaceColor } from '../../utils';
|
|
3
|
+
import { DialogIconSlot } from '../../types';
|
|
2
4
|
export interface DialogContentProps {
|
|
3
5
|
children?: ReactNode;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
showIcon?: boolean;
|
|
8
|
+
iconColor?: SurfaceColor;
|
|
9
|
+
iconSlot?: DialogIconSlot;
|
|
4
10
|
className?: string;
|
|
5
11
|
}
|
|
6
12
|
export declare const DialogContent: {
|
|
7
|
-
({ children, className }: DialogContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
({ children, iconSlot, icon, showIcon, iconColor, className }: DialogContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
14
|
displayName: string;
|
|
9
15
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { DialogActionsProps } from './dialogActions';
|
|
3
|
+
import { ElementFont, SurfaceColor } from '../../utils';
|
|
4
|
+
import { DialogIconSlot } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* Props for {@link DialogHeader}.
|
|
7
|
+
*
|
|
8
|
+
* @category Dialog
|
|
9
|
+
*/
|
|
10
|
+
export interface DialogHeaderProps {
|
|
11
|
+
/** Optional content before the back button and title row. */
|
|
12
|
+
leading?: ReactNode;
|
|
13
|
+
/** When true, renders the back affordance with {@link backIcon}. */
|
|
14
|
+
showBack?: boolean;
|
|
15
|
+
/** Invoked when the back control is activated. */
|
|
16
|
+
onBack?: () => void;
|
|
17
|
+
/** Icon element for the back control. */
|
|
18
|
+
backIcon?: ReactElement;
|
|
19
|
+
/** Resolved icon wrapper for leading/top slots; omit when no dialog icon. */
|
|
20
|
+
icon?: ReactElement;
|
|
21
|
+
showIcon?: boolean;
|
|
22
|
+
iconColor?: SurfaceColor;
|
|
23
|
+
/** Where the icon is placed inside the header vs content (see {@link DialogIconSlot}). */
|
|
24
|
+
iconSlot: DialogIconSlot;
|
|
25
|
+
/** Title alignment passed to {@link DialogTitle}. */
|
|
26
|
+
titleAlign?: 'start' | 'center' | 'end';
|
|
27
|
+
/** Title text. */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** Action buttons (see {@link DialogActions}). */
|
|
30
|
+
actions?: DialogActionsProps['actions'];
|
|
31
|
+
actionsAlign?: DialogActionsProps['align'];
|
|
32
|
+
actionsStack?: DialogActionsProps['stack'];
|
|
33
|
+
maxActions?: DialogActionsProps['maxActions'];
|
|
34
|
+
moreLabel?: DialogActionsProps['moreLabel'];
|
|
35
|
+
moreIcon?: DialogActionsProps['moreIcon'];
|
|
36
|
+
/** Optional content after actions / before close in the header row. */
|
|
37
|
+
trailing?: ReactNode;
|
|
38
|
+
/** When true, renders the close control with {@link closeIcon}. */
|
|
39
|
+
showClose?: boolean;
|
|
40
|
+
/** Invoked when the close control is activated. */
|
|
41
|
+
onClose?: () => void;
|
|
42
|
+
/** Icon element for the close control (already resolved to default or override). */
|
|
43
|
+
closeIcon?: ReactElement;
|
|
44
|
+
font?: ElementFont;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Dialog title row: leading/back/icon, title, inline actions, trailing, and close.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Non-inline actions are omitted here and rendered below the content by the parent.
|
|
51
|
+
*
|
|
52
|
+
* @function
|
|
53
|
+
* @param props Component properties.
|
|
54
|
+
*
|
|
55
|
+
* @category Dialog
|
|
56
|
+
*/
|
|
57
|
+
export declare const DialogHeader: {
|
|
58
|
+
({ leading, showBack, onBack, backIcon, icon, showIcon, iconColor, iconSlot, titleAlign, label, actions, actionsAlign, actionsStack, maxActions, moreLabel, moreIcon, trailing, showClose, onClose, closeIcon, font, }: DialogHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ElementFont, SurfaceColor } from '../../utils';
|
|
3
|
+
import { DialogIconSlot } from '../../types';
|
|
3
4
|
export interface DialogTitleProps {
|
|
4
|
-
icon?: ReactNode;
|
|
5
5
|
label?: string;
|
|
6
|
-
children?: ReactNode;
|
|
7
6
|
className?: string;
|
|
8
7
|
font?: ElementFont;
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** Resolved icon wrapper for leading/top slots; omit when no dialog icon. */
|
|
9
|
+
icon?: ReactNode | null;
|
|
10
|
+
/** Where the icon is placed inside the header vs content (see {@link DialogIconSlot}). */
|
|
11
|
+
iconSlot?: DialogIconSlot;
|
|
12
|
+
showIcon?: boolean;
|
|
13
|
+
iconColor?: SurfaceColor;
|
|
14
|
+
align?: 'start' | 'center' | 'end';
|
|
11
15
|
}
|
|
12
16
|
export declare const DialogTitle: {
|
|
13
|
-
({
|
|
17
|
+
({ label, icon, iconSlot, className, iconColor, showIcon, align, font, }: DialogTitleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
14
18
|
displayName: string;
|
|
15
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ElementFont, SurfaceColor } from '../../utils';
|
|
3
|
-
import { BoxBaseProps } from '../base
|
|
3
|
+
import { BoxBaseProps } from '../base';
|
|
4
4
|
/**
|
|
5
5
|
* Props for {@link Fieldset}.
|
|
6
6
|
* Extends {@link BoxBaseProps} except for `elementClass` and `component`.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { default as React, ElementType, ReactNode } from 'react';
|
|
2
|
+
import { ElementFocusEffect, ElementFont, ElementHoverEffect, ElementPressedEffect, SurfaceColor } from '../../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Link component.
|
|
5
|
+
*
|
|
6
|
+
* Inline link element with optional leading and trailing content and animated underline.
|
|
7
|
+
*
|
|
8
|
+
* @category Link
|
|
9
|
+
*/
|
|
10
|
+
export type LinkProps<T extends ElementType = 'a'> = {
|
|
11
|
+
/** Underlying element or router component. */
|
|
12
|
+
as?: T;
|
|
13
|
+
/** Link content. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/** Fallback text when children is not provided. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Leading visual element. */
|
|
18
|
+
leading?: ReactNode;
|
|
19
|
+
/** Trailing visual element. */
|
|
20
|
+
trailing?: ReactNode;
|
|
21
|
+
/** Surface color token applied to text. */
|
|
22
|
+
color?: SurfaceColor;
|
|
23
|
+
/** Underline visibility behavior. */
|
|
24
|
+
underline?: 'none' | 'hover' | 'always';
|
|
25
|
+
/** Font token applied to content. */
|
|
26
|
+
font?: ElementFont;
|
|
27
|
+
/** Opens link in new tab with security attributes. */
|
|
28
|
+
isExternal?: boolean;
|
|
29
|
+
/** Accessibility label override. */
|
|
30
|
+
'aria-label'?: string;
|
|
31
|
+
/** Additional class applied to the root element. */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Disables interaction and focus. */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Hover visual effects. */
|
|
36
|
+
hoverEffects?: ElementHoverEffect[];
|
|
37
|
+
/** Focus visual effects. */
|
|
38
|
+
focusEffects?: ElementFocusEffect[];
|
|
39
|
+
/** Pressed visual effects. */
|
|
40
|
+
pressedEffects?: ElementPressedEffect[];
|
|
41
|
+
/** Underline animation origin. */
|
|
42
|
+
underlineOrigin?: 'left' | 'center';
|
|
43
|
+
/** Underline animation type. */
|
|
44
|
+
underlineAnimation?: 'scale' | 'fade';
|
|
45
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, 'as' | 'color' | 'children' | 'className'>;
|
|
46
|
+
export interface LinkComponent {
|
|
47
|
+
<T extends ElementType = 'a'>(props: LinkProps<T>): ReactNode;
|
|
48
|
+
displayName?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Inline link component with optional leading and trailing content and animated underline.
|
|
52
|
+
*
|
|
53
|
+
* @function
|
|
54
|
+
* @param props Component properties.
|
|
55
|
+
*
|
|
56
|
+
* @category Link
|
|
57
|
+
*/
|
|
58
|
+
export declare const Link: LinkComponent;
|
|
@@ -5,4 +5,4 @@ export interface ListProps extends Omit<BoxBaseProps, 'type'> {
|
|
|
5
5
|
defaultValue?: string;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const List: ({ type, defaultValue, children
|
|
8
|
+
export declare const List: ({ type, defaultValue, children }: ListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React, HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { MotionAnimation, MotionStyle } from '../../types';
|
|
3
|
-
import { BorderColor,
|
|
3
|
+
import { BorderColor, ElementBorder, ElementDensity, ElementElevation, ElementFloatingMode, ElementFocusEffect, ElementFont, ElementPlacement, ElementSelectedEffect, ElementShape, ElementTouchEffect, SurfaceColor } from '../../utils';
|
|
4
4
|
/**
|
|
5
5
|
* Visual style preset for the Menu component.
|
|
6
6
|
*
|
|
@@ -85,7 +85,7 @@ export interface MenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'>
|
|
|
85
85
|
/** Opens the menu on pointer hover. */
|
|
86
86
|
openOnHover?: boolean;
|
|
87
87
|
/** Preferred placement relative to the anchor. */
|
|
88
|
-
placement?:
|
|
88
|
+
placement?: ElementPlacement;
|
|
89
89
|
/** Icon used for checked radio items. */
|
|
90
90
|
radioCheckedIcon?: ReactNode;
|
|
91
91
|
/** Icon used for unchecked radio items. */
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ElementDensity, ElementFocusEffect, ElementFont, ElementPlacement, ElementSize, ElementTextPlacement, SurfaceColor } from '../../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Rating component.
|
|
5
|
+
*
|
|
6
|
+
* Numeric rating control rendered as a star slider with optional label and description.
|
|
7
|
+
*
|
|
8
|
+
* @category Rating
|
|
9
|
+
*/
|
|
10
|
+
export interface RatingProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'defaultValue' | 'size'> {
|
|
11
|
+
/** Additional class applied to the root element. */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Color applied to the filled icons. */
|
|
14
|
+
color?: SurfaceColor;
|
|
15
|
+
/** Initial rating value for uncontrolled usage. */
|
|
16
|
+
defaultValue?: number;
|
|
17
|
+
/** Visual density of the control. */
|
|
18
|
+
density?: ElementDensity;
|
|
19
|
+
/** Supporting text displayed below the control. */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** Disables interaction with the control. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Icon used for the empty rating state. */
|
|
24
|
+
emptyIcon?: ReactNode;
|
|
25
|
+
/** Error message displayed below the control. */
|
|
26
|
+
error?: string;
|
|
27
|
+
/** Enables filled visual style for icons. */
|
|
28
|
+
filled?: boolean;
|
|
29
|
+
/** Visual effects applied when the control receives focus. */
|
|
30
|
+
focusEffects?: ElementFocusEffect[];
|
|
31
|
+
/** Font applied to the label text. */
|
|
32
|
+
font?: ElementFont;
|
|
33
|
+
/** Icon used for the filled rating state. */
|
|
34
|
+
icon?: ReactNode;
|
|
35
|
+
/** DOM id used for accessibility attributes. */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** Label text displayed next to the control. */
|
|
38
|
+
label?: string;
|
|
39
|
+
/** Maximum rating value. */
|
|
40
|
+
max?: number;
|
|
41
|
+
/** Called when the rating value changes. */
|
|
42
|
+
onChange?: (value: number) => void;
|
|
43
|
+
/** Prevents value changes while keeping the control focusable. */
|
|
44
|
+
readOnly?: boolean;
|
|
45
|
+
/** Marks the control as required. */
|
|
46
|
+
required?: boolean;
|
|
47
|
+
/** Visual size of the rating icons. */
|
|
48
|
+
size?: ElementSize;
|
|
49
|
+
/** Step size used for keyboard and pointer interaction. */
|
|
50
|
+
step?: number;
|
|
51
|
+
/** Placement of label and description relative to the control. */
|
|
52
|
+
textPlacement?: ElementTextPlacement;
|
|
53
|
+
/** Tooltip alignment relative to the control. */
|
|
54
|
+
tooltipAlign?: ElementPlacement;
|
|
55
|
+
/** Current rating value when used as a controlled component. */
|
|
56
|
+
value?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Star rating input rendered as an interactive slider.
|
|
60
|
+
*
|
|
61
|
+
* Supports mouse, keyboard and form integration through a hidden input.
|
|
62
|
+
*
|
|
63
|
+
* @function
|
|
64
|
+
* @param props Component properties.
|
|
65
|
+
*
|
|
66
|
+
* @category Rating
|
|
67
|
+
*/
|
|
68
|
+
export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SliderProps {
|
|
2
|
+
value?: number;
|
|
3
|
+
defaultValue?: number;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
step?: number;
|
|
7
|
+
name?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onChange?: (value: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const Slider: import('react').ForwardRefExoticComponent<SliderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
-
import { BorderColor,
|
|
2
|
+
import { BorderColor, ElementDensity, ElementElevation, ElementFocusEffect, ElementFont, ElementHoverEffect, ElementOutline, ElementPlacement, ElementPressedEffect, ElementSelectedEffect, ElementShape, ElementSize, ElementTextPlacement, ElementTouchEffect, SemanticColor } from '../../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Props for the Switch component.
|
|
5
5
|
*
|
|
@@ -26,10 +26,6 @@ export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
26
26
|
density?: ElementDensity;
|
|
27
27
|
/** Supporting text displayed below the label. */
|
|
28
28
|
description?: string;
|
|
29
|
-
/** Text color override for the description. */
|
|
30
|
-
descriptionColor?: SurfaceColor;
|
|
31
|
-
/** Font token applied to the description text. */
|
|
32
|
-
descriptionFont?: ElementFont;
|
|
33
29
|
/** Elevation level of the control surface. */
|
|
34
30
|
elevation?: ElementElevation;
|
|
35
31
|
/** Error message text. Overrides description when present. */
|
|
@@ -50,8 +46,6 @@ export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
50
46
|
id?: string;
|
|
51
47
|
/** Text label associated with the control. */
|
|
52
48
|
label?: string;
|
|
53
|
-
/** Text color override for the label. */
|
|
54
|
-
labelColor?: SurfaceColor;
|
|
55
49
|
/** Name attribute forwarded to the input element. */
|
|
56
50
|
name?: string;
|
|
57
51
|
/** Change event handler. */
|
|
@@ -66,12 +60,10 @@ export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
66
60
|
shape?: ElementShape;
|
|
67
61
|
/** Size of the control. */
|
|
68
62
|
size?: ElementSize;
|
|
69
|
-
/** Text color override for label and content. */
|
|
70
|
-
textColor?: SurfaceColor;
|
|
71
63
|
/** Layout of text relative to the control. */
|
|
72
64
|
textPlacement?: ElementTextPlacement;
|
|
73
65
|
/** Tooltip alignment relative to the control. */
|
|
74
|
-
tooltipAlign?:
|
|
66
|
+
tooltipAlign?: ElementPlacement;
|
|
75
67
|
/** Touch and click visual effects. */
|
|
76
68
|
touchEffects?: ElementTouchEffect[];
|
|
77
69
|
/** Border style when unchecked. */
|
|
@@ -12,20 +12,14 @@ export interface ThemeProviderProps {
|
|
|
12
12
|
* Defaults to #6750A4 if omitted.
|
|
13
13
|
*/
|
|
14
14
|
seedColor?: string;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
* If omitted, defaults to:
|
|
18
|
-
* - info: #03a9f4
|
|
19
|
-
* - warning: #ffd600
|
|
20
|
-
* - success: #689f38
|
|
21
|
-
*/
|
|
22
|
-
extraColors?: Partial<Record<'info' | 'warning' | 'success', string>>;
|
|
15
|
+
/** Optional custom colors map used to define or override generated theme roles. */
|
|
16
|
+
colors?: Record<string, string>;
|
|
23
17
|
}
|
|
24
18
|
/**
|
|
25
19
|
* Provides a ThemeContext to all descendant components using Material Design 3 color tokens.
|
|
26
20
|
*
|
|
27
21
|
* - Dynamically generates full theme schemes (`light` and `dark`) based on the provided `seedColor`
|
|
28
|
-
* and optional `
|
|
22
|
+
* and optional `colors`.
|
|
29
23
|
* - Injects resolved colors as CSS custom properties into the DOM (`:root` and `.dark`).
|
|
30
24
|
* - Automatically toggles the `.dark` class on `<body>` based on `colorMode`.
|
|
31
25
|
* - Exposes utility functions via context:
|
|
@@ -36,14 +30,15 @@ export interface ThemeProviderProps {
|
|
|
36
30
|
*
|
|
37
31
|
* This provider must wrap your application to enable theming and contextual access to color tokens.
|
|
38
32
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
33
|
+
* @param props - Theme provider props.
|
|
34
|
+
* @param props.children - React children rendered within the theme context.
|
|
35
|
+
* @param props.colorMode - Optional color mode: `'light'` or `'dark'`. Defaults to `'light'`.
|
|
36
|
+
* @param props.seedColor - Optional base color used to generate the theme. Defaults to `#6750A4`.
|
|
37
|
+
* @param props.colors - Optional custom colors map used to define or override generated theme roles.
|
|
43
38
|
*
|
|
44
39
|
* @example
|
|
45
40
|
* ```tsx
|
|
46
|
-
* <ThemeProvider colorMode="dark" seedColor="#6200ee"
|
|
41
|
+
* <ThemeProvider colorMode="dark" seedColor="#6200ee" colors={{ info: '#2196f3', primary: '#0f62fe' }}>
|
|
47
42
|
* <App />
|
|
48
43
|
* </ThemeProvider>
|
|
49
44
|
* ```
|
|
@@ -51,4 +46,4 @@ export interface ThemeProviderProps {
|
|
|
51
46
|
* @category Components
|
|
52
47
|
* @group Theme
|
|
53
48
|
*/
|
|
54
|
-
export declare const ThemeProvider: ({ children, colorMode, seedColor,
|
|
49
|
+
export declare const ThemeProvider: ({ children, colorMode, seedColor, colors }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
-
import { ElementElevation, ElementShape, SurfaceColor } from '../../utils';
|
|
2
|
+
import { ElementElevation, ElementShape, SurfaceColor, ToastStatus } from '../../utils';
|
|
3
3
|
import { BoxBaseProps } from '../base';
|
|
4
|
-
import {
|
|
4
|
+
import { MotionAnimation, MotionStyle } from '../../types';
|
|
5
5
|
/**
|
|
6
6
|
* Props for Toast component.
|
|
7
7
|
*
|
|
8
8
|
* @category Toast
|
|
9
9
|
*/
|
|
10
10
|
export interface ToastProps extends Omit<BoxBaseProps, 'children'> {
|
|
11
|
+
/** Toast identifier used for lifecycle control. */
|
|
12
|
+
id: string;
|
|
11
13
|
/** Primary heading text. */
|
|
12
14
|
title?: string;
|
|
13
15
|
/** Secondary supporting text. */
|
|
@@ -20,18 +22,30 @@ export interface ToastProps extends Omit<BoxBaseProps, 'children'> {
|
|
|
20
22
|
action?: ReactNode;
|
|
21
23
|
/** Full content override replacing internal layout. */
|
|
22
24
|
content?: ReactNode;
|
|
25
|
+
/** Time in milliseconds before the toast is automatically dismissed. */
|
|
26
|
+
timeout?: number;
|
|
23
27
|
/** Elevation token. Default: 3 */
|
|
24
28
|
elevation?: ElementElevation;
|
|
25
29
|
/** Status variant applied as CSS modifier class. */
|
|
26
30
|
status?: ToastStatus;
|
|
27
31
|
/** Shape token. Default: smooth */
|
|
28
32
|
shape?: ElementShape;
|
|
33
|
+
/** Animation preset used by internal motion elements. */
|
|
34
|
+
animation?: MotionAnimation;
|
|
35
|
+
/** Animation duration in milliseconds. */
|
|
36
|
+
duration?: number;
|
|
37
|
+
/** Motion style applied to animated elements. */
|
|
38
|
+
motionStyle?: MotionStyle;
|
|
39
|
+
leaving?: boolean;
|
|
40
|
+
onExitComplete?: (id: string) => void;
|
|
29
41
|
}
|
|
30
42
|
/**
|
|
31
|
-
* Toast
|
|
43
|
+
* Toast notification container.
|
|
44
|
+
*
|
|
45
|
+
* Handles auto-dismiss lifecycle using the timeout property.
|
|
32
46
|
*
|
|
33
47
|
* @function
|
|
34
|
-
* @param props Component
|
|
48
|
+
* @param props Component properties.
|
|
35
49
|
*
|
|
36
50
|
* @category Toast
|
|
37
51
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export type ToastPosition = '
|
|
1
|
+
export type ToastPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
2
2
|
export interface ToastViewportProps {
|
|
3
3
|
position?: ToastPosition;
|
|
4
|
-
|
|
4
|
+
timeout?: number;
|
|
5
|
+
limit?: number;
|
|
5
6
|
}
|
|
6
|
-
export declare const ToastViewport: ({ position,
|
|
7
|
+
export declare const ToastViewport: ({ position, timeout, limit }: ToastViewportProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementPlacement } from '../../utils';
|
|
3
3
|
export interface TooltipProps extends HTMLProps<HTMLDivElement> {
|
|
4
4
|
title: string;
|
|
5
5
|
children?: ReactNode;
|
|
6
|
-
align?:
|
|
6
|
+
align?: ElementPlacement;
|
|
7
7
|
}
|
|
8
8
|
export declare const Tooltip: import('react').ForwardRefExoticComponent<Omit<TooltipProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
+
import { useRovingFocus } from '../hooks/useRovingFocus';
|
|
1
2
|
/**
|
|
2
3
|
* Context value shared by components that rely on selection behavior.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* selected values.
|
|
5
|
+
* @typeParam T - Optional configuration object provided by the parent component.
|
|
6
6
|
*
|
|
7
7
|
* @category Contexts
|
|
8
8
|
*/
|
|
9
|
-
export interface SelectionContextValue {
|
|
10
|
-
/** Currently selected values. */
|
|
11
|
-
values: string[];
|
|
12
|
-
/** Selection mode: single or multiple. */
|
|
13
|
-
mode: 'single' | 'multiple';
|
|
14
|
-
/** Toggles selection state for a given value. */
|
|
15
|
-
toggle: (value: string) => void;
|
|
16
|
-
/** Sets a value directly (primarily for single mode). */
|
|
17
|
-
set: (value: string) => void;
|
|
9
|
+
export interface SelectionContextValue<T = unknown> {
|
|
18
10
|
/** Clears all selected values. */
|
|
19
11
|
clear: () => void;
|
|
12
|
+
/** Optional configuration object passed from the parent component. */
|
|
13
|
+
config?: T;
|
|
14
|
+
/** Selection type: single or multiple. */
|
|
15
|
+
type: 'single' | 'multiple';
|
|
16
|
+
/** Optional roving focus controller for keyboard navigation between items. */
|
|
17
|
+
roving?: ReturnType<typeof useRovingFocus>;
|
|
18
|
+
/** Sets a value directly. */
|
|
19
|
+
set: (value: string) => void;
|
|
20
|
+
/** Toggles selection state for a given value. */
|
|
21
|
+
toggle: (value: string) => void;
|
|
22
|
+
/** Currently selected values. */
|
|
23
|
+
values: string[];
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* Used by components such as Accordion, Tabs, RadioGroup,
|
|
25
|
-
* and similar patterns that require controlled selection logic.
|
|
26
|
+
* React context that exposes shared selection state and optional configuration.
|
|
26
27
|
*
|
|
27
|
-
* Returns `null`
|
|
28
|
+
* Returns `null` when accessed outside of a provider.
|
|
28
29
|
*
|
|
29
30
|
* @category Contexts
|
|
30
31
|
*/
|
|
31
|
-
export declare const SelectionContext: import('react').Context<SelectionContextValue | null>;
|
|
32
|
+
export declare const SelectionContext: import('react').Context<SelectionContextValue<unknown> | null>;
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './useAnimate';
|
|
2
2
|
export * from './useClickOutside';
|
|
3
3
|
export * from './useEscapeHandler';
|
|
4
|
-
export * from './useFocusState';
|
|
5
4
|
export * from './useFocusVisible';
|
|
6
5
|
export * from './useResizeObserver';
|
|
7
6
|
export * from './useSelection';
|
|
8
7
|
export * from './useTheme';
|
|
8
|
+
export * from './useSliderKeys';
|
|
9
|
+
export * from './useSelectionState';
|
|
10
|
+
export * from './useFocusTrap';
|
package/hooks/useAnimate.d.ts
CHANGED
|
@@ -19,36 +19,56 @@ export interface UseAnimateOptions {
|
|
|
19
19
|
* @category Hooks
|
|
20
20
|
*/
|
|
21
21
|
export interface UseAnimateResult {
|
|
22
|
-
/** True
|
|
22
|
+
/** True during the opening phase. */
|
|
23
23
|
opening: boolean;
|
|
24
|
-
/** True
|
|
24
|
+
/** True during the closing phase. */
|
|
25
25
|
closing: boolean;
|
|
26
|
-
/** True
|
|
26
|
+
/** True when animation is running and not temporarily suppressed. */
|
|
27
27
|
animating: boolean;
|
|
28
|
-
/** True
|
|
28
|
+
/** True while animation is in progress (opening or closing). */
|
|
29
|
+
active: boolean;
|
|
30
|
+
/** True only before any animation has started. */
|
|
29
31
|
idle: boolean;
|
|
30
32
|
/** CSS variables controlling animation timing and direction. */
|
|
31
33
|
animationVars: Record<string, string>;
|
|
32
|
-
/** Triggers
|
|
34
|
+
/** Triggers animation towards open or closed state. */
|
|
33
35
|
animate(next?: 'open' | 'closed'): void;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
|
-
*
|
|
38
|
+
* Handles open/close animation with interrupt support.
|
|
37
39
|
*
|
|
38
|
-
*
|
|
39
|
-
* -
|
|
40
|
-
* -
|
|
41
|
-
* -
|
|
40
|
+
* Flow:
|
|
41
|
+
* - animate('open') → sets phase to "opening" and starts a timer
|
|
42
|
+
* - after t1 → phase becomes "open" and timer is cleared
|
|
43
|
+
* - animate('closed') → sets phase to "closing" and starts a timer
|
|
44
|
+
* - after t2 → phase becomes "closed" and timer is cleared
|
|
42
45
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
46
|
+
* Interrupt:
|
|
47
|
+
* - calling animate() during an active transition clears the current timer
|
|
48
|
+
* - a new transition starts immediately
|
|
49
|
+
* - for one render animating = false (reset frame)
|
|
45
50
|
*
|
|
46
|
-
*
|
|
47
|
-
* -
|
|
48
|
-
* -
|
|
51
|
+
* State usage:
|
|
52
|
+
* - opening / closing → current transition phase
|
|
53
|
+
* - active → true while transition is in progress (used for mount/visibility)
|
|
54
|
+
* - animating → same as active, but disabled during reset frame (used for CSS classes)
|
|
55
|
+
* - idle → true only before the first animation
|
|
56
|
+
*
|
|
57
|
+
* Important:
|
|
58
|
+
* - use `active` to control visibility (mount/unmount)
|
|
59
|
+
* - use `animating` to apply or remove animation classes
|
|
60
|
+
*
|
|
61
|
+
* Timer:
|
|
62
|
+
* - created when transition starts
|
|
63
|
+
* - cleared on completion or interrupt
|
|
64
|
+
*
|
|
65
|
+
* Modes:
|
|
66
|
+
* - t1 defined → automatic timed transitions
|
|
67
|
+
* - t1 undefined → manual stepper (each call advances phase)
|
|
68
|
+
* - oneShot → only opening transition is executed
|
|
49
69
|
*
|
|
50
70
|
* @function
|
|
51
|
-
* @param options Hook configuration options
|
|
71
|
+
* @param options Hook configuration options
|
|
52
72
|
*
|
|
53
73
|
* @category Hooks
|
|
54
74
|
*/
|