@mrfylke/contact-form 0.1.21 → 0.1.22
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.
package/lib/ContactFormRoot.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export type ContactFormRootProps = {
|
|
|
30
30
|
* variant is always used.
|
|
31
31
|
*/
|
|
32
32
|
forceTheme?: 'light' | 'dark';
|
|
33
|
+
/**
|
|
34
|
+
* Optional explicit initial dark-mode state, e.g. restored from a cookie.
|
|
35
|
+
* Ignored when forceTheme is set.
|
|
36
|
+
*/
|
|
37
|
+
defaultDarkMode?: boolean;
|
|
33
38
|
/**
|
|
34
39
|
* Optional additional translation overrides that will be merged on top of config.translations.
|
|
35
40
|
* Config translations are required; this allows additional overrides at the root level if needed.
|
|
@@ -43,5 +48,5 @@ export type ContactFormRootProps = {
|
|
|
43
48
|
* providers together. Renders children inside the provider stack so
|
|
44
49
|
* consumers can pass their routes/layout as children.
|
|
45
50
|
*/
|
|
46
|
-
export declare function ContactFormRoot({ config, acceptLanguageHeader, initialLanguage, defaultLanguage, onLanguageChange, forceTheme, translationsOverride, children, }: ContactFormRootProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare function ContactFormRoot({ config, acceptLanguageHeader, initialLanguage, defaultLanguage, onLanguageChange, forceTheme, defaultDarkMode, translationsOverride, children, }: ContactFormRootProps): import("react/jsx-runtime").JSX.Element;
|
|
47
52
|
//# sourceMappingURL=ContactFormRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactFormRoot.d.ts","sourceRoot":"","sources":["../src/ContactFormRoot.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,KAAK,+BAA+B,EACpC,QAAQ,EACT,MAAM,gBAAgB,CAAC;A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AAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,+BAA+B,CAAC;IACvD,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,QAAQ,GACT,EAAE,oBAAoB,2CAyBtB"}
|
package/lib/ContactFormRoot.js
CHANGED
|
@@ -15,13 +15,13 @@ function ThemeSync({ children }) {
|
|
|
15
15
|
* providers together. Renders children inside the provider stack so
|
|
16
16
|
* consumers can pass their routes/layout as children.
|
|
17
17
|
*/
|
|
18
|
-
function ContactFormRoot({ config, acceptLanguageHeader, initialLanguage, defaultLanguage, onLanguageChange, forceTheme, translationsOverride, children, }) {
|
|
18
|
+
function ContactFormRoot({ config, acceptLanguageHeader, initialLanguage, defaultLanguage, onLanguageChange, forceTheme, defaultDarkMode, translationsOverride, children, }) {
|
|
19
19
|
const header = acceptLanguageHeader ?? deriveHeaderFromInitialLanguage(initialLanguage);
|
|
20
20
|
// Merge config translations (required) with optional root-level override (override takes precedence)
|
|
21
21
|
const mergedTranslations = translationsOverride
|
|
22
22
|
? deepMerge(config.translations, translationsOverride)
|
|
23
23
|
: config.translations;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(config_1.ContactFormConfigProvider, { config: config, children: (0, jsx_runtime_1.jsx)(theme_1.ThemeProvider, { forceTheme: forceTheme, children: (0, jsx_runtime_1.jsx)(ThemeSync, { children: (0, jsx_runtime_1.jsx)(translations_1.AppLanguageProvider, { serverAcceptLanguage: header ?? 'no,en;q=0.9', overrides: mergedTranslations, defaultLanguage: defaultLanguage, onLanguageChange: onLanguageChange, children: children }) }) }) }));
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(config_1.ContactFormConfigProvider, { config: config, children: (0, jsx_runtime_1.jsx)(theme_1.ThemeProvider, { forceTheme: forceTheme, defaultDarkMode: defaultDarkMode, children: (0, jsx_runtime_1.jsx)(ThemeSync, { children: (0, jsx_runtime_1.jsx)(translations_1.AppLanguageProvider, { serverAcceptLanguage: header ?? 'no,en;q=0.9', overrides: mergedTranslations, defaultLanguage: defaultLanguage, onLanguageChange: onLanguageChange, children: children }) }) }) }));
|
|
25
25
|
}
|
|
26
26
|
function deriveHeaderFromInitialLanguage(language) {
|
|
27
27
|
if (!language) {
|