nuxt-ui-tools 1.7.0 → 1.8.1

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 (162) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +18 -0
  3. package/dist/runtime/file-preview/components/provider/file-preview-host.d.vue.ts +7 -0
  4. package/dist/runtime/file-preview/components/provider/file-preview-host.vue +147 -0
  5. package/dist/runtime/file-preview/components/provider/file-preview-host.vue.d.ts +7 -0
  6. package/dist/runtime/file-preview/components/provider/file-preview-provider.d.vue.ts +21 -0
  7. package/dist/runtime/file-preview/components/provider/file-preview-provider.vue +23 -0
  8. package/dist/runtime/file-preview/components/provider/file-preview-provider.vue.d.ts +21 -0
  9. package/dist/runtime/file-preview/components/renderers/audio-renderer.d.vue.ts +10 -0
  10. package/dist/runtime/file-preview/components/renderers/audio-renderer.vue +83 -0
  11. package/dist/runtime/file-preview/components/renderers/audio-renderer.vue.d.ts +10 -0
  12. package/dist/runtime/file-preview/components/renderers/csv-renderer.d.vue.ts +10 -0
  13. package/dist/runtime/file-preview/components/renderers/csv-renderer.vue +116 -0
  14. package/dist/runtime/file-preview/components/renderers/csv-renderer.vue.d.ts +10 -0
  15. package/dist/runtime/file-preview/components/renderers/fallback-renderer.d.vue.ts +10 -0
  16. package/dist/runtime/file-preview/components/renderers/fallback-renderer.vue +41 -0
  17. package/dist/runtime/file-preview/components/renderers/fallback-renderer.vue.d.ts +10 -0
  18. package/dist/runtime/file-preview/components/renderers/file-preview-code.d.vue.ts +9 -0
  19. package/dist/runtime/file-preview/components/renderers/file-preview-code.vue +83 -0
  20. package/dist/runtime/file-preview/components/renderers/file-preview-code.vue.d.ts +9 -0
  21. package/dist/runtime/file-preview/components/renderers/file-preview-text-loading.d.vue.ts +3 -0
  22. package/dist/runtime/file-preview/components/renderers/file-preview-text-loading.vue +14 -0
  23. package/dist/runtime/file-preview/components/renderers/file-preview-text-loading.vue.d.ts +3 -0
  24. package/dist/runtime/file-preview/components/renderers/image-renderer.d.vue.ts +10 -0
  25. package/dist/runtime/file-preview/components/renderers/image-renderer.vue +182 -0
  26. package/dist/runtime/file-preview/components/renderers/image-renderer.vue.d.ts +10 -0
  27. package/dist/runtime/file-preview/components/renderers/markdown-renderer.d.vue.ts +10 -0
  28. package/dist/runtime/file-preview/components/renderers/markdown-renderer.vue +78 -0
  29. package/dist/runtime/file-preview/components/renderers/markdown-renderer.vue.d.ts +10 -0
  30. package/dist/runtime/file-preview/components/renderers/media-controls.d.vue.ts +10 -0
  31. package/dist/runtime/file-preview/components/renderers/media-controls.vue +145 -0
  32. package/dist/runtime/file-preview/components/renderers/media-controls.vue.d.ts +10 -0
  33. package/dist/runtime/file-preview/components/renderers/pdf-renderer.d.vue.ts +10 -0
  34. package/dist/runtime/file-preview/components/renderers/pdf-renderer.vue +58 -0
  35. package/dist/runtime/file-preview/components/renderers/pdf-renderer.vue.d.ts +10 -0
  36. package/dist/runtime/file-preview/components/renderers/text-renderer.d.vue.ts +10 -0
  37. package/dist/runtime/file-preview/components/renderers/text-renderer.vue +41 -0
  38. package/dist/runtime/file-preview/components/renderers/text-renderer.vue.d.ts +10 -0
  39. package/dist/runtime/file-preview/components/renderers/video-renderer.d.vue.ts +10 -0
  40. package/dist/runtime/file-preview/components/renderers/video-renderer.vue +110 -0
  41. package/dist/runtime/file-preview/components/renderers/video-renderer.vue.d.ts +10 -0
  42. package/dist/runtime/file-preview/components/shell/file-preview-button.d.vue.ts +16 -0
  43. package/dist/runtime/file-preview/components/shell/file-preview-button.vue +40 -0
  44. package/dist/runtime/file-preview/components/shell/file-preview-button.vue.d.ts +16 -0
  45. package/dist/runtime/{form/components/renderer/form-field-error.d.vue.ts → file-preview/components/shell/file-preview-details.d.vue.ts} +4 -2
  46. package/dist/runtime/file-preview/components/shell/file-preview-details.vue +25 -0
  47. package/dist/runtime/{form/components/renderer/form-field-error.vue.d.ts → file-preview/components/shell/file-preview-details.vue.d.ts} +4 -2
  48. package/dist/runtime/file-preview/components/shell/file-preview-header.d.vue.ts +44 -0
  49. package/dist/runtime/file-preview/components/shell/file-preview-header.vue +163 -0
  50. package/dist/runtime/file-preview/components/shell/file-preview-header.vue.d.ts +44 -0
  51. package/dist/runtime/file-preview/components/shell/file-preview-message.d.vue.ts +21 -0
  52. package/dist/runtime/file-preview/components/shell/file-preview-message.vue +49 -0
  53. package/dist/runtime/file-preview/components/shell/file-preview-message.vue.d.ts +21 -0
  54. package/dist/runtime/file-preview/components/shell/file-preview-shell.d.vue.ts +17 -0
  55. package/dist/runtime/file-preview/components/shell/file-preview-shell.vue +280 -0
  56. package/dist/runtime/file-preview/components/shell/file-preview-shell.vue.d.ts +17 -0
  57. package/dist/runtime/file-preview/components/shell/file-preview-stage.d.vue.ts +37 -0
  58. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue +173 -0
  59. package/dist/runtime/file-preview/components/shell/file-preview-stage.vue.d.ts +37 -0
  60. package/dist/runtime/file-preview/components/shell/file-preview-thumb.d.vue.ts +14 -0
  61. package/dist/runtime/file-preview/components/shell/file-preview-thumb.vue +69 -0
  62. package/dist/runtime/file-preview/components/shell/file-preview-thumb.vue.d.ts +14 -0
  63. package/dist/runtime/file-preview/components/shell/file-preview-tools.d.vue.ts +13 -0
  64. package/dist/runtime/file-preview/components/shell/file-preview-tools.vue +10 -0
  65. package/dist/runtime/file-preview/components/shell/file-preview-tools.vue.d.ts +13 -0
  66. package/dist/runtime/file-preview/composables/use-file-preview-api.d.ts +21 -0
  67. package/dist/runtime/file-preview/composables/use-file-preview-api.js +83 -0
  68. package/dist/runtime/file-preview/composables/use-file-preview-shell.d.ts +13 -0
  69. package/dist/runtime/file-preview/composables/use-file-preview-shell.js +30 -0
  70. package/dist/runtime/file-preview/composables/use-file-preview-source.d.ts +17 -0
  71. package/dist/runtime/file-preview/composables/use-file-preview-source.js +51 -0
  72. package/dist/runtime/file-preview/composables/use-file-preview-text.d.ts +14 -0
  73. package/dist/runtime/file-preview/composables/use-file-preview-text.js +79 -0
  74. package/dist/runtime/file-preview/index.d.ts +5 -0
  75. package/dist/runtime/file-preview/index.js +14 -0
  76. package/dist/runtime/file-preview/plugins/file-preview-api.d.ts +11 -0
  77. package/dist/runtime/file-preview/plugins/file-preview-api.js +10 -0
  78. package/dist/runtime/file-preview/types/api.d.ts +74 -0
  79. package/dist/runtime/file-preview/types/api.js +0 -0
  80. package/dist/runtime/file-preview/types/file.d.ts +77 -0
  81. package/dist/runtime/file-preview/types/file.js +0 -0
  82. package/dist/runtime/file-preview/types/index.d.ts +4 -0
  83. package/dist/runtime/file-preview/types/index.js +0 -0
  84. package/dist/runtime/file-preview/types/renderer.d.ts +49 -0
  85. package/dist/runtime/file-preview/types/renderer.js +0 -0
  86. package/dist/runtime/file-preview/types/shell.d.ts +12 -0
  87. package/dist/runtime/file-preview/types/shell.js +0 -0
  88. package/dist/runtime/file-preview/utils/container.d.ts +4 -0
  89. package/dist/runtime/file-preview/utils/container.js +10 -0
  90. package/dist/runtime/file-preview/utils/csv.d.ts +17 -0
  91. package/dist/runtime/file-preview/utils/csv.js +53 -0
  92. package/dist/runtime/file-preview/utils/download.d.ts +8 -0
  93. package/dist/runtime/file-preview/utils/download.js +40 -0
  94. package/dist/runtime/file-preview/utils/files.d.ts +7 -0
  95. package/dist/runtime/file-preview/utils/files.js +53 -0
  96. package/dist/runtime/file-preview/utils/format.d.ts +13 -0
  97. package/dist/runtime/file-preview/utils/format.js +40 -0
  98. package/dist/runtime/file-preview/utils/instance.d.ts +9 -0
  99. package/dist/runtime/file-preview/utils/instance.js +57 -0
  100. package/dist/runtime/file-preview/utils/renderers.d.ts +36 -0
  101. package/dist/runtime/file-preview/utils/renderers.js +247 -0
  102. package/dist/runtime/form/components/page/form-page-header.d.vue.ts +3 -1
  103. package/dist/runtime/form/components/page/form-page-header.vue +4 -4
  104. package/dist/runtime/form/components/page/form-page-header.vue.d.ts +3 -1
  105. package/dist/runtime/form/components/page/form-page-navigation.vue +2 -1
  106. package/dist/runtime/form/components/page/form-page-section.vue +15 -7
  107. package/dist/runtime/form/components/page/form-page.vue +0 -1
  108. package/dist/runtime/form/components/utils/form-file-preview.vue +5 -38
  109. package/dist/runtime/form/composables/use-field-control.d.ts +1 -1
  110. package/dist/runtime/form/composables/use-form-page.js +3 -1
  111. package/dist/runtime/form/composables/use-form-runtime.js +3 -0
  112. package/dist/runtime/form/composables/use-form-upload-registry.d.ts +2 -0
  113. package/dist/runtime/form/composables/use-form-upload-registry.js +11 -6
  114. package/dist/runtime/form/composables/use-form-validation.js +5 -1
  115. package/dist/runtime/form/fields/array-list/use-array-items.d.ts +1 -1
  116. package/dist/runtime/form/fields/array-table/array-table-cell.d.vue.ts +15 -0
  117. package/dist/runtime/form/fields/array-table/array-table-cell.vue +58 -0
  118. package/dist/runtime/form/fields/array-table/array-table-cell.vue.d.ts +15 -0
  119. package/dist/runtime/form/fields/array-table/component.vue +42 -26
  120. package/dist/runtime/form/fields/date/types.d.ts +6 -1
  121. package/dist/runtime/form/fields/date-family/component.vue +7 -1
  122. package/dist/runtime/form/fields/date-family/utils.d.ts +8 -1
  123. package/dist/runtime/form/fields/date-family/utils.js +10 -2
  124. package/dist/runtime/form/fields/hidden/types.d.ts +8 -1
  125. package/dist/runtime/form/fields/upload/component.vue +55 -176
  126. package/dist/runtime/form/fields/upload/types.d.ts +68 -3
  127. package/dist/runtime/form/fields/upload/upload-item.d.vue.ts +24 -0
  128. package/dist/runtime/form/fields/upload/upload-item.vue +158 -0
  129. package/dist/runtime/form/fields/upload/upload-item.vue.d.ts +24 -0
  130. package/dist/runtime/form/fields/upload/use-upload-items.d.ts +44 -0
  131. package/dist/runtime/form/fields/upload/use-upload-items.js +317 -0
  132. package/dist/runtime/form/types/callbacks.d.ts +8 -2
  133. package/dist/runtime/form/types/controller.d.ts +6 -3
  134. package/dist/runtime/form/types/field-base.d.ts +5 -5
  135. package/dist/runtime/form/types/field-output-utils.d.ts +12 -1
  136. package/dist/runtime/form/types/field-output.d.ts +1 -1
  137. package/dist/runtime/form/types/field.d.ts +3 -2
  138. package/dist/runtime/form/types/form-api.d.ts +4 -2
  139. package/dist/runtime/form/types/options-runtime.d.ts +8 -4
  140. package/dist/runtime/form/types/options.d.ts +11 -11
  141. package/dist/runtime/form/types/output.d.ts +33 -10
  142. package/dist/runtime/form/types/page.d.ts +7 -3
  143. package/dist/runtime/form/types/transform.d.ts +5 -2
  144. package/dist/runtime/form/types/ui.d.ts +7 -3
  145. package/dist/runtime/form/types/upload-runtime.d.ts +4 -0
  146. package/dist/runtime/form/utils/page.js +24 -5
  147. package/dist/runtime/form/utils/state.js +14 -11
  148. package/dist/runtime/i18n/locales/en.js +104 -1
  149. package/dist/runtime/i18n/locales/fr.js +104 -1
  150. package/dist/runtime/i18n/types.d.ts +121 -0
  151. package/dist/runtime/query-state/composables.d.ts +2 -2
  152. package/dist/runtime/shared/styles/tokens.css +1 -1
  153. package/dist/runtime/shared/types/utils.d.ts +12 -4
  154. package/dist/runtime/shared/utils/file.d.ts +11 -0
  155. package/dist/runtime/shared/utils/file.js +50 -0
  156. package/dist/runtime/table/components/table/table-renderer.vue +23 -3
  157. package/dist/runtime/table/components/table/table-skeleton-cell.js +2 -2
  158. package/dist/runtime/table/components/utils/search-query-input.d.vue.ts +5 -1
  159. package/dist/runtime/table/components/utils/search-query-input.vue +17 -3
  160. package/dist/runtime/table/components/utils/search-query-input.vue.d.ts +5 -1
  161. package/package.json +56 -29
  162. package/dist/runtime/form/components/renderer/form-field-error.vue +0 -16
