@byyuurin/ui 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/README.md +4 -5
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.json +12 -0
  4. package/dist/{nuxt.mjs → module.mjs} +8 -8
  5. package/dist/module.mjs.map +1 -0
  6. package/dist/runtime/app/injections.d.ts +16 -0
  7. package/dist/runtime/app/injections.js +31 -0
  8. package/dist/runtime/components/Accordion.vue +27 -38
  9. package/dist/runtime/components/Alert.vue +23 -16
  10. package/dist/runtime/components/App.vue +15 -15
  11. package/dist/runtime/components/Avatar.vue +73 -0
  12. package/dist/runtime/components/AvatarGroup.vue +90 -0
  13. package/dist/runtime/components/Badge.vue +15 -10
  14. package/dist/runtime/components/Breadcrumb.vue +105 -0
  15. package/dist/runtime/components/Button.vue +22 -23
  16. package/dist/runtime/components/ButtonGroup.vue +12 -10
  17. package/dist/runtime/components/Card.vue +16 -8
  18. package/dist/runtime/components/Carousel.vue +19 -12
  19. package/dist/runtime/components/Checkbox.vue +16 -12
  20. package/dist/runtime/components/Chip.vue +17 -12
  21. package/dist/runtime/components/Collapsible.vue +56 -0
  22. package/dist/runtime/components/Drawer.vue +18 -17
  23. package/dist/runtime/components/Input.vue +28 -28
  24. package/dist/runtime/components/InputNumber.vue +169 -0
  25. package/dist/runtime/components/Kbd.vue +51 -0
  26. package/dist/runtime/components/Link.vue +301 -72
  27. package/dist/runtime/components/LinkBase.vue +88 -0
  28. package/dist/runtime/components/Modal.vue +11 -9
  29. package/dist/runtime/components/ModalProvider.vue +2 -1
  30. package/dist/runtime/components/Pagination.vue +30 -30
  31. package/dist/runtime/components/PinInput.vue +7 -7
  32. package/dist/runtime/components/Popover.vue +7 -7
  33. package/dist/runtime/components/Progress.vue +165 -0
  34. package/dist/runtime/components/RadioGroup.vue +33 -29
  35. package/dist/runtime/components/Select.vue +40 -40
  36. package/dist/runtime/components/Separator.vue +63 -0
  37. package/dist/runtime/components/Skeleton.vue +33 -0
  38. package/dist/runtime/components/Slider.vue +6 -6
  39. package/dist/runtime/components/Switch.vue +14 -15
  40. package/dist/runtime/components/Table.vue +300 -0
  41. package/dist/runtime/components/Tabs.vue +25 -21
  42. package/dist/runtime/components/Textarea.vue +11 -11
  43. package/dist/runtime/components/Toast.vue +15 -14
  44. package/dist/runtime/components/Toaster.vue +5 -39
  45. package/dist/runtime/components/Tooltip.vue +7 -7
  46. package/dist/runtime/composables/useAvatarGroup.d.ts +4 -0
  47. package/dist/runtime/composables/useAvatarGroup.js +8 -0
  48. package/dist/runtime/composables/useButtonGroup.d.ts +4 -12
  49. package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +1 -6
  50. package/dist/runtime/composables/useComponentIcons.d.ts +9 -9
  51. package/dist/runtime/composables/useComponentIcons.js +24 -0
  52. package/dist/runtime/composables/useKbd.d.ts +35 -0
  53. package/dist/runtime/composables/useKbd.js +49 -0
  54. package/dist/runtime/composables/useLocale.d.ts +8 -0
  55. package/dist/runtime/composables/useLocale.js +22 -0
  56. package/dist/runtime/composables/useModal.d.ts +2 -7
  57. package/dist/runtime/composables/{useModal.mjs → useModal.js} +1 -6
  58. package/dist/runtime/composables/useTheme.d.ts +2 -6
  59. package/dist/runtime/composables/useTheme.js +16 -0
  60. package/dist/runtime/composables/useToast.d.ts +1 -1
  61. package/dist/runtime/index.d.ts +40 -0
  62. package/dist/runtime/index.js +40 -0
  63. package/dist/runtime/locale/en.d.ts +2 -0
  64. package/dist/runtime/locale/en.js +28 -0
  65. package/dist/runtime/locale/index.d.ts +2 -0
  66. package/dist/runtime/locale/index.js +2 -0
  67. package/dist/runtime/locale/zh-tw.d.ts +2 -0
  68. package/dist/runtime/locale/zh-tw.js +28 -0
  69. package/dist/runtime/theme/accordion.d.ts +5 -5
  70. package/dist/runtime/theme/{accordion.mjs → accordion.js} +2 -2
  71. package/dist/runtime/theme/alert.d.ts +2 -2
  72. package/dist/runtime/theme/{alert.mjs → alert.js} +4 -4
  73. package/dist/runtime/theme/app.d.ts +8 -5
  74. package/dist/runtime/theme/app.js +18 -0
  75. package/dist/runtime/theme/avatar-group.d.ts +52 -0
  76. package/dist/runtime/theme/avatar-group.js +32 -0
  77. package/dist/runtime/theme/avatar.d.ts +56 -0
  78. package/dist/runtime/theme/avatar.js +34 -0
  79. package/dist/runtime/theme/badge.d.ts +45 -21
  80. package/dist/runtime/theme/{badge.mjs → badge.js} +2 -2
  81. package/dist/runtime/theme/breadcrumb.d.ts +67 -0
  82. package/dist/runtime/theme/breadcrumb.js +44 -0
  83. package/dist/runtime/theme/button-group.d.ts +2 -2
  84. package/dist/runtime/theme/button.d.ts +61 -115
  85. package/dist/runtime/theme/button.js +164 -0
  86. package/dist/runtime/theme/card.d.ts +38 -38
  87. package/dist/runtime/theme/card.js +37 -0
  88. package/dist/runtime/theme/carousel.d.ts +2 -2
  89. package/dist/runtime/theme/{carousel.mjs → carousel.js} +2 -2
  90. package/dist/runtime/theme/checkbox.d.ts +1 -1
  91. package/dist/runtime/theme/{checkbox.mjs → checkbox.js} +3 -3
  92. package/dist/runtime/theme/chip.d.ts +47 -14
  93. package/dist/runtime/theme/{chip.mjs → chip.js} +7 -9
  94. package/dist/runtime/theme/collapsible.d.ts +38 -0
  95. package/dist/runtime/theme/collapsible.js +10 -0
  96. package/dist/runtime/theme/drawer.d.ts +43 -43
  97. package/dist/runtime/theme/{drawer.mjs → drawer.js} +33 -22
  98. package/dist/runtime/theme/index.d.ts +37 -27
  99. package/dist/runtime/theme/index.js +37 -0
  100. package/dist/runtime/theme/input-number.d.ts +141 -0
  101. package/dist/runtime/theme/input-number.js +95 -0
  102. package/dist/runtime/theme/input.d.ts +77 -105
  103. package/dist/runtime/theme/{input.mjs → input.js} +25 -25
  104. package/dist/runtime/theme/kbd.d.ts +39 -0
  105. package/dist/runtime/theme/kbd.js +26 -0
  106. package/dist/runtime/theme/link.d.ts +2 -2
  107. package/dist/runtime/theme/{link.mjs → link.js} +1 -1
  108. package/dist/runtime/theme/modal.d.ts +31 -8
  109. package/dist/runtime/theme/{modal.mjs → modal.js} +4 -9
  110. package/dist/runtime/theme/pagination.d.ts +17 -17
  111. package/dist/runtime/theme/pinInput.d.ts +42 -42
  112. package/dist/runtime/theme/{pinInput.mjs → pinInput.js} +10 -10
  113. package/dist/runtime/theme/popover.d.ts +8 -8
  114. package/dist/runtime/theme/{popover.mjs → popover.js} +1 -1
  115. package/dist/runtime/theme/progress.d.ts +122 -0
  116. package/dist/runtime/theme/progress.js +95 -0
  117. package/dist/runtime/theme/radio-group.d.ts +1 -1
  118. package/dist/runtime/theme/{radio-group.mjs → radio-group.js} +1 -1
  119. package/dist/runtime/theme/scroll-area.d.ts +17 -17
  120. package/dist/runtime/theme/{scroll-area.mjs → scroll-area.js} +2 -2
  121. package/dist/runtime/theme/select.d.ts +93 -108
  122. package/dist/runtime/theme/{select.mjs → select.js} +31 -31
  123. package/dist/runtime/theme/separator.d.ts +95 -0
  124. package/dist/runtime/theme/separator.js +53 -0
  125. package/dist/runtime/theme/skeleton.d.ts +8 -0
  126. package/dist/runtime/theme/skeleton.js +7 -0
  127. package/dist/runtime/theme/slider.d.ts +1 -1
  128. package/dist/runtime/theme/{slider.mjs → slider.js} +3 -3
  129. package/dist/runtime/theme/switch.d.ts +1 -1
  130. package/dist/runtime/theme/{switch.mjs → switch.js} +3 -3
  131. package/dist/runtime/theme/table.d.ts +89 -0
  132. package/dist/runtime/theme/table.js +35 -0
  133. package/dist/runtime/theme/tabs.d.ts +70 -53
  134. package/dist/runtime/theme/{tabs.mjs → tabs.js} +12 -12
  135. package/dist/runtime/theme/textarea.d.ts +43 -37
  136. package/dist/runtime/theme/{textarea.mjs → textarea.js} +10 -10
  137. package/dist/runtime/theme/toast.d.ts +2 -2
  138. package/dist/runtime/theme/{toast.mjs → toast.js} +3 -3
  139. package/dist/runtime/theme/toaster.d.ts +42 -27
  140. package/dist/runtime/theme/tooltip.d.ts +11 -11
  141. package/dist/runtime/theme/tooltip.js +11 -0
  142. package/dist/runtime/types/components.d.ts +37 -27
  143. package/dist/runtime/types/index.d.ts +5 -4
  144. package/dist/runtime/types/index.js +3 -0
  145. package/dist/runtime/types/locale.d.ts +23 -0
  146. package/dist/runtime/types/locale.js +0 -0
  147. package/dist/runtime/types/utils.d.ts +1 -1
  148. package/dist/runtime/types/utils.js +0 -0
  149. package/dist/runtime/utils/index.d.ts +9 -4
  150. package/dist/runtime/utils/{index.mjs → index.js} +9 -7
  151. package/dist/runtime/utils/link.d.ts +22 -7
  152. package/dist/runtime/utils/link.js +30 -0
  153. package/dist/runtime/utils/styler.d.ts +1 -1
  154. package/dist/runtime/utils/translator.d.ts +18 -0
  155. package/dist/runtime/utils/translator.js +8 -0
  156. package/dist/runtime/vue/stubs.d.ts +9 -0
  157. package/dist/runtime/vue/stubs.js +16 -0
  158. package/dist/shared/ui.ba24b380.mjs +4 -0
  159. package/dist/shared/ui.ba24b380.mjs.map +1 -0
  160. package/dist/types.d.mts +1 -0
  161. package/dist/types.d.ts +1 -0
  162. package/dist/unocss.d.mts +6 -11
  163. package/dist/unocss.d.ts +6 -11
  164. package/dist/unocss.mjs +40 -21
  165. package/dist/unocss.mjs.map +1 -1
  166. package/dist/unplugin.mjs +35 -8
  167. package/dist/unplugin.mjs.map +1 -1
  168. package/dist/vite.d.mts +0 -1
  169. package/dist/vite.d.ts +0 -1
  170. package/dist/vite.mjs +3 -1
  171. package/dist/vite.mjs.map +1 -1
  172. package/package.json +50 -38
  173. package/dist/index.d.ts +0 -29
  174. package/dist/index.mjs +0 -29
  175. package/dist/nuxt.mjs.map +0 -1
  176. package/dist/runtime/composables/useComponentIcons.mjs +0 -24
  177. package/dist/runtime/composables/useTheme.mjs +0 -26
  178. package/dist/runtime/theme/app.mjs +0 -15
  179. package/dist/runtime/theme/button.mjs +0 -148
  180. package/dist/runtime/theme/card.mjs +0 -14
  181. package/dist/runtime/theme/index.mjs +0 -27
  182. package/dist/runtime/theme/tooltip.mjs +0 -11
  183. package/dist/runtime/types/components.mjs +0 -27
  184. package/dist/runtime/types/index.mjs +0 -2
  185. package/dist/runtime/utils/link.mjs +0 -4
  186. package/dist/shared/ui.D4zm1r0C.mjs +0 -4
  187. package/dist/shared/ui.D4zm1r0C.mjs.map +0 -1
  188. /package/dist/{nuxt.d.mts → module.d.mts} +0 -0
  189. /package/dist/{nuxt.d.ts → module.d.ts} +0 -0
  190. /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
  191. /package/dist/runtime/theme/{button-group.mjs → button-group.js} +0 -0
  192. /package/dist/runtime/theme/{pagination.mjs → pagination.js} +0 -0
  193. /package/dist/runtime/theme/{toaster.mjs → toaster.js} +0 -0
  194. /package/dist/runtime/types/{utils.mjs → components.js} +0 -0
  195. /package/dist/runtime/utils/{extend-theme.mjs → extend-theme.js} +0 -0
  196. /package/dist/runtime/utils/{styler.mjs → styler.js} +0 -0
  197. /package/dist/runtime/{composables/defineInjection.d.ts → utils/vue.d.ts} +0 -0
  198. /package/dist/runtime/{composables/defineInjection.mjs → utils/vue.js} +0 -0
