@bug-on/md3-react 2.0.2 → 3.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.
Files changed (296) hide show
  1. package/.turbo/turbo-build.log +33 -0
  2. package/CHANGELOG.md +55 -0
  3. package/dist/index.css +23 -0
  4. package/dist/index.css.d.ts +2 -0
  5. package/dist/index.d.mts +6127 -0
  6. package/dist/index.d.ts +6127 -69
  7. package/dist/index.js +2536 -665
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2443 -603
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/material-symbols-cdn.css.d.ts +2 -0
  12. package/dist/material-symbols-self-hosted.css.d.ts +2 -0
  13. package/dist/typography.css.d.ts +2 -0
  14. package/package.json +23 -19
  15. package/scripts/copy-assets.js +82 -0
  16. package/src/assets/fonts/GoogleSansFlex-VariableFont.woff2 +0 -0
  17. package/src/assets/fonts/MaterialSymbolsOutlined-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
  18. package/src/assets/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
  19. package/src/assets/fonts/MaterialSymbolsSharp-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
  20. package/src/assets/loading-indicator.svg +19 -0
  21. package/src/assets/material-symbols-cdn.css +65 -0
  22. package/src/assets/material-symbols-self-hosted.css +90 -0
  23. package/src/css.d.ts +20 -0
  24. package/{dist/hooks/index.d.ts → src/hooks/index.ts} +1 -0
  25. package/src/hooks/useClickOutside.ts +37 -0
  26. package/src/hooks/useMediaQuery.ts +28 -0
  27. package/src/hooks/useRipple.ts +88 -0
  28. package/src/index.css +23 -0
  29. package/src/index.ts +349 -0
  30. package/src/lib/material-symbols-preconnect.tsx +82 -0
  31. package/src/lib/theme-utils.ts +180 -0
  32. package/src/lib/utils.ts +6 -0
  33. package/src/test/button.test.tsx +59 -0
  34. package/src/test/icon.test.tsx +91 -0
  35. package/src/test/loading-indicator.test.tsx +128 -0
  36. package/src/test/progress-indicator.test.tsx +306 -0
  37. package/src/test/setup.ts +80 -0
  38. package/src/test/typography.test.tsx +206 -0
  39. package/src/types/index.ts +7 -0
  40. package/src/types/md3.ts +31 -0
  41. package/src/ui/Text.tsx +60 -0
  42. package/src/ui/__snapshots__/divider.test.tsx.snap +63 -0
  43. package/src/ui/app-bar/app-bar-column.tsx +99 -0
  44. package/src/ui/app-bar/app-bar-item-button.tsx +71 -0
  45. package/src/ui/app-bar/app-bar-items.test.tsx +89 -0
  46. package/src/ui/app-bar/app-bar-overflow-indicator.tsx +108 -0
  47. package/src/ui/app-bar/app-bar-row.tsx +104 -0
  48. package/src/ui/app-bar/app-bar.test.tsx +87 -0
  49. package/src/ui/app-bar/app-bar.tokens.ts +223 -0
  50. package/src/ui/app-bar/app-bar.types.ts +441 -0
  51. package/src/ui/app-bar/bottom-app-bar.test.tsx +42 -0
  52. package/src/ui/app-bar/bottom-app-bar.tsx +84 -0
  53. package/src/ui/app-bar/docked-toolbar.test.tsx +34 -0
  54. package/src/ui/app-bar/docked-toolbar.tsx +54 -0
  55. package/src/ui/app-bar/flexible-app-bar.test.tsx +75 -0
  56. package/src/ui/app-bar/hooks/use-app-bar-scroll.ts +110 -0
  57. package/src/ui/app-bar/hooks/use-flexible-app-bar.ts +123 -0
  58. package/{dist/ui/app-bar/index.d.ts → src/ui/app-bar/index.ts} +35 -2
  59. package/src/ui/app-bar/large-flexible-app-bar.tsx +165 -0
  60. package/src/ui/app-bar/medium-flexible-app-bar.tsx +167 -0
  61. package/src/ui/app-bar/search-app-bar.test.tsx +49 -0
  62. package/src/ui/app-bar/search-app-bar.tsx +176 -0
  63. package/src/ui/app-bar/search-view.tsx +227 -0
  64. package/src/ui/app-bar/small-app-bar.test.tsx +48 -0
  65. package/src/ui/app-bar/small-app-bar.tsx +203 -0
  66. package/src/ui/badge.test.tsx +345 -0
  67. package/src/ui/badge.tsx +282 -0
  68. package/src/ui/button-group.test.tsx +71 -0
  69. package/src/ui/button-group.tsx +350 -0
  70. package/src/ui/button.test.tsx +297 -0
  71. package/src/ui/button.tsx +669 -0
  72. package/src/ui/card.test.tsx +187 -0
  73. package/src/ui/card.tsx +259 -0
  74. package/src/ui/checkbox.test.tsx +423 -0
  75. package/src/ui/checkbox.tsx +525 -0
  76. package/src/ui/chip.test.tsx +292 -0
  77. package/src/ui/chip.tsx +548 -0
  78. package/src/ui/code-block.tsx +219 -0
  79. package/src/ui/dialog.test.tsx +300 -0
  80. package/src/ui/dialog.tsx +384 -0
  81. package/src/ui/divider.test.tsx +314 -0
  82. package/src/ui/divider.tsx +412 -0
  83. package/src/ui/drawer.tsx +240 -0
  84. package/src/ui/fab-menu.test.tsx +494 -0
  85. package/src/ui/fab-menu.tsx +739 -0
  86. package/src/ui/fab.test.tsx +232 -0
  87. package/src/ui/fab.tsx +505 -0
  88. package/src/ui/icon-button.test.tsx +515 -0
  89. package/src/ui/icon-button.tsx +525 -0
  90. package/src/ui/icon.test.tsx +197 -0
  91. package/src/ui/icon.tsx +179 -0
  92. package/src/ui/loading-indicator.test.tsx +73 -0
  93. package/src/ui/loading-indicator.tsx +312 -0
  94. package/src/ui/menu/context-menu.tsx +275 -0
  95. package/src/ui/menu/index.ts +77 -0
  96. package/src/ui/menu/menu-animations.ts +102 -0
  97. package/src/ui/menu/menu-context.tsx +99 -0
  98. package/src/ui/menu/menu-divider.tsx +47 -0
  99. package/src/ui/menu/menu-group.tsx +200 -0
  100. package/src/ui/menu/menu-item.tsx +294 -0
  101. package/src/ui/menu/menu-tokens.ts +208 -0
  102. package/src/ui/menu/menu-types.ts +313 -0
  103. package/src/ui/menu/menu.test.tsx +624 -0
  104. package/src/ui/menu/menu.tsx +289 -0
  105. package/src/ui/menu/sub-menu.tsx +223 -0
  106. package/src/ui/menu/vertical-menu.tsx +382 -0
  107. package/src/ui/navigation-rail.test.tsx +404 -0
  108. package/src/ui/navigation-rail.tsx +604 -0
  109. package/src/ui/progress-indicator/circular.tsx +248 -0
  110. package/src/ui/progress-indicator/hooks.ts +51 -0
  111. package/{dist/ui/progress-indicator/index.d.ts → src/ui/progress-indicator/index.tsx} +20 -2
  112. package/src/ui/progress-indicator/linear-flat.tsx +83 -0
  113. package/src/ui/progress-indicator/linear-wavy.tsx +243 -0
  114. package/src/ui/progress-indicator/linear.tsx +143 -0
  115. package/src/ui/progress-indicator/types.ts +158 -0
  116. package/src/ui/progress-indicator/utils.ts +73 -0
  117. package/src/ui/radio-button.test.tsx +407 -0
  118. package/src/ui/radio-button.tsx +551 -0
  119. package/src/ui/ripple.test.tsx +72 -0
  120. package/src/ui/ripple.tsx +234 -0
  121. package/src/ui/scroll-area.test.tsx +58 -0
  122. package/src/ui/scroll-area.tsx +139 -0
  123. package/src/ui/search/animated-placeholder.tsx +145 -0
  124. package/src/ui/search/hooks/use-search-keyboard.test.ts +202 -0
  125. package/src/ui/search/hooks/use-search-keyboard.ts +104 -0
  126. package/src/ui/search/hooks/use-search-view-focus.test.ts +96 -0
  127. package/src/ui/search/hooks/use-search-view-focus.ts +24 -0
  128. package/src/ui/search/index.ts +44 -0
  129. package/src/ui/search/search-bar.tsx +220 -0
  130. package/src/ui/search/search-context.tsx +42 -0
  131. package/src/ui/search/search-view-docked.tsx +194 -0
  132. package/src/ui/search/search-view-fullscreen.tsx +247 -0
  133. package/src/ui/search/search.test.tsx +233 -0
  134. package/src/ui/search/search.tokens.ts +134 -0
  135. package/src/ui/search/search.tsx +131 -0
  136. package/src/ui/search/search.types.ts +154 -0
  137. package/src/ui/search/trailing-action.tsx +49 -0
  138. package/src/ui/shared/constants.ts +122 -0
  139. package/{dist/ui/shared/touch-target.d.ts → src/ui/shared/touch-target.tsx} +13 -1
  140. package/src/ui/slider/hooks/useSliderMath.ts +195 -0
  141. package/{dist/ui/slider/index.d.ts → src/ui/slider/index.ts} +12 -1
  142. package/src/ui/slider/range-slider.tsx +561 -0
  143. package/src/ui/slider/slider-thumb.tsx +379 -0
  144. package/src/ui/slider/slider-track.tsx +912 -0
  145. package/src/ui/slider/slider.tokens.ts +189 -0
  146. package/src/ui/slider/slider.tsx +259 -0
  147. package/src/ui/slider/slider.types.ts +288 -0
  148. package/src/ui/snackbar/index.ts +20 -0
  149. package/src/ui/snackbar/snackbar.test.tsx +338 -0
  150. package/src/ui/snackbar/snackbar.tsx +476 -0
  151. package/{dist/ui/switch/index.d.ts → src/ui/switch/index.ts} +1 -0
  152. package/src/ui/switch/switch.stories.tsx +309 -0
  153. package/src/ui/switch/switch.test.tsx +243 -0
  154. package/src/ui/switch/switch.tokens.ts +89 -0
  155. package/src/ui/switch/switch.tsx +504 -0
  156. package/src/ui/switch/switch.types.ts +62 -0
  157. package/{dist/ui/tabs/index.d.ts → src/ui/tabs/index.ts} +8 -1
  158. package/src/ui/tabs/tab.tsx +407 -0
  159. package/src/ui/tabs/tabs-content.tsx +89 -0
  160. package/src/ui/tabs/tabs-list.tsx +146 -0
  161. package/src/ui/tabs/tabs.test.tsx +290 -0
  162. package/src/ui/tabs/tabs.tokens.ts +121 -0
  163. package/src/ui/tabs/tabs.tsx +229 -0
  164. package/src/ui/tabs/tabs.types.ts +185 -0
  165. package/{dist/ui/text-field/index.d.ts → src/ui/text-field/index.ts} +8 -1
  166. package/src/ui/text-field/subcomponents/active-indicator.tsx +67 -0
  167. package/src/ui/text-field/subcomponents/floating-label.tsx +161 -0
  168. package/src/ui/text-field/subcomponents/leading-icon.tsx +46 -0
  169. package/src/ui/text-field/subcomponents/outline-container.tsx +170 -0
  170. package/src/ui/text-field/subcomponents/prefix-suffix.tsx +59 -0
  171. package/src/ui/text-field/subcomponents/supporting-text.tsx +145 -0
  172. package/src/ui/text-field/subcomponents/trailing-icon.tsx +199 -0
  173. package/src/ui/text-field/text-field.test.tsx +454 -0
  174. package/src/ui/text-field/text-field.tokens.ts +104 -0
  175. package/src/ui/text-field/text-field.tsx +548 -0
  176. package/src/ui/text-field/text-field.types.ts +180 -0
  177. package/src/ui/theme-provider/index.tsx +190 -0
  178. package/src/ui/toc.test.tsx +108 -0
  179. package/src/ui/toc.tsx +172 -0
  180. package/src/ui/tooltip/plain-tooltip.tsx +63 -0
  181. package/src/ui/tooltip/rich-tooltip.tsx +94 -0
  182. package/src/ui/tooltip/tooltip-box.tsx +266 -0
  183. package/src/ui/tooltip/tooltip-caret-shape.tsx +68 -0
  184. package/src/ui/tooltip/tooltip.tokens.ts +26 -0
  185. package/src/ui/tooltip/tooltip.types.ts +70 -0
  186. package/src/ui/tooltip/use-tooltip-position.ts +208 -0
  187. package/src/ui/tooltip/use-tooltip-state.ts +41 -0
  188. package/src/ui/typography/__tests__/typography.test.tsx +170 -0
  189. package/{dist/ui/typography/index.d.ts → src/ui/typography/index.ts} +21 -3
  190. package/src/ui/typography/type-scale-tokens.ts +205 -0
  191. package/src/ui/typography/typography-key-tokens.ts +43 -0
  192. package/src/ui/typography/typography-tokens.ts +360 -0
  193. package/src/ui/typography/typography.css +22 -0
  194. package/src/ui/typography/typography.tsx +559 -0
  195. package/test-render.tsx +4 -0
  196. package/test-shadow.html +26 -0
  197. package/test_output.txt +164 -0
  198. package/test_output_v2.txt +5 -0
  199. package/tsconfig.build.json +10 -0
  200. package/tsconfig.json +18 -0
  201. package/tsup.config.ts +20 -0
  202. package/vitest.config.ts +11 -0
  203. package/dist/hooks/useMediaQuery.d.ts +0 -11
  204. package/dist/hooks/useRipple.d.ts +0 -26
  205. package/dist/lib/material-symbols-preconnect.d.ts +0 -42
  206. package/dist/lib/theme-utils.d.ts +0 -63
  207. package/dist/lib/utils.d.ts +0 -2
  208. package/dist/types/index.d.ts +0 -1
  209. package/dist/types/md3.d.ts +0 -14
  210. package/dist/ui/app-bar/app-bar-column.d.ts +0 -28
  211. package/dist/ui/app-bar/app-bar-item-button.d.ts +0 -16
  212. package/dist/ui/app-bar/app-bar-overflow-indicator.d.ts +0 -18
  213. package/dist/ui/app-bar/app-bar-row.d.ts +0 -36
  214. package/dist/ui/app-bar/app-bar.tokens.d.ts +0 -184
  215. package/dist/ui/app-bar/app-bar.types.d.ts +0 -392
  216. package/dist/ui/app-bar/bottom-app-bar.d.ts +0 -31
  217. package/dist/ui/app-bar/docked-toolbar.d.ts +0 -25
  218. package/dist/ui/app-bar/hooks/use-app-bar-scroll.d.ts +0 -42
  219. package/dist/ui/app-bar/hooks/use-flexible-app-bar.d.ts +0 -37
  220. package/dist/ui/app-bar/large-flexible-app-bar.d.ts +0 -26
  221. package/dist/ui/app-bar/medium-flexible-app-bar.d.ts +0 -28
  222. package/dist/ui/app-bar/search-app-bar.d.ts +0 -43
  223. package/dist/ui/app-bar/search-view.d.ts +0 -54
  224. package/dist/ui/app-bar/small-app-bar.d.ts +0 -37
  225. package/dist/ui/badge.d.ts +0 -125
  226. package/dist/ui/button-group.d.ts +0 -59
  227. package/dist/ui/button.d.ts +0 -148
  228. package/dist/ui/card.d.ts +0 -62
  229. package/dist/ui/checkbox.d.ts +0 -82
  230. package/dist/ui/chip.d.ts +0 -110
  231. package/dist/ui/code-block.d.ts +0 -14
  232. package/dist/ui/dialog.d.ts +0 -111
  233. package/dist/ui/divider.d.ts +0 -164
  234. package/dist/ui/drawer.d.ts +0 -39
  235. package/dist/ui/dropdown.d.ts +0 -29
  236. package/dist/ui/fab-menu.d.ts +0 -204
  237. package/dist/ui/fab.d.ts +0 -162
  238. package/dist/ui/icon-button.d.ts +0 -131
  239. package/dist/ui/icon.d.ts +0 -88
  240. package/dist/ui/loading-indicator.d.ts +0 -42
  241. package/dist/ui/navigation-rail.d.ts +0 -29
  242. package/dist/ui/progress-indicator/circular.d.ts +0 -3
  243. package/dist/ui/progress-indicator/hooks.d.ts +0 -3
  244. package/dist/ui/progress-indicator/linear-flat.d.ts +0 -10
  245. package/dist/ui/progress-indicator/linear-wavy.d.ts +0 -18
  246. package/dist/ui/progress-indicator/linear.d.ts +0 -3
  247. package/dist/ui/progress-indicator/types.d.ts +0 -151
  248. package/dist/ui/progress-indicator/utils.d.ts +0 -3
  249. package/dist/ui/radio-button.d.ts +0 -106
  250. package/dist/ui/ripple.d.ts +0 -126
  251. package/dist/ui/scroll-area.d.ts +0 -27
  252. package/dist/ui/shared/constants.d.ts +0 -86
  253. package/dist/ui/slider/hooks/useSliderMath.d.ts +0 -101
  254. package/dist/ui/slider/range-slider.d.ts +0 -47
  255. package/dist/ui/slider/slider-thumb.d.ts +0 -33
  256. package/dist/ui/slider/slider-track.d.ts +0 -25
  257. package/dist/ui/slider/slider.d.ts +0 -60
  258. package/dist/ui/slider/slider.tokens.d.ts +0 -151
  259. package/dist/ui/slider/slider.types.d.ts +0 -259
  260. package/dist/ui/snackbar/index.d.ts +0 -6
  261. package/dist/ui/snackbar/snackbar.d.ts +0 -197
  262. package/dist/ui/switch/switch.d.ts +0 -30
  263. package/dist/ui/switch/switch.stories.d.ts +0 -48
  264. package/dist/ui/switch/switch.tokens.d.ts +0 -67
  265. package/dist/ui/switch/switch.types.d.ts +0 -59
  266. package/dist/ui/tabs/tab.d.ts +0 -43
  267. package/dist/ui/tabs/tabs-content.d.ts +0 -36
  268. package/dist/ui/tabs/tabs-list.d.ts +0 -40
  269. package/dist/ui/tabs/tabs.d.ts +0 -60
  270. package/dist/ui/tabs/tabs.tokens.d.ts +0 -94
  271. package/dist/ui/tabs/tabs.types.d.ts +0 -172
  272. package/dist/ui/text-field/subcomponents/active-indicator.d.ts +0 -24
  273. package/dist/ui/text-field/subcomponents/floating-label.d.ts +0 -43
  274. package/dist/ui/text-field/subcomponents/leading-icon.d.ts +0 -23
  275. package/dist/ui/text-field/subcomponents/outline-container.d.ts +0 -42
  276. package/dist/ui/text-field/subcomponents/prefix-suffix.d.ts +0 -24
  277. package/dist/ui/text-field/subcomponents/supporting-text.d.ts +0 -37
  278. package/dist/ui/text-field/subcomponents/trailing-icon.d.ts +0 -41
  279. package/dist/ui/text-field/text-field.d.ts +0 -49
  280. package/dist/ui/text-field/text-field.tokens.d.ts +0 -76
  281. package/dist/ui/text-field/text-field.types.d.ts +0 -126
  282. package/dist/ui/theme-provider/index.d.ts +0 -48
  283. package/dist/ui/toc.d.ts +0 -80
  284. package/dist/ui/tooltip/plain-tooltip.d.ts +0 -2
  285. package/dist/ui/tooltip/rich-tooltip.d.ts +0 -2
  286. package/dist/ui/tooltip/tooltip-box.d.ts +0 -2
  287. package/dist/ui/tooltip/tooltip-caret-shape.d.ts +0 -9
  288. package/dist/ui/tooltip/tooltip.tokens.d.ts +0 -26
  289. package/dist/ui/tooltip/tooltip.types.d.ts +0 -56
  290. package/dist/ui/tooltip/use-tooltip-position.d.ts +0 -8
  291. package/dist/ui/tooltip/use-tooltip-state.d.ts +0 -2
  292. package/dist/ui/typography/type-scale-tokens.d.ts +0 -162
  293. package/dist/ui/typography/typography-key-tokens.d.ts +0 -40
  294. package/dist/ui/typography/typography-tokens.d.ts +0 -220
  295. package/dist/ui/typography/typography.d.ts +0 -265
  296. /package/{dist/ui/tooltip/index.d.ts → src/ui/tooltip/index.ts} +0 -0
