@toolr/ui-design 0.1.6 → 0.1.8

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.
Files changed (61) hide show
  1. package/components/hooks/use-click-outside.ts +10 -3
  2. package/components/hooks/use-modal-behavior.ts +53 -0
  3. package/components/hooks/use-navigation-history.ts +7 -2
  4. package/components/hooks/use-resizable-sidebar.ts +38 -0
  5. package/components/lib/form-colors.ts +40 -0
  6. package/components/sections/captured-issues/captured-issues-panel.tsx +3 -3
  7. package/components/sections/captured-issues/use-captured-issues.ts +9 -3
  8. package/components/sections/golden-snapshots/file-diff-viewer.tsx +1 -1
  9. package/components/sections/golden-snapshots/status-overview.tsx +1 -1
  10. package/components/sections/prompt-editor/file-type-tabbed-prompt-editor.tsx +4 -40
  11. package/components/sections/prompt-editor/index.ts +0 -7
  12. package/components/sections/prompt-editor/simulator-prompt-editor.tsx +4 -40
  13. package/components/sections/prompt-editor/tabbed-prompt-editor.tsx +4 -36
  14. package/components/sections/snippets-editor/snippets-editor.tsx +6 -39
  15. package/components/settings/SettingsHeader.tsx +0 -1
  16. package/components/settings/SettingsTreeNav.tsx +9 -12
  17. package/components/ui/action-dialog.tsx +19 -55
  18. package/components/ui/ai-action-button.tsx +2 -4
  19. package/components/ui/badge.tsx +15 -23
  20. package/components/ui/breadcrumb.tsx +11 -71
  21. package/components/ui/checkbox.tsx +19 -27
  22. package/components/ui/collapsible-section.tsx +4 -41
  23. package/components/ui/confirm-badge.tsx +14 -23
  24. package/components/ui/cookie-consent.tsx +18 -2
  25. package/components/ui/debounce-border-overlay.tsx +31 -0
  26. package/components/ui/detail-section.tsx +2 -19
  27. package/components/ui/editor-placeholder-card.tsx +10 -9
  28. package/components/ui/execution-details-panel.tsx +2 -7
  29. package/components/ui/extension-list-card.tsx +1 -1
  30. package/components/ui/file-structure-section.tsx +3 -18
  31. package/components/ui/file-tree.tsx +6 -18
  32. package/components/ui/files-panel.tsx +3 -11
  33. package/components/ui/filter-dropdown.tsx +5 -2
  34. package/components/ui/form-actions.tsx +11 -8
  35. package/components/ui/icon-button.tsx +7 -6
  36. package/components/ui/input.tsx +18 -29
  37. package/components/ui/label.tsx +7 -17
  38. package/components/ui/layout-tab-bar.tsx +5 -5
  39. package/components/ui/modal.tsx +10 -18
  40. package/components/ui/nav-card.tsx +3 -18
  41. package/components/ui/navigation-bar.tsx +12 -73
  42. package/components/ui/number-input.tsx +6 -0
  43. package/components/ui/registry-browser.tsx +6 -20
  44. package/components/ui/registry-card.tsx +3 -7
  45. package/components/ui/resizable-textarea.tsx +13 -35
  46. package/components/ui/segmented-toggle.tsx +4 -1
  47. package/components/ui/select.tsx +8 -14
  48. package/components/ui/selection-grid.tsx +6 -50
  49. package/components/ui/setting-row.tsx +5 -5
  50. package/components/ui/settings-card.tsx +2 -2
  51. package/components/ui/settings-info-box.tsx +6 -24
  52. package/components/ui/sort-dropdown.tsx +8 -5
  53. package/components/ui/status-card.tsx +2 -13
  54. package/components/ui/tab-bar.tsx +17 -33
  55. package/components/ui/toggle.tsx +22 -30
  56. package/components/ui/tooltip.tsx +11 -23
  57. package/dist/index.d.ts +71 -142
  58. package/dist/index.js +1630 -2436
  59. package/index.ts +8 -7
  60. package/package.json +9 -1
  61. package/components/sections/prompt-editor/use-prompt-editor.ts +0 -131
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Shared types
2
- export { type FormColor } from './components/lib/form-colors.ts'
2
+ export { type FormColor, type AccentColor, ACCENT_TEXT, ACCENT_ICON, ACCENT_NAV } from './components/lib/form-colors.ts'
3
3
  export {
4
4
  SCALE_KEYS, type ScaleKey, type ThemeId,
5
5
  SURFACE_KEYS, type SurfaceKey,
@@ -14,11 +14,11 @@ export { AI_TOOL_LOGOS, AiToolIcon, AI_TOOL_NAMES, type AiToolKey } from './comp
14
14
 
15
15
  // UI Components
16
16
  export { IconButton, CollapseButton, iconMap, type IconButtonProps, type CollapseButtonProps, type IconButtonColor, type IconButtonVariant, type IconButtonStatus, type IconName, type ActionItem } from './components/ui/icon-button.tsx'
17
- export { Label, type LabelProps, type LabelColor } from './components/ui/label.tsx'
17
+ export { Label, smartCapitalize, type LabelProps, type LabelColor } from './components/ui/label.tsx'
18
18
  export { Badge, type BadgeProps, type BadgeColor } from './components/ui/badge.tsx'
19
19
  export { ConfirmBadge, type ConfirmBadgeProps, type ConfirmBadgeColor } from './components/ui/confirm-badge.tsx'
20
20
  export { Checkbox, type CheckboxProps, type CheckboxSize, type CheckboxColor, type CheckboxVariant } from './components/ui/checkbox.tsx'
21
- export { Toggle, type ToggleProps, type ToggleColor, type ToggleSize, type ToggleVariant } from './components/ui/toggle.tsx'
21
+ export { Toggle, type ToggleProps, type ToggleColor, type ToggleSize } from './components/ui/toggle.tsx'
22
22
  export { Input, type InputProps } from './components/ui/input.tsx'
23
23
  export { NumberInput, type NumberInputProps } from './components/ui/number-input.tsx'
24
24
  export { Tooltip, TooltipButton, type TooltipContent, type TooltipPosition, type TooltipAlign } from './components/ui/tooltip.tsx'
@@ -31,16 +31,16 @@ export { SortDropdown, type SortDropdownProps, type SortField } from './componen
31
31
  export { FormActions, type FormActionsProps } from './components/ui/form-actions.tsx'
32
32
  export { ConfirmModal, AlertModal, type ConfirmModalProps, type AlertModalProps, type ModalKind, type ModalSize } from './components/ui/modal.tsx'
33
33
  export { ActionDialog, type ActionDialogProps } from './components/ui/action-dialog.tsx'
34
- export { ExecutionDetailsPanel, type ExecutionDetailsPanelProps, type ExecutionDetailRow } from './components/ui/execution-details-panel.tsx'
34
+ export { ExecutionDetailsPanel, type ExecutionDetailsPanelProps } from './components/ui/execution-details-panel.tsx'
35
35
  export { FileTree, collectDirPaths, type FileTreeProps, type FileTreeNode } from './components/ui/file-tree.tsx'
36
36
  export { EditorToolbar, type EditorToolbarProps } from './components/ui/editor-toolbar.tsx'
37
37
  export { BottomPanelHeader, type BottomPanelHeaderProps, type PanelTab, type StatusBanner } from './components/ui/bottom-panel-header.tsx'
38
38
  export { FrontmatterFormHeader, type FrontmatterFormHeaderProps } from './components/ui/frontmatter-form-header.tsx'
39
39
  export { EditorPlaceholderCard, type EditorPlaceholderCardProps } from './components/ui/editor-placeholder-card.tsx'
40
40
  export { DetailViewWrapper, type DetailViewWrapperProps } from './components/ui/detail-view-wrapper.tsx'
41
- export { RegistryCard, type RegistryCardProps, type RegistryItemType, type ExtensionSource, type SeedrItemStatus, formatCategory } from './components/ui/registry-card.tsx'
41
+ export { RegistryCard, type RegistryCardProps, type RegistryItemType, type ExtensionSource, type SeedrItemStatus } from './components/ui/registry-card.tsx'
42
42
  export { RegistryDetail, type RegistryDetailProps } from './components/ui/registry-detail.tsx'
43
- export { FileStructureSection, getLanguageFromPath, type FileStructureSectionProps, type PreviewMode, type AccentColor } from './components/ui/file-structure-section.tsx'
43
+ export { FileStructureSection, getLanguageFromPath, type FileStructureSectionProps, type PreviewMode } from './components/ui/file-structure-section.tsx'
44
44
  export { RegistryBrowser, type RegistryBrowserProps } from './components/ui/registry-browser.tsx'
45
45
  export { AiActionButton, type AiActionButtonProps, type AiActionStatus, type AiCompletionResult } from './components/ui/ai-action-button.tsx'
46
46
  export { AiExecutionActionButtons, type AiExecutionActionButtonsProps, type ExecutionStatus } from './components/ui/ai-execution-action-buttons.tsx'
@@ -97,7 +97,6 @@ export {
97
97
  TabbedPromptEditor, type TabbedPromptEditorProps,
98
98
  FileTypeTabbedPromptEditor, type FileTypeTabbedPromptEditorProps,
99
99
  SimulatorPromptEditor, type SimulatorPromptEditorProps,
100
- usePromptEditor, type UsePromptEditorOptions, type UsePromptEditorReturn,
101
100
  type ToolTab, type PromptPlaceholder, type PromptSnapshot, type PromptEditorApi,
102
101
  type FileTypeOption, type ScenarioOption,
103
102
  } from './components/sections/prompt-editor/index.ts'
@@ -119,7 +118,9 @@ export { CookieConsent, type CookieConsentProps, type ConsentChoice } from './co
119
118
  // Hooks
120
119
  export { useClickOutside } from './components/hooks/use-click-outside.ts'
121
120
  export { useDropdownMaxHeight } from './components/hooks/use-dropdown-max-height.ts'
121
+ export { useModalBehavior } from './components/hooks/use-modal-behavior.ts'
122
122
  export { useNavigationHistory, type UseNavigationHistoryReturn } from './components/hooks/use-navigation-history.ts'
123
+ export { useResizableSidebar, type UseResizableSidebarOptions } from './components/hooks/use-resizable-sidebar.ts'
123
124
 
124
125
  // Settings
125
126
  export { SettingRow, type SettingRowProps } from './components/ui/setting-row.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolr/ui-design",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -67,5 +67,13 @@
67
67
  "@types/react-dom": "^19.2.3",
68
68
  "tsup": "^8.5.1",
69
69
  "typescript": "^5.9.3"
70
+ },
71
+ "pnpm": {
72
+ "overrides": {
73
+ "dompurify": ">=3.3.2"
74
+ }
75
+ },
76
+ "overrides": {
77
+ "dompurify": ">=3.3.2"
70
78
  }
