@bug-on/md3-react 2.0.3 → 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.
- package/.turbo/turbo-build.log +33 -0
- package/CHANGELOG.md +55 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +6127 -0
- package/dist/index.d.ts +6127 -71
- package/dist/index.js +1653 -614
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1566 -547
- 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/typography.css.d.ts +2 -0
- package/package.json +22 -19
- package/scripts/copy-assets.js +82 -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 +180 -0
- package/src/lib/utils.ts +6 -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 +297 -0
- package/src/ui/button.tsx +669 -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 +604 -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 +122 -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 +190 -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,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file switch.tsx
|
|
3
|
-
* MD3 Expressive Switch — ARIA switch pattern with Framer Motion animations.
|
|
4
|
-
* Spec: https://m3.material.io/components/switch/overview
|
|
5
|
-
*
|
|
6
|
-
* Key decisions:
|
|
7
|
-
* - Uses `<button role="switch">` (no <input>) per MD3 accessibility spec
|
|
8
|
-
* - Framer Motion for ALL animations (thumb x, size morph, state layer, icons)
|
|
9
|
-
* - Hover state via useState (required for Framer Motion color animate)
|
|
10
|
-
* - Disabled colors via rgba() literals (color-mix() not animatable by FM)
|
|
11
|
-
*/
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import type { SwitchProps } from "./switch.types";
|
|
14
|
-
/**
|
|
15
|
-
* MD3 Expressive Switch component.
|
|
16
|
-
*
|
|
17
|
-
* Toggles a single item on or off. Implements the ARIA switch pattern
|
|
18
|
-
* (`role="switch"`) without `<input>`. Fully animated per MD3 spec:
|
|
19
|
-
* thumb translation, size morph (16→24→28px), state layer, and icon cross-fade.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* <Switch checked={isOn} onCheckedChange={setIsOn} label="Wi-Fi" />
|
|
24
|
-
* <Switch checked={isOn} onCheckedChange={setIsOn} icons thumbContent={<CheckIcon />} />
|
|
25
|
-
* <Switch checked={isOn} onCheckedChange={setIsOn} disabled />
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @see https://m3.material.io/components/switch/overview
|
|
29
|
-
*/
|
|
30
|
-
export declare const Switch: React.NamedExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file switch.stories.tsx
|
|
3
|
-
* MD3 Expressive Switch — all usage patterns and states.
|
|
4
|
-
*
|
|
5
|
-
* Can be used as:
|
|
6
|
-
* 1. Storybook stories (if Storybook is configured)
|
|
7
|
-
* 2. Standalone demo component for the docs app
|
|
8
|
-
*
|
|
9
|
-
* Covers all 7 patterns from the MD3 Switch specification:
|
|
10
|
-
* 1. Basic toggle
|
|
11
|
-
* 2. With label
|
|
12
|
-
* 3. With icons (both states)
|
|
13
|
-
* 4. With only selected icon
|
|
14
|
-
* 5. Disabled (checked)
|
|
15
|
-
* 6. Disabled (unchecked)
|
|
16
|
-
* 7. All states grid
|
|
17
|
-
*/
|
|
18
|
-
/** Basic stateful switch — no label, no icons. */
|
|
19
|
-
export declare function Basic(): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
/** Switch with a visible text label using htmlFor linkage. */
|
|
21
|
-
export declare function WithLabel(): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
/**
|
|
23
|
-
* Switch showing icons in both checked and unchecked states.
|
|
24
|
-
* Uses check icon when on, close icon when off.
|
|
25
|
-
*/
|
|
26
|
-
export declare function WithIcons(): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
/**
|
|
28
|
-
* Switch showing the icon only in the checked (selected) state.
|
|
29
|
-
* Unselected state has no icon.
|
|
30
|
-
*/
|
|
31
|
-
export declare function WithOnlySelectedIcon(): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
/** Disabled switch in the checked (on) state. */
|
|
33
|
-
export declare function DisabledChecked(): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
/** Disabled switch in the unchecked (off) state. */
|
|
35
|
-
export declare function DisabledUnchecked(): import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
/**
|
|
37
|
-
* Grid displaying all Switch state combinations:
|
|
38
|
-
* - Enabled: checked / unchecked
|
|
39
|
-
* - Disabled: checked / unchecked
|
|
40
|
-
* - With icons: checked / unchecked
|
|
41
|
-
* - With only selected icon: checked / unchecked
|
|
42
|
-
*/
|
|
43
|
-
export declare function AllStatesGrid(): import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
/**
|
|
45
|
-
* All switch stories in one scrollable demo page.
|
|
46
|
-
* Used by the docs app to showcase all variants.
|
|
47
|
-
*/
|
|
48
|
-
export declare function SwitchDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file switch.tokens.ts
|
|
3
|
-
* MD3 Expressive Switch — Design tokens ported from SwitchTokens.kt.
|
|
4
|
-
* All dimensional values are in px (dp equivalent for web).
|
|
5
|
-
* @see docs/m3/switch/SwitchTokens.kt
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Design tokens for the MD3 Expressive Switch component.
|
|
9
|
-
*
|
|
10
|
-
* Maps directly from `SwitchTokens.kt` (v0_210) to CSS/JS values.
|
|
11
|
-
* Use these as the single source of truth for sizing and opacity.
|
|
12
|
-
*
|
|
13
|
-
* Color tokens are NOT included here — they reference CSS custom properties
|
|
14
|
-
* from the project's MD3 theme system (`--md-sys-color-*`).
|
|
15
|
-
*/
|
|
16
|
-
export declare const SwitchTokens: {
|
|
17
|
-
/** SwitchTokens.TrackWidth = 52dp */
|
|
18
|
-
readonly trackWidth: 52;
|
|
19
|
-
/** SwitchTokens.TrackHeight = 32dp */
|
|
20
|
-
readonly trackHeight: 32;
|
|
21
|
-
/** SwitchTokens.TrackOutlineWidth = 2dp */
|
|
22
|
-
readonly trackOutlineWidth: 2;
|
|
23
|
-
/** SwitchTokens.SelectedHandleWidth/Height = 24dp */
|
|
24
|
-
readonly selectedHandleSize: 24;
|
|
25
|
-
/** SwitchTokens.UnselectedHandleWidth/Height = 16dp */
|
|
26
|
-
readonly unselectedHandleSize: 16;
|
|
27
|
-
/** SwitchTokens.IconHandleWidth/Height = 24dp (when thumb has icon content) */
|
|
28
|
-
readonly iconHandleSize: 24;
|
|
29
|
-
/** SwitchTokens.PressedHandleWidth/Height = 28dp */
|
|
30
|
-
readonly pressedHandleSize: 28;
|
|
31
|
-
/** SwitchTokens.StateLayerSize = 40dp */
|
|
32
|
-
readonly stateLayerSize: 40;
|
|
33
|
-
/** SwitchTokens.SelectedIconSize / UnselectedIconSize = 16dp */
|
|
34
|
-
readonly iconSize: 16;
|
|
35
|
-
/** SwitchTokens.DisabledTrackOpacity = 0.12 */
|
|
36
|
-
readonly disabledTrackOpacity: 0.12;
|
|
37
|
-
/** SwitchTokens.DisabledSelectedHandleOpacity = 1.0 */
|
|
38
|
-
readonly disabledSelectedHandleOpacity: 1;
|
|
39
|
-
/** SwitchTokens.DisabledUnselectedHandleOpacity = 0.38 */
|
|
40
|
-
readonly disabledUnselectedHandleOpacity: 0.38;
|
|
41
|
-
/** SwitchTokens.DisabledSelectedIconOpacity = 0.38 */
|
|
42
|
-
readonly disabledSelectedIconOpacity: 0.38;
|
|
43
|
-
/** SwitchTokens.DisabledUnselectedIconOpacity = 0.38 */
|
|
44
|
-
readonly disabledUnselectedIconOpacity: 0.38;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* CSS custom property references for Switch colors.
|
|
48
|
-
* These map to the project's `--md-sys-color-*` tokens in `colors.css`.
|
|
49
|
-
*
|
|
50
|
-
* DO NOT hardcode hex values — always use these references so the
|
|
51
|
-
* component automatically adapts to light/dark theme switching.
|
|
52
|
-
*/
|
|
53
|
-
export declare const SwitchColors: {
|
|
54
|
-
readonly checkedTrack: "var(--md-sys-color-primary)";
|
|
55
|
-
readonly uncheckedTrack: "var(--md-sys-color-surface-container-highest)";
|
|
56
|
-
readonly uncheckedTrackOutline: "var(--md-sys-color-outline)";
|
|
57
|
-
readonly checkedThumb: "var(--md-sys-color-on-primary)";
|
|
58
|
-
readonly uncheckedThumb: "var(--md-sys-color-outline)";
|
|
59
|
-
readonly hoverCheckedThumb: "var(--md-sys-color-primary-container)";
|
|
60
|
-
readonly hoverUncheckedThumb: "var(--md-sys-color-on-surface-variant)";
|
|
61
|
-
readonly disabledCheckedThumb: "var(--md-sys-color-surface)";
|
|
62
|
-
readonly checkedIcon: "var(--md-sys-color-on-primary-container)";
|
|
63
|
-
readonly uncheckedIcon: "var(--md-sys-color-surface-container-highest)";
|
|
64
|
-
readonly checkedStateLayer: "var(--md-sys-color-primary)";
|
|
65
|
-
readonly uncheckedStateLayer: "var(--md-sys-color-on-surface)";
|
|
66
|
-
readonly focusIndicator: "var(--md-sys-color-secondary)";
|
|
67
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file switch.types.ts
|
|
3
|
-
* MD3 Expressive Switch — TypeScript prop definitions.
|
|
4
|
-
* Spec: https://m3.material.io/components/switch/overview
|
|
5
|
-
*/
|
|
6
|
-
import type * as React from "react";
|
|
7
|
-
/**
|
|
8
|
-
* Props for the `Switch` component.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <Switch checked={isOn} onCheckedChange={setIsOn} label="Wi-Fi" />
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export interface SwitchProps {
|
|
16
|
-
/** Controlled checked (on) state. */
|
|
17
|
-
checked: boolean;
|
|
18
|
-
/** Called when the switch is toggled. Not called when disabled. */
|
|
19
|
-
onCheckedChange: (checked: boolean) => void;
|
|
20
|
-
/** Disables interaction and applies disabled visual state. @default false */
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Optional icon content rendered inside the thumb.
|
|
24
|
-
* Expected to measure 16dp (SwitchTokens.iconSize).
|
|
25
|
-
*/
|
|
26
|
-
thumbContent?: React.ReactNode;
|
|
27
|
-
/**
|
|
28
|
-
* When true, shows thumb icons in both selected and unselected states.
|
|
29
|
-
* Requires `thumbContent` to be provided.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
icons?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* When true, shows the icon only in the selected/checked state.
|
|
35
|
-
* Requires `thumbContent` to be provided.
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
showOnlySelectedIcon?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Visible label text rendered adjacent to the switch.
|
|
41
|
-
* When provided, wraps the switch in a `<label>` for accessibility.
|
|
42
|
-
*/
|
|
43
|
-
label?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Overrides the accessible name. Used when no visible `label` is provided.
|
|
46
|
-
* Maps to the `aria-label` attribute.
|
|
47
|
-
*/
|
|
48
|
-
ariaLabel?: string;
|
|
49
|
-
/** Additional CSS class names applied to the outermost wrapper. */
|
|
50
|
-
className?: string;
|
|
51
|
-
/** Override track background color when checked. Defaults to MD3 primary. */
|
|
52
|
-
checkedTrackColor?: string;
|
|
53
|
-
/** Override track background color when unchecked. Defaults to MD3 surface-container-highest. */
|
|
54
|
-
uncheckedTrackColor?: string;
|
|
55
|
-
/** Override thumb color when checked. Defaults to MD3 on-primary. */
|
|
56
|
-
checkedThumbColor?: string;
|
|
57
|
-
/** Override thumb color when unchecked. Defaults to MD3 outline. */
|
|
58
|
-
uncheckedThumbColor?: string;
|
|
59
|
-
}
|
package/dist/ui/tabs/tab.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file tab.tsx
|
|
3
|
-
* MD3 Expressive Tab — Individual tab button with Framer Motion indicator.
|
|
4
|
-
*
|
|
5
|
-
* Design decisions:
|
|
6
|
-
* 1. PRIMARY indicator nested inside content wrapper → width = content width (not full button).
|
|
7
|
-
* 2. SECONDARY indicator outside content wrapper → `inset-x-0` = full button width.
|
|
8
|
-
* 3. ROVING TABINDEX (WAI-ARIA): only focused tab has tabIndex=0; ArrowKey moves focus, Enter/Space selects.
|
|
9
|
-
* 4. DISABLED tabs are skipped in ArrowKey navigation.
|
|
10
|
-
* 5. RTL: ArrowLeft/Right directions are swapped when `direction: rtl` is detected.
|
|
11
|
-
* 6. INLINE ICON: icon beside label, height stays 48dp (stacked = 64dp).
|
|
12
|
-
* 7. AUTO-ACTIVATE: when parent `<Tabs autoActivate>`, ArrowKey also selects.
|
|
13
|
-
*
|
|
14
|
-
* @see https://m3.material.io/components/tabs/overview
|
|
15
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
16
|
-
*/
|
|
17
|
-
import * as React from "react";
|
|
18
|
-
import type { TabProps } from "./tabs.types";
|
|
19
|
-
/**
|
|
20
|
-
* MD3 Expressive Tab component — individual tab button.
|
|
21
|
-
*
|
|
22
|
-
* Must be a direct child of `<TabsList>`. Implements WAI-ARIA Tabs pattern
|
|
23
|
-
* with roving tabindex keyboard navigation.
|
|
24
|
-
*
|
|
25
|
-
* - **Primary variant**: indicator width = content (text + icon) width.
|
|
26
|
-
* - **Secondary variant**: indicator width = full button hit area.
|
|
27
|
-
* - **Disabled**: Skipped entirely in ArrowKey navigation (cannot be focused).
|
|
28
|
-
* - **inlineIcon**: Icon beside (not above) label; height stays 48dp.
|
|
29
|
-
* - Framer Motion `layoutId` animates indicator with spring physics.
|
|
30
|
-
* - ArrowLeft/Right respect RTL direction automatically.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* <Tab value="flights" icon={<Icon name="flight" />}>Flights</Tab>
|
|
35
|
-
* <Tab value="trips">Trips</Tab>
|
|
36
|
-
* <Tab value="explore" disabled>Explore</Tab>
|
|
37
|
-
* <Tab value="hotels" icon={<Icon name="hotel" />} inlineIcon>Hotels</Tab>
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @see https://m3.material.io/components/tabs/overview
|
|
41
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
42
|
-
*/
|
|
43
|
-
export declare const Tab: React.NamedExoticComponent<TabProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file tabs-content.tsx
|
|
3
|
-
* MD3 Expressive TabsContent — Animated panel component.
|
|
4
|
-
*
|
|
5
|
-
* Implements WAI-ARIA tabpanel role with:
|
|
6
|
-
* - AnimatePresence for fade transition on tab switch
|
|
7
|
-
* - Proper aria-labelledby pointing to the associated <Tab>
|
|
8
|
-
* - tabIndex=0 so keyboard users can Tab from the tablist into the panel
|
|
9
|
-
* - Hidden panels are removed from the DOM (not just visually hidden)
|
|
10
|
-
* to prevent screen readers from reading inactive content
|
|
11
|
-
*/
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import type { TabsContentProps } from "./tabs.types";
|
|
14
|
-
/**
|
|
15
|
-
* MD3 Expressive TabsContent panel component.
|
|
16
|
-
*
|
|
17
|
-
* Each panel corresponds to a `<Tab>` with the same `value`.
|
|
18
|
-
* Only the active panel is rendered in the DOM — inactive panels
|
|
19
|
-
* are fully unmounted (not `display: none`) to prevent screen readers
|
|
20
|
-
* from reading hidden content.
|
|
21
|
-
*
|
|
22
|
-
* Fade animation is applied on both enter and exit via Framer Motion
|
|
23
|
-
* `AnimatePresence`. We use `mode="popLayout"` to prevent height layout shifting
|
|
24
|
-
* during tab transitions. Animation is automatically disabled when the user
|
|
25
|
-
* has enabled `prefers-reduced-motion`.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* <TabsContent value="flights">
|
|
30
|
-
* <p>Available flights...</p>
|
|
31
|
-
* </TabsContent>
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
35
|
-
*/
|
|
36
|
-
export declare const TabsContent: React.NamedExoticComponent<TabsContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file tabs-list.tsx
|
|
3
|
-
* MD3 Expressive TabsList — Container component for tab buttons.
|
|
4
|
-
*
|
|
5
|
-
* Responsibilities:
|
|
6
|
-
* - Applies variant (primary/secondary) layout and styling
|
|
7
|
-
* - Manages horizontal scroll for scrollable mode (52px edge padding per MD3)
|
|
8
|
-
* - Renders the bottom divider for secondary variant
|
|
9
|
-
* - Scopes Framer Motion LayoutGroup so indicators animate correctly
|
|
10
|
-
* when multiple <Tabs> instances are on the same page
|
|
11
|
-
* - Restores focus to activeTab when keyboard focus leaves the tablist
|
|
12
|
-
* (matches Google's `focusout` handler on <md-tabs>)
|
|
13
|
-
*/
|
|
14
|
-
import * as React from "react";
|
|
15
|
-
import type { TabsListProps } from "./tabs.types";
|
|
16
|
-
/**
|
|
17
|
-
* MD3 Expressive TabsList container component.
|
|
18
|
-
*
|
|
19
|
-
* Renders a horizontal row of `<Tab>` components with MD3-compliant
|
|
20
|
-
* layout (fixed or scrollable) and variant styling (primary or secondary).
|
|
21
|
-
*
|
|
22
|
-
* - **Primary**: Tabs divide available width equally, indicator width = content width.
|
|
23
|
-
* - **Secondary**: Tabs divide equally + full-width indicator + bottom divider line.
|
|
24
|
-
* - **Scrollable**: Tabs have min-width (90px), scroll horizontally with 52px edge padding.
|
|
25
|
-
* - **Focusout**: When focus leaves the tablist, roving focus resets to the active tab.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* <TabsList variant="primary" scrollable={false}>
|
|
30
|
-
* <Tab value="tab1">Tab 1</Tab>
|
|
31
|
-
* <Tab value="tab2">Tab 2</Tab>
|
|
32
|
-
* </TabsList>
|
|
33
|
-
*
|
|
34
|
-
* <TabsList variant="secondary" scrollable={true} aria-label="Content sections">
|
|
35
|
-
* <Tab value="a">Alpha</Tab>
|
|
36
|
-
* <Tab value="b">Beta</Tab>
|
|
37
|
-
* </TabsList>
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare const TabsList: React.NamedExoticComponent<TabsListProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/ui/tabs/tabs.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file tabs.tsx
|
|
3
|
-
* MD3 Expressive Tabs — Root context provider and state manager.
|
|
4
|
-
* Implements compound component pattern (similar to Radix UI).
|
|
5
|
-
* Spec: https://m3.material.io/components/tabs/overview
|
|
6
|
-
*/
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import type { TabsContextValue, TabsProps } from "./tabs.types";
|
|
9
|
-
/**
|
|
10
|
-
* Hook to consume the Tabs context.
|
|
11
|
-
* Throws if used outside a `<Tabs>` root.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare function useTabsContext(): TabsContextValue;
|
|
15
|
-
/**
|
|
16
|
-
* MD3 Expressive Tabs root component.
|
|
17
|
-
*
|
|
18
|
-
* Manages tab selection state and provides context to all
|
|
19
|
-
* compound sub-components. Supports both controlled and
|
|
20
|
-
* uncontrolled usage.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* // Uncontrolled
|
|
25
|
-
* <Tabs defaultValue="flights">
|
|
26
|
-
* <TabsList variant="primary">
|
|
27
|
-
* <Tab value="flights">Flights</Tab>
|
|
28
|
-
* <Tab value="trips">Trips</Tab>
|
|
29
|
-
* </TabsList>
|
|
30
|
-
* <TabsContent value="flights">Flight content</TabsContent>
|
|
31
|
-
* <TabsContent value="trips">Trip content</TabsContent>
|
|
32
|
-
* </Tabs>
|
|
33
|
-
*
|
|
34
|
-
* // Controlled
|
|
35
|
-
* const [tab, setTab] = useState("flights");
|
|
36
|
-
* <Tabs value={tab} onValueChange={setTab}>...</Tabs>
|
|
37
|
-
*
|
|
38
|
-
* // Auto-activate mode (focus = select)
|
|
39
|
-
* <Tabs defaultValue="flights" autoActivate>...</Tabs>
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @see https://m3.material.io/components/tabs/overview
|
|
43
|
-
*/
|
|
44
|
-
export declare const Tabs: React.NamedExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
-
/**
|
|
46
|
-
* Secondary context carrying variant + scrollable from <TabsList>.
|
|
47
|
-
* Separate from TabsContext so Tabs root doesn't need these props —
|
|
48
|
-
* they belong to the list, not the root.
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
export interface TabsListContextValue {
|
|
52
|
-
variant: "primary" | "secondary";
|
|
53
|
-
scrollable: boolean;
|
|
54
|
-
}
|
|
55
|
-
export declare const TabsListContext: React.Context<TabsListContextValue | null>;
|
|
56
|
-
/**
|
|
57
|
-
* Hook to consume TabsList-level context (variant, scrollable).
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
export declare function useTabsListContext(): TabsListContextValue;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file tabs.tokens.ts
|
|
3
|
-
* MD3 Expressive Tabs — Design tokens ported from:
|
|
4
|
-
* - PrimaryNavigationTabTokens.kt (v0_162)
|
|
5
|
-
* - SecondaryNavigationTabTokens.kt (v0_162)
|
|
6
|
-
*
|
|
7
|
-
* All dimensional values are in px (dp equivalent for web).
|
|
8
|
-
* @see docs/m3/tabs/PrimaryNavigationTabTokens.kt
|
|
9
|
-
* @see docs/m3/tabs/SecondaryNavigationTabTokens.kt
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Dimensional design tokens for the MD3 Tabs component.
|
|
13
|
-
*
|
|
14
|
-
* Maps directly from the `.kt` token files to CSS/JS values.
|
|
15
|
-
* Use as the single source of truth for sizing.
|
|
16
|
-
*/
|
|
17
|
-
export declare const TabsTokens: {
|
|
18
|
-
/** ContainerHeight = 48dp (text-only tab) */
|
|
19
|
-
readonly containerHeight: 48;
|
|
20
|
-
/** IconAndLabelTextContainerHeight = 64dp (tab with icon + label stacked) */
|
|
21
|
-
readonly containerHeightWithIcon: 64;
|
|
22
|
-
/** ActiveIndicatorHeight (Primary) = 3dp */
|
|
23
|
-
readonly primaryIndicatorHeight: 3;
|
|
24
|
-
/** ActiveIndicatorHeight (Secondary) = 2dp */
|
|
25
|
-
readonly secondaryIndicatorHeight: 2;
|
|
26
|
-
/**
|
|
27
|
-
* ActiveIndicatorShape = 3dp top-left and top-right (per MD3 token, not a full pill).
|
|
28
|
-
* Google reference: `var(--_active-indicator-shape)` resolves to `3px 3px 0 0` effectively.
|
|
29
|
-
*/
|
|
30
|
-
readonly indicatorBorderRadius: "3px 3px 0 0";
|
|
31
|
-
/** IconSize = 24dp */
|
|
32
|
-
readonly iconSize: 24;
|
|
33
|
-
/**
|
|
34
|
-
* Edge start/end padding for scrollable mode = 52px.
|
|
35
|
-
* Per MD3 spec: tabs have padding on both leading and trailing edges.
|
|
36
|
-
*/
|
|
37
|
-
readonly scrollableEdgePadding: 52;
|
|
38
|
-
/** Minimum tab width in scrollable mode = 90px. */
|
|
39
|
-
readonly scrollableMinTabWidth: 90;
|
|
40
|
-
/** DividerHeight = 1dp */
|
|
41
|
-
readonly dividerHeight: 1;
|
|
42
|
-
/**
|
|
43
|
-
* Focus ring border-radius = 8px.
|
|
44
|
-
* Google reference: `focus-ring.theme({ shape: 8px })` in _tab.scss.
|
|
45
|
-
*/
|
|
46
|
-
readonly focusRingBorderRadius: 8;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* CSS custom property references for Tabs colors.
|
|
50
|
-
* Maps to `--md-sys-color-*` tokens in the MD3 theme system.
|
|
51
|
-
*
|
|
52
|
-
* DO NOT hardcode hex values — use these references for automatic
|
|
53
|
-
* light/dark theme adaptation.
|
|
54
|
-
*/
|
|
55
|
-
export declare const TabsColors: {
|
|
56
|
-
/** Primary: ActiveLabelTextColor / ActiveIconColor = Primary */
|
|
57
|
-
readonly primaryActiveText: "var(--md-sys-color-primary)";
|
|
58
|
-
/** Primary: InactiveLabelTextColor / InactiveIconColor = OnSurfaceVariant */
|
|
59
|
-
readonly primaryInactiveText: "var(--md-sys-color-on-surface-variant)";
|
|
60
|
-
/** Primary: ActiveIndicatorColor = Primary */
|
|
61
|
-
readonly primaryIndicator: "var(--md-sys-color-primary)";
|
|
62
|
-
/** Secondary: ActiveLabelTextColor / ActiveIconColor = OnSurface */
|
|
63
|
-
readonly secondaryActiveText: "var(--md-sys-color-on-surface)";
|
|
64
|
-
/** Secondary: InactiveLabelTextColor / InactiveIconColor = OnSurfaceVariant */
|
|
65
|
-
readonly secondaryInactiveText: "var(--md-sys-color-on-surface-variant)";
|
|
66
|
-
/** Secondary: Indicator color = Primary (same as primary variant) */
|
|
67
|
-
readonly secondaryIndicator: "var(--md-sys-color-primary)";
|
|
68
|
-
/** Secondary: DividerColor = SurfaceVariant */
|
|
69
|
-
readonly divider: "var(--md-sys-color-surface-variant)";
|
|
70
|
-
/** ContainerColor = Surface */
|
|
71
|
-
readonly container: "var(--md-sys-color-surface)";
|
|
72
|
-
/** Focus ring indicator = Secondary */
|
|
73
|
-
readonly focusIndicator: "var(--md-sys-color-secondary)";
|
|
74
|
-
/** Hover state layer (primary active) */
|
|
75
|
-
readonly primaryActiveHover: "var(--md-sys-color-primary)";
|
|
76
|
-
/** Hover state layer (inactive, both variants) */
|
|
77
|
-
readonly inactiveHover: "var(--md-sys-color-on-surface)";
|
|
78
|
-
};
|
|
79
|
-
/** Spring transition for the sliding indicator (FastSpatial equivalent). */
|
|
80
|
-
export declare const TABS_INDICATOR_SPRING: {
|
|
81
|
-
readonly type: "spring";
|
|
82
|
-
readonly stiffness: 500;
|
|
83
|
-
readonly damping: 40;
|
|
84
|
-
};
|
|
85
|
-
/** Color transition for label/icon color animate (active ↔ inactive). */
|
|
86
|
-
export declare const TABS_COLOR_TRANSITION: {
|
|
87
|
-
readonly duration: 0.2;
|
|
88
|
-
readonly ease: "easeInOut";
|
|
89
|
-
};
|
|
90
|
-
/** Content fade transition when switching tabs. */
|
|
91
|
-
export declare const TABS_CONTENT_TRANSITION: {
|
|
92
|
-
readonly duration: 0.15;
|
|
93
|
-
readonly ease: "easeInOut";
|
|
94
|
-
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file tabs.types.ts
|
|
3
|
-
* MD3 Expressive Tabs — TypeScript prop definitions.
|
|
4
|
-
* Spec: https://m3.material.io/components/tabs/overview
|
|
5
|
-
*/
|
|
6
|
-
import type * as React from "react";
|
|
7
|
-
/** Visual variant: primary (content-width indicator) or secondary (full-width indicator + divider). */
|
|
8
|
-
export type TabsVariant = "primary" | "secondary";
|
|
9
|
-
/**
|
|
10
|
-
* Internal context shared across all compound components.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export interface TabsContextValue {
|
|
14
|
-
/** Currently selected tab value. */
|
|
15
|
-
value: string;
|
|
16
|
-
/** Callback to change the selected tab. */
|
|
17
|
-
onValueChange: (value: string) => void;
|
|
18
|
-
/** Currently keyboard-focused tab value (for roving tabindex). */
|
|
19
|
-
focusedValue: string;
|
|
20
|
-
/** Sets the focused tab value (keyboard nav only — does NOT select). */
|
|
21
|
-
setFocusedValue: (value: string) => void;
|
|
22
|
-
/** Ordered list of all registered tab values (for ArrowKey nav). */
|
|
23
|
-
tabValues: string[];
|
|
24
|
-
/** Register a tab value when a <Tab> mounts. */
|
|
25
|
-
registerTab: (value: string) => void;
|
|
26
|
-
/** Unregister a tab value when a <Tab> unmounts. */
|
|
27
|
-
unregisterTab: (value: string) => void;
|
|
28
|
-
/** Unique layout group ID scoped to this Tabs instance. */
|
|
29
|
-
layoutGroupId: string;
|
|
30
|
-
/**
|
|
31
|
-
* Set of currently disabled tab values.
|
|
32
|
-
* Used by keyboard navigation to skip disabled tabs.
|
|
33
|
-
*/
|
|
34
|
-
disabledValues: Set<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Mark or unmark a tab value as disabled.
|
|
37
|
-
* Called by <Tab> on mount and when `disabled` prop changes.
|
|
38
|
-
*/
|
|
39
|
-
markTabDisabled: (value: string, disabled: boolean) => void;
|
|
40
|
-
/**
|
|
41
|
-
* When true, focus moving via ArrowKey also selects the tab immediately.
|
|
42
|
-
* Mirrors Google's `autoActivate` attribute on <md-tabs>.
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
autoActivate: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Props for the `<Tabs>` root component.
|
|
49
|
-
*
|
|
50
|
-
* Supports both controlled (`value` + `onValueChange`) and
|
|
51
|
-
* uncontrolled (`defaultValue`) usage patterns.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```tsx
|
|
55
|
-
* // Controlled
|
|
56
|
-
* <Tabs value={tab} onValueChange={setTab}>...</Tabs>
|
|
57
|
-
*
|
|
58
|
-
* // Uncontrolled
|
|
59
|
-
* <Tabs defaultValue="flights">...</Tabs>
|
|
60
|
-
*
|
|
61
|
-
* // Auto-activate (focus = select)
|
|
62
|
-
* <Tabs defaultValue="flights" autoActivate>...</Tabs>
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export interface TabsProps {
|
|
66
|
-
/** Controlled selected value. Use with `onValueChange`. */
|
|
67
|
-
value?: string;
|
|
68
|
-
/** Initial value for uncontrolled usage. */
|
|
69
|
-
defaultValue?: string;
|
|
70
|
-
/** Called when the selected tab changes. */
|
|
71
|
-
onValueChange?: (value: string) => void;
|
|
72
|
-
/**
|
|
73
|
-
* When true, ArrowKey navigation also selects the focused tab immediately.
|
|
74
|
-
* Mirrors Google's `auto-activate` attribute on `<md-tabs>`.
|
|
75
|
-
* @default false
|
|
76
|
-
*/
|
|
77
|
-
autoActivate?: boolean;
|
|
78
|
-
/** Tab compound components as children. */
|
|
79
|
-
children: React.ReactNode;
|
|
80
|
-
/** Additional CSS class names for the root wrapper. */
|
|
81
|
-
className?: string;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Props for the `<TabsList>` container component.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```tsx
|
|
88
|
-
* <TabsList variant="primary" scrollable={false}>
|
|
89
|
-
* <Tab value="tab1">Tab 1</Tab>
|
|
90
|
-
* </TabsList>
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export interface TabsListProps {
|
|
94
|
-
/** Visual style variant. @required */
|
|
95
|
-
variant: TabsVariant;
|
|
96
|
-
/**
|
|
97
|
-
* When true, tabs scroll horizontally with 52px edge padding (MD3 spec).
|
|
98
|
-
* When false, tabs divide the available width equally (flex-1).
|
|
99
|
-
* @default false
|
|
100
|
-
*/
|
|
101
|
-
scrollable?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Background color override for the tab bar.
|
|
104
|
-
* @default "var(--md-sys-color-surface)"
|
|
105
|
-
*/
|
|
106
|
-
backgroundColor?: string;
|
|
107
|
-
/** Tab components as children. */
|
|
108
|
-
children: React.ReactNode;
|
|
109
|
-
/** Additional CSS class names. */
|
|
110
|
-
className?: string;
|
|
111
|
-
/** Forwarded aria-label for the tablist. */
|
|
112
|
-
"aria-label"?: string;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Props for an individual `<Tab>` component.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```tsx
|
|
119
|
-
* <Tab value="flights" icon={<Icon name="flight" />}>Flights</Tab>
|
|
120
|
-
* <Tab value="trips" disabled>Trips</Tab>
|
|
121
|
-
* <Tab value="hotels" icon={<Icon name="hotel" />} inlineIcon>Hotels</Tab>
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export interface TabProps {
|
|
125
|
-
/** Unique value identifying this tab. Must match a `<TabsContent value>`. */
|
|
126
|
-
value: string;
|
|
127
|
-
/**
|
|
128
|
-
* Optional icon rendered with the label text.
|
|
129
|
-
* - Default (stacked): icon above label, height increases to 64dp.
|
|
130
|
-
* - With `inlineIcon`: icon beside label (same row), height stays 48dp.
|
|
131
|
-
*/
|
|
132
|
-
icon?: React.ReactNode;
|
|
133
|
-
/**
|
|
134
|
-
* When true, icon is placed inline (same row) with the label text.
|
|
135
|
-
* Container height stays at 48dp (does NOT increase to 64dp).
|
|
136
|
-
* Mirrors the `inline-icon` attribute on `<md-primary-tab>`.
|
|
137
|
-
* @default false
|
|
138
|
-
*/
|
|
139
|
-
inlineIcon?: boolean;
|
|
140
|
-
/**
|
|
141
|
-
* When true, disables interaction.
|
|
142
|
-
* Disabled tabs are skipped entirely in keyboard navigation (ArrowKey).
|
|
143
|
-
*/
|
|
144
|
-
disabled?: boolean;
|
|
145
|
-
/** Additional CSS class names. */
|
|
146
|
-
className?: string;
|
|
147
|
-
/**
|
|
148
|
-
* Optional badge element overlaid on the tab content.
|
|
149
|
-
* Handled via `BadgedBox`:
|
|
150
|
-
* - Stacked icon: Overlaps icon's top-trailing corner.
|
|
151
|
-
* - Inline/Text-only: Placed next to the text.
|
|
152
|
-
*/
|
|
153
|
-
badge?: React.ReactNode;
|
|
154
|
-
/** Label text rendered inside the tab. */
|
|
155
|
-
children: React.ReactNode;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Props for the `<TabsContent>` panel component.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```tsx
|
|
162
|
-
* <TabsContent value="flights">Flight content here</TabsContent>
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
export interface TabsContentProps {
|
|
166
|
-
/** Must match the `value` of a sibling `<Tab>`. */
|
|
167
|
-
value: string;
|
|
168
|
-
/** Additional CSS class names. */
|
|
169
|
-
className?: string;
|
|
170
|
-
/** Panel content. */
|
|
171
|
-
children: React.ReactNode;
|
|
172
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file active-indicator.tsx
|
|
3
|
-
* Animated bottom border line for the MD3 Filled TextField.
|
|
4
|
-
* Expands height from 1px → 2px and color changes on focus.
|
|
5
|
-
*/
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
export interface ActiveIndicatorProps {
|
|
8
|
-
isFocused: boolean;
|
|
9
|
-
isError: boolean;
|
|
10
|
-
isDisabled: boolean;
|
|
11
|
-
isHovered: boolean;
|
|
12
|
-
prefersReduced: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* MD3 Active Indicator — the bottom border line for Filled TextField.
|
|
16
|
-
*
|
|
17
|
-
* Animates:
|
|
18
|
-
* - `height`: 1px (enabled) → 2px (focused)
|
|
19
|
-
* - `backgroundColor`: on-surface-variant → primary (focused) → error
|
|
20
|
-
* - `scaleX`: 0 → 1 expanding from center on focus in
|
|
21
|
-
*
|
|
22
|
-
* @see https://m3.material.io/components/text-fields/specs#filled-text-field
|
|
23
|
-
*/
|
|
24
|
-
export declare const ActiveIndicator: React.NamedExoticComponent<ActiveIndicatorProps>;
|