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

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 +111 -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 +320 -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 +580 -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,333 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomComponent, DomProps, FunctionElement, StyleElement } from "..";
3
+ import type { InteractableComponent } from "../state";
4
+ import type { SelectionChangeHandler } from "./base";
5
+ import { DomController } from "../dom/client";
6
+ import { InteractableController } from "../state/controller";
7
+ import "./selection.css";
8
+ /**
9
+ * {@link SegmentedButton} component properties.
10
+ */
11
+ export type SegmentedButtonProps = DomProps<HTMLButtonElement, Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "name" | "required" | "tabIndex" | "type" | "value">> & {
12
+ /**
13
+ * Segment is selected.
14
+ *
15
+ * Applies only to a standalone segment, which is controlled when this property, or its alias
16
+ * {@link SegmentedButtonProps.checked | `checked`}, is present. A segment of a {@link
17
+ * SegmentedButtonGroup} takes its selection from the group.
18
+ */
19
+ selected?: boolean | undefined;
20
+ /**
21
+ * Alias of {@link SegmentedButtonProps.selected | `selected`}.
22
+ *
23
+ * `selected` takes precedence when both are present.
24
+ */
25
+ checked?: boolean | undefined;
26
+ /**
27
+ * Initial selected state of an uncontrolled standalone segment.
28
+ *
29
+ * This is also the state restored when the segment's form is reset.
30
+ *
31
+ * @defaultValue `false`
32
+ * @remarks
33
+ * This is read once.
34
+ */
35
+ defaultSelected?: boolean | undefined;
36
+ /**
37
+ * Icon content, sized by the `cw-SegmentedButton-iconSize` role.
38
+ *
39
+ * A selected segment shows a checkmark in place of its icon. A segment without an icon shows
40
+ * the checkmark beside its label, which is centered while the segment is unselected.
41
+ */
42
+ icon?: JSX.Element;
43
+ /**
44
+ * Label content.
45
+ *
46
+ * Takes precedence over `children`, which is an equivalent label slot.
47
+ */
48
+ label?: JSX.Element;
49
+ /**
50
+ * Segment is disabled.
51
+ *
52
+ * @defaultValue `false`
53
+ */
54
+ disabled?: boolean | undefined;
55
+ /**
56
+ * Name under which a selected segment submits its value.
57
+ *
58
+ * The value is submitted through a hidden input, which follows the form named by `attr:form`
59
+ * when supplied.
60
+ */
61
+ name?: string | undefined;
62
+ /**
63
+ * Value identifying the segment.
64
+ *
65
+ * Within a {@link SegmentedButtonGroup}, the value identifies the segment's option and must
66
+ * be unique and non-blank: a segment without a usable value, or with the value of a preceding
67
+ * segment, is marked with `data-cw-invalid-value` and `aria-disabled="true"` and cannot be
68
+ * activated. A selected named segment submits this value.
69
+ */
70
+ value?: string | undefined;
71
+ /**
72
+ * Sequential focus index.
73
+ *
74
+ * Within a {@link SegmentedButtonGroup}, the group owns the tab order: a non-negative value
75
+ * makes the segment the group's preferred tab stop.
76
+ */
77
+ tabIndex?: number | undefined;
78
+ /**
79
+ * Handle a change of the selected state requested by the user.
80
+ *
81
+ * Runs after delegated click handlers have had the opportunity to cancel the click. A
82
+ * controlled standalone segment accepts the request only when the parent updates {@link
83
+ * SegmentedButtonProps.selected | `selected`}; within a {@link SegmentedButtonGroup}, the
84
+ * callback runs when the group accepts the request, before the group's `onChange`. Distinct
85
+ * `onChange` and `onSelectedChange` callbacks run in that order; one function supplied to both
86
+ * runs once.
87
+ *
88
+ * @see {@link ./base#SelectionChangeHandler}
89
+ */
90
+ onChange?: SelectionChangeHandler | undefined;
91
+ /**
92
+ * Alias of {@link SegmentedButtonProps.onChange | `onChange`}, matching Compose's naming.
93
+ */
94
+ onSelectedChange?: SelectionChangeHandler | undefined;
95
+ };
96
+ /**
97
+ * Data item accepted by {@link SegmentedButtonGroupProps.items}.
98
+ *
99
+ * The data form gives server rendering a complete, deterministic view of the segments, so the
100
+ * server can mark the last segment and choose a later selected or explicit tab stop.
101
+ */
102
+ export type SegmentedButtonItem = Omit<SegmentedButtonProps, "children"> & {
103
+ /**
104
+ * Label content, when no `label` is supplied.
105
+ */
106
+ children?: JSX.Element;
107
+ };
108
+ /**
109
+ * Selected value, or values, of a {@link SegmentedButtonGroup}.
110
+ */
111
+ export type SegmentedGroupValue = string | readonly string[];
112
+ /**
113
+ * Handle a change of the selection requested by the user.
114
+ *
115
+ * @param value - requested value of a single-choice group, or values of a multiple-choice group
116
+ * @param event - originating event
117
+ */
118
+ export type SegmentedGroupChangeHandler = (value: SegmentedGroupValue, event: Event) => void;
119
+ /**
120
+ * {@link SegmentedButtonGroup} component properties.
121
+ */
122
+ export type SegmentedButtonGroupProps = DomProps<HTMLDivElement, Omit<JSX.HTMLAttributes<HTMLDivElement>, "role">> & {
123
+ /**
124
+ * Allow more than one segment to be selected.
125
+ *
126
+ * A single-choice group is exposed as a `radiogroup` of `radio` segments, a multiple-choice
127
+ * group as a `group` of toggle buttons.
128
+ *
129
+ * @defaultValue `false`
130
+ */
131
+ multiple?: boolean | undefined;
132
+ /**
133
+ * Prevent deselecting the final selected segment of a multiple-choice group.
134
+ *
135
+ * A single-choice group never deselects its selected segment.
136
+ *
137
+ * @defaultValue `false`
138
+ */
139
+ required?: boolean | undefined;
140
+ /**
141
+ * Selected value, or values.
142
+ *
143
+ * The group is controlled when this property is present, even when its value is `undefined`.
144
+ * Segment `value`s identify the options; a single-choice group keeps the first value only.
145
+ */
146
+ value?: SegmentedGroupValue | undefined;
147
+ /**
148
+ * Initial selected value, or values, of an uncontrolled group.
149
+ *
150
+ * This is also the selection restored when the form of the segments is reset.
151
+ *
152
+ * @remarks
153
+ * This is read once.
154
+ */
155
+ defaultValue?: SegmentedGroupValue | undefined;
156
+ /**
157
+ * Layout direction.
158
+ *
159
+ * Arrow keys follow the layout direction; a single-choice group also accepts the arrow keys
160
+ * of the other axis, as radio groups do.
161
+ *
162
+ * @defaultValue `"horizontal"`
163
+ */
164
+ orientation?: "horizontal" | "vertical" | undefined;
165
+ /**
166
+ * Handle a change of the selection requested by the user.
167
+ *
168
+ * A controlled group accepts the request only when the parent updates {@link
169
+ * SegmentedButtonGroupProps.value | `value`}.
170
+ */
171
+ onChange?: SegmentedGroupChangeHandler | undefined;
172
+ /**
173
+ * Segment data, rendered in order in place of `children`.
174
+ *
175
+ * The group renders its items when this property is present as it is constructed, and its
176
+ * children otherwise. The items are reactive and keyed by identity.
177
+ */
178
+ items?: readonly SegmentedButtonItem[] | undefined;
179
+ };
180
+ /**
181
+ * Client controller of a {@link SegmentedButton}.
182
+ *
183
+ * A standalone segment is a toggle button exposing its selected state through `aria-pressed`. A
184
+ * segment of a {@link SegmentedButtonGroup} registers with the group, which owns the selection,
185
+ * the tab order, and the segment's position classes.
186
+ */
187
+ export declare class SegmentedButtonController extends InteractableController<SegmentedButtonProps> {
188
+ #private;
189
+ /**
190
+ * Construct a new `SegmentedButtonController`.
191
+ *
192
+ * @param props - component properties
193
+ */
194
+ constructor(props: SegmentedButtonProps);
195
+ /**
196
+ * Reject the interaction callbacks of a grouped segment without a usable value.
197
+ *
198
+ * @param event - interaction event received by the controller
199
+ */
200
+ protected onEvent(event: Event): void;
201
+ /**
202
+ * Apply local properties to component state and styling.
203
+ *
204
+ * @see {@link ../dom/client#DomController.applyComponentProps}
205
+ */
206
+ protected applyComponentProps(): void;
207
+ /**
208
+ * Handle function element replacement before the controller reference is updated.
209
+ *
210
+ * The function-element getter still exposes the previous element during this hook.
211
+ *
212
+ * @param curr - new function element, or `null` when absent
213
+ * @see {@link ../dom/client#DomController.onFunctionElementChanged}
214
+ */
215
+ protected onFunctionElementChanged(curr: FunctionElement<SegmentedButtonProps> | null): void;
216
+ /**
217
+ * Render the component's element tree.
218
+ *
219
+ * The icon and label slots insert their properties reactively; `children` is the label while
220
+ * no `label` is supplied. Attributes are applied by {@link
221
+ * SegmentedButtonController.applyComponentProps}.
222
+ *
223
+ * @param children - label content, possibly an accessor
224
+ * @param funcRef - callback receiving the button
225
+ * @returns rendered button element
226
+ * @see {@link ../dom/client#DomController.render}
227
+ */
228
+ protected render(children: JSX.Element, funcRef?: (elem: HTMLButtonElement) => void): JSX.Element;
229
+ }
230
+ /**
231
+ * Material 3 segmented button.
232
+ *
233
+ * Segmented buttons help people select options, switch views, or sort elements. Put segments in
234
+ * a {@link SegmentedButtonGroup}, or the {@link SingleChoiceSegmentedButtonRow} and {@link
235
+ * MultiChoiceSegmentedButtonRow} conveniences, for coordinated selection, roving arrow-key focus,
236
+ * and the shared outline. A standalone segment is a toggle button exposing its selected state
237
+ * through `aria-pressed`.
238
+ *
239
+ * # Design
240
+ *
241
+ * Design is controlled through the [`cw-SegmentedButton`](./segmented.yaml) component design
242
+ * attribute. The button receives `cw-SegmentedButton-selected` while selected,
243
+ * `cw-SegmentedButton-disabled` while disabled, and `cw-SegmentedButton-<state>` for interaction
244
+ * states. Within a group it also receives `cw-SegmentedButton-grouped`,
245
+ * `cw-SegmentedButton-vertical` in a vertical group, `cw-SegmentedButton-first`,
246
+ * `cw-SegmentedButton-last`, or `cw-SegmentedButton-only` by position, and
247
+ * `cw-SegmentedButton-invalid` without a usable value. A selected segment shows a
248
+ * checkmark, which fades in with the default effects spring and scales in with the fast spatial
249
+ * spring, while an unselected segment without an icon centers its label, as in Compose.
250
+ *
251
+ * @param props - component properties
252
+ * @returns rendered button element
253
+ */
254
+ export declare const SegmentedButton: InteractableComponent<SegmentedButtonProps>;
255
+ /**
256
+ * Client controller of a {@link SegmentedButtonGroup}.
257
+ *
258
+ * The controller applies the group semantics and moves focus with the arrow, `Home`, and `End`
259
+ * keys. Focus changes schedule a layout, so the focused segment becomes the tab stop. Child list
260
+ * changes within the group also schedule a layout, as keyed renderers move retained segments
261
+ * without registering them again, which would leave positions and value ownership stale.
262
+ */
263
+ export declare class SegmentedButtonGroupController extends DomController<SegmentedButtonGroupProps> {
264
+ #private;
265
+ /**
266
+ * Construct a new `SegmentedButtonGroupController`.
267
+ *
268
+ * @param props - component properties
269
+ */
270
+ constructor(props: SegmentedButtonGroupProps);
271
+ /**
272
+ * Apply local properties to component state and styling.
273
+ *
274
+ * @see {@link ../dom/client#DomController.applyComponentProps}
275
+ */
276
+ protected applyComponentProps(): void;
277
+ /**
278
+ * Handle style element replacement before the controller reference is updated.
279
+ *
280
+ * The style-element getter still exposes the previous element during this hook.
281
+ *
282
+ * @param curr - new style element, or `null` when absent
283
+ * @see {@link ../dom/client#DomController.onStyleElementChanged}
284
+ */
285
+ protected onStyleElementChanged(curr: StyleElement | null): void;
286
+ /**
287
+ * Render the component's element tree.
288
+ *
289
+ * @param children - segments, possibly an accessor
290
+ * @returns rendered group element
291
+ * @see {@link ../dom/client#DomController.render}
292
+ */
293
+ protected render(children: JSX.Element): JSX.Element;
294
+ }
295
+ /**
296
+ * Material 3 segmented button group, coordinating the selection of its segments.
297
+ *
298
+ * A single-choice group (the default) is a `radiogroup` whose segments are `radio`s; selection
299
+ * follows the arrow keys. A multiple-choice group, enabled with {@link
300
+ * SegmentedButtonGroupProps.multiple | `multiple`}, is a `group` of toggle buttons. The group is
301
+ * controlled when {@link SegmentedButtonGroupProps.value | `value`} is present. Exactly one
302
+ * enabled segment is in the tab order: the focused segment, otherwise a segment with a
303
+ * non-negative `tabIndex`, otherwise the first selected segment, otherwise the first segment.
304
+ * Segments may be nested in other elements; a segment belongs to its nearest group.
305
+ *
306
+ * # Design
307
+ *
308
+ * Design is controlled through the [`cw-SegmentedButtonGroup`](./segmented-group.yaml) component
309
+ * design attribute. The segments of a row share one width, and overlap by their outline width,
310
+ * as in Compose.
311
+ *
312
+ * @param props - component properties
313
+ * @returns rendered group element
314
+ */
315
+ export declare const SegmentedButtonGroup: DomComponent<SegmentedButtonGroupProps>;
316
+ /**
317
+ * Material 3 single-choice segmented button row.
318
+ *
319
+ * This is a {@link SegmentedButtonGroup} with `multiple` set to `false`.
320
+ *
321
+ * @param props - component properties
322
+ * @returns rendered group element
323
+ */
324
+ export declare const SingleChoiceSegmentedButtonRow: DomComponent<SegmentedButtonGroupProps>;
325
+ /**
326
+ * Material 3 multiple-choice segmented button row.
327
+ *
328
+ * This is a {@link SegmentedButtonGroup} with `multiple` set to `true`.
329
+ *
330
+ * @param props - component properties
331
+ * @returns rendered group element
332
+ */
333
+ export declare const MultiChoiceSegmentedButtonRow: DomComponent<SegmentedButtonGroupProps>;
@@ -0,0 +1,3 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+
3
+ export {};
@@ -0,0 +1,165 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { DomProps, FunctionElement } from "..";
3
+ import type { InteractableComponent } from "../state";
4
+ import type { SelectionChangeHandler } from "./base";
5
+ import { InteractableController } from "../state/controller";
6
+ import "./selection.css";
7
+ /**
8
+ * {@link Switch} component properties.
9
+ */
10
+ export type SwitchProps = DomProps<HTMLInputElement, Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "checked" | "defaultChecked" | "disabled" | "name" | "required" | "tabIndex" | "type" | "value">> & {
11
+ /**
12
+ * Switch is on.
13
+ *
14
+ * The switch is controlled when this property is present, even when its value is
15
+ * `undefined`. A controlled switch reports user changes through {@link SwitchProps.onChange |
16
+ * `onChange`} and displays the requested state only after the parent updates this property.
17
+ * Omit the property for an uncontrolled switch.
18
+ */
19
+ checked?: boolean | undefined;
20
+ /**
21
+ * Initial state of an uncontrolled switch.
22
+ *
23
+ * This is also the state restored when the switch's form is reset.
24
+ *
25
+ * @defaultValue `false`
26
+ * @remarks
27
+ * This is read once.
28
+ */
29
+ defaultChecked?: boolean | undefined;
30
+ /**
31
+ * Switch is disabled.
32
+ *
33
+ * A disabled switch cannot be toggled or focused and does not submit a value.
34
+ *
35
+ * @defaultValue `false`
36
+ */
37
+ disabled?: boolean | undefined;
38
+ /**
39
+ * Name under which the switch submits its value.
40
+ */
41
+ name?: string | undefined;
42
+ /**
43
+ * Value submitted while the switch is on.
44
+ *
45
+ * @defaultValue `"on"`
46
+ */
47
+ value?: string | undefined;
48
+ /**
49
+ * Switch must be on for its form to be submitted.
50
+ *
51
+ * @defaultValue `false`
52
+ */
53
+ required?: boolean | undefined;
54
+ /**
55
+ * Sequential focus index of the native control.
56
+ */
57
+ tabIndex?: number | undefined;
58
+ /**
59
+ * Handle a change of the state requested by the user.
60
+ *
61
+ * Runs for controlled and uncontrolled switches, with the requested state. A controlled switch
62
+ * accepts the request only when the parent updates {@link SwitchProps.checked | `checked`}.
63
+ * Distinct `onChange` and `onCheckedChange` callbacks run in that order; one function supplied
64
+ * to both runs once.
65
+ *
66
+ * @see {@link ./base#SelectionChangeHandler}
67
+ */
68
+ onChange?: SelectionChangeHandler | undefined;
69
+ /**
70
+ * Alias of {@link SwitchProps.onChange | `onChange`}, matching Compose's naming.
71
+ */
72
+ onCheckedChange?: SelectionChangeHandler | undefined;
73
+ /**
74
+ * Icon displayed in the handle while the switch is on.
75
+ *
76
+ * Icons are sized by the `cw-Switch-icon-size` role and are hidden from assistive technology.
77
+ */
78
+ selectedIcon?: JSX.Element;
79
+ /**
80
+ * Icon displayed in the handle while the switch is off.
81
+ *
82
+ * When supplied, the unselected handle uses the selected handle size, as in Material 3.
83
+ */
84
+ unselectedIcon?: JSX.Element;
85
+ };
86
+ /**
87
+ * Client controller of a {@link Switch}.
88
+ *
89
+ * The native checkbox owns the state of an uncontrolled switch. For a controlled switch, the
90
+ * controller restores the native state after each user change and form reset until the parent
91
+ * updates {@link SwitchProps.checked | `checked`}.
92
+ */
93
+ export declare class SwitchController extends InteractableController<SwitchProps> {
94
+ #private;
95
+ /**
96
+ * Construct a new `SwitchController`.
97
+ *
98
+ * @param props - component properties
99
+ */
100
+ constructor(props: SwitchProps);
101
+ /**
102
+ * Apply local properties to component state and styling.
103
+ *
104
+ * @see {@link ../dom/client#DomController.applyComponentProps}
105
+ */
106
+ protected applyComponentProps(): void;
107
+ /**
108
+ * Handle function element replacement before the controller reference is updated.
109
+ *
110
+ * The function-element getter still exposes the previous element during this hook.
111
+ *
112
+ * @param curr - new function element, or `null` when absent
113
+ * @see {@link ../dom/client#DomController.onFunctionElementChanged}
114
+ */
115
+ protected onFunctionElementChanged(curr: FunctionElement<SwitchProps> | null): void;
116
+ /**
117
+ * Render the component's element tree.
118
+ *
119
+ * The icon slots insert their properties reactively.
120
+ *
121
+ * @param children - label content, possibly an accessor
122
+ * @param funcRef - callback receiving the native switch
123
+ * @returns rendered label element
124
+ * @see {@link ../dom/client#DomController.render}
125
+ */
126
+ protected render(children: JSX.Element, funcRef?: (elem: HTMLInputElement) => void): JSX.Element;
127
+ }
128
+ /**
129
+ * Material 3 switch backed by a form-associated native checkbox with `role="switch"`.
130
+ *
131
+ * Switches toggle the state of a single item on or off. The switch is controlled when {@link
132
+ * SwitchProps.checked | `checked`} is present; otherwise the native checkbox owns the state,
133
+ * starting from {@link SwitchProps.defaultChecked | `defaultChecked`}. The native checkbox
134
+ * exposes the state to assistive technology. Children form the label; a switch without children
135
+ * needs `attr:aria-label`.
136
+ *
137
+ * # States
138
+ *
139
+ * The switch enters the focus, hover, and press interaction states while enabled. A pointer or
140
+ * keyboard activation anywhere on the label toggles the native checkbox, which covers the whole
141
+ * component; interactive label content remains clickable.
142
+ *
143
+ * # Design
144
+ *
145
+ * Design is controlled through the [`cw-Switch`](./switch.yaml) component design attribute. The
146
+ * style element receives `cw-Switch-checked` while on, `cw-Switch-disabled` while disabled, and
147
+ * `cw-Switch-<state>` for interaction states. The handle moves and resizes with the fast spatial
148
+ * spring and snaps to the pressed size, as in Compose; the 40px state layer travels with the
149
+ * handle, and the focus ring surrounds the track.
150
+ *
151
+ * # Elements
152
+ *
153
+ * | Element | Description |
154
+ * | --- | --- |
155
+ * | `label.cw-Switch` | Style element and label. |
156
+ * | `input.cw-Switch-input` | Function element; a native checkbox covering the label. |
157
+ * | `.cw-Switch-track` | Track. |
158
+ * | `.cw-Switch-thumb` | Handle. |
159
+ * | `.cw-Switch-selectedIcon` | Handle icon slot shown while on. |
160
+ * | `.cw-Switch-unselectedIcon` | Handle icon slot shown while off. |
161
+ *
162
+ * @param props - component properties
163
+ * @returns rendered label element
164
+ */
165
+ export declare const Switch: InteractableComponent<SwitchProps>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Rounding of a polygon corner.
3
+ *
4
+ * A rounded corner replaces its vertex with a circular arc of {@link CornerRounding.radius |
5
+ * `radius`}, tangent to both edges. {@link CornerRounding.smoothing | Smoothing} extends the
6
+ * rounding further along the edges, with curves blending into the arc. If an edge is too short
7
+ * for the rounding of both of its corners, then the smoothing, and if need be the radius, of both
8
+ * corners is reduced along that edge.
9
+ */
10
+ export declare class CornerRounding {
11
+ /**
12
+ * Rounding of a sharp corner.
13
+ */
14
+ static readonly Unrounded: CornerRounding;
15
+ /**
16
+ * Radius of the circular arc.
17
+ *
18
+ * This is in the coordinate space of the polygon.
19
+ */
20
+ readonly radius: number;
21
+ /**
22
+ * Smoothing of the corner, within `[0, 1]`.
23
+ *
24
+ * This is `0` for a circular arc, and `1` if no arc remains between the blending curves.
25
+ */
26
+ readonly smoothing: number;
27
+ /**
28
+ * Construct a new corner rounding.
29
+ *
30
+ * @param radius - finite, non-negative radius, or `undefined` for a sharp corner
31
+ * @param smoothing - smoothing within `[0, 1]`, or `undefined` for no smoothing
32
+ * @throws {@link Error} `radius` is negative or not finite, or `smoothing` is outside
33
+ * `[0, 1]`
34
+ */
35
+ constructor(radius?: number, smoothing?: number);
36
+ }