fuma 2.0.44 → 2.0.45

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.
@@ -6,17 +6,24 @@
6
6
  import { FormControl, type InputProps } from './index.js'
7
7
  import { USE_COERCE_DATE } from '../../utils/constant.js'
8
8
 
9
- type $$Props = InputProps<Date | null | undefined>
9
+ type $$Props = InputProps<Date | null | undefined> & { noTime?: boolean }
10
10
  export let value: Date | null | undefined = undefined
11
11
  export let input: HTMLInputAttributes = {}
12
+ export let noPreserveTime = false
12
13
  $: ({ class: inputClass = '', ...inputProps } = input)
13
14
 
14
15
  const dispatch = createEventDispatcher<{ input: Date | null }>()
15
16
 
16
17
  const handleInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
17
18
  const newValue = currentTarget.valueAsDate
18
- if (newValue === null) value = null
19
- newValue?.setHours(value?.getHours() || 0, value?.getMinutes() || 0, value?.getSeconds() || 0)
19
+ if (noPreserveTime) newValue?.setHours(0, 0, 0, 0)
20
+ else
21
+ newValue?.setHours(
22
+ value?.getHours() || 0,
23
+ value?.getMinutes() || 0,
24
+ value?.getSeconds() || 0,
25
+ 0
26
+ )
20
27
  value = newValue
21
28
  dispatch('input', value)
22
29
  }
@@ -1,4 +1,4 @@
1
- import { type InputProps } from './index.js';
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
3
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
4
  $$bindings?: Bindings;
@@ -12,7 +12,30 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
12
12
  };
13
13
  z_$$bindings?: Bindings;
14
14
  }
15
- declare const InputDate: $$__sveltets_2_IsomorphicComponent<InputProps<Date | null | undefined>, {
15
+ declare const InputDate: $$__sveltets_2_IsomorphicComponent<{
16
+ class?: string;
17
+ classLabel?: string;
18
+ key?: string;
19
+ label?: import("svelte").Snippet | string;
20
+ labelAppend?: import("svelte").Snippet | null;
21
+ error?: string;
22
+ hint?: string;
23
+ prefix?: string | number;
24
+ prefixFor?: string | number;
25
+ enhanceDisabled?: boolean;
26
+ labelPosition?: "top" | "left" | "right";
27
+ children?: import("svelte").Snippet<[{
28
+ key: string;
29
+ }]> | undefined;
30
+ } & {
31
+ input?: HTMLInputAttributes;
32
+ inputElement?: HTMLInputElement;
33
+ classWrapper?: string;
34
+ value?: Date | null | undefined;
35
+ bindWithParams?: boolean;
36
+ } & {
37
+ noTime?: boolean;
38
+ }, {
16
39
  focus: FocusEvent;
17
40
  blur: FocusEvent;
18
41
  input: CustomEvent<Date | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "2.0.44",
3
+ "version": "2.0.45",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",