@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.
- package/LICENSE +163 -0
- package/README.md +82 -2
- package/package.json +112 -3
- package/src/action/action.yaml +291 -0
- package/src/action/button-group.yaml +56 -0
- package/src/action/button.yaml +239 -0
- package/src/action/split-button.yaml +87 -0
- package/src/color/color.yaml +181 -0
- package/src/color/palette.yaml +147 -0
- package/src/container/card.yaml +170 -0
- package/src/container/corner-radius.yaml +50 -0
- package/src/container/elevation.yaml +19 -0
- package/src/design.yaml +41 -0
- package/src/feedback/feedback.yaml +225 -0
- package/src/icon/icon-font.yaml +28 -0
- package/src/icon/icon.yaml +31 -0
- package/src/input/date-picker.yaml +144 -0
- package/src/input/date-range-input.yaml +162 -0
- package/src/input/range-slider.yaml +161 -0
- package/src/input/select.yaml +230 -0
- package/src/input/slider.yaml +172 -0
- package/src/input/text-field.yaml +240 -0
- package/src/input/time-picker.yaml +220 -0
- package/src/motion/motion.yaml +371 -0
- package/src/navigation/app-bar.yaml +147 -0
- package/src/navigation/navigation.yaml +339 -0
- package/src/navigation/scroll.yaml +23 -0
- package/src/navigation/search.yaml +112 -0
- package/src/navigation/tabs.yaml +144 -0
- package/src/navigation/toolbar.yaml +130 -0
- package/src/selection/checkbox.yaml +162 -0
- package/src/selection/chip.yaml +219 -0
- package/src/selection/radio.yaml +125 -0
- package/src/selection/segmented-group.yaml +11 -0
- package/src/selection/segmented.yaml +69 -0
- package/src/selection/switch.yaml +209 -0
- package/src/spacing/measurement.yaml +80 -0
- package/src/state/state.yaml +38 -0
- package/src/surface/surface.yaml +483 -0
- package/src/text/line-height.yaml +144 -0
- package/src/text/typeface.yaml +31 -0
- package/src/text/typescale.yaml +726 -0
- package/target/esbuild/action/action.css +1 -0
- package/target/esbuild/action/base.jsx +1 -0
- package/target/esbuild/action/button.jsx +17 -0
- package/target/esbuild/action/fab-menu-context.jsx +1 -0
- package/target/esbuild/action/fab-menu.jsx +15 -0
- package/target/esbuild/action/fab.jsx +7 -0
- package/target/esbuild/action/group.jsx +22 -0
- package/target/esbuild/action/icon-button.jsx +5 -0
- package/target/esbuild/action/index.jsx +1 -0
- package/target/esbuild/action/split-button.jsx +12 -0
- package/target/esbuild/color/contrast.jsx +1 -0
- package/target/esbuild/color/dynamic.jsx +1 -0
- package/target/esbuild/color/hct.jsx +1 -0
- package/target/esbuild/color/index.css +1 -0
- package/target/esbuild/color/index.jsx +1 -0
- package/target/esbuild/color/palette.jsx +1 -0
- package/target/esbuild/color/scheme.jsx +1 -0
- package/target/esbuild/color/temperature.jsx +1 -0
- package/target/esbuild/container/card.css +1 -0
- package/target/esbuild/container/card.jsx +1 -0
- package/target/esbuild/container/elevation-shadow.css +1 -0
- package/target/esbuild/container/elevation-shadow.jsx +1 -0
- package/target/esbuild/container/index.jsx +1 -0
- package/target/esbuild/dom/client.jsx +1 -0
- package/target/esbuild/dom/index.jsx +1 -0
- package/target/esbuild/dom/server.jsx +1 -0
- package/target/esbuild/dom/types.jsx +1 -0
- package/target/esbuild/feedback/badge.jsx +15 -0
- package/target/esbuild/feedback/feedback.css +1 -0
- package/target/esbuild/feedback/focus.jsx +1 -0
- package/target/esbuild/feedback/index.jsx +1 -0
- package/target/esbuild/feedback/loading.jsx +7 -0
- package/target/esbuild/feedback/observe.jsx +1 -0
- package/target/esbuild/feedback/progress.jsx +35 -0
- package/target/esbuild/feedback/snackbar.jsx +23 -0
- package/target/esbuild/feedback/tooltip.jsx +24 -0
- package/target/esbuild/icon/icon.css +1 -0
- package/target/esbuild/icon/icon.jsx +1 -0
- package/target/esbuild/icon/index.jsx +1 -0
- package/target/esbuild/index.css +1 -0
- package/target/esbuild/index.jsx +1 -0
- package/target/esbuild/input/autocomplete.jsx +5 -0
- package/target/esbuild/input/base.jsx +4 -0
- package/target/esbuild/input/date-picker.css +1 -0
- package/target/esbuild/input/date-picker.jsx +104 -0
- package/target/esbuild/input/date-range-input.css +1 -0
- package/target/esbuild/input/date-time.jsx +21 -0
- package/target/esbuild/input/index.css +1 -0
- package/target/esbuild/input/index.jsx +1 -0
- package/target/esbuild/input/paired-input.jsx +1 -0
- package/target/esbuild/input/picker-dialog.css +1 -0
- package/target/esbuild/input/picker-dialog.jsx +14 -0
- package/target/esbuild/input/select.css +1 -0
- package/target/esbuild/input/select.jsx +63 -0
- package/target/esbuild/input/slider.css +1 -0
- package/target/esbuild/input/slider.jsx +51 -0
- package/target/esbuild/input/text-field.css +1 -0
- package/target/esbuild/input/text-field.jsx +67 -0
- package/target/esbuild/input/time-picker.css +1 -0
- package/target/esbuild/input/time-picker.jsx +29 -0
- package/target/esbuild/motion/frame.jsx +1 -0
- package/target/esbuild/motion/index.css +1 -0
- package/target/esbuild/motion/index.jsx +1 -0
- package/target/esbuild/motion/material.jsx +1 -0
- package/target/esbuild/motion/motion.jsx +1 -0
- package/target/esbuild/motion/spring.jsx +1 -0
- package/target/esbuild/motion/transition.css +1 -0
- package/target/esbuild/motion/transition.jsx +1 -0
- package/target/esbuild/motion/velocity.jsx +1 -0
- package/target/esbuild/navigation/app-bar.jsx +51 -0
- package/target/esbuild/navigation/base.jsx +1 -0
- package/target/esbuild/navigation/drawer.jsx +25 -0
- package/target/esbuild/navigation/index.jsx +1 -0
- package/target/esbuild/navigation/navigation.css +1 -0
- package/target/esbuild/navigation/navigation.jsx +29 -0
- package/target/esbuild/navigation/scroll.jsx +1 -0
- package/target/esbuild/navigation/search.jsx +29 -0
- package/target/esbuild/navigation/tabs.jsx +7 -0
- package/target/esbuild/navigation/toolbar.jsx +23 -0
- package/target/esbuild/selection/base.jsx +1 -0
- package/target/esbuild/selection/checkbox.jsx +14 -0
- package/target/esbuild/selection/chip.jsx +23 -0
- package/target/esbuild/selection/index.jsx +1 -0
- package/target/esbuild/selection/radio.jsx +9 -0
- package/target/esbuild/selection/segmented.jsx +15 -0
- package/target/esbuild/selection/selection.css +1 -0
- package/target/esbuild/selection/switch.jsx +14 -0
- package/target/esbuild/shape/corner-rounding.jsx +1 -0
- package/target/esbuild/shape/cubic.jsx +1 -0
- package/target/esbuild/shape/index.jsx +1 -0
- package/target/esbuild/shape/material-shapes.jsx +1 -0
- package/target/esbuild/shape/morph.jsx +1 -0
- package/target/esbuild/shape/path.jsx +1 -0
- package/target/esbuild/shape/point.jsx +1 -0
- package/target/esbuild/shape/rounded-polygon.jsx +1 -0
- package/target/esbuild/shape/shapes.jsx +1 -0
- package/target/esbuild/spacing/index.jsx +1 -0
- package/target/esbuild/state/component.css +1 -0
- package/target/esbuild/state/component.jsx +1 -0
- package/target/esbuild/state/controller.jsx +1 -0
- package/target/esbuild/state/index.jsx +1 -0
- package/target/esbuild/state/ripple.jsx +1 -0
- package/target/esbuild/state/state.jsx +1 -0
- package/target/esbuild/state/style.jsx +1 -0
- package/target/esbuild/surface/carousel-layout.jsx +1 -0
- package/target/esbuild/surface/carousel.css +1 -0
- package/target/esbuild/surface/carousel.jsx +10 -0
- package/target/esbuild/surface/dialog.jsx +35 -0
- package/target/esbuild/surface/divider.jsx +1 -0
- package/target/esbuild/surface/drag.jsx +1 -0
- package/target/esbuild/surface/gestures.css +1 -0
- package/target/esbuild/surface/gestures.jsx +7 -0
- package/target/esbuild/surface/index.css +1 -0
- package/target/esbuild/surface/index.jsx +1 -0
- package/target/esbuild/surface/interactive.jsx +1 -0
- package/target/esbuild/surface/list-patterns.jsx +26 -0
- package/target/esbuild/surface/list.css +1 -0
- package/target/esbuild/surface/list.jsx +9 -0
- package/target/esbuild/surface/menu.css +1 -0
- package/target/esbuild/surface/menu.jsx +12 -0
- package/target/esbuild/surface/scaffold.jsx +47 -0
- package/target/esbuild/surface/sheet.jsx +21 -0
- package/target/esbuild/surface/side-sheet.jsx +17 -0
- package/target/esbuild/surface/slots.jsx +1 -0
- package/target/esbuild/surface/surface.css +1 -0
- package/target/esbuild/surface/surface.jsx +1 -0
- package/target/esbuild/text/index.css +1 -0
- package/target/esbuild/text/index.jsx +1 -0
- package/target/esbuild/text/text.css +1 -0
- package/target/esbuild/text/text.jsx +3 -0
- package/target/esbuild/text/typography.css +1 -0
- package/target/esbuild/text/typography.jsx +1 -0
- package/target/esbuild/util/box-side.jsx +1 -0
- package/target/esbuild/util/debug.jsx +1 -0
- package/target/esbuild/util/dom.jsx +1 -0
- package/target/esbuild/util/event.jsx +1 -0
- package/target/esbuild/util/index.jsx +1 -0
- package/target/esbuild/util/preconditions.jsx +1 -0
- package/target/esbuild/util/reactive.jsx +1 -0
- package/target/tsc/action/action.css.d.ts +3 -0
- package/target/tsc/action/base.d.ts +211 -0
- package/target/tsc/action/button.d.ts +126 -0
- package/target/tsc/action/fab-menu-context.d.ts +16 -0
- package/target/tsc/action/fab-menu.d.ts +112 -0
- package/target/tsc/action/fab.d.ts +98 -0
- package/target/tsc/action/group.d.ts +166 -0
- package/target/tsc/action/icon-button.d.ts +79 -0
- package/target/tsc/action/index.d.ts +24 -0
- package/target/tsc/action/split-button.d.ts +78 -0
- package/target/tsc/color/contrast.d.ts +48 -0
- package/target/tsc/color/dynamic.d.ts +203 -0
- package/target/tsc/color/hct.d.ts +114 -0
- package/target/tsc/color/index.css.d.ts +3 -0
- package/target/tsc/color/index.d.ts +23 -0
- package/target/tsc/color/palette.d.ts +30 -0
- package/target/tsc/color/scheme.d.ts +446 -0
- package/target/tsc/color/temperature.d.ts +24 -0
- package/target/tsc/container/card.css.d.ts +3 -0
- package/target/tsc/container/card.d.ts +110 -0
- package/target/tsc/container/elevation-shadow.css.d.ts +3 -0
- package/target/tsc/container/elevation-shadow.d.ts +23 -0
- package/target/tsc/container/index.d.ts +44 -0
- package/target/tsc/dom/client.d.ts +387 -0
- package/target/tsc/dom/index.d.ts +93 -0
- package/target/tsc/dom/server.d.ts +65 -0
- package/target/tsc/dom/types.d.ts +134 -0
- package/target/tsc/feedback/badge.d.ts +116 -0
- package/target/tsc/feedback/feedback.css.d.ts +3 -0
- package/target/tsc/feedback/focus.d.ts +20 -0
- package/target/tsc/feedback/index.d.ts +17 -0
- package/target/tsc/feedback/loading.d.ts +194 -0
- package/target/tsc/feedback/observe.d.ts +75 -0
- package/target/tsc/feedback/progress.d.ts +281 -0
- package/target/tsc/feedback/snackbar.d.ts +398 -0
- package/target/tsc/feedback/tooltip.d.ts +326 -0
- package/target/tsc/icon/icon.css.d.ts +3 -0
- package/target/tsc/icon/icon.d.ts +69 -0
- package/target/tsc/icon/index.d.ts +13 -0
- package/target/tsc/index.css.d.ts +3 -0
- package/target/tsc/index.d.ts +7 -0
- package/target/tsc/input/autocomplete.d.ts +119 -0
- package/target/tsc/input/base.d.ts +282 -0
- package/target/tsc/input/date-picker.css.d.ts +3 -0
- package/target/tsc/input/date-picker.d.ts +351 -0
- package/target/tsc/input/date-range-input.css.d.ts +3 -0
- package/target/tsc/input/date-time.d.ts +171 -0
- package/target/tsc/input/index.css.d.ts +3 -0
- package/target/tsc/input/index.d.ts +27 -0
- package/target/tsc/input/paired-input.d.ts +435 -0
- package/target/tsc/input/picker-dialog.css.d.ts +3 -0
- package/target/tsc/input/picker-dialog.d.ts +84 -0
- package/target/tsc/input/select.css.d.ts +3 -0
- package/target/tsc/input/select.d.ts +267 -0
- package/target/tsc/input/slider.css.d.ts +3 -0
- package/target/tsc/input/slider.d.ts +372 -0
- package/target/tsc/input/text-field.css.d.ts +3 -0
- package/target/tsc/input/text-field.d.ts +415 -0
- package/target/tsc/input/time-picker.css.d.ts +3 -0
- package/target/tsc/input/time-picker.d.ts +212 -0
- package/target/tsc/motion/frame.d.ts +36 -0
- package/target/tsc/motion/index.css.d.ts +3 -0
- package/target/tsc/motion/index.d.ts +34 -0
- package/target/tsc/motion/material.d.ts +110 -0
- package/target/tsc/motion/motion.d.ts +235 -0
- package/target/tsc/motion/spring.d.ts +223 -0
- package/target/tsc/motion/transition.css.d.ts +3 -0
- package/target/tsc/motion/transition.d.ts +597 -0
- package/target/tsc/motion/velocity.d.ts +54 -0
- package/target/tsc/navigation/app-bar.d.ts +473 -0
- package/target/tsc/navigation/base.d.ts +331 -0
- package/target/tsc/navigation/drawer.d.ts +301 -0
- package/target/tsc/navigation/index.d.ts +25 -0
- package/target/tsc/navigation/navigation.css.d.ts +3 -0
- package/target/tsc/navigation/navigation.d.ts +537 -0
- package/target/tsc/navigation/scroll.d.ts +218 -0
- package/target/tsc/navigation/search.d.ts +332 -0
- package/target/tsc/navigation/tabs.d.ts +497 -0
- package/target/tsc/navigation/toolbar.d.ts +248 -0
- package/target/tsc/selection/base.d.ts +100 -0
- package/target/tsc/selection/checkbox.d.ts +194 -0
- package/target/tsc/selection/chip.d.ts +358 -0
- package/target/tsc/selection/index.d.ts +21 -0
- package/target/tsc/selection/radio.d.ts +198 -0
- package/target/tsc/selection/segmented.d.ts +333 -0
- package/target/tsc/selection/selection.css.d.ts +3 -0
- package/target/tsc/selection/switch.d.ts +165 -0
- package/target/tsc/shape/corner-rounding.d.ts +36 -0
- package/target/tsc/shape/cubic.d.ts +215 -0
- package/target/tsc/shape/index.d.ts +35 -0
- package/target/tsc/shape/material-shapes.d.ts +176 -0
- package/target/tsc/shape/morph.d.ts +91 -0
- package/target/tsc/shape/path.d.ts +177 -0
- package/target/tsc/shape/point.d.ts +165 -0
- package/target/tsc/shape/rounded-polygon.d.ts +289 -0
- package/target/tsc/shape/shapes.d.ts +76 -0
- package/target/tsc/spacing/index.d.ts +19 -0
- package/target/tsc/state/component.css.d.ts +3 -0
- package/target/tsc/state/component.d.ts +276 -0
- package/target/tsc/state/controller.d.ts +257 -0
- package/target/tsc/state/index.d.ts +19 -0
- package/target/tsc/state/ripple.d.ts +50 -0
- package/target/tsc/state/state.d.ts +129 -0
- package/target/tsc/state/style.d.ts +22 -0
- package/target/tsc/surface/carousel-layout.d.ts +212 -0
- package/target/tsc/surface/carousel.css.d.ts +3 -0
- package/target/tsc/surface/carousel.d.ts +231 -0
- package/target/tsc/surface/dialog.d.ts +582 -0
- package/target/tsc/surface/divider.d.ts +92 -0
- package/target/tsc/surface/drag.d.ts +92 -0
- package/target/tsc/surface/gestures.css.d.ts +3 -0
- package/target/tsc/surface/gestures.d.ts +292 -0
- package/target/tsc/surface/index.css.d.ts +3 -0
- package/target/tsc/surface/index.d.ts +29 -0
- package/target/tsc/surface/interactive.d.ts +22 -0
- package/target/tsc/surface/list-patterns.d.ts +384 -0
- package/target/tsc/surface/list.css.d.ts +3 -0
- package/target/tsc/surface/list.d.ts +340 -0
- package/target/tsc/surface/menu.css.d.ts +3 -0
- package/target/tsc/surface/menu.d.ts +590 -0
- package/target/tsc/surface/scaffold.d.ts +337 -0
- package/target/tsc/surface/sheet.d.ts +384 -0
- package/target/tsc/surface/side-sheet.d.ts +183 -0
- package/target/tsc/surface/slots.d.ts +21 -0
- package/target/tsc/surface/surface.css.d.ts +3 -0
- package/target/tsc/surface/surface.d.ts +192 -0
- package/target/tsc/text/index.css.d.ts +3 -0
- package/target/tsc/text/index.d.ts +18 -0
- package/target/tsc/text/text.css.d.ts +3 -0
- package/target/tsc/text/text.d.ts +94 -0
- package/target/tsc/text/typography.css.d.ts +3 -0
- package/target/tsc/text/typography.d.ts +82 -0
- package/target/tsc/util/box-side.d.ts +76 -0
- package/target/tsc/util/debug.d.ts +20 -0
- package/target/tsc/util/dom.d.ts +35 -0
- package/target/tsc/util/event.d.ts +93 -0
- package/target/tsc/util/index.d.ts +12 -0
- package/target/tsc/util/preconditions.d.ts +79 -0
- package/target/tsc/util/reactive.d.ts +36 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps, StyleElement } from "..";
|
|
3
|
+
import type { InteractableComponent, InteractableProps } from "../state";
|
|
4
|
+
import { DomController } from "../dom/client";
|
|
5
|
+
import { InteractableController } from "../state/controller";
|
|
6
|
+
import "./surface.css";
|
|
7
|
+
import "./list.css";
|
|
8
|
+
/**
|
|
9
|
+
* List selection behavior.
|
|
10
|
+
*
|
|
11
|
+
* | Mode | Semantics |
|
|
12
|
+
* | ---------- | ------------------------------------------------------ |
|
|
13
|
+
* | `none` | Ordinary list of list items. |
|
|
14
|
+
* | `single` | Listbox of options, at most one of which is selected. |
|
|
15
|
+
* | `multiple` | Multi-selectable listbox of options. |
|
|
16
|
+
*/
|
|
17
|
+
export type ListSelectionMode = "none" | "single" | "multiple";
|
|
18
|
+
/**
|
|
19
|
+
* Preset of the leading content of a list item.
|
|
20
|
+
*
|
|
21
|
+
* | Type | Leading content |
|
|
22
|
+
* | -------- | ---------------------------------------------------------------------------- |
|
|
23
|
+
* | `icon` | Icon, 24 pixels, or 20 pixels in standard and segmented lists. |
|
|
24
|
+
* | `avatar` | 40-pixel circular avatar on the primary container color. |
|
|
25
|
+
* | `image` | 56-pixel square image, with small corners in standard and segmented lists. |
|
|
26
|
+
* | `video` | Video thumbnail, 100 by 56 pixels, or 114 by 64 pixels in three-line items. |
|
|
27
|
+
*
|
|
28
|
+
* Images and video thumbnails are cropped to cover their box.
|
|
29
|
+
*
|
|
30
|
+
* @see `ListTokens.kt` `ItemLeading*` tokens
|
|
31
|
+
*/
|
|
32
|
+
export type ListItemLeadingType = "icon" | "avatar" | "image" | "video";
|
|
33
|
+
/**
|
|
34
|
+
* Properties accepted by {@link List}.
|
|
35
|
+
*/
|
|
36
|
+
export type ListProps = DomProps<HTMLUListElement, Omit<JSX.HTMLAttributes<HTMLUListElement>, "role" | "aria-multiselectable">> & {
|
|
37
|
+
/**
|
|
38
|
+
* List style, independent of {@link ListProps.selectionMode | selection behavior}.
|
|
39
|
+
*
|
|
40
|
+
* | Variant | Style |
|
|
41
|
+
* | ----------- | ------------------------------------------------------------------ |
|
|
42
|
+
* | `baseline` | Material 3 list of square items. |
|
|
43
|
+
* | `standard` | Material 3 Expressive list, whose rounded items morph their shape. |
|
|
44
|
+
* | `segmented` | Material 3 Expressive list of separate, connected item containers. |
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `"baseline"`
|
|
47
|
+
*/
|
|
48
|
+
variant?: "baseline" | "standard" | "segmented" | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Selection behavior.
|
|
51
|
+
*
|
|
52
|
+
* A selecting list is a listbox: its items are options, which an option's activation selects.
|
|
53
|
+
* Options without a {@link ListItemBaseProps.value | value} are disabled.
|
|
54
|
+
*
|
|
55
|
+
* @defaultValue `"none"`
|
|
56
|
+
*/
|
|
57
|
+
selectionMode?: ListSelectionMode | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Controlled selected value of a single-selection list.
|
|
60
|
+
*/
|
|
61
|
+
selectedValue?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Controlled selected values of a multiple-selection list.
|
|
64
|
+
*/
|
|
65
|
+
selectedValues?: readonly string[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Initial selected value of an uncontrolled single-selection list.
|
|
68
|
+
*
|
|
69
|
+
* When omitted, the first item which is {@link ListItemBaseProps.selected | selected} or
|
|
70
|
+
* {@link ListItemBaseProps.defaultSelected | selected by default} is selected.
|
|
71
|
+
*/
|
|
72
|
+
defaultSelectedValue?: string | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Notify the consumer of an option's selection, or request it when controlled.
|
|
75
|
+
*
|
|
76
|
+
* @param value - value of the option
|
|
77
|
+
* @param selected - new or requested selected state of the option
|
|
78
|
+
* @param event - activating event
|
|
79
|
+
*/
|
|
80
|
+
onSelectionChange?: ((value: string, selected: boolean, event: Event) => void) | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Alias of {@link ListProps.onSelectionChange | `onSelectionChange`}.
|
|
83
|
+
*
|
|
84
|
+
* When both are the same function, it is called once.
|
|
85
|
+
*
|
|
86
|
+
* @param value - value of the option
|
|
87
|
+
* @param selected - new or requested selected state of the option
|
|
88
|
+
* @param event - activating event
|
|
89
|
+
*/
|
|
90
|
+
onChange?: ((value: string, selected: boolean, event: Event) => void) | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Use the dense one-line item height.
|
|
93
|
+
*
|
|
94
|
+
* @defaultValue `false`
|
|
95
|
+
*/
|
|
96
|
+
dense?: boolean | undefined;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Properties accepted by {@link ListItem}.
|
|
100
|
+
*/
|
|
101
|
+
export type ListItemBaseProps = DomProps<HTMLLIElement, Omit<JSX.LiHTMLAttributes<HTMLLIElement>, "role" | "aria-disabled" | "aria-selected" | "tabindex">> & {
|
|
102
|
+
/**
|
|
103
|
+
* Value identifying the item as an option of a selecting {@link List}.
|
|
104
|
+
*/
|
|
105
|
+
value?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Overline content, above the headline.
|
|
108
|
+
*/
|
|
109
|
+
overline?: JSX.Element;
|
|
110
|
+
/**
|
|
111
|
+
* Headline content.
|
|
112
|
+
*
|
|
113
|
+
* When omitted, children are the headline.
|
|
114
|
+
*/
|
|
115
|
+
headline?: JSX.Element;
|
|
116
|
+
/**
|
|
117
|
+
* Supporting content, below the headline.
|
|
118
|
+
*/
|
|
119
|
+
supportingContent?: JSX.Element;
|
|
120
|
+
/**
|
|
121
|
+
* Alias of {@link ListItemBaseProps.supportingContent | `supportingContent`}.
|
|
122
|
+
*/
|
|
123
|
+
supportingText?: JSX.Element;
|
|
124
|
+
/**
|
|
125
|
+
* Leading content, such as an icon, avatar, image, or control.
|
|
126
|
+
*/
|
|
127
|
+
leading?: JSX.Element;
|
|
128
|
+
/**
|
|
129
|
+
* Alias of {@link ListItemBaseProps.leading | `leading`}.
|
|
130
|
+
*/
|
|
131
|
+
leadingContent?: JSX.Element;
|
|
132
|
+
/**
|
|
133
|
+
* Preset sizing and styling of the leading content.
|
|
134
|
+
*
|
|
135
|
+
* When omitted, leading content is sized by itself.
|
|
136
|
+
*/
|
|
137
|
+
leadingType?: ListItemLeadingType | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Trailing content, such as an icon, supporting text, or control.
|
|
140
|
+
*/
|
|
141
|
+
trailing?: JSX.Element;
|
|
142
|
+
/**
|
|
143
|
+
* Alias of {@link ListItemBaseProps.trailing | `trailing`}.
|
|
144
|
+
*/
|
|
145
|
+
trailingContent?: JSX.Element;
|
|
146
|
+
/**
|
|
147
|
+
* Number of text lines.
|
|
148
|
+
*
|
|
149
|
+
* When omitted, an item with an overline and supporting content has three lines, an item with
|
|
150
|
+
* either has two lines, and other items have one line. Set `3` for supporting content which
|
|
151
|
+
* wraps to two lines.
|
|
152
|
+
*/
|
|
153
|
+
lines?: 1 | 2 | 3 | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Has no effect: an enclosing selecting {@link List} makes its items options.
|
|
156
|
+
*/
|
|
157
|
+
selectable?: boolean | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Selected state, seeding the selection of an uncontrolled selecting {@link List}.
|
|
160
|
+
*
|
|
161
|
+
* The list owns the selection once it is rendered, so later changes have no effect.
|
|
162
|
+
*/
|
|
163
|
+
selected?: boolean | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Initial selected state, seeding the selection of an uncontrolled selecting {@link List}.
|
|
166
|
+
*/
|
|
167
|
+
defaultSelected?: boolean | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Disable activation and selection.
|
|
170
|
+
*
|
|
171
|
+
* A disabled option remains focusable, as the WAI-ARIA Authoring Practices recommend.
|
|
172
|
+
*
|
|
173
|
+
* @defaultValue `false`
|
|
174
|
+
*/
|
|
175
|
+
disabled?: boolean | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Sequential focus index of an item which is neither an option nor activatable.
|
|
178
|
+
*/
|
|
179
|
+
tabIndex?: number | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Handle activation of the item.
|
|
182
|
+
*
|
|
183
|
+
* An activatable item outside a listbox renders its content as a native button. Cancelling
|
|
184
|
+
* the activating event prevents selection of an option.
|
|
185
|
+
*
|
|
186
|
+
* @param event - activating click or key event
|
|
187
|
+
*/
|
|
188
|
+
onActivate?: ((event: MouseEvent | KeyboardEvent) => void) | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Notify the consumer of a selection change of the option, made by its {@link List}.
|
|
191
|
+
*
|
|
192
|
+
* @param selected - new or requested selected state
|
|
193
|
+
* @param event - activating event
|
|
194
|
+
*/
|
|
195
|
+
onSelectedChange?: ((selected: boolean, event: Event) => void) | undefined;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Properties accepted by {@link ListItem}, including interaction callbacks.
|
|
199
|
+
*/
|
|
200
|
+
export type ListItemProps = InteractableProps<ListItemBaseProps>;
|
|
201
|
+
/**
|
|
202
|
+
* Client controller of a {@link List}.
|
|
203
|
+
*
|
|
204
|
+
* The controller owns the list semantics of its rendered {@link ListItem | items}: in a selecting
|
|
205
|
+
* list, they are options, selected by activation, with one sequential focus stop roving between
|
|
206
|
+
* them as focus moves, including with the arrow, Home, and End keys. Disabled options remain
|
|
207
|
+
* focusable, but are not selectable. Items are found among the list's children, and observed for
|
|
208
|
+
* changes of their values, disabled states, and visibility, along with the visibility of the
|
|
209
|
+
* list's ancestors.
|
|
210
|
+
*
|
|
211
|
+
* Layout is read for as few items as possible: when the focus stop is chosen, or the focus stop
|
|
212
|
+
* itself changes, and when navigating with the keyboard. Items are updated only when their state
|
|
213
|
+
* changes.
|
|
214
|
+
*/
|
|
215
|
+
export declare class ListController extends DomController<ListProps> {
|
|
216
|
+
#private;
|
|
217
|
+
/**
|
|
218
|
+
* Construct a new `ListController`.
|
|
219
|
+
*
|
|
220
|
+
* @param props - component properties
|
|
221
|
+
*/
|
|
222
|
+
constructor(props: ListProps);
|
|
223
|
+
/**
|
|
224
|
+
* Apply local properties to component state and styling.
|
|
225
|
+
*
|
|
226
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
227
|
+
*/
|
|
228
|
+
protected applyComponentProps(): void;
|
|
229
|
+
/**
|
|
230
|
+
* Handle style element replacement before the controller reference is updated.
|
|
231
|
+
*
|
|
232
|
+
* The style-element getter still exposes the previous element during this hook.
|
|
233
|
+
*
|
|
234
|
+
* @param curr - new style element, or `null` when absent
|
|
235
|
+
* @see {@link ../dom/client#DomController.onStyleElementChanged}
|
|
236
|
+
*/
|
|
237
|
+
protected onStyleElementChanged(curr: StyleElement | null): void;
|
|
238
|
+
/**
|
|
239
|
+
* Render the component's element tree.
|
|
240
|
+
*
|
|
241
|
+
* @param children - nested component children, possibly an accessor
|
|
242
|
+
* @returns rendered component elements
|
|
243
|
+
* @see {@link ../dom/client#DomController.render}
|
|
244
|
+
*/
|
|
245
|
+
protected render(children: JSX.Element): JSX.Element;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* List of {@link ListItem | list items}, or listbox of options.
|
|
249
|
+
*
|
|
250
|
+
* An ordinary list contains list items, whose activation is independent of the list. A
|
|
251
|
+
* {@link ListProps.selectionMode | selecting} list is a listbox, which makes its items options:
|
|
252
|
+
* activating an option selects it, single or multiple selection is controlled or uncontrolled,
|
|
253
|
+
* and focus roves between options with the arrow, Home, and End keys.
|
|
254
|
+
*
|
|
255
|
+
* # Design
|
|
256
|
+
*
|
|
257
|
+
* Lists follow the Material 3 list tokens through the [`cw-Surface`](./surface.yaml) `listItem*`
|
|
258
|
+
* roles. {@link ListProps.variant | `props.variant`} selects the baseline, standard, or segmented
|
|
259
|
+
* style, which the `data-cw-list-variant` attribute reflects.
|
|
260
|
+
*
|
|
261
|
+
* @param props - component properties
|
|
262
|
+
* @returns rendered list
|
|
263
|
+
*/
|
|
264
|
+
export declare const List: DomComponent<ListProps>;
|
|
265
|
+
/**
|
|
266
|
+
* Client controller of a {@link ListItem}.
|
|
267
|
+
*
|
|
268
|
+
* An item is interactive while it is enabled and either an option of a listbox, which takes focus
|
|
269
|
+
* itself, or activatable, whose activation button takes focus. Interactive items enter the focus,
|
|
270
|
+
* hover, and press interaction states. Whether an item is activatable, and so renders an
|
|
271
|
+
* activation button, is decided when it is rendered.
|
|
272
|
+
*
|
|
273
|
+
* The item applies its list semantics from the state its {@link ListController | list} owns, and
|
|
274
|
+
* its own properties: role, selected and disabled state, sequential focus index, and the state of
|
|
275
|
+
* its activation button.
|
|
276
|
+
*/
|
|
277
|
+
export declare class ListItemController extends InteractableController<ListItemBaseProps> {
|
|
278
|
+
#private;
|
|
279
|
+
/**
|
|
280
|
+
* Construct a new `ListItemController`.
|
|
281
|
+
*
|
|
282
|
+
* @param props - component properties
|
|
283
|
+
*/
|
|
284
|
+
constructor(props: ListItemBaseProps);
|
|
285
|
+
/**
|
|
286
|
+
* Apply local properties to component state and styling.
|
|
287
|
+
*
|
|
288
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
289
|
+
*/
|
|
290
|
+
protected applyComponentProps(): void;
|
|
291
|
+
/**
|
|
292
|
+
* Handle style element replacement before the controller reference is updated.
|
|
293
|
+
*
|
|
294
|
+
* The style-element getter still exposes the previous element during this hook.
|
|
295
|
+
*
|
|
296
|
+
* @param curr - new style element, or `null` when absent
|
|
297
|
+
* @see {@link ../dom/client#DomController.onStyleElementChanged}
|
|
298
|
+
*/
|
|
299
|
+
protected onStyleElementChanged(curr: StyleElement | null): void;
|
|
300
|
+
/**
|
|
301
|
+
* Render the component's element tree.
|
|
302
|
+
*
|
|
303
|
+
* This renders the elements of the server rendering, with the current properties: slots are
|
|
304
|
+
* reactive, while attributes are static, and updated by the controllers. The activation button
|
|
305
|
+
* is rendered if, and only if, the item is activatable when rendered.
|
|
306
|
+
*
|
|
307
|
+
* @param children - nested component children, possibly an accessor
|
|
308
|
+
* @returns rendered component elements
|
|
309
|
+
* @see {@link ../dom/client#DomController.render}
|
|
310
|
+
*/
|
|
311
|
+
protected render(children: JSX.Element): JSX.Element;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* One-, two-, or three-line list item with leading, headline, supporting, and trailing content.
|
|
315
|
+
*
|
|
316
|
+
* Within a selecting {@link List}, the item is an option identified by its {@link
|
|
317
|
+
* ListItemBaseProps.value | value}, whose selection and focus the list coordinates. An item with
|
|
318
|
+
* an {@link ListItemBaseProps.onActivate | activation handler} renders its content as a native
|
|
319
|
+
* button outside a listbox, and is activated along with the option's selection inside one.
|
|
320
|
+
* Interactive children keep their own activation behavior.
|
|
321
|
+
*
|
|
322
|
+
* # States
|
|
323
|
+
*
|
|
324
|
+
* Enabled options and activatable items enter the focus, hover, and press interaction states,
|
|
325
|
+
* which add `cw-ListItem-<state>` classes; the press and focus states of an activatable item
|
|
326
|
+
* outside a listbox are those of its activation button. Options have the `cw-ListItem-selectable`
|
|
327
|
+
* class, and selected options the `cw-ListItem-selected` class. Disabled items have the
|
|
328
|
+
* `cw-ListItem-disabled` class and `aria-disabled="true"`.
|
|
329
|
+
*
|
|
330
|
+
* # Design
|
|
331
|
+
*
|
|
332
|
+
* Items follow the Material 3 list tokens through the [`cw-Surface`](./surface.yaml) `listItem*`
|
|
333
|
+
* roles, and the style of the enclosing list. The `data-cw-list-lines` attribute reflects the
|
|
334
|
+
* number of lines, and {@link ListItemBaseProps.leadingType | `props.leadingType`} sizes the
|
|
335
|
+
* leading content.
|
|
336
|
+
*
|
|
337
|
+
* @param props - component properties
|
|
338
|
+
* @returns rendered list item
|
|
339
|
+
*/
|
|
340
|
+
export declare const ListItem: InteractableComponent<ListItemBaseProps>;
|