Skip to content

Commit

Permalink
feat(ui): excise iaimantinesearchableselect
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Dec 20, 2023
1 parent 6b4ece0 commit 6c86824
Show file tree
Hide file tree
Showing 68 changed files with 1,345 additions and 2,549 deletions.
1 change: 1 addition & 0 deletions invokeai/frontend/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"react-konva": "^18.2.10",
"react-redux": "^9.0.2",
"react-resizable-panels": "^0.0.55",
"react-select": "5.7.7",
"react-use": "^17.4.2",
"react-virtuoso": "^4.6.2",
"reactflow": "^11.10.1",
Expand Down
3 changes: 3 additions & 0 deletions invokeai/frontend/web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion invokeai/frontend/web/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,8 @@
"selectLoRA": "Select a LoRA",
"selectModel": "Select a Model",
"noLoRAsInstalled": "No LoRAs installed",
"noRefinerModelsInstalled": "No SDXL Refiner models installed"
"noRefinerModelsInstalled": "No SDXL Refiner models installed",
"defaultVAE": "Default VAE"
},
"nodes": {
"addNode": "Add Node",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cardAnatomy } from '@chakra-ui/anatomy';
import { createMultiStyleConfigHelpers } from '@chakra-ui/react';
import { cardVariantLora } from 'features/lora/components/LoRACollapse/styles';
import { cardVariantLora } from 'features/lora/components/styles';

const { defineMultiStyleConfig } = createMultiStyleConfigHelpers(
cardAnatomy.keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type CustomOptionProps = OptionProps<

export const CustomComponents: CustomSelectComponentConfig = {
Option: ({ children, ...props }: CustomOptionProps) => {
delete props.innerProps.onMouseMove;
delete props.innerProps.onMouseOver;

if (props.data.icon) {
return (
<chakraComponents.Option {...props}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import { Select as ChakraReactSelect } from 'chakra-react-select';
import {
Select as ChakraReactSelect,
GroupBase,
StylesConfig,
} from 'chakra-react-select';
import { CustomComponents } from './CustomComponents';
import { CustomChakraStylesConfig, InvSelectProps } from './types';
import { useMemo } from 'react';
import {
CustomChakraStylesConfig,
InvSelectOption,
InvSelectProps,
} from './types';
import { memo, useMemo } from 'react';

export const InvSelect = (props: InvSelectProps) => {
const { sx, ...rest } = props;
const styles: StylesConfig<InvSelectOption> = {
menuPortal: (provided) => ({ ...provided, zIndex: 999 }),
};

export const InvSelect = memo((props: InvSelectProps) => {
const { sx, selectRef, ...rest } = props;
const chakraStyles = useMemo<CustomChakraStylesConfig>(
() => ({
container: (provided, _state) => ({ ...provided, ...sx }),
Expand All @@ -21,14 +33,18 @@ export const InvSelect = (props: InvSelectProps) => {
);

return (
<ChakraReactSelect
<ChakraReactSelect<InvSelectOption, false, GroupBase<InvSelectOption>>
ref={selectRef}
menuPortalTarget={document.body}
colorScheme="base"
selectedOptionColorScheme="base"
components={CustomComponents}
chakraStyles={chakraStyles}
styles={styles}
variant="filled"
{...rest}
/>
);
};
});

InvSelect.displayName = 'InvSelect';
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export type {
} from './types';
export { InvSelect } from './InvSelect';
export { InvSelectFallback } from './InvSelectFallback';
export { useGroupedModelInvSelect } from './useGroupedModelInvSelect';
10 changes: 8 additions & 2 deletions invokeai/frontend/web/src/common/components/InvSelect/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ChakraStylesConfig,
GroupBase,
OptionBase,
SelectInstance,
SingleValue,
} from 'chakra-react-select';
import { ReactNode } from 'react';
Expand All @@ -15,6 +16,7 @@ export interface InvSelectOption extends OptionBase {
description?: string;
icon?: ReactNode;
tooltip?: string;
tags?: string[];
}

export type InvSelectProps = ChakraReactSelectProps<
Expand All @@ -23,8 +25,10 @@ export type InvSelectProps = ChakraReactSelectProps<
GroupBase<InvSelectOption>
> & {
sx?: ChakraProps['sx'];
selectRef?: React.RefObject<
SelectInstance<InvSelectOption, false, GroupBase<InvSelectOption>>
>;
};

export type CustomChakraStylesConfig = ChakraStylesConfig<
InvSelectOption,
false,
Expand All @@ -35,4 +39,6 @@ export type InvSelectFallbackProps = {
label: string;
};

export type InvSelectOnChange = (v: SingleValue<InvSelectOption>) => void;
export type InvSelectOnChange = (
v: SingleValue<InvSelectOption> | null
) => void;
Loading

0 comments on commit 6c86824

Please sign in to comment.