-
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: wip * chore: wip (very crude impl) * chore: another crude wip * fix: improve typing * chore: move constants to shared * refactor: tree item, add virtualizer * refactor: roving focus to use new collection * feat: virtualizer * refactor: improve tree * fix: build * fix: missing value for comboboxitem * feat: export component, run docsgen * docs: tree, demo * docs: fix wrong demo * chore: expose more internal slot * test: add test for tree componetn * fix: missing aria condition * refactor: expose more function, cater for checkbox * chore: add dnd example * chore: cleanup dnd, add stackblitz docs * docs: update sb link * chore: lint * chore: improve story styling * feat: cater for async mode * chore: add story for nested dom case * chore: update docs * fix: direction
- Loading branch information
Showing
61 changed files
with
2,233 additions
and
111 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
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
8 changes: 4 additions & 4 deletions
8
docs/components/demo/CalendarYearIncrement/tailwind/index.vue
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,61 @@ | ||
<script setup lang="ts"> | ||
import { TreeItem, TreeRoot } from 'radix-vue' | ||
import { Icon } from '@iconify/vue' | ||
const items = [ | ||
{ | ||
title: 'composables', | ||
icon: 'lucide:folder', | ||
children: [ | ||
{ title: 'useAuth.ts', icon: 'vscode-icons:file-type-typescript' }, | ||
{ title: 'useUser.ts', icon: 'vscode-icons:file-type-typescript' }, | ||
], | ||
}, | ||
{ | ||
title: 'components', | ||
icon: 'lucide:folder', | ||
children: [ | ||
{ | ||
title: 'Home', | ||
icon: 'lucide:folder', | ||
children: [ | ||
{ title: 'Card.vue', icon: 'vscode-icons:file-type-vue' }, | ||
{ title: 'Button.vue', icon: 'vscode-icons:file-type-vue' }, | ||
], | ||
}, | ||
], | ||
}, | ||
{ title: 'app.vue', icon: 'vscode-icons:file-type-vue' }, | ||
{ title: 'nuxt.config.ts', icon: 'vscode-icons:file-type-nuxt' }, | ||
] | ||
</script> | ||
|
||
<template> | ||
<TreeRoot | ||
v-slot="{ flattenItems }" | ||
class="list-none select-none w-56 bg-white text-blackA11 rounded-lg p-2 text-sm font-medium" :items="items" | ||
:get-key="(item) => item.title" | ||
:default-expanded="['components']" | ||
> | ||
<h2 class="font-semibold !text-base text-blackA11 px-2 pt-1"> | ||
Directory Structure | ||
</h2> | ||
<TreeItem | ||
v-for="item in flattenItems" | ||
v-slot="{ isExpanded }" | ||
:key="item._id" | ||
:style="{ 'padding-left': `${item.level + 0.5}rem` }" | ||
v-bind="item.bind" | ||
class="flex items-center py-1 px-2 my-0.5 rounded outline-none focus:ring-grass8 focus:ring-2 data-[selected]:bg-grass4" | ||
> | ||
<template v-if="item.hasChildren"> | ||
<Icon v-if="!isExpanded" icon="lucide:folder" class="h-4 w-4" /> | ||
<Icon v-else icon="lucide:folder-open" class="h-4 w-4" /> | ||
</template> | ||
<Icon v-else :icon="item.value.icon || 'lucide:file'" class="h-4 w-4" /> | ||
<div class="pl-2"> | ||
{{ item.value.title }} | ||
</div> | ||
</TreeItem> | ||
</TreeRoot> | ||
</template> |
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,74 @@ | ||
<script setup lang="ts"> | ||
import { TreeItem, TreeRoot } from 'radix-vue' | ||
import { Icon } from '@iconify/vue' | ||
const items = [ | ||
{ | ||
title: 'composables', | ||
icon: 'lucide:folder', | ||
children: [ | ||
{ title: 'useAuth.ts', icon: 'vscode-icons:file-type-typescript' }, | ||
{ title: 'useUser.ts', icon: 'vscode-icons:file-type-typescript' }, | ||
], | ||
}, | ||
{ | ||
title: 'components', | ||
icon: 'lucide:folder', | ||
children: [ | ||
{ | ||
title: 'Home', | ||
icon: 'lucide:folder', | ||
children: [ | ||
{ title: 'Card.vue', icon: 'vscode-icons:file-type-vue' }, | ||
{ title: 'Button.vue', icon: 'vscode-icons:file-type-vue' }, | ||
], | ||
}, | ||
], | ||
}, | ||
{ title: 'app.vue', icon: 'vscode-icons:file-type-vue' }, | ||
{ title: 'nuxt.config.ts', icon: 'vscode-icons:file-type-nuxt' }, | ||
] | ||
</script> | ||
|
||
<template> | ||
<TreeRoot | ||
v-slot="{ flattenItems }" | ||
class="list-none select-none w-56 bg-white text-blackA11 rounded-lg p-2 text-sm font-medium" | ||
:items="items" | ||
:get-key="(item) => item.title" | ||
:default-expanded="['components']" | ||
> | ||
<h2 class="font-semibold !text-base text-blackA11 px-2 pt-1"> | ||
Directory Structure | ||
</h2> | ||
<TreeItem | ||
v-for="item in flattenItems" | ||
v-slot="{ isExpanded }" | ||
:key="item._id" | ||
:style="{ 'padding-left': `${item.level - 0.5}rem` }" | ||
v-bind="item.bind" | ||
class="flex items-center py-1 px-2 my-0.5 rounded outline-none focus:ring-grass8 focus:ring-2 data-[selected]:bg-grass4" | ||
> | ||
<template v-if="item.hasChildren"> | ||
<Icon | ||
v-if="!isExpanded" | ||
icon="lucide:folder" | ||
class="h-4 w-4" | ||
/> | ||
<Icon | ||
v-else | ||
icon="lucide:folder-open" | ||
class="h-4 w-4" | ||
/> | ||
</template> | ||
<Icon | ||
v-else | ||
:icon="item.value.icon || 'lucide:file'" | ||
class="h-4 w-4" | ||
/> | ||
<div class="pl-2"> | ||
{{ item.value.title }} | ||
</div> | ||
</TreeItem> | ||
</TreeRoot> | ||
</template> |
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,15 @@ | ||
const { green, grass } = require('@radix-ui/colors') | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: ['./**/*.vue'], | ||
theme: { | ||
extend: { | ||
colors: { | ||
...green, | ||
...grass, | ||
}, | ||
}, | ||
}, | ||
plugins: [], | ||
} |
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
Oops, something went wrong.