@h-ai/ui 0.1.0-alpha.29 → 0.1.0-alpha.30
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.md +12 -0
- package/dist/components/compounds/Accordion.svelte +6 -3
- package/dist/components/compounds/Accordion.svelte.d.ts +3 -1
- package/dist/components/compounds/ActionSheet.svelte +11 -8
- package/dist/components/compounds/ActionSheet.svelte.d.ts +3 -1
- package/dist/components/compounds/Alert.svelte +6 -4
- package/dist/components/compounds/Alert.svelte.d.ts +3 -2
- package/dist/components/compounds/AppBar.svelte +13 -9
- package/dist/components/compounds/AppBar.svelte.d.ts +3 -1
- package/dist/components/compounds/BottomNav.svelte +13 -10
- package/dist/components/compounds/BottomNav.svelte.d.ts +3 -1
- package/dist/components/compounds/Breadcrumb.svelte +6 -4
- package/dist/components/compounds/Breadcrumb.svelte.d.ts +3 -2
- package/dist/components/compounds/Calendar.svelte +7 -2
- package/dist/components/compounds/Calendar.svelte.d.ts +3 -1
- package/dist/components/compounds/Card.svelte +6 -4
- package/dist/components/compounds/Card.svelte.d.ts +3 -2
- package/dist/components/compounds/Combobox.svelte +6 -2
- package/dist/components/compounds/Combobox.svelte.d.ts +3 -1
- package/dist/components/compounds/Confirm.svelte +9 -7
- package/dist/components/compounds/Confirm.svelte.d.ts +3 -2
- package/dist/components/compounds/DataTable.svelte +6 -2
- package/dist/components/compounds/DataTable.svelte.d.ts +2 -1
- package/dist/components/compounds/DatePicker.svelte +7 -2
- package/dist/components/compounds/DatePicker.svelte.d.ts +3 -1
- package/dist/components/compounds/Drawer.svelte +6 -4
- package/dist/components/compounds/Drawer.svelte.d.ts +3 -2
- package/dist/components/compounds/Dropdown.svelte +6 -4
- package/dist/components/compounds/Dropdown.svelte.d.ts +3 -2
- package/dist/components/compounds/Empty.svelte +6 -4
- package/dist/components/compounds/Empty.svelte.d.ts +3 -2
- package/dist/components/compounds/Form.svelte +11 -9
- package/dist/components/compounds/Form.svelte.d.ts +3 -2
- package/dist/components/compounds/FormField.svelte +6 -4
- package/dist/components/compounds/FormField.svelte.d.ts +3 -2
- package/dist/components/compounds/InfiniteScroll.svelte +10 -7
- package/dist/components/compounds/InfiniteScroll.svelte.d.ts +3 -1
- package/dist/components/compounds/MessageBoxContainer.svelte +6 -1
- package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +3 -17
- package/dist/components/compounds/MessageBoxDialog.svelte +9 -7
- package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +2 -1
- package/dist/components/compounds/MessageContainer.svelte +6 -2
- package/dist/components/compounds/MessageContainer.svelte.d.ts +2 -1
- package/dist/components/compounds/Modal.svelte +9 -7
- package/dist/components/compounds/Modal.svelte.d.ts +3 -2
- package/dist/components/compounds/PageHeader.svelte +6 -2
- package/dist/components/compounds/PageHeader.svelte.d.ts +3 -1
- package/dist/components/compounds/Pagination.svelte +6 -4
- package/dist/components/compounds/Pagination.svelte.d.ts +3 -2
- package/dist/components/compounds/Popover.svelte +10 -8
- package/dist/components/compounds/Popover.svelte.d.ts +3 -2
- package/dist/components/compounds/PullRefresh.svelte +11 -8
- package/dist/components/compounds/PullRefresh.svelte.d.ts +3 -1
- package/dist/components/compounds/Result.svelte +6 -4
- package/dist/components/compounds/Result.svelte.d.ts +3 -2
- package/dist/components/compounds/SafeArea.svelte +6 -3
- package/dist/components/compounds/SafeArea.svelte.d.ts +3 -1
- package/dist/components/compounds/Skeleton.svelte +6 -4
- package/dist/components/compounds/Skeleton.svelte.d.ts +3 -2
- package/dist/components/compounds/Steps.svelte +6 -4
- package/dist/components/compounds/Steps.svelte.d.ts +3 -2
- package/dist/components/compounds/SwipeCell.svelte +6 -3
- package/dist/components/compounds/SwipeCell.svelte.d.ts +3 -1
- package/dist/components/compounds/Tabs.svelte +6 -4
- package/dist/components/compounds/Tabs.svelte.d.ts +3 -2
- package/dist/components/compounds/TagInput.svelte +11 -9
- package/dist/components/compounds/TagInput.svelte.d.ts +3 -2
- package/dist/components/compounds/Timeline.svelte +6 -3
- package/dist/components/compounds/Timeline.svelte.d.ts +3 -1
- package/dist/components/compounds/ToastContainer.svelte +6 -2
- package/dist/components/compounds/ToastContainer.svelte.d.ts +2 -1
- package/dist/components/compounds/Tooltip.svelte +6 -4
- package/dist/components/compounds/Tooltip.svelte.d.ts +3 -2
- package/dist/components/primitives/Avatar.svelte +6 -4
- package/dist/components/primitives/Avatar.svelte.d.ts +3 -2
- package/dist/components/primitives/Badge.svelte +6 -4
- package/dist/components/primitives/Badge.svelte.d.ts +3 -2
- package/dist/components/primitives/BareButton.svelte +15 -12
- package/dist/components/primitives/BareButton.svelte.d.ts +3 -2
- package/dist/components/primitives/BareInput.svelte +37 -34
- package/dist/components/primitives/BareInput.svelte.d.ts +3 -2
- package/dist/components/primitives/Button.svelte +12 -10
- package/dist/components/primitives/Button.svelte.d.ts +3 -2
- package/dist/components/primitives/Checkbox.svelte +6 -4
- package/dist/components/primitives/Checkbox.svelte.d.ts +3 -2
- package/dist/components/primitives/IconButton.svelte +6 -4
- package/dist/components/primitives/IconButton.svelte.d.ts +3 -2
- package/dist/components/primitives/Input.svelte +6 -4
- package/dist/components/primitives/Input.svelte.d.ts +3 -2
- package/dist/components/primitives/Progress.svelte +6 -4
- package/dist/components/primitives/Progress.svelte.d.ts +3 -2
- package/dist/components/primitives/Radio.svelte +6 -4
- package/dist/components/primitives/Radio.svelte.d.ts +2 -2
- package/dist/components/primitives/Range.svelte +6 -3
- package/dist/components/primitives/Range.svelte.d.ts +3 -1
- package/dist/components/primitives/Rating.svelte +6 -3
- package/dist/components/primitives/Rating.svelte.d.ts +3 -1
- package/dist/components/primitives/Select.svelte +6 -4
- package/dist/components/primitives/Select.svelte.d.ts +2 -2
- package/dist/components/primitives/Spinner.svelte +6 -4
- package/dist/components/primitives/Spinner.svelte.d.ts +3 -2
- package/dist/components/primitives/Switch.svelte +6 -4
- package/dist/components/primitives/Switch.svelte.d.ts +3 -2
- package/dist/components/primitives/Tag.svelte +6 -4
- package/dist/components/primitives/Tag.svelte.d.ts +3 -2
- package/dist/components/primitives/Textarea.svelte +6 -4
- package/dist/components/primitives/Textarea.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleCheckbox.svelte +13 -10
- package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleInput.svelte +13 -10
- package/dist/components/primitives/ToggleInput.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleRadio.svelte +13 -10
- package/dist/components/primitives/ToggleRadio.svelte.d.ts +3 -2
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +8 -5
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +6 -3
- package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/MarkdownRenderer.svelte +8 -7
- package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/document-types.d.ts +2 -1
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +6 -3
- package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/table/table-types.d.ts +2 -1
- package/dist/components/scenes/app/FeedbackModal.svelte +5 -2
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +3 -1
- package/dist/components/scenes/app/LanguageSwitch.svelte +6 -2
- package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +3 -1
- package/dist/components/scenes/app/SettingsLayout.svelte +6 -3
- package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +2 -1
- package/dist/components/scenes/app/SettingsModal.svelte +6 -3
- package/dist/components/scenes/app/SettingsModal.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeColorPicker.svelte +6 -3
- package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeSelector.svelte +6 -3
- package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeToggle.svelte +6 -2
- package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +3 -1
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +16 -11
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +6 -3
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +6 -3
- package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudEditPanel.svelte +6 -3
- package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudFilterBar.svelte +6 -2
- package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/CrudPage.svelte +6 -2
- package/dist/components/scenes/crud/CrudPage.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/crud-types.d.ts +2 -2
- package/dist/components/scenes/crypto/EncryptedInput.svelte +6 -3
- package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +3 -2
- package/dist/components/scenes/crypto/HashDisplay.svelte +6 -3
- package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +3 -1
- package/dist/components/scenes/crypto/SignatureDisplay.svelte +6 -3
- package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +3 -1
- package/dist/components/scenes/error/ErrorPage.svelte +6 -3
- package/dist/components/scenes/error/ErrorPage.svelte.d.ts +2 -1
- package/dist/components/scenes/iam/AuthShell.svelte +6 -3
- package/dist/components/scenes/iam/AuthShell.svelte.d.ts +2 -1
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/LoginForm.svelte +6 -3
- package/dist/components/scenes/iam/LoginForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/PasswordInput.svelte +6 -4
- package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +3 -2
- package/dist/components/scenes/iam/RegisterForm.svelte +6 -4
- package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/UserProfile.svelte +6 -3
- package/dist/components/scenes/iam/UserProfile.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/AvatarUpload.svelte +11 -8
- package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/FileList.svelte +6 -3
- package/dist/components/scenes/storage/FileList.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/FileUpload.svelte +6 -3
- package/dist/components/scenes/storage/FileUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/ImageUpload.svelte +12 -9
- package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/types.d.ts +16 -16
- package/dist/types.d.ts +43 -36
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +15 -0
- package/package.json +2 -2
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
通用按钮组件,支持多种变体和尺寸。
|
|
4
4
|
-->
|
|
5
5
|
<script lang='ts'>
|
|
6
|
-
import type { ButtonProps } from '../../types.js'
|
|
7
|
-
import { cn, getSizeClass, getVariantClass } from '../../utils.js'
|
|
6
|
+
import type { ButtonProps, DataAttributes } from '../../types.js'
|
|
7
|
+
import { cn, getDataAttributes, getSizeClass, getVariantClass } from '../../utils.js'
|
|
8
8
|
|
|
9
9
|
const {
|
|
10
10
|
variant = 'default',
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
type = 'button',
|
|
20
20
|
onclick,
|
|
21
21
|
children,
|
|
22
|
-
|
|
22
|
+
...restProps
|
|
23
|
+
}: ButtonProps & DataAttributes = $props()
|
|
23
24
|
|
|
25
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
24
26
|
const buttonClass = $derived(
|
|
25
27
|
cn(
|
|
26
28
|
'btn no-animation',
|
|
@@ -45,13 +47,13 @@
|
|
|
45
47
|
}
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
|
-
<button
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
<button {...dataAttributes}
|
|
51
|
+
{type}
|
|
52
|
+
form={form || undefined}
|
|
53
|
+
class={buttonClass}
|
|
54
|
+
disabled={disabled || loading}
|
|
55
|
+
aria-label={ariaLabel || undefined}
|
|
56
|
+
onclick={handleClick}
|
|
55
57
|
>
|
|
56
58
|
{#if loading}
|
|
57
59
|
<span class='loading loading-spinner loading-xs'></span>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ButtonProps } from '../../types.js';
|
|
1
|
+
import type { ButtonProps, DataAttributes } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = ButtonProps & DataAttributes;
|
|
2
3
|
/**
|
|
3
4
|
* Button
|
|
4
5
|
* 通用按钮组件,支持多种变体和尺寸。
|
|
5
6
|
*/
|
|
6
|
-
declare const Button: import("svelte").Component
|
|
7
|
+
declare const Button: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
8
|
type Button = ReturnType<typeof Button>;
|
|
8
9
|
export default Button;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { CheckboxProps } from '../../types.js'
|
|
12
|
-
import { cn, generateId, getSizeClass } from '../../utils.js'
|
|
11
|
+
import type { CheckboxProps, DataAttributes } from '../../types.js'
|
|
12
|
+
import { cn, generateId, getDataAttributes, getSizeClass } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
let {
|
|
15
15
|
checked = $bindable(false),
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
indeterminate = false,
|
|
21
21
|
class: className = '',
|
|
22
22
|
onchange,
|
|
23
|
-
|
|
23
|
+
...restProps
|
|
24
|
+
}: CheckboxProps & DataAttributes = $props()
|
|
24
25
|
|
|
26
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
25
27
|
const id = generateId('checkbox')
|
|
26
28
|
|
|
27
29
|
const checkboxClass = $derived(
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
}
|
|
41
43
|
</script>
|
|
42
44
|
|
|
43
|
-
<div class='inline-flex'>
|
|
45
|
+
<div {...dataAttributes} class='inline-flex'>
|
|
44
46
|
<label class='label cursor-pointer gap-2' for={id}>
|
|
45
47
|
<input
|
|
46
48
|
{id}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CheckboxProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { CheckboxProps, DataAttributes } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = CheckboxProps & DataAttributes;
|
|
3
|
+
declare const Checkbox: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
3
4
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
4
5
|
export default Checkbox;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { IconButtonProps } from '../../types.js'
|
|
12
|
-
import { cn, getSizeClass, getVariantClass } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, IconButtonProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes, getSizeClass, getVariantClass } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const SAFE_INLINE_SVG_REGEX = /^<svg[\s\S]*<\/svg>$/i
|
|
15
15
|
const UNSAFE_INLINE_SVG_REGEX = /<\s*(?:script|foreignObject|iframe|object|embed|link|meta|img)\b|\son[a-z]+\s*=|(?:href|xlink:href)\s*=\s*['"]\s*(?:javascript:|vbscript:|data:text\/html)/i
|
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
class: className = '',
|
|
27
27
|
onclick,
|
|
28
28
|
children,
|
|
29
|
-
|
|
29
|
+
...restProps
|
|
30
|
+
}: IconButtonProps & DataAttributes = $props()
|
|
30
31
|
|
|
32
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
31
33
|
/** 计算最终的 aria-label */
|
|
32
34
|
const computedAriaLabel = $derived(ariaLabel || label || tooltip)
|
|
33
35
|
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
</script>
|
|
86
88
|
|
|
87
89
|
{#if tooltip}
|
|
88
|
-
<div class='tooltip' data-tip={tooltip}>
|
|
90
|
+
<div {...dataAttributes} class='tooltip' data-tip={tooltip}>
|
|
89
91
|
<button
|
|
90
92
|
type='button'
|
|
91
93
|
class={buttonClass}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { IconButtonProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, IconButtonProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = IconButtonProps & DataAttributes;
|
|
3
|
+
declare const IconButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type IconButton = ReturnType<typeof IconButton>;
|
|
4
5
|
export default IconButton;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
文本输入框组件,支持自定义验证消息
|
|
4
4
|
-->
|
|
5
5
|
<script lang='ts'>
|
|
6
|
-
import type { InputProps } from '../../types.js'
|
|
7
|
-
import { cn } from '../../utils.js'
|
|
6
|
+
import type { DataAttributes, InputProps } from '../../types.js'
|
|
7
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
10
|
value = $bindable(''),
|
|
@@ -35,8 +35,10 @@
|
|
|
35
35
|
onblur,
|
|
36
36
|
onfocus,
|
|
37
37
|
oninvalid,
|
|
38
|
-
|
|
38
|
+
...restProps
|
|
39
|
+
}: InputProps & DataAttributes = $props()
|
|
39
40
|
|
|
41
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
40
42
|
const containerHeight = $derived(
|
|
41
43
|
size === 'xs'
|
|
42
44
|
? 'h-8'
|
|
@@ -112,7 +114,7 @@
|
|
|
112
114
|
}
|
|
113
115
|
</script>
|
|
114
116
|
|
|
115
|
-
<div class='fieldset w-full'>
|
|
117
|
+
<div {...dataAttributes} class='fieldset w-full'>
|
|
116
118
|
<div class={containerClass}>
|
|
117
119
|
<input
|
|
118
120
|
bind:this={inputRef}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { InputProps } from '../../types.js';
|
|
1
|
+
import type { DataAttributes, InputProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = InputProps & DataAttributes;
|
|
2
3
|
/**
|
|
3
4
|
* Input
|
|
4
5
|
* 文本输入框组件,支持自定义验证消息
|
|
5
6
|
*/
|
|
6
|
-
declare const Input: import("svelte").Component
|
|
7
|
+
declare const Input: import("svelte").Component<$$ComponentProps, {}, "value" | "inputRef">;
|
|
7
8
|
type Input = ReturnType<typeof Input>;
|
|
8
9
|
export default Input;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { ProgressProps } from '../../types.js'
|
|
12
|
-
import { cn, getProgressVariantClass } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, ProgressProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes, getProgressVariantClass } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
value,
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
variant = 'primary',
|
|
19
19
|
showLabel = false,
|
|
20
20
|
class: className = '',
|
|
21
|
-
|
|
21
|
+
...restProps
|
|
22
|
+
}: ProgressProps & DataAttributes = $props()
|
|
22
23
|
|
|
24
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
23
25
|
const sizeMap = {
|
|
24
26
|
'xs': 'h-1',
|
|
25
27
|
'sm': 'h-2',
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
)
|
|
44
46
|
</script>
|
|
45
47
|
|
|
46
|
-
<div class='w-full'>
|
|
48
|
+
<div {...dataAttributes} class='w-full'>
|
|
47
49
|
<progress
|
|
48
50
|
class={progressClass}
|
|
49
51
|
{value}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ProgressProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, ProgressProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = ProgressProps & DataAttributes;
|
|
3
|
+
declare const Progress: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type Progress = ReturnType<typeof Progress>;
|
|
4
5
|
export default Progress;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts' generics="T = string">
|
|
11
|
-
import type { RadioProps, SelectOption } from '../../types.js'
|
|
12
|
-
import { cn, getSizeClass } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, RadioProps, SelectOption } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes, getSizeClass } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
let {
|
|
15
15
|
value = $bindable() as T,
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
direction = 'vertical',
|
|
21
21
|
class: className = '',
|
|
22
22
|
onchange,
|
|
23
|
-
|
|
23
|
+
...restProps
|
|
24
|
+
}: RadioProps<T> & DataAttributes = $props()
|
|
24
25
|
|
|
26
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
25
27
|
const containerClass = $derived(
|
|
26
28
|
cn(
|
|
27
29
|
'flex gap-2',
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
}
|
|
44
46
|
</script>
|
|
45
47
|
|
|
46
|
-
<div class={containerClass} role='radiogroup'>
|
|
48
|
+
<div {...dataAttributes} class={containerClass} role='radiogroup'>
|
|
47
49
|
{#each options as option (option.value)}
|
|
48
50
|
<label class='label cursor-pointer gap-2 justify-start'>
|
|
49
51
|
<input
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RadioProps } from '../../types.js';
|
|
1
|
+
import type { DataAttributes, RadioProps } from '../../types.js';
|
|
2
2
|
declare function $$render<T = string>(): {
|
|
3
|
-
props: RadioProps<T
|
|
3
|
+
props: RadioProps<T> & DataAttributes;
|
|
4
4
|
exports: {};
|
|
5
5
|
bindings: "value";
|
|
6
6
|
slots: {};
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
|
-
import {
|
|
12
|
+
import type { DataAttributes } from '../../types.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
14
|
import BareInput from './BareInput.svelte'
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
@@ -49,8 +50,10 @@
|
|
|
49
50
|
onchange,
|
|
50
51
|
oninput,
|
|
51
52
|
class: className = '',
|
|
52
|
-
|
|
53
|
+
...restProps
|
|
54
|
+
}: Props & DataAttributes = $props()
|
|
53
55
|
|
|
56
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
54
57
|
const sizeClass = $derived({
|
|
55
58
|
xs: 'range-xs',
|
|
56
59
|
sm: 'range-sm',
|
|
@@ -94,7 +97,7 @@
|
|
|
94
97
|
}
|
|
95
98
|
</script>
|
|
96
99
|
|
|
97
|
-
<div class='w-full'>
|
|
100
|
+
<div {...dataAttributes} class='w-full'>
|
|
98
101
|
<BareInput
|
|
99
102
|
type='range'
|
|
100
103
|
class={rangeClass}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataAttributes } from '../../types.js';
|
|
1
2
|
interface Props {
|
|
2
3
|
/** 当前值 */
|
|
3
4
|
value?: number;
|
|
@@ -22,6 +23,7 @@ interface Props {
|
|
|
22
23
|
/** 自定义类名 */
|
|
23
24
|
class?: string;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
27
|
+
declare const Range: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
26
28
|
type Range = ReturnType<typeof Range>;
|
|
27
29
|
export default Range;
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
|
+
import type { DataAttributes } from '../../types.js'
|
|
12
13
|
import { uiM } from '../../messages.js'
|
|
13
|
-
import { cn } from '../../utils.js'
|
|
14
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
16
17
|
/** 当前评分值 (0 - max) */
|
|
@@ -49,8 +50,10 @@
|
|
|
49
50
|
name = `rating-${Math.random().toString(36).slice(2, 9)}`,
|
|
50
51
|
onchange,
|
|
51
52
|
class: className = '',
|
|
52
|
-
|
|
53
|
+
...restProps
|
|
54
|
+
}: Props & DataAttributes = $props()
|
|
53
55
|
|
|
56
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
54
57
|
const sizeClass = $derived({
|
|
55
58
|
xs: 'rating-xs',
|
|
56
59
|
sm: 'rating-sm',
|
|
@@ -110,7 +113,7 @@
|
|
|
110
113
|
|
|
111
114
|
{#if readonly}
|
|
112
115
|
<!-- 只读模式 - 使用 div 而非 input -->
|
|
113
|
-
<div class={cn('rating', sizeClass, className)}>
|
|
116
|
+
<div {...dataAttributes} class={cn('rating', sizeClass, className)}>
|
|
114
117
|
{#each Array.from({ length: max }) as _, i (i)}
|
|
115
118
|
<div
|
|
116
119
|
class={cn(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataAttributes } from '../../types.js';
|
|
1
2
|
interface Props {
|
|
2
3
|
/** 当前评分值 (0 - max) */
|
|
3
4
|
value?: number;
|
|
@@ -22,6 +23,7 @@ interface Props {
|
|
|
22
23
|
/** 自定义类名 */
|
|
23
24
|
class?: string;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
27
|
+
declare const Rating: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
26
28
|
type Rating = ReturnType<typeof Rating>;
|
|
27
29
|
export default Rating;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts' generics="T = string">
|
|
12
|
-
import type { SelectProps } from '../../types.js'
|
|
13
|
-
import { cn, getSizeClass } from '../../utils.js'
|
|
12
|
+
import type { DataAttributes, SelectProps } from '../../types.js'
|
|
13
|
+
import { cn, getDataAttributes, getSizeClass } from '../../utils.js'
|
|
14
14
|
|
|
15
15
|
let {
|
|
16
16
|
value = $bindable<T>(),
|
|
@@ -25,8 +25,10 @@
|
|
|
25
25
|
id,
|
|
26
26
|
onchange,
|
|
27
27
|
children,
|
|
28
|
-
|
|
28
|
+
...restProps
|
|
29
|
+
}: SelectProps<T> & DataAttributes = $props()
|
|
29
30
|
|
|
31
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
30
32
|
let selectRef: HTMLSelectElement | undefined = $state()
|
|
31
33
|
|
|
32
34
|
const selectClass = $derived(
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
}
|
|
63
65
|
</script>
|
|
64
66
|
|
|
65
|
-
<div class='fieldset w-full'>
|
|
67
|
+
<div {...dataAttributes} class='fieldset w-full'>
|
|
66
68
|
<select
|
|
67
69
|
bind:this={selectRef}
|
|
68
70
|
{id}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SelectProps } from '../../types.js';
|
|
1
|
+
import type { DataAttributes, SelectProps } from '../../types.js';
|
|
2
2
|
declare function $$render<T = string>(): {
|
|
3
|
-
props: SelectProps<T
|
|
3
|
+
props: SelectProps<T> & DataAttributes;
|
|
4
4
|
exports: {};
|
|
5
5
|
bindings: "value";
|
|
6
6
|
slots: {};
|
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { SpinnerProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, SpinnerProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
size = 'md',
|
|
16
16
|
variant = 'primary',
|
|
17
17
|
class: className = '',
|
|
18
|
-
|
|
18
|
+
...restProps
|
|
19
|
+
}: SpinnerProps & DataAttributes = $props()
|
|
19
20
|
|
|
21
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
20
22
|
const sizeMap = {
|
|
21
23
|
'xs': 'loading-xs',
|
|
22
24
|
'sm': 'loading-sm',
|
|
@@ -51,4 +53,4 @@
|
|
|
51
53
|
)
|
|
52
54
|
</script>
|
|
53
55
|
|
|
54
|
-
<span class={spinnerClass}></span>
|
|
56
|
+
<span {...dataAttributes} class={spinnerClass}></span>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { SpinnerProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, SpinnerProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = SpinnerProps & DataAttributes;
|
|
3
|
+
declare const Spinner: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type Spinner = ReturnType<typeof Spinner>;
|
|
4
5
|
export default Spinner;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { SwitchProps } from '../../types.js'
|
|
12
|
-
import { cn, generateId, getSizeClass } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, SwitchProps } from '../../types.js'
|
|
12
|
+
import { cn, generateId, getDataAttributes, getSizeClass } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
let {
|
|
15
15
|
checked = $bindable(false),
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
disabled = false,
|
|
19
19
|
class: className = '',
|
|
20
20
|
onchange,
|
|
21
|
-
|
|
21
|
+
...restProps
|
|
22
|
+
}: SwitchProps & DataAttributes = $props()
|
|
22
23
|
|
|
24
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
23
25
|
const id = generateId('switch')
|
|
24
26
|
|
|
25
27
|
const hasToggleColorVariant = $derived(
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
}
|
|
42
44
|
</script>
|
|
43
45
|
|
|
44
|
-
<div class='inline-flex'>
|
|
46
|
+
<div {...dataAttributes} class='inline-flex'>
|
|
45
47
|
<label class='label cursor-pointer gap-2' for={id}>
|
|
46
48
|
<input
|
|
47
49
|
{id}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { SwitchProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, SwitchProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = SwitchProps & DataAttributes;
|
|
3
|
+
declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
3
4
|
type Switch = ReturnType<typeof Switch>;
|
|
4
5
|
export default Switch;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { TagProps } from '../../types.js'
|
|
12
|
-
import { cn, getSizeClass, getVariantClass } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, TagProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes, getSizeClass, getVariantClass } from '../../utils.js'
|
|
13
13
|
import IconButton from './IconButton.svelte'
|
|
14
14
|
|
|
15
15
|
const {
|
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
class: className = '',
|
|
24
24
|
onclose,
|
|
25
25
|
children,
|
|
26
|
-
|
|
26
|
+
...restProps
|
|
27
|
+
}: TagProps & DataAttributes = $props()
|
|
27
28
|
|
|
29
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
28
30
|
const tagClass = $derived(
|
|
29
31
|
cn(
|
|
30
32
|
'badge gap-1',
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
}
|
|
42
44
|
</script>
|
|
43
45
|
|
|
44
|
-
<span class={tagClass}>
|
|
46
|
+
<span {...dataAttributes} class={tagClass}>
|
|
45
47
|
{#if children}
|
|
46
48
|
{@render children()}
|
|
47
49
|
{:else}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TagProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, TagProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = TagProps & DataAttributes;
|
|
3
|
+
declare const Tag: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type Tag = ReturnType<typeof Tag>;
|
|
4
5
|
export default Tag;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
|
-
import type { TextareaProps } from '../../types.js'
|
|
13
|
-
import { cn, getInputSizeClass } from '../../utils.js'
|
|
12
|
+
import type { DataAttributes, TextareaProps } from '../../types.js'
|
|
13
|
+
import { cn, getDataAttributes, getInputSizeClass } from '../../utils.js'
|
|
14
14
|
|
|
15
15
|
let {
|
|
16
16
|
value = $bindable(''),
|
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
id,
|
|
28
28
|
name,
|
|
29
29
|
oninput,
|
|
30
|
-
|
|
30
|
+
...restProps
|
|
31
|
+
}: TextareaProps & DataAttributes = $props()
|
|
31
32
|
|
|
33
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
32
34
|
let textareaRef: HTMLTextAreaElement | undefined = $state()
|
|
33
35
|
|
|
34
36
|
const textareaClass = $derived(
|
|
@@ -71,7 +73,7 @@
|
|
|
71
73
|
}
|
|
72
74
|
</script>
|
|
73
75
|
|
|
74
|
-
<div class='fieldset w-full'>
|
|
76
|
+
<div {...dataAttributes} class='fieldset w-full'>
|
|
75
77
|
<textarea
|
|
76
78
|
bind:this={textareaRef}
|
|
77
79
|
{id}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TextareaProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, TextareaProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = TextareaProps & DataAttributes;
|
|
3
|
+
declare const Textarea: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
3
4
|
type Textarea = ReturnType<typeof Textarea>;
|
|
4
5
|
export default Textarea;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { ToggleCheckboxProps } from '../../types.js'
|
|
11
|
+
import type { DataAttributes, ToggleCheckboxProps } from '../../types.js'
|
|
12
|
+
import { getDataAttributes } from '../../utils.js'
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
checked = $bindable(false),
|
|
@@ -17,20 +18,22 @@
|
|
|
17
18
|
disabled = false,
|
|
18
19
|
class: className = '',
|
|
19
20
|
onchange,
|
|
20
|
-
|
|
21
|
+
...restProps
|
|
22
|
+
}: ToggleCheckboxProps & DataAttributes = $props()
|
|
21
23
|
|
|
24
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
22
25
|
function handleChange(e: Event & { currentTarget: HTMLInputElement }) {
|
|
23
26
|
checked = e.currentTarget.checked
|
|
24
27
|
onchange?.(checked)
|
|
25
28
|
}
|
|
26
29
|
</script>
|
|
27
30
|
|
|
28
|
-
<input
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
<input {...dataAttributes}
|
|
32
|
+
{id}
|
|
33
|
+
{name}
|
|
34
|
+
type='checkbox'
|
|
35
|
+
class={className}
|
|
36
|
+
{disabled}
|
|
37
|
+
checked={checked}
|
|
38
|
+
onchange={handleChange}
|
|
36
39
|
/>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ToggleCheckboxProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, ToggleCheckboxProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = ToggleCheckboxProps & DataAttributes;
|
|
3
|
+
declare const ToggleCheckbox: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
3
4
|
type ToggleCheckbox = ReturnType<typeof ToggleCheckbox>;
|
|
4
5
|
export default ToggleCheckbox;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { ToggleCheckboxProps } from '../../types.js'
|
|
11
|
+
import type { DataAttributes, ToggleCheckboxProps } from '../../types.js'
|
|
12
|
+
import { getDataAttributes } from '../../utils.js'
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
checked = $bindable(false),
|
|
@@ -17,20 +18,22 @@
|
|
|
17
18
|
disabled = false,
|
|
18
19
|
class: className = '',
|
|
19
20
|
onchange,
|
|
20
|
-
|
|
21
|
+
...restProps
|
|
22
|
+
}: ToggleCheckboxProps & DataAttributes = $props()
|
|
21
23
|
|
|
24
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
22
25
|
function handleChange(e: Event & { currentTarget: HTMLInputElement }) {
|
|
23
26
|
checked = e.currentTarget.checked
|
|
24
27
|
onchange?.(checked)
|
|
25
28
|
}
|
|
26
29
|
</script>
|
|
27
30
|
|
|
28
|
-
<input
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
<input {...dataAttributes}
|
|
32
|
+
{id}
|
|
33
|
+
{name}
|
|
34
|
+
type='checkbox'
|
|
35
|
+
class={className}
|
|
36
|
+
{disabled}
|
|
37
|
+
checked={checked}
|
|
38
|
+
onchange={handleChange}
|
|
36
39
|
/>
|