@@ -42,6 +42,7 @@ import type { FormTextField } from '../fields/text/types.js';
42
42
  import type { FormTextareaField } from '../fields/textarea/types.js';
43
43
  import type { FormTimeField } from '../fields/time/types.js';
44
44
  import type { FormUploadField } from '../fields/upload/types.js';
45
+ import type { FormDependencyValues } from './callbacks.js';
45
46
  export type { FormContainerFieldBase, FormFieldType, FormStatefulFieldBase, FormStatelessFieldBase, } from './field-base.js';
46
47
  export type { FormArrayCollapseField } from '../fields/array-collapse/types.js';
47
48
  export type { FormArrayListField } from '../fields/array-list/types.js';
@@ -86,11 +87,11 @@ export type { FormTagField } from '../fields/tag/types.js';
86
87
  export type { FormTextField } from '../fields/text/types.js';
87
88
  export type { FormTextareaField } from '../fields/textarea/types.js';
88
89
  export type { FormTimeField } from '../fields/time/types.js';
89
- export type { FormUploadField } from '../fields/upload/types.js';
90
+ export type { FormUploadCallbackParams, FormUploadDeleteParams, FormUploadField, FormUploadHandler, FormUploadOpenParams, FormUploadResolvedFile, FormUploadValue, FormUploadValueParams, } from '../fields/upload/types.js';
90
91
  /**
91
92
  * Union of authored form fields.
92
93
  *
93
94
  * Individual field schema contracts live beside their field implementation in
94
95
  * `src/runtime/form/fields/<kind>/types.ts`; this file only assembles the public union.
95
96
  */
