v7.0.0-beta.2 release
This commit is contained in:
1 parent
6595fd0eb5
commit
fa8eba7a0d
1165 files changed
+107118
-762127
No files matched your search
@@ -4,6 +4,42 @@
|
||||
형식은 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/)를 따르며,
|
||||
[Semantic Versioning](https://semver.org/lang/ko/)을 준수합니다.
|
||||
|
||||
## [1.0.0-beta.2] - 2026-04-20
|
||||
|
||||
### Added
|
||||
|
||||
- NotificationCenter 컴포넌트 — 알림 드롭다운, 무한 스크롤, 안 읽은 필터, 개별/전체 삭제 (관리자 템플릿과 동일 UX)
|
||||
- 알림 전체 삭제 확인 모달 추가
|
||||
- 마이페이지 알림 목록에 "안 읽은 알림만" 필터 토글 추가
|
||||
- 실시간 알림 수신 시 카운트 갱신 + 토스트 표시 (WebSocket 연동)
|
||||
- 게시판/쇼핑몰 레이아웃에 SEO 설정 적용
|
||||
- 게시글 상세 페이지에 이전글/다음글 네비게이션 추가 — 독립 API로 비동기 로딩하여 초기 렌더링 속도 개선
|
||||
|
||||
### Changed
|
||||
|
||||
- 코어 최소 요구 버전을 7.0.0-beta.2 로 상향
|
||||
- 모듈/플러그인 의존성 버전 제약을 실제 릴리스 버전에 맞춰 정비
|
||||
- TabNavigation / Header / MobileNav / PageSkeleton 컴포넌트를 반응형으로 개선 — `useResponsive()` hook 기반 단일 분기 렌더링
|
||||
- 헤더 알림 버튼을 NotificationCenter 드롭다운으로 교체
|
||||
- 언어 선택 UI를 하드코딩에서 `localeNames` 기반 동적 생성으로 전환
|
||||
- HtmlContent DOMPurify를 FORBID 방식으로 전환 (보안 기본값 항상 유지)
|
||||
- HtmlEditor/HtmlContent를 extension_point로 변환
|
||||
- 인기글 기간 필터 "전체" 옵션을 "연간"으로 변경
|
||||
|
||||
### Fixed
|
||||
|
||||
- 마이페이지 배송지 관리에서 수정 버튼에 권한 체크가 누락되어 있던 문제 수정
|
||||
- 인기상품/신상품/최근본상품 섹션 반응형 개선 — grid 기반 카드 크기 제어 및 스크롤 버튼 breakpoint별 비활성화 처리
|
||||
- 다크 모드 variant 누락 보완
|
||||
- FileUploader 갤러리 이미지 깨짐 수정 — stale closure 문제
|
||||
- 사용자 화면 버전 배지 표현식 수정
|
||||
- 모바일 메뉴 통합검색 Enter 키 미작동 수정 — keydown 액션 누락
|
||||
- 상품 상세 페이지 모바일에서 가격이 중복 표시되던 문제 수정 — 모바일/데스크톱 가격 섹션을 상호 배타적 조건부 렌더링으로 분리
|
||||
- 상품 상세 모바일 가격 표시에 할인율 누락 수정 — PC와 동일하게 할인율 표시 추가
|
||||
- 주문 상세 아이템의 상태 뱃지·배송정보·구매확정/리뷰 버튼이 DOM에 이중 렌더링되던 문제 수정 — CSS hidden 토글에서 조건부 렌더링으로 전환
|
||||
- 장바구니 요약 패널이 모바일에서 sticky로 고정되어 스크롤 시 비정상 동작하던 문제 수정
|
||||
- 모달 내부 Select 드롭다운이 잘려 보이는 문제 수정
|
||||
|
||||
## [1.0.0-beta.1] - 2026-04-01
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* @file mypage-notifications.test.tsx
|
||||
* @description 사용자 알림 목록 페이지 레이아웃 테스트
|
||||
*
|
||||
* 테스트 대상:
|
||||
* - templates/.../mypage/notifications.json
|
||||
*
|
||||
* 검증 항목:
|
||||
* - 레이아웃 구조 (extends, data_sources)
|
||||
* - userNotifications 데이터소스 endpoint 및 params
|
||||
* - sort_order 파라미터 전달
|
||||
* - 초기 상태 (notificationsPage)
|
||||
* - init_actions 설정
|
||||
*
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
createLayoutTest,
|
||||
} from '@/core/template-engine/__tests__/utils/layoutTestUtils';
|
||||
import { ComponentRegistry } from '@/core/template-engine/ComponentRegistry';
|
||||
|
||||
// ========== 테스트용 컴포넌트 ==========
|
||||
|
||||
const TestDiv: React.FC<{ className?: string; children?: React.ReactNode; 'data-testid'?: string }> = ({ className, children, 'data-testid': testId }) => (
|
||||
<div className={className} data-testid={testId}>{children}</div>
|
||||
);
|
||||
|
||||
const TestSpan: React.FC<{ className?: string; children?: React.ReactNode; text?: string }> = ({ className, children, text }) => (
|
||||
<span className={className}>{children || text}</span>
|
||||
);
|
||||
|
||||
const TestButton: React.FC<{ type?: string; className?: string; children?: React.ReactNode; text?: string; onClick?: () => void }> = ({ type, className, children, text, onClick }) => (
|
||||
<button type={type as any} className={className} onClick={onClick}>{children || text}</button>
|
||||
);
|
||||
|
||||
const TestH1: React.FC<{ className?: string; children?: React.ReactNode; text?: string }> = ({ className, children, text }) => (
|
||||
<h1 className={className}>{children || text}</h1>
|
||||
);
|
||||
|
||||
const TestPagination: React.FC<{ currentPage?: number; totalPages?: number }> = ({ currentPage, totalPages }) => (
|
||||
<div data-testid="pagination" data-current={currentPage} data-total={totalPages}>Pagination</div>
|
||||
);
|
||||
|
||||
const TestContainer: React.FC<{ className?: string; children?: React.ReactNode }> = ({ className, children }) => (
|
||||
<div className={className} data-testid="container">{children}</div>
|
||||
);
|
||||
|
||||
// ========== 레지스트리 설정 ==========
|
||||
|
||||
function setupTestRegistry(): ComponentRegistry {
|
||||
const registry = ComponentRegistry.getInstance();
|
||||
(registry as any).registry = {
|
||||
Div: { component: TestDiv, metadata: { name: 'Div', type: 'basic' } },
|
||||
Span: { component: TestSpan, metadata: { name: 'Span', type: 'basic' } },
|
||||
Button: { component: TestButton, metadata: { name: 'Button', type: 'basic' } },
|
||||
H1: { component: TestH1, metadata: { name: 'H1', type: 'basic' } },
|
||||
Pagination: { component: TestPagination, metadata: { name: 'Pagination', type: 'composite' } },
|
||||
Container: { component: TestContainer, metadata: { name: 'Container', type: 'layout' } },
|
||||
};
|
||||
return registry;
|
||||
}
|
||||
|
||||
// ========== 테스트용 레이아웃 (mypage/notifications.json 기반) ==========
|
||||
|
||||
const notificationsLayout = {
|
||||
version: '1.0.0',
|
||||
layout_name: 'mypage/notifications',
|
||||
data_sources: [
|
||||
{
|
||||
id: 'userNotifications',
|
||||
type: 'api',
|
||||
endpoint: '/api/user/notifications',
|
||||
method: 'GET',
|
||||
auto_fetch: true,
|
||||
loading_strategy: 'progressive',
|
||||
params: {
|
||||
page: '{{_local.notificationsPage ?? 1}}',
|
||||
sort_order: 'desc',
|
||||
},
|
||||
},
|
||||
],
|
||||
init_actions: [
|
||||
{
|
||||
handler: 'setState',
|
||||
params: {
|
||||
target: 'local',
|
||||
notificationsPage: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
components: [
|
||||
{
|
||||
type: 'basic',
|
||||
name: 'Div',
|
||||
props: { className: 'min-h-screen bg-gray-50 dark:bg-gray-900' },
|
||||
children: [
|
||||
{
|
||||
type: 'layout',
|
||||
name: 'Container',
|
||||
props: { className: 'py-8' },
|
||||
children: [
|
||||
{
|
||||
id: 'notifications_header',
|
||||
type: 'basic',
|
||||
name: 'H1',
|
||||
text: '$t:notification.user.page_title',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// ========== 테스트 ==========
|
||||
|
||||
describe('mypage/notifications 레이아웃', () => {
|
||||
let testUtils: ReturnType<typeof createLayoutTest>;
|
||||
let registry: ComponentRegistry;
|
||||
|
||||
beforeEach(() => {
|
||||
registry = setupTestRegistry();
|
||||
testUtils = createLayoutTest(notificationsLayout, {
|
||||
translations: {},
|
||||
locale: 'ko',
|
||||
componentRegistry: registry,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
testUtils.cleanup();
|
||||
});
|
||||
|
||||
// ── 구조 검증 ──
|
||||
|
||||
it('데이터소스 endpoint가 새 API를 가리킨다', () => {
|
||||
const ds = notificationsLayout.data_sources.find((d) => d.id === 'userNotifications');
|
||||
expect(ds).toBeDefined();
|
||||
expect(ds!.endpoint).toBe('/api/user/notifications');
|
||||
});
|
||||
|
||||
it('데이터소스에 sort_order 파라미터가 포함된다', () => {
|
||||
const ds = notificationsLayout.data_sources.find((d) => d.id === 'userNotifications');
|
||||
expect(ds!.params!.sort_order).toBe('desc');
|
||||
});
|
||||
|
||||
it('데이터소스 params에 page 파라미터가 _local 바인딩이다', () => {
|
||||
const ds = notificationsLayout.data_sources.find((d) => d.id === 'userNotifications');
|
||||
expect(ds!.params!.page).toContain('_local.notificationsPage');
|
||||
});
|
||||
|
||||
it('init_actions에 notificationsPage 초기화가 설정되어 있다', () => {
|
||||
const initAction = notificationsLayout.init_actions[0];
|
||||
expect(initAction.handler).toBe('setState');
|
||||
expect(initAction.params.target).toBe('local');
|
||||
expect(initAction.params.notificationsPage).toBe(1);
|
||||
});
|
||||
|
||||
// ── 상태 관리 검증 ──
|
||||
|
||||
it('notificationsPage 초기 상태를 변경할 수 있다', async () => {
|
||||
testUtils.mockApi('userNotifications', {
|
||||
response: { data: { data: [], pagination: { current_page: 1, last_page: 1 } } },
|
||||
});
|
||||
|
||||
await testUtils.render();
|
||||
|
||||
testUtils.setState('notificationsPage', 2, 'local');
|
||||
expect(testUtils.getState()._local.notificationsPage).toBe(2);
|
||||
});
|
||||
});
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* @file responsive-consistency-audit.test.tsx
|
||||
* @description 모바일/PC 반응형 일관성 검증 테스트
|
||||
*
|
||||
* 테스트 대상:
|
||||
* - 주문 상세 아이템 (_items.json): CSS hidden 대신 if+responsive 사용 검증
|
||||
* - 장바구니 요약 (_cart_summary.json): 모바일에서 sticky 제거 검증
|
||||
* - 상품 상세 가격 (show.json + _info_summary.json + _price_mobile.json): 가격 중복 방지
|
||||
*
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
// ========== JSON 파일 로드 ==========
|
||||
|
||||
const layoutsDir = path.resolve(__dirname, '../../layouts');
|
||||
|
||||
function loadLayout(relativePath: string) {
|
||||
const filePath = path.join(layoutsDir, relativePath);
|
||||
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||
}
|
||||
|
||||
const orderItems = loadLayout('partials/mypage/orders/_items.json');
|
||||
const cartSummary = loadLayout('partials/shop/_cart_summary.json');
|
||||
|
||||
// ========== 헬퍼 함수 ==========
|
||||
|
||||
function findByComment(layout: any, commentSubstring: string): any {
|
||||
if (layout.comment?.includes(commentSubstring)) return layout;
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
const found = findByComment(child, commentSubstring);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function findAllByComment(layout: any, commentSubstring: string, results: any[] = []): any[] {
|
||||
if (layout.comment?.includes(commentSubstring)) results.push(layout);
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
findAllByComment(child, commentSubstring, results);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS "hidden" 클래스를 사용하여 표시/숨김 토글하는 노드를 찾는다
|
||||
* (responsive 내 className에 "hidden"이 포함되거나, 기본 className이 "hidden"인 경우)
|
||||
*/
|
||||
function findCssHiddenToggle(layout: any, results: any[] = []): any[] {
|
||||
// 기본 className이 "hidden"이고 responsive로 다른 클래스로 전환하는 경우
|
||||
if (layout.props?.className === 'hidden' && layout.responsive) {
|
||||
results.push(layout);
|
||||
}
|
||||
// responsive 내에서 className을 "hidden"으로 설정하는 경우
|
||||
if (layout.responsive) {
|
||||
for (const [breakpoint, config] of Object.entries(layout.responsive as Record<string, any>)) {
|
||||
if (config?.props?.className === 'hidden') {
|
||||
results.push(layout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
findCssHiddenToggle(child, results);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
// ========== 테스트 ==========
|
||||
|
||||
describe('Finding 2: 주문 상세 아이템 - 이중 렌더링 해소', () => {
|
||||
describe('모바일 전용 블록 (if+responsive.desktop 패턴)', () => {
|
||||
it('모바일 상태 뱃지+배송정보 블록이 if 기반 조건부 렌더링을 사용해야 한다', () => {
|
||||
const mobileStatus = findByComment(orderItems, '모바일: 상태 뱃지 + 배송정보');
|
||||
expect(mobileStatus).not.toBeNull();
|
||||
expect(mobileStatus.if).toBe('{{true}}');
|
||||
expect(mobileStatus.responsive?.desktop?.if).toBe('{{false}}');
|
||||
});
|
||||
|
||||
it('모바일 구매확정/리뷰 버튼 블록이 if 기반 조건부 렌더링을 사용해야 한다', () => {
|
||||
const mobileButtons = findByComment(orderItems, '모바일: 구매확정/리뷰 버튼');
|
||||
expect(mobileButtons).not.toBeNull();
|
||||
expect(mobileButtons.if).toBe('{{true}}');
|
||||
expect(mobileButtons.responsive?.desktop?.if).toBe('{{false}}');
|
||||
});
|
||||
|
||||
it('모바일 블록에 CSS hidden 클래스가 없어야 한다', () => {
|
||||
const mobileStatus = findByComment(orderItems, '모바일: 상태 뱃지 + 배송정보');
|
||||
const mobileButtons = findByComment(orderItems, '모바일: 구매확정/리뷰 버튼');
|
||||
expect(mobileStatus.props?.className).not.toBe('hidden');
|
||||
expect(mobileButtons.props?.className).not.toBe('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
describe('PC 전용 블록 (if+responsive.desktop 패턴)', () => {
|
||||
const pcOnlyComments = [
|
||||
'상태 뱃지 (PC만 표시)',
|
||||
'배송사 + 운송장번호 (PC만 표시)',
|
||||
'구매확정 버튼 (PC)',
|
||||
'리뷰작성 버튼 (PC)',
|
||||
'리뷰 작성 완료 뱃지 (PC)'
|
||||
];
|
||||
|
||||
it.each(pcOnlyComments)('%s: if 기반 조건부 렌더링을 사용해야 한다', (comment) => {
|
||||
const pcBlock = findByComment(orderItems, comment);
|
||||
expect(pcBlock).not.toBeNull();
|
||||
// 기본 if가 false (모바일 숨김)
|
||||
expect(pcBlock.if).toBe('{{false}}');
|
||||
// desktop에서 조건부 표시
|
||||
expect(pcBlock.responsive?.desktop?.if).toBeDefined();
|
||||
expect(pcBlock.responsive?.desktop?.if).not.toBe('{{false}}');
|
||||
});
|
||||
|
||||
it.each(pcOnlyComments)('%s: responsive.portable에 className hidden이 없어야 한다', (comment) => {
|
||||
const pcBlock = findByComment(orderItems, comment);
|
||||
expect(pcBlock.responsive?.portable?.props?.className).not.toBe('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
describe('CSS hidden 토글 패턴 부재 검증', () => {
|
||||
it('주문 아이템 영역에 CSS hidden 토글 패턴이 없어야 한다', () => {
|
||||
// 상품 목록 iteration 영역에서만 검사
|
||||
const itemsList = findByComment(orderItems, '상품 목록');
|
||||
expect(itemsList).not.toBeNull();
|
||||
const hiddenToggles = findCssHiddenToggle(itemsList);
|
||||
expect(hiddenToggles).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Finding 3: 장바구니 요약 패널 - 모바일 sticky 제거', () => {
|
||||
it('기본 className에 sticky top-24가 포함되어야 한다 (PC)', () => {
|
||||
expect(cartSummary.props.className).toContain('sticky');
|
||||
expect(cartSummary.props.className).toContain('top-24');
|
||||
});
|
||||
|
||||
it('portable responsive에서 sticky가 제거되어야 한다 (모바일)', () => {
|
||||
expect(cartSummary.responsive?.portable?.props?.className).toBeDefined();
|
||||
expect(cartSummary.responsive.portable.props.className).not.toContain('sticky');
|
||||
expect(cartSummary.responsive.portable.props.className).not.toContain('top-24');
|
||||
});
|
||||
|
||||
it('portable에서 기본 스타일(배경, 라운드, 그림자, 패딩)은 유지되어야 한다', () => {
|
||||
const portableClass = cartSummary.responsive.portable.props.className;
|
||||
expect(portableClass).toContain('bg-white');
|
||||
expect(portableClass).toContain('dark:bg-gray-800');
|
||||
expect(portableClass).toContain('rounded-lg');
|
||||
expect(portableClass).toContain('shadow');
|
||||
expect(portableClass).toContain('p-6');
|
||||
});
|
||||
});
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* @file shop-product-detail-price-responsive.test.tsx
|
||||
* @description 상품 상세 페이지 가격 표시 반응형 테스트
|
||||
*
|
||||
* 테스트 대상:
|
||||
* - templates/.../layouts/shop/show.json (상품 상세 메인 레이아웃)
|
||||
* - templates/.../partials/shop/detail/_price_mobile.json (모바일 전용 가격)
|
||||
* - templates/.../partials/shop/detail/_info_summary.json (가격 섹션 - 데스크톱 전용)
|
||||
*
|
||||
* 검증 항목:
|
||||
* - 모바일 가격(_price_mobile.json)은 모바일에서만 표시
|
||||
* - 정보 요약 가격(_info_summary.json)은 데스크톱에서만 표시
|
||||
* - 가격이 모바일에서 중복 표시되지 않음
|
||||
*
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
// ========== JSON 파일 로드 ==========
|
||||
|
||||
const layoutsDir = path.resolve(__dirname, '../../layouts');
|
||||
|
||||
function loadLayout(relativePath: string) {
|
||||
const filePath = path.join(layoutsDir, relativePath);
|
||||
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||
}
|
||||
|
||||
const showLayout = loadLayout('shop/show.json');
|
||||
const priceMobile = loadLayout('partials/shop/detail/_price_mobile.json');
|
||||
const infoSummary = loadLayout('partials/shop/detail/_info_summary.json');
|
||||
|
||||
// ========== 헬퍼 함수 ==========
|
||||
|
||||
/**
|
||||
* 중첩된 children에서 comment로 노드를 찾는다
|
||||
*/
|
||||
function findByComment(layout: any, commentSubstring: string): any {
|
||||
if (layout.comment?.includes(commentSubstring)) return layout;
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
const found = findByComment(child, commentSubstring);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
if (layout.slots) {
|
||||
for (const slotChildren of Object.values(layout.slots)) {
|
||||
for (const child of slotChildren as any[]) {
|
||||
const found = findByComment(child, commentSubstring);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ========== 테스트 ==========
|
||||
|
||||
describe('상품 상세 페이지 가격 표시 반응형', () => {
|
||||
describe('모바일 전용 가격 (show.json → _price_mobile.json)', () => {
|
||||
it('모바일 전용 가격 컨테이너가 존재해야 한다', () => {
|
||||
const mobilePriceWrapper = findByComment(showLayout, '모바일 전용: 가격 표시');
|
||||
expect(mobilePriceWrapper).not.toBeNull();
|
||||
});
|
||||
|
||||
it('기본 if가 true(모바일 표시)이어야 한다', () => {
|
||||
const mobilePriceWrapper = findByComment(showLayout, '모바일 전용: 가격 표시');
|
||||
expect(mobilePriceWrapper.if).toBe('{{true}}');
|
||||
});
|
||||
|
||||
it('desktop responsive에서 if가 false(데스크톱 숨김)이어야 한다', () => {
|
||||
const mobilePriceWrapper = findByComment(showLayout, '모바일 전용: 가격 표시');
|
||||
expect(mobilePriceWrapper.responsive?.desktop?.if).toBe('{{false}}');
|
||||
});
|
||||
});
|
||||
|
||||
describe('정보 요약 가격 (_info_summary.json)', () => {
|
||||
it('가격 섹션이 존재해야 한다', () => {
|
||||
const priceSection = findByComment(infoSummary, '가격 섹션');
|
||||
expect(priceSection).not.toBeNull();
|
||||
});
|
||||
|
||||
it('기본 if가 false(모바일 숨김)이어야 한다', () => {
|
||||
const priceSection = findByComment(infoSummary, '가격 섹션');
|
||||
expect(priceSection.if).toBe('{{false}}');
|
||||
});
|
||||
|
||||
it('desktop responsive에서 if가 true(데스크톱 표시)이어야 한다', () => {
|
||||
const priceSection = findByComment(infoSummary, '가격 섹션');
|
||||
expect(priceSection.responsive?.desktop?.if).toBe('{{true}}');
|
||||
});
|
||||
});
|
||||
|
||||
describe('가격 중복 방지 구조 검증', () => {
|
||||
it('모바일 가격과 정보 요약 가격의 responsive 조건이 상호 배타적이어야 한다', () => {
|
||||
const mobilePriceWrapper = findByComment(showLayout, '모바일 전용: 가격 표시');
|
||||
const priceSection = findByComment(infoSummary, '가격 섹션');
|
||||
|
||||
// 모바일 가격: 기본 표시, 데스크톱 숨김
|
||||
expect(mobilePriceWrapper.if).toBe('{{true}}');
|
||||
expect(mobilePriceWrapper.responsive?.desktop?.if).toBe('{{false}}');
|
||||
|
||||
// 정보 요약 가격: 기본 숨김, 데스크톱 표시
|
||||
expect(priceSection.if).toBe('{{false}}');
|
||||
expect(priceSection.responsive?.desktop?.if).toBe('{{true}}');
|
||||
});
|
||||
|
||||
it('_price_mobile.json에 할인율 표시 요소가 있어야 한다', () => {
|
||||
expect(priceMobile.children).toBeDefined();
|
||||
expect(priceMobile.children.length).toBeGreaterThan(0);
|
||||
|
||||
// 할인율 표시 요소 존재 확인
|
||||
const discountSection = findByComment(priceMobile, '할인율 + 판매가');
|
||||
expect(discountSection).not.toBeNull();
|
||||
expect(discountSection.if).toContain('discount_rate');
|
||||
|
||||
// 할인율 텍스트에 % 포함
|
||||
const discountRate = discountSection.children.find(
|
||||
(child: any) => child.text?.includes('discount_rate')
|
||||
);
|
||||
expect(discountRate).toBeDefined();
|
||||
expect(discountRate.text).toContain('%');
|
||||
});
|
||||
|
||||
it('_price_mobile.json에 판매가 표시 요소가 있어야 한다', () => {
|
||||
// 할인 시 판매가
|
||||
const discountSection = findByComment(priceMobile, '할인율 + 판매가');
|
||||
const sellingPrice = discountSection.children.find(
|
||||
(child: any) => child.text?.includes('selling_price')
|
||||
);
|
||||
expect(sellingPrice).toBeDefined();
|
||||
|
||||
// 비할인 시 판매가
|
||||
const noDiscountSection = findByComment(priceMobile, '판매가 (할인 없을 때)');
|
||||
expect(noDiscountSection).not.toBeNull();
|
||||
expect(noDiscountSection.text).toContain('selling_price');
|
||||
});
|
||||
|
||||
it('_info_summary.json 가격 섹션에 할인율/판매가 표시 요소가 있어야 한다', () => {
|
||||
const priceSection = findByComment(infoSummary, '가격 섹션');
|
||||
expect(priceSection.children).toBeDefined();
|
||||
expect(priceSection.children.length).toBeGreaterThan(0);
|
||||
|
||||
// 할인 관련 요소 존재 확인
|
||||
const discountElement = findByComment(priceSection, '할인');
|
||||
expect(discountElement).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* @file shop-product-sections-responsive.test.tsx
|
||||
* @description 인기상품/신상품/최근본상품 섹션 모바일 반응형 테스트
|
||||
*
|
||||
* 테스트 대상:
|
||||
* - templates/.../partials/shop/list/_popular_products.json
|
||||
* - templates/.../partials/shop/list/_new_products.json
|
||||
* - templates/.../partials/shop/list/_recent_products.json
|
||||
*
|
||||
* 검증 항목:
|
||||
* - 카드 너비: 모바일 2개/줄 + 데스크톱 4개/줄 클래스 공존
|
||||
* - 다음 버튼: portable responsive에서 +2 기준 비활성화
|
||||
* - responsive 속성 portable 프리셋 사용
|
||||
*
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
// ========== JSON 파일 로드 ==========
|
||||
|
||||
const partialsDir = path.resolve(__dirname, '../../layouts/partials/shop/list');
|
||||
|
||||
function loadPartial(filename: string) {
|
||||
const filePath = path.join(partialsDir, filename);
|
||||
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||
}
|
||||
|
||||
const popularProducts = loadPartial('_popular_products.json');
|
||||
const newProducts = loadPartial('_new_products.json');
|
||||
const recentProducts = loadPartial('_recent_products.json');
|
||||
|
||||
// ========== 헬퍼 함수 ==========
|
||||
|
||||
/**
|
||||
* 중첩된 children에서 iteration이 있는 카드 컨테이너를 찾는다
|
||||
*/
|
||||
function findIterationCard(layout: any): any {
|
||||
if (layout.iteration) return layout;
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
const found = findIterationCard(child);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중첩된 children에서 grid 스크롤 컨테이너를 찾는다
|
||||
*/
|
||||
function findScrollContainer(layout: any): any {
|
||||
if (layout.props?.className?.includes('grid-flow-col')) return layout;
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
const found = findScrollContainer(child);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 중첩된 children에서 responsive 속성이 있는 Button을 찾는다 (다음 버튼)
|
||||
*/
|
||||
function findNextButton(layout: any): any {
|
||||
if (layout.name === 'Button' && layout.responsive?.['0-639']) return layout;
|
||||
if (layout.children) {
|
||||
for (const child of layout.children) {
|
||||
const found = findNextButton(child);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ========== 테스트 ==========
|
||||
|
||||
describe('인기상품/신상품/최근본상품 섹션 모바일 반응형', () => {
|
||||
const partials = [
|
||||
{ name: '인기상품', layout: popularProducts, dataSource: 'popularProducts' },
|
||||
{ name: '신상품', layout: newProducts, dataSource: 'newProducts' },
|
||||
{ name: '최근본상품', layout: recentProducts, dataSource: 'recentProducts' },
|
||||
];
|
||||
|
||||
describe.each(partials)('$name 섹션', ({ layout, dataSource }) => {
|
||||
describe('grid 기반 카드 크기 반응형', () => {
|
||||
it('컨테이너가 grid grid-flow-col을 사용해야 한다', () => {
|
||||
const container = findScrollContainer(layout);
|
||||
expect(container).not.toBeNull();
|
||||
expect(container.props.className).toContain('grid');
|
||||
expect(container.props.className).toContain('grid-flow-col');
|
||||
});
|
||||
|
||||
it('모바일 auto-cols 50%, sm 33.333%, lg 25%가 적용되어야 한다', () => {
|
||||
const container = findScrollContainer(layout);
|
||||
expect(container.props.className).toContain('auto-cols-[calc(50%_-_8px)]');
|
||||
expect(container.props.className).toContain('sm:auto-cols-[calc(33.333%_-_11px)]');
|
||||
expect(container.props.className).toContain('lg:auto-cols-[calc(25%_-_12px)]');
|
||||
});
|
||||
|
||||
it('카드에 별도 너비 클래스가 없어야 한다 (grid가 제어)', () => {
|
||||
const card = findIterationCard(layout);
|
||||
expect(card.props.className ?? '').not.toContain('w-[');
|
||||
expect(card.props.className ?? '').not.toContain('flex-none');
|
||||
});
|
||||
});
|
||||
|
||||
describe('다음 버튼 responsive 오버라이드', () => {
|
||||
it('모바일(0-639)에서 +2 기준 disabled 조건이 있어야 한다', () => {
|
||||
const nextBtn = findNextButton(layout);
|
||||
expect(nextBtn).not.toBeNull();
|
||||
expect(nextBtn.responsive['0-639'].props.disabled).toContain('+ 2');
|
||||
});
|
||||
|
||||
it('태블릿(640-1023)에서 +3 기준 disabled 조건이 있어야 한다', () => {
|
||||
const nextBtn = findNextButton(layout);
|
||||
expect(nextBtn.responsive['640-1023'].props.disabled).toContain('+ 3');
|
||||
});
|
||||
|
||||
it('데스크톱 기본값은 +4 기준이어야 한다', () => {
|
||||
const nextBtn = findNextButton(layout);
|
||||
expect(nextBtn.props.disabled).toContain('+ 4');
|
||||
expect(nextBtn.props.className).toContain('+ 4');
|
||||
});
|
||||
|
||||
it('모바일 disabled에 올바른 데이터소스를 참조해야 한다', () => {
|
||||
const nextBtn = findNextButton(layout);
|
||||
expect(nextBtn.responsive['0-639'].props.disabled).toContain(`${dataSource}.data.length`);
|
||||
});
|
||||
|
||||
it('태블릿 disabled에 올바른 데이터소스를 참조해야 한다', () => {
|
||||
const nextBtn = findNextButton(layout);
|
||||
expect(nextBtn.responsive['640-1023'].props.disabled).toContain(`${dataSource}.data.length`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('공통 구조 검증', () => {
|
||||
it.each(partials)('$name: 컨테이너가 overflow-x-hidden이어야 한다', ({ layout }) => {
|
||||
const container = findScrollContainer(layout);
|
||||
expect(container).not.toBeNull();
|
||||
expect(container.props.className).toContain('overflow-x-hidden');
|
||||
});
|
||||
|
||||
it.each(partials)('$name: isolatedState에 scrollIdx가 정의되어야 한다', ({ layout }) => {
|
||||
expect(layout.isolatedState).toBeDefined();
|
||||
expect(layout.isolatedState.scrollIdx).toBe(0);
|
||||
});
|
||||
|
||||
it.each(partials)('$name: if 조건으로 데이터 없을 때 비노출 처리되어야 한다', ({ layout }) => {
|
||||
expect(layout.if).toBeDefined();
|
||||
expect(layout.if).toContain('.data');
|
||||
expect(layout.if).toContain('.length > 0');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,193 @@
|
||||
/**
|
||||
* @file user-base-mobile-search.test.tsx
|
||||
* @description 모바일 메뉴 통합검색 기능 테스트
|
||||
*
|
||||
* 테스트 대상:
|
||||
* - templates/.../layouts/_user_base.json (모바일 검색바 섹션)
|
||||
*
|
||||
* 검증 항목:
|
||||
* - 검색 Input에 keydown Enter 액션이 정의되어 있는지
|
||||
* - Enter 키 입력 시 /search 페이지로 navigate 되는지
|
||||
* - 검색어가 query.q 파라미터로 전달되는지
|
||||
*
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
createLayoutTest,
|
||||
screen,
|
||||
} from '@/core/template-engine/__tests__/utils/layoutTestUtils';
|
||||
import { ComponentRegistry } from '@/core/template-engine/ComponentRegistry';
|
||||
|
||||
// ========== 테스트용 컴포넌트 ==========
|
||||
|
||||
const TestDiv: React.FC<{ className?: string; children?: React.ReactNode; 'data-testid'?: string }> = ({ className, children, 'data-testid': testId }) => (
|
||||
<div className={className} data-testid={testId}>{children}</div>
|
||||
);
|
||||
|
||||
const TestInput: React.FC<{
|
||||
type?: string;
|
||||
name?: string;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
value?: string;
|
||||
onKeyDown?: (e: React.KeyboardEvent) => void;
|
||||
onChange?: (e: React.ChangeEvent) => void;
|
||||
}> = ({ type, name, placeholder, className, value, onKeyDown, onChange }) => (
|
||||
<input
|
||||
type={type}
|
||||
name={name}
|
||||
placeholder={placeholder}
|
||||
className={className}
|
||||
value={value}
|
||||
onKeyDown={onKeyDown}
|
||||
onChange={onChange}
|
||||
data-testid="search-input"
|
||||
/>
|
||||
);
|
||||
|
||||
const TestIcon: React.FC<{ name?: string; className?: string }> = ({ name, className }) => (
|
||||
<span className={className} data-icon={name} />
|
||||
);
|
||||
|
||||
// ========== 레지스트리 설정 ==========
|
||||
|
||||
function setupTestRegistry(): ComponentRegistry {
|
||||
const registry = ComponentRegistry.getInstance();
|
||||
(registry as any).registry = {
|
||||
Div: { component: TestDiv, metadata: { name: 'Div', type: 'basic' } },
|
||||
Input: { component: TestInput, metadata: { name: 'Input', type: 'basic' } },
|
||||
Icon: { component: TestIcon, metadata: { name: 'Icon', type: 'basic' } },
|
||||
};
|
||||
return registry;
|
||||
}
|
||||
|
||||
// ========== 모바일 검색바 레이아웃 (발췌) ==========
|
||||
|
||||
const mobileSearchLayout = {
|
||||
version: '1.0',
|
||||
layout_name: 'mobile_search_test',
|
||||
meta: { title: '모바일 검색 테스트' },
|
||||
components: [
|
||||
{
|
||||
comment: '검색바',
|
||||
type: 'basic' as const,
|
||||
name: 'Div',
|
||||
props: { className: 'p-4' },
|
||||
children: [
|
||||
{
|
||||
type: 'basic' as const,
|
||||
name: 'Div',
|
||||
props: { className: 'relative' },
|
||||
children: [
|
||||
{
|
||||
type: 'basic' as const,
|
||||
name: 'Icon',
|
||||
props: {
|
||||
name: 'search',
|
||||
className: 'absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'basic' as const,
|
||||
name: 'Input',
|
||||
props: {
|
||||
type: 'text',
|
||||
name: 'q',
|
||||
placeholder: '$t:user.search_placeholder',
|
||||
className: 'w-full pl-10 pr-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-blue-500',
|
||||
},
|
||||
actions: [
|
||||
{
|
||||
type: 'keydown',
|
||||
key: 'Enter',
|
||||
handler: 'sequence',
|
||||
actions: [
|
||||
{
|
||||
handler: 'setState',
|
||||
params: { target: 'global', mobileMenuOpen: false },
|
||||
},
|
||||
{
|
||||
handler: 'navigate',
|
||||
params: { path: '/search', query: { q: '{{$event.target.value}}' } },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// ========== 테스트 ==========
|
||||
|
||||
describe('모바일 메뉴 통합검색', () => {
|
||||
let testUtils: ReturnType<typeof createLayoutTest>;
|
||||
let registry: ComponentRegistry;
|
||||
|
||||
beforeEach(() => {
|
||||
registry = setupTestRegistry();
|
||||
testUtils = createLayoutTest(mobileSearchLayout, {
|
||||
translations: {},
|
||||
locale: 'ko',
|
||||
componentRegistry: registry,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
testUtils.cleanup();
|
||||
});
|
||||
|
||||
// ── 구조 검증 ──
|
||||
|
||||
it('검색 Input에 keydown Enter sequence 액션이 정의되어 있다', () => {
|
||||
const inputComponent = mobileSearchLayout.components[0].children[0].children[1];
|
||||
expect(inputComponent.name).toBe('Input');
|
||||
expect(inputComponent.actions).toBeDefined();
|
||||
expect(inputComponent.actions).toHaveLength(1);
|
||||
|
||||
const enterAction = inputComponent.actions![0];
|
||||
expect(enterAction.type).toBe('keydown');
|
||||
expect(enterAction.key).toBe('Enter');
|
||||
expect(enterAction.handler).toBe('sequence');
|
||||
expect(enterAction.actions).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('Enter 시 메뉴 닫기 후 /search로 이동한다', () => {
|
||||
const inputComponent = mobileSearchLayout.components[0].children[0].children[1];
|
||||
const sequenceActions = inputComponent.actions![0].actions!;
|
||||
|
||||
// 1단계: 메뉴 닫기
|
||||
expect(sequenceActions[0].handler).toBe('setState');
|
||||
expect(sequenceActions[0].params).toEqual({ target: 'global', mobileMenuOpen: false });
|
||||
|
||||
// 2단계: 검색 페이지 이동
|
||||
expect(sequenceActions[1].handler).toBe('navigate');
|
||||
expect(sequenceActions[1].params).toEqual({
|
||||
path: '/search',
|
||||
query: { q: '{{$event.target.value}}' },
|
||||
});
|
||||
});
|
||||
|
||||
it('검색 Input에 name="q" prop이 설정되어 있다', () => {
|
||||
const inputComponent = mobileSearchLayout.components[0].children[0].children[1];
|
||||
expect(inputComponent.props.name).toBe('q');
|
||||
});
|
||||
|
||||
it('데스크톱 검색과 동일한 navigate 핸들러 패턴을 사용한다', () => {
|
||||
// _search_input.json의 keydown Enter 핸들러와 동일한 navigate 패턴 검증
|
||||
const inputComponent = mobileSearchLayout.components[0].children[0].children[1];
|
||||
const navigateAction = inputComponent.actions![0].actions![1];
|
||||
|
||||
expect(navigateAction.handler).toBe('navigate');
|
||||
expect(navigateAction.params.query).toHaveProperty('q');
|
||||
// $event.target.value 패턴 사용 (CLAUDE.md: $value 금지)
|
||||
expect(navigateAction.params.query.q).toContain('$event.target.value');
|
||||
expect(navigateAction.params.query.q).not.toContain('$value');
|
||||
});
|
||||
});
|
||||
@@ -838,6 +838,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "NotificationCenter",
|
||||
"type": "composite",
|
||||
"description": "알림 센터 드롭다운 — 알림 목록 표시, 무한스크롤, 읽음 추적, 안 읽은 필터, 개별/전체 삭제",
|
||||
"path": "src/components/composite/NotificationCenter.tsx",
|
||||
"props": {
|
||||
"notifications": { "type": "array", "required": false, "default": [], "description": "알림 아이템 목록 (id, title, message, time, read, iconName, data)" },
|
||||
"unreadCount": { "type": "number", "required": false, "default": 0, "description": "서버 기반 미읽음 알림 수" },
|
||||
"hasMore": { "type": "boolean", "required": false, "default": false, "description": "추가 로드 가능 여부 (무한스크롤)" },
|
||||
"loading": { "type": "boolean", "required": false, "default": false, "description": "로딩 상태" },
|
||||
"titleText": { "type": "string", "required": false, "default": "알림", "description": "드롭다운 제목" },
|
||||
"emptyText": { "type": "string", "required": false, "description": "알림 없음 텍스트" },
|
||||
"markAllReadText": { "type": "string", "required": false, "description": "모두 읽음 버튼 텍스트" },
|
||||
"deleteAllText": { "type": "string", "required": false, "description": "모두 삭제 버튼 텍스트" },
|
||||
"unreadOnlyText": { "type": "string", "required": false, "description": "안 읽은 알림만 체크박스 텍스트" },
|
||||
"unreadOnly": { "type": "boolean", "required": false, "default": false, "description": "안 읽은 알림만 필터 상태" },
|
||||
"dropdownAlign": { "type": "string", "required": false, "default": "right", "description": "드롭다운 정렬 방향 (right/left)" },
|
||||
"className": { "type": "string", "required": false, "description": "추가 CSS 클래스" }
|
||||
},
|
||||
"events": ["onClose", "onNotificationClick", "onLoadMore", "onMarkAllRead", "onDeleteAll", "onDelete", "onUnreadOnlyToggle"]
|
||||
},
|
||||
{
|
||||
"name": "Pagination",
|
||||
"type": "composite",
|
||||
|
||||
@@ -1 +1 @@
|
||||
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-scroll-snap-strictness:proximity;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-yellow-900:oklch(42.1% .095 57.708);--color-yellow-950:oklch(28.6% .066 53.813);--color-lime-50:oklch(98.6% .031 120.757);--color-lime-100:oklch(96.7% .067 122.328);--color-lime-200:oklch(93.8% .127 124.321);--color-lime-300:oklch(89.7% .196 126.665);--color-lime-400:oklch(84.1% .238 128.85);--color-lime-500:oklch(76.8% .233 130.85);--color-lime-600:oklch(64.8% .2 131.684);--color-lime-700:oklch(53.2% .157 131.589);--color-lime-800:oklch(45.3% .124 130.933);--color-lime-900:oklch(40.5% .101 131.063);--color-lime-950:oklch(27.4% .072 132.109);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(Line truncated
|
||||
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-scroll-snap-strictness:proximity;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-yellow-900:oklch(42.1% .095 57.708);--color-yellow-950:oklch(28.6% .066 53.813);--color-lime-50:oklch(98.6% .031 120.757);--color-lime-100:oklch(96.7% .067 122.328);--color-lime-200:oklch(93.8% .127 124.321);--color-lime-300:oklch(89.7% .196 126.665);--color-lime-400:oklch(84.1% .238 128.85);--color-lime-500:oklch(76.8% .233 130.85);--color-lime-600:oklch(64.8% .2 131.684);--color-lime-700:oklch(53.2% .157 131.589);--color-lime-800:oklch(45.3% .124 130.933);--color-lime-900:oklch(40.5% .101 131.063);--color-lime-950:oklch(27.4% .072 132.109);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(Line truncated
|
||||
+22
-21
@@ -1,44 +1,45 @@
|
||||
var SirsoftBasic=(function(J,u,C,rr){"use strict";function hc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const E=hc(C),gc=()=>window.G7Core,Q=C.forwardRef(({children:e,variant:t="primary",size:r="md",className:n="",...o},a)=>{const s="inline-flex items-center justify-center",l=gc()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return u.jsx("button",{ref:a,className:l,...o,children:e})});Q.displayName="Button";const B=C.forwardRef(({children:e,className:t="",...r},n)=>u.jsx("div",{ref:n,className:t,...r,children:e})),ne=({children:e,className:t="",...r})=>u.jsx("span",{className:t,...r,children:e}),cn=({children:e,className:t="",...r})=>u.jsx("svg",{className:t,...r,children:e}),Dt=C.forwardRef(({label:e,error:t,className:r="",onChange:n,onKeyPress:o,value:a,defaultValue:s,type:l="text",checked:f,defaultChecked:g,...c},i)=>{const d=l==="radio"||l==="checkbox",h=C.useRef(!1),p=C.useRef(null);C.useImperativeHandle(i,()=>p.current);const[y,x]=C.useState(a??s??"");C.useEffect(()=>{!d&&!h.current&&a!==void 0&&x(a)},[a,d]);const m=C.useCallback(()=>{h.current=!0},[]),D=C.useCallback(v=>{if(h.current=!1,n){const M=v.target.value;x(M);const A=new Event("change",{bubbles:!0});Object.defineProperty(A,"target",{writable:!1,value:{value:M}}),Object.defineProperty(A,"currentTarget",{writable:!1,value:{value:M}}),n(A)}},[n]),_=C.useCallback(v=>{const M=v.target.value;x(M),!h.current&&n&&n(v)},[n]),T=C.useCallback(v=>{h.current||o&&o(v)},[o]),{loadingactions:P,formdata:S,...N}=c;if(d)return u.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:g,value:a,...N});const b=a!==void 0?{value:y}:{defaultValue:s};return u.jsx("input",{ref:p,type:l,className:r,onChange:_,onKeyPress:T,onCompositionStart:m,onCompositionEnd:D,...b,...N})});Dt.displayName="Input";const Ma=C.forwardRef(({accept:e,maxSize:t,onChange:r,onError:n,buttonText:o="Browse",placeholder:a="No file selected",className:s="",disabled:l,...f},g)=>{const c=C.useRef(null),i=g||c,[d,h]=C.useState(""),p=C.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),y=C.useCallback(m=>{const D=m.target.files?.[0]||null;if(!D){h(""),r?.(null);return}if(t&&D.size>t*1024*1024){const _=`File size exceeds ${t}MB limit`;n?.(_),i.current&&(i.current.value=""),h("");return}h(D.name),r?.(D)},[t,r,n,i]),x=C.useCallback(m=>{m.stopPropagation(),i.current&&(i.current.value=""),h(""),r?.(null)},[r,i]);return u.jsxs(B,{className:`flex items-center gap-2 ${s}`,children:[u.jsx(Dt,{ref:i,type:"file",accept:e,onChange:y,disabled:l,className:"hidden",...f}),u.jsx(Q,{type:"button",onClick:p,disabled:l,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:o}),u.jsx(ne,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:d||a}),d&&!l&&u.jsx(Q,{type:"button",onClick:x,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:u.jsx(cn,{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Ma.displayName="FileInput";var nt=(e=>(e.User="fa-user",e.Users="fa-users",e.UserCircle="fa-user-circle",e.UserPlus="fa-user-plus",e.UserMinus="fa-user-minus",e.UserShield="fa-user-shield",e.Search="fa-search",e.Edit="fa-edit",e.Pencil="fa-pencil-alt",e.Trash="fa-trash",e.Save="fa-save",e.Plus="fa-plus",e.Minus="fa-minus",e.Check="fa-check",e.Times="fa-times",e.Download="fa-download",e.Upload="fa-upload",e.Copy="fa-copy",e.ExternalLink="fa-external-link-alt",e.Home="fa-home",e.ChevronLeft="fa-chevron-left",e.ChevronRight="fa-chevron-right",e.ChevronUp="fa-chevron-up",e.ChevronDown="fa-chevron-down",e.AngleLeft="fa-angle-left",e.AngleRight="fa-angle-right",e.AngleUp="fa-angle-up",e.AngleDown="fa-angle-down",e.ArrowUp="fa-arrow-up",e.ArrowDown="fa-arrow-down",e.ArrowLeft="fa-arrow-left",e.ArrowRight="fa-arrow-right",e.Bars="fa-bars",e.EllipsisVertical="fa-ellipsis-v",e.EllipsisHorizontal="fa-ellipsis-h",e.CheckCircle="fa-check-circle",e.TimesCircle="fa-times-circle",e.ExclamationCircle="fa-exclamation-circle",e.ExclamationTriangle="fa-exclamation-triangle",e.InfoCircle="fa-info-circle",e.QuestionCircle="fa-question-circle",e.XCircle="fa-times-circle",e.ShoppingCart="fa-shopping-cart",e.ShoppingBag="fa-shopping-bag",e.CreditCard="fa-credit-card",e.Tag="fa-tag",e.Tags="fa-tags",e.File="fa-file",e.FileAlt="fa-file-alt",e.Folder="fa-folder",e.FolderOpen="fa-folder-open",e.Envelope="fa-envelope",e.Phone="fa-phonLine truncated
|
||||
var SirsoftBasic=(function(R,d,x,Jt){"use strict";function pc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const _=pc(x),mc=()=>window.G7Core,Q=x.forwardRef(({children:e,variant:t="primary",size:r="md",className:n="",...o},a)=>{const s="inline-flex items-center justify-center",l=mc()?.style?.mergeClasses?.(s,n)??`${s} ${n}`;return d.jsx("button",{ref:a,className:l,...o,children:e})});Q.displayName="Button";const j=x.forwardRef(({children:e,className:t="",...r},n)=>d.jsx("div",{ref:n,className:t,...r,children:e})),re=({children:e,className:t="",...r})=>d.jsx("span",{className:t,...r,children:e}),cn=({children:e,className:t="",...r})=>d.jsx("svg",{className:t,...r,children:e}),vt=x.forwardRef(({label:e,error:t,className:r="",onChange:n,onKeyPress:o,value:a,defaultValue:s,type:l="text",checked:f,defaultChecked:g,...c},i)=>{const u=l==="radio"||l==="checkbox",h=x.useRef(!1),p=x.useRef(null);x.useImperativeHandle(i,()=>p.current);const[y,w]=x.useState(a??s??"");x.useEffect(()=>{!u&&!h.current&&a!==void 0&&w(a)},[a,u]);const b=x.useCallback(()=>{h.current=!0},[]),L=x.useCallback(v=>{if(h.current=!1,n){const D=v.target.value;w(D);const N=new Event("change",{bubbles:!0});Object.defineProperty(N,"target",{writable:!1,value:{value:D}}),Object.defineProperty(N,"currentTarget",{writable:!1,value:{value:D}}),n(N)}},[n]),S=x.useCallback(v=>{const D=v.target.value;w(D),!h.current&&n&&n(v)},[n]),O=x.useCallback(v=>{h.current||o&&o(v)},[o]),{loadingactions:F,formdata:E,...T}=c;if(u)return d.jsx("input",{ref:p,type:l,className:r,onChange:n,checked:f,defaultChecked:g,value:a,...T});const m=a!==void 0?{value:y}:{defaultValue:s};return d.jsx("input",{ref:p,type:l,className:r,onChange:S,onKeyPress:O,onCompositionStart:b,onCompositionEnd:L,...m,...T})});vt.displayName="Input";const Oa=x.forwardRef(({accept:e,maxSize:t,onChange:r,onError:n,buttonText:o="Browse",placeholder:a="No file selected",className:s="",disabled:l,...f},g)=>{const c=x.useRef(null),i=g||c,[u,h]=x.useState(""),p=x.useCallback(()=>{!l&&i.current&&i.current.click()},[l,i]),y=x.useCallback(b=>{const L=b.target.files?.[0]||null;if(!L){h(""),r?.(null);return}if(t&&L.size>t*1024*1024){const S=`File size exceeds ${t}MB limit`;n?.(S),i.current&&(i.current.value=""),h("");return}h(L.name),r?.(L)},[t,r,n,i]),w=x.useCallback(b=>{b.stopPropagation(),i.current&&(i.current.value=""),h(""),r?.(null)},[r,i]);return d.jsxs(j,{className:`flex items-center gap-2 ${s}`,children:[d.jsx(vt,{ref:i,type:"file",accept:e,onChange:y,disabled:l,className:"hidden",...f}),d.jsx(Q,{type:"button",onClick:p,disabled:l,className:"px-4 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:o}),d.jsx(re,{className:"flex-1 text-sm text-gray-600 dark:text-gray-400 truncate",children:u||a}),u&&!l&&d.jsx(Q,{type:"button",onClick:w,className:"p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200","aria-label":"Clear file",children:d.jsx(cn,{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});Oa.displayName="FileInput";var Je=(e=>(e.User="fa-user",e.Users="fa-users",e.UserCircle="fa-user-circle",e.UserPlus="fa-user-plus",e.UserMinus="fa-user-minus",e.UserShield="fa-user-shield",e.Search="fa-search",e.Edit="fa-edit",e.Pencil="fa-pencil-alt",e.Trash="fa-trash",e.Save="fa-save",e.Plus="fa-plus",e.Minus="fa-minus",e.Check="fa-check",e.Times="fa-times",e.Download="fa-download",e.Upload="fa-upload",e.Copy="fa-copy",e.ExternalLink="fa-external-link-alt",e.Home="fa-home",e.ChevronLeft="fa-chevron-left",e.ChevronRight="fa-chevron-right",e.ChevronUp="fa-chevron-up",e.ChevronDown="fa-chevron-down",e.AngleLeft="fa-angle-left",e.AngleRight="fa-angle-right",e.AngleUp="fa-angle-up",e.AngleDown="fa-angle-down",e.ArrowUp="fa-arrow-up",e.ArrowDown="fa-arrow-down",e.ArrowLeft="fa-arrow-left",e.ArrowRight="fa-arrow-right",e.Bars="fa-bars",e.EllipsisVertical="fa-ellipsis-v",e.EllipsisHorizontal="fa-ellipsis-h",e.CheckCircle="fa-check-circle",e.TimesCircle="fa-times-circle",e.ExclamationCircle="fa-exclamation-circle",e.ExclamationTriangle="fa-exclamation-triangle",e.InfoCircle="fa-info-circle",e.QuestionCircle="fa-question-circle",e.XCircle="fa-times-circle",e.ShoppingCart="fa-shopping-cart",e.ShoppingBag="fa-shopping-bag",e.CreditCard="fa-credit-card",e.Tag="fa-tag",e.Tags="fa-tags",e.File="fa-file",e.FileAlt="fa-file-alt",e.Folder="fa-folder",e.FolderOpen="fa-folder-open",e.Envelope="fa-envelope",e.Phone="fa-phonLine truncated
|
||||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||||
${s==="auto"?"bg-gray-50 dark:bg-gray-700":""}
|
||||
`,children:[u.jsx(de,{name:nt.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),u.jsx(ne,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),s==="auto"&&u.jsx(de,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),u.jsxs(Q,{onClick:()=>i("light"),className:`
|
||||
`,children:[d.jsx(ue,{name:Je.Settings,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(re,{className:"flex-1 text-left text-gray-900 dark:text-white",children:r}),s==="auto"&&d.jsx(ue,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.jsxs(Q,{onClick:()=>i("light"),className:`
|
||||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||||
${s==="light"?"bg-gray-50 dark:bg-gray-700":""}
|
||||
`,children:[u.jsx(de,{name:nt.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),u.jsx(ne,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),s==="light"&&u.jsx(de,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),u.jsxs(Q,{onClick:()=>i("dark"),className:`
|
||||
`,children:[d.jsx(ue,{name:Je.Sun,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(re,{className:"flex-1 text-left text-gray-900 dark:text-white",children:n}),s==="light"&&d.jsx(ue,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]}),d.jsxs(Q,{onClick:()=>i("dark"),className:`
|
||||
w-full px-4 py-2 text-left hover:bg-gray-50 dark:hover:bg-gray-700 flex items-center gap-3 transition-colors
|
||||
${s==="dark"?"bg-gray-50 dark:bg-gray-700":""}
|
||||
`,children:[u.jsx(de,{name:nt.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),u.jsx(ne,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),s==="dark"&&u.jsx(de,{name:nt.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Dc=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:fn,default:fn},Symbol.toStringTag,{value:"Module"})),Ha={xs:"w-6 h-6 text-xs",sm:"w-8 h-8 text-sm",md:"w-10 h-10 text-base",lg:"w-12 h-12 text-lg",xl:"w-16 h-16 text-xl","2xl":"w-24 h-24 text-2xl","3xl":"w-32 h-32 text-3xl","4xl":"w-40 h-40 text-4xl","5xl":"w-48 h-48 text-5xl"},Ic="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",Pc="grayscale opacity-50",ro={normal:"bg-gradient-to-br from-blue-500 to-purple-600",withdrawn:"bg-gray-300 dark:bg-gray-600",guest:"bg-gray-200 dark:bg-gray-700"},Fr=({author:e,name:t,avatar:r,size:n="md",className:o="",text:a,isWithdrawn:s=!1,isGuest:l=!1})=>{const f=r??e?.avatar,g=a??t??e?.name??"?",c=s||e?.status==="withdrawn",i=l||e?.is_guest||!1,d=C.useMemo(()=>[Ha[n]||Ha.md,Ic,c?Pc:"",o].filter(Boolean).join(" "),[n,c,o]),h=i?ro.guest:c?ro.withdrawn:ro.normal,p=()=>i?u.jsx(B,{className:`w-full h-full flex items-center justify-center ${h}`,children:u.jsx(de,{name:"user",className:"text-gray-400 dark:text-gray-500"})}):c?u.jsx(B,{className:`w-full h-full flex items-center justify-center ${h}`,children:u.jsx(de,{name:"user",className:"text-gray-500 dark:text-gray-400"})}):u.jsx(B,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${h}`,children:g.charAt(0).toUpperCase()});return u.jsx(B,{className:d,children:f&&!i&&!c?u.jsx(Wt,{src:f,alt:g,className:"w-full h-full object-cover"}):p()})},Lc=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Fr},Symbol.toStringTag,{value:"Module"})),ot=(e,t)=>window.G7Core?.t?.(e,t)??e,gt=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ja=({logo:e,siteName:t="그누보드7",user:r,cartCount:n=0,notificationCount:o=0,boards:a=[],maxVisibleBoards:s=5,onMobileMenuOpen:l,availableLocales:f=[],currentLocale:g="ko",shopBase:c="/shop",className:i=""})=>{const[d,h]=C.useState(""),[p,y]=C.useState(!1),[x,m]=C.useState(!1),[D,_]=C.useState({top:0,left:0}),[T,P]=C.useState(window.location.pathname),S=C.useRef(null),N=C.useRef(null);C.useEffect(()=>{const w=()=>P(window.location.pathname);window.addEventListener("popstate",w);const k=history.pushState;return history.pushState=function(...z){k.apply(this,z),P(window.location.pathname)},()=>{window.removeEventListener("popstate",w),history.pushState=k}},[]);const b=(w,k=!1)=>k?T===w:T===w||T.startsWith(w+"/"),v=()=>{const w=c==="/"?"":c;return T.startsWith(`${w}/products`)||T.startsWith(`${w}/cart`)||T.startsWith(`${w}/checkout`)||T.startsWith(`${w}/category`)},M=w=>{const k="px-3 py-2 text-sm font-medium whitespace-nowrap cursor-pointer rounded-lg transition-colors";return w?`${k} bg-gray-900 text-white dark:bg-white dark:text-gray-900`:`${k} text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800`};C.useEffect(()=>{const w=k=>{S.current&&!S.current.contains(k.target)&&y(!1),N.current&&!N.current.contains(k.target)&&m(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]);const A=a.slice(0,s),F=a.slice(s),I=w=>{w.preventDefault(),d.trim()&>(`/search?q=${encodeURIComponent(d)}`)},L=async()=>{window.G7Core?.dispatch?.({handler:"logout"})},O=w=>{window.G7Core?.dispatch?.({handler:"setLocale",target:w}),y(!1)};return u.jsxs($a,{className:`sticky top-0 z-50 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-800 ${i}`,children:[u.jsx(B,{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:u.jsxs(B,{className:"flex items-center justify-between h-16",children:[u.jsx(Q,{onClick:()=>gt("/"),className:"flex items-center gap-2 flex-shrink-0 cursor-pointer",children:e?u.jsx(Wt,{src:e,alt:t,className:"h-8"}):u.jsx(ne,{className:"text-xl font-bold text-gray-900 dark:text-white",children:t})}),u.jsx(eo,{onSubmit:I,className:"hidden md:flex flex-1 max-w-lg mx-8",children:u.jsxs(B,{className:"relative w-full",children:[u.jsx(Dt,{type:"text",value:d,onChange:w=>h(w.target.value),placeholder:ot("common.search_placeholder"),className:"w-full px-4 py-2 pl-10 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),u.jsx(de,{name:"search",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500"})]})}),u.jsxs(B,{className:"flex items-center gap-2",children:[u.jsx(fn,{autoText:ot("common.theme.auto"),lightText:ot("common.theme.light"),darkText:ot("common.theme.dark")}),u.jsxs(Q,{onClick:()=>gt("/notifications"),className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hove
Line truncated
|
||||
`+vt),He&&hn([F,I,L],Qt=>{vt=$r(vt,Qt," ")}),T&&Ie?T.createHTML(vt):vt},t.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(ce),Ee=!0},t.clearConfig=function(){Be=null,Ee=!1},t.isValidAttribute=function(ce,H,q){Be||Ye({});const se=Oe(ce),We=Oe(H);return ic(se,We,q)},t.addHook=function(ce,H){typeof H=="function"&&Ur(A[ce],H)},t.removeHook=function(ce,H){if(H!==void 0){const q=Gc(A[ce],H);return q===-1?void 0:Wc(A[ce],q,1)[0]}return Va(A[ce])},t.removeHooks=function(ce){A[ce]=[]},t.removeAllHooks=function(){A=es()},t}var rs=ts();const ld=e=>window.G7Core?.state?.get?.(e),id=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},cd=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},ns=({product:e,onClick:t,shopBase:r="/shop",className:n=""})=>{const o=ld("preferredCurrency")||"KRW",a=x=>{const m=`multi_currency_${x}`,D=e[m];if(D&&D[o])return D[o].formatted;const _=`${x}_formatted`;return e[_]},s=e.name_localized??(typeof e.name=="string"?e.name:"")??"",l=a("selling_price"),f=a("list_price"),g=e.discount_rate&&e.discount_rate>0,c=e.sales_status&&e.sales_status!=="on_sale",i=e.labels??[],d=x=>rs.sanitize(x,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),h=e.name_highlighted,p=e.description_highlighted??e.short_description,y=()=>{t?t(e.id):id(`${r==="/"?"":r}/products/${e.id}`)};return u.jsxs(Q,{onClick:y,className:`block w-full text-left group bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden hover:shadow-lg transition-shadow cursor-pointer ${n}`,children:[u.jsxs(B,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[u.jsx(Wt,{src:e.thumbnail_url,alt:s,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200",loading:"lazy"}),c&&u.jsx(B,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:u.jsx(ne,{className:`text-lg font-bold ${e.sales_status==="sold_out"?"text-red-300":e.sales_status==="suspended"?"text-amber-300":"text-blue-300"}`,style:{textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e.sales_status_label??e.sales_status})}),g&&e.sales_status!=="sold_out"&&e.sales_status!=="suspended"&&u.jsxs(ne,{className:"absolute top-2 left-2 px-2 py-1 bg-red-500 text-white text-xs font-bold rounded",children:[e.discount_rate,"%"]}),i.length>0&&u.jsx(B,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:i.map((x,m)=>u.jsx(ne,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:x.color||"#6b7280"},children:x.name},m))})]}),u.jsxs(B,{className:"p-4",children:[u.jsxs(B,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&u.jsx(ne,{className:"inline-block text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-0.5 rounded",children:e.primary_category}),e.brand_name&&u.jsx(ne,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),h?u.jsx(B,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:d(h)}}):u.jsx(dn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:s}),p&&u.jsx(B,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400 line-clamp-2 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:d(p)}}),u.jsxs(B,{className:"mt-1.5 flex items-center gap-1",children:[cd(e.rating_avg??0).map((x,m)=>u.jsxs(ne,{className:`text-xs ${x==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[x==="full"&&u.jsx("i",{className:"fa-solid fa-star"}),x==="half"&&u.jsx("i",{className:"fa-solid fa-star-half-stroke"}),x==="empty"&&u.jsx("i",{className:"fa-regular fa-star"})]},m)),u.jsx(ne,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),u.jsxs(ne,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),u.jsxs(B,{className:"mt-2 flex items-baseline gap-2",children:[u.jsx(ne,{className:"font-bold text-gray-900 dark:text-white",children:l}),f&&g&&u.jsx(ne,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:f})]})]})]})},dd=Object.freeze(Object.defineProperty({__proto__:null,default:ns},Symbol.toStringTag,{value:"Module"})),os="carousel",Br="controller",ud="navigation",fd="no-scroll",ho="portal",hd="root",as="toolbar",gd="counter",Gr="fullscreen",ss="slideshow",Wr="thumbnails",ls="zoom",yr="loading",go="playing",Kr="error",Vr="complete",pd="placeholder",Yr=e=>`active-slide-${e}`,md=Yr(yr),bd=Yr(go),yd=Yr(Kr),vd=Yr(Vr),is="fullsize",vr="flex_center",wd="no_scroll",cs="no_scroll_padding",po="slide",ds="slide_wrapper",xd="slide_wrapper_interactive",Jt="prev",Rt="next",mo="swipe",wr="close",us="onPoint
Line truncated
|
||||
`,children:[d.jsx(ue,{name:Je.Moon,className:"w-5 h-5 text-gray-600 dark:text-gray-400"}),d.jsx(re,{className:"flex-1 text-left text-gray-900 dark:text-white",children:o}),s==="dark"&&d.jsx(ue,{name:Je.Check,className:"w-4 h-4 text-blue-600 dark:text-blue-400 ml-auto"})]})]})})]})},Ic=Object.freeze(Object.defineProperty({__proto__:null,ThemeToggle:fn,default:fn},Symbol.toStringTag,{value:"Module"})),Ba={xs:"w-6 h-6 text-xs",sm:"w-8 h-8 text-sm",md:"w-10 h-10 text-base",lg:"w-12 h-12 text-lg",xl:"w-16 h-16 text-xl","2xl":"w-24 h-24 text-2xl","3xl":"w-32 h-32 text-3xl","4xl":"w-40 h-40 text-4xl","5xl":"w-48 h-48 text-5xl"},Pc="rounded-full overflow-hidden flex-shrink-0 border border-gray-200 dark:border-gray-700",Lc="grayscale opacity-50",no={normal:"bg-gradient-to-br from-blue-500 to-purple-600",withdrawn:"bg-gray-300 dark:bg-gray-600",guest:"bg-gray-200 dark:bg-gray-700"},Fr=({author:e,name:t,avatar:r,size:n="md",className:o="",text:a,isWithdrawn:s=!1,isGuest:l=!1})=>{const f=r??e?.avatar,g=a??t??e?.name??"?",c=s||e?.status==="withdrawn",i=l||e?.is_guest||!1,u=x.useMemo(()=>[Ba[n]||Ba.md,Pc,c?Lc:"",o].filter(Boolean).join(" "),[n,c,o]),h=i?no.guest:c?no.withdrawn:no.normal,p=()=>i?d.jsx(j,{className:`w-full h-full flex items-center justify-center ${h}`,children:d.jsx(ue,{name:"user",className:"text-gray-400 dark:text-gray-500"})}):c?d.jsx(j,{className:`w-full h-full flex items-center justify-center ${h}`,children:d.jsx(ue,{name:"user",className:"text-gray-500 dark:text-gray-400"})}):d.jsx(j,{className:`w-full h-full flex items-center justify-center text-white font-semibold ${h}`,children:g.charAt(0).toUpperCase()});return d.jsx(j,{className:u,children:f&&!i&&!c?d.jsx(Wt,{src:f,alt:g,className:"w-full h-full object-cover"}):p()})},Fc=Object.freeze(Object.defineProperty({__proto__:null,Avatar:Fr},Symbol.toStringTag,{value:"Module"})),hn=({notifications:e=[],unreadCount:t=0,hasMore:r=!1,loading:n=!1,titleText:o="알림",emptyText:a="알림이 없습니다.",markAllReadText:s="모두 읽음",deleteAllText:l="모두 삭제",unreadOnlyText:f="안 읽은 알림만",unreadOnly:g=!1,onNotificationClick:c,onClose:i,onLoadMore:u,onMarkAllRead:h,onDeleteAll:p,onDelete:y,onUnreadOnlyToggle:w,dropdownAlign:b="right",className:L=""})=>{const[S,O]=x.useState(!1),F=x.useRef(null),E=x.useRef(null),T=x.useRef(null),m=x.useRef(new Set);x.useEffect(()=>{if(!T.current||!E.current||!r||n||!S)return;const P=new IntersectionObserver(([I])=>{I.isIntersecting&&u?.()},{root:E.current,threshold:.1});return P.observe(T.current),()=>P.disconnect()},[r,n,S,u,e.length]),x.useEffect(()=>{if(!E.current||!S)return;const P=new IntersectionObserver(M=>{M.forEach(A=>{const C=A.target.getAttribute("data-notification-id"),k=A.target.getAttribute("data-unread")==="true";C&&k&&A.isIntersecting&&m.current.add(C)})},{root:E.current,threshold:.5});return E.current.querySelectorAll("[data-notification-id]").forEach(M=>P.observe(M)),()=>P.disconnect()},[S,e]);const v=x.useCallback(()=>{if(S){const P=Array.from(m.current);P.length>0&&i?.(P),m.current.clear(),O(!1)}},[S,i]);x.useEffect(()=>{if(!S)return;const P=I=>{F.current&&!F.current.contains(I.target)&&v()};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[S,v]);const D=x.useCallback(()=>{S?v():O(!0)},[S,v]),N=t>0?t:e.filter(P=>!P.read).length;return d.jsxs(j,{ref:F,className:`relative ${L}`,children:[d.jsxs(Q,{onClick:D,className:"relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors cursor-pointer","aria-label":o,children:[d.jsx(ue,{name:Je.Bell,className:"w-5 h-5"}),N>0&&d.jsx(re,{className:"absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs font-bold text-white bg-red-500 rounded-full",children:N>99?"99+":N})]}),S&&d.jsxs(j,{className:`absolute ${b==="left"?"left-0":"right-0"} mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`,children:[d.jsxs(j,{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2",children:[d.jsxs(j,{className:"flex items-center gap-3 min-w-0",children:[d.jsx(re,{className:"font-semibold text-gray-900 dark:text-white",children:o}),w&&d.jsxs(j,{className:"flex items-center gap-1.5 cursor-pointer select-none",onClick:()=>w(!g),children:[d.jsx(vt,{type:"checkbox",checked:g,onChange:P=>{P.stopPropagation(),w(P.target.checked)},onClick:P=>P.stopPropagation(),className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 cursor-pointer"}),d.jsx(re,{className:"text-xs text-gray-600 dark:text-gray-400",children:f})]})]}),d.jsxs(j,{className:"flex items-center gap-3 flex-shrink-0",children:[h&&N>0&&d.jsx(Q,{onClick:()=>{h(),m.current.clear()},className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cu
Line truncated
|
||||
`+yt),He&&gn([P,I,M],Qt=>{yt=$r(yt,Qt," ")}),O&&Le?O.createHTML(yt):yt},t.setConfig=function(){let ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ze(ge),J=!0},t.clearConfig=function(){Ge=null,J=!1},t.isValidAttribute=function(ge,H,q){Ge||Ze({});const le=De(ge),Ve=De(H);return dc(le,Ve,q)},t.addHook=function(ge,H){typeof H=="function"&&Ur(N[ge],H)},t.removeHook=function(ge,H){if(H!==void 0){const q=Kc(N[ge],H);return q===-1?void 0:Vc(N[ge],q,1)[0]}return Xa(N[ge])},t.removeHooks=function(ge){N[ge]=[]},t.removeAllHooks=function(){N=rs()},t}var os=ns();const cd=e=>window.G7Core?.state?.get?.(e),dd=e=>{window.G7Core?.dispatch?.({handler:"navigate",params:{path:e}})},ud=e=>{const t=Math.round(e*2)/2;return[1,2,3,4,5].map(r=>t>=r?"full":t>=r-.5?"half":"empty")},as=({product:e,onClick:t,shopBase:r="/shop",className:n=""})=>{const o=cd("preferredCurrency")||"KRW",a=w=>{const b=`multi_currency_${w}`,L=e[b];if(L&&L[o])return L[o].formatted;const S=`${w}_formatted`;return e[S]},s=e.name_localized??(typeof e.name=="string"?e.name:"")??"",l=a("selling_price"),f=a("list_price"),g=e.discount_rate&&e.discount_rate>0,c=e.sales_status&&e.sales_status!=="on_sale",i=e.labels??[],u=w=>os.sanitize(w,{ALLOWED_TAGS:["mark"],ALLOWED_ATTR:[]}),h=e.name_highlighted,p=e.description_highlighted??e.short_description,y=()=>{t?t(e.id):dd(`${r==="/"?"":r}/products/${e.id}`)};return d.jsxs(Q,{onClick:y,className:`block w-full text-left group bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden hover:shadow-lg transition-shadow cursor-pointer ${n}`,children:[d.jsxs(j,{className:"relative aspect-square overflow-hidden bg-gray-100 dark:bg-gray-700",children:[d.jsx(Wt,{src:e.thumbnail_url,alt:s,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200",loading:"lazy"}),c&&d.jsx(j,{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:d.jsx(re,{className:`text-lg font-bold ${e.sales_status==="sold_out"?"text-red-300":e.sales_status==="suspended"?"text-amber-300":"text-blue-300"}`,style:{textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e.sales_status_label??e.sales_status})}),g&&e.sales_status!=="sold_out"&&e.sales_status!=="suspended"&&d.jsxs(re,{className:"absolute top-2 left-2 px-2 py-1 bg-red-500 text-white text-xs font-bold rounded",children:[e.discount_rate,"%"]}),i.length>0&&d.jsx(j,{className:"absolute bottom-2 right-2 flex gap-1 flex-wrap justify-end",children:i.map((w,b)=>d.jsx(re,{className:"text-xs text-white font-medium px-1.5 py-0.5 rounded",style:{backgroundColor:w.color||"#6b7280"},children:w.name},b))})]}),d.jsxs(j,{className:"p-4",children:[d.jsxs(j,{className:"flex items-center gap-1.5 flex-wrap",children:[e.primary_category&&d.jsx(re,{className:"inline-block text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-0.5 rounded",children:e.primary_category}),e.brand_name&&d.jsx(re,{className:"text-xs text-gray-500 dark:text-gray-400",children:e.brand_name})]}),h?d.jsx(j,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:u(h)}}):d.jsx(dn,{className:"mt-1 font-medium text-gray-900 dark:text-white line-clamp-1",children:s}),p&&d.jsx(j,{className:"mt-1 text-sm text-gray-600 dark:text-gray-400 line-clamp-2 [&_mark]:bg-yellow-200 [&_mark]:dark:bg-yellow-500/40 [&_mark]:px-0.5 [&_mark]:rounded",dangerouslySetInnerHTML:{__html:u(p)}}),d.jsxs(j,{className:"mt-1.5 flex items-center gap-1",children:[ud(e.rating_avg??0).map((w,b)=>d.jsxs(re,{className:`text-xs ${w==="empty"?"text-gray-300 dark:text-gray-600":"text-yellow-400"}`,children:[w==="full"&&d.jsx("i",{className:"fa-solid fa-star"}),w==="half"&&d.jsx("i",{className:"fa-solid fa-star-half-stroke"}),w==="empty"&&d.jsx("i",{className:"fa-regular fa-star"})]},b)),d.jsx(re,{className:"text-xs text-gray-600 dark:text-gray-400 ml-0.5",children:(e.rating_avg??0).toFixed(1)}),d.jsxs(re,{className:"text-xs text-gray-400 dark:text-gray-500",children:["(",e.review_count??0,")"]})]}),d.jsxs(j,{className:"mt-2 flex items-baseline gap-2",children:[d.jsx(re,{className:"font-bold text-gray-900 dark:text-white",children:l}),f&&g&&d.jsx(re,{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:f})]})]})]})},fd=Object.freeze(Object.defineProperty({__proto__:null,default:as},Symbol.toStringTag,{value:"Module"})),ss="carousel",Br="controller",hd="navigation",gd="no-scroll",go="portal",pd="root",ls="toolbar",md="counter",Gr="fullscreen",is="slideshow",Wr="thumbnails",cs="zoom",yr="loading",po="playing",Kr="error",Vr="complete",bd="placeholder",Yr=e=>`active-slide-${e}`,yd=Yr(yr),vd=Yr(po),wd=Yr(Kr),xd=Yr(Vr),ds="fullsize",vr="flex_center",kd="no_scroll",us="no_scroll_padding",mo="slide",fs="slide_wrapper",Cd="slide_wrapper_interactive",Rt="prev",er="next",bo="swipe",wr="close",hs="onPointer
Line truncated
|
||||
inline-flex items-center rounded-full border transition-colors
|
||||
${s[o]}
|
||||
${d?`${c.activeColor} border-transparent`:"border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}
|
||||
`,title:yl(c.labelKey),children:[u.jsx(ne,{className:l[o],children:c.emoji}),u.jsx(ne,{children:yl(c.labelKey)}),i>0&&u.jsx(ne,{className:"font-medium",children:i})]},c.type)})})},wf=Object.freeze(Object.defineProperty({__proto__:null,default:vl},Symbol.toStringTag,{value:"Module"})),En=window.G7Core?.createLogger?.("Comp:RichTextEditor")??{log:(...e)=>console.log("[Comp:RichTextEditor]",...e),warn:(...e)=>console.warn("[Comp:RichTextEditor]",...e),error:(...e)=>console.error("[Comp:RichTextEditor]",...e)},xt=(e,t)=>window.G7Core?.t?.(e,t)??e,wl=({name:e,initialValue:t="",placeholder:r,onChange:n,imageUploadUrl:o="/api/upload/image",minHeight:a="300px",disabled:s=!1,className:l=""})=>{const f=C.useRef(null),[g,c]=C.useState(t),[i,d]=C.useState(!1),[h,p]=C.useState(!1),[y,x]=C.useState("");C.useEffect(()=>{f.current&&!f.current.innerHTML&&(f.current.innerHTML=t)},[t]),C.useEffect(()=>{n&&n(g)},[g,n]);const m=b=>{En.log("Apply format:",b)},D=async b=>{const v=new FormData;v.append("file",b);try{const M=await fetch(o,{method:"POST",body:v,credentials:"include"});if(!M.ok)throw new Error("업로드 실패");const A=await M.json();En.log("Image uploaded:",A.url)}catch(M){En.error("이미지 업로드 오류:",M)}},_=b=>{const v=b.target.files?.[0];v&&D(v)},T=()=>{y&&(En.log("Insert link:",y),p(!1),x(""))},P=[{format:"bold",icon:"B",title:xt("editor.toolbar.bold")},{format:"italic",icon:"I",title:xt("editor.toolbar.italic")},{format:"underline",icon:"U",title:xt("editor.toolbar.underline")},{format:"strike",icon:"S",title:xt("editor.toolbar.strike")},{format:"code",icon:"</>",title:xt("editor.toolbar.code")}],S=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],N=[{format:"bulletList",icon:"•",title:xt("editor.toolbar.bullet_list")},{format:"orderedList",icon:"1.",title:xt("editor.toolbar.ordered_list")},{format:"blockquote",icon:"❝",title:xt("editor.toolbar.blockquote")}];return u.jsxs(B,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,children:[u.jsxs(B,{className:"flex flex-wrap items-center gap-1 p-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[u.jsx(B,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:P.map(b=>u.jsx(Q,{type:"button",onClick:()=>m(b.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:b.title,children:b.icon},b.format))}),u.jsx(B,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:S.map(b=>u.jsx(Q,{type:"button",onClick:()=>m(b.format),disabled:s,className:"px-2 h-8 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",children:b.label},b.format))}),u.jsx(B,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:N.map(b=>u.jsx(Q,{type:"button",onClick:()=>m(b.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:b.title,children:b.icon},b.format))}),u.jsxs(B,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[u.jsx(Q,{type:"button",onClick:()=>p(!0),disabled:s,className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:xt("editor.toolbar.link"),children:"🔗"}),u.jsxs(br,{className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer",children:["🖼",u.jsx(Dt,{type:"file",accept:"image/*",onChange:_,disabled:s,className:"hidden"})]})]}),u.jsxs(Q,{type:"button",onClick:()=>d(!i),disabled:s,className:`px-2 h-8 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50 ${i?"bg-gray-200 dark:bg-gray-700":""}`,children:["</>",xt("editor.toolbar.code_view")]})]}),i?u.jsx(Qn,{value:g,onChange:b=>c(b.target.value),placeholder:r,disabled:s,className:"w-full p-4 bg-gray-900 text-gray-100 font-mono text-sm focus:outline-none resize-none",style:{minHeight:a}}):u.jsx(B,{ref:f,contentEditable:!s,onInput:b=>c(b.currentTarget.innerHTML),className:"p-4 bg-white dark:bg-gray-900 text-gray-900 dark:text-white focus:outline-none prose dark:prose-invert max-w-none",style:{minHeight:a},"data-placeholder":r}),u.jsx(Dt,{type:"hidden",name:e,value:g}),h&&u.jsx(B,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:u.jsxs(B,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[u.jsx(dn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:xt("editor.link_modal.title")}),u.js
Line truncated
|
||||
${u?`${c.activeColor} border-transparent`:"border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}
|
||||
`,title:wl(c.labelKey),children:[d.jsx(re,{className:l[o],children:c.emoji}),d.jsx(re,{children:wl(c.labelKey)}),i>0&&d.jsx(re,{className:"font-medium",children:i})]},c.type)})})},kf=Object.freeze(Object.defineProperty({__proto__:null,default:xl},Symbol.toStringTag,{value:"Module"})),_n=window.G7Core?.createLogger?.("Comp:RichTextEditor")??{log:(...e)=>console.log("[Comp:RichTextEditor]",...e),warn:(...e)=>console.warn("[Comp:RichTextEditor]",...e),error:(...e)=>console.error("[Comp:RichTextEditor]",...e)},kt=(e,t)=>window.G7Core?.t?.(e,t)??e,kl=({name:e,initialValue:t="",placeholder:r,onChange:n,imageUploadUrl:o="/api/upload/image",minHeight:a="300px",disabled:s=!1,className:l=""})=>{const f=x.useRef(null),[g,c]=x.useState(t),[i,u]=x.useState(!1),[h,p]=x.useState(!1),[y,w]=x.useState("");x.useEffect(()=>{f.current&&!f.current.innerHTML&&(f.current.innerHTML=t)},[t]),x.useEffect(()=>{n&&n(g)},[g,n]);const b=m=>{_n.log("Apply format:",m)},L=async m=>{const v=new FormData;v.append("file",m);try{const D=await fetch(o,{method:"POST",body:v,credentials:"include"});if(!D.ok)throw new Error("업로드 실패");const N=await D.json();_n.log("Image uploaded:",N.url)}catch(D){_n.error("이미지 업로드 오류:",D)}},S=m=>{const v=m.target.files?.[0];v&&L(v)},O=()=>{y&&(_n.log("Insert link:",y),p(!1),w(""))},F=[{format:"bold",icon:"B",title:kt("editor.toolbar.bold")},{format:"italic",icon:"I",title:kt("editor.toolbar.italic")},{format:"underline",icon:"U",title:kt("editor.toolbar.underline")},{format:"strike",icon:"S",title:kt("editor.toolbar.strike")},{format:"code",icon:"</>",title:kt("editor.toolbar.code")}],E=[{format:"h1",label:"H1"},{format:"h2",label:"H2"},{format:"h3",label:"H3"}],T=[{format:"bulletList",icon:"•",title:kt("editor.toolbar.bullet_list")},{format:"orderedList",icon:"1.",title:kt("editor.toolbar.ordered_list")},{format:"blockquote",icon:"❝",title:kt("editor.toolbar.blockquote")}];return d.jsxs(j,{className:`border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden ${l}`,children:[d.jsxs(j,{className:"flex flex-wrap items-center gap-1 p-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:F.map(m=>d.jsx(Q,{type:"button",onClick:()=>b(m.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:m.title,children:m.icon},m.format))}),d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:E.map(m=>d.jsx(Q,{type:"button",onClick:()=>b(m.format),disabled:s,className:"px-2 h-8 text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",children:m.label},m.format))}),d.jsx(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:T.map(m=>d.jsx(Q,{type:"button",onClick:()=>b(m.format),disabled:s,className:"w-8 h-8 flex items-center justify-center text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:m.title,children:m.icon},m.format))}),d.jsxs(j,{className:"flex items-center gap-1 pr-2 border-r border-gray-200 dark:border-gray-700",children:[d.jsx(Q,{type:"button",onClick:()=>p(!0),disabled:s,className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50",title:kt("editor.toolbar.link"),children:"🔗"}),d.jsxs(br,{className:"w-8 h-8 flex items-center justify-center text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded cursor-pointer",children:["🖼",d.jsx(vt,{type:"file",accept:"image/*",onChange:S,disabled:s,className:"hidden"})]})]}),d.jsxs(Q,{type:"button",onClick:()=>u(!i),disabled:s,className:`px-2 h-8 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 rounded disabled:opacity-50 ${i?"bg-gray-200 dark:bg-gray-700":""}`,children:["</>",kt("editor.toolbar.code_view")]})]}),i?d.jsx(Jn,{value:g,onChange:m=>c(m.target.value),placeholder:r,disabled:s,className:"w-full p-4 bg-gray-900 text-gray-100 font-mono text-sm focus:outline-none resize-none",style:{minHeight:a}}):d.jsx(j,{ref:f,contentEditable:!s,onInput:m=>c(m.currentTarget.innerHTML),className:"p-4 bg-white dark:bg-gray-900 text-gray-900 dark:text-white focus:outline-none prose dark:prose-invert max-w-none",style:{minHeight:a},"data-placeholder":r}),d.jsx(vt,{type:"hidden",name:e,value:g}),h&&d.jsx(j,{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:d.jsxs(j,{className:"bg-white dark:bg-gray-800 rounded-lg p-6 w-96",children:[d.jsx(dn,{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:kt("editor.link_modal.title")}),d.js
Line truncated
|
||||
whitespace-pre-wrap
|
||||
text-gray-900 dark:text-gray-100
|
||||
font-sans
|
||||
${n}
|
||||
`.trim().replace(/\s+/g," ");return u.jsx(B,{className:g,children:a})}const s={ALLOWED_TAGS:["p","br","strong","em","u","s","strike","del","ins","mark","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","blockquote","code","pre","table","thead","tbody","tr","th","td","div","span"],ALLOWED_ATTR:["href","target","rel","title","alt","src","width","height","class","style","id","data-*"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"],SAFE_FOR_TEMPLATES:!0},l=C.useMemo(()=>{const g=o||s;return rs.sanitize(a,g).replace(/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,(i,d,h,p)=>(h.startsWith("http://")||h.startsWith("https://"))&&!i.includes("rel=")?`<a ${d}href="${h}"${p} rel="noopener noreferrer">`:i)},[a,o,s]),f=`
|
||||
`.trim().replace(/\s+/g," ");return d.jsx(j,{className:g,children:a})}const s={FORBID_TAGS:["script","noscript","iframe","frame","frameset","object","embed","applet","portal","form","input","textarea","select","button","style","link","meta","base","body","head","html","title","svg","math","audio","video","source","track","canvas","details","dialog","plaintext","xmp","listing","marquee","noframes","noembed","template","slot"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur","ontoggle","oncanplay","onloadstart","formaction","xlink:href","action"],ALLOW_DATA_ATTR:!0,ADD_ATTR:["target"]},l=x.useMemo(()=>{const g=o?{...s,...o,FORBID_TAGS:[...s.FORBID_TAGS,...o.FORBID_TAGS||[]],FORBID_ATTR:[...s.FORBID_ATTR,...o.FORBID_ATTR||[]]}:s;return os.sanitize(a,g).replace(/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,(i,u,h,p)=>(h.startsWith("http://")||h.startsWith("https://"))&&!i.includes("rel=")?`<a ${u}href="${h}"${p} rel="noopener noreferrer">`:i)},[a,o]),f=`
|
||||
prose dark:prose-invert max-w-none
|
||||
prose-p:my-2
|
||||
prose-headings:font-bold prose-headings:mt-6 prose-headings:mb-4
|
||||
prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg
|
||||
prose-a:text-blue-600 dark:prose-a:text-blue-400
|
||||
prose-a:no-underline hover:prose-a:underline
|
||||
prose-img:rounded-lg prose-img:shadow-md
|
||||
prose-blockquote:border-l-4 prose-blockquote:border-gray-300 dark:prose-blockquote:border-gray-600
|
||||
prose-blockquote:pl-4 prose-blockquote:italic
|
||||
prose-code:bg-gray-100 dark:prose-code:bg-gray-800
|
||||
prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
||||
prose-pre:bg-gray-100 dark:prose-pre:bg-gray-800
|
||||
prose-pre:p-4 prose-pre:rounded-lg prose-pre:overflow-x-auto
|
||||
prose-table:border prose-table:border-gray-300 dark:prose-table:border-gray-600
|
||||
prose-th:bg-gray-100 dark:prose-th:bg-gray-800
|
||||
prose-th:border prose-th:border-gray-300 dark:prose-th:border-gray-600
|
||||
prose-th:px-4 prose-th:py-2
|
||||
prose-td:border prose-td:border-gray-300 dark:prose-td:border-gray-600
|
||||
prose-td:px-4 prose-td:py-2
|
||||
[&_table]:w-full [&_table]:border-collapse [&_table]:border [&_table]:border-gray-300
|
||||
dark:[&_table]:border-gray-600
|
||||
[&_th]:border [&_th]:border-gray-300 [&_th]:px-4 [&_th]:py-2 [&_th]:bg-gray-100 [&_th]:text-left
|
||||
dark:[&_th]:border-gray-600 dark:[&_th]:bg-gray-800
|
||||
[&_td]:border [&_td]:border-gray-300 [&_td]:px-4 [&_td]:py-2
|
||||
dark:[&_td]:border-gray-600
|
||||
[&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50
|
||||
after:content-[''] after:block after:clear-both
|
||||
${n}
|
||||
`.trim().replace(/\s+/g," ");return u.jsx(B,{className:f,dangerouslySetInnerHTML:{__html:l}})},kf=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:jo},Symbol.toStringTag,{value:"Module"})),Bo=()=>window.G7Core,Go=(e,t)=>Bo()?.t?.(e,t)??e,xl=({content:e="",onChange:t,isHtml:r=!1,onIsHtmlChange:n,rows:o=15,placeholder:a="",label:s,showHtmlModeToggle:l=!0,contentClassName:f="",purifyConfig:g,className:c="",name:i="content",htmlFieldName:d="content_mode",readOnly:h=!1})=>{const[p,y]=C.useState(r),[x,m]=C.useState(e),[D,_]=C.useState(!1);C.useEffect(()=>{y(r)},[r]),C.useEffect(()=>{m(e)},[e]);const T=C.useCallback(N=>{const b=N.target.value;if(m(b),t){const v=Bo()?.createChangeEvent?.({value:b,name:i,type:"textarea"})??{target:{name:i,value:b}};t(v)}},[t,i]),P=C.useCallback(N=>{const b=N.target.checked;if(y(b),b||_(!1),n){const v=Bo()?.createChangeEvent?.({checked:b,name:d,type:"checkbox"})??{target:{name:d,checked:b}};n(v)}},[n,d]),S=C.useCallback(()=>{_(N=>!N)},[]);return u.jsxs(B,{className:`space-y-2 ${c}`,children:[u.jsxs(B,{className:"flex items-center justify-between",children:[s&&u.jsx(br,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),u.jsxs(B,{className:"flex items-center gap-3",children:[p&&!h&&u.jsx(Q,{type:"button",onClick:S,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${D?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:Go(D?"common.preview_off":"common.preview")}),l&&u.jsxs(br,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[u.jsx(Dt,{type:"checkbox",name:d,checked:p,onChange:P,disabled:h,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),u.jsx(B,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Go("common.html_mode")})]})]})]}),!D&&u.jsx(Qn,{name:i,value:x,onChange:T,placeholder:a,rows:o,readOnly:h,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${p?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`}),D&&u.jsx(B,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:u.jsx(jo,{content:x,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:g})})]})},Cf=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:xl},Symbol.toStringTag,{value:"Module"})),kl=e=>window.G7Core?.t?.(e)??e,Wo=({maxHeight:e=500,expandText:t,collapseText:r,className:n="",children:o})=>{const[a,s]=C.useState(!1),[l,f]=C.useState(!1),g=C.useRef(null),c=C.useCallback(()=>{if(g.current){const p=g.current.scrollHeight;f(p>e)}},[e]);C.useEffect(()=>{c();const p=g.current;if(!p)return;const y=p.querySelectorAll("img");y.forEach(m=>{m.complete||m.addEventListener("load",c)});let x=null;return typeof ResizeObserver<"u"&&(x=new ResizeObserver(c),x.observe(p)),()=>{y.forEach(m=>{m.removeEventListener("load",c)}),x?.disconnect()}},[c,o]);const i=()=>{s(p=>!p)},d=t||kl("sirsoft-ecommerce.shop.product.expand_detail"),h=r||kl("sirsoft-ecommerce.shop.product.collapse_detail");return u.jsxs(B,{className:n,children:[u.jsxs(B,{className:"relative",children:[u.jsx(B,{ref:g,className:!a&&l?"overflow-hidden transition-[max-height] duration-300 ease-in-out":"transition-[max-height] duration-300 ease-in-out",style:!a&&l?{maxHeight:`${e}px`}:void 0,children:o}),!a&&l&&u.jsx(B,{className:"absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-white dark:from-gray-900 to-transparent pointer-events-none"})]}),l&&u.jsxs(Q,{type:"button",onClick:i,className:"flex items-center justify-center w-full py-3.5 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors cursor-pointer gap-1.5",children:[u.jsx(ne,{className:"text-sm font-semibold text-gray-600 dark:text-gray-400",children:a?h:d}),u.jsx(de,{name:a?"chevron-up":"chevron-down",size:"sm"})]})]})},Sf=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:Wo,default:Wo},Symbol.toStringTag,{value:"Module"})),Ef=(e,t)=>window.G7Core?.t?.(e,t)??e,Ko=({isOpen:e,onClose:t,title:r,icon:n,iconClassName:o="text-gray-5
Line truncated
|
||||
`.trim().replace(/\s+/g," ");return d.jsx(j,{className:f,dangerouslySetInnerHTML:{__html:l}})},Sf=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:Bo},Symbol.toStringTag,{value:"Module"})),Go=()=>window.G7Core,Wo=(e,t)=>Go()?.t?.(e,t)??e,Cl=({content:e="",onChange:t,isHtml:r=!1,onIsHtmlChange:n,rows:o=15,placeholder:a="",label:s,showHtmlModeToggle:l=!0,contentClassName:f="",purifyConfig:g,className:c="",name:i="content",htmlFieldName:u="content_mode",readOnly:h=!1})=>{const[p,y]=x.useState(r),[w,b]=x.useState(e),[L,S]=x.useState(!1);x.useEffect(()=>{y(r)},[r]),x.useEffect(()=>{b(e)},[e]);const O=x.useCallback(T=>{const m=T.target.value;if(b(m),t){const v=Go()?.createChangeEvent?.({value:m,name:i,type:"textarea"})??{target:{name:i,value:m}};t(v)}},[t,i]),F=x.useCallback(T=>{const m=T.target.checked;if(y(m),m||S(!1),n){const v=Go()?.createChangeEvent?.({checked:m,name:u,type:"checkbox"})??{target:{name:u,checked:m}};n(v)}},[n,u]),E=x.useCallback(()=>{S(T=>!T)},[]);return d.jsxs(j,{className:`space-y-2 ${c}`,children:[d.jsxs(j,{className:"flex items-center justify-between",children:[s&&d.jsx(br,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),d.jsxs(j,{className:"flex items-center gap-3",children:[p&&!h&&d.jsx(Q,{type:"button",onClick:E,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${L?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:Wo(L?"common.preview_off":"common.preview")}),l&&d.jsxs(br,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[d.jsx(vt,{type:"checkbox",name:u,checked:p,onChange:F,disabled:h,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),d.jsx(j,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:Wo("common.html_mode")})]})]})]}),!L&&d.jsx(Jn,{name:i,value:w,onChange:O,placeholder:a,rows:o,readOnly:h,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${p?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`}),L&&d.jsx(j,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:d.jsx(Bo,{content:w,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:g})})]})},Ef=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:Cl},Symbol.toStringTag,{value:"Module"})),Sl=e=>window.G7Core?.t?.(e)??e,Ko=({maxHeight:e=500,expandText:t,collapseText:r,className:n="",children:o})=>{const[a,s]=x.useState(!1),[l,f]=x.useState(!1),g=x.useRef(null),c=x.useCallback(()=>{if(g.current){const p=g.current.scrollHeight;f(p>e)}},[e]);x.useEffect(()=>{c();const p=g.current;if(!p)return;const y=p.querySelectorAll("img");y.forEach(b=>{b.complete||b.addEventListener("load",c)});let w=null;return typeof ResizeObserver<"u"&&(w=new ResizeObserver(c),w.observe(p)),()=>{y.forEach(b=>{b.removeEventListener("load",c)}),w?.disconnect()}},[c,o]);const i=()=>{s(p=>!p)},u=t||Sl("sirsoft-ecommerce.shop.product.expand_detail"),h=r||Sl("sirsoft-ecommerce.shop.product.collapse_detail");return d.jsxs(j,{className:n,children:[d.jsxs(j,{className:"relative",children:[d.jsx(j,{ref:g,className:!a&&l?"overflow-hidden transition-[max-height] duration-300 ease-in-out":"transition-[max-height] duration-300 ease-in-out",style:!a&&l?{maxHeight:`${e}px`}:void 0,children:o}),!a&&l&&d.jsx(j,{className:"absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-white dark:from-gray-900 to-transparent pointer-events-none"})]}),l&&d.jsxs(Q,{type:"button",onClick:i,className:"flex items-center justify-center w-full py-3.5 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors cursor-pointer gap-1.5",children:[d.jsx(re,{className:"text-sm font-semibold text-gray-600 dark:text-gray-400",children:a?h:u}),d.jsx(ue,{name:a?"chevron-up":"chevron-down",size:"sm"})]})]})},_f=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:Ko,default:Ko},Symbol.toStringTag,{value:"Module"})),Tf=(e,t)=>window.G7Core?.t?.(e,t)??e,Vo=({isOpen:e,onClose:t,title:r,icon:n,iconClassName:o="text-gray-5
Line truncated
|
||||
let scriptImported = false
|
||||
self.addEventListener('message', async (e) => {
|
||||
const { file, id, imageCompressionLibUrl, options } = e.data
|
||||
@@ -57,20 +58,20 @@ self.addEventListener('message', async (e) => {
|
||||
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
||||
}
|
||||
})
|
||||
`;let qo;function Ff(e,t){return new Promise(((r,n)=>{qo||(qo=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(Lf));const o=new Worker(qo);o.addEventListener("message",(function(s){if(t.signal&&t.signal.aborted)o.terminate();else if(s.data.progress===void 0){if(s.data.error)return n(new Error(s.data.error)),void o.terminate();r(s.data.file),o.terminate()}else t.onProgress(s.data.progress)})),o.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",(()=>{n(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function it(e,t){return new Promise((function(r,n){let o,a,s,l,f,g;if(o={...t},s=0,{onProgress:l}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,f=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=h=>{s=h,typeof l=="function"&&l(s)},!(e instanceof Blob||e instanceof Pf))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(g=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!f||typeof Worker!="function"||g)return Fl(e,o).then(function(h){try{return a=h,d.call(this)}catch(p){return n(p)}}.bind(this),n);var c=function(){try{return d.call(this)}catch(h){return n(h)}}.bind(this),i=function(h){try{return Fl(e,o).then((function(p){try{return a=p,c()}catch(y){return n(y)}}),n)}catch(p){return n(p)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ff(e,o).then((function(h){try{return a=h,c()}catch{return i()}}),i)}catch{i()}function d(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(a=El(e,a))}catch{}return r(a)}}))}it.getDataUrlFromFile=Al,it.getFilefromDataUrl=Zo,it.loadImage=Ml,it.drawImageInCanvas=Dl,it.drawFileInCanvas=Mn,it.canvasToFile=On,it.getExifOrientation=Il,it.handleMaxWidthOrHeight=Pl,it.followExifOrientation=Ll,it.cleanupCanvasMemory=Vt,it.isAutoOrientationInBrowser=Tr,it.approximateBelowMaximumCanvasSizeOfBrowser=Ol,it.copyExifWithoutOrientation=El,it.getBrowserName=ur,it.version="2.0.2";const Uf=window.G7Core,Dn=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(2)} ${t[r]}`},Ul=e=>{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const r=Object.values(t.response.data.errors)[0];if(Array.isArray(r)&&r[0])return r[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},$l=e=>e?e.startsWith("image/")?"fa-file-image":e.startsWith("video/")?"fa-file-video":e.startsWith("audio/")?"fa-file-audio":e==="application/pdf"?"fa-file-pdf":e.includes("word")||e.includes("document")?"fa-file-word":e.includes("excel")||e.includes("spreadsheet")?"fa-file-excel":e.includes("zip")||e.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",et=(e,t)=>Uf?.t?.(e,t)??e,fr=window.G7Core;function zl(e){const{attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:g,autoUpload:c,initialFiles:i,endpoints:d,onFilesChange:h,onUploadComplete:p,onUploadError:y,onRemove:x,onReorder:m,uploadTriggerEvent:D,confirmBeforeRemove:_,uploadParams:T}=e,[P,S]=C.useState(i),[N,b]=C.useState([]),[v,M]=C.useState(!1),A=C.useRef(null),F=C.useRef(0),I=C.useRef(new Set),L=C.useRef(new Map),[O,w]=C.useState(!1),[k,z]=C.useState(null),[U,G]=C.useState(!1),V=C.useRef(!1),[$,W]=C.useState([]),K=C.useRef(i),[j,Z]=C.useState(!1),[me,ue]=C.useState(0),fe=C.useRef(0),[ee,Ne]=C.useState(new Map);C.useEffect(()=>{h?.(N)},[N,h]);const Ce=C.useMemo(()=>{const X=K.current;return X===i?X:X.length!==i.length?(K.current=i,i):X.length===0&&i.length===0?X:i.some((re,ae)=>re.id!==X[ae]?.id)?(K.current=i,i):X},[i]);C.useEffect(()=>{if(V.current)return;const X=Ce.filter(ae=>!I.current.has(ae.id)&&(!ae.hash||!I.current.has(ae.hash))),R=new Set(X.map(ae=>ae.id)),re=Array.from(L.current.values()).filter(ae=>!R.has(ae.id)&&!I.current.has(ae.id));S([...X,...re])},[Ce]);const He=C.useCallback(async X=>{const R={maxSizeMB:f?.maxSizeMB??1,maxWidthOrHeight:f?.maxWidthOrHeight??1920,useWebWorker:!0};return await it(X,R)},[f]),$e=C.useCallback(async X=>{const R=P.length+N.length,re=o-R,ae=Array.from(X).slice(0,re);for(const ie of ae){if(ie.size>a*1024*1024){y?.(`[${ie.name}] 파일 크기(${Dn(ie.size)})가 최대 허용 크기(${a}MB)를 초과합니다.`,ie);continue}if(l){const ge="."+ie.name.split(".").pop()?.toLowerCase();if(!l.split(",").map(ze=>ze.trim().toLowerCase()).some(ze=>{if(ze.includes("/")){if(ze.endsWith("/*")){const Le=ze.slice(0,-2);return ie.type.toLowerCase().startsWith(Le+"/")}return ie.type.toLowerCase()===ze}return ge===ze})){y?.(`[${ie.name}] 허용되지Line truncated
|
||||
`;let Qo;function $f(e,t){return new Promise(((r,n)=>{Qo||(Qo=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(Uf));const o=new Worker(Qo);o.addEventListener("message",(function(s){if(t.signal&&t.signal.aborted)o.terminate();else if(s.data.progress===void 0){if(s.data.error)return n(new Error(s.data.error)),void o.terminate();r(s.data.file),o.terminate()}else t.onProgress(s.data.progress)})),o.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",(()=>{n(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function it(e,t){return new Promise((function(r,n){let o,a,s,l,f,g;if(o={...t},s=0,{onProgress:l}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,f=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=h=>{s=h,typeof l=="function"&&l(s)},!(e instanceof Blob||e instanceof Ff))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(g=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!f||typeof Worker!="function"||g)return $l(e,o).then(function(h){try{return a=h,u.call(this)}catch(p){return n(p)}}.bind(this),n);var c=function(){try{return u.call(this)}catch(h){return n(h)}}.bind(this),i=function(h){try{return $l(e,o).then((function(p){try{return a=p,c()}catch(y){return n(y)}}),n)}catch(p){return n(p)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",$f(e,o).then((function(h){try{return a=h,c()}catch{return i()}}),i)}catch{i()}function u(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(a=Tl(e,a))}catch{}return r(a)}}))}it.getDataUrlFromFile=Ol,it.getFilefromDataUrl=qo,it.loadImage=Dl,it.drawImageInCanvas=Pl,it.drawFileInCanvas=On,it.canvasToFile=Dn,it.getExifOrientation=Ll,it.handleMaxWidthOrHeight=Fl,it.followExifOrientation=Ul,it.cleanupCanvasMemory=Vt,it.isAutoOrientationInBrowser=Tr,it.approximateBelowMaximumCanvasSizeOfBrowser=Il,it.copyExifWithoutOrientation=Tl,it.getBrowserName=ur,it.version="2.0.2";const zf=window.G7Core,In=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(2)} ${t[r]}`},zl=e=>{if(e&&typeof e=="object"){const t=e;if(t.response?.data?.message)return t.response.data.message;if(t.response?.data?.errors){const r=Object.values(t.response.data.errors)[0];if(Array.isArray(r)&&r[0])return r[0]}if(t.message)return t.message}return e instanceof Error?e.message:"업로드 실패"},Hl=e=>e?e.startsWith("image/")?"fa-file-image":e.startsWith("video/")?"fa-file-video":e.startsWith("audio/")?"fa-file-audio":e==="application/pdf"?"fa-file-pdf":e.includes("word")||e.includes("document")?"fa-file-word":e.includes("excel")||e.includes("spreadsheet")?"fa-file-excel":e.includes("zip")||e.includes("compressed")?"fa-file-zipper":"fa-file":"fa-file",nt=(e,t)=>zf?.t?.(e,t)??e,fr=window.G7Core;function jl(e){const{attachmentableType:t,attachmentableId:r,collection:n,maxFiles:o,maxSize:a,maxConcurrentUploads:s,accept:l,imageCompression:f,roleIds:g,autoUpload:c,initialFiles:i,endpoints:u,onFilesChange:h,onUploadComplete:p,onUploadError:y,onRemove:w,onReorder:b,uploadTriggerEvent:L,confirmBeforeRemove:S,uploadParams:O}=e,[F,E]=x.useState(i),[T,m]=x.useState([]),[v,D]=x.useState(!1),N=x.useRef(null),P=x.useRef(0),I=x.useRef(new Set),M=x.useRef(new Map),[A,C]=x.useState(!1),[k,z]=x.useState(null),[$,G]=x.useState(!1),V=x.useRef(!1),[U,W]=x.useState([]),K=x.useRef(i),[B,Z]=x.useState(!1),[pe,ie]=x.useState(0),fe=x.useRef(0),[ee,_e]=x.useState(new Map),ye=x.useRef(new Map);x.useEffect(()=>{h?.(T)},[T,h]);const He=x.useMemo(()=>{const X=K.current;return X===i?X:X.length!==i.length?(K.current=i,i):X.length===0&&i.length===0?X:i.some((ce,se)=>ce.id!==X[se]?.id)?(K.current=i,i):X},[i]);x.useEffect(()=>{if(V.current)return;const X=He.filter(se=>!I.current.has(se.id)&&(!se.hash||!I.current.has(se.hash))),ne=new Set(X.map(se=>se.id)),ce=Array.from(M.current.values()).filter(se=>!ne.has(se.id)&&!I.current.has(se.id));E([...X,...ce])},[He]);const Fe=x.useCallback(async X=>{const ne={maxSizeMB:f?.maxSizeMB??1,maxWidthOrHeight:f?.maxWidthOrHeight??1920,useWebWorker:!0};return await it(X,ne)},[f]),ve=x.useCallback(async X=>{const ne=F.length+T.length,ce=o-ne,se=Array.from(X).slice(0,ce);for(const oe of se){if(oe.size>a*1024*1024){y?.(`[${oe.name}] 파일 크기(${In(oe.size)})가 최대 허용 크기(${a}MB)를 초과합니다.`,oe);continue}if(l){const we="."+oe.name.split(".").pop()?.toLowerCase();if(!l.split(",").map(Ie=>Ie.trim().toLowerCase()).some(Ie=>{if(Ie.includes("/")){if(Ie.endsWith("/*")){const Be=Ie.slice(0,-2);return oe.type.toLowerCase().startsWith(Be+"/")}return oe.type.toLowerCase()===Ie}return we===Ie})){y?.
Line truncated
|
||||
relative border-2 border-dashed rounded-lg transition-colors
|
||||
${e?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600"}
|
||||
`,onDragOver:g=>{g.preventDefault(),t&&n(!0)},onDragLeave:()=>n(!1),onDrop:g=>{g.preventDefault(),n(!1),t&&r(g.dataTransfer.files)},children:[u.jsx("input",{ref:o,type:"file",multiple:!0,accept:a,onChange:g=>g.target.files&&r(g.target.files),className:"hidden"}),!f&&u.jsxs(B,{className:"p-8 text-center cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:()=>o.current?.click(),children:[u.jsx(Mt,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),u.jsx(It,{className:"text-sm text-gray-600 dark:text-gray-400",children:et("attachment.drop_or_click")}),u.jsxs(It,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[et("attachment.upload_limit",{maxFiles:s,maxSize:l}),a&&` (${a})`]})]}),f]});function $f(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return C.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const In=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Qo(e){return"nodeType"in e}function bt(e){var t,r;return e?Nr(e)?e:Qo(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Jo(e){const{Document:t}=bt(e);return e instanceof t}function Zr(e){return Nr(e)?!1:e instanceof bt(e).HTMLElement}function jl(e){return e instanceof bt(e).SVGElement}function Ar(e){return e?Nr(e)?e.document:Qo(e)?Jo(e)?e:Zr(e)||jl(e)?e.ownerDocument:document:document:document}const Yt=In?C.useLayoutEffect:C.useEffect;function Ro(e){const t=C.useRef(e);return Yt(()=>{t.current=e}),C.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function zf(){const e=C.useRef(null),t=C.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=C.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function qr(e,t){t===void 0&&(t=[e]);const r=C.useRef(e);return Yt(()=>{r.current!==e&&(r.current=e)},t),r}function Qr(e,t){const r=C.useRef();return C.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Pn(e){const t=Ro(e),r=C.useRef(null),n=C.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function ea(e){const t=C.useRef();return C.useEffect(()=>{t.current=e},[e]),t.current}let ta={};function Jr(e,t){return C.useMemo(()=>{if(t)return t;const r=ta[e]==null?0:ta[e]+1;return ta[e]=r,e+"-"+r},[e,t])}function Bl(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const l=Object.entries(s);for(const[f,g]of l){const c=a[f];c!=null&&(a[f]=c+e*g)}return a},{...t})}}const Mr=Bl(1),Rr=Bl(-1);function Hf(e){return"clientX"in e&&"clientY"in e}function ra(e){if(!e)return!1;const{KeyboardEvent:t}=bt(e.target);return t&&e instanceof t}function jf(e){if(!e)return!1;const{TouchEvent:t}=bt(e.target);return t&&e instanceof t}function na(e){if(jf(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Hf(e)?{x:e.clientX,y:e.clientY}:null}const en=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[en.Translate.toString(e),en.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Gl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bf(e){return e.matches(Gl)?e:e.querySelector(Gl)}const Gf={display:"none"};function Wf(e){let{id:t,value:r}=e;return C.createElement("div",{id:t,style:Gf},r)}function Kf(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Vf(){const[e,t]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Wl=C.createContext(null);function Yf(e){const t=C.useContext(Wl);C.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Xf(){const[e]=C.useState(()=>new Set),t=C.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[C.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const Zf={draggable:`
|
||||
`,onDragOver:g=>{g.preventDefault(),t&&n(!0)},onDragLeave:()=>n(!1),onDrop:g=>{g.preventDefault(),n(!1),t&&r(g.dataTransfer.files)},children:[d.jsx("input",{ref:o,type:"file",multiple:!0,accept:a,onChange:g=>g.target.files&&r(g.target.files),className:"hidden"}),!f&&d.jsxs(j,{className:"p-8 text-center cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",onClick:()=>o.current?.click(),children:[d.jsx(Ot,{className:"fa-solid fa-cloud-arrow-up text-4xl text-gray-400 dark:text-gray-500 mb-4"}),d.jsx(It,{className:"text-sm text-gray-600 dark:text-gray-400",children:nt("attachment.drop_or_click")}),d.jsxs(It,{className:"text-xs text-gray-500 dark:text-gray-500 mt-2",children:[nt("attachment.upload_limit",{maxFiles:s,maxSize:l}),a&&` (${a})`]})]}),f]});function Hf(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return x.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Pn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nr(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Jo(e){return"nodeType"in e}function mt(e){var t,r;return e?Nr(e)?e:Jo(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Ro(e){const{Document:t}=mt(e);return e instanceof t}function Zr(e){return Nr(e)?!1:e instanceof mt(e).HTMLElement}function Gl(e){return e instanceof mt(e).SVGElement}function Ar(e){return e?Nr(e)?e.document:Jo(e)?Ro(e)?e:Zr(e)||Gl(e)?e.ownerDocument:document:document:document}const Yt=Pn?x.useLayoutEffect:x.useEffect;function ea(e){const t=x.useRef(e);return Yt(()=>{t.current=e}),x.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function jf(){const e=x.useRef(null),t=x.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function qr(e,t){t===void 0&&(t=[e]);const r=x.useRef(e);return Yt(()=>{r.current!==e&&(r.current=e)},t),r}function Qr(e,t){const r=x.useRef();return x.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function Ln(e){const t=ea(e),r=x.useRef(null),n=x.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function ta(e){const t=x.useRef();return x.useEffect(()=>{t.current=e},[e]),t.current}let ra={};function Jr(e,t){return x.useMemo(()=>{if(t)return t;const r=ra[e]==null?0:ra[e]+1;return ra[e]=r,e+"-"+r},[e,t])}function Wl(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const l=Object.entries(s);for(const[f,g]of l){const c=a[f];c!=null&&(a[f]=c+e*g)}return a},{...t})}}const Mr=Wl(1),Rr=Wl(-1);function Bf(e){return"clientX"in e&&"clientY"in e}function na(e){if(!e)return!1;const{KeyboardEvent:t}=mt(e.target);return t&&e instanceof t}function Gf(e){if(!e)return!1;const{TouchEvent:t}=mt(e.target);return t&&e instanceof t}function oa(e){if(Gf(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Bf(e)?{x:e.clientX,y:e.clientY}:null}const en=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[en.Translate.toString(e),en.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Kl="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Wf(e){return e.matches(Kl)?e:e.querySelector(Kl)}const Kf={display:"none"};function Vf(e){let{id:t,value:r}=e;return x.createElement("div",{id:t,style:Kf},r)}function Yf(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return x.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Xf(){const[e,t]=x.useState("");return{announce:x.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Vl=x.createContext(null);function Zf(e){const t=x.useContext(Vl);x.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function qf(){const[e]=x.useState(()=>new Set),t=x.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[x.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const Qf={draggable:`
|
||||
To pick up a draggable item, press the space bar.
|
||||
While dragging, use the arrow keys to move the item.
|
||||
Press space again to drop the item in its new position, or press escape to cancel.
|
||||
`},qf={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Qf(e){let{announcements:t=qf,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Zf}=e;const{announce:a,announcement:s}=Vf(),l=Jr("DndLiveRegion"),[f,g]=C.useState(!1);if(C.useEffect(()=>{g(!0)},[]),Yf(C.useMemo(()=>({onDragStart(i){let{active:d}=i;a(t.onDragStart({active:d}))},onDragMove(i){let{active:d,over:h}=i;t.onDragMove&&a(t.onDragMove({active:d,over:h}))},onDragOver(i){let{active:d,over:h}=i;a(t.onDragOver({active:d,over:h}))},onDragEnd(i){let{active:d,over:h}=i;a(t.onDragEnd({active:d,over:h}))},onDragCancel(i){let{active:d,over:h}=i;a(t.onDragCancel({active:d,over:h}))}}),[a,t])),!f)return null;const c=C.createElement(C.Fragment,null,C.createElement(Wf,{id:n,value:o.draggable}),C.createElement(Kf,{id:l,announcement:s}));return r?rr.createPortal(c,r):c}var qe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(qe||(qe={}));function Ln(){}function Kl(e,t){return C.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Jf(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return C.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Ht=Object.freeze({x:0,y:0});function Vl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Yl(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Rf(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Xl(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function Zl(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function ql(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const eh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=ql(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const g=Vl(ql(f),o);a.push({id:l,data:{droppableContainer:s,value:g}})}}return a.sort(Yl)},th=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=Xl(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const g=Xl(f),c=o.reduce((d,h,p)=>d+Vl(g[p],h),0),i=Number((c/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(Yl)};function rh(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,l=a-r;if(n<o&&r<a){const f=t.width*t.height,g=e.width*e.height,c=s*l,i=c/(f+g-c);return Number(i.toFixed(4))}return 0}const nh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,l=r.get(s);if(l){const f=rh(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(Rf)};function oh(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Ql(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ht}function ah(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...r})}}const sh=ah(1);function lh(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function ih(e,t,r){const n=lh(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:l}=n,f=e.left-s-(1-o)*parseFloat(r),g=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?e.width/o:e.width,i=a?e.height/a:e.height;return{width:c,height:i,top:g,right:f+c,bottom:g+i,left:f}}const ch={ignoreTransform:!1};function Or(e,t){t===void 0&&(t=ch);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:g,transformOrigin:c}=bt(e).getComputedStyle(e);g&&(r=ih(r,g,c))}const{top:n,left:o,width:a,height:s,bottom:l,right:f}=r;return{top:n,left:o,width:a,height:s,bottom:l,right:f}}function Jl(e){return Or(e,{ignoreTransform:!0})}function dh(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function uh(e,t){return t===void 0&&(t=bt(e).getComputedStyle(e)),t.position==="fixed"}function fh(e,t){t===void 0&&(t=bt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","o
Line truncated
|
||||
`},Jf={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Rf(e){let{announcements:t=Jf,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Qf}=e;const{announce:a,announcement:s}=Xf(),l=Jr("DndLiveRegion"),[f,g]=x.useState(!1);if(x.useEffect(()=>{g(!0)},[]),Zf(x.useMemo(()=>({onDragStart(i){let{active:u}=i;a(t.onDragStart({active:u}))},onDragMove(i){let{active:u,over:h}=i;t.onDragMove&&a(t.onDragMove({active:u,over:h}))},onDragOver(i){let{active:u,over:h}=i;a(t.onDragOver({active:u,over:h}))},onDragEnd(i){let{active:u,over:h}=i;a(t.onDragEnd({active:u,over:h}))},onDragCancel(i){let{active:u,over:h}=i;a(t.onDragCancel({active:u,over:h}))}}),[a,t])),!f)return null;const c=x.createElement(x.Fragment,null,x.createElement(Vf,{id:n,value:o.draggable}),x.createElement(Yf,{id:l,announcement:s}));return r?Jt.createPortal(c,r):c}var Re;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Re||(Re={}));function Fn(){}function Yl(e,t){return x.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function eh(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return x.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const Ht=Object.freeze({x:0,y:0});function Xl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zl(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function th(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function ql(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function Ql(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Jl(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const rh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=Jl(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const g=Xl(Jl(f),o);a.push({id:l,data:{droppableContainer:s,value:g}})}}return a.sort(Zl)},nh=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=ql(t),a=[];for(const s of n){const{id:l}=s,f=r.get(l);if(f){const g=ql(f),c=o.reduce((u,h,p)=>u+Xl(g[p],h),0),i=Number((c/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:i}})}}return a.sort(Zl)};function oh(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,l=a-r;if(n<o&&r<a){const f=t.width*t.height,g=e.width*e.height,c=s*l,i=c/(f+g-c);return Number(i.toFixed(4))}return 0}const ah=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,l=r.get(s);if(l){const f=oh(l,t);f>0&&o.push({id:s,data:{droppableContainer:a,value:f}})}}return o.sort(th)};function sh(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Rl(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ht}function lh(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...r})}}const ih=lh(1);function ch(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dh(e,t,r){const n=ch(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:l}=n,f=e.left-s-(1-o)*parseFloat(r),g=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?e.width/o:e.width,i=a?e.height/a:e.height;return{width:c,height:i,top:g,right:f+c,bottom:g+i,left:f}}const uh={ignoreTransform:!1};function Or(e,t){t===void 0&&(t=uh);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:g,transformOrigin:c}=mt(e).getComputedStyle(e);g&&(r=dh(r,g,c))}const{top:n,left:o,width:a,height:s,bottom:l,right:f}=r;return{top:n,left:o,width:a,height:s,bottom:l,right:f}}function ei(e){return Or(e,{ignoreTransform:!0})}function fh(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function hh(e,t){return t===void 0&&(t=mt(e).getComputedStyle(e)),t.position==="fixed"}function gh(e,t){t===void 0&&(t=mt(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","o
Line truncated
|
||||
flex items-center gap-3 p-4 rounded-lg border shadow-lg
|
||||
min-w-[300px] max-w-md
|
||||
transition-all duration-300
|
||||
${o.bg}
|
||||
${r?"opacity-100 translate-y-0":`opacity-0 ${s}`}
|
||||
`,role:"alert",children:[u.jsx(de,{name:a,className:`w-5 h-5 flex-shrink-0 ${o.text}`}),u.jsx(ne,{className:`flex-1 text-sm font-medium ${o.text}`,children:e.message}),u.jsx(Q,{onClick:n,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${o.text} focus:outline-none`,"aria-label":Eg("common.close"),children:u.jsx(de,{name:nt.Times,className:"w-4 h-4"})})]})},Ag=Object.freeze(Object.defineProperty({__proto__:null,Toast:pa,default:pa},Symbol.toStringTag,{value:"Module"})),Mg=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},ma=({className:e="",style:t})=>{const[r,n]=C.useState(!1);return C.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){Mg.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{n(s)})},[]),r?u.jsxs(B,{className:`fixed top-0 left-0 right-0 z-50 ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[u.jsx(B,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:u.jsx(B,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),u.jsx("style",{children:`
|
||||
`,role:"alert",children:[d.jsx(ue,{name:a,className:`w-5 h-5 flex-shrink-0 ${o.text}`}),d.jsx(re,{className:`flex-1 text-sm font-medium ${o.text}`,children:e.message}),d.jsx(Q,{onClick:n,className:`flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 ${o.text} focus:outline-none`,"aria-label":Tg("common.close"),children:d.jsx(ue,{name:Je.Times,className:"w-4 h-4"})})]})},Og=Object.freeze(Object.defineProperty({__proto__:null,Toast:ma,default:ma},Symbol.toStringTag,{value:"Module"})),Dg=window.G7Core?.createLogger?.("Comp:PageTransition")??{log:(...e)=>console.log("[Comp:PageTransition]",...e),warn:(...e)=>console.warn("[Comp:PageTransition]",...e),error:(...e)=>console.error("[Comp:PageTransition]",...e)},ba=({className:e="",style:t})=>{const[r,n]=x.useState(!1);return x.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){Dg.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{n(s)})},[]),r?d.jsxs(j,{className:`fixed top-0 left-0 right-0 z-50 ${e}`,style:t,role:"progressbar","aria-label":"페이지 로딩 중",children:[d.jsx(j,{className:"h-1 bg-gradient-to-r from-blue-500 via-blue-600 to-blue-500 animate-pulse",children:d.jsx(j,{className:"h-full bg-blue-700 animate-[loading_1.5s_ease-in-out_infinite]",style:{width:"30%",animation:"loading 1.5s ease-in-out infinite"}})}),d.jsx("style",{children:`
|
||||
@keyframes loading {
|
||||
0% {
|
||||
transform: translateX(-100%);
|
||||
@@ -82,5 +83,5 @@ self.addEventListener('message', async (e) => {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
}
|
||||
`})]}):null},Og=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:ma,default:ma},Symbol.toStringTag,{value:"Module"})),Pi=window.G7Core?.createLogger?.("Comp:PageTransitionBlur")??{log:(...e)=>console.log("[Comp:PageTransitionBlur]",...e),warn:(...e)=>console.warn("[Comp:PageTransitionBlur]",...e)},ba=({className:e="",style:t})=>{const[r,n]=C.useState(!1);return C.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){Pi.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{Pi.log("isPending changed:",s),n(s)})},[]),r?u.jsx(B,{className:`fixed inset-0 z-40 bg-white/30 dark:bg-gray-900/30 backdrop-blur-sm transition-opacity duration-150 pointer-events-none ${e}`,style:t,role:"status","aria-label":"페이지 전환 중","data-testid":"page-transition-blur"}):null},Dg=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:ba,default:ba},Symbol.toStringTag,{value:"Module"})),Li={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Fi=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),Ig=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),Pg=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),Lg=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),Fg=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),Ui={DataGrid:(e,t)=>u.jsxs("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[u.jsx("div",{className:`h-10 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${e}`,children:u.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[u.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"}),u.jsx("div",{className:"h-3 w-24 bg-gray-300 dark:bg-gray-600 rounded"}),u.jsx("div",{className:"h-3 w-20 bg-gray-300 dark:bg-gray-600 rounded"}),u.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"})]})}),Array.from({length:t},(r,n)=>u.jsx("div",{className:`h-12 border-b border-gray-100 dark:border-gray-800 ${e}`,style:{animationDelay:`${n*75}ms`},children:u.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[u.jsx("div",{className:"h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded"}),u.jsx("div",{className:"h-3 flex-1 bg-gray-200 dark:bg-gray-700 rounded"}),u.jsx("div",{className:"h-3 w-16 bg-gray-100 dark:bg-gray-800 rounded"}),u.jsx("div",{className:"h-3 w-14 bg-gray-100 dark:bg-gray-800 rounded"})]})},n))]}),Pagination:e=>u.jsx("div",{className:"flex justify-center gap-1.5 py-3",children:Array.from({length:5},(t,r)=>u.jsx("div",{className:`w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),Tabs:e=>u.jsxs("div",{children:[u.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2 mb-3",children:Array.from({length:3},(t,r)=>u.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),u.jsx("div",{className:`h-32 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]}),TabNavigation:e=>u.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2",children:Array.from({length:3},(t,r)=>u.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),ProductCard:e=>u.jsxs("div",{className:"rounded-lg overflow-hidden",children:[u.jsx("div",{className:`h-48 w-full bg-gray-200 dark:bg-gray-700 ${e}`}),u.jsxs("div",{className:"p-3 space-y-2",children:[u.jsx("div",{className:`h-3.5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),u.jsx("div",{className:`h-4 w-1/3 bg-gray-300 dark:bg-gray-600 rounded ${e}`})]})]}),UserInfo:e=>u.jsx("div",{className:`h-3 w-14 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),QuantitySelector:e=>u.jsx("div",{className:`h-9 w-28 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 ${e}`}),Header:e=>u.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:u.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:u.jsxs("div",{className:"flex items-center justify-between h-16",children:[u.jsxs("div",{className:"flex items-center gap-8",children:[u.jsx("div",{className:`h-8 w-24 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),u.jsx("div",{className:"hidden lg:flex items-center gap-6",children:Array.from({length:4},(t,r)=>u.jsx("div",{className:`h-3.5 w-16 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))})]}),u.jsx("div",{className:"flex items-center gap-4",children:Array.from({length:3},(t,r)=>u.jsx("div",{className:`h-8 w-8 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))})]})})}),Footer:e=>u.jsx("footer",{className:"bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-
Line truncated
|
||||
`})]}):null},Ig=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionIndicator:ba,default:ba},Symbol.toStringTag,{value:"Module"})),Fi=window.G7Core?.createLogger?.("Comp:PageTransitionBlur")??{log:(...e)=>console.log("[Comp:PageTransitionBlur]",...e),warn:(...e)=>console.warn("[Comp:PageTransitionBlur]",...e)},ya=({className:e="",style:t})=>{const[r,n]=x.useState(!1);return x.useEffect(()=>{const o=window.G7Core?.TransitionManager;if(!o){Fi.warn("TransitionManager를 찾을 수 없습니다.");return}return n(o.getIsPending()),o.subscribe(s=>{Fi.log("isPending changed:",s),n(s)})},[]),r?d.jsx(j,{className:`fixed inset-0 z-40 bg-white/30 dark:bg-gray-900/30 backdrop-blur-sm transition-opacity duration-150 pointer-events-none ${e}`,style:t,role:"status","aria-label":"페이지 전환 중","data-testid":"page-transition-blur"}):null},Pg=Object.freeze(Object.defineProperty({__proto__:null,PageTransitionBlur:ya,default:ya},Symbol.toStringTag,{value:"Module"})),Ui={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$i=new Set(["hidden","block","inline-block","inline","flex","inline-flex","grid","inline-grid","table","table-row","table-cell","contents","list-item","flow-root"]),Lg=new Set(["Div","Flex","Grid","Section","Article","Nav","Aside","Main","Header","Footer","Fragment","Form","Container"]),Fg=new Set(["H1","H2","H3","H4","H5","H6","P","Span","Label","A","Strong","Em","Small","Badge"]),Ug=new Set(["Input","Textarea","Select","Checkbox","Radio","Toggle","DatePicker","TagInput","SearchBar"]),$g=new Set(["Img","Image","Avatar","AvatarUploader","ImageGallery","ProductImageViewer","FileUploader"]),zi={DataGrid:(e,t)=>d.jsxs("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[d.jsx("div",{className:`h-10 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 ${e}`,children:d.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[d.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-24 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-20 bg-gray-300 dark:bg-gray-600 rounded"}),d.jsx("div",{className:"h-3 w-16 bg-gray-300 dark:bg-gray-600 rounded"})]})}),Array.from({length:t},(r,n)=>d.jsx("div",{className:`h-12 border-b border-gray-100 dark:border-gray-800 ${e}`,style:{animationDelay:`${n*75}ms`},children:d.jsxs("div",{className:"flex items-center h-full px-4 gap-8",children:[d.jsx("div",{className:"h-3 w-12 bg-gray-200 dark:bg-gray-700 rounded"}),d.jsx("div",{className:"h-3 flex-1 bg-gray-200 dark:bg-gray-700 rounded"}),d.jsx("div",{className:"h-3 w-16 bg-gray-100 dark:bg-gray-800 rounded"}),d.jsx("div",{className:"h-3 w-14 bg-gray-100 dark:bg-gray-800 rounded"})]})},n))]}),Pagination:e=>d.jsx("div",{className:"flex justify-center gap-1.5 py-3",children:Array.from({length:5},(t,r)=>d.jsx("div",{className:`w-8 h-8 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),Tabs:e=>d.jsxs("div",{children:[d.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2 mb-3",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),d.jsx("div",{className:`h-32 bg-gray-100 dark:bg-gray-800 rounded ${e}`})]}),TabNavigation:e=>d.jsx("div",{className:"flex gap-4 border-b border-gray-200 dark:border-gray-700 pb-2",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-4 w-20 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))}),ProductCard:e=>d.jsxs("div",{className:"rounded-lg overflow-hidden",children:[d.jsx("div",{className:`h-48 w-full bg-gray-200 dark:bg-gray-700 ${e}`}),d.jsxs("div",{className:"p-3 space-y-2",children:[d.jsx("div",{className:`h-3.5 w-3/4 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:`h-4 w-1/3 bg-gray-300 dark:bg-gray-600 rounded ${e}`})]})]}),UserInfo:e=>d.jsx("div",{className:`h-3 w-14 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),QuantitySelector:e=>d.jsx("div",{className:`h-9 w-28 bg-gray-100 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 ${e}`}),Header:e=>d.jsx("header",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:d.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:d.jsxs("div",{className:"flex items-center justify-between h-16",children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("div",{className:`h-8 w-24 bg-gray-200 dark:bg-gray-700 rounded ${e}`}),d.jsx("div",{className:"hidden lg:flex items-center gap-6",children:Array.from({length:4},(t,r)=>d.jsx("div",{className:`h-3.5 w-16 bg-gray-200 dark:bg-gray-700 rounded ${e}`},r))})]}),d.jsx("div",{className:"flex items-center gap-4",children:Array.from({length:3},(t,r)=>d.jsx("div",{className:`h-8 w-8 bg-gray-200 dark:bg-gray-700 rounded-full ${e}`},r))})]})})}),Footer:e=>d.jsx("footer",{className:"bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-
Line truncated
|
||||
//# sourceMappingURL=components.iife.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"components.iife.js","sources":["../../src/components/basic/Button.tsx","../../src/components/basic/Div.tsx","../../src/components/basic/Span.tsx","../../src/components/basic/Svg.tsx","../../src/components/basic/Input.tsx","../../src/components/basic/FileInput.tsx","../../src/components/basic/IconTypes.ts","../../src/components/basic/Icon.tsx","../../src/components/basic/PasswordInput.tsx","../../src/components/basic/Textarea.tsx","../../src/components/basic/Label.tsx","../../src/components/basic/P.tsx","../../src/components/basic/Img.tsx","../../src/components/basic/H1.tsx","../../src/components/basic/H2.tsx","../../src/components/basic/H3.tsx","../../src/components/basic/H4.tsx","../../src/components/basic/Ul.tsx","../../src/components/basic/Ol.tsx","../../src/components/basic/Li.tsx","../../src/components/basic/A.tsx","../../src/components/basic/Form.tsx","../../src/components/basic/Select.tsx","../../src/components/basic/Option.tsx","../../src/components/basic/Optgroup.tsx","../../src/components/basic/Checkbox.tsx","../../src/components/basic/Table.tsx","../../src/components/basic/Thead.tsx","../../src/components/basic/Tbody.tsx","../../src/components/basic/Tr.tsx","../../src/components/basic/Th.tsx","../../src/components/basic/Td.tsx","../../src/components/basic/Nav.tsx","../../src/components/basic/Section.tsx","../../src/components/basic/Code.tsx","../../src/components/basic/Footer.tsx","../../src/components/basic/Header.tsx","../../src/components/basic/Hr.tsx","../../src/components/composite/ThemeToggle.tsx","../../src/components/composite/Avatar.tsx","../../src/components/composite/Header.tsx","../../src/components/composite/Footer.tsx","../../src/components/composite/MobileNav.tsx","../../node_modules/dompurify/dist/purify.es.mjs","../../src/components/composite/ProductCard.tsx","../../node_modules/yet-another-react-lightbox/dist/types.js","../../node_modules/yet-another-react-lightbox/dist/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/zoom/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/counter/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/slideshow/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/fullscreen/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/thumbnails/index.js","../../src/components/basic/I.tsx","../../src/components/composite/ImageGallery.tsx","../../src/components/composite/ProductImageViewer.tsx","../../src/components/composite/QuantitySelector.tsx","../../src/components/composite/PostReactions.tsx","../../src/components/composite/RichTextEditor.tsx","../../src/components/composite/HtmlContent.tsx","../../src/components/composite/HtmlEditor.tsx","../../src/components/composite/ExpandableContent.tsx","../../src/components/composite/Modal.tsx","../../src/components/composite/ConfirmDialog.tsx","../../src/components/composite/FileUploader/FileUploaderContext.tsx","../../node_modules/browser-image-compression/dist/browser-image-compression.mjs","../../src/components/composite/FileUploader/utils.ts","../../src/components/composite/FileUploader/useFileUploader.ts","../../src/components/composite/FileUploader/FileDropZone.tsx","../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js","../../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js","../../node_modules/@dnd-kit/core/dist/core.esm.js","../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js","../../src/components/composite/FileUploader/SortableThumbnailItem.tsx","../../src/components/composite/FileUploader/FileList.tsx","../../src/components/composite/FileUploader/FileUploader.tsx","../../src/components/composite/SocialLoginButtons.tsx","../../src/components/composite/Toast.tsx","../../src/components/composite/PageTransitionIndicator.tsx","../../src/components/composite/PageTransitionBlur.tsx","../../src/components/composite/PageSkeleton.tsx","../../src/components/composite/PageLoading.tsx","../../src/components/composite/Pagination.tsx","../../src/components/composite/SearchBar.tsx","../../src/components/composite/AvatarUploader.tsx","../../src/components/composite/UserInfo.tsx","../../src/components/composite/TabNavigation.tsx","../../src/components/composite/index.ts","../../src/components/layout/Container.tsx","../../src/components/layout/Grid.tsx","../../src/components/layout/Flex.tsx","../../src/components/layout/SectionLayout.tsx","../../src/components/layout/ThreeColumnLayout.tsx","../../src/handlers/productOptions.ts","../../src/handlers/cartHandlers.ts","../../src/handlers/cartOptionChange.ts","../../src/handlers/storageHandlers.ts","../../src/handlers/getDisplayPrice.ts","../../src/handlers/formatCurrency.ts","../../src/handlers/loadPreferredCurrency.ts","../../src/handlers/setThemeHandler.ts","../../src/handlers/index.ts","../../src/index.ts"],"sourcesContent":["import React, { forwardRef } from 'react';\n\n// G7Core 전역 객체의 스타일 헬퍼 접근\nconst G7CoLine truncated
|
||||
{"version":3,"file":"components.iife.js","sources":["../../src/components/basic/Button.tsx","../../src/components/basic/Div.tsx","../../src/components/basic/Span.tsx","../../src/components/basic/Svg.tsx","../../src/components/basic/Input.tsx","../../src/components/basic/FileInput.tsx","../../src/components/basic/IconTypes.ts","../../src/components/basic/Icon.tsx","../../src/components/basic/PasswordInput.tsx","../../src/components/basic/Textarea.tsx","../../src/components/basic/Label.tsx","../../src/components/basic/P.tsx","../../src/components/basic/Img.tsx","../../src/components/basic/H1.tsx","../../src/components/basic/H2.tsx","../../src/components/basic/H3.tsx","../../src/components/basic/H4.tsx","../../src/components/basic/Ul.tsx","../../src/components/basic/Ol.tsx","../../src/components/basic/Li.tsx","../../src/components/basic/A.tsx","../../src/components/basic/Form.tsx","../../src/components/basic/Select.tsx","../../src/components/basic/Option.tsx","../../src/components/basic/Optgroup.tsx","../../src/components/basic/Checkbox.tsx","../../src/components/basic/Table.tsx","../../src/components/basic/Thead.tsx","../../src/components/basic/Tbody.tsx","../../src/components/basic/Tr.tsx","../../src/components/basic/Th.tsx","../../src/components/basic/Td.tsx","../../src/components/basic/Nav.tsx","../../src/components/basic/Section.tsx","../../src/components/basic/Code.tsx","../../src/components/basic/Footer.tsx","../../src/components/basic/Header.tsx","../../src/components/basic/Hr.tsx","../../src/components/composite/ThemeToggle.tsx","../../src/components/composite/Avatar.tsx","../../src/components/composite/NotificationCenter.tsx","../../src/components/composite/Header.tsx","../../src/components/composite/Footer.tsx","../../src/components/composite/MobileNav.tsx","../../node_modules/dompurify/dist/purify.es.mjs","../../src/components/composite/ProductCard.tsx","../../node_modules/yet-another-react-lightbox/dist/types.js","../../node_modules/yet-another-react-lightbox/dist/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/zoom/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/counter/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/slideshow/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/fullscreen/index.js","../../node_modules/yet-another-react-lightbox/dist/plugins/thumbnails/index.js","../../src/components/basic/I.tsx","../../src/components/composite/ImageGallery.tsx","../../src/components/composite/ProductImageViewer.tsx","../../src/components/composite/QuantitySelector.tsx","../../src/components/composite/PostReactions.tsx","../../src/components/composite/RichTextEditor.tsx","../../src/components/composite/HtmlContent.tsx","../../src/components/composite/HtmlEditor.tsx","../../src/components/composite/ExpandableContent.tsx","../../src/components/composite/Modal.tsx","../../src/components/composite/ConfirmDialog.tsx","../../src/components/composite/FileUploader/FileUploaderContext.tsx","../../node_modules/browser-image-compression/dist/browser-image-compression.mjs","../../src/components/composite/FileUploader/utils.ts","../../src/components/composite/FileUploader/useFileUploader.ts","../../src/components/composite/FileUploader/FileDropZone.tsx","../../node_modules/@dnd-kit/utilities/dist/utilities.esm.js","../../node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js","../../node_modules/@dnd-kit/core/dist/core.esm.js","../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js","../../src/components/composite/FileUploader/SortableThumbnailItem.tsx","../../src/components/composite/FileUploader/FileList.tsx","../../src/components/composite/FileUploader/FileUploader.tsx","../../src/components/composite/SocialLoginButtons.tsx","../../src/components/composite/Toast.tsx","../../src/components/composite/PageTransitionIndicator.tsx","../../src/components/composite/PageTransitionBlur.tsx","../../src/components/composite/PageSkeleton.tsx","../../src/components/composite/PageLoading.tsx","../../src/components/composite/Pagination.tsx","../../src/components/composite/SearchBar.tsx","../../src/components/composite/AvatarUploader.tsx","../../src/components/composite/UserInfo.tsx","../../src/components/composite/TabNavigation.tsx","../../src/components/composite/index.ts","../../src/components/layout/Container.tsx","../../src/components/layout/Grid.tsx","../../src/components/layout/Flex.tsx","../../src/components/layout/SectionLayout.tsx","../../src/components/layout/ThreeColumnLayout.tsx","../../src/handlers/productOptions.ts","../../src/handlers/cartHandlers.ts","../../src/handlers/cartOptionChange.ts","../../src/handlers/storageHandlers.ts","../../src/handlers/getDisplayPrice.ts","../../src/handlers/formatCurrency.ts","../../src/handlers/loadPreferredCurrency.ts","../../src/handlers/setThemeHandler.ts","../../src/handlers/index.ts","../../src/index.ts"],"sourcesContent":["import React, { forwardRef } from 'react';\n\n// G7CLine truncated
|
||||
@@ -13,6 +13,10 @@ export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectE
|
||||
value: string | number;
|
||||
};
|
||||
}) => void;
|
||||
/** 드롭다운 내 검색 input 활성화 (engine-v1.40.0+) */
|
||||
searchable?: boolean;
|
||||
/** 검색 input placeholder */
|
||||
searchPlaceholder?: string;
|
||||
}
|
||||
/**
|
||||
* 커스텀 Select 컴포넌트
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { default as React } from 'react';
|
||||
import { NotificationItem } from './NotificationCenter';
|
||||
interface Board {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -36,6 +37,38 @@ interface HeaderProps {
|
||||
shopBase?: string;
|
||||
/** 추가 CSS 클래스 */
|
||||
className?: string;
|
||||
/** 알림 목록 (NotificationCenter에 전달) */
|
||||
notifications?: NotificationItem[];
|
||||
/** 더 불러올 페이지 존재 여부 */
|
||||
notificationHasMore?: boolean;
|
||||
/** 알림 로딩 상태 */
|
||||
notificationLoading?: boolean;
|
||||
/** "안 읽은 알림만" 필터 상태 */
|
||||
notificationUnreadOnly?: boolean;
|
||||
/** 알림 드롭다운 제목 */
|
||||
notificationTitleText?: string;
|
||||
/** 알림 없음 텍스트 */
|
||||
notificationEmptyText?: string;
|
||||
/** "모두 읽음" 텍스트 */
|
||||
notificationMarkAllReadText?: string;
|
||||
/** "모두 삭제" 텍스트 */
|
||||
notificationDeleteAllText?: string;
|
||||
/** "안 읽은 알림만" 체크박스 텍스트 */
|
||||
notificationUnreadOnlyText?: string;
|
||||
/** 알림 드롭다운 닫힐 때 (뷰포트에 보인 미읽음 ID 배열 전달) */
|
||||
onNotificationClose?: (visibleUnreadIds: (string | number)[]) => void;
|
||||
/** 개별 알림 클릭 */
|
||||
onNotificationClick?: (notification: NotificationItem) => void;
|
||||
/** 무한 스크롤: 추가 로드 */
|
||||
onNotificationLoadMore?: () => void;
|
||||
/** "모두 읽음" 처리 */
|
||||
onNotificationMarkAllRead?: () => void;
|
||||
/** "모두 삭제" 요청 (모달 오픈) */
|
||||
onNotificationDeleteAll?: () => void;
|
||||
/** 개별 알림 삭제 */
|
||||
onNotificationDelete?: (notification: NotificationItem) => void;
|
||||
/** "안 읽은 알림만" 체크박스 토글 */
|
||||
onNotificationUnreadOnlyToggle?: (checked: boolean) => void;
|
||||
}
|
||||
/**
|
||||
* 사이트 헤더 컴포넌트
|
||||
|
||||
-1
@@ -35,7 +35,6 @@ export interface HtmlContentProps {
|
||||
* @example
|
||||
* // HTML 렌더링 (기본값)
|
||||
* <HtmlContent content="<p>안녕하세요</p>" />
|
||||
* <HtmlContent content="<p>안녕하세요</p>" isHtml={true} />
|
||||
*
|
||||
* // 일반 텍스트 렌더링
|
||||
* <HtmlContent
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
import { default as React } from 'react';
|
||||
import { IconName } from '../basic/IconTypes';
|
||||
/**
|
||||
* 알림 아이템 인터페이스
|
||||
*/
|
||||
export interface NotificationItem {
|
||||
id: string | number;
|
||||
title: string;
|
||||
message: string;
|
||||
time: string;
|
||||
read?: boolean;
|
||||
iconName?: IconName;
|
||||
data?: Record<string, unknown>;
|
||||
onClick?: () => void;
|
||||
}
|
||||
/**
|
||||
* NotificationCenter Props
|
||||
*/
|
||||
export interface NotificationCenterProps {
|
||||
/** 알림 목록 */
|
||||
notifications?: NotificationItem[];
|
||||
/** 서버 기반 미읽음 알림 수 */
|
||||
unreadCount?: number;
|
||||
/** 추가 로드 가능 여부 */
|
||||
hasMore?: boolean;
|
||||
/** 로딩 상태 */
|
||||
loading?: boolean;
|
||||
/** 알림 제목 텍스트 */
|
||||
titleText?: string;
|
||||
/** 알림 없음 텍스트 */
|
||||
emptyText?: string;
|
||||
/** "모두 읽음" 버튼 텍스트 */
|
||||
markAllReadText?: string;
|
||||
/** "모두 삭제" 버튼 텍스트 */
|
||||
deleteAllText?: string;
|
||||
/** "미읽음만" 체크박스 텍스트 */
|
||||
unreadOnlyText?: string;
|
||||
/** "미읽음만" 체크박스 상태 */
|
||||
unreadOnly?: boolean;
|
||||
/** 알림 클릭 핸들러 (알림 전체 객체 전달) */
|
||||
onNotificationClick?: (notification: NotificationItem) => void;
|
||||
/** 드롭다운 닫힐 때 (뷰포트에 들어온 미읽음 알림 ID 목록) */
|
||||
onClose?: (visibleUnreadIds: (string | number)[]) => void;
|
||||
/** 추가 로드 요청 */
|
||||
onLoadMore?: () => void;
|
||||
/** 모두 읽음 처리 요청 */
|
||||
onMarkAllRead?: () => void;
|
||||
/** 모두 삭제 요청 */
|
||||
onDeleteAll?: () => void;
|
||||
/** 개별 알림 삭제 요청 (알림 전체 객체 전달) */
|
||||
onDelete?: (notification: NotificationItem) => void;
|
||||
/** "미읽음만" 체크박스 토글 */
|
||||
onUnreadOnlyToggle?: (checked: boolean) => void;
|
||||
/** 드롭다운 정렬 방향 — "right"(기본): 우측 정렬되어 좌측으로 확장 / "left": 좌측 정렬되어 우측으로 확장 */
|
||||
dropdownAlign?: 'left' | 'right';
|
||||
className?: string;
|
||||
}
|
||||
/**
|
||||
* NotificationCenter 컴포넌트 (User)
|
||||
*
|
||||
* 알림 센터 - 알림 목록 표시, 무한스크롤, 읽음 추적.
|
||||
* sirsoft-admin_basic의 NotificationCenter와 동일 API/동작을 제공한다.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* <NotificationCenter
|
||||
* notifications={[
|
||||
* { id: 1, title: '새 댓글', message: '게시물에 댓글이 달렸습니다', time: '5분 전' }
|
||||
* ]}
|
||||
* unreadCount={5}
|
||||
* hasMore={true}
|
||||
* titleText="알림"
|
||||
* emptyText="알림이 없습니다."
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
export declare const NotificationCenter: React.FC<NotificationCenterProps>;
|
||||
export default NotificationCenter;
|
||||
+7
-7
@@ -14,24 +14,25 @@ export interface TabNavigationProps {
|
||||
variant?: 'default' | 'pills' | 'underline';
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
/** 모바일에서 그리드 레이아웃 사용 (기본: true) */
|
||||
mobileGrid?: boolean;
|
||||
/** 모바일 그리드 컬럼 수 (기본: 3) */
|
||||
mobileColumns?: number;
|
||||
/** 숨길 탭 ID 목록 (동적 조건부 탭 노출용) */
|
||||
hiddenTabIds?: (string | number)[];
|
||||
/** 모바일 전환 임계값 (px). 기본값 768 — G7 ResponsiveContext mobile 프리셋과 동일 */
|
||||
mobileBreakpoint?: number;
|
||||
}
|
||||
/**
|
||||
* TabNavigation 집합 컴포넌트
|
||||
*
|
||||
* 탭 네비게이션을 제공하는 컴포넌트입니다.
|
||||
* 여러 탭을 전환할 수 있으며, 아이콘과 뱃지를 지원합니다.
|
||||
* 모바일에서는 그리드 레이아웃으로 표시합니다.
|
||||
*
|
||||
* 반응형: G7Core.useResponsive() hook으로 화면 너비를 구독하여
|
||||
* mobileBreakpoint(기본 768px) 미만일 때 Select 드롭다운으로 자동 전환됩니다.
|
||||
* Tailwind hidden md:flex 분기를 사용하지 않으므로 위지윅 편집기의 디바이스 미리보기와도 호환됩니다.
|
||||
*
|
||||
* **주의**: 이 컴포넌트는 순수 네비게이션 UI만 제공하며,
|
||||
* 실제 탭 컨텐츠는 부모 컴포넌트에서 activeTabId를 기반으로 조건부 렌더링해야 합니다.
|
||||
*
|
||||
* 기본 컴포넌트 조합: Nav + Button + Icon + Div + Span
|
||||
* 기본 컴포넌트 조합: Nav + Button + Icon + Div + Span + Select
|
||||
*
|
||||
* @example
|
||||
* // 레이아웃 JSON 사용 예시
|
||||
@@ -39,7 +40,6 @@ export interface TabNavigationProps {
|
||||
* "name": "TabNavigation",
|
||||
* "props": {
|
||||
* "activeTabId": 1,
|
||||
* "mobileColumns": 3,
|
||||
* "tabs": [
|
||||
* {"id": 1, "label": "프로필", "iconName": "user"},
|
||||
* {"id": 2, "label": "설정", "iconName": "cog", "badge": 3},
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
export { default as Header } from './Header';
|
||||
export { default as Footer } from './Footer';
|
||||
export { default as MobileNav } from './MobileNav';
|
||||
export { NotificationCenter } from './NotificationCenter';
|
||||
export type { NotificationCenterProps, NotificationItem } from './NotificationCenter';
|
||||
export { default as ProductCard } from './ProductCard';
|
||||
export { default as ImageGallery } from './ImageGallery';
|
||||
export { default as ProductImageViewer } from './ProductImageViewer';
|
||||
@@ -50,6 +52,7 @@ export declare const compositeComponents: {
|
||||
Header: () => Promise<typeof import("./Header")>;
|
||||
Footer: () => Promise<typeof import("./Footer")>;
|
||||
MobileNav: () => Promise<typeof import("./MobileNav")>;
|
||||
NotificationCenter: () => Promise<typeof import("./NotificationCenter")>;
|
||||
ProductCard: () => Promise<typeof import("./ProductCard")>;
|
||||
ImageGallery: () => Promise<typeof import("./ImageGallery")>;
|
||||
ProductImageViewer: () => Promise<typeof import("./ProductImageViewer")>;
|
||||
|
||||
+76
-70
@@ -1,73 +1,79 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "user-address-search",
|
||||
"description": "사용자 화면용 다음 주소 검색 Extension",
|
||||
"version": "1.0.0",
|
||||
"extension_point": "address_search_slot",
|
||||
"plugin": "sirsoft-daum_postcode"
|
||||
},
|
||||
"component": {
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"props": {
|
||||
"type": "button",
|
||||
"className": "flex-shrink-0 px-4 py-2.5 bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded-lg text-sm font-medium hover:bg-gray-800 dark:hover:bg-gray-100 transition-colors"
|
||||
},
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": {
|
||||
"type": "button",
|
||||
"className": "flex-shrink-0 px-3 py-2 bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded-lg text-xs font-medium hover:bg-gray-800 dark:hover:bg-gray-100 transition-colors"
|
||||
}
|
||||
}
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Icon",
|
||||
"props": { "name": "search", "className": "w-4 h-4 mr-1.5" }
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "$t:address.search"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
"handler": "openDaumPostcode",
|
||||
"params": {
|
||||
"callbackSetState": {
|
||||
"target": "{{$props.stateTarget || 'local'}}",
|
||||
"zonecode": "{{$props.zonecodePath || 'shipping.zonecode'}}",
|
||||
"address": "{{$props.addressPath || 'shipping.address'}}",
|
||||
"detailFocusField": "{{$props.detailFocusField || 'shipping.addressDetail'}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"translations": {
|
||||
"ko": {
|
||||
"address": {
|
||||
"search": "주소 검색",
|
||||
"search_placeholder": "주소를 검색해주세요",
|
||||
"zonecode": "우편번호",
|
||||
"address_main": "기본주소",
|
||||
"address_detail": "상세주소",
|
||||
"address_detail_placeholder": "상세주소를 입력해주세요"
|
||||
}
|
||||
},
|
||||
"en": {
|
||||
"address": {
|
||||
"search": "Search Address",
|
||||
"search_placeholder": "Please search for an address",
|
||||
"zonecode": "Postal Code",
|
||||
"address_main": "Address",
|
||||
"address_detail": "Detail Address",
|
||||
"address_detail_placeholder": "Please enter detail address"
|
||||
}
|
||||
"extension_point": "address_search_slot",
|
||||
"scripts": [
|
||||
{
|
||||
"src": "//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",
|
||||
"id": "daum_postcode_script"
|
||||
}
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"id": "daum_postcode_user_container",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": {
|
||||
"className": "inline-flex"
|
||||
},
|
||||
"lifecycle": {
|
||||
"onMount": [
|
||||
{
|
||||
"comment": "주소 검색 플러그인 마운트 시 지정된 필드를 readOnly로 설정",
|
||||
"handler": "sirsoft-daum_postcode.setFieldReadOnly",
|
||||
"params": {
|
||||
"fields": "{{extensionPointProps.readOnlyFields ?? ['zipcode', 'address']}}",
|
||||
"readOnly": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"id": "btn_user_search_address",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"props": {
|
||||
"type": "button",
|
||||
"className": "flex-shrink-0 px-4 py-2.5 border border-blue-500 dark:border-blue-400 text-blue-600 dark:text-blue-400 rounded-lg text-sm font-medium hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors"
|
||||
},
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": {
|
||||
"className": "flex-shrink-0 px-3 py-2 border border-blue-500 dark:border-blue-400 text-blue-600 dark:text-blue-400 rounded-lg text-xs font-medium hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors"
|
||||
}
|
||||
}
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Icon",
|
||||
"props": { "name": "search", "className": "w-4 h-4 mr-1.5" }
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "$t:sirsoft-daum_postcode.search_address"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
"handler": "sirsoft-daum_postcode.openPostcode",
|
||||
"params": {
|
||||
"displayMode": "{{_global.plugins['sirsoft-daum_postcode']?.display_mode ?? 'layer'}}",
|
||||
"width": "{{_global.plugins['sirsoft-daum_postcode']?.popup_width ?? 500}}",
|
||||
"height": "{{_global.plugins['sirsoft-daum_postcode']?.popup_height ?? 600}}",
|
||||
"theme": {
|
||||
"searchBgColor": "{{_global.plugins['sirsoft-daum_postcode']?.theme_color ?? '#1D4ED8'}}",
|
||||
"queryTextColor": "#FFFFFF"
|
||||
},
|
||||
"callbackAction": "{{extensionPointCallbacks.onAddressSelect}}",
|
||||
"targetFields": "{{extensionPointProps.targetFields}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"priority": 50
|
||||
}
|
||||
@@ -191,7 +191,7 @@
|
||||
"today": "Today",
|
||||
"this_week": "This Week",
|
||||
"this_month": "This Month",
|
||||
"all": "All",
|
||||
"year": "1 Year",
|
||||
"no_posts": "No popular posts",
|
||||
"no_posts_description": "There are no posts with high views in the selected period"
|
||||
},
|
||||
|
||||
@@ -324,8 +324,13 @@
|
||||
"unread_count": "{{count}} unread notifications",
|
||||
"mark_all_read": "Mark all as read",
|
||||
"delete_all": "Delete all",
|
||||
"delete_all_title": "Delete all notifications",
|
||||
"delete_all_confirm": "Are you sure you want to delete all notifications?",
|
||||
"delete_all_success": "All notifications have been deleted.",
|
||||
"delete_all_failed": "Failed to delete notifications.",
|
||||
"all_deleted": "All notifications have been deleted.",
|
||||
"unread_only": "Unread only",
|
||||
"new_notification_received": "New notification received.",
|
||||
"empty": "No notifications.",
|
||||
"type": {
|
||||
"order": "Order",
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"results": "Search Results",
|
||||
"results_count": "{{count}} results",
|
||||
"result_summary": "{{count}} results found",
|
||||
"result_count_suffix": " results found",
|
||||
"no_results": "No results found.",
|
||||
"try_different": "Try a different search term.",
|
||||
"tabs": {
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
"back_to_home": "Back to Home",
|
||||
"admin_edit": "Edit",
|
||||
"status_active": "Active",
|
||||
"status_draft": "Draft",
|
||||
"status_archived": "Archived",
|
||||
"published_at": "Published",
|
||||
"create_page": "Create Page",
|
||||
"attachments": "Attachments",
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
"today": "오늘",
|
||||
"this_week": "이번주",
|
||||
"this_month": "이번달",
|
||||
"all": "전체",
|
||||
"year": "1년",
|
||||
"no_posts": "인기 게시글이 없습니다",
|
||||
"no_posts_description": "선택한 기간에 조회수가 높은 게시글이 없습니다"
|
||||
},
|
||||
|
||||
@@ -324,8 +324,13 @@
|
||||
"unread_count": "읽지 않은 알림 {{count}}건",
|
||||
"mark_all_read": "모두 읽음",
|
||||
"delete_all": "모두 삭제",
|
||||
"delete_all_title": "알림 전체 삭제",
|
||||
"delete_all_confirm": "모든 알림을 삭제하시겠습니까?",
|
||||
"delete_all_success": "모든 알림이 삭제되었습니다.",
|
||||
"delete_all_failed": "알림 삭제에 실패했습니다.",
|
||||
"all_deleted": "모든 알림이 삭제되었습니다.",
|
||||
"unread_only": "안 읽은 알림만",
|
||||
"new_notification_received": "새 알림이 도착했습니다.",
|
||||
"empty": "알림이 없습니다.",
|
||||
"type": {
|
||||
"order": "주문",
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"results": "검색 결과",
|
||||
"results_count": "{{count}}개의 결과",
|
||||
"result_summary": "검색 결과 {{count}}건",
|
||||
"result_count_suffix": "건",
|
||||
"no_results": "검색 결과가 없습니다.",
|
||||
"try_different": "다른 검색어로 시도해보세요.",
|
||||
"tabs": {
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
"back_to_home": "홈으로 돌아가기",
|
||||
"admin_edit": "수정",
|
||||
"status_active": "시행중",
|
||||
"status_draft": "초안",
|
||||
"status_archived": "보관됨",
|
||||
"published_at": "발행일",
|
||||
"create_page": "페이지 생성",
|
||||
"attachments": "첨부파일",
|
||||
|
||||
@@ -104,6 +104,69 @@
|
||||
"path": "count"
|
||||
},
|
||||
"fallback": { "data": { "count": 0 } }
|
||||
},
|
||||
{
|
||||
"id": "notification_unread_count",
|
||||
"type": "api",
|
||||
"endpoint": "/api/user/notifications/unread-count",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"loading_strategy": "progressive",
|
||||
"initGlobal": {
|
||||
"key": "notificationCount",
|
||||
"path": "unread_count"
|
||||
},
|
||||
"fallback": { "data": { "unread_count": 0 } },
|
||||
"errorHandling": {
|
||||
"401": { "handler": "suppress" },
|
||||
"403": { "handler": "suppress" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "알림 목록 — 드롭다운 NotificationCenter 에서 사용. unreadOnly 토글에 따라 read 필터 동적 적용",
|
||||
"id": "notifications",
|
||||
"type": "api",
|
||||
"endpoint": "/api/user/notifications",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"loading_strategy": "progressive",
|
||||
"params": {
|
||||
"per_page": 15,
|
||||
"read": "{{(_global.notificationsUnreadOnly ?? true) ? 'unread' : 'all'}}"
|
||||
},
|
||||
"fallback": { "data": { "data": [] } },
|
||||
"errorHandling": {
|
||||
"401": { "handler": "suppress" },
|
||||
"403": { "handler": "suppress" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "user_notification_ws",
|
||||
"type": "websocket",
|
||||
"channel": "core.user.notifications.{{_global.currentUser?.uuid}}",
|
||||
"event": "notification.received",
|
||||
"channel_type": "private",
|
||||
"target_source": "notification_unread_count",
|
||||
"onReceive": [
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
},
|
||||
{
|
||||
"handler": "toast",
|
||||
"params": {
|
||||
"type": "info",
|
||||
"message": "{{$args[0].subject ?? '$t:mypage.notifications.new_notification_received'}}",
|
||||
"duration": 5000
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
@@ -207,21 +270,12 @@
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"name": "Span",
|
||||
"if": "{{!_global.settings?.general?.site_logo_url}}",
|
||||
"props": {
|
||||
"className": "flex items-center justify-center w-8 h-8 bg-black dark:bg-white rounded-lg"
|
||||
"className": "text-lg font-bold text-gray-900 dark:text-white"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": {
|
||||
"className": "text-white dark:text-black font-bold text-sm"
|
||||
},
|
||||
"text": "N"
|
||||
}
|
||||
]
|
||||
"text": "{{_global.settings?.general?.site_name ?? 'Site'}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -246,7 +300,216 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "장바구니",
|
||||
"comment": "알림센터 드롭다운 — 모바일 (PC와 동일 순서: 알림 → 장바구니)",
|
||||
"id": "mobile_notification_center",
|
||||
"type": "composite",
|
||||
"name": "NotificationCenter",
|
||||
"if": "{{_global.currentUser?.uuid}}",
|
||||
"props": {
|
||||
"notifications": "{{(notifications?.data?.data ?? []).map(n => ({ id: n.id, title: n.subject ?? '', message: n.body ?? '', time: n.created_at ?? '', read: !!n.read_at, url: n.url ?? '', data: n.data ?? {} }))}}",
|
||||
"unreadCount": "{{_global.notificationCount ?? 0}}",
|
||||
"hasMore": "{{_global.notificationsHasMore ?? notifications?.data?.pagination?.has_more_pages ?? false}}",
|
||||
"loading": "{{_global.notificationsLoadingMore ?? notifications?.loading ?? false}}",
|
||||
"titleText": "$t:mypage.notifications.title",
|
||||
"emptyText": "$t:mypage.notifications.empty",
|
||||
"markAllReadText": "$t:mypage.notifications.mark_all_read",
|
||||
"deleteAllText": "$t:mypage.notifications.delete_all",
|
||||
"unreadOnlyText": "$t:mypage.notifications.unread_only",
|
||||
"unreadOnly": "{{_global.notificationsUnreadOnly ?? true}}",
|
||||
"dropdownAlign": "right"
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"event": "onClose",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/read-batch",
|
||||
"params": {
|
||||
"method": "POST",
|
||||
"body": { "ids": "{{$args[0]}}" }
|
||||
},
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onNotificationClick",
|
||||
"handler": "parallel",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "navigate",
|
||||
"params": { "path": "{{$args[0].url ?? '/mypage/notifications'}}" }
|
||||
},
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/{{$args[0].id}}/read",
|
||||
"params": { "method": "PATCH" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onMarkAllRead",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/read-all",
|
||||
"params": { "method": "POST" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null,
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onUnreadOnlyToggle",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsUnreadOnly": "{{$args[0]}}",
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null,
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onDelete",
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/{{$args[0].id}}",
|
||||
"params": { "method": "DELETE" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"event": "onDeleteAll",
|
||||
"handler": "openModal",
|
||||
"target": "notification_delete_all_confirm_modal"
|
||||
},
|
||||
{
|
||||
"event": "onLoadMore",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsLoadingMore": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications",
|
||||
"params": {
|
||||
"method": "GET",
|
||||
"query": {
|
||||
"page": "{{(_global.notificationsCurrentPage ?? notifications?.data?.pagination?.current_page ?? 1) + 1}}",
|
||||
"per_page": 15
|
||||
}
|
||||
},
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "appendDataSource",
|
||||
"params": {
|
||||
"dataSourceId": "notifications",
|
||||
"dataPath": "data.data",
|
||||
"newData": "{{response.data.data ?? []}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsCurrentPage": "{{response.data.pagination.current_page}}",
|
||||
"notificationsHasMore": "{{response.data.pagination.has_more_pages}}",
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"onError": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "장바구니 — PC와 동일 순서 (알림 → 장바구니)",
|
||||
"id": "mobile_cart_btn",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
@@ -276,40 +539,12 @@
|
||||
"name": "Span",
|
||||
"if": "{{_global.cartCount > 0}}",
|
||||
"props": {
|
||||
"className": "absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white text-xs font-bold rounded-full flex items-center justify-center"
|
||||
"className": "absolute -top-1 -right-1 w-5 h-5 bg-blue-500 text-white text-xs font-bold rounded-full flex items-center justify-center"
|
||||
},
|
||||
"text": "{{_global.cartCount > 99 ? '99+' : _global.cartCount}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "알림",
|
||||
"id": "mobile_notification_btn",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{_global.currentUser?.uuid}}",
|
||||
"props": {
|
||||
"className": "p-2 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg relative"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Icon",
|
||||
"props": {
|
||||
"name": "bell",
|
||||
"className": "w-5 h-5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"if": "{{_global.notificationCount > 0}}",
|
||||
"props": {
|
||||
"className": "absolute -top-1 -right-1 w-2 h-2 bg-red-500 rounded-full"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "사용자 아이콘 (로그인 시) / 로그인 버튼",
|
||||
"id": "mobile_user_btn",
|
||||
@@ -452,7 +687,7 @@
|
||||
"name": "Icon",
|
||||
"props": {
|
||||
"name": "search",
|
||||
"className": "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"
|
||||
"className": "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -460,9 +695,27 @@
|
||||
"name": "Input",
|
||||
"props": {
|
||||
"type": "text",
|
||||
"name": "q",
|
||||
"placeholder": "$t:user.search_placeholder",
|
||||
"className": "w-full pl-10 pr-4 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-blue-500"
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "keydown",
|
||||
"key": "Enter",
|
||||
"handler": "sequence",
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": { "target": "global", "mobileMenuOpen": false }
|
||||
},
|
||||
{
|
||||
"handler": "navigate",
|
||||
"params": { "path": "/search", "query": { "q": "{{$event.target.value}}" } }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -535,7 +788,7 @@
|
||||
"name": "Icon",
|
||||
"props": {
|
||||
"name": "chevron-down",
|
||||
"className": "{{_global.mobileUserMenuOpen ? 'rotate-180' : ''}} w-5 h-5 text-gray-400 transition-transform duration-200"
|
||||
"className": "{{_global.mobileUserMenuOpen ? 'rotate-180' : ''}} w-5 h-5 text-gray-400 dark:text-gray-500 transition-transform duration-200"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -765,7 +1018,7 @@
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "{{loc === 'ko' ? '한국어' : loc === 'en' ? 'English' : loc}}"
|
||||
"text": "{{_global.appConfig?.localeNames?.[loc] ?? loc}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1425,13 +1678,207 @@
|
||||
"maxVisibleBoards": 5,
|
||||
"availableLocales": "{{$locales}}",
|
||||
"currentLocale": "{{$locale}}",
|
||||
"className": "hidden"
|
||||
"className": "hidden",
|
||||
"notifications": "{{(notifications?.data?.data ?? []).map(n => ({ id: n.id, title: n.subject ?? '', message: n.body ?? '', time: n.created_at ?? '', read: !!n.read_at, url: n.url ?? '', data: n.data ?? {} }))}}",
|
||||
"notificationHasMore": "{{_global.notificationsHasMore ?? notifications?.data?.pagination?.has_more_pages ?? false}}",
|
||||
"notificationLoading": "{{_global.notificationsLoadingMore ?? notifications?.loading ?? false}}",
|
||||
"notificationUnreadOnly": "{{_global.notificationsUnreadOnly ?? true}}"
|
||||
},
|
||||
"responsive": {
|
||||
"desktop": {
|
||||
"props": { "className": "block" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"event": "onNotificationClose",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/read-batch",
|
||||
"params": {
|
||||
"method": "POST",
|
||||
"body": { "ids": "{{$args[0]}}" }
|
||||
},
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onNotificationClick",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/{{$args[0].id}}/read",
|
||||
"params": { "method": "PATCH" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"handler": "navigate",
|
||||
"if": "{{$args[0].url}}",
|
||||
"params": { "path": "{{$args[0].url ?? '/mypage/notifications'}}" }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onNotificationMarkAllRead",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/read-all",
|
||||
"params": { "method": "POST" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null,
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onNotificationUnreadOnlyToggle",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsUnreadOnly": "{{$args[0]}}",
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null,
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"event": "onNotificationDelete",
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/{{$args[0].id}}",
|
||||
"params": { "method": "DELETE" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"event": "onNotificationDeleteAll",
|
||||
"handler": "openModal",
|
||||
"target": "notification_delete_all_confirm_modal"
|
||||
},
|
||||
{
|
||||
"event": "onNotificationLoadMore",
|
||||
"handler": "sequence",
|
||||
"params": {
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsLoadingMore": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications",
|
||||
"params": {
|
||||
"method": "GET",
|
||||
"query": {
|
||||
"page": "{{(_global.notificationsCurrentPage ?? notifications?.data?.pagination?.current_page ?? 1) + 1}}",
|
||||
"per_page": 15
|
||||
}
|
||||
},
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "appendDataSource",
|
||||
"params": {
|
||||
"dataSourceId": "notifications",
|
||||
"dataPath": "data.data",
|
||||
"newData": "{{response.data.data ?? []}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsCurrentPage": "{{response.data.pagination.current_page}}",
|
||||
"notificationsHasMore": "{{response.data.pagination.has_more_pages}}",
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"onError": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "=== 메인 콘텐츠 영역 ===",
|
||||
@@ -1479,5 +1926,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"modals": [
|
||||
{
|
||||
"partial": "partials/_modal_notification_delete_all_confirm.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,7 +6,15 @@
|
||||
"meta": {
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-board" }
|
||||
],
|
||||
"data_sources": ["boardList"],
|
||||
"page_type": "boards",
|
||||
"toggle_setting": "$module_settings:sirsoft-board:seo.seo_boards",
|
||||
"vars": {
|
||||
"site_name": "$core_settings:general.site_name"
|
||||
},
|
||||
"priority": 0.5,
|
||||
"changefreq": "weekly",
|
||||
"og": {
|
||||
@@ -24,7 +32,7 @@
|
||||
"endpoint": "/api/modules/sirsoft-board/boards",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"auth_mode": "optional",
|
||||
"refetchOnMount": true,
|
||||
"errorHandling": {
|
||||
"403": {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"endpoint": "/api/modules/sirsoft-board/boards/{{route.slug}}/posts/form-data",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"auth_mode": "optional",
|
||||
"cache": false,
|
||||
"refetchOnMount": true,
|
||||
"initLocal": "form",
|
||||
@@ -54,7 +54,7 @@
|
||||
"endpoint": "/api/modules/sirsoft-board/boards/{{route.slug}}/posts/form-meta",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"auth_mode": "optional",
|
||||
"cache": false,
|
||||
"refetchOnMount": true,
|
||||
"params": {
|
||||
|
||||
@@ -6,11 +6,22 @@
|
||||
"meta": {
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-board" }
|
||||
],
|
||||
"data_sources": ["posts"],
|
||||
"page_type": "board",
|
||||
"toggle_setting": "$module_settings:sirsoft-board:seo.seo_board",
|
||||
"vars": {
|
||||
"site_name": "$core_settings:general.site_name",
|
||||
"board_name": "{{posts.data.board.name ?? ''}}",
|
||||
"board_description": "{{posts.data.board.description ?? ''}}"
|
||||
},
|
||||
"priority": 0.6,
|
||||
"changefreq": "daily",
|
||||
"og": {
|
||||
"type": "website"
|
||||
"type": "website",
|
||||
"description": "{{_seo.board.description ?? posts.data.board.description ?? ''}}"
|
||||
},
|
||||
"structured_data": {
|
||||
"@type": "ItemList"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"limit": 20
|
||||
},
|
||||
"auto_fetch": true,
|
||||
"auth_required": true,
|
||||
"auth_required": false,
|
||||
"refetchOnMount": true,
|
||||
"errorHandling": {
|
||||
"403": {
|
||||
@@ -182,14 +182,14 @@
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"props": {
|
||||
"className": "{{(query.period ?? 'week') === 'all' ? 'px-4 py-2 bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded-lg font-medium' : 'px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}"
|
||||
"className": "{{(query.period ?? 'week') === 'year' ? 'px-4 py-2 bg-gray-900 dark:bg-white text-white dark:text-gray-900 rounded-lg font-medium' : 'px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Icon",
|
||||
"props": {
|
||||
"name": "list",
|
||||
"name": "calendar-alt",
|
||||
"size": "sm",
|
||||
"className": "mr-1.5 inline"
|
||||
}
|
||||
@@ -197,7 +197,7 @@
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "$t:board.popular.all"
|
||||
"text": "$t:board.popular.year"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
@@ -205,7 +205,7 @@
|
||||
"type": "click",
|
||||
"handler": "navigate",
|
||||
"params": {
|
||||
"path": "/boards/popular?period=all"
|
||||
"path": "/boards/popular?period=year"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -6,17 +6,27 @@
|
||||
"meta": {
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-board" }
|
||||
],
|
||||
"data_sources": ["post"],
|
||||
"page_type": "post",
|
||||
"toggle_setting": "$module_settings:sirsoft-board:seo.seo_post_detail",
|
||||
"vars": {
|
||||
"site_name": "$core_settings:general.site_name",
|
||||
"board_name": "{{post.data.board.name ?? ''}}",
|
||||
"post_title": "{{post.data.title ?? ''}}"
|
||||
},
|
||||
"priority": 0.5,
|
||||
"changefreq": "monthly",
|
||||
"og": {
|
||||
"type": "article",
|
||||
"title": "{{post.data.title ?? ''}}",
|
||||
"description": "{{post.data.content ?? ''}}"
|
||||
"title": "{{_seo.post.title ?? post.data.title ?? ''}}",
|
||||
"description": "{{_seo.post.description ?? post.data.content ?? ''}}"
|
||||
},
|
||||
"structured_data": {
|
||||
"@type": "Article",
|
||||
"headline": "{{post.data.title ?? ''}}",
|
||||
"headline": "{{_seo.post.title ?? post.data.title ?? ''}}",
|
||||
"datePublished": "{{post.data.created_at ?? ''}}",
|
||||
"dateModified": "{{post.data.updated_at ?? ''}}"
|
||||
}
|
||||
@@ -55,6 +65,18 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "navigation",
|
||||
"type": "api",
|
||||
"endpoint": "/api/modules/sirsoft-board/boards/{{route.slug}}/posts/{{route.id}}/navigation",
|
||||
"method": "GET",
|
||||
"params": {
|
||||
"del": "{{query.del ?? ''}}"
|
||||
},
|
||||
"auto_fetch": true,
|
||||
"auth_mode": "optional",
|
||||
"refetchOnMount": true
|
||||
}
|
||||
],
|
||||
"computed": {
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
"endpoint": "/api/modules/sirsoft-board/me/activity-stats",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"auth_required": true
|
||||
"auth_required": true,
|
||||
"lazy": true,
|
||||
"blur_until_loaded": true
|
||||
},
|
||||
{
|
||||
"id": "myPosts",
|
||||
|
||||
@@ -19,10 +19,16 @@
|
||||
{
|
||||
"id": "userNotifications",
|
||||
"type": "api",
|
||||
"endpoint": "/api/notifications?page={{_local.notificationsPage ?? 1}}",
|
||||
"endpoint": "/api/user/notifications",
|
||||
"method": "GET",
|
||||
"auto_fetch": true,
|
||||
"loading_strategy": "progressive"
|
||||
"auth_required": true,
|
||||
"loading_strategy": "progressive",
|
||||
"params": {
|
||||
"page": "{{_local.notificationsPage ?? 1}}",
|
||||
"sort_order": "desc",
|
||||
"read": "{{_local.userNotificationsUnreadOnly ? 'unread' : 'all'}}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"init_actions": [
|
||||
@@ -30,7 +36,8 @@
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "local",
|
||||
"notificationsPage": 1
|
||||
"notificationsPage": 1,
|
||||
"userNotificationsUnreadOnly": false
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -122,25 +122,7 @@
|
||||
"props": {
|
||||
"className": "px-2 py-0.5 text-xs font-medium bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded"
|
||||
},
|
||||
"text": "v{{page?.data?.version ?? '1'}}.0"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"if": "{{page?.data?.status === 'draft'}}",
|
||||
"props": {
|
||||
"className": "px-2 py-0.5 text-xs font-medium bg-yellow-100 dark:bg-yellow-900 text-yellow-700 dark:text-yellow-300 rounded"
|
||||
},
|
||||
"text": "$t:user.page.status_draft"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"if": "{{page?.data?.status === 'archived'}}",
|
||||
"props": {
|
||||
"className": "px-2 py-0.5 text-xs font-medium bg-orange-100 dark:bg-orange-900 text-orange-700 dark:text-orange-300 rounded"
|
||||
},
|
||||
"text": "$t:user.page.status_archived"
|
||||
"text": "v{{page?.data?.current_version ?? 1}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -189,13 +171,24 @@
|
||||
},
|
||||
{
|
||||
"id": "page_html_content",
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"props": {
|
||||
"content": "{{page?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(page?.data?.content_mode ?? 'html') === 'html'}}",
|
||||
"className": "text-gray-700 dark:text-gray-300"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{page?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(page?.data?.content_mode ?? 'html') === 'html'}}",
|
||||
"className": "text-gray-700 dark:text-gray-300"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "page_attachments_section",
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
{
|
||||
"meta": {
|
||||
"is_partial": true,
|
||||
"description": "알림 전체 삭제 확인 모달 (User)"
|
||||
},
|
||||
"id": "notification_delete_all_confirm_modal",
|
||||
"type": "composite",
|
||||
"name": "Modal",
|
||||
"props": {
|
||||
"title": "$t:mypage.notifications.delete_all_title",
|
||||
"size": "small"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "P",
|
||||
"props": {
|
||||
"className": "text-gray-700 dark:text-gray-300"
|
||||
},
|
||||
"text": "$t:mypage.notifications.delete_all_confirm"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": {
|
||||
"className": "flex justify-end gap-3 mt-6"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"props": {
|
||||
"className": "px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",
|
||||
"disabled": "{{_global.isDeletingAllNotifications}}",
|
||||
"type": "button"
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
"handler": "closeModal",
|
||||
"target": "notification_delete_all_confirm_modal"
|
||||
}
|
||||
],
|
||||
"text": "$t:common.cancel"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"props": {
|
||||
"className": "flex items-center gap-2 px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed",
|
||||
"disabled": "{{_global.isDeletingAllNotifications}}",
|
||||
"type": "button"
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
"handler": "sequence",
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"isDeletingAllNotifications": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/user/notifications/all",
|
||||
"params": { "method": "DELETE" },
|
||||
"onSuccess": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"isDeletingAllNotifications": false,
|
||||
"notificationsCurrentPage": 1,
|
||||
"notificationsHasMore": null,
|
||||
"notificationsLoadingMore": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "toast",
|
||||
"params": {
|
||||
"type": "success",
|
||||
"message": "$t:mypage.notifications.delete_all_success"
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notifications" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "notification_unread_count" }
|
||||
},
|
||||
{
|
||||
"handler": "refetchDataSource",
|
||||
"params": { "dataSourceId": "userNotifications" }
|
||||
},
|
||||
{
|
||||
"handler": "closeModal",
|
||||
"target": "notification_delete_all_confirm_modal"
|
||||
}
|
||||
],
|
||||
"onError": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "global",
|
||||
"isDeletingAllNotifications": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"handler": "toast",
|
||||
"params": {
|
||||
"type": "error",
|
||||
"message": "{{error.message ?? $t:mypage.notifications.delete_all_failed}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Icon",
|
||||
"if": "{{_global.isDeletingAllNotifications}}",
|
||||
"props": {
|
||||
"name": "spinner",
|
||||
"className": "w-4 h-4 animate-spin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "{{_global.isDeletingAllNotifications ? $t:common.deleting : $t:common.delete}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -55,13 +55,25 @@
|
||||
"props": { "className": "flex-1 overflow-y-auto min-h-0 max-h-96" },
|
||||
"children": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"id": "privacy_html_content",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"props": {
|
||||
"content": "{{privacyContent?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(privacyContent?.data?.content_mode ?? 'html') === 'html'}}",
|
||||
"className": "prose dark:prose-invert prose-sm max-w-none text-gray-700 dark:text-gray-300"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{privacyContent?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(privacyContent?.data?.content_mode ?? 'html') === 'html'}}",
|
||||
"className": "prose dark:prose-invert prose-sm max-w-none text-gray-700 dark:text-gray-300"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -55,13 +55,25 @@
|
||||
"props": { "className": "flex-1 overflow-y-auto min-h-0 max-h-96" },
|
||||
"children": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"id": "terms_html_content",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"props": {
|
||||
"content": "{{termsContent?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(termsContent?.data?.content_mode ?? 'html') === 'html'}}",
|
||||
"className": "prose dark:prose-invert prose-sm max-w-none text-gray-700 dark:text-gray-300"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{termsContent?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(termsContent?.data?.content_mode ?? 'html') === 'html'}}",
|
||||
"className": "prose dark:prose-invert prose-sm max-w-none text-gray-700 dark:text-gray-300"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -321,7 +321,7 @@
|
||||
"name": "Select",
|
||||
"props": {
|
||||
"name": "language",
|
||||
"options": "{{($locales ?? []).map(l => ({ value: l, label: $t('languages.' + l) }))}}",
|
||||
"options": "{{($locales ?? []).map(l => ({ value: l, label: _global.appConfig?.localeNames?.[l] ?? l }))}}",
|
||||
"className": "w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
||||
"disabled": "{{_local?.isRegistering}}"
|
||||
}
|
||||
|
||||
@@ -123,13 +123,24 @@
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"props": {
|
||||
"content": "{{form_meta?.data?.parent_post?.content}}",
|
||||
"content": "{{form_meta?.data?.parent_post?.content ?? ''}}",
|
||||
"isHtml": "{{(form_meta?.data?.parent_post?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "{{_local.parentPostExpanded ? '' : 'line-clamp-3'}} text-sm text-gray-600 dark:text-gray-300 mb-2"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{form_meta?.data?.parent_post?.content ?? ''}}",
|
||||
"isHtml": "{{(form_meta?.data?.parent_post?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "{{_local.parentPostExpanded ? '' : 'line-clamp-3'}} text-sm text-gray-600 dark:text-gray-300 mb-2"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
|
||||
@@ -498,9 +498,11 @@
|
||||
"event": "change",
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "_local",
|
||||
"key": "form.category",
|
||||
"value": "{{$event.target.value}}"
|
||||
"target": "local",
|
||||
"form": {
|
||||
"category": "{{$event.target.value}}"
|
||||
},
|
||||
"hasChanges": true
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -565,28 +567,44 @@
|
||||
"children": [
|
||||
{
|
||||
"comment": "내용 에디터",
|
||||
"type": "composite",
|
||||
"name": "HtmlEditor",
|
||||
"id": "content_section",
|
||||
"type": "extension_point",
|
||||
"name": "html_editor",
|
||||
"props": {
|
||||
"name": "content",
|
||||
"content": "{{_local.form?.content ?? ''}}",
|
||||
"isHtml": "{{(_local.form?.content_mode ?? 'text') === 'html'}}",
|
||||
"rows": 15,
|
||||
"placeholder": "$t:board.form.content_placeholder",
|
||||
"label": "$t:board.form.content",
|
||||
"showHtmlModeToggle": true,
|
||||
"name": "content"
|
||||
"showHtmlModeToggle": true
|
||||
},
|
||||
"actions": [
|
||||
"default": [
|
||||
{
|
||||
"event": "onIsHtmlChange",
|
||||
"type": "change",
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "local",
|
||||
"form": {
|
||||
"content_mode": "{{$args[0].target.checked ? 'html' : 'text'}}"
|
||||
"type": "composite",
|
||||
"name": "HtmlEditor",
|
||||
"props": {
|
||||
"name": "content",
|
||||
"content": "{{_local.form?.content ?? ''}}",
|
||||
"isHtml": "{{(_local.form?.content_mode ?? 'text') === 'html'}}",
|
||||
"rows": 15,
|
||||
"placeholder": "$t:board.form.content_placeholder",
|
||||
"label": "$t:board.form.content",
|
||||
"showHtmlModeToggle": true
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"event": "onIsHtmlChange",
|
||||
"type": "change",
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "local",
|
||||
"form": {
|
||||
"content_mode": "{{$args[0].target.checked ? 'html' : 'text'}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"type": "composite",
|
||||
"type": "basic",
|
||||
"name": "Icon",
|
||||
"props": {
|
||||
"name": "list",
|
||||
@@ -62,7 +62,7 @@
|
||||
"comment": "이전글 버튼 - 아이콘 + 텍스트",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{post?.data?.navigation?.prev?.id}}",
|
||||
"if": "{{navigation?.data?.prev?.id}}",
|
||||
"props": {
|
||||
"className": "flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 dark:text-white bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 transition-all shadow-sm cursor-pointer"
|
||||
},
|
||||
@@ -71,7 +71,7 @@
|
||||
"type": "click",
|
||||
"handler": "navigate",
|
||||
"params": {
|
||||
"path": "/board/{{route.slug}}/{{post.data.navigation.prev.id}}",
|
||||
"path": "/board/{{route.slug}}/{{navigation.data.prev.id}}",
|
||||
"query": {
|
||||
"del": "{{query.del ?? ''}}"
|
||||
}
|
||||
@@ -98,7 +98,7 @@
|
||||
"comment": "다음글 버튼 - 아이콘 + 텍스트",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{post?.data?.navigation?.next?.id}}",
|
||||
"if": "{{navigation?.data?.next?.id}}",
|
||||
"props": {
|
||||
"className": "flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 dark:text-white bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 transition-all shadow-sm cursor-pointer"
|
||||
},
|
||||
@@ -107,7 +107,7 @@
|
||||
"type": "click",
|
||||
"handler": "navigate",
|
||||
"params": {
|
||||
"path": "/board/{{route.slug}}/{{post.data.navigation.next.id}}",
|
||||
"path": "/board/{{route.slug}}/{{navigation.data.next.id}}",
|
||||
"query": {
|
||||
"del": "{{query.del ?? ''}}"
|
||||
}
|
||||
|
||||
@@ -243,14 +243,26 @@
|
||||
},
|
||||
{
|
||||
"comment": "일반 글 내용",
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"id": "reply_html_content",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"if": "{{reply?.status !== 'blinded' && !reply?.is_secret}}",
|
||||
"props": {
|
||||
"content": "{{reply?.content ?? ''}}",
|
||||
"isHtml": "{{(reply?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose-sm dark:prose-invert max-w-none {{_local?.expandedReplyId === reply?.id ? '' : '[&_img]:hidden [&_table]:hidden'}}"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{reply?.content ?? ''}}",
|
||||
"isHtml": "{{(reply?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose-sm dark:prose-invert max-w-none {{_local?.expandedReplyId === reply?.id ? '' : '[&_img]:hidden [&_table]:hidden'}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -390,14 +390,26 @@
|
||||
},
|
||||
{
|
||||
"comment": "일반 글인 경우 - 내용",
|
||||
"id": "parent_post_html_content",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"if": "{{post?.data?.parent?.status !== 'blinded' && !(post?.data?.parent?.is_secret && post?.data?.parent?.content === null)}}",
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{post?.data?.parent?.content ?? ''}}",
|
||||
"isHtml": "{{(post?.data?.parent?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "{{_local?.parentContentExpanded ? '' : '[&_img]:hidden [&_table]:hidden'}}"
|
||||
}
|
||||
"className": "{{_local?.parentContentExpanded ? 'prose dark:prose-invert max-w-none' : '[&_img]:hidden [&_table]:hidden'}}"
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{post?.data?.parent?.content ?? ''}}",
|
||||
"isHtml": "{{(post?.data?.parent?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "{{_local?.parentContentExpanded ? 'prose dark:prose-invert max-w-none' : '[&_img]:hidden [&_table]:hidden'}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -570,13 +582,24 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"props": {
|
||||
"content": "{{post?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(post?.data?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose dark:prose-invert max-w-none"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{post?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(post?.data?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose dark:prose-invert max-w-none"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -819,14 +842,25 @@
|
||||
},
|
||||
{
|
||||
"comment": "게시글 내용 (정상)",
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"if": "{{post?.data?.status !== 'blinded' && post?.data?.content !== null}}",
|
||||
"props": {
|
||||
"content": "{{post?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(post?.data?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose dark:prose-invert max-w-none mb-6"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{post?.data?.content ?? ''}}",
|
||||
"isHtml": "{{(post?.data?.content_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose dark:prose-invert max-w-none mb-6"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"text": "{{item.name}}",
|
||||
"actions": [{ "type": "click", "handler": "navigate", "params": { "path": "/board/{{item.slug}}" } }]
|
||||
},
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-1 rounded" }, "text": "{{item.posts_count}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-1 rounded" }, "text": "{{item.posts_count | number}}" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm font-medium text-gray-900 dark:text-white" }, "text": "{{board.name}}" }
|
||||
]
|
||||
},
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-1 rounded" }, "text": "{{board.posts_count}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-xs font-medium text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 px-2 py-1 rounded" }, "text": "{{board.posts_count | number}}" }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
"comment": "수정 버튼",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{address.abilities?.can_update === true}}",
|
||||
"props": {
|
||||
"type": "button",
|
||||
"className": "px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
},
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"blur_until_loaded": {
|
||||
"enabled": true,
|
||||
"data_sources": ["myPosts", "myActivityStats"]
|
||||
},
|
||||
"props": {
|
||||
"className": "mt-6"
|
||||
},
|
||||
@@ -50,6 +46,10 @@
|
||||
"comment": "통계 카드 3개",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"blur_until_loaded": {
|
||||
"enabled": true,
|
||||
"data_sources": ["myActivityStats"]
|
||||
},
|
||||
"props": {
|
||||
"className": "grid grid-cols-3 gap-4 mb-6"
|
||||
},
|
||||
@@ -289,6 +289,10 @@
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"if": "{{(_global.boardActivitySubTab ?? 'my-posts') === 'my-posts'}}",
|
||||
"blur_until_loaded": {
|
||||
"enabled": true,
|
||||
"data_sources": ["myPosts"]
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"partial": "partials/mypage/board/_my_posts.json"
|
||||
@@ -300,6 +304,10 @@
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"if": "{{(_global.boardActivitySubTab ?? 'my-posts') === 'my-comments'}}",
|
||||
"blur_until_loaded": {
|
||||
"enabled": true,
|
||||
"data_sources": ["myComments"]
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"partial": "partials/mypage/board/_my_comments.json"
|
||||
|
||||
@@ -33,11 +33,58 @@
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"comment": "읽지 않은 알림 카운트",
|
||||
"comment": "좌측: 카운트 + 안 읽은 알림만 필터",
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-sm text-red-500 dark:text-red-400 font-medium" },
|
||||
"text": "$t:mypage.notifications.unread_count|count={{userNotifications.data?.unread_count ?? 0}}"
|
||||
"name": "Div",
|
||||
"props": { "className": "flex items-center gap-4" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-sm text-red-500 dark:text-red-400 font-medium" },
|
||||
"text": "$t:mypage.notifications.unread_count|count={{userNotifications.data?.unread_count ?? 0}}"
|
||||
},
|
||||
{
|
||||
"comment": "안 읽은 알림만 필터 토글",
|
||||
"type": "basic",
|
||||
"name": "Label",
|
||||
"props": { "className": "flex items-center gap-1.5 cursor-pointer select-none" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Input",
|
||||
"props": {
|
||||
"type": "checkbox",
|
||||
"checked": "{{_local.userNotificationsUnreadOnly ?? false}}",
|
||||
"className": "w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 cursor-pointer"
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "change",
|
||||
"handler": "sequence",
|
||||
"actions": [
|
||||
{
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
"target": "local",
|
||||
"userNotificationsUnreadOnly": "{{$event.target.checked}}",
|
||||
"notificationsPage": 1
|
||||
}
|
||||
},
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "userNotifications" } }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-xs text-gray-600 dark:text-gray-400" },
|
||||
"text": "$t:mypage.notifications.unread_only"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "액션 버튼 그룹",
|
||||
@@ -54,17 +101,18 @@
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{userNotifications.data.data && userNotifications.data.data.length > 0}}",
|
||||
"props": { "className": "text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors" },
|
||||
"props": { "className": "text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors", "type": "button" },
|
||||
"text": "$t:mypage.notifications.mark_all_read",
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/notifications/read-all",
|
||||
"params": { "method": "PUT" },
|
||||
"target": "/api/user/notifications/read-all",
|
||||
"params": { "method": "POST" },
|
||||
"onSuccess": [
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "userNotifications" } },
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "notification_unread_count" } },
|
||||
{ "handler": "setState", "params": { "target": "global", "notificationCount": 0 } }
|
||||
]
|
||||
}
|
||||
@@ -74,26 +122,13 @@
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{userNotifications.data.data && userNotifications.data.data.length > 0}}",
|
||||
"props": { "className": "text-sm text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 transition-colors" },
|
||||
"props": { "className": "text-sm text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 transition-colors", "type": "button" },
|
||||
"text": "$t:mypage.notifications.delete_all",
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
"handler": "confirm",
|
||||
"params": { "message": "$t:mypage.notifications.delete_all_confirm" },
|
||||
"onConfirm": [
|
||||
{
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/notifications",
|
||||
"params": { "method": "DELETE" },
|
||||
"onSuccess": [
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "userNotifications" } },
|
||||
{ "handler": "setState", "params": { "target": "global", "notificationCount": 0 } },
|
||||
{ "handler": "toast", "params": { "type": "success", "message": "$t:mypage.notifications.all_deleted" } }
|
||||
]
|
||||
}
|
||||
]
|
||||
"handler": "openModal",
|
||||
"target": "notification_delete_all_confirm_modal"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -132,16 +167,17 @@
|
||||
"handler": "apiCall",
|
||||
"if": "{{!notification.read_at}}",
|
||||
"auth_required": true,
|
||||
"target": "/api/notifications/{{notification.id}}/read",
|
||||
"params": { "method": "PUT" },
|
||||
"target": "/api/user/notifications/{{notification.id}}/read",
|
||||
"params": { "method": "PATCH" },
|
||||
"onSuccess": [
|
||||
{ "handler": "setState", "params": { "target": "global", "notificationCount": "{{Math.max(0, _global.notificationCount - 1)}}" } }
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "notification_unread_count" } },
|
||||
{ "handler": "setState", "params": { "target": "global", "notificationCount": "{{Math.max(0, (_global.notificationCount ?? 0) - 1)}}" } }
|
||||
]
|
||||
},
|
||||
{
|
||||
"handler": "navigate",
|
||||
"if": "{{notification.link}}",
|
||||
"target": "{{notification.link}}"
|
||||
"if": "{{notification.url}}",
|
||||
"params": { "path": "{{notification.url}}" }
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -221,16 +257,17 @@
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-sm text-gray-900 dark:text-white truncate {{notification.read_at ? '' : 'font-semibold'}}" },
|
||||
"text": "{{notification.title}}"
|
||||
"text": "{{notification.subject ?? ''}}"
|
||||
},
|
||||
{
|
||||
"comment": "타입 태그",
|
||||
"comment": "타입 태그 — type_label은 BE의 NotificationDefinition.name(다국어)에서 해석된 값. 미정의 type은 식별자 fallback",
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"if": "{{notification.type_label}}",
|
||||
"props": {
|
||||
"className": "flex-shrink-0 px-2 py-0.5 text-xs rounded {{notification.type === 'order' ? 'bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300' : notification.type === 'comment' ? 'bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300' : notification.type === 'shipping' ? 'bg-orange-100 dark:bg-orange-900/50 text-orange-700 dark:text-orange-300' : notification.type === 'promotion' ? 'bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300' : 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300'}}"
|
||||
},
|
||||
"text": "$t:mypage.notifications.type.{{notification.type}}"
|
||||
"text": "{{notification.type_label}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -238,7 +275,7 @@
|
||||
"comment": "삭제 버튼",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"props": { "className": "flex-shrink-0 p-1.5 text-gray-400 hover:text-red-500 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors" },
|
||||
"props": { "className": "flex-shrink-0 p-1.5 text-gray-400 dark:text-gray-500 hover:text-red-500 dark:hover:text-red-400 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors", "type": "button" },
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "trash-can", "className": "w-4 h-4" } }
|
||||
],
|
||||
@@ -251,14 +288,15 @@
|
||||
"type": "click",
|
||||
"handler": "apiCall",
|
||||
"auth_required": true,
|
||||
"target": "/api/notifications/{{notification.id}}",
|
||||
"target": "/api/user/notifications/{{notification.id}}",
|
||||
"params": { "method": "DELETE" },
|
||||
"onSuccess": [
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "userNotifications" } },
|
||||
{ "handler": "refetchDataSource", "params": { "dataSourceId": "notification_unread_count" } },
|
||||
{
|
||||
"handler": "setState",
|
||||
"if": "{{!notification.read_at}}",
|
||||
"params": { "target": "global", "notificationCount": "{{Math.max(0, _global.notificationCount - 1)}}" }
|
||||
"params": { "target": "global", "notificationCount": "{{Math.max(0, (_global.notificationCount ?? 0) - 1)}}" }
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -271,7 +309,7 @@
|
||||
"type": "basic",
|
||||
"name": "P",
|
||||
"props": { "className": "text-sm text-gray-600 dark:text-gray-400 mb-1" },
|
||||
"text": "{{notification.message}}"
|
||||
"text": "{{notification.body ?? ''}}"
|
||||
},
|
||||
{
|
||||
"comment": "날짜",
|
||||
|
||||
@@ -244,12 +244,13 @@
|
||||
"comment": "모바일: 상태 뱃지 + 배송정보 (인라인)",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "hidden" },
|
||||
"if": "{{true}}",
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "flex flex-wrap items-center gap-2 mt-2" }
|
||||
"desktop": {
|
||||
"if": "{{false}}"
|
||||
}
|
||||
},
|
||||
"props": { "className": "flex flex-wrap items-center gap-2 mt-2" },
|
||||
"children": [
|
||||
{
|
||||
"comment": "상태 뱃지 (모바일)",
|
||||
@@ -274,12 +275,13 @@
|
||||
"comment": "모바일: 구매확정/리뷰 버튼",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "hidden" },
|
||||
"if": "{{true}}",
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "flex gap-2 mt-2" }
|
||||
"desktop": {
|
||||
"if": "{{false}}"
|
||||
}
|
||||
},
|
||||
"props": { "className": "flex gap-2 mt-2" },
|
||||
"children": [
|
||||
{
|
||||
"comment": "구매확정 버튼 (모바일)",
|
||||
@@ -574,27 +576,28 @@
|
||||
"comment": "상태 뱃지 (PC만 표시)",
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"if": "{{false}}",
|
||||
"responsive": {
|
||||
"desktop": {
|
||||
"if": "{{true}}"
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"className": "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium {{item.option_status_variant === 'success' ? 'bg-green-100 text-green-600 dark:bg-green-900/30 dark:text-green-400' : item.option_status_variant === 'danger' ? 'bg-red-100 text-red-600 dark:bg-red-900/30 dark:text-red-400' : item.option_status_variant === 'warning' ? 'bg-yellow-100 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400' : item.option_status_variant === 'secondary' ? 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300' : 'bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400'}}"
|
||||
},
|
||||
"text": "{{item.option_status_label ?? ''}}",
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "hidden" }
|
||||
}
|
||||
}
|
||||
"text": "{{item.option_status_label ?? ''}}"
|
||||
},
|
||||
{
|
||||
"comment": "배송사 + 운송장번호 (PC만 표시)",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"if": "{{!!item.carrier_name}}",
|
||||
"props": { "className": "flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400" },
|
||||
"if": "{{false}}",
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "hidden" }
|
||||
"desktop": {
|
||||
"if": "{{!!item.carrier_name}}"
|
||||
}
|
||||
},
|
||||
"props": { "className": "flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
@@ -619,16 +622,16 @@
|
||||
"comment": "구매확정 버튼 (PC)",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{item.can_confirm === true}}",
|
||||
"if": "{{false}}",
|
||||
"responsive": {
|
||||
"desktop": {
|
||||
"if": "{{item.can_confirm === true}}"
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"type": "button",
|
||||
"className": "px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-xs font-medium rounded-lg transition-colors cursor-pointer"
|
||||
},
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "hidden" }
|
||||
}
|
||||
},
|
||||
"text": "$t:mypage.order_detail.confirm_purchase",
|
||||
"actions": [
|
||||
{
|
||||
@@ -664,16 +667,16 @@
|
||||
"comment": "리뷰작성 버튼 (PC)",
|
||||
"type": "basic",
|
||||
"name": "Button",
|
||||
"if": "{{item.can_write_review === true}}",
|
||||
"if": "{{false}}",
|
||||
"responsive": {
|
||||
"desktop": {
|
||||
"if": "{{item.can_write_review === true}}"
|
||||
}
|
||||
},
|
||||
"props": {
|
||||
"type": "button",
|
||||
"className": "px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-xs font-medium rounded-lg transition-colors cursor-pointer"
|
||||
},
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "hidden" }
|
||||
}
|
||||
},
|
||||
"text": "$t:mypage.order_detail.write_review",
|
||||
"actions": [
|
||||
{
|
||||
@@ -708,13 +711,13 @@
|
||||
"comment": "리뷰 작성 완료 뱃지 (PC)",
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"if": "{{item.has_review === true}}",
|
||||
"props": { "className": "inline-flex items-center gap-1 px-2.5 py-1 bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400 text-xs font-medium rounded-lg" },
|
||||
"if": "{{false}}",
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "hidden" }
|
||||
"desktop": {
|
||||
"if": "{{item.has_review === true}}"
|
||||
}
|
||||
},
|
||||
"props": { "className": "inline-flex items-center gap-1 px-2.5 py-1 bg-green-100 dark:bg-green-900/30 text-green-600 dark:text-green-400 text-xs font-medium rounded-lg" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
|
||||
@@ -811,7 +811,9 @@
|
||||
"name": "timezone",
|
||||
"value": "{{user.data?.timezone ?? ''}}",
|
||||
"className": "w-full",
|
||||
"options": "{{[{ label: $t('mypage.profile.timezone_placeholder'), value: '' }].concat(_global.appConfig?.supportedTimezones?.map(tz => ({ value: tz, label: $t('timezones.' + tz) })) ?? [])}}"
|
||||
"options": "{{_global.appConfig?.supportedTimezones ?? []}}",
|
||||
"searchable": true,
|
||||
"searchPlaceholder": "{{$t('common.search')}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
"props": { "className": "text-sm text-gray-600 dark:text-gray-400" },
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-blue-600 dark:text-blue-400 font-medium" }, "text": "\"{{query?.q}}\"" },
|
||||
{ "type": "basic", "name": "Span", "text": " $t:search.result_summary|count={{searchResults?.data?.total ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "text": " $t:search.results" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "font-medium" }, "text": " {{(searchResults.data.total ?? 0) | number}}" },
|
||||
{ "type": "basic", "name": "Span", "text": "$t:search.result_count_suffix" }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "grid", "size": "sm", "className": "mr-1.5 inline" } },
|
||||
{ "type": "basic", "name": "Span", "text": "$t:search.tabs.all" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{(_global.searchActiveTab ?? 'all') === 'all' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{searchResults.data.all_count ?? searchResults.data.total ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{(_global.searchActiveTab ?? 'all') === 'all' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{(searchResults.data.all_count ?? searchResults.data.total ?? 0) | number}}" }
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
@@ -32,7 +32,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "file-text", "size": "sm", "className": "mr-1.5 inline" } },
|
||||
{ "type": "basic", "name": "Span", "text": "$t:search.tabs.posts" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{_global.searchActiveTab === 'posts' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{searchResults.data.posts_count ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{_global.searchActiveTab === 'posts' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{(searchResults.data.posts_count ?? 0) | number}}" }
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
@@ -52,7 +52,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "shopping-bag", "size": "sm", "className": "mr-1.5 inline" } },
|
||||
{ "type": "basic", "name": "Span", "text": "$t:search.tabs.products" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{_global.searchActiveTab === 'products' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{searchResults.data.products_count ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{_global.searchActiveTab === 'products' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{(searchResults.data.products_count ?? 0) | number}}" }
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
@@ -72,7 +72,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "file-alt", "size": "sm", "className": "mr-1.5 inline" } },
|
||||
{ "type": "basic", "name": "Span", "text": "$t:search.tabs.pages" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{_global.searchActiveTab === 'pages' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{searchResults.data.pages_count ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "ml-1.5 {{_global.searchActiveTab === 'pages' ? 'text-blue-600 dark:text-blue-400' : 'text-gray-500 dark:text-gray-400'}}" }, "text": "{{(searchResults.data.pages_count ?? 0) | number}}" }
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "file-alt", "size": "sm", "className": "text-gray-500 dark:text-gray-400" } },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "font-medium text-gray-900 dark:text-white" }, "text": "$t:search.tabs.pages" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm text-blue-600 dark:text-blue-400" }, "text": "{{searchResults?.data?.pages_count ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm text-blue-600 dark:text-blue-400" }, "text": "{{(searchResults?.data?.pages_count ?? 0) | number}}" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "file-text", "size": "sm", "className": "text-gray-500 dark:text-gray-400" } },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "font-medium text-gray-900 dark:text-white" }, "text": "$t:search.tabs.posts" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm text-blue-600 dark:text-blue-400" }, "text": "{{searchResults?.data?.posts_count ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm text-blue-600 dark:text-blue-400" }, "text": "{{(searchResults?.data?.posts_count ?? 0) | number}}" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"children": [
|
||||
{ "type": "basic", "name": "Icon", "props": { "name": "shopping-bag", "size": "sm", "className": "text-gray-500 dark:text-gray-400" } },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "font-medium text-gray-900 dark:text-white" }, "text": "$t:search.tabs.products" },
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm text-blue-600 dark:text-blue-400" }, "text": "{{searchResults?.data?.products_count ?? 0}}" }
|
||||
{ "type": "basic", "name": "Span", "props": { "className": "text-sm text-blue-600 dark:text-blue-400" }, "text": "{{(searchResults?.data?.products_count ?? 0) | number}}" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "bg-white dark:bg-gray-800 rounded-lg shadow p-6 sticky top-24" },
|
||||
"responsive": {
|
||||
"portable": {
|
||||
"props": { "className": "bg-white dark:bg-gray-800 rounded-lg shadow p-6" }
|
||||
}
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
|
||||
@@ -448,7 +448,9 @@
|
||||
"type": "extension_point",
|
||||
"name": "address_search_slot",
|
||||
"props": {
|
||||
"readOnlyFields": ["zipcode", "address"],
|
||||
"readOnlyFields": ["zipcode", "address"]
|
||||
},
|
||||
"callbacks": {
|
||||
"onAddressSelect": {
|
||||
"handler": "sequence",
|
||||
"actions": [
|
||||
|
||||
@@ -666,7 +666,9 @@
|
||||
"type": "extension_point",
|
||||
"name": "address_search_slot",
|
||||
"props": {
|
||||
"readOnlyFields": ["zipcode", "address"],
|
||||
"readOnlyFields": ["zipcode", "address"]
|
||||
},
|
||||
"callbacks": {
|
||||
"onAddressSelect": {
|
||||
"handler": "setState",
|
||||
"params": {
|
||||
|
||||
@@ -5,9 +5,15 @@
|
||||
"props": { "className": "space-y-4" },
|
||||
"children": [
|
||||
{
|
||||
"comment": "=== 가격 섹션 ===",
|
||||
"comment": "=== 가격 섹션 (데스크톱 전용 — 모바일은 _price_mobile.json에서 표시) ===",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"if": "{{false}}",
|
||||
"responsive": {
|
||||
"desktop": {
|
||||
"if": "{{true}}"
|
||||
}
|
||||
},
|
||||
"props": { "className": "mb-4" },
|
||||
"children": [
|
||||
{
|
||||
|
||||
@@ -5,18 +5,48 @@
|
||||
},
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "flex items-baseline gap-2" },
|
||||
"children": [
|
||||
{
|
||||
"comment": "할인 전 금액 (취소선, 할인 있을 때)",
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"name": "Div",
|
||||
"if": "{{product.data?.discount_rate > 0}}",
|
||||
"props": { "className": "text-sm text-gray-500 dark:text-gray-400 line-through" },
|
||||
"text": "{{product.data?.multi_currency_list_price?.[_global.preferredCurrency ?? 'KRW']?.formatted ?? product.data?.list_price_formatted}}"
|
||||
"props": { "className": "mb-1" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-sm text-gray-500 dark:text-gray-400 line-through" },
|
||||
"text": "{{product.data?.multi_currency_list_price?.[_global.preferredCurrency ?? 'KRW']?.formatted ?? product.data?.list_price_formatted}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "할인율 + 판매가 (할인 있을 때)",
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"name": "Div",
|
||||
"if": "{{product.data?.discount_rate > 0}}",
|
||||
"props": { "className": "flex items-center gap-2" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-lg font-bold text-red-500" },
|
||||
"text": "{{product.data?.discount_rate}}%"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"props": { "className": "text-xl font-bold text-gray-900 dark:text-white" },
|
||||
"text": "{{product.data?.multi_currency_selling_price?.[_global.preferredCurrency ?? 'KRW']?.formatted ?? product.data?.selling_price_formatted}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "판매가 (할인 없을 때)",
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"if": "{{!product.data?.discount_rate || product.data?.discount_rate <= 0}}",
|
||||
"props": { "className": "text-xl font-bold text-gray-900 dark:text-white" },
|
||||
"text": "{{product.data?.multi_currency_selling_price?.[_global.preferredCurrency ?? 'KRW']?.formatted ?? product.data?.selling_price_formatted}}"
|
||||
}
|
||||
|
||||
@@ -16,12 +16,25 @@
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"id": "product_description_html",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"props": {
|
||||
"content": "{{product.data?.description_localized ?? ''}}",
|
||||
"isHtml": "{{(product.data?.description_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose dark:prose-invert max-w-none"
|
||||
}
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{product.data?.description_localized ?? ''}}",
|
||||
"isHtml": "{{(product.data?.description_mode ?? 'text') === 'html'}}",
|
||||
"className": "prose dark:prose-invert max-w-none"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -103,13 +116,26 @@
|
||||
},
|
||||
{
|
||||
"comment": "공통정보 - HTML 모드",
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"id": "product_common_info_html",
|
||||
"type": "extension_point",
|
||||
"name": "html_content",
|
||||
"if": "{{product.data?.common_info?.content_mode === 'html'}}",
|
||||
"props": {
|
||||
"content": "{{product.data?.common_info?.content ?? ''}}",
|
||||
"className": "prose dark:prose-invert max-w-none text-sm"
|
||||
}
|
||||
"isHtml": true,
|
||||
"className": "prose prose-sm dark:prose-invert max-w-none"
|
||||
},
|
||||
"default": [
|
||||
{
|
||||
"type": "composite",
|
||||
"name": "HtmlContent",
|
||||
"props": {
|
||||
"content": "{{product.data?.common_info?.content ?? ''}}",
|
||||
"isHtml": true,
|
||||
"className": "prose prose-sm dark:prose-invert max-w-none"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "공통정보 - Text 모드 (줄바꿈 유지)",
|
||||
|
||||
@@ -72,6 +72,20 @@
|
||||
"className": "{{(_isolated.scrollIdx + 4) >= (newProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 4) >= (newProducts.data.length)}}"
|
||||
},
|
||||
"responsive": {
|
||||
"0-639": {
|
||||
"props": {
|
||||
"className": "{{(_isolated.scrollIdx + 2) >= (newProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 2) >= (newProducts.data.length)}}"
|
||||
}
|
||||
},
|
||||
"640-1023": {
|
||||
"props": {
|
||||
"className": "{{(_isolated.scrollIdx + 3) >= (newProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 3) >= (newProducts.data.length)}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
@@ -106,15 +120,14 @@
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "flex gap-4 overflow-x-hidden" },
|
||||
"props": { "className": "grid grid-flow-col auto-cols-[calc(50%_-_8px)] sm:auto-cols-[calc(33.333%_-_11px)] lg:auto-cols-[calc(25%_-_12px)] gap-4 overflow-x-hidden" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"iteration": { "source": "{{newProducts.data ?? []}}", "item_var": "product", "index_var": "idx" },
|
||||
"props": {
|
||||
"id": "new-product-{{idx}}",
|
||||
"className": "flex-none w-[calc(25%-12px)]"
|
||||
"id": "new-product-{{idx}}"
|
||||
},
|
||||
"children": [
|
||||
{ "type": "composite", "name": "ProductCard", "props": { "product": "{{product}}", "shopBase": "{{_global.shopBase ?? '/shop'}}" } }
|
||||
|
||||
@@ -72,6 +72,20 @@
|
||||
"className": "{{(_isolated.scrollIdx + 4) >= (popularProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 4) >= (popularProducts.data.length)}}"
|
||||
},
|
||||
"responsive": {
|
||||
"0-639": {
|
||||
"props": {
|
||||
"className": "{{(_isolated.scrollIdx + 2) >= (popularProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 2) >= (popularProducts.data.length)}}"
|
||||
}
|
||||
},
|
||||
"640-1023": {
|
||||
"props": {
|
||||
"className": "{{(_isolated.scrollIdx + 3) >= (popularProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 3) >= (popularProducts.data.length)}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
@@ -106,15 +120,14 @@
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "flex gap-4 overflow-x-hidden" },
|
||||
"props": { "className": "grid grid-flow-col auto-cols-[calc(50%_-_8px)] sm:auto-cols-[calc(33.333%_-_11px)] lg:auto-cols-[calc(25%_-_12px)] gap-4 overflow-x-hidden" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"iteration": { "source": "{{popularProducts.data ?? []}}", "item_var": "product", "index_var": "idx" },
|
||||
"props": {
|
||||
"id": "popular-product-{{idx}}",
|
||||
"className": "flex-none w-[calc(25%-12px)]"
|
||||
"id": "popular-product-{{idx}}"
|
||||
},
|
||||
"children": [
|
||||
{ "type": "composite", "name": "ProductCard", "props": { "product": "{{product}}", "shopBase": "{{_global.shopBase ?? '/shop'}}" } }
|
||||
|
||||
@@ -72,6 +72,20 @@
|
||||
"className": "{{(_isolated.scrollIdx + 4) >= (recentProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 4) >= (recentProducts.data.length)}}"
|
||||
},
|
||||
"responsive": {
|
||||
"0-639": {
|
||||
"props": {
|
||||
"className": "{{(_isolated.scrollIdx + 2) >= (recentProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 2) >= (recentProducts.data.length)}}"
|
||||
}
|
||||
},
|
||||
"640-1023": {
|
||||
"props": {
|
||||
"className": "{{(_isolated.scrollIdx + 3) >= (recentProducts.data.length) ? 'p-2 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-300 dark:text-gray-600 cursor-not-allowed' : 'p-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700'}}",
|
||||
"disabled": "{{(_isolated.scrollIdx + 3) >= (recentProducts.data.length)}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
"type": "click",
|
||||
@@ -106,15 +120,14 @@
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"props": { "className": "flex gap-4 overflow-x-hidden" },
|
||||
"props": { "className": "grid grid-flow-col auto-cols-[calc(50%_-_8px)] sm:auto-cols-[calc(33.333%_-_11px)] lg:auto-cols-[calc(25%_-_12px)] gap-4 overflow-x-hidden" },
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Div",
|
||||
"iteration": { "source": "{{recentProducts.data ?? []}}", "item_var": "product", "index_var": "idx" },
|
||||
"props": {
|
||||
"id": "recent-product-{{idx}}",
|
||||
"className": "flex-none w-[calc(25%-12px)]"
|
||||
"id": "recent-product-{{idx}}"
|
||||
},
|
||||
"children": [
|
||||
{ "type": "composite", "name": "ProductCard", "props": { "product": "{{product}}", "shopBase": "{{_global.shopBase ?? '/shop'}}" } }
|
||||
|
||||
@@ -6,21 +6,24 @@
|
||||
"meta": {
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-ecommerce" }
|
||||
],
|
||||
"data_sources": [],
|
||||
"page_type": "search",
|
||||
"toggle_setting": "$module_settings:seo.seo_search_result",
|
||||
"toggle_setting": "$module_settings:sirsoft-ecommerce:seo.seo_search_result",
|
||||
"vars": {
|
||||
"keyword_name": "$query:q",
|
||||
"commerce_name": "$module_settings:basic_info.shop_name",
|
||||
"site_name": "$core_settings:general.site_name"
|
||||
},
|
||||
"priority": 0.3,
|
||||
"changefreq": "daily",
|
||||
"og": {
|
||||
"type": "website"
|
||||
"type": "website",
|
||||
"title": "{{_seo.search.title ?? ''}}"
|
||||
},
|
||||
"structured_data": {
|
||||
"@type": "SearchResultsPage"
|
||||
"@type": "SearchResultsPage",
|
||||
"name": "{{_seo.search.title ?? ''}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
"description": "{{category?.data?.description_localized ?? ''}}",
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-ecommerce" }
|
||||
],
|
||||
"data_sources": ["category", "products"],
|
||||
"page_type": "category",
|
||||
"toggle_setting": "$module_settings:sirsoft-ecommerce:seo.seo_category",
|
||||
"vars": {
|
||||
"category_name": "{{category.data.name ?? ''}}",
|
||||
"commerce_name": "$module_settings:sirsoft-ecommerce:basic_info.shop_name",
|
||||
"category_description": "{{category.data.description ?? ''}}",
|
||||
"site_name": "$core_settings:general.site_name",
|
||||
"shopBase": "$module_settings:sirsoft-ecommerce:basic_info.route_path"
|
||||
},
|
||||
@@ -21,12 +24,12 @@
|
||||
"changefreq": "weekly",
|
||||
"og": {
|
||||
"type": "website",
|
||||
"title": "{{category.data.name ?? ''}}",
|
||||
"description": "{{category.data.description ?? ''}}"
|
||||
"title": "{{_seo.category.title ?? category.data.name ?? ''}}",
|
||||
"description": "{{_seo.category.description ?? category.data.description ?? ''}}"
|
||||
},
|
||||
"structured_data": {
|
||||
"@type": "ItemList",
|
||||
"name": "{{category.data.name ?? ''}}"
|
||||
"name": "{{_seo.category.title ?? category.data.name ?? ''}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,22 +6,26 @@
|
||||
"meta": {
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-ecommerce" }
|
||||
],
|
||||
"data_sources": ["products", "categories"],
|
||||
"page_type": "category",
|
||||
"toggle_setting": "$module_settings:sirsoft-ecommerce:seo.seo_category",
|
||||
"page_type": "shop_index",
|
||||
"toggle_setting": "$module_settings:sirsoft-ecommerce:seo.seo_shop_index",
|
||||
"vars": {
|
||||
"commerce_name": "$module_settings:sirsoft-ecommerce:basic_info.shop_name",
|
||||
"site_name": "$core_settings:general.site_name",
|
||||
"shopBase": "$module_settings:sirsoft-ecommerce:basic_info.route_path"
|
||||
},
|
||||
"priority": 0.7,
|
||||
"changefreq": "daily",
|
||||
"og": {
|
||||
"type": "website"
|
||||
"type": "website",
|
||||
"title": "{{_seo.shop_index.title ?? ''}}"
|
||||
},
|
||||
"structured_data": {
|
||||
"@type": "ItemList",
|
||||
"name": "$t:user.shop.index_title"
|
||||
"name": "{{_seo.shop_index.title ?? ''}}",
|
||||
"description": "{{_seo.shop_index.description ?? ''}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
"meta": {
|
||||
"seo": {
|
||||
"enabled": true,
|
||||
"extensions": [
|
||||
{ "type": "module", "id": "sirsoft-ecommerce" }
|
||||
],
|
||||
"data_sources": ["product", "popularProducts", "reviews"],
|
||||
"page_type": "product",
|
||||
"toggle_setting": "$module_settings:sirsoft-ecommerce:seo.seo_product_detail",
|
||||
"vars": {
|
||||
"product_name": "{{product.data.name ?? ''}}",
|
||||
"product_description": "{{product.data.short_description ?? product.data.description ?? ''}}",
|
||||
"commerce_name": "$module_settings:sirsoft-ecommerce:basic_info.shop_name",
|
||||
"site_name": "$core_settings:general.site_name",
|
||||
"shopBase": "$module_settings:sirsoft-ecommerce:basic_info.route_path"
|
||||
},
|
||||
@@ -20,14 +22,14 @@
|
||||
"changefreq": "daily",
|
||||
"og": {
|
||||
"type": "product",
|
||||
"title": "{{product.data.name ?? ''}}",
|
||||
"description": "{{product.data.description ?? ''}}",
|
||||
"title": "{{_seo.product.title ?? product.data.name ?? ''}}",
|
||||
"description": "{{_seo.product.description ?? product.data.description ?? ''}}",
|
||||
"image": "{{product.data.thumbnail_url ?? ''}}"
|
||||
},
|
||||
"structured_data": {
|
||||
"@type": "Product",
|
||||
"name": "{{product.data.name ?? ''}}",
|
||||
"description": "{{product.data.description ?? ''}}",
|
||||
"name": "{{_seo.product.title ?? product.data.name ?? ''}}",
|
||||
"description": "{{_seo.product.description ?? product.data.description ?? ''}}",
|
||||
"image": "{{product.data.thumbnail_url ?? ''}}",
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
|
||||
@@ -329,7 +329,7 @@
|
||||
"props": {
|
||||
"className": "text-3xl font-bold text-blue-600 dark:text-blue-400"
|
||||
},
|
||||
"text": "{{postStats.data?.posts_count ?? 0}}"
|
||||
"text": "{{postStats.data.posts_count ?? 0 | number}}"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
@@ -355,7 +355,7 @@
|
||||
"props": {
|
||||
"className": "text-3xl font-bold text-green-600 dark:text-green-400"
|
||||
},
|
||||
"text": "{{postStats.data?.comments_count ?? 0}}"
|
||||
"text": "{{postStats.data.comments_count ?? 0 | number}}"
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sirsoft-basic",
|
||||
"version": "1.0.0-beta.1",
|
||||
"version": "1.0.0-beta.2",
|
||||
"description": "Gnuboard7 Basic User Template Components - Nexibase Style",
|
||||
"type": "module",
|
||||
"main": "dist/components.js",
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* @file board-seo-meta.test.tsx
|
||||
* @description 게시판 레이아웃 SEO meta 설정 구조 검증 (이슈 #78)
|
||||
*
|
||||
* 검증 항목:
|
||||
* 1. boards.json: meta.seo.extensions, page_type, toggle_setting, vars
|
||||
* 2. index.json: meta.seo.extensions, page_type, toggle_setting, vars, _seo 바인딩
|
||||
* 3. show.json: meta.seo.extensions, page_type, toggle_setting, vars, _seo 바인딩
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import boardsLayout from '../../../layouts/board/boards.json';
|
||||
import indexLayout from '../../../layouts/board/index.json';
|
||||
import showLayout from '../../../layouts/board/show.json';
|
||||
|
||||
// JSON 내 문자열 포함 여부 검사 헬퍼
|
||||
function jsonContains(obj: unknown, str: string): boolean {
|
||||
return JSON.stringify(obj).includes(str);
|
||||
}
|
||||
|
||||
describe('boards.json - SEO meta 설정', () => {
|
||||
const seo = (boardsLayout as any).meta?.seo;
|
||||
|
||||
it('meta.seo가 존재한다', () => {
|
||||
expect(seo).toBeDefined();
|
||||
});
|
||||
|
||||
it('enabled가 true이다', () => {
|
||||
expect(seo.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('extensions에 sirsoft-board 모듈이 포함된다', () => {
|
||||
const ext = seo.extensions;
|
||||
expect(Array.isArray(ext)).toBe(true);
|
||||
const hasSirsoftBoard = ext.some(
|
||||
(e: any) => e.type === 'module' && e.id === 'sirsoft-board'
|
||||
);
|
||||
expect(hasSirsoftBoard, 'sirsoft-board extension이 없다').toBe(true);
|
||||
});
|
||||
|
||||
it('page_type이 boards이다', () => {
|
||||
expect(seo.page_type).toBe('boards');
|
||||
});
|
||||
|
||||
it('toggle_setting이 seo.seo_boards를 참조한다', () => {
|
||||
expect(seo.toggle_setting).toBe('$module_settings:sirsoft-board:seo.seo_boards');
|
||||
});
|
||||
|
||||
it('vars에 site_name이 정의된다', () => {
|
||||
expect(seo.vars).toBeDefined();
|
||||
expect(seo.vars.site_name).toBe('$core_settings:general.site_name');
|
||||
});
|
||||
|
||||
it('auth_mode가 optional이다 (봇 접근 허용)', () => {
|
||||
const ds = (boardsLayout as any).data_sources as any[];
|
||||
const boardListDs = ds?.find((d: any) => d.id === 'boardList');
|
||||
expect(boardListDs).toBeDefined();
|
||||
expect(boardListDs.auth_mode).toBe('optional');
|
||||
});
|
||||
});
|
||||
|
||||
describe('index.json - SEO meta 설정', () => {
|
||||
const seo = (indexLayout as any).meta?.seo;
|
||||
|
||||
it('meta.seo가 존재한다', () => {
|
||||
expect(seo).toBeDefined();
|
||||
});
|
||||
|
||||
it('enabled가 true이다', () => {
|
||||
expect(seo.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('extensions에 sirsoft-board 모듈이 포함된다', () => {
|
||||
const ext = seo.extensions;
|
||||
expect(Array.isArray(ext)).toBe(true);
|
||||
const hasSirsoftBoard = ext.some(
|
||||
(e: any) => e.type === 'module' && e.id === 'sirsoft-board'
|
||||
);
|
||||
expect(hasSirsoftBoard, 'sirsoft-board extension이 없다').toBe(true);
|
||||
});
|
||||
|
||||
it('page_type이 board이다', () => {
|
||||
expect(seo.page_type).toBe('board');
|
||||
});
|
||||
|
||||
it('toggle_setting이 seo.seo_board를 참조한다', () => {
|
||||
expect(seo.toggle_setting).toBe('$module_settings:sirsoft-board:seo.seo_board');
|
||||
});
|
||||
|
||||
it('vars에 site_name, board_name, board_description이 정의된다', () => {
|
||||
const vars = seo.vars;
|
||||
expect(vars).toBeDefined();
|
||||
expect(vars.site_name).toBe('$core_settings:general.site_name');
|
||||
expect(vars.board_name).toContain('board.name');
|
||||
expect(vars.board_description).toContain('board.description');
|
||||
});
|
||||
|
||||
it('vars 표현식에 fallback(??)이 있다', () => {
|
||||
const vars = seo.vars;
|
||||
expect(vars.board_name).toContain('??');
|
||||
expect(vars.board_description).toContain('??');
|
||||
});
|
||||
|
||||
it('og.description이 _seo 컨텍스트를 참조한다', () => {
|
||||
const ogDesc = seo.og?.description ?? '';
|
||||
expect(ogDesc).toContain('_seo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('show.json - SEO meta 설정', () => {
|
||||
const seo = (showLayout as any).meta?.seo;
|
||||
|
||||
it('meta.seo가 존재한다', () => {
|
||||
expect(seo).toBeDefined();
|
||||
});
|
||||
|
||||
it('enabled가 true이다', () => {
|
||||
expect(seo.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('extensions에 sirsoft-board 모듈이 포함된다', () => {
|
||||
const ext = seo.extensions;
|
||||
expect(Array.isArray(ext)).toBe(true);
|
||||
const hasSirsoftBoard = ext.some(
|
||||
(e: any) => e.type === 'module' && e.id === 'sirsoft-board'
|
||||
);
|
||||
expect(hasSirsoftBoard, 'sirsoft-board extension이 없다').toBe(true);
|
||||
});
|
||||
|
||||
it('page_type이 post이다', () => {
|
||||
expect(seo.page_type).toBe('post');
|
||||
});
|
||||
|
||||
it('toggle_setting이 seo.seo_post_detail을 참조한다', () => {
|
||||
expect(seo.toggle_setting).toBe('$module_settings:sirsoft-board:seo.seo_post_detail');
|
||||
});
|
||||
|
||||
it('vars에 site_name, board_name, post_title이 정의된다', () => {
|
||||
const vars = seo.vars;
|
||||
expect(vars).toBeDefined();
|
||||
expect(vars.site_name).toBe('$core_settings:general.site_name');
|
||||
expect(vars.board_name).toContain('board.name');
|
||||
expect(vars.post_title).toContain('post.data.title');
|
||||
});
|
||||
|
||||
it('vars 표현식에 fallback(??)이 있다', () => {
|
||||
const vars = seo.vars;
|
||||
expect(vars.board_name).toContain('??');
|
||||
expect(vars.post_title).toContain('??');
|
||||
});
|
||||
|
||||
it('og.title이 _seo 컨텍스트를 참조한다', () => {
|
||||
const ogTitle = seo.og?.title ?? '';
|
||||
expect(ogTitle).toContain('_seo');
|
||||
});
|
||||
|
||||
it('og.description이 _seo 컨텍스트를 참조한다', () => {
|
||||
const ogDesc = seo.og?.description ?? '';
|
||||
expect(ogDesc).toContain('_seo');
|
||||
});
|
||||
|
||||
it('structured_data.headline이 _seo 컨텍스트를 참조한다', () => {
|
||||
const headline = seo.structured_data?.headline ?? '';
|
||||
expect(headline).toContain('_seo');
|
||||
});
|
||||
|
||||
it('data_sources에 post가 정의된다', () => {
|
||||
const ds = (showLayout as any).data_sources as any[];
|
||||
const postDs = ds?.find((d: any) => d.id === 'post');
|
||||
expect(postDs).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,7 @@
|
||||
* - 기본 렌더링: 페이지 데이터 있을 때 제목/본문/첨부파일 영역 확인
|
||||
* - 조건부 렌더링: 데이터 없을 때 not_found 영역 표시, 데이터 있을 때 back_button 표시
|
||||
* - 첨부파일: 없을 때 섹션 미표시, 있을 때 섹션 표시
|
||||
* - 상태 배지: draft/archived 상태에 따른 배지 조건부 렌더링
|
||||
* - 버전 배지: 관리자에게만 표시되는 버전 배지 렌더링
|
||||
* - 관리자 편집 버튼: 관리자만 표시
|
||||
*
|
||||
* @vitest-environment jsdom
|
||||
@@ -95,16 +95,9 @@ const pageShowFixture = {
|
||||
{
|
||||
type: 'basic',
|
||||
name: 'Span',
|
||||
if: '{{page?.data?.status === "draft"}}',
|
||||
props: { 'data-testid': 'badge-draft' },
|
||||
text: 'status_draft',
|
||||
},
|
||||
{
|
||||
type: 'basic',
|
||||
name: 'Span',
|
||||
if: '{{page?.data?.status === "archived"}}',
|
||||
props: { 'data-testid': 'badge-archived' },
|
||||
text: 'status_archived',
|
||||
if: '{{_global.currentUser?.is_admin}}',
|
||||
props: { 'data-testid': 'badge-version' },
|
||||
text: 'v{{page?.data?.current_version ?? 1}}',
|
||||
},
|
||||
{
|
||||
id: 'page_admin_edit_button',
|
||||
@@ -202,9 +195,8 @@ function makePageApiResponse(overrides: Record<string, unknown> = {}) {
|
||||
id: 1,
|
||||
title: '이용약관',
|
||||
content: '<p>내용</p>',
|
||||
status: 'active',
|
||||
attachments: [],
|
||||
version: 1,
|
||||
current_version: 1,
|
||||
...overrides,
|
||||
},
|
||||
},
|
||||
@@ -279,46 +271,37 @@ describe('page/show.json 레이아웃 렌더링 (Issue #99)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('상태 배지 조건부 렌더링', () => {
|
||||
it('active 상태에서는 draft/archived 배지가 표시되지 않는다', async () => {
|
||||
const testUtils = createLayoutTest(pageShowFixture, { componentRegistry: registry });
|
||||
testUtils.mockApi('terms', makePageApiResponse({ status: 'active' }));
|
||||
describe('버전 배지 조건부 렌더링', () => {
|
||||
it('관리자에게는 버전 배지가 표시된다', async () => {
|
||||
const testUtils = createLayoutTest(pageShowFixture, {
|
||||
componentRegistry: registry,
|
||||
initialState: { _global: { currentUser: { is_admin: true } } },
|
||||
});
|
||||
testUtils.mockApi('terms', makePageApiResponse({ current_version: 2 }));
|
||||
|
||||
await testUtils.render();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('badge-version')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByTestId('badge-version')).toHaveTextContent('v2');
|
||||
|
||||
testUtils.cleanup();
|
||||
});
|
||||
|
||||
it('비관리자에게는 버전 배지가 표시되지 않는다', async () => {
|
||||
const testUtils = createLayoutTest(pageShowFixture, {
|
||||
componentRegistry: registry,
|
||||
initialState: { _global: { currentUser: { is_admin: false } } },
|
||||
});
|
||||
testUtils.mockApi('terms', makePageApiResponse());
|
||||
|
||||
await testUtils.render();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('page-content-card')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.queryByTestId('badge-draft')).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('badge-archived')).not.toBeInTheDocument();
|
||||
|
||||
testUtils.cleanup();
|
||||
});
|
||||
|
||||
it('draft 상태에서는 draft 배지가 표시된다', async () => {
|
||||
const testUtils = createLayoutTest(pageShowFixture, { componentRegistry: registry });
|
||||
testUtils.mockApi('terms', makePageApiResponse({ status: 'draft' }));
|
||||
|
||||
await testUtils.render();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('badge-draft')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.queryByTestId('badge-archived')).not.toBeInTheDocument();
|
||||
|
||||
testUtils.cleanup();
|
||||
});
|
||||
|
||||
it('archived 상태에서는 archived 배지가 표시된다', async () => {
|
||||
const testUtils = createLayoutTest(pageShowFixture, { componentRegistry: registry });
|
||||
testUtils.mockApi('terms', makePageApiResponse({ status: 'archived' }));
|
||||
|
||||
await testUtils.render();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('badge-archived')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.queryByTestId('badge-draft')).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('badge-version')).not.toBeInTheDocument();
|
||||
|
||||
testUtils.cleanup();
|
||||
});
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import React, { useMemo, useState, useRef, useEffect } from 'react';
|
||||
import React, { useMemo, useState, useRef, useEffect, useCallback } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { Div } from './Div';
|
||||
import { Button } from './Button';
|
||||
import { Span } from './Span';
|
||||
import { Svg } from './Svg';
|
||||
import { Input } from './Input';
|
||||
|
||||
// Logger 설정 (G7Core 초기화 전에도 동작하도록 폴백 포함)
|
||||
const logger = ((window as any).G7Core?.createLogger?.('Comp:Select')) ?? {
|
||||
@@ -22,6 +24,10 @@ export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectE
|
||||
error?: string;
|
||||
options?: SelectOption[] | string[];
|
||||
onChange?: (e: React.ChangeEvent<HTMLSelectElement> | { target: { value: string | number } }) => void;
|
||||
/** 드롭다운 내 검색 input 활성화 (engine-v1.40.0+) */
|
||||
searchable?: boolean;
|
||||
/** 검색 input placeholder */
|
||||
searchPlaceholder?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,11 +62,17 @@ export const Select: React.FC<SelectProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
disabled,
|
||||
searchable = false,
|
||||
searchPlaceholder,
|
||||
...props
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [dropdownPos, setDropdownPos] = useState<{ top?: number; bottom?: number; left: number; width: number } | null>(null);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const searchInputRef = useRef<HTMLInputElement>(null);
|
||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// options를 SelectOption[] 형식으로 정규화
|
||||
const normalizedOptions = useMemo((): SelectOption[] | null => {
|
||||
@@ -94,10 +106,79 @@ export const Select: React.FC<SelectProps> = ({
|
||||
return selected?.label || '';
|
||||
}, [normalizedOptions, value]);
|
||||
|
||||
// 외부 클릭 시 드롭다운 닫기
|
||||
// searchable 모드에서 검색어로 필터링된 옵션
|
||||
const visibleOptions = useMemo((): SelectOption[] | null => {
|
||||
if (!normalizedOptions) return null;
|
||||
if (!searchable || searchTerm.trim() === '') return normalizedOptions;
|
||||
const needle = searchTerm.trim().toLowerCase();
|
||||
return normalizedOptions.filter(opt =>
|
||||
opt.label.toLowerCase().includes(needle) ||
|
||||
String(opt.value).toLowerCase().includes(needle)
|
||||
);
|
||||
}, [normalizedOptions, searchable, searchTerm]);
|
||||
|
||||
// 드롭다운 열릴 때 검색어 초기화 및 input 포커스
|
||||
useEffect(() => {
|
||||
if (isOpen && searchable) {
|
||||
setSearchTerm('');
|
||||
// 다음 tick에 포커스 (DOM 렌더 이후)
|
||||
const timer = setTimeout(() => searchInputRef.current?.focus(), 0);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
if (!isOpen) {
|
||||
setSearchTerm('');
|
||||
}
|
||||
}, [isOpen, searchable]);
|
||||
|
||||
/**
|
||||
* 드롭다운 위치 계산 (버튼 기준 fixed positioning)
|
||||
* Modal 등 overflow:hidden 컨테이너 내부에서도 정상 표시
|
||||
*/
|
||||
const updateDropdownPos = useCallback(() => {
|
||||
if (!buttonRef.current) return;
|
||||
const rect = buttonRef.current.getBoundingClientRect();
|
||||
const spaceBelow = window.innerHeight - rect.bottom;
|
||||
const dropdownMaxH = 280; // max-h-60(240px) + search(~40px)
|
||||
// 아래 공간 부족 시 위로 열기
|
||||
const openUpward = spaceBelow < dropdownMaxH && rect.top > spaceBelow;
|
||||
if (openUpward) {
|
||||
setDropdownPos({
|
||||
bottom: window.innerHeight - rect.top + 4,
|
||||
left: rect.left,
|
||||
width: rect.width,
|
||||
});
|
||||
} else {
|
||||
setDropdownPos({
|
||||
top: rect.bottom + 4,
|
||||
left: rect.left,
|
||||
width: rect.width,
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 드롭다운 열릴 때 위치 계산 + 스크롤/리사이즈 추적
|
||||
useEffect(() => {
|
||||
if (!isOpen) {
|
||||
setDropdownPos(null);
|
||||
return;
|
||||
}
|
||||
updateDropdownPos();
|
||||
window.addEventListener('scroll', updateDropdownPos, true);
|
||||
window.addEventListener('resize', updateDropdownPos);
|
||||
return () => {
|
||||
window.removeEventListener('scroll', updateDropdownPos, true);
|
||||
window.removeEventListener('resize', updateDropdownPos);
|
||||
};
|
||||
}, [isOpen, updateDropdownPos]);
|
||||
|
||||
// 외부 클릭 시 드롭다운 닫기 (Portal 영역 포함)
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (containerRef.current && !containerRef.current.contains(event.target as Node)) {
|
||||
const target = event.target as Node;
|
||||
if (
|
||||
containerRef.current && !containerRef.current.contains(target) &&
|
||||
(!dropdownRef.current || !dropdownRef.current.contains(target))
|
||||
) {
|
||||
setIsOpen(false);
|
||||
}
|
||||
};
|
||||
@@ -190,13 +271,34 @@ export const Select: React.FC<SelectProps> = ({
|
||||
</Svg>
|
||||
</Button>
|
||||
|
||||
{isOpen && (
|
||||
{isOpen && dropdownPos && createPortal(
|
||||
<Div
|
||||
className="absolute z-50 w-full mt-2 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden"
|
||||
ref={dropdownRef}
|
||||
className="fixed z-[9999] bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 overflow-hidden"
|
||||
style={{ top: dropdownPos.top, bottom: dropdownPos.bottom, left: dropdownPos.left, width: dropdownPos.width }}
|
||||
role="listbox"
|
||||
>
|
||||
{searchable && (
|
||||
<Div className="p-2 border-b border-gray-200 dark:border-gray-600">
|
||||
<Input
|
||||
ref={searchInputRef}
|
||||
type="text"
|
||||
value={searchTerm}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setSearchTerm(e.target.value)}
|
||||
placeholder={searchPlaceholder ?? 'Search...'}
|
||||
className="w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border-0 rounded-lg text-sm text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
role="searchbox"
|
||||
aria-label={searchPlaceholder ?? 'Search'}
|
||||
/>
|
||||
</Div>
|
||||
)}
|
||||
<Div className="py-2 max-h-60 overflow-auto">
|
||||
{normalizedOptions.map((option) => {
|
||||
{visibleOptions && visibleOptions.length === 0 && (
|
||||
<Div className="px-4 py-3 text-sm text-gray-500 dark:text-gray-400 text-center">
|
||||
{searchTerm ? 'No results' : ''}
|
||||
</Div>
|
||||
)}
|
||||
{(visibleOptions ?? []).map((option) => {
|
||||
const isSelected = String(option.value) === String(value);
|
||||
return (
|
||||
<Button
|
||||
@@ -225,7 +327,8 @@ export const Select: React.FC<SelectProps> = ({
|
||||
);
|
||||
})}
|
||||
</Div>
|
||||
</Div>
|
||||
</Div>,
|
||||
document.body
|
||||
)}
|
||||
</Div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,737 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { Select } from '../Select';
|
||||
|
||||
describe('Select 컴포넌트', () => {
|
||||
describe('기본 렌더링 (children 모드)', () => {
|
||||
it('select 요소가 렌더링된다', () => {
|
||||
const { container } = render(
|
||||
<Select>
|
||||
<option value="">선택</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select).toBeTruthy();
|
||||
});
|
||||
|
||||
it('option 요소가 렌더링된다', () => {
|
||||
render(
|
||||
<Select>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
expect(screen.getByText('옵션 1')).toBeTruthy();
|
||||
expect(screen.getByText('옵션 2')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('기본 선택 옵션이 표시된다', () => {
|
||||
const { container } = render(
|
||||
<Select defaultValue="2">
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
const select = container.querySelector('select') as HTMLSelectElement;
|
||||
expect(select.value).toBe('2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('이벤트 핸들링 (children 모드)', () => {
|
||||
it('onChange 핸들러가 호출된다', () => {
|
||||
const handleChange = vi.fn();
|
||||
const { container } = render(
|
||||
<Select onChange={handleChange}>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
const select = container.querySelector('select')!;
|
||||
fireEvent.change(select, { target: { value: '2' } });
|
||||
|
||||
expect(handleChange).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('onFocus 핸들러가 호출된다', () => {
|
||||
const handleFocus = vi.fn();
|
||||
const { container } = render(
|
||||
<Select onFocus={handleFocus}>
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
const select = container.querySelector('select')!;
|
||||
fireEvent.focus(select);
|
||||
|
||||
expect(handleFocus).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('onBlur 핸들러가 호출된다', () => {
|
||||
const handleBlur = vi.fn();
|
||||
const { container } = render(
|
||||
<Select onBlur={handleBlur}>
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
const select = container.querySelector('select')!;
|
||||
fireEvent.blur(select);
|
||||
|
||||
expect(handleBlur).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('value 및 제어 컴포넌트 (children 모드)', () => {
|
||||
it('value prop이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select value="2" onChange={() => {}}>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
<option value="3">옵션 3</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
const select = container.querySelector('select') as HTMLSelectElement;
|
||||
expect(select.value).toBe('2');
|
||||
});
|
||||
|
||||
it('제어 컴포넌트로 작동한다', () => {
|
||||
const TestComponent = () => {
|
||||
const [value, setValue] = React.useState('1');
|
||||
|
||||
return (
|
||||
<Select value={value} onChange={(e) => setValue(String(e.target.value))}>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</Select>
|
||||
);
|
||||
};
|
||||
|
||||
const { container } = render(<TestComponent />);
|
||||
const select = container.querySelector('select')!;
|
||||
|
||||
expect((select as HTMLSelectElement).value).toBe('1');
|
||||
|
||||
fireEvent.change(select, { target: { value: '2' } });
|
||||
|
||||
expect((select as HTMLSelectElement).value).toBe('2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('HTML 속성 (children 모드)', () => {
|
||||
it('disabled 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select disabled>
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.disabled).toBe(true);
|
||||
});
|
||||
|
||||
it('required 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select required>
|
||||
<option value="">선택</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.required).toBe(true);
|
||||
});
|
||||
|
||||
it('name 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select name="category">
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.name).toBe('category');
|
||||
});
|
||||
|
||||
it('id 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select id="category-select">
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.id).toBe('category-select');
|
||||
});
|
||||
|
||||
it('multiple 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select multiple>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.multiple).toBe(true);
|
||||
});
|
||||
|
||||
it('size 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select size={3}>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.size).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Label 및 Error Props', () => {
|
||||
it('label prop이 존재한다', () => {
|
||||
// label prop은 있지만 렌더링하지 않음 (부모에서 처리)
|
||||
const { container } = render(
|
||||
<Select label="카테고리 선택">
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select).toBeTruthy();
|
||||
});
|
||||
|
||||
it('error prop이 존재한다', () => {
|
||||
// error prop은 있지만 렌더링하지 않음 (부모에서 처리)
|
||||
const { container } = render(
|
||||
<Select error="카테고리를 선택해주세요">
|
||||
<option value="">선택</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('사용자 정의 Props (children 모드)', () => {
|
||||
it('사용자 정의 클래스가 추가된다', () => {
|
||||
const { container } = render(
|
||||
<Select className="custom-select">
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.className).toContain('custom-select');
|
||||
});
|
||||
|
||||
it('aria-label이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select aria-label="카테고리 선택">
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.getAttribute('aria-label')).toBe('카테고리 선택');
|
||||
});
|
||||
|
||||
it('data 속성이 적용된다', () => {
|
||||
const { container } = render(
|
||||
<Select data-testid="test-select">
|
||||
<option value="1">옵션 1</option>
|
||||
</Select>
|
||||
);
|
||||
const select = container.querySelector('select');
|
||||
expect(select?.getAttribute('data-testid')).toBe('test-select');
|
||||
});
|
||||
});
|
||||
|
||||
describe('optgroup 지원', () => {
|
||||
it('optgroup이 렌더링된다', () => {
|
||||
render(
|
||||
<Select>
|
||||
<optgroup label="그룹 1">
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
</optgroup>
|
||||
<optgroup label="그룹 2">
|
||||
<option value="3">옵션 3</option>
|
||||
<option value="4">옵션 4</option>
|
||||
</optgroup>
|
||||
</Select>
|
||||
);
|
||||
|
||||
expect(screen.getByText('옵션 1')).toBeTruthy();
|
||||
expect(screen.getByText('옵션 3')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('복합 Props (children 모드)', () => {
|
||||
it('여러 props가 함께 적용된다', () => {
|
||||
const handleChange = vi.fn();
|
||||
const { container } = render(
|
||||
<Select
|
||||
name="category"
|
||||
value="2"
|
||||
onChange={handleChange}
|
||||
required
|
||||
className="custom-select"
|
||||
aria-label="카테고리 선택"
|
||||
>
|
||||
<option value="">선택하세요</option>
|
||||
<option value="1">옵션 1</option>
|
||||
<option value="2">옵션 2</option>
|
||||
<option value="3">옵션 3</option>
|
||||
</Select>
|
||||
);
|
||||
|
||||
const select = container.querySelector('select')!;
|
||||
expect(select.name).toBe('category');
|
||||
expect((select as HTMLSelectElement).value).toBe('2');
|
||||
expect(select.required).toBe(true);
|
||||
expect(select.className).toContain('custom-select');
|
||||
expect(select.getAttribute('aria-label')).toBe('카테고리 선택');
|
||||
|
||||
fireEvent.change(select, { target: { value: '3' } });
|
||||
expect(handleChange).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
// ========================================
|
||||
// 커스텀 드롭다운 모드 (options prop 사용)
|
||||
// ========================================
|
||||
describe('커스텀 드롭다운 렌더링 (options 모드)', () => {
|
||||
const options = [
|
||||
{ value: '', label: '전체' },
|
||||
{ value: 'name', label: '이름' },
|
||||
{ value: 'email', label: '이메일' },
|
||||
];
|
||||
|
||||
it('options prop으로 커스텀 드롭다운이 렌더링된다', () => {
|
||||
render(<Select options={options} value="" onChange={() => {}} />);
|
||||
|
||||
// 버튼이 렌더링되어야 함 (select가 아닌 button)
|
||||
const button = screen.getByRole('button');
|
||||
expect(button).toBeTruthy();
|
||||
});
|
||||
|
||||
it('선택된 옵션의 라벨이 버튼에 표시된다', () => {
|
||||
render(<Select options={options} value="name" onChange={() => {}} />);
|
||||
|
||||
expect(screen.getByText('이름')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('빈 값일 때 해당 옵션의 라벨이 표시된다', () => {
|
||||
render(<Select options={options} value="" onChange={() => {}} />);
|
||||
|
||||
expect(screen.getByText('전체')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('버튼 클릭 시 드롭다운이 열린다', () => {
|
||||
render(<Select options={options} value="" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
// 드롭다운 메뉴가 열림 (listbox)
|
||||
const listbox = screen.getByRole('listbox');
|
||||
expect(listbox).toBeTruthy();
|
||||
|
||||
// 모든 옵션이 표시됨 (옵션은 role="option"으로 찾음)
|
||||
const optionElements = screen.getAllByRole('option');
|
||||
expect(optionElements.length).toBe(3);
|
||||
});
|
||||
|
||||
it('옵션 클릭 시 onChange가 호출되고 드롭다운이 닫힌다', () => {
|
||||
const handleChange = vi.fn();
|
||||
render(<Select options={options} value="" onChange={handleChange} />);
|
||||
|
||||
// 드롭다운 열기
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
// 옵션 선택
|
||||
const nameOption = screen.getAllByRole('option').find(
|
||||
opt => opt.textContent?.includes('이름')
|
||||
);
|
||||
fireEvent.click(nameOption!);
|
||||
|
||||
// onChange가 호출됨 (synthetic event 형식)
|
||||
expect(handleChange).toHaveBeenCalledTimes(1);
|
||||
expect(handleChange).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
target: { value: 'name' },
|
||||
type: 'change',
|
||||
})
|
||||
);
|
||||
|
||||
// 드롭다운이 닫힘
|
||||
expect(screen.queryByRole('listbox')).toBeNull();
|
||||
});
|
||||
|
||||
it('선택된 옵션에 체크마크가 표시된다', () => {
|
||||
render(<Select options={options} value="email" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
// 선택된 옵션 찾기
|
||||
const selectedOption = screen.getAllByRole('option').find(
|
||||
opt => opt.getAttribute('aria-selected') === 'true'
|
||||
);
|
||||
|
||||
expect(selectedOption).toBeTruthy();
|
||||
expect(selectedOption?.textContent).toContain('이메일');
|
||||
});
|
||||
|
||||
it('disabled 상태에서 클릭이 작동하지 않는다', () => {
|
||||
render(<Select options={options} value="" onChange={() => {}} disabled />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
expect(button).toHaveProperty('disabled', true);
|
||||
|
||||
fireEvent.click(button);
|
||||
|
||||
// 드롭다운이 열리지 않음
|
||||
expect(screen.queryByRole('listbox')).toBeNull();
|
||||
});
|
||||
|
||||
it('외부 클릭 시 드롭다운이 닫힌다', () => {
|
||||
render(
|
||||
<div>
|
||||
<Select options={options} value="" onChange={() => {}} />
|
||||
<div data-testid="outside">외부 영역</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 드롭다운 열기
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
expect(screen.getByRole('listbox')).toBeTruthy();
|
||||
|
||||
// 외부 클릭
|
||||
const outside = screen.getByTestId('outside');
|
||||
fireEvent.mouseDown(outside);
|
||||
|
||||
// 드롭다운이 닫힘
|
||||
expect(screen.queryByRole('listbox')).toBeNull();
|
||||
});
|
||||
|
||||
it('ESC 키로 드롭다운이 닫힌다', () => {
|
||||
render(<Select options={options} value="" onChange={() => {}} />);
|
||||
|
||||
// 드롭다운 열기
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
expect(screen.getByRole('listbox')).toBeTruthy();
|
||||
|
||||
// ESC 키 입력
|
||||
fireEvent.keyDown(document, { key: 'Escape' });
|
||||
|
||||
// 드롭다운이 닫힘
|
||||
expect(screen.queryByRole('listbox')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('커스텀 드롭다운 스타일 (options 모드)', () => {
|
||||
const options = [
|
||||
{ value: '1', label: '옵션 1' },
|
||||
{ value: '2', label: '옵션 2' },
|
||||
];
|
||||
|
||||
it('기본 스타일이 적용된다', () => {
|
||||
render(<Select options={options} value="1" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
expect(button.className).toContain('bg-gray-100');
|
||||
expect(button.className).toContain('rounded-xl');
|
||||
});
|
||||
|
||||
it('커스텀 className이 적용된다', () => {
|
||||
render(
|
||||
<Select
|
||||
options={options}
|
||||
value="1"
|
||||
onChange={() => {}}
|
||||
className="bg-blue-100 custom-class"
|
||||
/>
|
||||
);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
expect(button.className).toContain('bg-blue-100');
|
||||
expect(button.className).toContain('custom-class');
|
||||
});
|
||||
|
||||
it('드롭다운 메뉴가 둥근 모서리를 가진다', () => {
|
||||
render(<Select options={options} value="1" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
const listbox = screen.getByRole('listbox');
|
||||
expect(listbox.className).toContain('rounded-2xl');
|
||||
expect(listbox.className).toContain('shadow-lg');
|
||||
});
|
||||
});
|
||||
|
||||
describe('string[] options 지원', () => {
|
||||
it('string 배열을 옵션으로 변환한다', () => {
|
||||
render(<Select options={['ko', 'en']} value="ko" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
// 로케일 이름으로 변환됨 (role="option"으로 찾음)
|
||||
const optionElements = screen.getAllByRole('option');
|
||||
const labels = optionElements.map(opt => opt.textContent);
|
||||
expect(labels).toContain('한국어');
|
||||
expect(labels).toContain('English');
|
||||
});
|
||||
|
||||
it('알 수 없는 로케일은 그대로 표시된다', () => {
|
||||
render(<Select options={['unknown']} value="unknown" onChange={() => {}} />);
|
||||
|
||||
expect(screen.getByText('unknown')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('disabled 옵션 지원', () => {
|
||||
it('disabled 옵션이 비활성화된다', () => {
|
||||
const options = [
|
||||
{ value: '1', label: '옵션 1' },
|
||||
{ value: '2', label: '옵션 2', disabled: true },
|
||||
];
|
||||
|
||||
const handleChange = vi.fn();
|
||||
render(<Select options={options} value="1" onChange={handleChange} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
const disabledOption = screen.getAllByRole('option').find(
|
||||
opt => opt.textContent?.includes('옵션 2')
|
||||
);
|
||||
|
||||
expect(disabledOption).toHaveProperty('disabled', true);
|
||||
|
||||
// 클릭해도 onChange가 호출되지 않음
|
||||
fireEvent.click(disabledOption!);
|
||||
expect(handleChange).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('접근성 (options 모드)', () => {
|
||||
const options = [
|
||||
{ value: '1', label: '옵션 1' },
|
||||
{ value: '2', label: '옵션 2' },
|
||||
];
|
||||
|
||||
it('aria-haspopup 속성이 있다', () => {
|
||||
render(<Select options={options} value="1" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
expect(button.getAttribute('aria-haspopup')).toBe('listbox');
|
||||
});
|
||||
|
||||
it('aria-expanded가 열림 상태를 반영한다', () => {
|
||||
render(<Select options={options} value="1" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
expect(button.getAttribute('aria-expanded')).toBe('false');
|
||||
|
||||
fireEvent.click(button);
|
||||
expect(button.getAttribute('aria-expanded')).toBe('true');
|
||||
});
|
||||
|
||||
it('옵션에 role="option"이 있다', () => {
|
||||
render(<Select options={options} value="1" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
const optionElements = screen.getAllByRole('option');
|
||||
expect(optionElements.length).toBe(2);
|
||||
});
|
||||
|
||||
it('선택된 옵션에 aria-selected="true"가 있다', () => {
|
||||
render(<Select options={options} value="2" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
fireEvent.click(button);
|
||||
|
||||
const selectedOption = screen.getAllByRole('option').find(
|
||||
opt => opt.getAttribute('aria-selected') === 'true'
|
||||
);
|
||||
|
||||
expect(selectedOption?.textContent).toContain('옵션 2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('제어 컴포넌트 (options 모드)', () => {
|
||||
it('value 변경에 따라 표시가 업데이트된다', () => {
|
||||
const options = [
|
||||
{ value: '1', label: '옵션 1' },
|
||||
{ value: '2', label: '옵션 2' },
|
||||
];
|
||||
|
||||
const TestComponent = () => {
|
||||
const [value, setValue] = React.useState('1');
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
options={options}
|
||||
value={value}
|
||||
onChange={(e) => setValue(String(e.target.value))}
|
||||
/>
|
||||
<button onClick={() => setValue('2')}>변경</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
render(<TestComponent />);
|
||||
|
||||
// 초기값 확인
|
||||
expect(screen.getByText('옵션 1')).toBeTruthy();
|
||||
|
||||
// 외부에서 값 변경
|
||||
fireEvent.click(screen.getByText('변경'));
|
||||
|
||||
// 표시가 업데이트됨
|
||||
expect(screen.getByText('옵션 2')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('빈 options 처리', () => {
|
||||
it('빈 배열일 때도 렌더링된다', () => {
|
||||
render(<Select options={[]} value="" onChange={() => {}} />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
expect(button).toBeTruthy();
|
||||
});
|
||||
|
||||
it('options가 배열이 아닐 때 기본 select로 폴백된다', () => {
|
||||
// @ts-expect-error - 의도적으로 잘못된 타입 전달
|
||||
const { container } = render(<Select options="invalid" />);
|
||||
|
||||
const select = container.querySelector('select');
|
||||
expect(select).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
// ========================================
|
||||
// searchable 모드 (engine-v1.40.0+)
|
||||
// ========================================
|
||||
describe('searchable 모드', () => {
|
||||
const timezoneOptions = [
|
||||
{ value: 'Asia/Seoul', label: '(UTC+09:00) Asia/Seoul' },
|
||||
{ value: 'Asia/Tokyo', label: '(UTC+09:00) Asia/Tokyo' },
|
||||
{ value: 'America/New_York', label: '(UTC-05:00) America/New_York' },
|
||||
{ value: 'Europe/London', label: '(UTC+00:00) Europe/London' },
|
||||
{ value: 'Pacific/Auckland', label: '(UTC+13:00) Pacific/Auckland' },
|
||||
];
|
||||
|
||||
it('searchable=false 기본값에서는 검색 input이 렌더링되지 않는다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
expect(screen.queryByRole('searchbox')).toBeNull();
|
||||
});
|
||||
|
||||
it('searchable=true 시 드롭다운 내 검색 input이 렌더링된다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} searchable />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
expect(screen.getByRole('searchbox')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('searchPlaceholder가 input placeholder로 적용된다', () => {
|
||||
render(
|
||||
<Select
|
||||
options={timezoneOptions}
|
||||
value="Asia/Seoul"
|
||||
onChange={() => {}}
|
||||
searchable
|
||||
searchPlaceholder="타임존 검색..."
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
const input = screen.getByRole('searchbox') as HTMLInputElement;
|
||||
expect(input.placeholder).toBe('타임존 검색...');
|
||||
});
|
||||
|
||||
it('검색어 입력 시 라벨 기준으로 옵션이 필터링된다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} searchable />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
|
||||
const input = screen.getByRole('searchbox');
|
||||
fireEvent.change(input, { target: { value: 'tokyo' } });
|
||||
|
||||
const visibleOptions = screen.getAllByRole('option');
|
||||
expect(visibleOptions.length).toBe(1);
|
||||
expect(visibleOptions[0].textContent).toContain('Asia/Tokyo');
|
||||
});
|
||||
|
||||
it('검색은 대소문자를 구분하지 않는다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} searchable />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
|
||||
fireEvent.change(screen.getByRole('searchbox'), { target: { value: 'LONDON' } });
|
||||
|
||||
const visibleOptions = screen.getAllByRole('option');
|
||||
expect(visibleOptions.length).toBe(1);
|
||||
expect(visibleOptions[0].textContent).toContain('Europe/London');
|
||||
});
|
||||
|
||||
it('value 문자열에 대해서도 검색된다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} searchable />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
|
||||
fireEvent.change(screen.getByRole('searchbox'), { target: { value: 'pacific' } });
|
||||
|
||||
const visibleOptions = screen.getAllByRole('option');
|
||||
expect(visibleOptions.length).toBe(1);
|
||||
expect(visibleOptions[0].textContent).toContain('Pacific/Auckland');
|
||||
});
|
||||
|
||||
it('검색 결과가 없으면 "No results" 메시지가 표시된다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} searchable />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
|
||||
fireEvent.change(screen.getByRole('searchbox'), { target: { value: 'nonexistent-zzz' } });
|
||||
|
||||
expect(screen.queryAllByRole('option').length).toBe(0);
|
||||
expect(screen.getByText('No results')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('필터된 옵션 선택 시 onChange가 호출되고 드롭다운이 닫힌다', () => {
|
||||
const handleChange = vi.fn();
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={handleChange} searchable />);
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
|
||||
fireEvent.change(screen.getByRole('searchbox'), { target: { value: 'tokyo' } });
|
||||
|
||||
const tokyoOption = screen.getAllByRole('option')[0];
|
||||
fireEvent.click(tokyoOption);
|
||||
|
||||
expect(handleChange).toHaveBeenCalledTimes(1);
|
||||
expect(handleChange).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ target: { value: 'Asia/Tokyo' } })
|
||||
);
|
||||
expect(screen.queryByRole('listbox')).toBeNull();
|
||||
});
|
||||
|
||||
it('드롭다운을 다시 열면 검색어가 초기화된다', () => {
|
||||
render(<Select options={timezoneOptions} value="Asia/Seoul" onChange={() => {}} searchable />);
|
||||
|
||||
// 첫 번째 열기 + 필터링
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
fireEvent.change(screen.getByRole('searchbox'), { target: { value: 'tokyo' } });
|
||||
expect(screen.getAllByRole('option').length).toBe(1);
|
||||
|
||||
// 닫기 (외부 클릭 대신 ESC)
|
||||
fireEvent.keyDown(document, { key: 'Escape' });
|
||||
expect(screen.queryByRole('listbox')).toBeNull();
|
||||
|
||||
// 다시 열기 — 검색어가 초기화되어 모든 옵션이 보여야 함
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
expect(screen.getAllByRole('option').length).toBe(timezoneOptions.length);
|
||||
const input = screen.getByRole('searchbox') as HTMLInputElement;
|
||||
expect(input.value).toBe('');
|
||||
});
|
||||
});
|
||||
});
|
||||
+38
-15
@@ -142,6 +142,8 @@ export function useFileUploader(options: UseFileUploaderOptions): UseFileUploade
|
||||
const galleryKeyRef = useRef(0);
|
||||
// 인증된 이미지 URL 캐시 (기존 첨부파일용)
|
||||
const [authenticatedImageUrls, setAuthenticatedImageUrls] = useState<Map<number, string>>(new Map());
|
||||
// ref로 URL 캐시 추적 (stale closure 방지 — cleanup/has 체크에서 항상 최신 참조)
|
||||
const authenticatedImageUrlsRef = useRef<Map<number, string>>(new Map());
|
||||
|
||||
// 대기 파일 변경 시 콜백
|
||||
useEffect(() => {
|
||||
@@ -674,35 +676,56 @@ export function useFileUploader(options: UseFileUploaderOptions): UseFileUploade
|
||||
|
||||
// 기존 첨부파일 인증된 이미지 URL 로드 (갤러리용)
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
const loadAuthenticatedUrls = async () => {
|
||||
const existingImageFiles = existingFiles.filter((f) => f.mime_type?.startsWith('image/') ?? false);
|
||||
// is_image 필드 사용 (imageFiles 필터와 일치)
|
||||
const existingImageFiles = existingFiles.filter((f) => f.is_image);
|
||||
|
||||
// existingFiles에서 제거된 파일의 URL 정리
|
||||
const currentIds = new Set(existingImageFiles.map((f) => f.id));
|
||||
for (const [id, url] of authenticatedImageUrlsRef.current) {
|
||||
if (!currentIds.has(id)) {
|
||||
URL.revokeObjectURL(url);
|
||||
authenticatedImageUrlsRef.current.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
for (const file of existingImageFiles) {
|
||||
if (!authenticatedImageUrls.has(file.id)) {
|
||||
try {
|
||||
const blob = await G7Core.api.get(file.download_url, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
if (blob) {
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
setAuthenticatedImageUrls((prev) => new Map(prev).set(file.id, objectUrl));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load authenticated image:', error);
|
||||
if (cancelled) break;
|
||||
// ref 기반 has 체크 (stale closure 방지)
|
||||
if (authenticatedImageUrlsRef.current.has(file.id)) continue;
|
||||
|
||||
try {
|
||||
const blob = await G7Core.api.get(file.download_url, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
if (!cancelled && blob) {
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
authenticatedImageUrlsRef.current.set(file.id, objectUrl);
|
||||
setAuthenticatedImageUrls(new Map(authenticatedImageUrlsRef.current));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load authenticated image:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
loadAuthenticatedUrls();
|
||||
|
||||
// 클린업: 컴포넌트 언마운트 시 URL 해제
|
||||
return () => {
|
||||
authenticatedImageUrls.forEach((url) => URL.revokeObjectURL(url));
|
||||
cancelled = true;
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [existingFiles]);
|
||||
|
||||
// 언마운트 시에만 모든 인증된 이미지 URL 해제
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
authenticatedImageUrlsRef.current.forEach((url) => URL.revokeObjectURL(url));
|
||||
authenticatedImageUrlsRef.current.clear();
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 파일 다운로드 실행
|
||||
const handleDownload = useCallback(async (item: Attachment) => {
|
||||
const { executeImageDownload } = await import('../ImageGallery');
|
||||
|
||||
@@ -33,6 +33,9 @@ import { ThemeToggle } from './ThemeToggle';
|
||||
// Avatar 컴포넌트 import
|
||||
import { Avatar } from './Avatar';
|
||||
|
||||
// NotificationCenter 컴포넌트 import
|
||||
import { NotificationCenter, type NotificationItem } from './NotificationCenter';
|
||||
|
||||
// G7Core.t() 번역 함수 참조
|
||||
const t = (key: string, params?: Record<string, string | number>) =>
|
||||
(window as any).G7Core?.t?.(key, params) ?? key;
|
||||
@@ -84,6 +87,40 @@ interface HeaderProps {
|
||||
shopBase?: string;
|
||||
/** 추가 CSS 클래스 */
|
||||
className?: string;
|
||||
|
||||
// ===== 알림센터 드롭다운 Props =====
|
||||
/** 알림 목록 (NotificationCenter에 전달) */
|
||||
notifications?: NotificationItem[];
|
||||
/** 더 불러올 페이지 존재 여부 */
|
||||
notificationHasMore?: boolean;
|
||||
/** 알림 로딩 상태 */
|
||||
notificationLoading?: boolean;
|
||||
/** "안 읽은 알림만" 필터 상태 */
|
||||
notificationUnreadOnly?: boolean;
|
||||
/** 알림 드롭다운 제목 */
|
||||
notificationTitleText?: string;
|
||||
/** 알림 없음 텍스트 */
|
||||
notificationEmptyText?: string;
|
||||
/** "모두 읽음" 텍스트 */
|
||||
notificationMarkAllReadText?: string;
|
||||
/** "모두 삭제" 텍스트 */
|
||||
notificationDeleteAllText?: string;
|
||||
/** "안 읽은 알림만" 체크박스 텍스트 */
|
||||
notificationUnreadOnlyText?: string;
|
||||
/** 알림 드롭다운 닫힐 때 (뷰포트에 보인 미읽음 ID 배열 전달) */
|
||||
onNotificationClose?: (visibleUnreadIds: (string | number)[]) => void;
|
||||
/** 개별 알림 클릭 */
|
||||
onNotificationClick?: (notification: NotificationItem) => void;
|
||||
/** 무한 스크롤: 추가 로드 */
|
||||
onNotificationLoadMore?: () => void;
|
||||
/** "모두 읽음" 처리 */
|
||||
onNotificationMarkAllRead?: () => void;
|
||||
/** "모두 삭제" 요청 (모달 오픈) */
|
||||
onNotificationDeleteAll?: () => void;
|
||||
/** 개별 알림 삭제 */
|
||||
onNotificationDelete?: (notification: NotificationItem) => void;
|
||||
/** "안 읽은 알림만" 체크박스 토글 */
|
||||
onNotificationUnreadOnlyToggle?: (checked: boolean) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,6 +157,23 @@ const Header: React.FC<HeaderProps> = ({
|
||||
currentLocale = 'ko',
|
||||
shopBase = '/shop',
|
||||
className = '',
|
||||
// 알림센터
|
||||
notifications = [],
|
||||
notificationHasMore = false,
|
||||
notificationLoading = false,
|
||||
notificationUnreadOnly = false,
|
||||
notificationTitleText,
|
||||
notificationEmptyText,
|
||||
notificationMarkAllReadText,
|
||||
notificationDeleteAllText,
|
||||
notificationUnreadOnlyText,
|
||||
onNotificationClose,
|
||||
onNotificationClick,
|
||||
onNotificationLoadMore,
|
||||
onNotificationMarkAllRead,
|
||||
onNotificationDeleteAll,
|
||||
onNotificationDelete,
|
||||
onNotificationUnreadOnlyToggle,
|
||||
}) => {
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [showUserMenu, setShowUserMenu] = useState(false);
|
||||
@@ -129,6 +183,14 @@ const Header: React.FC<HeaderProps> = ({
|
||||
const userMenuRef = useRef<HTMLDivElement>(null);
|
||||
const moreButtonRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// G7Core.useResponsive를 통해 반응형 상태 구독 (G7 표준 — 위지윅 overrideWidth 호환)
|
||||
const G7Core = (window as any).G7Core;
|
||||
const useResponsive = G7Core?.useResponsive;
|
||||
const responsiveValue = useResponsive?.();
|
||||
const isMobile = responsiveValue
|
||||
? responsiveValue.width < 768
|
||||
: typeof window !== 'undefined' && window.innerWidth < 768;
|
||||
|
||||
// 경로 변경 감지 (SPA 네비게이션 대응)
|
||||
useEffect(() => {
|
||||
const handlePopState = () => setCurrentPath(window.location.pathname);
|
||||
@@ -228,22 +290,24 @@ const Header: React.FC<HeaderProps> = ({
|
||||
)}
|
||||
</Button>
|
||||
|
||||
{/* 검색바 (데스크톱) */}
|
||||
<Form onSubmit={handleSearch} className="hidden md:flex flex-1 max-w-lg mx-8">
|
||||
<Div className="relative w-full">
|
||||
<Input
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
placeholder={t('common.search_placeholder')}
|
||||
className="w-full px-4 py-2 pl-10 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||
/>
|
||||
<Icon
|
||||
name="search"
|
||||
className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500"
|
||||
/>
|
||||
</Div>
|
||||
</Form>
|
||||
{/* 검색바 (데스크톱 전용) */}
|
||||
{!isMobile && (
|
||||
<Form onSubmit={handleSearch} className="flex flex-1 max-w-lg mx-8">
|
||||
<Div className="relative w-full">
|
||||
<Input
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
placeholder={t('common.search_placeholder')}
|
||||
className="w-full px-4 py-2 pl-10 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||
/>
|
||||
<Icon
|
||||
name="search"
|
||||
className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500"
|
||||
/>
|
||||
</Div>
|
||||
</Form>
|
||||
)}
|
||||
|
||||
{/* 우측 액션 버튼들 */}
|
||||
<Div className="flex items-center gap-2">
|
||||
@@ -254,15 +318,29 @@ const Header: React.FC<HeaderProps> = ({
|
||||
darkText={t('common.theme.dark')}
|
||||
/>
|
||||
|
||||
{/* 알림 */}
|
||||
<Button onClick={() => navigate('/notifications')} className="relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer">
|
||||
<Icon name="bell" className="w-5 h-5" />
|
||||
{notificationCount > 0 && (
|
||||
<Span className="absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs bg-red-500 text-white rounded-full">
|
||||
{notificationCount > 99 ? '99+' : notificationCount}
|
||||
</Span>
|
||||
)}
|
||||
</Button>
|
||||
{/* 알림센터 드롭다운 — 로그인 사용자에게만 노출 */}
|
||||
{user?.uuid && (
|
||||
<NotificationCenter
|
||||
notifications={notifications}
|
||||
unreadCount={notificationCount}
|
||||
hasMore={notificationHasMore}
|
||||
loading={notificationLoading}
|
||||
unreadOnly={notificationUnreadOnly}
|
||||
titleText={notificationTitleText ?? t('mypage.notifications.title')}
|
||||
emptyText={notificationEmptyText ?? t('mypage.notifications.empty')}
|
||||
markAllReadText={notificationMarkAllReadText ?? t('mypage.notifications.mark_all_read')}
|
||||
deleteAllText={notificationDeleteAllText ?? t('mypage.notifications.delete_all')}
|
||||
unreadOnlyText={notificationUnreadOnlyText ?? t('mypage.notifications.unread_only')}
|
||||
onClose={onNotificationClose}
|
||||
onNotificationClick={onNotificationClick}
|
||||
onLoadMore={onNotificationLoadMore}
|
||||
onMarkAllRead={onNotificationMarkAllRead}
|
||||
onDeleteAll={onNotificationDeleteAll}
|
||||
onDelete={onNotificationDelete}
|
||||
onUnreadOnlyToggle={onNotificationUnreadOnlyToggle}
|
||||
dropdownAlign="right"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* 장바구니 */}
|
||||
<Button onClick={() => navigate(`${shopBase}/cart`)} className="relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white cursor-pointer">
|
||||
@@ -391,19 +469,22 @@ const Header: React.FC<HeaderProps> = ({
|
||||
</Div>
|
||||
)}
|
||||
|
||||
{/* 모바일 햄버거 메뉴 */}
|
||||
<Button
|
||||
onClick={onMobileMenuOpen}
|
||||
className="md:hidden p-2 text-gray-600 dark:text-gray-400"
|
||||
>
|
||||
<Icon name="menu" className="w-6 h-6" />
|
||||
</Button>
|
||||
{/* 모바일 햄버거 메뉴 (모바일 전용) */}
|
||||
{isMobile && (
|
||||
<Button
|
||||
onClick={onMobileMenuOpen}
|
||||
className="p-2 text-gray-600 dark:text-gray-400"
|
||||
>
|
||||
<Icon name="menu" className="w-6 h-6" />
|
||||
</Button>
|
||||
)}
|
||||
</Div>
|
||||
</Div>
|
||||
</Div>
|
||||
|
||||
{/* 탭 네비게이션 */}
|
||||
<Nav className="hidden md:block border-t border-gray-200 dark:border-gray-800">
|
||||
{/* 탭 네비게이션 (데스크톱 전용) */}
|
||||
{!isMobile && (
|
||||
<Nav className="border-t border-gray-200 dark:border-gray-800">
|
||||
<Div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<Div className="flex items-center gap-1 h-12 overflow-x-auto">
|
||||
<Button onClick={() => navigate('/')} className={getNavButtonClass(isActiveRoute('/', true))}>
|
||||
@@ -481,6 +562,7 @@ const Header: React.FC<HeaderProps> = ({
|
||||
</Div>
|
||||
</Div>
|
||||
</Nav>
|
||||
)}
|
||||
</HeaderBasic>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -44,7 +44,6 @@ export interface HtmlContentProps {
|
||||
* @example
|
||||
* // HTML 렌더링 (기본값)
|
||||
* <HtmlContent content="<p>안녕하세요</p>" />
|
||||
* <HtmlContent content="<p>안녕하세요</p>" isHtml={true} />
|
||||
*
|
||||
* // 일반 텍스트 렌더링
|
||||
* <HtmlContent
|
||||
@@ -95,41 +94,57 @@ export const HtmlContent: React.FC<HtmlContentProps> = ({
|
||||
);
|
||||
}
|
||||
|
||||
// isHtml=true: HTML 렌더링 (기존 로직)
|
||||
// 기본 DOMPurify 설정
|
||||
// 기본 DOMPurify 설정 (FORBID 방식: 위험 태그/속성만 차단, 나머지 허용)
|
||||
const defaultConfig: any = {
|
||||
ALLOWED_TAGS: [
|
||||
'p', 'br', 'strong', 'em', 'u', 's', 'strike', 'del', 'ins', 'mark',
|
||||
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
||||
'ul', 'ol', 'li',
|
||||
'a', 'img',
|
||||
'blockquote', 'code', 'pre',
|
||||
'table', 'thead', 'tbody', 'tr', 'th', 'td',
|
||||
'div', 'span',
|
||||
FORBID_TAGS: [
|
||||
// 스크립트 실행
|
||||
'script', 'noscript',
|
||||
// 외부 콘텐츠 삽입
|
||||
'iframe', 'frame', 'frameset', 'object', 'embed', 'applet', 'portal',
|
||||
// 폼 요소 (피싱 방지)
|
||||
'form', 'input', 'textarea', 'select', 'button',
|
||||
// 메타/스타일 조작
|
||||
'style', 'link', 'meta', 'base',
|
||||
// 구조 태그 주입
|
||||
'body', 'head', 'html', 'title',
|
||||
// SVG/MathML (XSS 벡터)
|
||||
'svg', 'math',
|
||||
// 미디어 이벤트 핸들러 (onerror, onloadstart)
|
||||
'audio', 'video', 'source', 'track', 'canvas',
|
||||
// UI 오버레이/이벤트
|
||||
'details', 'dialog',
|
||||
// HTML 파서 혼란/sanitizer 우회
|
||||
'plaintext', 'xmp', 'listing',
|
||||
// 레거시/비표준
|
||||
'marquee', 'noframes', 'noembed', 'template', 'slot',
|
||||
],
|
||||
ALLOWED_ATTR: [
|
||||
'href', 'target', 'rel', 'title', 'alt', 'src', 'width', 'height',
|
||||
'class', 'style', 'id', 'data-*',
|
||||
FORBID_ATTR: [
|
||||
'onerror', 'onload', 'onclick', 'onmouseover', 'onfocus', 'onblur',
|
||||
'ontoggle', 'oncanplay', 'onloadstart',
|
||||
'formaction', 'xlink:href', 'action',
|
||||
],
|
||||
ALLOW_DATA_ATTR: true,
|
||||
// 외부 링크는 rel="noopener noreferrer" 자동 추가
|
||||
ADD_ATTR: ['target'],
|
||||
// target="_blank"인 링크에 rel="noopener noreferrer" 자동 추가
|
||||
SAFE_FOR_TEMPLATES: true,
|
||||
};
|
||||
|
||||
// sanitize된 HTML을 메모이제이션
|
||||
const sanitizedHtml = useMemo(() => {
|
||||
const config = purifyConfig || defaultConfig;
|
||||
const config = purifyConfig
|
||||
? {
|
||||
...defaultConfig,
|
||||
...purifyConfig,
|
||||
// 보안 기본값은 항상 유지 (사용자 설정으로 덮어쓰기 방지)
|
||||
FORBID_TAGS: [...defaultConfig.FORBID_TAGS, ...(purifyConfig.FORBID_TAGS || [])],
|
||||
FORBID_ATTR: [...defaultConfig.FORBID_ATTR, ...(purifyConfig.FORBID_ATTR || [])],
|
||||
}
|
||||
: defaultConfig;
|
||||
const cleaned = DOMPurify.sanitize(actualContent, config) as unknown as string;
|
||||
|
||||
// target="_blank" 링크에 rel 속성 추가 (보안)
|
||||
return cleaned.replace(
|
||||
/<a\s+([^>]*?)href=["']([^"']+)["']([^>]*?)>/gi,
|
||||
(match: string, before: string, href: string, after: string) => {
|
||||
// 외부 링크인 경우
|
||||
if (href.startsWith('http://') || href.startsWith('https://')) {
|
||||
// rel 속성이 없으면 추가
|
||||
if (!match.includes('rel=')) {
|
||||
return `<a ${before}href="${href}"${after} rel="noopener noreferrer">`;
|
||||
}
|
||||
@@ -137,7 +152,7 @@ export const HtmlContent: React.FC<HtmlContentProps> = ({
|
||||
return match;
|
||||
}
|
||||
);
|
||||
}, [actualContent, purifyConfig, defaultConfig]);
|
||||
}, [actualContent, purifyConfig]);
|
||||
|
||||
// 컨테이너 클래스 조합
|
||||
const containerClasses = `
|
||||
@@ -147,19 +162,20 @@ export const HtmlContent: React.FC<HtmlContentProps> = ({
|
||||
prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg
|
||||
prose-a:text-blue-600 dark:prose-a:text-blue-400
|
||||
prose-a:no-underline hover:prose-a:underline
|
||||
prose-img:rounded-lg prose-img:shadow-md
|
||||
prose-blockquote:border-l-4 prose-blockquote:border-gray-300 dark:prose-blockquote:border-gray-600
|
||||
prose-blockquote:pl-4 prose-blockquote:italic
|
||||
prose-code:bg-gray-100 dark:prose-code:bg-gray-800
|
||||
prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
||||
prose-pre:bg-gray-100 dark:prose-pre:bg-gray-800
|
||||
prose-pre:p-4 prose-pre:rounded-lg prose-pre:overflow-x-auto
|
||||
prose-table:border prose-table:border-gray-300 dark:prose-table:border-gray-600
|
||||
prose-th:bg-gray-100 dark:prose-th:bg-gray-800
|
||||
prose-th:border prose-th:border-gray-300 dark:prose-th:border-gray-600
|
||||
prose-th:px-4 prose-th:py-2
|
||||
prose-td:border prose-td:border-gray-300 dark:prose-td:border-gray-600
|
||||
prose-td:px-4 prose-td:py-2
|
||||
[&_table]:w-full [&_table]:border-collapse [&_table]:border [&_table]:border-gray-300
|
||||
dark:[&_table]:border-gray-600
|
||||
[&_th]:border [&_th]:border-gray-300 [&_th]:px-4 [&_th]:py-2 [&_th]:bg-gray-100 [&_th]:text-left
|
||||
dark:[&_th]:border-gray-600 dark:[&_th]:bg-gray-800
|
||||
[&_td]:border [&_td]:border-gray-300 [&_td]:px-4 [&_td]:py-2
|
||||
dark:[&_td]:border-gray-600
|
||||
[&_tr:hover]:bg-gray-50 dark:[&_tr:hover]:bg-gray-700/50
|
||||
after:content-[''] after:block after:clear-both
|
||||
${className}
|
||||
`.trim().replace(/\s+/g, ' ');
|
||||
|
||||
|
||||
@@ -88,6 +88,15 @@ const MobileNav: React.FC<MobileNavProps> = ({
|
||||
}) => {
|
||||
const drawerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// G7Core.useResponsive를 통해 반응형 상태 구독 (G7 표준 — 위지윅 overrideWidth 호환)
|
||||
const G7Core = (window as any).G7Core;
|
||||
const useResponsive = G7Core?.useResponsive;
|
||||
const responsiveValue = useResponsive?.();
|
||||
// lg 미만(< 1024px)에서만 드로어 노출 — 데스크톱은 Header의 탭 nav 사용
|
||||
const isPortable = responsiveValue
|
||||
? responsiveValue.width < 1024
|
||||
: typeof window !== 'undefined' && window.innerWidth < 1024;
|
||||
|
||||
// ESC 키로 닫기
|
||||
useEffect(() => {
|
||||
const handleEscape = (e: KeyboardEvent) => {
|
||||
@@ -115,10 +124,12 @@ const MobileNav: React.FC<MobileNavProps> = ({
|
||||
};
|
||||
|
||||
if (!isOpen) return null;
|
||||
// 데스크톱(lg+)에서는 모바일 드로어 자체를 노출하지 않음 (위지윅 overrideWidth 호환)
|
||||
if (!isPortable) return null;
|
||||
|
||||
return (
|
||||
<Div
|
||||
className="fixed inset-0 z-50 lg:hidden"
|
||||
className="fixed inset-0 z-50"
|
||||
onClick={handleOverlayClick}
|
||||
>
|
||||
{/* 오버레이 */}
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
||||
import { Div } from '../basic/Div';
|
||||
import { Button } from '../basic/Button';
|
||||
import { Span } from '../basic/Span';
|
||||
import { Icon } from '../basic/Icon';
|
||||
import { IconName } from '../basic/IconTypes';
|
||||
import { Input } from '../basic/Input';
|
||||
|
||||
/**
|
||||
* 알림 아이템 인터페이스
|
||||
*/
|
||||
export interface NotificationItem {
|
||||
id: string | number;
|
||||
title: string;
|
||||
message: string;
|
||||
time: string;
|
||||
read?: boolean;
|
||||
iconName?: IconName;
|
||||
data?: Record<string, unknown>;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* NotificationCenter Props
|
||||
*/
|
||||
export interface NotificationCenterProps {
|
||||
/** 알림 목록 */
|
||||
notifications?: NotificationItem[];
|
||||
/** 서버 기반 미읽음 알림 수 */
|
||||
unreadCount?: number;
|
||||
/** 추가 로드 가능 여부 */
|
||||
hasMore?: boolean;
|
||||
/** 로딩 상태 */
|
||||
loading?: boolean;
|
||||
/** 알림 제목 텍스트 */
|
||||
titleText?: string;
|
||||
/** 알림 없음 텍스트 */
|
||||
emptyText?: string;
|
||||
/** "모두 읽음" 버튼 텍스트 */
|
||||
markAllReadText?: string;
|
||||
/** "모두 삭제" 버튼 텍스트 */
|
||||
deleteAllText?: string;
|
||||
/** "미읽음만" 체크박스 텍스트 */
|
||||
unreadOnlyText?: string;
|
||||
/** "미읽음만" 체크박스 상태 */
|
||||
unreadOnly?: boolean;
|
||||
/** 알림 클릭 핸들러 (알림 전체 객체 전달) */
|
||||
onNotificationClick?: (notification: NotificationItem) => void;
|
||||
/** 드롭다운 닫힐 때 (뷰포트에 들어온 미읽음 알림 ID 목록) */
|
||||
onClose?: (visibleUnreadIds: (string | number)[]) => void;
|
||||
/** 추가 로드 요청 */
|
||||
onLoadMore?: () => void;
|
||||
/** 모두 읽음 처리 요청 */
|
||||
onMarkAllRead?: () => void;
|
||||
/** 모두 삭제 요청 */
|
||||
onDeleteAll?: () => void;
|
||||
/** 개별 알림 삭제 요청 (알림 전체 객체 전달) */
|
||||
onDelete?: (notification: NotificationItem) => void;
|
||||
/** "미읽음만" 체크박스 토글 */
|
||||
onUnreadOnlyToggle?: (checked: boolean) => void;
|
||||
/** 드롭다운 정렬 방향 — "right"(기본): 우측 정렬되어 좌측으로 확장 / "left": 좌측 정렬되어 우측으로 확장 */
|
||||
dropdownAlign?: 'left' | 'right';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* NotificationCenter 컴포넌트 (User)
|
||||
*
|
||||
* 알림 센터 - 알림 목록 표시, 무한스크롤, 읽음 추적.
|
||||
* sirsoft-admin_basic의 NotificationCenter와 동일 API/동작을 제공한다.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* <NotificationCenter
|
||||
* notifications={[
|
||||
* { id: 1, title: '새 댓글', message: '게시물에 댓글이 달렸습니다', time: '5분 전' }
|
||||
* ]}
|
||||
* unreadCount={5}
|
||||
* hasMore={true}
|
||||
* titleText="알림"
|
||||
* emptyText="알림이 없습니다."
|
||||
* />
|
||||
* ```
|
||||
*/
|
||||
export const NotificationCenter: React.FC<NotificationCenterProps> = ({
|
||||
notifications = [],
|
||||
unreadCount = 0,
|
||||
hasMore = false,
|
||||
loading = false,
|
||||
titleText = '알림',
|
||||
emptyText = '알림이 없습니다.',
|
||||
markAllReadText = '모두 읽음',
|
||||
deleteAllText = '모두 삭제',
|
||||
unreadOnlyText = '안 읽은 알림만',
|
||||
unreadOnly = false,
|
||||
onNotificationClick,
|
||||
onClose,
|
||||
onLoadMore,
|
||||
onMarkAllRead,
|
||||
onDeleteAll,
|
||||
onDelete,
|
||||
onUnreadOnlyToggle,
|
||||
dropdownAlign = 'right',
|
||||
className = '',
|
||||
}) => {
|
||||
const [showNotifications, setShowNotifications] = useState(false);
|
||||
const notificationRef = useRef<HTMLDivElement>(null);
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
const sentinelRef = useRef<HTMLDivElement>(null);
|
||||
const visibleUnreadIdsRef = useRef<Set<string | number>>(new Set());
|
||||
|
||||
/**
|
||||
* 무한스크롤 — IntersectionObserver
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (!sentinelRef.current || !scrollRef.current || !hasMore || loading || !showNotifications) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
if (entry.isIntersecting) {
|
||||
onLoadMore?.();
|
||||
}
|
||||
},
|
||||
{ root: scrollRef.current, threshold: 0.1 }
|
||||
);
|
||||
|
||||
observer.observe(sentinelRef.current);
|
||||
return () => observer.disconnect();
|
||||
}, [hasMore, loading, showNotifications, onLoadMore, notifications.length]);
|
||||
|
||||
/**
|
||||
* 뷰포트 내 미읽음 알림 추적 — IntersectionObserver
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (!scrollRef.current || !showNotifications) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
const id = entry.target.getAttribute('data-notification-id');
|
||||
const isUnread = entry.target.getAttribute('data-unread') === 'true';
|
||||
if (id && isUnread && entry.isIntersecting) {
|
||||
visibleUnreadIdsRef.current.add(id);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
root: scrollRef.current,
|
||||
threshold: 0.5,
|
||||
}
|
||||
);
|
||||
|
||||
const items = scrollRef.current.querySelectorAll('[data-notification-id]');
|
||||
items.forEach((item) => observer.observe(item));
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, [showNotifications, notifications]);
|
||||
|
||||
/**
|
||||
* 드롭다운 닫기 — 뷰포트에 들어온 미읽음 알림 ID 전달
|
||||
*/
|
||||
const handleClose = useCallback(() => {
|
||||
if (showNotifications) {
|
||||
const ids = Array.from(visibleUnreadIdsRef.current);
|
||||
if (ids.length > 0) {
|
||||
onClose?.(ids);
|
||||
}
|
||||
visibleUnreadIdsRef.current.clear();
|
||||
setShowNotifications(false);
|
||||
}
|
||||
}, [showNotifications, onClose]);
|
||||
|
||||
/**
|
||||
* 외부 클릭 감지 — 드롭다운이 열려 있을 때만 리스너 등록
|
||||
* (stale closure 방지: showNotifications 변경 시 리스너 재등록)
|
||||
* 주의: handleClose가 useCallback으로 선언된 이후에 위치해야 TDZ 위반 방지
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (!showNotifications) return;
|
||||
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (
|
||||
notificationRef.current &&
|
||||
!notificationRef.current.contains(event.target as Node)
|
||||
) {
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('mousedown', handleClickOutside);
|
||||
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||
}, [showNotifications, handleClose]);
|
||||
|
||||
/**
|
||||
* 드롭다운 토글
|
||||
*/
|
||||
const handleToggle = useCallback(() => {
|
||||
if (showNotifications) {
|
||||
handleClose();
|
||||
} else {
|
||||
setShowNotifications(true);
|
||||
}
|
||||
}, [showNotifications, handleClose]);
|
||||
|
||||
/**
|
||||
* 뱃지에 표시할 카운트
|
||||
*/
|
||||
const displayCount = unreadCount > 0 ? unreadCount : notifications.filter((n) => !n.read).length;
|
||||
|
||||
return (
|
||||
<Div ref={notificationRef} className={`relative ${className}`}>
|
||||
<Button
|
||||
onClick={handleToggle}
|
||||
className="relative p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-colors cursor-pointer"
|
||||
aria-label={titleText}
|
||||
>
|
||||
<Icon name={IconName.Bell} className="w-5 h-5" />
|
||||
{displayCount > 0 && (
|
||||
<Span className="absolute -top-1 -right-1 w-5 h-5 flex items-center justify-center text-xs font-bold text-white bg-red-500 rounded-full">
|
||||
{displayCount > 99 ? '99+' : displayCount}
|
||||
</Span>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
{/* 알림 드롭다운 */}
|
||||
{showNotifications && (
|
||||
<Div className={`absolute ${dropdownAlign === 'left' ? 'left-0' : 'right-0'} mt-2 w-80 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50`}>
|
||||
<Div className="px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between gap-2">
|
||||
<Div className="flex items-center gap-3 min-w-0">
|
||||
<Span className="font-semibold text-gray-900 dark:text-white">{titleText}</Span>
|
||||
{onUnreadOnlyToggle && (
|
||||
<Div
|
||||
className="flex items-center gap-1.5 cursor-pointer select-none"
|
||||
onClick={() => onUnreadOnlyToggle(!unreadOnly)}
|
||||
>
|
||||
<Input
|
||||
type="checkbox"
|
||||
checked={unreadOnly}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
e.stopPropagation();
|
||||
onUnreadOnlyToggle(e.target.checked);
|
||||
}}
|
||||
onClick={(e: React.MouseEvent) => e.stopPropagation()}
|
||||
className="w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 cursor-pointer"
|
||||
/>
|
||||
<Span className="text-xs text-gray-600 dark:text-gray-400">{unreadOnlyText}</Span>
|
||||
</Div>
|
||||
)}
|
||||
</Div>
|
||||
<Div className="flex items-center gap-3 flex-shrink-0">
|
||||
{onMarkAllRead && displayCount > 0 && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
onMarkAllRead();
|
||||
visibleUnreadIdsRef.current.clear();
|
||||
}}
|
||||
className="text-xs text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 hover:underline cursor-pointer"
|
||||
>
|
||||
{markAllReadText}
|
||||
</Button>
|
||||
)}
|
||||
{onDeleteAll && notifications.length > 0 && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
// 드롭다운은 닫지 않음 — 확인 모달이 닫히면 다시 자연스럽게 노출되어야 하고,
|
||||
// 사용자가 모달 취소 시에도 컨텍스트 유지 (PO 요구)
|
||||
onDeleteAll();
|
||||
}}
|
||||
className="text-xs text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 hover:underline cursor-pointer"
|
||||
>
|
||||
{deleteAllText}
|
||||
</Button>
|
||||
)}
|
||||
</Div>
|
||||
</Div>
|
||||
<Div ref={scrollRef} className="max-h-96 overflow-y-auto">
|
||||
{notifications.length === 0 && !loading ? (
|
||||
<Div className="px-4 py-8 text-center text-gray-500 dark:text-gray-400">
|
||||
<Span>{emptyText}</Span>
|
||||
</Div>
|
||||
) : (
|
||||
<>
|
||||
{notifications.map((notification) => {
|
||||
const isUnread = !notification.read;
|
||||
return (
|
||||
<Div
|
||||
key={notification.id}
|
||||
data-notification-id={notification.id}
|
||||
data-unread={isUnread ? 'true' : 'false'}
|
||||
onClick={() => {
|
||||
notification.onClick?.();
|
||||
onNotificationClick?.(notification);
|
||||
setShowNotifications(false);
|
||||
}}
|
||||
className={`group flex items-start gap-3 px-4 py-3 text-left border-b border-gray-100 dark:border-gray-700 transition-colors cursor-pointer ${
|
||||
isUnread
|
||||
? 'bg-blue-50/70 dark:bg-blue-900/20 hover:bg-blue-50 dark:hover:bg-blue-900/30'
|
||||
: 'bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/50 opacity-70'
|
||||
}`}
|
||||
>
|
||||
{notification.iconName && (
|
||||
<Icon
|
||||
name={notification.iconName}
|
||||
className={`w-5 h-5 mt-0.5 flex-shrink-0 ${
|
||||
isUnread ? 'text-blue-600 dark:text-blue-400' : 'text-gray-400 dark:text-gray-500'
|
||||
}`}
|
||||
/>
|
||||
)}
|
||||
<Div className="flex-1 min-w-0">
|
||||
<Div
|
||||
className={`text-sm truncate ${
|
||||
isUnread
|
||||
? 'font-semibold text-gray-900 dark:text-white'
|
||||
: 'font-normal text-gray-600 dark:text-gray-400'
|
||||
}`}
|
||||
>
|
||||
{notification.title}
|
||||
</Div>
|
||||
<Div
|
||||
className={`text-sm mt-1 line-clamp-2 ${
|
||||
isUnread ? 'text-gray-700 dark:text-gray-300' : 'text-gray-500 dark:text-gray-500'
|
||||
}`}
|
||||
>
|
||||
{notification.message}
|
||||
</Div>
|
||||
<Div className="text-gray-400 dark:text-gray-500 text-xs mt-1 font-mono">
|
||||
{notification.time}
|
||||
</Div>
|
||||
</Div>
|
||||
<Div className="flex flex-col items-center gap-2 flex-shrink-0">
|
||||
{isUnread && (
|
||||
<Span className="w-2 h-2 bg-blue-500 rounded-full mt-1.5" />
|
||||
)}
|
||||
{onDelete && (
|
||||
<Button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(notification);
|
||||
}}
|
||||
className="p-1 text-gray-400 dark:text-gray-500 hover:text-red-600 dark:hover:text-red-400 rounded hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity"
|
||||
aria-label="Delete notification"
|
||||
>
|
||||
<Icon name={IconName.Trash} className="w-4 h-4" />
|
||||
</Button>
|
||||
)}
|
||||
</Div>
|
||||
</Div>
|
||||
);
|
||||
})}
|
||||
{/* 무한스크롤 sentinel */}
|
||||
{hasMore && (
|
||||
<Div ref={sentinelRef} className="px-4 py-3 text-center">
|
||||
{loading ? (
|
||||
<Span className="text-sm text-gray-400 dark:text-gray-500">...</Span>
|
||||
) : (
|
||||
<Span className="text-sm text-gray-400 dark:text-gray-500" />
|
||||
)}
|
||||
</Div>
|
||||
)}
|
||||
{loading && !hasMore && notifications.length > 0 && (
|
||||
<Div className="px-4 py-2 text-center">
|
||||
<Span className="text-sm text-gray-400 dark:text-gray-500">...</Span>
|
||||
</Div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Div>
|
||||
</Div>
|
||||
)}
|
||||
</Div>
|
||||
);
|
||||
};
|
||||
|
||||
export default NotificationCenter;
|
||||
@@ -422,29 +422,30 @@ function renderChildren(
|
||||
children: LayoutComponent[] | undefined,
|
||||
animClass: string,
|
||||
iterCount: number,
|
||||
width: number,
|
||||
): (React.ReactElement | null)[] {
|
||||
if (!children || children.length === 0) return [];
|
||||
const filtered = filterChildren(children);
|
||||
return filtered.map((child, i) =>
|
||||
renderSkeletonNode(child, animClass, iterCount, i)
|
||||
renderSkeletonNode(child, animClass, iterCount, i, width)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 뷰포트에 맞는 className 결정
|
||||
*
|
||||
* responsive 속성이 있으면 현재 window 크기에 따라 적절한 className 선택.
|
||||
* responsive 속성이 있으면 호출자가 전달한 viewport width 기준으로 적절한 className 선택.
|
||||
* - desktop (lg, 1024px+): responsive.desktop.props.className
|
||||
* - tablet (md, 768px+): responsive.tablet.props.className
|
||||
* - 기본: props.className
|
||||
*
|
||||
* @param width G7Core.useResponsive()로 구독한 viewport width (overrideWidth 반영)
|
||||
*/
|
||||
function resolveClassName(component: LayoutComponent): string {
|
||||
function resolveClassName(component: LayoutComponent, width: number): string {
|
||||
const baseClassName = component.props?.className || component.className || '';
|
||||
|
||||
if (!component.responsive) return baseClassName;
|
||||
|
||||
const width = typeof window !== 'undefined' ? window.innerWidth : 1024;
|
||||
|
||||
if (width >= 1024 && component.responsive.desktop?.props?.className) {
|
||||
return component.responsive.desktop.props.className;
|
||||
}
|
||||
@@ -456,18 +457,19 @@ function resolveClassName(component: LayoutComponent): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tailwind 반응형 display 클래스를 현재 뷰포트 기준으로 해석
|
||||
* Tailwind 반응형 display 클래스를 viewport 기준으로 해석
|
||||
*
|
||||
* 레이아웃 JSON의 className에 `hidden lg:grid`, `lg:hidden` 같은 Tailwind 반응형 패턴이 포함됨.
|
||||
* Tailwind은 빌드 시 CSS로 처리하지만, 스켈레톤은 런타임에서 JS로 해석해야 함.
|
||||
*
|
||||
* 동작:
|
||||
* 1. className에서 display 관련 클래스(hidden, flex, grid 등) + 반응형 접두사(lg:grid 등) 추출
|
||||
* 2. Tailwind cascade 규칙 적용: base → sm → md → lg → xl → 2xl 순서로 현재 width에 맞는 display 결정
|
||||
* 2. Tailwind cascade 규칙 적용: base → sm → md → lg → xl → 2xl 순서로 width에 맞는 display 결정
|
||||
* 3. hidden이면 컴포넌트 숨김, 아니면 해석된 display 클래스 + 나머지 클래스 반환
|
||||
*
|
||||
* @param width G7Core.useResponsive()로 구독한 viewport width (overrideWidth 반영)
|
||||
*/
|
||||
function resolveResponsiveDisplay(className: string): { visible: boolean; className: string } {
|
||||
const width = typeof window !== 'undefined' ? window.innerWidth : 1024;
|
||||
function resolveResponsiveDisplay(className: string, width: number): { visible: boolean; className: string } {
|
||||
const tokens = className.split(/\s+/).filter(Boolean);
|
||||
|
||||
const displayEntries: Array<{ breakpoint: number; display: string }> = [];
|
||||
@@ -560,10 +562,11 @@ function renderSkeletonNode(
|
||||
animClass: string,
|
||||
iterCount: number,
|
||||
index: number,
|
||||
width: number,
|
||||
): React.ReactElement | null {
|
||||
const { name, children, iteration } = component;
|
||||
// 1. responsive 속성에서 뷰포트에 맞는 className 선택
|
||||
const rawClassName = resolveClassName(component);
|
||||
const rawClassName = resolveClassName(component, width);
|
||||
// 1.5. Flex/Grid 레이아웃 props → Tailwind 클래스 병합
|
||||
const layoutClasses = resolveLayoutProps(component);
|
||||
const mergedClassName = layoutClasses
|
||||
@@ -572,7 +575,7 @@ function renderSkeletonNode(
|
||||
// 2. {{...}} 표현식 해석 (삼항 → true 분기)
|
||||
const exprResolved = resolveExpressions(mergedClassName);
|
||||
// 3. Tailwind 반응형 display 클래스 해석 (hidden lg:grid → grid at desktop)
|
||||
const responsive = resolveResponsiveDisplay(exprResolved);
|
||||
const responsive = resolveResponsiveDisplay(exprResolved, width);
|
||||
|
||||
if (!name) return null;
|
||||
|
||||
@@ -591,6 +594,7 @@ function renderSkeletonNode(
|
||||
animClass,
|
||||
iterCount,
|
||||
i,
|
||||
width,
|
||||
)
|
||||
))}
|
||||
</React.Fragment>
|
||||
@@ -620,7 +624,7 @@ function renderSkeletonNode(
|
||||
}
|
||||
|
||||
// 자식 렌더링 (조건부 분기 필터링 적용)
|
||||
const renderedChildren = renderChildren(children, animClass, iterCount);
|
||||
const renderedChildren = renderChildren(children, animClass, iterCount, width);
|
||||
const hasContent = renderedChildren.length > 0 && renderedChildren.some(c => c !== null);
|
||||
|
||||
// 모든 자식이 필터링됨 (로딩/에러 wrapper 등) → 컨테이너 자체 스킵
|
||||
@@ -686,7 +690,7 @@ function renderSkeletonNode(
|
||||
if (name === 'Button') {
|
||||
if (children && children.length > 0) {
|
||||
const sanitized = sanitizeClassName(className, name);
|
||||
const renderedChildren = renderChildren(children, animClass, iterCount);
|
||||
const renderedChildren = renderChildren(children, animClass, iterCount, width);
|
||||
const hasContent = renderedChildren.length > 0 && renderedChildren.some(c => c !== null);
|
||||
if (!hasContent) return null;
|
||||
// 원본 className에 border/rounded가 있으면 실제 버튼 형태 → 스켈레톤 경계 추가
|
||||
@@ -712,7 +716,7 @@ function renderSkeletonNode(
|
||||
if (children && children.length > 0) {
|
||||
return (
|
||||
<div key={index} className={sanitizedLeafClass}>
|
||||
{renderChildren(children, animClass, iterCount)}
|
||||
{renderChildren(children, animClass, iterCount, width)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -740,6 +744,14 @@ function renderSkeletonNode(
|
||||
export const PageSkeleton: React.FC<PageSkeletonProps> = ({ components, options }) => {
|
||||
const animClass = getAnimationClass(options.animation);
|
||||
|
||||
// G7Core.useResponsive를 통해 viewport width 구독 (G7 표준 — 위지윅 overrideWidth 호환)
|
||||
const G7Core = (window as any).G7Core;
|
||||
const useResponsive = G7Core?.useResponsive;
|
||||
const responsiveValue = useResponsive?.();
|
||||
const width = responsiveValue
|
||||
? responsiveValue.width
|
||||
: (typeof window !== 'undefined' ? window.innerWidth : 1024);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="w-full"
|
||||
@@ -747,7 +759,7 @@ export const PageSkeleton: React.FC<PageSkeletonProps> = ({ components, options
|
||||
aria-busy="true"
|
||||
aria-label="Loading..."
|
||||
>
|
||||
{renderChildren(components, animClass, options.iteration_count)}
|
||||
{renderChildren(components, animClass, options.iteration_count, width)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import { Nav } from '../basic/Nav';
|
||||
import { Button } from '../basic/Button';
|
||||
import { Icon } from '../basic/Icon';
|
||||
import { IconName } from '../basic/IconTypes';
|
||||
import { Div } from '../basic/Div';
|
||||
import { Span } from '../basic/Span';
|
||||
import { Select } from '../basic/Select';
|
||||
|
||||
export interface Tab {
|
||||
id: string | number;
|
||||
@@ -21,12 +22,10 @@ export interface TabNavigationProps {
|
||||
variant?: 'default' | 'pills' | 'underline';
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
/** 모바일에서 그리드 레이아웃 사용 (기본: true) */
|
||||
mobileGrid?: boolean;
|
||||
/** 모바일 그리드 컬럼 수 (기본: 3) */
|
||||
mobileColumns?: number;
|
||||
/** 숨길 탭 ID 목록 (동적 조건부 탭 노출용) */
|
||||
hiddenTabIds?: (string | number)[];
|
||||
/** 모바일 전환 임계값 (px). 기본값 768 — G7 ResponsiveContext mobile 프리셋과 동일 */
|
||||
mobileBreakpoint?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,12 +33,15 @@ export interface TabNavigationProps {
|
||||
*
|
||||
* 탭 네비게이션을 제공하는 컴포넌트입니다.
|
||||
* 여러 탭을 전환할 수 있으며, 아이콘과 뱃지를 지원합니다.
|
||||
* 모바일에서는 그리드 레이아웃으로 표시합니다.
|
||||
*
|
||||
* 반응형: G7Core.useResponsive() hook으로 화면 너비를 구독하여
|
||||
* mobileBreakpoint(기본 768px) 미만일 때 Select 드롭다운으로 자동 전환됩니다.
|
||||
* Tailwind hidden md:flex 분기를 사용하지 않으므로 위지윅 편집기의 디바이스 미리보기와도 호환됩니다.
|
||||
*
|
||||
* **주의**: 이 컴포넌트는 순수 네비게이션 UI만 제공하며,
|
||||
* 실제 탭 컨텐츠는 부모 컴포넌트에서 activeTabId를 기반으로 조건부 렌더링해야 합니다.
|
||||
*
|
||||
* 기본 컴포넌트 조합: Nav + Button + Icon + Div + Span
|
||||
* 기본 컴포넌트 조합: Nav + Button + Icon + Div + Span + Select
|
||||
*
|
||||
* @example
|
||||
* // 레이아웃 JSON 사용 예시
|
||||
@@ -47,7 +49,6 @@ export interface TabNavigationProps {
|
||||
* "name": "TabNavigation",
|
||||
* "props": {
|
||||
* "activeTabId": 1,
|
||||
* "mobileColumns": 3,
|
||||
* "tabs": [
|
||||
* {"id": 1, "label": "프로필", "iconName": "user"},
|
||||
* {"id": 2, "label": "설정", "iconName": "cog", "badge": 3},
|
||||
@@ -64,22 +65,16 @@ export const TabNavigation: React.FC<TabNavigationProps> = ({
|
||||
variant = 'underline',
|
||||
className = '',
|
||||
style,
|
||||
mobileGrid = true,
|
||||
mobileColumns = 3,
|
||||
hiddenTabIds = [],
|
||||
mobileBreakpoint = 768,
|
||||
}) => {
|
||||
const [isMobile, setIsMobile] = useState(false);
|
||||
|
||||
// 모바일 감지 (768px 기준)
|
||||
useEffect(() => {
|
||||
const checkMobile = () => {
|
||||
setIsMobile(window.innerWidth < 768);
|
||||
};
|
||||
|
||||
checkMobile();
|
||||
window.addEventListener('resize', checkMobile);
|
||||
return () => window.removeEventListener('resize', checkMobile);
|
||||
}, []);
|
||||
// G7Core.useResponsive를 통해 반응형 상태 구독 (G7 표준)
|
||||
const G7Core = (window as any).G7Core;
|
||||
const useResponsive = G7Core?.useResponsive;
|
||||
const responsiveValue = useResponsive?.();
|
||||
const isMobile = responsiveValue
|
||||
? responsiveValue.width < mobileBreakpoint
|
||||
: typeof window !== 'undefined' && window.innerWidth < mobileBreakpoint;
|
||||
|
||||
const handleTabClick = (tab: Tab) => {
|
||||
if (!tab.disabled && tab.id !== activeTabId) {
|
||||
@@ -87,23 +82,52 @@ export const TabNavigation: React.FC<TabNavigationProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelectChange = (
|
||||
e: React.ChangeEvent<HTMLSelectElement> | { target: { value: string | number } }
|
||||
) => {
|
||||
const selectedId = e.target.value;
|
||||
const numericId = Number(selectedId);
|
||||
const finalId =
|
||||
typeof selectedId === 'string' && selectedId !== '' && !Number.isNaN(numericId)
|
||||
? numericId
|
||||
: selectedId;
|
||||
const selectedTab = tabs.find((tab) => String(tab.id) === String(finalId));
|
||||
if (selectedTab) {
|
||||
handleTabClick(selectedTab);
|
||||
}
|
||||
};
|
||||
|
||||
const visibleTabs = hiddenTabIds.length > 0
|
||||
? tabs.filter((tab) => !hiddenTabIds.includes(tab.id))
|
||||
: tabs;
|
||||
|
||||
// 모바일: Select 드롭다운 단일 렌더
|
||||
if (isMobile) {
|
||||
return (
|
||||
<Div className={`relative ${className}`} style={style}>
|
||||
<Select
|
||||
value={activeTabId !== undefined ? String(activeTabId) : ''}
|
||||
onChange={handleSelectChange}
|
||||
options={visibleTabs.map((tab) => ({
|
||||
value: String(tab.id),
|
||||
label: tab.badge !== undefined ? `${tab.label} (${tab.badge})` : tab.label,
|
||||
disabled: tab.disabled,
|
||||
}))}
|
||||
className="w-full"
|
||||
/>
|
||||
</Div>
|
||||
);
|
||||
}
|
||||
|
||||
const getTabClasses = (tab: Tab) => {
|
||||
const isActive = tab.id === activeTabId;
|
||||
const baseClasses = isMobile && mobileGrid
|
||||
? 'flex flex-col items-center justify-center gap-3 pt-4 pb-2 font-medium text-sm transition-all'
|
||||
: 'flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap';
|
||||
const baseClasses =
|
||||
'flex items-center gap-2 px-3 py-2 font-medium text-sm transition-all shrink-0 whitespace-nowrap';
|
||||
|
||||
if (tab.disabled) {
|
||||
return `${baseClasses} opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-600`;
|
||||
}
|
||||
|
||||
// 모바일 그리드 스타일
|
||||
if (isMobile && mobileGrid) {
|
||||
return isActive
|
||||
? `${baseClasses} text-gray-900 dark:text-white bg-gray-100 dark:bg-gray-700 rounded-lg`
|
||||
: `${baseClasses} text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-700 rounded-lg`;
|
||||
}
|
||||
|
||||
switch (variant) {
|
||||
case 'pills':
|
||||
return isActive
|
||||
@@ -123,65 +147,36 @@ export const TabNavigation: React.FC<TabNavigationProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
// 모바일 그리드 컬럼 클래스
|
||||
const getGridColumnsClass = () => {
|
||||
switch (mobileColumns) {
|
||||
case 2:
|
||||
return 'grid-cols-2';
|
||||
case 4:
|
||||
return 'grid-cols-4';
|
||||
case 3:
|
||||
default:
|
||||
return 'grid-cols-3';
|
||||
}
|
||||
};
|
||||
|
||||
const navClasses = isMobile && mobileGrid
|
||||
? `grid ${getGridColumnsClass()} gap-1 p-1 bg-gray-50 dark:bg-gray-800 rounded-lg`
|
||||
: variant === 'underline'
|
||||
const navClasses =
|
||||
variant === 'underline'
|
||||
? 'flex gap-0 border-b border-gray-200 dark:border-gray-700'
|
||||
: 'flex gap-2';
|
||||
|
||||
const renderTabButton = (tab: Tab) => (
|
||||
<Button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={() => handleTabClick(tab)}
|
||||
disabled={tab.disabled}
|
||||
className={getTabClasses(tab)}
|
||||
>
|
||||
{tab.iconName && (
|
||||
<Icon name={tab.iconName} size="sm"/>
|
||||
)}
|
||||
|
||||
{isMobile && mobileGrid && tab.badge !== undefined ? (
|
||||
<Div className="flex items-center gap-1">
|
||||
<Span className="text-xs">{tab.label}</Span>
|
||||
<Div className="flex items-center justify-center min-w-5 h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full">
|
||||
<Span>{tab.badge}</Span>
|
||||
</Div>
|
||||
</Div>
|
||||
) : (
|
||||
<>
|
||||
<Span className={isMobile && mobileGrid ? 'text-xs' : ''}>{tab.label}</Span>
|
||||
{tab.badge !== undefined && (
|
||||
<Div className="flex items-center justify-center min-w-5 h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full">
|
||||
<Span>{tab.badge}</Span>
|
||||
</Div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
|
||||
const visibleTabs = hiddenTabIds.length > 0
|
||||
? tabs.filter((tab) => !hiddenTabIds.includes(tab.id))
|
||||
: tabs;
|
||||
|
||||
// 데스크톱: 탭 버튼 단일 렌더
|
||||
return (
|
||||
<Div className={`relative ${className}`} style={style}>
|
||||
<Nav className={navClasses}>
|
||||
{visibleTabs.map((tab) => renderTabButton(tab))}
|
||||
{visibleTabs.map((tab) => (
|
||||
<Button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={() => handleTabClick(tab)}
|
||||
disabled={tab.disabled}
|
||||
className={getTabClasses(tab)}
|
||||
>
|
||||
{tab.iconName && (
|
||||
<Icon name={tab.iconName} size="sm" />
|
||||
)}
|
||||
|
||||
<Span>{tab.label}</Span>
|
||||
|
||||
{tab.badge !== undefined && (
|
||||
<Div className="flex items-center justify-center min-w-5 h-5 px-1.5 bg-red-500 text-white text-xs font-bold rounded-full">
|
||||
<Span>{tab.badge}</Span>
|
||||
</Div>
|
||||
)}
|
||||
</Button>
|
||||
))}
|
||||
</Nav>
|
||||
</Div>
|
||||
);
|
||||
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
* NotificationCenter 컴포넌트 테스트 (sirsoft-basic)
|
||||
*
|
||||
* @description 알림센터 드롭다운의 핵심 동작 검증
|
||||
* 주요 회귀:
|
||||
* - 알림 카드는 Button이 아닌 Div (button-in-button HTML 무효 회피)
|
||||
* - 외부 클릭 useEffect 의존성에 [showNotifications, handleClose] 포함
|
||||
* - useEffect는 handleClose(useCallback) 정의 이후 위치 → TDZ 회피
|
||||
* - 콜백은 notification 객체 전체를 인자로 전달 (id가 아님)
|
||||
*/
|
||||
import React from 'react';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, fireEvent, cleanup } from '@testing-library/react';
|
||||
import { NotificationCenter, type NotificationItem } from '../NotificationCenter';
|
||||
|
||||
// IntersectionObserver 폴리필
|
||||
beforeEach(() => {
|
||||
cleanup();
|
||||
(window as any).IntersectionObserver = class {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
});
|
||||
|
||||
const mockNotifications: NotificationItem[] = [
|
||||
{
|
||||
id: 1,
|
||||
title: '새 댓글',
|
||||
message: '게시물에 댓글이 달렸습니다',
|
||||
time: '2026-04-10 10:00:00',
|
||||
read: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '시스템 알림',
|
||||
message: '시스템 점검이 완료되었습니다',
|
||||
time: '2026-04-10 09:00:00',
|
||||
read: true,
|
||||
},
|
||||
];
|
||||
|
||||
describe('NotificationCenter (sirsoft-basic)', () => {
|
||||
describe('기본 렌더링', () => {
|
||||
it('Bell 트리거 버튼이 렌더링됨', () => {
|
||||
render(<NotificationCenter />);
|
||||
expect(screen.getByLabelText('알림')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('unreadCount가 0보다 크면 배지가 표시됨', () => {
|
||||
render(<NotificationCenter unreadCount={5} />);
|
||||
expect(screen.getByText('5')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('unreadCount가 99 초과 시 99+로 표시됨', () => {
|
||||
render(<NotificationCenter unreadCount={150} />);
|
||||
expect(screen.getByText('99+')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('unreadCount가 0이면 배지가 표시되지 않음', () => {
|
||||
const { container } = render(<NotificationCenter unreadCount={0} notifications={[]} />);
|
||||
// 배지는 .bg-red-500 클래스를 가지는 Span
|
||||
expect(container.querySelector('.bg-red-500')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('드롭다운 토글', () => {
|
||||
it('Bell 클릭 시 드롭다운이 열림', () => {
|
||||
render(<NotificationCenter notifications={mockNotifications} titleText="알림" />);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
expect(screen.getByText('새 댓글')).toBeInTheDocument();
|
||||
expect(screen.getByText('시스템 알림')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('알림이 비어있을 때 emptyText가 표시됨', () => {
|
||||
render(<NotificationCenter notifications={[]} emptyText="알림이 없습니다." />);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
expect(screen.getByText('알림이 없습니다.')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('드롭다운 외부 클릭 시 닫힘 (외부 클릭 의존성 회귀)', () => {
|
||||
const { container } = render(
|
||||
<div>
|
||||
<NotificationCenter notifications={mockNotifications} />
|
||||
<div data-testid="outside">바깥</div>
|
||||
</div>
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
expect(screen.getByText('새 댓글')).toBeInTheDocument();
|
||||
|
||||
fireEvent.mouseDown(screen.getByTestId('outside'));
|
||||
expect(screen.queryByText('새 댓글')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('button-in-button 회귀 — 알림 카드는 Div', () => {
|
||||
it('알림 카드가 button 태그가 아닌 div 태그여야 함', () => {
|
||||
const { container } = render(<NotificationCenter notifications={mockNotifications} />);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
|
||||
const titleEl = screen.getByText('새 댓글');
|
||||
// 가장 가까운 알림 카드 컨테이너 (data-notification-id 속성을 가진 요소)
|
||||
const card = titleEl.closest('[data-notification-id]');
|
||||
expect(card).not.toBeNull();
|
||||
expect(card!.tagName.toLowerCase()).toBe('div');
|
||||
});
|
||||
});
|
||||
|
||||
describe('이벤트 핸들러', () => {
|
||||
it('알림 클릭 시 onNotificationClick 콜백에 객체 전체가 전달됨', () => {
|
||||
const handler = vi.fn();
|
||||
render(
|
||||
<NotificationCenter
|
||||
notifications={mockNotifications}
|
||||
onNotificationClick={handler}
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
const card = screen.getByText('새 댓글').closest('[data-notification-id]');
|
||||
fireEvent.click(card!);
|
||||
|
||||
expect(handler).toHaveBeenCalledTimes(1);
|
||||
expect(handler).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ id: 1, title: '새 댓글' })
|
||||
);
|
||||
});
|
||||
|
||||
it('개별 삭제 버튼 클릭 시 onDelete가 호출되고 카드 클릭 이벤트는 전파되지 않음', () => {
|
||||
const onDelete = vi.fn();
|
||||
const onClick = vi.fn();
|
||||
const { container } = render(
|
||||
<NotificationCenter
|
||||
notifications={mockNotifications}
|
||||
onDelete={onDelete}
|
||||
onNotificationClick={onClick}
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
|
||||
const deleteBtn = container.querySelector('[aria-label="Delete notification"]');
|
||||
expect(deleteBtn).not.toBeNull();
|
||||
fireEvent.click(deleteBtn!);
|
||||
|
||||
expect(onDelete).toHaveBeenCalledTimes(1);
|
||||
expect(onDelete).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ id: 1 })
|
||||
);
|
||||
// stopPropagation 검증: 카드 클릭 핸들러는 호출되지 않아야 함
|
||||
expect(onClick).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('"모두 읽음" 버튼은 displayCount > 0 일 때만 표시되고 onMarkAllRead 호출', () => {
|
||||
const onMarkAllRead = vi.fn();
|
||||
render(
|
||||
<NotificationCenter
|
||||
notifications={mockNotifications}
|
||||
unreadCount={2}
|
||||
onMarkAllRead={onMarkAllRead}
|
||||
markAllReadText="모두 읽음"
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
fireEvent.click(screen.getByText('모두 읽음'));
|
||||
expect(onMarkAllRead).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('"모두 삭제" 버튼은 notifications.length > 0 일 때만 표시되고 onDeleteAll 호출', () => {
|
||||
const onDeleteAll = vi.fn();
|
||||
render(
|
||||
<NotificationCenter
|
||||
notifications={mockNotifications}
|
||||
onDeleteAll={onDeleteAll}
|
||||
deleteAllText="모두 삭제"
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
fireEvent.click(screen.getByText('모두 삭제'));
|
||||
expect(onDeleteAll).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('"안 읽은 알림만" 체크박스 토글 시 onUnreadOnlyToggle 호출', () => {
|
||||
const onUnreadOnlyToggle = vi.fn();
|
||||
render(
|
||||
<NotificationCenter
|
||||
notifications={mockNotifications}
|
||||
unreadOnly={false}
|
||||
onUnreadOnlyToggle={onUnreadOnlyToggle}
|
||||
unreadOnlyText="안 읽은 알림만"
|
||||
/>
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
const checkbox = screen.getByRole('checkbox') as HTMLInputElement;
|
||||
fireEvent.click(checkbox);
|
||||
expect(onUnreadOnlyToggle).toHaveBeenCalled();
|
||||
expect(onUnreadOnlyToggle).toHaveBeenLastCalledWith(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('dropdownAlign prop', () => {
|
||||
it('기본값은 right (right-0 클래스)', () => {
|
||||
const { container } = render(<NotificationCenter notifications={mockNotifications} />);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
expect(container.querySelector('.right-0')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('left 지정 시 left-0 클래스', () => {
|
||||
const { container } = render(
|
||||
<NotificationCenter notifications={mockNotifications} dropdownAlign="left" />
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
expect(container.querySelector('.left-0')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('읽음/미읽음 시각 구분', () => {
|
||||
it('미읽음 알림에는 파란 점이 있음', () => {
|
||||
const { container } = render(
|
||||
<NotificationCenter notifications={mockNotifications} />
|
||||
);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
const blueDots = container.querySelectorAll('.bg-blue-500.rounded-full');
|
||||
// 미읽음 1건만 점 표시
|
||||
expect(blueDots.length).toBe(1);
|
||||
});
|
||||
|
||||
it('미읽음 카드에는 파란 배경 클래스가 적용됨', () => {
|
||||
render(<NotificationCenter notifications={mockNotifications} />);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
const unread = screen.getByText('새 댓글').closest('[data-notification-id]');
|
||||
expect(unread?.className).toMatch(/bg-blue-50/);
|
||||
});
|
||||
|
||||
it('읽음 카드에는 opacity-70 클래스가 적용됨', () => {
|
||||
render(<NotificationCenter notifications={mockNotifications} />);
|
||||
fireEvent.click(screen.getByLabelText('알림'));
|
||||
const read = screen.getByText('시스템 알림').closest('[data-notification-id]');
|
||||
expect(read?.className).toMatch(/opacity-70/);
|
||||
});
|
||||
});
|
||||
});
|
||||
+140
-82
@@ -2,47 +2,30 @@
|
||||
* TabNavigation 컴포넌트 테스트
|
||||
*
|
||||
* @description 탭 네비게이션 컴포넌트의 동작을 테스트합니다.
|
||||
* 주요 검증: 탭 렌더링, 탭 전환, 뱃지 표시, hiddenTabIds, disabled 상태
|
||||
* 주요 검증: 탭 렌더링, 탭 전환, 뱃지 표시, hiddenTabIds, disabled, 반응형 분기 (G7Core.useResponsive)
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import type { Tab } from '../TabNavigation';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import { TabNavigation, type Tab } from '../TabNavigation';
|
||||
|
||||
// basic 컴포넌트 의존성을 제거한 Mock TabNavigation
|
||||
const MockTabNavigation: React.FC<{
|
||||
tabs: Tab[];
|
||||
activeTabId?: string | number;
|
||||
onTabChange?: (tabId: string | number) => void;
|
||||
mobileGrid?: boolean;
|
||||
hiddenTabIds?: (string | number)[];
|
||||
}> = ({ tabs, activeTabId, onTabChange, mobileGrid = true, hiddenTabIds = [] }) => {
|
||||
const visibleTabs = hiddenTabIds.length > 0
|
||||
? tabs.filter((tab) => !hiddenTabIds.includes(tab.id))
|
||||
: tabs;
|
||||
const mockUseResponsive = vi.fn(() => ({
|
||||
width: 1024,
|
||||
isMobile: false,
|
||||
isTablet: false,
|
||||
isDesktop: true,
|
||||
matchedPreset: 'desktop' as const,
|
||||
}));
|
||||
|
||||
return (
|
||||
<nav data-testid="tab-navigation">
|
||||
{visibleTabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
data-testid={`tab-${tab.id}`}
|
||||
onClick={() => !tab.disabled && onTabChange?.(tab.id)}
|
||||
disabled={tab.disabled}
|
||||
aria-selected={tab.id === activeTabId}
|
||||
>
|
||||
<span data-testid={`tab-label-${tab.id}`}>{tab.label}</span>
|
||||
{mobileGrid && tab.badge !== undefined && (
|
||||
<span data-testid={`tab-badge-${tab.id}`}>{tab.badge}</span>
|
||||
)}
|
||||
{!mobileGrid && tab.badge !== undefined && (
|
||||
<span data-testid={`tab-badge-${tab.id}`}>{tab.badge}</span>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
const setMobile = () => {
|
||||
mockUseResponsive.mockReturnValue({
|
||||
width: 375,
|
||||
isMobile: true,
|
||||
isTablet: false,
|
||||
isDesktop: false,
|
||||
matchedPreset: 'mobile' as const,
|
||||
});
|
||||
};
|
||||
|
||||
const defaultTabs: Tab[] = [
|
||||
@@ -52,50 +35,72 @@ const defaultTabs: Tab[] = [
|
||||
];
|
||||
|
||||
describe('TabNavigation 컴포넌트', () => {
|
||||
describe('렌더링', () => {
|
||||
it('모든 탭이 렌더링되어야 함', () => {
|
||||
render(<MockTabNavigation tabs={defaultTabs} activeTabId="detail" />);
|
||||
let originalG7Core: any;
|
||||
|
||||
expect(screen.getByTestId('tab-detail')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('tab-reviews')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('tab-qna')).toBeInTheDocument();
|
||||
beforeEach(() => {
|
||||
originalG7Core = (window as any).G7Core;
|
||||
(window as any).G7Core = {
|
||||
...originalG7Core,
|
||||
useResponsive: mockUseResponsive,
|
||||
};
|
||||
mockUseResponsive.mockReturnValue({
|
||||
width: 1024,
|
||||
isMobile: false,
|
||||
isTablet: false,
|
||||
isDesktop: true,
|
||||
matchedPreset: 'desktop' as const,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
(window as any).G7Core = originalG7Core;
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('데스크톱 렌더링', () => {
|
||||
it('Nav 안의 버튼으로 모든 탭이 렌더링되어야 함', () => {
|
||||
const { container } = render(
|
||||
<TabNavigation tabs={defaultTabs} activeTabId="detail" />
|
||||
);
|
||||
|
||||
expect(container.querySelector('nav')).toBeInTheDocument();
|
||||
expect(screen.getByText('상세정보')).toBeInTheDocument();
|
||||
expect(screen.getByText('리뷰')).toBeInTheDocument();
|
||||
expect(screen.getByText('문의')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('탭 라벨이 표시되어야 함', () => {
|
||||
render(<MockTabNavigation tabs={defaultTabs} activeTabId="detail" />);
|
||||
it('Select 드롭다운은 렌더링되지 않아야 함', () => {
|
||||
const { container } = render(
|
||||
<TabNavigation tabs={defaultTabs} activeTabId="detail" />
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('tab-label-detail')).toHaveTextContent('상세정보');
|
||||
expect(screen.getByTestId('tab-label-reviews')).toHaveTextContent('리뷰');
|
||||
expect(screen.getByTestId('tab-label-qna')).toHaveTextContent('문의');
|
||||
const selects = container.querySelectorAll('select');
|
||||
expect(selects.length).toBe(0);
|
||||
});
|
||||
|
||||
it('활성 탭이 aria-selected=true 이어야 함', () => {
|
||||
render(<MockTabNavigation tabs={defaultTabs} activeTabId="reviews" />);
|
||||
it('활성 탭이 활성화 스타일을 가져야 함', () => {
|
||||
render(
|
||||
<TabNavigation tabs={defaultTabs} activeTabId="reviews" variant="underline" />
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('tab-reviews')).toHaveAttribute('aria-selected', 'true');
|
||||
expect(screen.getByTestId('tab-detail')).toHaveAttribute('aria-selected', 'false');
|
||||
const activeButton = screen.getByText('리뷰').closest('button');
|
||||
expect(activeButton).toHaveClass('border-b-2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('뱃지(badge)', () => {
|
||||
it('badge가 있는 탭에 뱃지가 표시되어야 함', () => {
|
||||
render(<MockTabNavigation tabs={defaultTabs} activeTabId="detail" />);
|
||||
it('뱃지가 표시되어야 함', () => {
|
||||
render(<TabNavigation tabs={defaultTabs} activeTabId="detail" />);
|
||||
|
||||
expect(screen.getByTestId('tab-badge-reviews')).toHaveTextContent('12');
|
||||
expect(screen.getByTestId('tab-badge-qna')).toHaveTextContent('3');
|
||||
});
|
||||
|
||||
it('badge가 없는 탭에는 뱃지가 렌더링되지 않아야 함', () => {
|
||||
render(<MockTabNavigation tabs={defaultTabs} activeTabId="detail" />);
|
||||
|
||||
expect(screen.queryByTestId('tab-badge-detail')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('12')).toBeInTheDocument();
|
||||
expect(screen.getByText('3')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('badge 값이 0일 때도 표시되어야 함', () => {
|
||||
const tabs: Tab[] = [{ id: 'qna', label: '문의', badge: 0 }];
|
||||
render(<MockTabNavigation tabs={tabs} activeTabId="qna" />);
|
||||
render(<TabNavigation tabs={tabs} activeTabId="qna" />);
|
||||
|
||||
expect(screen.getByTestId('tab-badge-qna')).toHaveTextContent('0');
|
||||
expect(screen.getByText('0')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -103,10 +108,14 @@ describe('TabNavigation 컴포넌트', () => {
|
||||
it('탭 클릭 시 onTabChange가 호출되어야 함', () => {
|
||||
const onTabChange = vi.fn();
|
||||
render(
|
||||
<MockTabNavigation tabs={defaultTabs} activeTabId="detail" onTabChange={onTabChange} />,
|
||||
<TabNavigation
|
||||
tabs={defaultTabs}
|
||||
activeTabId="detail"
|
||||
onTabChange={onTabChange}
|
||||
/>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByTestId('tab-reviews'));
|
||||
fireEvent.click(screen.getByText('리뷰').closest('button')!);
|
||||
expect(onTabChange).toHaveBeenCalledWith('reviews');
|
||||
});
|
||||
|
||||
@@ -114,19 +123,21 @@ describe('TabNavigation 컴포넌트', () => {
|
||||
const Wrapper = () => {
|
||||
const [activeTabId, setActiveTabId] = useState<string | number>('detail');
|
||||
return (
|
||||
<MockTabNavigation
|
||||
<TabNavigation
|
||||
tabs={defaultTabs}
|
||||
activeTabId={activeTabId}
|
||||
onTabChange={setActiveTabId}
|
||||
variant="underline"
|
||||
/>
|
||||
);
|
||||
};
|
||||
render(<Wrapper />);
|
||||
|
||||
expect(screen.getByTestId('tab-detail')).toHaveAttribute('aria-selected', 'true');
|
||||
fireEvent.click(screen.getByTestId('tab-reviews'));
|
||||
expect(screen.getByTestId('tab-reviews')).toHaveAttribute('aria-selected', 'true');
|
||||
expect(screen.getByTestId('tab-detail')).toHaveAttribute('aria-selected', 'false');
|
||||
expect(screen.getByText('상세정보').closest('button')).toHaveClass('border-b-2');
|
||||
|
||||
fireEvent.click(screen.getByText('리뷰').closest('button')!);
|
||||
|
||||
expect(screen.getByText('리뷰').closest('button')).toHaveClass('border-b-2');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -138,44 +149,91 @@ describe('TabNavigation 컴포넌트', () => {
|
||||
{ id: 'reviews', label: '리뷰', disabled: true },
|
||||
];
|
||||
render(
|
||||
<MockTabNavigation tabs={tabs} activeTabId="detail" onTabChange={onTabChange} />,
|
||||
<TabNavigation
|
||||
tabs={tabs}
|
||||
activeTabId="detail"
|
||||
onTabChange={onTabChange}
|
||||
/>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByTestId('tab-reviews'));
|
||||
fireEvent.click(screen.getByText('리뷰').closest('button')!);
|
||||
expect(onTabChange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('disabled 탭은 disabled 속성이 있어야 함', () => {
|
||||
const tabs: Tab[] = [{ id: 'reviews', label: '리뷰', disabled: true }];
|
||||
render(<MockTabNavigation tabs={tabs} activeTabId="detail" />);
|
||||
render(<TabNavigation tabs={tabs} activeTabId="detail" />);
|
||||
|
||||
expect(screen.getByTestId('tab-reviews')).toBeDisabled();
|
||||
expect(screen.getByText('리뷰').closest('button')).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('hiddenTabIds', () => {
|
||||
it('hiddenTabIds에 포함된 탭은 렌더링되지 않아야 함', () => {
|
||||
render(
|
||||
<MockTabNavigation
|
||||
<TabNavigation
|
||||
tabs={defaultTabs}
|
||||
activeTabId="detail"
|
||||
hiddenTabIds={['qna']}
|
||||
/>,
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('tab-detail')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('tab-reviews')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('tab-qna')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('상세정보')).toBeInTheDocument();
|
||||
expect(screen.getByText('리뷰')).toBeInTheDocument();
|
||||
expect(screen.queryByText('문의')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hiddenTabIds가 빈 배열이면 모든 탭이 표시되어야 함', () => {
|
||||
render(
|
||||
<MockTabNavigation tabs={defaultTabs} activeTabId="detail" hiddenTabIds={[]} />,
|
||||
<TabNavigation tabs={defaultTabs} activeTabId="detail" hiddenTabIds={[]} />
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('tab-detail')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('tab-reviews')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('tab-qna')).toBeInTheDocument();
|
||||
expect(screen.getByText('상세정보')).toBeInTheDocument();
|
||||
expect(screen.getByText('리뷰')).toBeInTheDocument();
|
||||
expect(screen.getByText('문의')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('모바일 (useResponsive isMobile=true)', () => {
|
||||
beforeEach(() => {
|
||||
setMobile();
|
||||
});
|
||||
|
||||
it('Nav 대신 Select 드롭다운만 렌더링해야 함', () => {
|
||||
const { container } = render(
|
||||
<TabNavigation tabs={defaultTabs} activeTabId="detail" />
|
||||
);
|
||||
|
||||
expect(container.querySelector('nav')).not.toBeInTheDocument();
|
||||
// custom Select trigger button이 존재해야 함
|
||||
const trigger = container.querySelector('button');
|
||||
expect(trigger).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('현재 활성 탭의 label을 Select trigger에 표시해야 함', () => {
|
||||
render(<TabNavigation tabs={defaultTabs} activeTabId="detail" />);
|
||||
|
||||
expect(screen.getByText('상세정보')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('뱃지가 있는 탭은 label과 함께 뱃지 수를 병기해야 함', () => {
|
||||
render(<TabNavigation tabs={defaultTabs} activeTabId="reviews" />);
|
||||
|
||||
expect(screen.getByText('리뷰 (12)')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('hiddenTabIds가 모바일에서도 적용되어야 함', () => {
|
||||
render(
|
||||
<TabNavigation
|
||||
tabs={defaultTabs}
|
||||
activeTabId="detail"
|
||||
hiddenTabIds={['qna']}
|
||||
/>
|
||||
);
|
||||
|
||||
// 활성 라벨은 보이지만 숨김 처리된 항목은 보이지 않음 (Select 닫힌 상태)
|
||||
expect(screen.getByText('상세정보')).toBeInTheDocument();
|
||||
expect(screen.queryByText('문의')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,8 @@
|
||||
export { default as Header } from './Header';
|
||||
export { default as Footer } from './Footer';
|
||||
export { default as MobileNav } from './MobileNav';
|
||||
export { NotificationCenter } from './NotificationCenter';
|
||||
export type { NotificationCenterProps, NotificationItem } from './NotificationCenter';
|
||||
|
||||
// 상품 관련 컴포넌트
|
||||
export { default as ProductCard } from './ProductCard';
|
||||
@@ -63,6 +65,7 @@ export const compositeComponents = {
|
||||
Header: () => import('./Header'),
|
||||
Footer: () => import('./Footer'),
|
||||
MobileNav: () => import('./MobileNav'),
|
||||
NotificationCenter: () => import('./NotificationCenter'),
|
||||
|
||||
// 상품
|
||||
ProductCard: () => import('./ProductCard'),
|
||||
|
||||
@@ -242,6 +242,7 @@ break-inside-auto break-inside-avoid break-inside-avoid-page break-inside-avoid-
|
||||
|
||||
/* Auto */
|
||||
auto-cols-auto auto-cols-min auto-cols-max auto-cols-fr
|
||||
auto-cols-[calc(50%_-_8px)] auto-cols-[calc(33.333%_-_11px)] auto-cols-[calc(25%_-_12px)]
|
||||
auto-rows-auto auto-rows-min auto-rows-max auto-rows-fr
|
||||
grid-flow-row grid-flow-col grid-flow-dense grid-flow-row-dense grid-flow-col-dense
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"ko": "Basic",
|
||||
"en": "Basic"
|
||||
},
|
||||
"version": "1.0.0-beta.1",
|
||||
"version": "1.0.0-beta.2",
|
||||
"license": "MIT",
|
||||
"description": {
|
||||
"ko": "그누보드7 기본 사용자 템플릿",
|
||||
@@ -19,15 +19,15 @@
|
||||
"url": "https://sirsoft.com"
|
||||
},
|
||||
"release_date": "2026-01-07",
|
||||
"g7_version": ">=7.0.0-beta.1",
|
||||
"g7_version": ">=7.0.0-beta.2",
|
||||
"dependencies": {
|
||||
"modules": {
|
||||
"sirsoft-board": ">=0.1.1",
|
||||
"sirsoft-ecommerce": ">=0.1.1",
|
||||
"sirsoft-page": ">=0.1.1"
|
||||
"sirsoft-board": ">=1.0.0-beta.2",
|
||||
"sirsoft-ecommerce": ">=1.0.0-beta.2",
|
||||
"sirsoft-page": ">=1.0.0-beta.2"
|
||||
},
|
||||
"plugins": {
|
||||
"sirsoft-daum_postcode": ">=0.1.1"
|
||||
"sirsoft-daum_postcode": ">=1.0.0-beta.2"
|
||||
}
|
||||
},
|
||||
"assets": {
|
||||
|
||||
@@ -26,11 +26,12 @@ export default defineConfig({
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
setupFiles: [path.resolve(rootDir, 'resources/js/tests/setup.ts')],
|
||||
include: ['src/**/*.{test,spec}.{ts,tsx}'],
|
||||
include: ['src/**/*.{test,spec}.{ts,tsx}', '__tests__/**/*.{test,spec}.{ts,tsx}'],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(rootDir, 'resources/js'),
|
||||
'@core': path.resolve(rootDir, 'resources/js/core'),
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user