@krosoft/react 0.0.420 → 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 };
@@ -3,11 +3,13 @@ export interface UseCopyToClipboardOptions {
3
3
  successKey?: string;
4
4
  /** Clé i18n du message d'échec. */
5
5
  errorKey?: string;
6
+ /** Pas de notification de succès : l'appelant affiche son propre retour (bouton « Copiée »). L'échec reste notifié. */
7
+ silentSuccess?: boolean;
6
8
  }
7
9
  export interface UseCopyToClipboardResult {
8
10
  /** Copie le texte et notifie le résultat ; renvoie vrai si la copie a réussi. */
9
11
  copy: (text: string) => Promise<boolean>;
10
12
  }
11
13
  /** Copie un texte dans le presse-papiers et affiche une notification de succès ou d'échec. */
12
- export declare const useCopyToClipboard: ({ successKey, errorKey }?: UseCopyToClipboardOptions) => UseCopyToClipboardResult;
14
+ export declare const useCopyToClipboard: ({ successKey, errorKey, silentSuccess, }?: UseCopyToClipboardOptions) => UseCopyToClipboardResult;
13
15
  //# sourceMappingURL=useCopyToClipboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/behavior/useCopyToClipboard.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,GAAI,2BAA8D,yBAA8B,KAAG,wBAgBjI,CAAC"}
1
+ {"version":3,"file":"useCopyToClipboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/behavior/useCopyToClipboard.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uHAAuH;IACvH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,GAAI,2CAIhC,yBAA8B,KAAG,wBAkBnC,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { useNotifications as e } from "../ui/useNotifications.js";
2
2
  import { useKrosoftTranslation as t } from "../../i18n/useKrosoftTranslation.js";
3
3
  // src/hooks/behavior/useCopyToClipboard.ts
4
- var n = ({ successKey: n = "copy.copied", errorKey: r = "copy.copyFailed" } = {}) => {
5
- let { t: i } = t(), { showSuccess: a, showError: o } = e();
4
+ var n = ({ successKey: n = "copy.copied", errorKey: r = "copy.copyFailed", silentSuccess: i = !1 } = {}) => {
5
+ let { t: a } = t(), { showSuccess: o, showError: s } = e();
6
6
  return { copy: async (e) => {
7
7
  try {
8
- return await navigator.clipboard.writeText(e), a(i(n)), !0;
8
+ return await navigator.clipboard.writeText(e), i || o(a(n)), !0;
9
9
  } catch (e) {
10
- return o(i(r), void 0, e instanceof Error ? e : null), !1;
10
+ return s(a(r), void 0, e instanceof Error ? e : null), !1;
11
11
  }
12
12
  } };
13
13
  };
@@ -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.420",
3
+ "version": "0.0.422",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "sideEffects": [