@bug-on/m3-expressive 1.0.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/CHANGELOG.md +110 -0
- package/README.md +110 -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 +94 -0
- package/dist/buttons.d.mts +180 -0
- package/dist/buttons.d.ts +180 -0
- package/dist/buttons.js +4282 -0
- package/dist/buttons.js.map +1 -0
- package/dist/buttons.mjs +4227 -0
- package/dist/buttons.mjs.map +1 -0
- package/dist/core.d.mts +422 -0
- package/dist/core.d.ts +422 -0
- package/dist/core.js +2581 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +2547 -0
- package/dist/core.mjs.map +1 -0
- package/dist/feedback.d.mts +600 -0
- package/dist/feedback.d.ts +600 -0
- package/dist/feedback.js +2357 -0
- package/dist/feedback.js.map +1 -0
- package/dist/feedback.mjs +2321 -0
- package/dist/feedback.mjs.map +1 -0
- package/dist/forms.d.mts +40 -0
- package/dist/forms.d.ts +40 -0
- package/dist/forms.js +4263 -0
- package/dist/forms.js.map +1 -0
- package/dist/forms.mjs +4228 -0
- package/dist/forms.mjs.map +1 -0
- package/dist/icon-button-D-gs0gfj.d.mts +136 -0
- package/dist/icon-button-D-gs0gfj.d.ts +136 -0
- package/dist/index.css +309 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +23972 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +23668 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layout.d.mts +610 -0
- package/dist/layout.d.ts +610 -0
- package/dist/layout.js +5091 -0
- package/dist/layout.js.map +1 -0
- package/dist/layout.mjs +5042 -0
- package/dist/layout.mjs.map +1 -0
- package/dist/material-symbols-cdn.css +65 -0
- package/dist/material-symbols-cdn.css.d.ts +2 -0
- package/dist/material-symbols-self-hosted.css +94 -0
- package/dist/material-symbols-self-hosted.css.d.ts +2 -0
- package/dist/md3-DFhj-NZj.d.mts +17 -0
- package/dist/md3-DFhj-NZj.d.ts +17 -0
- package/dist/navigation.d.mts +2766 -0
- package/dist/navigation.d.ts +2766 -0
- package/dist/navigation.js +6684 -0
- package/dist/navigation.js.map +1 -0
- package/dist/navigation.mjs +6573 -0
- package/dist/navigation.mjs.map +1 -0
- package/dist/overlays.d.mts +161 -0
- package/dist/overlays.d.ts +161 -0
- package/dist/overlays.js +3298 -0
- package/dist/overlays.js.map +1 -0
- package/dist/overlays.mjs +3244 -0
- package/dist/overlays.mjs.map +1 -0
- package/dist/pickers.d.mts +1074 -0
- package/dist/pickers.d.ts +1074 -0
- package/dist/pickers.js +4240 -0
- package/dist/pickers.js.map +1 -0
- package/dist/pickers.mjs +4200 -0
- package/dist/pickers.mjs.map +1 -0
- package/dist/plugin.d.mts +1 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +13 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.mjs +3 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/scroll-area-CVS6HyLl.d.mts +33 -0
- package/dist/scroll-area-CVS6HyLl.d.ts +33 -0
- package/dist/shapes.d.mts +1119 -0
- package/dist/shapes.d.ts +1119 -0
- package/dist/shapes.js +2941 -0
- package/dist/shapes.js.map +1 -0
- package/dist/shapes.mjs +2889 -0
- package/dist/shapes.mjs.map +1 -0
- package/dist/side-sheet-modal-BY6VCC8p.d.mts +553 -0
- package/dist/side-sheet-modal-CglP6KYA.d.ts +553 -0
- package/dist/split-button-trailing-uncheckable-C5CLCIKP.d.ts +731 -0
- package/dist/split-button-trailing-uncheckable-MXj_kyNt.d.mts +731 -0
- package/dist/text-field-eAIpz9z1.d.mts +1038 -0
- package/dist/text-field-eAIpz9z1.d.ts +1038 -0
- package/dist/typography-339RV6v7.d.mts +486 -0
- package/dist/typography-339RV6v7.d.ts +486 -0
- package/dist/typography.css +22 -0
- package/dist/typography.css.d.ts +2 -0
- package/package.json +207 -0
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
import { HTMLMotionProps } from 'motion/react';
|
|
2
|
+
import { M as MD3ColorStyle, b as MD3Size, a as MD3Shape } from './md3-DFhj-NZj.js';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
type MotionButtonProps$3 = Omit<HTMLMotionProps<"button">, "children" | "color">;
|
|
7
|
+
interface BaseButtonProps extends MotionButtonProps$3 {
|
|
8
|
+
/**
|
|
9
|
+
* The visual style of the button.
|
|
10
|
+
* Maps to MD3 emphasis levels.
|
|
11
|
+
* @default "filled"
|
|
12
|
+
*/
|
|
13
|
+
colorStyle?: MD3ColorStyle;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated `selectedColorStyle` is no longer used. Color styles are now automatically
|
|
16
|
+
* resolved based on the `colorStyle` and `selected` state per MD3 specs.
|
|
17
|
+
* If provided, it will be ignored.
|
|
18
|
+
*/
|
|
19
|
+
selectedColorStyle?: MD3ColorStyle;
|
|
20
|
+
/**
|
|
21
|
+
* The size variant of the button.
|
|
22
|
+
* @default "sm"
|
|
23
|
+
*/
|
|
24
|
+
size?: MD3Size;
|
|
25
|
+
/**
|
|
26
|
+
* Shape of the button container.
|
|
27
|
+
* MD3 Expressive morphs the shape slightly on press based on the chosen shape variant.
|
|
28
|
+
* @default "round"
|
|
29
|
+
*/
|
|
30
|
+
shape?: MD3Shape;
|
|
31
|
+
/**
|
|
32
|
+
* Override the default border width for outlined buttons.
|
|
33
|
+
* By default, this is derived from the size token (e.g., 1dp for sm, 3dp for xl).
|
|
34
|
+
*/
|
|
35
|
+
outlineWidth?: number;
|
|
36
|
+
/**
|
|
37
|
+
* An optional icon to display alongside the label.
|
|
38
|
+
*/
|
|
39
|
+
icon?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Position of the icon relative to the label.
|
|
42
|
+
* @default "leading"
|
|
43
|
+
*/
|
|
44
|
+
iconPosition?: "leading" | "trailing";
|
|
45
|
+
/**
|
|
46
|
+
* The loading state of the button. Replaces the icon (or is prepended) with a spinner.
|
|
47
|
+
* Disables the button visually and functionally.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The visual variant of the loading spinner.
|
|
53
|
+
* @default "loading-indicator"
|
|
54
|
+
*/
|
|
55
|
+
loadingVariant?: "loading-indicator" | "circular";
|
|
56
|
+
/**
|
|
57
|
+
* Replaces the wrapping `<button>` with the child element, passing all props and styles to it.
|
|
58
|
+
* Useful for rendering as an `<a>` tag or a React Router `<Link>`.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
asChild?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Explicitly sets the trailing icon layout mode.
|
|
64
|
+
* Mostly used internally by ButtonGroup to align dropdown carets.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
hasTrailingIcon?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* A specific string key identifying the button in a ButtonGroup context.
|
|
70
|
+
*/
|
|
71
|
+
value?: string;
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
}
|
|
74
|
+
type ButtonProps = BaseButtonProps & ({
|
|
75
|
+
variant?: "default";
|
|
76
|
+
selected?: never;
|
|
77
|
+
} | {
|
|
78
|
+
variant: "toggle";
|
|
79
|
+
selected: boolean;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
declare const Button: React$1.NamedExoticComponent<(Omit<BaseButtonProps & {
|
|
83
|
+
variant?: "default";
|
|
84
|
+
selected?: never;
|
|
85
|
+
}, "ref"> | Omit<BaseButtonProps & {
|
|
86
|
+
variant: "toggle";
|
|
87
|
+
selected: boolean;
|
|
88
|
+
}, "ref">) & React$1.RefAttributes<HTMLButtonElement>>;
|
|
89
|
+
|
|
90
|
+
declare const BUTTON_SIZE_TOKENS: {
|
|
91
|
+
readonly xs: {
|
|
92
|
+
readonly height: "2rem";
|
|
93
|
+
readonly leadingSpace: "1rem";
|
|
94
|
+
readonly trailingSpace: "1rem";
|
|
95
|
+
readonly iconSize: "1.25rem";
|
|
96
|
+
readonly iconLabelSpace: "0.5rem";
|
|
97
|
+
readonly outlineWidth: 1;
|
|
98
|
+
readonly squareShapeRadius: 12;
|
|
99
|
+
readonly pressedShapeRadius: 8;
|
|
100
|
+
readonly roundShapeRadius: 16;
|
|
101
|
+
};
|
|
102
|
+
readonly sm: {
|
|
103
|
+
readonly height: "2.5rem";
|
|
104
|
+
readonly leadingSpace: "1rem";
|
|
105
|
+
readonly trailingSpace: "1rem";
|
|
106
|
+
readonly iconSize: "1.25rem";
|
|
107
|
+
readonly iconLabelSpace: "0.5rem";
|
|
108
|
+
readonly outlineWidth: 1;
|
|
109
|
+
readonly squareShapeRadius: 12;
|
|
110
|
+
readonly pressedShapeRadius: 8;
|
|
111
|
+
readonly roundShapeRadius: 20;
|
|
112
|
+
};
|
|
113
|
+
readonly md: {
|
|
114
|
+
readonly height: "3.5rem";
|
|
115
|
+
readonly leadingSpace: "1.5rem";
|
|
116
|
+
readonly trailingSpace: "1.5rem";
|
|
117
|
+
readonly iconSize: "1.5rem";
|
|
118
|
+
readonly iconLabelSpace: "0.5rem";
|
|
119
|
+
readonly outlineWidth: 1;
|
|
120
|
+
readonly squareShapeRadius: 16;
|
|
121
|
+
readonly pressedShapeRadius: 12;
|
|
122
|
+
readonly roundShapeRadius: 28;
|
|
123
|
+
};
|
|
124
|
+
readonly lg: {
|
|
125
|
+
readonly height: "6rem";
|
|
126
|
+
readonly leadingSpace: "3rem";
|
|
127
|
+
readonly trailingSpace: "3rem";
|
|
128
|
+
readonly iconSize: "2rem";
|
|
129
|
+
readonly iconLabelSpace: "0.75rem";
|
|
130
|
+
readonly outlineWidth: 2;
|
|
131
|
+
readonly squareShapeRadius: 28;
|
|
132
|
+
readonly pressedShapeRadius: 16;
|
|
133
|
+
readonly roundShapeRadius: 48;
|
|
134
|
+
};
|
|
135
|
+
readonly xl: {
|
|
136
|
+
readonly height: "8.5rem";
|
|
137
|
+
readonly leadingSpace: "4rem";
|
|
138
|
+
readonly trailingSpace: "4rem";
|
|
139
|
+
readonly iconSize: "2.5rem";
|
|
140
|
+
readonly iconLabelSpace: "1rem";
|
|
141
|
+
readonly outlineWidth: 3;
|
|
142
|
+
readonly squareShapeRadius: 28;
|
|
143
|
+
readonly pressedShapeRadius: 16;
|
|
144
|
+
readonly roundShapeRadius: 68;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
declare const BUTTON_COLOR_TOKENS: {
|
|
148
|
+
readonly elevated: {
|
|
149
|
+
readonly default: "bg-m3-surface-container-low text-m3-primary shadow-md";
|
|
150
|
+
readonly selected: "bg-m3-primary text-m3-on-primary shadow-md";
|
|
151
|
+
readonly unselected: "bg-m3-surface-container-low text-m3-primary shadow-md";
|
|
152
|
+
};
|
|
153
|
+
readonly filled: {
|
|
154
|
+
readonly default: "bg-m3-primary text-m3-on-primary";
|
|
155
|
+
readonly selected: "bg-m3-primary text-m3-on-primary";
|
|
156
|
+
readonly unselected: "bg-m3-surface-container text-m3-on-surface-variant";
|
|
157
|
+
};
|
|
158
|
+
readonly tonal: {
|
|
159
|
+
readonly default: "bg-m3-secondary-container text-m3-on-secondary-container";
|
|
160
|
+
readonly selected: "bg-m3-secondary text-m3-on-secondary";
|
|
161
|
+
readonly unselected: "bg-m3-secondary-container text-m3-on-secondary-container";
|
|
162
|
+
};
|
|
163
|
+
readonly outlined: {
|
|
164
|
+
readonly default: "bg-transparent text-m3-on-surface-variant border-m3-outline-variant";
|
|
165
|
+
readonly selected: "bg-m3-inverse-surface text-m3-inverse-on-surface border-transparent";
|
|
166
|
+
readonly unselected: "bg-transparent text-m3-on-surface-variant border-m3-outline-variant";
|
|
167
|
+
};
|
|
168
|
+
readonly text: {
|
|
169
|
+
readonly default: "bg-transparent text-m3-primary";
|
|
170
|
+
readonly selected: "bg-transparent text-m3-primary";
|
|
171
|
+
readonly unselected: "bg-transparent text-m3-primary";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
type ButtonGroupVariant = "standard" | "connected" | "navbar";
|
|
176
|
+
type ButtonGroupOrientation = "horizontal" | "vertical";
|
|
177
|
+
/**
|
|
178
|
+
* Thuộc tính truyền vào cho thành phần nhóm nút (Button Group).
|
|
179
|
+
*/
|
|
180
|
+
interface ButtonGroupProps extends React$1.FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
181
|
+
/**
|
|
182
|
+
* Cấu trúc hiển thị của nhóm nút:
|
|
183
|
+
* - `standard`: Các nút cách xa và có khoảng cách độc lập với nhau (gap).
|
|
184
|
+
* - `connected`: Các nút nối liền khung viền với nhau để tạo thành dạng Segmented Button.
|
|
185
|
+
* - `navbar`: Nút hiển thị dưới dạng thanh điều hướng với active pill chuyển động (Sliding Indicator).
|
|
186
|
+
* @default "standard"
|
|
187
|
+
*/
|
|
188
|
+
variant?: ButtonGroupVariant;
|
|
189
|
+
/**
|
|
190
|
+
* Hướng sắp xếp của các nút trong nhóm.
|
|
191
|
+
* @default "horizontal"
|
|
192
|
+
*/
|
|
193
|
+
orientation?: ButtonGroupOrientation;
|
|
194
|
+
/**
|
|
195
|
+
* Đặt thành `true` nếu bạn muốn nhóm hiển thị dạng `standard` giãn đều lấp đầy toàn bộ khu vực chứa (container).
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
fullWidth?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Áp dụng thống nhất chung một kích thước (`size`) cho tất cả các con trong nhóm (ghi đè kích thước lẻ từng nút).
|
|
201
|
+
*/
|
|
202
|
+
size?: MD3Size;
|
|
203
|
+
/**
|
|
204
|
+
* Bật/tắt hiệu ứng thu phóng độ rộng / khoảng đệm (Morphing Width) khi nhấn vào các nút (áp dụng cho nhóm `standard`).
|
|
205
|
+
* @default true
|
|
206
|
+
*/
|
|
207
|
+
morphingWidth?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Tỷ lệ mở rộng chiều rộng của nút khi được nhấn (áp dụng cho nhóm `standard` ngang).
|
|
210
|
+
* Theo MD3 Spec, mặc định là 0.15 (15%).
|
|
211
|
+
* @default 0.15
|
|
212
|
+
*/
|
|
213
|
+
expandedRatio?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Tự động hiển thị biểu tượng (icon) Check khi một nút trạng thái nằm trong nhóm được chỉ định là `selected={true}`.
|
|
216
|
+
* @default false
|
|
217
|
+
*/
|
|
218
|
+
showCheck?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Điều khiển hành vi hiển thị Icon (áp dụng chính cho `navbar`).
|
|
221
|
+
* - `selected`: Chỉ hiển thị icon trên mục được chọn.
|
|
222
|
+
* - `all`: Hiển thị trên tất cả.
|
|
223
|
+
* - `none`: Ẩn toàn bộ icon.
|
|
224
|
+
*/
|
|
225
|
+
iconBehavior?: "selected" | "all" | "none";
|
|
226
|
+
/**
|
|
227
|
+
* Điều khiển hành vi hiển thị Label (áp dụng chính cho `navbar`).
|
|
228
|
+
* - `selected`: Chỉ hiển thị label trên mục được chọn.
|
|
229
|
+
* - `all`: Hiển thị trên tất cả.
|
|
230
|
+
* - `none`: Ẩn toàn bộ label.
|
|
231
|
+
*/
|
|
232
|
+
labelBehavior?: "selected" | "all" | "none";
|
|
233
|
+
/**
|
|
234
|
+
* Tùy chọn: Bật chế độ Active Morphing (dựa trên Selection).
|
|
235
|
+
* Khi `true`, các nút sẽ tự động co dãn (tăng/giảm width) dựa trên việc nút nào đang được chọn,
|
|
236
|
+
* tạo hiệu ứng thay đổi kích thước mượt mà theo trạng thái.
|
|
237
|
+
* Khi `false` hoặc `undefined`, Group sẽ hoạt động dựa trên `isPressed` (nhấn chuột) như mặc định.
|
|
238
|
+
*/
|
|
239
|
+
activeMorphing?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Class CSS tùy chỉnh áp dụng cho từng button con trong nhóm.
|
|
242
|
+
* Hữu ích để thay đổi padding, min-width hoặc các thuộc tính khác một cách linh hoạt.
|
|
243
|
+
* Đối với variant `navbar`, class này sẽ được ưu tiên hơn so với các padding mặc định.
|
|
244
|
+
*/
|
|
245
|
+
itemClassName?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare const ButtonGroup: React$1.NamedExoticComponent<ButtonGroupProps & React$1.RefAttributes<HTMLFieldSetElement>>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @file extended-fab.tsx
|
|
252
|
+
* MD3 Expressive Extended Floating Action Button.
|
|
253
|
+
* @see https://m3.material.io/components/extended-fab/specs
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
type MotionButtonProps$2 = Omit<HTMLMotionProps<"button">, "children" | "color">;
|
|
257
|
+
/** Props for the `ExtendedFAB` component. */
|
|
258
|
+
interface ExtendedFABProps extends MotionButtonProps$2 {
|
|
259
|
+
/** Required text label. Keep it short (1-2 words); it does not wrap. */
|
|
260
|
+
label: string;
|
|
261
|
+
/** Icon to render. Automatically replaced by a spinner when `loading={true}`. */
|
|
262
|
+
icon?: React$1.ReactNode;
|
|
263
|
+
/** Button size per MD3 Expressive spec. @default "sm" */
|
|
264
|
+
size?: "sm" | "md" | "lg";
|
|
265
|
+
/** MD3 color role for the container surface. @default "primary" */
|
|
266
|
+
colorStyle?: "primary" | "secondary" | "tertiary" | "surface";
|
|
267
|
+
/** Reduces shadow to the lower elevation variant. @default false */
|
|
268
|
+
lowered?: boolean;
|
|
269
|
+
/** Replaces the icon with a spinner and blocks interaction. @default false */
|
|
270
|
+
loading?: boolean;
|
|
271
|
+
/** Spinner style shown while loading. @default "loading-indicator" */
|
|
272
|
+
loadingVariant?: "loading-indicator" | "circular";
|
|
273
|
+
/** Mounts/unmounts with an entrance/exit animation. @default true */
|
|
274
|
+
visible?: boolean;
|
|
275
|
+
/** Collapses to icon-only when the user scrolls down. @default false */
|
|
276
|
+
collapseOnScroll?: boolean;
|
|
277
|
+
/** Minimum scroll delta (px) required to trigger collapse/expand. @default 50 */
|
|
278
|
+
scrollThreshold?: number;
|
|
279
|
+
/** Controlled collapsed state. Overrides internal scroll-driven state when provided. */
|
|
280
|
+
collapsed?: boolean;
|
|
281
|
+
/** Callback fired when the internal collapsed state changes. */
|
|
282
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
283
|
+
/** Layout ID for Framer Motion Container Transform transitions. */
|
|
284
|
+
layoutId?: string;
|
|
285
|
+
}
|
|
286
|
+
declare const ExtendedFAB: React$1.NamedExoticComponent<Omit<ExtendedFABProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
287
|
+
|
|
288
|
+
type MotionButtonProps$1 = Omit<HTMLMotionProps<"button">, "children" | "color">;
|
|
289
|
+
/**
|
|
290
|
+
* Tham số Props dùng cho component thao tác nổi `FAB`.
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* - Đảm bảo rằng đối với loại FAB chỉ show ra mỗi con Icon mà không có nhãn hiển thị (icon-only), bắt buộc phải có thuộc tính `aria-label` nhằm phục vụ (accessibility).
|
|
294
|
+
* - Ở hình thể mở rộng (khi `extended={true}`), phần nội dung truyền vào `children` chính là chuỗi Text được thể hiện cùng nút, và nó sẽ khiến nút button có label mặc định nên bạn có thể chém bớt tham số `aria-label`.
|
|
295
|
+
* - Thuộc tính cờ `lowered` (chìm) giúp giáng cấp hiệu ứng tạo bóng Shadow của thẻ, rải mảng cái shadow theo phong thái MD3 "lowered" FAB;
|
|
296
|
+
* sử dụng khi nút FAB này vốn bị bọc bên trong bề mặt chìm đè lên component gì khác mà vốn tụi nó đã nhún ở mực sâu (Ví dụ Bottom App Bar) để thiết lập Hierarchy hài hoà.
|
|
297
|
+
*
|
|
298
|
+
* @see https://m3.material.io/components/floating-action-button/overview
|
|
299
|
+
*/
|
|
300
|
+
interface FABProps extends MotionButtonProps$1 {
|
|
301
|
+
/**
|
|
302
|
+
* Icon đại diện render — thông thường là truyền thẻ component Icon.
|
|
303
|
+
* Sẽ được tráo đổi thành Spinner tự động quay khi giá trị `loading={true}`.
|
|
304
|
+
*/
|
|
305
|
+
icon: React$1.ReactNode;
|
|
306
|
+
/**
|
|
307
|
+
* Kích thước hiển thị FAB. Tuân chuẩn.
|
|
308
|
+
* - `sm`: Small (40dp) — Được khuyên dùng cho các không gian kín/trong lòng Content.
|
|
309
|
+
* - `md`: Regular (56dp) — Action thứ yếu hoặc tiêu điểm màn hình. (Phần đông người dùng xài).
|
|
310
|
+
* - `lg`: Large (96dp) — Trọng tâm thao tác quan trọng lớn nhát.
|
|
311
|
+
* - `xl`: Extra-large (136dp) — Gây tiếng vang, dạng Spotlight cực bùng nổ của app.
|
|
312
|
+
* @default "md"
|
|
313
|
+
*/
|
|
314
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
315
|
+
/**
|
|
316
|
+
* Container vai trò hệ thống tông màu MD3 dùng phết nền.
|
|
317
|
+
* @default "primary"
|
|
318
|
+
*/
|
|
319
|
+
colorStyle?: "primary" | "secondary" | "tertiary" | "surface";
|
|
320
|
+
/**
|
|
321
|
+
* Kích hoạt khi giá trị được đổi là `true`, sẽ diễn tả Animation bung chữ kèm theo độ dãn hình dài cho cái FAB.
|
|
322
|
+
* Chiều rộng tự cơi nới để thích ứng chuỗi `children`.
|
|
323
|
+
* @default false
|
|
324
|
+
*/
|
|
325
|
+
extended?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Nơi đón lấy chữ được render cùng khi `extended={true}` bật lên.
|
|
328
|
+
* Khuyến nghị là Text string thuần.
|
|
329
|
+
*/
|
|
330
|
+
children?: React$1.ReactNode;
|
|
331
|
+
/**
|
|
332
|
+
* Nhấn `true`, thì rút lại shadow đi một cấp xuống độ nổi nông cạn.
|
|
333
|
+
* Mảng bám ở Bottom bar hay Top bar Surface để ránh rườm rà.
|
|
334
|
+
* @default false
|
|
335
|
+
*/
|
|
336
|
+
lowered?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Nhấp chuột sang `true`, đổi Icon thành cối xay Spinner chờ kết quả. Đồng loạt chặn click tương tác.
|
|
339
|
+
* @default false
|
|
340
|
+
*/
|
|
341
|
+
loading?: boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Có 2 chuẩn hình của Loading chờ.
|
|
344
|
+
* @default "loading-indicator"
|
|
345
|
+
*/
|
|
346
|
+
loadingVariant?: "loading-indicator" | "circular";
|
|
347
|
+
/**
|
|
348
|
+
* Hiện thẻ FAB lên layout không (Kiểm soát bằng motion scale Entrance/Exit).
|
|
349
|
+
* @default true
|
|
350
|
+
*/
|
|
351
|
+
visible?: boolean;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Interface cho component bọc thẻ `FABPosition` — Gắn lớp absolute position nhét cục FAB vào một góc cố định của góc nào đó tại trình duyệt/bề mặt render.
|
|
355
|
+
*
|
|
356
|
+
* @see {@link FABPosition}
|
|
357
|
+
*/
|
|
358
|
+
interface FABPositionProps {
|
|
359
|
+
/**
|
|
360
|
+
* Góc để niêm chặt nút FAB.
|
|
361
|
+
* @default "bottom-right"
|
|
362
|
+
*/
|
|
363
|
+
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
364
|
+
/** Kẹp một nùi element. Mong chờ thả Node `<FAB>` vào đây.*/
|
|
365
|
+
children: React$1.ReactNode;
|
|
366
|
+
/** CSS Class hỗ trợ chỉnh override */
|
|
367
|
+
className?: string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Element bao bọc thẻ định vị Absolute cho component `<FAB>`.
|
|
371
|
+
*
|
|
372
|
+
* Component dùng để cắm phao Neo cái FAB vào sát ở góc của screen kèm theo một cái offset space theo responsive an toàn mà lại trơn chu nhạy nhẽo.
|
|
373
|
+
* Nhưng có quy tắc gốc đó là phần tử bao bọc cha mẹ của nó PHẢI có thẻ tag css `position: relative` (hoặc ở cấp tổ tiêm của trang nào đó phải đẻ gốc rễ ra posisition).
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```tsx
|
|
377
|
+
* <div className="relative min-h-screen">
|
|
378
|
+
* // Cái nút sẽ xà xuống dưới cùng bên lề Trái
|
|
379
|
+
* <FABPosition position="bottom-left">
|
|
380
|
+
* <FAB icon={<Icon name="edit" />} aria-label="Compose New Mail" />
|
|
381
|
+
* </FABPosition>
|
|
382
|
+
* </div>
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* @see {@link FAB}
|
|
386
|
+
* @see https://m3.material.io/components/floating-action-button/guidelines
|
|
387
|
+
*/
|
|
388
|
+
declare function FABPosition({ position, children, className, }: FABPositionProps): react_jsx_runtime.JSX.Element;
|
|
389
|
+
/**
|
|
390
|
+
* Action nổi chính theo phong cách MD3 Expressive Floating Action Button (FAB).
|
|
391
|
+
*
|
|
392
|
+
* Phơi nhiễm các action tạo nhịp điệu kích hoạt cho người sử dụng với đủ bộ trang hoàn trọn kích thước Size (SM->XL),
|
|
393
|
+
* mang nhiều màu sắc Color role khác biệt, cung cấp một sức nén cho Label để kéo toẹt cái ống dài ra (gọi là Dạng Mở Rộng - Extended) tạo nên hành động sinh động,
|
|
394
|
+
* Trạng thái load/nhấp hiện xuất cùng animation thu scale thoát cảnh bắt mắt đầy nghệ thuật.
|
|
395
|
+
*
|
|
396
|
+
* @remarks
|
|
397
|
+
* - Chỉ định bắt buộc `aria-label` cho những mẫu icon bị đơn côi trơ trọi (icon-only FABs).
|
|
398
|
+
* - Trường hợp xài mode Mở Rộng qua việc truyền hàm `extended={true}`, nút FAB này tự ngộ nhận thân thế, lấy `children` dùng làm Aria label luôn hễ như `children` đó đang chứa text string.
|
|
399
|
+
* Khi ấy bạn tha hồ cắt bỏ thuộc tính `aria-label` ra.
|
|
400
|
+
* - Lúc cho biến mất (`visible={false}`), bộ nút tung chiêu lùi về sau làm quả rút bóng thoát Scale-out qua effect spring uyển chuyển.
|
|
401
|
+
* - Sài kèm `FABPosition` bao đùm nó lại nếu bạn muốn xích nó cố định ngấm chân sâu góc màn hình hiển thị.
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```tsx
|
|
405
|
+
* // FAB cơ bản, nhỏ xinh, chỉ hiện icon.
|
|
406
|
+
* <FAB icon={<Icon name="search" />} aria-label="Nhấn tìm kiếm" size="sm" />
|
|
407
|
+
*
|
|
408
|
+
* // Dịch sang dòng Extended có dòng caption chữ dài thòn
|
|
409
|
+
* const [isOpen, setOpen] = React.useState(false);
|
|
410
|
+
* <FAB
|
|
411
|
+
* icon={<Icon name="edit" />}
|
|
412
|
+
* extended={isOpen}
|
|
413
|
+
* onClick={() => setOpen(!isOpen)}
|
|
414
|
+
* >
|
|
415
|
+
* Viết tâm thư
|
|
416
|
+
* </FAB>
|
|
417
|
+
*
|
|
418
|
+
* // FAB to lớn nhất dùng trạng thái chờ load Submit lên Server
|
|
419
|
+
* <FAB
|
|
420
|
+
* icon={<Icon name="upload" />}
|
|
421
|
+
* size="lg"
|
|
422
|
+
* loading={isUploading}
|
|
423
|
+
* colorStyle="secondary"
|
|
424
|
+
* aria-label="Upload Files lên mây xanh"
|
|
425
|
+
* />
|
|
426
|
+
*
|
|
427
|
+
* // Cố định dưới chân tay phải
|
|
428
|
+
* <FABPosition position="bottom-right">
|
|
429
|
+
* <FAB icon={<Icon name="add" />} aria-label="Dấu Cộng sinh nảy" />
|
|
430
|
+
* </FABPosition>
|
|
431
|
+
* ```
|
|
432
|
+
*
|
|
433
|
+
* @see https://m3.material.io/components/floating-action-button/overview
|
|
434
|
+
*/
|
|
435
|
+
declare const FAB: React$1.NamedExoticComponent<Omit<FABProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Định dạng dữ liệu cho từng hành động (item) trong biểu mẫu menu của FAB.
|
|
439
|
+
*
|
|
440
|
+
* Nếu bỏ qua thuộc tính `label`, item sẽ render dạng ô vuông chỉ có icon.
|
|
441
|
+
*/
|
|
442
|
+
interface FABMenuItemData {
|
|
443
|
+
/** Một ID duy nhất để dùng cho key react và quản lý focus. */
|
|
444
|
+
id: string;
|
|
445
|
+
/** Label hiển thị cạnh icon (tuỳ chọn). Không thêm thuộc tính này nếu muốn hiển thị chỉ có icon (icon-only). */
|
|
446
|
+
label?: string;
|
|
447
|
+
/** Node của Icon — thường là một component SVG Icon duy nhất. */
|
|
448
|
+
icon: React$1.ReactNode;
|
|
449
|
+
/** Gọi hàm ngay lập tức khi item được kích hoạt (click hoặc nhấn Enter/Phím cách). */
|
|
450
|
+
onClick: () => void;
|
|
451
|
+
/**
|
|
452
|
+
* Khi `true`, vô hiệu hoá item về mặt hình thức lẫn tương tác rẽ nhánh.
|
|
453
|
+
* Vẫn dùng `aria-disabled` thay vì HTML `disabled` nhằm giữ nó lấy được focus phục vụ cho accessibility.
|
|
454
|
+
* @default false
|
|
455
|
+
*/
|
|
456
|
+
disabled?: boolean;
|
|
457
|
+
/** Thêm CSS classes bổ sung dùng cho wrapper chính của item. */
|
|
458
|
+
className?: string;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Các props điều khiển Component chính `FABMenu`.
|
|
462
|
+
*
|
|
463
|
+
* @remarks
|
|
464
|
+
* FABMenu quản lý vòng đời trạng thái mở/đóng menu (open/close), quản lý focus, điều khiển phím,
|
|
465
|
+
* và điều hướng hiệu ứng chuyển động. Trạng thái `expanded` được truyền từ ngoài (controlled state),
|
|
466
|
+
* do đó bạn có thể quản lý qua react state, hoặc dùng router hay business logic khác.
|
|
467
|
+
*/
|
|
468
|
+
interface FABMenuProps {
|
|
469
|
+
/** FAB Menu có đang mở (mở rộng)/hiển thị hay không. */
|
|
470
|
+
expanded: boolean;
|
|
471
|
+
/** Hàm handler kích hoạt khi Toggle FAB được người dùng tương tác, hoặc khi dismiss backdrop. */
|
|
472
|
+
onToggle: (expanded: boolean) => void;
|
|
473
|
+
/** Danh sách các action items (Spec MD3 đề nghị 2-6 item là hoàn hảo). */
|
|
474
|
+
items: FABMenuItemData[];
|
|
475
|
+
/**
|
|
476
|
+
* Vai trò màu (color role container) MD3 cho cái nút FAB lẫn các menu items.
|
|
477
|
+
* @default "primary"
|
|
478
|
+
*/
|
|
479
|
+
colorVariant?: "primary" | "secondary" | "tertiary";
|
|
480
|
+
/**
|
|
481
|
+
* Kích cỡ khởi tạo cho cái ToggleFAB (FAB biến hình thành cục đóng dấu X khi nó expanded).
|
|
482
|
+
* @default "baseline"
|
|
483
|
+
*/
|
|
484
|
+
fabSize?: "baseline" | "medium" | "large";
|
|
485
|
+
/**
|
|
486
|
+
* Căn lề của danh sách menu items tương quan với cái Toggle FAB.
|
|
487
|
+
* - `"end"`: Các items dồn hết theo lề phía tay phải (trailing edge, default cực hữu hiệu đối với RTL design).
|
|
488
|
+
* - `"start"`: Các items dồn hết dọc theo lề trái.
|
|
489
|
+
* - `"center"`: Các item sẽ được căn ra giữa chiều dọc, căn giữa tâm khối với cái FAB.
|
|
490
|
+
* @default "end"
|
|
491
|
+
*/
|
|
492
|
+
alignment?: "start" | "end" | "center";
|
|
493
|
+
/** Thuộc tính cho CSS component root để đè. */
|
|
494
|
+
className?: string;
|
|
495
|
+
/**
|
|
496
|
+
* Nếu `true`, khi menu đang hiện ra, click chuột ra phía sau (màn xám mờ backdrop) để đóng menu.
|
|
497
|
+
* @default true
|
|
498
|
+
*/
|
|
499
|
+
closeOnBackdropClick?: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* Nếu `true`, focus sẽ tự động chạy xuống item CUỐI (sát bên trên cái nút FAB) khi menu vừa loé mờ ra.
|
|
502
|
+
* Nếu `false`, focus sẽ bay lên item ĐẦU TIÊN của danh sách (cao nhất trên màn hình).
|
|
503
|
+
* @default true
|
|
504
|
+
*/
|
|
505
|
+
focusLast?: boolean;
|
|
506
|
+
/** Bắt buộc truyền `aria-label` cho ToggleFAB để đáp ứng Accessibility. */
|
|
507
|
+
"aria-label"?: string;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Props thuộc component `ToggleFAB` đứng độc lập.
|
|
511
|
+
*/
|
|
512
|
+
interface ToggleFABProps {
|
|
513
|
+
/** Nút có đang trong trạng thái được kích hoạt check (expanded). */
|
|
514
|
+
expanded: boolean;
|
|
515
|
+
/** Gọi khi xảy ra sự kiện Toggle nút. */
|
|
516
|
+
onToggle: (expanded: boolean) => void;
|
|
517
|
+
/**
|
|
518
|
+
* Function sinh Icon - nhận về tiến độ `progress` trong khoảng `0` -> `1` (Từ Chưa Expanded -> Đã Expanded)
|
|
519
|
+
* Dùng cho các hiệu ứng morphing Icon khi animtion render (VD: Từ Cộng thành Đóng).
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* ```tsx
|
|
523
|
+
* icon={(progress) => progress > 0.5 ? <Icon name="close" /> : <Icon name="add" />}
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
icon: (progress: number) => React$1.ReactNode;
|
|
527
|
+
/** Vai trò màu container chuẩn MD3. @default "primary" */
|
|
528
|
+
colorVariant?: "primary" | "secondary" | "tertiary";
|
|
529
|
+
/** Kích thước của cục FAB ban đầu (Sau khi nhấn sẽ thu tròn). @default "baseline" */
|
|
530
|
+
fabSize?: "baseline" | "medium" | "large";
|
|
531
|
+
/** CSS Class linh tinh bổ sung thêm. */
|
|
532
|
+
className?: string;
|
|
533
|
+
/** Thuộc tính đọc thẻ accessibility. Bắt buộc có. */
|
|
534
|
+
"aria-label"?: string;
|
|
535
|
+
/** Kiểm soát giá trị của ID để link với menu qua aria-controls. */
|
|
536
|
+
"aria-controls"?: string;
|
|
537
|
+
/** Trỏ id component. */
|
|
538
|
+
id?: string;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Props thuộc component một món item đơn lẻ `FABMenuItem`.
|
|
542
|
+
*/
|
|
543
|
+
interface FABMenuItemProps {
|
|
544
|
+
/** Node của icon hiện. */
|
|
545
|
+
icon: React$1.ReactNode;
|
|
546
|
+
/** Tên nhãn mô tả kế bên icon cho item này. Hoặc ẩn nó đi nếu không mong đợi. */
|
|
547
|
+
label?: string;
|
|
548
|
+
/** Hàm bắn ra khi item được kích. */
|
|
549
|
+
onClick: () => void;
|
|
550
|
+
/** Vô hiệu hóa hành vi tương tác item mà vẫn cho phép bàn phím tab bấm dính lấy focus. @default false */
|
|
551
|
+
disabled?: boolean;
|
|
552
|
+
/** Container tông màu. @default "primary" */
|
|
553
|
+
colorVariant?: "primary" | "secondary" | "tertiary";
|
|
554
|
+
/** Custom CSS className. */
|
|
555
|
+
className?: string;
|
|
556
|
+
/** Số index liệt kê trong mảng dùng tính render delay (Dành cho animation cấu trúc `custom`). */
|
|
557
|
+
index?: number;
|
|
558
|
+
/** Tổng danh sách items có mảng. */
|
|
559
|
+
totalItems?: number;
|
|
560
|
+
/** Giá trị logic `tabIndex` dùng điều khiển thao tác phím Tab thủ công. */
|
|
561
|
+
tabIndex?: number;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Nút Toggle FAB (Biến hình) có thể được dùng độc lập đứng một mình (standalone) hoặc kết nối để kích hoạt mở cả nùi Menu ở dưới con `FABMenu`.
|
|
565
|
+
*
|
|
566
|
+
* Sức ép hiệu ứng kích thước khung nền sẽ chuyển từ vuôn/vát cạnh sang hình tròn hẵn (square → circle), chuyển biến cả màu sắc
|
|
567
|
+
* khi mà cờ `expanded` chuyển tiếp từ false sang → true.
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```tsx
|
|
571
|
+
* const [open, setOpen] = React.useState(false);
|
|
572
|
+
* <ToggleFAB
|
|
573
|
+
* expanded={open}
|
|
574
|
+
* onToggle={setOpen}
|
|
575
|
+
* colorVariant="primary"
|
|
576
|
+
* aria-label="Toggle actions"
|
|
577
|
+
* icon={(progress) => progress > 0.5 ? <Icon name="close" /> : <Icon name="add" />}
|
|
578
|
+
* />
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
declare const ToggleFAB: React$1.NamedExoticComponent<ToggleFABProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
582
|
+
/**
|
|
583
|
+
* Một item thực hiện một loại hành động duy nhất trong `FABMenu`.
|
|
584
|
+
*
|
|
585
|
+
* Render hình dạng viên thuốc bao quanh icon cùng với label diễn giải.
|
|
586
|
+
* Khi `label` bỏ trống, nó sẽ render thành một cục thẻ gạch ốp màu vuông vức chứa chữ mỗi cái icon.
|
|
587
|
+
* Component chứa gợn sóng MD3 Ripple cùng 48dp chuẩn vùng target đụng diện chuẩn WCAG 2.5.5 cho cảm ứng.
|
|
588
|
+
*
|
|
589
|
+
* @remarks
|
|
590
|
+
* Những thành phần khi bị tắt (vô hiệu tương tác) thì chỉ được dùng role `aria-disabled="true"` ở lớp div bề mặt thay vì lấy
|
|
591
|
+
* thuộc tính gốc `disabled` của HTML. Nhờ đó, item tuy xám mờ không bấm được phím chuột vẫn sẽ có khả năng focus qua vòng đời tab phím bàn phím
|
|
592
|
+
* (quy chuẩn chặt chẽ của Material Design 3).
|
|
593
|
+
*/
|
|
594
|
+
declare function FABMenuItem({ icon, label, onClick, disabled, colorVariant, className, tabIndex, }: FABMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
595
|
+
/**
|
|
596
|
+
* MD3 Expressive FAB Menu.
|
|
597
|
+
*
|
|
598
|
+
* Bộ mở rộng Floating Action Button. Khi tương tác bật vào toggle-button (FAB con lai), sẽ trút ra mớ tác vụ menu ở xếp dọc (hoặc lan ra) từ trên đè ngược xuống trên nó.
|
|
599
|
+
*
|
|
600
|
+
* Accessibility thực thi chuẩn MD3 toàn phần:
|
|
601
|
+
* - thẻ `role="menu"` trang bị cho thẻ hộp div làm luống container
|
|
602
|
+
* - trang bị thẻ `role="menuitem"` trên mảng items thành phần con
|
|
603
|
+
* - Lifecycle Focus cho trải nghiệm hoàn mỹ: Mở phím bật -> Focus thẳng lên item cao/thấp đầu/cuối cùng menu; Đóng tắt menu -> Focus trả về ngược lại ToggleFAB
|
|
604
|
+
* - Tính năng Bàn Phím: Lách Escape nhấn tắt nhắm, Nhấn phím hướng lên-xuống(ArrowUp/Down) để di chuyển, Móc Tab(hoặc là Shift+Tab) nhảy lăng quăng qua các item.
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
* ```tsx
|
|
608
|
+
* const [open, setOpen] = React.useState(false);
|
|
609
|
+
*
|
|
610
|
+
* const items = [
|
|
611
|
+
* { id: 'share', icon: <Icon name="share" />, label: 'Chia sẻ', onClick: () => console.log('Share') },
|
|
612
|
+
* { id: 'edit', icon: <Icon name="edit" />, label: 'Chỉnh sửa', onClick: () => console.log('Edit') },
|
|
613
|
+
* { id: 'delete', icon: <Icon name="delete" />, label: 'Xóa bớt', disabled: true, onClick: () => {} }
|
|
614
|
+
* ];
|
|
615
|
+
*
|
|
616
|
+
* <FABMenu
|
|
617
|
+
* expanded={open}
|
|
618
|
+
* onToggle={setOpen}
|
|
619
|
+
* aria-label="Các công cụ thao tác nhanh"
|
|
620
|
+
* alignment="center"
|
|
621
|
+
* colorVariant="tertiary"
|
|
622
|
+
* items={items}
|
|
623
|
+
* />
|
|
624
|
+
* ```
|
|
625
|
+
*
|
|
626
|
+
* @see https://m3.material.io/components/floating-action-button/overview
|
|
627
|
+
*/
|
|
628
|
+
declare function FABMenu({ expanded, onToggle, items, colorVariant, fabSize, alignment, className, closeOnBackdropClick, focusLast, "aria-label": ariaLabel, }: FABMenuProps): react_jsx_runtime.JSX.Element;
|
|
629
|
+
|
|
630
|
+
type SplitButtonVariant = "filled" | "tonal" | "elevated" | "outlined";
|
|
631
|
+
type SplitButtonSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
632
|
+
interface SplitButtonSizeTokens {
|
|
633
|
+
containerHeight: number;
|
|
634
|
+
betweenSpace: number;
|
|
635
|
+
innerCorner: {
|
|
636
|
+
default: number;
|
|
637
|
+
hovered: number;
|
|
638
|
+
pressed: number;
|
|
639
|
+
};
|
|
640
|
+
outerCornerPercent: number;
|
|
641
|
+
leadingPadding: {
|
|
642
|
+
start: number;
|
|
643
|
+
end: number;
|
|
644
|
+
};
|
|
645
|
+
trailingPadding: {
|
|
646
|
+
start: number;
|
|
647
|
+
end: number;
|
|
648
|
+
};
|
|
649
|
+
trailingIconSize: number;
|
|
650
|
+
/** Optical centering offset in px for trailing icon when unselected (asymmetric shape).
|
|
651
|
+
* Negative = shift toward center. Applied as translateX(-Ndp) on trailing icon container.
|
|
652
|
+
* Values: xs=-1, sm=-1, md=-2, lg=-3, xl=-6.
|
|
653
|
+
* When trailing button is selected (circular), offset = 0 (centered normally). */
|
|
654
|
+
opticalCenterOffset: number;
|
|
655
|
+
}
|
|
656
|
+
interface SplitButtonLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
657
|
+
leadingButton: React.ReactNode;
|
|
658
|
+
trailingButton: React.ReactNode;
|
|
659
|
+
/**
|
|
660
|
+
* Visual variant for both buttons. If provided, overrides variants on sub-components.
|
|
661
|
+
*/
|
|
662
|
+
variant?: SplitButtonVariant;
|
|
663
|
+
/**
|
|
664
|
+
* Size for both buttons. If provided, overrides sizes on sub-components.
|
|
665
|
+
*/
|
|
666
|
+
size?: SplitButtonSize;
|
|
667
|
+
className?: string;
|
|
668
|
+
/**
|
|
669
|
+
* Gap between leading and trailing button.
|
|
670
|
+
* Default: 2
|
|
671
|
+
*/
|
|
672
|
+
spacing?: number;
|
|
673
|
+
}
|
|
674
|
+
type MotionButtonProps = Omit<HTMLMotionProps<"button">, "color" | "children">;
|
|
675
|
+
interface SplitButtonLeadingProps extends MotionButtonProps {
|
|
676
|
+
/** Visual variant matching the paired trailing button */
|
|
677
|
+
variant?: SplitButtonVariant;
|
|
678
|
+
/** Size of the button */
|
|
679
|
+
size?: SplitButtonSize;
|
|
680
|
+
/** Leading icon element */
|
|
681
|
+
icon?: React.ReactNode;
|
|
682
|
+
/** Children = label text */
|
|
683
|
+
children?: React.ReactNode;
|
|
684
|
+
disabled?: boolean;
|
|
685
|
+
className?: string;
|
|
686
|
+
}
|
|
687
|
+
interface SplitButtonTrailingProps extends Omit<MotionButtonProps, "onChange" | "color" | "children"> {
|
|
688
|
+
variant?: SplitButtonVariant;
|
|
689
|
+
size?: SplitButtonSize;
|
|
690
|
+
/** Checked/selected state — triggers shape morph to circle + icon rotation */
|
|
691
|
+
checked: boolean;
|
|
692
|
+
onCheckedChange: (checked: boolean) => void;
|
|
693
|
+
/** Icon to render (default: arrow_drop_down icon) */
|
|
694
|
+
icon?: React.ReactNode;
|
|
695
|
+
disabled?: boolean;
|
|
696
|
+
/** aria-label REQUIRED for accessibility */
|
|
697
|
+
"aria-label": string;
|
|
698
|
+
/** ID of controlled menu element */
|
|
699
|
+
"aria-controls"?: string;
|
|
700
|
+
className?: string;
|
|
701
|
+
}
|
|
702
|
+
interface SplitButtonTrailingUncheckableProps extends Omit<MotionButtonProps, "color" | "children"> {
|
|
703
|
+
variant?: SplitButtonVariant;
|
|
704
|
+
size?: SplitButtonSize;
|
|
705
|
+
icon?: React.ReactNode;
|
|
706
|
+
disabled?: boolean;
|
|
707
|
+
"aria-label": string;
|
|
708
|
+
className?: string;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
declare const SplitButtonLayout: React$1.NamedExoticComponent<SplitButtonLayoutProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
712
|
+
|
|
713
|
+
declare const SplitButtonLeading: React$1.NamedExoticComponent<Omit<SplitButtonLeadingProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
714
|
+
declare const FilledSplitButtonLeading: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonLeadingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
715
|
+
declare const TonalSplitButtonLeading: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonLeadingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
716
|
+
declare const ElevatedSplitButtonLeading: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonLeadingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
717
|
+
declare const OutlinedSplitButtonLeading: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonLeadingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
718
|
+
|
|
719
|
+
declare const SplitButtonTrailing: React$1.NamedExoticComponent<Omit<SplitButtonTrailingProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
720
|
+
declare const FilledSplitButtonTrailing: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
721
|
+
declare const TonalSplitButtonTrailing: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
722
|
+
declare const ElevatedSplitButtonTrailing: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
723
|
+
declare const OutlinedSplitButtonTrailing: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
724
|
+
|
|
725
|
+
declare const SplitButtonTrailingUncheckable: React$1.NamedExoticComponent<Omit<SplitButtonTrailingUncheckableProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
726
|
+
declare const FilledSplitButtonTrailingUncheckable: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingUncheckableProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
727
|
+
declare const TonalSplitButtonTrailingUncheckable: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingUncheckableProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
728
|
+
declare const ElevatedSplitButtonTrailingUncheckable: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingUncheckableProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
729
|
+
declare const OutlinedSplitButtonTrailingUncheckable: React$1.ForwardRefExoticComponent<Omit<Omit<SplitButtonTrailingUncheckableProps, "variant">, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
730
|
+
|
|
731
|
+
export { SplitButtonLeading as A, BUTTON_COLOR_TOKENS as B, type SplitButtonLeadingProps as C, type SplitButtonSize as D, ElevatedSplitButtonLeading as E, FAB as F, SplitButtonTrailing as G, type SplitButtonTrailingProps as H, SplitButtonTrailingUncheckable as I, type SplitButtonTrailingUncheckableProps as J, type SplitButtonVariant as K, type ToggleFABProps as L, TonalSplitButtonLeading as M, TonalSplitButtonTrailing as N, OutlinedSplitButtonLeading as O, TonalSplitButtonTrailingUncheckable as P, type SplitButtonSizeTokens as Q, SplitButtonLayout as S, ToggleFAB as T, BUTTON_SIZE_TOKENS as a, type BaseButtonProps as b, Button as c, ButtonGroup as d, type ButtonGroupOrientation as e, type ButtonGroupProps as f, type ButtonGroupVariant as g, type ButtonProps as h, ElevatedSplitButtonTrailing as i, ElevatedSplitButtonTrailingUncheckable as j, ExtendedFAB as k, type ExtendedFABProps as l, FABMenu as m, FABMenuItem as n, type FABMenuItemData as o, type FABMenuItemProps as p, type FABMenuProps as q, FABPosition as r, type FABPositionProps as s, type FABProps as t, FilledSplitButtonLeading as u, FilledSplitButtonTrailing as v, FilledSplitButtonTrailingUncheckable as w, OutlinedSplitButtonTrailing as x, OutlinedSplitButtonTrailingUncheckable as y, type SplitButtonLayoutProps as z };
|