@timeax/form-palette 0.1.2 → 0.1.3

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.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader } from './variant-BGkGWsSy.mjs';
2
- export { B as BaseProps, r as ButtonRef, y as EffectiveFieldLayout, x as FieldLayoutConfig, w as FieldOrdering, v as FieldRootId, t as FieldRoots, u as FieldSlotId, s as FieldSlots, o as FormProps, m as InferFromSchema, I as InputNumber, q as InputStore, z as LayoutResolveContext, A as LayoutResolver, R as RelativeRootsMap, n as SubmitEvent, T as Textarea, p as ValuesResult, G as VariantEntry, M as VariantLayoutDefaults, N as VariantModuleFor, K as VariantValidateFn, J as Variants } from './variant-BGkGWsSy.mjs';
1
+ import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader, m as FileItem } from './core-BD0ObjuE.mjs';
2
+ export { B as BaseProps, s as ButtonRef, z as EffectiveFieldLayout, y as FieldLayoutConfig, x as FieldOrdering, w as FieldRootId, u as FieldRoots, v as FieldSlotId, t as FieldSlots, p as FormProps, n as InferFromSchema, I as InputNumber, r as InputStore, A as LayoutResolveContext, G as LayoutResolver, R as RelativeRootsMap, o as SubmitEvent, T as Textarea, q as ValuesResult, J as VariantEntry, N as VariantLayoutDefaults, O as VariantModuleFor, M as VariantValidateFn, K as Variants } from './core-BD0ObjuE.mjs';
3
3
  import { A as AdapterKey } from './adapter-CvjXO9Gi.mjs';
4
4
  export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.mjs';
5
5
  export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.mjs';
@@ -204,6 +204,7 @@ interface UseFieldOptions<T = unknown> {
204
204
  * error bags (unless mapped via `shared` or `alias`).
205
205
  */
206
206
  name?: string;
207
+ variant: VariantKey;
207
208
  /**
208
209
  * Optional internal binding identifier.
209
210
  *
@@ -283,6 +284,7 @@ interface UseFieldOptions<T = unknown> {
283
284
  * This is in addition to the form-level `onChange`.
284
285
  */
285
286
  onValueChange?(next: T, prev: T, variant: string): void;
287
+ onSubmit?(e: any): any;
286
288
  }
