fumadocs-ui 12.3.1 → 12.3.3

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,7 +6,7 @@ declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLD
6
6
  /**
7
7
  * @defaultValue info
8
8
  */
9
- type?: "info" | "warn" | "error" | undefined;
9
+ type?: "info" | "warn" | "error";
10
10
  icon?: ReactNode;
11
11
  } & React.RefAttributes<HTMLDivElement>>;
12
12
 
@@ -18,7 +18,7 @@ declare const CodeBlock: React.ForwardRefExoticComponent<HTMLAttributes<HTMLElem
18
18
  * When passed as a string, it assumes the value is the HTML of icon
19
19
  */
20
20
  icon?: ReactNode;
21
- allowCopy?: boolean | undefined;
21
+ allowCopy?: boolean;
22
22
  } & React.RefAttributes<HTMLElement>>;
23
23
 
24
24
  export { CodeBlock, type CodeBlockProps, Pre };
package/dist/i18n.d.ts CHANGED
@@ -5,14 +5,20 @@ export { T as Translations } from './i18n-DSnJuWoW.js';
5
5
  interface I18nProviderProps {
6
6
  /**
7
7
  * Force a locale, by default, it is parsed from pathname
8
+ *
9
+ * **Highly recommended to specify one**
8
10
  */
9
11
  locale?: string;
10
12
  /**
11
13
  * Translations for each language
12
14
  */
13
15
  translations?: Record<string, NamedTranslation>;
16
+ /**
17
+ * Handle changes to the locale, redirect user when not specified.
18
+ */
19
+ onChange?: (v: string) => void;
14
20
  children: ReactNode;
15
21
  }
16
- declare function I18nProvider({ translations, locale: forceLocale, children, }: I18nProviderProps): React.ReactElement;
22
+ declare function I18nProvider({ translations, ...props }: I18nProviderProps): React.ReactElement;
17
23
 
18
24
  export { I18nProvider };
package/dist/i18n.js CHANGED
@@ -11,21 +11,22 @@ import { useRouter, usePathname } from "next/navigation";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
  function I18nProvider({
13
13
  translations = {},
14
- locale: forceLocale,
15
- children
14
+ ...props
16
15
  }) {
17
- const localeIndex = 1;
18
- const router = useRouter();
19
- const pathname = usePathname();
20
16
  const context = useI18n();
21
- const segments = pathname.split("/");
22
- const locale = forceLocale ?? segments[localeIndex];
17
+ const router = useRouter();
18
+ const segments = usePathname().split("/").filter((v) => v.length > 0);
19
+ const locale = props.locale ?? segments[0];
23
20
  const onChange = useCallback(
24
21
  (v) => {
25
- segments[localeIndex] = v;
26
- router.push(segments.join("/"));
22
+ if (segments[0] !== locale) {
23
+ segments.unshift(v);
24
+ } else {
25
+ segments[0] = v;
26
+ }
27
+ router.push(`/${segments.join("/")}`);
27
28
  },
28
- [segments, router]
29
+ [locale, segments, router]
29
30
  );
30
31
  return /* @__PURE__ */ jsx(
31
32
  I18nContext.Provider,
@@ -37,9 +38,9 @@ function I18nProvider({
37
38
  ...context.text,
38
39
  ...translations[locale]
39
40
  },
40
- onChange
41
+ onChange: props.onChange ?? onChange
41
42
  },
42
- children
43
+ children: props.children
43
44
  }
44
45
  );
45
46
  }
@@ -33,7 +33,7 @@ interface Preset {
33
33
  declare const docsUi: {
34
34
  (options: DocsUIOptions): {
35
35
  handler: tailwindcss_types_config.PluginCreator;
36
- config?: Partial<tailwindcss_types_config.Config> | undefined;
36
+ config?: Partial<tailwindcss_types_config.Config>;
37
37
  };
38
38
  __isOptionsFunction: true;
39
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "12.3.1",
3
+ "version": "12.3.3",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -81,28 +81,28 @@
81
81
  "dist/*"
82
82
  ],
83
83
  "dependencies": {
84
- "@radix-ui/react-accordion": "^1.1.2",
85
- "@radix-ui/react-collapsible": "^1.0.3",
86
- "@radix-ui/react-dialog": "^1.0.5",
87
- "@radix-ui/react-direction": "^1.0.1",
88
- "@radix-ui/react-popover": "^1.0.7",
89
- "@radix-ui/react-scroll-area": "^1.0.5",
90
- "@radix-ui/react-tabs": "^1.0.4",
84
+ "@radix-ui/react-accordion": "^1.2.0",
85
+ "@radix-ui/react-collapsible": "^1.1.0",
86
+ "@radix-ui/react-dialog": "^1.1.1",
87
+ "@radix-ui/react-direction": "^1.1.0",
88
+ "@radix-ui/react-popover": "^1.1.1",
89
+ "@radix-ui/react-scroll-area": "^1.1.0",
90
+ "@radix-ui/react-tabs": "^1.1.0",
91
91
  "@tailwindcss/typography": "^0.5.13",
92
92
  "class-variance-authority": "^0.7.0",
93
93
  "cmdk": "^1.0.0",
94
- "lucide-react": "^0.395.0",
94
+ "lucide-react": "^0.399.0",
95
95
  "next-themes": "^0.3.0",
96
- "react-medium-image-zoom": "^5.2.4",
96
+ "react-medium-image-zoom": "^5.2.5",
97
97
  "tailwind-merge": "^2.3.0",
98
- "fumadocs-core": "12.3.1"
98
+ "fumadocs-core": "12.3.3"
99
99
  },
100
100
  "devDependencies": {
101
- "@algolia/client-search": "^4.23.3",
101
+ "@algolia/client-search": "^4.24.0",
102
102
  "@next/eslint-plugin-next": "^14.2.4",
103
103
  "@types/react": "^18.3.3",
104
104
  "@types/react-dom": "^18.3.0",
105
- "algoliasearch": "^4.23.3",
105
+ "algoliasearch": "^4.24.0",
106
106
  "next": "^14.2.4",
107
107
  "postcss": "^8.4.38",
108
108
  "postcss-cli": "^11.0.0",