@matekit/react 0.0.0-stage → 0.1.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 (268) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +56 -0
  4. package/README.md +115 -2
  5. package/dist/atoms/Divider/Divider.d.ts +49 -0
  6. package/dist/atoms/Divider/Divider.js +29 -0
  7. package/dist/atoms/FocusRing/FocusRing.d.ts +16 -0
  8. package/dist/atoms/FocusRing/FocusRing.js +16 -0
  9. package/dist/atoms/Group/Group.d.ts +38 -0
  10. package/dist/atoms/Group/Group.js +34 -0
  11. package/dist/atoms/Icon/Icon.d.ts +23 -0
  12. package/dist/atoms/Icon/Icon.js +19 -0
  13. package/dist/atoms/Interactive/Interactive.d.ts +98 -0
  14. package/dist/atoms/Interactive/Interactive.js +87 -0
  15. package/dist/atoms/Ripple/Ripple.d.ts +14 -0
  16. package/dist/atoms/Ripple/Ripple.js +63 -0
  17. package/dist/atoms/Shape/Shape.d.ts +24 -0
  18. package/dist/atoms/Shape/Shape.js +19 -0
  19. package/dist/atoms/Shape/shapes.d.ts +8 -0
  20. package/dist/atoms/Shape/shapes.js +40 -0
  21. package/dist/atoms/Stack/Stack.d.ts +58 -0
  22. package/dist/atoms/Stack/Stack.js +33 -0
  23. package/dist/atoms/StateLayer/StateLayer.d.ts +17 -0
  24. package/dist/atoms/StateLayer/StateLayer.js +17 -0
  25. package/dist/atoms/index.d.ts +10 -0
  26. package/dist/atoms/index.js +10 -0
  27. package/dist/fonts/roboto-flex/OFL.txt +93 -0
  28. package/dist/fonts/roboto-flex/roboto-flex-cyrillic-ext.woff2 +0 -0
  29. package/dist/fonts/roboto-flex/roboto-flex-cyrillic.woff2 +0 -0
  30. package/dist/fonts/roboto-flex/roboto-flex-greek.woff2 +0 -0
  31. package/dist/fonts/roboto-flex/roboto-flex-latin-ext.woff2 +0 -0
  32. package/dist/fonts/roboto-flex/roboto-flex-latin.woff2 +0 -0
  33. package/dist/fonts/roboto-flex/roboto-flex-vietnamese.woff2 +0 -0
  34. package/dist/icons/icons.d.ts +89 -0
  35. package/dist/icons/icons.js +186 -0
  36. package/dist/icons/index.d.ts +1 -0
  37. package/dist/icons/index.js +3 -0
  38. package/dist/index.d.ts +8 -0
  39. package/dist/index.js +12 -0
  40. package/dist/internal/accessible-name.d.ts +17 -0
  41. package/dist/internal/accessible-name.js +33 -0
  42. package/dist/internal/anchor-position.d.ts +99 -0
  43. package/dist/internal/anchor-position.js +159 -0
  44. package/dist/internal/anchored-drag.d.ts +25 -0
  45. package/dist/internal/anchored-drag.js +106 -0
  46. package/dist/internal/dev.d.ts +2 -0
  47. package/dist/internal/dev.js +18 -0
  48. package/dist/internal/diagnostics.d.ts +46 -0
  49. package/dist/internal/diagnostics.js +125 -0
  50. package/dist/internal/group-label.d.ts +22 -0
  51. package/dist/internal/group-label.js +50 -0
  52. package/dist/internal/interactive.d.ts +28 -0
  53. package/dist/internal/interactive.js +18 -0
  54. package/dist/internal/layout-element.d.ts +21 -0
  55. package/dist/internal/layout-element.js +33 -0
  56. package/dist/internal/merge-refs.d.ts +13 -0
  57. package/dist/internal/merge-refs.js +35 -0
  58. package/dist/internal/modal-dialog.d.ts +63 -0
  59. package/dist/internal/modal-dialog.js +267 -0
  60. package/dist/internal/navigation-count.d.ts +38 -0
  61. package/dist/internal/navigation-count.js +60 -0
  62. package/dist/internal/navigation-item.d.ts +14 -0
  63. package/dist/internal/navigation-item.js +17 -0
  64. package/dist/internal/nearest-scroller.d.ts +4 -0
  65. package/dist/internal/nearest-scroller.js +17 -0
  66. package/dist/internal/open-state.d.ts +15 -0
  67. package/dist/internal/open-state.js +42 -0
  68. package/dist/internal/roving-focus.d.ts +41 -0
  69. package/dist/internal/roving-focus.js +126 -0
  70. package/dist/internal/settle-animations.d.ts +33 -0
  71. package/dist/internal/settle-animations.js +48 -0
  72. package/dist/internal/time-period.d.ts +10 -0
  73. package/dist/internal/time-period.js +26 -0
  74. package/dist/internal/time.d.ts +23 -0
  75. package/dist/internal/time.js +69 -0
  76. package/dist/internal/typeahead.d.ts +17 -0
  77. package/dist/internal/typeahead.js +35 -0
  78. package/dist/molecules/Badge/Badge.d.ts +25 -0
  79. package/dist/molecules/Badge/Badge.js +16 -0
  80. package/dist/molecules/Button/Button.d.ts +48 -0
  81. package/dist/molecules/Button/Button.js +34 -0
  82. package/dist/molecules/Card/Card.d.ts +159 -0
  83. package/dist/molecules/Card/Card.js +119 -0
  84. package/dist/molecules/Checkbox/Checkbox.d.ts +26 -0
  85. package/dist/molecules/Checkbox/Checkbox.js +40 -0
  86. package/dist/molecules/Chip/AssistChip.d.ts +23 -0
  87. package/dist/molecules/Chip/AssistChip.js +22 -0
  88. package/dist/molecules/Chip/ChipGroup.d.ts +85 -0
  89. package/dist/molecules/Chip/ChipGroup.js +92 -0
  90. package/dist/molecules/Chip/FilterChip.d.ts +33 -0
  91. package/dist/molecules/Chip/FilterChip.js +30 -0
  92. package/dist/molecules/Chip/InputChip.d.ts +60 -0
  93. package/dist/molecules/Chip/InputChip.js +107 -0
  94. package/dist/molecules/Chip/SuggestionChip.d.ts +24 -0
  95. package/dist/molecules/Chip/SuggestionChip.js +17 -0
  96. package/dist/molecules/Chip/chip-content.d.ts +39 -0
  97. package/dist/molecules/Chip/chip-content.js +95 -0
  98. package/dist/molecules/Chip/chip-element.d.ts +14 -0
  99. package/dist/molecules/Chip/chip-element.js +14 -0
  100. package/dist/molecules/Chip/strings.d.ts +8 -0
  101. package/dist/molecules/Chip/strings.js +5 -0
  102. package/dist/molecules/Fab/Fab.d.ts +78 -0
  103. package/dist/molecules/Fab/Fab.js +52 -0
  104. package/dist/molecules/IconButton/IconButton.d.ts +59 -0
  105. package/dist/molecules/IconButton/IconButton.js +36 -0
  106. package/dist/molecules/LoadingIndicator/LoadingIndicator.d.ts +38 -0
  107. package/dist/molecules/LoadingIndicator/LoadingIndicator.js +25 -0
  108. package/dist/molecules/LoadingIndicator/determinate.d.ts +3 -0
  109. package/dist/molecules/LoadingIndicator/determinate.js +47 -0
  110. package/dist/molecules/LoadingIndicator/loading-indicator-data.d.ts +21 -0
  111. package/dist/molecules/LoadingIndicator/loading-indicator-data.js +72 -0
  112. package/dist/molecules/ProgressIndicator/CircularProgressIndicator.d.ts +35 -0
  113. package/dist/molecules/ProgressIndicator/CircularProgressIndicator.js +30 -0
  114. package/dist/molecules/ProgressIndicator/LinearProgressIndicator.d.ts +43 -0
  115. package/dist/molecules/ProgressIndicator/LinearProgressIndicator.js +28 -0
  116. package/dist/molecules/ProgressIndicator/circular-wavy-data.d.ts +5 -0
  117. package/dist/molecules/ProgressIndicator/circular-wavy-data.js +19 -0
  118. package/dist/molecules/ProgressIndicator/progress.d.ts +24 -0
  119. package/dist/molecules/ProgressIndicator/progress.js +60 -0
  120. package/dist/molecules/RadioButton/RadioButton.d.ts +27 -0
  121. package/dist/molecules/RadioButton/RadioButton.js +70 -0
  122. package/dist/molecules/RadioButton/RadioGroup.d.ts +73 -0
  123. package/dist/molecules/RadioButton/RadioGroup.js +82 -0
  124. package/dist/molecules/ScrollField/ScrollField.d.ts +61 -0
  125. package/dist/molecules/ScrollField/ScrollField.js +352 -0
  126. package/dist/molecules/Slider/RangeSlider.d.ts +60 -0
  127. package/dist/molecules/Slider/RangeSlider.js +169 -0
  128. package/dist/molecules/Slider/Slider.d.ts +54 -0
  129. package/dist/molecules/Slider/Slider.js +71 -0
  130. package/dist/molecules/Slider/slider-shared.d.ts +26 -0
  131. package/dist/molecules/Slider/slider-shared.js +98 -0
  132. package/dist/molecules/Switch/Switch.d.ts +22 -0
  133. package/dist/molecules/Switch/Switch.js +20 -0
  134. package/dist/molecules/TextField/TextField.d.ts +83 -0
  135. package/dist/molecules/TextField/TextField.js +146 -0
  136. package/dist/molecules/TextField/TextFieldSlots.d.ts +22 -0
  137. package/dist/molecules/TextField/TextFieldSlots.js +24 -0
  138. package/dist/molecules/TimeInput/TimeInput.d.ts +108 -0
  139. package/dist/molecules/TimeInput/TimeInput.js +347 -0
  140. package/dist/molecules/TimeInput/strings.d.ts +13 -0
  141. package/dist/molecules/TimeInput/strings.js +10 -0
  142. package/dist/molecules/TimeScroll/TimeScroll.d.ts +106 -0
  143. package/dist/molecules/TimeScroll/TimeScroll.js +213 -0
  144. package/dist/molecules/TimeScroll/strings.d.ts +13 -0
  145. package/dist/molecules/TimeScroll/strings.js +12 -0
  146. package/dist/molecules/index.d.ts +27 -0
  147. package/dist/molecules/index.js +25 -0
  148. package/dist/organisms/BottomSheet/BottomSheet.d.ts +128 -0
  149. package/dist/organisms/BottomSheet/BottomSheet.js +432 -0
  150. package/dist/organisms/BottomSheet/BottomSheetSlots.d.ts +17 -0
  151. package/dist/organisms/BottomSheet/BottomSheetSlots.js +16 -0
  152. package/dist/organisms/BottomSheet/StandardBottomSheet.d.ts +37 -0
  153. package/dist/organisms/BottomSheet/StandardBottomSheet.js +206 -0
  154. package/dist/organisms/BottomSheet/bottom-sheet-context.d.ts +31 -0
  155. package/dist/organisms/BottomSheet/bottom-sheet-context.js +12 -0
  156. package/dist/organisms/BottomSheet/sheet-drag.d.ts +1 -0
  157. package/dist/organisms/BottomSheet/sheet-drag.js +4 -0
  158. package/dist/organisms/BottomSheet/strings.d.ts +9 -0
  159. package/dist/organisms/BottomSheet/strings.js +8 -0
  160. package/dist/organisms/ButtonGroup/ButtonGroup.d.ts +97 -0
  161. package/dist/organisms/ButtonGroup/ButtonGroup.js +242 -0
  162. package/dist/organisms/ButtonGroup/ButtonGroupItem.d.ts +36 -0
  163. package/dist/organisms/ButtonGroup/ButtonGroupItem.js +47 -0
  164. package/dist/organisms/Dialog/Dialog.d.ts +186 -0
  165. package/dist/organisms/Dialog/Dialog.js +193 -0
  166. package/dist/organisms/Dialog/DialogSlots.d.ts +60 -0
  167. package/dist/organisms/Dialog/DialogSlots.js +54 -0
  168. package/dist/organisms/Dialog/strings.d.ts +5 -0
  169. package/dist/organisms/Dialog/strings.js +5 -0
  170. package/dist/organisms/FabMenu/FabMenu.d.ts +104 -0
  171. package/dist/organisms/FabMenu/FabMenu.js +142 -0
  172. package/dist/organisms/FabMenu/strings.d.ts +9 -0
  173. package/dist/organisms/FabMenu/strings.js +5 -0
  174. package/dist/organisms/List/List.d.ts +190 -0
  175. package/dist/organisms/List/List.js +148 -0
  176. package/dist/organisms/Menu/Menu.d.ts +313 -0
  177. package/dist/organisms/Menu/Menu.js +865 -0
  178. package/dist/organisms/Menu/MenuSlots.d.ts +35 -0
  179. package/dist/organisms/Menu/MenuSlots.js +36 -0
  180. package/dist/organisms/NavigationBar/NavigationBar.d.ts +96 -0
  181. package/dist/organisms/NavigationBar/NavigationBar.js +77 -0
  182. package/dist/organisms/NavigationRail/ModalNavigationRail.d.ts +105 -0
  183. package/dist/organisms/NavigationRail/ModalNavigationRail.js +272 -0
  184. package/dist/organisms/NavigationRail/NavigationRail.d.ts +148 -0
  185. package/dist/organisms/NavigationRail/NavigationRail.js +114 -0
  186. package/dist/organisms/NavigationRail/NavigationRailSection.d.ts +54 -0
  187. package/dist/organisms/NavigationRail/NavigationRailSection.js +96 -0
  188. package/dist/organisms/NavigationRail/strings.d.ts +7 -0
  189. package/dist/organisms/NavigationRail/strings.js +7 -0
  190. package/dist/organisms/NavigationSuite/NavigationSuite.d.ts +109 -0
  191. package/dist/organisms/NavigationSuite/NavigationSuite.js +86 -0
  192. package/dist/organisms/PaneScaffold/PaneScaffold.d.ts +106 -0
  193. package/dist/organisms/PaneScaffold/PaneScaffold.js +120 -0
  194. package/dist/organisms/Search/Search.d.ts +207 -0
  195. package/dist/organisms/Search/Search.js +754 -0
  196. package/dist/organisms/Search/SearchSlots.d.ts +16 -0
  197. package/dist/organisms/Search/SearchSlots.js +17 -0
  198. package/dist/organisms/Search/strings.d.ts +21 -0
  199. package/dist/organisms/Search/strings.js +12 -0
  200. package/dist/organisms/Select/Select.d.ts +186 -0
  201. package/dist/organisms/Select/Select.js +597 -0
  202. package/dist/organisms/Select/SelectSlots.d.ts +12 -0
  203. package/dist/organisms/Select/SelectSlots.js +12 -0
  204. package/dist/organisms/SideSheet/SideSheet.d.ts +88 -0
  205. package/dist/organisms/SideSheet/SideSheet.js +109 -0
  206. package/dist/organisms/SideSheet/SideSheetSlots.d.ts +35 -0
  207. package/dist/organisms/SideSheet/SideSheetSlots.js +37 -0
  208. package/dist/organisms/SideSheet/strings.d.ts +7 -0
  209. package/dist/organisms/SideSheet/strings.js +6 -0
  210. package/dist/organisms/Snackbar/Snackbar.d.ts +46 -0
  211. package/dist/organisms/Snackbar/Snackbar.js +36 -0
  212. package/dist/organisms/Snackbar/SnackbarHost.d.ts +57 -0
  213. package/dist/organisms/Snackbar/SnackbarHost.js +221 -0
  214. package/dist/organisms/Snackbar/snackbar-queue.d.ts +81 -0
  215. package/dist/organisms/Snackbar/snackbar-queue.js +114 -0
  216. package/dist/organisms/Snackbar/strings.d.ts +8 -0
  217. package/dist/organisms/Snackbar/strings.js +5 -0
  218. package/dist/organisms/SplitButton/SplitButton.d.ts +73 -0
  219. package/dist/organisms/SplitButton/SplitButton.js +77 -0
  220. package/dist/organisms/SplitButton/strings.d.ts +9 -0
  221. package/dist/organisms/SplitButton/strings.js +5 -0
  222. package/dist/organisms/Tabs/TabLink.d.ts +27 -0
  223. package/dist/organisms/Tabs/TabLink.js +25 -0
  224. package/dist/organisms/Tabs/TabNav.d.ts +19 -0
  225. package/dist/organisms/Tabs/TabNav.js +55 -0
  226. package/dist/organisms/Tabs/Tabs.d.ts +147 -0
  227. package/dist/organisms/Tabs/Tabs.js +223 -0
  228. package/dist/organisms/Tabs/tab-content.d.ts +23 -0
  229. package/dist/organisms/Tabs/tab-content.js +105 -0
  230. package/dist/organisms/Tabs/tab-fit.d.ts +4 -0
  231. package/dist/organisms/Tabs/tab-fit.js +65 -0
  232. package/dist/organisms/Tabs/tab-motion.d.ts +2 -0
  233. package/dist/organisms/Tabs/tab-motion.js +68 -0
  234. package/dist/organisms/TimePickerDialog/TimePickerDialog.d.ts +26 -0
  235. package/dist/organisms/TimePickerDialog/TimePickerDialog.js +34 -0
  236. package/dist/organisms/Toolbar/Toolbar.d.ts +75 -0
  237. package/dist/organisms/Toolbar/Toolbar.js +84 -0
  238. package/dist/organisms/Toolbar/ToolbarLayout.d.ts +44 -0
  239. package/dist/organisms/Toolbar/ToolbarLayout.js +90 -0
  240. package/dist/organisms/Toolbar/ToolbarScroll.d.ts +8 -0
  241. package/dist/organisms/Toolbar/ToolbarScroll.js +222 -0
  242. package/dist/organisms/Tooltip/RichTooltip.d.ts +73 -0
  243. package/dist/organisms/Tooltip/RichTooltip.js +250 -0
  244. package/dist/organisms/Tooltip/Tooltip.d.ts +52 -0
  245. package/dist/organisms/Tooltip/Tooltip.js +99 -0
  246. package/dist/organisms/Tooltip/tooltip-behavior.d.ts +43 -0
  247. package/dist/organisms/Tooltip/tooltip-behavior.js +307 -0
  248. package/dist/organisms/TopAppBar/TopAppBar.d.ts +107 -0
  249. package/dist/organisms/TopAppBar/TopAppBar.js +78 -0
  250. package/dist/organisms/TopAppBar/TopAppBarScroll.d.ts +7 -0
  251. package/dist/organisms/TopAppBar/TopAppBarScroll.js +155 -0
  252. package/dist/organisms/index.d.ts +36 -0
  253. package/dist/organisms/index.js +36 -0
  254. package/dist/palettes/blue.css +275 -0
  255. package/dist/palettes/green.css +275 -0
  256. package/dist/palettes/index.css +823 -0
  257. package/dist/palettes/orange.css +275 -0
  258. package/dist/shapes.css +115 -0
  259. package/dist/strings/index.d.ts +35 -0
  260. package/dist/strings/index.js +39 -0
  261. package/dist/styles-no-fonts.css +11991 -0
  262. package/dist/styles.css +12089 -0
  263. package/dist/stylesheet.d.ts +2 -0
  264. package/dist/tokens/breakpoints.d.ts +33 -0
  265. package/dist/tokens/breakpoints.js +31 -0
  266. package/dist/tokens/space.d.ts +26 -0
  267. package/dist/tokens/space.js +26 -0
  268. package/package.json +110 -3
