@bigbinary/neeto-commons-frontend 4.13.92 → 4.13.94-beta.1

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.
Files changed (94) hide show
  1. package/README.md +1 -0
  2. package/configs/esbuild/index.js +4 -0
  3. package/configs/esbuild/plugins/packageTranslations.js +16 -0
  4. package/configs/esbuild/plugins/preval.js +16 -6
  5. package/configs/esbuild/plugins/reactGiphy.js +1 -0
  6. package/configs/scripts/buildTranslationImports.js +21 -0
  7. package/configs/scripts/getEnglishTranslation.js +11 -0
  8. package/configs/utils/packageTranslations.js +90 -0
  9. package/configs/vite/index.js +5 -0
  10. package/configs/vite/plugins/packageTranslations.js +14 -0
  11. package/configs/vite/plugins/preval.js +17 -11
  12. package/dist/cjs/initializers/i18n.js +120 -183
  13. package/dist/cjs/initializers/i18n.js.map +1 -1
  14. package/dist/cjs/initializers/index.js +43 -19
  15. package/dist/cjs/initializers/index.js.map +1 -1
  16. package/dist/cjs/react-utils/PrivateRoute/PrivateRoute.js +17 -13
  17. package/dist/cjs/react-utils/PrivateRoute/PrivateRoute.js.map +1 -1
  18. package/dist/cjs/react-utils/PrivateRoute/constants.js +8 -0
  19. package/dist/cjs/react-utils/PrivateRoute/constants.js.map +1 -0
  20. package/dist/cjs/react-utils/PrivateRoute/index.js +2 -0
  21. package/dist/cjs/react-utils/PrivateRoute/index.js.map +1 -1
  22. package/dist/cjs/react-utils/PrivateRoute/utils.js +16 -0
  23. package/dist/cjs/react-utils/PrivateRoute/utils.js.map +1 -0
  24. package/dist/cjs/react-utils/index.js +5 -0
  25. package/dist/cjs/react-utils/index.js.map +1 -1
  26. package/dist/cjs/react-utils/mount/mount.js +68 -69
  27. package/dist/cjs/react-utils/mount/mount.js.map +1 -1
  28. package/dist/cjs/react-utils/usePrefersReducedMotion/constants.js +6 -0
  29. package/dist/cjs/react-utils/usePrefersReducedMotion/constants.js.map +1 -0
  30. package/dist/cjs/react-utils/usePrefersReducedMotion/index.js +12 -0
  31. package/dist/cjs/react-utils/usePrefersReducedMotion/index.js.map +1 -0
  32. package/dist/cjs/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js +46 -0
  33. package/dist/cjs/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js.map +1 -0
  34. package/dist/initializers/i18n.js +120 -183
  35. package/dist/initializers/i18n.js.map +1 -1
  36. package/dist/initializers/index.js +43 -19
  37. package/dist/initializers/index.js.map +1 -1
  38. package/dist/react-utils/PrivateRoute/PrivateRoute.js +17 -13
  39. package/dist/react-utils/PrivateRoute/PrivateRoute.js.map +1 -1
  40. package/dist/react-utils/PrivateRoute/constants.js +5 -0
  41. package/dist/react-utils/PrivateRoute/constants.js.map +1 -0
  42. package/dist/react-utils/PrivateRoute/index.js +2 -0
  43. package/dist/react-utils/PrivateRoute/index.js.map +1 -1
  44. package/dist/react-utils/PrivateRoute/utils.js +14 -0
  45. package/dist/react-utils/PrivateRoute/utils.js.map +1 -0
  46. package/dist/react-utils/index.js +4 -0
  47. package/dist/react-utils/index.js.map +1 -1
  48. package/dist/react-utils/mount/mount.js +68 -69
  49. package/dist/react-utils/mount/mount.js.map +1 -1
  50. package/dist/react-utils/usePrefersReducedMotion/constants.js +4 -0
  51. package/dist/react-utils/usePrefersReducedMotion/constants.js.map +1 -0
  52. package/dist/react-utils/usePrefersReducedMotion/index.js +6 -0
  53. package/dist/react-utils/usePrefersReducedMotion/index.js.map +1 -0
  54. package/dist/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js +44 -0
  55. package/dist/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js.map +1 -0
  56. package/initializers.d.ts +1 -1
  57. package/package.json +13 -7
  58. package/react-utils.d.ts +69 -3
  59. package/src/translations/ar.json +111 -0
  60. package/src/translations/bg.json +111 -0
  61. package/src/translations/ca.json +111 -0
  62. package/src/translations/cs.json +111 -0
  63. package/src/translations/da.json +111 -0
  64. package/src/translations/de.json +111 -0
  65. package/src/translations/en.json +111 -0
  66. package/src/translations/es-MX.json +111 -0
  67. package/src/translations/es.json +111 -0
  68. package/src/translations/et.json +111 -0
  69. package/src/translations/fi.json +111 -0
  70. package/src/translations/fil.json +111 -0
  71. package/src/translations/fr.json +111 -0
  72. package/src/translations/he.json +111 -0
  73. package/src/translations/hi.json +111 -0
  74. package/src/translations/hr.json +111 -0
  75. package/src/translations/id.json +111 -0
  76. package/src/translations/it.json +111 -0
  77. package/src/translations/ja.json +111 -0
  78. package/src/translations/ko.json +111 -0
  79. package/src/translations/nl.json +111 -0
  80. package/src/translations/pl.json +111 -0
  81. package/src/translations/pt-BR.json +111 -0
  82. package/src/translations/pt.json +111 -0
  83. package/src/translations/ro.json +111 -0
  84. package/src/translations/ru.json +111 -0
  85. package/src/translations/sk.json +111 -0
  86. package/src/translations/sl.json +111 -0
  87. package/src/translations/sv.json +111 -0
  88. package/src/translations/th.json +111 -0
  89. package/src/translations/tr.json +111 -0
  90. package/src/translations/uk.json +111 -0
  91. package/src/translations/vi.json +111 -0
  92. package/src/translations/zh-CN.json +111 -0
  93. package/src/translations/zh-TW.json +111 -0
  94. package/configs/scripts/getPkgTranslations.js +0 -45
