@nuxt/ui 3.0.0-beta.2 → 3.0.0-beta.4
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/button.ts +8 -0
- package/.nuxt/ui/pagination.ts +6 -1
- package/.nuxt/ui/table.ts +2 -1
- package/dist/module.cjs +2 -2
- package/dist/module.json +2 -2
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +7 -0
- package/dist/runtime/components/Alert.vue +14 -0
- package/dist/runtime/components/App.vue +6 -6
- package/dist/runtime/components/Avatar.vue +8 -1
- package/dist/runtime/components/AvatarGroup.vue +3 -0
- package/dist/runtime/components/Badge.vue +9 -0
- package/dist/runtime/components/Breadcrumb.vue +4 -0
- package/dist/runtime/components/Button.vue +57 -18
- package/dist/runtime/components/ButtonGroup.vue +3 -0
- package/dist/runtime/components/Calendar.vue +10 -0
- package/dist/runtime/components/Card.vue +3 -0
- package/dist/runtime/components/Carousel.vue +6 -0
- package/dist/runtime/components/Checkbox.vue +8 -0
- package/dist/runtime/components/Chip.vue +10 -0
- package/dist/runtime/components/ColorPicker.vue +3 -0
- package/dist/runtime/components/CommandPalette.vue +10 -1
- package/dist/runtime/components/ContextMenu.vue +9 -0
- package/dist/runtime/components/ContextMenuContent.vue +9 -0
- package/dist/runtime/components/DropdownMenu.vue +9 -0
- package/dist/runtime/components/DropdownMenuContent.vue +9 -0
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/FormField.vue +4 -1
- package/dist/runtime/components/Input.vue +16 -3
- package/dist/runtime/components/InputMenu.vue +18 -3
- package/dist/runtime/components/InputNumber.vue +2 -0
- package/dist/runtime/components/Kbd.vue +6 -0
- package/dist/runtime/components/Link.vue +8 -4
- package/dist/runtime/components/LinkBase.vue +4 -2
- package/dist/runtime/components/Modal.vue +1 -0
- package/dist/runtime/components/NavigationMenu.vue +17 -0
- package/dist/runtime/components/Pagination.vue +16 -11
- package/dist/runtime/components/PinInput.vue +13 -0
- package/dist/runtime/components/Progress.vue +10 -0
- package/dist/runtime/components/RadioGroup.vue +6 -0
- package/dist/runtime/components/Select.vue +14 -0
- package/dist/runtime/components/SelectMenu.vue +16 -1
- package/dist/runtime/components/Separator.vue +13 -1
- package/dist/runtime/components/Slideover.vue +5 -0
- package/dist/runtime/components/Slider.vue +6 -0
- package/dist/runtime/components/Stepper.vue +13 -0
- package/dist/runtime/components/Switch.vue +15 -2
- package/dist/runtime/components/Table.vue +15 -2
- package/dist/runtime/components/Tabs.vue +12 -0
- package/dist/runtime/components/Textarea.vue +16 -3
- package/dist/runtime/components/Toast.vue +11 -0
- package/dist/runtime/components/Toaster.vue +4 -0
- package/dist/runtime/components/Tree.vue +15 -0
- package/dist/runtime/composables/defineLocale.d.ts +4 -4
- package/dist/runtime/composables/useComponentIcons.d.ts +13 -3
- package/dist/runtime/composables/useLocale.d.ts +3 -3
- package/dist/runtime/composables/useLocale.js +3 -3
- package/dist/runtime/locale/ar.d.ts +2 -1
- package/dist/runtime/locale/az.d.ts +2 -1
- package/dist/runtime/locale/bn.d.ts +2 -1
- package/dist/runtime/locale/cs.d.ts +2 -1
- package/dist/runtime/locale/da.d.ts +2 -1
- package/dist/runtime/locale/de.d.ts +2 -1
- package/dist/runtime/locale/el.d.ts +2 -1
- package/dist/runtime/locale/en.d.ts +2 -1
- package/dist/runtime/locale/es.d.ts +2 -1
- package/dist/runtime/locale/et.d.ts +2 -1
- package/dist/runtime/locale/fa_ir.d.ts +2 -1
- package/dist/runtime/locale/fi.d.ts +2 -1
- package/dist/runtime/locale/fr.d.ts +2 -1
- package/dist/runtime/locale/he.d.ts +2 -1
- package/dist/runtime/locale/hi.d.ts +2 -1
- package/dist/runtime/locale/hu.d.ts +2 -1
- package/dist/runtime/locale/id.d.ts +2 -1
- package/dist/runtime/locale/index.d.ts +3 -2
- package/dist/runtime/locale/index.js +3 -2
- package/dist/runtime/locale/it.d.ts +2 -1
- package/dist/runtime/locale/ja.d.ts +2 -1
- package/dist/runtime/locale/km.d.ts +2 -1
- package/dist/runtime/locale/ko.d.ts +2 -1
- package/dist/runtime/locale/nb_no.d.ts +2 -1
- package/dist/runtime/locale/nl.d.ts +2 -1
- package/dist/runtime/locale/pl.d.ts +2 -1
- package/dist/runtime/locale/pt.d.ts +2 -1
- package/dist/runtime/locale/pt_br.d.ts +2 -1
- package/dist/runtime/locale/ru.d.ts +2 -1
- package/dist/runtime/locale/sk.d.ts +2 -1
- package/dist/runtime/locale/sv.d.ts +2 -1
- package/dist/runtime/locale/th.d.ts +2 -1
- package/dist/runtime/locale/tr.d.ts +2 -1
- package/dist/runtime/locale/uk.d.ts +2 -1
- package/dist/runtime/locale/vi.d.ts +2 -1
- package/dist/runtime/locale/zh_cn.d.ts +2 -1
- package/dist/runtime/locale/zh_tw.d.ts +2 -1
- package/dist/runtime/plugins/colors.js +3 -1
- package/dist/runtime/types/form.d.ts +1 -1
- package/dist/runtime/types/locale.d.ts +2 -2
- package/dist/runtime/utils/index.js +1 -1
- package/dist/runtime/utils/locale.d.ts +5 -5
- package/dist/runtime/utils/tv.d.ts +1 -1
- package/dist/runtime/vue/components/Link.vue +8 -4
- package/dist/runtime/vue/plugins/head.d.ts +1 -1
- package/dist/runtime/vue/plugins/head.js +4 -3
- package/dist/runtime/vue/stubs.d.ts +2 -0
- package/dist/runtime/vue/stubs.js +2 -0
- package/dist/shared/{ui.DfK2RX6G.cjs → ui.COBs1u5H.cjs} +23 -5
- package/dist/shared/{ui.DSPu6Y8j.mjs → ui.yjbGE7Dx.mjs} +23 -5
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +25 -26
|
@@ -29,7 +29,7 @@ export interface FormEmits<T extends object> {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface FormSlots {
|
|
32
|
-
default(props?: {}): any
|
|
32
|
+
default(props?: { errors: FormError[] }): any
|
|
33
33
|
}
|
|
34
34
|
</script>
|
|
35
35
|
|
|
@@ -69,7 +69,7 @@ onMounted(async () => {
|
|
|
69
69
|
nestedForms.value.set(event.formId, { validate: event.validate })
|
|
70
70
|
} else if (event.type === 'detach') {
|
|
71
71
|
nestedForms.value.delete(event.formId)
|
|
72
|
-
} else if (props.validateOn?.includes(event.type)) {
|
|
72
|
+
} else if (props.validateOn?.includes(event.type) && !loading.value) {
|
|
73
73
|
if (event.type !== 'input') {
|
|
74
74
|
await _validate({ name: event.name, silent: true, nested: false })
|
|
75
75
|
} else if (event.eager || blurredFields.has(event.name)) {
|
|
@@ -121,7 +121,7 @@ const blurredFields = new Set<keyof T>()
|
|
|
121
121
|
function resolveErrorIds(errs: FormError[]): FormErrorWithId[] {
|
|
122
122
|
return errs.map(err => ({
|
|
123
123
|
...err,
|
|
124
|
-
id: inputs.value[err.name]?.id
|
|
124
|
+
id: err?.name ? inputs.value[err.name]?.id : undefined
|
|
125
125
|
}))
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -159,12 +159,12 @@ async function _validate(opts: { name?: keyof T | (keyof T)[], silent?: boolean,
|
|
|
159
159
|
if (names) {
|
|
160
160
|
const otherErrors = errors.value.filter(error => !names.some((name) => {
|
|
161
161
|
const pattern = inputs.value?.[name]?.pattern
|
|
162
|
-
return name === error.name || (pattern && error.name
|
|
162
|
+
return name === error.name || (pattern && error.name?.match(pattern))
|
|
163
163
|
}))
|
|
164
164
|
|
|
165
165
|
const pathErrors = (await getErrors()).filter(error => names.some((name) => {
|
|
166
166
|
const pattern = inputs.value?.[name]?.pattern
|
|
167
|
-
return name === error.name || (pattern && error.name
|
|
167
|
+
return name === error.name || (pattern && error.name?.match(pattern))
|
|
168
168
|
}))
|
|
169
169
|
|
|
170
170
|
errors.value = otherErrors.concat(pathErrors)
|
|
@@ -269,6 +269,6 @@ defineExpose<Form<T>>({
|
|
|
269
269
|
:class="form({ class: props.class })"
|
|
270
270
|
@submit.prevent="onSubmitWrapper"
|
|
271
271
|
>
|
|
272
|
-
<slot />
|
|
272
|
+
<slot :errors="errors" />
|
|
273
273
|
</component>
|
|
274
274
|
</template>
|
|
@@ -26,6 +26,9 @@ export interface FormFieldProps {
|
|
|
26
26
|
help?: string
|
|
27
27
|
error?: string | boolean
|
|
28
28
|
hint?: string
|
|
29
|
+
/**
|
|
30
|
+
* @defaultValue 'md'
|
|
31
|
+
*/
|
|
29
32
|
size?: FormFieldVariants['size']
|
|
30
33
|
required?: boolean
|
|
31
34
|
eagerValidation?: boolean
|
|
@@ -60,7 +63,7 @@ const ui = computed(() => formField({
|
|
|
60
63
|
|
|
61
64
|
const formErrors = inject<Ref<FormError[]> | null>('form-errors', null)
|
|
62
65
|
|
|
63
|
-
const error = computed(() => props.error || formErrors?.value?.find(error => error.name === props.name || (props.errorPattern && error.name.match(props.errorPattern)))?.message)
|
|
66
|
+
const error = computed(() => props.error || formErrors?.value?.find(error => error.name && (error.name === props.name || (props.errorPattern && error.name.match(props.errorPattern))))?.message)
|
|
64
67
|
|
|
65
68
|
const id = ref(useId())
|
|
66
69
|
// Copies id's initial value to bind aria-attributes such as aria-describedby.
|
|
@@ -26,8 +26,17 @@ export interface InputProps extends UseComponentIconsProps {
|
|
|
26
26
|
type?: InputHTMLAttributes['type']
|
|
27
27
|
/** The placeholder text when the input is empty. */
|
|
28
28
|
placeholder?: string
|
|
29
|
+
/**
|
|
30
|
+
* @defaultValue 'primary'
|
|
31
|
+
*/
|
|
29
32
|
color?: InputVariants['color']
|
|
33
|
+
/**
|
|
34
|
+
* @defaultValue 'outline'
|
|
35
|
+
*/
|
|
30
36
|
variant?: InputVariants['variant']
|
|
37
|
+
/**
|
|
38
|
+
* @defaultValue 'md'
|
|
39
|
+
*/
|
|
31
40
|
size?: InputVariants['size']
|
|
32
41
|
required?: boolean
|
|
33
42
|
autocomplete?: InputHTMLAttributes['autocomplete']
|
|
@@ -73,7 +82,7 @@ const props = withDefaults(defineProps<InputProps>(), {
|
|
|
73
82
|
const emits = defineEmits<InputEmits>()
|
|
74
83
|
const slots = defineSlots<InputSlots>()
|
|
75
84
|
|
|
76
|
-
const [modelValue, modelModifiers] = defineModel<string | number>()
|
|
85
|
+
const [modelValue, modelModifiers] = defineModel<string | number | null>()
|
|
77
86
|
|
|
78
87
|
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField<InputProps>(props, { deferInputValidation: true })
|
|
79
88
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
|
@@ -102,15 +111,19 @@ function autoFocus() {
|
|
|
102
111
|
}
|
|
103
112
|
|
|
104
113
|
// Custom function to handle the v-model properties
|
|
105
|
-
function updateInput(value: string) {
|
|
114
|
+
function updateInput(value: string | null) {
|
|
106
115
|
if (modelModifiers.trim) {
|
|
107
|
-
value = value
|
|
116
|
+
value = value?.trim() ?? null
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
if (modelModifiers.number || props.type === 'number') {
|
|
111
120
|
value = looseToNumber(value)
|
|
112
121
|
}
|
|
113
122
|
|
|
123
|
+
if (modelModifiers.nullify) {
|
|
124
|
+
value ||= null
|
|
125
|
+
}
|
|
126
|
+
|
|
114
127
|
modelValue.value = value
|
|
115
128
|
emitFormInput()
|
|
116
129
|
}
|
|
@@ -16,6 +16,9 @@ const inputMenu = tv({ extend: tv(theme), ...(appConfigInputMenu.ui?.inputMenu |
|
|
|
16
16
|
|
|
17
17
|
export interface InputMenuItem {
|
|
18
18
|
label?: string
|
|
19
|
+
/**
|
|
20
|
+
* @IconifyIcon
|
|
21
|
+
*/
|
|
19
22
|
icon?: string
|
|
20
23
|
avatar?: AvatarProps
|
|
21
24
|
chip?: ChipProps
|
|
@@ -40,8 +43,17 @@ export interface InputMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends Ma
|
|
|
40
43
|
type?: InputHTMLAttributes['type']
|
|
41
44
|
/** The placeholder text when the input is empty. */
|
|
42
45
|
placeholder?: string
|
|
46
|
+
/**
|
|
47
|
+
* @defaultValue 'primary'
|
|
48
|
+
*/
|
|
43
49
|
color?: InputMenuVariants['color']
|
|
50
|
+
/**
|
|
51
|
+
* @defaultValue 'outline'
|
|
52
|
+
*/
|
|
44
53
|
variant?: InputMenuVariants['variant']
|
|
54
|
+
/**
|
|
55
|
+
* @defaultValue 'md'
|
|
56
|
+
*/
|
|
45
57
|
size?: InputMenuVariants['size']
|
|
46
58
|
required?: boolean
|
|
47
59
|
autofocus?: boolean
|
|
@@ -49,17 +61,20 @@ export interface InputMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends Ma
|
|
|
49
61
|
/**
|
|
50
62
|
* The icon displayed to open the menu.
|
|
51
63
|
* @defaultValue appConfig.ui.icons.chevronDown
|
|
64
|
+
* @IconifyIcon
|
|
52
65
|
*/
|
|
53
66
|
trailingIcon?: string
|
|
54
67
|
/**
|
|
55
68
|
* The icon displayed when an item is selected.
|
|
56
69
|
* @defaultValue appConfig.ui.icons.check
|
|
70
|
+
* @IconifyIcon
|
|
57
71
|
*/
|
|
58
72
|
selectedIcon?: string
|
|
59
73
|
/**
|
|
60
74
|
* The icon displayed to delete a tag.
|
|
61
75
|
* Works only when `multiple` is `true`.
|
|
62
76
|
* @defaultValue appConfig.ui.icons.close
|
|
77
|
+
* @IconifyIcon
|
|
63
78
|
*/
|
|
64
79
|
deleteIcon?: string
|
|
65
80
|
/**
|
|
@@ -142,7 +157,7 @@ export interface InputMenuSlots<T, M extends boolean> {
|
|
|
142
157
|
import { computed, ref, toRef, onMounted, toRaw } from 'vue'
|
|
143
158
|
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from 'reka-ui'
|
|
144
159
|
import { defu } from 'defu'
|
|
145
|
-
import { isEqual } from 'ohash'
|
|
160
|
+
import { isEqual } from 'ohash/utils'
|
|
146
161
|
import { reactivePick, createReusableTemplate } from '@vueuse/core'
|
|
147
162
|
import { useAppConfig } from '#imports'
|
|
148
163
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
@@ -171,7 +186,7 @@ const { t } = useLocale()
|
|
|
171
186
|
const appConfig = useAppConfig()
|
|
172
187
|
const { contains } = useFilter({ sensitivity: 'base' })
|
|
173
188
|
|
|
174
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'multiple', 'resetSearchTermOnBlur', 'highlightOnHover', 'ignoreFilter'), emits)
|
|
189
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'required', 'multiple', 'resetSearchTermOnBlur', 'highlightOnHover', 'ignoreFilter'), emits)
|
|
175
190
|
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as ComboboxContentProps)
|
|
176
191
|
const arrowProps = toRef(() => props.arrow as ComboboxArrowProps)
|
|
177
192
|
|
|
@@ -340,6 +355,7 @@ defineExpose({
|
|
|
340
355
|
v-slot="{ modelValue: tags }"
|
|
341
356
|
:model-value="(modelValue as string[])"
|
|
342
357
|
:disabled="disabled"
|
|
358
|
+
:required="required"
|
|
343
359
|
delimiter=""
|
|
344
360
|
as-child
|
|
345
361
|
@blur="onBlur"
|
|
@@ -365,7 +381,6 @@ defineExpose({
|
|
|
365
381
|
ref="inputRef"
|
|
366
382
|
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
367
383
|
:placeholder="placeholder"
|
|
368
|
-
:required="required"
|
|
369
384
|
:class="ui.tagsInput({ class: props.ui?.tagsInput })"
|
|
370
385
|
@keydown.enter.prevent
|
|
371
386
|
/>
|
|
@@ -40,6 +40,7 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|
|
40
40
|
/**
|
|
41
41
|
* The icon displayed to increment the value.
|
|
42
42
|
* @defaultValue appConfig.ui.icons.plus
|
|
43
|
+
* @IconifyIcon
|
|
43
44
|
*/
|
|
44
45
|
incrementIcon?: string
|
|
45
46
|
/**
|
|
@@ -50,6 +51,7 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|
|
50
51
|
/**
|
|
51
52
|
* The icon displayed to decrement the value.
|
|
52
53
|
* @defaultValue appConfig.ui.icons.minus
|
|
54
|
+
* @IconifyIcon
|
|
53
55
|
*/
|
|
54
56
|
decrementIcon?: string
|
|
55
57
|
autofocus?: boolean
|
|
@@ -91,7 +91,7 @@ export interface LinkSlots {
|
|
|
91
91
|
|
|
92
92
|
<script setup lang="ts">
|
|
93
93
|
import { computed } from 'vue'
|
|
94
|
-
import { isEqual, diff } from 'ohash'
|
|
94
|
+
import { isEqual, diff } from 'ohash/utils'
|
|
95
95
|
import { useForwardProps } from 'reka-ui'
|
|
96
96
|
import { reactiveOmit } from '@vueuse/core'
|
|
97
97
|
import { useRoute } from '#imports'
|
|
@@ -124,11 +124,15 @@ const ui = computed(() => tv({
|
|
|
124
124
|
function isPartiallyEqual(item1: any, item2: any) {
|
|
125
125
|
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
126
126
|
if (q.type === 'added') {
|
|
127
|
-
filtered.
|
|
127
|
+
filtered.add(q.key)
|
|
128
128
|
}
|
|
129
129
|
return filtered
|
|
130
|
-
},
|
|
131
|
-
|
|
130
|
+
}, new Set<string>())
|
|
131
|
+
|
|
132
|
+
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)))
|
|
133
|
+
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)))
|
|
134
|
+
|
|
135
|
+
return isEqual(item1Filtered, item2Filtered)
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { LinkProps } from '../types'
|
|
3
|
+
|
|
2
4
|
export interface LinkBaseProps {
|
|
3
5
|
as?: string
|
|
4
6
|
type?: string
|
|
@@ -6,8 +8,8 @@ export interface LinkBaseProps {
|
|
|
6
8
|
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>
|
|
7
9
|
href?: string
|
|
8
10
|
navigate?: (e: MouseEvent) => void
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
target?: LinkProps['target']
|
|
12
|
+
rel?: LinkProps['rel']
|
|
11
13
|
isExternal?: boolean
|
|
12
14
|
}
|
|
13
15
|
</script>
|
|
@@ -19,6 +19,9 @@ export interface NavigationMenuChildItem extends Omit<NavigationMenuItem, 'child
|
|
|
19
19
|
|
|
20
20
|
export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<CollapsibleRootProps, 'defaultOpen' | 'open'> {
|
|
21
21
|
label?: string
|
|
22
|
+
/**
|
|
23
|
+
* @IconifyIcon
|
|
24
|
+
*/
|
|
22
25
|
icon?: string
|
|
23
26
|
avatar?: AvatarProps
|
|
24
27
|
/**
|
|
@@ -26,6 +29,9 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
26
29
|
* `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
|
|
27
30
|
*/
|
|
28
31
|
badge?: string | number | BadgeProps
|
|
32
|
+
/**
|
|
33
|
+
* @IconifyIcon
|
|
34
|
+
*/
|
|
29
35
|
trailingIcon?: string
|
|
30
36
|
/**
|
|
31
37
|
* The type of the item.
|
|
@@ -50,16 +56,24 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'm
|
|
|
50
56
|
/**
|
|
51
57
|
* The icon displayed to open the menu.
|
|
52
58
|
* @defaultValue appConfig.ui.icons.chevronDown
|
|
59
|
+
* @IconifyIcon
|
|
53
60
|
*/
|
|
54
61
|
trailingIcon?: string
|
|
55
62
|
/**
|
|
56
63
|
* The icon displayed when the item is an external link.
|
|
57
64
|
* Set to `false` to hide the external icon.
|
|
58
65
|
* @defaultValue appConfig.ui.icons.external
|
|
66
|
+
* @IconifyIcon
|
|
59
67
|
*/
|
|
60
68
|
externalIcon?: boolean | string
|
|
61
69
|
items?: T
|
|
70
|
+
/**
|
|
71
|
+
* @defaultValue 'primary'
|
|
72
|
+
*/
|
|
62
73
|
color?: NavigationMenuVariants['color']
|
|
74
|
+
/**
|
|
75
|
+
* @defaultValue 'pill'
|
|
76
|
+
*/
|
|
63
77
|
variant?: NavigationMenuVariants['variant']
|
|
64
78
|
/**
|
|
65
79
|
* The orientation of the menu.
|
|
@@ -74,6 +88,9 @@ export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'm
|
|
|
74
88
|
collapsed?: boolean
|
|
75
89
|
/** Display a line next to the active item. */
|
|
76
90
|
highlight?: boolean
|
|
91
|
+
/**
|
|
92
|
+
* @defaultValue 'primary'
|
|
93
|
+
*/
|
|
77
94
|
highlightColor?: NavigationMenuVariants['highlightColor']
|
|
78
95
|
/** The content of the menu. */
|
|
79
96
|
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PaginationRootProps, PaginationRootEmits } from 'reka-ui'
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
-
import type { RouteLocationRaw } from '#vue-router'
|
|
5
4
|
import _appConfig from '#build/app.config'
|
|
6
5
|
import theme from '#build/ui/pagination'
|
|
7
6
|
import { tv } from '../utils/tv'
|
|
@@ -20,31 +19,37 @@ export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defa
|
|
|
20
19
|
/**
|
|
21
20
|
* The icon to use for the first page control.
|
|
22
21
|
* @defaultValue appConfig.ui.icons.chevronDoubleLeft
|
|
22
|
+
* @IconifyIcon
|
|
23
23
|
*/
|
|
24
24
|
firstIcon?: string
|
|
25
25
|
/**
|
|
26
26
|
* The icon to use for the previous page control.
|
|
27
27
|
* @defaultValue appConfig.ui.icons.chevronLeft
|
|
28
|
+
* @IconifyIcon
|
|
28
29
|
*/
|
|
29
30
|
prevIcon?: string
|
|
30
31
|
/**
|
|
31
32
|
* The icon to use for the next page control.
|
|
32
33
|
* @defaultValue appConfig.ui.icons.chevronRight
|
|
34
|
+
* @IconifyIcon
|
|
33
35
|
*/
|
|
34
36
|
nextIcon?: string
|
|
35
37
|
/**
|
|
36
38
|
* The icon to use for the last page control.
|
|
37
39
|
* @defaultValue appConfig.ui.icons.chevronDoubleRight
|
|
40
|
+
* @IconifyIcon
|
|
38
41
|
*/
|
|
39
42
|
lastIcon?: string
|
|
40
43
|
/**
|
|
41
44
|
* The icon to use for the ellipsis control.
|
|
42
45
|
* @defaultValue appConfig.ui.icons.ellipsis
|
|
46
|
+
* @IconifyIcon
|
|
43
47
|
*/
|
|
44
48
|
ellipsisIcon?: string
|
|
45
49
|
/**
|
|
46
50
|
* The color of the pagination controls.
|
|
47
51
|
* @defaultValue 'neutral'
|
|
52
|
+
* @IconifyIcon
|
|
48
53
|
*/
|
|
49
54
|
color?: ButtonProps['color']
|
|
50
55
|
/**
|
|
@@ -72,7 +77,7 @@ export interface PaginationProps extends Partial<Pick<PaginationRootProps, 'defa
|
|
|
72
77
|
* A function to render page controls as links.
|
|
73
78
|
* @param page The page number to navigate to.
|
|
74
79
|
*/
|
|
75
|
-
to?: (page: number) =>
|
|
80
|
+
to?: (page: number) => ButtonProps['to']
|
|
76
81
|
class?: any
|
|
77
82
|
ui?: Partial<typeof pagination.slots>
|
|
78
83
|
}
|
|
@@ -138,19 +143,19 @@ const ui = pagination()
|
|
|
138
143
|
<template>
|
|
139
144
|
<PaginationRoot v-slot="{ page, pageCount }" v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
140
145
|
<PaginationList v-slot="{ items }" :class="ui.list({ class: props.ui?.list })">
|
|
141
|
-
<PaginationFirst v-if="showControls || !!slots.first" as-child>
|
|
146
|
+
<PaginationFirst v-if="showControls || !!slots.first" as-child :class="ui.first({ class: props.ui?.first })">
|
|
142
147
|
<slot name="first">
|
|
143
148
|
<UButton :color="color" :variant="variant" :size="size" :icon="firstIcon" :to="to?.(1)" />
|
|
144
149
|
</slot>
|
|
145
150
|
</PaginationFirst>
|
|
146
|
-
<PaginationPrev v-if="showControls || !!slots.prev" as-child>
|
|
151
|
+
<PaginationPrev v-if="showControls || !!slots.prev" as-child :class="ui.prev({ class: props.ui?.prev })">
|
|
147
152
|
<slot name="prev">
|
|
148
153
|
<UButton :color="color" :variant="variant" :size="size" :icon="prevIcon" :to="page > 1 ? to?.(page - 1) : undefined" />
|
|
149
154
|
</slot>
|
|
150
155
|
</PaginationPrev>
|
|
151
156
|
|
|
152
157
|
<template v-for="(item, index) in items">
|
|
153
|
-
<PaginationListItem v-if="item.type === 'page'" :key="index" as-child :value="item.value">
|
|
158
|
+
<PaginationListItem v-if="item.type === 'page'" :key="index" as-child :value="item.value" :class="ui.item({ class: props.ui?.item })">
|
|
154
159
|
<slot name="item" v-bind="{ item, index, page, pageCount }">
|
|
155
160
|
<UButton
|
|
156
161
|
:color="page === item.value ? activeColor : color"
|
|
@@ -164,21 +169,21 @@ const ui = pagination()
|
|
|
164
169
|
</slot>
|
|
165
170
|
</PaginationListItem>
|
|
166
171
|
|
|
167
|
-
<PaginationEllipsis v-else :key="item.type" :index="index" as-child>
|
|
172
|
+
<PaginationEllipsis v-else :key="item.type" :index="index" as-child :class="ui.ellipsis({ class: props.ui?.ellipsis })">
|
|
168
173
|
<slot name="ellipsis">
|
|
169
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="ellipsisIcon || appConfig.ui.icons.ellipsis"
|
|
174
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="ellipsisIcon || appConfig.ui.icons.ellipsis" />
|
|
170
175
|
</slot>
|
|
171
176
|
</PaginationEllipsis>
|
|
172
177
|
</template>
|
|
173
178
|
|
|
174
|
-
<PaginationNext v-if="showControls || !!slots.next" as-child>
|
|
179
|
+
<PaginationNext v-if="showControls || !!slots.next" as-child :class="ui.next({ class: props.ui?.next })">
|
|
175
180
|
<slot name="next">
|
|
176
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="nextIcon" :to="page < pageCount ? to?.(
|
|
181
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="nextIcon" :to="page < pageCount ? to?.(page + 1) : undefined" />
|
|
177
182
|
</slot>
|
|
178
183
|
</PaginationNext>
|
|
179
|
-
<PaginationLast v-if="showControls || !!slots.last" as-child>
|
|
184
|
+
<PaginationLast v-if="showControls || !!slots.last" as-child :class="ui.last({ class: props.ui?.last })">
|
|
180
185
|
<slot name="last">
|
|
181
|
-
<UButton :color="color" :variant="variant" :size="size" :icon="lastIcon" :to="
|
|
186
|
+
<UButton :color="color" :variant="variant" :size="size" :icon="lastIcon" :to="to?.(pageCount)" />
|
|
182
187
|
</slot>
|
|
183
188
|
</PaginationLast>
|
|
184
189
|
</PaginationList>
|
|
@@ -19,9 +19,22 @@ export interface PinInputProps extends Pick<PinInputRootProps, 'defaultValue' |
|
|
|
19
19
|
* @defaultValue 'div'
|
|
20
20
|
*/
|
|
21
21
|
as?: any
|
|
22
|
+
/**
|
|
23
|
+
* @defaultValue 'primary'
|
|
24
|
+
*/
|
|
22
25
|
color?: PinInputVariants['color']
|
|
26
|
+
/**
|
|
27
|
+
* @defaultValue 'outline'
|
|
28
|
+
*/
|
|
23
29
|
variant?: PinInputVariants['variant']
|
|
30
|
+
/**
|
|
31
|
+
* @defaultValue 'md'
|
|
32
|
+
*/
|
|
24
33
|
size?: PinInputVariants['size']
|
|
34
|
+
/**
|
|
35
|
+
* The number of input fields.
|
|
36
|
+
* @defaultValue 5
|
|
37
|
+
*/
|
|
25
38
|
length?: number | string
|
|
26
39
|
highlight?: boolean
|
|
27
40
|
class?: any
|
|
@@ -25,13 +25,23 @@ export interface ProgressProps extends Pick<ProgressRootProps, 'getValueLabel' |
|
|
|
25
25
|
status?: boolean
|
|
26
26
|
/** Whether the progress is visually inverted. */
|
|
27
27
|
inverted?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* @defaultValue 'md'
|
|
30
|
+
*/
|
|
28
31
|
size?: ProgressVariants['size']
|
|
32
|
+
/**
|
|
33
|
+
* @defaultValue 'primary'
|
|
34
|
+
*/
|
|
29
35
|
color?: ProgressVariants['color']
|
|
30
36
|
/**
|
|
31
37
|
* The orientation of the progress bar.
|
|
32
38
|
* @defaultValue 'horizontal'
|
|
33
39
|
*/
|
|
34
40
|
orientation?: ProgressVariants['orientation']
|
|
41
|
+
/**
|
|
42
|
+
* The animation of the progress bar.
|
|
43
|
+
* @defaultValue 'carousel'
|
|
44
|
+
*/
|
|
35
45
|
animation?: ProgressVariants['animation']
|
|
36
46
|
class?: any
|
|
37
47
|
ui?: Partial<typeof progress.slots>
|
|
@@ -42,7 +42,13 @@ export interface RadioGroupProps<T> extends Pick<RadioGroupRootProps, 'defaultVa
|
|
|
42
42
|
*/
|
|
43
43
|
descriptionKey?: string
|
|
44
44
|
items?: T[]
|
|
45
|
+
/**
|
|
46
|
+
* @defaultValue 'md'
|
|
47
|
+
*/
|
|
45
48
|
size?: RadioGroupVariants['size']
|
|
49
|
+
/**
|
|
50
|
+
* @defaultValue 'primary'
|
|
51
|
+
*/
|
|
46
52
|
color?: RadioGroupVariants['color']
|
|
47
53
|
/**
|
|
48
54
|
* The orientation the radio buttons are laid out.
|
|
@@ -15,6 +15,9 @@ const select = tv({ extend: tv(theme), ...(appConfigSelect.ui?.select || {}) })
|
|
|
15
15
|
|
|
16
16
|
export interface SelectItem {
|
|
17
17
|
label?: string
|
|
18
|
+
/**
|
|
19
|
+
* @IconifyIcon
|
|
20
|
+
*/
|
|
18
21
|
icon?: string
|
|
19
22
|
avatar?: AvatarProps
|
|
20
23
|
chip?: ChipProps
|
|
@@ -33,17 +36,28 @@ export interface SelectProps<T extends MaybeArrayOfArrayItem<I>, I extends Maybe
|
|
|
33
36
|
id?: string
|
|
34
37
|
/** The placeholder text when the select is empty. */
|
|
35
38
|
placeholder?: string
|
|
39
|
+
/**
|
|
40
|
+
* @defaultValue 'primary'
|
|
41
|
+
*/
|
|
36
42
|
color?: SelectVariants['color']
|
|
43
|
+
/**
|
|
44
|
+
* @defaultValue 'outline'
|
|
45
|
+
*/
|
|
37
46
|
variant?: SelectVariants['variant']
|
|
47
|
+
/**
|
|
48
|
+
* @defaultValue 'md'
|
|
49
|
+
*/
|
|
38
50
|
size?: SelectVariants['size']
|
|
39
51
|
/**
|
|
40
52
|
* The icon displayed to open the menu.
|
|
41
53
|
* @defaultValue appConfig.ui.icons.chevronDown
|
|
54
|
+
* @IconifyIcon
|
|
42
55
|
*/
|
|
43
56
|
trailingIcon?: string
|
|
44
57
|
/**
|
|
45
58
|
* The icon displayed when an item is selected.
|
|
46
59
|
* @defaultValue appConfig.ui.icons.check
|
|
60
|
+
* @IconifyIcon
|
|
47
61
|
*/
|
|
48
62
|
selectedIcon?: string
|
|
49
63
|
/**
|
|
@@ -15,6 +15,9 @@ const selectMenu = tv({ extend: tv(theme), ...(appConfigSelectMenu.ui?.selectMen
|
|
|
15
15
|
|
|
16
16
|
export interface SelectMenuItem {
|
|
17
17
|
label?: string
|
|
18
|
+
/**
|
|
19
|
+
* @IconifyIcon
|
|
20
|
+
*/
|
|
18
21
|
icon?: string
|
|
19
22
|
avatar?: AvatarProps
|
|
20
23
|
chip?: ChipProps
|
|
@@ -40,18 +43,29 @@ export interface SelectMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends M
|
|
|
40
43
|
* @defaultValue true
|
|
41
44
|
*/
|
|
42
45
|
searchInput?: boolean | InputProps
|
|
46
|
+
/**
|
|
47
|
+
* @defaultValue 'primary'
|
|
48
|
+
*/
|
|
43
49
|
color?: SelectMenuVariants['color']
|
|
50
|
+
/**
|
|
51
|
+
* @defaultValue 'outline'
|
|
52
|
+
*/
|
|
44
53
|
variant?: SelectMenuVariants['variant']
|
|
54
|
+
/**
|
|
55
|
+
* @defaultValue 'md'
|
|
56
|
+
*/
|
|
45
57
|
size?: SelectMenuVariants['size']
|
|
46
58
|
required?: boolean
|
|
47
59
|
/**
|
|
48
60
|
* The icon displayed to open the menu.
|
|
49
61
|
* @defaultValue appConfig.ui.icons.chevronDown
|
|
62
|
+
* @IconifyIcon
|
|
50
63
|
*/
|
|
51
64
|
trailingIcon?: string
|
|
52
65
|
/**
|
|
53
66
|
* The icon displayed when an item is selected.
|
|
54
67
|
* @defaultValue appConfig.ui.icons.check
|
|
68
|
+
* @IconifyIcon
|
|
55
69
|
*/
|
|
56
70
|
selectedIcon?: string
|
|
57
71
|
/**
|
|
@@ -62,6 +76,7 @@ export interface SelectMenuProps<T extends MaybeArrayOfArrayItem<I>, I extends M
|
|
|
62
76
|
/**
|
|
63
77
|
* Display an arrow alongside the menu.
|
|
64
78
|
* @defaultValue false
|
|
79
|
+
* @IconifyIcon
|
|
65
80
|
*/
|
|
66
81
|
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
|
|
67
82
|
/**
|
|
@@ -162,7 +177,7 @@ const { t } = useLocale()
|
|
|
162
177
|
const appConfig = useAppConfig()
|
|
163
178
|
const { contains } = useFilter({ sensitivity: 'base' })
|
|
164
179
|
|
|
165
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'multiple', 'resetSearchTermOnBlur', 'highlightOnHover'), emits)
|
|
180
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'required', 'multiple', 'resetSearchTermOnBlur', 'highlightOnHover'), emits)
|
|
166
181
|
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as ComboboxContentProps)
|
|
167
182
|
const arrowProps = toRef(() => props.arrow as ComboboxArrowProps)
|
|
168
183
|
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t('selectMenu.search'), variant: 'none' }) as InputProps)
|
|
@@ -21,12 +21,24 @@ export interface SeparatorProps extends Pick<_SeparatorProps, 'decorative'> {
|
|
|
21
21
|
as?: any
|
|
22
22
|
/** Display a label in the middle. */
|
|
23
23
|
label?: string
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Display an icon in the middle.
|
|
26
|
+
* @IconifyIcon
|
|
27
|
+
*/
|
|
25
28
|
icon?: string
|
|
26
29
|
/** Display an avatar in the middle. */
|
|
27
30
|
avatar?: AvatarProps
|
|
31
|
+
/**
|
|
32
|
+
* @defaultValue 'neutral'
|
|
33
|
+
*/
|
|
28
34
|
color?: SeparatorVariants['color']
|
|
35
|
+
/**
|
|
36
|
+
* @defaultValue 'xs'
|
|
37
|
+
*/
|
|
29
38
|
size?: SeparatorVariants['size']
|
|
39
|
+
/**
|
|
40
|
+
* @defaultValue 'solid'
|
|
41
|
+
*/
|
|
30
42
|
type?: SeparatorVariants['type']
|
|
31
43
|
/**
|
|
32
44
|
* The orientation of the separator.
|
|
@@ -28,6 +28,10 @@ export interface SlideoverProps extends DialogRootProps {
|
|
|
28
28
|
* @defaultValue true
|
|
29
29
|
*/
|
|
30
30
|
transition?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* The side of the slideover.
|
|
33
|
+
* @defaultValue 'right'
|
|
34
|
+
*/
|
|
31
35
|
side?: SlideoverVariants['side']
|
|
32
36
|
/**
|
|
33
37
|
* Render the slideover in a portal.
|
|
@@ -43,6 +47,7 @@ export interface SlideoverProps extends DialogRootProps {
|
|
|
43
47
|
/**
|
|
44
48
|
* The icon displayed in the close button.
|
|
45
49
|
* @defaultValue appConfig.ui.icons.close
|
|
50
|
+
* @IconifyIcon
|
|
46
51
|
*/
|
|
47
52
|
closeIcon?: string
|
|
48
53
|
/**
|
|
@@ -18,7 +18,13 @@ export interface SliderProps extends Pick<SliderRootProps, 'name' | 'disabled' |
|
|
|
18
18
|
* @defaultValue 'div'
|
|
19
19
|
*/
|
|
20
20
|
as?: any
|
|
21
|
+
/**
|
|
22
|
+
* @defaultValue 'md'
|
|
23
|
+
*/
|
|
21
24
|
size?: SliderVariants['size']
|
|
25
|
+
/**
|
|
26
|
+
* @defaultValue 'primary'
|
|
27
|
+
*/
|
|
22
28
|
color?: SliderVariants['color']
|
|
23
29
|
/**
|
|
24
30
|
* The orientation of the slider.
|