@@ -0,0 +1,148 @@
1
+ import type { HTMLAttributes, Ref } from 'react';
2
+ import type { ButtonElementProps, LinkElementProps, RenderElementProps } from '../../atoms/Interactive/Interactive.tsx';
3
+ import { type NavigationItemOwnProps } from '../../internal/navigation-item.tsx';
4
+ export type NavigationRailVariant = 'docked' | 'floating';
5
+ export type NavigationRailAlign = 'top' | 'middle';
6
+ export type NavigationRailCollapsedLabels = 'visible' | 'hidden';
7
+ export interface NavigationRailProps extends HTMLAttributes<HTMLElement> {
8
+ /**
9
+ * Expanded (220 px wide, destinations with the icon next to the label) or collapsed (96 px, icon
10
+ * above the label). The app controls it; the change animates with the default spatial spring.
11
+ * Defaults to `false`.
12
+ */
13
+ expanded?: boolean | undefined;
14
+ /**
15
+ * `docked` (the default): no background, against the edge. `floating`: when expanded, a
16
+ * `surface-container` background with radius 16. Collapsed, both look the same (the kit has no
17
+ * floating collapsed rail).
18
+ */
19
+ variant?: NavigationRailVariant | undefined;
20
+ /**
21
+ * `top` (the default): the destinations go below the header block. `middle`: the destinations are
22
+ * centered in the rail's full height and the header block stays at the top; if there is no room,
23
+ * the destinations move down so as not to cover the block.
24
+ */
25
+ align?: NavigationRailAlign | undefined;
26
+ /**
27
+ * Destination labels when the rail is collapsed: `visible` (the default) or `hidden` (a 56 × 56
28
+ * indicator with only the icon, the kit's "Show label"). Hidden, they are still each destination's
29
+ * accessible name. Expanded, they are always shown.
30
+ */
31
+ collapsedLabels?: NavigationRailCollapsedLabels | undefined;
32
+ /** Ref to the `<nav>`. */
33
+ ref?: Ref<HTMLElement> | undefined;
34
+ }
35
+ /**
36
+ * Material 3 Expressive navigation rail: a vertical `<nav>` for medium and large screens, collapsed
37
+ * (96 px) or expanded (220 px).
38
+ *
39
+ * **When to use it** (Material 3 window size classes): in a compact window (less than 600 px wide),
40
+ * a NavigationBar at the bottom; in a medium one (600 to 839 px), the collapsed rail; in an expanded
41
+ * one (840 px or more), the collapsed or expanded rail, depending on how much room the app wants to
42
+ * give it. The component decides none of that and has no media queries: the app chooses what to
43
+ * render and whether it is `expanded` (for example with `matchMedia` or with the menu button).
44
+ *
45
+ * **Height and position:** it takes its container's height (`height: 100%`) and scrolls if the
46
+ * destinations do not fit. The app places it (in a grid or flex next to the content, or fixed with
47
+ * `position: sticky`). The expanded width changes with the `--mk-navigation-rail-expanded-width`
48
+ * variable, between 220 and 360 px (Compose's minimum and maximum).
49
+ *
50
+ * Name: if the page has more than one `<nav>`, give it a name with `aria-label`.
51
+ *
52
+ * **Destinations:** collapsed, **3 to 7** (Material guidance), in any window; expanded, **no
53
+ * limit**. If they do not fit in height, the rail scrolls vertically (both states); it never
54
+ * overflows in width: long labels are truncated with an ellipsis. Collapsed with more than 7, it
55
+ * warns in development (`MK_NAVIGATION_TOO_MANY_DESTINATIONS`); the fix is to have fewer, or move the
56
+ * rest to a `ModalNavigationRail` or a `Menu`. The warning counts the `NavigationRailItem` children
57
+ * (also in arrays, fragments, `NavigationRailSection`s or wrapped one by one, as in a `Tooltip`); it
58
+ * does not see the ones another component renders.
59
+ *
60
+ * **Sections:** with many destinations (expanded or in a `ModalNavigationRail`), group them in
61
+ * `NavigationRailSection`s with a `NavigationRailSectionLabel`; the rail draws the dividers.
62
+ *
63
+ * ```tsx
64
+ * const [expanded, setExpanded] = useState(false)
65
+ *
66
+ * <NavigationRail aria-label="Main" expanded={expanded} id="rail">
67
+ * <NavigationRailHeader>
68
+ * <IconButton
69
+ * label="Navigation"
70
+ * aria-expanded={expanded}
71
+ * aria-controls="rail"
72
+ * size="md"
73
+ * shape="square"
74
+ * onClick={() => setExpanded(!expanded)}
75
+ * >
76
+ * {expanded ? <MenuOpenIcon /> : <MenuIcon />}
77
+ * </IconButton>
78
+ * <ExtendedFab expanded={expanded}><EditIcon />Write</ExtendedFab>
79
+ * </NavigationRailHeader>
80
+ * <NavigationRailItem href="/" current>
81
+ * <NavigationRailItemIcon><HomeIcon filled /></NavigationRailItemIcon>
82
+ * <NavigationRailItemLabel>Home</NavigationRailItemLabel>
83
+ * </NavigationRailItem>
84
+ * <NavigationRailItem href="/favorites">
85
+ * <NavigationRailItemIcon><StarIcon /></NavigationRailItemIcon>
86
+ * <NavigationRailItemLabel>Favorites</NavigationRailItemLabel>
87
+ * <Badge label="3 new">3</Badge>
88
+ * </NavigationRailItem>
89
+ * </NavigationRail>
90
+ * ```
91
+ */
92
+ export declare function NavigationRail({ expanded, variant, align, collapsedLabels, className, ...props }: NavigationRailProps): import("react").JSX.Element;
93
+ export interface NavigationRailHeaderProps extends HTMLAttributes<HTMLDivElement> {
94
+ ref?: Ref<HTMLDivElement> | undefined;
95
+ }
96
+ /**
97
+ * The rail's header block: the menu button (a 56 px `IconButton`, `size="md" shape="square"`) and
98
+ * the `Fab` or `ExtendedFab`, one below the other, 4 apart. The app fills it: if the button toggles
99
+ * the rail, give it `aria-expanded` (and `aria-controls` with the rail's `id`) and a fixed label
100
+ * ("Navigation"): `aria-expanded` announces the state, and changing the label too would repeat it
101
+ * (WAI-ARIA APG, Disclosure pattern). The `ExtendedFab` gets the same `expanded` as the rail.
102
+ */
103
+ export declare function NavigationRailHeader({ className, ...props }: NavigationRailHeaderProps): import("react").JSX.Element;
104
+ /** With `href`, the item is an `<a>`. */
105
+ export type NavigationRailItemLinkProps = NavigationItemOwnProps & LinkElementProps;
106
+ /** Without `href`, the item is a `<button type="button">`. */
107
+ export type NavigationRailItemButtonProps = NavigationItemOwnProps & ButtonElementProps;
108
+ /**
109
+ * With `render`, the element passed (the router's `Link`), cloned with the classes, `aria-current`
110
+ * and the parts as children.
111
+ */
112
+ export type NavigationRailItemRenderProps = NavigationItemOwnProps & RenderElementProps;
113
+ export type NavigationRailItemProps = NavigationRailItemLinkProps | NavigationRailItemButtonProps | NavigationRailItemRenderProps;
114
+ /**
115
+ * A destination of the rail. An `<a>` if it gets `href`, a `<button type="button">` if not, or the
116
+ * `render` element (the router's `Link`). The current one has `aria-current="page"`. Same as
117
+ * `NavigationBarItem` (they share the code).
118
+ *
119
+ * With the rail collapsed, the icon goes above the label (56 × 32 indicator); expanded, beside it
120
+ * (a 56 px tall indicator that wraps icon and label). A small `Badge` goes at the icon's corner;
121
+ * the large one, over the icon when collapsed and after the label when expanded.
122
+ *
123
+ * The accessible name comes from the content: the label and the badge's `label`, in that order.
124
+ * Without a label, `aria-label` is required.
125
+ *
126
+ * Keyboard: the native element's (Tab moves through; Enter follows a link; Enter and Space activate
127
+ * a button).
128
+ */
129
+ export declare function NavigationRailItem(props: NavigationRailItemProps): import("react").JSX.Element;
130
+ export interface NavigationRailItemIconProps extends HTMLAttributes<HTMLSpanElement> {
131
+ ref?: Ref<HTMLSpanElement> | undefined;
132
+ }
133
+ /**
134
+ * The destination's icon (24 px), inside the indicator. `on-surface-variant` when not current and
135
+ * `on-secondary-container` when current. For the filled icon of the current one, pass it the same
136
+ * boolean as `current`: `<StarIcon filled={current} />`. It is decorative (hidden from screen
137
+ * readers). Expanded, it can be left out (a label-only destination, the kit's "Show icon").
138
+ */
139
+ export declare function NavigationRailItemIcon({ className, ...props }: NavigationRailItemIconProps): import("react").JSX.Element;
140
+ export interface NavigationRailItemLabelProps extends HTMLAttributes<HTMLSpanElement> {
141
+ ref?: Ref<HTMLSpanElement> | undefined;
142
+ }
143
+ /**
144
+ * The destination's label, on a single line, truncated with an ellipsis if it does not fit.
145
+ * Collapsed: Label Medium below the indicator, `secondary` when current. Expanded: Label Large next
146
+ * to the icon, `on-secondary-container` when current. `on-surface-variant` when not current.
147
+ */
148
+ export declare function NavigationRailItemLabel({ className, ...props }: NavigationRailItemLabelProps): import("react").JSX.Element;
@@ -0,0 +1,114 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cx } from '../../internal/interactive.js';
3
+ import { navigationItem } from '../../internal/navigation-item.js';
4
+ import { warnTooManyDestinations } from '../../internal/navigation-count.js';
5
+ // Solo para contar los destinos de adentro de las secciones; la sección es cliente (contexto) y este
6
+ // módulo sigue universal: importar un componente cliente no lo vuelve cliente.
7
+ import { NavigationRailSection } from './NavigationRailSection.js';
8
+ /**
9
+ * Material 3 Expressive navigation rail: a vertical `<nav>` for medium and large screens, collapsed
10
+ * (96 px) or expanded (220 px).
11
+ *
12
+ * **When to use it** (Material 3 window size classes): in a compact window (less than 600 px wide),
13
+ * a NavigationBar at the bottom; in a medium one (600 to 839 px), the collapsed rail; in an expanded
14
+ * one (840 px or more), the collapsed or expanded rail, depending on how much room the app wants to
15
+ * give it. The component decides none of that and has no media queries: the app chooses what to
16
+ * render and whether it is `expanded` (for example with `matchMedia` or with the menu button).
17
+ *
18
+ * **Height and position:** it takes its container's height (`height: 100%`) and scrolls if the
19
+ * destinations do not fit. The app places it (in a grid or flex next to the content, or fixed with
20
+ * `position: sticky`). The expanded width changes with the `--mk-navigation-rail-expanded-width`
21
+ * variable, between 220 and 360 px (Compose's minimum and maximum).
22
+ *
23
+ * Name: if the page has more than one `<nav>`, give it a name with `aria-label`.
24
+ *
25
+ * **Destinations:** collapsed, **3 to 7** (Material guidance), in any window; expanded, **no
26
+ * limit**. If they do not fit in height, the rail scrolls vertically (both states); it never
27
+ * overflows in width: long labels are truncated with an ellipsis. Collapsed with more than 7, it
28
+ * warns in development (`MK_NAVIGATION_TOO_MANY_DESTINATIONS`); the fix is to have fewer, or move the
29
+ * rest to a `ModalNavigationRail` or a `Menu`. The warning counts the `NavigationRailItem` children
30
+ * (also in arrays, fragments, `NavigationRailSection`s or wrapped one by one, as in a `Tooltip`); it
31
+ * does not see the ones another component renders.
32
+ *
33
+ * **Sections:** with many destinations (expanded or in a `ModalNavigationRail`), group them in
34
+ * `NavigationRailSection`s with a `NavigationRailSectionLabel`; the rail draws the dividers.
35
+ *
36
+ * ```tsx
37
+ * const [expanded, setExpanded] = useState(false)
38
+ *
39
+ * <NavigationRail aria-label="Main" expanded={expanded} id="rail">
40
+ * <NavigationRailHeader>
41
+ * <IconButton
42
+ * label="Navigation"
43
+ * aria-expanded={expanded}
44
+ * aria-controls="rail"
45
+ * size="md"
46
+ * shape="square"
47
+ * onClick={() => setExpanded(!expanded)}
48
+ * >
49
+ * {expanded ? <MenuOpenIcon /> : <MenuIcon />}
50
+ * </IconButton>
51
+ * <ExtendedFab expanded={expanded}><EditIcon />Write</ExtendedFab>
52
+ * </NavigationRailHeader>
53
+ * <NavigationRailItem href="/" current>
54
+ * <NavigationRailItemIcon><HomeIcon filled /></NavigationRailItemIcon>
55
+ * <NavigationRailItemLabel>Home</NavigationRailItemLabel>
56
+ * </NavigationRailItem>
57
+ * <NavigationRailItem href="/favorites">
58
+ * <NavigationRailItemIcon><StarIcon /></NavigationRailItemIcon>
59
+ * <NavigationRailItemLabel>Favorites</NavigationRailItemLabel>
60
+ * <Badge label="3 new">3</Badge>
61
+ * </NavigationRailItem>
62
+ * </NavigationRail>
63
+ * ```
64
+ */
65
+ export function NavigationRail({ expanded = false, variant = 'docked', align = 'top', collapsedLabels = 'visible', className, ...props }) {
66
+ if (!expanded)
67
+ warnTooManyDestinations('NavigationRail', props.children, NavigationRailItem, [NavigationRailSection]);
68
+ return (_jsx("nav", { ...props, className: cx('mk-navigation-rail', className), "data-expanded": String(expanded), "data-variant": variant, "data-align": align, "data-collapsed-labels": collapsedLabels }));
69
+ }
70
+ /**
71
+ * The rail's header block: the menu button (a 56 px `IconButton`, `size="md" shape="square"`) and
72
+ * the `Fab` or `ExtendedFab`, one below the other, 4 apart. The app fills it: if the button toggles
73
+ * the rail, give it `aria-expanded` (and `aria-controls` with the rail's `id`) and a fixed label
74
+ * ("Navigation"): `aria-expanded` announces the state, and changing the label too would repeat it
75
+ * (WAI-ARIA APG, Disclosure pattern). The `ExtendedFab` gets the same `expanded` as the rail.
76
+ */
77
+ export function NavigationRailHeader({ className, ...props }) {
78
+ return _jsx("div", { ...props, className: cx('mk-navigation-rail-header', className) });
79
+ }
80
+ /**
81
+ * A destination of the rail. An `<a>` if it gets `href`, a `<button type="button">` if not, or the
82
+ * `render` element (the router's `Link`). The current one has `aria-current="page"`. Same as
83
+ * `NavigationBarItem` (they share the code).
84
+ *
85
+ * With the rail collapsed, the icon goes above the label (56 × 32 indicator); expanded, beside it
86
+ * (a 56 px tall indicator that wraps icon and label). A small `Badge` goes at the icon's corner;
87
+ * the large one, over the icon when collapsed and after the label when expanded.
88
+ *
89
+ * The accessible name comes from the content: the label and the badge's `label`, in that order.
90
+ * Without a label, `aria-label` is required.
91
+ *
92
+ * Keyboard: the native element's (Tab moves through; Enter follows a link; Enter and Space activate
93
+ * a button).
94
+ */
95
+ export function NavigationRailItem(props) {
96
+ return navigationItem('NavigationRailItem', 'mk-navigation-rail-item', props);
97
+ }
98
+ /**
99
+ * The destination's icon (24 px), inside the indicator. `on-surface-variant` when not current and
100
+ * `on-secondary-container` when current. For the filled icon of the current one, pass it the same
101
+ * boolean as `current`: `<StarIcon filled={current} />`. It is decorative (hidden from screen
102
+ * readers). Expanded, it can be left out (a label-only destination, the kit's "Show icon").
103
+ */
104
+ export function NavigationRailItemIcon({ className, ...props }) {
105
+ return _jsx("span", { "aria-hidden": "true", ...props, className: cx('mk-navigation-rail-item-icon', className) });
106
+ }
107
+ /**
108
+ * The destination's label, on a single line, truncated with an ellipsis if it does not fit.
109
+ * Collapsed: Label Medium below the indicator, `secondary` when current. Expanded: Label Large next
110
+ * to the icon, `on-secondary-container` when current. `on-surface-variant` when not current.
111
+ */
112
+ export function NavigationRailItemLabel({ className, ...props }) {
113
+ return _jsx("span", { ...props, className: cx('mk-navigation-rail-item-label', className) });
114
+ }
@@ -0,0 +1,54 @@
1
+ import { type HTMLAttributes, type Ref } from 'react';
2
+ export interface NavigationRailSectionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
3
+ /** Ref to the group element. */
4
+ ref?: Ref<HTMLDivElement> | undefined;
5
+ }
6
+ /**
7
+ * A titled group of destinations inside the expanded `NavigationRail` or the `ModalNavigationRail`,
8
+ * where there is no destination limit and a long list reads better in named groups. It is a
9
+ * `role="group"` named by its `NavigationRailSectionLabel` (your own `aria-labelledby` or
10
+ * `aria-label` wins); without a label it is only a visual group, with no role.
11
+ *
12
+ * ```tsx
13
+ * <ModalNavigationRail open={open} onClose={() => setOpen(false)}>
14
+ * <NavigationRailSection>
15
+ * <NavigationRailSectionLabel>Library</NavigationRailSectionLabel>
16
+ * <NavigationRailItem href="/albums" current>
17
+ * <NavigationRailItemLabel>Albums</NavigationRailItemLabel>
18
+ * </NavigationRailItem>
19
+ * <NavigationRailItem href="/artists">
20
+ * <NavigationRailItemLabel>Artists</NavigationRailItemLabel>
21
+ * </NavigationRailItem>
22
+ * </NavigationRailSection>
23
+ * <NavigationRailSection>
24
+ * <NavigationRailSectionLabel>Playlists</NavigationRailSectionLabel>
25
+ * …
26
+ * </NavigationRailSection>
27
+ * </ModalNavigationRail>
28
+ * ```
29
+ *
30
+ * - **Divider:** the rail draws a 1 px `outline-variant` line between a section and the destination
31
+ * or section next to it (never next to `NavigationRailHeader`), inset 36 px on each side (where the
32
+ * destinations' content starts), with no extra space: the next title starts right below it (the
33
+ * kit's navigation drawer).
34
+ * - **Collapsed rail:** the title is hidden (it still names the group) and the dividers stay,
35
+ * aligned with the indicators, so the grouping is still visible.
36
+ * - **Keyboard:** unchanged. The section is not a Tab stop; Tab goes through the destinations in
37
+ * document order, and `current` works as usual.
38
+ * - **Destination count:** the collapsed rail's warning (`MK_NAVIGATION_TOO_MANY_DESTINATIONS`)
39
+ * counts the destinations inside sections too.
40
+ * - Not for `NavigationBar` or `NavigationSuite`: 5 or 7 destinations need no groups.
41
+ */
42
+ export declare function NavigationRailSection({ className, children, ...props }: NavigationRailSectionProps): import("react").JSX.Element;
43
+ export interface NavigationRailSectionLabelProps extends HTMLAttributes<HTMLDivElement> {
44
+ /** Ref to the label element. */
45
+ ref?: Ref<HTMLDivElement> | undefined;
46
+ }
47
+ /**
48
+ * The title of a `NavigationRailSection`, which names the group (`aria-labelledby`): 56 px tall,
49
+ * Label Medium Emphasized in `tertiary` (smaller and in another color than the destinations, so it does not read
50
+ * as one), starting where the destinations' content starts (their icon, or
51
+ * their label when they have none) and truncated with an ellipsis if it does not fit. It is not focusable. With the rail collapsed it is hidden but still
52
+ * names the group. Outside a `NavigationRailSection` it throws (`MK_PART_OUTSIDE_PARENT`).
53
+ */
54
+ export declare function NavigationRailSectionLabel({ className, ...props }: NavigationRailSectionLabelProps): import("react").JSX.Element;
@@ -0,0 +1,96 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ // Partes interactivas del rail (ADR-0003, ADR-0029): la sección y su título comparten por contexto el
4
+ // id que nombra el grupo, con la base común de las etiquetas de grupo (src/internal/group-label.tsx,
5
+ // la misma de MenuGroupLabel, SelectGroupLabel y SearchSuggestionGroupLabel; ADR-0039). Por el
6
+ // contexto son cliente; NavigationRail y sus destinos siguen universales: desde un Server Component,
7
+ // la sección es un límite cliente y los destinos que recibe como hijos se siguen dibujando en el
8
+ // servidor. Alternativa descartada: una sección universal que busca su título entre los hijos y le da
9
+ // un id con useId, sin registro ni contexto; no podía avisar de un título fuera de su sección
10
+ // (MK_PART_OUTSIDE_PARENT necesita contexto) y dejaba sin nombre una sección cuyo título dibuja un
11
+ // componente propio. Para que el HTML del servidor salga nombrado igual, la sección hace esa misma
12
+ // búsqueda solo como pista del estado inicial (`useGroupLabel(…, initialLabel)`); el registro manda
13
+ // después de montar.
14
+ //
15
+ // Marcado: el rail no tiene semántica de lista (sus destinos son hijos directos del <nav>), así que la
16
+ // sección es un <div role="group"> con aria-labelledby y el título un <div> (el de la base): sin
17
+ // listas que romper. Los destinos siguen en el orden del documento: la sección no es una parada de Tab.
18
+ //
19
+ // El divisor entre secciones no es un elemento: lo dibuja el CSS (navigation-rail.css) según los
20
+ // hermanos de la sección, que el componente no conoce.
21
+ import { Children, createContext, Fragment, isValidElement, use } from 'react';
22
+ import { GroupLabel, useGroupLabel } from '../../internal/group-label.js';
23
+ import { partOutsideParent } from '../../internal/diagnostics.js';
24
+ import { cx } from '../../internal/interactive.js';
25
+ const NavigationRailSectionContext = createContext(null);
26
+ /**
27
+ * A titled group of destinations inside the expanded `NavigationRail` or the `ModalNavigationRail`,
28
+ * where there is no destination limit and a long list reads better in named groups. It is a
29
+ * `role="group"` named by its `NavigationRailSectionLabel` (your own `aria-labelledby` or
30
+ * `aria-label` wins); without a label it is only a visual group, with no role.
31
+ *
32
+ * ```tsx
33
+ * <ModalNavigationRail open={open} onClose={() => setOpen(false)}>
34
+ * <NavigationRailSection>
35
+ * <NavigationRailSectionLabel>Library</NavigationRailSectionLabel>
36
+ * <NavigationRailItem href="/albums" current>
37
+ * <NavigationRailItemLabel>Albums</NavigationRailItemLabel>
38
+ * </NavigationRailItem>
39
+ * <NavigationRailItem href="/artists">
40
+ * <NavigationRailItemLabel>Artists</NavigationRailItemLabel>
41
+ * </NavigationRailItem>
42
+ * </NavigationRailSection>
43
+ * <NavigationRailSection>
44
+ * <NavigationRailSectionLabel>Playlists</NavigationRailSectionLabel>
45
+ * …
46
+ * </NavigationRailSection>
47
+ * </ModalNavigationRail>
48
+ * ```
49
+ *
50
+ * - **Divider:** the rail draws a 1 px `outline-variant` line between a section and the destination
51
+ * or section next to it (never next to `NavigationRailHeader`), inset 36 px on each side (where the
52
+ * destinations' content starts), with no extra space: the next title starts right below it (the
53
+ * kit's navigation drawer).
54
+ * - **Collapsed rail:** the title is hidden (it still names the group) and the dividers stay,
55
+ * aligned with the indicators, so the grouping is still visible.
56
+ * - **Keyboard:** unchanged. The section is not a Tab stop; Tab goes through the destinations in
57
+ * document order, and `current` works as usual.
58
+ * - **Destination count:** the collapsed rail's warning (`MK_NAVIGATION_TOO_MANY_DESTINATIONS`)
59
+ * counts the destinations inside sections too.
60
+ * - Not for `NavigationBar` or `NavigationSuite`: 5 or 7 destinations need no groups.
61
+ */
62
+ export function NavigationRailSection({ className, children, ...props }) {
63
+ const { registry, labelledBy } = useGroupLabel(props['aria-labelledby'], findLabel(children));
64
+ const named = labelledBy !== undefined || props['aria-label'] !== undefined;
65
+ return (_jsx(NavigationRailSectionContext, { value: registry, children: _jsx("div", { ...props, role: named ? 'group' : undefined, "aria-labelledby": labelledBy, className: cx('mk-navigation-rail-section', className), children: children }) }));
66
+ }
67
+ // La pista para el HTML del servidor: el título entre los hijos directos o dentro de fragmentos (no ve
68
+ // uno que dibuja un componente propio; ese se registra al montar).
69
+ function findLabel(children) {
70
+ for (const child of Children.toArray(children)) {
71
+ if (!isValidElement(child))
72
+ continue;
73
+ if (child.type === NavigationRailSectionLabel)
74
+ return { id: child.props.id };
75
+ if (child.type === Fragment) {
76
+ const found = findLabel(child.props.children);
77
+ if (found)
78
+ return found;
79
+ }
80
+ }
81
+ return null;
82
+ }
83
+ /**
84
+ * The title of a `NavigationRailSection`, which names the group (`aria-labelledby`): 56 px tall,
85
+ * Label Medium Emphasized in `tertiary` (smaller and in another color than the destinations, so it does not read
86
+ * as one), starting where the destinations' content starts (their icon, or
87
+ * their label when they have none) and truncated with an ellipsis if it does not fit. It is not focusable. With the rail collapsed it is hidden but still
88
+ * names the group. Outside a `NavigationRailSection` it throws (`MK_PART_OUTSIDE_PARENT`).
89
+ */
90
+ export function NavigationRailSectionLabel({ className, ...props }) {
91
+ const registry = use(NavigationRailSectionContext);
92
+ if (!registry)
93
+ throw partOutsideParent('NavigationRailSectionLabel', 'NavigationRailSection');
94
+ // La base pone el marcado, la clase común y el registro del id.
95
+ return _jsx(GroupLabel, { ...props, registry: registry, className: cx('mk-navigation-rail-section-label', className) });
96
+ }
@@ -0,0 +1,7 @@
1
+ export interface ModalNavigationRailStrings {
2
+ /** `ModalNavigationRail` `label`: the dialog's name. */
3
+ label: string;
4
+ /** `ModalNavigationRailClose` `label`: the button that closes the rail. */
5
+ closeLabel: string;
6
+ }
7
+ export declare const modalNavigationRailStrings: ModalNavigationRailStrings;
@@ -0,0 +1,7 @@
1
+ // Textos por defecto de ModalNavigationRail (en inglés: son salida para quien usa la librería). El
2
+ // índice src/strings/index.ts los reúne con los demás. Son los de Compose (material3, res/values/
3
+ // strings.xml: m3c_wide_navigation_rail_pane_title y m3c_wide_navigation_rail_close_rail).
4
+ export const modalNavigationRailStrings = {
5
+ label: 'Navigation rail',
6
+ closeLabel: 'Close rail',
7
+ };
@@ -0,0 +1,109 @@
1
+ import type { HTMLAttributes, Ref } from 'react';
2
+ import type { ButtonElementProps, LinkElementProps, RenderElementProps } from '../../atoms/Interactive/Interactive.tsx';
3
+ import { type NavigationItemOwnProps } from '../../internal/navigation-item.tsx';
4
+ /**
5
+ * Which presentation it uses. With `auto` (the default) the window chooses, following Compose's
6
+ * rule (`NavigationSuiteScaffoldDefaults.navigationSuiteType`):
7
+ * - compact width (under 600 px, `WINDOW_WIDTH.medium`): a bar with vertical destinations;
8
+ * - otherwise, compact height (under 480 px, `WINDOW_HEIGHT.medium`; a phone in landscape): a bar
9
+ * with horizontal destinations;
10
+ * - otherwise: a collapsed rail (also from 1200 px: matekit, like Compose, does not expand the rail
11
+ * by itself).
12
+ *
13
+ * `bar` always uses the bar (vertical destinations at compact width, horizontal from 600) and
14
+ * `rail` the collapsed rail, in any window.
15
+ */
16
+ export type NavigationSuiteLayout = 'auto' | 'bar' | 'rail';
17
+ export interface NavigationSuiteProps extends HTMLAttributes<HTMLElement> {
18
+ /** Presentation: `auto` (by the window), `bar` or `rail`. See `NavigationSuiteLayout`. Defaults to `auto`. */
19
+ layout?: NavigationSuiteLayout | undefined;
20
+ /** Ref to the `<nav>`. */
21
+ ref?: Ref<HTMLElement> | undefined;
22
+ }
23
+ /**
24
+ * Adaptive navigation: the destinations are written once and shown as a `NavigationBar` or as a
25
+ * collapsed `NavigationRail` depending on the window, like Compose's `NavigationSuiteScaffold`. To
26
+ * choose by hand, use `NavigationBar` and `NavigationRail` directly.
27
+ *
28
+ * ```tsx
29
+ * <NavigationSuite aria-label="Main">
30
+ * <NavigationSuiteHeader>
31
+ * <Fab label="Write"><EditIcon /></Fab>
32
+ * </NavigationSuiteHeader>
33
+ * <NavigationSuiteItem href="/" current>
34
+ * <NavigationSuiteItemIcon><HomeIcon filled /></NavigationSuiteItemIcon>
35
+ * <NavigationSuiteItemLabel>Home</NavigationSuiteItemLabel>
36
+ * </NavigationSuiteItem>
37
+ * …
38
+ * </NavigationSuite>
39
+ * ```
40
+ *
41
+ * - **No JavaScript:** the choice is CSS (media queries with the `WINDOW_WIDTH` and
42
+ * `WINDOW_HEIGHT` breakpoints), so it works from a Server Component and does not change on
43
+ * hydration.
44
+ * - **Bar:** 64 tall on `surface-container`, destinations spread out, safe area at the bottom and
45
+ * the sides. **Rail:** 96 wide, no background, as tall as its container (scrolls if it does not
46
+ * fit), 44 at the top and 56 at the bottom, 4 between destinations, safe area at the top, bottom
47
+ * and start.
48
+ * - **Placement:** the app places it in its layout (at the bottom for the bar, at the start for the
49
+ * rail) with the same media queries (`(width < 37.5rem), (height < 30rem)`), or puts it inside a
50
+ * `PaneScaffold`, which places it.
51
+ * - **Expanded rail:** there is none. To expand, the menu button in the header opens a
52
+ * `ModalNavigationRail` with the same destinations (like Compose's `ModalWideNavigationRail`), or
53
+ * the app uses `NavigationRail` with `expanded`.
54
+ *
55
+ * Native props and `ref` reach the `<nav>`. If the page has more than one `<nav>`, name it with
56
+ * `aria-label`.
57
+ *
58
+ * **Destinations: 3 to 5** in any window, because in a compact (or short) one it is shown as a bar
59
+ * (Material guidance); with `layout="rail"`, which is never a bar, **3 to 7**. As a bar, the
60
+ * destinations share the width and shrink down to 24 px without overflowing (like `NavigationBar`);
61
+ * as a rail, it scrolls vertically if they do not fit. Above the limit it warns in development
62
+ * (`MK_NAVIGATION_TOO_MANY_DESTINATIONS`). It counts the child `NavigationSuiteItem`s (also in
63
+ * arrays, fragments or wrapped one by one, as in a `Tooltip`); it does not see those rendered by
64
+ * another component.
65
+ */
66
+ export declare function NavigationSuite({ layout, className, ...props }: NavigationSuiteProps): import("react").JSX.Element;
67
+ export interface NavigationSuiteHeaderProps extends HTMLAttributes<HTMLDivElement> {
68
+ ref?: Ref<HTMLDivElement> | undefined;
69
+ }
70
+ /**
71
+ * The rail's header (Compose's `primaryActionContent`): the menu button and the `Fab`, one below
72
+ * the other with 4 between them and 40 to the destinations, like `NavigationRailHeader`. It is not
73
+ * shown in the bar (Compose does not put it in the bar either): if the action must always be
74
+ * available, the app also places it outside the bar.
75
+ */
76
+ export declare function NavigationSuiteHeader({ className, ...props }: NavigationSuiteHeaderProps): import("react").JSX.Element;
77
+ /** With `href`, the element is an `<a>`. */
78
+ export type NavigationSuiteItemLinkProps = NavigationItemOwnProps & LinkElementProps;
79
+ /** Without `href`, the element is a `<button type="button">`. */
80
+ export type NavigationSuiteItemButtonProps = NavigationItemOwnProps & ButtonElementProps;
81
+ /**
82
+ * With `render`, the element passed (the router's `Link`), cloned with the classes,
83
+ * `aria-current` and the parts as children.
84
+ */
85
+ export type NavigationSuiteItemRenderProps = NavigationItemOwnProps & RenderElementProps;
86
+ export type NavigationSuiteItemProps = NavigationSuiteItemLinkProps | NavigationSuiteItemButtonProps | NavigationSuiteItemRenderProps;
87
+ /**
88
+ * A destination. An `<a>` when given `href`, a `<button type="button">` otherwise, or the `render`
89
+ * element (the router's `Link`). The current one gets `aria-current="page"`. It is the
90
+ * `NavigationBar` destination (they share code and CSS): icon above the label in a phone's bar and
91
+ * in the rail, beside it in the bar of a short window.
92
+ *
93
+ * The accessible name comes from the content (the label and the badge's `label`); without a label,
94
+ * `aria-label` is required.
95
+ */
96
+ export declare function NavigationSuiteItem(props: NavigationSuiteItemProps): import("react").JSX.Element;
97
+ export interface NavigationSuiteItemIconProps extends HTMLAttributes<HTMLSpanElement> {
98
+ ref?: Ref<HTMLSpanElement> | undefined;
99
+ }
100
+ /**
101
+ * The destination's icon (24 px), inside the indicator; decorative. For the filled icon of the
102
+ * current destination, pass it the same boolean as `current`: `<StarIcon filled={current} />`.
103
+ */
104
+ export declare function NavigationSuiteItemIcon({ className, ...props }: NavigationSuiteItemIconProps): import("react").JSX.Element;
105
+ export interface NavigationSuiteItemLabelProps extends HTMLAttributes<HTMLSpanElement> {
106
+ ref?: Ref<HTMLSpanElement> | undefined;
107
+ }
108
+ /** The destination's label (Label Medium), on one line, truncated with an ellipsis if it does not fit. */
109
+ export declare function NavigationSuiteItemLabel({ className, ...props }: NavigationSuiteItemLabelProps): import("react").JSX.Element;
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cx } from '../../internal/interactive.js';
3
+ import { navigationItem } from '../../internal/navigation-item.js';
4
+ import { warnTooManyDestinations } from '../../internal/navigation-count.js';
5
+ /**
6
+ * Adaptive navigation: the destinations are written once and shown as a `NavigationBar` or as a
7
+ * collapsed `NavigationRail` depending on the window, like Compose's `NavigationSuiteScaffold`. To
8
+ * choose by hand, use `NavigationBar` and `NavigationRail` directly.
9
+ *
10
+ * ```tsx
11
+ * <NavigationSuite aria-label="Main">
12
+ * <NavigationSuiteHeader>
13
+ * <Fab label="Write"><EditIcon /></Fab>
14
+ * </NavigationSuiteHeader>
15
+ * <NavigationSuiteItem href="/" current>
16
+ * <NavigationSuiteItemIcon><HomeIcon filled /></NavigationSuiteItemIcon>
17
+ * <NavigationSuiteItemLabel>Home</NavigationSuiteItemLabel>
18
+ * </NavigationSuiteItem>
19
+ * …
20
+ * </NavigationSuite>
21
+ * ```
22
+ *
23
+ * - **No JavaScript:** the choice is CSS (media queries with the `WINDOW_WIDTH` and
24
+ * `WINDOW_HEIGHT` breakpoints), so it works from a Server Component and does not change on
25
+ * hydration.
26
+ * - **Bar:** 64 tall on `surface-container`, destinations spread out, safe area at the bottom and
27
+ * the sides. **Rail:** 96 wide, no background, as tall as its container (scrolls if it does not
28
+ * fit), 44 at the top and 56 at the bottom, 4 between destinations, safe area at the top, bottom
29
+ * and start.
30
+ * - **Placement:** the app places it in its layout (at the bottom for the bar, at the start for the
31
+ * rail) with the same media queries (`(width < 37.5rem), (height < 30rem)`), or puts it inside a
32
+ * `PaneScaffold`, which places it.
33
+ * - **Expanded rail:** there is none. To expand, the menu button in the header opens a
34
+ * `ModalNavigationRail` with the same destinations (like Compose's `ModalWideNavigationRail`), or
35
+ * the app uses `NavigationRail` with `expanded`.
36
+ *
37
+ * Native props and `ref` reach the `<nav>`. If the page has more than one `<nav>`, name it with
38
+ * `aria-label`.
39
+ *
40
+ * **Destinations: 3 to 5** in any window, because in a compact (or short) one it is shown as a bar
41
+ * (Material guidance); with `layout="rail"`, which is never a bar, **3 to 7**. As a bar, the
42
+ * destinations share the width and shrink down to 24 px without overflowing (like `NavigationBar`);
43
+ * as a rail, it scrolls vertically if they do not fit. Above the limit it warns in development
44
+ * (`MK_NAVIGATION_TOO_MANY_DESTINATIONS`). It counts the child `NavigationSuiteItem`s (also in
45
+ * arrays, fragments or wrapped one by one, as in a `Tooltip`); it does not see those rendered by
46
+ * another component.
47
+ */
48
+ export function NavigationSuite({ layout = 'auto', className, ...props }) {
49
+ warnTooManyDestinations(layout === 'rail' ? 'NavigationSuiteRail' : 'NavigationSuite', props.children, NavigationSuiteItem);
50
+ return _jsx("nav", { ...props, className: cx('mk-navigation-suite', className), "data-layout": layout });
51
+ }
52
+ /**
53
+ * The rail's header (Compose's `primaryActionContent`): the menu button and the `Fab`, one below
54
+ * the other with 4 between them and 40 to the destinations, like `NavigationRailHeader`. It is not
55
+ * shown in the bar (Compose does not put it in the bar either): if the action must always be
56
+ * available, the app also places it outside the bar.
57
+ */
58
+ export function NavigationSuiteHeader({ className, ...props }) {
59
+ return _jsx("div", { ...props, className: cx('mk-navigation-rail-header mk-navigation-suite-header', className) });
60
+ }
61
+ /**
62
+ * A destination. An `<a>` when given `href`, a `<button type="button">` otherwise, or the `render`
63
+ * element (the router's `Link`). The current one gets `aria-current="page"`. It is the
64
+ * `NavigationBar` destination (they share code and CSS): icon above the label in a phone's bar and
65
+ * in the rail, beside it in the bar of a short window.
66
+ *
67
+ * The accessible name comes from the content (the label and the badge's `label`); without a label,
68
+ * `aria-label` is required.
69
+ */
70
+ export function NavigationSuiteItem(props) {
71
+ return navigationItem('NavigationSuiteItem', 'mk-navigation-bar-item', {
72
+ ...props,
73
+ className: cx('mk-navigation-suite-item', props.className),
74
+ });
75
+ }
76
+ /**
77
+ * The destination's icon (24 px), inside the indicator; decorative. For the filled icon of the
78
+ * current destination, pass it the same boolean as `current`: `<StarIcon filled={current} />`.
79
+ */
80
+ export function NavigationSuiteItemIcon({ className, ...props }) {
81
+ return (_jsx("span", { "aria-hidden": "true", ...props, className: cx('mk-navigation-bar-item-icon mk-navigation-suite-item-icon', className) }));
82
+ }
83
+ /** The destination's label (Label Medium), on one line, truncated with an ellipsis if it does not fit. */
84
+ export function NavigationSuiteItemLabel({ className, ...props }) {
85
+ return _jsx("span", { ...props, className: cx('mk-navigation-bar-item-label mk-navigation-suite-item-label', className) });
86
+ }