diff --git a/package.json b/package.json index 842c19c62..f6527c935 100644 --- a/package.json +++ b/package.json @@ -139,12 +139,12 @@ "@fortawesome/free-regular-svg-icons": "^6.1.2", "@fortawesome/free-solid-svg-icons": "^6.1.2", "@fortawesome/react-fontawesome": "^0.2.0", - "@mantine/core": "~7.0.2", - "@mantine/dates": "~7.0.2", - "@mantine/form": "~7.0.2", - "@mantine/hooks": "~7.0.2", - "@mantine/modals": "~7.0.2", - "@mantine/notifications": "~7.0.2", + "@mantine/core": "~7.1.2", + "@mantine/dates": "~7.1.2", + "@mantine/form": "~7.1.2", + "@mantine/hooks": "~7.1.2", + "@mantine/modals": "~7.1.2", + "@mantine/notifications": "~7.1.2", "@types/d3-hexbin": "^0.2.3", "@types/d3v7": "npm:@types/d3@^7.4.0", "@types/plotly.js-dist-min": "^2.3.0", @@ -187,8 +187,7 @@ "chromatic": "^6.19.9", "cypress": "^13.2.0", "storybook": "^7.0.12", - "storybook-addon-swc": "^1.1.9", - "typescript-plugin-css-modules": "^5.0.1" + "storybook-addon-swc": "^1.1.9" }, "resolutions": { "@types/react": "~18.2.0", diff --git a/src/demo/MainApp.tsx b/src/demo/MainApp.tsx index 91de9f0d9..5caaea12a 100644 --- a/src/demo/MainApp.tsx +++ b/src/demo/MainApp.tsx @@ -1,4 +1,4 @@ -import { Loader, Select, SimpleGrid, Stack, Text } from '@mantine/core'; +import { Box, Button, Loader, Select, SimpleGrid, Stack, Text } from '@mantine/core'; import '@mantine/core/styles.css'; import * as React from 'react'; import { VisynApp, VisynHeader, useVisynAppContext } from '../app'; @@ -9,8 +9,11 @@ import { IScatterConfig } from '../vis/scatter/interfaces'; import { fetchIrisData } from '../vis/stories/Iris.stories'; import { iris } from '../vis/stories/irisData'; import { MyNumberScore, MyStringScore } from './scoresUtils'; +import classes from '../vis/Vis.module.css'; export function MainApp() { + + const { user } = useVisynAppContext(); const [visConfig, setVisConfig] = React.useState({ type: ESupportedPlotlyVis.SCATTER, @@ -84,6 +87,7 @@ export function MainApp() { onBuiltLineUp={({ createScoreColumn }) => (createScoreColumnFunc.current = createScoreColumn)} /> + null, se style={{ height: height + margin.top + margin.bottom, }} - className={classes.hexplotWrapper} + className={classes.overlayWrapper} > diff --git a/src/vis/sidebar/CategoricalColumnSelect.tsx b/src/vis/sidebar/CategoricalColumnSelect.tsx index 378eed355..6c4509e1d 100644 --- a/src/vis/sidebar/CategoricalColumnSelect.tsx +++ b/src/vis/sidebar/CategoricalColumnSelect.tsx @@ -1,4 +1,4 @@ -import { MultiSelect } from '@mantine/core'; +import { CheckIcon, CloseButton, Combobox, Group, MultiSelect, Pill, PillsInput, useCombobox } from '@mantine/core'; import * as React from 'react'; import { ColumnInfo, EColumnTypes, VisColumn } from '../interfaces'; @@ -8,6 +8,53 @@ interface CategoricalColumnSelectProps { currentSelected: ColumnInfo[]; } +function Test({ data }: { data: { value: string; label: string; description: string }[] }) { + const combobox = useCombobox({ + onDropdownClose: () => combobox.resetSelectedOption(), + }); + + const [value, setValue] = React.useState([]); + + const handleValueSelect = (val: string) => setValue((current) => (current.includes(val) ? current.filter((v) => v !== val) : [...current, val])); + + const handleValueRemove = (val: string) => setValue((current) => current.filter((v) => v !== val)); + + const values = value.map((item) => ( + handleValueRemove(item)}> + {item} + + )); + + const options = data.map((item) => ( + + + {value.includes(item.value) ? : null} + {item.value} + + + )); + + return ( + + + 0 ? event.preventDefault()} onClick={() => setValue([])} /> : + } + onClick={() => combobox.openDropdown()} + > + {values} + + + + + {options} + + + ); +} + export function CategoricalColumnSelect({ callback, columns, currentSelected }: CategoricalColumnSelectProps) { const selectCatOptions = React.useMemo(() => { return columns.filter((c) => c.type === EColumnTypes.CATEGORICAL).map((c) => ({ value: c.info.id, label: c.info.name, description: c.info.description })); @@ -18,14 +65,17 @@ export function CategoricalColumnSelect({ callback, columns, currentSelected }: // itemComponent={SelectDropdownItem} return ( - callback(e.map((id) => columns.find((c) => c.info.id === id).info))} - name="numColumns" - data={selectCatOptions} - value={currentSelected.map((c) => c.id)} - /> + <> + + callback(e.map((id) => columns.find((c) => c.info.id === id).info))} + name="numColumns" + data={selectCatOptions} + value={currentSelected.map((c) => c.id)} + /> + ); } diff --git a/tsconfig.json b/tsconfig.json index 62ef558c6..801c29aa0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "jsx": "react", "outDir": "./dist", - "plugins": [{ "name": "typescript-plugin-css-modules" }], }, "include": [ "src/**/*.ts",