@conscience-technology/ovenn 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/components/AIMessage/AIMessage.module.css +2 -1
- package/assets/components/Accordion/Accordion.module.css +3 -0
- package/assets/components/AppFrame/AppFrame.module.css +2 -0
- package/assets/components/AttachmentItem/AttachmentItem.module.css +9 -3
- package/assets/components/AttachmentThumb/AttachmentThumb.module.css +4 -0
- package/assets/components/Avatar/Avatar.module.css +26 -11
- package/assets/components/Avatar/Avatar.tsx +1 -1
- package/assets/components/AvatarUpload/AvatarUpload.module.css +4 -3
- package/assets/components/Badge/Badge.module.css +96 -70
- package/assets/components/Badge/Badge.tsx +33 -25
- package/assets/components/Breadcrumb/Breadcrumb.module.css +8 -4
- package/assets/components/Breadcrumb/Breadcrumb.tsx +1 -1
- package/assets/components/Bubble/Bubble.module.css +6 -0
- package/assets/components/Button/Button.module.css +6 -0
- package/assets/components/Calendar/Calendar.module.css +244 -0
- package/assets/components/Calendar/Calendar.tsx +419 -0
- package/assets/components/Calendar/index.ts +2 -0
- package/assets/components/Callout/Callout.module.css +1 -0
- package/assets/components/Canvas/Canvas.module.css +75 -0
- package/assets/components/Canvas/Canvas.tsx +699 -0
- package/assets/components/Canvas/alignment.ts +34 -0
- package/assets/components/Canvas/clipboard.ts +30 -0
- package/assets/components/Canvas/collision.ts +67 -0
- package/assets/components/Canvas/edgeOptions.ts +11 -0
- package/assets/components/Canvas/graph.ts +11 -0
- package/assets/components/Canvas/history.ts +41 -0
- package/assets/components/Canvas/index.ts +4 -0
- package/assets/components/Canvas/selection.ts +56 -0
- package/assets/components/Canvas/tokens.css +61 -0
- package/assets/components/Canvas/types.ts +27 -0
- package/assets/components/Canvas/useCanvasSettlement.ts +79 -0
- package/assets/components/CanvasEdge/CanvasEdge.module.css +62 -0
- package/assets/components/CanvasEdge/CanvasEdge.tsx +121 -0
- package/assets/components/CanvasEdge/geometry.ts +350 -0
- package/assets/components/CanvasEdge/index.ts +4 -0
- package/assets/components/CanvasEdge/interactions.ts +14 -0
- package/assets/components/CanvasEdge/tokens.css +29 -0
- package/assets/components/CanvasNode/CanvasNode.module.css +234 -30
- package/assets/components/CanvasNode/CanvasNode.tsx +95 -28
- package/assets/components/CanvasNode/index.ts +1 -1
- package/assets/components/CanvasNode/runningOutline.ts +59 -0
- package/assets/components/CanvasNode/tokens.css +76 -13
- package/assets/components/Card/Card.module.css +5 -0
- package/assets/components/Chart/Chart.module.css +278 -0
- package/assets/components/Chart/Chart.tsx +385 -0
- package/assets/components/Chart/entrance.tsx +57 -0
- package/assets/components/Chart/index.ts +14 -0
- package/assets/components/ChatInput/ChatInput.module.css +5 -0
- package/assets/components/Checkbox/Checkbox.module.css +39 -0
- package/assets/components/Checkbox/Checkbox.tsx +99 -14
- package/assets/components/Checkbox/index.ts +1 -1
- package/assets/components/CheckboxCard/CheckboxCard.module.css +1 -177
- package/assets/components/CheckboxCard/CheckboxCard.tsx +6 -72
- package/assets/components/Chip/Chip.module.css +20 -30
- package/assets/components/Code/Code.module.css +1 -0
- package/assets/components/CodeBlock/CodeBlock.module.css +7 -3
- package/assets/components/ColorArea/ColorArea.module.css +3 -0
- package/assets/components/ColorField/ColorField.module.css +6 -0
- package/assets/components/ColorField/ColorField.tsx +3 -1
- package/assets/components/ColorPicker/ColorPicker.module.css +310 -0
- package/assets/components/ColorPicker/ColorPicker.tsx +387 -0
- package/assets/components/ColorPicker/index.ts +16 -0
- package/assets/components/ColorSlider/ColorSlider.module.css +15 -12
- package/assets/components/ColorSlider/ColorSlider.tsx +3 -3
- package/assets/components/ColorSwatch/ColorSwatch.module.css +2 -2
- package/assets/components/ColorSwatchPicker/ColorSwatchPicker.module.css +4 -3
- package/assets/components/Combobox/Combobox.module.css +1 -1
- package/assets/components/Combobox/Combobox.tsx +1 -1
- package/assets/components/CommandPalette/CommandPalette.module.css +18 -23
- package/assets/components/CommandPalette/CommandPalette.tsx +7 -5
- package/assets/components/Comment/Comment.module.css +25 -0
- package/assets/components/Comment/Comment.tsx +44 -0
- package/assets/components/Comment/CommentComposer.module.css +26 -0
- package/assets/components/Comment/CommentComposer.tsx +56 -0
- package/assets/components/Comment/CommentEditor.module.css +8 -0
- package/assets/components/Comment/CommentEditor.tsx +43 -0
- package/assets/components/Comment/CommentMentionInput.module.css +9 -0
- package/assets/components/Comment/CommentMentionInput.tsx +150 -0
- package/assets/components/Comment/index.ts +9 -0
- package/assets/components/Comment/types.ts +1 -0
- package/assets/components/ContextMenu/ContextMenu.module.css +5 -2
- package/assets/components/ContextMenu/ContextMenu.tsx +5 -0
- package/assets/components/ControlGroup/ControlGroup.module.css +7 -1
- package/assets/components/DataTable/DataTable.module.css +2 -0
- package/assets/components/DatePicker/DatePicker.module.css +36 -3
- package/assets/components/DatePicker/DatePicker.tsx +11 -1
- package/assets/components/DatePicker/TimeSelector.tsx +1 -1
- package/assets/components/Disclosure/Disclosure.module.css +1 -0
- package/assets/components/Drawer/Drawer.module.css +11 -4
- package/assets/components/Drawer/Drawer.tsx +5 -1
- package/assets/components/DropdownMenu/DropdownMenu.tsx +5 -0
- package/assets/components/EventChip/EventChip.module.css +120 -53
- package/assets/components/EventChip/EventChip.tsx +54 -6
- package/assets/components/EventChip/index.ts +1 -1
- package/assets/components/EventListItem/EventListItem.module.css +3 -0
- package/assets/components/EventListItem/EventListItem.tsx +15 -8
- package/assets/components/FileIcon/FileIcon.module.css +2 -0
- package/assets/components/FileUpload/FileUpload.module.css +10 -3
- package/assets/components/FileUpload/FileUpload.tsx +5 -9
- package/assets/components/FileUpload/FileUploadItem.tsx +34 -0
- package/assets/components/GalleryItem/GalleryItem.module.css +16 -19
- package/assets/components/GeneratedImage/GeneratedImage.module.css +2 -0
- package/assets/components/Icon/Icon.tsx +264 -1088
- package/assets/components/Icon/LucideFamilyIcon.tsx +434 -0
- package/assets/components/Icon/MissingIcon.tsx +25 -0
- package/assets/components/Icon/SolarFamilyIcon.tsx +439 -0
- package/assets/components/Icon/catalogNames.ts +8 -0
- package/assets/components/Icon/context.tsx +1 -1
- package/assets/components/Icon/index.ts +2 -0
- package/assets/components/Icon/lucideCatalog.ts +11358 -0
- package/assets/components/Icon/phosphorCatalog.ts +3052 -0
- package/assets/components/Icon/solarCatalog.ts +16064 -0
- package/assets/components/IconButton/IconButton.module.css +3 -2
- package/assets/components/Input/Input.module.css +30 -12
- package/assets/components/Input/Input.tsx +1 -1
- package/assets/components/Kanban/Kanban.module.css +6 -0
- package/assets/components/ListItem/ListItem.module.css +9 -6
- package/assets/components/MenuItem/MenuItem.module.css +24 -22
- package/assets/components/MenuItem/MenuItem.tsx +12 -12
- package/assets/components/MessageActions/MessageActions.module.css +36 -0
- package/assets/components/MessageActions/MessageActions.tsx +53 -28
- package/assets/components/MessageQuote/MessageQuote.module.css +1 -0
- package/assets/components/MessageSources/MessageSources.module.css +2 -0
- package/assets/components/MessageState/MessageState.module.css +1 -1
- package/assets/components/MetricCard/MetricCard.module.css +96 -108
- package/assets/components/MetricCard/MetricCard.tsx +45 -23
- package/assets/components/MetricCard/tokens.css +10 -0
- package/assets/components/MiniCalendar/MiniCalendar.module.css +130 -0
- package/assets/components/MiniCalendar/MiniCalendar.tsx +161 -0
- package/assets/components/MiniCalendar/index.ts +2 -0
- package/assets/components/Modal/Modal.module.css +13 -4
- package/assets/components/Modal/Modal.tsx +4 -0
- package/assets/components/Onboarding/LayoutBuilder.tsx +12 -50
- package/assets/components/Onboarding/Onboarding.module.css +211 -278
- package/assets/components/Onboarding/OnboardingAxisPanel.tsx +81 -125
- package/assets/components/Onboarding/OnboardingPage.tsx +244 -467
- package/assets/components/Onboarding/actions.ts +5 -0
- package/assets/components/Onboarding/palette.css +8 -0
- package/assets/components/Onboarding/wizardData.ts +8 -8
- package/assets/components/ProgressBar/ProgressBar.module.css +8 -8
- package/assets/components/ProgressBar/ProgressBar.tsx +0 -5
- package/assets/components/ProgressBar/index.ts +0 -1
- package/assets/components/QuotationBar/QuotationBar.module.css +2 -0
- package/assets/components/Radio/Radio.module.css +2 -0
- package/assets/components/RadioCard/RadioCard.module.css +78 -3
- package/assets/components/RadioCard/RadioCard.tsx +34 -12
- package/assets/components/RadioCard/index.ts +1 -1
- package/assets/components/SegmentedChart/SegmentedChart.module.css +16 -0
- package/assets/components/SegmentedChart/SegmentedChart.tsx +25 -8
- package/assets/components/Select/Select.tsx +7 -4
- package/assets/components/Shortcut/Shortcut.module.css +2 -0
- package/assets/components/Sidebar/Sidebar.module.css +1 -0
- package/assets/components/Sidebar/Sidebar.tsx +2 -2
- package/assets/components/Skeleton/Skeleton.module.css +33 -0
- package/assets/components/Skeleton/Skeleton.tsx +20 -0
- package/assets/components/Skeleton/index.ts +2 -0
- package/assets/components/Skeleton/tokens.css +11 -0
- package/assets/components/Slider/Slider.module.css +3 -0
- package/assets/components/Slider/Slider.tsx +7 -2
- package/assets/components/Spinner/LottiePlayer.tsx +4 -4
- package/assets/components/Spinner/Spinner.module.css +3 -0
- package/assets/components/Spinner/lottieManifest.ts +3 -0
- package/assets/components/Stepper/Stepper.module.css +56 -8
- package/assets/components/Stepper/Stepper.tsx +13 -4
- package/assets/components/Switch/Switch.module.css +55 -42
- package/assets/components/Switch/Switch.tsx +6 -2
- package/assets/components/Switch/index.ts +1 -1
- package/assets/components/TabStrip/TabStrip.module.css +5 -1
- package/assets/components/TableCell/TableCell.module.css +8 -1
- package/assets/components/TableCell/TableCellBadge.tsx +7 -3
- package/assets/components/TableCell/TableCellImage.tsx +1 -1
- package/assets/components/TableCell/TableCellTag.tsx +23 -0
- package/assets/components/TableCell/index.ts +3 -0
- package/assets/components/TableHeader/TableHeader.module.css +4 -0
- package/assets/components/TableRow/TableRow.module.css +3 -0
- package/assets/components/TableRowEdit/TableRowEdit.module.css +2 -0
- package/assets/components/TableToolbar/TableToolbar.module.css +1 -0
- package/assets/components/Tabs/Tabs.module.css +22 -7
- package/assets/components/Tabs/Tabs.tsx +2 -1
- package/assets/components/Tag/Tag.module.css +101 -0
- package/assets/components/Tag/Tag.tsx +55 -0
- package/assets/components/Tag/index.ts +2 -0
- package/assets/components/TemplateBoundary/TemplateBoundary.tsx +22 -18
- package/assets/components/TemplateBoundary/types.ts +2 -0
- package/assets/components/Textarea/Textarea.module.css +7 -0
- package/assets/components/ThemeController.tsx +30 -3
- package/assets/components/TimePicker/TimePicker.module.css +1 -0
- package/assets/components/TimePicker/TimePicker.tsx +37 -16
- package/assets/components/TimelineView/TimelineEventBar.tsx +109 -0
- package/assets/components/TimelineView/TimelineView.module.css +203 -0
- package/assets/components/TimelineView/TimelineView.tsx +137 -0
- package/assets/components/TimelineView/axis.ts +62 -0
- package/assets/components/TimelineView/index.ts +3 -0
- package/assets/components/TimelineView/layout.ts +56 -0
- package/assets/components/TimelineView/move.ts +51 -0
- package/assets/components/TimelineView/useTimelineDrag.ts +215 -0
- package/assets/components/TimelineView/useTimelineZoom.ts +92 -0
- package/assets/components/Toast/Toast.module.css +2 -0
- package/assets/components/Toolbar/Toolbar.module.css +31 -24
- package/assets/components/Toolbar/Toolbar.tsx +4 -3
- package/assets/components/Tooltip/Tooltip.module.css +10 -0
- package/assets/components/Tooltip/Tooltip.tsx +17 -8
- package/assets/components/TopLoader/TopLoader.module.css +1 -0
- package/assets/components/TreeNav/TreeNav.module.css +1 -0
- package/assets/components/_color.ts +2 -2
- package/assets/components/_data.ts +33 -32
- package/assets/components/_utils.css +5 -0
- package/assets/components/axisOptions.ts +2 -0
- package/assets/components/component-registry.json +151 -2
- package/assets/components/index.ts +16 -0
- package/assets/components/materialScope.tsx +11 -0
- package/assets/components/reset.css +1 -0
- package/assets/components/themeBootScript.ts +3 -2
- package/assets/components/tokens.css +225 -71
- package/assets/components/useChartEntrance.ts +119 -0
- package/assets/prompts/ASSEMBLY.md +9 -7
- package/assets/prompts/CATALOG.md +18 -4
- package/assets/prompts/FEEDBACK_PROCESS.md +19 -0
- package/assets/prompts/PRINCIPLES.md +14 -0
- package/assets/prompts/WORKFLOW_DESIGN.md +46 -70
- package/assets/prompts/axes/font.md +6 -1
- package/assets/prompts/axes/icon.md +6 -4
- package/assets/prompts/axes/material.md +40 -0
- package/assets/prompts/axes/palette.md +2 -1
- package/assets/prompts/axes/shape.md +8 -0
- package/assets/prompts/components/attachment-item.md +2 -1
- package/assets/prompts/components/badge.md +32 -97
- package/assets/prompts/components/breadcrumb.md +1 -0
- package/assets/prompts/components/calendar.md +151 -0
- package/assets/prompts/components/canvas-edge.md +67 -0
- package/assets/prompts/components/canvas-node.md +25 -8
- package/assets/prompts/components/canvas.md +82 -0
- package/assets/prompts/components/card.md +10 -10
- package/assets/prompts/components/chart-bar.md +77 -0
- package/assets/prompts/components/chart-pie.md +63 -0
- package/assets/prompts/components/chart-radar.md +56 -0
- package/assets/prompts/components/chart-radial.md +56 -0
- package/assets/prompts/components/chart.md +129 -0
- package/assets/prompts/components/checkbox-card.md +26 -45
- package/assets/prompts/components/checkbox.md +23 -0
- package/assets/prompts/components/chip.md +6 -6
- package/assets/prompts/components/code-block.md +1 -0
- package/assets/prompts/components/color-picker.md +173 -0
- package/assets/prompts/components/color-slider.md +7 -7
- package/assets/prompts/components/command-palette.md +7 -6
- package/assets/prompts/components/comment.md +72 -0
- package/assets/prompts/components/context-menu.md +6 -3
- package/assets/prompts/components/data-table.md +9 -0
- package/assets/prompts/components/date-picker.md +10 -0
- package/assets/prompts/components/drawer.md +10 -0
- package/assets/prompts/components/dropdown-menu.md +3 -1
- package/assets/prompts/components/event-chip.md +60 -18
- package/assets/prompts/components/event-list-item.md +14 -10
- package/assets/prompts/components/file-upload.md +1 -1
- package/assets/prompts/components/gallery-item.md +5 -4
- package/assets/prompts/components/icon.md +30 -8
- package/assets/prompts/components/kanban.md +1 -1
- package/assets/prompts/components/list-item.md +11 -2
- package/assets/prompts/components/menu-item.md +8 -3
- package/assets/prompts/components/message-actions.md +9 -0
- package/assets/prompts/components/metric-card.md +57 -109
- package/assets/prompts/components/mini-calendar.md +72 -0
- package/assets/prompts/components/modal.md +1 -0
- package/assets/prompts/components/onboarding.md +11 -7
- package/assets/prompts/components/page-header.md +11 -2
- package/assets/prompts/components/progress-bar.md +12 -2
- package/assets/prompts/components/radio-card.md +33 -117
- package/assets/prompts/components/segmented-chart.md +19 -5
- package/assets/prompts/components/select.md +1 -0
- package/assets/prompts/components/sidebar.md +12 -3
- package/assets/prompts/components/skeleton.md +44 -0
- package/assets/prompts/components/stepper.md +15 -1
- package/assets/prompts/components/switch.md +15 -10
- package/assets/prompts/components/tab-strip.md +1 -0
- package/assets/prompts/components/table-cell.md +6 -4
- package/assets/prompts/components/table-row.md +12 -3
- package/assets/prompts/components/table-toolbar.md +9 -0
- package/assets/prompts/components/tabs.md +4 -2
- package/assets/prompts/components/tag.md +54 -0
- package/assets/prompts/components/time-picker.md +1 -0
- package/assets/prompts/components/timeline-view.md +129 -0
- package/assets/prompts/components/toast.md +1 -1
- package/assets/prompts/components/toolbar.md +17 -4
- package/assets/prompts/components/tooltip.md +21 -3
- package/assets/prompts/components/top-loader.md +1 -1
- package/assets/prompts/components/topbar.md +9 -0
- package/assets/prompts/components/tree-nav.md +1 -1
- package/assets/prompts/templates/ains.md +2 -1
- package/assets/prompts/templates/aurora.md +5 -4
- package/assets/prompts/templates/glass-button.md +6 -5
- package/assets/prompts/templates/minimal.md +8 -6
- package/assets/prompts/templates/workspace.md +3 -3
- package/assets/prompts/tokens/color.md +4 -2
- package/assets/prompts/tokens/material.md +51 -0
- package/assets/prompts/tokens/radius.md +12 -0
- package/assets/prompts/tokens/typography.md +24 -2
- package/assets/prompts/use-cases/chart-chart-area.md +1334 -0
- package/assets/prompts/use-cases/chart-chart-bar.md +1886 -0
- package/assets/prompts/use-cases/chart-chart-pie.md +1031 -0
- package/assets/prompts/use-cases/chart-chart-radar.md +785 -0
- package/assets/prompts/use-cases/chart-chart-radial.md +988 -0
- package/assets/prompts/use-cases/chart-segmented-chart.md +262 -0
- package/assets/prompts/use-cases/data-comment.md +360 -0
- package/assets/prompts/use-cases/data-data-table.md +249 -0
- package/assets/prompts/use-cases/data-list-item.md +1056 -0
- package/assets/prompts/use-cases/data-metric-card.md +673 -0
- package/assets/prompts/use-cases/data-table-row.md +966 -0
- package/assets/prompts/use-cases/data-table-toolbar.md +481 -0
- package/assets/prompts/use-cases/feedback-drawer.md +1163 -0
- package/assets/prompts/use-cases/feedback-progress-bar.md +427 -0
- package/assets/prompts/use-cases/general-toolbar.md +854 -0
- package/assets/prompts/use-cases/general-tooltip.md +652 -0
- package/assets/prompts/use-cases/input-checkbox.md +443 -0
- package/assets/prompts/use-cases/structure-card.md +603 -0
- package/assets/prompts/use-cases/structure-page-header.md +755 -0
- package/assets/prompts/use-cases/structure-sidebar.md +1132 -0
- package/assets/prompts/use-cases/structure-topbar.md +1200 -0
- package/assets/public/ovenn-wordmark.svg +19 -0
- package/package.json +6 -2
- package/src/commands/info.js +1 -1
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
# Tooltip 사용 사례 소스
|
|
2
|
+
|
|
3
|
+
<!-- Generated by scripts/build-use-cases.mjs. Edit original TSX/CSS, then regenerate. -->
|
|
4
|
+
|
|
5
|
+
### 사례 목록
|
|
6
|
+
|
|
7
|
+
- Copy confirmation
|
|
8
|
+
|
|
9
|
+
문서: /en/components/general/tooltip#use-cases
|
|
10
|
+
|
|
11
|
+
문서 페이지에서 렌더하는 사례입니다.
|
|
12
|
+
|
|
13
|
+
### 조회 방법
|
|
14
|
+
|
|
15
|
+
get_guide(topic="use-cases/general-tooltip", sections=["사례 목록", "파일 목록"])로 먼저 확인하고, 필요한 Section 또는 Source 파일 헤딩만 sections로 조회하세요. 전체 문서는 문서 페이지의 다른 예제도 포함합니다. 공용 컴포넌트 계약은 get_component로 읽고, 예제의 docs 전용 셸·locale·import 경로는 대상 프로젝트에 맞게 조합하세요. 이 연결은 디자인 승인이나 기능 검증을 뜻하지 않습니다.
|
|
16
|
+
|
|
17
|
+
### 파일 목록
|
|
18
|
+
|
|
19
|
+
- `web/app/[lang]/components/general/tooltip/_strings.tsx`
|
|
20
|
+
- `web/app/[lang]/components/general/tooltip/page.tsx`
|
|
21
|
+
- `web/examples/TooltipFeedbackExample.tsx`
|
|
22
|
+
|
|
23
|
+
### Section: web/app/[lang]/components/general/tooltip/page.tsx#use-cases
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<section id="use-cases">
|
|
27
|
+
<h2>{ko ? "사용사례" : "Use cases"}</h2>
|
|
28
|
+
<h3>{ko ? "복사 완료 피드백" : "Copy confirmation"}</h3>
|
|
29
|
+
<ExampleBlock code={'<MessageActions variant="toolbar" size="sm" actions={[{\n kind: "copy",\n successLabel: "Copied",\n errorLabel: "Copy failed",\n onClick: () => navigator.clipboard.writeText(text),\n}]} />'}>
|
|
30
|
+
<TooltipFeedbackExample />
|
|
31
|
+
</ExampleBlock>
|
|
32
|
+
</section>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Source: web/app/[lang]/components/general/tooltip/_strings.tsx
|
|
36
|
+
|
|
37
|
+
````tsx
|
|
38
|
+
import { Code } from "@/components/Code";
|
|
39
|
+
import type { ReactNode } from "react";
|
|
40
|
+
|
|
41
|
+
type Strings = {
|
|
42
|
+
title: string;
|
|
43
|
+
lead: string;
|
|
44
|
+
playgroundDesc: string;
|
|
45
|
+
|
|
46
|
+
saveLabel: string;
|
|
47
|
+
searchLabel: string;
|
|
48
|
+
favoriteLabel: string;
|
|
49
|
+
notificationsLabel: string;
|
|
50
|
+
deleteLabel: string;
|
|
51
|
+
up: string;
|
|
52
|
+
right: string;
|
|
53
|
+
down: string;
|
|
54
|
+
left: string;
|
|
55
|
+
cantSaveReason: string;
|
|
56
|
+
noDeletePermission: string;
|
|
57
|
+
alreadySubmitted: string;
|
|
58
|
+
editLabel: string;
|
|
59
|
+
alwaysOpenLabel: string;
|
|
60
|
+
alwaysOpenCaption: string;
|
|
61
|
+
|
|
62
|
+
usage: { heading: string; desc: ReactNode };
|
|
63
|
+
placement: { heading: string; desc: ReactNode };
|
|
64
|
+
withIconButton: { heading: string; desc: ReactNode };
|
|
65
|
+
withDisabled: { heading: string; desc: ReactNode };
|
|
66
|
+
withShortcut: { heading: string; desc: ReactNode };
|
|
67
|
+
controlled: { heading: string; desc: ReactNode };
|
|
68
|
+
api: {
|
|
69
|
+
heading: string;
|
|
70
|
+
desc: ReactNode;
|
|
71
|
+
columns: { prop: string; type: string; default: string; desc: string };
|
|
72
|
+
rows: {
|
|
73
|
+
content: string;
|
|
74
|
+
children: string;
|
|
75
|
+
side: string;
|
|
76
|
+
align: string;
|
|
77
|
+
sideOffset: string;
|
|
78
|
+
arrowOffset: string;
|
|
79
|
+
followMouse: string;
|
|
80
|
+
arrow: string;
|
|
81
|
+
open: string;
|
|
82
|
+
onOpenChange: string;
|
|
83
|
+
delayDuration: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const en: Strings = {
|
|
89
|
+
title: "Tooltip",
|
|
90
|
+
lead: "An overlay that pops a short caption on hover or focus. Reach for it on icon buttons, disabled reasons, and shortcut hints. For long content or anything interactive use Popover.",
|
|
91
|
+
playgroundDesc: "Toggle the knobs below to inspect combinations.",
|
|
92
|
+
|
|
93
|
+
saveLabel: "Save",
|
|
94
|
+
searchLabel: "Search",
|
|
95
|
+
favoriteLabel: "Favorites",
|
|
96
|
+
notificationsLabel: "Notifications",
|
|
97
|
+
deleteLabel: "Delete",
|
|
98
|
+
up: "Top",
|
|
99
|
+
right: "Right",
|
|
100
|
+
down: "Bottom",
|
|
101
|
+
left: "Left",
|
|
102
|
+
cantSaveReason: "No changes to save",
|
|
103
|
+
noDeletePermission: "You do not have permission to delete",
|
|
104
|
+
alreadySubmitted: "Already submitted",
|
|
105
|
+
editLabel: "Edit",
|
|
106
|
+
alwaysOpenLabel: "Controlled tooltip",
|
|
107
|
+
alwaysOpenCaption: "Controlled open state",
|
|
108
|
+
|
|
109
|
+
usage: {
|
|
110
|
+
heading: "Usage",
|
|
111
|
+
desc: (
|
|
112
|
+
<>
|
|
113
|
+
One trigger as a child. The caption goes in <Code>content</Code>.
|
|
114
|
+
</>
|
|
115
|
+
),
|
|
116
|
+
},
|
|
117
|
+
placement: {
|
|
118
|
+
heading: "Placement",
|
|
119
|
+
desc: "Defaults to the top. When it collides with the viewport it flips automatically.",
|
|
120
|
+
},
|
|
121
|
+
withIconButton: {
|
|
122
|
+
heading: "With Icon Button",
|
|
123
|
+
desc: (
|
|
124
|
+
<>
|
|
125
|
+
An icon-only button does not read on its own. Pair with a Tooltip and keep
|
|
126
|
+
<Code>aria-label</Code> for accessibility.
|
|
127
|
+
</>
|
|
128
|
+
),
|
|
129
|
+
},
|
|
130
|
+
withDisabled: {
|
|
131
|
+
heading: "With Disabled Reason",
|
|
132
|
+
desc: "A disabled element does not receive pointer events, so Tooltip needs a wrapper around the trigger.",
|
|
133
|
+
},
|
|
134
|
+
withShortcut: {
|
|
135
|
+
heading: "With Shortcut",
|
|
136
|
+
desc: (
|
|
137
|
+
<>
|
|
138
|
+
Combine the feature name with its shortcut. Pass JSX to <Code>content</Code>
|
|
139
|
+
so the label and key sit next to each other.
|
|
140
|
+
</>
|
|
141
|
+
),
|
|
142
|
+
},
|
|
143
|
+
controlled: {
|
|
144
|
+
heading: "Controlled Open",
|
|
145
|
+
desc: (
|
|
146
|
+
<>
|
|
147
|
+
Use <Code>open</Code> to force open or drive it from outside. Handy for
|
|
148
|
+
onboarding hints.
|
|
149
|
+
</>
|
|
150
|
+
),
|
|
151
|
+
},
|
|
152
|
+
api: {
|
|
153
|
+
heading: "API Reference",
|
|
154
|
+
desc: (
|
|
155
|
+
<>
|
|
156
|
+
Portal rendering, automatic <Code>aria-describedby</Code>, keyboard focus
|
|
157
|
+
trigger, ESC dismiss, and viewport collision avoidance are included.
|
|
158
|
+
</>
|
|
159
|
+
),
|
|
160
|
+
columns: { prop: "Prop", type: "Type", default: "Default", desc: "Description" },
|
|
161
|
+
rows: {
|
|
162
|
+
content: "Content shown inside the tooltip.",
|
|
163
|
+
children: "The trigger. Must be a single child.",
|
|
164
|
+
side: "Default side. Auto-flips on viewport collision.",
|
|
165
|
+
align: "Alignment along the side.",
|
|
166
|
+
sideOffset: "Gap from the trigger (px).",
|
|
167
|
+
arrowOffset: "Shifts the arrow from center by px.",
|
|
168
|
+
followMouse: "Arrow follows the pointer over the trigger. Ignores arrowOffset.",
|
|
169
|
+
arrow: "Shows the arrow.",
|
|
170
|
+
open: "Controlled open state.",
|
|
171
|
+
onOpenChange: "Open state change callback.",
|
|
172
|
+
delayDuration: "Delay before showing on hover (ms).",
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const ko: Strings = {
|
|
178
|
+
title: "Tooltip",
|
|
179
|
+
lead: "트리거에 호버나 포커스했을 때 짧은 설명을 띄우는 오버레이. 아이콘 버튼 라벨, 비활성 이유, 단축키 안내에 씁니다. 긴 설명이나 클릭 가능한 콘텐츠는 Popover로.",
|
|
180
|
+
playgroundDesc: "조합을 눌러보면서 확인하세요.",
|
|
181
|
+
|
|
182
|
+
saveLabel: "저장",
|
|
183
|
+
searchLabel: "검색",
|
|
184
|
+
favoriteLabel: "즐겨찾기",
|
|
185
|
+
notificationsLabel: "알림",
|
|
186
|
+
deleteLabel: "삭제",
|
|
187
|
+
up: "위",
|
|
188
|
+
right: "오른쪽",
|
|
189
|
+
down: "아래",
|
|
190
|
+
left: "왼쪽",
|
|
191
|
+
cantSaveReason: "변경사항이 없어 저장할 수 없습니다",
|
|
192
|
+
noDeletePermission: "권한이 없어 삭제할 수 없습니다",
|
|
193
|
+
alreadySubmitted: "이미 제출된 항목입니다",
|
|
194
|
+
editLabel: "편집",
|
|
195
|
+
alwaysOpenLabel: "Controlled tooltip",
|
|
196
|
+
alwaysOpenCaption: "외부 상태로 제어",
|
|
197
|
+
|
|
198
|
+
usage: {
|
|
199
|
+
heading: "Usage",
|
|
200
|
+
desc: (
|
|
201
|
+
<>
|
|
202
|
+
트리거 하나를 자식으로, 설명은 <Code>content</Code>로.
|
|
203
|
+
</>
|
|
204
|
+
),
|
|
205
|
+
},
|
|
206
|
+
placement: {
|
|
207
|
+
heading: "Placement",
|
|
208
|
+
desc: "기본 방향은 위쪽. 뷰포트에 부딪히면 자동으로 반대편으로 이동합니다.",
|
|
209
|
+
},
|
|
210
|
+
withIconButton: {
|
|
211
|
+
heading: "With Icon Button",
|
|
212
|
+
desc: (
|
|
213
|
+
<>
|
|
214
|
+
아이콘만 있는 버튼은 그 자체로 뜻이 안 읽힙니다. Tooltip으로 라벨을 보완하되 접근성을 위해 <Code>aria-label</Code>도 같이.
|
|
215
|
+
</>
|
|
216
|
+
),
|
|
217
|
+
},
|
|
218
|
+
withDisabled: {
|
|
219
|
+
heading: "With Disabled Reason",
|
|
220
|
+
desc: "disabled 요소는 포인터 이벤트를 못 받으니 Tooltip을 걸려면 트리거를 감싸는 래퍼가 필요합니다.",
|
|
221
|
+
},
|
|
222
|
+
withShortcut: {
|
|
223
|
+
heading: "With Shortcut",
|
|
224
|
+
desc: (
|
|
225
|
+
<>
|
|
226
|
+
기능 이름과 단축키를 함께. <Code>content</Code>에 JSX를 넘겨 라벨과 키를 나란히.
|
|
227
|
+
</>
|
|
228
|
+
),
|
|
229
|
+
},
|
|
230
|
+
controlled: {
|
|
231
|
+
heading: "Controlled Open",
|
|
232
|
+
desc: (
|
|
233
|
+
<>
|
|
234
|
+
<Code>open</Code>으로 강제로 열어두거나 외부에서 제어합니다. 온보딩 힌트에 유용합니다.
|
|
235
|
+
</>
|
|
236
|
+
),
|
|
237
|
+
},
|
|
238
|
+
api: {
|
|
239
|
+
heading: "API Reference",
|
|
240
|
+
desc: (
|
|
241
|
+
<>
|
|
242
|
+
Portal 렌더링, <Code>aria-describedby</Code> 자동 연결, keyboard focus 트리거, ESC dismiss, 뷰포트 자동 회피가 기본에 포함됩니다.
|
|
243
|
+
</>
|
|
244
|
+
),
|
|
245
|
+
columns: { prop: "Prop", type: "Type", default: "Default", desc: "Description" },
|
|
246
|
+
rows: {
|
|
247
|
+
content: "툴팁 안에 표시할 내용.",
|
|
248
|
+
children: "툴팁을 붙일 트리거. 반드시 단일 자식.",
|
|
249
|
+
side: "기본 방향. 뷰포트 충돌 시 자동 flip.",
|
|
250
|
+
align: "방향에서의 정렬.",
|
|
251
|
+
sideOffset: "트리거와의 간격(px).",
|
|
252
|
+
arrowOffset: "꼭지를 중심에서 px만큼 이동.",
|
|
253
|
+
followMouse: "트리거 위 마우스를 따라 꼭지 이동. arrowOffset은 무시.",
|
|
254
|
+
arrow: "꼭지 표시 여부.",
|
|
255
|
+
open: "controlled open 상태.",
|
|
256
|
+
onOpenChange: "open 상태 변경 콜백.",
|
|
257
|
+
delayDuration: "hover 후 등장 지연(ms).",
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export const strings = { en, ko };
|
|
263
|
+
export type { Strings };
|
|
264
|
+
````
|
|
265
|
+
|
|
266
|
+
### Source: web/app/[lang]/components/general/tooltip/page.tsx
|
|
267
|
+
|
|
268
|
+
````tsx
|
|
269
|
+
"use client";
|
|
270
|
+
|
|
271
|
+
import { useState } from "react";
|
|
272
|
+
import { usePathname } from "next/navigation";
|
|
273
|
+
import { Tooltip } from "@/components/Tooltip";
|
|
274
|
+
import { TooltipFeedbackExample } from "@/examples/TooltipFeedbackExample";
|
|
275
|
+
import { Button } from "@/components/Button";
|
|
276
|
+
import { Code } from "@/components/Code";
|
|
277
|
+
import { Shortcut } from "@/components/Shortcut";
|
|
278
|
+
import { IconButton } from "@/components/IconButton";
|
|
279
|
+
import { Icon } from "@/components/Icon/Icon";
|
|
280
|
+
import { useTheme } from "@/components/ThemeController";
|
|
281
|
+
import { ExampleBlock } from "../../../../_components/ExampleBlock";
|
|
282
|
+
import { Playground } from "../../../../_components/Playground";
|
|
283
|
+
import { DocsTable } from "../../../../_components/DocsTable";
|
|
284
|
+
import { labels } from "../../../../_labels";
|
|
285
|
+
import { localeFromPathname } from "../../../../_dict";
|
|
286
|
+
import { strings } from "./_strings";
|
|
287
|
+
|
|
288
|
+
type Side = "top" | "right" | "bottom" | "left";
|
|
289
|
+
type Align = "start" | "center" | "end";
|
|
290
|
+
|
|
291
|
+
export default function TooltipPage() {
|
|
292
|
+
const pathname = usePathname() ?? "/";
|
|
293
|
+
const t = strings[localeFromPathname(pathname)];
|
|
294
|
+
const ko = localeFromPathname(pathname) === "ko";
|
|
295
|
+
const { lang } = useTheme();
|
|
296
|
+
const l = labels("en");
|
|
297
|
+
|
|
298
|
+
const [arrowOffset, setArrowOffset] = useState(0);
|
|
299
|
+
const [side, setSide] = useState<Side>("top");
|
|
300
|
+
const [align, setAlign] = useState<Align>("center");
|
|
301
|
+
const [arrow, setArrow] = useState(true);
|
|
302
|
+
const [followMouse, setFollowMouse] = useState(false);
|
|
303
|
+
const [open, setOpen] = useState(true);
|
|
304
|
+
const [controlledOpen, setControlledOpen] = useState(false);
|
|
305
|
+
|
|
306
|
+
const sideLabels: Record<Side, string> = {
|
|
307
|
+
top: strings.en.up,
|
|
308
|
+
right: strings.en.right,
|
|
309
|
+
bottom: strings.en.down,
|
|
310
|
+
left: strings.en.left,
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<>
|
|
315
|
+
<h1 className="page-title">{t.title}</h1>
|
|
316
|
+
<p className="page-lead">{t.lead}</p>
|
|
317
|
+
|
|
318
|
+
<section id="usage" className="section-first">
|
|
319
|
+
<h2>{t.usage.heading}</h2>
|
|
320
|
+
<p className="desc">{t.usage.desc}</p>
|
|
321
|
+
<ExampleBlock
|
|
322
|
+
code={`import { Tooltip } from "@/components/Tooltip";
|
|
323
|
+
|
|
324
|
+
<Tooltip content="${strings.en.saveLabel}">
|
|
325
|
+
<IconButton icon={<Icon name="check" />} aria-label="${strings.en.saveLabel}" />
|
|
326
|
+
</Tooltip>`}
|
|
327
|
+
>
|
|
328
|
+
<Tooltip content={l.basicTooltip}>
|
|
329
|
+
<Button variant="outline">{l.hoverMe}</Button>
|
|
330
|
+
</Tooltip>
|
|
331
|
+
</ExampleBlock>
|
|
332
|
+
</section>
|
|
333
|
+
|
|
334
|
+
<Playground
|
|
335
|
+
desc={t.playgroundDesc}
|
|
336
|
+
axes={[
|
|
337
|
+
{ label: "side", value: side, onChange: (v) => setSide(v as Side), options: ["top", "right", "bottom", "left"] },
|
|
338
|
+
{ label: "align", value: align, onChange: (v) => setAlign(v as Align), options: ["start", "center", "end"] },
|
|
339
|
+
]}
|
|
340
|
+
sliders={[
|
|
341
|
+
{ label: "arrowOffset", value: arrowOffset, onChange: setArrowOffset, min: -40, max: 40, step: 1, unit: "px" },
|
|
342
|
+
]}
|
|
343
|
+
toggles={[
|
|
344
|
+
{ label: "arrow", value: arrow, onChange: setArrow },
|
|
345
|
+
{ label: "followMouse", value: followMouse, onChange: setFollowMouse },
|
|
346
|
+
{ label: "open", value: open, onChange: setOpen },
|
|
347
|
+
]}
|
|
348
|
+
>
|
|
349
|
+
<div className="tooltip-pg-stage">
|
|
350
|
+
<Tooltip
|
|
351
|
+
content={`side=${side}, align=${align}`}
|
|
352
|
+
side={side}
|
|
353
|
+
align={align}
|
|
354
|
+
arrowOffset={arrowOffset}
|
|
355
|
+
arrow={arrow}
|
|
356
|
+
followMouse={followMouse}
|
|
357
|
+
open={open}
|
|
358
|
+
onOpenChange={setOpen}
|
|
359
|
+
>
|
|
360
|
+
<Button variant="outline">{l.trigger}</Button>
|
|
361
|
+
</Tooltip>
|
|
362
|
+
</div>
|
|
363
|
+
</Playground>
|
|
364
|
+
|
|
365
|
+
<style jsx>{`
|
|
366
|
+
.tooltip-pg-stage {
|
|
367
|
+
display: flex;
|
|
368
|
+
justify-content: center;
|
|
369
|
+
padding: var(--space-16) 0;
|
|
370
|
+
}
|
|
371
|
+
.tooltip-placement-grid {
|
|
372
|
+
display: grid;
|
|
373
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
374
|
+
grid-template-rows: repeat(3, minmax(var(--size-10), auto));
|
|
375
|
+
column-gap: var(--space-10);
|
|
376
|
+
align-items: center;
|
|
377
|
+
justify-items: center;
|
|
378
|
+
}
|
|
379
|
+
.tooltip-placement-cell[data-pos="top"] {
|
|
380
|
+
grid-column: 2;
|
|
381
|
+
grid-row: 1;
|
|
382
|
+
align-self: end;
|
|
383
|
+
}
|
|
384
|
+
.tooltip-placement-cell[data-pos="left"] {
|
|
385
|
+
grid-column: 1;
|
|
386
|
+
grid-row: 2;
|
|
387
|
+
justify-self: end;
|
|
388
|
+
}
|
|
389
|
+
.tooltip-placement-cell[data-pos="right"] {
|
|
390
|
+
grid-column: 3;
|
|
391
|
+
grid-row: 2;
|
|
392
|
+
justify-self: start;
|
|
393
|
+
}
|
|
394
|
+
.tooltip-placement-cell[data-pos="bottom"] {
|
|
395
|
+
grid-column: 2;
|
|
396
|
+
grid-row: 3;
|
|
397
|
+
align-self: start;
|
|
398
|
+
}
|
|
399
|
+
`}</style>
|
|
400
|
+
|
|
401
|
+
<section id="placement">
|
|
402
|
+
<h2>{t.placement.heading}</h2>
|
|
403
|
+
<p className="desc">{t.placement.desc}</p>
|
|
404
|
+
<ExampleBlock
|
|
405
|
+
code={`<Tooltip content="${strings.en.up}" side="top">...</Tooltip>
|
|
406
|
+
<Tooltip content="${strings.en.right}" side="right">...</Tooltip>
|
|
407
|
+
<Tooltip content="${strings.en.down}" side="bottom">...</Tooltip>
|
|
408
|
+
<Tooltip content="${strings.en.left}" side="left">...</Tooltip>`}
|
|
409
|
+
>
|
|
410
|
+
<div className="tooltip-placement-grid">
|
|
411
|
+
<div className="tooltip-placement-cell" data-pos="top">
|
|
412
|
+
<Tooltip content={sideLabels.top} side="top">
|
|
413
|
+
<Button variant="outline">{sideLabels.top}</Button>
|
|
414
|
+
</Tooltip>
|
|
415
|
+
</div>
|
|
416
|
+
<div className="tooltip-placement-cell" data-pos="left">
|
|
417
|
+
<Tooltip content={sideLabels.left} side="left">
|
|
418
|
+
<Button variant="outline">{sideLabels.left}</Button>
|
|
419
|
+
</Tooltip>
|
|
420
|
+
</div>
|
|
421
|
+
<div className="tooltip-placement-cell" data-pos="right">
|
|
422
|
+
<Tooltip content={sideLabels.right} side="right">
|
|
423
|
+
<Button variant="outline">{sideLabels.right}</Button>
|
|
424
|
+
</Tooltip>
|
|
425
|
+
</div>
|
|
426
|
+
<div className="tooltip-placement-cell" data-pos="bottom">
|
|
427
|
+
<Tooltip content={sideLabels.bottom} side="bottom">
|
|
428
|
+
<Button variant="outline">{sideLabels.bottom}</Button>
|
|
429
|
+
</Tooltip>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
</ExampleBlock>
|
|
433
|
+
</section>
|
|
434
|
+
|
|
435
|
+
<section id="with-icon-button">
|
|
436
|
+
<h2>{t.withIconButton.heading}</h2>
|
|
437
|
+
<p className="desc">{t.withIconButton.desc}</p>
|
|
438
|
+
<ExampleBlock
|
|
439
|
+
code={`<Tooltip content="${strings.en.searchLabel}">
|
|
440
|
+
<IconButton icon={<Icon name="search" />} aria-label="${strings.en.searchLabel}" />
|
|
441
|
+
</Tooltip>`}
|
|
442
|
+
>
|
|
443
|
+
<Tooltip content={strings.en.searchLabel}>
|
|
444
|
+
<IconButton icon={<Icon name="search" />} aria-label={strings.en.searchLabel} />
|
|
445
|
+
</Tooltip>
|
|
446
|
+
<Tooltip content={strings.en.favoriteLabel}>
|
|
447
|
+
<IconButton icon={<Icon name="star" />} aria-label={strings.en.favoriteLabel} />
|
|
448
|
+
</Tooltip>
|
|
449
|
+
<Tooltip content={strings.en.notificationsLabel}>
|
|
450
|
+
<IconButton icon={<Icon name="bell" />} aria-label={strings.en.notificationsLabel} />
|
|
451
|
+
</Tooltip>
|
|
452
|
+
<Tooltip content={strings.en.deleteLabel}>
|
|
453
|
+
<IconButton icon={<Icon name="trash" />} variant="destructive" aria-label={strings.en.deleteLabel} />
|
|
454
|
+
</Tooltip>
|
|
455
|
+
</ExampleBlock>
|
|
456
|
+
</section>
|
|
457
|
+
|
|
458
|
+
<section id="with-disabled">
|
|
459
|
+
<h2>{t.withDisabled.heading}</h2>
|
|
460
|
+
<p className="desc">{t.withDisabled.desc}</p>
|
|
461
|
+
<ExampleBlock
|
|
462
|
+
code={`<Tooltip content="${strings.en.cantSaveReason}">
|
|
463
|
+
<span className="disabled-wrap">
|
|
464
|
+
<Button variant="primary" disabled>${strings.en.saveLabel}</Button>
|
|
465
|
+
</span>
|
|
466
|
+
</Tooltip>`}
|
|
467
|
+
>
|
|
468
|
+
<Tooltip content={strings.en.cantSaveReason}>
|
|
469
|
+
<span className="disabled-wrap">
|
|
470
|
+
<Button variant="primary" disabled>{strings.en.saveLabel}</Button>
|
|
471
|
+
</span>
|
|
472
|
+
</Tooltip>
|
|
473
|
+
<Tooltip content={strings.en.noDeletePermission}>
|
|
474
|
+
<span className="disabled-wrap">
|
|
475
|
+
<Button variant="destructive" disabled leftIcon={<Icon name="trash" />}>{strings.en.deleteLabel}</Button>
|
|
476
|
+
</span>
|
|
477
|
+
</Tooltip>
|
|
478
|
+
<Tooltip content={strings.en.alreadySubmitted}>
|
|
479
|
+
<span className="disabled-wrap">
|
|
480
|
+
<Button variant="outline" disabled>{strings.en.editLabel}</Button>
|
|
481
|
+
</span>
|
|
482
|
+
</Tooltip>
|
|
483
|
+
</ExampleBlock>
|
|
484
|
+
</section>
|
|
485
|
+
|
|
486
|
+
<section id="with-shortcut">
|
|
487
|
+
<h2>{t.withShortcut.heading}</h2>
|
|
488
|
+
<p className="desc">{t.withShortcut.desc}</p>
|
|
489
|
+
<ExampleBlock
|
|
490
|
+
code={`<Tooltip content={<span className="shortcut-content">${strings.en.saveLabel} <Shortcut size="sm">⌘S</Shortcut></span>}>
|
|
491
|
+
<IconButton icon={<Icon name="check" />} aria-label="${strings.en.saveLabel}" />
|
|
492
|
+
</Tooltip>`}
|
|
493
|
+
>
|
|
494
|
+
<Tooltip
|
|
495
|
+
content={
|
|
496
|
+
<span className="shortcut-content">
|
|
497
|
+
{strings.en.saveLabel} <Shortcut size="sm">⌘S</Shortcut>
|
|
498
|
+
</span>
|
|
499
|
+
}
|
|
500
|
+
>
|
|
501
|
+
<IconButton icon={<Icon name="check" />} aria-label={strings.en.saveLabel} />
|
|
502
|
+
</Tooltip>
|
|
503
|
+
<Tooltip
|
|
504
|
+
content={
|
|
505
|
+
<span className="shortcut-content">
|
|
506
|
+
{strings.en.searchLabel} <Shortcut size="sm">⌘K</Shortcut>
|
|
507
|
+
</span>
|
|
508
|
+
}
|
|
509
|
+
>
|
|
510
|
+
<IconButton icon={<Icon name="search" />} aria-label={strings.en.searchLabel} />
|
|
511
|
+
</Tooltip>
|
|
512
|
+
</ExampleBlock>
|
|
513
|
+
</section>
|
|
514
|
+
|
|
515
|
+
<section id="controlled">
|
|
516
|
+
<h2>{t.controlled.heading}</h2>
|
|
517
|
+
<p className="desc">{t.controlled.desc}</p>
|
|
518
|
+
<ExampleBlock
|
|
519
|
+
code={`const [open, setOpen] = useState(false);
|
|
520
|
+
|
|
521
|
+
<Tooltip content="${strings.en.alwaysOpenCaption}" open={open} onOpenChange={setOpen}>
|
|
522
|
+
<Button variant="outline">${strings.en.alwaysOpenLabel}</Button>
|
|
523
|
+
</Tooltip>`}
|
|
524
|
+
>
|
|
525
|
+
<Tooltip content={strings.en.alwaysOpenCaption} open={controlledOpen} onOpenChange={setControlledOpen}>
|
|
526
|
+
<Button variant="outline">{strings.en.alwaysOpenLabel}</Button>
|
|
527
|
+
</Tooltip>
|
|
528
|
+
</ExampleBlock>
|
|
529
|
+
</section>
|
|
530
|
+
|
|
531
|
+
<section id="use-cases">
|
|
532
|
+
<h2>{ko ? "사용사례" : "Use cases"}</h2>
|
|
533
|
+
<h3>{ko ? "복사 완료 피드백" : "Copy confirmation"}</h3>
|
|
534
|
+
<ExampleBlock code={'<MessageActions variant="toolbar" size="sm" actions={[{\n kind: "copy",\n successLabel: "Copied",\n errorLabel: "Copy failed",\n onClick: () => navigator.clipboard.writeText(text),\n}]} />'}>
|
|
535
|
+
<TooltipFeedbackExample />
|
|
536
|
+
</ExampleBlock>
|
|
537
|
+
</section>
|
|
538
|
+
<section id="motion-standard">
|
|
539
|
+
<h2>{ko ? "애니메이션 표준" : "Animation standard"}</h2>
|
|
540
|
+
<DocsTable columns={[{ key: "phase", label: ko ? "단계" : "Phase", width: 150 }, { key: "behavior", label: ko ? "동작" : "Behavior", flex: true }]} rows={[
|
|
541
|
+
{ phase: ko ? "완료" : "Confirmation", behavior: ko ? "성공한 뒤 체크와 완료 문구를 1200ms 표시합니다. Copy가 160ms 동안 완전히 사라진 뒤 체크는 크기를 유지하며 360ms 동안 왼쪽부터 드러나고, 완료 문구는 240ms 동안 거의 제자리에서 페이드됩니다." : "After success, show a check and confirmation for 1200ms. Copy fades out completely over 160ms. Then the check reveals from left to right over 360ms at a fixed size and the label fades in over 240ms with minimal vertical movement." },
|
|
542
|
+
{ phase: ko ? "닫힘" : "Dismissal", behavior: ko ? "포인터 이탈·포커스 해제 시 닫습니다. 종료 중에는 완료 문구를 유지하고, 다음 열림에 원래 라벨로 복원합니다." : "Dismiss on pointer leave or blur. Keep the result throughout exit; restore the original label on the next opening." },
|
|
543
|
+
{ phase: ko ? "표면·접근성" : "Surface and motion", behavior: ko ? "표면의 등장·퇴장은 공용 m-float을 사용합니다. 테마 모션과 모션 감소 설정을 따릅니다." : "Use the shared m-float animation for the surface. Respect the theme motion setting and reduced-motion preference." },
|
|
544
|
+
]} />
|
|
545
|
+
</section>
|
|
546
|
+
|
|
547
|
+
<section id="api">
|
|
548
|
+
<h2>{t.api.heading}</h2>
|
|
549
|
+
<p className="desc">{t.api.desc}</p>
|
|
550
|
+
<DocsTable
|
|
551
|
+
columns={[
|
|
552
|
+
{ key: "prop", label: t.api.columns.prop, width: 140 },
|
|
553
|
+
{ key: "type", label: t.api.columns.type, flex: true, minWidth: 200 },
|
|
554
|
+
{ key: "default", label: t.api.columns.default, width: 120 },
|
|
555
|
+
{ key: "desc", label: t.api.columns.desc, flex: true, minWidth: 240 },
|
|
556
|
+
]}
|
|
557
|
+
rows={[
|
|
558
|
+
{
|
|
559
|
+
prop: <Code>content</Code>,
|
|
560
|
+
type: <Code>ReactNode</Code>,
|
|
561
|
+
default: "",
|
|
562
|
+
desc: t.api.rows.content,
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
prop: <Code>children</Code>,
|
|
566
|
+
type: <Code>ReactNode</Code>,
|
|
567
|
+
default: "",
|
|
568
|
+
desc: t.api.rows.children,
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
prop: <Code>side</Code>,
|
|
572
|
+
type: <Code>'top' | 'right' | 'bottom' | 'left'</Code>,
|
|
573
|
+
default: <Code>'top'</Code>,
|
|
574
|
+
desc: t.api.rows.side,
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
prop: <Code>align</Code>,
|
|
578
|
+
type: <Code>'start' | 'center' | 'end'</Code>,
|
|
579
|
+
default: <Code>'center'</Code>,
|
|
580
|
+
desc: t.api.rows.align,
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
prop: <Code>sideOffset</Code>,
|
|
584
|
+
type: <Code>number</Code>,
|
|
585
|
+
default: <Code>6</Code>,
|
|
586
|
+
desc: t.api.rows.sideOffset,
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
prop: <Code>arrowOffset</Code>,
|
|
590
|
+
type: <Code>number</Code>,
|
|
591
|
+
default: <Code>0</Code>,
|
|
592
|
+
desc: t.api.rows.arrowOffset,
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
prop: <Code>followMouse</Code>,
|
|
596
|
+
type: <Code>boolean</Code>,
|
|
597
|
+
default: <Code>false</Code>,
|
|
598
|
+
desc: t.api.rows.followMouse,
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
prop: <Code>arrow</Code>,
|
|
602
|
+
type: <Code>boolean</Code>,
|
|
603
|
+
default: <Code>true</Code>,
|
|
604
|
+
desc: t.api.rows.arrow,
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
prop: <Code>open</Code>,
|
|
608
|
+
type: <Code>boolean</Code>,
|
|
609
|
+
default: "",
|
|
610
|
+
desc: t.api.rows.open,
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
prop: <Code>onOpenChange</Code>,
|
|
614
|
+
type: <Code>(open: boolean) => void</Code>,
|
|
615
|
+
default: "",
|
|
616
|
+
desc: t.api.rows.onOpenChange,
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
prop: <Code>delayDuration</Code>,
|
|
620
|
+
type: <Code>number</Code>,
|
|
621
|
+
default: <Code>300</Code>,
|
|
622
|
+
desc: t.api.rows.delayDuration,
|
|
623
|
+
},
|
|
624
|
+
]}
|
|
625
|
+
/>
|
|
626
|
+
</section>
|
|
627
|
+
</>
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
````
|
|
631
|
+
|
|
632
|
+
### Source: web/examples/TooltipFeedbackExample.tsx
|
|
633
|
+
|
|
634
|
+
````tsx
|
|
635
|
+
"use client";
|
|
636
|
+
|
|
637
|
+
import { Code } from "@/components/Code";
|
|
638
|
+
import { MessageActions } from "@/components/MessageActions";
|
|
639
|
+
|
|
640
|
+
export function TooltipFeedbackExample() {
|
|
641
|
+
const text = "Design review is ready.";
|
|
642
|
+
return <>
|
|
643
|
+
<Code>{text}</Code>
|
|
644
|
+
<MessageActions variant="toolbar" size="sm" actions={[{
|
|
645
|
+
kind: "copy",
|
|
646
|
+
successLabel: "Copied",
|
|
647
|
+
errorLabel: "Copy failed",
|
|
648
|
+
onClick: () => navigator.clipboard.writeText(text),
|
|
649
|
+
}]} />
|
|
650
|
+
</>;
|
|
651
|
+
}
|
|
652
|
+
````
|