Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #343 - Export missing SnackbarContent for TypeScript #354

Merged
merged 2 commits into from
Feb 23, 2021
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
5 changes: 3 additions & 2 deletions src/SnackbarContent/SnackbarContent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { forwardRef } from 'react';
import clsx from 'clsx';
import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles';
import { SnackbarContentProps } from '../index';

const styles = (theme: Theme) => createStyles({
root: {
Expand All @@ -14,9 +15,9 @@ const styles = (theme: Theme) => createStyles({
}
});

interface SnackbarContentProps extends WithStyles<typeof styles>, React.HTMLAttributes<HTMLDivElement> { }
interface Props extends WithStyles<typeof styles>, SnackbarContentProps { }

const SnackbarContent = forwardRef<HTMLDivElement, SnackbarContentProps>(({ classes, className, ...props }, ref) => (
const SnackbarContent = forwardRef<HTMLDivElement, Props>(({ classes, className, ...props }, ref) => (
<div ref={ref} className={clsx(classes.root, className)} {...props} />
))

Expand Down
3 changes: 2 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export interface TransitionHandlerProps {
onExited: TransitionHandler;
}

export type SnackbarContentProps = React.HTMLAttributes<HTMLDivElement>
export type SnackbarContentProps = React.HTMLAttributes<HTMLDivElement>;

/**
* @category Shared
Expand Down Expand Up @@ -269,6 +269,7 @@ export interface ProviderContext {
export function withSnackbar<P extends ProviderContext>(component: React.ComponentType<P>):
React.ComponentClass<Omit<P, keyof ProviderContext>> & { WrappedComponent: React.ComponentType<P> };

export declare const SnackbarContent: React.ComponentType<SnackbarContentProps & React.RefAttributes<HTMLDivElement>>;

export function useSnackbar(): ProviderContext;

Expand Down
62 changes: 56 additions & 6 deletions typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5471,7 +5471,7 @@
}
},
{
"id": 222,
"id": 223,
"name": "WithSnackbarProps",
"kind": 4194304,
"kindString": "Type alias",
Expand All @@ -5481,7 +5481,7 @@
"sources": [
{
"fileName": "src/index.d.ts",
"line": 276,
"line": 277,
"character": 29
}
],
Expand All @@ -5493,6 +5493,49 @@
},
{
"id": 220,
"name": "SnackbarContent",
"kind": 32,
"kindString": "Variable",
"flags": {
"isExported": true,
"isConst": true
},
"sources": [
{
"fileName": "src/index.d.ts",
"line": 272,
"character": 36
}
],
"type": {
"type": "reference",
"typeArguments": [
{
"type": "intersection",
"types": [
{
"type": "reference",
"id": 213,
"name": "SnackbarContentProps"
},
{
"type": "reference",
"typeArguments": [
{
"type": "reference",
"name": "HTMLDivElement"
}
],
"name": "RefAttributes"
}
]
}
],
"name": "React.ComponentType"
}
},
{
"id": 221,
"name": "useSnackbar",
"kind": 64,
"kindString": "Function",
Expand All @@ -5501,7 +5544,7 @@
},
"signatures": [
{
"id": 221,
"id": 222,
"name": "useSnackbar",
"kind": 4096,
"kindString": "Call signature",
Expand All @@ -5518,7 +5561,7 @@
"sources": [
{
"fileName": "src/index.d.ts",
"line": 273,
"line": 274,
"character": 27
}
]
Expand Down Expand Up @@ -5763,14 +5806,21 @@
205,
211,
181,
222
223
]
},
{
"title": "Variables",
"kind": 32,
"children": [
220
]
},
{
"title": "Functions",
"kind": 64,
"children": [
220,
221,
214
]
}
Expand Down