@ncds/ui-admin 1.8.21-alpha.0 → 1.8.21-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/assets/scripts/notification/FullWidthNotification.js +17 -6
- package/dist/cjs/assets/scripts/notification/MessageNotification.js +10 -48
- package/dist/cjs/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/cjs/assets/scripts/notification/const/index.js +1 -1
- package/dist/cjs/assets/scripts/notification/const/sizes.js +4 -2
- package/dist/cjs/assets/scripts/notification/messageTemplate.js +106 -0
- package/dist/cjs/assets/scripts/notification/utils.js +40 -4
- package/dist/cjs/constant/notification.js +21 -0
- package/dist/cjs/src/components/forms-and-input/input-base/InputBase.js +52 -34
- package/dist/cjs/src/components/forms-and-input/input-base/__tests__/InputBase.test.js +228 -0
- package/dist/cjs/src/components/forms-and-input/password-input/PasswordInput.js +3 -2
- package/dist/cjs/src/components/forms-and-input/password-input/__tests__/PasswordInput.test.js +59 -0
- package/dist/cjs/src/components/index.js +22 -0
- package/dist/cjs/src/components/layout/ncua-scope/NcuaScope.js +79 -0
- package/dist/cjs/src/components/layout/ncua-scope/index.js +16 -0
- package/dist/cjs/src/components/navigation/pagination/Pagination.js +3 -1
- package/dist/cjs/src/components/navigation/pagination/__tests__/Pagination.test.js +74 -0
- package/dist/cjs/src/components/overlays/notification/FullWidthNotification.js +3 -1
- package/dist/cjs/src/components/overlays/notification/MessageNotification.js +14 -54
- package/dist/cjs/src/components/overlays/notification/MessageNotificationParts.js +92 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/MessageNotification.test.js +246 -0
- package/dist/cjs/src/components/overlays/notification/__tests__/hidePermanentlyLabel.test.js +209 -0
- package/dist/cjs/src/components/overlays/postcode-search-modal/PostcodeSearchModal.js +259 -0
- package/dist/cjs/src/components/overlays/postcode-search-modal/PostcodeSearchModalTip.js +70 -0
- package/dist/cjs/src/components/overlays/postcode-search-modal/__tests__/PostcodeSearchModal.test.js +623 -0
- package/dist/cjs/src/components/overlays/postcode-search-modal/index.js +16 -0
- package/dist/cjs/src/generated/scoped-css.js +9 -0
- package/dist/esm/assets/scripts/notification/FullWidthNotification.js +17 -6
- package/dist/esm/assets/scripts/notification/MessageNotification.js +12 -50
- package/dist/esm/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/esm/assets/scripts/notification/const/index.js +3 -2
- package/dist/esm/assets/scripts/notification/const/sizes.js +4 -2
- package/dist/esm/assets/scripts/notification/messageTemplate.js +100 -0
- package/dist/esm/assets/scripts/notification/utils.js +39 -4
- package/dist/esm/constant/notification.js +15 -0
- package/dist/esm/src/components/forms-and-input/input-base/InputBase.js +52 -34
- package/dist/esm/src/components/forms-and-input/input-base/__tests__/InputBase.test.js +228 -0
- package/dist/esm/src/components/forms-and-input/password-input/PasswordInput.js +3 -2
- package/dist/esm/src/components/forms-and-input/password-input/__tests__/PasswordInput.test.js +56 -0
- package/dist/esm/src/components/index.js +2 -0
- package/dist/esm/src/components/layout/ncua-scope/NcuaScope.js +73 -0
- package/dist/esm/src/components/layout/ncua-scope/index.js +1 -0
- package/dist/esm/src/components/navigation/pagination/Pagination.js +3 -1
- package/dist/esm/src/components/navigation/pagination/__tests__/Pagination.test.js +74 -0
- package/dist/esm/src/components/overlays/notification/FullWidthNotification.js +3 -1
- package/dist/esm/src/components/overlays/notification/MessageNotification.js +15 -55
- package/dist/esm/src/components/overlays/notification/MessageNotificationParts.js +85 -0
- package/dist/esm/src/components/overlays/notification/__tests__/MessageNotification.test.js +243 -0
- package/dist/esm/src/components/overlays/notification/__tests__/hidePermanentlyLabel.test.js +206 -0
- package/dist/esm/src/components/overlays/postcode-search-modal/PostcodeSearchModal.js +252 -0
- package/dist/esm/src/components/overlays/postcode-search-modal/PostcodeSearchModalTip.js +63 -0
- package/dist/esm/src/components/overlays/postcode-search-modal/__tests__/PostcodeSearchModal.test.js +620 -0
- package/dist/esm/src/components/overlays/postcode-search-modal/index.js +1 -0
- package/dist/esm/src/generated/scoped-css.js +3 -0
- package/dist/temp/assets/scripts/notification/FullWidthNotification.d.ts +6 -0
- package/dist/temp/assets/scripts/notification/FullWidthNotification.js +14 -5
- package/dist/temp/assets/scripts/notification/MessageNotification.d.ts +0 -3
- package/dist/temp/assets/scripts/notification/MessageNotification.js +9 -44
- package/dist/temp/assets/scripts/notification/const/classNames.d.ts +1 -0
- package/dist/temp/assets/scripts/notification/const/classNames.js +3 -0
- package/dist/temp/assets/scripts/notification/const/index.d.ts +3 -3
- package/dist/temp/assets/scripts/notification/const/index.js +3 -2
- package/dist/temp/assets/scripts/notification/const/sizes.d.ts +2 -2
- package/dist/temp/assets/scripts/notification/const/sizes.js +4 -2
- package/dist/temp/assets/scripts/notification/const/types.d.ts +30 -2
- package/dist/temp/assets/scripts/notification/messageTemplate.d.ts +15 -0
- package/dist/temp/assets/scripts/notification/messageTemplate.js +79 -0
- package/dist/temp/assets/scripts/notification/utils.d.ts +19 -2
- package/dist/temp/assets/scripts/notification/utils.js +39 -5
- package/dist/temp/constant/notification.d.ts +15 -0
- package/dist/temp/constant/notification.js +15 -0
- package/dist/temp/src/components/forms-and-input/input-base/InputBase.d.ts +1 -1
- package/dist/temp/src/components/forms-and-input/input-base/InputBase.js +43 -26
- package/dist/temp/src/components/forms-and-input/input-base/__tests__/InputBase.test.js +174 -0
- package/dist/temp/src/components/forms-and-input/password-input/PasswordInput.js +2 -1
- package/dist/temp/src/components/forms-and-input/password-input/__tests__/PasswordInput.test.d.ts +1 -0
- package/dist/temp/src/components/forms-and-input/password-input/__tests__/PasswordInput.test.js +48 -0
- package/dist/temp/src/components/index.d.ts +2 -0
- package/dist/temp/src/components/index.js +2 -0
- package/dist/temp/src/components/layout/ncua-scope/NcuaScope.d.ts +32 -0
- package/dist/temp/src/components/layout/ncua-scope/NcuaScope.js +51 -0
- package/dist/temp/src/components/layout/ncua-scope/index.d.ts +1 -0
- package/dist/temp/src/components/layout/ncua-scope/index.js +1 -0
- package/dist/temp/src/components/navigation/pagination/Pagination.js +3 -1
- package/dist/temp/src/components/navigation/pagination/__tests__/Pagination.test.js +74 -0
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.d.ts +6 -0
- package/dist/temp/src/components/overlays/notification/FullWidthNotification.js +3 -2
- package/dist/temp/src/components/overlays/notification/MessageNotification.d.ts +6 -0
- package/dist/temp/src/components/overlays/notification/MessageNotification.js +4 -13
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.d.ts +28 -0
- package/dist/temp/src/components/overlays/notification/MessageNotificationParts.js +28 -0
- package/dist/temp/src/components/overlays/notification/Notification.d.ts +11 -2
- package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.d.ts +1 -0
- package/dist/temp/src/components/overlays/notification/__tests__/MessageNotification.test.js +190 -0
- package/dist/temp/src/components/overlays/notification/__tests__/hidePermanentlyLabel.test.d.ts +1 -0
- package/dist/temp/src/components/overlays/notification/__tests__/hidePermanentlyLabel.test.js +160 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/PostcodeSearchModal.d.ts +45 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/PostcodeSearchModal.js +125 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/PostcodeSearchModalTip.d.ts +16 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/PostcodeSearchModalTip.js +24 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/__tests__/PostcodeSearchModal.test.d.ts +1 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/__tests__/PostcodeSearchModal.test.js +503 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/index.d.ts +1 -0
- package/dist/temp/src/components/overlays/postcode-search-modal/index.js +1 -0
- package/dist/temp/src/generated/scoped-css.d.ts +1 -0
- package/dist/temp/src/generated/scoped-css.js +3 -0
- package/dist/types/assets/scripts/notification/FullWidthNotification.d.ts +6 -0
- package/dist/types/assets/scripts/notification/MessageNotification.d.ts +0 -3
- package/dist/types/assets/scripts/notification/const/classNames.d.ts +1 -0
- package/dist/types/assets/scripts/notification/const/index.d.ts +3 -3
- package/dist/types/assets/scripts/notification/const/sizes.d.ts +2 -2
- package/dist/types/assets/scripts/notification/const/types.d.ts +30 -2
- package/dist/types/assets/scripts/notification/messageTemplate.d.ts +15 -0
- package/dist/types/assets/scripts/notification/utils.d.ts +19 -2
- package/dist/types/constant/notification.d.ts +15 -0
- package/dist/types/src/components/forms-and-input/input-base/InputBase.d.ts +1 -1
- package/dist/types/src/components/forms-and-input/password-input/__tests__/PasswordInput.test.d.ts +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/layout/ncua-scope/NcuaScope.d.ts +32 -0
- package/dist/types/src/components/layout/ncua-scope/index.d.ts +1 -0
- package/dist/types/src/components/overlays/notification/FullWidthNotification.d.ts +6 -0
- package/dist/types/src/components/overlays/notification/MessageNotification.d.ts +6 -0
- package/dist/types/src/components/overlays/notification/MessageNotificationParts.d.ts +28 -0
- package/dist/types/src/components/overlays/notification/Notification.d.ts +11 -2
- package/dist/types/src/components/overlays/notification/__tests__/MessageNotification.test.d.ts +1 -0
- package/dist/types/src/components/overlays/notification/__tests__/hidePermanentlyLabel.test.d.ts +1 -0
- package/dist/types/src/components/overlays/postcode-search-modal/PostcodeSearchModal.d.ts +45 -0
- package/dist/types/src/components/overlays/postcode-search-modal/PostcodeSearchModalTip.d.ts +16 -0
- package/dist/types/src/components/overlays/postcode-search-modal/__tests__/PostcodeSearchModal.test.d.ts +1 -0
- package/dist/types/src/components/overlays/postcode-search-modal/index.d.ts +1 -0
- package/dist/types/src/generated/scoped-css.d.ts +1 -0
- package/dist/ui-admin/assets/styles/style.css +296 -56
- package/dist/ui-admin/assets/styles/style.scoped.css +8595 -0
- package/package.json +13 -6
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Button } from '../../action/button';
|
|
5
|
+
import { EmptyState } from '../../feedback-and-status/empty-state';
|
|
6
|
+
import { InputBase } from '../../forms-and-input/input-base';
|
|
7
|
+
import { Radio } from '../../forms-and-input/radio';
|
|
8
|
+
import { Pagination } from '../../navigation/pagination';
|
|
9
|
+
import { Modal } from '../modal';
|
|
10
|
+
import { TIP_TITLE, Tip } from './PostcodeSearchModalTip';
|
|
11
|
+
/** 기획서 기준값 */
|
|
12
|
+
const PAGE_SIZE = 15;
|
|
13
|
+
/** 페이지 번호 그룹 크기 — 초과 시 Pagination 이 점프 버튼을 노출한다 */
|
|
14
|
+
const PAGER_WINDOW = 10;
|
|
15
|
+
/** 반응형 전환 기준 — assets/styles/base/_variable.scss 의 $breakpoint 와 동일 */
|
|
16
|
+
const MOBILE_BREAKPOINT = 768;
|
|
17
|
+
/** 본문 스크롤 컨테이너. Modal.Content 가 overflow-y:auto 를 갖는다. */
|
|
18
|
+
const SCROLL_CONTAINER_SELECTOR = '.ncua-modal__content';
|
|
19
|
+
const MODAL_TITLE = '주소 찾기';
|
|
20
|
+
const SEARCH_PLACEHOLDER = '도로명, 지번, 건물명 검색';
|
|
21
|
+
const SEARCH_BUTTON_LABEL = '검색';
|
|
22
|
+
const EMPTY_TITLE = '검색 결과가 없습니다.';
|
|
23
|
+
const EMPTY_DESCRIPTION = '검색어를 다시 확인해 주세요.';
|
|
24
|
+
const ROAD_BADGE_LABEL = '도로명';
|
|
25
|
+
const JIBUN_BADGE_LABEL = '지번';
|
|
26
|
+
// 라디오 그룹 이름. `ncua-` 로 시작하면 MCP 의 BEM 추출기가 CSS 클래스로 오인하므로 접두사를 뺀다.
|
|
27
|
+
const RESULT_RADIO_NAME = 'postcode-search-modal-result';
|
|
28
|
+
/** E0006·E0008 외 나머지 코드는 모두 같은 문구를 쓴다(기획서: E0009~E0013 통합). */
|
|
29
|
+
const DEFAULT_ERROR_HINT = '검색어를 다시 입력해주세요.';
|
|
30
|
+
const ERROR_HINT = {
|
|
31
|
+
E0006: '시도명으로는 검색이 불가합니다.',
|
|
32
|
+
E0008: '검색어를 두 글자 이상 입력해주세요.'
|
|
33
|
+
};
|
|
34
|
+
/** 선택 표시를 판정하는 키. 우편번호만으로는 같은 건물의 다른 지번을 구분하지 못한다. */
|
|
35
|
+
const resultKey = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
zipCode,
|
|
38
|
+
roadAddress,
|
|
39
|
+
jibunAddress
|
|
40
|
+
} = _ref;
|
|
41
|
+
return `${zipCode}|${roadAddress}|${jibunAddress}`;
|
|
42
|
+
};
|
|
43
|
+
/** SSR(도큐사우루스 등)에서는 초기값을 false(=PC)로 두고 mount 이후 갱신한다. */
|
|
44
|
+
const useIsMobileViewport = () => {
|
|
45
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;
|
|
48
|
+
const mediaQuery = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT}px)`);
|
|
49
|
+
const sync = () => setIsMobile(mediaQuery.matches);
|
|
50
|
+
sync();
|
|
51
|
+
mediaQuery.addEventListener('change', sync);
|
|
52
|
+
return () => {
|
|
53
|
+
mediaQuery.removeEventListener('change', sync);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
return isMobile;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* 본문이 위로 스크롤됐는지 여부.
|
|
60
|
+
* 고정된 검색 영역과 스크롤되는 결과 사이의 경계선을 스크롤 중에만 그리기 위해 쓴다.
|
|
61
|
+
* enabled 가 false 면 감시를 걸지 않고 항상 false 를 돌려준다.
|
|
62
|
+
*/
|
|
63
|
+
const useIsContentScrolled = (rootRef, enabled) => {
|
|
64
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!enabled) {
|
|
67
|
+
setIsScrolled(false);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const scroller = rootRef.current?.closest(SCROLL_CONTAINER_SELECTOR);
|
|
71
|
+
if (!scroller) return;
|
|
72
|
+
const sync = () => setIsScrolled(scroller.scrollTop > 0);
|
|
73
|
+
// 결과가 바뀌어도 스크롤 위치는 남을 수 있어 구독 시점의 값으로 먼저 맞춘다.
|
|
74
|
+
sync();
|
|
75
|
+
scroller.addEventListener('scroll', sync, {
|
|
76
|
+
passive: true
|
|
77
|
+
});
|
|
78
|
+
return () => {
|
|
79
|
+
scroller.removeEventListener('scroll', sync);
|
|
80
|
+
};
|
|
81
|
+
}, [rootRef, enabled]);
|
|
82
|
+
return isScrolled;
|
|
83
|
+
};
|
|
84
|
+
const PostcodeSearchModal = _ref2 => {
|
|
85
|
+
let {
|
|
86
|
+
open,
|
|
87
|
+
onClose,
|
|
88
|
+
zIndex,
|
|
89
|
+
className,
|
|
90
|
+
searchQuery,
|
|
91
|
+
onSearchQueryChange,
|
|
92
|
+
onSearch,
|
|
93
|
+
results,
|
|
94
|
+
totalCount,
|
|
95
|
+
currentPage,
|
|
96
|
+
onPageChange,
|
|
97
|
+
pageSize = PAGE_SIZE,
|
|
98
|
+
loading = false,
|
|
99
|
+
errorCode,
|
|
100
|
+
onSelect
|
|
101
|
+
} = _ref2;
|
|
102
|
+
const isMobile = useIsMobileViewport();
|
|
103
|
+
const rootRef = useRef(null);
|
|
104
|
+
// 선택 표시는 컴포넌트가 직접 들고 있는다. 사용처는 onSelect 로 값만 받으면 된다.
|
|
105
|
+
// 우편번호는 한 페이지에 중복될 수 있어 주소 전체를 키로 쓴다.
|
|
106
|
+
const [selectedKey, setSelectedKey] = useState();
|
|
107
|
+
// 검색이 실행된 검색어. 입력 중에는 갱신되지 않는다.
|
|
108
|
+
// 초기값은 마운트 시점의 searchQuery — 사용처가 검색어를 채운 채로 열면 그 검색은 이미 실행된 것으로 본다.
|
|
109
|
+
const [searchedQuery, setSearchedQuery] = useState(searchQuery);
|
|
110
|
+
// Modal 은 닫혀도 이 컴포넌트를 언마운트하지 않아 내부 상태가 다음 열기까지 남는다.
|
|
111
|
+
// 열리는 순간 이전 세션의 선택·검색 상태를 지운다.
|
|
112
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: searchQuery 를 deps 에 넣으면 입력할 때마다 초기화된다
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!open) return;
|
|
115
|
+
setSelectedKey(undefined);
|
|
116
|
+
setSearchedQuery(searchQuery);
|
|
117
|
+
}, [open]);
|
|
118
|
+
const hasError = Boolean(errorCode);
|
|
119
|
+
const hasResults = !hasError && results.length > 0;
|
|
120
|
+
// 검색을 실행한 검색어와 현재 입력값이 같을 때만 "결과 없음"으로 본다.
|
|
121
|
+
// 입력 중에는 두 값이 달라지고, 응답을 기다리는 동안에는 loading 이 막는다.
|
|
122
|
+
const showEmptyState = !hasError && !loading && results.length === 0 && searchQuery !== '' && searchQuery === searchedQuery;
|
|
123
|
+
// 결과 목록이 있을 때만 스크롤이 생기므로 그때만 감시한다.
|
|
124
|
+
const isContentScrolled = useIsContentScrolled(rootRef, open && hasResults);
|
|
125
|
+
const handleSearchQueryChange = event => {
|
|
126
|
+
onSearchQueryChange(event.target.value);
|
|
127
|
+
};
|
|
128
|
+
const handleSearch = () => {
|
|
129
|
+
setSearchedQuery(searchQuery);
|
|
130
|
+
onSearch();
|
|
131
|
+
};
|
|
132
|
+
const handleSearchKeyDown = event => {
|
|
133
|
+
// 한글 조합 중의 Enter 는 글자 확정이므로 검색으로 보지 않는다.
|
|
134
|
+
if (event.key !== 'Enter' || event.nativeEvent.isComposing) return;
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
handleSearch();
|
|
137
|
+
};
|
|
138
|
+
return _jsxs(Modal, {
|
|
139
|
+
isOpen: open,
|
|
140
|
+
onClose: onClose,
|
|
141
|
+
size: "md",
|
|
142
|
+
zIndex: zIndex,
|
|
143
|
+
className: className,
|
|
144
|
+
children: [_jsx(Modal.Header, {
|
|
145
|
+
title: MODAL_TITLE,
|
|
146
|
+
onClose: onClose,
|
|
147
|
+
showDivider: true
|
|
148
|
+
}), _jsx(Modal.Content, {
|
|
149
|
+
children: _jsxs("div", {
|
|
150
|
+
className: "ncua-postcode-search-modal",
|
|
151
|
+
ref: rootRef,
|
|
152
|
+
children: [_jsxs("div", {
|
|
153
|
+
className: classnames('ncua-postcode-search-modal__search-area', {
|
|
154
|
+
'is-fixed': hasResults && isContentScrolled
|
|
155
|
+
}),
|
|
156
|
+
children: [_jsxs("div", {
|
|
157
|
+
className: "ncua-postcode-search-modal__search",
|
|
158
|
+
children: [_jsx(InputBase, {
|
|
159
|
+
className: "ncua-postcode-search-modal__search-input",
|
|
160
|
+
size: "sm",
|
|
161
|
+
fullWidth: true,
|
|
162
|
+
value: searchQuery,
|
|
163
|
+
onChange: handleSearchQueryChange,
|
|
164
|
+
onKeyDown: handleSearchKeyDown,
|
|
165
|
+
placeholder: SEARCH_PLACEHOLDER,
|
|
166
|
+
destructive: hasError,
|
|
167
|
+
hintText: errorCode ? ERROR_HINT[errorCode] ?? DEFAULT_ERROR_HINT : undefined
|
|
168
|
+
}), _jsx(Button, {
|
|
169
|
+
className: "ncua-postcode-search-modal__search-button",
|
|
170
|
+
label: SEARCH_BUTTON_LABEL,
|
|
171
|
+
size: "sm",
|
|
172
|
+
hierarchy: "secondary",
|
|
173
|
+
onClick: handleSearch
|
|
174
|
+
})]
|
|
175
|
+
}), hasResults && _jsxs("div", {
|
|
176
|
+
children: [_jsx("p", {
|
|
177
|
+
className: "ncua-postcode-search-modal__result-title",
|
|
178
|
+
children: TIP_TITLE
|
|
179
|
+
}), _jsx("p", {
|
|
180
|
+
className: "ncua-postcode-search-modal__result-desc",
|
|
181
|
+
children: "\uB3C4\uB85C\uBA85+\uAC74\uBB3C\uBC88\uD638, \uC9C0\uC5ED\uBA85+\uC9C0\uBC88, \uC9C0\uC5ED\uBA85+\uAC74\uBB3C\uBA85(\uC544\uD30C\uD2B8\uBA85)"
|
|
182
|
+
})]
|
|
183
|
+
})]
|
|
184
|
+
}), !hasResults && _jsx(PostcodeSearchModal.Tip, {}), hasResults && _jsxs(_Fragment, {
|
|
185
|
+
children: [_jsxs("p", {
|
|
186
|
+
className: "ncua-postcode-search-modal__count",
|
|
187
|
+
children: ["\uAC80\uC0C9 ", _jsx("b", {
|
|
188
|
+
children: totalCount
|
|
189
|
+
}), "\uAC1C"]
|
|
190
|
+
}), _jsx("ul", {
|
|
191
|
+
className: "ncua-postcode-search-modal__list",
|
|
192
|
+
children: results.map((result, index) => _jsx("li", {
|
|
193
|
+
className: "ncua-postcode-search-modal__item",
|
|
194
|
+
children: _jsx(Radio, {
|
|
195
|
+
name: RESULT_RADIO_NAME,
|
|
196
|
+
value: result.zipCode,
|
|
197
|
+
checked: selectedKey === resultKey(result),
|
|
198
|
+
onChange: () => {
|
|
199
|
+
setSelectedKey(resultKey(result));
|
|
200
|
+
onSelect(result);
|
|
201
|
+
},
|
|
202
|
+
text: _jsxs(_Fragment, {
|
|
203
|
+
children: [_jsxs("span", {
|
|
204
|
+
className: "ncua-postcode-search-modal__addr-line",
|
|
205
|
+
children: [_jsx("span", {
|
|
206
|
+
className: "ncua-postcode-search-modal__badge",
|
|
207
|
+
children: ROAD_BADGE_LABEL
|
|
208
|
+
}), _jsx("span", {
|
|
209
|
+
className: "ncua-postcode-search-modal__item-road",
|
|
210
|
+
children: result.roadAddress
|
|
211
|
+
}), _jsx("span", {
|
|
212
|
+
className: "ncua-postcode-search-modal__item-zip",
|
|
213
|
+
children: result.zipCode
|
|
214
|
+
})]
|
|
215
|
+
}), _jsxs("span", {
|
|
216
|
+
className: "ncua-postcode-search-modal__addr-line",
|
|
217
|
+
children: [_jsx("span", {
|
|
218
|
+
className: "ncua-postcode-search-modal__badge",
|
|
219
|
+
children: JIBUN_BADGE_LABEL
|
|
220
|
+
}), _jsx("span", {
|
|
221
|
+
className: "ncua-postcode-search-modal__item-jibun",
|
|
222
|
+
children: result.jibunAddress
|
|
223
|
+
})]
|
|
224
|
+
})]
|
|
225
|
+
})
|
|
226
|
+
})
|
|
227
|
+
}, `${result.zipCode}-${index}`))
|
|
228
|
+
}), _jsx("div", {
|
|
229
|
+
className: "ncua-postcode-search-modal__pagination",
|
|
230
|
+
children: _jsx(Pagination, {
|
|
231
|
+
totalCount: totalCount,
|
|
232
|
+
itemCountPerPage: pageSize,
|
|
233
|
+
pageCount: PAGER_WINDOW,
|
|
234
|
+
currentPage: currentPage,
|
|
235
|
+
breakPoint: isMobile ? 'mo' : 'pc',
|
|
236
|
+
onPageChange: onPageChange
|
|
237
|
+
})
|
|
238
|
+
})]
|
|
239
|
+
}), showEmptyState && _jsx("div", {
|
|
240
|
+
className: "ncua-postcode-search-modal__empty",
|
|
241
|
+
children: _jsx(EmptyState, {
|
|
242
|
+
title: EMPTY_TITLE,
|
|
243
|
+
description: EMPTY_DESCRIPTION
|
|
244
|
+
})
|
|
245
|
+
})]
|
|
246
|
+
})
|
|
247
|
+
})]
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
PostcodeSearchModal.displayName = 'PostcodeSearchModal';
|
|
251
|
+
PostcodeSearchModal.Tip = Tip;
|
|
252
|
+
export { PostcodeSearchModal };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AnnotationInfoFill } from '@ncds/ui-admin-icon';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
const TIP_LABEL = 'Tip';
|
|
5
|
+
/** Tip 카드 첫 줄 안내 문구 (기획서 TIPS.searchTitle) */
|
|
6
|
+
const TIP_TITLE = '아래 조합으로 검색하면 원하는 주소를 더 쉽게 찾을 수 있어요.';
|
|
7
|
+
/** Tip 에 노출할 검색어 조합과 예시 주소 (기획서 TIPS.searchTips) */
|
|
8
|
+
const TIP_ITEMS = [{
|
|
9
|
+
combination: '도로명 + 건물번호',
|
|
10
|
+
example: '디지털로26길 43'
|
|
11
|
+
}, {
|
|
12
|
+
combination: '지역명(동·리) + 번지',
|
|
13
|
+
example: '구로동 235-3'
|
|
14
|
+
}, {
|
|
15
|
+
combination: '지역명(동·리) + 건물명(아파트명)',
|
|
16
|
+
example: '구로동 대륭포스트타워8차'
|
|
17
|
+
}];
|
|
18
|
+
const TIP_EXAMPLE_PREFIX = '예)';
|
|
19
|
+
const TIP_ICON_SIZE = 16;
|
|
20
|
+
/**
|
|
21
|
+
* 검색어 조합을 안내하는 Tip 카드.
|
|
22
|
+
* 결과 목록이 없는 화면(초기·오류·결과 없음)에서만 노출된다.
|
|
23
|
+
* 결과가 있을 때는 모달이 안내 문구 한 줄만 검색 영역에 붙여 고정한다.
|
|
24
|
+
*/
|
|
25
|
+
const Tip = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
className
|
|
28
|
+
} = _ref;
|
|
29
|
+
return _jsxs("div", {
|
|
30
|
+
className: classnames('ncua-postcode-search-modal__tip', className),
|
|
31
|
+
children: [_jsxs("p", {
|
|
32
|
+
className: "ncua-postcode-search-modal__tip-label",
|
|
33
|
+
children: [_jsx(AnnotationInfoFill, {
|
|
34
|
+
className: "ncua-postcode-search-modal__tip-icon",
|
|
35
|
+
width: TIP_ICON_SIZE,
|
|
36
|
+
height: TIP_ICON_SIZE
|
|
37
|
+
}), TIP_LABEL]
|
|
38
|
+
}), _jsx("p", {
|
|
39
|
+
className: "ncua-postcode-search-modal__tip-title",
|
|
40
|
+
children: TIP_TITLE
|
|
41
|
+
}), _jsx("ul", {
|
|
42
|
+
className: "ncua-postcode-search-modal__tip-list",
|
|
43
|
+
children: TIP_ITEMS.map(_ref2 => {
|
|
44
|
+
let {
|
|
45
|
+
combination,
|
|
46
|
+
example
|
|
47
|
+
} = _ref2;
|
|
48
|
+
return _jsxs("li", {
|
|
49
|
+
className: "ncua-postcode-search-modal__tip-item",
|
|
50
|
+
children: [_jsx("span", {
|
|
51
|
+
className: "ncua-postcode-search-modal__tip-combination",
|
|
52
|
+
children: combination
|
|
53
|
+
}), _jsx("span", {
|
|
54
|
+
className: "ncua-postcode-search-modal__tip-example",
|
|
55
|
+
children: `${TIP_EXAMPLE_PREFIX} ${example}`
|
|
56
|
+
})]
|
|
57
|
+
}, combination);
|
|
58
|
+
})
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
Tip.displayName = 'PostcodeSearchModal.Tip';
|
|
63
|
+
export { Tip, TIP_TITLE };
|