287
289
  interface UseFieldReturn<T = unknown> {
288
290
  /** Ref to the underlying DOM element */
@@ -412,6 +414,14 @@ interface InputFieldBaseProps<TValue = unknown> {
412
414
  tags?: FieldTag[];
413
415
  contain?: boolean;
414
416
  autoOff?: boolean;
417
+ /**
418
+ * Handles the submission logic for a given form or process.
419
+ *
420
+ * @param {TValue} e - The value associated with the submission action.
421
+ * @return {any} Value to be submitted.
422
+ */
423
+ onSubmit?(e: TValue): any;
424
+ onReset?(e: React.FormEvent<HTMLFormElement>): void;
415
425
  label?: React.ReactNode;
416
426
  sublabel?: React.ReactNode;
417
427
  description?: React.ReactNode;
@@ -470,7 +480,7 @@ interface InputFieldBaseProps<TValue = unknown> {
470
480
  * NOTE: this is a type alias (not an interface) so we can safely intersect
471
481
  * unions coming from VariantPropsFor<K> / VariantValueFor<K>.
472
482
  */
473
- type InputFieldProps<K extends VariantKey = VariantKey, H = unknown> = InputFieldBaseProps<VariantValueFor<K, H>> & VariantPropsFor<K, H> & InputFieldClassNameProps & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | 'defaultValue'> & {
483
+ type InputFieldProps<K extends VariantKey = VariantKey, H = unknown> = InputFieldBaseProps<VariantValueFor<K, H>> & VariantPropsFor<K, H> & InputFieldClassNameProps & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> & {
474
484
  variant: K;
475
485
  /**
476
486
  * @deprecated Use the specific *ClassName props instead
@@ -681,6 +691,7 @@ interface PaletteRegistry {
681
691
  ruleDefinition: PasswordDefinitionMap;
682
692
  customLoader: CustomFileLoader;
683
693
  getCountries: () => Promise<PhoneCountry[]>;
694
+ formatFileValue: (file: FileItem) => string | undefined;
684
695
  }
685
696
  declare global {
686
697
  interface Window {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader } from './variant-B_L0opEi.js';
2
- export { B as BaseProps, r as ButtonRef, y as EffectiveFieldLayout, x as FieldLayoutConfig, w as FieldOrdering, v as FieldRootId, t as FieldRoots, u as FieldSlotId, s as FieldSlots, o as FormProps, m as InferFromSchema, I as InputNumber, q as InputStore, z as LayoutResolveContext, A as LayoutResolver, R as RelativeRootsMap, n as SubmitEvent, T as Textarea, p as ValuesResult, G as VariantEntry, M as VariantLayoutDefaults, N as VariantModuleFor, K as VariantValidateFn, J as Variants } from './variant-B_L0opEi.js';
1
+ import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule, P as PhoneCountry, k as PasswordDefinitionMap, l as CustomFileLoader, m as FileItem } from './core-q_p0E4W9.js';
2
+ export { B as BaseProps, s as ButtonRef, z as EffectiveFieldLayout, y as FieldLayoutConfig, x as FieldOrdering, w as FieldRootId, u as FieldRoots, v as FieldSlotId, t as FieldSlots, p as FormProps, n as InferFromSchema, I as InputNumber, r as InputStore, A as LayoutResolveContext, G as LayoutResolver, R as RelativeRootsMap, o as SubmitEvent, T as Textarea, q as ValuesResult, J as VariantEntry, N as VariantLayoutDefaults, O as VariantModuleFor, M as VariantValidateFn, K as Variants } from './core-q_p0E4W9.js';
3
3
  import { A as AdapterKey } from './adapter-CvjXO9Gi.js';
4
4
  export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.js';
5
5
  export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.js';
@@ -204,6 +204,7 @@ interface UseFieldOptions<T = unknown> {
204
204
  * error bags (unless mapped via `shared` or `alias`).
205
205
  */
206
206
  name?: string;
207
+ variant: VariantKey;
207
208
  /**
208
209
  * Optional internal binding identifier.
209
210
  *
@@ -283,6 +284,7 @@ interface UseFieldOptions<T = unknown> {
283
284
  * This is in addition to the form-level `onChange`.
284
285
  */
285
286
  onValueChange?(next: T, prev: T, variant: string): void;
287
+ onSubmit?(e: any): any;
286
288
  }
287
289
  interface UseFieldReturn<T = unknown> {
288
290
  /** Ref to the underlying DOM element */
@@ -412,6 +414,14 @@ interface InputFieldBaseProps<TValue = unknown> {
412
414
  tags?: FieldTag[];
413
415
  contain?: boolean;
414
416
  autoOff?: boolean;
417
+ /**
418
+ * Handles the submission logic for a given form or process.
419
+ *
420
+ * @param {TValue} e - The value associated with the submission action.
421
+ * @return {any} Value to be submitted.
422
+ */
423
+ onSubmit?(e: TValue): any;
424
+ onReset?(e: React.FormEvent<HTMLFormElement>): void;
415
425
  label?: React.ReactNode;
416
426
  sublabel?: React.ReactNode;
417
427
  description?: React.ReactNode;
@@ -470,7 +480,7 @@ interface InputFieldBaseProps<TValue = unknown> {
470
480
  * NOTE: this is a type alias (not an interface) so we can safely intersect
471
481
  * unions coming from VariantPropsFor<K> / VariantValueFor<K>.
472
482
  */
473
- type InputFieldProps<K extends VariantKey = VariantKey, H = unknown> = InputFieldBaseProps<VariantValueFor<K, H>> & VariantPropsFor<K, H> & InputFieldClassNameProps & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | 'defaultValue'> & {
483
+ type InputFieldProps<K extends VariantKey = VariantKey, H = unknown> = InputFieldBaseProps<VariantValueFor<K, H>> & VariantPropsFor<K, H> & InputFieldClassNameProps & Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> & {
474
484
  variant: K;
475
485
  /**
476
486
  * @deprecated Use the specific *ClassName props instead
@@ -681,6 +691,7 @@ interface PaletteRegistry {
681
691
  ruleDefinition: PasswordDefinitionMap;
682
692
  customLoader: CustomFileLoader;
683
693
  getCountries: () => Promise<PhoneCountry[]>;
694
+ formatFileValue: (file: FileItem) => string | undefined;
684
695
  }
685
696
  declare global {
686
697
  interface Window {