@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.
Files changed (297) hide show
  1. package/README.md +170 -58
  2. package/dist/module.d.mts +4 -13
  3. package/dist/module.json +4 -4
  4. package/dist/module.mjs +54 -20
  5. package/dist/runtime/components/Accordion.vue +28 -23
  6. package/dist/runtime/components/Accordion.vue.d.ts +51 -29
  7. package/dist/runtime/components/Alert.vue +47 -27
  8. package/dist/runtime/components/Alert.vue.d.ts +37 -25
  9. package/dist/runtime/components/App.vue +9 -8
  10. package/dist/runtime/components/App.vue.d.ts +22 -20
  11. package/dist/runtime/components/Avatar.vue +65 -21
  12. package/dist/runtime/components/Avatar.vue.d.ts +27 -13
  13. package/dist/runtime/components/AvatarGroup.vue +14 -10
  14. package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
  15. package/dist/runtime/components/Badge.vue +64 -32
  16. package/dist/runtime/components/Badge.vue.d.ts +30 -29
  17. package/dist/runtime/components/Breadcrumb.vue +40 -22
  18. package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
  19. package/dist/runtime/components/Button.vue +113 -52
  20. package/dist/runtime/components/Button.vue.d.ts +36 -20
  21. package/dist/runtime/components/Calendar.vue +50 -43
  22. package/dist/runtime/components/Calendar.vue.d.ts +58 -31
  23. package/dist/runtime/components/Card.vue +18 -14
  24. package/dist/runtime/components/Card.vue.d.ts +18 -14
  25. package/dist/runtime/components/Carousel.vue +99 -46
  26. package/dist/runtime/components/Carousel.vue.d.ts +46 -25
  27. package/dist/runtime/components/Checkbox.vue +60 -35
  28. package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
  29. package/dist/runtime/components/CheckboxGroup.vue +131 -0
  30. package/dist/runtime/components/CheckboxGroup.vue.d.ts +89 -0
  31. package/dist/runtime/components/Chip.vue +35 -32
  32. package/dist/runtime/components/Chip.vue.d.ts +33 -15
  33. package/dist/runtime/components/Collapsible.vue +13 -9
  34. package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
  35. package/dist/runtime/components/Drawer.vue +80 -70
  36. package/dist/runtime/components/Drawer.vue.d.ts +51 -28
  37. package/dist/runtime/components/DropdownMenu.vue +23 -16
  38. package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
  39. package/dist/runtime/components/DropdownMenuContent.vue +136 -106
  40. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
  41. package/dist/runtime/components/FieldGroup.vue +33 -0
  42. package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
  43. package/dist/runtime/components/Form.vue +172 -88
  44. package/dist/runtime/components/Form.vue.d.ts +69 -44
  45. package/dist/runtime/components/FormField.vue +108 -0
  46. package/dist/runtime/components/FormField.vue.d.ts +63 -0
  47. package/dist/runtime/components/Icon.vue +20 -0
  48. package/dist/runtime/components/Icon.vue.d.ts +9 -0
  49. package/dist/runtime/components/Input.vue +84 -79
  50. package/dist/runtime/components/Input.vue.d.ts +55 -43
  51. package/dist/runtime/components/InputNumber.vue +66 -52
  52. package/dist/runtime/components/InputNumber.vue.d.ts +50 -109
  53. package/dist/runtime/components/InputTags.vue +155 -0
  54. package/dist/runtime/components/InputTags.vue.d.ts +85 -0
  55. package/dist/runtime/components/Kbd.vue +11 -5
  56. package/dist/runtime/components/Kbd.vue.d.ts +17 -11
  57. package/dist/runtime/components/Link.vue +54 -197
  58. package/dist/runtime/components/Link.vue.d.ts +17 -17
  59. package/dist/runtime/components/LinkBase.vue +11 -33
  60. package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
  61. package/dist/runtime/components/Marquee.vue +38 -0
  62. package/dist/runtime/components/Marquee.vue.d.ts +54 -0
  63. package/dist/runtime/components/Modal.vue +53 -39
  64. package/dist/runtime/components/Modal.vue.d.ts +64 -34
  65. package/dist/runtime/components/NavigationMenu.vue +345 -0
  66. package/dist/runtime/components/NavigationMenu.vue.d.ts +216 -0
  67. package/dist/runtime/components/OverlayProvider.vue +3 -3
  68. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
  69. package/dist/runtime/components/Pagination.vue +39 -47
  70. package/dist/runtime/components/Pagination.vue.d.ts +54 -31
  71. package/dist/runtime/components/PinInput.vue +46 -32
  72. package/dist/runtime/components/PinInput.vue.d.ts +40 -21
  73. package/dist/runtime/components/Popover.vue +33 -19
  74. package/dist/runtime/components/Popover.vue.d.ts +57 -32
  75. package/dist/runtime/components/Progress.vue +31 -26
  76. package/dist/runtime/components/Progress.vue.d.ts +32 -23
  77. package/dist/runtime/components/RadioGroup.vue +75 -48
  78. package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
  79. package/dist/runtime/components/ScrollArea.vue +33 -31
  80. package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
  81. package/dist/runtime/components/Select.vue +166 -76
  82. package/dist/runtime/components/Select.vue.d.ts +206 -65
  83. package/dist/runtime/components/Separator.vue +42 -16
  84. package/dist/runtime/components/Separator.vue.d.ts +35 -14
  85. package/dist/runtime/components/Skeleton.vue +18 -6
  86. package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
  87. package/dist/runtime/components/Slider.vue +42 -24
  88. package/dist/runtime/components/Slider.vue.d.ts +43 -27
  89. package/dist/runtime/components/Switch.vue +40 -31
  90. package/dist/runtime/components/Switch.vue.d.ts +36 -27
  91. package/dist/runtime/components/Table.vue +329 -79
  92. package/dist/runtime/components/Table.vue.d.ts +152 -66
  93. package/dist/runtime/components/Tabs.vue +70 -23
  94. package/dist/runtime/components/Tabs.vue.d.ts +61 -29
  95. package/dist/runtime/components/Textarea.vue +102 -54
  96. package/dist/runtime/components/Textarea.vue.d.ts +57 -41
  97. package/dist/runtime/components/Timeline.vue +102 -0
  98. package/dist/runtime/components/Timeline.vue.d.ts +74 -0
  99. package/dist/runtime/components/Toast.vue +84 -38
  100. package/dist/runtime/components/Toast.vue.d.ts +48 -27
  101. package/dist/runtime/components/ToastProvider.vue +31 -22
  102. package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
  103. package/dist/runtime/components/Tooltip.vue +33 -21
  104. package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
  105. package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
  106. package/dist/runtime/composables/defineShortcuts.js +129 -0
  107. package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
  108. package/dist/runtime/composables/useAvatarGroup.js +10 -3
  109. package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
  110. package/dist/runtime/composables/useComponentIcons.js +4 -4
  111. package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
  112. package/dist/runtime/composables/useFieldGroup.js +14 -0
  113. package/dist/runtime/composables/useFormField.d.ts +62 -0
  114. package/dist/runtime/composables/useFormField.js +99 -0
  115. package/dist/runtime/composables/useKbd.d.ts +3 -2
  116. package/dist/runtime/composables/useKbd.js +3 -2
  117. package/dist/runtime/composables/useLocale.d.ts +68 -5
  118. package/dist/runtime/composables/useLocale.js +11 -11
  119. package/dist/runtime/composables/useOverlay.d.ts +51 -15
  120. package/dist/runtime/composables/useOverlay.js +44 -30
  121. package/dist/runtime/composables/usePortal.d.ts +6 -0
  122. package/dist/runtime/composables/usePortal.js +17 -0
  123. package/dist/runtime/composables/useToast.d.ts +12 -5
  124. package/dist/runtime/composables/useToast.js +12 -7
  125. package/dist/runtime/locale/en.d.ts +30 -1
  126. package/dist/runtime/locale/en.js +2 -1
  127. package/dist/runtime/locale/index.d.ts +2 -2
  128. package/dist/runtime/locale/index.js +1 -1
  129. package/dist/runtime/locale/zh_tw.d.ts +31 -0
  130. package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
  131. package/dist/runtime/plugins/colors.d.ts +2 -0
  132. package/dist/runtime/plugins/colors.js +50 -0
  133. package/dist/runtime/types/app.config.d.ts +6 -0
  134. package/dist/runtime/types/form.d.ts +58 -17
  135. package/dist/runtime/types/form.js +11 -0
  136. package/dist/runtime/types/index.d.ts +56 -8
  137. package/dist/runtime/types/index.js +49 -1
  138. package/dist/runtime/types/input.d.ts +8 -0
  139. package/dist/runtime/types/locale.d.ts +5 -0
  140. package/dist/runtime/types/style.d.ts +33 -0
  141. package/dist/runtime/types/style.js +0 -0
  142. package/dist/runtime/types/unocss.d.ts +4 -0
  143. package/dist/runtime/types/utils.d.ts +41 -37
  144. package/dist/runtime/utils/form.d.ts +5 -1
  145. package/dist/runtime/utils/form.js +49 -0
  146. package/dist/runtime/utils/index.d.ts +10 -13
  147. package/dist/runtime/utils/index.js +41 -48
  148. package/dist/runtime/utils/link.d.ts +3 -2
  149. package/dist/runtime/utils/link.js +16 -2
  150. package/dist/runtime/utils/locale.d.ts +5 -0
  151. package/dist/runtime/utils/locale.js +10 -0
  152. package/dist/runtime/utils/style.d.ts +94 -0
  153. package/dist/runtime/utils/style.js +37 -0
  154. package/dist/runtime/vue/components/Icon.vue +15 -0
  155. package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
  156. package/dist/runtime/vue/components/Link.vue +163 -0
  157. package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
  158. package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
  159. package/dist/runtime/vue/composables/useAppConfig.js +4 -0
  160. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  161. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  162. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  163. package/dist/runtime/vue/plugins/head.js +9 -0
  164. package/dist/runtime/vue/stubs.d.ts +16 -1
  165. package/dist/runtime/vue/stubs.js +32 -1
  166. package/dist/setup.d.mts +13 -0
  167. package/dist/setup.mjs +12 -0
  168. package/dist/shared/ui.CzIlLITK.mjs +51 -0
  169. package/dist/shared/ui.DLOxhmP0.mjs +4242 -0
  170. package/dist/shared/ui.DpbffTXs.d.mts +84 -0
  171. package/dist/shared/ui.IulR-OYx.d.mts +64 -0
  172. package/dist/types.d.mts +3 -1
  173. package/dist/unocss.d.mts +12 -52
  174. package/dist/unocss.mjs +144 -254
  175. package/dist/unplugin.d.mts +13 -26
  176. package/dist/unplugin.mjs +193 -18
  177. package/dist/vite.d.mts +10 -1
  178. package/dist/vite.mjs +12 -3
  179. package/package.json +154 -87
  180. package/vue-plugin.d.ts +5 -0
  181. package/dist/module.d.ts +0 -13
  182. package/dist/module.mjs.map +0 -1
  183. package/dist/runtime/app/injections.d.ts +0 -9331
  184. package/dist/runtime/app/injections.js +0 -61
  185. package/dist/runtime/components/ButtonGroup.vue +0 -26
  186. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
  187. package/dist/runtime/components/FormItem.vue +0 -90
  188. package/dist/runtime/components/FormItem.vue.d.ts +0 -60
  189. package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
  190. package/dist/runtime/composables/useButtonGroup.js +0 -9
  191. package/dist/runtime/composables/useFormItem.d.ts +0 -27
  192. package/dist/runtime/composables/useFormItem.js +0 -64
  193. package/dist/runtime/composables/useTheme.d.ts +0 -9
  194. package/dist/runtime/composables/useTheme.js +0 -23
  195. package/dist/runtime/index.d.ts +0 -44
  196. package/dist/runtime/index.js +0 -44
  197. package/dist/runtime/locale/zh-tw.d.ts +0 -2
  198. package/dist/runtime/theme/accordion.d.ts +0 -50
  199. package/dist/runtime/theme/accordion.js +0 -28
  200. package/dist/runtime/theme/alert.d.ts +0 -119
  201. package/dist/runtime/theme/alert.js +0 -47
  202. package/dist/runtime/theme/app.d.ts +0 -19
  203. package/dist/runtime/theme/app.js +0 -19
  204. package/dist/runtime/theme/avatar-group.d.ts +0 -46
  205. package/dist/runtime/theme/avatar-group.js +0 -32
  206. package/dist/runtime/theme/avatar.d.ts +0 -50
  207. package/dist/runtime/theme/avatar.js +0 -34
  208. package/dist/runtime/theme/badge.d.ts +0 -76
  209. package/dist/runtime/theme/badge.js +0 -92
  210. package/dist/runtime/theme/breadcrumb.d.ts +0 -61
  211. package/dist/runtime/theme/breadcrumb.js +0 -44
  212. package/dist/runtime/theme/button-group.d.ts +0 -60
  213. package/dist/runtime/theme/button-group.js +0 -42
  214. package/dist/runtime/theme/button.d.ts +0 -184
  215. package/dist/runtime/theme/button.js +0 -164
  216. package/dist/runtime/theme/calendar.d.ts +0 -58
  217. package/dist/runtime/theme/calendar.js +0 -86
  218. package/dist/runtime/theme/card.d.ts +0 -56
  219. package/dist/runtime/theme/card.js +0 -37
  220. package/dist/runtime/theme/carousel.d.ts +0 -107
  221. package/dist/runtime/theme/carousel.js +0 -43
  222. package/dist/runtime/theme/checkbox.d.ts +0 -82
  223. package/dist/runtime/theme/checkbox.js +0 -54
  224. package/dist/runtime/theme/chip.d.ts +0 -61
  225. package/dist/runtime/theme/chip.js +0 -66
  226. package/dist/runtime/theme/collapsible.d.ts +0 -32
  227. package/dist/runtime/theme/collapsible.js +0 -10
  228. package/dist/runtime/theme/drawer.d.ts +0 -142
  229. package/dist/runtime/theme/drawer.js +0 -113
  230. package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
  231. package/dist/runtime/theme/dropdown-menu.js +0 -83
  232. package/dist/runtime/theme/form-item.d.ts +0 -70
  233. package/dist/runtime/theme/form-item.js +0 -34
  234. package/dist/runtime/theme/form.d.ts +0 -2
  235. package/dist/runtime/theme/form.js +0 -7
  236. package/dist/runtime/theme/index.d.ts +0 -41
  237. package/dist/runtime/theme/index.js +0 -41
  238. package/dist/runtime/theme/input-number.d.ts +0 -115
  239. package/dist/runtime/theme/input-number.js +0 -95
  240. package/dist/runtime/theme/input.d.ts +0 -172
  241. package/dist/runtime/theme/input.js +0 -151
  242. package/dist/runtime/theme/kbd.d.ts +0 -33
  243. package/dist/runtime/theme/kbd.js +0 -26
  244. package/dist/runtime/theme/link.d.ts +0 -38
  245. package/dist/runtime/theme/link.js +0 -26
  246. package/dist/runtime/theme/modal.d.ts +0 -42
  247. package/dist/runtime/theme/modal.js +0 -55
  248. package/dist/runtime/theme/pagination.d.ts +0 -74
  249. package/dist/runtime/theme/pagination.js +0 -17
  250. package/dist/runtime/theme/pinInput.d.ts +0 -94
  251. package/dist/runtime/theme/pinInput.js +0 -111
  252. package/dist/runtime/theme/popover.d.ts +0 -32
  253. package/dist/runtime/theme/popover.js +0 -13
  254. package/dist/runtime/theme/progress.d.ts +0 -180
  255. package/dist/runtime/theme/progress.js +0 -95
  256. package/dist/runtime/theme/radio-group.d.ts +0 -104
  257. package/dist/runtime/theme/radio-group.js +0 -61
  258. package/dist/runtime/theme/scroll-area.d.ts +0 -67
  259. package/dist/runtime/theme/scroll-area.js +0 -33
  260. package/dist/runtime/theme/select.d.ts +0 -186
  261. package/dist/runtime/theme/select.js +0 -173
  262. package/dist/runtime/theme/separator.d.ts +0 -74
  263. package/dist/runtime/theme/separator.js +0 -53
  264. package/dist/runtime/theme/skeleton.d.ts +0 -2
  265. package/dist/runtime/theme/skeleton.js +0 -7
  266. package/dist/runtime/theme/slider.d.ts +0 -70
  267. package/dist/runtime/theme/slider.js +0 -52
  268. package/dist/runtime/theme/switch.d.ts +0 -116
  269. package/dist/runtime/theme/switch.js +0 -78
  270. package/dist/runtime/theme/table.d.ts +0 -86
  271. package/dist/runtime/theme/table.js +0 -36
  272. package/dist/runtime/theme/tabs.d.ts +0 -129
  273. package/dist/runtime/theme/tabs.js +0 -146
  274. package/dist/runtime/theme/textarea.d.ts +0 -90
  275. package/dist/runtime/theme/textarea.js +0 -116
  276. package/dist/runtime/theme/toast-provider.d.ts +0 -116
  277. package/dist/runtime/theme/toast-provider.js +0 -97
  278. package/dist/runtime/theme/toast.d.ts +0 -83
  279. package/dist/runtime/theme/toast.js +0 -35
  280. package/dist/runtime/theme/tooltip.d.ts +0 -38
  281. package/dist/runtime/theme/tooltip.js +0 -11
  282. package/dist/runtime/types/components.d.ts +0 -42
  283. package/dist/runtime/utils/extend-theme.d.ts +0 -9
  284. package/dist/runtime/utils/extend-theme.js +0 -27
  285. package/dist/runtime/utils/styler.d.ts +0 -4
  286. package/dist/runtime/utils/styler.js +0 -10
  287. package/dist/runtime/utils/translator.d.ts +0 -18
  288. package/dist/runtime/utils/translator.js +0 -8
  289. package/dist/shared/ui.D1BTWZFB.mjs +0 -5
  290. package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
  291. package/dist/unocss.d.ts +0 -52
  292. package/dist/unocss.mjs.map +0 -1
  293. package/dist/unplugin.d.ts +0 -26
  294. package/dist/unplugin.mjs.map +0 -1
  295. package/dist/vite.d.ts +0 -9
  296. package/dist/vite.mjs.map +0 -1
  297. /package/dist/runtime/types/{components.js → input.js} +0 -0
