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,589 @@
|
|
|
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 zh_CN_default from "../locale/zh-CN.js";
|
|
10
|
+
import { ConfigContext } from "../config/config-context.js";
|
|
11
|
+
import { X } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
12
|
+
import Button from "../button/button.js";
|
|
13
|
+
import Teleport from "../base/teleport.js";
|
|
14
|
+
import { Transition } from "../base/transition.js";
|
|
15
|
+
import { getMousePoint } from "../config/context.js";
|
|
16
|
+
import { c } from "react/compiler-runtime";
|
|
17
|
+
import clsx from "clsx";
|
|
18
|
+
import { useContext, useEffect, useRef, useState } from "react";
|
|
19
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
//#region components/modal/modal.tsx
|
|
21
|
+
var Modal = (t0) => {
|
|
22
|
+
const $ = c(117);
|
|
23
|
+
const { className, open, defaultOpen: t1, title, okText, cancelText, width: t2, top: t3, mask: t4, maskClosable: t5, maximized: t6, centered: t7, draggable: t8, showClose: t9, loading: t10, footer: t11, escKey: t12, panelOnly: t13, onClose, onOk, onCancel, onOpenChange, onAfterClose, content, children } = t0;
|
|
24
|
+
const defaultOpen = t1 === void 0 ? false : t1;
|
|
25
|
+
const width = t2 === void 0 ? 520 : t2;
|
|
26
|
+
const top = t3 === void 0 ? 100 : t3;
|
|
27
|
+
const mask = t4 === void 0 ? true : t4;
|
|
28
|
+
const maskClosable = t5 === void 0 ? false : t5;
|
|
29
|
+
const maximized = t6 === void 0 ? false : t6;
|
|
30
|
+
const centered = t7 === void 0 ? false : t7;
|
|
31
|
+
const draggable = t8 === void 0 ? false : t8;
|
|
32
|
+
const showClose = t9 === void 0 ? true : t9;
|
|
33
|
+
const loading = t10 === void 0 ? false : t10;
|
|
34
|
+
const footer = t11 === void 0 ? true : t11;
|
|
35
|
+
const escKey = t12 === void 0 ? true : t12;
|
|
36
|
+
const panelOnly = t13 === void 0 ? false : t13;
|
|
37
|
+
const locale = useContext(ConfigContext)?.locale || zh_CN_default;
|
|
38
|
+
const [innerOpen, setInnerOpen] = useState(defaultOpen);
|
|
39
|
+
const currentOpen = open ?? innerOpen;
|
|
40
|
+
const [visible, setVisible] = useState(false);
|
|
41
|
+
const [showInner, setShowInner] = useState(false);
|
|
42
|
+
const [rendered, setRendered] = useState(false);
|
|
43
|
+
const [leftPos, setLeftPos] = useState(0);
|
|
44
|
+
const [topPos, setTopPos] = useState(top);
|
|
45
|
+
const [isMousePressed, setIsMousePressed] = useState(false);
|
|
46
|
+
const [mousedownIn, setMousedownIn] = useState(false);
|
|
47
|
+
let t14;
|
|
48
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
49
|
+
t14 = {
|
|
50
|
+
x: 0,
|
|
51
|
+
y: 0
|
|
52
|
+
};
|
|
53
|
+
$[0] = t14;
|
|
54
|
+
} else t14 = $[0];
|
|
55
|
+
const startPos = useRef(t14);
|
|
56
|
+
const refModal = useRef(null);
|
|
57
|
+
const refWrap = useRef(null);
|
|
58
|
+
const refHeader = useRef(null);
|
|
59
|
+
const previousActiveRef = useRef(null);
|
|
60
|
+
const hideTimerRef = useRef(null);
|
|
61
|
+
const getOffset = _temp;
|
|
62
|
+
let t15;
|
|
63
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t15 = () => {
|
|
65
|
+
if (refModal.current) {
|
|
66
|
+
const { x, y } = getMousePoint();
|
|
67
|
+
const p = getOffset(refModal.current);
|
|
68
|
+
refModal.current.style.transformOrigin = `${x - p.left}px ${y - p.top}px`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
$[1] = t15;
|
|
72
|
+
} else t15 = $[1];
|
|
73
|
+
const updateOrigin = t15;
|
|
74
|
+
let t16;
|
|
75
|
+
if ($[2] !== draggable || $[3] !== rendered || $[4] !== top) {
|
|
76
|
+
t16 = (value) => {
|
|
77
|
+
if (!rendered && value) {
|
|
78
|
+
setRendered(true);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (value) {
|
|
82
|
+
if (document.activeElement instanceof HTMLElement) previousActiveRef.current = document.activeElement;
|
|
83
|
+
setLeftPos(0);
|
|
84
|
+
setTopPos(top);
|
|
85
|
+
setVisible(true);
|
|
86
|
+
setShowInner(true);
|
|
87
|
+
refWrap.current?.focus();
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
if (draggable && refModal.current) setLeftPos((document.body.offsetWidth - refModal.current.offsetWidth) / 2);
|
|
90
|
+
updateOrigin();
|
|
91
|
+
}, 100);
|
|
92
|
+
} else {
|
|
93
|
+
setVisible(false);
|
|
94
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
95
|
+
hideTimerRef.current = setTimeout(() => {
|
|
96
|
+
setShowInner(false);
|
|
97
|
+
}, 300);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
$[2] = draggable;
|
|
101
|
+
$[3] = rendered;
|
|
102
|
+
$[4] = top;
|
|
103
|
+
$[5] = t16;
|
|
104
|
+
} else t16 = $[5];
|
|
105
|
+
const toggle = t16;
|
|
106
|
+
let t17;
|
|
107
|
+
if ($[6] !== onOpenChange || $[7] !== open) {
|
|
108
|
+
t17 = (next) => {
|
|
109
|
+
if (open === void 0) setInnerOpen(next);
|
|
110
|
+
onOpenChange?.(next);
|
|
111
|
+
};
|
|
112
|
+
$[6] = onOpenChange;
|
|
113
|
+
$[7] = open;
|
|
114
|
+
$[8] = t17;
|
|
115
|
+
} else t17 = $[8];
|
|
116
|
+
const requestOpen = t17;
|
|
117
|
+
let t18;
|
|
118
|
+
let t19;
|
|
119
|
+
if ($[9] !== currentOpen || $[10] !== panelOnly || $[11] !== rendered || $[12] !== toggle || $[13] !== visible) {
|
|
120
|
+
t18 = () => {
|
|
121
|
+
if (panelOnly) return;
|
|
122
|
+
const timer = setTimeout(() => {
|
|
123
|
+
if (currentOpen && !rendered) {
|
|
124
|
+
setRendered(true);
|
|
125
|
+
toggle(true);
|
|
126
|
+
} else if (currentOpen !== visible) toggle(currentOpen);
|
|
127
|
+
}, 0);
|
|
128
|
+
return () => clearTimeout(timer);
|
|
129
|
+
};
|
|
130
|
+
t19 = [
|
|
131
|
+
currentOpen,
|
|
132
|
+
panelOnly,
|
|
133
|
+
toggle,
|
|
134
|
+
rendered,
|
|
135
|
+
visible
|
|
136
|
+
];
|
|
137
|
+
$[9] = currentOpen;
|
|
138
|
+
$[10] = panelOnly;
|
|
139
|
+
$[11] = rendered;
|
|
140
|
+
$[12] = toggle;
|
|
141
|
+
$[13] = visible;
|
|
142
|
+
$[14] = t18;
|
|
143
|
+
$[15] = t19;
|
|
144
|
+
} else {
|
|
145
|
+
t18 = $[14];
|
|
146
|
+
t19 = $[15];
|
|
147
|
+
}
|
|
148
|
+
useEffect(t18, t19);
|
|
149
|
+
let t20;
|
|
150
|
+
let t21;
|
|
151
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
152
|
+
t20 = () => () => {
|
|
153
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
154
|
+
};
|
|
155
|
+
t21 = [];
|
|
156
|
+
$[16] = t20;
|
|
157
|
+
$[17] = t21;
|
|
158
|
+
} else {
|
|
159
|
+
t20 = $[16];
|
|
160
|
+
t21 = $[17];
|
|
161
|
+
}
|
|
162
|
+
useEffect(t20, t21);
|
|
163
|
+
let t22;
|
|
164
|
+
if ($[18] !== onClose || $[19] !== requestOpen) {
|
|
165
|
+
t22 = () => {
|
|
166
|
+
requestOpen(false);
|
|
167
|
+
onClose?.();
|
|
168
|
+
};
|
|
169
|
+
$[18] = onClose;
|
|
170
|
+
$[19] = requestOpen;
|
|
171
|
+
$[20] = t22;
|
|
172
|
+
} else t22 = $[20];
|
|
173
|
+
const close = t22;
|
|
174
|
+
let t23;
|
|
175
|
+
if ($[21] !== close) {
|
|
176
|
+
t23 = (e) => {
|
|
177
|
+
if (e.key === "Escape") close();
|
|
178
|
+
};
|
|
179
|
+
$[21] = close;
|
|
180
|
+
$[22] = t23;
|
|
181
|
+
} else t23 = $[22];
|
|
182
|
+
const escToClose = t23;
|
|
183
|
+
let t24;
|
|
184
|
+
let t25;
|
|
185
|
+
if ($[23] !== escKey || $[24] !== escToClose || $[25] !== panelOnly) {
|
|
186
|
+
t24 = () => {
|
|
187
|
+
if (panelOnly || !escKey) return;
|
|
188
|
+
document.addEventListener("keydown", escToClose);
|
|
189
|
+
return () => {
|
|
190
|
+
document.removeEventListener("keydown", escToClose);
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
t25 = [
|
|
194
|
+
escKey,
|
|
195
|
+
escToClose,
|
|
196
|
+
panelOnly
|
|
197
|
+
];
|
|
198
|
+
$[23] = escKey;
|
|
199
|
+
$[24] = escToClose;
|
|
200
|
+
$[25] = panelOnly;
|
|
201
|
+
$[26] = t24;
|
|
202
|
+
$[27] = t25;
|
|
203
|
+
} else {
|
|
204
|
+
t24 = $[26];
|
|
205
|
+
t25 = $[27];
|
|
206
|
+
}
|
|
207
|
+
useEffect(t24, t25);
|
|
208
|
+
let t26;
|
|
209
|
+
if ($[28] !== onOk) {
|
|
210
|
+
t26 = () => onOk?.();
|
|
211
|
+
$[28] = onOk;
|
|
212
|
+
$[29] = t26;
|
|
213
|
+
} else t26 = $[29];
|
|
214
|
+
const ok = t26;
|
|
215
|
+
let t27;
|
|
216
|
+
if ($[30] !== onCancel || $[31] !== requestOpen) {
|
|
217
|
+
t27 = () => {
|
|
218
|
+
requestOpen(false);
|
|
219
|
+
onCancel?.();
|
|
220
|
+
};
|
|
221
|
+
$[30] = onCancel;
|
|
222
|
+
$[31] = requestOpen;
|
|
223
|
+
$[32] = t27;
|
|
224
|
+
} else t27 = $[32];
|
|
225
|
+
const cancel = t27;
|
|
226
|
+
let t28;
|
|
227
|
+
if ($[33] !== onAfterClose) {
|
|
228
|
+
t28 = () => {
|
|
229
|
+
previousActiveRef.current?.focus();
|
|
230
|
+
previousActiveRef.current = null;
|
|
231
|
+
onAfterClose?.();
|
|
232
|
+
};
|
|
233
|
+
$[33] = onAfterClose;
|
|
234
|
+
$[34] = t28;
|
|
235
|
+
} else t28 = $[34];
|
|
236
|
+
const afterClose = t28;
|
|
237
|
+
let t29;
|
|
238
|
+
if ($[35] !== close || $[36] !== loading || $[37] !== maskClosable || $[38] !== mousedownIn) {
|
|
239
|
+
t29 = (e_0) => {
|
|
240
|
+
if (!loading && maskClosable && !refModal.current?.contains(e_0.target) && !mousedownIn) close();
|
|
241
|
+
};
|
|
242
|
+
$[35] = close;
|
|
243
|
+
$[36] = loading;
|
|
244
|
+
$[37] = maskClosable;
|
|
245
|
+
$[38] = mousedownIn;
|
|
246
|
+
$[39] = t29;
|
|
247
|
+
} else t29 = $[39];
|
|
248
|
+
const clickMaskToClose = t29;
|
|
249
|
+
let t30;
|
|
250
|
+
if ($[40] !== draggable || $[41] !== isMousePressed) {
|
|
251
|
+
t30 = (e_1) => {
|
|
252
|
+
if (isMousePressed && draggable) {
|
|
253
|
+
const { x: x_0, y: y_0 } = startPos.current;
|
|
254
|
+
setLeftPos((prev) => prev + e_1.clientX - x_0);
|
|
255
|
+
setTopPos((prev_0) => (prev_0 ?? 100) + e_1.clientY - y_0);
|
|
256
|
+
startPos.current = {
|
|
257
|
+
x: e_1.clientX,
|
|
258
|
+
y: e_1.clientY
|
|
259
|
+
};
|
|
260
|
+
updateOrigin();
|
|
261
|
+
e_1.preventDefault();
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
$[40] = draggable;
|
|
265
|
+
$[41] = isMousePressed;
|
|
266
|
+
$[42] = t30;
|
|
267
|
+
} else t30 = $[42];
|
|
268
|
+
const mousemove = t30;
|
|
269
|
+
let t31;
|
|
270
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
271
|
+
t31 = () => {
|
|
272
|
+
setIsMousePressed(false);
|
|
273
|
+
};
|
|
274
|
+
$[43] = t31;
|
|
275
|
+
} else t31 = $[43];
|
|
276
|
+
const mouseup = t31;
|
|
277
|
+
let t32;
|
|
278
|
+
if ($[44] !== draggable || $[45] !== visible) {
|
|
279
|
+
t32 = (e_2) => {
|
|
280
|
+
if (e_2.button === 0 && draggable && refHeader.current && refHeader.current.contains(e_2.target)) {
|
|
281
|
+
setIsMousePressed(true);
|
|
282
|
+
startPos.current = {
|
|
283
|
+
x: e_2.clientX,
|
|
284
|
+
y: e_2.clientY
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
setMousedownIn(visible && !!refModal.current?.contains(e_2.target));
|
|
288
|
+
};
|
|
289
|
+
$[44] = draggable;
|
|
290
|
+
$[45] = visible;
|
|
291
|
+
$[46] = t32;
|
|
292
|
+
} else t32 = $[46];
|
|
293
|
+
const handleMouseDown = t32;
|
|
294
|
+
let t33;
|
|
295
|
+
let t34;
|
|
296
|
+
if ($[47] !== handleMouseDown || $[48] !== mousemove || $[49] !== panelOnly) {
|
|
297
|
+
t33 = () => {
|
|
298
|
+
if (panelOnly) return;
|
|
299
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
300
|
+
document.addEventListener("mousemove", mousemove);
|
|
301
|
+
document.addEventListener("mouseup", mouseup);
|
|
302
|
+
return () => {
|
|
303
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
304
|
+
document.removeEventListener("mousemove", mousemove);
|
|
305
|
+
document.removeEventListener("mouseup", mouseup);
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
t34 = [
|
|
309
|
+
handleMouseDown,
|
|
310
|
+
mousemove,
|
|
311
|
+
mouseup,
|
|
312
|
+
panelOnly
|
|
313
|
+
];
|
|
314
|
+
$[47] = handleMouseDown;
|
|
315
|
+
$[48] = mousemove;
|
|
316
|
+
$[49] = panelOnly;
|
|
317
|
+
$[50] = t33;
|
|
318
|
+
$[51] = t34;
|
|
319
|
+
} else {
|
|
320
|
+
t33 = $[50];
|
|
321
|
+
t34 = $[51];
|
|
322
|
+
}
|
|
323
|
+
useEffect(t33, t34);
|
|
324
|
+
const okLabel = okText || locale?.k?.common?.ok;
|
|
325
|
+
const cancelLabel = cancelText || locale?.k?.common?.cancel;
|
|
326
|
+
let contentNode = content;
|
|
327
|
+
if (!contentNode) {
|
|
328
|
+
let t35;
|
|
329
|
+
if ($[52] !== cancel || $[53] !== cancelLabel || $[54] !== footer || $[55] !== loading || $[56] !== ok || $[57] !== okLabel) {
|
|
330
|
+
t35 = footer === true ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
331
|
+
onClick: cancel,
|
|
332
|
+
children: cancelLabel
|
|
333
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
334
|
+
onClick: ok,
|
|
335
|
+
type: "primary",
|
|
336
|
+
loading,
|
|
337
|
+
children: okLabel
|
|
338
|
+
})] }) : footer;
|
|
339
|
+
$[52] = cancel;
|
|
340
|
+
$[53] = cancelLabel;
|
|
341
|
+
$[54] = footer;
|
|
342
|
+
$[55] = loading;
|
|
343
|
+
$[56] = ok;
|
|
344
|
+
$[57] = okLabel;
|
|
345
|
+
$[58] = t35;
|
|
346
|
+
} else t35 = $[58];
|
|
347
|
+
const footerContent = t35;
|
|
348
|
+
let t36;
|
|
349
|
+
if ($[59] !== close || $[60] !== showClose) {
|
|
350
|
+
t36 = showClose && /* @__PURE__ */ jsx(Button, {
|
|
351
|
+
icon: X,
|
|
352
|
+
size: "small",
|
|
353
|
+
onClick: close,
|
|
354
|
+
className: "k-modal-close",
|
|
355
|
+
type: "text"
|
|
356
|
+
});
|
|
357
|
+
$[59] = close;
|
|
358
|
+
$[60] = showClose;
|
|
359
|
+
$[61] = t36;
|
|
360
|
+
} else t36 = $[61];
|
|
361
|
+
let t37;
|
|
362
|
+
if ($[62] !== title) {
|
|
363
|
+
t37 = title !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
364
|
+
className: "k-modal-header",
|
|
365
|
+
ref: refHeader,
|
|
366
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
367
|
+
className: "k-modal-header-inner",
|
|
368
|
+
children: title
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
$[62] = title;
|
|
372
|
+
$[63] = t37;
|
|
373
|
+
} else t37 = $[63];
|
|
374
|
+
let t38;
|
|
375
|
+
if ($[64] !== children) {
|
|
376
|
+
t38 = /* @__PURE__ */ jsx("div", {
|
|
377
|
+
className: "k-modal-body",
|
|
378
|
+
children
|
|
379
|
+
});
|
|
380
|
+
$[64] = children;
|
|
381
|
+
$[65] = t38;
|
|
382
|
+
} else t38 = $[65];
|
|
383
|
+
let t39;
|
|
384
|
+
if ($[66] !== footer || $[67] !== footerContent) {
|
|
385
|
+
t39 = footer !== false && /* @__PURE__ */ jsx("div", {
|
|
386
|
+
className: "k-modal-footer",
|
|
387
|
+
children: footerContent
|
|
388
|
+
});
|
|
389
|
+
$[66] = footer;
|
|
390
|
+
$[67] = footerContent;
|
|
391
|
+
$[68] = t39;
|
|
392
|
+
} else t39 = $[68];
|
|
393
|
+
let t40;
|
|
394
|
+
if ($[69] !== t36 || $[70] !== t37 || $[71] !== t38 || $[72] !== t39) {
|
|
395
|
+
t40 = /* @__PURE__ */ jsxs("div", {
|
|
396
|
+
className: "k-modal-content",
|
|
397
|
+
tabIndex: 0,
|
|
398
|
+
children: [
|
|
399
|
+
t36,
|
|
400
|
+
t37,
|
|
401
|
+
t38,
|
|
402
|
+
t39
|
|
403
|
+
]
|
|
404
|
+
});
|
|
405
|
+
$[69] = t36;
|
|
406
|
+
$[70] = t37;
|
|
407
|
+
$[71] = t38;
|
|
408
|
+
$[72] = t39;
|
|
409
|
+
$[73] = t40;
|
|
410
|
+
} else t40 = $[73];
|
|
411
|
+
contentNode = t40;
|
|
412
|
+
}
|
|
413
|
+
if (panelOnly) {
|
|
414
|
+
let t35;
|
|
415
|
+
if ($[74] !== className) {
|
|
416
|
+
t35 = clsx("k-modal", "k-modal-panel", className);
|
|
417
|
+
$[74] = className;
|
|
418
|
+
$[75] = t35;
|
|
419
|
+
} else t35 = $[75];
|
|
420
|
+
const t36 = typeof width === "number" ? `${width}px` : width;
|
|
421
|
+
let t37;
|
|
422
|
+
if ($[76] !== t36) {
|
|
423
|
+
t37 = { width: t36 };
|
|
424
|
+
$[76] = t36;
|
|
425
|
+
$[77] = t37;
|
|
426
|
+
} else t37 = $[77];
|
|
427
|
+
let t38;
|
|
428
|
+
if ($[78] !== contentNode) {
|
|
429
|
+
t38 = /* @__PURE__ */ jsx("div", {
|
|
430
|
+
className: "k-modal-wrap",
|
|
431
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
432
|
+
className: "k-modal-inner",
|
|
433
|
+
children: contentNode
|
|
434
|
+
})
|
|
435
|
+
});
|
|
436
|
+
$[78] = contentNode;
|
|
437
|
+
$[79] = t38;
|
|
438
|
+
} else t38 = $[79];
|
|
439
|
+
let t39;
|
|
440
|
+
if ($[80] !== t35 || $[81] !== t37 || $[82] !== t38) {
|
|
441
|
+
t39 = /* @__PURE__ */ jsx("div", {
|
|
442
|
+
className: t35,
|
|
443
|
+
style: t37,
|
|
444
|
+
children: t38
|
|
445
|
+
});
|
|
446
|
+
$[80] = t35;
|
|
447
|
+
$[81] = t37;
|
|
448
|
+
$[82] = t38;
|
|
449
|
+
$[83] = t39;
|
|
450
|
+
} else t39 = $[83];
|
|
451
|
+
return t39;
|
|
452
|
+
}
|
|
453
|
+
let t35;
|
|
454
|
+
if ($[84] !== draggable || $[85] !== leftPos || $[86] !== maximized || $[87] !== topPos || $[88] !== width) {
|
|
455
|
+
t35 = maximized ? null : {
|
|
456
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
457
|
+
top: `${topPos}px`,
|
|
458
|
+
left: draggable ? `${leftPos}px` : void 0
|
|
459
|
+
};
|
|
460
|
+
$[84] = draggable;
|
|
461
|
+
$[85] = leftPos;
|
|
462
|
+
$[86] = maximized;
|
|
463
|
+
$[87] = topPos;
|
|
464
|
+
$[88] = width;
|
|
465
|
+
$[89] = t35;
|
|
466
|
+
} else t35 = $[89];
|
|
467
|
+
const modalStyle = t35;
|
|
468
|
+
const t36 = footer !== false && footer != null;
|
|
469
|
+
let t37;
|
|
470
|
+
if ($[90] !== centered || $[91] !== className || $[92] !== draggable || $[93] !== maximized || $[94] !== t36) {
|
|
471
|
+
t37 = clsx("k-modal", className, {
|
|
472
|
+
"k-modal-draggable": draggable,
|
|
473
|
+
"k-modal-maximized": maximized,
|
|
474
|
+
"k-modal-centered": centered,
|
|
475
|
+
"k-modal-has-footer": t36
|
|
476
|
+
});
|
|
477
|
+
$[90] = centered;
|
|
478
|
+
$[91] = className;
|
|
479
|
+
$[92] = draggable;
|
|
480
|
+
$[93] = maximized;
|
|
481
|
+
$[94] = t36;
|
|
482
|
+
$[95] = t37;
|
|
483
|
+
} else t37 = $[95];
|
|
484
|
+
const classes = t37;
|
|
485
|
+
if (!rendered) return null;
|
|
486
|
+
let t38;
|
|
487
|
+
if ($[96] !== mask || $[97] !== visible) {
|
|
488
|
+
t38 = mask && /* @__PURE__ */ jsx(Transition, {
|
|
489
|
+
show: visible,
|
|
490
|
+
name: "k-modal-fade",
|
|
491
|
+
timeout: 400,
|
|
492
|
+
children: /* @__PURE__ */ jsx("div", { className: "k-modal-mask" })
|
|
493
|
+
});
|
|
494
|
+
$[96] = mask;
|
|
495
|
+
$[97] = visible;
|
|
496
|
+
$[98] = t38;
|
|
497
|
+
} else t38 = $[98];
|
|
498
|
+
const t39 = showInner ? void 0 : "none";
|
|
499
|
+
let t40;
|
|
500
|
+
if ($[99] !== t39) {
|
|
501
|
+
t40 = { display: t39 };
|
|
502
|
+
$[99] = t39;
|
|
503
|
+
$[100] = t40;
|
|
504
|
+
} else t40 = $[100];
|
|
505
|
+
const t41 = modalStyle || void 0;
|
|
506
|
+
let t42;
|
|
507
|
+
if ($[101] === Symbol.for("react.memo_cache_sentinel")) {
|
|
508
|
+
t42 = /* @__PURE__ */ jsx("div", { tabIndex: 0 });
|
|
509
|
+
$[101] = t42;
|
|
510
|
+
} else t42 = $[101];
|
|
511
|
+
let t43;
|
|
512
|
+
if ($[102] !== contentNode || $[103] !== t41) {
|
|
513
|
+
t43 = /* @__PURE__ */ jsxs("div", {
|
|
514
|
+
ref: refModal,
|
|
515
|
+
className: "k-modal-inner",
|
|
516
|
+
style: t41,
|
|
517
|
+
children: [contentNode, t42]
|
|
518
|
+
});
|
|
519
|
+
$[102] = contentNode;
|
|
520
|
+
$[103] = t41;
|
|
521
|
+
$[104] = t43;
|
|
522
|
+
} else t43 = $[104];
|
|
523
|
+
let t44;
|
|
524
|
+
if ($[105] !== afterClose || $[106] !== t43 || $[107] !== visible) {
|
|
525
|
+
t44 = /* @__PURE__ */ jsx(Transition, {
|
|
526
|
+
show: visible,
|
|
527
|
+
name: "k-modal-zoom",
|
|
528
|
+
timeout: 250,
|
|
529
|
+
onAfterLeave: afterClose,
|
|
530
|
+
children: t43
|
|
531
|
+
});
|
|
532
|
+
$[105] = afterClose;
|
|
533
|
+
$[106] = t43;
|
|
534
|
+
$[107] = visible;
|
|
535
|
+
$[108] = t44;
|
|
536
|
+
} else t44 = $[108];
|
|
537
|
+
let t45;
|
|
538
|
+
if ($[109] !== clickMaskToClose || $[110] !== t40 || $[111] !== t44) {
|
|
539
|
+
t45 = /* @__PURE__ */ jsx("div", {
|
|
540
|
+
ref: refWrap,
|
|
541
|
+
className: "k-modal-wrap",
|
|
542
|
+
tabIndex: -1,
|
|
543
|
+
role: "dialog",
|
|
544
|
+
style: t40,
|
|
545
|
+
onClick: clickMaskToClose,
|
|
546
|
+
children: t44
|
|
547
|
+
});
|
|
548
|
+
$[109] = clickMaskToClose;
|
|
549
|
+
$[110] = t40;
|
|
550
|
+
$[111] = t44;
|
|
551
|
+
$[112] = t45;
|
|
552
|
+
} else t45 = $[112];
|
|
553
|
+
let t46;
|
|
554
|
+
if ($[113] !== classes || $[114] !== t38 || $[115] !== t45) {
|
|
555
|
+
t46 = /* @__PURE__ */ jsx(Teleport, {
|
|
556
|
+
to: "body",
|
|
557
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
558
|
+
className: classes,
|
|
559
|
+
children: [t38, t45]
|
|
560
|
+
})
|
|
561
|
+
});
|
|
562
|
+
$[113] = classes;
|
|
563
|
+
$[114] = t38;
|
|
564
|
+
$[115] = t45;
|
|
565
|
+
$[116] = t46;
|
|
566
|
+
} else t46 = $[116];
|
|
567
|
+
return t46;
|
|
568
|
+
};
|
|
569
|
+
function ModalPanel(props) {
|
|
570
|
+
const $ = c(2);
|
|
571
|
+
let t0;
|
|
572
|
+
if ($[0] !== props) {
|
|
573
|
+
t0 = /* @__PURE__ */ jsx(Modal, {
|
|
574
|
+
...props,
|
|
575
|
+
panelOnly: true
|
|
576
|
+
});
|
|
577
|
+
$[0] = props;
|
|
578
|
+
$[1] = t0;
|
|
579
|
+
} else t0 = $[1];
|
|
580
|
+
return t0;
|
|
581
|
+
}
|
|
582
|
+
function _temp(el) {
|
|
583
|
+
return {
|
|
584
|
+
left: el.offsetLeft,
|
|
585
|
+
top: el.offsetTop
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
export { ModalPanel, Modal as default };
|
|
@@ -0,0 +1,99 @@
|
|
|
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 zh_CN_default from "../locale/zh-CN.js";
|
|
10
|
+
import { ConfigContext } from "../config/config-context.js";
|
|
11
|
+
import { CircleAlert, CircleCheck, CircleQuestionMark, CircleX, Info } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
12
|
+
import Icon from "../icon/index.js";
|
|
13
|
+
import Button from "../button/button.js";
|
|
14
|
+
import Modal from "./modal.js";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import { useContext, useRef, useState } from "react";
|
|
17
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
//#region components/modal/toast.tsx
|
|
19
|
+
var icons = {
|
|
20
|
+
info: Info,
|
|
21
|
+
error: CircleX,
|
|
22
|
+
success: CircleCheck,
|
|
23
|
+
warning: CircleAlert,
|
|
24
|
+
confirm: CircleQuestionMark
|
|
25
|
+
};
|
|
26
|
+
function Toast({ title, okText, cancelText, content, color, icon, onOk, onCancel, onDestroy, type = "info" }) {
|
|
27
|
+
const { locale } = useContext(ConfigContext);
|
|
28
|
+
const messages = (locale ?? zh_CN_default)?.k?.common;
|
|
29
|
+
const [open, setOpen] = useState(true);
|
|
30
|
+
const [loading, setLoading] = useState(false);
|
|
31
|
+
const destroyRequestedRef = useRef(false);
|
|
32
|
+
const requestDestroy = () => {
|
|
33
|
+
if (destroyRequestedRef.current) return;
|
|
34
|
+
destroyRequestedRef.current = true;
|
|
35
|
+
onDestroy?.();
|
|
36
|
+
};
|
|
37
|
+
const handleClose = () => {
|
|
38
|
+
setOpen(false);
|
|
39
|
+
};
|
|
40
|
+
const ok = async () => {
|
|
41
|
+
try {
|
|
42
|
+
const result = onOk?.();
|
|
43
|
+
if (result && typeof result.then === "function") {
|
|
44
|
+
setLoading(true);
|
|
45
|
+
await result;
|
|
46
|
+
}
|
|
47
|
+
} catch {
|
|
48
|
+
setLoading(false);
|
|
49
|
+
} finally {
|
|
50
|
+
handleClose();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const cancel = () => {
|
|
54
|
+
onCancel?.();
|
|
55
|
+
handleClose();
|
|
56
|
+
};
|
|
57
|
+
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
58
|
+
/* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: "k-toast-header",
|
|
60
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
61
|
+
className: "k-toast-icon",
|
|
62
|
+
type: icon ?? icons[type],
|
|
63
|
+
color
|
|
64
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
65
|
+
className: "k-toast-title",
|
|
66
|
+
children: title
|
|
67
|
+
})]
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx("div", {
|
|
70
|
+
className: "k-toast-content",
|
|
71
|
+
children: content
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "k-toast-footer",
|
|
75
|
+
children: [type === "confirm" && /* @__PURE__ */ jsx(Button, {
|
|
76
|
+
onClick: cancel,
|
|
77
|
+
children: cancelText ?? messages?.cancel
|
|
78
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
79
|
+
type: "primary",
|
|
80
|
+
loading,
|
|
81
|
+
onClick: ok,
|
|
82
|
+
children: okText ?? messages?.ok
|
|
83
|
+
})]
|
|
84
|
+
})
|
|
85
|
+
] });
|
|
86
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
87
|
+
open,
|
|
88
|
+
className: clsx("k-toast", `k-toast-${type}`),
|
|
89
|
+
maskClosable: false,
|
|
90
|
+
content: body,
|
|
91
|
+
onClose: handleClose,
|
|
92
|
+
onAfterClose: requestDestroy,
|
|
93
|
+
onOpenChange: (opened) => {
|
|
94
|
+
if (!opened) setOpen(false);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { Toast as default };
|