@byyuurin/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +5 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.vue +41 -41
- package/dist/runtime/components/Accordion.vue.d.ts +11 -7
- package/dist/runtime/components/Alert.vue +63 -63
- package/dist/runtime/components/Alert.vue.d.ts +4 -4
- package/dist/runtime/components/App.vue +11 -10
- package/dist/runtime/components/App.vue.d.ts +11 -7
- package/dist/runtime/components/Avatar.vue +29 -29
- package/dist/runtime/components/Avatar.vue.d.ts +4 -3
- package/dist/runtime/components/AvatarGroup.vue +4 -4
- package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Badge.vue +32 -32
- package/dist/runtime/components/Badge.vue.d.ts +2 -2
- package/dist/runtime/components/Breadcrumb.vue +49 -49
- package/dist/runtime/components/Breadcrumb.vue.d.ts +10 -6
- package/dist/runtime/components/Button.vue +52 -51
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +74 -74
- package/dist/runtime/components/Calendar.vue.d.ts +16 -12
- package/dist/runtime/components/Card.vue +41 -41
- package/dist/runtime/components/Card.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.vue +66 -66
- package/dist/runtime/components/Carousel.vue.d.ts +14 -10
- package/dist/runtime/components/Checkbox.vue +46 -46
- package/dist/runtime/components/Checkbox.vue.d.ts +4 -3
- package/dist/runtime/components/CheckboxGroup.vue +29 -29
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +11 -7
- package/dist/runtime/components/Chip.vue +15 -15
- package/dist/runtime/components/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/Collapsible.vue +14 -14
- package/dist/runtime/components/Collapsible.vue.d.ts +2 -2
- package/dist/runtime/components/Drawer.vue +76 -76
- package/dist/runtime/components/Drawer.vue.d.ts +6 -6
- package/dist/runtime/components/DropdownMenu.vue +28 -28
- package/dist/runtime/components/DropdownMenu.vue.d.ts +17 -9
- package/dist/runtime/components/DropdownMenuContent.vue +152 -153
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +11 -7
- package/dist/runtime/components/FieldGroup.vue +3 -3
- package/dist/runtime/components/FieldGroup.vue.d.ts +2 -2
- package/dist/runtime/components/Form.vue +9 -9
- package/dist/runtime/components/Form.vue.d.ts +13 -8
- package/dist/runtime/components/FormField.vue +39 -38
- package/dist/runtime/components/FormField.vue.d.ts +7 -2
- package/dist/runtime/components/Icon.vue +2 -2
- package/dist/runtime/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/Input.vue +48 -48
- package/dist/runtime/components/Input.vue.d.ts +16 -12
- package/dist/runtime/components/InputNumber.vue +47 -47
- package/dist/runtime/components/InputNumber.vue.d.ts +128 -124
- package/dist/runtime/components/InputTags.vue +54 -53
- package/dist/runtime/components/InputTags.vue.d.ts +16 -11
- package/dist/runtime/components/Kbd.vue +3 -3
- package/dist/runtime/components/Kbd.vue.d.ts +2 -2
- package/dist/runtime/components/Link.vue +26 -25
- package/dist/runtime/components/Link.vue.d.ts +16 -6
- package/dist/runtime/components/LinkBase.vue +3 -3
- package/dist/runtime/components/LinkBase.vue.d.ts +2 -2
- package/dist/runtime/components/Marquee.vue +5 -5
- package/dist/runtime/components/Marquee.vue.d.ts +3 -3
- package/dist/runtime/components/Modal.vue +74 -74
- package/dist/runtime/components/Modal.vue.d.ts +6 -6
- package/dist/runtime/components/NavigationMenu.vue +228 -228
- package/dist/runtime/components/NavigationMenu.vue.d.ts +11 -7
- package/dist/runtime/components/OverlayProvider.vue +9 -9
- package/dist/runtime/components/Pagination.vue +47 -47
- package/dist/runtime/components/Pagination.vue.d.ts +4 -4
- package/dist/runtime/components/PinInput.vue +23 -23
- package/dist/runtime/components/PinInput.vue.d.ts +14 -10
- package/dist/runtime/components/Popover.vue +22 -22
- package/dist/runtime/components/Popover.vue.d.ts +11 -7
- package/dist/runtime/components/Progress.vue +25 -25
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +50 -50
- package/dist/runtime/components/RadioGroup.vue.d.ts +11 -7
- package/dist/runtime/components/ScrollArea.vue +32 -32
- package/dist/runtime/components/ScrollArea.vue.d.ts +2 -2
- package/dist/runtime/components/Select.vue +299 -148
- package/dist/runtime/components/Select.vue.d.ts +103 -123
- package/dist/runtime/components/Separator.vue +30 -30
- package/dist/runtime/components/Separator.vue.d.ts +2 -2
- package/dist/runtime/components/Skeleton.vue +11 -11
- package/dist/runtime/components/Skeleton.vue.d.ts +2 -2
- package/dist/runtime/components/Slider.vue +25 -25
- package/dist/runtime/components/Slider.vue.d.ts +11 -7
- package/dist/runtime/components/Stepper.vue +116 -0
- package/dist/runtime/components/Stepper.vue.d.ts +83 -0
- package/dist/runtime/components/Switch.vue +30 -30
- package/dist/runtime/components/Switch.vue.d.ts +4 -3
- package/dist/runtime/components/Table.vue +137 -137
- package/dist/runtime/components/Table.vue.d.ts +13 -8
- package/dist/runtime/components/Tabs.vue +74 -74
- package/dist/runtime/components/Tabs.vue.d.ts +12 -8
- package/dist/runtime/components/Textarea.vue +47 -47
- package/dist/runtime/components/Textarea.vue.d.ts +16 -11
- package/dist/runtime/components/Timeline.vue +47 -47
- package/dist/runtime/components/Timeline.vue.d.ts +11 -7
- package/dist/runtime/components/Toast.vue +93 -93
- package/dist/runtime/components/Toast.vue.d.ts +5 -5
- package/dist/runtime/components/ToastProvider.vue +29 -29
- package/dist/runtime/components/ToastProvider.vue.d.ts +3 -3
- package/dist/runtime/components/Tooltip.vue +24 -25
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/components/Tree.vue +241 -0
- package/dist/runtime/components/Tree.vue.d.ts +121 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.js +44 -8
- package/dist/runtime/composables/useLocale.d.ts +12 -0
- package/dist/runtime/locale/en.d.ts +6 -0
- package/dist/runtime/locale/en.js +6 -0
- package/dist/runtime/locale/zh_tw.d.ts +6 -0
- package/dist/runtime/locale/zh_tw.js +6 -0
- package/dist/runtime/types/html.d.ts +8 -0
- package/dist/runtime/types/html.js +0 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/input.d.ts +5 -5
- package/dist/runtime/types/locale.d.ts +6 -0
- package/dist/runtime/types/unocss.d.ts +4 -4
- package/dist/runtime/types/utils.d.ts +3 -3
- package/dist/runtime/utils/index.d.ts +3 -3
- package/dist/runtime/utils/link.d.ts +2 -1
- package/dist/runtime/utils/link.js +40 -29
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/vue/components/Link.vue +7 -12
- package/dist/runtime/vue/components/Link.vue.d.ts +11 -40
- package/dist/setup.d.mts +1 -1
- package/dist/shared/{ui.CzIlLITK.mjs → ui.9kQouwss.mjs} +5 -3
- package/dist/shared/{ui.DpbffTXs.d.mts → ui.D8Bg1HWt.d.mts} +2 -0
- package/dist/shared/{ui.DLOxhmP0.mjs → ui.DpkP12cX.mjs} +262 -17
- package/dist/unocss.mjs +1 -1
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.mjs +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +29 -29
- package/vue-plugin.d.ts +5 -5
|
@@ -29,14 +29,18 @@ export type DropdownMenuContentSlots<A extends ArrayOrNested<DropdownMenuItem> =
|
|
|
29
29
|
index: number;
|
|
30
30
|
ui: ComponentStyler<typeof theme>;
|
|
31
31
|
}>;
|
|
32
|
-
declare const
|
|
33
|
-
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
33
|
+
export default _default;
|
|
34
|
+
declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
35
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DropdownMenuContentProps<T> & {
|
|
34
36
|
onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
|
|
35
37
|
onPointerDownOutside?: ((event: import("reka-ui").PointerDownOutsideEvent) => any) | undefined;
|
|
36
38
|
onFocusOutside?: ((event: import("reka-ui").FocusOutsideEvent) => any) | undefined;
|
|
37
39
|
onInteractOutside?: ((event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => any) | undefined;
|
|
38
40
|
onCloseAutoFocus?: ((event: Event) => any) | undefined;
|
|
39
|
-
}> &
|
|
41
|
+
}> & (typeof globalThis extends {
|
|
42
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
43
|
+
} ? P : {});
|
|
40
44
|
expose: (exposed: {}) => void;
|
|
41
45
|
attrs: any;
|
|
42
46
|
slots: DropdownMenuContentSlots<T, NestedItem<T>>;
|
|
@@ -44,8 +48,8 @@ declare const __VLS_export: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_pr
|
|
|
44
48
|
}>) => import("vue").VNode & {
|
|
45
49
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
46
50
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
52
|
+
[K in keyof T]: T[K];
|
|
53
|
+
} : {
|
|
50
54
|
[K in keyof T as K]: T[K];
|
|
51
|
-
} & {};
|
|
55
|
+
}) & {};
|
|
@@ -27,7 +27,7 @@ provideFieldGroup(computed(() => ({
|
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<template>
|
|
30
|
-
<Primitive :as="props.as" :class="ui.base({ class: props.class })" :data-orientation="props.orientation" data-part="base">
|
|
31
|
-
<slot></slot>
|
|
32
|
-
</Primitive>
|
|
30
|
+
<Primitive :as="props.as" :class="ui.base({ class: props.class })" :data-orientation="props.orientation" data-part="base">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</Primitive>
|
|
33
33
|
</template>
|
|
@@ -21,11 +21,11 @@ export interface FieldGroupProps extends ComponentBaseProps {
|
|
|
21
21
|
export interface FieldGroupSlots {
|
|
22
22
|
default: StaticSlot;
|
|
23
23
|
}
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
24
26
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FieldGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FieldGroupProps> & Readonly<{}>, {
|
|
25
27
|
orientation: "horizontal" | "vertical";
|
|
26
28
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FieldGroupSlots>;
|
|
27
|
-
declare const _default: typeof __VLS_export;
|
|
28
|
-
export default _default;
|
|
29
29
|
type __VLS_WithSlots<T, S> = T & {
|
|
30
30
|
new (): {
|
|
31
31
|
$slots: S;
|
|
@@ -269,13 +269,13 @@ const ui = computed(() => {
|
|
|
269
269
|
</script>
|
|
270
270
|
|
|
271
271
|
<template>
|
|
272
|
-
<component
|
|
273
|
-
:is="parentBus ? 'div' : 'form'"
|
|
274
|
-
:id="formId"
|
|
275
|
-
:class="ui.base({ class: props.class })"
|
|
276
|
-
data-part="base"
|
|
277
|
-
@submit.prevent="onSubmitWrapper"
|
|
278
|
-
>
|
|
279
|
-
<slot :errors="errors" :loading="loading"></slot>
|
|
280
|
-
</component>
|
|
272
|
+
<component
|
|
273
|
+
:is="parentBus ? 'div' : 'form'"
|
|
274
|
+
:id="formId"
|
|
275
|
+
:class="ui.base({ class: props.class })"
|
|
276
|
+
data-part="base"
|
|
277
|
+
@submit.prevent="onSubmitWrapper"
|
|
278
|
+
>
|
|
279
|
+
<slot :errors="errors" :loading="loading"></slot>
|
|
280
|
+
</component>
|
|
281
281
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentBaseProps, FormData, FormError, FormErrorEvent, FormErrorWithId, FormInputEvents, FormSchema, FormSubmitEvent, InferInput } from '../types';
|
|
2
|
+
import type { FormHTMLAttributes } from '../types/html';
|
|
2
3
|
import type { StaticSlot } from '../types/utils';
|
|
3
|
-
export interface FormProps<S extends FormSchema, T extends boolean = true, N extends boolean = false> extends ComponentBaseProps {
|
|
4
|
+
export interface FormProps<S extends FormSchema, T extends boolean = true, N extends boolean = false> extends ComponentBaseProps, /** @vue-ignore */ Omit<FormHTMLAttributes, 'name'> {
|
|
4
5
|
id?: string | number;
|
|
5
6
|
/** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */
|
|
6
7
|
schema?: S;
|
|
@@ -59,11 +60,15 @@ export interface FormSlots {
|
|
|
59
60
|
loading: boolean;
|
|
60
61
|
}>;
|
|
61
62
|
}
|
|
62
|
-
declare const
|
|
63
|
-
|
|
63
|
+
declare const _default: typeof __VLS_export;
|
|
64
|
+
export default _default;
|
|
65
|
+
declare const __VLS_export: <S extends FormSchema, T extends boolean = true, N extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
66
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<FormProps<S, T, N> & {
|
|
64
67
|
onError?: ((event: FormErrorEvent) => any) | undefined;
|
|
65
68
|
onSubmit?: ((event: FormSubmitEvent<FormData<S, T>>) => any) | undefined;
|
|
66
|
-
}> &
|
|
69
|
+
}> & (typeof globalThis extends {
|
|
70
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
71
|
+
} ? P : {});
|
|
67
72
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
68
73
|
validate: any;
|
|
69
74
|
errors: import("vue").Ref<{
|
|
@@ -96,8 +101,8 @@ declare const __VLS_export: <S extends FormSchema, T extends boolean = true, N e
|
|
|
96
101
|
}>) => import("vue").VNode & {
|
|
97
102
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
98
103
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
105
|
+
[K in keyof T]: T[K];
|
|
106
|
+
} : {
|
|
102
107
|
[K in keyof T as K]: T[K];
|
|
103
|
-
} & {};
|
|
108
|
+
}) & {};
|
|
@@ -15,8 +15,9 @@ const props = defineProps({
|
|
|
15
15
|
label: { type: String, required: false },
|
|
16
16
|
description: { type: String, required: false },
|
|
17
17
|
help: { type: String, required: false },
|
|
18
|
-
error: { type: [String, Boolean], required: false },
|
|
18
|
+
error: { type: [String, Boolean], required: false, default: void 0 },
|
|
19
19
|
hint: { type: String, required: false },
|
|
20
|
+
orientation: { type: null, required: false },
|
|
20
21
|
size: { type: null, required: false },
|
|
21
22
|
required: { type: Boolean, required: false },
|
|
22
23
|
eagerValidation: { type: Boolean, required: false },
|
|
@@ -68,41 +69,41 @@ const ui = computed(() => {
|
|
|
68
69
|
</script>
|
|
69
70
|
|
|
70
71
|
<template>
|
|
71
|
-
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
72
|
-
<div :class="ui.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
73
|
-
<div v-if="props.label || !!slots.label" :class="ui.labelWrapper({ class: props.ui?.labelWrapper })" data-part="labelWrapper">
|
|
74
|
-
<Label :for="id" :class="ui.label({ class: props.ui?.label })" data-part="label">
|
|
75
|
-
<slot name="label" :label="props.label">
|
|
76
|
-
{{ props.label }}
|
|
77
|
-
</slot>
|
|
78
|
-
</Label>
|
|
79
|
-
<span v-if="props.hint || !!slots.hint" :id="`${ariaId}-hint`" :class="ui.hint({ class: props.ui?.hint })" data-part="hint">
|
|
80
|
-
<slot name="hint" :hint="props.hint">
|
|
81
|
-
{{ props.hint }}
|
|
82
|
-
</slot>
|
|
83
|
-
</span>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<p v-if="props.description || !!slots.description" :id="`${ariaId}-description`" :class="ui.description({ class: props.ui?.description })" data-part="description">
|
|
87
|
-
<slot name="description" :description="props.description">
|
|
88
|
-
{{ props.description }}
|
|
89
|
-
</slot>
|
|
90
|
-
</p>
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<div :class="(props.label || !!slots.label || props.description || !!slots.description) && ui.container({ class: props.ui?.container })" data-part="container">
|
|
94
|
-
<slot :error="error"></slot>
|
|
95
|
-
|
|
96
|
-
<div v-if="typeof error === 'string' && error || !!slots.error" :id="`${ariaId}-error`" :class="ui.error({ class: props.ui?.error })" data-part="error">
|
|
97
|
-
<slot name="error" :error="error">
|
|
98
|
-
{{ error }}
|
|
99
|
-
</slot>
|
|
100
|
-
</div>
|
|
101
|
-
<div v-else-if="props.help || !!slots.help" :class="ui.help({ class: props.ui?.help })" data-part="help">
|
|
102
|
-
<slot name="help" :help="props.help">
|
|
103
|
-
{{ props.help }}
|
|
104
|
-
</slot>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</Primitive>
|
|
72
|
+
<Primitive :as="props.as" :class="ui.root({ class: [props.ui?.root, props.class] })" :data-orientation="props.orientation" data-part="root">
|
|
73
|
+
<div :class="ui.wrapper({ class: props.ui?.wrapper })" data-part="wrapper">
|
|
74
|
+
<div v-if="props.label || !!slots.label" :class="ui.labelWrapper({ class: props.ui?.labelWrapper })" data-part="labelWrapper">
|
|
75
|
+
<Label :for="id" :class="ui.label({ class: props.ui?.label })" data-part="label">
|
|
76
|
+
<slot name="label" :label="props.label">
|
|
77
|
+
{{ props.label }}
|
|
78
|
+
</slot>
|
|
79
|
+
</Label>
|
|
80
|
+
<span v-if="props.hint || !!slots.hint" :id="`${ariaId}-hint`" :class="ui.hint({ class: props.ui?.hint })" data-part="hint">
|
|
81
|
+
<slot name="hint" :hint="props.hint">
|
|
82
|
+
{{ props.hint }}
|
|
83
|
+
</slot>
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<p v-if="props.description || !!slots.description" :id="`${ariaId}-description`" :class="ui.description({ class: props.ui?.description })" data-part="description">
|
|
88
|
+
<slot name="description" :description="props.description">
|
|
89
|
+
{{ props.description }}
|
|
90
|
+
</slot>
|
|
91
|
+
</p>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<div :class="(props.label || !!slots.label || props.description || !!slots.description) && ui.container({ class: props.ui?.container })" data-part="container">
|
|
95
|
+
<slot :error="error"></slot>
|
|
96
|
+
|
|
97
|
+
<div v-if="props.error !== false && (typeof error === 'string' && error || !!slots.error)" :id="`${ariaId}-error`" :class="ui.error({ class: props.ui?.error })" data-part="error">
|
|
98
|
+
<slot name="error" :error="error">
|
|
99
|
+
{{ error }}
|
|
100
|
+
</slot>
|
|
101
|
+
</div>
|
|
102
|
+
<div v-else-if="props.help || !!slots.help" :class="ui.help({ class: props.ui?.help })" data-part="help">
|
|
103
|
+
<slot name="help" :help="props.help">
|
|
104
|
+
{{ props.help }}
|
|
105
|
+
</slot>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</Primitive>
|
|
108
109
|
</template>
|
|
@@ -20,8 +20,11 @@ export interface FormFieldProps extends ComponentBaseProps {
|
|
|
20
20
|
error?: string | boolean;
|
|
21
21
|
hint?: string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The orientation of the form field.
|
|
24
|
+
* @default "vertical"
|
|
24
25
|
*/
|
|
26
|
+
orientation?: ThemeVariants['orientation'];
|
|
27
|
+
/** @default "md" */
|
|
25
28
|
size?: ThemeVariants['size'];
|
|
26
29
|
required?: boolean;
|
|
27
30
|
/** If true, validation on input will be active immediately instead of waiting for a blur event. */
|
|
@@ -53,9 +56,11 @@ export interface FormFieldSlots {
|
|
|
53
56
|
error?: boolean | string;
|
|
54
57
|
}>;
|
|
55
58
|
}
|
|
56
|
-
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FormFieldSlots>;
|
|
57
59
|
declare const _default: typeof __VLS_export;
|
|
58
60
|
export default _default;
|
|
61
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {
|
|
62
|
+
error: string | boolean;
|
|
63
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, FormFieldSlots>;
|
|
59
64
|
type __VLS_WithSlots<T, S> = T & {
|
|
60
65
|
new (): {
|
|
61
66
|
$slots: S;
|
|
@@ -15,6 +15,6 @@ const iconProps = useForwardProps(reactivePick(props, "name", "mode", "size", "c
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<Icon v-if="typeof props.name === 'string'" v-bind="iconProps" />
|
|
19
|
-
<component :is="props.name" v-else />
|
|
18
|
+
<Icon v-if="typeof props.name === 'string'" v-bind="iconProps" />
|
|
19
|
+
<component :is="props.name" v-else />
|
|
20
20
|
</template>
|
|
@@ -4,6 +4,6 @@ export interface IconProps {
|
|
|
4
4
|
size?: string | number;
|
|
5
5
|
customize?: (content: string, name?: string, prefix?: string, provider?: string) => string;
|
|
6
6
|
}
|
|
7
|
-
declare const __VLS_export: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
7
|
declare const _default: typeof __VLS_export;
|
|
9
8
|
export default _default;
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<IconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IconProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -107,52 +107,52 @@ defineExpose({
|
|
|
107
107
|
</script>
|
|
108
108
|
|
|
109
109
|
<template>
|
|
110
|
-
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
111
|
-
<span v-if="isLeading || !!props.avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })" data-part="leading">
|
|
112
|
-
<slot name="leading" :ui="ui">
|
|
113
|
-
<Icon
|
|
114
|
-
v-if="isLeading && leadingIconName"
|
|
115
|
-
:name="leadingIconName"
|
|
116
|
-
:class="ui.leadingIcon({ class: props.ui?.leadingIcon })"
|
|
117
|
-
data-part="leadingIcon"
|
|
118
|
-
/>
|
|
119
|
-
<Avatar
|
|
120
|
-
v-else-if="props.avatar"
|
|
121
|
-
:size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
122
|
-
v-bind="props.avatar"
|
|
123
|
-
:class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })"
|
|
124
|
-
data-part="leadingAvatar"
|
|
125
|
-
/>
|
|
126
|
-
</slot>
|
|
127
|
-
</span>
|
|
128
|
-
|
|
129
|
-
<input
|
|
130
|
-
ref="inputRef"
|
|
131
|
-
:type="props.type"
|
|
132
|
-
:value="modelValue"
|
|
133
|
-
:placeholder="props.placeholder"
|
|
134
|
-
:required="props.required"
|
|
135
|
-
:autocomplete="props.autocomplete"
|
|
136
|
-
v-bind="{ id, name, disabled, ...$attrs, ...ariaAttrs }"
|
|
137
|
-
:class="ui.base({ class: props.ui?.base })"
|
|
138
|
-
data-part="base"
|
|
139
|
-
@input="onInput"
|
|
140
|
-
@blur="onBlur"
|
|
141
|
-
@change="onChange"
|
|
142
|
-
@focus="emitFormFocus"
|
|
143
|
-
/>
|
|
144
|
-
|
|
145
|
-
<slot :ui="ui"></slot>
|
|
146
|
-
|
|
147
|
-
<span v-if="isTrailing || slots.trailing" :class="ui.trailing({ class: props.ui?.trailing })" data-part="trailing">
|
|
148
|
-
<slot name="trailing" :ui="ui">
|
|
149
|
-
<Icon
|
|
150
|
-
v-if="trailingIconName"
|
|
151
|
-
:name="trailingIconName"
|
|
152
|
-
:class="ui.trailingIcon({ class: props.ui?.trailingIcon })"
|
|
153
|
-
data-part="trailingIcon"
|
|
154
|
-
/>
|
|
155
|
-
</slot>
|
|
156
|
-
</span>
|
|
157
|
-
</Primitive>
|
|
110
|
+
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
|
|
111
|
+
<span v-if="isLeading || !!props.avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })" data-part="leading">
|
|
112
|
+
<slot name="leading" :ui="ui">
|
|
113
|
+
<Icon
|
|
114
|
+
v-if="isLeading && leadingIconName"
|
|
115
|
+
:name="leadingIconName"
|
|
116
|
+
:class="ui.leadingIcon({ class: props.ui?.leadingIcon })"
|
|
117
|
+
data-part="leadingIcon"
|
|
118
|
+
/>
|
|
119
|
+
<Avatar
|
|
120
|
+
v-else-if="props.avatar"
|
|
121
|
+
:size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()"
|
|
122
|
+
v-bind="props.avatar"
|
|
123
|
+
:class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })"
|
|
124
|
+
data-part="leadingAvatar"
|
|
125
|
+
/>
|
|
126
|
+
</slot>
|
|
127
|
+
</span>
|
|
128
|
+
|
|
129
|
+
<input
|
|
130
|
+
ref="inputRef"
|
|
131
|
+
:type="props.type"
|
|
132
|
+
:value="modelValue"
|
|
133
|
+
:placeholder="props.placeholder"
|
|
134
|
+
:required="props.required"
|
|
135
|
+
:autocomplete="props.autocomplete"
|
|
136
|
+
v-bind="{ id, name, disabled, ...$attrs, ...ariaAttrs }"
|
|
137
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
138
|
+
data-part="base"
|
|
139
|
+
@input="onInput"
|
|
140
|
+
@blur="onBlur"
|
|
141
|
+
@change="onChange"
|
|
142
|
+
@focus="emitFormFocus"
|
|
143
|
+
/>
|
|
144
|
+
|
|
145
|
+
<slot :ui="ui"></slot>
|
|
146
|
+
|
|
147
|
+
<span v-if="isTrailing || slots.trailing" :class="ui.trailing({ class: props.ui?.trailing })" data-part="trailing">
|
|
148
|
+
<slot name="trailing" :ui="ui">
|
|
149
|
+
<Icon
|
|
150
|
+
v-if="trailingIconName"
|
|
151
|
+
:name="trailingIconName"
|
|
152
|
+
:class="ui.trailingIcon({ class: props.ui?.trailingIcon })"
|
|
153
|
+
data-part="trailingIcon"
|
|
154
|
+
/>
|
|
155
|
+
</slot>
|
|
156
|
+
</span>
|
|
157
|
+
</Primitive>
|
|
158
158
|
</template>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
2
|
import type { PrimitiveProps } from 'reka-ui';
|
|
3
|
-
import type { InputHTMLAttributes } from 'vue';
|
|
4
3
|
import theme from '#build/ui/input';
|
|
5
4
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
6
5
|
import type { ComponentBaseProps, ComponentStyler, ComponentUIProps } from '../types';
|
|
6
|
+
import type { InputHTMLAttributes } from '../types/html';
|
|
7
7
|
import type { ModelModifiers } from '../types/input';
|
|
8
8
|
import type { AcceptableValue, MaybeNull, StaticSlot } from '../types/utils';
|
|
9
9
|
export type InputValue = AcceptableValue;
|
|
10
10
|
type ThemeVariants = VariantProps<typeof theme>;
|
|
11
|
-
export interface InputProps<T extends InputValue = InputValue> extends ComponentBaseProps, UseComponentIconsProps {
|
|
11
|
+
export interface InputProps<T extends InputValue = InputValue> extends ComponentBaseProps, UseComponentIconsProps, /** @vue-ignore */ Omit<InputHTMLAttributes, 'name' | 'type' | 'placeholder' | 'required' | 'autocomplete' | 'autofocus' | 'disabled'> {
|
|
12
12
|
/**
|
|
13
13
|
* The element or component this component should render as.
|
|
14
14
|
* @default "div"
|
|
@@ -35,7 +35,7 @@ export interface InputProps<T extends InputValue = InputValue> extends Component
|
|
|
35
35
|
disabled?: boolean;
|
|
36
36
|
defaultValue?: T;
|
|
37
37
|
modelValue?: T;
|
|
38
|
-
modelModifiers?: ModelModifiers
|
|
38
|
+
modelModifiers?: ModelModifiers<T>;
|
|
39
39
|
ui?: ComponentUIProps<typeof theme>;
|
|
40
40
|
}
|
|
41
41
|
export interface InputEmits<T extends InputValue> {
|
|
@@ -54,23 +54,27 @@ export interface InputSlots {
|
|
|
54
54
|
ui: ComponentStyler<typeof theme>;
|
|
55
55
|
}>;
|
|
56
56
|
}
|
|
57
|
-
declare const
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
declare const _default: typeof __VLS_export;
|
|
58
|
+
export default _default;
|
|
59
|
+
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
60
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<InputProps<T> & {
|
|
60
61
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
62
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
61
63
|
"onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
62
|
-
}> &
|
|
64
|
+
}> & (typeof globalThis extends {
|
|
65
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
66
|
+
} ? P : {});
|
|
63
67
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
64
68
|
inputRef: import("vue").Ref<MaybeNull<HTMLInputElement>, MaybeNull<HTMLInputElement>>;
|
|
65
69
|
}>) => void;
|
|
66
70
|
attrs: any;
|
|
67
71
|
slots: InputSlots;
|
|
68
|
-
emit: ((evt: "
|
|
72
|
+
emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void);
|
|
69
73
|
}>) => import("vue").VNode & {
|
|
70
74
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
71
75
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
77
|
+
[K in keyof T]: T[K];
|
|
78
|
+
} : {
|
|
75
79
|
[K in keyof T as K]: T[K];
|
|
76
|
-
} & {};
|
|
80
|
+
}) & {};
|
|
@@ -95,51 +95,51 @@ defineExpose({
|
|
|
95
95
|
</script>
|
|
96
96
|
|
|
97
97
|
<template>
|
|
98
|
-
<NumberFieldRoot
|
|
99
|
-
v-bind="{ ...rootProps, id, name, disabled, modelValue }"
|
|
100
|
-
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
101
|
-
data-part="root"
|
|
102
|
-
@update:model-value="onUpdate"
|
|
103
|
-
>
|
|
104
|
-
<NumberFieldInput
|
|
105
|
-
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
106
|
-
ref="inputRef"
|
|
107
|
-
:placeholder="props.placeholder"
|
|
108
|
-
:required="props.required"
|
|
109
|
-
:class="ui.base({ class: props.ui?.base })"
|
|
110
|
-
data-part="base"
|
|
111
|
-
@blur="onBlur"
|
|
112
|
-
@focus="emitFormFocus"
|
|
113
|
-
/>
|
|
114
|
-
|
|
115
|
-
<div v-if="props.increment" :class="ui.increment({ class: props.ui?.increment })" data-part="increment">
|
|
116
|
-
<NumberFieldIncrement :disabled="disabled || incrementDisabled" as-child>
|
|
117
|
-
<slot name="increment">
|
|
118
|
-
<Button
|
|
119
|
-
:icon="incrementIcon"
|
|
120
|
-
:size="props.size"
|
|
121
|
-
:color="color"
|
|
122
|
-
variant="link"
|
|
123
|
-
:aria-label="t('inputNumber.increment')"
|
|
124
|
-
v-bind="typeof props.increment === 'object' ? props.increment : void 0"
|
|
125
|
-
/>
|
|
126
|
-
</slot>
|
|
127
|
-
</NumberFieldIncrement>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div v-if="props.decrement" :class="ui.decrement({ class: props.ui?.decrement })" data-part="decrement">
|
|
131
|
-
<NumberFieldDecrement :disabled="disabled || decrementDisabled" as-child>
|
|
132
|
-
<slot name="decrement">
|
|
133
|
-
<Button
|
|
134
|
-
:icon="decrementIcon"
|
|
135
|
-
:size="props.size"
|
|
136
|
-
:color="color"
|
|
137
|
-
variant="link"
|
|
138
|
-
:aria-label="t('inputNumber.decrement')"
|
|
139
|
-
v-bind="typeof props.decrement === 'object' ? props.decrement : void 0"
|
|
140
|
-
/>
|
|
141
|
-
</slot>
|
|
142
|
-
</NumberFieldDecrement>
|
|
143
|
-
</div>
|
|
144
|
-
</NumberFieldRoot>
|
|
98
|
+
<NumberFieldRoot
|
|
99
|
+
v-bind="{ ...rootProps, id, name, disabled, modelValue }"
|
|
100
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
101
|
+
data-part="root"
|
|
102
|
+
@update:model-value="onUpdate"
|
|
103
|
+
>
|
|
104
|
+
<NumberFieldInput
|
|
105
|
+
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
106
|
+
ref="inputRef"
|
|
107
|
+
:placeholder="props.placeholder"
|
|
108
|
+
:required="props.required"
|
|
109
|
+
:class="ui.base({ class: props.ui?.base })"
|
|
110
|
+
data-part="base"
|
|
111
|
+
@blur="onBlur"
|
|
112
|
+
@focus="emitFormFocus"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<div v-if="props.increment" :class="ui.increment({ class: props.ui?.increment })" data-part="increment">
|
|
116
|
+
<NumberFieldIncrement :disabled="disabled || incrementDisabled" as-child>
|
|
117
|
+
<slot name="increment">
|
|
118
|
+
<Button
|
|
119
|
+
:icon="incrementIcon"
|
|
120
|
+
:size="props.size"
|
|
121
|
+
:color="color"
|
|
122
|
+
variant="link"
|
|
123
|
+
:aria-label="t('inputNumber.increment')"
|
|
124
|
+
v-bind="typeof props.increment === 'object' ? props.increment : void 0"
|
|
125
|
+
/>
|
|
126
|
+
</slot>
|
|
127
|
+
</NumberFieldIncrement>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div v-if="props.decrement" :class="ui.decrement({ class: props.ui?.decrement })" data-part="decrement">
|
|
131
|
+
<NumberFieldDecrement :disabled="disabled || decrementDisabled" as-child>
|
|
132
|
+
<slot name="decrement">
|
|
133
|
+
<Button
|
|
134
|
+
:icon="decrementIcon"
|
|
135
|
+
:size="props.size"
|
|
136
|
+
:color="color"
|
|
137
|
+
variant="link"
|
|
138
|
+
:aria-label="t('inputNumber.decrement')"
|
|
139
|
+
v-bind="typeof props.decrement === 'object' ? props.decrement : void 0"
|
|
140
|
+
/>
|
|
141
|
+
</slot>
|
|
142
|
+
</NumberFieldDecrement>
|
|
143
|
+
</div>
|
|
144
|
+
</NumberFieldRoot>
|
|
145
145
|
</template>
|