Skip to content

Commit d422008

Browse files
Update and add types
1 parent 6f7f9d8 commit d422008

File tree

1 file changed

+97
-19
lines changed

1 file changed

+97
-19
lines changed

src/types/index.ts

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
/* eslint-disable no-unused-vars */
22
import type {
33
CSSProperties,
4+
JSXComponent,
5+
MaybeRef,
46
Ref,
57
} from 'vue';
68
import type {
79
VBtn,
810
VCheckbox,
11+
VIcon,
912
VSelect,
1013
VSwitch,
1114
VTextField,
@@ -23,25 +26,46 @@ export type TimeOpened = Date | null;
2326
export type GlobalDensity = VCheckbox['$props']['density'] | VSelect['$props']['density'] | VSwitch['$props']['density'] | VTextField['$props']['density'] | VTextarea['$props']['density'];
2427
export type GlobalVariant = VSelect['$props']['variant'] | VTextField['$props']['variant'] | VTextarea['$props']['variant'];
2528

29+
export type VIconColor = VIcon['$props']['color'];
30+
export type VIconSize = VIcon['$props']['size'];
31+
export type VIconValue = string | (string | [path: string, opacity: number])[] | JSXComponent;
32+
33+
export type VBtnColor = VBtn['$props']['color'];
34+
export type VBtnSize = VBtn['$props']['size'];
35+
export type VBtnVariant = VBtn['$props']['variant'];
36+
2637

2738
// -------------------------------------------------- Colors //
2839
export type HEXColor = string;
2940
export type HSLColor = [number, number, number, number | string];
3041
export type RGBColor = [number, number, number, number | string];
3142

3243

44+
3345
// -------------------------------------------------- Props //
3446
export interface SharedProps {
3547
alignItems?: AlignItems;
3648
autofocus?: boolean;
37-
cancelButtonColor?: VBtn['$props']['color'];
38-
cancelButtonSize?: VBtn['$props']['size'];
49+
cancelButtonColor?: VBtnColor;
50+
cancelButtonSize?: VBtnSize;
3951
cancelButtonTitle?: string | undefined;
40-
cancelButtonVariant?: VBtn['$props']['variant'];
52+
cancelButtonVariant?: VBtnVariant;
4153
cancelIcon?: string | undefined;
4254
cancelIconColor?: string;
4355
closeSiblings?: boolean;
4456
color?: string;
57+
displayAppendIcon?: VIconValue;
58+
displayAppendIconColor?: VIconColor;
59+
displayAppendIconSize?: VIconSize;
60+
displayAppendInnerIcon?: VIconValue;
61+
displayAppendInnerIconColor?: VIconColor;
62+
displayAppendInnerIconSize?: VIconSize;
63+
displayPrependIcon?: VIconValue;
64+
displayPrependIconColor?: VIconColor;
65+
displayPrependIconSize?: VIconSize;
66+
displayPrependInnerIcon?: VIconValue;
67+
displayPrependInnerIconColor?: VIconColor;
68+
displayPrependInnerIconSize?: VIconSize;
4569
disabled?: boolean;
4670
emptyText?: string;
4771
error?: boolean;
@@ -64,10 +88,10 @@ export interface SharedProps {
6488
loadingWait?: boolean;
6589
name?: string;
6690
required?: boolean;
67-
saveButtonColor?: VBtn['$props']['color'];
68-
saveButtonSize?: VBtn['$props']['size'];
91+
saveButtonColor?: VBtnColor;
92+
saveButtonSize?: VBtnSize;
6993
saveButtonTitle?: string | undefined;
70-
saveButtonVariant?: VBtn['$props']['variant'];
94+
saveButtonVariant?: VBtnVariant;
7195
saveIcon?: string | undefined;
7296
saveIconColor?: string;
7397
tableField?: boolean;
@@ -141,6 +165,28 @@ export interface BooleanIcons extends
141165
'iconTrue'
142166
> { };
143167

168+
169+
export interface DisplayValueProps {
170+
[key: string]: any;
171+
color: SharedProps['color'];
172+
displayAppendIcon: SharedProps['displayAppendIcon'];
173+
displayAppendIconColor: SharedProps['displayAppendIconColor'];
174+
displayAppendInnerIcon: SharedProps['displayAppendInnerIcon'];
175+
displayAppendInnerIconColor: SharedProps['displayAppendInnerIconColor'];
176+
displayPrependIcon: SharedProps['displayPrependIcon'];
177+
displayPrependIconColor: SharedProps['displayPrependIconColor'];
178+
displayPrependInnerIcon: SharedProps['displayPrependInnerIcon'];
179+
displayPrependInnerIconColor: SharedProps['displayPrependInnerIconColor'];
180+
displayValue: any;
181+
empty?: MaybeRef<boolean> | boolean | undefined;
182+
error?: MaybeRef<boolean> | boolean | undefined;
183+
field: string;
184+
underlineColor?: SharedProps['underlineColor'];
185+
underlineStyle?: SharedProps['underlineStyle'];
186+
underlineWidth?: SharedProps['underlineWidth'];
187+
underlined?: SharedProps['underlined'];
188+
}
189+
144190
export interface SaveFieldButtons extends
145191
Required<Pick<SharedProps,
146192
'cancelButtonColor' |
@@ -188,6 +234,7 @@ export interface UseInlineFieldsContainerClass {
188234
loading?: Ref<boolean> | boolean;
189235
loadingWait?: Ref<SharedProps['loadingWait']> | SharedProps['loadingWait'];
190236
tableField?: SharedProps['tableField'];
237+
variant?: GlobalVariant;
191238
},
192239
): object;
193240
}
@@ -230,6 +277,38 @@ export interface UseDisplayValueClass {
230277
): object;
231278
}
232279

