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,351 @@
|
|
|
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 { getChildren } from "../utils/react-node.js";
|
|
10
|
+
import Teleport from "../base/teleport.js";
|
|
11
|
+
import { Transition } from "../base/transition.js";
|
|
12
|
+
import { setPlacement } from "../utils/placement.js";
|
|
13
|
+
import { DropdownContext } from "./dropdown-context.js";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
//#region components/dropdown/dropdown.tsx
|
|
18
|
+
var Dropdown = ({ trigger = "hover", disabled = false, arrow = false, open, defaultOpen = false, show, placement = "bottom-left", target, onOpenChange, overlay, children, className = "", style, ...rest }) => {
|
|
19
|
+
const externalOpen = open ?? show;
|
|
20
|
+
const initialOpen = externalOpen ?? defaultOpen;
|
|
21
|
+
const [visible, setVisible] = useState(initialOpen);
|
|
22
|
+
const [rendered, setRendered] = useState(initialOpen);
|
|
23
|
+
const [positioned, setPositioned] = useState(false);
|
|
24
|
+
const [previousOpen, setPreviousOpen] = useState(externalOpen);
|
|
25
|
+
if (previousOpen !== externalOpen) {
|
|
26
|
+
setPreviousOpen(externalOpen);
|
|
27
|
+
if (externalOpen !== void 0) {
|
|
28
|
+
setVisible(externalOpen);
|
|
29
|
+
if (externalOpen) setRendered(true);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const localRefSelection = useRef(null);
|
|
33
|
+
const refPopper = useRef(null);
|
|
34
|
+
const [currentPlacement, setCurrentPlacement] = useState(placement);
|
|
35
|
+
const [transOrigin, setTransOrigin] = useState("bottom");
|
|
36
|
+
const [left, setLeft] = useState(0);
|
|
37
|
+
const [top, setTop] = useState(0);
|
|
38
|
+
const placementRef = useRef(placement);
|
|
39
|
+
const transOriginRef = useRef("bottom");
|
|
40
|
+
const leftRef = useRef(0);
|
|
41
|
+
const topRef = useRef(0);
|
|
42
|
+
const showTimer = useRef(null);
|
|
43
|
+
const positionTimer = useRef(null);
|
|
44
|
+
const initialPositionFrameRef = useRef(null);
|
|
45
|
+
const frameRef = useRef(null);
|
|
46
|
+
const contextmenuPosition = useRef(null);
|
|
47
|
+
const refSelection = target || localRefSelection;
|
|
48
|
+
const setLocalSelection = useCallback((node) => {
|
|
49
|
+
localRefSelection.current = node;
|
|
50
|
+
}, []);
|
|
51
|
+
const focusMenuItem = (last = false) => {
|
|
52
|
+
window.requestAnimationFrame(() => {
|
|
53
|
+
window.requestAnimationFrame(() => {
|
|
54
|
+
const items = Array.from(refPopper.current?.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])") || []);
|
|
55
|
+
items[last ? items.length - 1 : 0]?.focus({ preventScroll: true });
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const updatePosition = useCallback((e, requestedPlacement = placement) => {
|
|
60
|
+
if (!refPopper.current) return false;
|
|
61
|
+
const targetElement = refSelection.current;
|
|
62
|
+
if (!targetElement) return false;
|
|
63
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
64
|
+
const position = e != null ? {
|
|
65
|
+
x: e.clientX,
|
|
66
|
+
y: e.clientY
|
|
67
|
+
} : trigger === "contextmenu" ? contextmenuPosition.current ? {
|
|
68
|
+
x: targetRect.left + contextmenuPosition.current.offsetX,
|
|
69
|
+
y: targetRect.top + contextmenuPosition.current.offsetY
|
|
70
|
+
} : null : null;
|
|
71
|
+
placementRef.current = requestedPlacement;
|
|
72
|
+
setPlacement({
|
|
73
|
+
refSelection,
|
|
74
|
+
position,
|
|
75
|
+
refPopper,
|
|
76
|
+
currentPlacement: placementRef,
|
|
77
|
+
transOrigin: transOriginRef,
|
|
78
|
+
top: topRef,
|
|
79
|
+
left: leftRef
|
|
80
|
+
});
|
|
81
|
+
setCurrentPlacement((current) => current === placementRef.current ? current : placementRef.current);
|
|
82
|
+
setTransOrigin((current_0) => current_0 === transOriginRef.current ? current_0 : transOriginRef.current);
|
|
83
|
+
setTop((current_1) => current_1 === topRef.current ? current_1 : topRef.current);
|
|
84
|
+
setLeft((current_2) => current_2 === leftRef.current ? current_2 : leftRef.current);
|
|
85
|
+
return true;
|
|
86
|
+
}, [
|
|
87
|
+
placement,
|
|
88
|
+
refSelection,
|
|
89
|
+
trigger
|
|
90
|
+
]);
|
|
91
|
+
useLayoutEffect(() => {
|
|
92
|
+
if (!rendered || !visible || positioned) return;
|
|
93
|
+
if (updatePosition(void 0, placement)) initialPositionFrameRef.current = window.requestAnimationFrame(() => {
|
|
94
|
+
initialPositionFrameRef.current = null;
|
|
95
|
+
setPositioned(true);
|
|
96
|
+
});
|
|
97
|
+
return () => {
|
|
98
|
+
if (initialPositionFrameRef.current !== null) {
|
|
99
|
+
cancelAnimationFrame(initialPositionFrameRef.current);
|
|
100
|
+
initialPositionFrameRef.current = null;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}, [
|
|
104
|
+
placement,
|
|
105
|
+
positioned,
|
|
106
|
+
rendered,
|
|
107
|
+
updatePosition,
|
|
108
|
+
visible
|
|
109
|
+
]);
|
|
110
|
+
const schedulePositionUpdate = useCallback(() => {
|
|
111
|
+
if (frameRef.current !== null || typeof window === "undefined") return;
|
|
112
|
+
frameRef.current = window.requestAnimationFrame(() => {
|
|
113
|
+
frameRef.current = null;
|
|
114
|
+
updatePosition();
|
|
115
|
+
});
|
|
116
|
+
}, [updatePosition]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (visible) positionTimer.current = setTimeout(() => updatePosition(void 0, placement), 0);
|
|
119
|
+
return () => {
|
|
120
|
+
if (positionTimer.current) clearTimeout(positionTimer.current);
|
|
121
|
+
positionTimer.current = null;
|
|
122
|
+
};
|
|
123
|
+
}, [
|
|
124
|
+
placement,
|
|
125
|
+
updatePosition,
|
|
126
|
+
visible
|
|
127
|
+
]);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!visible) return;
|
|
130
|
+
const targetElement_0 = refSelection.current;
|
|
131
|
+
if (!targetElement_0) return;
|
|
132
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedulePositionUpdate);
|
|
133
|
+
observer?.observe(targetElement_0);
|
|
134
|
+
if (refPopper.current) observer?.observe(refPopper.current);
|
|
135
|
+
window.addEventListener("resize", schedulePositionUpdate);
|
|
136
|
+
window.addEventListener("scroll", schedulePositionUpdate, true);
|
|
137
|
+
return () => {
|
|
138
|
+
observer?.disconnect();
|
|
139
|
+
window.removeEventListener("resize", schedulePositionUpdate);
|
|
140
|
+
window.removeEventListener("scroll", schedulePositionUpdate, true);
|
|
141
|
+
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
142
|
+
frameRef.current = null;
|
|
143
|
+
};
|
|
144
|
+
}, [
|
|
145
|
+
refSelection,
|
|
146
|
+
schedulePositionUpdate,
|
|
147
|
+
visible
|
|
148
|
+
]);
|
|
149
|
+
const outsideClick = useCallback((e_0) => {
|
|
150
|
+
const targetElement_1 = refSelection.current;
|
|
151
|
+
if (!refPopper.current) return;
|
|
152
|
+
const clickedEl = e_0.target;
|
|
153
|
+
if (!refPopper.current.contains(clickedEl) && (!targetElement_1 || !targetElement_1.contains(clickedEl)) || trigger === "contextmenu" && !refPopper.current.contains(clickedEl)) {
|
|
154
|
+
if (externalOpen === void 0) setVisible(false);
|
|
155
|
+
onOpenChange?.(false);
|
|
156
|
+
}
|
|
157
|
+
}, [
|
|
158
|
+
externalOpen,
|
|
159
|
+
onOpenChange,
|
|
160
|
+
refSelection,
|
|
161
|
+
trigger
|
|
162
|
+
]);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (visible) document.addEventListener("click", outsideClick);
|
|
165
|
+
else document.removeEventListener("click", outsideClick);
|
|
166
|
+
return () => {
|
|
167
|
+
document.removeEventListener("click", outsideClick);
|
|
168
|
+
};
|
|
169
|
+
}, [outsideClick, visible]);
|
|
170
|
+
const clearPopTimer = () => {
|
|
171
|
+
if (showTimer.current) {
|
|
172
|
+
clearTimeout(showTimer.current);
|
|
173
|
+
showTimer.current = null;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
useEffect(() => () => {
|
|
177
|
+
clearPopTimer();
|
|
178
|
+
if (positionTimer.current) clearTimeout(positionTimer.current);
|
|
179
|
+
if (initialPositionFrameRef.current !== null) cancelAnimationFrame(initialPositionFrameRef.current);
|
|
180
|
+
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
181
|
+
}, []);
|
|
182
|
+
const openChange = (opened, e_1) => {
|
|
183
|
+
if (!rendered && opened) setRendered(true);
|
|
184
|
+
if (externalOpen === void 0) setVisible(opened);
|
|
185
|
+
onOpenChange?.(opened);
|
|
186
|
+
if (opened) {
|
|
187
|
+
setPositioned(false);
|
|
188
|
+
if (trigger === "contextmenu" && e_1) {
|
|
189
|
+
const rect = refSelection.current?.getBoundingClientRect();
|
|
190
|
+
if (rect) contextmenuPosition.current = {
|
|
191
|
+
offsetX: e_1.clientX - rect.left,
|
|
192
|
+
offsetY: e_1.clientY - rect.top
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (positionTimer.current) clearTimeout(positionTimer.current);
|
|
196
|
+
positionTimer.current = setTimeout(() => updatePosition(e_1, placement), 0);
|
|
197
|
+
} else if (trigger === "contextmenu") contextmenuPosition.current = null;
|
|
198
|
+
};
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (!visible) return;
|
|
201
|
+
const handleEscape = (event) => {
|
|
202
|
+
if (event.key !== "Escape") return;
|
|
203
|
+
event.preventDefault();
|
|
204
|
+
event.stopPropagation();
|
|
205
|
+
if (externalOpen === void 0) setVisible(false);
|
|
206
|
+
onOpenChange?.(false);
|
|
207
|
+
refSelection.current?.focus({ preventScroll: true });
|
|
208
|
+
};
|
|
209
|
+
document.addEventListener("keydown", handleEscape, true);
|
|
210
|
+
return () => document.removeEventListener("keydown", handleEscape, true);
|
|
211
|
+
}, [
|
|
212
|
+
externalOpen,
|
|
213
|
+
onOpenChange,
|
|
214
|
+
refSelection,
|
|
215
|
+
visible
|
|
216
|
+
]);
|
|
217
|
+
const mouseEnterEvent = () => {
|
|
218
|
+
if (disabled) return;
|
|
219
|
+
if (trigger === "hover") {
|
|
220
|
+
clearPopTimer();
|
|
221
|
+
openChange(true);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const mouseLeaveEvent = () => {
|
|
225
|
+
if (disabled) return;
|
|
226
|
+
if (trigger === "hover") {
|
|
227
|
+
clearPopTimer();
|
|
228
|
+
showTimer.current = setTimeout(() => {
|
|
229
|
+
openChange(false);
|
|
230
|
+
}, 300);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const clickEvent = () => {
|
|
234
|
+
if (disabled) return;
|
|
235
|
+
if (trigger === "click") openChange(!visible);
|
|
236
|
+
};
|
|
237
|
+
const contextmenuEvent = (e_2) => {
|
|
238
|
+
if (disabled) return;
|
|
239
|
+
if (trigger === "contextmenu") {
|
|
240
|
+
e_2.preventDefault();
|
|
241
|
+
openChange(true, e_2.nativeEvent);
|
|
242
|
+
focusMenuItem();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const childList = getChildren(children);
|
|
246
|
+
const candidate = childList.length === 1 ? childList[0] : /* @__PURE__ */ jsx("span", { children: childList });
|
|
247
|
+
const firstChild = React.isValidElement(candidate) ? candidate : null;
|
|
248
|
+
const triggerProps = {};
|
|
249
|
+
if (!target) {
|
|
250
|
+
triggerProps.onClick = (e_3) => {
|
|
251
|
+
clickEvent();
|
|
252
|
+
if (firstChild?.props.onClick) firstChild.props.onClick(e_3);
|
|
253
|
+
};
|
|
254
|
+
triggerProps.onMouseEnter = (e_4) => {
|
|
255
|
+
mouseEnterEvent();
|
|
256
|
+
if (firstChild?.props.onMouseEnter) firstChild.props.onMouseEnter(e_4);
|
|
257
|
+
};
|
|
258
|
+
triggerProps.onMouseLeave = (e_5) => {
|
|
259
|
+
mouseLeaveEvent();
|
|
260
|
+
if (firstChild?.props.onMouseLeave) firstChild.props.onMouseLeave(e_5);
|
|
261
|
+
};
|
|
262
|
+
triggerProps.onContextMenu = (e_6) => {
|
|
263
|
+
contextmenuEvent(e_6);
|
|
264
|
+
if (firstChild?.props.onContextMenu) firstChild.props.onContextMenu(e_6);
|
|
265
|
+
};
|
|
266
|
+
triggerProps.onKeyDown = (e_7) => {
|
|
267
|
+
if (e_7.key === "Escape" && visible) {
|
|
268
|
+
e_7.preventDefault();
|
|
269
|
+
openChange(false);
|
|
270
|
+
} else if (e_7.key === "ArrowDown" || e_7.key === "ArrowUp") {
|
|
271
|
+
e_7.preventDefault();
|
|
272
|
+
openChange(true);
|
|
273
|
+
focusMenuItem(e_7.key === "ArrowUp");
|
|
274
|
+
} else if (trigger === "click" && (e_7.key === "Enter" || e_7.key === " ")) {
|
|
275
|
+
e_7.preventDefault();
|
|
276
|
+
openChange(!visible);
|
|
277
|
+
}
|
|
278
|
+
firstChild?.props.onKeyDown?.(e_7);
|
|
279
|
+
};
|
|
280
|
+
triggerProps["aria-haspopup"] = "menu";
|
|
281
|
+
triggerProps["aria-expanded"] = visible;
|
|
282
|
+
}
|
|
283
|
+
const triggerNode = target ? candidate : firstChild ? React.cloneElement(firstChild, {
|
|
284
|
+
ref: setLocalSelection,
|
|
285
|
+
...triggerProps
|
|
286
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
287
|
+
ref: setLocalSelection,
|
|
288
|
+
...triggerProps,
|
|
289
|
+
children: candidate
|
|
290
|
+
});
|
|
291
|
+
const popperClasses = clsx("k-dropdown", { "k-dropdown-has-arrow": arrow }, className);
|
|
292
|
+
const overlayNode = rendered && overlay ? /* @__PURE__ */ jsx(Transition, {
|
|
293
|
+
show: visible,
|
|
294
|
+
name: "k-dropdown",
|
|
295
|
+
nodeRef: refPopper,
|
|
296
|
+
appear: true,
|
|
297
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
298
|
+
ref: refPopper,
|
|
299
|
+
style: {
|
|
300
|
+
left: `${left}px`,
|
|
301
|
+
top: `${top}px`,
|
|
302
|
+
transformOrigin: transOrigin,
|
|
303
|
+
...style,
|
|
304
|
+
visibility: positioned ? style?.visibility : "hidden"
|
|
305
|
+
},
|
|
306
|
+
className: popperClasses,
|
|
307
|
+
"k-placement": currentPlacement,
|
|
308
|
+
onMouseEnter: clearPopTimer,
|
|
309
|
+
onMouseLeave: mouseLeaveEvent,
|
|
310
|
+
...rest,
|
|
311
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
312
|
+
className: "k-dropdown-content",
|
|
313
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
314
|
+
className: "k-dropdown-body",
|
|
315
|
+
children: overlay
|
|
316
|
+
}), arrow && /* @__PURE__ */ jsx("div", {
|
|
317
|
+
className: "k-dropdown-arrow",
|
|
318
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
319
|
+
style: { fill: "currentcolor" },
|
|
320
|
+
viewBox: "0 0 24 8",
|
|
321
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
322
|
+
d: "M24,0.97087 L24,1.97087 C20,1.97087 18.5,2.97087 16.5,4.97087 C14.5,6.97087 14,7.97087 12,7.97087 C10,7.97087 9.5,6.97087 7.5,4.97087 C5.5,2.97087 4,1.97087 0,1.97087 L0,0.97087 L24,0.97087 Z",
|
|
323
|
+
id: "ot"
|
|
324
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
325
|
+
d: "M24,0 L24,1 C20.032328,1 18.1576594,1.985435 16.1576594,3.985435 C14.1576594,5.985435 13.3847825,7 12,7 C10.6152175,7 9.81306952,5.985435 7.81306952,3.985435 C5.81306952,1.985435 4.0114261,1 0,1 L0,0 L24,0 Z",
|
|
326
|
+
id: "in",
|
|
327
|
+
stroke: "currentcolor"
|
|
328
|
+
})]
|
|
329
|
+
})
|
|
330
|
+
})]
|
|
331
|
+
})
|
|
332
|
+
})
|
|
333
|
+
}) : null;
|
|
334
|
+
return /* @__PURE__ */ jsxs(DropdownContext.Provider, {
|
|
335
|
+
value: {
|
|
336
|
+
onMouseEnter: mouseEnterEvent,
|
|
337
|
+
onMouseLeave: mouseLeaveEvent,
|
|
338
|
+
clearPopTimer,
|
|
339
|
+
menuSelected: () => {
|
|
340
|
+
openChange(false);
|
|
341
|
+
window.requestAnimationFrame(() => refSelection.current?.focus({ preventScroll: true }));
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
children: [triggerNode, /* @__PURE__ */ jsx(Teleport, {
|
|
345
|
+
to: "body",
|
|
346
|
+
children: overlayNode
|
|
347
|
+
})]
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
//#endregion
|
|
351
|
+
export { Dropdown as default };
|
|
@@ -0,0 +1,88 @@
|
|
|
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 Button from "../button/button.js";
|
|
10
|
+
import { useDropdownContext } from "./dropdown-context.js";
|
|
11
|
+
import { c } from "react/compiler-runtime";
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
//#region components/dropdown/trigger.tsx
|
|
15
|
+
var TriggerButton = React.forwardRef((t0, ref) => {
|
|
16
|
+
const $ = c(21);
|
|
17
|
+
let children;
|
|
18
|
+
let icon;
|
|
19
|
+
let onMouseEnter;
|
|
20
|
+
let onMouseLeave;
|
|
21
|
+
let rest;
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[0] !== t0) {
|
|
24
|
+
({icon, disabled: t1, children, onMouseEnter, onMouseLeave, ...rest} = t0);
|
|
25
|
+
$[0] = t0;
|
|
26
|
+
$[1] = children;
|
|
27
|
+
$[2] = icon;
|
|
28
|
+
$[3] = onMouseEnter;
|
|
29
|
+
$[4] = onMouseLeave;
|
|
30
|
+
$[5] = rest;
|
|
31
|
+
$[6] = t1;
|
|
32
|
+
} else {
|
|
33
|
+
children = $[1];
|
|
34
|
+
icon = $[2];
|
|
35
|
+
onMouseEnter = $[3];
|
|
36
|
+
onMouseLeave = $[4];
|
|
37
|
+
rest = $[5];
|
|
38
|
+
t1 = $[6];
|
|
39
|
+
}
|
|
40
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
41
|
+
const dropdown = useDropdownContext();
|
|
42
|
+
let t2;
|
|
43
|
+
if ($[7] !== dropdown || $[8] !== onMouseEnter) {
|
|
44
|
+
t2 = (e) => {
|
|
45
|
+
dropdown?.onMouseEnter?.();
|
|
46
|
+
onMouseEnter?.(e);
|
|
47
|
+
};
|
|
48
|
+
$[7] = dropdown;
|
|
49
|
+
$[8] = onMouseEnter;
|
|
50
|
+
$[9] = t2;
|
|
51
|
+
} else t2 = $[9];
|
|
52
|
+
const handleMouseEnter = t2;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[10] !== dropdown || $[11] !== onMouseLeave) {
|
|
55
|
+
t3 = (e_0) => {
|
|
56
|
+
dropdown?.onMouseLeave?.();
|
|
57
|
+
onMouseLeave?.(e_0);
|
|
58
|
+
};
|
|
59
|
+
$[10] = dropdown;
|
|
60
|
+
$[11] = onMouseLeave;
|
|
61
|
+
$[12] = t3;
|
|
62
|
+
} else t3 = $[12];
|
|
63
|
+
const handleMouseLeave = t3;
|
|
64
|
+
let t4;
|
|
65
|
+
if ($[13] !== children || $[14] !== disabled || $[15] !== handleMouseEnter || $[16] !== handleMouseLeave || $[17] !== icon || $[18] !== ref || $[19] !== rest) {
|
|
66
|
+
t4 = /* @__PURE__ */ jsx(Button, {
|
|
67
|
+
ref,
|
|
68
|
+
icon,
|
|
69
|
+
disabled,
|
|
70
|
+
onMouseEnter: handleMouseEnter,
|
|
71
|
+
onMouseLeave: handleMouseLeave,
|
|
72
|
+
...rest,
|
|
73
|
+
children
|
|
74
|
+
});
|
|
75
|
+
$[13] = children;
|
|
76
|
+
$[14] = disabled;
|
|
77
|
+
$[15] = handleMouseEnter;
|
|
78
|
+
$[16] = handleMouseLeave;
|
|
79
|
+
$[17] = icon;
|
|
80
|
+
$[18] = ref;
|
|
81
|
+
$[19] = rest;
|
|
82
|
+
$[20] = t4;
|
|
83
|
+
} else t4 = $[20];
|
|
84
|
+
return t4;
|
|
85
|
+
});
|
|
86
|
+
TriggerButton.displayName = "TriggerButton";
|
|
87
|
+
//#endregion
|
|
88
|
+
export { TriggerButton as default };
|
|
@@ -0,0 +1,133 @@
|
|
|
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 { Inbox } 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 { c } from "react/compiler-runtime";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import React, { useContext } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
//#region components/empty/index.tsx
|
|
18
|
+
var Empty = (t0) => {
|
|
19
|
+
const $ = c(29);
|
|
20
|
+
let children;
|
|
21
|
+
let description;
|
|
22
|
+
let image;
|
|
23
|
+
let imageStyle;
|
|
24
|
+
let rest;
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] !== t0) {
|
|
27
|
+
({description, image, imageStyle, children, className: t1, ...rest} = t0);
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = children;
|
|
30
|
+
$[2] = description;
|
|
31
|
+
$[3] = image;
|
|
32
|
+
$[4] = imageStyle;
|
|
33
|
+
$[5] = rest;
|
|
34
|
+
$[6] = t1;
|
|
35
|
+
} else {
|
|
36
|
+
children = $[1];
|
|
37
|
+
description = $[2];
|
|
38
|
+
image = $[3];
|
|
39
|
+
imageStyle = $[4];
|
|
40
|
+
rest = $[5];
|
|
41
|
+
t1 = $[6];
|
|
42
|
+
}
|
|
43
|
+
const className = t1 === void 0 ? "" : t1;
|
|
44
|
+
const locale = useContext(ConfigContext)?.locale || zh_CN_default;
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[7] !== description || $[8] !== image || $[9] !== imageStyle || $[10] !== locale?.k?.empty?.description) {
|
|
47
|
+
t2 = () => {
|
|
48
|
+
if (!image) return /* @__PURE__ */ jsx(Icon, {
|
|
49
|
+
type: Inbox,
|
|
50
|
+
className: "k-empty-icon",
|
|
51
|
+
strokeWidth: "0.01em"
|
|
52
|
+
});
|
|
53
|
+
if (React.isValidElement(image)) return image;
|
|
54
|
+
return /* @__PURE__ */ jsx("img", {
|
|
55
|
+
src: image,
|
|
56
|
+
className: "k-empty-image",
|
|
57
|
+
style: imageStyle,
|
|
58
|
+
alt: typeof description === "string" ? description : locale?.k?.empty?.description || "Empty state image"
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
$[7] = description;
|
|
62
|
+
$[8] = image;
|
|
63
|
+
$[9] = imageStyle;
|
|
64
|
+
$[10] = locale?.k?.empty?.description;
|
|
65
|
+
$[11] = t2;
|
|
66
|
+
} else t2 = $[11];
|
|
67
|
+
const renderImage = t2;
|
|
68
|
+
const descriptionText = typeof description === "string" ? description : locale?.k?.empty?.description;
|
|
69
|
+
let t3;
|
|
70
|
+
if ($[12] !== description || $[13] !== descriptionText) {
|
|
71
|
+
t3 = description !== false ? /* @__PURE__ */ jsx("p", {
|
|
72
|
+
className: "k-empty-description",
|
|
73
|
+
children: React.isValidElement(description) ? description : descriptionText
|
|
74
|
+
}) : null;
|
|
75
|
+
$[12] = description;
|
|
76
|
+
$[13] = descriptionText;
|
|
77
|
+
$[14] = t3;
|
|
78
|
+
} else t3 = $[14];
|
|
79
|
+
const descriptionNode = t3;
|
|
80
|
+
let t4;
|
|
81
|
+
if ($[15] !== children) {
|
|
82
|
+
t4 = children ? /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: "k-empty-footer",
|
|
84
|
+
children
|
|
85
|
+
}) : null;
|
|
86
|
+
$[15] = children;
|
|
87
|
+
$[16] = t4;
|
|
88
|
+
} else t4 = $[16];
|
|
89
|
+
const footerNode = t4;
|
|
90
|
+
let t5;
|
|
91
|
+
if ($[17] !== className) {
|
|
92
|
+
t5 = clsx("k-empty", className);
|
|
93
|
+
$[17] = className;
|
|
94
|
+
$[18] = t5;
|
|
95
|
+
} else t5 = $[18];
|
|
96
|
+
const classes = t5;
|
|
97
|
+
let t6;
|
|
98
|
+
if ($[19] !== renderImage) {
|
|
99
|
+
t6 = renderImage();
|
|
100
|
+
$[19] = renderImage;
|
|
101
|
+
$[20] = t6;
|
|
102
|
+
} else t6 = $[20];
|
|
103
|
+
let t7;
|
|
104
|
+
if ($[21] !== descriptionNode || $[22] !== footerNode || $[23] !== t6) {
|
|
105
|
+
t7 = /* @__PURE__ */ jsxs("div", {
|
|
106
|
+
className: "k-empty-content",
|
|
107
|
+
children: [
|
|
108
|
+
t6,
|
|
109
|
+
descriptionNode,
|
|
110
|
+
footerNode
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
$[21] = descriptionNode;
|
|
114
|
+
$[22] = footerNode;
|
|
115
|
+
$[23] = t6;
|
|
116
|
+
$[24] = t7;
|
|
117
|
+
} else t7 = $[24];
|
|
118
|
+
let t8;
|
|
119
|
+
if ($[25] !== classes || $[26] !== rest || $[27] !== t7) {
|
|
120
|
+
t8 = /* @__PURE__ */ jsx("div", {
|
|
121
|
+
className: classes,
|
|
122
|
+
...rest,
|
|
123
|
+
children: t7
|
|
124
|
+
});
|
|
125
|
+
$[25] = classes;
|
|
126
|
+
$[26] = rest;
|
|
127
|
+
$[27] = t7;
|
|
128
|
+
$[28] = t8;
|
|
129
|
+
} else t8 = $[28];
|
|
130
|
+
return t8;
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
export { Empty as default };
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { normalizeSurfaceShape, useConfigAppearance } from "../config/use-config-appearance.js";
|
|
10
|
+
import Icon from "../icon/index.js";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
//#region components/feature-card/index.tsx
|
|
14
|
+
function FeatureCard({ icon, title, desc, bordered = false, theme: themeProp, shape: shapeProp, size: sizeProp, direction = "horizontal", clickable = false, disabled = false, color, iconBackground, children, extra, onClick, className, ...rest }) {
|
|
15
|
+
const inheritedAppearance = useConfigAppearance();
|
|
16
|
+
const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
|
|
17
|
+
const shape = normalizeSurfaceShape(shapeProp ?? inheritedAppearance.shape ?? "round");
|
|
18
|
+
const size = sizeProp ?? inheritedAppearance.size ?? "medium";
|
|
19
|
+
const handleKeyDown = (event) => {
|
|
20
|
+
if (event.target !== event.currentTarget) return;
|
|
21
|
+
if (!clickable || disabled || event.key !== "Enter" && event.key !== " ") return;
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
event.currentTarget.click();
|
|
24
|
+
};
|
|
25
|
+
const isLibraryIcon = Array.isArray(icon) && icon.every((item) => typeof item === "object" && item != null && "d" in item && typeof item.d === "string");
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
...rest,
|
|
28
|
+
onClick: disabled ? void 0 : onClick,
|
|
29
|
+
onKeyDown: handleKeyDown,
|
|
30
|
+
role: clickable ? "button" : void 0,
|
|
31
|
+
tabIndex: clickable && !disabled ? 0 : void 0,
|
|
32
|
+
"aria-disabled": clickable && disabled ? true : void 0,
|
|
33
|
+
style: {
|
|
34
|
+
...rest.style,
|
|
35
|
+
...color ? { "--k-feature-card-color": color } : {},
|
|
36
|
+
...iconBackground ? { "--k-feature-card-icon-bg": iconBackground } : {}
|
|
37
|
+
},
|
|
38
|
+
className: clsx("k-feature-card", {
|
|
39
|
+
"k-feature-card-bordered": bordered,
|
|
40
|
+
[`k-feature-card-${theme}`]: theme,
|
|
41
|
+
[`k-feature-card-${shape}`]: shape,
|
|
42
|
+
[`k-feature-card-${size}`]: size,
|
|
43
|
+
[`k-feature-card-${direction}`]: direction,
|
|
44
|
+
"k-feature-card-clickable": clickable,
|
|
45
|
+
"k-feature-card-disabled": disabled
|
|
46
|
+
}, className),
|
|
47
|
+
children: [
|
|
48
|
+
icon != null && /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "k-feature-card-icon",
|
|
50
|
+
children: isLibraryIcon ? /* @__PURE__ */ jsx(Icon, { type: icon }) : icon
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "k-feature-card-content",
|
|
54
|
+
children: [
|
|
55
|
+
title != null && /* @__PURE__ */ jsx("div", {
|
|
56
|
+
className: "k-feature-card-title",
|
|
57
|
+
children: title
|
|
58
|
+
}),
|
|
59
|
+
desc != null && /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: "k-feature-card-desc",
|
|
61
|
+
children: desc
|
|
62
|
+
}),
|
|
63
|
+
children
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
extra != null && /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: "k-feature-card-extra",
|
|
68
|
+
children: extra
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { FeatureCard as default };
|