@uniai-fe/uds-templates 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/styles.css +18 -0
- package/package.json +1 -1
- package/src/service-inquiry/jotai/context.ts +2 -10
- package/src/service-inquiry/styles/index.scss +1 -0
- package/src/service-inquiry/styles/open-button.scss +11 -15
- package/src/service-inquiry/styles/variables.scss +8 -0
- package/src/service-inquiry/types/api.ts +2 -2
- package/src/service-inquiry/types/form-context.ts +2 -2
- package/src/service-inquiry/types/hooks.ts +0 -5
- package/src/service-inquiry/utils/modal-option.tsx +4 -0
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ Next.js 서비스에서 primitives와 동일한 방식으로 **Raw TypeScript**
|
|
|
124
124
|
|
|
125
125
|
1. 서비스 앱이 `react-hook-form`으로 `defaultValues`와 `onSubmit`을 준비한다.
|
|
126
126
|
2. layout 고정 버튼은 `ServiceInquiry.useUserContext()`로 모듈 내부 registry 기반 `requestContext`를 읽는다.
|
|
127
|
-
3. 각 페이지/폼은 `ServiceInquiry.useProvideContext({ labels,
|
|
127
|
+
3. 각 페이지/폼은 `ServiceInquiry.useProvideContext({ labels, userContext })`로 `ServiceInquiryProvidedContext`를 등록한다.
|
|
128
128
|
4. 기본 버튼은 `ServiceInquiry.OpenButton`, 커스텀 버튼은 `ServiceInquiry.useOpen`으로 모달 open을 연결한다.
|
|
129
129
|
5. modal footer confirm이 `ServiceInquiry.Form` submit 진입을 담당한다.
|
|
130
130
|
6. 실제 submit은 서비스 앱의 `useMutation + Next.js route handler + Modal.Alert` 조합으로 처리한다.
|
package/dist/styles.css
CHANGED
|
@@ -94,6 +94,11 @@
|
|
|
94
94
|
/* Controls */
|
|
95
95
|
--cctv-open-button-color-on: var(--color-common-99);
|
|
96
96
|
--cctv-open-button-color-off: var(--color-label-disabled);
|
|
97
|
+
--service-inquiry-button-width: var(--button-round-height-large);
|
|
98
|
+
--service-inquiry-button-pos-top: auto;
|
|
99
|
+
--service-inquiry-button-pos-left: var(--spacing-padding-10);
|
|
100
|
+
--service-inquiry-button-pos-right: auto;
|
|
101
|
+
--service-inquiry-button-pos-bottom: var(--spacing-padding-10);
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
/* templates styles는 foundation/primitives 순으로 import된 이후를 가정한다. */
|
|
@@ -1733,6 +1738,8 @@
|
|
|
1733
1738
|
margin-top: var(--spacing-gap-8);
|
|
1734
1739
|
}
|
|
1735
1740
|
|
|
1741
|
+
|
|
1742
|
+
|
|
1736
1743
|
.service-inquiry-form {
|
|
1737
1744
|
display: flex;
|
|
1738
1745
|
flex-direction: column;
|
|
@@ -1748,3 +1755,14 @@
|
|
|
1748
1755
|
display: flex;
|
|
1749
1756
|
flex-direction: column;
|
|
1750
1757
|
}
|
|
1758
|
+
|
|
1759
|
+
.service-inquiry-open-button {
|
|
1760
|
+
width: var(--service-inquiry-button-width);
|
|
1761
|
+
--button-round-padding-inline-large: 0px;
|
|
1762
|
+
position: fixed;
|
|
1763
|
+
top: var(--service-inquiry-button-pos-top);
|
|
1764
|
+
left: var(--service-inquiry-button-pos-left);
|
|
1765
|
+
right: var(--service-inquiry-button-pos-right);
|
|
1766
|
+
bottom: var(--service-inquiry-button-pos-bottom);
|
|
1767
|
+
z-index: 100;
|
|
1768
|
+
}
|
package/package.json
CHANGED
|
@@ -40,13 +40,6 @@ export const serviceInquiryProvidedContextAtom =
|
|
|
40
40
|
),
|
|
41
41
|
),
|
|
42
42
|
),
|
|
43
|
-
pagePath:
|
|
44
|
-
[...providedContexts].reverse().find(providedContext => {
|
|
45
|
-
return (
|
|
46
|
-
typeof providedContext.pagePath === "string" &&
|
|
47
|
-
providedContext.pagePath.length > 0
|
|
48
|
-
);
|
|
49
|
-
})?.pagePath ?? "",
|
|
50
43
|
userContext: providedContexts.reduce<ServiceInquiryUserContext | null>(
|
|
51
44
|
(currentUserContext, providedContext) => {
|
|
52
45
|
if (!providedContext.userContext) {
|
|
@@ -74,9 +67,8 @@ export const serviceInquiryRequestContextAtom =
|
|
|
74
67
|
|
|
75
68
|
return {
|
|
76
69
|
labels: providedContext.labels ?? [],
|
|
77
|
-
page_path
|
|
78
|
-
|
|
79
|
-
(typeof window === "undefined" ? "" : window.location.pathname),
|
|
70
|
+
// 변경 설명: page_path는 서비스 입력값이 아니라 모듈이 현재 페이지 URL 전체를 자동 수집하는 시스템 필드로 고정한다.
|
|
71
|
+
page_path: typeof window === "undefined" ? "" : window.location.href,
|
|
80
72
|
user_context:
|
|
81
73
|
providedContext.userContext || additionalUserContext
|
|
82
74
|
? {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// // justify-content: center;
|
|
13
|
-
// // padding: 0;
|
|
14
|
-
// // cursor: pointer;
|
|
15
|
-
// }
|
|
1
|
+
.service-inquiry-open-button {
|
|
2
|
+
width: var(--service-inquiry-button-width);
|
|
3
|
+
--button-round-padding-inline-large: 0px;
|
|
4
|
+
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: var(--service-inquiry-button-pos-top);
|
|
7
|
+
left: var(--service-inquiry-button-pos-left);
|
|
8
|
+
right: var(--service-inquiry-button-pos-right);
|
|
9
|
+
bottom: var(--service-inquiry-button-pos-bottom);
|
|
10
|
+
z-index: 100;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--service-inquiry-button-width: var(--button-round-height-large);
|
|
3
|
+
|
|
4
|
+
--service-inquiry-button-pos-top: auto;
|
|
5
|
+
--service-inquiry-button-pos-left: var(--spacing-padding-10);
|
|
6
|
+
--service-inquiry-button-pos-right: auto;
|
|
7
|
+
--service-inquiry-button-pos-bottom: var(--spacing-padding-10);
|
|
8
|
+
}
|
|
@@ -6,7 +6,7 @@ import type { ServiceInquiryUserContext } from "./form-context";
|
|
|
6
6
|
* @property {string} farm_name 문의 대상 농장명 또는 빈 문자열
|
|
7
7
|
* @property {string[]} labels JIRA label 목록
|
|
8
8
|
* @property {string} contact 문의자 연락처(email 또는 phone number)
|
|
9
|
-
* @property {string} page_path 문의하기를 연 페이지
|
|
9
|
+
* @property {string} page_path 문의하기를 연 현재 페이지 URL
|
|
10
10
|
* @property {ServiceInquiryUserContext | null} user_context 문의 시점 사용자/환경 맥락
|
|
11
11
|
*/
|
|
12
12
|
export interface API_Req_ServiceInquiry {
|
|
@@ -27,7 +27,7 @@ export interface API_Req_ServiceInquiry {
|
|
|
27
27
|
*/
|
|
28
28
|
contact: string;
|
|
29
29
|
/**
|
|
30
|
-
* 문의하기를 연 페이지
|
|
30
|
+
* 문의하기를 연 현재 페이지 URL
|
|
31
31
|
*/
|
|
32
32
|
page_path: string;
|
|
33
33
|
/**
|
|
@@ -22,7 +22,7 @@ export interface ServiceInquiryFormValues {
|
|
|
22
22
|
/**
|
|
23
23
|
* Service Inquiry Form; 시스템 주입 request context
|
|
24
24
|
* @property {string[]} labels JIRA label 목록
|
|
25
|
-
* @property {string} page_path 문의를 연 페이지
|
|
25
|
+
* @property {string} page_path 문의를 연 현재 페이지 URL
|
|
26
26
|
* @property {ServiceInquiryUserContext | null} user_context 문의 시점 사용자/환경 맥락
|
|
27
27
|
*/
|
|
28
28
|
export interface ServiceInquiryRequestContext {
|
|
@@ -31,7 +31,7 @@ export interface ServiceInquiryRequestContext {
|
|
|
31
31
|
*/
|
|
32
32
|
labels: string[];
|
|
33
33
|
/**
|
|
34
|
-
* 문의를 연 페이지
|
|
34
|
+
* 문의를 연 현재 페이지 URL
|
|
35
35
|
*/
|
|
36
36
|
page_path: string;
|
|
37
37
|
/**
|
|
@@ -6,7 +6,6 @@ import type {
|
|
|
6
6
|
/**
|
|
7
7
|
* Service Inquiry Hook; 모듈 내부 공유 context 값
|
|
8
8
|
* @property {string[]} [labels] 문의 request에 포함할 labels
|
|
9
|
-
* @property {string} [pagePath] 문의를 연 페이지 경로
|
|
10
9
|
* @property {ServiceInquiryUserContext | null} [userContext] 페이지/폼이 제공하는 추가 user_context
|
|
11
10
|
*/
|
|
12
11
|
export interface ServiceInquiryProvidedContext {
|
|
@@ -14,10 +13,6 @@ export interface ServiceInquiryProvidedContext {
|
|
|
14
13
|
* 문의 request에 포함할 labels
|
|
15
14
|
*/
|
|
16
15
|
labels?: string[];
|
|
17
|
-
/**
|
|
18
|
-
* 문의를 연 페이지 경로
|
|
19
|
-
*/
|
|
20
|
-
pagePath?: string;
|
|
21
16
|
/**
|
|
22
17
|
* 페이지/폼이 제공하는 추가 user_context
|
|
23
18
|
*/
|
|
@@ -23,12 +23,16 @@ export function createServiceInquiryModal({
|
|
|
23
23
|
formProps,
|
|
24
24
|
dialogOptions,
|
|
25
25
|
}: ServiceInquiryCreateModalOptions) {
|
|
26
|
+
const formContextOptions = dialogOptions?.formContextOptions ?? {};
|
|
27
|
+
|
|
26
28
|
return createDialogModal<ServiceInquiryFormValues>({
|
|
27
29
|
...dialogOptions,
|
|
28
30
|
stackKey,
|
|
29
31
|
title: dialogOptions?.title ?? "문의하기",
|
|
30
32
|
// 변경 설명: 문의 모달은 title과 안내 문구를 좌측 정렬로 읽히게 하기 위해 split header를 기본값으로 사용한다.
|
|
31
33
|
headerLayout: dialogOptions?.headerLayout ?? "split",
|
|
34
|
+
// 변경 설명: ServiceInquiryForm은 useFormContext를 직접 읽으므로 Dialog 내부 Form.Provider를 항상 활성화한다.
|
|
35
|
+
formContextOptions,
|
|
32
36
|
content: <ServiceInquiryForm {...formProps} />,
|
|
33
37
|
confirm: {
|
|
34
38
|
label: "문의 접수",
|