@texturehq/edges 5.0.0 → 5.1.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.
@@ -1,9 +1,9 @@
1
- import { FieldValues, FieldPath, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
1
+ import { FieldValues, FieldPath, FieldPathValue, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
2
2
  export { Controller, useFieldArray, useFormContext, useWatch } from 'react-hook-form';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import { Key, DateValue } from 'react-aria-components';
6
- import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-CJUNJDQT.cjs';
6
+ import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, M as MultiSelect, c as MultiSelectOption, N as NumberField, R as RadioCardGroup, d as RadioGroup, S as Select, e as Switch, T as TextArea, f as TextField, g as TimeFieldProps, B as Button } from '../TimeField-DsHO9pLs.cjs';
7
7
  import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-B_GaE_Yf.cjs';
8
8
  import '@phosphor-icons/react';
9
9
 
@@ -45,6 +45,25 @@ interface FormFileUploadProps<T extends FieldValues> extends Omit<React.Componen
45
45
  }
46
46
  declare function FormFileUpload<T extends FieldValues>({ name, defaultValue, errorBelow, ...rest }: FormFileUploadProps<T>): react_jsx_runtime.JSX.Element;
47
47
 
48
+ /**
49
+ * Paths in `T` whose value is a string array. `MultiSelect` spreads its value, so a
50
+ * scalar path would turn a string into character-by-character selections and a
51
+ * non-iterable would throw — neither of which the old `FieldPath<T>` prevented.
52
+ *
53
+ * Built from `FieldPathValue` rather than RHF's own `FieldPathByValue`, which only
54
+ * exists from 7.35. This package declares `react-hook-form` at `^7.x`, so a consumer
55
+ * on an earlier 7 must still typecheck; `FieldPathValue` has been there since 7.0.
56
+ */
57
+ type ArrayFieldPath<T extends FieldValues> = {
58
+ [K in FieldPath<T>]: FieldPathValue<T, K> extends string[] | undefined ? K : never;
59
+ }[FieldPath<T>];
60
+ interface FormMultiSelectProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof MultiSelect>, "value" | "defaultValue" | "onChange" | "errorMessage" | "inputRef" | "options"> {
61
+ name: ArrayFieldPath<T>;
62
+ options: readonly MultiSelectOption[];
63
+ defaultValue?: string[];
64
+ }
65
+ declare function FormMultiSelect<T extends FieldValues>({ name, defaultValue, ...rest }: FormMultiSelectProps<T>): react_jsx_runtime.JSX.Element;
66
+
48
67
  interface FormNumberFieldProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof NumberField>, "value" | "defaultValue" | "onChange"> {
49
68
  name: FieldPath<T>;
50
69
  defaultValue?: number;
@@ -178,4 +197,4 @@ declare function useAutoSave<TValues extends Record<string, unknown>>({ delayMs,
178
197
 
179
198
  declare function focusFirstError(formEl: HTMLFormElement): void;
180
199
 
181
- export { ErrorSummary, type ErrorSummaryProps, FieldArrayList, type FieldArrayListProps, FormAutocomplete, type FormAutocompleteProps, FormCheckbox, FormCheckboxGroup, type FormCheckboxGroupProps, type FormCheckboxProps, FormColorField, type FormColorFieldProps, FormDateField, type FormDateFieldProps, FormFileUpload, type FormFileUploadProps, FormNumberField, type FormNumberFieldProps, FormProvider, type FormProviderProps, FormRadioCardGroup, type FormRadioCardGroupProps, FormRadioGroup, type FormRadioGroupProps, FormRichTextEditor, type FormRichTextEditorProps, FormSaveBar, type FormSaveBarProps, FormSelect, type FormSelectProps, FormSwitch, type FormSwitchProps, FormTextArea, type FormTextAreaProps, FormTextField, type FormTextFieldProps, FormTimeField, type FormTimeFieldProps, SubmitButton, type SubmitButtonProps, type UseAutoSaveOptions, focusFirstError, useAutoSave, useScrollIntoViewOnError };
200
+ export { ErrorSummary, type ErrorSummaryProps, FieldArrayList, type FieldArrayListProps, FormAutocomplete, type FormAutocompleteProps, FormCheckbox, FormCheckboxGroup, type FormCheckboxGroupProps, type FormCheckboxProps, FormColorField, type FormColorFieldProps, FormDateField, type FormDateFieldProps, FormFileUpload, type FormFileUploadProps, FormMultiSelect, type FormMultiSelectProps, FormNumberField, type FormNumberFieldProps, FormProvider, type FormProviderProps, FormRadioCardGroup, type FormRadioCardGroupProps, FormRadioGroup, type FormRadioGroupProps, FormRichTextEditor, type FormRichTextEditorProps, FormSaveBar, type FormSaveBarProps, FormSelect, type FormSelectProps, FormSwitch, type FormSwitchProps, FormTextArea, type FormTextAreaProps, FormTextField, type FormTextFieldProps, FormTimeField, type FormTimeFieldProps, SubmitButton, type SubmitButtonProps, type UseAutoSaveOptions, focusFirstError, useAutoSave, useScrollIntoViewOnError };
@@ -1,9 +1,9 @@
1
- import { FieldValues, FieldPath, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
1
+ import { FieldValues, FieldPath, FieldPathValue, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
2
2
  export { Controller, useFieldArray, useFormContext, useWatch } from 'react-hook-form';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import { Key, DateValue } from 'react-aria-components';
6
- import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-rRIt80g3.js';
6
+ import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, M as MultiSelect, c as MultiSelectOption, N as NumberField, R as RadioCardGroup, d as RadioGroup, S as Select, e as Switch, T as TextArea, f as TextField, g as TimeFieldProps, B as Button } from '../TimeField-DVuYVoDw.js';
7
7
  import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-B_GaE_Yf.js';
8
8
  import '@phosphor-icons/react';
9
9
 
@@ -45,6 +45,25 @@ interface FormFileUploadProps<T extends FieldValues> extends Omit<React.Componen
45
45
  }
46
46
  declare function FormFileUpload<T extends FieldValues>({ name, defaultValue, errorBelow, ...rest }: FormFileUploadProps<T>): react_jsx_runtime.JSX.Element;
47
47
 
48
+ /**
49
+ * Paths in `T` whose value is a string array. `MultiSelect` spreads its value, so a
50
+ * scalar path would turn a string into character-by-character selections and a
51
+ * non-iterable would throw — neither of which the old `FieldPath<T>` prevented.
52
+ *
53
+ * Built from `FieldPathValue` rather than RHF's own `FieldPathByValue`, which only
54
+ * exists from 7.35. This package declares `react-hook-form` at `^7.x`, so a consumer
55
+ * on an earlier 7 must still typecheck; `FieldPathValue` has been there since 7.0.
56
+ */
57
+ type ArrayFieldPath<T extends FieldValues> = {
58
+ [K in FieldPath<T>]: FieldPathValue<T, K> extends string[] | undefined ? K : never;
59
+ }[FieldPath<T>];
60
+ interface FormMultiSelectProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof MultiSelect>, "value" | "defaultValue" | "onChange" | "errorMessage" | "inputRef" | "options"> {
61
+ name: ArrayFieldPath<T>;
62
+ options: readonly MultiSelectOption[];
63
+ defaultValue?: string[];
64
+ }
65
+ declare function FormMultiSelect<T extends FieldValues>({ name, defaultValue, ...rest }: FormMultiSelectProps<T>): react_jsx_runtime.JSX.Element;
66
+
48
67
  interface FormNumberFieldProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof NumberField>, "value" | "defaultValue" | "onChange"> {
49
68
  name: FieldPath<T>;
50
69
  defaultValue?: number;
@@ -178,4 +197,4 @@ declare function useAutoSave<TValues extends Record<string, unknown>>({ delayMs,
178
197
 
179
198
  declare function focusFirstError(formEl: HTMLFormElement): void;
180
199
 
181
- export { ErrorSummary, type ErrorSummaryProps, FieldArrayList, type FieldArrayListProps, FormAutocomplete, type FormAutocompleteProps, FormCheckbox, FormCheckboxGroup, type FormCheckboxGroupProps, type FormCheckboxProps, FormColorField, type FormColorFieldProps, FormDateField, type FormDateFieldProps, FormFileUpload, type FormFileUploadProps, FormNumberField, type FormNumberFieldProps, FormProvider, type FormProviderProps, FormRadioCardGroup, type FormRadioCardGroupProps, FormRadioGroup, type FormRadioGroupProps, FormRichTextEditor, type FormRichTextEditorProps, FormSaveBar, type FormSaveBarProps, FormSelect, type FormSelectProps, FormSwitch, type FormSwitchProps, FormTextArea, type FormTextAreaProps, FormTextField, type FormTextFieldProps, FormTimeField, type FormTimeFieldProps, SubmitButton, type SubmitButtonProps, type UseAutoSaveOptions, focusFirstError, useAutoSave, useScrollIntoViewOnError };
200
+ export { ErrorSummary, type ErrorSummaryProps, FieldArrayList, type FieldArrayListProps, FormAutocomplete, type FormAutocompleteProps, FormCheckbox, FormCheckboxGroup, type FormCheckboxGroupProps, type FormCheckboxProps, FormColorField, type FormColorFieldProps, FormDateField, type FormDateFieldProps, FormFileUpload, type FormFileUploadProps, FormMultiSelect, type FormMultiSelectProps, FormNumberField, type FormNumberFieldProps, FormProvider, type FormProviderProps, FormRadioCardGroup, type FormRadioCardGroupProps, FormRadioGroup, type FormRadioGroupProps, FormRichTextEditor, type FormRichTextEditorProps, FormSaveBar, type FormSaveBarProps, FormSelect, type FormSelectProps, FormSwitch, type FormSwitchProps, FormTextArea, type FormTextAreaProps, FormTextField, type FormTextFieldProps, FormTimeField, type FormTimeFieldProps, SubmitButton, type SubmitButtonProps, type UseAutoSaveOptions, focusFirstError, useAutoSave, useScrollIntoViewOnError };