@bug-on/md3-react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -0
- package/dist/assets/fonts/GoogleSansFlex-VariableFont.woff2 +0 -0
- package/dist/assets/fonts/MaterialSymbolsOutlined-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/fonts/MaterialSymbolsSharp-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/loading-indicator.svg +19 -0
- package/dist/assets/material-symbols-cdn.css +65 -0
- package/dist/assets/material-symbols-self-hosted.css +109 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useMediaQuery.d.ts +11 -0
- package/dist/hooks/useRipple.d.ts +26 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +9059 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8929 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/material-symbols-preconnect.d.ts +42 -0
- package/dist/lib/theme-utils.d.ts +63 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/material-symbols-cdn.css +65 -0
- package/dist/material-symbols-self-hosted.css +109 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/md3.d.ts +14 -0
- package/dist/typography.css +22 -0
- package/dist/ui/badge.d.ts +125 -0
- package/dist/ui/button-group.d.ts +59 -0
- package/dist/ui/button.d.ts +148 -0
- package/dist/ui/card.d.ts +62 -0
- package/dist/ui/checkbox.d.ts +82 -0
- package/dist/ui/chip.d.ts +110 -0
- package/dist/ui/code-block.d.ts +14 -0
- package/dist/ui/dialog.d.ts +111 -0
- package/dist/ui/divider.d.ts +164 -0
- package/dist/ui/drawer.d.ts +39 -0
- package/dist/ui/dropdown.d.ts +29 -0
- package/dist/ui/fab-menu.d.ts +204 -0
- package/dist/ui/fab.d.ts +162 -0
- package/dist/ui/icon-button.d.ts +131 -0
- package/dist/ui/icon.d.ts +88 -0
- package/dist/ui/loading-indicator.d.ts +42 -0
- package/dist/ui/navigation-rail.d.ts +29 -0
- package/dist/ui/progress-indicator/circular.d.ts +3 -0
- package/dist/ui/progress-indicator/hooks.d.ts +3 -0
- package/dist/ui/progress-indicator/index.d.ts +21 -0
- package/dist/ui/progress-indicator/linear-flat.d.ts +10 -0
- package/dist/ui/progress-indicator/linear-wavy.d.ts +18 -0
- package/dist/ui/progress-indicator/linear.d.ts +3 -0
- package/dist/ui/progress-indicator/types.d.ts +151 -0
- package/dist/ui/progress-indicator/utils.d.ts +3 -0
- package/dist/ui/radio-button.d.ts +106 -0
- package/dist/ui/ripple.d.ts +126 -0
- package/dist/ui/scroll-area.d.ts +27 -0
- package/dist/ui/shared/constants.d.ts +86 -0
- package/dist/ui/shared/touch-target.d.ts +38 -0
- package/dist/ui/snackbar/index.d.ts +6 -0
- package/dist/ui/snackbar/snackbar.d.ts +196 -0
- package/dist/ui/switch/index.d.ts +7 -0
- package/dist/ui/switch/switch.d.ts +30 -0
- package/dist/ui/switch/switch.stories.d.ts +48 -0
- package/dist/ui/switch/switch.tokens.d.ts +67 -0
- package/dist/ui/switch/switch.types.d.ts +59 -0
- package/dist/ui/tabs/index.d.ts +10 -0
- package/dist/ui/tabs/tab.d.ts +43 -0
- package/dist/ui/tabs/tabs-content.d.ts +36 -0
- package/dist/ui/tabs/tabs-list.d.ts +40 -0
- package/dist/ui/tabs/tabs.d.ts +60 -0
- package/dist/ui/tabs/tabs.tokens.d.ts +94 -0
- package/dist/ui/tabs/tabs.types.d.ts +172 -0
- package/dist/ui/text-field/index.d.ts +11 -0
- package/dist/ui/text-field/subcomponents/active-indicator.d.ts +24 -0
- package/dist/ui/text-field/subcomponents/floating-label.d.ts +43 -0
- package/dist/ui/text-field/subcomponents/leading-icon.d.ts +23 -0
- package/dist/ui/text-field/subcomponents/outline-container.d.ts +42 -0
- package/dist/ui/text-field/subcomponents/prefix-suffix.d.ts +24 -0
- package/dist/ui/text-field/subcomponents/supporting-text.d.ts +37 -0
- package/dist/ui/text-field/subcomponents/trailing-icon.d.ts +41 -0
- package/dist/ui/text-field/text-field.d.ts +49 -0
- package/dist/ui/text-field/text-field.tokens.d.ts +76 -0
- package/dist/ui/text-field/text-field.types.d.ts +126 -0
- package/dist/ui/theme-provider/index.d.ts +18 -0
- package/dist/ui/toc.d.ts +74 -0
- package/dist/ui/tooltip/index.d.ts +8 -0
- package/dist/ui/tooltip/plain-tooltip.d.ts +2 -0
- package/dist/ui/tooltip/rich-tooltip.d.ts +2 -0
- package/dist/ui/tooltip/tooltip-box.d.ts +2 -0
- package/dist/ui/tooltip/tooltip-caret-shape.d.ts +9 -0
- package/dist/ui/tooltip/tooltip.tokens.d.ts +26 -0
- package/dist/ui/tooltip/tooltip.types.d.ts +56 -0
- package/dist/ui/tooltip/use-tooltip-position.d.ts +8 -0
- package/dist/ui/tooltip/use-tooltip-state.d.ts +2 -0
- package/dist/ui/typography/index.d.ts +16 -0
- package/dist/ui/typography/type-scale-tokens.d.ts +162 -0
- package/dist/ui/typography/typography-key-tokens.d.ts +40 -0
- package/dist/ui/typography/typography-tokens.d.ts +220 -0
- package/dist/ui/typography/typography.d.ts +265 -0
- package/package.json +80 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file text-field.types.ts
|
|
3
|
+
* TypeScript interfaces and types for TextField MD3 Expressive component.
|
|
4
|
+
* @see https://m3.material.io/components/text-fields/overview
|
|
5
|
+
*/
|
|
6
|
+
import type * as React from "react";
|
|
7
|
+
export type TextFieldVariant = "filled" | "outlined";
|
|
8
|
+
export type TextFieldInputType = "text" | "email" | "number" | "password" | "search" | "tel" | "url" | "textarea";
|
|
9
|
+
export type TextFieldTrailingIconMode = "none" | "clear" | "password-toggle" | "custom";
|
|
10
|
+
/**
|
|
11
|
+
* Imperative handle exposed via forwardRef.
|
|
12
|
+
* Allows parent components to programmatically control the text field.
|
|
13
|
+
*/
|
|
14
|
+
export interface TextFieldHandle {
|
|
15
|
+
/** Focuses the input element. */
|
|
16
|
+
focus(): void;
|
|
17
|
+
/** Blurs the input element. */
|
|
18
|
+
blur(): void;
|
|
19
|
+
/** Selects all text in the input. */
|
|
20
|
+
select(): void;
|
|
21
|
+
/** Clears the current value and fires onChange with empty string. */
|
|
22
|
+
clear(): void;
|
|
23
|
+
/** Sets a custom validation message on the native input. */
|
|
24
|
+
setCustomValidity(message: string): void;
|
|
25
|
+
/** Returns true if the input is valid. Does not show validation UI. */
|
|
26
|
+
checkValidity(): boolean;
|
|
27
|
+
/** Returns true if the input is valid. Shows validation UI if invalid. */
|
|
28
|
+
reportValidity(): boolean;
|
|
29
|
+
/** Returns the current value string. */
|
|
30
|
+
getValue(): string;
|
|
31
|
+
/** Returns the underlying input or textarea element. */
|
|
32
|
+
getInputElement(): HTMLInputElement | HTMLTextAreaElement | null;
|
|
33
|
+
}
|
|
34
|
+
export interface TextFieldProps {
|
|
35
|
+
/** Filled or outlined variant. @default 'filled' */
|
|
36
|
+
variant?: TextFieldVariant;
|
|
37
|
+
/** Floating label text. Also used as accessible name when no aria-label is set. */
|
|
38
|
+
label?: string;
|
|
39
|
+
/** Controlled value. Use with onChange for controlled mode. */
|
|
40
|
+
value?: string;
|
|
41
|
+
/** Initial value for uncontrolled mode. */
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
/** Fires when value changes. Receives new value string and native event. */
|
|
44
|
+
onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
45
|
+
/** Input type. Use 'textarea' for multi-line input. @default 'text' */
|
|
46
|
+
type?: TextFieldInputType;
|
|
47
|
+
/** Placeholder text — shown only when no label OR label is floated. */
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
id?: string;
|
|
51
|
+
autoComplete?: string;
|
|
52
|
+
inputMode?: React.HTMLAttributes<HTMLInputElement>["inputMode"];
|
|
53
|
+
/** Number of rows for textarea type. @default 2 */
|
|
54
|
+
rows?: number;
|
|
55
|
+
/** Number of columns for textarea type. @default 20 */
|
|
56
|
+
cols?: number;
|
|
57
|
+
/** Whether the textarea should automatically resize to fit its content. @default false */
|
|
58
|
+
autoResize?: boolean;
|
|
59
|
+
/** Maximum number of rows when autoResize is true. */
|
|
60
|
+
maxRows?: number;
|
|
61
|
+
/** CSS direction override for input text. */
|
|
62
|
+
textDirection?: "ltr" | "rtl" | "";
|
|
63
|
+
/** Marks field as required. Shows asterisk on label. */
|
|
64
|
+
required?: boolean;
|
|
65
|
+
/** Hides the asterisk even when required=true. */
|
|
66
|
+
noAsterisk?: boolean;
|
|
67
|
+
/** Manual error override — forces error visual state. */
|
|
68
|
+
error?: boolean;
|
|
69
|
+
/** Error message shown below the field (replaces supportingText). */
|
|
70
|
+
errorText?: string;
|
|
71
|
+
minLength?: number;
|
|
72
|
+
/** When set, enables character counter display. */
|
|
73
|
+
maxLength?: number;
|
|
74
|
+
min?: string;
|
|
75
|
+
max?: string;
|
|
76
|
+
step?: string;
|
|
77
|
+
pattern?: string;
|
|
78
|
+
/** For type="email" — allows multiple email addresses. */
|
|
79
|
+
multiple?: boolean;
|
|
80
|
+
/** Helper text shown below the field. Replaced by errorText when in error state. */
|
|
81
|
+
supportingText?: string;
|
|
82
|
+
/** Text displayed before the input value (e.g., "$"). */
|
|
83
|
+
prefixText?: string;
|
|
84
|
+
/** Text displayed after the input value (e.g., ".00"). */
|
|
85
|
+
suffixText?: string;
|
|
86
|
+
/** Icon node for the leading slot. Should be 24×24px. */
|
|
87
|
+
leadingIcon?: React.ReactNode;
|
|
88
|
+
/** Custom trailing icon node. Used when trailingIconMode='custom'. */
|
|
89
|
+
trailingIcon?: React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* Built-in trailing icon behavior.
|
|
92
|
+
* - 'none' — no trailing icon
|
|
93
|
+
* - 'clear' — ✕ button, clears value when clicked
|
|
94
|
+
* - 'password-toggle' — eye icon, toggles password visibility
|
|
95
|
+
* - 'custom' — uses trailingIcon prop
|
|
96
|
+
* @default 'none'
|
|
97
|
+
*/
|
|
98
|
+
trailingIconMode?: TextFieldTrailingIconMode;
|
|
99
|
+
disabled?: boolean;
|
|
100
|
+
readOnly?: boolean;
|
|
101
|
+
/** Hides spinner arrows on type="number". */
|
|
102
|
+
noSpinner?: boolean;
|
|
103
|
+
form?: string;
|
|
104
|
+
"aria-label"?: string;
|
|
105
|
+
"aria-describedby"?: string;
|
|
106
|
+
"aria-labelledby"?: string;
|
|
107
|
+
/** Extra class applied to the root wrapper element. */
|
|
108
|
+
className?: string;
|
|
109
|
+
/** Makes the component fill its container width. */
|
|
110
|
+
fullWidth?: boolean;
|
|
111
|
+
/** Dense variant — reduced height (48px instead of 56px). */
|
|
112
|
+
dense?: boolean;
|
|
113
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
114
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
115
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
116
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
117
|
+
ref?: React.Ref<TextFieldHandle>;
|
|
118
|
+
/**
|
|
119
|
+
* Controls when the scrollbars are visible when type="textarea".
|
|
120
|
+
* - `hover`: Show on hover (default)
|
|
121
|
+
* - `scroll`: Show only while scrolling
|
|
122
|
+
* - `always`: Always visible
|
|
123
|
+
* - `none`: Never visible
|
|
124
|
+
*/
|
|
125
|
+
scrollAreaType?: "hover" | "scroll" | "always" | "none";
|
|
126
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ThemeMode } from "../../lib/theme-utils";
|
|
3
|
+
interface ThemeContextValue {
|
|
4
|
+
sourceColor: string;
|
|
5
|
+
setSourceColor: (color: string) => void;
|
|
6
|
+
mode: ThemeMode;
|
|
7
|
+
setMode: (mode: ThemeMode) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface MD3ThemeProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
sourceColor?: string;
|
|
12
|
+
defaultMode?: ThemeMode;
|
|
13
|
+
persistToLocalStorage?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function MD3ThemeProvider({ children, sourceColor: initialSourceColor, defaultMode, persistToLocalStorage, }: MD3ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function useTheme(): ThemeContextValue;
|
|
17
|
+
export declare function useThemeMode(): Pick<ThemeContextValue, "mode" | "setMode">;
|
|
18
|
+
export {};
|
package/dist/ui/toc.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file toc.tsx
|
|
3
|
+
*
|
|
4
|
+
* Table of Contents component for long-form documentation pages.
|
|
5
|
+
*
|
|
6
|
+
* Uses `IntersectionObserver` to track which section heading is currently in the
|
|
7
|
+
* viewport and highlights the corresponding link. Smooth-scrolls to the target
|
|
8
|
+
* when a link is clicked (respecting the browser's `prefers-reduced-motion`
|
|
9
|
+
* media query via the native `scrollIntoView` API).
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - SSR-safe: `IntersectionObserver` usage is guarded by a `typeof` check.
|
|
13
|
+
* - The observer `rootMargin` is tuned for documentation layout with a fixed header
|
|
14
|
+
* (~100px) and early deactivation (~80% from bottom) so the active item changes
|
|
15
|
+
* before the section scrolls off-screen.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* A single entry in the Table of Contents.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const items: ToCItem[] = [
|
|
23
|
+
* { id: "installation", label: "Installation" },
|
|
24
|
+
* { id: "usage", label: "Usage" },
|
|
25
|
+
* ];
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface ToCItem {
|
|
29
|
+
/** The DOM `id` attribute of the corresponding section heading. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Human-readable label shown in the ToC. */
|
|
32
|
+
label: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props for the `TableOfContents` component.
|
|
36
|
+
*/
|
|
37
|
+
export interface TableOfContentsProps {
|
|
38
|
+
/**
|
|
39
|
+
* Ordered list of section items to display.
|
|
40
|
+
* Each item must have a matching DOM element with the same `id`.
|
|
41
|
+
*/
|
|
42
|
+
items: ToCItem[];
|
|
43
|
+
/**
|
|
44
|
+
* Additional CSS classes applied to the root `<nav>` element.
|
|
45
|
+
* Use this to control positioning (e.g. sticky, fixed) from the consumer.
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Table of Contents sidebar component.
|
|
51
|
+
*
|
|
52
|
+
* Renders a `<nav>` sidebar with links to page sections. Tracks the active
|
|
53
|
+
* section using `IntersectionObserver` and applies active styles to the
|
|
54
|
+
* current link.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* - Visible only on `xl` screens (`hidden xl:block` — sticky sidebar).
|
|
58
|
+
* - The `aria-current` attribute is set on the active link for screen readers.
|
|
59
|
+
* - Click scroll is smooth: `scrollIntoView({ behavior: "smooth" })`.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const toc: ToCItem[] = [
|
|
64
|
+
* { id: "overview", label: "Overview" },
|
|
65
|
+
* { id: "props", label: "Props" },
|
|
66
|
+
* { id: "examples", label: "Examples" },
|
|
67
|
+
* ];
|
|
68
|
+
*
|
|
69
|
+
* <TableOfContents items={toc} />
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @see https://m3.material.io/foundations/content-design/navigation
|
|
73
|
+
*/
|
|
74
|
+
export declare function TableOfContents({ items, className }: TableOfContentsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { PlainTooltip } from "./plain-tooltip";
|
|
2
|
+
export { RichTooltip } from "./rich-tooltip";
|
|
3
|
+
export * from "./tooltip.tokens";
|
|
4
|
+
export * from "./tooltip.types";
|
|
5
|
+
export { TooltipBox } from "./tooltip-box";
|
|
6
|
+
export { TooltipCaretShape } from "./tooltip-caret-shape";
|
|
7
|
+
export { useTooltipPosition } from "./use-tooltip-position";
|
|
8
|
+
export { useTooltipState } from "./use-tooltip-state";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { TooltipBoxProps } from "./tooltip.types";
|
|
2
|
+
export declare function TooltipBox({ children, tooltip, placement, trigger, state: controlledState, spacingFromAnchor, disabled, className, showDelay, hideDelay, "aria-label": ariaLabel, }: TooltipBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TooltipCaretProps {
|
|
2
|
+
side: "top" | "bottom" | "left" | "right";
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
customPath?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function TooltipCaretShape({ side, width, height, color, customPath, className, }: TooltipCaretProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const TooltipTokens: {
|
|
2
|
+
readonly PlainTooltip: {
|
|
3
|
+
readonly containerColor: "var(--md-sys-color-inverse-surface)";
|
|
4
|
+
readonly textColor: "var(--md-sys-color-inverse-on-surface)";
|
|
5
|
+
readonly shape: "rounded-[4px]";
|
|
6
|
+
readonly font: "text-[12px] font-normal tracking-[0.4px] leading-[16px]";
|
|
7
|
+
readonly height: "min-h-6";
|
|
8
|
+
readonly padding: "px-2 py-1";
|
|
9
|
+
readonly maxWidth: "max-w-50";
|
|
10
|
+
};
|
|
11
|
+
readonly RichTooltip: {
|
|
12
|
+
readonly containerColor: "var(--md-sys-color-surface-container)";
|
|
13
|
+
readonly elevation: "shadow-md";
|
|
14
|
+
readonly shape: "rounded-[12px]";
|
|
15
|
+
readonly paddingTop: "pt-3";
|
|
16
|
+
readonly paddingBottom: "pb-2";
|
|
17
|
+
readonly paddingX: "px-4";
|
|
18
|
+
readonly maxWidth: "max-w-80";
|
|
19
|
+
readonly subheadColor: "var(--md-sys-color-on-surface-variant)";
|
|
20
|
+
readonly subheadFont: "text-[14px] font-medium leading-[20px]";
|
|
21
|
+
readonly bodyColor: "var(--md-sys-color-on-surface-variant)";
|
|
22
|
+
readonly bodyFont: "text-[14px] font-normal leading-[20px]";
|
|
23
|
+
readonly actionColor: "var(--md-sys-color-primary)";
|
|
24
|
+
readonly actionFont: "text-[14px] font-medium leading-[20px]";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export type TooltipPlacement = "top" | "bottom" | "left" | "right" | "auto";
|
|
3
|
+
export type TooltipTrigger = "hover" | "focus" | "click" | "long-press" | "manual";
|
|
4
|
+
export interface TooltipStateConfig {
|
|
5
|
+
initialVisible?: boolean;
|
|
6
|
+
isPersistent?: boolean;
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TooltipState {
|
|
10
|
+
isVisible: boolean;
|
|
11
|
+
show: () => void;
|
|
12
|
+
dismiss: () => void;
|
|
13
|
+
}
|
|
14
|
+
export interface CaretConfig {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
customPath?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface TooltipBoxProps {
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
tooltip: React.ReactNode;
|
|
23
|
+
placement?: TooltipPlacement;
|
|
24
|
+
trigger?: TooltipTrigger | TooltipTrigger[];
|
|
25
|
+
state?: TooltipState;
|
|
26
|
+
spacingFromAnchor?: number;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
showDelay?: number;
|
|
30
|
+
hideDelay?: number;
|
|
31
|
+
"aria-label"?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface PlainTooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
caret?: CaretConfig | null;
|
|
36
|
+
maxWidth?: number;
|
|
37
|
+
className?: string;
|
|
38
|
+
containerColor?: string;
|
|
39
|
+
textColor?: string;
|
|
40
|
+
"data-side"?: "top" | "bottom" | "left" | "right";
|
|
41
|
+
}
|
|
42
|
+
export interface RichTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
title?: React.ReactNode;
|
|
45
|
+
action?: React.ReactNode;
|
|
46
|
+
caret?: CaretConfig | null;
|
|
47
|
+
maxWidth?: number;
|
|
48
|
+
className?: string;
|
|
49
|
+
colors?: {
|
|
50
|
+
container?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
body?: string;
|
|
53
|
+
action?: string;
|
|
54
|
+
};
|
|
55
|
+
"data-side"?: "top" | "bottom" | "left" | "right";
|
|
56
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TooltipPlacement } from "./tooltip.types";
|
|
2
|
+
interface PositionState {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
actualSide: "top" | "bottom" | "left" | "right";
|
|
6
|
+
}
|
|
7
|
+
export declare function useTooltipPosition(anchorRef: React.RefObject<HTMLElement | null>, tooltipRef: React.RefObject<HTMLElement | null>, placement: TooltipPlacement, spacing: number, isVisible: boolean): PositionState;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Public API for the MD3 Expressive Typography module.
|
|
4
|
+
*
|
|
5
|
+
* Re-exports all types, classes, constants, and hooks required to integrate
|
|
6
|
+
* the typography system into a React application.
|
|
7
|
+
*
|
|
8
|
+
* @module typography
|
|
9
|
+
*/
|
|
10
|
+
export type { TypeScaleTokensType } from "./type-scale-tokens";
|
|
11
|
+
export { TypeScaleTokens } from "./type-scale-tokens";
|
|
12
|
+
export type { TypographyProviderProps } from "./typography";
|
|
13
|
+
export { Typography, TypographyContext, TypographyProvider, useTypography, } from "./typography";
|
|
14
|
+
export { TypographyKeyTokens } from "./typography-key-tokens";
|
|
15
|
+
export type { FontVariationAxes, TextStyle, TypographyTokensOptions, } from "./typography-tokens";
|
|
16
|
+
export { DEFAULT_FONT_VARIATION_AXES, MD3_EXPRESSIVE_FONT_VARIATION, serializeFontVariationAxes, TypographyTokens, } from "./typography-tokens";
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScaleTokens - MD3 Expressive Typography Physical Tokens
|
|
3
|
+
*
|
|
4
|
+
* Port of androidx.compose.material3.tokens.TypeScaleTokens
|
|
5
|
+
* Adapted for Web with Google Sans Flex Variable Font (ROND axis = 100).
|
|
6
|
+
*
|
|
7
|
+
* All font sizes use rem units based on 14px root (project default).
|
|
8
|
+
* Reference: Material Design 3 Type Scale Tokens spec.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TypeScaleTokens: {
|
|
11
|
+
readonly DisplayLargeFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
12
|
+
readonly DisplayLargeWeight: 400;
|
|
13
|
+
readonly DisplayLargeSize: "3.571rem";
|
|
14
|
+
readonly DisplayLargeLineHeight: "4rem";
|
|
15
|
+
readonly DisplayLargeTracking: "-0.25px";
|
|
16
|
+
readonly DisplayMediumFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
17
|
+
readonly DisplayMediumWeight: 400;
|
|
18
|
+
readonly DisplayMediumSize: "2.857rem";
|
|
19
|
+
readonly DisplayMediumLineHeight: "3.286rem";
|
|
20
|
+
readonly DisplayMediumTracking: "0px";
|
|
21
|
+
readonly DisplaySmallFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
22
|
+
readonly DisplaySmallWeight: 400;
|
|
23
|
+
readonly DisplaySmallSize: "2.571rem";
|
|
24
|
+
readonly DisplaySmallLineHeight: "3.143rem";
|
|
25
|
+
readonly DisplaySmallTracking: "0px";
|
|
26
|
+
readonly HeadlineLargeFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
27
|
+
readonly HeadlineLargeWeight: 400;
|
|
28
|
+
readonly HeadlineLargeSize: "2.286rem";
|
|
29
|
+
readonly HeadlineLargeLineHeight: "2.857rem";
|
|
30
|
+
readonly HeadlineLargeTracking: "0px";
|
|
31
|
+
readonly HeadlineMediumFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
32
|
+
readonly HeadlineMediumWeight: 400;
|
|
33
|
+
readonly HeadlineMediumSize: "2rem";
|
|
34
|
+
readonly HeadlineMediumLineHeight: "2.571rem";
|
|
35
|
+
readonly HeadlineMediumTracking: "0px";
|
|
36
|
+
readonly HeadlineSmallFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
37
|
+
readonly HeadlineSmallWeight: 400;
|
|
38
|
+
readonly HeadlineSmallSize: "1.714rem";
|
|
39
|
+
readonly HeadlineSmallLineHeight: "2.286rem";
|
|
40
|
+
readonly HeadlineSmallTracking: "0px";
|
|
41
|
+
readonly TitleLargeFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
42
|
+
readonly TitleLargeWeight: 400;
|
|
43
|
+
readonly TitleLargeSize: "1.571rem";
|
|
44
|
+
readonly TitleLargeLineHeight: "2rem";
|
|
45
|
+
readonly TitleLargeTracking: "0px";
|
|
46
|
+
readonly TitleMediumFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
47
|
+
readonly TitleMediumWeight: 500;
|
|
48
|
+
readonly TitleMediumSize: "1.143rem";
|
|
49
|
+
readonly TitleMediumLineHeight: "1.714rem";
|
|
50
|
+
readonly TitleMediumTracking: "0.15px";
|
|
51
|
+
readonly TitleSmallFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
52
|
+
readonly TitleSmallWeight: 500;
|
|
53
|
+
readonly TitleSmallSize: "1rem";
|
|
54
|
+
readonly TitleSmallLineHeight: "1.429rem";
|
|
55
|
+
readonly TitleSmallTracking: "0.1px";
|
|
56
|
+
readonly BodyLargeFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
57
|
+
readonly BodyLargeWeight: 400;
|
|
58
|
+
readonly BodyLargeSize: "1.143rem";
|
|
59
|
+
readonly BodyLargeLineHeight: "1.714rem";
|
|
60
|
+
readonly BodyLargeTracking: "0.5px";
|
|
61
|
+
readonly BodyMediumFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
62
|
+
readonly BodyMediumWeight: 400;
|
|
63
|
+
readonly BodyMediumSize: "1rem";
|
|
64
|
+
readonly BodyMediumLineHeight: "1.429rem";
|
|
65
|
+
readonly BodyMediumTracking: "0.25px";
|
|
66
|
+
readonly BodySmallFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
67
|
+
readonly BodySmallWeight: 400;
|
|
68
|
+
readonly BodySmallSize: "0.857rem";
|
|
69
|
+
readonly BodySmallLineHeight: "1.143rem";
|
|
70
|
+
readonly BodySmallTracking: "0.4px";
|
|
71
|
+
readonly LabelLargeFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
72
|
+
readonly LabelLargeWeight: 500;
|
|
73
|
+
readonly LabelLargeSize: "1rem";
|
|
74
|
+
readonly LabelLargeLineHeight: "1.429rem";
|
|
75
|
+
readonly LabelLargeTracking: "0.1px";
|
|
76
|
+
readonly LabelMediumFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
77
|
+
readonly LabelMediumWeight: 500;
|
|
78
|
+
readonly LabelMediumSize: "0.857rem";
|
|
79
|
+
readonly LabelMediumLineHeight: "1.143rem";
|
|
80
|
+
readonly LabelMediumTracking: "0.5px";
|
|
81
|
+
readonly LabelSmallFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
82
|
+
readonly LabelSmallWeight: 500;
|
|
83
|
+
readonly LabelSmallSize: "0.786rem";
|
|
84
|
+
readonly LabelSmallLineHeight: "1.143rem";
|
|
85
|
+
readonly LabelSmallTracking: "0.5px";
|
|
86
|
+
readonly DisplayLargeEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
87
|
+
readonly DisplayLargeEmphasizedWeight: 800;
|
|
88
|
+
readonly DisplayLargeEmphasizedSize: "3.571rem";
|
|
89
|
+
readonly DisplayLargeEmphasizedLineHeight: "4rem";
|
|
90
|
+
readonly DisplayLargeEmphasizedTracking: "-0.25px";
|
|
91
|
+
readonly DisplayMediumEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
92
|
+
readonly DisplayMediumEmphasizedWeight: 800;
|
|
93
|
+
readonly DisplayMediumEmphasizedSize: "2.857rem";
|
|
94
|
+
readonly DisplayMediumEmphasizedLineHeight: "3.286rem";
|
|
95
|
+
readonly DisplayMediumEmphasizedTracking: "0px";
|
|
96
|
+
readonly DisplaySmallEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
97
|
+
readonly DisplaySmallEmphasizedWeight: 800;
|
|
98
|
+
readonly DisplaySmallEmphasizedSize: "2.571rem";
|
|
99
|
+
readonly DisplaySmallEmphasizedLineHeight: "3.143rem";
|
|
100
|
+
readonly DisplaySmallEmphasizedTracking: "0px";
|
|
101
|
+
readonly HeadlineLargeEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
102
|
+
readonly HeadlineLargeEmphasizedWeight: 800;
|
|
103
|
+
readonly HeadlineLargeEmphasizedSize: "2.286rem";
|
|
104
|
+
readonly HeadlineLargeEmphasizedLineHeight: "2.857rem";
|
|
105
|
+
readonly HeadlineLargeEmphasizedTracking: "0px";
|
|
106
|
+
readonly HeadlineMediumEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
107
|
+
readonly HeadlineMediumEmphasizedWeight: 800;
|
|
108
|
+
readonly HeadlineMediumEmphasizedSize: "2rem";
|
|
109
|
+
readonly HeadlineMediumEmphasizedLineHeight: "2.571rem";
|
|
110
|
+
readonly HeadlineMediumEmphasizedTracking: "0px";
|
|
111
|
+
readonly HeadlineSmallEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
112
|
+
readonly HeadlineSmallEmphasizedWeight: 800;
|
|
113
|
+
readonly HeadlineSmallEmphasizedSize: "1.714rem";
|
|
114
|
+
readonly HeadlineSmallEmphasizedLineHeight: "2.286rem";
|
|
115
|
+
readonly HeadlineSmallEmphasizedTracking: "0px";
|
|
116
|
+
readonly TitleLargeEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
117
|
+
readonly TitleLargeEmphasizedWeight: 700;
|
|
118
|
+
readonly TitleLargeEmphasizedSize: "1.571rem";
|
|
119
|
+
readonly TitleLargeEmphasizedLineHeight: "2rem";
|
|
120
|
+
readonly TitleLargeEmphasizedTracking: "0px";
|
|
121
|
+
readonly TitleMediumEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
122
|
+
readonly TitleMediumEmphasizedWeight: 700;
|
|
123
|
+
readonly TitleMediumEmphasizedSize: "1.143rem";
|
|
124
|
+
readonly TitleMediumEmphasizedLineHeight: "1.714rem";
|
|
125
|
+
readonly TitleMediumEmphasizedTracking: "0.15px";
|
|
126
|
+
readonly TitleSmallEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
127
|
+
readonly TitleSmallEmphasizedWeight: 700;
|
|
128
|
+
readonly TitleSmallEmphasizedSize: "1rem";
|
|
129
|
+
readonly TitleSmallEmphasizedLineHeight: "1.429rem";
|
|
130
|
+
readonly TitleSmallEmphasizedTracking: "0.1px";
|
|
131
|
+
readonly BodyLargeEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
132
|
+
readonly BodyLargeEmphasizedWeight: 700;
|
|
133
|
+
readonly BodyLargeEmphasizedSize: "1.143rem";
|
|
134
|
+
readonly BodyLargeEmphasizedLineHeight: "1.714rem";
|
|
135
|
+
readonly BodyLargeEmphasizedTracking: "0.5px";
|
|
136
|
+
readonly BodyMediumEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
137
|
+
readonly BodyMediumEmphasizedWeight: 700;
|
|
138
|
+
readonly BodyMediumEmphasizedSize: "1rem";
|
|
139
|
+
readonly BodyMediumEmphasizedLineHeight: "1.429rem";
|
|
140
|
+
readonly BodyMediumEmphasizedTracking: "0.25px";
|
|
141
|
+
readonly BodySmallEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
142
|
+
readonly BodySmallEmphasizedWeight: 700;
|
|
143
|
+
readonly BodySmallEmphasizedSize: "0.857rem";
|
|
144
|
+
readonly BodySmallEmphasizedLineHeight: "1.143rem";
|
|
145
|
+
readonly BodySmallEmphasizedTracking: "0.4px";
|
|
146
|
+
readonly LabelLargeEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
147
|
+
readonly LabelLargeEmphasizedWeight: 800;
|
|
148
|
+
readonly LabelLargeEmphasizedSize: "1rem";
|
|
149
|
+
readonly LabelLargeEmphasizedLineHeight: "1.429rem";
|
|
150
|
+
readonly LabelLargeEmphasizedTracking: "0.1px";
|
|
151
|
+
readonly LabelMediumEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
152
|
+
readonly LabelMediumEmphasizedWeight: 800;
|
|
153
|
+
readonly LabelMediumEmphasizedSize: "0.857rem";
|
|
154
|
+
readonly LabelMediumEmphasizedLineHeight: "1.143rem";
|
|
155
|
+
readonly LabelMediumEmphasizedTracking: "0.5px";
|
|
156
|
+
readonly LabelSmallEmphasizedFont: "'Google Sans Flex', system-ui, sans-serif";
|
|
157
|
+
readonly LabelSmallEmphasizedWeight: 800;
|
|
158
|
+
readonly LabelSmallEmphasizedSize: "0.786rem";
|
|
159
|
+
readonly LabelSmallEmphasizedLineHeight: "1.143rem";
|
|
160
|
+
readonly LabelSmallEmphasizedTracking: "0.5px";
|
|
161
|
+
};
|
|
162
|
+
export type TypeScaleTokensType = typeof TypeScaleTokens;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypographyKeyTokens - MD3 Expressive Typography Key Tokens Enum
|
|
3
|
+
*
|
|
4
|
+
* Port of androidx.compose.material3.tokens.TypographyKeyTokens (Kotlin enum class).
|
|
5
|
+
* Used to reference a specific TextStyle via Typography.fromToken().
|
|
6
|
+
*
|
|
7
|
+
* Contains 30 keys: 15 baseline + 15 emphasized (MD3 Expressive).
|
|
8
|
+
*/
|
|
9
|
+
export declare enum TypographyKeyTokens {
|
|
10
|
+
BodyLarge = "BodyLarge",
|
|
11
|
+
BodyMedium = "BodyMedium",
|
|
12
|
+
BodySmall = "BodySmall",
|
|
13
|
+
DisplayLarge = "DisplayLarge",
|
|
14
|
+
DisplayMedium = "DisplayMedium",
|
|
15
|
+
DisplaySmall = "DisplaySmall",
|
|
16
|
+
HeadlineLarge = "HeadlineLarge",
|
|
17
|
+
HeadlineMedium = "HeadlineMedium",
|
|
18
|
+
HeadlineSmall = "HeadlineSmall",
|
|
19
|
+
LabelLarge = "LabelLarge",
|
|
20
|
+
LabelMedium = "LabelMedium",
|
|
21
|
+
LabelSmall = "LabelSmall",
|
|
22
|
+
TitleLarge = "TitleLarge",
|
|
23
|
+
TitleMedium = "TitleMedium",
|
|
24
|
+
TitleSmall = "TitleSmall",
|
|
25
|
+
BodyLargeEmphasized = "BodyLargeEmphasized",
|
|
26
|
+
BodyMediumEmphasized = "BodyMediumEmphasized",
|
|
27
|
+
BodySmallEmphasized = "BodySmallEmphasized",
|
|
28
|
+
DisplayLargeEmphasized = "DisplayLargeEmphasized",
|
|
29
|
+
DisplayMediumEmphasized = "DisplayMediumEmphasized",
|
|
30
|
+
DisplaySmallEmphasized = "DisplaySmallEmphasized",
|
|
31
|
+
HeadlineLargeEmphasized = "HeadlineLargeEmphasized",
|
|
32
|
+
HeadlineMediumEmphasized = "HeadlineMediumEmphasized",
|
|
33
|
+
HeadlineSmallEmphasized = "HeadlineSmallEmphasized",
|
|
34
|
+
LabelLargeEmphasized = "LabelLargeEmphasized",
|
|
35
|
+
LabelMediumEmphasized = "LabelMediumEmphasized",
|
|
36
|
+
LabelSmallEmphasized = "LabelSmallEmphasized",
|
|
37
|
+
TitleLargeEmphasized = "TitleLargeEmphasized",
|
|
38
|
+
TitleMediumEmphasized = "TitleMediumEmphasized",
|
|
39
|
+
TitleSmallEmphasized = "TitleSmallEmphasized"
|
|
40
|
+
}
|