Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/.eslintrc.js → apps/docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
module.exports = {
extends: ["custom/next"],
};
1 change: 1 addition & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@types/node": "22.13.10",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"@next/eslint-plugin-next": "15.2.4",
"pagefind": "1.3.0",
"postcss": "8.5.3",
"tailwindcss": "4.0.17",
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-config-custom/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const project = resolve(process.cwd(), "tsconfig.json");
*
* This config extends the Vercel Engineering Style Guide.
* For more information, see https://github.com/vercel/style-guide
*
*/

module.exports = {
Expand All @@ -18,7 +17,6 @@ module.exports = {
"@vercel/style-guide/eslint/browser",
"@vercel/style-guide/eslint/react",
"@vercel/style-guide/eslint/next",
"eslint-config-turbo",
].map(require.resolve),
parserOptions: {
project,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-hooks/hooks/useResizeObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
* @returns The ref.
* @public
*/
export function useResizeObserver(callback: (element: any, entry: ResizeObserverEntry) => void) {
const ref = useRef(null);
export function useResizeObserver<T extends Element>(callback: (element: any, entry: ResizeObserverEntry) => void) {
const ref = useRef<T>(null);

useIsomorphicLayoutEffect(() => {
const element = ref?.current;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-hooks/temp/react-hooks.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type UsePromiseResult<T> = {
};

// @public
export function useResizeObserver(callback: (element: any, entry: ResizeObserverEntry) => void): react.MutableRefObject<null>;
export function useResizeObserver<T extends Element>(callback: (element: any, entry: ResizeObserverEntry) => void): react.RefObject<T | null>;

// (No @packageDocumentation comment for this package)

Expand Down
2 changes: 1 addition & 1 deletion packages/react-mui-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"peerDependencies": {
"@enterwell/react-ui": "^0",
"@mui/material": "^6",
"@mui/x-data-grid-pro": "^6",
"@mui/x-data-grid-pro": "^7",
"react": "^18",
"react-dom": "^18"
}
Expand Down
50 changes: 41 additions & 9 deletions packages/react-ui/PageDrawer/PageDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ import {
type TouchEvent as ReactTouchEvent,
type MouseEvent as ReactMouseEvent
} from 'react';
import { Accordion, AccordionDetails, AccordionSummary } from '@mui/material';
import { Box } from '@mui/system';
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
type SxProps,
type Theme
} from '@mui/material';
import { ExpandMore } from '@mui/icons-material';

const isScrollable = (node: Element) => {
Expand Down Expand Up @@ -37,12 +43,33 @@ const getScrollParent = (node: Element): Element => {
* @public
*/
export type PageDrawerProps = HTMLAttributes<HTMLDivElement> & {
/**
* @defaultValue `primary.dark`
*/
color?: string;
/**
* @defaultValue `background.default`
*/
bgColor?: string;
expanded?: boolean;
height?: number;
/**
* @defaultValue `50`
*/
minHeight?: number;
onChange?: () => void;
onResize?: (height: number | undefined) => void;
slots?: {
root?: {
sx?: SxProps<Theme>;
},
summary?: {
sx?: SxProps<Theme>;
},
details?: {
sx?: SxProps<Theme>;
}
}
};

/**
Expand All @@ -59,7 +86,9 @@ export function PageDrawer({
height,
minHeight = 50,
onResize,
color,
color = 'primary.dark',
bgColor = 'background.default',
slots = {},
...rest
}: PageDrawerProps) {
const isResizingRef = useRef(false);
Expand Down Expand Up @@ -167,7 +196,8 @@ export function PageDrawer({
border: 'none',
'&::before': {
display: 'none'
}
},
...(slots.root?.sx ?? {})
}}
expanded={realExpanded}
onChange={handleOnChange}
Expand All @@ -183,7 +213,7 @@ export function PageDrawer({
minHeight: 32,
height: 32,
'.MuiAccordionSummary-expandIconWrapper': {
bgcolor: color ?? 'primary.dark',
bgcolor: color,
color: 'primary.main',
borderRadius: 1
},
Expand All @@ -199,15 +229,16 @@ export function PageDrawer({
left: 0,
right: 0,
bottom: 0,
bgcolor: 'background.default'
}
bgcolor: bgColor
},
...(slots.summary?.sx ?? {})
}}
>
<Box
sx={{
borderTop: '1px solid',
borderBottom: '1px solid',
borderColor: color ?? 'primary.dark',
borderColor: color,
height: 3,
width: '100%',
position: 'absolute',
Expand All @@ -219,10 +250,11 @@ export function PageDrawer({
<AccordionDetails
ref={contentRef}
sx={{
bgcolor: 'background.default',
bgcolor: bgColor,
overflowX: 'hidden',
overflowY: 'auto',
height: height ? `${height}px` : undefined,
...(slots.details?.sx ?? {})
}}
>
{children}
Expand Down
17 changes: 16 additions & 1 deletion packages/react-ui/temp/react-ui.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ import { DatePickerProps as DatePickerProps_2 } from '@mui/x-date-pickers/DatePi
import { DialogProps } from '@mui/material';
import { FocusEvent as FocusEvent_2 } from 'react';
import { HTMLAttributes } from 'react';
import { JSX } from 'react';
import * as react from 'react';
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { SxProps } from '@mui/material';
import { SyntheticEvent } from 'react';
import { TextField } from '@mui/material';
import { TextFieldProps } from '@mui/material';
import { Theme } from '@mui/material';
import { Variant } from '@mui/material/styles/createTypography';

// @public
Expand Down Expand Up @@ -120,16 +123,28 @@ export function ItemAccordionDetails(props: AccordionDetailsProps): react_jsx_ru
export function ItemAccordionSummary(props: AccordionSummaryProps): react_jsx_runtime.JSX.Element;

// @public
export function PageDrawer({ expanded, onChange, children, height, minHeight, onResize, color, ...rest }: PageDrawerProps): react_jsx_runtime.JSX.Element;
export function PageDrawer({ expanded, onChange, children, height, minHeight, onResize, color, bgColor, slots, ...rest }: PageDrawerProps): react_jsx_runtime.JSX.Element;

// @public
export type PageDrawerProps = HTMLAttributes<HTMLDivElement> & {
color?: string;
bgColor?: string;
expanded?: boolean;
height?: number;
minHeight?: number;
onChange?: () => void;
onResize?: (height: number | undefined) => void;
slots?: {
root?: {
sx?: SxProps<Theme>;
};
summary?: {
sx?: SxProps<Theme>;
};
details?: {
sx?: SxProps<Theme>;
};
};
};

// @public
Expand Down
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

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