96
- export type FormField<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>> = FormTextField<TContext, TDeps> | FormPasswordField<TContext, TDeps> | FormTextareaField<TContext, TDeps> | FormNumberField<TContext, TDeps> | FormAutoCompleteField<TContext, TDeps> | FormCheckboxField<TContext, TDeps> | FormSwitchField<TContext, TDeps> | FormSwitchGroupField<TContext, TDeps> | FormRadioField<TContext, TDeps> | FormRadioCardField<TContext, TDeps> | FormCheckboxGroupField<TContext, TDeps> | FormCheckboxCardField<TContext, TDeps> | FormSelectField<TContext, TDeps> | FormDateField<TContext, TDeps> | FormDateTimeField<TContext, TDeps> | FormDateRangeField<TContext, TDeps> | FormMonthRangeField<TContext, TDeps> | FormDateTimeRangeField<TContext, TDeps> | FormMonthField<TContext, TDeps> | FormYearField<TContext, TDeps> | FormTimeField<TContext, TDeps> | FormTreeSelectField<TContext, TDeps> | FormCascaderField<TContext, TDeps> | FormTreeField<TContext, TDeps> | FormPhoneNumberField<TContext, TDeps> | FormHiddenField<TContext, TDeps> | FormInfoField<TContext, TDeps> | FormDividerField<TContext, TDeps> | FormSectionField<TContext, TDeps> | FormInputGroupField<TContext, TDeps> | FormTabsField<TContext, TDeps> | FormGroupField<TContext, TDeps> | FormObjectField<TContext, TDeps> | FormMatrixField<TContext, TDeps> | FormCustomComponentField<TContext, TDeps> | FormFileField<TContext, TDeps> | FormUploadField<TContext, TDeps> | FormArrayListField<TContext, TDeps> | FormArrayTableField<TContext, TDeps> | FormArrayTabsField<TContext, TDeps> | FormArrayVariantField<TContext, TDeps> | FormArrayCollapseField<TContext, TDeps> | FormArrayPrimitiveField<TContext, TDeps> | FormSliderField<TContext, TDeps> | FormColorPickerField<TContext, TDeps> | FormOneTimeCodeField<TContext, TDeps> | FormRatingField<TContext, TDeps> | FormTagField<TContext, TDeps> | FormButtonField<TContext, TDeps> | FormCardField<TContext, TDeps> | FormColumnField<TContext, TDeps>;
97
+ export type FormField<TContext = NonNullable<unknown>, TDeps = FormDependencyValues> = FormTextField<TContext, TDeps> | FormPasswordField<TContext, TDeps> | FormTextareaField<TContext, TDeps> | FormNumberField<TContext, TDeps> | FormAutoCompleteField<TContext, TDeps> | FormCheckboxField<TContext, TDeps> | FormSwitchField<TContext, TDeps> | FormSwitchGroupField<TContext, TDeps> | FormRadioField<TContext, TDeps> | FormRadioCardField<TContext, TDeps> | FormCheckboxGroupField<TContext, TDeps> | FormCheckboxCardField<TContext, TDeps> | FormSelectField<TContext, TDeps> | FormDateField<TContext, TDeps> | FormDateTimeField<TContext, TDeps> | FormDateRangeField<TContext, TDeps> | FormMonthRangeField<TContext, TDeps> | FormDateTimeRangeField<TContext, TDeps> | FormMonthField<TContext, TDeps> | FormYearField<TContext, TDeps> | FormTimeField<TContext, TDeps> | FormTreeSelectField<TContext, TDeps> | FormCascaderField<TContext, TDeps> | FormTreeField<TContext, TDeps> | FormPhoneNumberField<TContext, TDeps> | FormHiddenField<TContext, TDeps> | FormInfoField<TContext, TDeps> | FormDividerField<TContext, TDeps> | FormSectionField<TContext, TDeps> | FormInputGroupField<TContext, TDeps> | FormTabsField<TContext, TDeps> | FormGroupField<TContext, TDeps> | FormObjectField<TContext, TDeps> | FormMatrixField<TContext, TDeps> | FormCustomComponentField<TContext, TDeps> | FormFileField<TContext, TDeps> | FormUploadField<TContext, TDeps> | FormArrayListField<TContext, TDeps> | FormArrayTableField<TContext, TDeps> | FormArrayTabsField<TContext, TDeps> | FormArrayVariantField<TContext, TDeps> | FormArrayCollapseField<TContext, TDeps> | FormArrayPrimitiveField<TContext, TDeps> | FormSliderField<TContext, TDeps> | FormColorPickerField<TContext, TDeps> | FormOneTimeCodeField<TContext, TDeps> | FormRatingField<TContext, TDeps> | FormTagField<TContext, TDeps> | FormButtonField<TContext, TDeps> | FormCardField<TContext, TDeps> | FormColumnField<TContext, TDeps>;
@@ -2,7 +2,7 @@ import type { ComputedRef } from 'vue';
2
2
  import type { FormValue } from './/index.js';
