@krosoft/react 0.0.421 → 0.0.422

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,2 @@
1
+ export declare const DocumentTitleContext: import("react").Context<string | undefined>;
2
+ //# sourceMappingURL=documentTitle.context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentTitle.context.d.ts","sourceRoot":"","sources":["../../src/contexts/documentTitle.context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,6CAA+C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { createContext as e } from "react";
2
+ // src/contexts/documentTitle.context.ts
3
+ var t = e(void 0);
4
+ export { t as DocumentTitleContext };
@@ -2,4 +2,5 @@ export { PageContext } from "./page.context";
2
2
  export type { PageContextType } from "./page.context";
3
3
  export { SidebarContext } from "./sidebar.context";
4
4
  export type { SidebarContextType } from "./sidebar.context";
5
+ export { DocumentTitleContext } from "./documentTitle.context";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { PageContext as e } from "./page.context.js";
2
2
  import { SidebarContext as t } from "./sidebar.context.js";
3
- export { e as PageContext, t as SidebarContext };
3
+ import { DocumentTitleContext as n } from "./documentTitle.context.js";
4
+ export { n as DocumentTitleContext, e as PageContext, t as SidebarContext };
@@ -1 +1 @@
1
- {"version":3,"file":"useDocumentTitle.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useDocumentTitle.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,IAcvF,CAAC"}
1
+ {"version":3,"file":"useDocumentTitle.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/useDocumentTitle.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,IAiBvF,CAAC"}
@@ -1,18 +1,19 @@
1
- import { useKrosoftTranslation as e } from "../../i18n/useKrosoftTranslation.js";
2
- import { useEffect as t } from "react";
1
+ import { DocumentTitleContext as e } from "../../contexts/documentTitle.context.js";
2
+ import { useKrosoftTranslation as t } from "../../i18n/useKrosoftTranslation.js";
3
+ import { useContext as n, useEffect as r } from "react";
3
4
  // src/hooks/ui/useDocumentTitle.ts
4
- var n = (n, r, i) => {
5
- let { t: a } = e();
6
- t(() => {
7
- let e = a(n), t = document.title, o = r ? `${e} - ${r}` : e, s = i ? `${o} | ${i}` : o;
8
- return document.title = s, () => {
5
+ var i = (i, a, o) => {
6
+ let { t: s } = t(), c = n(e), l = o ?? c;
7
+ r(() => {
8
+ let e = s(i), t = document.title, n = a ? `${e} - ${a}` : e, r = l ? `${n} | ${l}` : n;
9
+ return document.title = r, () => {
9
10
  document.title = t;
10
11
  };
11
12
  }, [
12
- i,
13
- r,
13
+ l,
14
14
  a,
15
- n
15
+ s,
16
+ i
16
17
  ]);
17
18
  };
18
- export { n as useDocumentTitle };
19
+ export { i as useDocumentTitle };
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export interface DocumentTitleProviderProps {
3
+ appTitle: string;
4
+ children: React.ReactNode;
5
+ }
6
+ /** Fournit le nom de l'application ajouté au titre de l'onglet par `useDocumentTitle` (ex : « Factures | MonApp »). */
7
+ export declare const DocumentTitleProvider: ({ appTitle, children }: DocumentTitleProviderProps) => React.JSX.Element;
8
+ //# sourceMappingURL=DocumentTitleProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentTitleProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DocumentTitleProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,uHAAuH;AACvH,eAAO,MAAM,qBAAqB,GAAI,wBAAwB,0BAA0B,KAAG,KAAK,CAAC,GAAG,CAAC,OAEpG,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { DocumentTitleContext as e } from "../contexts/documentTitle.context.js";
2
+ import "react";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ // src/providers/DocumentTitleProvider.tsx
5
+ var n = ({ appTitle: n, children: r }) => /* @__PURE__ */ t(e.Provider, {
6
+ value: n,
7
+ children: r
8
+ });
9
+ export { n as DocumentTitleProvider };
@@ -1,2 +1,4 @@
1
1
  export { SidebarProvider } from "./SidebarProvider";
2
+ export { DocumentTitleProvider } from "./DocumentTitleProvider";
3
+ export type { DocumentTitleProviderProps } from "./DocumentTitleProvider";
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1 +1,3 @@
1
- export { SidebarProvider } from "./SidebarProvider.js";
1
+ import { SidebarProvider as e } from "./SidebarProvider.js";
2
+ import { DocumentTitleProvider as t } from "./DocumentTitleProvider.js";
3
+ export { t as DocumentTitleProvider, e as SidebarProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.421",
3
+ "version": "0.0.422",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "sideEffects": [