@codebit-programando-solucoes/codebit-web-antd 1.1.16 → 1.1.20

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/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /*! For license information please see index.cjs.LICENSE.txt */
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-runtime.development.js": function(__unused_webpack_module, exports1, __webpack_require__) {
4
+ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js" (__unused_rspack_module, exports1, __webpack_require__) {
5
5
  /**
6
6
  * @license React
7
7
  * react-jsx-runtime.development.js
@@ -209,7 +209,7 @@ var __webpack_modules__ = {
209
209
  };
210
210
  }();
211
211
  },
212
- "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-runtime.production.js": function(__unused_webpack_module, exports1) {
212
+ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.production.js" (__unused_rspack_module, exports1) {
213
213
  /**
214
214
  * @license React
215
215
  * react-jsx-runtime.production.js
@@ -240,11 +240,11 @@ var __webpack_modules__ = {
240
240
  exports1.jsx = jsxProd;
241
241
  exports1.jsxs = jsxProd;
242
242
  },
243
- "../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-runtime.js": function(module, __unused_webpack_exports, __webpack_require__) {
244
- if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-runtime.production.js");
245
- else module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-runtime.development.js");
243
+ "../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js" (module, __unused_rspack_exports, __webpack_require__) {
244
+ if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.production.js");
245
+ else module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js");
246
246
  },
247
- react: function(module) {
247
+ react (module) {
248
248
  module.exports = require("react");
249
249
  }
250
250
  };
@@ -280,7 +280,7 @@ function __webpack_require__(moduleId) {
280
280
  })();
281
281
  (()=>{
282
282
  __webpack_require__.r = (exports1)=>{
283
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
283
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
284
284
  value: 'Module'
285
285
  });
286
286
  Object.defineProperty(exports1, '__esModule', {
@@ -296,12 +296,13 @@ var __webpack_exports__ = {};
296
296
  CssTokenBridge: ()=>CssTokenBridge,
297
297
  LoggedMainContainer: ()=>LoggedMainContainer,
298
298
  Login: ()=>Login,
299
+ CodebitThemeProvider: ()=>CodebitThemeProvider,
299
300
  ErrorRetry: ()=>ErrorRetry,
301
+ CodebitThemeContext: ()=>CodebitThemeContext,
300
302
  CodebitConfigContext: ()=>CodebitConfigContext,
301
303
  ListCard: ()=>ListCard,
302
304
  ForgotPassword: ()=>ForgotPassword,
303
305
  LoginContainer: ()=>LoginContainer,
304
- CodebitTheme: ()=>CodebitTheme,
305
306
  LocalLoginRecoveryPasswordResult: ()=>LocalLoginRecoveryPasswordResult,
306
307
  FilterContainer: ()=>FilterContainer,
307
308
  HandleError: ()=>HandleError,
@@ -309,15 +310,102 @@ var __webpack_exports__ = {};
309
310
  CodebitConfigProvider: ()=>CodebitConfigProvider,
310
311
  ThemeToggle: ()=>ThemeToggle
311
312
  });
312
- var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-runtime.js");
313
+ var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js");
313
314
  const icons_namespaceObject = require("@ant-design/icons");
314
315
  const external_antd_namespaceObject = require("antd");
315
316
  const external_prop_types_namespaceObject = require("prop-types");
316
317
  var external_prop_types_default = /*#__PURE__*/ __webpack_require__.n(external_prop_types_namespaceObject);
317
318
  var external_react_ = __webpack_require__("react");
318
319
  const external_react_router_namespaceObject = require("react-router");
319
- const external_i18next_namespaceObject = require("i18next");
320
+ const react_namespaceObject = require("@sentry/react");
321
+ const codebit_web_namespaceObject = require("@codebit-programando-solucoes/codebit-web");
322
+ const logger = new codebit_web_namespaceObject.Logger('CodebitConfigContext');
323
+ const CodebitConfigContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
324
+ function CodebitConfigProvider({ children, menuItems, version = '1.0', showVersion = ()=>true, secondarySidebar, secondarySidebarWidth = 280, doLogout, checkLogin }) {
325
+ const [isLogged, setIsLogged] = (0, external_react_.useState)(null);
326
+ const [user, setUser] = (0, external_react_.useState)(null);
327
+ const logout = async ()=>{
328
+ await doLogout();
329
+ setIsLogged(false);
330
+ setUser(null);
331
+ react_namespaceObject.setUser(null);
332
+ };
333
+ (0, external_react_.useEffect)(()=>{
334
+ if (null === isLogged) checkLogin().then((loggedUser)=>{
335
+ if (loggedUser) {
336
+ logger.trace('User data.', loggedUser);
337
+ setIsLogged(true);
338
+ setUser(loggedUser);
339
+ react_namespaceObject.setUser({
340
+ id: loggedUser.id,
341
+ email: loggedUser.email,
342
+ name: loggedUser.name
343
+ });
344
+ } else {
345
+ logger.trace('User not logged in.');
346
+ setIsLogged(false);
347
+ setUser(null);
348
+ react_namespaceObject.setUser(null);
349
+ }
350
+ }).catch((e)=>{
351
+ logger.error('Error fetching session state.', e);
352
+ setIsLogged(false);
353
+ setUser(null);
354
+ });
355
+ }, [
356
+ isLogged
357
+ ]);
358
+ const contextValue = (0, external_react_.useMemo)(()=>({
359
+ menuItems,
360
+ isLogged,
361
+ user,
362
+ logout,
363
+ version,
364
+ showVersion,
365
+ secondarySidebar,
366
+ secondarySidebarWidth
367
+ }), [
368
+ menuItems,
369
+ isLogged,
370
+ user,
371
+ version,
372
+ showVersion,
373
+ secondarySidebar,
374
+ secondarySidebarWidth
375
+ ]);
376
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitConfigContext.Provider, {
377
+ value: contextValue,
378
+ children: children
379
+ });
380
+ }
381
+ CodebitConfigProvider.propTypes = {
382
+ children: external_prop_types_default().node.isRequired,
383
+ menuItems: external_prop_types_default().func.isRequired,
384
+ version: external_prop_types_default().string,
385
+ showVersion: external_prop_types_default().func,
386
+ secondarySidebar: external_prop_types_default().func,
387
+ secondarySidebarWidth: external_prop_types_default().number,
388
+ doLogout: external_prop_types_default().func.isRequired,
389
+ checkLogin: external_prop_types_default().func.isRequired
390
+ };
391
+ const ThemeToggle = ()=>{
392
+ const config = (0, external_react_.useContext)(CodebitThemeContext);
393
+ if (!config) throw new Error('ThemeToggle must be used within CodebitThemeContext');
394
+ (0, external_react_.useEffect)(()=>{
395
+ document.documentElement.style.colorScheme = config.isDarkMode ? 'dark' : 'light';
396
+ }, [
397
+ config.isDarkMode
398
+ ]);
399
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Switch, {
400
+ theme: config.isDarkMode ? 'dark' : 'light',
401
+ checked: config.isDarkMode,
402
+ onChange: (value)=>config.setIsDarkMode(value),
403
+ checkedChildren: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MoonOutlined, {}),
404
+ unCheckedChildren: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.SunOutlined, {})
405
+ });
406
+ };
320
407
  const external_react_i18next_namespaceObject = require("react-i18next");
