@pg-labs-incubator/cobweb 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +163 -0
- package/README.md +82 -2
- package/package.json +112 -3
- package/src/action/action.yaml +291 -0
- package/src/action/button-group.yaml +56 -0
- package/src/action/button.yaml +239 -0
- package/src/action/split-button.yaml +87 -0
- package/src/color/color.yaml +181 -0
- package/src/color/palette.yaml +147 -0
- package/src/container/card.yaml +170 -0
- package/src/container/corner-radius.yaml +50 -0
- package/src/container/elevation.yaml +19 -0
- package/src/design.yaml +41 -0
- package/src/feedback/feedback.yaml +225 -0
- package/src/icon/icon-font.yaml +28 -0
- package/src/icon/icon.yaml +31 -0
- package/src/input/date-picker.yaml +144 -0
- package/src/input/date-range-input.yaml +162 -0
- package/src/input/range-slider.yaml +161 -0
- package/src/input/select.yaml +230 -0
- package/src/input/slider.yaml +172 -0
- package/src/input/text-field.yaml +240 -0
- package/src/input/time-picker.yaml +220 -0
- package/src/motion/motion.yaml +371 -0
- package/src/navigation/app-bar.yaml +147 -0
- package/src/navigation/navigation.yaml +339 -0
- package/src/navigation/scroll.yaml +23 -0
- package/src/navigation/search.yaml +112 -0
- package/src/navigation/tabs.yaml +144 -0
- package/src/navigation/toolbar.yaml +130 -0
- package/src/selection/checkbox.yaml +162 -0
- package/src/selection/chip.yaml +219 -0
- package/src/selection/radio.yaml +125 -0
- package/src/selection/segmented-group.yaml +11 -0
- package/src/selection/segmented.yaml +69 -0
- package/src/selection/switch.yaml +209 -0
- package/src/spacing/measurement.yaml +80 -0
- package/src/state/state.yaml +38 -0
- package/src/surface/surface.yaml +483 -0
- package/src/text/line-height.yaml +144 -0
- package/src/text/typeface.yaml +31 -0
- package/src/text/typescale.yaml +726 -0
- package/target/esbuild/action/action.css +1 -0
- package/target/esbuild/action/base.jsx +1 -0
- package/target/esbuild/action/button.jsx +17 -0
- package/target/esbuild/action/fab-menu-context.jsx +1 -0
- package/target/esbuild/action/fab-menu.jsx +15 -0
- package/target/esbuild/action/fab.jsx +7 -0
- package/target/esbuild/action/group.jsx +22 -0
- package/target/esbuild/action/icon-button.jsx +5 -0
- package/target/esbuild/action/index.jsx +1 -0
- package/target/esbuild/action/split-button.jsx +12 -0
- package/target/esbuild/color/contrast.jsx +1 -0
- package/target/esbuild/color/dynamic.jsx +1 -0
- package/target/esbuild/color/hct.jsx +1 -0
- package/target/esbuild/color/index.css +1 -0
- package/target/esbuild/color/index.jsx +1 -0
- package/target/esbuild/color/palette.jsx +1 -0
- package/target/esbuild/color/scheme.jsx +1 -0
- package/target/esbuild/color/temperature.jsx +1 -0
- package/target/esbuild/container/card.css +1 -0
- package/target/esbuild/container/card.jsx +1 -0
- package/target/esbuild/container/elevation-shadow.css +1 -0
- package/target/esbuild/container/elevation-shadow.jsx +1 -0
- package/target/esbuild/container/index.jsx +1 -0
- package/target/esbuild/dom/client.jsx +1 -0
- package/target/esbuild/dom/index.jsx +1 -0
- package/target/esbuild/dom/server.jsx +1 -0
- package/target/esbuild/dom/types.jsx +1 -0
- package/target/esbuild/feedback/badge.jsx +15 -0
- package/target/esbuild/feedback/feedback.css +1 -0
- package/target/esbuild/feedback/focus.jsx +1 -0
- package/target/esbuild/feedback/index.jsx +1 -0
- package/target/esbuild/feedback/loading.jsx +7 -0
- package/target/esbuild/feedback/observe.jsx +1 -0
- package/target/esbuild/feedback/progress.jsx +35 -0
- package/target/esbuild/feedback/snackbar.jsx +23 -0
- package/target/esbuild/feedback/tooltip.jsx +24 -0
- package/target/esbuild/icon/icon.css +1 -0
- package/target/esbuild/icon/icon.jsx +1 -0
- package/target/esbuild/icon/index.jsx +1 -0
- package/target/esbuild/index.css +1 -0
- package/target/esbuild/index.jsx +1 -0
- package/target/esbuild/input/autocomplete.jsx +5 -0
- package/target/esbuild/input/base.jsx +4 -0
- package/target/esbuild/input/date-picker.css +1 -0
- package/target/esbuild/input/date-picker.jsx +104 -0
- package/target/esbuild/input/date-range-input.css +1 -0
- package/target/esbuild/input/date-time.jsx +21 -0
- package/target/esbuild/input/index.css +1 -0
- package/target/esbuild/input/index.jsx +1 -0
- package/target/esbuild/input/paired-input.jsx +1 -0
- package/target/esbuild/input/picker-dialog.css +1 -0
- package/target/esbuild/input/picker-dialog.jsx +14 -0
- package/target/esbuild/input/select.css +1 -0
- package/target/esbuild/input/select.jsx +63 -0
- package/target/esbuild/input/slider.css +1 -0
- package/target/esbuild/input/slider.jsx +51 -0
- package/target/esbuild/input/text-field.css +1 -0
- package/target/esbuild/input/text-field.jsx +67 -0
- package/target/esbuild/input/time-picker.css +1 -0
- package/target/esbuild/input/time-picker.jsx +29 -0
- package/target/esbuild/motion/frame.jsx +1 -0
- package/target/esbuild/motion/index.css +1 -0
- package/target/esbuild/motion/index.jsx +1 -0
- package/target/esbuild/motion/material.jsx +1 -0
- package/target/esbuild/motion/motion.jsx +1 -0
- package/target/esbuild/motion/spring.jsx +1 -0
- package/target/esbuild/motion/transition.css +1 -0
- package/target/esbuild/motion/transition.jsx +1 -0
- package/target/esbuild/motion/velocity.jsx +1 -0
- package/target/esbuild/navigation/app-bar.jsx +51 -0
- package/target/esbuild/navigation/base.jsx +1 -0
- package/target/esbuild/navigation/drawer.jsx +25 -0
- package/target/esbuild/navigation/index.jsx +1 -0
- package/target/esbuild/navigation/navigation.css +1 -0
- package/target/esbuild/navigation/navigation.jsx +29 -0
- package/target/esbuild/navigation/scroll.jsx +1 -0
- package/target/esbuild/navigation/search.jsx +29 -0
- package/target/esbuild/navigation/tabs.jsx +7 -0
- package/target/esbuild/navigation/toolbar.jsx +23 -0
- package/target/esbuild/selection/base.jsx +1 -0
- package/target/esbuild/selection/checkbox.jsx +14 -0
- package/target/esbuild/selection/chip.jsx +23 -0
- package/target/esbuild/selection/index.jsx +1 -0
- package/target/esbuild/selection/radio.jsx +9 -0
- package/target/esbuild/selection/segmented.jsx +15 -0
- package/target/esbuild/selection/selection.css +1 -0
- package/target/esbuild/selection/switch.jsx +14 -0
- package/target/esbuild/shape/corner-rounding.jsx +1 -0
- package/target/esbuild/shape/cubic.jsx +1 -0
- package/target/esbuild/shape/index.jsx +1 -0
- package/target/esbuild/shape/material-shapes.jsx +1 -0
- package/target/esbuild/shape/morph.jsx +1 -0
- package/target/esbuild/shape/path.jsx +1 -0
- package/target/esbuild/shape/point.jsx +1 -0
- package/target/esbuild/shape/rounded-polygon.jsx +1 -0
- package/target/esbuild/shape/shapes.jsx +1 -0
- package/target/esbuild/spacing/index.jsx +1 -0
- package/target/esbuild/state/component.css +1 -0
- package/target/esbuild/state/component.jsx +1 -0
- package/target/esbuild/state/controller.jsx +1 -0
- package/target/esbuild/state/index.jsx +1 -0
- package/target/esbuild/state/ripple.jsx +1 -0
- package/target/esbuild/state/state.jsx +1 -0
- package/target/esbuild/state/style.jsx +1 -0
- package/target/esbuild/surface/carousel-layout.jsx +1 -0
- package/target/esbuild/surface/carousel.css +1 -0
- package/target/esbuild/surface/carousel.jsx +10 -0
- package/target/esbuild/surface/dialog.jsx +35 -0
- package/target/esbuild/surface/divider.jsx +1 -0
- package/target/esbuild/surface/drag.jsx +1 -0
- package/target/esbuild/surface/gestures.css +1 -0
- package/target/esbuild/surface/gestures.jsx +7 -0
- package/target/esbuild/surface/index.css +1 -0
- package/target/esbuild/surface/index.jsx +1 -0
- package/target/esbuild/surface/interactive.jsx +1 -0
- package/target/esbuild/surface/list-patterns.jsx +26 -0
- package/target/esbuild/surface/list.css +1 -0
- package/target/esbuild/surface/list.jsx +9 -0
- package/target/esbuild/surface/menu.css +1 -0
- package/target/esbuild/surface/menu.jsx +12 -0
- package/target/esbuild/surface/scaffold.jsx +47 -0
- package/target/esbuild/surface/sheet.jsx +21 -0
- package/target/esbuild/surface/side-sheet.jsx +17 -0
- package/target/esbuild/surface/slots.jsx +1 -0
- package/target/esbuild/surface/surface.css +1 -0
- package/target/esbuild/surface/surface.jsx +1 -0
- package/target/esbuild/text/index.css +1 -0
- package/target/esbuild/text/index.jsx +1 -0
- package/target/esbuild/text/text.css +1 -0
- package/target/esbuild/text/text.jsx +3 -0
- package/target/esbuild/text/typography.css +1 -0
- package/target/esbuild/text/typography.jsx +1 -0
- package/target/esbuild/util/box-side.jsx +1 -0
- package/target/esbuild/util/debug.jsx +1 -0
- package/target/esbuild/util/dom.jsx +1 -0
- package/target/esbuild/util/event.jsx +1 -0
- package/target/esbuild/util/index.jsx +1 -0
- package/target/esbuild/util/preconditions.jsx +1 -0
- package/target/esbuild/util/reactive.jsx +1 -0
- package/target/tsc/action/action.css.d.ts +3 -0
- package/target/tsc/action/base.d.ts +211 -0
- package/target/tsc/action/button.d.ts +126 -0
- package/target/tsc/action/fab-menu-context.d.ts +16 -0
- package/target/tsc/action/fab-menu.d.ts +112 -0
- package/target/tsc/action/fab.d.ts +98 -0
- package/target/tsc/action/group.d.ts +166 -0
- package/target/tsc/action/icon-button.d.ts +79 -0
- package/target/tsc/action/index.d.ts +24 -0
- package/target/tsc/action/split-button.d.ts +78 -0
- package/target/tsc/color/contrast.d.ts +48 -0
- package/target/tsc/color/dynamic.d.ts +203 -0
- package/target/tsc/color/hct.d.ts +114 -0
- package/target/tsc/color/index.css.d.ts +3 -0
- package/target/tsc/color/index.d.ts +23 -0
- package/target/tsc/color/palette.d.ts +30 -0
- package/target/tsc/color/scheme.d.ts +446 -0
- package/target/tsc/color/temperature.d.ts +24 -0
- package/target/tsc/container/card.css.d.ts +3 -0
- package/target/tsc/container/card.d.ts +110 -0
- package/target/tsc/container/elevation-shadow.css.d.ts +3 -0
- package/target/tsc/container/elevation-shadow.d.ts +23 -0
- package/target/tsc/container/index.d.ts +44 -0
- package/target/tsc/dom/client.d.ts +387 -0
- package/target/tsc/dom/index.d.ts +93 -0
- package/target/tsc/dom/server.d.ts +65 -0
- package/target/tsc/dom/types.d.ts +134 -0
- package/target/tsc/feedback/badge.d.ts +116 -0
- package/target/tsc/feedback/feedback.css.d.ts +3 -0
- package/target/tsc/feedback/focus.d.ts +20 -0
- package/target/tsc/feedback/index.d.ts +17 -0
- package/target/tsc/feedback/loading.d.ts +194 -0
- package/target/tsc/feedback/observe.d.ts +75 -0
- package/target/tsc/feedback/progress.d.ts +281 -0
- package/target/tsc/feedback/snackbar.d.ts +398 -0
- package/target/tsc/feedback/tooltip.d.ts +326 -0
- package/target/tsc/icon/icon.css.d.ts +3 -0
- package/target/tsc/icon/icon.d.ts +69 -0
- package/target/tsc/icon/index.d.ts +13 -0
- package/target/tsc/index.css.d.ts +3 -0
- package/target/tsc/index.d.ts +7 -0
- package/target/tsc/input/autocomplete.d.ts +119 -0
- package/target/tsc/input/base.d.ts +282 -0
- package/target/tsc/input/date-picker.css.d.ts +3 -0
- package/target/tsc/input/date-picker.d.ts +351 -0
- package/target/tsc/input/date-range-input.css.d.ts +3 -0
- package/target/tsc/input/date-time.d.ts +171 -0
- package/target/tsc/input/index.css.d.ts +3 -0
- package/target/tsc/input/index.d.ts +27 -0
- package/target/tsc/input/paired-input.d.ts +435 -0
- package/target/tsc/input/picker-dialog.css.d.ts +3 -0
- package/target/tsc/input/picker-dialog.d.ts +84 -0
- package/target/tsc/input/select.css.d.ts +3 -0
- package/target/tsc/input/select.d.ts +267 -0
- package/target/tsc/input/slider.css.d.ts +3 -0
- package/target/tsc/input/slider.d.ts +372 -0
- package/target/tsc/input/text-field.css.d.ts +3 -0
- package/target/tsc/input/text-field.d.ts +415 -0
- package/target/tsc/input/time-picker.css.d.ts +3 -0
- package/target/tsc/input/time-picker.d.ts +212 -0
- package/target/tsc/motion/frame.d.ts +36 -0
- package/target/tsc/motion/index.css.d.ts +3 -0
- package/target/tsc/motion/index.d.ts +34 -0
- package/target/tsc/motion/material.d.ts +110 -0
- package/target/tsc/motion/motion.d.ts +235 -0
- package/target/tsc/motion/spring.d.ts +223 -0
- package/target/tsc/motion/transition.css.d.ts +3 -0
- package/target/tsc/motion/transition.d.ts +597 -0
- package/target/tsc/motion/velocity.d.ts +54 -0
- package/target/tsc/navigation/app-bar.d.ts +473 -0
- package/target/tsc/navigation/base.d.ts +331 -0
- package/target/tsc/navigation/drawer.d.ts +301 -0
- package/target/tsc/navigation/index.d.ts +25 -0
- package/target/tsc/navigation/navigation.css.d.ts +3 -0
- package/target/tsc/navigation/navigation.d.ts +537 -0
- package/target/tsc/navigation/scroll.d.ts +218 -0
- package/target/tsc/navigation/search.d.ts +332 -0
- package/target/tsc/navigation/tabs.d.ts +497 -0
- package/target/tsc/navigation/toolbar.d.ts +248 -0
- package/target/tsc/selection/base.d.ts +100 -0
- package/target/tsc/selection/checkbox.d.ts +194 -0
- package/target/tsc/selection/chip.d.ts +358 -0
- package/target/tsc/selection/index.d.ts +21 -0
- package/target/tsc/selection/radio.d.ts +198 -0
- package/target/tsc/selection/segmented.d.ts +333 -0
- package/target/tsc/selection/selection.css.d.ts +3 -0
- package/target/tsc/selection/switch.d.ts +165 -0
- package/target/tsc/shape/corner-rounding.d.ts +36 -0
- package/target/tsc/shape/cubic.d.ts +215 -0
- package/target/tsc/shape/index.d.ts +35 -0
- package/target/tsc/shape/material-shapes.d.ts +176 -0
- package/target/tsc/shape/morph.d.ts +91 -0
- package/target/tsc/shape/path.d.ts +177 -0
- package/target/tsc/shape/point.d.ts +165 -0
- package/target/tsc/shape/rounded-polygon.d.ts +289 -0
- package/target/tsc/shape/shapes.d.ts +76 -0
- package/target/tsc/spacing/index.d.ts +19 -0
- package/target/tsc/state/component.css.d.ts +3 -0
- package/target/tsc/state/component.d.ts +276 -0
- package/target/tsc/state/controller.d.ts +257 -0
- package/target/tsc/state/index.d.ts +19 -0
- package/target/tsc/state/ripple.d.ts +50 -0
- package/target/tsc/state/state.d.ts +129 -0
- package/target/tsc/state/style.d.ts +22 -0
- package/target/tsc/surface/carousel-layout.d.ts +212 -0
- package/target/tsc/surface/carousel.css.d.ts +3 -0
- package/target/tsc/surface/carousel.d.ts +231 -0
- package/target/tsc/surface/dialog.d.ts +582 -0
- package/target/tsc/surface/divider.d.ts +92 -0
- package/target/tsc/surface/drag.d.ts +92 -0
- package/target/tsc/surface/gestures.css.d.ts +3 -0
- package/target/tsc/surface/gestures.d.ts +292 -0
- package/target/tsc/surface/index.css.d.ts +3 -0
- package/target/tsc/surface/index.d.ts +29 -0
- package/target/tsc/surface/interactive.d.ts +22 -0
- package/target/tsc/surface/list-patterns.d.ts +384 -0
- package/target/tsc/surface/list.css.d.ts +3 -0
- package/target/tsc/surface/list.d.ts +340 -0
- package/target/tsc/surface/menu.css.d.ts +3 -0
- package/target/tsc/surface/menu.d.ts +590 -0
- package/target/tsc/surface/scaffold.d.ts +337 -0
- package/target/tsc/surface/sheet.d.ts +384 -0
- package/target/tsc/surface/side-sheet.d.ts +183 -0
- package/target/tsc/surface/slots.d.ts +21 -0
- package/target/tsc/surface/surface.css.d.ts +3 -0
- package/target/tsc/surface/surface.d.ts +192 -0
- package/target/tsc/text/index.css.d.ts +3 -0
- package/target/tsc/text/index.d.ts +18 -0
- package/target/tsc/text/text.css.d.ts +3 -0
- package/target/tsc/text/text.d.ts +94 -0
- package/target/tsc/text/typography.css.d.ts +3 -0
- package/target/tsc/text/typography.d.ts +82 -0
- package/target/tsc/util/box-side.d.ts +76 -0
- package/target/tsc/util/debug.d.ts +20 -0
- package/target/tsc/util/dom.d.ts +35 -0
- package/target/tsc/util/event.d.ts +93 -0
- package/target/tsc/util/index.d.ts +12 -0
- package/target/tsc/util/preconditions.d.ts +79 -0
- package/target/tsc/util/reactive.d.ts +36 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent } from "..";
|
|
3
|
+
import type { DialogProps } from "../surface/dialog";
|
|
4
|
+
import "../container/elevation-shadow.css";
|
|
5
|
+
import "./picker-dialog.css";
|
|
6
|
+
/**
|
|
7
|
+
* {@link PickerDialog} component properties.
|
|
8
|
+
*/
|
|
9
|
+
export type PickerDialogProps = Omit<DialogProps, "modal"> & {
|
|
10
|
+
/**
|
|
11
|
+
* Modal pickers open as a modal dialog; docked pickers open as a nonmodal surface attached to
|
|
12
|
+
* {@link PickerDialogProps.anchor}.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue `"modal"`
|
|
15
|
+
*/
|
|
16
|
+
presentation?: "modal" | "docked";
|
|
17
|
+
/**
|
|
18
|
+
* Anchor of a docked picker, usually its text field or the field's trailing button.
|
|
19
|
+
*/
|
|
20
|
+
anchor?: HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
* Render the Cancel and OK actions.
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue `true` for a modal picker, `false` for a docked picker
|
|
25
|
+
*/
|
|
26
|
+
showActions?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Disable confirmation while the draft selection is incomplete or invalid.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue `false`
|
|
31
|
+
*/
|
|
32
|
+
confirmDisabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Content of the confirmation action.
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue `"OK"`
|
|
37
|
+
*/
|
|
38
|
+
confirmLabel?: JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Content of the cancellation action.
|
|
41
|
+
*
|
|
42
|
+
* @defaultValue `"Cancel"`
|
|
43
|
+
*/
|
|
44
|
+
dismissLabel?: JSX.Element;
|
|
45
|
+
/**
|
|
46
|
+
* Handle activation of the confirmation action before closure is requested.
|
|
47
|
+
*
|
|
48
|
+
* Commit the application's draft here. Calling `event.preventDefault()` keeps the picker open.
|
|
49
|
+
* With controlled `open`, the parent must also accept the subsequent `onOpenChange` request.
|
|
50
|
+
*
|
|
51
|
+
* @param event - confirmation button click
|
|
52
|
+
*/
|
|
53
|
+
onConfirm?: (event: MouseEvent) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Handle activation of the cancellation action before closure is requested.
|
|
56
|
+
*
|
|
57
|
+
* Discard the application's draft here. Calling `event.preventDefault()` keeps the picker open.
|
|
58
|
+
* Escape and outside dismissal do not invoke this callback; use the inherited `onOpenChange`
|
|
59
|
+
* callback for close requests or `onClose` for close notifications.
|
|
60
|
+
*
|
|
61
|
+
* @param event - cancellation button click
|
|
62
|
+
*/
|
|
63
|
+
onDismiss?: (event: MouseEvent) => void;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Material 3 picker dialog for a date, date range or time picker.
|
|
67
|
+
*
|
|
68
|
+
* Keep the draft value in the composing component and commit it in
|
|
69
|
+
* {@link PickerDialogProps.onConfirm}. A modal picker is a modal {@link ../surface#Dialog}; a
|
|
70
|
+
* docked picker is a nonmodal surface in the top layer attached below its anchor, dismissed by a
|
|
71
|
+
* press or focus outside it. Both focus the picker's tab-stop date, or their first control, when
|
|
72
|
+
* they open, and expose the controller of their surface, with `open()`, `close()`, `toggle()` and
|
|
73
|
+
* `isOpen()`, through `controllerRef`.
|
|
74
|
+
*
|
|
75
|
+
* # Design
|
|
76
|
+
*
|
|
77
|
+
* Picker dialogs size to their picker, whose design attribute supplies their width. The docked
|
|
78
|
+
* surface uses the large corner radius and the level 3 elevation of the docked date picker. Cancel
|
|
79
|
+
* and OK are text buttons at the bottom end (Compose `DatePickerDialog`).
|
|
80
|
+
*
|
|
81
|
+
* @param props - component properties
|
|
82
|
+
* @returns rendered component elements
|
|
83
|
+
*/
|
|
84
|
+
export declare const PickerDialog: DomComponent<PickerDialogProps>;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps } from "..";
|
|
3
|
+
import type { InputFieldSlots, InputSlot, InputValueChangeHandler, InputVariant } from "./base";
|
|
4
|
+
import { DomController } from "../dom/client";
|
|
5
|
+
import "./text-field.css";
|
|
6
|
+
import "./select.css";
|
|
7
|
+
/**
|
|
8
|
+
* Callback invoked after the selected option changes.
|
|
9
|
+
*/
|
|
10
|
+
export type SelectChangeHandler = InputValueChangeHandler<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Native option data with deterministic server selection.
|
|
13
|
+
*/
|
|
14
|
+
export interface SelectOption {
|
|
15
|
+
/**
|
|
16
|
+
* Native option value submitted by the form and emitted by selection callbacks.
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
/**
|
|
20
|
+
* Text rendered as the option's visible and accessible label.
|
|
21
|
+
*/
|
|
22
|
+
label: string;
|
|
23
|
+
/**
|
|
24
|
+
* Prevent this option from being selected through native interaction.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `false`
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A named group of native options.
|
|
32
|
+
*/
|
|
33
|
+
export interface SelectOptionGroup {
|
|
34
|
+
/**
|
|
35
|
+
* Visible label for the native option group.
|
|
36
|
+
*/
|
|
37
|
+
label: string;
|
|
38
|
+
/**
|
|
39
|
+
* Options rendered within the group, in the supplied order.
|
|
40
|
+
*/
|
|
41
|
+
options: readonly SelectOption[];
|
|
42
|
+
/**
|
|
43
|
+
* Disable native selection of every option in the group.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue `false`
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* {@link Select} component properties.
|
|
51
|
+
*
|
|
52
|
+
* Use `attr:form` to associate the native select with a form outside its ancestors.
|
|
53
|
+
*/
|
|
54
|
+
export type SelectProps = DomProps<HTMLSelectElement, Omit<JSX.SelectHTMLAttributes<HTMLSelectElement>, "defaultValue" | "disabled" | "multiple" | "name" | "required" | "size" | "value">> & Omit<InputFieldSlots, "prefix" | "suffix"> & {
|
|
55
|
+
/**
|
|
56
|
+
* Native option data, including groups.
|
|
57
|
+
*
|
|
58
|
+
* Options are keyed by object identity: an option object retained across updates keeps its
|
|
59
|
+
* element. When supplied, this takes precedence over option children. Data options serialize
|
|
60
|
+
* the initial selection during server rendering; with option children, supply the `selected`
|
|
61
|
+
* attribute for the initial server selection.
|
|
62
|
+
*/
|
|
63
|
+
options?: readonly (SelectOption | SelectOptionGroup)[];
|
|
64
|
+
/**
|
|
65
|
+
* Container variant.
|
|
66
|
+
*
|
|
67
|
+
* @defaultValue `"filled"`
|
|
68
|
+
*/
|
|
69
|
+
variant?: InputVariant | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Controlled option value.
|
|
72
|
+
*
|
|
73
|
+
* Supplying the property, even as `undefined`, makes the select controlled when it is
|
|
74
|
+
* constructed; `undefined` and `""` select the placeholder, if any.
|
|
75
|
+
*/
|
|
76
|
+
value?: string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Initial option value of an uncontrolled select, restored by a form reset.
|
|
79
|
+
*
|
|
80
|
+
* When omitted, an uncontrolled select with a placeholder initially selects the placeholder.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* This is **not** reactive.
|
|
84
|
+
*/
|
|
85
|
+
defaultValue?: string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Placeholder option content, shown while no option is selected and the label floats.
|
|
88
|
+
*
|
|
89
|
+
* Supplying the property renders a disabled, hidden placeholder option with an empty value,
|
|
90
|
+
* so a {@link SelectProps.required | required} select is invalid until an option is chosen.
|
|
91
|
+
* Whether the property is supplied is read once, when the select is rendered.
|
|
92
|
+
*/
|
|
93
|
+
placeholder?: InputSlot;
|
|
94
|
+
/**
|
|
95
|
+
* Disable selection and form participation.
|
|
96
|
+
*
|
|
97
|
+
* @defaultValue `false`
|
|
98
|
+
*/
|
|
99
|
+
disabled?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Prevent selection changes while keeping the select focusable and in its form.
|
|
102
|
+
*
|
|
103
|
+
* Pointer and keyboard input which would open the option menu or change the selection is
|
|
104
|
+
* ignored, and the select is exposed with `aria-readonly`.
|
|
105
|
+
*
|
|
106
|
+
* @defaultValue `false`
|
|
107
|
+
*/
|
|
108
|
+
readOnly?: boolean | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Require a selected option with a non-empty value at form submission.
|
|
111
|
+
*
|
|
112
|
+
* The label of a required select ends with an asterisk, which assistive technology skips: the
|
|
113
|
+
* native select conveys that it is required.
|
|
114
|
+
*
|
|
115
|
+
* @defaultValue `false`
|
|
116
|
+
* @see {@link SelectProps.noAsterisk}
|
|
117
|
+
*/
|
|
118
|
+
required?: boolean | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Omit the asterisk which ends the label of a {@link SelectProps.required | required} select.
|
|
121
|
+
*
|
|
122
|
+
* @defaultValue `false`
|
|
123
|
+
*/
|
|
124
|
+
noAsterisk?: boolean | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Form control name.
|
|
127
|
+
*/
|
|
128
|
+
name?: string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Native select id, used by the label.
|
|
131
|
+
*
|
|
132
|
+
* This takes precedence over `attr:id`. When neither is supplied, a unique id is generated.
|
|
133
|
+
*/
|
|
134
|
+
id?: string | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Notify the parent after the user selects an option.
|
|
137
|
+
*
|
|
138
|
+
* `onValueChange`, `onSelectedChange`, `onChange` run in that order; the same function
|
|
139
|
+
* supplied to multiple aliases runs once. Controlled values are reapplied after callbacks, so
|
|
140
|
+
* update the controlled property to accept the selection. `preventDefault()` in these
|
|
141
|
+
* callbacks does not roll back the native selection.
|
|
142
|
+
*
|
|
143
|
+
* @see {@link SelectProps.value}
|
|
144
|
+
*/
|
|
145
|
+
onValueChange?: SelectChangeHandler | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Alias for {@link SelectProps.onValueChange}.
|
|
148
|
+
*/
|
|
149
|
+
onSelectedChange?: SelectChangeHandler | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Alias for {@link SelectProps.onValueChange}.
|
|
152
|
+
*/
|
|
153
|
+
onChange?: SelectChangeHandler | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Show the error state without error text.
|
|
156
|
+
*
|
|
157
|
+
* @defaultValue `false`
|
|
158
|
+
*/
|
|
159
|
+
invalid?: boolean | undefined;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Client controller of a {@link Select}.
|
|
163
|
+
*
|
|
164
|
+
* The rendered element tree is static. Every attribute, class and selection is applied by this
|
|
165
|
+
* controller; slots and options are inserted as reactive children. Once mounted, the controller
|
|
166
|
+
* publishes the inline size of the floating label on the root, from which an outlined select
|
|
167
|
+
* sizes the notch of its outline ({@link ./base#observeLabelInlineSize}).
|
|
168
|
+
*
|
|
169
|
+
* # Selection
|
|
170
|
+
*
|
|
171
|
+
* Uncontrolled selects apply `defaultValue` once, or select their placeholder, and record that
|
|
172
|
+
* selection as the native default restored by a form reset; a selection changed before hydration
|
|
173
|
+
* is retained. Controlled selects mirror their value into the native default, so a form reset
|
|
174
|
+
* restores the controlled value without script. When options change, a controlled select
|
|
175
|
+
* reselects its value and an uncontrolled select reselects the user's last choice, or the
|
|
176
|
+
* selection a later form reset restored, if present.
|
|
177
|
+
*/
|
|
178
|
+
export declare class SelectController extends DomController<SelectProps> {
|
|
179
|
+
#private;
|
|
180
|
+
/**
|
|
181
|
+
* Construct a new `SelectController`.
|
|
182
|
+
*
|
|
183
|
+
* @param props - component properties
|
|
184
|
+
*/
|
|
185
|
+
constructor(props: SelectProps);
|
|
186
|
+
/**
|
|
187
|
+
* Apply local properties to component state and styling.
|
|
188
|
+
*
|
|
189
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
190
|
+
*/
|
|
191
|
+
protected applyComponentProps(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Handle function element replacement before the controller reference is updated.
|
|
194
|
+
*
|
|
195
|
+
* @param curr - new function element, or `null` when absent
|
|
196
|
+
* @see {@link ../dom/client#DomController.onFunctionElementChanged}
|
|
197
|
+
*/
|
|
198
|
+
protected onFunctionElementChanged(curr: HTMLSelectElement | null): void;
|
|
199
|
+
/**
|
|
200
|
+
* Render the component's element tree.
|
|
201
|
+
*
|
|
202
|
+
* The tree is static, structurally matching the server rendering. Slots and options are
|
|
203
|
+
* reactive children. Options leave the selection to this controller, so hydration keeps the
|
|
204
|
+
* selection the server rendered.
|
|
205
|
+
*
|
|
206
|
+
* @param children - nested option children, possibly an accessor
|
|
207
|
+
* @param funcRef - callback receiving the native select
|
|
208
|
+
* @returns rendered component elements
|
|
209
|
+
* @see {@link ../dom/client#DomController.render}
|
|
210
|
+
*/
|
|
211
|
+
protected render(children: JSX.Element, funcRef?: (elem: HTMLSelectElement) => void): JSX.Element;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Material 3 select, also known as an exposed dropdown menu.
|
|
215
|
+
*
|
|
216
|
+
* A select lets users choose one option from a list. The closed field is a Material text field:
|
|
217
|
+
* container, floating label, leading icon, dropdown arrow and supporting text. The option menu is
|
|
218
|
+
* the native select's own menu, which keeps native form participation, keyboard interaction and
|
|
219
|
+
* accessibility, and the platform pickers of mobile browsers. Where the browser supports a
|
|
220
|
+
* customizable select (`appearance: base-select`), the menu is styled with the Material menu
|
|
221
|
+
* roles and the dropdown arrow turns while it is open; elsewhere the browser's menu is used.
|
|
222
|
+
*
|
|
223
|
+
* # States
|
|
224
|
+
*
|
|
225
|
+
* The label rests inside the field while the placeholder is selected and the select is not
|
|
226
|
+
* focused; otherwise it floats. As for text fields, a resting (body-large) and a floating
|
|
227
|
+
* (body-small) label show text laid out at the size of either state, and copies of the label
|
|
228
|
+
* carry the motion between them. Hover, focus, error and disabled states follow {@link
|
|
229
|
+
* ./text-field#TextField}; focus also colors the dropdown arrow. {@link SelectProps.readOnly |
|
|
230
|
+
* Read-only} selects ignore input which would change the selection.
|
|
231
|
+
*
|
|
232
|
+
* # Design
|
|
233
|
+
*
|
|
234
|
+
* Design is controlled through the [`cw-Select`](./select.yaml) component design attribute, with
|
|
235
|
+
* the `filled` (default) and `outlined` themes selected by {@link SelectProps.variant |
|
|
236
|
+
* `props.variant`}. The root element has the `cw-Select` class, `cw-Select-disabled`,
|
|
237
|
+
* `cw-Select-readOnly` and `cw-Select-error` while in the respective state.
|
|
238
|
+
*
|
|
239
|
+
* # Accessibility
|
|
240
|
+
*
|
|
241
|
+
* The floating label is associated with the native select, and alone renders the label slot, which
|
|
242
|
+
* may therefore hold a node constructed once, such as a cached element; the resting label and the
|
|
243
|
+
* moving copies draw clones of its content and are hidden from assistive technology. Supporting
|
|
244
|
+
* text describes the native select and is a polite live region. The label of a {@link
|
|
245
|
+
* SelectProps.required | required} select ends with an asterisk, as in material-web (`select.ts`
|
|
246
|
+
* `noAsterisk`), which is hidden from assistive technology since the native select conveys that
|
|
247
|
+
* it is required.
|
|
248
|
+
*
|
|
249
|
+
* @param props - component properties
|
|
250
|
+
* @returns rendered component elements
|
|
251
|
+
* @example
|
|
252
|
+
* ```tsx
|
|
253
|
+
* <Select
|
|
254
|
+
* label="Color"
|
|
255
|
+
* placeholder="Choose a color"
|
|
256
|
+
* required
|
|
257
|
+
* options={[{ value: "red", label: "Red" }, { value: "blue", label: "Blue" }]}
|
|
258
|
+
* value={color()}
|
|
259
|
+
* onValueChange={setColor}
|
|
260
|
+
* />
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
export declare const Select: DomComponent<SelectProps>;
|
|
264
|
+
/**
|
|
265
|
+
* Alias for {@link Select}, after the Material name of the component.
|
|
266
|
+
*/
|
|
267
|
+
export declare const ExposedDropdownMenu: typeof Select;
|