@@ -0,0 +1,300 @@
1
+ <script lang="ts">
2
+ 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, Updater, VisibilityOptions, VisibilityState } from '@tanstack/vue-table'
3
+ import type { PrimitiveProps } from 'reka-ui'
4
+ import type { Ref } from 'vue'
5
+ import type { table } from '../theme'
6
+ import type { ComponentAttrs } from '../types'
7
+
8
+ 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>
9
+
10
+ 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>
11
+
12
+ export type TableSlots<T> = {
13
+ expanded: (props: { row: Row<T> }) => any
14
+ empty: (props?: {}) => any
15
+ caption: (props?: {}) => any
16
+ } & DynamicHeaderSlots<T> & DynamicCellSlots<T>
17
+
18
+ export type TableData = RowData
19
+ export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D> & { title?: string }
20
+
21
+ export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
22
+ state?: CoreOptions<T>['state']
23
+ onStateChange?: CoreOptions<T>['onStateChange']
24
+ renderFallbackValue?: CoreOptions<T>['renderFallbackValue']
25
+ }
26
+
27
+ export interface TableProps<T extends TableData> extends ComponentAttrs<typeof table>, TableOptions<T> {
28
+ /**
29
+ * The element or component this component should render as.
30
+ * @default "div"
31
+ */
32
+ as?: PrimitiveProps['as']
33
+ data?: T[]
34
+ columns?: TableColumn<T>[]
35
+ caption?: string
36
+ /**
37
+ * Whether the table should have a sticky header.
38
+ * @default false
39
+ */
40
+ sticky?: boolean
41
+ /**
42
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/global-filtering#table-options)
43
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/global-filtering)
44
+ */
45
+ globalFilterOptions?: Omit<GlobalFilterOptions<T>, 'onGlobalFilterChange'>
46
+ /**
47
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#table-options)
48
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
49
+ */
50
+ columnFiltersOptions?: Omit<ColumnFiltersOptions<T>, 'getFilteredRowModel' | 'onColumnFiltersChange'>
51
+ /**
52
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-pinning#table-options)
53
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
54
+ */
55
+ columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>
56
+ /**
57
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#table-options)
58
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
59
+ */
60
+ columnSizingOptions?: Omit<ColumnSizingOptions, 'onColumnSizingChange' | 'onColumnSizingInfoChange'>
61
+ /**
62
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
63
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
64
+ */
65
+ visibilityOptions?: Omit<VisibilityOptions, 'onColumnVisibilityChange'>
66
+ /**
67
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/sorting#table-options)
68
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
69
+ */
70
+ sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>
71
+ /**
72
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#table-options)
73
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
74
+ */
75
+ groupingOptions?: Omit<GroupingOptions, 'onGroupingChange'>
76
+ /**
77
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
78
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
79
+ */
80
+ expandedOptions?: Omit<ExpandedOptions<T>, 'getExpandedRowModel' | 'onExpandedChange'>
81
+ /**
82
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#table-options)
83
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
84
+ */
85
+ rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>
86
+ /**
87
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#table-options)
88
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)
89
+ */
90
+ rowPinningOptions?: Omit<RowPinningOptions<T>, 'onRowPinningChange'>
91
+ /**
92
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#table-options)
93
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)
94
+ */
95
+ paginationOptions?: Omit<PaginationOptions, 'onPaginationChange'>
96
+ /**
97
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#table-options)
98
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
99
+ */
100
+ facetedOptions?: FacetedOptions<T>
101
+ }
102
+ </script>
103
+
104
+ <script setup lang="ts" generic="T extends TableData">
105
+ import { FlexRender, getCoreRowModel, getExpandedRowModel, getFilteredRowModel, getSortedRowModel, useVueTable } from '@tanstack/vue-table'
106
+ import { reactiveOmit } from '@vueuse/core'
107
+ import { Primitive } from 'reka-ui'
108
+ import { upperFirst } from 'scule'
109
+ import { computed } from 'vue'
110
+ import { useLocale } from '../composables/useLocale'
111
+ import { useTheme } from '../composables/useTheme'
112
+
113
+ const props = defineProps<TableProps<T>>()
114
+
115
+ defineSlots<TableSlots<T>>()
116
+
117
+ const globalFilterState = defineModel<string>('globalFilter', { default: undefined })
118
+ const columnFiltersState = defineModel<ColumnFiltersState>('columnFilters', { default: [] })
119
+ const columnOrderState = defineModel<ColumnOrderState>('columnOrder', { default: [] })
120
+ const columnVisibilityState = defineModel<VisibilityState>('columnVisibility', { default: {} })
121
+ const columnPinningState = defineModel<ColumnPinningState>('columnPinning', { default: {} })
122
+ const columnSizingState = defineModel<ColumnSizingState>('columnSizing', { default: {} })
123
+ const columnSizingInfoState = defineModel<ColumnSizingInfoState>('columnSizingInfo', { default: {} })
124
+ const rowSelectionState = defineModel<RowSelectionState>('rowSelection', { default: {} })
125
+ const rowPinningState = defineModel<RowPinningState>('rowPinning', { default: {} })
126
+ const sortingState = defineModel<SortingState>('sorting', { default: [] })
127
+ const groupingState = defineModel<GroupingState>('grouping', { default: [] })
128
+ const expandedState = defineModel<ExpandedState>('expanded', { default: {} })
129
+ const paginationState = defineModel<PaginationState>('pagination', { default: {} })
130
+
131
+ const data = computed(() => props.data ?? [])
132
+ const columns = computed<TableColumn<T>[]>(
133
+ () =>
134
+ props.columns ?? Object.keys(data.value[0] ?? {}).map(
135
+ (accessorKey: string) => ({ accessorKey, header: upperFirst(accessorKey) }),
136
+ ),
137
+ )
138
+
139
+ const tableApi = useVueTable({
140
+ ...reactiveOmit(props, 'data', 'columns', 'caption', 'sticky', 'class', 'ui'),
141
+ data,
142
+ columns: columns.value,
143
+ getCoreRowModel: getCoreRowModel(),
144
+
145
+ ...props.globalFilterOptions,
146
+ onGlobalFilterChange: (updaterOrValue) => valueUpdater(updaterOrValue, globalFilterState),
147
+
148
+ ...props.columnFiltersOptions,
149
+ getFilteredRowModel: getFilteredRowModel(),
150
+ onColumnFiltersChange: (updaterOrValue) => valueUpdater(updaterOrValue, columnFiltersState),
151
+ onColumnOrderChange: (updaterOrValue) => valueUpdater(updaterOrValue, columnOrderState),
152
+
153
+ ...props.visibilityOptions,
154
+ onColumnVisibilityChange: (updaterOrValue) => valueUpdater(updaterOrValue, columnVisibilityState),
155
+
156
+ ...props.columnPinningOptions,
157
+ onColumnPinningChange: (updaterOrValue) => valueUpdater(updaterOrValue, columnPinningState),
158
+
159
+ ...props.columnSizingOptions,
160
+ onColumnSizingChange: (updaterOrValue) => valueUpdater(updaterOrValue, columnSizingState),
161
+ onColumnSizingInfoChange: (updaterOrValue) => valueUpdater(updaterOrValue, columnSizingInfoState),
162
+
163
+ ...props.rowSelectionOptions,
164
+ onRowSelectionChange: (updaterOrValue) => valueUpdater(updaterOrValue, rowSelectionState),
165
+
166
+ ...props.rowPinningOptions,
167
+ onRowPinningChange: (updaterOrValue) => valueUpdater(updaterOrValue, rowPinningState),
168
+
169
+ ...props.sortingOptions,
170
+ getSortedRowModel: getSortedRowModel(),
171
+ onSortingChange: (updaterOrValue) => valueUpdater(updaterOrValue, sortingState),
172
+
173
+ ...props.groupingOptions,
174
+ onGroupingChange: (updaterOrValue) => valueUpdater(updaterOrValue, groupingState),
175
+
176
+ ...props.expandedOptions,
177
+ getExpandedRowModel: getExpandedRowModel(),
178
+ onExpandedChange: (updaterOrValue) => valueUpdater(updaterOrValue, expandedState),
179
+
180
+ ...props.paginationOptions,
181
+ onPaginationChange: (updaterOrValue) => valueUpdater(updaterOrValue, paginationState),
182
+
183
+ ...props.facetedOptions,
184
+ state: {
185
+ get globalFilter() {
186
+ return globalFilterState.value
187
+ },
188
+ get columnFilters() {
189
+ return columnFiltersState.value
190
+ },
191
+ get columnOrder() {
192
+ return columnOrderState.value
193
+ },
194
+ get columnVisibility() {
195
+ return columnVisibilityState.value
196
+ },
197
+ get columnPinning() {
198
+ return columnPinningState.value
199
+ },
200
+ get expanded() {
201
+ return expandedState.value
202
+ },
203
+ get rowSelection() {
204
+ return rowSelectionState.value
205
+ },
206
+ get sorting() {
207
+ return sortingState.value
208
+ },
209
+ get grouping() {
210
+ return groupingState.value
211
+ },
212
+ get rowPinning() {
213
+ return rowPinningState.value
214
+ },
215
+ get columnSizing() {
216
+ return columnSizingState.value
217
+ },
218
+ get columnSizingInfo() {
219
+ return columnSizingInfoState.value
220
+ },
221
+ get pagination() {
222
+ return paginationState.value
223
+ },
224
+ },
225
+ })
226
+
227
+ function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
228
+ ref.value = typeof updaterOrValue === 'function' ? updaterOrValue(ref.value) : updaterOrValue
229
+ }
230
+
231
+ const { t } = useLocale()
232
+ const { theme, createStyler } = useTheme()
233
+ const style = computed(() => {
234
+ const styler = createStyler(theme.value.table)
235
+ return styler(props)
236
+ })
237
+
238
+ defineExpose({
239
+ tableApi,
240
+ })
241
+ </script>
242
+
243
+ <template>
244
+ <Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
245
+ <table :class="style.base({ class: props.ui?.base })">
246
+ <caption v-if="props.caption" :class="style.caption({ class: props.caption })">
247
+ <slot name="caption">
248
+ {{ props.caption }}
249
+ </slot>
250
+ </caption>
251
+
252
+ <thead :class="style.thead({ class: props.ui?.thead })">
253
+ <tr v-for="headerGroup in tableApi.getHeaderGroups()" :key="headerGroup.id" :class="style.tr({ class: props.ui?.tr })">
254
+ <th
255
+ v-for="header in headerGroup.headers"
256
+ :key="header.id"
257
+ :data-pinned="header.column.getIsPinned()"
258
+ :class="style.th({ class: props.ui?.th, pinned: !!header.column.getIsPinned() })"
259
+ >
260
+ <slot :name="`${header.id}-header`" v-bind="header.getContext()">
261
+ <FlexRender v-if="!header.isPlaceholder" :render="header.column.columnDef.header" :props="header.getContext" />
262
+ </slot>
263
+ </th>
264
+ </tr>
265
+ </thead>
266
+
267
+ <tbody :class="style.tbody({ class: props.ui?.tbody })">
268
+ <template v-if="tableApi.getRowModel().rows.length > 0">
269
+ <template v-for="row in tableApi.getRowModel().rows" :key="row.id">
270
+ <tr :data-selected="row.getIsSelected()" :data-expanded="row.getIsExpanded()" :class="style.tr({ class: props.ui?.tr })">
271
+ <td
272
+ v-for="cell in row.getVisibleCells()"
273
+ :key="cell.id"
274
+ :data-pinned="cell.column.getIsPinned()"
275
+ :class="style.td({ class: props.ui?.td, pinned: !!cell.column.getIsPinned() })"
276
+ >
277
+ <slot :name="`${cell.column.id}-cell`" v-bind="cell.getContext()">
278
+ <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
279
+ </slot>
280
+ </td>
281
+ </tr>
282
+ <tr v-if="row.getIsExpanded()" :class="style.tr({ class: props.ui?.tr, expanded: true })">
283
+ <td :colspan="row.getAllCells().length" :class="style.td({ class: props.ui?.td })">
284
+ <slot name="expanded" :row="row"></slot>
285
+ </td>
286
+ </tr>
287
+ </template>
288
+ </template>
289
+
290
+ <tr v-else :class="style.tr({ class: props.ui?.tr })">
291
+ <td :colspan="columns.length" :class="style.empty({ class: props.ui?.empty })">
292
+ <slot name="empty">
293
+ {{ t('table.noData') }}
294
+ </slot>
295
+ </td>
296
+ </tr>
297
+ </tbody>
298
+ </table>
299
+ </Primitive>
300
+ </template>
@@ -1,9 +1,20 @@
1
1
  <script lang="ts">
