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,85 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { Button, Input, Page, Space, Table, type Column } from "react-kui";
|
|
3
|
+
|
|
4
|
+
type Row = { id: number; name: string };
|
|
5
|
+
const allRows: Row[] = Array.from({ length: 47 }, (_, index) => ({
|
|
6
|
+
id: index + 1,
|
|
7
|
+
name: `用户 ${index + 1}`,
|
|
8
|
+
}));
|
|
9
|
+
const columns: Column<Row>[] = [
|
|
10
|
+
{ title: "编号", key: "id" },
|
|
11
|
+
{ title: "姓名", key: "name" },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default function App() {
|
|
15
|
+
const [keyword, setKeyword] = useState("");
|
|
16
|
+
const [request, setRequest] = useState({ query: "", page: 1, pageSize: 10, revision: 0 });
|
|
17
|
+
const [result, setResult] = useState({ data: [] as Row[], total: 0, loading: true, error: "" });
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
let canceled = false;
|
|
20
|
+
async function load() {
|
|
21
|
+
await Promise.resolve();
|
|
22
|
+
if (canceled) return;
|
|
23
|
+
setResult((previous) => ({ ...previous, loading: true, error: "" }));
|
|
24
|
+
try {
|
|
25
|
+
// Replace this local mock with an API returning { data, total }.
|
|
26
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
27
|
+
const rows = allRows.filter((row) => row.name.includes(request.query));
|
|
28
|
+
if (!canceled)
|
|
29
|
+
setResult({
|
|
30
|
+
data: rows.slice(
|
|
31
|
+
(request.page - 1) * request.pageSize,
|
|
32
|
+
request.page * request.pageSize,
|
|
33
|
+
),
|
|
34
|
+
total: rows.length,
|
|
35
|
+
loading: false,
|
|
36
|
+
error: "",
|
|
37
|
+
});
|
|
38
|
+
} catch {
|
|
39
|
+
if (!canceled)
|
|
40
|
+
setResult((previous) => ({ ...previous, loading: false, error: "加载失败,请重试" }));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
void load();
|
|
44
|
+
return () => {
|
|
45
|
+
canceled = true;
|
|
46
|
+
};
|
|
47
|
+
}, [request]);
|
|
48
|
+
return (
|
|
49
|
+
<Space vertical block>
|
|
50
|
+
<Space>
|
|
51
|
+
<Input value={keyword} onChange={setKeyword} placeholder="搜索姓名" />
|
|
52
|
+
<Button
|
|
53
|
+
type="primary"
|
|
54
|
+
onClick={() =>
|
|
55
|
+
setRequest((previous) => ({
|
|
56
|
+
...previous,
|
|
57
|
+
query: keyword.trim(),
|
|
58
|
+
page: 1,
|
|
59
|
+
revision: previous.revision + 1,
|
|
60
|
+
}))
|
|
61
|
+
}
|
|
62
|
+
>
|
|
63
|
+
搜索
|
|
64
|
+
</Button>
|
|
65
|
+
<Button
|
|
66
|
+
disabled={result.loading}
|
|
67
|
+
onClick={() =>
|
|
68
|
+
setRequest((previous) => ({ ...previous, revision: previous.revision + 1 }))
|
|
69
|
+
}
|
|
70
|
+
>
|
|
71
|
+
刷新
|
|
72
|
+
</Button>
|
|
73
|
+
</Space>
|
|
74
|
+
{result.error && <p role="alert">{result.error}</p>}
|
|
75
|
+
<Table<Row> rowKey="id" columns={columns} data={result.data} loading={result.loading} />
|
|
76
|
+
<Page
|
|
77
|
+
page={request.page}
|
|
78
|
+
pageSize={request.pageSize}
|
|
79
|
+
total={result.total}
|
|
80
|
+
showSizer
|
|
81
|
+
onChange={(page, pageSize) => setRequest((previous) => ({ ...previous, page, pageSize }))}
|
|
82
|
+
/>
|
|
83
|
+
</Space>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UsageIssue {
|
|
2
|
+
kind: string;
|
|
3
|
+
message: string;
|
|
4
|
+
line?: number;
|
|
5
|
+
column?: number;
|
|
6
|
+
component?: string;
|
|
7
|
+
prop?: string;
|
|
8
|
+
}
|
|
9
|
+
export function validateUsage(source: string, metadata: unknown): {
|
|
10
|
+
valid: boolean;
|
|
11
|
+
complete: false;
|
|
12
|
+
scope: string;
|
|
13
|
+
issues: UsageIssue[];
|
|
14
|
+
skipped: string[];
|
|
15
|
+
nextStep?: string;
|
|
16
|
+
};
|
package/ai/validate.mjs
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { parse } from "@babel/parser";
|
|
2
|
+
|
|
3
|
+
const jsxName = (node) =>
|
|
4
|
+
!node
|
|
5
|
+
? ""
|
|
6
|
+
: node.type === "JSXIdentifier"
|
|
7
|
+
? node.name
|
|
8
|
+
: node.type === "JSXMemberExpression"
|
|
9
|
+
? `${jsxName(node.object)}.${jsxName(node.property)}`
|
|
10
|
+
: `${jsxName(node.namespace)}:${jsxName(node.name)}`;
|
|
11
|
+
const literal = (node) => {
|
|
12
|
+
if (!node) return { known: true, value: true };
|
|
13
|
+
if (node.type === "JSXExpressionContainer") return literal(node.expression);
|
|
14
|
+
if (["StringLiteral", "BooleanLiteral", "NumericLiteral"].includes(node.type))
|
|
15
|
+
return { known: true, value: node.value };
|
|
16
|
+
if (node.type === "NullLiteral") return { known: true, value: null };
|
|
17
|
+
if (
|
|
18
|
+
node.type === "UnaryExpression" &&
|
|
19
|
+
node.operator === "-" &&
|
|
20
|
+
node.argument.type === "NumericLiteral"
|
|
21
|
+
)
|
|
22
|
+
return { known: true, value: -node.argument.value };
|
|
23
|
+
return { known: false };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export function validateUsage(source, metadata) {
|
|
27
|
+
const issues = [];
|
|
28
|
+
const skipped = new Set();
|
|
29
|
+
const add = (kind, message, node, extra = {}) =>
|
|
30
|
+
issues.push({
|
|
31
|
+
kind,
|
|
32
|
+
message,
|
|
33
|
+
line: (node.loc?.start ?? node.loc)?.line,
|
|
34
|
+
column: ((node.loc?.start ?? node.loc)?.column ?? 0) + 1,
|
|
35
|
+
...extra,
|
|
36
|
+
});
|
|
37
|
+
let ast;
|
|
38
|
+
try {
|
|
39
|
+
ast = parse(source, {
|
|
40
|
+
sourceType: "module",
|
|
41
|
+
plugins: ["typescript", "jsx"],
|
|
42
|
+
errorRecovery: true,
|
|
43
|
+
});
|
|
44
|
+
for (const error of ast.errors) add("syntax", error.message, error);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
add("syntax", error.message, error);
|
|
47
|
+
return { valid: false, complete: false, scope: "static-jsx", issues, skipped: [] };
|
|
48
|
+
}
|
|
49
|
+
const byName = new Map(metadata.components.map((c) => [c.name, c]));
|
|
50
|
+
const bindings = new Map();
|
|
51
|
+
const namespaces = new Set();
|
|
52
|
+
let hasImports = false;
|
|
53
|
+
for (const node of ast.program.body) {
|
|
54
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
55
|
+
hasImports = true;
|
|
56
|
+
const own = node.source.value === "react-kui";
|
|
57
|
+
for (const spec of node.specifiers) {
|
|
58
|
+
if (!own) continue;
|
|
59
|
+
if (node.importKind === "type" || spec.importKind === "type") continue;
|
|
60
|
+
if (spec.type === "ImportNamespaceSpecifier") namespaces.add(spec.local.name);
|
|
61
|
+
else if (spec.type === "ImportSpecifier") {
|
|
62
|
+
const name = spec.imported.name || spec.imported.value;
|
|
63
|
+
bindings.set(spec.local.name, name);
|
|
64
|
+
if (metadata.exports && !metadata.exports.includes(name))
|
|
65
|
+
add("import", `Unknown react-kui export: ${name}`, spec);
|
|
66
|
+
// Non-component helper exports are allowed; only flag them if used as JSX.
|
|
67
|
+
} else {
|
|
68
|
+
skipped.add("default export is version metadata; use named imports for components");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const resolve = (name) => {
|
|
73
|
+
if (bindings.has(name)) return { name: bindings.get(name), explicit: true };
|
|
74
|
+
const [namespace, member] = name.split(".");
|
|
75
|
+
if (namespaces.has(namespace) && member) return { name: member, explicit: true };
|
|
76
|
+
// Bare JSX fragments are supported, but other imports must never be mistaken for KUI.
|
|
77
|
+
if (!hasImports && byName.has(name)) return { name, explicit: false };
|
|
78
|
+
return undefined;
|
|
79
|
+
};
|
|
80
|
+
const walk = (node) => {
|
|
81
|
+
if (!node || typeof node !== "object") return;
|
|
82
|
+
if (node.type === "JSXOpeningElement") {
|
|
83
|
+
const tag = jsxName(node.name);
|
|
84
|
+
const resolved = resolve(tag);
|
|
85
|
+
const component = resolved && byName.get(resolved.name);
|
|
86
|
+
if (resolved && !component)
|
|
87
|
+
add("component", `Unknown react-kui component export: ${resolved.name}`, node);
|
|
88
|
+
else if (!component && /^[A-Z]/.test(tag))
|
|
89
|
+
skipped.add(`unresolved or custom component: ${tag}`);
|
|
90
|
+
const props = new Map(component?.props.map((p) => [p.name, p]) || []);
|
|
91
|
+
const native = new Set(component?.nativeProps || []);
|
|
92
|
+
const present = new Set();
|
|
93
|
+
let spread = false;
|
|
94
|
+
for (const attr of node.attributes) {
|
|
95
|
+
if (attr.type === "JSXSpreadAttribute") {
|
|
96
|
+
spread = true;
|
|
97
|
+
skipped.add("spread props and their override order");
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const name = jsxName(attr.name);
|
|
101
|
+
if (
|
|
102
|
+
/^(v-|@|:)/.test(name) ||
|
|
103
|
+
name === "class" ||
|
|
104
|
+
name === "for" ||
|
|
105
|
+
name.startsWith("onUpdate:")
|
|
106
|
+
) {
|
|
107
|
+
add("framework", `Use React JSX props instead of ${name}`, attr);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (!component) continue;
|
|
111
|
+
present.add(name);
|
|
112
|
+
const nativeType = component.nativeValueTypes?.[name];
|
|
113
|
+
const prop =
|
|
114
|
+
props.get(name) ||
|
|
115
|
+
(nativeType ? { name, type: nativeType, boolean: nativeType === "boolean" } : undefined);
|
|
116
|
+
if (!prop) {
|
|
117
|
+
if (!native.has(name) && !["key", "ref"].includes(name) && !/^(data-|aria-)/.test(name))
|
|
118
|
+
add(
|
|
119
|
+
/^on[A-Z]/.test(name) ? "event" : "prop",
|
|
120
|
+
`Unknown prop ${name} on ${component.name}`,
|
|
121
|
+
attr,
|
|
122
|
+
{ component: component.name, prop: name },
|
|
123
|
+
);
|
|
124
|
+
if (native.has(name) && /^on[A-Z]/.test(name) && literal(attr.value).known)
|
|
125
|
+
add("event", `${name} requires a callback`, attr);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const value = literal(attr.value);
|
|
129
|
+
if (!value.known) {
|
|
130
|
+
skipped.add("expression types and callback signatures");
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (prop.enumValues && !prop.enumValues.includes(value.value))
|
|
134
|
+
add(
|
|
135
|
+
"value",
|
|
136
|
+
`Invalid ${name}; expected ${prop.enumValues.map((v) => JSON.stringify(v)).join(" | ")}`,
|
|
137
|
+
attr,
|
|
138
|
+
{ component: component.name, prop: name },
|
|
139
|
+
);
|
|
140
|
+
else if (prop.boolean && typeof value.value !== "boolean")
|
|
141
|
+
add("value", `${name} requires a boolean`, attr, {
|
|
142
|
+
component: component.name,
|
|
143
|
+
prop: name,
|
|
144
|
+
});
|
|
145
|
+
else if (
|
|
146
|
+
/^(number|string)( \| undefined)?$/.test(prop.type) &&
|
|
147
|
+
typeof value.value !== prop.type.split(" ")[0]
|
|
148
|
+
)
|
|
149
|
+
add("value", `${name} has an invalid primitive value`, attr, {
|
|
150
|
+
component: component.name,
|
|
151
|
+
prop: name,
|
|
152
|
+
});
|
|
153
|
+
else if (/^on[A-Z]/.test(name) && value.value !== null)
|
|
154
|
+
add("event", `${name} requires a callback`, attr, {
|
|
155
|
+
component: component.name,
|
|
156
|
+
prop: name,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (component && !spread)
|
|
160
|
+
for (const prop of props.values()) {
|
|
161
|
+
if (prop.required && prop.name !== "children" && !present.has(prop.name))
|
|
162
|
+
add("required", `Missing required prop ${prop.name} on ${component.name}`, node, {
|
|
163
|
+
component: component.name,
|
|
164
|
+
prop: prop.name,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
for (const [key, value] of Object.entries(node)) {
|
|
169
|
+
if (["loc", "tokens", "comments", "errors"].includes(key)) continue;
|
|
170
|
+
if (Array.isArray(value)) value.forEach(walk);
|
|
171
|
+
else if (value && typeof value === "object") walk(value);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
walk(ast.program);
|
|
175
|
+
return {
|
|
176
|
+
valid: !issues.length,
|
|
177
|
+
complete: false,
|
|
178
|
+
scope: "static-jsx",
|
|
179
|
+
issues,
|
|
180
|
+
skipped: [...skipped],
|
|
181
|
+
nextStep:
|
|
182
|
+
"Run tsc --noEmit and interaction tests. This check does not evaluate expressions, resolve local wrappers or verify callback types/runtime behavior.",
|
|
183
|
+
};
|
|
184
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __exportAll = (all, no_symbols) => {
|
|
12
|
+
let target = {};
|
|
13
|
+
for (var name in all) __defProp(target, name, {
|
|
14
|
+
get: all[name],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { __exportAll };
|
|
@@ -0,0 +1,222 @@
|
|
|
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 { c } from "react/compiler-runtime";
|
|
10
|
+
import clsx from "clsx";
|
|
11
|
+
import { useEffect, useRef, useState } from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
//#region components/affix/index.tsx
|
|
14
|
+
var defaultTarget = () => typeof window === "undefined" ? null : window;
|
|
15
|
+
function isSameStyle(current, next) {
|
|
16
|
+
const currentStyle = current;
|
|
17
|
+
const nextStyle = next;
|
|
18
|
+
const currentKeys = Object.keys(currentStyle);
|
|
19
|
+
const nextKeys = Object.keys(nextStyle);
|
|
20
|
+
return currentKeys.length === nextKeys.length && currentKeys.every((key) => currentStyle[key] === nextStyle[key]);
|
|
21
|
+
}
|
|
22
|
+
function Affix(t0) {
|
|
23
|
+
const $ = c(37);
|
|
24
|
+
let children;
|
|
25
|
+
let className;
|
|
26
|
+
let offsetBottom;
|
|
27
|
+
let onChange;
|
|
28
|
+
let rest;
|
|
29
|
+
let style;
|
|
30
|
+
let t1;
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[0] !== t0) {
|
|
33
|
+
({children, offsetTop: t1, offsetBottom, target: t2, onChange, className, style, ...rest} = t0);
|
|
34
|
+
$[0] = t0;
|
|
35
|
+
$[1] = children;
|
|
36
|
+
$[2] = className;
|
|
37
|
+
$[3] = offsetBottom;
|
|
38
|
+
$[4] = onChange;
|
|
39
|
+
$[5] = rest;
|
|
40
|
+
$[6] = style;
|
|
41
|
+
$[7] = t1;
|
|
42
|
+
$[8] = t2;
|
|
43
|
+
} else {
|
|
44
|
+
children = $[1];
|
|
45
|
+
className = $[2];
|
|
46
|
+
offsetBottom = $[3];
|
|
47
|
+
onChange = $[4];
|
|
48
|
+
rest = $[5];
|
|
49
|
+
style = $[6];
|
|
50
|
+
t1 = $[7];
|
|
51
|
+
t2 = $[8];
|
|
52
|
+
}
|
|
53
|
+
const offsetTop = t1 === void 0 ? 0 : t1;
|
|
54
|
+
const target = t2 === void 0 ? defaultTarget : t2;
|
|
55
|
+
const wrapperRef = useRef(null);
|
|
56
|
+
const innerRef = useRef(null);
|
|
57
|
+
const targetRef = useRef(null);
|
|
58
|
+
const frameRef = useRef(null);
|
|
59
|
+
const fixedRef = useRef(false);
|
|
60
|
+
const onChangeRef = useRef(onChange);
|
|
61
|
+
const [fixed, setFixed] = useState(false);
|
|
62
|
+
let t3;
|
|
63
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t3 = {};
|
|
65
|
+
$[9] = t3;
|
|
66
|
+
} else t3 = $[9];
|
|
67
|
+
const [affixStyle, setAffixStyle] = useState(t3);
|
|
68
|
+
let t4;
|
|
69
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t4 = {};
|
|
71
|
+
$[10] = t4;
|
|
72
|
+
} else t4 = $[10];
|
|
73
|
+
const [placeholderStyle, setPlaceholderStyle] = useState(t4);
|
|
74
|
+
let t5;
|
|
75
|
+
let t6;
|
|
76
|
+
if ($[11] !== onChange) {
|
|
77
|
+
t5 = () => {
|
|
78
|
+
onChangeRef.current = onChange;
|
|
79
|
+
};
|
|
80
|
+
t6 = [onChange];
|
|
81
|
+
$[11] = onChange;
|
|
82
|
+
$[12] = t5;
|
|
83
|
+
$[13] = t6;
|
|
84
|
+
} else {
|
|
85
|
+
t5 = $[12];
|
|
86
|
+
t6 = $[13];
|
|
87
|
+
}
|
|
88
|
+
useEffect(t5, t6);
|
|
89
|
+
let t7;
|
|
90
|
+
if ($[14] !== offsetBottom || $[15] !== offsetTop) {
|
|
91
|
+
t7 = () => {
|
|
92
|
+
frameRef.current = null;
|
|
93
|
+
const wrapper = wrapperRef.current;
|
|
94
|
+
const inner = innerRef.current;
|
|
95
|
+
const scrollTarget = targetRef.current;
|
|
96
|
+
if (!wrapper || !inner || !scrollTarget || typeof window === "undefined") return;
|
|
97
|
+
const rect = wrapper.getBoundingClientRect();
|
|
98
|
+
const targetRect = scrollTarget === window ? {
|
|
99
|
+
top: 0,
|
|
100
|
+
bottom: window.innerHeight
|
|
101
|
+
} : scrollTarget.getBoundingClientRect();
|
|
102
|
+
const nextFixed = offsetBottom !== void 0 ? targetRect.bottom - rect.bottom - offsetBottom <= 0 : rect.top - targetRect.top - offsetTop <= 0;
|
|
103
|
+
let nextStyle = {};
|
|
104
|
+
if (offsetBottom !== void 0) {
|
|
105
|
+
if (nextFixed) nextStyle = {
|
|
106
|
+
position: "fixed",
|
|
107
|
+
bottom: window.innerHeight - targetRect.bottom + offsetBottom,
|
|
108
|
+
left: rect.left,
|
|
109
|
+
width: rect.width
|
|
110
|
+
};
|
|
111
|
+
} else if (nextFixed) nextStyle = {
|
|
112
|
+
position: "fixed",
|
|
113
|
+
top: targetRect.top + offsetTop,
|
|
114
|
+
left: rect.left,
|
|
115
|
+
width: rect.width
|
|
116
|
+
};
|
|
117
|
+
const nextPlaceholderStyle = nextFixed ? { height: inner.getBoundingClientRect().height } : {};
|
|
118
|
+
setAffixStyle((current) => isSameStyle(current, nextStyle) ? current : nextStyle);
|
|
119
|
+
setPlaceholderStyle((current_0) => isSameStyle(current_0, nextPlaceholderStyle) ? current_0 : nextPlaceholderStyle);
|
|
120
|
+
if (fixedRef.current !== nextFixed) {
|
|
121
|
+
fixedRef.current = nextFixed;
|
|
122
|
+
setFixed(nextFixed);
|
|
123
|
+
onChangeRef.current?.(nextFixed);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
$[14] = offsetBottom;
|
|
127
|
+
$[15] = offsetTop;
|
|
128
|
+
$[16] = t7;
|
|
129
|
+
} else t7 = $[16];
|
|
130
|
+
const updatePosition = t7;
|
|
131
|
+
let t8;
|
|
132
|
+
if ($[17] !== updatePosition) {
|
|
133
|
+
t8 = () => {
|
|
134
|
+
if (frameRef.current !== null || typeof window === "undefined") return;
|
|
135
|
+
frameRef.current = window.requestAnimationFrame(updatePosition);
|
|
136
|
+
};
|
|
137
|
+
$[17] = updatePosition;
|
|
138
|
+
$[18] = t8;
|
|
139
|
+
} else t8 = $[18];
|
|
140
|
+
const scheduleUpdate = t8;
|
|
141
|
+
let t10;
|
|
142
|
+
let t9;
|
|
143
|
+
if ($[19] !== scheduleUpdate || $[20] !== target) {
|
|
144
|
+
t9 = () => {
|
|
145
|
+
if (typeof window === "undefined" || !wrapperRef.current || !innerRef.current) return;
|
|
146
|
+
targetRef.current = target();
|
|
147
|
+
const scrollTarget_0 = targetRef.current;
|
|
148
|
+
if (!scrollTarget_0) return;
|
|
149
|
+
window.addEventListener("scroll", scheduleUpdate, true);
|
|
150
|
+
window.addEventListener("resize", scheduleUpdate);
|
|
151
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(scheduleUpdate);
|
|
152
|
+
observer?.observe(wrapperRef.current);
|
|
153
|
+
observer?.observe(innerRef.current);
|
|
154
|
+
if (scrollTarget_0 !== window) observer?.observe(scrollTarget_0);
|
|
155
|
+
scheduleUpdate();
|
|
156
|
+
return () => {
|
|
157
|
+
window.removeEventListener("scroll", scheduleUpdate, true);
|
|
158
|
+
window.removeEventListener("resize", scheduleUpdate);
|
|
159
|
+
observer?.disconnect();
|
|
160
|
+
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
161
|
+
frameRef.current = null;
|
|
162
|
+
targetRef.current = null;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
t10 = [scheduleUpdate, target];
|
|
166
|
+
$[19] = scheduleUpdate;
|
|
167
|
+
$[20] = target;
|
|
168
|
+
$[21] = t10;
|
|
169
|
+
$[22] = t9;
|
|
170
|
+
} else {
|
|
171
|
+
t10 = $[21];
|
|
172
|
+
t9 = $[22];
|
|
173
|
+
}
|
|
174
|
+
useEffect(t9, t10);
|
|
175
|
+
let t11;
|
|
176
|
+
if ($[23] !== placeholderStyle || $[24] !== style) {
|
|
177
|
+
t11 = {
|
|
178
|
+
...style,
|
|
179
|
+
...placeholderStyle
|
|
180
|
+
};
|
|
181
|
+
$[23] = placeholderStyle;
|
|
182
|
+
$[24] = style;
|
|
183
|
+
$[25] = t11;
|
|
184
|
+
} else t11 = $[25];
|
|
185
|
+
let t12;
|
|
186
|
+
if ($[26] !== fixed) {
|
|
187
|
+
t12 = clsx("k-affix", { "k-affix-fixed": fixed });
|
|
188
|
+
$[26] = fixed;
|
|
189
|
+
$[27] = t12;
|
|
190
|
+
} else t12 = $[27];
|
|
191
|
+
let t13;
|
|
192
|
+
if ($[28] !== affixStyle || $[29] !== children || $[30] !== t12) {
|
|
193
|
+
t13 = /* @__PURE__ */ jsx("div", {
|
|
194
|
+
ref: innerRef,
|
|
195
|
+
className: t12,
|
|
196
|
+
style: affixStyle,
|
|
197
|
+
children
|
|
198
|
+
});
|
|
199
|
+
$[28] = affixStyle;
|
|
200
|
+
$[29] = children;
|
|
201
|
+
$[30] = t12;
|
|
202
|
+
$[31] = t13;
|
|
203
|
+
} else t13 = $[31];
|
|
204
|
+
let t14;
|
|
205
|
+
if ($[32] !== className || $[33] !== rest || $[34] !== t11 || $[35] !== t13) {
|
|
206
|
+
t14 = /* @__PURE__ */ jsx("div", {
|
|
207
|
+
...rest,
|
|
208
|
+
ref: wrapperRef,
|
|
209
|
+
className,
|
|
210
|
+
style: t11,
|
|
211
|
+
children: t13
|
|
212
|
+
});
|
|
213
|
+
$[32] = className;
|
|
214
|
+
$[33] = rest;
|
|
215
|
+
$[34] = t11;
|
|
216
|
+
$[35] = t13;
|
|
217
|
+
$[36] = t14;
|
|
218
|
+
} else t14 = $[36];
|
|
219
|
+
return t14;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
export { Affix as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { useConfigAppearance } from "../config/use-config-appearance.js";
|
|
10
|
+
import { CircleAlert, CircleCheck, CircleX, Info, X } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
11
|
+
import Icon from "../icon/index.js";
|
|
12
|
+
import clsx from "clsx";
|
|
13
|
+
import { useState } from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
//#region components/alert/index.tsx
|
|
16
|
+
var Alert = ({ type = "warning", closable = false, showIcon = true, icon, message, description, bordered = false, theme: themeProp, shape: shapeProp, onClose, children, className = "", ...rest }) => {
|
|
17
|
+
const inheritedAppearance = useConfigAppearance();
|
|
18
|
+
const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
|
|
19
|
+
const shape = shapeProp ?? inheritedAppearance.shape ?? "round";
|
|
20
|
+
const [closed, setClosed] = useState(false);
|
|
21
|
+
const close = (e) => {
|
|
22
|
+
setClosed(true);
|
|
23
|
+
onClose?.(e);
|
|
24
|
+
};
|
|
25
|
+
if (closed) return null;
|
|
26
|
+
const iconNode = showIcon ? /* @__PURE__ */ jsx(Icon, {
|
|
27
|
+
type: icon ? icon : {
|
|
28
|
+
info: Info,
|
|
29
|
+
error: CircleX,
|
|
30
|
+
success: CircleCheck,
|
|
31
|
+
warning: CircleAlert
|
|
32
|
+
}[type],
|
|
33
|
+
className: "k-alert-icon"
|
|
34
|
+
}) : null;
|
|
35
|
+
const closeIcon = closable ? /* @__PURE__ */ jsx(Icon, {
|
|
36
|
+
className: "k-alert-close",
|
|
37
|
+
type: X,
|
|
38
|
+
onClick: close
|
|
39
|
+
}) : null;
|
|
40
|
+
const descriptionNode = description ? /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "k-alert-description",
|
|
42
|
+
children: description
|
|
43
|
+
}) : null;
|
|
44
|
+
const msgNode = /* @__PURE__ */ jsx("div", {
|
|
45
|
+
className: "k-alert-message",
|
|
46
|
+
children: message || children
|
|
47
|
+
});
|
|
48
|
+
const classes = clsx("k-alert", {
|
|
49
|
+
[`k-alert-${type}`]: type,
|
|
50
|
+
"k-alert-has-icon": showIcon,
|
|
51
|
+
"k-alert-has-close": closable,
|
|
52
|
+
"k-alert-bordered": bordered,
|
|
53
|
+
[`k-alert-theme-${theme}`]: theme,
|
|
54
|
+
[`k-alert-shape-${shape}`]: shape,
|
|
55
|
+
"k-alert-has-description": description
|
|
56
|
+
}, className);
|
|
57
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
58
|
+
className: classes,
|
|
59
|
+
...rest,
|
|
60
|
+
children: [
|
|
61
|
+
iconNode,
|
|
62
|
+
/* @__PURE__ */ jsxs("div", {
|
|
63
|
+
className: "k-alert-content",
|
|
64
|
+
children: [msgNode, descriptionNode]
|
|
65
|
+
}),
|
|
66
|
+
closeIcon
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { Alert as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { createContext } from "react";
|
|
10
|
+
//#region components/anchor/anchor-context.ts
|
|
11
|
+
var AnchorContext = createContext(null);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { AnchorContext };
|