408
+ const external_i18next_namespaceObject = require("i18next");
321
409
  const pt = {
322
410
  codebitWebAntd: {
323
411
  LoggedMainContainer: {
@@ -537,146 +625,408 @@ var __webpack_exports__ = {};
537
625
  }
538
626
  });
539
627
  const i18n = i18nLib;
540
- const CodebitConfigContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
541
- function CodebitConfigProvider({ children, menuItems, user, onLogout, version = '1.0', showVersion = true, secondarySidebar, secondarySidebarWidth = 280, storeThemeInLocalStorage = true }) {
542
- const getSystemTheme = ()=>globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;
543
- const [isDarkMode, setIsDarkMode] = (0, external_react_.useState)(()=>{
544
- if (storeThemeInLocalStorage) {
545
- const savedTheme = localStorage.getItem('theme');
546
- if (null !== savedTheme) return 'dark' === savedTheme;
547
- }
548
- return getSystemTheme();
628
+ const useCodebitWebAntdTranslation = ()=>(0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd', {
629
+ i18n: i18n
549
630
  });
550
- (0, external_react_.useEffect)(()=>{
551
- const mediaQuery = globalThis.matchMedia('(prefers-color-scheme: dark)');
552
- const handleThemeChange = (e)=>{
553
- if (!storeThemeInLocalStorage) return void setIsDarkMode(e.matches);
554
- const savedTheme = localStorage.getItem('theme');
555
- if (null === savedTheme) setIsDarkMode(e.matches);
556
- };
557
- mediaQuery.addEventListener('change', handleThemeChange);
558
- return ()=>{
559
- mediaQuery.removeEventListener('change', handleThemeChange);
560
- };
561
- }, [
562
- storeThemeInLocalStorage
563
- ]);
564
- const toggleTheme = ()=>{
565
- const newTheme = !isDarkMode;
566
- setIsDarkMode(newTheme);
567
- if (storeThemeInLocalStorage) localStorage.setItem('theme', newTheme ? 'dark' : 'light');
568
- };
569
- const resetToSystemTheme = ()=>{
570
- if (storeThemeInLocalStorage) localStorage.removeItem('theme');
571
- setIsDarkMode(getSystemTheme());
572
- };
573
- const contextValue = (0, external_react_.useMemo)(()=>({
574
- menuItems,
575
- user,
576
- onLogout,
577
- version,
578
- showVersion,
579
- i18n: i18n,
580
- secondarySidebar,
581
- secondarySidebarWidth,
582
- isDarkMode,
583
- setIsDarkMode,
584
- toggleTheme,
585
- resetToSystemTheme
586
- }), [
587
- menuItems,
588
- user,
589
- onLogout,
590
- version,
591
- showVersion,
592
- secondarySidebar,
593
- secondarySidebarWidth,
594
- isDarkMode,
595
- storeThemeInLocalStorage
596
- ]);
597
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)(CodebitConfigContext.Provider, {
598
- value: contextValue,
599
- children: [
600
- /*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {}),
601
- children
602
- ]
631
+ const ErrorRetry_logger = new codebit_web_namespaceObject.Logger('ErrorRetry');
632
+ function ErrorRetry({ error, onRetry }) {
633
+ const { t } = useCodebitWebAntdTranslation();
634
+ if (error && error instanceof Error) {
635
+ ErrorRetry_logger.error('Fail to load.', error);
636
+ react_namespaceObject.captureException(error);
637
+ }
638
+ const responseStatus = error?.response?.status || null;
639
+ let errorMessage = t('ErrorRetry.defaultError');
640
+ let retryText = t('ErrorRetry.retryButton');
641
+ let status = 'error';
642
+ if (error?.errorCode) switch(error.errorCode){
643
+ case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
644
+ errorMessage = t('ErrorRetry.networkError');
645
+ break;
646
+ case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
647
+ errorMessage = t('ErrorRetry.timeoutError');
648
+ break;
649
+ }
650
+ else if (responseStatus) switch(responseStatus){
651
+ case 400:
652
+ errorMessage = t('ErrorRetry.badRequestError');
653
+ break;
654
+ case 403:
655
+ errorMessage = t('ErrorRetry.forbiddenError');
656
+ retryText = t('ErrorRetry.reloadPageButton');
657
+ onRetry = ()=>{
658
+ globalThis.location.reload();
659
+ };
660
+ status = 403;
661
+ break;
662
+ case 404:
663
+ errorMessage = t('ErrorRetry.notFoundError');
664
+ status = 404;
665
+ break;
666
+ case 500:
667
+ errorMessage = t('ErrorRetry.internalServerError');
668
+ status = 500;
669
+ break;
670
+ case 401:
671
+ errorMessage = t('ErrorRetry.sessionExpiredError');
672
+ retryText = t('ErrorRetry.reloadPageButton');
673
+ onRetry = ()=>{
674
+ globalThis.location.reload();
675
+ };
676
+ break;
677
+ }
678
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
679
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
680
+ status: status,
681
+ title: errorMessage,
682
+ extra: [
683
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
684
+ type: 'primary',
685
+ onClick: onRetry,
686
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
687
+ children: retryText
688
+ }, 'retry')
689
+ ]
690
+ })
603
691
  });
604
692
  }
605
- CodebitConfigProvider.propTypes = {
606
- children: external_prop_types_default().node.isRequired,
607
- menuItems: external_prop_types_default().arrayOf(external_prop_types_default().shape({
608
- key: external_prop_types_default().string.isRequired,
609
- icon: external_prop_types_default().node,
610
- label: external_prop_types_default().string.isRequired,
611
- roles: external_prop_types_default().arrayOf(external_prop_types_default().string)
612
- })).isRequired,
613
- user: external_prop_types_default().shape({
614
- name: external_prop_types_default().string.isRequired,
615
- email: external_prop_types_default().string.isRequired,
616
- id: external_prop_types_default().string.isRequired,
617
- roles: external_prop_types_default().arrayOf(external_prop_types_default().string).isRequired
618
- }).isRequired,
619
- onLogout: external_prop_types_default().func.isRequired,
620
- version: external_prop_types_default().string,
621
- showVersion: external_prop_types_default().bool,
622
- secondarySidebar: external_prop_types_default().node,
623
- secondarySidebarWidth: external_prop_types_default().number,
624
- storeThemeInLocalStorage: external_prop_types_default().bool
693
+ ErrorRetry.propTypes = {
694
+ error: external_prop_types_default().object.isRequired,
695
+ onRetry: external_prop_types_default().func.isRequired
625
696
  };
626
- const ThemeToggle = ()=>{
627
- const config = (0, external_react_.useContext)(CodebitConfigContext);
628
- if (!config) throw new Error('ThemeToggle must be used within CodebitConfigProvider');
629
- (0, external_react_.useEffect)(()=>{
630
- document.documentElement.style.colorScheme = config.isDarkMode ? 'dark' : 'light';
631
- }, [
632
- config.isDarkMode
633
- ]);
634
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Switch, {
635
- theme: config.isDarkMode ? 'dark' : 'light',
636
- checked: config.isDarkMode,
637
- onChange: config.toggleTheme,
638
- checkedChildren: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MoonOutlined, {}),
639
- unCheckedChildren: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.SunOutlined, {})
697
+ const ListCard_module = {
698
+ listCard: "listCard-ISftFd",
699
+ headerRow: "headerRow-UsZAzP",
700
+ actions: "actions-ig53s2",
701
+ filtersRow: "filtersRow-f3Xk5a",
702
+ expandArea: "expandArea-czOoFS"
703
+ };
704
+ const { Title } = external_antd_namespaceObject.Typography;
705
+ function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
706
+ const { token } = external_antd_namespaceObject.theme.useToken();
707
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
708
+ const margin = token['margin'];
709
+ return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
710
+ className: ListCard_module.listCard,
711
+ children: [
712
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
713
+ gutter: margin,
714
+ align: 'middle',
715
+ className: ListCard_module.headerRow,
716
+ children: [
717
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
718
+ xs: 24,
719
+ sm: 24,
720
+ md: 12,
721
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
722
+ level: 4,
723
+ children: title
724
+ })
725
+ }),
726
+ (!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
727
+ xs: 24,
728
+ sm: 24,
729
+ md: 12,
730
+ className: ListCard_module.actions,
731
+ children: [
732
+ !!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
733
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
734
+ onClick: onClearFilters,
735
+ children: t('ListCard.clearFilters')
736
+ }),
737
+ actions
738
+ ]
739
+ })
740
+ ]
741
+ }),
742
+ !!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
743
+ gutter: margin,
744
+ className: ListCard_module.filtersRow,
745
+ children: headerContainer
746
+ }),
747
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
748
+ className: ListCard_module.expandArea,
749
+ children: tableContainer
750
+ })
751
+ ]
640
752
  });
753
+ }
754
+ ListCard.propTypes = {
755
+ title: external_prop_types_default().string.isRequired,
756
+ onClearFilters: external_prop_types_default().func,
757
+ headerContainer: external_prop_types_default().node,
758
+ tableContainer: external_prop_types_default().node,
759
+ actions: external_prop_types_default().node
641
760
  };
642
- const LoggedMainContainer_module = {
643
- layout: "layout-mL5o6I",
644
- drawer: "drawer-oj0mJX",
645
- drawerBody: "drawerBody-YtAN37",
646
- drawerFlex: "drawerFlex-AGTAax",
647
- sider: "sider-BDy1Bs",
648
- siderLayout: "siderLayout-C8H0uI",
649
- secondarySidebar: "secondarySidebar-P6J_Xn",
650
- menu: "menu-KMvPt7",
651
- menuContainer: "menuContainer-ahnhBu",
652
- menuLabel: "menuLabel-csBJTc",
653
- menuDescription: "menuDescription-d6BFBO",
654
- menuSpacer: "menuSpacer-RIB3II",
655
- versionMenu: "versionMenu-NM4uyG",
656
- logoutMenu: "logoutMenu-_RLfGo",
657
- header: "header-vgc67L",
658
- mobile: "mobile-mKGxb5",
659
- headerSpace: "headerSpace-Fd_iha",
660
- content: "content-OZHp2h"
761
+ ListCard.defaultProps = {
762
+ onClearFilters: null,
763
+ headerContainer: null,
764
+ tableContainer: null,
765
+ actions: null
661
766
  };
662
- const useCodebitWebAntdTranslation = ()=>(0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd', {
663
- i18n: i18n
664
- });
665
- const { Header, Sider, Content } = external_antd_namespaceObject.Layout;
666
- const { Text } = external_antd_namespaceObject.Typography;
667
- function LoggedMainContainer({ children }) {
668
- const [collapsed, setCollapsed] = (0, external_react_.useState)(false);
669
- const [isMobile, setIsMobile] = (0, external_react_.useState)(false);
670
- const [drawerVisible, setDrawerVisible] = (0, external_react_.useState)(false);
671
- const [secondarySidebarDrawerVisible, setSecondarySidebarDrawerVisible] = (0, external_react_.useState)(false);
672
- const { t } = useCodebitWebAntdTranslation();
767
+ const CssTokenBridge = ()=>{
768
+ const { token } = external_antd_namespaceObject.theme.useToken();
769
+ (0, external_react_.useLayoutEffect)(()=>{
770
+ const root = document.documentElement;
771
+ root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
772
+ root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
773
+ root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
774
+ root.style.setProperty('--antd-color-border', token['colorBorder']);
775
+ root.style.setProperty('--antd-color-primary', token['colorPrimary']);
776
+ root.style.setProperty('--antd-color-text', token['colorText']);
777
+ root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
778
+ root.style.setProperty('--antd-color-split', token['colorSplit']);
779
+ root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
780
+ root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
781
+ root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
782
+ root.style.setProperty('--antd-margin', `${token['margin']}px`);
783
+ root.style.setProperty('--antd-margin-md', `${token['marginMD']}px`);
784
+ root.style.setProperty('--antd-margin-lg', `${token['marginLG']}px`);
785
+ root.style.setProperty('--antd-margin-xl', `${token['marginXL']}px`);
786
+ root.style.setProperty('--antd-margin-xxl', `${token['marginXXL']}px`);
787
+ root.style.setProperty('--antd-padding-xxs', `${token['paddingXXS']}px`);
788
+ root.style.setProperty('--antd-padding-xs', `${token['paddingXS']}px`);
789
+ root.style.setProperty('--antd-padding-sm', `${token['paddingSM']}px`);
790
+ root.style.setProperty('--antd-padding', `${token['padding']}px`);
791
+ root.style.setProperty('--antd-padding-md', `${token['paddingMD']}px`);
792
+ root.style.setProperty('--antd-padding-lg', `${token['paddingLG']}px`);
793
+ root.style.setProperty('--antd-padding-xl', `${token['paddingXL']}px`);
794
+ root.style.setProperty('--antd-font-size-xxs', '8px');
795
+ root.style.setProperty('--antd-font-size-xs', '10px');
796
+ root.style.setProperty('--antd-font-size-sm', `${token['fontSizeSM']}px`);
797
+ root.style.setProperty('--antd-font-size', `${token['fontSize']}px`);
798
+ root.style.setProperty('--antd-font-size-lg', `${token['fontSizeLG']}px`);
799
+ root.style.setProperty('--antd-font-size-xl', `${token['fontSizeXL']}px`);
800
+ root.style.setProperty('--antd-font-size-xxl', `${token['fontSizeXXL']}px`);
801
+ root.style.setProperty('--antd-font-size-heading1', `${token['fontSizeHeading1']}px`);
802
+ root.style.setProperty('--antd-font-size-heading2', `${token['fontSizeHeading2']}px`);
803
+ root.style.setProperty('--antd-font-size-heading3', `${token['fontSizeHeading3']}px`);
804
+ root.style.setProperty('--antd-font-size-heading4', `${token['fontSizeHeading4']}px`);
805
+ root.style.setProperty('--antd-font-size-heading5', `${token['fontSizeHeading5']}px`);
806
+ root.style.setProperty('--antd-line-height', token['lineHeight']);
807
+ root.style.setProperty('--antd-line-height-lg', token['lineHeightLG']);
808
+ root.style.setProperty('--antd-control-height-sm', `${token['controlHeightSM']}px`);
809
+ root.style.setProperty('--antd-control-height', `${token['controlHeight']}px`);
810
+ root.style.setProperty('--antd-control-height-lg', `${token['controlHeightLG']}px`);
811
+ root.style.setProperty('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
812
+ root.style.setProperty('--antd-border-radius', `${token['borderRadius']}px`);
813
+ root.style.setProperty('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
814
+ }, [
815
+ token
816
+ ]);
817
+ return null;
818
+ };
819
+ const TableContainer_module = {
820
+ tableContainer: "tableContainer-EhNwOm"
821
+ };
822
+ function isPaginationNode(node) {
823
+ if (node.nodeType !== Node.ELEMENT_NODE) return false;
824
+ const element = node;
825
+ return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
826
+ }
827
+ function hasPaginationInMutation(mutation) {
828
+ return Array.from(mutation.addedNodes).some(isPaginationNode);
829
+ }
830
+ function TableContainer({ children }) {
831
+ const containerRef = (0, external_react_.useRef)(null);
832
+ const containerHeightRef = (0, external_react_.useRef)(null);
833
+ const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
834
+ (0, external_react_.useLayoutEffect)(()=>{
835
+ const calculateHeights = ()=>{
836
+ if (!containerRef.current) return;
837
+ containerHeightRef.current = containerRef.current.offsetHeight;
838
+ const thead = containerRef.current.querySelector('thead');
839
+ let theadHeight = 0;
840
+ if (thead) {
841
+ const rect = thead.getBoundingClientRect();
842
+ const styles = globalThis.getComputedStyle(thead);
843
+ const marginTop = Number.parseFloat(styles.marginTop) || 0;
844
+ const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
845
+ theadHeight = rect.height + marginTop + marginBottom;
846
+ }
847
+ const pagination = containerRef.current.querySelector('.ant-table-pagination');
848
+ let paginationHeight = 0;
849
+ if (pagination) {
850
+ const rect = pagination.getBoundingClientRect();
851
+ const styles = globalThis.getComputedStyle(pagination);
852
+ const marginTop = Number.parseFloat(styles.marginTop) || 0;
853
+ const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
854
+ paginationHeight = rect.height + marginTop + marginBottom;
855
+ }
856
+ const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
857
+ setScrollY(availableHeight);
858
+ };
859
+ calculateHeights();
860
+ const observer = new MutationObserver((mutations)=>{
861
+ const hasPagination = mutations.some(hasPaginationInMutation);
862
+ if (hasPagination) calculateHeights();
863
+ });
864
+ if (containerRef.current) observer.observe(containerRef.current, {
865
+ childList: true,
866
+ subtree: true
867
+ });
868
+ globalThis.addEventListener('resize', calculateHeights);
869
+ return ()=>{
870
+ observer.disconnect();
871
+ globalThis.removeEventListener('resize', calculateHeights);
872
+ };
873
+ }, []);
874
+ const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
875
+ scroll: {
876
+ ...children.props?.scroll,
877
+ y: scrollY,
878
+ x: 'max-content'
879
+ }
880
+ }) : children;
881
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
882
+ ref: containerRef,
883
+ className: TableContainer_module.tableContainer,
884
+ children: enhancedChildren
885
+ });
886
+ }
887
+ TableContainer.propTypes = {
888
+ children: external_prop_types_default().element.isRequired
889
+ };
890
+ function FilterContainer({ children, ...props }) {
891
+ const { token } = external_antd_namespaceObject.theme.useToken();
892
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
893
+ styles: {
894
+ body: {
895
+ padding: token['paddingXS'] + 'px'
896
+ }
897
+ },
898
+ ...props,
899
+ children: children
900
+ });
901
+ }
902
+ FilterContainer.propTypes = {
903
+ children: external_prop_types_default().node.isRequired,
904
+ ...external_antd_namespaceObject.Card.propTypes
905
+ };
906
+ const CodebitThemeContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
907
+ const CodebitThemeProvider = ({ children, storeThemeInLocalStorage = true, ...props })=>{
908
+ const hasLoaded = (0, external_react_.useRef)(false);
909
+ const [isDarkMode, setIsDarkMode] = (0, external_react_.useState)(()=>{
910
+ try {
911
+ if (storeThemeInLocalStorage) {
912
+ const savedTheme = localStorage?.getItem('theme');
913
+ if (null !== savedTheme) return 'dark' === savedTheme;
914
+ }
915
+ return globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;
916
+ } finally{
917
+ hasLoaded.current = true;
918
+ }
919
+ });
920
+ const toggleTheme = ()=>{
921
+ setIsDarkMode((prev)=>!prev);
922
+ };
923
+ (0, external_react_.useEffect)(()=>{
924
+ const rootElement = document.getElementById('root');
925
+ if (isDarkMode) {
926
+ document.body.classList.add('dark-theme');
927
+ rootElement.classList.add('dark-theme');
928
+ } else {
929
+ document.body.classList.remove('dark-theme');
930
+ rootElement.classList.remove('dark-theme');
931
+ }
932
+ document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
933
+ }, [
934
+ isDarkMode
935
+ ]);
936
+ (0, external_react_.useEffect)(()=>{
937
+ if (hasLoaded.current && storeThemeInLocalStorage) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
938
+ }, [
939
+ isDarkMode,
940
+ storeThemeInLocalStorage
941
+ ]);
942
+ const themeContextValue = (0, external_react_.useMemo)(()=>({
943
+ isDarkMode,
944
+ toggleTheme,
945
+ setIsDarkMode
946
+ }), [
947
+ isDarkMode
948
+ ]);
949
+ return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitThemeContext.Provider, {
950
+ value: themeContextValue,
951
+ children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.ConfigProvider, {
952
+ theme: {
953
+ algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
954
+ token: {
955
+ colorPrimary: isDarkMode ? '#589C75' : '#29D266',
956
+ colorInfo: isDarkMode ? '#589C75' : '#29D266',
957
+ colorLink: isDarkMode ? '#589C75' : '#29D266'
958
+ },
959
+ components: {
960
+ Menu: {
961
+ itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
962
+ itemSelectedColor: '#FAFAFA',
963
+ darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
964
+ darkItemSelectedColor: '#FAFAFA'
965
+ },
966
+ Button: {
967
+ colorPrimary: isDarkMode ? '#589C75' : '#29D266',
968
+ colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
969
+ colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
970
+ },
971
+ Layout: {
972
+ siderBg: isDarkMode ? '#1a1a1a' : '#001529',
973
+ triggerBg: isDarkMode ? '#589C75' : '#29D266',
974
+ triggerColor: '#FAFAFA'
975
+ },
976
+ Header: {
977
+ colorPrimary: isDarkMode ? '#589C75' : '#29D266'
978
+ }
979
+ }
980
+ },
981
+ ...props,
982
+ children: [
983
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {}),
984
+ children
985
+ ]
986
+ })
987
+ });
988
+ };
989
+ CodebitThemeProvider.propTypes = {
990
+ children: external_prop_types_default().node.isRequired,
991
+ storeThemeInLocalStorage: external_prop_types_default().bool
992
+ };
993
+ const LoggedMainContainer_module = {
994
+ layout: "layout-mL5o6I",
995
+ drawer: "drawer-oj0mJX",
996
+ drawerBody: "drawerBody-YtAN37",
997
+ drawerFlex: "drawerFlex-AGTAax",
998
+ sider: "sider-BDy1Bs",
999
+ siderLayout: "siderLayout-C8H0uI",
1000
+ secondarySidebar: "secondarySidebar-P6J_Xn",
1001
+ menu: "menu-KMvPt7",
1002
+ menuContainer: "menuContainer-ahnhBu",
1003
+ menuLabel: "menuLabel-csBJTc",
1004
+ menuDescription: "menuDescription-d6BFBO",
1005
+ menuSpacer: "menuSpacer-RIB3II",
1006
+ versionMenu: "versionMenu-NM4uyG",
1007
+ logoutMenu: "logoutMenu-_RLfGo",
1008
+ header: "header-vgc67L",
1009
+ mobile: "mobile-mKGxb5",
1010
+ headerSpace: "headerSpace-Fd_iha",
1011
+ content: "content-OZHp2h"
1012
+ };
1013
+ const { Header, Sider, Content } = external_antd_namespaceObject.Layout;
1014
+ const { Text } = external_antd_namespaceObject.Typography;
1015
+ function LoggedMainContainer({ children }) {
1016
+ const [collapsed, setCollapsed] = (0, external_react_.useState)(false);
1017
+ const [isMobile, setIsMobile] = (0, external_react_.useState)(false);
1018
+ const [drawerVisible, setDrawerVisible] = (0, external_react_.useState)(false);
1019
+ const [secondarySidebarDrawerVisible, setSecondarySidebarDrawerVisible] = (0, external_react_.useState)(false);
1020
+ const { t } = useCodebitWebAntdTranslation();
673
1021
  const navigate = (0, external_react_router_namespaceObject.useNavigate)();
674
1022
  const location = (0, external_react_router_namespaceObject.useLocation)();
675
- const config = (0, external_react_.useContext)(CodebitConfigContext);
676
- if (!config) throw new Error('LoggedContainer must be used within CodebitConfigProvider');
677
- const { menuItems, user, onLogout, version, showVersion, isDarkMode, secondarySidebar, secondarySidebarWidth = 280 } = config;
1023
+ const configCodebit = (0, external_react_.useContext)(CodebitConfigContext);
1024
+ const configTheme = (0, external_react_.useContext)(CodebitThemeContext);
1025
+ if (!configCodebit || !configTheme) throw new Error('LoggedContainer must be used within CodebitConfigProvider and CodebitThemeContext');
1026
+ const { logout, user, menuItems, version, showVersion, secondarySidebar, secondarySidebarWidth = 280 } = configCodebit;
1027
+ const { isDarkMode } = configTheme;
678
1028
  const systemTheme = isDarkMode ? 'dark' : 'light';
679
- const filteredMenuItems = (0, external_react_.useMemo)(()=>menuItems.filter((item)=>{
1029
+ const filteredMenuItems = (0, external_react_.useMemo)(()=>menuItems(user).filter((item)=>{
680
1030
  if (!item.roles) return true;
681
1031
  if (!user || !user.roles) return false;
682
1032
  if (item.roles) return item.roles.some((role)=>user.roles.includes(role));
@@ -694,7 +1044,7 @@ var __webpack_exports__ = {};
694
1044
  return ()=>window.removeEventListener('resize', checkScreenSize);
695
1045
  }, []);
696
1046
  const handleLogout = async ()=>{
697
- if (onLogout) await onLogout();
1047
+ await logout?.();
698
1048
  if (isMobile) setDrawerVisible(false);
699
1049
  navigate('/');
700
1050
  };
@@ -725,7 +1075,7 @@ var __webpack_exports__ = {};
725
1075
  /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout.Content, {
726
1076
  className: LoggedMainContainer_module.menuSpacer
727
1077
  }),
728
- showVersion && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
1078
+ showVersion?.(user) && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
729
1079
  theme: systemTheme,
730
1080
  mode: 'horizontal',
731
1081
  className: LoggedMainContainer_module.versionMenu,
@@ -769,347 +1119,79 @@ var __webpack_exports__ = {};
769
1119
  vertical: true,
770
1120
  className: LoggedMainContainer_module.drawerFlex,
771
1121
  children: menuContent
772
- })
773
- }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
774
- theme: systemTheme,
775
- trigger: null,
776
- collapsible: true,
777
- collapsed: !collapsed,
778
- breakpoint: 'lg',
779
- collapsedWidth: 80,
780
- className: LoggedMainContainer_module.sider,
781
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
782
- className: LoggedMainContainer_module.siderLayout,
783
- children: menuContent
784
- })
785
- }),
786
- secondarySidebar && !isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
787
- theme: systemTheme,
788
- width: secondarySidebarWidth,
789
- className: `${LoggedMainContainer_module.secondarySidebar} ${isDarkMode ? LoggedMainContainer_module.secondarySidebarDark : ''}`,
790
- children: secondarySidebar
791
- }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
792
- placement: 'right',
793
- onClose: ()=>setSecondarySidebarDrawerVisible(false),
794
- open: secondarySidebarDrawerVisible,
795
- width: 280,
796
- className: LoggedMainContainer_module.drawer,
797
- title: null,
798
- closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
799
- children: secondarySidebar
800
- }),
801
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
802
- children: [
803
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(Header, {
804
- className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
805
- children: [
806
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
807
- children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
808
- type: 'text',
809
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
810
- onClick: ()=>setDrawerVisible(true)
811
- }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
812
- type: 'text',
813
- icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
814
- onClick: ()=>setCollapsed(!collapsed)
815
- })
816
- }),
817
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
818
- size: isMobile ? 'small' : 'middle',
819
- className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
820
- children: [
821
- secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
822
- type: 'text',
823
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
824
- onClick: ()=>setSecondarySidebarDrawerVisible(true)
825
- }),
826
- !isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
827
- children: t('LoggedMainContainer.theme')
828
- }),
829
- /*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {})
830
- ]
831
- })
832
- ]
833
- }),
834
- /*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
835
- className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
836
- children: children
837
- })
838
- ]
839
- })
840
- ]
841
- });
842
- }
843
- LoggedMainContainer.propTypes = {
844
- children: external_prop_types_default().node.isRequired
845
- };
846
- const codebit_web_namespaceObject = require("@codebit-programando-solucoes/codebit-web");
847
- const react_namespaceObject = require("@sentry/react");
848
- function ErrorRetry({ error, onRetry }) {
849
- const { t } = useCodebitWebAntdTranslation();
850
- if (error && error instanceof Error) {
851
- console.error('Fail to load.', error);
852
- react_namespaceObject.captureException(error);
853
- }
854
- const responseStatus = error?.response?.status || null;
855
- let errorMessage = t('ErrorRetry.defaultError');
856
- let retryText = t('ErrorRetry.retryButton');
857
- let status = 'error';
858
- if (error?.errorCode) switch(error.errorCode){
859
- case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
860
- errorMessage = t('ErrorRetry.networkError');
861
- break;
862
- case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
863
- errorMessage = t('ErrorRetry.timeoutError');
864
- break;
865
- }
866
- else if (responseStatus) switch(responseStatus){
867
- case 400:
868
- errorMessage = t('ErrorRetry.badRequestError');
869
- break;
870
- case 403:
871
- errorMessage = t('ErrorRetry.forbiddenError');
872
- retryText = t('ErrorRetry.reloadPageButton');
873
- onRetry = ()=>{
874
- globalThis.location.reload();
875
- };
876
- status = 403;
877
- break;
878
- case 404:
879
- errorMessage = t('ErrorRetry.notFoundError');
880
- status = 404;
881
- break;
882
- case 500:
883
- errorMessage = t('ErrorRetry.internalServerError');
884
- status = 500;
885
- break;
886
- case 401:
887
- errorMessage = t('ErrorRetry.sessionExpiredError');
888
- retryText = t('ErrorRetry.reloadPageButton');
889
- onRetry = ()=>{
890
- globalThis.location.reload();
891
- };
892
- break;
893
- }
894
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
895
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
896
- status: status,
897
- title: errorMessage,
898
- extra: [
899
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
900
- type: 'primary',
901
- onClick: onRetry,
902
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
903
- children: retryText
904
- }, 'retry')
905
- ]
906
- })
907
- });
908
- }
909
- ErrorRetry.propTypes = {
910
- error: external_prop_types_default().object.isRequired,
911
- onRetry: external_prop_types_default().func.isRequired
912
- };
913
- const ListCard_module = {
914
- listCard: "listCard-ISftFd",
915
- headerRow: "headerRow-UsZAzP",
916
- actions: "actions-ig53s2",
917
- filtersRow: "filtersRow-f3Xk5a",
918
- expandArea: "expandArea-czOoFS"
919
- };
920
- const { Title } = external_antd_namespaceObject.Typography;
921
- function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
922
- const { token } = external_antd_namespaceObject.theme.useToken();
923
- const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
924
- const margin = token['margin'];
925
- return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
926
- className: ListCard_module.listCard,
927
- children: [
928
- /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
929
- gutter: margin,
930
- align: 'middle',
931
- className: ListCard_module.headerRow,
1122
+ })
1123
+ }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
1124
+ theme: systemTheme,
1125
+ trigger: null,
1126
+ collapsible: true,
1127
+ collapsed: !collapsed,
1128
+ breakpoint: 'lg',
1129
+ collapsedWidth: 80,
1130
+ className: LoggedMainContainer_module.sider,
1131
+ children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
1132
+ className: LoggedMainContainer_module.siderLayout,
1133
+ children: menuContent
1134
+ })
1135
+ }),
1136
+ secondarySidebar && !isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(Sider, {
1137
+ theme: systemTheme,
1138
+ width: secondarySidebarWidth,
1139
+ className: `${LoggedMainContainer_module.secondarySidebar} ${isDarkMode ? LoggedMainContainer_module.secondarySidebarDark : ''}`,
1140
+ children: secondarySidebar(user)
1141
+ }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
1142
+ placement: 'right',
1143
+ onClose: ()=>setSecondarySidebarDrawerVisible(false),
1144
+ open: secondarySidebarDrawerVisible,
1145
+ width: 280,
1146
+ className: LoggedMainContainer_module.drawer,
1147
+ title: null,
1148
+ closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
1149
+ children: secondarySidebar(user)
1150
+ }),
1151
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
932
1152
  children: [
933
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
934
- xs: 24,
935
- sm: 24,
936
- md: 12,
937
- children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
938
- level: 4,
939
- children: title
940
- })
941
- }),
942
- (!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
943
- xs: 24,
944
- sm: 24,
945
- md: 12,
946
- className: ListCard_module.actions,
1153
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(Header, {
1154
+ className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
947
1155
  children: [
948
- !!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
949
- icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
950
- onClick: onClearFilters,
951
- children: t('ListCard.clearFilters')
1156
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
1157
+ children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1158
+ type: 'text',
1159
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
1160
+ onClick: ()=>setDrawerVisible(true)
1161
+ }) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1162
+ type: 'text',
1163
+ icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
1164
+ onClick: ()=>setCollapsed(!collapsed)
1165
+ })
952
1166
  }),
953
- actions
1167
+ /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
1168
+ size: isMobile ? 'small' : 'middle',
1169
+ className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1170
+ children: [
1171
+ secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
1172
+ type: 'text',
1173
+ icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
1174
+ onClick: ()=>setSecondarySidebarDrawerVisible(true)
1175
+ }),
1176
+ !isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
1177
+ children: t('LoggedMainContainer.theme')
1178
+ }),
1179
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {})
1180
+ ]
1181
+ })
954
1182
  ]
1183
+ }),
1184
+ /*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
1185
+ className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
1186
+ children: children
955
1187
  })
956
1188
  ]
957
- }),
958
- !!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
959
- gutter: margin,
960
- className: ListCard_module.filtersRow,
961
- children: headerContainer
962
- }),
963
- /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
964
- className: ListCard_module.expandArea,
965
- children: tableContainer
966
1189
  })
967
1190
  ]
968
1191
  });
969
1192
  }
970
- ListCard.propTypes = {
971
- title: external_prop_types_default().string.isRequired,
972
- onClearFilters: external_prop_types_default().func,
973
- headerContainer: external_prop_types_default().node,
974
- tableContainer: external_prop_types_default().node,
975
- actions: external_prop_types_default().node
976
- };
977
- ListCard.defaultProps = {
978
- onClearFilters: null,
979
- headerContainer: null,
980
- tableContainer: null,
981
- actions: null
982
- };
983
- const CssTokenBridge = ()=>{
984
- const { token } = external_antd_namespaceObject.theme.useToken();
985
- (0, external_react_.useLayoutEffect)(()=>{
986
- const root = document.documentElement;
987
- root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
988
- root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
989
- root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
990
- root.style.setProperty('--antd-color-border', token['colorBorder']);
991
- root.style.setProperty('--antd-color-primary', token['colorPrimary']);
992
- root.style.setProperty('--antd-color-text', token['colorText']);
993
- root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
994
- root.style.setProperty('--antd-color-split', token['colorSplit']);
995
- root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
996
- root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
997
- root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
998
- root.style.setProperty('--antd-margin', `${token['margin']}px`);
999
- root.style.setProperty('--antd-margin-md', `${token['marginMD']}px`);
1000
- root.style.setProperty('--antd-margin-lg', `${token['marginLG']}px`);
1001
- root.style.setProperty('--antd-margin-xl', `${token['marginXL']}px`);
1002
- root.style.setProperty('--antd-margin-xxl', `${token['marginXXL']}px`);
1003
- root.style.setProperty('--antd-padding-xxs', `${token['paddingXXS']}px`);
1004
- root.style.setProperty('--antd-padding-xs', `${token['paddingXS']}px`);
1005
- root.style.setProperty('--antd-padding-sm', `${token['paddingSM']}px`);
1006
- root.style.setProperty('--antd-padding', `${token['padding']}px`);
1007
- root.style.setProperty('--antd-padding-md', `${token['paddingMD']}px`);
1008
- root.style.setProperty('--antd-padding-lg', `${token['paddingLG']}px`);
1009
- root.style.setProperty('--antd-padding-xl', `${token['paddingXL']}px`);
1010
- root.style.setProperty('--antd-font-size-sm', `${token['fontSizeSM']}px`);
1011
- root.style.setProperty('--antd-font-size', `${token['fontSize']}px`);
1012
- root.style.setProperty('--antd-font-size-lg', `${token['fontSizeLG']}px`);
1013
- root.style.setProperty('--antd-font-size-xl', `${token['fontSizeXL']}px`);
1014
- root.style.setProperty('--antd-line-height', token['lineHeight']);
1015
- root.style.setProperty('--antd-line-height-lg', token['lineHeightLG']);
1016
- root.style.setProperty('--antd-control-height-sm', `${token['controlHeightSM']}px`);
1017
- root.style.setProperty('--antd-control-height', `${token['controlHeight']}px`);
1018
- root.style.setProperty('--antd-control-height-lg', `${token['controlHeightLG']}px`);
1019
- root.style.setProperty('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
1020
- root.style.setProperty('--antd-border-radius', `${token['borderRadius']}px`);
1021
- root.style.setProperty('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
1022
- }, [
1023
- token
1024
- ]);
1025
- return null;
1026
- };
1027
- const TableContainer_module = {
1028
- tableContainer: "tableContainer-EhNwOm"
1029
- };
1030
- function isPaginationNode(node) {
1031
- if (node.nodeType !== Node.ELEMENT_NODE) return false;
1032
- const element = node;
1033
- return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
1034
- }
1035
- function hasPaginationInMutation(mutation) {
1036
- return Array.from(mutation.addedNodes).some(isPaginationNode);
1037
- }
1038
- function TableContainer({ children }) {
1039
- const containerRef = (0, external_react_.useRef)(null);
1040
- const containerHeightRef = (0, external_react_.useRef)(null);
1041
- const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
1042
- (0, external_react_.useLayoutEffect)(()=>{
1043
- const calculateHeights = ()=>{
1044
- if (!containerRef.current) return;
1045
- containerHeightRef.current = containerRef.current.offsetHeight;
1046
- const thead = containerRef.current.querySelector('thead');
1047
- let theadHeight = 0;
1048
- if (thead) {
1049
- const rect = thead.getBoundingClientRect();
1050
- const styles = globalThis.getComputedStyle(thead);
1051
- const marginTop = Number.parseFloat(styles.marginTop) || 0;
1052
- const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
1053
- theadHeight = rect.height + marginTop + marginBottom;
1054
- }
1055
- const pagination = containerRef.current.querySelector('.ant-table-pagination');
1056
- let paginationHeight = 0;
1057
- if (pagination) {
1058
- const rect = pagination.getBoundingClientRect();
1059
- const styles = globalThis.getComputedStyle(pagination);
1060
- const marginTop = Number.parseFloat(styles.marginTop) || 0;
1061
- const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
1062
- paginationHeight = rect.height + marginTop + marginBottom;
1063
- }
1064
- const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
1065
- setScrollY(availableHeight);
1066
- };
1067
- calculateHeights();
1068
- const observer = new MutationObserver((mutations)=>{
1069
- const hasPagination = mutations.some(hasPaginationInMutation);
1070
- if (hasPagination) calculateHeights();
1071
- });
1072
- if (containerRef.current) observer.observe(containerRef.current, {
1073
- childList: true,
1074
- subtree: true
1075
- });
1076
- globalThis.addEventListener('resize', calculateHeights);
1077
- return ()=>{
1078
- observer.disconnect();
1079
- globalThis.removeEventListener('resize', calculateHeights);
1080
- };
1081
- }, []);
1082
- const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
1083
- scroll: {
1084
- ...children.props?.scroll,
1085
- y: scrollY,
1086
- x: 'max-content'
1087
- }
1088
- }) : children;
1089
- return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
1090
- ref: containerRef,
1091
- className: TableContainer_module.tableContainer,
1092
- children: enhancedChildren
1093
- });
1094
- }
1095
- TableContainer.propTypes = {
1096
- children: external_prop_types_default().element.isRequired
1097
- };
1098
- function FilterContainer({ children, ...props }) {
1099
- const { token } = external_antd_namespaceObject.theme.useToken();
1100
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
1101
- styles: {
1102
- body: {
1103
- padding: token['paddingXS'] + 'px'
1104
- }
1105
- },
1106
- ...props,
1107
- children: children
1108
- });
1109
- }
1110
- FilterContainer.propTypes = {
1111
- children: external_prop_types_default().node.isRequired,
1112
- ...external_antd_namespaceObject.Card.propTypes
1193
+ LoggedMainContainer.propTypes = {
1194
+ children: external_prop_types_default().node.isRequired
1113
1195
  };
1114
1196
  const Login_module = {
1115
1197
  containerRow: "containerRow-lnjnDt",
@@ -1122,8 +1204,8 @@ var __webpack_exports__ = {};
1122
1204
  loginHeader: "loginHeader-bBGO5B"
1123
1205
  };
1124
1206
  function LoginContainer({ title, children }) {
1125
- const config = (0, external_react_.useContext)(CodebitConfigContext);
1126
- if (!config) throw new Error('Login must be used within CodebitConfigProvider');
1207
+ const config = (0, external_react_.useContext)(CodebitThemeContext);
1208
+ if (!config) throw new Error('Login must be used within CodebitThemeContext');
1127
1209
  const { t } = useCodebitWebAntdTranslation();
1128
1210
  const classList = [
1129
1211
  Login_module.loginCard
@@ -1183,7 +1265,7 @@ var __webpack_exports__ = {};
1183
1265
  ]).isRequired,
1184
1266
  children: external_prop_types_default().node
1185
1267
  };
1186
- const logger = new codebit_web_namespaceObject.Logger('Login');
1268
+ const Login_logger = new codebit_web_namespaceObject.Logger('Login');
1187
1269
  const LocalLoginAuthenticationResult = Object.freeze({
1188
1270
  INVALID_EMAIL: 'INVALID_EMAIL',
1189
1271
  INVALID_PASSWORD: 'INVALID_PASSWORD',
@@ -1268,7 +1350,7 @@ var __webpack_exports__ = {};
1268
1350
  });
1269
1351
  break;
1270
1352
  default:
1271
- logger.warn('Unhandled authentication result:', result);
1353
+ Login_logger.warn('Unhandled authentication result:', result);
1272
1354
  modal.error({
1273
1355
  title: t('Login.authenticationFailed'),
1274
1356
  content: t('Common.genericError'),
@@ -1276,7 +1358,7 @@ var __webpack_exports__ = {};
1276
1358
  });
1277
1359
  }
1278
1360
  } catch (error) {
1279
- logger.error(error);
1361
+ Login_logger.error(error);
1280
1362
  react_namespaceObject.captureException(error);
1281
1363
  modal.error({
1282
1364
  title: t('Login.errorTitle'),
@@ -1597,63 +1679,11 @@ var __webpack_exports__ = {};
1597
1679
  navigateToLogin: external_prop_types_default().func,
1598
1680
  submitRecoveryPassword: external_prop_types_default().func.isRequired
1599
1681
  };
1600
- const CodebitTheme = (props)=>{
1601
- const { token } = external_antd_namespaceObject.theme.useToken();
1602
- const config = (0, external_react_.useContext)(CodebitConfigContext);
1603
- if (!config) throw new Error('CodebitTheme must be used within CodebitConfigProvider');
1604
- const { isDarkMode } = config;
1605
- (0, external_react_.useEffect)(()=>{
1606
- const rootElement = document.getElementById('root');
1607
- if (isDarkMode) {
1608
- document.body.classList.add('dark-theme');
1609
- rootElement.classList.add('dark-theme');
1610
- } else {
1611
- document.body.classList.remove('dark-theme');
1612
- rootElement.classList.remove('dark-theme');
1613
- }
1614
- document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
1615
- }, [
1616
- isDarkMode,
1617
- token.colorBgContainer
1618
- ]);
1619
- return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.ConfigProvider, {
1620
- theme: {
1621
- algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
1622
- token: {
1623
- colorPrimary: isDarkMode ? '#589C75' : '#29D266',
1624
- colorInfo: isDarkMode ? '#589C75' : '#29D266',
1625
- colorLink: isDarkMode ? '#589C75' : '#29D266'
1626
- },
1627
- components: {
1628
- Menu: {
1629
- itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
1630
- itemSelectedColor: '#FAFAFA',
1631
- darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
1632
- darkItemSelectedColor: '#FAFAFA'
1633
- },
1634
- Button: {
1635
- colorPrimary: isDarkMode ? '#589C75' : '#29D266',
1636
- colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
1637
- colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
1638
- },
1639
- Layout: {
1640
- siderBg: isDarkMode ? '#1a1a1a' : '#001529',
1641
- triggerBg: isDarkMode ? '#589C75' : '#29D266',
1642
- triggerColor: '#FAFAFA'
1643
- },
1644
- Header: {
1645
- colorPrimary: isDarkMode ? '#589C75' : '#29D266'
1646
- }
1647
- }
1648
- },
1649
- ...props
1650
- });
1651
- };
1652
- CodebitTheme.propTypes = {};
1653
1682
  })();
1654
1683
  exports.CodebitConfigContext = __webpack_exports__.CodebitConfigContext;
1655
1684
  exports.CodebitConfigProvider = __webpack_exports__.CodebitConfigProvider;
1656
- exports.CodebitTheme = __webpack_exports__.CodebitTheme;
1685
+ exports.CodebitThemeContext = __webpack_exports__.CodebitThemeContext;
1686
+ exports.CodebitThemeProvider = __webpack_exports__.CodebitThemeProvider;
1657
1687
  exports.CssTokenBridge = __webpack_exports__.CssTokenBridge;
1658
1688
  exports.ErrorRetry = __webpack_exports__.ErrorRetry;
1659
1689
  exports.FilterContainer = __webpack_exports__.FilterContainer;
@@ -1667,10 +1697,11 @@ exports.Login = __webpack_exports__.Login;
1667
1697
  exports.LoginContainer = __webpack_exports__.LoginContainer;
1668
1698
  exports.TableContainer = __webpack_exports__.TableContainer;
1669
1699
  exports.ThemeToggle = __webpack_exports__.ThemeToggle;
1670
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
1700
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
1671
1701
  "CodebitConfigContext",
1672
1702
  "CodebitConfigProvider",
1673
- "CodebitTheme",
1703
+ "CodebitThemeContext",
1704
+ "CodebitThemeProvider",
1674
1705
  "CssTokenBridge",
1675
1706
  "ErrorRetry",
1676
1707
  "FilterContainer",
@@ -1684,7 +1715,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
1684
1715
  "LoginContainer",
1685
1716
  "TableContainer",
1686
1717
  "ThemeToggle"
1687
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
1718
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
1688
1719
  Object.defineProperty(exports, '__esModule', {
1689
1720
  value: true
1690
1721
  });