fuma 0.3.23 → 0.3.25

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,4 +1,4 @@
1
- type Container = 'drawer' | 'card';
1
+ type Container = 'drawer' | 'card' | 'dialog';
2
2
  export declare const contextContainer: {
3
3
  set(container: Container): Container;
4
4
  get(): Container | null;
@@ -1,11 +1,13 @@
1
1
  <script>import { createEventDispatcher, onMount } from "svelte";
2
2
  import { mdiClose } from "@mdi/js";
3
3
  import { Icon } from "../icon/index.js";
4
+ import { contextContainer } from "../context.js";
4
5
  export let dialog;
5
6
  export let hideCloseButton = false;
6
7
  let klass = "";
7
8
  export { klass as class };
8
9
  const dispatch = createEventDispatcher();
10
+ contextContainer.set("dialog");
9
11
  onMount(() => {
10
12
  const inputsSelector = 'input:not([type=hidden], [tabindex="-1"])';
11
13
  const inputs = dialog.querySelectorAll(inputsSelector);
@@ -77,10 +77,13 @@ function lookupValueFromParams() {
77
77
  const actionPadding = getActionPadding();
78
78
  function getActionPadding() {
79
79
  const container = contextContainer.get();
80
+ console.log({ container });
80
81
  if (container === "card")
81
82
  return "-mx-2 sm:-mx-8 px-2 sm:px-8";
82
83
  if (container === "drawer")
83
84
  return "-ml-8 -mr-4 pl-8 pr-4";
85
+ if (container === "dialog")
86
+ return "-bottom-4 -mx-4 px-4";
84
87
  return "";
85
88
  }
86
89
  const getBoolean = (bool) => (_data) => typeof bool === "boolean" || bool === void 0 ? !!bool : !!bool(_data);
@@ -96,7 +99,7 @@ const getBoolean = (bool) => (_data) => typeof bool === "boolean" || bool === vo
96
99
  >
97
100
  <slot />
98
101
 
99
- {#if data.id}
102
+ {#if data?.id}
100
103
  <input type="hidden" name="id" value={data.id} />
101
104
  {/if}
102
105
 
@@ -137,7 +140,10 @@ const getBoolean = (bool) => (_data) => typeof bool === "boolean" || bool === vo
137
140
  <button class="btn btn-primary"> Valider </button>
138
141
  <div class="grow" />
139
142
  {#if data.id && actionDelete}
140
- <ButtonDelete formaction="{action}{actionDelete}">Supprimer</ButtonDelete>
143
+ {@const formaction = `${action}${actionDelete}`}
144
+ <slot name="delete" {formaction}>
145
+ <ButtonDelete {formaction}>Supprimer</ButtonDelete>
146
+ </slot>
141
147
  {/if}
142
148
  </div>
143
149
  </form>
@@ -33,6 +33,9 @@ declare class __sveltets_Render<Shape extends z.ZodRawShape, ReturnData extends
33
33
  };
34
34
  slots(): {
35
35
  default: {};
36
+ delete: {
37
+ formaction: any;
38
+ };
36
39
  };
37
40
  }
38
41
  export type FormProps<Shape extends z.ZodRawShape, ReturnData extends Record<string, unknown> = FormDataInput<Shape>, Data extends FormDataInput<Shape> = FormDataInput<Shape>> = ReturnType<__sveltets_Render<Shape, ReturnData, Data>['props']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.3.23",
3
+ "version": "0.3.25",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",