fuma 0.1.21 → 0.1.23

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.
@@ -42,15 +42,15 @@ contextContainer.set("drawer");
42
42
  on:keyup={close}
43
43
  transition:fade={{ duration: 200 }}
44
44
  class="
45
- fixed inset-0 z-10 bg-black/25 backdrop-blur-[1.5px]
46
- dark:bg-white/25"
45
+ fixed inset-0 z-10 bg-black/15 backdrop-blur-[1.5px]
46
+ dark:bg-white/15"
47
47
  />
48
48
 
49
49
  <aside
50
50
  transition:fly|local={{ x: 500, duration: 200 }}
51
51
  style="max-width: min(100%, {maxWidth}); transform: translateX({-$offset * 4}rem);"
52
52
  class="{klass}
53
- fixed bottom-0 right-0 top-0 z-10 flex
53
+ fixed bottom-0 right-0 top-0 z-10 flex w-full
54
54
  flex-col overflow-y-scroll bg-base-100 transition-transform
55
55
  "
56
56
  >
@@ -19,16 +19,18 @@ export let data = initData(fields);
19
19
  export let action = "";
20
20
  export let actionDelete = "";
21
21
  export let actionPrefix = "";
22
- export let successMessage = "Succ\xE8s";
22
+ export let options = {};
23
23
  export function set(key, value) {
24
24
  data[key] = value;
25
25
  }
26
26
  const dispatch = createEventDispatcher();
27
27
  const { enhance } = useForm({
28
+ ...options,
28
29
  onSuccess(action2, data2) {
29
30
  dispatch("success", { action: action2, data: data2 });
30
- },
31
- successMessage
31
+ if (options.onSuccess)
32
+ options.onSuccess(action2, data2);
33
+ }
32
34
  });
33
35
  onMount(lookupValueFromParams);
34
36
  function lookupValueFromParams() {
@@ -1,6 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { z } from 'zod';
3
3
  import { type FormField, type FormSectionProps } from './form.js';
4
+ import { type UseFormOptions } from '../../validation/form.js';
4
5
  declare class __sveltets_Render<Shape extends z.ZodRawShape> {
5
6
  props(): {
6
7
  class?: string | undefined;
@@ -12,7 +13,7 @@ declare class __sveltets_Render<Shape extends z.ZodRawShape> {
12
13
  action?: string | undefined;
13
14
  actionDelete?: string | undefined;
14
15
  actionPrefix?: string | undefined;
15
- successMessage?: string | undefined;
16
+ options?: UseFormOptions<Partial<z.objectUtil.addQuestionMarks<z.baseObjectOutputType<Shape>, { [k_1 in keyof z.baseObjectOutputType<Shape>]: undefined extends z.baseObjectOutputType<Shape>[k_1] ? never : k_1; }[keyof Shape]> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<Shape>, { [k_1 in keyof z.baseObjectOutputType<Shape>]: undefined extends z.baseObjectOutputType<Shape>[k_1] ? never : k_1; }[keyof Shape]>[k]; } : never>> | undefined;
16
17
  set?: (<K extends keyof Shape>(key: K, value: Partial<z.objectUtil.addQuestionMarks<z.baseObjectOutputType<Shape>, { [k_1 in keyof z.baseObjectOutputType<Shape>]: undefined extends z.baseObjectOutputType<Shape>[k_1] ? never : k_1; }[keyof Shape]> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<Shape>, { [k_1 in keyof z.baseObjectOutputType<Shape>]: undefined extends z.baseObjectOutputType<Shape>[k_1] ? never : k_1; }[keyof Shape]>[k]; } : never>[K]) => void) | undefined;
17
18
  };
18
19
  events(): {
@@ -10,7 +10,7 @@ export declare const formContext: {
10
10
  };
11
11
  type SuccessMessage = false | string | ((action: URL) => string);
12
12
  type BooleanOrFunction = boolean | ((action: URL) => boolean);
13
- type UseFormOptions<ReturnData> = {
13
+ export type UseFormOptions<ReturnData> = {
14
14
  onSubmit?: (...args: Parameters<SubmitFunction>) => any;
15
15
  onSuccess?: (action: URL, data?: ReturnData) => any;
16
16
  onResetError?: () => unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod and more",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",