@@ -3,10 +3,12 @@ import { _ as _objectWithoutProperties } from '../../objectWithoutProperties-DN7
3
3
  import ErrorPage from '@bigbinary/neeto-molecules/ErrorPage';
4
4
  import { includes, __ } from 'ramda';
5
5
  import { Route, Redirect } from 'react-router-dom';
6
+ import { getHomeUrl } from './utils.js';
6
7
  import { jsx } from 'react/jsx-runtime';
7
8
  import '../../typeof-D-UKOauR.js';
9
+ import './constants.js';
8
10
 
9
- var _excluded = ["condition", "redirectRoute", "errorPage", "permissions"];
11
+ var _excluded = ["condition", "redirectRoute", "errorPage", "permissions", "homeUrl"];
10
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
14
  var PrivateRoute = function PrivateRoute(_ref) {
@@ -18,29 +20,31 @@ var PrivateRoute = function PrivateRoute(_ref) {
18
20
  errorPage = _ref$errorPage === void 0 ? undefined : _ref$errorPage,
19
21
  _ref$permissions = _ref.permissions,
20
22
  permissions = _ref$permissions === void 0 ? undefined : _ref$permissions,
23
+ _ref$homeUrl = _ref.homeUrl,
24
+ homeUrl = _ref$homeUrl === void 0 ? undefined : _ref$homeUrl,
21
25
  props = _objectWithoutProperties(_ref, _excluded);
26
+ var renderErrorPage = function renderErrorPage(errorPage, homeUrl, path) {
27
+ return errorPage || /*#__PURE__*/jsx(ErrorPage, {
28
+ homeUrl: homeUrl || getHomeUrl(path),
29
+ status: 403
30
+ });
31
+ };
22
32
  if (condition) {
23
33
  if (permissions) {
24
34
  return globalProps.permissions.some(includes(__, permissions)) ? /*#__PURE__*/jsx(Route, _objectSpread({}, props)) : /*#__PURE__*/jsx(Route, _objectSpread(_objectSpread({}, props), {}, {
25
35
  component: function component() {
26
- return errorPage || /*#__PURE__*/jsx(ErrorPage, {
27
- status: 403
28
- });
36
+ return renderErrorPage(errorPage, homeUrl, props.path);
29
37
  }
30
38
  }));
31
39
  }
32
40
  return /*#__PURE__*/jsx(Route, _objectSpread({}, props));
33
41
  }
34
- if (redirectRoute) {
35
- return /*#__PURE__*/jsx(Redirect, {
36
- to: {
37
- pathname: redirectRoute
38
- }
39
- });
40
- }
41
- return errorPage || /*#__PURE__*/jsx(ErrorPage, {
42
- status: 403
42
+ if (redirectRoute) return /*#__PURE__*/jsx(Redirect, {
43
+ to: {
44
+ pathname: redirectRoute
45
+ }
43
46
  });
47
+ return renderErrorPage(errorPage, homeUrl, props.path);
44
48
  };
45
49
 
46
50
  export { PrivateRoute as default };
@@ -1 +1 @@
1
- {"version":3,"file":"PrivateRoute.js","sources":["../../../src/react-utils/PrivateRoute/PrivateRoute.jsx"],"sourcesContent":["import ErrorPage from \"neetomolecules/ErrorPage\";\nimport { __, includes } from \"ramda\";\nimport { Redirect, Route } from \"react-router-dom\";\n\nconst PrivateRoute = ({\n condition = globalProps.authenticated,\n redirectRoute = undefined,\n errorPage = undefined,\n permissions = undefined,\n ...props\n}) => {\n if (condition) {\n if (permissions) {\n return globalProps.permissions.some(includes(__, permissions)) ? (\n <Route {...props} />\n ) : (\n <Route\n {...props}\n component={() => errorPage || <ErrorPage status={403} />}\n />\n );\n }\n\n return <Route {...props} />;\n }\n\n if (redirectRoute) {\n return <Redirect to={{ pathname: redirectRoute }} />;\n }\n\n return errorPage || <ErrorPage status={403} />;\n};\n\nexport default PrivateRoute;\n"],"names":["PrivateRoute","_ref","_ref$condition","condition","globalProps","authenticated","_ref$redirectRoute","redirectRoute","undefined","_ref$errorPage","errorPage","_ref$permissions","permissions","props","_objectWithoutProperties","_excluded","some","includes","__","_jsx","Route","_objectSpread","component","ErrorPage","status","Redirect","to","pathname"],"mappings":";;;;;;;;;;;AAIA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAMZ;AAAA,EAAA,IAAAC,cAAA,GAAAD,IAAA,CALJE,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAGE,WAAW,CAACC,aAAa,GAAAH,cAAA;IAAAI,kBAAA,GAAAL,IAAA,CACrCM,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAGE,MAAAA,GAAAA,SAAS,GAAAF,kBAAA;IAAAG,cAAA,GAAAR,IAAA,CACzBS,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAGD,MAAAA,GAAAA,SAAS,GAAAC,cAAA;IAAAE,gBAAA,GAAAV,IAAA,CACrBW,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAGH,MAAAA,GAAAA,SAAS,GAAAG,gBAAA;AACpBE,IAAAA,KAAK,GAAAC,wBAAA,CAAAb,IAAA,EAAAc,SAAA,CAAA;AAER,EAAA,IAAIZ,SAAS,EAAE;AACb,IAAA,IAAIS,WAAW,EAAE;AACf,MAAA,OAAOR,WAAW,CAACQ,WAAW,CAACI,IAAI,CAACC,QAAQ,CAACC,EAAE,EAAEN,WAAW,CAAC,CAAC,gBAC5DO,GAAA,CAACC,KAAK,EAAAC,aAAA,CAAA,EAAA,EAAKR,KAAK,CAAG,CAAC,gBAEpBM,GAAA,CAACC,KAAK,EAAAC,aAAA,CAAAA,aAAA,KACAR,KAAK,CAAA,EAAA,EAAA,EAAA;QACTS,SAAS,EAAE,SAAXA,SAASA,GAAA;AAAA,UAAA,OAAQZ,SAAS,iBAAIS,GAAA,CAACI,SAAS,EAAA;AAACC,YAAAA,MAAM,EAAE;AAAI,WAAE,CAAC;AAAA;AAAC,OAAA,CAC1D,CACF;AACH;IAEA,oBAAOL,GAAA,CAACC,KAAK,EAAAC,aAAA,CAAKR,EAAAA,EAAAA,KAAK,CAAG,CAAC;AAC7B;AAEA,EAAA,IAAIN,aAAa,EAAE;IACjB,oBAAOY,GAAA,CAACM,QAAQ,EAAA;AAACC,MAAAA,EAAE,EAAE;AAAEC,QAAAA,QAAQ,EAAEpB;AAAc;AAAE,KAAE,CAAC;AACtD;AAEA,EAAA,OAAOG,SAAS,iBAAIS,GAAA,CAACI,SAAS,EAAA;AAACC,IAAAA,MAAM,EAAE;AAAI,GAAE,CAAC;AAChD;;;;"}
1
+ {"version":3,"file":"PrivateRoute.js","sources":["../../../src/react-utils/PrivateRoute/PrivateRoute.jsx"],"sourcesContent":["import ErrorPage from \"neetomolecules/ErrorPage\";\nimport { __, includes } from \"ramda\";\nimport { Redirect, Route } from \"react-router-dom\";\n\nimport { getHomeUrl } from \"./utils\";\n\nconst PrivateRoute = ({\n condition = globalProps.authenticated,\n redirectRoute = undefined,\n errorPage = undefined,\n permissions = undefined,\n homeUrl = undefined,\n ...props\n}) => {\n const renderErrorPage = (errorPage, homeUrl, path) =>\n errorPage || (\n <ErrorPage homeUrl={homeUrl || getHomeUrl(path)} status={403} />\n );\n\n if (condition) {\n if (permissions) {\n return globalProps.permissions.some(includes(__, permissions)) ? (\n <Route {...props} />\n ) : (\n <Route\n {...props}\n component={() => renderErrorPage(errorPage, homeUrl, props.path)}\n />\n );\n }\n\n return <Route {...props} />;\n }\n\n if (redirectRoute) return <Redirect to={{ pathname: redirectRoute }} />;\n\n return renderErrorPage(errorPage, homeUrl, props.path);\n};\n\nexport default PrivateRoute;\n"],"names":["PrivateRoute","_ref","_ref$condition","condition","globalProps","authenticated","_ref$redirectRoute","redirectRoute","undefined","_ref$errorPage","errorPage","_ref$permissions","permissions","_ref$homeUrl","homeUrl","props","_objectWithoutProperties","_excluded","renderErrorPage","path","_jsx","ErrorPage","getHomeUrl","status","some","includes","__","Route","_objectSpread","component","Redirect","to","pathname"],"mappings":";;;;;;;;;;;;;AAMA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAOZ;AAAA,EAAA,IAAAC,cAAA,GAAAD,IAAA,CANJE,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAGE,WAAW,CAACC,aAAa,GAAAH,cAAA;IAAAI,kBAAA,GAAAL,IAAA,CACrCM,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAGE,MAAAA,GAAAA,SAAS,GAAAF,kBAAA;IAAAG,cAAA,GAAAR,IAAA,CACzBS,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAGD,MAAAA,GAAAA,SAAS,GAAAC,cAAA;IAAAE,gBAAA,GAAAV,IAAA,CACrBW,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KA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AS,EAAEI,OAAO,EAAEC,KAAK,CAACI,IAAI,CAAC;AACxD;;;;"}
@@ -0,0 +1,5 @@
1
+ var HOME_PATH = "/";
2
+ var ADMIN_PATH = "/admin";
3
+
4
+ export { ADMIN_PATH, HOME_PATH };
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../src/react-utils/PrivateRoute/constants.js"],"sourcesContent":["export const HOME_PATH = \"/\";\nexport const ADMIN_PATH = \"/admin\";\n"],"names":["HOME_PATH","ADMIN_PATH"],"mappings":"AAAO,IAAMA,SAAS,GAAG;AAClB,IAAMC,UAAU,GAAG;;;;"}
@@ -5,5 +5,7 @@ import '../../objectWithoutProperties-DN7d1SzH.js';
5
5
  import '@bigbinary/neeto-molecules/ErrorPage';
6
6
  import 'ramda';
7
7
  import 'react-router-dom';
8
+ import './utils.js';
9
+ import './constants.js';
8
10
  import 'react/jsx-runtime';
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import { HOME_PATH, ADMIN_PATH } from './constants.js';
2
+
3
+ var getHomeUrl = function getHomeUrl(path) {
4
+ if (!path) return HOME_PATH;
5
+ if (Array.isArray(path)) {
6
+ return path.some(function (p) {
7
+ return p === null || p === void 0 ? void 0 : p.includes(ADMIN_PATH);
8
+ }) ? ADMIN_PATH : HOME_PATH;
9
+ }
10
+ return path.includes(ADMIN_PATH) ? ADMIN_PATH : HOME_PATH;
11
+ };
12
+
13
+ export { getHomeUrl };
14
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/react-utils/PrivateRoute/utils.js"],"sourcesContent":["import { ADMIN_PATH, HOME_PATH } from \"./constants\";\n\nexport const getHomeUrl = path => {\n if (!path) return HOME_PATH;\n\n if (Array.isArray(path)) {\n return path.some(p => p?.includes(ADMIN_PATH)) ? ADMIN_PATH : HOME_PATH;\n }\n\n return path.includes(ADMIN_PATH) ? ADMIN_PATH : HOME_PATH;\n};\n"],"names":["getHomeUrl","path","HOME_PATH","Array","isArray","some","p","includes","ADMIN_PATH"],"mappings":";;IAEaA,UAAU,GAAG,SAAbA,UAAUA,CAAGC,IAAI,EAAI;AAChC,EAAA,IAAI,CAACA,IAAI,EAAE,OAAOC,SAAS;AAE3B,EAAA,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;AACvB,IAAA,OAAOA,IAAI,CAACI,IAAI,CAAC,UAAAC,CAAC,EAAA;MAAA,OAAIA,CAAC,aAADA,CAAC,KAAA,MAAA,GAAA,MAAA,GAADA,CAAC,CAAEC,QAAQ,CAACC,UAAU,CAAC;KAAC,CAAA,GAAGA,UAAU,GAAGN,SAAS;AACzE;EAEA,OAAOD,IAAI,CAACM,QAAQ,CAACC,UAAU,CAAC,GAAGA,UAAU,GAAGN,SAAS;AAC3D;;;;"}
@@ -13,6 +13,7 @@ export { default as useMutationWithInvalidation } from './useMutationWithInvalid
13
13
  export { default as useOnClickOutside } from './useOnClickOutside/useOnClickOutside.js';