3
3
  import type { FormSubmitHandler } from './api.js';
4
4
  import type { FormController } from './controller.js';
5
- import type { ExtractFormOutput } from './output.js';
5
+ import type { ExtractFormInput, ExtractFormOutput } from './output.js';
6
6
  import type { FormObject } from './utils.js';
7
7
  export type FormApiDisplayMode = 'modal' | 'drawer' | 'fullscreen';
8
8
  export type FormApiDisplayModeInput = FormApiDisplayMode | string | (() => FormApiDisplayModeInput);
@@ -20,7 +20,9 @@ export interface FormResolvedCreateOptions {
20
20
  mode: FormApiDisplayModeInput;
21
21
  onSubmit?: FormSubmitHandler<FormObject, FormValue>;
22
22
  }
23
- export interface FormApiCreateOptions<TSchema, TSubmitData = FormValue> extends FormApiCreateBaseOptions {
23
+ export interface FormApiCreateOptions<TSchema, TSubmitData = FormValue> extends Omit<FormApiCreateBaseOptions, 'input'> {
24
+ /** Initial value, typed from the schema as in `useForm`. */
25
+ input?: ExtractFormInput<TSchema>;
24
26
  /** Optional submit handler owned by the form overlay. Keeps submit buttons pending until it settles. */
25
27
  onSubmit?: FormSubmitHandler<ExtractFormOutput<TSchema>, TSubmitData>;
26
28
  }
@@ -1,11 +1,15 @@
1
- import type { QueryKey, UseQueryOptions } from '@tanstack/vue-query';
2
- import type { ComputedRef, Ref } from 'vue';
1
+ import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query';
2
+ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
3
3
  import type { ResolvedFormOption } from '../utils/options.js';
4
4
  import type { FormValue } from './/index.js';
5
5
  /**
6
- * Query options accepted by option sources once they cross the runtime boundary.
6
+ * Query options accepted by option sources once they cross the runtime boundary: a plain options
7
+ * object whose `queryKey` is an array, which is what the runtime checks before using it. They reach
8
+ * Vue Query's `useQuery`, which reads `enabled` as a boolean, a ref, or a getter.
7
9
  */
8
- export type FormRuntimeQueryOptions = Exclude<UseQueryOptions<FormValue, Error, FormValue, FormValue, QueryKey>, Ref<FormValue> | ComputedRef<FormValue>>;
10
+ export type FormRuntimeQueryOptions = Omit<QueryObserverOptions<FormValue, Error, FormValue, FormValue, QueryKey>, 'enabled'> & {
11
+ enabled?: MaybeRefOrGetter<boolean | undefined>;
12
+ };
9
13
  /**
10
14
  * Option state registered by a mounted option field and read through the field API.
11
15
  */
@@ -1,7 +1,7 @@
1
1
  import type { QueryKey } from '@tanstack/vue-query';
2
2
  import type { RemoteOptionsLoader, RemoteOptionsPageRequest, RemoteOptionsPagination, RemoteOptionsResult, RemoteOptionsSearch } from '../../shared/types/remote-options.js';
3
3
  import type { FormValue } from './/index.js';
4
- import type { FormFieldCallback, FormFieldCallbackParams } from './callbacks.js';
4
+ import type { FormDependencyValues, FormFieldCallback, FormFieldCallbackParams } from './callbacks.js';
5
5
  import type { FormQueryOptions } from './context.js';
6
6
  import type { FormMaybePromise, FormText } from './utils.js';
7
7
  /**
@@ -28,15 +28,15 @@ export type FormOptionItem<TValue extends FormOptionValue = FormOptionValue> = T
28
28
  /**
29
29
  * A static, sync-derived, promise-backed, or TanStack Query-backed option source.
30
30
  */
31
- export type FormOptionsSource<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> = readonly TOption[] | FormQueryOptions<readonly TOption[]> | FormFieldCallback<readonly TOption[] | Promise<readonly TOption[]> | FormQueryOptions<readonly TOption[]>, TContext, TDeps, TValue, TOption>;
31
+ export type FormOptionsSource<TOption, TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue> = readonly TOption[] | FormQueryOptions<readonly TOption[]> | FormFieldCallback<readonly TOption[] | Promise<readonly TOption[]> | FormQueryOptions<readonly TOption[]>, TContext, TDeps, TValue, TOption>;
32
32
  /**
33
33
  * Option creation hook for fields that can create a missing option from user input.
34
34
  */
35
- export interface FormCreateOptionParams<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
35
+ export interface FormCreateOptionParams<TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
36
36
  /** User-entered label that should be converted into a concrete option. */
37
37
  label: string;
38
38
  }
39
- export interface FormCreateOption<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> {
39
+ export interface FormCreateOption<TOption, TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue> {
40
40
  /** Label shown by the create affordance. */
41
41
  label?: FormText;
42
42
  /** Selects the newly-created option immediately. Defaults to `true`. */
@@ -46,14 +46,14 @@ export interface FormCreateOption<TOption, TContext = NonNullable<unknown>, TDep
46
46
  /** Creates an option and returns it. Return `null` when creation was cancelled. */
47
47
  handler: (params: FormCreateOptionParams<TContext, TDeps, TValue, TOption>) => FormMaybePromise<TOption | null>;
48
48
  }
49
- export interface FormOptionsChangeParams<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
49
+ export interface FormOptionsChangeParams<TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
50
50
  /** Previously resolved normalized options. */
51
51
  previousOptions: readonly TOption[];
52
52
  }
53
53
  /**
54
54
  * Shared option configuration for option-based fields.
55
55
  */
