@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.
- package/LICENSE +163 -0
- package/README.md +82 -2
- package/package.json +111 -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 +320 -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 +580 -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,358 @@
|
|
|
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 "../container/elevation-shadow.css";
|
|
7
|
+
import "./selection.css";
|
|
8
|
+
/**
|
|
9
|
+
* Container treatment of an assist, filter, or suggestion chip.
|
|
10
|
+
*
|
|
11
|
+
* | Design | Description |
|
|
12
|
+
* | --- | --- |
|
|
13
|
+
* | `"flat"` | Outlined container without elevation. |
|
|
14
|
+
* | `"elevated"` | Filled container with elevation and without outline. |
|
|
15
|
+
*/
|
|
16
|
+
export type ChipDesign = "elevated" | "flat";
|
|
17
|
+
/**
|
|
18
|
+
* Handle a request to remove a chip.
|
|
19
|
+
*
|
|
20
|
+
* @param event - remove-action click, or the `Backspace` or `Delete` key press on the chip
|
|
21
|
+
*/
|
|
22
|
+
export type ChipDismissHandler = (event: KeyboardEvent | MouseEvent) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Properties of every chip.
|
|
25
|
+
*/
|
|
26
|
+
export type BaseChipProps = DomProps<HTMLButtonElement, Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "name" | "onChange" | "required" | "tabIndex" | "type" | "value">> & {
|
|
27
|
+
/**
|
|
28
|
+
* Label content.
|
|
29
|
+
*
|
|
30
|
+
* Takes precedence over `children`, which is an equivalent label slot.
|
|
31
|
+
*/
|
|
32
|
+
label?: JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Leading icon content, sized by the `cw-Chip-icon-size` role.
|
|
35
|
+
*/
|
|
36
|
+
leadingIcon?: JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Trailing icon content inside the chip action, sized by the `cw-Chip-icon-size` role.
|
|
39
|
+
*/
|
|
40
|
+
trailingIcon?: JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* Chip is disabled.
|
|
43
|
+
*
|
|
44
|
+
* A disabled chip cannot be activated or focused.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `false`
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Sequential focus index of the chip action.
|
|
51
|
+
*/
|
|
52
|
+
tabIndex?: number | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Chip shows the Material 3 dragged state while a pointer drags it.
|
|
55
|
+
*
|
|
56
|
+
* Enable this for chips which the application lets users drag, for example to reorder a set of
|
|
57
|
+
* chips; the application implements the drag itself. When a pointer press moves beyond the
|
|
58
|
+
* drag threshold, the chip enters the drag interaction state, captures the pointer, and
|
|
59
|
+
* applies the dragged elevation and state layer until the pointer is released. A drag does
|
|
60
|
+
* not activate the chip. This is unrelated to the native `attr:draggable`.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue `false`
|
|
63
|
+
*/
|
|
64
|
+
draggable?: boolean | undefined;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Properties of a chip with a flat or an elevated container.
|
|
68
|
+
*/
|
|
69
|
+
type DesignChipProps = {
|
|
70
|
+
/**
|
|
71
|
+
* Container treatment.
|
|
72
|
+
*
|
|
73
|
+
* @defaultValue `"flat"`
|
|
74
|
+
*/
|
|
75
|
+
design?: ChipDesign | undefined;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Properties of a selectable chip.
|
|
79
|
+
*/
|
|
80
|
+
type SelectableChipProps = {
|
|
81
|
+
/**
|
|
82
|
+
* Chip is selected.
|
|
83
|
+
*
|
|
84
|
+
* The chip is controlled when this property, or its alias {@link
|
|
85
|
+
* SelectableChipProps.checked | `checked`}, is present, even when its value is `undefined`.
|
|
86
|
+
* Omit both properties for an uncontrolled chip.
|
|
87
|
+
*/
|
|
88
|
+
selected?: boolean | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Alias of {@link SelectableChipProps.selected | `selected`}.
|
|
91
|
+
*
|
|
92
|
+
* `selected` takes precedence when both are present.
|
|
93
|
+
*/
|
|
94
|
+
checked?: boolean | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Initial selected state of an uncontrolled chip.
|
|
97
|
+
*
|
|
98
|
+
* This is also the state restored when the chip's form is reset.
|
|
99
|
+
*
|
|
100
|
+
* @defaultValue `false`
|
|
101
|
+
* @remarks
|
|
102
|
+
* This is read once.
|
|
103
|
+
*/
|
|
104
|
+
defaultSelected?: boolean | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Name under which a selected chip submits its value.
|
|
107
|
+
*
|
|
108
|
+
* The value is submitted through a hidden input, which follows the form named by `attr:form`
|
|
109
|
+
* when supplied.
|
|
110
|
+
*/
|
|
111
|
+
name?: string | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Value submitted while the chip is selected.
|
|
114
|
+
*/
|
|
115
|
+
value?: string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Apply the Material 3 Expressive chip shapes.
|
|
118
|
+
*
|
|
119
|
+
* The container morphs between its unselected, selected (fully rounded), and pressed shapes
|
|
120
|
+
* with the fast spatial spring.
|
|
121
|
+
*
|
|
122
|
+
* @defaultValue `false`
|
|
123
|
+
*/
|
|
124
|
+
expressive?: boolean | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Handle a change of the selected state requested by the user.
|
|
127
|
+
*
|
|
128
|
+
* Runs for controlled and uncontrolled chips after delegated click handlers have had the
|
|
129
|
+
* opportunity to cancel the click. A controlled chip accepts the request only when the parent
|
|
130
|
+
* updates {@link SelectableChipProps.selected | `selected`}. Distinct `onChange` and
|
|
131
|
+
* `onSelectedChange` callbacks run in that order; one function supplied to both runs once.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link ./base#SelectionChangeHandler}
|
|
134
|
+
*/
|
|
135
|
+
onChange?: SelectionChangeHandler | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Alias of {@link SelectableChipProps.onChange | `onChange`}, matching Compose's naming.
|
|
138
|
+
*/
|
|
139
|
+
onSelectedChange?: SelectionChangeHandler | undefined;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Properties of a chip with a remove action.
|
|
143
|
+
*/
|
|
144
|
+
type DismissibleChipProps = {
|
|
145
|
+
/**
|
|
146
|
+
* Show the remove action.
|
|
147
|
+
*
|
|
148
|
+
* The remove action is also shown when {@link DismissibleChipProps.onDismiss | `onDismiss`}
|
|
149
|
+
* is supplied.
|
|
150
|
+
*
|
|
151
|
+
* @defaultValue `false`
|
|
152
|
+
*/
|
|
153
|
+
removable?: boolean | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Accessible name of the remove action.
|
|
156
|
+
*
|
|
157
|
+
* @defaultValue `"Remove"` followed by the chip's label
|
|
158
|
+
*/
|
|
159
|
+
removeLabel?: string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Handle a request to remove the chip.
|
|
162
|
+
*
|
|
163
|
+
* Runs when the remove action is activated, or when `Backspace` or `Delete` is pressed while
|
|
164
|
+
* the chip has focus, after delegated handlers have had the opportunity to cancel the event.
|
|
165
|
+
* The chip does not remove itself: remove it from the rendered data and move focus to a
|
|
166
|
+
* neighboring element.
|
|
167
|
+
*/
|
|
168
|
+
onDismiss?: ChipDismissHandler | undefined;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Properties of an assist chip.
|
|
172
|
+
*/
|
|
173
|
+
export type AssistChipProps = BaseChipProps & DesignChipProps;
|
|
174
|
+
/**
|
|
175
|
+
* Properties of a filter chip.
|
|
176
|
+
*/
|
|
177
|
+
export type FilterChipProps = BaseChipProps & DesignChipProps & DismissibleChipProps & SelectableChipProps;
|
|
178
|
+
/**
|
|
179
|
+
* Properties of an input chip.
|
|
180
|
+
*/
|
|
181
|
+
export type InputChipProps = BaseChipProps & DismissibleChipProps & SelectableChipProps & {
|
|
182
|
+
/**
|
|
183
|
+
* Avatar content, displayed in a circular slot in place of the leading icon.
|
|
184
|
+
*/
|
|
185
|
+
avatar?: JSX.Element;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Properties of a suggestion chip.
|
|
189
|
+
*/
|
|
190
|
+
export type SuggestionChipProps = BaseChipProps & DesignChipProps;
|
|
191
|
+
/**
|
|
192
|
+
* Properties of any chip variant, as read by {@link ChipController}.
|
|
193
|
+
*/
|
|
194
|
+
export type ChipProps = BaseChipProps & DesignChipProps & DismissibleChipProps & SelectableChipProps & Pick<InputChipProps, "avatar">;
|
|
195
|
+
/**
|
|
196
|
+
* Chip variant.
|
|
197
|
+
*
|
|
198
|
+
* | Variant | Selectable | Remove action | Designs | Base CSS class |
|
|
199
|
+
* | --- | --- | --- | --- | --- |
|
|
200
|
+
* | `"assist"` | No | No | Flat, elevated | `cw-AssistChip` |
|
|
201
|
+
* | `"filter"` | Yes | Optional | Flat, elevated | `cw-FilterChip` |
|
|
202
|
+
* | `"input"` | Yes | Optional | Flat | `cw-InputChip` |
|
|
203
|
+
* | `"suggestion"` | No | No | Flat, elevated | `cw-SuggestionChip` |
|
|
204
|
+
*/
|
|
205
|
+
export type ChipVariant = "assist" | "filter" | "input" | "suggestion";
|
|
206
|
+
/**
|
|
207
|
+
* Client controller shared by all chip variants.
|
|
208
|
+
*
|
|
209
|
+
* The container is the style element and the primary action, a native button, is the function
|
|
210
|
+
* element. Selectable chips own their selected state when uncontrolled, toggle it on activation,
|
|
211
|
+
* and submit their value through a hidden input while selected. Filter and input chips may show a
|
|
212
|
+
* remove action, and request their removal on `Backspace` and `Delete`.
|
|
213
|
+
*
|
|
214
|
+
* @typeParam P - component properties type
|
|
215
|
+
*/
|
|
216
|
+
export declare class ChipController<P extends ChipProps = ChipProps> extends InteractableController<P> {
|
|
217
|
+
#private;
|
|
218
|
+
/**
|
|
219
|
+
* Construct a new `ChipController`.
|
|
220
|
+
*
|
|
221
|
+
* @param props - component properties
|
|
222
|
+
* @param variant - chip variant
|
|
223
|
+
*/
|
|
224
|
+
constructor(props: P, variant: ChipVariant);
|
|
225
|
+
/**
|
|
226
|
+
* Base CSS class of the chip variant.
|
|
227
|
+
*/
|
|
228
|
+
protected get baseClassName(): string;
|
|
229
|
+
/**
|
|
230
|
+
* Apply local properties to component state and styling.
|
|
231
|
+
*
|
|
232
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
233
|
+
*/
|
|
234
|
+
protected applyComponentProps(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Handle function element replacement before the controller reference is updated.
|
|
237
|
+
*
|
|
238
|
+
* The function-element getter still exposes the previous element during this hook.
|
|
239
|
+
*
|
|
240
|
+
* @param curr - new function element, or `null` when absent
|
|
241
|
+
* @see {@link ../dom/client#DomController.onFunctionElementChanged}
|
|
242
|
+
*/
|
|
243
|
+
protected onFunctionElementChanged(curr: FunctionElement<P> | null): void;
|
|
244
|
+
/**
|
|
245
|
+
* Render the component's element tree.
|
|
246
|
+
*
|
|
247
|
+
* The content slots insert their properties reactively; `children` is the label while no
|
|
248
|
+
* `label` is supplied. Attributes are applied by {@link ChipController.applyComponentProps}.
|
|
249
|
+
*
|
|
250
|
+
* @param children - label content, possibly an accessor
|
|
251
|
+
* @param funcRef - callback receiving the primary action
|
|
252
|
+
* @returns rendered container element
|
|
253
|
+
* @see {@link ../dom/client#DomController.render}
|
|
254
|
+
*/
|
|
255
|
+
protected render(children: JSX.Element, funcRef?: (elem: FunctionElement<P>) => void): JSX.Element;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Material 3 assist chip.
|
|
259
|
+
*
|
|
260
|
+
* Assist chips represent smart or automated actions. The chip is a native button whose
|
|
261
|
+
* activation runs the interaction `onClick` callback.
|
|
262
|
+
*
|
|
263
|
+
* # Design
|
|
264
|
+
*
|
|
265
|
+
* Design is controlled through the [`cw-Chip`](./chip.yaml) component design attribute, with the
|
|
266
|
+
* `assist` theme and, for `design="elevated"`, the `elevated` theme. The container receives
|
|
267
|
+
* `cw-AssistChip-disabled` while disabled and `cw-AssistChip-<state>` for interaction states.
|
|
268
|
+
*
|
|
269
|
+
* @param props - component properties
|
|
270
|
+
* @returns rendered container element
|
|
271
|
+
*/
|
|
272
|
+
export declare const AssistChip: InteractableComponent<AssistChipProps>;
|
|
273
|
+
/**
|
|
274
|
+
* Material 3 elevated assist chip.
|
|
275
|
+
*
|
|
276
|
+
* This is an {@link AssistChip} whose `design` defaults to `"elevated"`.
|
|
277
|
+
*
|
|
278
|
+
* @param props - component properties
|
|
279
|
+
* @returns rendered container element
|
|
280
|
+
*/
|
|
281
|
+
export declare const ElevatedAssistChip: InteractableComponent<AssistChipProps>;
|
|
282
|
+
/**
|
|
283
|
+
* Material 3 filter chip.
|
|
284
|
+
*
|
|
285
|
+
* Filter chips use tags or descriptive words to filter content. The chip is a toggle button
|
|
286
|
+
* exposing its selected state through `aria-pressed`; a selected filter chip shows a checkmark in
|
|
287
|
+
* place of its leading icon. The chip is controlled when `selected` or its alias `checked` is
|
|
288
|
+
* present. A named chip submits its value while selected, and a removable filter chip shows a
|
|
289
|
+
* remove action.
|
|
290
|
+
*
|
|
291
|
+
* # Design
|
|
292
|
+
*
|
|
293
|
+
* Design is controlled through the [`cw-Chip`](./chip.yaml) component design attribute, with the
|
|
294
|
+
* `elevated` theme for `design="elevated"` and the `expressive` theme for `expressive`. The
|
|
295
|
+
* container receives `cw-FilterChip-selected` while selected, `cw-FilterChip-removable` while the
|
|
296
|
+
* remove action is shown, `cw-FilterChip-disabled` while disabled, and `cw-FilterChip-<state>`
|
|
297
|
+
* for interaction states. The checkmark expands with the fast spatial spring and fades in with the
|
|
298
|
+
* slow effects spring, as in Compose.
|
|
299
|
+
*
|
|
300
|
+
* @param props - component properties
|
|
301
|
+
* @returns rendered container element
|
|
302
|
+
*/
|
|
303
|
+
export declare const FilterChip: InteractableComponent<FilterChipProps>;
|
|
304
|
+
/**
|
|
305
|
+
* Material 3 elevated filter chip.
|
|
306
|
+
*
|
|
307
|
+
* This is a {@link FilterChip} whose `design` defaults to `"elevated"`.
|
|
308
|
+
*
|
|
309
|
+
* @param props - component properties
|
|
310
|
+
* @returns rendered container element
|
|
311
|
+
*/
|
|
312
|
+
export declare const ElevatedFilterChip: InteractableComponent<FilterChipProps>;
|
|
313
|
+
/**
|
|
314
|
+
* Material 3 input chip.
|
|
315
|
+
*
|
|
316
|
+
* Input chips represent discrete pieces of information entered by the user, such as entities or
|
|
317
|
+
* contacts. The chip is a toggle button exposing its selected state through `aria-pressed`, and
|
|
318
|
+
* may show an avatar and a remove action. `Backspace` and `Delete` request the removal of a
|
|
319
|
+
* focused removable chip. A named chip submits its value while selected.
|
|
320
|
+
*
|
|
321
|
+
* # Design
|
|
322
|
+
*
|
|
323
|
+
* Design is controlled through the [`cw-Chip`](./chip.yaml) component design attribute, with the
|
|
324
|
+
* `input` theme and the `expressive` theme for `expressive`. The container receives
|
|
325
|
+
* `cw-InputChip-selected` while selected, `cw-InputChip-removable` while the remove action is
|
|
326
|
+
* shown, `cw-InputChip-disabled` while disabled, and `cw-InputChip-<state>` for interaction
|
|
327
|
+
* states.
|
|
328
|
+
*
|
|
329
|
+
* @param props - component properties
|
|
330
|
+
* @returns rendered container element
|
|
331
|
+
*/
|
|
332
|
+
export declare const InputChip: InteractableComponent<InputChipProps>;
|
|
333
|
+
/**
|
|
334
|
+
* Material 3 suggestion chip.
|
|
335
|
+
*
|
|
336
|
+
* Suggestion chips help narrow a user's intent by presenting dynamically generated suggestions.
|
|
337
|
+
* The chip is a native button whose activation runs the interaction `onClick` callback.
|
|
338
|
+
*
|
|
339
|
+
* # Design
|
|
340
|
+
*
|
|
341
|
+
* Design is controlled through the [`cw-Chip`](./chip.yaml) component design attribute, with the
|
|
342
|
+
* `elevated` theme for `design="elevated"`. The container receives `cw-SuggestionChip-disabled`
|
|
343
|
+
* while disabled and `cw-SuggestionChip-<state>` for interaction states.
|
|
344
|
+
*
|
|
345
|
+
* @param props - component properties
|
|
346
|
+
* @returns rendered container element
|
|
347
|
+
*/
|
|
348
|
+
export declare const SuggestionChip: InteractableComponent<SuggestionChipProps>;
|
|
349
|
+
/**
|
|
350
|
+
* Material 3 elevated suggestion chip.
|
|
351
|
+
*
|
|
352
|
+
* This is a {@link SuggestionChip} whose `design` defaults to `"elevated"`.
|
|
353
|
+
*
|
|
354
|
+
* @param props - component properties
|
|
355
|
+
* @returns rendered container element
|
|
356
|
+
*/
|
|
357
|
+
export declare const ElevatedSuggestionChip: InteractableComponent<SuggestionChipProps>;
|
|
358
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material 3 selection controls.
|
|
3
|
+
*
|
|
4
|
+
* Checkboxes, radio buttons, and switches wrap form-associated native inputs, so they participate
|
|
5
|
+
* in forms, keep native keyboard behavior, and expose native semantics. Chips and segmented
|
|
6
|
+
* buttons are native buttons which submit their values through hidden inputs while selected.
|
|
7
|
+
* Every component renders on the server and hydrates in place.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
export type { SelectionChangeHandler } from "./base";
|
|
12
|
+
export type { CheckboxProps, CheckboxState } from "./checkbox";
|
|
13
|
+
export type { AssistChipProps, BaseChipProps, ChipDesign, ChipDismissHandler, ChipProps, ChipVariant, FilterChipProps, InputChipProps, SuggestionChipProps } from "./chip";
|
|
14
|
+
export type { RadioButtonProps, RadioGroupProps } from "./radio";
|
|
15
|
+
export type { SegmentedButtonGroupProps, SegmentedButtonItem, SegmentedButtonProps, SegmentedGroupChangeHandler, SegmentedGroupValue } from "./segmented";
|
|
16
|
+
export type { SwitchProps } from "./switch";
|
|
17
|
+
export { Checkbox, CheckboxController } from "./checkbox";
|
|
18
|
+
export { AssistChip, ChipController, ElevatedAssistChip, ElevatedFilterChip, ElevatedSuggestionChip, FilterChip, InputChip, SuggestionChip } from "./chip";
|
|
19
|
+
export { RadioButton, RadioButtonController, RadioGroup } from "./radio";
|
|
20
|
+
export { MultiChoiceSegmentedButtonRow, SegmentedButton, SegmentedButtonController, SegmentedButtonGroup, SegmentedButtonGroupController, SingleChoiceSegmentedButtonRow } from "./segmented";
|
|
21
|
+
export { Switch, SwitchController } from "./switch";
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, 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 RadioButton} component properties.
|
|
9
|
+
*/
|
|
10
|
+
export type RadioButtonProps = DomProps<HTMLInputElement, Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "checked" | "defaultChecked" | "disabled" | "name" | "required" | "tabIndex" | "type" | "value">> & {
|
|
11
|
+
/**
|
|
12
|
+
* Radio button is selected.
|
|
13
|
+
*
|
|
14
|
+
* The radio button is controlled when this property, or its alias {@link
|
|
15
|
+
* RadioButtonProps.checked | `checked`}, is present, even when its value is `undefined`. A
|
|
16
|
+
* controlled radio button displays a requested selection only after the parent updates the
|
|
17
|
+
* controlling property; until then, it and its controlled peers keep their states. Omit both
|
|
18
|
+
* properties for an uncontrolled radio button.
|
|
19
|
+
*/
|
|
20
|
+
selected?: boolean | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Alias of {@link RadioButtonProps.selected | `selected`}, matching the native property.
|
|
23
|
+
*
|
|
24
|
+
* `selected` takes precedence when both are present.
|
|
25
|
+
*/
|
|
26
|
+
checked?: boolean | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Initial selected state of an uncontrolled radio button.
|
|
29
|
+
*
|
|
30
|
+
* This is also the state restored when the radio button's form is reset.
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue `false`
|
|
33
|
+
* @remarks
|
|
34
|
+
* This is read once.
|
|
35
|
+
*/
|
|
36
|
+
defaultSelected?: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Alias of {@link RadioButtonProps.defaultSelected | `defaultSelected`}, matching the native
|
|
39
|
+
* property.
|
|
40
|
+
*
|
|
41
|
+
* `defaultSelected` takes precedence when both are present.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* This is read once.
|
|
45
|
+
*/
|
|
46
|
+
defaultChecked?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Radio button is disabled.
|
|
49
|
+
*
|
|
50
|
+
* A disabled radio button cannot be selected or focused and does not submit a value.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue `false`
|
|
53
|
+
*/
|
|
54
|
+
disabled?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Native radio group name.
|
|
57
|
+
*
|
|
58
|
+
* Radio buttons with the same name and form form one group: selecting one clears the others,
|
|
59
|
+
* and the arrow keys move the selection within the group.
|
|
60
|
+
*/
|
|
61
|
+
name?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Value submitted while the radio button is selected.
|
|
64
|
+
*
|
|
65
|
+
* @defaultValue `"on"`
|
|
66
|
+
*/
|
|
67
|
+
value?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* A radio button of the group must be selected for its form to be submitted.
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue `false`
|
|
72
|
+
*/
|
|
73
|
+
required?: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Sequential focus index of the native control.
|
|
76
|
+
*/
|
|
77
|
+
tabIndex?: number | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Handle a selection requested by the user.
|
|
80
|
+
*
|
|
81
|
+
* Runs for controlled and uncontrolled radio buttons when the user selects the radio button.
|
|
82
|
+
* A controlled radio button accepts the request only when the parent updates {@link
|
|
83
|
+
* RadioButtonProps.selected | `selected`} or {@link RadioButtonProps.checked | `checked`}.
|
|
84
|
+
* Distinct `onChange` and `onSelectedChange` callbacks run in that order; one function
|
|
85
|
+
* supplied to both runs once.
|
|
86
|
+
*
|
|
87
|
+
* @see {@link ./base#SelectionChangeHandler}
|
|
88
|
+
*/
|
|
89
|
+
onChange?: SelectionChangeHandler | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Alias of {@link RadioButtonProps.onChange | `onChange`}, matching Compose's naming.
|
|
92
|
+
*/
|
|
93
|
+
onSelectedChange?: SelectionChangeHandler | undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Client controller of a {@link RadioButton}.
|
|
97
|
+
*
|
|
98
|
+
* The native radio button owns the selection of an uncontrolled radio button. For a controlled
|
|
99
|
+
* radio button, the controller restores the native state after each user change, peer change,
|
|
100
|
+
* and form reset until the parent updates the controlling property. Each selection, including a
|
|
101
|
+
* restored one, also refreshes the selected state of the observed peers it cleared.
|
|
102
|
+
*/
|
|
103
|
+
export declare class RadioButtonController extends InteractableController<RadioButtonProps> {
|
|
104
|
+
#private;
|
|
105
|
+
/**
|
|
106
|
+
* Construct a new `RadioButtonController`.
|
|
107
|
+
*
|
|
108
|
+
* @param props - component properties
|
|
109
|
+
*/
|
|
110
|
+
constructor(props: RadioButtonProps);
|
|
111
|
+
/**
|
|
112
|
+
* Apply local properties to component state and styling.
|
|
113
|
+
*
|
|
114
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
115
|
+
*/
|
|
116
|
+
protected applyComponentProps(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Handle function element replacement before the controller reference is updated.
|
|
119
|
+
*
|
|
120
|
+
* The function-element getter still exposes the previous element during this hook.
|
|
121
|
+
*
|
|
122
|
+
* @param curr - new function element, or `null` when absent
|
|
123
|
+
* @see {@link ../dom/client#DomController.onFunctionElementChanged}
|
|
124
|
+
*/
|
|
125
|
+
protected onFunctionElementChanged(curr: FunctionElement<RadioButtonProps> | null): void;
|
|
126
|
+
/**
|
|
127
|
+
* Render the component's element tree.
|
|
128
|
+
*
|
|
129
|
+
* @param children - label content, possibly an accessor
|
|
130
|
+
* @param funcRef - callback receiving the native radio button
|
|
131
|
+
* @returns rendered label element
|
|
132
|
+
* @see {@link ../dom/client#DomController.render}
|
|
133
|
+
*/
|
|
134
|
+
protected render(children: JSX.Element, funcRef?: (elem: HTMLInputElement) => void): JSX.Element;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Material 3 radio button backed by a form-associated native radio button.
|
|
138
|
+
*
|
|
139
|
+
* Radio buttons let users select one option from a set. Radio buttons sharing a
|
|
140
|
+
* {@link RadioButtonProps.name | `name`} and form form a native group, which provides the
|
|
141
|
+
* selection exclusivity, the arrow-key navigation, and the form value. The radio button is
|
|
142
|
+
* controlled when {@link RadioButtonProps.selected | `selected`} or its alias `checked` is
|
|
143
|
+
* present. Children form the label; a radio button without children needs `attr:aria-label`.
|
|
144
|
+
*
|
|
145
|
+
* # States
|
|
146
|
+
*
|
|
147
|
+
* The radio button enters the focus, hover, and press interaction states while enabled. A pointer
|
|
148
|
+
* or keyboard activation anywhere on the label selects the native radio button, which covers the
|
|
149
|
+
* whole component; interactive label content remains clickable.
|
|
150
|
+
*
|
|
151
|
+
* # Design
|
|
152
|
+
*
|
|
153
|
+
* Design is controlled through the [`cw-RadioButton`](./radio.yaml) component design attribute.
|
|
154
|
+
* The style element receives `cw-RadioButton-selected` while selected, `cw-RadioButton-disabled`
|
|
155
|
+
* while disabled, and `cw-RadioButton-<state>` for interaction states. The 40px state layer is
|
|
156
|
+
* centered on the ring at the start of the 48px target. The dot scales with the fast spatial
|
|
157
|
+
* spring and colors use the default effects spring, as in Compose.
|
|
158
|
+
*
|
|
159
|
+
* # Elements
|
|
160
|
+
*
|
|
161
|
+
* | Element | Description |
|
|
162
|
+
* | --- | --- |
|
|
163
|
+
* | `label.cw-RadioButton` | Style element and label. |
|
|
164
|
+
* | `input.cw-RadioButton-input` | Function element; a native radio button covering the label. |
|
|
165
|
+
* | `.cw-RadioButton-circle` | Ring and dot. |
|
|
166
|
+
*
|
|
167
|
+
* @param props - component properties
|
|
168
|
+
* @returns rendered label element
|
|
169
|
+
*/
|
|
170
|
+
export declare const RadioButton: InteractableComponent<RadioButtonProps>;
|
|
171
|
+
/**
|
|
172
|
+
* {@link RadioGroup} component properties.
|
|
173
|
+
*/
|
|
174
|
+
export type RadioGroupProps = DomProps<HTMLFieldSetElement, Omit<JSX.FieldsetHTMLAttributes<HTMLFieldSetElement>, "role">> & {
|
|
175
|
+
/**
|
|
176
|
+
* Layout direction of the radio buttons.
|
|
177
|
+
*
|
|
178
|
+
* Also exposed as `aria-orientation`, unless `attr:aria-orientation` is supplied.
|
|
179
|
+
*
|
|
180
|
+
* @defaultValue `"vertical"`
|
|
181
|
+
*/
|
|
182
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Accessible container for related radio buttons.
|
|
186
|
+
*
|
|
187
|
+
* The group renders a `fieldset` with `role="radiogroup"` and lays out its children. Grouping
|
|
188
|
+
* itself remains native: give each child {@link RadioButton} the same `name`. Name the group with
|
|
189
|
+
* a `legend` child or `attr:aria-label`.
|
|
190
|
+
*
|
|
191
|
+
* # Design
|
|
192
|
+
*
|
|
193
|
+
* The style element receives `cw-RadioGroup`; the orientation selects the layout direction.
|
|
194
|
+
*
|
|
195
|
+
* @param props - component properties
|
|
196
|
+
* @returns rendered fieldset element
|
|
197
|
+
*/
|
|
198
|
+
export declare const RadioGroup: DomComponent<RadioGroupProps>;
|