14
14
  export { default as usePersistedQuery } from './usePersistedQuery/usePersistedQuery.js';
15
15
  export { default as usePrevious } from './usePrevious/usePrevious.js';
16
+ export { default as usePrefersReducedMotion } from './usePrefersReducedMotion/usePrefersReducedMotion.js';
16
17
  export { default as useQueryParams } from './useQueryParams/useQueryParams.js';
17
18
  export { useNavigationCheckpoints, default as useRegisterNavigationCheckpoint, useRemoveNavigationCheckpoint } from './useRegisterNavigationCheckpoint/useRegisterNavigationCheckpoint.js';
18
19
  export { default as useStateWithDependency } from './useStateWithDependency/useStateWithDependency.js';
@@ -47,6 +48,8 @@ import './HoneybadgerErrorBoundary/utils.js';
47
48
  import '../objectWithoutProperties-DN7d1SzH.js';
48
49
  import '@bigbinary/neeto-molecules/ErrorPage';
49
50
  import 'react-router-dom';
51
+ import './PrivateRoute/utils.js';
52
+ import './PrivateRoute/constants.js';
50
53
  import 'react-helmet';
51
54
  import '../slicedToArray-DmsZvA_9.js';
52
55
  import '../unsupportedIterableToArray-Dqz8Y8_I.js';
