@frontile/forms 0.18.0-alpha.2 → 0.18.0-alpha.20

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.
Files changed (87) hide show
  1. package/declarations/index.d.ts +1 -17
  2. package/declarations/template-registry.d.ts +1 -15
  3. package/declarations/test-support.d.ts +1 -2
  4. package/dist/index.js +13 -15
  5. package/dist/index.js.map +1 -1
  6. package/dist/test-support.js +1 -1336
  7. package/dist/test-support.js.map +1 -1
  8. package/package.json +15 -41
  9. package/declarations/components/checkbox-group.d.ts +0 -42
  10. package/declarations/components/checkbox.d.ts +0 -40
  11. package/declarations/components/field-types.d.ts +0 -14
  12. package/declarations/components/field.d.ts +0 -85
  13. package/declarations/components/form-control.d.ts +0 -47
  14. package/declarations/components/form-description.d.ts +0 -18
  15. package/declarations/components/form-feedback.d.ts +0 -22
  16. package/declarations/components/form.d.ts +0 -254
  17. package/declarations/components/icons.d.ts +0 -7
  18. package/declarations/components/input.d.ts +0 -145
  19. package/declarations/components/label.d.ts +0 -40
  20. package/declarations/components/native-select.d.ts +0 -154
  21. package/declarations/components/radio-group.d.ts +0 -43
  22. package/declarations/components/radio.d.ts +0 -41
  23. package/declarations/components/select.d.ts +0 -531
  24. package/declarations/components/switch.d.ts +0 -152
  25. package/declarations/components/textarea.d.ts +0 -69
  26. package/declarations/utils/index.d.ts +0 -3
  27. package/declarations/utils/nested-data.d.ts +0 -44
  28. package/declarations/utils/standard-validator.d.ts +0 -151
  29. package/dist/_app_/components/checkbox-group.js +0 -1
  30. package/dist/_app_/components/checkbox.js +0 -1
  31. package/dist/_app_/components/field-types.js +0 -1
  32. package/dist/_app_/components/field.js +0 -1
  33. package/dist/_app_/components/form-control.js +0 -1
  34. package/dist/_app_/components/form-description.js +0 -1
  35. package/dist/_app_/components/form-feedback.js +0 -1
  36. package/dist/_app_/components/form.js +0 -1
  37. package/dist/_app_/components/icons.js +0 -1
  38. package/dist/_app_/components/input.js +0 -1
  39. package/dist/_app_/components/label.js +0 -1
  40. package/dist/_app_/components/native-select.js +0 -1
  41. package/dist/_app_/components/radio-group.js +0 -1
  42. package/dist/_app_/components/radio.js +0 -1
  43. package/dist/_app_/components/select.js +0 -1
  44. package/dist/_app_/components/switch.js +0 -1
  45. package/dist/_app_/components/textarea.js +0 -1
  46. package/dist/components/checkbox-group.js +0 -29
  47. package/dist/components/checkbox-group.js.map +0 -1
  48. package/dist/components/checkbox.js +0 -50
  49. package/dist/components/checkbox.js.map +0 -1
  50. package/dist/components/field-types.js +0 -2
  51. package/dist/components/field-types.js.map +0 -1
  52. package/dist/components/field.js +0 -103
  53. package/dist/components/field.js.map +0 -1
  54. package/dist/components/form-control.js +0 -61
  55. package/dist/components/form-control.js.map +0 -1
  56. package/dist/components/form-description.js +0 -24
  57. package/dist/components/form-description.js.map +0 -1
  58. package/dist/components/form-feedback.js +0 -36
  59. package/dist/components/form-feedback.js.map +0 -1
  60. package/dist/components/form.js +0 -13
  61. package/dist/components/form.js.map +0 -1
  62. package/dist/components/icons.js +0 -13
  63. package/dist/components/icons.js.map +0 -1
  64. package/dist/components/input.js +0 -106
  65. package/dist/components/input.js.map +0 -1
  66. package/dist/components/label.js +0 -23
  67. package/dist/components/label.js.map +0 -1
  68. package/dist/components/native-select.js +0 -134
  69. package/dist/components/native-select.js.map +0 -1
  70. package/dist/components/radio-group.js +0 -29
  71. package/dist/components/radio-group.js.map +0 -1
  72. package/dist/components/radio.js +0 -49
  73. package/dist/components/radio.js.map +0 -1
  74. package/dist/components/select.js +0 -386
  75. package/dist/components/select.js.map +0 -1
  76. package/dist/components/switch.js +0 -63
  77. package/dist/components/switch.js.map +0 -1
  78. package/dist/components/textarea.js +0 -53
  79. package/dist/components/textarea.js.map +0 -1
  80. package/dist/form-CVuJDJUq.js +0 -726
  81. package/dist/form-CVuJDJUq.js.map +0 -1
  82. package/dist/index-6gTa9ocT.js +0 -23
  83. package/dist/index-6gTa9ocT.js.map +0 -1
  84. package/dist/index-CeaQc-U7.js +0 -23
  85. package/dist/index-CeaQc-U7.js.map +0 -1
  86. package/dist/runtime-BPCpkOf1-B5Lbloj7.js +0 -67
  87. package/dist/runtime-BPCpkOf1-B5Lbloj7.js.map +0 -1