2
2
  import type { VariantProps } from '@byyuurin/ui-kit'
3
- import type { PrimitiveProps, TabsRootEmits, TabsRootProps } from 'reka-ui'
3
+ import type { TabsRootEmits, TabsRootProps } from 'reka-ui'
4
4
  import type { tabs } from '../theme'
5
5
  import type { ComponentAttrs, DynamicSlots } from '../types'
6
6
 
7
+ export interface TabsEmits extends TabsRootEmits<string | number> {}
8
+
9
+ type SlotProps<T> = (props: { item: T, index: number }) => any
10
+
11
+ export type TabsSlots<T extends { slot?: string }> = {
12
+ leading?: SlotProps<T>
13
+ default?: SlotProps<T>
14
+ trailing?: SlotProps<T>
15
+ content?: SlotProps<T>
16
+ } & DynamicSlots<T, SlotProps<T>>
17
+
7
18
  export interface TabsItem {
8
19
  label?: string
9
20
  icon?: string
@@ -17,13 +28,17 @@ export interface TabsItem {
17
28
  type TabsVariants = VariantProps<typeof tabs>
18
29
 
19
30
  export interface TabsProps<T> extends ComponentAttrs<typeof tabs>, Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
20
- as?: PrimitiveProps['as']
31
+ /**
32
+ * The element or component this component should render as.
33
+ * @default "div"
34
+ */
35
+ as?: TabsRootProps<string | number>['as']
21
36
  items?: T[]
22
37
  variant?: TabsVariants['variant']
23
38
  orientation?: TabsVariants['orientation']
24
39
  size?: TabsVariants['size']
25
40
  /** @default true */
26
- full?: boolean
41
+ evenly?: boolean
27
42
  /**
28
43
  * The content of the tabs, can be disabled to prevent rendering the content.
29
44
  * @default true
@@ -31,21 +46,10 @@ export interface TabsProps<T> extends ComponentAttrs<typeof tabs>, Pick<TabsRoot
31
46
  content?: boolean
32
47
  /**
33
48
  * The key used to get the label from the item.
34
- * @default 'label'
49
+ * @default "label"
35
50
  */
36
51
  labelKey?: string
37
52
  }
38
-
39
- export interface TabsEmits extends TabsRootEmits<string | number> {}
40
-
41
- type SlotProps<T> = (props: { item: T, index: number }) => any
42
-
43
- export type TabsSlots<T extends { slot?: string }> = {
44
- prefix?: SlotProps<T>
45
- default?: SlotProps<T>
46
- suffix?: SlotProps<T>
47
- content?: SlotProps<T>
48
- } & DynamicSlots<T, SlotProps<T>>
49
53
  </script>
50
54
 
51
55
  <script lang="ts" setup generic="T extends TabsItem">
@@ -59,15 +63,15 @@ const props = withDefaults(defineProps<TabsProps<T>>(), {
59
63
  defaultValue: '0',
60
64
  variant: 'solid',
61
65
  orientation: 'horizontal',
62
- full: true,
66
+ evenly: true,
63
67
  content: true,
64
68
  labelKey: 'label',
65
69
  })
66
70
 
67
- const emits = defineEmits<TabsEmits>()
71
+ const emit = defineEmits<TabsEmits>()
68
72
  const slots = defineSlots<TabsSlots<T>>()
69
73
 
70
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'activationMode', 'unmountOnHide'), emits)
74
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'activationMode', 'unmountOnHide'), emit)
71
75
 
