Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

feat(typing): adds more typescript definitions #11

Merged
merged 2 commits into from
Sep 26, 2020
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
17 changes: 17 additions & 0 deletions packages/svelte-materialify/@types/components/AppBar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LocalSvelteComponent } from '../shared';

interface AppBarProps {
height?: string;
tile?: boolean;
flat?: boolean;
dense?: boolean;
prominent?: boolean;
fixed?: boolean;
absolute?: boolean;
collapsed?: boolean;
style?: string;
}

declare class AppBar extends LocalSvelteComponent<AppBarProps> {}

export default AppBar;
23 changes: 23 additions & 0 deletions packages/svelte-materialify/@types/components/Button.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { LocalSvelteComponent } from '../shared';

interface ButtonProps {
fab?: boolean;
icon?: boolean;
block?: boolean;
size?: 'x-small' | 'small' | 'default' | 'large' | 'x-large';
tile?: boolean;
text?: boolean;
depressed?: boolean;
outlined?: boolean;
rounded?: boolean;
disabled?: boolean;
active?: boolean;
activeClass?: string;
type?: 'button' | 'reset' | 'submit';
ripple?: any;
style?: string;
}

declare class Button extends LocalSvelteComponent<ButtonProps> {}

export default Button;
15 changes: 15 additions & 0 deletions packages/svelte-materialify/@types/components/Icon.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LocalSvelteComponent } from '../shared';

interface IconProps {
size?: string;
rotate?: number;
spin?: boolean;
disabled?: boolean;
path?: any;
label?: any;
style?: string;
}

declare class Icon extends LocalSvelteComponent<IconProps> {}

export default Icon;
18 changes: 18 additions & 0 deletions packages/svelte-materialify/@types/components/Input.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { LocalSvelteComponent } from '../shared';

interface InputProps {
value?: any;
color?: string;
dense?: boolean;
readonly?: boolean;
disabled?: boolean;
counter?: boolean;
hint?: string;
messages?: string[];
messagesCount?: number;
error?: boolean;
}

declare class Input extends LocalSvelteComponent<InputProps> {}

export default Input;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LocalSvelteComponent } from '../shared';

interface MaterialAppProps {
theme?: string;
}

declare class MaterialApp extends LocalSvelteComponent<MaterialAppProps> {}

export default MaterialApp;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { LocalSvelteComponent } from '../shared';

interface NavigationDrawerProps {
width?: string;
active?: boolean;
fixed?: boolean;
absolute?: boolean;
right?: boolean;
mini?: boolean;
clipped?: boolean;
noBorder?: boolean;
miniWidth?: string;
clippedHeight?: string;
transition?: any;
transitionOpts?: Record<string, any>;
style?: string;
}

declare class NavigationDrawer extends LocalSvelteComponent<NavigationDrawerProps> {}

export default NavigationDrawer;
15 changes: 15 additions & 0 deletions packages/svelte-materialify/@types/components/Overlay.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LocalSvelteComponent } from '../shared';

interface OverlayProps {
active?: boolean;
opacity?: number;
color?: string;
index?: number;
absolute?: boolean;
fadeOptions?: any;
style?: string;
}

declare class Overlay extends LocalSvelteComponent<OverlayProps> {}

export default Overlay;
50 changes: 50 additions & 0 deletions packages/svelte-materialify/@types/components/TextField.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { LocalSvelteComponent } from '../shared';

interface TextFieldProps {
// Value of the text input.
value?: string;
// The color of the input when active.
color?: string;
// Changes the variant of the input to filled.
filled?: boolean;
// Changes the variant of the input to solo.
solo?: boolean;
// Changes the variant of the input to outlined.
outlined?: boolean;
// Removes any shadow from the input.
flat?: boolean;
// Reduces the input height.
dense?: boolean;
// Adds a border radius to the input.
rounded?: boolean;
// Add input clear functionality.
clearable?: boolean;
// Puts input in readonly state.
readonly?: boolean;
// Disable the input.
disabled?: boolean;
// The input placeholder content.
placeholder?: string;
// Hint text.
hint?: string;
/**
* Creates counter for input length.
* @type {number}
*/
counter?: number;
/**
* An array of functions which take input value as arguement and return error message.
* @type {Array}
*/
rules: ((value) => string | false)[];
// Delays validation till blur.
validateOnBlur: boolean;
// Error state of the input.
error: boolean;
// Id of the text input.
id?: string;
}

