@allsrvsonline/vue-component-library 0.1.0 → 0.1.2
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/index.d.ts +302 -1
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,302 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
import { PublicProps } from 'vue';
|
|
5
|
+
import { Ref } from 'vue';
|
|
6
|
+
|
|
7
|
+
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
8
|
+
click: (event: MouseEvent) => any;
|
|
9
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
variant: ButtonVariant;
|
|
13
|
+
size: ButtonSize;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
fullWidth: boolean;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
type: "button" | "submit" | "reset";
|
|
18
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
19
|
+
|
|
20
|
+
declare const __VLS_component_2: DefineComponent<BaseCardProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<BaseCardProps> & Readonly<{}>, {
|
|
21
|
+
elevated: boolean;
|
|
22
|
+
padding: boolean;
|
|
23
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* BaseButton - A versatile button component with multiple variants and sizes
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```vue
|
|
30
|
+
* <BaseButton variant="primary" size="medium" @click="handleClick">
|
|
31
|
+
* Click me
|
|
32
|
+
* </BaseButton>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare type __VLS_Props = BaseButtonProps & {
|
|
36
|
+
type?: 'button' | 'submit' | 'reset';
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
declare function __VLS_template(): {
|
|
40
|
+
attrs: Partial<{}>;
|
|
41
|
+
slots: {
|
|
42
|
+
default?(_: {}): any;
|
|
43
|
+
};
|
|
44
|
+
refs: {};
|
|
45
|
+
rootEl: HTMLButtonElement;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
declare function __VLS_template_2(): {
|
|
49
|
+
attrs: Partial<{}>;
|
|
50
|
+
slots: {
|
|
51
|
+
header?(_: {}): any;
|
|
52
|
+
default?(_: {}): any;
|
|
53
|
+
footer?(_: {}): any;
|
|
54
|
+
};
|
|
55
|
+
refs: {};
|
|
56
|
+
rootEl: HTMLDivElement;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
60
|
+
|
|
61
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
62
|
+
|
|
63
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
64
|
+
new (): {
|
|
65
|
+
$slots: S;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
70
|
+
new (): {
|
|
71
|
+
$slots: S;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export declare const BaseButton: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Events emitted by BaseButton
|
|
79
|
+
*/
|
|
80
|
+
export declare interface BaseButtonEmits {
|
|
81
|
+
/**
|
|
82
|
+
* Emitted when button is clicked
|
|
83
|
+
*/
|
|
84
|
+
(e: 'click', event: MouseEvent): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Props for BaseButton component
|
|
89
|
+
*/
|
|
90
|
+
export declare interface BaseButtonProps {
|
|
91
|
+
/**
|
|
92
|
+
* The visual style variant of the button
|
|
93
|
+
* @default 'primary'
|
|
94
|
+
*/
|
|
95
|
+
variant?: ButtonVariant;
|
|
96
|
+
/**
|
|
97
|
+
* The size of the button
|
|
98
|
+
* @default 'medium'
|
|
99
|
+
*/
|
|
100
|
+
size?: ButtonSize;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the button is disabled
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the button should take full width
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
fullWidth?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the button is in loading state
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
loading?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export declare const BaseCard: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* BaseCard - A container component for grouping related content
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```vue
|
|
125
|
+
* <BaseCard title="Card Title" elevated>
|
|
126
|
+
* <p>Card content goes here</p>
|
|
127
|
+
* <template #footer>
|
|
128
|
+
* <BaseButton>Action</BaseButton>
|
|
129
|
+
* </template>
|
|
130
|
+
* </BaseCard>
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
declare interface BaseCardProps {
|
|
134
|
+
/**
|
|
135
|
+
* Card title (alternative to header slot)
|
|
136
|
+
*/
|
|
137
|
+
title?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the card has elevated shadow
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
elevated?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether the card has padding
|
|
145
|
+
* @default true
|
|
146
|
+
*/
|
|
147
|
+
padding?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export declare const BaseInput: DefineComponent<BaseInputProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
151
|
+
"update:modelValue": (value: string) => any;
|
|
152
|
+
focus: (event: FocusEvent) => any;
|
|
153
|
+
blur: (event: FocusEvent) => any;
|
|
154
|
+
}, string, PublicProps, Readonly<BaseInputProps> & Readonly<{
|
|
155
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
156
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
157
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
158
|
+
}>, {
|
|
159
|
+
disabled: boolean;
|
|
160
|
+
type: "text" | "email" | "password" | "number" | "tel" | "url";
|
|
161
|
+
modelValue: string;
|
|
162
|
+
required: boolean;
|
|
163
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Events emitted by BaseInput
|
|
167
|
+
*/
|
|
168
|
+
export declare interface BaseInputEmits {
|
|
169
|
+
/**
|
|
170
|
+
* Emitted when value changes (v-model)
|
|
171
|
+
*/
|
|
172
|
+
(e: 'update:modelValue', value: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* Emitted when input is focused
|
|
175
|
+
*/
|
|
176
|
+
(e: 'focus', event: FocusEvent): void;
|
|
177
|
+
/**
|
|
178
|
+
* Emitted when input loses focus
|
|
179
|
+
*/
|
|
180
|
+
(e: 'blur', event: FocusEvent): void;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Props for BaseInput component
|
|
185
|
+
*/
|
|
186
|
+
export declare interface BaseInputProps {
|
|
187
|
+
/**
|
|
188
|
+
* The input value (v-model)
|
|
189
|
+
*/
|
|
190
|
+
modelValue?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Input type
|
|
193
|
+
* @default 'text'
|
|
194
|
+
*/
|
|
195
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
|
|
196
|
+
/**
|
|
197
|
+
* Placeholder text
|
|
198
|
+
*/
|
|
199
|
+
placeholder?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Whether the input is disabled
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
disabled?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Whether the input is required
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
required?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Input label
|
|
212
|
+
*/
|
|
213
|
+
label?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Error message to display
|
|
216
|
+
*/
|
|
217
|
+
error?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Button size types
|
|
222
|
+
*/
|
|
223
|
+
export declare type ButtonSize = 'small' | 'medium' | 'large';
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Type definitions for the component library
|
|
227
|
+
*/
|
|
228
|
+
/**
|
|
229
|
+
* Base button variant types
|
|
230
|
+
*/
|
|
231
|
+
export declare type ButtonVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning';
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Utility functions for the component library
|
|
235
|
+
*/
|
|
236
|
+
/**
|
|
237
|
+
* Combines multiple CSS class names, filtering out falsy values
|
|
238
|
+
*
|
|
239
|
+
* @param classes - Array of class names or conditional class names
|
|
240
|
+
* @returns Combined class string
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* cn('btn', isActive && 'btn--active', 'btn--large')
|
|
245
|
+
* // Returns: 'btn btn--active btn--large' (if isActive is true)
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export declare function cn(...classes: (string | false | null | undefined)[]): string;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Debounces a function call
|
|
252
|
+
*
|
|
253
|
+
* @param fn - Function to debounce
|
|
254
|
+
* @param delay - Delay in milliseconds
|
|
255
|
+
* @returns Debounced function
|
|
256
|
+
*/
|
|
257
|
+
export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Generates a unique ID
|
|
261
|
+
*
|
|
262
|
+
* @param prefix - Optional prefix for the ID
|
|
263
|
+
* @returns Unique ID string
|
|
264
|
+
*/
|
|
265
|
+
export declare function generateId(prefix?: string): string;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Composable for detecting clicks outside an element
|
|
269
|
+
*
|
|
270
|
+
* @param elementRef - Reference to the element to monitor
|
|
271
|
+
* @param callback - Function to call when click occurs outside
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* const dropdownRef = ref<HTMLElement>()
|
|
276
|
+
* useClickOutside(dropdownRef, () => {
|
|
277
|
+
* // Close dropdown
|
|
278
|
+
* })
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
export declare function useClickOutside(elementRef: Ref<HTMLElement | undefined>, callback: () => void): void;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Composable for managing form validation state
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* const { value, error, validate, reset } = useValidation(
|
|
289
|
+
* '',
|
|
290
|
+
* (val) => val.length > 0 ? null : 'Field is required'
|
|
291
|
+
* )
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
export declare function useValidation<T>(initialValue: T, validator: (value: T) => string | null): {
|
|
295
|
+
value: Ref<T>;
|
|
296
|
+
error: Ref<string | null>;
|
|
297
|
+
isValid: Ref<boolean>;
|
|
298
|
+
validate: () => boolean;
|
|
299
|
+
reset: () => void;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allsrvsonline/vue-component-library",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/vue-component-library.umd.js",
|
|
6
6
|
"module": "./dist/vue-component-library.es.js",
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
"import": "./dist/vue-component-library.es.js",
|
|
12
12
|
"require": "./dist/vue-component-library.umd.js"
|
|
13
13
|
},
|
|
14
|
-
"./style.css":
|
|
14
|
+
"./style.css": {
|
|
15
|
+
"import": "./dist/vue-component-library.css",
|
|
16
|
+
"require": "./dist/vue-component-library.css",
|
|
17
|
+
"default": "./dist/vue-component-library.css"
|
|
18
|
+
},
|
|
19
|
+
"./dist/vue-component-library.css": "./dist/vue-component-library.css"
|
|
15
20
|
},
|
|
16
21
|
"files": [
|
|
17
22
|
"dist"
|