@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,497 @@
|
|
|
1
|
+
import type { Accessor, JSX } from "solid-js";
|
|
2
|
+
import type { DomComponent, DomProps, FunctionElement, StyleElement } from "..";
|
|
3
|
+
import type { InteractableComponent, InteractableProps } from "../state";
|
|
4
|
+
import type { NavigationChangeHandler, NavigationElementProps, NavigationOrientation, TabActivationMode } from "./base";
|
|
5
|
+
import { DomController } from "../dom/client";
|
|
6
|
+
import { InteractableController } from "../state/controller";
|
|
7
|
+
import "./navigation.css";
|
|
8
|
+
/**
|
|
9
|
+
* Properties of a tabs root, which groups a tab list with its tab panels.
|
|
10
|
+
*/
|
|
11
|
+
export type TabsProps = NavigationElementProps<HTMLDivElement>;
|
|
12
|
+
/**
|
|
13
|
+
* Properties of a tab list.
|
|
14
|
+
*/
|
|
15
|
+
export type TabListProps = NavigationElementProps<HTMLDivElement> & {
|
|
16
|
+
/**
|
|
17
|
+
* Tab row variant.
|
|
18
|
+
*
|
|
19
|
+
* | Variant | Indicator |
|
|
20
|
+
* | ------------- | ---------------------------------------------------------------- |
|
|
21
|
+
* | `"primary"` | 3dp indicator matching the width of the selected tab's content. |
|
|
22
|
+
* | `"secondary"` | 2dp indicator spanning the selected tab. |
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue `"primary"`
|
|
25
|
+
*/
|
|
26
|
+
variant?: "primary" | "secondary" | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Scroll tabs horizontally instead of sharing the list width equally.
|
|
29
|
+
*
|
|
30
|
+
* A scrollable list scrolls the selected tab towards its center when the selection changes.
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue `false`
|
|
33
|
+
*/
|
|
34
|
+
scrollable?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Orientation of the arrow keys which move focus between tabs.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `"horizontal"`
|
|
39
|
+
*/
|
|
40
|
+
orientation?: NavigationOrientation | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Tab activation behavior.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue `"automatic"`
|
|
45
|
+
*/
|
|
46
|
+
activationMode?: TabActivationMode | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Alias for {@link TabListProps.activationMode | `activationMode`}.
|
|
49
|
+
*/
|
|
50
|
+
activation?: TabActivationMode | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Controlled value of the selected tab.
|
|
53
|
+
*
|
|
54
|
+
* When this key is present, the selection changes only when this value changes; activating a
|
|
55
|
+
* tab requests a change through {@link TabListProps.onChange | `onChange`}. A value which
|
|
56
|
+
* identifies no enabled tab selects no tab.
|
|
57
|
+
*/
|
|
58
|
+
value?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Alias for {@link TabListProps.value | `value`}.
|
|
61
|
+
*/
|
|
62
|
+
selectedValue?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Initial value of the selected tab of an uncontrolled list.
|
|
65
|
+
*
|
|
66
|
+
* When omitted, the first enabled tab is selected. A value which identifies no enabled tab
|
|
67
|
+
* leaves the list unselected, on both server and client, until a tab is activated.
|
|
68
|
+
*/
|
|
69
|
+
defaultValue?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Callback invoked after a tab is activated.
|
|
72
|
+
*
|
|
73
|
+
* Distinct callbacks run in `onChange`, `onValueChange`, `onSelectedChange` order; identical
|
|
74
|
+
* references run once. An uncontrolled list updates its selection before the callbacks.
|
|
75
|
+
*/
|
|
76
|
+
onChange?: NavigationChangeHandler | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Alias for {@link TabListProps.onChange | `onChange`}.
|
|
79
|
+
*/
|
|
80
|
+
onValueChange?: NavigationChangeHandler | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Alias for {@link TabListProps.onChange | `onChange`}.
|
|
83
|
+
*/
|
|
84
|
+
onSelectedChange?: NavigationChangeHandler | undefined;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Properties of a tab.
|
|
88
|
+
*
|
|
89
|
+
* A tab with an {@link TabProps.href | `href`} renders a native link, and otherwise a native
|
|
90
|
+
* button of type `"button"`. The `disabled`, `href`, `id`, and `tabIndex` properties are local
|
|
91
|
+
* component properties, applied to the native element by the component controller; `id` takes
|
|
92
|
+
* precedence over `attr:id`. A tab accepts no `attr:tabindex`, since its controller applies the
|
|
93
|
+
* tab index on every update, as a tab list moves the tab stop between its tabs. Other native
|
|
94
|
+
* attributes of either element remain available through the namespaced `attr:` properties
|
|
95
|
+
* supplied by {@link DomProps}, such as `attr:target`, `attr:rel`, `attr:download`,
|
|
96
|
+
* `attr:hreflang`, and `attr:referrerpolicy` of a link. The function element which `ref` and
|
|
97
|
+
* native listeners receive is typed as an `HTMLElement`, since it may be either.
|
|
98
|
+
*/
|
|
99
|
+
export type TabProps = DomProps<HTMLElement, Omit<JSX.AnchorHTMLAttributes<HTMLElement> & JSX.ButtonHTMLAttributes<HTMLElement>, "disabled" | "href" | "tabindex" | "type">> & {
|
|
100
|
+
/**
|
|
101
|
+
* Value identifying the tab within its tab list.
|
|
102
|
+
*/
|
|
103
|
+
value?: string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Controlled selected state of a tab outside a tab list.
|
|
106
|
+
*/
|
|
107
|
+
selected?: boolean | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Initial selected state of an uncontrolled tab outside a tab list.
|
|
110
|
+
*/
|
|
111
|
+
defaultSelected?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Disable activation and remove the tab from sequential focus.
|
|
114
|
+
*
|
|
115
|
+
* @defaultValue `false`
|
|
116
|
+
*/
|
|
117
|
+
disabled?: boolean | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Link destination.
|
|
120
|
+
*
|
|
121
|
+
* When specified, the tab renders a native link; otherwise, it renders a native button.
|
|
122
|
+
*/
|
|
123
|
+
href?: string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Element id; takes precedence over `attr:id`.
|
|
126
|
+
*/
|
|
127
|
+
id?: string | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Id of the tab panel the tab controls.
|
|
130
|
+
*
|
|
131
|
+
* When omitted, a tab within {@link Tabs} controls the panel with its value, matched by
|
|
132
|
+
* occurrence among tabs and panels with the same value.
|
|
133
|
+
*/
|
|
134
|
+
panelId?: string | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Alias for {@link TabProps.panelId | `panelId`}.
|
|
137
|
+
*/
|
|
138
|
+
controls?: string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Icon content.
|
|
141
|
+
*/
|
|
142
|
+
icon?: JSX.Element;
|
|
143
|
+
/**
|
|
144
|
+
* Label content; `children` are used when this is omitted.
|
|
145
|
+
*/
|
|
146
|
+
label?: JSX.Element;
|
|
147
|
+
/**
|
|
148
|
+
* Sequential focus index; takes precedence over the roving tab index of a tab list.
|
|
149
|
+
*/
|
|
150
|
+
tabIndex?: number | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Callback invoked when a tab outside a tab list is activated.
|
|
153
|
+
*
|
|
154
|
+
* Distinct callbacks run in `onChange`, `onSelect`, `onSelectedChange` order; identical
|
|
155
|
+
* references run once. An uncontrolled tab is selected before the callbacks run.
|
|
156
|
+
*
|
|
157
|
+
* @param selected - requested selection state, always `true`
|
|
158
|
+
* @param event - click event which activated the tab
|
|
159
|
+
*/
|
|
160
|
+
onChange?: ((selected: boolean, event: Event) => void) | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Alias for {@link TabProps.onChange | `onChange`}.
|
|
163
|
+
*/
|
|
164
|
+
onSelect?: ((selected: boolean, event: Event) => void) | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Alias for {@link TabProps.onChange | `onChange`}.
|
|
167
|
+
*/
|
|
168
|
+
onSelectedChange?: ((selected: boolean, event: Event) => void) | undefined;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Properties of a tab panel.
|
|
172
|
+
*/
|
|
173
|
+
export type TabPanelProps = NavigationElementProps<HTMLDivElement> & {
|
|
174
|
+
/**
|
|
175
|
+
* Element id; takes precedence over `attr:id`.
|
|
176
|
+
*/
|
|
177
|
+
id?: string | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Id of the tab which labels the panel.
|
|
180
|
+
*
|
|
181
|
+
* When omitted, a panel within {@link Tabs} is labelled by the tab with its value, matched by
|
|
182
|
+
* occurrence among tabs and panels with the same value.
|
|
183
|
+
*/
|
|
184
|
+
tabId?: string | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* Value associating the panel with a tab.
|
|
187
|
+
*/
|
|
188
|
+
value?: string | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Controlled visibility of a panel which no tab list controls.
|
|
191
|
+
*/
|
|
192
|
+
active?: boolean | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Initial visibility of an uncontrolled panel which no tab list controls.
|
|
195
|
+
*
|
|
196
|
+
* @defaultValue `true`
|
|
197
|
+
*/
|
|
198
|
+
defaultActive?: boolean | undefined;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Client controller of a tabs root.
|
|
202
|
+
*
|
|
203
|
+
* The root observes structural changes of its content, so the tabs and panels within it are
|
|
204
|
+
* relinked when they move.
|
|
205
|
+
*/
|
|
206
|
+
export declare class TabsController extends DomController<TabsProps> {
|
|
207
|
+
#private;
|
|
208
|
+
/**
|
|
209
|
+
* Construct a new tabs root controller.
|
|
210
|
+
*
|
|
211
|
+
* @param props - component properties
|
|
212
|
+
*/
|
|
213
|
+
constructor(props: TabsProps);
|
|
214
|
+
/**
|
|
215
|
+
* Apply local properties to component state and styling.
|
|
216
|
+
*
|
|
217
|
+
* A tabs root has no local properties.
|
|
218
|
+
*
|
|
219
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
220
|
+
*/
|
|
221
|
+
protected applyComponentProps(): void;
|
|
222
|
+
/**
|
|
223
|
+
* Handle style element replacement before the controller reference is updated.
|
|
224
|
+
*
|
|
225
|
+
* @param curr - new style element, or `null` when absent
|
|
226
|
+
* @see {@link ../dom/client#DomController.onStyleElementChanged}
|
|
227
|
+
*/
|
|
228
|
+
protected onStyleElementChanged(curr: StyleElement | null): void;
|
|
229
|
+
/**
|
|
230
|
+
* Stop observing the root.
|
|
231
|
+
*
|
|
232
|
+
* @see {@link ../dom/client#DomController.onControllerCleanup}
|
|
233
|
+
*/
|
|
234
|
+
protected onControllerCleanup(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Render the component's element tree.
|
|
237
|
+
*
|
|
238
|
+
* @param children - nested component children, possibly an accessor
|
|
239
|
+
* @returns rendered component elements
|
|
240
|
+
* @see {@link ../dom/client#DomController.render}
|
|
241
|
+
*/
|
|
242
|
+
protected render(children: JSX.Element): JSX.Element;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Root grouping a {@link TabList} with its {@link TabPanel | tab panels}.
|
|
246
|
+
*
|
|
247
|
+
* Within a root, each tab controls the panel with its value, and the root's tab list shows only
|
|
248
|
+
* the panel of its selected tab. Tabs and panels may render in any order and within any wrapper
|
|
249
|
+
* elements; duplicate values pair the *n*-th tab with the *n*-th panel.
|
|
250
|
+
*
|
|
251
|
+
* @param props - component properties
|
|
252
|
+
* @returns rendered component elements
|
|
253
|
+
*/
|
|
254
|
+
export declare const Tabs: DomComponent<TabsProps>;
|
|
255
|
+
/**
|
|
256
|
+
* Client controller of a tab list.
|
|
257
|
+
*
|
|
258
|
+
* The list implements the APG tabs pattern: one roving tab stop, which follows the selected tab
|
|
259
|
+
* and, while focus is within the list, the focused tab, unless the `hidden` or `inert` attribute
|
|
260
|
+
* hides that tab within the list; the arrow keys, Home, and End move focus among enabled,
|
|
261
|
+
* rendered tabs; and automatic or manual activation. Activation requests are deferred until
|
|
262
|
+
* delegated consumers had an opportunity to cancel the event.
|
|
263
|
+
*
|
|
264
|
+
* Selection changes update only the previously and newly selected tabs and panels. The list
|
|
265
|
+
* re-resolves its selection once per batch of structural changes, such as tabs being added,
|
|
266
|
+
* removed, revalued, or disabled.
|
|
267
|
+
*
|
|
268
|
+
* # Motion
|
|
269
|
+
*
|
|
270
|
+
* The indicator of the newly selected tab starts from the position and width of the previous
|
|
271
|
+
* indicator, and settles with the default spatial spring (`TabRow.kt` `TabIndicatorOffsetNode`).
|
|
272
|
+
* The motion is a runtime spring, so a selection change mid-flight continues from the indicator's
|
|
273
|
+
* current position and velocity. A scrollable list scrolls the selected tab towards its center
|
|
274
|
+
* with smooth scrolling, the web counterpart of `ScrollableTabRow`'s animated scroll.
|
|
275
|
+
*/
|
|
276
|
+
export declare class TabListController extends DomController<TabListProps> {
|
|
277
|
+
#private;
|
|
278
|
+
/**
|
|
279
|
+
* Construct a new tab list controller.
|
|
280
|
+
*
|
|
281
|
+
* @param props - component properties
|
|
282
|
+
*/
|
|
283
|
+
constructor(props: TabListProps);
|
|
284
|
+
/**
|
|
285
|
+
* Apply local properties to component state and styling.
|
|
286
|
+
*
|
|
287
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
288
|
+
*/
|
|
289
|
+
protected applyComponentProps(): void;
|
|
290
|
+
/**
|
|
291
|
+
* Handle style element replacement before the controller reference is updated.
|
|
292
|
+
*
|
|
293
|
+
* @param curr - new style element, or `null` when absent
|
|
294
|
+
* @see {@link ../dom/client#DomController.onStyleElementChanged}
|
|
295
|
+
*/
|
|
296
|
+
protected onStyleElementChanged(curr: StyleElement | null): void;
|
|
297
|
+
/**
|
|
298
|
+
* Stop observing the list and its indicator motion.
|
|
299
|
+
*
|
|
300
|
+
* @see {@link ../dom/client#DomController.onControllerCleanup}
|
|
301
|
+
*/
|
|
302
|
+
protected onControllerCleanup(): void;
|
|
303
|
+
/**
|
|
304
|
+
* Render the component's element tree.
|
|
305
|
+
*
|
|
306
|
+
* The tree is static: presentation attributes are applied by {@link
|
|
307
|
+
* TabListController.applyComponentProps}.
|
|
308
|
+
*
|
|
309
|
+
* @param children - nested component children, possibly an accessor
|
|
310
|
+
* @returns rendered component elements
|
|
311
|
+
* @see {@link ../dom/client#DomController.render}
|
|
312
|
+
*/
|
|
313
|
+
protected render(children: JSX.Element): JSX.Element;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Material tab list.
|
|
317
|
+
*
|
|
318
|
+
* A tab list organizes related content across tab panels. Within a {@link Tabs} root, it shows the
|
|
319
|
+
* {@link TabPanel} of its selected tab. Tabs share the list width equally, or scroll when the
|
|
320
|
+
* list is {@link TabListProps.scrollable | scrollable}.
|
|
321
|
+
*
|
|
322
|
+
* # States
|
|
323
|
+
*
|
|
324
|
+
* The list has controlled and uncontrolled selection states; see {@link TabListProps}. The
|
|
325
|
+
* selected tab has the `cw-Tab-selected` class and `aria-selected="true"`.
|
|
326
|
+
*
|
|
327
|
+
* # Design
|
|
328
|
+
*
|
|
329
|
+
* Tabs are designed through the [`cw-Tabs`](./tabs.yaml) component design attribute, following
|
|
330
|
+
* `PrimaryNavigationTabTokens` and `SecondaryNavigationTabTokens`.
|
|
331
|
+
*
|
|
332
|
+
* # Accessibility
|
|
333
|
+
*
|
|
334
|
+
* The list implements the APG tabs pattern; see {@link TabListController}. Name the list with
|
|
335
|
+
* `attr:aria-label`.
|
|
336
|
+
*
|
|
337
|
+
* @param props - component properties
|
|
338
|
+
* @returns rendered component elements
|
|
339
|
+
*/
|
|
340
|
+
export declare const TabList: DomComponent<TabListProps>;
|
|
341
|
+
/**
|
|
342
|
+
* Client controller of a tab.
|
|
343
|
+
*
|
|
344
|
+
* Within a tab list, the list manages the tab's selection and tab stop. Within a {@link Tabs}
|
|
345
|
+
* root, the root links the tab to its panel. A tab outside a list manages its own selection.
|
|
346
|
+
*
|
|
347
|
+
* # Elements
|
|
348
|
+
*
|
|
349
|
+
* | Element | Description |
|
|
350
|
+
* | -------------------------------- | --------------------------------------------------- |
|
|
351
|
+
* | `button.cw-Tab`, `a.cw-Tab` | Function element; a link when `href` is specified. |
|
|
352
|
+
* | `span.cw-Tab-content` | Icon and label; bounds the primary indicator. |
|
|
353
|
+
* | `span.cw-Tab-icon` | {@link TabProps.icon} slot. |
|
|
354
|
+
* | `span.cw-Tab-label` | {@link TabProps.label} slot. |
|
|
355
|
+
*/
|
|
356
|
+
export declare class TabController extends InteractableController<TabProps> {
|
|
357
|
+
#private;
|
|
358
|
+
/**
|
|
359
|
+
* Construct a new tab controller.
|
|
360
|
+
*
|
|
361
|
+
* @param props - component properties
|
|
362
|
+
*/
|
|
363
|
+
constructor(props: InteractableProps<TabProps>);
|
|
364
|
+
/**
|
|
365
|
+
* Apply local properties to component state and styling.
|
|
366
|
+
*
|
|
367
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
368
|
+
*/
|
|
369
|
+
protected applyComponentProps(): void;
|
|
370
|
+
/**
|
|
371
|
+
* Handle function element replacement before the controller reference is updated.
|
|
372
|
+
*
|
|
373
|
+
* @param curr - new function element, or `null` when absent
|
|
374
|
+
* @see {@link ../dom/client#DomController.onFunctionElementChanged}
|
|
375
|
+
*/
|
|
376
|
+
protected onFunctionElementChanged(curr: FunctionElement<TabProps> | null): void;
|
|
377
|
+
/**
|
|
378
|
+
* Release the tab's registrations.
|
|
379
|
+
*
|
|
380
|
+
* @see {@link ../dom/client#DomController.onControllerCleanup}
|
|
381
|
+
*/
|
|
382
|
+
protected onControllerCleanup(): void;
|
|
383
|
+
/**
|
|
384
|
+
* Render the component's element tree.
|
|
385
|
+
*
|
|
386
|
+
* The content wrapper is rendered once and moves between the link and button elements, which
|
|
387
|
+
* the `href` property selects. Attributes are applied by {@link
|
|
388
|
+
* TabController.applyComponentProps}.
|
|
389
|
+
*
|
|
390
|
+
* @param children - nested component children, possibly an accessor
|
|
391
|
+
* @param funcRef - callback receiving the native function element
|
|
392
|
+
* @returns rendered component elements
|
|
393
|
+
* @see {@link ../dom/client#DomController.render}
|
|
394
|
+
*/
|
|
395
|
+
protected render(children: JSX.Element, funcRef?: (element: HTMLElement) => void): Accessor<JSX.Element>;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Material tab.
|
|
399
|
+
*
|
|
400
|
+
* A tab is a native button, or a native link when it has an `href`. Within a {@link TabList}, it
|
|
401
|
+
* participates in the list's selection and roving focus; within a {@link Tabs} root, it controls
|
|
402
|
+
* the {@link TabPanel} with its value. Icons stack above labels; see {@link LeadingIconTab} for
|
|
403
|
+
* icons before labels.
|
|
404
|
+
*
|
|
405
|
+
* # States
|
|
406
|
+
*
|
|
407
|
+
* Tabs enter the {@link FocusState | focus}, {@link HoverState | hover}, and {@link PressState |
|
|
408
|
+
* press} states, which apply `cw-Tab-<state>` classes and show a state layer and ripple. Selected
|
|
409
|
+
* tabs have the `cw-Tab-selected` class; disabled tabs have the `cw-Tab-disabled` class and
|
|
410
|
+
* `aria-disabled`.
|
|
411
|
+
*
|
|
412
|
+
* # Design
|
|
413
|
+
*
|
|
414
|
+
* Tabs are designed through the [`cw-Tabs`](./tabs.yaml) component design attribute.
|
|
415
|
+
*
|
|
416
|
+
* @param props - component properties
|
|
417
|
+
* @returns rendered component elements
|
|
418
|
+
*/
|
|
419
|
+
export declare const Tab: InteractableComponent<TabProps>;
|
|
420
|
+
/**
|
|
421
|
+
* Material leading-icon tab, which places its icon before its label in a 48dp tab (`Tab.kt`
|
|
422
|
+
* `LeadingIconTab`).
|
|
423
|
+
*
|
|
424
|
+
* @param props - component properties
|
|
425
|
+
* @returns rendered component elements
|
|
426
|
+
* @see {@link Tab}
|
|
427
|
+
*/
|
|
428
|
+
export declare const LeadingIconTab: InteractableComponent<TabProps>;
|
|
429
|
+
/**
|
|
430
|
+
* Client controller of a tab panel.
|
|
431
|
+
*
|
|
432
|
+
* Within a {@link Tabs} root with a tab list, the list shows only the panel of its selected tab;
|
|
433
|
+
* otherwise, the panel's `active` state applies.
|
|
434
|
+
*/
|
|
435
|
+
export declare class TabPanelController extends DomController<TabPanelProps> {
|
|
436
|
+
#private;
|
|
437
|
+
/**
|
|
438
|
+
* Construct a new tab panel controller.
|
|
439
|
+
*
|
|
440
|
+
* @param props - component properties
|
|
441
|
+
*/
|
|
442
|
+
constructor(props: TabPanelProps);
|
|
443
|
+
/**
|
|
444
|
+
* Apply local properties to component state and styling.
|
|
445
|
+
*
|
|
446
|
+
* @see {@link ../dom/client#DomController.applyComponentProps}
|
|
447
|
+
*/
|
|
448
|
+
protected applyComponentProps(): void;
|
|
449
|
+
/**
|
|
450
|
+
* Release the panel's registration.
|
|
451
|
+
*
|
|
452
|
+
* @see {@link ../dom/client#DomController.onControllerCleanup}
|
|
453
|
+
*/
|
|
454
|
+
protected onControllerCleanup(): void;
|
|
455
|
+
/**
|
|
456
|
+
* Render the component's element tree.
|
|
457
|
+
*
|
|
458
|
+
* @param children - nested component children, possibly an accessor
|
|
459
|
+
* @returns rendered component elements
|
|
460
|
+
* @see {@link ../dom/client#DomController.render}
|
|
461
|
+
*/
|
|
462
|
+
protected render(children: JSX.Element): JSX.Element;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Material tab panel, which holds the content of a {@link Tab}.
|
|
466
|
+
*
|
|
467
|
+
* Within a {@link Tabs} root, a panel is shown only while its tab is selected, and is labelled by
|
|
468
|
+
* its tab. A panel which no tab list manages is shown according to its `active` state.
|
|
469
|
+
*
|
|
470
|
+
* @param props - component properties
|
|
471
|
+
* @returns rendered component elements
|
|
472
|
+
*/
|
|
473
|
+
export declare const TabPanel: DomComponent<TabPanelProps>;
|
|
474
|
+
/**
|
|
475
|
+
* Material primary tab row, a {@link TabList} with the primary variant (`PrimaryTabRow`).
|
|
476
|
+
*
|
|
477
|
+
* @param props - component properties
|
|
478
|
+
* @returns rendered component elements
|
|
479
|
+
* @see {@link TabList}
|
|
480
|
+
*/
|
|
481
|
+
export declare const PrimaryTabRow: DomComponent<TabListProps>;
|
|
482
|
+
/**
|
|
483
|
+
* Material secondary tab row, a {@link TabList} with the secondary variant (`SecondaryTabRow`).
|
|
484
|
+
*
|
|
485
|
+
* @param props - component properties
|
|
486
|
+
* @returns rendered component elements
|
|
487
|
+
* @see {@link TabList}
|
|
488
|
+
*/
|
|
489
|
+
export declare const SecondaryTabRow: DomComponent<TabListProps>;
|
|
490
|
+
/**
|
|
491
|
+
* Material tab row, the earlier name of {@link PrimaryTabRow} (`TabRow`).
|
|
492
|
+
*
|
|
493
|
+
* @param props - component properties
|
|
494
|
+
* @returns rendered component elements
|
|
495
|
+
* @see {@link TabList}
|
|
496
|
+
*/
|
|
497
|
+
export declare const TabRow: DomComponent<TabListProps>;
|