@@ -75,6 +78,7 @@ import '../lodash-M8VRFvKw.js';
75
78
  import '@bigbinary/neeto-time-zones';
76
79
  import 'ua-parser-js';
77
80
  import '@tanstack/react-query';
81
+ import './usePrefersReducedMotion/constants.js';
78
82
  import './useBreakpoints/utils.js';
79
83
  import './useColumnConfig/useConfigApi.js';
80
84
  import './useColumnConfig/api.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -8,76 +8,75 @@ import '../../_commonjsHelpers-BFTU3MAI.js';
8
8
 
9
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- function mount(components) {
12
- var run = function run() {
13
- var mountPoints = document.querySelectorAll("[data-react-class]");
14
- Array.from(mountPoints).forEach(/*#__PURE__*/function () {
15
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(element) {
16
- var _element$dataset;
17
- var _ref2, reactClass, reactProps, importFn, props, module, Component, root;
18
- return _regeneratorRuntime.wrap(function _callee$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- if (!(((_element$dataset = element.dataset) === null || _element$dataset === void 0 ? void 0 : _element$dataset.mounted) === "true")) {
22
- _context.next = 2;
23
- break;
24
- }
25
- return _context.abrupt("return");
26
- case 2:
27
- _ref2 = element.dataset || {}, reactClass = _ref2.reactClass, reactProps = _ref2.reactProps;
28
- if (reactClass) {
29
- _context.next = 5;
30
- break;
31
- }
32
- return _context.abrupt("return");
33
- case 5:
34
- importFn = components[reactClass];
35
- if (importFn) {
36
- _context.next = 9;
37
- break;
38
- }
39
- console.warn("WARNING: No component found for:", reactClass, components);
40
- return _context.abrupt("return");
41
- case 9:
42
- props = {};
43
- if (reactProps) {
44
- try {
45
- props = JSON.parse(reactProps);
46
- } catch (_unused) {
47
- console.error("Invalid JSON in data-react-props:", reactProps);
48
- }
49
- }
50
- _context.prev = 11;
51
- _context.next = 14;
52
- return _retryImport(importFn);
53
- case 14:
54
- module = _context.sent;
55
- Component = module["default"] || module;
56
- root = ReactDOM.createRoot(element);
57
- root.render(/*#__PURE__*/jsx(Component, _objectSpread({}, props)));
58
- if (element.dataset) element.dataset.mounted = "true";
59
- _context.next = 24;
60
- break;
61
- case 21:
62
- _context.prev = 21;
63
- _context.t0 = _context["catch"](11);
64
- console.error("Failed to load component \"".concat(reactClass, "\""), _context.t0);
65
- case 24:
66
- case "end":
67
- return _context.stop();
68
- }
69
- }, _callee, null, [[11, 21]]);
70
- }));
71
- return function (_x) {
72
- return _ref.apply(this, arguments);
73
- };
74
- }());
75
- };
76
- if (document.readyState === "loading") {
77
- document.addEventListener("DOMContentLoaded", run);
78
- } else {
79
- run();
11
+ var jsonParse = function jsonParse(value) {
12
+ if (typeof value !== "string") return {};
13
+ try {
14
+ return JSON.parse(value);
15
+ } catch (_unused) {
16
+ return {};
80
17
  }
18
+ };
19
+ function mount(_x) {
20
+ return _mount.apply(this, arguments);
21
+ }
22
+ function _mount() {
23
+ _mount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(componentMap) {
24
+ var _element$dataset;
25
+ var element, _ref, reactClass, reactProps, importFn, props, module, Component, root;
26
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
27
+ while (1) switch (_context.prev = _context.next) {
28
+ case 0:
29
+ element = document.querySelector("[data-react-class]");
30
+ if (element) {
31
+ _context.next = 3;
32
+ break;
33
+ }
34
+ return _context.abrupt("return");
35
+ case 3:
36
+ if (!(((_element$dataset = element.dataset) === null || _element$dataset === void 0 ? void 0 : _element$dataset.mounted) === "true")) {
37
+ _context.next = 5;
38
+ break;
39
+ }
40
+ return _context.abrupt("return");
41
+ case 5:
42
+ _ref = element.dataset || {}, reactClass = _ref.reactClass, reactProps = _ref.reactProps;
43
+ if (reactClass) {
44
+ _context.next = 8;
45
+ break;
46
+ }
47
+ return _context.abrupt("return");
48
+ case 8:
49
+ importFn = componentMap[reactClass];
50
+ if (importFn) {
51
+ _context.next = 12;
52
+ break;
53
+ }
54
+ console.warn("WARNING: No component found for:", reactClass, componentMap);
55
+ return _context.abrupt("return");
56
+ case 12:
57
+ props = jsonParse(reactProps);
58
+ _context.prev = 13;
59
+ _context.next = 16;
60
+ return _retryImport(importFn);
61
+ case 16:
62
+ module = _context.sent;
63
+ Component = module["default"] || module;
64
+ root = ReactDOM.createRoot(element);
65
+ root.render(/*#__PURE__*/jsx(Component, _objectSpread({}, props)));
66
+ if (element.dataset) element.dataset.mounted = "true";
67
+ _context.next = 26;
68
+ break;
69
+ case 23:
70
+ _context.prev = 23;
71
+ _context.t0 = _context["catch"](13);
72
+ console.error("Failed to load component \"".concat(reactClass, "\""), _context.t0);
73
+ case 26:
74
+ case "end":
75
+ return _context.stop();
76
+ }
77
+ }, _callee, null, [[13, 23]]);
78
+ }));
79
+ return _mount.apply(this, arguments);
81
80
  }
