@owp/core 2.5.34 → 2.5.35

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 (108) hide show
  1. package/dist/_virtual/index3.js +2 -2
  2. package/dist/_virtual/index4.js +2 -2
  3. package/dist/components/OwpAutoLogoutDialog/OwpAutoLogoutDialog.js +68 -62
  4. package/dist/components/OwpAutoLogoutDialog/OwpAutoLogoutDialog.js.map +1 -1
  5. package/dist/components/OwpDialog/OwpAlertDialog.js +19 -18
  6. package/dist/components/OwpDialog/OwpAlertDialog.js.map +1 -1
  7. package/dist/components/OwpDialog/OwpDialog.js +34 -31
  8. package/dist/components/OwpDialog/OwpDialog.js.map +1 -1
  9. package/dist/components/OwpDialog/internal/useDialogOpenFocusCleanup.js +18 -0
  10. package/dist/components/OwpDialog/internal/useDialogOpenFocusCleanup.js.map +1 -0
  11. package/dist/components/OwpErrorBoundary/OwpErrorBoundary.js +25 -15
  12. package/dist/components/OwpErrorBoundary/OwpErrorBoundary.js.map +1 -1
  13. package/dist/components/OwpLayout/OwpLayout.js.map +1 -1
  14. package/dist/components/OwpNumberField/OwpNumberField.js +45 -24
  15. package/dist/components/OwpNumberField/OwpNumberField.js.map +1 -1
  16. package/dist/components/OwpScrollbars/OwpScrollbars.js +79 -52
  17. package/dist/components/OwpScrollbars/OwpScrollbars.js.map +1 -1
  18. package/dist/components/OwpSelectorBase/OwpSelectorAutocomplete.js +157 -157
  19. package/dist/components/OwpSelectorBase/OwpSelectorAutocomplete.js.map +1 -1
  20. package/dist/components/OwpTable/OwpDataTable.js +377 -342
  21. package/dist/components/OwpTable/OwpDataTable.js.map +1 -1
  22. package/dist/components/OwpTable/OwpTable.js +20 -19
  23. package/dist/components/OwpTable/OwpTable.js.map +1 -1
  24. package/dist/components/OwpTable/internal/OwpTableBase.js +81 -78
  25. package/dist/components/OwpTable/internal/OwpTableBase.js.map +1 -1
  26. package/dist/components/OwpTable/internal/treeGridTableStyle.js +88 -31
  27. package/dist/components/OwpTable/internal/treeGridTableStyle.js.map +1 -1
  28. package/dist/components/OwpTreeGrid/OwpTreeGrid.js +304 -262
  29. package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
  30. package/dist/components/OwpTreeGrid/internal/treeGridTheme.js +282 -277
  31. package/dist/components/OwpTreeGrid/internal/treeGridTheme.js.map +1 -1
  32. package/dist/configs/layoutConfig.js +0 -6
  33. package/dist/configs/layoutConfig.js.map +1 -1
  34. package/dist/constants/treeGrid.js +59 -46
  35. package/dist/constants/treeGrid.js.map +1 -1
  36. package/dist/constants.js +18 -18
  37. package/dist/constants.js.map +1 -1
  38. package/dist/features/themePreview/dialogs/ThemePreviewDialog.js +15 -15
  39. package/dist/features/themePreview/dialogs/ThemePreviewDialog.js.map +1 -1
  40. package/dist/hooks/internal/useNavbar.js +4 -4
  41. package/dist/hooks/useConfirm.js +1 -1
  42. package/dist/hooks/useConfirm.js.map +1 -1
  43. package/dist/hooks/useOwpDialogs.js +19 -0
  44. package/dist/hooks/useOwpDialogs.js.map +1 -0
  45. package/dist/hooks.js +34 -32
  46. package/dist/hooks.js.map +1 -1
  47. package/dist/index.js +69 -71
  48. package/dist/index.js.map +1 -1
  49. package/dist/layout/Layout.js +23 -27
  50. package/dist/layout/Layout.js.map +1 -1
  51. package/dist/layout/components/layouts/FooterLayout.js.map +1 -1
  52. package/dist/layout/components/menus/PasswordChangeMenu.js +25 -25
  53. package/dist/layout/components/menus/PasswordChangeMenu.js.map +1 -1
  54. package/dist/layout/components/toggles/NavigationSearchToggle.js +1 -1
  55. package/dist/layout/components/toggles/NavigationSearchToggle.js.map +1 -1
  56. package/dist/layout/components/toggles/NavigationShortcutsToggle.js +1 -1
  57. package/dist/layout/components/toggles/NavigationShortcutsToggle.js.map +1 -1
  58. package/dist/layout/components/toggles/ThemePreviewToggle.js +14 -14
  59. package/dist/layout/components/toggles/ThemePreviewToggle.js.map +1 -1
  60. package/dist/node_modules/.pnpm/inko@1.1.1/node_modules/inko/index.js +1 -1
  61. package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/index.js +1 -1
  62. package/dist/owp-app.css +1 -1
  63. package/dist/types/components/OwpAutoLogoutDialog/OwpAutoLogoutDialog.d.ts +5 -3
  64. package/dist/types/components/OwpDialog/OwpAlertDialog.d.ts +1 -1
  65. package/dist/types/components/OwpDialog/internal/useDialogOpenFocusCleanup.d.ts +5 -0
  66. package/dist/types/components/OwpErrorBoundary/OwpErrorBoundary.d.ts +8 -14
  67. package/dist/types/components/OwpNumberField/OwpNumberField.d.ts +18 -4
  68. package/dist/types/components/OwpScrollbars/OwpScrollbars.d.ts +28 -14
  69. package/dist/types/components/OwpTable/internal/OwpTableBase.d.ts +3 -1
  70. package/dist/types/components/OwpTable/internal/treeGridTableStyle.d.ts +61 -2
  71. package/dist/types/components/OwpTreeGrid/internal/treeGridTheme.d.ts +2 -1
  72. package/dist/types/configs/layoutConfig.d.ts +0 -6
  73. package/dist/types/constants/index.d.ts +0 -1
  74. package/dist/types/constants/treeGrid.d.ts +9 -0
  75. package/dist/types/features/themePreview/dialogs/ThemePreviewDialog.d.ts +1 -1
  76. package/dist/types/hooks/index.d.ts +1 -0
  77. package/dist/types/hooks/useOwpDialogs.d.ts +5 -0
  78. package/dist/types/hooks/useOwpSettings.d.ts +0 -6
  79. package/dist/types/index.d.ts +0 -1
  80. package/dist/types/store/atoms/owpSettingsAtoms.d.ts +0 -6
  81. package/dist/types/types/OwpDialogTypes.d.ts +1 -0
  82. package/dist/types/types/OwpRouteTypes.d.ts +25 -0
  83. package/dist/types/types/index.d.ts +2 -0
  84. package/dist/types/utils/index.d.ts +0 -1
  85. package/dist/types/utils/internal/blurActiveElement.d.ts +4 -0
  86. package/dist/utils/internal/blurActiveElement.js +12 -0
  87. package/dist/utils/internal/blurActiveElement.js.map +1 -0
  88. package/dist/utils/{navigationUtils.js → internal/navigationUtils.js} +3 -3
  89. package/dist/utils/internal/navigationUtils.js.map +1 -0
  90. package/dist/utils.js +23 -25
  91. package/dist/utils.js.map +1 -1
  92. package/package.json +1 -1
  93. package/dist/components/OwpEventEmitter/OwpEventEmitter.js +0 -51
  94. package/dist/components/OwpEventEmitter/OwpEventEmitter.js.map +0 -1
  95. package/dist/layout/components/layouts/LeftSideLayout.js +0 -13
  96. package/dist/layout/components/layouts/LeftSideLayout.js.map +0 -1
  97. package/dist/node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/array/some.js +0 -66
  98. package/dist/node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/array/some.js.map +0 -1
  99. package/dist/node_modules/.pnpm/perfect-scrollbar@1.5.6/node_modules/perfect-scrollbar/css/perfect-scrollbar.css +0 -1
  100. package/dist/types/components/OwpEventEmitter/OwpEventEmitter.d.ts +0 -27
  101. package/dist/types/components/OwpEventEmitter/index.d.ts +0 -1
  102. package/dist/types/layout/components/layouts/LeftSideLayout.d.ts +0 -6
  103. package/dist/types/utils/common/OwpUtils.d.ts +0 -119
  104. package/dist/types/utils/common/index.d.ts +0 -1
  105. package/dist/utils/common/OwpUtils.js +0 -196
  106. package/dist/utils/common/OwpUtils.js.map +0 -1
  107. package/dist/utils/navigationUtils.js.map +0 -1
  108. /package/dist/types/utils/{navigationUtils.d.ts → internal/navigationUtils.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- var r = {};
1
+ var o = { exports: {} };
2
2
  export {
3
- r as __exports
3
+ o as __module
4
4
  };
5
5
  //# sourceMappingURL=index3.js.map
@@ -1,5 +1,5 @@
1
- var o = { exports: {} };
1
+ var r = {};
2
2
  export {
3
- o as __module
3
+ r as __exports
4
4
  };
5
5
  //# sourceMappingURL=index4.js.map
@@ -1,85 +1,91 @@
1
- var _ = Object.defineProperty;
2
- var i = (t, o) => _(t, "name", { value: o, configurable: !0 });
1
+ var w = Object.defineProperty;
2
+ var o = (t, i) => w(t, "name", { value: i, configurable: !0 });
3
3
  import { jsx as v } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
4
- import { useConfirm as L } from "../../hooks/useConfirm.js";
5
- import { useOwpTranslation as N } from "../../hooks/useOwpTranslation.js";
6
- import { useStorage as E } from "../../hooks/useStorage.js";
4
+ import { useConfirm as E } from "../../hooks/useConfirm.js";
5
+ import { useOwpTranslation as L } from "../../hooks/useOwpTranslation.js";
6
+ import { useStorage as N } from "../../hooks/useStorage.js";
7
7
  import { Typography as R } from "@mui/material";
8
- import { useState as M, useRef as x, useEffect as O, useCallback as S } from "react";
8
+ import { useState as M, useRef as x, useCallback as O, useEffect as I } from "react";
9
9
  import { useIdleTimer as y } from "../../node_modules/.pnpm/react-idle-timer@5.7.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-idle-timer/dist/index.legacy.esm.js";
10
- import { useNavigate as C, useLocation as D } from "react-router-dom";
11
- import { isNumber as a } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isNumber.js";
10
+ import { useNavigate as A, useLocation as C } from "react-router-dom";
12
11
  import { OwpDialog as b } from "../OwpDialog/OwpDialog.js";
13
- const T = 6e4, A = 36e5, I = "/auth/login";
14
- function P(t) {
15
- return a(t) ? Math.floor(t / 1e3) : "";
12
+ import { isNumber as D } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isNumber.js";
13
+ const P = 6e4, U = 36e5, s = "/auth/login", k = [
14
+ "mousemove",
15
+ "keydown",
16
+ "wheel",
17
+ "DOMMouseScroll",
18
+ "mousewheel",
19
+ "mousedown",
20
+ "touchstart",
21
+ "touchmove",
22
+ "MSPointerDown",
23
+ "MSPointerMove",
24
+ "visibilitychange"
25
+ ];
26
+ function G(t) {
27
+ return D(t) ? Math.max(0, Math.ceil(t / 1e3)) : "";
16
28
  }
17
- i(P, "millisToSeconds");
18
- function J({ timeout: t }) {
19
- const o = C(), { pathname: l } = D(), { t: n } = N(), { confirmInfo: m } = L(), { resetStorage: c } = E(), [r, s] = M(!1), [e, f] = M(null), p = x(!1), { getRemainingTime: g, reset: h } = y({
20
- timeout: t ?? A,
21
- events: [
22
- "mousemove",
23
- "keydown",
24
- "wheel",
25
- "DOMMouseScroll",
26
- "mousewheel",
27
- "mousedown",
28
- "touchstart",
29
- "touchmove",
30
- "MSPointerDown",
31
- "MSPointerMove",
32
- "visibilitychange"
33
- ],
34
- throttle: 500
29
+ o(G, "millisToSeconds");
30
+ function X({ timeout: t }) {
31
+ const i = A(), { pathname: n } = C(), { t: a } = L(), { confirmInfo: f } = E(), { resetStorage: p } = N(), [u, r] = M(!1), [S, e] = M(null), l = x(!1), T = O(async () => {
32
+ l.current || (l.current = !0, e(null), r(!1), await f({
33
+ title: a("Message.로그인 페이지로 이동합니다.")
34
+ }), p(), i(s, { replace: !0 }));
35
+ }, [f, i, p, a]), g = t ?? U, { getRemainingTime: c, reset: h } = y({
36
+ timeout: g,
37
+ promptBeforeIdle: Math.min(g, P),
38
+ events: k,
39
+ throttle: 500,
40
+ disabled: n === s,
41
+ onPrompt: /* @__PURE__ */ o((d, m) => {
42
+ n === s || l.current || (e((m == null ? void 0 : m.getRemainingTime()) ?? null), r(!0));
43
+ }, "onPrompt"),
44
+ onIdle: /* @__PURE__ */ o(() => {
45
+ n !== s && T();
46
+ }, "onIdle"),
47
+ onActive: /* @__PURE__ */ o(() => {
48
+ e(null), r(!1);
49
+ }, "onActive")
35
50
  });
36
- O(() => {
37
- const w = setInterval(() => {
38
- f(g());
39
- }, 500);
51
+ I(() => {
52
+ if (!u)
53
+ return;
54
+ e(c());
55
+ const d = setInterval(() => {
56
+ e(c());
57
+ }, 1e3);
40
58
  return () => {
41
- clearInterval(w);
59
+ clearInterval(d);
42
60
  };
43
- }, [g]);
44
- const u = S(() => {
45
- s(!1), h();
46
- }, [h]), d = S(async () => {
47
- p.current || (p.current = !0, f(null), s(!1), await m({
48
- title: n("Message.로그인 페이지로 이동합니다.")
49
- }), c(), o(I));
50
- }, [m, o, c, n]);
51
- return O(() => {
52
- if (l === I) {
53
- s(!1);
54
- return;
55
- }
56
- if (!r && a(e) && e > 0 && e <= T) {
57
- s(!0);
58
- return;
59
- }
60
- if (r && a(e) && e > T) {
61
- u();
61
+ }, [c, u]);
62
+ const _ = O(() => {
63
+ r(!1), e(null), h();
64
+ }, [h]);
65
+ return I(() => {
66
+ if (n === s) {
67
+ e(null), r(!1);
62
68
  return;
63
69
  }
64
- a(e) && e <= 0 && d();
65
- }, [r, e, l, u, d]), /* @__PURE__ */ v(
70
+ l.current = !1;
71
+ }, [n]), /* @__PURE__ */ v(
66
72
  b,
67
73
  {
68
- title: n("Title.로그인 연장"),
74
+ title: a("Title.로그인 연장"),
69
75
  canConfirm: !1,
70
- open: r,
71
- onClose: /* @__PURE__ */ i(() => u(), "onClose"),
76
+ open: u,
77
+ onClose: _,
72
78
  maxWidth: "xs",
73
79
  fullWidth: !0,
74
- children: /* @__PURE__ */ v(R, { variant: "h6", children: n("Message.자동 로그아웃 남은 시간 안내", {
80
+ children: /* @__PURE__ */ v(R, { variant: "h6", children: a("Message.자동 로그아웃 남은 시간 안내", {
75
81
  defaultValue: "{{seconds}}초 후 로그인 페이지로 이동합니다.",
76
- seconds: P(e)
82
+ seconds: G(S)
77
83
  }) })
78
84
  }
79
85
  );
80
86
  }
81
- i(J, "OwpAutoLogoutDialog");
87
+ o(X, "OwpAutoLogoutDialog");
82
88
  export {
83
- J as OwpAutoLogoutDialog
89
+ X as OwpAutoLogoutDialog
84
90
  };
85
91
  //# sourceMappingURL=OwpAutoLogoutDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OwpAutoLogoutDialog.js","sources":["../../../src/components/OwpAutoLogoutDialog/OwpAutoLogoutDialog.tsx"],"sourcesContent":["import { OwpDialog } from '@/components/OwpDialog';\nimport { useConfirm } from '@/hooks/useConfirm';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { useStorage } from '@/hooks/useStorage';\nimport { Typography } from '@mui/material';\nimport { isNumber } from 'es-toolkit/compat';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useIdleTimer } from 'react-idle-timer/legacy';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nconst ONE_MINUTE_TO_MILLIS = 60000;\nconst ONE_HOUR_TO_MILLIS = 3600000;\n\nconst LOGIN_PATH_NAME = '/auth/login';\n\n/**\n * 밀리초 초 단위 변환\n * @param millis 밀리초\n */\nfunction millisToSeconds(millis: number | null) {\n if (!isNumber(millis)) {\n return '';\n }\n\n return Math.floor(millis / 1000);\n}\n/**\n * OwpAutoLogoutDialog 컴포넌트\n * @param timeout 자동 로그아웃 시간(ms)\n */\nexport function OwpAutoLogoutDialog({ timeout }: { timeout?: number }) {\n const navigate = useNavigate();\n const { pathname } = useLocation();\n const { t } = useOwpTranslation();\n const { confirmInfo } = useConfirm();\n const { resetStorage } = useStorage();\n const [open, setOpenStatus] = useState(false);\n const [remaining, setRemaining] = useState<number | null>(null);\n const isRedirectingRef = useRef(false);\n const { getRemainingTime, reset } = useIdleTimer({\n timeout: timeout ?? ONE_HOUR_TO_MILLIS,\n events: [\n 'mousemove',\n 'keydown',\n 'wheel',\n 'DOMMouseScroll',\n 'mousewheel',\n 'mousedown',\n 'touchstart',\n 'touchmove',\n 'MSPointerDown',\n 'MSPointerMove',\n 'visibilitychange',\n ],\n throttle: 500,\n });\n\n useEffect(() => {\n const interval = setInterval(() => {\n setRemaining(getRemainingTime());\n }, 500);\n\n return () => {\n clearInterval(interval);\n };\n }, [getRemainingTime]);\n\n const handleClose = useCallback(() => {\n setOpenStatus(false);\n reset();\n }, [reset]);\n\n \n const handleSessionExpired = useCallback(async () => {\n if (isRedirectingRef.current) {\n return;\n }\n\n isRedirectingRef.current = true;\n setRemaining(null);\n setOpenStatus(false);\n\n await confirmInfo({\n title: t('Message.로그인 페이지로 이동합니다.'),\n });\n\n resetStorage();\n navigate(LOGIN_PATH_NAME);\n }, [confirmInfo, navigate, resetStorage, t]);\n\n useEffect(() => {\n if (pathname === LOGIN_PATH_NAME) {\n setOpenStatus(false);\n return;\n }\n\n if (!open && isNumber(remaining) && remaining > 0 && remaining <= ONE_MINUTE_TO_MILLIS) {\n setOpenStatus(true);\n return;\n }\n\n if (open && isNumber(remaining) && remaining > ONE_MINUTE_TO_MILLIS) {\n handleClose();\n return;\n }\n\n if (isNumber(remaining) && remaining <= 0) {\n void handleSessionExpired();\n }\n }, [open, remaining, pathname, handleClose, handleSessionExpired]);\n\n return (\n <OwpDialog\n title={t('Title.로그인 연장')}\n canConfirm={false}\n open={open}\n onClose={() => handleClose()}\n maxWidth=\"xs\"\n fullWidth\n >\n <Typography variant=\"h6\">\n {t('Message.자동 로그아웃 남은 시간 안내', {\n defaultValue: '{{seconds}}초 후 로그인 페이지로 이동합니다.',\n seconds: millisToSeconds(remaining),\n })}\n </Typography>\n </OwpDialog>\n );\n}\n"],"names":["ONE_MINUTE_TO_MILLIS","ONE_HOUR_TO_MILLIS","LOGIN_PATH_NAME","millisToSeconds","millis","isNumber","__name","OwpAutoLogoutDialog","timeout","navigate","useNavigate","pathname","useLocation","t","useOwpTranslation","confirmInfo","useConfirm","resetStorage","useStorage","open","setOpenStatus","useState","remaining","setRemaining","isRedirectingRef","useRef","getRemainingTime","reset","useIdleTimer","useEffect","interval","handleClose","useCallback","handleSessionExpired","jsx","OwpDialog","Typography"],"mappings":";;;;;;;;;;;;AAUA,MAAMA,IAAuB,KACvBC,IAAqB,MAErBC,IAAkB;AAMxB,SAASC,EAAgBC,GAAuB;AAC9C,SAAKC,EAASD,CAAM,IAIb,KAAK,MAAMA,IAAS,GAAI,IAHtB;AAIX;AANSE,EAAAH,GAAA;AAWF,SAASI,EAAoB,EAAE,SAAAC,KAAiC;AACrE,QAAMC,IAAWC,EAAA,GACX,EAAE,UAAAC,EAAA,IAAaC,EAAA,GACf,EAAE,GAAAC,EAAA,IA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AoB,EAAc,EAAI;AAClB;AAAA,IACF;AAEA,QAAID,KAAQd,EAASiB,CAAS,KAAKA,IAAYtB,GAAsB;AACnE,MAAA+B,EAAA;AACA;AAAA,IACF;AAEA,IAAI1B,EAASiB,CAAS,KAAKA,KAAa,KACjCW,EAAA;AAAA,EAET,GAAG,CAACd,GAAMG,GAAWX,GAAUoB,GAAaE,CAAoB,CAAC,GAG/D,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAOtB,EAAE,cAAc;AAAA,MACvB,YAAY;AAAA,MACZ,MAAAM;AAAA,MACA,SAAS,gBAAAb,EAAA,MAAMyB,EAAA,GAAN;AAAA,MACT,UAAS;AAAA,MACT,WAAS;AAAA,MAET,UAAA,gBAAAG,EAACE,GAAA,EAAW,SAAQ,MACjB,YAAE,4BAA4B;AAAA,QAC7B,cAAc;AAAA,QACd,SAASjC,EAAgBmB,CAAS;AAAA,MAAA,CACnC,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAlGgBhB,EAAAC,GAAA;"}
1
+ {"version":3,"file":"OwpAutoLogoutDialog.js","sources":["../../../src/components/OwpAutoLogoutDialog/OwpAutoLogoutDialog.tsx"],"sourcesContent":["import { OwpDialog } from '@/components/OwpDialog';\nimport { useConfirm } from '@/hooks/useConfirm';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { useStorage } from '@/hooks/useStorage';\nimport { Typography } from '@mui/material';\nimport { isNumber } from 'es-toolkit/compat';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { useIdleTimer, type IIdleTimerProps } from 'react-idle-timer/legacy';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nconst ONE_MINUTE_TO_MILLIS = 60000;\nconst ONE_HOUR_TO_MILLIS = 3600000;\n\nconst LOGIN_PATH_NAME = '/auth/login';\nconst AUTO_LOGOUT_EVENTS: NonNullable<IIdleTimerProps['events']> = [\n 'mousemove',\n 'keydown',\n 'wheel',\n 'DOMMouseScroll',\n 'mousewheel',\n 'mousedown',\n 'touchstart',\n 'touchmove',\n 'MSPointerDown',\n 'MSPointerMove',\n 'visibilitychange',\n];\n\ntype OwpAutoLogoutDialogProps = { timeout?: number };\n\n/**\n * 밀리초 초 단위 변환\n * @param millis 밀리초\n */\nfunction millisToSeconds(millis: number | null) {\n if (!isNumber(millis)) {\n return '';\n }\n\n return Math.max(0, Math.ceil(millis / 1000));\n}\n/**\n * OwpAutoLogoutDialog 컴포넌트\n * @param timeout 자동 로그아웃 시간(ms)\n */\nexport function OwpAutoLogoutDialog({ timeout }: OwpAutoLogoutDialogProps) {\n const navigate = useNavigate();\n const { pathname } = useLocation();\n const { t } = useOwpTranslation();\n const { confirmInfo } = useConfirm();\n const { resetStorage } = useStorage();\n const [open, setOpenStatus] = useState(false);\n const [remaining, setRemaining] = useState<number | null>(null);\n const isRedirectingRef = useRef(false);\n\n const handleSessionExpired = useCallback(async () => {\n if (isRedirectingRef.current) {\n return;\n }\n\n isRedirectingRef.current = true;\n setRemaining(null);\n setOpenStatus(false);\n\n await confirmInfo({\n title: t('Message.로그인 페이지로 이동합니다.'),\n });\n\n resetStorage();\n navigate(LOGIN_PATH_NAME, { replace: true });\n }, [confirmInfo, navigate, resetStorage, t]);\n\n const resolvedTimeout = timeout ?? ONE_HOUR_TO_MILLIS;\n const { getRemainingTime, reset } = useIdleTimer({\n timeout: resolvedTimeout,\n promptBeforeIdle: Math.min(resolvedTimeout, ONE_MINUTE_TO_MILLIS),\n events: AUTO_LOGOUT_EVENTS,\n throttle: 500,\n disabled: pathname === LOGIN_PATH_NAME,\n onPrompt: (_event, idleTimer) => {\n if (pathname === LOGIN_PATH_NAME || isRedirectingRef.current) {\n return;\n }\n\n setRemaining(idleTimer?.getRemainingTime() ?? null);\n setOpenStatus(true);\n },\n onIdle: () => {\n if (pathname === LOGIN_PATH_NAME) {\n return;\n }\n\n void handleSessionExpired();\n },\n onActive: () => {\n setRemaining(null);\n setOpenStatus(false);\n },\n });\n\n useEffect(() => {\n if (!open) {\n return;\n }\n\n setRemaining(getRemainingTime());\n\n const interval = setInterval(() => {\n setRemaining(getRemainingTime());\n }, 1000);\n\n return () => {\n clearInterval(interval);\n };\n }, [getRemainingTime, open]);\n\n const handleClose = useCallback(() => {\n setOpenStatus(false);\n setRemaining(null);\n reset();\n }, [reset]);\n\n useEffect(() => {\n if (pathname === LOGIN_PATH_NAME) {\n setRemaining(null);\n setOpenStatus(false);\n return;\n }\n\n isRedirectingRef.current = false;\n }, [pathname]);\n\n return (\n <OwpDialog\n title={t('Title.로그인 연장')}\n canConfirm={false}\n open={open}\n onClose={handleClose}\n maxWidth=\"xs\"\n fullWidth\n >\n <Typography variant=\"h6\">\n {t('Message.자동 로그아웃 남은 시간 안내', {\n defaultValue: '{{seconds}}초 후 로그인 페이지로 이동합니다.',\n seconds: millisToSeconds(remaining),\n })}\n </Typography>\n </OwpDialog>\n );\n}\n"],"names":["ONE_MINUTE_TO_MILLIS","ONE_HOUR_TO_MILLIS","LOGIN_PATH_NAME","AUTO_LOGOUT_EVENTS","millisToSeconds","millis","isNumber","__name","OwpAutoLogoutDialog","timeout","navigate","useNavigate","pathname","useLocation","t","useOwpTranslation","confirmInfo","useConfirm","resetStorage","useStorage","open","setOpenStatus","useState","remaining","setRemaining","isRedirectingRef","useRef","handleSessionExpired","useCallback","resolvedTimeout","getRemainingTime","reset","useIdleTimer","_event","idleTimer","useEffect","interval","handleClose","jsx","OwpDialog","Typography"],"mappings":";;;;;;;;;;;;AAUA,MAAMA,IAAuB,KACvBC,IAAqB,MAErBC,IAAkB,eAClBC,IAA6D;AAAA,EACjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAQA,SAASC,EAAgBC,GAAuB;AAC9C,SAAKC,EAASD,CAAM,IAIb,KAAK,IAAI,GAAG,KAAK,KAAKA,IAAS,GAAI,CAAC,IAHlC;AAIX;AAN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AHU;AAAA,EAGV,CACD;AAED,EAAAc,EAAU,MAAM;AACd,QAAI,CAACf;AACH;AAGF,IAAAI,EAAaM,GAAkB;AAE/B,UAAMM,IAAW,YAAY,MAAM;AACjC,MAAAZ,EAAaM,GAAkB;AAAA,IACjC,GAAG,GAAI;AAEP,WAAO,MAAM;AACX,oBAAcM,CAAQ;AAAA,IACxB;AAAA,EACF,GAAG,CAACN,GAAkBV,CAAI,CAAC;AAE3B,QAAMiB,IAAcT,EAAY,MAAM;AACpC,IAAAP,EAAc,EAAK,GACnBG,EAAa,IAAI,GACjBO,EAAA;AAAA,EACF,GAAG,CAACA,CAAK,CAAC;AAEV,SAAAI,EAAU,MAAM;AACd,QAAIvB,MAAaV,GAAiB;AAChC,MAAAsB,EAAa,IAAI,GACjBH,EAAc,EAAK;AACnB;AAAA,IACF;AAEA,IAAAI,EAAiB,UAAU;AAAA,EAC7B,GAAG,CAACb,CAAQ,CAAC,GAGX,gBAAA0B;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAOzB,EAAE,cAAc;AAAA,MACvB,YAAY;AAAA,MACZ,MAAAM;AAAA,MACA,SAASiB;AAAA,MACT,UAAS;AAAA,MACT,WAAS;AAAA,MAET,UAAA,gBAAAC,EAACE,GAAA,EAAW,SAAQ,MACjB,YAAE,4BAA4B;AAAA,QAC7B,cAAc;AAAA,QACd,SAASpC,EAAgBmB,CAAS;AAAA,MAAA,CACnC,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAxGgBhB,EAAAC,GAAA;"}
@@ -1,36 +1,37 @@
1
1
  var f = Object.defineProperty;
2
- var i = (t, r) => f(t, "name", { value: r, configurable: !0 });
3
- import { jsxs as s, jsx as e } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
2
+ var e = (t, o) => f(t, "name", { value: o, configurable: !0 });
3
+ import { jsxs as s, jsx as i } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
4
4
  import { useOwpTranslation as D } from "../../hooks/useOwpTranslation.js";
5
- import { DialogActions as T, Button as a, Dialog as k, DialogTitle as v, DialogContentText as B, DialogContent as b } from "@mui/material";
6
- const p = /* @__PURE__ */ i(({
5
+ import { DialogActions as T, Button as a, Dialog as v, DialogTitle as k, DialogContentText as B, DialogContent as O } from "@mui/material";
6
+ import { useDialogOpenFocusCleanup as b } from "./internal/useDialogOpenFocusCleanup.js";
7
+ const C = /* @__PURE__ */ e(({
7
8
  payload: t,
8
- open: r,
9
- onClose: o
9
+ open: o,
10
+ onClose: r
10
11
  }) => {
11
- const { title: n, description: l, okButtonProps: d, cancelButtonProps: g, severity: u, useInfo: x } = t, { t: c } = D(), h = (t == null ? void 0 : t.okText) ?? c("Button.확인"), m = (t == null ? void 0 : t.cancelText) ?? c("Button.취소");
12
+ const { title: n, description: l, okButtonProps: d, cancelButtonProps: u, severity: g, useInfo: m } = t, { t: c } = D(), x = b(o), h = (t == null ? void 0 : t.okText) ?? c("Button.확인"), p = (t == null ? void 0 : t.cancelText) ?? c("Button.취소");
12
13
  return /* @__PURE__ */ s(
13
- k,
14
+ v,
14
15
  {
15
16
  fullWidth: !0,
16
17
  maxWidth: "xs",
17
- open: r,
18
- onClose: /* @__PURE__ */ i(() => o(!1), "onClose"),
18
+ open: x,
19
+ onClose: /* @__PURE__ */ e(() => r(!1), "onClose"),
19
20
  role: "alertdialog",
20
21
  "aria-labelledby": n ? "alert-dialog-title" : void 0,
21
22
  "aria-describedby": l ? "alert-dialog-description" : void 0,
22
23
  children: [
23
- n && /* @__PURE__ */ e(v, { id: "alert-dialog-title", children: n }),
24
- l && /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(B, { id: "alert-dialog-description", children: l }) }),
24
+ n && /* @__PURE__ */ i(k, { id: "alert-dialog-title", children: n }),
25
+ l && /* @__PURE__ */ i(O, { children: /* @__PURE__ */ i(B, { id: "alert-dialog-description", children: l }) }),
25
26
  /* @__PURE__ */ s(T, { children: [
26
- !x && /* @__PURE__ */ e(a, { ...g, variant: "outlined", onClick: /* @__PURE__ */ i(() => o(!1), "onClick"), children: m }),
27
- /* @__PURE__ */ e(
27
+ !m && /* @__PURE__ */ i(a, { ...u, variant: "outlined", onClick: /* @__PURE__ */ e(() => r(!1), "onClick"), children: p }),
28
+ /* @__PURE__ */ i(
28
29
  a,
29
30
  {
30
- color: u ?? "primary",
31
+ color: g ?? "primary",
31
32
  variant: "contained",
32
33
  ...d,
33
- onClick: /* @__PURE__ */ i(() => o(!0), "onClick"),
34
+ onClick: /* @__PURE__ */ e(() => r(!0), "onClick"),
34
35
  children: h
35
36
  }
36
37
  )
@@ -39,8 +40,8 @@ const p = /* @__PURE__ */ i(({
39
40
  }
40
41
  );
41
42
  }, "OwpAlertDialog");
42
- p.displayName = "OwpAlertDialog";
43
+ C.displayName = "OwpAlertDialog";
43
44
  export {
44
- p as OwpAlertDialog
45
+ C as OwpAlertDialog
45
46
  };
46
47
  //# sourceMappingURL=OwpAlertDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OwpAlertDialog.js","sources":["../../../src/components/OwpDialog/OwpAlertDialog.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n} from '@mui/material';\nimport type { ButtonProps } from '@mui/material';\nimport type { DialogProps } from '@toolpad/core/useDialogs';\nimport type { ReactNode } from 'react';\n\nexport type OwpAlertDialogSeverity =\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n\nexport interface OwpAlertDialogPayload {\n title?: ReactNode | string;\n description?: ReactNode | string;\n okText?: string;\n cancelText?: string;\n severity?: OwpAlertDialogSeverity;\n useInfo?: boolean;\n okButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n}\n\n/**\n * 경고성 확인 대화상자 컴포넌트\n * @param payload 대화상자 표시 속성\n * @param open 열림 여부\n * @param onClose 닫힘 핸들러\n */\nconst OwpAlertDialog = ({\n payload,\n open,\n onClose,\n}: DialogProps<OwpAlertDialogPayload, boolean>) => {\n const { title, description, okButtonProps, cancelButtonProps, severity, useInfo } = payload;\n const { t } = useOwpTranslation();\n\n const okText = payload?.okText ?? t('Button.확인');\n const cancelText = payload?.cancelText ?? t('Button.취소');\n\n return (\n <Dialog\n fullWidth\n maxWidth=\"xs\"\n open={open}\n onClose={() => onClose(false)}\n role=\"alertdialog\"\n aria-labelledby={title ? 'alert-dialog-title' : undefined}\n aria-describedby={description ? 'alert-dialog-description' : undefined}\n >\n {title && <DialogTitle id=\"alert-dialog-title\">{title}</DialogTitle>}\n {description && (\n <DialogContent>\n <DialogContentText id=\"alert-dialog-description\">{description}</DialogContentText>\n </DialogContent>\n )}\n <DialogActions>\n {!useInfo && (\n <Button {...cancelButtonProps} variant=\"outlined\" onClick={() => onClose(false)}>\n {cancelText}\n </Button>\n )}\n <Button\n color={severity ?? 'primary'}\n variant=\"contained\"\n {...okButtonProps}\n onClick={() => onClose(true)}\n >\n {okText}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\nOwpAlertDialog.displayName = 'OwpAlertDialog';\n\nexport { OwpAlertDialog };\n"],"names":["OwpAlertDialog","__name","payload","open","onClose","title","description","okButtonProps","cancelButtonProps","severity","useInfo","t","useOwpTranslation","okText","cancelText","jsxs","Dialog","jsx","DialogTitle","DialogContent","DialogContentText","DialogActions","Button"],"mappings":";;;;;AAsCA,MAAMA,IAAiB,gBAAAC,EAAA,CAAC;AAAA,EACtB,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AACF,MAAmD;AACjD,QAAM,EAAE,OAAAC,GAAO,aAAAC,GAAa,eAAAC,GAAe,mBAAAC,GAAmB,UAAAC,GAAU,SAAAC,MAAYR,GAC9E,EAAE,GAAAS,EAAA,IAAMC,EAAA,GAERC,KAASX,KAAA,gBAAAA,EAAS,WAAUS,EAAE,WAAW,GACzCG,KAAaZ,KAAA,gBAAAA,EAAS,eAAcS,EAAE,WAAW;AAEvD,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAS;AAAA,MACT,UAAS;AAAA,MACT,MAAAb;AAAA,MACA,SAAS,gBAAAF,EAAA,MAAMG,EAAQ,EAAK,GAAnB;AAAA,MACT,MAAK;AAAA,MACL,mBAAiBC,IAAQ,uBAAuB;AAAA,MAChD,oBAAkBC,IAAc,6BAA6B;AAAA,MAE5D,UAAA;AAAA,QAAAD,KAAS,gBAAAY,EAACC,GAAA,EAAY,IAAG,sBAAsB,UAAAb,GAAM;AAAA,QACrDC,uBACEa,GAAA,EACC,UAAA,gBAAAF,EAACG,KAAkB,IAAG,4BAA4B,aAAY,EAAA,CAChE;AAAA,0BAEDC,GAAA,EACE,UAAA;AAAA,UAAA,CAACX,KACA,gBAAAO,EAACK,GAAA,EAAQ,GAAGd,GAAmB,SAAQ,YAAW,SAAS,gBAAAP,EAAA,MAAMG,EAAQ,EAAK,GAAnB,YACxD,UAAAU,EAAA,CACH;AAAA,UAEF,gBAAAG;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,OAAOb,KAAY;AAAA,cACnB,SAAQ;AAAA,cACP,GAAGF;AAAA,cACJ,SAAS,gBAAAN,EAAA,MAAMG,EAAQ,EAAI,GAAlB;AAAA,cAER,UAAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,GA5CuB;AA8CvBb,EAAe,cAAc;"}
1
+ {"version":3,"file":"OwpAlertDialog.js","sources":["../../../src/components/OwpDialog/OwpAlertDialog.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport type { DialogProps } from '@/types/OwpDialogTypes';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n} from '@mui/material';\nimport type { ButtonProps } from '@mui/material';\nimport type { ReactNode } from 'react';\nimport { useDialogOpenFocusCleanup } from './internal/useDialogOpenFocusCleanup';\n\nexport type OwpAlertDialogSeverity =\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n\nexport interface OwpAlertDialogPayload {\n title?: ReactNode | string;\n description?: ReactNode | string;\n okText?: string;\n cancelText?: string;\n severity?: OwpAlertDialogSeverity;\n useInfo?: boolean;\n okButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n}\n\n/**\n * 경고성 확인 대화상자 컴포넌트\n * @param payload 대화상자 표시 속성\n * @param open 열림 여부\n * @param onClose 닫힘 핸들러\n */\nconst OwpAlertDialog = ({\n payload,\n open,\n onClose,\n}: DialogProps<OwpAlertDialogPayload, boolean>) => {\n const { title, description, okButtonProps, cancelButtonProps, severity, useInfo } = payload;\n const { t } = useOwpTranslation();\n const resolvedOpen = useDialogOpenFocusCleanup(open);\n\n const okText = payload?.okText ?? t('Button.확인');\n const cancelText = payload?.cancelText ?? t('Button.취소');\n\n return (\n <Dialog\n fullWidth\n maxWidth=\"xs\"\n open={resolvedOpen}\n onClose={() => onClose(false)}\n role=\"alertdialog\"\n aria-labelledby={title ? 'alert-dialog-title' : undefined}\n aria-describedby={description ? 'alert-dialog-description' : undefined}\n >\n {title && <DialogTitle id=\"alert-dialog-title\">{title}</DialogTitle>}\n {description && (\n <DialogContent>\n <DialogContentText id=\"alert-dialog-description\">{description}</DialogContentText>\n </DialogContent>\n )}\n <DialogActions>\n {!useInfo && (\n <Button {...cancelButtonProps} variant=\"outlined\" onClick={() => onClose(false)}>\n {cancelText}\n </Button>\n )}\n <Button\n color={severity ?? 'primary'}\n variant=\"contained\"\n {...okButtonProps}\n onClick={() => onClose(true)}\n >\n {okText}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n\nOwpAlertDialog.displayName = 'OwpAlertDialog';\n\nexport { OwpAlertDialog };\n"],"names":["OwpAlertDialog","__name","payload","open","onClose","title","description","okButtonProps","cancelButtonProps","severity","useInfo","t","useOwpTranslation","resolvedOpen","useDialogOpenFocusCleanup","okText","cancelText","jsxs","Dialog","jsx","DialogTitle","DialogContent","DialogContentText","DialogActions","Button"],"mappings":";;;;;;AAuCA,MAAMA,IAAiB,gBAAAC,EAAA,CAAC;AAAA,EACtB,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AACF,MAAmD;AACjD,QAAM,EAAE,OAAAC,GAAO,aAAAC,GAAa,eAAAC,GAAe,mBAAAC,GAAmB,UAAAC,GAAU,SAAAC,MAAYR,GAC9E,EAAE,GAAAS,EAAA,IAAMC,EAAA,GACRC,IAAeC,EAA0BX,CAAI,GAE7CY,KAASb,KAAA,gBAAAA,EAAS,WAAUS,EAAE,WAAW,GACzCK,KAAad,KAAA,gBAAAA,EAAS,eAAcS,EAAE,WAAW;AAEvD,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAS;AAAA,MACT,UAAS;AAAA,MACT,MAAML;AAAA,MACN,SAAS,gBAAAZ,EAAA,MAAMG,EAAQ,EAAK,GAAnB;AAAA,MACT,MAAK;AAAA,MACL,mBAAiBC,IAAQ,uBAAuB;AAAA,MAChD,oBAAkBC,IAAc,6BAA6B;AAAA,MAE5D,UAAA;AAAA,QAAAD,KAAS,gBAAAc,EAACC,GAAA,EAAY,IAAG,sBAAsB,UAAAf,GAAM;AAAA,QACrDC,uBACEe,GAAA,EACC,UAAA,gBAAAF,EAACG,KAAkB,IAAG,4BAA4B,aAAY,EAAA,CAChE;AAAA,0BAEDC,GAAA,EACE,UAAA;AAAA,UAAA,CAACb,KACA,gBAAAS,EAACK,GAAA,EAAQ,GAAGhB,GAAmB,SAAQ,YAAW,SAAS,gBAAAP,EAAA,MAAMG,EAAQ,EAAK,GAAnB,YACxD,UAAAY,EAAA,CACH;AAAA,UAEF,gBAAAG;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,OAAOf,KAAY;AAAA,cACnB,SAAQ;AAAA,cACP,GAAGF;AAAA,cACJ,SAAS,gBAAAN,EAAA,MAAMG,EAAQ,EAAI,GAAlB;AAAA,cAER,UAAAW;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,GA7CuB;AA+CvBf,EAAe,cAAc;"}
@@ -1,49 +1,52 @@
1
- var K = Object.defineProperty;
2
- var n = (e, c) => K(e, "name", { value: c, configurable: !0 });
1
+ var P = Object.defineProperty;
2
+ var n = (e, o) => P(e, "name", { value: o, configurable: !0 });
3
3
  import { jsxs as l, jsx as r } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
4
- import { useOwpTranslation as N } from "../../hooks/useOwpTranslation.js";
5
- import { DialogContent as P, DialogActions as z, Dialog as H, DialogTitle as R, CircularProgress as W, Box as m, Button as y } from "@mui/material";
6
- import { forwardRef as q } from "react";
7
- const E = q(
4
+ import { useOwpTranslation as z } from "../../hooks/useOwpTranslation.js";
5
+ import { DialogContent as F, DialogActions as H, Dialog as R, DialogTitle as W, CircularProgress as q, Box as x, Button as y } from "@mui/material";
6
+ import { forwardRef as E } from "react";
7
+ import { useDialogOpenFocusCleanup as G } from "./internal/useDialogOpenFocusCleanup.js";
8
+ const J = E(
8
9
  ({
9
10
  title: e,
10
- children: c,
11
- loading: o = !1,
11
+ children: o,
12
+ loading: c = !1,
12
13
  alertDialog: h = !1,
13
14
  canCancel: g = !0,
14
15
  canConfirm: s = !0,
15
16
  confirmText: D,
16
17
  cancelText: v,
17
18
  onConfirm: d,
18
- onCancel: f,
19
+ onCancel: p,
19
20
  onClose: t,
21
+ open: w,
20
22
  useSubmit: a,
21
23
  actions: u,
22
- contentProps: w,
23
- role: T,
24
- ...B
24
+ contentProps: T,
25
+ role: B,
26
+ ...O
25
27
  }, k) => {
26
- const { t: p } = N(), b = D ?? p("Button.저장"), j = v ?? p(s ? "Button.취소" : "Button.닫기"), { sx: i, ...A } = w ?? {}, O = [
27
- { position: "relative", minHeight: o ? 120 : void 0 },
28
+ const { t: f } = z(), b = D ?? f("Button.저장"), j = v ?? f(s ? "Button.취소" : "Button.닫기"), A = G(w), { sx: i, ...I } = T ?? {}, K = [
29
+ { position: "relative", minHeight: c ? 120 : void 0 },
28
30
  ...Array.isArray(i) ? i : i ? [i] : []
29
31
  ];
30
32
  return /* @__PURE__ */ l(
31
- H,
33
+ R,
32
34
  {
33
35
  ref: k,
34
36
  fullWidth: !0,
37
+ open: A,
35
38
  component: a ? "form" : void 0,
36
- role: h ? "alertdialog" : T,
37
- onClose: /* @__PURE__ */ n((I, x) => {
38
- x !== "backdropClick" && (t == null || t(I, x));
39
+ role: h ? "alertdialog" : B,
40
+ onClose: /* @__PURE__ */ n((N, m) => {
41
+ m !== "backdropClick" && (t == null || t(N, m));
39
42
  }, "onClose"),
40
- ...B,
43
+ ...O,
41
44
  children: [
42
- e && /* @__PURE__ */ r(R, { children: e }),
43
- /* @__PURE__ */ l(P, { dividers: !0, "aria-busy": o, ...A, sx: O, children: [
44
- c,
45
- o && /* @__PURE__ */ r(
46
- m,
45
+ e && /* @__PURE__ */ r(W, { children: e }),
46
+ /* @__PURE__ */ l(F, { dividers: !0, "aria-busy": c, ...I, sx: K, children: [
47
+ o,
48
+ c && /* @__PURE__ */ r(
49
+ x,
47
50
  {
48
51
  "aria-hidden": "true",
49
52
  sx: {
@@ -54,19 +57,19 @@ const E = q(
54
57
  alignItems: "center",
55
58
  justifyContent: "center"
56
59
  },
57
- children: /* @__PURE__ */ r(W, { color: "secondary" })
60
+ children: /* @__PURE__ */ r(q, { color: "secondary" })
58
61
  }
59
62
  )
60
63
  ] }),
61
- /* @__PURE__ */ l(z, { children: [
62
- u && /* @__PURE__ */ r(m, { className: "flex w-full items-start", children: u }),
64
+ /* @__PURE__ */ l(H, { children: [
65
+ u && /* @__PURE__ */ r(x, { className: "flex w-full items-start", children: u }),
63
66
  g && /* @__PURE__ */ r(
64
67
  y,
65
68
  {
66
69
  variant: "outlined",
67
70
  onClick: /* @__PURE__ */ n(() => {
68
- if (typeof f == "function") {
69
- f();
71
+ if (typeof p == "function") {
72
+ p();
70
73
  return;
71
74
  }
72
75
  t == null || t({}, "escapeKeyDown");
@@ -98,8 +101,8 @@ const E = q(
98
101
  );
99
102
  }
100
103
  );
101
- E.displayName = "OwpDialog";
104
+ J.displayName = "OwpDialog";
102
105
  export {
103
- E as OwpDialog
106
+ J as OwpDialog
104
107
  };
105
108
  //# sourceMappingURL=OwpDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OwpDialog.js","sources":["../../../src/components/OwpDialog/OwpDialog.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n Box,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentProps,\n DialogProps,\n DialogTitle,\n} from '@mui/material';\nimport { forwardRef, ReactNode } from 'react';\n\nexport interface OwpDialogProps extends Omit<DialogProps, 'title'> {\n title?: ReactNode;\n children?: ReactNode;\n loading?: boolean;\n alertDialog?: boolean;\n canConfirm?: boolean;\n canCancel?: boolean;\n confirmText?: string;\n cancelText?: string;\n useSubmit?: boolean;\n actions?: ReactNode;\n contentProps?: DialogContentProps;\n onConfirm?: () => void;\n onCancel?: () => void;\n}\n\n/**\n * OwpDialog 컴포넌트\n * @param title 제목\n * @param children 하위 콘텐츠\n * @param loading 본문 로딩 여부\n * @param alertDialog alertdialog role 적용 여부\n * @param canCancel canCancel 값\n * @param canConfirm canConfirm 값\n * @param onConfirm onConfirm 핸들러\n * @param onCancel onCancel 핸들러\n */\nconst OwpDialog = forwardRef<HTMLDivElement, OwpDialogProps>(\n (\n {\n title,\n children,\n loading = false,\n alertDialog = false,\n canCancel = true,\n canConfirm = true,\n confirmText: confirmTextProp,\n cancelText: cancelTextProp,\n onConfirm,\n onCancel,\n onClose,\n useSubmit,\n actions,\n contentProps,\n role: roleProp,\n ...dialogProps\n },\n ref,\n ) => {\n const { t } = useOwpTranslation();\n const confirmText = confirmTextProp ?? t('Button.저장');\n const cancelText = cancelTextProp ?? t(canConfirm ? 'Button.취소' : 'Button.닫기');\n const { sx: contentSx, ...restContentProps } = contentProps ?? {};\n const resolvedContentSx = [\n { position: 'relative', minHeight: loading ? 120 : undefined },\n ...(Array.isArray(contentSx) ? contentSx : contentSx ? [contentSx] : []),\n ];\n\n return (\n <Dialog\n ref={ref}\n fullWidth\n component={useSubmit ? 'form' : undefined}\n role={alertDialog ? 'alertdialog' : roleProp}\n onClose={(event, reason) => {\n if (reason === 'backdropClick') {\n return;\n }\n\n onClose?.(event, reason);\n }}\n {...dialogProps}\n >\n {title && <DialogTitle>{title}</DialogTitle>}\n <DialogContent dividers aria-busy={loading} {...restContentProps} sx={resolvedContentSx}>\n {children}\n {loading && (\n <Box\n aria-hidden=\"true\"\n sx={{\n position: 'absolute',\n inset: 0,\n zIndex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <CircularProgress color=\"secondary\" />\n </Box>\n )}\n </DialogContent>\n <DialogActions>\n {actions && <Box className=\"flex w-full items-start\">{actions}</Box>}\n {canCancel && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n if (typeof onCancel === 'function') {\n onCancel();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {cancelText}\n </Button>\n )}\n {canConfirm && (\n <Button\n variant=\"contained\"\n color=\"secondary\"\n type={useSubmit ? 'submit' : 'button'}\n onClick={() => {\n if (useSubmit) {\n return;\n }\n\n if (typeof onConfirm === 'function') {\n onConfirm();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {confirmText}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n },\n);\n\nOwpDialog.displayName = 'OwpDialog';\nexport { OwpDialog };\n"],"names":["OwpDialog","forwardRef","title","children","loading","alertDialog","canCancel","canConfirm","confirmTextProp","cancelTextProp","onConfirm","onCancel","onClose","useSubmit","actions","contentProps","roleProp","dialogProps","ref","t","useOwpTranslation","confirmText","cancelText","contentSx","restContentProps","resolvedContentSx","jsxs","Dialog","__name","event","reason","jsx","DialogTitle","DialogContent","Box","CircularProgress","DialogActions","Button"],"mappings":";;;;;;AAyCA,MAAMA,IAAYC;AAAA,EAChB,CACE;AAAA,IACE,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,aAAAC,IAAc;AAAA,IACd,WAAAC,IAAY;AAAA,IACZ,YAAAC,IAAa;AAAA,IACb,aAAaC;AAAA,IACb,YAAYC;AAAA,IACZ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,MAAMC;AAAA,IACN,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACRC,IAAcb,KAAmBW,EAAE,WAAW,GAC9CG,IAAab,KAAkBU,EAAEZ,IAAa,cAAc,WAAW,GACvE,EAAE,IAAIgB,GAAW,GAAGC,EAAA,IAAqBT,KAAgB,CAAA,GACzDU,IAAoB;AAAA,MACxB,EAAE,UAAU,YAAY,WAAWrB,IAAU,MAAM,OAAA;AAAA,MACnD,GAAI,MAAM,QAAQmB,CAAS,IAAIA,IAAYA,IAAY,CAACA,CAAS,IAAI,CAAA;AAAA,IAAC;AAGxE,WACE,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAT;AAAA,QACA,WAAS;AAAA,QACT,WAAWL,IAAY,SAAS;AAAA,QAChC,MAAMR,IAAc,gBAAgBW;AAAA,QACpC,SAAS,gBAAAY,EAAA,CAACC,GAAOC,MAAW;AAC1B,UAAIA,MAAW,oBAIflB,KAAA,QAA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BAAAE,KAAA,QAAAA,EAAU,CAAA,GAAI;AAAA;AAAA,gBAChB,GAXS;AAAA,gBAaR,UAAAS;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEArB,EAAU,cAAc;"}
1
+ {"version":3,"file":"OwpDialog.js","sources":["../../../src/components/OwpDialog/OwpDialog.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n Box,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentProps,\n DialogProps,\n DialogTitle,\n} from '@mui/material';\nimport { forwardRef, ReactNode } from 'react';\nimport { useDialogOpenFocusCleanup } from './internal/useDialogOpenFocusCleanup';\n\nexport interface OwpDialogProps extends Omit<DialogProps, 'title'> {\n title?: ReactNode;\n children?: ReactNode;\n loading?: boolean;\n alertDialog?: boolean;\n canConfirm?: boolean;\n canCancel?: boolean;\n confirmText?: string;\n cancelText?: string;\n useSubmit?: boolean;\n actions?: ReactNode;\n contentProps?: DialogContentProps;\n onConfirm?: () => void;\n onCancel?: () => void;\n}\n\n/**\n * OwpDialog 컴포넌트\n * @param title 제목\n * @param children 하위 콘텐츠\n * @param loading 본문 로딩 여부\n * @param alertDialog alertdialog role 적용 여부\n * @param canCancel canCancel 값\n * @param canConfirm canConfirm 값\n * @param onConfirm onConfirm 핸들러\n * @param onCancel onCancel 핸들러\n */\nconst OwpDialog = forwardRef<HTMLDivElement, OwpDialogProps>(\n (\n {\n title,\n children,\n loading = false,\n alertDialog = false,\n canCancel = true,\n canConfirm = true,\n confirmText: confirmTextProp,\n cancelText: cancelTextProp,\n onConfirm,\n onCancel,\n onClose,\n open,\n useSubmit,\n actions,\n contentProps,\n role: roleProp,\n ...dialogProps\n },\n ref,\n ) => {\n const { t } = useOwpTranslation();\n const confirmText = confirmTextProp ?? t('Button.저장');\n const cancelText = cancelTextProp ?? t(canConfirm ? 'Button.취소' : 'Button.닫기');\n const resolvedOpen = useDialogOpenFocusCleanup(open);\n const { sx: contentSx, ...restContentProps } = contentProps ?? {};\n const resolvedContentSx = [\n { position: 'relative', minHeight: loading ? 120 : undefined },\n ...(Array.isArray(contentSx) ? contentSx : contentSx ? [contentSx] : []),\n ];\n\n return (\n <Dialog\n ref={ref}\n fullWidth\n open={resolvedOpen}\n component={useSubmit ? 'form' : undefined}\n role={alertDialog ? 'alertdialog' : roleProp}\n onClose={(event, reason) => {\n if (reason === 'backdropClick') {\n return;\n }\n\n onClose?.(event, reason);\n }}\n {...dialogProps}\n >\n {title && <DialogTitle>{title}</DialogTitle>}\n <DialogContent dividers aria-busy={loading} {...restContentProps} sx={resolvedContentSx}>\n {children}\n {loading && (\n <Box\n aria-hidden=\"true\"\n sx={{\n position: 'absolute',\n inset: 0,\n zIndex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <CircularProgress color=\"secondary\" />\n </Box>\n )}\n </DialogContent>\n <DialogActions>\n {actions && <Box className=\"flex w-full items-start\">{actions}</Box>}\n {canCancel && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n if (typeof onCancel === 'function') {\n onCancel();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {cancelText}\n </Button>\n )}\n {canConfirm && (\n <Button\n variant=\"contained\"\n color=\"secondary\"\n type={useSubmit ? 'submit' : 'button'}\n onClick={() => {\n if (useSubmit) {\n return;\n }\n\n if (typeof onConfirm === 'function') {\n onConfirm();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {confirmText}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n },\n);\n\nOwpDialog.displayName = 'OwpDialog';\nexport { OwpDialog };\n"],"names":["OwpDialog","forwardRef","title","children","loading","alertDialog","canCancel","canConfirm","confirmTextProp","cancelTextProp","onConfirm","onCancel","onClose","open","useSubmit","actions","contentProps","roleProp","dialogProps","ref","t","useOwpTranslation","confirmText","cancelText","resolvedOpen","useDialogOpenFocusCleanup","contentSx","restContentProps","resolvedContentSx","jsxs","Dialog","__name","event","reason","jsx","DialogTitle","DialogContent","Box","CircularProgress","DialogActions","Button"],"mappings":";;;;;;;AA0CA,MAAMA,IAAYC;AAAA,EAChB,CACE;AAAA,IACE,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,aAAAC,IAAc;AAAA,IACd,WAAAC,IAAY;AAAA,IACZ,YAAAC,IAAa;AAAA,IACb,aAAaC;AAAA,IACb,YAAYC;AAAA,IACZ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,MAAMC;AAAA,IACN,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACRC,IAAcd,KAAmBY,EAAE,WAAW,GAC9CG,IAAad,KAAkBW,EAAEb,IAAa,cAAc,WAAW,GACvEiB,IAAeC,EAA0BZ,CAAI,GAC7C,EAAE,IAAIa,GAAW,GAAGC,EAAA,IAAqBX,KAAgB,CAAA,GACzDY,IAAoB;AAAA,MACxB,EAAE,UAAU,YAAY,WAAWxB,IAAU,MAAM,OAAA;AAAA,MACnD,GAAI,MAAM,QAAQsB,CAAS,IAAIA,IAAYA,IAAY,CAACA,CAAS,IAAI,CAAA;AAAA,IAAC;AAGxE,WACE,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAX;AAAA,QACA,WAAS;AAAA,QACT,MAAMK;AAAA,QACN,WAAWV,IAAY,SAAS;AAAA,QAChC,MAAMT,IAAc,gBAAgBY;AAAA,QACpC,SAAS,gBAAAc,EAAA,CAACC,GAAOC,MAAW;AAC1B,UAAIA,MAAW,oBAIfrB,KAAA,QAAAA,EAAUoB,GAAOC;AAAA,QACnB,GANS;AAAA,QAOR,GAAGf;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A,gBAChB,GAXS;AAAA,gBAaR,UAAAU;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAtB,EAAU,cAAc;"}
@@ -0,0 +1,18 @@
1
+ var n = Object.defineProperty;
2
+ var o = (t, e) => n(t, "name", { value: e, configurable: !0 });
3
+ import { blurActiveElement as r } from "../../../utils/internal/blurActiveElement.js";
4
+ import { useState as f, useLayoutEffect as c, useEffect as a } from "react";
5
+ const l = typeof window < "u" ? c : a, m = /* @__PURE__ */ o((t) => {
6
+ const e = t === !0, [u, s] = f(!1);
7
+ return l(() => {
8
+ if (!e) {
9
+ s(!1);
10
+ return;
11
+ }
12
+ r(), s(!0);
13
+ }, [e]), e && u;
14
+ }, "useDialogOpenFocusCleanup");
15
+ export {
16
+ m as useDialogOpenFocusCleanup
17
+ };
18
+ //# sourceMappingURL=useDialogOpenFocusCleanup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDialogOpenFocusCleanup.js","sources":["../../../../src/components/OwpDialog/internal/useDialogOpenFocusCleanup.ts"],"sourcesContent":["import { blurActiveElement } from '@/utils/internal/blurActiveElement';\nimport { useEffect, useLayoutEffect, useState } from 'react';\n\nconst useEnhancedEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n/**\n * Dialog open 전 focus 정리 상태\n * @param open 요청 open 여부\n */\nexport const useDialogOpenFocusCleanup = (open?: boolean) => {\n const shouldOpen = open === true;\n const [isFocusCleared, setIsFocusCleared] = useState(false);\n\n useEnhancedEffect(() => {\n if (!shouldOpen) {\n setIsFocusCleared(false);\n return;\n }\n\n blurActiveElement();\n setIsFocusCleared(true);\n }, [shouldOpen]);\n\n return shouldOpen && isFocusCleared;\n};\n"],"names":["useEnhancedEffect","useLayoutEffect","useEffect","useDialogOpenFocusCleanup","__name","open","shouldOpen","isFocusCleared","setIsFocusCleared","useState","blurActiveElement"],"mappings":";;;;AAGA,MAAMA,IAAoB,OAAO,SAAW,MAAcC,IAAkBC,GAM/DC,IAA4B,gBAAAC,EAAA,CAACC,MAAmB;AAC3D,QAAMC,IAAaD,MAAS,IACtB,CAACE,GAAgBC,CAAiB,IAAIC,EAAS,EAAK;AAE1D,SAAAT,EAAkB,MAAM;AACtB,QAAI,CAACM,GAAY;AACf,MAAAE,EAAkB,EAAK;AACvB;AAAA,IACF;AAEA,IAAAE,EAAA,GACAF,EAAkB,EAAI;AAAA,EACxB,GAAG,CAACF,CAAU,CAAC,GAERA,KAAcC;AACvB,GAfyC;"}
@@ -1,8 +1,21 @@
1
1
  var h = Object.defineProperty;
2
- var o = (i, r) => h(i, "name", { value: r, configurable: !0 });
3
- import { jsxs as n, jsx as a } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
2
+ var s = (t, r) => h(t, "name", { value: r, configurable: !0 });
3
+ import { jsx as n, jsxs as c } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
4
+ import { useOwpTranslation as u } from "../../hooks/useOwpTranslation.js";
4
5
  import { Component as m } from "react";
5
- const t = class t extends m {
6
+ function p({ error: t, errorInfo: r }) {
7
+ const { t: e } = u();
8
+ return /* @__PURE__ */ c("div", { className: "bg-white p-24", children: [
9
+ /* @__PURE__ */ n("h1", { className: "text-2xl font-semibold", children: e("Message.문제가 발생했습니다.") }),
10
+ /* @__PURE__ */ c("p", { className: "text-base whitespace-pre-wrap", children: [
11
+ t && t.toString(),
12
+ /* @__PURE__ */ n("br", {}),
13
+ r && r.componentStack
14
+ ] })
15
+ ] });
16
+ }
17
+ s(p, "OwpErrorBoundaryFallback");
18
+ const a = class a extends m {
6
19
  constructor(r) {
7
20
  super(r), this.state = { hasError: !1, error: null, errorInfo: null };
8
21
  }
@@ -13,20 +26,17 @@ const t = class t extends m {
13
26
  this.setState({ error: r, errorInfo: e }), console.error("Uncaught error:", r, e);
14
27
  }
15
28
  render() {
16
- const { children: r = null } = this.props, { error: e, errorInfo: s, hasError: l } = this.state;
17
- return l ? /* @__PURE__ */ n("div", { className: "bg-white p-24", children: [
18
- /* @__PURE__ */ a("h1", { className: "text-2xl font-semibold", children: "Something went wrong." }),
19
- /* @__PURE__ */ n("p", { className: "text-base whitespace-pre-wrap", children: [
20
- e && e.toString(),
21
- /* @__PURE__ */ a("br", {}),
22
- s && s.componentStack
23
- ] })
24
- ] }) : r;
29
+ const { children: r = null } = this.props, { error: e, errorInfo: i, hasError: l } = this.state;
30
+ return l ? /* @__PURE__ */ n(p, { error: e, errorInfo: i }) : r;
25
31
  }
26
32
  };
27
- o(t, "OwpErrorBoundary");
28
- let c = t;
33
+ s(a, "OwpErrorBoundaryAdapter");
34
+ let o = a;
35
+ function g({ children: t }) {
36
+ return /* @__PURE__ */ n(o, { children: t });
37
+ }
38
+ s(g, "OwpErrorBoundary");
29
39
  export {
30
- c as OwpErrorBoundary
40
+ g as OwpErrorBoundary
31
41
  };
32
42
  //# sourceMappingURL=OwpErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OwpErrorBoundary.js","sources":["../../../src/components/OwpErrorBoundary/OwpErrorBoundary.tsx"],"sourcesContent":["import { Component, ErrorInfo, ReactNode } from 'react';\n\ninterface OwpErrorBoundaryProps {\n children?: ReactNode;\n}\n\ninterface OwpErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n errorInfo: ErrorInfo | null;\n}\n\nexport class OwpErrorBoundary extends Component<OwpErrorBoundaryProps, OwpErrorBoundaryState> {\n constructor(props: OwpErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null, errorInfo: null };\n }\n\n static getDerivedStateFromError(error: Error): OwpErrorBoundaryState {\n return { hasError: true, error, errorInfo: null };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ error, errorInfo });\n console.error('Uncaught error:', error, errorInfo);\n }\n\n render() {\n const { children = null } = this.props;\n const { error, errorInfo, hasError } = this.state;\n\n if (hasError) {\n return (\n <div className=\"bg-white p-24\">\n <h1 className=\"text-2xl font-semibold\">Something went wrong.</h1>\n <p className=\"text-base whitespace-pre-wrap\">\n {error && error.toString()}\n <br />\n {errorInfo && errorInfo.componentStack}\n </p>\n </div>\n );\n }\n\n return children;\n }\n}\n"],"names":["_OwpErrorBoundary","Component","props","error","errorInfo","children","hasError","jsxs","jsx","__name","OwpErrorBoundary"],"mappings":";;;;AAYO,MAAMA,IAAN,MAAMA,UAAyBC,EAAwD;AAAA,EAC5F,YAAYC,GAA8B;AACxC,UAAMA,CAAK,GACX,KAAK,QAAQ,EAAE,UAAU,IAAO,OAAO,MAAM,WAAW,KAAA;AAAA,EAC1D;AAAA,EAEA,OAAO,yBAAyBC,GAAqC;AACnE,WAAO,EAAE,UAAU,IAAM,OAAAA,GAAO,WAAW,KAAA;AAAA,EAC7C;AAAA,EAEA,kBAAkBA,GAAcC,GAAsB;AACpD,SAAK,SAAS,EAAE,OAAAD,GAAO,WAAAC,EAAA,CAAW,GAClC,QAAQ,MAAM,mBAAmBD,GAAOC,CAAS;AAAA,EACnD;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,UAAAC,IAAW,KAAA,IAAS,KAAK,OAC3B,EAAE,OAAAF,GAAO,WAAAC,GAAW,UAAAE,EAAA,IAAa,KAAK;AAE5C,WAAIA,IAEA,gBAAAC,EAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,MAAA,gBAAAC,EAAC,MAAA,EAAG,WAAU,0BAAyB,UAAA,yBAAqB;AAAA,MAC5D,gBAAAD,EAAC,KAAA,EAAE,WAAU,iCACV,UAAA;AAAA,QAAAJ,KAASA,EAAM,SAAA;AAAA,0BACf,MAAA,EAAG;AAAA,QACHC,KAAaA,EAAU;AAAA,MAAA,EAAA,CAC1B;AAAA,IAAA,GACF,IAIGC;AAAA,EACT;AACF;AAlC8FI,EAAAT,GAAA;AAAvF,IAAMU,IAANV;"}
1
+ {"version":3,"file":"OwpErrorBoundary.js","sources":["../../../src/components/OwpErrorBoundary/OwpErrorBoundary.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport { Component, type ErrorInfo, type ReactNode } from 'react';\n\ntype OwpErrorBoundaryProps = {\n children?: ReactNode;\n};\n\ntype OwpErrorBoundaryState = {\n hasError: boolean;\n error: Error | null;\n errorInfo: ErrorInfo | null;\n};\n\ntype OwpErrorBoundaryFallbackProps = Pick<OwpErrorBoundaryState, 'error' | 'errorInfo'>;\n\n/**\n * 에러 경계 fallback UI\n * @param error 발생 에러\n * @param errorInfo React 에러 정보\n */\nfunction OwpErrorBoundaryFallback({ error, errorInfo }: OwpErrorBoundaryFallbackProps) {\n const { t } = useOwpTranslation();\n\n return (\n <div className=\"bg-white p-24\">\n <h1 className=\"text-2xl font-semibold\">{t('Message.문제가 발생했습니다.')}</h1>\n <p className=\"text-base whitespace-pre-wrap\">\n {error && error.toString()}\n <br />\n {errorInfo && errorInfo.componentStack}\n </p>\n </div>\n );\n}\n\n/**\n * React 에러 경계 class adapter\n */\nclass OwpErrorBoundaryAdapter extends Component<OwpErrorBoundaryProps, OwpErrorBoundaryState> {\n constructor(props: OwpErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null, errorInfo: null };\n }\n\n static getDerivedStateFromError(error: Error): OwpErrorBoundaryState {\n return { hasError: true, error, errorInfo: null };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ error, errorInfo });\n console.error('Uncaught error:', error, errorInfo);\n }\n\n render() {\n const { children = null } = this.props;\n const { error, errorInfo, hasError } = this.state;\n\n if (hasError) {\n return <OwpErrorBoundaryFallback error={error} errorInfo={errorInfo} />;\n }\n\n return children;\n }\n}\n\n/**\n * OWP 에러 경계\n * @param children 하위 콘텐츠\n */\nexport function OwpErrorBoundary({ children }: OwpErrorBoundaryProps) {\n return <OwpErrorBoundaryAdapter>{children}</OwpErrorBoundaryAdapter>;\n}\n"],"names":["OwpErrorBoundaryFallback","error","errorInfo","t","useOwpTranslation","jsxs","jsx","__name","_OwpErrorBoundaryAdapter","Component","props","children","hasError","OwpErrorBoundaryAdapter","OwpErrorBoundary"],"mappings":";;;;;AAoBA,SAASA,EAAyB,EAAE,OAAAC,GAAO,WAAAC,KAA4C;AACrF,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAU,iBACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,MAAA,EAAG,WAAU,0BAA0B,UAAAH,EAAE,qBAAqB,GAAE;AAAA,IACjE,gBAAAE,EAAC,KAAA,EAAE,WAAU,iCACV,UAAA;AAAA,MAAAJ,KAASA,EAAM,SAAA;AAAA,wBACf,MAAA,EAAG;AAAA,MACHC,KAAaA,EAAU;AAAA,IAAA,EAAA,CAC1B;AAAA,EAAA,GACF;AAEJ;AAbSK,EAAAP,GAAA;AAkBT,MAAMQ,IAAN,MAAMA,UAAgCC,EAAwD;AAAA,EAC5F,YAAYC,GAA8B;AACxC,UAAMA,CAAK,GACX,KAAK,QAAQ,EAAE,UAAU,IAAO,OAAO,MAAM,WAAW,KAAA;AAAA,EAC1D;AAAA,EAEA,OAAO,yBAAyBT,GAAqC;AACnE,WAAO,EAAE,UAAU,IAAM,OAAAA,GAAO,WAAW,KAAA;AAAA,EAC7C;AAAA,EAEA,kBAAkBA,GAAcC,GAAsB;AACpD,SAAK,SAAS,EAAE,OAAAD,GAAO,WAAAC,EAAA,CAAW,GAClC,QAAQ,MAAM,mBAAmBD,GAAOC,CAAS;AAAA,EACnD;AAAA,EAEA,SAAS;AACP,UAAM,EAAE,UAAAS,IAAW,KAAA,IAAS,KAAK,OAC3B,EAAE,OAAAV,GAAO,WAAAC,GAAW,UAAAU,EAAA,IAAa,KAAK;AAE5C,WAAIA,IACK,gBAAAN,EAACN,GAAA,EAAyB,OAAAC,GAAc,WAAAC,EAAA,CAAsB,IAGhES;AAAA,EACT;AACF;AAzB8FJ,EAAAC,GAAA;AAA9F,IAAMK,IAANL;AA+BO,SAASM,EAAiB,EAAE,UAAAH,KAAmC;AACpE,SAAO,gBAAAL,EAACO,KAAyB,UAAAF,GAAS;AAC5C;AAFgBJ,EAAAO,GAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"OwpLayout.js","sources":["../../../src/components/OwpLayout/OwpLayout.tsx"],"sourcesContent":["import { themeLayouts, themeLayoutsType } from '@/layout/themeLayouts';\nimport { useOwpAppContext } from '@/contexts/OwpAppProvider';\nimport { generateSettings } from '@/configs/defaultConfig';\nimport { LayoutConfigDefaultsType } from '@/configs/layoutConfig';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n useGetCurrentSettings,\n useGetDefaultSettings,\n useSetSettings,\n} from '@/hooks/useOwpSettings';\nimport type { OwpSettingsConfigType } from '@/types/OwpSettingsTypes';\nimport { OwpRoutesType } from '@/utils/common/OwpUtils';\nimport { isEqual, merge } from 'es-toolkit/compat';\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react';\nimport { matchRoutes, RouteMatch, RouteObject, useLocation } from 'react-router-dom';\nimport { OwpLoading } from '../OwpLoading';\n\nexport type OwpRouteObjectType = RouteObject & {\n settings?: OwpSettingsConfigType;\n auth?: string[] | [] | null | undefined;\n};\n\nexport type OwpRouteMatchType = RouteMatch & {\n route: OwpRouteObjectType;\n};\n\ntype OwpLayoutProps = {\n layouts?: themeLayoutsType;\n children?: ReactNode;\n};\n\n/**\n * OwpLayout\n * React frontend component in a React project that is used for layouting the user interface. The component\n * handles generating user interface settings related to current routes, merged with default settings, and uses\n * the new settings to generate layouts.\n */\nfunction OwpLayout(props: OwpLayoutProps) {\n const { routesConfig } = useOwpAppContext();\n const { i18n } = useOwpTranslation();\n\n const { layouts = themeLayouts, children } = props;\n const setSettings = useSetSettings();\n const settings = useGetCurrentSettings();\n const defaultSettings = useGetDefaultSettings();\n const location = useLocation();\n const { pathname } = location;\n const hasCompletedInitialLayoutSyncRef = useRef(false);\n\n const matchedSettings = useMemo(\n () => getRouteParamUtil(routesConfig, pathname, 'settings', true),\n [pathname, routesConfig],\n );\n const currentSettings = useMemo(() => {\n if (matchedSettings === undefined) {\n return defaultSettings;\n }\n\n return generateSettings(defaultSettings, matchedSettings);\n }, [defaultSettings, matchedSettings]);\n const isSettingsSynchronized = useMemo(\n () => settings === currentSettings || isEqual(currentSettings, settings),\n [currentSettings, settings],\n );\n const resolvedSettings = isSettingsSynchronized ? settings : currentSettings;\n const layoutStyle = resolvedSettings?.layout?.style;\n const layoutConfig = resolvedSettings?.layout?.config as LayoutConfigDefaultsType | undefined;\n\n useEffect(() => {\n if (isSettingsSynchronized) {\n return;\n }\n\n setSettings(currentSettings);\n }, [currentSettings, isSettingsSynchronized, setSettings]);\n\n useEffect(() => {\n window.scrollTo(0, 0);\n }, [pathname]);\n\n useEffect(() => {\n if (isSettingsSynchronized && i18n.isInitialized) {\n hasCompletedInitialLayoutSyncRef.current = true;\n }\n }, [i18n.isInitialized, isSettingsSynchronized]);\n\n return useMemo(() => {\n const shouldBlockForInitialLoading =\n !i18n.isInitialized ||\n (!isSettingsSynchronized && !hasCompletedInitialLayoutSyncRef.current);\n\n if (shouldBlockForInitialLoading) {\n return <OwpLoading />;\n }\n\n return Object.entries(layouts).map(([key, Layout]) => {\n if (key === layoutStyle) {\n return (\n <Layout key={key} layoutConfig={layoutConfig}>\n {children}\n </Layout>\n );\n }\n\n return null;\n });\n }, [children, i18n.isInitialized, isSettingsSynchronized, layoutConfig, layoutStyle, layouts]);\n}\n\nexport { OwpLayout };\n\n/**\n * Utility function to retrieve and merge or replace a specific route parameter from matched routes.\n *\n * @param pathname The current pathname\n * @param key The key of the parameter to merge or replace (e.g., 'settings', 'auth')\n * @param useMerge Whether to merge the parameter (using es-toolkit merge) or replace it\n * @returns The merged or replaced parameter data of type T\n */\nfunction getRouteParamUtil<T>(\n routes: OwpRoutesType,\n pathname: string,\n key: keyof OwpRouteObjectType,\n useMerge: boolean = true,\n): T | undefined {\n const matchedRoutes = matchRoutes(routes, pathname) as OwpRouteMatchType[] | null;\n\n if (!matchedRoutes) {\n return undefined;\n }\n\n let hasMatchedParam = false;\n\n const resolvedRouteParam = matchedRoutes.reduce<T | undefined>((acc, match) => {\n const routeParam = match.route[key] as T | undefined;\n\n if (routeParam === undefined) {\n return acc;\n }\n\n hasMatchedParam = true;\n\n if (!useMerge) {\n return routeParam;\n }\n\n if (routeParam === null) {\n return routeParam;\n }\n\n return merge(acc ?? {}, routeParam);\n }, undefined);\n\n return hasMatchedParam ? resolvedRouteParam : undefined;\n}\n"],"names":["OwpLayout","props","routesConfig","useOwpAppContext","i18n","useOwpTranslation","layouts","themeLayouts","children","setSettings","useSetSettings","settings","useGetCurrentSettings","defaultSettings","useGetDefaultSettings","location","useLocation","pathname","hasCompletedInitialLayoutSyncRef","useRef","matchedSettings","useMemo","getRouteParamUtil","currentSettings","generateSettings","isSettingsSynchronized","isEqual","resolvedSettings","layoutStyle","_a","layoutConfig","_b","useEffect","OwpLoading","key","Layout","jsx","__name","routes","useMerge","matchedRoutes","matchRoutes","hasMatchedParam","resolvedRouteParam","acc","match","routeParam","merge"],"mappings":";;;;;;;;;;;;;AAqCA,SAASA,EAAUC,GAAuB;;AACxC,QAAM,EAAE,cAAAC,EAAA,IAAiBC,EAAA,GACnB,EAAE,MAAAC,EAAA,IAASC,EAAA,GAEX,EAAE,SAAAC,IAAUC,GAAc,UAAAC,EAAA,IAAaP,GACvCQ,IAAcC,EAAA,GACdC,IAAWC,EAAA,GACXC,IAAkBC,EAAA,GAClBC,IAAWC,EAAA,GACX,EAAE,UAAAC,MAAaF,GACfG,IAAmCC,EAAO,EAAK,GAE/CC,IAAkBC;AAAA,IACtB,MAAMC,EAAkBpB,GAAce,GAAU,YAAY,EAAI;AAAA,IAChE,CAACA,GAAUf,CAAY;AAAA,E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EtB,QAAMC,IAAqBH,EAAc,OAAsB,CAACI,GAAKC,MAAU;AAC7E,UAAMC,IAAaD,EAAM,MAAMX,CAAG;AAElC,WAAIY,MAAe,SACVF,KAGTF,IAAkB,IAEd,CAACH,KAIDO,MAAe,OACVA,IAGFC,EAAMH,KAAO,CAAA,GAAIE,CAAU;AAAA,EACpC,GAAG,MAAS;AAEZ,SAAOJ,IAAkBC,IAAqB;AAChD;AAnCSN,EAAAf,GAAA;"}
1
+ {"version":3,"file":"OwpLayout.js","sources":["../../../src/components/OwpLayout/OwpLayout.tsx"],"sourcesContent":["import { themeLayouts, themeLayoutsType } from '@/layout/themeLayouts';\nimport { useOwpAppContext } from '@/contexts/OwpAppProvider';\nimport { generateSettings } from '@/configs/defaultConfig';\nimport { LayoutConfigDefaultsType } from '@/configs/layoutConfig';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n useGetCurrentSettings,\n useGetDefaultSettings,\n useSetSettings,\n} from '@/hooks/useOwpSettings';\nimport type { OwpSettingsConfigType } from '@/types/OwpSettingsTypes';\nimport type { OwpRoutesType } from '@/types/OwpRouteTypes';\nimport { isEqual, merge } from 'es-toolkit/compat';\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react';\nimport { matchRoutes, RouteMatch, RouteObject, useLocation } from 'react-router-dom';\nimport { OwpLoading } from '../OwpLoading';\n\nexport type OwpRouteObjectType = RouteObject & {\n settings?: OwpSettingsConfigType;\n auth?: string[] | [] | null | undefined;\n};\n\nexport type OwpRouteMatchType = RouteMatch & {\n route: OwpRouteObjectType;\n};\n\ntype OwpLayoutProps = {\n layouts?: themeLayoutsType;\n children?: ReactNode;\n};\n\n/**\n * OwpLayout\n * React frontend component in a React project that is used for layouting the user interface. The component\n * handles generating user interface settings related to current routes, merged with default settings, and uses\n * the new settings to generate layouts.\n */\nfunction OwpLayout(props: OwpLayoutProps) {\n const { routesConfig } = useOwpAppContext();\n const { i18n } = useOwpTranslation();\n\n const { layouts = themeLayouts, children } = props;\n const setSettings = useSetSettings();\n const settings = useGetCurrentSettings();\n const defaultSettings = useGetDefaultSettings();\n const location = useLocation();\n const { pathname } = location;\n const hasCompletedInitialLayoutSyncRef = useRef(false);\n\n const matchedSettings = useMemo(\n () => getRouteParamUtil(routesConfig, pathname, 'settings', true),\n [pathname, routesConfig],\n );\n const currentSettings = useMemo(() => {\n if (matchedSettings === undefined) {\n return defaultSettings;\n }\n\n return generateSettings(defaultSettings, matchedSettings);\n }, [defaultSettings, matchedSettings]);\n const isSettingsSynchronized = useMemo(\n () => settings === currentSettings || isEqual(currentSettings, settings),\n [currentSettings, settings],\n );\n const resolvedSettings = isSettingsSynchronized ? settings : currentSettings;\n const layoutStyle = resolvedSettings?.layout?.style;\n const layoutConfig = resolvedSettings?.layout?.config as LayoutConfigDefaultsType | undefined;\n\n useEffect(() => {\n if (isSettingsSynchronized) {\n return;\n }\n\n setSettings(currentSettings);\n }, [currentSettings, isSettingsSynchronized, setSettings]);\n\n useEffect(() => {\n window.scrollTo(0, 0);\n }, [pathname]);\n\n useEffect(() => {\n if (isSettingsSynchronized && i18n.isInitialized) {\n hasCompletedInitialLayoutSyncRef.current = true;\n }\n }, [i18n.isInitialized, isSettingsSynchronized]);\n\n return useMemo(() => {\n const shouldBlockForInitialLoading =\n !i18n.isInitialized ||\n (!isSettingsSynchronized && !hasCompletedInitialLayoutSyncRef.current);\n\n if (shouldBlockForInitialLoading) {\n return <OwpLoading />;\n }\n\n return Object.entries(layouts).map(([key, Layout]) => {\n if (key === layoutStyle) {\n return (\n <Layout key={key} layoutConfig={layoutConfig}>\n {children}\n </Layout>\n );\n }\n\n return null;\n });\n }, [children, i18n.isInitialized, isSettingsSynchronized, layoutConfig, layoutStyle, layouts]);\n}\n\nexport { OwpLayout };\n\n/**\n * Utility function to retrieve and merge or replace a specific route parameter from matched routes.\n *\n * @param pathname The current pathname\n * @param key The key of the parameter to merge or replace (e.g., 'settings', 'auth')\n * @param useMerge Whether to merge the parameter (using es-toolkit merge) or replace it\n * @returns The merged or replaced parameter data of type T\n */\nfunction getRouteParamUtil<T>(\n routes: OwpRoutesType,\n pathname: string,\n key: keyof OwpRouteObjectType,\n useMerge: boolean = true,\n): T | undefined {\n const matchedRoutes = matchRoutes(routes, pathname) as OwpRouteMatchType[] | null;\n\n if (!matchedRoutes) {\n return undefined;\n }\n\n let hasMatchedParam = false;\n\n const resolvedRouteParam = matchedRoutes.reduce<T | undefined>((acc, match) => {\n const routeParam = match.route[key] as T | undefined;\n\n if (routeParam === undefined) {\n return acc;\n }\n\n hasMatchedParam = true;\n\n if (!useMerge) {\n return routeParam;\n }\n\n if (routeParam === null) {\n return routeParam;\n }\n\n return merge(acc ?? {}, routeParam);\n }, undefined);\n\n return hasMatchedParam ? resolvedRouteParam : undefined;\n}\n"],"names":["OwpLayout","props","routesConfig","useOwpAppContext","i18n","useOwpTranslation","layouts","themeLayouts","children","setSettings","useSetSettings","settings","useGetCurrentSettings","defaultSettings","useGetDefaultSettings","location","useLocation","pathname","hasCompletedInitialLayoutSyncRef","useRef","matchedSettings","useMemo","getRouteParamUtil","currentSettings","generateSettings","isSettingsSynchronized","isEqual","resolvedSettings","layoutStyle","_a","layoutConfig","_b","useEffect","OwpLoading","key","Layout","jsx","__name","routes","useMerge","matchedRoutes","matchRoutes","hasMatchedParam","resolvedRouteParam","acc","match","routeParam","merge"],"mappings":";;;;;;;;;;;;;AAqCA,SAASA,EAAUC,GAAuB;;AACxC,QAAM,EAAE,cAAAC,EAAA,IAAiBC,EAAA,GACnB,EAAE,MAAAC,EAAA,IAASC,EAAA,GAEX,EAAE,SAAAC,IAAUC,GAAc,UAAAC,EAAA,IAAaP,GACvCQ,IAAcC,EAAA,GACdC,IAAWC,EAAA,GACXC,IAAkBC,EAAA,GAClBC,IAAWC,EAAA,GACX,EAAE,UAAAC,MAAaF,GACfG,IAAmCC,EAAO,EAAK,GAE/CC,IAAkBC;AAAA,IACtB,MAAMC,EAAkBpB,GAAce,GAAU,YAAY,EAAI;AA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