@pg-labs-incubator/cobweb 0.0.0-stage → 0.0.2

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 (320) hide show
  1. package/LICENSE +163 -0
  2. package/README.md +82 -2
  3. package/package.json +112 -3
  4. package/src/action/action.yaml +291 -0
  5. package/src/action/button-group.yaml +56 -0
  6. package/src/action/button.yaml +239 -0
  7. package/src/action/split-button.yaml +87 -0
  8. package/src/color/color.yaml +181 -0
  9. package/src/color/palette.yaml +147 -0
  10. package/src/container/card.yaml +170 -0
  11. package/src/container/corner-radius.yaml +50 -0
  12. package/src/container/elevation.yaml +19 -0
  13. package/src/design.yaml +41 -0
  14. package/src/feedback/feedback.yaml +225 -0
  15. package/src/icon/icon-font.yaml +28 -0
  16. package/src/icon/icon.yaml +31 -0
  17. package/src/input/date-picker.yaml +144 -0
  18. package/src/input/date-range-input.yaml +162 -0
  19. package/src/input/range-slider.yaml +161 -0
  20. package/src/input/select.yaml +230 -0
  21. package/src/input/slider.yaml +172 -0
  22. package/src/input/text-field.yaml +240 -0
  23. package/src/input/time-picker.yaml +220 -0
  24. package/src/motion/motion.yaml +371 -0
  25. package/src/navigation/app-bar.yaml +147 -0
  26. package/src/navigation/navigation.yaml +339 -0
  27. package/src/navigation/scroll.yaml +23 -0
  28. package/src/navigation/search.yaml +112 -0
  29. package/src/navigation/tabs.yaml +144 -0
  30. package/src/navigation/toolbar.yaml +130 -0
  31. package/src/selection/checkbox.yaml +162 -0
  32. package/src/selection/chip.yaml +219 -0
  33. package/src/selection/radio.yaml +125 -0
  34. package/src/selection/segmented-group.yaml +11 -0
  35. package/src/selection/segmented.yaml +69 -0
  36. package/src/selection/switch.yaml +209 -0
  37. package/src/spacing/measurement.yaml +80 -0
  38. package/src/state/state.yaml +38 -0
  39. package/src/surface/surface.yaml +483 -0
  40. package/src/text/line-height.yaml +144 -0
  41. package/src/text/typeface.yaml +31 -0
  42. package/src/text/typescale.yaml +726 -0
  43. package/target/esbuild/action/action.css +1 -0
  44. package/target/esbuild/action/base.jsx +1 -0
  45. package/target/esbuild/action/button.jsx +17 -0
  46. package/target/esbuild/action/fab-menu-context.jsx +1 -0
  47. package/target/esbuild/action/fab-menu.jsx +15 -0
  48. package/target/esbuild/action/fab.jsx +7 -0
  49. package/target/esbuild/action/group.jsx +22 -0
  50. package/target/esbuild/action/icon-button.jsx +5 -0
  51. package/target/esbuild/action/index.jsx +1 -0
  52. package/target/esbuild/action/split-button.jsx +12 -0
  53. package/target/esbuild/color/contrast.jsx +1 -0
  54. package/target/esbuild/color/dynamic.jsx +1 -0
  55. package/target/esbuild/color/hct.jsx +1 -0
  56. package/target/esbuild/color/index.css +1 -0
  57. package/target/esbuild/color/index.jsx +1 -0
  58. package/target/esbuild/color/palette.jsx +1 -0
  59. package/target/esbuild/color/scheme.jsx +1 -0
  60. package/target/esbuild/color/temperature.jsx +1 -0
  61. package/target/esbuild/container/card.css +1 -0
  62. package/target/esbuild/container/card.jsx +1 -0
  63. package/target/esbuild/container/elevation-shadow.css +1 -0
  64. package/target/esbuild/container/elevation-shadow.jsx +1 -0
  65. package/target/esbuild/container/index.jsx +1 -0
  66. package/target/esbuild/dom/client.jsx +1 -0
  67. package/target/esbuild/dom/index.jsx +1 -0
  68. package/target/esbuild/dom/server.jsx +1 -0
  69. package/target/esbuild/dom/types.jsx +1 -0
  70. package/target/esbuild/feedback/badge.jsx +15 -0
  71. package/target/esbuild/feedback/feedback.css +1 -0
  72. package/target/esbuild/feedback/focus.jsx +1 -0
  73. package/target/esbuild/feedback/index.jsx +1 -0
  74. package/target/esbuild/feedback/loading.jsx +7 -0
  75. package/target/esbuild/feedback/observe.jsx +1 -0
  76. package/target/esbuild/feedback/progress.jsx +35 -0
  77. package/target/esbuild/feedback/snackbar.jsx +23 -0
  78. package/target/esbuild/feedback/tooltip.jsx +24 -0
  79. package/target/esbuild/icon/icon.css +1 -0
  80. package/target/esbuild/icon/icon.jsx +1 -0
  81. package/target/esbuild/icon/index.jsx +1 -0
  82. package/target/esbuild/index.css +1 -0
  83. package/target/esbuild/index.jsx +1 -0
  84. package/target/esbuild/input/autocomplete.jsx +5 -0
  85. package/target/esbuild/input/base.jsx +4 -0
  86. package/target/esbuild/input/date-picker.css +1 -0
  87. package/target/esbuild/input/date-picker.jsx +104 -0
  88. package/target/esbuild/input/date-range-input.css +1 -0
  89. package/target/esbuild/input/date-time.jsx +21 -0
  90. package/target/esbuild/input/index.css +1 -0
  91. package/target/esbuild/input/index.jsx +1 -0
  92. package/target/esbuild/input/paired-input.jsx +1 -0
  93. package/target/esbuild/input/picker-dialog.css +1 -0
  94. package/target/esbuild/input/picker-dialog.jsx +14 -0
  95. package/target/esbuild/input/select.css +1 -0
  96. package/target/esbuild/input/select.jsx +63 -0
  97. package/target/esbuild/input/slider.css +1 -0
  98. package/target/esbuild/input/slider.jsx +51 -0
  99. package/target/esbuild/input/text-field.css +1 -0
  100. package/target/esbuild/input/text-field.jsx +67 -0
  101. package/target/esbuild/input/time-picker.css +1 -0
  102. package/target/esbuild/input/time-picker.jsx +29 -0
  103. package/target/esbuild/motion/frame.jsx +1 -0
  104. package/target/esbuild/motion/index.css +1 -0
  105. package/target/esbuild/motion/index.jsx +1 -0
  106. package/target/esbuild/motion/material.jsx +1 -0
  107. package/target/esbuild/motion/motion.jsx +1 -0
  108. package/target/esbuild/motion/spring.jsx +1 -0
  109. package/target/esbuild/motion/transition.css +1 -0
  110. package/target/esbuild/motion/transition.jsx +1 -0
  111. package/target/esbuild/motion/velocity.jsx +1 -0
  112. package/target/esbuild/navigation/app-bar.jsx +51 -0
  113. package/target/esbuild/navigation/base.jsx +1 -0
  114. package/target/esbuild/navigation/drawer.jsx +25 -0
  115. package/target/esbuild/navigation/index.jsx +1 -0
  116. package/target/esbuild/navigation/navigation.css +1 -0
  117. package/target/esbuild/navigation/navigation.jsx +29 -0
  118. package/target/esbuild/navigation/scroll.jsx +1 -0
  119. package/target/esbuild/navigation/search.jsx +29 -0
  120. package/target/esbuild/navigation/tabs.jsx +7 -0
  121. package/target/esbuild/navigation/toolbar.jsx +23 -0
  122. package/target/esbuild/selection/base.jsx +1 -0
  123. package/target/esbuild/selection/checkbox.jsx +14 -0
  124. package/target/esbuild/selection/chip.jsx +23 -0
  125. package/target/esbuild/selection/index.jsx +1 -0
  126. package/target/esbuild/selection/radio.jsx +9 -0
  127. package/target/esbuild/selection/segmented.jsx +15 -0
  128. package/target/esbuild/selection/selection.css +1 -0
  129. package/target/esbuild/selection/switch.jsx +14 -0
  130. package/target/esbuild/shape/corner-rounding.jsx +1 -0
  131. package/target/esbuild/shape/cubic.jsx +1 -0
  132. package/target/esbuild/shape/index.jsx +1 -0
  133. package/target/esbuild/shape/material-shapes.jsx +1 -0
  134. package/target/esbuild/shape/morph.jsx +1 -0
  135. package/target/esbuild/shape/path.jsx +1 -0
  136. package/target/esbuild/shape/point.jsx +1 -0
  137. package/target/esbuild/shape/rounded-polygon.jsx +1 -0
  138. package/target/esbuild/shape/shapes.jsx +1 -0
  139. package/target/esbuild/spacing/index.jsx +1 -0
  140. package/target/esbuild/state/component.css +1 -0
  141. package/target/esbuild/state/component.jsx +1 -0
  142. package/target/esbuild/state/controller.jsx +1 -0
  143. package/target/esbuild/state/index.jsx +1 -0
  144. package/target/esbuild/state/ripple.jsx +1 -0
  145. package/target/esbuild/state/state.jsx +1 -0
  146. package/target/esbuild/state/style.jsx +1 -0
  147. package/target/esbuild/surface/carousel-layout.jsx +1 -0
  148. package/target/esbuild/surface/carousel.css +1 -0
  149. package/target/esbuild/surface/carousel.jsx +10 -0
  150. package/target/esbuild/surface/dialog.jsx +35 -0
  151. package/target/esbuild/surface/divider.jsx +1 -0
  152. package/target/esbuild/surface/drag.jsx +1 -0
  153. package/target/esbuild/surface/gestures.css +1 -0
  154. package/target/esbuild/surface/gestures.jsx +7 -0
  155. package/target/esbuild/surface/index.css +1 -0
  156. package/target/esbuild/surface/index.jsx +1 -0
  157. package/target/esbuild/surface/interactive.jsx +1 -0
  158. package/target/esbuild/surface/list-patterns.jsx +26 -0
  159. package/target/esbuild/surface/list.css +1 -0
  160. package/target/esbuild/surface/list.jsx +9 -0
  161. package/target/esbuild/surface/menu.css +1 -0
  162. package/target/esbuild/surface/menu.jsx +12 -0
  163. package/target/esbuild/surface/scaffold.jsx +47 -0
  164. package/target/esbuild/surface/sheet.jsx +21 -0
  165. package/target/esbuild/surface/side-sheet.jsx +17 -0
  166. package/target/esbuild/surface/slots.jsx +1 -0
  167. package/target/esbuild/surface/surface.css +1 -0
  168. package/target/esbuild/surface/surface.jsx +1 -0
  169. package/target/esbuild/text/index.css +1 -0
  170. package/target/esbuild/text/index.jsx +1 -0
  171. package/target/esbuild/text/text.css +1 -0
  172. package/target/esbuild/text/text.jsx +3 -0
  173. package/target/esbuild/text/typography.css +1 -0
  174. package/target/esbuild/text/typography.jsx +1 -0
  175. package/target/esbuild/util/box-side.jsx +1 -0
  176. package/target/esbuild/util/debug.jsx +1 -0
  177. package/target/esbuild/util/dom.jsx +1 -0
  178. package/target/esbuild/util/event.jsx +1 -0
  179. package/target/esbuild/util/index.jsx +1 -0
  180. package/target/esbuild/util/preconditions.jsx +1 -0
  181. package/target/esbuild/util/reactive.jsx +1 -0
  182. package/target/tsc/action/action.css.d.ts +3 -0
  183. package/target/tsc/action/base.d.ts +211 -0
  184. package/target/tsc/action/button.d.ts +126 -0
  185. package/target/tsc/action/fab-menu-context.d.ts +16 -0
  186. package/target/tsc/action/fab-menu.d.ts +112 -0
  187. package/target/tsc/action/fab.d.ts +98 -0
  188. package/target/tsc/action/group.d.ts +166 -0
  189. package/target/tsc/action/icon-button.d.ts +79 -0
  190. package/target/tsc/action/index.d.ts +24 -0
  191. package/target/tsc/action/split-button.d.ts +78 -0
  192. package/target/tsc/color/contrast.d.ts +48 -0
  193. package/target/tsc/color/dynamic.d.ts +203 -0
  194. package/target/tsc/color/hct.d.ts +114 -0
  195. package/target/tsc/color/index.css.d.ts +3 -0
  196. package/target/tsc/color/index.d.ts +23 -0
  197. package/target/tsc/color/palette.d.ts +30 -0
  198. package/target/tsc/color/scheme.d.ts +446 -0
  199. package/target/tsc/color/temperature.d.ts +24 -0
  200. package/target/tsc/container/card.css.d.ts +3 -0
  201. package/target/tsc/container/card.d.ts +110 -0
  202. package/target/tsc/container/elevation-shadow.css.d.ts +3 -0
  203. package/target/tsc/container/elevation-shadow.d.ts +23 -0
  204. package/target/tsc/container/index.d.ts +44 -0
  205. package/target/tsc/dom/client.d.ts +387 -0
  206. package/target/tsc/dom/index.d.ts +93 -0
  207. package/target/tsc/dom/server.d.ts +65 -0
  208. package/target/tsc/dom/types.d.ts +134 -0
  209. package/target/tsc/feedback/badge.d.ts +116 -0
  210. package/target/tsc/feedback/feedback.css.d.ts +3 -0
  211. package/target/tsc/feedback/focus.d.ts +20 -0
  212. package/target/tsc/feedback/index.d.ts +17 -0
  213. package/target/tsc/feedback/loading.d.ts +194 -0
  214. package/target/tsc/feedback/observe.d.ts +75 -0
  215. package/target/tsc/feedback/progress.d.ts +281 -0
  216. package/target/tsc/feedback/snackbar.d.ts +398 -0
  217. package/target/tsc/feedback/tooltip.d.ts +326 -0
  218. package/target/tsc/icon/icon.css.d.ts +3 -0
  219. package/target/tsc/icon/icon.d.ts +69 -0
  220. package/target/tsc/icon/index.d.ts +13 -0
  221. package/target/tsc/index.css.d.ts +3 -0
  222. package/target/tsc/index.d.ts +7 -0
  223. package/target/tsc/input/autocomplete.d.ts +119 -0
  224. package/target/tsc/input/base.d.ts +282 -0
  225. package/target/tsc/input/date-picker.css.d.ts +3 -0
  226. package/target/tsc/input/date-picker.d.ts +351 -0
  227. package/target/tsc/input/date-range-input.css.d.ts +3 -0
  228. package/target/tsc/input/date-time.d.ts +171 -0
  229. package/target/tsc/input/index.css.d.ts +3 -0
  230. package/target/tsc/input/index.d.ts +27 -0
  231. package/target/tsc/input/paired-input.d.ts +435 -0
  232. package/target/tsc/input/picker-dialog.css.d.ts +3 -0
  233. package/target/tsc/input/picker-dialog.d.ts +84 -0
  234. package/target/tsc/input/select.css.d.ts +3 -0
  235. package/target/tsc/input/select.d.ts +267 -0
  236. package/target/tsc/input/slider.css.d.ts +3 -0
  237. package/target/tsc/input/slider.d.ts +372 -0
  238. package/target/tsc/input/text-field.css.d.ts +3 -0
  239. package/target/tsc/input/text-field.d.ts +415 -0
  240. package/target/tsc/input/time-picker.css.d.ts +3 -0
  241. package/target/tsc/input/time-picker.d.ts +212 -0
  242. package/target/tsc/motion/frame.d.ts +36 -0
  243. package/target/tsc/motion/index.css.d.ts +3 -0
  244. package/target/tsc/motion/index.d.ts +34 -0
  245. package/target/tsc/motion/material.d.ts +110 -0
  246. package/target/tsc/motion/motion.d.ts +235 -0
  247. package/target/tsc/motion/spring.d.ts +223 -0
  248. package/target/tsc/motion/transition.css.d.ts +3 -0
  249. package/target/tsc/motion/transition.d.ts +597 -0
  250. package/target/tsc/motion/velocity.d.ts +54 -0
  251. package/target/tsc/navigation/app-bar.d.ts +473 -0
  252. package/target/tsc/navigation/base.d.ts +331 -0
  253. package/target/tsc/navigation/drawer.d.ts +301 -0
  254. package/target/tsc/navigation/index.d.ts +25 -0
  255. package/target/tsc/navigation/navigation.css.d.ts +3 -0
  256. package/target/tsc/navigation/navigation.d.ts +537 -0
  257. package/target/tsc/navigation/scroll.d.ts +218 -0
  258. package/target/tsc/navigation/search.d.ts +332 -0
  259. package/target/tsc/navigation/tabs.d.ts +497 -0
  260. package/target/tsc/navigation/toolbar.d.ts +248 -0
  261. package/target/tsc/selection/base.d.ts +100 -0
  262. package/target/tsc/selection/checkbox.d.ts +194 -0
  263. package/target/tsc/selection/chip.d.ts +358 -0
  264. package/target/tsc/selection/index.d.ts +21 -0
  265. package/target/tsc/selection/radio.d.ts +198 -0
  266. package/target/tsc/selection/segmented.d.ts +333 -0
  267. package/target/tsc/selection/selection.css.d.ts +3 -0
  268. package/target/tsc/selection/switch.d.ts +165 -0
  269. package/target/tsc/shape/corner-rounding.d.ts +36 -0
  270. package/target/tsc/shape/cubic.d.ts +215 -0
  271. package/target/tsc/shape/index.d.ts +35 -0
  272. package/target/tsc/shape/material-shapes.d.ts +176 -0
  273. package/target/tsc/shape/morph.d.ts +91 -0
  274. package/target/tsc/shape/path.d.ts +177 -0
  275. package/target/tsc/shape/point.d.ts +165 -0
  276. package/target/tsc/shape/rounded-polygon.d.ts +289 -0
  277. package/target/tsc/shape/shapes.d.ts +76 -0
  278. package/target/tsc/spacing/index.d.ts +19 -0
  279. package/target/tsc/state/component.css.d.ts +3 -0
  280. package/target/tsc/state/component.d.ts +276 -0
  281. package/target/tsc/state/controller.d.ts +257 -0
  282. package/target/tsc/state/index.d.ts +19 -0
  283. package/target/tsc/state/ripple.d.ts +50 -0
  284. package/target/tsc/state/state.d.ts +129 -0
  285. package/target/tsc/state/style.d.ts +22 -0
  286. package/target/tsc/surface/carousel-layout.d.ts +212 -0
  287. package/target/tsc/surface/carousel.css.d.ts +3 -0
  288. package/target/tsc/surface/carousel.d.ts +231 -0
  289. package/target/tsc/surface/dialog.d.ts +582 -0
  290. package/target/tsc/surface/divider.d.ts +92 -0
  291. package/target/tsc/surface/drag.d.ts +92 -0
  292. package/target/tsc/surface/gestures.css.d.ts +3 -0
  293. package/target/tsc/surface/gestures.d.ts +292 -0
  294. package/target/tsc/surface/index.css.d.ts +3 -0
  295. package/target/tsc/surface/index.d.ts +29 -0
  296. package/target/tsc/surface/interactive.d.ts +22 -0
  297. package/target/tsc/surface/list-patterns.d.ts +384 -0
  298. package/target/tsc/surface/list.css.d.ts +3 -0
  299. package/target/tsc/surface/list.d.ts +340 -0
  300. package/target/tsc/surface/menu.css.d.ts +3 -0
  301. package/target/tsc/surface/menu.d.ts +590 -0
  302. package/target/tsc/surface/scaffold.d.ts +337 -0
  303. package/target/tsc/surface/sheet.d.ts +384 -0
  304. package/target/tsc/surface/side-sheet.d.ts +183 -0
  305. package/target/tsc/surface/slots.d.ts +21 -0
  306. package/target/tsc/surface/surface.css.d.ts +3 -0
  307. package/target/tsc/surface/surface.d.ts +192 -0
  308. package/target/tsc/text/index.css.d.ts +3 -0
  309. package/target/tsc/text/index.d.ts +18 -0
  310. package/target/tsc/text/text.css.d.ts +3 -0
  311. package/target/tsc/text/text.d.ts +94 -0
  312. package/target/tsc/text/typography.css.d.ts +3 -0
  313. package/target/tsc/text/typography.d.ts +82 -0
  314. package/target/tsc/util/box-side.d.ts +76 -0
  315. package/target/tsc/util/debug.d.ts +20 -0
  316. package/target/tsc/util/dom.d.ts +35 -0
  317. package/target/tsc/util/event.d.ts +93 -0
  318. package/target/tsc/util/index.d.ts +12 -0
  319. package/target/tsc/util/preconditions.d.ts +79 -0
  320. package/target/tsc/util/reactive.d.ts +36 -0
