@bug-on/md3-react 2.0.3 → 3.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/.turbo/turbo-build.log +42 -0
- package/CHANGELOG.md +69 -0
- package/dist/index.css +178 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +6135 -0
- package/dist/index.d.ts +6135 -71
- package/dist/index.js +1688 -631
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1600 -564
- package/dist/index.mjs.map +1 -1
- package/dist/material-symbols-cdn.css.d.ts +2 -0
- package/dist/material-symbols-self-hosted.css.d.ts +2 -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/typography.css.d.ts +2 -0
- package/package.json +28 -19
- package/scripts/copy-assets.js +115 -0
- package/src/assets/fonts/GoogleSansFlex-VariableFont.woff2 +0 -0
- package/src/assets/fonts/MaterialSymbolsOutlined-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/src/assets/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/src/assets/fonts/MaterialSymbolsSharp-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/src/assets/loading-indicator.svg +19 -0
- package/src/assets/material-symbols-cdn.css +65 -0
- package/src/assets/material-symbols-self-hosted.css +90 -0
- package/src/css.d.ts +20 -0
- package/src/hooks/useClickOutside.ts +37 -0
- package/src/hooks/useMediaQuery.ts +28 -0
- package/src/hooks/useRipple.ts +88 -0
- package/src/index.css +23 -0
- package/src/index.ts +349 -0
- package/src/lib/material-symbols-preconnect.tsx +82 -0
- package/src/lib/theme-utils.ts +195 -0
- package/src/lib/utils.ts +6 -0
- package/src/plugin.ts +12 -0
- package/src/test/button.test.tsx +59 -0
- package/src/test/icon.test.tsx +91 -0
- package/src/test/loading-indicator.test.tsx +128 -0
- package/src/test/progress-indicator.test.tsx +306 -0
- package/src/test/setup.ts +80 -0
- package/src/test/typography.test.tsx +206 -0
- package/src/types/index.ts +7 -0
- package/src/types/md3.ts +31 -0
- package/src/ui/Text.tsx +60 -0
- package/src/ui/__snapshots__/divider.test.tsx.snap +63 -0
- package/src/ui/app-bar/app-bar-column.tsx +99 -0
- package/src/ui/app-bar/app-bar-item-button.tsx +71 -0
- package/src/ui/app-bar/app-bar-items.test.tsx +89 -0
- package/src/ui/app-bar/app-bar-overflow-indicator.tsx +108 -0
- package/src/ui/app-bar/app-bar-row.tsx +104 -0
- package/src/ui/app-bar/app-bar.test.tsx +87 -0
- package/src/ui/app-bar/app-bar.tokens.ts +223 -0
- package/src/ui/app-bar/app-bar.types.ts +441 -0
- package/src/ui/app-bar/bottom-app-bar.test.tsx +42 -0
- package/src/ui/app-bar/bottom-app-bar.tsx +84 -0
- package/src/ui/app-bar/docked-toolbar.test.tsx +34 -0
- package/src/ui/app-bar/docked-toolbar.tsx +54 -0
- package/src/ui/app-bar/flexible-app-bar.test.tsx +75 -0
- package/src/ui/app-bar/hooks/use-app-bar-scroll.ts +110 -0
- package/src/ui/app-bar/hooks/use-flexible-app-bar.ts +123 -0
- package/{dist/ui/app-bar/index.d.ts → src/ui/app-bar/index.ts} +35 -2
- package/src/ui/app-bar/large-flexible-app-bar.tsx +165 -0
- package/src/ui/app-bar/medium-flexible-app-bar.tsx +167 -0
- package/src/ui/app-bar/search-app-bar.test.tsx +49 -0
- package/src/ui/app-bar/search-app-bar.tsx +176 -0
- package/src/ui/app-bar/search-view.tsx +227 -0
- package/src/ui/app-bar/small-app-bar.test.tsx +48 -0
- package/src/ui/app-bar/small-app-bar.tsx +203 -0
- package/src/ui/badge.test.tsx +345 -0
- package/src/ui/badge.tsx +282 -0
- package/src/ui/button-group.test.tsx +71 -0
- package/src/ui/button-group.tsx +350 -0
- package/src/ui/button.test.tsx +306 -0
- package/src/ui/button.tsx +665 -0
- package/src/ui/card.test.tsx +187 -0
- package/src/ui/card.tsx +259 -0
- package/src/ui/checkbox.test.tsx +423 -0
- package/src/ui/checkbox.tsx +525 -0
- package/src/ui/chip.test.tsx +292 -0
- package/src/ui/chip.tsx +548 -0
- package/src/ui/code-block.tsx +219 -0
- package/src/ui/dialog.test.tsx +300 -0
- package/src/ui/dialog.tsx +384 -0
- package/src/ui/divider.test.tsx +314 -0
- package/src/ui/divider.tsx +412 -0
- package/src/ui/drawer.tsx +240 -0
- package/src/ui/fab-menu.test.tsx +494 -0
- package/src/ui/fab-menu.tsx +739 -0
- package/src/ui/fab.test.tsx +232 -0
- package/src/ui/fab.tsx +505 -0
- package/src/ui/icon-button.test.tsx +515 -0
- package/src/ui/icon-button.tsx +525 -0
- package/src/ui/icon.test.tsx +197 -0
- package/src/ui/icon.tsx +179 -0
- package/src/ui/loading-indicator.test.tsx +73 -0
- package/src/ui/loading-indicator.tsx +312 -0
- package/src/ui/menu/context-menu.tsx +275 -0
- package/src/ui/menu/index.ts +77 -0
- package/src/ui/menu/menu-animations.ts +102 -0
- package/src/ui/menu/menu-context.tsx +99 -0
- package/src/ui/menu/menu-divider.tsx +47 -0
- package/src/ui/menu/menu-group.tsx +200 -0
- package/src/ui/menu/menu-item.tsx +294 -0
- package/src/ui/menu/menu-tokens.ts +208 -0
- package/src/ui/menu/menu-types.ts +313 -0
- package/src/ui/menu/menu.test.tsx +624 -0
- package/src/ui/menu/menu.tsx +289 -0
- package/src/ui/menu/sub-menu.tsx +223 -0
- package/src/ui/menu/vertical-menu.tsx +382 -0
- package/src/ui/navigation-rail.test.tsx +404 -0
- package/src/ui/navigation-rail.tsx +607 -0
- package/src/ui/progress-indicator/circular.tsx +248 -0
- package/src/ui/progress-indicator/hooks.ts +51 -0
- package/{dist/ui/progress-indicator/index.d.ts → src/ui/progress-indicator/index.tsx} +20 -2
- package/src/ui/progress-indicator/linear-flat.tsx +83 -0
- package/src/ui/progress-indicator/linear-wavy.tsx +243 -0
- package/src/ui/progress-indicator/linear.tsx +143 -0
- package/src/ui/progress-indicator/types.ts +158 -0
- package/src/ui/progress-indicator/utils.ts +73 -0
- package/src/ui/radio-button.test.tsx +407 -0
- package/src/ui/radio-button.tsx +551 -0
- package/src/ui/ripple.test.tsx +72 -0
- package/src/ui/ripple.tsx +234 -0
- package/src/ui/scroll-area.test.tsx +58 -0
- package/src/ui/scroll-area.tsx +139 -0
- package/src/ui/search/animated-placeholder.tsx +145 -0
- package/src/ui/search/hooks/use-search-keyboard.test.ts +202 -0
- package/src/ui/search/hooks/use-search-keyboard.ts +104 -0
- package/src/ui/search/hooks/use-search-view-focus.test.ts +96 -0
- package/src/ui/search/hooks/use-search-view-focus.ts +24 -0
- package/src/ui/search/index.ts +44 -0
- package/src/ui/search/search-bar.tsx +220 -0
- package/src/ui/search/search-context.tsx +42 -0
- package/src/ui/search/search-view-docked.tsx +194 -0
- package/src/ui/search/search-view-fullscreen.tsx +247 -0
- package/src/ui/search/search.test.tsx +233 -0
- package/src/ui/search/search.tokens.ts +134 -0
- package/src/ui/search/search.tsx +131 -0
- package/src/ui/search/search.types.ts +154 -0
- package/src/ui/search/trailing-action.tsx +49 -0
- package/src/ui/shared/constants.ts +135 -0
- package/{dist/ui/shared/touch-target.d.ts → src/ui/shared/touch-target.tsx} +13 -1
- package/src/ui/slider/hooks/useSliderMath.ts +195 -0
- package/{dist/ui/slider/index.d.ts → src/ui/slider/index.ts} +12 -1
- package/src/ui/slider/range-slider.tsx +561 -0
- package/src/ui/slider/slider-thumb.tsx +379 -0
- package/src/ui/slider/slider-track.tsx +912 -0
- package/src/ui/slider/slider.tokens.ts +189 -0
- package/src/ui/slider/slider.tsx +259 -0
- package/src/ui/slider/slider.types.ts +288 -0
- package/src/ui/snackbar/index.ts +20 -0
- package/src/ui/snackbar/snackbar.test.tsx +338 -0
- package/src/ui/snackbar/snackbar.tsx +476 -0
- package/{dist/ui/switch/index.d.ts → src/ui/switch/index.ts} +1 -0
- package/src/ui/switch/switch.stories.tsx +309 -0
- package/src/ui/switch/switch.test.tsx +243 -0
- package/src/ui/switch/switch.tokens.ts +89 -0
- package/src/ui/switch/switch.tsx +504 -0
- package/src/ui/switch/switch.types.ts +62 -0
- package/{dist/ui/tabs/index.d.ts → src/ui/tabs/index.ts} +8 -1
- package/src/ui/tabs/tab.tsx +407 -0
- package/src/ui/tabs/tabs-content.tsx +89 -0
- package/src/ui/tabs/tabs-list.tsx +146 -0
- package/src/ui/tabs/tabs.test.tsx +290 -0
- package/src/ui/tabs/tabs.tokens.ts +121 -0
- package/src/ui/tabs/tabs.tsx +229 -0
- package/src/ui/tabs/tabs.types.ts +185 -0
- package/{dist/ui/text-field/index.d.ts → src/ui/text-field/index.ts} +8 -1
- package/src/ui/text-field/subcomponents/active-indicator.tsx +67 -0
- package/src/ui/text-field/subcomponents/floating-label.tsx +161 -0
- package/src/ui/text-field/subcomponents/leading-icon.tsx +46 -0
- package/src/ui/text-field/subcomponents/outline-container.tsx +170 -0
- package/src/ui/text-field/subcomponents/prefix-suffix.tsx +59 -0
- package/src/ui/text-field/subcomponents/supporting-text.tsx +145 -0
- package/src/ui/text-field/subcomponents/trailing-icon.tsx +199 -0
- package/src/ui/text-field/text-field.test.tsx +454 -0
- package/src/ui/text-field/text-field.tokens.ts +104 -0
- package/src/ui/text-field/text-field.tsx +548 -0
- package/src/ui/text-field/text-field.types.ts +180 -0
- package/src/ui/theme-provider/index.tsx +215 -0
- package/src/ui/toc.test.tsx +108 -0
- package/src/ui/toc.tsx +172 -0
- package/src/ui/tooltip/plain-tooltip.tsx +63 -0
- package/src/ui/tooltip/rich-tooltip.tsx +94 -0
- package/src/ui/tooltip/tooltip-box.tsx +266 -0
- package/src/ui/tooltip/tooltip-caret-shape.tsx +68 -0
- package/src/ui/tooltip/tooltip.tokens.ts +26 -0
- package/src/ui/tooltip/tooltip.types.ts +70 -0
- package/src/ui/tooltip/use-tooltip-position.ts +208 -0
- package/src/ui/tooltip/use-tooltip-state.ts +41 -0
- package/src/ui/typography/__tests__/typography.test.tsx +170 -0
- package/{dist/ui/typography/index.d.ts → src/ui/typography/index.ts} +21 -3
- package/src/ui/typography/type-scale-tokens.ts +205 -0
- package/src/ui/typography/typography-key-tokens.ts +43 -0
- package/src/ui/typography/typography-tokens.ts +360 -0
- package/src/ui/typography/typography.css +22 -0
- package/src/ui/typography/typography.tsx +559 -0
- package/test-render.tsx +4 -0
- package/test-shadow.html +26 -0
- package/test_output.txt +164 -0
- package/test_output_v2.txt +5 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +18 -0
- package/tsup.config.ts +20 -0
- package/vitest.config.ts +11 -0
- package/dist/hooks/useClickOutside.d.ts +0 -8
- package/dist/hooks/useMediaQuery.d.ts +0 -11
- package/dist/hooks/useRipple.d.ts +0 -26
- package/dist/lib/material-symbols-preconnect.d.ts +0 -42
- package/dist/lib/theme-utils.d.ts +0 -63
- package/dist/lib/utils.d.ts +0 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/md3.d.ts +0 -14
- package/dist/ui/app-bar/app-bar-column.d.ts +0 -28
- package/dist/ui/app-bar/app-bar-item-button.d.ts +0 -16
- package/dist/ui/app-bar/app-bar-overflow-indicator.d.ts +0 -18
- package/dist/ui/app-bar/app-bar-row.d.ts +0 -36
- package/dist/ui/app-bar/app-bar.tokens.d.ts +0 -184
- package/dist/ui/app-bar/app-bar.types.d.ts +0 -392
- package/dist/ui/app-bar/bottom-app-bar.d.ts +0 -31
- package/dist/ui/app-bar/docked-toolbar.d.ts +0 -25
- package/dist/ui/app-bar/hooks/use-app-bar-scroll.d.ts +0 -42
- package/dist/ui/app-bar/hooks/use-flexible-app-bar.d.ts +0 -37
- package/dist/ui/app-bar/large-flexible-app-bar.d.ts +0 -26
- package/dist/ui/app-bar/medium-flexible-app-bar.d.ts +0 -28
- package/dist/ui/app-bar/search-app-bar.d.ts +0 -43
- package/dist/ui/app-bar/search-view.d.ts +0 -54
- package/dist/ui/app-bar/small-app-bar.d.ts +0 -37
- package/dist/ui/badge.d.ts +0 -125
- package/dist/ui/button-group.d.ts +0 -59
- package/dist/ui/button.d.ts +0 -148
- package/dist/ui/card.d.ts +0 -62
- package/dist/ui/checkbox.d.ts +0 -82
- package/dist/ui/chip.d.ts +0 -110
- package/dist/ui/code-block.d.ts +0 -14
- package/dist/ui/dialog.d.ts +0 -111
- package/dist/ui/divider.d.ts +0 -164
- package/dist/ui/drawer.d.ts +0 -39
- package/dist/ui/dropdown.d.ts +0 -29
- package/dist/ui/fab-menu.d.ts +0 -204
- package/dist/ui/fab.d.ts +0 -162
- package/dist/ui/icon-button.d.ts +0 -131
- package/dist/ui/icon.d.ts +0 -88
- package/dist/ui/loading-indicator.d.ts +0 -42
- package/dist/ui/navigation-rail.d.ts +0 -29
- package/dist/ui/progress-indicator/circular.d.ts +0 -3
- package/dist/ui/progress-indicator/hooks.d.ts +0 -3
- package/dist/ui/progress-indicator/linear-flat.d.ts +0 -10
- package/dist/ui/progress-indicator/linear-wavy.d.ts +0 -18
- package/dist/ui/progress-indicator/linear.d.ts +0 -3
- package/dist/ui/progress-indicator/types.d.ts +0 -151
- package/dist/ui/progress-indicator/utils.d.ts +0 -3
- package/dist/ui/radio-button.d.ts +0 -106
- package/dist/ui/ripple.d.ts +0 -126
- package/dist/ui/scroll-area.d.ts +0 -27
- package/dist/ui/search/animated-placeholder.d.ts +0 -54
- package/dist/ui/search/hooks/use-search-keyboard.d.ts +0 -32
- package/dist/ui/search/hooks/use-search-view-focus.d.ts +0 -6
- package/dist/ui/search/index.d.ts +0 -27
- package/dist/ui/search/search-bar.d.ts +0 -32
- package/dist/ui/search/search-context.d.ts +0 -24
- package/dist/ui/search/search-view-docked.d.ts +0 -25
- package/dist/ui/search/search-view-fullscreen.d.ts +0 -36
- package/dist/ui/search/search.d.ts +0 -50
- package/dist/ui/search/search.tokens.d.ts +0 -112
- package/dist/ui/search/search.types.d.ts +0 -131
- package/dist/ui/search/trailing-action.d.ts +0 -9
- package/dist/ui/shared/constants.d.ts +0 -86
- package/dist/ui/slider/hooks/useSliderMath.d.ts +0 -101
- package/dist/ui/slider/range-slider.d.ts +0 -47
- package/dist/ui/slider/slider-thumb.d.ts +0 -33
- package/dist/ui/slider/slider-track.d.ts +0 -25
- package/dist/ui/slider/slider.d.ts +0 -60
- package/dist/ui/slider/slider.tokens.d.ts +0 -151
- package/dist/ui/slider/slider.types.d.ts +0 -259
- package/dist/ui/snackbar/index.d.ts +0 -6
- package/dist/ui/snackbar/snackbar.d.ts +0 -197
- package/dist/ui/switch/switch.d.ts +0 -30
- package/dist/ui/switch/switch.stories.d.ts +0 -48
- package/dist/ui/switch/switch.tokens.d.ts +0 -67
- package/dist/ui/switch/switch.types.d.ts +0 -59
- package/dist/ui/tabs/tab.d.ts +0 -43
- package/dist/ui/tabs/tabs-content.d.ts +0 -36
- package/dist/ui/tabs/tabs-list.d.ts +0 -40
- package/dist/ui/tabs/tabs.d.ts +0 -60
- package/dist/ui/tabs/tabs.tokens.d.ts +0 -94
- package/dist/ui/tabs/tabs.types.d.ts +0 -172
- package/dist/ui/text-field/subcomponents/active-indicator.d.ts +0 -24
- package/dist/ui/text-field/subcomponents/floating-label.d.ts +0 -43
- package/dist/ui/text-field/subcomponents/leading-icon.d.ts +0 -23
- package/dist/ui/text-field/subcomponents/outline-container.d.ts +0 -42
- package/dist/ui/text-field/subcomponents/prefix-suffix.d.ts +0 -24
- package/dist/ui/text-field/subcomponents/supporting-text.d.ts +0 -37
- package/dist/ui/text-field/subcomponents/trailing-icon.d.ts +0 -41
- package/dist/ui/text-field/text-field.d.ts +0 -49
- package/dist/ui/text-field/text-field.tokens.d.ts +0 -76
- package/dist/ui/text-field/text-field.types.d.ts +0 -126
- package/dist/ui/theme-provider/index.d.ts +0 -48
- package/dist/ui/toc.d.ts +0 -80
- package/dist/ui/tooltip/plain-tooltip.d.ts +0 -2
- package/dist/ui/tooltip/rich-tooltip.d.ts +0 -2
- package/dist/ui/tooltip/tooltip-box.d.ts +0 -2
- package/dist/ui/tooltip/tooltip-caret-shape.d.ts +0 -9
- package/dist/ui/tooltip/tooltip.tokens.d.ts +0 -26
- package/dist/ui/tooltip/tooltip.types.d.ts +0 -56
- package/dist/ui/tooltip/use-tooltip-position.d.ts +0 -8
- package/dist/ui/tooltip/use-tooltip-state.d.ts +0 -2
- package/dist/ui/typography/type-scale-tokens.d.ts +0 -162
- package/dist/ui/typography/typography-key-tokens.d.ts +0 -40
- package/dist/ui/typography/typography-tokens.d.ts +0 -220
- package/dist/ui/typography/typography.d.ts +0 -265
- /package/{dist/hooks/index.d.ts → src/hooks/index.ts} +0 -0
- /package/{dist/ui/tooltip/index.d.ts → src/ui/tooltip/index.ts} +0 -0
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export declare const WavyLinearTrack: React.NamedExoticComponent<{
|
|
3
|
-
trackHeight: number;
|
|
4
|
-
svgHeight: number;
|
|
5
|
-
amplitude: number;
|
|
6
|
-
wavelength: number;
|
|
7
|
-
indeterminateWavelength: number;
|
|
8
|
-
activeColor: string;
|
|
9
|
-
trackColor: string;
|
|
10
|
-
value?: number;
|
|
11
|
-
isRtl: boolean;
|
|
12
|
-
gapSize: number;
|
|
13
|
-
waveSpeed: number;
|
|
14
|
-
crawlerSpeed: number;
|
|
15
|
-
determinateAnimation: "md3" | "continuous";
|
|
16
|
-
indeterminateAnimation: "md3" | "continuous";
|
|
17
|
-
trackShape: "flat" | "wavy";
|
|
18
|
-
}>;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
2
|
-
export interface ProgressBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
-
/**
|
|
4
|
-
* Giá trị phần trăm tiến trình hiện tại (từ 0 đến 100).
|
|
5
|
-
* Nếu truyền giá trị này, tiến trình sẽ hiển thị ở trạng thái Determinate.
|
|
6
|
-
* Nếu bỏ trống (undefined), tiến trình sẽ tự động ở trạng thái Indeterminate.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* <ProgressIndicator value={45} aria-label="Loading profile..." />
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
value?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Nhan đề mô tả mục đích của thanh tiến trình dành cho screen readers (bắt buộc).
|
|
16
|
-
*/
|
|
17
|
-
"aria-label": string;
|
|
18
|
-
/**
|
|
19
|
-
* Độ dày của track (đường nền) của thanh tiến trình (đơn vị: px).
|
|
20
|
-
* - Với Linear: là chiều cao của thanh.
|
|
21
|
-
* - Với Circular: là độ dày của viền hình tròn.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* trackHeight={8} // Dày hơn bình thường
|
|
25
|
-
*/
|
|
26
|
-
trackHeight?: number;
|
|
27
|
-
/**
|
|
28
|
-
* Màu sắc của phần tiến trình (phần đã hoàn thành).
|
|
29
|
-
* Mặc định mượn màu `currentColor` của thẻ wrap, để dễ dàng tuỳ biến qua utility class.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* color="var(--md-sys-color-primary)" // Sử dụng custom token
|
|
33
|
-
*/
|
|
34
|
-
color?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Màu sắc của thanh nền (phần chưa hoàn thành).
|
|
37
|
-
* Mặc định sử dụng màu được tính toán từ bề mặt hoặc transparency để tạo sự tinh tế.
|
|
38
|
-
*/
|
|
39
|
-
trackColor?: string;
|
|
40
|
-
}
|
|
41
|
-
export interface LinearProgressProps extends ProgressBaseProps {
|
|
42
|
-
/** Phân loại component sang kiểu dáng Linear (đường thẳng ngang). */
|
|
43
|
-
variant: "linear";
|
|
44
|
-
/**
|
|
45
|
-
* Hình dáng của vạch tiến trình (phần đã hoàn thành).
|
|
46
|
-
* - `flat`: Đường nét liền phẳng (mặc định)
|
|
47
|
-
* - `wavy`: Đường lượn sóng động
|
|
48
|
-
*/
|
|
49
|
-
shape?: "flat" | "wavy";
|
|
50
|
-
/**
|
|
51
|
-
* Hình dáng của thanh nền chờ (track).
|
|
52
|
-
* - `flat`: Đường nét liền phẳng (mặc định)
|
|
53
|
-
* - `wavy`: Đường lượn sóng cố định hoặc động
|
|
54
|
-
*/
|
|
55
|
-
trackShape?: "flat" | "wavy";
|
|
56
|
-
/**
|
|
57
|
-
* Biên độ sóng (áp dụng khi `shape` hoặc `trackShape` là "wavy").
|
|
58
|
-
* Chỉ định độ lượn cao thấp của con sóng.
|
|
59
|
-
*/
|
|
60
|
-
amplitude?: number;
|
|
61
|
-
/**
|
|
62
|
-
* Chiều dài một nhịp sóng (áp dụng khi `shape` là "wavy" theo determinate).
|
|
63
|
-
* Khoảng cách giữa 2 đỉnh sóng kề nhau.
|
|
64
|
-
*/
|
|
65
|
-
wavelength?: number;
|
|
66
|
-
/**
|
|
67
|
-
* Nhịp sóng dành riêng cho trạng thái chạy liên tục (Indeterminate Wavy).
|
|
68
|
-
*/
|
|
69
|
-
indeterminateWavelength?: number;
|
|
70
|
-
/**
|
|
71
|
-
* Khoảng hở kết dính giữa cụm vạch đang chạy và thanh nền.
|
|
72
|
-
* Cho phép truyền \`0\` để hai thanh chạm sát vào nhau liền mạch.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```tsx
|
|
76
|
-
* <ProgressIndicator variant="linear" shape="wavy" gapSize={0} /> // Sóng chạm track liền nét
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
gapSize?: number;
|
|
80
|
-
/**
|
|
81
|
-
* Tốc độ dao động vỗ của sóng (Multiplier). Mặc định là \`1\`.
|
|
82
|
-
* Tăng giá trị (VD: 1.5, 2) để sóng dao động nhanh hơn.
|
|
83
|
-
*/
|
|
84
|
-
waveSpeed?: number;
|
|
85
|
-
/**
|
|
86
|
-
* Tốc độ lướt / cuộn dải màu dọc trên track (Crawler) đối với trạng thái Indeterminate.
|
|
87
|
-
* Mặc định là \`1\`.
|
|
88
|
-
*/
|
|
89
|
-
crawlerSpeed?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Cấu hình hiệu ứng gợn khi thanh determinate ở mức xấp xỉ mép viền (<= 10% hoặc >= 90%).
|
|
92
|
-
* - `md3`: Tự động ép phẳng biên độ sóng thành số 0 một cách mềm mại (Chuẩn Google MD3).
|
|
93
|
-
* - `continuous`: Bỏ qua các ràng buộc ép phẳng, con sóng vẫn gợn lấp lóa trên mọi giá trị phần trăm.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```tsx
|
|
97
|
-
* <ProgressIndicator variant="linear" shape="wavy" determinateAnimation="continuous" />
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
determinateAnimation?: "md3" | "continuous";
|
|
101
|
-
/**
|
|
102
|
-
* Kiểu kịch bản tịnh tiến cho thanh Indeterminate.
|
|
103
|
-
* - `md3`: Render 2 vạch song song vọt tới & co giãn mô phỏng vật lý (Chuẩn Google MD3).
|
|
104
|
-
* - `continuous`: Vạch không ngắt quãng mà tràn lướt vòng lặp mượt mà.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```tsx
|
|
108
|
-
* <ProgressIndicator variant="linear" indeterminateAnimation="continuous" />
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
indeterminateAnimation?: "md3" | "continuous";
|
|
112
|
-
/**
|
|
113
|
-
* Bật/tắt dấm chấm điểm báo kết thúc ở cuối track (Stop Indicator).
|
|
114
|
-
* - `true`: Luôn thấy một chấm tròn bé xíu ở cuối đường đi
|
|
115
|
-
* - `false`: Tắt hoàn toàn
|
|
116
|
-
* - `"auto"`: Chấm tròn chỉ hiển thị và hòa trộn khi progress đạt 100%
|
|
117
|
-
*/
|
|
118
|
-
showStopIndicator?: boolean | "auto";
|
|
119
|
-
}
|
|
120
|
-
export interface CircularProgressProps extends ProgressBaseProps {
|
|
121
|
-
/** Phân loại component sang kiểu dáng Circular (hình tròn khép kín). */
|
|
122
|
-
variant: "circular";
|
|
123
|
-
/**
|
|
124
|
-
* Đường kính hiển thị của vòng biểu đồ, đơn vị px.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```tsx
|
|
128
|
-
* <ProgressIndicator variant="circular" size={48} aria-label="Loading..." />
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
size?: number;
|
|
132
|
-
/**
|
|
133
|
-
* Phong cách nét vẽ của đường viền trong trạng thái trượt.
|
|
134
|
-
* - `flat`: Đường nét cứng, vuốt tròn hai đầu stroke.
|
|
135
|
-
* - `wavy`: Vệt màu chuyển động rung tạo hình răng cưa/gợn sóng.
|
|
136
|
-
*/
|
|
137
|
-
shape?: "flat" | "wavy";
|
|
138
|
-
/**
|
|
139
|
-
* Biên độ gợn của trạng thái `wavy` cho vòng tròn.
|
|
140
|
-
*/
|
|
141
|
-
amplitude?: number;
|
|
142
|
-
/** Bước sóng bao trọn chu vi hình tròn. */
|
|
143
|
-
wavelength?: number;
|
|
144
|
-
/** Khoảng hở khe đứt ngang nối đỉnh nét vẽ. */
|
|
145
|
-
gapSize?: number;
|
|
146
|
-
/**
|
|
147
|
-
* Xoay nhanh hay chậm theo số nhân cho Crawler Circular quay Indeterminate.
|
|
148
|
-
*/
|
|
149
|
-
crawlerSpeed?: number;
|
|
150
|
-
}
|
|
151
|
-
export type ProgressIndicatorProps = LinearProgressProps | CircularProgressProps;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function easeInOutCubic(x: number): number;
|
|
2
|
-
export declare function generateWavyCircularPath(center: number, radius: number, amplitude: number, wavelength: number): string;
|
|
3
|
-
export declare function getSinePath(startX: number, endX: number, phase: number, wl: number, amp: number): string;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file radio-button.tsx
|
|
3
|
-
* MD3 Expressive RadioButton — single-select with RadioGroup support.
|
|
4
|
-
* Spec: https://m3.material.io/components/radio-button/overview
|
|
5
|
-
*/
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
/**
|
|
8
|
-
* Color variant for `RadioButton`.
|
|
9
|
-
* - `"primary"` — standard selection (default)
|
|
10
|
-
* - `"error"` — error/invalid state
|
|
11
|
-
*/
|
|
12
|
-
export type RadioButtonColors = "primary" | "error";
|
|
13
|
-
/** Props for `RadioButton`. */
|
|
14
|
-
export interface RadioButtonProps {
|
|
15
|
-
/** Whether this radio is selected. */
|
|
16
|
-
selected?: boolean;
|
|
17
|
-
/** Initial selected state (uncontrolled). @default false */
|
|
18
|
-
defaultSelected?: boolean;
|
|
19
|
-
/** Called when user clicks. Pass `null` to disable interaction. */
|
|
20
|
-
onClick?: (() => void) | null;
|
|
21
|
-
/** Disables the radio — visual disabled state + no interaction. @default false */
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
/** Color variant. @default "primary" */
|
|
24
|
-
color?: RadioButtonColors;
|
|
25
|
-
/** Error state — changes colors to `m3-error`. @default false */
|
|
26
|
-
error?: boolean;
|
|
27
|
-
/** Adjacent label text. Renders a `<label>` wrapper. */
|
|
28
|
-
label?: string;
|
|
29
|
-
/** Value used for form submission. */
|
|
30
|
-
value?: string;
|
|
31
|
-
/** Name for grouping (used in RadioGroup context). */
|
|
32
|
-
name?: string;
|
|
33
|
-
/** ID for the hidden `<input>`. Auto-generated when `label` is set. */
|
|
34
|
-
id?: string;
|
|
35
|
-
/** Extra class names on the outermost wrapper. */
|
|
36
|
-
className?: string;
|
|
37
|
-
/** ARIA label for the radio when no visible label exists. */
|
|
38
|
-
"aria-label"?: string;
|
|
39
|
-
"aria-labelledby"?: string;
|
|
40
|
-
"aria-describedby"?: string;
|
|
41
|
-
/** Whether the radio is required for form submission. */
|
|
42
|
-
required?: boolean;
|
|
43
|
-
/** Ref to the hidden `<input type="radio">`. */
|
|
44
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
45
|
-
}
|
|
46
|
-
/** Props for `RadioGroup`. */
|
|
47
|
-
export interface RadioGroupProps {
|
|
48
|
-
/** The name attribute shared across all child RadioButtons. */
|
|
49
|
-
name: string;
|
|
50
|
-
/** The currently selected value (controlled). */
|
|
51
|
-
value?: string;
|
|
52
|
-
/** Default value (uncontrolled). */
|
|
53
|
-
defaultValue?: string;
|
|
54
|
-
/** Called when selection changes. */
|
|
55
|
-
onValueChange?: (value: string) => void;
|
|
56
|
-
/** Disables all radio buttons in the group. */
|
|
57
|
-
disabled?: boolean;
|
|
58
|
-
/** Error state for the entire group. */
|
|
59
|
-
error?: boolean;
|
|
60
|
-
/** Label for the group (renders as visually hidden or visible heading). */
|
|
61
|
-
label?: string;
|
|
62
|
-
/** ID of an external element that labels this group. */
|
|
63
|
-
"aria-labelledby"?: string;
|
|
64
|
-
/** Direction of layout. @default "vertical" */
|
|
65
|
-
orientation?: "horizontal" | "vertical";
|
|
66
|
-
/** Whether at least one radio in the group must be selected. */
|
|
67
|
-
required?: boolean;
|
|
68
|
-
children: React.ReactNode;
|
|
69
|
-
className?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* MD3 Expressive RadioButton component.
|
|
73
|
-
*
|
|
74
|
-
* Single-select control. Supports standalone (controlled/uncontrolled) and
|
|
75
|
-
* `RadioGroup` context. Animated per MD3 spec: inner dot radius morph,
|
|
76
|
-
* outer ring color transition, state layer, and ripple.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```tsx
|
|
80
|
-
* <RadioButton selected={isSelected} onClick={() => setSelected(true)} label="Option A" />
|
|
81
|
-
*
|
|
82
|
-
* <RadioGroup name="plan" value={plan} onValueChange={setPlan}>
|
|
83
|
-
* <RadioButton value="free" label="Free" />
|
|
84
|
-
* <RadioButton value="pro" label="Pro" />
|
|
85
|
-
* </RadioGroup>
|
|
86
|
-
* ```
|
|
87
|
-
* @see https://m3.material.io/components/radio-button/overview
|
|
88
|
-
*/
|
|
89
|
-
export declare const RadioButton: React.NamedExoticComponent<Omit<RadioButtonProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
90
|
-
/**
|
|
91
|
-
* MD3 Expressive RadioGroup component.
|
|
92
|
-
*
|
|
93
|
-
* Groups multiple `RadioButton` components under a shared `name` with keyboard
|
|
94
|
-
* navigation (Arrow keys with wrapping) and ARIA `radiogroup` semantics.
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```tsx
|
|
98
|
-
* <RadioGroup name="theme" value={theme} onValueChange={setTheme} label="Theme">
|
|
99
|
-
* <RadioButton value="light" label="Light" />
|
|
100
|
-
* <RadioButton value="dark" label="Dark" />
|
|
101
|
-
* <RadioButton value="system" label="System" />
|
|
102
|
-
* </RadioGroup>
|
|
103
|
-
* ```
|
|
104
|
-
* @see https://m3.material.io/components/radio-button/overview
|
|
105
|
-
*/
|
|
106
|
-
export declare const RadioGroup: React.NamedExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/ui/ripple.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Represents a single ripple wave instance with position and size metadata.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```tsx
|
|
7
|
-
* const ripple: RippleOrigin = { id: Date.now(), x: 50, y: 30, size: 200 };
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export interface RippleOrigin {
|
|
11
|
-
/** Unique identifier used as React key and for removal. */
|
|
12
|
-
id: number;
|
|
13
|
-
/** X coordinate of the pointer event relative to the container's left edge (px). */
|
|
14
|
-
x: number;
|
|
15
|
-
/** Y coordinate of the pointer event relative to the container's top edge (px). */
|
|
16
|
-
y: number;
|
|
17
|
-
/**
|
|
18
|
-
* Diameter of the ripple circle (px).
|
|
19
|
-
* Typically `Math.hypot(width, height) * 2` to ensure it fills the container.
|
|
20
|
-
*/
|
|
21
|
-
size: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Props for the `Ripple` presentation component.
|
|
25
|
-
*/
|
|
26
|
-
export interface RippleProps {
|
|
27
|
-
/** Active ripple instances to render. Managed by the parent via `useRipple`. */
|
|
28
|
-
ripples: RippleOrigin[];
|
|
29
|
-
/** Called when a ripple's exit animation completes — remove it from state. */
|
|
30
|
-
onRippleDone: (id: number) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Completely disables the ripple effect.
|
|
33
|
-
* Use this when the parent element is disabled or interaction is not desired.
|
|
34
|
-
* @default false
|
|
35
|
-
*/
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* When `true`, the ripple respects the user's OS-level
|
|
39
|
-
* `prefers-reduced-motion` accessibility setting and renders nothing if active.
|
|
40
|
-
*
|
|
41
|
-
* Set to `false` to always show ripples regardless of system preference.
|
|
42
|
-
* @default true
|
|
43
|
-
*/
|
|
44
|
-
respectSystemMotion?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* MD3 Expressive Ripple — animated touch-feedback wave layer.
|
|
48
|
-
*
|
|
49
|
-
* Renders absolutely-positioned ripple circles inside an `overflow-hidden`
|
|
50
|
-
* container. Must be placed as a direct child of the interactive element.
|
|
51
|
-
*
|
|
52
|
-
* @remarks
|
|
53
|
-
* - The parent element **must** have `overflow: hidden` and `position: relative`
|
|
54
|
-
* (or equivalent) for clipping to work correctly.
|
|
55
|
-
* - Set `disabled` to `true` on parent's disabled state to avoid stale ripples.
|
|
56
|
-
* - The ripple color is `currentColor` at 12% opacity — matching MD3 state layer spec.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```tsx
|
|
60
|
-
* const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
61
|
-
*
|
|
62
|
-
* <button onPointerDown={onPointerDown} className="relative overflow-hidden">
|
|
63
|
-
* <Ripple ripples={ripples} onRippleDone={removeRipple} />
|
|
64
|
-
* Click me
|
|
65
|
-
* </button>
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @see {@link useRippleState} for the state management hook
|
|
69
|
-
* @see https://m3.material.io/foundations/interaction/states/overview
|
|
70
|
-
*/
|
|
71
|
-
export declare function Ripple({ ripples, onRippleDone, disabled, respectSystemMotion, }: RippleProps): import("react/jsx-runtime").JSX.Element | null;
|
|
72
|
-
/**
|
|
73
|
-
* Options for configuring `useRippleState` behaviour.
|
|
74
|
-
*/
|
|
75
|
-
export interface UseRippleStateOptions {
|
|
76
|
-
/**
|
|
77
|
-
* When `true`, the ripple is suppressed — `onPointerDown` becomes a no-op.
|
|
78
|
-
* Use this to sync the ripple with the parent element's `disabled` state.
|
|
79
|
-
* @default false
|
|
80
|
-
*/
|
|
81
|
-
disabled?: boolean;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* `useRippleState` — state manager for MD3 Expressive ripple waves.
|
|
85
|
-
*
|
|
86
|
-
* Tracks active ripple instances and provides pointer event handlers.
|
|
87
|
-
* Pair with the `<Ripple>` component for rendering.
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* This hook only manages ripple *state* (coordinates, size, lifecycle).
|
|
91
|
-
* The actual animation is handled by `<Ripple>` via Framer Motion.
|
|
92
|
-
* Respecting `prefers-reduced-motion` is handled by `<Ripple>` itself.
|
|
93
|
-
*
|
|
94
|
-
* @param options - Configuration options. See {@link UseRippleStateOptions}.
|
|
95
|
-
* @returns `{ ripples, onPointerDown, removeRipple }` — bind to the interactive element.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```tsx
|
|
99
|
-
* function MyButton({ disabled, children }) {
|
|
100
|
-
* const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
101
|
-
*
|
|
102
|
-
* return (
|
|
103
|
-
* <button
|
|
104
|
-
* disabled={disabled}
|
|
105
|
-
* onPointerDown={onPointerDown}
|
|
106
|
-
* className="relative overflow-hidden"
|
|
107
|
-
* >
|
|
108
|
-
* <Ripple ripples={ripples} onRippleDone={removeRipple} disabled={disabled} />
|
|
109
|
-
* {children}
|
|
110
|
-
* </button>
|
|
111
|
-
* );
|
|
112
|
-
* }
|
|
113
|
-
* ```
|
|
114
|
-
*
|
|
115
|
-
* @see {@link Ripple} for the rendering component
|
|
116
|
-
*/
|
|
117
|
-
export declare function useRippleState(options?: UseRippleStateOptions): {
|
|
118
|
-
ripples: RippleOrigin[];
|
|
119
|
-
onPointerDown: (e: React.PointerEvent<HTMLElement>) => void;
|
|
120
|
-
removeRipple: (id: number) => void;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* @deprecated Use `useRippleState` instead. This alias will be removed in a future version.
|
|
124
|
-
* @see {@link useRippleState}
|
|
125
|
-
*/
|
|
126
|
-
export declare const useRipple: typeof useRippleState;
|
package/dist/ui/scroll-area.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as RadixScrollArea from "@radix-ui/react-scroll-area";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
/** Radix accepts hover/scroll/always/auto. We add 'none' as a UI-only hide. */
|
|
4
|
-
export type ScrollAreaType = "hover" | "scroll" | "always" | "none";
|
|
5
|
-
export type ScrollAreaOrientation = "vertical" | "horizontal" | "both";
|
|
6
|
-
export interface ScrollAreaProps extends Omit<React.ComponentPropsWithoutRef<typeof RadixScrollArea.Root>, "type"> {
|
|
7
|
-
/**
|
|
8
|
-
* Controls when the scrollbars are visible.
|
|
9
|
-
* - `hover`: Show on hover (default, recommended for desktop)
|
|
10
|
-
* - `scroll`: Show only while scrolling (recommended for mobile)
|
|
11
|
-
* - `always`: Always visible
|
|
12
|
-
* - `none`: Never visible
|
|
13
|
-
*/
|
|
14
|
-
type?: ScrollAreaType;
|
|
15
|
-
/**
|
|
16
|
-
* The scrollbar orientation to render.
|
|
17
|
-
* @default "vertical"
|
|
18
|
-
*/
|
|
19
|
-
orientation?: ScrollAreaOrientation;
|
|
20
|
-
/** Delay in ms before scrollbars hide when `type` is `hover` or `scroll`. */
|
|
21
|
-
scrollHideDelay?: number;
|
|
22
|
-
/** Extra classes applied to the inner viewport element. */
|
|
23
|
-
viewportClassName?: string;
|
|
24
|
-
}
|
|
25
|
-
declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
-
declare const ScrollAreaScrollbar: React.ForwardRefExoticComponent<Omit<RadixScrollArea.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
-
export { ScrollArea, ScrollAreaScrollbar };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file animated-placeholder.tsx
|
|
3
|
-
* MD3 Expressive Search — Animated placeholder overlay.
|
|
4
|
-
*
|
|
5
|
-
* Replaces the native `::placeholder` with a GPU-accelerated `translateX`
|
|
6
|
-
* animation so the placeholder text can smoothly slide from its alignment
|
|
7
|
-
* position (center / right) to left when the search input is focused.
|
|
8
|
-
*
|
|
9
|
-
* Implementation notes:
|
|
10
|
-
* - Only `transform: translateX` is animated → no layout triggers, no paint.
|
|
11
|
-
* - Container width is measured once via `useLayoutEffect` (before paint) to
|
|
12
|
-
* avoid a first-render flash, then kept fresh via `ResizeObserver`.
|
|
13
|
-
* - xOffset is stored in `useState` so Framer Motion picks up changes and
|
|
14
|
-
* re-animates smoothly on container resize.
|
|
15
|
-
* - The span is never unmounted — only opacity-toggled — to preserve the
|
|
16
|
-
* measurement ref between renders.
|
|
17
|
-
*/
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
interface AnimatedPlaceholderProps {
|
|
20
|
-
/** Placeholder text to display. */
|
|
21
|
-
text: string;
|
|
22
|
-
/** Alignment of the placeholder when idle (not focused). @default "left" */
|
|
23
|
-
textAlign: "left" | "center" | "right";
|
|
24
|
-
/**
|
|
25
|
-
* Whether the placeholder should be visible.
|
|
26
|
-
* Pass `!query` — hide when the user has typed something.
|
|
27
|
-
*/
|
|
28
|
-
visible: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Whether the search is in an active/focused state.
|
|
31
|
-
* When `true`, the placeholder snaps to `left` regardless of `textAlign`.
|
|
32
|
-
*/
|
|
33
|
-
focused: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* The `<input>` element that this component wraps.
|
|
36
|
-
* It should have `w-full` instead of `flex-1` since this wrapper
|
|
37
|
-
* takes over the `flex-1` role in the parent flex layout.
|
|
38
|
-
*/
|
|
39
|
-
children: React.ReactNode;
|
|
40
|
-
/** Extra className forwarded to the wrapper div. */
|
|
41
|
-
className?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Wraps a search `<input>` with an animated placeholder overlay.
|
|
45
|
-
*
|
|
46
|
-
* The wrapper div occupies `flex-1` so it fits seamlessly in the
|
|
47
|
-
* horizontal flex layout used by search bar headers. The children
|
|
48
|
-
* (the `<input>`) should use `w-full` to fill the wrapper.
|
|
49
|
-
*
|
|
50
|
-
* Accessibility: `aria-label` on the `<input>` carries the placeholder
|
|
51
|
-
* text for screen readers; this span is `aria-hidden="true"`.
|
|
52
|
-
*/
|
|
53
|
-
export declare function AnimatedPlaceholder({ text, textAlign, visible, focused, children, className, }: AnimatedPlaceholderProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file use-search-keyboard.ts
|
|
3
|
-
* Keyboard navigation hook for the MD3 Search component.
|
|
4
|
-
*
|
|
5
|
-
* Handles:
|
|
6
|
-
* - ArrowDown / ArrowUp → navigate through suggestions (role="option")
|
|
7
|
-
* - Enter → submit search or select active suggestion
|
|
8
|
-
* - Escape → close the SearchView
|
|
9
|
-
*/
|
|
10
|
-
import type { UseSearchKeyboardReturn } from "../search.types";
|
|
11
|
-
interface UseSearchKeyboardOptions {
|
|
12
|
-
/** Whether the SearchView is currently open. */
|
|
13
|
-
active: boolean;
|
|
14
|
-
/** Callback to close the SearchView. */
|
|
15
|
-
onActiveChange: (active: boolean) => void;
|
|
16
|
-
/** Callback for search submission. */
|
|
17
|
-
onSearch: (query: string) => void;
|
|
18
|
-
/** Current search query. */
|
|
19
|
-
query: string;
|
|
20
|
-
/** Total number of suggestion items in the listbox. */
|
|
21
|
-
itemCount: number;
|
|
22
|
-
/** Called when user selects a specific suggestion by index. */
|
|
23
|
-
onSelectSuggestion?: (index: number) => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Manages keyboard navigation for the Search component.
|
|
27
|
-
*
|
|
28
|
-
* Complies with WAI-ARIA Combobox pattern:
|
|
29
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
30
|
-
*/
|
|
31
|
-
export declare function useSearchKeyboard({ active, onActiveChange, onSearch, query, itemCount, onSelectSuggestion, }: UseSearchKeyboardOptions): UseSearchKeyboardReturn;
|
|
32
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Focuses `inputRef` when `active` becomes true, using a double-rAF
|
|
4
|
-
* to wait for Framer Motion's layout animation to finish painting.
|
|
5
|
-
*/
|
|
6
|
-
export declare function useSearchViewFocus(inputRef: React.RefObject<HTMLInputElement | null>, active: boolean): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file index.ts
|
|
3
|
-
* MD3 Expressive Search — Public API exports.
|
|
4
|
-
*
|
|
5
|
-
* Components:
|
|
6
|
-
* - Search: Orchestrator (SearchBar + SearchView)
|
|
7
|
-
* - SearchBar: Collapsed pill state (standalone use)
|
|
8
|
-
* - SearchViewDocked: Expanded docked popup (standalone use)
|
|
9
|
-
* - SearchViewFullScreen: Expanded full-screen overlay (standalone use)
|
|
10
|
-
*
|
|
11
|
-
* Hook:
|
|
12
|
-
* - useSearchKeyboard: WAI-ARIA combobox keyboard navigation
|
|
13
|
-
*
|
|
14
|
-
* Tokens:
|
|
15
|
-
* - SearchTokens: Dimensional tokens (heights, sizes)
|
|
16
|
-
* - SEARCH_COLORS: CSS custom property color references
|
|
17
|
-
* - SEARCH_TYPOGRAPHY: Typography class strings
|
|
18
|
-
* - Animation constants
|
|
19
|
-
*/
|
|
20
|
-
export { useSearchKeyboard } from "./hooks/use-search-keyboard";
|
|
21
|
-
export { Search } from "./search";
|
|
22
|
-
export { SEARCH_BAR_EXIT_SPRING, SEARCH_BAR_EXPAND_SPRING, SEARCH_COLORS, SEARCH_DOCKED_REVEAL_SPRING, SEARCH_FULLSCREEN_SPRING, SEARCH_TYPOGRAPHY, SearchTokens, } from "./search.tokens";
|
|
23
|
-
export type { SearchProps, SearchStyleType, SearchVariant, } from "./search.types";
|
|
24
|
-
export { SearchBar } from "./search-bar";
|
|
25
|
-
export { useSearch } from "./search-context";
|
|
26
|
-
export { SearchViewDocked } from "./search-view-docked";
|
|
27
|
-
export { SearchViewFullScreen } from "./search-view-fullscreen";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file search-bar.tsx
|
|
3
|
-
* MD3 Expressive SearchBar — Collapsed state.
|
|
4
|
-
*
|
|
5
|
-
* Renders a pill-shaped search bar (CornerFull, h-56px).
|
|
6
|
-
* When focused/clicked → calls onActiveChange(true) to open SearchView.
|
|
7
|
-
*
|
|
8
|
-
* Option B (MD3 morphing): SearchBar is wrapped in its own AnimatePresence
|
|
9
|
-
* with mode="popLayout". When SearchView opens, SearchBar plays an exit
|
|
10
|
-
* animation (opacity → 0, scale → 0.95) before unmounting, releasing the
|
|
11
|
-
* shared layoutId so SearchView can claim it and morph from the same origin.
|
|
12
|
-
*
|
|
13
|
-
* Role: combobox (WAI-ARIA Search Combobox pattern).
|
|
14
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
15
|
-
*/
|
|
16
|
-
import * as React from "react";
|
|
17
|
-
import type { SearchInternalProps, SearchProps } from "./search.types";
|
|
18
|
-
type SearchBarProps = Pick<SearchProps, "query" | "onQueryChange" | "onSearch" | "active" | "onActiveChange" | "leadingIcon" | "trailingIcon" | "placeholder" | "textAlign" | "className" | "aria-label"> & SearchInternalProps & {
|
|
19
|
-
/** KeyDown handler from useSearchKeyboard. */
|
|
20
|
-
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
21
|
-
/** Currently highlighted suggestion index (-1 = none). */
|
|
22
|
-
activeIndex: number;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* SearchBar — collapsed state of the MD3 Search component.
|
|
26
|
-
*
|
|
27
|
-
* Uses Framer Motion `layout` + shared `layoutId` to morph into
|
|
28
|
-
* SearchView when active. Wrapped in AnimatePresence with mode="popLayout"
|
|
29
|
-
* so it exits (fades/scales out) before SearchView claims the layoutId.
|
|
30
|
-
*/
|
|
31
|
-
export declare function SearchBar({ query, onQueryChange, onSearch, active, onActiveChange, leadingIcon, trailingIcon, placeholder, textAlign, className, "aria-label": ariaLabel, searchId, listboxId, onKeyDown, activeIndex, }: SearchBarProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* MD3 Expressive Search Context
|
|
4
|
-
* Shared state for the Search orchestrator and its children.
|
|
5
|
-
*/
|
|
6
|
-
interface SearchContextValue {
|
|
7
|
-
/** Unique ID for the results listbox, used for aria-controls. */
|
|
8
|
-
listboxId: string;
|
|
9
|
-
/** Currently highlighted suggestion index. -1 = none. */
|
|
10
|
-
activeIndex: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Provider for Search component state.
|
|
14
|
-
* Internal use only within the library.
|
|
15
|
-
*/
|
|
16
|
-
export declare function SearchProvider({ children, value, }: {
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
value: SearchContextValue;
|
|
19
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
/**
|
|
21
|
-
* Hook to access Search state from children (e.g., search items).
|
|
22
|
-
*/
|
|
23
|
-
export declare function useSearch(): SearchContextValue;
|
|
24
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file search-view-docked.tsx
|
|
3
|
-
* MD3 Expressive SearchView — Docked variant.
|
|
4
|
-
*
|
|
5
|
-
* Displays as a popup dropdown below the SearchBar.
|
|
6
|
-
* Recommended for medium and large screens (tablets, desktops).
|
|
7
|
-
*
|
|
8
|
-
* Shape: CornerExtraLarge (rounded-[28px]) per SearchViewTokens.DockedContainerShape.
|
|
9
|
-
* Header height: 56dp per SearchViewTokens.DockedHeaderContainerHeight.
|
|
10
|
-
*
|
|
11
|
-
* Animation (Option B — MD3 morphing):
|
|
12
|
-
* - Shares `layoutId` with SearchBar. After SearchBar exits via its own
|
|
13
|
-
* AnimatePresence (mode="popLayout"), this view claims the layoutId and
|
|
14
|
-
* Framer Motion morphs the pill shape → rounded-[28px] container.
|
|
15
|
-
* - Uses mode="popLayout" so SearchBar can re-enter after this exits.
|
|
16
|
-
* - Focus: double-rAF pattern syncs focus with layout animation frame.
|
|
17
|
-
*/
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import type { SearchInternalProps, SearchProps } from "./search.types";
|
|
20
|
-
type SearchViewDockedProps = Pick<SearchProps, "query" | "onQueryChange" | "onSearch" | "active" | "onActiveChange" | "leadingIcon" | "trailingIcon" | "placeholder" | "textAlign" | "styleType" | "hasGap" | "children" | "viewClassName" | "aria-label"> & SearchInternalProps & {
|
|
21
|
-
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
22
|
-
activeIndex: number;
|
|
23
|
-
};
|
|
24
|
-
export declare function SearchViewDocked({ query, onQueryChange, onSearch, active, onActiveChange, leadingIcon, trailingIcon, placeholder, textAlign, styleType, hasGap, children, viewClassName, "aria-label": ariaLabel, searchId, listboxId, onKeyDown, activeIndex, }: SearchViewDockedProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {};
|