svelte-mobile-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/components/ActionBar/ActionBar.svelte +31 -0
- package/components/ActionBar/ActionBarButton.svelte +105 -0
- package/components/ActionBar/ActionBarIcon.svelte +100 -0
- package/components/ActionBar/index.ts +3 -0
- package/components/ActionSheet/ActionSheet.svelte +134 -0
- package/components/ActionSheet/index.ts +1 -0
- package/components/AddressEdit/AddressEdit.svelte +23 -0
- package/components/AddressEdit/index.ts +1 -0
- package/components/AddressList/AddressList.svelte +23 -0
- package/components/AddressList/index.ts +1 -0
- package/components/Area/Area.svelte +23 -0
- package/components/Area/index.ts +1 -0
- package/components/BackTop/BackTop.svelte +23 -0
- package/components/BackTop/index.ts +1 -0
- package/components/Badge/Badge.svelte +90 -0
- package/components/Badge/index.ts +1 -0
- package/components/Barrage/Barrage.svelte +23 -0
- package/components/Barrage/index.ts +1 -0
- package/components/Button/Button.svelte +297 -0
- package/components/Button/index.ts +1 -0
- package/components/Calendar/Calendar.svelte +23 -0
- package/components/Calendar/index.ts +1 -0
- package/components/Card/Card.svelte +23 -0
- package/components/Card/index.ts +1 -0
- package/components/Cascader/Cascader.svelte +23 -0
- package/components/Cascader/index.ts +1 -0
- package/components/Cell/Cell.svelte +155 -0
- package/components/Cell/index.ts +1 -0
- package/components/CellGroup/CellGroup.svelte +47 -0
- package/components/CellGroup/index.ts +1 -0
- package/components/Checkbox/Checkbox.svelte +128 -0
- package/components/Checkbox/index.ts +1 -0
- package/components/CheckboxGroup/CheckboxGroup.svelte +36 -0
- package/components/CheckboxGroup/index.ts +1 -0
- package/components/Circle/Circle.svelte +23 -0
- package/components/Circle/index.ts +1 -0
- package/components/Col/Col.svelte +23 -0
- package/components/Col/index.ts +1 -0
- package/components/Collapse/Collapse.svelte +25 -0
- package/components/Collapse/CollapseItem.svelte +102 -0
- package/components/Collapse/index.ts +2 -0
- package/components/ConfigProvider/ConfigProvider.svelte +23 -0
- package/components/ConfigProvider/index.ts +1 -0
- package/components/ContactCard/ContactCard.svelte +23 -0
- package/components/ContactCard/index.ts +1 -0
- package/components/ContactEdit/ContactEdit.svelte +207 -0
- package/components/ContactEdit/index.ts +1 -0
- package/components/ContactList/ContactList.svelte +143 -0
- package/components/ContactList/index.ts +1 -0
- package/components/CountDown/CountDown.svelte +23 -0
- package/components/CountDown/index.ts +1 -0
- package/components/Coupon/Coupon.svelte +23 -0
- package/components/Coupon/CouponCell.svelte +130 -0
- package/components/Coupon/CouponList.svelte +225 -0
- package/components/Coupon/index.ts +3 -0
- package/components/DatePicker/DatePicker.svelte +23 -0
- package/components/DatePicker/index.ts +1 -0
- package/components/Dialog/Dialog.svelte +141 -0
- package/components/Dialog/index.ts +1 -0
- package/components/Divider/Divider.svelte +61 -0
- package/components/Divider/index.ts +1 -0
- package/components/DropdownMenu/DropdownItem.svelte +131 -0
- package/components/DropdownMenu/DropdownMenu.svelte +23 -0
- package/components/DropdownMenu/index.ts +2 -0
- package/components/Empty/Empty.svelte +73 -0
- package/components/Empty/index.ts +1 -0
- package/components/Field/Field.svelte +270 -0
- package/components/Field/index.ts +1 -0
- package/components/FloatingBubble/FloatingBubble.svelte +23 -0
- package/components/FloatingBubble/index.ts +1 -0
- package/components/FloatingPanel/FloatingPanel.svelte +139 -0
- package/components/FloatingPanel/index.ts +1 -0
- package/components/Form/Form.svelte +23 -0
- package/components/Form/index.ts +1 -0
- package/components/Grid/Grid.svelte +47 -0
- package/components/Grid/GridItem.svelte +150 -0
- package/components/Grid/index.ts +2 -0
- package/components/Highlight/Highlight.svelte +23 -0
- package/components/Highlight/index.ts +1 -0
- package/components/Icon/Icon.svelte +111 -0
- package/components/Icon/index.ts +1 -0
- package/components/ImageComp/ImageComp.svelte +104 -0
- package/components/ImageComp/index.ts +1 -0
- package/components/ImagePreview/ImagePreview.svelte +23 -0
- package/components/ImagePreview/index.ts +1 -0
- package/components/IndexBar/IndexAnchor.svelte +33 -0
- package/components/IndexBar/IndexBar.svelte +23 -0
- package/components/IndexBar/index.ts +2 -0
- package/components/List/List.svelte +23 -0
- package/components/List/index.ts +1 -0
- package/components/Loading/Loading.svelte +149 -0
- package/components/Loading/index.ts +1 -0
- package/components/NavBar/NavBar.svelte +109 -0
- package/components/NavBar/index.ts +1 -0
- package/components/NoticeBar/NoticeBar.svelte +120 -0
- package/components/NoticeBar/index.ts +1 -0
- package/components/Notify/Notify.svelte +23 -0
- package/components/Notify/index.ts +1 -0
- package/components/NumberKeyboard/NumberKeyboard.svelte +23 -0
- package/components/NumberKeyboard/index.ts +1 -0
- package/components/Overlay/Overlay.svelte +46 -0
- package/components/Overlay/index.ts +1 -0
- package/components/Pagination/Pagination.svelte +23 -0
- package/components/Pagination/index.ts +1 -0
- package/components/PasswordInput/PasswordInput.svelte +23 -0
- package/components/PasswordInput/index.ts +1 -0
- package/components/Picker/Picker.svelte +23 -0
- package/components/Picker/index.ts +1 -0
- package/components/PickerGroup/PickerGroup.svelte +99 -0
- package/components/PickerGroup/index.ts +1 -0
- package/components/Popover/Popover.svelte +23 -0
- package/components/Popover/index.ts +1 -0
- package/components/Popup/Popup.svelte +154 -0
- package/components/Popup/index.ts +1 -0
- package/components/Progress/Progress.svelte +89 -0
- package/components/Progress/index.ts +1 -0
- package/components/PullRefresh/PullRefresh.svelte +23 -0
- package/components/PullRefresh/index.ts +1 -0
- package/components/Radio/Radio.svelte +106 -0
- package/components/Radio/index.ts +1 -0
- package/components/RadioGroup/RadioGroup.svelte +34 -0
- package/components/RadioGroup/index.ts +1 -0
- package/components/Rate/Rate.svelte +87 -0
- package/components/Rate/index.ts +1 -0
- package/components/RollingText/RollingText.svelte +104 -0
- package/components/RollingText/index.ts +1 -0
- package/components/Row/Row.svelte +23 -0
- package/components/Row/index.ts +1 -0
- package/components/Search/Search.svelte +124 -0
- package/components/Search/index.ts +1 -0
- package/components/ShareSheet/ShareSheet.svelte +23 -0
- package/components/ShareSheet/index.ts +1 -0
- package/components/Sidebar/Sidebar.svelte +23 -0
- package/components/Sidebar/SidebarItem.svelte +110 -0
- package/components/Sidebar/index.ts +2 -0
- package/components/Signature/Signature.svelte +198 -0
- package/components/Signature/index.ts +1 -0
- package/components/Skeleton/Skeleton.svelte +23 -0
- package/components/Skeleton/SkeletonAvatar.svelte +26 -0
- package/components/Skeleton/SkeletonImage.svelte +44 -0
- package/components/Skeleton/SkeletonParagraph.svelte +60 -0
- package/components/Skeleton/SkeletonTitle.svelte +38 -0
- package/components/Skeleton/index.ts +5 -0
- package/components/Slider/Slider.svelte +112 -0
- package/components/Slider/index.ts +1 -0
- package/components/Space/Space.svelte +52 -0
- package/components/Space/index.ts +1 -0
- package/components/Stepper/Stepper.svelte +197 -0
- package/components/Stepper/index.ts +1 -0
- package/components/Steps/Step.svelte +126 -0
- package/components/Steps/Steps.svelte +23 -0
- package/components/Steps/index.ts +2 -0
- package/components/Sticky/Sticky.svelte +88 -0
- package/components/Sticky/index.ts +1 -0
- package/components/SubmitBar/SubmitBar.svelte +23 -0
- package/components/SubmitBar/index.ts +1 -0
- package/components/Swipe/Swipe.svelte +23 -0
- package/components/Swipe/SwipeItem.svelte +25 -0
- package/components/Swipe/index.ts +2 -0
- package/components/SwipeCell/SwipeCell.svelte +23 -0
- package/components/SwipeCell/index.ts +1 -0
- package/components/Switch/Switch.svelte +97 -0
- package/components/Switch/index.ts +1 -0
- package/components/Tabbar/Tabbar.svelte +62 -0
- package/components/Tabbar/index.ts +1 -0
- package/components/TabbarItem/TabbarItem.svelte +72 -0
- package/components/TabbarItem/index.ts +1 -0
- package/components/Tabs/Tab.svelte +37 -0
- package/components/Tabs/Tabs.svelte +161 -0
- package/components/Tabs/index.ts +2 -0
- package/components/Tag/Tag.svelte +144 -0
- package/components/Tag/index.ts +1 -0
- package/components/TextEllipsis/TextEllipsis.svelte +23 -0
- package/components/TextEllipsis/index.ts +1 -0
- package/components/TimePicker/TimePicker.svelte +23 -0
- package/components/TimePicker/index.ts +1 -0
- package/components/Toast/Toast.svelte +129 -0
- package/components/Toast/index.ts +1 -0
- package/components/TreeSelect/TreeSelect.svelte +23 -0
- package/components/TreeSelect/index.ts +1 -0
- package/components/Uploader/Uploader.svelte +23 -0
- package/components/Uploader/index.ts +1 -0
- package/components/Watermark/Watermark.svelte +23 -0
- package/components/Watermark/index.ts +1 -0
- package/components/index.ts +100 -0
- package/dist/styles.css +1 -0
- package/dist/svelte-mobile-ui.cjs +158 -0
- package/dist/svelte-mobile-ui.iife.js +209 -0
- package/dist/svelte-mobile-ui.mjs +158 -0
- package/dist/types/icons.ts +106 -0
- package/dist/types/index.ts +82 -0
- package/index.ts +8 -0
- package/package.json +63 -0
- package/styles/index.scss +153 -0
- package/styles/var.scss +83 -0
- package/utils/icons.ts +106 -0
- package/utils/index.ts +82 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
content = '',
|
|
6
|
+
color = '',
|
|
7
|
+
dot = false,
|
|
8
|
+
max = 0,
|
|
9
|
+
showZero = true,
|
|
10
|
+
offset,
|
|
11
|
+
children,
|
|
12
|
+
class: className = '',
|
|
13
|
+
}: {
|
|
14
|
+
content?: string | number
|
|
15
|
+
color?: string
|
|
16
|
+
dot?: boolean
|
|
17
|
+
max?: number
|
|
18
|
+
showZero?: boolean
|
|
19
|
+
offset?: [number, number]
|
|
20
|
+
children?: Snippet
|
|
21
|
+
class?: string
|
|
22
|
+
} = $props()
|
|
23
|
+
|
|
24
|
+
const displayContent = $derived(() => {
|
|
25
|
+
if (dot) return ''
|
|
26
|
+
if (typeof content === 'number' && max > 0 && content > max) return max + '+'
|
|
27
|
+
if (content === 0 && !showZero) return ''
|
|
28
|
+
return String(content ?? '')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const badgeStyle = $derived([
|
|
32
|
+
color ? `background: ${color}` : '',
|
|
33
|
+
offset ? `transform: translate(${offset[0]}px, ${offset[1]}px)` : '',
|
|
34
|
+
].filter(Boolean).join('; '))
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div class="smu-badge__wrapper {className}">
|
|
38
|
+
{#if children}{@render children()}{/if}
|
|
39
|
+
{#if dot || displayContent()}
|
|
40
|
+
<div class="smu-badge {dot ? 'smu-badge--dot' : ''} {!children ? 'smu-badge--fixed' : ''}" style={badgeStyle}>
|
|
41
|
+
{#if !dot}{displayContent()}{/if}
|
|
42
|
+
</div>
|
|
43
|
+
{/if}
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
.smu-badge {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
min-width: 16px;
|
|
53
|
+
padding: 0 3px;
|
|
54
|
+
color: var(--smu-white);
|
|
55
|
+
font-size: var(--smu-font-size-xs);
|
|
56
|
+
font-weight: var(--smu-font-bold);
|
|
57
|
+
line-height: 14px;
|
|
58
|
+
text-align: center;
|
|
59
|
+
background: var(--smu-danger-color);
|
|
60
|
+
border: 1px solid var(--smu-white);
|
|
61
|
+
border-radius: var(--smu-radius-max);
|
|
62
|
+
|
|
63
|
+
&__wrapper {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: inline-block;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&--dot {
|
|
69
|
+
width: 8px;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
height: 8px;
|
|
72
|
+
padding: 0;
|
|
73
|
+
border-radius: 50%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&--fixed:not(.smu-badge--dot) {
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: 0;
|
|
79
|
+
right: 0;
|
|
80
|
+
transform: translate(50%, -50%);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&--dot.smu-badge--fixed {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 0;
|
|
86
|
+
right: 0;
|
|
87
|
+
transform: translate(50%, -50%);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Badge } from './Badge.svelte'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = '',
|
|
7
|
+
...restProps
|
|
8
|
+
}: {
|
|
9
|
+
children?: Snippet
|
|
10
|
+
class?: string
|
|
11
|
+
[key: string]: any
|
|
12
|
+
} = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="smu-barrage {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-barrage {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Barrage } from './Barrage.svelte'
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Button 按钮组件
|
|
4
|
+
* 支持多种类型、尺寸、形状
|
|
5
|
+
*/
|
|
6
|
+
import Icon from "../Icon/Icon.svelte";
|
|
7
|
+
import Loading from "../Loading/Loading.svelte";
|
|
8
|
+
import type { Snippet } from "svelte";
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
type = "default",
|
|
12
|
+
size = "normal",
|
|
13
|
+
text = "",
|
|
14
|
+
icon = "",
|
|
15
|
+
color = "",
|
|
16
|
+
block = false,
|
|
17
|
+
plain = false,
|
|
18
|
+
round = false,
|
|
19
|
+
square = false,
|
|
20
|
+
loading = false,
|
|
21
|
+
loadingText = "",
|
|
22
|
+
loadingSize = "20px",
|
|
23
|
+
loadingType = "circular",
|
|
24
|
+
disabled = false,
|
|
25
|
+
hairline = false,
|
|
26
|
+
iconPosition = "left",
|
|
27
|
+
nativeType = "button",
|
|
28
|
+
onclick,
|
|
29
|
+
children,
|
|
30
|
+
class: className = "",
|
|
31
|
+
}: {
|
|
32
|
+
type?: "default" | "primary" | "success" | "warning" | "danger";
|
|
33
|
+
size?: "large" | "normal" | "small" | "mini";
|
|
34
|
+
text?: string;
|
|
35
|
+
icon?: string;
|
|
36
|
+
color?: string;
|
|
37
|
+
block?: boolean;
|
|
38
|
+
plain?: boolean;
|
|
39
|
+
round?: boolean;
|
|
40
|
+
square?: boolean;
|
|
41
|
+
loading?: boolean;
|
|
42
|
+
loadingText?: string;
|
|
43
|
+
loadingSize?: string;
|
|
44
|
+
loadingType?: "circular" | "spinner";
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
hairline?: boolean;
|
|
47
|
+
iconPosition?: "left" | "right";
|
|
48
|
+
nativeType?: "button" | "submit" | "reset";
|
|
49
|
+
onclick?: (e: MouseEvent) => void;
|
|
50
|
+
children?: Snippet;
|
|
51
|
+
class?: string;
|
|
52
|
+
} = $props();
|
|
53
|
+
|
|
54
|
+
const classes = $derived(
|
|
55
|
+
[
|
|
56
|
+
"smu-button",
|
|
57
|
+
`smu-button--${type}`,
|
|
58
|
+
`smu-button--${size}`,
|
|
59
|
+
plain && "smu-button--plain",
|
|
60
|
+
block && "smu-button--block",
|
|
61
|
+
round && "smu-button--round",
|
|
62
|
+
square && "smu-button--square",
|
|
63
|
+
loading && "smu-button--loading",
|
|
64
|
+
disabled && "smu-button--disabled",
|
|
65
|
+
hairline && "smu-hairline--surround",
|
|
66
|
+
className,
|
|
67
|
+
]
|
|
68
|
+
.filter(Boolean)
|
|
69
|
+
.join(" "),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const customStyle = $derived(() => {
|
|
73
|
+
if (!color) return "";
|
|
74
|
+
const s: string[] = [];
|
|
75
|
+
if (plain) {
|
|
76
|
+
s.push(`color: ${color}`);
|
|
77
|
+
s.push(`border-color: ${color}`);
|
|
78
|
+
} else {
|
|
79
|
+
s.push(`color: white`);
|
|
80
|
+
s.push(`background: ${color}`);
|
|
81
|
+
if (!color.includes("gradient")) s.push(`border-color: ${color}`);
|
|
82
|
+
else s.push("border: 0");
|
|
83
|
+
}
|
|
84
|
+
return s.join("; ");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
function handleClick(e: MouseEvent) {
|
|
88
|
+
if (!loading && !disabled && onclick) onclick(e);
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<button
|
|
93
|
+
type={nativeType}
|
|
94
|
+
class={classes}
|
|
95
|
+
style={customStyle()}
|
|
96
|
+
{disabled}
|
|
97
|
+
onclick={handleClick}
|
|
98
|
+
>
|
|
99
|
+
<div class="smu-button__content">
|
|
100
|
+
{#if loading}
|
|
101
|
+
{#if iconPosition === "left"}
|
|
102
|
+
<Loading
|
|
103
|
+
size={loadingSize}
|
|
104
|
+
type={loadingType}
|
|
105
|
+
class="smu-button__loading"
|
|
106
|
+
/>
|
|
107
|
+
{/if}
|
|
108
|
+
<span class="smu-button__text"
|
|
109
|
+
>{loadingText ||
|
|
110
|
+
text ||
|
|
111
|
+
""}{#if children && !loadingText}{@render children()}{/if}</span
|
|
112
|
+
>
|
|
113
|
+
{#if iconPosition === "right"}
|
|
114
|
+
<Loading
|
|
115
|
+
size={loadingSize}
|
|
116
|
+
type={loadingType}
|
|
117
|
+
class="smu-button__loading"
|
|
118
|
+
/>
|
|
119
|
+
{/if}
|
|
120
|
+
{:else}
|
|
121
|
+
{#if icon && iconPosition === "left"}
|
|
122
|
+
<Icon name={icon} class="smu-button__icon" />
|
|
123
|
+
{/if}
|
|
124
|
+
{#if text || children}
|
|
125
|
+
<span class="smu-button__text"
|
|
126
|
+
>{text}{#if children}{@render children()}{/if}</span
|
|
127
|
+
>
|
|
128
|
+
{/if}
|
|
129
|
+
{#if icon && iconPosition === "right"}
|
|
130
|
+
<Icon name={icon} class="smu-button__icon" />
|
|
131
|
+
{/if}
|
|
132
|
+
{/if}
|
|
133
|
+
</div>
|
|
134
|
+
</button>
|
|
135
|
+
|
|
136
|
+
<style lang="scss">
|
|
137
|
+
.smu-button {
|
|
138
|
+
position: relative;
|
|
139
|
+
display: inline-flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
height: 44px;
|
|
144
|
+
margin: 0;
|
|
145
|
+
padding: 0 15px;
|
|
146
|
+
font-size: var(--smu-font-size-lg);
|
|
147
|
+
line-height: 1.2;
|
|
148
|
+
text-align: center;
|
|
149
|
+
border-radius: var(--smu-radius-md);
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
border: 1px solid transparent;
|
|
152
|
+
transition: opacity var(--smu-duration-fast);
|
|
153
|
+
-webkit-appearance: none;
|
|
154
|
+
-webkit-font-smoothing: auto;
|
|
155
|
+
|
|
156
|
+
&::before {
|
|
157
|
+
position: absolute;
|
|
158
|
+
top: 50%;
|
|
159
|
+
left: 50%;
|
|
160
|
+
width: 100%;
|
|
161
|
+
height: 100%;
|
|
162
|
+
background: var(--smu-black);
|
|
163
|
+
border: inherit;
|
|
164
|
+
border-color: var(--smu-black);
|
|
165
|
+
border-radius: inherit;
|
|
166
|
+
transform: translate(-50%, -50%);
|
|
167
|
+
opacity: 0;
|
|
168
|
+
content: "";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&:active::before {
|
|
172
|
+
opacity: 0.1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__content {
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
justify-content: center;
|
|
179
|
+
height: 100%;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&__text {
|
|
183
|
+
display: inline;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&__icon {
|
|
187
|
+
font-size: 1.2em;
|
|
188
|
+
line-height: inherit;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&__icon + &__text,
|
|
192
|
+
&__loading + &__text,
|
|
193
|
+
&__text + &__icon,
|
|
194
|
+
&__text + &__loading {
|
|
195
|
+
margin-left: 4px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ========== 类型 ==========
|
|
199
|
+
&--default {
|
|
200
|
+
color: var(--smu-text-color);
|
|
201
|
+
background: var(--smu-white);
|
|
202
|
+
border-color: var(--smu-border-color);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&--primary {
|
|
206
|
+
color: var(--smu-white);
|
|
207
|
+
background: var(--smu-primary-color);
|
|
208
|
+
border-color: var(--smu-primary-color);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&--success {
|
|
212
|
+
color: var(--smu-white);
|
|
213
|
+
background: var(--smu-success-color);
|
|
214
|
+
border-color: var(--smu-success-color);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&--warning {
|
|
218
|
+
color: var(--smu-white);
|
|
219
|
+
background: var(--smu-warning-color);
|
|
220
|
+
border-color: var(--smu-warning-color);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&--danger {
|
|
224
|
+
color: var(--smu-white);
|
|
225
|
+
background: var(--smu-danger-color);
|
|
226
|
+
border-color: var(--smu-danger-color);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ========== 朴素 ==========
|
|
230
|
+
&--plain {
|
|
231
|
+
background: var(--smu-white);
|
|
232
|
+
|
|
233
|
+
&.smu-button--primary {
|
|
234
|
+
color: var(--smu-primary-color);
|
|
235
|
+
}
|
|
236
|
+
&.smu-button--success {
|
|
237
|
+
color: var(--smu-success-color);
|
|
238
|
+
}
|
|
239
|
+
&.smu-button--warning {
|
|
240
|
+
color: var(--smu-warning-color);
|
|
241
|
+
}
|
|
242
|
+
&.smu-button--danger {
|
|
243
|
+
color: var(--smu-danger-color);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ========== 尺寸 ==========
|
|
248
|
+
&--large {
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: 50px;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&--small {
|
|
254
|
+
height: 32px;
|
|
255
|
+
padding: 0 8px;
|
|
256
|
+
font-size: var(--smu-font-size-sm);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
&--mini {
|
|
260
|
+
height: 24px;
|
|
261
|
+
padding: 0 4px;
|
|
262
|
+
font-size: var(--smu-font-size-xs);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// ========== 形状 ==========
|
|
266
|
+
&--round {
|
|
267
|
+
border-radius: var(--smu-radius-max);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&--square {
|
|
271
|
+
border-radius: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
&--block {
|
|
275
|
+
display: flex;
|
|
276
|
+
width: 100%;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ========== 状态 ==========
|
|
280
|
+
&--disabled {
|
|
281
|
+
cursor: not-allowed;
|
|
282
|
+
opacity: var(--smu-disabled-opacity);
|
|
283
|
+
|
|
284
|
+
&:active::before {
|
|
285
|
+
opacity: 0;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&--loading {
|
|
290
|
+
cursor: default;
|
|
291
|
+
|
|
292
|
+
&:active::before {
|
|
293
|
+
opacity: 0;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from './Button.svelte'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = '',
|
|
7
|
+
...restProps
|
|
8
|
+
}: {
|
|
9
|
+
children?: Snippet
|
|
10
|
+
class?: string
|
|
11
|
+
[key: string]: any
|
|
12
|
+
} = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="smu-calendar {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-calendar {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Calendar } from './Calendar.svelte'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = '',
|
|
7
|
+
...restProps
|
|
8
|
+
}: {
|
|
9
|
+
children?: Snippet
|
|
10
|
+
class?: string
|
|
11
|
+
[key: string]: any
|
|
12
|
+
} = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="smu-card {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-card {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Card } from './Card.svelte'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = '',
|
|
7
|
+
...restProps
|
|
8
|
+
}: {
|
|
9
|
+
children?: Snippet
|
|
10
|
+
class?: string
|
|
11
|
+
[key: string]: any
|
|
12
|
+
} = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="smu-cascader {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-cascader {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Cascader } from './Cascader.svelte'
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from '../Icon/Icon.svelte'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
title = '',
|
|
7
|
+
value = '',
|
|
8
|
+
label = '',
|
|
9
|
+
icon = '',
|
|
10
|
+
size = '',
|
|
11
|
+
border = true,
|
|
12
|
+
center = false,
|
|
13
|
+
isLink = false,
|
|
14
|
+
required = false,
|
|
15
|
+
arrowDirection = 'right',
|
|
16
|
+
clickable = false,
|
|
17
|
+
titleClass = '',
|
|
18
|
+
valueClass = '',
|
|
19
|
+
labelClass = '',
|
|
20
|
+
onclick,
|
|
21
|
+
children,
|
|
22
|
+
titleSlot,
|
|
23
|
+
class: className = '',
|
|
24
|
+
}: {
|
|
25
|
+
title?: string
|
|
26
|
+
value?: string | number
|
|
27
|
+
label?: string
|
|
28
|
+
icon?: string
|
|
29
|
+
size?: '' | 'large'
|
|
30
|
+
border?: boolean
|
|
31
|
+
center?: boolean
|
|
32
|
+
isLink?: boolean
|
|
33
|
+
required?: boolean
|
|
34
|
+
arrowDirection?: 'up' | 'down' | 'left' | 'right'
|
|
35
|
+
clickable?: boolean | null
|
|
36
|
+
titleClass?: string
|
|
37
|
+
valueClass?: string
|
|
38
|
+
labelClass?: string
|
|
39
|
+
onclick?: (e: MouseEvent) => void
|
|
40
|
+
children?: Snippet
|
|
41
|
+
titleSlot?: Snippet
|
|
42
|
+
class?: string
|
|
43
|
+
} = $props()
|
|
44
|
+
|
|
45
|
+
const isClickable = $derived(clickable ?? isLink)
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
class="smu-cell {size ? `smu-cell--${size}` : ''} {center ? 'smu-cell--center' : ''} {required ? 'smu-cell--required' : ''} {border ? 'smu-cell--border' : ''} {isClickable ? 'smu-cell--clickable' : ''} {className}"
|
|
50
|
+
role={isClickable ? 'button' : undefined}
|
|
51
|
+
tabindex={isClickable ? 0 : undefined}
|
|
52
|
+
onclick={onclick}
|
|
53
|
+
>
|
|
54
|
+
{#if icon}
|
|
55
|
+
<Icon name={icon} class="smu-cell__left-icon" />
|
|
56
|
+
{/if}
|
|
57
|
+
<div class="smu-cell__title {titleClass}">
|
|
58
|
+
{#if titleSlot}{@render titleSlot()}{:else}{title}{/if}
|
|
59
|
+
{#if label}<div class="smu-cell__label {labelClass}">{label}</div>{/if}
|
|
60
|
+
</div>
|
|
61
|
+
<div class="smu-cell__value {valueClass}">
|
|
62
|
+
{#if children}{@render children()}{:else}{value}{/if}
|
|
63
|
+
</div>
|
|
64
|
+
{#if isLink}
|
|
65
|
+
<Icon name="arrow" class="smu-cell__right-icon smu-cell__right-icon--{arrowDirection}" />
|
|
66
|
+
{/if}
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<style lang="scss">
|
|
70
|
+
.smu-cell {
|
|
71
|
+
position: relative;
|
|
72
|
+
display: flex;
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
width: 100%;
|
|
75
|
+
padding: 10px 16px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
color: var(--smu-text-color);
|
|
78
|
+
font-size: var(--smu-font-size-md);
|
|
79
|
+
line-height: 24px;
|
|
80
|
+
background: var(--smu-background-2);
|
|
81
|
+
|
|
82
|
+
&--border::after {
|
|
83
|
+
position: absolute;
|
|
84
|
+
box-sizing: border-box;
|
|
85
|
+
content: '';
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
right: 16px;
|
|
88
|
+
bottom: 0;
|
|
89
|
+
left: 16px;
|
|
90
|
+
border-bottom: 1px solid var(--smu-border-color);
|
|
91
|
+
transform: scaleY(0.5);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&--center { align-items: center; }
|
|
95
|
+
|
|
96
|
+
&--required::before {
|
|
97
|
+
position: absolute;
|
|
98
|
+
left: 8px;
|
|
99
|
+
color: var(--smu-danger-color);
|
|
100
|
+
font-size: var(--smu-font-size-md);
|
|
101
|
+
content: '*';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&--clickable {
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
&:active { background: var(--smu-active-color); }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&--large {
|
|
110
|
+
padding-top: 12px;
|
|
111
|
+
padding-bottom: 12px;
|
|
112
|
+
|
|
113
|
+
.smu-cell__title { font-size: var(--smu-font-size-lg); }
|
|
114
|
+
.smu-cell__label { font-size: var(--smu-font-size-md); }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__left-icon {
|
|
118
|
+
margin-right: 4px;
|
|
119
|
+
font-size: 16px;
|
|
120
|
+
line-height: 24px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&__right-icon {
|
|
124
|
+
margin-left: 4px;
|
|
125
|
+
color: var(--smu-gray-6);
|
|
126
|
+
font-size: 16px;
|
|
127
|
+
line-height: 24px;
|
|
128
|
+
flex-shrink: 0;
|
|
129
|
+
|
|
130
|
+
&--up { transform: rotate(90deg); }
|
|
131
|
+
&--down { transform: rotate(-90deg); }
|
|
132
|
+
&--left { transform: rotate(0deg); }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&__title {
|
|
136
|
+
flex: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&__value {
|
|
140
|
+
position: relative;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
color: var(--smu-gray-6);
|
|
143
|
+
text-align: right;
|
|
144
|
+
vertical-align: middle;
|
|
145
|
+
word-wrap: break-word;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__label {
|
|
149
|
+
margin-top: 4px;
|
|
150
|
+
color: var(--smu-gray-6);
|
|
151
|
+
font-size: var(--smu-font-size-sm);
|
|
152
|
+
line-height: var(--smu-line-height-sm);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Cell } from './Cell.svelte'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
title = '',
|
|
6
|
+
inset = false,
|
|
7
|
+
border = true,
|
|
8
|
+
children,
|
|
9
|
+
class: className = '',
|
|
10
|
+
}: {
|
|
11
|
+
title?: string
|
|
12
|
+
inset?: boolean
|
|
13
|
+
border?: boolean
|
|
14
|
+
children?: Snippet
|
|
15
|
+
class?: string
|
|
16
|
+
} = $props()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#if title}
|
|
20
|
+
<div class="smu-cell-group__title {inset ? 'smu-cell-group__title--inset' : ''}">{title}</div>
|
|
21
|
+
{/if}
|
|
22
|
+
<div class="smu-cell-group {inset ? 'smu-cell-group--inset' : ''} {border ? 'smu-hairline--top-bottom' : ''} {className}">
|
|
23
|
+
{#if children}{@render children()}{/if}
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<style lang="scss">
|
|
27
|
+
.smu-cell-group {
|
|
28
|
+
background: var(--smu-background-2);
|
|
29
|
+
|
|
30
|
+
&--inset {
|
|
31
|
+
margin: 0 var(--smu-padding-md);
|
|
32
|
+
border-radius: var(--smu-radius-lg);
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__title {
|
|
37
|
+
padding: var(--smu-padding-md) var(--smu-padding-md) var(--smu-padding-xs);
|
|
38
|
+
color: var(--smu-text-color-2);
|
|
39
|
+
font-size: var(--smu-font-size-md);
|
|
40
|
+
line-height: var(--smu-line-height-md);
|
|
41
|
+
|
|
42
|
+
&--inset {
|
|
43
|
+
padding-left: calc(var(--smu-padding-md) * 2);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|