@byyuurin/ui 0.0.11 → 0.2.0
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/README.md +170 -58
- package/dist/module.d.mts +4 -13
- package/dist/module.json +4 -4
- package/dist/module.mjs +54 -20
- package/dist/runtime/components/Accordion.vue +28 -23
- package/dist/runtime/components/Accordion.vue.d.ts +51 -29
- package/dist/runtime/components/Alert.vue +47 -27
- package/dist/runtime/components/Alert.vue.d.ts +37 -25
- package/dist/runtime/components/App.vue +9 -8
- package/dist/runtime/components/App.vue.d.ts +22 -20
- package/dist/runtime/components/Avatar.vue +65 -21
- package/dist/runtime/components/Avatar.vue.d.ts +27 -13
- package/dist/runtime/components/AvatarGroup.vue +14 -10
- package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
- package/dist/runtime/components/Badge.vue +64 -32
- package/dist/runtime/components/Badge.vue.d.ts +30 -29
- package/dist/runtime/components/Breadcrumb.vue +40 -22
- package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
- package/dist/runtime/components/Button.vue +113 -52
- package/dist/runtime/components/Button.vue.d.ts +36 -20
- package/dist/runtime/components/Calendar.vue +50 -43
- package/dist/runtime/components/Calendar.vue.d.ts +58 -31
- package/dist/runtime/components/Card.vue +18 -14
- package/dist/runtime/components/Card.vue.d.ts +18 -14
- package/dist/runtime/components/Carousel.vue +99 -46
- package/dist/runtime/components/Carousel.vue.d.ts +46 -25
- package/dist/runtime/components/Checkbox.vue +60 -35
- package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
- package/dist/runtime/components/CheckboxGroup.vue +131 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +89 -0
- package/dist/runtime/components/Chip.vue +35 -32
- package/dist/runtime/components/Chip.vue.d.ts +33 -15
- package/dist/runtime/components/Collapsible.vue +13 -9
- package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
- package/dist/runtime/components/Drawer.vue +80 -70
- package/dist/runtime/components/Drawer.vue.d.ts +51 -28
- package/dist/runtime/components/DropdownMenu.vue +23 -16
- package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
- package/dist/runtime/components/DropdownMenuContent.vue +136 -106
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
- package/dist/runtime/components/FieldGroup.vue +33 -0
- package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
- package/dist/runtime/components/Form.vue +172 -88
- package/dist/runtime/components/Form.vue.d.ts +69 -44
- package/dist/runtime/components/FormField.vue +108 -0
- package/dist/runtime/components/FormField.vue.d.ts +63 -0
- package/dist/runtime/components/Icon.vue +20 -0
- package/dist/runtime/components/Icon.vue.d.ts +9 -0
- package/dist/runtime/components/Input.vue +84 -79
- package/dist/runtime/components/Input.vue.d.ts +55 -43
- package/dist/runtime/components/InputNumber.vue +66 -52
- package/dist/runtime/components/InputNumber.vue.d.ts +50 -109
- package/dist/runtime/components/InputTags.vue +155 -0
- package/dist/runtime/components/InputTags.vue.d.ts +85 -0
- package/dist/runtime/components/Kbd.vue +11 -5
- package/dist/runtime/components/Kbd.vue.d.ts +17 -11
- package/dist/runtime/components/Link.vue +54 -197
- package/dist/runtime/components/Link.vue.d.ts +17 -17
- package/dist/runtime/components/LinkBase.vue +11 -33
- package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
- package/dist/runtime/components/Marquee.vue +38 -0
- package/dist/runtime/components/Marquee.vue.d.ts +54 -0
- package/dist/runtime/components/Modal.vue +53 -39
- package/dist/runtime/components/Modal.vue.d.ts +64 -34
- package/dist/runtime/components/NavigationMenu.vue +345 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +216 -0
- package/dist/runtime/components/OverlayProvider.vue +3 -3
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Pagination.vue +39 -47
- package/dist/runtime/components/Pagination.vue.d.ts +54 -31
- package/dist/runtime/components/PinInput.vue +46 -32
- package/dist/runtime/components/PinInput.vue.d.ts +40 -21
- package/dist/runtime/components/Popover.vue +33 -19
- package/dist/runtime/components/Popover.vue.d.ts +57 -32
- package/dist/runtime/components/Progress.vue +31 -26
- package/dist/runtime/components/Progress.vue.d.ts +32 -23
- package/dist/runtime/components/RadioGroup.vue +75 -48
- package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
- package/dist/runtime/components/ScrollArea.vue +33 -31
- package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
- package/dist/runtime/components/Select.vue +166 -76
- package/dist/runtime/components/Select.vue.d.ts +206 -65
- package/dist/runtime/components/Separator.vue +42 -16
- package/dist/runtime/components/Separator.vue.d.ts +35 -14
- package/dist/runtime/components/Skeleton.vue +18 -6
- package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
- package/dist/runtime/components/Slider.vue +42 -24
- package/dist/runtime/components/Slider.vue.d.ts +43 -27
- package/dist/runtime/components/Switch.vue +40 -31
- package/dist/runtime/components/Switch.vue.d.ts +36 -27
- package/dist/runtime/components/Table.vue +329 -79
- package/dist/runtime/components/Table.vue.d.ts +152 -66
- package/dist/runtime/components/Tabs.vue +70 -23
- package/dist/runtime/components/Tabs.vue.d.ts +61 -29
- package/dist/runtime/components/Textarea.vue +102 -54
- package/dist/runtime/components/Textarea.vue.d.ts +57 -41
- package/dist/runtime/components/Timeline.vue +102 -0
- package/dist/runtime/components/Timeline.vue.d.ts +74 -0
- package/dist/runtime/components/Toast.vue +84 -38
- package/dist/runtime/components/Toast.vue.d.ts +48 -27
- package/dist/runtime/components/ToastProvider.vue +31 -22
- package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
- package/dist/runtime/components/Tooltip.vue +33 -21
- package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
- package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
- package/dist/runtime/composables/defineShortcuts.js +129 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
- package/dist/runtime/composables/useAvatarGroup.js +10 -3
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
- package/dist/runtime/composables/useComponentIcons.js +4 -4
- package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
- package/dist/runtime/composables/useFieldGroup.js +14 -0
- package/dist/runtime/composables/useFormField.d.ts +62 -0
- package/dist/runtime/composables/useFormField.js +99 -0
- package/dist/runtime/composables/useKbd.d.ts +3 -2
- package/dist/runtime/composables/useKbd.js +3 -2
- package/dist/runtime/composables/useLocale.d.ts +68 -5
- package/dist/runtime/composables/useLocale.js +11 -11
- package/dist/runtime/composables/useOverlay.d.ts +51 -15
- package/dist/runtime/composables/useOverlay.js +44 -30
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/composables/useToast.d.ts +12 -5
- package/dist/runtime/composables/useToast.js +12 -7
- package/dist/runtime/locale/en.d.ts +30 -1
- package/dist/runtime/locale/en.js +2 -1
- package/dist/runtime/locale/index.d.ts +2 -2
- package/dist/runtime/locale/index.js +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +31 -0
- package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.js +50 -0
- package/dist/runtime/types/app.config.d.ts +6 -0
- package/dist/runtime/types/form.d.ts +58 -17
- package/dist/runtime/types/form.js +11 -0
- package/dist/runtime/types/index.d.ts +56 -8
- package/dist/runtime/types/index.js +49 -1
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/locale.d.ts +5 -0
- package/dist/runtime/types/style.d.ts +33 -0
- package/dist/runtime/types/style.js +0 -0
- package/dist/runtime/types/unocss.d.ts +4 -0
- package/dist/runtime/types/utils.d.ts +41 -37
- package/dist/runtime/utils/form.d.ts +5 -1
- package/dist/runtime/utils/form.js +49 -0
- package/dist/runtime/utils/index.d.ts +10 -13
- package/dist/runtime/utils/index.js +41 -48
- package/dist/runtime/utils/link.d.ts +3 -2
- package/dist/runtime/utils/link.js +16 -2
- package/dist/runtime/utils/locale.d.ts +5 -0
- package/dist/runtime/utils/locale.js +10 -0
- package/dist/runtime/utils/style.d.ts +94 -0
- package/dist/runtime/utils/style.js +37 -0
- package/dist/runtime/vue/components/Icon.vue +15 -0
- package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
- package/dist/runtime/vue/components/Link.vue +163 -0
- package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +4 -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 +9 -0
- package/dist/runtime/vue/stubs.d.ts +16 -1
- package/dist/runtime/vue/stubs.js +32 -1
- package/dist/setup.d.mts +13 -0
- package/dist/setup.mjs +12 -0
- package/dist/shared/ui.CzIlLITK.mjs +51 -0
- package/dist/shared/ui.DLOxhmP0.mjs +4242 -0
- package/dist/shared/ui.DpbffTXs.d.mts +84 -0
- package/dist/shared/ui.IulR-OYx.d.mts +64 -0
- package/dist/types.d.mts +3 -1
- package/dist/unocss.d.mts +12 -52
- package/dist/unocss.mjs +144 -254
- package/dist/unplugin.d.mts +13 -26
- package/dist/unplugin.mjs +193 -18
- package/dist/vite.d.mts +10 -1
- package/dist/vite.mjs +12 -3
- package/package.json +154 -87
- package/vue-plugin.d.ts +5 -0
- package/dist/module.d.ts +0 -13
- package/dist/module.mjs.map +0 -1
- package/dist/runtime/app/injections.d.ts +0 -9331
- package/dist/runtime/app/injections.js +0 -61
- package/dist/runtime/components/ButtonGroup.vue +0 -26
- package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
- package/dist/runtime/components/FormItem.vue +0 -90
- package/dist/runtime/components/FormItem.vue.d.ts +0 -60
- package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
- package/dist/runtime/composables/useButtonGroup.js +0 -9
- package/dist/runtime/composables/useFormItem.d.ts +0 -27
- package/dist/runtime/composables/useFormItem.js +0 -64
- package/dist/runtime/composables/useTheme.d.ts +0 -9
- package/dist/runtime/composables/useTheme.js +0 -23
- package/dist/runtime/index.d.ts +0 -44
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/locale/zh-tw.d.ts +0 -2
- package/dist/runtime/theme/accordion.d.ts +0 -50
- package/dist/runtime/theme/accordion.js +0 -28
- package/dist/runtime/theme/alert.d.ts +0 -119
- package/dist/runtime/theme/alert.js +0 -47
- package/dist/runtime/theme/app.d.ts +0 -19
- package/dist/runtime/theme/app.js +0 -19
- package/dist/runtime/theme/avatar-group.d.ts +0 -46
- package/dist/runtime/theme/avatar-group.js +0 -32
- package/dist/runtime/theme/avatar.d.ts +0 -50
- package/dist/runtime/theme/avatar.js +0 -34
- package/dist/runtime/theme/badge.d.ts +0 -76
- package/dist/runtime/theme/badge.js +0 -92
- package/dist/runtime/theme/breadcrumb.d.ts +0 -61
- package/dist/runtime/theme/breadcrumb.js +0 -44
- package/dist/runtime/theme/button-group.d.ts +0 -60
- package/dist/runtime/theme/button-group.js +0 -42
- package/dist/runtime/theme/button.d.ts +0 -184
- package/dist/runtime/theme/button.js +0 -164
- package/dist/runtime/theme/calendar.d.ts +0 -58
- package/dist/runtime/theme/calendar.js +0 -86
- package/dist/runtime/theme/card.d.ts +0 -56
- package/dist/runtime/theme/card.js +0 -37
- package/dist/runtime/theme/carousel.d.ts +0 -107
- package/dist/runtime/theme/carousel.js +0 -43
- package/dist/runtime/theme/checkbox.d.ts +0 -82
- package/dist/runtime/theme/checkbox.js +0 -54
- package/dist/runtime/theme/chip.d.ts +0 -61
- package/dist/runtime/theme/chip.js +0 -66
- package/dist/runtime/theme/collapsible.d.ts +0 -32
- package/dist/runtime/theme/collapsible.js +0 -10
- package/dist/runtime/theme/drawer.d.ts +0 -142
- package/dist/runtime/theme/drawer.js +0 -113
- package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
- package/dist/runtime/theme/dropdown-menu.js +0 -83
- package/dist/runtime/theme/form-item.d.ts +0 -70
- package/dist/runtime/theme/form-item.js +0 -34
- package/dist/runtime/theme/form.d.ts +0 -2
- package/dist/runtime/theme/form.js +0 -7
- package/dist/runtime/theme/index.d.ts +0 -41
- package/dist/runtime/theme/index.js +0 -41
- package/dist/runtime/theme/input-number.d.ts +0 -115
- package/dist/runtime/theme/input-number.js +0 -95
- package/dist/runtime/theme/input.d.ts +0 -172
- package/dist/runtime/theme/input.js +0 -151
- package/dist/runtime/theme/kbd.d.ts +0 -33
- package/dist/runtime/theme/kbd.js +0 -26
- package/dist/runtime/theme/link.d.ts +0 -38
- package/dist/runtime/theme/link.js +0 -26
- package/dist/runtime/theme/modal.d.ts +0 -42
- package/dist/runtime/theme/modal.js +0 -55
- package/dist/runtime/theme/pagination.d.ts +0 -74
- package/dist/runtime/theme/pagination.js +0 -17
- package/dist/runtime/theme/pinInput.d.ts +0 -94
- package/dist/runtime/theme/pinInput.js +0 -111
- package/dist/runtime/theme/popover.d.ts +0 -32
- package/dist/runtime/theme/popover.js +0 -13
- package/dist/runtime/theme/progress.d.ts +0 -180
- package/dist/runtime/theme/progress.js +0 -95
- package/dist/runtime/theme/radio-group.d.ts +0 -104
- package/dist/runtime/theme/radio-group.js +0 -61
- package/dist/runtime/theme/scroll-area.d.ts +0 -67
- package/dist/runtime/theme/scroll-area.js +0 -33
- package/dist/runtime/theme/select.d.ts +0 -186
- package/dist/runtime/theme/select.js +0 -173
- package/dist/runtime/theme/separator.d.ts +0 -74
- package/dist/runtime/theme/separator.js +0 -53
- package/dist/runtime/theme/skeleton.d.ts +0 -2
- package/dist/runtime/theme/skeleton.js +0 -7
- package/dist/runtime/theme/slider.d.ts +0 -70
- package/dist/runtime/theme/slider.js +0 -52
- package/dist/runtime/theme/switch.d.ts +0 -116
- package/dist/runtime/theme/switch.js +0 -78
- package/dist/runtime/theme/table.d.ts +0 -86
- package/dist/runtime/theme/table.js +0 -36
- package/dist/runtime/theme/tabs.d.ts +0 -129
- package/dist/runtime/theme/tabs.js +0 -146
- package/dist/runtime/theme/textarea.d.ts +0 -90
- package/dist/runtime/theme/textarea.js +0 -116
- package/dist/runtime/theme/toast-provider.d.ts +0 -116
- package/dist/runtime/theme/toast-provider.js +0 -97
- package/dist/runtime/theme/toast.d.ts +0 -83
- package/dist/runtime/theme/toast.js +0 -35
- package/dist/runtime/theme/tooltip.d.ts +0 -38
- package/dist/runtime/theme/tooltip.js +0 -11
- package/dist/runtime/types/components.d.ts +0 -42
- package/dist/runtime/utils/extend-theme.d.ts +0 -9
- package/dist/runtime/utils/extend-theme.js +0 -27
- package/dist/runtime/utils/styler.d.ts +0 -4
- package/dist/runtime/utils/styler.js +0 -10
- package/dist/runtime/utils/translator.d.ts +0 -18
- package/dist/runtime/utils/translator.js +0 -8
- package/dist/shared/ui.D1BTWZFB.mjs +0 -5
- package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
- package/dist/unocss.d.ts +0 -52
- package/dist/unocss.mjs.map +0 -1
- package/dist/unplugin.d.ts +0 -26
- package/dist/unplugin.mjs.map +0 -1
- package/dist/vite.d.ts +0 -9
- package/dist/vite.mjs.map +0 -1
- /package/dist/runtime/types/{components.js → input.js} +0 -0
|
@@ -1,27 +1,48 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { Cell, Header, RowData, TableMeta } from '@tanstack/table-core';
|
|
3
|
+
import type { CellContext, ColumnDef, ColumnFiltersOptions, ColumnFiltersState, ColumnOrderState, ColumnPinningOptions, ColumnPinningState, ColumnSizingInfoState, ColumnSizingOptions, ColumnSizingState, CoreOptions, ExpandedOptions, ExpandedState, FacetedOptions, GlobalFilterOptions, GroupingOptions, GroupingState, HeaderContext, PaginationOptions, PaginationState, Row, RowPinningOptions, RowPinningState, RowSelectionOptions, RowSelectionState, SortingOptions, SortingState, VisibilityOptions, VisibilityState } from '@tanstack/vue-table';
|
|
4
|
+
import type { VirtualizerOptions } from '@tanstack/vue-virtual';
|
|
2
5
|
import type { PrimitiveProps } from 'reka-ui';
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
import type { WatchOptions } from 'vue';
|
|
7
|
+
import theme from '#build/ui/table';
|
|
8
|
+
import type { ComponentBaseProps, ComponentUIProps } from '../types';
|
|
9
|
+
import type { MaybeNull, StaticSlot } from '../types/utils';
|
|
10
|
+
declare module '@tanstack/table-core' {
|
|
11
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
12
|
+
class?: {
|
|
13
|
+
th?: string | ((cell: Header<TData, TValue>) => string);
|
|
14
|
+
td?: string | ((cell: Cell<TData, TValue>) => string);
|
|
15
|
+
};
|
|
16
|
+
style?: {
|
|
17
|
+
th?: string | Record<string, string> | ((cell: Header<TData, TValue>) => string | Record<string, string>);
|
|
18
|
+
td?: string | Record<string, string> | ((cell: Cell<TData, TValue>) => string | Record<string, string>);
|
|
19
|
+
};
|
|
20
|
+
colspan?: {
|
|
21
|
+
td?: string | ((cell: Cell<TData, TValue>) => string);
|
|
22
|
+
};
|
|
23
|
+
rowspan?: {
|
|
24
|
+
td?: string | ((cell: Cell<TData, TValue>) => string);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface TableMeta<TData> {
|
|
28
|
+
class?: {
|
|
29
|
+
tr?: string | ((row: Row<TData>) => string);
|
|
30
|
+
};
|
|
31
|
+
style?: {
|
|
32
|
+
tr?: string | Record<string, string> | ((row: Row<TData>) => string | Record<string, string>);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export type TableRow<T> = Row<T>;
|
|
15
37
|
export type TableData = RowData;
|
|
16
|
-
export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
38
|
+
export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D>;
|
|
39
|
+
export interface TableOptions<T extends TableData = TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
20
40
|
state?: CoreOptions<T>['state'];
|
|
21
41
|
onStateChange?: CoreOptions<T>['onStateChange'];
|
|
22
42
|
renderFallbackValue?: CoreOptions<T>['renderFallbackValue'];
|
|
23
43
|
}
|
|
24
|
-
|
|
44
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
45
|
+
export interface TableProps<T extends TableData = TableData> extends ComponentBaseProps, TableOptions<T> {
|
|
25
46
|
/**
|
|
26
47
|
* The element or component this component should render as.
|
|
27
48
|
* @default "div"
|
|
@@ -30,95 +51,143 @@ export interface TableProps<T extends TableData> extends ComponentAttrs<typeof t
|
|
|
30
51
|
data?: T[];
|
|
31
52
|
columns?: TableColumn<T>[];
|
|
32
53
|
caption?: string;
|
|
54
|
+
meta?: TableMeta<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Enable virtualization for large datasets.
|
|
57
|
+
*
|
|
58
|
+
* Note: when enabled, the divider between rows and sticky properties are not supported.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
virtualize?: boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, 'getScrollElement' | 'count' | 'estimateSize' | 'overscan'>> & {
|
|
62
|
+
/**
|
|
63
|
+
* Number of items rendered outside the visible area
|
|
64
|
+
* @default 12
|
|
65
|
+
*/
|
|
66
|
+
overscan?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Estimated size (in px) of each item
|
|
69
|
+
* @default 65
|
|
70
|
+
*/
|
|
71
|
+
estimateSize?: number;
|
|
72
|
+
});
|
|
33
73
|
/**
|
|
34
74
|
* The text to display when the table is empty.
|
|
35
75
|
* @default t('table.noData')
|
|
36
76
|
*/
|
|
37
77
|
empty?: string;
|
|
38
78
|
/**
|
|
39
|
-
* Whether the table should have a sticky header.
|
|
79
|
+
* Whether the table should have a sticky header or footer. True for both, 'header' for header only, 'footer' for footer only.
|
|
80
|
+
*
|
|
81
|
+
* Note: this prop is not supported when `virtualize` is true.
|
|
40
82
|
* @default false
|
|
41
83
|
*/
|
|
42
|
-
sticky?: boolean;
|
|
84
|
+
sticky?: boolean | 'header' | 'footer';
|
|
43
85
|
/** Whether the table should be in loading state. */
|
|
44
86
|
loading?: boolean;
|
|
87
|
+
/** @default "primary" */
|
|
88
|
+
loadingColor?: ThemeVariants['loadingColor'];
|
|
89
|
+
/** @default "carousel" */
|
|
90
|
+
loadingAnimation?: ThemeVariants['loadingAnimation'];
|
|
91
|
+
globalFilter?: string;
|
|
92
|
+
columnFilters?: ColumnFiltersState;
|
|
93
|
+
columnOrder?: ColumnOrderState;
|
|
94
|
+
columnVisibility?: VisibilityState;
|
|
95
|
+
columnPinning?: ColumnPinningState;
|
|
96
|
+
columnSizing?: ColumnSizingState;
|
|
97
|
+
columnSizingInfo?: ColumnSizingInfoState;
|
|
98
|
+
rowSelection?: RowSelectionState;
|
|
99
|
+
rowPinning?: RowPinningState;
|
|
100
|
+
sorting?: SortingState;
|
|
101
|
+
grouping?: GroupingState;
|
|
102
|
+
expanded?: ExpandedState;
|
|
103
|
+
pagination?: PaginationState;
|
|
104
|
+
/**
|
|
105
|
+
* Use the `watchOptions` prop to customize reactivity (for ex: disable deep watching for changes in your data or limiting the max traversal depth). This can improve performance by reducing unnecessary re-renders, but it should be used with caution as it may lead to unexpected behavior if not managed properly.
|
|
106
|
+
* @see [API](https://vuejs.org/api/options-state.html#watch)
|
|
107
|
+
* @see [Guide](https://vuejs.org/guide/essentials/watchers.html)
|
|
108
|
+
* @default { deep: true }
|
|
109
|
+
*/
|
|
110
|
+
watchOptions?: WatchOptions;
|
|
45
111
|
/**
|
|
46
|
-
* @
|
|
47
|
-
* @
|
|
112
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
|
|
113
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
|
|
48
114
|
*/
|
|
49
115
|
globalFilterOptions?: Omit<GlobalFilterOptions<T>, 'onGlobalFilterChange'>;
|
|
50
116
|
/**
|
|
51
|
-
* @
|
|
52
|
-
* @
|
|
117
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
|
|
118
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
53
119
|
*/
|
|
54
120
|
columnFiltersOptions?: Omit<ColumnFiltersOptions<T>, 'getFilteredRowModel' | 'onColumnFiltersChange'>;
|
|
55
121
|
/**
|
|
56
|
-
* @
|
|
57
|
-
* @
|
|
122
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
|
|
123
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
|
|
58
124
|
*/
|
|
59
125
|
columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>;
|
|
60
126
|
/**
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
127
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/column-sizing#table-options)
|
|
128
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
|
|
63
129
|
*/
|
|
64
130
|
columnSizingOptions?: Omit<ColumnSizingOptions, 'onColumnSizingChange' | 'onColumnSizingInfoChange'>;
|
|
65
131
|
/**
|
|
66
|
-
* @
|
|
67
|
-
* @
|
|
132
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
|
|
133
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
|
|
68
134
|
*/
|
|
69
135
|
visibilityOptions?: Omit<VisibilityOptions, 'onColumnVisibilityChange'>;
|
|
70
136
|
/**
|
|
71
|
-
* @
|
|
72
|
-
* @
|
|
137
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
|
|
138
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
|
|
73
139
|
*/
|
|
74
140
|
sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>;
|
|
75
141
|
/**
|
|
76
|
-
* @
|
|
77
|
-
* @
|
|
142
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/grouping#table-options)
|
|
143
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
|
|
78
144
|
*/
|
|
79
145
|
groupingOptions?: Omit<GroupingOptions, 'onGroupingChange'>;
|
|
80
146
|
/**
|
|
81
|
-
* @
|
|
82
|
-
* @
|
|
147
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
|
|
148
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
|
|
83
149
|
*/
|
|
84
150
|
expandedOptions?: Omit<ExpandedOptions<T>, 'getExpandedRowModel' | 'onExpandedChange'>;
|
|
85
151
|
/**
|
|
86
|
-
* @
|
|
87
|
-
* @
|
|
152
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
|
|
153
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
|
|
88
154
|
*/
|
|
89
155
|
rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>;
|
|
90
156
|
/**
|
|
91
|
-
* @
|
|
92
|
-
* @
|
|
157
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/row-pinning#table-options)
|
|
158
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)
|
|
93
159
|
*/
|
|
94
160
|
rowPinningOptions?: Omit<RowPinningOptions<T>, 'onRowPinningChange'>;
|
|
95
161
|
/**
|
|
96
|
-
* @
|
|
97
|
-
* @
|
|
162
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/pagination#table-options)
|
|
163
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/pagination)
|
|
98
164
|
*/
|
|
99
165
|
paginationOptions?: Omit<PaginationOptions, 'onPaginationChange'>;
|
|
100
166
|
/**
|
|
101
|
-
* @
|
|
102
|
-
* @
|
|
167
|
+
* @see [API](https://tanstack.com/table/v8/docs/api/features/column-faceting#table-options)
|
|
168
|
+
* @see [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
|
|
103
169
|
*/
|
|
104
170
|
facetedOptions?: FacetedOptions<T>;
|
|
171
|
+
onSelect?: (e: Event, row: TableRow<T>) => void;
|
|
172
|
+
onHover?: (e: Event, row: MaybeNull<TableRow<T>>) => void;
|
|
173
|
+
onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
|
|
174
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
105
175
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:globalFilter" | "onUpdate:columnFilters" | "onUpdate:columnOrder" | "onUpdate:columnVisibility" | "onUpdate:columnPinning" | "onUpdate:columnSizing" | "onUpdate:columnSizingInfo" | "onUpdate:rowSelection" | "onUpdate:rowPinning" | "onUpdate:sorting" | "onUpdate:grouping" | "onUpdate:expanded" | "onUpdate:pagination"> & (TableProps<T> & {
|
|
176
|
+
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>;
|
|
177
|
+
type DynamicFooterSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-footer`, (props: HeaderContext<T, unknown>) => any>;
|
|
178
|
+
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>;
|
|
179
|
+
export type TableSlots<T> = {
|
|
180
|
+
'expanded': StaticSlot<{
|
|
181
|
+
row: Row<T>;
|
|
182
|
+
}>;
|
|
183
|
+
'empty': StaticSlot;
|
|
184
|
+
'loading': StaticSlot;
|
|
185
|
+
'caption': StaticSlot;
|
|
186
|
+
'body-top': StaticSlot;
|
|
187
|
+
'body-bottom': StaticSlot;
|
|
188
|
+
} & DynamicHeaderSlots<T> & DynamicFooterSlots<T> & DynamicCellSlots<T>;
|
|
189
|
+
declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
190
|
+
props: __VLS_PrettifyLocal<(TableProps<T> & {
|
|
122
191
|
globalFilter?: string;
|
|
123
192
|
columnFilters?: ColumnFiltersState;
|
|
124
193
|
columnOrder?: ColumnOrderState;
|
|
@@ -132,17 +201,34 @@ declare const _default: <T extends TableData>(__VLS_props: NonNullable<Awaited<t
|
|
|
132
201
|
grouping?: GroupingState;
|
|
133
202
|
expanded?: ExpandedState;
|
|
134
203
|
pagination?: PaginationState;
|
|
135
|
-
}) &
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
204
|
+
}) & {
|
|
205
|
+
"onUpdate:globalFilter"?: ((value: string | undefined) => any) | undefined;
|
|
206
|
+
"onUpdate:columnFilters"?: ((value: ColumnFiltersState | undefined) => any) | undefined;
|
|
207
|
+
"onUpdate:columnOrder"?: ((value: ColumnOrderState | undefined) => any) | undefined;
|
|
208
|
+
"onUpdate:columnVisibility"?: ((value: VisibilityState | undefined) => any) | undefined;
|
|
209
|
+
"onUpdate:columnPinning"?: ((value: ColumnPinningState | undefined) => any) | undefined;
|
|
210
|
+
"onUpdate:columnSizing"?: ((value: ColumnSizingState | undefined) => any) | undefined;
|
|
211
|
+
"onUpdate:columnSizingInfo"?: ((value: ColumnSizingInfoState | undefined) => any) | undefined;
|
|
212
|
+
"onUpdate:rowSelection"?: ((value: RowSelectionState | undefined) => any) | undefined;
|
|
213
|
+
"onUpdate:rowPinning"?: ((value: RowPinningState | undefined) => any) | undefined;
|
|
214
|
+
"onUpdate:sorting"?: ((value: SortingState | undefined) => any) | undefined;
|
|
215
|
+
"onUpdate:grouping"?: ((value: GroupingState | undefined) => any) | undefined;
|
|
216
|
+
"onUpdate:expanded"?: ((value: ExpandedState | undefined) => any) | undefined;
|
|
217
|
+
"onUpdate:pagination"?: ((value: PaginationState | undefined) => any) | undefined;
|
|
218
|
+
}> & import("vue").PublicProps;
|
|
219
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
220
|
+
readonly $el: any;
|
|
221
|
+
tableRef: import("vue").ShallowRef<MaybeNull<HTMLTableElement>, MaybeNull<HTMLTableElement>>;
|
|
222
|
+
tableApi: import("@tanstack/table-core").Table<T>;
|
|
223
|
+
}>) => void;
|
|
139
224
|
attrs: any;
|
|
140
225
|
slots: TableSlots<T>;
|
|
141
|
-
emit: ((evt: "update:globalFilter", value: string) => void) & ((evt: "update:columnFilters", value: ColumnFiltersState) => void) & ((evt: "update:columnOrder", value: ColumnOrderState) => void) & ((evt: "update:columnVisibility", value: VisibilityState) => void) & ((evt: "update:columnPinning", value: ColumnPinningState) => void) & ((evt: "update:columnSizing", value: ColumnSizingState) => void) & ((evt: "update:columnSizingInfo", value: ColumnSizingInfoState) => void) & ((evt: "update:rowSelection", value: RowSelectionState) => void) & ((evt: "update:rowPinning", value: RowPinningState) => void) & ((evt: "update:sorting", value: SortingState) => void) & ((evt: "update:grouping", value: GroupingState) => void) & ((evt: "update:expanded", value: ExpandedState) => void) & ((evt: "update:pagination", value: PaginationState) => void);
|
|
226
|
+
emit: ((evt: "update:globalFilter", value: string | undefined) => void) & ((evt: "update:columnFilters", value: ColumnFiltersState | undefined) => void) & ((evt: "update:columnOrder", value: ColumnOrderState | undefined) => void) & ((evt: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((evt: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((evt: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((evt: "update:columnSizingInfo", value: ColumnSizingInfoState | undefined) => void) & ((evt: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((evt: "update:rowPinning", value: RowPinningState | undefined) => void) & ((evt: "update:sorting", value: SortingState | undefined) => void) & ((evt: "update:grouping", value: GroupingState | undefined) => void) & ((evt: "update:expanded", value: ExpandedState | undefined) => void) & ((evt: "update:pagination", value: PaginationState | undefined) => void);
|
|
142
227
|
}>) => import("vue").VNode & {
|
|
143
228
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
144
229
|
};
|
|
230
|
+
declare const _default: typeof __VLS_export;
|
|
145
231
|
export default _default;
|
|
146
232
|
type __VLS_PrettifyLocal<T> = {
|
|
147
|
-
[K in keyof T]: T[K];
|
|
233
|
+
[K in keyof T as K]: T[K];
|
|
148
234
|
} & {};
|
|
@@ -1,70 +1,117 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
2
|
+
import theme from "#build/ui/tabs";
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { reactivePick } from "@vueuse/core";
|
|
7
7
|
import { TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger, useForwardPropsEmits } from "reka-ui";
|
|
8
|
-
import { computed } from "vue";
|
|
9
|
-
import {
|
|
8
|
+
import { computed, ref } from "vue";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
10
|
import { get } from "../utils";
|
|
11
|
+
import { cv, merge } from "../utils/style";
|
|
12
|
+
import Avatar from "./Avatar.vue";
|
|
13
|
+
import Badge from "./Badge.vue";
|
|
14
|
+
import Icon from "./Icon.vue";
|
|
11
15
|
const props = defineProps({
|
|
12
16
|
as: { type: null, required: false },
|
|
13
17
|
items: { type: Array, required: false },
|
|
14
|
-
variant: { type: null, required: false
|
|
18
|
+
variant: { type: null, required: false },
|
|
15
19
|
orientation: { type: null, required: false, default: "horizontal" },
|
|
20
|
+
color: { type: null, required: false },
|
|
16
21
|
size: { type: null, required: false },
|
|
17
|
-
evenly: { type: Boolean, required: false, default: true },
|
|
18
22
|
content: { type: Boolean, required: false, default: true },
|
|
19
|
-
labelKey: { type:
|
|
20
|
-
class: { type: null, required: false },
|
|
23
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
21
24
|
ui: { type: null, required: false },
|
|
25
|
+
class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
|
|
22
26
|
defaultValue: { type: [String, Number], required: false, default: "0" },
|
|
23
27
|
modelValue: { type: [String, Number], required: false },
|
|
24
28
|
activationMode: { type: String, required: false },
|
|
25
|
-
unmountOnHide: { type: Boolean, required: false }
|
|
29
|
+
unmountOnHide: { type: Boolean, required: false, default: true }
|
|
26
30
|
});
|
|
27
31
|
const emit = defineEmits(["update:modelValue"]);
|
|
28
32
|
const slots = defineSlots();
|
|
29
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "
|
|
30
|
-
const
|
|
31
|
-
const
|
|
33
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "unmountOnHide"), emit);
|
|
34
|
+
const appConfig = useAppConfig();
|
|
35
|
+
const ui = computed(() => {
|
|
36
|
+
const styler = cv(merge(theme, appConfig.ui.tabs));
|
|
37
|
+
return styler(props);
|
|
38
|
+
});
|
|
39
|
+
const triggersRef = ref([]);
|
|
40
|
+
defineExpose({
|
|
41
|
+
triggersRef
|
|
42
|
+
});
|
|
32
43
|
</script>
|
|
33
44
|
|
|
34
45
|
<template>
|
|
35
|
-
<TabsRoot
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
<TabsRoot
|
|
47
|
+
v-bind="rootProps"
|
|
48
|
+
:model-value="props.modelValue"
|
|
49
|
+
:default-value="props.defaultValue"
|
|
50
|
+
:orientation="props.orientation"
|
|
51
|
+
:activation-mode="props.activationMode"
|
|
52
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
53
|
+
data-part="root"
|
|
54
|
+
>
|
|
55
|
+
<TabsList :class="ui.list({ class: props.ui?.list })" data-part="list">
|
|
56
|
+
<TabsIndicator :class="ui.indicator({ class: props.ui?.indicator })" data-part="indicator" />
|
|
57
|
+
|
|
58
|
+
<slot name="list-leading">
|
|
59
|
+
</slot>
|
|
38
60
|
|
|
39
61
|
<TabsTrigger
|
|
40
62
|
v-for="(item, index) of items"
|
|
63
|
+
:ref="(el) => triggersRef[index] = el"
|
|
41
64
|
:key="index"
|
|
42
|
-
:value="item.value
|
|
65
|
+
:value="item.value ?? String(index)"
|
|
43
66
|
:disabled="item.disabled"
|
|
44
|
-
:class="
|
|
67
|
+
:class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger] })"
|
|
45
68
|
data-part="trigger"
|
|
46
69
|
>
|
|
47
|
-
<slot name="leading" :item="item" :index="index">
|
|
48
|
-
<
|
|
70
|
+
<slot name="leading" :item="item" :index="index" :ui="ui">
|
|
71
|
+
<Icon
|
|
72
|
+
v-if="item.icon"
|
|
73
|
+
:name="item.icon"
|
|
74
|
+
:class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })"
|
|
75
|
+
data-part="leadingIcon"
|
|
76
|
+
/>
|
|
77
|
+
<Avatar
|
|
78
|
+
v-else-if="item.avatar"
|
|
79
|
+
:size="item.ui?.leadingAvatarSize || props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
80
|
+
v-bind="item.avatar"
|
|
81
|
+
:class="ui.leadingAvatar({ class: [props.ui?.leadingAvatar, item.ui?.leadingAvatar] })"
|
|
82
|
+
data-part="leadingAvatar"
|
|
83
|
+
/>
|
|
49
84
|
</slot>
|
|
50
85
|
|
|
51
|
-
<span v-if="get(item, props.labelKey) || slots.default" :class="
|
|
86
|
+
<span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })" data-part="label">
|
|
52
87
|
<slot :item="item" :index="index">{{ get(item, props.labelKey) }}</slot>
|
|
53
88
|
</span>
|
|
54
89
|
|
|
55
|
-
<slot name="trailing" :item="item" :index="index"
|
|
90
|
+
<slot name="trailing" :item="item" :index="index" :ui="ui">
|
|
91
|
+
<Badge
|
|
92
|
+
v-if="item.badge !== void 0"
|
|
93
|
+
color="neutral"
|
|
94
|
+
variant="outline"
|
|
95
|
+
:size="item.ui?.trailingBadgeSize || props.ui?.trailingBadgeSize || ui.trailingBadgeSize()"
|
|
96
|
+
v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
|
|
97
|
+
:class="ui.trailingBadge({ class: [props.ui?.trailingBadge, item.ui?.trailingBadge] })"
|
|
98
|
+
data-part="trailingBadge"
|
|
99
|
+
/>
|
|
100
|
+
</slot>
|
|
56
101
|
</TabsTrigger>
|
|
102
|
+
|
|
103
|
+
<slot name="list-trailing"></slot>
|
|
57
104
|
</TabsList>
|
|
58
105
|
|
|
59
106
|
<template v-if="props.content">
|
|
60
107
|
<TabsContent
|
|
61
108
|
v-for="(item, index) of items"
|
|
62
109
|
:key="index"
|
|
63
|
-
:value="item.value
|
|
64
|
-
:class="
|
|
110
|
+
:value="item.value ?? String(index)"
|
|
111
|
+
:class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
|
|
65
112
|
data-part="content"
|
|
66
113
|
>
|
|
67
|
-
<slot :name="item.slot || 'content'" :item="item" :index="index">
|
|
114
|
+
<slot :name="item.slot || 'content'" :item="item" :index="index" :ui="ui">
|
|
68
115
|
{{ item.content }}
|
|
69
116
|
</slot>
|
|
70
117
|
</TabsContent>
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
+
import type { ComponentPublicInstance } from 'vue';
|
|
1
2
|
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
3
|
import type { TabsRootEmits, TabsRootProps } from 'reka-ui';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
}
|
|
4
|
+
import theme from '#build/ui/tabs';
|
|
5
|
+
import type { AvatarProps, BadgeProps, ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
|
|
6
|
+
import type { DynamicSlots, GetItemKeys, StaticSlot } from '../types/utils';
|
|
7
7
|
export interface TabsItem {
|
|
8
8
|
label?: string;
|
|
9
|
-
icon?:
|
|
9
|
+
icon?: IconProps['name'];
|
|
10
|
+
avatar?: AvatarProps;
|
|
11
|
+
/** Display a badge on the item. */
|
|
12
|
+
badge?: string | number | BadgeProps;
|
|
10
13
|
slot?: string;
|
|
11
14
|
content?: string;
|
|
12
15
|
/** A unique value for the tab item. Defaults to the index. */
|
|
13
16
|
value?: string | number;
|
|
14
17
|
disabled?: boolean;
|
|
18
|
+
ui?: Pick<ComponentUIProps<typeof theme>, 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'>;
|
|
15
19
|
[key: string]: any;
|
|
16
20
|
}
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
index: number;
|
|
20
|
-
}) => any;
|
|
21
|
-
export type TabsSlots<T extends TabsItem = TabsItem> = {
|
|
22
|
-
leading?: SlotProps<T>;
|
|
23
|
-
default?: SlotProps<T>;
|
|
24
|
-
trailing?: SlotProps<T>;
|
|
25
|
-
content?: SlotProps<T>;
|
|
26
|
-
} & DynamicSlots<T, undefined, SlotProps<T>>;
|
|
27
|
-
type TabsVariants = VariantProps<typeof tabs>;
|
|
28
|
-
export interface TabsProps<T extends TabsItem = TabsItem> extends ComponentAttrs<typeof tabs>, Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
|
|
21
|
+
type ThemeVariants = VariantProps<typeof theme>;
|
|
22
|
+
export interface TabsProps<T extends TabsItem = TabsItem> extends ComponentBaseProps, Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
|
|
29
23
|
/**
|
|
30
24
|
* The element or component this component should render as.
|
|
31
25
|
* @default "div"
|
|
32
26
|
*/
|
|
33
27
|
as?: TabsRootProps<string | number>['as'];
|
|
34
28
|
items?: T[];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
/** @default "pill" */
|
|
30
|
+
variant?: ThemeVariants['variant'];
|
|
31
|
+
/**
|
|
32
|
+
* The orientation of the tabs.
|
|
33
|
+
* @default "horizontal"
|
|
34
|
+
*/
|
|
35
|
+
orientation?: ThemeVariants['orientation'];
|
|
36
|
+
/** @default "primary" */
|
|
37
|
+
color?: ThemeVariants['color'];
|
|
38
|
+
/** @default "md" */
|
|
39
|
+
size?: ThemeVariants['size'];
|
|
40
40
|
/**
|
|
41
41
|
* The content of the tabs, can be disabled to prevent rendering the content.
|
|
42
42
|
* @default true
|
|
@@ -46,20 +46,52 @@ export interface TabsProps<T extends TabsItem = TabsItem> extends ComponentAttrs
|
|
|
46
46
|
* The key used to get the label from the item.
|
|
47
47
|
* @default "label"
|
|
48
48
|
*/
|
|
49
|
-
labelKey?:
|
|
49
|
+
labelKey?: GetItemKeys<T>;
|
|
50
|
+
ui?: ComponentUIProps<typeof theme>;
|
|
51
|
+
}
|
|
52
|
+
export interface TabsEmits extends TabsRootEmits<string | number> {
|
|
50
53
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
export type TabsSlots<T extends TabsItem = TabsItem> = {
|
|
55
|
+
'leading': StaticSlot<{
|
|
56
|
+
item: T;
|
|
57
|
+
index: number;
|
|
58
|
+
ui: ComponentStyler<typeof theme>;
|
|
59
|
+
}>;
|
|
60
|
+
'default': StaticSlot<{
|
|
61
|
+
item: T;
|
|
62
|
+
index: number;
|
|
63
|
+
}>;
|
|
64
|
+
'trailing': StaticSlot<{
|
|
65
|
+
item: T;
|
|
66
|
+
index: number;
|
|
67
|
+
ui: ComponentStyler<typeof theme>;
|
|
68
|
+
}>;
|
|
69
|
+
'content': StaticSlot<{
|
|
70
|
+
item: T;
|
|
71
|
+
index: number;
|
|
72
|
+
ui: ComponentStyler<typeof theme>;
|
|
73
|
+
}>;
|
|
74
|
+
'list-leading': StaticSlot;
|
|
75
|
+
'list-trailing': StaticSlot;
|
|
76
|
+
} & DynamicSlots<T, undefined, {
|
|
77
|
+
index: number;
|
|
78
|
+
ui: ComponentStyler<typeof theme>;
|
|
79
|
+
}>;
|
|
80
|
+
declare const __VLS_export: <T extends TabsItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
81
|
+
props: __VLS_PrettifyLocal<TabsProps<T> & {
|
|
82
|
+
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
83
|
+
}> & import("vue").PublicProps;
|
|
84
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
85
|
+
triggersRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
|
|
86
|
+
}>) => void;
|
|
56
87
|
attrs: any;
|
|
57
88
|
slots: TabsSlots<T>;
|
|
58
89
|
emit: (evt: "update:modelValue", payload: string | number) => void;
|
|
59
90
|
}>) => import("vue").VNode & {
|
|
60
91
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
61
92
|
};
|
|
93
|
+
declare const _default: typeof __VLS_export;
|
|
62
94
|
export default _default;
|
|
63
95
|
type __VLS_PrettifyLocal<T> = {
|
|
64
|
-
[K in keyof T]: T[K];
|
|
96
|
+
[K in keyof T as K]: T[K];
|
|
65
97
|
} & {};
|