@douglasneuroinformatics/libui 3.8.4 → 3.8.6

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.
@@ -45,10 +45,10 @@ var useNotificationsStore = create((set) => ({
45
45
  // src/hooks/useDownload/useDownload.ts
46
46
  function useDownload() {
47
47
  const notifications = useNotificationsStore();
48
- const [state, setState] = useState(null);
48
+ const [downloads, setDownloads] = useState([]);
49
49
  useEffect(() => {
50
- if (state) {
51
- const { blobType, data, filename } = state;
50
+ if (downloads.length) {
51
+ const { blobType, data, filename, id } = downloads.at(-1);
52
52
  const anchor = document.createElement("a");
53
53
  document.body.appendChild(anchor);
54
54
  const blob = new Blob([data], { type: blobType });
@@ -58,16 +58,19 @@ function useDownload() {
58
58
  anchor.click();
59
59
  URL.revokeObjectURL(url);
60
60
  anchor.remove();
61
- setState(null);
61
+ setDownloads((prevDownloads) => prevDownloads.filter((item) => item.id !== id));
62
62
  }
63
- }, [state]);
63
+ }, [downloads]);
64
64
  return async (filename, _data, options) => {
65
65
  try {
66
66
  const data = typeof _data === "function" ? await _data() : _data;
67
67
  if (typeof data !== "string" && !options?.blobType) {
68
68
  throw new Error("argument 'blobType' must be defined when download is called with a Blob object");
69
69
  }
70
- setState({ blobType: options?.blobType ?? "text/plain", data, filename });
70
+ setDownloads((prevDownloads) => [
71
+ ...prevDownloads,
72
+ { blobType: options?.blobType ?? "text/plain", data, filename, id: crypto.randomUUID() }
73
+ ]);
71
74
  } catch (error) {
72
75
  const message = error instanceof Error ? error.message : "An unknown error occurred";
73
76
  notifications.addNotification({
@@ -364,4 +367,4 @@ export {
364
367
  useTranslation,
365
368
  useWindowSize
366
369
  };
367
- //# sourceMappingURL=chunk-EORB7HTH.js.map
370
+ //# sourceMappingURL=chunk-GLOKPJGE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useChart/useChart.ts","../src/context/ChartContext.tsx","../src/hooks/useDownload/useDownload.ts","../src/hooks/useNotificationsStore/useNotificationsStore.ts","../src/hooks/useEventCallback/useEventCallback.ts","../src/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts","../src/hooks/useEventListener/useEventListener.ts","../src/hooks/useInterval/useInterval.ts","../src/hooks/useMediaQuery/useMediaQuery.ts","../src/hooks/useOnClickOutside/useOnClickOutside.ts","../src/hooks/useStorage/useStorage.ts","../src/hooks/useStorage/useLocalStorage.ts","../src/hooks/useStorage/useSessionStorage.ts","../src/hooks/useTheme/useTheme.ts","../src/hooks/useTranslation/useTranslation.ts","../src/hooks/useWindowSize/useWindowSize.ts"],"sourcesContent":["import { useContext } from 'react';\n\nimport { ChartContext } from '@/context/ChartContext';\n\nexport function useChart() {\n const context = useContext(ChartContext);\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n return context;\n}\n","import { createContext } from 'react';\n\nimport type { ChartConfig } from '@/components';\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\nexport const ChartContext = createContext<ChartContextProps | null>(null);\n","import { useEffect, useState } from 'react';\n\nimport type { Promisable } from 'type-fest';\n\nimport { useNotificationsStore } from '../useNotificationsStore';\n\ntype DownloadTextOptions = {\n blobType: 'text/csv' | 'text/plain';\n};\n\ntype DownloadBlobOptions = {\n blobType: 'application/zip' | 'image/jpeg' | 'image/png' | 'image/webp';\n};\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ninterface DownloadFunction {\n (filename: string, data: Blob, options: DownloadBlobOptions): Promise<void>;\n (filename: string, data: () => Promisable<Blob>, options: DownloadBlobOptions): Promise<void>;\n (filename: string, data: string, options?: DownloadTextOptions): Promise<void>;\n (filename: string, data: () => Promisable<string>, options?: DownloadTextOptions): Promise<void>;\n}\n\ntype Downloadable = {\n blobType: string;\n data: Blob | string;\n filename: string;\n id: string;\n};\n\n/**\n * Used to trigger downloads of arbitrary data to the client\n * @returns A function to invoke the download\n */\nexport function useDownload(): DownloadFunction {\n const notifications = useNotificationsStore();\n const [downloads, setDownloads] = useState<Downloadable[]>([]);\n\n useEffect(() => {\n if (downloads.length) {\n const { blobType, data, filename, id } = downloads.at(-1)!;\n const anchor = document.createElement('a');\n document.body.appendChild(anchor);\n const blob = new Blob([data], { type: blobType });\n const url = URL.createObjectURL(blob);\n anchor.href = url;\n anchor.download = filename;\n anchor.click();\n URL.revokeObjectURL(url);\n anchor.remove();\n setDownloads((prevDownloads) => prevDownloads.filter((item) => item.id !== id));\n }\n }, [downloads]);\n\n return async (filename, _data, options) => {\n try {\n const data = typeof _data === 'function' ? await _data() : _data;\n if (typeof data !== 'string' && !options?.blobType) {\n throw new Error(\"argument 'blobType' must be defined when download is called with a Blob object\");\n }\n setDownloads((prevDownloads) => [\n ...prevDownloads,\n { blobType: options?.blobType ?? 'text/plain', data, filename, id: crypto.randomUUID() }\n ]);\n } catch (error) {\n const message = error instanceof Error ? error.message : 'An unknown error occurred';\n notifications.addNotification({\n message,\n title: 'Error',\n type: 'error'\n });\n }\n };\n}\n","import { create } from 'zustand';\n\nexport type NotificationInterface = {\n id: number;\n message?: string;\n title?: string;\n type: 'error' | 'info' | 'success' | 'warning';\n variant?: 'critical' | 'standard';\n};\n\nexport type NotificationsStore = {\n addNotification: (notification: Omit<NotificationInterface, 'id'>) => void;\n dismissNotification: (id: number) => void;\n notifications: NotificationInterface[];\n};\n\nexport const useNotificationsStore = create<NotificationsStore>((set) => ({\n addNotification: (notification) => {\n set((state) => ({\n notifications: [...state.notifications, { id: Date.now(), ...notification }]\n }));\n },\n dismissNotification: (id) => {\n set((state) => ({\n notifications: state.notifications.filter((notification) => notification.id !== id)\n }));\n },\n notifications: []\n}));\n","import { useCallback, useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';\n\nexport function useEventCallback<Args extends unknown[], R>(fn: (...args: Args) => R) {\n const ref = useRef<typeof fn>(() => {\n throw new Error('Cannot call an event handler while rendering.');\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((...args: Args) => ref.current(...args), [ref]);\n}\n","import { useEffect, useLayoutEffect } from 'react';\n\nimport { isBrowser } from '@/utils';\n\nexport const useIsomorphicLayoutEffect = isBrowser() ? useLayoutEffect : useEffect;\n","import { type RefObject, useEffect, useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';\n\n// MediaQueryList Event based useEventListener interface\nfunction useEventListener<K extends keyof MediaQueryListEventMap>(\n eventName: K,\n handler: (event: MediaQueryListEventMap[K]) => void,\n element: RefObject<MediaQueryList>,\n options?: AddEventListenerOptions | boolean\n): void;\n\n// Window Event based useEventListener interface\nfunction useEventListener<K extends keyof WindowEventMap>(\n eventName: K,\n handler: (event: WindowEventMap[K]) => void,\n element?: undefined,\n options?: AddEventListenerOptions | boolean\n): void;\n\n// Element Event based useEventListener interface\nfunction useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = HTMLDivElement>(\n eventName: K,\n handler: (event: HTMLElementEventMap[K]) => void,\n element: RefObject<T>,\n options?: AddEventListenerOptions | boolean\n): void;\n\n// Document Event based useEventListener interface\nfunction useEventListener<K extends keyof DocumentEventMap>(\n eventName: K,\n handler: (event: DocumentEventMap[K]) => void,\n element: RefObject<Document>,\n options?: AddEventListenerOptions | boolean\n): void;\n\nfunction useEventListener<\n KW extends keyof WindowEventMap,\n KH extends keyof HTMLElementEventMap,\n KM extends keyof MediaQueryListEventMap,\n T extends HTMLElement | MediaQueryList | void = void\n>(\n eventName: KH | KM | KW,\n handler: (event: Event | HTMLElementEventMap[KH] | MediaQueryListEventMap[KM] | WindowEventMap[KW]) => void,\n element?: RefObject<T>,\n options?: AddEventListenerOptions | boolean\n) {\n // Create a ref that stores handler\n const savedHandler = useRef(handler);\n\n useIsomorphicLayoutEffect(() => {\n savedHandler.current = handler;\n }, [handler]);\n\n useEffect(() => {\n // Define the listening target\n const targetElement: T | Window = element?.current ?? window;\n\n if (!(targetElement && targetElement.addEventListener)) return;\n\n // Create event listener that calls handler function stored in ref\n const listener: typeof handler = (event) => savedHandler.current(event);\n\n targetElement.addEventListener(eventName, listener, options);\n\n // Remove event listener on cleanup\n return () => {\n targetElement.removeEventListener(eventName, listener, options);\n };\n }, [eventName, element, options]);\n}\n\nexport { useEventListener };\n","import { useEffect, useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';\n\nexport function useInterval(callback: () => void, delay: null | number) {\n const savedCallback = useRef(callback);\n\n // Remember the latest callback if it changes.\n useIsomorphicLayoutEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n useEffect(() => {\n // Don't schedule if no delay is specified.\n // Note: 0 is a valid value for delay.\n if (!delay && delay !== 0) {\n return;\n }\n\n const id = setInterval(() => savedCallback.current(), delay);\n\n return () => clearInterval(id);\n }, [delay]);\n}\n","import { useEffect, useState } from 'react';\n\nimport { isBrowser } from '@/utils';\n\n/**\n * Get the result of an arbitrary CSS media query\n *\n * @param query - the CSS media query\n * @returns a boolean indicating the result of the query\n * @example\n * // true if the viewport is at least 768px wide\n * const matches = useMediaQuery('(min-width: 768px)')\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (query: string): boolean => {\n // Prevents SSR issues\n if (isBrowser()) {\n return window.matchMedia(query).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n function handleChange() {\n setMatches(getMatches(query));\n }\n\n useEffect(() => {\n const matchMedia = window.matchMedia(query);\n\n // Triggered at the first client-side load and if query changes\n handleChange();\n\n matchMedia.addEventListener('change', handleChange);\n\n return () => {\n matchMedia.removeEventListener('change', handleChange);\n };\n }, [query]);\n\n return matches;\n}\n","import { type RefObject } from 'react';\n\nimport { useEventListener } from '../useEventListener';\n\ntype Handler = (event: MouseEvent) => void;\n\nexport function useOnClickOutside<T extends HTMLElement = HTMLElement>(\n ref: RefObject<T>,\n handler: Handler,\n mouseEvent: 'mousedown' | 'mouseup' = 'mousedown'\n): void {\n useEventListener(mouseEvent, (event) => {\n const el = ref.current;\n\n // Do nothing if clicking ref's element or descendent elements\n if (!el || el.contains(event.target as Node)) {\n return;\n }\n\n handler(event);\n });\n}\n","import { useCallback, useEffect, useState } from 'react';\nimport type { Dispatch, SetStateAction } from 'react';\n\nimport { isBrowser } from '@/utils';\n\nimport { useEventCallback } from '../useEventCallback';\nimport { useEventListener } from '../useEventListener';\n\ntype StorageName = 'localStorage' | 'sessionStorage';\n\ntype StorageEventMap = {\n [K in StorageName]: CustomEvent;\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-object-type\n interface WindowEventMap extends StorageEventMap {}\n}\n\n/**\n * Represents the options for customizing the behavior of serialization and deserialization.\n * @template T - The type of the state to be stored in storage.\n */\ntype UseStorageOptions<T> = {\n /** A function to deserialize the stored value. */\n deserializer?: (value: string) => T;\n /**\n * If `true` (default), the hook will initialize reading the storage. In SSR, you should set it to `false`, returning the initial value initially.\n * @default true\n */\n initializeWithValue?: boolean;\n /** A function to serialize the value before storing it. */\n serializer?: (value: T) => string;\n};\n\n/**\n * Custom hook that uses local or session storage to persist state across page reloads.\n * @template T - The type of the state to be stored in storage.\n * @param key - The key under which the value will be stored in storage.\n * @param initialValue - The initial value of the state or a function that returns the initial value.\n * @param options - Options for customizing the behavior of serialization and deserialization (optional).\n * @returns A tuple containing the stored value and a function to set the value.\n * @public\n * @example\n * ```tsx\n * const [count, setCount] = useStorage('count', 0);\n * // Access the `count` value and the `setCount` function to update it.\n * ```\n */\nexport function useStorage<T>(\n key: string,\n initialValue: (() => T) | T,\n storageName: StorageName,\n options: UseStorageOptions<T> = {}\n): [T, Dispatch<SetStateAction<T>>] {\n const { initializeWithValue = true } = options;\n const storage = window[storageName];\n\n const serializer = useCallback<(value: T) => string>(\n (value) => {\n if (options.serializer) {\n return options.serializer(value);\n }\n return JSON.stringify(value);\n },\n [options]\n );\n\n const deserializer = useCallback<(value: string) => T>(\n (value) => {\n if (options.deserializer) {\n return options.deserializer(value);\n } else if (value === 'undefined') {\n return undefined as unknown as T;\n }\n const defaultValue = initialValue instanceof Function ? initialValue() : initialValue;\n let parsed: unknown;\n try {\n parsed = JSON.parse(value);\n } catch (err) {\n console.error(`Error parsing JSON: ${(err as Error).message}`);\n return defaultValue;\n }\n return parsed as T;\n },\n [options, initialValue]\n );\n\n const readValue = useCallback((): T => {\n const initialValueToUse = initialValue instanceof Function ? initialValue() : initialValue;\n if (!isBrowser()) {\n return initialValueToUse;\n }\n const raw = storage.getItem(key);\n return raw ? deserializer(raw) : initialValueToUse;\n }, [initialValue, key, deserializer]);\n\n const [storedValue, setStoredValue] = useState(() => {\n if (initializeWithValue) {\n return readValue();\n }\n return initialValue instanceof Function ? initialValue() : initialValue;\n });\n\n const setValue: Dispatch<SetStateAction<T>> = useEventCallback((value) => {\n if (!isBrowser()) {\n console.warn(`Tried setting storage key “${key}” even though environment is not a client`);\n }\n try {\n const newValue = value instanceof Function ? value(readValue()) : value;\n storage.setItem(key, serializer(newValue));\n setStoredValue(newValue);\n window.dispatchEvent(new StorageEvent(storageName, { key }));\n } catch (error) {\n console.warn(`Error setting storage key “${key}”:`, error);\n }\n });\n\n useEffect(() => {\n setStoredValue(readValue());\n }, [key]);\n\n const handleStorageChange = useCallback(\n (event: CustomEvent | StorageEvent) => {\n if ((event as StorageEvent).key && (event as StorageEvent).key !== key) {\n return;\n }\n setStoredValue(readValue());\n },\n [key, readValue]\n );\n\n // this only works for other documents, not the current one\n useEventListener('storage', handleStorageChange);\n\n useEventListener(storageName, handleStorageChange);\n\n return [storedValue, setValue];\n}\n\nexport type { StorageName, UseStorageOptions };\n","import type { Dispatch, SetStateAction } from 'react';\n\nimport { useStorage, type UseStorageOptions } from './useStorage';\n\n/** Custom hook that uses local storage to persist state across page reloads */\nexport function useLocalStorage<T>(\n key: string,\n initialValue: (() => T) | T,\n options: UseStorageOptions<T> = {}\n): [T, Dispatch<SetStateAction<T>>] {\n return useStorage(key, initialValue, 'localStorage', options);\n}\n","import type { Dispatch, SetStateAction } from 'react';\n\nimport { useStorage, type UseStorageOptions } from './useStorage';\n\n/** Custom hook that uses session storage to persist state across page reloads */\nexport function useSessionStorage<T>(\n key: string,\n initialValue: (() => T) | T,\n options: UseStorageOptions<T> = {}\n): [T, Dispatch<SetStateAction<T>>] {\n return useStorage(key, initialValue, 'sessionStorage', options);\n}\n","import { useEffect, useState } from 'react';\n\n// this is required since our storybook manager plugin cannot use vite aliases\nimport { isBrowser } from '../../utils';\n\ntype Theme = 'dark' | 'light';\n\ntype UpdateTheme = (theme: Theme) => void;\n\n/** @private */\nconst DEFAULT_THEME: Theme = 'light';\n\n/** @private */\nconst THEME_ATTRIBUTE = 'data-mode';\n\n/** @private */\nconst THEME_KEY = 'theme';\n\n/** @private */\nconst SYS_DARK_MEDIA_QUERY = '(prefers-color-scheme: dark)';\n\n/**\n * Returns the current theme and a function to update the current theme\n *\n * The reason the implementation of this hook is rather convoluted is for\n * cases where the theme is updated outside this hook\n */\nfunction useTheme(): readonly [Theme, UpdateTheme] {\n // Initial theme value is based on the value saved in local storage or the system theme\n const [theme, setTheme] = useState<Theme>(() => {\n if (!isBrowser()) {\n return DEFAULT_THEME;\n }\n const savedTheme = window.localStorage.getItem(THEME_KEY);\n let initialTheme: Theme;\n if (savedTheme === 'dark' || savedTheme === 'light') {\n initialTheme = savedTheme;\n } else {\n initialTheme = window.matchMedia(SYS_DARK_MEDIA_QUERY).matches ? 'dark' : 'light';\n }\n document.documentElement.setAttribute(THEME_ATTRIBUTE, initialTheme);\n return initialTheme;\n });\n\n useEffect(() => {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.attributeName === THEME_ATTRIBUTE) {\n const updatedTheme = (mutation.target as HTMLHtmlElement).getAttribute(THEME_ATTRIBUTE);\n if (updatedTheme === 'light' || updatedTheme === 'dark') {\n window.localStorage.setItem(THEME_KEY, updatedTheme);\n setTheme(updatedTheme);\n } else {\n console.error(`Unexpected value for 'data-mode' attribute: ${updatedTheme}`);\n }\n }\n });\n });\n observer.observe(document.documentElement, {\n attributes: true\n });\n return () => observer.disconnect();\n }, []);\n\n // When the user wants to change the theme\n const updateTheme = (theme: Theme) => {\n document.documentElement.setAttribute(THEME_ATTRIBUTE, theme);\n };\n\n return [theme, updateTheme] as const;\n}\n\nexport { DEFAULT_THEME, SYS_DARK_MEDIA_QUERY, type Theme, THEME_ATTRIBUTE, THEME_KEY, useTheme };\n","import { useCallback } from 'react';\n\nimport { useStore } from 'zustand';\n\nimport { translationStore } from '@/i18n';\nimport type { TranslateFunction, TranslationNamespace } from '@/i18n';\nimport { getTranslation } from '@/i18n/internal';\n\nexport function useTranslation<TNamespace extends TranslationNamespace | undefined = undefined>(\n namespace?: TNamespace\n) {\n const changeLanguage = useStore(translationStore, (store) => store.changeLanguage);\n const fallbackLanguage = useStore(translationStore, (store) => store.fallbackLanguage);\n const resolvedLanguage = useStore(translationStore, (store) => store.resolvedLanguage);\n const translations = useStore(translationStore, (store) => {\n if (namespace) {\n return store.translations[namespace];\n }\n return store.translations;\n });\n\n const t: TranslateFunction<TNamespace> = useCallback(\n (target, ...args) => {\n return getTranslation(target, { fallbackLanguage, resolvedLanguage, translations }, ...args);\n },\n [fallbackLanguage, resolvedLanguage, translations]\n );\n\n return { changeLanguage, resolvedLanguage, t };\n}\n","import { useState } from 'react';\n\nimport { useEventListener } from '../useEventListener';\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect';\n\nexport type WindowSize = {\n height: number;\n width: number;\n};\n\nexport function useWindowSize(): WindowSize {\n const [windowSize, setWindowSize] = useState<WindowSize>({\n height: 0,\n width: 0\n });\n\n const handleSize = () => {\n setWindowSize({\n height: window.innerHeight,\n width: window.innerWidth\n });\n };\n\n useEventListener('resize', handleSize);\n\n // Set size at the first client-side load\n useIsomorphicLayoutEffect(() => {\n handleSize();\n }, []);\n\n return windowSize;\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,kBAAkB;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BAAkB,CAAC,UAAU,MAAM,gBAAgB;AACrF,QAAM,eAAe,SAAS,kBAAkB,CAAC,UAAU;AACzD,QAAI,WAAW;AACb,aAAO,MAAM,aAAa,SAAS;AAAA,IACrC;AACA,WAAO,MAAM;AAAA,EACf,CAAC;AAED,QAAM,IAAmCC;AAAA,IACvC,CAAC,WAAW,SAAS;AACnB,aAAO,eAAe,QAAQ,EAAE,kBAAkB,kBAAkB,aAAa,GAAG,GAAG,IAAI;AAAA,IAC7F;AAAA,IACA,CAAC,kBAAkB,kBAAkB,YAAY;AAAA,EACnD;AAEA,SAAO,EAAE,gBAAgB,kBAAkB,EAAE;AAC/C;;;AC7BA,SAAS,YAAAC,iBAAgB;AAUlB,SAAS,gBAA4B;AAC1C,QAAM,CAAC,YAAY,aAAa,IAAIC,UAAqB;AAAA,IACvD,QAAQ;AAAA,IACR,OAAO;AAAA,EACT,CAAC;AAED,QAAM,aAAa,MAAM;AACvB,kBAAc;AAAA,MACZ,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,IAChB,CAAC;AAAA,EACH;AAEA,mBAAiB,UAAU,UAAU;AAGrC,4BAA0B,MAAM;AAC9B,eAAW;AAAA,EACb,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;","names":["useEffect","useEffect","useEffect","useRef","useRef","useEffect","useEffect","useRef","useRef","useEffect","useEffect","useState","query","useState","useEffect","useCallback","useEffect","useState","useCallback","useState","useEffect","useEffect","useState","useState","useEffect","theme","useCallback","useCallback","useState","useState"]}
@@ -1239,9 +1239,9 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
1239
1239
  content: FormContent<TData>;
1240
1240
  fieldsFooter?: React.ReactNode;
1241
1241
  id?: string;
1242
- initialValues?: PartialNullableFormDataType<TData>;
1243
- onError?: (error: z.ZodError<TData>) => void;
1244
- onSubmit: (data: TData) => Promisable<void>;
1242
+ initialValues?: PartialNullableFormDataType<NoInfer<TData>>;
1243
+ onError?: (error: z.ZodError<NoInfer<TData>>) => void;
1244
+ onSubmit: (data: NoInfer<TData>) => Promisable<void>;
1245
1245
  preventResetValuesOnReset?: boolean;
1246
1246
  readOnly?: boolean;
1247
1247
  resetBtn?: boolean;
@@ -5,7 +5,7 @@ import {
5
5
  useNotificationsStore,
6
6
  useTheme,
7
7
  useTranslation
8
- } from "./chunk-EORB7HTH.js";
8
+ } from "./chunk-GLOKPJGE.js";
9
9
  import "./chunk-M5H3G5VE.js";
10
10
  import {
11
11
  cn
@@ -1514,8 +1514,8 @@ var ContextMenu = Object.assign(Root7.bind(null), {
1514
1514
 
1515
1515
  // src/components/CopyButton/CopyButton.tsx
1516
1516
  import { useState as useState2 } from "react";
1517
- import { AnimatePresence, motion } from "framer-motion";
1518
1517
  import { ClipboardCheckIcon, ClipboardListIcon } from "lucide-react";
1518
+ import { AnimatePresence, motion } from "motion/react";
1519
1519
  import { match } from "ts-pattern";
1520
1520
  import { jsx as jsx71 } from "react/jsx-runtime";
1521
1521
  var CopyButton = ({
@@ -1556,12 +1556,12 @@ var CopyButton = ({
1556
1556
  // src/components/DatePicker/DatePicker.tsx
1557
1557
  import { useReducer, useState as useState3 } from "react";
1558
1558
  import * as React17 from "react";
1559
- import { AnimatePresence as AnimatePresence3, motion as motion3 } from "framer-motion";
1559
+ import { AnimatePresence as AnimatePresence3, motion as motion3 } from "motion/react";
1560
1560
 
1561
1561
  // src/components/DatePicker/Calendar.tsx
1562
1562
  import { forwardRef as forwardRef59 } from "react";
1563
- import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
1564
1563
  import { range as range2 } from "lodash-es";
1564
+ import { AnimatePresence as AnimatePresence2, motion as motion2 } from "motion/react";
1565
1565
  import { jsx as jsx72, jsxs as jsxs19 } from "react/jsx-runtime";
1566
1566
  var CALENDAR_ANIMATION_DURATION = 0.2;
1567
1567
  var Calendar = forwardRef59(function Calendar2(props, ref) {
@@ -2976,8 +2976,8 @@ var StringFieldInput = ({
2976
2976
 
2977
2977
  // src/components/Form/StringField/StringFieldPassword.tsx
2978
2978
  import { useEffect as useEffect7, useState as useState6 } from "react";
2979
- import { motion as motion4 } from "framer-motion";
2980
2979
  import { EyeIcon, EyeOffIcon } from "lucide-react";
2980
+ import { motion as motion4 } from "motion/react";
2981
2981
  import { jsx as jsx125, jsxs as jsxs42 } from "react/jsx-runtime";
2982
2982
  var StringFieldPassword = ({
2983
2983
  calculateStrength,
@@ -4022,8 +4022,8 @@ var MenuBar = Object.assign(MenuBarRoot, {
4022
4022
  });
4023
4023
 
4024
4024
  // src/components/NotificationHub/NotificationHub.tsx
4025
- import { AnimatePresence as AnimatePresence4, motion as motion5 } from "framer-motion";
4026
4025
  import { XIcon as XIcon2 } from "lucide-react";
4026
+ import { AnimatePresence as AnimatePresence4, motion as motion5 } from "motion/react";
4027
4027
 
4028
4028
  // src/components/NotificationHub/NotificationIcon.tsx
4029
4029
  import { jsx as jsx152 } from "react/jsx-runtime";
@@ -4516,7 +4516,7 @@ var SpinnerIcon = ({ className, ...props }) => /* @__PURE__ */ jsx175(
4516
4516
 
4517
4517
  // src/components/StatisticCard/StatisticCard.tsx
4518
4518
  import { useEffect as useEffect11 } from "react";
4519
- import { motion as motion6, useSpring, useTransform } from "framer-motion";
4519
+ import { motion as motion6, useSpring, useTransform } from "motion/react";
4520
4520
  import { jsx as jsx176, jsxs as jsxs60 } from "react/jsx-runtime";
4521
4521
  var StatisticCard = ({ className, icon, label, value, ...props }) => {
4522
4522
  const spring = useSpring(0, { bounce: 0 });