@ufoui/core 0.0.1
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/LICENSE +150 -0
- package/README.md +37 -0
- package/TRADEMARK.md +10 -0
- package/components/article/article.d.ts +25 -0
- package/components/aside/aside.d.ts +27 -0
- package/components/avatar/avatar.d.ts +35 -0
- package/components/badge/badge.d.ts +57 -0
- package/components/base/boxBase/boxBase.d.ts +126 -0
- package/components/base/buttonBase/buttonBase.d.ts +126 -0
- package/components/base/checkboxBase/checkboxBase.d.ts +124 -0
- package/components/base/dialogBase/dialog.d.ts +35 -0
- package/components/base/fieldBase/fieldBase.d.ts +50 -0
- package/components/base/inlineBase/inlineBase.d.ts +62 -0
- package/components/button/button.d.ts +24 -0
- package/components/card/card.d.ts +15 -0
- package/components/checkbox/checkbox.d.ts +31 -0
- package/components/chip/chip.d.ts +7 -0
- package/components/content/content.d.ts +28 -0
- package/components/dateInput/dateInput.d.ts +2 -0
- package/components/dateTimeInput/dateTimeInput.d.ts +2 -0
- package/components/dialog/dialogActions.d.ts +15 -0
- package/components/dialog/dialogContent.d.ts +9 -0
- package/components/dialog/dialogTitle.d.ts +16 -0
- package/components/div/div.d.ts +29 -0
- package/components/divider/divider.d.ts +70 -0
- package/components/divider/divider.guards.d.ts +15 -0
- package/components/emailInput/emailInput.d.ts +2 -0
- package/components/fab/fab.d.ts +29 -0
- package/components/fieldset/fieldset.d.ts +45 -0
- package/components/flex/flex.d.ts +36 -0
- package/components/footer/footer.d.ts +27 -0
- package/components/grid/grid.d.ts +38 -0
- package/components/header/header.d.ts +27 -0
- package/components/iconButton/iconButton.d.ts +27 -0
- package/components/listItem/listItem.d.ts +179 -0
- package/components/listItem/listItem.guards.d.ts +15 -0
- package/components/main/main.d.ts +27 -0
- package/components/menu/menu.d.ts +177 -0
- package/components/menu/menu.guards.d.ts +15 -0
- package/components/menuItem/menuItem.d.ts +179 -0
- package/components/menuItem/menuItem.guards.d.ts +15 -0
- package/components/nav/nav.d.ts +27 -0
- package/components/numberInput/numberInput.d.ts +2 -0
- package/components/option/option.d.ts +6 -0
- package/components/option/option.guards.d.ts +16 -0
- package/components/radio/radio.d.ts +31 -0
- package/components/radiogroup/radioGroup.d.ts +47 -0
- package/components/section/section.d.ts +27 -0
- package/components/select/select.d.ts +32 -0
- package/components/spinner/spinner.d.ts +7 -0
- package/components/switch/switch.d.ts +102 -0
- package/components/telInput/telInput.d.ts +2 -0
- package/components/textField/textField.d.ts +9 -0
- package/components/themeProvider/themeProvider.d.ts +54 -0
- package/components/timeInput/timeInput.d.ts +2 -0
- package/components/toggleButton/toggleButton.d.ts +6 -0
- package/components/tooltip/tooltip.d.ts +8 -0
- package/components/urlInput/urlInput.d.ts +2 -0
- package/context/fieldsetContext.d.ts +22 -0
- package/context/radioGroupContext.d.ts +28 -0
- package/context/themeContext.d.ts +61 -0
- package/hooks/useAnimate.d.ts +55 -0
- package/hooks/useClickOutside.d.ts +36 -0
- package/hooks/useEscapeHandler.d.ts +1 -0
- package/hooks/useFocusState.d.ts +16 -0
- package/hooks/useFocusVisible.d.ts +20 -0
- package/hooks/useTheme.d.ts +12 -0
- package/index.css +1 -0
- package/index.d.ts +53 -0
- package/index.mjs +3300 -0
- package/internal/inlineTooltip/inlineTooltip.d.ts +11 -0
- package/internal/inlineTooltip/inlineTooltip2.d.ts +10 -0
- package/internal/inlineTooltip/inlineTooltipManager.d.ts +12 -0
- package/package.json +38 -0
- package/types/index.d.ts +2 -0
- package/types/motion.d.ts +17 -0
- package/types/theme.d.ts +246 -0
- package/utils/calculateFloatingPosition.d.ts +68 -0
- package/utils/color.d.ts +415 -0
- package/utils/generateMaterialColors.d.ts +31 -0
- package/utils/generateSchemes.d.ts +32 -0
- package/utils/inputhMethod.d.ts +17 -0
- package/utils/utils.d.ts +202 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { default as React, HTMLProps, ReactNode } from 'react';
|
|
2
|
+
import { ElementDensity, ElementFocusEffect, ElementFont, ElementSelectedEffect, ElementShape, ElementTouchEffect } from '../utils';
|
|
3
|
+
import { MenuVariant } from '../menu/menu';
|
|
4
|
+
import { SurfaceColor } from '../../utils/color';
|
|
5
|
+
/**
|
|
6
|
+
* Visual variant of a MenuItem.
|
|
7
|
+
*
|
|
8
|
+
* Inherited from {@link MenuVariant}.
|
|
9
|
+
*
|
|
10
|
+
* @category MenuItem
|
|
11
|
+
*/
|
|
12
|
+
export type MenuItemVariant = MenuVariant;
|
|
13
|
+
/**
|
|
14
|
+
* Defines the behavioral type of a MenuItem.
|
|
15
|
+
*
|
|
16
|
+
* - `item` – simple action item
|
|
17
|
+
* - `checkbox` – toggleable multiple-selection item
|
|
18
|
+
* - `radio` – mutually exclusive selection item
|
|
19
|
+
* - `option` – selectable option item
|
|
20
|
+
*
|
|
21
|
+
* @category MenuItem
|
|
22
|
+
*/
|
|
23
|
+
export type MenuItemType = 'item' | 'checkbox' | 'radio' | 'option';
|
|
24
|
+
/**
|
|
25
|
+
* Change event payload for selectable menu items
|
|
26
|
+
* (checkbox, radio and option).
|
|
27
|
+
*
|
|
28
|
+
* @category MenuItem
|
|
29
|
+
*/
|
|
30
|
+
export interface MenuItemChangeEvent {
|
|
31
|
+
/** Checkbox or radio checked state. */
|
|
32
|
+
checked?: boolean;
|
|
33
|
+
/** Item name identifier. */
|
|
34
|
+
name?: string;
|
|
35
|
+
/** Selection state for option items. */
|
|
36
|
+
selected?: boolean;
|
|
37
|
+
/** Item value identifier. */
|
|
38
|
+
value?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Props for the {@link MenuItem} component.
|
|
42
|
+
*
|
|
43
|
+
* @category MenuItem
|
|
44
|
+
*/
|
|
45
|
+
export interface MenuItemProps extends Omit<HTMLProps<HTMLDivElement>, 'ref' | 'onChange'> {
|
|
46
|
+
/** Marks item as active (roving focus). */
|
|
47
|
+
active?: boolean;
|
|
48
|
+
/** Badge content rendered at the end. */
|
|
49
|
+
badge?: ReactNode;
|
|
50
|
+
/** Checked state for checkbox or radio items. */
|
|
51
|
+
checked?: boolean;
|
|
52
|
+
/** Icon shown when item is checked. */
|
|
53
|
+
checkedIcon?: ReactNode;
|
|
54
|
+
/** Item content or nested submenu. */
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
/** Base surface color of the item. */
|
|
57
|
+
color?: SurfaceColor;
|
|
58
|
+
/** Density preset controlling spacing. */
|
|
59
|
+
density?: ElementDensity;
|
|
60
|
+
/** Secondary description text. */
|
|
61
|
+
description?: string;
|
|
62
|
+
/** Text color of the description. */
|
|
63
|
+
descriptionColor?: SurfaceColor;
|
|
64
|
+
/** Font token applied to the description text. */
|
|
65
|
+
descriptionFont?: ElementFont;
|
|
66
|
+
/** Disables interactions and focus. */
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
/** Icon rendered at the end (alias for `trailing`). */
|
|
69
|
+
endIcon?: ReactNode;
|
|
70
|
+
/** Whether a nested submenu is expanded. */
|
|
71
|
+
expanded?: boolean;
|
|
72
|
+
/** Reserves leading slot even without an icon. */
|
|
73
|
+
fixedLeading?: boolean;
|
|
74
|
+
/** Visual focus effects applied when active. */
|
|
75
|
+
focusEffects?: ElementFocusEffect[];
|
|
76
|
+
/** Forces focus-visible styling. */
|
|
77
|
+
focusVisible?: boolean;
|
|
78
|
+
/** Alias for labelFont. */
|
|
79
|
+
font?: ElementFont;
|
|
80
|
+
/** Enables horizontal layout mode. */
|
|
81
|
+
horizontal?: boolean;
|
|
82
|
+
/** Icon rendered at the start (alias for `leading`). */
|
|
83
|
+
icon?: ReactNode;
|
|
84
|
+
/** Primary label text. */
|
|
85
|
+
label?: string;
|
|
86
|
+
/** Text color of the label. */
|
|
87
|
+
labelColor?: SurfaceColor;
|
|
88
|
+
/** Font token applied to the label text. */
|
|
89
|
+
labelFont?: ElementFont;
|
|
90
|
+
/** Custom leading content. */
|
|
91
|
+
leading?: ReactNode;
|
|
92
|
+
/** Item name used in change events. */
|
|
93
|
+
name?: string;
|
|
94
|
+
/** Change handler for checkbox, radio and option items. */
|
|
95
|
+
onChange?: (e: MenuItemChangeEvent) => void;
|
|
96
|
+
/** Click handler for action items. */
|
|
97
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
98
|
+
/** Selected state for option items. */
|
|
99
|
+
selected?: boolean;
|
|
100
|
+
/** Background color used when selected. */
|
|
101
|
+
selectedColor?: SurfaceColor;
|
|
102
|
+
/** Visual effects applied when selected. */
|
|
103
|
+
selectedEffects?: ElementSelectedEffect[];
|
|
104
|
+
/** Shape token applied to the item. */
|
|
105
|
+
shape?: ElementShape;
|
|
106
|
+
/** Keyboard shortcut label. */
|
|
107
|
+
shortcut?: string;
|
|
108
|
+
/** Text color of the shortcut label. */
|
|
109
|
+
shortcutColor?: SurfaceColor;
|
|
110
|
+
/** Font token applied to the shortcut text. */
|
|
111
|
+
shortcutFont?: ElementFont;
|
|
112
|
+
/** Overrides automatic text color. */
|
|
113
|
+
textColor?: SurfaceColor;
|
|
114
|
+
/** Touch and click feedback effects. */
|
|
115
|
+
touchEffects?: ElementTouchEffect[];
|
|
116
|
+
/** Custom trailing content. */
|
|
117
|
+
trailing?: ReactNode;
|
|
118
|
+
/** Item behavior type. */
|
|
119
|
+
type?: MenuItemType;
|
|
120
|
+
/** Icon shown when item is unchecked. */
|
|
121
|
+
uncheckedIcon?: ReactNode;
|
|
122
|
+
/** Item value used in change events. */
|
|
123
|
+
value?: string;
|
|
124
|
+
/** Visual variant inherited from Menu. */
|
|
125
|
+
variant?: MenuItemVariant;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Internal props injected by Menu.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
* @category MenuItem
|
|
132
|
+
*/
|
|
133
|
+
export interface MenuItemInternalProps {
|
|
134
|
+
/** Disables pointer and keyboard interactions. */
|
|
135
|
+
__interactionsDisabled?: boolean;
|
|
136
|
+
/** Item index inside the parent menu. */
|
|
137
|
+
__index?: number;
|
|
138
|
+
/** Index exposed for DOM queries. */
|
|
139
|
+
'data-menu-index'?: number;
|
|
140
|
+
/** ARIA role family inherited from parent container. */
|
|
141
|
+
roleFamily?: 'menu' | 'listbox' | 'command' | 'toolbar';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* **MenuItem** - single interactive item inside a {@link Menu}.
|
|
145
|
+
*
|
|
146
|
+
* Represents an action, checkbox, radio item or selectable option.
|
|
147
|
+
* Supports icons, badges, shortcuts, descriptions and nested submenus.
|
|
148
|
+
*
|
|
149
|
+
* Keyboard interaction and focus are handled by the parent Menu.
|
|
150
|
+
*
|
|
151
|
+
* @param props
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```tsx
|
|
155
|
+
* <MenuItem label="Open" onClick={handleOpen} />
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```tsx
|
|
160
|
+
* <MenuItem
|
|
161
|
+
* type="checkbox"
|
|
162
|
+
* label="Show grid"
|
|
163
|
+
* checked={enabled}
|
|
164
|
+
* onChange={() => setEnabled(v => !v)}
|
|
165
|
+
* />
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <MenuItem label="More">
|
|
171
|
+
* <Menu>
|
|
172
|
+
* <MenuItem label="Sub item" />
|
|
173
|
+
* </Menu>
|
|
174
|
+
* </MenuItem>
|
|
175
|
+
* ```
|
|
176
|
+
* @function
|
|
177
|
+
* @category MenuItem
|
|
178
|
+
*/
|
|
179
|
+
export declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & MenuItemInternalProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React, ReactElement } from 'react';
|
|
2
|
+
import { MenuItemInternalProps, MenuItemProps } from './menuItem';
|
|
3
|
+
export declare const IS_MENU_ITEM: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Type guard that checks whether a React node is a MenuItem component.
|
|
6
|
+
*
|
|
7
|
+
* Identifies MenuItem elements by the internal {@link IS_MENU_ITEM} symbol
|
|
8
|
+
* attached to the component type.
|
|
9
|
+
*
|
|
10
|
+
* @param el - React node to test.
|
|
11
|
+
* @returns `true` if the node is a MenuItem element.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function isMenuItem(el: React.ReactNode): el is ReactElement<MenuItemProps & MenuItemInternalProps>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BoxBaseProps } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link Nav}.
|
|
4
|
+
* Extends {@link BoxBaseProps} except for `elementClass` and `component`.
|
|
5
|
+
*
|
|
6
|
+
* @category Box
|
|
7
|
+
*/
|
|
8
|
+
export type NavProps = Omit<BoxBaseProps, 'elementClass' | 'component'>;
|
|
9
|
+
/**
|
|
10
|
+
* Semantic layout wrapper for the native `<nav>` element.
|
|
11
|
+
*
|
|
12
|
+
* Built on top of {@link BoxBase}, inheriting its layout and styling props.
|
|
13
|
+
* Defaults to a row layout (`direction="row"`) and applies
|
|
14
|
+
* the semantic UUI class `"uui-nav"`.
|
|
15
|
+
*
|
|
16
|
+
* Use for primary or secondary navigation menus.
|
|
17
|
+
*
|
|
18
|
+
* @function
|
|
19
|
+
* @param props - All layout and style props inherited from {@link BoxBase}.
|
|
20
|
+
* @example
|
|
21
|
+
* <Nav elevation={1} shape="rounded">
|
|
22
|
+
* <NavLink href="/">Home</NavLink>
|
|
23
|
+
* </Nav>
|
|
24
|
+
*
|
|
25
|
+
* @category Box
|
|
26
|
+
*/
|
|
27
|
+
export declare const Nav: import('react').ForwardRefExoticComponent<NavProps & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { MenuItemInternalProps, MenuItemProps } from '../core';
|
|
3
|
+
export interface OptionProps extends Omit<MenuItemProps, 'type' | 'checked'> {
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const Option: ForwardRefExoticComponent<OptionProps & MenuItemInternalProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React, ReactElement } from 'react';
|
|
2
|
+
import { OptionProps } from './option';
|
|
3
|
+
import { MenuItemInternalProps } from '../menuItem/menuItem';
|
|
4
|
+
export declare const IS_OPTION: unique symbol;
|
|
5
|
+
/**
|
|
6
|
+
* Type guard that checks whether a React node is an Option component.
|
|
7
|
+
*
|
|
8
|
+
* Identifies Option elements by the internal {@link IS_OPTION} symbol
|
|
9
|
+
* attached to the component type.
|
|
10
|
+
*
|
|
11
|
+
* @param el - React node to test.
|
|
12
|
+
* @returns `true` if the node is an Option element.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function isOption(el: React.ReactNode): el is ReactElement<OptionProps & MenuItemInternalProps>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CheckboxBaseProps } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Radio component.
|
|
4
|
+
*
|
|
5
|
+
* Extends {@link CheckboxBaseProps} with radio-specific defaults
|
|
6
|
+
* and removes indeterminate-related options.
|
|
7
|
+
*
|
|
8
|
+
* @category Radio
|
|
9
|
+
*/
|
|
10
|
+
export type RadioProps = Omit<CheckboxBaseProps, 'type' | 'elementClass' | 'indeterminateIcon' | 'indeterminate'>;
|
|
11
|
+
/**
|
|
12
|
+
* Radio button component built on top of {@link CheckboxBase}.
|
|
13
|
+
*
|
|
14
|
+
* Provides radio-specific defaults, circular shape,
|
|
15
|
+
* and checked icon rendering.
|
|
16
|
+
*
|
|
17
|
+
* @param props Component properties.
|
|
18
|
+
* @function
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Radio label="Option A" />
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* <Radio
|
|
25
|
+
* label="Option B"
|
|
26
|
+
* checked
|
|
27
|
+
* />
|
|
28
|
+
*
|
|
29
|
+
* @category Radio
|
|
30
|
+
*/
|
|
31
|
+
export declare const Radio: import('react').ForwardRefExoticComponent<RadioProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { FieldsetProps } from '../fieldset/fieldset';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the RadioGroup component.
|
|
5
|
+
*
|
|
6
|
+
* @category RadioGroup
|
|
7
|
+
*/
|
|
8
|
+
export interface RadioGroupProps extends Omit<FieldsetProps, 'component' | 'elementClass' | 'defaultChecked' | 'onChange'> {
|
|
9
|
+
/** Shared name attribute for all radio buttons in the group. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Initial selected value for uncontrolled usage. */
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/** Controlled selected value. */
|
|
14
|
+
value?: string;
|
|
15
|
+
/** Called when the selected value changes. */
|
|
16
|
+
onChange?: (value: string) => void;
|
|
17
|
+
/** Radio buttons rendered inside the group. */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Groups related radio buttons into a single selectable set.
|
|
22
|
+
*
|
|
23
|
+
* Supports controlled and uncontrolled usage.
|
|
24
|
+
*
|
|
25
|
+
* @category RadioGroup
|
|
26
|
+
* @function
|
|
27
|
+
* @param props RadioGroupProps
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Uncontrolled
|
|
32
|
+
* <RadioGroup name="options" defaultValue="a">
|
|
33
|
+
* <Radio value="a" label="Option A" />
|
|
34
|
+
* <Radio value="b" label="Option B" />
|
|
35
|
+
* </RadioGroup>
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Controlled
|
|
40
|
+
* const [value, setValue] = useState('a');
|
|
41
|
+
*
|
|
42
|
+
* <RadioGroup name="options" value={value} onChange={setValue}>
|
|
43
|
+
* <Radio value="a" label="Option A" />
|
|
44
|
+
* <Radio value="b" label="Option B" />
|
|
45
|
+
* </RadioGroup>
|
|
46
|
+
*/
|
|
47
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BoxBaseProps } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link Section}.
|
|
4
|
+
* Extends {@link BoxBaseProps} except for `elementClass` and `component`.
|
|
5
|
+
*
|
|
6
|
+
* @category Box
|
|
7
|
+
*/
|
|
8
|
+
export type SectionProps = Omit<BoxBaseProps, 'elementClass' | 'component'>;
|
|
9
|
+
/**
|
|
10
|
+
* Semantic layout wrapper for the native `<section>` element.
|
|
11
|
+
*
|
|
12
|
+
* Built on top of {@link BoxBase}, inheriting its layout and styling props.
|
|
13
|
+
* Defaults to a column layout (`direction="col"`) and applies
|
|
14
|
+
* the semantic UUI class `"uui-section"`.
|
|
15
|
+
*
|
|
16
|
+
* Use for grouping related content within a document or page.
|
|
17
|
+
*
|
|
18
|
+
* @function
|
|
19
|
+
* @param props - All layout and style props inherited from {@link BoxBase}.
|
|
20
|
+
* @example
|
|
21
|
+
* <Section elevation={1} shape="rounded">
|
|
22
|
+
* <Article />
|
|
23
|
+
* </Section>
|
|
24
|
+
*
|
|
25
|
+
* @category Box
|
|
26
|
+
*/
|
|
27
|
+
export declare const Section: import('react').ForwardRefExoticComponent<SectionProps & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldBaseProps } from '../core';
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link Select}.
|
|
5
|
+
*
|
|
6
|
+
* @category Field
|
|
7
|
+
*/
|
|
8
|
+
export interface SelectProps extends Omit<FieldBaseProps, 'elementClass' | 'value' | 'onChange'> {
|
|
9
|
+
/** Current selected value. */
|
|
10
|
+
value?: string | string[];
|
|
11
|
+
/** Placeholder displayed when no value is selected. */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Change handler called with the selected value. */
|
|
14
|
+
onChange?: (value: string | string[] | undefined) => void;
|
|
15
|
+
/** Enables multiple value selection. */
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
/** Makes the control read-only. */
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
/** Custom renderer for the selected value. */
|
|
20
|
+
renderValue?: (value: string | string[] | undefined) => ReactNode;
|
|
21
|
+
/** Select options. */
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* **Select** – form control used to choose one or multiple values
|
|
26
|
+
* from a predefined list of options.
|
|
27
|
+
*
|
|
28
|
+
* @param props
|
|
29
|
+
*
|
|
30
|
+
* @category Field
|
|
31
|
+
* @function
|
|
32
|
+
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type SpinnerVariant = 'circular' | 'dots' | 'bars' | 'ring' | 'bars2' | 'orbit' | 'arc' | 'stepBar';
|
|
2
|
+
export interface SpinnerProps {
|
|
3
|
+
variant?: SpinnerVariant;
|
|
4
|
+
className?: string;
|
|
5
|
+
inline?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function Spinner({ variant, inline, className }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ElementAlign, ElementDensity, ElementElevation, ElementFocusEffect, ElementFont, ElementHoverEffect, ElementOutline, ElementPressedEffect, ElementSelectedEffect, ElementShape, ElementSize, ElementTextPlacement, ElementTouchEffect } from '../utils';
|
|
3
|
+
import { BorderColor, SemanticColor, SurfaceColor } from '../../utils/color';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Switch component.
|
|
6
|
+
*
|
|
7
|
+
* Low-level boolean control.
|
|
8
|
+
*
|
|
9
|
+
* @category Switch
|
|
10
|
+
*/
|
|
11
|
+
export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'color' | 'size' | 'type'> {
|
|
12
|
+
/** Border style when outlined. */
|
|
13
|
+
border?: ElementOutline;
|
|
14
|
+
/** Border color override. */
|
|
15
|
+
borderColor?: BorderColor;
|
|
16
|
+
/** Border color when unchecked. */
|
|
17
|
+
uncheckedBorderColor?: BorderColor;
|
|
18
|
+
/** Custom content rendered inside the control. */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** Additional root class name. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Semantic color used for the checked state. */
|
|
23
|
+
color?: SemanticColor;
|
|
24
|
+
/** Semantic color used for the unchecked state. */
|
|
25
|
+
uncheckedColor?: SemanticColor;
|
|
26
|
+
/** Visual density affecting layout spacing. */
|
|
27
|
+
density?: ElementDensity;
|
|
28
|
+
/** Supporting text displayed below the label. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Text color override for the description. */
|
|
31
|
+
descriptionColor?: SurfaceColor;
|
|
32
|
+
/** Font token applied to the description text. */
|
|
33
|
+
descriptionFont?: ElementFont;
|
|
34
|
+
/** Elevation level of the control surface. */
|
|
35
|
+
elevation?: ElementElevation;
|
|
36
|
+
/** Error message text. Overrides description when present. */
|
|
37
|
+
error?: string;
|
|
38
|
+
/** Focus ring color override. */
|
|
39
|
+
focusColor?: BorderColor;
|
|
40
|
+
/** Visual effects applied on focus. */
|
|
41
|
+
focusEffects?: ElementFocusEffect[];
|
|
42
|
+
/** Font token applied to the label text. */
|
|
43
|
+
font?: ElementFont;
|
|
44
|
+
/** Enables full color rendering for the unchecked state. */
|
|
45
|
+
fullColor?: boolean;
|
|
46
|
+
/** Visual effects applied on hover. */
|
|
47
|
+
hoverEffects?: ElementHoverEffect[];
|
|
48
|
+
/** Icon rendered when checked. */
|
|
49
|
+
icon?: ReactNode;
|
|
50
|
+
/** DOM id. Auto-generated if not provided. */
|
|
51
|
+
id?: string;
|
|
52
|
+
/** Text label associated with the control. */
|
|
53
|
+
label?: string;
|
|
54
|
+
/** Text color override for the label. */
|
|
55
|
+
labelColor?: SurfaceColor;
|
|
56
|
+
/** Name attribute forwarded to the input element. */
|
|
57
|
+
name?: string;
|
|
58
|
+
/** Change event handler. */
|
|
59
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
60
|
+
/** Visual effects applied on press. */
|
|
61
|
+
pressedEffects?: ElementPressedEffect[];
|
|
62
|
+
/** Marks the control as required. Visual only. */
|
|
63
|
+
required?: boolean;
|
|
64
|
+
/** Visual effects applied when checked. */
|
|
65
|
+
selectedEffects?: ElementSelectedEffect[];
|
|
66
|
+
/** Shape variant of the control. */
|
|
67
|
+
shape?: ElementShape;
|
|
68
|
+
/** Size of the control. */
|
|
69
|
+
size?: ElementSize;
|
|
70
|
+
/** Text color override for label and content. */
|
|
71
|
+
textColor?: SurfaceColor;
|
|
72
|
+
/** Layout of text relative to the control. */
|
|
73
|
+
textPlacement?: ElementTextPlacement;
|
|
74
|
+
/** Tooltip alignment relative to the control. */
|
|
75
|
+
tooltipAlign?: ElementAlign;
|
|
76
|
+
/** Touch and click visual effects. */
|
|
77
|
+
touchEffects?: ElementTouchEffect[];
|
|
78
|
+
/** Border style when unchecked. */
|
|
79
|
+
uncheckedBorder?: ElementOutline;
|
|
80
|
+
/** Icon rendered when unchecked. */
|
|
81
|
+
uncheckedIcon?: ReactNode;
|
|
82
|
+
/** Controlled value forwarded to the input element. */
|
|
83
|
+
value?: string;
|
|
84
|
+
/** Duration of the thumb transition between checked and unchecked states. */
|
|
85
|
+
duration?: number;
|
|
86
|
+
/** Marks the control as read-only. Applies aria-readonly. */
|
|
87
|
+
readOnly?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Switch control used to toggle a setting on or off.
|
|
91
|
+
*
|
|
92
|
+
* Represents an immediate boolean preference.
|
|
93
|
+
*
|
|
94
|
+
* @function Switch
|
|
95
|
+
* @param props Component properties.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* <Switch label="Notifications" />
|
|
99
|
+
*
|
|
100
|
+
* @category Switch
|
|
101
|
+
*/
|
|
102
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FieldBaseProps } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link TextField}.
|
|
4
|
+
* Extends {@link FieldBaseProps}.
|
|
5
|
+
*
|
|
6
|
+
* @category Field
|
|
7
|
+
*/
|
|
8
|
+
export type FieldProps = Omit<FieldBaseProps, 'elementClass'>;
|
|
9
|
+
export declare const TextField: import('react').ForwardRefExoticComponent<FieldProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ThemeProviderProps {
|
|
3
|
+
/** React children to render within the theme context. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Optional color mode: 'light' or 'dark'.
|
|
7
|
+
* If not provided, defaults to 'light'.
|
|
8
|
+
*/
|
|
9
|
+
colorMode?: 'light' | 'dark';
|
|
10
|
+
/**
|
|
11
|
+
* Optional seed color used to generate MD3 theme.
|
|
12
|
+
* Defaults to #6750A4 if omitted.
|
|
13
|
+
*/
|
|
14
|
+
seedColor?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional custom colors used for info, warning, and success roles.
|
|
17
|
+
* If omitted, defaults to:
|
|
18
|
+
* - info: #03a9f4
|
|
19
|
+
* - warning: #ffd600
|
|
20
|
+
* - success: #689f38
|
|
21
|
+
*/
|
|
22
|
+
extraColors?: Partial<Record<'info' | 'warning' | 'success', string>>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Provides a ThemeContext to all descendant components using Material Design 3 color tokens.
|
|
26
|
+
*
|
|
27
|
+
* - Dynamically generates full theme schemes (`light` and `dark`) based on the provided `seedColor`
|
|
28
|
+
* and optional `extraColors` (`info`, `warning`, `success`).
|
|
29
|
+
* - Injects resolved colors as CSS custom properties into the DOM (`:root` and `.dark`).
|
|
30
|
+
* - Automatically toggles the `.dark` class on `<body>` based on `colorMode`.
|
|
31
|
+
* - Exposes utility functions via context:
|
|
32
|
+
* - `setTheme`: updates the full theme object
|
|
33
|
+
* - `setDarkMode`: enables/disables dark mode
|
|
34
|
+
* - `getColorValue`: gets current color value (light or dark based on mode)
|
|
35
|
+
* - `getThemeColorValue`: gets any color from a specified scheme (`light` or `dark`)
|
|
36
|
+
*
|
|
37
|
+
* This provider must wrap your application to enable theming and contextual access to color tokens.
|
|
38
|
+
*
|
|
39
|
+
* @param children - React children rendered within the theme context.
|
|
40
|
+
* @param colorMode - Optional color mode: `'light'` or `'dark'`. Defaults to `'light'`.
|
|
41
|
+
* @param seedColor - Optional base color used to generate the theme. Defaults to `#6750A4`.
|
|
42
|
+
* @param extraColors - Optional custom base colors for semantic roles (`info`, `warning`, `success`).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <ThemeProvider colorMode="dark" seedColor="#6200ee" extraColors={{ info: '#2196f3' }}>
|
|
47
|
+
* <App />
|
|
48
|
+
* </ThemeProvider>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @category Components
|
|
52
|
+
* @group Theme
|
|
53
|
+
*/
|
|
54
|
+
export declare const ThemeProvider: ({ children, colorMode, seedColor, extraColors }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ButtonBaseProps } from '../core';
|
|
2
|
+
export interface ToggleButtonProps extends Omit<ButtonBaseProps, 'filled' | 'controlClass' | 'iconClass'> {
|
|
3
|
+
selected?: boolean;
|
|
4
|
+
iconPosition?: 'start' | 'end';
|
|
5
|
+
}
|
|
6
|
+
export declare const ToggleButton: import('react').ForwardRefExoticComponent<ToggleButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLProps, ReactNode } from 'react';
|
|
2
|
+
import { ElementAlign } from '../utils';
|
|
3
|
+
export interface TooltipProps extends HTMLProps<HTMLDivElement> {
|
|
4
|
+
title: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
align?: ElementAlign;
|
|
7
|
+
}
|
|
8
|
+
export declare const Tooltip: import('react').ForwardRefExoticComponent<Omit<TooltipProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context value shared by {@link Fieldset} and its child controls.
|
|
3
|
+
*
|
|
4
|
+
* Provides semantic state for grouped form elements.
|
|
5
|
+
*
|
|
6
|
+
* @category Contexts
|
|
7
|
+
*/
|
|
8
|
+
export interface FieldsetContextValue {
|
|
9
|
+
/** Whether all controls inside the fieldset should be disabled. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* FieldsetContext provides access to the current fieldset state.
|
|
14
|
+
*
|
|
15
|
+
* Used by form controls (e.g. Checkbox, Radio) to inherit
|
|
16
|
+
* group-level properties such as `disabled`.
|
|
17
|
+
*
|
|
18
|
+
* Returns `null` if used outside a {@link Fieldset}.
|
|
19
|
+
*
|
|
20
|
+
* @category Contexts
|
|
21
|
+
*/
|
|
22
|
+
export declare const FieldsetContext: import('react').Context<FieldsetContextValue | null>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context value shared by {@link RadioGroup} and radio controls.
|
|
3
|
+
*
|
|
4
|
+
* Provides group-level state and behavior for radio button collections.
|
|
5
|
+
*
|
|
6
|
+
* @category Contexts
|
|
7
|
+
*/
|
|
8
|
+
export interface RadioGroupContextValue {
|
|
9
|
+
/** Whether all radio controls inside the group are disabled. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Shared name attribute applied to all radio inputs in the group. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Updates the selected value of the radio group. */
|
|
14
|
+
setValue?: (v: string) => void;
|
|
15
|
+
/** Currently selected value of the radio group. */
|
|
16
|
+
value?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* RadioGroupContext provides access to the current radio group state.
|
|
20
|
+
*
|
|
21
|
+
* Used by radio controls to inherit group-level properties such as
|
|
22
|
+
* `name`, `value`, `disabled`, and selection behavior.
|
|
23
|
+
*
|
|
24
|
+
* Returns `null` if used outside a {@link RadioGroup}.
|
|
25
|
+
*
|
|
26
|
+
* @category Contexts
|
|
27
|
+
*/
|
|
28
|
+
export declare const RadioGroupContext: import('react').Context<RadioGroupContextValue | null>;
|