Label value
diff --git a/ui/src/Components/Theme/ReactSelect.test.tsx b/ui/src/Components/Theme/ReactSelect.test.tsx
index 76b14e396..aba4d57d2 100644
--- a/ui/src/Components/Theme/ReactSelect.test.tsx
+++ b/ui/src/Components/Theme/ReactSelect.test.tsx
@@ -30,6 +30,12 @@ describe("
", () => {
expect(toDiffableHtml(tree.html())).toMatchSnapshot();
});
+ it("matches snapshot when focused and disabled", () => {
+ const tree = mount(
);
+ tree.find("input").simulate("focus");
+ expect(toDiffableHtml(tree.html())).toMatchSnapshot();
+ });
+
it("matches snapshot with a value", () => {
const tree = mount(
({
- control: (base: CSSProperties, state: StateFnT) =>
- state.isFocused
+const ReactSelectStyles = <
+ OptionType extends OptionTypeBase,
+ IsMulti extends boolean
+>(
+ theme: ReactSelectTheme
+): Styles => ({
+ control: (base: CSSProperties, props: ControlProps) =>
+ props.isFocused
? {
...base,
- backgroundColor: theme.backgroundColor,
+ backgroundColor: props.isDisabled
+ ? theme.disabledValueContainerBackground
+ : theme.valueContainerBackground,
outline: "0",
outlineOffset: "-2px",
boxShadow: `0 0 0 0.2rem ${theme.focusedBoxShadow}`,
@@ -69,20 +83,22 @@ const ReactSelectStyles = (theme: ReactSelectTheme): Styles => ({
}
: {
...base,
- backgroundColor: "inherit",
+ backgroundColor: props.isDisabled
+ ? theme.disabledValueContainerBackground
+ : theme.valueContainerBackground,
borderRadius: "0.25rem",
borderColor: theme.borderColor,
"&:hover": { borderColor: theme.borderColor },
},
- valueContainer: (base: CSSProperties, state: StateFnT) =>
- state.isMulti
+ valueContainer: (
+ base: CSSProperties,
+ props: ValueContainerProps
+ ) =>
+ props.isMulti
? {
...base,
borderTopLeftRadius: "0.25rem",
borderBottomLeftRadius: "0.25rem",
- backgroundColor: state.isDisabled
- ? theme.disabledValueContainerBackground
- : theme.valueContainerBackground,
paddingLeft: "4px",
paddingRight: "4px",
display: "flex",
@@ -95,11 +111,8 @@ const ReactSelectStyles = (theme: ReactSelectTheme): Styles => ({
...base,
borderTopLeftRadius: "0.25rem",
borderBottomLeftRadius: "0.25rem",
- backgroundColor: state.isDisabled
- ? theme.disabledValueContainerBackground
- : theme.valueContainerBackground,
},
- singleValue: (base: CSSProperties) => ({
+ singleValue: (base: CSSProperties, props: SingleValueProps) => ({
...base,
color: theme.singleValueColor,
}),
@@ -138,9 +151,12 @@ const ReactSelectStyles = (theme: ReactSelectTheme): Styles => ({
...base,
color: "inherit",
}),
- indicatorsContainer: (base: CSSProperties, state: StateFnT) => ({
+ indicatorsContainer: (
+ base: CSSProperties,
+ props: IndicatorContainerProps
+ ) => ({
...base,
- backgroundColor: state.isDisabled
+ backgroundColor: props.isDisabled
? theme.disabledValueContainerBackground
: theme.valueContainerBackground,
borderTopRightRadius: "0.25rem",
diff --git a/ui/src/Components/Theme/__snapshots__/ReactSelect.test.tsx.snap b/ui/src/Components/Theme/__snapshots__/ReactSelect.test.tsx.snap
index 68dd84583..7e1ea81e8 100644
--- a/ui/src/Components/Theme/__snapshots__/ReactSelect.test.tsx.snap
+++ b/ui/src/Components/Theme/__snapshots__/ReactSelect.test.tsx.snap
@@ -14,7 +14,7 @@ exports[` matches snapshot when focused 1`] = `
-
+
Select...
@@ -61,11 +61,73 @@ exports[`
matches snapshot when focused 1`] = `
"
`;
+exports[`
matches snapshot when focused and disabled 1`] = `
+"
+
+
+
+
+
+
+ 0 results available. Select is focused ,type to refine list, press Down to open the menu,
+
+
+
+
+"
+`;
+
exports[`
matches snapshot with a value 1`] = `
"
-
-
+
+
foo
@@ -76,7 +138,7 @@ exports[`
matches snapshot with a value 1`] = `
matches snapshot with a value 1`] = `
exports[`
matches snapshot with isDisabled=true 1`] = `
"
-
-
+
+
foo
@@ -128,7 +190,7 @@ exports[`
matches snapshot with isDisabled=true 1`]
autocapitalize=\\"none\\"
autocomplete=\\"off\\"
autocorrect=\\"off\\"
- id=\\"react-select-6-input\\"
+ id=\\"react-select-7-input\\"
spellcheck=\\"false\\"
tabindex=\\"0\\"
type=\\"text\\"
@@ -167,8 +229,8 @@ exports[`
matches snapshot with isDisabled=true 1`]
exports[`
matches snapshot with isMulti=true 1`] = `
"
-
-
+
+
Select...
@@ -218,8 +280,8 @@ exports[`
matches snapshot with isMulti=true 1`] = `
exports[`
matches snapshot with isMulti=true and a value 1`] = `
"
-
-
+
+
foo
@@ -244,7 +306,7 @@ exports[`
matches snapshot with isMulti=true and a v
{
export interface ThemeCtx {
isDark: boolean;
- reactSelectStyles: Styles;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ reactSelectStyles: Styles
;
animations: {
duration: number;
};