@lerx/promise-modal 0.0.48 → 0.0.50

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 (53) hide show
  1. package/dist/app/ModalManager.d.ts +1 -1
  2. package/dist/app/ModalManager.d.ts.map +1 -1
  3. package/dist/app/constant.d.ts +1 -1
  4. package/dist/app/constant.d.ts.map +1 -1
  5. package/dist/bootstrap/BootstrapProvider/BootstrapProvider.d.ts +2 -2
  6. package/dist/bootstrap/BootstrapProvider/helpers/bootstrap.d.ts +1 -1
  7. package/dist/bootstrap/BootstrapProvider/helpers/bootstrap.d.ts.map +1 -1
  8. package/dist/bootstrap/BootstrapProvider/type.d.ts +1 -1
  9. package/dist/bootstrap/BootstrapProvider/type.d.ts.map +1 -1
  10. package/dist/components/Anchor/Anchor.d.ts +1 -1
  11. package/dist/components/Anchor/Anchor.d.ts.map +1 -1
  12. package/dist/core/node/ModalNode/AbstractNode.d.ts +1 -1
  13. package/dist/core/node/ModalNode/AbstractNode.d.ts.map +1 -1
  14. package/dist/hooks/useActiveModalCount.d.ts +1 -1
  15. package/dist/hooks/useActiveModalCount.d.ts.map +1 -1
  16. package/dist/hooks/useDestroyAfter.d.ts +1 -1
  17. package/dist/hooks/useDestroyAfter.d.ts.map +1 -1
  18. package/dist/hooks/useModalAnimation.d.ts +1 -1
  19. package/dist/hooks/useModalAnimation.d.ts.map +1 -1
  20. package/dist/index.cjs.js +2 -2
  21. package/dist/index.cjs.js.map +1 -1
  22. package/dist/index.esm.js +2 -2
  23. package/dist/index.esm.js.map +1 -1
  24. package/dist/providers/ConfigurationContext/ConfigurationContext.d.ts +1 -1
  25. package/dist/providers/ConfigurationContext/ConfigurationContext.d.ts.map +1 -1
  26. package/dist/providers/ConfigurationContext/ConfigurationContextProvider.d.ts +1 -1
  27. package/dist/providers/ConfigurationContext/ConfigurationContextProvider.d.ts.map +1 -1
  28. package/dist/providers/ConfigurationContext/useConfigurationContext.d.ts +3 -3
  29. package/dist/providers/ConfigurationContext/useConfigurationContext.d.ts.map +1 -1
  30. package/dist/providers/ModalManagerContext/ModalManagerContext.d.ts +1 -1
  31. package/dist/providers/ModalManagerContext/ModalManagerContext.d.ts.map +1 -1
  32. package/dist/providers/ModalManagerContext/ModalManagerContextProvider.d.ts +1 -1
  33. package/dist/providers/ModalManagerContext/ModalManagerContextProvider.d.ts.map +1 -1
  34. package/dist/providers/UserDefinedContext/UserDefinedContext.d.ts +1 -1
  35. package/dist/providers/UserDefinedContext/UserDefinedContext.d.ts.map +1 -1
  36. package/dist/providers/UserDefinedContext/UserDefinedContextProvider.d.ts +1 -1
  37. package/dist/providers/UserDefinedContext/UserDefinedContextProvider.d.ts.map +1 -1
  38. package/dist/types/alert.d.ts +1 -1
  39. package/dist/types/alert.d.ts.map +1 -1
  40. package/dist/types/base.d.ts +1 -1
  41. package/dist/types/base.d.ts.map +1 -1
  42. package/dist/types/confirm.d.ts +1 -1
  43. package/dist/types/confirm.d.ts.map +1 -1
  44. package/dist/types/modal.d.ts +1 -1
  45. package/dist/types/modal.d.ts.map +1 -1
  46. package/dist/types/prompt.d.ts +1 -1
  47. package/dist/types/prompt.d.ts.map +1 -1
  48. package/package.json +28 -29
  49. /package/dist/@aileron/{types → declare}/function.d.ts +0 -0
  50. /package/dist/@aileron/{types → declare}/index.d.ts +0 -0
  51. /package/dist/@aileron/{types → declare}/object.d.ts +0 -0
  52. /package/dist/@aileron/{types → declare}/unit.d.ts +0 -0
  53. /package/dist/@aileron/{types → declare}/utility.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import type { Fn } from '../@aileron/types';
1
+ import type { Fn } from '../@aileron/declare';
2
2
  import type { Modal } from '../types';