56
- export interface FormOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> {
56
+ export interface FormOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue> {
57
57
  /** Local option configs never declare a mode; `mode: 'remote'` selects the remote config. */
58
58
  mode?: never;
59
59
  /** Static, sync-derived, promise-backed, or query-backed options. */
@@ -69,7 +69,7 @@ export interface FormOptionConfig<TOption, TContext = NonNullable<unknown>, TDep
69
69
  /** Disable the field while its option source has no usable data yet. */
70
70
  disableOnLoading?: boolean;
71
71
  }
72
- export interface FormRemoteOptionsRequest<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
72
+ export interface FormRemoteOptionsRequest<TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
73
73
  /** Current debounced search term. Empty when the menu lists unfiltered options. */
74
74
  search: string;
75
75
  /** Requested page. `cursor` is set for cursor pagination and `index` for page pagination. */
@@ -77,7 +77,7 @@ export interface FormRemoteOptionsRequest<TContext = NonNullable<unknown>, TDeps
77
77
  /** Parent option whose direct children are requested. Undefined for root pages. */
78
78
  parent?: NoInfer<TOption>;
79
79
  }
80
- export interface FormRemoteSelectedRequest<TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
80
+ export interface FormRemoteSelectedRequest<TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue, TOption = FormValue> extends FormFieldCallbackParams<TContext, TDeps, TValue, TOption> {
81
81
  /** Selected values that are not present in the loaded pages. */
82
82
  values: readonly FormOptionValue[];
83
83
  }
@@ -85,7 +85,7 @@ export type FormRemoteSource<TResult> = FormQueryOptions<TResult> | Promise<TRes
85
85
  /**
86
86
  * Remote option configuration: server-side search, pagination, and selected-value hydration.
87
87
  */
