@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,372 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps, FunctionElement } from "..";
|
|
3
|
+
import type { InputFieldSlots, InputOrientation, InputValueChangeHandler } from "./base";
|
|
4
|
+
import type { InputPair, PairedInputProps } from "./paired-input";
|
|
5
|
+
import { DomController } from "../dom/client";
|
|
6
|
+
import { PairedInputController } from "./paired-input";
|
|
7
|
+
import "./slider.css";
|
|
8
|
+
/**
|
|
9
|
+
* Callback invoked after a single slider value changes.
|
|
10
|
+
*/
|
|
11
|
+
export type SliderChangeHandler = InputValueChangeHandler<number>;
|
|
12
|
+
/**
|
|
13
|
+
* Slider size, from Material 3 Expressive extra small (`"xs"`) to extra large (`"xl"`).
|
|
14
|
+
*/
|
|
15
|
+
export type SliderSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
16
|
+
/**
|
|
17
|
+
* Slider track corner treatment.
|
|
18
|
+
*
|
|
19
|
+
* `"standard"` rounds the outer track ends with the leading track corner of the
|
|
20
|
+
* {@link SliderSize | size}: 8, 8, 12, 16 or 28px, the
|
|
21
|
+
* `m3_comp_slider_*_active_track_shape_leading` dimensions of material-components-android
|
|
22
|
+
* `tokens.xml`. `"round"` rounds them to half the track height, as Compose's
|
|
23
|
+
* `SliderDefaults.Track` does with its default, unspecified `trackCornerSize` (`Slider.kt`). The
|
|
24
|
+
* track ends next to a handle always use the 2dp inside corner.
|
|
25
|
+
*/
|
|
26
|
+
export type SliderShape = "standard" | "round";
|
|
27
|
+
/**
|
|
28
|
+
* Format a slider value for its value indicator and `aria-valuetext`.
|
|
29
|
+
*
|
|
30
|
+
* @param value - native slider value
|
|
31
|
+
* @returns text presented for `value`
|
|
32
|
+
*/
|
|
33
|
+
export type SliderValueFormatter = (value: number) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Properties shared by {@link Slider} and {@link RangeSlider}.
|
|
36
|
+
*/
|
|
37
|
+
interface SliderTrackProps {
|
|
38
|
+
/**
|
|
39
|
+
* Lower value bound.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue `0`
|
|
42
|
+
*/
|
|
43
|
+
min?: number | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Upper value bound. A bound below `min` is raised to `min`.
|
|
46
|
+
*
|
|
47
|
+
* @defaultValue `100`
|
|
48
|
+
*/
|
|
49
|
+
max?: number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Native value step.
|
|
52
|
+
*
|
|
53
|
+
* A positive number giving two or more steps draws a stop at every step that is at least
|
|
54
|
+
* `tickMinSpacing` apart (material-components-android `tickVisibilityMode="autoLimit"`).
|
|
55
|
+
* `"any"` and an absent step draw a continuous track.
|
|
56
|
+
*
|
|
57
|
+
* @defaultValue native step `1`, drawn as a continuous track
|
|
58
|
+
*/
|
|
59
|
+
step?: number | "any" | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Slider orientation.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue `"horizontal"`
|
|
64
|
+
*/
|
|
65
|
+
orientation?: InputOrientation | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Alias for a vertical {@link SliderTrackProps.orientation | orientation}.
|
|
68
|
+
*
|
|
69
|
+
* @defaultValue `false`
|
|
70
|
+
*/
|
|
71
|
+
vertical?: boolean | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Track and handle size.
|
|
74
|
+
*
|
|
75
|
+
* @defaultValue `"xs"`
|
|
76
|
+
*/
|
|
77
|
+
size?: SliderSize | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Track corner treatment.
|
|
80
|
+
*
|
|
81
|
+
* @defaultValue `"standard"`
|
|
82
|
+
*/
|
|
83
|
+
shape?: SliderShape | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Show the value indicator next to a pressed or keyboard-focused handle.
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue `true`
|
|
88
|
+
*/
|
|
89
|
+
valueIndicator?: boolean | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Format values for the value indicator and `aria-valuetext`.
|
|
92
|
+
*
|
|
93
|
+
* @defaultValue values formatted by `String()`, without `aria-valuetext`
|
|
94
|
+
*/
|
|
95
|
+
formatValue?: SliderValueFormatter | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Mark the slider invalid without an error slot.
|
|
98
|
+
*
|
|
99
|
+
* @defaultValue `false`
|
|
100
|
+
*/
|
|
101
|
+
invalid?: boolean | undefined;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* {@link Slider} component properties.
|
|
105
|
+
*/
|
|
106
|
+
export type SliderProps = DomProps<HTMLInputElement, Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "disabled" | "max" | "min" | "name" | "required" | "step" | "type" | "value">> & InputFieldSlots & SliderTrackProps & {
|
|
107
|
+
/**
|
|
108
|
+
* Current controlled value.
|
|
109
|
+
*
|
|
110
|
+
* Supplying this property, including `undefined`, selects controlled operation at
|
|
111
|
+
* construction. Update it from {@link SliderProps.onValueChange} to accept an edit.
|
|
112
|
+
*/
|
|
113
|
+
value?: number | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Initial value of an uncontrolled slider.
|
|
116
|
+
*
|
|
117
|
+
* @defaultValue `min`
|
|
118
|
+
*/
|
|
119
|
+
defaultValue?: number | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Disable native interaction and form participation.
|
|
122
|
+
*
|
|
123
|
+
* @defaultValue `false`
|
|
124
|
+
*/
|
|
125
|
+
disabled?: boolean | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Keep the value in forms while preventing edits.
|
|
128
|
+
*
|
|
129
|
+
* @defaultValue `false`
|
|
130
|
+
*/
|
|
131
|
+
readOnly?: boolean | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Require a value at form submission.
|
|
134
|
+
*
|
|
135
|
+
* @defaultValue `false`
|
|
136
|
+
*/
|
|
137
|
+
required?: boolean | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Native form name.
|
|
140
|
+
*/
|
|
141
|
+
name?: string | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Id of the native input; `attr:id` is used when this is absent.
|
|
144
|
+
*/
|
|
145
|
+
id?: string | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Fill the active track between the midpoint and the value.
|
|
148
|
+
*
|
|
149
|
+
* @defaultValue `false`
|
|
150
|
+
*/
|
|
151
|
+
centered?: boolean | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Icon inset in the track of a medium or larger standard slider.
|
|
154
|
+
*
|
|
155
|
+
* The icon is drawn at the start of the active track when it fits there, and at the start of
|
|
156
|
+
* the inactive track otherwise.
|
|
157
|
+
*/
|
|
158
|
+
insetIcon?: JSX.Element;
|
|
159
|
+
/**
|
|
160
|
+
* Notify the parent after the value is edited.
|
|
161
|
+
*
|
|
162
|
+
* `onValueChange` and `onChange` run in that order; the same function supplied to both runs
|
|
163
|
+
* once. Controlled values are reasserted after the callbacks, so update the controlled
|
|
164
|
+
* property to accept the edit. Use `event:change` to observe committed edits.
|
|
165
|
+
*
|
|
166
|
+
* @see {@link SliderProps.value}
|
|
167
|
+
*/
|
|
168
|
+
onValueChange?: SliderChangeHandler | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Alias for {@link SliderProps.onValueChange}.
|
|
171
|
+
*/
|
|
172
|
+
onChange?: SliderChangeHandler | undefined;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Pair of values edited by a {@link RangeSlider}; the first value is never above the second.
|
|
176
|
+
*/
|
|
177
|
+
export type RangeValue = InputPair<number>;
|
|
178
|
+
/**
|
|
179
|
+
* Callback invoked after either thumb of a range slider changes.
|
|
180
|
+
*/
|
|
181
|
+
export type RangeSliderChangeHandler = InputValueChangeHandler<RangeValue>;
|
|
182
|
+
/**
|
|
183
|
+
* {@link RangeSlider} component properties.
|
|
184
|
+
*/
|
|
185
|
+
export type RangeSliderProps = Omit<PairedInputProps<number>, "attr:step"> & SliderTrackProps & {
|
|
186
|
+
/**
|
|
187
|
+
* Alias for {@link PairedInputProps.startValue}.
|
|
188
|
+
*/
|
|
189
|
+
start?: number | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Alias for {@link PairedInputProps.endValue}.
|
|
192
|
+
*/
|
|
193
|
+
end?: number | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Alias for {@link PairedInputProps.onValueChange}, invoked after it.
|
|
196
|
+
*/
|
|
197
|
+
onRangeChange?: RangeSliderChangeHandler | undefined;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Client controller of a {@link Slider}.
|
|
201
|
+
*
|
|
202
|
+
* The native range input is the function element. The controller applies bounds, step, value,
|
|
203
|
+
* native and ARIA states to it, draws the track from its value, places the inset icon, and routes
|
|
204
|
+
* pointer input through a {@link SliderGesture}.
|
|
205
|
+
*/
|
|
206
|
+
export declare class SliderController extends DomController<SliderProps> {
|
|
207
|
+
#private;
|
|
208
|
+
/**
|
|
209
|
+
* Construct a new `SliderController`.
|
|
210
|
+
*
|
|
211
|
+
* @param props - component properties
|
|
212
|
+
*/
|
|
213
|
+
constructor(props: SliderProps);
|
|
214
|
+
/**
|
|
215
|
+
* Apply local properties to component state and styling.
|
|
216
|
+
*
|
|
217
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
218
|
+
*/
|
|
219
|
+
protected applyComponentProps(): void;
|
|
220
|
+
/**
|
|
221
|
+
* Handle function element replacement before the controller reference is updated.
|
|
222
|
+
*
|
|
223
|
+
* The function-element getter still exposes the previous element during this hook.
|
|
224
|
+
*
|
|
225
|
+
* @param curr - new function element, or `null` when absent
|
|
226
|
+
* @see {@link ../dom/client#DomController.onFunctionElementChanged}
|
|
227
|
+
*/
|
|
228
|
+
protected onFunctionElementChanged(curr: FunctionElement<SliderProps> | null): void;
|
|
229
|
+
/**
|
|
230
|
+
* Render the component's element tree.
|
|
231
|
+
*
|
|
232
|
+
* Slots are inserted reactively right after their containers are created, in the order of
|
|
233
|
+
* the server renderer; all other state is applied by
|
|
234
|
+
* {@link SliderController.applyComponentProps}.
|
|
235
|
+
*
|
|
236
|
+
* @param children - nested component children, possibly an accessor
|
|
237
|
+
* @param funcRef - callback receiving the native function element
|
|
238
|
+
* @returns rendered component elements
|
|
239
|
+
* @see {@link ../dom/client#DomController.render}
|
|
240
|
+
*/
|
|
241
|
+
protected render(children: JSX.Element, funcRef?: (elem: HTMLInputElement) => void): JSX.Element;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Material 3 slider backed by a native range input.
|
|
245
|
+
*
|
|
246
|
+
* Sliders select a value from a range. The track is drawn after Compose's `SliderDefaults.Track`:
|
|
247
|
+
* a 6dp gap separates the active and inactive tracks from the handle, the track ends next to the
|
|
248
|
+
* handle use a 2dp radius, a stop indicator is centered in the outer corner of the inactive track,
|
|
249
|
+
* and a stepped track draws its stops on the visible tracks only, between the track corners.
|
|
250
|
+
*
|
|
251
|
+
* # States
|
|
252
|
+
*
|
|
253
|
+
* The native input supplies focus, keyboard interaction (arrows, Page Up/Down, Home, End), the
|
|
254
|
+
* `slider` role and form participation. A press anywhere on the track moves the handle there and
|
|
255
|
+
* dragging follows the pointer; pressing or keyboard focus narrows the handle and shows the value
|
|
256
|
+
* indicator. `disabled` disables the input; `readOnly` keeps its form value but reverts edits.
|
|
257
|
+
* Pointer input is ignored while the input matches `:disabled`, also within a disabled `fieldset`.
|
|
258
|
+
*
|
|
259
|
+
* # Design
|
|
260
|
+
*
|
|
261
|
+
* Slider design is controlled through the [`cw-Slider`](./slider.yaml) component design
|
|
262
|
+
* attribute, with themes for the five Material 3 Expressive sizes. The root receives
|
|
263
|
+
* `cw-Slider-horizontal` or `cw-Slider-vertical`, `cw-Slider-centered`, `cw-Slider-disabled`,
|
|
264
|
+
* `cw-Slider-readOnly` and `cw-Slider-error`.
|
|
265
|
+
*
|
|
266
|
+
* # Elements
|
|
267
|
+
*
|
|
268
|
+
* The root `<label>` contains the label, the track with its leading, prefix, suffix and trailing
|
|
269
|
+
* slots, and the supporting text. The label names the input through `aria-labelledby`, and the
|
|
270
|
+
* supporting text describes it.
|
|
271
|
+
*
|
|
272
|
+
* @param props - component properties
|
|
273
|
+
* @returns rendered component elements
|
|
274
|
+
*/
|
|
275
|
+
export declare const Slider: DomComponent<SliderProps>;
|
|
276
|
+
/**
|
|
277
|
+
* Client controller of a {@link RangeSlider}.
|
|
278
|
+
*
|
|
279
|
+
* The start input is the function element. Pair semantics, labels, form participation and
|
|
280
|
+
* validity are shared with the date range input through {@link PairedInputController}; this
|
|
281
|
+
* controller adds bounds and steps, per-thumb `aria-valuemin`/`aria-valuemax`, the drawn track
|
|
282
|
+
* and pointer routing through a {@link SliderGesture}.
|
|
283
|
+
*/
|
|
284
|
+
export declare class RangeSliderController extends PairedInputController<RangeSliderProps, number> {
|
|
285
|
+
#private;
|
|
286
|
+
/**
|
|
287
|
+
* Construct a new `RangeSliderController`.
|
|
288
|
+
*
|
|
289
|
+
* @param props - component properties
|
|
290
|
+
*/
|
|
291
|
+
constructor(props: RangeSliderProps);
|
|
292
|
+
/**
|
|
293
|
+
* Clamp a thumb value to the bounds; an absent value uses the nearest bound.
|
|
294
|
+
*
|
|
295
|
+
* @param value - resolved value
|
|
296
|
+
* @param index - `0` for the start thumb, `1` for the end thumb
|
|
297
|
+
* @returns clamped value
|
|
298
|
+
*/
|
|
299
|
+
protected normalize(value: number | undefined, index: 0 | 1): number;
|
|
300
|
+
/**
|
|
301
|
+
* Apply changed bounds and step to both inputs.
|
|
302
|
+
*
|
|
303
|
+
* @param start - start input
|
|
304
|
+
* @param end - end input
|
|
305
|
+
* @returns `true` if, and only if, a bound or the step changed
|
|
306
|
+
*/
|
|
307
|
+
protected applyConstraints(start: HTMLInputElement, end: HTMLInputElement): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Value callbacks in invocation order.
|
|
310
|
+
*
|
|
311
|
+
* @returns `onValueChange`, `onRangeChange` and `onChange`
|
|
312
|
+
*/
|
|
313
|
+
protected changeCallbacks(): readonly (RangeSliderChangeHandler | undefined)[];
|
|
314
|
+
/**
|
|
315
|
+
* Draw the applied pair and expose each thumb's movable range.
|
|
316
|
+
*
|
|
317
|
+
* @param pair - native start and end values
|
|
318
|
+
*/
|
|
319
|
+
protected onPairApplied(pair: RangeValue): void;
|
|
320
|
+
/**
|
|
321
|
+
* Apply local properties to component state and styling.
|
|
322
|
+
*
|
|
323
|
+
* @see {@link PairedInputController.applyComponentProps}
|
|
324
|
+
*/
|
|
325
|
+
protected applyComponentProps(): void;
|
|
326
|
+
/**
|
|
327
|
+
* Render the component's element tree.
|
|
328
|
+
*
|
|
329
|
+
* Slots are inserted reactively right after their containers are created, in the order of
|
|
330
|
+
* the server renderer; all other state is applied by
|
|
331
|
+
* {@link RangeSliderController.applyComponentProps}.
|
|
332
|
+
*
|
|
333
|
+
* @param children - nested component children, possibly an accessor
|
|
334
|
+
* @param funcRef - callback receiving the native function element
|
|
335
|
+
* @returns rendered component elements
|
|
336
|
+
* @see {@link ../dom/client#DomController.render}
|
|
337
|
+
*/
|
|
338
|
+
protected render(children: JSX.Element, funcRef?: (elem: HTMLInputElement) => void): JSX.Element;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Material 3 range slider backed by two native range inputs.
|
|
342
|
+
*
|
|
343
|
+
* Range sliders select a start and end value; the thumbs never cross. The track is drawn like a
|
|
344
|
+
* {@link Slider}'s, with stop indicators centered in both outer corners. A press on the track
|
|
345
|
+
* moves the nearest thumb there, and a press on shared thumbs moves the thumb that can follow the
|
|
346
|
+
* first movement.
|
|
347
|
+
*
|
|
348
|
+
* # States
|
|
349
|
+
*
|
|
350
|
+
* Each native input supplies focus, keyboard interaction and the `slider` role, with
|
|
351
|
+
* `aria-valuemin` and `aria-valuemax` limited by the other thumb. `disabled`, `readOnly` and
|
|
352
|
+
* validity apply to both inputs. Pointer input is ignored while the inputs match `:disabled`, also
|
|
353
|
+
* within a disabled `fieldset`. Both values serialize in start, end order under `name`.
|
|
354
|
+
*
|
|
355
|
+
* # Design
|
|
356
|
+
*
|
|
357
|
+
* Range slider design is controlled through the [`cw-RangeSlider`](./range-slider.yaml)
|
|
358
|
+
* component design attribute. The root receives `cw-RangeSlider-horizontal` or
|
|
359
|
+
* `cw-RangeSlider-vertical`, `cw-RangeSlider-disabled`, `cw-RangeSlider-readOnly` and
|
|
360
|
+
* `cw-RangeSlider-error`.
|
|
361
|
+
*
|
|
362
|
+
* # Elements
|
|
363
|
+
*
|
|
364
|
+
* The root `<fieldset>` is labelled by its `<legend>`; the inputs are labelled "Minimum" and
|
|
365
|
+
* "Maximum" unless {@link PairedInputProps.startLabel} and {@link PairedInputProps.endLabel}
|
|
366
|
+
* are supplied.
|
|
367
|
+
*
|
|
368
|
+
* @param props - component properties
|
|
369
|
+
* @returns rendered component elements
|
|
370
|
+
*/
|
|
371
|
+
export declare const RangeSlider: DomComponent<RangeSliderProps>;
|
|
372
|
+
export {};
|