-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
452 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
import type { APISchema } from "@/types"; | ||
import { asChild } from "./helpers"; | ||
|
||
export const root: APISchema = { | ||
title: "Root", | ||
description: "The root component used to set and manage the state of the alert dialog.", | ||
props: [ | ||
{ | ||
name: "preventScroll", | ||
default: "true", | ||
type: "boolean", | ||
description: "Whether or not to prevent scroll on the body when the alert dialog is open." | ||
}, | ||
{ | ||
name: "closeOnEscape", | ||
default: "true", | ||
type: "boolean", | ||
description: "Whether to close the alert dialog when the escape key is pressed." | ||
}, | ||
{ | ||
name: "closeOnOutsideClick", | ||
type: "boolean", | ||
default: "true", | ||
description: "Whether to close the alert dialog when a click occurs outside of it." | ||
}, | ||
{ | ||
name: "open", | ||
type: "boolean", | ||
default: "false", | ||
description: "Whether or not the alert dialog is open." | ||
}, | ||
{ | ||
name: "onOpenChange", | ||
type: "(open: boolean) => void", | ||
description: "A callback function called when the open state changes." | ||
} | ||
] | ||
}; | ||
|
||
export const action: APISchema = { | ||
title: "Action", | ||
description: "A button used to close the alert dialog by taking an action.", | ||
props: [asChild] | ||
}; | ||
|
||
export const cancel: APISchema = { | ||
title: "Cancel", | ||
description: "A button used to close the alert dialog without taking an action.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "melt-dialog-close", | ||
value: "", | ||
description: "Present on the cancel element." | ||
} | ||
] | ||
}; | ||
|
||
export const content: APISchema = { | ||
title: "Cancel", | ||
description: "The content displayed within the alert dialog modal.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "state", | ||
value: "'open' | 'closed'", | ||
description: "The state of the alert dialog." | ||
}, | ||
{ | ||
name: "melt-dialog-content", | ||
value: "", | ||
description: "Present on the content element." | ||
} | ||
] | ||
}; | ||
|
||
export const title: APISchema = { | ||
title: "Title", | ||
description: "An accessibile title for the alert dialog.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "melt-dialog-title", | ||
value: "", | ||
description: "Present on the title element." | ||
} | ||
] | ||
}; | ||
|
||
export const description: APISchema = { | ||
title: "Description", | ||
description: "An accessibile description for the alert dialog.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "melt-dialog-description", | ||
value: "", | ||
description: "Present on the description element." | ||
} | ||
] | ||
}; | ||
|
||
export const trigger: APISchema = { | ||
title: "Trigger", | ||
description: "The element which opens the alert dialog on press.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "melt-dialog-trigger", | ||
value: "", | ||
description: "Present on the trigger element." | ||
} | ||
] | ||
}; | ||
|
||
export const overlay: APISchema = { | ||
title: "Overlay", | ||
description: "An overlay which covers the body when the alert dialog is open.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "state", | ||
value: "'open' | 'closed'", | ||
description: "The state of the alert dialog." | ||
}, | ||
{ | ||
name: "melt-dialog-overlay", | ||
value: "", | ||
description: "Present on the overlay element." | ||
} | ||
] | ||
}; | ||
|
||
export const portal: APISchema = { | ||
title: "Portal", | ||
description: "A portal which renders the alert dialog into the body when it is open." | ||
}; | ||
|
||
export const alertDialog = [ | ||
root, | ||
trigger, | ||
content, | ||
overlay, | ||
portal, | ||
action, | ||
cancel, | ||
title, | ||
description | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { APISchema } from "@/types"; | ||
|
||
export const root: APISchema = { | ||
title: "Root", | ||
description: "The aspect ratio component.", | ||
props: [ | ||
{ | ||
name: "ratio", | ||
default: "1", | ||
type: "number", | ||
description: "The desired aspect ratio." | ||
} | ||
] | ||
}; | ||
|
||
export const aspectRatio = [root]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { APISchema } from "@/types"; | ||
import { asChild } from "./helpers"; | ||
|
||
export const root: APISchema = { | ||
title: "Root", | ||
description: "The root component used to set and manage the state of the avatar.", | ||
props: [ | ||
{ | ||
name: "delayMs", | ||
default: "0", | ||
type: "number", | ||
description: | ||
"How long to wait before showing the image after it has loaded. This can be useful to prevent a harsh flickering effect when the image loads quickly." | ||
}, | ||
{ | ||
name: "loadingStatus", | ||
type: "'loading' | 'loaded' | 'error'", | ||
description: | ||
"The loading status of the avatars source image. You can bind a variable to track the status outside of the component and use it to show a loading indicator or error message." | ||
}, | ||
{ | ||
name: "onLoadingStatusChange", | ||
type: "(status: 'loading' | 'loaded' | 'error') => void", | ||
description: "A callback function called when the loading status of the image changes." | ||
} | ||
] | ||
}; | ||
|
||
export const image: APISchema = { | ||
title: "Image", | ||
description: "The avatar image displayed once it has loaded.", | ||
props: [ | ||
{ | ||
name: "src", | ||
type: "string", | ||
description: | ||
"The source of the image. This is typed the same as the native `img` element so you can use any valid `img` `src` value." | ||
}, | ||
{ | ||
name: "alt", | ||
type: "string", | ||
description: | ||
"The alt text of the image. This is typed the same as the native `img` element so you can use any valid `img` `alt` value." | ||
}, | ||
asChild | ||
] | ||
}; | ||
|
||
export const fallback: APISchema = { | ||
title: "Fallback", | ||
description: "The fallback displayed while the avatar image is loading or if it fails to load", | ||
props: [asChild] | ||
}; | ||
|
||
export const avatar = [root, image, fallback]; |
Oops, something went wrong.