@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,326 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomComponent, DomProps, FunctionElement, StyleElement } from "..";
3
+ import { DomController } from "../dom/client";
4
+ import "../container/elevation-shadow.css";
5
+ import "./feedback.css";
6
+ /**
7
+ * Preferred placement of a tooltip relative to its anchor.
8
+ *
9
+ * `"start"` and `"end"` follow the text direction of the anchor.
10
+ */
11
+ export type TooltipPlacement = "bottom" | "end" | "start" | "top";
12
+ /**
13
+ * Attributes supplied to a {@link TooltipTriggerFactory}.
14
+ *
15
+ * Spread the attributes onto the element which receives focus, or map them to the `attr:`
16
+ * properties of a Cobweb control. The ARIA attributes and `tabIndex` are reactive getters, so
17
+ * the trigger is not rendered again as they change. ARIA attributes supplied to the tooltip
18
+ * through `attr:` properties take precedence over the generated ones.
19
+ */
20
+ export interface TooltipTriggerContext extends JSX.AriaAttributes {
21
+ /**
22
+ * Id of the popup.
23
+ *
24
+ * This is metadata, not an attribute: it is not enumerable, so a spread omits it.
25
+ */
26
+ readonly popupId: string;
27
+ /**
28
+ * Popup is open.
29
+ *
30
+ * This is metadata, not an attribute: it is not enumerable, so a spread omits it.
31
+ */
32
+ readonly open: boolean;
33
+ /**
34
+ * Sequential focus index: `0` while the tooltip is enabled, `undefined` while disabled.
35
+ */
36
+ readonly tabIndex: 0 | undefined;
37
+ /**
38
+ * Id of the popup, describing the trigger; `undefined` while disabled.
39
+ */
40
+ readonly "aria-describedby"?: string;
41
+ /**
42
+ * Id of the popup of a rich tooltip; `undefined` for a plain tooltip and while disabled.
43
+ */
44
+ readonly "aria-controls"?: string;
45
+ /**
46
+ * Visibility of the popup of a rich tooltip; `undefined` for a plain tooltip and while
47
+ * disabled.
48
+ */
49
+ readonly "aria-expanded"?: "false" | "true";
50
+ /**
51
+ * `"dialog"` for a rich tooltip; `undefined` for a plain tooltip and while disabled.
52
+ */
53
+ readonly "aria-haspopup"?: JSX.AriaAttributes["aria-haspopup"];
54
+ }
55
+ /**
56
+ * Function rendering the trigger of a tooltip.
57
+ *
58
+ * The returned element is the anchor of the tooltip, and receives keyboard focus, so it is
59
+ * rendered identically by the server and the client.
60
+ *
61
+ * @param context - attributes linking the trigger to the popup
62
+ * @returns trigger element
63
+ */
64
+ export type TooltipTriggerFactory = (context: TooltipTriggerContext) => JSX.Element;
65
+ /**
66
+ * Properties common to {@link PlainTooltip} and {@link RichTooltip}.
67
+ */
68
+ export type TooltipBaseProps = DomProps<HTMLSpanElement, Omit<JSX.HTMLAttributes<HTMLSpanElement>, "role">> & {
69
+ /**
70
+ * Content of the popup: the text of a plain tooltip, or the supporting text of a rich
71
+ * tooltip.
72
+ */
73
+ content?: JSX.Element;
74
+ /**
75
+ * Popup is open.
76
+ *
77
+ * Supplying this property, including as `undefined`, controls the tooltip: interaction then
78
+ * requests visibility changes through {@link TooltipBaseProps.onOpenChange | `onOpenChange`},
79
+ * which the owner accepts by updating this property. Omit it to let interaction open and close
80
+ * the tooltip.
81
+ */
82
+ open?: boolean | undefined;
83
+ /**
84
+ * Delay before hover or keyboard focus opens the popup, in milliseconds.
85
+ *
86
+ * Negative delays are `0`, and non-finite delays the default. A touch long press always opens
87
+ * after 500 milliseconds.
88
+ *
89
+ * @defaultValue `500`
90
+ */
91
+ showDelay?: number | undefined;
92
+ /**
93
+ * Delay before the popup closes once neither hovered nor focused, or once a long press ends,
94
+ * in milliseconds.
95
+ *
96
+ * Negative delays are `0`, and non-finite delays the default. Escape, activation, and a
97
+ * cancelled touch close the popup at once.
98
+ *
99
+ * @defaultValue `1500`
100
+ */
101
+ hideDelay?: number | undefined;
102
+ /**
103
+ * Preferred placement of the popup.
104
+ *
105
+ * The popup is placed on the opposite side when the preferred side lacks room, and is kept
106
+ * within the viewport.
107
+ *
108
+ * @defaultValue `"top"`
109
+ */
110
+ placement?: TooltipPlacement | undefined;
111
+ /**
112
+ * Popup shows a caret pointing at its anchor (`TooltipDefaults.caretShape()`).
113
+ *
114
+ * @defaultValue `false`
115
+ */
116
+ caret?: boolean | undefined;
117
+ /**
118
+ * Tooltip is disabled: interaction does not open it, its popup is closed, and the trigger is
119
+ * not linked to the popup.
120
+ *
121
+ * @defaultValue `false`
122
+ */
123
+ disabled?: boolean | undefined;
124
+ /**
125
+ * Id of the popup, referenced by the trigger; generated when omitted.
126
+ */
127
+ id?: string | undefined;
128
+ /**
129
+ * Function rendering the trigger.
130
+ *
131
+ * The trigger receives the attributes linking it to the popup. Without a factory, nested
132
+ * children are wrapped by an element which links the first focusable child, or becomes
133
+ * focusable itself when no child is.
134
+ */
135
+ trigger?: TooltipTriggerFactory | undefined;
136
+ /**
137
+ * Function notified of a request to change the visibility of the popup.
138
+ *
139
+ * Opening a tooltip through interaction also requests the other open tooltips of its document
140
+ * to close.
141
+ *
142
+ * @param open - requested visibility
143
+ */
144
+ onOpenChange?: ((open: boolean) => void) | undefined;
145
+ };
146
+ /**
147
+ * {@link PlainTooltip} component properties.
148
+ */
149
+ export type PlainTooltipProps = TooltipBaseProps;
150
+ /**
151
+ * {@link RichTooltip} component properties.
152
+ */
153
+ export type RichTooltipProps = TooltipBaseProps & {
154
+ /**
155
+ * Title, which also names the popup.
156
+ */
157
+ title?: JSX.Element;
158
+ /**
159
+ * Accessible name of the popup without a title.
160
+ *
161
+ * @defaultValue `"Tooltip"`
162
+ */
163
+ popupLabel?: string | undefined;
164
+ /**
165
+ * Supporting text, superseding {@link TooltipBaseProps.content | `content`}.
166
+ */
167
+ supportingText?: JSX.Element;
168
+ /**
169
+ * Action content, usually a text button.
170
+ */
171
+ action?: JSX.Element;
172
+ /**
173
+ * Popup stays open until dismissed (`TooltipState.isPersistent`).
174
+ *
175
+ * A persistent tooltip opens on hover, keyboard focus, long press, and activation of its
176
+ * trigger, which also closes it again. It does not close when the pointer or focus leaves it,
177
+ * but on Escape and on a press outside of the trigger and the popup. Make a tooltip with an
178
+ * action persistent, so its action remains reachable.
179
+ *
180
+ * @defaultValue `false`
181
+ */
182
+ persistent?: boolean | undefined;
183
+ };
184
+ /**
185
+ * Client-side controller shared by tooltips.
186
+ *
187
+ * The controller links the element which actually receives focus, the *target*, to the popup:
188
+ * the element rendered by a trigger factory, the first focusable child of the trigger wrapper,
189
+ * or the wrapper itself. It opens and closes the popup on interaction, coordinates open tooltips
190
+ * of a document, and positions the popup in the top layer.
191
+ *
192
+ * # Interaction
193
+ *
194
+ * | Interaction | Plain or rich tooltip | Persistent rich tooltip |
195
+ * | ------------------------------ | --------------------------- | --------------------------- |
196
+ * | Hover the trigger or the popup | Opens after the show delay | Opens after the show delay |
197
+ * | Keyboard focus on the target | Opens after the show delay | Opens after the show delay |
198
+ * | Pointer and focus leave | Closes after the hide delay | Stays open |
199
+ * | Touch long press | Opens; release starts the hide delay | Opens |
200
+ * | Activate the trigger | Closes | Opens or closes |
201
+ * | Escape | Closes the most recent | Closes the most recent |
202
+ * | Press outside | Closes | Closes |
203
+ *
204
+ * @typeParam P - component properties type
205
+ */
206
+ export declare abstract class TooltipController<P extends TooltipBaseProps> extends DomController<P> {
207
+ #private;
208
+ /**
209
+ * Construct a new controller.
210
+ *
211
+ * @param props - component properties
212
+ * @param rich - tooltip is rich
213
+ */
214
+ constructor(props: P, rich: boolean);
215
+ /**
216
+ * Popup is persistent.
217
+ *
218
+ * @returns `true` if, and only if, the popup stays open until dismissed
219
+ */
220
+ protected get persistent(): boolean;
221
+ protected applyComponentProps(): void;
222
+ /**
223
+ * Name the popup.
224
+ *
225
+ * This is invoked by {@link TooltipController.applyComponentProps}, in the same tracking
226
+ * context, after the popup id is applied. A plain tooltip popup needs no name.
227
+ *
228
+ * @param _popup - popup element
229
+ */
230
+ protected applyPopupName(_popup: HTMLSpanElement): void;
231
+ protected onFunctionElementChanged(curr: FunctionElement<P> | null): void;
232
+ protected onStyleElementChanged(curr: StyleElement | null): void;
233
+ protected onControllerCleanup(): void;
234
+ /**
235
+ * Render the trigger content.
236
+ *
237
+ * @param children - nested children
238
+ * @returns trigger content
239
+ */
240
+ protected renderTrigger(children: JSX.Element): JSX.Element;
241
+ /**
242
+ * Register the rendered popup of the tooltip.
243
+ *
244
+ * @param popup - popup element
245
+ */
246
+ protected setPopup(popup: HTMLSpanElement): void;
247
+ }
248
+ /**
249
+ * Client-side controller of a {@link PlainTooltip}.
250
+ */
251
+ export declare class PlainTooltipController extends TooltipController<PlainTooltipProps> {
252
+ /**
253
+ * Construct a new controller.
254
+ *
255
+ * @param props - component properties
256
+ */
257
+ constructor(props: PlainTooltipProps);
258
+ protected render(children: JSX.Element, funcRef?: (elem: FunctionElement<PlainTooltipProps>) => void): JSX.Element;
259
+ }
260
+ /**
261
+ * Material 3 plain tooltip.
262
+ *
263
+ * A plain tooltip briefly describes an element, usually an icon button, in a small popup which
264
+ * opens on hover, keyboard focus, and touch long press, and closes once the pointer and focus
265
+ * leave, or on Escape. The popup describes the element which receives focus through
266
+ * `aria-describedby`; keep its content short and non-interactive, and give the element its own
267
+ * accessible name.
268
+ *
269
+ * Render the trigger through {@link TooltipBaseProps.trigger | `props.trigger`}, which renders
270
+ * the same linkage on the server and the client. Popups are positioned in the top layer, above
271
+ * clipping containers.
272
+ *
273
+ * # Design
274
+ *
275
+ * Design is controlled through the `tooltip` roles of the [`cw-Feedback`](./feedback.yaml) design
276
+ * attribute (`PlainTooltipTokens`): an inverse surface container with an extra small shape, from
277
+ * 40px to 200px wide and at least 24px tall, 4px from its anchor. Opening fades the popup in with
278
+ * the fast effects spring while scaling it from 0.8 with the fast spatial spring (`Tooltip.kt`).
279
+ * {@link TooltipBaseProps.caret | `props.caret`} adds a caret pointing at the anchor.
280
+ *
281
+ * @param props - component properties
282
+ * @returns rendered element
283
+ */
284
+ export declare const PlainTooltip: DomComponent<PlainTooltipProps>;
285
+ /**
286
+ * Client-side controller of a {@link RichTooltip}.
287
+ */
288
+ export declare class RichTooltipController extends TooltipController<RichTooltipProps> {
289
+ #private;
290
+ /**
291
+ * Construct a new controller.
292
+ *
293
+ * @param props - component properties
294
+ */
295
+ constructor(props: RichTooltipProps);
296
+ protected get persistent(): boolean;
297
+ protected applyComponentProps(): void;
298
+ protected applyPopupName(popup: HTMLSpanElement): void;
299
+ protected render(children: JSX.Element, funcRef?: (elem: FunctionElement<RichTooltipProps>) => void): JSX.Element;
300
+ }
301
+ /**
302
+ * Material 3 rich tooltip.
303
+ *
304
+ * A rich tooltip shows a title, supporting text, and an optional action in a popup, a non-modal
305
+ * `dialog`, which opens on hover, keyboard focus, and touch long press. Focus stays on the
306
+ * trigger as the popup opens, and Tab reaches its action; Escape closes the popup, returning
307
+ * focus to the trigger when it was within the popup. A
308
+ * {@link RichTooltipProps.persistent | persistent} tooltip also opens and closes through its
309
+ * trigger, and stays open until dismissed, as a tooltip with an action should.
310
+ *
311
+ * The trigger is linked to the popup through `aria-controls`, `aria-describedby`,
312
+ * `aria-expanded`, and `aria-haspopup`. The popup is named by its title, or by
313
+ * {@link RichTooltipProps.popupLabel | `props.popupLabel`}.
314
+ *
315
+ * # Design
316
+ *
317
+ * Design is controlled through the `tooltip` roles of the [`cw-Feedback`](./feedback.yaml) design
318
+ * attribute, with the `richTooltip` theme (`RichTooltipTokens`): a surface container with a
319
+ * medium shape and level 2 elevation, up to 320px wide, 4px from its anchor. The title is
320
+ * title-small in the on-surface-variant color, and Material buttons in the action slot take the
321
+ * primary color.
322
+ *
323
+ * @param props - component properties
324
+ * @returns rendered element
325
+ */
326
+ export declare const RichTooltip: DomComponent<RichTooltipProps>;
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+
3
+ export {};
@@ -0,0 +1,69 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomComponent, DomProps } from "..";
3
+ import "./icon.css";
4
+ /**
5
+ * Icon {@link Icon | component} properties.
6
+ */
7
+ export type IconProps = DomProps<HTMLElement, JSX.HTMLElementTags["i"]> & {
8
+ /**
9
+ * Icon is mirrored horizontally in a right-to-left context.
10
+ *
11
+ * Enable this for icons indicating a direction, such as arrows pointing back or forward, so
12
+ * that they point the same way as the layout when the directionality of the icon element is
13
+ * right-to-left.
14
+ *
15
+ * @defaultValue `false`
16
+ */
17
+ autoMirror?: boolean;
18
+ /**
19
+ * Name of icon to render.
20
+ *
21
+ * If this is not omitted, then any {@link IconProps.children | nested} children are
22
+ * ignored.
23
+ */
24
+ name?: string | undefined;
25
+ };
26
+ /**
27
+ * Icon component.
28
+ *
29
+ * Icons are rendered within a non-interactive container. There is no restriction on what may be
30
+ * nested within an icon component; however, usually text will be nested within the icon. As there
31
+ * are no restrictions on nesting, an `<img>` may also be nested within an icon, without any text.
32
+ * The `<img>` will then be rendered in place of the icon font rendered icon.
33
+ *
34
+ * If {@link IconProps.name | `props.name`} is specified, then all nested children are ignored and
35
+ * `props.name` is used as the name of the icon to render. This may be preferred as this evaluates
36
+ * to a simple `textContent` assignment, which performs better than updating nested children.
37
+ *
38
+ * By default, rendered elements have the `attr:aria-hidden` and `attr:role` attributes set to
39
+ * `true` and `img`, respectively. This can be disabled by explicitly setting `attr:aria-hidden`
40
+ * or `attr:role` within `props`.
41
+ *
42
+ * Since icon components are not interactable, `event:*` handlers, such as `event:click`, will
43
+ * never be invoked. These handlers should be excluded from `props`. If handling events is
44
+ * required, the icon component should be nested within an interactable container.
45
+ *
46
+ * # Design
47
+ *
48
+ * Icons are rendered with the icon font specification, defined by the
49
+ * [`cw-IconFont`](./icon-font.yaml) reference design attribute. Component specific design,
50
+ * however, is controlled through the [`cw-Icon`](./icon.yaml) design attribute. Its fill, grade,
51
+ * and weight roles set the corresponding axes of the icon font, while the optical size axis
52
+ * follows the icon size. The fill role is a number, so that transitions of it animate the fill.
53
+ * The glyphs of an icon without nested elements are painted in the icon color as graphics,
54
+ * smoothed in grayscale, unless colors are forced. Icons indicating a direction set
55
+ * {@link IconProps.autoMirror | `props.autoMirror`} to be mirrored in a right-to-left context.
56
+ *
57
+ * @param props - component properties
58
+ * @returns rendered element
59
+ * @example
60
+ * ```tsx
61
+ * // Renders a `home` icon using the configured icon font.
62
+ * <Icon>home</Icon> // equivalent to: <Icon name="home" />
63
+ * // Renders an image icon:
64
+ * <Icon><img src="https://foo/bar.png" /></Icon>
65
+ * // Renders a back arrow, pointing right in a right-to-left context:
66
+ * <Icon autoMirror name="arrow_back" />
67
+ * ```
68
+ */
69
+ export declare const Icon: DomComponent<IconProps>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Icon definitions.
3
+ *
4
+ * This module defines the {@link Icon} component. While icon components are not formally defined
5
+ * by the Material 3 design specification, the [`cw-IconFont`](./icon-font.yaml) design attribute
6
+ * is well [defined](https://m3.material.io/styles/icons/overview). The icon component uses this
7
+ * reference design attribute, along with the [`cw-Icon`](./icon.yaml) component design attribute,
8
+ * to control its design.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export type { IconProps } from "./icon";
13
+ export { Icon } from "./icon";
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+
3
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Components library, based on Material 3, for SolidJS.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export type { BaseDomProps, ClientDomProps, DomAttributes, DomComponent, DomController, DomControllerOptions, DomEventHandlerProps, DomProps, DomTag, ElementDomProps, FunctionElement, PickDomAttributes, PickLocalDomProps, ReadProps, RenderServerDom, StyleElement } from "./dom";
7
+ export { defineDomComponent } from "./dom";
@@ -0,0 +1,119 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomComponent, FunctionElement } from "..";
3
+ import type { TextFieldProps } from "./text-field";
4
+ import { TextFieldController } from "./text-field";
5
+ import "../container/elevation-shadow.css";
6
+ /**
7
+ * {@link Autocomplete} component properties.
8
+ *
9
+ * An autocomplete field accepts the single-line {@link ./text-field#TextFieldProps | text-field
10
+ * properties}. Use `attr:form` to associate the native input with a form outside its ancestors.
11
+ */
12
+ export type AutocompleteProps = Omit<TextFieldProps, "cols" | "max" | "min" | "multiline" | "revealPassword" | "revealPasswordLabel" | "rows" | "secure" | "step" | "type"> & {
13
+ /**
14
+ * Suggestions shown in the menu, in order.
15
+ *
16
+ * The caller filters the suggestions for the current value, which it receives through the
17
+ * value-change callbacks. Choosing a suggestion commits it as the field value. The menu is
18
+ * shown while the user edits the field or navigates the suggestions, and while there is at
19
+ * least one suggestion.
20
+ */
21
+ options: readonly string[];
22
+ };
23
+ /**
24
+ * Client controller of an {@link Autocomplete}.
25
+ *
26
+ * The native input is an ARIA 1.2 combobox controlling a listbox of suggestions, which opens in the
27
+ * top layer as a native popover. The input keeps focus while suggestions are navigated; the active
28
+ * suggestion is referenced by `aria-activedescendant`.
29
+ *
30
+ * # Keyboard
31
+ *
32
+ * | Key | Behavior |
33
+ * | --- | --- |
34
+ * | Down arrow | Open the menu and activate the first suggestion, or activate the next one. |
35
+ * | Up arrow | Open the menu and activate the last suggestion, or activate the previous one. |
36
+ * | Alt + Down arrow | Open the menu without activating a suggestion. |
37
+ * | Home, End | Activate the first or last suggestion while one is active. |
38
+ * | Enter | Choose the active suggestion. |
39
+ * | Escape | Close the menu. |
40
+ *
41
+ * Typing opens the menu without activating a suggestion; moving focus away closes it. A field
42
+ * which is read-only or disabled, including through a disabled `<fieldset>` ancestor, neither
43
+ * opens the menu nor chooses a suggestion: the arrow keys keep their native behavior, and the
44
+ * menu closes when the field becomes read-only or disabled.
45
+ */
46
+ export declare class AutocompleteController extends TextFieldController<AutocompleteProps> {
47
+ #private;
48
+ /**
49
+ * Construct a new `AutocompleteController`.
50
+ *
51
+ * @param props - component properties
52
+ */
53
+ constructor(props: AutocompleteProps);
54
+ /**
55
+ * Apply local properties to component state and styling.
56
+ *
57
+ * @see {@link ../dom/client#DomController.applyComponentProps}
58
+ */
59
+ protected applyComponentProps(): void;
60
+ /**
61
+ * Handle function element replacement before the controller reference is updated.
62
+ *
63
+ * @param element - new function element, or `null` when absent
64
+ * @see {@link ../dom/client#DomController.onFunctionElementChanged}
65
+ */
66
+ protected onFunctionElementChanged(element: FunctionElement<AutocompleteProps> | null): void;
67
+ /**
68
+ * Render the suggestion menu after the field.
69
+ *
70
+ * Suggestions are a reactive list; every other part of the menu is static.
71
+ *
72
+ * @returns suggestion menu
73
+ * @see {@link ./text-field#TextFieldController.renderExtension}
74
+ */
75
+ protected renderExtension(): JSX.Element;
76
+ }
77
+ /**
78
+ * Material 3 autocomplete text field.
79
+ *
80
+ * An autocomplete field is a single-line {@link ./text-field#TextField | text field} whose
81
+ * suggestions, supplied and filtered by the caller, are shown in a menu below the field
82
+ * (`FilledAutocompleteTokens.kt`, `OutlinedAutocompleteTokens.kt`). Choosing a suggestion
83
+ * commits it as the field value through the value-change callbacks; the native input keeps
84
+ * submitting the field value with its form.
85
+ *
86
+ * # States
87
+ *
88
+ * The field states follow {@link ./text-field#TextField}. The menu opens, scaling and fading in,
89
+ * while the user edits the field or navigates the suggestions, and closes when a suggestion is
90
+ * chosen, Escape is pressed, focus leaves the field, or no suggestion remains. A read-only or
91
+ * disabled field offers no suggestions.
92
+ *
93
+ * # Design
94
+ *
95
+ * Design is controlled through the [`cw-TextField`](./text-field.yaml) component design attribute,
96
+ * whose `menu` roles style the suggestion menu. The root element has the `cw-TextField` and
97
+ * `cw-Autocomplete` classes; the menu has the `cw-Autocomplete-menu` class and each suggestion
98
+ * the `cw-Autocomplete-option` class.
99
+ *
100
+ * # Accessibility
101
+ *
102
+ * The input is an ARIA 1.2 combobox with list autocompletion, controlling the suggestion listbox;
103
+ * see {@link AutocompleteController} for keyboard interaction.
104
+ *
105
+ * @param props - component properties
106
+ * @returns rendered component elements
107
+ * @example
108
+ * ```tsx
109
+ * const [city, setCity] = createSignal("");
110
+ *
111
+ * <Autocomplete
112
+ * label="City"
113
+ * value={city()}
114
+ * onValueChange={setCity}
115
+ * options={CITIES.filter((name) => name.toLowerCase().startsWith(city().toLowerCase()))}
116
+ * />
117
+ * ```
118
+ */
119
+ export declare const Autocomplete: DomComponent<AutocompleteProps>;