dishui 0.0.108 → 0.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.release-verified.json +3 -2
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/Avatar/index.js.map +1 -1
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ButtonMenu/index.js.map +1 -1
- package/dist/components/Card/Metric2.js.map +1 -1
- package/dist/components/Card/Ticket2.js.map +1 -1
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Chart/Chart.js.map +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/ChoicePicker/index.js.map +1 -1
- package/dist/components/Column/index.js.map +1 -1
- package/dist/components/ConfirmDialog/index.js.map +1 -1
- package/dist/components/DateTimeInput/index.js.map +1 -1
- package/dist/components/Demo/index.js.map +1 -1
- package/dist/components/Demo/source.js.map +1 -1
- package/dist/components/Divider/index.js.map +1 -1
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/FileUploader/DropZone.js.map +1 -1
- package/dist/components/FileUploader/FileItem.js.map +1 -1
- package/dist/components/FileUploader/FileUploader.js.map +1 -1
- package/dist/components/FileUploader/UploadQueue.js.map +1 -1
- package/dist/components/GroupButton/index.js.map +1 -1
- package/dist/components/GroupedTable/index.js.map +1 -1
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Image/index.js.map +1 -1
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/LayoutSuite/DashboardSuite.js.map +1 -1
- package/dist/components/LayoutSuite/index.js.map +1 -1
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Markdown/codeThemes.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Markdown/parseCodeBlockMeta.js.map +1 -1
- package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
- package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
- package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
- package/dist/components/Modal/focusScope.js.map +1 -1
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/MultipleChoice/index.js.map +1 -1
- package/dist/components/NavigationList/index.js.map +1 -1
- package/dist/components/Page/Float2.js.map +1 -1
- package/dist/components/Page/index.js.map +1 -1
- package/dist/components/Page/resize2.js.map +1 -1
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/PagePanel/index.js.map +1 -1
- package/dist/components/ProtectedRoute/index.js.map +1 -1
- package/dist/components/Resizable/ResizeGrip.js.map +1 -1
- package/dist/components/Resizable/index.js.map +1 -1
- package/dist/components/Resizable/useResize.js.map +1 -1
- package/dist/components/Row/index.js.map +1 -1
- package/dist/components/Section/index.js.map +1 -1
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SidebarToggleButton/index.js.map +1 -1
- package/dist/components/Skeleton/index.js.map +1 -1
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Tab/index.js.map +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tabNavigation.js.map +1 -1
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/ai/AgentChat/index.js.map +1 -1
- package/dist/components/ai/AgentRunCard/index.js.map +1 -1
- package/dist/components/ai/AgentScreen/index.js.map +1 -1
- package/dist/components/ai/ApprovalCard/index.js.map +1 -1
- package/dist/components/ai/CodeView/index.js.map +1 -1
- package/dist/components/ai/CommandSearch/index.js.map +1 -1
- package/dist/components/ai/ContextCards/index.js.map +1 -1
- package/dist/components/ai/DiffTable/index.js.map +1 -1
- package/dist/components/ai/FilterTable/index.js.map +1 -1
- package/dist/components/ai/FineTuneCard/index.js.map +1 -1
- package/dist/components/ai/InsightCards/index.js.map +1 -1
- package/dist/components/ai/IssueCard/index.js.map +1 -1
- package/dist/components/ai/LoadingState/index.js.map +1 -1
- package/dist/components/ai/PromptBar/index.js.map +1 -1
- package/dist/components/ai/RecommendationCard/index.js.map +1 -1
- package/dist/components/ai/RecordsTable/index.js.map +1 -1
- package/dist/components/ai/SelectionActions/index.js.map +1 -1
- package/dist/components/ai/StateFlow/index.js.map +1 -1
- package/dist/components/ai/StreamingText/index.js.map +1 -1
- package/dist/components/ai/TaskRows/index.js.map +1 -1
- package/dist/components/ai/Thinking/index.js.map +1 -1
- package/dist/components/ai/ToolChips/index.js.map +1 -1
- package/dist/components/ai/shared.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
- package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
- package/dist/components/pro/ArticleControl/buildHeadingTree.js.map +1 -1
- package/dist/components/pro/ArticleControl/useArticleToc.js.map +1 -1
- package/dist/components/pro/Calendar/Calendar.js +165 -160
- package/dist/components/pro/Calendar/Calendar.js.map +1 -1
- package/dist/components/pro/Calendar/hooks/useCalendarDrag.js.map +1 -1
- package/dist/components/pro/Calendar/hooks/useCalendarState.js +31 -31
- package/dist/components/pro/Calendar/hooks/useCalendarState.js.map +1 -1
- package/dist/components/pro/Calendar/utils.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/javascript.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/python.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/snippets.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js +65 -59
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/themes.js.map +1 -1
- package/dist/components/pro/CodeEditor/utils.js.map +1 -1
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/Filters.js.map +1 -1
- package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
- package/dist/components/pro/DataTable/PivotView.js.map +1 -1
- package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
- package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
- package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
- package/dist/components/pro/DataTable/extension.js.map +1 -1
- package/dist/components/pro/DataTable/pivotEngine.js.map +1 -1
- package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
- package/dist/components/pro/DataTable/useColumnDragReorder.js.map +1 -1
- package/dist/components/pro/DataTable/useDataTableModel.js +119 -104
- package/dist/components/pro/DataTable/useDataTableModel.js.map +1 -1
- package/dist/components/pro/DataTable/utils.js.map +1 -1
- package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
- package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
- package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
- package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
- package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/archify/build.js.map +1 -1
- package/dist/components/pro/Flow/archify/convert.js.map +1 -1
- package/dist/components/pro/Flow/archify/palette.js.map +1 -1
- package/dist/components/pro/Flow/archify/presets.js.map +1 -1
- package/dist/components/pro/Flow/archify/spec.js.map +1 -1
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js.map +1 -1
- package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
- package/dist/components/pro/Flow/constants.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgeMarkers.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useResizablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useUndoRedo.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useViewport.js.map +1 -1
- package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
- package/dist/components/pro/Flow/lines/lineSmoothing.js.map +1 -1
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
- package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
- package/dist/components/pro/Flow/nodes/animAnchors.js.map +1 -1
- package/dist/components/pro/Flow/nodes/chartGeometryBudget.js.map +1 -1
- package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/demandRender.js.map +1 -1
- package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
- package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
- package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
- package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
- package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
- package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
- package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
- package/dist/components/pro/Flow/types.js.map +1 -1
- package/dist/components/pro/Flow/utils/dashedLine.js.map +1 -1
- package/dist/components/pro/Flow/utils/gradient.js.map +1 -1
- package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -1
- package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
- package/dist/components/pro/Gantt/Gantt.js.map +1 -1
- package/dist/components/pro/Gantt/hooks/useGanttDrag.js.map +1 -1
- package/dist/components/pro/Gantt/hooks/useGanttState.js +79 -71
- package/dist/components/pro/Gantt/hooks/useGanttState.js.map +1 -1
- package/dist/components/pro/Gantt/utils.js.map +1 -1
- package/dist/components/pro/Kanban/Kanban.js.map +1 -1
- package/dist/components/pro/Kanban/Swimlanes.js.map +1 -1
- package/dist/components/pro/Kanban/useKanbanDrag.js.map +1 -1
- package/dist/components/pro/Kanban/utils.js.map +1 -1
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
- package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/ResizableImage.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/legacyMermaid.js.map +1 -1
- package/dist/components/pro/RichTextEditor/types.js.map +1 -1
- package/dist/components/pro/Sprite/Molly/animations.d.ts +6 -0
- package/dist/components/pro/Sprite/Molly/animations.js +52 -0
- package/dist/components/pro/Sprite/Molly/animations.js.map +1 -0
- package/dist/components/pro/Sprite/Molly/events.d.ts +2 -0
- package/dist/components/pro/Sprite/Molly/events.js +46 -0
- package/dist/components/pro/Sprite/Molly/events.js.map +1 -0
- package/dist/components/pro/Sprite/Molly/index.d.ts +1 -0
- package/dist/components/pro/Sprite/Molly/index.js +12 -0
- package/dist/components/pro/Sprite/Molly/index.js.map +1 -0
- package/dist/components/pro/Sprite/Molly/legFlexion.d.ts +3 -0
- package/dist/components/pro/Sprite/Molly/legFlexion.js +48 -0
- package/dist/components/pro/Sprite/Molly/legFlexion.js.map +1 -0
- package/dist/components/pro/Sprite/Molly/locomotion.d.ts +4 -0
- package/dist/components/pro/Sprite/Molly/locomotion.js +51 -0
- package/dist/components/pro/Sprite/Molly/locomotion.js.map +1 -0
- package/dist/components/pro/Sprite/Molly/model.d.ts +23 -0
- package/dist/components/pro/Sprite/Molly/model.js +614 -0
- package/dist/components/pro/Sprite/Molly/model.js.map +1 -0
- package/dist/components/pro/Sprite/Molly/rig.d.ts +25 -0
- package/dist/components/pro/Sprite/Molly/rig.js +102 -0
- package/dist/components/pro/Sprite/Molly/rig.js.map +1 -0
- package/dist/components/pro/Sprite/Ruby/animations.d.ts +6 -0
- package/dist/components/pro/Sprite/Ruby/animations.js +58 -0
- package/dist/components/pro/Sprite/Ruby/animations.js.map +1 -0
- package/dist/components/pro/Sprite/Ruby/events.d.ts +2 -0
- package/dist/components/pro/Sprite/Ruby/events.js +46 -0
- package/dist/components/pro/Sprite/Ruby/events.js.map +1 -0
- package/dist/components/pro/Sprite/Ruby/index.d.ts +1 -0
- package/dist/components/pro/Sprite/Ruby/index.js +12 -0
- package/dist/components/pro/Sprite/Ruby/index.js.map +1 -0
- package/dist/components/pro/Sprite/Ruby/locomotion.d.ts +4 -0
- package/dist/components/pro/Sprite/Ruby/locomotion.js +41 -0
- package/dist/components/pro/Sprite/Ruby/locomotion.js.map +1 -0
- package/dist/components/pro/Sprite/Ruby/model.d.ts +23 -0
- package/dist/components/pro/Sprite/Ruby/model.js +605 -0
- package/dist/components/pro/Sprite/Ruby/model.js.map +1 -0
- package/dist/components/pro/Sprite/Ruby/rig.d.ts +26 -0
- package/dist/components/pro/Sprite/Ruby/rig.js +112 -0
- package/dist/components/pro/Sprite/Ruby/rig.js.map +1 -0
- package/dist/components/pro/Sprite/Sprite.d.ts +23 -0
- package/dist/components/pro/Sprite/Sprite2.js +224 -0
- package/dist/components/pro/Sprite/Sprite2.js.map +1 -0
- package/dist/components/pro/Sprite/actions.d.ts +3 -0
- package/dist/components/pro/Sprite/actions.js +16 -0
- package/dist/components/pro/Sprite/actions.js.map +1 -0
- package/dist/components/pro/Sprite/createSpriteScene.d.ts +4 -0
- package/dist/components/pro/Sprite/createSpriteScene.js +14 -0
- package/dist/components/pro/Sprite/createSpriteScene.js.map +1 -0
- package/dist/components/pro/Sprite/index.d.ts +4 -0
- package/dist/components/pro/Sprite/shared/animation.d.ts +33 -0
- package/dist/components/pro/Sprite/shared/animation.js +39 -0
- package/dist/components/pro/Sprite/shared/animation.js.map +1 -0
- package/dist/components/pro/Sprite/shared/createSpriteStage.d.ts +14 -0
- package/dist/components/pro/Sprite/shared/createSpriteStage.js +127 -0
- package/dist/components/pro/Sprite/shared/createSpriteStage.js.map +1 -0
- package/dist/components/pro/Sprite/shared/events.d.ts +5 -0
- package/dist/components/pro/Sprite/shared/events.js +21 -0
- package/dist/components/pro/Sprite/shared/events.js.map +1 -0
- package/dist/components/pro/Sprite/shared/face.d.ts +15 -0
- package/dist/components/pro/Sprite/shared/face.js +33 -0
- package/dist/components/pro/Sprite/shared/face.js.map +1 -0
- package/dist/components/pro/Sprite/shared/faceSurface.d.ts +6 -0
- package/dist/components/pro/Sprite/shared/faceSurface.js +66 -0
- package/dist/components/pro/Sprite/shared/faceSurface.js.map +1 -0
- package/dist/components/pro/Sprite/shared/gait.d.ts +5 -0
- package/dist/components/pro/Sprite/shared/gait.js +19 -0
- package/dist/components/pro/Sprite/shared/gait.js.map +1 -0
- package/dist/components/pro/Sprite/shared/geometry.d.ts +8 -0
- package/dist/components/pro/Sprite/shared/geometry.js +59 -0
- package/dist/components/pro/Sprite/shared/geometry.js.map +1 -0
- package/dist/components/pro/Sprite/shared/magicEffect.d.ts +27 -0
- package/dist/components/pro/Sprite/shared/magicEffect.js +61 -0
- package/dist/components/pro/Sprite/shared/magicEffect.js.map +1 -0
- package/dist/components/pro/Sprite/shared/playback.d.ts +8 -0
- package/dist/components/pro/Sprite/shared/playback.js +74 -0
- package/dist/components/pro/Sprite/shared/playback.js.map +1 -0
- package/dist/components/pro/Sprite/shared/rig.d.ts +6 -0
- package/dist/components/pro/Sprite/shared/rig.js +48 -0
- package/dist/components/pro/Sprite/shared/rig.js.map +1 -0
- package/dist/components/pro/Sprite/shared/scene.d.ts +9 -0
- package/dist/components/pro/Sprite/shared/scene.js +21 -0
- package/dist/components/pro/Sprite/shared/scene.js.map +1 -0
- package/dist/components/pro/Sprite/shared/sculptor.d.ts +14 -0
- package/dist/components/pro/Sprite/shared/sculptor.js +78 -0
- package/dist/components/pro/Sprite/shared/sculptor.js.map +1 -0
- package/dist/components/pro/Sprite/shared/speechBubble.d.ts +15 -0
- package/dist/components/pro/Sprite/shared/speechBubble.js +129 -0
- package/dist/components/pro/Sprite/shared/speechBubble.js.map +1 -0
- package/dist/components/pro/Sprite/types.d.ts +40 -0
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/contexts/authentication.js.map +1 -1
- package/dist/data-table.js +3 -3
- package/dist/data-table.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/hooks/useContainerElement.js.map +1 -1
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/useCopyToClipboard.js.map +1 -1
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useDraggable.js.map +1 -1
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/hooks/useTableData.js.map +1 -1
- package/dist/index-nostyled.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +116 -115
- package/dist/layouts/MainLayout.js.map +1 -1
- package/dist/layouts/Navbar.js.map +1 -1
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/layouts/headbar/Headbar.js.map +1 -1
- package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
- package/dist/sprite.js +2 -0
- package/dist/styles/themeStyles.js.map +1 -1
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/flexLayout.js.map +1 -1
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js.map +1 -1
- package/dist/utils/rehype-code-meta.js.map +1 -1
- package/dist/utils/remark-code-meta.js.map +1 -1
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/safeStorage.js.map +1 -1
- package/dist/utils/selection.js +29 -20
- package/dist/utils/selection.js.map +1 -1
- package/dist/utils/themes.js.map +1 -1
- package/package.json +15 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Card/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\nimport { CardMetric, type CardMetricProps } from './Metric';\nimport { CardTicket, type CardTicketProps } from './Ticket';\nimport ApprovalCard, { type ApprovalCardProps } from '../ai/ApprovalCard';\nimport RecommendationCard, { type RecommendationCardProps } from '../ai/RecommendationCard';\nimport ContextCards, { type ContextCardsProps } from '../ai/ContextCards';\nimport InsightCards, { type InsightCardsProps } from '../ai/InsightCards';\nimport FineTuneCard, { type FineTuneCardProps } from '../ai/FineTuneCard';\nimport IssueCard, { type IssueCardProps } from '../ai/IssueCard';\nimport AgentRunCard, { type AgentRunCardProps } from '../ai/AgentRunCard';\nexport type { CardMetricProps, CardMetricItem } from './Metric';\nexport type {\n CardTicketProps,\n CardTicketTone,\n CardTicketPriorityLevel,\n CardTicketStatus,\n CardTicketIssueType,\n CardTicketAssignee,\n CardTicketPriority,\n CardTicketLabel,\n CardTicketSubtaskProgress,\n} from './Ticket';\nexport type { ApprovalCardProps, ApprovalOption } from '../ai/ApprovalCard';\nexport type { RecommendationCardProps, Recommendation, RecommendationAlternative, RecommendationCardLabels, ConfidenceLevel } from '../ai/RecommendationCard';\nexport type { ContextCardsProps, ContextChunk, ContextSource, ContextSourceKind, ContextCardsLabels } from '../ai/ContextCards';\nexport type { InsightCardsProps, InsightCardItem } from '../ai/InsightCards';\nexport type { FineTuneCardProps, FineTuneMetric } from '../ai/FineTuneCard';\nexport type { IssueCardProps, IssueLabel, IssuePriority, IssueAccent } from '../ai/IssueCard';\nexport type { AgentRunCardProps, AgentRunStatus, AgentRunMeta } from '../ai/AgentRunCard';\n\nexport type CardProps = {\n children: React.ReactNode;\n variant?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';\n bordered?: boolean;\n dash?: boolean;\n side?: boolean;\n imageFull?: boolean;\n compact?: boolean;\n hover?: boolean;\n glass?: boolean; // 毛玻璃效果\n /** Background opacity only (0..1, default 0.15). Non-finite values use the default. */\n glassOpacity?: number;\n style?: React.CSSProperties;\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n className?: string;\n};\n\nconst Card = ({\n children,\n variant,\n bordered = false,\n dash = false,\n side = false,\n imageFull = false,\n compact = false,\n hover = true, // 默认启用 hover 效果\n glass = true, // 默认启用毛玻璃效果\n glassOpacity,\n style,\n size = 'sm',\n className = '',\n}: CardProps) => {\n const baseClass = 'card';\n\n const defaultStyles = glass && !variant ? 'dishui-card-glass' : '';\n\n // 如果指定了 variant,使用该 variant 的背景色,并添加阴影\n const variantClass = variant ? `bg-${variant} text-${variant}-content shadow-md` : '';\n\n const borderedClass = bordered ? 'card-bordered' : '';\n const dashClass = dash ? 'card-dash' : '';\n const sideClass = side ? 'card-side' : '';\n const imageFullClass = imageFull ? 'image-full' : '';\n const compactClass = compact ? 'card-compact' : '';\n const hoverClass = hover ? 'hover:shadow-md transition-shadow duration-200 motion-reduce:transition-none' : '';\n const sizeClass = size ? `card-${size}` : '';\n\n // 宽度策略:\n // 1. 如果用户指定了 w-/max-w-/min-w-,则完全使用用户的设置\n // 2. 否则不设置固定宽度,让 Card 自然适应父容器(Grid 中自动填充,Flex 中根据内容)\n const hasWidthClass = className.includes('w-') || className.match(/max-w-|min-w-/);\n const widthClass = ''; // 不设置默认宽度,让布局决定\n\n const cardClasses = cn(\n baseClass,\n widthClass,\n defaultStyles,\n variantClass,\n borderedClass,\n dashClass,\n sideClass,\n imageFullClass,\n compactClass,\n hoverClass,\n sizeClass,\n className\n );\n\n return (\n <div className={cardClasses} style={buildCardStyle({ variant, glass, glassOpacity, style })}>\n {children}\n </div>\n );\n};\n\n// Card.Title 组件\nexport type CardTitleProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nconst CardTitle = ({\n children,\n className = '',\n}: CardTitleProps) => {\n const titleClasses = cn('card-title', className);\n\n return (\n <h2 className={titleClasses}>\n {children}\n </h2>\n );\n};\n\n// Card.Body 组件\nexport type CardBodyProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nconst CardBody = ({\n children,\n className = '',\n}: CardBodyProps) => {\n const bodyClasses = cn('card-body', className);\n\n return (\n <div className={bodyClasses}>\n {children}\n </div>\n );\n};\n\n// Card.Actions 组件\nexport type CardActionsProps = {\n children: React.ReactNode;\n className?: string;\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n};\n\nconst CardActions = ({\n children,\n className = '',\n justify = 'end',\n}: CardActionsProps) => {\n const actionsClasses = cn(\n 'card-actions',\n justify && `justify-${justify}`,\n className\n );\n\n return (\n <div className={actionsClasses}>\n {children}\n </div>\n );\n};\n\n// Card.Figure 组件\nexport type CardFigureProps = {\n children: React.ReactNode;\n className?: string;\n /**\n * 图片填充方式(作用于内部 <img>):\n * - `cover` 等比裁切填满(默认,“撑满”)\n * - `contain` 等比完整展示,可能留白\n * - `fill` 拉伸填满(不保持比例)\n */\n fit?: 'cover' | 'contain' | 'fill';\n /** 图片撑满整个 figure(w/h 100%)。card-side 时建议开启。 */\n fill?: boolean;\n /** 指定 figure 高度(数字按 px,支持 \"16rem\"/\"50%\" 等);内部图片自动填满该高度 */\n height?: number | string;\n};\n\nconst FIT_CLASS: Record<NonNullable<CardFigureProps['fit']>, string> = {\n cover: '[&>img]:object-cover',\n contain: '[&>img]:object-contain',\n fill: '[&>img]:object-fill',\n};\n\nconst toCssSize = (value: number | string | undefined): string | undefined =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst CardFigure = ({\n children,\n className = '',\n fit = 'cover',\n fill = false,\n height,\n}: CardFigureProps) => {\n const figureClasses = cn(\n 'figure',\n FIT_CLASS[fit],\n // 撑满:figure 与内部 img 都占满可用空间\n fill && 'w-full h-full [&>img]:h-full [&>img]:w-full',\n // 指定高度:figure 定高,内部图片自动填满\n height !== undefined && 'w-full [&>img]:h-full [&>img]:w-full',\n className\n );\n\n return (\n <figure className={figureClasses} style={height !== undefined ? { height: toCssSize(height) } : undefined}>\n {children}\n </figure>\n );\n};\n\n// ─── 内部工具:复用基础 Card 的类名拼装逻辑 ──────────────────\n\ninterface CardClassOptions {\n variant?: CardProps['variant'];\n bordered?: boolean;\n glass?: boolean;\n className?: string;\n}\n\nconst buildCardClasses = ({ variant, bordered = false, glass = true, className = '' }: CardClassOptions) => {\n const defaultStyles = glass && !variant ? 'dishui-card-glass' : '';\n const variantClass = variant ? `bg-${variant} text-${variant}-content shadow-md` : '';\n return cn('card', defaultStyles, variantClass, bordered && 'card-bordered', className);\n};\n\nconst buildCardStyle = ({\n variant,\n glass = true,\n glassOpacity = 0.15,\n style,\n}: Pick<CardProps, 'variant' | 'glass' | 'glassOpacity' | 'style'>): React.CSSProperties | undefined => {\n if (!glass || variant) return style;\n const opacity = Number.isFinite(glassOpacity) ? Math.min(1, Math.max(0, glassOpacity)) : 0.15;\n return { '--dishui-card-glass-opacity': `${opacity * 100}%`, ...style } as React.CSSProperties;\n};\n\nconst ClockGlyph: React.FC<{ className?: string }> = ({ className }) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className={cn('h-4 w-4', className)} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path strokeLinecap=\"round\" d=\"M12 7v5l3 2\" />\n </svg>\n);\n\n// ─── Card.Feature:特性卡(图标 + 标题 + 描述) ───────────────\n\nexport type CardFeatureProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** Icon node (usually a lucide / inline svg), rendered inside a tinted container. */\n icon?: React.ReactNode;\n /** Feature title. */\n title: React.ReactNode;\n /** Feature description rendered under the title. */\n description?: React.ReactNode;\n /** `vertical` centers everything with the icon on top; `horizontal` puts the icon at the left. */\n layout?: 'vertical' | 'horizontal';\n /** Icon container shape. Defaults to `circle` (vertical) / `square` (horizontal). */\n iconShape?: 'circle' | 'square';\n /** Extra content rendered under the description. */\n children?: React.ReactNode;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border. */\n bordered?: boolean;\n /** Disable the default glass background. */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst CardFeature: React.FC<CardFeatureProps> = ({\n icon,\n title,\n description,\n layout = 'vertical',\n iconShape,\n children,\n variant,\n bordered,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => {\n const shape = iconShape ?? (layout === 'vertical' ? 'circle' : 'square');\n const iconBox = icon && (\n <span\n className={cn(\n 'flex shrink-0 items-center justify-center bg-primary/10 text-primary',\n layout === 'vertical' ? 'size-16' : 'size-12',\n shape === 'circle' ? 'rounded-full' : 'rounded-xl',\n )}\n >\n {icon}\n </span>\n );\n\n return (\n <div\n className={buildCardClasses({ variant, bordered, glass, className })}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n onClick={onClick}\n >\n {layout === 'horizontal' ? (\n <div className=\"card-body flex-row items-center gap-4\">\n {iconBox}\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"font-semibold text-base-content\">{title}</h3>\n {description && (\n <p className=\"mt-0.5 text-sm text-base-content/70\">{description}</p>\n )}\n {children}\n </div>\n </div>\n ) : (\n <div className=\"card-body items-center gap-3 text-center\">\n {iconBox}\n <h3 className=\"text-lg font-bold text-base-content\">{title}</h3>\n {description && (\n <p className=\"text-sm leading-relaxed text-base-content/70\">{description}</p>\n )}\n {children}\n </div>\n )}\n </div>\n );\n};\n\n// ─── Card.Quote:引用卡(引用文本 + 作者 / 日期 + 装饰引号) ──\n\nexport type CardQuoteProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** The quoted text. */\n children: React.ReactNode;\n /** Author name (rendered in primary color). */\n author?: React.ReactNode;\n /** Avatar node (e.g. an `<img>` or initial circle) shown before the author. */\n avatar?: React.ReactNode;\n /** Date string/node rendered at the right side of the footer. */\n date?: React.ReactNode;\n /** Hide the decorative quote glyph in the top-right corner. */\n quoteMark?: boolean;\n /** Hide the divider between quote and footer. */\n divider?: boolean;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border. */\n bordered?: boolean;\n /** Disable the default glass background. */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst CardQuote: React.FC<CardQuoteProps> = ({\n children,\n author,\n avatar,\n date,\n quoteMark = true,\n divider = true,\n variant,\n bordered,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => (\n <div\n className={cn(\n buildCardClasses({ variant, bordered, glass, className }),\n 'relative overflow-hidden',\n )}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n onClick={onClick}\n >\n {quoteMark && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute right-5 top-2 select-none font-serif text-6xl leading-none text-primary/25\"\n >\n ”\n </span>\n )}\n <div className=\"card-body gap-0 p-6\">\n <div className={cn('relative z-10 min-w-0 wrap-anywhere text-lg text-base-content', quoteMark && 'pe-10')}>{children}</div>\n <div\n className={cn(\n 'mt-4 flex flex-wrap items-center justify-between gap-3',\n divider && 'border-t border-base-300 pt-3.5',\n )}\n >\n <div className=\"flex min-w-0 items-center gap-2.5\">\n {avatar && <span className=\"size-8 shrink-0 overflow-hidden rounded-full\">{avatar}</span>}\n {author && (\n <span className=\"truncate text-sm font-medium text-primary\">{author}</span>\n )}\n </div>\n {date && (\n <span className=\"flex shrink-0 items-center gap-1.5 text-sm text-base-content/55\">\n <ClockGlyph />\n {date}\n </span>\n )}\n </div>\n </div>\n </div>\n);\n\n// ─── Card.Meta:元信息卡(标题 + 徽章 + 描述 + 左右页脚) ────\n\nexport type CardMetaProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** Card title (top-left). */\n title: React.ReactNode;\n /** Badge / tag node (top-right, e.g. a visibility badge). */\n badge?: React.ReactNode;\n /** Body content under the title row. */\n children?: React.ReactNode;\n /** Footer left slot (e.g. `@author`). */\n footerLeft?: React.ReactNode;\n /** Footer right slot (e.g. a date). */\n footerRight?: React.ReactNode;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border. */\n bordered?: boolean;\n /** Disable the default glass background. */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst CardMeta: React.FC<CardMetaProps> = ({\n title,\n badge,\n children,\n footerLeft,\n footerRight,\n variant,\n bordered,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => (\n <div\n className={buildCardClasses({ variant, bordered, glass, className })}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n onClick={onClick}\n >\n <div className=\"card-body gap-2.5 p-6\">\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"min-w-0 flex-1 truncate text-lg font-bold text-base-content\">{title}</h3>\n {badge && <span className=\"shrink-0\">{badge}</span>}\n </div>\n {children && <div className=\"text-sm text-base-content/75\">{children}</div>}\n {(footerLeft || footerRight) && (\n <div className=\"mt-1.5 flex items-center justify-between gap-3 text-sm text-base-content/55\">\n <span className=\"min-w-0 truncate\">{footerLeft}</span>\n <span className=\"shrink-0\">{footerRight}</span>\n </div>\n )}\n </div>\n </div>\n);\n\n// ─── Card.Info:指标卡(标签 + 数值 + 可选图标 / hint / 加载态) ──\n\nexport type CardInfoTone = 'primary' | 'success' | 'warning' | 'info' | 'error' | 'neutral';\n\nimport './Info.css';\n\nexport type CardInfoProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** Metric name. */\n label: React.ReactNode;\n /** Metric value (number or short text). */\n value: React.ReactNode;\n /** Icon slot. Use Icon to control its size, color and background independently. */\n icon?: React.ReactNode;\n /** `top` keeps the icon beside the label; `left` / `right` flank the content. */\n iconPosition?: 'top' | 'left' | 'right';\n /** Stacked content (default), compact horizontal row, or two-column summary. */\n layout?: 'stacked' | 'horizontal' | 'split';\n /** Content alignment (default left). */\n align?: 'left' | 'center' | 'right';\n /** Additional multi-line content below the summary. */\n children?: React.ReactNode;\n /** Footer slot separated by a subtle divider. */\n footer?: React.ReactNode;\n /** @deprecated Use Icon styles instead. Shape of the optional neutral compatibility box. */\n iconShape?: 'square' | 'circle';\n /** @deprecated Use Icon styles instead. Optional neutral icon box (default false). */\n iconBoxed?: boolean;\n /** Card surface and border tone (default neutral). Does not style the icon. */\n tone?: CardInfoTone;\n /** Small hint text below the value (e.g. deltas, update time). */\n hint?: React.ReactNode;\n /** Loading state: value renders as a skeleton. */\n loading?: boolean;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border (default true). */\n bordered?: boolean;\n /** Enable the glass background (default true, matching Card). */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\n\nconst CardInfo: React.FC<CardInfoProps> = ({\n label,\n value,\n icon,\n iconPosition = 'top',\n iconShape = 'square',\n iconBoxed = false,\n tone = 'neutral',\n layout = 'stacked',\n align = 'left',\n children,\n footer,\n hint,\n loading = false,\n variant,\n bordered = true,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => {\n const cardClasses = buildCardClasses({\n variant, bordered, glass,\n className: cn('dishui-card-info', 'p-4', className),\n });\n const iconNode = icon != null && (\n <span className={cn(\n 'dishui-card-info__icon',\n iconBoxed && (iconShape === 'circle' ? 'rounded-full' : 'rounded-lg'),\n iconBoxed && 'bg-base-content/5',\n )}>\n {icon}\n </span>\n );\n\n return (\n <div\n className={cardClasses}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n data-layout={layout}\n data-align={align}\n data-tone={variant ? undefined : tone}\n data-bordered={bordered}\n data-glass={glass}\n role={onClick ? 'button' : undefined}\n tabIndex={onClick ? 0 : undefined}\n aria-busy={loading || undefined}\n onClick={onClick}\n onKeyDown={onClick ? (event) => {\n // Let controls inside content/footer handle their own keyboard events.\n if (event.target !== event.currentTarget) return;\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n if (!event.repeat) event.currentTarget.click();\n }\n } : undefined}\n >\n <div className=\"dishui-card-info__body\">\n {iconPosition === 'left' && iconNode}\n <div className=\"dishui-card-info__content\">\n <div className=\"dishui-card-info__summary\">\n <div className=\"dishui-card-info__header\">\n <div className=\"dishui-card-info__label\">{label}</div>\n {iconPosition === 'top' && iconNode}\n </div>\n <div className=\"dishui-card-info__reading\">\n <div className=\"dishui-card-info__value\">\n {loading ? <span className=\"dishui-card-info__skeleton\" aria-hidden=\"true\" /> : value}\n </div>\n {hint != null && <div className=\"dishui-card-info__hint\">{hint}</div>}\n </div>\n </div>\n {children != null && <div className=\"dishui-card-info__details\">{children}</div>}\n </div>\n {iconPosition === 'right' && iconNode}\n </div>\n {footer != null && <div className=\"dishui-card-info__footer\">{footer}</div>}\n </div>\n );\n};\n\n// ─── Card.Stat:统计面板(Grafana 风格:超大数值 + 迷你图 / 角标 / 填充色) ───\n\nexport type CardStatProps = {\n /** 面板标签 */\n label: React.ReactNode;\n /** 面板数值(数字或短文本) */\n value: React.ReactNode;\n /** 色调(决定数值文字色 / 角标三角 / filled 底色) */\n tone?: CardInfoTone;\n /** 加载态:值显示为骨架 */\n loading?: boolean;\n className?: string;\n /** 数值单位后缀(如 `K`、`%`),以小号字体渲染在数值右侧。 */\n unit?: React.ReactNode;\n /** 面板数值字号,默认 `xl`。 */\n valueSize?: 'md' | 'lg' | 'xl' | '2xl';\n /** 面板内容对齐,默认 `left`。 */\n align?: 'left' | 'center';\n /** 直接传入迷你图节点(优先于 sparklineData)。 */\n sparkline?: React.ReactNode;\n /** 迷你图数据:传入数值数组后自动渲染 sparkline。 */\n sparklineData?: number[];\n /** 迷你图类型:折线 / 面积 / 柱状。 */\n sparklineType?: 'line' | 'area' | 'bar';\n /** 迷你图高度(px)。 */\n sparklineHeight?: number;\n /** 右上角状态三角(Grafana 阈值指示)。 */\n indicator?: boolean;\n /** 整卡填充 tone 底色、文字用对应 content 色(图 RabbitMQ 风格)。 */\n filled?: boolean;\n /** 点击回调(面板常用于跳转详情)。 */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst STAT_TONE_TEXT_CLASS: Record<NonNullable<CardStatProps['tone']>, string> = {\n primary: 'text-primary',\n success: 'text-success',\n warning: 'text-warning',\n info: 'text-info',\n error: 'text-error',\n neutral: 'text-base-content/70',\n};\n\n/** filled 模式:整卡 tone 底色 + 对应 content 文字色 */\nconst STAT_FILLED_CLASS: Record<NonNullable<CardStatProps['tone']>, string> = {\n primary: 'bg-primary text-primary-content',\n success: 'bg-success text-success-content',\n warning: 'bg-warning text-warning-content',\n info: 'bg-info text-info-content',\n error: 'bg-error text-error-content',\n neutral: 'bg-neutral text-neutral-content',\n};\n\nconst STAT_VALUE_SIZE_CLASS: Record<NonNullable<CardStatProps['valueSize']> & string, string> = {\n md: 'text-2xl',\n lg: 'text-4xl',\n xl: 'text-5xl',\n '2xl': 'text-6xl',\n};\n\nconst statCssVarColor = (tone: NonNullable<CardStatProps['tone']>) =>\n tone === 'neutral' ? 'var(--color-base-content)' : `var(--color-${tone})`;\n\n/** 由数值数组生成迷你图(viewBox 拉伸铺满,描边不随宽度变形) */\nconst MiniSparkline: React.FC<{\n data: number[];\n type: 'line' | 'area' | 'bar';\n height: number;\n}> = ({ data, type, height }) => {\n if (!data || data.length < 2) return null;\n const w = 100;\n const pad = 3;\n const min = Math.min(...data);\n const max = Math.max(...data);\n const range = max - min || 1;\n const px = (i: number) => (i / (data.length - 1)) * w;\n const py = (v: number) => height - pad - ((v - min) / range) * (height - pad * 2);\n const points = data.map((v, i) => `${px(i).toFixed(2)},${py(v).toFixed(2)}`);\n\n if (type === 'bar') {\n const bw = w / data.length;\n return (\n <svg\n viewBox={`0 0 ${w} ${height}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height }}\n aria-hidden=\"true\"\n >\n {data.map((v, i) => (\n <rect\n key={i}\n x={px(i) - bw / 2}\n y={py(v)}\n width={bw * 0.8}\n height={Math.max(1, height - pad - py(v))}\n fill=\"currentColor\"\n />\n ))}\n </svg>\n );\n }\n\n if (type === 'area') {\n return (\n <svg\n viewBox={`0 0 ${w} ${height}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height }}\n aria-hidden=\"true\"\n >\n <path\n d={`M0,${height} L${points.join(' L')} L${w},${height} Z`}\n fill=\"currentColor\"\n opacity={0.18}\n />\n <polyline\n points={points.join(' ')}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n );\n }\n\n return (\n <svg\n viewBox={`0 0 ${w} ${height}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height }}\n aria-hidden=\"true\"\n >\n <polyline\n points={points.join(' ')}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n );\n};\n\n/**\n * 统计面板:Grafana stat panel 风格的「标签 + 超大数值 + 迷你图」小卡,\n * 支持单位后缀、折线 / 面积 / 柱状迷你图、角标状态三角与整卡填充色。\n *\n * 简单的「标签 + 数值 + 图标」指标卡请使用 `Card.Info`。\n */\nconst CardStat: React.FC<CardStatProps> = ({\n label,\n value,\n tone = 'primary',\n loading = false,\n className = '',\n unit,\n valueSize = 'xl',\n align = 'left',\n sparkline,\n sparklineData,\n sparklineType = 'line',\n sparklineHeight = 36,\n indicator = false,\n filled = false,\n onClick,\n}) => {\n const sparklineNode =\n sparkline ??\n (sparklineData && sparklineData.length >= 2 ? (\n <MiniSparkline data={sparklineData} type={sparklineType} height={sparklineHeight} />\n ) : null);\n\n const textColor = filled ? '' : STAT_TONE_TEXT_CLASS[tone];\n const mutedText = filled ? 'opacity-80' : 'text-base-content/60';\n\n return (\n <div\n onClick={onClick}\n className={`relative flex flex-col overflow-hidden rounded-lg p-3 ${\n filled ? STAT_FILLED_CLASS[tone] : 'border border-base-300/60 bg-base-200'\n } ${onClick ? 'cursor-pointer transition-colors hover:border-primary/40' : ''} ${className}`.trim()}\n >\n {indicator && !filled && (\n <span\n aria-hidden=\"true\"\n className=\"absolute right-0 top-0 h-0 w-0\"\n style={{\n borderTop: '14px solid ' + statCssVarColor(tone),\n borderLeft: '14px solid transparent',\n }}\n />\n )}\n <div\n className={`truncate text-xs font-medium ${mutedText} ${align === 'center' ? 'text-center' : ''}`.trim()}\n >\n {label}\n </div>\n <div\n className={`flex min-h-[3rem] flex-1 items-center py-1 ${align === 'center' ? 'justify-center' : 'justify-start'}`}\n >\n {loading ? (\n <span\n className={`inline-block h-8 w-16 animate-pulse rounded ${\n filled ? 'bg-white/25' : 'bg-base-content/10'\n }`}\n />\n ) : (\n <span className={`leading-none tracking-tight ${STAT_VALUE_SIZE_CLASS[valueSize]} font-semibold ${filled ? '' : textColor}`.trim()}>\n {value}\n {unit !== undefined && unit !== null && unit !== '' && (\n <span className=\"ml-0.5 text-[0.45em] font-semibold\">{unit}</span>\n )}\n </span>\n )}\n </div>\n {sparklineNode && (\n <div className={`-mx-3 -mb-3 mt-1 ${filled ? 'text-white' : STAT_TONE_TEXT_CLASS[tone]}`}>\n {sparklineNode}\n </div>\n )}\n </div>\n );\n};\n\n// 扩展Card组件,添加子组件\ninterface CardCompound extends React.FC<CardProps> {\n Metric: React.FC<CardMetricProps>;\n /** Jira 风格工单卡:状态、类型、负责人、优先级、日期、估算与子任务进度。 */\n Ticket: React.FC<CardTicketProps>;\n Title: React.FC<CardTitleProps>;\n Body: React.FC<CardBodyProps>;\n Actions: React.FC<CardActionsProps>;\n Figure: React.FC<CardFigureProps>;\n /** 特性卡:图标 + 标题 + 描述(垂直居中 / 横向两种布局) */\n Feature: React.FC<CardFeatureProps>;\n /** 引用卡:引用文本 + 作者头像 / 日期 + 装饰引号 */\n Quote: React.FC<CardQuoteProps>;\n /** 元信息卡:标题 + 徽章 + 描述 + 左右页脚 */\n Meta: React.FC<CardMetaProps>;\n /** 指标卡:标签 + 数值 + 可选图标 / hint / 加载态(仪表盘统计卡片) */\n Info: React.FC<CardInfoProps>;\n /** 统计面板:Grafana 风格超大数值 + 迷你折线 / 面积 / 柱状图 / 角标 / 填充色 */\n Stat: React.FC<CardStatProps>;\n /** AI 审批卡片:明确展示待批准操作及可选方案。 */\n Approval: React.FC<ApprovalCardProps>;\n /** AI 推荐卡片:首选建议、置信度与替代方案。 */\n Recommendation: React.FC<RecommendationCardProps>;\n /** AI 上下文卡片集合:检索片段与来源。 */\n Context: React.FC<ContextCardsProps>;\n /** AI 洞察指标卡片集合。 */\n Insights: React.FC<InsightCardsProps>;\n /** AI 微调任务状态卡片。 */\n FineTune: React.FC<FineTuneCardProps>;\n /** Linear 风格的工单卡片:标题、标签、类型图标、编号、优先级点、估点与负责人。 */\n Issue: React.FC<IssueCardProps>;\n /** Agent 运行卡片:头像 + 名称 + 模型、状态徽章、任务、当前动作、进度条、元信息与分支页脚。 */\n Run: React.FC<AgentRunCardProps>;\n}\n\nconst CardWithCompounds = Card as CardCompound;\nCardWithCompounds.Title = CardTitle;\nCardWithCompounds.Body = CardBody;\nCardWithCompounds.Actions = CardActions;\nCardWithCompounds.Figure = CardFigure;\nCardWithCompounds.Feature = CardFeature;\nCardWithCompounds.Quote = CardQuote;\nCardWithCompounds.Meta = CardMeta;\nCardWithCompounds.Info = CardInfo;\nCardWithCompounds.Stat = CardStat;\nCardWithCompounds.Metric = CardMetric;\nCardWithCompounds.Ticket = CardTicket;\nCardWithCompounds.Approval = ApprovalCard;\nCardWithCompounds.Recommendation = RecommendationCard;\nCardWithCompounds.Context = ContextCards;\nCardWithCompounds.Insights = InsightCards;\nCardWithCompounds.FineTune = FineTuneCard;\nCardWithCompounds.Issue = IssueCard;\nCardWithCompounds.Run = AgentRunCard;\n\nexport default CardWithCompounds; "],"mappings":";;;;;;;;;;;;;;AAgDA,IAAM,KAAQ,EACZ,aACA,YACA,cAAW,IACX,UAAO,IACP,UAAO,IACP,eAAY,IACZ,aAAU,IACV,WAAQ,IACR,WAAQ,IACR,iBACA,UACA,UAAO,MACP,eAAY,SACG;CACf,IAEM,IAAgB,KAAS,CAAC,IAAU,sBAAsB,IAG1D,IAAe,IAAU,MAAM,EAAQ,QAAQ,EAAQ,sBAAsB,IAE7E,IAAgB,IAAW,kBAAkB,IAC7C,IAAY,IAAO,cAAc,IACjC,IAAY,IAAO,cAAc,IACjC,IAAiB,IAAY,eAAe,IAC5C,IAAe,IAAU,iBAAiB,IAC1C,IAAa,IAAQ,iFAAiF,IACtG,IAAY,IAAO,QAAQ,MAAS;CAKpB,EAAU,SAAS,IAAI,KAAK,EAAU,MAAM,eAAe;CAGjF,IAA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S,GAC3B,EAAkB,UAAU,GAC5B,EAAkB,QAAQ,GAC1B,EAAkB,OAAO,GACzB,EAAkB,OAAO,GACzB,EAAkB,OAAO,GACzB,EAAkB,SAAS,GAC3B,EAAkB,SAAS,GAC3B,EAAkB,WAAW,GAC7B,EAAkB,iBAAiB,GACnC,EAAkB,UAAU,GAC5B,EAAkB,WAAW,GAC7B,EAAkB,WAAW,GAC7B,EAAkB,QAAQ,GAC1B,EAAkB,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ApprovalCard","RecommendationCard","ContextCards","InsightCards","FineTuneCard","IssueCard","AgentRunCard","Card","defaultStyles","glass","variant","variantClass","borderedClass","bordered","dashClass","dash","sideClass","side","imageFullClass","imageFull","compactClass","compact","hoverClass","hover","sizeClass","size","className","cardClasses","cn","buildCardStyle","CardTitle","titleClasses","CardBody","bodyClasses","CardActions","actionsClasses","justify","FIT_CLASS","toCssSize","value","CardFigure","figureClasses","fit","fill","height","buildCardClasses","style","glassOpacity","ClockGlyph","CardFeature","iconBox","icon","layout","iconShape","title","description","children","CardQuote","quoteMark","divider","avatar","author","date","CardMeta","badge","footerLeft","footerRight","CardInfo","iconNode","iconBoxed","align","tone","onClick","loading","event","iconPosition","label","hint","footer","STAT_TONE_TEXT_CLASS","STAT_FILLED_CLASS","STAT_VALUE_SIZE_CLASS","statCssVarColor","MiniSparkline","data","min","range","px","i","py","v","points","type","bw","CardStat","sparklineNode","sparkline","sparklineData","sparklineType","sparklineHeight","textColor","filled","mutedText","indicator","valueSize","unit","CardWithCompounds","CardMetric","CardTicket"],"sources":["../../../src/components/Card/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\nimport { CardMetric, type CardMetricProps } from './Metric';\nimport { CardTicket, type CardTicketProps } from './Ticket';\nimport ApprovalCard, { type ApprovalCardProps } from '../ai/ApprovalCard';\nimport RecommendationCard, { type RecommendationCardProps } from '../ai/RecommendationCard';\nimport ContextCards, { type ContextCardsProps } from '../ai/ContextCards';\nimport InsightCards, { type InsightCardsProps } from '../ai/InsightCards';\nimport FineTuneCard, { type FineTuneCardProps } from '../ai/FineTuneCard';\nimport IssueCard, { type IssueCardProps } from '../ai/IssueCard';\nimport AgentRunCard, { type AgentRunCardProps } from '../ai/AgentRunCard';\nexport type { CardMetricProps, CardMetricItem } from './Metric';\nexport type {\n CardTicketProps,\n CardTicketTone,\n CardTicketPriorityLevel,\n CardTicketStatus,\n CardTicketIssueType,\n CardTicketAssignee,\n CardTicketPriority,\n CardTicketLabel,\n CardTicketSubtaskProgress,\n} from './Ticket';\nexport type { ApprovalCardProps, ApprovalOption } from '../ai/ApprovalCard';\nexport type { RecommendationCardProps, Recommendation, RecommendationAlternative, RecommendationCardLabels, ConfidenceLevel } from '../ai/RecommendationCard';\nexport type { ContextCardsProps, ContextChunk, ContextSource, ContextSourceKind, ContextCardsLabels } from '../ai/ContextCards';\nexport type { InsightCardsProps, InsightCardItem } from '../ai/InsightCards';\nexport type { FineTuneCardProps, FineTuneMetric } from '../ai/FineTuneCard';\nexport type { IssueCardProps, IssueLabel, IssuePriority, IssueAccent } from '../ai/IssueCard';\nexport type { AgentRunCardProps, AgentRunStatus, AgentRunMeta } from '../ai/AgentRunCard';\n\nexport type CardProps = {\n children: React.ReactNode;\n variant?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';\n bordered?: boolean;\n dash?: boolean;\n side?: boolean;\n imageFull?: boolean;\n compact?: boolean;\n hover?: boolean;\n glass?: boolean; // 毛玻璃效果\n /** Background opacity only (0..1, default 0.15). Non-finite values use the default. */\n glassOpacity?: number;\n style?: React.CSSProperties;\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n className?: string;\n};\n\nconst Card = ({\n children,\n variant,\n bordered = false,\n dash = false,\n side = false,\n imageFull = false,\n compact = false,\n hover = true, // 默认启用 hover 效果\n glass = true, // 默认启用毛玻璃效果\n glassOpacity,\n style,\n size = 'sm',\n className = '',\n}: CardProps) => {\n const baseClass = 'card';\n\n const defaultStyles = glass && !variant ? 'dishui-card-glass' : '';\n\n // 如果指定了 variant,使用该 variant 的背景色,并添加阴影\n const variantClass = variant ? `bg-${variant} text-${variant}-content shadow-md` : '';\n\n const borderedClass = bordered ? 'card-bordered' : '';\n const dashClass = dash ? 'card-dash' : '';\n const sideClass = side ? 'card-side' : '';\n const imageFullClass = imageFull ? 'image-full' : '';\n const compactClass = compact ? 'card-compact' : '';\n const hoverClass = hover ? 'hover:shadow-md transition-shadow duration-200 motion-reduce:transition-none' : '';\n const sizeClass = size ? `card-${size}` : '';\n\n // 宽度策略:\n // 1. 如果用户指定了 w-/max-w-/min-w-,则完全使用用户的设置\n // 2. 否则不设置固定宽度,让 Card 自然适应父容器(Grid 中自动填充,Flex 中根据内容)\n const hasWidthClass = className.includes('w-') || className.match(/max-w-|min-w-/);\n const widthClass = ''; // 不设置默认宽度,让布局决定\n\n const cardClasses = cn(\n baseClass,\n widthClass,\n defaultStyles,\n variantClass,\n borderedClass,\n dashClass,\n sideClass,\n imageFullClass,\n compactClass,\n hoverClass,\n sizeClass,\n className\n );\n\n return (\n <div className={cardClasses} style={buildCardStyle({ variant, glass, glassOpacity, style })}>\n {children}\n </div>\n );\n};\n\n// Card.Title 组件\nexport type CardTitleProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nconst CardTitle = ({\n children,\n className = '',\n}: CardTitleProps) => {\n const titleClasses = cn('card-title', className);\n\n return (\n <h2 className={titleClasses}>\n {children}\n </h2>\n );\n};\n\n// Card.Body 组件\nexport type CardBodyProps = {\n children: React.ReactNode;\n className?: string;\n};\n\nconst CardBody = ({\n children,\n className = '',\n}: CardBodyProps) => {\n const bodyClasses = cn('card-body', className);\n\n return (\n <div className={bodyClasses}>\n {children}\n </div>\n );\n};\n\n// Card.Actions 组件\nexport type CardActionsProps = {\n children: React.ReactNode;\n className?: string;\n justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';\n};\n\nconst CardActions = ({\n children,\n className = '',\n justify = 'end',\n}: CardActionsProps) => {\n const actionsClasses = cn(\n 'card-actions',\n justify && `justify-${justify}`,\n className\n );\n\n return (\n <div className={actionsClasses}>\n {children}\n </div>\n );\n};\n\n// Card.Figure 组件\nexport type CardFigureProps = {\n children: React.ReactNode;\n className?: string;\n /**\n * 图片填充方式(作用于内部 <img>):\n * - `cover` 等比裁切填满(默认,“撑满”)\n * - `contain` 等比完整展示,可能留白\n * - `fill` 拉伸填满(不保持比例)\n */\n fit?: 'cover' | 'contain' | 'fill';\n /** 图片撑满整个 figure(w/h 100%)。card-side 时建议开启。 */\n fill?: boolean;\n /** 指定 figure 高度(数字按 px,支持 \"16rem\"/\"50%\" 等);内部图片自动填满该高度 */\n height?: number | string;\n};\n\nconst FIT_CLASS: Record<NonNullable<CardFigureProps['fit']>, string> = {\n cover: '[&>img]:object-cover',\n contain: '[&>img]:object-contain',\n fill: '[&>img]:object-fill',\n};\n\nconst toCssSize = (value: number | string | undefined): string | undefined =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst CardFigure = ({\n children,\n className = '',\n fit = 'cover',\n fill = false,\n height,\n}: CardFigureProps) => {\n const figureClasses = cn(\n 'figure',\n FIT_CLASS[fit],\n // 撑满:figure 与内部 img 都占满可用空间\n fill && 'w-full h-full [&>img]:h-full [&>img]:w-full',\n // 指定高度:figure 定高,内部图片自动填满\n height !== undefined && 'w-full [&>img]:h-full [&>img]:w-full',\n className\n );\n\n return (\n <figure className={figureClasses} style={height !== undefined ? { height: toCssSize(height) } : undefined}>\n {children}\n </figure>\n );\n};\n\n// ─── 内部工具:复用基础 Card 的类名拼装逻辑 ──────────────────\n\ninterface CardClassOptions {\n variant?: CardProps['variant'];\n bordered?: boolean;\n glass?: boolean;\n className?: string;\n}\n\nconst buildCardClasses = ({ variant, bordered = false, glass = true, className = '' }: CardClassOptions) => {\n const defaultStyles = glass && !variant ? 'dishui-card-glass' : '';\n const variantClass = variant ? `bg-${variant} text-${variant}-content shadow-md` : '';\n return cn('card', defaultStyles, variantClass, bordered && 'card-bordered', className);\n};\n\nconst buildCardStyle = ({\n variant,\n glass = true,\n glassOpacity = 0.15,\n style,\n}: Pick<CardProps, 'variant' | 'glass' | 'glassOpacity' | 'style'>): React.CSSProperties | undefined => {\n if (!glass || variant) return style;\n const opacity = Number.isFinite(glassOpacity) ? Math.min(1, Math.max(0, glassOpacity)) : 0.15;\n return { '--dishui-card-glass-opacity': `${opacity * 100}%`, ...style } as React.CSSProperties;\n};\n\nconst ClockGlyph: React.FC<{ className?: string }> = ({ className }) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" className={cn('h-4 w-4', className)} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" strokeWidth={2}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path strokeLinecap=\"round\" d=\"M12 7v5l3 2\" />\n </svg>\n);\n\n// ─── Card.Feature:特性卡(图标 + 标题 + 描述) ───────────────\n\nexport type CardFeatureProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** Icon node (usually a lucide / inline svg), rendered inside a tinted container. */\n icon?: React.ReactNode;\n /** Feature title. */\n title: React.ReactNode;\n /** Feature description rendered under the title. */\n description?: React.ReactNode;\n /** `vertical` centers everything with the icon on top; `horizontal` puts the icon at the left. */\n layout?: 'vertical' | 'horizontal';\n /** Icon container shape. Defaults to `circle` (vertical) / `square` (horizontal). */\n iconShape?: 'circle' | 'square';\n /** Extra content rendered under the description. */\n children?: React.ReactNode;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border. */\n bordered?: boolean;\n /** Disable the default glass background. */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst CardFeature: React.FC<CardFeatureProps> = ({\n icon,\n title,\n description,\n layout = 'vertical',\n iconShape,\n children,\n variant,\n bordered,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => {\n const shape = iconShape ?? (layout === 'vertical' ? 'circle' : 'square');\n const iconBox = icon && (\n <span\n className={cn(\n 'flex shrink-0 items-center justify-center bg-primary/10 text-primary',\n layout === 'vertical' ? 'size-16' : 'size-12',\n shape === 'circle' ? 'rounded-full' : 'rounded-xl',\n )}\n >\n {icon}\n </span>\n );\n\n return (\n <div\n className={buildCardClasses({ variant, bordered, glass, className })}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n onClick={onClick}\n >\n {layout === 'horizontal' ? (\n <div className=\"card-body flex-row items-center gap-4\">\n {iconBox}\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"font-semibold text-base-content\">{title}</h3>\n {description && (\n <p className=\"mt-0.5 text-sm text-base-content/70\">{description}</p>\n )}\n {children}\n </div>\n </div>\n ) : (\n <div className=\"card-body items-center gap-3 text-center\">\n {iconBox}\n <h3 className=\"text-lg font-bold text-base-content\">{title}</h3>\n {description && (\n <p className=\"text-sm leading-relaxed text-base-content/70\">{description}</p>\n )}\n {children}\n </div>\n )}\n </div>\n );\n};\n\n// ─── Card.Quote:引用卡(引用文本 + 作者 / 日期 + 装饰引号) ──\n\nexport type CardQuoteProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** The quoted text. */\n children: React.ReactNode;\n /** Author name (rendered in primary color). */\n author?: React.ReactNode;\n /** Avatar node (e.g. an `<img>` or initial circle) shown before the author. */\n avatar?: React.ReactNode;\n /** Date string/node rendered at the right side of the footer. */\n date?: React.ReactNode;\n /** Hide the decorative quote glyph in the top-right corner. */\n quoteMark?: boolean;\n /** Hide the divider between quote and footer. */\n divider?: boolean;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border. */\n bordered?: boolean;\n /** Disable the default glass background. */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst CardQuote: React.FC<CardQuoteProps> = ({\n children,\n author,\n avatar,\n date,\n quoteMark = true,\n divider = true,\n variant,\n bordered,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => (\n <div\n className={cn(\n buildCardClasses({ variant, bordered, glass, className }),\n 'relative overflow-hidden',\n )}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n onClick={onClick}\n >\n {quoteMark && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute right-5 top-2 select-none font-serif text-6xl leading-none text-primary/25\"\n >\n ”\n </span>\n )}\n <div className=\"card-body gap-0 p-6\">\n <div className={cn('relative z-10 min-w-0 wrap-anywhere text-lg text-base-content', quoteMark && 'pe-10')}>{children}</div>\n <div\n className={cn(\n 'mt-4 flex flex-wrap items-center justify-between gap-3',\n divider && 'border-t border-base-300 pt-3.5',\n )}\n >\n <div className=\"flex min-w-0 items-center gap-2.5\">\n {avatar && <span className=\"size-8 shrink-0 overflow-hidden rounded-full\">{avatar}</span>}\n {author && (\n <span className=\"truncate text-sm font-medium text-primary\">{author}</span>\n )}\n </div>\n {date && (\n <span className=\"flex shrink-0 items-center gap-1.5 text-sm text-base-content/55\">\n <ClockGlyph />\n {date}\n </span>\n )}\n </div>\n </div>\n </div>\n);\n\n// ─── Card.Meta:元信息卡(标题 + 徽章 + 描述 + 左右页脚) ────\n\nexport type CardMetaProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** Card title (top-left). */\n title: React.ReactNode;\n /** Badge / tag node (top-right, e.g. a visibility badge). */\n badge?: React.ReactNode;\n /** Body content under the title row. */\n children?: React.ReactNode;\n /** Footer left slot (e.g. `@author`). */\n footerLeft?: React.ReactNode;\n /** Footer right slot (e.g. a date). */\n footerRight?: React.ReactNode;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border. */\n bordered?: boolean;\n /** Disable the default glass background. */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst CardMeta: React.FC<CardMetaProps> = ({\n title,\n badge,\n children,\n footerLeft,\n footerRight,\n variant,\n bordered,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => (\n <div\n className={buildCardClasses({ variant, bordered, glass, className })}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n onClick={onClick}\n >\n <div className=\"card-body gap-2.5 p-6\">\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"min-w-0 flex-1 truncate text-lg font-bold text-base-content\">{title}</h3>\n {badge && <span className=\"shrink-0\">{badge}</span>}\n </div>\n {children && <div className=\"text-sm text-base-content/75\">{children}</div>}\n {(footerLeft || footerRight) && (\n <div className=\"mt-1.5 flex items-center justify-between gap-3 text-sm text-base-content/55\">\n <span className=\"min-w-0 truncate\">{footerLeft}</span>\n <span className=\"shrink-0\">{footerRight}</span>\n </div>\n )}\n </div>\n </div>\n);\n\n// ─── Card.Info:指标卡(标签 + 数值 + 可选图标 / hint / 加载态) ──\n\nexport type CardInfoTone = 'primary' | 'success' | 'warning' | 'info' | 'error' | 'neutral';\n\nimport './Info.css';\n\nexport type CardInfoProps = Pick<CardProps, 'glassOpacity' | 'style'> & {\n /** Metric name. */\n label: React.ReactNode;\n /** Metric value (number or short text). */\n value: React.ReactNode;\n /** Icon slot. Use Icon to control its size, color and background independently. */\n icon?: React.ReactNode;\n /** `top` keeps the icon beside the label; `left` / `right` flank the content. */\n iconPosition?: 'top' | 'left' | 'right';\n /** Stacked content (default), compact horizontal row, or two-column summary. */\n layout?: 'stacked' | 'horizontal' | 'split';\n /** Content alignment (default left). */\n align?: 'left' | 'center' | 'right';\n /** Additional multi-line content below the summary. */\n children?: React.ReactNode;\n /** Footer slot separated by a subtle divider. */\n footer?: React.ReactNode;\n /** @deprecated Use Icon styles instead. Shape of the optional neutral compatibility box. */\n iconShape?: 'square' | 'circle';\n /** @deprecated Use Icon styles instead. Optional neutral icon box (default false). */\n iconBoxed?: boolean;\n /** Card surface and border tone (default neutral). Does not style the icon. */\n tone?: CardInfoTone;\n /** Small hint text below the value (e.g. deltas, update time). */\n hint?: React.ReactNode;\n /** Loading state: value renders as a skeleton. */\n loading?: boolean;\n /** Color variant (daisyUI). */\n variant?: CardProps['variant'];\n /** Show a border (default true). */\n bordered?: boolean;\n /** Enable the glass background (default true, matching Card). */\n glass?: boolean;\n /** Extra class names on the card. */\n className?: string;\n /** Click handler. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\n\nconst CardInfo: React.FC<CardInfoProps> = ({\n label,\n value,\n icon,\n iconPosition = 'top',\n iconShape = 'square',\n iconBoxed = false,\n tone = 'neutral',\n layout = 'stacked',\n align = 'left',\n children,\n footer,\n hint,\n loading = false,\n variant,\n bordered = true,\n glass = true,\n glassOpacity,\n style,\n className = '',\n onClick,\n}) => {\n const cardClasses = buildCardClasses({\n variant, bordered, glass,\n className: cn('dishui-card-info', 'p-4', className),\n });\n const iconNode = icon != null && (\n <span className={cn(\n 'dishui-card-info__icon',\n iconBoxed && (iconShape === 'circle' ? 'rounded-full' : 'rounded-lg'),\n iconBoxed && 'bg-base-content/5',\n )}>\n {icon}\n </span>\n );\n\n return (\n <div\n className={cardClasses}\n style={buildCardStyle({ variant, glass, glassOpacity, style })}\n data-layout={layout}\n data-align={align}\n data-tone={variant ? undefined : tone}\n data-bordered={bordered}\n data-glass={glass}\n role={onClick ? 'button' : undefined}\n tabIndex={onClick ? 0 : undefined}\n aria-busy={loading || undefined}\n onClick={onClick}\n onKeyDown={onClick ? (event) => {\n // Let controls inside content/footer handle their own keyboard events.\n if (event.target !== event.currentTarget) return;\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n if (!event.repeat) event.currentTarget.click();\n }\n } : undefined}\n >\n <div className=\"dishui-card-info__body\">\n {iconPosition === 'left' && iconNode}\n <div className=\"dishui-card-info__content\">\n <div className=\"dishui-card-info__summary\">\n <div className=\"dishui-card-info__header\">\n <div className=\"dishui-card-info__label\">{label}</div>\n {iconPosition === 'top' && iconNode}\n </div>\n <div className=\"dishui-card-info__reading\">\n <div className=\"dishui-card-info__value\">\n {loading ? <span className=\"dishui-card-info__skeleton\" aria-hidden=\"true\" /> : value}\n </div>\n {hint != null && <div className=\"dishui-card-info__hint\">{hint}</div>}\n </div>\n </div>\n {children != null && <div className=\"dishui-card-info__details\">{children}</div>}\n </div>\n {iconPosition === 'right' && iconNode}\n </div>\n {footer != null && <div className=\"dishui-card-info__footer\">{footer}</div>}\n </div>\n );\n};\n\n// ─── Card.Stat:统计面板(Grafana 风格:超大数值 + 迷你图 / 角标 / 填充色) ───\n\nexport type CardStatProps = {\n /** 面板标签 */\n label: React.ReactNode;\n /** 面板数值(数字或短文本) */\n value: React.ReactNode;\n /** 色调(决定数值文字色 / 角标三角 / filled 底色) */\n tone?: CardInfoTone;\n /** 加载态:值显示为骨架 */\n loading?: boolean;\n className?: string;\n /** 数值单位后缀(如 `K`、`%`),以小号字体渲染在数值右侧。 */\n unit?: React.ReactNode;\n /** 面板数值字号,默认 `xl`。 */\n valueSize?: 'md' | 'lg' | 'xl' | '2xl';\n /** 面板内容对齐,默认 `left`。 */\n align?: 'left' | 'center';\n /** 直接传入迷你图节点(优先于 sparklineData)。 */\n sparkline?: React.ReactNode;\n /** 迷你图数据:传入数值数组后自动渲染 sparkline。 */\n sparklineData?: number[];\n /** 迷你图类型:折线 / 面积 / 柱状。 */\n sparklineType?: 'line' | 'area' | 'bar';\n /** 迷你图高度(px)。 */\n sparklineHeight?: number;\n /** 右上角状态三角(Grafana 阈值指示)。 */\n indicator?: boolean;\n /** 整卡填充 tone 底色、文字用对应 content 色(图 RabbitMQ 风格)。 */\n filled?: boolean;\n /** 点击回调(面板常用于跳转详情)。 */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\nconst STAT_TONE_TEXT_CLASS: Record<NonNullable<CardStatProps['tone']>, string> = {\n primary: 'text-primary',\n success: 'text-success',\n warning: 'text-warning',\n info: 'text-info',\n error: 'text-error',\n neutral: 'text-base-content/70',\n};\n\n/** filled 模式:整卡 tone 底色 + 对应 content 文字色 */\nconst STAT_FILLED_CLASS: Record<NonNullable<CardStatProps['tone']>, string> = {\n primary: 'bg-primary text-primary-content',\n success: 'bg-success text-success-content',\n warning: 'bg-warning text-warning-content',\n info: 'bg-info text-info-content',\n error: 'bg-error text-error-content',\n neutral: 'bg-neutral text-neutral-content',\n};\n\nconst STAT_VALUE_SIZE_CLASS: Record<NonNullable<CardStatProps['valueSize']> & string, string> = {\n md: 'text-2xl',\n lg: 'text-4xl',\n xl: 'text-5xl',\n '2xl': 'text-6xl',\n};\n\nconst statCssVarColor = (tone: NonNullable<CardStatProps['tone']>) =>\n tone === 'neutral' ? 'var(--color-base-content)' : `var(--color-${tone})`;\n\n/** 由数值数组生成迷你图(viewBox 拉伸铺满,描边不随宽度变形) */\nconst MiniSparkline: React.FC<{\n data: number[];\n type: 'line' | 'area' | 'bar';\n height: number;\n}> = ({ data, type, height }) => {\n if (!data || data.length < 2) return null;\n const w = 100;\n const pad = 3;\n const min = Math.min(...data);\n const max = Math.max(...data);\n const range = max - min || 1;\n const px = (i: number) => (i / (data.length - 1)) * w;\n const py = (v: number) => height - pad - ((v - min) / range) * (height - pad * 2);\n const points = data.map((v, i) => `${px(i).toFixed(2)},${py(v).toFixed(2)}`);\n\n if (type === 'bar') {\n const bw = w / data.length;\n return (\n <svg\n viewBox={`0 0 ${w} ${height}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height }}\n aria-hidden=\"true\"\n >\n {data.map((v, i) => (\n <rect\n key={i}\n x={px(i) - bw / 2}\n y={py(v)}\n width={bw * 0.8}\n height={Math.max(1, height - pad - py(v))}\n fill=\"currentColor\"\n />\n ))}\n </svg>\n );\n }\n\n if (type === 'area') {\n return (\n <svg\n viewBox={`0 0 ${w} ${height}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height }}\n aria-hidden=\"true\"\n >\n <path\n d={`M0,${height} L${points.join(' L')} L${w},${height} Z`}\n fill=\"currentColor\"\n opacity={0.18}\n />\n <polyline\n points={points.join(' ')}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n );\n }\n\n return (\n <svg\n viewBox={`0 0 ${w} ${height}`}\n preserveAspectRatio=\"none\"\n className=\"block w-full\"\n style={{ height }}\n aria-hidden=\"true\"\n >\n <polyline\n points={points.join(' ')}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n );\n};\n\n/**\n * 统计面板:Grafana stat panel 风格的「标签 + 超大数值 + 迷你图」小卡,\n * 支持单位后缀、折线 / 面积 / 柱状迷你图、角标状态三角与整卡填充色。\n *\n * 简单的「标签 + 数值 + 图标」指标卡请使用 `Card.Info`。\n */\nconst CardStat: React.FC<CardStatProps> = ({\n label,\n value,\n tone = 'primary',\n loading = false,\n className = '',\n unit,\n valueSize = 'xl',\n align = 'left',\n sparkline,\n sparklineData,\n sparklineType = 'line',\n sparklineHeight = 36,\n indicator = false,\n filled = false,\n onClick,\n}) => {\n const sparklineNode =\n sparkline ??\n (sparklineData && sparklineData.length >= 2 ? (\n <MiniSparkline data={sparklineData} type={sparklineType} height={sparklineHeight} />\n ) : null);\n\n const textColor = filled ? '' : STAT_TONE_TEXT_CLASS[tone];\n const mutedText = filled ? 'opacity-80' : 'text-base-content/60';\n\n return (\n <div\n onClick={onClick}\n className={`relative flex flex-col overflow-hidden rounded-lg p-3 ${\n filled ? STAT_FILLED_CLASS[tone] : 'border border-base-300/60 bg-base-200'\n } ${onClick ? 'cursor-pointer transition-colors hover:border-primary/40' : ''} ${className}`.trim()}\n >\n {indicator && !filled && (\n <span\n aria-hidden=\"true\"\n className=\"absolute right-0 top-0 h-0 w-0\"\n style={{\n borderTop: '14px solid ' + statCssVarColor(tone),\n borderLeft: '14px solid transparent',\n }}\n />\n )}\n <div\n className={`truncate text-xs font-medium ${mutedText} ${align === 'center' ? 'text-center' : ''}`.trim()}\n >\n {label}\n </div>\n <div\n className={`flex min-h-[3rem] flex-1 items-center py-1 ${align === 'center' ? 'justify-center' : 'justify-start'}`}\n >\n {loading ? (\n <span\n className={`inline-block h-8 w-16 animate-pulse rounded ${\n filled ? 'bg-white/25' : 'bg-base-content/10'\n }`}\n />\n ) : (\n <span className={`leading-none tracking-tight ${STAT_VALUE_SIZE_CLASS[valueSize]} font-semibold ${filled ? '' : textColor}`.trim()}>\n {value}\n {unit !== undefined && unit !== null && unit !== '' && (\n <span className=\"ml-0.5 text-[0.45em] font-semibold\">{unit}</span>\n )}\n </span>\n )}\n </div>\n {sparklineNode && (\n <div className={`-mx-3 -mb-3 mt-1 ${filled ? 'text-white' : STAT_TONE_TEXT_CLASS[tone]}`}>\n {sparklineNode}\n </div>\n )}\n </div>\n );\n};\n\n// 扩展Card组件,添加子组件\ninterface CardCompound extends React.FC<CardProps> {\n Metric: React.FC<CardMetricProps>;\n /** Jira 风格工单卡:状态、类型、负责人、优先级、日期、估算与子任务进度。 */\n Ticket: React.FC<CardTicketProps>;\n Title: React.FC<CardTitleProps>;\n Body: React.FC<CardBodyProps>;\n Actions: React.FC<CardActionsProps>;\n Figure: React.FC<CardFigureProps>;\n /** 特性卡:图标 + 标题 + 描述(垂直居中 / 横向两种布局) */\n Feature: React.FC<CardFeatureProps>;\n /** 引用卡:引用文本 + 作者头像 / 日期 + 装饰引号 */\n Quote: React.FC<CardQuoteProps>;\n /** 元信息卡:标题 + 徽章 + 描述 + 左右页脚 */\n Meta: React.FC<CardMetaProps>;\n /** 指标卡:标签 + 数值 + 可选图标 / hint / 加载态(仪表盘统计卡片) */\n Info: React.FC<CardInfoProps>;\n /** 统计面板:Grafana 风格超大数值 + 迷你折线 / 面积 / 柱状图 / 角标 / 填充色 */\n Stat: React.FC<CardStatProps>;\n /** AI 审批卡片:明确展示待批准操作及可选方案。 */\n Approval: React.FC<ApprovalCardProps>;\n /** AI 推荐卡片:首选建议、置信度与替代方案。 */\n Recommendation: React.FC<RecommendationCardProps>;\n /** AI 上下文卡片集合:检索片段与来源。 */\n Context: React.FC<ContextCardsProps>;\n /** AI 洞察指标卡片集合。 */\n Insights: React.FC<InsightCardsProps>;\n /** AI 微调任务状态卡片。 */\n FineTune: React.FC<FineTuneCardProps>;\n /** Linear 风格的工单卡片:标题、标签、类型图标、编号、优先级点、估点与负责人。 */\n Issue: React.FC<IssueCardProps>;\n /** Agent 运行卡片:头像 + 名称 + 模型、状态徽章、任务、当前动作、进度条、元信息与分支页脚。 */\n Run: React.FC<AgentRunCardProps>;\n}\n\nconst CardWithCompounds = Card as CardCompound;\nCardWithCompounds.Title = CardTitle;\nCardWithCompounds.Body = CardBody;\nCardWithCompounds.Actions = CardActions;\nCardWithCompounds.Figure = CardFigure;\nCardWithCompounds.Feature = CardFeature;\nCardWithCompounds.Quote = CardQuote;\nCardWithCompounds.Meta = CardMeta;\nCardWithCompounds.Info = CardInfo;\nCardWithCompounds.Stat = CardStat;\nCardWithCompounds.Metric = CardMetric;\nCardWithCompounds.Ticket = CardTicket;\nCardWithCompounds.Approval = ApprovalCard;\nCardWithCompounds.Recommendation = RecommendationCard;\nCardWithCompounds.Context = ContextCards;\nCardWithCompounds.Insights = InsightCards;\nCardWithCompounds.FineTune = FineTuneCard;\nCardWithCompounds.Issue = IssueCard;\nCardWithCompounds.Run = AgentRunCard;\n\nexport default CardWithCompounds; "],"mappings":";;;;;;;;;;;;;;AAgDA,IAAMO,KAAQ,EACZ,aACA,YACA,cAAW,IACX,UAAO,IACP,UAAO,IACP,eAAY,IACZ,aAAU,IACV,WAAQ,IACR,WAAQ,IACR,iBACA,UACA,UAAO,MACP,eAAY,SACG;CACf,IAEMC,IAAgBC,KAAS,CAACC,IAAU,sBAAsB,IAG1DC,IAAeD,IAAU,MAAMA,EAAQ,QAAQA,EAAQ,sBAAsB,IAE7EE,IAAgBC,IAAW,kBAAkB,IAC7CC,IAAYC,IAAO,cAAc,IACjCC,IAAYC,IAAO,cAAc,IACjC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,kBAAC,OAAD;IACI,WAAW,8CAA8CN,MAAU,WAAW,mBAAmB;IAEhG,UAAAG,IACG,kBAAC,QAAD,EACI,WAAW,+CACP4B,IAAS,gBAAgB,uBAEhC,CAAA,IAED,kBAAC,QAAD;KAAM,WAAW,+BAA+BpB,EAAsBuB,GAAW,iBAAiBH,IAAS,KAAKD,IAAY,KAAK;KAAjI,UAAA,CACK7D,GACAkE,KAA+B,QAAQA,MAAS,MAC7C,kBAAC,QAAD;MAAM,WAAU;MAAsC,UAAAA;KAAW,CAAA,CAEnE;;GAET,CAAA;GACJV,KACG,kBAAC,OAAD;IAAK,WAAW,oBAAoBM,IAAS,eAAetB,EAAqBR;IAC5E,UAAAwB;GACA,CAAA;EAER;;AAEb,GAqCMW,IAAoBnG;AAC1B,EAAkB,QAAQuB,GAC1B,EAAkB,OAAOE,GACzB,EAAkB,UAAUE,GAC5B,EAAkB,SAASM,GAC3B,EAAkB,UAAUS,GAC5B,EAAkB,QAAQQ,GAC1B,EAAkB,OAAOM,GACzB,EAAkB,OAAOI,GACzB,EAAkB,OAAO2B,GACzB,EAAkB,SAASa,GAC3B,EAAkB,SAASC,GAC3B,EAAkB,WAAW5G,GAC7B,EAAkB,iBAAiBC,GACnC,EAAkB,UAAUC,GAC5B,EAAkB,WAAWC,GAC7B,EAAkB,WAAWC,GAC7B,EAAkB,QAAQC,GAC1B,EAAkB,MAAMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":[],"sources":["../../../src/components/Chart/Chart.tsx"],"sourcesContent":["import React from 'react';\nimport { Chart as TanStackChart } from '@tanstack/react-charts/tooltip';\nimport type { DomChartDefinition } from '@tanstack/charts';\n\nexport interface ChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** TanStack Charts declarative chart definition. */\n definition: DomChartDefinition<any, any, any>;\n\n /** Wrapper height. TanStack Charts fills the available space. */\n height?: number | string;\n /** Additional wrapper class name. */\n className?: string;\n /** Additional wrapper style. */\n style?: React.CSSProperties;\n /** Optional empty state controlled by the caller. */\n empty?: boolean;\n emptyContent?: React.ReactNode;\n}\n\nconst Chart = React.forwardRef<HTMLDivElement, ChartProps>(function Chart({\n height = 360,\n className = '',\n style,\n empty = false,\n emptyContent = 'No chart data',\n definition,\n ...wrapperProps\n}, ref) {\n const numericChartHeight = typeof height === 'number' ? Math.max(1, height - 26) : undefined;\n\n return (\n <div\n ref={ref}\n className={`relative w-full overflow-hidden rounded-xl border border-base-300 bg-base-100 p-3 ${className}`}\n style={{ height, ...style }}\n {...wrapperProps}\n >\n {empty ? (\n <div className=\"flex h-full items-center justify-center p-6 text-sm text-base-content/50\">\n {emptyContent}\n </div>\n ) : (\n <TanStackChart\n definition={definition}\n ariaLabel={wrapperProps['aria-label'] || 'Chart'}\n height={numericChartHeight}\n style={typeof height === 'string' ? { height: '100%' } : undefined}\n />\n )}\n </div>\n );\n});\n\nexport default Chart;\n"],"mappings":";;;;AAmBA,
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["Chart","TanStackChart","React","Chart$1","wrapperProps","numericChartHeight","height","className","style","empty","emptyContent","Chart"],"sources":["../../../src/components/Chart/Chart.tsx"],"sourcesContent":["import React from 'react';\nimport { Chart as TanStackChart } from '@tanstack/react-charts/tooltip';\nimport type { DomChartDefinition } from '@tanstack/charts';\n\nexport interface ChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n /** TanStack Charts declarative chart definition. */\n definition: DomChartDefinition<any, any, any>;\n\n /** Wrapper height. TanStack Charts fills the available space. */\n height?: number | string;\n /** Additional wrapper class name. */\n className?: string;\n /** Additional wrapper style. */\n style?: React.CSSProperties;\n /** Optional empty state controlled by the caller. */\n empty?: boolean;\n emptyContent?: React.ReactNode;\n}\n\nconst Chart = React.forwardRef<HTMLDivElement, ChartProps>(function Chart({\n height = 360,\n className = '',\n style,\n empty = false,\n emptyContent = 'No chart data',\n definition,\n ...wrapperProps\n}, ref) {\n const numericChartHeight = typeof height === 'number' ? Math.max(1, height - 26) : undefined;\n\n return (\n <div\n ref={ref}\n className={`relative w-full overflow-hidden rounded-xl border border-base-300 bg-base-100 p-3 ${className}`}\n style={{ height, ...style }}\n {...wrapperProps}\n >\n {empty ? (\n <div className=\"flex h-full items-center justify-center p-6 text-sm text-base-content/50\">\n {emptyContent}\n </div>\n ) : (\n <TanStackChart\n definition={definition}\n ariaLabel={wrapperProps['aria-label'] || 'Chart'}\n height={numericChartHeight}\n style={typeof height === 'string' ? { height: '100%' } : undefined}\n />\n )}\n </div>\n );\n});\n\nexport default Chart;\n"],"mappings":";;;;AAmBA,IAAMA,IAAQE,EAAM,WAAuC,SAAe,EACxE,YAAS,KACT,eAAY,IACZ,UACA,WAAQ,IACR,kBAAe,iBACf,eACA,GAAGE,KACF,GAAK;CACN,IAAMC,IAAqB,OAAOC,KAAW,WAAW,KAAK,IAAI,GAAGA,IAAS,EAAE,IAAI,KAAA;CAEnF,OACE,kBAAC,OAAD;EACO;EACL,WAAW,qFAAqFC;EAChG,OAAO;GAAE;GAAQ,GAAGC;EAAM;EAC1B,GAAIJ;EAEH,UAAAK,IACC,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAAC;EACE,CAAA,IAEL,kBAACT,GAAD;GACc;GACZ,WAAWG,EAAa,iBAAiB;GACzC,QAAQC;GACR,OAAO,OAAOC,KAAW,WAAW,EAAE,QAAQ,OAAO,IAAI,KAAA;EAC1D,CAAA;CAEA,CAAA;AAET,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { useRef, useEffect, useCallback } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CheckboxProps = {\n /** Controlled checked state. */\n checked?: boolean;\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean;\n /** Change handler; receives the new checked value. */\n onChange?: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;\n /** Optional label rendered next to the box. */\n label?: React.ReactNode;\n /** Label position relative to the box. */\n labelPosition?: 'right' | 'left';\n /** Color variant (daisyUI). */\n variant?: 'default' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';\n /** Size. */\n size?: 'xs' | 'sm' | 'md' | 'lg';\n /** Disabled state. */\n disabled?: boolean;\n /** Indeterminate (partial) state; overrides the visual check mark. */\n indeterminate?: boolean;\n /** Native name attribute (useful in forms). */\n name?: string;\n /** Native value attribute. */\n value?: string;\n /** Extra class names applied to the wrapping label element. */\n className?: string;\n /** Inline styles applied to the wrapping label element. */\n style?: React.CSSProperties;\n /** id forwarded to the input. */\n id?: string;\n};\n\nconst VARIANT_CLASS: Record<NonNullable<CheckboxProps['variant']>, string> = {\n default: '',\n primary: 'checkbox-primary',\n secondary: 'checkbox-secondary',\n accent: 'checkbox-accent',\n info: 'checkbox-info',\n success: 'checkbox-success',\n warning: 'checkbox-warning',\n error: 'checkbox-error',\n};\n\nconst SIZE_CLASS: Record<NonNullable<CheckboxProps['size']>, string> = {\n xs: 'checkbox-xs',\n sm: 'checkbox-sm',\n md: 'checkbox-md',\n lg: 'checkbox-lg',\n};\n\nconst Checkbox: React.FC<CheckboxProps> = ({\n checked,\n defaultChecked,\n onChange,\n label,\n labelPosition = 'right',\n variant = 'default',\n size = 'sm',\n disabled = false,\n indeterminate = false,\n name,\n value,\n className = '',\n style,\n id,\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\n\n // The `indeterminate` visual state can only be set imperatively on the DOM node.\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked, e);\n },\n [onChange],\n );\n\n const inputClasses = cn(\n 'checkbox',\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n // If there is no label, allow className to style the input directly.\n className && !label ? className : '',\n );\n\n const input = (\n <input\n ref={inputRef}\n id={id}\n type=\"checkbox\"\n className={inputClasses}\n checked={checked}\n defaultChecked={defaultChecked}\n onChange={handleChange}\n disabled={disabled}\n name={name}\n value={value}\n aria-checked={indeterminate ? 'mixed' : undefined}\n />\n );\n\n // No label → return the bare input.\n if (label === undefined || label === null || label === '') {\n return input;\n }\n\n const labelClasses = cn(\n 'label cursor-pointer inline-flex items-center gap-2 w-fit',\n disabled && 'opacity-50 cursor-not-allowed',\n className,\n );\n\n return (\n <label className={labelClasses} style={style}>\n {labelPosition === 'left' && <span className=\"label-text\">{label}</span>}\n {input}\n {labelPosition === 'right' && <span className=\"label-text\">{label}</span>}\n </label>\n );\n};\n\nexport default Checkbox;\n"],"mappings":";;;;AAkCA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["VARIANT_CLASS","SIZE_CLASS","Checkbox","inputRef","useRef","indeterminate","handleChange","useCallback","onChange","inputClasses","cn","variant","size","className","label","input","labelClasses","disabled","labelPosition"],"sources":["../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, { useRef, useEffect, useCallback } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type CheckboxProps = {\n /** Controlled checked state. */\n checked?: boolean;\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean;\n /** Change handler; receives the new checked value. */\n onChange?: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;\n /** Optional label rendered next to the box. */\n label?: React.ReactNode;\n /** Label position relative to the box. */\n labelPosition?: 'right' | 'left';\n /** Color variant (daisyUI). */\n variant?: 'default' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';\n /** Size. */\n size?: 'xs' | 'sm' | 'md' | 'lg';\n /** Disabled state. */\n disabled?: boolean;\n /** Indeterminate (partial) state; overrides the visual check mark. */\n indeterminate?: boolean;\n /** Native name attribute (useful in forms). */\n name?: string;\n /** Native value attribute. */\n value?: string;\n /** Extra class names applied to the wrapping label element. */\n className?: string;\n /** Inline styles applied to the wrapping label element. */\n style?: React.CSSProperties;\n /** id forwarded to the input. */\n id?: string;\n};\n\nconst VARIANT_CLASS: Record<NonNullable<CheckboxProps['variant']>, string> = {\n default: '',\n primary: 'checkbox-primary',\n secondary: 'checkbox-secondary',\n accent: 'checkbox-accent',\n info: 'checkbox-info',\n success: 'checkbox-success',\n warning: 'checkbox-warning',\n error: 'checkbox-error',\n};\n\nconst SIZE_CLASS: Record<NonNullable<CheckboxProps['size']>, string> = {\n xs: 'checkbox-xs',\n sm: 'checkbox-sm',\n md: 'checkbox-md',\n lg: 'checkbox-lg',\n};\n\nconst Checkbox: React.FC<CheckboxProps> = ({\n checked,\n defaultChecked,\n onChange,\n label,\n labelPosition = 'right',\n variant = 'default',\n size = 'sm',\n disabled = false,\n indeterminate = false,\n name,\n value,\n className = '',\n style,\n id,\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\n\n // The `indeterminate` visual state can only be set imperatively on the DOM node.\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.checked, e);\n },\n [onChange],\n );\n\n const inputClasses = cn(\n 'checkbox',\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n // If there is no label, allow className to style the input directly.\n className && !label ? className : '',\n );\n\n const input = (\n <input\n ref={inputRef}\n id={id}\n type=\"checkbox\"\n className={inputClasses}\n checked={checked}\n defaultChecked={defaultChecked}\n onChange={handleChange}\n disabled={disabled}\n name={name}\n value={value}\n aria-checked={indeterminate ? 'mixed' : undefined}\n />\n );\n\n // No label → return the bare input.\n if (label === undefined || label === null || label === '') {\n return input;\n }\n\n const labelClasses = cn(\n 'label cursor-pointer inline-flex items-center gap-2 w-fit',\n disabled && 'opacity-50 cursor-not-allowed',\n className,\n );\n\n return (\n <label className={labelClasses} style={style}>\n {labelPosition === 'left' && <span className=\"label-text\">{label}</span>}\n {input}\n {labelPosition === 'right' && <span className=\"label-text\">{label}</span>}\n </label>\n );\n};\n\nexport default Checkbox;\n"],"mappings":";;;;AAkCA,IAAMA,IAAuE;CAC3E,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEMC,IAAiE;CACrE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAEMC,KAAqC,EACzC,YACA,mBACA,aACA,UACA,mBAAgB,SAChB,aAAU,WACV,UAAO,MACP,cAAW,IACX,mBAAgB,IAChB,SACA,UACA,eAAY,IACZ,UACA,YACI;CACJ,IAAMC,IAAWC,EAAyB,IAAI;CAG9C,QAAgB;EACd,AAAID,EAAS,YACX,EAAS,QAAQ,gBAAgBE;CAErC,GAAG,CAACA,CAAa,CAAC;CAElB,IAAMC,IAAeC,GAClB,MAA2C;EAC1C,IAAW,EAAE,OAAO,SAAS,CAAC;CAChC,GACA,CAACC,CAAQ,CACX,GAEMC,IAAeC,EACnB,YACAV,EAAcW,IACdV,EAAWW,IAEXC,KAAa,CAACC,IAAQD,IAAY,EACpC,GAEME,IACJ,kBAAC,SAAD;EACE,KAAKZ;EACD;EACJ,MAAK;EACL,WAAWM;EACF;EACO;EAChB,UAAUH;EACA;EACJ;EACC;EACP,gBAAcD,IAAgB,UAAU,KAAA;CACzC,CAAA;CAIH,IAAIS,KAAiC,QAAQA,MAAU,IACrD,OAAOC;CAGT,IAAMC,IAAeN,EACnB,6DACAO,KAAY,iCACZJ,CACF;CAEA,OACE,kBAAC,SAAD;EAAO,WAAWG;EAAqB;EAAvC,UAAA;GACGE,MAAkB,UAAU,kBAAC,QAAD;IAAM,WAAU;IAAc,UAAAJ;GAAY,CAAA;GACtEC;GACAG,MAAkB,WAAW,kBAAC,QAAD;IAAM,WAAU;IAAc,UAAAJ;GAAY,CAAA;EACnE;;AAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ChoicePicker/index.tsx"],"sourcesContent":["import React, { useCallback, useId, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ChoicePickerOption = {\n /** Value submitted for this option. */\n value: string | number;\n /** Display label. */\n label: React.ReactNode;\n /** Disable this option only. */\n disabled?: boolean;\n};\n\nexport type ChoicePickerVariant =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'info'\n | 'success'\n | 'warning'\n | 'error';\n\nexport type ChoicePickerProps = {\n /** Available options. */\n options: ChoicePickerOption[];\n /** Controlled selected value. */\n value?: string | number;\n /** Uncontrolled initial value. */\n defaultValue?: string | number;\n /** Change handler with the selected value. */\n onChange?: (value: string | number) => void;\n /** `list` renders radio rows; `chip` renders a button group. */\n appearance?: 'list' | 'chip';\n /** Layout of list rows or chip wrapping. */\n orientation?: 'vertical' | 'horizontal';\n /** Color variant. */\n variant?: ChoicePickerVariant;\n /** Size (daisyUI). */\n size?: 'xs' | 'sm' | 'md' | 'lg';\n /** Disable the whole group. */\n disabled?: boolean;\n /** Optional group label rendered above the options. */\n label?: React.ReactNode;\n /** Native name attribute for the radios. */\n name?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n /** Inline styles on the wrapper. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CHIP_ACTIVE: Record<Exclude<ChoicePickerVariant, 'default'>, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n accent: 'btn-accent',\n info: 'btn-info',\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n};\n\nconst VARIANT_RADIO: Record<Exclude<ChoicePickerVariant, 'default'>, string> = {\n primary: 'radio-primary',\n secondary: 'radio-secondary',\n accent: 'radio-accent',\n info: 'radio-info',\n success: 'radio-success',\n warning: 'radio-warning',\n error: 'radio-error',\n};\n\nconst SIZE_CHIP: Record<ChoicePickerProps['size'] & string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nconst SIZE_RADIO: Record<ChoicePickerProps['size'] & string, string> = {\n xs: 'radio-xs',\n sm: 'radio-sm',\n md: 'radio-md',\n lg: 'radio-lg',\n};\n\n/**\n * ChoicePicker —— A2UI 交互组件(v0.9):单选项组。\n * `list` 外观为 radio 行(daisyUI radio),`chip` 外观为按钮组(daisyUI btn)。\n */\nconst ChoicePicker: React.FC<ChoicePickerProps> = ({\n options,\n value,\n defaultValue,\n onChange,\n appearance = 'list',\n orientation = 'vertical',\n variant = 'primary',\n size = 'sm',\n disabled = false,\n label,\n name,\n className = '',\n style,\n}) => {\n const [internal, setInternal] = useState<string | number | undefined>(defaultValue);\n const isControlled = value !== undefined;\n const selected = isControlled ? value : internal;\n\n const select = useCallback(\n (optionValue: string | number) => {\n if (!isControlled) setInternal(optionValue);\n onChange?.(optionValue);\n },\n [isControlled, onChange],\n );\n\n const generatedName = useId();\n const groupName = name ?? `choicepicker-${generatedName}`;\n const labelId = `${generatedName}-label`;\n\n const layoutClass =\n orientation === 'horizontal' ? 'flex flex-wrap items-center' : 'flex flex-col';\n\n return (\n <div className={cn('w-full', className)} style={style} role={appearance === 'chip' ? 'group' : 'radiogroup'} aria-labelledby={label !== undefined && label !== null ? labelId : undefined}>\n {label !== undefined && (\n <div id={labelId} className=\"mb-1.5 text-sm font-medium text-base-content/80\">{label}</div>\n )}\n\n {appearance === 'chip' ? (\n <div className={cn(layoutClass, 'gap-2')}>\n {options.map((option) => {\n const active = selected === option.value;\n return (\n <button\n key={String(option.value)}\n type=\"button\"\n disabled={disabled || option.disabled}\n aria-pressed={active}\n onClick={() => select(option.value)}\n className={cn(\n 'btn',\n SIZE_CHIP[size],\n active\n ? variant === 'default'\n ? 'btn-neutral'\n : VARIANT_CHIP_ACTIVE[variant]\n : 'btn-outline',\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n ) : (\n <div className={cn(layoutClass, 'gap-2.5')}>\n {options.map((option) => {\n const active = selected === option.value;\n return (\n <label\n key={String(option.value)}\n className={cn(\n 'flex w-full cursor-pointer items-center gap-2.5',\n (disabled || option.disabled) && 'cursor-not-allowed opacity-50',\n )}\n >\n <input\n type=\"radio\"\n className={cn(\n 'radio',\n variant !== 'default' && VARIANT_RADIO[variant],\n SIZE_RADIO[size],\n )}\n name={groupName}\n value={String(option.value)}\n checked={active}\n disabled={disabled || option.disabled}\n onChange={() => select(option.value)}\n />\n <span className=\"text-sm text-base-content\">{option.label}</span>\n </label>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ChoicePicker;\n"],"mappings":";;;;AAmDA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["VARIANT_CHIP_ACTIVE","VARIANT_RADIO","SIZE_CHIP","SIZE_RADIO","ChoicePicker","internal","setInternal","useState","defaultValue","isControlled","value","selected","select","useCallback","optionValue","onChange","generatedName","useId","groupName","name","labelId","layoutClass","orientation","cn","className","appearance","label","options","active","option","disabled","size","variant"],"sources":["../../../src/components/ChoicePicker/index.tsx"],"sourcesContent":["import React, { useCallback, useId, useState } from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type ChoicePickerOption = {\n /** Value submitted for this option. */\n value: string | number;\n /** Display label. */\n label: React.ReactNode;\n /** Disable this option only. */\n disabled?: boolean;\n};\n\nexport type ChoicePickerVariant =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'info'\n | 'success'\n | 'warning'\n | 'error';\n\nexport type ChoicePickerProps = {\n /** Available options. */\n options: ChoicePickerOption[];\n /** Controlled selected value. */\n value?: string | number;\n /** Uncontrolled initial value. */\n defaultValue?: string | number;\n /** Change handler with the selected value. */\n onChange?: (value: string | number) => void;\n /** `list` renders radio rows; `chip` renders a button group. */\n appearance?: 'list' | 'chip';\n /** Layout of list rows or chip wrapping. */\n orientation?: 'vertical' | 'horizontal';\n /** Color variant. */\n variant?: ChoicePickerVariant;\n /** Size (daisyUI). */\n size?: 'xs' | 'sm' | 'md' | 'lg';\n /** Disable the whole group. */\n disabled?: boolean;\n /** Optional group label rendered above the options. */\n label?: React.ReactNode;\n /** Native name attribute for the radios. */\n name?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n /** Inline styles on the wrapper. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CHIP_ACTIVE: Record<Exclude<ChoicePickerVariant, 'default'>, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n accent: 'btn-accent',\n info: 'btn-info',\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n};\n\nconst VARIANT_RADIO: Record<Exclude<ChoicePickerVariant, 'default'>, string> = {\n primary: 'radio-primary',\n secondary: 'radio-secondary',\n accent: 'radio-accent',\n info: 'radio-info',\n success: 'radio-success',\n warning: 'radio-warning',\n error: 'radio-error',\n};\n\nconst SIZE_CHIP: Record<ChoicePickerProps['size'] & string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nconst SIZE_RADIO: Record<ChoicePickerProps['size'] & string, string> = {\n xs: 'radio-xs',\n sm: 'radio-sm',\n md: 'radio-md',\n lg: 'radio-lg',\n};\n\n/**\n * ChoicePicker —— A2UI 交互组件(v0.9):单选项组。\n * `list` 外观为 radio 行(daisyUI radio),`chip` 外观为按钮组(daisyUI btn)。\n */\nconst ChoicePicker: React.FC<ChoicePickerProps> = ({\n options,\n value,\n defaultValue,\n onChange,\n appearance = 'list',\n orientation = 'vertical',\n variant = 'primary',\n size = 'sm',\n disabled = false,\n label,\n name,\n className = '',\n style,\n}) => {\n const [internal, setInternal] = useState<string | number | undefined>(defaultValue);\n const isControlled = value !== undefined;\n const selected = isControlled ? value : internal;\n\n const select = useCallback(\n (optionValue: string | number) => {\n if (!isControlled) setInternal(optionValue);\n onChange?.(optionValue);\n },\n [isControlled, onChange],\n );\n\n const generatedName = useId();\n const groupName = name ?? `choicepicker-${generatedName}`;\n const labelId = `${generatedName}-label`;\n\n const layoutClass =\n orientation === 'horizontal' ? 'flex flex-wrap items-center' : 'flex flex-col';\n\n return (\n <div className={cn('w-full', className)} style={style} role={appearance === 'chip' ? 'group' : 'radiogroup'} aria-labelledby={label !== undefined && label !== null ? labelId : undefined}>\n {label !== undefined && (\n <div id={labelId} className=\"mb-1.5 text-sm font-medium text-base-content/80\">{label}</div>\n )}\n\n {appearance === 'chip' ? (\n <div className={cn(layoutClass, 'gap-2')}>\n {options.map((option) => {\n const active = selected === option.value;\n return (\n <button\n key={String(option.value)}\n type=\"button\"\n disabled={disabled || option.disabled}\n aria-pressed={active}\n onClick={() => select(option.value)}\n className={cn(\n 'btn',\n SIZE_CHIP[size],\n active\n ? variant === 'default'\n ? 'btn-neutral'\n : VARIANT_CHIP_ACTIVE[variant]\n : 'btn-outline',\n )}\n >\n {option.label}\n </button>\n );\n })}\n </div>\n ) : (\n <div className={cn(layoutClass, 'gap-2.5')}>\n {options.map((option) => {\n const active = selected === option.value;\n return (\n <label\n key={String(option.value)}\n className={cn(\n 'flex w-full cursor-pointer items-center gap-2.5',\n (disabled || option.disabled) && 'cursor-not-allowed opacity-50',\n )}\n >\n <input\n type=\"radio\"\n className={cn(\n 'radio',\n variant !== 'default' && VARIANT_RADIO[variant],\n SIZE_RADIO[size],\n )}\n name={groupName}\n value={String(option.value)}\n checked={active}\n disabled={disabled || option.disabled}\n onChange={() => select(option.value)}\n />\n <span className=\"text-sm text-base-content\">{option.label}</span>\n </label>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n\nexport default ChoicePicker;\n"],"mappings":";;;;AAmDA,IAAMA,IAA+E;CACnF,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEMC,IAAyE;CAC7E,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEMC,IAAgE;CACpE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAEMC,IAAiE;CACrE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAMMC,KAA6C,EACj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AD;KAEE,WAAWN,EACT,oDACCO,KAAYD,EAAO,aAAa,+BACnC;KALF,UAAA,CAOE,kBAAC,SAAD;MACE,MAAK;MACL,WAAWN,EACT,SACAS,MAAY,aAAa/B,EAAc+B,IACvC7B,EAAW4B,EACb;MACA,MAAMb;MACN,OAAO,OAAOW,EAAO,KAAK;MAC1B,SAASD;MACT,UAAUE,KAAYD,EAAO;MAC7B,gBAAgBjB,EAAOiB,EAAO,KAAK;KACpC,CAAA,GACD,kBAAC,QAAD;MAAM,WAAU;MAA6B,UAAAA,EAAO;KAAY,CAAA,CAC3D;IApBA,GAAA,OAAOA,EAAO,KAAK,CAoBnB;GAEX,CAAC;EACE,CAAA,CAEJ;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Column/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\nimport { FLEX_ALIGN_CLASS, FLEX_JUSTIFY_CLASS, flexGap, type FlexAlign, type FlexJustify } from '../../utils/flexLayout';\n\nexport type ColumnAlign = FlexAlign;\nexport type ColumnJustify = FlexJustify;\n\nexport type ColumnProps = {\n children?: React.ReactNode;\n /** Gap between children; number is treated as px. */\n gap?: number | string;\n /** Cross-axis alignment. */\n align?: ColumnAlign;\n /** Main-axis (vertical) distribution. */\n justify?: ColumnJustify;\n /** Allow children to wrap (rarely used in a column). */\n wrap?: boolean;\n /** Reverse the visual order of children. */\n reverse?: boolean;\n /** Extra class names on the container. */\n className?: string;\n /** Inline styles on the container. */\n style?: React.CSSProperties;\n /** Click handler on the container. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\n\n/**\n * Column —— A2UI 布局组件:垂直排列子元素。\n * 等价于 `display: flex; flex-direction: column` 的语义化封装。\n */\nconst Column: React.FC<ColumnProps> = ({\n children,\n gap,\n align = 'stretch',\n justify = 'start',\n wrap = false,\n reverse = false,\n className = '',\n style,\n onClick,\n}) => (\n <div\n className={cn(\n 'flex',\n reverse ? 'flex-col-reverse' : 'flex-col',\n FLEX_ALIGN_CLASS[align],\n FLEX_JUSTIFY_CLASS[justify],\n wrap && 'flex-wrap',\n className,\n )}\n style={{ gap: flexGap(gap), ...style }}\n onClick={onClick}\n >\n {children}\n </div>\n);\n\nexport default Column;\n"],"mappings":";;;;;AAgCA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["Column","cn","reverse","FLEX_ALIGN_CLASS","align","FLEX_JUSTIFY_CLASS","justify","wrap","className","flexGap","gap","style"],"sources":["../../../src/components/Column/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\nimport { FLEX_ALIGN_CLASS, FLEX_JUSTIFY_CLASS, flexGap, type FlexAlign, type FlexJustify } from '../../utils/flexLayout';\n\nexport type ColumnAlign = FlexAlign;\nexport type ColumnJustify = FlexJustify;\n\nexport type ColumnProps = {\n children?: React.ReactNode;\n /** Gap between children; number is treated as px. */\n gap?: number | string;\n /** Cross-axis alignment. */\n align?: ColumnAlign;\n /** Main-axis (vertical) distribution. */\n justify?: ColumnJustify;\n /** Allow children to wrap (rarely used in a column). */\n wrap?: boolean;\n /** Reverse the visual order of children. */\n reverse?: boolean;\n /** Extra class names on the container. */\n className?: string;\n /** Inline styles on the container. */\n style?: React.CSSProperties;\n /** Click handler on the container. */\n onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;\n};\n\n\n/**\n * Column —— A2UI 布局组件:垂直排列子元素。\n * 等价于 `display: flex; flex-direction: column` 的语义化封装。\n */\nconst Column: React.FC<ColumnProps> = ({\n children,\n gap,\n align = 'stretch',\n justify = 'start',\n wrap = false,\n reverse = false,\n className = '',\n style,\n onClick,\n}) => (\n <div\n className={cn(\n 'flex',\n reverse ? 'flex-col-reverse' : 'flex-col',\n FLEX_ALIGN_CLASS[align],\n FLEX_JUSTIFY_CLASS[justify],\n wrap && 'flex-wrap',\n className,\n )}\n style={{ gap: flexGap(gap), ...style }}\n onClick={onClick}\n >\n {children}\n </div>\n);\n\nexport default Column;\n"],"mappings":";;;;;AAgCA,IAAMA,KAAiC,EACrC,aACA,QACA,WAAQ,WACR,aAAU,SACV,UAAO,IACP,aAAU,IACV,eAAY,IACZ,UACA,iBAEA,kBAAC,OAAD;CACE,WAAWC,EACT,QACAC,IAAU,qBAAqB,YAC/BC,EAAiBC,IACjBC,EAAmBC,IACnBC,KAAQ,aACRC,CACF;CACA,OAAO;EAAE,KAAKC,EAAQC,CAAG;EAAG,GAAGC;CAAM;CAC5B;CAER;AACE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ConfirmDialog/index.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport Button from '../Button';\nimport Modal from '../Modal';\n\nexport type ConfirmDialogProps = {\n open: boolean;\n onClose: () => void;\n /** Called once per confirmation. Reject to keep the dialog open and show an error. */\n onConfirm: () => void | Promise<void>;\n title: string;\n /** Name of the object affected by the action. */\n objectName: string;\n /** Explain the effect of confirming (including irreversible consequences). */\n consequence: string;\n /** Require the exact object name before enabling confirmation for highest-risk actions. */\n requireName?: boolean;\n confirmLabel?: string;\n cancelLabel?: string;\n pendingLabel?: string;\n failureMessage?: string;\n namePrompt?: string;\n};\n\nexport default function ConfirmDialog(props: ConfirmDialogProps) {\n return props.open ? <ConfirmDialogContent {...props} /> : null;\n}\n\nfunction ConfirmDialogContent({\n onClose,\n onConfirm,\n title,\n objectName,\n consequence,\n requireName = false,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n pendingLabel = 'Working…',\n failureMessage = 'The action failed. Try again or cancel.',\n namePrompt = 'Type the object name to confirm',\n}: ConfirmDialogProps) {\n const [pending, setPending] = useState(false);\n const [error, setError] = useState(false);\n const [enteredName, setEnteredName] = useState('');\n const submitting = useRef(false);\n const mounted = useRef(true);\n const nameId = useId();\n\n useEffect(() => {\n mounted.current = true;\n return () => { mounted.current = false; };\n }, []);\n\n const dismiss = () => {\n if (!submitting.current) onClose();\n };\n const confirm = async () => {\n if (submitting.current || (requireName && enteredName !== objectName)) return;\n submitting.current = true;\n\n setError(false);\n setPending(true);\n try {\n await onConfirm();\n if (mounted.current) onClose();\n } catch {\n if (mounted.current) setError(true);\n } finally {\n if (mounted.current) {\n submitting.current = false;\n setPending(false);\n }\n }\n };\n\n return (\n <Modal\n open\n onClose={dismiss}\n title={title}\n description={<>Object: <strong>{objectName}</strong>. {consequence}</>}\n size=\"sm\"\n showClose={false}\n closeOnOverlay={false}\n footer={<>\n <Button type=\"button\" variant=\"neutral\" autoFocus disabled={pending} onClick={dismiss}>{cancelLabel}</Button>\n <Button type=\"button\" variant=\"destructive\" disabled={pending || (requireName && enteredName !== objectName)} onClick={confirm}>\n {pending ? pendingLabel : confirmLabel}\n </Button>\n </>}\n >\n {requireName && (\n <div className=\"flex flex-col gap-2\">\n <label htmlFor={nameId} className=\"text-body-sm font-medium\">{namePrompt}: {objectName}</label>\n <input id={nameId} type=\"text\" value={enteredName} disabled={pending} onChange={event => setEnteredName(event.target.value)}\n className=\"input input-bordered w-full\" autoComplete=\"off\" />\n </div>\n )}\n {error && <p role=\"alert\" className=\"mt-3 text-body-sm text-error\">{failureMessage}</p>}\n </Modal>\n );\n}\n"],"mappings":";;;;;AAuBA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","Button","ButtonWithCompounds","Modal","ConfirmDialog","props","ConfirmDialogContent","pending","setPending","useState","error","setError","enteredName","setEnteredName","submitting","useRef","mounted","nameId","useId","dismiss","onClose","Fragment","objectName","consequence","cancelLabel","requireName","onConfirm","pendingLabel","confirmLabel","namePrompt","event","failureMessage"],"sources":["../../../src/components/ConfirmDialog/index.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport Button from '../Button';\nimport Modal from '../Modal';\n\nexport type ConfirmDialogProps = {\n open: boolean;\n onClose: () => void;\n /** Called once per confirmation. Reject to keep the dialog open and show an error. */\n onConfirm: () => void | Promise<void>;\n title: string;\n /** Name of the object affected by the action. */\n objectName: string;\n /** Explain the effect of confirming (including irreversible consequences). */\n consequence: string;\n /** Require the exact object name before enabling confirmation for highest-risk actions. */\n requireName?: boolean;\n confirmLabel?: string;\n cancelLabel?: string;\n pendingLabel?: string;\n failureMessage?: string;\n namePrompt?: string;\n};\n\nexport default function ConfirmDialog(props: ConfirmDialogProps) {\n return props.open ? <ConfirmDialogContent {...props} /> : null;\n}\n\nfunction ConfirmDialogContent({\n onClose,\n onConfirm,\n title,\n objectName,\n consequence,\n requireName = false,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n pendingLabel = 'Working…',\n failureMessage = 'The action failed. Try again or cancel.',\n namePrompt = 'Type the object name to confirm',\n}: ConfirmDialogProps) {\n const [pending, setPending] = useState(false);\n const [error, setError] = useState(false);\n const [enteredName, setEnteredName] = useState('');\n const submitting = useRef(false);\n const mounted = useRef(true);\n const nameId = useId();\n\n useEffect(() => {\n mounted.current = true;\n return () => { mounted.current = false; };\n }, []);\n\n const dismiss = () => {\n if (!submitting.current) onClose();\n };\n const confirm = async () => {\n if (submitting.current || (requireName && enteredName !== objectName)) return;\n submitting.current = true;\n\n setError(false);\n setPending(true);\n try {\n await onConfirm();\n if (mounted.current) onClose();\n } catch {\n if (mounted.current) setError(true);\n } finally {\n if (mounted.current) {\n submitting.current = false;\n setPending(false);\n }\n }\n };\n\n return (\n <Modal\n open\n onClose={dismiss}\n title={title}\n description={<>Object: <strong>{objectName}</strong>. {consequence}</>}\n size=\"sm\"\n showClose={false}\n closeOnOverlay={false}\n footer={<>\n <Button type=\"button\" variant=\"neutral\" autoFocus disabled={pending} onClick={dismiss}>{cancelLabel}</Button>\n <Button type=\"button\" variant=\"destructive\" disabled={pending || (requireName && enteredName !== objectName)} onClick={confirm}>\n {pending ? pendingLabel : confirmLabel}\n </Button>\n </>}\n >\n {requireName && (\n <div className=\"flex flex-col gap-2\">\n <label htmlFor={nameId} className=\"text-body-sm font-medium\">{namePrompt}: {objectName}</label>\n <input id={nameId} type=\"text\" value={enteredName} disabled={pending} onChange={event => setEnteredName(event.target.value)}\n className=\"input input-bordered w-full\" autoComplete=\"off\" />\n </div>\n )}\n {error && <p role=\"alert\" className=\"mt-3 text-body-sm text-error\">{failureMessage}</p>}\n </Modal>\n );\n}\n"],"mappings":";;;;;AAuBA,SAAwBI,EAAc,GAA2B;CAC7D,OAAOC,EAAM,OAAO,kBAACC,GAAD,EAAsB,GAAID,EAAQ,CAAA,IAAI;AAC9D;AAEA,SAASC,EAAqB,EAC1B,YACA,cACA,UACA,eACA,gBACA,iBAAc,IACd,kBAAe,WACf,iBAAc,UACd,kBAAe,YACf,oBAAiB,2CACjB,gBAAa,qCACM;CACnB,IAAM,CAACC,GAASC,KAAcC,EAAS,EAAK,GACtC,CAACC,GAAOC,KAAYF,EAAS,EAAK,GAClC,CAACG,GAAaC,KAAkBJ,EAAS,EAAE,GAC3CK,IAAaC,EAAO,EAAK,GACzBC,IAAUD,EAAO,EAAI,GACrBE,IAASC,EAAM;CAErB,SACI,EAAQ,UAAU,UACL;EAAE,EAAQ,UAAU;CAAO,IACzC,CAAC,CAAC;CAEL,IAAMC,UAAgB;EAClB,AAAKL,EAAW,WAASM,EAAQ;CACrC;CAoBA,OACI,kBAACjB,GAAD;EACI,MAAA;EACA,SAASgB;EACF;EACP,aAAa,kBAAAnB,GAAA,EAAA,UAAA;GAAE;GAAQ,kBAAC,UAAD,EAAA,UAASsB,EAAmB,CAAA;GAAC;GAAGC;EAAc,EAAA,CAAA;EACrE,MAAK;EACL,WAAW;EACX,gBAAgB;EAChB,QAAQ,kBAAAvB,GAAA,EAAA,UAAA,CACJ,kBAACC,GAAD;GAAQ,MAAK;GAAS,SAAQ;GAAU,WAAA;GAAU,UAAUM;GAAS,SAASY;GAAU,UAAAK;EAAoB,CAAA,GAC5G,kBAACvB,GAAD;GAAQ,MAAK;GAAS,SAAQ;GAAc,UAAUM,KAAYkB,KAAeb,MAAgBU;GAAa,SAAS,YA9BvG;IACxB,IAAI,IAAW,WAAYG,KAAeb,MAAgBU,IAI1D;KAHA,EAAW,UAAU,IAErBX,EAAS,EAAK,GACdH,EAAW,EAAI;KACf,IAAI;MAEA,AADA,MAAMkB,EAAU,GACZV,EAAQ,WAASI,EAAQ;KACjC,QAAQ;MACJ,AAAIJ,EAAQ,WAASL,EAAS,EAAI;KACtC,UAAU;MACN,AAAIK,EAAQ,YACR,EAAW,UAAU,IACrBR,EAAW,EAAK;KAExB;IAXe;GAYnB;GAciB,UAAAD,IAAUoB,IAAeC;EACtB,CAAA,CACV,EAAA,CAAA;EAbN,UAAA,CAeKH,KACG,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACI,kBAAC,SAAD;IAAO,SAASR;IAAQ,WAAU;IAAlC,UAAA;KAA8DY;KAAW;KAAGP;IAAkB;GAC9F,CAAA,GAAA,kBAAC,SAAD;IAAO,IAAIL;IAAQ,MAAK;IAAO,OAAOL;IAAa,UAAUL;IAAS,WAAU,MAASM,EAAeiB,EAAM,OAAO,KAAK;IACtH,WAAU;IAA8B,cAAa;GAAO,CAAA,CAC/D;EAER,CAAA,GAAApB,KAAS,kBAAC,KAAD;GAAG,MAAK;GAAQ,WAAU;GAAgC,UAAAqB;EAAkB,CAAA,CACnF;;AAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/DateTimeInput/index.tsx"],"sourcesContent":["import React, { useCallback, useId } from 'react';\nimport { cn } from '../../utils/cn';\nimport './DateTimeInput.css';\n\nexport type DateTimeType = 'date' | 'time' | 'datetime-local' | 'month' | 'week';\n\nexport type DateTimeVariant =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'info'\n | 'success'\n | 'warning'\n | 'error';\n\nexport type DateTimeSize = 'xs' | 'sm' | 'md' | 'lg';\n\nexport type DateTimeInputProps = {\n /** Which native picker to render. */\n type?: DateTimeType;\n /** Controlled value (`YYYY-MM-DD`, `HH:mm`, … per `type`). */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n /** Change handler with the raw input value. */\n onChange?: (value: string, e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Minimum allowed value. */\n min?: string;\n /** Maximum allowed value. */\n max?: string;\n /** Step (seconds for time / datetime-local, days for date, …). */\n step?: number | string;\n /** Optional label rendered above the field. */\n label?: React.ReactNode;\n /** Placeholder (only shown by browsers that support it). */\n placeholder?: string;\n /** Color variant (daisyUI). */\n variant?: DateTimeVariant;\n /** Size (daisyUI). */\n size?: DateTimeSize;\n /** Disabled state. */\n disabled?: boolean;\n /** Read-only state. */\n readOnly?: boolean;\n /** Native name attribute. */\n name?: string;\n /** Extra class names on the input. */\n className?: string;\n /** Inline styles on the wrapper. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CLASS: Record<DateTimeVariant, string> = {\n default: '',\n primary: 'input-primary',\n secondary: 'input-secondary',\n accent: 'input-accent',\n info: 'input-info',\n success: 'input-success',\n warning: 'input-warning',\n error: 'input-error',\n};\n\nconst SIZE_CLASS: Record<DateTimeSize, string> = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n};\n\n/**\n * DateTimeInput —— A2UI 交互组件:日期 / 时间选择输入。\n * 基于原生 `date / time / datetime-local / month / week` 输入,套用 daisyUI input 样式。\n */\nconst DateTimeInput: React.FC<DateTimeInputProps> = ({\n type = 'date',\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n label,\n placeholder,\n variant = 'default',\n size = 'sm',\n disabled = false,\n readOnly = false,\n name,\n className = '',\n style,\n}) => {\n const inputId = useId();\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.value, e);\n },\n [onChange],\n );\n\n const input = (\n <input\n id={inputId}\n type={type}\n className={cn('input dishui-datetime-input w-full', VARIANT_CLASS[variant], SIZE_CLASS[size], className)}\n value={value}\n defaultValue={value !== undefined ? undefined : defaultValue}\n min={min}\n max={max}\n step={step}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n name={name}\n onChange={handleChange}\n />\n );\n\n if (label === undefined || label === null || label === '') {\n return input;\n }\n\n return (\n <div className=\"dishui-datetime-field w-full\" style={style}>\n <label htmlFor={inputId} className=\"label-text mb-1 block text-sm text-base-content/80\">\n {label}\n </label>\n {input}\n </div>\n );\n};\n\nexport default DateTimeInput;\n"],"mappings":";;;;;AAqDA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["VARIANT_CLASS","SIZE_CLASS","DateTimeInput","inputId","useId","handleChange","useCallback","onChange","input","cn","variant","size","className","value","defaultValue","label"],"sources":["../../../src/components/DateTimeInput/index.tsx"],"sourcesContent":["import React, { useCallback, useId } from 'react';\nimport { cn } from '../../utils/cn';\nimport './DateTimeInput.css';\n\nexport type DateTimeType = 'date' | 'time' | 'datetime-local' | 'month' | 'week';\n\nexport type DateTimeVariant =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'info'\n | 'success'\n | 'warning'\n | 'error';\n\nexport type DateTimeSize = 'xs' | 'sm' | 'md' | 'lg';\n\nexport type DateTimeInputProps = {\n /** Which native picker to render. */\n type?: DateTimeType;\n /** Controlled value (`YYYY-MM-DD`, `HH:mm`, … per `type`). */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n /** Change handler with the raw input value. */\n onChange?: (value: string, e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Minimum allowed value. */\n min?: string;\n /** Maximum allowed value. */\n max?: string;\n /** Step (seconds for time / datetime-local, days for date, …). */\n step?: number | string;\n /** Optional label rendered above the field. */\n label?: React.ReactNode;\n /** Placeholder (only shown by browsers that support it). */\n placeholder?: string;\n /** Color variant (daisyUI). */\n variant?: DateTimeVariant;\n /** Size (daisyUI). */\n size?: DateTimeSize;\n /** Disabled state. */\n disabled?: boolean;\n /** Read-only state. */\n readOnly?: boolean;\n /** Native name attribute. */\n name?: string;\n /** Extra class names on the input. */\n className?: string;\n /** Inline styles on the wrapper. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CLASS: Record<DateTimeVariant, string> = {\n default: '',\n primary: 'input-primary',\n secondary: 'input-secondary',\n accent: 'input-accent',\n info: 'input-info',\n success: 'input-success',\n warning: 'input-warning',\n error: 'input-error',\n};\n\nconst SIZE_CLASS: Record<DateTimeSize, string> = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n};\n\n/**\n * DateTimeInput —— A2UI 交互组件:日期 / 时间选择输入。\n * 基于原生 `date / time / datetime-local / month / week` 输入,套用 daisyUI input 样式。\n */\nconst DateTimeInput: React.FC<DateTimeInputProps> = ({\n type = 'date',\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n label,\n placeholder,\n variant = 'default',\n size = 'sm',\n disabled = false,\n readOnly = false,\n name,\n className = '',\n style,\n}) => {\n const inputId = useId();\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.value, e);\n },\n [onChange],\n );\n\n const input = (\n <input\n id={inputId}\n type={type}\n className={cn('input dishui-datetime-input w-full', VARIANT_CLASS[variant], SIZE_CLASS[size], className)}\n value={value}\n defaultValue={value !== undefined ? undefined : defaultValue}\n min={min}\n max={max}\n step={step}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n name={name}\n onChange={handleChange}\n />\n );\n\n if (label === undefined || label === null || label === '') {\n return input;\n }\n\n return (\n <div className=\"dishui-datetime-field w-full\" style={style}>\n <label htmlFor={inputId} className=\"label-text mb-1 block text-sm text-base-content/80\">\n {label}\n </label>\n {input}\n </div>\n );\n};\n\nexport default DateTimeInput;\n"],"mappings":";;;;;AAqDA,IAAMA,IAAiD;CACrD,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAEMC,IAA2C;CAC/C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAMMC,KAA+C,EACnD,UAAO,QACP,UACA,iBACA,aACA,QACA,QACA,SACA,UACA,gBACA,aAAU,WACV,UAAO,MACP,cAAW,IACX,cAAW,IACX,SACA,eAAY,IACZ,eACI;CACJ,IAAMC,IAAUC,EAAM,GAChBC,IAAeC,GAClB,MAA2C;EAC1C,IAAW,EAAE,OAAO,OAAO,CAAC;CAC9B,GACA,CAACC,CAAQ,CACX,GAEMC,IACJ,kBAAC,SAAD;EACE,IAAIL;EACE;EACN,WAAWM,EAAG,sCAAsCT,EAAcU,IAAUT,EAAWU,IAAOC,CAAS;EAChG;EACP,cAAcC,MAAU,KAAA,IAAwBC,IAAZ,KAAA;EAC/B;EACA;EACC;EACO;EACH;EACA;EACJ;EACN,UAAUT;CACX,CAAA;CAOH,OAJIU,KAAiC,QAAQA,MAAU,KAC9CP,IAIP,kBAAC,OAAD;EAAK,WAAU;EAAsC;EAArD,UAAA,CACE,kBAAC,SAAD;GAAO,SAASL;GAAS,WAAU;GAChC,UAAAY;EACI,CAAA,GACNP,CACE;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Demo/index.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport { useCopyToClipboard } from '../../hooks/useCopyToClipboard';\nimport { formatDemoSource, type DemoSource } from './source';\nimport Button from '../Button';\nimport Text from '../Text';\n\nexport type { DemoSource } from './source';\n\nexport interface CodeBlockProps {\n children: string;\n language?: string;\n}\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({ children, language = 'jsx' }) => {\n const { copied, error, copy } = useCopyToClipboard();\n\n return (\n <div className=\"min-w-0 overflow-hidden rounded-lg border border-base-300\">\n <div className=\"flex items-center justify-between gap-3 bg-base-200 px-4 py-2\">\n <Text size=\"xs\" mono color=\"muted\">{language}</Text>\n <div className=\"flex items-center gap-2\">\n <Text role=\"status\" size=\"xs\">\n {error ? 'Copy failed / 复制失败,请手动复制' : copied ? 'Copied / 已复制' : ''}\n </Text>\n <Button\n type=\"button\"\n variant=\"ghost\" size=\"xs\"\n onClick={() => void copy(children)}\n aria-label=\"Copy source code / 复制源代码\"\n >\n Copy / 复制\n </Button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={coldarkDark}\n tabIndex={0}\n aria-label=\"Source code / 源代码\"\n customStyle={{\n margin: 0,\n borderRadius: 0,\n fontSize: '0.8125rem',\n lineHeight: 1.7,\n padding: '1rem',\n maxHeight: '32rem',\n overflow: 'auto',\n }}\n >\n {children}\n </SyntaxHighlighter>\n </div>\n );\n};\n\ntype DemoSourceLoader = () => Promise<DemoSource>;\n\ntype SourceLoadResult = {\n loader: DemoSourceLoader;\n attempt: number;\n} & ({ status: 'success'; data: DemoSource } | { status: 'error' });\n\nexport interface DemoProps {\n title: string;\n description?: string;\n children: React.ReactNode;\n code: string;\n language?: string;\n source?: DemoSource | DemoSourceLoader;\n sourceContext?: Record<string, unknown>;\n}\n\nconst Demo: React.FC<DemoProps> = ({\n title,\n description,\n children,\n code,\n language = 'jsx',\n source,\n sourceContext,\n}) => {\n const [showCode, setShowCode] = useState(false);\n const [attempt, setAttempt] = useState(0);\n const [loadResult, setLoadResult] = useState<SourceLoadResult | null>(null);\n const request = useRef<{\n loader: DemoSourceLoader;\n attempt: number;\n promise: Promise<DemoSource>;\n } | null>(null);\n\n useEffect(() => {\n if (!showCode || typeof source !== 'function') return;\n\n let active = true;\n // Reuse the request across collapse/reopen and StrictMode effect replays.\n if (request.current?.loader !== source || request.current.attempt !== attempt) {\n request.current = {\n loader: source,\n attempt,\n promise: Promise.resolve().then(() => source()),\n };\n }\n void request.current.promise.then(\n data => {\n if (active) setLoadResult({ loader: source, attempt, status: 'success', data });\n },\n () => {\n if (active) setLoadResult({ loader: source, attempt, status: 'error' });\n },\n );\n return () => { active = false; };\n }, [source, showCode, attempt]);\n\n // Match the loader before rendering so switching props cannot flash stale source.\n const currentResult = typeof source === 'function'\n && loadResult?.loader === source && loadResult.attempt === attempt\n ? loadResult : null;\n const resolvedSource = typeof source === 'function'\n ? currentResult?.status === 'success' ? currentResult.data : undefined\n : source;\n const loading = typeof source === 'function' && !currentResult;\n const id = useId();\n const titleId = `${id}-title`;\n const codeId = `${id}-code`;\n\n return (\n <section aria-labelledby={titleId} className=\"dishui-demo mb-4 min-w-0 rounded-lg border border-hairline bg-page\">\n <div className=\"border-b border-hairline bg-subtle px-4 py-3 rounded-t-lg\">\n <Text as=\"h3\" id={titleId} size=\"sm\" weight=\"semibold\">{title}</Text>\n {description && <Text as=\"p\" size=\"sm\" color=\"muted\" className=\"mt-1 leading-relaxed\">{description}</Text>}\n </div>\n\n <div className=\"flex min-w-0 flex-wrap items-center gap-4 p-4\">\n {children}\n </div>\n\n <div className=\"border-t border-base-300\">\n <Button\n type=\"button\" variant=\"ghost\"\n className=\"flex w-full items-center justify-between rounded-none rounded-b-lg px-4 text-xs font-medium\"\n aria-expanded={showCode}\n aria-controls={codeId}\n onClick={() => setShowCode(value => !value)}\n >\n <Text size=\"xs\" weight=\"medium\" color=\"inherit\">Source Code / 源代码</Text>\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={`h-4 w-4 transition-transform motion-reduce:transition-none ${showCode ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n </Button>\n <div id={codeId} hidden={!showCode} className=\"min-w-0 border-t border-base-300 p-4\">\n {showCode && (\n <div className=\"min-w-0 space-y-3\">\n <div className=\"min-w-0\" aria-busy={loading}>\n {loading ? (\n <Text as=\"p\" role=\"status\" size=\"sm\">Loading source code… / 正在加载源码…</Text>\n ) : currentResult?.status === 'error' ? (\n <div className=\"space-y-2\">\n <Text as=\"p\" role=\"alert\" size=\"sm\">\n Could not load source code. Please retry. / 源码加载失败,请重试。\n </Text>\n <Button\n type=\"button\" variant=\"ghost\" size=\"sm\"\n onClick={() => setAttempt(value => value + 1)}\n >\n Retry loading source / 重新加载源码\n </Button>\n </div>\n ) : resolvedSource ? (\n <CodeBlock language=\"tsx\">\n {formatDemoSource(resolvedSource, sourceContext)}\n </CodeBlock>\n ) : !source ? (\n <CodeBlock language={language}>{code}</CodeBlock>\n ) : null}\n </div>\n </div>\n )}\n </div>\n </div>\n </section>\n );\n};\n\nexport default Demo;\n"],"mappings":";;;;;;;;;AAeA,IAAM,KAAuC,EAAE,aAAU,cAAW,YAAY;CAC9E,IAAM,EAAE,WAAQ,UAAO,YAAS,EAAmB;CAEnD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,GAAD;IAAM,MAAK;IAAK,MAAA;IAAK,OAAM;IAAS,UAAA;GAAe,CAAA,GACnD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,GAAD;KAAM,MAAK;KAAS,MAAK;KACtB,UAAA,IAAQ,6BAA6B,IAAS,iBAAiB;IAC5D,CAAA,GACN,kBAAC,GAAD;KACE,MAAK;KACL,SAAQ;KAAQ,MAAK;KACrB,eAAe,KAAK,EAAK,CAAQ;KACjC,cAAW;KACZ,UAAA;IAEO,CAAA,CACL;GACF,CAAA,CAAA;EACL,CAAA,GAAA,kBAAC,GAAD;GACY;GACV,OAAO;GACP,UAAU;GACV,cAAW;GACX,aAAa;IACX,QAAQ;IACR,cAAc;IACd,UAAU;IACV,YAAY;IACZ,SAAS;IACT,WAAW;IACX,UAAU;GACZ;GAEC;EACgB,CAAA,CAChB;;AAET,GAmBM,KAA6B,EACjC,UACA,gBACA,aACA,SACA,cAAW,OACX,WACA,uBACI;CACJ,IAAM,CAAC,GAAU,K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","SyntaxHighlighter","ButtonWithCompounds","Text","CodeBlock","useCopyToClipboard","language","error","copied","copy","children","Prism","coldarkDark","Demo","showCode","setShowCode","useState","attempt","setAttempt","loadResult","setLoadResult","request","useRef","source","active","currentResult","resolvedSource","loading","id","useId","titleId","codeId","title","description","value","formatDemoSource","sourceContext","code"],"sources":["../../../src/components/Demo/index.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport { useCopyToClipboard } from '../../hooks/useCopyToClipboard';\nimport { formatDemoSource, type DemoSource } from './source';\nimport Button from '../Button';\nimport Text from '../Text';\n\nexport type { DemoSource } from './source';\n\nexport interface CodeBlockProps {\n children: string;\n language?: string;\n}\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({ children, language = 'jsx' }) => {\n const { copied, error, copy } = useCopyToClipboard();\n\n return (\n <div className=\"min-w-0 overflow-hidden rounded-lg border border-base-300\">\n <div className=\"flex items-center justify-between gap-3 bg-base-200 px-4 py-2\">\n <Text size=\"xs\" mono color=\"muted\">{language}</Text>\n <div className=\"flex items-center gap-2\">\n <Text role=\"status\" size=\"xs\">\n {error ? 'Copy failed / 复制失败,请手动复制' : copied ? 'Copied / 已复制' : ''}\n </Text>\n <Button\n type=\"button\"\n variant=\"ghost\" size=\"xs\"\n onClick={() => void copy(children)}\n aria-label=\"Copy source code / 复制源代码\"\n >\n Copy / 复制\n </Button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={coldarkDark}\n tabIndex={0}\n aria-label=\"Source code / 源代码\"\n customStyle={{\n margin: 0,\n borderRadius: 0,\n fontSize: '0.8125rem',\n lineHeight: 1.7,\n padding: '1rem',\n maxHeight: '32rem',\n overflow: 'auto',\n }}\n >\n {children}\n </SyntaxHighlighter>\n </div>\n );\n};\n\ntype DemoSourceLoader = () => Promise<DemoSource>;\n\ntype SourceLoadResult = {\n loader: DemoSourceLoader;\n attempt: number;\n} & ({ status: 'success'; data: DemoSource } | { status: 'error' });\n\nexport interface DemoProps {\n title: string;\n description?: string;\n children: React.ReactNode;\n code: string;\n language?: string;\n source?: DemoSource | DemoSourceLoader;\n sourceContext?: Record<string, unknown>;\n}\n\nconst Demo: React.FC<DemoProps> = ({\n title,\n description,\n children,\n code,\n language = 'jsx',\n source,\n sourceContext,\n}) => {\n const [showCode, setShowCode] = useState(false);\n const [attempt, setAttempt] = useState(0);\n const [loadResult, setLoadResult] = useState<SourceLoadResult | null>(null);\n const request = useRef<{\n loader: DemoSourceLoader;\n attempt: number;\n promise: Promise<DemoSource>;\n } | null>(null);\n\n useEffect(() => {\n if (!showCode || typeof source !== 'function') return;\n\n let active = true;\n // Reuse the request across collapse/reopen and StrictMode effect replays.\n if (request.current?.loader !== source || request.current.attempt !== attempt) {\n request.current = {\n loader: source,\n attempt,\n promise: Promise.resolve().then(() => source()),\n };\n }\n void request.current.promise.then(\n data => {\n if (active) setLoadResult({ loader: source, attempt, status: 'success', data });\n },\n () => {\n if (active) setLoadResult({ loader: source, attempt, status: 'error' });\n },\n );\n return () => { active = false; };\n }, [source, showCode, attempt]);\n\n // Match the loader before rendering so switching props cannot flash stale source.\n const currentResult = typeof source === 'function'\n && loadResult?.loader === source && loadResult.attempt === attempt\n ? loadResult : null;\n const resolvedSource = typeof source === 'function'\n ? currentResult?.status === 'success' ? currentResult.data : undefined\n : source;\n const loading = typeof source === 'function' && !currentResult;\n const id = useId();\n const titleId = `${id}-title`;\n const codeId = `${id}-code`;\n\n return (\n <section aria-labelledby={titleId} className=\"dishui-demo mb-4 min-w-0 rounded-lg border border-hairline bg-page\">\n <div className=\"border-b border-hairline bg-subtle px-4 py-3 rounded-t-lg\">\n <Text as=\"h3\" id={titleId} size=\"sm\" weight=\"semibold\">{title}</Text>\n {description && <Text as=\"p\" size=\"sm\" color=\"muted\" className=\"mt-1 leading-relaxed\">{description}</Text>}\n </div>\n\n <div className=\"flex min-w-0 flex-wrap items-center gap-4 p-4\">\n {children}\n </div>\n\n <div className=\"border-t border-base-300\">\n <Button\n type=\"button\" variant=\"ghost\"\n className=\"flex w-full items-center justify-between rounded-none rounded-b-lg px-4 text-xs font-medium\"\n aria-expanded={showCode}\n aria-controls={codeId}\n onClick={() => setShowCode(value => !value)}\n >\n <Text size=\"xs\" weight=\"medium\" color=\"inherit\">Source Code / 源代码</Text>\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={`h-4 w-4 transition-transform motion-reduce:transition-none ${showCode ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n </Button>\n <div id={codeId} hidden={!showCode} className=\"min-w-0 border-t border-base-300 p-4\">\n {showCode && (\n <div className=\"min-w-0 space-y-3\">\n <div className=\"min-w-0\" aria-busy={loading}>\n {loading ? (\n <Text as=\"p\" role=\"status\" size=\"sm\">Loading source code… / 正在加载源码…</Text>\n ) : currentResult?.status === 'error' ? (\n <div className=\"space-y-2\">\n <Text as=\"p\" role=\"alert\" size=\"sm\">\n Could not load source code. Please retry. / 源码加载失败,请重试。\n </Text>\n <Button\n type=\"button\" variant=\"ghost\" size=\"sm\"\n onClick={() => setAttempt(value => value + 1)}\n >\n Retry loading source / 重新加载源码\n </Button>\n </div>\n ) : resolvedSource ? (\n <CodeBlock language=\"tsx\">\n {formatDemoSource(resolvedSource, sourceContext)}\n </CodeBlock>\n ) : !source ? (\n <CodeBlock language={language}>{code}</CodeBlock>\n ) : null}\n </div>\n </div>\n )}\n </div>\n </div>\n </section>\n );\n};\n\nexport default Demo;\n"],"mappings":";;;;;;;;;AAeA,IAAMI,KAAuC,EAAE,aAAU,cAAW,YAAY;CAC9E,IAAM,EAAE,WAAQ,UAAO,YAASC,EAAmB;CAEnD,OACE,kBAA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GAAE;MAAkB,CAAA;KACpF,CAAA,CACC;IACR,CAAA,GAAA,kBAAC,OAAD;KAAK,IAAIiB;KAAQ,QAAQ,CAACjB;KAAU,WAAU;KAC3C,UAAAA,KACC,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,OAAD;OAAK,WAAU;OAAU,aAAWa;OACjC,UAAAA,IACC,kBAACxB,GAAD;QAAM,IAAG;QAAI,MAAK;QAAS,MAAK;QAAK,UAAA;OAAoC,CAAA,IACvEsB,GAAe,WAAW,UAC5B,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACE,kBAACtB,GAAD;SAAM,IAAG;SAAI,MAAK;SAAQ,MAAK;SAAK,UAAA;QAE9B,CAAA,GACN,kBAACH,GAAD;SACE,MAAK;SAAS,SAAQ;SAAQ,MAAK;SACnC,eAAekB,GAAW,MAASgB,IAAQ,CAAC;SAC7C,UAAA;QAEO,CAAA,CACL;OACH,CAAA,IAAAR,IACF,kBAACtB,GAAD;QAAW,UAAS;QACjB,UAAA+B,EAAiBT,GAAgBU,CAAa;OACtC,CAAA,IACRb,IAED,OADF,kBAACnB,GAAD;QAAqB;QAAW,UAAAiC;OAAgB,CAAA;MAE/C,CAAA;KACF,CAAA;IAEJ,CAAA,CACF;;EACE;;AAEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","names":[],"sources":["../../../src/components/Demo/source.ts"],"sourcesContent":["export interface DemoSource {\n imports: string;\n setup: string;\n preview: string;\n context: string[];\n path?: string;\n line?: number;\n}\n\nfunction normalizeSection(code: string, trimmedFirstLine = false): string {\n const lines = code.replace(/\\r\\n/g, '\\n').split('\\n');\n while (lines.length && !lines[0].trim()) lines.shift();\n while (lines.length && !lines[lines.length - 1].trim()) lines.pop();\n // The extracted JSX starts at its first token; subsequent lines still carry the\n // page's indentation. Do not reindent template literals, whose spaces are data.\n if (code.includes('`')) return lines.join('\\n');\n const indentedLines = trimmedFirstLine && lines[0]?.match(/^\\S/) ? lines.slice(1) : lines;\n const indentation = Math.min(...indentedLines.filter(line => line.trim()).map(line => line.match(/^[\\t ]*/)?.[0].length ?? 0));\n return lines.map((line, index) => trimmedFirstLine && index === 0 && /^\\S/.test(line) ? line : line.slice(indentation)).join('\\n');\n}\n\nexport function formatDemoSource(\n source: DemoSource,\n sourceContext: Record<string, unknown> = {},\n): string {\n const declarations: string[] = [];\n for (const name of new Set(source.context)) {\n if (!Object.prototype.hasOwnProperty.call(sourceContext, name)) continue;\n const value = sourceContext[name];\n // Runtime functions and circular values cannot be represented as JSON source.\n try {\n const literal = value === undefined ? 'undefined' : JSON.stringify(value, null, 2);\n if (literal !== undefined) declarations.push(`const ${name} = ${literal};`);\n } catch {\n continue;\n }\n }\n\n return [\n normalizeSection(source.imports),\n declarations.join('\\n'),\n normalizeSection(source.setup),\n normalizeSection(source.preview, true),\n ].filter(Boolean).join('\\n\\n');\n}\n"],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"source.js","names":["normalizeSection","lines","code","indentedLines","trimmedFirstLine","indentation","line","index","formatDemoSource","declarations","name","source","sourceContext","value","literal"],"sources":["../../../src/components/Demo/source.ts"],"sourcesContent":["export interface DemoSource {\n imports: string;\n setup: string;\n preview: string;\n context: string[];\n path?: string;\n line?: number;\n}\n\nfunction normalizeSection(code: string, trimmedFirstLine = false): string {\n const lines = code.replace(/\\r\\n/g, '\\n').split('\\n');\n while (lines.length && !lines[0].trim()) lines.shift();\n while (lines.length && !lines[lines.length - 1].trim()) lines.pop();\n // The extracted JSX starts at its first token; subsequent lines still carry the\n // page's indentation. Do not reindent template literals, whose spaces are data.\n if (code.includes('`')) return lines.join('\\n');\n const indentedLines = trimmedFirstLine && lines[0]?.match(/^\\S/) ? lines.slice(1) : lines;\n const indentation = Math.min(...indentedLines.filter(line => line.trim()).map(line => line.match(/^[\\t ]*/)?.[0].length ?? 0));\n return lines.map((line, index) => trimmedFirstLine && index === 0 && /^\\S/.test(line) ? line : line.slice(indentation)).join('\\n');\n}\n\nexport function formatDemoSource(\n source: DemoSource,\n sourceContext: Record<string, unknown> = {},\n): string {\n const declarations: string[] = [];\n for (const name of new Set(source.context)) {\n if (!Object.prototype.hasOwnProperty.call(sourceContext, name)) continue;\n const value = sourceContext[name];\n // Runtime functions and circular values cannot be represented as JSON source.\n try {\n const literal = value === undefined ? 'undefined' : JSON.stringify(value, null, 2);\n if (literal !== undefined) declarations.push(`const ${name} = ${literal};`);\n } catch {\n continue;\n }\n }\n\n return [\n normalizeSection(source.imports),\n declarations.join('\\n'),\n normalizeSection(source.setup),\n normalizeSection(source.preview, true),\n ].filter(Boolean).join('\\n\\n');\n}\n"],"mappings":";AASA,SAASA,EAAiB,GAAc,IAAmB,IAAe;CACxE,IAAMC,IAAQC,EAAK,QAAQ,SAAS,IAAI,CAAC,CAAC,MAAM,IAAI;CACpD,OAAOD,EAAM,UAAU,CAACA,EAAM,EAAE,CAAC,KAAK,IAAG,EAAM,MAAM;CACrD,OAAOA,EAAM,UAAU,CAACA,EAAMA,EAAM,SAAS,EAAE,CAAC,KAAK,IAAG,EAAM,IAAI;CAGlE,IAAIC,EAAK,SAAS,GAAG,GAAG,OAAOD,EAAM,KAAK,IAAI;CAC9C,IAAME,IAAgBC,KAAoBH,EAAM,EAAE,EAAE,MAAM,KAAK,IAAIA,EAAM,MAAM,CAAC,IAAIA,GAC9EI,IAAc,KAAK,IAAI,GAAGF,EAAc,QAAO,MAAQG,EAAK,KAAK,CAAC,CAAC,CAAC,KAAI,MAAQA,EAAK,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;CAC7H,OAAOL,EAAM,KAAK,GAAM,MAAUG,KAAoBG,MAAU,KAAK,MAAM,KAAKD,CAAI,IAAIA,IAAOA,EAAK,MAAMD,CAAW,CAAC,CAAC,CAAC,KAAK,IAAI;AACnI;AAEA,SAAgBG,EACd,GACA,IAAyC,CAAC,GAClC;CACR,IAAMC,IAAyB,CAAC;CAChC,KAAK,IAAMC,KAAQ,IAAI,IAAIC,EAAO,OAAO,GAAG;EAC1C,IAAI,CAAC,OAAO,UAAU,eAAe,KAAKC,GAAeF,CAAI,GAAG;EAChE,IAAMG,IAAQD,EAAcF;EAE5B,IAAI;GACF,IAAMI,IAAUD,MAAU,KAAA,IAAY,cAAc,KAAK,UAAUA,GAAO,MAAM,CAAC;GACjF,AAAIC,MAAY,KAAA,KAAWL,EAAa,KAAK,SAASC,EAAK,KAAKI,EAAQ,EAAE;EAC5E,QAAQ;GACN;EACF;CACF;CAEA,OAAO;EACLd,EAAiBW,EAAO,OAAO;EAC/BF,EAAa,KAAK,IAAI;EACtBT,EAAiBW,EAAO,KAAK;EAC7BX,EAAiBW,EAAO,SAAS,EAAI;CACvC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,MAAM;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Divider/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type DividerProps = {\n /** Optional label rendered in the middle of the divider. */\n children?: React.ReactNode;\n /** Orientation. */\n direction?: 'horizontal' | 'vertical';\n /** Alignment of the label along the divider. */\n align?: 'start' | 'center' | 'end';\n /** Color variant (daisyUI). */\n variant?: 'default' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral';\n /** Extra class names. */\n className?: string;\n /** Inline styles. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CLASS: Record<NonNullable<DividerProps['variant']>, string> = {\n default: '',\n primary: 'divider-primary',\n secondary: 'divider-secondary',\n accent: 'divider-accent',\n info: 'divider-info',\n success: 'divider-success',\n warning: 'divider-warning',\n error: 'divider-error',\n neutral: 'divider-neutral',\n};\n\nconst ALIGN_CLASS: Record<NonNullable<DividerProps['align']>, string> = {\n start: 'divider-start',\n center: '',\n end: 'divider-end',\n};\n\n/**\n * Divider —— 分隔线。基于 daisyUI `divider`,支持水平/垂直、可选居中文本与色调变体。\n */\nconst Divider: React.FC<DividerProps> = ({\n children,\n direction = 'horizontal',\n align = 'center',\n variant = 'default',\n className = '',\n style,\n}) => {\n const classes = cn(\n 'divider',\n // daisyUI 语义:基础 `.divider` 为水平线;`.divider-horizontal` 为用于横向布局的竖线。\n direction === 'vertical' && 'divider-horizontal',\n ALIGN_CLASS[align],\n VARIANT_CLASS[variant],\n className,\n );\n\n return (\n <div className={classes} style={style}>\n {children}\n </div>\n );\n};\n\nexport default Divider;\n"],"mappings":";;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["VARIANT_CLASS","ALIGN_CLASS","Divider","classes","cn","direction","align","variant","className"],"sources":["../../../src/components/Divider/index.tsx"],"sourcesContent":["import React from 'react';\nimport { cn } from '../../utils/cn';\n\nexport type DividerProps = {\n /** Optional label rendered in the middle of the divider. */\n children?: React.ReactNode;\n /** Orientation. */\n direction?: 'horizontal' | 'vertical';\n /** Alignment of the label along the divider. */\n align?: 'start' | 'center' | 'end';\n /** Color variant (daisyUI). */\n variant?: 'default' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral';\n /** Extra class names. */\n className?: string;\n /** Inline styles. */\n style?: React.CSSProperties;\n};\n\nconst VARIANT_CLASS: Record<NonNullable<DividerProps['variant']>, string> = {\n default: '',\n primary: 'divider-primary',\n secondary: 'divider-secondary',\n accent: 'divider-accent',\n info: 'divider-info',\n success: 'divider-success',\n warning: 'divider-warning',\n error: 'divider-error',\n neutral: 'divider-neutral',\n};\n\nconst ALIGN_CLASS: Record<NonNullable<DividerProps['align']>, string> = {\n start: 'divider-start',\n center: '',\n end: 'divider-end',\n};\n\n/**\n * Divider —— 分隔线。基于 daisyUI `divider`,支持水平/垂直、可选居中文本与色调变体。\n */\nconst Divider: React.FC<DividerProps> = ({\n children,\n direction = 'horizontal',\n align = 'center',\n variant = 'default',\n className = '',\n style,\n}) => {\n const classes = cn(\n 'divider',\n // daisyUI 语义:基础 `.divider` 为水平线;`.divider-horizontal` 为用于横向布局的竖线。\n direction === 'vertical' && 'divider-horizontal',\n ALIGN_CLASS[align],\n VARIANT_CLASS[variant],\n className,\n );\n\n return (\n <div className={classes} style={style}>\n {children}\n </div>\n );\n};\n\nexport default Divider;\n"],"mappings":";;;;AAkBA,IAAMA,IAAsE;CAC1E,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;CACP,SAAS;AACX,GAEMC,IAAkE;CACtE,OAAO;CACP,QAAQ;CACR,KAAK;AACP,GAKMC,KAAmC,EACvC,aACA,eAAY,cACZ,WAAQ,UACR,aAAU,WACV,eAAY,IACZ,eACI;CACJ,IAAMC,IAAUC,EACd,WAEAC,MAAc,cAAc,sBAC5BJ,EAAYK,IACZN,EAAcO,IACdC,CACF;CAEA,OACE,kBAAC,OAAD;EAAK,WAAWL;EAAgB;EAC7B;CACE,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/EmptyState/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport type EmptyStateProps = {\n /** 主图标(通常为 lucide 图标) */\n icon?: React.ReactNode;\n /** 主标题 */\n title: React.ReactNode;\n /** 补充说明 */\n description?: React.ReactNode;\n /** 底部操作(按钮等) */\n action?: React.ReactNode;\n /** 是否默认填满所在区域(宽高 100%,内容居中);默认 true */\n fill?: boolean;\n className?: string;\n};\n\n/**\n * 空状态:虚线边框卡片 + 图标 + 标题 + 说明,统一列表为空时的展示。\n * 默认填满所在区域(fill),在固定高度的容器内自动垂直居中。\n */\nconst EmptyState = ({\n icon,\n title,\n description,\n action,\n fill = true,\n className = '',\n}: EmptyStateProps) => {\n return (\n <div\n className={`dishui-empty-state flex min-w-0 flex-col items-center justify-center rounded-lg border border-dashed border-base-300 bg-base-100 px-6 py-12 text-center text-body leading-5 ${fill ? 'h-full w-full' : ''} ${className}`.trim()}\n >\n {icon && (\n <span className=\"mb-3 flex size-10 items-center justify-center rounded-lg bg-base-200 text-base-content/70 [&>svg]:h-5 [&>svg]:w-5\">\n {icon}\n </span>\n )}\n <p className=\"max-w-full break-words text-body font-medium text-base-content\">{title}</p>\n {description && (\n <p className=\"mt-1 max-w-sm break-words text-body-sm leading-5 text-base-content/70\">{description}</p>\n )}\n {action && <div className=\"mt-4\">{action}</div>}\n </div>\n );\n};\n\nexport default EmptyState;\n"],"mappings":";;;AAoBA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["EmptyState","fill","className","icon","title","description","action"],"sources":["../../../src/components/EmptyState/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport type EmptyStateProps = {\n /** 主图标(通常为 lucide 图标) */\n icon?: React.ReactNode;\n /** 主标题 */\n title: React.ReactNode;\n /** 补充说明 */\n description?: React.ReactNode;\n /** 底部操作(按钮等) */\n action?: React.ReactNode;\n /** 是否默认填满所在区域(宽高 100%,内容居中);默认 true */\n fill?: boolean;\n className?: string;\n};\n\n/**\n * 空状态:虚线边框卡片 + 图标 + 标题 + 说明,统一列表为空时的展示。\n * 默认填满所在区域(fill),在固定高度的容器内自动垂直居中。\n */\nconst EmptyState = ({\n icon,\n title,\n description,\n action,\n fill = true,\n className = '',\n}: EmptyStateProps) => {\n return (\n <div\n className={`dishui-empty-state flex min-w-0 flex-col items-center justify-center rounded-lg border border-dashed border-base-300 bg-base-100 px-6 py-12 text-center text-body leading-5 ${fill ? 'h-full w-full' : ''} ${className}`.trim()}\n >\n {icon && (\n <span className=\"mb-3 flex size-10 items-center justify-center rounded-lg bg-base-200 text-base-content/70 [&>svg]:h-5 [&>svg]:w-5\">\n {icon}\n </span>\n )}\n <p className=\"max-w-full break-words text-body font-medium text-base-content\">{title}</p>\n {description && (\n <p className=\"mt-1 max-w-sm break-words text-body-sm leading-5 text-base-content/70\">{description}</p>\n )}\n {action && <div className=\"mt-4\">{action}</div>}\n </div>\n );\n};\n\nexport default EmptyState;\n"],"mappings":";;;AAoBA,IAAMA,KAAc,EAChB,SACA,UACA,gBACA,WACA,UAAO,IACP,eAAY,SAGR,kBAAC,OAAD;CACI,WAAW,+KAA+KC,IAAO,kBAAkB,GAAG,GAAGC,IAAY,KAAK;CAD9O,UAAA;EAGKC,KACG,kBAAC,QAAD;GAAM,WAAU;GACX,UAAAA;EACC,CAAA;EAEV,kBAAC,KAAD;GAAG,WAAU;GAAkE,UAAAC;EAAS,CAAA;EACvFC,KACG,kBAAC,KAAD;GAAG,WAAU;GAAyE,UAAAA;EAAe,CAAA;EAExGC,KAAU,kBAAC,OAAD;GAAK,WAAU;GAAQ,UAAAA;EAAY,CAAA;CAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Field/index.tsx"],"sourcesContent":["import React, { forwardRef, useId } from 'react';\nimport { cn } from '../../utils/cn';\nimport './style.css';\n\nexport interface FieldProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {\n legend?: React.ReactNode;\n description?: React.ReactNode;\n error?: React.ReactNode;\n}\n\nconst hasContent = (node: React.ReactNode) => node !== null && node !== undefined && typeof node !== 'boolean' && node !== '';\n\nconst Field = forwardRef<HTMLFieldSetElement, FieldProps>(function Field({\n legend,\n description,\n error,\n children,\n className,\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n ...props\n}, ref) {\n const id = useId();\n const descriptionId = `${id}-description`;\n const errorId = `${id}-error`;\n const showDescription = hasContent(description);\n const showError = hasContent(error);\n const ids = [describedBy, showDescription ? descriptionId : undefined, showError ? errorId : undefined]\n .filter(Boolean).join(' ') || undefined;\n\n return (\n <fieldset\n {...props}\n ref={ref}\n className={cn('dishui-field', className)}\n aria-describedby={ids}\n aria-invalid={invalid ?? (showError ? true : undefined)}\n >\n {hasContent(legend) && <legend className=\"dishui-field-legend\">{legend}</legend>}\n <div className=\"dishui-field-content\">\n {showDescription && <div id={descriptionId} className=\"dishui-field-description\">{description}</div>}\n {children}\n {showError && <div id={errorId} className=\"dishui-field-error\" role=\"alert\">{error}</div>}\n </div>\n </fieldset>\n );\n});\n\nexport default Field;\n"],"mappings":";;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["hasContent","node","Field","forwardRef","describedBy","invalid","props","id","useId","descriptionId","errorId","showDescription","description","showError","error","ids","cn","className","legend","children"],"sources":["../../../src/components/Field/index.tsx"],"sourcesContent":["import React, { forwardRef, useId } from 'react';\nimport { cn } from '../../utils/cn';\nimport './style.css';\n\nexport interface FieldProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {\n legend?: React.ReactNode;\n description?: React.ReactNode;\n error?: React.ReactNode;\n}\n\nconst hasContent = (node: React.ReactNode) => node !== null && node !== undefined && typeof node !== 'boolean' && node !== '';\n\nconst Field = forwardRef<HTMLFieldSetElement, FieldProps>(function Field({\n legend,\n description,\n error,\n children,\n className,\n 'aria-describedby': describedBy,\n 'aria-invalid': invalid,\n ...props\n}, ref) {\n const id = useId();\n const descriptionId = `${id}-description`;\n const errorId = `${id}-error`;\n const showDescription = hasContent(description);\n const showError = hasContent(error);\n const ids = [describedBy, showDescription ? descriptionId : undefined, showError ? errorId : undefined]\n .filter(Boolean).join(' ') || undefined;\n\n return (\n <fieldset\n {...props}\n ref={ref}\n className={cn('dishui-field', className)}\n aria-describedby={ids}\n aria-invalid={invalid ?? (showError ? true : undefined)}\n >\n {hasContent(legend) && <legend className=\"dishui-field-legend\">{legend}</legend>}\n <div className=\"dishui-field-content\">\n {showDescription && <div id={descriptionId} className=\"dishui-field-description\">{description}</div>}\n {children}\n {showError && <div id={errorId} className=\"dishui-field-error\" role=\"alert\">{error}</div>}\n </div>\n </fieldset>\n );\n});\n\nexport default Field;\n"],"mappings":";;;;;AAUA,IAAMA,KAAc,MAA0BC,KAAS,QAA8B,OAAOA,KAAS,aAAaA,MAAS,IAErHC,IAAQC,EAA4C,SAAe,EACvE,WACA,gBACA,UACA,aACA,cACA,oBAAoBC,GACpB,gBAAgBC,GAChB,GAAGC,KACF,GAAK;CACN,IAAMC,IAAKC,EAAM,GACXC,IAAgB,GAAGF,EAAG,eACtBG,IAAU,GAAGH,EAAG,SAChBI,IAAkBX,EAAWY,CAAW,GACxCC,IAAYb,EAAWc,CAAK,GAC5BC,IAAM;EAACX;EAAaO,IAAkBF,IAAgB,KAAA;EAAWI,IAAYH,IAAU,KAAA;CAAS,CAAC,CACpG,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;CAEhC,OACE,kBAAC,YAAD;EACE,GAAIJ;EACC;EACL,WAAWU,EAAG,gBAAgBC,CAAS;EACvC,oBAAkBF;EAClB,gBAAcV,MAAYQ,IAAY,KAAO,KAAA;EAL/C,UAAA,CAOGb,EAAWkB,CAAM,KAAK,kBAAC,UAAD;GAAQ,WAAU;GAAuB,UAAAA;EAAe,CAAA,GAC/E,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACGP,KAAmB,kBAAC,OAAD;KAAK,IAAIF;KAAe,WAAU;KAA4B,UAAAG;IAAiB,CAAA;IAClGO;IACAN,KAAa,kBAAC,OAAD;KAAK,IAAIH;KAAS,WAAU;KAAqB,MAAK;KAAS,UAAAI;IAAW,CAAA;GACrF;EACG,CAAA,CAAA;;AAEd,CAAC"}
|