@bigbinary/neeto-commons-frontend 2.1.11 → 2.1.13
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/cypress-configs/initializer.js +2 -2
- package/package.json +1 -1
- package/react-utils.cjs.js +4 -1
- package/react-utils.cjs.js.map +1 -1
- package/react-utils.d.ts +26 -2
- package/react-utils.js +4 -1
- package/react-utils.js.map +1 -1
package/react-utils.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { Notice } from "@honeybadger-io/js/dist/server/types/core/types";
|
|
|
4
4
|
import { History } from "history";
|
|
5
5
|
import { StoreApi, UseBoundStore } from "zustand";
|
|
6
6
|
import { UseQueryOptions, UseQueryResult, UseMutationOptions, UseMutationResult } from "react-query";
|
|
7
|
+
import { KeyPrefix, Namespace } from "i18next";
|
|
8
|
+
import { DefaultNamespace } from "react-i18next/TransWithoutContext";
|
|
7
9
|
import { qsOptionsType, QueryParamsType } from "./utils";
|
|
8
10
|
/**
|
|
9
11
|
*
|
|
@@ -1315,13 +1317,35 @@ export function useFetchNeetoApps(options?: UseQueryOptions): ReturnType<typeof
|
|
|
1315
1317
|
*
|
|
1316
1318
|
* // Example usage of withT:
|
|
1317
1319
|
* const ComponentWithTranslation = withT(({ t }) => <div>{t("some.key")}</div>);
|
|
1320
|
+
*
|
|
1321
|
+
* // Example usage of withT with forwarded ref:
|
|
1322
|
+
* const ComponentWithRef = withT(
|
|
1323
|
+
* React.forwardRef(({ t }, ref) => <div ref={ref}>{t("some.key")}</div>),
|
|
1324
|
+
* {
|
|
1325
|
+
* withRef: true,
|
|
1326
|
+
* }
|
|
1327
|
+
* );
|
|
1328
|
+
*
|
|
1329
|
+
* // Example usage of withT with keyPrefix:
|
|
1330
|
+
* const ComponentWithTranslation = withT(
|
|
1331
|
+
* ({ t }) => (
|
|
1332
|
+
* // t function will be called with the key "very.nested.key.some.key"
|
|
1333
|
+
* <div ref={ref}>{t("some.key")}</div>
|
|
1334
|
+
* ),
|
|
1335
|
+
* {
|
|
1336
|
+
* keyPrefix: "very.nested.key",
|
|
1337
|
+
* }
|
|
1338
|
+
* );
|
|
1318
1339
|
* @endexample
|
|
1319
1340
|
*/
|
|
1320
1341
|
export const withT: <Props extends {
|
|
1321
1342
|
[key: string]: any;
|
|
1322
|
-
}>(Component: React.ComponentType<Props & {
|
|
1343
|
+
}, N extends Namespace = DefaultNamespace, TKPrefix extends KeyPrefix<N> = undefined>(Component: React.ComponentType<Props & {
|
|
1323
1344
|
t: TFunction;
|
|
1324
|
-
}
|
|
1345
|
+
}>, options?: {
|
|
1346
|
+
withRef?: boolean;
|
|
1347
|
+
keyPrefix?: TKPrefix;
|
|
1348
|
+
}, ns?: N) => React.ComponentType<Props>;
|
|
1325
1349
|
/**
|
|
1326
1350
|
*
|
|
1327
1351
|
* useMutationWithInvalidation is a wrapper function around the
|
package/react-utils.js
CHANGED
|
@@ -6281,7 +6281,10 @@ var isMetaKeyPressed = function isMetaKeyPressed(event) {
|
|
|
6281
6281
|
return !!(event !== null && event !== void 0 && event.ctrlKey || event !== null && event !== void 0 && event.metaKey);
|
|
6282
6282
|
};
|
|
6283
6283
|
|
|
6284
|
-
var withT =
|
|
6284
|
+
var withT = function withT(Component, options) {
|
|
6285
|
+
var namespace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
6286
|
+
return withTranslation(namespace, options)(Component);
|
|
6287
|
+
};
|
|
6285
6288
|
|
|
6286
6289
|
var withTitle = function withTitle(Component) {
|
|
6287
6290
|
var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|