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,63 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { normalizeSurfaceShape, useConfigAppearance } from "../config/use-config-appearance.js";
|
|
10
|
+
import StatNumber from "./stat-number.js";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
//#region components/stat-card/stat-card.tsx
|
|
14
|
+
function StatCard({ title, precision = 0, items = [], separator, statNumberType = "countup", reverse = false, bordered = false, theme: themeProp, shape: shapeProp, size: sizeProp, prefix, suffix, className, ...rest }) {
|
|
15
|
+
const inheritedAppearance = useConfigAppearance();
|
|
16
|
+
const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
|
|
17
|
+
const shape = normalizeSurfaceShape(shapeProp ?? inheritedAppearance.shape ?? "round");
|
|
18
|
+
const size = sizeProp ?? inheritedAppearance.size ?? "medium";
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
...rest,
|
|
21
|
+
className: clsx("k-stat-card", {
|
|
22
|
+
"k-stat-card-bordered": bordered,
|
|
23
|
+
[`k-stat-card-${theme}`]: theme,
|
|
24
|
+
[`k-stat-card-${shape}`]: shape,
|
|
25
|
+
[`k-stat-card-${size}`]: size
|
|
26
|
+
}, className),
|
|
27
|
+
children: [title != null && /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "k-stat-card-title",
|
|
29
|
+
children: title
|
|
30
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: "k-stat-card-items",
|
|
32
|
+
children: items.map((item, index) => /* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: clsx("k-stat-card-item", { "k-stat-card-item-reverse": reverse }),
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("div", {
|
|
36
|
+
className: "k-stat-card-item-value",
|
|
37
|
+
children: /* @__PURE__ */ jsx(StatNumber, {
|
|
38
|
+
value: item.value,
|
|
39
|
+
autoAnimate: item.autoAnimate,
|
|
40
|
+
autoAnimateOnce: item.autoAnimateOnce,
|
|
41
|
+
duration: item.duration,
|
|
42
|
+
precision: item.precision ?? precision,
|
|
43
|
+
separator: item.separator ?? separator,
|
|
44
|
+
type: statNumberType,
|
|
45
|
+
prefix: item.prefix ?? prefix,
|
|
46
|
+
suffix: item.suffix ?? suffix
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
49
|
+
item.desc != null && /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "k-stat-card-item-desc",
|
|
51
|
+
children: item.desc
|
|
52
|
+
}),
|
|
53
|
+
item.trend != null && item.trend !== false && /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: clsx("k-stat-card-item-trend", `k-stat-card-item-trend-${item.trendStatus || "default"}`),
|
|
55
|
+
children: item.trend
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
}, `${typeof (item.key ?? index)}:${String(item.key ?? index)}`))
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { StatCard as default };
|
|
@@ -0,0 +1,125 @@
|
|
|
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 CountUpNumber from "./countup.js";
|
|
10
|
+
import { c } from "react/compiler-runtime";
|
|
11
|
+
import clsx from "clsx";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
//#region components/stat-card/stat-number.tsx
|
|
14
|
+
function StatNumber(t0) {
|
|
15
|
+
const $ = c(32);
|
|
16
|
+
let className;
|
|
17
|
+
let prefix;
|
|
18
|
+
let rest;
|
|
19
|
+
let separator;
|
|
20
|
+
let suffix;
|
|
21
|
+
let t1;
|
|
22
|
+
let t2;
|
|
23
|
+
let t3;
|
|
24
|
+
let t4;
|
|
25
|
+
let t5;
|
|
26
|
+
let value;
|
|
27
|
+
if ($[0] !== t0) {
|
|
28
|
+
({value, separator, duration: t1, precision: t2, type: t3, prefix, suffix, autoAnimate: t4, autoAnimateOnce: t5, className, ...rest} = t0);
|
|
29
|
+
$[0] = t0;
|
|
30
|
+
$[1] = className;
|
|
31
|
+
$[2] = prefix;
|
|
32
|
+
$[3] = rest;
|
|
33
|
+
$[4] = separator;
|
|
34
|
+
$[5] = suffix;
|
|
35
|
+
$[6] = t1;
|
|
36
|
+
$[7] = t2;
|
|
37
|
+
$[8] = t3;
|
|
38
|
+
$[9] = t4;
|
|
39
|
+
$[10] = t5;
|
|
40
|
+
$[11] = value;
|
|
41
|
+
} else {
|
|
42
|
+
className = $[1];
|
|
43
|
+
prefix = $[2];
|
|
44
|
+
rest = $[3];
|
|
45
|
+
separator = $[4];
|
|
46
|
+
suffix = $[5];
|
|
47
|
+
t1 = $[6];
|
|
48
|
+
t2 = $[7];
|
|
49
|
+
t3 = $[8];
|
|
50
|
+
t4 = $[9];
|
|
51
|
+
t5 = $[10];
|
|
52
|
+
value = $[11];
|
|
53
|
+
}
|
|
54
|
+
const duration = t1 === void 0 ? 1.2 : t1;
|
|
55
|
+
const precision = t2 === void 0 ? 0 : t2;
|
|
56
|
+
const type = t3 === void 0 ? "countup" : t3;
|
|
57
|
+
const autoAnimate = t4 === void 0 ? true : t4;
|
|
58
|
+
const autoAnimateOnce = t5 === void 0 ? true : t5;
|
|
59
|
+
let t6;
|
|
60
|
+
if ($[12] !== className) {
|
|
61
|
+
t6 = clsx("k-stat-number", className);
|
|
62
|
+
$[12] = className;
|
|
63
|
+
$[13] = t6;
|
|
64
|
+
} else t6 = $[13];
|
|
65
|
+
let t7;
|
|
66
|
+
if ($[14] !== prefix) {
|
|
67
|
+
t7 = prefix != null && /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "k-stat-number-prefix",
|
|
69
|
+
children: prefix
|
|
70
|
+
});
|
|
71
|
+
$[14] = prefix;
|
|
72
|
+
$[15] = t7;
|
|
73
|
+
} else t7 = $[15];
|
|
74
|
+
const t8 = value ?? 0;
|
|
75
|
+
let t9;
|
|
76
|
+
if ($[16] !== autoAnimate || $[17] !== autoAnimateOnce || $[18] !== duration || $[19] !== precision || $[20] !== separator || $[21] !== t8 || $[22] !== type) {
|
|
77
|
+
t9 = /* @__PURE__ */ jsx(CountUpNumber, {
|
|
78
|
+
value: t8,
|
|
79
|
+
separator,
|
|
80
|
+
duration,
|
|
81
|
+
precision,
|
|
82
|
+
type,
|
|
83
|
+
autoAnimate,
|
|
84
|
+
autoAnimateOnce
|
|
85
|
+
});
|
|
86
|
+
$[16] = autoAnimate;
|
|
87
|
+
$[17] = autoAnimateOnce;
|
|
88
|
+
$[18] = duration;
|
|
89
|
+
$[19] = precision;
|
|
90
|
+
$[20] = separator;
|
|
91
|
+
$[21] = t8;
|
|
92
|
+
$[22] = type;
|
|
93
|
+
$[23] = t9;
|
|
94
|
+
} else t9 = $[23];
|
|
95
|
+
let t10;
|
|
96
|
+
if ($[24] !== suffix) {
|
|
97
|
+
t10 = suffix != null && /* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "k-stat-number-suffix",
|
|
99
|
+
children: suffix
|
|
100
|
+
});
|
|
101
|
+
$[24] = suffix;
|
|
102
|
+
$[25] = t10;
|
|
103
|
+
} else t10 = $[25];
|
|
104
|
+
let t11;
|
|
105
|
+
if ($[26] !== rest || $[27] !== t10 || $[28] !== t6 || $[29] !== t7 || $[30] !== t9) {
|
|
106
|
+
t11 = /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
...rest,
|
|
108
|
+
className: t6,
|
|
109
|
+
children: [
|
|
110
|
+
t7,
|
|
111
|
+
t9,
|
|
112
|
+
t10
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
$[26] = rest;
|
|
116
|
+
$[27] = t10;
|
|
117
|
+
$[28] = t6;
|
|
118
|
+
$[29] = t7;
|
|
119
|
+
$[30] = t9;
|
|
120
|
+
$[31] = t11;
|
|
121
|
+
} else t11 = $[31];
|
|
122
|
+
return t11;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { StatNumber as default };
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
//#region components/stat-card/utils/countup.ts
|
|
10
|
+
/**
|
|
11
|
+
* Animates a number by counting to it.
|
|
12
|
+
* playground: stackblitz.com/edit/countup-typescript
|
|
13
|
+
*
|
|
14
|
+
* @param target - id of html element, input, svg text element, or DOM element reference where counting occurs.
|
|
15
|
+
* @param endVal - the value you want to arrive at.
|
|
16
|
+
* @param options - optional configuration object for fine-grain control
|
|
17
|
+
*/
|
|
18
|
+
var CountUp = class CountUp {
|
|
19
|
+
version = "2.10.0";
|
|
20
|
+
static observedElements = /* @__PURE__ */ new WeakMap();
|
|
21
|
+
defaults = {
|
|
22
|
+
startVal: 0,
|
|
23
|
+
decimalPlaces: 0,
|
|
24
|
+
duration: 2,
|
|
25
|
+
useEasing: true,
|
|
26
|
+
useGrouping: true,
|
|
27
|
+
useIndianSeparators: false,
|
|
28
|
+
smartEasingThreshold: 999,
|
|
29
|
+
smartEasingAmount: 333,
|
|
30
|
+
separator: ",",
|
|
31
|
+
decimal: ".",
|
|
32
|
+
prefix: "",
|
|
33
|
+
suffix: "",
|
|
34
|
+
autoAnimate: false,
|
|
35
|
+
autoAnimateDelay: 200,
|
|
36
|
+
autoAnimateOnce: false
|
|
37
|
+
};
|
|
38
|
+
rAF;
|
|
39
|
+
autoAnimateTimeout;
|
|
40
|
+
startTime = null;
|
|
41
|
+
remaining = 0;
|
|
42
|
+
finalEndVal = null;
|
|
43
|
+
useEasing = true;
|
|
44
|
+
countDown = false;
|
|
45
|
+
observer = null;
|
|
46
|
+
el;
|
|
47
|
+
formattingFn;
|
|
48
|
+
easingFn;
|
|
49
|
+
error = "";
|
|
50
|
+
startVal = 0;
|
|
51
|
+
duration = 2;
|
|
52
|
+
paused = true;
|
|
53
|
+
frameVal;
|
|
54
|
+
once = false;
|
|
55
|
+
options;
|
|
56
|
+
endVal;
|
|
57
|
+
constructor(target, endVal, options) {
|
|
58
|
+
this.options = {
|
|
59
|
+
...this.defaults,
|
|
60
|
+
...options
|
|
61
|
+
};
|
|
62
|
+
this.formattingFn = this.options.formattingFn ? this.options.formattingFn : this.formatNumber;
|
|
63
|
+
this.easingFn = this.options.easingFn ? this.options.easingFn : this.easeOutExpo;
|
|
64
|
+
this.el = typeof target === "string" ? document.getElementById(target) : target;
|
|
65
|
+
endVal = endVal == null && this.el ? this.parse(this.el.innerHTML) : endVal;
|
|
66
|
+
this.startVal = this.validateValue(this.options.startVal || 0);
|
|
67
|
+
this.frameVal = this.startVal;
|
|
68
|
+
this.endVal = this.validateValue(endVal);
|
|
69
|
+
this.options.decimalPlaces = typeof this.options.decimalPlaces === "number" && Number.isFinite(this.options.decimalPlaces) ? Math.min(100, Math.max(0, Math.floor(this.options.decimalPlaces || 0))) : 0;
|
|
70
|
+
this.resetDuration();
|
|
71
|
+
this.options.separator = String(this.options.separator);
|
|
72
|
+
this.useEasing = this.options.useEasing || false;
|
|
73
|
+
if (this.options.separator === "") this.options.useGrouping = false;
|
|
74
|
+
if (this.el) this.printValue(this.startVal);
|
|
75
|
+
else this.error = "[CountUp] target is null or undefined";
|
|
76
|
+
if (typeof window !== "undefined" && this.options.autoAnimate) {
|
|
77
|
+
if (!this.error && typeof IntersectionObserver !== "undefined") this.setupObserver();
|
|
78
|
+
else if (this.error) console.error(this.error, target);
|
|
79
|
+
else console.error("IntersectionObserver is not supported by this browser");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Set up an IntersectionObserver to auto-animate when the target element appears. */
|
|
83
|
+
setupObserver() {
|
|
84
|
+
const existing = CountUp.observedElements.get(this.el);
|
|
85
|
+
if (existing) existing.unobserve();
|
|
86
|
+
CountUp.observedElements.set(this.el, this);
|
|
87
|
+
this.observer = new IntersectionObserver((entries) => {
|
|
88
|
+
for (const entry of entries) if (entry.isIntersecting && this.paused && !this.once) {
|
|
89
|
+
this.paused = false;
|
|
90
|
+
this.autoAnimateTimeout = setTimeout(() => this.start(), this.options.autoAnimateDelay);
|
|
91
|
+
if (this.options.autoAnimateOnce) {
|
|
92
|
+
this.once = true;
|
|
93
|
+
this.observer?.disconnect();
|
|
94
|
+
}
|
|
95
|
+
} else if (!entry.isIntersecting && !this.paused) {
|
|
96
|
+
clearTimeout(this.autoAnimateTimeout);
|
|
97
|
+
this.reset();
|
|
98
|
+
}
|
|
99
|
+
}, { threshold: 0 });
|
|
100
|
+
if (this.el) this.observer.observe(this.el);
|
|
101
|
+
}
|
|
102
|
+
/** Disconnect the IntersectionObserver and stop watching this element. */
|
|
103
|
+
unobserve() {
|
|
104
|
+
clearTimeout(this.autoAnimateTimeout);
|
|
105
|
+
this.observer?.disconnect();
|
|
106
|
+
CountUp.observedElements.delete(this.el);
|
|
107
|
+
}
|
|
108
|
+
/** Teardown: cancel animation, disconnect observer, clear callbacks. */
|
|
109
|
+
onDestroy() {
|
|
110
|
+
clearTimeout(this.autoAnimateTimeout);
|
|
111
|
+
if (this.rAF !== void 0) cancelAnimationFrame(this.rAF);
|
|
112
|
+
this.paused = true;
|
|
113
|
+
this.unobserve();
|
|
114
|
+
this.options.plugin?.destroy?.();
|
|
115
|
+
this.options.onCompleteCallback = null;
|
|
116
|
+
this.options.onStartCallback = null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Smart easing works by breaking the animation into 2 parts, the second part being the
|
|
120
|
+
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
|
|
121
|
+
* by disabling easing for the first part and enabling it on the second part. It is used if
|
|
122
|
+
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
|
|
123
|
+
*/
|
|
124
|
+
determineDirectionAndSmartEasing() {
|
|
125
|
+
const end = this.finalEndVal ? this.finalEndVal : this.endVal;
|
|
126
|
+
this.countDown = this.startVal > end;
|
|
127
|
+
const animateAmount = end - this.startVal;
|
|
128
|
+
if (Math.abs(animateAmount) > (this.options.smartEasingThreshold || 999) && this.options.useEasing) {
|
|
129
|
+
this.finalEndVal = end;
|
|
130
|
+
const up = this.countDown ? 1 : -1;
|
|
131
|
+
this.endVal = end + up * (this.options.smartEasingAmount || 333);
|
|
132
|
+
this.duration = this.duration / 2;
|
|
133
|
+
} else {
|
|
134
|
+
this.endVal = end;
|
|
135
|
+
this.finalEndVal = null;
|
|
136
|
+
}
|
|
137
|
+
if (this.finalEndVal !== null) this.useEasing = false;
|
|
138
|
+
else this.useEasing = this.options.useEasing || false;
|
|
139
|
+
}
|
|
140
|
+
/** Start the animation. Optionally pass a callback that fires on completion. */
|
|
141
|
+
start(callback) {
|
|
142
|
+
if (this.error) return;
|
|
143
|
+
if (this.options.onStartCallback) this.options.onStartCallback();
|
|
144
|
+
if (callback) this.options.onCompleteCallback = callback;
|
|
145
|
+
if (this.duration > 0) {
|
|
146
|
+
this.determineDirectionAndSmartEasing();
|
|
147
|
+
this.paused = false;
|
|
148
|
+
this.rAF = requestAnimationFrame(this.count);
|
|
149
|
+
} else this.printValue(this.endVal);
|
|
150
|
+
}
|
|
151
|
+
/** Toggle pause/resume on the animation. */
|
|
152
|
+
pauseResume() {
|
|
153
|
+
if (!this.paused) {
|
|
154
|
+
if (this.rAF !== void 0) cancelAnimationFrame(this.rAF);
|
|
155
|
+
} else {
|
|
156
|
+
this.startTime = null;
|
|
157
|
+
this.duration = this.remaining;
|
|
158
|
+
this.startVal = this.frameVal;
|
|
159
|
+
this.determineDirectionAndSmartEasing();
|
|
160
|
+
this.rAF = requestAnimationFrame(this.count);
|
|
161
|
+
}
|
|
162
|
+
this.paused = !this.paused;
|
|
163
|
+
}
|
|
164
|
+
/** Reset to startVal so the animation can be run again. */
|
|
165
|
+
reset() {
|
|
166
|
+
clearTimeout(this.autoAnimateTimeout);
|
|
167
|
+
if (this.rAF !== void 0) cancelAnimationFrame(this.rAF);
|
|
168
|
+
this.paused = true;
|
|
169
|
+
this.once = false;
|
|
170
|
+
this.resetDuration();
|
|
171
|
+
this.startVal = this.validateValue(this.options.startVal || 0);
|
|
172
|
+
this.frameVal = this.startVal;
|
|
173
|
+
this.printValue(this.startVal);
|
|
174
|
+
}
|
|
175
|
+
/** Pass a new endVal and start the animation. */
|
|
176
|
+
update(newEndVal) {
|
|
177
|
+
if (this.rAF !== void 0) cancelAnimationFrame(this.rAF);
|
|
178
|
+
this.startTime = null;
|
|
179
|
+
this.endVal = this.validateValue(newEndVal);
|
|
180
|
+
if (this.endVal === this.frameVal) return;
|
|
181
|
+
this.startVal = this.frameVal;
|
|
182
|
+
if (this.finalEndVal == null) this.resetDuration();
|
|
183
|
+
this.finalEndVal = null;
|
|
184
|
+
if (this.duration <= 0) {
|
|
185
|
+
this.frameVal = this.endVal;
|
|
186
|
+
this.paused = true;
|
|
187
|
+
this.printValue(this.endVal);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.determineDirectionAndSmartEasing();
|
|
191
|
+
this.rAF = requestAnimationFrame(this.count);
|
|
192
|
+
}
|
|
193
|
+
/** Animation frame callback — advances the value each frame. */
|
|
194
|
+
count = (timestamp) => {
|
|
195
|
+
if (!this.startTime) this.startTime = timestamp;
|
|
196
|
+
const progress = timestamp - this.startTime;
|
|
197
|
+
this.remaining = this.duration - progress;
|
|
198
|
+
if (this.useEasing) {
|
|
199
|
+
if (this.countDown) this.frameVal = this.startVal - this.easingFn(progress, 0, this.startVal - this.endVal, this.duration);
|
|
200
|
+
else this.frameVal = this.easingFn(progress, this.startVal, this.endVal - this.startVal, this.duration);
|
|
201
|
+
} else this.frameVal = this.startVal + (this.endVal - this.startVal) * (progress / this.duration);
|
|
202
|
+
const wentPast = this.countDown ? this.frameVal < this.endVal : this.frameVal > this.endVal;
|
|
203
|
+
this.frameVal = wentPast ? this.endVal : this.frameVal;
|
|
204
|
+
this.frameVal = Number(this.frameVal.toFixed(this.options.decimalPlaces));
|
|
205
|
+
this.printValue(this.frameVal);
|
|
206
|
+
if (progress < this.duration) this.rAF = requestAnimationFrame(this.count);
|
|
207
|
+
else if (this.finalEndVal !== null) this.update(this.finalEndVal);
|
|
208
|
+
else if (this.options.onCompleteCallback) this.options.onCompleteCallback();
|
|
209
|
+
};
|
|
210
|
+
/** Format and render the given value to the target element. */
|
|
211
|
+
printValue(val) {
|
|
212
|
+
if (!this.el) return;
|
|
213
|
+
const result = this.formattingFn(val);
|
|
214
|
+
if (this.options.plugin?.render) {
|
|
215
|
+
this.options.plugin.render(this.el, result);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (this.el.tagName === "INPUT") {
|
|
219
|
+
const input = this.el;
|
|
220
|
+
input.value = result;
|
|
221
|
+
} else if (this.el.tagName === "text" || this.el.tagName === "tspan") this.el.textContent = result;
|
|
222
|
+
else this.el.innerHTML = result;
|
|
223
|
+
}
|
|
224
|
+
/** Return true if the value is a finite number. */
|
|
225
|
+
ensureNumber(n) {
|
|
226
|
+
return typeof n === "number" && Number.isFinite(n);
|
|
227
|
+
}
|
|
228
|
+
/** Validate and convert a value to a number, setting an error if invalid. */
|
|
229
|
+
validateValue(value) {
|
|
230
|
+
const newValue = Number(value);
|
|
231
|
+
if (!this.ensureNumber(newValue)) {
|
|
232
|
+
this.error = `[CountUp] invalid start or end value: ${value}`;
|
|
233
|
+
return 0;
|
|
234
|
+
} else return newValue;
|
|
235
|
+
}
|
|
236
|
+
/** Reset startTime, duration, and remaining to their initial values. */
|
|
237
|
+
resetDuration() {
|
|
238
|
+
this.startTime = null;
|
|
239
|
+
const duration = Number(this.options.duration);
|
|
240
|
+
this.duration = (Number.isFinite(duration) ? Math.max(0, duration) : 0) * 1e3;
|
|
241
|
+
this.remaining = this.duration;
|
|
242
|
+
}
|
|
243
|
+
/** Default number formatter with grouping, decimals, prefix/suffix, and numeral substitution. */
|
|
244
|
+
formatNumber = (num) => {
|
|
245
|
+
const neg = num < 0 ? "-" : "";
|
|
246
|
+
let result, x1, x2, x3;
|
|
247
|
+
result = Math.abs(num).toFixed(this.options.decimalPlaces);
|
|
248
|
+
result += "";
|
|
249
|
+
const x = result.split(".");
|
|
250
|
+
x1 = x[0];
|
|
251
|
+
x2 = x.length > 1 ? this.options.decimal + x[1] : "";
|
|
252
|
+
if (this.options.useGrouping) {
|
|
253
|
+
x3 = "";
|
|
254
|
+
let factor = 3, j = 0;
|
|
255
|
+
for (let i = 0, len = x1.length; i < len; ++i) {
|
|
256
|
+
if (this.options.useIndianSeparators && i === 4) {
|
|
257
|
+
factor = 2;
|
|
258
|
+
j = 1;
|
|
259
|
+
}
|
|
260
|
+
if (i !== 0 && j % factor === 0) x3 = this.options.separator + x3;
|
|
261
|
+
j++;
|
|
262
|
+
x3 = x1[len - i - 1] + x3;
|
|
263
|
+
}
|
|
264
|
+
x1 = x3;
|
|
265
|
+
}
|
|
266
|
+
const { numerals } = this.options;
|
|
267
|
+
if (numerals && numerals.length) {
|
|
268
|
+
x1 = x1.replace(/[0-9]/g, (w) => numerals[+w]);
|
|
269
|
+
x2 = x2.replace(/[0-9]/g, (w) => numerals[+w]);
|
|
270
|
+
}
|
|
271
|
+
return neg + this.options.prefix + x1 + x2 + this.options.suffix;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Default easing function (easeOutExpo).
|
|
275
|
+
* @param t current time
|
|
276
|
+
* @param b beginning value
|
|
277
|
+
* @param c change in value
|
|
278
|
+
* @param d duration
|
|
279
|
+
*/
|
|
280
|
+
easeOutExpo = (t, b, c, d) => c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
|
|
281
|
+
/** Parse a formatted string back to a number using the current separator/decimal options. */
|
|
282
|
+
parse(number) {
|
|
283
|
+
const escapeRegExp = (s) => s.replace(/([.,' ])/g, "\\$1");
|
|
284
|
+
const sep = escapeRegExp(this.options.separator || ",");
|
|
285
|
+
const dec = escapeRegExp(this.options.decimal || ".");
|
|
286
|
+
const num = number.replace(new RegExp(sep, "g"), "").replace(new RegExp(dec, "g"), ".");
|
|
287
|
+
return parseFloat(num);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
//#endregion
|
|
291
|
+
export { CountUp };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.0.0
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
//#region components/stat-card/utils/odometer.ts
|
|
10
|
+
var rAF = (callback) => typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame(callback) : setTimeout(() => callback(Date.now()), 1e3 / 60);
|
|
11
|
+
var Odometer = class {
|
|
12
|
+
version = "1.0";
|
|
13
|
+
options;
|
|
14
|
+
defaults = {
|
|
15
|
+
duration: .8,
|
|
16
|
+
lastDigitDelay: .25
|
|
17
|
+
};
|
|
18
|
+
cell_digits = null;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = {
|
|
21
|
+
...this.defaults,
|
|
22
|
+
...options
|
|
23
|
+
};
|
|
24
|
+
this.cell_digits = null;
|
|
25
|
+
}
|
|
26
|
+
destroy() {
|
|
27
|
+
this.cell_digits?.forEach((cell) => {
|
|
28
|
+
clearTimeout(cell.lastTimer);
|
|
29
|
+
if (cell.timerClean) clearTimeout(cell.timerClean);
|
|
30
|
+
});
|
|
31
|
+
this.cell_digits = null;
|
|
32
|
+
}
|
|
33
|
+
render(elem, formatted) {
|
|
34
|
+
const options = this.options;
|
|
35
|
+
let createdNow = false;
|
|
36
|
+
if (!this.cell_digits) {
|
|
37
|
+
createdNow = true;
|
|
38
|
+
if (!document.querySelector("style[odometer]")) {
|
|
39
|
+
const style = document.createElement("style");
|
|
40
|
+
style.setAttribute("odometer", "odometer");
|
|
41
|
+
style.innerHTML = ".odometer-numbers{display:inline-flex;line-height:100%;overflow-y:hidden}.odometer-numbers>span{display:flex;flex-direction:column;justify-content:start;align-items:center;height:1em;will-change:transform;transform:translateY(0)}";
|
|
42
|
+
document.head.appendChild(style);
|
|
43
|
+
}
|
|
44
|
+
elem.innerHTML = "<div class=\"odometer-numbers\"></div>";
|
|
45
|
+
this.cell_digits = [];
|
|
46
|
+
}
|
|
47
|
+
const blank = "<span style=\"color:transparent\">0</span>";
|
|
48
|
+
const transitionDigit = `transform ${options.duration}s ease-out`;
|
|
49
|
+
for (let i = this.cell_digits.length; i < formatted.length; i++) {
|
|
50
|
+
const container = document.createElement("span");
|
|
51
|
+
container.style.transition = transitionDigit;
|
|
52
|
+
container.innerHTML = createdNow ? "" : blank;
|
|
53
|
+
if (elem.firstChild) elem.firstChild.appendChild(container);
|
|
54
|
+
this.cell_digits.push({
|
|
55
|
+
container,
|
|
56
|
+
current: void 0,
|
|
57
|
+
position: createdNow ? 1 : 0,
|
|
58
|
+
new: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function appendDigit(cell, newDigit) {
|
|
62
|
+
cell.position--;
|
|
63
|
+
cell.container.appendChild(newDigit);
|
|
64
|
+
cell.lastTimeAdd = +/* @__PURE__ */ new Date();
|
|
65
|
+
if (cell.new) {
|
|
66
|
+
cell.new = false;
|
|
67
|
+
rAF(function() {
|
|
68
|
+
cell.container.style.transform = `translateY(${cell.position}em)`;
|
|
69
|
+
});
|
|
70
|
+
} else cell.container.style.transform = `translateY(${cell.position}em)`;
|
|
71
|
+
}
|
|
72
|
+
function pushDigit(cell, newDigit) {
|
|
73
|
+
const { lastDigitDelay = .25, duration = .8 } = options;
|
|
74
|
+
if (cell.nextToAdd) {
|
|
75
|
+
appendDigit(cell, cell.nextToAdd);
|
|
76
|
+
clearTimeout(cell.lastTimer);
|
|
77
|
+
cell.nextToAdd = null;
|
|
78
|
+
}
|
|
79
|
+
const now = +/* @__PURE__ */ new Date();
|
|
80
|
+
const lastTimeAdd = cell.lastTimeAdd ?? 0;
|
|
81
|
+
const delayTime = lastDigitDelay * 1e3 - (now - lastTimeAdd);
|
|
82
|
+
if (lastDigitDelay <= 0 || now - lastTimeAdd >= delayTime * 1.05) {
|
|
83
|
+
appendDigit(cell, newDigit);
|
|
84
|
+
cell.nextToAdd = null;
|
|
85
|
+
} else {
|
|
86
|
+
cell.nextToAdd = newDigit;
|
|
87
|
+
cell.lastTimer = setTimeout(() => {
|
|
88
|
+
if (cell.nextToAdd) appendDigit(cell, cell.nextToAdd);
|
|
89
|
+
cell.nextToAdd = null;
|
|
90
|
+
}, duration * 1e3);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const len = Math.max(formatted.length, this.cell_digits.length);
|
|
94
|
+
for (let i = 0; i < len; i++) {
|
|
95
|
+
const ch = i < formatted.length ? formatted.charAt(i) : null;
|
|
96
|
+
const cell = this.cell_digits[i];
|
|
97
|
+
if (cell.current != ch) {
|
|
98
|
+
cell.current = ch;
|
|
99
|
+
const newDigit = document.createElement("span");
|
|
100
|
+
newDigit.innerHTML = ch === null ? blank : ch;
|
|
101
|
+
if (cell.container.children.length < 4) appendDigit(cell, newDigit);
|
|
102
|
+
else pushDigit(cell, newDigit);
|
|
103
|
+
if (cell.timerClean) clearTimeout(cell.timerClean);
|
|
104
|
+
cell.timerClean = setTimeout(function() {
|
|
105
|
+
cell.timerClean = null;
|
|
106
|
+
if (cell.container.children.length < 3) return;
|
|
107
|
+
cell.container.style.transition = "none";
|
|
108
|
+
rAF(() => {
|
|
109
|
+
cell.position = -1;
|
|
110
|
+
while (cell.container.children.length > 1) {
|
|
111
|
+
const firstChild = cell.container.firstChild;
|
|
112
|
+
if (!firstChild) break;
|
|
113
|
+
cell.container.removeChild(firstChild);
|
|
114
|
+
}
|
|
115
|
+
const digitBlank = document.createElement("span");
|
|
116
|
+
digitBlank.innerHTML = blank;
|
|
117
|
+
cell.container.insertBefore(digitBlank, cell.container.firstChild);
|
|
118
|
+
cell.container.style.transform = `translateY(${cell.position}em)`;
|
|
119
|
+
rAF(() => {
|
|
120
|
+
cell.container.style.transition = transitionDigit;
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}, ((options.duration || .8) + (options.duration || .25)) * 1e3 + 2500);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Odometer };
|