280+
export interface UseDisplayValueStyles {
281+
(
282+
options: {
283+
color: SharedProps['color'];
284+
error: MaybeRef<boolean> | boolean | undefined;
285+
theme: ThemeInstance;
286+
underlineColor: SharedProps['underlineColor'];
287+
underlineStyle: SharedProps['underlineStyle'];
288+
underlineWidth: SharedProps['underlineWidth'];
289+
underlined: SharedProps['underlined'];
290+
}
291+
): CSSProperties;
292+
}
293+
294+
// ------------------------ Display Value Container Prepend/Append Icons //
295+
export interface UsePrependAppendIconClasses {
296+
(
297+
options: {
298+
inner?: Ref<boolean> | boolean;
299+
position?: Ref<string> | string;
300+
},
301+
): object;
302+
}
303+
304+
export interface UsePrependAppendIconStyles {
305+
(
306+
options: {
307+
underlineWidth: SharedProps['underlineWidth'];
308+
}
309+
): CSSProperties;
310+
}
311+
233312
// ------------------------ Field Container //
234313
export interface UseFieldContainerClass {
235314
(
@@ -266,19 +345,7 @@ export interface UseCheckForErrors {
266345
};
267346
}
268347

269-
export interface UseDisplayValueStyles {
270-
(
271-
options: {
272-
color: SharedProps['color'];
273-
error: Ref<boolean> | boolean;
274-
theme: ThemeInstance;
275-
underlineColor: SharedProps['underlineColor'];
276-
underlineStyle: SharedProps['underlineStyle'];
277-
underlineWidth: SharedProps['underlineWidth'];
278-
underlined: SharedProps['underlined'];
279-
}
280-
): CSSProperties;
281-
}
348+
282349

283350
export interface UseToggleField {
284351
(
@@ -312,3 +379,14 @@ export interface UseTruncateText {
312379

313380
// -------------------------------------------------- Close Siblings Event Bus //
314381
export const CloseSiblingsBus: EventBusKey<TimeOpened> = Symbol('identifier');
382+
383+
384+
// ------------------------- Helpers //
385+
export interface UseConvertToUnit {
386+
(
387+
options: {
388+
str: string | number,
389+
unit?: string,
390+
}
391+
): string | void;
392+
}

0 commit comments

Comments
 (0)