react-kui 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI.en-US.md +23 -0
- package/AI.md +76 -0
- package/LICENSE +21 -21
- package/README.zh-CN.md +142 -0
- package/ai/behaviors.json +16 -0
- package/ai/cli.mjs +27 -0
- package/ai/evals/README.md +59 -0
- package/ai/evals/cases.json +207 -0
- package/ai/evals/config.json +4 -0
- package/ai/evals/evaluate.mjs +267 -0
- package/ai/evals/run.mjs +118 -0
- package/ai/kui-components.json +58292 -0
- package/ai/kui-components.schema.json +143 -0
- package/ai/mcp.mjs +290 -0
- package/ai/skills/react-kui/SKILL.md +16 -0
- package/ai/skills/react-kui/references/components.md +9 -0
- package/ai/skills/react-kui/references/mcp.md +14 -0
- package/ai/templates/form.tsx +69 -0
- package/ai/templates/index.json +23 -0
- package/ai/templates/modal-editor.tsx +80 -0
- package/ai/templates/table.tsx +85 -0
- package/ai/validate.d.mts +16 -0
- package/ai/validate.mjs +184 -0
- package/es/_virtual/_rolldown/runtime.js +21 -0
- package/es/affix/index.js +222 -0
- package/es/alert/index.js +71 -0
- package/es/anchor/anchor-context.js +13 -0
- package/es/anchor/anchor-link.js +121 -0
- package/es/anchor/anchor.js +431 -0
- package/es/auto-complete/index.js +692 -0
- package/es/avatar/avatar-group-context.js +13 -0
- package/es/avatar/avatar-group.js +145 -0
- package/es/avatar/avatar.js +204 -0
- package/es/back-top/index.js +224 -0
- package/es/badge/index.js +66 -0
- package/es/base/teleport.js +83 -0
- package/es/base/transition-props.js +56 -0
- package/es/base/transition.js +108 -0
- package/es/breadcrumb/breadcrumb-context.js +13 -0
- package/es/breadcrumb/breadcrumb-item.js +128 -0
- package/es/breadcrumb/breadcrumb.js +75 -0
- package/es/button/button-group-context.js +13 -0
- package/es/button/button-group.js +100 -0
- package/es/button/button.js +99 -0
- package/es/calendar/index.js +271 -0
- package/es/card/index.js +157 -0
- package/es/carousel/carousel-context.js +17 -0
- package/es/carousel/carousel-item.js +71 -0
- package/es/carousel/carousel.js +453 -0
- package/es/cascader/index.js +435 -0
- package/es/check-card/check-card-group.js +211 -0
- package/es/check-card/check-card.js +326 -0
- package/es/check-card/context.js +13 -0
- package/es/checkbox/checkbox-group-context.js +13 -0
- package/es/checkbox/checkbox-group.js +168 -0
- package/es/checkbox/checkbox.js +270 -0
- package/es/checkbox/index.js +14 -0
- package/es/collapse/collapse-panel.js +233 -0
- package/es/collapse/collapse.js +186 -0
- package/es/color-picker/alpha.js +131 -0
- package/es/color-picker/hue.js +111 -0
- package/es/color-picker/index.js +329 -0
- package/es/color-picker/mode.js +178 -0
- package/es/color-picker/paint.js +175 -0
- package/es/color-picker/presets.js +80 -0
- package/es/components.js +260 -0
- package/es/config/config-context.js +13 -0
- package/es/config/context.js +26 -0
- package/es/config/index.js +52 -0
- package/es/config/size-context.js +13 -0
- package/es/config/use-config-appearance.js +39 -0
- package/es/const/var.js +31 -0
- package/es/date-picker/index.js +1257 -0
- package/es/descriptions/descriptions-item.js +25 -0
- package/es/descriptions/descriptions.js +285 -0
- package/es/divider/index.js +38 -0
- package/es/drawer/index.js +432 -0
- package/es/dropdown/dropdown-button.js +139 -0
- package/es/dropdown/dropdown-context.js +16 -0
- package/es/dropdown/dropdown.js +351 -0
- package/es/dropdown/trigger.js +88 -0
- package/es/empty/index.js +133 -0
- package/es/feature-card/index.js +74 -0
- package/es/feedback-panel/index.js +179 -0
- package/es/flame-wrap/index.js +262 -0
- package/es/flame-wrap/types.js +593 -0
- package/es/flex/index.js +46 -0
- package/es/form/field-context.js +102 -0
- package/es/form/form-context.js +13 -0
- package/es/form/form-item.js +327 -0
- package/es/form/form.js +303 -0
- package/es/form/utils.js +44 -0
- package/es/grid/grid-item.js +130 -0
- package/es/grid/grid.js +177 -0
- package/es/grid/useBreakpoint.js +64 -0
- package/es/icon/index.js +161 -0
- package/es/image/group.js +121 -0
- package/es/image/image-group-context.js +13 -0
- package/es/image/image.js +314 -0
- package/es/image/instance.js +47 -0
- package/es/image/preview.js +383 -0
- package/es/image/utils.js +39 -0
- package/es/index.js +129 -0
- package/es/input/index.js +15 -0
- package/es/input/input-box.js +40 -0
- package/es/input/input-group.js +150 -0
- package/es/input/input.js +203 -0
- package/es/input/textarea.js +135 -0
- package/es/input-number/index.js +153 -0
- package/es/input-otp/index.js +142 -0
- package/es/input-tag/index.js +178 -0
- package/es/kanban/index.js +254 -0
- package/es/layout/index.js +256 -0
- package/es/layout/layout-context.js +13 -0
- package/es/list-panel/index.js +194 -0
- package/es/loading/index.js +69 -0
- package/es/loading/loading-bar.js +133 -0
- package/es/locale/de.js +69 -0
- package/es/locale/el.js +69 -0
- package/es/locale/en.js +69 -0
- package/es/locale/fr.js +69 -0
- package/es/locale/it.js +69 -0
- package/es/locale/ja.js +69 -0
- package/es/locale/ko.js +69 -0
- package/es/locale/ru.js +69 -0
- package/es/locale/th.js +69 -0
- package/es/locale/uk.js +69 -0
- package/es/locale/vi.js +69 -0
- package/es/locale/zh-CN.js +69 -0
- package/es/locale/zh-TW.js +69 -0
- package/es/mentions/index.js +710 -0
- package/es/menu/menu-context.js +20 -0
- package/es/menu/menu-divider.js +29 -0
- package/es/menu/menu-group.js +49 -0
- package/es/menu/menu-item.js +79 -0
- package/es/menu/menu-keyboard.js +35 -0
- package/es/menu/menu.js +484 -0
- package/es/menu/recursive-menu.js +68 -0
- package/es/menu/sub-menu.js +256 -0
- package/es/message/index.js +67 -0
- package/es/modal/api.js +62 -0
- package/es/modal/modal.js +589 -0
- package/es/modal/toast.js +99 -0
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +189 -0
- package/es/notice/container.js +123 -0
- package/es/notice/content.js +92 -0
- package/es/notice/index.js +52 -0
- package/es/notice/instance.js +65 -0
- package/es/page/index.js +275 -0
- package/es/page-header/index.js +134 -0
- package/es/popconfirm/index.js +275 -0
- package/es/poptip/index.js +270 -0
- package/es/progress/index.js +253 -0
- package/es/qrcode/index.js +204 -0
- package/es/radio/radio-button.js +158 -0
- package/es/radio/radio-group-context.js +13 -0
- package/es/radio/radio-group.js +264 -0
- package/es/radio/radio.js +232 -0
- package/es/rate/index.js +253 -0
- package/es/rate/star.js +150 -0
- package/es/result/index.js +147 -0
- package/es/ripple/index.js +245 -0
- package/es/ripple/types.js +433 -0
- package/es/row-col/col.js +163 -0
- package/es/row-col/row.js +37 -0
- package/es/segmented/index.js +240 -0
- package/es/select/option.js +124 -0
- package/es/select/select.js +655 -0
- package/es/skeleton/skeleton-avatar.js +44 -0
- package/es/skeleton/skeleton-button.js +43 -0
- package/es/skeleton/skeleton-image.js +131 -0
- package/es/skeleton/skeleton-text.js +113 -0
- package/es/skeleton/skeleton.js +148 -0
- package/es/skeleton/use-skeleton-loading.js +53 -0
- package/es/slider/index.js +484 -0
- package/es/slider/thumb.js +158 -0
- package/es/space/index.js +94 -0
- package/es/spin/index.js +61 -0
- package/es/splitter/splitter-panel.js +50 -0
- package/es/splitter/splitter.js +310 -0
- package/es/stat-card/countup.js +157 -0
- package/es/stat-card/stat-card.js +63 -0
- package/es/stat-card/stat-number.js +125 -0
- package/es/stat-card/utils/countup.js +291 -0
- package/es/stat-card/utils/odometer.js +129 -0
- package/es/steps/index.js +139 -0
- package/es/switch/index.js +72 -0
- package/es/table/column-setting.js +179 -0
- package/es/table/index.js +506 -0
- package/es/table/utils.js +34 -0
- package/es/tabs/tab-panel.js +86 -0
- package/es/tabs/tabs.js +263 -0
- package/es/tag/index.js +74 -0
- package/es/time-line/timeline-item.js +133 -0
- package/es/time-line/timeline.js +55 -0
- package/es/tooltip/index.js +278 -0
- package/es/tour/index.js +379 -0
- package/es/transfer/index.js +511 -0
- package/es/tree/index.js +488 -0
- package/es/tree/utils.js +101 -0
- package/es/tree-select/index.js +938 -0
- package/es/typography/index.js +359 -0
- package/es/upload/file-list.js +143 -0
- package/es/upload/index.js +434 -0
- package/es/upload/picture-sort.js +142 -0
- package/es/upload/selector.js +207 -0
- package/es/utils/checked.js +24 -0
- package/es/utils/color.js +15 -0
- package/es/utils/number.js +74 -0
- package/es/utils/placement.js +151 -0
- package/es/utils/react-node.js +63 -0
- package/es/utils/share.js +12 -0
- package/es/utils/theme.js +57 -0
- package/es/utils/transition.js +58 -0
- package/es/utils/use-value.js +60 -0
- package/es/virtual-list/index.js +252 -0
- package/es/virtual-list/range.js +27 -0
- package/es/watermark/index.js +313 -0
- package/lib/index.cjs +9 -0
- package/lib/locale/de.cjs +9 -0
- package/lib/locale/el.cjs +9 -0
- package/lib/locale/en.cjs +9 -0
- package/lib/locale/fr.cjs +9 -0
- package/lib/locale/it.cjs +9 -0
- package/lib/locale/ja.cjs +9 -0
- package/lib/locale/ko.cjs +9 -0
- package/lib/locale/ru.cjs +9 -0
- package/lib/locale/th.cjs +9 -0
- package/lib/locale/uk.cjs +9 -0
- package/lib/locale/vi.cjs +9 -0
- package/lib/locale/zh-CN.cjs +9 -0
- package/lib/locale/zh-TW.cjs +9 -0
- package/package.json +175 -94
- package/readme.md +142 -82
- package/style/base.css +9 -0
- package/style/components.css +9 -0
- package/style/index.css +9 -0
- package/style/theme.css +9 -0
- package/types/affix/index.d.cts +9 -0
- package/types/affix/index.d.ts +9 -0
- package/types/alert/index.d.cts +18 -0
- package/types/alert/index.d.ts +18 -0
- package/types/anchor/anchor-context.d.cts +7 -0
- package/types/anchor/anchor-context.d.ts +7 -0
- package/types/anchor/anchor-link.d.cts +6 -0
- package/types/anchor/anchor-link.d.ts +6 -0
- package/types/anchor/anchor.d.cts +10 -0
- package/types/anchor/anchor.d.ts +10 -0
- package/types/anchor/index.d.cts +5 -0
- package/types/anchor/index.d.ts +5 -0
- package/types/auto-complete/index.d.cts +28 -0
- package/types/auto-complete/index.d.ts +28 -0
- package/types/avatar/avatar-group-context.d.cts +7 -0
- package/types/avatar/avatar-group-context.d.ts +7 -0
- package/types/avatar/avatar-group.d.cts +11 -0
- package/types/avatar/avatar-group.d.ts +11 -0
- package/types/avatar/avatar.d.cts +14 -0
- package/types/avatar/avatar.d.ts +14 -0
- package/types/avatar/index.d.cts +5 -0
- package/types/avatar/index.d.ts +5 -0
- package/types/back-top/index.d.cts +11 -0
- package/types/back-top/index.d.ts +11 -0
- package/types/badge/index.d.cts +15 -0
- package/types/badge/index.d.ts +15 -0
- package/types/base/teleport.d.cts +13 -0
- package/types/base/teleport.d.ts +13 -0
- package/types/base/transition-props.d.cts +4 -0
- package/types/base/transition-props.d.ts +4 -0
- package/types/base/transition.d.cts +27 -0
- package/types/base/transition.d.ts +27 -0
- package/types/breadcrumb/breadcrumb-context.d.cts +2 -0
- package/types/breadcrumb/breadcrumb-context.d.ts +2 -0
- package/types/breadcrumb/breadcrumb-item.d.cts +11 -0
- package/types/breadcrumb/breadcrumb-item.d.ts +11 -0
- package/types/breadcrumb/breadcrumb.d.cts +7 -0
- package/types/breadcrumb/breadcrumb.d.ts +7 -0
- package/types/breadcrumb/index.d.cts +5 -0
- package/types/breadcrumb/index.d.ts +5 -0
- package/types/button/button-group-context.d.cts +6 -0
- package/types/button/button-group-context.d.ts +6 -0
- package/types/button/button-group.d.cts +9 -0
- package/types/button/button-group.d.ts +9 -0
- package/types/button/button.d.cts +20 -0
- package/types/button/button.d.ts +20 -0
- package/types/button/index.d.cts +5 -0
- package/types/button/index.d.ts +5 -0
- package/types/calendar/index.d.cts +36 -0
- package/types/calendar/index.d.ts +36 -0
- package/types/card/index.d.cts +22 -0
- package/types/card/index.d.ts +22 -0
- package/types/carousel/carousel-context.d.cts +6 -0
- package/types/carousel/carousel-context.d.ts +6 -0
- package/types/carousel/carousel-item.d.cts +3 -0
- package/types/carousel/carousel-item.d.ts +3 -0
- package/types/carousel/carousel.d.cts +18 -0
- package/types/carousel/carousel.d.ts +18 -0
- package/types/carousel/index.d.cts +5 -0
- package/types/carousel/index.d.ts +5 -0
- package/types/cascader/index.d.cts +5 -0
- package/types/cascader/index.d.ts +5 -0
- package/types/cascader/types.d.cts +38 -0
- package/types/cascader/types.d.ts +38 -0
- package/types/check-card/check-card-group.d.cts +4 -0
- package/types/check-card/check-card-group.d.ts +4 -0
- package/types/check-card/check-card.d.cts +4 -0
- package/types/check-card/check-card.d.ts +4 -0
- package/types/check-card/context.d.cts +14 -0
- package/types/check-card/context.d.ts +14 -0
- package/types/check-card/index.d.cts +4 -0
- package/types/check-card/index.d.ts +4 -0
- package/types/check-card/types.d.cts +46 -0
- package/types/check-card/types.d.ts +46 -0
- package/types/checkbox/checkbox-group-context.d.cts +11 -0
- package/types/checkbox/checkbox-group-context.d.ts +11 -0
- package/types/checkbox/checkbox-group.d.cts +22 -0
- package/types/checkbox/checkbox-group.d.ts +22 -0
- package/types/checkbox/checkbox.d.cts +23 -0
- package/types/checkbox/checkbox.d.ts +23 -0
- package/types/checkbox/index.d.cts +6 -0
- package/types/checkbox/index.d.ts +6 -0
- package/types/collapse/collapse-panel.d.cts +12 -0
- package/types/collapse/collapse-panel.d.ts +12 -0
- package/types/collapse/collapse.d.cts +15 -0
- package/types/collapse/collapse.d.ts +15 -0
- package/types/collapse/index.d.cts +6 -0
- package/types/collapse/index.d.ts +6 -0
- package/types/color-picker/alpha.d.cts +6 -0
- package/types/color-picker/alpha.d.ts +6 -0
- package/types/color-picker/hue.d.cts +5 -0
- package/types/color-picker/hue.d.ts +5 -0
- package/types/color-picker/index.d.cts +30 -0
- package/types/color-picker/index.d.ts +30 -0
- package/types/color-picker/mode.d.cts +10 -0
- package/types/color-picker/mode.d.ts +10 -0
- package/types/color-picker/paint.d.cts +7 -0
- package/types/color-picker/paint.d.ts +7 -0
- package/types/color-picker/presets.d.cts +7 -0
- package/types/color-picker/presets.d.ts +7 -0
- package/types/components.d.cts +165 -0
- package/types/components.d.ts +165 -0
- package/types/config/config-context.d.cts +11 -0
- package/types/config/config-context.d.ts +11 -0
- package/types/config/context.d.cts +7 -0
- package/types/config/context.d.ts +7 -0
- package/types/config/index.d.cts +14 -0
- package/types/config/index.d.ts +14 -0
- package/types/config/size-context.d.cts +3 -0
- package/types/config/size-context.d.ts +3 -0
- package/types/config/use-config-appearance.d.cts +7 -0
- package/types/config/use-config-appearance.d.ts +7 -0
- package/types/const/types.d.cts +22 -0
- package/types/const/types.d.ts +22 -0
- package/types/const/var.d.cts +1 -0
- package/types/const/var.d.ts +1 -0
- package/types/date-picker/index.d.cts +54 -0
- package/types/date-picker/index.d.ts +54 -0
- package/types/descriptions/descriptions-item.d.cts +5 -0
- package/types/descriptions/descriptions-item.d.ts +5 -0
- package/types/descriptions/descriptions.d.cts +21 -0
- package/types/descriptions/descriptions.d.ts +21 -0
- package/types/descriptions/index.d.cts +4 -0
- package/types/descriptions/index.d.ts +4 -0
- package/types/directives/outsiteclick.d.cts +3 -0
- package/types/directives/outsiteclick.d.ts +3 -0
- package/types/directives/resize.d.cts +3 -0
- package/types/directives/resize.d.ts +3 -0
- package/types/directives/scroll.d.cts +3 -0
- package/types/directives/scroll.d.ts +3 -0
- package/types/directives/transfer.d.cts +2 -0
- package/types/directives/transfer.d.ts +2 -0
- package/types/divider/index.d.cts +14 -0
- package/types/divider/index.d.ts +14 -0
- package/types/drawer/index.d.cts +27 -0
- package/types/drawer/index.d.ts +27 -0
- package/types/dropdown/dropdown-button.d.cts +17 -0
- package/types/dropdown/dropdown-button.d.ts +17 -0
- package/types/dropdown/dropdown-context.d.cts +11 -0
- package/types/dropdown/dropdown-context.d.ts +11 -0
- package/types/dropdown/dropdown.d.cts +18 -0
- package/types/dropdown/dropdown.d.ts +18 -0
- package/types/dropdown/index.d.cts +4 -0
- package/types/dropdown/index.d.ts +4 -0
- package/types/dropdown/trigger.d.cts +9 -0
- package/types/dropdown/trigger.d.ts +9 -0
- package/types/empty/index.d.cts +9 -0
- package/types/empty/index.d.ts +9 -0
- package/types/feature-card/index.d.cts +20 -0
- package/types/feature-card/index.d.ts +20 -0
- package/types/feedback-panel/index.d.cts +15 -0
- package/types/feedback-panel/index.d.ts +15 -0
- package/types/flame-wrap/index.d.cts +3 -0
- package/types/flame-wrap/index.d.ts +3 -0
- package/types/flame-wrap/types.d.cts +71 -0
- package/types/flame-wrap/types.d.ts +71 -0
- package/types/flex/index.d.cts +15 -0
- package/types/flex/index.d.ts +15 -0
- package/types/form/field-context.d.cts +39 -0
- package/types/form/field-context.d.ts +39 -0
- package/types/form/form-context.d.cts +22 -0
- package/types/form/form-context.d.ts +22 -0
- package/types/form/form-item.d.cts +12 -0
- package/types/form/form-item.d.ts +12 -0
- package/types/form/form.d.cts +40 -0
- package/types/form/form.d.ts +40 -0
- package/types/form/index.d.cts +7 -0
- package/types/form/index.d.ts +7 -0
- package/types/form/types.d.cts +20 -0
- package/types/form/types.d.ts +20 -0
- package/types/form/utils.d.cts +6 -0
- package/types/form/utils.d.ts +6 -0
- package/types/grid/grid-item.d.cts +10 -0
- package/types/grid/grid-item.d.ts +10 -0
- package/types/grid/grid.d.cts +17 -0
- package/types/grid/grid.d.ts +17 -0
- package/types/grid/index.d.cts +6 -0
- package/types/grid/index.d.ts +6 -0
- package/types/grid/useBreakpoint.d.cts +11 -0
- package/types/grid/useBreakpoint.d.ts +11 -0
- package/types/icon/index.d.cts +15 -0
- package/types/icon/index.d.ts +15 -0
- package/types/image/group.d.cts +5 -0
- package/types/image/group.d.ts +5 -0
- package/types/image/image-group-context.d.cts +8 -0
- package/types/image/image-group-context.d.ts +8 -0
- package/types/image/image.d.cts +28 -0
- package/types/image/image.d.ts +28 -0
- package/types/image/index.d.cts +6 -0
- package/types/image/index.d.ts +6 -0
- package/types/image/instance.d.cts +5 -0
- package/types/image/instance.d.ts +5 -0
- package/types/image/preview.d.cts +19 -0
- package/types/image/preview.d.ts +19 -0
- package/types/image/utils.d.cts +6 -0
- package/types/image/utils.d.ts +6 -0
- package/types/index.d.cts +8 -0
- package/types/index.d.ts +8 -0
- package/types/input/index.d.cts +8 -0
- package/types/input/index.d.ts +8 -0
- package/types/input/input-box.d.cts +14 -0
- package/types/input/input-box.d.ts +14 -0
- package/types/input/input-group.d.cts +11 -0
- package/types/input/input-group.d.ts +11 -0
- package/types/input/input.d.cts +28 -0
- package/types/input/input.d.ts +28 -0
- package/types/input/textarea.d.cts +11 -0
- package/types/input/textarea.d.ts +11 -0
- package/types/input-number/index.d.cts +27 -0
- package/types/input-number/index.d.ts +27 -0
- package/types/input-otp/index.d.cts +27 -0
- package/types/input-otp/index.d.ts +27 -0
- package/types/input-tag/index.d.cts +23 -0
- package/types/input-tag/index.d.ts +23 -0
- package/types/kanban/index.d.cts +31 -0
- package/types/kanban/index.d.ts +31 -0
- package/types/layout/index.d.cts +29 -0
- package/types/layout/index.d.ts +29 -0
- package/types/layout/layout-context.d.cts +1 -0
- package/types/layout/layout-context.d.ts +1 -0
- package/types/list-panel/index.d.cts +16 -0
- package/types/list-panel/index.d.ts +16 -0
- package/types/loading/index.d.cts +10 -0
- package/types/loading/index.d.ts +10 -0
- package/types/loading/loading-bar.d.cts +12 -0
- package/types/loading/loading-bar.d.ts +12 -0
- package/types/locale/de.d.cts +65 -0
- package/types/locale/de.d.ts +65 -0
- package/types/locale/el.d.cts +65 -0
- package/types/locale/el.d.ts +65 -0
- package/types/locale/en.d.cts +65 -0
- package/types/locale/en.d.ts +65 -0
- package/types/locale/fr.d.cts +65 -0
- package/types/locale/fr.d.ts +65 -0
- package/types/locale/it.d.cts +65 -0
- package/types/locale/it.d.ts +65 -0
- package/types/locale/ja.d.cts +65 -0
- package/types/locale/ja.d.ts +65 -0
- package/types/locale/ko.d.cts +65 -0
- package/types/locale/ko.d.ts +65 -0
- package/types/locale/ru.d.cts +65 -0
- package/types/locale/ru.d.ts +65 -0
- package/types/locale/th.d.cts +65 -0
- package/types/locale/th.d.ts +65 -0
- package/types/locale/uk.d.cts +65 -0
- package/types/locale/uk.d.ts +65 -0
- package/types/locale/vi.d.cts +65 -0
- package/types/locale/vi.d.ts +65 -0
- package/types/locale/zh-CN.d.cts +65 -0
- package/types/locale/zh-CN.d.ts +65 -0
- package/types/locale/zh-TW.d.cts +65 -0
- package/types/locale/zh-TW.d.ts +65 -0
- package/types/mentions/index.d.cts +28 -0
- package/types/mentions/index.d.ts +28 -0
- package/types/menu/index.d.cts +7 -0
- package/types/menu/index.d.ts +7 -0
- package/types/menu/menu-context.d.cts +24 -0
- package/types/menu/menu-context.d.ts +24 -0
- package/types/menu/menu-divider.d.cts +3 -0
- package/types/menu/menu-divider.d.ts +3 -0
- package/types/menu/menu-group.d.cts +7 -0
- package/types/menu/menu-group.d.ts +7 -0
- package/types/menu/menu-item.d.cts +15 -0
- package/types/menu/menu-item.d.ts +15 -0
- package/types/menu/menu-keyboard.d.cts +7 -0
- package/types/menu/menu-keyboard.d.ts +7 -0
- package/types/menu/menu.d.cts +33 -0
- package/types/menu/menu.d.ts +33 -0
- package/types/menu/recursive-menu.d.cts +7 -0
- package/types/menu/recursive-menu.d.ts +7 -0
- package/types/menu/sub-menu.d.cts +12 -0
- package/types/menu/sub-menu.d.ts +12 -0
- package/types/message/index.d.cts +24 -0
- package/types/message/index.d.ts +24 -0
- package/types/modal/api.d.cts +26 -0
- package/types/modal/api.d.ts +26 -0
- package/types/modal/index.d.cts +4 -0
- package/types/modal/index.d.ts +4 -0
- package/types/modal/modal.d.cts +32 -0
- package/types/modal/modal.d.ts +32 -0
- package/types/modal/toast.d.cts +15 -0
- package/types/modal/toast.d.ts +15 -0
- package/types/notice/container.d.cts +9 -0
- package/types/notice/container.d.ts +9 -0
- package/types/notice/content.d.cts +22 -0
- package/types/notice/content.d.ts +22 -0
- package/types/notice/index.d.cts +24 -0
- package/types/notice/index.d.ts +24 -0
- package/types/notice/instance.d.cts +7 -0
- package/types/notice/instance.d.ts +7 -0
- package/types/page/index.d.cts +19 -0
- package/types/page/index.d.ts +19 -0
- package/types/page-header/index.d.cts +10 -0
- package/types/page-header/index.d.ts +10 -0
- package/types/popconfirm/index.d.cts +27 -0
- package/types/popconfirm/index.d.ts +27 -0
- package/types/poptip/index.d.cts +25 -0
- package/types/poptip/index.d.ts +25 -0
- package/types/progress/index.d.cts +21 -0
- package/types/progress/index.d.ts +21 -0
- package/types/qrcode/index.d.cts +28 -0
- package/types/qrcode/index.d.ts +28 -0
- package/types/radio/index.d.cts +7 -0
- package/types/radio/index.d.ts +7 -0
- package/types/radio/radio-button.d.cts +20 -0
- package/types/radio/radio-button.d.ts +20 -0
- package/types/radio/radio-group-context.d.cts +13 -0
- package/types/radio/radio-group-context.d.ts +13 -0
- package/types/radio/radio-group.d.cts +26 -0
- package/types/radio/radio-group.d.ts +26 -0
- package/types/radio/radio.d.cts +17 -0
- package/types/radio/radio.d.ts +17 -0
- package/types/radio/types.d.cts +5 -0
- package/types/radio/types.d.ts +5 -0
- package/types/rate/index.d.cts +22 -0
- package/types/rate/index.d.ts +22 -0
- package/types/rate/star.d.cts +19 -0
- package/types/rate/star.d.ts +19 -0
- package/types/result/index.d.cts +12 -0
- package/types/result/index.d.ts +12 -0
- package/types/ripple/index.d.cts +10 -0
- package/types/ripple/index.d.ts +10 -0
- package/types/ripple/types.d.cts +48 -0
- package/types/ripple/types.d.ts +48 -0
- package/types/row-col/col.d.cts +26 -0
- package/types/row-col/col.d.ts +26 -0
- package/types/row-col/index.d.cts +5 -0
- package/types/row-col/index.d.ts +5 -0
- package/types/row-col/row.d.cts +9 -0
- package/types/row-col/row.d.ts +9 -0
- package/types/segmented/index.d.cts +25 -0
- package/types/segmented/index.d.ts +25 -0
- package/types/select/index.d.cts +5 -0
- package/types/select/index.d.ts +5 -0
- package/types/select/option.d.cts +17 -0
- package/types/select/option.d.ts +17 -0
- package/types/select/select.d.cts +51 -0
- package/types/select/select.d.ts +51 -0
- package/types/skeleton/index.d.cts +11 -0
- package/types/skeleton/index.d.ts +11 -0
- package/types/skeleton/skeleton-avatar.d.cts +13 -0
- package/types/skeleton/skeleton-avatar.d.ts +13 -0
- package/types/skeleton/skeleton-button.d.cts +14 -0
- package/types/skeleton/skeleton-button.d.ts +14 -0
- package/types/skeleton/skeleton-image.d.cts +11 -0
- package/types/skeleton/skeleton-image.d.ts +11 -0
- package/types/skeleton/skeleton-text.d.cts +12 -0
- package/types/skeleton/skeleton-text.d.ts +12 -0
- package/types/skeleton/skeleton.d.cts +19 -0
- package/types/skeleton/skeleton.d.ts +19 -0
- package/types/skeleton/use-skeleton-loading.d.cts +1 -0
- package/types/skeleton/use-skeleton-loading.d.ts +1 -0
- package/types/slider/index.d.cts +21 -0
- package/types/slider/index.d.ts +21 -0
- package/types/slider/thumb.d.cts +17 -0
- package/types/slider/thumb.d.ts +17 -0
- package/types/space/index.d.cts +15 -0
- package/types/space/index.d.ts +15 -0
- package/types/spin/index.d.cts +11 -0
- package/types/spin/index.d.ts +11 -0
- package/types/splitter/index.d.cts +4 -0
- package/types/splitter/index.d.ts +4 -0
- package/types/splitter/splitter-panel.d.cts +7 -0
- package/types/splitter/splitter-panel.d.ts +7 -0
- package/types/splitter/splitter.d.cts +9 -0
- package/types/splitter/splitter.d.ts +9 -0
- package/types/stat-card/countup.d.cts +11 -0
- package/types/stat-card/countup.d.ts +11 -0
- package/types/stat-card/index.d.cts +5 -0
- package/types/stat-card/index.d.ts +5 -0
- package/types/stat-card/rollup.d.cts +7 -0
- package/types/stat-card/rollup.d.ts +7 -0
- package/types/stat-card/stat-card.d.cts +31 -0
- package/types/stat-card/stat-card.d.ts +31 -0
- package/types/stat-card/stat-number.d.cts +13 -0
- package/types/stat-card/stat-number.d.ts +13 -0
- package/types/stat-card/utils/countup.d.cts +128 -0
- package/types/stat-card/utils/countup.d.ts +128 -0
- package/types/stat-card/utils/odometer.d.cts +14 -0
- package/types/stat-card/utils/odometer.d.ts +14 -0
- package/types/steps/index.d.cts +20 -0
- package/types/steps/index.d.ts +20 -0
- package/types/switch/index.d.cts +21 -0
- package/types/switch/index.d.ts +21 -0
- package/types/table/column-setting.d.cts +28 -0
- package/types/table/column-setting.d.ts +28 -0
- package/types/table/index.d.cts +5 -0
- package/types/table/index.d.ts +5 -0
- package/types/table/types.d.cts +66 -0
- package/types/table/types.d.ts +66 -0
- package/types/table/utils.d.cts +14 -0
- package/types/table/utils.d.ts +14 -0
- package/types/tabs/index.d.cts +5 -0
- package/types/tabs/index.d.ts +5 -0
- package/types/tabs/tab-panel.d.cts +17 -0
- package/types/tabs/tab-panel.d.ts +17 -0
- package/types/tabs/tabs.d.cts +16 -0
- package/types/tabs/tabs.d.ts +16 -0
- package/types/tabs/types.d.cts +16 -0
- package/types/tabs/types.d.ts +16 -0
- package/types/tag/index.d.cts +16 -0
- package/types/tag/index.d.ts +16 -0
- package/types/time-line/index.d.cts +5 -0
- package/types/time-line/index.d.ts +5 -0
- package/types/time-line/timeline-item.d.cts +10 -0
- package/types/time-line/timeline-item.d.ts +10 -0
- package/types/time-line/timeline.d.cts +6 -0
- package/types/time-line/timeline.d.ts +6 -0
- package/types/tooltip/index.d.cts +23 -0
- package/types/tooltip/index.d.ts +23 -0
- package/types/tour/index.d.cts +22 -0
- package/types/tour/index.d.ts +22 -0
- package/types/transfer/index.d.cts +33 -0
- package/types/transfer/index.d.ts +33 -0
- package/types/tree/index.d.cts +51 -0
- package/types/tree/index.d.ts +51 -0
- package/types/tree/types.d.cts +27 -0
- package/types/tree/types.d.ts +27 -0
- package/types/tree/utils.d.cts +33 -0
- package/types/tree/utils.d.ts +33 -0
- package/types/tree-select/index.d.cts +60 -0
- package/types/tree-select/index.d.ts +60 -0
- package/types/typography/index.d.cts +40 -0
- package/types/typography/index.d.ts +40 -0
- package/types/upload/file-list.d.cts +19 -0
- package/types/upload/file-list.d.ts +19 -0
- package/types/upload/index.d.cts +90 -0
- package/types/upload/index.d.ts +90 -0
- package/types/upload/picture-sort.d.cts +2 -0
- package/types/upload/picture-sort.d.ts +2 -0
- package/types/upload/selector.d.cts +21 -0
- package/types/upload/selector.d.ts +21 -0
- package/types/utils/checked.d.cts +2 -0
- package/types/utils/checked.d.ts +2 -0
- package/types/utils/color.d.cts +1 -0
- package/types/utils/color.d.ts +1 -0
- package/types/utils/element.d.cts +2 -0
- package/types/utils/element.d.ts +2 -0
- package/types/utils/mouse.d.cts +1 -0
- package/types/utils/mouse.d.ts +1 -0
- package/types/utils/number.d.cts +6 -0
- package/types/utils/number.d.ts +6 -0
- package/types/utils/placement.d.cts +16 -0
- package/types/utils/placement.d.ts +16 -0
- package/types/utils/react-node.d.cts +5 -0
- package/types/utils/react-node.d.ts +5 -0
- package/types/utils/share.d.cts +12 -0
- package/types/utils/share.d.ts +12 -0
- package/types/utils/theme.d.cts +5 -0
- package/types/utils/theme.d.ts +5 -0
- package/types/utils/transition.d.cts +3 -0
- package/types/utils/transition.d.ts +3 -0
- package/types/utils/use-value.d.cts +2 -0
- package/types/utils/use-value.d.ts +2 -0
- package/types/virtual-list/index.d.cts +17 -0
- package/types/virtual-list/index.d.ts +17 -0
- package/types/virtual-list/range.d.cts +15 -0
- package/types/virtual-list/range.d.ts +15 -0
- package/types/watermark/index.d.cts +27 -0
- package/types/watermark/index.d.ts +27 -0
- package/dist/k-ui.css +0 -7
- package/dist/k-ui.js +0 -13
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ArrowDown, ArrowLeft, ArrowRight, ChevronLeft, ChevronRight, Image, Loading, Minus, Plus, RotateCcwSquare, RotateCwSquare, X } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
10
|
+
import Icon from "../icon/index.js";
|
|
11
|
+
import Button from "../button/button.js";
|
|
12
|
+
import { Transition } from "../base/transition.js";
|
|
13
|
+
import slider_default from "../slider/index.js";
|
|
14
|
+
import { loadImage } from "./utils.js";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
17
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
//#region components/image/preview.tsx
|
|
19
|
+
var ImagePreview = forwardRef(function ImagePreview(initial, ref) {
|
|
20
|
+
const [options, setOptions] = useState(initial);
|
|
21
|
+
const [visible, setVisible] = useState(true);
|
|
22
|
+
const [scale, setScale] = useState(1);
|
|
23
|
+
const [rotate, setRotate] = useState(0);
|
|
24
|
+
const [position, setPosition] = useState({
|
|
25
|
+
left: 0,
|
|
26
|
+
top: 0
|
|
27
|
+
});
|
|
28
|
+
const [dragging, setDragging] = useState(false);
|
|
29
|
+
const [loading, setLoading] = useState(false);
|
|
30
|
+
const [error, setError] = useState(false);
|
|
31
|
+
const [panelVisible, setPanelVisible] = useState(!!initial.showPanel);
|
|
32
|
+
const [panelRight, setPanelRight] = useState(0);
|
|
33
|
+
const dragRef = useRef({
|
|
34
|
+
x: 0,
|
|
35
|
+
y: 0
|
|
36
|
+
});
|
|
37
|
+
const imageRef = useRef(null);
|
|
38
|
+
const stopDragRef = useRef(() => {});
|
|
39
|
+
const visibleRef = useRef(true);
|
|
40
|
+
const optionsRef = useRef(options);
|
|
41
|
+
const panelRef = useRef(null);
|
|
42
|
+
const data = options.data ?? [];
|
|
43
|
+
const src = options.src ?? "";
|
|
44
|
+
const index = data.indexOf(src);
|
|
45
|
+
const setImageRef = useCallback((node) => {
|
|
46
|
+
imageRef.current = node;
|
|
47
|
+
}, []);
|
|
48
|
+
optionsRef.current = options;
|
|
49
|
+
visibleRef.current = visible;
|
|
50
|
+
const resetTransform = useCallback(() => {
|
|
51
|
+
setScale(1);
|
|
52
|
+
setRotate(0);
|
|
53
|
+
setPosition({
|
|
54
|
+
left: 0,
|
|
55
|
+
top: 0
|
|
56
|
+
});
|
|
57
|
+
setDragging(false);
|
|
58
|
+
}, []);
|
|
59
|
+
const constrainPosition = useCallback((current, nextScale = scale, nextRotate = rotate) => {
|
|
60
|
+
const image = imageRef.current;
|
|
61
|
+
if (!image || typeof window === "undefined") return current;
|
|
62
|
+
const vertical = Math.abs(nextRotate / 90) % 2 === 0;
|
|
63
|
+
const width = vertical ? image.offsetWidth : image.offsetHeight;
|
|
64
|
+
const height = vertical ? image.offsetHeight : image.offsetWidth;
|
|
65
|
+
const availableWidth = window.innerWidth - panelRight;
|
|
66
|
+
const maxLeft = Math.max(0, (width * nextScale - availableWidth) / 2);
|
|
67
|
+
const maxTop = Math.max(0, (height * nextScale - window.innerHeight) / 2);
|
|
68
|
+
return {
|
|
69
|
+
left: Math.max(-maxLeft, Math.min(maxLeft, current.left)),
|
|
70
|
+
top: Math.max(-maxTop, Math.min(maxTop, current.top))
|
|
71
|
+
};
|
|
72
|
+
}, [
|
|
73
|
+
panelRight,
|
|
74
|
+
rotate,
|
|
75
|
+
scale
|
|
76
|
+
]);
|
|
77
|
+
const changeScale = useCallback((nextScale_0) => {
|
|
78
|
+
const value = Math.max(1, Math.min(10, nextScale_0));
|
|
79
|
+
setScale(value);
|
|
80
|
+
setPosition((current_0) => constrainPosition(current_0, value, rotate));
|
|
81
|
+
}, [constrainPosition, rotate]);
|
|
82
|
+
const changeRotate = useCallback((offset) => {
|
|
83
|
+
const value_0 = rotate + offset;
|
|
84
|
+
setRotate(value_0);
|
|
85
|
+
setPosition((current_1) => constrainPosition(current_1, scale, value_0));
|
|
86
|
+
}, [
|
|
87
|
+
constrainPosition,
|
|
88
|
+
rotate,
|
|
89
|
+
scale
|
|
90
|
+
]);
|
|
91
|
+
const close = useCallback(() => {
|
|
92
|
+
if (!visibleRef.current) return;
|
|
93
|
+
visibleRef.current = false;
|
|
94
|
+
setVisible(false);
|
|
95
|
+
optionsRef.current.onClose?.();
|
|
96
|
+
}, []);
|
|
97
|
+
const togglePanel = () => setPanelVisible((value_1) => !value_1);
|
|
98
|
+
useImperativeHandle(ref, () => ({
|
|
99
|
+
show(props) {
|
|
100
|
+
resetTransform();
|
|
101
|
+
setOptions((current_2) => ({
|
|
102
|
+
...current_2,
|
|
103
|
+
...props
|
|
104
|
+
}));
|
|
105
|
+
setPanelVisible(!!props.showPanel);
|
|
106
|
+
visibleRef.current = true;
|
|
107
|
+
setVisible(true);
|
|
108
|
+
},
|
|
109
|
+
close,
|
|
110
|
+
togglePanel
|
|
111
|
+
}), [close, resetTransform]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
setError(false);
|
|
114
|
+
if (!src || options.type === "media") {
|
|
115
|
+
setLoading(false);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
setLoading(true);
|
|
119
|
+
return loadImage(src, () => {
|
|
120
|
+
setLoading(false);
|
|
121
|
+
setError(false);
|
|
122
|
+
}, () => {
|
|
123
|
+
setLoading(false);
|
|
124
|
+
setError(true);
|
|
125
|
+
});
|
|
126
|
+
}, [options.type, src]);
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
const keydown = (event) => {
|
|
129
|
+
if (event.key === "Escape" && visibleRef.current) close();
|
|
130
|
+
};
|
|
131
|
+
const wheel = (event_0) => {
|
|
132
|
+
if (!visibleRef.current) return;
|
|
133
|
+
event_0.preventDefault();
|
|
134
|
+
changeScale(scale + (event_0.deltaY < 0 ? 1 : -1));
|
|
135
|
+
};
|
|
136
|
+
document.addEventListener("keydown", keydown);
|
|
137
|
+
document.addEventListener("wheel", wheel, { passive: false });
|
|
138
|
+
return () => {
|
|
139
|
+
document.removeEventListener("keydown", keydown);
|
|
140
|
+
document.removeEventListener("wheel", wheel);
|
|
141
|
+
};
|
|
142
|
+
}, [
|
|
143
|
+
changeScale,
|
|
144
|
+
close,
|
|
145
|
+
scale
|
|
146
|
+
]);
|
|
147
|
+
useLayoutEffect(() => {
|
|
148
|
+
if (!panelVisible || !options.panel || !panelRef.current) {
|
|
149
|
+
setPanelRight(0);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const panel = panelRef.current;
|
|
153
|
+
const update = () => setPanelRight(panel.offsetWidth);
|
|
154
|
+
update();
|
|
155
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
|
|
156
|
+
observer?.observe(panel);
|
|
157
|
+
return () => observer?.disconnect();
|
|
158
|
+
}, [options.panel, panelVisible]);
|
|
159
|
+
useEffect(() => () => stopDragRef.current(), []);
|
|
160
|
+
const switchImage = (offset_0) => {
|
|
161
|
+
const next = Math.max(0, Math.min(data.length - 1, index + offset_0));
|
|
162
|
+
if (next === index || next < 0) return;
|
|
163
|
+
setOptions((current_3) => ({
|
|
164
|
+
...current_3,
|
|
165
|
+
src: data[next]
|
|
166
|
+
}));
|
|
167
|
+
resetTransform();
|
|
168
|
+
options.onSwitch?.(next);
|
|
169
|
+
};
|
|
170
|
+
const startDrag = (event_1) => {
|
|
171
|
+
if ("button" in event_1 && event_1.button !== 0) return;
|
|
172
|
+
event_1.preventDefault();
|
|
173
|
+
stopDragRef.current();
|
|
174
|
+
setDragging(true);
|
|
175
|
+
const touch = "touches" in event_1;
|
|
176
|
+
const point = touch ? event_1.touches[0] : event_1;
|
|
177
|
+
dragRef.current = {
|
|
178
|
+
x: point.clientX,
|
|
179
|
+
y: point.clientY
|
|
180
|
+
};
|
|
181
|
+
const move = (moveEvent) => {
|
|
182
|
+
moveEvent.preventDefault();
|
|
183
|
+
const nextPoint = "touches" in moveEvent ? moveEvent.touches[0] : moveEvent;
|
|
184
|
+
if (!nextPoint) return;
|
|
185
|
+
const deltaX = nextPoint.clientX - dragRef.current.x;
|
|
186
|
+
const deltaY = nextPoint.clientY - dragRef.current.y;
|
|
187
|
+
dragRef.current = {
|
|
188
|
+
x: nextPoint.clientX,
|
|
189
|
+
y: nextPoint.clientY
|
|
190
|
+
};
|
|
191
|
+
setPosition((current_4) => ({
|
|
192
|
+
left: current_4.left + deltaX,
|
|
193
|
+
top: current_4.top + deltaY
|
|
194
|
+
}));
|
|
195
|
+
};
|
|
196
|
+
const up = () => {
|
|
197
|
+
setDragging(false);
|
|
198
|
+
setPosition((current_5) => constrainPosition(current_5));
|
|
199
|
+
stopDragRef.current();
|
|
200
|
+
};
|
|
201
|
+
const stop = () => {
|
|
202
|
+
document.removeEventListener("mousemove", move);
|
|
203
|
+
document.removeEventListener("mouseup", up);
|
|
204
|
+
document.removeEventListener("touchmove", move);
|
|
205
|
+
document.removeEventListener("touchend", up);
|
|
206
|
+
document.removeEventListener("touchcancel", up);
|
|
207
|
+
stopDragRef.current = () => {};
|
|
208
|
+
};
|
|
209
|
+
stopDragRef.current = stop;
|
|
210
|
+
if (touch) {
|
|
211
|
+
document.addEventListener("touchmove", move, { passive: false });
|
|
212
|
+
document.addEventListener("touchend", up);
|
|
213
|
+
document.addEventListener("touchcancel", up);
|
|
214
|
+
} else {
|
|
215
|
+
document.addEventListener("mousemove", move, { passive: false });
|
|
216
|
+
document.addEventListener("mouseup", up);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const download = async () => {
|
|
220
|
+
if (!src || error) return;
|
|
221
|
+
try {
|
|
222
|
+
const response = await fetch(src);
|
|
223
|
+
if (!response.ok) return;
|
|
224
|
+
const url = URL.createObjectURL(await response.blob());
|
|
225
|
+
const anchor = document.createElement("a");
|
|
226
|
+
anchor.href = url;
|
|
227
|
+
anchor.download = "";
|
|
228
|
+
anchor.click();
|
|
229
|
+
URL.revokeObjectURL(url);
|
|
230
|
+
} catch {}
|
|
231
|
+
};
|
|
232
|
+
return /* @__PURE__ */ jsx("div", {
|
|
233
|
+
className: "k-image-preview-root",
|
|
234
|
+
children: /* @__PURE__ */ jsx(Transition, {
|
|
235
|
+
show: visible,
|
|
236
|
+
name: "k-image-fade",
|
|
237
|
+
appear: true,
|
|
238
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
239
|
+
className: "k-image-preview",
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ jsx("div", {
|
|
242
|
+
className: "k-image-preview-mask",
|
|
243
|
+
onClick: close
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ jsxs("div", {
|
|
246
|
+
className: "k-image-preview-wrap",
|
|
247
|
+
style: { right: panelRight },
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ jsxs("ul", {
|
|
250
|
+
className: "k-image-preview-control",
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ jsxs("li", {
|
|
253
|
+
className: "k-image-preview-action-nav",
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx(Button, {
|
|
256
|
+
icon: ChevronLeft,
|
|
257
|
+
type: "text",
|
|
258
|
+
disabled: index <= 0,
|
|
259
|
+
onClick: () => switchImage(-1)
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
262
|
+
index + 1 || 1,
|
|
263
|
+
"/",
|
|
264
|
+
data.length || 1
|
|
265
|
+
] }),
|
|
266
|
+
/* @__PURE__ */ jsx(Button, {
|
|
267
|
+
icon: ChevronRight,
|
|
268
|
+
type: "text",
|
|
269
|
+
disabled: index < 0 || index >= data.length - 1,
|
|
270
|
+
onClick: () => switchImage(1)
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsx("li", {
|
|
275
|
+
className: "k-image-preview-action",
|
|
276
|
+
onClick: () => changeRotate(-90),
|
|
277
|
+
children: /* @__PURE__ */ jsx(Icon, { type: RotateCcwSquare })
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx("li", {
|
|
280
|
+
className: "k-image-preview-action",
|
|
281
|
+
onClick: () => changeRotate(90),
|
|
282
|
+
children: /* @__PURE__ */ jsx(Icon, { type: RotateCwSquare })
|
|
283
|
+
}),
|
|
284
|
+
/* @__PURE__ */ jsx("li", {
|
|
285
|
+
className: clsx("k-image-preview-action", { "k-image-preview-action-disabled": scale <= 1 }),
|
|
286
|
+
onClick: () => changeScale(scale - 1),
|
|
287
|
+
children: /* @__PURE__ */ jsx(Icon, { type: Minus })
|
|
288
|
+
}),
|
|
289
|
+
/* @__PURE__ */ jsx("li", {
|
|
290
|
+
className: "k-image-preview-action k-image-preview-action-scale",
|
|
291
|
+
children: /* @__PURE__ */ jsx(slider_default, {
|
|
292
|
+
value: scale,
|
|
293
|
+
min: 1,
|
|
294
|
+
max: 10,
|
|
295
|
+
size: "small",
|
|
296
|
+
tooltipVisible: false,
|
|
297
|
+
onChange: (value_2) => changeScale(value_2)
|
|
298
|
+
})
|
|
299
|
+
}),
|
|
300
|
+
/* @__PURE__ */ jsx("li", {
|
|
301
|
+
className: clsx("k-image-preview-action", { "k-image-preview-action-disabled": scale >= 10 }),
|
|
302
|
+
onClick: () => changeScale(scale + 1),
|
|
303
|
+
children: /* @__PURE__ */ jsx(Icon, { type: Plus })
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ jsx("li", {
|
|
306
|
+
className: "k-image-preview-action",
|
|
307
|
+
onClick: download,
|
|
308
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ArrowDown })
|
|
309
|
+
}),
|
|
310
|
+
options.tools && /* @__PURE__ */ jsx("li", {
|
|
311
|
+
className: "k-image-preview-action",
|
|
312
|
+
children: options.tools
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ jsx("li", { className: "k-image-preview-action-divider" }),
|
|
315
|
+
/* @__PURE__ */ jsx("li", {
|
|
316
|
+
className: "k-image-preview-action",
|
|
317
|
+
onClick: close,
|
|
318
|
+
children: /* @__PURE__ */ jsx(Icon, { type: X })
|
|
319
|
+
})
|
|
320
|
+
]
|
|
321
|
+
}),
|
|
322
|
+
/* @__PURE__ */ jsx("div", {
|
|
323
|
+
className: "k-image-preview-img-wrap",
|
|
324
|
+
style: {
|
|
325
|
+
transform: `translate3d(${position.left}px, ${position.top}px, 0)`,
|
|
326
|
+
transition: dragging ? "none" : void 0
|
|
327
|
+
},
|
|
328
|
+
children: options.type === "media" ? /* @__PURE__ */ jsx("video", {
|
|
329
|
+
ref: setImageRef,
|
|
330
|
+
draggable: false,
|
|
331
|
+
controls: true,
|
|
332
|
+
className: "k-image-preview-img",
|
|
333
|
+
src,
|
|
334
|
+
style: { transform: `scale3d(${scale},${scale},1) rotate(${rotate}deg)` },
|
|
335
|
+
onMouseDown: startDrag,
|
|
336
|
+
onTouchStart: startDrag
|
|
337
|
+
}) : error ? /* @__PURE__ */ jsx("div", {
|
|
338
|
+
className: "k-image-preview-img-error",
|
|
339
|
+
children: /* @__PURE__ */ jsx(Icon, { type: Image })
|
|
340
|
+
}) : !loading && /* @__PURE__ */ jsx("img", {
|
|
341
|
+
ref: setImageRef,
|
|
342
|
+
draggable: false,
|
|
343
|
+
className: "k-image-preview-img",
|
|
344
|
+
src,
|
|
345
|
+
style: { transform: `scale3d(${scale},${scale},1) rotate(${rotate}deg)` },
|
|
346
|
+
onMouseDown: startDrag,
|
|
347
|
+
onTouchStart: startDrag
|
|
348
|
+
})
|
|
349
|
+
}),
|
|
350
|
+
data.length > 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
351
|
+
className: clsx("k-image-preview-switch-left", { "k-image-preview-switch-disabled": index <= 0 }),
|
|
352
|
+
onClick: () => switchImage(-1),
|
|
353
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ArrowLeft })
|
|
354
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
355
|
+
className: clsx("k-image-preview-switch-right", { "k-image-preview-switch-disabled": index >= data.length - 1 }),
|
|
356
|
+
onClick: () => switchImage(1),
|
|
357
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ArrowRight })
|
|
358
|
+
})] }),
|
|
359
|
+
loading && /* @__PURE__ */ jsx("div", {
|
|
360
|
+
className: "k-image-preview-loading",
|
|
361
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
362
|
+
type: Loading,
|
|
363
|
+
spin: true
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
}),
|
|
368
|
+
options.panel && /* @__PURE__ */ jsxs("div", {
|
|
369
|
+
ref: panelRef,
|
|
370
|
+
className: clsx("k-image-preview-panel", { "k-image-preview-panel-hidden": !panelVisible }),
|
|
371
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
372
|
+
className: "k-image-preview-panel-action",
|
|
373
|
+
onClick: togglePanel,
|
|
374
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ChevronRight })
|
|
375
|
+
}), options.panel]
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
})
|
|
379
|
+
})
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
//#endregion
|
|
383
|
+
export { ImagePreview as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
//#region components/image/utils.ts
|
|
10
|
+
var loadImage = (src, callback, err) => {
|
|
11
|
+
if (!src) return () => {};
|
|
12
|
+
let image = new Image();
|
|
13
|
+
let isCompleted = false;
|
|
14
|
+
const cleanup = () => {
|
|
15
|
+
if (isCompleted || !image) return;
|
|
16
|
+
isCompleted = true;
|
|
17
|
+
image.onload = null;
|
|
18
|
+
image.onerror = null;
|
|
19
|
+
image = null;
|
|
20
|
+
};
|
|
21
|
+
image.onload = () => {
|
|
22
|
+
if (!isCompleted && image) {
|
|
23
|
+
const { naturalWidth: width, naturalHeight: height } = image;
|
|
24
|
+
callback?.({
|
|
25
|
+
width,
|
|
26
|
+
height
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
cleanup();
|
|
30
|
+
};
|
|
31
|
+
image.onerror = () => {
|
|
32
|
+
if (!isCompleted) err?.();
|
|
33
|
+
cleanup();
|
|
34
|
+
};
|
|
35
|
+
image.src = src;
|
|
36
|
+
return cleanup;
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { loadImage };
|
package/es/index.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Affix from "./affix/index.js";
|
|
10
|
+
import Icon from "./icon/index.js";
|
|
11
|
+
import Alert from "./alert/index.js";
|
|
12
|
+
import Button from "./button/button.js";
|
|
13
|
+
import ButtonGroup from "./button/button-group.js";
|
|
14
|
+
import Calendar from "./calendar/index.js";
|
|
15
|
+
import Empty from "./empty/index.js";
|
|
16
|
+
import Kanban from "./kanban/index.js";
|
|
17
|
+
import Avatar from "./avatar/avatar.js";
|
|
18
|
+
import AvatarGroup from "./avatar/avatar-group.js";
|
|
19
|
+
import Card, { CardMeta } from "./card/index.js";
|
|
20
|
+
import ListPanel from "./list-panel/index.js";
|
|
21
|
+
import InputGroup from "./input/input-group.js";
|
|
22
|
+
import input_default from "./input/input.js";
|
|
23
|
+
import textarea_default from "./input/textarea.js";
|
|
24
|
+
import auto_complete_default from "./auto-complete/index.js";
|
|
25
|
+
import Anchor from "./anchor/anchor.js";
|
|
26
|
+
import AnchorLink from "./anchor/anchor-link.js";
|
|
27
|
+
import Breadcrumb from "./breadcrumb/breadcrumb.js";
|
|
28
|
+
import BreadcrumbItem from "./breadcrumb/breadcrumb-item.js";
|
|
29
|
+
import BackTop from "./back-top/index.js";
|
|
30
|
+
import Badge from "./badge/index.js";
|
|
31
|
+
import Carousel from "./carousel/carousel.js";
|
|
32
|
+
import CarouselItem from "./carousel/carousel-item.js";
|
|
33
|
+
import checkbox_default from "./checkbox/checkbox.js";
|
|
34
|
+
import checkbox_group_default from "./checkbox/checkbox-group.js";
|
|
35
|
+
import check_card_default from "./check-card/check-card.js";
|
|
36
|
+
import check_card_group_default from "./check-card/check-card-group.js";
|
|
37
|
+
import Collapse from "./collapse/collapse.js";
|
|
38
|
+
import CollapsePanel from "./collapse/collapse-panel.js";
|
|
39
|
+
import input_number_default from "./input-number/index.js";
|
|
40
|
+
import Option from "./select/option.js";
|
|
41
|
+
import Space from "./space/index.js";
|
|
42
|
+
import Tag from "./tag/index.js";
|
|
43
|
+
import Tooltip, { TooltipPanel } from "./tooltip/index.js";
|
|
44
|
+
import { getVirtualRange } from "./virtual-list/range.js";
|
|
45
|
+
import VirtualList from "./virtual-list/index.js";
|
|
46
|
+
import select_default from "./select/select.js";
|
|
47
|
+
import color_picker_default, { ColorPickerPanel } from "./color-picker/index.js";
|
|
48
|
+
import date_picker_default, { DatePickerPanel } from "./date-picker/index.js";
|
|
49
|
+
import Descriptions from "./descriptions/descriptions.js";
|
|
50
|
+
import DescriptionsItem from "./descriptions/descriptions-item.js";
|
|
51
|
+
import Drawer from "./drawer/index.js";
|
|
52
|
+
import Dropdown from "./dropdown/dropdown.js";
|
|
53
|
+
import DropdownButton from "./dropdown/dropdown-button.js";
|
|
54
|
+
import Divider from "./divider/index.js";
|
|
55
|
+
import Form from "./form/form.js";
|
|
56
|
+
import Col from "./row-col/col.js";
|
|
57
|
+
import Row from "./row-col/row.js";
|
|
58
|
+
import FormItem from "./form/form-item.js";
|
|
59
|
+
import Flex from "./flex/index.js";
|
|
60
|
+
import FeatureCard from "./feature-card/index.js";
|
|
61
|
+
import { FlameWrap } from "./flame-wrap/index.js";
|
|
62
|
+
import FeedbackPanel from "./feedback-panel/index.js";
|
|
63
|
+
import Grid from "./grid/grid.js";
|
|
64
|
+
import GridItem from "./grid/grid-item.js";
|
|
65
|
+
import slider_default from "./slider/index.js";
|
|
66
|
+
import ImageGroup from "./image/group.js";
|
|
67
|
+
import KImage from "./image/image.js";
|
|
68
|
+
import input_tag_default from "./input-tag/index.js";
|
|
69
|
+
import input_otp_default from "./input-otp/index.js";
|
|
70
|
+
import { Content, Footer, Header, Layout, Sider } from "./layout/index.js";
|
|
71
|
+
import loading from "./loading/index.js";
|
|
72
|
+
import { MenuItem } from "./menu/menu-item.js";
|
|
73
|
+
import { SubMenu } from "./menu/sub-menu.js";
|
|
74
|
+
import { Menu } from "./menu/menu.js";
|
|
75
|
+
import { MenuDivider } from "./menu/menu-divider.js";
|
|
76
|
+
import { MenuGroup } from "./menu/menu-group.js";
|
|
77
|
+
import { MessagePanel, NoticePanel } from "./notice/content.js";
|
|
78
|
+
import message from "./message/index.js";
|
|
79
|
+
import mentions_default from "./mentions/index.js";
|
|
80
|
+
import Modal, { ModalPanel } from "./modal/modal.js";
|
|
81
|
+
import { modal } from "./modal/api.js";
|
|
82
|
+
import notice from "./notice/index.js";
|
|
83
|
+
import Page from "./page/index.js";
|
|
84
|
+
import PageHeader from "./page-header/index.js";
|
|
85
|
+
import Poptip, { PoptipPanel } from "./poptip/index.js";
|
|
86
|
+
import Popconfirm, { PopconfirmPanel } from "./popconfirm/index.js";
|
|
87
|
+
import Progress from "./progress/index.js";
|
|
88
|
+
import { Ripple } from "./ripple/index.js";
|
|
89
|
+
import Spin from "./spin/index.js";
|
|
90
|
+
import QRCode from "./qrcode/index.js";
|
|
91
|
+
import radio_default from "./radio/radio.js";
|
|
92
|
+
import radio_button_default from "./radio/radio-button.js";
|
|
93
|
+
import radio_group_default from "./radio/radio-group.js";
|
|
94
|
+
import segmented_default from "./segmented/index.js";
|
|
95
|
+
import rate_default from "./rate/index.js";
|
|
96
|
+
import Result from "./result/index.js";
|
|
97
|
+
import ConfigProvider from "./config/index.js";
|
|
98
|
+
import Skeleton from "./skeleton/skeleton.js";
|
|
99
|
+
import SkeletonAvatar from "./skeleton/skeleton-avatar.js";
|
|
100
|
+
import SkeletonButton from "./skeleton/skeleton-button.js";
|
|
101
|
+
import SkeletonImage from "./skeleton/skeleton-image.js";
|
|
102
|
+
import SkeletonText from "./skeleton/skeleton-text.js";
|
|
103
|
+
import StatNumber from "./stat-card/stat-number.js";
|
|
104
|
+
import StatCard from "./stat-card/stat-card.js";
|
|
105
|
+
import Steps, { Step } from "./steps/index.js";
|
|
106
|
+
import switch_default from "./switch/index.js";
|
|
107
|
+
import { Splitter } from "./splitter/splitter.js";
|
|
108
|
+
import { SplitterPanel } from "./splitter/splitter-panel.js";
|
|
109
|
+
import { TableColumnSetting } from "./table/column-setting.js";
|
|
110
|
+
import Table from "./table/index.js";
|
|
111
|
+
import Tour from "./tour/index.js";
|
|
112
|
+
import TabPanel from "./tabs/tab-panel.js";
|
|
113
|
+
import Tabs from "./tabs/tabs.js";
|
|
114
|
+
import TimeLine from "./time-line/timeline.js";
|
|
115
|
+
import TimeLineItem from "./time-line/timeline-item.js";
|
|
116
|
+
import Tree from "./tree/index.js";
|
|
117
|
+
import tree_select_default from "./tree-select/index.js";
|
|
118
|
+
import cascader_default from "./cascader/index.js";
|
|
119
|
+
import upload_default from "./upload/index.js";
|
|
120
|
+
import Watermark from "./watermark/index.js";
|
|
121
|
+
import Theme from "./utils/theme.js";
|
|
122
|
+
import transfer_default from "./transfer/index.js";
|
|
123
|
+
import Typography, { TypographyParagraph, TypographyText, TypographyTitle } from "./typography/index.js";
|
|
124
|
+
import { components_exports } from "./components.js";
|
|
125
|
+
//#region components/index.ts
|
|
126
|
+
var version = void 0;
|
|
127
|
+
var components_default = { version: void 0 };
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Affix, Alert, Anchor, AnchorLink, auto_complete_default as AutoComplete, Avatar, AvatarGroup, BackTop, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonGroup, Calendar, Card, CardMeta, Carousel, CarouselItem, cascader_default as Cascader, check_card_default as CheckCard, check_card_group_default as CheckCardGroup, checkbox_default as Checkbox, checkbox_group_default as CheckboxGroup, Col, Collapse, CollapsePanel, color_picker_default as ColorPicker, ColorPickerPanel, ConfigProvider, Content, date_picker_default as DatePicker, DatePickerPanel, Descriptions, DescriptionsItem, Divider, Drawer, Dropdown, DropdownButton, Empty, FeatureCard, FeedbackPanel, FlameWrap, Flex, Footer, Form, FormItem, Grid, GridItem, Header, Icon, ImageGroup, input_default as Input, InputGroup, input_number_default as InputNumber, input_otp_default as InputOTP, input_tag_default as InputTag, KImage, Kanban, Layout, ListPanel, mentions_default as Mentions, Menu, MenuDivider, MenuGroup, MenuItem, MessagePanel, Modal, ModalPanel, NoticePanel, Option, Page, PageHeader, Popconfirm, PopconfirmPanel, Poptip, PoptipPanel, Progress, QRCode, radio_default as Radio, radio_button_default as RadioButton, radio_group_default as RadioGroup, rate_default as Rate, Result, Ripple, Row, segmented_default as Segmented, select_default as Select, Sider, Skeleton, SkeletonAvatar, SkeletonButton, SkeletonImage, SkeletonText, slider_default as Slider, Space, Spin, Splitter, SplitterPanel, StatCard, StatNumber, Step, Steps, SubMenu, switch_default as Switch, TabPanel, Table, TableColumnSetting, Tabs, Tag, textarea_default as TextArea, TimeLine, TimeLineItem, Tooltip, TooltipPanel, Tour, transfer_default as Transfer, Tree, tree_select_default as TreeSelect, Typography, TypographyParagraph, TypographyText, TypographyTitle, upload_default as Upload, VirtualList, Watermark, components_exports as components, components_default as default, getVirtualRange, loading, message, modal, notice, Theme as theme, version };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import InputGroup from "./input-group.js";
|
|
10
|
+
import input_default$1 from "./input.js";
|
|
11
|
+
import textarea_default from "./textarea.js";
|
|
12
|
+
//#region components/input/index.ts
|
|
13
|
+
var input_default = input_default$1;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { input_default$1 as Input, InputGroup, textarea_default as TextArea, input_default as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import "react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
//#region components/input/input-box.tsx
|
|
13
|
+
var InputBox = ({ multiple, disabled, size, type, theme, shape, inputType, value, showPassword, inputRef, className = "", onFocus, onBlur, onInput, ...rest }) => {
|
|
14
|
+
let currentType = type;
|
|
15
|
+
if (showPassword === true && currentType === "password") currentType = "text";
|
|
16
|
+
const classes = clsx({
|
|
17
|
+
[`k-${inputType}`]: !multiple,
|
|
18
|
+
[`k-${inputType}-text`]: multiple,
|
|
19
|
+
[`k-${inputType}-disabled`]: disabled,
|
|
20
|
+
[`k-${inputType}-sm`]: size === "small" && !multiple,
|
|
21
|
+
[`k-${inputType}-lg`]: size === "large" && !multiple,
|
|
22
|
+
[`k-${inputType}-${theme}`]: theme !== "solid" && !multiple && theme,
|
|
23
|
+
[`k-${inputType}-circle`]: shape === "circle" && !multiple,
|
|
24
|
+
[`k-${inputType}-square`]: shape === "square" && !multiple
|
|
25
|
+
}, className);
|
|
26
|
+
return /* @__PURE__ */ jsx("input", {
|
|
27
|
+
ref: inputRef,
|
|
28
|
+
className: classes,
|
|
29
|
+
"data-single": "",
|
|
30
|
+
disabled,
|
|
31
|
+
type: currentType,
|
|
32
|
+
value: value ?? "",
|
|
33
|
+
onFocus,
|
|
34
|
+
onBlur,
|
|
35
|
+
onInput,
|
|
36
|
+
...rest
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { InputBox as default };
|