@h-ai/ui 0.1.0-alpha8 → 1.0.0-beta.1
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/README.en.md +1036 -0
- package/README.ja.md +1036 -0
- package/README.md +670 -119
- package/auto-import.d.ts +45 -0
- package/auto-import.js +46 -69
- package/dist/components/compounds/Accordion.svelte +30 -3
- package/dist/components/compounds/Accordion.svelte.d.ts +37 -1
- package/dist/components/compounds/ActionSheet.svelte +35 -8
- package/dist/components/compounds/ActionSheet.svelte.d.ts +41 -1
- package/dist/components/compounds/Alert.svelte +24 -15
- package/dist/components/compounds/Alert.svelte.d.ts +14 -3
- package/dist/components/compounds/AppBar.svelte +37 -9
- package/dist/components/compounds/AppBar.svelte.d.ts +36 -1
- package/dist/components/compounds/BottomNav.svelte +68 -8
- package/dist/components/compounds/BottomNav.svelte.d.ts +51 -1
- package/dist/components/compounds/Breadcrumb.svelte +18 -5
- package/dist/components/compounds/Breadcrumb.svelte.d.ts +23 -2
- package/dist/components/compounds/Calendar.svelte +31 -12
- package/dist/components/compounds/Calendar.svelte.d.ts +23 -7
- package/dist/components/compounds/Card.svelte +17 -5
- package/dist/components/compounds/Card.svelte.d.ts +13 -2
- package/dist/components/compounds/Combobox.svelte +124 -42
- package/dist/components/compounds/Combobox.svelte.d.ts +42 -20
- package/dist/components/compounds/Confirm.svelte +32 -9
- package/dist/components/compounds/Confirm.svelte.d.ts +24 -2
- package/dist/components/compounds/DataTable.svelte +317 -33
- package/dist/components/compounds/DataTable.svelte.d.ts +28 -14
- package/dist/components/compounds/DatePicker.svelte +62 -18
- package/dist/components/compounds/DatePicker.svelte.d.ts +27 -8
- package/dist/components/compounds/Drawer.svelte +179 -22
- package/dist/components/compounds/Drawer.svelte.d.ts +24 -2
- package/dist/components/compounds/Dropdown.svelte +19 -5
- package/dist/components/compounds/Dropdown.svelte.d.ts +13 -2
- package/dist/components/compounds/Empty.svelte +22 -9
- package/dist/components/compounds/Empty.svelte.d.ts +23 -2
- package/dist/components/compounds/FilterBar.svelte +82 -0
- package/dist/components/compounds/FilterBar.svelte.d.ts +39 -0
- package/dist/components/compounds/Form.svelte +59 -16
- package/dist/components/compounds/Form.svelte.d.ts +23 -2
- package/dist/components/compounds/FormField.svelte +99 -16
- package/dist/components/compounds/FormField.svelte.d.ts +23 -2
- package/dist/components/compounds/FormLayout.svelte +71 -0
- package/dist/components/compounds/FormLayout.svelte.d.ts +17 -0
- package/dist/components/compounds/InfiniteScroll.svelte +34 -7
- package/dist/components/compounds/InfiniteScroll.svelte.d.ts +37 -1
- package/dist/components/compounds/JsonViewer.svelte +214 -0
- package/dist/components/compounds/JsonViewer.svelte.d.ts +26 -0
- package/dist/components/compounds/MessageBoxContainer.svelte +34 -0
- package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +25 -0
- package/dist/components/compounds/MessageBoxDialog.svelte +209 -0
- package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +29 -0
- package/dist/components/compounds/MessageContainer.svelte +24 -0
- package/dist/components/compounds/MessageContainer.svelte.d.ts +18 -0
- package/dist/components/compounds/Modal.svelte +348 -73
- package/dist/components/compounds/Modal.svelte.d.ts +13 -2
- package/dist/components/compounds/PageHeader.svelte +44 -20
- package/dist/components/compounds/PageHeader.svelte.d.ts +24 -9
- package/dist/components/compounds/Pagination.svelte +139 -105
- package/dist/components/compounds/Pagination.svelte.d.ts +23 -2
- package/dist/components/compounds/Popover.svelte +124 -25
- package/dist/components/compounds/Popover.svelte.d.ts +23 -2
- package/dist/components/compounds/PullRefresh.svelte +35 -8
- package/dist/components/compounds/PullRefresh.svelte.d.ts +35 -1
- package/dist/components/compounds/Result.svelte +17 -4
- package/dist/components/compounds/Result.svelte.d.ts +23 -2
- package/dist/components/compounds/SafeArea.svelte +30 -3
- package/dist/components/compounds/SafeArea.svelte.d.ts +35 -1
- package/dist/components/compounds/Skeleton.svelte +19 -7
- package/dist/components/compounds/Skeleton.svelte.d.ts +13 -2
- package/dist/components/compounds/Steps.svelte +17 -4
- package/dist/components/compounds/Steps.svelte.d.ts +23 -2
- package/dist/components/compounds/SwipeCell.svelte +30 -3
- package/dist/components/compounds/SwipeCell.svelte.d.ts +40 -1
- package/dist/components/compounds/TableToolbar.svelte +289 -0
- package/dist/components/compounds/TableToolbar.svelte.d.ts +69 -0
- package/dist/components/compounds/Tabs.svelte +84 -14
- package/dist/components/compounds/Tabs.svelte.d.ts +13 -2
- package/dist/components/compounds/TagInput.svelte +51 -33
- package/dist/components/compounds/TagInput.svelte.d.ts +23 -2
- package/dist/components/compounds/Timeline.svelte +30 -3
- package/dist/components/compounds/Timeline.svelte.d.ts +37 -1
- package/dist/components/compounds/ToastContainer.svelte +386 -28
- package/dist/components/compounds/ToastContainer.svelte.d.ts +27 -1
- package/dist/components/compounds/Tooltip.svelte +143 -9
- package/dist/components/compounds/Tooltip.svelte.d.ts +25 -2
- package/dist/components/compounds/accordion-types.d.ts +10 -1
- package/dist/components/compounds/action-sheet-types.d.ts +9 -0
- package/dist/components/compounds/bottom-nav-types.d.ts +9 -0
- package/dist/components/compounds/index.d.ts +7 -0
- package/dist/components/compounds/index.js +11 -0
- package/dist/components/compounds/swipe-cell-types.d.ts +9 -0
- package/dist/components/compounds/timeline-types.d.ts +9 -0
- package/dist/components/control-size.d.ts +35 -0
- package/dist/components/control-size.js +26 -0
- package/dist/components/primitives/Avatar.svelte +19 -5
- package/dist/components/primitives/Avatar.svelte.d.ts +13 -2
- package/dist/components/primitives/Badge.svelte +16 -4
- package/dist/components/primitives/Badge.svelte.d.ts +13 -2
- package/dist/components/primitives/BareButton.svelte +26 -12
- package/dist/components/primitives/BareButton.svelte.d.ts +23 -2
- package/dist/components/primitives/BareInput.svelte +57 -35
- package/dist/components/primitives/BareInput.svelte.d.ts +23 -2
- package/dist/components/primitives/Button.svelte +30 -9
- package/dist/components/primitives/Button.svelte.d.ts +13 -2
- package/dist/components/primitives/Checkbox.svelte +24 -5
- package/dist/components/primitives/Checkbox.svelte.d.ts +23 -2
- package/dist/components/primitives/IconButton.svelte +35 -10
- package/dist/components/primitives/IconButton.svelte.d.ts +23 -2
- package/dist/components/primitives/Input.svelte +56 -26
- package/dist/components/primitives/Input.svelte.d.ts +13 -2
- package/dist/components/primitives/Progress.svelte +17 -4
- package/dist/components/primitives/Progress.svelte.d.ts +23 -2
- package/dist/components/primitives/Radio.svelte +17 -4
- package/dist/components/primitives/Radio.svelte.d.ts +22 -2
- package/dist/components/primitives/Range.svelte +31 -4
- package/dist/components/primitives/Range.svelte.d.ts +37 -1
- package/dist/components/primitives/Rating.svelte +32 -5
- package/dist/components/primitives/Rating.svelte.d.ts +37 -1
- package/dist/components/primitives/Select.svelte +404 -47
- package/dist/components/primitives/Select.svelte.d.ts +23 -2
- package/dist/components/primitives/Spinner.svelte +17 -4
- package/dist/components/primitives/Spinner.svelte.d.ts +23 -2
- package/dist/components/primitives/Switch.svelte +22 -4
- package/dist/components/primitives/Switch.svelte.d.ts +23 -2
- package/dist/components/primitives/Tag.svelte +17 -4
- package/dist/components/primitives/Tag.svelte.d.ts +23 -2
- package/dist/components/primitives/Textarea.svelte +75 -30
- package/dist/components/primitives/Textarea.svelte.d.ts +24 -2
- package/dist/components/primitives/ToggleCheckbox.svelte +24 -10
- package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +23 -2
- package/dist/components/primitives/ToggleInput.svelte +24 -10
- package/dist/components/primitives/ToggleInput.svelte.d.ts +23 -2
- package/dist/components/primitives/ToggleRadio.svelte +24 -10
- package/dist/components/primitives/ToggleRadio.svelte.d.ts +23 -2
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +54 -23
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +30 -1
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +3428 -693
- package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +26 -1
- package/dist/components/scenes/ai/MarkdownRenderer.svelte +119 -116
- package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +31 -1
- package/dist/components/scenes/ai/code-preview.d.ts +46 -0
- package/dist/components/scenes/ai/code-preview.js +141 -0
- package/dist/components/scenes/ai/document-download.d.ts +52 -0
- package/dist/components/scenes/ai/document-download.js +296 -77
- package/dist/components/scenes/ai/document-parse.d.ts +101 -11
- package/dist/components/scenes/ai/document-parse.js +212 -48
- package/dist/components/scenes/ai/document-types.d.ts +292 -75
- package/dist/components/scenes/ai/editor-markdown-extensions.d.ts +27 -0
- package/dist/components/scenes/ai/editor-markdown-extensions.js +215 -0
- package/dist/components/scenes/ai/highlight.d.ts +37 -0
- package/dist/components/scenes/ai/highlight.js +162 -0
- package/dist/components/scenes/ai/index.d.ts +5 -2
- package/dist/components/scenes/ai/index.js +3 -0
- package/dist/components/scenes/ai/markdown-parse.d.ts +11 -3
- package/dist/components/scenes/ai/markdown-parse.js +42 -31
- package/dist/components/scenes/ai/mermaid-host-sync.d.ts +72 -0
- package/dist/components/scenes/ai/mermaid-host-sync.js +65 -0
- package/dist/components/scenes/ai/mermaid-render.d.ts +30 -0
- package/dist/components/scenes/ai/mermaid-render.js +61 -0
- package/dist/components/scenes/ai/safe-html.d.ts +64 -0
- package/dist/components/scenes/ai/safe-html.js +345 -0
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +1692 -0
- package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +32 -0
- package/dist/components/scenes/ai/table/table-types.d.ts +181 -0
- package/dist/components/scenes/ai/table/table-types.js +1 -0
- package/dist/components/scenes/app/FeedbackDetail.svelte +236 -0
- package/dist/components/scenes/app/FeedbackDetail.svelte.d.ts +40 -0
- package/dist/components/scenes/app/FeedbackForm.svelte +337 -0
- package/dist/components/scenes/app/FeedbackForm.svelte.d.ts +72 -0
- package/dist/components/scenes/app/FeedbackList.svelte +150 -0
- package/dist/components/scenes/app/FeedbackList.svelte.d.ts +28 -0
- package/dist/components/scenes/app/FeedbackModal.svelte +65 -139
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +14 -39
- package/dist/components/scenes/app/FeedbackRecorder.svelte +154 -0
- package/dist/components/scenes/app/FeedbackRecorder.svelte.d.ts +9 -0
- package/dist/components/scenes/app/FeedbackReplay.svelte +142 -0
- package/dist/components/scenes/app/FeedbackReplay.svelte.d.ts +7 -0
- package/dist/components/scenes/app/FeedbackScreenshot.svelte +120 -0
- package/dist/components/scenes/app/FeedbackScreenshot.svelte.d.ts +8 -0
- package/dist/components/scenes/app/LanguageSwitch.svelte +38 -21
- package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +33 -20
- package/dist/components/scenes/app/SettingsLayout.svelte +115 -0
- package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +54 -0
- package/dist/components/scenes/app/SettingsModal.svelte +33 -7
- package/dist/components/scenes/app/SettingsModal.svelte.d.ts +27 -1
- package/dist/components/scenes/app/ThemeColorPicker.svelte +240 -0
- package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +57 -0
- package/dist/components/scenes/app/ThemeSelector.svelte +87 -26
- package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +26 -7
- package/dist/components/scenes/app/ThemeToggle.svelte +27 -6
- package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +24 -5
- package/dist/components/scenes/app/WorkspaceLayout.svelte +64 -0
- package/dist/components/scenes/app/WorkspaceLayout.svelte.d.ts +36 -0
- package/dist/components/scenes/app/feedback-functions.d.ts +57 -0
- package/dist/components/scenes/app/feedback-functions.js +107 -0
- package/dist/components/scenes/app/feedback-types.d.ts +224 -0
- package/dist/components/scenes/app/feedback-types.js +1 -0
- package/dist/components/scenes/app/index.d.ts +8 -1
- package/dist/components/scenes/app/index.js +7 -1
- package/dist/components/scenes/charts/Chart.svelte +163 -0
- package/dist/components/scenes/charts/Chart.svelte.d.ts +25 -0
- package/dist/components/scenes/charts/chart-theme.d.ts +47 -0
- package/dist/components/scenes/charts/chart-theme.js +68 -0
- package/dist/components/scenes/charts/chart-types.d.ts +153 -0
- package/dist/components/scenes/charts/chart-types.js +7 -0
- package/dist/components/scenes/charts/index.d.ts +8 -0
- package/dist/components/scenes/charts/index.js +7 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/AreaChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/BarChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte +624 -0
- package/dist/components/scenes/charts/renderers/LineChart.svelte.d.ts +32 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/PieChart.svelte.d.ts +5 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte +18 -0
- package/dist/components/scenes/charts/renderers/ScatterChart.svelte.d.ts +5 -0
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +29 -11
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +13 -1
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +77 -22
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +19 -4
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +242 -0
- package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +66 -0
- package/dist/components/scenes/crud/CrudEditPanel.svelte +365 -0
- package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +48 -0
- package/dist/components/scenes/crud/CrudFilterBar.svelte +17 -85
- package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +13 -25
- package/dist/components/scenes/crud/CrudPage.svelte +564 -185
- package/dist/components/scenes/crud/CrudPage.svelte.d.ts +137 -51
- package/dist/components/scenes/crud/crud-controller.svelte.d.ts +335 -0
- package/dist/components/scenes/crud/crud-controller.svelte.js +276 -0
- package/dist/components/scenes/crud/crud-form-validation.d.ts +16 -0
- package/dist/components/scenes/crud/crud-form-validation.js +51 -0
- package/dist/components/scenes/crud/crud-types.d.ts +136 -43
- package/dist/components/scenes/crud/index.d.ts +9 -3
- package/dist/components/scenes/crud/index.js +8 -3
- package/dist/components/scenes/crud/nav-adapter.d.ts +50 -0
- package/dist/components/scenes/crud/nav-adapter.js +39 -0
- package/dist/components/scenes/crypto/EncryptedInput.svelte +63 -28
- package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +38 -3
- package/dist/components/scenes/crypto/HashDisplay.svelte +30 -22
- package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +24 -1
- package/dist/components/scenes/crypto/SignatureDisplay.svelte +41 -40
- package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +24 -1
- package/dist/components/scenes/error/ErrorPage.svelte +135 -0
- package/dist/components/scenes/error/ErrorPage.svelte.d.ts +50 -0
- package/dist/components/scenes/error/error-presets.d.ts +60 -0
- package/dist/components/scenes/error/error-presets.js +51 -0
- package/dist/components/scenes/error/index.d.ts +8 -0
- package/dist/components/scenes/error/index.js +8 -0
- package/dist/components/scenes/guide/GuideHost.svelte +56 -0
- package/dist/components/scenes/guide/GuideHost.svelte.d.ts +35 -0
- package/dist/components/scenes/guide/GuideHostContent.svelte +136 -0
- package/dist/components/scenes/guide/GuideHostContent.svelte.d.ts +43 -0
- package/dist/components/scenes/guide/HelpCenter.svelte +135 -0
- package/dist/components/scenes/guide/HelpCenter.svelte.d.ts +40 -0
- package/dist/components/scenes/guide/index.d.ts +2 -0
- package/dist/components/scenes/guide/index.js +2 -0
- package/dist/components/scenes/iam/AgreementNotice.svelte +48 -0
- package/dist/components/scenes/iam/AgreementNotice.svelte.d.ts +7 -0
- package/dist/components/scenes/iam/AuthPanel.svelte +226 -0
- package/dist/components/scenes/iam/AuthPanel.svelte.d.ts +29 -0
- package/dist/components/scenes/iam/AuthShell.svelte +160 -0
- package/dist/components/scenes/iam/AuthShell.svelte.d.ts +56 -0
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +84 -63
- package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +113 -89
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +24 -1
- package/dist/components/scenes/iam/LoginForm.svelte +215 -117
- package/dist/components/scenes/iam/LoginForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/PasswordInput.svelte +79 -32
- package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +30 -4
- package/dist/components/scenes/iam/PermGuard.svelte +21 -11
- package/dist/components/scenes/iam/PermGuard.svelte.d.ts +30 -0
- package/dist/components/scenes/iam/ReauthenticationDialog.svelte +68 -0
- package/dist/components/scenes/iam/ReauthenticationDialog.svelte.d.ts +17 -0
- package/dist/components/scenes/iam/RegisterForm.svelte +129 -116
- package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +101 -88
- package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +13 -1
- package/dist/components/scenes/iam/SensitiveOperationsForm.svelte +76 -0
- package/dist/components/scenes/iam/SensitiveOperationsForm.svelte.d.ts +21 -0
- package/dist/components/scenes/iam/SessionRecoveryDialog.svelte +64 -0
- package/dist/components/scenes/iam/SessionRecoveryDialog.svelte.d.ts +22 -0
- package/dist/components/scenes/iam/UserProfile.svelte +47 -21
- package/dist/components/scenes/iam/UserProfile.svelte.d.ts +24 -1
- package/dist/components/scenes/iam/auth-captcha.d.ts +21 -0
- package/dist/components/scenes/iam/auth-captcha.js +23 -0
- package/dist/components/scenes/iam/auth-error-message.d.ts +13 -0
- package/dist/components/scenes/iam/auth-error-message.js +65 -0
- package/dist/components/scenes/iam/index.d.ts +10 -0
- package/dist/components/scenes/iam/index.js +9 -1
- package/dist/components/scenes/iam/password-utils.d.ts +33 -6
- package/dist/components/scenes/iam/password-utils.js +61 -8
- package/dist/components/scenes/iam/permission-context.svelte.d.ts +33 -23
- package/dist/components/scenes/iam/permission-context.svelte.js +20 -22
- package/dist/components/scenes/iam/sensitive-actions.svelte.d.ts +68 -0
- package/dist/components/scenes/iam/sensitive-actions.svelte.js +101 -0
- package/dist/components/scenes/iam/session-recovery.svelte.d.ts +44 -0
- package/dist/components/scenes/iam/session-recovery.svelte.js +57 -0
- package/dist/components/scenes/index.d.ts +3 -0
- package/dist/components/scenes/index.js +5 -0
- package/dist/components/scenes/storage/AvatarUpload.svelte +82 -68
- package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +23 -1
- package/dist/components/scenes/storage/FileList.svelte +19 -5
- package/dist/components/scenes/storage/FileList.svelte.d.ts +23 -1
- package/dist/components/scenes/storage/FileUpload.svelte +151 -96
- package/dist/components/scenes/storage/FileUpload.svelte.d.ts +24 -1
- package/dist/components/scenes/storage/ImageUpload.svelte +93 -94
- package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +24 -1
- package/dist/components/scenes/types.d.ts +574 -42
- package/dist/guide-storage.d.ts +18 -0
- package/dist/guide-storage.js +79 -0
- package/dist/guide-types.d.ts +143 -0
- package/dist/guide-types.js +1 -0
- package/dist/guide.d.ts +3 -0
- package/dist/guide.js +3 -0
- package/dist/guide.svelte.d.ts +29 -0
- package/dist/guide.svelte.js +506 -0
- package/dist/i18n.svelte.d.ts +67 -4
- package/dist/i18n.svelte.js +106 -21
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/internal/browser-safety.d.ts +88 -0
- package/dist/internal/browser-safety.js +140 -0
- package/dist/internal/dialog-focus.d.ts +21 -0
- package/dist/internal/dialog-focus.js +77 -0
- package/dist/internal/form-context.d.ts +92 -0
- package/dist/internal/form-context.js +70 -0
- package/dist/internal/form-validation.svelte.d.ts +70 -0
- package/dist/internal/form-validation.svelte.js +142 -0
- package/dist/internal/icon-safety.d.ts +14 -0
- package/dist/internal/icon-safety.js +40 -0
- package/dist/internal/locale.d.ts +21 -0
- package/dist/internal/locale.js +43 -0
- package/dist/message.svelte.d.ts +138 -0
- package/dist/message.svelte.js +149 -0
- package/dist/messagebox.svelte.d.ts +130 -0
- package/dist/messagebox.svelte.js +171 -0
- package/dist/messages/en-US.json +297 -16
- package/dist/messages/ja-JP.json +523 -0
- package/dist/messages/zh-CN.json +297 -16
- package/dist/messages.d.ts +25 -3
- package/dist/messages.js +23 -6
- package/dist/styles/design-tokens.css +4 -2
- package/dist/styles/formal.css +55 -0
- package/dist/styles/global.css +86 -18
- package/dist/styles/guide.css +88 -0
- package/dist/styles/high-contrast.css +64 -0
- package/dist/styles/mobile.css +28 -0
- package/dist/styles/theme.css +42 -0
- package/dist/theme-config.d.ts +263 -10
- package/dist/theme-config.js +252 -17
- package/dist/toast.svelte.d.ts +210 -2
- package/dist/toast.svelte.js +296 -19
- package/dist/types.d.ts +787 -63
- package/dist/utils/platform.svelte.d.ts +28 -15
- package/dist/utils/platform.svelte.js +23 -16
- package/dist/utils.d.ts +121 -1
- package/dist/utils.js +208 -13
- package/dist/workspace-context.d.ts +20 -0
- package/dist/workspace-context.js +9 -0
- package/package.json +120 -24
- package/vite.d.ts +13 -0
- package/vite.js +96 -0
- package/dist/components/scenes/crud/CrudEditDrawer.svelte +0 -225
- package/dist/components/scenes/crud/CrudEditDrawer.svelte.d.ts +0 -48
package/dist/types.d.ts
CHANGED
|
@@ -5,30 +5,89 @@
|
|
|
5
5
|
* @module types
|
|
6
6
|
*/
|
|
7
7
|
import type { Snippet } from 'svelte';
|
|
8
|
+
/**
|
|
9
|
+
* 可转发到组件根节点或主交互节点的 data-* 属性。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import type { DataAttributeValue } from '@h-ai/ui'
|
|
14
|
+
* const example: DataAttributeValue = 'profile-save'
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type DataAttributeValue = string | number | boolean | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* 可转发到 DOM 的 data-* 字段集合;null/undefined 在转发时被忽略。
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import type { DataAttributes } from '@h-ai/ui'
|
|
24
|
+
* const example: DataAttributes = { 'data-testid': 'profile-save', 'data-loading': false }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export interface DataAttributes {
|
|
28
|
+
[key: `data-${string}`]: DataAttributeValue;
|
|
29
|
+
}
|
|
30
|
+
export type { ChartDataItem, ChartProps, ChartSeries, ChartSize, ChartType } from './components/scenes/charts/chart-types.js';
|
|
8
31
|
/**
|
|
9
32
|
* 基础变体类型
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import type { Variant } from '@h-ai/ui'
|
|
37
|
+
* const example: Variant = 'primary'
|
|
38
|
+
* ```
|
|
10
39
|
*/
|
|
11
40
|
export type Variant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'ghost' | 'link' | 'outline';
|
|
12
41
|
/**
|
|
13
42
|
* 尺寸类型
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import type { Size } from '@h-ai/ui'
|
|
47
|
+
* const example: Size = 'lg'
|
|
48
|
+
* ```
|
|
14
49
|
*/
|
|
15
50
|
export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl';
|
|
16
51
|
/**
|
|
17
52
|
* 位置类型
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import type { Position } from '@h-ai/ui'
|
|
57
|
+
* const example: Position = 'right'
|
|
58
|
+
* ```
|
|
18
59
|
*/
|
|
19
60
|
export type Position = 'top' | 'right' | 'bottom' | 'left';
|
|
20
61
|
/**
|
|
21
62
|
* 对齐类型
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import type { Alignment } from '@h-ai/ui'
|
|
67
|
+
* const example: Alignment = 'end'
|
|
68
|
+
* ```
|
|
22
69
|
*/
|
|
23
70
|
export type Alignment = 'start' | 'center' | 'end';
|
|
24
71
|
/**
|
|
25
72
|
* 按钮属性
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```svelte
|
|
76
|
+
* <script lang="ts">
|
|
77
|
+
* import { Button } from '@h-ai/ui'
|
|
78
|
+
* import type { ButtonProps } from '@h-ai/ui'
|
|
79
|
+
* const props: ButtonProps = { variant: 'primary', type: 'submit' }
|
|
80
|
+
* </script>
|
|
81
|
+
* <Button {...props}>保存</Button>
|
|
82
|
+
* ```
|
|
26
83
|
*/
|
|
27
|
-
export interface ButtonProps {
|
|
84
|
+
export interface ButtonProps extends DataAttributes {
|
|
28
85
|
/** 变体 */
|
|
29
86
|
variant?: Variant;
|
|
30
87
|
/** 尺寸 */
|
|
31
88
|
size?: Size;
|
|
89
|
+
/** 关联表单 ID */
|
|
90
|
+
form?: string;
|
|
32
91
|
/** 自定义类名 */
|
|
33
92
|
class?: string;
|
|
34
93
|
/** aria-label(无障碍标签) */
|
|
@@ -43,6 +102,8 @@ export interface ButtonProps {
|
|
|
43
102
|
circle?: boolean;
|
|
44
103
|
/** 按钮类型 */
|
|
45
104
|
type?: 'button' | 'submit' | 'reset';
|
|
105
|
+
/** type=submit 时显示原生表单 Enter 提示;不注册全局快捷键。 */
|
|
106
|
+
submitHint?: boolean;
|
|
46
107
|
/** 点击事件 */
|
|
47
108
|
onclick?: (e: MouseEvent) => void;
|
|
48
109
|
/** 子内容 */
|
|
@@ -50,8 +111,18 @@ export interface ButtonProps {
|
|
|
50
111
|
}
|
|
51
112
|
/**
|
|
52
113
|
* 无样式按钮属性
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```svelte
|
|
117
|
+
* <script lang="ts">
|
|
118
|
+
* import { BareButton } from '@h-ai/ui'
|
|
119
|
+
* import type { BareButtonProps } from '@h-ai/ui'
|
|
120
|
+
* const props: BareButtonProps = { type: 'button', ariaLabel: '关闭' }
|
|
121
|
+
* </script>
|
|
122
|
+
* <BareButton {...props}>关闭</BareButton>
|
|
123
|
+
* ```
|
|
53
124
|
*/
|
|
54
|
-
export interface BareButtonProps {
|
|
125
|
+
export interface BareButtonProps extends DataAttributes {
|
|
55
126
|
/** 按钮类型 */
|
|
56
127
|
type?: 'button' | 'submit' | 'reset';
|
|
57
128
|
/** 是否禁用 */
|
|
@@ -75,14 +146,24 @@ export interface BareButtonProps {
|
|
|
75
146
|
}
|
|
76
147
|
/**
|
|
77
148
|
* 输入框属性
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```svelte
|
|
152
|
+
* <script lang="ts">
|
|
153
|
+
* import { Input } from '@h-ai/ui'
|
|
154
|
+
* import type { InputProps } from '@h-ai/ui'
|
|
155
|
+
* const props: InputProps = { name: 'email', type: 'email', required: true }
|
|
156
|
+
* </script>
|
|
157
|
+
* <Input {...props} />
|
|
158
|
+
* ```
|
|
78
159
|
*/
|
|
79
|
-
export interface InputProps {
|
|
160
|
+
export interface InputProps extends DataAttributes {
|
|
80
161
|
/** 值 */
|
|
81
162
|
value?: string;
|
|
82
163
|
/** 占位符 */
|
|
83
164
|
placeholder?: string;
|
|
84
|
-
/**
|
|
85
|
-
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search';
|
|
165
|
+
/** 类型;datetime-local 使用浏览器本地时区,服务层应转换为明确的时间戳。 */
|
|
166
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'datetime-local';
|
|
86
167
|
/** 尺寸 */
|
|
87
168
|
size?: Size;
|
|
88
169
|
/** 是否禁用 */
|
|
@@ -92,9 +173,9 @@ export interface InputProps {
|
|
|
92
173
|
/** 是否必填 */
|
|
93
174
|
required?: boolean;
|
|
94
175
|
/** 错误消息 */
|
|
95
|
-
error?:
|
|
176
|
+
error?: FormText;
|
|
96
177
|
/** 自定义验证消息(用于覆盖浏览器原生验证提示) */
|
|
97
|
-
validationMessage?:
|
|
178
|
+
validationMessage?: FormText;
|
|
98
179
|
/** 自定义类名 */
|
|
99
180
|
class?: string;
|
|
100
181
|
/** 元素 ID */
|
|
@@ -148,9 +229,19 @@ export interface InputProps {
|
|
|
148
229
|
}
|
|
149
230
|
/**
|
|
150
231
|
* 无样式输入框属性
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```svelte
|
|
235
|
+
* <script lang="ts">
|
|
236
|
+
* import { BareInput } from '@h-ai/ui'
|
|
237
|
+
* import type { BareInputProps } from '@h-ai/ui'
|
|
238
|
+
* const props: BareInputProps = { name: 'query', type: 'search' }
|
|
239
|
+
* </script>
|
|
240
|
+
* <BareInput {...props} />
|
|
241
|
+
* ```
|
|
151
242
|
*/
|
|
152
|
-
export interface BareInputProps {
|
|
153
|
-
/**
|
|
243
|
+
export interface BareInputProps extends DataAttributes {
|
|
244
|
+
/** 文本值;file 类型通过事件读取 files,不绑定文件路径。 */
|
|
154
245
|
value?: string;
|
|
155
246
|
/** 占位符 */
|
|
156
247
|
placeholder?: string;
|
|
@@ -172,6 +263,10 @@ export interface BareInputProps {
|
|
|
172
263
|
ariaControls?: string;
|
|
173
264
|
/** aria-autocomplete */
|
|
174
265
|
ariaAutocomplete?: 'none' | 'list' | 'inline' | 'both';
|
|
266
|
+
/** 字段校验状态 */
|
|
267
|
+
ariaInvalid?: boolean;
|
|
268
|
+
/** 字段提示/错误元素 ID */
|
|
269
|
+
ariaDescribedby?: string;
|
|
175
270
|
/** 元素 ID */
|
|
176
271
|
id?: string;
|
|
177
272
|
/** input 引用 */
|
|
@@ -227,8 +322,18 @@ export interface BareInputProps {
|
|
|
227
322
|
}
|
|
228
323
|
/**
|
|
229
324
|
* 文本域属性
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```svelte
|
|
328
|
+
* <script lang="ts">
|
|
329
|
+
* import { Textarea } from '@h-ai/ui'
|
|
330
|
+
* import type { TextareaProps } from '@h-ai/ui'
|
|
331
|
+
* const props: TextareaProps = { name: 'description', rows: 4, maxlength: 500 }
|
|
332
|
+
* </script>
|
|
333
|
+
* <Textarea {...props} />
|
|
334
|
+
* ```
|
|
230
335
|
*/
|
|
231
|
-
export interface TextareaProps {
|
|
336
|
+
export interface TextareaProps extends DataAttributes {
|
|
232
337
|
/** 值 */
|
|
233
338
|
value?: string;
|
|
234
339
|
/** 占位符 */
|
|
@@ -245,10 +350,19 @@ export interface TextareaProps {
|
|
|
245
350
|
required?: boolean;
|
|
246
351
|
/** 是否自动调整高度 */
|
|
247
352
|
autoResize?: boolean;
|
|
248
|
-
inputmode?:
|
|
249
|
-
error?:
|
|
353
|
+
inputmode?: InputProps['inputmode'];
|
|
354
|
+
error?: FormText;
|
|
250
355
|
/** 自定义验证消息(用于覆盖浏览器原生验证提示) */
|
|
251
|
-
validationMessage?:
|
|
356
|
+
validationMessage?: FormText;
|
|
357
|
+
/** 最小长度 */
|
|
358
|
+
minlength?: number;
|
|
359
|
+
/** 最大长度 */
|
|
360
|
+
maxlength?: number;
|
|
361
|
+
/** 原生控件引用 */
|
|
362
|
+
textareaRef?: HTMLTextAreaElement;
|
|
363
|
+
oninvalid?: (e: Event & {
|
|
364
|
+
currentTarget: HTMLTextAreaElement;
|
|
365
|
+
}) => void;
|
|
252
366
|
/** 自定义类名 */
|
|
253
367
|
class?: string;
|
|
254
368
|
/** 元素 ID */
|
|
@@ -262,6 +376,13 @@ export interface TextareaProps {
|
|
|
262
376
|
}
|
|
263
377
|
/**
|
|
264
378
|
* 选择框选项
|
|
379
|
+
* @typeParam T - 字段值或资源条目的数据类型。
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```ts
|
|
383
|
+
* import type { SelectOption } from '@h-ai/ui'
|
|
384
|
+
* const example: SelectOption = { value: 'active', label: '启用' }
|
|
385
|
+
* ```
|
|
265
386
|
*/
|
|
266
387
|
export interface SelectOption<T = string> {
|
|
267
388
|
/** 值 */
|
|
@@ -273,11 +394,22 @@ export interface SelectOption<T = string> {
|
|
|
273
394
|
}
|
|
274
395
|
/**
|
|
275
396
|
* 选择框属性
|
|
397
|
+
* @typeParam T - 字段值或资源条目的数据类型。
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```svelte
|
|
401
|
+
* <script lang="ts">
|
|
402
|
+
* import { Select } from '@h-ai/ui'
|
|
403
|
+
* import type { SelectProps } from '@h-ai/ui'
|
|
404
|
+
* const props: SelectProps = { options: [{ value: 'active', label: '启用' }], value: 'active' }
|
|
405
|
+
* </script>
|
|
406
|
+
* <Select {...props} />
|
|
407
|
+
* ```
|
|
276
408
|
*/
|
|
277
|
-
export interface SelectProps<T = string> {
|
|
409
|
+
export interface SelectProps<T = string> extends DataAttributes {
|
|
278
410
|
/** 值 */
|
|
279
411
|
value?: T;
|
|
280
|
-
/**
|
|
412
|
+
/** 选项 */
|
|
281
413
|
options?: SelectOption<T>[];
|
|
282
414
|
/** 占位符 */
|
|
283
415
|
placeholder?: string;
|
|
@@ -287,23 +419,39 @@ export interface SelectProps<T = string> {
|
|
|
287
419
|
disabled?: boolean;
|
|
288
420
|
/** 是否必填 */
|
|
289
421
|
required?: boolean;
|
|
422
|
+
/** 是否可清空 */
|
|
423
|
+
clearable?: boolean;
|
|
424
|
+
/** 是否可筛选(启用后可在输入框内输入过滤选项) */
|
|
425
|
+
filterable?: boolean;
|
|
290
426
|
/** 错误消息 */
|
|
291
|
-
error?:
|
|
292
|
-
/**
|
|
293
|
-
validationMessage?:
|
|
427
|
+
error?: FormText;
|
|
428
|
+
/** 自定义验证提示,仅在校验失败时显示。 */
|
|
429
|
+
validationMessage?: FormText;
|
|
430
|
+
/** 表单字段名 */
|
|
431
|
+
name?: string;
|
|
294
432
|
/** 自定义类名 */
|
|
295
433
|
class?: string;
|
|
296
434
|
/** 元素 ID */
|
|
297
435
|
id?: string;
|
|
298
436
|
/** 变化事件 */
|
|
299
437
|
onchange?: (value: T) => void;
|
|
300
|
-
/** 子元素(原生 option 元素) */
|
|
301
|
-
children?: Snippet;
|
|
302
438
|
}
|
|
303
439
|
/**
|
|
304
440
|
* 复选框属性
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```svelte
|
|
444
|
+
* <script lang="ts">
|
|
445
|
+
* import { Checkbox } from '@h-ai/ui'
|
|
446
|
+
* import type { CheckboxProps } from '@h-ai/ui'
|
|
447
|
+
* const props: CheckboxProps = { label: '同意条款', checked: true }
|
|
448
|
+
* </script>
|
|
449
|
+
* <Checkbox {...props} />
|
|
450
|
+
* ```
|
|
305
451
|
*/
|
|
306
|
-
export interface CheckboxProps {
|
|
452
|
+
export interface CheckboxProps extends DataAttributes {
|
|
453
|
+
/** 元素 ID;用于 FormField 标签关联。 */
|
|
454
|
+
id?: string;
|
|
307
455
|
/** 是否选中 */
|
|
308
456
|
checked?: boolean;
|
|
309
457
|
/** 标签 */
|
|
@@ -323,8 +471,18 @@ export interface CheckboxProps {
|
|
|
323
471
|
}
|
|
324
472
|
/**
|
|
325
473
|
* 开关属性
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```svelte
|
|
477
|
+
* <script lang="ts">
|
|
478
|
+
* import { Switch } from '@h-ai/ui'
|
|
479
|
+
* import type { SwitchProps } from '@h-ai/ui'
|
|
480
|
+
* const props: SwitchProps = { label: '开启通知', checked: true }
|
|
481
|
+
* </script>
|
|
482
|
+
* <Switch {...props} />
|
|
483
|
+
* ```
|
|
326
484
|
*/
|
|
327
|
-
export interface SwitchProps {
|
|
485
|
+
export interface SwitchProps extends DataAttributes {
|
|
328
486
|
/** 是否开启 */
|
|
329
487
|
checked?: boolean;
|
|
330
488
|
/** 标签 */
|
|
@@ -340,8 +498,18 @@ export interface SwitchProps {
|
|
|
340
498
|
}
|
|
341
499
|
/**
|
|
342
500
|
* 原生开关输入(用于折叠/抽屉等结构要求 input 直系子元素的场景)
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```svelte
|
|
504
|
+
* <script lang="ts">
|
|
505
|
+
* import { ToggleCheckbox } from '@h-ai/ui'
|
|
506
|
+
* import type { ToggleCheckboxProps } from '@h-ai/ui'
|
|
507
|
+
* const props: ToggleCheckboxProps = { name: 'expanded', checked: true }
|
|
508
|
+
* </script>
|
|
509
|
+
* <ToggleCheckbox {...props} />
|
|
510
|
+
* ```
|
|
343
511
|
*/
|
|
344
|
-
export interface ToggleCheckboxProps {
|
|
512
|
+
export interface ToggleCheckboxProps extends DataAttributes {
|
|
345
513
|
/** 是否选中 */
|
|
346
514
|
checked?: boolean;
|
|
347
515
|
/** 表单字段名称 */
|
|
@@ -355,7 +523,20 @@ export interface ToggleCheckboxProps {
|
|
|
355
523
|
/** 变化事件 */
|
|
356
524
|
onchange?: (checked: boolean) => void;
|
|
357
525
|
}
|
|
358
|
-
|
|
526
|
+
/**
|
|
527
|
+
* 用于手风琴等结构的原生单选控件属性;同一 name 的选项互斥。
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```svelte
|
|
531
|
+
* <script lang="ts">
|
|
532
|
+
* import { ToggleRadio } from '@h-ai/ui'
|
|
533
|
+
* import type { ToggleRadioProps } from '@h-ai/ui'
|
|
534
|
+
* const props: ToggleRadioProps = { name: 'section', checked: true }
|
|
535
|
+
* </script>
|
|
536
|
+
* <ToggleRadio {...props} />
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
export interface ToggleRadioProps extends DataAttributes {
|
|
359
540
|
/** 是否选中 */
|
|
360
541
|
checked?: boolean;
|
|
361
542
|
/** 表单字段名称 */
|
|
@@ -371,8 +552,19 @@ export interface ToggleRadioProps {
|
|
|
371
552
|
}
|
|
372
553
|
/**
|
|
373
554
|
* 单选框属性
|
|
555
|
+
* @typeParam T - 字段值或资源条目的数据类型。
|
|
556
|
+
*
|
|
557
|
+
* @example
|
|
558
|
+
* ```svelte
|
|
559
|
+
* <script lang="ts">
|
|
560
|
+
* import { Radio } from '@h-ai/ui'
|
|
561
|
+
* import type { RadioProps } from '@h-ai/ui'
|
|
562
|
+
* const props: RadioProps = { options: [{ value: 'email', label: '邮件' }], value: 'email' }
|
|
563
|
+
* </script>
|
|
564
|
+
* <Radio {...props} />
|
|
565
|
+
* ```
|
|
374
566
|
*/
|
|
375
|
-
export interface RadioProps<T = string> {
|
|
567
|
+
export interface RadioProps<T = string> extends DataAttributes {
|
|
376
568
|
/** 值 */
|
|
377
569
|
value?: T;
|
|
378
570
|
/** 选项 */
|
|
@@ -392,8 +584,18 @@ export interface RadioProps<T = string> {
|
|
|
392
584
|
}
|
|
393
585
|
/**
|
|
394
586
|
* 徽章属性
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```svelte
|
|
590
|
+
* <script lang="ts">
|
|
591
|
+
* import { Badge } from '@h-ai/ui'
|
|
592
|
+
* import type { BadgeProps } from '@h-ai/ui'
|
|
593
|
+
* const props: BadgeProps = { variant: 'success' }
|
|
594
|
+
* </script>
|
|
595
|
+
* <Badge {...props}>已启用</Badge>
|
|
596
|
+
* ```
|
|
395
597
|
*/
|
|
396
|
-
export interface BadgeProps {
|
|
598
|
+
export interface BadgeProps extends DataAttributes {
|
|
397
599
|
/** 变体 */
|
|
398
600
|
variant?: Variant;
|
|
399
601
|
/** 尺寸 */
|
|
@@ -407,8 +609,18 @@ export interface BadgeProps {
|
|
|
407
609
|
}
|
|
408
610
|
/**
|
|
409
611
|
* 卡片属性
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```svelte
|
|
615
|
+
* <script lang="ts">
|
|
616
|
+
* import { Card } from '@h-ai/ui'
|
|
617
|
+
* import type { CardProps } from '@h-ai/ui'
|
|
618
|
+
* const props: CardProps = { title: '个人资料', bordered: true }
|
|
619
|
+
* </script>
|
|
620
|
+
* <Card {...props}>资料内容</Card>
|
|
621
|
+
* ```
|
|
410
622
|
*/
|
|
411
|
-
export interface CardProps {
|
|
623
|
+
export interface CardProps extends DataAttributes {
|
|
412
624
|
/** 标题 */
|
|
413
625
|
title?: string;
|
|
414
626
|
/** 是否有边框 */
|
|
@@ -428,20 +640,40 @@ export interface CardProps {
|
|
|
428
640
|
}
|
|
429
641
|
/**
|
|
430
642
|
* 模态框属性
|
|
643
|
+
*
|
|
644
|
+
* @example
|
|
645
|
+
* ```svelte
|
|
646
|
+
* <script lang="ts">
|
|
647
|
+
* import { Modal } from '@h-ai/ui'
|
|
648
|
+
* import type { ModalProps } from '@h-ai/ui'
|
|
649
|
+
* const props: ModalProps = { open: true, title: '编辑资料', closeOnBackdrop: false }
|
|
650
|
+
* </script>
|
|
651
|
+
* <Modal {...props}>表单内容</Modal>
|
|
652
|
+
* ```
|
|
431
653
|
*/
|
|
432
|
-
export interface ModalProps {
|
|
654
|
+
export interface ModalProps extends DataAttributes {
|
|
433
655
|
/** 是否打开 */
|
|
434
656
|
open?: boolean;
|
|
435
657
|
/** 标题 */
|
|
436
658
|
title?: string;
|
|
437
659
|
/** 尺寸 */
|
|
438
660
|
size?: Size | 'full';
|
|
661
|
+
/** 面板圆角(任意合法 CSS border-radius 值,默认 1rem) */
|
|
662
|
+
radius?: string;
|
|
439
663
|
/** 是否可通过点击遮罩关闭 */
|
|
440
664
|
closeOnBackdrop?: boolean;
|
|
441
665
|
/** 是否可通过 ESC 键关闭 */
|
|
442
666
|
closeOnEscape?: boolean;
|
|
443
667
|
/** 是否显示关闭按钮 */
|
|
444
668
|
showClose?: boolean;
|
|
669
|
+
/** 自定义宽度(任意合法 CSS 宽度值) */
|
|
670
|
+
width?: string;
|
|
671
|
+
/** 自定义高度(任意合法 CSS 高度值) */
|
|
672
|
+
height?: string;
|
|
673
|
+
/** 主体区域溢出策略。默认 auto,适合长内容;visible 适合内部浮层需要越界显示的场景。 */
|
|
674
|
+
bodyOverflow?: 'auto' | 'visible' | 'hidden';
|
|
675
|
+
/** 主体区域自定义类名 */
|
|
676
|
+
bodyClass?: string;
|
|
445
677
|
/** 自定义类名 */
|
|
446
678
|
class?: string;
|
|
447
679
|
/** 关闭事件 */
|
|
@@ -455,8 +687,18 @@ export interface ModalProps {
|
|
|
455
687
|
}
|
|
456
688
|
/**
|
|
457
689
|
* 抽屉属性
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* ```svelte
|
|
693
|
+
* <script lang="ts">
|
|
694
|
+
* import { Drawer } from '@h-ai/ui'
|
|
695
|
+
* import type { DrawerProps } from '@h-ai/ui'
|
|
696
|
+
* const props: DrawerProps = { open: true, title: '详情', position: 'right', width: '28rem' }
|
|
697
|
+
* </script>
|
|
698
|
+
* <Drawer {...props}>详情内容</Drawer>
|
|
699
|
+
* ```
|
|
458
700
|
*/
|
|
459
|
-
export interface DrawerProps {
|
|
701
|
+
export interface DrawerProps extends DataAttributes {
|
|
460
702
|
/** 是否打开 */
|
|
461
703
|
open?: boolean;
|
|
462
704
|
/** 标题 */
|
|
@@ -465,8 +707,16 @@ export interface DrawerProps {
|
|
|
465
707
|
position?: Position;
|
|
466
708
|
/** 尺寸 */
|
|
467
709
|
size?: Size;
|
|
710
|
+
/** 自定义宽度(任意合法 CSS 宽度值,优先级高于 size 预设) */
|
|
711
|
+
width?: string;
|
|
712
|
+
/** 是否允许拖动抽屉边缘调整宽度;仅 left/right 位置生效 */
|
|
713
|
+
resizable?: boolean;
|
|
714
|
+
/** 宽度持久化 key;设置后会从 localStorage 恢复并记忆拖动后的像素宽度 */
|
|
715
|
+
widthStorageKey?: string;
|
|
468
716
|
/** 是否可通过点击遮罩关闭 */
|
|
469
717
|
closeOnBackdrop?: boolean;
|
|
718
|
+
/** 是否允许 Esc 关闭;提交期间可显式关闭。 */
|
|
719
|
+
closeOnEscape?: boolean;
|
|
470
720
|
/** 是否显示关闭按钮 */
|
|
471
721
|
showClose?: boolean;
|
|
472
722
|
/** 自定义类名 */
|
|
@@ -478,8 +728,18 @@ export interface DrawerProps {
|
|
|
478
728
|
}
|
|
479
729
|
/**
|
|
480
730
|
* 提示框属性
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```svelte
|
|
734
|
+
* <script lang="ts">
|
|
735
|
+
* import { Tooltip } from '@h-ai/ui'
|
|
736
|
+
* import type { TooltipProps } from '@h-ai/ui'
|
|
737
|
+
* const props: TooltipProps = { content: '复制链接', position: 'top' }
|
|
738
|
+
* </script>
|
|
739
|
+
* <Tooltip {...props}><span>复制</span></Tooltip>
|
|
740
|
+
* ```
|
|
481
741
|
*/
|
|
482
|
-
export interface TooltipProps {
|
|
742
|
+
export interface TooltipProps extends DataAttributes {
|
|
483
743
|
/** 提示内容 */
|
|
484
744
|
content: string;
|
|
485
745
|
/** 位置 */
|
|
@@ -490,11 +750,26 @@ export interface TooltipProps {
|
|
|
490
750
|
class?: string;
|
|
491
751
|
/** 触发元素插槽 */
|
|
492
752
|
children?: Snippet;
|
|
753
|
+
/**
|
|
754
|
+
* 启用 portal 模式:提示内容通过 document.body 渲染,
|
|
755
|
+
* 不受父容器 overflow 裁剪。适用于表格、滚动容器等场景。
|
|
756
|
+
*/
|
|
757
|
+
portal?: boolean;
|
|
493
758
|
}
|
|
494
759
|
/**
|
|
495
760
|
* 加载属性
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```svelte
|
|
764
|
+
* <script lang="ts">
|
|
765
|
+
* import { Spinner } from '@h-ai/ui'
|
|
766
|
+
* import type { SpinnerProps } from '@h-ai/ui'
|
|
767
|
+
* const props: SpinnerProps = { size: 'sm', variant: 'primary' }
|
|
768
|
+
* </script>
|
|
769
|
+
* <Spinner {...props} />
|
|
770
|
+
* ```
|
|
496
771
|
*/
|
|
497
|
-
export interface SpinnerProps {
|
|
772
|
+
export interface SpinnerProps extends DataAttributes {
|
|
498
773
|
/** 尺寸 */
|
|
499
774
|
size?: Size;
|
|
500
775
|
/** 变体 */
|
|
@@ -504,9 +779,19 @@ export interface SpinnerProps {
|
|
|
504
779
|
}
|
|
505
780
|
/**
|
|
506
781
|
* 进度条属性
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* ```svelte
|
|
785
|
+
* <script lang="ts">
|
|
786
|
+
* import { Progress } from '@h-ai/ui'
|
|
787
|
+
* import type { ProgressProps } from '@h-ai/ui'
|
|
788
|
+
* const props: ProgressProps = { value: 65, max: 100, showLabel: true }
|
|
789
|
+
* </script>
|
|
790
|
+
* <Progress {...props} />
|
|
791
|
+
* ```
|
|
507
792
|
*/
|
|
508
|
-
export interface ProgressProps {
|
|
509
|
-
/**
|
|
793
|
+
export interface ProgressProps extends DataAttributes {
|
|
794
|
+
/** 当前进度值,按 max 解释;max 默认 100。 */
|
|
510
795
|
value: number;
|
|
511
796
|
/** 最大值 */
|
|
512
797
|
max?: number;
|
|
@@ -527,10 +812,20 @@ export interface ProgressProps {
|
|
|
527
812
|
}
|
|
528
813
|
/**
|
|
529
814
|
* 警告框属性
|
|
815
|
+
*
|
|
816
|
+
* @example
|
|
817
|
+
* ```svelte
|
|
818
|
+
* <script lang="ts">
|
|
819
|
+
* import { Alert } from '@h-ai/ui'
|
|
820
|
+
* import type { AlertProps } from '@h-ai/ui'
|
|
821
|
+
* const props: AlertProps = { title: '保存成功', variant: 'success' }
|
|
822
|
+
* </script>
|
|
823
|
+
* <Alert {...props}>操作已经完成。</Alert>
|
|
824
|
+
* ```
|
|
530
825
|
*/
|
|
531
|
-
export interface AlertProps {
|
|
532
|
-
/**
|
|
533
|
-
variant?:
|
|
826
|
+
export interface AlertProps extends DataAttributes {
|
|
827
|
+
/** 持续信息的变体;警告和错误统一使用 toast / ToastContainer。 */
|
|
828
|
+
variant?: 'info' | 'success';
|
|
534
829
|
/** 标题 */
|
|
535
830
|
title?: string;
|
|
536
831
|
/** 是否可关闭 */
|
|
@@ -544,15 +839,26 @@ export interface AlertProps {
|
|
|
544
839
|
}
|
|
545
840
|
/**
|
|
546
841
|
* Toast 属性
|
|
842
|
+
*
|
|
843
|
+
* @example
|
|
844
|
+
* ```ts
|
|
845
|
+
* import { toast } from '@h-ai/ui'
|
|
846
|
+
* import type { ToastProps } from '@h-ai/ui'
|
|
847
|
+
* const options: ToastProps = { message: '保存完成', variant: 'success', duration: 3000 }
|
|
848
|
+
* const id = toast.add(options)
|
|
849
|
+
* toast.remove(id)
|
|
850
|
+
* ```
|
|
547
851
|
*/
|
|
548
|
-
export interface ToastProps {
|
|
852
|
+
export interface ToastProps extends DataAttributes {
|
|
549
853
|
/** 消息 */
|
|
550
854
|
message: string;
|
|
855
|
+
/** 问题追踪编号;默认隐藏,用户展开排查信息后可查看和复制,不传入敏感信息。 */
|
|
856
|
+
traceId?: string;
|
|
551
857
|
/** 变体 */
|
|
552
858
|
variant?: Variant;
|
|
553
|
-
/**
|
|
859
|
+
/** 展示后的持续时间 (ms),默认 3000;排队、悬停、聚焦或展开排查信息时暂停,0 为不自动关闭 */
|
|
554
860
|
duration?: number;
|
|
555
|
-
/**
|
|
861
|
+
/** 浮动位置,默认 bottom-right;多个提示按加入顺序逐条显示 */
|
|
556
862
|
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
|
|
557
863
|
/** 是否可关闭 */
|
|
558
864
|
dismissible?: boolean;
|
|
@@ -561,8 +867,18 @@ export interface ToastProps {
|
|
|
561
867
|
}
|
|
562
868
|
/**
|
|
563
869
|
* 分页属性
|
|
870
|
+
*
|
|
871
|
+
* @example
|
|
872
|
+
* ```svelte
|
|
873
|
+
* <script lang="ts">
|
|
874
|
+
* import { Pagination } from '@h-ai/ui'
|
|
875
|
+
* import type { PaginationProps } from '@h-ai/ui'
|
|
876
|
+
* const props: PaginationProps = { page: 1, total: 42, pageSize: 10 }
|
|
877
|
+
* </script>
|
|
878
|
+
* <Pagination {...props} />
|
|
879
|
+
* ```
|
|
564
880
|
*/
|
|
565
|
-
export interface PaginationProps {
|
|
881
|
+
export interface PaginationProps extends DataAttributes {
|
|
566
882
|
/** 当前页 */
|
|
567
883
|
page: number;
|
|
568
884
|
/** 总数 */
|
|
@@ -575,6 +891,14 @@ export interface PaginationProps {
|
|
|
575
891
|
showTotal?: boolean;
|
|
576
892
|
/** 是否显示跳转 */
|
|
577
893
|
showJumper?: boolean;
|
|
894
|
+
/** 是否显示每页条数选择器 */
|
|
895
|
+
showSizeChanger?: boolean;
|
|
896
|
+
/** 是否显示页码信息文案(如「第 1 / 5 页」,默认 true;紧凑视图可关闭) */
|
|
897
|
+
showPageInfo?: boolean;
|
|
898
|
+
/** 是否显示首页 / 末页跳转按钮(默认 true;紧凑视图可仅保留上一页 / 下一页) */
|
|
899
|
+
showFirstLast?: boolean;
|
|
900
|
+
/** 每页条数候选项(配合 showSizeChanger,默认 [10, 20, 50, 100]) */
|
|
901
|
+
pageSizeOptions?: number[];
|
|
578
902
|
/** i18n 文案配置 */
|
|
579
903
|
labels?: {
|
|
580
904
|
/** 总数文案,{count} 会被替换为实际数字 */
|
|
@@ -583,14 +907,28 @@ export interface PaginationProps {
|
|
|
583
907
|
jumpTo?: string;
|
|
584
908
|
/** 页 */
|
|
585
909
|
page?: string;
|
|
910
|
+
/** 每页条数文案,{size} 会被替换为实际数字 */
|
|
911
|
+
pageSize?: string;
|
|
912
|
+
/** 每页条数前缀文案(如「每页」/「Rows per page」) */
|
|
913
|
+
rowsPerPage?: string;
|
|
914
|
+
/** 页码信息文案,{page} / {total} 会被替换(如「第 {page} / {total} 页」) */
|
|
915
|
+
pageInfo?: string;
|
|
586
916
|
};
|
|
587
917
|
/** 自定义类名 */
|
|
588
918
|
class?: string;
|
|
589
919
|
/** 页码变化事件 */
|
|
590
920
|
onchange?: (page: number) => void;
|
|
921
|
+
/** 每页条数变化事件 */
|
|
922
|
+
onpagesizechange?: (pageSize: number) => void;
|
|
591
923
|
}
|
|
592
924
|
/**
|
|
593
925
|
* 面包屑项
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* ```ts
|
|
929
|
+
* import type { BreadcrumbItem } from '@h-ai/ui'
|
|
930
|
+
* const example: BreadcrumbItem = { label: '设置', href: '/settings' }
|
|
931
|
+
* ```
|
|
594
932
|
*/
|
|
595
933
|
export interface BreadcrumbItem {
|
|
596
934
|
/** 显示文本 */
|
|
@@ -602,8 +940,18 @@ export interface BreadcrumbItem {
|
|
|
602
940
|
}
|
|
603
941
|
/**
|
|
604
942
|
* 面包屑属性
|
|
943
|
+
*
|
|
944
|
+
* @example
|
|
945
|
+
* ```svelte
|
|
946
|
+
* <script lang="ts">
|
|
947
|
+
* import { Breadcrumb } from '@h-ai/ui'
|
|
948
|
+
* import type { BreadcrumbProps } from '@h-ai/ui'
|
|
949
|
+
* const props: BreadcrumbProps = { items: [{ label: '首页', href: '/' }, { label: '设置' }] }
|
|
950
|
+
* </script>
|
|
951
|
+
* <Breadcrumb {...props} />
|
|
952
|
+
* ```
|
|
605
953
|
*/
|
|
606
|
-
export interface BreadcrumbProps {
|
|
954
|
+
export interface BreadcrumbProps extends DataAttributes {
|
|
607
955
|
/** 项目 */
|
|
608
956
|
items: BreadcrumbItem[];
|
|
609
957
|
/** 分隔符 */
|
|
@@ -613,6 +961,12 @@ export interface BreadcrumbProps {
|
|
|
613
961
|
}
|
|
614
962
|
/**
|
|
615
963
|
* 标签页项
|
|
964
|
+
*
|
|
965
|
+
* @example
|
|
966
|
+
* ```ts
|
|
967
|
+
* import type { TabItem } from '@h-ai/ui'
|
|
968
|
+
* const example: TabItem = { key: 'security', label: '安全' }
|
|
969
|
+
* ```
|
|
616
970
|
*/
|
|
617
971
|
export interface TabItem {
|
|
618
972
|
/** 唯一标识 */
|
|
@@ -624,10 +978,38 @@ export interface TabItem {
|
|
|
624
978
|
/** 图标 */
|
|
625
979
|
icon?: string;
|
|
626
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* 标签页内容上下文
|
|
983
|
+
*
|
|
984
|
+
* 传给 `Tabs` 的 `children` 插槽,支持惰性挂载:只渲染已激活过的页签内容,
|
|
985
|
+
* 不预加载不可见页签。
|
|
986
|
+
*
|
|
987
|
+
* @example
|
|
988
|
+
* ```ts
|
|
989
|
+
* import type { TabsContentContext } from '@h-ai/ui'
|
|
990
|
+
* const example: TabsContentContext = { active: 'profile', isActivated: key => key === 'profile' }
|
|
991
|
+
* ```
|
|
992
|
+
*/
|
|
993
|
+
export interface TabsContentContext {
|
|
994
|
+
/** 当前激活的标签 key */
|
|
995
|
+
active: string;
|
|
996
|
+
/** 指定标签是否已被激活过(`lazy` 为 false 时恒为 true) */
|
|
997
|
+
isActivated: (key: string) => boolean;
|
|
998
|
+
}
|
|
627
999
|
/**
|
|
628
1000
|
* 标签页属性
|
|
1001
|
+
*
|
|
1002
|
+
* @example
|
|
1003
|
+
* ```svelte
|
|
1004
|
+
* <script lang="ts">
|
|
1005
|
+
* import { Tabs } from '@h-ai/ui'
|
|
1006
|
+
* import type { TabsProps } from '@h-ai/ui'
|
|
1007
|
+
* const props: TabsProps = { items: [{ key: 'profile', label: '资料' }, { key: 'security', label: '安全' }], active: 'profile', lazy: true }
|
|
1008
|
+
* </script>
|
|
1009
|
+
* <Tabs {...props} />
|
|
1010
|
+
* ```
|
|
629
1011
|
*/
|
|
630
|
-
export interface TabsProps {
|
|
1012
|
+
export interface TabsProps extends DataAttributes {
|
|
631
1013
|
/** 标签项 */
|
|
632
1014
|
items: TabItem[];
|
|
633
1015
|
/** 当前激活的标签 */
|
|
@@ -640,13 +1022,27 @@ export interface TabsProps {
|
|
|
640
1022
|
class?: string;
|
|
641
1023
|
/** 变化事件 */
|
|
642
1024
|
onchange?: (key: string) => void;
|
|
643
|
-
/**
|
|
644
|
-
|
|
1025
|
+
/** 页签首次激活时触发一次;用于惰性加载对应内容(如调用控制器的 load) */
|
|
1026
|
+
onactivate?: (key: string) => void;
|
|
1027
|
+
/** 是否惰性挂载页签内容:为 true 时未激活过的页签不渲染,`isActivated` 据此判断 */
|
|
1028
|
+
lazy?: boolean;
|
|
1029
|
+
/** 内容插槽;参数提供当前激活项与惰性挂载判断 */
|
|
1030
|
+
children?: Snippet<[TabsContentContext]>;
|
|
645
1031
|
}
|
|
646
1032
|
/**
|
|
647
1033
|
* 头像属性
|
|
1034
|
+
*
|
|
1035
|
+
* @example
|
|
1036
|
+
* ```svelte
|
|
1037
|
+
* <script lang="ts">
|
|
1038
|
+
* import { Avatar } from '@h-ai/ui'
|
|
1039
|
+
* import type { AvatarProps } from '@h-ai/ui'
|
|
1040
|
+
* const props: AvatarProps = { name: 'Ada', alt: '用户头像', size: 'md' }
|
|
1041
|
+
* </script>
|
|
1042
|
+
* <Avatar {...props} />
|
|
1043
|
+
* ```
|
|
648
1044
|
*/
|
|
649
|
-
export interface AvatarProps {
|
|
1045
|
+
export interface AvatarProps extends DataAttributes {
|
|
650
1046
|
/** 图片地址 */
|
|
651
1047
|
src?: string;
|
|
652
1048
|
/** 替代文本 */
|
|
@@ -666,6 +1062,12 @@ export interface AvatarProps {
|
|
|
666
1062
|
}
|
|
667
1063
|
/**
|
|
668
1064
|
* 下拉菜单项
|
|
1065
|
+
*
|
|
1066
|
+
* @example
|
|
1067
|
+
* ```ts
|
|
1068
|
+
* import type { DropdownItem } from '@h-ai/ui'
|
|
1069
|
+
* const example: DropdownItem = { key: 'edit', label: '编辑' }
|
|
1070
|
+
* ```
|
|
669
1071
|
*/
|
|
670
1072
|
export interface DropdownItem {
|
|
671
1073
|
/** 唯一标识 */
|
|
@@ -681,18 +1083,30 @@ export interface DropdownItem {
|
|
|
681
1083
|
}
|
|
682
1084
|
/**
|
|
683
1085
|
* 下拉菜单属性
|
|
1086
|
+
*
|
|
1087
|
+
* @example
|
|
1088
|
+
* ```svelte
|
|
1089
|
+
* <script lang="ts">
|
|
1090
|
+
* import { Dropdown } from '@h-ai/ui'
|
|
1091
|
+
* import type { DropdownProps } from '@h-ai/ui'
|
|
1092
|
+
* const props: DropdownProps = { items: [{ key: 'edit', label: '编辑' }], position: 'bottom' }
|
|
1093
|
+
* </script>
|
|
1094
|
+
* <Dropdown {...props} />
|
|
1095
|
+
* ```
|
|
684
1096
|
*/
|
|
685
|
-
export interface DropdownProps {
|
|
1097
|
+
export interface DropdownProps extends DataAttributes {
|
|
686
1098
|
/** 菜单项 */
|
|
687
1099
|
items: DropdownItem[];
|
|
688
|
-
/**
|
|
689
|
-
trigger?: 'click' | 'hover';
|
|
1100
|
+
/** 触发方式;`manual` 由外部完全控制 open 状态。 */
|
|
1101
|
+
trigger?: 'click' | 'hover' | 'manual';
|
|
690
1102
|
/** 位置 */
|
|
691
1103
|
position?: Position;
|
|
692
1104
|
/** 对齐 */
|
|
693
1105
|
align?: Alignment;
|
|
694
1106
|
/** 自定义类名 */
|
|
695
1107
|
class?: string;
|
|
1108
|
+
/** 触发按钮类名 */
|
|
1109
|
+
triggerClass?: string;
|
|
696
1110
|
/** 选择事件 */
|
|
697
1111
|
onselect?: (key: string) => void;
|
|
698
1112
|
/** 触发元素插槽 */
|
|
@@ -701,7 +1115,86 @@ export interface DropdownProps {
|
|
|
701
1115
|
/**
|
|
702
1116
|
* 表单属性
|
|
703
1117
|
*/
|
|
704
|
-
|
|
1118
|
+
/**
|
|
1119
|
+
* 表单标签位置:独立成行或与控件同行。
|
|
1120
|
+
*
|
|
1121
|
+
* @example
|
|
1122
|
+
* ```ts
|
|
1123
|
+
* import type { FormLabelPosition } from '@h-ai/ui'
|
|
1124
|
+
* const example: FormLabelPosition = 'top'
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
export type FormLabelPosition = 'top' | 'left';
|
|
1128
|
+
/**
|
|
1129
|
+
* 双列表单字段占用列数;auto 根据控件类型判断。
|
|
1130
|
+
*
|
|
1131
|
+
* @example
|
|
1132
|
+
* ```ts
|
|
1133
|
+
* import type { FormColSpan } from '@h-ai/ui'
|
|
1134
|
+
* const example: FormColSpan = 2
|
|
1135
|
+
* ```
|
|
1136
|
+
*/
|
|
1137
|
+
export type FormColSpan = 'auto' | 1 | 2;
|
|
1138
|
+
/**
|
|
1139
|
+
* 支持延迟求值的表单文案,切换语言时重新解析。
|
|
1140
|
+
*
|
|
1141
|
+
* @example
|
|
1142
|
+
* ```ts
|
|
1143
|
+
* import type { FormText } from '@h-ai/ui'
|
|
1144
|
+
* const example: FormText = () => '邮箱不能为空'
|
|
1145
|
+
* ```
|
|
1146
|
+
*/
|
|
1147
|
+
export type FormText = string | (() => string);
|
|
1148
|
+
/**
|
|
1149
|
+
* 表单布局配置;窄容器自动收为单列。
|
|
1150
|
+
*
|
|
1151
|
+
* @example
|
|
1152
|
+
* ```ts
|
|
1153
|
+
* import type { FormLayoutOptions } from '@h-ai/ui'
|
|
1154
|
+
* const example: FormLayoutOptions = { columns: 2, labelPosition: 'top', labelWidth: '8rem' }
|
|
1155
|
+
* ```
|
|
1156
|
+
*/
|
|
1157
|
+
export interface FormLayoutOptions {
|
|
1158
|
+
/** 字段列数,默认 1。 */
|
|
1159
|
+
columns?: 1 | 2;
|
|
1160
|
+
/** 标签位置,默认 top。 */
|
|
1161
|
+
labelPosition?: FormLabelPosition;
|
|
1162
|
+
/** 同行标签宽度(CSS 值),默认 8rem。 */
|
|
1163
|
+
labelWidth?: string;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* 可嵌入原生 form 的布局容器。
|
|
1167
|
+
*
|
|
1168
|
+
* @example
|
|
1169
|
+
* ```svelte
|
|
1170
|
+
* <script lang="ts">
|
|
1171
|
+
* import { FormLayout } from '@h-ai/ui'
|
|
1172
|
+
* import type { FormLayoutProps } from '@h-ai/ui'
|
|
1173
|
+
* const props: FormLayoutProps = { columns: 2, labelPosition: 'top' }
|
|
1174
|
+
* </script>
|
|
1175
|
+
* <FormLayout {...props}><span>表单字段</span></FormLayout>
|
|
1176
|
+
* ```
|
|
1177
|
+
*/
|
|
1178
|
+
export interface FormLayoutProps extends FormLayoutOptions, DataAttributes {
|
|
1179
|
+
class?: string;
|
|
1180
|
+
children?: Snippet;
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* 表单容器属性;接管提交和重置,并向后代提供布局与禁用状态。
|
|
1184
|
+
*
|
|
1185
|
+
* @example
|
|
1186
|
+
* ```svelte
|
|
1187
|
+
* <script lang="ts">
|
|
1188
|
+
* import { Form } from '@h-ai/ui'
|
|
1189
|
+
* import type { FormProps } from '@h-ai/ui'
|
|
1190
|
+
* const props: FormProps = { id: 'profile-form', columns: 2 }
|
|
1191
|
+
* </script>
|
|
1192
|
+
* <Form {...props}><input name="email" type="email" value="ada@example.com" /></Form>
|
|
1193
|
+
* ```
|
|
1194
|
+
*/
|
|
1195
|
+
export interface FormProps extends FormLayoutOptions, DataAttributes {
|
|
1196
|
+
/** 表单 ID */
|
|
1197
|
+
id?: string;
|
|
705
1198
|
/** 自定义类名 */
|
|
706
1199
|
class?: string;
|
|
707
1200
|
/** 加载状态 */
|
|
@@ -719,16 +1212,34 @@ export interface FormProps {
|
|
|
719
1212
|
}
|
|
720
1213
|
/**
|
|
721
1214
|
* 表单字段属性
|
|
1215
|
+
*
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```svelte
|
|
1218
|
+
* <script lang="ts">
|
|
1219
|
+
* import { FormField } from '@h-ai/ui'
|
|
1220
|
+
* import type { FormFieldProps } from '@h-ai/ui'
|
|
1221
|
+
* const props: FormFieldProps = { label: '邮箱', name: 'email', required: true }
|
|
1222
|
+
* </script>
|
|
1223
|
+
* <FormField {...props}><input name="email" type="email" /></FormField>
|
|
1224
|
+
* ```
|
|
722
1225
|
*/
|
|
723
|
-
export interface FormFieldProps {
|
|
1226
|
+
export interface FormFieldProps extends DataAttributes {
|
|
724
1227
|
/** 标签 */
|
|
725
|
-
label?:
|
|
1228
|
+
label?: FormText;
|
|
1229
|
+
/** 关联控件 ID;省略时为内部控件自动提供唯一 ID。 */
|
|
1230
|
+
for?: string;
|
|
1231
|
+
/** 覆盖所在表单的标签位置。 */
|
|
1232
|
+
labelPosition?: FormLabelPosition;
|
|
1233
|
+
/** 覆盖所在表单的同行标签宽度。 */
|
|
1234
|
+
labelWidth?: string;
|
|
1235
|
+
/** 双列时的占用列数,默认 auto;多行文本、上传和多选自动占两列。 */
|
|
1236
|
+
colSpan?: FormColSpan;
|
|
726
1237
|
/** 字段名 */
|
|
727
1238
|
name?: string;
|
|
728
1239
|
/** 错误消息 */
|
|
729
|
-
error?:
|
|
1240
|
+
error?: FormText;
|
|
730
1241
|
/** 提示信息 */
|
|
731
|
-
hint?:
|
|
1242
|
+
hint?: FormText;
|
|
732
1243
|
/** 是否必填 */
|
|
733
1244
|
required?: boolean;
|
|
734
1245
|
/** 自定义类名 */
|
|
@@ -738,8 +1249,18 @@ export interface FormFieldProps {
|
|
|
738
1249
|
}
|
|
739
1250
|
/**
|
|
740
1251
|
* 骨架屏属性
|
|
1252
|
+
*
|
|
1253
|
+
* @example
|
|
1254
|
+
* ```svelte
|
|
1255
|
+
* <script lang="ts">
|
|
1256
|
+
* import { Skeleton } from '@h-ai/ui'
|
|
1257
|
+
* import type { SkeletonProps } from '@h-ai/ui'
|
|
1258
|
+
* const props: SkeletonProps = { variant: 'text', count: 3 }
|
|
1259
|
+
* </script>
|
|
1260
|
+
* <Skeleton {...props} />
|
|
1261
|
+
* ```
|
|
741
1262
|
*/
|
|
742
|
-
export interface SkeletonProps {
|
|
1263
|
+
export interface SkeletonProps extends DataAttributes {
|
|
743
1264
|
/** 变体 */
|
|
744
1265
|
variant?: 'text' | 'title' | 'avatar' | 'thumbnail' | 'button' | 'input';
|
|
745
1266
|
/** 宽度 */
|
|
@@ -757,8 +1278,18 @@ export interface SkeletonProps {
|
|
|
757
1278
|
}
|
|
758
1279
|
/**
|
|
759
1280
|
* 空状态属性
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
* ```svelte
|
|
1284
|
+
* <script lang="ts">
|
|
1285
|
+
* import { Empty } from '@h-ai/ui'
|
|
1286
|
+
* import type { EmptyProps } from '@h-ai/ui'
|
|
1287
|
+
* const props: EmptyProps = { title: '暂无记录', icon: 'inbox' }
|
|
1288
|
+
* </script>
|
|
1289
|
+
* <Empty {...props} />
|
|
1290
|
+
* ```
|
|
760
1291
|
*/
|
|
761
|
-
export interface EmptyProps {
|
|
1292
|
+
export interface EmptyProps extends DataAttributes {
|
|
762
1293
|
/** 标题 */
|
|
763
1294
|
title?: string;
|
|
764
1295
|
/** 描述 */
|
|
@@ -774,10 +1305,47 @@ export interface EmptyProps {
|
|
|
774
1305
|
/** 自定义图标插槽 */
|
|
775
1306
|
children?: Snippet;
|
|
776
1307
|
}
|
|
1308
|
+
/**
|
|
1309
|
+
* JSON 查看器属性
|
|
1310
|
+
*
|
|
1311
|
+
* @example
|
|
1312
|
+
* ```svelte
|
|
1313
|
+
* <script lang="ts">
|
|
1314
|
+
* import { JsonViewer } from '@h-ai/ui'
|
|
1315
|
+
* import type { JsonViewerProps } from '@h-ai/ui'
|
|
1316
|
+
* const props: JsonViewerProps = { value: { name: 'wf', nested: { list: [1, 2] } } }
|
|
1317
|
+
* </script>
|
|
1318
|
+
* <JsonViewer {...props} />
|
|
1319
|
+
* ```
|
|
1320
|
+
*/
|
|
1321
|
+
export interface JsonViewerProps extends DataAttributes {
|
|
1322
|
+
/** 要展示的 JSON 数据;循环引用自动替换为占位符 */
|
|
1323
|
+
value: unknown;
|
|
1324
|
+
/** 初始展开深度;0 表示全部折叠,1 展开顶层容器 */
|
|
1325
|
+
defaultExpandedDepth?: number;
|
|
1326
|
+
/** 标量文本截断长度;超出部分以省略号结尾 */
|
|
1327
|
+
maxScalarLength?: number;
|
|
1328
|
+
/** 是否显示复制按钮 */
|
|
1329
|
+
showCopy?: boolean;
|
|
1330
|
+
/** 自定义类名 */
|
|
1331
|
+
class?: string;
|
|
1332
|
+
/** 复制成功后的回调,参数为复制的格式化 JSON 文本 */
|
|
1333
|
+
onCopy?: (text: string) => void;
|
|
1334
|
+
}
|
|
777
1335
|
/**
|
|
778
1336
|
* 结果页属性
|
|
1337
|
+
*
|
|
1338
|
+
* @example
|
|
1339
|
+
* ```svelte
|
|
1340
|
+
* <script lang="ts">
|
|
1341
|
+
* import { Result } from '@h-ai/ui'
|
|
1342
|
+
* import type { ResultProps } from '@h-ai/ui'
|
|
1343
|
+
* const props: ResultProps = { status: 'success', title: '提交完成' }
|
|
1344
|
+
* </script>
|
|
1345
|
+
* <Result {...props} />
|
|
1346
|
+
* ```
|
|
779
1347
|
*/
|
|
780
|
-
export interface ResultProps {
|
|
1348
|
+
export interface ResultProps extends DataAttributes {
|
|
781
1349
|
/** 状态 */
|
|
782
1350
|
status?: 'success' | 'error' | 'warning' | 'info';
|
|
783
1351
|
/** 标题 */
|
|
@@ -795,8 +1363,18 @@ export interface ResultProps {
|
|
|
795
1363
|
}
|
|
796
1364
|
/**
|
|
797
1365
|
* 确认对话框属性
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* ```svelte
|
|
1369
|
+
* <script lang="ts">
|
|
1370
|
+
* import { Confirm } from '@h-ai/ui'
|
|
1371
|
+
* import type { ConfirmProps } from '@h-ai/ui'
|
|
1372
|
+
* const props: ConfirmProps = { open: true, title: '删除记录', message: '确定删除这条记录?', variant: 'warning' }
|
|
1373
|
+
* </script>
|
|
1374
|
+
* <Confirm {...props} />
|
|
1375
|
+
* ```
|
|
798
1376
|
*/
|
|
799
|
-
export interface ConfirmProps {
|
|
1377
|
+
export interface ConfirmProps extends DataAttributes {
|
|
800
1378
|
/** 是否打开 */
|
|
801
1379
|
open?: boolean;
|
|
802
1380
|
/** 标题 */
|
|
@@ -820,8 +1398,18 @@ export interface ConfirmProps {
|
|
|
820
1398
|
}
|
|
821
1399
|
/**
|
|
822
1400
|
* 标签属性
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* ```svelte
|
|
1404
|
+
* <script lang="ts">
|
|
1405
|
+
* import { Tag } from '@h-ai/ui'
|
|
1406
|
+
* import type { TagProps } from '@h-ai/ui'
|
|
1407
|
+
* const props: TagProps = { text: '已启用', variant: 'success', closable: true }
|
|
1408
|
+
* </script>
|
|
1409
|
+
* <Tag {...props} />
|
|
1410
|
+
* ```
|
|
823
1411
|
*/
|
|
824
|
-
export interface TagProps {
|
|
1412
|
+
export interface TagProps extends DataAttributes {
|
|
825
1413
|
/** 文本 */
|
|
826
1414
|
text?: string;
|
|
827
1415
|
/** 变体 */
|
|
@@ -843,8 +1431,18 @@ export interface TagProps {
|
|
|
843
1431
|
}
|
|
844
1432
|
/**
|
|
845
1433
|
* 标签输入框属性
|
|
1434
|
+
*
|
|
1435
|
+
* @example
|
|
1436
|
+
* ```svelte
|
|
1437
|
+
* <script lang="ts">
|
|
1438
|
+
* import { TagInput } from '@h-ai/ui'
|
|
1439
|
+
* import type { TagInputProps } from '@h-ai/ui'
|
|
1440
|
+
* const props: TagInputProps = { tags: ['Svelte'], maxTags: 5 }
|
|
1441
|
+
* </script>
|
|
1442
|
+
* <TagInput {...props} />
|
|
1443
|
+
* ```
|
|
846
1444
|
*/
|
|
847
|
-
export interface TagInputProps {
|
|
1445
|
+
export interface TagInputProps extends DataAttributes {
|
|
848
1446
|
/** 标签列表 */
|
|
849
1447
|
tags?: string[];
|
|
850
1448
|
/** 占位符 */
|
|
@@ -864,6 +1462,12 @@ export interface TagInputProps {
|
|
|
864
1462
|
}
|
|
865
1463
|
/**
|
|
866
1464
|
* 步骤项
|
|
1465
|
+
*
|
|
1466
|
+
* @example
|
|
1467
|
+
* ```ts
|
|
1468
|
+
* import type { StepItem } from '@h-ai/ui'
|
|
1469
|
+
* const example: StepItem = { title: '确认资料', description: '核对后提交' }
|
|
1470
|
+
* ```
|
|
867
1471
|
*/
|
|
868
1472
|
export interface StepItem {
|
|
869
1473
|
/** 标题 */
|
|
@@ -875,8 +1479,18 @@ export interface StepItem {
|
|
|
875
1479
|
}
|
|
876
1480
|
/**
|
|
877
1481
|
* 步骤条属性
|
|
1482
|
+
*
|
|
1483
|
+
* @example
|
|
1484
|
+
* ```svelte
|
|
1485
|
+
* <script lang="ts">
|
|
1486
|
+
* import { Steps } from '@h-ai/ui'
|
|
1487
|
+
* import type { StepsProps } from '@h-ai/ui'
|
|
1488
|
+
* const props: StepsProps = { items: [{ title: '填写资料' }, { title: '确认' }], current: 0 }
|
|
1489
|
+
* </script>
|
|
1490
|
+
* <Steps {...props} />
|
|
1491
|
+
* ```
|
|
878
1492
|
*/
|
|
879
|
-
export interface StepsProps {
|
|
1493
|
+
export interface StepsProps extends DataAttributes {
|
|
880
1494
|
/** 步骤列表 */
|
|
881
1495
|
items?: StepItem[];
|
|
882
1496
|
/** 当前步骤 */
|
|
@@ -894,9 +1508,19 @@ export interface StepsProps {
|
|
|
894
1508
|
}
|
|
895
1509
|
/**
|
|
896
1510
|
* 图标按钮属性
|
|
1511
|
+
*
|
|
1512
|
+
* @example
|
|
1513
|
+
* ```svelte
|
|
1514
|
+
* <script lang="ts">
|
|
1515
|
+
* import { IconButton } from '@h-ai/ui'
|
|
1516
|
+
* import type { IconButtonProps } from '@h-ai/ui'
|
|
1517
|
+
* const props: IconButtonProps = { label: '关闭', tooltip: '关闭面板' }
|
|
1518
|
+
* </script>
|
|
1519
|
+
* <IconButton {...props}>×</IconButton>
|
|
1520
|
+
* ```
|
|
897
1521
|
*/
|
|
898
|
-
export interface IconButtonProps {
|
|
899
|
-
/**
|
|
1522
|
+
export interface IconButtonProps extends DataAttributes {
|
|
1523
|
+
/** 图标(受信任的内联 SVG 字符串或 Snippet) */
|
|
900
1524
|
icon?: string | Snippet;
|
|
901
1525
|
/** 标签(无障碍) */
|
|
902
1526
|
label?: string;
|
|
@@ -921,8 +1545,18 @@ export interface IconButtonProps {
|
|
|
921
1545
|
}
|
|
922
1546
|
/**
|
|
923
1547
|
* 弹出层属性
|
|
1548
|
+
*
|
|
1549
|
+
* @example
|
|
1550
|
+
* ```svelte
|
|
1551
|
+
* <script lang="ts">
|
|
1552
|
+
* import { Popover } from '@h-ai/ui'
|
|
1553
|
+
* import type { PopoverProps } from '@h-ai/ui'
|
|
1554
|
+
* const props: PopoverProps = { position: 'bottom', portal: true }
|
|
1555
|
+
* </script>
|
|
1556
|
+
* <Popover {...props}>提示内容</Popover>
|
|
1557
|
+
* ```
|
|
924
1558
|
*/
|
|
925
|
-
export interface PopoverProps {
|
|
1559
|
+
export interface PopoverProps extends DataAttributes {
|
|
926
1560
|
/** 是否打开 */
|
|
927
1561
|
open?: boolean;
|
|
928
1562
|
/** 位置 */
|
|
@@ -931,6 +1565,8 @@ export interface PopoverProps {
|
|
|
931
1565
|
trigger?: 'click' | 'hover';
|
|
932
1566
|
/** 偏移量 */
|
|
933
1567
|
offset?: number;
|
|
1568
|
+
/** 是否将内容挂到 body,以逃逸祖先 overflow 和堆叠上下文。 */
|
|
1569
|
+
portal?: boolean;
|
|
934
1570
|
/** 自定义类名 */
|
|
935
1571
|
class?: string;
|
|
936
1572
|
/** 打开事件 */
|
|
@@ -942,3 +1578,91 @@ export interface PopoverProps {
|
|
|
942
1578
|
/** 内容插槽 */
|
|
943
1579
|
children?: Snippet;
|
|
944
1580
|
}
|
|
1581
|
+
/**
|
|
1582
|
+
* MessageBox 类型
|
|
1583
|
+
* - confirm: 双按钮(确认 / 取消)
|
|
1584
|
+
* - alert: 单按钮(仅确认)
|
|
1585
|
+
* - prompt: 带输入框的确认(预留)
|
|
1586
|
+
*
|
|
1587
|
+
* @example
|
|
1588
|
+
* ```ts
|
|
1589
|
+
* import type { MessageBoxAction } from '@h-ai/ui'
|
|
1590
|
+
* const example: MessageBoxAction = 'confirm'
|
|
1591
|
+
* ```
|
|
1592
|
+
*/
|
|
1593
|
+
export type MessageBoxAction = 'confirm' | 'cancel' | 'close';
|
|
1594
|
+
/**
|
|
1595
|
+
* MessageBox 图标类型
|
|
1596
|
+
*
|
|
1597
|
+
* @example
|
|
1598
|
+
* ```ts
|
|
1599
|
+
* import type { MessageBoxIconType } from '@h-ai/ui'
|
|
1600
|
+
* const example: MessageBoxIconType = 'warning'
|
|
1601
|
+
* ```
|
|
1602
|
+
*/
|
|
1603
|
+
export type MessageBoxIconType = 'info' | 'success' | 'warning' | 'error';
|
|
1604
|
+
/**
|
|
1605
|
+
* MessageBox 配置项
|
|
1606
|
+
*
|
|
1607
|
+
* @example
|
|
1608
|
+
* ```ts
|
|
1609
|
+
* import type { MessageBoxOptions } from '@h-ai/ui'
|
|
1610
|
+
* const example: MessageBoxOptions = { title: '删除记录', message: '确认删除?', showCancel: true, closeOnClickModal: false }
|
|
1611
|
+
* ```
|
|
1612
|
+
*/
|
|
1613
|
+
export interface MessageBoxOptions {
|
|
1614
|
+
/** 标题 */
|
|
1615
|
+
title?: string;
|
|
1616
|
+
/** 消息纯文本;HTML 标签按文字展示,不作为 HTML 执行。 */
|
|
1617
|
+
message: string;
|
|
1618
|
+
/** 类型:confirm 双按钮 / alert 单按钮 */
|
|
1619
|
+
type?: 'confirm' | 'alert';
|
|
1620
|
+
/** 图标类型 */
|
|
1621
|
+
iconType?: MessageBoxIconType;
|
|
1622
|
+
/** 确认按钮文本 */
|
|
1623
|
+
confirmText?: string;
|
|
1624
|
+
/** 取消按钮文本 */
|
|
1625
|
+
cancelText?: string;
|
|
1626
|
+
/** 确认按钮变体 */
|
|
1627
|
+
confirmVariant?: 'default' | 'primary' | 'warning' | 'error';
|
|
1628
|
+
/** 是否显示取消按钮(alert 模式下默认 false) */
|
|
1629
|
+
showCancel?: boolean;
|
|
1630
|
+
/** 点击遮罩是否关闭,默认 true;需要明确确认时显式设置 false。 */
|
|
1631
|
+
closeOnClickModal?: boolean;
|
|
1632
|
+
/** 是否显示右上角关闭按钮,默认 true。 */
|
|
1633
|
+
showClose?: boolean;
|
|
1634
|
+
/** 确认前回调(返回 false 可阻止关闭) */
|
|
1635
|
+
beforeClose?: (action: MessageBoxAction, instance: MessageBoxInstance) => boolean | Promise<boolean>;
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* MessageBox 实例(供 beforeClose 回调使用)
|
|
1639
|
+
*
|
|
1640
|
+
* @example
|
|
1641
|
+
* ```ts
|
|
1642
|
+
* import type { MessageBoxInstance } from '@h-ai/ui'
|
|
1643
|
+
* const example: MessageBoxInstance = { setLoading: loading => document.body.toggleAttribute('aria-busy', loading) }
|
|
1644
|
+
* ```
|
|
1645
|
+
*/
|
|
1646
|
+
export interface MessageBoxInstance {
|
|
1647
|
+
/** 设置加载态 */
|
|
1648
|
+
setLoading: (loading: boolean) => void;
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Message 消息提示配置项
|
|
1652
|
+
*
|
|
1653
|
+
* @example
|
|
1654
|
+
* ```ts
|
|
1655
|
+
* import type { MessageOptions } from '@h-ai/ui'
|
|
1656
|
+
* const example: MessageOptions = { message: '保存完成', type: 'success', duration: 3000 }
|
|
1657
|
+
* ```
|
|
1658
|
+
*/
|
|
1659
|
+
export interface MessageOptions {
|
|
1660
|
+
/** 消息文本 */
|
|
1661
|
+
message: string;
|
|
1662
|
+
/** 类型 */
|
|
1663
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
1664
|
+
/** 显示时长(毫秒),0 表示不自动关闭 */
|
|
1665
|
+
duration?: number;
|
|
1666
|
+
/** 是否可手动关闭,默认 true;与 Toast 共用队列。 */
|
|
1667
|
+
closable?: boolean;
|
|
1668
|
+
}
|