@@ -1,27 +1,48 @@
1
- import type { CellContext, ColumnDef, ColumnFiltersOptions, ColumnFiltersState, ColumnOrderState, ColumnPinningOptions, ColumnPinningState, ColumnSizingInfoState, ColumnSizingOptions, ColumnSizingState, CoreOptions, ExpandedOptions, ExpandedState, FacetedOptions, GlobalFilterOptions, GroupingOptions, GroupingState, HeaderContext, PaginationOptions, PaginationState, Row, RowData, RowPinningOptions, RowPinningState, RowSelectionOptions, RowSelectionState, SortingOptions, SortingState, VisibilityOptions, VisibilityState } from '@tanstack/vue-table';
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 { table } from '../theme/index.js';
4
- import type { ComponentAttrs } from '../types/index.js';
5
- 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>;
6
- 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>;
7
- export type TableSlots<T> = {
8
- expanded?: (props: {
9
- row: Row<T>;
10
- }) => any;
11
- empty?: any;
12
- loading?: any;
13
- caption?: any;
14
- } & DynamicHeaderSlots<T> & DynamicCellSlots<T>;
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
- title?: string;
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
- export interface TableProps<T extends TableData> extends ComponentAttrs<typeof table>, TableOptions<T> {
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
47
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
52
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
57
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#table-options)
62
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
67
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
72
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#table-options)
77
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
82
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
87
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#table-options)
92
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#table-options)
97
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)
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
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#table-options)
102
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
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
- declare const _default: <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<{
107
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
108
- readonly "onUpdate:globalFilter"?: ((value: string) => any) | undefined;
109
- readonly "onUpdate:columnFilters"?: ((value: ColumnFiltersState) => any) | undefined;
110
- readonly "onUpdate:columnOrder"?: ((value: ColumnOrderState) => any) | undefined;
111
- readonly "onUpdate:columnVisibility"?: ((value: VisibilityState) => any) | undefined;
112
- readonly "onUpdate:columnPinning"?: ((value: ColumnPinningState) => any) | undefined;
113
- readonly "onUpdate:columnSizing"?: ((value: ColumnSizingState) => any) | undefined;
114
- readonly "onUpdate:columnSizingInfo"?: ((value: ColumnSizingInfoState) => any) | undefined;
115
- readonly "onUpdate:rowSelection"?: ((value: RowSelectionState) => any) | undefined;
116
- readonly "onUpdate:rowPinning"?: ((value: RowPinningState) => any) | undefined;
117
- readonly "onUpdate:sorting"?: ((value: SortingState) => any) | undefined;
118
- readonly "onUpdate:grouping"?: ((value: GroupingState) => any) | undefined;
119
- readonly "onUpdate:expanded"?: ((value: ExpandedState) => any) | undefined;
120
- readonly "onUpdate:pagination"?: ((value: PaginationState) => any) | undefined;
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
- }) & Partial<{}>> & import("vue").PublicProps;
136
- expose(exposed: import("vue").ShallowUnwrapRef<{
137
- tableApi: import("@tanstack/vue-table").Table<T>;
138
- }>): void;
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 { useTheme } from "../composables/useTheme";
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, default: "solid" },
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: String, required: false, default: "label" },
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", "modelValue", "defaultValue", "orientation", "activationMode", "unmountOnHide"), emit);
30
- const { generateStyle } = useTheme();
31
- const style = computed(() => generateStyle("tabs", props));
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 v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
36
- <TabsList :class="style.list({ class: props.ui?.list })" data-part="list">
37
- <TabsIndicator :class="style.indicator({ class: props.ui?.indicator })" data-part="indicator" />
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 || String(index)"
65
+ :value="item.value ?? String(index)"
43
66
  :disabled="item.disabled"
44
- :class="style.trigger({ class: props.ui?.trigger })"
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
- <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })" data-part="leading-icon"></span>
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="style.label({ class: props.ui?.label })" data-part="label">
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"></slot>
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 || String(index)"
64
- :class="style.content({ class: props.ui?.content })"
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 type { tabs } from '../theme/index.js';
4
- import type { ComponentAttrs, DynamicSlots } from '../types/index.js';
5
- export interface TabsEmits extends TabsRootEmits<string | number> {
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?: string;
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 SlotProps<T extends TabsItem> = (props: {
18
- item: T;
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
- variant?: TabsVariants['variant'];
36
- orientation?: TabsVariants['orientation'];
37
- size?: TabsVariants['size'];
38
- /** @default true */
39
- evenly?: boolean;
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?: string;
49
+ labelKey?: GetItemKeys<T>;
50
+ ui?: ComponentUIProps<typeof theme>;
51
+ }
52
+ export interface TabsEmits extends TabsRootEmits<string | number> {
50
53
  }
51
- declare const _default: <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<{
52
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
53
- readonly "onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
54
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & TabsProps<T> & Partial<{}>> & import("vue").PublicProps;
55
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
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
  } & {};