@nuxt/ui 3.0.0-alpha.11 → 3.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/ui/accordion.ts +2 -2
- package/.nuxt/ui/alert.ts +47 -37
- package/.nuxt/ui/avatar-group.ts +1 -1
- package/.nuxt/ui/avatar.ts +4 -4
- package/.nuxt/ui/badge.ts +37 -28
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button.ts +42 -43
- package/.nuxt/ui/calendar.ts +15 -15
- package/.nuxt/ui/card.ts +27 -1
- package/.nuxt/ui/carousel.ts +2 -2
- package/.nuxt/ui/checkbox.ts +18 -18
- package/.nuxt/ui/chip.ts +8 -8
- package/.nuxt/ui/color-picker.ts +2 -2
- package/.nuxt/ui/command-palette.ts +12 -12
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/context-menu.ts +32 -32
- package/.nuxt/ui/drawer.ts +72 -11
- package/.nuxt/ui/dropdown-menu.ts +33 -33
- package/.nuxt/ui/form-field.ts +6 -6
- package/.nuxt/ui/input-menu.ts +41 -41
- package/.nuxt/ui/input-number.ts +20 -20
- package/.nuxt/ui/input.ts +23 -23
- package/.nuxt/ui/kbd.ts +4 -4
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +5 -5
- package/.nuxt/ui/navigation-menu.ts +144 -77
- package/.nuxt/ui/pin-input.ts +20 -20
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +17 -17
- package/.nuxt/ui/radio-group.ts +20 -20
- package/.nuxt/ui/select-menu.ts +33 -32
- package/.nuxt/ui/select.ts +31 -31
- package/.nuxt/ui/separator.ts +8 -8
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +4 -4
- package/.nuxt/ui/slider.ts +16 -16
- package/.nuxt/ui/stepper.ts +18 -18
- package/.nuxt/ui/switch.ts +20 -20
- package/.nuxt/ui/table.ts +16 -16
- package/.nuxt/ui/tabs.ts +33 -33
- package/.nuxt/ui/textarea.ts +23 -23
- package/.nuxt/ui/toast.ts +42 -32
- package/.nuxt/ui/toaster.ts +4 -4
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui.css +90 -0
- package/README.md +2 -2
- package/cli/package.json +2 -2
- package/cli/templates.mjs +7 -7
- package/dist/chunks/component-meta.cjs +2590 -2511
- package/dist/chunks/component-meta.mjs +2590 -2511
- package/dist/client/devtools/200.html +1 -1
- package/dist/client/devtools/404.html +1 -1
- package/dist/client/devtools/_nuxt/CG6Dc4jp.js +1 -0
- package/dist/client/devtools/_nuxt/{Dtz-o9GB.js → DrNJgD08.js} +1 -1
- package/dist/client/devtools/_nuxt/{DNZFyo26.js → ElqrUh1r.js} +1 -1
- package/dist/client/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/client/devtools/_nuxt/builds/meta/255c8d0b-7281-4d74-b4b6-ec96e6721aa0.json +1 -0
- package/dist/client/devtools/_nuxt/entry.Hn8drx4g.css +1 -0
- package/dist/client/devtools/_nuxt/error-404.Dew7w9Ee.css +1 -0
- package/dist/client/devtools/_nuxt/error-500.Dep59i31.css +1 -0
- package/dist/client/devtools/_nuxt/mC2e7kOs.js +57 -0
- package/dist/client/devtools/index.html +1 -1
- package/dist/devtools/runtime/examples/CardExample.vue +3 -3
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +1 -1
- package/dist/devtools/runtime/examples/ContainerExample.vue +1 -1
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +1 -1
- package/dist/devtools/runtime/examples/PopoverExample.vue +1 -1
- package/dist/devtools/runtime/examples/TooltipExample.vue +1 -1
- package/dist/module.cjs +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/Accordion.vue +2 -2
- package/dist/runtime/components/Alert.vue +15 -12
- package/dist/runtime/components/App.vue +3 -3
- package/dist/runtime/components/Avatar.vue +31 -10
- package/dist/runtime/components/AvatarGroup.vue +2 -2
- package/dist/runtime/components/Badge.vue +7 -3
- package/dist/runtime/components/Breadcrumb.vue +2 -2
- package/dist/runtime/components/Button.vue +2 -2
- package/dist/runtime/components/ButtonGroup.vue +2 -2
- package/dist/runtime/components/Calendar.vue +6 -3
- package/dist/runtime/components/Card.vue +8 -4
- package/dist/runtime/components/Carousel.vue +2 -2
- package/dist/runtime/components/Checkbox.vue +4 -4
- package/dist/runtime/components/Chip.vue +2 -2
- package/dist/runtime/components/Collapsible.vue +2 -2
- package/dist/runtime/components/ColorPicker.vue +46 -15
- package/dist/runtime/components/CommandPalette.vue +48 -41
- package/dist/runtime/components/Container.vue +2 -2
- package/dist/runtime/components/ContextMenu.vue +10 -2
- package/dist/runtime/components/ContextMenuContent.vue +4 -2
- package/dist/runtime/components/Drawer.vue +9 -3
- package/dist/runtime/components/DropdownMenu.vue +10 -2
- package/dist/runtime/components/DropdownMenuContent.vue +4 -2
- package/dist/runtime/components/Form.vue +46 -17
- package/dist/runtime/components/FormField.vue +12 -6
- package/dist/runtime/components/Input.vue +5 -4
- package/dist/runtime/components/InputMenu.vue +6 -5
- package/dist/runtime/components/InputNumber.vue +10 -6
- package/dist/runtime/components/Kbd.vue +2 -2
- package/dist/runtime/components/Link.vue +2 -2
- package/dist/runtime/components/Modal.vue +17 -3
- package/dist/runtime/components/NavigationMenu.vue +110 -67
- package/dist/runtime/components/Pagination.vue +2 -2
- package/dist/runtime/components/PinInput.vue +5 -4
- package/dist/runtime/components/Popover.vue +2 -2
- package/dist/runtime/components/Progress.vue +2 -2
- package/dist/runtime/components/RadioGroup.vue +4 -4
- package/dist/runtime/components/Select.vue +9 -7
- package/dist/runtime/components/SelectMenu.vue +67 -64
- package/dist/runtime/components/Separator.vue +2 -2
- package/dist/runtime/components/Skeleton.vue +2 -2
- package/dist/runtime/components/Slideover.vue +17 -3
- package/dist/runtime/components/Slider.vue +4 -4
- package/dist/runtime/components/Stepper.vue +3 -3
- package/dist/runtime/components/Switch.vue +4 -4
- package/dist/runtime/components/Table.vue +96 -18
- package/dist/runtime/components/Tabs.vue +2 -2
- package/dist/runtime/components/Textarea.vue +7 -5
- package/dist/runtime/components/Toast.vue +28 -16
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Tooltip.vue +2 -2
- package/dist/runtime/composables/useFormField.d.ts +6 -2
- package/dist/runtime/composables/useFormField.js +18 -11
- package/dist/runtime/composables/useToast.d.ts +4 -3
- package/dist/runtime/composables/useToast.js +20 -6
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/locale/az.js +54 -0
- package/dist/runtime/locale/bn.js +54 -0
- package/dist/runtime/locale/es.js +2 -2
- package/dist/runtime/locale/he.d.ts +2 -0
- package/dist/runtime/locale/he.js +53 -0
- package/dist/runtime/locale/hi.d.ts +2 -0
- package/dist/runtime/locale/hi.js +54 -0
- package/dist/runtime/locale/hu.d.ts +2 -0
- package/dist/runtime/locale/hu.js +54 -0
- package/dist/runtime/locale/index.d.ts +8 -2
- package/dist/runtime/locale/index.js +8 -2
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.js +54 -0
- package/dist/runtime/locale/nb_no.d.ts +2 -0
- package/dist/runtime/locale/nb_no.js +54 -0
- package/dist/runtime/locale/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/{zh_hans.js → zh_cn.js} +1 -1
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/{zh_hant.js → zh_tw.js} +1 -1
- package/dist/runtime/plugins/colors.js +8 -5
- package/dist/runtime/types/form.d.ts +21 -12
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +5 -0
- package/dist/runtime/utils/form.js +3 -5
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Link.vue +77 -18
- package/dist/shared/{ui.DCjJwb6l.cjs → ui.C5FzRWM5.cjs} +529 -366
- package/dist/shared/{ui.BKsd22-Q.mjs → ui.DCZM2pl8.mjs} +525 -366
- package/dist/unplugin.cjs +44 -20
- package/dist/unplugin.d.cts +10 -0
- package/dist/unplugin.d.mts +10 -0
- package/dist/unplugin.d.ts +10 -0
- package/dist/unplugin.mjs +43 -19
- package/dist/vite.cjs +3 -2
- package/dist/vite.d.cts +2 -0
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.mjs +3 -2
- package/package.json +67 -41
- package/dist/client/devtools/_nuxt/CQ-XZFu7.js +0 -54
- package/dist/client/devtools/_nuxt/builds/meta/1f5fbd7b-9d97-480e-9ae4-e02b4ff7018b.json +0 -1
- package/dist/client/devtools/_nuxt/entry.qOdop8tq.css +0 -1
- package/dist/client/devtools/_nuxt/error-404.D-rS9BDk.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.CfcCHs91.css +0 -1
- /package/dist/runtime/locale/{zh_hans.d.ts → az.d.ts} +0 -0
- /package/dist/runtime/locale/{zh_hant.d.ts → bn.d.ts} +0 -0
|
@@ -7,9 +7,9 @@ import theme from '#build/ui/radio-group'
|
|
|
7
7
|
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
8
8
|
import { tv } from '../utils/tv'
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const appConfigRadioGroup = _appConfig as AppConfig & { ui: { radioGroup: Partial<typeof theme> } }
|
|
11
11
|
|
|
12
|
-
const radioGroup = tv({ extend: tv(theme), ...(
|
|
12
|
+
const radioGroup = tv({ extend: tv(theme), ...(appConfigRadioGroup.ui?.radioGroup || {}) })
|
|
13
13
|
|
|
14
14
|
type RadioGroupVariants = VariantProps<typeof radioGroup>
|
|
15
15
|
|
|
@@ -87,7 +87,7 @@ const slots = defineSlots<RadioGroupSlots<T>>()
|
|
|
87
87
|
|
|
88
88
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'orientation', 'loop', 'required'), emits)
|
|
89
89
|
|
|
90
|
-
const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled } = useFormField<RadioGroupProps<T>>(props, { bind: false })
|
|
90
|
+
const { emitFormChange, emitFormInput, color, name, size, id: _id, disabled, ariaAttrs } = useFormField<RadioGroupProps<T>>(props, { bind: false })
|
|
91
91
|
const id = _id.value ?? useId()
|
|
92
92
|
|
|
93
93
|
const ui = computed(() => radioGroup({
|
|
@@ -147,7 +147,7 @@ function onUpdate(value: any) {
|
|
|
147
147
|
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
|
148
148
|
@update:model-value="onUpdate"
|
|
149
149
|
>
|
|
150
|
-
<fieldset :class="ui.fieldset({ class: props.ui?.fieldset })">
|
|
150
|
+
<fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
|
|
151
151
|
<legend v-if="legend || !!slots.legend" :class="ui.legend({ class: props.ui?.legend })">
|
|
152
152
|
<slot name="legend">
|
|
153
153
|
{{ legend }}
|
|
@@ -10,9 +10,9 @@ import { tv } from '../utils/tv'
|
|
|
10
10
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
|
11
11
|
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const appConfigSelect = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }
|
|
14
14
|
|
|
15
|
-
const select = tv({ extend: tv(theme), ...(
|
|
15
|
+
const select = tv({ extend: tv(theme), ...(appConfigSelect.ui?.select || {}) })
|
|
16
16
|
|
|
17
17
|
export interface SelectItem {
|
|
18
18
|
label?: string
|
|
@@ -129,11 +129,11 @@ const emits = defineEmits<SelectEmits<T, V, M>>()
|
|
|
129
129
|
const slots = defineSlots<SelectSlots<T, M>>()
|
|
130
130
|
|
|
131
131
|
const appConfig = useAppConfig()
|
|
132
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, '
|
|
132
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'disabled', 'autocomplete', 'required', 'multiple'), emits)
|
|
133
133
|
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as SelectContentProps)
|
|
134
134
|
const arrowProps = toRef(() => props.arrow as SelectArrowProps)
|
|
135
135
|
|
|
136
|
-
const { emitFormChange, emitFormInput, emitFormBlur, size: formGroupSize, color, id, name, highlight, disabled } = useFormField<InputProps>(props)
|
|
136
|
+
const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField<InputProps>(props)
|
|
137
137
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
|
138
138
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })))
|
|
139
139
|
|
|
@@ -179,6 +179,7 @@ function onUpdateOpen(value: boolean) {
|
|
|
179
179
|
} else {
|
|
180
180
|
const event = new FocusEvent('focus')
|
|
181
181
|
emits('focus', event)
|
|
182
|
+
emitFormFocus()
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
</script>
|
|
@@ -186,16 +187,17 @@ function onUpdateOpen(value: boolean) {
|
|
|
186
187
|
<!-- eslint-disable vue/no-template-shadow -->
|
|
187
188
|
<template>
|
|
188
189
|
<SelectRoot
|
|
189
|
-
:id="id"
|
|
190
190
|
v-slot="{ modelValue, open }"
|
|
191
|
-
v-bind="rootProps"
|
|
192
191
|
:name="name"
|
|
192
|
+
v-bind="rootProps"
|
|
193
193
|
:autocomplete="autocomplete"
|
|
194
194
|
:disabled="disabled"
|
|
195
|
+
:default-value="(defaultValue as (AcceptableValue | AcceptableValue[] | undefined))"
|
|
196
|
+
:model-value="(modelValue as (AcceptableValue | AcceptableValue[] | undefined))"
|
|
195
197
|
@update:model-value="onUpdate"
|
|
196
198
|
@update:open="onUpdateOpen"
|
|
197
199
|
>
|
|
198
|
-
<SelectTrigger :class="ui.base({ class: [props.class, props.ui?.base] })">
|
|
200
|
+
<SelectTrigger :id="id" :class="ui.base({ class: [props.class, props.ui?.base] })" v-bind="ariaAttrs">
|
|
199
201
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
200
202
|
<slot name="leading" :model-value="(modelValue as M extends true ? AcceptableValue[] : AcceptableValue)" :open="open" :ui="ui">
|
|
201
203
|
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
@@ -10,9 +10,9 @@ import { tv } from '../utils/tv'
|
|
|
10
10
|
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
|
11
11
|
import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils'
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const appConfigSelectMenu = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } }
|
|
14
14
|
|
|
15
|
-
const selectMenu = tv({ extend: tv(theme), ...(
|
|
15
|
+
const selectMenu = tv({ extend: tv(theme), ...(appConfigSelectMenu.ui?.selectMenu || {}) })
|
|
16
16
|
|
|
17
17
|
export interface SelectMenuItem {
|
|
18
18
|
label?: string
|
|
@@ -134,7 +134,7 @@ extendDevtoolsMeta({ defaultProps: { items: ['Option 1', 'Option 2', 'Option 3']
|
|
|
134
134
|
|
|
135
135
|
<script setup lang="ts" generic="T extends MaybeArrayOfArrayItem<I>, I extends MaybeArrayOfArray<SelectMenuItem | AcceptableValue | boolean> = MaybeArrayOfArray<SelectMenuItem | AcceptableValue | boolean>, V extends SelectItemKey<T> | undefined = undefined, M extends boolean = false">
|
|
136
136
|
import { computed, toRef, toRaw } from 'vue'
|
|
137
|
-
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, useForwardPropsEmits, useFilter } from 'reka-ui'
|
|
137
|
+
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, FocusScope, useForwardPropsEmits, useFilter } from 'reka-ui'
|
|
138
138
|
import { defu } from 'defu'
|
|
139
139
|
import { reactivePick, createReusableTemplate } from '@vueuse/core'
|
|
140
140
|
import { useAppConfig } from '#imports'
|
|
@@ -168,7 +168,7 @@ const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffse
|
|
|
168
168
|
const arrowProps = toRef(() => props.arrow as ComboboxArrowProps)
|
|
169
169
|
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t('selectMenu.search'), variant: 'none' }) as InputProps)
|
|
170
170
|
|
|
171
|
-
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled } = useFormField<InputProps>(props)
|
|
171
|
+
const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField<InputProps>(props)
|
|
172
172
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
|
173
173
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })))
|
|
174
174
|
|
|
@@ -272,6 +272,7 @@ function onUpdateOpen(value: boolean) {
|
|
|
272
272
|
} else {
|
|
273
273
|
const event = new FocusEvent('focus')
|
|
274
274
|
emits('focus', event)
|
|
275
|
+
emitFormFocus()
|
|
275
276
|
clearTimeout(timeoutId)
|
|
276
277
|
}
|
|
277
278
|
}
|
|
@@ -298,7 +299,7 @@ function onUpdateOpen(value: boolean) {
|
|
|
298
299
|
<ComboboxRoot
|
|
299
300
|
:id="id"
|
|
300
301
|
v-slot="{ modelValue, open }"
|
|
301
|
-
v-bind="rootProps"
|
|
302
|
+
v-bind="{ ...rootProps, ...ariaAttrs }"
|
|
302
303
|
ignore-filter
|
|
303
304
|
as-child
|
|
304
305
|
:name="name"
|
|
@@ -336,68 +337,70 @@ function onUpdateOpen(value: boolean) {
|
|
|
336
337
|
|
|
337
338
|
<ComboboxPortal :disabled="!portal">
|
|
338
339
|
<ComboboxContent :class="ui.content({ class: props.ui?.content })" v-bind="contentProps">
|
|
339
|
-
<
|
|
340
|
-
<
|
|
341
|
-
|
|
340
|
+
<FocusScope trapped :class="ui.focusScope({ class: props.ui?.focusScope })">
|
|
341
|
+
<ComboboxInput v-if="!!searchInput" v-model="searchTerm" :display-value="() => searchTerm" as-child>
|
|
342
|
+
<UInput autofocus autocomplete="off" v-bind="searchInputProps" :class="ui.input({ class: props.ui?.input })" />
|
|
343
|
+
</ComboboxInput>
|
|
344
|
+
|
|
345
|
+
<ComboboxEmpty :class="ui.empty({ class: props.ui?.empty })">
|
|
346
|
+
<slot name="empty" :search-term="searchTerm">
|
|
347
|
+
{{ searchTerm ? t('selectMenu.noMatch', { searchTerm }) : t('selectMenu.noData') }}
|
|
348
|
+
</slot>
|
|
349
|
+
</ComboboxEmpty>
|
|
350
|
+
|
|
351
|
+
<ComboboxViewport :class="ui.viewport({ class: props.ui?.viewport })">
|
|
352
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'top'" />
|
|
353
|
+
|
|
354
|
+
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
|
|
355
|
+
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
356
|
+
<ComboboxLabel v-if="item?.type === 'label'" :class="ui.label({ class: props.ui?.label })">
|
|
357
|
+
{{ get(item, props.labelKey as string) }}
|
|
358
|
+
</ComboboxLabel>
|
|
359
|
+
|
|
360
|
+
<ComboboxSeparator v-else-if="item?.type === 'separator'" :class="ui.separator({ class: props.ui?.separator })" />
|
|
361
|
+
|
|
362
|
+
<ComboboxItem
|
|
363
|
+
v-else
|
|
364
|
+
:class="ui.item({ class: props.ui?.item })"
|
|
365
|
+
:disabled="item.disabled"
|
|
366
|
+
:value="valueKey && typeof item === 'object' ? get(item, props.valueKey as string) : item"
|
|
367
|
+
@select="item.onSelect"
|
|
368
|
+
>
|
|
369
|
+
<slot name="item" :item="(item as T)" :index="index">
|
|
370
|
+
<slot name="item-leading" :item="(item as T)" :index="index">
|
|
371
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
|
|
372
|
+
<UAvatar v-else-if="item.avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
|
|
373
|
+
<UChip
|
|
374
|
+
v-else-if="item.chip"
|
|
375
|
+
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
|
376
|
+
inset
|
|
377
|
+
standalone
|
|
378
|
+
v-bind="item.chip"
|
|
379
|
+
:class="ui.itemLeadingChip({ class: props.ui?.itemLeadingChip })"
|
|
380
|
+
/>
|
|
381
|
+
</slot>
|
|
342
382
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
</ComboboxLabel>
|
|
357
|
-
|
|
358
|
-
<ComboboxSeparator v-else-if="item?.type === 'separator'" :class="ui.separator({ class: props.ui?.separator })" />
|
|
359
|
-
|
|
360
|
-
<ComboboxItem
|
|
361
|
-
v-else
|
|
362
|
-
:class="ui.item({ class: props.ui?.item })"
|
|
363
|
-
:disabled="item.disabled"
|
|
364
|
-
:value="valueKey && typeof item === 'object' ? get(item, props.valueKey as string) : item"
|
|
365
|
-
@select="item.onSelect"
|
|
366
|
-
>
|
|
367
|
-
<slot name="item" :item="(item as T)" :index="index">
|
|
368
|
-
<slot name="item-leading" :item="(item as T)" :index="index">
|
|
369
|
-
<UIcon v-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
|
|
370
|
-
<UAvatar v-else-if="item.avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
|
|
371
|
-
<UChip
|
|
372
|
-
v-else-if="item.chip"
|
|
373
|
-
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
|
374
|
-
inset
|
|
375
|
-
standalone
|
|
376
|
-
v-bind="item.chip"
|
|
377
|
-
:class="ui.itemLeadingChip({ class: props.ui?.itemLeadingChip })"
|
|
378
|
-
/>
|
|
383
|
+
<span :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
|
384
|
+
<slot name="item-label" :item="(item as T)" :index="index">
|
|
385
|
+
{{ typeof item === 'object' ? get(item, props.labelKey as string) : item }}
|
|
386
|
+
</slot>
|
|
387
|
+
</span>
|
|
388
|
+
|
|
389
|
+
<span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
|
|
390
|
+
<slot name="item-trailing" :item="(item as T)" :index="index" />
|
|
391
|
+
|
|
392
|
+
<ComboboxItemIndicator as-child>
|
|
393
|
+
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: props.ui?.itemTrailingIcon })" />
|
|
394
|
+
</ComboboxItemIndicator>
|
|
395
|
+
</span>
|
|
379
396
|
</slot>
|
|
397
|
+
</ComboboxItem>
|
|
398
|
+
</template>
|
|
399
|
+
</ComboboxGroup>
|
|
380
400
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
</slot>
|
|
385
|
-
</span>
|
|
386
|
-
|
|
387
|
-
<span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
|
|
388
|
-
<slot name="item-trailing" :item="(item as T)" :index="index" />
|
|
389
|
-
|
|
390
|
-
<ComboboxItemIndicator as-child>
|
|
391
|
-
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: props.ui?.itemTrailingIcon })" />
|
|
392
|
-
</ComboboxItemIndicator>
|
|
393
|
-
</span>
|
|
394
|
-
</slot>
|
|
395
|
-
</ComboboxItem>
|
|
396
|
-
</template>
|
|
397
|
-
</ComboboxGroup>
|
|
398
|
-
|
|
399
|
-
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'bottom'" />
|
|
400
|
-
</ComboboxViewport>
|
|
401
|
+
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'bottom'" />
|
|
402
|
+
</ComboboxViewport>
|
|
403
|
+
</FocusScope>
|
|
401
404
|
|
|
402
405
|
<ComboboxArrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
|
|
403
406
|
</ComboboxContent>
|
|
@@ -7,9 +7,9 @@ import theme from '#build/ui/separator'
|
|
|
7
7
|
import { tv } from '../utils/tv'
|
|
8
8
|
import type { AvatarProps } from '../types'
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const appConfigSeparator = _appConfig as AppConfig & { ui: { separator: Partial<typeof theme> } }
|
|
11
11
|
|
|
12
|
-
const separator = tv({ extend: tv(theme), ...(
|
|
12
|
+
const separator = tv({ extend: tv(theme), ...(appConfigSeparator.ui?.separator || {}) })
|
|
13
13
|
|
|
14
14
|
type SeparatorVariants = VariantProps<typeof separator>
|
|
15
15
|
|
|
@@ -5,9 +5,9 @@ import theme from '#build/ui/skeleton'
|
|
|
5
5
|
import { tv } from '../utils/tv'
|
|
6
6
|
import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const appConfigSkeleton = _appConfig as AppConfig & { ui: { skeleton: Partial<typeof theme> } }
|
|
9
9
|
|
|
10
|
-
const skeleton = tv({ extend: tv(theme), ...(
|
|
10
|
+
const skeleton = tv({ extend: tv(theme), ...(appConfigSkeleton.ui?.skeleton || {}) })
|
|
11
11
|
|
|
12
12
|
export interface SkeletonProps {
|
|
13
13
|
/**
|
|
@@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
|
8
8
|
import { tv } from '../utils/tv'
|
|
9
9
|
import type { ButtonProps } from '../types'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const appConfigSlideover = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }
|
|
12
12
|
|
|
13
|
-
const slideover = tv({ extend: tv(theme), ...(
|
|
13
|
+
const slideover = tv({ extend: tv(theme), ...(appConfigSlideover.ui?.slideover || {}) })
|
|
14
14
|
|
|
15
15
|
type SlideoverVariants = VariantProps<typeof slideover>
|
|
16
16
|
|
|
@@ -73,7 +73,7 @@ extendDevtoolsMeta({ example: 'SlideoverExample' })
|
|
|
73
73
|
|
|
74
74
|
<script setup lang="ts">
|
|
75
75
|
import { computed, toRef } from 'vue'
|
|
76
|
-
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, useForwardPropsEmits } from 'reka-ui'
|
|
76
|
+
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, VisuallyHidden, useForwardPropsEmits } from 'reka-ui'
|
|
77
77
|
import { reactivePick } from '@vueuse/core'
|
|
78
78
|
import { useAppConfig } from '#imports'
|
|
79
79
|
import { useLocale } from '../composables/useLocale'
|
|
@@ -124,6 +124,20 @@ const ui = computed(() => slideover({
|
|
|
124
124
|
<DialogOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
|
|
125
125
|
|
|
126
126
|
<DialogContent :data-side="side" :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" v-on="contentEvents">
|
|
127
|
+
<VisuallyHidden v-if="!!slots.content && ((title || !!slots.title) || (description || !!slots.description))">
|
|
128
|
+
<DialogTitle v-if="title || !!slots.title">
|
|
129
|
+
<slot name="title">
|
|
130
|
+
{{ title }}
|
|
131
|
+
</slot>
|
|
132
|
+
</DialogTitle>
|
|
133
|
+
|
|
134
|
+
<DialogDescription v-if="description || !!slots.description">
|
|
135
|
+
<slot name="description">
|
|
136
|
+
{{ description }}
|
|
137
|
+
</slot>
|
|
138
|
+
</DialogDescription>
|
|
139
|
+
</VisuallyHidden>
|
|
140
|
+
|
|
127
141
|
<slot name="content">
|
|
128
142
|
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
129
143
|
<slot name="header">
|
|
@@ -6,9 +6,9 @@ import _appConfig from '#build/app.config'
|
|
|
6
6
|
import theme from '#build/ui/slider'
|
|
7
7
|
import { tv } from '../utils/tv'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const appConfigSlider = _appConfig as AppConfig & { ui: { slider: Partial<typeof theme> } }
|
|
10
10
|
|
|
11
|
-
const slider = tv({ extend: tv(theme), ...(
|
|
11
|
+
const slider = tv({ extend: tv(theme), ...(appConfigSlider.ui?.slider || {}) })
|
|
12
12
|
|
|
13
13
|
type SliderVariants = VariantProps<typeof slider>
|
|
14
14
|
|
|
@@ -55,7 +55,7 @@ const modelValue = defineModel<number | number[]>()
|
|
|
55
55
|
|
|
56
56
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'orientation', 'min', 'max', 'step', 'minStepsBetweenThumbs', 'inverted'), emits)
|
|
57
57
|
|
|
58
|
-
const { id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<SliderProps>(props)
|
|
58
|
+
const { id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<SliderProps>(props)
|
|
59
59
|
|
|
60
60
|
const defaultSliderValue = computed(() => {
|
|
61
61
|
if (typeof props.defaultValue === 'number') {
|
|
@@ -95,7 +95,7 @@ function onChange(value: any) {
|
|
|
95
95
|
|
|
96
96
|
<template>
|
|
97
97
|
<SliderRoot
|
|
98
|
-
v-bind="rootProps"
|
|
98
|
+
v-bind="{ ...rootProps, ...ariaAttrs }"
|
|
99
99
|
:id="id"
|
|
100
100
|
v-model="sliderValue"
|
|
101
101
|
:name="name"
|
|
@@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
|
8
8
|
import { tv } from '../utils/tv'
|
|
9
9
|
import type { DynamicSlots } from '../types/utils'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const appConfigStepper = _appConfig as AppConfig & { ui: { stepper: Partial<typeof theme> } }
|
|
12
12
|
|
|
13
|
-
const stepper = tv({ extend: tv(theme), ...(
|
|
13
|
+
const stepper = tv({ extend: tv(theme), ...(appConfigStepper.ui?.stepper || {}) })
|
|
14
14
|
|
|
15
15
|
type StepperVariants = VariantProps<typeof stepper>
|
|
16
16
|
|
|
@@ -163,7 +163,7 @@ defineExpose({
|
|
|
163
163
|
|
|
164
164
|
<div v-if="currentStep?.content || !!slots.content || (currentStep?.slot && !!slots[currentStep.slot]) || (currentStep?.value && !!slots[currentStep.value])" :class="ui.content({ class: props.ui?.description })">
|
|
165
165
|
<slot
|
|
166
|
-
:name="!!slots[currentStep?.slot ?? currentStep.value] ? currentStep.slot ?? currentStep.value : 'content'"
|
|
166
|
+
:name="!!slots[currentStep?.slot ?? currentStep.value!] ? currentStep.slot ?? currentStep.value : 'content'"
|
|
167
167
|
:item="currentStep"
|
|
168
168
|
>
|
|
169
169
|
{{ currentStep?.content }}
|
|
@@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta'
|
|
|
8
8
|
import { tv } from '../utils/tv'
|
|
9
9
|
import type { PartialString } from '../types/utils'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const appConfigSwitch = _appConfig as AppConfig & { ui: { switch: Partial<typeof theme> } }
|
|
12
12
|
|
|
13
|
-
const switchTv = tv({ extend: tv(theme), ...(
|
|
13
|
+
const switchTv = tv({ extend: tv(theme), ...(appConfigSwitch.ui?.switch || {}) })
|
|
14
14
|
|
|
15
15
|
type SwitchVariants = VariantProps<typeof switchTv>
|
|
16
16
|
|
|
@@ -68,7 +68,7 @@ const modelValue = defineModel<boolean>({ default: undefined })
|
|
|
68
68
|
const appConfig = useAppConfig()
|
|
69
69
|
const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
|
|
70
70
|
|
|
71
|
-
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<SwitchProps>(props)
|
|
71
|
+
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<SwitchProps>(props)
|
|
72
72
|
const id = _id.value ?? useId()
|
|
73
73
|
|
|
74
74
|
const ui = computed(() => switchTv({
|
|
@@ -93,7 +93,7 @@ function onUpdate(value: any) {
|
|
|
93
93
|
<div :class="ui.container({ class: props.ui?.container })">
|
|
94
94
|
<SwitchRoot
|
|
95
95
|
:id="id"
|
|
96
|
-
v-bind="rootProps"
|
|
96
|
+
v-bind="{ ...rootProps, ...ariaAttrs }"
|
|
97
97
|
v-model="modelValue"
|
|
98
98
|
:name="name"
|
|
99
99
|
:disabled="disabled || loading"
|
|
@@ -5,24 +5,36 @@ import type { VariantProps } from 'tailwind-variants'
|
|
|
5
5
|
import type { AppConfig } from '@nuxt/schema'
|
|
6
6
|
import type { RowData } from '@tanstack/table-core'
|
|
7
7
|
import type {
|
|
8
|
-
|
|
8
|
+
CellContext,
|
|
9
9
|
ColumnDef,
|
|
10
|
+
ColumnFiltersOptions,
|
|
10
11
|
ColumnFiltersState,
|
|
12
|
+
ColumnOrderState,
|
|
13
|
+
ColumnPinningOptions,
|
|
11
14
|
ColumnPinningState,
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
ColumnSizingInfoState,
|
|
16
|
+
ColumnSizingOptions,
|
|
17
|
+
ColumnSizingState,
|
|
18
|
+
CoreOptions,
|
|
19
|
+
ExpandedOptions,
|
|
14
20
|
ExpandedState,
|
|
15
|
-
|
|
21
|
+
FacetedOptions,
|
|
16
22
|
GlobalFilterOptions,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
GroupingOptions,
|
|
24
|
+
GroupingState,
|
|
25
|
+
HeaderContext,
|
|
26
|
+
PaginationOptions,
|
|
27
|
+
PaginationState,
|
|
28
|
+
Row,
|
|
29
|
+
RowPinningOptions,
|
|
30
|
+
RowPinningState,
|
|
22
31
|
RowSelectionOptions,
|
|
32
|
+
RowSelectionState,
|
|
33
|
+
SortingOptions,
|
|
34
|
+
SortingState,
|
|
23
35
|
Updater,
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
VisibilityOptions,
|
|
37
|
+
VisibilityState
|
|
26
38
|
} from '@tanstack/vue-table'
|
|
27
39
|
import _appConfig from '#build/app.config'
|
|
28
40
|
import theme from '#build/ui/table'
|
|
@@ -38,19 +50,23 @@ declare module '@tanstack/table-core' {
|
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
52
|
|
|
41
|
-
const
|
|
53
|
+
const appConfigTable = _appConfig as AppConfig & { ui: { table: Partial<typeof theme> } }
|
|
42
54
|
|
|
43
|
-
const table = tv({ extend: tv(theme), ...(
|
|
55
|
+
const table = tv({ extend: tv(theme), ...(appConfigTable.ui?.table || {}) })
|
|
44
56
|
|
|
45
57
|
type TableVariants = VariantProps<typeof table>
|
|
46
58
|
|
|
47
|
-
export type
|
|
59
|
+
export type TableData = RowData
|
|
60
|
+
|
|
61
|
+
export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D>
|
|
48
62
|
|
|
49
|
-
export interface TableData {
|
|
50
|
-
[
|
|
63
|
+
export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
64
|
+
state?: CoreOptions<T>['state']
|
|
65
|
+
onStateChange?: CoreOptions<T>['onStateChange']
|
|
66
|
+
renderFallbackValue?: CoreOptions<T>['renderFallbackValue']
|
|
51
67
|
}
|
|
52
68
|
|
|
53
|
-
export interface TableProps<T> {
|
|
69
|
+
export interface TableProps<T extends TableData> extends TableOptions<T> {
|
|
54
70
|
/**
|
|
55
71
|
* The element or component this component should render as.
|
|
56
72
|
* @defaultValue 'div'
|
|
@@ -83,6 +99,11 @@ export interface TableProps<T> {
|
|
|
83
99
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-pinning)
|
|
84
100
|
*/
|
|
85
101
|
columnPinningOptions?: Omit<ColumnPinningOptions, 'onColumnPinningChange'>
|
|
102
|
+
/**
|
|
103
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-sizing#table-options)
|
|
104
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-sizing)
|
|
105
|
+
*/
|
|
106
|
+
columnSizingOptions?: Omit<ColumnSizingOptions, 'onColumnSizingChange' | 'onColumnSizingInfoChange'>
|
|
86
107
|
/**
|
|
87
108
|
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-visibility#table-options)
|
|
88
109
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-visibility)
|
|
@@ -93,6 +114,11 @@ export interface TableProps<T> {
|
|
|
93
114
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/sorting)
|
|
94
115
|
*/
|
|
95
116
|
sortingOptions?: Omit<SortingOptions<T>, 'getSortedRowModel' | 'onSortingChange'>
|
|
117
|
+
/**
|
|
118
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/grouping#table-options)
|
|
119
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/grouping)
|
|
120
|
+
*/
|
|
121
|
+
groupingOptions?: Omit<GroupingOptions, 'onGroupingChange'>
|
|
96
122
|
/**
|
|
97
123
|
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/expanding#table-options)
|
|
98
124
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/expanding)
|
|
@@ -103,6 +129,21 @@ export interface TableProps<T> {
|
|
|
103
129
|
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
|
|
104
130
|
*/
|
|
105
131
|
rowSelectionOptions?: Omit<RowSelectionOptions<T>, 'onRowSelectionChange'>
|
|
132
|
+
/**
|
|
133
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-pinning#table-options)
|
|
134
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-pinning)
|
|
135
|
+
*/
|
|
136
|
+
rowPinningOptions?: Omit<RowPinningOptions<T>, 'onRowPinningChange'>
|
|
137
|
+
/**
|
|
138
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/pagination#table-options)
|
|
139
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/pagination)
|
|
140
|
+
*/
|
|
141
|
+
paginationOptions?: Omit<PaginationOptions, 'onPaginationChange'>
|
|
142
|
+
/**
|
|
143
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#table-options)
|
|
144
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
|
|
145
|
+
*/
|
|
146
|
+
facetedOptions?: FacetedOptions<T>
|
|
106
147
|
class?: any
|
|
107
148
|
ui?: Partial<typeof table.slots>
|
|
108
149
|
}
|
|
@@ -121,8 +162,9 @@ export type TableSlots<T> = {
|
|
|
121
162
|
<script setup lang="ts" generic="T extends TableData">
|
|
122
163
|
import { computed } from 'vue'
|
|
123
164
|
import { Primitive } from 'reka-ui'
|
|
124
|
-
import { FlexRender, getCoreRowModel, getFilteredRowModel, getSortedRowModel, getExpandedRowModel, useVueTable } from '@tanstack/vue-table'
|
|
125
165
|
import { upperFirst } from 'scule'
|
|
166
|
+
import { FlexRender, getCoreRowModel, getFilteredRowModel, getSortedRowModel, getExpandedRowModel, useVueTable } from '@tanstack/vue-table'
|
|
167
|
+
import { reactiveOmit } from '@vueuse/core'
|
|
126
168
|
import { useLocale } from '../composables/useLocale'
|
|
127
169
|
|
|
128
170
|
const props = defineProps<TableProps<T>>()
|
|
@@ -142,13 +184,20 @@ const ui = computed(() => table({
|
|
|
142
184
|
|
|
143
185
|
const globalFilterState = defineModel<string>('globalFilter', { default: undefined })
|
|
144
186
|
const columnFiltersState = defineModel<ColumnFiltersState>('columnFilters', { default: [] })
|
|
187
|
+
const columnOrderState = defineModel<ColumnOrderState>('columnOrder', { default: [] })
|
|
145
188
|
const columnVisibilityState = defineModel<VisibilityState>('columnVisibility', { default: {} })
|
|
146
189
|
const columnPinningState = defineModel<ColumnPinningState>('columnPinning', { default: {} })
|
|
190
|
+
const columnSizingState = defineModel<ColumnSizingState>('columnSizing', { default: {} })
|
|
191
|
+
const columnSizingInfoState = defineModel<ColumnSizingInfoState>('columnSizingInfo', { default: {} })
|
|
147
192
|
const rowSelectionState = defineModel<RowSelectionState>('rowSelection', { default: {} })
|
|
193
|
+
const rowPinningState = defineModel<RowPinningState>('rowPinning', { default: {} })
|
|
148
194
|
const sortingState = defineModel<SortingState>('sorting', { default: [] })
|
|
195
|
+
const groupingState = defineModel<GroupingState>('grouping', { default: [] })
|
|
149
196
|
const expandedState = defineModel<ExpandedState>('expanded', { default: {} })
|
|
197
|
+
const paginationState = defineModel<PaginationState>('pagination', { default: {} })
|
|
150
198
|
|
|
151
199
|
const tableApi = useVueTable({
|
|
200
|
+
...reactiveOmit(props, 'as', 'data', 'columns', 'caption', 'sticky', 'loading', 'loadingColor', 'loadingAnimation', 'class', 'ui'),
|
|
152
201
|
data,
|
|
153
202
|
columns: columns.value,
|
|
154
203
|
getCoreRowModel: getCoreRowModel(),
|
|
@@ -157,18 +206,29 @@ const tableApi = useVueTable({
|
|
|
157
206
|
...(props.columnFiltersOptions || {}),
|
|
158
207
|
getFilteredRowModel: getFilteredRowModel(),
|
|
159
208
|
onColumnFiltersChange: updaterOrValue => valueUpdater(updaterOrValue, columnFiltersState),
|
|
209
|
+
onColumnOrderChange: updaterOrValue => valueUpdater(updaterOrValue, columnOrderState),
|
|
160
210
|
...(props.visibilityOptions || {}),
|
|
161
211
|
onColumnVisibilityChange: updaterOrValue => valueUpdater(updaterOrValue, columnVisibilityState),
|
|
162
212
|
...(props.columnPinningOptions || {}),
|
|
163
213
|
onColumnPinningChange: updaterOrValue => valueUpdater(updaterOrValue, columnPinningState),
|
|
214
|
+
...(props.columnSizingOptions || {}),
|
|
215
|
+
onColumnSizingChange: updaterOrValue => valueUpdater(updaterOrValue, columnSizingState),
|
|
216
|
+
onColumnSizingInfoChange: updaterOrValue => valueUpdater(updaterOrValue, columnSizingInfoState),
|
|
164
217
|
...(props.rowSelectionOptions || {}),
|
|
165
218
|
onRowSelectionChange: updaterOrValue => valueUpdater(updaterOrValue, rowSelectionState),
|
|
219
|
+
...(props.rowPinningOptions || {}),
|
|
220
|
+
onRowPinningChange: updaterOrValue => valueUpdater(updaterOrValue, rowPinningState),
|
|
166
221
|
...(props.sortingOptions || {}),
|
|
167
222
|
getSortedRowModel: getSortedRowModel(),
|
|
168
223
|
onSortingChange: updaterOrValue => valueUpdater(updaterOrValue, sortingState),
|
|
224
|
+
...(props.groupingOptions || {}),
|
|
225
|
+
onGroupingChange: updaterOrValue => valueUpdater(updaterOrValue, groupingState),
|
|
169
226
|
...(props.expandedOptions || {}),
|
|
170
227
|
getExpandedRowModel: getExpandedRowModel(),
|
|
171
228
|
onExpandedChange: updaterOrValue => valueUpdater(updaterOrValue, expandedState),
|
|
229
|
+
...(props.paginationOptions || {}),
|
|
230
|
+
onPaginationChange: updaterOrValue => valueUpdater(updaterOrValue, paginationState),
|
|
231
|
+
...(props.facetedOptions || {}),
|
|
172
232
|
state: {
|
|
173
233
|
get globalFilter() {
|
|
174
234
|
return globalFilterState.value
|
|
@@ -176,6 +236,9 @@ const tableApi = useVueTable({
|
|
|
176
236
|
get columnFilters() {
|
|
177
237
|
return columnFiltersState.value
|
|
178
238
|
},
|
|
239
|
+
get columnOrder() {
|
|
240
|
+
return columnOrderState.value
|
|
241
|
+
},
|
|
179
242
|
get columnVisibility() {
|
|
180
243
|
return columnVisibilityState.value
|
|
181
244
|
},
|
|
@@ -190,6 +253,21 @@ const tableApi = useVueTable({
|
|
|
190
253
|
},
|
|
191
254
|
get sorting() {
|
|
192
255
|
return sortingState.value
|
|
256
|
+
},
|
|
257
|
+
get grouping() {
|
|
258
|
+
return groupingState.value
|
|
259
|
+
},
|
|
260
|
+
get rowPinning() {
|
|
261
|
+
return rowPinningState.value
|
|
262
|
+
},
|
|
263
|
+
get columnSizing() {
|
|
264
|
+
return columnSizingState.value
|
|
265
|
+
},
|
|
266
|
+
get columnSizingInfo() {
|
|
267
|
+
return columnSizingInfoState.value
|
|
268
|
+
},
|
|
269
|
+
get pagination() {
|
|
270
|
+
return paginationState.value
|
|
193
271
|
}
|
|
194
272
|
}
|
|
195
273
|
})
|
|
@@ -9,9 +9,9 @@ import { tv } from '../utils/tv'
|
|
|
9
9
|
import type { AvatarProps } from '../types'
|
|
10
10
|
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const appConfigTabs = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }
|
|
13
13
|
|
|
14
|
-
const tabs = tv({ extend: tv(theme), ...(
|
|
14
|
+
const tabs = tv({ extend: tv(theme), ...(appConfigTabs.ui?.tabs || {}) })
|
|
15
15
|
|
|
16
16
|
export interface TabsItem {
|
|
17
17
|
label?: string
|