gantri-components 2.253.1 → 2.254.0

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.
@@ -0,0 +1,34 @@
1
+ import { ComponentType } from 'react';
2
+ /**
3
+ * Formik is an **optional** peer dependency of gantri-components. The Modal
4
+ * component opts in to wrapping its body with `<Form>` when a Formik
5
+ * context exists in the React tree above it — but consumers that don't
6
+ * use Formik should not get a hard import error.
7
+ *
8
+ * We `require('formik')` once at module-load time inside a try/catch:
9
+ *
10
+ * - When formik IS installed, we capture its `FormikContext` and
11
+ * `Form` exports and expose them via `useOptionalFormikContext()` /
12
+ * `OptionalFormikForm`.
13
+ * - When formik is NOT installed, both refs stay `undefined`, the hook
14
+ * always returns `undefined`, and the Modal renders without a form
15
+ * wrapper.
16
+ *
17
+ * `useContext` is called unconditionally on every render so React's
18
+ * rules-of-hooks stay satisfied — when formik isn't installed we fall
19
+ * back to a never-set internal context.
20
+ */
21
+ type FormikContextLike = {
22
+ handleSubmit: (...args: unknown[]) => unknown;
23
+ };
24
+ /**
25
+ * Returns the current Formik context if Modal is rendered inside a
26
+ * `<Formik>` provider; otherwise `undefined`. Safe to call unconditionally.
27
+ */
28
+ export declare const useOptionalFormikContext: () => FormikContextLike | undefined;
29
+ /**
30
+ * The Formik `<Form>` component, or `undefined` if formik isn't installed.
31
+ * Modal renders it conditionally based on `useOptionalFormikContext`.
32
+ */
33
+ export declare const OptionalFormikForm: ComponentType<unknown> | undefined;
34
+ export {};