@daisu-ui/ui 0.0.0-stage → 0.1.0-beta.3
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/CHANGELOG.md +58 -0
- package/LICENSE +21 -0
- package/README.md +93 -2
- package/THIRD_PARTY_NOTICES.md +19 -0
- package/dist/ActionSheet.d.ts +45 -0
- package/dist/ActionSheet.jsx +37 -0
- package/dist/AnchoredBubble.d.ts +36 -0
- package/dist/AnchoredBubble.jsx +120 -0
- package/dist/Avatar.d.ts +35 -0
- package/dist/Avatar.jsx +29 -0
- package/dist/Backtop.d.ts +22 -0
- package/dist/Backtop.jsx +18 -0
- package/dist/Badge.d.ts +19 -0
- package/dist/Badge.jsx +11 -0
- package/dist/BarCode.d.ts +20 -0
- package/dist/BarCode.jsx +38 -0
- package/dist/Button.d.ts +21 -0
- package/dist/Button.jsx +19 -0
- package/dist/Calendar.d.ts +90 -0
- package/dist/Calendar.jsx +164 -0
- package/dist/CalendarView.d.ts +51 -0
- package/dist/CalendarView.jsx +136 -0
- package/dist/Card.d.ts +21 -0
- package/dist/Card.jsx +21 -0
- package/dist/Cascader.d.ts +75 -0
- package/dist/Cascader.jsx +212 -0
- package/dist/Cell.d.ts +34 -0
- package/dist/Cell.jsx +37 -0
- package/dist/Checkbox.d.ts +50 -0
- package/dist/Checkbox.jsx +74 -0
- package/dist/Circle.d.ts +19 -0
- package/dist/Circle.jsx +35 -0
- package/dist/Collapse.d.ts +31 -0
- package/dist/Collapse.jsx +61 -0
- package/dist/ConfigProvider.d.ts +15 -0
- package/dist/ConfigProvider.jsx +20 -0
- package/dist/CountDown.d.ts +20 -0
- package/dist/CountDown.jsx +15 -0
- package/dist/CountTo.d.ts +28 -0
- package/dist/CountTo.jsx +27 -0
- package/dist/Curtain.d.ts +29 -0
- package/dist/Curtain.jsx +51 -0
- package/dist/DatetimePicker.d.ts +46 -0
- package/dist/DatetimePicker.jsx +138 -0
- package/dist/DatetimePickerView.d.ts +38 -0
- package/dist/DatetimePickerView.jsx +36 -0
- package/dist/Dialog.d.ts +64 -0
- package/dist/Dialog.jsx +105 -0
- package/dist/Divider.d.ts +16 -0
- package/dist/Divider.jsx +9 -0
- package/dist/DropMenu.d.ts +55 -0
- package/dist/DropMenu.jsx +210 -0
- package/dist/Empty.d.ts +14 -0
- package/dist/Empty.jsx +14 -0
- package/dist/EmptyState.d.ts +6 -0
- package/dist/EmptyState.jsx +9 -0
- package/dist/Fab.d.ts +30 -0
- package/dist/Fab.jsx +127 -0
- package/dist/FloatingPanel.d.ts +21 -0
- package/dist/FloatingPanel.jsx +102 -0
- package/dist/Form.d.ts +63 -0
- package/dist/Form.jsx +108 -0
- package/dist/FormFieldRow.d.ts +56 -0
- package/dist/FormFieldRow.jsx +63 -0
- package/dist/Gap.d.ts +10 -0
- package/dist/Gap.jsx +14 -0
- package/dist/Grid.d.ts +47 -0
- package/dist/Grid.jsx +31 -0
- package/dist/Icon.d.ts +11 -0
- package/dist/Icon.jsx +12 -0
- package/dist/ImagePreview.d.ts +62 -0
- package/dist/ImagePreview.jsx +78 -0
- package/dist/Img.d.ts +28 -0
- package/dist/Img.jsx +59 -0
- package/dist/ImgCropper.d.ts +74 -0
- package/dist/ImgCropper.jsx +114 -0
- package/dist/IndexBar.d.ts +36 -0
- package/dist/IndexBar.jsx +149 -0
- package/dist/Input.d.ts +11 -0
- package/dist/Input.jsx +3 -0
- package/dist/InputNumber.d.ts +32 -0
- package/dist/InputNumber.jsx +165 -0
- package/dist/Keyboard.d.ts +37 -0
- package/dist/Keyboard.jsx +130 -0
- package/dist/Layout.d.ts +31 -0
- package/dist/Layout.jsx +14 -0
- package/dist/Loading.d.ts +18 -0
- package/dist/Loading.jsx +15 -0
- package/dist/Loadmore.d.ts +18 -0
- package/dist/Loadmore.jsx +16 -0
- package/dist/Navbar.d.ts +35 -0
- package/dist/Navbar.jsx +50 -0
- package/dist/NoticeBar.d.ts +30 -0
- package/dist/NoticeBar.jsx +86 -0
- package/dist/Notify.d.ts +34 -0
- package/dist/Notify.jsx +52 -0
- package/dist/NumberStepper.d.ts +11 -0
- package/dist/NumberStepper.jsx +41 -0
- package/dist/Overlay.d.ts +16 -0
- package/dist/Overlay.jsx +12 -0
- package/dist/PagedList.d.ts +13 -0
- package/dist/PagedList.jsx +36 -0
- package/dist/Pagination.d.ts +29 -0
- package/dist/Pagination.jsx +33 -0
- package/dist/PasswordInput.d.ts +16 -0
- package/dist/PasswordInput.jsx +20 -0
- package/dist/Picker.d.ts +61 -0
- package/dist/Picker.jsx +80 -0
- package/dist/PickerView.d.ts +43 -0
- package/dist/PickerView.jsx +142 -0
- package/dist/Popover.d.ts +23 -0
- package/dist/Popover.jsx +35 -0
- package/dist/Popup.d.ts +30 -0
- package/dist/Popup.jsx +32 -0
- package/dist/Progress.d.ts +17 -0
- package/dist/Progress.jsx +45 -0
- package/dist/QrCode.d.ts +46 -0
- package/dist/QrCode.jsx +67 -0
- package/dist/Radio.d.ts +21 -0
- package/dist/Radio.jsx +34 -0
- package/dist/Rate.d.ts +25 -0
- package/dist/Rate.jsx +39 -0
- package/dist/Resize.d.ts +17 -0
- package/dist/Resize.jsx +17 -0
- package/dist/RichText.d.ts +133 -0
- package/dist/RichText.jsx +288 -0
- package/dist/RootPortal.d.ts +11 -0
- package/dist/RootPortal.jsx +19 -0
- package/dist/Search.d.ts +39 -0
- package/dist/Search.jsx +94 -0
- package/dist/Segmented.d.ts +18 -0
- package/dist/Segmented.jsx +35 -0
- package/dist/SelectPicker.d.ts +54 -0
- package/dist/SelectPicker.jsx +136 -0
- package/dist/Sidebar.d.ts +34 -0
- package/dist/Sidebar.jsx +43 -0
- package/dist/Signature.d.ts +46 -0
- package/dist/Signature.jsx +203 -0
- package/dist/Skeleton.d.ts +27 -0
- package/dist/Skeleton.jsx +29 -0
- package/dist/SlideVerify.d.ts +27 -0
- package/dist/SlideVerify.jsx +138 -0
- package/dist/Slider.d.ts +21 -0
- package/dist/Slider.jsx +131 -0
- package/dist/SortButton.d.ts +16 -0
- package/dist/SortButton.jsx +19 -0
- package/dist/Steps.d.ts +23 -0
- package/dist/Steps.jsx +25 -0
- package/dist/Sticky.d.ts +17 -0
- package/dist/Sticky.jsx +69 -0
- package/dist/SwipeAction.d.ts +27 -0
- package/dist/SwipeAction.jsx +187 -0
- package/dist/Swiper.d.ts +54 -0
- package/dist/Swiper.jsx +94 -0
- package/dist/SwiperNav.d.ts +18 -0
- package/dist/SwiperNav.jsx +10 -0
- package/dist/Switch.d.ts +31 -0
- package/dist/Switch.jsx +46 -0
- package/dist/SyncedInput.d.ts +12 -0
- package/dist/SyncedInput.jsx +18 -0
- package/dist/SyncedTextarea.d.ts +11 -0
- package/dist/SyncedTextarea.jsx +18 -0
- package/dist/Tabbar.d.ts +37 -0
- package/dist/Tabbar.jsx +46 -0
- package/dist/Table.d.ts +51 -0
- package/dist/Table.jsx +125 -0
- package/dist/Tabs.d.ts +65 -0
- package/dist/Tabs.jsx +132 -0
- package/dist/Tag.d.ts +33 -0
- package/dist/Tag.jsx +63 -0
- package/dist/Text.d.ts +19 -0
- package/dist/Text.jsx +7 -0
- package/dist/TextField.d.ts +89 -0
- package/dist/TextField.jsx +149 -0
- package/dist/Textarea.d.ts +22 -0
- package/dist/Textarea.jsx +3 -0
- package/dist/Toast.d.ts +36 -0
- package/dist/Toast.jsx +30 -0
- package/dist/Tooltip.d.ts +8 -0
- package/dist/Tooltip.jsx +5 -0
- package/dist/Tour.d.ts +85 -0
- package/dist/Tour.jsx +150 -0
- package/dist/Transition.d.ts +32 -0
- package/dist/Transition.jsx +43 -0
- package/dist/Upload.d.ts +64 -0
- package/dist/Upload.jsx +163 -0
- package/dist/VideoPreview.d.ts +47 -0
- package/dist/VideoPreview.jsx +59 -0
- package/dist/Watermark.d.ts +36 -0
- package/dist/Watermark.jsx +18 -0
- package/dist/action-sheet.css +19 -0
- package/dist/avatar.css +23 -0
- package/dist/avatarModel.d.ts +8 -0
- package/dist/avatarModel.js +17 -0
- package/dist/backtop.css +6 -0
- package/dist/badge.css +15 -0
- package/dist/badgeModel.d.ts +2 -0
- package/dist/badgeModel.js +18 -0
- package/dist/bar-code.css +5 -0
- package/dist/barCodeModel.d.ts +80 -0
- package/dist/barCodeModel.js +99 -0
- package/dist/bubble.css +14 -0
- package/dist/bubblePosition.d.ts +19 -0
- package/dist/bubblePosition.js +41 -0
- package/dist/button.css +56 -0
- package/dist/calendar.css +56 -0
- package/dist/calendarModel.d.ts +62 -0
- package/dist/calendarModel.js +141 -0
- package/dist/card.css +8 -0
- package/dist/cascader.css +16 -0
- package/dist/cascaderModel.d.ts +21 -0
- package/dist/cascaderModel.js +32 -0
- package/dist/cell.css +41 -0
- package/dist/choice.css +27 -0
- package/dist/choice.d.ts +28 -0
- package/dist/choice.jsx +16 -0
- package/dist/circle.css +4 -0
- package/dist/circleModel.d.ts +15 -0
- package/dist/circleModel.js +31 -0
- package/dist/config-provider.css +2 -0
- package/dist/configContext.d.ts +23 -0
- package/dist/configContext.js +24 -0
- package/dist/configTheme.d.ts +3 -0
- package/dist/configTheme.js +22 -0
- package/dist/count-down.css +2 -0
- package/dist/count-to.css +8 -0
- package/dist/countDownModel.d.ts +11 -0
- package/dist/countDownModel.js +7 -0
- package/dist/countToModel.d.ts +3 -0
- package/dist/countToModel.js +3 -0
- package/dist/curtain.css +10 -0
- package/dist/datetime-picker.css +11 -0
- package/dist/datetimePickerModel.d.ts +47 -0
- package/dist/datetimePickerModel.js +128 -0
- package/dist/dialog.css +23 -0
- package/dist/divider.css +14 -0
- package/dist/drop-menu.css +28 -0
- package/dist/empty.css +7 -0
- package/dist/fab.css +23 -0
- package/dist/fabModel.d.ts +26 -0
- package/dist/fabModel.js +16 -0
- package/dist/floating-panel.css +6 -0
- package/dist/floatingPanelModel.d.ts +3 -0
- package/dist/floatingPanelModel.js +10 -0
- package/dist/form.css +10 -0
- package/dist/formContext.d.ts +7 -0
- package/dist/formContext.js +2 -0
- package/dist/formModel.d.ts +38 -0
- package/dist/formModel.js +16 -0
- package/dist/gap.css +1 -0
- package/dist/grid.css +17 -0
- package/dist/icon.css +8 -0
- package/dist/icons/LICENSE.tabler +21 -0
- package/dist/icons/paths.d.ts +309 -0
- package/dist/icons/paths.js +310 -0
- package/dist/icons/render.d.ts +2 -0
- package/dist/icons/render.js +5 -0
- package/dist/image-preview.css +8 -0
- package/dist/img-cropper.css +1 -0
- package/dist/img.css +5 -0
- package/dist/imgCropperModel.d.ts +55 -0
- package/dist/imgCropperModel.js +41 -0
- package/dist/imgModel.d.ts +13 -0
- package/dist/imgModel.js +22 -0
- package/dist/index-bar.css +12 -0
- package/dist/index.d.ts +200 -0
- package/dist/index.js +99 -0
- package/dist/indexBarModel.d.ts +19 -0
- package/dist/indexBarModel.js +37 -0
- package/dist/input-number.css +24 -0
- package/dist/inputNumberModel.d.ts +23 -0
- package/dist/inputNumberModel.js +40 -0
- package/dist/keyboard.css +26 -0
- package/dist/keyboardModel.d.ts +11 -0
- package/dist/keyboardModel.js +34 -0
- package/dist/layout.css +2 -0
- package/dist/legacy/RadioGroup.d.ts +13 -0
- package/dist/legacy/RadioGroup.jsx +13 -0
- package/dist/legacy-controls.css +87 -0
- package/dist/loading.css +31 -0
- package/dist/loadingModel.d.ts +2 -0
- package/dist/loadingModel.js +21 -0
- package/dist/loadmore.css +5 -0
- package/dist/navbar.css +16 -0
- package/dist/notice-bar.css +19 -0
- package/dist/notify.css +14 -0
- package/dist/overlay.css +2 -0
- package/dist/pagination.css +12 -0
- package/dist/paginationModel.d.ts +6 -0
- package/dist/paginationModel.js +7 -0
- package/dist/password-input.css +14 -0
- package/dist/passwordInputModel.d.ts +6 -0
- package/dist/passwordInputModel.js +11 -0
- package/dist/picker.css +42 -0
- package/dist/pickerModel.d.ts +32 -0
- package/dist/pickerModel.js +49 -0
- package/dist/popover.css +5 -0
- package/dist/popup.css +17 -0
- package/dist/progress.css +16 -0
- package/dist/progressModel.d.ts +12 -0
- package/dist/progressModel.js +19 -0
- package/dist/qr-code.css +4 -0
- package/dist/qrCodeModel.d.ts +36 -0
- package/dist/qrCodeModel.js +61 -0
- package/dist/rate.css +20 -0
- package/dist/rateModel.d.ts +4 -0
- package/dist/rateModel.js +38 -0
- package/dist/resize.css +2 -0
- package/dist/rich-text.css +19 -0
- package/dist/richTextMedia.d.ts +28 -0
- package/dist/richTextMedia.js +3 -0
- package/dist/richTextModel.d.ts +52 -0
- package/dist/richTextModel.js +195 -0
- package/dist/root-portal.css +1 -0
- package/dist/router/RouterView.d.ts +21 -0
- package/dist/router/RouterView.jsx +120 -0
- package/dist/router/core.d.ts +85 -0
- package/dist/router/core.js +255 -0
- package/dist/router/hooks.d.ts +17 -0
- package/dist/router/hooks.jsx +71 -0
- package/dist/router/index.d.ts +5 -0
- package/dist/router/index.js +3 -0
- package/dist/router/location.d.ts +8 -0
- package/dist/router/location.js +46 -0
- package/dist/router/router.css +7 -0
- package/dist/router/runtime.d.ts +1 -0
- package/dist/router/runtime.js +25 -0
- package/dist/search.css +23 -0
- package/dist/segmented.css +19 -0
- package/dist/segmentedModel.d.ts +10 -0
- package/dist/segmentedModel.js +8 -0
- package/dist/sidebar.css +18 -0
- package/dist/sidebarModel.d.ts +8 -0
- package/dist/sidebarModel.js +27 -0
- package/dist/signature.css +5 -0
- package/dist/signatureModel.d.ts +23 -0
- package/dist/signatureModel.js +80 -0
- package/dist/skeleton.css +16 -0
- package/dist/slide-verify.css +7 -0
- package/dist/slider.css +49 -0
- package/dist/sliderModel.d.ts +10 -0
- package/dist/sliderModel.js +27 -0
- package/dist/sort-button.css +12 -0
- package/dist/steps.css +35 -0
- package/dist/sticky.css +7 -0
- package/dist/styles.css +136 -0
- package/dist/styles.d.ts +1 -0
- package/dist/swipe-action.css +6 -0
- package/dist/swiper.css +27 -0
- package/dist/swiperAnimation.d.ts +3 -0
- package/dist/swiperAnimation.js +6 -0
- package/dist/swiperModel.d.ts +2 -0
- package/dist/swiperModel.js +3 -0
- package/dist/switch.css +12 -0
- package/dist/tabbar.css +17 -0
- package/dist/tabbarModel.d.ts +8 -0
- package/dist/tabbarModel.js +27 -0
- package/dist/table.css +21 -0
- package/dist/tableModel.d.ts +10 -0
- package/dist/tableModel.js +17 -0
- package/dist/tabs.css +31 -0
- package/dist/tabsModel.d.ts +7 -0
- package/dist/tabsModel.js +14 -0
- package/dist/tag.css +66 -0
- package/dist/text-field.css +15 -0
- package/dist/text.css +7 -0
- package/dist/textModel.d.ts +3 -0
- package/dist/textModel.js +24 -0
- package/dist/toast.css +13 -0
- package/dist/tokens.d.ts +34 -0
- package/dist/tokens.js +10 -0
- package/dist/tour.css +8 -0
- package/dist/transition.css +12 -0
- package/dist/upload.css +11 -0
- package/dist/useCountDown.d.ts +14 -0
- package/dist/useCountDown.js +73 -0
- package/dist/useDialog.d.ts +9 -0
- package/dist/useDialog.js +33 -0
- package/dist/useImagePreview.d.ts +7 -0
- package/dist/useImagePreview.js +17 -0
- package/dist/useNotify.d.ts +9 -0
- package/dist/useNotify.js +26 -0
- package/dist/usePressState.d.ts +6 -0
- package/dist/usePressState.js +17 -0
- package/dist/useToast.d.ts +11 -0
- package/dist/useToast.js +23 -0
- package/dist/useVideoPreview.d.ts +7 -0
- package/dist/useVideoPreview.js +17 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +4 -0
- package/dist/video-preview.css +7 -0
- package/dist/watermark.css +6 -0
- package/dist/web/imgCropperElement.d.ts +2 -0
- package/dist/web/imgCropperElement.js +309 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.js +6 -0
- package/dist/web/qrCodeExportElement.d.ts +4 -0
- package/dist/web/qrCodeExportElement.js +70 -0
- package/dist/web/richTextMediaElement.d.ts +2 -0
- package/dist/web/richTextMediaElement.js +276 -0
- package/package.json +98 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# 更新日志
|
|
2
|
+
|
|
3
|
+
记录 Daisu UI 的版本变化。npm 组件包名为 `@daisu-ui/ui`,GitLab 保留源码与 Git 安装产物。
|
|
4
|
+
|
|
5
|
+
## 0.1.0-beta.3
|
|
6
|
+
|
|
7
|
+
2026-11-25 · npm 首次发布
|
|
8
|
+
|
|
9
|
+
- npm 包名统一为 `@daisu-ui/ui`,同步组件示例、公开入口与消费校验。
|
|
10
|
+
- npm 仅包含 UI 库的 ESM、保留 JSX 的组件、声明、样式和许可证;不包含 Demo、文档应用或 MCP。
|
|
11
|
+
- 建立 `developer` 开发、`main` 稳定源码、`npm-dist` 产物分支,发布前核对源码已合并到远端 `main`。
|
|
12
|
+
- 增加 npm 产物校验、beta/latest 发布命令及 README 的完整发布操作示例。
|
|
13
|
+
|
|
14
|
+
## 0.1.0-beta.2
|
|
15
|
+
|
|
16
|
+
2026-11-25 · Git 发布
|
|
17
|
+
|
|
18
|
+
- 通过受保护的源码版本 Tag 自动执行测试、类型检查、Demo/文档构建和独立组件包校验。
|
|
19
|
+
- 自动生成 `npm-dist` 发布分支及 `npm-v*` 安装标签,产物保留 JSX、类型声明和自动样式加载。
|
|
20
|
+
- 提供本地 Docker Runner 配置和一键 Git 发布命令,无需发布到 npmjs。
|
|
21
|
+
|
|
22
|
+
## 0.1.0-beta.1
|
|
23
|
+
|
|
24
|
+
2026-11-25 · 开发中
|
|
25
|
+
|
|
26
|
+
- 增加随仓库使用的本地 stdio MCP 文档服务,提供组件、API、Demo、主题变量、全文搜索与更新记录查询;补充通用 JSON、Cursor、VS Code 和 Codex 配置及真实客户端集成测试。
|
|
27
|
+
- 文档站增加分组指南、设计系统与 AI 导航,统一左侧目录和顶部菜单,提供 AI 总览、文档搜索及版本更新定位,支持键盘、触屏与明暗主题。
|
|
28
|
+
- 清理组件注释、使用指南、示例内容及远程资源引用。
|
|
29
|
+
- 内置图标切换至 Tabler Icons 3.53.0,保留现有 305 个图标名称。
|
|
30
|
+
- 演示插画、视频与旋律使用本仓库生成的本地资源,水印使用 Daisu UI 标志。
|
|
31
|
+
|
|
32
|
+
## 0.1.0-beta.0
|
|
33
|
+
|
|
34
|
+
2026-11-25 · 开发中
|
|
35
|
+
|
|
36
|
+
### 新增
|
|
37
|
+
|
|
38
|
+
- 将应用内通用 UI 提取为独立 ReactLynx npm 包。
|
|
39
|
+
- 提供保留 JSX 的 ESM、TypeScript 声明和完整组件样式。
|
|
40
|
+
- 从组件入口自动加载样式,支持生产构建 tree shaking,无需单独导入 CSS。
|
|
41
|
+
- 提供独立 router、router/runtime 与 utils 入口。
|
|
42
|
+
- 提供独立交互 Demo 与 Web 组件文档站,包含使用示例、API 表格和本页目录。
|
|
43
|
+
- 提供站内源码查看器,支持高亮、复制与源码链接直接访问。
|
|
44
|
+
- 增加更新日志页面及组件分类导航。
|
|
45
|
+
|
|
46
|
+
### 优化
|
|
47
|
+
|
|
48
|
+
- 统一组件文档的说明、代码和交互预览布局。
|
|
49
|
+
- 文档构建同步生成最新组件库与 Demo,避免预览使用旧产物。
|
|
50
|
+
|
|
51
|
+
### 修复
|
|
52
|
+
|
|
53
|
+
- 修复文档底部源码链接触发下载的问题,改为站内查看。
|
|
54
|
+
|
|
55
|
+
### 版本说明
|
|
56
|
+
|
|
57
|
+
- 业务组件及 Flutter 宿主适配由应用维护。
|
|
58
|
+
- 首个 beta,原生平台完整回归待完成。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daisu UI contributors
|
|
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
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Daisu UI · 袋鼠 UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
面向 ReactLynx 的 UI 组件库,提供表单、展示、反馈、导航组件和独立路由入口。组件使用 Lynx 原生元素,ESM 产物保留 JSX,由消费项目的 ReactLynx 编译器处理。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @daisu-ui/ui@beta
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
消费项目需安装 `@lynx-js/react@^0.126.2`、`@lynx-js/types@^4.2.1` 和 `@types/react@^18.3.0`,使用 Rspeedy 的 `pluginReactLynx({ engineVersion: '4.2' })` 构建。库开发使用 `@lynx-js/types@4.2.1`,iOS 与 Android 均以 Lynx 4.2 作为设备回归目标;首个 beta 尚需完成这两个平台的完整真机验收,不能将 Web 预览通过视为原生验收。编译目标不会升级接收端的原生引擎,宿主集成方须确保引擎至少为 4.2。
|
|
12
|
+
|
|
13
|
+
若构建插件仍内置 `@lynx-js/tasm@0.0.49`,需在消费项目根 `package.json` 添加 `"overrides": { "@lynx-js/tasm": "0.0.53" }` 并更新锁文件;旧编译器最高只支持 Lynx 3.9。当前 workspace 已配置此覆盖,独立仓库保留此配置。
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { root } from '@lynx-js/react';
|
|
19
|
+
import { Button, ConfigProvider, RootPortalHost } from '@daisu-ui/ui';
|
|
20
|
+
|
|
21
|
+
root.render(
|
|
22
|
+
<ConfigProvider>
|
|
23
|
+
<RootPortalHost>
|
|
24
|
+
<Button label="确定" onTap={() => { 'background only'; console.log('tap'); }} />
|
|
25
|
+
</RootPortalHost>
|
|
26
|
+
</ConfigProvider>,
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
从 `@daisu-ui/ui` 导入组件时会自动加载样式,无需额外引入 CSS;生产构建会保留该副作用。`RootPortalHost` 承载弹窗、Toast 等浮层;需要与内容处于同一个 `ConfigProvider` 内。主题 API 见仓库的 `docs/ui/components/`;通过 `npm run ui:docs:dev` 预览文档与独立 Demo。为兼容现有页面,CSS 变量暂时保留 `--cso-ui-*` 命名,类名前缀保留 `ui-`。
|
|
31
|
+
|
|
32
|
+
### 公开入口
|
|
33
|
+
|
|
34
|
+
| 入口 | 内容 |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `@daisu-ui/ui` | UI 组件、hooks、类型及 tokens |
|
|
37
|
+
| `@daisu-ui/ui/styles.css` | 全部组件及通用控件样式,保留为兼容入口,常规使用无需手动引入 |
|
|
38
|
+
| `@daisu-ui/ui/router` | Router、RouterView、路由 hooks 和宿主历史适配接口 |
|
|
39
|
+
| `@daisu-ui/ui/router/location` | 无渲染依赖的地址编解码和宿主历史类型,供纯 Web 宿主使用 |
|
|
40
|
+
| `@daisu-ui/ui/router/runtime` | Lynx 路由运行环境初始化,有副作用,须保留 |
|
|
41
|
+
| `@daisu-ui/ui/utils` | Demo 可复用的日期、轮播和按压状态辅助 API |
|
|
42
|
+
|
|
43
|
+
使用路由时,在应用入口、加载 TanStack Router 之前引入 `@daisu-ui/ui/router/runtime`。路由入口也包含运行环境初始化与 URLSearchParams 兼容处理。使用 TanStack 的路由树 API 时,应在应用直接声明 `@tanstack/react-router@1.170.46` 依赖,并按 ReactLynx 官方接入配置将 `react`、`react/jsx-runtime`、`react/jsx-dev-runtime` 映射到 `@lynx-js/react/compat` 及对应 JSX runtime。
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import '@daisu-ui/ui/router/runtime';
|
|
47
|
+
import { RouterView, createRouter } from '@daisu-ui/ui/router';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 宿主能力
|
|
51
|
+
|
|
52
|
+
组件包不包含业务会话、请求地址或 FlutterBridge。`Upload` 使用调用方传入的 `UploadAdapter` 接入选图、上传和预览;路由通过 `RouterHistoryAdapter` 接入宿主历史。业务网络请求及鉴权继续由应用负责。
|
|
53
|
+
|
|
54
|
+
`EmbeddedLayout` 与业务状态、搜索工具栏等组件留在主应用。`PagedList` 继续使用官方 `FeedList`,没有更换滚动后端。
|
|
55
|
+
|
|
56
|
+
## 本仓库开发
|
|
57
|
+
|
|
58
|
+
本仓库以 npm workspace 管理组件包、独立 Demo 和文档。组件源码唯一位于 packages/daisu-ui/src,示例唯一位于 apps/demo/src/features/ui-demo,组件包不依赖主业务工程。Demo 使用公开 exports;库测试通过源码 alias 共享上下文,真实产物由隔离 tarball 消费验收。
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm ci
|
|
62
|
+
npm test
|
|
63
|
+
npm run test:types
|
|
64
|
+
npm run build
|
|
65
|
+
npm run ui:check
|
|
66
|
+
npm run ui:pack
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
ui:check 创建临时工程、安装真实 tarball 并检查声明、保留 JSX、样式和 Lynx/Web 构建。ui:pack 输出 artifacts/ 下的 npm tarball。主业务工程只安装 tarball 或已发布版本,不再构建库源码。
|
|
70
|
+
|
|
71
|
+
## 发布与切换
|
|
72
|
+
|
|
73
|
+
npm 包名为 `@daisu-ui/ui`,预发布渠道为 `beta`。仅发布本 UI 库的构建产物、类型、样式、更新日志与许可证,不含 Demo、文档应用或 CLI/MCP。
|
|
74
|
+
|
|
75
|
+
源码采用 `developer → main` 审核发布;本地与 CI 发布脚本都会核对提交已合入远端 main。在仓库根执行:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
npm ci
|
|
79
|
+
npm login --registry=https://registry.npmjs.org/ --auth-type=web
|
|
80
|
+
npm run ui:npm:release -- --dry-run
|
|
81
|
+
npm run ui:npm:publish
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
完整更新版本、合并分支、创建源码 Tag、GitLab NPM_TOKEN 配置与安装回退示例见 [仓库 README](https://git.zilueit.com/daisu-ui/daisu-ui/blob/main/README.md)。npm 组件包与应用 Manifest/Bundle 分别发布。
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT。第三方版权与改编说明见 `THIRD_PARTY_NOTICES.md` 及包内 `dist/icons/LICENSE.tabler`。
|
|
89
|
+
|
|
90
|
+
### 浏览器富文本音视频
|
|
91
|
+
|
|
92
|
+
浏览器宿主在挂载 `<lynx-view>` 之前调用 `import { registerRichTextMedia } from '@daisu-ui/ui/web'; registerRichTextMedia();`。Lynx 富文本传 `mediaMode="browser"`,即可使用 HTML5 视频控件和音频播放条,以及 ref 的 playMedia/pauseMedia/seekMedia。默认不加载 DOM 代码。该模式目前仅用于浏览器,Flutter 默认继续使用 `mediaMode="none"`。详见 `docs/ui/components/rich-text.md`。
|
|
93
|
+
|
|
94
|
+
浏览器宿主可统一调用 `registerDaisuWebComponents()` 注册富文本音视频、视频预览、图片裁剪和二维码 PNG 导出。`VideoPreview` 使用 `mediaMode="browser"`;`ImgCropper` 使用 `mode="browser"`,真实导出PNG/JPEG Blob URL并支持下载。参见仓库 `docs/ui/components/video-preview.md` 与 `img-cropper.md`;Flutter后端尚未接入。
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
## Tabler Icons
|
|
4
|
+
|
|
5
|
+
The bundled SVG glyphs are generated from Tabler Icons 3.53.0, licensed under MIT. Copyright (c) 2020-2026 Paweł Kuna. The complete license is distributed as `dist/icons/LICENSE.tabler`. Public icon names are mapped to bundled glyphs in the source catalog; generation uses `npm run icons:generate`.
|
|
6
|
+
|
|
7
|
+
Upstream: https://github.com/tabler/tabler-icons
|
|
8
|
+
|
|
9
|
+
## Lynx UI
|
|
10
|
+
|
|
11
|
+
本库通过 npm 依赖使用官方 `@lynx-js/lynx-ui` 的 List、FeedList 和 Swiper 等组件。项目:https://github.com/lynx-family/lynx-ui ,许可证为 Apache-2.0,其声明由对应依赖包提供。
|
|
12
|
+
|
|
13
|
+
## Other runtime dependencies
|
|
14
|
+
|
|
15
|
+
TanStack Router、abort-controller、fflate、htmlparser2、JsBarcode、qrcode-generator 和 url-search-params-polyfill 均通过 npm 依赖分发,各自版权与许可证以对应安装包中的声明为准。
|
|
16
|
+
|
|
17
|
+
## Demo assets
|
|
18
|
+
|
|
19
|
+
The local illustration, video and melody assets are generated from the original SVG scenes and synthesis commands in this repository. They are maintained with the Demo and are not included in the published component package.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
2
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
3
|
+
import type { PopupProps } from "./Popup.jsx";
|
|
4
|
+
import type { IconName } from './icons/paths.js';
|
|
5
|
+
export type ActionSheetAction = {
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ActionSheetPanel = {
|
|
13
|
+
icon?: IconName | ReactNode;
|
|
14
|
+
image?: string;
|
|
15
|
+
title: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ActionSheetSelection = {
|
|
20
|
+
item: ActionSheetAction;
|
|
21
|
+
index: number;
|
|
22
|
+
} | {
|
|
23
|
+
item: ActionSheetPanel;
|
|
24
|
+
index: number;
|
|
25
|
+
} | {
|
|
26
|
+
item: ActionSheetPanel;
|
|
27
|
+
rowIndex: number;
|
|
28
|
+
colIndex: number;
|
|
29
|
+
};
|
|
30
|
+
export type ActionSheetProps = Pick<PopupProps, 'show' | 'onChange' | 'closeOnClickModal' | 'onClickModal' | 'duration' | 'zIndex' | 'lazyRender' | 'safeAreaInsetBottom' | 'safeAreaBottom' | 'rootPortal' | 'onEnter' | 'onAfterEnter' | 'onLeave' | 'onAfterLeave'> & {
|
|
31
|
+
actions?: readonly ActionSheetAction[];
|
|
32
|
+
panels?: readonly ActionSheetPanel[] | readonly (readonly ActionSheetPanel[])[];
|
|
33
|
+
title?: string;
|
|
34
|
+
cancelText?: string;
|
|
35
|
+
closeOnClickAction?: boolean;
|
|
36
|
+
onClose?: () => void;
|
|
37
|
+
onCancel?: () => void;
|
|
38
|
+
onSelect?: (selection: ActionSheetSelection) => void;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
renderClose?: (close: () => void) => ReactNode;
|
|
41
|
+
titleClassName?: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
style?: CSSProperties;
|
|
44
|
+
};
|
|
45
|
+
export declare function ActionSheet({ actions, panels, title, cancelText, closeOnClickAction, onClose, onCancel, onSelect, children, renderClose, titleClassName, className, style, duration, safeAreaInsetBottom, onChange, show, ...popup }: ActionSheetProps): import("@lynx-js/react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Popup } from "./Popup.jsx";
|
|
2
|
+
import { Icon } from "./Icon.jsx";
|
|
3
|
+
import { Loading } from "./Loading.jsx";
|
|
4
|
+
export function ActionSheet({ actions = [], panels = [], title, cancelText, closeOnClickAction = true, onClose, onCancel, onSelect, children, renderClose, titleClassName = '', className = '', style, duration = 200, safeAreaInsetBottom = true, onChange, show = false, ...popup }) {
|
|
5
|
+
const close = () => {
|
|
6
|
+
'background only';
|
|
7
|
+
if (!show)
|
|
8
|
+
return;
|
|
9
|
+
onChange?.(false);
|
|
10
|
+
onClose?.();
|
|
11
|
+
};
|
|
12
|
+
const select = (selection) => {
|
|
13
|
+
'background only';
|
|
14
|
+
if (!show || selection.item.disabled || ('loading' in selection.item && selection.item.loading))
|
|
15
|
+
return;
|
|
16
|
+
onSelect?.(selection);
|
|
17
|
+
if (closeOnClickAction)
|
|
18
|
+
close();
|
|
19
|
+
};
|
|
20
|
+
const multiple = panels.length > 0 && Array.isArray(panels[0]);
|
|
21
|
+
const rows = (multiple ? panels : [panels]);
|
|
22
|
+
return <Popup {...popup} show={show} duration={duration} position="bottom" round lockScroll={false} onChange={close} safeAreaInsetBottom={safeAreaInsetBottom} className={`ui-action-sheet ${className}`} style={style}>
|
|
23
|
+
{title ? <view className={`ui-action-sheet-header ${titleClassName}`}><text className="ui-action-sheet-title">{title}</text><view className="ui-action-sheet-close" catchtap={close} accessibility-element accessibility-traits="button" accessibility-label="关闭动作面板">{renderClose ? renderClose(close) : <Icon name="close" size={24}/>}</view></view> : null}
|
|
24
|
+
{children ?? (panels.length ? <view className="ui-action-sheet-panels">{rows.map((row, rowIndex) => <scroll-view key={rowIndex} className="ui-action-sheet-panel-scroll" scroll-orientation="horizontal" scroll-x><view className="ui-action-sheet-panel-row">{row.map((item, colIndex) => <view key={colIndex} className={`ui-action-sheet-panel ${item.disabled ? 'ui-action-sheet-disabled' : ''}`} bindtap={() => select(multiple ? { item, rowIndex, colIndex } : { item, index: colIndex })} accessibility-element accessibility-traits="button" accessibility-label={item.title}>
|
|
25
|
+
<view className="ui-action-sheet-panel-icon">{item.image ? <image src={item.image} mode="aspectFit" className="ui-action-sheet-panel-image"/> : typeof item.icon === 'string' ? <Icon name={item.icon} size={24} color={item.color}/> : item.icon}</view><text className="ui-action-sheet-panel-title">{item.title}</text>
|
|
26
|
+
</view>)}</view></scroll-view>)}</view> : <view>{actions.map((item, index) => <view key={index} className={`ui-action-sheet-action ${item.disabled ? 'ui-action-sheet-disabled' : ''}`} bindtap={() => select({ item, index })} accessibility-element accessibility-traits="button" accessibility-label={item.name ?? '加载中'}>
|
|
27
|
+
{index ? <view className="ui-action-sheet-line"/> : null}{item.loading ? <Loading size={28}/> : <><text className="ui-action-sheet-name" style={item.color ? { color: item.color } : undefined}>{item.name}</text>{item.description ? <text className="ui-action-sheet-description">{item.description}</text> : null}</>}
|
|
28
|
+
</view>)}</view>)}
|
|
29
|
+
{cancelText ? <view className="ui-action-sheet-cancel-wrap"><view className="ui-action-sheet-cancel" bindtap={() => {
|
|
30
|
+
'background only';
|
|
31
|
+
if (!show)
|
|
32
|
+
return;
|
|
33
|
+
onCancel?.();
|
|
34
|
+
close();
|
|
35
|
+
}}><text>{cancelText}</text></view></view> : null}
|
|
36
|
+
</Popup>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
2
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
3
|
+
import type { BubbleOffset, BubblePlacement } from './bubblePosition.js';
|
|
4
|
+
export type BubbleRef = {
|
|
5
|
+
open: () => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
updatePosition: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type AnchoredBubbleProps = {
|
|
10
|
+
show?: boolean;
|
|
11
|
+
defaultShow?: boolean;
|
|
12
|
+
onShowChange?: (show: boolean) => void;
|
|
13
|
+
onChange?: (event: {
|
|
14
|
+
show: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
onOpen?: () => void;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
placement?: BubblePlacement;
|
|
19
|
+
offset?: BubbleOffset;
|
|
20
|
+
visibleArrow?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
showClose?: boolean;
|
|
23
|
+
duration?: number;
|
|
24
|
+
zIndex?: number;
|
|
25
|
+
rootPortal?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
arrowClassName?: string;
|
|
29
|
+
popClassName?: string;
|
|
30
|
+
popStyle?: CSSProperties;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
contentNode?: ReactNode;
|
|
33
|
+
kind: 'tooltip' | 'popover';
|
|
34
|
+
};
|
|
35
|
+
/** Shared geometry and interaction for the public Tooltip and Popover. */
|
|
36
|
+
export declare const AnchoredBubble: (props: AnchoredBubbleProps & import("react").RefAttributes<BubbleRef>) => React.ReactElement | null;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from '@lynx-js/react';
|
|
2
|
+
import { Icon } from "./Icon.jsx";
|
|
3
|
+
import { RootPortal } from "./RootPortal.jsx";
|
|
4
|
+
import { Transition } from "./Transition.jsx";
|
|
5
|
+
import { bubblePosition } from './bubblePosition.js';
|
|
6
|
+
function measure(node) {
|
|
7
|
+
'background only';
|
|
8
|
+
return new Promise(resolve => {
|
|
9
|
+
if (!node) {
|
|
10
|
+
resolve(undefined);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
node.invoke({ method: 'boundingClientRect', params: { androidEnableTransformProps: true, iosEnableTransformProps: true }, success: (value) => {
|
|
14
|
+
'background only';
|
|
15
|
+
const rect = value;
|
|
16
|
+
resolve(rect && [rect.left, rect.top, rect.width, rect.height].every(Number.isFinite) ? rect : undefined);
|
|
17
|
+
}, fail: () => resolve(undefined) }).exec();
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** Shared geometry and interaction for the public Tooltip and Popover. */
|
|
21
|
+
export const AnchoredBubble = forwardRef(function AnchoredBubble({ show, defaultShow = false, onShowChange, onChange, onOpen, onClose, placement = 'bottom', offset = 0, visibleArrow = true, disabled = false, showClose = false, duration = 200, zIndex = 20, rootPortal = false, className = '', style, arrowClassName = '', popClassName = '', popStyle, children, contentNode, kind }, ref) {
|
|
22
|
+
const [inner, setInner] = useState(defaultShow);
|
|
23
|
+
const requested = (show ?? inner) && !disabled;
|
|
24
|
+
const [position, setPosition] = useState();
|
|
25
|
+
const [targetRect, setTargetRect] = useState();
|
|
26
|
+
const [contentWidth, setContentWidth] = useState(0);
|
|
27
|
+
const repositionTimer = useRef();
|
|
28
|
+
const target = useRef(null);
|
|
29
|
+
const content = useRef(null);
|
|
30
|
+
const viewport = useRef(null);
|
|
31
|
+
const sequence = useRef(0);
|
|
32
|
+
const live = useRef({ requested, disabled, placement, offset, visibleArrow, rootPortal });
|
|
33
|
+
live.current = { requested, disabled, placement, offset, visibleArrow, rootPortal };
|
|
34
|
+
const callbacks = useRef({ onOpen, onClose });
|
|
35
|
+
callbacks.current = { onOpen, onClose };
|
|
36
|
+
const previous = useRef(false);
|
|
37
|
+
const size = useRef({ width: 0, height: 0 });
|
|
38
|
+
const calculatePosition = () => {
|
|
39
|
+
'background only';
|
|
40
|
+
if (!live.current.requested)
|
|
41
|
+
return;
|
|
42
|
+
const token = ++sequence.current;
|
|
43
|
+
void Promise.all([measure(target.current), measure(content.current), measure(viewport.current)]).then(([trigger, box, bounds]) => {
|
|
44
|
+
'background only';
|
|
45
|
+
if (token !== sequence.current || !live.current.requested || !trigger || !box || !bounds || box.width <= 0 || box.height <= 0 || bounds.width <= 0 || bounds.height <= 0)
|
|
46
|
+
return;
|
|
47
|
+
const state = live.current;
|
|
48
|
+
setTargetRect(trigger);
|
|
49
|
+
setContentWidth(box.width);
|
|
50
|
+
setPosition(bubblePosition(trigger, box, bounds, state.placement, state.offset, state.visibleArrow));
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const calculateRef = useRef(calculatePosition);
|
|
54
|
+
calculateRef.current = calculatePosition;
|
|
55
|
+
const updatePosition = () => {
|
|
56
|
+
'background only';
|
|
57
|
+
if (!live.current.requested)
|
|
58
|
+
return;
|
|
59
|
+
setPosition(undefined);
|
|
60
|
+
clearTimeout(repositionTimer.current);
|
|
61
|
+
repositionTimer.current = setTimeout(() => calculateRef.current(), 32);
|
|
62
|
+
};
|
|
63
|
+
const updateRef = useRef(updatePosition);
|
|
64
|
+
updateRef.current = updatePosition;
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (requested) {
|
|
67
|
+
setPosition(undefined);
|
|
68
|
+
const timer = setTimeout(() => calculateRef.current(), 40);
|
|
69
|
+
if (!previous.current)
|
|
70
|
+
callbacks.current.onOpen?.();
|
|
71
|
+
previous.current = true;
|
|
72
|
+
return () => { clearTimeout(timer); sequence.current++; };
|
|
73
|
+
}
|
|
74
|
+
sequence.current++;
|
|
75
|
+
if (previous.current)
|
|
76
|
+
callbacks.current.onClose?.();
|
|
77
|
+
previous.current = false;
|
|
78
|
+
}, [requested]);
|
|
79
|
+
const offsetKey = JSON.stringify(offset);
|
|
80
|
+
useEffect(() => { if (requested)
|
|
81
|
+
updatePosition(); }, [placement, offsetKey, visibleArrow, rootPortal]);
|
|
82
|
+
useEffect(() => () => { sequence.current++; clearTimeout(repositionTimer.current); }, []);
|
|
83
|
+
const request = (next) => {
|
|
84
|
+
'background only';
|
|
85
|
+
if (next && disabled || next === requested)
|
|
86
|
+
return;
|
|
87
|
+
if (show === undefined)
|
|
88
|
+
setInner(next);
|
|
89
|
+
onShowChange?.(next);
|
|
90
|
+
onChange?.({ show: next });
|
|
91
|
+
};
|
|
92
|
+
useImperativeHandle(ref, () => ({ open: () => {
|
|
93
|
+
'background only';
|
|
94
|
+
request(true);
|
|
95
|
+
}, close: () => {
|
|
96
|
+
'background only';
|
|
97
|
+
request(false);
|
|
98
|
+
}, updatePosition }), [show, requested, disabled, onShowChange, onChange]);
|
|
99
|
+
const layer = <view className={`ui-bubble-anchor ui-${kind}-anchor`} style={{ position: rootPortal || !position ? 'fixed' : 'absolute', width: position ? `${contentWidth}px` : undefined, left: `${position ? position.x - (rootPortal ? 0 : targetRect?.left ?? 0) : 0}px`, top: `${position ? position.y - (rootPortal ? 0 : targetRect?.top ?? 0) : 0}px`, zIndex, visibility: position ? 'visible' : 'hidden' }}>
|
|
100
|
+
<Transition show={requested} name="fade" duration={duration} destroy={false} interactiveDuringLeave className={`ui-bubble-panel ui-${kind}-panel ${popClassName}`} style={popStyle}>
|
|
101
|
+
<view ref={content} className={`ui-bubble-body ${showClose ? 'ui-bubble-closable' : ''}`} flatten={false} catchtap={() => { }} bindlayoutchange={event => {
|
|
102
|
+
'background only';
|
|
103
|
+
const { width, height } = event.detail;
|
|
104
|
+
if (width === size.current.width && height === size.current.height)
|
|
105
|
+
return;
|
|
106
|
+
size.current = { width, height };
|
|
107
|
+
calculateRef.current();
|
|
108
|
+
}}>
|
|
109
|
+
{visibleArrow && position ? <view className={`ui-bubble-arrow ui-bubble-arrow-${position.side} ${arrowClassName}`} style={position.side === 'top' || position.side === 'bottom' ? { left: `${position.arrow - 8}px` } : { top: `${position.arrow - 8}px` }}/> : null}
|
|
110
|
+
{contentNode}
|
|
111
|
+
{showClose ? <view className="ui-bubble-close" catchtap={() => request(false)} accessibility-element accessibility-traits="button" accessibility-label="关闭提示"><Icon name="close" size={12}/></view> : null}
|
|
112
|
+
</view>
|
|
113
|
+
</Transition>
|
|
114
|
+
</view>;
|
|
115
|
+
return <view className={`ui-bubble ui-${kind} ${className}`} style={style}>
|
|
116
|
+
<view ref={viewport} className="ui-bubble-viewport" flatten={false} bindlayoutchange={() => updateRef.current()}/>
|
|
117
|
+
<view ref={target} className={`ui-bubble-target ui-${kind}-target`} flatten={false} catchtap={() => request(!requested)} bindlayoutchange={() => updateRef.current()}>{children}</view>
|
|
118
|
+
{rootPortal ? <RootPortal>{layer}</RootPortal> : layer}
|
|
119
|
+
</view>;
|
|
120
|
+
});
|
package/dist/Avatar.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
2
|
+
import type { BaseEvent, CSSProperties, ImageErrorEvent } from '@lynx-js/types';
|
|
3
|
+
import type { AvatarSize } from './avatarModel.js';
|
|
4
|
+
export type AvatarProps = {
|
|
5
|
+
src?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
shape?: 'round' | 'square';
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
alt?: string;
|
|
13
|
+
mode?: 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'center';
|
|
14
|
+
onTap?: () => void;
|
|
15
|
+
onError?: (event: BaseEvent<'error', ImageErrorEvent>) => void;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
export declare function Avatar({ src, text, icon, size, shape, bgColor, color, alt, mode, onTap, onError, children, className, style }: AvatarProps): import("@lynx-js/react").JSX.Element;
|
|
21
|
+
export type AvatarGroupItem = AvatarProps & {
|
|
22
|
+
key?: string | number;
|
|
23
|
+
};
|
|
24
|
+
export type AvatarGroupProps = {
|
|
25
|
+
items: readonly AvatarGroupItem[];
|
|
26
|
+
maxCount?: number;
|
|
27
|
+
cascading?: 'left-up' | 'right-up';
|
|
28
|
+
size?: AvatarSize;
|
|
29
|
+
shape?: 'round' | 'square';
|
|
30
|
+
collapseAvatar?: string;
|
|
31
|
+
vertical?: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
};
|
|
35
|
+
export declare function AvatarGroup({ items, maxCount, cascading, size, shape, collapseAvatar, vertical, className, style }: AvatarGroupProps): import("@lynx-js/react").JSX.Element;
|
package/dist/Avatar.jsx
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState } from '@lynx-js/react';
|
|
2
|
+
import { Icon } from "./Icon.jsx";
|
|
3
|
+
import { avatarMetrics, avatarVisibleCount } from './avatarModel.js';
|
|
4
|
+
function AvatarImage({ src, mode, fallback, onError }) {
|
|
5
|
+
const [failed, setFailed] = useState(false);
|
|
6
|
+
return failed ? fallback : <image className="ui-avatar-image" src={src} mode={mode} binderror={event => {
|
|
7
|
+
'background only';
|
|
8
|
+
setFailed(true);
|
|
9
|
+
onError?.(event);
|
|
10
|
+
}}/>;
|
|
11
|
+
}
|
|
12
|
+
export function Avatar({ src = '', text = '', icon = '', size = 'normal', shape = 'round', bgColor, color, alt = '', mode = 'aspectFill', onTap, onError, children, className = '', style }) {
|
|
13
|
+
const metrics = avatarMetrics(size);
|
|
14
|
+
const foreground = color || (bgColor ? '#fff' : undefined);
|
|
15
|
+
const fallback = alt || text ? <text className="ui-avatar-text" style={{ fontSize: metrics.font, lineHeight: metrics.line, color: foreground }} text-maxline="1" text-overflow="ellipsis">{alt || text}</text> : icon ? <view className="ui-avatar-icon" style={{ width: metrics.font, height: metrics.font }}>{foreground ? <Icon name={icon} color={foreground}/> : <><Icon name={icon} color="#868a9c" className="ui-avatar-icon-light"/><Icon name={icon} color="#f7f8fa" className="ui-avatar-icon-dark"/></>}</view> : null;
|
|
16
|
+
const content = text ? <text className="ui-avatar-text" style={{ fontSize: metrics.font, lineHeight: metrics.line, color: foreground }} text-maxline="1" text-overflow="ellipsis">{text}</text> : fallback;
|
|
17
|
+
return <view className={`ui-avatar ui-avatar-${shape} ${className}`} style={{ width: metrics.dimension, height: metrics.dimension, backgroundColor: bgColor, ...style }} bindtap={onTap} accessibility-element={!!onTap || !!alt} accessibility-traits={onTap ? 'button' : 'image'} accessibility-label={alt || text || '头像'}>
|
|
18
|
+
{children !== undefined && children !== null && children !== false ? typeof children === 'string' || typeof children === 'number' ? <text className="ui-avatar-text" style={{ fontSize: metrics.font, lineHeight: metrics.line, color: foreground }}>{children}</text> : children : src ? <AvatarImage key={src} src={src} mode={mode} fallback={fallback} onError={onError}/> : content}
|
|
19
|
+
</view>;
|
|
20
|
+
}
|
|
21
|
+
export function AvatarGroup({ items, maxCount, cascading = 'left-up', size = 'normal', shape = 'round', collapseAvatar, vertical = false, className = '', style }) {
|
|
22
|
+
const count = avatarVisibleCount(items.length, maxCount);
|
|
23
|
+
const overflow = items.length - count;
|
|
24
|
+
const metrics = avatarMetrics(size);
|
|
25
|
+
const visible = [...items.slice(0, count), ...(overflow ? [{ key: '__collapse__', text: collapseAvatar || `+${overflow}`, className: 'ui-avatar-collapse' }] : [])];
|
|
26
|
+
return <view className={`ui-avatar-group ${vertical ? 'ui-avatar-group-vertical' : ''} ${className}`} style={style}>
|
|
27
|
+
{visible.map(({ key, style: itemStyle, className: itemClass = '', ...item }, index) => <Avatar key={index === count ? 'collapse' : `avatar:${typeof key}:${key ?? index}`} {...item} size={size} shape={shape} className={`ui-avatar-group-item ${itemClass}`} style={{ ...itemStyle, ...(index ? vertical ? { marginTop: metrics.overlap } : { marginLeft: metrics.overlap } : {}), zIndex: cascading === 'left-up' ? index + 1 : count - index }}/>)}
|
|
28
|
+
</view>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
2
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
3
|
+
export type BacktopRequest = {
|
|
4
|
+
duration: number;
|
|
5
|
+
};
|
|
6
|
+
export type BacktopProps = {
|
|
7
|
+
scrollTop: number;
|
|
8
|
+
onBacktop: (request: BacktopRequest) => void;
|
|
9
|
+
top?: number;
|
|
10
|
+
duration?: number;
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
bottom?: number;
|
|
13
|
+
right?: number;
|
|
14
|
+
shape?: 'circle' | 'square';
|
|
15
|
+
text?: string;
|
|
16
|
+
iconStyle?: CSSProperties;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
};
|
|
21
|
+
/** Scrolling belongs to the caller's scroll-view/List/host, never the global page. */
|
|
22
|
+
export declare function Backtop({ scrollTop, onBacktop, top, duration, zIndex, bottom, right, shape, text, iconStyle, children, className, style }: BacktopProps): import("@lynx-js/react").JSX.Element;
|
package/dist/Backtop.jsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Icon } from "./Icon.jsx";
|
|
2
|
+
import { Transition } from "./Transition.jsx";
|
|
3
|
+
/** Scrolling belongs to the caller's scroll-view/List/host, never the global page. */
|
|
4
|
+
export function Backtop({ scrollTop, onBacktop, top = 300, duration = 100, zIndex = 10, bottom = 100, right = 20, shape = 'circle', text, iconStyle, children, className = '', style }) {
|
|
5
|
+
const visible = Number.isFinite(scrollTop) && scrollTop > top;
|
|
6
|
+
const activate = () => {
|
|
7
|
+
'background only';
|
|
8
|
+
if (visible)
|
|
9
|
+
onBacktop({ duration: Number.isFinite(duration) ? Math.max(0, duration) : 100 });
|
|
10
|
+
};
|
|
11
|
+
return <view className="ui-backtop-position" style={{ bottom: `${bottom}px`, right: `${right}px`, zIndex }}>
|
|
12
|
+
<Transition show={visible} name="fade" lazyRender>
|
|
13
|
+
<view className={`ui-backtop ui-backtop-${shape} ${className}`} style={style} bindtap={activate} accessibility-element accessibility-traits="button" accessibility-label={text || '回到顶部'}>
|
|
14
|
+
{children ?? <view className="ui-backtop-content"><view style={iconStyle}><Icon name="to-top" size={20} color={typeof iconStyle?.color === 'string' ? iconStyle.color : undefined}/></view>{text ? <text className="ui-backtop-text" style={{ color: style?.color }}>{text}</text> : null}</view>}
|
|
15
|
+
</view>
|
|
16
|
+
</Transition>
|
|
17
|
+
</view>;
|
|
18
|
+
}
|
package/dist/Badge.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from '@lynx-js/react';
|
|
2
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
3
|
+
export type BadgeProps = {
|
|
4
|
+
value?: string | number;
|
|
5
|
+
max?: number;
|
|
6
|
+
top?: string | number;
|
|
7
|
+
right?: string | number;
|
|
8
|
+
isDot?: boolean;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
11
|
+
bgColor?: string;
|
|
12
|
+
showZero?: boolean;
|
|
13
|
+
shape?: 'circle' | 'square' | 'bubble';
|
|
14
|
+
border?: boolean;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
export declare function Badge({ value, max, top, right, isDot, hidden, type, bgColor, showZero, shape, border, children, className, style }: BadgeProps): import("@lynx-js/react").JSX.Element;
|
package/dist/Badge.jsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { badgeLabel, badgeOffset } from './badgeModel.js';
|
|
2
|
+
export function Badge({ value, max, top, right, isDot = false, hidden = false, type = 'danger', bgColor, showZero = false, shape = 'circle', border = false, children, className = '', style }) {
|
|
3
|
+
const label = badgeLabel(value, max, showZero);
|
|
4
|
+
const fixed = children !== undefined && children !== null && children !== false;
|
|
5
|
+
return <view className={`ui-badge ${className}`} style={style}>
|
|
6
|
+
{typeof children === 'string' || typeof children === 'number' ? <text>{children}</text> : children}
|
|
7
|
+
{!hidden && (isDot || label !== null) ? <view className={`ui-badge-content ui-badge-${type} ui-badge-${shape} ${fixed ? 'ui-badge-fixed' : ''} ${isDot ? 'ui-badge-dot' : ''} ${border ? 'ui-badge-bordered' : ''}`} style={{ top: badgeOffset(top), right: badgeOffset(right), backgroundColor: bgColor }}>
|
|
8
|
+
{isDot ? null : <text className="ui-badge-label">{label}</text>}
|
|
9
|
+
</view> : null}
|
|
10
|
+
</view>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CSSProperties } from '@lynx-js/types';
|
|
2
|
+
import type { BarCodeOptions } from './barCodeModel.js';
|
|
3
|
+
export type { BarCodeFormat } from './barCodeModel.js';
|
|
4
|
+
export type BarCodeProps = BarCodeOptions & {
|
|
5
|
+
onValid?: (valid: boolean) => void;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export type BarCodeRef = {
|
|
11
|
+
exportImage: () => Promise<string>;
|
|
12
|
+
getSvg: () => string;
|
|
13
|
+
};
|
|
14
|
+
/** Standard barcode encoders and native SVG; no DOM, Canvas, filesystem or host business API. */
|
|
15
|
+
export declare const BarCode: (props: BarCodeOptions & {
|
|
16
|
+
onValid?: (valid: boolean) => void;
|
|
17
|
+
onError?: (error: Error) => void;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
} & import("react").RefAttributes<BarCodeRef>) => React.ReactElement | null;
|