-
-
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
27 changed files
with
476 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,8 @@ | |
{ | ||
"files": "*.svelte", | ||
"options": { | ||
"parser": "svelte" | ||
"parser": "svelte", | ||
"printWidth": 100 | ||
} | ||
}, | ||
{ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts"> | ||
import { DataAttrsTable, PropsTable } from "@/components"; | ||
import { h3 as H3 } from "@/components/markdown"; | ||
import { p as P } from "@/components/markdown"; | ||
import type { APISchema } from "@/types"; | ||
export let schemas: APISchema[] = []; | ||
</script> | ||
|
||
<div class="flex flex-col gap-8"> | ||
{#each schemas as schema} | ||
<div> | ||
<H3>{schema.title}</H3> | ||
<P class="!mt-2 !mb-5">{schema.description}</P> | ||
<div class="flex flex-col gap-8"> | ||
{#if schema.props && schema.props.length} | ||
<PropsTable props={schema.props} /> | ||
{/if} | ||
{#if schema.dataAttributes && schema.dataAttributes.length} | ||
<DataAttrsTable dataAttrs={schema.dataAttributes} /> | ||
{/if} | ||
</div> | ||
</div> | ||
{/each} | ||
</div> |
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,36 @@ | ||
<script lang="ts"> | ||
import * as Table from "@/components/ui/table"; | ||
import { Code } from "@/components"; | ||
import { parseMarkdown } from "@/utils"; | ||
import type { DataAttrSchema } from "@/types"; | ||
export let dataAttrs: DataAttrSchema[] = []; | ||
</script> | ||
|
||
<Table.Root> | ||
<Table.Header> | ||
<Table.Row class="w-1/4"> | ||
<Table.Head class="w-1/2 whitespace-nowrap">Data Attribute</Table.Head> | ||
<Table.Head class="w-1/2 whitespace-nowrap">Value/Description</Table.Head> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{#if dataAttrs.length} | ||
{#each dataAttrs as attr} | ||
<Table.Row> | ||
<Table.Cell class="align-baseline"> | ||
<Code>data-{attr.name}</Code> | ||
</Table.Cell> | ||
<Table.Cell class="align-baseline"> | ||
{#if attr.value} | ||
<Code neutral>{attr.value}</Code> | ||
{/if} | ||
<p class="text-sm leading-7 my-2"> | ||
{@html parseMarkdown(attr.description)} | ||
</p> | ||
</Table.Cell> | ||
</Table.Row> | ||
{/each} | ||
{/if} | ||
</Table.Body> | ||
</Table.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,2 @@ | ||
export { default as DataAttrsTable } from "./data-attrs-table.svelte"; | ||
export { default as PropsTable } from "./props-table.svelte"; |
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,40 @@ | ||
<script lang="ts"> | ||
import * as Table from "@/components/ui/table"; | ||
import { Code } from "@/components"; | ||
import type { PropSchema } from "@/types"; | ||
import { parseMarkdown } from "@/utils"; | ||
export let props: PropSchema[] = []; | ||
</script> | ||
|
||
<Table.Root> | ||
<Table.Header> | ||
<Table.Row class="w-1/4"> | ||
<Table.Head class="w-1/4 whitespace-nowrap">Prop</Table.Head> | ||
<Table.Head class="w-1/4 whitespace-nowrap">Default</Table.Head> | ||
<Table.Head class="w-1/2 whitespace-nowrap">Type/Description</Table.Head> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{#each props as prop} | ||
<Table.Row> | ||
<Table.Cell class="align-baseline"> | ||
<Code>{prop.name}</Code> | ||
</Table.Cell> | ||
<Table.Cell class="align-baseline"> | ||
{#if prop.default} | ||
<Code neutral>{prop.default}</Code> | ||
{:else} | ||
<p>-</p> | ||
{/if} | ||
</Table.Cell> | ||
<Table.Cell class="align-baseline"> | ||
<Code neutral>{prop.type}</Code> | ||
<p class="text-sm leading-7 my-2"> | ||
{@html parseMarkdown(prop.description)} | ||
</p> | ||
</Table.Cell> | ||
</Table.Row> | ||
{/each} | ||
</Table.Body> | ||
</Table.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
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 @@ | ||
<script lang="ts"> | ||
import { cn } from "@/utils"; | ||
let className: string | undefined | null = undefined; | ||
export { className as class }; | ||
export let neutral = false; | ||
</script> | ||
|
||
<code | ||
class={cn( | ||
"relative rounded !px-[0.25rem] !py-[0.15rem] font-mono !text-[12px]", | ||
neutral ? "!bg-muted" : "!bg-secondary/25", | ||
className | ||
)} | ||
> | ||
<slot /> | ||
</code> |
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,148 @@ | ||
import type { APISchema } from "@/types"; | ||
import { asChild } from "./helpers"; | ||
|
||
export const root: APISchema = { | ||
title: "Root", | ||
description: "The root accordion component used to set and manage the state of the accordion.", | ||
props: [ | ||
{ | ||
name: "multiple", | ||
default: "false", | ||
type: "boolean", | ||
description: "Whether or not multiple accordion items can be active at the same time." | ||
}, | ||
{ | ||
name: "disabled", | ||
default: "false", | ||
type: "boolean", | ||
description: "Whether or not the accordion is disabled." | ||
}, | ||
{ | ||
name: "value", | ||
type: "string | undefined", | ||
description: "The active accordion item value." | ||
}, | ||
{ | ||
name: "onValueChange", | ||
type: "(value: string | undefined) => void", | ||
description: "A callback function called when the active accordion item value changes." | ||
}, | ||
{ | ||
name: "value", | ||
type: "string | undefined", | ||
description: "The active accordion item value when `multiple` is true." | ||
}, | ||
{ | ||
name: "onValueChange", | ||
type: "(value: string[]) => void", | ||
description: | ||
"A callback function called when the active accordion item value changes when `multiple` is true." | ||
} | ||
], | ||
dataAttributes: [ | ||
{ | ||
name: "orientation", | ||
value: "'horizontal' | 'vertical'", | ||
description: "The orientation of the accordion." | ||
}, | ||
{ | ||
name: "melt-accordion", | ||
value: "", | ||
description: "Present on the root element." | ||
} | ||
] | ||
}; | ||
|
||
const item: APISchema = { | ||
title: "Item", | ||
description: "An accordion item.", | ||
props: [ | ||
asChild, | ||
{ | ||
name: "value", | ||
type: "string", | ||
description: "The value of the accordion item." | ||
}, | ||
{ | ||
name: "disabled", | ||
default: "false", | ||
type: "boolean", | ||
description: "Whether or not the accordion item is disabled." | ||
} | ||
], | ||
dataAttributes: [ | ||
{ | ||
name: "state", | ||
value: "'open' | 'closed'", | ||
description: "The state of the accordion item." | ||
}, | ||
{ | ||
name: "disabled", | ||
value: "", | ||
description: "Present when the accordion item is disabled." | ||
}, | ||
{ | ||
name: "melt-accordion-item", | ||
value: "", | ||
description: "Present on the accordion item elements." | ||
} | ||
] | ||
}; | ||
|
||
const trigger: APISchema = { | ||
title: "Trigger", | ||
description: "The accordion item trigger, which opens and closes the accordion item.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "state", | ||
value: "'open' | 'closed'", | ||
description: "The state of the accordion item." | ||
}, | ||
{ | ||
name: "disabled", | ||
value: "", | ||
description: "Present when the accordion item is disabled." | ||
}, | ||
{ | ||
name: "value", | ||
value: "", | ||
description: "The value of the accordion item." | ||
}, | ||
{ | ||
name: "melt-accordion-trigger", | ||
value: "", | ||
description: "Present on the accordion item elements." | ||
} | ||
] | ||
}; | ||
|
||
const content: APISchema = { | ||
title: "Content", | ||
description: "The accordion item content, which is displayed when the item is open.", | ||
props: [asChild], | ||
dataAttributes: [ | ||
{ | ||
name: "state", | ||
value: "'open' | 'closed'", | ||
description: "The state of the accordion item." | ||
}, | ||
{ | ||
name: "disabled", | ||
value: "", | ||
description: "Present when the accordion item is disabled." | ||
}, | ||
{ | ||
name: "value", | ||
value: "", | ||
description: "The value of the accordion item." | ||
}, | ||
{ | ||
name: "melt-accordion-content", | ||
value: "", | ||
description: "Present on the accordion item elements." | ||
} | ||
] | ||
}; | ||
|
||
export const accordion = [root, item, trigger, content]; |
Oops, something went wrong.