@nuxt/ui 3.0.0-alpha.6 → 3.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/ui/accordion.ts +20 -0
- package/.nuxt/ui/alert.ts +242 -0
- package/.nuxt/ui/avatar-group.ts +40 -0
- package/.nuxt/ui/avatar.ts +42 -0
- package/.nuxt/ui/badge.ts +194 -0
- package/.nuxt/ui/breadcrumb.ts +45 -0
- package/.nuxt/ui/button-group.ts +16 -0
- package/.nuxt/ui/button.ts +344 -0
- package/.nuxt/ui/card.ts +8 -0
- package/.nuxt/ui/carousel.ts +41 -0
- package/.nuxt/ui/checkbox.ts +105 -0
- package/.nuxt/ui/chip.ts +67 -0
- package/.nuxt/ui/collapsible.ts +6 -0
- package/.nuxt/ui/command-palette.ts +40 -0
- package/.nuxt/ui/container.ts +3 -0
- package/.nuxt/ui/context-menu.ts +198 -0
- package/.nuxt/ui/drawer.ts +55 -0
- package/.nuxt/ui/dropdown-menu.ts +199 -0
- package/.nuxt/ui/form-field.ts +40 -0
- package/.nuxt/ui/form.ts +3 -0
- package/.nuxt/ui/index.ts +43 -0
- package/.nuxt/ui/input-menu.ts +411 -0
- package/.nuxt/ui/input.ts +263 -0
- package/.nuxt/ui/kbd.ts +19 -0
- package/.nuxt/ui/link.ts +15 -0
- package/.nuxt/ui/modal.ts +28 -0
- package/.nuxt/ui/navigation-menu.ts +390 -0
- package/.nuxt/ui/pagination.ts +8 -0
- package/.nuxt/ui/popover.ts +6 -0
- package/.nuxt/ui/progress.ts +258 -0
- package/.nuxt/ui/radio-group.ts +112 -0
- package/.nuxt/ui/select-menu.ts +321 -0
- package/.nuxt/ui/select.ts +314 -0
- package/.nuxt/ui/separator.ts +143 -0
- package/.nuxt/ui/skeleton.ts +3 -0
- package/.nuxt/ui/slideover.ts +63 -0
- package/.nuxt/ui/slider.ts +148 -0
- package/.nuxt/ui/switch.ts +113 -0
- package/.nuxt/ui/table.ts +128 -0
- package/.nuxt/ui/tabs.ts +227 -0
- package/.nuxt/ui/textarea.ts +263 -0
- package/.nuxt/ui/toast.ts +66 -0
- package/.nuxt/ui/toaster.ts +75 -0
- package/.nuxt/ui/tooltip.ts +9 -0
- package/cli/templates.mjs +1 -1
- package/dist/chunks/component-meta.cjs +73264 -0
- package/dist/chunks/component-meta.mjs +73262 -0
- package/dist/client/devtools/200.html +1 -0
- package/dist/client/devtools/404.html +1 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/Bj9hdafK.js +1 -0
- package/dist/client/devtools/_nuxt/DM3_wAgz.js +62 -0
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +1 -0
- package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +24 -0
- package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +1 -0
- package/dist/client/devtools/_nuxt/hKiujHsR.js +1 -0
- package/dist/client/devtools/favicon.svg +1 -0
- package/dist/client/devtools/index.html +1 -0
- package/dist/devtools/runtime/DevtoolsRenderer.vue +53 -0
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
- package/dist/devtools/runtime/examples/CardExample.vue +13 -0
- package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
- package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
- package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
- package/dist/devtools/runtime/examples/FormExample.vue +30 -0
- package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
- package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
- package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
- package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
- package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
- package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
- package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
- package/dist/module.cjs +222 -4
- package/dist/module.d.cts +54 -0
- package/dist/module.d.mts +16 -6
- package/dist/module.d.ts +16 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +157 -2629
- package/dist/runtime/components/Accordion.vue +45 -6
- package/dist/runtime/components/Alert.vue +4 -0
- package/dist/runtime/components/App.vue +8 -0
- package/dist/runtime/components/Avatar.vue +23 -5
- package/dist/runtime/components/AvatarGroup.vue +3 -0
- package/dist/runtime/components/Badge.vue +33 -3
- package/dist/runtime/components/Breadcrumb.vue +39 -7
- package/dist/runtime/components/Button.vue +10 -3
- package/dist/runtime/components/ButtonGroup.vue +4 -1
- package/dist/runtime/components/Card.vue +3 -0
- package/dist/runtime/components/Carousel.vue +13 -8
- package/dist/runtime/components/Checkbox.vue +7 -6
- package/dist/runtime/components/Chip.vue +9 -2
- package/dist/runtime/components/Collapsible.vue +3 -0
- package/dist/runtime/components/CommandPalette.vue +28 -17
- package/dist/runtime/components/Container.vue +3 -0
- package/dist/runtime/components/ContextMenu.vue +95 -10
- package/dist/runtime/components/ContextMenuContent.vue +41 -13
- package/dist/runtime/components/Drawer.vue +3 -0
- package/dist/runtime/components/DropdownMenu.vue +83 -10
- package/dist/runtime/components/DropdownMenuContent.vue +43 -13
- package/dist/runtime/components/Form.vue +6 -1
- package/dist/runtime/components/FormField.vue +3 -0
- package/dist/runtime/components/Input.vue +7 -4
- package/dist/runtime/components/InputMenu.vue +61 -34
- package/dist/runtime/components/Kbd.vue +2 -0
- package/dist/runtime/components/Link.vue +50 -1
- package/dist/runtime/components/LinkBase.vue +4 -2
- package/dist/runtime/components/Modal.vue +3 -0
- package/dist/runtime/components/NavigationMenu.vue +159 -75
- package/dist/runtime/components/Pagination.vue +5 -1
- package/dist/runtime/components/Popover.vue +3 -0
- package/dist/runtime/components/Progress.vue +1 -1
- package/dist/runtime/components/RadioGroup.vue +26 -4
- package/dist/runtime/components/Select.vue +44 -21
- package/dist/runtime/components/SelectMenu.vue +67 -43
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Skeleton.vue +3 -0
- package/dist/runtime/components/Slideover.vue +3 -0
- package/dist/runtime/components/Slider.vue +1 -1
- package/dist/runtime/components/Switch.vue +5 -1
- package/dist/runtime/components/Table.vue +241 -0
- package/dist/runtime/components/Tabs.vue +35 -8
- package/dist/runtime/components/Toast.vue +4 -0
- package/dist/runtime/components/Toaster.vue +8 -1
- package/dist/runtime/components/Tooltip.vue +3 -0
- package/dist/runtime/composables/defineShortcuts.js +1 -7
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
- package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
- package/dist/runtime/composables/useKbd.d.ts +10 -3
- package/dist/runtime/composables/useKbd.js +14 -8
- package/dist/runtime/composables/useModal.d.ts +1 -1
- package/dist/runtime/composables/useSlideover.d.ts +1 -1
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -0
- package/dist/runtime/types/form.d.ts +2 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +7 -0
- package/dist/runtime/utils/form.d.ts +3 -0
- package/dist/runtime/utils/form.js +14 -0
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +3 -0
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Link.vue +195 -0
- package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
- package/dist/runtime/vue/plugins/color-mode.js +6 -0
- package/dist/runtime/vue/plugins/head.d.ts +4 -0
- package/dist/runtime/vue/plugins/head.js +6 -0
- package/dist/runtime/vue/stubs.d.ts +15 -0
- package/dist/runtime/vue/stubs.js +27 -0
- package/dist/shared/ui.BU7wzH0D.cjs +2872 -0
- package/dist/shared/ui.BufKhDiD.mjs +2865 -0
- package/dist/unplugin.cjs +192 -0
- package/dist/unplugin.d.cts +47 -0
- package/dist/unplugin.d.mts +47 -0
- package/dist/unplugin.d.ts +47 -0
- package/dist/unplugin.mjs +181 -0
- package/dist/vite.cjs +22 -0
- package/dist/vite.d.cts +13 -0
- package/dist/vite.d.mts +13 -0
- package/dist/vite.d.ts +13 -0
- package/dist/vite.mjs +20 -0
- package/package.json +73 -32
- package/vue-plugin.d.ts +5 -0
- package/cli/node_modules/.ignored/citty/LICENSE +0 -36
- package/cli/node_modules/.ignored/citty/README.md +0 -134
- package/cli/node_modules/.ignored/citty/dist/index.cjs +0 -475
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +0 -80
- package/cli/node_modules/.ignored/citty/dist/index.mjs +0 -463
- package/cli/node_modules/.ignored/citty/package.json +0 -49
- package/cli/node_modules/.ignored/consola/LICENSE +0 -47
- package/cli/node_modules/.ignored/consola/README.md +0 -318
- package/cli/node_modules/.ignored/consola/core.d.ts +0 -1
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +0 -32
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +0 -24
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +0 -80
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +0 -7
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +0 -72
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +0 -436
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +0 -429
- package/cli/node_modules/.ignored/consola/dist/core.cjs +0 -415
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +0 -124
- package/cli/node_modules/.ignored/consola/dist/core.mjs +0 -410
- package/cli/node_modules/.ignored/consola/dist/index.cjs +0 -21
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +0 -9
- package/cli/node_modules/.ignored/consola/dist/index.mjs +0 -8
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +0 -62
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +0 -636
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +0 -645
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +0 -65
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +0 -308
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +0 -169
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +0 -284
- package/cli/node_modules/.ignored/consola/lib/index.cjs +0 -9
- package/cli/node_modules/.ignored/consola/package.json +0 -101
- package/cli/node_modules/.ignored/consola/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/pathe/LICENSE +0 -44
- package/cli/node_modules/.ignored/pathe/README.md +0 -69
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +0 -23
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +0 -36
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +0 -1
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +0 -238
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +0 -221
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +0 -58
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +0 -5
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +0 -54
- package/cli/node_modules/.ignored/pathe/package.json +0 -48
- package/cli/node_modules/.ignored/pathe/utils.d.ts +0 -1
- package/cli/node_modules/.ignored/scule/LICENSE +0 -21
- package/cli/node_modules/.ignored/scule/README.md +0 -149
- package/cli/node_modules/.ignored/scule/dist/index.cjs +0 -92
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +0 -57
- package/cli/node_modules/.ignored/scule/dist/index.mjs +0 -80
- package/cli/node_modules/.ignored/scule/package.json +0 -43
- package/cli/node_modules/.package-lock.json +0 -33
- package/dist/runtime/types/component.d.ts +0 -17
- package/dist/runtime/types/component.js +0 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
<!-- eslint-disable vue/block-tag-newline -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import type { Ref } from 'vue'
|
|
4
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import type {
|
|
7
|
+
Row,
|
|
8
|
+
ColumnDef,
|
|
9
|
+
ColumnFiltersState,
|
|
10
|
+
ColumnPinningState,
|
|
11
|
+
RowSelectionState,
|
|
12
|
+
SortingState,
|
|
13
|
+
ExpandedState,
|
|
14
|
+
VisibilityState,
|
|
15
|
+
GlobalFilterOptions,
|
|
16
|
+
ColumnFiltersOptions,
|
|
17
|
+
ColumnPinningOptions,
|
|
18
|
+
VisibilityOptions,
|
|
19
|
+
ExpandedOptions,
|
|
20
|
+
SortingOptions,
|
|
21
|
+
RowSelectionOptions,
|
|
22
|
+
Updater,
|
|
23
|
+
CellContext,
|
|
24
|
+
HeaderContext
|
|
25
|
+
} from '@tanstack/vue-table'
|
|
26
|
+
import _appConfig from '#build/app.config'
|
|
27
|
+
import theme from '#build/ui/table'
|
|
28
|
+
|
|
29
|
+
const appConfig = _appConfig as AppConfig & { ui: { table: Partial<typeof theme> } }
|
|
30
|
+
|
|
31
|
+
const table = tv({ extend: tv(theme), ...(appConfig.ui?.table || {}) })
|
|
32
|
+
|
|
33
|
+
type TableVariants = VariantProps<typeof table>
|
|
34
|
+
|
|
35
|
+
export type TableColumn<T> = ColumnDef<T>
|
|
36
|
+
|
|
37
|
+
export interface TableData {
|
|
38
|
+
[key: string]: any
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface TableProps<T> {
|
|
42
|
+
data?: T[]
|
|
43
|
+
columns?: TableColumn<T>[]
|
|
44
|
+
/**
|
|
45
|
+
* Whether the table should have a sticky header.
|
|
46
|
+
* @defaultValue false
|
|
47
|
+
*/
|
|
48
|
+
sticky?: boolean
|
|
49
|
+
/** Whether the table should be in loading state. */
|
|
50
|
+
loading?: boolean
|
|
51
|
+
loadingColor?: TableVariants['loadingColor']
|
|
52
|
+
loadingAnimation?: TableVariants['loadingAnimation']
|
|
53
|
+
/**
|
|
54
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
|
|
55
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
|
|
56
|
+
*/
|
|
57
|
+
globalFilterOptions?: Omit<GlobalFilterOptions<T>, 'onGlobalFilterChange'>
|
|
58
|
+
/**
|
|
59
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
|
|
60
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
61
|
+
*/
|
|
62
|
+
columnFiltersOptions?: Omit<ColumnFiltersOptions<T>, 'getFilteredRowModel' | 'onColumnFiltersChange'>
|
|
63
|
+
/**
|
|
64
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
|
|
65
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
|
|
66
|
+
*/
|
|
67
|
+
columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>
|
|
68
|
+
/**
|
|
69
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
|
|
70
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
|
|
71
|
+
*/
|
|
72
|
+
visibilityOptions?: Omit<VisibilityOptions, 'onColumnVisibilityChange'>
|
|
73
|
+
/**
|
|
74
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
|
|
75
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
|
|
76
|
+
*/
|
|
77
|
+
sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>
|
|
78
|
+
/**
|
|
79
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
|
|
80
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
|
|
81
|
+
*/
|
|
82
|
+
expandedOptions?: Omit<ExpandedOptions<T>, 'getExpandedRowModel' | 'onExpandedChange'>
|
|
83
|
+
/**
|
|
84
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
|
|
85
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
|
|
86
|
+
*/
|
|
87
|
+
rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>
|
|
88
|
+
class?: any
|
|
89
|
+
ui?: Partial<typeof table.slots>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>
|
|
93
|
+
type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>
|
|
94
|
+
|
|
95
|
+
export type TableSlots<T> = {
|
|
96
|
+
expanded: (props: { row: Row<T> }) => any
|
|
97
|
+
empty: (props?: {}) => any
|
|
98
|
+
} & DynamicHeaderSlots<T> & DynamicCellSlots<T>
|
|
99
|
+
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<script setup lang="ts" generic="T extends TableData">
|
|
103
|
+
import { computed } from 'vue'
|
|
104
|
+
import {
|
|
105
|
+
FlexRender,
|
|
106
|
+
getCoreRowModel,
|
|
107
|
+
getFilteredRowModel,
|
|
108
|
+
getSortedRowModel,
|
|
109
|
+
getExpandedRowModel,
|
|
110
|
+
useVueTable
|
|
111
|
+
} from '@tanstack/vue-table'
|
|
112
|
+
import { upperFirst } from 'scule'
|
|
113
|
+
|
|
114
|
+
const props = defineProps<TableProps<T>>()
|
|
115
|
+
defineSlots<TableSlots<T>>()
|
|
116
|
+
|
|
117
|
+
const data = computed(() => props.data ?? [])
|
|
118
|
+
const columns = computed<TableColumn<T>[]>(() => props.columns ?? Object.keys(data.value[0] ?? {}).map((accessorKey: string) => ({ accessorKey, header: upperFirst(accessorKey) })))
|
|
119
|
+
|
|
120
|
+
const ui = computed(() => table({
|
|
121
|
+
sticky: props.sticky,
|
|
122
|
+
loading: props.loading,
|
|
123
|
+
loadingColor: props.loadingColor,
|
|
124
|
+
loadingAnimation: props.loadingAnimation
|
|
125
|
+
}))
|
|
126
|
+
|
|
127
|
+
const globalFilterState = defineModel<string>('globalFilter', { default: undefined })
|
|
128
|
+
const columnFiltersState = defineModel<ColumnFiltersState>('columnFilters', { default: [] })
|
|
129
|
+
const columnVisibilityState = defineModel<VisibilityState>('columnVisibility', { default: {} })
|
|
130
|
+
const columnPinningState = defineModel<ColumnPinningState>('columnPinning', { default: {} })
|
|
131
|
+
const rowSelectionState = defineModel<RowSelectionState>('rowSelection', { default: {} })
|
|
132
|
+
const sortingState = defineModel<SortingState>('sorting', { default: [] })
|
|
133
|
+
const expandedState = defineModel<ExpandedState>('expanded', { default: {} })
|
|
134
|
+
|
|
135
|
+
const tableApi = useVueTable({
|
|
136
|
+
data,
|
|
137
|
+
columns: columns.value,
|
|
138
|
+
getCoreRowModel: getCoreRowModel(),
|
|
139
|
+
...(props.globalFilterOptions || {}),
|
|
140
|
+
onGlobalFilterChange: updaterOrValue => valueUpdater(updaterOrValue, globalFilterState),
|
|
141
|
+
...(props.columnFiltersOptions || {}),
|
|
142
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
143
|
+
onColumnFiltersChange: updaterOrValue => valueUpdater(updaterOrValue, columnFiltersState),
|
|
144
|
+
...(props.visibilityOptions || {}),
|
|
145
|
+
onColumnVisibilityChange: updaterOrValue => valueUpdater(updaterOrValue, columnVisibilityState),
|
|
146
|
+
...(props.columnPinningOptions || {}),
|
|
147
|
+
onColumnPinningChange: updaterOrValue => valueUpdater(updaterOrValue, columnPinningState),
|
|
148
|
+
...(props.rowSelectionOptions || {}),
|
|
149
|
+
onRowSelectionChange: updaterOrValue => valueUpdater(updaterOrValue, rowSelectionState),
|
|
150
|
+
...(props.sortingOptions || {}),
|
|
151
|
+
getSortedRowModel: getSortedRowModel(),
|
|
152
|
+
onSortingChange: updaterOrValue => valueUpdater(updaterOrValue, sortingState),
|
|
153
|
+
...(props.expandedOptions || {}),
|
|
154
|
+
getExpandedRowModel: getExpandedRowModel(),
|
|
155
|
+
onExpandedChange: updaterOrValue => valueUpdater(updaterOrValue, expandedState),
|
|
156
|
+
state: {
|
|
157
|
+
get globalFilter() {
|
|
158
|
+
return globalFilterState.value
|
|
159
|
+
},
|
|
160
|
+
get columnFilters() {
|
|
161
|
+
return columnFiltersState.value
|
|
162
|
+
},
|
|
163
|
+
get columnVisibility() {
|
|
164
|
+
return columnVisibilityState.value
|
|
165
|
+
},
|
|
166
|
+
get columnPinning() {
|
|
167
|
+
return columnPinningState.value
|
|
168
|
+
},
|
|
169
|
+
get expanded() {
|
|
170
|
+
return expandedState.value
|
|
171
|
+
},
|
|
172
|
+
get rowSelection() {
|
|
173
|
+
return rowSelectionState.value
|
|
174
|
+
},
|
|
175
|
+
get sorting() {
|
|
176
|
+
return sortingState.value
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
|
|
182
|
+
ref.value = typeof updaterOrValue === 'function' ? updaterOrValue(ref.value) : updaterOrValue
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
defineExpose({
|
|
186
|
+
tableApi
|
|
187
|
+
})
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<template>
|
|
191
|
+
<div :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
192
|
+
<table :class="ui.base({ class: [props.ui?.base] })">
|
|
193
|
+
<thead :class="ui.thead({ class: [props.ui?.thead] })">
|
|
194
|
+
<tr v-for="headerGroup in tableApi.getHeaderGroups()" :key="headerGroup.id" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
195
|
+
<th
|
|
196
|
+
v-for="header in headerGroup.headers"
|
|
197
|
+
:key="header.id"
|
|
198
|
+
:data-pinned="header.column.getIsPinned()"
|
|
199
|
+
:class="ui.th({ class: [props.ui?.th], pinned: !!header.column.getIsPinned() })"
|
|
200
|
+
>
|
|
201
|
+
<slot :name="`${header.id}-header`" v-bind="header.getContext()">
|
|
202
|
+
<FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.header" :props="header.getContext()" />
|
|
203
|
+
</slot>
|
|
204
|
+
</th>
|
|
205
|
+
</tr>
|
|
206
|
+
</thead>
|
|
207
|
+
|
|
208
|
+
<tbody :class="ui.tbody({ class: [props.ui?.tbody] })">
|
|
209
|
+
<template v-if="tableApi.getRowModel().rows?.length">
|
|
210
|
+
<template v-for="row in tableApi.getRowModel().rows" :key="row.id">
|
|
211
|
+
<tr :data-selected="row.getIsSelected()" :data-expanded="row.getIsExpanded()" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
212
|
+
<td
|
|
213
|
+
v-for="cell in row.getVisibleCells()"
|
|
214
|
+
:key="cell.id"
|
|
215
|
+
:data-pinned="cell.column.getIsPinned()"
|
|
216
|
+
:class="ui.td({ class: [props.ui?.td], pinned: !!cell.column.getIsPinned() })"
|
|
217
|
+
>
|
|
218
|
+
<slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
|
|
219
|
+
<FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
|
220
|
+
</slot>
|
|
221
|
+
</td>
|
|
222
|
+
</tr>
|
|
223
|
+
<tr v-if="row.getIsExpanded()" :class="ui.tr({ class: [props.ui?.tr] })">
|
|
224
|
+
<td :colspan="row.getAllCells().length" :class="ui.td({ class: [props.ui?.td] })">
|
|
225
|
+
<slot name="expanded" :row="row" />
|
|
226
|
+
</td>
|
|
227
|
+
</tr>
|
|
228
|
+
</template>
|
|
229
|
+
</template>
|
|
230
|
+
|
|
231
|
+
<tr v-else :class="ui.tr({ class: [props.ui?.tr] })">
|
|
232
|
+
<td :colspan="columns?.length" :class="ui.empty({ class: props.ui?.empty })">
|
|
233
|
+
<slot name="empty">
|
|
234
|
+
No results
|
|
235
|
+
</slot>
|
|
236
|
+
</td>
|
|
237
|
+
</tr>
|
|
238
|
+
</tbody>
|
|
239
|
+
</table>
|
|
240
|
+
</div>
|
|
241
|
+
</template>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<!-- eslint-disable vue/block-tag-newline -->
|
|
2
1
|
<script lang="ts">
|
|
3
2
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
|
-
import type { TabsRootProps, TabsRootEmits, TabsContentProps
|
|
3
|
+
import type { TabsRootProps, TabsRootEmits, TabsContentProps } from 'radix-vue'
|
|
5
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
6
5
|
import _appConfig from '#build/app.config'
|
|
7
6
|
import theme from '#build/ui/tabs'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
8
|
import type { AvatarProps } from '../types'
|
|
9
9
|
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme>
|
|
|
12
12
|
|
|
13
13
|
const tabs = tv({ extend: tv(theme), ...(appConfig.ui?.tabs || {}) })
|
|
14
14
|
|
|
15
|
-
export interface TabsItem
|
|
15
|
+
export interface TabsItem {
|
|
16
16
|
label?: string
|
|
17
17
|
icon?: string
|
|
18
18
|
avatar?: AvatarProps
|
|
@@ -20,6 +20,7 @@ export interface TabsItem extends Pick<TabsTriggerProps, 'disabled'> {
|
|
|
20
20
|
content?: string
|
|
21
21
|
/** A unique value for the tab item. Defaults to the index. */
|
|
22
22
|
value?: string | number
|
|
23
|
+
disabled?: boolean
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
type TabsVariants = VariantProps<typeof tabs>
|
|
@@ -44,6 +45,11 @@ export interface TabsProps<T> extends Pick<TabsRootProps<string | number>, 'defa
|
|
|
44
45
|
* @defaultValue true
|
|
45
46
|
*/
|
|
46
47
|
content?: boolean | Omit<TabsContentProps, 'as' | 'asChild' | 'value'>
|
|
48
|
+
/**
|
|
49
|
+
* The key used to get the label from the item.
|
|
50
|
+
* @defaultValue 'label'
|
|
51
|
+
*/
|
|
52
|
+
labelKey?: string
|
|
47
53
|
class?: any
|
|
48
54
|
ui?: PartialString<typeof tabs.slots>
|
|
49
55
|
}
|
|
@@ -59,6 +65,23 @@ export type TabsSlots<T extends { slot?: string }> = {
|
|
|
59
65
|
content: SlotProps<T>
|
|
60
66
|
} & DynamicSlots<T, SlotProps<T>>
|
|
61
67
|
|
|
68
|
+
extendDevtoolsMeta({
|
|
69
|
+
defaultProps: {
|
|
70
|
+
items: [{
|
|
71
|
+
label: 'Tab1',
|
|
72
|
+
avatar: { src: 'https://avatars.githubusercontent.com/u/739984?v=4' },
|
|
73
|
+
content: 'This is the content shown for Tab1'
|
|
74
|
+
}, {
|
|
75
|
+
label: 'Tab2',
|
|
76
|
+
icon: 'i-lucide-user',
|
|
77
|
+
content: 'And, this is the content for Tab2'
|
|
78
|
+
}, {
|
|
79
|
+
label: 'Tab3',
|
|
80
|
+
icon: 'i-lucide-bell',
|
|
81
|
+
content: 'Finally, this is the content for Tab3'
|
|
82
|
+
}]
|
|
83
|
+
}
|
|
84
|
+
})
|
|
62
85
|
</script>
|
|
63
86
|
|
|
64
87
|
<script setup lang="ts" generic="T extends TabsItem">
|
|
@@ -66,11 +89,15 @@ import { computed, toRef } from 'vue'
|
|
|
66
89
|
import { defu } from 'defu'
|
|
67
90
|
import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from 'radix-vue'
|
|
68
91
|
import { reactivePick } from '@vueuse/core'
|
|
92
|
+
import { get } from '../utils'
|
|
93
|
+
import UIcon from './Icon.vue'
|
|
94
|
+
import UAvatar from './Avatar.vue'
|
|
69
95
|
|
|
70
96
|
const props = withDefaults(defineProps<TabsProps<T>>(), {
|
|
71
97
|
content: true,
|
|
72
98
|
defaultValue: '0',
|
|
73
|
-
orientation: 'horizontal'
|
|
99
|
+
orientation: 'horizontal',
|
|
100
|
+
labelKey: 'label'
|
|
74
101
|
})
|
|
75
102
|
const emits = defineEmits<TabsEmits>()
|
|
76
103
|
const slots = defineSlots<TabsSlots<T>>()
|
|
@@ -93,12 +120,12 @@ const ui = computed(() => tabs({
|
|
|
93
120
|
|
|
94
121
|
<TabsTrigger v-for="(item, index) of items" :key="index" :value="item.value || String(index)" :disabled="item.disabled" :class="ui.trigger({ class: props.ui?.trigger })">
|
|
95
122
|
<slot name="leading" :item="item" :index="index">
|
|
96
|
-
<
|
|
97
|
-
<
|
|
123
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
124
|
+
<UAvatar v-else-if="item.avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
98
125
|
</slot>
|
|
99
126
|
|
|
100
|
-
<span v-if="item.
|
|
101
|
-
<slot :item="item" :index="index">{{ item.
|
|
127
|
+
<span v-if="get(item, props.labelKey as string) || !!slots.default" :class="ui.label({ class: props.ui?.label })">
|
|
128
|
+
<slot :item="item" :index="index">{{ get(item, props.labelKey as string) }}</slot>
|
|
102
129
|
</span>
|
|
103
130
|
|
|
104
131
|
<slot name="trailing" :item="item" :index="index" />
|
|
@@ -4,6 +4,7 @@ import type { ToastRootProps, ToastRootEmits } from 'radix-vue'
|
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/toast'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
import type { AvatarProps, ButtonProps } from '../types'
|
|
8
9
|
|
|
9
10
|
const appConfig = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }
|
|
@@ -53,6 +54,8 @@ export interface ToastSlots {
|
|
|
53
54
|
actions(props?: {}): any
|
|
54
55
|
close(props: { ui: any }): any
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
extendDevtoolsMeta<ToastProps>({ ignore: true })
|
|
56
59
|
</script>
|
|
57
60
|
|
|
58
61
|
<script setup lang="ts">
|
|
@@ -62,6 +65,7 @@ import { reactivePick } from '@vueuse/core'
|
|
|
62
65
|
import { useAppConfig } from '#imports'
|
|
63
66
|
import UIcon from './Icon.vue'
|
|
64
67
|
import UAvatar from './Avatar.vue'
|
|
68
|
+
import UButton from './Button.vue'
|
|
65
69
|
|
|
66
70
|
const props = withDefaults(defineProps<ToastProps>(), {
|
|
67
71
|
close: true
|
|
@@ -4,6 +4,7 @@ import type { ToastProviderProps } from 'radix-vue'
|
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/toaster'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
|
|
8
9
|
const appConfig = _appConfig as AppConfig & { ui: { toaster: Partial<typeof theme> } }
|
|
9
10
|
|
|
@@ -25,6 +26,12 @@ export interface ToasterProps extends Omit<ToastProviderProps, 'swipeDirection'>
|
|
|
25
26
|
export interface ToasterSlots {
|
|
26
27
|
default(props?: {}): any
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
name: 'Toaster'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
extendDevtoolsMeta({ example: 'ToasterExample' })
|
|
28
35
|
</script>
|
|
29
36
|
|
|
30
37
|
<script setup lang="ts">
|
|
@@ -32,8 +39,8 @@ import { ref, computed } from 'vue'
|
|
|
32
39
|
import { ToastProvider, ToastViewport, useForwardProps } from 'radix-vue'
|
|
33
40
|
import { reactivePick } from '@vueuse/core'
|
|
34
41
|
import { useToast } from '../composables/useToast'
|
|
35
|
-
import UToast from './Toast.vue'
|
|
36
42
|
import { omit } from '../utils'
|
|
43
|
+
import UToast from './Toast.vue'
|
|
37
44
|
|
|
38
45
|
const props = withDefaults(defineProps<ToasterProps>(), {
|
|
39
46
|
expand: true,
|
|
@@ -4,6 +4,7 @@ import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipAr
|
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/tooltip'
|
|
7
|
+
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
8
|
import type { KbdProps } from '../types'
|
|
8
9
|
|
|
9
10
|
const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
|
|
@@ -40,6 +41,8 @@ export interface TooltipSlots {
|
|
|
40
41
|
default(props: { open: boolean }): any
|
|
41
42
|
content(props?: {}): any
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
extendDevtoolsMeta({ example: 'TooltipExample', defaultProps: { text: 'Hello world!' } })
|
|
43
46
|
</script>
|
|
44
47
|
|
|
45
48
|
<script setup lang="ts">
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ref, computed, toValue } from "vue";
|
|
2
2
|
import { useEventListener, useActiveElement, useDebounceFn } from "@vueuse/core";
|
|
3
|
-
import { useKbd } from "../composables/useKbd.js";
|
|
4
3
|
const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/;
|
|
5
4
|
const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/;
|
|
6
5
|
export function extractShortcuts(items) {
|
|
@@ -9,7 +8,7 @@ export function extractShortcuts(items) {
|
|
|
9
8
|
items2.forEach((item) => {
|
|
10
9
|
if (item.kbds?.length && (item.select || item.click)) {
|
|
11
10
|
const shortcutKey = item.kbds.join("_");
|
|
12
|
-
shortcuts[shortcutKey] = item.
|
|
11
|
+
shortcuts[shortcutKey] = item.onSelect || item.onClick;
|
|
13
12
|
}
|
|
14
13
|
if (item.children) {
|
|
15
14
|
traverse(item.children.flat());
|
|
@@ -28,7 +27,6 @@ export function defineShortcuts(config, options = {}) {
|
|
|
28
27
|
chainedInputs.value.splice(0, chainedInputs.value.length);
|
|
29
28
|
};
|
|
30
29
|
const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800);
|
|
31
|
-
const { macOS } = useKbd();
|
|
32
30
|
const activeElement = useActiveElement();
|
|
33
31
|
const onKeyDown = (e) => {
|
|
34
32
|
if (!e.key) {
|
|
@@ -114,10 +112,6 @@ export function defineShortcuts(config, options = {}) {
|
|
|
114
112
|
};
|
|
115
113
|
}
|
|
116
114
|
shortcut.chained = chained;
|
|
117
|
-
if (!macOS.value && shortcut.metaKey && !shortcut.ctrlKey) {
|
|
118
|
-
shortcut.metaKey = false;
|
|
119
|
-
shortcut.ctrlKey = true;
|
|
120
|
-
}
|
|
121
115
|
if (typeof shortcutConfig === "function") {
|
|
122
116
|
shortcut.handler = shortcutConfig;
|
|
123
117
|
} else if (typeof shortcutConfig === "object") {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { AvatarProps } from '../types';
|
|
2
3
|
export interface UseComponentIconsProps {
|
|
3
4
|
/** Display an icon based on the `leading` and `trailing` props. */
|
|
4
5
|
icon?: string;
|
|
6
|
+
/** Display an avatar on the left side. */
|
|
7
|
+
avatar?: AvatarProps;
|
|
5
8
|
/** When `true`, the icon will be displayed on the left side. */
|
|
6
9
|
leading?: boolean;
|
|
7
10
|
/** Display an icon on the left side. */
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
type KbdKeysSpecificMap = {
|
|
2
|
+
meta: string;
|
|
3
|
+
alt: string;
|
|
4
|
+
ctrl: string;
|
|
5
|
+
};
|
|
1
6
|
export declare const kbdKeysMap: {
|
|
2
7
|
meta: string;
|
|
8
|
+
ctrl: string;
|
|
9
|
+
alt: string;
|
|
10
|
+
win: string;
|
|
3
11
|
command: string;
|
|
4
12
|
shift: string;
|
|
5
|
-
ctrl: string;
|
|
6
13
|
option: string;
|
|
7
|
-
alt: string;
|
|
8
14
|
enter: string;
|
|
9
15
|
delete: string;
|
|
10
16
|
backspace: string;
|
|
@@ -21,8 +27,9 @@ export declare const kbdKeysMap: {
|
|
|
21
27
|
end: string;
|
|
22
28
|
};
|
|
23
29
|
export type KbdKey = keyof typeof kbdKeysMap;
|
|
30
|
+
export type KbdKeySpecific = keyof KbdKeysSpecificMap;
|
|
24
31
|
export declare const useKbd: () => {
|
|
25
32
|
macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
|
|
26
|
-
metaSymbol: import("vue").Ref<string, string>;
|
|
27
33
|
getKbdKey: (value?: KbdKey | string) => string | undefined;
|
|
28
34
|
};
|
|
35
|
+
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { reactive, computed, onMounted } from "vue";
|
|
1
2
|
import { createSharedComposable } from "@vueuse/core";
|
|
2
|
-
import { ref, computed, onMounted } from "vue";
|
|
3
3
|
export const kbdKeysMap = {
|
|
4
4
|
meta: "",
|
|
5
|
+
ctrl: "",
|
|
6
|
+
alt: "",
|
|
7
|
+
win: "\u229E",
|
|
5
8
|
command: "\u2318",
|
|
6
9
|
shift: "\u21E7",
|
|
7
|
-
ctrl: "\u2303",
|
|
8
10
|
option: "\u2325",
|
|
9
|
-
alt: "\u2387",
|
|
10
11
|
enter: "\u21B5",
|
|
11
12
|
delete: "\u2326",
|
|
12
13
|
backspace: "\u232B",
|
|
@@ -24,22 +25,27 @@ export const kbdKeysMap = {
|
|
|
24
25
|
};
|
|
25
26
|
const _useKbd = () => {
|
|
26
27
|
const macOS = computed(() => import.meta.client && navigator && navigator.userAgent && navigator.userAgent.match(/Macintosh;/));
|
|
27
|
-
const
|
|
28
|
+
const kbdKeysSpecificMap = reactive({
|
|
29
|
+
meta: " ",
|
|
30
|
+
alt: " ",
|
|
31
|
+
ctrl: " "
|
|
32
|
+
});
|
|
28
33
|
onMounted(() => {
|
|
29
|
-
|
|
34
|
+
kbdKeysSpecificMap.meta = macOS.value ? kbdKeysMap.command : kbdKeysMap.win;
|
|
35
|
+
kbdKeysSpecificMap.alt = macOS.value ? kbdKeysMap.option : "alt";
|
|
36
|
+
kbdKeysSpecificMap.ctrl = macOS.value ? "\u2303" : "ctrl";
|
|
30
37
|
});
|
|
31
38
|
function getKbdKey(value) {
|
|
32
39
|
if (!value) {
|
|
33
40
|
return;
|
|
34
41
|
}
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
42
|
+
if (["meta", "alt", "ctrl"].includes(value)) {
|
|
43
|
+
return kbdKeysSpecificMap[value];
|
|
37
44
|
}
|
|
38
45
|
return kbdKeysMap[value] || value.toUpperCase();
|
|
39
46
|
}
|
|
40
47
|
return {
|
|
41
48
|
macOS,
|
|
42
|
-
metaSymbol,
|
|
43
49
|
getKbdKey
|
|
44
50
|
};
|
|
45
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ShallowRef, Component, InjectionKey } from 'vue';
|
|
2
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
2
3
|
import type { ModalProps } from '../types';
|
|
3
|
-
import type { ComponentProps } from '../types/component';
|
|
4
4
|
export interface ModalState {
|
|
5
5
|
component: Component | string;
|
|
6
6
|
props: ModalProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ShallowRef, Component, InjectionKey } from 'vue';
|
|
2
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
2
3
|
import type { SlideoverProps } from '../types';
|
|
3
|
-
import type { ComponentProps } from '../types/component';
|
|
4
4
|
export interface SlideoverState {
|
|
5
5
|
component: Component | string;
|
|
6
6
|
props: SlideoverProps;
|
package/dist/runtime/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@theme{--spacing-4_5:1.125rem}@variant dark (&:where(.dark, .dark *));@layer base{body{@apply antialiased
|
|
1
|
+
@import "./keyframes.css";@theme default{--spacing-4_5:1.125rem}@variant dark (&:where(.dark, .dark *));@layer base{body{@apply antialiased text-[var(--ui-text)] bg-[var(--ui-bg)]}:root{color-scheme:light;--ui-text-dimmed:var(--ui-color-neutral-400);--ui-text-muted:var(--ui-color-neutral-500);--ui-text-toned:var(--ui-color-neutral-600);--ui-text:var(--ui-color-neutral-700);--ui-text-highlighted:var(--ui-color-neutral-900);--ui-bg:var(--color-white);--ui-bg-elevated:var(--ui-color-neutral-100);--ui-bg-accented:var(--ui-color-neutral-200);--ui-bg-inverted:var(--ui-color-neutral-900);--ui-border:var(--ui-color-neutral-200);--ui-border-accented:var(--ui-color-neutral-300);--ui-border-inverted:var(--ui-color-neutral-900);--ui-radius:var(--radius)}.dark{color-scheme:dark;--ui-text-dimmed:var(--ui-color-neutral-500);--ui-text-muted:var(--ui-color-neutral-400);--ui-text-toned:var(--ui-color-neutral-300);--ui-text:var(--ui-color-neutral-200);--ui-text-highlighted:var(--color-white);--ui-bg:var(--ui-color-neutral-900);--ui-bg-elevated:var(--ui-color-neutral-800);--ui-bg-accented:var(--ui-color-neutral-700);--ui-bg-inverted:var(--color-white);--ui-border:var(--ui-color-neutral-800);--ui-border-accented:var(--ui-color-neutral-700);--ui-border-inverted:var(--color-white)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}@keyframes collapsible-up{0%{height:var(--radix-collapsible-content-height)}to{height:0}}@keyframes collapsible-down{0%{height:0}to{height:var(--radix-collapsible-content-height)}}@keyframes toast-collapsed-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--before) - var(--height))*var(--gap))) scale(var(--scale))}}@keyframes toast-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--offset) - var(--height))*var(--translate-factor)))}}@keyframes toast-slide-left{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(-100%) translateY(var(--translate))}}@keyframes toast-slide-right{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(100%) translateY(var(--translate))}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes slide-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes slide-in-from-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slide-out-to-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slide-in-from-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slide-out-to-bottom{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slide-in-from-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-out-to-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes slide-in-from-top-and-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-top-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes slide-in-from-right-and-fade{0%{opacity:0;transform:translateX(4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-right-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(4px)}}@keyframes slide-in-from-bottom-and-fade{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-out-to-bottom-and-fade{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}@keyframes slide-in-from-left-and-fade{0%{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-out-to-left-and-fade{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-4px)}}@keyframes enter-from-right{0%{opacity:0;transform:translateX(200px)}to{opacity:1;transform:translateX(0)}}@keyframes enter-from-left{0%{opacity:0;transform:translateX(-200px)}to{opacity:1;transform:translateX(0)}}@keyframes exit-to-right{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(200px)}}@keyframes exit-to-left{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-200px)}}@keyframes carousel{0%,to{width:50%}0%{transform:translateX(-100%)}to{transform:translateX(200%)}}@keyframes carousel-vertical{0%,to{height:50%}0%{transform:translateY(-100%)}to{transform:translateY(200%)}}@keyframes carousel-inverse{0%,to{width:50%}0%{transform:translateX(200%)}to{transform:translateX(-100%)}}@keyframes carousel-inverse-vertical{0%,to{height:50%}0%{transform:translateY(200%)}to{transform:translateY(-100%)}}@keyframes swing{0%,to{width:50%}0%,to{transform:translateX(-25%)}50%{transform:translateX(125%)}}@keyframes swing-vertical{0%,to{height:50%}0%,to{transform:translateY(-25%)}50%{transform:translateY(125%)}}@keyframes elastic{0%,to{margin-left:25%;width:50%}50%{margin-left:5%;width:90%}}@keyframes elastic-vertical{0%,to{height:50%;margin-top:25%}50%{height:90%;margin-top:5%}}
|
|
@@ -5,6 +5,7 @@ import type { Schema as JoiSchema } from 'joi';
|
|
|
5
5
|
import type { ObjectSchema as YupObjectSchema } from 'yup';
|
|
6
6
|
import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
|
|
7
7
|
import type { GetObjectField } from './utils';
|
|
8
|
+
import type { Struct as SuperstructSchema } from 'superstruct';
|
|
8
9
|
export interface Form<T> {
|
|
9
10
|
validate(opts?: {
|
|
10
11
|
name: string | string[];
|
|
@@ -18,7 +19,7 @@ export interface Form<T> {
|
|
|
18
19
|
submit(): Promise<void>;
|
|
19
20
|
disabled: ComputedRef<boolean>;
|
|
20
21
|
}
|
|
21
|
-
export type FormSchema<T extends Record<string, any>> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | StandardSchema;
|
|
22
|
+
export type FormSchema<T extends Record<string, any>> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchema;
|
|
22
23
|
export type FormInputEvents = 'input' | 'blur' | 'change';
|
|
23
24
|
export interface FormError<P extends string = string> {
|
|
24
25
|
name: P;
|
|
@@ -35,6 +35,7 @@ export * from '../components/Skeleton.vue';
|
|
|
35
35
|
export * from '../components/Slideover.vue';
|
|
36
36
|
export * from '../components/Slider.vue';
|
|
37
37
|
export * from '../components/Switch.vue';
|
|
38
|
+
export * from '../components/Table.vue';
|
|
38
39
|
export * from '../components/Tabs.vue';
|
|
39
40
|
export * from '../components/Textarea.vue';
|
|
40
41
|
export * from '../components/Toast.vue';
|
|
@@ -35,6 +35,7 @@ export * from "../components/Skeleton.vue";
|
|
|
35
35
|
export * from "../components/Slideover.vue";
|
|
36
36
|
export * from "../components/Slider.vue";
|
|
37
37
|
export * from "../components/Switch.vue";
|
|
38
|
+
export * from "../components/Table.vue";
|
|
38
39
|
export * from "../components/Tabs.vue";
|
|
39
40
|
export * from "../components/Textarea.vue";
|
|
40
41
|
export * from "../components/Toast.vue";
|
|
@@ -15,3 +15,10 @@ export type ArrayOrWrapped<T> = T extends any[] ? T : Array<T>;
|
|
|
15
15
|
export type PartialString<T> = {
|
|
16
16
|
[K in keyof T]?: string;
|
|
17
17
|
};
|
|
18
|
+
export type MaybeArrayOfArray<T> = T[] | T[][];
|
|
19
|
+
export type MaybeArrayOfArrayItem<I> = I extends Array<infer T> ? T extends Array<infer U> ? U : T : never;
|
|
20
|
+
export type SelectModelValue<T, V, M extends boolean = false, DV = T> = (T extends Record<string, any> ? V extends keyof T ? T[V] : DV : T) extends infer U ? M extends true ? U[] : U : never;
|
|
21
|
+
export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
22
|
+
export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
|
|
23
|
+
'update:modelValue': [payload: SelectModelValue<T, V, M, DV>];
|
|
24
|
+
};
|