@vitessce/styles 3.6.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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Poppers rely on the 3rd party library [Popper.js](https://popper.js.org/docs/v1/) for positioning.
3
+ */
4
+ export const Popper: any;
5
+ //# sourceMappingURL=Popper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../src/Popper.js"],"names":[],"mappings":"AAyCA;;GAEG;AACH,yBAgLG"}
@@ -0,0 +1,160 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * This is the Popper component from MUI v4 which uses Popper.js v1.
4
+ * The Popper in MUI v7 uses Popper.js v2 and does not seem to respect the anchorEl's positioning,
5
+ * which is the reason we copy the v4 version here.
6
+ * Reference: https://github.com/mui/material-ui/blob/v4.x/packages/material-ui/src/Popper/Popper.js
7
+ */
8
+ import * as React from 'react';
9
+ import PopperJs from 'popper.js';
10
+ import { useStyles as useTheme } from 'tss-react/mui';
11
+ import { Portal } from '@mui/material';
12
+ import { createChainedFunction, setRef, useForkRef } from './utils.js';
13
+ function flipPlacement(placement, theme) {
14
+ const direction = (theme && theme.direction) || 'ltr';
15
+ if (direction === 'ltr') {
16
+ return placement;
17
+ }
18
+ switch (placement) {
19
+ case 'bottom-end':
20
+ return 'bottom-start';
21
+ case 'bottom-start':
22
+ return 'bottom-end';
23
+ case 'top-end':
24
+ return 'top-start';
25
+ case 'top-start':
26
+ return 'top-end';
27
+ default:
28
+ return placement;
29
+ }
30
+ }
31
+ function getAnchorEl(anchorEl) {
32
+ return typeof anchorEl === 'function' ? anchorEl() : anchorEl;
33
+ }
34
+ const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
35
+ const defaultPopperOptions = {};
36
+ /**
37
+ * Poppers rely on the 3rd party library [Popper.js](https://popper.js.org/docs/v1/) for positioning.
38
+ */
39
+ export const Popper = React.forwardRef((props, ref) => {
40
+ const { anchorEl, children, container, disablePortal = false, keepMounted = false, modifiers, open, placement: initialPlacement = 'bottom', popperOptions = defaultPopperOptions, popperRef: popperRefProp, style, transition = false, ...other } = props;
41
+ const tooltipRef = React.useRef(null);
42
+ const ownRef = useForkRef(tooltipRef, ref);
43
+ const popperRef = React.useRef(null);
44
+ const handlePopperRef = useForkRef(popperRef, popperRefProp);
45
+ const handlePopperRefRef = React.useRef(handlePopperRef);
46
+ useEnhancedEffect(() => {
47
+ handlePopperRefRef.current = handlePopperRef;
48
+ }, [handlePopperRef]);
49
+ React.useImperativeHandle(popperRefProp, () => popperRef.current, []);
50
+ const [exited, setExited] = React.useState(true);
51
+ const { theme } = useTheme();
52
+ const rtlPlacement = flipPlacement(initialPlacement, theme);
53
+ /**
54
+ * placement initialized from prop but can change during lifetime if modifiers.flip.
55
+ * modifiers.flip is essentially a flip for controlled/uncontrolled behavior
56
+ */
57
+ const [placement, setPlacement] = React.useState(rtlPlacement);
58
+ React.useEffect(() => {
59
+ if (popperRef.current) {
60
+ popperRef.current.update();
61
+ }
62
+ });
63
+ const handleOpen = React.useCallback(() => {
64
+ if (!tooltipRef.current || !anchorEl || !open) {
65
+ return;
66
+ }
67
+ if (popperRef.current) {
68
+ popperRef.current.destroy();
69
+ handlePopperRefRef.current(null);
70
+ }
71
+ const handlePopperUpdate = (data) => {
72
+ setPlacement(data.placement);
73
+ };
74
+ const resolvedAnchorEl = getAnchorEl(anchorEl);
75
+ if (process.env.NODE_ENV !== 'production') {
76
+ if (resolvedAnchorEl && resolvedAnchorEl.nodeType === 1) {
77
+ const box = resolvedAnchorEl.getBoundingClientRect();
78
+ if (process.env.NODE_ENV !== 'test'
79
+ && box.top === 0
80
+ && box.left === 0
81
+ && box.right === 0
82
+ && box.bottom === 0) {
83
+ console.warn([
84
+ 'Material-UI: The `anchorEl` prop provided to the component is invalid.',
85
+ 'The anchor element should be part of the document layout.',
86
+ "Make sure the element is present in the document or that it's not display none.",
87
+ ].join('\n'));
88
+ }
89
+ }
90
+ }
91
+ const popper = new PopperJs(getAnchorEl(anchorEl), tooltipRef.current, {
92
+ placement: rtlPlacement,
93
+ ...popperOptions,
94
+ modifiers: {
95
+ ...(disablePortal
96
+ ? {}
97
+ : {
98
+ // It's using scrollParent by default, we can use the viewport when using a portal.
99
+ preventOverflow: {
100
+ boundariesElement: 'window',
101
+ },
102
+ }),
103
+ ...modifiers,
104
+ ...popperOptions.modifiers,
105
+ },
106
+ // We could have been using a custom modifier like react-popper is doing.
107
+ // But it seems this is the best public API for this use case.
108
+ onCreate: createChainedFunction(handlePopperUpdate, popperOptions.onCreate),
109
+ onUpdate: createChainedFunction(handlePopperUpdate, popperOptions.onUpdate),
110
+ });
111
+ handlePopperRefRef.current(popper);
112
+ }, [anchorEl, disablePortal, modifiers, open, rtlPlacement, popperOptions]);
113
+ const handleRef = React.useCallback((node) => {
114
+ setRef(ownRef, node);
115
+ handleOpen();
116
+ }, [ownRef, handleOpen]);
117
+ const handleEnter = () => {
118
+ setExited(false);
119
+ };
120
+ const handleClose = () => {
121
+ if (!popperRef.current) {
122
+ return;
123
+ }
124
+ popperRef.current.destroy();
125
+ handlePopperRefRef.current(null);
126
+ };
127
+ const handleExited = () => {
128
+ setExited(true);
129
+ handleClose();
130
+ };
131
+ React.useEffect(() => () => {
132
+ handleClose();
133
+ }, []);
134
+ React.useEffect(() => {
135
+ if (!open && !transition) {
136
+ // Otherwise handleExited will call this.
137
+ handleClose();
138
+ }
139
+ }, [open, transition]);
140
+ if (!keepMounted && !open && (!transition || exited)) {
141
+ return null;
142
+ }
143
+ const childProps = { placement };
144
+ if (transition) {
145
+ childProps.TransitionProps = {
146
+ in: open,
147
+ onEnter: handleEnter,
148
+ onExited: handleExited,
149
+ };
150
+ }
151
+ return (_jsx(Portal, { disablePortal: disablePortal, container: container, children: _jsx("div", { ref: handleRef, role: "tooltip", ...other, style: {
152
+ // Prevents scroll issue, waiting for Popper.js to add this style once initiated.
153
+ position: 'fixed',
154
+ // Fix Popper.js display issue
155
+ top: 0,
156
+ left: 0,
157
+ display: !open && keepMounted && !transition ? 'none' : null,
158
+ ...style,
159
+ }, children: typeof children === 'function' ? children(childProps) : children }) }));
160
+ });
@@ -0,0 +1,2 @@
1
+ export function ScopedGlobalStyles(props: any): any;
2
+ //# sourceMappingURL=ScopedGlobalStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopedGlobalStyles.d.ts","sourceRoot":"","sources":["../src/ScopedGlobalStyles.js"],"names":[],"mappings":"AAUA,oDAaC"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { useMemo } from 'react';
3
+ import { GlobalStyles } from 'tss-react';
4
+ function prependParentClassName(jssObject, parentClassName) {
5
+ return Object.entries(jssObject).reduce((accumulator, [key, value]) => {
6
+ accumulator[`.${parentClassName} ${key}`] = value;
7
+ return accumulator;
8
+ }, {});
9
+ }
10
+ export function ScopedGlobalStyles(props) {
11
+ const { styles, parentClassName } = props;
12
+ const component = useMemo(() => {
13
+ const computedStyles = prependParentClassName(styles, parentClassName);
14
+ return (_jsx(GlobalStyles, { styles: computedStyles }));
15
+ }, [parentClassName]);
16
+ return component;
17
+ }
@@ -0,0 +1,73 @@
1
+ export { CacheProvider } from "@emotion/react";
2
+ export { default as createCache } from "@emotion/cache";
3
+ export { GlobalStyles } from "tss-react";
4
+ export { grey } from "@mui/material/colors";
5
+ export { default as Accordion } from "@mui/material/Accordion";
6
+ export { default as AccordionDetails } from "@mui/material/AccordionDetails";
7
+ export { default as AccordionSummary } from "@mui/material/AccordionSummary";
8
+ export { default as Autocomplete } from "@mui/material/Autocomplete";
9
+ export { default as Box } from "@mui/material/Box";
10
+ export { default as Button } from "@mui/material/Button";
11
+ export { default as ButtonGroup } from "@mui/material/ButtonGroup";
12
+ export { default as Checkbox } from "@mui/material/Checkbox";
13
+ export { default as CircularProgress } from "@mui/material/CircularProgress";
14
+ export { default as ClickAwayListener } from "@mui/material/ClickAwayListener";
15
+ export { default as Fade } from "@mui/material/Fade";
16
+ export { default as FormControl } from "@mui/material/FormControl";
17
+ export { default as FormControlLabel } from "@mui/material/FormControlLabel";
18
+ export { default as FormGroup } from "@mui/material/FormGroup";
19
+ export { default as FormHelperText } from "@mui/material/FormHelperText";
20
+ export { default as FormLabel } from "@mui/material/FormLabel";
21
+ export { default as Grid } from "@mui/material/Grid";
22
+ export { default as IconButton } from "@mui/material/IconButton";
23
+ export { default as InputLabel } from "@mui/material/InputLabel";
24
+ export { default as Link } from "@mui/material/Link";
25
+ export { default as List } from "@mui/material/List";
26
+ export { default as ListItem } from "@mui/material/ListItem";
27
+ export { default as ListItemText } from "@mui/material/ListItemText";
28
+ export { default as MenuList } from "@mui/material/MenuList";
29
+ export { default as MenuItem } from "@mui/material/MenuItem";
30
+ export { default as NativeSelect } from "@mui/material/NativeSelect";
31
+ export { default as Paper } from "@mui/material/Paper";
32
+ export { default as Popper } from "@mui/material/Popper";
33
+ export { default as Radio } from "@mui/material/Radio";
34
+ export { default as RadioGroup } from "@mui/material/RadioGroup";
35
+ export { default as Select } from "@mui/material/Select";
36
+ export { default as Slider } from "@mui/material/Slider";
37
+ export { default as Step } from "@mui/material/Step";
38
+ export { default as StepLabel } from "@mui/material/StepLabel";
39
+ export { default as Stepper } from "@mui/material/Stepper";
40
+ export { default as Switch } from "@mui/material/Switch";
41
+ export { default as Tab } from "@mui/material/Tab";
42
+ export { default as Table } from "@mui/material/Table";
43
+ export { default as TableBody } from "@mui/material/TableBody";
44
+ export { default as TableCell } from "@mui/material/TableCell";
45
+ export { default as TableContainer } from "@mui/material/TableContainer";
46
+ export { default as TableRow } from "@mui/material/TableRow";
47
+ export { default as Tabs } from "@mui/material/Tabs";
48
+ export { default as TextField } from "@mui/material/TextField";
49
+ export { default as Tooltip } from "@mui/material/Tooltip";
50
+ export { default as Typography } from "@mui/material/Typography";
51
+ export { default as Add } from "@mui/icons-material/Add";
52
+ export { default as ArrowDropDown } from "@mui/icons-material/ArrowDropDown";
53
+ export { default as ArrowDropUp } from "@mui/icons-material/ArrowDropUp";
54
+ export { default as CenterFocusStrong } from "@mui/icons-material/CenterFocusStrong";
55
+ export { default as Close } from "@mui/icons-material/Close";
56
+ export { default as CloudDownload } from "@mui/icons-material/CloudDownload";
57
+ export { default as ExpandLess } from "@mui/icons-material/ExpandLess";
58
+ export { default as ExpandMore } from "@mui/icons-material/ExpandMore";
59
+ export { default as Help } from "@mui/icons-material/Help";
60
+ export { default as Image } from "@mui/icons-material/Image";
61
+ export { default as Info } from "@mui/icons-material/Info";
62
+ export { default as Lens } from "@mui/icons-material/Lens";
63
+ export { default as MoreVert } from "@mui/icons-material/MoreVert";
64
+ export { default as RemoveCircle } from "@mui/icons-material/RemoveCircle";
65
+ export { default as Settings } from "@mui/icons-material/Settings";
66
+ export { default as Visibility } from "@mui/icons-material/Visibility";
67
+ export { default as VisibilityOff } from "@mui/icons-material/VisibilityOff";
68
+ export { DataGrid } from "@mui/x-data-grid/DataGrid";
69
+ export { Popper as PopperV4 } from "./Popper.js";
70
+ export { ScopedGlobalStyles } from "./ScopedGlobalStyles.js";
71
+ export { makeStyles, useStyles as useTheme } from "tss-react/mui";
72
+ export { createTheme, ThemeProvider } from "@mui/material/styles";
73
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,82 @@
1
+ // Here, we re-export all MUI things
2
+ // used in the rest of the monorepo packages.
3
+ // This is intended to make upgrading MUI easier.
4
+ export { CacheProvider } from '@emotion/react';
5
+ export { default as createCache } from '@emotion/cache';
6
+ export { GlobalStyles } from 'tss-react';
7
+ export { makeStyles, useStyles as useTheme } from 'tss-react/mui';
8
+ // TODO: to customize the theme argument passed in makeStyles, use createMakeAndWithStyles
9
+ // Reference: https://mui.com/material-ui/integrations/interoperability/#jss-tss
10
+ // Utils
11
+ export { createTheme, ThemeProvider, } from '@mui/material/styles';
12
+ export { grey } from '@mui/material/colors';
13
+ // Components
14
+ export { default as Accordion } from '@mui/material/Accordion';
15
+ export { default as AccordionDetails } from '@mui/material/AccordionDetails';
16
+ export { default as AccordionSummary } from '@mui/material/AccordionSummary';
17
+ export { default as Autocomplete } from '@mui/material/Autocomplete';
18
+ export { default as Box } from '@mui/material/Box';
19
+ export { default as Button } from '@mui/material/Button';
20
+ export { default as ButtonGroup } from '@mui/material/ButtonGroup';
21
+ export { default as Checkbox } from '@mui/material/Checkbox';
22
+ export { default as CircularProgress } from '@mui/material/CircularProgress';
23
+ export { default as ClickAwayListener } from '@mui/material/ClickAwayListener';
24
+ export { default as Fade } from '@mui/material/Fade';
25
+ export { default as FormControl } from '@mui/material/FormControl';
26
+ export { default as FormControlLabel } from '@mui/material/FormControlLabel';
27
+ export { default as FormGroup } from '@mui/material/FormGroup';
28
+ export { default as FormHelperText } from '@mui/material/FormHelperText';
29
+ export { default as FormLabel } from '@mui/material/FormLabel';
30
+ export { default as Grid } from '@mui/material/Grid';
31
+ export { default as IconButton } from '@mui/material/IconButton';
32
+ export { default as InputLabel } from '@mui/material/InputLabel';
33
+ export { default as Link } from '@mui/material/Link';
34
+ export { default as List } from '@mui/material/List';
35
+ export { default as ListItem } from '@mui/material/ListItem';
36
+ export { default as ListItemText } from '@mui/material/ListItemText';
37
+ export { default as MenuList } from '@mui/material/MenuList';
38
+ export { default as MenuItem } from '@mui/material/MenuItem';
39
+ export { default as NativeSelect } from '@mui/material/NativeSelect';
40
+ export { default as Paper } from '@mui/material/Paper';
41
+ export { default as Popper } from '@mui/material/Popper';
42
+ export { default as Radio } from '@mui/material/Radio';
43
+ export { default as RadioGroup } from '@mui/material/RadioGroup';
44
+ export { default as Select } from '@mui/material/Select';
45
+ export { default as Slider } from '@mui/material/Slider';
46
+ export { default as Step } from '@mui/material/Step';
47
+ export { default as StepLabel } from '@mui/material/StepLabel';
48
+ export { default as Stepper } from '@mui/material/Stepper';
49
+ export { default as Switch } from '@mui/material/Switch';
50
+ export { default as Tab } from '@mui/material/Tab';
51
+ export { default as Table } from '@mui/material/Table';
52
+ export { default as TableBody } from '@mui/material/TableBody';
53
+ export { default as TableCell } from '@mui/material/TableCell';
54
+ export { default as TableContainer } from '@mui/material/TableContainer';
55
+ export { default as TableRow } from '@mui/material/TableRow';
56
+ export { default as Tabs } from '@mui/material/Tabs';
57
+ export { default as TextField } from '@mui/material/TextField';
58
+ export { default as Tooltip } from '@mui/material/Tooltip';
59
+ export { default as Typography } from '@mui/material/Typography';
60
+ // Icons
61
+ export { default as Add } from '@mui/icons-material/Add';
62
+ export { default as ArrowDropDown } from '@mui/icons-material/ArrowDropDown';
63
+ export { default as ArrowDropUp } from '@mui/icons-material/ArrowDropUp';
64
+ export { default as CenterFocusStrong } from '@mui/icons-material/CenterFocusStrong';
65
+ export { default as Close } from '@mui/icons-material/Close';
66
+ export { default as CloudDownload } from '@mui/icons-material/CloudDownload';
67
+ export { default as ExpandLess } from '@mui/icons-material/ExpandLess';
68
+ export { default as ExpandMore } from '@mui/icons-material/ExpandMore';
69
+ export { default as Help } from '@mui/icons-material/Help';
70
+ export { default as Image } from '@mui/icons-material/Image';
71
+ export { default as Info } from '@mui/icons-material/Info';
72
+ export { default as Lens } from '@mui/icons-material/Lens';
73
+ export { default as MoreVert } from '@mui/icons-material/MoreVert';
74
+ export { default as RemoveCircle } from '@mui/icons-material/RemoveCircle';
75
+ export { default as Settings } from '@mui/icons-material/Settings';
76
+ export { default as Visibility } from '@mui/icons-material/Visibility';
77
+ export { default as VisibilityOff } from '@mui/icons-material/VisibilityOff';
78
+ // Data Grid
79
+ export { DataGrid } from '@mui/x-data-grid/DataGrid';
80
+ // Local exports
81
+ export { Popper as PopperV4 } from './Popper.js';
82
+ export { ScopedGlobalStyles } from './ScopedGlobalStyles.js';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Safe chained function
3
+ *
4
+ * Will only create a new function if needed,
5
+ * otherwise will pass back existing functions or null.
6
+ *
7
+ * @param {function} functions to chain
8
+ * @returns {function|null}
9
+ */
10
+ export function createChainedFunction(...funcs: any[]): Function | null;
11
+ export function setRef(ref: any, value: any): void;
12
+ export function useForkRef(refA: any, refB: any): any;
13
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wDAFa,WAAS,IAAI,CAwBzB;AAED,mDAOC;AAED,sDAeC"}
@@ -0,0 +1,52 @@
1
+ // Reference: https://github.com/mui/material-ui/tree/v4.x/packages/material-ui/src/utils
2
+ import { useMemo } from 'react';
3
+ /**
4
+ * Safe chained function
5
+ *
6
+ * Will only create a new function if needed,
7
+ * otherwise will pass back existing functions or null.
8
+ *
9
+ * @param {function} functions to chain
10
+ * @returns {function|null}
11
+ */
12
+ export function createChainedFunction(...funcs) {
13
+ return funcs.reduce((acc, func) => {
14
+ if (func == null) {
15
+ return acc;
16
+ }
17
+ if (process.env.NODE_ENV !== 'production') {
18
+ if (typeof func !== 'function') {
19
+ console.error('Material-UI: Invalid Argument Type, must only provide functions, undefined, or null.');
20
+ }
21
+ }
22
+ return function chainedFunction(...args) {
23
+ acc.apply(this, args);
24
+ func.apply(this, args);
25
+ };
26
+ }, () => { });
27
+ }
28
+ export function setRef(ref, value) {
29
+ if (typeof ref === 'function') {
30
+ ref(value);
31
+ }
32
+ else if (ref) {
33
+ // eslint-disable-next-line no-param-reassign
34
+ ref.current = value;
35
+ }
36
+ }
37
+ export function useForkRef(refA, refB) {
38
+ /**
39
+ * This will create a new function if the ref props change and are defined.
40
+ * This means react will call the old forkRef with `null` and the new forkRef
41
+ * with the ref. Cleanup naturally emerges from this behavior
42
+ */
43
+ return useMemo(() => {
44
+ if (refA == null && refB == null) {
45
+ return null;
46
+ }
47
+ return (refValue) => {
48
+ setRef(refA, refValue);
49
+ setRef(refB, refValue);
50
+ };
51
+ }, [refA, refB]);
52
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@vitessce/styles",
3
+ "version": "3.6.0",
4
+ "author": "HIDIVE Lab at HMS",
5
+ "homepage": "http://vitessce.io",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/vitessce/vitessce.git"
9
+ },
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "main": "dist/index.js",
13
+ "files": [
14
+ "src",
15
+ "dist",
16
+ "dist-tsc"
17
+ ],
18
+ "dependencies": {
19
+ "@mui/material": "^7.1.0",
20
+ "@mui/icons-material": "^7.1.0",
21
+ "@mui/lab": "^7.0.0-beta.12",
22
+ "@mui/x-data-grid": "8.0.0-beta.3",
23
+ "tss-react": "^4.9.18",
24
+ "@emotion/styled": "^11.14.0",
25
+ "@emotion/react": "^11.14.0",
26
+ "@emotion/cache": "^11.14.0",
27
+ "popper.js": "^1.16.1"
28
+ },
29
+ "devDependencies": {
30
+ "react": "^18.0.0",
31
+ "vite": "^6.3.5",
32
+ "vitest": "^3.1.4"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
36
+ },
37
+ "scripts": {
38
+ "bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
39
+ "test": "pnpm exec vitest --run"
40
+ },
41
+ "module": "dist/index.js",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist-tsc/index.d.ts",
45
+ "import": "./dist/index.js"
46
+ }
47
+ }
48
+ }