@@ -1,37 +0,0 @@
1
- /**
2
- * @file use-flexible-app-bar.ts
3
- * Shared animation hook for MediumFlexibleAppBar and LargeFlexibleAppBar.
4
- *
5
- * Extracts common scroll-driven animation state to avoid duplication.
6
- */
7
- import type { MotionValue } from "motion/react";
8
- import type { RefObject } from "react";
9
- import type { AppBarColors } from "../app-bar.types";
10
- interface UseFlexibleAppBarOptions {
11
- collapsedHeight: number;
12
- expandedHeight: number;
13
- scrollElement?: RefObject<HTMLElement | null>;
14
- colors?: AppBarColors;
15
- /** [start, end] progress range where large title fades from 1 → 0 */
16
- largeTitleFadeRange: [number, number];
17
- /** [start, end] progress range where small title fades from 0 → 1 */
18
- smallTitleFadeRange: [number, number];
19
- /** [start, end] progress range where subtitle fades from 1 → 0 */
20
- subtitleFadeRange: [number, number];
21
- /** [start, end] progress range where headerContent fades from 1 → 0 */
22
- headerContentFadeRange: [number, number];
23
- /** [expanded, collapsed] Y offset for large title */
24
- largeTitleYRange: [number, number];
25
- }
26
- export interface FlexibleAppBarAnimationState {
27
- height: MotionValue<number>;
28
- currentBg: string;
29
- cssTransition: string | undefined;
30
- largeTitleOpacity: MotionValue<number>;
31
- largeTitleY: MotionValue<number>;
32
- smallTitleOpacity: MotionValue<number>;
33
- subtitleOpacity: MotionValue<number>;
34
- headerContentOpacity: MotionValue<number>;
35
- }
36
- export declare function useFlexibleAppBar({ collapsedHeight, expandedHeight, scrollElement, colors, largeTitleFadeRange, smallTitleFadeRange, subtitleFadeRange, headerContentFadeRange, largeTitleYRange, }: UseFlexibleAppBarOptions): FlexibleAppBarAnimationState;
37
- export {};
@@ -1,26 +0,0 @@
1
- /**
2
- * @file large-flexible-app-bar.tsx
3
- * MD3 Expressive Large Flexible App Bar.
4
- *
5
- * Like MediumFlexibleAppBar but with larger typography.
6
- * Expanded height: 120px (no subtitle) / 152px (with subtitle)
7
- * Collapsed height: 64px
8
- * Title crossfade: DisplaySmall (expanded) ↔ TitleLarge (collapsed)
9
- *
10
- * @see docs/m3/app-bars/AppBarLargeFlexibleTokens.kt
11
- */
12
- import type { FlexibleAppBarProps } from "./app-bar.types";
13
- /**
14
- * MD3 Expressive Large Flexible App Bar.
15
- *
16
- * @example
17
- * ```tsx
18
- * <LargeFlexibleAppBar
19
- * title="Discover"
20
- * subtitle="Trending today"
21
- * navigationIcon={<IconButton aria-label="Open menu"><Icon>menu</Icon></IconButton>}
22
- * headerContent={<img src="/banner.jpg" alt="" className="rounded-xl h-20 w-full object-cover" />}
23
- * />
24
- * ```
25
- */
26
- export declare function LargeFlexibleAppBar({ title, subtitle, titleAlignment, navigationIcon, actions, colors, scrollElement, headerContent, collapsedHeight, expandedHeight, className, }: FlexibleAppBarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,28 +0,0 @@
1
- /**
2
- * @file medium-flexible-app-bar.tsx
3
- * MD3 Expressive Medium Flexible App Bar.
4
- *
5
- * Two-row layout in expanded state, collapses to single row on scroll.
6
- * Expanded height: 112px (no subtitle) / 136px (with subtitle)
7
- * Collapsed height: 64px
8
- * Title crossfade: HeadlineMedium (expanded) ↔ TitleLarge (collapsed)
9
- *
10
- * Supports `exitUntilCollapsed` scroll behavior only.
11
- *
12
- * @see docs/m3/app-bars/AppBarMediumFlexibleTokens.kt
13
- */
14
- import type { FlexibleAppBarProps } from "./app-bar.types";
15
- /**
16
- * MD3 Expressive Medium Flexible App Bar.
17
- *
18
- * @example
19
- * ```tsx
20
- * <MediumFlexibleAppBar
21
- * title="Settings"
22
- * subtitle="Manage your preferences"
23
- * navigationIcon={<IconButton aria-label="Go back"><Icon>arrow_back</Icon></IconButton>}
24
- * actions={<IconButton aria-label="More options"><Icon>more_vert</Icon></IconButton>}
25
- * />
26
- * ```
27
- */
28
- export declare function MediumFlexibleAppBar({ title, subtitle, titleAlignment, navigationIcon, actions, colors, scrollElement, headerContent, collapsedHeight, expandedHeight, className, }: FlexibleAppBarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,43 +0,0 @@
1
- /**
2
- * @file search-app-bar.tsx
3
- * MD3 Expressive Search App Bar.
4
- *
5
- * New variant in MD3 Expressive (May 2025).
6
- * Replaces the title area with a pill-shaped search bar.
7
- * Uses Framer Motion layoutId to enable shared element transition with <SearchView>.
8
- *
9
- * @see docs/m3/app-bars/AppBar.kt — SearchAppBar
10
- */
11
- import type { SearchAppBarProps } from "./app-bar.types";
12
- /**
13
- * MD3 Expressive Search App Bar.
14
- *
15
- * When the search bar is clicked, callers should open a `<SearchView>` overlay.
16
- * Uses Framer Motion `layoutId` (via `searchBarId`) for a smooth shared-element
17
- * transition between this bar and the search view.
18
- *
19
- * @example
20
- * ```tsx
21
- * const [searchOpen, setSearchOpen] = useState(false);
22
- *
23
- * <SearchAppBar
24
- * searchBarId="main-search"
25
- * searchPlaceholder="Search messages..."
26
- * onSearchFocus={() => setSearchOpen(true)}
27
- * trailingSearchActions={
28
- * <IconButton aria-label="Voice search"><Icon>mic</Icon></IconButton>
29
- * }
30
- * externalActions={<Avatar src={user.avatar} />}
31
- * />
32
- *
33
- * <AnimatePresence>
34
- * {searchOpen && (
35
- * <SearchView
36
- * searchBarId="main-search"
37
- * onClose={() => setSearchOpen(false)}
38
- * />
39
- * )}
40
- * </AnimatePresence>
41
- * ```
42
- */
43
- export declare function SearchAppBar({ searchPlaceholder, searchValue, onSearchFocus, leadingSearchIcon, trailingSearchActions, externalActions, navigationIcon, colors, scrollBehavior, scrollElement, searchBarId, className, }: SearchAppBarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,54 +0,0 @@
1
- /**
2
- * @file search-view.tsx
3
- * MD3 Expressive Search View.
4
- *
5
- * Full-screen overlay activated when a SearchAppBar's search bar is clicked.
6
- * Shares a Framer Motion `layoutId` with the SearchAppBar search bar for a
7
- * smooth shared element transition.
8
- *
9
- * Usage pattern:
10
- * ```tsx
11
- * const [open, setOpen] = useState(false);
12
- *
13
- * // In render:
14
- * <SearchAppBar searchBarId="main" onSearchFocus={() => setOpen(true)} />
15
- * <AnimatePresence>
16
- * {open && <SearchView searchBarId="main" onClose={() => setOpen(false)} />}
17
- * </AnimatePresence>
18
- * ```
19
- *
20
- * Design notes:
21
- * - The SearchView is intentionally separate from SearchAppBar to allow consumers
22
- * to customize the results/suggestions content without coupling.
23
- * - The `searchBarId` prop must match between SearchAppBar and SearchView to
24
- * enable the shared element transition.
25
- * - Focus is moved to the search input when the view opens.
26
- * - Escape key closes the view and returns focus to the search bar.
27
- */
28
- import type { SearchViewProps } from "./app-bar.types";
29
- /**
30
- * MD3 Expressive Search View.
31
- *
32
- * Renders a full-screen search overlay with a shared element transition
33
- * from the triggering `<SearchAppBar>` search bar.
34
- *
35
- * Mount/unmount this component via `<AnimatePresence>` in the consumer.
36
- */
37
- export declare function SearchView({ searchBarId, value, onChange, onClose, placeholder, children, leadingIcon, trailingAction, className, }: SearchViewProps): import("react/jsx-runtime").JSX.Element;
38
- /**
39
- * Convenience wrapper that handles the AnimatePresence + open state.
40
- *
41
- * @example
42
- * ```tsx
43
- * <SearchBar
44
- * isOpen={searchOpen}
45
- * onClose={() => setSearchOpen(false)}
46
- * searchBarId="main-search"
47
- * >
48
- * <SearchResultsList results={results} />
49
- * </SearchBar>
50
- * ```
51
- */
52
- export declare function SearchViewContainer({ isOpen, ...props }: SearchViewProps & {
53
- isOpen: boolean;
54
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,37 +0,0 @@
1
- /**
2
- * @file small-app-bar.tsx
3
- * MD3 Expressive Small App Bar.
4
- *
5
- * Single-row layout: [navigationIcon][title + subtitle][actions]
6
- * Height: 64px | Title: TitleLarge (22sp) | Subtitle: LabelMedium (12sp)
7
- *
8
- * Scroll behaviors:
9
- * - pinned: changes background color surface → surface-container
10
- * - enterAlways: slides up when scrolling down, slides down when scrolling up
11
- *
12
- * @see docs/m3/app-bars/AppBarSmallTokens.kt
13
- */
14
- import type { SmallAppBarProps } from "./app-bar.types";
15
- /**
16
- * MD3 Expressive Small App Bar.
17
- *
18
- * @example
19
- * ```tsx
20
- * // Left-aligned (default)
21
- * <SmallAppBar
22
- * title="Inbox"
23
- * navigationIcon={<IconButton aria-label="Go back"><Icon>arrow_back</Icon></IconButton>}
24
- * actions={<IconButton aria-label="Search"><Icon>search</Icon></IconButton>}
25
- * scrollBehavior="pinned"
26
- * />
27
- *
28
- * // Center-aligned with subtitle
29
- * <SmallAppBar
30
- * title="Profile"
31
- * subtitle="@username"
32
- * titleAlignment="center"
33
- * scrollBehavior="enterAlways"
34
- * />
35
- * ```
36
- */
37
- export declare function SmallAppBar({ title, subtitle, titleAlignment, navigationIcon, actions, colors, scrollBehavior, scrollElement, className, }: SmallAppBarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,125 +0,0 @@
1
- /**
2
- * @file badge.tsx
3
- *
4
- * MD3 Expressive Badge component.
5
- *
6
- * - `Badge` → A small status indicator. Can be a dot (no content) or labeled (with content).
7
- * - `BadgedBox` → Positions a Badge at the top-trailing corner of an anchor element.
8
- *
9
- * @remarks
10
- * Token references (Kotlin source):
11
- * BadgeTokens — Size=6dp (→ 6px), LargeSize=16dp (→ 16px), Shape=CornerFull, Color=Error,
12
- * LargeLabelTextFont=LabelSmall, LargeLabelTextColor=OnError
13
- *
14
- * BadgedBox offsets:
15
- * - Small (dot): BadgeOffset = 6dp → translate(50%, -50%)
16
- * - Large (text): HOffset=12dp, VOffset=14dp → translate(35%, -35%)
17
- *
18
- * Architecture:
19
- * - Styling: `cn` (clsx/tailwind-merge) + static Tailwind classes
20
- * - Animation: Framer Motion (`LazyMotion` + `domMax`) spring mount/unmount
21
- * - A11y: `role="status"` with `aria-label`, decorative dots use `aria-hidden="true"`
22
- *
23
- * @see https://m3.material.io/components/badge/overview
24
- */
25
- import * as React from "react";
26
- type SafeHTMLSpanAttrs = Omit<React.HTMLAttributes<HTMLSpanElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onDragEnter" | "onDragLeave" | "onDragOver" | "onDrop">;
27
- export interface BadgeProps extends SafeHTMLSpanAttrs {
28
- /**
29
- * The content to display inside the badge.
30
- * - Omitted / undefined → renders as a small 6×6px dot (decorative).
31
- * - string | number → renders as a large badge (min 16px height) with label.
32
- *
33
- * Numbers exceeding `max` are displayed as `{max}+`.
34
- * Strings longer than 4 characters are truncated to 4.
35
- */
36
- children?: React.ReactNode;
37
- /**
38
- * Maximum numeric value to display before appending "+".
39
- * Only applies when `children` is a number.
40
- * @example max={99} + children={150} → "99+"
41
- */
42
- max?: number;
43
- /**
44
- * Override the background (container) color.
45
- * Accepts any valid CSS color value.
46
- * Defaults to MD3 `error` token — `bg-m3-error`.
47
- */
48
- containerColor?: string;
49
- /**
50
- * Override the text/content color.
51
- * Accepts any valid CSS color value.
52
- * Defaults to MD3 `on-error` token — `text-m3-on-error`.
53
- */
54
- contentColor?: string;
55
- }
56
- export interface BadgedBoxProps {
57
- /**
58
- * The badge element to overlay on the anchor.
59
- * Typically a `<Badge />`.
60
- */
61
- badge: React.ReactNode;
62
- /**
63
- * The anchor content that the badge is attached to.
64
- */
65
- children: React.ReactNode;
66
- /**
67
- * Additional className applied to the outer wrapper `span`.
68
- */
69
- className?: string;
70
- /**
71
- * Explicitly override size detection for badge positioning.
72
- * - `'small'` → BadgeOffset = 6dp → translate(50%, -50%)
73
- * - `'large'` → HOffset=12dp/VOffset=14dp → translate(35%, -35%)
74
- * When omitted, BadgedBox auto-detects by inspecting `badge` children prop.
75
- */
76
- badgeSize?: "small" | "large";
77
- }
78
- /**
79
- * MD3 Expressive Badge — dynamic status indicator.
80
- *
81
- * @example
82
- * ```tsx
83
- * // Small dot badge (no content) — decorative
84
- * <Badge />
85
- *
86
- * // Large badge with number (truncated at max)
87
- * <Badge max={99}>150</Badge>
88
- * // → displays "99+"
89
- *
90
- * // Large badge with text label
91
- * <Badge>NEW</Badge>
92
- *
93
- * // Custom colors
94
- * <Badge containerColor="#6750A4" contentColor="#FFFFFF">3</Badge>
95
- * ```
96
- *
97
- * @see https://m3.material.io/components/badge/overview
98
- */
99
- export declare const Badge: React.NamedExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
100
- /**
101
- * MD3 BadgedBox — positions a Badge at the top-trailing corner of an anchor.
102
- *
103
- * Implements MD3 offset specs from Badge.kt:
104
- * - Small badge (dot): `BadgeOffset = 6dp` → translate(50%, -50%)
105
- * - Large badge (text): `BadgeWithContentHorizontalOffset = 12dp` / `VerticalOffset = 14dp`
106
- * → translate(35%, -35%)
107
- *
108
- * Auto-detects badge size by inspecting the badge element's children prop,
109
- * or accepts an explicit `badgeSize` override.
110
- *
111
- * @example
112
- * ```tsx
113
- * // Small dot on mail icon
114
- * <BadgedBox badge={<Badge />}>
115
- * <Icon name="mail" />
116
- * </BadgedBox>
117
- *
118
- * // Count badge on notification icon
119
- * <BadgedBox badge={<Badge max={99}>{count}</Badge>}>
120
- * <Icon name="notifications" />
121
- * </BadgedBox>
122
- * ```
123
- */
124
- export declare function BadgedBox({ badge, children, className, badgeSize, }: BadgedBoxProps): import("react/jsx-runtime").JSX.Element;
125
- export {};
@@ -1,59 +0,0 @@
1
- import * as React from "react";
2
- /**
3
- * Thuộc tính truyền vào cho thành phần nhóm nút (Button Group).
4
- */
5
- export interface ButtonGroupProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {
6
- /**
7
- * Cấu trúc hiển thị của nhóm nút:
8
- * - `standard`: Các nút cách xa và có khoảng cách độc lập với nhau (gap).
9
- * - `connected`: Các nút nối liền khung viền với nhau để tạo thành dạng Segmented Button.
10
- * @default "standard"
11
- */
12
- variant?: "standard" | "connected";
13
- /**
14
- * Hướng sắp xếp của các nút trong nhóm.
15
- * @default "horizontal"
16
- */
17
- orientation?: "horizontal" | "vertical";
18
- /**
19
- * Đặ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).
20
- * @default false
21
- */
22
- fullWidth?: boolean;
23
- /**
24
- * Á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).
25
- */
26
- size?: "xs" | "sm" | "md" | "lg" | "xl";
27
- /**
28
- * 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`).
29
- * @default true
30
- */
31
- morphingWidth?: boolean;
32
- /**
33
- * 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}`.
34
- * @default false
35
- */
36
- showCheck?: boolean;
37
- }
38
- /**
39
- * Component Nhóm Nút (Button Group) được sử dụng để gom nhóm nhiều nút có công năng tương tự lại với nhau.
40
- * Hỗ trợ tạo các bộ nút độc lập (Standard) hoặc khối liên kết liền mạch (Connected/Segmented Buttons).
41
- * Kế thừa cơ chế chuyển động kết hợp liền mạch của MD3 Expressive.
42
- *
43
- * @example
44
- * ```tsx
45
- * // Nhóm nút tiêu chuẩn rời rạc (Standard)
46
- * <ButtonGroup variant="standard">
47
- * <Button>Lựa chọn 1</Button>
48
- * <Button>Lựa chọn 2</Button>
49
- * </ButtonGroup>
50
- *
51
- * // Nhóm nút liền khối (Connected Segmented Button)
52
- * <ButtonGroup variant="connected" showCheck fullWidth>
53
- * <Button variant="toggle" selected={view === "day"} onClick={() => setView("day")}>Ngày</Button>
54
- * <Button variant="toggle" selected={view === "week"} onClick={() => setView("week")}>Tuần</Button>
55
- * <Button variant="toggle" selected={view === "month"} onClick={() => setView("month")}>Tháng</Button>
56
- * </ButtonGroup>
57
- * ```
58
- */
59
- export declare const ButtonGroup: React.NamedExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLFieldSetElement>>;
@@ -1,148 +0,0 @@
1
- /**
2
- * @file button.tsx
3
- *
4
- * MD3 Expressive Button component.
5
- *
6
- * Spec: https://m3.material.io/components/buttons/overview
7
- * Sizing (May 2025):
8
- * XS → h:32dp | px: 12dp | icon: 18dp | gap: 8dp
9
- * SM → h:40dp | px: 16dp | icon: 20dp | gap: 8dp
10
- * MD → h:56dp | px: 24dp | icon: 24dp | gap: 8dp
11
- * LG → h:96dp | px: 48dp | icon: 32dp | gap: 12dp
12
- * XL → h:136dp | px: 48dp | icon: 40dp | gap: 12dp
13
- */
14
- import type { HTMLMotionProps } from "motion/react";
15
- import * as React from "react";
16
- type MotionButtonProps = Omit<HTMLMotionProps<"button">, "children" | "color">;
17
- /**
18
- * Base props shared between the standard and toggle button variants.
19
- *
20
- * @see {@link ButtonProps} for the complete discriminated union type.
21
- * @see https://m3.material.io/components/buttons/overview
22
- */
23
- export interface BaseButtonProps extends MotionButtonProps {
24
- /**
25
- * Visual style variant following MD3 color roles.
26
- * @default "filled"
27
- */
28
- colorStyle?: "elevated" | "filled" | "tonal" | "outlined" | "text";
29
- /**
30
- * Color style applied when the toggle button is in the *selected* state.
31
- * Only meaningful when `variant="toggle"`.
32
- * Falls back to `"filled"` when not specified.
33
- */
34
- selectedColorStyle?: "elevated" | "filled" | "tonal" | "outlined" | "text";
35
- /**
36
- * Button size following MD3 Expressive size scale.
37
- * @default "sm"
38
- */
39
- size?: "xs" | "sm" | "md" | "lg" | "xl";
40
- /**
41
- * Container shape — controls border-radius morphing.
42
- * - `round`: pill shape (CornerFull), morphs to rounded-square when toggled.
43
- * - `square`: rounded-square, morphs to pill when toggled.
44
- * @default "round"
45
- */
46
- shape?: "round" | "square";
47
- /**
48
- * Optional leading or trailing icon node.
49
- * Size is automatically scaled to match the button's `size` prop.
50
- */
51
- icon?: React.ReactNode;
52
- /**
53
- * Position of the icon relative to the label text.
54
- * @default "leading"
55
- */
56
- iconPosition?: "leading" | "trailing";
57
- /**
58
- * When `true`, replaces the icon with an animated loading indicator
59
- * and prevents interaction.
60
- * @default false
61
- */
62
- loading?: boolean;
63
- /**
64
- * Controls which loading spinner is shown while `loading={true}`.
65
- * - `loading-indicator`: MD3 Expressive morphing shape (default).
66
- * - `circular`: Classic circular spinner.
67
- * @default "loading-indicator"
68
- */
69
- loadingVariant?: "loading-indicator" | "circular";
70
- /**
71
- * When `true`, the Button renders its child element directly (using Radix Slot),
72
- * merging all button props (className, style, event handlers) onto it.
73
- * Useful for rendering a Next.js `<Link>` with Button styles.
74
- *
75
- * @example
76
- * ```tsx
77
- * <Button asChild size="lg">
78
- * <Link href="/components">Explore Components</Link>
79
- * </Button>
80
- * ```
81
- * @default false
82
- */
83
- asChild?: boolean;
84
- /** Button label — any React content, typically a string. */
85
- children: React.ReactNode;
86
- }
87
- /**
88
- * Complete `Button` props — discriminated union that enforces
89
- * `selected` is only valid for `variant="toggle"`.
90
- *
91
- * @example
92
- * ```tsx
93
- * // Standard button
94
- * <Button colorStyle="filled" size="md">Confirm</Button>
95
- *
96
- * // Toggle button (selected state required)
97
- * <Button variant="toggle" selected={isActive} onClick={toggle}>Filter</Button>
98
- *
99
- * // With leading icon and loading state
100
- * <Button icon={<CheckIcon />} loading={isSubmitting}>Save</Button>
101
- * ```
102
- *
103
- * @see https://m3.material.io/components/buttons/overview
104
- */
105
- export type ButtonProps = BaseButtonProps & ({
106
- variant?: "default";
107
- selected?: never;
108
- } | {
109
- variant: "toggle";
110
- selected: boolean;
111
- });
112
- /**
113
- * MD3 Expressive Button component.
114
- *
115
- * Supports all five MD3 color styles, five sizes, shape morphing on toggle,
116
- * leading/trailing icons, and an animated loading state.
117
- *
118
- * @remarks
119
- * - `variant="toggle"` requires `selected: boolean` — enforced by the type system.
120
- * - When `loading={true}`, the button is visually dimmed, pointer events are
121
- * blocked, and `aria-busy` is set for screen readers.
122
- * - Shape morphs smoothly between pill ↔ rounded-square when toggle state changes,
123
- * using a critically-damped spring (no overshoot artefacts).
124
- *
125
- * @example
126
- * ```tsx
127
- * // Standard filled button
128
- * <Button colorStyle="filled" size="md">Confirm</Button>
129
- *
130
- * // Button with icon
131
- * <Button icon={<CheckIcon />} loading={isSubmitting}>Save</Button>
132
- *
133
- * // Toggle button
134
- * <Button variant="toggle" selected={isActive} onClick={toggle}>
135
- * Filter
136
- * </Button>
137
- * ```
138
- *
139
- * @see https://m3.material.io/components/buttons/overview
140
- */
141
- export declare const Button: React.NamedExoticComponent<(Omit<BaseButtonProps & {
142
- variant?: "default";
143
- selected?: never;
144
- }, "ref"> | Omit<BaseButtonProps & {
145
- variant: "toggle";
146
- selected: boolean;
147
- }, "ref">) & React.RefAttributes<HTMLButtonElement>>;
148
- export {};
package/dist/ui/card.d.ts DELETED
@@ -1,62 +0,0 @@
1
- /**
2
- * @file card.tsx
3
- *
4
- * Thẻ Card của bộ khung MD3 Expressive.
5
- *
6
- * Phân chia làm hai khía cạnh chức năng (cấu trúc tham khảo từ con ruột Android Card.kt):
7
- * - **Tĩnh Lặng (Static)** → đơn thuần mang thẻ `<div>`, yên tĩnh và không hề mảy may phản hồi có tương tác nào.
8
- * - **Có phản ứng (Interactive)** → được phù phép bằng `<motion.button>` hoặc `<motion.a>`, mang bùa Ripple vẫy sống cùng khả năng nhảy vọt elevation khi lướt lên.
9
- *
10
- * Nấc độ bóng Elevation levels (dịch từ các file mã ElevatedCardTokens / FilledCardTokens / OutlinedCardTokens / Elevation.kt):
11
- * - Level 0 = "none" (Bằng phẳng)
12
- * - Level 1 = box-shadow ~1dp (Hơi nhỉnh nổi nhẹ)
13
- * - Level 2 = box-shadow ~2dp (Bay lên cao xíu)
14
- *
15
- * @example
16
- * ```tsx
17
- * // Card tĩnh
18
- * <Card variant="elevated">
19
- * <div className="p-4">Nội dung thẻ Card nhẹ nhàng</div>
20
- * </Card>
21
- *
22
- * // Card button tương tác
23
- * <Card variant="filled" onClick={() => alert('Đã nhấn!')}>
24
- * <div className="p-4">Click vào đây em ei</div>
25
- * </Card>
26
- *
27
- * // Card làm thẻ Link a
28
- * <Card variant="outlined" href="/home">
29
- * <div className="p-4">Click để chuyển trang</div>
30
- * </Card>
31
- * ```
32
- *
33
- * @see https://m3.material.io/components/cards/overview
34
- */
35
- import { type VariantProps } from "class-variance-authority";
36
- import type { HTMLMotionProps } from "motion/react";
37
- import * as React from "react";
38
- declare const cardVariants: (props?: ({
39
- variant?: "outlined" | "elevated" | "filled" | null | undefined;
40
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
41
- type MotionDivProps = Omit<HTMLMotionProps<"button">, "children" | "color">;
42
- export interface CardProps extends MotionDivProps, VariantProps<typeof cardVariants> {
43
- /** Vô hiệu hóa tương tác và giảm opacity (MD3 disabled state). */
44
- disabled?: boolean;
45
- /**
46
- * Buộc card trở thành interactive dù không có `onClick`.
47
- * Hữu ích khi card chứa các element con là interactive.
48
- */
49
- interactive?: boolean;
50
- /**
51
- * Nếu có, card render thành thẻ `<a>`. Tự động kích hoạt interactive mode.
52
- * Ưu tiên dùng `href` thay vì `onClick` khi điều hướng trang.
53
- */
54
- href?: string;
55
- /** Target cho thẻ `<a>` (chỉ có hiệu lực khi `href` được cung cấp). */
56
- target?: React.AnchorHTMLAttributes<HTMLAnchorElement>["target"];
57
- /** rel cho thẻ `<a>` (tự động thêm `noreferrer` khi `target="_blank"`). */
58
- rel?: string;
59
- children?: React.ReactNode;
60
- }
61
- export declare const Card: React.NamedExoticComponent<Omit<CardProps, "ref"> & React.RefAttributes<HTMLElement>>;
62
- export {};