@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
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const escape = (value) => value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
|
2
|
+
/** Render trusted, bundled SVG geometry with a literal or gradient paint. */
|
|
3
|
+
export function glyphSvg(glyph, color, defs = '') {
|
|
4
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">${defs}${glyph.replaceAll('currentColor', escape(color))}</svg>`;
|
|
5
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
.ui-image-preview{background:var(--cso-ui-image-preview-bg,rgba(0,0,0,.75));}
|
|
2
|
+
.ui-image-preview-swiper,.ui-image-preview-item{width:100%;height:100%;}
|
|
3
|
+
.ui-image-preview-index{position:absolute;top:16px;left:50%;transform:translateX(-50%);color:#fff;font-size:18px;font-weight:600;line-height:26px;z-index:10;}
|
|
4
|
+
.ui-image-preview-close{position:absolute;top:16px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;z-index:10;}
|
|
5
|
+
.ui-image-preview-close-top-right{right:16px;}.ui-image-preview-close-top-left{left:16px;}
|
|
6
|
+
.ui-image-preview-content,.ui-image-preview-custom-indicator{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;}
|
|
7
|
+
.ui-image-preview-custom-close{position:absolute;top:16px;right:16px;z-index:10;}
|
|
8
|
+
.ui-image-preview-content > *,.ui-image-preview-custom-indicator > *{pointer-events:auto;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ui-img-cropper { width:100%; height:100%; }
|
package/dist/img.css
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
.ui-img{position:relative;display:flex;flex-shrink:0;overflow:hidden;}
|
|
2
|
+
.ui-img-round{border-radius:9999px;}
|
|
3
|
+
.ui-img-image{position:absolute;left:0;top:0;width:100%;height:100%;}
|
|
4
|
+
.ui-img-placeholder{position:absolute;left:0;top:0;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:14px;color:var(--cso-ui-text-muted);background-color:var(--cso-ui-img-loading-bg,#f7f8fa);}
|
|
5
|
+
.theme-dark .ui-img-placeholder{background-color:var(--cso-ui-img-loading-bg,#1d1f29);}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type CropperSize = {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
export type CropperTransform = {
|
|
6
|
+
rotation: number;
|
|
7
|
+
zoom: number;
|
|
8
|
+
offsetX: number;
|
|
9
|
+
offsetY: number;
|
|
10
|
+
};
|
|
11
|
+
export type ImgCropperConfig = {
|
|
12
|
+
show: boolean;
|
|
13
|
+
imgSrc: string;
|
|
14
|
+
aspectRatio: string;
|
|
15
|
+
imgWidth?: number | string;
|
|
16
|
+
imgHeight?: number | string;
|
|
17
|
+
disabledRotate: boolean;
|
|
18
|
+
exportScale: number;
|
|
19
|
+
maxScale: number;
|
|
20
|
+
quality: number;
|
|
21
|
+
fileType: 'png' | 'jpg';
|
|
22
|
+
cancelButtonText: string;
|
|
23
|
+
confirmButtonText: string;
|
|
24
|
+
};
|
|
25
|
+
export type ImgCropperResult = {
|
|
26
|
+
tempFilePath: string;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
fileType: 'png' | 'jpg';
|
|
30
|
+
};
|
|
31
|
+
export type ImgCropperSignal = {
|
|
32
|
+
kind: 'confirm' | 'cancel' | 'loaded' | 'error';
|
|
33
|
+
phase?: 'load' | 'export' | 'config';
|
|
34
|
+
result?: ImgCropperResult;
|
|
35
|
+
width?: number;
|
|
36
|
+
height?: number;
|
|
37
|
+
message?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const initialCropperTransform: CropperTransform;
|
|
40
|
+
export declare function cropperAspect(value?: string): number;
|
|
41
|
+
export declare function cropperFrame(viewport: CropperSize, aspect: string): CropperSize;
|
|
42
|
+
/** Clamp the crop corners in the rotated image's coordinate system. */
|
|
43
|
+
export declare function cropperGeometry(source: CropperSize, crop: CropperSize, input: CropperTransform, maxScale?: number): {
|
|
44
|
+
rotation: number;
|
|
45
|
+
zoom: number;
|
|
46
|
+
offsetX: number;
|
|
47
|
+
offsetY: number;
|
|
48
|
+
scale: number;
|
|
49
|
+
coverScale: number;
|
|
50
|
+
};
|
|
51
|
+
export declare function cropperExportSize(frame: CropperSize, exportScale: number): {
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
};
|
|
55
|
+
export declare function cropperInitialZoom(source: CropperSize, viewport: CropperSize, cover: number, width?: number | string, height?: number | string): number;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const initialCropperTransform = { rotation: 0, zoom: 1, offsetX: 0, offsetY: 0 };
|
|
2
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
3
|
+
export function cropperAspect(value = '1:1') {
|
|
4
|
+
const match = /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(value);
|
|
5
|
+
if (!match || Number(match[1]) <= 0 || Number(match[2]) <= 0)
|
|
6
|
+
throw new Error('aspectRatio 必须为正数宽:高');
|
|
7
|
+
const ratio = Number(match[1]) / Number(match[2]);
|
|
8
|
+
if (!Number.isFinite(ratio) || ratio < 0.02 || ratio > 50)
|
|
9
|
+
throw new Error('裁剪比例超出范围');
|
|
10
|
+
return ratio;
|
|
11
|
+
}
|
|
12
|
+
export function cropperFrame(viewport, aspect) {
|
|
13
|
+
const ratio = cropperAspect(aspect), width = Math.min(Math.max(1, viewport.width - 40), viewport.height * 0.85 * ratio);
|
|
14
|
+
return { width: Math.max(1, width), height: Math.max(1, width / ratio) };
|
|
15
|
+
}
|
|
16
|
+
/** Clamp the crop corners in the rotated image's coordinate system. */
|
|
17
|
+
export function cropperGeometry(source, crop, input, maxScale = 3) {
|
|
18
|
+
const rotation = ((input.rotation % 360) + 360) % 360, radians = rotation * Math.PI / 180;
|
|
19
|
+
const cos = Math.cos(radians), sin = Math.sin(radians);
|
|
20
|
+
const extentX = (Math.abs(cos) * crop.width + Math.abs(sin) * crop.height) / 2;
|
|
21
|
+
const extentY = (Math.abs(sin) * crop.width + Math.abs(cos) * crop.height) / 2;
|
|
22
|
+
const coverScale = Math.max(extentX * 2 / source.width, extentY * 2 / source.height);
|
|
23
|
+
const zoom = clamp(Number.isFinite(input.zoom) ? input.zoom : 1, 1, Math.max(1, maxScale));
|
|
24
|
+
const scale = coverScale * zoom;
|
|
25
|
+
const limitX = Math.max(0, source.width * scale / 2 - extentX), limitY = Math.max(0, source.height * scale / 2 - extentY);
|
|
26
|
+
const x = clamp(cos * input.offsetX + sin * input.offsetY, -limitX, limitX);
|
|
27
|
+
const y = clamp(-sin * input.offsetX + cos * input.offsetY, -limitY, limitY);
|
|
28
|
+
return { rotation, zoom, offsetX: cos * x - sin * y, offsetY: sin * x + cos * y, scale, coverScale };
|
|
29
|
+
}
|
|
30
|
+
export function cropperExportSize(frame, exportScale) {
|
|
31
|
+
if (!Number.isFinite(exportScale) || exportScale <= 0)
|
|
32
|
+
throw new Error('exportScale 必须为有限正数');
|
|
33
|
+
const width = Math.round(frame.width * exportScale), height = Math.round(frame.height * exportScale);
|
|
34
|
+
if (width < 1 || height < 1 || width > 4096 || height > 4096 || width * height > 16777216)
|
|
35
|
+
throw new Error('导出图片应在 1–4096 像素及 1600 万像素内');
|
|
36
|
+
return { width, height };
|
|
37
|
+
}
|
|
38
|
+
export function cropperInitialZoom(source, viewport, cover, width, height) {
|
|
39
|
+
const size = (v, total) => typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : typeof v === 'string' && /^\d+(\.\d+)?%$/.test(v) ? parseFloat(v) / 100 * total : 0;
|
|
40
|
+
return Math.max(1, size(width, viewport.width) / source.width / cover, size(height, viewport.height) / source.height / cover);
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ImgMode = 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
|
|
2
|
+
export type ImgSize = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function imgFrame(mode: ImgMode, box: ImgSize, natural: ImgSize): {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
mode: "aspectFit" | "scaleToFill" | "aspectFill";
|
|
12
|
+
};
|
|
13
|
+
export declare function imgDimension(value: number | string | undefined, fallback: number): string;
|
package/dist/imgModel.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function imgFrame(mode, box, natural) {
|
|
2
|
+
let { width, height } = natural;
|
|
3
|
+
if (mode === 'widthFix') {
|
|
4
|
+
width = box.width;
|
|
5
|
+
height = width * natural.height / natural.width;
|
|
6
|
+
}
|
|
7
|
+
if (mode === 'heightFix') {
|
|
8
|
+
height = box.height;
|
|
9
|
+
width = height * natural.width / natural.height;
|
|
10
|
+
}
|
|
11
|
+
if (mode === 'scaleToFill' || mode === 'aspectFit' || mode === 'aspectFill')
|
|
12
|
+
return { width: box.width, height: box.height, left: 0, top: 0, mode };
|
|
13
|
+
const scaled = mode === 'widthFix' || mode === 'heightFix';
|
|
14
|
+
return { width, height, left: scaled || mode.includes('left') ? 0 : mode.includes('right') ? box.width - width : (box.width - width) / 2, top: scaled || mode.includes('top') ? 0 : mode.includes('bottom') ? box.height - height : (box.height - height) / 2, mode: 'scaleToFill' };
|
|
15
|
+
}
|
|
16
|
+
export function imgDimension(value, fallback) {
|
|
17
|
+
if (typeof value === 'number')
|
|
18
|
+
return `${Number.isFinite(value) ? Math.max(0, value) : fallback}px`;
|
|
19
|
+
if (value === undefined || value.trim() === '')
|
|
20
|
+
return `${fallback}px`;
|
|
21
|
+
return /^\d+(\.\d+)?$/.test(value) ? `${value}px` : value;
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.ui-index-bar { position: relative; width: 100%; height: 100%; overflow: hidden; }
|
|
2
|
+
.ui-index-bar-list { width: 100%; height: 100%; }
|
|
3
|
+
.ui-index-bar-sticky { position: absolute; top: 0; left: 0; width: 100%; z-index: 2; }
|
|
4
|
+
.ui-index-anchor { width: 100%; padding: 10px; background-color: var(--cso-ui-canvas); }
|
|
5
|
+
.ui-index-anchor text { font-size: 14px; line-height: 16px; color: var(--cso-ui-text); }
|
|
6
|
+
.ui-index-bar-rail { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: flex; flex-direction: column; z-index: 3; }
|
|
7
|
+
.ui-index-bar-index { width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
|
|
8
|
+
.ui-index-bar-index text { font-size: 12px; line-height: 18px; font-weight: 500; color: var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); }
|
|
9
|
+
.ui-index-bar-index-active { background-color: var(--cso-ui-primary); }
|
|
10
|
+
.ui-index-bar-index-active text { color: #fff; }
|
|
11
|
+
.ui-index-bar-current { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%; background-color: var(--cso-ui-primary); display: flex; align-items: center; justify-content: center; z-index: 4; }
|
|
12
|
+
.ui-index-bar-current text { font-size: 24px; line-height: 32px; color: #fff; }
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
export { Button } from "./Button.jsx";
|
|
2
|
+
export { Text } from "./Text.jsx";
|
|
3
|
+
export { Transition } from "./Transition.jsx";
|
|
4
|
+
export type { TransitionProps, TransitionName } from "./Transition.jsx";
|
|
5
|
+
export { Resize } from "./Resize.jsx";
|
|
6
|
+
export type { ResizeProps, ResizeRect } from "./Resize.jsx";
|
|
7
|
+
export { Icon } from "./Icon.jsx";
|
|
8
|
+
export type { IconProps } from "./Icon.jsx";
|
|
9
|
+
export { iconNames } from './icons/paths.js';
|
|
10
|
+
export type { IconName } from './icons/paths.js';
|
|
11
|
+
export { Row, Col } from "./Layout.jsx";
|
|
12
|
+
export type { RowProps, ColProps } from "./Layout.jsx";
|
|
13
|
+
export type { TextProps } from "./Text.jsx";
|
|
14
|
+
export type { TextMode } from './textModel.js';
|
|
15
|
+
export type { ButtonProps, ButtonSize, ButtonTone, ButtonVariant } from "./Button.jsx";
|
|
16
|
+
export { Card, SectionTitle } from "./Card.jsx";
|
|
17
|
+
export { Collapse, CollapseItem, CollapseViewMore } from "./Collapse.jsx";
|
|
18
|
+
export type { CollapseItemData, CollapseProps } from "./Collapse.jsx";
|
|
19
|
+
export { Cell, CellGroup } from "./Cell.jsx";
|
|
20
|
+
export type { CellProps, CellGroupProps } from "./Cell.jsx";
|
|
21
|
+
export { Slider } from "./Slider.jsx";
|
|
22
|
+
export type { SliderProps } from "./Slider.jsx";
|
|
23
|
+
export type { SliderValue } from './sliderModel.js';
|
|
24
|
+
export { Divider } from "./Divider.jsx";
|
|
25
|
+
export type { DividerAlign, DividerProps } from "./Divider.jsx";
|
|
26
|
+
export { EmptyState } from "./EmptyState.jsx";
|
|
27
|
+
export { Loading } from "./Loading.jsx";
|
|
28
|
+
export type { LoadingSize, LoadingProps, LoadingType } from "./Loading.jsx";
|
|
29
|
+
export { Tabs } from "./Tabs.jsx";
|
|
30
|
+
export type { TabOption, TabsProps, LegacyTabsProps, StandardTabsProps, TabsItem, TabsEvent, TabsRef, TabsLineTheme } from "./Tabs.jsx";
|
|
31
|
+
export type { TabsValue } from './tabsModel.js';
|
|
32
|
+
export { Tag } from "./Tag.jsx";
|
|
33
|
+
export type { TagTone, TagProps, TagType, TagSize, TagVariant } from "./Tag.jsx";
|
|
34
|
+
export { uiTokens } from './tokens.js';
|
|
35
|
+
export type { UiTokens } from './tokens.js';
|
|
36
|
+
export { Navbar, NavbarCapsule } from "./Navbar.jsx";
|
|
37
|
+
export type { NavbarProps, NavbarCapsuleProps } from "./Navbar.jsx";
|
|
38
|
+
export { NumberStepper } from "./NumberStepper.jsx";
|
|
39
|
+
export { PagedList } from "./PagedList.jsx";
|
|
40
|
+
export { Radio, RadioGroup } from "./Radio.jsx";
|
|
41
|
+
export type { RadioProps, RadioGroupProps } from "./Radio.jsx";
|
|
42
|
+
export type { RadioOption } from "./legacy/RadioGroup.jsx";
|
|
43
|
+
export { SyncedInput } from "./SyncedInput.jsx";
|
|
44
|
+
export { SyncedTextarea } from "./SyncedTextarea.jsx";
|
|
45
|
+
export { FormFieldRow, FormInputRow, FormNumberRow, FormRadioRow, FormSelectRow, FormTextareaRow } from "./FormFieldRow.jsx";
|
|
46
|
+
export { RootPortal, RootPortalHost } from "./RootPortal.jsx";
|
|
47
|
+
export type { RootPortalProps, RootPortalHostProps } from "./RootPortal.jsx";
|
|
48
|
+
export { Fab } from "./Fab.jsx";
|
|
49
|
+
export type { FabProps, FabRef } from "./Fab.jsx";
|
|
50
|
+
export type { FabPosition, FabDirection, FabGap } from './fabModel.js';
|
|
51
|
+
export { Pagination } from "./Pagination.jsx";
|
|
52
|
+
export type { PaginationProps, PaginationRenderState } from "./Pagination.jsx";
|
|
53
|
+
export { Tabbar } from "./Tabbar.jsx";
|
|
54
|
+
export type { TabbarProps, TabbarItem } from "./Tabbar.jsx";
|
|
55
|
+
export type { TabbarValue, TabbarBeforeChange } from './tabbarModel.js';
|
|
56
|
+
export { Segmented } from "./Segmented.jsx";
|
|
57
|
+
export type { SegmentedProps } from "./Segmented.jsx";
|
|
58
|
+
export type { SegmentedValue, SegmentedOption, SegmentedInput } from './segmentedModel.js';
|
|
59
|
+
export { Sidebar } from "./Sidebar.jsx";
|
|
60
|
+
export type { SidebarProps, SidebarItem, SidebarBadgeProps } from "./Sidebar.jsx";
|
|
61
|
+
export type { SidebarValue, SidebarBeforeChange } from './sidebarModel.js';
|
|
62
|
+
export { IndexBar, IndexAnchor } from "./IndexBar.jsx";
|
|
63
|
+
export type { IndexBarProps, IndexAnchorProps, IndexBarRenderItem } from "./IndexBar.jsx";
|
|
64
|
+
export type { AnchorIndex, IndexBarSection } from './indexBarModel.js';
|
|
65
|
+
export { Backtop } from "./Backtop.jsx";
|
|
66
|
+
export type { BacktopProps, BacktopRequest } from "./Backtop.jsx";
|
|
67
|
+
export { Gap } from "./Gap.jsx";
|
|
68
|
+
export type { GapProps } from "./Gap.jsx";
|
|
69
|
+
export { Badge } from "./Badge.jsx";
|
|
70
|
+
export type { BadgeProps } from "./Badge.jsx";
|
|
71
|
+
export { Avatar, AvatarGroup } from "./Avatar.jsx";
|
|
72
|
+
export type { AvatarProps, AvatarGroupProps, AvatarGroupItem } from "./Avatar.jsx";
|
|
73
|
+
export type { AvatarSize } from './avatarModel.js';
|
|
74
|
+
export { Loadmore } from "./Loadmore.jsx";
|
|
75
|
+
export type { LoadmoreProps, LoadmoreState } from "./Loadmore.jsx";
|
|
76
|
+
export { Overlay } from "./Overlay.jsx";
|
|
77
|
+
export type { OverlayProps, LayerLifecycle } from "./Overlay.jsx";
|
|
78
|
+
export { Popup } from "./Popup.jsx";
|
|
79
|
+
export type { PopupProps, PopupPosition, PopupCloseReason } from "./Popup.jsx";
|
|
80
|
+
export { ActionSheet } from "./ActionSheet.jsx";
|
|
81
|
+
export type { ActionSheetProps, ActionSheetAction, ActionSheetPanel, ActionSheetSelection } from "./ActionSheet.jsx";
|
|
82
|
+
export { Dialog } from "./Dialog.jsx";
|
|
83
|
+
export type { DialogProps, DialogOptions, DialogAction, DialogResult, DialogInputProps } from "./Dialog.jsx";
|
|
84
|
+
export { useDialog } from './useDialog.js';
|
|
85
|
+
export { Switch } from "./Switch.jsx";
|
|
86
|
+
export type { SwitchProps, SwitchValue } from "./Switch.jsx";
|
|
87
|
+
export { Rate } from "./Rate.jsx";
|
|
88
|
+
export type { RateProps } from "./Rate.jsx";
|
|
89
|
+
export { SortButton } from "./SortButton.jsx";
|
|
90
|
+
export type { SortButtonProps, SortButtonValue } from "./SortButton.jsx";
|
|
91
|
+
export { DropMenu, DropMenuItem } from "./DropMenu.jsx";
|
|
92
|
+
export type { DropMenuProps, DropMenuItemProps, DropMenuItemRef, DropMenuValue, DropMenuOption } from "./DropMenu.jsx";
|
|
93
|
+
export { Tooltip } from "./Tooltip.jsx";
|
|
94
|
+
export type { TooltipProps, TooltipRef } from "./Tooltip.jsx";
|
|
95
|
+
export type { BubblePlacement, BubbleOffset } from './bubblePosition.js';
|
|
96
|
+
export { Toast } from "./Toast.jsx";
|
|
97
|
+
export { useToast } from './useToast.js';
|
|
98
|
+
export type { ToastProps, ToastOptions, ToastIconType, ToastDirection, ToastPosition, ToastLoadingType } from "./Toast.jsx";
|
|
99
|
+
export { Popover } from "./Popover.jsx";
|
|
100
|
+
export type { PopoverProps, PopoverRef, PopoverMenuItem } from "./Popover.jsx";
|
|
101
|
+
export { FloatingPanel } from "./FloatingPanel.jsx";
|
|
102
|
+
export type { FloatingPanelProps } from "./FloatingPanel.jsx";
|
|
103
|
+
export { SwipeAction } from "./SwipeAction.jsx";
|
|
104
|
+
export type { SwipeActionProps, SwipeActionRef, SwipeActionStatus, SwipeActionReason, SwipeActionPosition, SwipeActionBeforeClose, SwipeActionClickEvent } from "./SwipeAction.jsx";
|
|
105
|
+
export { Tour } from "./Tour.jsx";
|
|
106
|
+
export type { TourProps, TourStep, TourStepEvent, TourEndEvent, TourRenderState, TourRef } from "./Tour.jsx";
|
|
107
|
+
export { Input } from "./Input.jsx";
|
|
108
|
+
export type { InputProps, InputRef, TextFieldEvent } from "./Input.jsx";
|
|
109
|
+
export { Textarea } from "./Textarea.jsx";
|
|
110
|
+
export type { TextareaProps, TextareaRef } from "./Textarea.jsx";
|
|
111
|
+
export { InputNumber } from "./InputNumber.jsx";
|
|
112
|
+
export type { InputNumberProps, InputNumberValue, InputNumberTheme } from "./InputNumber.jsx";
|
|
113
|
+
export { Search } from "./Search.jsx";
|
|
114
|
+
export type { SearchProps, SearchRef } from "./Search.jsx";
|
|
115
|
+
export { Form, FormItem } from "./Form.jsx";
|
|
116
|
+
export type { FormProps, FormItemProps, FormRef } from "./Form.jsx";
|
|
117
|
+
export { zodAdapter } from './formModel.js';
|
|
118
|
+
export type { FormModel, FormSchema, FormSchemaIssue, FormError, FormValidateResult, FormValidateTrigger } from './formModel.js';
|
|
119
|
+
export { Checkbox, CheckboxGroup } from "./Checkbox.jsx";
|
|
120
|
+
export type { CheckboxProps, CheckboxRef, CheckboxGroupProps, CheckboxGroupRef } from "./Checkbox.jsx";
|
|
121
|
+
export type { ChoiceValue, ChoiceType } from "./choice.jsx";
|
|
122
|
+
export { Picker, PickerView } from "./Picker.jsx";
|
|
123
|
+
export type { PickerProps, PickerRef, PickerViewProps, PickerViewRef, PickerValue, PickerOption, PickerChange, PickerColumnItem, PickerColumns, PickerFieldNames } from "./Picker.jsx";
|
|
124
|
+
export { SelectPicker } from "./SelectPicker.jsx";
|
|
125
|
+
export type { SelectPickerProps, SelectPickerOption, SelectPickerValue, SelectPickerRef } from "./SelectPicker.jsx";
|
|
126
|
+
export { DatetimePicker, DatetimePickerView } from "./DatetimePicker.jsx";
|
|
127
|
+
export type { DatetimePickerProps, DatetimePickerRef, DatetimePickerModelValue, DatetimePickerViewProps, DatetimePickerType, DatetimePickerValue, DatetimePickerViewRef, DatetimePickerChange, DatetimeColumn, DatetimeColumnType, DatetimeFilterParams } from "./DatetimePicker.jsx";
|
|
128
|
+
export { Calendar, CalendarView } from "./Calendar.jsx";
|
|
129
|
+
export type { CalendarRef, CalendarShortcut, CalendarProps, CalendarViewProps, CalendarViewRef, CalendarType, CalendarValue, CalendarDayItem, CalendarDayType, CalendarSwitchMode } from "./Calendar.jsx";
|
|
130
|
+
export { Cascader } from "./Cascader.jsx";
|
|
131
|
+
export type { CascaderProps, CascaderOption, CascaderSelection, CascaderValue, CascaderLazyLoad, CascaderRef } from "./Cascader.jsx";
|
|
132
|
+
export { Upload } from "./Upload.jsx";
|
|
133
|
+
export type { UploadProps, UploadFile, UploadAdapter } from "./Upload.jsx";
|
|
134
|
+
export { SlideVerify } from "./SlideVerify.jsx";
|
|
135
|
+
export type { SlideVerifyProps, SlideVerifyRef } from "./SlideVerify.jsx";
|
|
136
|
+
export { Keyboard } from "./Keyboard.jsx";
|
|
137
|
+
export type { KeyboardProps, KeyboardMode, CarKeyboardLang } from "./Keyboard.jsx";
|
|
138
|
+
export { PasswordInput } from "./PasswordInput.jsx";
|
|
139
|
+
export type { PasswordInputProps } from "./PasswordInput.jsx";
|
|
140
|
+
export { ConfigProvider, useConfigProvider } from "./ConfigProvider.jsx";
|
|
141
|
+
export type { ConfigProviderProps, ConfigProviderTheme, ConfigProviderThemeVars, ConfigProviderValue, ConfigButtonDefaults, ConfigTagDefaults } from "./ConfigProvider.jsx";
|
|
142
|
+
export { Progress } from "./Progress.jsx";
|
|
143
|
+
export type { ProgressProps, PercentPosition } from "./Progress.jsx";
|
|
144
|
+
export type { ProgressColor, ProgressColorStop } from './progressModel.js';
|
|
145
|
+
export { Circle } from "./Circle.jsx";
|
|
146
|
+
export type { CircleProps } from "./Circle.jsx";
|
|
147
|
+
export type { CircleColor } from './circleModel.js';
|
|
148
|
+
export { Notify } from "./Notify.jsx";
|
|
149
|
+
export type { NotifyProps, NotifyOptions, NotifyType, NotifyPosition, NotifyVariant } from "./Notify.jsx";
|
|
150
|
+
export { useNotify } from './useNotify.js';
|
|
151
|
+
export { Signature } from "./Signature.jsx";
|
|
152
|
+
export type { SignatureProps, SignatureRef, SignatureFooter, SignatureResult, SignaturePoint, SignatureStroke } from "./Signature.jsx";
|
|
153
|
+
export { Grid, GridItem } from "./Grid.jsx";
|
|
154
|
+
export type { GridProps, GridItemProps, GridNavigation } from "./Grid.jsx";
|
|
155
|
+
export { CountDown } from "./CountDown.jsx";
|
|
156
|
+
export type { CountDownProps, CountDownRef } from "./CountDown.jsx";
|
|
157
|
+
export { useCountDown } from './useCountDown.js';
|
|
158
|
+
export type { UseCountDownOptions } from './useCountDown.js';
|
|
159
|
+
export type { TimeData } from './countDownModel.js';
|
|
160
|
+
export { CountTo } from "./CountTo.jsx";
|
|
161
|
+
export type { CountToProps, CountToRef } from "./CountTo.jsx";
|
|
162
|
+
export { Img } from "./Img.jsx";
|
|
163
|
+
export type { ImgProps, ImgPreview } from "./Img.jsx";
|
|
164
|
+
export type { ImgMode } from './imgModel.js';
|
|
165
|
+
export { Empty } from "./Empty.jsx";
|
|
166
|
+
export type { EmptyProps } from "./Empty.jsx";
|
|
167
|
+
export { NoticeBar } from "./NoticeBar.jsx";
|
|
168
|
+
export type { NoticeBarProps, NoticeBarRef, NoticeBarClick } from "./NoticeBar.jsx";
|
|
169
|
+
export type { CardProps } from "./Card.jsx";
|
|
170
|
+
export { Skeleton } from "./Skeleton.jsx";
|
|
171
|
+
export type { SkeletonProps, SkeletonCell, SkeletonRow, SkeletonTheme } from "./Skeleton.jsx";
|
|
172
|
+
export { Steps, Step } from "./Steps.jsx";
|
|
173
|
+
export type { StepsProps, StepProps, StepStatus } from "./Steps.jsx";
|
|
174
|
+
export { Sticky, StickyBox } from "./Sticky.jsx";
|
|
175
|
+
export type { StickyProps, StickyBoxProps } from "./Sticky.jsx";
|
|
176
|
+
export { Curtain } from "./Curtain.jsx";
|
|
177
|
+
export type { CurtainProps, CurtainClosePosition } from "./Curtain.jsx";
|
|
178
|
+
export { Watermark } from "./Watermark.jsx";
|
|
179
|
+
export type { WatermarkProps } from "./Watermark.jsx";
|
|
180
|
+
export { Swiper } from "./Swiper.jsx";
|
|
181
|
+
export type { SwiperProps, SwiperItem, SwiperIndicator, SwiperRef, SwiperChangeSource } from "./Swiper.jsx";
|
|
182
|
+
export { ImagePreview } from "./ImagePreview.jsx";
|
|
183
|
+
export type { ImagePreviewOptions, ImagePreviewProps, ImagePreviewRef, ImagePreviewSlot } from "./ImagePreview.jsx";
|
|
184
|
+
export { useImagePreview } from './useImagePreview.js';
|
|
185
|
+
export { SwiperNav } from "./SwiperNav.jsx";
|
|
186
|
+
export type { SwiperNavProps } from "./SwiperNav.jsx";
|
|
187
|
+
export { Table } from "./Table.jsx";
|
|
188
|
+
export type { TableProps, TableColumn, TableSortEvent, TableSpanScope } from "./Table.jsx";
|
|
189
|
+
export type { TableSpan } from './tableModel.js';
|
|
190
|
+
export { BarCode } from "./BarCode.jsx";
|
|
191
|
+
export type { BarCodeProps, BarCodeRef, BarCodeFormat } from "./BarCode.jsx";
|
|
192
|
+
export { QrCode } from "./QrCode.jsx";
|
|
193
|
+
export type { QrCodeProps, QrCodeRef } from "./QrCode.jsx";
|
|
194
|
+
export { RichText } from "./RichText.jsx";
|
|
195
|
+
export type { RichTextProps, RichTextRef, RichTextHeading, RichTextError, RichTextRect, RichTextMediaEvent, RichTextMediaTimeUpdate } from "./RichText.jsx";
|
|
196
|
+
export { VideoPreview } from "./VideoPreview.jsx";
|
|
197
|
+
export { useVideoPreview } from './useVideoPreview.js';
|
|
198
|
+
export type { VideoPreviewOptions, VideoPreviewProps, VideoPreviewRef, PreviewVideo } from "./VideoPreview.jsx";
|
|
199
|
+
export { ImgCropper } from "./ImgCropper.jsx";
|
|
200
|
+
export type { ImgCropperProps, ImgCropperRef, ImgCropperResult } from "./ImgCropper.jsx";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import './styles.css';
|
|
2
|
+
export { Button } from "./Button.jsx";
|
|
3
|
+
export { Text } from "./Text.jsx";
|
|
4
|
+
export { Transition } from "./Transition.jsx";
|
|
5
|
+
export { Resize } from "./Resize.jsx";
|
|
6
|
+
export { Icon } from "./Icon.jsx";
|
|
7
|
+
export { iconNames } from './icons/paths.js';
|
|
8
|
+
export { Row, Col } from "./Layout.jsx";
|
|
9
|
+
export { Card, SectionTitle } from "./Card.jsx";
|
|
10
|
+
export { Collapse, CollapseItem, CollapseViewMore } from "./Collapse.jsx";
|
|
11
|
+
export { Cell, CellGroup } from "./Cell.jsx";
|
|
12
|
+
export { Slider } from "./Slider.jsx";
|
|
13
|
+
export { Divider } from "./Divider.jsx";
|
|
14
|
+
export { EmptyState } from "./EmptyState.jsx";
|
|
15
|
+
export { Loading } from "./Loading.jsx";
|
|
16
|
+
export { Tabs } from "./Tabs.jsx";
|
|
17
|
+
export { Tag } from "./Tag.jsx";
|
|
18
|
+
export { uiTokens } from './tokens.js';
|
|
19
|
+
// Shared controls used by both business pages and the component demos.
|
|
20
|
+
export { Navbar, NavbarCapsule } from "./Navbar.jsx";
|
|
21
|
+
export { NumberStepper } from "./NumberStepper.jsx";
|
|
22
|
+
export { PagedList } from "./PagedList.jsx";
|
|
23
|
+
export { Radio, RadioGroup } from "./Radio.jsx";
|
|
24
|
+
export { SyncedInput } from "./SyncedInput.jsx";
|
|
25
|
+
export { SyncedTextarea } from "./SyncedTextarea.jsx";
|
|
26
|
+
export { FormFieldRow, FormInputRow, FormNumberRow, FormRadioRow, FormSelectRow, FormTextareaRow } from "./FormFieldRow.jsx";
|
|
27
|
+
export { RootPortal, RootPortalHost } from "./RootPortal.jsx";
|
|
28
|
+
export { Fab } from "./Fab.jsx";
|
|
29
|
+
export { Pagination } from "./Pagination.jsx";
|
|
30
|
+
export { Tabbar } from "./Tabbar.jsx";
|
|
31
|
+
export { Segmented } from "./Segmented.jsx";
|
|
32
|
+
export { Sidebar } from "./Sidebar.jsx";
|
|
33
|
+
export { IndexBar, IndexAnchor } from "./IndexBar.jsx";
|
|
34
|
+
export { Backtop } from "./Backtop.jsx";
|
|
35
|
+
export { Gap } from "./Gap.jsx";
|
|
36
|
+
export { Badge } from "./Badge.jsx";
|
|
37
|
+
export { Avatar, AvatarGroup } from "./Avatar.jsx";
|
|
38
|
+
export { Loadmore } from "./Loadmore.jsx";
|
|
39
|
+
export { Overlay } from "./Overlay.jsx";
|
|
40
|
+
export { Popup } from "./Popup.jsx";
|
|
41
|
+
export { ActionSheet } from "./ActionSheet.jsx";
|
|
42
|
+
export { Dialog } from "./Dialog.jsx";
|
|
43
|
+
export { useDialog } from './useDialog.js';
|
|
44
|
+
export { Switch } from "./Switch.jsx";
|
|
45
|
+
export { Rate } from "./Rate.jsx";
|
|
46
|
+
export { SortButton } from "./SortButton.jsx";
|
|
47
|
+
export { DropMenu, DropMenuItem } from "./DropMenu.jsx";
|
|
48
|
+
export { Tooltip } from "./Tooltip.jsx";
|
|
49
|
+
export { Toast } from "./Toast.jsx";
|
|
50
|
+
export { useToast } from './useToast.js';
|
|
51
|
+
export { Popover } from "./Popover.jsx";
|
|
52
|
+
export { FloatingPanel } from "./FloatingPanel.jsx";
|
|
53
|
+
export { SwipeAction } from "./SwipeAction.jsx";
|
|
54
|
+
export { Tour } from "./Tour.jsx";
|
|
55
|
+
export { Input } from "./Input.jsx";
|
|
56
|
+
export { Textarea } from "./Textarea.jsx";
|
|
57
|
+
export { InputNumber } from "./InputNumber.jsx";
|
|
58
|
+
export { Search } from "./Search.jsx";
|
|
59
|
+
export { Form, FormItem } from "./Form.jsx";
|
|
60
|
+
export { zodAdapter } from './formModel.js';
|
|
61
|
+
export { Checkbox, CheckboxGroup } from "./Checkbox.jsx";
|
|
62
|
+
export { Picker, PickerView } from "./Picker.jsx";
|
|
63
|
+
export { SelectPicker } from "./SelectPicker.jsx";
|
|
64
|
+
export { DatetimePicker, DatetimePickerView } from "./DatetimePicker.jsx";
|
|
65
|
+
export { Calendar, CalendarView } from "./Calendar.jsx";
|
|
66
|
+
export { Cascader } from "./Cascader.jsx";
|
|
67
|
+
export { Upload } from "./Upload.jsx";
|
|
68
|
+
export { SlideVerify } from "./SlideVerify.jsx";
|
|
69
|
+
export { Keyboard } from "./Keyboard.jsx";
|
|
70
|
+
export { PasswordInput } from "./PasswordInput.jsx";
|
|
71
|
+
export { ConfigProvider, useConfigProvider } from "./ConfigProvider.jsx";
|
|
72
|
+
export { Progress } from "./Progress.jsx";
|
|
73
|
+
export { Circle } from "./Circle.jsx";
|
|
74
|
+
export { Notify } from "./Notify.jsx";
|
|
75
|
+
export { useNotify } from './useNotify.js';
|
|
76
|
+
export { Signature } from "./Signature.jsx";
|
|
77
|
+
export { Grid, GridItem } from "./Grid.jsx";
|
|
78
|
+
export { CountDown } from "./CountDown.jsx";
|
|
79
|
+
export { useCountDown } from './useCountDown.js';
|
|
80
|
+
export { CountTo } from "./CountTo.jsx";
|
|
81
|
+
export { Img } from "./Img.jsx";
|
|
82
|
+
export { Empty } from "./Empty.jsx";
|
|
83
|
+
export { NoticeBar } from "./NoticeBar.jsx";
|
|
84
|
+
export { Skeleton } from "./Skeleton.jsx";
|
|
85
|
+
export { Steps, Step } from "./Steps.jsx";
|
|
86
|
+
export { Sticky, StickyBox } from "./Sticky.jsx";
|
|
87
|
+
export { Curtain } from "./Curtain.jsx";
|
|
88
|
+
export { Watermark } from "./Watermark.jsx";
|
|
89
|
+
export { Swiper } from "./Swiper.jsx";
|
|
90
|
+
export { ImagePreview } from "./ImagePreview.jsx";
|
|
91
|
+
export { useImagePreview } from './useImagePreview.js';
|
|
92
|
+
export { SwiperNav } from "./SwiperNav.jsx";
|
|
93
|
+
export { Table } from "./Table.jsx";
|
|
94
|
+
export { BarCode } from "./BarCode.jsx";
|
|
95
|
+
export { QrCode } from "./QrCode.jsx";
|
|
96
|
+
export { RichText } from "./RichText.jsx";
|
|
97
|
+
export { VideoPreview } from "./VideoPreview.jsx";
|
|
98
|
+
export { useVideoPreview } from './useVideoPreview.js';
|
|
99
|
+
export { ImgCropper } from "./ImgCropper.jsx";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type AnchorIndex = string | number;
|
|
2
|
+
export type IndexBarSection<T> = {
|
|
3
|
+
index: AnchorIndex;
|
|
4
|
+
data: readonly T[];
|
|
5
|
+
};
|
|
6
|
+
export declare function indexBarSize(value: number, fallback: number): number;
|
|
7
|
+
export declare function indexBarLayout<T>(sections: readonly IndexBarSection<T>[], itemHeight?: number, anchorHeight?: number): {
|
|
8
|
+
position: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}[];
|
|
12
|
+
export declare function indexBarSectionAtOffset(layout: readonly {
|
|
13
|
+
offset: number;
|
|
14
|
+
}[], offset: number): number;
|
|
15
|
+
export declare function indexBarIndexAtPoint(point: number, top: number, height: number, count: number): number;
|
|
16
|
+
export declare function indexBarStickyOffset(layout: readonly {
|
|
17
|
+
offset: number;
|
|
18
|
+
}[], section: number, scrollTop: number, height: number): number;
|
|
19
|
+
export declare function anchorKey(index: AnchorIndex): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function indexBarSize(value, fallback) {
|
|
2
|
+
return Number.isFinite(value) && value > 0 ? value : fallback;
|
|
3
|
+
}
|
|
4
|
+
export function indexBarLayout(sections, itemHeight = 44, anchorHeight = 36) {
|
|
5
|
+
const rowSize = indexBarSize(itemHeight, 44);
|
|
6
|
+
const anchorSize = indexBarSize(anchorHeight, 36);
|
|
7
|
+
let position = 0;
|
|
8
|
+
let offset = 0;
|
|
9
|
+
return sections.map(section => {
|
|
10
|
+
const result = { position, offset, height: anchorSize + section.data.length * rowSize };
|
|
11
|
+
position += section.data.length + 1;
|
|
12
|
+
offset += result.height;
|
|
13
|
+
return result;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function indexBarSectionAtOffset(layout, offset) {
|
|
17
|
+
if (!layout.length)
|
|
18
|
+
return -1;
|
|
19
|
+
const top = Number.isFinite(offset) ? Math.max(0, offset) : 0;
|
|
20
|
+
let section = 0;
|
|
21
|
+
for (let i = 1; i < layout.length; i++) {
|
|
22
|
+
if (top + .5 < layout[i].offset)
|
|
23
|
+
break;
|
|
24
|
+
section = i;
|
|
25
|
+
}
|
|
26
|
+
return section;
|
|
27
|
+
}
|
|
28
|
+
export function indexBarIndexAtPoint(point, top, height, count) {
|
|
29
|
+
if (!count || ![point, top, height].every(Number.isFinite) || height <= 0)
|
|
30
|
+
return -1;
|
|
31
|
+
return Math.max(0, Math.min(count - 1, Math.floor((point - top) / (height / count))));
|
|
32
|
+
}
|
|
33
|
+
export function indexBarStickyOffset(layout, section, scrollTop, height) {
|
|
34
|
+
const next = layout[section + 1];
|
|
35
|
+
return next ? Math.min(0, next.offset - Math.max(0, scrollTop) - height) : 0;
|
|
36
|
+
}
|
|
37
|
+
export function anchorKey(index) { return `${typeof index}:${index}`; }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.ui-input-number{--ui-number-action-bg:var(--cso-ui-canvas);--ui-number-action-color:var(--cso-ui-text-muted);--ui-number-inner-bg:var(--cso-ui-canvas);display:flex;flex-direction:row;align-items:center;}
|
|
2
|
+
.ui-input-number-action{position:relative;display:flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;background-color:var(--ui-number-action-bg);}
|
|
3
|
+
.ui-input-number-minus{border-radius:4px 0 0 4px;}
|
|
4
|
+
.ui-input-number-plus{border-radius:0 4px 4px 0;}
|
|
5
|
+
.ui-input-number-horizontal{width:12px;height:1.5px;background-color:var(--ui-number-action-color);}
|
|
6
|
+
.ui-input-number-vertical{position:absolute;width:1.5px;height:12px;background-color:var(--ui-number-action-color);}
|
|
7
|
+
.ui-input-number-action-disabled{--ui-number-action-color:var(--cso-ui-line-strong,#c9cbd4);}
|
|
8
|
+
.ui-input-number-inner{height:28px;padding:0 8px;background-color:var(--ui-number-inner-bg);display:flex;flex-direction:row;align-items:center;}
|
|
9
|
+
.ui-input-number-editor{height:100%;}
|
|
10
|
+
.ui-input-number-editor .ui-textfield-body{height:100%;}
|
|
11
|
+
.ui-input-number-editor .ui-textfield-native{height:100%;font-weight:600;}
|
|
12
|
+
.ui-input-number-divider{position:absolute;top:0;width:1px;height:100%;background-color:var(--cso-ui-surface);}
|
|
13
|
+
.ui-input-number-minus .ui-input-number-divider{right:0;}
|
|
14
|
+
.ui-input-number-plus .ui-input-number-divider{left:0;}
|
|
15
|
+
.ui-input-number-outline-split .ui-input-number-divider{top:5px;height:18px;background-color:var(--cso-ui-line);}
|
|
16
|
+
.ui-input-number-outline .ui-input-number-divider,.ui-input-number-primary .ui-input-number-divider{display:none;}
|
|
17
|
+
.ui-input-number-outline .ui-input-number-action{border-width:1px;border-style:solid;border-color:var(--cso-ui-line);}
|
|
18
|
+
.ui-input-number-outline .ui-input-number-inner{border-top-width:1px;border-top-style:solid;border-top-color:var(--cso-ui-line);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--cso-ui-line);}
|
|
19
|
+
.ui-input-number-primary .ui-input-number-minus{--ui-number-action-bg:transparent;--ui-number-action-color:var(--cso-ui-primary);border-width:1px;border-style:solid;border-color:var(--cso-ui-primary);}
|
|
20
|
+
.ui-input-number-primary .ui-input-number-plus{--ui-number-action-bg:var(--cso-ui-primary);--ui-number-action-color:#fff;}
|
|
21
|
+
.ui-input-number-primary .ui-input-number-action-disabled{opacity:.4;}
|
|
22
|
+
.ui-input-number-round .ui-input-number-minus{border-radius:999px 0 0 999px;}
|
|
23
|
+
.ui-input-number-round .ui-input-number-plus{border-radius:0 999px 999px 0;}
|
|
24
|
+
.ui-input-number .ui-textfield-disabled .ui-textfield-native{color:var(--cso-ui-text);}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type InputNumberValue = number | string;
|
|
2
|
+
export type NumberRules = {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
precision?: number | string;
|
|
7
|
+
stepStrictly?: boolean;
|
|
8
|
+
allowNull?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function numberRules({ min, max, step, precision, stepStrictly, allowNull }: NumberRules): {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
step: number;
|
|
14
|
+
precision: number;
|
|
15
|
+
stepStrictly: boolean;
|
|
16
|
+
allowNull: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type ResolvedNumberRules = ReturnType<typeof numberRules>;
|
|
19
|
+
export declare function normalizeNumber(value: InputNumberValue | undefined, rules: ResolvedNumberRules): number | '';
|
|
20
|
+
export declare function numberDisplay(value: InputNumberValue | undefined, rules: ResolvedNumberRules, normalize?: boolean): string;
|
|
21
|
+
export declare function numberDraft(value: string, precision: number): string;
|
|
22
|
+
export declare function sameNumber(a: InputNumberValue | undefined, b: InputNumberValue | undefined): boolean;
|
|
23
|
+
export declare function addNumber(value: number, step: number): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export function numberRules({ min = 1, max = Number.MAX_SAFE_INTEGER, step = 1, precision = 0, stepStrictly = false, allowNull = false }) {
|
|
2
|
+
const lower = Number.isFinite(min) ? min : 1;
|
|
3
|
+
return { min: lower, max: Number.isFinite(max) ? Math.max(lower, max) : Number.MAX_SAFE_INTEGER, step: Number.isFinite(step) && step > 0 ? step : 1, precision: Number.isFinite(Number(precision)) ? Math.min(20, Math.max(0, Math.trunc(Number(precision)))) : 0, stepStrictly, allowNull };
|
|
4
|
+
}
|
|
5
|
+
export function normalizeNumber(value, rules) {
|
|
6
|
+
if (rules.allowNull && (value === undefined || value === ''))
|
|
7
|
+
return '';
|
|
8
|
+
const parsed = value === undefined || value === '' ? rules.min : Number(value);
|
|
9
|
+
let next = Number.isFinite(parsed) ? parsed : rules.min;
|
|
10
|
+
if (rules.stepStrictly) {
|
|
11
|
+
const first = Math.ceil(Number((rules.min / rules.step).toPrecision(15)));
|
|
12
|
+
const last = Math.floor(Number((rules.max / rules.step).toPrecision(15)));
|
|
13
|
+
// An interval without a step multiple prioritizes the explicit bounds.
|
|
14
|
+
next = first <= last ? Math.min(last, Math.max(first, Math.round(next / rules.step))) * rules.step : rules.min;
|
|
15
|
+
}
|
|
16
|
+
next = Number(Math.min(rules.max, Math.max(rules.min, next)).toFixed(rules.precision));
|
|
17
|
+
return Math.min(rules.max, Math.max(rules.min, next));
|
|
18
|
+
}
|
|
19
|
+
export function numberDisplay(value, rules, normalize = true) {
|
|
20
|
+
const next = normalize ? normalizeNumber(value, rules) : value;
|
|
21
|
+
if (next === '' || next === undefined)
|
|
22
|
+
return rules.allowNull ? '' : rules.min.toFixed(rules.precision);
|
|
23
|
+
const parsed = Number(next);
|
|
24
|
+
return (Number.isFinite(parsed) ? parsed : rules.min).toFixed(rules.precision);
|
|
25
|
+
}
|
|
26
|
+
export function numberDraft(value, precision) {
|
|
27
|
+
const negative = value.startsWith('-');
|
|
28
|
+
let clean = value.replace(/[^\d.]/g, '');
|
|
29
|
+
const parts = clean.split('.');
|
|
30
|
+
clean = precision > 0 ? parts[0] + (parts.length > 1 ? `.${parts.slice(1).join('')}` : '') : parts[0];
|
|
31
|
+
if (clean.startsWith('.'))
|
|
32
|
+
clean = `0${clean}`;
|
|
33
|
+
return `${negative ? '-' : ''}${clean}`;
|
|
34
|
+
}
|
|
35
|
+
export function sameNumber(a, b) {
|
|
36
|
+
if (a === '' || b === '' || a === undefined || b === undefined)
|
|
37
|
+
return a === b;
|
|
38
|
+
return Number(a) === Number(b);
|
|
39
|
+
}
|
|
40
|
+
export function addNumber(value, step) { return Number((value + step).toPrecision(15)); }
|