@@ -0,0 +1,590 @@
1
+ import type { Accessor, JSX } from "solid-js";
2
+ import type { DomComponent, DomProps, StyleElement } from "..";
3
+ import type { InteractableComponent } from "../state";
4
+ import { DomController } from "../dom/client";
5
+ import { InteractableController } from "../state/controller";
6
+ import "../container/elevation-shadow.css";
7
+ import "./surface.css";
8
+ import "./menu.css";
9
+ /**
10
+ * Menu item role.
11
+ */
12
+ type MenuItemRole = "menuitem" | "menuitemcheckbox" | "menuitemradio";
13
+ /**
14
+ * Menu placement relative to its trigger.
15
+ *
16
+ * Horizontal placements are logical: `"bottom-start"` aligns the start edges of menu and trigger,
17
+ * and `"inline-end"` opens toward the end of the writing direction, as submenus do.
18
+ */
19
+ export type MenuPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end" | "inline-start" | "inline-end";
20
+ /**
21
+ * State and linkage supplied to a render-prop menu trigger.
22
+ */
23
+ export type MenuTriggerRenderProps = {
24
+ /**
25
+ * Reactive popup id. Keep this metadata separate from DOM attributes.
26
+ */
27
+ menuId: Accessor<string>;
28
+ /**
29
+ * Reactive open state. Keep this metadata separate from DOM attributes.
30
+ */
31
+ open: Accessor<boolean>;
32
+ /**
33
+ * Attributes intended to be spread onto the actual focusable trigger.
34
+ */
35
+ attrs: {
36
+ /**
37
+ * Reactive id of the menu popup controlled by the trigger.
38
+ */
39
+ "aria-controls": string;
40
+ /**
41
+ * Reactive open state serialized as an ARIA boolean.
42
+ */
43
+ "aria-expanded": "true" | "false";
44
+ /**
45
+ * Popup type identifying the controlled element as a menu.
46
+ */
47
+ "aria-haspopup": "menu";
48
+ };
49
+ };
50
+ /**
51
+ * Properties accepted by {@link Menu}.
52
+ */
53
+ export type MenuProps = DomProps<HTMLDivElement, Omit<JSX.HTMLAttributes<HTMLDivElement>, "role">> & {
54
+ /**
55
+ * Material menu presentation.
56
+ *
57
+ * | Variant | Presentation |
58
+ * | ----------------------------- | ------------------------------------------------ |
59
+ * | `"baseline"` | Material 3 menu, `MenuTokens` |
60
+ * | `"expressive"`, `"segmented"` | Material 3 Expressive menu, `SegmentedMenuTokens` |
61
+ *
62
+ * Submenus share the presentation of their menu.
63
+ *
64
+ * @defaultValue `"baseline"`
65
+ */
66
+ variant?: "baseline" | "segmented" | "expressive" | undefined;
67
+ /**
68
+ * Item arrangement and arrow-key navigation axis.
69
+ *
70
+ * @defaultValue `"vertical"`
71
+ */
72
+ orientation?: "vertical" | "horizontal" | undefined;
73
+ /**
74
+ * Color style of an Expressive menu (`StandardMenuTokens`, `VibrantMenuTokens`).
75
+ *
76
+ * Baseline menus ignore this. Submenus share the color style of their menu.
77
+ *
78
+ * @defaultValue `"standard"`
79
+ */
80
+ color?: "standard" | "vibrant" | undefined;
81
+ /**
82
+ * Element which opens the menu, or a function rendering it.
83
+ *
84
+ * The menu is linked to the one enabled focusable control within the trigger, or to the trigger
85
+ * itself when it has no control. Only that control toggles the menu: other content of the
86
+ * trigger, such as the popup of a tooltip wrapping the control, does not.
87
+ */
88
+ trigger?: JSX.Element | ((props: MenuTriggerRenderProps) => JSX.Element);
89
+ /**
90
+ * Controlled open state.
91
+ */
92
+ open?: boolean | undefined;
93
+ /**
94
+ * Initial open state when `open` is omitted.
95
+ */
96
+ defaultOpen?: boolean | undefined;
97
+ /**
98
+ * Treat the trigger as an item in a parent menu. Prefer {@link SubMenu}.
99
+ */
100
+ submenu?: boolean | undefined;
101
+ /**
102
+ * Menu placement.
103
+ *
104
+ * @defaultValue `"bottom-start"`
105
+ */
106
+ placement?: MenuPlacement | undefined;
107
+ /**
108
+ * Use automatic native popover behavior when supported.
109
+ *
110
+ * `true` selects `popover="auto"`; `false` selects `popover="manual"`. Submenus always use
111
+ * manual popovers. This option does not make the menu a modal dialog or trap focus.
112
+ *
113
+ * @defaultValue `true`
114
+ */
115
+ modal?: boolean | undefined;
116
+ /**
117
+ * Close after selecting an item.
118
+ *
119
+ * @defaultValue `true`, except for checkbox items
120
+ */
121
+ closeOnSelect?: boolean | undefined;
122
+ /**
123
+ * Move focus from either end of the menu to the other end with the arrow keys.
124
+ *
125
+ * @defaultValue `true`
126
+ */
127
+ loopFocus?: boolean | undefined;
128
+ /**
129
+ * Stable menu id.
130
+ */
131
+ id?: string | undefined;
132
+ /**
133
+ * Accessible name for the menu popup.
134
+ *
135
+ * @defaultValue `"Menu"`
136
+ */
137
+ label?: string | undefined;
138
+ /**
139
+ * Notify the parent when interaction requests a visibility change.
140
+ *
141
+ * With controlled `open`, the menu waits for the parent to accept the request. Prop-driven
142
+ * updates do not echo another request.
143
+ *
144
+ * @param open - new or requested open state
145
+ * @param event - triggering event, if any
146
+ */
147
+ onOpenChange?: ((open: boolean, event?: Event) => void) | undefined;
148
+ };
149
+ /**
150
+ * Properties accepted by {@link SubMenu}.
151
+ *
152
+ * A submenu shares the presentation and color style of its menu.
153
+ */
154
+ export type SubMenuProps = Omit<MenuProps, "color" | "submenu" | "variant">;
155
+ /**
156
+ * Common properties accepted by menu items.
157
+ */
158
+ export type MenuItemBaseProps = DomProps<HTMLDivElement, Omit<JSX.HTMLAttributes<HTMLDivElement>, "role" | "aria-disabled" | "aria-checked" | "tabindex">> & {
159
+ /**
160
+ * Leading icon or image.
161
+ */
162
+ leading?: JSX.Element;
163
+ /**
164
+ * Label; children are used when omitted.
165
+ */
166
+ label?: JSX.Element;
167
+ /**
168
+ * Secondary supporting text.
169
+ */
170
+ supportingText?: JSX.Element;
171
+ /**
172
+ * Trailing text, such as a keyboard shortcut, or icon.
173
+ */
174
+ trailing?: JSX.Element;
175
+ /**
176
+ * Trailing badge.
177
+ */
178
+ badge?: JSX.Element;
179
+ /**
180
+ * Stable item value.
181
+ */
182
+ value?: string | undefined;
183
+ /**
184
+ * Disable activation.
185
+ *
186
+ * Disabled items remain focusable by keyboard navigation, so that their presence can be
187
+ * discovered, as the WAI-ARIA APG recommends.
188
+ *
189
+ * @defaultValue `false`
190
+ */
191
+ disabled?: boolean | undefined;
192
+ /**
193
+ * Radio group name, used by radio items.
194
+ */
195
+ name?: string | undefined;
196
+ /**
197
+ * Close the owning menu after selection.
198
+ *
199
+ * @defaultValue `true`, except for checkbox items
200
+ */
201
+ closeOnSelect?: boolean | undefined;
202
+ /**
203
+ * Sequential focus index; the menu moves focus between items by default.
204
+ *
205
+ * @defaultValue `-1`
206
+ */
207
+ tabIndex?: number | undefined;
208
+ /**
209
+ * Handle item activation before notifying the owning menu.
210
+ *
211
+ * Call `event.preventDefault()` to prevent the menu selection event and automatic closing.
212
+ * Checkbox and radio state requests happen before this callback; cancelling here does not
213
+ * undo a committed checked state. Use `onCheckedChange` to veto that state change.
214
+ *
215
+ * @param event - activating click or keyboard event
216
+ */
217
+ onSelect?: ((event: MouseEvent | KeyboardEvent) => void) | undefined;
218
+ };
219
+ /**
220
+ * Standard menu item properties.
221
+ */
222
+ export type MenuItemProps = MenuItemBaseProps;
223
+ /**
224
+ * Checkbox menu item properties.
225
+ */
226
+ export type MenuCheckboxItemProps = MenuItemBaseProps & {
227
+ /**
228
+ * Controlled checked state.
229
+ */
230
+ checked?: boolean | undefined;
231
+ /**
232
+ * Initial checked state for an uncontrolled item.
233
+ */
234
+ defaultChecked?: boolean | undefined;
235
+ /**
236
+ * Request the next checked state before an uncontrolled item commits it.
237
+ *
238
+ * Call `event.preventDefault()` to veto both the checked change and further item activation.
239
+ * Controlled items require the parent to update `checked`.
240
+ *
241
+ * @param checked - requested checked state
242
+ * @param event - originating activation event
243
+ */
244
+ onCheckedChange?: ((checked: boolean, event: Event) => void) | undefined;
245
+ };
246
+ /**
247
+ * Radio menu item properties.
248
+ */
249
+ export type MenuRadioItemProps = MenuItemBaseProps & {
250
+ /**
251
+ * Controlled selected state.
252
+ */
253
+ checked?: boolean | undefined;
254
+ /**
255
+ * Initial selected state for an uncontrolled item.
256
+ */
257
+ defaultChecked?: boolean | undefined;
258
+ /**
259
+ * Request a radio selection or notify a controlled selected peer that it should clear.
260
+ *
261
+ * During activation, `event.preventDefault()` vetoes selection and further item activation.
262
+ * Peer updates carry an internal group event. Controlled items require the parent to update
263
+ * `checked`.
264
+ *
265
+ * @param checked - requested selected state
266
+ * @param event - activation or group-coordination event
267
+ */
268
+ onCheckedChange?: ((checked: boolean, event: Event) => void) | undefined;
269
+ };
270
+ /**
271
+ * Properties accepted by {@link MenuGroup}.
272
+ */
273
+ export type MenuGroupProps = DomProps<HTMLDivElement> & {
274
+ /**
275
+ * Section label, shown above the items and naming the group.
276
+ */
277
+ label?: string | undefined;
278
+ };
279
+ /**
280
+ * Client controller of a {@link Menu}: popup visibility, positioning, and APG menu navigation.
281
+ *
282
+ * The popup is a native popover when supported, positioned next to its trigger within the viewport
283
+ * margins of Compose's menus. While open, the menu listens to clicks outside of it, and positions
284
+ * its popup once per animation frame while its document scrolls or its window resizes.
285
+ */
286
+ export declare class MenuController extends DomController<MenuProps> {
287
+ #private;
288
+ /**
289
+ * Construct a new `MenuController`.
290
+ *
291
+ * The authored `attr:aria-label` property names the popup; it is split from the properties of
292
+ * the root, which has no role and must not be named.
293
+ *
294
+ * @param props - component properties
295
+ */
296
+ constructor(props: MenuProps);
297
+ /**
298
+ * Test whether the menu is open.
299
+ *
300
+ * @returns `true` if, and only if, the menu is open
301
+ */
302
+ isOpen(): boolean;
303
+ /**
304
+ * Request that the menu open.
305
+ *
306
+ * Controlled menus notify `onOpenChange` and wait for an updated `open` property.
307
+ *
308
+ * @param event - originating event, if any
309
+ */
310
+ open(event?: Event): void;
311
+ /**
312
+ * Request that the menu close.
313
+ *
314
+ * Controlled menus notify `onOpenChange` and wait for an updated `open` property.
315
+ *
316
+ * @param event - originating event, if any
317
+ */
318
+ close(event?: Event): void;
319
+ /**
320
+ * Apply local properties to component state and styling.
321
+ *
322
+ * @see {@link ../dom/client#DomController.applyComponentProps}
323
+ */
324
+ protected applyComponentProps(): void;
325
+ /**
326
+ * Handle style element replacement before the controller reference is updated.
327
+ *
328
+ * The style-element getter still exposes the previous element during this hook.
329
+ *
330
+ * @param curr - new style element, or `null` when absent
331
+ * @see {@link ../dom/client#DomController.onStyleElementChanged}
332
+ */
333
+ protected onStyleElementChanged(curr: StyleElement | null): void;
334
+ /**
335
+ * Render the component's element tree.
336
+ *
337
+ * The trigger and the children are reactive slots.
338
+ *
339
+ * @param children - nested component children, possibly an accessor
340
+ * @returns rendered component elements
341
+ * @see {@link ../dom/client#DomController.render}
342
+ */
343
+ protected render(children: JSX.Element): JSX.Element;
344
+ }
345
+ /**
346
+ * Menu popup with a trigger, roving item focus, and optional nested submenus.
347
+ *
348
+ * Supply a trigger factory to apply {@link MenuTriggerRenderProps.attrs} to the actual focus
349
+ * target during server rendering and hydration. Omitting `open` enables uncontrolled state
350
+ * initialized by `defaultOpen`; supplying it requires the parent to accept open-change requests.
351
+ *
352
+ * The popup opens from its trigger: it scales up from 80% and fades in with the fast spatial and
353
+ * effects springs, and reverses this when it closes (Compose `Menu.kt`). It stays within the
354
+ * viewport margins of Compose's menus, and scrolls the items which do not fit, in either
355
+ * orientation.
356
+ *
357
+ * # Navigation
358
+ *
359
+ * Following the WAI-ARIA APG menu pattern, the arrow keys of the menu orientation move focus
360
+ * between items, Home and End to the first and last item, and typed characters to the next item
361
+ * starting with them. Enter and Space activate the focused item. Escape closes the menu and returns
362
+ * focus to its trigger. Disabled items are focusable, but cannot be activated.
363
+ *
364
+ * # Design
365
+ *
366
+ * Menus use the menu roles of the [`cw-Surface`](./surface.yaml) design attribute. Expressive
367
+ * menus render each {@link MenuGroup} as a separate surface.
368
+ *
369
+ * @param props - component properties
370
+ * @returns trigger and menu elements
371
+ */
372
+ export declare const Menu: DomComponent<MenuProps>;
373
+ /**
374
+ * Nested menu with a menu-item trigger, directional entry and return, and delayed pointer opening.
375
+ *
376
+ * A submenu opens toward the end of the writing direction, and shares the presentation and color
377
+ * style of its menu.
378
+ *
379
+ * @param props - component properties
380
+ * @returns rendered component elements
381
+ */
382
+ export declare const SubMenu: DomComponent<SubMenuProps>;
383
+ /**
384
+ * Client controller of menu items; checkbox and radio subclasses add checked state.
385
+ *
386
+ * Items are interactable: they render state layers and a focus indicator for the hover, focus,
387
+ * and press states. Disabled items keep the focus state only, since they remain focusable.
388
+ *
389
+ * @typeParam P - component properties type
390
+ */
391
+ export declare class MenuItemController<P extends MenuItemBaseProps = MenuItemBaseProps> extends InteractableController<P> {
392
+ #private;
393
+ /**
394
+ * Menu item role selected by the component factory.
395
+ */
396
+ protected readonly itemRole: MenuItemRole;
397
+ /**
398
+ * Construct a new `MenuItemController`.
399
+ *
400
+ * @param props - component properties
401
+ * @param role - menu item role supplied by the component factory
402
+ */
403
+ constructor(props: P, role?: MenuItemRole);
404
+ /**
405
+ * Handle the selection of a peer in a named radio group; only radio items react to it.
406
+ *
407
+ * @param _event - internal peer-selection event, ignored by the base implementation
408
+ */
409
+ protected onRadioUncheck(_event: Event): void;
410
+ /**
411
+ * Clear a duplicate uncontrolled radio default; only radio items react to it.
412
+ *
413
+ * @param _event - internal default-normalization event, ignored by the base implementation
414
+ */
415
+ protected onRadioNormalize(_event: Event): void;
416
+ /**
417
+ * Notify the owning menu that this item was activated.
418
+ *
419
+ * @param event - activating click or keyboard event
420
+ */
421
+ protected activate(event: MouseEvent | KeyboardEvent): void;
422
+ /**
423
+ * Apply local properties to component state and styling.
424
+ *
425
+ * @see {@link ../dom/client#DomController.applyComponentProps}
426
+ */
427
+ protected applyComponentProps(): void;
428
+ /**
429
+ * Handle style element replacement before the controller reference is updated.
430
+ *
431
+ * The style-element getter still exposes the previous element during this hook.
432
+ *
433
+ * @param curr - new style element, or `null` when absent
434
+ * @see {@link ../dom/client#DomController.onStyleElementChanged}
435
+ */
436
+ protected onStyleElementChanged(curr: StyleElement | null): void;
437
+ /**
438
+ * Render the component's element tree.
439
+ *
440
+ * The content slots are reactive.
441
+ *
442
+ * @param children - nested component children, possibly an accessor
443
+ * @returns rendered component elements
444
+ * @see {@link ../dom/client#DomController.render}
445
+ */
446
+ protected render(children: JSX.Element): JSX.Element;
447
+ }
448
+ /**
449
+ * Standard menu item.
450
+ *
451
+ * @param props - component properties
452
+ * @returns rendered component elements
453
+ */
454
+ export declare const MenuItem: InteractableComponent<MenuItemProps>;
455
+ /**
456
+ * Checkbox menu item controller with controlled or uncontrolled checked state.
457
+ */
458
+ export declare class MenuCheckboxItemController extends MenuItemController<MenuCheckboxItemProps> {
459
+ #private;
460
+ /**
461
+ * Construct a new `MenuCheckboxItemController`.
462
+ *
463
+ * @param props - component properties
464
+ * @param role - menu item role supplied by the component factory
465
+ */
466
+ constructor(props: MenuCheckboxItemProps, role?: "menuitemcheckbox" | "menuitemradio");
467
+ /**
468
+ * Request a checked-state change, then notify the owning menu if activation is not cancelled.
469
+ *
470
+ * @param event - activating click or keyboard event
471
+ */
472
+ protected activate(event: MouseEvent | KeyboardEvent): void;
473
+ /**
474
+ * Handle selection of a peer in the same named radio group.
475
+ *
476
+ * Uncontrolled items clear their checked state; controlled checked items request it.
477
+ *
478
+ * @param event - internal peer-selection event carrying the group name
479
+ */
480
+ protected onRadioUncheck(event: Event): void;
481
+ /**
482
+ * Clear a duplicate uncontrolled radio default without notifying the consumer.
483
+ *
484
+ * @param event - internal default-normalization event carrying the group name
485
+ */
486
+ protected onRadioNormalize(event: Event): void;
487
+ /**
488
+ * Handle style element replacement before the controller reference is updated.
489
+ *
490
+ * An uncontrolled radio default inserted after a checked peer of its group renders unchecked.
491
+ *
492
+ * @param curr - new style element, or `null` when absent
493
+ * @see {@link ../dom/client#DomController.onStyleElementChanged}
494
+ */
495
+ protected onStyleElementChanged(curr: StyleElement | null): void;
496
+ /**
497
+ * Apply local properties to component state and styling.
498
+ *
499
+ * @see {@link ../dom/client#DomController.applyComponentProps}
500
+ */
501
+ protected applyComponentProps(): void;
502
+ /**
503
+ * Render the component's element tree.
504
+ *
505
+ * The content slots are reactive.
506
+ *
507
+ * @param children - nested component children, possibly an accessor
508
+ * @returns rendered component elements
509
+ * @see {@link ../dom/client#DomController.render}
510
+ */
511
+ protected render(children: JSX.Element): JSX.Element;
512
+ }
513
+ /**
514
+ * Checkbox menu item.
515
+ *
516
+ * Activating the item toggles its checked state. The menu remains open unless `closeOnSelect` is
517
+ * set.
518
+ *
519
+ * @param props - component properties
520
+ * @returns rendered component elements
521
+ */
522
+ export declare const MenuCheckboxItem: InteractableComponent<MenuCheckboxItemProps>;
523
+ /**
524
+ * Radio menu item controller.
525
+ */
526
+ export declare class MenuRadioItemController extends MenuCheckboxItemController {
527
+ /**
528
+ * Construct a new `MenuRadioItemController`.
529
+ *
530
+ * @param props - component properties
531
+ */
532
+ constructor(props: MenuRadioItemProps);
533
+ }
534
+ /**
535
+ * Radio menu item coordinated with named peers by its controller.
536
+ *
537
+ * Items with the same nonempty `name` within the nearest menu form a group. Unnamed items
538
+ * remain independent. Controlled items require the parent to accept selection requests.
539
+ *
540
+ * @param props - component properties
541
+ * @returns rendered menu item
542
+ */
543
+ export declare const MenuRadioItem: InteractableComponent<MenuRadioItemProps>;
544
+ /**
545
+ * Client controller of a {@link MenuGroup}.
546
+ */
547
+ export declare class MenuGroupController extends DomController<MenuGroupProps> {
548
+ #private;
549
+ /**
550
+ * Construct a new `MenuGroupController`.
551
+ *
552
+ * @param props - component properties
553
+ */
554
+ constructor(props: MenuGroupProps);
555
+ /**
556
+ * Apply local properties to component state and styling.
557
+ *
558
+ * @see {@link ../dom/client#DomController.applyComponentProps}
559
+ */
560
+ protected applyComponentProps(): void;
561
+ /**
562
+ * Handle style element replacement before the controller reference is updated.
563
+ *
564
+ * The style-element getter still exposes the previous element during this hook.
565
+ *
566
+ * @param curr - new style element, or `null` when absent
567
+ * @see {@link ../dom/client#DomController.onStyleElementChanged}
568
+ */
569
+ protected onStyleElementChanged(curr: StyleElement | null): void;
570
+ /**
571
+ * Render the component's element tree.
572
+ *
573
+ * @param children - nested component children, possibly an accessor
574
+ * @returns rendered component elements
575
+ * @see {@link ../dom/client#DomController.render}
576
+ */
577
+ protected render(children: JSX.Element): JSX.Element;
578
+ }
579
+ /**
580
+ * Related menu items with an optional section label.
581
+ *
582
+ * In an Expressive menu, every group is a separate surface; groups are separated by a gap, and
583
+ * their outer corners follow their position in the menu (Compose `MenuDefaults.groupShape`). The
584
+ * label is shown above the items and names the group.
585
+ *
586
+ * @param props - component properties
587
+ * @returns rendered component elements
588
+ */
589
+ export declare const MenuGroup: DomComponent<MenuGroupProps>;
590
+ export {};