declare class TextField extends LocalSvelteComponent<TextFieldProps> {}

export default TextField;
17 changes: 17 additions & 0 deletions packages/svelte-materialify/@types/components/card/card.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LocalSvelteComponent } from '../../shared';

interface CardProps {
flat?: boolean;
tile?: boolean;
outlined?: boolean;
raised?: boolean;
shaped?: boolean;
hover?: boolean;
link?: boolean;
disabled?: boolean;
style?: string;
}

declare class Card extends LocalSvelteComponent<CardProps> {}

export default Card;
15 changes: 15 additions & 0 deletions packages/svelte-materialify/@types/components/list/List.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LocalSvelteComponent } from '../../shared';

interface ListProps {
dense?: boolean;
disabled?: boolean;
flat?: boolean;
rounded?: boolean;
nav?: boolean;
outlined?: boolean;
style?: string;
}

declare class List extends LocalSvelteComponent<ListProps> {}

export default List;
16 changes: 16 additions & 0 deletions packages/svelte-materialify/@types/components/list/ListGroup.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { LocalSvelteComponent } from '../../shared';

interface ListGroupProps {
active?: boolean;
eager?: boolean;
transition?: any;
transitionOpts?: Record<string, any>;
offset?: boolean;
disabled?: boolean;
ripple?: any;
style?: string;
}

declare class ListGroup extends LocalSvelteComponent<ListGroupProps> {}

export default ListGroup;
16 changes: 16 additions & 0 deletions packages/svelte-materialify/@types/components/list/ListItem.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { LocalSvelteComponent } from '../../shared';

interface ListItemProps {
class?: string;
activeClass?: string;
active?: boolean;
value?: any;
dense?: boolean;
disabled?: boolean;
selectable?: boolean;
ripple?: any;
}

declare class ListItem extends LocalSvelteComponent<ListItemProps> {}

export default ListItem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { LocalSvelteComponent } from '../../shared';

interface ListItemGroupProps {
value?: any;
multiple?: boolean;
mandatory?: boolean;
max?: number;
style?: string;
}

declare class ListItemGroup extends LocalSvelteComponent<ListItemGroupProps> {}

export default ListItemGroup;
14 changes: 14 additions & 0 deletions packages/svelte-materialify/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@ export { default as ClickOutside } from './ClickOutside';
export { default as Intersect } from './Intersect';
export { default as Jump } from './Jump';
export { default as Touch } from './Touch';

export { default as AppBar } from './components/AppBar';
export { default as Button } from './components/Button';
export { default as Card } from './components/card/Card';
export { default as Icon } from './components/Icon';
export { default as Input } from './components/Input';
export { default as List } from './components/list/List';
export { default as ListGroup } from './components/list/ListGroup';
export { default as ListItem } from './components/list/ListItem';
export { default as ListItemGroup } from './components/list/ListItemGroup';
export { default as MaterialApp } from './components/MaterialApp';
export { default as NavigationDrawer } from './components/NavigationDrawer';
export { default as Overlay } from './components/Overlay';
export { default as TextField } from './components/TextField';
21 changes: 21 additions & 0 deletions packages/svelte-materialify/@types/shared.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type LocalSvelteProps = {
children?: any;
class?: string;
} & Record<string, any>;

/**
* Local svelte class for adding typescript definitions for svelte components
*
*/
export declare class LocalSvelteComponent<Props = {}> {
constructor(props: Props & LocalSvelteProps);
$on<T = any>(event: string, callback: (event: CustomEvent<T>) => void): () => void;
$$prop_def: Props & LocalSvelteProps;
render: undefined;
context: undefined;
setState: undefined;
forceUpdate: undefined;
props: undefined;
state: undefined;
refs: undefined;
}