82
81
 
83
82
  export { mount as default };
@@ -1 +1 @@
1
- {"version":3,"file":"mount.js","sources":["../../../src/react-utils/mount/mount.jsx"],"sourcesContent":["/* eslint-disable no-console */\nimport ReactDOM from \"react-dom/client\";\nimport retryImport from \"utils/retryImport\";\n\nexport default function mount(components) {\n const run = () => {\n const mountPoints = document.querySelectorAll(\"[data-react-class]\");\n\n Array.from(mountPoints).forEach(async element => {\n if (element.dataset?.mounted === \"true\") return;\n\n const { reactClass, reactProps } = element.dataset || {};\n\n if (!reactClass) return;\n\n const importFn = components[reactClass];\n\n if (!importFn) {\n console.warn(\n \"WARNING: No component found for:\",\n reactClass,\n components\n );\n\n return;\n }\n\n let props = {};\n if (reactProps) {\n try {\n props = JSON.parse(reactProps);\n } catch {\n console.error(\"Invalid JSON in data-react-props:\", reactProps);\n }\n }\n\n try {\n const module = await retryImport(importFn);\n const Component = module.default || module;\n\n const root = ReactDOM.createRoot(element);\n root.render(<Component {...props} />);\n\n if (element.dataset) element.dataset.mounted = \"true\";\n } catch (error) {\n console.error(`Failed to load component \"${reactClass}\"`, error);\n }\n });\n };\n\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", run);\n } else {\n run();\n }\n}\n"],"names":["mount","components","run","mountPoints","document","querySelectorAll","Array","from","forEach","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","element","_element$dataset","_ref2","reactClass","reactProps","importFn","props","module","Component","root","wrap","_callee$","_context","prev","next","dataset","mounted","abrupt","console","warn","JSON","parse","_unused","error","retryImport","sent","ReactDOM","createRoot","render","_jsx","_objectSpread","t0","concat","stop","_x","apply","arguments","readyState","addEventListener"],"mappings":";;;;;;;;;;AAIe,SAASA,KAAKA,CAACC,UAAU,EAAE;AACxC,EAAA,IAAM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A,CAAAmB,EAAA,GAAAnB,QAAA,CAAA,OAAA,CAAA,CAAA,EAAA,CAAA;cAEtDM,OAAO,CAACK,KAAK,CAAA,6BAAA,CAAAS,MAAA,CAA8B7B,UAAU,EAAAS,IAAAA,CAAAA,EAAAA,QAAA,CAAAmB,EAAU,CAAC;AAAC,YAAA,KAAA,EAAA;AAAA,YAAA,KAAA,KAAA;cAAA,OAAAnB,QAAA,CAAAqB,IAAA,EAAA;AAAA;AAAA,SAAA,EAAAlC,OAAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,CAAA;OAEpE,CAAA,CAAA;AAAA,MAAA,OAAA,UAAAmC,EAAA,EAAA;AAAA,QAAA,OAAAvC,IAAA,CAAAwC,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA;AAAA,OAAA;KAAC,EAAA,CAAA;GACH;AAED,EAAA,IAAI9C,QAAQ,CAAC+C,UAAU,KAAK,SAAS,EAAE;AACrC/C,IAAAA,QAAQ,CAACgD,gBAAgB,CAAC,kBAAkB,EAAElD,GAAG,CAAC;AACpD,GAAC,MAAM;AACLA,IAAAA,GAAG,EAAE;AACP;AACF;;;;"}
1
+ {"version":3,"file":"mount.js","sources":["../../../src/react-utils/mount/mount.jsx"],"sourcesContent":["/* eslint-disable no-console */\nimport ReactDOM from \"react-dom/client\";\nimport retryImport from \"utils/retryImport\";\n\nconst jsonParse = value => {\n if (typeof value !== \"string\") return {};\n\n try {\n return JSON.parse(value);\n } catch {\n return {};\n }\n};\n\nexport default async function mount(componentMap) {\n const element = document.querySelector(\"[data-react-class]\");\n if (!element) return;\n\n if (element.dataset?.mounted === \"true\") return;\n\n const { reactClass, reactProps } = element.dataset || {};\n if (!reactClass) return;\n\n const importFn = componentMap[reactClass];\n\n if (!importFn) {\n console.warn(\"WARNING: No component found for:\", reactClass, componentMap);\n\n return;\n }\n\n const props = jsonParse(reactProps);\n\n try {\n const module = await retryImport(importFn);\n const Component = module.default || module;\n\n const root = ReactDOM.createRoot(element);\n root.render(<Component {...props} />);\n\n if (element.dataset) element.dataset.mounted = \"true\";\n } catch (error) {\n console.error(`Failed to load component \"${reactClass}\"`, error);\n }\n}\n"],"names":["jsonParse","value","JSON","parse","_unused","mount","_x","_mount","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","componentMap","_element$dataset","element","_ref","reactClass","reactProps","importFn","props","module","Component","root","wrap","_callee$","_context","prev","next","document","querySelector","abrupt","dataset","mounted","console","warn","retryImport","sent","ReactDOM","createRoot","render","_jsx","_objectSpread","t0","error","concat","stop"],"mappings":";;;;;;;;;;AAIA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAGC,KAAK,EAAI;AACzB,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,EAAE;EAExC,IAAI;AACF,IAAA,OAAOC,IAAI,CAACC,KAAK,CAACF,KAAK,CAAC;GACzB,CAAC,OAAAG,OAAA,EAAM;AACN,IAAA,OAAO,EAAE;AACX;AACF,CAAC;AAE6BC,SAAAA,KAAKA,CAAAC,EAAA,EAAA;AAAA,EAAA,OAAAC,MAAA,CAAAC,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA;AAAA;AA8BlC,SAAAF,MAAA,GAAA;EAAAA,MAAA,GAAAG,iBAAA,cAAAC,mBAAA,CAAAC,IAAA,CA9Bc,SAAAC,OAAAA,CAAqBC,YAAY,EAAA;AAAA,IAAA,IAAAC,gBAAA;AAAA,IAAA,IAAAC,OAAA,EAAAC,IAAA,EAAAC,UAAA,EAAAC,UAAA,EAAAC,QAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,SAAA,EAAAC,IAAA;AAAA,IAAA,OAAAb,mBAAA,CAAAc,IAAA,CAAA,SAAAC,SAAAC,QAAA,EAAA;AAAA,MAAA,OAAA,CAAA,EAAA,QAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;AAAA,QAAA,KAAA,CAAA;AACxCb,UAAAA,O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@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../src/react-utils/usePrefersReducedMotion/constants.js"],"sourcesContent":["export const QUERY = \"(prefers-reduced-motion: no-preference)\";\n"],"names":["QUERY"],"mappings":"AAAO,IAAMA,KAAK,GAAG;;;;"}
@@ -0,0 +1,6 @@
1
+ export { default } from './usePrefersReducedMotion.js';
2
+ import '../../slicedToArray-DmsZvA_9.js';
3
+ import '../../unsupportedIterableToArray-Dqz8Y8_I.js';
4
+ import 'react';
5
+ import './constants.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,44 @@
1
+ import { _ as _slicedToArray } from '../../slicedToArray-DmsZvA_9.js';
2
+ import { useState, useEffect } from 'react';
3
+ import { QUERY } from './constants.js';
4
+ import '../../unsupportedIterableToArray-Dqz8Y8_I.js';
5
+
6
+ var isRenderingOnServer = typeof window === "undefined";
7
+ var getInitialState = function getInitialState() {
8
+ return (
9
+ // For our initial server render, we won't know if the user
10
+ // prefers reduced motion, but it doesn't matter. This value
11
+ // will be overwritten on the client, before any animations
12
+ // occur.
13
+ isRenderingOnServer ? true : !window.matchMedia(QUERY).matches
14
+ );
15
+ };
16
+ var usePrefersReducedMotion = function usePrefersReducedMotion() {
17
+ var _useState = useState(getInitialState),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ prefersReducedMotion = _useState2[0],
20
+ setPrefersReducedMotion = _useState2[1];
21
+ useEffect(function () {
22
+ if (isRenderingOnServer) return undefined;
23
+ var mediaQueryList = window.matchMedia(QUERY);
24
+ var listener = function listener(event) {
25
+ setPrefersReducedMotion(!event.matches);
26
+ };
27
+ if (mediaQueryList.addEventListener) {
28
+ mediaQueryList.addEventListener("change", listener);
29
+ } else {
30
+ mediaQueryList.addListener(listener);
31
+ }
32
+ return function () {
33
+ if (mediaQueryList.removeEventListener) {
34
+ mediaQueryList.removeEventListener("change", listener);
35
+ } else {
36
+ mediaQueryList.removeListener(listener);
37
+ }
38
+ };
39
+ }, []);
40
+ return prefersReducedMotion;
41
+ };
42
+
43
+ export { usePrefersReducedMotion as default };
44
+ //# sourceMappingURL=usePrefersReducedMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefersReducedMotion.js","sources":["../../../src/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js"],"sourcesContent":["import { useState, useEffect } from \"react\";\n\nimport { QUERY } from \"./constants\";\n\nconst isRenderingOnServer = typeof window === \"undefined\";\n\nconst getInitialState = () =>\n // For our initial server render, we won't know if the user\n // prefers reduced motion, but it doesn't matter. This value\n // will be overwritten on the client, before any animations\n // occur.\n isRenderingOnServer ? true : !window.matchMedia(QUERY).matches;\n\nconst usePrefersReducedMotion = () => {\n const [prefersReducedMotion, setPrefersReducedMotion] =\n useState(getInitialState);\n\n useEffect(() => {\n if (isRenderingOnServer) return undefined;\n\n const mediaQueryList = window.matchMedia(QUERY);\n\n const listener = event => {\n setPrefersReducedMotion(!event.matches);\n };\n\n if (mediaQueryList.addEventListener) {\n mediaQueryList.addEventListener(\"change\", listener);\n } else {\n mediaQueryList.addListener(listener);\n }\n\n return () => {\n if (mediaQueryList.removeEventListener) {\n mediaQueryList.removeEventListener(\"change\", listener);\n } else {\n mediaQueryList.removeListener(listener);\n }\n };\n }, []);\n\n return prefersReducedMotion;\n};\n\nexport default usePrefersReducedMotion;\n"],"names":["isRenderingOnServer","window","getInitialState","matchMedia","QUERY","matches","usePrefersReducedMotion","_useState","useState","_useState2","_slicedToArray","prefersReducedMotion","setPrefersReducedMotion","useEffect","undefined","mediaQueryList","listener","event","addEventListener","addListener","removeEventListener","removeListener"],"mappings":";;;;;AAIA,IAAMA,mBAAmB,GAAG,OAAOC,MAAM,KAAK,WAAW;AAEzD,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,GAAA;AAAA,EAAA;AACnB;AACA;AACA;AACA;IACAF,mBAAmB,GAAG,IAAI,GAAG,CAACC,MAAM,CAACE,UAAU,CAACC,KAAK,CAAC,CAACC;AAAO;AAAA,CAAA;AAEhE,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,GAAS;AACpC,EAAA,IAAAC,SAAA,GACEC,QAAQ,CAACN,eAAe,CAAC;IAAAO,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AADpBI,IAAAA,oBAAoB,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,uBAAuB,GAAAH,UAAA,CAAA,CAAA,CAAA;AAGpDI,EAAAA,SAAS,CAAC,YAAM;IACd,IAAIb,mBAAmB,EAAE,OAAOc,SAAS;AAEzC,IAAA,IAAMC,cAAc,GAAGd,MAAM,CAACE,UAAU,CAACC,KAAK,CAAC;AAE/C,IAAA,IAAMY,QAAQ,GAAG,SAAXA,QAAQA,CAAGC,KAAK,EAAI;AACxBL,MAAAA,uBAAuB,CAAC,CAACK,KAAK,CAACZ,OAAO,CAAC;KACxC;IAED,IAAIU,cAAc,CAACG,gBAAgB,EAAE;AACnCH,MAAAA,cAAc,CAACG,gBAAgB,CAAC,QAAQ,EAAEF,QAAQ,CAAC;AACrD,KAAC,MAAM;AACLD,MAAAA,cAAc,CAACI,WAAW,CAACH,QAAQ,CAAC;AACtC;AAEA,IAAA,OAAO,YAAM;MACX,IAAID,cAAc,CAACK,mBAAmB,EAAE;AACtCL,QAAAA,cAAc,CAACK,mBAAmB,CAAC,QAAQ,EAAEJ,QAAQ,CAAC;AACxD,OAAC,MAAM;AACLD,QAAAA,cAAc,CAACM,cAAc,CAACL,QAAQ,CAAC;AACzC;KACD;GACF,EAAE,EAAE,CAAC;AAEN,EAAA,OAAOL,oBAAoB;AAC7B;;;;"}
package/initializers.d.ts CHANGED
@@ -65,7 +65,7 @@ type TaxonomiesType = {
65
65
  plural: string;
66
66
  };
