@dalcvil/steam-green-react 0.1.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/LICENSE +25 -25
- package/README.md +38 -12
- 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.css.d.ts +1 -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/FieldLabel/index.d.ts.map +1 -0
- 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 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -2
- package/dist/styles/scrollbars.css +123 -0
- package/dist/styles/scrollbars.css.d.ts +1 -0
- package/dist/styles/theme.css +167 -122
- 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 +23 -14
- 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/{GreenButton/GreenButton.css.d.ts → Avatar/Avatar.css.d.ts} +0 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import "./ColorPicker.css";
|
|
4
|
+
//#region src/components/ColorPicker/ColorPicker.tsx
|
|
5
|
+
var DEFAULT_PALETTE = [
|
|
6
|
+
{
|
|
7
|
+
name: "GreenBG",
|
|
8
|
+
value: "#4C5844"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: "LightGreenBG",
|
|
12
|
+
value: "#5A6A50"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "DarkGreenBG",
|
|
16
|
+
value: "#3E4637"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "BorderBright",
|
|
20
|
+
value: "#899281"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "BorderDark",
|
|
24
|
+
value: "#292D23"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "ShadeLighter",
|
|
28
|
+
value: "#B8C4AD"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "OffWhite",
|
|
32
|
+
value: "#D8DED3"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "White",
|
|
36
|
+
value: "#FFFFFF"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Label",
|
|
40
|
+
value: "#A0AA95"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "DimListText",
|
|
44
|
+
value: "#758666"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "DisabledText1",
|
|
48
|
+
value: "#75806F"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "DisabledText2",
|
|
52
|
+
value: "#282E22"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "Maize",
|
|
56
|
+
value: "#C4B550"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "MaizeBG",
|
|
60
|
+
value: "#91863C"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "Selection",
|
|
64
|
+
value: "#96892D"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "NavHover",
|
|
68
|
+
value: "#E3E41F"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "Link",
|
|
72
|
+
value: "#AAAAAA"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "FullGreen",
|
|
76
|
+
value: "#7EA64B"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "Success",
|
|
80
|
+
value: "#1AE225"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "Warning",
|
|
84
|
+
value: "#C4B550"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "Danger",
|
|
88
|
+
value: "#E2251A"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "Info",
|
|
92
|
+
value: "#0900FF"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "PingLow",
|
|
96
|
+
value: "#6A1610"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "PingMedium",
|
|
100
|
+
value: "#91863C"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "PingHigh",
|
|
104
|
+
value: "#4C5844"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "FriendsSelected",
|
|
108
|
+
value: "#111111"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "FriendsIgnored",
|
|
112
|
+
value: "#F86C4F"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "FriendsAvatarOver",
|
|
116
|
+
value: "#FFFFFF"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "ClayBG",
|
|
120
|
+
value: "#464646"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "LightClayBG",
|
|
124
|
+
value: "#686A65"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "LightClayButtonBG",
|
|
128
|
+
value: "#7D8078"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "ClaySheetBottom",
|
|
132
|
+
value: "#5C5957"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "DarkClayBG",
|
|
136
|
+
value: "#2F312D"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "ClayLightGreen",
|
|
140
|
+
value: "#ADB5A8"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "ClayDimLightGreen",
|
|
144
|
+
value: "#A6ACA2"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "BorderSelection",
|
|
148
|
+
value: "#000000"
|
|
149
|
+
}
|
|
150
|
+
];
|
|
151
|
+
var HEX_PATTERN = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
152
|
+
var isHex = (value) => HEX_PATTERN.test(value);
|
|
153
|
+
var normalizeHex = (value) => value.toUpperCase();
|
|
154
|
+
var rgbHex = (value) => value.slice(0, 7).toUpperCase();
|
|
155
|
+
var alphaOf = (value) => value.length === 9 ? parseInt(value.slice(7, 9), 16) : 255;
|
|
156
|
+
var withAlpha = (value, alpha) => `${rgbHex(value)}${Math.round(alpha).toString(16).padStart(2, "0").toUpperCase()}`;
|
|
157
|
+
var channelsOf = (value) => [
|
|
158
|
+
1,
|
|
159
|
+
3,
|
|
160
|
+
5
|
|
161
|
+
].map((i) => parseInt(value.slice(i, i + 2), 16) / 255);
|
|
162
|
+
var toHsv = (value) => {
|
|
163
|
+
const [r, g, b] = channelsOf(value);
|
|
164
|
+
const max = Math.max(r, g, b);
|
|
165
|
+
const delta = max - Math.min(r, g, b);
|
|
166
|
+
let h = 0;
|
|
167
|
+
if (delta !== 0) {
|
|
168
|
+
if (max === r) h = (g - b) / delta % 6;
|
|
169
|
+
else if (max === g) h = (b - r) / delta + 2;
|
|
170
|
+
else h = (r - g) / delta + 4;
|
|
171
|
+
h *= 60;
|
|
172
|
+
if (h < 0) h += 360;
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
h,
|
|
176
|
+
s: max === 0 ? 0 : delta / max,
|
|
177
|
+
v: max
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
var fromHsv = ({ h, s, v }) => {
|
|
181
|
+
const c = v * s;
|
|
182
|
+
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
183
|
+
const m = v - c;
|
|
184
|
+
const [r, g, b] = [
|
|
185
|
+
[
|
|
186
|
+
c,
|
|
187
|
+
x,
|
|
188
|
+
0
|
|
189
|
+
],
|
|
190
|
+
[
|
|
191
|
+
x,
|
|
192
|
+
c,
|
|
193
|
+
0
|
|
194
|
+
],
|
|
195
|
+
[
|
|
196
|
+
0,
|
|
197
|
+
c,
|
|
198
|
+
x
|
|
199
|
+
],
|
|
200
|
+
[
|
|
201
|
+
0,
|
|
202
|
+
x,
|
|
203
|
+
c
|
|
204
|
+
],
|
|
205
|
+
[
|
|
206
|
+
x,
|
|
207
|
+
0,
|
|
208
|
+
c
|
|
209
|
+
],
|
|
210
|
+
[
|
|
211
|
+
c,
|
|
212
|
+
0,
|
|
213
|
+
x
|
|
214
|
+
]
|
|
215
|
+
][Math.min(5, Math.floor(h / 60))];
|
|
216
|
+
const channel = (n) => Math.round((n + m) * 255).toString(16).padStart(2, "0").toUpperCase();
|
|
217
|
+
return `#${channel(r)}${channel(g)}${channel(b)}`;
|
|
218
|
+
};
|
|
219
|
+
var instance = 0;
|
|
220
|
+
var ColorPicker = forwardRef(function ColorPicker({ className, style, value, onValueChange, palette = DEFAULT_PALETTE, hex = false, continuous = false, alpha = false, columns = 12, swatchOnly = false, inline = false, disabled = false, "aria-label": ariaLabel, ...rest }, ref) {
|
|
221
|
+
const fallback = palette[0]?.value ?? "#4C5844";
|
|
222
|
+
const [internal, setInternal] = useState(() => normalizeHex(value ?? fallback));
|
|
223
|
+
const current = normalizeHex(value ?? internal);
|
|
224
|
+
const [ids] = useState(() => {
|
|
225
|
+
instance += 1;
|
|
226
|
+
return {
|
|
227
|
+
panel: `vgui-color-picker-${instance}-panel`,
|
|
228
|
+
listbox: `vgui-color-picker-${instance}-grid`,
|
|
229
|
+
option: (index) => `vgui-color-picker-${instance}-swatch-${index}`
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
const selectedIndex = palette.findIndex((entry) => normalizeHex(entry.value) === current);
|
|
233
|
+
const [open, setOpen] = useState(false);
|
|
234
|
+
const [activeIndex, setActiveIndex] = useState(() => selectedIndex >= 0 ? selectedIndex : 0);
|
|
235
|
+
const [hexDraft, setHexDraft] = useState(current);
|
|
236
|
+
const [seen, setSeen] = useState(current);
|
|
237
|
+
const [pending, setPending] = useState(null);
|
|
238
|
+
const [hsv, setHsv] = useState(() => toHsv(current));
|
|
239
|
+
if (seen !== current) {
|
|
240
|
+
setSeen(current);
|
|
241
|
+
setHexDraft(current);
|
|
242
|
+
setHsv(toHsv(current));
|
|
243
|
+
}
|
|
244
|
+
const display = pending ?? current;
|
|
245
|
+
const shownAlpha = alphaOf(display);
|
|
246
|
+
const hsvAlpha = alphaOf(current);
|
|
247
|
+
const hueHex = fromHsv({
|
|
248
|
+
h: hsv.h,
|
|
249
|
+
s: 1,
|
|
250
|
+
v: 1
|
|
251
|
+
});
|
|
252
|
+
const commit = (next) => {
|
|
253
|
+
const normalized = normalizeHex(next);
|
|
254
|
+
if (normalized === current) return;
|
|
255
|
+
if (value === void 0) setInternal(normalized);
|
|
256
|
+
onValueChange?.(normalized);
|
|
257
|
+
};
|
|
258
|
+
const applySliderValue = (event, next) => {
|
|
259
|
+
setPending(next);
|
|
260
|
+
if (event.nativeEvent.type === "change") {
|
|
261
|
+
setPending(null);
|
|
262
|
+
commit(next);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const rootRef = useRef(null);
|
|
266
|
+
const listboxRef = useRef(null);
|
|
267
|
+
const triggerRef = useRef(null);
|
|
268
|
+
const restoreFocus = useRef(true);
|
|
269
|
+
const wasOpen = useRef(false);
|
|
270
|
+
const setRefs = (node) => {
|
|
271
|
+
rootRef.current = node;
|
|
272
|
+
if (typeof ref === "function") ref(node);
|
|
273
|
+
else if (ref) ref.current = node;
|
|
274
|
+
};
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
if (open) {
|
|
277
|
+
wasOpen.current = true;
|
|
278
|
+
listboxRef.current?.focus();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (wasOpen.current) {
|
|
282
|
+
wasOpen.current = false;
|
|
283
|
+
if (restoreFocus.current) triggerRef.current?.focus();
|
|
284
|
+
}
|
|
285
|
+
restoreFocus.current = true;
|
|
286
|
+
}, [open]);
|
|
287
|
+
const openPanel = () => {
|
|
288
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
289
|
+
setOpen(true);
|
|
290
|
+
};
|
|
291
|
+
const closePanel = () => setOpen(false);
|
|
292
|
+
const choose = (index) => {
|
|
293
|
+
const entry = palette[index];
|
|
294
|
+
if (!entry || disabled) return;
|
|
295
|
+
commit(compose(entry.value));
|
|
296
|
+
if (!inline) closePanel();
|
|
297
|
+
};
|
|
298
|
+
const moveTo = (index) => setActiveIndex(Math.max(0, Math.min(palette.length - 1, index)));
|
|
299
|
+
const compose = (hex) => alpha && hsvAlpha < 255 ? withAlpha(hex, hsvAlpha) : normalizeHex(hex);
|
|
300
|
+
const handleGridKeyDown = (event) => {
|
|
301
|
+
switch (event.key) {
|
|
302
|
+
case "ArrowRight":
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
moveTo(activeIndex + 1);
|
|
305
|
+
break;
|
|
306
|
+
case "ArrowLeft":
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
moveTo(activeIndex - 1);
|
|
309
|
+
break;
|
|
310
|
+
case "ArrowDown":
|
|
311
|
+
event.preventDefault();
|
|
312
|
+
moveTo(activeIndex + columns);
|
|
313
|
+
break;
|
|
314
|
+
case "ArrowUp":
|
|
315
|
+
event.preventDefault();
|
|
316
|
+
moveTo(activeIndex - columns);
|
|
317
|
+
break;
|
|
318
|
+
case "Home":
|
|
319
|
+
event.preventDefault();
|
|
320
|
+
moveTo(0);
|
|
321
|
+
break;
|
|
322
|
+
case "End":
|
|
323
|
+
event.preventDefault();
|
|
324
|
+
moveTo(palette.length - 1);
|
|
325
|
+
break;
|
|
326
|
+
case "Enter":
|
|
327
|
+
case " ":
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
choose(activeIndex);
|
|
330
|
+
break;
|
|
331
|
+
case "Escape":
|
|
332
|
+
event.preventDefault();
|
|
333
|
+
closePanel();
|
|
334
|
+
break;
|
|
335
|
+
case "Tab":
|
|
336
|
+
restoreFocus.current = false;
|
|
337
|
+
closePanel();
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
const handleTriggerKeyDown = (event) => {
|
|
341
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
342
|
+
event.preventDefault();
|
|
343
|
+
openPanel();
|
|
344
|
+
} else if (event.key === "Escape" && open) {
|
|
345
|
+
event.preventDefault();
|
|
346
|
+
closePanel();
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
const commitHex = () => {
|
|
350
|
+
if (!isHex(hexDraft)) return;
|
|
351
|
+
commit(hexDraft);
|
|
352
|
+
};
|
|
353
|
+
const handleHexChange = (event) => {
|
|
354
|
+
setHexDraft(event.currentTarget.value.trim());
|
|
355
|
+
};
|
|
356
|
+
const handleHexKeyDown = (event) => {
|
|
357
|
+
if (event.key === "Enter") {
|
|
358
|
+
event.preventDefault();
|
|
359
|
+
commitHex();
|
|
360
|
+
} else if (event.key === "Escape") {
|
|
361
|
+
event.preventDefault();
|
|
362
|
+
setHexDraft(current);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
const classes = ["vgui-color-picker"];
|
|
366
|
+
if (hex) classes.push("vgui-color-picker--hex");
|
|
367
|
+
if (continuous) classes.push("vgui-color-picker--continuous");
|
|
368
|
+
if (alpha) classes.push("vgui-color-picker--alpha");
|
|
369
|
+
if (swatchOnly) classes.push("vgui-color-picker--swatch-only");
|
|
370
|
+
if (inline) classes.push("vgui-color-picker--inline");
|
|
371
|
+
if (className) classes.push(className);
|
|
372
|
+
const rootStyle = {
|
|
373
|
+
...style,
|
|
374
|
+
"--vgui-color-picker-columns": columns
|
|
375
|
+
};
|
|
376
|
+
const swatch = /* @__PURE__ */ jsx("span", {
|
|
377
|
+
className: "vgui-color-picker__swatch",
|
|
378
|
+
style: { "--vgui-swatch": display },
|
|
379
|
+
"data-alpha": shownAlpha < 255 ? "true" : void 0
|
|
380
|
+
});
|
|
381
|
+
const grid = /* @__PURE__ */ jsx("div", {
|
|
382
|
+
ref: listboxRef,
|
|
383
|
+
id: inline ? void 0 : ids.listbox,
|
|
384
|
+
className: "vgui-color-picker__grid",
|
|
385
|
+
role: "listbox",
|
|
386
|
+
"aria-label": "Colour palette",
|
|
387
|
+
"aria-activedescendant": ids.option(activeIndex),
|
|
388
|
+
tabIndex: 0,
|
|
389
|
+
onKeyDown: handleGridKeyDown,
|
|
390
|
+
children: palette.map((entry, index) => /* @__PURE__ */ jsx("div", {
|
|
391
|
+
id: ids.option(index),
|
|
392
|
+
className: "vgui-color-picker__option",
|
|
393
|
+
role: "option",
|
|
394
|
+
"aria-label": entry.name,
|
|
395
|
+
"aria-selected": normalizeHex(entry.value) === current,
|
|
396
|
+
"aria-disabled": disabled || void 0,
|
|
397
|
+
"data-active": index === activeIndex ? "true" : void 0,
|
|
398
|
+
"data-alpha": alphaOf(entry.value) < 255 ? "true" : void 0,
|
|
399
|
+
title: entry.name,
|
|
400
|
+
style: { "--vgui-option-color": entry.value },
|
|
401
|
+
onClick: () => choose(index)
|
|
402
|
+
}, `${entry.name}-${index}`))
|
|
403
|
+
});
|
|
404
|
+
const controls = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
405
|
+
continuous ? /* @__PURE__ */ jsxs("div", {
|
|
406
|
+
className: "vgui-color-picker__continuous",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsx("input", {
|
|
409
|
+
className: "vgui-color-picker__slider vgui-color-picker__hue",
|
|
410
|
+
type: "range",
|
|
411
|
+
min: 0,
|
|
412
|
+
max: 359,
|
|
413
|
+
step: 1,
|
|
414
|
+
"aria-label": "Hue",
|
|
415
|
+
value: Math.round(hsv.h),
|
|
416
|
+
disabled,
|
|
417
|
+
onChange: (event) => {
|
|
418
|
+
const next = {
|
|
419
|
+
...hsv,
|
|
420
|
+
h: Number(event.currentTarget.value)
|
|
421
|
+
};
|
|
422
|
+
setHsv(next);
|
|
423
|
+
applySliderValue(event, compose(fromHsv(next)));
|
|
424
|
+
}
|
|
425
|
+
}),
|
|
426
|
+
/* @__PURE__ */ jsx("div", {
|
|
427
|
+
className: "vgui-color-picker__sv",
|
|
428
|
+
"aria-hidden": "true",
|
|
429
|
+
style: { "--vgui-hue": hueHex }
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ jsx("input", {
|
|
432
|
+
className: "vgui-color-picker__slider vgui-color-picker__sv-saturation",
|
|
433
|
+
type: "range",
|
|
434
|
+
min: 0,
|
|
435
|
+
max: 100,
|
|
436
|
+
step: 1,
|
|
437
|
+
"aria-label": "Saturation",
|
|
438
|
+
value: Math.round(hsv.s * 100),
|
|
439
|
+
disabled,
|
|
440
|
+
onChange: (event) => {
|
|
441
|
+
const next = {
|
|
442
|
+
...hsv,
|
|
443
|
+
s: Number(event.currentTarget.value) / 100
|
|
444
|
+
};
|
|
445
|
+
setHsv(next);
|
|
446
|
+
applySliderValue(event, compose(fromHsv(next)));
|
|
447
|
+
}
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ jsx("input", {
|
|
450
|
+
className: "vgui-color-picker__slider vgui-color-picker__sv-value",
|
|
451
|
+
type: "range",
|
|
452
|
+
min: 0,
|
|
453
|
+
max: 100,
|
|
454
|
+
step: 1,
|
|
455
|
+
"aria-label": "Brightness",
|
|
456
|
+
value: Math.round(hsv.v * 100),
|
|
457
|
+
disabled,
|
|
458
|
+
onChange: (event) => {
|
|
459
|
+
const next = {
|
|
460
|
+
...hsv,
|
|
461
|
+
v: Number(event.currentTarget.value) / 100
|
|
462
|
+
};
|
|
463
|
+
setHsv(next);
|
|
464
|
+
applySliderValue(event, compose(fromHsv(next)));
|
|
465
|
+
}
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
}) : null,
|
|
469
|
+
alpha ? /* @__PURE__ */ jsx("input", {
|
|
470
|
+
className: "vgui-color-picker__slider vgui-color-picker__alpha",
|
|
471
|
+
type: "range",
|
|
472
|
+
min: 0,
|
|
473
|
+
max: 255,
|
|
474
|
+
step: 1,
|
|
475
|
+
"aria-label": "Alpha",
|
|
476
|
+
"aria-valuetext": `${Math.round(shownAlpha / 255 * 100)}%`,
|
|
477
|
+
value: shownAlpha,
|
|
478
|
+
disabled,
|
|
479
|
+
onChange: (event) => applySliderValue(event, withAlpha(display, Number(event.currentTarget.value)))
|
|
480
|
+
}) : null,
|
|
481
|
+
hex ? /* @__PURE__ */ jsx("input", {
|
|
482
|
+
className: "vgui-color-picker__hex",
|
|
483
|
+
type: "text",
|
|
484
|
+
"aria-label": "Hex colour",
|
|
485
|
+
"aria-invalid": isHex(hexDraft) ? void 0 : true,
|
|
486
|
+
spellCheck: false,
|
|
487
|
+
value: hexDraft,
|
|
488
|
+
disabled,
|
|
489
|
+
onChange: handleHexChange,
|
|
490
|
+
onKeyDown: handleHexKeyDown,
|
|
491
|
+
onBlur: commitHex
|
|
492
|
+
}) : null
|
|
493
|
+
] });
|
|
494
|
+
return /* @__PURE__ */ jsx("div", {
|
|
495
|
+
ref: setRefs,
|
|
496
|
+
className: classes.join(" "),
|
|
497
|
+
style: rootStyle,
|
|
498
|
+
...rest,
|
|
499
|
+
children: inline ? /* @__PURE__ */ jsxs(Fragment$1, { children: [grid, controls] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
500
|
+
ref: triggerRef,
|
|
501
|
+
type: "button",
|
|
502
|
+
className: "vgui-color-picker__trigger",
|
|
503
|
+
"aria-label": ariaLabel,
|
|
504
|
+
"aria-haspopup": "dialog",
|
|
505
|
+
"aria-expanded": open,
|
|
506
|
+
"aria-controls": ids.panel,
|
|
507
|
+
disabled,
|
|
508
|
+
onClick: () => open ? closePanel() : openPanel(),
|
|
509
|
+
onKeyDown: handleTriggerKeyDown,
|
|
510
|
+
children: [
|
|
511
|
+
swatch,
|
|
512
|
+
swatchOnly ? null : /* @__PURE__ */ jsx("span", {
|
|
513
|
+
className: "vgui-color-picker__label",
|
|
514
|
+
children: display
|
|
515
|
+
}),
|
|
516
|
+
/* @__PURE__ */ jsx("span", {
|
|
517
|
+
className: "vgui-color-picker__arrow",
|
|
518
|
+
"aria-hidden": "true"
|
|
519
|
+
})
|
|
520
|
+
]
|
|
521
|
+
}), open ? /* @__PURE__ */ jsxs("div", {
|
|
522
|
+
id: ids.panel,
|
|
523
|
+
className: "vgui-color-picker__panel",
|
|
524
|
+
role: "dialog",
|
|
525
|
+
"aria-label": "Colour palette",
|
|
526
|
+
children: [grid, controls]
|
|
527
|
+
}) : null] })
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
ColorPicker.displayName = "ColorPicker";
|
|
531
|
+
//#endregion
|
|
532
|
+
export { ColorPicker };
|
|
533
|
+
|
|
534
|
+
//# sourceMappingURL=ColorPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","names":[],"sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { useEffect, useRef, useState, forwardRef } from 'react'\nimport type {\n ChangeEvent as ReactChangeEvent,\n CSSProperties,\n HTMLAttributes,\n KeyboardEvent as ReactKeyboardEvent,\n} from 'react'\n\nimport './ColorPicker.css'\n\n/*\n * The palette is `foundations.md` §3 — the theme's own token table, which is\n * the corpus's colour list (`steamscheme.res:10-71`). These are data, not\n * styling: they are handed to CSS as custom properties, which is why they are\n * literal hex strings rather than `var()` references.\n */\nconst DEFAULT_PALETTE: Array<{ name: string; value: string }> = [\n { name: 'GreenBG', value: '#4C5844' },\n { name: 'LightGreenBG', value: '#5A6A50' },\n { name: 'DarkGreenBG', value: '#3E4637' },\n { name: 'BorderBright', value: '#899281' },\n { name: 'BorderDark', value: '#292D23' },\n { name: 'ShadeLighter', value: '#B8C4AD' },\n { name: 'OffWhite', value: '#D8DED3' },\n { name: 'White', value: '#FFFFFF' },\n { name: 'Label', value: '#A0AA95' },\n { name: 'DimListText', value: '#758666' },\n { name: 'DisabledText1', value: '#75806F' },\n { name: 'DisabledText2', value: '#282E22' },\n { name: 'Maize', value: '#C4B550' },\n { name: 'MaizeBG', value: '#91863C' },\n { name: 'Selection', value: '#96892D' },\n { name: 'NavHover', value: '#E3E41F' },\n { name: 'Link', value: '#AAAAAA' },\n { name: 'FullGreen', value: '#7EA64B' },\n { name: 'Success', value: '#1AE225' },\n { name: 'Warning', value: '#C4B550' },\n { name: 'Danger', value: '#E2251A' },\n { name: 'Info', value: '#0900FF' },\n { name: 'PingLow', value: '#6A1610' },\n { name: 'PingMedium', value: '#91863C' },\n { name: 'PingHigh', value: '#4C5844' },\n { name: 'FriendsSelected', value: '#111111' },\n { name: 'FriendsIgnored', value: '#F86C4F' },\n { name: 'FriendsAvatarOver', value: '#FFFFFF' },\n { name: 'ClayBG', value: '#464646' },\n { name: 'LightClayBG', value: '#686A65' },\n { name: 'LightClayButtonBG', value: '#7D8078' },\n { name: 'ClaySheetBottom', value: '#5C5957' },\n { name: 'DarkClayBG', value: '#2F312D' },\n { name: 'ClayLightGreen', value: '#ADB5A8' },\n { name: 'ClayDimLightGreen', value: '#A6ACA2' },\n { name: 'BorderSelection', value: '#000000' },\n]\n\n/* The corpus writes alpha as a fourth component (`\"0 0 0 128\"`), so it is part\n * of the value grammar even though the theme barely uses it. */\nconst HEX_PATTERN = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i\n\nconst isHex = (value: string) => HEX_PATTERN.test(value)\n\nconst normalizeHex = (value: string) => value.toUpperCase()\n\nconst rgbHex = (value: string) => value.slice(0, 7).toUpperCase()\n\nconst alphaOf = (value: string) => (value.length === 9 ? parseInt(value.slice(7, 9), 16) : 255)\n\nconst withAlpha = (value: string, alpha: number) =>\n `${rgbHex(value)}${Math.round(alpha).toString(16).padStart(2, '0').toUpperCase()}`\n\nconst channelsOf = (value: string) => [1, 3, 5].map((i) => parseInt(value.slice(i, i + 2), 16) / 255)\n\nconst toHsv = (value: string) => {\n const [r, g, b] = channelsOf(value)\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const delta = max - min\n let h = 0\n if (delta !== 0) {\n if (max === r) h = ((g - b) / delta) % 6\n else if (max === g) h = (b - r) / delta + 2\n else h = (r - g) / delta + 4\n h *= 60\n if (h < 0) h += 360\n }\n return { h, s: max === 0 ? 0 : delta / max, v: max }\n}\n\nconst fromHsv = ({ h, s, v }: { h: number; s: number; v: number }) => {\n const c = v * s\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n const m = v - c\n const segments = [\n [c, x, 0],\n [x, c, 0],\n [0, c, x],\n [0, x, c],\n [x, 0, c],\n [c, 0, x],\n ]\n const [r, g, b] = segments[Math.min(5, Math.floor(h / 60))]\n const channel = (n: number) =>\n Math.round((n + m) * 255)\n .toString(16)\n .padStart(2, '0')\n .toUpperCase()\n\n return `#${channel(r)}${channel(g)}${channel(b)}`\n}\n\nlet instance = 0\n\nexport interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Current colour as `#RRGGBB` or `#RRGGBBAA`. */\n value?: string\n /** Called with the new colour when the user commits a choice. */\n onValueChange?: (value: string) => void\n /** Palette to show. Defaults to the scheme's named colours. */\n palette?: Array<{ name: string; value: string }>\n /** Show the hex text input beside the grid. */\n hex?: boolean\n /** Add a hue strip and saturation/value square. Not period-accurate. */\n continuous?: boolean\n /** Allow alpha editing. */\n alpha?: boolean\n /** Grid columns. 12 fits the scheme palette in three tidy rows. */\n columns?: number\n /** Render the swatch alone, with no hex label in the trigger. */\n swatchOnly?: boolean\n /** Grid always visible; no trigger or panel. */\n inline?: boolean\n /** Disable the control and the panel. */\n disabled?: boolean\n}\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(function ColorPicker(\n {\n className,\n style,\n value,\n onValueChange,\n palette = DEFAULT_PALETTE,\n hex = false,\n continuous = false,\n alpha = false,\n columns = 12,\n swatchOnly = false,\n inline = false,\n disabled = false,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n) {\n const fallback = palette[0]?.value ?? '#4C5844'\n const [internal, setInternal] = useState(() => normalizeHex(value ?? fallback))\n const current = normalizeHex(value ?? internal)\n\n const [ids] = useState(() => {\n instance += 1\n return {\n panel: `vgui-color-picker-${instance}-panel`,\n listbox: `vgui-color-picker-${instance}-grid`,\n option: (index: number) => `vgui-color-picker-${instance}-swatch-${index}`,\n }\n })\n\n const selectedIndex = palette.findIndex((entry) => normalizeHex(entry.value) === current)\n\n const [open, setOpen] = useState(false)\n const [activeIndex, setActiveIndex] = useState(() => (selectedIndex >= 0 ? selectedIndex : 0))\n\n /* The hex field and the sliders own their text until the value is valid. */\n const [hexDraft, setHexDraft] = useState(current)\n const [seen, setSeen] = useState(current)\n\n /*\n * A live preview: a drag emits `input` continuously, so the value is only\n * committed when the interaction ends and the `change` event arrives, as the\n * doc's accessibility notes require.\n */\n const [pending, setPending] = useState<string | null>(null)\n const [hsv, setHsv] = useState(() => toHsv(current))\n\n if (seen !== current) {\n setSeen(current)\n setHexDraft(current)\n setHsv(toHsv(current))\n }\n\n const display = pending ?? current\n const shownAlpha = alphaOf(display)\n const hsvAlpha = alphaOf(current)\n const hueHex = fromHsv({ h: hsv.h, s: 1, v: 1 })\n\n const commit = (next: string) => {\n const normalized = normalizeHex(next)\n if (normalized === current) return\n if (value === undefined) setInternal(normalized)\n onValueChange?.(normalized)\n }\n\n /*\n * React maps `onChange` on a range input to both the `input` and the `change`\n * event; only the latter is the commit point. The intermediate value still\n * paints, so the swatch follows the drag.\n */\n const applySliderValue = (event: ReactChangeEvent<HTMLInputElement>, next: string) => {\n setPending(next)\n if (event.nativeEvent.type === 'change') {\n setPending(null)\n commit(next)\n }\n }\n\n const rootRef = useRef<HTMLDivElement | null>(null)\n const listboxRef = useRef<HTMLDivElement | null>(null)\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const restoreFocus = useRef(true)\n const wasOpen = useRef(false)\n\n const setRefs = (node: HTMLDivElement | null) => {\n rootRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLDivElement | null }).current = node\n }\n\n useEffect(() => {\n if (open) {\n wasOpen.current = true\n listboxRef.current?.focus()\n return\n }\n if (wasOpen.current) {\n wasOpen.current = false\n if (restoreFocus.current) triggerRef.current?.focus()\n }\n restoreFocus.current = true\n }, [open])\n\n const openPanel = () => {\n setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0)\n setOpen(true)\n }\n\n const closePanel = () => setOpen(false)\n\n const choose = (index: number) => {\n const entry = palette[index]\n if (!entry || disabled) return\n /* An edited alpha carries across palette picks; a full alpha does not. */\n commit(compose(entry.value))\n if (!inline) closePanel()\n }\n\n const moveTo = (index: number) => setActiveIndex(Math.max(0, Math.min(palette.length - 1, index)))\n\n /* Alpha only survives a change when the control is actually editing it, so a\n * picker without `alpha` keeps emitting 6-digit values. */\n const compose = (hex: string) => (alpha && hsvAlpha < 255 ? withAlpha(hex, hsvAlpha) : normalizeHex(hex))\n\n const handleGridKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case 'ArrowRight':\n event.preventDefault()\n moveTo(activeIndex + 1)\n break\n case 'ArrowLeft':\n event.preventDefault()\n moveTo(activeIndex - 1)\n break\n case 'ArrowDown':\n event.preventDefault()\n moveTo(activeIndex + columns)\n break\n case 'ArrowUp':\n event.preventDefault()\n moveTo(activeIndex - columns)\n break\n case 'Home':\n event.preventDefault()\n moveTo(0)\n break\n case 'End':\n event.preventDefault()\n moveTo(palette.length - 1)\n break\n case 'Enter':\n case ' ':\n event.preventDefault()\n choose(activeIndex)\n break\n case 'Escape':\n event.preventDefault()\n closePanel()\n break\n case 'Tab':\n /* Not a focus trap: the panel simply closes and focus moves on. */\n restoreFocus.current = false\n closePanel()\n break\n default:\n break\n }\n }\n\n const handleTriggerKeyDown = (event: ReactKeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n openPanel()\n } else if (event.key === 'Escape' && open) {\n event.preventDefault()\n closePanel()\n }\n }\n\n const commitHex = () => {\n if (!isHex(hexDraft)) return\n commit(hexDraft)\n }\n\n const handleHexChange = (event: ReactChangeEvent<HTMLInputElement>) => {\n setHexDraft(event.currentTarget.value.trim())\n }\n\n const handleHexKeyDown = (event: ReactKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commitHex()\n } else if (event.key === 'Escape') {\n event.preventDefault()\n setHexDraft(current)\n }\n }\n\n const classes = ['vgui-color-picker']\n if (hex) classes.push('vgui-color-picker--hex')\n if (continuous) classes.push('vgui-color-picker--continuous')\n if (alpha) classes.push('vgui-color-picker--alpha')\n if (swatchOnly) classes.push('vgui-color-picker--swatch-only')\n if (inline) classes.push('vgui-color-picker--inline')\n if (className) classes.push(className)\n\n const rootStyle = {\n ...style,\n '--vgui-color-picker-columns': columns,\n } as CSSProperties\n\n const swatch = (\n <span\n className=\"vgui-color-picker__swatch\"\n style={{ '--vgui-swatch': display } as CSSProperties}\n data-alpha={shownAlpha < 255 ? 'true' : undefined}\n />\n )\n\n const grid = (\n <div\n ref={listboxRef}\n id={inline ? undefined : ids.listbox}\n className=\"vgui-color-picker__grid\"\n role=\"listbox\"\n aria-label=\"Colour palette\"\n aria-activedescendant={ids.option(activeIndex)}\n tabIndex={0}\n onKeyDown={handleGridKeyDown}\n >\n {palette.map((entry, index) => (\n <div\n key={`${entry.name}-${index}`}\n id={ids.option(index)}\n className=\"vgui-color-picker__option\"\n role=\"option\"\n aria-label={entry.name}\n aria-selected={normalizeHex(entry.value) === current}\n aria-disabled={disabled || undefined}\n data-active={index === activeIndex ? 'true' : undefined}\n data-alpha={alphaOf(entry.value) < 255 ? 'true' : undefined}\n title={entry.name}\n style={{ '--vgui-option-color': entry.value } as CSSProperties}\n onClick={() => choose(index)}\n />\n ))}\n </div>\n )\n\n const controls = (\n <>\n {continuous ? (\n <div className=\"vgui-color-picker__continuous\">\n <input\n className=\"vgui-color-picker__slider vgui-color-picker__hue\"\n type=\"range\"\n min={0}\n max={359}\n step={1}\n aria-label=\"Hue\"\n value={Math.round(hsv.h)}\n disabled={disabled}\n onChange={(event) => {\n const next = { ...hsv, h: Number(event.currentTarget.value) }\n setHsv(next)\n applySliderValue(event, compose(fromHsv(next)))\n }}\n />\n {/* The square is a data visualisation; the two sliders below it are\n the operable controls, which is what the a11y notes require. */}\n <div className=\"vgui-color-picker__sv\" aria-hidden=\"true\" style={{ '--vgui-hue': hueHex } as CSSProperties} />\n <input\n className=\"vgui-color-picker__slider vgui-color-picker__sv-saturation\"\n type=\"range\"\n min={0}\n max={100}\n step={1}\n aria-label=\"Saturation\"\n value={Math.round(hsv.s * 100)}\n disabled={disabled}\n onChange={(event) => {\n const next = { ...hsv, s: Number(event.currentTarget.value) / 100 }\n setHsv(next)\n applySliderValue(event, compose(fromHsv(next)))\n }}\n />\n <input\n className=\"vgui-color-picker__slider vgui-color-picker__sv-value\"\n type=\"range\"\n min={0}\n max={100}\n step={1}\n aria-label=\"Brightness\"\n value={Math.round(hsv.v * 100)}\n disabled={disabled}\n onChange={(event) => {\n const next = { ...hsv, v: Number(event.currentTarget.value) / 100 }\n setHsv(next)\n applySliderValue(event, compose(fromHsv(next)))\n }}\n />\n </div>\n ) : null}\n\n {alpha ? (\n <input\n className=\"vgui-color-picker__slider vgui-color-picker__alpha\"\n type=\"range\"\n min={0}\n max={255}\n step={1}\n aria-label=\"Alpha\"\n aria-valuetext={`${Math.round((shownAlpha / 255) * 100)}%`}\n value={shownAlpha}\n disabled={disabled}\n onChange={(event) => applySliderValue(event, withAlpha(display, Number(event.currentTarget.value)))}\n />\n ) : null}\n\n {hex ? (\n <input\n className=\"vgui-color-picker__hex\"\n type=\"text\"\n aria-label=\"Hex colour\"\n aria-invalid={isHex(hexDraft) ? undefined : true}\n spellCheck={false}\n value={hexDraft}\n disabled={disabled}\n onChange={handleHexChange}\n onKeyDown={handleHexKeyDown}\n onBlur={commitHex}\n />\n ) : null}\n </>\n )\n\n return (\n <div\n ref={setRefs}\n className={classes.join(' ')}\n style={rootStyle}\n {...rest}\n >\n {inline ? (\n <>\n {grid}\n {controls}\n </>\n ) : (\n <>\n <button\n ref={triggerRef}\n type=\"button\"\n className=\"vgui-color-picker__trigger\"\n aria-label={ariaLabel}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={ids.panel}\n disabled={disabled}\n onClick={() => (open ? closePanel() : openPanel())}\n onKeyDown={handleTriggerKeyDown}\n >\n {swatch}\n {swatchOnly ? null : <span className=\"vgui-color-picker__label\">{display}</span>}\n <span className=\"vgui-color-picker__arrow\" aria-hidden=\"true\" />\n </button>\n {open ? (\n <div\n id={ids.panel}\n className=\"vgui-color-picker__panel\"\n role=\"dialog\"\n aria-label=\"Colour palette\"\n >\n {grid}\n {controls}\n </div>\n ) : null}\n </>\n )}\n </div>\n )\n})\n\nColorPicker.displayName = 'ColorPicker'\n"],"mappings":";;;;AAgBA,IAAM,kBAA0D;CAC9D;EAAE,MAA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,SAAD;GACE,WAAU;GACV,MAAK;GACL,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAW;GACX,kBAAgB,GAAG,KAAK,MAAO,aAAa,MAAO,GAAG,EAAE;GACxD,OAAO;GACG;GACV,WAAW,UAAU,iBAAiB,OAAO,UAAU,SAAS,OAAO,MAAM,cAAc,KAAK,CAAC,CAAC;EACnG,CAAA,IACC;EAEH,MACC,oBAAC,SAAD;GACE,WAAU;GACV,MAAK;GACL,cAAW;GACX,gBAAc,MAAM,QAAQ,IAAI,KAAA,IAAY;GAC5C,YAAY;GACZ,OAAO;GACG;GACV,UAAU;GACV,WAAW;GACX,QAAQ;EACT,CAAA,IACC;CACJ,EAAA,CAAA;CAGJ,OACE,oBAAC,OAAD;EACE,KAAK;EACL,WAAW,QAAQ,KAAK,GAAG;EAC3B,OAAO;EACP,GAAI;EAEH,UAAA,SACC,qBAAA,YAAA,EAAA,UAAA,CACG,MACA,QACD,EAAA,CAAA,IAEF,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,UAAD;GACE,KAAK;GACL,MAAK;GACL,WAAU;GACV,cAAY;GACZ,iBAAc;GACd,iBAAe;GACf,iBAAe,IAAI;GACT;GACV,eAAgB,OAAO,WAAW,IAAI,UAAU;GAChD,WAAW;GAVb,UAAA;IAYG;IACA,aAAa,OAAO,oBAAC,QAAD;KAAM,WAAU;KAA4B,UAAA;IAAc,CAAA;IAC/E,oBAAC,QAAD;KAAM,WAAU;KAA2B,eAAY;IAAQ,CAAA;GACzD;EACP,CAAA,GAAA,OACC,qBAAC,OAAD;GACE,IAAI,IAAI;GACR,WAAU;GACV,MAAK;GACL,cAAW;GAJb,UAAA,CAMG,MACA,QACE;EACH,CAAA,IAAA,IACJ,EAAA,CAAA;CAED,CAAA;AAET,CAAC;AAED,YAAY,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Green Steam console.
|
|
3
|
+
*
|
|
4
|
+
* There is no `Console` block in `steam.styles`: the console *is* a RichText
|
|
5
|
+
* (docs/components/Console.md), so it takes the recessed frame and the
|
|
6
|
+
* `DarkGreenBG` interior from RichText and adds exactly two things — a 12px
|
|
7
|
+
* monospace family (the theme's only non-`basefont` text) and a per-line colour.
|
|
8
|
+
*
|
|
9
|
+
* Live output is `Text` (#A0AA95), scrollback is `White`, and errors are
|
|
10
|
+
* `Highlight3`, which is `--vgui-console-error` in `src/styles/tokens.css`.
|
|
11
|
+
*
|
|
12
|
+
* Component-local metrics are declared here per foundations.md §4; shared
|
|
13
|
+
* palette tokens are referenced bare.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
.vgui-console {
|
|
17
|
+
--vgui-console-font: var(--vgui-font-mono);
|
|
18
|
+
--vgui-console-font-size: var(--vgui-font-size-small);
|
|
19
|
+
--vgui-console-line-height: 1.35;
|
|
20
|
+
--vgui-console-bg: var(--vgui-surface-dark); /* DarkGreenBG */
|
|
21
|
+
--vgui-console-text: var(--vgui-text-muted); /* Text, steam.styles:57 */
|
|
22
|
+
--vgui-console-history-text: var(--vgui-text-strong); /* White */
|
|
23
|
+
--vgui-console-selection-bg: var(--vgui-accent-dark); /* MaizeBG */
|
|
24
|
+
--vgui-console-inset: var(--vgui-richtext-inset, 6px);
|
|
25
|
+
--vgui-console-error-prefix: 'ERR: ';
|
|
26
|
+
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
/* Inverted bevel: top/left dark, bottom/right lit — the recessed orientation
|
|
29
|
+
RichText shares with ListPanel. */
|
|
30
|
+
border-block-start: var(--vgui-bevel-width) solid var(--vgui-bevel-dark);
|
|
31
|
+
border-inline-start: var(--vgui-bevel-width) solid var(--vgui-bevel-dark);
|
|
32
|
+
border-inline-end: var(--vgui-bevel-width) solid var(--vgui-bevel-light);
|
|
33
|
+
border-block-end: var(--vgui-bevel-width) solid var(--vgui-bevel-light);
|
|
34
|
+
padding: var(--vgui-console-inset);
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
background-color: var(--vgui-console-bg);
|
|
37
|
+
color: var(--vgui-console-text);
|
|
38
|
+
font-family: var(--vgui-console-font);
|
|
39
|
+
font-size: var(--vgui-console-font-size);
|
|
40
|
+
line-height: var(--vgui-console-line-height);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* The container is `tabindex="0"` so the log can be scrolled with the keyboard,
|
|
45
|
+
* which makes it focusable and therefore in need of a ring. Nothing here traps
|
|
46
|
+
* the keyboard: `Ctrl+C` on selected text must keep working.
|
|
47
|
+
*/
|
|
48
|
+
.vgui-console:focus-visible {
|
|
49
|
+
outline: var(--vgui-focus-ring);
|
|
50
|
+
outline-offset: var(--vgui-focus-ring-offset);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.vgui-console__history {
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
list-style: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.vgui-console__line {
|
|
60
|
+
color: var(--vgui-console-text);
|
|
61
|
+
/* Console output is column-aligned by the engine, so whitespace is meaningful
|
|
62
|
+
— but a 4000-character server-supplied token must still not overflow. */
|
|
63
|
+
white-space: pre-wrap;
|
|
64
|
+
overflow-wrap: anywhere;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* CConsoleHistory is White; console_text is Text. Two colours, one console. */
|
|
68
|
+
.vgui-console__line--history {
|
|
69
|
+
color: var(--vgui-console-history-text);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Highlight3 fails contrast on this fill (1.74:1), so the colour is never the
|
|
73
|
+
only signal: an error line also carries a glyph. Non-colour cue, WCAG 1.4.1.
|
|
74
|
+
The prefix is CSS so that `lines` stays a plain data array. */
|
|
75
|
+
.vgui-console__line--error {
|
|
76
|
+
color: var(--vgui-console-error);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.vgui-console__line--error::before {
|
|
80
|
+
content: var(--vgui-console-error-prefix);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Opt-out for a consumer that supplies its own prefix or localises it. */
|
|
84
|
+
.vgui-console--no-error-prefix .vgui-console__line--error::before {
|
|
85
|
+
content: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* `CConsoleHistory` declares no `selectedbgcolor`, so scrollback selection keeps
|
|
90
|
+
* the platform highlight — reproduced by simply not styling it. The live styles
|
|
91
|
+
* do set MaizeBG, and maize takes dark text (foundations.md §10, baseline 1).
|
|
92
|
+
*/
|
|
93
|
+
.vgui-console__line:not(.vgui-console__line--history)::selection {
|
|
94
|
+
background-color: var(--vgui-console-selection-bg);
|
|
95
|
+
color: var(--vgui-selection-text);
|
|
96
|
+
}
|