71
79
  }
@@ -1,131 +0,0 @@
1
- /**
2
- * usePromptEditor — Hook managing prompt editor state
3
- *
4
- * Part of: Sections > Prompt Editor
5
- *
6
- * Handles:
7
- * - Local content state (separate from saved content for dirty detection)
8
- * - Dirty state detection
9
- * - Save with Ctrl/Cmd+S keyboard shortcut
10
- * - Variable search/filter
11
- * - Active tab state
12
- */
13
-
14
- import { useState, useCallback, useEffect, useMemo } from 'react'
15
- import type { ToolTab, PromptPlaceholder } from './types.ts'
16
-
17
- export interface UsePromptEditorOptions {
18
- /** Prompt content keyed by tool id */
19
- prompts: Record<string, string>
20
- /** Called when saving (all modified prompts at once) */
21
- onPromptChange: (tool: string, value: string) => void
22
- /** Available tool tabs */
23
- tools: ToolTab[]
24
- /** Available template variables */
25
- variables?: PromptPlaceholder[]
26
- }
27
-
28
- export interface UsePromptEditorReturn {
29
- /** Currently active tool tab id */
30
- activeTab: string
31
- setActiveTab: (tab: string) => void
32
- /** Local editor content (may differ from saved prompts) */
33
- localContent: Record<string, string>
34
- /** Current prompt for the active tab */
35
- currentPrompt: string
36
- /** Whether any tab has unsaved changes */
37
- isDirty: boolean
38
- /** Handle editor content change */
39
- handleEditorChange: (value: string | undefined) => void
40
- /** Save all modified prompts */
41
- handleSave: () => void
42
- /** Variable search state */
43
- variableSearch: string
44
- setVariableSearch: (search: string) => void
45
- /** Filtered variables based on search */
46
- filteredVariables: PromptPlaceholder[]
47
- }
48
-
49
- export function usePromptEditor({
50
- prompts,
51
- onPromptChange,
52
- tools,
53
- variables,
54
- }: UsePromptEditorOptions): UsePromptEditorReturn {
55
- const [activeTab, setActiveTab] = useState(tools[0]?.id ?? '')
56
- const [localContent, setLocalContent] = useState<Record<string, string>>(prompts)
57
- const [isDirty, setIsDirty] = useState(false)
58
- const [variableSearch, setVariableSearch] = useState('')
59
-
60
- // Sync local content when prompts change externally
61
- useEffect(() => {
62
- setLocalContent(prompts)
63
- setIsDirty(false)
64
- }, [prompts])
65
-
66
- const handleEditorChange = useCallback(
67
- (value: string | undefined) => {
68
- const newValue = value ?? ''
69
- setLocalContent((prev) => {
70
- const updated = { ...prev, [activeTab]: newValue }
71
- const hasDiff = Object.keys(prompts).some(
72
- (tool) => updated[tool] !== prompts[tool],
73
- )
74
- setIsDirty(hasDiff)
75
- return updated
76
- })
77
- },
78
- [activeTab, prompts],
79
- )
80
-
81
- const handleSave = useCallback(() => {
82
- for (const tool of Object.keys(prompts)) {
83
- if (localContent[tool] !== prompts[tool]) {
84
- onPromptChange(tool, localContent[tool])
85
- }
86
- }
87
- setIsDirty(false)
88
- }, [localContent, prompts, onPromptChange])
89
-
90
- // Keyboard shortcut: Cmd/Ctrl + S
91
- useEffect(() => {
92
- const handleKeyDown = (e: KeyboardEvent) => {
93
- if ((e.metaKey || e.ctrlKey) && e.key === 's') {
94
- e.preventDefault()
95
- if (isDirty) {
96
- handleSave()
97
- }
98
- }
99
- }
100
- window.addEventListener('keydown', handleKeyDown)
101
- return () => window.removeEventListener('keydown', handleKeyDown)
102
- }, [isDirty, handleSave])
103
-
104
- const currentPrompt = localContent[activeTab] ?? ''
105
-
106
- // Filter variables based on search
107
- const filteredVariables = useMemo(() => {
108
- if (!variables) return []
109
- if (!variableSearch.trim()) return variables
110
- const search = variableSearch.toLowerCase()
111
- return variables.filter(
112
- (v) =>
113
- v.name.toLowerCase().includes(search) ||
114
- v.description.toLowerCase().includes(search) ||
115
- (v.example && v.example.toLowerCase().includes(search)),
116
- )
117
- }, [variables, variableSearch])
118
-
119
- return {
120
- activeTab,
121
- setActiveTab,
122
- localContent,
123
- currentPrompt,
124
- isDirty,
125
- handleEditorChange,
126
- handleSave,
127
- variableSearch,
128
- setVariableSearch,
129
- filteredVariables,
130
- }
131
- }