67
67
  };
68
- export default function initializeApplication(configurations: Configurations): void;
68
+ export default function initializeApplication(configurations?: Configurations): void;
69
69
  export const globalProps: GlobalPropsType;
70
70
  export const taxonomies: TaxonomiesType;
71
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "4.13.92",
3
+ "version": "4.13.94-beta.1",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -67,7 +67,8 @@
67
67
  "files": [
68
68
  "dist",
69
69
  "configs",
70
- "*.d.ts"
70
+ "*.d.ts",
71
+ "src/translations"
71
72
  ],
72
73
  "devDependencies": {
73
74
  "@babel/cli": "^7.23.0",
@@ -83,9 +84,10 @@
83
84
  "@babel/runtime": "7.26.10",
84
85
  "@babel/types": "^7.20.7",
85
86
  "@bigbinary/babel-preset-neeto": "1.0.8",
86
- "@bigbinary/eslint-plugin-neeto": "^1.6.2",
87
+ "@bigbinary/eslint-plugin-neeto": "1.8.0",
87
88
  "@bigbinary/neeto-audit-frontend": "^2.3.1",
88
89
  "@bigbinary/neeto-cist": "1.0.11",
90
+ "@bigbinary/neeto-commons-frontend": "4.4.6",
89
91
  "@bigbinary/neeto-editor": "1.38.1",
90
92
  "@bigbinary/neeto-hotkeys": "^1.0.7",
91
93
  "@bigbinary/neeto-icons": "1.20.5",
@@ -108,6 +110,7 @@
108
110
  "@rollup/plugin-replace": "5.0.4",
109
111
  "@svgr/rollup": "8.1.0",
110
112
  "@tailwindcss/container-queries": "^0.1.1",
113
+ "@tailwindcss/postcss": "^4.1.18",
111
114
  "@tanstack/react-query": "5.59.20",
112
115
  "@tanstack/react-query-devtools": "5.59.20",
113
116
  "@testing-library/jest-dom": "5.16.2",
@@ -165,6 +168,7 @@
165
168
  "husky": "7.0.4",
166
169
  "i18next": "22.5.1",
167
170
  "i18next-browser-languagedetector": "^7.1.0",
171
+ "i18next-resources-to-backend": "^1.2.1",
168
172
  "immer": "^10.0.2",
169
173
  "jest": "29.7.0",
170
174
  "jest-environment-jsdom": "29.7.0",
@@ -179,7 +183,7 @@
179
183
  "postcss-loader": "^7.0.1",
180
184
  "postcss-preset-env": "7.8.2",
181
185
  "prettier": "3",
182
- "prettier-plugin-tailwindcss": "0.6.14",
186
+ "prettier-plugin-tailwindcss": "^0.7.2",
183
187
  "qs": "6.13.0",
184
188
  "ramda": "0.29.1",
185
189
  "react": "18.2.0",
@@ -199,7 +203,7 @@
199
203
  "rollup-plugin-styles": "4.0.0",
200
204
  "sass": "1.62.0",
201
205
  "sass-loader": "^13.0.2",
202
- "tailwindcss": "^3.4.1",
206
+ "tailwindcss": "^4.1.18",
203
207
  "ua-parser-js": "^2.0.3",
204
208
  "unified": "11.0.0",
205
209
  "util": "^0.12.5",
@@ -210,8 +214,9 @@
210
214
  },