@@ -1,40 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { type FormControlSharedArgs } from './form-control';
3
- import { type CheckboxVariants, type CheckboxSlots, type SlotsToClasses } from '@frontile/theme';
4
- interface Args extends FormControlSharedArgs {
5
- checked?: boolean;
6
- name?: string;
7
- size?: CheckboxVariants['size'];
8
- classes?: SlotsToClasses<CheckboxSlots>;
9
- onChange?: (value: boolean, event: Event) => void;
10
- onBlur?: () => void;
11
- }
12
- interface CheckboxSignature {
13
- Args: Args;
14
- Element: HTMLInputElement;
15
- }
16
- declare class Checkbox extends Component<CheckboxSignature> {
17
- get isChecked(): boolean;
18
- handleChange(event: Event): void;
19
- handleBlur(): void;
20
- get classes(): {
21
- base: (slotProps?: ({
22
- size?: "sm" | "md" | "lg" | undefined;
23
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
24
- input: (slotProps?: ({
25
- size?: "sm" | "md" | "lg" | undefined;
26
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
27
- labelContainer: (slotProps?: ({
28
- size?: "sm" | "md" | "lg" | undefined;
29
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
30
- label: (slotProps?: ({
31
- size?: "sm" | "md" | "lg" | undefined;
32
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
33
- } & {
34
- input: (slotProps?: ({
35
- size?: "sm" | "md" | "lg" | undefined;
36
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
37
- } & {};
38
- }
39
- export { Checkbox, type CheckboxSignature };
40
- export default Checkbox;
@@ -1,14 +0,0 @@
1
- import type { MaybeNamed } from '@glint/template/-private/signature';
2
- import type { Invokable, NamedArgs, ComponentReturn } from '@glint/template/-private/integration';
3
- export type WithBoundArgsForSignature<Sig extends {
4
- Args: unknown;
5
- Blocks?: unknown;
6
- Element?: unknown;
7
- }, BoundKeys extends keyof Sig['Args']> = Invokable<(...args: [
8
- ...positional: [],
9
- ...named: MaybeNamed<NamedArgs<Omit<Sig['Args'], BoundKeys> & Partial<Pick<Sig['Args'], BoundKeys>>>>
10
- ]) => ComponentReturn<Sig extends {
11
- Blocks: infer B;
12
- } ? B : {}, Sig extends {
13
- Element: infer E;
14
- } ? E : unknown>>;
@@ -1,85 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import Checkbox from './checkbox';
3
- import CheckboxGroup from './checkbox-group';
4
- import Input from './input';
5
- import Radio from './radio';
6
- import RadioGroup from './radio-group';
7
- import Switch from './switch';
8
- import Textarea from './textarea';
9
- import type { WithBoundArgs } from '@glint/template';
10
- import type { FormDataCompiled, FormErrors } from './form';
11
- import type { SelectSignature } from './select';
12
- import type { WithBoundArgsForSignature } from './field-types';
13
- type BoundSingleSelect<S = unknown> = WithBoundArgsForSignature<SelectSignature<S>, 'name' | 'errors' | 'selectedKey' | 'onBlur' | 'isDisabled'>;
14
- type BoundMultiSelect<S = unknown> = WithBoundArgsForSignature<SelectSignature<S>, 'selectionMode' | 'name' | 'errors' | 'selectedKeys' | 'onBlur' | 'isDisabled'>;
15
- interface FieldSignature<T extends Record<string, unknown> = FormDataCompiled> {
16
- Element: HTMLElement;
17
- Args: {
18
- /** The name of the form field. */
19
- name: string;
20
- /** The validation errors for the form, keyed by field name. */
21
- errors?: FormErrors;
22
- /** The form data as key/value pairs. */
23
- formData?: T;
24
- /** Whether the field should be disabled. */
25
- disabled?: boolean;
26
- /** When to run validation. */
27
- validateOn?: ('change' | 'input' | 'blur')[];
28
- /** Function to validate a single field by name. */
29
- validateField?: (data: T, name: string) => Promise<FormErrors | undefined>;
30
- };
31
- Blocks: {
32
- default: [
33
- {
34
- Checkbox: WithBoundArgs<typeof Checkbox, 'name' | 'errors' | 'checked' | 'onChange' | 'onBlur' | 'isDisabled'>;
35
- CheckboxGroup: WithBoundArgs<typeof CheckboxGroup, 'name' | 'errors' | 'isDisabled'>;
36
- Input: WithBoundArgs<typeof Input, 'name' | 'errors' | 'value' | 'onChange' | 'onInput' | 'onBlur' | 'isDisabled'>;
37
- Radio: WithBoundArgs<typeof Radio, 'name' | 'errors' | 'checkedValue' | 'onChange' | 'onBlur' | 'isDisabled'>;
38
- RadioGroup: WithBoundArgs<typeof RadioGroup, 'name' | 'errors' | 'value' | 'onChange' | 'isDisabled'>;
39
- SingleSelect: BoundSingleSelect;
40
- MultiSelect: BoundMultiSelect;
41
- Switch: WithBoundArgs<typeof Switch, 'name' | 'errors' | 'isSelected' | 'onChange' | 'onBlur' | 'isDisabled'>;
42
- Textarea: WithBoundArgs<typeof Textarea, 'name' | 'errors' | 'value' | 'onChange' | 'onInput' | 'onBlur' | 'isDisabled'>;
43
- }
44
- ];
45
- };
46
- }
47
- /**
48
- * Field is a component wrapper that provides conveniences for form fields.
49
- * It automatically binds the appropriate form errors by name to yielded
50
- * components.
51
- */
52
- declare class Field<T extends Record<string, unknown> = FormDataCompiled> extends Component<FieldSignature<T>> {
53
- /**
54
- * Returns the validation errors for the field.
55
- * Supports dotted field names (e.g., 'profile.email').
56
- */
57
- get fieldErrors(): string | string[] | undefined;
58
- /** The events on which validation should run. Defaults to ['change']. */
59
- get validateOn(): ('change' | 'input' | 'blur')[];
60
- /**
61
- * Returns the current value for the field from formData.
62
- * Supports both flat and dotted field names (e.g., 'email' or 'profile.email').
63
- * Uses Ember's get() which handles both flat keys and dotted paths.
64
- */
65
- get fieldValue(): T[string] | undefined;
66
- /**
67
- * Validates the field by calling the validateField function passed in args.
68
- */
69
- validateField(): void;
70
- /**
71
- * Validates the field on change if change validation is enabled.
72
- */
73
- handleChange(): void;
74
- /**
75
- * Validates the field on input if input validation is enabled.
76
- * Debounces validation to avoid excessive validation calls on every keystroke.
77
- */
78
- handleInput(): void;
79
- /**
80
- * Validates the field on blur if blur validation is enabled.
81
- */
82
- handleBlur(): void;
83
- }
84
- export { Field, type FieldSignature };
85
- export default Field;
@@ -1,47 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { type FormFeedbackSignature } from './form-feedback';
3
- import { type FormDescriptionSignature } from './form-description';
4
- import { type LabelSignature } from './label';
5
- import type { ComponentLike, WithBoundArgs } from '@glint/template';
6
- interface FormControlSharedArgs {
7
- label?: string;
8
- isRequired?: boolean;
9
- description?: string;
10
- errors?: string[] | string;
11
- isInvalid?: boolean;
12
- isDisabled?: boolean;
13
- }
14
- interface Args extends FormControlSharedArgs {
15
- id?: string;
16
- size?: 'sm' | 'md' | 'lg';
17
- preventErrorFeedback?: boolean;
18
- class?: string;
19
- }
20
- interface FormControlSignature {
21
- Args: Args;
22
- Blocks: {
23
- default: [
24
- {
25
- id: string;
26
- isInvalid: boolean;
27
- describedBy: (hasDescription?: string | boolean, hasFeedback?: string | boolean) => string | undefined;
28
- Label: WithBoundArgs<ComponentLike<LabelSignature>, 'for' | 'size' | 'isRequired'>;
29
- Description: WithBoundArgs<ComponentLike<FormDescriptionSignature>, 'id' | 'size'>;
30
- Feedback: WithBoundArgs<ComponentLike<FormFeedbackSignature>, 'id' | 'size' | 'messages' | 'intent'>;
31
- }
32
- ];
33
- label: [];
34
- description: [];
35
- };
36
- Element: HTMLDivElement;
37
- }
38
- declare class FormControl extends Component<FormControlSignature> {
39
- id: string;
40
- get descriptionId(): string;
41
- get feedbackId(): string;
42
- describedBy: (hasDescription?: string | boolean, hasFeedback?: string | boolean) => string | undefined;
43
- get isInvalid(): boolean;
44
- get showErrorFeedback(): boolean;
45
- }
46
- export { FormControl, type FormControlSignature, type FormControlSharedArgs };
47
- export default FormControl;
@@ -1,18 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { type FormDescriptionVariants } from '@frontile/theme';
3
- interface FormDescriptionSignature {
4
- Args: {
5
- id?: string;
6
- size?: FormDescriptionVariants['size'];
7
- class?: string;
8
- };
9
- Element: HTMLDivElement;
10
- Blocks: {
11
- default: [];
12
- };
13
- }
14
- declare class FormDescription extends Component<FormDescriptionSignature> {
15
- get classes(): string;
16
- }
17
- export { FormDescription, type FormDescriptionSignature };
18
- export default FormDescription;
@@ -1,22 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { type FormFeedbackVariants } from '@frontile/theme';
3
- interface FormFeedbackSignature {
4
- Args: {
5
- id?: string;
6
- messages?: string[] | string;
7
- intent?: FormFeedbackVariants['intent'];
8
- size?: FormFeedbackVariants['size'];
9
- class?: string;
10
- };
11
- Element: HTMLDivElement;
12
- Blocks: {
13
- default: [];
14
- };
15
- }
16
- declare class FormFeedback extends Component<FormFeedbackSignature> {
17
- get isError(): boolean;
18
- get classes(): string;
19
- get messageText(): string;
20
- }
21
- export { FormFeedback, type FormFeedbackSignature };
22
- export default FormFeedback;
@@ -1,254 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { dataFrom } from 'form-data-utils';
3
- import { Field } from './field';
4
- import type { WithBoundArgs } from '@glint/template';
5
- import type { StandardSchemaV1 } from '@standard-schema/spec';
6
- import type { CustomValidatorFn } from '../utils/standard-validator';
7
- import type Owner from '@ember/owner';
8
- /** The form data as key/value pairs. */
9
- type FormDataCompiled = ReturnType<typeof dataFrom>;
10
- /** The validation errors for the form, keyed by field name. */
11
- type FormErrors = Record<string, string | string[] | undefined>;
12
- /**
13
- * The data passed to `onChange` and `onSubmit` callbacks, which is similar
14
- * to `FormContext` but also includes the form data.
15
- */
16
- type FormResultData<T = FormDataCompiled> = {
17
- /** The form data as key/value pairs. */
18
- data: T;
19
- /** Whether the form is valid (i.e. has no validation errors). */
20
- isValid: boolean;
21
- /** Whether the form is invalid (i.e. has validation errors). */
22
- isInvalid: boolean;
23
- /** The current form validation errors. */
24
- errors: FormErrors;
25
- /**
26
- * The set of fields that have changed from their initial values.
27
- * For flat data structures: contains top-level keys (e.g., "firstName", "email")
28
- * For nested data structures: contains dotted paths (e.g., "user.name.first", "profile.email")
29
- */
30
- dirty: Set<string>;
31
- };
32
- /**
33
- * The context yielded to the default block of the `Form` component.
34
- */
35
- interface FormContext<T = FormDataCompiled> {
36
- /** The form data as key/value pairs. */
37
- data?: T;
38
- /** Whether the form is currently submitting. */
39
- isLoading: boolean;
40
- /** Whether the form is valid (i.e. has no validation errors). */
41
- isValid: boolean;
42
- /** Whether the form is invalid (i.e. has validation errors). */
43
- isInvalid: boolean;
44
- /** The current form validation errors. */
45
- errors: FormErrors;
46
- /**
47
- * The set of fields that have changed from their initial values.
48
- * For flat data structures: contains top-level keys (e.g., "firstName", "email")
49
- * For nested data structures: contains dotted paths (e.g., "user.name.first", "profile.email")
50
- */
51
- dirty: Set<string>;
52
- /**
53
- * Resets the form to its initial state.
54
- * Clears all form fields, validation errors, and dirty tracking.
55
- */
56
- reset: () => void;
57
- /** The `Field` component, with args bound. */
58
- Field: WithBoundArgs<typeof Field, 'errors' | 'formData' | 'disabled' | 'validateOn' | 'validateField'>;
59
- }
60
- interface FormSignature<T = FormDataCompiled> {
61
- Element: HTMLFormElement;
62
- Args: {
63
- /**
64
- * The standard schema to validate form data against.
65
- */
66
- schema?: StandardSchemaV1<T>;
67
- /**
68
- * Optional custom validation function. A custom validator should return
69
- * an array of Standard Schema issues, or `undefined` if there are none.
70
- * This function may be async or sync.
71
- */
72
- validate?: CustomValidatorFn<T>;
73
- /**
74
- * When to run validation.
75
- */
76
- validateOn?: ('change' | 'input' | 'blur' | 'submit')[];
77
- /**
78
- * The initial form data as key/value pairs.
79
- * This is primarily useful for setting default values in the form.
80
- * This object receives changes as the user interacts with the form.
81
- */
82
- data?: T;
83
- /**
84
- * Whether the entire form and all its fields should be disabled. This only
85
- * applies when using the yielded `Field` component.
86
- */
87
- disabled?: boolean;
88
- /**
89
- * Optional callback invoked on input changes within the form.
90
- * @param result - The current form result data.
91
- * @param event - The input event that triggered the change.
92
- * @returns A promise or void.
93
- */
94
- onChange?: (result: FormResultData<T>, event: Event) => Promise<void> | void;
95
- /**
96
- * Callback invoked on form submission. If `onSubmit` returns a promise,
97
- * the form will be marked as `isLoading` until the promise resolves.
98
- * @param result - The current form result data.
99
- * @param event - The submit event that triggered the submission.
100
- * @returns A promise or void.
101
- */
102
- onSubmit: (result: FormResultData<T>, event: SubmitEvent) => Promise<void> | void;
103
- /**
104
- * Optional callback invoked when validation errors occur on form submission.
105
- * @param errors - The validation errors found.
106
- * @param data - The form data that was validated.
107
- * @param event - The submit event that triggered the validation.
108
- * @returns A promise or void.
109
- */
110
- onError?: (errors: FormErrors, data: T, event: SubmitEvent) => Promise<void> | void;
111
- };
112
- Blocks: {
113
- default: [FormContext<T>];
114
- };
115
- }
116
- /**
117
- * A form component that handles form submissions and input changes.
118
- *
119
- * @example
120
- * ```hbs
121
- * <Form
122
- * @data={{this.formData}}
123
- * @schema={{this.schema}}
124
- * @validate={{this.customValidator}}
125
- * @onSubmit={{this.onSubmit}}
126
- * @onChange={{this.onChange}}
127
- * as |form|
128
- * >
129
- * <form.Field name="firstName" as |field|>
130
- * <field.Input />
131
- * </form.Field>
132
- * <form.Field name="lastName" as |field|>
133
- * <field.Input />
134
- * </form.Field>
135
- * <button type="submit" disabled={{form.isLoading}}>
136
- * {{#if form.isLoading}}Submitting...{{else}}Submit{{/if}}
137
- * </button>
138
- * </Form>
139
- * ```
140
- */
141
- declare class Form<T = FormDataCompiled> extends Component<FormSignature<T>> {
142
- /** Whether the form is currently submitting. */
143
- isLoading: boolean;
144
- /** The current form validation errors. */
145
- errors: FormErrors;
146
- /** The current uncontrolled form data. */
147
- uncontrolledData?: T;
148
- /**
149
- * Flattened snapshot of initial data for dirty field comparison.
150
- * Stored in flattened form regardless of whether source data is nested or flat.
151
- */
152
- initialDataSnapshot?: Record<string, unknown>;
153
- /**
154
- * The set of fields that have changed from their initial values.
155
- * For flat data structures: contains top-level keys (e.g., "firstName", "email")
156
- * For nested data structures: contains dotted paths (e.g., "user.name.first", "profile.email")
157
- */
158
- dirty: Set<string>;
159
- /** Reference to the form element. */
160
- element: {
161
- "__#1@#private": any;
162
- current: HTMLFormElement | undefined;
163
- setup: import("ember-modifier").FunctionBasedModifier<{
164
- Args: {
165
- Positional: unknown[];
166
- Named: import("ember-modifier/-private/signature").EmptyObject;
167
- };
168
- Element: HTMLFormElement;
169
- }>;
170
- };
171
- /**
172
- * Creates a new instance of the Form component.
173
- * Initializes internal state based on provided args.
174
- * @param owner - The owner of the component.
175
- * @param args - The arguments passed to the component.
176
- */
177
- constructor(owner: Owner, args: FormSignature<T>['Args']);
178
- /** Whether the form is valid (i.e. has no validation errors). */
179
- get isValid(): boolean;
180
- /** Whether the form is invalid (i.e. has validation errors). */
181
- get isInvalid(): boolean;
182
- /** Whether the form is controlled (`onChange` is provided). */
183
- get isControlled(): boolean;
184
- /** The events on which validation should run. */
185
- get validateOn(): ('change' | 'input' | 'blur' | 'submit')[];
186
- /** The events on which field-level validation should run. */
187
- get fieldValidateOn(): ('change' | 'input' | 'blur')[];
188
- /** The current form data, from args if controlled, or internal state if uncontrolled. */
189
- get currentData(): T | undefined;
190
- /**
191
- * Validates data against the provided schema using StandardValidator.
192
- * Updates the `errors` property with any validation errors found.
193
- *
194
- * @param data - The form data to validate.
195
- * @returns A promise that resolves to the validation errors, if any.
196
- */
197
- validate(data: T): Promise<FormErrors | undefined>;
198
- /**
199
- * Validates a single field against the provided schema using
200
- * StandardValidator. Updates the `errors` property with any validation
201
- * errors found for the field. If the field had previous errors but
202
- * is now valid, those errors are cleared.
203
- *
204
- * @param data - The form data to validate against.
205
- * @param name - The name of the field to validate.
206
- * @returns A promise that resolves to errors for the field, if any.
207
- */
208
- validateField(data: T, name: string): Promise<FormErrors | undefined>;
209
- /**
210
- * Computes which fields have changed from their initial values.
211
- * Uses deep comparison for consistency across flat and nested structures.
212
- * This is a pure function with no side effects.
213
- *
214
- * @param data - The current form data.
215
- * @returns A set of field names that have changed.
216
- */
217
- computeDirtyFields(data: T): Set<string>;
218
- /**
219
- * Builds the form result data object to pass to callbacks.
220
- * Also updates the dirty state as a side effect.
221
- *
222
- * @param data - The current form data.
223
- * @returns The form result data object.
224
- */
225
- buildFormResultData(data: T): FormResultData<T>;
226
- /**
227
- * Handles the `input` event on the form element.
228
- * Calls the `onChange` callback with the current form data if provided.
229
- * Automatically unflattens dotted field names to nested structure.
230
- */
231
- handleInput(event: Event): void;
232
- /**
233
- * Handles the `submit` event on the form element.
234
- * Prevents the default form submission and calls the `onSubmit` callback
235
- * with the current form data. Manages the `isLoading` state during the
236
- * submission process. Automatically unflattens dotted field names to nested structure.
237
- */
238
- handleSubmit(event: SubmitEvent): Promise<void>;
239
- /**
240
- * Handles the `reset` event on the form element.
241
- * Clears validation errors and dirty tracking.
242
- * Restores the form data to its initial state.
243
- * Calls `onChange` if the form is controlled to let parent update state.
244
- */
245
- handleReset(event: Event): void;
246
- /**
247
- * Resets the form to its initial state.
248
- * This method calls the native form reset() to clear all form controls,
249
- * triggering a `reset` event that is handled in `handleReset`.
250
- */
251
- reset(): void;
252
- }
253
- export { Form, type FormContext, type FormSignature, type FormDataCompiled, type FormResultData, type FormErrors };
254
- export default Form;
@@ -1,7 +0,0 @@
1
- import type { TOC } from '@ember/component/template-only';
2
- declare const IconChevronUpDown: TOC<{
3
- Element: SVGElement;
4
- }>;
5
- export { IconChevronUpDown };
6
- declare const _default: import("@ember/component/template-only").TemplateOnlyComponent<never> & (abstract new () => import("@glint/template/-private/integration").InvokableInstance<() => import("@glint/template/-private/integration").ComponentReturn<{}>> & import("@glint/template/-private/integration").HasContext<import("@glint/template/-private/integration").TemplateContext<void, {}, {}, void>>);
7
- export default _default;
@@ -1,145 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { type InputSlots, type InputVariants, type SlotsToClasses } from '@frontile/theme';
3
- import { type FormControlSharedArgs } from './form-control';
4
- interface Args extends FormControlSharedArgs {
5
- type?: string;
6
- value?: string;
7
- name?: string;
8
- size?: InputVariants['size'];
9
- classes?: SlotsToClasses<InputSlots>;
10
- /**
11
- * Whether to include a clear button
12
- */
13
- isClearable?: boolean;
14
- /**
15
- * Controls pointer-events property of startContent.
16
- * If you want to pass the click event to the input, set it to `none`.
17
- *
18
- * @defaultValue 'auto'
19
- */
20
- startContentPointerEvents?: 'none' | 'auto';
21
- /**
22
- * Controls pointer-events property of endContent.
23
- * If you want to pass the click event to the input, set it to `none`.
24
- *
25
- * @defaultValue 'auto'
26
- */
27
- endContentPointerEvents?: 'none' | 'auto';
28
- /**
29
- * Callback when oninput is triggered
30
- */
31
- onInput?: (value: string, event?: InputEvent) => void;
32
- /**
33
- * Callback when onchange is triggered
34
- */
35
- onChange?: (value: string, event?: InputEvent) => void;
36
- /**
37
- * Callback when onblur is triggered
38
- */
39
- onBlur?: () => void;
40
- }
41
- interface InputSignature {
42
- Args: Args;
43
- Blocks: {
44
- startContent: [];
45
- endContent: [];
46
- };
47
- Element: HTMLInputElement;
48
- }
49
- declare class Input extends Component<InputSignature> {
50
- uncontrolledValue: string;
51
- inputRef: {
52
- "__#1@#private": any;
53
- current: HTMLInputElement | undefined;
54
- setup: import("ember-modifier").FunctionBasedModifier<{
55
- Args: {
56
- Positional: unknown[];
57
- Named: import("ember-modifier/-private/signature").EmptyObject;
58
- };
59
- Element: HTMLInputElement;
60
- }>;
61
- };
62
- get isControlled(): boolean;
63
- get value(): string | undefined;
64
- get type(): string;
65
- handleOnInput(event: Event): void;
66
- handleOnChange(event: Event): void;
67
- handleOnBlur(): void;
68
- clearValue(): void;
69
- get isClearable(): boolean;
70
- get classes(): {
71
- base: (slotProps?: ({
72
- size?: "sm" | "md" | "lg" | undefined;
73
- startContentPointerEvents?: "none" | "auto" | undefined;
74
- endContentPointerEvents?: "none" | "auto" | undefined;
75
- hasStartContent?: boolean | undefined;
76
- hasEndContent?: boolean | undefined;
77
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
78
- innerContainer: (slotProps?: ({
79
- size?: "sm" | "md" | "lg" | undefined;
80
- startContentPointerEvents?: "none" | "auto" | undefined;
81
- endContentPointerEvents?: "none" | "auto" | undefined;
82
- hasStartContent?: boolean | undefined;
83
- hasEndContent?: boolean | undefined;
84
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
85
- startContent: (slotProps?: ({
86
- size?: "sm" | "md" | "lg" | undefined;
87
- startContentPointerEvents?: "none" | "auto" | undefined;
88
- endContentPointerEvents?: "none" | "auto" | undefined;
89
- hasStartContent?: boolean | undefined;
90
- hasEndContent?: boolean | undefined;
91
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
92
- endContent: (slotProps?: ({
93
- size?: "sm" | "md" | "lg" | undefined;
94
- startContentPointerEvents?: "none" | "auto" | undefined;
95
- endContentPointerEvents?: "none" | "auto" | undefined;
96
- hasStartContent?: boolean | undefined;
97
- hasEndContent?: boolean | undefined;
98
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
99
- input: (slotProps?: ({
100
- size?: "sm" | "md" | "lg" | undefined;
101
- startContentPointerEvents?: "none" | "auto" | undefined;
102
- endContentPointerEvents?: "none" | "auto" | undefined;
103
- hasStartContent?: boolean | undefined;
104
- hasEndContent?: boolean | undefined;
105
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
106
- } & {
107
- base: (slotProps?: ({
108
- size?: "sm" | "md" | "lg" | undefined;
109
- startContentPointerEvents?: "none" | "auto" | undefined;
110
- endContentPointerEvents?: "none" | "auto" | undefined;
111
- hasStartContent?: boolean | undefined;
112
- hasEndContent?: boolean | undefined;
113
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
114
- innerContainer: (slotProps?: ({
115
- size?: "sm" | "md" | "lg" | undefined;
116
- startContentPointerEvents?: "none" | "auto" | undefined;
117
- endContentPointerEvents?: "none" | "auto" | undefined;
118
- hasStartContent?: boolean | undefined;
119
- hasEndContent?: boolean | undefined;
120
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
121
- startContent: (slotProps?: ({
122
- size?: "sm" | "md" | "lg" | undefined;
123
- startContentPointerEvents?: "none" | "auto" | undefined;
124
- endContentPointerEvents?: "none" | "auto" | undefined;
125
- hasStartContent?: boolean | undefined;
126
- hasEndContent?: boolean | undefined;
127
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
128
- endContent: (slotProps?: ({
129
- size?: "sm" | "md" | "lg" | undefined;
130
- startContentPointerEvents?: "none" | "auto" | undefined;
131
- endContentPointerEvents?: "none" | "auto" | undefined;
132
- hasStartContent?: boolean | undefined;
133
- hasEndContent?: boolean | undefined;
134
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
135
- input: (slotProps?: ({
136
- size?: "sm" | "md" | "lg" | undefined;
137
- startContentPointerEvents?: "none" | "auto" | undefined;
138
- endContentPointerEvents?: "none" | "auto" | undefined;
139
- hasStartContent?: boolean | undefined;
140
- hasEndContent?: boolean | undefined;
141
- } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
142
- } & {};
143
- }
144
- export { Input, type InputSignature };
145
- export default Input;