3
3
  export declare class ModalManager {
4
4
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["../../src/app/ModalManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,qBAAa,YAAY;;IAEvB,MAAM,CAAC,QAAQ;IAMf,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QACtB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,WAAW,CAAC;KACpB,GAAG,WAAW;IAkBf,MAAM,KAAK,SAAS,YAEnB;IAID,MAAM,KAAK,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAGhD;IAED,MAAM,KAAK,UAAU,YAEpB;IAED,MAAM,CAAC,KAAK;IAQZ,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK;CAGzB"}
1
+ {"version":3,"file":"ModalManager.d.ts","sourceRoot":"","sources":["../../src/app/ModalManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,qBAAa,YAAY;;IAEvB,MAAM,CAAC,QAAQ;IAMf,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QACtB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,WAAW,CAAC;KACpB,GAAG,WAAW;IAkBf,MAAM,KAAK,SAAS,YAEnB;IAID,MAAM,KAAK,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAGhD;IAED,MAAM,KAAK,UAAU,YAEpB;IAED,MAAM,CAAC,KAAK;IAQZ,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK;CAGzB"}
@@ -1,4 +1,4 @@
1
- import type { Color, Duration } from '../@aileron/types';
1
+ import type { Color, Duration } from '../@aileron/declare';
2
2
  export declare const DEFAULT_ANIMATION_DURATION: Duration;
3
3
  export declare const DEFAULT_BACKDROP_COLOR: Color;
4
4
  //# sourceMappingURL=constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/app/constant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,0BAA0B,EAAE,QAAkB,CAAC;AAE5D,eAAO,MAAM,sBAAsB,EAAE,KAA4B,CAAC"}
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/app/constant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,0BAA0B,EAAE,QAAkB,CAAC;AAE5D,eAAO,MAAM,sBAAsB,EAAE,KAA4B,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { BootstrapProviderHandle } from './type';
2
2
  export declare const BootstrapProvider: import("react").ForwardRefExoticComponent<{
3
- usePathname?: import("../../../@aileron/types").Fn<[], {
3
+ usePathname?: import("../../@aileron/declare").Fn<[], {
4
4
  pathname: string;
5
5
  }>;
6
- context?: import("../../../@aileron/types").Dictionary;
6
+ context?: import("../../@aileron/declare").Dictionary;
7
7
  root?: HTMLElement | null;
8
8
  } & import("../../providers/ConfigurationContext").ConfigurationContextProviderProps & {
9
9
  children?: import("react").ReactNode | undefined;
@@ -1,4 +1,4 @@
1
- import type { Dictionary, Fn } from '../../../@aileron/types';
1
+ import type { Dictionary, Fn } from '../../../@aileron/declare';
2
2
  import { type ConfigurationContextProviderProps } from '../../../providers/ConfigurationContext';
3
3
  interface BootstrapProps extends ConfigurationContextProviderProps {
4
4
  usePathname: Fn<[], {
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/BootstrapProvider/helpers/bootstrap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,gDAAgD,CAAC;AAIxD,UAAU,cAAe,SAAQ,iCAAiC;IAChE,WAAW,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,+JAWnB,cAAc,gCAkBd,CAAC"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../src/bootstrap/BootstrapProvider/helpers/bootstrap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,gDAAgD,CAAC;AAIxD,UAAU,cAAe,SAAQ,iCAAiC;IAChE,WAAW,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,+JAWnB,cAAc,gCAkBd,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Dictionary, Fn } from '../../@aileron/types';
1
+ import type { Dictionary, Fn } from '../../@aileron/declare';
2
2
  import type { ConfigurationContextProviderProps } from '../../providers/ConfigurationContext';
3
3
  export type BootstrapProviderProps = {
4
4
  usePathname?: Fn<[], {
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/BootstrapProvider/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AAExG,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B,GAAG,iCAAiC,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;CAC/B"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/BootstrapProvider/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AAExG,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B,GAAG,iCAAiC,CAAC;AAEtC,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;CAC/B"}
@@ -1,2 +1,2 @@
1
- export declare const Anchor: import("react").MemoExoticComponent<import("react").ComponentType<import("@winglet/react-utils/dist/@aileron/types").Dictionary>>;
1
+ export declare const Anchor: import("react").MemoExoticComponent<import("react").ComponentType<import("winglet/react-utils/dist/@aileron/declare").Dictionary>>;
2
2
  //# sourceMappingURL=Anchor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../src/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AA6CA,eAAO,MAAM,MAAM,mIAAuC,CAAC"}
1
+ {"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../src/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AA6CA,eAAO,MAAM,MAAM,oIAAuC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { Fn } from '../../../@aileron/types';
2
+ import type { Fn } from '../../../@aileron/declare';
3
3
  import type { BackgroundComponent, BaseModal, ForegroundComponent, ManagedEntity, ModalBackground } from '../../../types';
4
4
  type AbstractNodeProps<T, B> = BaseModal<T, B> & ManagedEntity;
5
5
  export declare abstract class AbstractNode<T, B> {
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractNode.d.ts","sourceRoot":"","sources":["../../../../src/core/node/ModalNode/AbstractNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC;AAE/D,8BAAsB,YAAY,CAAC,CAAC,EAAE,CAAC;;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAEzC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IACnD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAGnD,IAAI,KAAK,YAER;IAED,IAAI,OAAO,YAEV;gBAKW,EACV,EAAE,EACF,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,MAAa,EACb,aAAqB,EACrB,oBAA2B,EAC3B,OAAO,EACP,mBAAmB,EACnB,mBAAmB,GACpB,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;IAmB1B,SAAS,CAAC,QAAQ,EAAE,EAAE;IAMtB,OAAO;IAGP,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI;IAGlC,SAAS;IAKT,MAAM;IAKN,MAAM;IAKN,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,QAAQ,CAAC,SAAS,IAAI,IAAI;CAC3B"}
1
+ {"version":3,"file":"AbstractNode.d.ts","sourceRoot":"","sources":["../../../../src/core/node/ModalNode/AbstractNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC;AAE/D,8BAAsB,YAAY,CAAC,CAAC,EAAE,CAAC;;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAEzC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IACnD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAGnD,IAAI,KAAK,YAER;IAED,IAAI,OAAO,YAEV;gBAKW,EACV,EAAE,EACF,SAAS,EACT,KAAK,EACL,QAAQ,EACR,UAAU,EACV,MAAa,EACb,aAAqB,EACrB,oBAA2B,EAC3B,OAAO,EACP,mBAAmB,EACnB,mBAAmB,GACpB,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;IAmB1B,SAAS,CAAC,QAAQ,EAAE,EAAE;IAMtB,OAAO;IAGP,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI;IAGlC,SAAS;IAKT,MAAM;IAKN,MAAM;IAKN,QAAQ,CAAC,OAAO,IAAI,IAAI;IACxB,QAAQ,CAAC,SAAS,IAAI,IAAI;CAC3B"}
@@ -1,4 +1,4 @@
1
- import type { Fn } from '../@aileron/types';
1
+ import type { Fn } from '../@aileron/declare';
2
2
  import type { ModalNode } from '../core';
3
3
  export declare const useActiveModalCount: (validate?: Fn<[ModalNode?], boolean | undefined>, refreshKey?: string | number) => number;
4
4
  //# sourceMappingURL=useActiveModalCount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useActiveModalCount.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveModalCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,mBAAmB,cACpB,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,eACnC,MAAM,GAAG,MAAM,WAW5B,CAAC"}
1
+ {"version":3,"file":"useActiveModalCount.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveModalCount.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,mBAAmB,cACpB,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,eACnC,MAAM,GAAG,MAAM,WAW5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Duration } from '../@aileron/types';
1
+ import type { Duration } from '../@aileron/declare';
2
2
  import type { ModalNode } from '../core';
3
3
  export declare const useDestroyAfter: (modalId: ModalNode["id"], duration: Duration | number) => void;
4
4
  //# sourceMappingURL=useDestroyAfter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDestroyAfter.d.ts","sourceRoot":"","sources":["../../src/hooks/useDestroyAfter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,eAAe,YACjB,SAAS,CAAC,IAAI,CAAC,YACd,QAAQ,GAAG,MAAM,SAuB5B,CAAC"}
1
+ {"version":3,"file":"useDestroyAfter.d.ts","sourceRoot":"","sources":["../../src/hooks/useDestroyAfter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKtD,eAAO,MAAM,eAAe,YACjB,SAAS,CAAC,IAAI,CAAC,YACd,QAAQ,GAAG,MAAM,SAuB5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Fn } from '../@aileron/types';
1
+ import type { Fn } from '../@aileron/declare';
2
2
  interface ModalAnimationHandler {
3
3
  onVisible?: Fn;
4
4
  onHidden?: Fn;
@@ -1 +1 @@
1
- {"version":3,"file":"useModalAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useModalAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEzC,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,EAAE,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,YACnB,OAAO,WACP,qBAAqB,SAc/B,CAAC"}
1
+ {"version":3,"file":"useModalAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useModalAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,UAAU,qBAAqB;IAC7B,SAAS,CAAC,EAAE,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,EAAE,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,YACnB,OAAO,WACP,qBAAqB,SAc/B,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e,n,t,o,r,i,s,a,l,c,u=require("react/jsx-runtime"),d=require("react"),m=require("@winglet/common-utils"),p=require("@winglet/react-utils"),f=require("@emotion/css"),b=require("react-dom");
1
+ "use strict";var e,n,o,t,r,s,i,a,l,c,u=require("react/jsx-runtime"),d=require("react"),m=require("@winglet/common-utils"),p=require("@winglet/react-utils"),C=require("@emotion/css"),f=require("react-dom");
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -14,5 +14,5 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
16
  /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
17
- function h(e,n,t,o){if("a"===t&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?e!==n||!o:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?o:"a"===t?o.call(e):o?o.value:n.get(e)}function C(e,n,t,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?e!==n||!r:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,t):r?r.value=t:n.set(e,t),t}"function"==typeof SuppressedError&&SuppressedError;class g{static activate(){return!h(e,e,"f",n)&&C(e,e,!0,"f",n)}static anchor(n){if(h(e,e,"f",t)){const n=document.getElementById(h(e,e,"f",t).id);if(n)return n}const{tag:o="div",prefix:r="promise-modal",root:i=document.body}=n||{},s=document.createElement(o);return s.setAttribute("id",`${r}-${m.getRandomString(36)}`),i.appendChild(s),C(e,e,s,"f",t),s}static get prerender(){return h(e,e,"f",o)}static set openHandler(n){C(e,e,n,"f",r),C(e,e,[],"f",o)}static get unanchored(){return!h(e,e,"f",t)}static reset(){C(e,e,!1,"f",n),C(e,e,null,"f",t),C(e,e,[],"f",o),C(e,e,(n=>h(e,e,"f",o).push(n)),"f",r)}static open(n){h(e,e,"f",r).call(e,n)}}e=g,n={value:!1},t={value:null},o={value:[]},r={value:n=>h(e,e,"f",o).push(n)};class v{get alive(){return h(this,i,"f")}get visible(){return h(this,s,"f")}constructor({id:e,initiator:n,title:t,subtitle:o,background:r,dimmed:c=!0,manualDestroy:u=!1,closeOnBackdropClick:d=!0,resolve:m,ForegroundComponent:p,BackgroundComponent:f}){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initiator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtitle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"background",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualDestroy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"closeOnBackdropClick",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dimmed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ForegroundComponent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BackgroundComponent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i.set(this,void 0),s.set(this,void 0),a.set(this,void 0),l.set(this,new Set),this.id=e,this.initiator=n,this.title=t,this.subtitle=o,this.background=r,this.dimmed=c,this.manualDestroy=u,this.closeOnBackdropClick=d,this.ForegroundComponent=p,this.BackgroundComponent=f,C(this,i,!0,"f"),C(this,s,!0,"f"),C(this,a,m,"f")}subscribe(e){return h(this,l,"f").add(e),()=>{h(this,l,"f").delete(e)}}publish(){for(const e of h(this,l,"f"))e()}resolve(e){h(this,a,"f").call(this,e)}onDestroy(){const e=!0===h(this,i,"f");C(this,i,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===h(this,s,"f");C(this,s,!0,"f"),e&&this.publish()}onHide(){const e=!0===h(this,s,"f");C(this,s,!1,"f"),e&&this.publish()}}i=new WeakMap,s=new WeakMap,a=new WeakMap,l=new WeakMap;class y extends v{constructor({id:e,initiator:n,type:t,subtype:o,title:r,subtitle:i,content:s,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:f}){super({id:e,initiator:n,title:r,subtitle:i,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:f}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=t,this.subtype=o,this.content=s,this.footer=a}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class k extends v{constructor({id:e,initiator:n,type:t,subtype:o,title:r,subtitle:i,content:s,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:f}){super({id:e,initiator:n,title:r,subtitle:i,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:f}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"subtype",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.type=t,this.subtype=o,this.content=s,this.footer=a}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class x extends v{constructor({id:e,initiator:n,type:t,title:o,subtitle:r,content:i,defaultValue:s,Input:a,disabled:l,returnOnCancel:u,footer:d,background:m,dimmed:p,manualDestroy:f,closeOnBackdropClick:b,resolve:h,ForegroundComponent:g,BackgroundComponent:v}){super({id:e,initiator:n,title:o,subtitle:r,background:m,dimmed:p,manualDestroy:f,closeOnBackdropClick:b,resolve:h,ForegroundComponent:g,BackgroundComponent:v}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"Input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnOnCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c.set(this,void 0),this.type=t,this.content=i,this.Input=a,this.defaultValue=s,C(this,c,s,"f"),this.disabled=l,this.returnOnCancel=u,this.footer=d}onChange(e){C(this,c,e,"f")}onConfirm(){this.resolve(h(this,c,"f")??null)}onClose(){this.returnOnCancel?this.resolve(h(this,c,"f")??null):this.resolve(null)}}c=new WeakMap;const j=e=>{switch(e.type){case"alert":return new y(e);case"confirm":return new k(e);case"prompt":return new x(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},w=d.createContext({}),O=d.memo((({usePathname:e,children:n})=>{const t=d.useRef(new Map),[o,r]=d.useState([]),i=p.useReference(o),{pathname:s}=e(),a=d.useRef(s),l=d.useRef(0),c=q(),f=d.useMemo((()=>m.convertMsFromDuration(c.duration)),[c]);p.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=c;for(const o of g.prerender){const i=j({...o,id:l.current++,initiator:a.current,manualDestroy:void 0!==o.manualDestroy?o.manualDestroy:e,closeOnBackdropClick:void 0!==o.closeOnBackdropClick?o.closeOnBackdropClick:n});t.current.set(i.id,i),r((e=>[...e,i.id]))}return g.openHandler=o=>{const i=j({...o,id:l.current++,initiator:a.current,manualDestroy:void 0!==o.manualDestroy?o.manualDestroy:e,closeOnBackdropClick:void 0!==o.closeOnBackdropClick?o.closeOnBackdropClick:n});t.current.set(i.id,i),r((e=>{const n=[];for(const o of e)t.current.get(o)?.alive?n.push(o):t.current.delete(o);return[...n,i.id]}))},()=>{g.reset()}})),d.useLayoutEffect((()=>{for(const e of i.current){const n=t.current.get(e);n?.alive&&(n.initiator===s?n.onShow():n.onHide())}a.current=s}),[i,s]);const b=d.useCallback((e=>t.current.get(e)),[]),h=d.useCallback((e=>{const n=t.current.get(e);n&&(n.onDestroy(),C.current?.())}),[]),C=d.useRef(),v=d.useCallback((e=>{const n=t.current.get(e);n&&(n.onHide(),C.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),f))}),[f]),y=d.useCallback(((e,n)=>{const o=t.current.get(e);o&&"prompt"===o.type&&o.onChange(n)}),[]),k=d.useCallback((e=>{const n=t.current.get(e);n&&(n.onConfirm(),v(e))}),[v]),x=d.useCallback((e=>{const n=t.current.get(e);n&&(n.onClose(),v(e))}),[v]),O=d.useCallback((e=>({modal:b(e),onConfirm:()=>k(e),onClose:()=>x(e),onChange:n=>y(e,n),onDestroy:()=>h(e)})),[b,k,x,y,h]),B=d.useMemo((()=>({modalIds:o,getModalNode:b,onChange:y,onConfirm:k,onClose:x,onDestroy:h,getModal:O,setUpdater:e=>{C.current=e}})),[o,O,b,y,k,x,h]);return u.jsx(w.Provider,{value:B,children:n})})),B=()=>d.useContext(w),D=e=>{const{getModal:n}=B();return d.useMemo((()=>n(e)),[e,n])};function F(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const P=f.css("production"===process.env.NODE_ENV?{name:"131j9g2",styles:"margin:unset"}:{name:"1w3kbco-fallback",styles:"margin:unset;label:fallback;",toString:F}),M=f.css("production"===process.env.NODE_ENV?{name:"1kuk3a3",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black"}:{name:"16dbbea-frame",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black;label:frame;",toString:F}),S=({children:e})=>u.jsx("h2",{className:P,children:e}),E=({children:e})=>u.jsx("h3",{className:P,children:e}),N=({children:e})=>u.jsx("div",{className:P,children:e}),I=({confirmLabel:e,hideConfirm:n=!1,cancelLabel:t,hideCancel:o=!1,disabled:r,onConfirm:i,onCancel:s})=>u.jsxs("div",{children:[!n&&u.jsx("button",{onClick:i,disabled:r,children:e||"확인"}),!o&&"function"==typeof s&&u.jsx("button",{onClick:s,children:t||"취소"})]}),V=e=>e?.visible,T=(e=V,n=0)=>{const{modalIds:t,getModalNode:o}=B();return d.useMemo((()=>{let n=0;for(const r of t)e(o(r))&&n++;return n}),[o,t,n])},z=d.forwardRef((({id:e,onChangeOrder:n,children:t},o)=>{const r=T(),[i,s]=d.useMemo((()=>{const n=r>1;return[n?Math.floor(e/5)%3*100:0,n?e%5*35:0]}),[r,e]);return u.jsx("div",{ref:o,className:M,onClick:n,style:{marginBottom:`calc(25vh + ${i}px)`,marginLeft:`${i}px`,transform:`translate(${s}px, ${s}px)`},children:t})})),R=d.createContext({}),H=d.memo((({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:t,SubtitleComponent:o,ContentComponent:r,FooterComponent:i,options:s,children:a})=>{const l=d.useMemo((()=>({BackgroundComponent:n,ForegroundComponent:e||z,TitleComponent:t||S,SubtitleComponent:o||E,ContentComponent:d.memo(r||N),FooterComponent:d.memo(i||I),options:{duration:"300ms",backdrop:"rgba(0, 0, 0, 0.5)",closeOnBackdropClick:!0,manualDestroy:!1,...s}})),[e,n,r,i,o,t,s]);return u.jsx(R.Provider,{value:l,children:a})})),L=()=>d.useContext(R),q=()=>d.useContext(R).options,A=d.createContext({}),_=({context:e,children:n})=>{const t=d.useMemo((()=>({context:e||{}})),[e]);return u.jsx(A.Provider,{value:t,children:n})},$=()=>d.useContext(A),W=()=>{const[e,n]=d.useState(window.location.pathname);return d.useLayoutEffect((()=>{let t;const o=()=>{t&&cancelAnimationFrame(t),e!==window.location.pathname?n(window.location.pathname):t=requestAnimationFrame(o)};return t=requestAnimationFrame(o),()=>{t&&cancelAnimationFrame(t)}}),[e]),{pathname:e}};function Y(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const U=f.css("production"===process.env.NODE_ENV?{name:"u7uu4v",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;}"}:{name:"coymdj-background",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;};label:background;",toString:Y}),G=f.css("production"===process.env.NODE_ENV?{name:"n07k1x",styles:"pointer-events:all"}:{name:"1hektcs-active",styles:"pointer-events:all;label:active;",toString:Y}),J=f.css("production"===process.env.NODE_ENV?{name:"1wnowod",styles:"display:flex;align-items:center;justify-content:center"}:{name:"xppew7-visible",styles:"display:flex;align-items:center;justify-content:center;label:visible;",toString:Y}),K=({modalId:e,onChangeOrder:n})=>{const{BackgroundComponent:t}=L(),{context:o}=$(),{modal:r,onClose:i,onChange:s,onConfirm:a,onDestroy:l}=D(e),c=d.useCallback((e=>{r&&r.closeOnBackdropClick&&r.visible&&i(),e.stopPropagation()}),[r,i]),m=d.useMemo((()=>r?.BackgroundComponent||t),[t,r]);return r?u.jsx("div",{className:f.cx(U,{[J]:r.manualDestroy?r.alive:r.visible,[G]:r.closeOnBackdropClick&&r.visible}),onClick:c,children:m&&u.jsx(m,{id:r.id,type:r.type,alive:r.alive,visible:r.visible,initiator:r.initiator,manualDestroy:r.manualDestroy,closeOnBackdropClick:r.closeOnBackdropClick,background:r.background,onChange:s,onConfirm:a,onClose:i,onDestroy:l,onChangeOrder:n,context:o})}):null};function Q(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const X=f.css("production"===process.env.NODE_ENV?{name:"12g0hx0",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1"}:{name:"1hcczik-foreground",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1;label:foreground;",toString:Q}),Z=f.css("production"===process.env.NODE_ENV?{name:"1g95xyq",styles:">*{pointer-events:all;}"}:{name:"123csva-active",styles:">*{pointer-events:all;};label:active;",toString:Q}),ee=f.css("production"===process.env.NODE_ENV?{name:"1fmljv2",styles:"display:flex!important;justify-content:center;align-items:center"}:{name:"1p4unab-visible",styles:"display:flex!important;justify-content:center;align-items:center;label:visible;",toString:Q}),ne=d.memo((({modal:e,handlers:n})=>{const{title:t,subtitle:o,content:r,footer:i}=d.useMemo((()=>e),[e]),{context:s}=$(),{onConfirm:a}=d.useMemo((()=>n),[n]),l=p.useHandle(a),{TitleComponent:c,SubtitleComponent:f,ContentComponent:b,FooterComponent:h}=L();return u.jsxs(d.Fragment,{children:[t&&(m.isString(t)?u.jsx(c,{context:s,children:t}):t),o&&(m.isString(o)?u.jsx(f,{context:s,children:o}):o),r&&(m.isString(r)?u.jsx(b,{context:s,children:r}):p.renderComponent(r,{onConfirm:l})),!1!==i&&("function"==typeof i?i({onConfirm:l,context:s}):u.jsx(h,{onConfirm:l,confirmLabel:i?.confirm,hideConfirm:i?.hideConfirm,context:s}))]})})),te=d.memo((({modal:e,handlers:n})=>{const{title:t,subtitle:o,content:r,footer:i}=d.useMemo((()=>e),[e]),{context:s}=$(),{onConfirm:a,onClose:l}=d.useMemo((()=>n),[n]),c=p.useHandle(a),f=p.useHandle(l),{TitleComponent:b,SubtitleComponent:h,ContentComponent:C,FooterComponent:g}=L();return u.jsxs(d.Fragment,{children:[t&&(m.isString(t)?u.jsx(b,{context:s,children:t}):t),o&&(m.isString(o)?u.jsx(h,{context:s,children:o}):o),r&&(m.isString(r)?u.jsx(C,{context:s,children:r}):p.renderComponent(r,{onConfirm:c,onCancel:f,context:s})),!1!==i&&("function"==typeof i?i({onConfirm:c,onCancel:f,context:s}):u.jsx(g,{onConfirm:c,onCancel:f,confirmLabel:i?.confirm,cancelLabel:i?.cancel,hideConfirm:i?.hideConfirm,hideCancel:i?.hideCancel,context:s}))]})})),oe=d.memo((({modal:e,handlers:n})=>{const{Input:t,defaultValue:o,disabled:r,title:i,subtitle:s,content:a,footer:l}=d.useMemo((()=>({...e,Input:d.memo(p.withErrorBoundary(e.Input))})),[e]),{context:c}=$(),[f,b]=d.useState(o),{onChange:h,onClose:C,onConfirm:g}=d.useMemo((()=>n),[n]),v=p.useHandle(C),y=p.useHandle((e=>{const n=m.isFunction(e)?e(f):e;b(n),h(n)})),k=d.useCallback((()=>{setTimeout((()=>{g()}))}),[g]),x=d.useMemo((()=>!!f&&!!r?.(f)),[r,f]),{TitleComponent:j,SubtitleComponent:w,ContentComponent:O,FooterComponent:B}=L();return u.jsxs(d.Fragment,{children:[i&&(m.isString(i)?u.jsx(j,{context:c,children:i}):i),s&&(m.isString(s)?u.jsx(w,{context:c,children:s}):s),a&&(m.isString(a)?u.jsx(O,{context:c,children:a}):p.renderComponent(a,{onConfirm:k,onCancel:v,context:c})),t&&u.jsx(t,{defaultValue:o,value:f,onChange:y,onConfirm:k,onCancel:v,context:c}),!1!==l&&("function"==typeof l?l({value:f,disabled:x,onChange:y,onConfirm:k,onCancel:v,context:c}):u.jsx(B,{disabled:x,onConfirm:k,onCancel:v,confirmLabel:l?.confirm,cancelLabel:l?.cancel,hideConfirm:l?.hideConfirm,hideCancel:l?.hideCancel,context:c}))]})})),re=({modalId:e,onChangeOrder:n})=>{const{ForegroundComponent:t}=L(),{context:o}=$(),{modal:r,onChange:i,onConfirm:s,onClose:a,onDestroy:l}=D(e),c=d.useMemo((()=>r?.ForegroundComponent||t),[t,r]);return r?u.jsx("div",{className:f.cx(X,{[ee]:r.manualDestroy?r.alive:r.visible,[Z]:r.visible}),children:u.jsxs(c,{id:r.id,type:r.type,alive:r.alive,visible:r.visible,initiator:r.initiator,manualDestroy:r.manualDestroy,closeOnBackdropClick:r.closeOnBackdropClick,background:r.background,onChange:i,onConfirm:s,onClose:a,onDestroy:l,onChangeOrder:n,context:o,children:["alert"===r.type&&u.jsx(ne,{modal:r,handlers:{onConfirm:s}}),"confirm"===r.type&&u.jsx(te,{modal:r,handlers:{onConfirm:s,onClose:a}}),"prompt"===r.type&&u.jsx(oe,{modal:r,handlers:{onChange:i,onConfirm:s,onClose:a}})]})}):null},ie=e=>{const[n,t]=p.useVersion();return d.useEffect((()=>{if(e)return e.subscribe(t)}),[e]),n},se=f.css("production"===process.env.NODE_ENV?{name:"13dmkf4",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden"}:{name:"yjeu12-presenter",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden;label:presenter;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),{increment:ae}=m.counterFactory(1),le=d.memo((({modalId:e})=>{const n=d.useRef(null),{modal:t}=D(e);ie(t);const o=p.useHandle((()=>{n.current&&(n.current.style.zIndex=`${ae()}`)}));return u.jsxs("div",{ref:n,className:se,children:[u.jsx(K,{modalId:e,onChangeOrder:o}),u.jsx(re,{modalId:e,onChangeOrder:o})]})})),ce=f.css("production"===process.env.NODE_ENV?{name:"2hpasy",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out"}:{name:"lhj8co-anchor",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out;label:anchor;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),ue=e=>e?.visible&&e.dimmed,de=d.memo(p.withErrorBoundary((()=>{const[e,n]=p.useVersion(),{modalIds:t,setUpdater:o}=B();d.useEffect((()=>{o(n)}),[o,n]);const r=q(),i=T(ue,e);return u.jsx("div",{className:ce,style:{transitionDuration:r.duration,backgroundColor:i?r.backdrop:"transparent"},children:m.map(t,(e=>u.jsx(le,{modalId:e},e)))})}))),me=({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:t,SubtitleComponent:o,ContentComponent:r,FooterComponent:i,usePathname:s,options:a,context:l,anchor:c})=>b.createPortal(u.jsx(_,{context:l,children:u.jsx(H,{ForegroundComponent:e,BackgroundComponent:n,TitleComponent:t,SubtitleComponent:o,ContentComponent:r,FooterComponent:i,options:a,children:u.jsx(O,{usePathname:s,children:u.jsx(de,{})})})}),c),pe=()=>{const e=d.useRef(g.activate()),n=d.useRef(null),[,t]=p.useVersion(),o=d.useCallback((o=>{e.current?(n.current=g.anchor({root:o}),t()):m.printError("ModalProvider is already initialized",["ModalProvider can only be initialized once.","Nesting ModalProvider will be ignored..."],{info:"Something is wrong with the ModalProvider initialization..."})}),[t]);return{anchorRef:n,handleInitialize:o}},fe=d.forwardRef((({usePathname:e,ForegroundComponent:n,BackgroundComponent:t,TitleComponent:o,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,options:a,context:l,children:c},m)=>{const f=d.useMemo((()=>e||W),[e]),{anchorRef:b,handleInitialize:h}=pe();return d.useImperativeHandle(m,(()=>({initialize:h})),[h]),p.useOnMount((()=>(null===m&&h(),()=>{b.current&&b.current.remove()}))),u.jsxs(d.Fragment,{children:[c,b.current&&me({ForegroundComponent:n,BackgroundComponent:t,TitleComponent:o,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,usePathname:f,options:a,context:l,anchor:b.current})]})}));exports.ModalProvider=fe,exports.alert=({subtype:e,title:n,subtitle:t,content:o,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{g.open({type:"alert",subtype:e,resolve:()=>d(),title:n,subtitle:t,content:o,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.confirm=({subtype:e,title:n,subtitle:t,content:o,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{g.open({type:"confirm",subtype:e,resolve:e=>d(e??!1),title:n,subtitle:t,content:o,background:r,footer:i,dimmed:s,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:t,content:o,Input:r,disabled:i,returnOnCancel:s,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})=>new Promise(((f,b)=>{try{g.open({type:"prompt",resolve:e=>f(e),title:n,subtitle:t,content:o,Input:r,defaultValue:e,disabled:i,returnOnCancel:s,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})}catch(e){b(e)}})),exports.useActiveModalCount=T,exports.useDestroyAfter=(e,n)=>{const{modal:t,onDestroy:o}=D(e),r=ie(t),i=d.useRef({modal:t,onDestroy:o,milliseconds:m.isString(n)?m.convertMsFromDuration(n):n});d.useEffect((()=>{const{modal:e,onDestroy:n,milliseconds:t}=i.current;if(!e||e.visible||!e.alive)return;const o=setTimeout((()=>{n()}),t);return()=>{o&&clearTimeout(o)}}),[r])},exports.useInitializeModal=({usePathname:e,ForegroundComponent:n,BackgroundComponent:t,TitleComponent:o,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,options:a,context:l,mode:c="auto"}={})=>{const u=d.useMemo((()=>e||W),[e]),{anchorRef:m,handleInitialize:f}=pe();p.useOnMount((()=>("auto"===c&&f(),()=>{m.current&&m.current.remove()})));const b=d.useCallback((e=>{"manual"===c&&f(e)}),[c,f]);return{portal:m.current&&me({usePathname:u,ForegroundComponent:n,BackgroundComponent:t,TitleComponent:o,SubtitleComponent:r,ContentComponent:i,FooterComponent:s,options:a,context:l,anchor:m.current}),initialize:b}},exports.useModalAnimation=(e,n)=>{const t=d.useRef(n);t.current=n,d.useLayoutEffect((()=>{if(!t.current)return;let n;return n=e?requestAnimationFrame((()=>t.current.onVisible?.())):requestAnimationFrame((()=>t.current.onHidden?.())),()=>{n&&cancelAnimationFrame(n)}}),[e])},exports.useModalBackdrop=()=>q().backdrop,exports.useModalDuration=()=>{const e=q();return{duration:e.duration,milliseconds:m.convertMsFromDuration(e.duration)}},exports.useModalOptions=q,exports.useSubscribeModal=ie;
17
+ function h(e,n,o,t){if("a"===o&&!t)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?e!==n||!t:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?t:"a"===o?t.call(e):t?t.value:n.get(e)}function g(e,n,o,t,r){if("m"===t)throw new TypeError("Private method is not writable");if("a"===t&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?e!==n||!r:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===t?r.call(e,o):r?r.value=o:n.set(e,o),o}"function"==typeof SuppressedError&&SuppressedError;class b{static activate(){return!h(e,e,"f",n)&&g(e,e,!0,"f",n)}static anchor(n){if(h(e,e,"f",o)){const n=document.getElementById(h(e,e,"f",o).id);if(n)return n}const{tag:t="div",prefix:r="promise-modal",root:s=document.body}=n||{},i=document.createElement(t);return i.setAttribute("id",`${r}-${m.getRandomString(36)}`),s.appendChild(i),g(e,e,i,"f",o),i}static get prerender(){return h(e,e,"f",t)}static set openHandler(n){g(e,e,n,"f",r),g(e,e,[],"f",t)}static get unanchored(){return!h(e,e,"f",o)}static reset(){g(e,e,!1,"f",n),g(e,e,null,"f",o),g(e,e,[],"f",t),g(e,e,(n=>h(e,e,"f",t).push(n)),"f",r)}static open(n){h(e,e,"f",r).call(e,n)}}e=b,n={value:!1},o={value:null},t={value:[]},r={value:n=>h(e,e,"f",t).push(n)};class y{get alive(){return h(this,s,"f")}get visible(){return h(this,i,"f")}constructor({id:e,initiator:n,title:o,subtitle:t,background:r,dimmed:c=!0,manualDestroy:u=!1,closeOnBackdropClick:d=!0,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){s.set(this,void 0),i.set(this,void 0),a.set(this,void 0),l.set(this,new Set),this.id=e,this.initiator=n,this.title=o,this.subtitle=t,this.background=r,this.dimmed=c,this.manualDestroy=u,this.closeOnBackdropClick=d,this.ForegroundComponent=p,this.BackgroundComponent=C,g(this,s,!0,"f"),g(this,i,!0,"f"),g(this,a,m,"f")}subscribe(e){return h(this,l,"f").add(e),()=>{h(this,l,"f").delete(e)}}publish(){for(const e of h(this,l,"f"))e()}resolve(e){h(this,a,"f").call(this,e)}onDestroy(){const e=!0===h(this,s,"f");g(this,s,!1,"f"),this.manualDestroy&&e&&this.publish()}onShow(){const e=!1===h(this,i,"f");g(this,i,!0,"f"),e&&this.publish()}onHide(){const e=!0===h(this,i,"f");g(this,i,!1,"f"),e&&this.publish()}}s=new WeakMap,i=new WeakMap,a=new WeakMap,l=new WeakMap;class v extends y{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:s,content:i,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){super({id:e,initiator:n,title:r,subtitle:s,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}),this.type=o,this.subtype=t,this.content=i,this.footer=a}onClose(){this.resolve(null)}onConfirm(){this.resolve(null)}}class x extends y{constructor({id:e,initiator:n,type:o,subtype:t,title:r,subtitle:s,content:i,footer:a,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}){super({id:e,initiator:n,title:r,subtitle:s,background:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,resolve:m,ForegroundComponent:p,BackgroundComponent:C}),this.type=o,this.subtype=t,this.content=i,this.footer=a}onClose(){this.resolve(!1)}onConfirm(){this.resolve(!0)}}class k extends y{constructor({id:e,initiator:n,type:o,title:t,subtitle:r,content:s,defaultValue:i,Input:a,disabled:l,returnOnCancel:u,footer:d,background:m,dimmed:p,manualDestroy:C,closeOnBackdropClick:f,resolve:h,ForegroundComponent:b,BackgroundComponent:y}){super({id:e,initiator:n,title:t,subtitle:r,background:m,dimmed:p,manualDestroy:C,closeOnBackdropClick:f,resolve:h,ForegroundComponent:b,BackgroundComponent:y}),c.set(this,void 0),this.type=o,this.content=s,this.Input=a,this.defaultValue=i,g(this,c,i,"f"),this.disabled=l,this.returnOnCancel=u,this.footer=d}onChange(e){g(this,c,e,"f")}onConfirm(){this.resolve(h(this,c,"f")??null)}onClose(){this.returnOnCancel?this.resolve(h(this,c,"f")??null):this.resolve(null)}}c=new WeakMap;const j=e=>{switch(e.type){case"alert":return new v(e);case"confirm":return new x(e);case"prompt":return new k(e)}throw new Error(`Unknown modal: ${e.type}`,{modal:e})},w=d.createContext({}),D=d.memo((({usePathname:e,children:n})=>{const o=d.useRef(new Map),[t,r]=d.useState([]),s=p.useReference(t),{pathname:i}=e(),a=d.useRef(i),l=d.useRef(0),c=q(),C=d.useMemo((()=>m.convertMsFromDuration(c.duration)),[c]);p.useOnMountLayout((()=>{const{manualDestroy:e,closeOnBackdropClick:n}=c;for(const t of b.prerender){const s=j({...t,id:l.current++,initiator:a.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});o.current.set(s.id,s),r((e=>[...e,s.id]))}return b.openHandler=t=>{const s=j({...t,id:l.current++,initiator:a.current,manualDestroy:void 0!==t.manualDestroy?t.manualDestroy:e,closeOnBackdropClick:void 0!==t.closeOnBackdropClick?t.closeOnBackdropClick:n});o.current.set(s.id,s),r((e=>{const n=[];for(const t of e)o.current.get(t)?.alive?n.push(t):o.current.delete(t);return[...n,s.id]}))},()=>{b.reset()}})),d.useLayoutEffect((()=>{for(const e of s.current){const n=o.current.get(e);n?.alive&&(n.initiator===i?n.onShow():n.onHide())}a.current=i}),[s,i]);const f=d.useCallback((e=>o.current.get(e)),[]),h=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onDestroy(),g.current?.())}),[]),g=d.useRef(),y=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onHide(),g.current?.(),n.manualDestroy||setTimeout((()=>{n.onDestroy()}),C))}),[C]),v=d.useCallback(((e,n)=>{const t=o.current.get(e);t&&"prompt"===t.type&&t.onChange(n)}),[]),x=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onConfirm(),y(e))}),[y]),k=d.useCallback((e=>{const n=o.current.get(e);n&&(n.onClose(),y(e))}),[y]),D=d.useCallback((e=>({modal:f(e),onConfirm:()=>x(e),onClose:()=>k(e),onChange:n=>v(e,n),onDestroy:()=>h(e)})),[f,x,k,v,h]),B=d.useMemo((()=>({modalIds:t,getModalNode:f,onChange:v,onConfirm:x,onClose:k,onDestroy:h,getModal:D,setUpdater:e=>{g.current=e}})),[t,D,f,v,x,k,h]);return u.jsx(w.Provider,{value:B,children:n})})),B=()=>d.useContext(w),O=e=>{const{getModal:n}=B();return d.useMemo((()=>n(e)),[e,n])};function F(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const M=C.css("production"===process.env.NODE_ENV?{name:"131j9g2",styles:"margin:unset"}:{name:"1w3kbco-fallback",styles:"margin:unset;label:fallback;",toString:F}),S=C.css("production"===process.env.NODE_ENV?{name:"1kuk3a3",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black"}:{name:"16dbbea-frame",styles:"display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:white;padding:20px 80px;gap:10px;border:1px solid black;label:frame;",toString:F}),E=({children:e})=>u.jsx("h2",{className:M,children:e}),N=({children:e})=>u.jsx("h3",{className:M,children:e}),I=({children:e})=>u.jsx("div",{className:M,children:e}),P=({confirmLabel:e,hideConfirm:n=!1,cancelLabel:o,hideCancel:t=!1,disabled:r,onConfirm:s,onCancel:i})=>u.jsxs("div",{children:[!n&&u.jsx("button",{onClick:s,disabled:r,children:e||"확인"}),!t&&"function"==typeof i&&u.jsx("button",{onClick:i,children:o||"취소"})]}),T=e=>e?.visible,V=(e=T,n=0)=>{const{modalIds:o,getModalNode:t}=B();return d.useMemo((()=>{let n=0;for(const r of o)e(t(r))&&n++;return n}),[t,o,n])},z=d.forwardRef((({id:e,onChangeOrder:n,children:o},t)=>{const r=V(),[s,i]=d.useMemo((()=>{const n=r>1;return[n?Math.floor(e/5)%3*100:0,n?e%5*35:0]}),[r,e]);return u.jsx("div",{ref:t,className:S,onClick:n,style:{marginBottom:`calc(25vh + ${s}px)`,marginLeft:`${s}px`,transform:`translate(${i}px, ${i}px)`},children:o})})),R=d.createContext({}),H=d.memo((({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:s,options:i,children:a})=>{const l=d.useMemo((()=>({BackgroundComponent:n,ForegroundComponent:e||z,TitleComponent:o||E,SubtitleComponent:t||N,ContentComponent:d.memo(r||I),FooterComponent:d.memo(s||P),options:{duration:"300ms",backdrop:"rgba(0, 0, 0, 0.5)",closeOnBackdropClick:!0,manualDestroy:!1,...i}})),[e,n,r,s,t,o,i]);return u.jsx(R.Provider,{value:l,children:a})})),L=()=>d.useContext(R),q=()=>d.useContext(R).options,A=d.createContext({}),_=({context:e,children:n})=>{const o=d.useMemo((()=>({context:e||{}})),[e]);return u.jsx(A.Provider,{value:o,children:n})},$=()=>d.useContext(A),W=()=>{const[e,n]=d.useState(window.location.pathname);return d.useLayoutEffect((()=>{let o;const t=()=>{o&&cancelAnimationFrame(o),e!==window.location.pathname?n(window.location.pathname):o=requestAnimationFrame(t)};return o=requestAnimationFrame(t),()=>{o&&cancelAnimationFrame(o)}}),[e]),{pathname:e}};function Y(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const U=C.css("production"===process.env.NODE_ENV?{name:"u7uu4v",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;}"}:{name:"coymdj-background",styles:"display:none;position:fixed;inset:0;z-index:-999;pointer-events:none;>*{pointer-events:none;};label:background;",toString:Y}),G=C.css("production"===process.env.NODE_ENV?{name:"n07k1x",styles:"pointer-events:all"}:{name:"1hektcs-active",styles:"pointer-events:all;label:active;",toString:Y}),J=C.css("production"===process.env.NODE_ENV?{name:"1wnowod",styles:"display:flex;align-items:center;justify-content:center"}:{name:"xppew7-visible",styles:"display:flex;align-items:center;justify-content:center;label:visible;",toString:Y}),K=({modalId:e,onChangeOrder:n})=>{const{BackgroundComponent:o}=L(),{context:t}=$(),{modal:r,onClose:s,onChange:i,onConfirm:a,onDestroy:l}=O(e),c=d.useCallback((e=>{r&&r.closeOnBackdropClick&&r.visible&&s(),e.stopPropagation()}),[r,s]),m=d.useMemo((()=>r?.BackgroundComponent||o),[o,r]);return r?u.jsx("div",{className:C.cx(U,{[J]:r.manualDestroy?r.alive:r.visible,[G]:r.closeOnBackdropClick&&r.visible}),onClick:c,children:m&&u.jsx(m,{id:r.id,type:r.type,alive:r.alive,visible:r.visible,initiator:r.initiator,manualDestroy:r.manualDestroy,closeOnBackdropClick:r.closeOnBackdropClick,background:r.background,onChange:i,onConfirm:a,onClose:s,onDestroy:l,onChangeOrder:n,context:t})}):null};function Q(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}const X=C.css("production"===process.env.NODE_ENV?{name:"12g0hx0",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1"}:{name:"1hcczik-foreground",styles:"pointer-events:none;display:none;position:fixed;inset:0;z-index:1;label:foreground;",toString:Q}),Z=C.css("production"===process.env.NODE_ENV?{name:"1g95xyq",styles:">*{pointer-events:all;}"}:{name:"123csva-active",styles:">*{pointer-events:all;};label:active;",toString:Q}),ee=C.css("production"===process.env.NODE_ENV?{name:"1fmljv2",styles:"display:flex!important;justify-content:center;align-items:center"}:{name:"1p4unab-visible",styles:"display:flex!important;justify-content:center;align-items:center;label:visible;",toString:Q}),ne=d.memo((({modal:e,handlers:n})=>{const{title:o,subtitle:t,content:r,footer:s}=d.useMemo((()=>e),[e]),{context:i}=$(),{onConfirm:a}=d.useMemo((()=>n),[n]),l=p.useHandle(a),{TitleComponent:c,SubtitleComponent:C,ContentComponent:f,FooterComponent:h}=L();return u.jsxs(d.Fragment,{children:[o&&(m.isString(o)?u.jsx(c,{context:i,children:o}):o),t&&(m.isString(t)?u.jsx(C,{context:i,children:t}):t),r&&(m.isString(r)?u.jsx(f,{context:i,children:r}):p.renderComponent(r,{onConfirm:l})),!1!==s&&("function"==typeof s?s({onConfirm:l,context:i}):u.jsx(h,{onConfirm:l,confirmLabel:s?.confirm,hideConfirm:s?.hideConfirm,context:i}))]})})),oe=d.memo((({modal:e,handlers:n})=>{const{title:o,subtitle:t,content:r,footer:s}=d.useMemo((()=>e),[e]),{context:i}=$(),{onConfirm:a,onClose:l}=d.useMemo((()=>n),[n]),c=p.useHandle(a),C=p.useHandle(l),{TitleComponent:f,SubtitleComponent:h,ContentComponent:g,FooterComponent:b}=L();return u.jsxs(d.Fragment,{children:[o&&(m.isString(o)?u.jsx(f,{context:i,children:o}):o),t&&(m.isString(t)?u.jsx(h,{context:i,children:t}):t),r&&(m.isString(r)?u.jsx(g,{context:i,children:r}):p.renderComponent(r,{onConfirm:c,onCancel:C,context:i})),!1!==s&&("function"==typeof s?s({onConfirm:c,onCancel:C,context:i}):u.jsx(b,{onConfirm:c,onCancel:C,confirmLabel:s?.confirm,cancelLabel:s?.cancel,hideConfirm:s?.hideConfirm,hideCancel:s?.hideCancel,context:i}))]})})),te=d.memo((({modal:e,handlers:n})=>{const{Input:o,defaultValue:t,disabled:r,title:s,subtitle:i,content:a,footer:l}=d.useMemo((()=>({...e,Input:d.memo(p.withErrorBoundary(e.Input))})),[e]),{context:c}=$(),[C,f]=d.useState(t),{onChange:h,onClose:g,onConfirm:b}=d.useMemo((()=>n),[n]),y=p.useHandle(g),v=p.useHandle((e=>{const n=m.isFunction(e)?e(C):e;f(n),h(n)})),x=d.useCallback((()=>{setTimeout((()=>{b()}))}),[b]),k=d.useMemo((()=>!!C&&!!r?.(C)),[r,C]),{TitleComponent:j,SubtitleComponent:w,ContentComponent:D,FooterComponent:B}=L();return u.jsxs(d.Fragment,{children:[s&&(m.isString(s)?u.jsx(j,{context:c,children:s}):s),i&&(m.isString(i)?u.jsx(w,{context:c,children:i}):i),a&&(m.isString(a)?u.jsx(D,{context:c,children:a}):p.renderComponent(a,{onConfirm:x,onCancel:y,context:c})),o&&u.jsx(o,{defaultValue:t,value:C,onChange:v,onConfirm:x,onCancel:y,context:c}),!1!==l&&("function"==typeof l?l({value:C,disabled:k,onChange:v,onConfirm:x,onCancel:y,context:c}):u.jsx(B,{disabled:k,onConfirm:x,onCancel:y,confirmLabel:l?.confirm,cancelLabel:l?.cancel,hideConfirm:l?.hideConfirm,hideCancel:l?.hideCancel,context:c}))]})})),re=({modalId:e,onChangeOrder:n})=>{const{ForegroundComponent:o}=L(),{context:t}=$(),{modal:r,onChange:s,onConfirm:i,onClose:a,onDestroy:l}=O(e),c=d.useMemo((()=>r?.ForegroundComponent||o),[o,r]);return r?u.jsx("div",{className:C.cx(X,{[ee]:r.manualDestroy?r.alive:r.visible,[Z]:r.visible}),children:u.jsxs(c,{id:r.id,type:r.type,alive:r.alive,visible:r.visible,initiator:r.initiator,manualDestroy:r.manualDestroy,closeOnBackdropClick:r.closeOnBackdropClick,background:r.background,onChange:s,onConfirm:i,onClose:a,onDestroy:l,onChangeOrder:n,context:t,children:["alert"===r.type&&u.jsx(ne,{modal:r,handlers:{onConfirm:i}}),"confirm"===r.type&&u.jsx(oe,{modal:r,handlers:{onConfirm:i,onClose:a}}),"prompt"===r.type&&u.jsx(te,{modal:r,handlers:{onChange:s,onConfirm:i,onClose:a}})]})}):null},se=e=>{const[n,o]=p.useVersion();return d.useEffect((()=>{if(e)return e.subscribe(o)}),[e]),n},ie=C.css("production"===process.env.NODE_ENV?{name:"13dmkf4",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden"}:{name:"yjeu12-presenter",styles:"position:fixed;inset:0;pointer-events:none;overflow:hidden;label:presenter;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),{increment:ae}=m.counterFactory(1),le=d.memo((({modalId:e})=>{const n=d.useRef(null),{modal:o}=O(e);se(o);const t=p.useHandle((()=>{n.current&&(n.current.style.zIndex=`${ae()}`)}));return u.jsxs("div",{ref:n,className:ie,children:[u.jsx(K,{modalId:e,onChangeOrder:t}),u.jsx(re,{modalId:e,onChangeOrder:t})]})})),ce=C.css("production"===process.env.NODE_ENV?{name:"2hpasy",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out"}:{name:"lhj8co-anchor",styles:"display:flex;align-items:center;justify-content:center;position:fixed;inset:0;pointer-events:none;z-index:1000;transition:background-color ease-in-out;label:anchor;",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),ue=e=>e?.visible&&e.dimmed,de=d.memo(p.withErrorBoundary((()=>{const[e,n]=p.useVersion(),{modalIds:o,setUpdater:t}=B();d.useEffect((()=>{t(n)}),[t,n]);const r=q(),s=V(ue,e);return u.jsx("div",{className:ce,style:{transitionDuration:r.duration,backgroundColor:s?r.backdrop:"transparent"},children:m.map(o,(e=>u.jsx(le,{modalId:e},e)))})}))),me=({ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:s,usePathname:i,options:a,context:l,anchor:c})=>f.createPortal(u.jsx(_,{context:l,children:u.jsx(H,{ForegroundComponent:e,BackgroundComponent:n,TitleComponent:o,SubtitleComponent:t,ContentComponent:r,FooterComponent:s,options:a,children:u.jsx(D,{usePathname:i,children:u.jsx(de,{})})})}),c),pe=()=>{const e=d.useRef(b.activate()),n=d.useRef(null),[,o]=p.useVersion(),t=d.useCallback((t=>{e.current?(n.current=b.anchor({root:t}),o()):m.printError("ModalProvider is already initialized",["ModalProvider can only be initialized once.","Nesting ModalProvider will be ignored..."],{info:"Something is wrong with the ModalProvider initialization..."})}),[o]);return{anchorRef:n,handleInitialize:t}},Ce=d.forwardRef((({usePathname:e,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,options:a,context:l,children:c},m)=>{const C=d.useMemo((()=>e||W),[e]),{anchorRef:f,handleInitialize:h}=pe();return d.useImperativeHandle(m,(()=>({initialize:h})),[h]),p.useOnMount((()=>(null===m&&h(),()=>{f.current&&f.current.remove()}))),u.jsxs(d.Fragment,{children:[c,f.current&&me({ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,usePathname:C,options:a,context:l,anchor:f.current})]})}));exports.ModalProvider=Ce,exports.alert=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{b.open({type:"alert",subtype:e,resolve:()=>d(),title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.confirm=({subtype:e,title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})=>new Promise(((d,m)=>{try{b.open({type:"confirm",subtype:e,resolve:e=>d(e??!1),title:n,subtitle:o,content:t,background:r,footer:s,dimmed:i,manualDestroy:a,closeOnBackdropClick:l,ForegroundComponent:c,BackgroundComponent:u})}catch(e){m(e)}})),exports.prompt=({defaultValue:e,title:n,subtitle:o,content:t,Input:r,disabled:s,returnOnCancel:i,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})=>new Promise(((C,f)=>{try{b.open({type:"prompt",resolve:e=>C(e),title:n,subtitle:o,content:t,Input:r,defaultValue:e,disabled:s,returnOnCancel:i,background:a,footer:l,dimmed:c,manualDestroy:u,closeOnBackdropClick:d,ForegroundComponent:m,BackgroundComponent:p})}catch(e){f(e)}})),exports.useActiveModalCount=V,exports.useDestroyAfter=(e,n)=>{const{modal:o,onDestroy:t}=O(e),r=se(o),s=d.useRef({modal:o,onDestroy:t,milliseconds:m.isString(n)?m.convertMsFromDuration(n):n});d.useEffect((()=>{const{modal:e,onDestroy:n,milliseconds:o}=s.current;if(!e||e.visible||!e.alive)return;const t=setTimeout((()=>{n()}),o);return()=>{t&&clearTimeout(t)}}),[r])},exports.useInitializeModal=({usePathname:e,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,options:a,context:l,mode:c="auto"}={})=>{const u=d.useMemo((()=>e||W),[e]),{anchorRef:m,handleInitialize:C}=pe();p.useOnMount((()=>("auto"===c&&C(),()=>{m.current&&m.current.remove()})));const f=d.useCallback((e=>{"manual"===c&&C(e)}),[c,C]);return{portal:m.current&&me({usePathname:u,ForegroundComponent:n,BackgroundComponent:o,TitleComponent:t,SubtitleComponent:r,ContentComponent:s,FooterComponent:i,options:a,context:l,anchor:m.current}),initialize:f}},exports.useModalAnimation=(e,n)=>{const o=d.useRef(n);o.current=n,d.useLayoutEffect((()=>{if(!o.current)return;let n;return n=e?requestAnimationFrame((()=>o.current.onVisible?.())):requestAnimationFrame((()=>o.current.onHidden?.())),()=>{n&&cancelAnimationFrame(n)}}),[e])},exports.useModalBackdrop=()=>q().backdrop,exports.useModalDuration=()=>{const e=q();return{duration:e.duration,milliseconds:m.convertMsFromDuration(e.duration)}},exports.useModalOptions=q,exports.useSubscribeModal=se;
18
18
  //# sourceMappingURL=index.cjs.js.map