vuiii 1.0.0-beta.82 → 1.0.0-beta.83
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/dist/arrow-top-right-on-square-ncaAU5g2.js +7 -0
- package/dist/components/Autocomplete.vue.d.ts +70 -0
- package/dist/components/Checkbox.vue.d.ts +68 -0
- package/dist/components/Divider.vue.d.ts +39 -0
- package/dist/components/FormFields.vue.d.ts +6 -7
- package/dist/components/FormGroup.vue.d.ts +55 -0
- package/dist/components/Input.vue.d.ts +64 -0
- package/dist/components/RadioGroup.vue.d.ts +67 -0
- package/dist/components/Select.vue.d.ts +64 -0
- package/dist/components/Table.vue.d.ts +4 -0
- package/dist/components/Textarea.vue.d.ts +44 -0
- package/dist/composables/useCursor.d.ts +42 -0
- package/dist/composables/useDropArea.d.ts +60 -0
- package/dist/composables/useLoadData.d.ts +68 -0
- package/dist/composables/useLoadPaginatedData.d.ts +62 -0
- package/dist/composables/useOnClickOutside.d.ts +31 -0
- package/dist/composables/useOnFocusOutside.d.ts +24 -0
- package/dist/composables/useOnKeyPress.d.ts +25 -0
- package/dist/composables/usePageFromRouteQuery.d.ts +24 -0
- package/dist/composables/usePreventHandlingDrop.d.ts +19 -0
- package/dist/composables/useRouteQuery.d.ts +0 -7
- package/dist/composables/useSubmitAction.d.ts +64 -0
- package/dist/composables/useValidation.d.ts +71 -0
- package/dist/dialogStack.d.ts +96 -0
- package/dist/index.d.ts +6 -2
- package/dist/snackbar.d.ts +19 -0
- package/dist/types.d.ts +117 -5
- package/dist/utils/iconsResolver.d.ts +38 -0
- package/dist/utils/normalizeOptions.d.ts +40 -0
- package/dist/valueParsers/dateValueParser.d.ts +2 -0
- package/dist/valueParsers/numberValueParser.d.ts +2 -0
- package/dist/vuiii.css +1 -1
- package/dist/vuiii.js +838 -789
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const o = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
2
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" />
|
|
3
|
+
</svg>
|
|
4
|
+
`;
|
|
5
|
+
export {
|
|
6
|
+
o as default
|
|
7
|
+
};
|
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
import { InputWrapperProps, InputWrapperSlots } from './InputWrapper.vue';
|
|
2
2
|
import { Extractor, Option } from '../types';
|
|
3
3
|
export type AutocompleteFilterFn<T = any> = (option: Option<T>, query: string) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Autocomplete input with dropdown suggestions and keyboard navigation.
|
|
6
|
+
* Supports custom option rendering, filtering, and various data formats.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link module:normalizeOptions} for supported option formats and extractor props
|
|
9
|
+
*
|
|
10
|
+
* @component Autocomplete
|
|
11
|
+
* @generic T - The type of option data
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage with string array
|
|
15
|
+
* import { Autocomplete } from 'vuiii'
|
|
16
|
+
*
|
|
17
|
+
* <Autocomplete v-model="search" :options="['Apple', 'Banana', 'Cherry']" />
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // With object options and extractors
|
|
21
|
+
* const users = [
|
|
22
|
+
* { id: 1, name: 'John Doe', email: 'john@example.com' },
|
|
23
|
+
* { id: 2, name: 'Jane Smith', email: 'jane@example.com' }
|
|
24
|
+
* ]
|
|
25
|
+
*
|
|
26
|
+
* <Autocomplete
|
|
27
|
+
* v-model="search"
|
|
28
|
+
* :options="users"
|
|
29
|
+
* option-label="name"
|
|
30
|
+
* option-value="id"
|
|
31
|
+
* option-description="email"
|
|
32
|
+
* @select="(option) => selectedUser = option.data"
|
|
33
|
+
* />
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // With custom filter function
|
|
37
|
+
* const customFilter = (option, query) => {
|
|
38
|
+
* return option.label.startsWith(query)
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* <Autocomplete
|
|
42
|
+
* v-model="search"
|
|
43
|
+
* :options="options"
|
|
44
|
+
* :filter="customFilter"
|
|
45
|
+
* />
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // With custom option rendering
|
|
49
|
+
* <Autocomplete v-model="search" :options="users" option-label="name">
|
|
50
|
+
* <template #option="{ option, isHighlighted }">
|
|
51
|
+
* <div :class="{ highlighted: isHighlighted }">
|
|
52
|
+
* <strong>{{ option.label }}</strong>
|
|
53
|
+
* <small>{{ option.description }}</small>
|
|
54
|
+
* </div>
|
|
55
|
+
* </template>
|
|
56
|
+
* </Autocomplete>
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Programmatic control via ref
|
|
60
|
+
* const autocompleteRef = ref<AutocompleteRef>()
|
|
61
|
+
*
|
|
62
|
+
* autocompleteRef.value?.open()
|
|
63
|
+
* autocompleteRef.value?.close()
|
|
64
|
+
* autocompleteRef.value?.focus()
|
|
65
|
+
*
|
|
66
|
+
* @slot prefix - Content before the input
|
|
67
|
+
* @slot suffix - Content after the input
|
|
68
|
+
* @slot option - Custom option rendering. Props: { option, index, isHighlighted }
|
|
69
|
+
*
|
|
70
|
+
* @emits select - When an option is selected. Payload: Option<T>
|
|
71
|
+
* @emits prefix-icon-click - When prefix icon is clicked
|
|
72
|
+
* @emits suffix-icon-click - When suffix icon is clicked
|
|
73
|
+
*/
|
|
4
74
|
export type AutocompleteRef = {
|
|
5
75
|
inputElement: HTMLInputElement;
|
|
6
76
|
focus: () => void;
|
|
@@ -1,10 +1,75 @@
|
|
|
1
1
|
import { InputSize, ValueParser } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Checkbox input with toggle/switch variant and indeterminate state support.
|
|
4
|
+
* Can be used standalone or within CheckboxGroup.
|
|
5
|
+
*
|
|
6
|
+
* @component Checkbox
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Basic usage
|
|
10
|
+
* import { Checkbox } from 'vuiii'
|
|
11
|
+
*
|
|
12
|
+
* <Checkbox v-model="accepted" label="I accept the terms" />
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Switch variant (toggle)
|
|
16
|
+
* <Checkbox v-model="enabled" switch label="Enable notifications" />
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // With description
|
|
20
|
+
* <Checkbox
|
|
21
|
+
* v-model="newsletter"
|
|
22
|
+
* label="Subscribe to newsletter"
|
|
23
|
+
* description="Get weekly updates about new features"
|
|
24
|
+
* />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Required checkbox
|
|
28
|
+
* <Checkbox v-model="terms" required label="I agree to the terms" />
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Indeterminate state (for "select all" patterns)
|
|
32
|
+
* <Checkbox
|
|
33
|
+
* :model-value="allSelected"
|
|
34
|
+
* :indeterminate="someSelected && !allSelected"
|
|
35
|
+
* label="Select all"
|
|
36
|
+
* @update:model-value="toggleAll"
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Different sizes
|
|
41
|
+
* <Checkbox v-model="small" size="small" label="Small" />
|
|
42
|
+
* <Checkbox v-model="normal" size="normal" label="Normal" />
|
|
43
|
+
* <Checkbox v-model="large" size="large" label="Large" />
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Custom value parser (for non-boolean values)
|
|
47
|
+
* const yesNoParser = {
|
|
48
|
+
* parse: (checked) => checked ? 'yes' : 'no',
|
|
49
|
+
* stringify: (value) => value === 'yes'
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* <Checkbox v-model="answer" :value-parser="yesNoParser" label="Accept" />
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Custom symbol slot
|
|
56
|
+
* <Checkbox v-model="checked">
|
|
57
|
+
* <template #symbol="{ checked, disabled, indeterminate }">
|
|
58
|
+
* <Icon :name="checked ? 'check-square' : 'square'" />
|
|
59
|
+
* </template>
|
|
60
|
+
* Custom checkbox label
|
|
61
|
+
* </Checkbox>
|
|
62
|
+
*
|
|
63
|
+
* @slot default - Label content (alternative to label prop)
|
|
64
|
+
* @slot symbol - Custom checkbox/switch symbol. Props: { checked, disabled, indeterminate, size }
|
|
65
|
+
*/
|
|
2
66
|
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
3
67
|
modelValue?: any;
|
|
4
68
|
} & {
|
|
5
69
|
required?: boolean;
|
|
6
70
|
disabled?: boolean;
|
|
7
71
|
switch?: boolean;
|
|
72
|
+
indeterminate?: boolean;
|
|
8
73
|
label?: string;
|
|
9
74
|
description?: string;
|
|
10
75
|
size?: InputSize;
|
|
@@ -17,6 +82,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
|
17
82
|
required?: boolean;
|
|
18
83
|
disabled?: boolean;
|
|
19
84
|
switch?: boolean;
|
|
85
|
+
indeterminate?: boolean;
|
|
20
86
|
label?: string;
|
|
21
87
|
description?: string;
|
|
22
88
|
size?: InputSize;
|
|
@@ -30,6 +96,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
|
30
96
|
symbol?: (props: {
|
|
31
97
|
checked: boolean;
|
|
32
98
|
disabled: boolean;
|
|
99
|
+
indeterminate: boolean;
|
|
33
100
|
size: InputSize;
|
|
34
101
|
}) => any;
|
|
35
102
|
}> & {
|
|
@@ -37,6 +104,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
|
37
104
|
symbol?: (props: {
|
|
38
105
|
checked: boolean;
|
|
39
106
|
disabled: boolean;
|
|
107
|
+
indeterminate: boolean;
|
|
40
108
|
size: InputSize;
|
|
41
109
|
}) => any;
|
|
42
110
|
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual separator line for content sections.
|
|
3
|
+
* Can be horizontal (default) or vertical.
|
|
4
|
+
*
|
|
5
|
+
* @component Divider
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Horizontal divider (default)
|
|
9
|
+
* import { Divider } from 'vuiii'
|
|
10
|
+
*
|
|
11
|
+
* <div>Section 1</div>
|
|
12
|
+
* <Divider />
|
|
13
|
+
* <div>Section 2</div>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Vertical divider (for inline content)
|
|
17
|
+
* <div style="display: flex; align-items: center;">
|
|
18
|
+
* <span>Item 1</span>
|
|
19
|
+
* <Divider orientation="vertical" />
|
|
20
|
+
* <span>Item 2</span>
|
|
21
|
+
* </div>
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // In FormFields (using FORM_DIVIDER constant)
|
|
25
|
+
* import { FORM_DIVIDER } from 'vuiii'
|
|
26
|
+
*
|
|
27
|
+
* const fields = [
|
|
28
|
+
* { name: 'name', component: Input, label: 'Name' },
|
|
29
|
+
* FORM_DIVIDER,
|
|
30
|
+
* { name: 'email', component: Input, label: 'Email' }
|
|
31
|
+
* ]
|
|
32
|
+
*/
|
|
33
|
+
type __VLS_Props = {
|
|
34
|
+
orientation?: "horizontal" | "vertical";
|
|
35
|
+
};
|
|
36
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
37
|
+
orientation: "horizontal" | "vertical";
|
|
38
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLHRElement>;
|
|
39
|
+
export default _default;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormFieldOrRow, ObjectKeyOrAnyString, ValidationFieldResults } from '../types';
|
|
2
2
|
declare const _default: <Data extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
4
|
readonly "onUpdate:model-value"?: ((value: any) => any) | undefined;
|
|
5
5
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:model-value"> & {
|
|
6
|
-
fields:
|
|
6
|
+
fields: FormFieldOrRow<Data>[];
|
|
7
7
|
modelValue: any;
|
|
8
8
|
validationResults?: Partial<Record<ObjectKeyOrAnyString<Data>, ValidationFieldResults>>;
|
|
9
|
+
orientation?: "vertical" | "horizontal";
|
|
9
10
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
10
11
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
11
12
|
attrs: any;
|
|
12
13
|
slots: Partial<Record<`field:${string}`, (_: {
|
|
13
14
|
index: number;
|
|
14
|
-
value: unknown;
|
|
15
|
-
required: boolean;
|
|
16
|
-
disabled: boolean;
|
|
17
|
-
invalid: boolean | undefined;
|
|
18
|
-
errorMessage: string | undefined;
|
|
19
15
|
name: ObjectKeyOrAnyString<Data>;
|
|
20
16
|
label?: string;
|
|
21
17
|
description?: string;
|
|
22
18
|
hint?: string;
|
|
19
|
+
required?: boolean | ((value: any) => boolean);
|
|
20
|
+
disabled?: boolean | ((value: any) => boolean);
|
|
23
21
|
component: string | import('vue').Component | import('vue').AsyncComponentLoader;
|
|
24
22
|
props?: Record<string, unknown>;
|
|
23
|
+
value?: import('../types').FormFieldValue<Data> | undefined;
|
|
25
24
|
}) => any>>;
|
|
26
25
|
emit: (evt: "update:model-value", value: any) => void;
|
|
27
26
|
}>) => import('vue').VNode & {
|
|
@@ -1,3 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form field wrapper with label, description, hint, and error message support.
|
|
3
|
+
* Used by FormFields internally, but can be used standalone for custom form layouts.
|
|
4
|
+
*
|
|
5
|
+
* @component FormGroup
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Basic usage with label
|
|
9
|
+
* import { FormGroup, Input } from 'vuiii'
|
|
10
|
+
*
|
|
11
|
+
* <FormGroup label="Email">
|
|
12
|
+
* <Input v-model="email" type="email" />
|
|
13
|
+
* </FormGroup>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // With description and hint
|
|
17
|
+
* <FormGroup
|
|
18
|
+
* label="Password"
|
|
19
|
+
* description="Choose a strong password for your account"
|
|
20
|
+
* hint="Must be at least 8 characters"
|
|
21
|
+
* >
|
|
22
|
+
* <Input v-model="password" type="password" />
|
|
23
|
+
* </FormGroup>
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // With required indicator and validation error
|
|
27
|
+
* <FormGroup
|
|
28
|
+
* label="Username"
|
|
29
|
+
* required
|
|
30
|
+
* :error="errors.username"
|
|
31
|
+
* >
|
|
32
|
+
* <Input v-model="username" :invalid="!!errors.username" />
|
|
33
|
+
* </FormGroup>
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // With custom label slot
|
|
37
|
+
* <FormGroup>
|
|
38
|
+
* <template #label>
|
|
39
|
+
* <span>Email</span>
|
|
40
|
+
* <Icon name="info" v-tooltip="'We will never share your email'" />
|
|
41
|
+
* </template>
|
|
42
|
+
* <Input v-model="email" />
|
|
43
|
+
* </FormGroup>
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* // Boolean error (shows invalid state without message)
|
|
47
|
+
* <FormGroup label="Field" :error="hasError">
|
|
48
|
+
* <Input v-model="value" :invalid="hasError" />
|
|
49
|
+
* </FormGroup>
|
|
50
|
+
*
|
|
51
|
+
* @slot default - The form input element
|
|
52
|
+
* @slot label - Custom label content (replaces label prop)
|
|
53
|
+
* @slot description - Custom description content (replaces description prop)
|
|
54
|
+
* @slot hint - Custom hint content (replaces hint prop)
|
|
55
|
+
*/
|
|
1
56
|
type __VLS_Props = {
|
|
2
57
|
label?: string;
|
|
3
58
|
for?: string;
|
|
@@ -1,4 +1,64 @@
|
|
|
1
1
|
import { InputWrapperProps, InputWrapperSlots } from './InputWrapper.vue';
|
|
2
|
+
/**
|
|
3
|
+
* Text input component with icon support, size variants, and validation states.
|
|
4
|
+
* Wraps native input with InputWrapper for consistent styling.
|
|
5
|
+
*
|
|
6
|
+
* @component Input
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Basic usage
|
|
10
|
+
* import { Input } from 'vuiii'
|
|
11
|
+
*
|
|
12
|
+
* <Input v-model="name" placeholder="Enter your name" />
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Different input types (passed via attrs)
|
|
16
|
+
* <Input v-model="email" type="email" placeholder="Email" />
|
|
17
|
+
* <Input v-model="password" type="password" placeholder="Password" />
|
|
18
|
+
* <Input v-model="count" type="number" placeholder="Count" />
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // With icons
|
|
22
|
+
* <Input v-model="search" prefixIcon="magnifying-glass" placeholder="Search..." />
|
|
23
|
+
* <Input v-model="email" suffixIcon="envelope" placeholder="Email" />
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // With clickable icons (emits events)
|
|
27
|
+
* <Input
|
|
28
|
+
* v-model="password"
|
|
29
|
+
* :suffix-icon="showPassword ? 'eye-slash' : 'eye'"
|
|
30
|
+
* :type="showPassword ? 'text' : 'password'"
|
|
31
|
+
* @suffix-icon-click="showPassword = !showPassword"
|
|
32
|
+
* />
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Different sizes
|
|
36
|
+
* <Input v-model="text" size="small" placeholder="Small" />
|
|
37
|
+
* <Input v-model="text" size="normal" placeholder="Normal" />
|
|
38
|
+
* <Input v-model="text" size="large" placeholder="Large" />
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Validation state
|
|
42
|
+
* <Input v-model="email" :invalid="!isValidEmail" placeholder="Email" />
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Value as number or date (for type="number" or type="date")
|
|
46
|
+
* <Input v-model="count" type="number" value-as-number />
|
|
47
|
+
* <Input v-model="date" type="date" value-as-date />
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Programmatic control via ref
|
|
51
|
+
* const inputRef = ref<InputRef>()
|
|
52
|
+
*
|
|
53
|
+
* inputRef.value?.focus()
|
|
54
|
+
* inputRef.value?.select()
|
|
55
|
+
*
|
|
56
|
+
* @slot prefix - Content before the input (replaces prefixIcon)
|
|
57
|
+
* @slot suffix - Content after the input (replaces suffixIcon)
|
|
58
|
+
*
|
|
59
|
+
* @emits prefix-icon-click - When prefix icon is clicked
|
|
60
|
+
* @emits suffix-icon-click - When suffix icon is clicked
|
|
61
|
+
*/
|
|
2
62
|
export type InputRef = {
|
|
3
63
|
input: HTMLInputElement;
|
|
4
64
|
focus: () => void;
|
|
@@ -8,6 +68,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
|
8
68
|
modelValue?: string | number | Date | null | undefined;
|
|
9
69
|
} & InputWrapperProps & {
|
|
10
70
|
inputClass?: any;
|
|
71
|
+
valueAsNumber?: boolean;
|
|
72
|
+
valueAsDate?: boolean;
|
|
11
73
|
}, {
|
|
12
74
|
input: import('vue').Ref<any, any>;
|
|
13
75
|
focus: () => any;
|
|
@@ -20,6 +82,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
|
20
82
|
modelValue?: string | number | Date | null | undefined;
|
|
21
83
|
} & InputWrapperProps & {
|
|
22
84
|
inputClass?: any;
|
|
85
|
+
valueAsNumber?: boolean;
|
|
86
|
+
valueAsDate?: boolean;
|
|
23
87
|
}> & Readonly<{
|
|
24
88
|
"onPrefix-icon-click"?: (() => any) | undefined;
|
|
25
89
|
"onSuffix-icon-click"?: (() => any) | undefined;
|
|
@@ -1,4 +1,71 @@
|
|
|
1
1
|
import { Extractor, Option, ValueParser } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Radio button group for single selection from a list of options.
|
|
4
|
+
* Normalizes various option formats and supports custom value parsing.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link module:normalizeOptions} for supported option formats and extractor props
|
|
7
|
+
*
|
|
8
|
+
* @component RadioGroup
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Basic usage with string array
|
|
12
|
+
* import { RadioGroup } from 'vuiii'
|
|
13
|
+
*
|
|
14
|
+
* <RadioGroup v-model="color" :options="['Red', 'Green', 'Blue']" />
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // With object options and extractors
|
|
18
|
+
* const plans = [
|
|
19
|
+
* { id: 'free', name: 'Free', info: '0$/month' },
|
|
20
|
+
* { id: 'pro', name: 'Pro', info: '10$/month' },
|
|
21
|
+
* { id: 'enterprise', name: 'Enterprise', info: 'Contact us' }
|
|
22
|
+
* ]
|
|
23
|
+
*
|
|
24
|
+
* <RadioGroup
|
|
25
|
+
* v-model="selectedPlan"
|
|
26
|
+
* :options="plans"
|
|
27
|
+
* option-value="id"
|
|
28
|
+
* option-label="name"
|
|
29
|
+
* option-description="info"
|
|
30
|
+
* />
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Inline layout (horizontal)
|
|
34
|
+
* <RadioGroup
|
|
35
|
+
* v-model="size"
|
|
36
|
+
* :options="['Small', 'Medium', 'Large']"
|
|
37
|
+
* inline
|
|
38
|
+
* />
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // With type parsing
|
|
42
|
+
* <RadioGroup
|
|
43
|
+
* v-model="quantity"
|
|
44
|
+
* :options="[1, 2, 3, 4, 5]"
|
|
45
|
+
* type="number"
|
|
46
|
+
* />
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // With custom option rendering
|
|
50
|
+
* <RadioGroup v-model="theme" :options="themes" option-value="id">
|
|
51
|
+
* <template #default="{ option }">
|
|
52
|
+
* <div class="theme-preview" :style="{ background: option.data.color }">
|
|
53
|
+
* {{ option.label }}
|
|
54
|
+
* </div>
|
|
55
|
+
* </template>
|
|
56
|
+
* </RadioGroup>
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // With custom symbol slot
|
|
60
|
+
* <RadioGroup v-model="selected" :options="options">
|
|
61
|
+
* <template #symbol="{ checked, disabled }">
|
|
62
|
+
* <Icon :name="checked ? 'circle-dot' : 'circle'" />
|
|
63
|
+
* </template>
|
|
64
|
+
* </RadioGroup>
|
|
65
|
+
*
|
|
66
|
+
* @slot default - Custom option content. Props: { option }
|
|
67
|
+
* @slot symbol - Custom radio symbol. Props: { checked, disabled }
|
|
68
|
+
*/
|
|
2
69
|
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
|
|
3
70
|
modelValue?: any;
|
|
4
71
|
} & {
|
|
@@ -1,4 +1,68 @@
|
|
|
1
1
|
import { Extractor, InputSize, ValueParser } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Native select dropdown with support for various option formats and type parsing.
|
|
4
|
+
* Normalizes arrays, objects, and grouped options into a consistent format.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link module:normalizeOptions} for supported option formats and extractor props
|
|
7
|
+
*
|
|
8
|
+
* @component Select
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Basic usage with string array
|
|
12
|
+
* import { Select } from 'vuiii'
|
|
13
|
+
*
|
|
14
|
+
* <Select v-model="color" :options="['Red', 'Green', 'Blue']" />
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // With object array and extractors
|
|
18
|
+
* const countries = [
|
|
19
|
+
* { code: 'us', name: 'United States' },
|
|
20
|
+
* { code: 'uk', name: 'United Kingdom' }
|
|
21
|
+
* ]
|
|
22
|
+
*
|
|
23
|
+
* <Select
|
|
24
|
+
* v-model="country"
|
|
25
|
+
* :options="countries"
|
|
26
|
+
* option-value="code"
|
|
27
|
+
* option-label="name"
|
|
28
|
+
* placeholder="Select a country"
|
|
29
|
+
* />
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // With key-value object options
|
|
33
|
+
* const statuses = { draft: 'Draft', published: 'Published', archived: 'Archived' }
|
|
34
|
+
*
|
|
35
|
+
* <Select v-model="status" :options="statuses" />
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // With grouped options (optgroup)
|
|
39
|
+
* const vehicles = [
|
|
40
|
+
* { category: 'Cars', items: [{ id: 1, name: 'Sedan' }, { id: 2, name: 'SUV' }] },
|
|
41
|
+
* { category: 'Bikes', items: [{ id: 3, name: 'Mountain' }, { id: 4, name: 'Road' }] }
|
|
42
|
+
* ]
|
|
43
|
+
*
|
|
44
|
+
* <Select
|
|
45
|
+
* v-model="vehicle"
|
|
46
|
+
* :options="vehicles"
|
|
47
|
+
* group-label="category"
|
|
48
|
+
* group-options="items"
|
|
49
|
+
* option-value="id"
|
|
50
|
+
* option-label="name"
|
|
51
|
+
* />
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // With type parsing (automatically converts string value to number)
|
|
55
|
+
* <Select v-model="count" :options="[1, 2, 3, 4, 5]" type="number" />
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // With custom value parser
|
|
59
|
+
* const dateParser = {
|
|
60
|
+
* parse: (str) => new Date(str),
|
|
61
|
+
* stringify: (date) => date.toISOString()
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* <Select v-model="date" :options="dates" :value-parser="dateParser" />
|
|
65
|
+
*/
|
|
2
66
|
declare const _default: import('vue').DefineComponent<{
|
|
3
67
|
modelValue?: any;
|
|
4
68
|
} & {
|
|
@@ -39,6 +39,8 @@ declare const _default: <T extends object>(__VLS_props: NonNullable<Awaited<type
|
|
|
39
39
|
item: T;
|
|
40
40
|
value: any;
|
|
41
41
|
index: number;
|
|
42
|
+
}) => any; } & { [K_1 in `header:${string & {}}` | `header:${keyof T & string}`]: (props: {
|
|
43
|
+
column: TableColumn<T>;
|
|
42
44
|
}) => any; } & {
|
|
43
45
|
rowOptions?: (props: {
|
|
44
46
|
item: T;
|
|
@@ -51,6 +53,8 @@ declare const _default: <T extends object>(__VLS_props: NonNullable<Awaited<type
|
|
|
51
53
|
item: T;
|
|
52
54
|
value: any;
|
|
53
55
|
index: number;
|
|
56
|
+
}) => any; } & { [K_1 in `header:${string & {}}` | `header:${keyof T & string}`]: (props: {
|
|
57
|
+
column: TableColumn<T>;
|
|
54
58
|
}) => any; } & {
|
|
55
59
|
rowOptions?: (props: {
|
|
56
60
|
item: T;
|
|
@@ -1,4 +1,48 @@
|
|
|
1
1
|
import { InputWrapperProps, InputWrapperSlots } from './InputWrapper.vue';
|
|
2
|
+
/**
|
|
3
|
+
* Multi-line text input with InputWrapper styling.
|
|
4
|
+
* Supports prefix icon and programmatic control.
|
|
5
|
+
*
|
|
6
|
+
* @component Textarea
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Basic usage
|
|
10
|
+
* import { Textarea } from 'vuiii'
|
|
11
|
+
*
|
|
12
|
+
* <Textarea v-model="description" placeholder="Enter description..." />
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // With rows and placeholder
|
|
16
|
+
* <Textarea
|
|
17
|
+
* v-model="content"
|
|
18
|
+
* placeholder="Write your message..."
|
|
19
|
+
* rows="5"
|
|
20
|
+
* />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With prefix icon
|
|
24
|
+
* <Textarea v-model="notes" prefix-icon="document-text" placeholder="Notes..." />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Validation state
|
|
28
|
+
* <Textarea v-model="bio" :invalid="errors.bio" placeholder="Bio" />
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Disabled and readonly states
|
|
32
|
+
* <Textarea v-model="text" disabled />
|
|
33
|
+
* <Textarea v-model="text" readonly />
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Programmatic control via ref
|
|
37
|
+
* const textareaRef = ref<TextareaRef>()
|
|
38
|
+
*
|
|
39
|
+
* textareaRef.value?.focus()
|
|
40
|
+
* textareaRef.value?.select()
|
|
41
|
+
*
|
|
42
|
+
* @slot prefix - Content before the textarea (replaces prefixIcon)
|
|
43
|
+
*
|
|
44
|
+
* @emits prefix-icon-click - When prefix icon is clicked
|
|
45
|
+
*/
|
|
2
46
|
export type TextareaRef = {
|
|
3
47
|
focus: () => void;
|
|
4
48
|
select: () => void;
|
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Manages cursor position for navigating through arrays.
|
|
4
|
+
* Used internally by [Autocomplete](/components/autocomplete) for keyboard navigation.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of items in the array
|
|
7
|
+
* @param items - Array or ref to array of items
|
|
8
|
+
* @param options - Configuration options
|
|
9
|
+
* @param options.cycle - Wrap around when reaching start/end
|
|
10
|
+
* @param options.onCursorMove - Callback when cursor position changes
|
|
11
|
+
* @returns Object with cursor state and navigation methods
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage
|
|
15
|
+
* import { useCursor } from 'vuiii'
|
|
16
|
+
*
|
|
17
|
+
* const items = ref(['Apple', 'Banana', 'Cherry'])
|
|
18
|
+
*
|
|
19
|
+
* const {
|
|
20
|
+
* cursorIndex,
|
|
21
|
+
* cursorItem,
|
|
22
|
+
* moveCursorForward,
|
|
23
|
+
* moveCursorBack,
|
|
24
|
+
* resetCursor
|
|
25
|
+
* } = useCursor(items)
|
|
26
|
+
*
|
|
27
|
+
* console.log(cursorItem.value) // 'Apple'
|
|
28
|
+
* moveCursorForward()
|
|
29
|
+
* console.log(cursorItem.value) // 'Banana'
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // With cycling
|
|
33
|
+
* const { moveCursorForward } = useCursor(items, { cycle: true })
|
|
34
|
+
* // At last item, moveCursorForward() goes back to first
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* // Handle keyboard navigation
|
|
38
|
+
* function handleKeydown(e: KeyboardEvent) {
|
|
39
|
+
* if (e.key === 'ArrowDown') moveCursorForward()
|
|
40
|
+
* if (e.key === 'ArrowUp') moveCursorBack()
|
|
41
|
+
* if (e.key === 'Enter') selectItem(cursorItem.value)
|
|
42
|
+
* }
|
|
43
|
+
*/
|
|
2
44
|
export declare function useCursor<T = unknown>(items: Ref<T[]> | T[], options?: {
|
|
3
45
|
cycle?: boolean;
|
|
4
46
|
onCursorMove?: () => void;
|