shelving 1.264.0 → 1.264.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/package.json +1 -1
- package/ui/README.md +2 -2
- package/ui/block/Blockquote.module.css +0 -3
- package/ui/block/Card.d.ts +1 -1
- package/ui/block/Card.js +1 -1
- package/ui/block/Card.md +3 -7
- package/ui/block/Card.module.css +0 -3
- package/ui/block/Card.tsx +1 -1
- package/ui/block/Heading.md +0 -1
- package/ui/block/Heading.module.css +0 -3
- package/ui/block/Image.d.ts +3 -3
- package/ui/block/Image.js +4 -4
- package/ui/block/Image.module.css +4 -1
- package/ui/block/Image.tsx +14 -4
- package/ui/block/Label.module.css +0 -3
- package/ui/block/List.md +1 -2
- package/ui/block/List.module.css +0 -3
- package/ui/block/Panel.md +1 -2
- package/ui/block/Panel.module.css +0 -3
- package/ui/block/Paragraph.md +1 -2
- package/ui/block/Paragraph.module.css +0 -3
- package/ui/block/Preformatted.module.css +0 -3
- package/ui/block/Subheading.md +0 -1
- package/ui/block/Subheading.module.css +0 -3
- package/ui/block/Title.md +0 -1
- package/ui/block/Title.module.css +0 -3
- package/ui/block/Video.d.ts +3 -58
- package/ui/block/Video.js +2 -52
- package/ui/block/Video.module.css +1 -51
- package/ui/block/Video.tsx +3 -99
- package/ui/{form → button}/Button.d.ts +6 -2
- package/ui/{form → button}/Button.md +1 -2
- package/ui/{form → button}/Button.module.css +0 -3
- package/ui/{form → button}/Button.tsx +6 -1
- package/ui/button/FullscreenButton.d.ts +31 -0
- package/ui/button/FullscreenButton.js +37 -0
- package/ui/button/FullscreenButton.tsx +58 -0
- package/ui/button/RetryButton.d.ts +29 -0
- package/ui/button/RetryButton.js +27 -0
- package/ui/button/RetryButton.tsx +48 -0
- package/ui/{form → button}/SubmitButton.d.ts +12 -8
- package/ui/{form → button}/SubmitButton.js +4 -4
- package/ui/{form → button}/SubmitButton.tsx +22 -18
- package/ui/button/index.d.ts +5 -0
- package/ui/button/index.js +5 -0
- package/ui/button/index.ts +5 -0
- package/ui/dialog/Dialog.d.ts +1 -1
- package/ui/dialog/Dialog.tsx +1 -1
- package/ui/docs/DocumentationPage.test.tsx +2 -4
- package/ui/docs/DocumentationParams.js +1 -1
- package/ui/docs/DocumentationParams.tsx +1 -1
- package/ui/docs/DocumentationProperties.js +1 -1
- package/ui/docs/DocumentationProperties.tsx +1 -1
- package/ui/docs/DocumentationReferences.js +1 -1
- package/ui/docs/DocumentationReferences.tsx +1 -1
- package/ui/docs/DocumentationReturns.js +1 -1
- package/ui/docs/DocumentationReturns.tsx +1 -1
- package/ui/docs/DocumentationSearchPage.js +2 -2
- package/ui/docs/DocumentationSearchPage.tsx +2 -2
- package/ui/docs/DocumentationThrows.js +1 -1
- package/ui/docs/DocumentationThrows.tsx +1 -1
- package/ui/form/Field.test.tsx +1 -1
- package/ui/form/FormContext.d.ts +1 -1
- package/ui/form/FormContext.js +1 -1
- package/ui/form/FormContext.tsx +1 -1
- package/ui/form/FormFields.d.ts +1 -1
- package/ui/form/FormFields.js +1 -1
- package/ui/form/FormFields.tsx +2 -2
- package/ui/form/FormFooter.js +1 -1
- package/ui/form/FormFooter.tsx +1 -1
- package/ui/form/FormInput.d.ts +1 -1
- package/ui/form/FormInput.js +1 -1
- package/ui/form/FormInput.tsx +2 -2
- package/ui/form/Progress.d.ts +6 -24
- package/ui/form/Progress.js +9 -20
- package/ui/form/Progress.module.css +13 -32
- package/ui/form/Progress.tsx +18 -51
- package/ui/form/index.d.ts +0 -23
- package/ui/form/index.js +0 -23
- package/ui/form/index.ts +0 -23
- package/ui/index.d.ts +2 -0
- package/ui/index.js +2 -0
- package/ui/index.ts +2 -0
- package/ui/inline/Deleted.md +4 -5
- package/ui/inline/Deleted.module.css +1 -3
- package/ui/inline/Inserted.md +4 -5
- package/ui/inline/Inserted.module.css +1 -3
- package/ui/inline/Link.d.ts +1 -1
- package/ui/inline/Link.js +1 -1
- package/ui/inline/Link.md +2 -3
- package/ui/inline/Link.module.css +1 -3
- package/ui/inline/Link.tsx +1 -1
- package/ui/inline/Mark.js +1 -2
- package/ui/inline/Mark.md +5 -5
- package/ui/inline/Mark.module.css +2 -3
- package/ui/inline/Mark.tsx +0 -2
- package/ui/{form → input}/ArrayInput.js +1 -1
- package/ui/{form → input}/ArrayInput.tsx +1 -1
- package/ui/{form → input}/ButtonInput.d.ts +1 -1
- package/ui/{form → input}/ButtonInput.js +1 -1
- package/ui/{form → input}/ButtonInput.tsx +1 -1
- package/ui/{form → input}/ButtonPopover.d.ts +1 -1
- package/ui/{form → input}/ButtonPopover.js +1 -1
- package/ui/{form → input}/ButtonPopover.tsx +1 -1
- package/ui/{form → input}/DictionaryInput.js +1 -1
- package/ui/{form → input}/DictionaryInput.tsx +1 -1
- package/ui/{form → input}/SchemaInput.js +1 -1
- package/ui/{form → input}/SchemaInput.test.tsx +3 -3
- package/ui/{form → input}/SchemaInput.tsx +1 -1
- package/ui/{form → input}/TextInput.d.ts +1 -1
- package/ui/{form → input}/TextInput.js +1 -1
- package/ui/{form → input}/TextInput.tsx +1 -1
- package/ui/input/index.d.ts +20 -0
- package/ui/input/index.js +20 -0
- package/ui/input/index.ts +20 -0
- package/ui/layout/CenteredLayout.d.ts +5 -7
- package/ui/layout/CenteredLayout.js +8 -4
- package/ui/layout/CenteredLayout.md +9 -2
- package/ui/layout/CenteredLayout.module.css +16 -22
- package/ui/layout/CenteredLayout.tsx +18 -12
- package/ui/layout/Layout.d.ts +1 -1
- package/ui/layout/Layout.js +4 -0
- package/ui/layout/Layout.ts +6 -0
- package/ui/layout/SidebarLayout.js +13 -6
- package/ui/layout/SidebarLayout.md +4 -4
- package/ui/layout/SidebarLayout.module.css +6 -9
- package/ui/layout/SidebarLayout.tsx +21 -18
- package/ui/menu/Menu.d.ts +1 -1
- package/ui/menu/Menu.js +1 -1
- package/ui/menu/Menu.tsx +1 -1
- package/ui/misc/Catcher.d.ts +2 -19
- package/ui/misc/Catcher.js +3 -22
- package/ui/misc/Catcher.tsx +4 -40
- package/ui/misc/MetaContext.test.tsx +2 -3
- package/ui/misc/Tag.d.ts +1 -1
- package/ui/misc/Tag.js +1 -1
- package/ui/misc/Tag.md +1 -2
- package/ui/misc/Tag.module.css +0 -3
- package/ui/misc/Tag.tsx +1 -1
- package/ui/notice/Message.module.css +0 -3
- package/ui/notice/Notice.md +1 -2
- package/ui/notice/Notice.module.css +0 -3
- package/ui/router/Router.test.tsx +1 -4
- package/ui/style/TINT_CLASS.md +1 -1
- package/ui/style/Width.d.ts +2 -1
- package/ui/style/Width.module.css +47 -17
- package/ui/style/Width.tsx +22 -1
- package/ui/style/getWidthClass.md +5 -9
- package/ui/table/Table.md +1 -1
- package/ui/tree/TreeButton.d.ts +1 -1
- package/ui/tree/TreeButton.js +1 -1
- package/ui/tree/TreeButton.test.tsx +2 -5
- package/ui/tree/TreeButton.tsx +1 -1
- package/ui/tree/TreeContext.test.tsx +2 -3
- package/ui/tree/TreeMarkup.test.tsx +2 -5
- package/ui/tree/TreeRouter.test.tsx +2 -5
- package/ui/tree/TreeSidebar.js +1 -1
- package/ui/tree/TreeSidebar.tsx +1 -1
- /package/ui/{form → button}/Button.js +0 -0
- /package/ui/{form → button}/Clickable.d.ts +0 -0
- /package/ui/{form → button}/Clickable.js +0 -0
- /package/ui/{form → button}/Clickable.tsx +0 -0
- /package/ui/{form → input}/ArrayInput.d.ts +0 -0
- /package/ui/{form → input}/ArrayRadioInputs.d.ts +0 -0
- /package/ui/{form → input}/ArrayRadioInputs.js +0 -0
- /package/ui/{form → input}/ArrayRadioInputs.tsx +0 -0
- /package/ui/{form → input}/ButtonInputPopover.d.ts +0 -0
- /package/ui/{form → input}/ButtonInputPopover.js +0 -0
- /package/ui/{form → input}/ButtonInputPopover.tsx +0 -0
- /package/ui/{form → input}/CheckboxInput.d.ts +0 -0
- /package/ui/{form → input}/CheckboxInput.js +0 -0
- /package/ui/{form → input}/CheckboxInput.tsx +0 -0
- /package/ui/{form → input}/ChoiceRadioInputs.d.ts +0 -0
- /package/ui/{form → input}/ChoiceRadioInputs.js +0 -0
- /package/ui/{form → input}/ChoiceRadioInputs.tsx +0 -0
- /package/ui/{form → input}/DataInput.d.ts +0 -0
- /package/ui/{form → input}/DataInput.js +0 -0
- /package/ui/{form → input}/DataInput.tsx +0 -0
- /package/ui/{form → input}/DateInput.d.ts +0 -0
- /package/ui/{form → input}/DateInput.js +0 -0
- /package/ui/{form → input}/DateInput.tsx +0 -0
- /package/ui/{form → input}/DictionaryInput.d.ts +0 -0
- /package/ui/{form → input}/FileInput.d.ts +0 -0
- /package/ui/{form → input}/FileInput.js +0 -0
- /package/ui/{form → input}/FileInput.tsx +0 -0
- /package/ui/{form → input}/Input.d.ts +0 -0
- /package/ui/{form → input}/Input.js +0 -0
- /package/ui/{form → input}/Input.module.css +0 -0
- /package/ui/{form → input}/Input.tsx +0 -0
- /package/ui/{form → input}/NumberInput.d.ts +0 -0
- /package/ui/{form → input}/NumberInput.js +0 -0
- /package/ui/{form → input}/NumberInput.tsx +0 -0
- /package/ui/{form → input}/OutputInput.d.ts +0 -0
- /package/ui/{form → input}/OutputInput.js +0 -0
- /package/ui/{form → input}/OutputInput.tsx +0 -0
- /package/ui/{form → input}/Popover.d.ts +0 -0
- /package/ui/{form → input}/Popover.js +0 -0
- /package/ui/{form → input}/Popover.module.css +0 -0
- /package/ui/{form → input}/Popover.tsx +0 -0
- /package/ui/{form → input}/QueryInput.d.ts +0 -0
- /package/ui/{form → input}/QueryInput.js +0 -0
- /package/ui/{form → input}/QueryInput.tsx +0 -0
- /package/ui/{form → input}/RadioInput.d.ts +0 -0
- /package/ui/{form → input}/RadioInput.js +0 -0
- /package/ui/{form → input}/RadioInput.tsx +0 -0
- /package/ui/{form → input}/SchemaInput.d.ts +0 -0
- /package/ui/{form → input}/SchemaInput.md +0 -0
- /package/ui/{form → input}/SelectInput.d.ts +0 -0
- /package/ui/{form → input}/SelectInput.js +0 -0
- /package/ui/{form → input}/SelectInput.tsx +0 -0
package/ui/block/Video.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type MouseEvent, type ReactElement, useEffect, useRef, useState } from "react";
|
|
1
|
+
import { type ReactElement, useRef } from "react";
|
|
3
2
|
import { getBlockClass } from "../style/Block.js";
|
|
4
3
|
import type { SpaceVariants } from "../style/Space.js";
|
|
5
4
|
import type { WidthVariants } from "../style/Width.js";
|
|
6
5
|
import { getClass, getModuleClass } from "../util/css.js";
|
|
7
|
-
import type {
|
|
6
|
+
import type { OptionalChildProps } from "../util/props.js";
|
|
8
7
|
import VIDEO_CSS from "./Video.module.css";
|
|
9
8
|
|
|
10
9
|
const VIDEO_CLASS = getModuleClass(VIDEO_CSS, "video");
|
|
@@ -16,31 +15,10 @@ const VIDEO_CLASS = getModuleClass(VIDEO_CSS, "video");
|
|
|
16
15
|
*/
|
|
17
16
|
export interface VideoProps extends SpaceVariants, WidthVariants, OptionalChildProps {}
|
|
18
17
|
|
|
19
|
-
/**
|
|
20
|
-
* Props for `VideoButtons` — `children` plus an optional `left` alignment flag.
|
|
21
|
-
*
|
|
22
|
-
* @see https://shelving.cc/ui/VideoButtonsProps
|
|
23
|
-
*/
|
|
24
|
-
export interface VideoButtonsProps extends ChildProps {
|
|
25
|
-
left?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Props for `VideoButton` — `children` plus optional `title`, `onClick`, `danger`, and `disabled`.
|
|
30
|
-
*
|
|
31
|
-
* @see https://shelving.cc/ui/VideoButtonProps
|
|
32
|
-
*/
|
|
33
|
-
export interface VideoButtonProps extends ChildProps {
|
|
34
|
-
title?: string | undefined;
|
|
35
|
-
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
36
|
-
danger?: boolean;
|
|
37
|
-
disabled?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
18
|
/**
|
|
41
19
|
* Video container element.
|
|
42
20
|
* - Has a black background and a 16:9 aspect ratio.
|
|
43
|
-
* - Shows its contents (i.e. a `<video>` element or a `<TwilioRoom
|
|
21
|
+
* - Shows its contents (i.e. a `<video>` element or a `<TwilioRoom>`).
|
|
44
22
|
*
|
|
45
23
|
* @kind component
|
|
46
24
|
* @example <Video><video src="/clip.mp4" /></Video>
|
|
@@ -61,77 +39,3 @@ export function Video({ children, ...props }: VideoProps): ReactElement {
|
|
|
61
39
|
</figure>
|
|
62
40
|
);
|
|
63
41
|
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Set of video buttons floating over a video.
|
|
67
|
-
*
|
|
68
|
-
* @example <VideoButtons><FullscreenVideoButton /></VideoButtons>
|
|
69
|
-
* @see https://shelving.cc/ui/VideoButtons
|
|
70
|
-
*/
|
|
71
|
-
export function VideoButtons({ children, ...variants }: VideoButtonsProps) {
|
|
72
|
-
return <div className={getModuleClass(VIDEO_CSS, "buttons", variants)}>{children}</div>;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Individual video button over a video — renders a `<button>`.
|
|
77
|
-
*
|
|
78
|
-
* @kind component
|
|
79
|
-
* @example <VideoButton title="Play" onClick={play}><PlayIcon /></VideoButton>
|
|
80
|
-
* @see https://shelving.cc/ui/VideoButton
|
|
81
|
-
*/
|
|
82
|
-
export function VideoButton({ children, title, onClick, disabled, ...variants }: VideoButtonProps): ReactElement {
|
|
83
|
-
return (
|
|
84
|
-
<button type="button" onClick={onClick} className={getModuleClass(VIDEO_CSS, "button", variants)} title={title} disabled={disabled}>
|
|
85
|
-
{children}
|
|
86
|
-
</button>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
declare const _fullscreenVideoButtonProps: unique symbol;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Props for `FullscreenVideoButton` — an empty marker interface (the component takes no props).
|
|
94
|
-
*
|
|
95
|
-
* @see https://shelving.cc/ui/FullscreenVideoButtonProps
|
|
96
|
-
*/
|
|
97
|
-
export interface FullscreenVideoButtonProps {
|
|
98
|
-
readonly [_fullscreenVideoButtonProps]?: never;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Button to toggle the surrounding video element in and out of fullscreen.
|
|
103
|
-
* - Renders `null` when the browser does not support the Fullscreen API.
|
|
104
|
-
* - Tracks fullscreen state so the icon and title flip between enter/exit.
|
|
105
|
-
*
|
|
106
|
-
* @returns Rendered fullscreen toggle button, or `null` when fullscreen is unavailable.
|
|
107
|
-
* @kind component
|
|
108
|
-
* @example <Video><video src="/clip.mp4" /><VideoButtons><FullscreenVideoButton /></VideoButtons></Video>
|
|
109
|
-
* @see https://shelving.cc/ui/FullscreenVideoButton
|
|
110
|
-
*/
|
|
111
|
-
export function FullscreenVideoButton(): ReactElement | null {
|
|
112
|
-
const [isFull, setFull] = useState(() => typeof document !== "undefined" && !!document.fullscreenElement);
|
|
113
|
-
|
|
114
|
-
useEffect(() => {
|
|
115
|
-
const onChange = () => setFull(!!document.fullscreenElement);
|
|
116
|
-
document.addEventListener("fullscreenchange", onChange);
|
|
117
|
-
return () => document.removeEventListener("fullscreenchange", onChange);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
if (!document.fullscreenEnabled) return null;
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<VideoButton
|
|
124
|
-
title={isFull ? "Exit full screen mode" : "Enter full screen mode"}
|
|
125
|
-
onClick={({ currentTarget }) => {
|
|
126
|
-
if (document.fullscreenElement) {
|
|
127
|
-
document.exitFullscreen();
|
|
128
|
-
} else {
|
|
129
|
-
const parent = currentTarget.closest("figure, video");
|
|
130
|
-
if (parent) parent.requestFullscreen();
|
|
131
|
-
}
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
{isFull ? <ArrowsPointingInIcon /> : <ArrowsPointingOutIcon />}
|
|
135
|
-
</VideoButton>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
@@ -28,7 +28,12 @@ export interface ButtonVariants extends FlexVariants, StatusVariants, Typography
|
|
|
28
28
|
* @see https://shelving.cc/ui/getButtonClass
|
|
29
29
|
*/
|
|
30
30
|
export declare function getButtonClass(variants: ButtonVariants): string;
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Component props for a `<Button>` component.
|
|
33
|
+
*
|
|
34
|
+
* @see https://shelving.cc/ui/ButtonProps
|
|
35
|
+
*/
|
|
36
|
+
export interface ButtonProps extends ButtonVariants, ClickableProps {
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* Render either a `<button>` or an `<a href="">` styled as a button, based on whether an `onClick` or `href` prop is provided.
|
|
@@ -39,4 +44,3 @@ interface ButtonProps extends ButtonVariants, ClickableProps {
|
|
|
39
44
|
* @see https://shelving.cc/ui/Button
|
|
40
45
|
*/
|
|
41
46
|
export declare function Button(props: ButtonProps): ReactElement;
|
|
42
|
-
export {};
|
|
@@ -46,11 +46,10 @@ import { getButtonClass } from "shelving/ui";
|
|
|
46
46
|
|
|
47
47
|
## Styling
|
|
48
48
|
|
|
49
|
-
`Button` paints from the [tint ladder](/ui/TINT_CLASS). Override these hooks at `:root` or any ancestor scope;
|
|
49
|
+
`Button` paints from the [tint ladder](/ui/TINT_CLASS). Override these hooks at `:root` or any ancestor scope; apply `color=` / `status=` (on the button or an ancestor scope) to recolour the whole button, or use a per-property hook for one change.
|
|
50
50
|
|
|
51
51
|
| Variable | Styles | Default |
|
|
52
52
|
|---|---|---|
|
|
53
|
-
| `--button-tint` | Tint anchor for the button scope | `inherit` (flows from `color=` / `status=` / parent) |
|
|
54
53
|
| `--button-background` | Surface fill | `var(--tint-90)` |
|
|
55
54
|
| `--button-hover-background` | Surface fill on hover / focus | `var(--tint-95)` |
|
|
56
55
|
| `--button-hover-border` | Border on hover / focus | `var(--button-stroke) solid var(--tint-90)` |
|
|
@@ -40,7 +40,12 @@ export function getButtonClass(variants: ButtonVariants): string {
|
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Component props for a `<Button>` component.
|
|
45
|
+
*
|
|
46
|
+
* @see https://shelving.cc/ui/ButtonProps
|
|
47
|
+
*/
|
|
48
|
+
export interface ButtonProps extends ButtonVariants, ClickableProps {}
|
|
44
49
|
|
|
45
50
|
/**
|
|
46
51
|
* Render either a `<button>` or an `<a href="">` styled as a button, based on whether an `onClick` or `href` prop is provided.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type ButtonVariants } from "./Button.js";
|
|
3
|
+
/**
|
|
4
|
+
* Component props for a `<FullscreenButton>`
|
|
5
|
+
*
|
|
6
|
+
* @see https://shelving.cc/ui/FullscreenButtonProps
|
|
7
|
+
*/
|
|
8
|
+
export interface FullscreenButtonProps extends ButtonVariants {
|
|
9
|
+
/**
|
|
10
|
+
* CSS selector to identify the parent element to toggle fullscreen status on.
|
|
11
|
+
* @default "body, figure"
|
|
12
|
+
*/
|
|
13
|
+
target?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Button to toggle the surrounding `<figure>` element or `<body>` element in/out of fullscreen mode.
|
|
17
|
+
* - Renders `null` when the browser does not support the Fullscreen API.
|
|
18
|
+
* - Tracks fullscreen state so the icon and title toggle between enter/exit.
|
|
19
|
+
* - Parent can be identified by `props.target`, but defaults to `figure, body` does not exist, the button will do nothing when clicked.
|
|
20
|
+
* - The `<Figure>` and `<Video>` components are rendered as `<figure>` so this works out the box with both of these.
|
|
21
|
+
* - If not contained in a `<figure>` by default the
|
|
22
|
+
*
|
|
23
|
+
* @returns Rendered fullscreen toggle button, or `null` when fullscreen is unavailable.
|
|
24
|
+
* @kind component
|
|
25
|
+
* @example <Video><video src="/clip.mp4" /><FullscreenButton /></Video>
|
|
26
|
+
* @see https://shelving.cc/ui/FullscreenButton
|
|
27
|
+
*/
|
|
28
|
+
export declare function FullscreenButton({ target, ...props }: {
|
|
29
|
+
[x: string]: any;
|
|
30
|
+
target?: string | undefined;
|
|
31
|
+
}): ReactElement | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowsPointingInIcon, ArrowsPointingOutIcon } from "@heroicons/react/16/solid";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Button } from "./Button.js";
|
|
5
|
+
/**
|
|
6
|
+
* Button to toggle the surrounding `<figure>` element or `<body>` element in/out of fullscreen mode.
|
|
7
|
+
* - Renders `null` when the browser does not support the Fullscreen API.
|
|
8
|
+
* - Tracks fullscreen state so the icon and title toggle between enter/exit.
|
|
9
|
+
* - Parent can be identified by `props.target`, but defaults to `figure, body` does not exist, the button will do nothing when clicked.
|
|
10
|
+
* - The `<Figure>` and `<Video>` components are rendered as `<figure>` so this works out the box with both of these.
|
|
11
|
+
* - If not contained in a `<figure>` by default the
|
|
12
|
+
*
|
|
13
|
+
* @returns Rendered fullscreen toggle button, or `null` when fullscreen is unavailable.
|
|
14
|
+
* @kind component
|
|
15
|
+
* @example <Video><video src="/clip.mp4" /><FullscreenButton /></Video>
|
|
16
|
+
* @see https://shelving.cc/ui/FullscreenButton
|
|
17
|
+
*/
|
|
18
|
+
export function FullscreenButton({ target = "body, figure", ...props }) {
|
|
19
|
+
const [isFull, setFull] = useState(() => typeof document !== "undefined" && !!document.fullscreenElement);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const onChange = () => setFull(!!document.fullscreenElement);
|
|
22
|
+
document.addEventListener("fullscreenchange", onChange);
|
|
23
|
+
return () => document.removeEventListener("fullscreenchange", onChange);
|
|
24
|
+
});
|
|
25
|
+
if (!document.fullscreenEnabled)
|
|
26
|
+
return null;
|
|
27
|
+
return (_jsx(Button, { title: isFull ? "Exit full screen mode" : "Enter full screen mode", onClick: ({ currentTarget }) => {
|
|
28
|
+
if (document.fullscreenElement) {
|
|
29
|
+
document.exitFullscreen();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const parent = currentTarget.closest(target);
|
|
33
|
+
if (parent)
|
|
34
|
+
parent.requestFullscreen();
|
|
35
|
+
}
|
|
36
|
+
}, ...props, children: isFull ? _jsx(ArrowsPointingInIcon, {}) : _jsx(ArrowsPointingOutIcon, {}) }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ArrowsPointingInIcon, ArrowsPointingOutIcon } from "@heroicons/react/16/solid";
|
|
2
|
+
import { type ReactElement, useEffect, useState } from "react";
|
|
3
|
+
import { Button, type ButtonVariants } from "./Button.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Component props for a `<FullscreenButton>`
|
|
7
|
+
*
|
|
8
|
+
* @see https://shelving.cc/ui/FullscreenButtonProps
|
|
9
|
+
*/
|
|
10
|
+
export interface FullscreenButtonProps extends ButtonVariants {
|
|
11
|
+
/**
|
|
12
|
+
* CSS selector to identify the parent element to toggle fullscreen status on.
|
|
13
|
+
* @default "body, figure"
|
|
14
|
+
*/
|
|
15
|
+
target?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Button to toggle the surrounding `<figure>` element or `<body>` element in/out of fullscreen mode.
|
|
20
|
+
* - Renders `null` when the browser does not support the Fullscreen API.
|
|
21
|
+
* - Tracks fullscreen state so the icon and title toggle between enter/exit.
|
|
22
|
+
* - Parent can be identified by `props.target`, but defaults to `figure, body` does not exist, the button will do nothing when clicked.
|
|
23
|
+
* - The `<Figure>` and `<Video>` components are rendered as `<figure>` so this works out the box with both of these.
|
|
24
|
+
* - If not contained in a `<figure>` by default the
|
|
25
|
+
*
|
|
26
|
+
* @returns Rendered fullscreen toggle button, or `null` when fullscreen is unavailable.
|
|
27
|
+
* @kind component
|
|
28
|
+
* @example <Video><video src="/clip.mp4" /><FullscreenButton /></Video>
|
|
29
|
+
* @see https://shelving.cc/ui/FullscreenButton
|
|
30
|
+
*/
|
|
31
|
+
export function FullscreenButton({ target = "body, figure", ...props }): ReactElement | null {
|
|
32
|
+
const [isFull, setFull] = useState(() => typeof document !== "undefined" && !!document.fullscreenElement);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const onChange = () => setFull(!!document.fullscreenElement);
|
|
36
|
+
document.addEventListener("fullscreenchange", onChange);
|
|
37
|
+
return () => document.removeEventListener("fullscreenchange", onChange);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (!document.fullscreenEnabled) return null;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Button
|
|
44
|
+
title={isFull ? "Exit full screen mode" : "Enter full screen mode"}
|
|
45
|
+
onClick={({ currentTarget }) => {
|
|
46
|
+
if (document.fullscreenElement) {
|
|
47
|
+
document.exitFullscreen();
|
|
48
|
+
} else {
|
|
49
|
+
const parent = currentTarget.closest(target);
|
|
50
|
+
if (parent) parent.requestFullscreen();
|
|
51
|
+
}
|
|
52
|
+
}}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{isFull ? <ArrowsPointingInIcon /> : <ArrowsPointingOutIcon />}
|
|
56
|
+
</Button>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { Callback } from "../../util/function.js";
|
|
3
|
+
import type { OptionalChildProps } from "../util/index.js";
|
|
4
|
+
import { type ButtonVariants } from "./Button.js";
|
|
5
|
+
/**
|
|
6
|
+
* Context for providing a "retry" callback to descendant `<RetryButton>` elements.
|
|
7
|
+
* - Used by `<Catcher>` to provide a retry callback to its children.
|
|
8
|
+
* - Default `<ErrorNotice>` and `<ErrorPage>` elements include `<RetryButton>` to trigger a retry on their parent `<Catcher>`
|
|
9
|
+
*/
|
|
10
|
+
export declare const RetryContext: import("react").Context<Callback | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Component props for `<RetryButton>`
|
|
13
|
+
*
|
|
14
|
+
* @property children - The content of the button. Defaults to a refresh icon and `"Retry"`
|
|
15
|
+
*
|
|
16
|
+
* @see https://shelving.cc/ui/RetryButtonProps
|
|
17
|
+
*/
|
|
18
|
+
export interface RetryButtonProps extends ButtonVariants, OptionalChildProps {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Button that retries the nearest `<Catcher>` error boundary when clicked.
|
|
22
|
+
*
|
|
23
|
+
* - Reads the retry callback from `<Catcher>`'s private context, so it renders `null` when there is no boundary above it to retry.
|
|
24
|
+
* - Defaults to an "Retry" label with a refresh icon; pass `children` to override.
|
|
25
|
+
*
|
|
26
|
+
* @kind component
|
|
27
|
+
* @see https://shelving.cc/ui/RetryButton
|
|
28
|
+
*/
|
|
29
|
+
export declare function RetryButton({ children, ...props }: RetryButtonProps): ReactElement | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowPathIcon } from "@heroicons/react/16/solid";
|
|
3
|
+
import { createContext, use } from "react";
|
|
4
|
+
import { Button } from "./Button.js";
|
|
5
|
+
/**
|
|
6
|
+
* Context for providing a "retry" callback to descendant `<RetryButton>` elements.
|
|
7
|
+
* - Used by `<Catcher>` to provide a retry callback to its children.
|
|
8
|
+
* - Default `<ErrorNotice>` and `<ErrorPage>` elements include `<RetryButton>` to trigger a retry on their parent `<Catcher>`
|
|
9
|
+
*/
|
|
10
|
+
export const RetryContext = createContext(undefined);
|
|
11
|
+
RetryContext.displayName = "RetryContext";
|
|
12
|
+
const _RETRY_CHILDREN = (_jsxs(_Fragment, { children: [_jsx(ArrowPathIcon, {}), "Retry"] }));
|
|
13
|
+
/**
|
|
14
|
+
* Button that retries the nearest `<Catcher>` error boundary when clicked.
|
|
15
|
+
*
|
|
16
|
+
* - Reads the retry callback from `<Catcher>`'s private context, so it renders `null` when there is no boundary above it to retry.
|
|
17
|
+
* - Defaults to an "Retry" label with a refresh icon; pass `children` to override.
|
|
18
|
+
*
|
|
19
|
+
* @kind component
|
|
20
|
+
* @see https://shelving.cc/ui/RetryButton
|
|
21
|
+
*/
|
|
22
|
+
export function RetryButton({ children = _RETRY_CHILDREN, ...props }) {
|
|
23
|
+
const retry = use(RetryContext);
|
|
24
|
+
if (!retry)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsx(Button, { onClick: retry, ...props, children: children }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ArrowPathIcon } from "@heroicons/react/16/solid";
|
|
2
|
+
import { createContext, type ReactElement, use } from "react";
|
|
3
|
+
import type { Callback } from "../../util/function.js";
|
|
4
|
+
import type { OptionalChildProps } from "../util/index.js";
|
|
5
|
+
import { Button, type ButtonVariants } from "./Button.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context for providing a "retry" callback to descendant `<RetryButton>` elements.
|
|
9
|
+
* - Used by `<Catcher>` to provide a retry callback to its children.
|
|
10
|
+
* - Default `<ErrorNotice>` and `<ErrorPage>` elements include `<RetryButton>` to trigger a retry on their parent `<Catcher>`
|
|
11
|
+
*/
|
|
12
|
+
export const RetryContext = createContext<Callback | undefined>(undefined);
|
|
13
|
+
RetryContext.displayName = "RetryContext";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Component props for `<RetryButton>`
|
|
17
|
+
*
|
|
18
|
+
* @property children - The content of the button. Defaults to a refresh icon and `"Retry"`
|
|
19
|
+
*
|
|
20
|
+
* @see https://shelving.cc/ui/RetryButtonProps
|
|
21
|
+
*/
|
|
22
|
+
export interface RetryButtonProps extends ButtonVariants, OptionalChildProps {}
|
|
23
|
+
|
|
24
|
+
const _RETRY_CHILDREN = (
|
|
25
|
+
<>
|
|
26
|
+
<ArrowPathIcon />
|
|
27
|
+
Retry
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Button that retries the nearest `<Catcher>` error boundary when clicked.
|
|
33
|
+
*
|
|
34
|
+
* - Reads the retry callback from `<Catcher>`'s private context, so it renders `null` when there is no boundary above it to retry.
|
|
35
|
+
* - Defaults to an "Retry" label with a refresh icon; pass `children` to override.
|
|
36
|
+
*
|
|
37
|
+
* @kind component
|
|
38
|
+
* @see https://shelving.cc/ui/RetryButton
|
|
39
|
+
*/
|
|
40
|
+
export function RetryButton({ children = _RETRY_CHILDREN, ...props }: RetryButtonProps): ReactElement | null {
|
|
41
|
+
const retry = use(RetryContext);
|
|
42
|
+
if (!retry) return null;
|
|
43
|
+
return (
|
|
44
|
+
<Button onClick={retry} {...props}>
|
|
45
|
+
{children}
|
|
46
|
+
</Button>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import type { OptionalChildProps } from "../util/props.js";
|
|
3
3
|
import { type ButtonVariants } from "./Button.js";
|
|
4
|
+
/**
|
|
5
|
+
* Component props for `<SubmitButton>`, a form submit button.
|
|
6
|
+
*
|
|
7
|
+
* @property children - The content of the button. Defaults to `"Save"` with a right-pointing arrow icon.
|
|
8
|
+
* @property strong - Whether the button should have strong styling. Defaults to `true`
|
|
9
|
+
* @property color - The color variant of the button. Defaults to `"primary"`
|
|
10
|
+
*
|
|
11
|
+
* @see https://shelving.cc/ui/SubmitButtonProps
|
|
12
|
+
*/
|
|
13
|
+
export interface SubmitButtonProps extends ButtonVariants, OptionalChildProps {
|
|
14
|
+
}
|
|
4
15
|
/**
|
|
5
16
|
* Submit button for a form that disables itself and shows a spinner while the form is busy.
|
|
6
17
|
* - Defaults to strong, full-width, primary styling and a "Save" label.
|
|
@@ -9,11 +20,4 @@ import { type ButtonVariants } from "./Button.js";
|
|
|
9
20
|
* @example <SubmitButton>Save changes</SubmitButton>
|
|
10
21
|
* @see https://shelving.cc/ui/SubmitButton
|
|
11
22
|
*/
|
|
12
|
-
export declare function SubmitButton({ children, strong, color, full, ...
|
|
13
|
-
/**
|
|
14
|
-
* Props for `SubmitButton`, a form submit button.
|
|
15
|
-
*
|
|
16
|
-
* @see https://shelving.cc/ui/SubmitButtonProps
|
|
17
|
-
*/
|
|
18
|
-
export interface SubmitButtonProps extends ButtonVariants, OptionalChildProps {
|
|
19
|
-
}
|
|
23
|
+
export declare function SubmitButton({ children, strong, color, full, ...props }: SubmitButtonProps): ReactElement;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ArrowRightIcon } from "@heroicons/react/24/solid";
|
|
3
3
|
import { useStore } from "../../react/useStore.js";
|
|
4
|
+
import { requireForm } from "../form/FormContext.js";
|
|
4
5
|
import { LOADING } from "../misc/Loading.js";
|
|
5
6
|
import { getButtonClass } from "./Button.js";
|
|
6
|
-
|
|
7
|
+
const _SUBMIT_CHILDREN = (_jsxs(_Fragment, { children: ["Save", _jsx(ArrowRightIcon, {})] }));
|
|
7
8
|
/**
|
|
8
9
|
* Submit button for a form that disables itself and shows a spinner while the form is busy.
|
|
9
10
|
* - Defaults to strong, full-width, primary styling and a "Save" label.
|
|
@@ -12,9 +13,8 @@ import { requireForm } from "./FormContext.js";
|
|
|
12
13
|
* @example <SubmitButton>Save changes</SubmitButton>
|
|
13
14
|
* @see https://shelving.cc/ui/SubmitButton
|
|
14
15
|
*/
|
|
15
|
-
export function SubmitButton({ children =
|
|
16
|
+
export function SubmitButton({ children = _SUBMIT_CHILDREN, strong = true, color = "primary", full = true, ...props }) {
|
|
16
17
|
const form = requireForm();
|
|
17
18
|
const busy = useStore(form.busy).value;
|
|
18
|
-
return (_jsx("button", { type: "submit", disabled: busy, className: getButtonClass({ strong, color, full, ...
|
|
19
|
+
return (_jsx("button", { type: "submit", disabled: busy, className: getButtonClass({ strong, color, full, ...props }), children: busy ? LOADING : children }));
|
|
19
20
|
}
|
|
20
|
-
const SUBMIT_CHILDREN = (_jsxs(_Fragment, { children: ["Save", _jsx(ArrowRightIcon, {})] }));
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import { ArrowRightIcon } from "@heroicons/react/24/solid";
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import { useStore } from "../../react/useStore.js";
|
|
4
|
+
import { requireForm } from "../form/FormContext.js";
|
|
4
5
|
import { LOADING } from "../misc/Loading.js";
|
|
5
6
|
import type { OptionalChildProps } from "../util/props.js";
|
|
6
7
|
import { type ButtonVariants, getButtonClass } from "./Button.js";
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Component props for `<SubmitButton>`, a form submit button.
|
|
11
|
+
*
|
|
12
|
+
* @property children - The content of the button. Defaults to `"Save"` with a right-pointing arrow icon.
|
|
13
|
+
* @property strong - Whether the button should have strong styling. Defaults to `true`
|
|
14
|
+
* @property color - The color variant of the button. Defaults to `"primary"`
|
|
15
|
+
*
|
|
16
|
+
* @see https://shelving.cc/ui/SubmitButtonProps
|
|
17
|
+
*/
|
|
18
|
+
export interface SubmitButtonProps extends ButtonVariants, OptionalChildProps {}
|
|
19
|
+
|
|
20
|
+
const _SUBMIT_CHILDREN = (
|
|
21
|
+
<>
|
|
22
|
+
Save
|
|
23
|
+
<ArrowRightIcon />
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
8
26
|
|
|
9
27
|
/**
|
|
10
28
|
* Submit button for a form that disables itself and shows a spinner while the form is busy.
|
|
@@ -15,31 +33,17 @@ import { requireForm } from "./FormContext.js";
|
|
|
15
33
|
* @see https://shelving.cc/ui/SubmitButton
|
|
16
34
|
*/
|
|
17
35
|
export function SubmitButton({
|
|
18
|
-
children =
|
|
36
|
+
children = _SUBMIT_CHILDREN,
|
|
19
37
|
strong = true,
|
|
20
38
|
color = "primary",
|
|
21
39
|
full = true,
|
|
22
|
-
...
|
|
40
|
+
...props
|
|
23
41
|
}: SubmitButtonProps): ReactElement {
|
|
24
42
|
const form = requireForm();
|
|
25
43
|
const busy = useStore(form.busy).value;
|
|
26
44
|
return (
|
|
27
|
-
<button type="submit" disabled={busy} className={getButtonClass({ strong, color, full, ...
|
|
45
|
+
<button type="submit" disabled={busy} className={getButtonClass({ strong, color, full, ...props })}>
|
|
28
46
|
{busy ? LOADING : children}
|
|
29
47
|
</button>
|
|
30
48
|
);
|
|
31
49
|
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Props for `SubmitButton`, a form submit button.
|
|
35
|
-
*
|
|
36
|
-
* @see https://shelving.cc/ui/SubmitButtonProps
|
|
37
|
-
*/
|
|
38
|
-
export interface SubmitButtonProps extends ButtonVariants, OptionalChildProps {}
|
|
39
|
-
|
|
40
|
-
const SUBMIT_CHILDREN = (
|
|
41
|
-
<>
|
|
42
|
-
Save
|
|
43
|
-
<ArrowRightIcon />
|
|
44
|
-
</>
|
|
45
|
-
);
|
package/ui/dialog/Dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import type { Callback } from "../../util/function.js";
|
|
3
|
-
import type { ButtonVariants } from "../
|
|
3
|
+
import type { ButtonVariants } from "../button/Button.js";
|
|
4
4
|
import type { OptionalChildProps } from "../util/props.js";
|
|
5
5
|
/**
|
|
6
6
|
* Props for `<Dialog>` — optional `children` content and an `onClose` callback.
|
package/ui/dialog/Dialog.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { XMarkIcon } from "@heroicons/react/24/solid";
|
|
2
2
|
import { type MouseEvent, memo, type ReactElement, Suspense, useEffect, useRef } from "react";
|
|
3
3
|
import type { Callback } from "../../util/function.js";
|
|
4
|
-
import type { ButtonVariants } from "../
|
|
4
|
+
import type { ButtonVariants } from "../button/Button.js";
|
|
5
5
|
import { getModuleClass } from "../util/css.js";
|
|
6
6
|
import type { OptionalChildProps } from "../util/props.js";
|
|
7
7
|
import styles from "./Dialog.module.css";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { createMeta } from "../util/meta.js";
|
|
7
|
-
import { DocumentationPage } from "./DocumentationPage.js";
|
|
4
|
+
import { createMeta, DocumentationPage, MetaContext } from "shelving/ui";
|
|
5
|
+
import type { DocumentationElement } from "shelving/util/tree";
|
|
8
6
|
|
|
9
7
|
/** Make a minimal `tree-documentation` child element of a given kind. */
|
|
10
8
|
function doc(name: string, kind: string): DocumentationElement {
|
|
@@ -29,7 +29,7 @@ export function DocumentationParams({ params }) {
|
|
|
29
29
|
const map = useTreeMap();
|
|
30
30
|
if (!params?.length)
|
|
31
31
|
return null;
|
|
32
|
-
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Param" }), _jsx(Cell, { header: true, width: "fit", children: "Type" }), _jsx(Cell, { header: true, width: "
|
|
32
|
+
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Param" }), _jsx(Cell, { header: true, width: "fit", children: "Type" }), _jsx(Cell, { header: true, width: "16x", grow: true })] }) }), _jsx("tbody", { children: params.map(({ name, type = DEFAULT_TYPE, description, default: def, optional }) => {
|
|
33
33
|
const { members, optional: typeOptional } = splitType(type);
|
|
34
34
|
// An options-bag param whose (single, concrete) type resolves to a documented interface/object type is flattened into its individual fields as indented child rows.
|
|
35
35
|
const single = members.length === 1 ? members[0] : undefined;
|
|
@@ -24,7 +24,7 @@ export function DocumentationProperties({ properties }) {
|
|
|
24
24
|
const map = useTreeMap();
|
|
25
25
|
if (!properties?.length)
|
|
26
26
|
return null;
|
|
27
|
-
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Property" }), _jsx(Cell, { header: true, width: "fit", children: "Type" }), _jsx(Cell, { header: true, width: "
|
|
27
|
+
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Property" }), _jsx(Cell, { header: true, width: "fit", children: "Type" }), _jsx(Cell, { header: true, width: "16x", grow: true })] }) }), _jsx("tbody", { children: properties.map(({ name, type = DEFAULT_TYPE, description, default: def, optional, readonly }) => {
|
|
28
28
|
const { members, optional: typeOptional } = splitType(type);
|
|
29
29
|
return (_jsxs("tr", { children: [_jsx(Cell, { nowrap: true, children: _jsx(Code, { nowrap: true, children: `.${name}` }) }), _jsx("td", { children: _jsx(DocumentationType, { members: members }) }), _jsx("td", { children: _jsx(DocumentationDescription, { description: description || getTreeElement(map, members[0] ?? DEFAULT_TYPE)?.props.description, default: def, optional: !!optional || typeOptional, readonly: readonly }) })] }, `${name}-${type}`));
|
|
30
30
|
}) })] }) }) }));
|
|
@@ -19,5 +19,5 @@ export function DocumentationReferences({ types }) {
|
|
|
19
19
|
const map = useTreeMap();
|
|
20
20
|
if (!types?.length)
|
|
21
21
|
return null;
|
|
22
|
-
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Type" }), _jsx(Cell, { header: true, width: "
|
|
22
|
+
return (_jsx(Section, { children: _jsx(Scroll, { horizontal: true, children: _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx(Cell, { header: true, width: "fit", children: "Type" }), _jsx(Cell, { header: true, width: "16x", grow: true })] }) }), _jsx("tbody", { children: types.map(type => (_jsxs("tr", { children: [_jsx("td", { children: _jsx(TreeLink, { name: type }) }), _jsx("td", { children: _jsx(DocumentationDescription, { description: getTreeElement(map, type)?.props.description }) })] }, type))) })] }) }) }));
|
|
23
23
|
}
|