88
- export interface FormRemoteOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> {
88
+ export interface FormRemoteOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue> {
89
89
  mode: 'remote';
90
90
  /** Loads one page of options for the current search, page, and optional parent. */
91
91
  source: (request: FormRemoteOptionsRequest<TContext, TDeps, TValue, TOption>) => FormRemoteSource<RemoteOptionsResult<TOption>>;
@@ -114,7 +114,7 @@ export interface FormRemoteOptionConfig<TOption, TContext = NonNullable<unknown>
114
114
  disableOnLoading?: boolean;
115
115
  }
116
116
  /** Reuses one remote loader while keeping field-specific refresh and creation behavior local. */
117
- export interface FormRemoteLoaderOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> extends Omit<FormRemoteOptionConfig<TOption, TContext, TDeps, TValue>, 'source' | 'resolveSelected' | 'pagination' | 'search' | 'queryKeyFor' | 'selectedQueryKeyFor'> {
117
+ export interface FormRemoteLoaderOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue> extends Omit<FormRemoteOptionConfig<TOption, TContext, TDeps, TValue>, 'source' | 'resolveSelected' | 'pagination' | 'search' | 'queryKeyFor' | 'selectedQueryKeyFor'> {
118
118
  loader: RemoteOptionsLoader<TOption>;
119
119
  source?: never;
120
120
  resolveSelected?: never;
@@ -123,4 +123,4 @@ export interface FormRemoteLoaderOptionConfig<TOption, TContext = NonNullable<un
123
123
  queryKeyFor?: never;
124
124
  selectedQueryKeyFor?: never;
125
125
  }
126
- export type FormAnyOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>, TValue = FormValue> = FormOptionConfig<TOption, TContext, TDeps, TValue> | FormRemoteOptionConfig<TOption, TContext, TDeps, TValue> | FormRemoteLoaderOptionConfig<TOption, TContext, TDeps, TValue> | FormOptionsSource<TOption, TContext, TDeps, TValue>;
126
+ export type FormAnyOptionConfig<TOption, TContext = NonNullable<unknown>, TDeps = FormDependencyValues, TValue = FormValue> = FormOptionConfig<TOption, TContext, TDeps, TValue> | FormRemoteOptionConfig<TOption, TContext, TDeps, TValue> | FormRemoteLoaderOptionConfig<TOption, TContext, TDeps, TValue> | FormOptionsSource<TOption, TContext, TDeps, TValue>;
@@ -1,7 +1,7 @@
1
1
  import type { DeepPrettify, DeepTransformNestedPaths, PathToObject, UnionToIntersection } from '../../shared/types/utils.js';
2
2
  import type { FormObject, FormValue } from './/index.js';
3
3
  import type { ArrayCollapseFieldOutput, ArrayListFieldOutput, ArrayPrimitiveFieldOutput, ArrayTableFieldOutput, ArrayTabsFieldOutput, ObjectFieldOutput, MatrixFieldOutput, ResolveFormFieldValue } from './field-output.js';
4
- import type { FormStateMode, TransformOutputValue } from './field-output-utils.js';
4
+ import type { FormStateMode, NullableValue, TransformInputValue, TransformOutputValue } from './field-output-utils.js';
5
5
  export type { ExtractFormFieldInternalValue, NullableValue, ResolveFormFieldValue, } from './field-output.js';
6
6
  export type { FormStateMode } from './field-output-utils.js';
7
7
  export type ExtractFormFieldOutputValue<TField> = TransformOutputValue<TField, ResolveFormFieldValue<TField>>;
@@ -49,7 +49,9 @@ type ArrayFieldValue<TField, TMode extends FormStateMode> = TField extends {
49
49
  } ? ArrayVariantValue<TField, TMode> : TField extends {
50
50
  type: 'array-collapse';
51
51
  } ? ArrayCollapseFieldOutput<FieldsValue<ChildFields<TField>, TMode> & VirtualFieldsValue<TField>> : never;
52
- type ApplyOutputMode<TField, TMode extends FormStateMode, TValue> = TMode extends 'output' ? TransformOutputValue<TField, TValue> : TValue;
52
+ type ApplyOutputMode<TField, TMode extends FormStateMode, TValue> = TMode extends 'output' ? TransformOutputValue<TField, TValue> : TMode extends 'input' ? TransformInputValue<TField, TValue | NullableValue> : TValue;
53
+ /** Input leaves every key out and accepts `null`, since a form fills in defaults for what is missing. */
54
+ type ModeFieldValueObject<TField, TMode extends FormStateMode, TValue> = TMode extends 'input' ? OptionalFieldValueObject<TField, TValue> : FieldValueObject<TField, TValue>;
53
55
  type ObjectFieldValue<TField, TMode extends FormStateMode> = ApplyOutputMode<TField, TMode, ObjectFieldOutput<FieldsValue<ChildFields<TField>, TMode>>>;
54
56
  type MatrixRows<TField> = TField extends {
55
57
  readonly rows: infer TRows;
@@ -57,7 +59,7 @@ type MatrixRows<TField> = TField extends {
57
59
  key: string;
58
60
  }[] ? TRows : readonly [] : readonly [];
59
61
  type MatrixFieldValue<TField, TMode extends FormStateMode> = ApplyOutputMode<TField, TMode, MatrixFieldOutput<MatrixRows<TField>, FieldsValue<ChildFields<TField>, TMode>>>;
60
- type StatefulFieldObject<TField, TMode extends FormStateMode> = TMode extends 'output' ? TField extends {
62
+ type StatefulFieldObject<TField, TMode extends FormStateMode> = TMode extends 'input' ? OptionalFieldValueObject<TField, ApplyOutputMode<TField, TMode, ResolveFormFieldValue<TField>>> : TMode extends 'output' ? TField extends {
61
63
  submit: {
62
64
  omit: true;
63
65
  };
@@ -72,13 +74,13 @@ type FieldObject<TField, TMode extends FormStateMode> = TField extends {
72
74
  type: 'input-group' | 'card' | 'column';
73
75
  } ? FieldsValue<ChildFields<TField>, TMode> : TField extends {
74
76
  type: 'object' | 'group';
75
- } ? FieldValueObject<TField, ObjectFieldValue<TField, TMode>> : TField extends {
77
+ } ? ModeFieldValueObject<TField, TMode, ObjectFieldValue<TField, TMode>> : TField extends {
76
78
  type: 'matrix';
77
- } ? FieldValueObject<TField, MatrixFieldValue<TField, TMode>> : TField extends {
79
+ } ? ModeFieldValueObject<TField, TMode, MatrixFieldValue<TField, TMode>> : TField extends {
78
80
  type: 'array-list' | 'array-table' | 'array-tabs' | 'array-variant' | 'array-collapse';
79
- } ? FieldValueObject<TField, ArrayFieldValue<TField, TMode>> : TField extends {
81
+ } ? ModeFieldValueObject<TField, TMode, ArrayFieldValue<TField, TMode>> : TField extends {
80
82
  type: 'array-primitive';
81
- } ? FieldValueObject<TField, ApplyOutputMode<TField, TMode, ArrayPrimitiveFieldOutput<TField>>> : StatefulFieldObject<TField, TMode>;
83
+ } ? ModeFieldValueObject<TField, TMode, ApplyOutputMode<TField, TMode, ArrayPrimitiveFieldOutput<TField>>> : StatefulFieldObject<TField, TMode>;
82
84
  type StepFields<TStep> = TStep extends {
83
85
  readonly fields: infer TFields;
84
86
  } ? TFields : never;
@@ -95,10 +97,31 @@ export type ExtractFormInternalValue<TSchema> = TSchema extends {
95
97
  readonly steps: infer TSteps;
96
98
  } ? DeepPrettify<StepsValue<TSteps, 'internal'>> : NonNullable<unknown>;
97
99
  /**
98
- * Extracts the complete submitted output value from a raw authored schema.
100
+ * Extracts the value a form accepts as `input` from a raw authored schema: every key optional,
101
+ * `null` accepted, and a field with `transform.input` typed by the value that hook takes.
102
+ */
103
+ export type ExtractFormInput<TSchema> = TSchema extends {
104
+ readonly fields: infer TFields;
105
+ } ? FormInputValue<DeepPrettify<FieldsValue<TFields, 'input'>>> : TSchema extends {
106
+ readonly steps: infer TSteps;
107
+ } ? FormInputValue<DeepPrettify<StepsValue<TSteps, 'input'>>> : FormObject;
108
+ /** Makes every key of plain records optional, through arrays, leaving files and dates whole. */
109
+ type FormInputValue<TValue> = TValue extends Date | Blob ? TValue : TValue extends readonly (infer TItem)[] ? readonly FormInputValue<TItem>[] : TValue extends FormObject ? {
110
+ [TKey in keyof TValue]?: FormInputValue<TValue[TKey]>;
111
+ } : TValue;
112
+ /**
113
+ * Extracts the complete submitted output value from a raw authored schema. Its arrays are mutable:
114
+ * the submitted value is a fresh object, and request bodies inferred from validators take mutable
115
+ * arrays, so `formData` passes to them as it is.
99
116
  */
100
117
  export type ExtractFormOutput<TSchema> = TSchema extends {
101
118
  readonly fields: infer TFields;
102
- } ? DeepPrettify<FieldsValue<TFields, 'output'>> : TSchema extends {
119
+ } ? FormOutputValue<DeepPrettify<FieldsValue<TFields, 'output'>>> : TSchema extends {
103
120
  readonly steps: infer TSteps;
104
- } ? DeepPrettify<StepsValue<TSteps, 'output'>> : NonNullable<unknown>;
121
+ } ? FormOutputValue<DeepPrettify<StepsValue<TSteps, 'output'>>> : NonNullable<unknown>;
122
+ /** Drops `readonly` from arrays and tuples through plain records, leaving files and dates whole. */
123
+ type FormOutputValue<TValue> = TValue extends Date | Blob ? TValue : TValue extends readonly unknown[] ? {
124
+ -readonly [TIndex in keyof TValue]: FormOutputValue<TValue[TIndex]>;
125
+ } : TValue extends FormObject ? {
126
+ [TKey in keyof TValue]: FormOutputValue<TValue[TKey]>;
127
+ } : TValue;
@@ -43,7 +43,8 @@ export interface FormPageSection<TContext = NonNullable<unknown>, TFields extend
43
43
  /**
44
44
  * Shows the section as optional and leaves it out of the sections left to complete. A section
45
45
  * without a required field is optional already; set this when its required fields are filled
46
- * by their defaults and the user has nothing to do there.
46
+ * by their defaults and the user has nothing to do there. Set `false` to keep a section
47
+ * required when its only required fields are the cells of array rows.
47
48
  */
48
49
  optional?: boolean;
49
50
  /** Grid of the section's fields, merged over the schema `layout`. */
@@ -159,9 +160,12 @@ export interface FormPageSectionState {
159
160
  label: string;
160
161
  /** Resolved supporting copy. */
161
162
  description?: string;
162
- /** True when the section is declared optional or has no required field. */
163
+ /**
164
+ * True when the section is declared optional, or declares nothing and has no required field
165
+ * outside array items.
166
+ */
163
167
  optional: boolean;
164
- /** Number of required fields without a value. */
168
+ /** Number of required fields without a value, the fields of array items included. */
165
169
  missing: number;
166
170
  /** Summary of the section's requirements, see `FormPageSectionStatus`. */
167
171
  status: FormPageSectionStatus;
@@ -2,10 +2,13 @@ import type { FormValue } from './/index.js';
2
2
  import type { FormFieldCallbackParams } from './callbacks.js';
3
3
  /**
4
4
  * Input/output transform hooks for a stateful field.
5
+ *
6
+ * The hooks are methods so a field can declare the value it accepts: `input(value: string)`
7
+ * types the field in `ExtractFormInput`, and `output` types it in `ExtractFormOutput`.
5
8
  */
6
9
  export interface FormTransformConfig<TInternal = FormValue, TExternal = TInternal, TContext = NonNullable<unknown>, TDeps = NonNullable<unknown>> {
7
10
  /** Converts an incoming raw value into the internal form value. Replaces legacy `preformat`. */
8
- input?: (value: TExternal, params: FormFieldCallbackParams<TContext, TDeps, TInternal>) => TInternal;
11
+ input?(value: TExternal, params: FormFieldCallbackParams<TContext, TDeps, TInternal>): TInternal;
9
12
  /** Converts the internal form value into the submitted output value. Replaces legacy `transform`. */
10
- output?: (value: TInternal, params: FormFieldCallbackParams<TContext, TDeps, TInternal>) => TExternal;
13
+ output?(value: TInternal, params: FormFieldCallbackParams<TContext, TDeps, TInternal>): TExternal;
11
14
  }
@@ -173,7 +173,9 @@ export interface FormArrayTableUi {
173
173
  cell?: FormUiClass;
174
174
  control?: FormUiClass;
175
175
  actionsCell?: FormUiClass;
176
+ /** Tooltip that shows the message of an invalid cell on hover and focus. */
176
177
  error?: FormUiClass;
178
+ /** Empty state, kept in view when the table scrolls sideways. */
177
179
  empty?: FormUiClass;
178
180
  addCell?: FormUiClass;
179
181
  add?: FormUiClass;
@@ -189,9 +191,11 @@ export interface FormOverlayUi {
189
191
  * (`complete`, `invalid`, `pending`) on entries and indicators, `data-dirty` on modified
190
192
  * sections and entries.
191
193
  *
192
- * Two CSS variables place sections under the pinned header: `--nut-form-page-header` (its
193
- * measured height, set by the page) and `--nut-form-page-gap` (the room below it, `24px` by
194
- * default). Set them on an element around the navigation and sections, such as the root.
194
+ * Sections and the navigation stay below the pinned header: the page gives each section its
195
+ * `scroll-margin-top` and the navigation the `--nut-form-page-header` variable (the header's
196
+ * measured height), rather than setting a variable every field inherits, so a header that
197
+ * resizes restyles only them. `--nut-form-page-gap` is the room below the header (`24px` by
198
+ * default); set it on an element around the navigation and sections, such as the root.
195
199
  */
196
200
  export interface FormPageUi {
197
201
  /** The `<form>` element, which scrolls on its own and is the container of the page queries. */
@@ -4,4 +4,8 @@ export interface FormUploadRuntimeState {
4
4
  cancel: () => Promise<void>;
5
5
  retry: () => Promise<void>;
6
6
  remove: (value?: FormValue) => Promise<void>;
7
+ /** Resolves once every upload running for the field has finished or failed. */
8
+ settle: () => Promise<void>;
9
+ /** True while the field holds selected files that are not stored yet. */
10
+ pending: () => boolean;
7
11
  }
@@ -3,8 +3,10 @@ import { getPathValue, isRecord } from "./path.js";
3
3
  import { isBoolean, isFunction, isNumber, isString } from "./predicate.js";
4
4
  import {
5
5
  fieldPath,
6
+ getArrayItemFields,
6
7
  getChildFields,
7
8
  getSchemaFields,
9
+ isArrayField,
8
10
  isEmptyValue,
9
11
  isFlatPassthroughField,
10
12
  isObjectContainerField,
@@ -40,7 +42,7 @@ export function resolveFormPageSectionState(params) {
40
42
  const invalid = runtime.errors.value.some((error) => contains(error.path));
41
43
  const required = params.requiredEnforced ? leaves.filter((leaf) => isRequiredLeaf(leaf, runtime)) : [];
42
44
  const missing = required.filter((leaf) => isEmptyValue(runtime.getValue(leaf.path))).length;
43
- const optional = entry.section.optional === true || required.length === 0;
45
+ const optional = entry.section.optional ?? required.every((leaf) => leaf.item);
44
46
  const filled = !optional || leaves.some((leaf) => isProvided(leaf, runtime, dirtyPaths, params.input));
45
47
  return {
46
48
  description: resolveFormText(entry.section.description),
@@ -54,7 +56,7 @@ export function resolveFormPageSectionState(params) {
54
56
  status: invalid ? "invalid" : missing === 0 && filled ? "complete" : "pending"
55
57
  };
56
58
  }
57
- function collectVisibleLeaves(fields, parentPath, runtime) {
59
+ function collectVisibleLeaves(fields, parentPath, runtime, item = false) {
58
60
  return fields.flatMap((field) => {
59
61
  if (field.ignore === true) {
60
62
  return [];
@@ -67,14 +69,31 @@ function collectVisibleLeaves(fields, parentPath, runtime) {
67
69
  return [];
68
70
  }
69
71
  if (isFlatPassthroughField(field)) {
70
- return collectVisibleLeaves(getChildFields(field), parentPath, runtime);
72
+ return collectVisibleLeaves(getChildFields(field), parentPath, runtime, item);
71
73
  }
72
74
  if (isObjectContainerField(field)) {
73
- return collectVisibleLeaves(getChildFields(field), path, runtime);
75
+ return collectVisibleLeaves(getChildFields(field), path, runtime, item);
74
76
  }
75
- return [{ field, path }];
77
+ if (isArrayField(field)) {
78
+ return [{ field, item, path }, ...collectArrayItemLeaves(field, path, runtime)];
79
+ }
80
+ return [{ field, item, path }];
76
81
  });
77
82
  }
83
+ function collectArrayItemLeaves(field, path, runtime) {
84
+ const items = runtime.getValue(path);
85
+ if (!Array.isArray(items)) {
86
+ return [];
87
+ }
88
+ return items.flatMap(
89
+ (value, index) => isRecord(value) ? collectVisibleLeaves(
90
+ getArrayItemFields(field, value),
91
+ [...path, String(index)],
92
+ runtime,
93
+ true
94
+ ) : []
95
+ );
96
+ }
78
97
  function isRequiredLeaf(leaf, runtime) {
79
98
  const required = Object.getOwnPropertyDescriptor(leaf.field, "required")?.value;
80
99
  if (isBoolean(required)) {
@@ -73,7 +73,7 @@ function applyInputTransforms(target, fields, ctx, parentPath, apiFactory) {
73
73
  continue;
74
74
  }
75
75
  const path = fieldPath(parentPath, field);
76
- const value = getPathValue(target, path);
76
+ const value = transformFieldInput({ apiFactory, ctx, field, parentPath, path, target });
77
77
  if (isObjectContainerField(field)) {
78
78
  if (isRecord(value)) {
79
79
  applyInputTransforms(target, getChildFields(field), ctx, path, apiFactory);
@@ -109,18 +109,21 @@ function applyInputTransforms(target, fields, ctx, parentPath, apiFactory) {
109
109
  }
110
110
  continue;
111
111
  }
112
- if (isUndefined(value)) {
113
- continue;
114
- }
115
- const transform = Object.getOwnPropertyDescriptor(field, "transform")?.value;
116
- if (!isRecord(transform) || !isFunction(transform.input)) {
117
- continue;
118
- }
119
- const api = apiFactory?.(path, field);
120
- const params = api ? callbackParams({ api, ctx, field, parentPath, state: target }) : void 0;
121
- setPathValue(target, path, transform.input(value, params));
122
112
  }
123
113
  }
114
+ function transformFieldInput(params) {
115
+ const { target, field, path } = params;
116
+ const value = getPathValue(target, path);
117
+ const transform = Object.getOwnPropertyDescriptor(field, "transform")?.value;
118
+ if (isUndefined(value) || !isRecord(transform) || !isFunction(transform.input)) {
119
+ return value;
120
+ }
121
+ const api = params.apiFactory?.(path, field);
122
+ const callback = api ? callbackParams({ api, ctx: params.ctx, field, parentPath: params.parentPath, state: target }) : void 0;
123
+ const transformed = transform.input(value, callback);
124
+ setPathValue(target, path, transformed);
125
+ return transformed;
126
+ }
124
127
  export function buildInitialFormFieldsState(fields, ctx) {
125
128
  const state = {};
126
129
  mergeMissingFieldDefaults(state, fields, ctx, []);
@@ -97,6 +97,101 @@ export default defineUiToolsLocale({
97
97
  retry: "Retry"
98
98
  }
99
99
  },
100
+ filePreview: {
101
+ close: "Close",
102
+ converted: {
103
+ description: "The original is a {kind} file.",
104
+ download: "Download original",
105
+ title: "Converted preview"
106
+ },
107
+ counter: "{current} / {total}",
108
+ csv: {
109
+ bom: "UTF-8 with BOM",
110
+ columns: "{count} columns",
111
+ delimiter: "Delimiter \u201C{value}\u201D",
112
+ rows: "{count} rows",
113
+ tab: "tab"
114
+ },
115
+ details: "Details",
116
+ download: "Download",
117
+ errors: {
118
+ decodeDescription: "Download it to open it in another app.",
119
+ decodeTitle: "This browser can\u2019t display {extension} files",
120
+ open: "Open",
121
+ pdfDescription: "Open it in the system viewer or download it.",
122
+ pdfTitle: "This device can\u2019t show PDFs here",
123
+ sourceDescription: "The link may have expired. Retry asks for it again.",
124
+ sourceTitle: "Couldn\u2019t load this file"
125
+ },
126
+ expand: "Expand",
127
+ fallback: {
128
+ description: "{extension} files can\u2019t be shown here. Download it to open it in another app.",
129
+ descriptionUnnamed: "This file can\u2019t be shown here. Download it to open it in another app.",
130
+ title: "No preview available"
131
+ },
132
+ fields: {
133
+ columns: "Columns",
134
+ dimensions: "Dimensions",
135
+ duration: "Duration",
136
+ lines: "Lines",
137
+ modified: "Modified",
138
+ name: "Name",
139
+ rows: "Rows",
140
+ size: "Size",
141
+ type: "Type"
142
+ },
143
+ image: {
144
+ fit: "Fit to screen",
145
+ rotate: "Rotate",
146
+ zoomIn: "Zoom in",
147
+ zoomOut: "Zoom out"
148
+ },
149
+ kinds: {
150
+ archive: "Archive",
151
+ audio: "Audio",
152
+ csv: "CSV",
153
+ image: "Image",
154
+ markdown: "Markdown",
155
+ office: "Office document",
156
+ other: "File",
157
+ pdf: "PDF",
158
+ text: "Text",
159
+ video: "Video"
160
+ },
161
+ markdown: {
162
+ preview: "Preview",
163
+ source: "Source"
164
+ },
165
+ media: {
166
+ captions: "Captions",
167
+ exitFullscreen: "Exit full screen",
168
+ fullscreen: "Full screen",
169
+ mute: "Mute",
170
+ pause: "Pause",
171
+ pictureInPicture: "Picture in picture",
172
+ play: "Play",
173
+ seek: "Seek",
174
+ speed: "Playback speed",
175
+ unmute: "Unmute",
176
+ volume: "Volume"
177
+ },
178
+ moreActions: "More actions",
179
+ next: "Next",
180
+ openInNewTab: "Open in new tab",
181
+ position: "{current} of {total}: {name}",
182
+ previous: "Previous",
183
+ restore: "Restore",
184
+ retry: "Retry",
185
+ text: {
186
+ copied: "Copied",
187
+ copy: "Copy contents",
188
+ formatted: "Formatted JSON",
189
+ lines: "{count} lines",
190
+ wrap: "Wrap lines"
191
+ },
192
+ truncated: "Showing the first {size} of {total}.",
193
+ untitled: "Untitled file"
194
+ },
100
195
  form: {
101
196
  actions: {
102
197
  cancelButton: "Cancel",
@@ -144,7 +239,8 @@ export default defineUiToolsLocale({
144
239
  clear: "Clear value",
145
240
  confirm: "Confirm",
146
241
  end: "End",
147
- start: "Start"
242
+ start: "Start",
243
+ tokens: { day: "dd", hour: "hh", minute: "mm", month: "mm", year: "yyyy" }
148
244
  },
149
245
  description: {
150
246
  close: "Close",
@@ -195,7 +291,14 @@ export default defineUiToolsLocale({
195
291
  minute: "Minute"
196
292
  },
197
293
  upload: {
294
+ cancel: "Cancel upload",
198
295
  failed: "Upload failed.",
296
+ open: "Open file",
297
+ pending: "Upload or remove the selected files before saving.",
298
+ queued: "Ready to upload",
299
+ replace: "Replace file",
300
+ retry: "Retry upload",
301
+ uploading: "Uploading\u2026",
199
302
  remove: "Remove",
200
303
  upload: "Upload"
201
304
  }