@illinois-grad/grad-vue 2.2.0 → 2.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.
@@ -11,14 +11,12 @@ type Props = {
11
11
  * Disabled
12
12
  */
13
13
  disabled?: boolean;
14
- /**
15
- * Error message
16
- */
17
- error?: string;
14
+ errors?: string[];
18
15
  /**
19
16
  * Instructions
20
17
  */
21
18
  instructions?: string;
19
+ name?: string;
22
20
  };
23
21
  type __VLS_Props = Props;
24
22
  type __VLS_ModelProps = {
@@ -30,10 +28,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
28
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
29
  "onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
32
30
  }>, {
31
+ name: string;
32
+ errors: string[];
33
33
  label: string;
34
34
  placeholder: string;
35
35
  disabled: boolean;
36
- error: string;
37
36
  instructions: string;
38
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
38
  declare const _default: typeof __VLS_export;
@@ -11,14 +11,12 @@ type Props = {
11
11
  * Disabled
12
12
  */
13
13
  disabled?: boolean;
14
- /**
15
- * Error message
16
- */
17
- error?: string;
14
+ errors?: string[];
18
15
  /**
19
16
  * Instructions
20
17
  */
21
18
  instructions?: string;
19
+ name?: string;
22
20
  };
23
21
  type __VLS_Props = Props;
24
22
  type __VLS_ModelProps = {
@@ -30,10 +28,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
28
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
29
  "onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
32
30
  }>, {
31
+ name: string;
32
+ errors: string[];
33
33
  label: string;
34
34
  placeholder: string;
35
35
  disabled: boolean;
36
- error: string;
37
36
  instructions: string;
38
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
38
  declare const _default: typeof __VLS_export;
@@ -15,14 +15,12 @@ type Props = {
15
15
  * Disabled
16
16
  */
17
17
  disabled?: boolean;
18
- /**
19
- * Error message
20
- */
21
- error?: string;
18
+ errors?: string[];
22
19
  /**
23
20
  * Instructions
24
21
  */
25
22
  instructions?: string;
23
+ name?: string;
26
24
  };
27
25
  type __VLS_Props = Props;
28
26
  type DateRange = {
@@ -38,9 +36,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
38
36
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
39
37
  "onUpdate:modelValue"?: ((value: DateRange) => any) | undefined;
40
38
  }>, {
39
+ name: string;
40
+ errors: string[];
41
41
  label: string;
42
42
  disabled: boolean;
43
- error: string;
44
43
  instructions: string;
45
44
  startLabel: string;
46
45
  endLabel: string;
@@ -11,14 +11,12 @@ type Props = {
11
11
  * Disabled
12
12
  */
13
13
  disabled?: boolean;
14
- /**
15
- * Error message
16
- */
17
- error?: string;
14
+ errors?: string[];
18
15
  /**
19
16
  * Instructions
20
17
  */
21
18
  instructions?: string;
19
+ name?: string;
22
20
  };
23
21
  type __VLS_Props = Props;
24
22
  type __VLS_ModelProps = {
@@ -30,10 +28,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
28
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
29
  "onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
32
30
  }>, {
31
+ name: string;
32
+ errors: string[];
33
33
  label: string;
34
34
  placeholder: string;
35
35
  disabled: boolean;
36
- error: string;
37
36
  instructions: string;
38
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
38
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,42 @@
1
+ interface Props {
2
+ /**
3
+ * Action URL (optional, for native form submission)
4
+ */
5
+ action?: string;
6
+ /**
7
+ * HTTP method (optional, for native form submission)
8
+ */
9
+ method?: string;
10
+ }
11
+ type __VLS_Props = Props;
12
+ type __VLS_ModelProps = {
13
+ modelValue?: Record<string, any>;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_1: {
17
+ isSubmitting: boolean;
18
+ hasErrors: boolean;
19
+ values: Record<string, any>;
20
+ errors: Record<string, string[]>;
21
+ };
22
+ type __VLS_Slots = {} & {
23
+ default?: (props: typeof __VLS_1) => any;
24
+ };
25
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
+ "update:modelValue": (value: Record<string, any>) => any;
27
+ submit: (values: Record<string, any>) => any;
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
29
+ "onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
30
+ onSubmit?: ((values: Record<string, any>) => any) | undefined;
31
+ }>, {
32
+ action: string;
33
+ method: string;
34
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
38
+ type __VLS_WithSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };
@@ -28,8 +28,8 @@ declare const __VLS_export: <T extends {
28
28
  } & {
29
29
  modelValue?: string | null;
30
30
  }) & {
31
- "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
32
31
  onSelect?: ((...args: any[]) => any) | undefined;
32
+ "onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
33
33
  onSubmit?: ((...args: any[]) => any) | undefined;
34
34
  }> & (typeof globalThis extends {
35
35
  __VLS_PROPS_FALLBACK: infer P;
@@ -22,9 +22,6 @@ interface Props {
22
22
  * Disabled
23
23
  */
24
24
  disabled?: boolean;
25
- /**
26
- * Name
27
- */
28
25
  name?: string;
29
26
  /**
30
27
  * Searchable
@@ -38,6 +35,7 @@ interface Props {
38
35
  * Compact
39
36
  */
40
37
  compact?: boolean;
38
+ errors?: string[];
41
39
  }
42
40
  type __VLS_Props = Props;
43
41
  type __VLS_ModelProps = {
@@ -59,8 +57,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
59
57
  onChange?: ((...args: any[]) => any) | undefined;
60
58
  "onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
61
59
  }>, {
62
- disabled: boolean;
63
60
  name: string;
61
+ errors: string[];
62
+ disabled: boolean;
64
63
  searchable: boolean;
65
64
  compact: boolean;
66
65
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -12,14 +12,12 @@ interface Props {
12
12
  * Size
13
13
  */
14
14
  size?: "small" | "medium" | "large";
15
- /**
16
- * Name
17
- */
18
15
  name?: string;
19
16
  /**
20
17
  * Disabled
21
18
  */
22
19
  disabled?: boolean;
20
+ errors?: string[];
23
21
  }
24
22
  type __VLS_Props = Props;
25
23
  type __VLS_ModelProps = {
@@ -34,8 +32,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
34
32
  "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
35
33
  }>, {
36
34
  size: "small" | "medium" | "large";
37
- disabled: boolean;
38
35
  name: string;
36
+ errors: string[];
37
+ disabled: boolean;
39
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
39
  declare const _default: typeof __VLS_export;
41
40
  export default _default;
@@ -0,0 +1,31 @@
1
+ interface Props {
2
+ /**
3
+ * Disabled state
4
+ */
5
+ disabled?: boolean;
6
+ /**
7
+ * Loading text to show during submission
8
+ */
9
+ loadingText?: string;
10
+ /**
11
+ * Variant
12
+ */
13
+ variant?: "primary" | "secondary" | "danger";
14
+ }
15
+ declare var __VLS_8: {};
16
+ type __VLS_Slots = {} & {
17
+ default?: (props: typeof __VLS_8) => any;
18
+ };
19
+ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
20
+ disabled: boolean;
21
+ variant: "primary" | "secondary" | "danger";
22
+ loadingText: string;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -11,10 +11,7 @@ type Props = {
11
11
  * Disabled
12
12
  */
13
13
  disabled?: boolean;
14
- /**
15
- * Error message
16
- */
17
- error?: string;
14
+ errors?: string[];
18
15
  /**
19
16
  * Instructions
20
17
  */
@@ -31,6 +28,7 @@ type Props = {
31
28
  * Debounce in milliseconds
32
29
  */
33
30
  debounce?: number;
31
+ name?: string;
34
32
  };
35
33
  type __VLS_Props = Props;
36
34
  type __VLS_ModelProps = {
@@ -54,10 +52,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
54
52
  }) => any) | undefined;
55
53
  "onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
56
54
  }>, {
55
+ name: string;
56
+ errors: string[];
57
57
  label: string;
58
58
  placeholder: string;
59
59
  disabled: boolean;
60
- error: string;
61
60
  instructions: string;
62
61
  prefix: string;
63
62
  suffix: string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Internal component for displaying form field error messages.
3
+ * This component is used by form input components to display validation errors
4
+ * in a consistent way across all form fields.
5
+ */
6
+ interface Props {
7
+ /**
8
+ * Array of error messages to display
9
+ */
10
+ errors: string[];
11
+ /**
12
+ * ID for the error container (used for aria-describedby)
13
+ */
14
+ id: string;
15
+ }
16
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { Ref, ComputedRef } from "vue";
2
+ export interface FormField {
3
+ name: string;
4
+ value: Ref<any>;
5
+ errors: Ref<string[]> | ComputedRef<string[]>;
6
+ }
7
+ export interface UseFormReturn {
8
+ fields: Record<string, FormField>;
9
+ values: Ref<Record<string, any>>;
10
+ errors: Ref<Record<string, string[]>>;
11
+ isSubmitting: Ref<boolean>;
12
+ hasErrors: Ref<boolean>;
13
+ registerField: (name: string, field: FormField) => void;
14
+ unregisterField: (name: string) => void;
15
+ submit: (handler: (values: Record<string, any>) => Promise<void> | void) => Promise<void>;
16
+ }
17
+ /**
18
+ * Composable to manage form state and link form inputs together.
19
+ * Uses reactive state pattern - errors are provided as reactive props to input components.
20
+ */
21
+ export declare function useForm(): UseFormReturn;
@@ -0,0 +1,29 @@
1
+ import { Ref, ComputedRef } from "vue";
2
+ export interface UseFormFieldOptions {
3
+ /**
4
+ * The name of the field (required for form registration)
5
+ */
6
+ name?: string;
7
+ /**
8
+ * The model value ref to register with the form
9
+ */
10
+ value: Ref<any>;
11
+ /**
12
+ * Error messages from props (optional) - should be a reactive reference
13
+ */
14
+ errors?: Ref<string[]> | ComputedRef<string[]>;
15
+ }
16
+ export interface UseFormFieldReturn {
17
+ /**
18
+ * Combined filtered errors array
19
+ */
20
+ displayErrors: Ref<string[]>;
21
+ /**
22
+ * Whether the field has any errors
23
+ */
24
+ hasErrors: Ref<boolean>;
25
+ }
26
+ /**
27
+ * Composable to handle form field registration and error management.
28
+ */
29
+ export declare function useFormField(options: UseFormFieldOptions): UseFormFieldReturn;