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,204 @@
|
|
|
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 { useConfigAppearance } from "../config/use-config-appearance.js";
|
|
12
|
+
import Button from "../button/button.js";
|
|
13
|
+
import Spin from "../spin/index.js";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useRef } from "react";
|
|
16
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import Color from "color";
|
|
18
|
+
import { toCanvas } from "qrcode";
|
|
19
|
+
//#region components/qrcode/index.tsx
|
|
20
|
+
var positive = (value, fallback) => Number.isFinite(value) && value > 0 ? value : fallback;
|
|
21
|
+
var resolveColor = (input, parent, fallback) => {
|
|
22
|
+
if (!input.trim().startsWith("var(")) return input;
|
|
23
|
+
const element = document.createElement("span");
|
|
24
|
+
element.style.color = input;
|
|
25
|
+
(parent ?? document.body).appendChild(element);
|
|
26
|
+
const computed = getComputedStyle(element).color;
|
|
27
|
+
element.remove();
|
|
28
|
+
if (!computed || computed.includes("var(")) return fallback;
|
|
29
|
+
try {
|
|
30
|
+
return Color(computed).hex();
|
|
31
|
+
} catch {
|
|
32
|
+
return fallback;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var loadImage = (src) => new Promise((resolve) => {
|
|
36
|
+
const image = new Image();
|
|
37
|
+
image.crossOrigin = "anonymous";
|
|
38
|
+
image.onload = () => resolve(image);
|
|
39
|
+
image.onerror = () => resolve(null);
|
|
40
|
+
image.src = src;
|
|
41
|
+
});
|
|
42
|
+
var QRCode = forwardRef(function QRCode({ value, size = 160, colorDark = "var(--kui-color-reverse)", colorLight = "var(--kui-color-bg)", bordered = true, shape: shapeProp, theme: themeProp, status = "active", logo = "", logoSize, margin = 0, logoRadius = 4, logoBorder = true, errorLevel = "M", loadingContent, expiredContent, scannedContent, onRefresh, className, style, ...rest }, ref) {
|
|
43
|
+
const inheritedAppearance = useConfigAppearance();
|
|
44
|
+
const shape = shapeProp ?? inheritedAppearance.shape ?? "round";
|
|
45
|
+
const theme = themeProp ?? inheritedAppearance.theme ?? "outline";
|
|
46
|
+
const canvasRef = useRef(null);
|
|
47
|
+
const drawIdRef = useRef(0);
|
|
48
|
+
const drawnRef = useRef(false);
|
|
49
|
+
const drawPromiseRef = useRef(Promise.resolve());
|
|
50
|
+
const safeSize = positive(size, 160);
|
|
51
|
+
const safeMargin = Number.isFinite(margin) ? Math.max(0, Math.floor(margin)) : 0;
|
|
52
|
+
const { locale } = useContext(ConfigContext);
|
|
53
|
+
const messages = (locale ?? zh_CN_default)?.k?.qrcode;
|
|
54
|
+
const draw = useCallback(async () => {
|
|
55
|
+
const canvas = canvasRef.current;
|
|
56
|
+
if (!canvas) return;
|
|
57
|
+
const drawId = ++drawIdRef.current;
|
|
58
|
+
const ratio = positive(window.devicePixelRatio, 1);
|
|
59
|
+
const pixelSize = Math.max(1, Math.round(safeSize * ratio));
|
|
60
|
+
const dark = resolveColor(colorDark, canvas.parentElement, "#000000");
|
|
61
|
+
const light = resolveColor(colorLight, canvas.parentElement, "#ffffff");
|
|
62
|
+
const memory = document.createElement("canvas");
|
|
63
|
+
const options = {
|
|
64
|
+
width: pixelSize,
|
|
65
|
+
margin: safeMargin,
|
|
66
|
+
color: {
|
|
67
|
+
dark,
|
|
68
|
+
light
|
|
69
|
+
},
|
|
70
|
+
errorCorrectionLevel: errorLevel
|
|
71
|
+
};
|
|
72
|
+
try {
|
|
73
|
+
await toCanvas(memory, value || " ", options);
|
|
74
|
+
if (logo) {
|
|
75
|
+
const image = await loadImage(logo);
|
|
76
|
+
if (drawId !== drawIdRef.current) return;
|
|
77
|
+
const context = memory.getContext("2d");
|
|
78
|
+
if (image && context) {
|
|
79
|
+
const requestedLogoSize = positive(logoSize ?? safeSize * .22, safeSize * .22);
|
|
80
|
+
const finalSize = Math.min(safeSize, requestedLogoSize) * ratio;
|
|
81
|
+
const radius = Math.min(Math.max(0, logoRadius), requestedLogoSize / 2) * ratio;
|
|
82
|
+
const x = (pixelSize - finalSize) / 2;
|
|
83
|
+
const y = (pixelSize - finalSize) / 2;
|
|
84
|
+
context.save();
|
|
85
|
+
if (logoBorder) {
|
|
86
|
+
const borderSize = Math.min(pixelSize, finalSize + 6 * ratio);
|
|
87
|
+
context.fillStyle = light;
|
|
88
|
+
context.beginPath();
|
|
89
|
+
context.roundRect((pixelSize - borderSize) / 2, (pixelSize - borderSize) / 2, borderSize, borderSize, Math.min(borderSize / 2, radius + 2 * ratio));
|
|
90
|
+
context.fill();
|
|
91
|
+
}
|
|
92
|
+
context.beginPath();
|
|
93
|
+
context.roundRect(x, y, finalSize, finalSize, radius);
|
|
94
|
+
context.clip();
|
|
95
|
+
context.drawImage(image, x, y, finalSize, finalSize);
|
|
96
|
+
context.restore();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (drawId !== drawIdRef.current) return;
|
|
100
|
+
canvas.width = pixelSize;
|
|
101
|
+
canvas.height = pixelSize;
|
|
102
|
+
canvas.getContext("2d")?.drawImage(memory, 0, 0, pixelSize, pixelSize);
|
|
103
|
+
drawnRef.current = true;
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (drawId === drawIdRef.current) console.error("Failed to render QR code", error);
|
|
106
|
+
}
|
|
107
|
+
}, [
|
|
108
|
+
colorDark,
|
|
109
|
+
colorLight,
|
|
110
|
+
errorLevel,
|
|
111
|
+
logo,
|
|
112
|
+
logoBorder,
|
|
113
|
+
logoRadius,
|
|
114
|
+
logoSize,
|
|
115
|
+
safeMargin,
|
|
116
|
+
safeSize,
|
|
117
|
+
value
|
|
118
|
+
]);
|
|
119
|
+
const scheduleDraw = useCallback(() => {
|
|
120
|
+
const promise = draw();
|
|
121
|
+
drawPromiseRef.current = promise;
|
|
122
|
+
}, [draw]);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (!drawnRef.current || status === "active") scheduleDraw();
|
|
125
|
+
}, [scheduleDraw, status]);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const observer = new MutationObserver((records) => {
|
|
128
|
+
if (status === "active" && records.some((record) => record.attributeName === "theme-mode")) scheduleDraw();
|
|
129
|
+
});
|
|
130
|
+
observer.observe(document.documentElement, {
|
|
131
|
+
attributes: true,
|
|
132
|
+
attributeFilter: ["theme-mode"]
|
|
133
|
+
});
|
|
134
|
+
return () => observer.disconnect();
|
|
135
|
+
}, [scheduleDraw, status]);
|
|
136
|
+
useEffect(() => () => {
|
|
137
|
+
drawIdRef.current += 1;
|
|
138
|
+
}, []);
|
|
139
|
+
useImperativeHandle(ref, () => ({ async download(fileName = "qrcode.png") {
|
|
140
|
+
await drawPromiseRef.current;
|
|
141
|
+
const canvas_0 = canvasRef.current;
|
|
142
|
+
if (!canvas_0) return;
|
|
143
|
+
const anchor = document.createElement("a");
|
|
144
|
+
anchor.download = fileName;
|
|
145
|
+
anchor.href = canvas_0.toDataURL("image/png");
|
|
146
|
+
anchor.click();
|
|
147
|
+
} }));
|
|
148
|
+
const handleExpiredKeyDown = (event) => {
|
|
149
|
+
if (event.target !== event.currentTarget || event.key !== "Enter" && event.key !== " ") return;
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
onRefresh?.();
|
|
152
|
+
};
|
|
153
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
154
|
+
...rest,
|
|
155
|
+
className: clsx("k-qrcode", `k-qrcode-${shape}`, `k-qrcode-${theme}`, { "k-qrcode-plain": !bordered }, className),
|
|
156
|
+
style: {
|
|
157
|
+
...style,
|
|
158
|
+
width: safeSize,
|
|
159
|
+
height: safeSize
|
|
160
|
+
},
|
|
161
|
+
children: [/* @__PURE__ */ jsx("canvas", {
|
|
162
|
+
ref: canvasRef,
|
|
163
|
+
style: {
|
|
164
|
+
width: safeSize,
|
|
165
|
+
height: safeSize,
|
|
166
|
+
display: "block"
|
|
167
|
+
}
|
|
168
|
+
}), status !== "active" && /* @__PURE__ */ jsxs("div", {
|
|
169
|
+
className: "k-qrcode-mask",
|
|
170
|
+
children: [
|
|
171
|
+
status === "loading" && /* @__PURE__ */ jsx("div", {
|
|
172
|
+
className: "k-qrcode-loading-wrapper",
|
|
173
|
+
children: loadingContent ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
174
|
+
/* @__PURE__ */ jsx(Spin, { size: "small" }),
|
|
175
|
+
" ",
|
|
176
|
+
/* @__PURE__ */ jsx("span", { children: messages?.loading })
|
|
177
|
+
] })
|
|
178
|
+
}),
|
|
179
|
+
status === "expired" && /* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: "k-qrcode-expired-wrapper",
|
|
181
|
+
role: "button",
|
|
182
|
+
tabIndex: 0,
|
|
183
|
+
onClick: onRefresh,
|
|
184
|
+
onKeyDown: handleExpiredKeyDown,
|
|
185
|
+
children: expiredContent ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
186
|
+
className: "k-qrcode-expired",
|
|
187
|
+
children: messages?.expired
|
|
188
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
189
|
+
size: "small",
|
|
190
|
+
type: "text",
|
|
191
|
+
tabIndex: -1,
|
|
192
|
+
children: messages?.refresh
|
|
193
|
+
})] })
|
|
194
|
+
}),
|
|
195
|
+
status === "scanned" && /* @__PURE__ */ jsx("div", {
|
|
196
|
+
className: "k-qrcode-scanned-wrapper",
|
|
197
|
+
children: scannedContent ?? messages?.scanned
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
})]
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
//#endregion
|
|
204
|
+
export { QRCode as default };
|
|
@@ -0,0 +1,158 @@
|
|
|
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 Button from "../button/button.js";
|
|
11
|
+
import { createFormFieldComponent } from "../form/field-context.js";
|
|
12
|
+
import { RadioGroupContext } from "./radio-group-context.js";
|
|
13
|
+
import { c } from "react/compiler-runtime";
|
|
14
|
+
import React, { useContext, useState } from "react";
|
|
15
|
+
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
//#region components/radio/radio-button.tsx
|
|
17
|
+
var RadioButton = React.forwardRef((t0, ref) => {
|
|
18
|
+
const $ = c(40);
|
|
19
|
+
let checked;
|
|
20
|
+
let children;
|
|
21
|
+
let icon;
|
|
22
|
+
let label;
|
|
23
|
+
let onChange;
|
|
24
|
+
let onClick;
|
|
25
|
+
let rest;
|
|
26
|
+
let shapeProp;
|
|
27
|
+
let sizeProp;
|
|
28
|
+
let t1;
|
|
29
|
+
let t2;
|
|
30
|
+
let t3;
|
|
31
|
+
let themeProp;
|
|
32
|
+
let value;
|
|
33
|
+
if ($[0] !== t0) {
|
|
34
|
+
({label, value, theme: themeProp, disabled: t1, readOnly: t2, checked, defaultChecked: t3, icon, size: sizeProp, shape: shapeProp, onChange, onClick, children, ...rest} = t0);
|
|
35
|
+
$[0] = t0;
|
|
36
|
+
$[1] = checked;
|
|
37
|
+
$[2] = children;
|
|
38
|
+
$[3] = icon;
|
|
39
|
+
$[4] = label;
|
|
40
|
+
$[5] = onChange;
|
|
41
|
+
$[6] = onClick;
|
|
42
|
+
$[7] = rest;
|
|
43
|
+
$[8] = shapeProp;
|
|
44
|
+
$[9] = sizeProp;
|
|
45
|
+
$[10] = t1;
|
|
46
|
+
$[11] = t2;
|
|
47
|
+
$[12] = t3;
|
|
48
|
+
$[13] = themeProp;
|
|
49
|
+
$[14] = value;
|
|
50
|
+
} else {
|
|
51
|
+
checked = $[1];
|
|
52
|
+
children = $[2];
|
|
53
|
+
icon = $[3];
|
|
54
|
+
label = $[4];
|
|
55
|
+
onChange = $[5];
|
|
56
|
+
onClick = $[6];
|
|
57
|
+
rest = $[7];
|
|
58
|
+
shapeProp = $[8];
|
|
59
|
+
sizeProp = $[9];
|
|
60
|
+
t1 = $[10];
|
|
61
|
+
t2 = $[11];
|
|
62
|
+
t3 = $[12];
|
|
63
|
+
themeProp = $[13];
|
|
64
|
+
value = $[14];
|
|
65
|
+
}
|
|
66
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
67
|
+
const readOnly = t2 === void 0 ? false : t2;
|
|
68
|
+
const defaultChecked = t3 === void 0 ? false : t3;
|
|
69
|
+
const inheritedAppearance = useConfigAppearance();
|
|
70
|
+
const theme = themeProp ?? inheritedAppearance.theme;
|
|
71
|
+
const size = sizeProp ?? inheritedAppearance.size;
|
|
72
|
+
const shape = shapeProp ?? inheritedAppearance.shape;
|
|
73
|
+
const group = useContext(RadioGroupContext);
|
|
74
|
+
const isGroup = !!group;
|
|
75
|
+
const [localChecked, setLocalChecked] = useState(defaultChecked);
|
|
76
|
+
const groupChecked = isGroup ? group.value === value : false;
|
|
77
|
+
const isChecked = isGroup ? groupChecked : checked ?? localChecked;
|
|
78
|
+
const currentDisabled = disabled || isGroup && group.disabled;
|
|
79
|
+
const currentReadOnly = readOnly || Boolean(isGroup && group.readOnly);
|
|
80
|
+
const currentTheme = themeProp ?? group?.theme ?? theme;
|
|
81
|
+
const currentSize = sizeProp ?? group?.size ?? size;
|
|
82
|
+
const currentShape = shapeProp ?? group?.shape ?? shape;
|
|
83
|
+
const labelText = label ?? children ?? String(value ?? "");
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[15] !== checked || $[16] !== currentDisabled || $[17] !== currentReadOnly || $[18] !== group || $[19] !== isChecked || $[20] !== isGroup || $[21] !== label || $[22] !== onChange || $[23] !== onClick || $[24] !== value) {
|
|
86
|
+
t4 = (e) => {
|
|
87
|
+
onClick?.(e);
|
|
88
|
+
if (e.defaultPrevented) return;
|
|
89
|
+
if (currentDisabled || currentReadOnly || isChecked) return;
|
|
90
|
+
if (!isGroup && checked === void 0) setLocalChecked(true);
|
|
91
|
+
const eventObj = {
|
|
92
|
+
checked: true,
|
|
93
|
+
value,
|
|
94
|
+
label: label ?? String(value ?? "")
|
|
95
|
+
};
|
|
96
|
+
onChange?.(eventObj);
|
|
97
|
+
group?.onChange?.(eventObj);
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
};
|
|
100
|
+
$[15] = checked;
|
|
101
|
+
$[16] = currentDisabled;
|
|
102
|
+
$[17] = currentReadOnly;
|
|
103
|
+
$[18] = group;
|
|
104
|
+
$[19] = isChecked;
|
|
105
|
+
$[20] = isGroup;
|
|
106
|
+
$[21] = label;
|
|
107
|
+
$[22] = onChange;
|
|
108
|
+
$[23] = onClick;
|
|
109
|
+
$[24] = value;
|
|
110
|
+
$[25] = t4;
|
|
111
|
+
} else t4 = $[25];
|
|
112
|
+
const handleClick = t4;
|
|
113
|
+
const t5 = isChecked ? "primary" : "default";
|
|
114
|
+
const t6 = currentReadOnly || void 0;
|
|
115
|
+
const t7 = isChecked ? 0 : -1;
|
|
116
|
+
let t8;
|
|
117
|
+
if ($[26] !== currentDisabled || $[27] !== currentShape || $[28] !== currentSize || $[29] !== currentTheme || $[30] !== handleClick || $[31] !== icon || $[32] !== isChecked || $[33] !== labelText || $[34] !== ref || $[35] !== rest || $[36] !== t5 || $[37] !== t6 || $[38] !== t7) {
|
|
118
|
+
t8 = /* @__PURE__ */ jsx(Button, {
|
|
119
|
+
...rest,
|
|
120
|
+
ref,
|
|
121
|
+
disabled: currentDisabled,
|
|
122
|
+
size: currentSize,
|
|
123
|
+
icon,
|
|
124
|
+
theme: currentTheme,
|
|
125
|
+
shape: currentShape,
|
|
126
|
+
type: t5,
|
|
127
|
+
onClick: handleClick,
|
|
128
|
+
role: "radio",
|
|
129
|
+
"aria-checked": isChecked,
|
|
130
|
+
"aria-readonly": t6,
|
|
131
|
+
tabIndex: t7,
|
|
132
|
+
children: labelText
|
|
133
|
+
});
|
|
134
|
+
$[26] = currentDisabled;
|
|
135
|
+
$[27] = currentShape;
|
|
136
|
+
$[28] = currentSize;
|
|
137
|
+
$[29] = currentTheme;
|
|
138
|
+
$[30] = handleClick;
|
|
139
|
+
$[31] = icon;
|
|
140
|
+
$[32] = isChecked;
|
|
141
|
+
$[33] = labelText;
|
|
142
|
+
$[34] = ref;
|
|
143
|
+
$[35] = rest;
|
|
144
|
+
$[36] = t5;
|
|
145
|
+
$[37] = t6;
|
|
146
|
+
$[38] = t7;
|
|
147
|
+
$[39] = t8;
|
|
148
|
+
} else t8 = $[39];
|
|
149
|
+
return t8;
|
|
150
|
+
});
|
|
151
|
+
RadioButton.displayName = "RadioButton";
|
|
152
|
+
var radio_button_default = createFormFieldComponent(RadioButton, {
|
|
153
|
+
valueProp: "checked",
|
|
154
|
+
getFieldValue: (value) => value === true || value === 1 || value === "1",
|
|
155
|
+
getChangeValue: (event) => event.checked
|
|
156
|
+
});
|
|
157
|
+
//#endregion
|
|
158
|
+
export { radio_button_default 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/radio/radio-group-context.ts
|
|
11
|
+
var RadioGroupContext = createContext(null);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { RadioGroupContext };
|
|
@@ -0,0 +1,264 @@
|
|
|
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 { useValue } from "../utils/use-value.js";
|
|
11
|
+
import { createFormFieldComponent } from "../form/field-context.js";
|
|
12
|
+
import { RadioGroupContext } from "./radio-group-context.js";
|
|
13
|
+
import radio_default from "./radio.js";
|
|
14
|
+
import radio_button_default from "./radio-button.js";
|
|
15
|
+
import { c } from "react/compiler-runtime";
|
|
16
|
+
import clsx from "clsx";
|
|
17
|
+
import React, { useId, useRef } from "react";
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
//#region components/radio/radio-group.tsx
|
|
20
|
+
var RadioGroup = (t0) => {
|
|
21
|
+
const $ = c(67);
|
|
22
|
+
let children;
|
|
23
|
+
let onChange;
|
|
24
|
+
let onKeyDown;
|
|
25
|
+
let options;
|
|
26
|
+
let rest;
|
|
27
|
+
let shapeProp;
|
|
28
|
+
let sizeProp;
|
|
29
|
+
let t1;
|
|
30
|
+
let t2;
|
|
31
|
+
let t3;
|
|
32
|
+
let t4;
|
|
33
|
+
let themeProp;
|
|
34
|
+
let type;
|
|
35
|
+
let value;
|
|
36
|
+
if ($[0] !== t0) {
|
|
37
|
+
({value, disabled: t1, readOnly: t2, direction: t3, size: sizeProp, theme: themeProp, shape: shapeProp, options, type, onChange, children, className: t4, onKeyDown, ...rest} = t0);
|
|
38
|
+
$[0] = t0;
|
|
39
|
+
$[1] = children;
|
|
40
|
+
$[2] = onChange;
|
|
41
|
+
$[3] = onKeyDown;
|
|
42
|
+
$[4] = options;
|
|
43
|
+
$[5] = rest;
|
|
44
|
+
$[6] = shapeProp;
|
|
45
|
+
$[7] = sizeProp;
|
|
46
|
+
$[8] = t1;
|
|
47
|
+
$[9] = t2;
|
|
48
|
+
$[10] = t3;
|
|
49
|
+
$[11] = t4;
|
|
50
|
+
$[12] = themeProp;
|
|
51
|
+
$[13] = type;
|
|
52
|
+
$[14] = value;
|
|
53
|
+
} else {
|
|
54
|
+
children = $[1];
|
|
55
|
+
onChange = $[2];
|
|
56
|
+
onKeyDown = $[3];
|
|
57
|
+
options = $[4];
|
|
58
|
+
rest = $[5];
|
|
59
|
+
shapeProp = $[6];
|
|
60
|
+
sizeProp = $[7];
|
|
61
|
+
t1 = $[8];
|
|
62
|
+
t2 = $[9];
|
|
63
|
+
t3 = $[10];
|
|
64
|
+
t4 = $[11];
|
|
65
|
+
themeProp = $[12];
|
|
66
|
+
type = $[13];
|
|
67
|
+
value = $[14];
|
|
68
|
+
}
|
|
69
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
70
|
+
const readOnly = t2 === void 0 ? false : t2;
|
|
71
|
+
const direction = t3 === void 0 ? "horizontal" : t3;
|
|
72
|
+
const className = t4 === void 0 ? "" : t4;
|
|
73
|
+
const inheritedAppearance = useConfigAppearance();
|
|
74
|
+
const size = sizeProp ?? inheritedAppearance.size;
|
|
75
|
+
const theme = themeProp ?? inheritedAppearance.theme;
|
|
76
|
+
const shape = shapeProp ?? inheritedAppearance.shape;
|
|
77
|
+
const rootRef = useRef(null);
|
|
78
|
+
const t5 = useId();
|
|
79
|
+
let t6;
|
|
80
|
+
if ($[15] !== t5) {
|
|
81
|
+
let t7;
|
|
82
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
83
|
+
t7 = /:/g;
|
|
84
|
+
$[17] = t7;
|
|
85
|
+
} else t7 = $[17];
|
|
86
|
+
t6 = t5.replace(t7, "");
|
|
87
|
+
$[15] = t5;
|
|
88
|
+
$[16] = t6;
|
|
89
|
+
} else t6 = $[16];
|
|
90
|
+
const name = `k-radio-group-${t6}`;
|
|
91
|
+
const [innerValue, setInnerValue] = useValue(value, _temp);
|
|
92
|
+
const currentValue = innerValue;
|
|
93
|
+
const isVertical = direction === "vertical";
|
|
94
|
+
const isButton = type === "button";
|
|
95
|
+
let t7;
|
|
96
|
+
if ($[18] !== onChange || $[19] !== readOnly || $[20] !== setInnerValue) {
|
|
97
|
+
t7 = (event) => {
|
|
98
|
+
if (readOnly || event.value === void 0) return;
|
|
99
|
+
const nextValue = event.value;
|
|
100
|
+
setInnerValue(nextValue);
|
|
101
|
+
onChange?.(nextValue);
|
|
102
|
+
};
|
|
103
|
+
$[18] = onChange;
|
|
104
|
+
$[19] = readOnly;
|
|
105
|
+
$[20] = setInnerValue;
|
|
106
|
+
$[21] = t7;
|
|
107
|
+
} else t7 = $[21];
|
|
108
|
+
const handleRadioChange = t7;
|
|
109
|
+
const t8 = shape === "circle";
|
|
110
|
+
const t9 = theme === "fill" && isButton;
|
|
111
|
+
let t10;
|
|
112
|
+
if ($[22] !== className || $[23] !== isButton || $[24] !== isVertical || $[25] !== t8 || $[26] !== t9) {
|
|
113
|
+
t10 = clsx("k-radio-group", {
|
|
114
|
+
"k-radio-button-group": isButton,
|
|
115
|
+
"k-radio-group-circle": t8,
|
|
116
|
+
"k-radio-group-fill": t9,
|
|
117
|
+
"k-radio-group-vertical": isVertical
|
|
118
|
+
}, className);
|
|
119
|
+
$[22] = className;
|
|
120
|
+
$[23] = isButton;
|
|
121
|
+
$[24] = isVertical;
|
|
122
|
+
$[25] = t8;
|
|
123
|
+
$[26] = t9;
|
|
124
|
+
$[27] = t10;
|
|
125
|
+
} else t10 = $[27];
|
|
126
|
+
const classes = t10;
|
|
127
|
+
const Component = isButton ? radio_button_default : radio_default;
|
|
128
|
+
let t11;
|
|
129
|
+
bb0: {
|
|
130
|
+
if (options && options.length > 0) {
|
|
131
|
+
let t12;
|
|
132
|
+
if ($[28] !== Component || $[29] !== disabled || $[30] !== options || $[31] !== readOnly || $[32] !== shape || $[33] !== size || $[34] !== theme) {
|
|
133
|
+
let t13;
|
|
134
|
+
if ($[36] !== Component || $[37] !== disabled || $[38] !== readOnly || $[39] !== shape || $[40] !== size || $[41] !== theme) {
|
|
135
|
+
t13 = (option) => /* @__PURE__ */ jsx(Component, {
|
|
136
|
+
label: option.label,
|
|
137
|
+
value: option.value,
|
|
138
|
+
disabled: disabled || option.disabled,
|
|
139
|
+
readOnly,
|
|
140
|
+
icon: option.icon,
|
|
141
|
+
size,
|
|
142
|
+
theme,
|
|
143
|
+
shape
|
|
144
|
+
}, option.label ?? option.value);
|
|
145
|
+
$[36] = Component;
|
|
146
|
+
$[37] = disabled;
|
|
147
|
+
$[38] = readOnly;
|
|
148
|
+
$[39] = shape;
|
|
149
|
+
$[40] = size;
|
|
150
|
+
$[41] = theme;
|
|
151
|
+
$[42] = t13;
|
|
152
|
+
} else t13 = $[42];
|
|
153
|
+
t12 = options.map(t13);
|
|
154
|
+
$[28] = Component;
|
|
155
|
+
$[29] = disabled;
|
|
156
|
+
$[30] = options;
|
|
157
|
+
$[31] = readOnly;
|
|
158
|
+
$[32] = shape;
|
|
159
|
+
$[33] = size;
|
|
160
|
+
$[34] = theme;
|
|
161
|
+
$[35] = t12;
|
|
162
|
+
} else t12 = $[35];
|
|
163
|
+
t11 = t12;
|
|
164
|
+
break bb0;
|
|
165
|
+
}
|
|
166
|
+
let t12;
|
|
167
|
+
if ($[43] !== children) {
|
|
168
|
+
t12 = React.Children.map(children, _temp2);
|
|
169
|
+
$[43] = children;
|
|
170
|
+
$[44] = t12;
|
|
171
|
+
} else t12 = $[44];
|
|
172
|
+
t11 = t12;
|
|
173
|
+
}
|
|
174
|
+
const content = t11;
|
|
175
|
+
let t12;
|
|
176
|
+
if ($[45] !== currentValue || $[46] !== disabled || $[47] !== handleRadioChange || $[48] !== name || $[49] !== readOnly || $[50] !== shape || $[51] !== size || $[52] !== theme) {
|
|
177
|
+
t12 = {
|
|
178
|
+
name,
|
|
179
|
+
value: currentValue,
|
|
180
|
+
disabled,
|
|
181
|
+
readOnly,
|
|
182
|
+
theme,
|
|
183
|
+
size,
|
|
184
|
+
shape,
|
|
185
|
+
onChange: handleRadioChange
|
|
186
|
+
};
|
|
187
|
+
$[45] = currentValue;
|
|
188
|
+
$[46] = disabled;
|
|
189
|
+
$[47] = handleRadioChange;
|
|
190
|
+
$[48] = name;
|
|
191
|
+
$[49] = readOnly;
|
|
192
|
+
$[50] = shape;
|
|
193
|
+
$[51] = size;
|
|
194
|
+
$[52] = theme;
|
|
195
|
+
$[53] = t12;
|
|
196
|
+
} else t12 = $[53];
|
|
197
|
+
const t13 = disabled || void 0;
|
|
198
|
+
const t14 = readOnly || void 0;
|
|
199
|
+
let t15;
|
|
200
|
+
if ($[54] !== isButton || $[55] !== onKeyDown) {
|
|
201
|
+
t15 = (event_0) => {
|
|
202
|
+
onKeyDown?.(event_0);
|
|
203
|
+
if (event_0.defaultPrevented) return;
|
|
204
|
+
if (!isButton || ![
|
|
205
|
+
"ArrowRight",
|
|
206
|
+
"ArrowDown",
|
|
207
|
+
"ArrowLeft",
|
|
208
|
+
"ArrowUp"
|
|
209
|
+
].includes(event_0.key)) return;
|
|
210
|
+
const buttons = [...rootRef.current?.querySelectorAll("[role=\"radio\"]:not([disabled])") ?? []];
|
|
211
|
+
if (!buttons.length) return;
|
|
212
|
+
event_0.preventDefault();
|
|
213
|
+
const index = buttons.indexOf(event_0.target);
|
|
214
|
+
const offset = event_0.key === "ArrowRight" || event_0.key === "ArrowDown" ? 1 : -1;
|
|
215
|
+
const next_0 = buttons[(Math.max(index, 0) + offset + buttons.length) % buttons.length];
|
|
216
|
+
next_0?.focus();
|
|
217
|
+
next_0?.click();
|
|
218
|
+
};
|
|
219
|
+
$[54] = isButton;
|
|
220
|
+
$[55] = onKeyDown;
|
|
221
|
+
$[56] = t15;
|
|
222
|
+
} else t15 = $[56];
|
|
223
|
+
let t16;
|
|
224
|
+
if ($[57] !== classes || $[58] !== content || $[59] !== rest || $[60] !== t13 || $[61] !== t14 || $[62] !== t15) {
|
|
225
|
+
t16 = /* @__PURE__ */ jsx("div", {
|
|
226
|
+
...rest,
|
|
227
|
+
className: classes,
|
|
228
|
+
ref: rootRef,
|
|
229
|
+
role: "radiogroup",
|
|
230
|
+
"aria-disabled": t13,
|
|
231
|
+
"aria-readonly": t14,
|
|
232
|
+
onKeyDown: t15,
|
|
233
|
+
children: content
|
|
234
|
+
});
|
|
235
|
+
$[57] = classes;
|
|
236
|
+
$[58] = content;
|
|
237
|
+
$[59] = rest;
|
|
238
|
+
$[60] = t13;
|
|
239
|
+
$[61] = t14;
|
|
240
|
+
$[62] = t15;
|
|
241
|
+
$[63] = t16;
|
|
242
|
+
} else t16 = $[63];
|
|
243
|
+
let t17;
|
|
244
|
+
if ($[64] !== t12 || $[65] !== t16) {
|
|
245
|
+
t17 = /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
|
|
246
|
+
value: t12,
|
|
247
|
+
children: t16
|
|
248
|
+
});
|
|
249
|
+
$[64] = t12;
|
|
250
|
+
$[65] = t16;
|
|
251
|
+
$[66] = t17;
|
|
252
|
+
} else t17 = $[66];
|
|
253
|
+
return t17;
|
|
254
|
+
};
|
|
255
|
+
var radio_group_default = createFormFieldComponent(RadioGroup);
|
|
256
|
+
function _temp(next) {
|
|
257
|
+
return next ?? "";
|
|
258
|
+
}
|
|
259
|
+
function _temp2(child) {
|
|
260
|
+
if (React.isValidElement(child)) return child;
|
|
261
|
+
return child;
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
export { radio_group_default as default };
|