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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 free-walk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# svelte-mobile-ui
|
|
2
|
+
|
|
3
|
+
基于 Svelte 5 的移动端 UI 组件库,提供 80+ 高质量组件。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 🎯 **80+ 组件** — 覆盖移动端开发常用场景
|
|
8
|
+
- ⚡ **Svelte 5** — 基于 Svelte 5 Runes 模式,性能优异
|
|
9
|
+
- 📦 **按需引入** — 支持全量引入和按需引入
|
|
10
|
+
- 🌐 **CDN 支持** — 提供 IIFE 格式,可直接通过 CDN 使用
|
|
11
|
+
- 🎨 **主题定制** — 基于 CSS 变量,轻松定制主题
|
|
12
|
+
- 📱 **移动端优先** — 专为移动端设计,触控友好
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install svelte-mobile-ui
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 快速开始
|
|
21
|
+
|
|
22
|
+
### ES Module 引入
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { Button, Cell, Icon } from 'svelte-mobile-ui'
|
|
26
|
+
import 'svelte-mobile-ui/dist/styles.css'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 按需引入
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { Button } from 'svelte-mobile-ui/components/Button'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### CDN 引入
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<link rel="stylesheet" href="https://unpkg.com/svelte-mobile-ui/dist/styles.css" />
|
|
39
|
+
<script src="https://unpkg.com/svelte-mobile-ui/dist/svelte-mobile-ui.iife.js"></script>
|
|
40
|
+
<script>
|
|
41
|
+
const { Button, Cell } = SvelteMobileUI
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 组件列表
|
|
46
|
+
|
|
47
|
+
### 基础组件
|
|
48
|
+
- `Button` — 按钮
|
|
49
|
+
- `Cell` / `CellGroup` — 单元格
|
|
50
|
+
- `Icon` — 图标
|
|
51
|
+
- `ImageComp` — 图片
|
|
52
|
+
- `Popup` — 弹出层
|
|
53
|
+
- `Overlay` — 遮罩层
|
|
54
|
+
- `Toast` — 轻提示
|
|
55
|
+
- `ConfigProvider` — 全局配置
|
|
56
|
+
|
|
57
|
+
### 表单组件
|
|
58
|
+
- `Calendar` — 日历
|
|
59
|
+
- `Cascader` — 级联选择
|
|
60
|
+
- `Checkbox` / `CheckboxGroup` — 复选框
|
|
61
|
+
- `DatePicker` — 日期选择
|
|
62
|
+
- `Field` — 输入框
|
|
63
|
+
- `Form` — 表单
|
|
64
|
+
- `NumberKeyboard` — 数字键盘
|
|
65
|
+
- `PasswordInput` — 密码输入框
|
|
66
|
+
- `Picker` / `PickerGroup` — 选择器
|
|
67
|
+
- `Radio` / `RadioGroup` — 单选
|
|
68
|
+
- `Rate` — 评分
|
|
69
|
+
- `Search` — 搜索
|
|
70
|
+
- `Slider` — 滑块
|
|
71
|
+
- `Stepper` — 步进器
|
|
72
|
+
- `Switch` — 开关
|
|
73
|
+
- `TimePicker` — 时间选择
|
|
74
|
+
- `Uploader` — 文件上传
|
|
75
|
+
|
|
76
|
+
### 反馈组件
|
|
77
|
+
- `ActionSheet` — 动作面板
|
|
78
|
+
- `Dialog` — 弹出框
|
|
79
|
+
- `Loading` — 加载
|
|
80
|
+
- `Notify` — 消息提示
|
|
81
|
+
- `Popover` — 气泡弹出框
|
|
82
|
+
- `PullRefresh` — 下拉刷新
|
|
83
|
+
- `ShareSheet` — 分享面板
|
|
84
|
+
- `SwipeCell` — 滑动单元格
|
|
85
|
+
- `FloatingPanel` — 浮动面板
|
|
86
|
+
- `FloatingBubble` — 浮动气泡
|
|
87
|
+
|
|
88
|
+
### 展示组件
|
|
89
|
+
- `Badge` — 徽标
|
|
90
|
+
- `Circle` — 环形进度条
|
|
91
|
+
- `Collapse` / `CollapseItem` — 折叠面板
|
|
92
|
+
- `CountDown` — 倒计时
|
|
93
|
+
- `Divider` — 分割线
|
|
94
|
+
- `Empty` — 空状态
|
|
95
|
+
- `Highlight` — 高亮文本
|
|
96
|
+
- `ImagePreview` — 图片预览
|
|
97
|
+
- `NoticeBar` — 通知栏
|
|
98
|
+
- `Progress` — 进度条
|
|
99
|
+
- `Skeleton` — 骨架屏
|
|
100
|
+
- `Steps` / `Step` — 步骤条
|
|
101
|
+
- `Swipe` / `SwipeItem` — 轮播
|
|
102
|
+
- `Tag` — 标签
|
|
103
|
+
- `TextEllipsis` — 文本省略
|
|
104
|
+
- `Watermark` — 水印
|
|
105
|
+
- `Barrage` — 弹幕
|
|
106
|
+
- `RollingText` — 翻滚文本
|
|
107
|
+
- `List` — 列表
|
|
108
|
+
|
|
109
|
+
### 导航组件
|
|
110
|
+
- `ActionBar` — 动作栏
|
|
111
|
+
- `BackTop` — 回到顶部
|
|
112
|
+
- `Grid` / `GridItem` — 宫格
|
|
113
|
+
- `IndexBar` / `IndexAnchor` — 索引栏
|
|
114
|
+
- `NavBar` — 导航栏
|
|
115
|
+
- `Pagination` — 分页
|
|
116
|
+
- `Sidebar` / `SidebarItem` — 侧边导航
|
|
117
|
+
- `Sticky` — 粘性布局
|
|
118
|
+
- `Tabs` / `Tab` — 标签页
|
|
119
|
+
- `Tabbar` / `TabbarItem` — 标签栏
|
|
120
|
+
- `TreeSelect` — 分类选择
|
|
121
|
+
|
|
122
|
+
### 布局组件
|
|
123
|
+
- `Col` — 列
|
|
124
|
+
- `Row` — 行
|
|
125
|
+
- `Space` — 间距
|
|
126
|
+
|
|
127
|
+
### 业务组件
|
|
128
|
+
- `AddressEdit` — 地址编辑
|
|
129
|
+
- `AddressList` — 地址列表
|
|
130
|
+
- `Area` — 省市区选择
|
|
131
|
+
- `Card` — 商品卡片
|
|
132
|
+
- `ContactCard` — 联系人卡片
|
|
133
|
+
- `ContactEdit` — 联系人编辑
|
|
134
|
+
- `ContactList` — 联系人列表
|
|
135
|
+
- `Coupon` / `CouponCell` / `CouponList` — 优惠券
|
|
136
|
+
- `Signature` — 签名
|
|
137
|
+
- `SubmitBar` — 提交订单栏
|
|
138
|
+
- `DropdownMenu` / `DropdownItem` — 下拉菜单
|
|
139
|
+
|
|
140
|
+
## 主题定制
|
|
141
|
+
|
|
142
|
+
通过 CSS 变量定制主题:
|
|
143
|
+
|
|
144
|
+
```css
|
|
145
|
+
:root {
|
|
146
|
+
--smu-primary-color: #1989fa;
|
|
147
|
+
--smu-success-color: #07c160;
|
|
148
|
+
--smu-warning-color: #ff976a;
|
|
149
|
+
--smu-danger-color: #ee0a24;
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
或使用 `ConfigProvider` 组件:
|
|
154
|
+
|
|
155
|
+
```svelte
|
|
156
|
+
<ConfigProvider theme={{ primaryColor: '#1989fa' }}>
|
|
157
|
+
<Button type="primary">主题按钮</Button>
|
|
158
|
+
</ConfigProvider>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## 兼容性
|
|
162
|
+
|
|
163
|
+
| 格式 | 文件 | 用途 |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| ESM | `dist/svelte-mobile-ui.mjs` | `import` 语法 |
|
|
166
|
+
| CJS | `dist/svelte-mobile-ui.cjs` | `require()` 语法 |
|
|
167
|
+
| IIFE | `dist/svelte-mobile-ui.iife.js` | CDN / `<script>` 标签 |
|
|
168
|
+
| CSS | `dist/styles.css` | 全局样式 |
|
|
169
|
+
| Svelte 源码 | `index.ts` | Svelte 项目直接引用 |
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
class: className = "",
|
|
7
|
+
}: {
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div class="smu-action-bar {className}">
|
|
14
|
+
{#if children}{@render children()}{/if}
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style lang="scss">
|
|
18
|
+
.smu-action-bar {
|
|
19
|
+
position: fixed;
|
|
20
|
+
right: 0;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
padding: 0 var(--smu-padding-md);
|
|
27
|
+
height: 50px;
|
|
28
|
+
background: var(--smu-background-2);
|
|
29
|
+
z-index: var(--smu-action-bar-z-index, 100);
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
text = "",
|
|
6
|
+
type = "danger",
|
|
7
|
+
color = "",
|
|
8
|
+
icon = "",
|
|
9
|
+
loading = false,
|
|
10
|
+
disabled = false,
|
|
11
|
+
url = "",
|
|
12
|
+
onclick,
|
|
13
|
+
children,
|
|
14
|
+
class: className = "",
|
|
15
|
+
}: {
|
|
16
|
+
text?: string;
|
|
17
|
+
type?: "default" | "primary" | "warning" | "danger";
|
|
18
|
+
color?: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
url?: string;
|
|
23
|
+
onclick?: (e: MouseEvent) => void;
|
|
24
|
+
children?: Snippet;
|
|
25
|
+
class?: string;
|
|
26
|
+
} = $props();
|
|
27
|
+
|
|
28
|
+
function handleClick(e: MouseEvent) {
|
|
29
|
+
if (loading || disabled) return;
|
|
30
|
+
onclick?.(e);
|
|
31
|
+
if (url) window.location.href = url;
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<button
|
|
36
|
+
class="smu-action-bar-button smu-action-bar-button--{type} {loading
|
|
37
|
+
? 'smu-action-bar-button--loading'
|
|
38
|
+
: ''} {className}"
|
|
39
|
+
style={color ? `background: ${color}; border-color: ${color}` : ""}
|
|
40
|
+
disabled={disabled || loading}
|
|
41
|
+
onclick={handleClick}
|
|
42
|
+
>
|
|
43
|
+
{#if loading}
|
|
44
|
+
<span class="smu-action-bar-button__loading"></span>
|
|
45
|
+
{/if}
|
|
46
|
+
{#if children}{@render children()}{:else}{text}{/if}
|
|
47
|
+
</button>
|
|
48
|
+
|
|
49
|
+
<style lang="scss">
|
|
50
|
+
.smu-action-bar-button {
|
|
51
|
+
flex: 1;
|
|
52
|
+
height: 40px;
|
|
53
|
+
font-size: var(--smu-font-size-md);
|
|
54
|
+
font-weight: var(--smu-font-bold);
|
|
55
|
+
border: none;
|
|
56
|
+
border-radius: var(--smu-radius-max);
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
color: var(--smu-white);
|
|
59
|
+
|
|
60
|
+
&:not(:first-child) {
|
|
61
|
+
margin-left: 8px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&--danger {
|
|
65
|
+
background: var(--smu-danger-color);
|
|
66
|
+
}
|
|
67
|
+
&--warning {
|
|
68
|
+
background: var(--smu-warning-color);
|
|
69
|
+
}
|
|
70
|
+
&--primary {
|
|
71
|
+
background: var(--smu-primary-color);
|
|
72
|
+
}
|
|
73
|
+
&--default {
|
|
74
|
+
background: var(--smu-white);
|
|
75
|
+
color: var(--smu-text-color);
|
|
76
|
+
border: 1px solid var(--smu-border-color);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:disabled {
|
|
80
|
+
opacity: 0.5;
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
}
|
|
83
|
+
&:active:not(:disabled) {
|
|
84
|
+
opacity: 0.8;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&__loading {
|
|
88
|
+
display: inline-block;
|
|
89
|
+
width: 16px;
|
|
90
|
+
height: 16px;
|
|
91
|
+
border: 2px solid currentColor;
|
|
92
|
+
border-top-color: transparent;
|
|
93
|
+
border-radius: 50%;
|
|
94
|
+
animation: smu-rotate 0.8s linear infinite;
|
|
95
|
+
margin-right: 4px;
|
|
96
|
+
vertical-align: middle;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes smu-rotate {
|
|
101
|
+
to {
|
|
102
|
+
transform: rotate(360deg);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import Icon from "../Icon/Icon.svelte";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
text = "",
|
|
7
|
+
icon = "",
|
|
8
|
+
color = "",
|
|
9
|
+
dot = false,
|
|
10
|
+
badge = "",
|
|
11
|
+
url = "",
|
|
12
|
+
onclick,
|
|
13
|
+
iconSlot,
|
|
14
|
+
class: className = "",
|
|
15
|
+
}: {
|
|
16
|
+
text?: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
color?: string;
|
|
19
|
+
dot?: boolean;
|
|
20
|
+
badge?: string | number;
|
|
21
|
+
url?: string;
|
|
22
|
+
onclick?: (e: MouseEvent) => void;
|
|
23
|
+
iconSlot?: Snippet;
|
|
24
|
+
class?: string;
|
|
25
|
+
} = $props();
|
|
26
|
+
|
|
27
|
+
function handleClick(e: MouseEvent) {
|
|
28
|
+
onclick?.(e);
|
|
29
|
+
if (url) window.location.href = url;
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
class="smu-action-bar-icon {className}"
|
|
35
|
+
role="button"
|
|
36
|
+
tabindex="0"
|
|
37
|
+
onclick={handleClick}
|
|
38
|
+
>
|
|
39
|
+
<div class="smu-action-bar-icon__icon">
|
|
40
|
+
{#if iconSlot}
|
|
41
|
+
{@render iconSlot()}
|
|
42
|
+
{:else if icon}
|
|
43
|
+
<Icon name={icon} {color} />
|
|
44
|
+
{/if}
|
|
45
|
+
{#if dot}<div class="smu-action-bar-icon__dot"></div>{/if}
|
|
46
|
+
{#if badge}<div class="smu-action-bar-icon__badge">{badge}</div>{/if}
|
|
47
|
+
</div>
|
|
48
|
+
{#if text}<span class="smu-action-bar-icon__text">{text}</span>{/if}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<style lang="scss">
|
|
52
|
+
.smu-action-bar-icon {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
min-width: 48px;
|
|
58
|
+
height: 100%;
|
|
59
|
+
color: var(--smu-text-color);
|
|
60
|
+
font-size: var(--smu-font-size-xs);
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
|
|
63
|
+
&:active {
|
|
64
|
+
opacity: 0.7;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&__icon {
|
|
68
|
+
position: relative;
|
|
69
|
+
font-size: 18px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__text {
|
|
73
|
+
margin-top: 4px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__dot {
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: -4px;
|
|
79
|
+
right: -4px;
|
|
80
|
+
width: 8px;
|
|
81
|
+
height: 8px;
|
|
82
|
+
background: var(--smu-danger-color);
|
|
83
|
+
border-radius: 50%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__badge {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: -6px;
|
|
89
|
+
right: -8px;
|
|
90
|
+
min-width: 16px;
|
|
91
|
+
padding: 0 3px;
|
|
92
|
+
color: var(--smu-white);
|
|
93
|
+
font-size: 10px;
|
|
94
|
+
line-height: 14px;
|
|
95
|
+
text-align: center;
|
|
96
|
+
background: var(--smu-danger-color);
|
|
97
|
+
border-radius: var(--smu-radius-max);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Popup from '../Popup/Popup.svelte'
|
|
3
|
+
import Loading from '../Loading/Loading.svelte'
|
|
4
|
+
import Icon from '../Icon/Icon.svelte'
|
|
5
|
+
import type { Snippet } from 'svelte'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
show = $bindable(false),
|
|
9
|
+
title = '',
|
|
10
|
+
description = '',
|
|
11
|
+
cancelText = '',
|
|
12
|
+
closeable = true,
|
|
13
|
+
closeIcon = 'cross',
|
|
14
|
+
round = true,
|
|
15
|
+
safeAreaInsetBottom = true,
|
|
16
|
+
actions = [],
|
|
17
|
+
onSelect,
|
|
18
|
+
onCancel,
|
|
19
|
+
onclose,
|
|
20
|
+
children,
|
|
21
|
+
class: className = '',
|
|
22
|
+
}: {
|
|
23
|
+
show?: boolean
|
|
24
|
+
title?: string
|
|
25
|
+
description?: string
|
|
26
|
+
cancelText?: string
|
|
27
|
+
closeable?: boolean
|
|
28
|
+
closeIcon?: string
|
|
29
|
+
round?: boolean
|
|
30
|
+
safeAreaInsetBottom?: boolean
|
|
31
|
+
actions?: Array<{ name: string; subname?: string; color?: string; loading?: boolean; disabled?: boolean; className?: string }>
|
|
32
|
+
onSelect?: (action: any, index: number) => void
|
|
33
|
+
onCancel?: () => void
|
|
34
|
+
onclose?: () => void
|
|
35
|
+
children?: Snippet
|
|
36
|
+
class?: string
|
|
37
|
+
} = $props()
|
|
38
|
+
|
|
39
|
+
function handleClose() { show = false; onclose?.() }
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<Popup bind:show position="bottom" {round} {closeable} closeIcon={title ? closeIcon : ''} {safeAreaInsetBottom} onclose={handleClose}>
|
|
43
|
+
<div class="smu-action-sheet {className}">
|
|
44
|
+
{#if title}
|
|
45
|
+
<div class="smu-action-sheet__header">{title}</div>
|
|
46
|
+
{/if}
|
|
47
|
+
{#if description}
|
|
48
|
+
<div class="smu-action-sheet__description">{description}</div>
|
|
49
|
+
{/if}
|
|
50
|
+
{#if children}
|
|
51
|
+
<div class="smu-action-sheet__content">{@render children()}</div>
|
|
52
|
+
{:else}
|
|
53
|
+
{#each actions as action, i}
|
|
54
|
+
<button
|
|
55
|
+
class="smu-action-sheet__item {action.disabled ? 'smu-action-sheet__item--disabled' : ''} {action.className || ''}"
|
|
56
|
+
style="{action.color ? `color: ${action.color}` : ''}"
|
|
57
|
+
disabled={action.disabled || action.loading}
|
|
58
|
+
onclick={() => { if (!action.disabled && !action.loading) { onSelect?.(action, i); show = false } }}
|
|
59
|
+
type="button"
|
|
60
|
+
>
|
|
61
|
+
{#if action.loading}
|
|
62
|
+
<Loading size="20px" />
|
|
63
|
+
{:else}
|
|
64
|
+
<span class="smu-action-sheet__name">{action.name}</span>
|
|
65
|
+
{#if action.subname}<div class="smu-action-sheet__subname">{action.subname}</div>{/if}
|
|
66
|
+
{/if}
|
|
67
|
+
</button>
|
|
68
|
+
{/each}
|
|
69
|
+
{/if}
|
|
70
|
+
{#if cancelText}
|
|
71
|
+
<div class="smu-action-sheet__gap"></div>
|
|
72
|
+
<button class="smu-action-sheet__cancel" onclick={() => { show = false; onCancel?.() }} type="button">{cancelText}</button>
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
75
|
+
</Popup>
|
|
76
|
+
|
|
77
|
+
<style lang="scss">
|
|
78
|
+
.smu-action-sheet {
|
|
79
|
+
max-height: 80vh;
|
|
80
|
+
overflow-y: auto;
|
|
81
|
+
color: var(--smu-text-color);
|
|
82
|
+
|
|
83
|
+
&__header {
|
|
84
|
+
padding: 12px 16px;
|
|
85
|
+
font-weight: var(--smu-font-bold);
|
|
86
|
+
font-size: var(--smu-font-size-lg);
|
|
87
|
+
line-height: var(--smu-line-height-lg);
|
|
88
|
+
text-align: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&__description {
|
|
92
|
+
padding: 12px 16px;
|
|
93
|
+
color: var(--smu-text-color-2);
|
|
94
|
+
font-size: var(--smu-font-size-md);
|
|
95
|
+
line-height: var(--smu-line-height-md);
|
|
96
|
+
text-align: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&__item {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
width: 100%;
|
|
105
|
+
padding: 14px 16px;
|
|
106
|
+
font-size: var(--smu-font-size-lg);
|
|
107
|
+
background: var(--smu-background-2);
|
|
108
|
+
border: none;
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
|
|
111
|
+
&:active { background: var(--smu-active-color); }
|
|
112
|
+
&--disabled { color: var(--smu-gray-5); cursor: not-allowed; &:active { background: var(--smu-background-2); } }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&__subname {
|
|
116
|
+
margin-top: var(--smu-padding-xs);
|
|
117
|
+
color: var(--smu-text-color-2);
|
|
118
|
+
font-size: var(--smu-font-size-sm);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__gap { display: block; height: 8px; background: var(--smu-background); }
|
|
122
|
+
|
|
123
|
+
&__cancel {
|
|
124
|
+
display: block;
|
|
125
|
+
width: 100%;
|
|
126
|
+
padding: 14px;
|
|
127
|
+
font-size: var(--smu-font-size-lg);
|
|
128
|
+
background: var(--smu-background-2);
|
|
129
|
+
border: none;
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
&:active { background: var(--smu-active-color); }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ActionSheet } from './ActionSheet.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-addressedit {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-addressedit {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AddressEdit } from './AddressEdit.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-addresslist {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-addresslist {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AddressList } from './AddressList.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-area {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-area {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Area } from './Area.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-backtop {className}">
|
|
16
|
+
{#if children}{@render children()}{/if}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.smu-backtop {
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BackTop } from './BackTop.svelte'
|