72
76
  const { theme, createStyler } = useTheme()
73
77
  const style = computed(() => {
@@ -88,15 +92,15 @@ const style = computed(() => {
88
92
  :disabled="item.disabled"
89
93
  :class="style.trigger({ class: props.ui?.trigger })"
90
94
  >
91
- <slot name="prefix" :item="item" :index="index">
92
- <i v-if="item.icon" :class="style.prefixIcon({ class: [item.icon, props.ui?.prefixIcon] })"></i>
95
+ <slot name="leading" :item="item" :index="index">
96
+ <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })"></span>
93
97
  </slot>
94
98
 
95
99
  <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
96
100
  <slot :item="item" :index="index">{{ get(item, props.labelKey) }}</slot>
97
101
  </span>
98
102
 
99
- <slot name="suffix" :item="item" :index="index"></slot>
103
+ <slot name="trailing" :item="item" :index="index"></slot>
100
104
  </TabsTrigger>
101
105
  </TabsList>
102
106
 
@@ -4,12 +4,22 @@ import type { PrimitiveProps } from 'reka-ui'
4
4
  import type { textarea } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface TextareaEmits {
8
+ (e: 'update:modelValue', payload: string): void
9
+ (e: 'blur', event: FocusEvent): void
10
+ (e: 'change', event: Event): void
11
+ }
12
+
13
+ export interface TextareaSlots {
14
+ default?: (props?: {}) => any
15
+ }
16
+
7
17
  type TextareaVariants = VariantProps<typeof textarea>
8
18
 
9
19
  export interface TextareaProps extends ComponentAttrs<typeof textarea> {
10
20
  /**
11
21
  * The element or component this component should render as.
12
- * @defaultValue 'div'
22
+ * @default "div"
13
23
  */
14
24
  as?: PrimitiveProps['as']
15
25
  id?: string
@@ -27,16 +37,6 @@ export interface TextareaProps extends ComponentAttrs<typeof textarea> {
27
37
  maxRows?: number
28
38
  autoResize?: boolean
29
39
  }
30
-
31
- export interface TextareaEmits {
32
- (e: 'update:modelValue', payload: string): void
33
- (e: 'blur', event: FocusEvent): void
34
- (e: 'change', event: Event): void
35
- }
36
-
37
- export interface TextareaSlots {
38
- default?: (props?: {}) => any
39
- }
40
40
  </script>
41
41
 
42
42
  <script setup lang="ts">
@@ -4,6 +4,16 @@ import type { PrimitiveProps, ToastRootEmits, ToastRootProps } from 'reka-ui'
4
4
  import type { toast } from '../theme'
5
5
  import type { ButtonProps, ComponentAttrs } from '../types'
6
6
 
7
+ export interface ToastEmits extends ToastRootEmits {}
8
+
9
+ export interface ToastSlots {
10
+ icon?: (props?: {}) => any
11
+ title?: (props?: {}) => any
12
+ description?: (props?: {}) => any
13
+ actions?: (props?: {}) => any
14
+ close?: (props: { ui: any }) => any
15
+ }
16
+
7
17
  type ToastVariants = VariantProps<typeof toast>
8
18
 
9
19
  export interface ToastProps extends ComponentAttrs<typeof toast>, Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
@@ -27,23 +37,13 @@ export interface ToastProps extends ComponentAttrs<typeof toast>, Pick<ToastRoot
27
37
  /** @default app.icons.close */
28
38
  closeIcon?: string
29
39
  }
30
-
31
- export interface ToastEmits extends ToastRootEmits {}
32
-
33
- export interface ToastSlots {
34
- icon?: (props?: {}) => any
35
- title?: (props?: {}) => any
36
- description?: (props?: {}) => any
37
- actions?: (props?: {}) => any
38
- close?: (props: { ui: any }) => any
39
-
40
- }
41
40
  </script>
42
41
 
43
42
  <script setup lang="ts">
44
43
  import { reactivePick, useElementBounding } from '@vueuse/core'
45
44
  import { ToastAction, ToastClose, ToastDescription, ToastRoot, ToastTitle, useForwardPropsEmits } from 'reka-ui'
46
45
  import { computed, ref } from 'vue'
46
+ import { useLocale } from '../composables/useLocale'
47
47
  import { useTheme } from '../composables/useTheme'
48
48
  import Button from './Button.vue'
49
49
 
@@ -60,6 +60,7 @@ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen',
60
60
  const el = ref<InstanceType<typeof ToastRoot>>()
61
61
  const { height } = useElementBounding(() => el.value?.$el.getBoundingClientRect ? el.value.$el : undefined)
62
62
 
63
+ const { t } = useLocale()
63
64
  const { theme, createStyler } = useTheme()
64
65
  const style = computed(() => {
65
66
  const styler = createStyler(theme.value.toast)
@@ -83,7 +84,7 @@ defineExpose({
83
84
  :style="{ '--height': height }"
84
85
  >
85
86
  <slot name="icon">
86
- <i v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></i>
87
+ <span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
87
88
  </slot>
88
89
 
89
90
  <div :class="style.wrapper({ class: props.ui?.wrapper })">
@@ -121,9 +122,9 @@ defineExpose({
121
122
  <Button
122
123
  v-if="props.close"
123
124
  :icon="props.closeIcon || theme.app.icons.close"
124
- size="md"
125
+ size="sm"
125
126
  variant="link"
126
- aria-label="close"
127
+ :aria-label="t('toast.close')"
127
128
  v-bind="typeof close === 'object' ? close : undefined"
128
129
  :class="style.close({ class: props.ui?.close })"
129
130
  @click.stop
@@ -4,6 +4,10 @@ import type { ToastProviderProps } from 'reka-ui'
4
4
  import type { toaster } from '../theme'
5
5
  import type { ComponentAttrs } from '../types'
6
6
 
7
+ export interface ToasterSlots {
8
+ default?: (props?: {}) => any
9
+ }
10
+
7
11
  type ToasterVariants = VariantProps<typeof toaster>
8
12
 
9
13
  export interface ToasterProps extends ComponentAttrs<typeof toaster>, Omit<ToastProviderProps, 'swipeDirection'> {
@@ -20,10 +24,6 @@ export interface ToasterProps extends ComponentAttrs<typeof toaster>, Omit<Toast
20
24
  */
21
25
  portal?: boolean
22
26
  }
23
-
24
- export interface ToasterSlots {
25
- default?: (props?: {}) => any
26
- }
27
27
  </script>
28
28
 
29
29
  <script setup lang="ts">
@@ -139,39 +139,5 @@ function getOffset(index: number) {
139
139
  </template>
140
140
 
141
141
  <style>
142
- @keyframes toast-collapsed-closed {
143
- from {
144
- transform: var(--transform);
145
- }
146
- to {
147
- transform: translateY(calc((var(--before) - var(--height)) * var(--gap)))
148
- scale(var(--scale));
149
- }
150
- }
151
- @keyframes toast-closed {
152
- from {
153
- transform: var(--transform);
154
- }
155
- to {
156
- transform: translateY(
157
- calc((var(--offset) - var(--height)) * var(--translate-factor))
158
- );
159
- }
160
- }
161
- @keyframes toast-slide-left {
162
- from {
163
- transform: translateX(0) translateY(var(--translate));
164
- }
165
- to {
166
- transform: translateX(-100%) translateY(var(--translate));
167
- }
168
- }
169
- @keyframes toast-slide-right {
170
- from {
171
- transform: translateX(0) translateY(var(--translate));
172
- }
173
- to {
174
- transform: translateX(100%) translateY(var(--translate));
175
- }
176
- }
142
+ @keyframes toast-collapsed-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--before) - var(--height))*var(--gap))) scale(var(--scale))}}@keyframes toast-closed{0%{transform:var(--transform)}to{transform:translateY(calc((var(--offset) - var(--height))*var(--translate-factor)))}}@keyframes toast-slide-left{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(-100%) translateY(var(--translate))}}@keyframes toast-slide-right{0%{transform:translateX(0) translateY(var(--translate))}to{transform:translateX(100%) translateY(var(--translate))}}
177
143
  </style>
@@ -3,6 +3,13 @@ import type { TooltipArrowProps, TooltipContentProps, TooltipRootEmits, TooltipR
3
3
  import type { tooltip } from '../theme'
4
4
  import type { ComponentAttrs } from '../types'
5
5
 
6
+ export interface TooltipEmits extends TooltipRootEmits {}
7
+
8
+ export interface TooltipSlots {
9
+ default?: (props: { open: boolean }) => any
10
+ content?: (props: {}) => any
11
+ }
12
+
6
13
  export interface TooltipProps extends ComponentAttrs<typeof tooltip>, TooltipRootProps {
7
14
  text?: string
8
15
  content?: Omit<TooltipContentProps, 'as' | 'asChild'>
@@ -10,13 +17,6 @@ export interface TooltipProps extends ComponentAttrs<typeof tooltip>, TooltipRoo
10
17
  /** @default true */
11
18
  portal?: boolean
12
19
  }
13
-
14
- export interface TooltipEmits extends TooltipRootEmits {}
15
-
16
- export interface TooltipSlots {
17
- default?: (props: { open: boolean }) => any
18
- content?: (props: {}) => any
19
- }
20
20
  </script>
21
21
 
22
22
  <script lang="ts" setup>
@@ -0,0 +1,4 @@
1
+ import type { AvatarProps } from '../types/index.js';
2
+ export declare function useAvatarGroup(props?: AvatarProps): {
3
+ size: import("vue").ComputedRef<any>;
4
+ };
@@ -0,0 +1,8 @@
1
+ import { computed } from "vue";
2
+ import { injectAvatarGroup } from "../app/injections.js";
3
+ export function useAvatarGroup(props = {}) {
4
+ const avatarGroup = injectAvatarGroup();
5
+ return {
6
+ size: computed(() => props.size ?? avatarGroup?.value.size)
7
+ };
8
+ }
@@ -1,13 +1,5 @@
1
- import type { ComputedRef } from 'vue';
2
- import type { ButtonGroupProps } from '../components/ButtonGroup.vue';
3
- interface ButtonGroupInjectData {
4
- size: ButtonGroupProps['size'];
5
- orientation: ButtonGroupProps['orientation'];
6
- }
7
- export declare const InjectionKeyButtonGroup: import("vue").InjectionKey<ComputedRef<ButtonGroupInjectData>>, injectButtonGroup: () => ComputedRef<ButtonGroupInjectData> | undefined, provideButtonGroup: (value: ComputedRef<ButtonGroupInjectData>) => void;
8
- type UseButtonGroupProps = Pick<ButtonGroupProps, 'size'>;
9
- export declare function useButtonGroup(props?: UseButtonGroupProps): {
10
- size: ComputedRef<any>;
11
- orientation: ComputedRef<any>;
1
+ import type { ButtonProps } from '../types/index.js';
2
+ export declare function useButtonGroup(props?: Pick<ButtonProps, 'size'>): {
3
+ size: import("vue").ComputedRef<any>;
4
+ orientation: import("vue").ComputedRef<any>;
12
5
  };
13
- export {};
@@ -1,10 +1,5 @@
1
1
  import { computed } from "vue";
2
- import { defineInjection } from "./defineInjection.mjs";
3
- export const {
4
- InjectionKey: InjectionKeyButtonGroup,
5
- inject: injectButtonGroup,
6
- provide: provideButtonGroup
7
- } = defineInjection("ui.buttonGroup");
2
+ import { injectButtonGroup } from "../app/injections.js";
8
3
  export function useButtonGroup(props = {}) {
9
4
  const buttonGroup = injectButtonGroup();
10
5
  return {