@dalcvil/steam-green-react 0.2.0 → 1.0.0
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/README.md +20 -5
- package/dist/components/Avatar/Avatar.css +136 -0
- package/dist/components/Avatar/Avatar.d.ts +22 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +49 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Button/Button.css +117 -0
- package/dist/components/Button/Button.d.ts +18 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +29 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.css +116 -0
- package/dist/components/Checkbox/Checkbox.css.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +51 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.css +331 -0
- package/dist/components/ColorPicker/ColorPicker.css.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +29 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.js +534 -0
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/ColorPicker/index.d.ts +3 -0
- package/dist/components/{GreenButton → ColorPicker}/index.d.ts.map +1 -1
- package/dist/components/Console/Console.css +96 -0
- package/dist/components/Console/Console.css.d.ts +1 -0
- package/dist/components/Console/Console.d.ts +26 -0
- package/dist/components/Console/Console.d.ts.map +1 -0
- package/dist/components/Console/Console.js +59 -0
- package/dist/components/Console/Console.js.map +1 -0
- package/dist/components/Console/index.d.ts +3 -0
- package/dist/components/Console/index.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.css +137 -0
- package/dist/components/Dialog/Dialog.css.d.ts +1 -0
- package/dist/components/Dialog/Dialog.d.ts +28 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.js +151 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Divider/Divider.css +68 -0
- package/dist/components/Divider/Divider.css.d.ts +1 -0
- package/dist/components/Divider/Divider.d.ts +12 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +23 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +3 -0
- package/dist/components/Divider/index.d.ts.map +1 -0
- package/dist/components/FieldLabel/FieldLabel.css +98 -0
- package/dist/components/FieldLabel/FieldLabel.css.d.ts +1 -0
- package/dist/components/FieldLabel/FieldLabel.d.ts +29 -0
- package/dist/components/FieldLabel/FieldLabel.d.ts.map +1 -0
- package/dist/components/FieldLabel/FieldLabel.js +42 -0
- package/dist/components/FieldLabel/FieldLabel.js.map +1 -0
- package/dist/components/FieldLabel/index.d.ts +3 -0
- package/dist/components/{GreenPanel → FieldLabel}/index.d.ts.map +1 -1
- package/dist/components/GroupBox/GroupBox.css +101 -0
- package/dist/components/GroupBox/GroupBox.css.d.ts +1 -0
- package/dist/components/GroupBox/GroupBox.d.ts +14 -0
- package/dist/components/GroupBox/GroupBox.d.ts.map +1 -0
- package/dist/components/GroupBox/GroupBox.js +25 -0
- package/dist/components/GroupBox/GroupBox.js.map +1 -0
- package/dist/components/GroupBox/index.d.ts +3 -0
- package/dist/components/GroupBox/index.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.css +184 -0
- package/dist/components/IconButton/IconButton.css.d.ts +1 -0
- package/dist/components/IconButton/IconButton.d.ts +56 -0
- package/dist/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.js +77 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/index.d.ts +3 -0
- package/dist/components/IconButton/index.d.ts.map +1 -0
- package/dist/components/LevelMeter/LevelMeter.css +117 -0
- package/dist/components/LevelMeter/LevelMeter.css.d.ts +1 -0
- package/dist/components/LevelMeter/LevelMeter.d.ts +20 -0
- package/dist/components/LevelMeter/LevelMeter.d.ts.map +1 -0
- package/dist/components/LevelMeter/LevelMeter.js +44 -0
- package/dist/components/LevelMeter/LevelMeter.js.map +1 -0
- package/dist/components/LevelMeter/index.d.ts +3 -0
- package/dist/components/LevelMeter/index.d.ts.map +1 -0
- package/dist/components/Link/Link.css +127 -0
- package/dist/components/Link/Link.css.d.ts +1 -0
- package/dist/components/Link/Link.d.ts +26 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +60 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/index.d.ts +3 -0
- package/dist/components/Link/index.d.ts.map +1 -0
- package/dist/components/List/List.css +224 -0
- package/dist/components/List/List.css.d.ts +1 -0
- package/dist/components/List/List.d.ts +49 -0
- package/dist/components/List/List.d.ts.map +1 -0
- package/dist/components/List/List.js +300 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/List/index.d.ts +3 -0
- package/dist/components/List/index.d.ts.map +1 -0
- package/dist/components/Menu/Menu.css +122 -0
- package/dist/components/Menu/Menu.css.d.ts +1 -0
- package/dist/components/Menu/Menu.d.ts +46 -0
- package/dist/components/Menu/Menu.d.ts.map +1 -0
- package/dist/components/Menu/Menu.js +246 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/index.d.ts +3 -0
- package/dist/components/Menu/index.d.ts.map +1 -0
- package/dist/components/MenuBar/MenuBar.css +94 -0
- package/dist/components/MenuBar/MenuBar.css.d.ts +1 -0
- package/dist/components/MenuBar/MenuBar.d.ts +34 -0
- package/dist/components/MenuBar/MenuBar.d.ts.map +1 -0
- package/dist/components/MenuBar/MenuBar.js +129 -0
- package/dist/components/MenuBar/MenuBar.js.map +1 -0
- package/dist/components/MenuBar/index.d.ts +3 -0
- package/dist/components/MenuBar/index.d.ts.map +1 -0
- package/dist/components/NavBar/NavBar.css +179 -0
- package/dist/components/NavBar/NavBar.css.d.ts +1 -0
- package/dist/components/NavBar/NavBar.d.ts +39 -0
- package/dist/components/NavBar/NavBar.d.ts.map +1 -0
- package/dist/components/NavBar/NavBar.js +198 -0
- package/dist/components/NavBar/NavBar.js.map +1 -0
- package/dist/components/NavBar/index.d.ts +3 -0
- package/dist/components/NavBar/index.d.ts.map +1 -0
- package/dist/components/Notification/Notification.css +176 -0
- package/dist/components/Notification/Notification.css.d.ts +1 -0
- package/dist/components/Notification/Notification.d.ts +26 -0
- package/dist/components/Notification/Notification.d.ts.map +1 -0
- package/dist/components/Notification/Notification.js +181 -0
- package/dist/components/Notification/Notification.js.map +1 -0
- package/dist/components/Notification/index.d.ts +3 -0
- package/dist/components/Notification/index.d.ts.map +1 -0
- package/dist/components/Panel/Panel.css +56 -0
- package/dist/components/Panel/Panel.css.d.ts +1 -0
- package/dist/components/Panel/Panel.d.ts +14 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -0
- package/dist/components/Panel/Panel.js +42 -0
- package/dist/components/Panel/Panel.js.map +1 -0
- package/dist/components/Panel/index.d.ts +3 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.css +108 -0
- package/dist/components/ProgressBar/ProgressBar.css.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +22 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.js +43 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressBar/index.d.ts +3 -0
- package/dist/components/ProgressBar/index.d.ts.map +1 -0
- package/dist/components/Radio/Radio.css +125 -0
- package/dist/components/Radio/Radio.css.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +40 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -0
- package/dist/components/Radio/Radio.js +91 -0
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/RichText/RichText.css +96 -0
- package/dist/components/RichText/RichText.css.d.ts +1 -0
- package/dist/components/RichText/RichText.d.ts +25 -0
- package/dist/components/RichText/RichText.d.ts.map +1 -0
- package/dist/components/RichText/RichText.js +56 -0
- package/dist/components/RichText/RichText.js.map +1 -0
- package/dist/components/RichText/index.d.ts +3 -0
- package/dist/components/RichText/index.d.ts.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.css +236 -0
- package/dist/components/ScrollArea/ScrollArea.css.d.ts +1 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +25 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.js +124 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/ScrollArea/index.d.ts +3 -0
- package/dist/components/ScrollArea/index.d.ts.map +1 -0
- package/dist/components/Scrollbar/Scrollbar.css +260 -0
- package/dist/components/Scrollbar/Scrollbar.css.d.ts +1 -0
- package/dist/components/Scrollbar/Scrollbar.d.ts +31 -0
- package/dist/components/Scrollbar/Scrollbar.d.ts.map +1 -0
- package/dist/components/Scrollbar/Scrollbar.js +277 -0
- package/dist/components/Scrollbar/Scrollbar.js.map +1 -0
- package/dist/components/Scrollbar/index.d.ts +3 -0
- package/dist/components/Scrollbar/index.d.ts.map +1 -0
- package/dist/components/Select/Select.css +299 -0
- package/dist/components/Select/Select.css.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +52 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.js +281 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Slider/Slider.css +158 -0
- package/dist/components/Slider/Slider.css.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +26 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -0
- package/dist/components/Slider/Slider.js +67 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/index.d.ts +3 -0
- package/dist/components/Slider/index.d.ts.map +1 -0
- package/dist/components/SpinBox/SpinBox.css +152 -0
- package/dist/components/SpinBox/SpinBox.css.d.ts +1 -0
- package/dist/components/SpinBox/SpinBox.d.ts +28 -0
- package/dist/components/SpinBox/SpinBox.d.ts.map +1 -0
- package/dist/components/SpinBox/SpinBox.js +207 -0
- package/dist/components/SpinBox/SpinBox.js.map +1 -0
- package/dist/components/SpinBox/index.d.ts +3 -0
- package/dist/components/SpinBox/index.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.css +137 -0
- package/dist/components/Spinner/Spinner.css.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +20 -0
- package/dist/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.js +36 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +3 -0
- package/dist/components/Spinner/index.d.ts.map +1 -0
- package/dist/components/Splitter/Splitter.css +119 -0
- package/dist/components/Splitter/Splitter.css.d.ts +1 -0
- package/dist/components/Splitter/Splitter.d.ts +25 -0
- package/dist/components/Splitter/Splitter.d.ts.map +1 -0
- package/dist/components/Splitter/Splitter.js +212 -0
- package/dist/components/Splitter/Splitter.js.map +1 -0
- package/dist/components/Splitter/index.d.ts +3 -0
- package/dist/components/Splitter/index.d.ts.map +1 -0
- package/dist/components/StatusBar/StatusBar.css +97 -0
- package/dist/components/StatusBar/StatusBar.css.d.ts +1 -0
- package/dist/components/StatusBar/StatusBar.d.ts +22 -0
- package/dist/components/StatusBar/StatusBar.d.ts.map +1 -0
- package/dist/components/StatusBar/StatusBar.js +56 -0
- package/dist/components/StatusBar/StatusBar.js.map +1 -0
- package/dist/components/StatusBar/index.d.ts +3 -0
- package/dist/components/StatusBar/index.d.ts.map +1 -0
- package/dist/components/StatusLabel/StatusLabel.css +93 -0
- package/dist/components/StatusLabel/StatusLabel.css.d.ts +1 -0
- package/dist/components/StatusLabel/StatusLabel.d.ts +20 -0
- package/dist/components/StatusLabel/StatusLabel.d.ts.map +1 -0
- package/dist/components/StatusLabel/StatusLabel.js +42 -0
- package/dist/components/StatusLabel/StatusLabel.js.map +1 -0
- package/dist/components/StatusLabel/index.d.ts +3 -0
- package/dist/components/StatusLabel/index.d.ts.map +1 -0
- package/dist/components/Table/Table.css +253 -0
- package/dist/components/Table/Table.css.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +67 -0
- package/dist/components/Table/Table.d.ts.map +1 -0
- package/dist/components/Table/Table.js +429 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/index.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.css +138 -0
- package/dist/components/Tabs/Tabs.css.d.ts +1 -0
- package/dist/components/Tabs/Tabs.d.ts +34 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +140 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/TextInput/TextInput.css +133 -0
- package/dist/components/TextInput/TextInput.css.d.ts +1 -0
- package/dist/components/TextInput/TextInput.d.ts +16 -0
- package/dist/components/TextInput/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput/TextInput.js +38 -0
- package/dist/components/TextInput/TextInput.js.map +1 -0
- package/dist/components/TextInput/index.d.ts +3 -0
- package/dist/components/TextInput/index.d.ts.map +1 -0
- package/dist/components/Textarea/Textarea.css +121 -0
- package/dist/components/Textarea/Textarea.css.d.ts +1 -0
- package/dist/components/Textarea/Textarea.d.ts +21 -0
- package/dist/components/Textarea/Textarea.d.ts.map +1 -0
- package/dist/components/Textarea/Textarea.js +61 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textarea/index.d.ts +3 -0
- package/dist/components/Textarea/index.d.ts.map +1 -0
- package/dist/components/TitleBar/TitleBar.css +76 -0
- package/dist/components/TitleBar/TitleBar.css.d.ts +1 -0
- package/dist/components/TitleBar/TitleBar.d.ts +20 -0
- package/dist/components/TitleBar/TitleBar.d.ts.map +1 -0
- package/dist/components/TitleBar/TitleBar.js +43 -0
- package/dist/components/TitleBar/TitleBar.js.map +1 -0
- package/dist/components/TitleBar/index.d.ts +3 -0
- package/dist/components/TitleBar/index.d.ts.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.css +162 -0
- package/dist/components/ToggleButton/ToggleButton.css.d.ts +1 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +27 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.js +52 -0
- package/dist/components/ToggleButton/ToggleButton.js.map +1 -0
- package/dist/components/ToggleButton/index.d.ts +3 -0
- package/dist/components/ToggleButton/index.d.ts.map +1 -0
- package/dist/components/Toolbar/Toolbar.css +202 -0
- package/dist/components/Toolbar/Toolbar.css.d.ts +1 -0
- package/dist/components/Toolbar/Toolbar.d.ts +46 -0
- package/dist/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/components/Toolbar/Toolbar.js +102 -0
- package/dist/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/components/Toolbar/index.d.ts +3 -0
- package/dist/components/Toolbar/index.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.css +86 -0
- package/dist/components/Tooltip/Tooltip.css.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +22 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +92 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/TreeView/TreeView.css +191 -0
- package/dist/components/TreeView/TreeView.css.d.ts +1 -0
- package/dist/components/TreeView/TreeView.d.ts +46 -0
- package/dist/components/TreeView/TreeView.d.ts.map +1 -0
- package/dist/components/TreeView/TreeView.js +331 -0
- package/dist/components/TreeView/TreeView.js.map +1 -0
- package/dist/components/TreeView/index.d.ts +3 -0
- package/dist/components/TreeView/index.d.ts.map +1 -0
- package/dist/components/Window/Window.css +218 -0
- package/dist/components/Window/Window.css.d.ts +1 -0
- package/dist/components/Window/Window.d.ts +30 -0
- package/dist/components/Window/Window.d.ts.map +1 -0
- package/dist/components/Window/Window.js +156 -0
- package/dist/components/Window/Window.js.map +1 -0
- package/dist/components/Window/index.d.ts +3 -0
- package/dist/components/Window/index.d.ts.map +1 -0
- package/dist/index.d.ts +91 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -3
- package/dist/styles/scrollbars.css +123 -0
- package/dist/styles/scrollbars.css.d.ts +1 -0
- package/dist/styles/theme.css +86 -41
- package/dist/styles/tokens.css +202 -0
- package/dist/styles/tokens.css.d.ts +1 -0
- package/dist/test/a11y.d.ts +3 -0
- package/dist/test/a11y.d.ts.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/package.json +13 -2
- package/dist/components/GreenButton/GreenButton.css +0 -47
- package/dist/components/GreenButton/GreenButton.d.ts +0 -8
- package/dist/components/GreenButton/GreenButton.d.ts.map +0 -1
- package/dist/components/GreenButton/GreenButton.js +0 -20
- package/dist/components/GreenButton/GreenButton.js.map +0 -1
- package/dist/components/GreenButton/index.d.ts +0 -3
- package/dist/components/GreenPanel/GreenPanel.css +0 -45
- package/dist/components/GreenPanel/GreenPanel.d.ts +0 -12
- package/dist/components/GreenPanel/GreenPanel.d.ts.map +0 -1
- package/dist/components/GreenPanel/GreenPanel.js +0 -24
- package/dist/components/GreenPanel/GreenPanel.js.map +0 -1
- package/dist/components/GreenPanel/index.d.ts +0 -3
- /package/dist/components/{GreenButton/GreenButton.css.d.ts → Avatar/Avatar.css.d.ts} +0 -0
- /package/dist/components/{GreenPanel/GreenPanel.css.d.ts → Button/Button.css.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import './Console.css';
|
|
3
|
+
import '../../styles/scrollbars.css';
|
|
4
|
+
export type ConsoleLineKind = 'text' | 'error' | 'history';
|
|
5
|
+
export interface ConsoleLine {
|
|
6
|
+
/** Stable identity; also the React key. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The log text, rendered verbatim including whitespace. */
|
|
9
|
+
text: string;
|
|
10
|
+
/** Drives the colour: Text, Highlight3, or White for history. */
|
|
11
|
+
kind: ConsoleLineKind;
|
|
12
|
+
}
|
|
13
|
+
export interface ConsoleProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/** Lines in display order, oldest first. */
|
|
15
|
+
lines: ConsoleLine[];
|
|
16
|
+
/** Accessible name, e.g. "Server console". */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Scroll to the newest line when it is appended. */
|
|
19
|
+
follow?: boolean;
|
|
20
|
+
/** Maximum retained lines before the oldest are dropped. */
|
|
21
|
+
maxLines?: number;
|
|
22
|
+
/** Text prefixed to error lines so the failure is not colour-only; set to '' to disable. */
|
|
23
|
+
errorPrefix?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const Console: import("react").ForwardRefExoticComponent<ConsoleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
//# sourceMappingURL=Console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Console.d.ts","sourceRoot":"","sources":["../../../src/components/Console/Console.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,OAAO,CAAA;AAE1D,OAAO,eAAe,CAAA;AACtB,OAAO,6BAA6B,CAAA;AAEpC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AAE1D,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,iEAAiE;IACjE,IAAI,EAAE,eAAe,CAAA;CACtB;AAED,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,cAAc,CAAC;IAClE,4CAA4C;IAC5C,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,OAAO,yGA6ElB,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "../../styles/scrollbars.css";
|
|
4
|
+
import "./Console.css";
|
|
5
|
+
//#region src/components/Console/Console.tsx
|
|
6
|
+
var Console = forwardRef(function Console({ className, lines, label, follow = false, maxLines, errorPrefix = "ERR: ", style, ...rest }, ref) {
|
|
7
|
+
const scrollRef = useRef(null);
|
|
8
|
+
const setRef = useCallback((node) => {
|
|
9
|
+
scrollRef.current = node;
|
|
10
|
+
if (typeof ref === "function") ref(node);
|
|
11
|
+
else if (ref) ref.current = node;
|
|
12
|
+
}, [ref]);
|
|
13
|
+
const retained = maxLines === void 0 || lines.length <= maxLines ? lines : lines.slice(lines.length - Math.max(0, maxLines));
|
|
14
|
+
const newestId = retained[retained.length - 1]?.id;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!follow) return;
|
|
17
|
+
const node = scrollRef.current;
|
|
18
|
+
if (node === null) return;
|
|
19
|
+
node.scrollTop = node.scrollHeight;
|
|
20
|
+
}, [
|
|
21
|
+
follow,
|
|
22
|
+
newestId,
|
|
23
|
+
retained.length
|
|
24
|
+
]);
|
|
25
|
+
const classes = ["vgui-console", "vgui-scroll-surface"];
|
|
26
|
+
if (errorPrefix === "") classes.push("vgui-console--no-error-prefix");
|
|
27
|
+
if (className) classes.push(className);
|
|
28
|
+
const inlineStyle = {
|
|
29
|
+
...style,
|
|
30
|
+
"--vgui-console-error-prefix": JSON.stringify(errorPrefix)
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsx("div", {
|
|
33
|
+
ref: setRef,
|
|
34
|
+
role: "log",
|
|
35
|
+
"aria-live": "polite",
|
|
36
|
+
"aria-label": label,
|
|
37
|
+
tabIndex: 0,
|
|
38
|
+
className: classes.join(" "),
|
|
39
|
+
style: inlineStyle,
|
|
40
|
+
...rest,
|
|
41
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
42
|
+
className: "vgui-console__history",
|
|
43
|
+
children: retained.map((line) => {
|
|
44
|
+
const lineClasses = ["vgui-console__line"];
|
|
45
|
+
if (line.kind === "error") lineClasses.push("vgui-console__line--error");
|
|
46
|
+
if (line.kind === "history") lineClasses.push("vgui-console__line--history");
|
|
47
|
+
return /* @__PURE__ */ jsx("li", {
|
|
48
|
+
className: lineClasses.join(" "),
|
|
49
|
+
children: line.text
|
|
50
|
+
}, line.id);
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
Console.displayName = "Console";
|
|
56
|
+
//#endregion
|
|
57
|
+
export { Console };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=Console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Console.js","names":[],"sources":["../../../src/components/Console/Console.tsx"],"sourcesContent":["import { forwardRef, useCallback, useEffect, useRef } from 'react'\nimport type { CSSProperties, HTMLAttributes } from 'react'\n\nimport './Console.css'\nimport '../../styles/scrollbars.css'\n\nexport type ConsoleLineKind = 'text' | 'error' | 'history'\n\nexport interface ConsoleLine {\n /** Stable identity; also the React key. */\n id: string\n /** The log text, rendered verbatim including whitespace. */\n text: string\n /** Drives the colour: Text, Highlight3, or White for history. */\n kind: ConsoleLineKind\n}\n\nexport interface ConsoleProps extends HTMLAttributes<HTMLDivElement> {\n /** Lines in display order, oldest first. */\n lines: ConsoleLine[]\n /** Accessible name, e.g. \"Server console\". */\n label: string\n /** Scroll to the newest line when it is appended. */\n follow?: boolean\n /** Maximum retained lines before the oldest are dropped. */\n maxLines?: number\n /** Text prefixed to error lines so the failure is not colour-only; set to '' to disable. */\n errorPrefix?: string\n}\n\nexport const Console = forwardRef<HTMLDivElement, ConsoleProps>(function Console(\n {\n className,\n lines,\n label,\n follow = false,\n maxLines,\n errorPrefix = 'ERR: ',\n style,\n ...rest\n },\n ref,\n) {\n const scrollRef = useRef<HTMLDivElement | null>(null)\n\n const setRef = useCallback(\n (node: HTMLDivElement | null) => {\n scrollRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n },\n [ref],\n )\n\n // `maxLines` is an addition the corpus does not describe: an unbounded log is\n // an unbounded DOM.\n const retained =\n maxLines === undefined || lines.length <= maxLines\n ? lines\n : lines.slice(lines.length - Math.max(0, maxLines))\n const newestId = retained[retained.length - 1]?.id\n\n useEffect(() => {\n if (!follow) return\n const node = scrollRef.current\n if (node === null) return\n node.scrollTop = node.scrollHeight\n }, [follow, newestId, retained.length])\n\n const classes = ['vgui-console', 'vgui-scroll-surface']\n if (errorPrefix === '') classes.push('vgui-console--no-error-prefix')\n if (className) classes.push(className)\n\n const inlineStyle = {\n ...style,\n '--vgui-console-error-prefix': JSON.stringify(errorPrefix),\n } as CSSProperties\n\n return (\n <div\n ref={setRef}\n role=\"log\"\n aria-live=\"polite\"\n aria-label={label}\n tabIndex={0}\n className={classes.join(' ')}\n style={inlineStyle}\n {...rest}\n >\n <ol className=\"vgui-console__history\">\n {retained.map((line) => {\n const lineClasses = ['vgui-console__line']\n if (line.kind === 'error') lineClasses.push('vgui-console__line--error')\n if (line.kind === 'history') lineClasses.push('vgui-console__line--history')\n\n return (\n <li key={line.id} className={lineClasses.join(' ')}>\n {line.text}\n </li>\n )\n })}\n </ol>\n </div>\n )\n})\n\nConsole.displayName = 'Console'\n"],"mappings":";;;;;AA8BA,IAAa,UAAU,WAAyC,SAAS,QACvE,EACE,WACA,OACA,OACA,SAAS,OACT,UACA,cAAc,SACd,OACA,GAAG,QAEL,KACA;CACA,MAAM,YAAY,OAA8B,IAAI;CAEpD,MAAM,SAAS,aACZ,SAAgC;EAC/B,UAAU,UAAU;EACpB,IAAI,OAAO,QAAQ,YACjB,IAAI,IAAI;OACH,IAAI,KACT,IAAI,UAAU;CAElB,GACA,CAAC,GAAG,CACN;CAIA,MAAM,WACJ,aAAa,KAAA,KAAa,MAAM,UAAU,WACtC,QACA,MAAM,MAAM,MAAM,SAAS,KAAK,IAAI,GAAG,QAAQ,CAAC;CACtD,MAAM,WAAW,SAAS,SAAS,SAAS,EAAE,EAAE;CAEhD,gBAAgB;EACd,IAAI,CAAC,QAAQ;EACb,MAAM,OAAO,UAAU;EACvB,IAAI,SAAS,MAAM;EACnB,KAAK,YAAY,KAAK;CACxB,GAAG;EAAC;EAAQ;EAAU,SAAS;CAAM,CAAC;CAEtC,MAAM,UAAU,CAAC,gBAAgB,qBAAqB;CACtD,IAAI,gBAAgB,IAAI,QAAQ,KAAK,+BAA+B;CACpE,IAAI,WAAW,QAAQ,KAAK,SAAS;CAErC,MAAM,cAAc;EAClB,GAAG;EACH,+BAA+B,KAAK,UAAU,WAAW;CAC3D;CAEA,OACE,oBAAC,OAAD;EACE,KAAK;EACL,MAAK;EACL,aAAU;EACV,cAAY;EACZ,UAAU;EACV,WAAW,QAAQ,KAAK,GAAG;EAC3B,OAAO;EACP,GAAI;EAEJ,UAAA,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,SAAS,KAAK,SAAS;IACtB,MAAM,cAAc,CAAC,oBAAoB;IACzC,IAAI,KAAK,SAAS,SAAS,YAAY,KAAK,2BAA2B;IACvE,IAAI,KAAK,SAAS,WAAW,YAAY,KAAK,6BAA6B;IAE3E,OACE,oBAAC,MAAD;KAAkB,WAAW,YAAY,KAAK,GAAG;KAC9C,UAAA,KAAK;IACJ,GAFK,KAAK,EAEV;GAER,CAAC;EACC,CAAA;CACD,CAAA;AAET,CAAC;AAED,QAAQ,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Console/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Dialog — the VGUI `MessageBox` / modal frame.
|
|
3
|
+
*
|
|
4
|
+
* The dialog is a `Window` with modal semantics, so the frame's look (bevel,
|
|
5
|
+
* title bar, clay controls) comes from Window.css. Everything here is the part
|
|
6
|
+
* a message box adds: the dimming scrim, the four MessageBox shapes and the
|
|
7
|
+
* button row.
|
|
8
|
+
*
|
|
9
|
+
* `tokens.css` has no scrim, z-index or dialog-sizing tokens, so those values
|
|
10
|
+
* are declared as component-local custom properties on the two root classes.
|
|
11
|
+
* They are part of this component's public styling surface: set them on
|
|
12
|
+
* `.vgui-dialog-overlay` / `.vgui-dialog` to retheme without touching a token.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
.vgui-dialog-overlay {
|
|
16
|
+
--vgui-dialog-scrim: rgb(0 0 0 / 0.5);
|
|
17
|
+
--vgui-dialog-z-index: 900;
|
|
18
|
+
|
|
19
|
+
position: fixed;
|
|
20
|
+
inset: 0;
|
|
21
|
+
/*
|
|
22
|
+
* The scrim is decoration: it takes no focus, and centring the frame keeps
|
|
23
|
+
* the only way to hit it a click outside the frame.
|
|
24
|
+
*/
|
|
25
|
+
display: grid;
|
|
26
|
+
place-items: center;
|
|
27
|
+
outline: none;
|
|
28
|
+
background-color: var(--vgui-dialog-scrim);
|
|
29
|
+
z-index: var(--vgui-dialog-z-index);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* `.vgui-dialog` lands on the same element as Window's own `.vgui-window`, so
|
|
34
|
+
* the two selectors are written as one compound selector: the dialog owns the
|
|
35
|
+
* layout (a capped-height column) no matter which stylesheet a bundler emits
|
|
36
|
+
* first.
|
|
37
|
+
*/
|
|
38
|
+
.vgui-window.vgui-dialog {
|
|
39
|
+
--vgui-dialog-min-width: 320px;
|
|
40
|
+
--vgui-dialog-max-width: min(90vw, 640px);
|
|
41
|
+
--vgui-dialog-max-height: 90vh;
|
|
42
|
+
--vgui-dialog-footer-gap: 8px;
|
|
43
|
+
--vgui-dialog-footer-padding: 12px;
|
|
44
|
+
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
min-width: var(--vgui-dialog-min-width);
|
|
49
|
+
max-width: var(--vgui-dialog-max-width);
|
|
50
|
+
max-height: var(--vgui-dialog-max-height);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* The frame is a focus sink, not a stop: the trap below tabulates its children. */
|
|
54
|
+
.vgui-dialog:focus {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vgui-dialog__body {
|
|
59
|
+
flex: 1 1 auto;
|
|
60
|
+
min-height: 0;
|
|
61
|
+
overflow: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.vgui-dialog--invalid .vgui-dialog__body {
|
|
65
|
+
color: var(--vgui-danger);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.vgui-dialog__footer {
|
|
69
|
+
flex: 0 0 auto;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: flex-end;
|
|
73
|
+
gap: var(--vgui-dialog-footer-gap);
|
|
74
|
+
padding-top: var(--vgui-dialog-footer-padding);
|
|
75
|
+
border-top: var(--vgui-bevel-width) solid var(--vgui-bevel-dark);
|
|
76
|
+
box-shadow: inset 0 var(--vgui-bevel-width) 0 var(--vgui-bevel-light);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Valve's message boxes are a row of identical plates, not width-to-content. */
|
|
80
|
+
.vgui-dialog__footer .vgui-button {
|
|
81
|
+
min-width: var(--vgui-dialog-button-width);
|
|
82
|
+
min-height: var(--vgui-dialog-button-height);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Destructive dialogs mark the last action as the danger action. Only the label
|
|
87
|
+
* is recoloured: the plate's bevel belongs to Button, and a `--vgui-danger`
|
|
88
|
+
* border would flatten it. Consumers wanting the full treatment also pass
|
|
89
|
+
* `.vgui-button--danger` through `actions`.
|
|
90
|
+
*/
|
|
91
|
+
.vgui-dialog--destructive .vgui-dialog__footer .vgui-button:last-child {
|
|
92
|
+
color: var(--vgui-danger);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/*
|
|
96
|
+
* While an action is in flight the row is inert but still visible, so the user
|
|
97
|
+
* can see which choice they already made.
|
|
98
|
+
*/
|
|
99
|
+
.vgui-dialog--busy .vgui-dialog__footer > * {
|
|
100
|
+
pointer-events: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.vgui-dialog__spinner {
|
|
104
|
+
flex: 0 0 auto;
|
|
105
|
+
/* Sized in `em` off a token so no new pixel metric is introduced. */
|
|
106
|
+
font-size: var(--vgui-font-size-small);
|
|
107
|
+
width: 1em;
|
|
108
|
+
height: 1em;
|
|
109
|
+
border: var(--vgui-bevel-width) solid var(--vgui-bevel-dark);
|
|
110
|
+
border-top-color: var(--vgui-clay-glyph);
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
115
|
+
.vgui-dialog__spinner {
|
|
116
|
+
animation: vgui-dialog-spin 0.9s linear infinite;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@keyframes vgui-dialog-spin {
|
|
121
|
+
to {
|
|
122
|
+
transform: rotate(1turn);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.vgui-dialog .vgui-visually-hidden {
|
|
127
|
+
position: absolute;
|
|
128
|
+
width: 1px;
|
|
129
|
+
height: 1px;
|
|
130
|
+
margin: -1px;
|
|
131
|
+
padding: 0;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
clip: rect(0 0 0 0);
|
|
134
|
+
clip-path: inset(50%);
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
border: 0;
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
import type { WindowProps } from '../Window';
|
|
3
|
+
import './Dialog.css';
|
|
4
|
+
import '../../styles/scrollbars.css';
|
|
5
|
+
export interface DialogProps extends Omit<WindowProps, 'title' | 'onAction'> {
|
|
6
|
+
/** Dialog title, shown in the shared title bar. */
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** Whether the dialog is rendered. Uncontrolled by default. */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/** Called when the user dismisses via the close button, Escape or the scrim. */
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
/** Prompt or content. */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/** Footer actions. Rendered right-aligned in the order given. */
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
/** Hide the close button and ignore Escape. */
|
|
17
|
+
unclosable?: boolean;
|
|
18
|
+
/** Clicking the scrim dismisses. Off by default — accidental data loss. */
|
|
19
|
+
dismissOnOverlayClick?: boolean;
|
|
20
|
+
/** Element to focus when the dialog opens; defaults to the first action. */
|
|
21
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
22
|
+
/** Disable the button row while an action is in flight. */
|
|
23
|
+
busy?: boolean;
|
|
24
|
+
/** Which of the four MessageBox shapes this dialog reproduces. */
|
|
25
|
+
variant?: 'alert' | 'confirm' | 'prompt' | 'destructive';
|
|
26
|
+
}
|
|
27
|
+
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,cAAc,CAAA;AACrB,OAAO,6BAA6B,CAAA;AAEpC,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,CAAC;IAC1E,mDAAmD;IACnD,KAAK,EAAE,SAAS,CAAA;IAChB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,gFAAgF;IAChF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,iEAAiE;IACjE,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,2EAA2E;IAC3E,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,4EAA4E;IAC5E,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC/C,2DAA2D;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAA;CACzD;AAoCD,eAAO,MAAM,MAAM,wGAwKjB,CAAA"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Window } from "../Window/Window.js";
|
|
2
|
+
import { forwardRef, useCallback, useId, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import "./Dialog.css";
|
|
5
|
+
import "../../styles/scrollbars.css";
|
|
6
|
+
//#region src/components/Dialog/Dialog.tsx
|
|
7
|
+
/** Anything a dialog may move focus to, in DOM order. */
|
|
8
|
+
var FOCUSABLE_SELECTOR = [
|
|
9
|
+
"a[href]",
|
|
10
|
+
"button:not([disabled])",
|
|
11
|
+
"input:not([disabled])",
|
|
12
|
+
"select:not([disabled])",
|
|
13
|
+
"textarea:not([disabled])",
|
|
14
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
15
|
+
].join(", ");
|
|
16
|
+
var focusableWithin = (node) => Array.from(node.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
17
|
+
var initialTarget = (node) => {
|
|
18
|
+
const preferred = [
|
|
19
|
+
node.querySelector(".vgui-dialog__footer"),
|
|
20
|
+
node.querySelector(".vgui-dialog__body"),
|
|
21
|
+
node
|
|
22
|
+
];
|
|
23
|
+
for (const scope of preferred) {
|
|
24
|
+
if (!scope) continue;
|
|
25
|
+
const [first] = focusableWithin(scope);
|
|
26
|
+
if (first) return first;
|
|
27
|
+
}
|
|
28
|
+
return node;
|
|
29
|
+
};
|
|
30
|
+
var Dialog = forwardRef(function Dialog({ actions, busy = false, children, className, closable = true, controlsLabel, dismissOnOverlayClick = false, focused = true, icon, initialFocusRef, maximizable = false, maximized = false, minimizable = false, onDrag, onKeyDown, onOpenChange, open, resizable = false, title, tooltip, unclosable = false, variant = "confirm", ...sectionProps }, ref) {
|
|
31
|
+
const titleId = useId();
|
|
32
|
+
const bodyId = useId();
|
|
33
|
+
const overlayRef = useRef(null);
|
|
34
|
+
const dialogRef = useRef(null);
|
|
35
|
+
const restoreRef = useRef(null);
|
|
36
|
+
const [internalOpen, setInternalOpen] = useState(true);
|
|
37
|
+
const isOpen = open ?? internalOpen;
|
|
38
|
+
const setDialog = useCallback((node) => {
|
|
39
|
+
dialogRef.current = node;
|
|
40
|
+
if (typeof ref === "function") ref(node);
|
|
41
|
+
else if (ref) ref.current = node;
|
|
42
|
+
}, [ref]);
|
|
43
|
+
const requestOpen = (next) => {
|
|
44
|
+
if (open === void 0) setInternalOpen(next);
|
|
45
|
+
onOpenChange?.(next);
|
|
46
|
+
};
|
|
47
|
+
useLayoutEffect(() => {
|
|
48
|
+
if (!isOpen) return;
|
|
49
|
+
const node = dialogRef.current;
|
|
50
|
+
if (!node) return;
|
|
51
|
+
const previous = document.activeElement;
|
|
52
|
+
const target = initialFocusRef?.current ?? initialTarget(node);
|
|
53
|
+
if (!node.contains(document.activeElement)) {
|
|
54
|
+
target.focus();
|
|
55
|
+
restoreRef.current = previous;
|
|
56
|
+
}
|
|
57
|
+
return () => {
|
|
58
|
+
const restore = restoreRef.current;
|
|
59
|
+
if (restore instanceof HTMLElement && restore.isConnected) restore.focus();
|
|
60
|
+
restoreRef.current = null;
|
|
61
|
+
};
|
|
62
|
+
}, [initialFocusRef, isOpen]);
|
|
63
|
+
const handleOverlayClick = (event) => {
|
|
64
|
+
if (!dismissOnOverlayClick || unclosable) return;
|
|
65
|
+
if (event.target !== overlayRef.current) return;
|
|
66
|
+
requestOpen(false);
|
|
67
|
+
};
|
|
68
|
+
/** Wraps `Tab` at both ends of the dialog, which is what contains focus. */
|
|
69
|
+
const handleKeyDown = (event) => {
|
|
70
|
+
onKeyDown?.(event);
|
|
71
|
+
if (event.key !== "Tab") return;
|
|
72
|
+
const node = dialogRef.current;
|
|
73
|
+
if (!node) return;
|
|
74
|
+
const focusable = focusableWithin(node);
|
|
75
|
+
if (focusable.length === 0) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const first = focusable[0];
|
|
80
|
+
const last = focusable[focusable.length - 1];
|
|
81
|
+
const active = document.activeElement;
|
|
82
|
+
if (event.shiftKey) {
|
|
83
|
+
if (active === first || !node.contains(active)) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
last.focus();
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (active === last || !node.contains(active)) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
first.focus();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
if (!isOpen) return null;
|
|
95
|
+
return /* @__PURE__ */ jsx("div", {
|
|
96
|
+
ref: overlayRef,
|
|
97
|
+
className: "vgui-dialog-overlay",
|
|
98
|
+
onClick: handleOverlayClick,
|
|
99
|
+
children: /* @__PURE__ */ jsxs(Window, {
|
|
100
|
+
...sectionProps,
|
|
101
|
+
ref: setDialog,
|
|
102
|
+
role: "dialog",
|
|
103
|
+
"aria-modal": "true",
|
|
104
|
+
"aria-labelledby": titleId,
|
|
105
|
+
"aria-describedby": children ? bodyId : void 0,
|
|
106
|
+
"aria-busy": busy || void 0,
|
|
107
|
+
tabIndex: -1,
|
|
108
|
+
className: [
|
|
109
|
+
"vgui-dialog",
|
|
110
|
+
`vgui-dialog--${variant}`,
|
|
111
|
+
busy ? "vgui-dialog--busy" : null,
|
|
112
|
+
className
|
|
113
|
+
].filter(Boolean).join(" "),
|
|
114
|
+
focused,
|
|
115
|
+
minimizable,
|
|
116
|
+
maximizable,
|
|
117
|
+
maximized,
|
|
118
|
+
closable: closable && !unclosable,
|
|
119
|
+
resizable,
|
|
120
|
+
icon,
|
|
121
|
+
controlsLabel,
|
|
122
|
+
tooltip,
|
|
123
|
+
onDrag,
|
|
124
|
+
onAction: (action) => {
|
|
125
|
+
if (action === "close") requestOpen(false);
|
|
126
|
+
},
|
|
127
|
+
onKeyDown: handleKeyDown,
|
|
128
|
+
title: /* @__PURE__ */ jsx("span", {
|
|
129
|
+
id: titleId,
|
|
130
|
+
children: title
|
|
131
|
+
}),
|
|
132
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
133
|
+
className: "vgui-dialog__body vgui-scroll-surface",
|
|
134
|
+
id: bodyId,
|
|
135
|
+
children
|
|
136
|
+
}), actions ? /* @__PURE__ */ jsxs("div", {
|
|
137
|
+
className: "vgui-dialog__footer",
|
|
138
|
+
"data-busy": busy ? "true" : void 0,
|
|
139
|
+
children: [busy ? /* @__PURE__ */ jsx("span", {
|
|
140
|
+
className: "vgui-dialog__spinner",
|
|
141
|
+
"aria-hidden": "true"
|
|
142
|
+
}) : null, actions]
|
|
143
|
+
}) : null]
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
Dialog.displayName = "Dialog";
|
|
148
|
+
//#endregion
|
|
149
|
+
export { Dialog };
|
|
150
|
+
|
|
151
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":[],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefObject,\n} from 'react'\nimport { Window } from '../Window'\nimport type { WindowProps } from '../Window'\nimport './Dialog.css'\nimport '../../styles/scrollbars.css'\n\nexport interface DialogProps extends Omit<WindowProps, 'title' | 'onAction'> {\n /** Dialog title, shown in the shared title bar. */\n title: ReactNode\n /** Whether the dialog is rendered. Uncontrolled by default. */\n open?: boolean\n /** Called when the user dismisses via the close button, Escape or the scrim. */\n onOpenChange?: (open: boolean) => void\n /** Prompt or content. */\n children?: ReactNode\n /** Footer actions. Rendered right-aligned in the order given. */\n actions?: ReactNode\n /** Hide the close button and ignore Escape. */\n unclosable?: boolean\n /** Clicking the scrim dismisses. Off by default — accidental data loss. */\n dismissOnOverlayClick?: boolean\n /** Element to focus when the dialog opens; defaults to the first action. */\n initialFocusRef?: RefObject<HTMLElement | null>\n /** Disable the button row while an action is in flight. */\n busy?: boolean\n /** Which of the four MessageBox shapes this dialog reproduces. */\n variant?: 'alert' | 'confirm' | 'prompt' | 'destructive'\n}\n\n/** Anything a dialog may move focus to, in DOM order. */\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(', ')\n\nconst focusableWithin = (node: HTMLElement) =>\n Array.from(node.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR))\n\n/*\n * The frame's own controls sit before the body in DOM order, so a naive \"first\n * focusable\" would always land on the close button. The actions the user came\n * for come first, then the body, then the frame.\n */\nconst initialTarget = (node: HTMLElement) => {\n const preferred = [\n node.querySelector<HTMLElement>('.vgui-dialog__footer'),\n node.querySelector<HTMLElement>('.vgui-dialog__body'),\n node,\n ]\n\n for (const scope of preferred) {\n if (!scope) continue\n const [first] = focusableWithin(scope)\n if (first) return first\n }\n\n return node\n}\n\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(\n {\n actions,\n busy = false,\n children,\n className,\n closable = true,\n controlsLabel,\n dismissOnOverlayClick = false,\n focused = true,\n icon,\n initialFocusRef,\n maximizable = false,\n maximized = false,\n minimizable = false,\n onDrag,\n onKeyDown,\n onOpenChange,\n open,\n resizable = false,\n title,\n tooltip,\n unclosable = false,\n variant = 'confirm',\n ...sectionProps\n },\n ref,\n) {\n const titleId = useId()\n const bodyId = useId()\n const overlayRef = useRef<HTMLDivElement | null>(null)\n const dialogRef = useRef<HTMLDivElement | null>(null)\n const restoreRef = useRef<Element | null>(null)\n const [internalOpen, setInternalOpen] = useState(true)\n\n const isOpen = open ?? internalOpen\n\n const setDialog = useCallback(\n (node: HTMLDivElement | null) => {\n dialogRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) ref.current = node\n },\n [ref],\n )\n\n const requestOpen = (next: boolean) => {\n if (open === undefined) setInternalOpen(next)\n onOpenChange?.(next)\n }\n\n /*\n * A dialog that opens without moving focus leaves the keyboard user tabbing\n * around the page behind it, and one that closes without giving focus back\n * strands them at the top of the document.\n */\n useLayoutEffect(() => {\n if (!isOpen) return\n\n const node = dialogRef.current\n if (!node) return\n\n const previous = document.activeElement\n const target = initialFocusRef?.current ?? initialTarget(node)\n\n // `autoFocus` on a child already moved focus during commit; leave it alone.\n if (!node.contains(document.activeElement)) {\n target.focus()\n restoreRef.current = previous\n }\n\n return () => {\n const restore = restoreRef.current\n if (restore instanceof HTMLElement && restore.isConnected) restore.focus()\n restoreRef.current = null\n }\n }, [initialFocusRef, isOpen])\n\n const handleOverlayClick = (event: ReactMouseEvent<HTMLDivElement>) => {\n // Test the click target rather than stopping propagation, so a click that\n // starts inside the dialog but ends on the scrim is not treated as a\n // dismissal of the dialog.\n if (!dismissOnOverlayClick || unclosable) return\n if (event.target !== overlayRef.current) return\n requestOpen(false)\n }\n\n /** Wraps `Tab` at both ends of the dialog, which is what contains focus. */\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (event.key !== 'Tab') return\n\n const node = dialogRef.current\n if (!node) return\n\n const focusable = focusableWithin(node)\n if (focusable.length === 0) {\n event.preventDefault()\n return\n }\n\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n const active = document.activeElement\n\n if (event.shiftKey) {\n if (active === first || !node.contains(active)) {\n event.preventDefault()\n last.focus()\n }\n return\n }\n\n if (active === last || !node.contains(active)) {\n event.preventDefault()\n first.focus()\n }\n }\n\n if (!isOpen) return null\n\n return (\n <div ref={overlayRef} className=\"vgui-dialog-overlay\" onClick={handleOverlayClick}>\n <Window\n {...sectionProps}\n ref={setDialog}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={children ? bodyId : undefined}\n aria-busy={busy || undefined}\n tabIndex={-1}\n className={[\n 'vgui-dialog',\n `vgui-dialog--${variant}`,\n busy ? 'vgui-dialog--busy' : null,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n focused={focused}\n minimizable={minimizable}\n maximizable={maximizable}\n maximized={maximized}\n closable={closable && !unclosable}\n resizable={resizable}\n icon={icon}\n controlsLabel={controlsLabel}\n tooltip={tooltip}\n onDrag={onDrag}\n onAction={(action) => {\n if (action === 'close') requestOpen(false)\n }}\n onKeyDown={handleKeyDown}\n title={<span id={titleId}>{title}</span>}\n >\n <div className=\"vgui-dialog__body vgui-scroll-surface\" id={bodyId}>\n {children}\n </div>\n {actions ? (\n <div className=\"vgui-dialog__footer\" data-busy={busy ? 'true' : undefined}>\n {busy ? <span className=\"vgui-dialog__spinner\" aria-hidden=\"true\" /> : null}\n {actions}\n </div>\n ) : null}\n </Window>\n </div>\n )\n})\n\nDialog.displayName = 'Dialog'\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Green Steam divider — two 1px rows, dark above light
|
|
3
|
+
* (docs/components/Divider.md).
|
|
4
|
+
*
|
|
5
|
+
* The two-tone groove is a `linear-gradient` rather than `border` +
|
|
6
|
+
* `box-shadow`: a 2px-tall box needs a 1px row at the exact top and a 1px row
|
|
7
|
+
* at the exact bottom, which one declaration expresses and a border cannot.
|
|
8
|
+
* Both stop positions stay at `1px`, so the element must stay exactly 2px tall
|
|
9
|
+
* and use `margin` for any spacing.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
.vgui-divider {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
display: block;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 2px;
|
|
17
|
+
margin: 0;
|
|
18
|
+
border: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
background-image: linear-gradient(
|
|
21
|
+
to bottom,
|
|
22
|
+
var(--vgui-bevel-dark) 0,
|
|
23
|
+
var(--vgui-bevel-dark) 1px,
|
|
24
|
+
var(--vgui-bevel-light) 1px,
|
|
25
|
+
var(--vgui-bevel-light) 2px
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.vgui-divider--inset {
|
|
30
|
+
background-image: linear-gradient(
|
|
31
|
+
to bottom,
|
|
32
|
+
var(--vgui-bevel-light) 0,
|
|
33
|
+
var(--vgui-bevel-light) 1px,
|
|
34
|
+
var(--vgui-bevel-dark) 1px,
|
|
35
|
+
var(--vgui-bevel-dark) 2px
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.vgui-divider--vertical {
|
|
40
|
+
width: 2px;
|
|
41
|
+
height: 100%;
|
|
42
|
+
min-height: 1em;
|
|
43
|
+
background-image: linear-gradient(
|
|
44
|
+
to right,
|
|
45
|
+
var(--vgui-bevel-dark) 0,
|
|
46
|
+
var(--vgui-bevel-dark) 1px,
|
|
47
|
+
var(--vgui-bevel-light) 1px,
|
|
48
|
+
var(--vgui-bevel-light) 2px
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vgui-divider--spaced {
|
|
53
|
+
margin: 20px 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Forced-colors discards the gradient and the rule disappears, so it is drawn
|
|
58
|
+
* with a system-coloured border instead.
|
|
59
|
+
*/
|
|
60
|
+
@media (forced-colors: active) {
|
|
61
|
+
.vgui-divider,
|
|
62
|
+
.vgui-divider--inset,
|
|
63
|
+
.vgui-divider--vertical {
|
|
64
|
+
forced-color-adjust: none;
|
|
65
|
+
background-image: none;
|
|
66
|
+
border-top: 1px solid CanvasText;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
import './Divider.css';
|
|
3
|
+
export interface DividerProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Invert the two rows, for a rule sitting on a recessed surface. */
|
|
5
|
+
inset?: boolean;
|
|
6
|
+
/** Draw a vertical rule instead of a horizontal one. */
|
|
7
|
+
vertical?: boolean;
|
|
8
|
+
/** Add the standard 20px vertical margin. */
|
|
9
|
+
spaced?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/Divider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,eAAe,CAAA;AAEtB,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,cAAc,CAAC;IAClE,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,eAAO,MAAM,OAAO,yGAqBlB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import "./Divider.css";
|
|
4
|
+
//#region src/components/Divider/Divider.tsx
|
|
5
|
+
var Divider = forwardRef(function Divider({ className, inset = false, vertical = false, spaced = false, ...rest }, ref) {
|
|
6
|
+
const classes = ["vgui-divider"];
|
|
7
|
+
if (inset) classes.push("vgui-divider--inset");
|
|
8
|
+
if (vertical) classes.push("vgui-divider--vertical");
|
|
9
|
+
if (spaced) classes.push("vgui-divider--spaced");
|
|
10
|
+
if (className) classes.push(className);
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
ref,
|
|
13
|
+
role: "separator",
|
|
14
|
+
"aria-orientation": vertical ? "vertical" : "horizontal",
|
|
15
|
+
className: classes.join(" "),
|
|
16
|
+
...rest
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
Divider.displayName = "Divider";
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Divider };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","names":[],"sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport type { HTMLAttributes } from 'react'\n\nimport './Divider.css'\n\nexport interface DividerProps extends HTMLAttributes<HTMLDivElement> {\n /** Invert the two rows, for a rule sitting on a recessed surface. */\n inset?: boolean\n /** Draw a vertical rule instead of a horizontal one. */\n vertical?: boolean\n /** Add the standard 20px vertical margin. */\n spaced?: boolean\n}\n\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(function Divider(\n { className, inset = false, vertical = false, spaced = false, ...rest },\n ref,\n) {\n const classes = ['vgui-divider']\n if (inset) classes.push('vgui-divider--inset')\n if (vertical) classes.push('vgui-divider--vertical')\n if (spaced) classes.push('vgui-divider--spaced')\n if (className) classes.push(className)\n\n return (\n <div\n ref={ref}\n role=\"separator\"\n // ARIA's default orientation is vertical, so the horizontal case has to\n // say so out loud.\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={classes.join(' ')}\n {...rest}\n />\n )\n})\n\nDivider.displayName = 'Divider'\n"],"mappings":";;;;AAcA,IAAa,UAAU,WAAyC,SAAS,QACvE,EAAE,WAAW,QAAQ,OAAO,WAAW,OAAO,SAAS,OAAO,GAAG,QACjE,KACA;CACA,MAAM,UAAU,CAAC,cAAc;CAC/B,IAAI,OAAO,QAAQ,KAAK,qBAAqB;CAC7C,IAAI,UAAU,QAAQ,KAAK,wBAAwB;CACnD,IAAI,QAAQ,QAAQ,KAAK,sBAAsB;CAC/C,IAAI,WAAW,QAAQ,KAAK,SAAS;CAErC,OACE,oBAAC,OAAD;EACO;EACL,MAAK;EAGL,oBAAkB,WAAW,aAAa;EAC1C,WAAW,QAAQ,KAAK,GAAG;EAC3B,GAAI;CACL,CAAA;AAEL,CAAC;AAED,QAAQ,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
|