@sellmate/design-system-react 1.0.55 → 1.0.57
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.
|
@@ -9,10 +9,7 @@ import { createComponent } from '@stencil/react-output-target/ssr';
|
|
|
9
9
|
export const serializeShadowRoot = { default: "declarative-shadow-dom" };
|
|
10
10
|
export const SdActionModal = /*@__PURE__*/ createComponent({
|
|
11
11
|
tagName: 'sd-action-modal',
|
|
12
|
-
properties: {
|
|
13
|
-
modalTitle: 'modal-title',
|
|
14
|
-
buttonLabel: 'button-label'
|
|
15
|
-
},
|
|
12
|
+
properties: { modalTitle: 'modal-title' },
|
|
16
13
|
hydrateModule: import('@sellmate/design-system/hydrate'),
|
|
17
14
|
clientModule: clientComponents.SdActionModal,
|
|
18
15
|
serializeShadowRoot,
|
package/dist/sdModal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType } from 'react';
|
|
2
|
-
import { type ConfirmModalOptions, type
|
|
2
|
+
import { type ConfirmModalOptions, type ModalDialogRef, type SdModalCreateOption as CoreSdModalCreateOption, type SdModalGlobalOptions } from '@sellmate/design-system/utils';
|
|
3
3
|
/**
|
|
4
4
|
* `sdModal.create` 에 넘기는 입력.
|
|
5
5
|
*
|
|
@@ -28,8 +28,8 @@ export interface SdModalCreateOption extends Omit<CoreSdModalCreateOption, 'comp
|
|
|
28
28
|
* 감싸주세요.
|
|
29
29
|
*/
|
|
30
30
|
export declare const sdModal: {
|
|
31
|
-
confirm(options: ConfirmModalOptions):
|
|
31
|
+
confirm(options: ConfirmModalOptions): ModalDialogRef;
|
|
32
32
|
configure(options: SdModalGlobalOptions): void;
|
|
33
|
-
create(input: SdModalCreateOption):
|
|
33
|
+
create(input: SdModalCreateOption): ModalDialogRef;
|
|
34
34
|
};
|
|
35
35
|
export default sdModal;
|
package/dist/sdModal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { flushSync } from 'react-dom';
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
|
-
import { sdModal as coreSdModal, } from '@sellmate/design-system/utils';
|
|
5
|
+
import { sdModal as coreSdModal, _createSdModalRef, _attachSdModalWithRef, } from '@sellmate/design-system/utils';
|
|
6
6
|
function isHTMLElement(value) {
|
|
7
7
|
return typeof HTMLElement !== 'undefined' && value instanceof HTMLElement;
|
|
8
8
|
}
|
|
@@ -47,14 +47,18 @@ export const sdModal = {
|
|
|
47
47
|
if (isHTMLElement(component)) {
|
|
48
48
|
return coreSdModal.create({ component, persist });
|
|
49
49
|
}
|
|
50
|
-
// React 컴포넌트 오버로드
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
50
|
+
// React 컴포넌트 오버로드 — modalRef 를 먼저 만들어 props 에 주입한 뒤 mount
|
|
51
|
+
const modalRef = _createSdModalRef();
|
|
52
|
+
const { el, host, root } = mountReactComponent(component, {
|
|
53
|
+
...componentProps,
|
|
54
|
+
modalRef,
|
|
55
|
+
});
|
|
56
|
+
_attachSdModalWithRef(modalRef, { component: el, persist });
|
|
57
|
+
modalRef.onDismissed(() => {
|
|
54
58
|
root.unmount();
|
|
55
59
|
host.remove();
|
|
56
60
|
});
|
|
57
|
-
return
|
|
61
|
+
return modalRef;
|
|
58
62
|
},
|
|
59
63
|
};
|
|
60
64
|
export default sdModal;
|
|
@@ -74,10 +74,7 @@ export type SdActionModalEvents = {
|
|
|
74
74
|
|
|
75
75
|
export const SdActionModal: StencilReactComponent<SdActionModalElement, SdActionModalEvents> = /*@__PURE__*/ createComponent<SdActionModalElement, SdActionModalEvents>({
|
|
76
76
|
tagName: 'sd-action-modal',
|
|
77
|
-
properties: {
|
|
78
|
-
modalTitle: 'modal-title',
|
|
79
|
-
buttonLabel: 'button-label'
|
|
80
|
-
},
|
|
77
|
+
properties: { modalTitle: 'modal-title' },
|
|
81
78
|
hydrateModule: import('@sellmate/design-system/hydrate') as Promise<HydrateModule>,
|
|
82
79
|
clientModule: clientComponents.SdActionModal as ReactWebComponent<SdActionModalElement, SdActionModalEvents>,
|
|
83
80
|
serializeShadowRoot,
|
package/lib/sdModal.ts
CHANGED
|
@@ -5,8 +5,10 @@ import { flushSync } from 'react-dom';
|
|
|
5
5
|
import { createRoot, type Root } from 'react-dom/client';
|
|
6
6
|
import {
|
|
7
7
|
sdModal as coreSdModal,
|
|
8
|
+
_createSdModalRef,
|
|
9
|
+
_attachSdModalWithRef,
|
|
8
10
|
type ConfirmModalOptions,
|
|
9
|
-
type
|
|
11
|
+
type ModalDialogRef,
|
|
10
12
|
type SdModalCreateOption as CoreSdModalCreateOption,
|
|
11
13
|
type SdModalGlobalOptions,
|
|
12
14
|
} from '@sellmate/design-system/utils';
|
|
@@ -68,7 +70,7 @@ function mountReactComponent(
|
|
|
68
70
|
* 감싸주세요.
|
|
69
71
|
*/
|
|
70
72
|
export const sdModal = {
|
|
71
|
-
confirm(options: ConfirmModalOptions):
|
|
73
|
+
confirm(options: ConfirmModalOptions): ModalDialogRef {
|
|
72
74
|
return coreSdModal.confirm(options);
|
|
73
75
|
},
|
|
74
76
|
|
|
@@ -76,7 +78,7 @@ export const sdModal = {
|
|
|
76
78
|
coreSdModal.configure(options);
|
|
77
79
|
},
|
|
78
80
|
|
|
79
|
-
create(input: SdModalCreateOption):
|
|
81
|
+
create(input: SdModalCreateOption): ModalDialogRef {
|
|
80
82
|
const { component, componentProps = {}, persist } = input;
|
|
81
83
|
|
|
82
84
|
// HTMLElement 오버로드: core 로 바로 위임
|
|
@@ -84,15 +86,19 @@ export const sdModal = {
|
|
|
84
86
|
return coreSdModal.create({ component, persist });
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
// React 컴포넌트 오버로드
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
|
|
89
|
+
// React 컴포넌트 오버로드 — modalRef 를 먼저 만들어 props 에 주입한 뒤 mount
|
|
90
|
+
const modalRef = _createSdModalRef();
|
|
91
|
+
const { el, host, root } = mountReactComponent(component, {
|
|
92
|
+
...componentProps,
|
|
93
|
+
modalRef,
|
|
94
|
+
});
|
|
95
|
+
_attachSdModalWithRef(modalRef, { component: el, persist });
|
|
96
|
+
modalRef.onDismissed(() => {
|
|
91
97
|
root.unmount();
|
|
92
98
|
host.remove();
|
|
93
99
|
});
|
|
94
100
|
|
|
95
|
-
return
|
|
101
|
+
return modalRef;
|
|
96
102
|
},
|
|
97
103
|
};
|
|
98
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sellmate/design-system-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
4
4
|
"description": "Design System - React Component Wrappers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dev": "tsc --watch"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@sellmate/design-system": "^1.0.
|
|
57
|
+
"@sellmate/design-system": "^1.0.57",
|
|
58
58
|
"@stencil/react-output-target": "^1.2.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|