211
215
  "peerDependencies": {
212
216
  "@bigbinary/babel-preset-neeto": "1.0.8",
213
- "@bigbinary/eslint-plugin-neeto": "^1.6.2",
217
+ "@bigbinary/eslint-plugin-neeto": "1.8.0",
214
218
  "@bigbinary/neeto-cist": "1.0.11",
219
+ "@bigbinary/neeto-commons-frontend": "4.4.6",
215
220
  "@bigbinary/neeto-editor": "1.38.1",
216
221
  "@bigbinary/neeto-hotkeys": "^1.0.7",
217
222
  "@bigbinary/neeto-icons": "1.20.5",
@@ -224,6 +229,7 @@
224
229
  "@rails/actioncable": "7.2.100",
225
230
  "@svgr/rollup": "8.1.0",
226
231
  "@tailwindcss/container-queries": "^0.1.1",
232
+ "@tailwindcss/postcss": "^4.1.18",
227
233
  "@tanstack/react-query": "5.59.20",
228
234
  "@tanstack/react-query-devtools": "5.59.20",
229
235
  "@tippyjs/react": "4.2.6",
@@ -261,7 +267,7 @@
261
267
  "react-toastify": "8.0.2",
262
268
  "sass": "1.62.0",
263
269
  "shakapacker": "^6.5.5",
264
- "tailwindcss": "^3.4.1",
270
+ "tailwindcss": "^4.1.18",
265
271
  "ua-parser-js": "^2.0.3",
266
272
  "util": "^0.12.5",
267
273
  "uuid": "10.0.0",
package/react-utils.d.ts CHANGED
@@ -180,6 +180,7 @@ export function PrivateRoute(props: {
180
180
  redirectRoute?: string;
181
181
  errorPage?: React.ReactNode;
182
182
  permissions?: string[];
183
+ homeUrl?: string;
183
184
  } & RouteProps): JSX.Element;
184
185
  type OptionsType = {
185
186
  root?: Element | null;
@@ -526,6 +527,71 @@ export function useOnClickOutside<T>(ref: React.MutableRefObject<T>, handler: (e
526
527
  *
527
528
  */
528
529
  export function usePrevious<T>(value: T): T;
530
+ /**
531
+ *
532
+ * The usePrefersReducedMotion hook is a utility that detects whether the user has
533
+ *
534
+ * preferred reduced motion enabled in their system settings. This is particularly
535
+ *
536
+ * useful for creating accessible user interfaces that respect user preferences for
537
+ *
538
+ * motion and animations. The hook listens to changes in the user's motion
539
+ *
540
+ * preferences and updates accordingly.
541
+ *
542
+ * This hook uses the CSS media query (prefers-reduced-motion: no-preference) to
543
+ *
544
+ * determine if the user prefers reduced motion. When the user has reduced motion
545
+ *
546
+ * enabled, the media query will not match, and the hook will return true.
547
+ *
548
+ * This hook does not accept any arguments.
549
+ *
550
+ * The following code snippet demonstrates the usage of usePrefersReducedMotion to
551
+ *
552
+ * conditionally apply animations based on user preferences.
553
+ *
554
+ * @example
555
+ *
556
+ * import { usePrefersReducedMotion } from "@bigbinary/neeto-commons-frontend/react-utils";
557
+ *
558
+ * const MyComponent = () => {
559
+ * const prefersReducedMotion = usePrefersReducedMotion();
560
+ *
561
+ * return (
562
+ * <div
563
+ * className={prefersReducedMotion ? "static" : "animate-fade-in"}
564
+ * >
565
+ * Content that respects motion preferences
566
+ * </div>
567
+ * );
568
+ * };
569
+ * @endexample
570
+ * You can also use this hook to conditionally render animation libraries or
571
+ *
572
+ * components:
573
+ *
574
+ * @example
575
+ *
576
+ * import { usePrefersReducedMotion } from "@bigbinary/neeto-commons-frontend/react-utils";
577
+ * import { motion } from "framer-motion";
578
+ *
579
+ * const AnimatedComponent = ({ children }) => {
580
+ * const prefersReducedMotion = usePrefersReducedMotion();
581
+ *
582
+ * return (
583
+ * <motion.div
584
+ * initial={{ opacity: 0 }}
585
+ * animate={{ opacity: 1 }}
586
+ * transition={{ duration: prefersReducedMotion ? 0 : 0.5 }}
587
+ * >
588
+ * {children}
589
+ * </motion.div>
590
+ * );
591
+ * };
592
+ * @endexample
593
+ */
594
+ export function usePrefersReducedMotion(): boolean;
529
595
  /**
530
596
  *
531
597
  * The useUpdateEffect hook is a variation of the standard useEffect hook in
@@ -1949,13 +2015,13 @@ export function lazyWithRetry(importFn: () => Promise<{
1949
2015
  * import mount from "@bigbinary/neeto-commons-frontend/react-utils/mount";
1950
2016
  *
1951
2017
  * // Define your component mappings
1952
- * const components = {
2018
+ * const componentMap = {
1953
2019
  * MyComponent: () => import("./components/MyComponent"),
1954
2020
  * AnotherComponent: () => import("./components/AnotherComponent"),
1955
2021
  * };
1956
2022
  *
1957
2023
  * // Call mount with the component mappings
1958
- * mount(components);
2024
+ * mount(componentMap);
1959
2025
  * @endexample
1960
2026
  * In your HTML, you would have elements like:
1961
2027
  *
@@ -1974,6 +2040,6 @@ export function lazyWithRetry(importFn: () => Promise<{
1974
2040
  * with automatic retry logic.
1975
2041
  *
1976
2042
  */
1977
- export function mount(components: Record<string, () => Promise<{
2043
+ export function mount(componentMap: Record<string, () => Promise<{
1978
2044
  default: React.ComponentType<any>;
1979
2045
  } | React.ComponentType<any>>>): void;