@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,415 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps, ElementDomProps, FunctionElement, PickLocalDomProps } from "..";
|
|
3
|
+
import type { InputFieldSlots, InputValueChangeHandler, InputVariant } from "./base";
|
|
4
|
+
import { DomController } from "../dom/client";
|
|
5
|
+
import "./text-field.css";
|
|
6
|
+
/**
|
|
7
|
+
* Native input types supported by {@link TextField}.
|
|
8
|
+
*/
|
|
9
|
+
export type TextFieldType = "date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
10
|
+
/**
|
|
11
|
+
* Callback invoked after a text field's native value changes.
|
|
12
|
+
*/
|
|
13
|
+
export type TextFieldChangeHandler = InputValueChangeHandler<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Native control of a text field: an input, or a textarea for multiline fields.
|
|
16
|
+
*/
|
|
17
|
+
type NativeTextElement = HTMLInputElement | HTMLTextAreaElement;
|
|
18
|
+
/**
|
|
19
|
+
* {@link TextField} component properties.
|
|
20
|
+
*
|
|
21
|
+
* Use `attr:form` to associate the native input or textarea with a form outside its ancestors.
|
|
22
|
+
*/
|
|
23
|
+
export type TextFieldProps = DomProps<NativeTextElement, JSX.HTMLAttributes<NativeTextElement> & Pick<JSX.InputHTMLAttributes<HTMLInputElement>, "form">> & InputFieldSlots & {
|
|
24
|
+
/**
|
|
25
|
+
* Container variant.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue `"filled"`
|
|
28
|
+
*/
|
|
29
|
+
variant?: InputVariant | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Render a textarea instead of an input.
|
|
32
|
+
*
|
|
33
|
+
* Multiline fields grow with their content, starting from {@link TextFieldProps.rows}
|
|
34
|
+
* lines.
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue `false`
|
|
37
|
+
*/
|
|
38
|
+
multiline?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Native input type.
|
|
41
|
+
*
|
|
42
|
+
* Password fields render a password visibility toggle, see {@link
|
|
43
|
+
* TextFieldProps.revealPassword}. This is ignored by multiline fields.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue `"password"` when {@link TextFieldProps.secure} is `true`; otherwise,
|
|
46
|
+
* `"text"`
|
|
47
|
+
*/
|
|
48
|
+
type?: TextFieldType | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Hide the text as a password and render the password visibility toggle.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue `false`
|
|
53
|
+
*/
|
|
54
|
+
secure?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Render the password visibility toggle.
|
|
57
|
+
*
|
|
58
|
+
* When omitted, secure and password fields render the toggle. `false` removes it; `true`
|
|
59
|
+
* renders it for any single-line field.
|
|
60
|
+
*/
|
|
61
|
+
revealPassword?: boolean | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Accessible name of the password visibility toggle.
|
|
64
|
+
*
|
|
65
|
+
* The name does not change with the toggle state, which is exposed through `aria-pressed`.
|
|
66
|
+
*
|
|
67
|
+
* @defaultValue `"Show password"`
|
|
68
|
+
*/
|
|
69
|
+
revealPasswordLabel?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Controlled text value.
|
|
72
|
+
*
|
|
73
|
+
* Omit for browser-managed state. Supplying the property, even as `undefined`, makes the
|
|
74
|
+
* field controlled when it is constructed; `undefined` is an empty value.
|
|
75
|
+
*/
|
|
76
|
+
value?: string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Initial value of an uncontrolled field, restored by a form reset.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* This is **not** reactive.
|
|
82
|
+
*/
|
|
83
|
+
defaultValue?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Disable editing and form participation.
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue `false`
|
|
88
|
+
*/
|
|
89
|
+
disabled?: boolean | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Prevent editing while keeping the field focusable and in its form.
|
|
92
|
+
*
|
|
93
|
+
* @defaultValue `false`
|
|
94
|
+
*/
|
|
95
|
+
readOnly?: boolean | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Require a non-empty value at form submission.
|
|
98
|
+
*
|
|
99
|
+
* The label of a required field ends with an asterisk, which assistive technology skips: the
|
|
100
|
+
* native control conveys that it is required.
|
|
101
|
+
*
|
|
102
|
+
* @defaultValue `false`
|
|
103
|
+
* @see {@link TextFieldProps.noAsterisk}
|
|
104
|
+
*/
|
|
105
|
+
required?: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Omit the asterisk which ends the label of a {@link TextFieldProps.required | required}
|
|
108
|
+
* field.
|
|
109
|
+
*
|
|
110
|
+
* @defaultValue `false`
|
|
111
|
+
*/
|
|
112
|
+
noAsterisk?: boolean | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Form control name.
|
|
115
|
+
*/
|
|
116
|
+
name?: string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Native control id, used by the label.
|
|
119
|
+
*
|
|
120
|
+
* This takes precedence over `attr:id`. When neither is supplied, a unique id is generated.
|
|
121
|
+
*/
|
|
122
|
+
id?: string | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Placeholder text, shown while the field is empty and its label floats.
|
|
125
|
+
*/
|
|
126
|
+
placeholder?: string | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Native autocomplete hint.
|
|
129
|
+
*/
|
|
130
|
+
autocomplete?: string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Native input mode hint.
|
|
133
|
+
*/
|
|
134
|
+
inputMode?: JSX.InputHTMLAttributes<HTMLInputElement>["inputMode"];
|
|
135
|
+
/**
|
|
136
|
+
* Native validation pattern.
|
|
137
|
+
*/
|
|
138
|
+
pattern?: string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Native minimum, for number, date and time fields.
|
|
141
|
+
*/
|
|
142
|
+
min?: string | number | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Native maximum, for number, date and time fields.
|
|
145
|
+
*/
|
|
146
|
+
max?: string | number | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Native step, for number, date and time fields.
|
|
149
|
+
*/
|
|
150
|
+
step?: string | number | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Minimum number of visible lines of a multiline field.
|
|
153
|
+
*
|
|
154
|
+
* @defaultValue `1`
|
|
155
|
+
*/
|
|
156
|
+
rows?: number | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Native column count of a multiline field.
|
|
159
|
+
*/
|
|
160
|
+
cols?: number | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Native maximum text length.
|
|
163
|
+
*
|
|
164
|
+
* A positive maximum renders a character counter after the supporting text.
|
|
165
|
+
*/
|
|
166
|
+
maxLength?: number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Native minimum text length.
|
|
169
|
+
*/
|
|
170
|
+
minLength?: number | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Native spell-checking hint.
|
|
173
|
+
*/
|
|
174
|
+
spellCheck?: boolean | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Notify the parent after a native value edit.
|
|
177
|
+
*
|
|
178
|
+
* `onValueChange`, `onTextChange`, `onChange` run in that order; the same function supplied
|
|
179
|
+
* to multiple aliases runs once. Controlled values are synchronized after callbacks, so update
|
|
180
|
+
* the controlled property to accept the edit. An unchanged native value retains its caret and
|
|
181
|
+
* intermediate number-editing state. Uncommitted composition (IME) text is reported with an
|
|
182
|
+
* `event` whose `isComposing` is `true`; a controlled value is applied to the native value
|
|
183
|
+
* only after the composition ends. `preventDefault()` in these callbacks does not roll back
|
|
184
|
+
* the native value.
|
|
185
|
+
*
|
|
186
|
+
* @see {@link TextFieldProps.value}
|
|
187
|
+
*/
|
|
188
|
+
onValueChange?: TextFieldChangeHandler | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Alias for {@link TextFieldProps.onValueChange}.
|
|
191
|
+
*/
|
|
192
|
+
onTextChange?: TextFieldChangeHandler | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Alias for {@link TextFieldProps.onValueChange}.
|
|
195
|
+
*/
|
|
196
|
+
onChange?: TextFieldChangeHandler | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Show the error state without error text.
|
|
199
|
+
*
|
|
200
|
+
* @defaultValue `false`
|
|
201
|
+
*/
|
|
202
|
+
invalid?: boolean | undefined;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Additional attributes and content of a text field rendered on the server by a derived
|
|
206
|
+
* component.
|
|
207
|
+
*
|
|
208
|
+
* @see {@link renderTextField}
|
|
209
|
+
*/
|
|
210
|
+
export interface TextFieldServerExtension {
|
|
211
|
+
/**
|
|
212
|
+
* CSS class added to the root element.
|
|
213
|
+
*/
|
|
214
|
+
className: string;
|
|
215
|
+
/**
|
|
216
|
+
* Id of the label element.
|
|
217
|
+
*/
|
|
218
|
+
labelId: string;
|
|
219
|
+
/**
|
|
220
|
+
* Attributes added to the native control.
|
|
221
|
+
*/
|
|
222
|
+
controlAttributes: Record<string, string>;
|
|
223
|
+
/**
|
|
224
|
+
* Create the content rendered after the field's supporting text.
|
|
225
|
+
*
|
|
226
|
+
* The content is created where it is nested, after the rest of the field.
|
|
227
|
+
*
|
|
228
|
+
* @returns rendered content
|
|
229
|
+
*/
|
|
230
|
+
content: () => JSX.Element;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Render a text field on the server.
|
|
234
|
+
*
|
|
235
|
+
* The structure matches {@link TextFieldController.render}; every attribute is serialized from
|
|
236
|
+
* the initial properties. Hydration identifies elements by the order in which they are created,
|
|
237
|
+
* so this creates them in the client's order: the controller generates its ids and resolves the
|
|
238
|
+
* error and supporting slots when it is constructed, *before* it renders; every other slot and
|
|
239
|
+
* element is created where it is nested, in document order.
|
|
240
|
+
*
|
|
241
|
+
* A derived component extends the field through `extend`, which is invoked after the field
|
|
242
|
+
* generated its ids and resolved its error and supporting slots, matching a derived controller
|
|
243
|
+
* whose constructor runs after the text-field constructor.
|
|
244
|
+
*
|
|
245
|
+
* @param elemProps - element properties
|
|
246
|
+
* @param localProps - local component properties
|
|
247
|
+
* @param extend - function returning additional control attributes and content of a derived
|
|
248
|
+
* component
|
|
249
|
+
* @returns rendered element
|
|
250
|
+
*/
|
|
251
|
+
export declare function renderTextField(elemProps: ElementDomProps<TextFieldProps>, localProps: PickLocalDomProps<TextFieldProps>, extend?: () => TextFieldServerExtension): JSX.Element;
|
|
252
|
+
/**
|
|
253
|
+
* Client controller of a {@link TextField}.
|
|
254
|
+
*
|
|
255
|
+
* The rendered element tree is static. Every attribute, class and value is applied by this
|
|
256
|
+
* controller; slots are inserted as reactive children. Native attributes the controller applies
|
|
257
|
+
* through {@link DomController.setAttribute} follow the native control when a multiline change
|
|
258
|
+
* replaces it. Once mounted, the controller publishes the inline size of the floating label on
|
|
259
|
+
* the root, from which an outlined field sizes the notch of its outline ({@link
|
|
260
|
+
* ./base#observeLabelInlineSize}).
|
|
261
|
+
*
|
|
262
|
+
* # Value
|
|
263
|
+
*
|
|
264
|
+
* Uncontrolled fields keep their native value; their `defaultValue` is applied once, as the
|
|
265
|
+
* native default restored by a form reset. Controlled fields mirror their value into the native
|
|
266
|
+
* default, so a form reset restores the controlled value without script. A native value edited
|
|
267
|
+
* before hydration is retained by uncontrolled fields.
|
|
268
|
+
*
|
|
269
|
+
* Composition (IME) input is reported but never overwritten: a controlled value is applied to the
|
|
270
|
+
* native value only after the composition ends.
|
|
271
|
+
*/
|
|
272
|
+
export declare class TextFieldController<P extends TextFieldProps = TextFieldProps> extends DomController<P> {
|
|
273
|
+
#private;
|
|
274
|
+
/**
|
|
275
|
+
* Construct a new `TextFieldController`.
|
|
276
|
+
*
|
|
277
|
+
* @param props - component properties
|
|
278
|
+
*/
|
|
279
|
+
constructor(props: P);
|
|
280
|
+
/**
|
|
281
|
+
* Commit a value chosen by the user other than through native editing.
|
|
282
|
+
*
|
|
283
|
+
* An uncontrolled field applies the value; a controlled field reports it and applies the
|
|
284
|
+
* controlled value the parent returns. Value-change callbacks run as for a native edit.
|
|
285
|
+
*
|
|
286
|
+
* @param value - committed value
|
|
287
|
+
* @param event - originating event
|
|
288
|
+
*/
|
|
289
|
+
protected commitValue(value: string, event: Event): void;
|
|
290
|
+
/**
|
|
291
|
+
* Apply local properties to component state and styling.
|
|
292
|
+
*
|
|
293
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
294
|
+
*/
|
|
295
|
+
protected applyComponentProps(): void;
|
|
296
|
+
/**
|
|
297
|
+
* Handle function element replacement before the controller reference is updated.
|
|
298
|
+
*
|
|
299
|
+
* The first control receives the initial value. A control replacing another, when the
|
|
300
|
+
* `multiline` property changes, receives the value and native default of the previous one.
|
|
301
|
+
*
|
|
302
|
+
* @param element - new function element, or `null` when absent
|
|
303
|
+
* @see {@link ../dom/client#DomController.onFunctionElementChanged}
|
|
304
|
+
*/
|
|
305
|
+
protected onFunctionElementChanged(element: FunctionElement<P> | null): void;
|
|
306
|
+
/**
|
|
307
|
+
* Render the component's element tree.
|
|
308
|
+
*
|
|
309
|
+
* The tree is static, structurally matching {@link renderTextField}. Slots are reactive
|
|
310
|
+
* children; the native control is replaced when {@link TextFieldProps.multiline} changes,
|
|
311
|
+
* and the password visibility toggle is inserted while the field has one.
|
|
312
|
+
*
|
|
313
|
+
* @param children - nested component children, possibly an accessor
|
|
314
|
+
* @param funcRef - callback receiving the native function element
|
|
315
|
+
* @returns rendered component elements
|
|
316
|
+
* @see {@link ../dom/client#DomController.render}
|
|
317
|
+
*/
|
|
318
|
+
protected render(children: JSX.Element, funcRef?: (elem: FunctionElement<P>) => void): JSX.Element;
|
|
319
|
+
/**
|
|
320
|
+
* Label element, once rendered.
|
|
321
|
+
*
|
|
322
|
+
* @returns label element, or `null` before the field is rendered
|
|
323
|
+
*/
|
|
324
|
+
protected get labelElement(): HTMLLabelElement | null;
|
|
325
|
+
/**
|
|
326
|
+
* Render additional content after the supporting text.
|
|
327
|
+
*
|
|
328
|
+
* Derived components override this to add content, which must structurally match the content
|
|
329
|
+
* of the {@link TextFieldServerExtension | server extension}.
|
|
330
|
+
*
|
|
331
|
+
* @returns additional content, if any
|
|
332
|
+
*/
|
|
333
|
+
protected renderExtension(): JSX.Element;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Material 3 text field.
|
|
337
|
+
*
|
|
338
|
+
* Text fields let users enter and edit text. The native input (or textarea, for {@link
|
|
339
|
+
* TextFieldProps.multiline | multiline} fields) keeps its semantics, validation and form
|
|
340
|
+
* participation; the field adds the Material container, floating label, icons, prefix and suffix,
|
|
341
|
+
* supporting text, character counter and, for passwords, a visibility toggle.
|
|
342
|
+
*
|
|
343
|
+
* # States
|
|
344
|
+
*
|
|
345
|
+
* The label rests inside an empty, unfocused field and floats when the field is focused or
|
|
346
|
+
* populated; placeholder, prefix and suffix show only while the label floats. As in material-web
|
|
347
|
+
* (`field.ts`), a resting (body-large) and a floating (body-small) label show text laid out at
|
|
348
|
+
* the size of either state; copies of the label carry the motion between them. Hovering the
|
|
349
|
+
* container and focusing the control apply the hover and focus colors; focus also thickens the
|
|
350
|
+
* active indicator or outline. {@link TextFieldProps.invalid | Invalid} fields and fields with
|
|
351
|
+
* {@link InputFieldSlots.errorText | error text} show the error colors and set `aria-invalid`;
|
|
352
|
+
* error text replaces the supporting text. Disabled fields dim their content and ignore pointer
|
|
353
|
+
* input.
|
|
354
|
+
*
|
|
355
|
+
* # Design
|
|
356
|
+
*
|
|
357
|
+
* Design is controlled through the [`cw-TextField`](./text-field.yaml) component design
|
|
358
|
+
* attribute, with the `filled` (default) and `outlined` themes selected by {@link
|
|
359
|
+
* TextFieldProps.variant | `props.variant`}. The root element has the `cw-TextField` class,
|
|
360
|
+
* `cw-TextField-disabled`, `cw-TextField-readOnly` and `cw-TextField-error` while in the
|
|
361
|
+
* respective state.
|
|
362
|
+
*
|
|
363
|
+
* # Accessibility
|
|
364
|
+
*
|
|
365
|
+
* The floating label is associated with the native control, and alone renders the label slot,
|
|
366
|
+
* which may therefore hold a node constructed once, such as a cached element; the resting label
|
|
367
|
+
* and the moving copies draw clones of its content and are hidden from assistive technology.
|
|
368
|
+
* Supporting text and the character counter describe the native control. Supporting text is a
|
|
369
|
+
* polite live region, so changed error text is announced. The label of a {@link
|
|
370
|
+
* TextFieldProps.required | required} field ends with an asterisk, as in material-web (`field.ts`
|
|
371
|
+
* `renderLabel`), which is hidden from assistive technology since the native control conveys that
|
|
372
|
+
* it is required; {@link TextFieldProps.noAsterisk} omits it. The password visibility toggle has a
|
|
373
|
+
* constant name and exposes its state through `aria-pressed`.
|
|
374
|
+
*
|
|
375
|
+
* @param props - component properties
|
|
376
|
+
* @returns rendered component elements
|
|
377
|
+
* @example
|
|
378
|
+
* ```tsx
|
|
379
|
+
* <TextField
|
|
380
|
+
* label="Email"
|
|
381
|
+
* type="email"
|
|
382
|
+
* variant="outlined"
|
|
383
|
+
* value={email()}
|
|
384
|
+
* onValueChange={setEmail}
|
|
385
|
+
* errorText={valid() ? undefined : "Enter an email address"}
|
|
386
|
+
* />
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
export declare const TextField: DomComponent<TextFieldProps>;
|
|
390
|
+
/**
|
|
391
|
+
* Outlined {@link TextField}.
|
|
392
|
+
*
|
|
393
|
+
* @param props - component properties
|
|
394
|
+
* @returns rendered component elements
|
|
395
|
+
*/
|
|
396
|
+
export declare function OutlinedTextField(props: Parameters<typeof TextField>[0]): JSX.Element;
|
|
397
|
+
/**
|
|
398
|
+
* Filled {@link TextField}.
|
|
399
|
+
*
|
|
400
|
+
* @param props - component properties
|
|
401
|
+
* @returns rendered component elements
|
|
402
|
+
*/
|
|
403
|
+
export declare function FilledTextField(props: Parameters<typeof TextField>[0]): JSX.Element;
|
|
404
|
+
/**
|
|
405
|
+
* Password {@link TextField} with a password visibility toggle.
|
|
406
|
+
*
|
|
407
|
+
* @param props - component properties
|
|
408
|
+
* @returns rendered component elements
|
|
409
|
+
*/
|
|
410
|
+
export declare function PasswordField(props: Omit<Parameters<typeof TextField>[0], "secure" | "type">): JSX.Element;
|
|
411
|
+
/**
|
|
412
|
+
* Alias for {@link PasswordField}.
|
|
413
|
+
*/
|
|
414
|
+
export declare const SecureField: typeof PasswordField;
|
|
415
|
+
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps } from "..";
|
|
3
|
+
import type { InputValueChangeHandler } from "./base";
|
|
4
|
+
import "./time-picker.css";
|
|
5
|
+
/**
|
|
6
|
+
* Translatable labels of a {@link TimePicker}.
|
|
7
|
+
*
|
|
8
|
+
* The defaults follow the English strings of Compose Material 3 where it defines one.
|
|
9
|
+
*/
|
|
10
|
+
export interface TimePickerLabels {
|
|
11
|
+
/**
|
|
12
|
+
* Headline, which also names the time selectors.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue `"Select time"`
|
|
15
|
+
*/
|
|
16
|
+
selectTime: string;
|
|
17
|
+
/**
|
|
18
|
+
* Name of the hour selector, input and dial face, and supporting text of the hour input.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue `"Hour"`
|
|
21
|
+
*/
|
|
22
|
+
hour: string;
|
|
23
|
+
/**
|
|
24
|
+
* Name of the minute selector, input and dial face, and supporting text of the minute input.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `"Minute"`
|
|
27
|
+
*/
|
|
28
|
+
minute: string;
|
|
29
|
+
/**
|
|
30
|
+
* Label of the morning period.
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue `"AM"`
|
|
33
|
+
*/
|
|
34
|
+
am: string;
|
|
35
|
+
/**
|
|
36
|
+
* Label of the afternoon period.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `"PM"`
|
|
39
|
+
*/
|
|
40
|
+
pm: string;
|
|
41
|
+
/**
|
|
42
|
+
* Name of the period selector (Compose `Strings.TimePickerPeriodToggle`).
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue `"Select AM or PM"`
|
|
45
|
+
*/
|
|
46
|
+
selectPeriod: string;
|
|
47
|
+
/**
|
|
48
|
+
* Error of an hour input outside the hours of a 12-hour picker.
|
|
49
|
+
*
|
|
50
|
+
* @defaultValue `"Hour must be 1–12"`
|
|
51
|
+
*/
|
|
52
|
+
hourError: string;
|
|
53
|
+
/**
|
|
54
|
+
* Error of an hour input outside the hours of a 24-hour picker.
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue `"Hour must be 0–23"`
|
|
57
|
+
*/
|
|
58
|
+
hour24Error: string;
|
|
59
|
+
/**
|
|
60
|
+
* Error of a minute input outside the minutes of an hour.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue `"Minute must be 0–59"`
|
|
63
|
+
*/
|
|
64
|
+
minuteError: string;
|
|
65
|
+
/**
|
|
66
|
+
* Name of the mode toggle while the clock dial is shown.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue `"Switch to time input"`
|
|
69
|
+
*/
|
|
70
|
+
switchToInput: string;
|
|
71
|
+
/**
|
|
72
|
+
* Name of the mode toggle while the time inputs are shown.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue `"Switch to clock"`
|
|
75
|
+
*/
|
|
76
|
+
switchToClock: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* {@link TimePicker} component properties.
|
|
80
|
+
*/
|
|
81
|
+
export type TimePickerProps = DomProps<HTMLDivElement, JSX.HTMLAttributes<HTMLDivElement>> & {
|
|
82
|
+
/**
|
|
83
|
+
* Current controlled time in 24-hour `HH:mm` form.
|
|
84
|
+
*
|
|
85
|
+
* Supplying this property, including `undefined`, selects controlled operation at
|
|
86
|
+
* construction. Update it from {@link TimePickerProps.onChange} to accept an edit. Values
|
|
87
|
+
* which are not `HH:mm` times resolve to `"00:00"`; {@link TimePickerProps.hourCycle} changes
|
|
88
|
+
* presentation only.
|
|
89
|
+
*/
|
|
90
|
+
value?: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Initial value of an uncontrolled picker, restored when its form resets.
|
|
93
|
+
*
|
|
94
|
+
* @defaultValue `"00:00"`
|
|
95
|
+
*/
|
|
96
|
+
defaultValue?: string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Hour cycle: hours from 1 to 12 with a period selector, or hours from 0 to 23.
|
|
99
|
+
*
|
|
100
|
+
* Values remain 24-hour `HH:mm` times. Without this property, the picker follows the hour
|
|
101
|
+
* cycle of its {@link TimePickerProps.locale | locale}, as Compose follows the 24-hour setting
|
|
102
|
+
* of the system (`TimePicker.kt:1412-1415`).
|
|
103
|
+
*
|
|
104
|
+
* @defaultValue hour cycle of `locale`
|
|
105
|
+
*/
|
|
106
|
+
hourCycle?: "h12" | "h23" | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Locale of the numerals and of the default hour cycle.
|
|
109
|
+
*
|
|
110
|
+
* @defaultValue `"en-US"`
|
|
111
|
+
*/
|
|
112
|
+
locale?: string | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Layout: the time selectors above the clock dial, or beside it.
|
|
115
|
+
*
|
|
116
|
+
* A landscape picker narrower than its landscape width, and the time inputs, use the
|
|
117
|
+
* portrait layout.
|
|
118
|
+
*
|
|
119
|
+
* @defaultValue `"portrait"`
|
|
120
|
+
*/
|
|
121
|
+
orientation?: "portrait" | "landscape" | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Initial display mode: the clock dial, or the time inputs.
|
|
124
|
+
*
|
|
125
|
+
* @defaultValue `"clock"`
|
|
126
|
+
*/
|
|
127
|
+
defaultDisplayMode?: "clock" | "input" | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Disable the controls and form submission.
|
|
130
|
+
*
|
|
131
|
+
* @defaultValue `false`
|
|
132
|
+
*/
|
|
133
|
+
disabled?: boolean | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Keep the value in forms while preventing edits.
|
|
136
|
+
*
|
|
137
|
+
* @defaultValue `false`
|
|
138
|
+
*/
|
|
139
|
+
readOnly?: boolean | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Form field name of the `HH:mm` value; a picker without a name is not submitted.
|
|
142
|
+
*/
|
|
143
|
+
name?: string | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Id of the form submitting the value, when it is not the nearest form ancestor.
|
|
146
|
+
*/
|
|
147
|
+
form?: string | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Translations of the picker labels.
|
|
150
|
+
*
|
|
151
|
+
* @defaultValue English labels, see {@link TimePickerLabels}
|
|
152
|
+
*/
|
|
153
|
+
labels?: Partial<TimePickerLabels> | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Notify the parent after the time is edited.
|
|
156
|
+
*
|
|
157
|
+
* An edit calls this once with the new `HH:mm` time, and an edit which leaves the time
|
|
158
|
+
* unchanged does not call it; dragging the dial reports each time it passes. Controlled values
|
|
159
|
+
* remain until the parent updates {@link TimePickerProps.value}.
|
|
160
|
+
*/
|
|
161
|
+
onChange?: InputValueChangeHandler<string> | undefined;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Material 3 time picker, with a clock dial and time inputs.
|
|
165
|
+
*
|
|
166
|
+
* Time pickers select a time of day. The time selectors show the hour and the minute, the period
|
|
167
|
+
* selector the morning or afternoon period of a 12-hour picker, and the clock dial edits the
|
|
168
|
+
* selected field. Values and form submissions are 24-hour `HH:mm` times, independently of the
|
|
169
|
+
* hour cycle and of the locale, whose numerals the picker shows. Compose a picker with a {@link
|
|
170
|
+
* ./picker-dialog#PickerDialog} for a modal time picker.
|
|
171
|
+
*
|
|
172
|
+
* # States
|
|
173
|
+
*
|
|
174
|
+
* A tap on the dial selects the hour nearest to it, or the nearest five minutes, and the
|
|
175
|
+
* selector hand rotates there with the default spatial spring; after an hour, the dial switches
|
|
176
|
+
* to the minutes 100ms later. A drag moves the hand with the pointer and selects the hour or the
|
|
177
|
+
* minute under it; on release, the hand settles with the spring, and a dragged hour switches to
|
|
178
|
+
* the minutes. The dial follows a pointer pressed on it until its release, also outside of the
|
|
179
|
+
* dial. A 24-hour dial shows hours 0 to 11 on its outer ring and 12 to 23 on its inner ring. The
|
|
180
|
+
* numbers of the hour and minute faces crossfade when the field changes.
|
|
181
|
+
*
|
|
182
|
+
* The time selectors, the periods and each dial face are radio groups: arrow keys move the
|
|
183
|
+
* selection and the focus together, and Home and End select the first and the last number of a
|
|
184
|
+
* dial face. A dial number activated with the keyboard selects its time, and an hour switches the
|
|
185
|
+
* dial to the minutes. The mode toggle shows the time inputs instead of the dial; an input
|
|
186
|
+
* holding a number its field cannot show displays an error and keeps the time.
|
|
187
|
+
*
|
|
188
|
+
* `disabled` disables the controls and form submission; `readOnly` keeps the form value but
|
|
189
|
+
* ignores edits. Edits are also ignored while the time inputs match `:disabled`, as within a
|
|
190
|
+
* disabled `fieldset`, which cancels a drag on the dial.
|
|
191
|
+
*
|
|
192
|
+
* # Design
|
|
193
|
+
*
|
|
194
|
+
* Time picker design is controlled through the [`cw-TimePicker`](./time-picker.yaml) component
|
|
195
|
+
* design attribute. The root receives `cw-TimePicker-landscape`, `cw-TimePicker-inputMode`,
|
|
196
|
+
* `cw-TimePicker-disabled` and `cw-TimePicker-readOnly`. The time selectors, periods, dial numbers
|
|
197
|
+
* and mode toggle paint the state layer of their hover, focus and press states.
|
|
198
|
+
*
|
|
199
|
+
* # Elements
|
|
200
|
+
*
|
|
201
|
+
* The root contains the headline (`cw-TimePicker-title`), the hour and minute fields
|
|
202
|
+
* (`cw-TimePicker-time`, `cw-TimePicker-field`) with their time selectors
|
|
203
|
+
* (`cw-TimePicker-selector`) and inputs (`cw-TimePicker-input`), the period selector
|
|
204
|
+
* (`cw-TimePicker-period`), the clock dial (`cw-TimePicker-dial`) with the selector hand
|
|
205
|
+
* (`cw-TimePicker-hand`) and the numbers (`cw-TimePicker-number`) of its faces, the mode toggle
|
|
206
|
+
* (`cw-TimePicker-mode`), a hidden input submitting the value under `name`, and the children. As
|
|
207
|
+
* in Compose, the fields are laid out from left to right in every layout direction.
|
|
208
|
+
*
|
|
209
|
+
* @param props - component properties
|
|
210
|
+
* @returns rendered component elements
|
|
211
|
+
*/
|
|
212
|
+
export declare const TimePicker: DomComponent<TimePickerProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function invoked once per animation frame of a window.
|
|
3
|
+
*
|
|
4
|
+
* Every listener of a window receives the same frame timestamp, so motions driven by one window
|
|
5
|
+
* share one clock.
|
|
6
|
+
*
|
|
7
|
+
* @param time - frame timestamp, in milliseconds, on the window's animation-frame clock
|
|
8
|
+
* @see {@link subscribeMotionFrames}
|
|
9
|
+
*/
|
|
10
|
+
export type MotionFrameListener = (time: DOMHighResTimeStamp) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Invoke a listener on every animation frame of a window until it is unsubscribed.
|
|
13
|
+
*
|
|
14
|
+
* All listeners of a window share a single animation-frame request, receive the same frame
|
|
15
|
+
* timestamp, and run within one animation-frame callback in subscription order. A listener
|
|
16
|
+
* subscribed during a frame first runs on the next frame; a listener unsubscribed during a frame
|
|
17
|
+
* does not run again, even later within the same frame. Subscribing a listener which is already
|
|
18
|
+
* subscribed has no effect beyond returning another function which removes it.
|
|
19
|
+
*
|
|
20
|
+
* Listeners should only write styles. Reading layout from a listener forces a synchronous layout
|
|
21
|
+
* after every listener which wrote styles before it, defeating the batching.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* const unsubscribe = subscribeMotionFrames(window, (time) => {
|
|
25
|
+
* elem.style.setProperty("--progress", `${progressAt(time)}`);
|
|
26
|
+
* if (progressAt(time) === 1)
|
|
27
|
+
* unsubscribe();
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param view - window whose animation frames invoke `listener`
|
|
32
|
+
* @param listener - function to invoke once per frame
|
|
33
|
+
* @returns function which unsubscribes `listener`; calling it more than once has no effect
|
|
34
|
+
* @throws {@link Error} `view` does not provide `requestAnimationFrame()`
|
|
35
|
+
*/
|
|
36
|
+
export declare function subscribeMotionFrames(view: Window, listener: MotionFrameListener): () => void;
|