react-kui 3.1.2 → 3.2.1
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/README.zh-CN.md +3 -1
- package/ai/kui-components.json +918 -324
- package/es/_virtual/_rolldown/runtime.js +1 -1
- package/es/affix/index.js +1 -1
- package/es/alert/index.js +11 -4
- package/es/anchor/anchor-context.js +1 -1
- package/es/anchor/anchor-link.js +1 -1
- package/es/anchor/anchor.js +1 -1
- package/es/auto-complete/index.js +371 -347
- package/es/avatar/avatar-group-context.js +1 -1
- package/es/avatar/avatar-group.js +1 -1
- package/es/avatar/avatar.js +1 -1
- package/es/back-top/index.js +1 -1
- package/es/badge/index.js +10 -8
- package/es/base/teleport.js +1 -1
- package/es/base/transition-props.js +1 -1
- package/es/base/transition.js +1 -1
- package/es/breadcrumb/breadcrumb-context.js +1 -1
- package/es/breadcrumb/breadcrumb-item.js +1 -1
- package/es/breadcrumb/breadcrumb.js +1 -1
- package/es/button/button-group-context.js +1 -1
- package/es/button/button-group.js +1 -1
- package/es/button/button.js +13 -6
- package/es/calendar/index.js +20 -6
- package/es/card/index.js +11 -4
- package/es/carousel/carousel-context.js +1 -1
- package/es/carousel/carousel-item.js +1 -1
- package/es/carousel/carousel.js +1 -1
- package/es/carousel/drag.js +1 -1
- package/es/cascader/index.js +13 -10
- package/es/check-card/check-card-group.js +3 -3
- package/es/check-card/check-card.js +155 -141
- package/es/check-card/context.js +1 -1
- package/es/checkbox/checkbox-group-context.js +1 -1
- package/es/checkbox/checkbox-group.js +3 -3
- package/es/checkbox/checkbox.js +64 -244
- package/es/checkbox/index.js +1 -1
- package/es/collapse/collapse-panel.js +1 -1
- package/es/collapse/collapse.js +96 -82
- package/es/color-picker/alpha.js +1 -1
- package/es/color-picker/hue.js +1 -1
- package/es/color-picker/index.js +7 -7
- package/es/color-picker/mode.js +2 -2
- package/es/color-picker/paint.js +1 -1
- package/es/color-picker/presets.js +1 -1
- package/es/components.js +4 -4
- package/es/config/config-context.js +16 -3
- package/es/config/context.js +29 -2
- package/es/config/index.js +31 -12
- package/es/config/popup-host.js +106 -0
- package/es/config/size-context.js +1 -1
- package/es/config/use-config-appearance.js +62 -2
- package/es/const/var.js +6 -2
- package/es/date-picker/index.js +404 -885
- package/es/descriptions/descriptions-item.js +1 -1
- package/es/descriptions/descriptions.js +1 -1
- package/es/divider/index.js +1 -1
- package/es/drawer/index.js +328 -240
- package/es/dropdown/dropdown-button.js +69 -51
- package/es/dropdown/dropdown-context.js +1 -1
- package/es/dropdown/dropdown.js +137 -93
- package/es/dropdown/trigger.js +85 -33
- package/es/empty/index.js +3 -4
- package/es/feature-card/index.js +15 -4
- package/es/feedback-panel/index.js +95 -81
- package/es/flame-wrap/index.js +116 -109
- package/es/flame-wrap/types.js +54 -6
- package/es/flex/index.js +1 -1
- package/es/form/field-context.js +16 -2
- package/es/form/form-context.js +1 -1
- package/es/form/form-item.js +7 -6
- package/es/form/form.js +1 -1
- package/es/form/utils.js +1 -1
- package/es/grid/grid-item.js +1 -1
- package/es/grid/grid.js +1 -1
- package/es/grid/useBreakpoint.js +1 -1
- package/es/icon/index.js +1 -1
- package/es/image/group.js +1 -1
- package/es/image/image-group-context.js +1 -1
- package/es/image/image.js +137 -123
- package/es/image/instance.js +1 -1
- package/es/image/preview.js +1 -1
- package/es/image/utils.js +1 -1
- package/es/index.js +3 -3
- package/es/input/index.js +3 -3
- package/es/input/input-base.js +7 -7
- package/es/input/input-box.js +2 -2
- package/es/input/input-group.js +43 -127
- package/es/input/input.js +1 -1
- package/es/input/textarea.js +28 -114
- package/es/input-number/index.js +7 -5
- package/es/input-otp/index.js +5 -5
- package/es/input-tag/index.js +5 -5
- package/es/kanban/index.js +79 -63
- package/es/layout/index.js +1 -1
- package/es/layout/layout-context.js +1 -1
- package/es/list-panel/index.js +96 -83
- package/es/loading/index.js +1 -1
- package/es/loading/loading-bar.js +1 -1
- package/es/locale/de.js +10 -2
- package/es/locale/el.js +10 -2
- package/es/locale/en.js +10 -2
- package/es/locale/fr.js +10 -2
- package/es/locale/it.js +10 -2
- package/es/locale/ja.js +10 -2
- package/es/locale/ko.js +10 -2
- package/es/locale/ru.js +10 -2
- package/es/locale/th.js +10 -2
- package/es/locale/uk.js +10 -2
- package/es/locale/vi.js +10 -2
- package/es/locale/zh-CN.js +10 -2
- package/es/locale/zh-TW.js +10 -2
- package/es/mentions/index.js +291 -286
- package/es/menu/menu-context.js +1 -1
- package/es/menu/menu-divider.js +1 -1
- package/es/menu/menu-group.js +1 -1
- package/es/menu/menu-item.js +1 -1
- package/es/menu/menu-keyboard.js +41 -2
- package/es/menu/menu.js +268 -222
- package/es/menu/recursive-menu.js +1 -1
- package/es/menu/sub-menu.js +81 -23
- package/es/message/index.js +1 -1
- package/es/modal/api.js +46 -12
- package/es/modal/modal.js +441 -345
- package/es/modal/toast.js +177 -64
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
- package/es/notice/container.js +1 -1
- package/es/notice/content.js +1 -1
- package/es/notice/index.js +1 -1
- package/es/notice/instance.js +1 -1
- package/es/page/index.js +13 -8
- package/es/page/responsive.js +1 -1
- package/es/page-header/index.js +1 -1
- package/es/popconfirm/index.js +36 -35
- package/es/poptip/index.js +47 -45
- package/es/popup/index.js +5 -2
- package/es/popup/layers.js +11 -2
- package/es/progress/index.js +1 -1
- package/es/qrcode/index.js +13 -7
- package/es/radio/radio-button.js +51 -44
- package/es/radio/radio-group-context.js +1 -1
- package/es/radio/radio-group.js +49 -52
- package/es/radio/radio.js +46 -197
- package/es/rate/index.js +1 -1
- package/es/rate/star.js +1 -1
- package/es/result/index.js +1 -1
- package/es/ripple/index.js +104 -97
- package/es/ripple/types.js +71 -18
- package/es/row-col/col.js +1 -1
- package/es/row-col/row.js +1 -1
- package/es/segmented/index.js +112 -92
- package/es/select/option.js +1 -1
- package/es/select/select.js +29 -29
- package/es/skeleton/skeleton-avatar.js +1 -1
- package/es/skeleton/skeleton-button.js +1 -1
- package/es/skeleton/skeleton-image.js +1 -1
- package/es/skeleton/skeleton-text.js +1 -1
- package/es/skeleton/skeleton.js +1 -1
- package/es/skeleton/use-skeleton-loading.js +1 -1
- package/es/slider/index.js +1 -1
- package/es/slider/thumb.js +1 -1
- package/es/space/index.js +1 -1
- package/es/spin/index.js +1 -1
- package/es/splitter/splitter-panel.js +1 -1
- package/es/splitter/splitter.js +1 -1
- package/es/stat-card/countup.js +2 -2
- package/es/stat-card/rollup.js +1 -1
- package/es/stat-card/stat-card.js +16 -7
- package/es/stat-card/stat-number.js +4 -3
- package/es/stat-card/utils/countup.js +1 -1
- package/es/stat-card/utils/odometer.js +1 -1
- package/es/stat-card/utils/stat-item-key.js +22 -0
- package/es/steps/index.js +1 -1
- package/es/switch/index.js +3 -3
- package/es/table/column-setting.js +104 -115
- package/es/table/index.js +556 -207
- package/es/table/utils.js +140 -3
- package/es/tabs/tab-panel.js +1 -1
- package/es/tabs/tabs.js +1 -1
- package/es/tag/index.js +12 -5
- package/es/time-line/timeline-item.js +1 -1
- package/es/time-line/timeline.js +1 -1
- package/es/tooltip/index.js +114 -94
- package/es/tour/index.js +1 -1
- package/es/transfer/index.js +190 -172
- package/es/tree/index.js +55 -44
- package/es/tree/utils.js +1 -1
- package/es/tree-select/index.js +259 -781
- package/es/typography/index.js +1 -1
- package/es/upload/file-list.js +1 -1
- package/es/upload/index.js +5 -6
- package/es/upload/picture-sort.js +1 -1
- package/es/upload/selector.js +1 -1
- package/es/utils/checked.js +1 -1
- package/es/utils/color.js +25 -2
- package/es/utils/css.js +19 -0
- package/es/utils/focus.js +63 -0
- package/es/utils/number.js +1 -1
- package/es/utils/overlay-order.js +18 -0
- package/es/utils/overlay-stack.js +33 -0
- package/es/utils/placement.js +1 -1
- package/es/utils/popup.js +1 -1
- package/es/utils/promise.js +18 -0
- package/es/utils/react-node.js +55 -30
- package/es/utils/selection-tags.js +6 -4
- package/es/utils/share.js +5 -2
- package/es/utils/theme.js +1 -1
- package/es/utils/transition.js +1 -1
- package/es/utils/use-value.js +1 -1
- package/es/virtual-list/index.js +1 -1
- package/es/virtual-list/range.js +3 -2
- package/es/watermark/index.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +2 -2
- package/lib/locale/el.cjs +2 -2
- package/lib/locale/en.cjs +2 -2
- package/lib/locale/fr.cjs +2 -2
- package/lib/locale/it.cjs +2 -2
- package/lib/locale/ja.cjs +2 -2
- package/lib/locale/ko.cjs +2 -2
- package/lib/locale/ru.cjs +2 -2
- package/lib/locale/th.cjs +2 -2
- package/lib/locale/uk.cjs +2 -2
- package/lib/locale/vi.cjs +2 -2
- package/lib/locale/zh-CN.cjs +2 -2
- package/lib/locale/zh-TW.cjs +2 -2
- package/package.json +4 -3
- package/readme.md +3 -1
- package/style/base.css +2 -2
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +2 -2
- package/types/alert/index.d.cts +2 -2
- package/types/alert/index.d.ts +2 -2
- package/types/auto-complete/index.d.cts +7 -1
- package/types/auto-complete/index.d.ts +7 -1
- package/types/badge/index.d.cts +2 -1
- package/types/badge/index.d.ts +2 -1
- package/types/button/button.d.cts +2 -2
- package/types/button/button.d.ts +2 -2
- package/types/card/index.d.cts +3 -3
- package/types/card/index.d.ts +3 -3
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/cascader/types.d.cts +2 -0
- package/types/cascader/types.d.ts +2 -0
- package/types/check-card/context.d.cts +4 -3
- package/types/check-card/context.d.ts +4 -3
- package/types/check-card/index.d.cts +1 -1
- package/types/check-card/index.d.ts +1 -1
- package/types/check-card/types.d.cts +3 -4
- package/types/check-card/types.d.ts +3 -4
- package/types/checkbox/checkbox-group.d.cts +2 -2
- package/types/checkbox/checkbox-group.d.ts +2 -2
- package/types/checkbox/checkbox.d.cts +2 -2
- package/types/checkbox/checkbox.d.ts +2 -2
- package/types/collapse/collapse.d.cts +3 -3
- package/types/collapse/collapse.d.ts +3 -3
- package/types/color-picker/index.d.cts +3 -1
- package/types/color-picker/index.d.ts +3 -1
- package/types/components.d.cts +2 -2
- package/types/components.d.ts +2 -2
- package/types/config/config-context.d.cts +15 -2
- package/types/config/config-context.d.ts +15 -2
- package/types/config/context.d.cts +6 -0
- package/types/config/context.d.ts +6 -0
- package/types/config/popup-host.d.cts +16 -0
- package/types/config/popup-host.d.ts +16 -0
- package/types/config/use-config-appearance.d.cts +41 -2
- package/types/config/use-config-appearance.d.ts +41 -2
- package/types/const/types.d.cts +30 -1
- package/types/const/types.d.ts +30 -1
- package/types/const/var.d.cts +6 -1
- package/types/const/var.d.ts +6 -1
- package/types/date-picker/index.d.cts +3 -1
- package/types/date-picker/index.d.ts +3 -1
- package/types/descriptions/descriptions.d.cts +2 -2
- package/types/descriptions/descriptions.d.ts +2 -2
- package/types/drawer/index.d.cts +1 -0
- package/types/drawer/index.d.ts +1 -0
- package/types/dropdown/dropdown-button.d.cts +5 -2
- package/types/dropdown/dropdown-button.d.ts +5 -2
- package/types/dropdown/dropdown-context.d.cts +6 -0
- package/types/dropdown/dropdown-context.d.ts +6 -0
- package/types/dropdown/dropdown.d.cts +2 -0
- package/types/dropdown/dropdown.d.ts +2 -0
- package/types/feature-card/index.d.cts +3 -3
- package/types/feature-card/index.d.ts +3 -3
- package/types/feedback-panel/index.d.cts +3 -3
- package/types/feedback-panel/index.d.ts +3 -3
- package/types/flame-wrap/types.d.cts +18 -0
- package/types/flame-wrap/types.d.ts +18 -0
- package/types/form/field-context.d.cts +2 -0
- package/types/form/field-context.d.ts +2 -0
- package/types/image/image.d.cts +2 -2
- package/types/image/image.d.ts +2 -2
- package/types/input/input-group.d.cts +2 -2
- package/types/input/input-group.d.ts +2 -2
- package/types/input-number/index.d.cts +2 -0
- package/types/input-number/index.d.ts +2 -0
- package/types/kanban/index.d.cts +3 -2
- package/types/kanban/index.d.ts +3 -2
- package/types/list-panel/index.d.cts +3 -3
- package/types/list-panel/index.d.ts +3 -3
- package/types/locale/de.d.cts +6 -0
- package/types/locale/de.d.ts +6 -0
- package/types/locale/el.d.cts +6 -0
- package/types/locale/el.d.ts +6 -0
- package/types/locale/en.d.cts +6 -0
- package/types/locale/en.d.ts +6 -0
- package/types/locale/fr.d.cts +6 -0
- package/types/locale/fr.d.ts +6 -0
- package/types/locale/it.d.cts +6 -0
- package/types/locale/it.d.ts +6 -0
- package/types/locale/ja.d.cts +6 -0
- package/types/locale/ja.d.ts +6 -0
- package/types/locale/ko.d.cts +6 -0
- package/types/locale/ko.d.ts +6 -0
- package/types/locale/ru.d.cts +6 -0
- package/types/locale/ru.d.ts +6 -0
- package/types/locale/th.d.cts +6 -0
- package/types/locale/th.d.ts +6 -0
- package/types/locale/uk.d.cts +6 -0
- package/types/locale/uk.d.ts +6 -0
- package/types/locale/vi.d.cts +6 -0
- package/types/locale/vi.d.ts +6 -0
- package/types/locale/zh-CN.d.cts +6 -0
- package/types/locale/zh-CN.d.ts +6 -0
- package/types/locale/zh-TW.d.cts +6 -0
- package/types/locale/zh-TW.d.ts +6 -0
- package/types/mentions/index.d.cts +2 -0
- package/types/mentions/index.d.ts +2 -0
- package/types/menu/menu-keyboard.d.cts +23 -0
- package/types/menu/menu-keyboard.d.ts +23 -0
- package/types/modal/api.d.cts +6 -1
- package/types/modal/api.d.ts +6 -1
- package/types/modal/modal.d.cts +1 -0
- package/types/modal/modal.d.ts +1 -0
- package/types/modal/toast.d.cts +8 -2
- package/types/modal/toast.d.ts +8 -2
- package/types/page/index.d.cts +2 -2
- package/types/page/index.d.ts +2 -2
- package/types/popconfirm/index.d.cts +2 -0
- package/types/popconfirm/index.d.ts +2 -0
- package/types/poptip/index.d.cts +2 -0
- package/types/poptip/index.d.ts +2 -0
- package/types/popup/layers.d.cts +2 -0
- package/types/popup/layers.d.ts +2 -0
- package/types/qrcode/index.d.cts +2 -2
- package/types/qrcode/index.d.ts +2 -2
- package/types/radio/radio-button.d.cts +2 -2
- package/types/radio/radio-button.d.ts +2 -2
- package/types/radio/radio-group.d.cts +2 -2
- package/types/radio/radio-group.d.ts +2 -2
- package/types/radio/radio.d.cts +2 -2
- package/types/radio/radio.d.ts +2 -2
- package/types/ripple/types.d.cts +18 -0
- package/types/ripple/types.d.ts +18 -0
- package/types/segmented/index.d.cts +2 -1
- package/types/segmented/index.d.ts +2 -1
- package/types/select/select.d.cts +2 -0
- package/types/select/select.d.ts +2 -0
- package/types/stat-card/stat-card.d.cts +3 -3
- package/types/stat-card/stat-card.d.ts +3 -3
- package/types/stat-card/utils/stat-item-key.d.cts +11 -0
- package/types/stat-card/utils/stat-item-key.d.ts +11 -0
- package/types/table/column-setting.d.cts +4 -4
- package/types/table/column-setting.d.ts +4 -4
- package/types/table/index.d.cts +2 -2
- package/types/table/index.d.ts +2 -2
- package/types/table/types.d.cts +21 -2
- package/types/table/types.d.ts +21 -2
- package/types/table/utils.d.cts +75 -0
- package/types/table/utils.d.ts +75 -0
- package/types/tag/index.d.cts +2 -2
- package/types/tag/index.d.ts +2 -2
- package/types/tooltip/index.d.cts +2 -0
- package/types/tooltip/index.d.ts +2 -0
- package/types/transfer/index.d.cts +3 -2
- package/types/transfer/index.d.ts +3 -2
- package/types/tree-select/index.d.cts +3 -1
- package/types/tree-select/index.d.ts +3 -1
- package/types/utils/checked.d.cts +1 -1
- package/types/utils/checked.d.ts +1 -1
- package/types/utils/color.d.cts +13 -0
- package/types/utils/color.d.ts +13 -0
- package/types/utils/css.d.cts +2 -0
- package/types/utils/css.d.ts +2 -0
- package/types/utils/focus.d.cts +5 -0
- package/types/utils/focus.d.ts +5 -0
- package/types/utils/overlay-order.d.cts +6 -0
- package/types/utils/overlay-order.d.ts +6 -0
- package/types/utils/overlay-stack.d.cts +13 -0
- package/types/utils/overlay-stack.d.ts +13 -0
- package/types/utils/promise.d.cts +5 -0
- package/types/utils/promise.d.ts +5 -0
- package/types/utils/react-node.d.cts +10 -0
- package/types/utils/react-node.d.ts +10 -0
package/es/typography/index.js
CHANGED
package/es/upload/file-list.js
CHANGED
package/es/upload/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import { ConfigContext } from "../config/config-context.js";
|
|
9
|
+
import { ConfigContext, DEFAULT_LOCALE } from "../config/config-context.js";
|
|
11
10
|
import { createFormFieldComponent } from "../form/field-context.js";
|
|
12
11
|
import FileList from "./file-list.js";
|
|
13
12
|
import Selector from "./selector.js";
|
|
@@ -20,7 +19,7 @@ var createUploadUid = () => globalThis.crypto?.randomUUID?.() ?? `k-upload-${Dat
|
|
|
20
19
|
var formatSize = (size) => size < 1024 ? `${size}B` : size < 1024 ** 2 ? `${(size / 1024).toFixed(2)}KB` : size < 1024 ** 3 ? `${(size / 1024 ** 2).toFixed(2)}MB` : `${(size / 1024 ** 3).toFixed(2)}GB`;
|
|
21
20
|
var Upload = forwardRef(function Upload({ method = "post", name = "file", action, type = "list", data = {}, disabled, readOnly, directory, multiple, accept, headers, withCredentials = false, timeout = 0, customRequest, parseResponse, showUploadList = true, transformFile, fileList, autoTrigger = true, limit, minSize, maxSize, uploadText, uploadSubText, uploadIcon, draggable, sortable, preview = true, validateAccept = true, maxConcurrent = Infinity, onChange, onRemove, onSelectFiles, onExceed, onSizeError, onTypeError, onSort, onBeforeUpload, className, children, ...rest }, ref) {
|
|
22
21
|
const { locale } = useContext(ConfigContext);
|
|
23
|
-
const messages = locale ??
|
|
22
|
+
const messages = locale ?? DEFAULT_LOCALE;
|
|
24
23
|
const [files, setFiles] = useState(fileList ?? []);
|
|
25
24
|
const filesRef = useRef(files);
|
|
26
25
|
filesRef.current = files;
|
|
@@ -132,7 +131,7 @@ var Upload = forwardRef(function Upload({ method = "post", name = "file", action
|
|
|
132
131
|
item_7.percent = 100;
|
|
133
132
|
item_7.response = value;
|
|
134
133
|
if (item_7.uid) pendingRef.current.delete(item_7.uid);
|
|
135
|
-
} else item_7.errorText = value instanceof Error ? value.message : String(value || messages?.k
|
|
134
|
+
} else item_7.errorText = value instanceof Error ? value.message : String(value || messages?.k.upload.failed);
|
|
136
135
|
item_7.xhr = void 0;
|
|
137
136
|
update(item_7);
|
|
138
137
|
finishTask(item_7);
|
|
@@ -184,7 +183,7 @@ var Upload = forwardRef(function Upload({ method = "post", name = "file", action
|
|
|
184
183
|
if (item_7.uid) requestHandlesRef.current.set(item_7.uid, { abort: () => xhr_0.abort() });
|
|
185
184
|
Object.entries(headers ?? {}).forEach(([key_0, value_1]) => xhr_0.setRequestHeader(key_0, value_1));
|
|
186
185
|
const fail = (detail) => {
|
|
187
|
-
const message = detail ? `${messages?.k
|
|
186
|
+
const message = detail ? `${messages?.k.upload.failed}: ${detail}` : messages?.k.upload.failed;
|
|
188
187
|
settle("error", message);
|
|
189
188
|
};
|
|
190
189
|
xhr_0.upload.onloadstart = () => {
|
package/es/upload/selector.js
CHANGED
package/es/utils/checked.js
CHANGED
package/es/utils/color.js
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import Color from "color";
|
|
9
10
|
//#region components/utils/color.ts
|
|
10
11
|
function isColor(value) {
|
|
11
12
|
if (typeof value !== "string" || typeof CSS === "undefined" || !CSS.supports) return false;
|
|
12
13
|
return CSS.supports("color", value);
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* `color-mix(in srgb, <colour> <share>%, transparent)` written out as a plain colour.
|
|
17
|
+
*
|
|
18
|
+
* Mixing with `transparent` in srgb only scales the colour's own alpha, so the result is the same
|
|
19
|
+
* rgb triple at `share × alpha` — a value every engine can paint, including the Electron build on
|
|
20
|
+
* Windows 7, where `color-mix()` needs Chrome 111 and a declaration that uses it simply gets no
|
|
21
|
+
* value at all.
|
|
22
|
+
*
|
|
23
|
+
* `share` is the percentage the stylesheet would have written. Colours that only resolve in the
|
|
24
|
+
* browser (`currentColor`, `var(--token)`) and anything unparseable return `undefined`, so callers
|
|
25
|
+
* keep the shade their stylesheet baked instead of shipping a broken declaration.
|
|
26
|
+
*/
|
|
27
|
+
function wash(value, share) {
|
|
28
|
+
if (!value) return void 0;
|
|
29
|
+
try {
|
|
30
|
+
const { r, g, b, alpha = 1 } = Color(value).rgb().object();
|
|
31
|
+
const washAlpha = Math.round(alpha * share / 100 * 100) / 100;
|
|
32
|
+
return `rgba(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)}, ${washAlpha})`;
|
|
33
|
+
} catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
14
37
|
//#endregion
|
|
15
|
-
export { isColor };
|
|
38
|
+
export { isColor, wash };
|
package/es/utils/css.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.2.1
|
|
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/utils/css.ts
|
|
10
|
+
var numericLengthPattern = /^-?(?:\d+\.?\d*|\.\d+)$/;
|
|
11
|
+
var toCssLength = (value) => {
|
|
12
|
+
if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : void 0;
|
|
13
|
+
if (typeof value !== "string") return void 0;
|
|
14
|
+
const normalized = value.trim();
|
|
15
|
+
if (!normalized) return void 0;
|
|
16
|
+
return numericLengthPattern.test(normalized) ? `${normalized}px` : normalized;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { toCssLength };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.2.1
|
|
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/utils/focus.ts
|
|
10
|
+
var focusableSelector = [
|
|
11
|
+
"[autofocus]",
|
|
12
|
+
"button:not([disabled])",
|
|
13
|
+
"a[href]",
|
|
14
|
+
"input:not([disabled])",
|
|
15
|
+
"select:not([disabled])",
|
|
16
|
+
"textarea:not([disabled])",
|
|
17
|
+
"[tabindex]:not([tabindex='-1'])"
|
|
18
|
+
].join(",");
|
|
19
|
+
var getFocusableElements = (container) => Array.from(container.querySelectorAll(focusableSelector)).filter((element) => !element.hidden && element.getAttribute("aria-hidden") !== "true");
|
|
20
|
+
var createFocusTrap = (getContainer) => {
|
|
21
|
+
let previousFocus = null;
|
|
22
|
+
const activate = () => {
|
|
23
|
+
const active = document.activeElement;
|
|
24
|
+
previousFocus = active instanceof HTMLElement ? active : null;
|
|
25
|
+
queueMicrotask(() => {
|
|
26
|
+
const container = getContainer();
|
|
27
|
+
if (!container) return;
|
|
28
|
+
(getFocusableElements(container)[0] ?? container).focus({ preventScroll: true });
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const deactivate = () => {
|
|
32
|
+
const target = previousFocus;
|
|
33
|
+
previousFocus = null;
|
|
34
|
+
if (target?.isConnected) queueMicrotask(() => target.focus({ preventScroll: true }));
|
|
35
|
+
};
|
|
36
|
+
const handleKeydown = (event) => {
|
|
37
|
+
if (event.key !== "Tab") return;
|
|
38
|
+
const container = getContainer();
|
|
39
|
+
if (!container) return;
|
|
40
|
+
const focusable = getFocusableElements(container);
|
|
41
|
+
if (!focusable.length) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
container.focus({ preventScroll: true });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const first = focusable[0];
|
|
47
|
+
const last = focusable[focusable.length - 1];
|
|
48
|
+
if (event.shiftKey && (document.activeElement === first || !container.contains(document.activeElement))) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
last.focus();
|
|
51
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
first.focus();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
activate,
|
|
58
|
+
deactivate,
|
|
59
|
+
handleKeydown
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { createFocusTrap };
|
package/es/utils/number.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.2.1
|
|
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/utils/overlay-order.ts
|
|
10
|
+
/**
|
|
11
|
+
* 遮罩层(Modal / Drawer)与弹层(Popup)共用一个"打开顺序"时钟:数值越大越晚打开,也就越靠上。
|
|
12
|
+
* 两边各自有注册表(弹层要算子孙,语义不一样),但必须用同一个时钟才能互相比较谁压在上面。
|
|
13
|
+
* 两个仓库这份实现逐字符相同。
|
|
14
|
+
*/
|
|
15
|
+
var order = 0;
|
|
16
|
+
var nextOverlayOrder = () => ++order;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { nextOverlayOrder };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.2.1
|
|
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 { nextOverlayOrder } from "./overlay-order.js";
|
|
10
|
+
import { latestPopupLayerOrder } from "../popup/layers.js";
|
|
11
|
+
//#region components/utils/overlay-stack.ts
|
|
12
|
+
var overlays = [];
|
|
13
|
+
function pushOverlay() {
|
|
14
|
+
const order = nextOverlayOrder();
|
|
15
|
+
overlays.push(order);
|
|
16
|
+
let released = false;
|
|
17
|
+
return {
|
|
18
|
+
isTop: () => {
|
|
19
|
+
if (released) return false;
|
|
20
|
+
let top = order;
|
|
21
|
+
for (const other of overlays) top = Math.max(top, other);
|
|
22
|
+
return top === order && latestPopupLayerOrder() < order;
|
|
23
|
+
},
|
|
24
|
+
release: () => {
|
|
25
|
+
if (released) return;
|
|
26
|
+
released = true;
|
|
27
|
+
const index = overlays.indexOf(order);
|
|
28
|
+
if (index >= 0) overlays.splice(index, 1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { pushOverlay };
|
package/es/utils/placement.js
CHANGED
package/es/utils/popup.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.2.1
|
|
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/utils/promise.ts
|
|
10
|
+
/**
|
|
11
|
+
* onOk / validate 这类回调允许返回 Promise,组件得先认出 thenable 才决定要不要挂 loading。
|
|
12
|
+
* 两个仓库这份实现逐字符相同。
|
|
13
|
+
*/
|
|
14
|
+
function isPromiseLike(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && typeof value.then === "function";
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isPromiseLike };
|
package/es/utils/react-node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -26,38 +26,63 @@ function getChildren(children) {
|
|
|
26
26
|
});
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Whether an optional content prop deserves its wrapper element.
|
|
31
|
+
*
|
|
32
|
+
* `null` and `undefined` are the documented way to omit a slot, but callers also
|
|
33
|
+
* pass `false` (a conditional like `isAdmin && <Icon />`) or an empty string, and
|
|
34
|
+
* the framework renders `false` as nothing while still mounting the wrapper —
|
|
35
|
+
* which keeps its padding, border and flex gap in the layout with nothing inside
|
|
36
|
+
* it. Numbers count as content, including `0`.
|
|
37
|
+
*/
|
|
38
|
+
function hasRenderableContent(value) {
|
|
39
|
+
if (value == null || value === false || value === true) return false;
|
|
40
|
+
if (typeof value === "string") return value.trim() !== "";
|
|
41
|
+
if (Array.isArray(value)) return value.some(hasRenderableContent);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
var scrollLocks = /* @__PURE__ */ new Map();
|
|
43
45
|
var toggleContainerScroll = (target, lock) => {
|
|
44
|
-
if (!target ||
|
|
46
|
+
if (!target || typeof window === "undefined") return;
|
|
45
47
|
if (lock) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
const current = scrollLocks.get(target);
|
|
49
|
+
if (current) {
|
|
50
|
+
current.count += 1;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const state = {
|
|
54
|
+
count: 1,
|
|
55
|
+
overflow: target.style.overflow,
|
|
56
|
+
overflowY: target.style.overflowY,
|
|
57
|
+
width: target.style.width,
|
|
58
|
+
paddingRight: target.style.paddingRight,
|
|
59
|
+
scrollbarWidth: target.style.getPropertyValue("--kui-scrollbar-width"),
|
|
60
|
+
hadLockClass: target.classList.contains("k-scroll-locked")
|
|
61
|
+
};
|
|
62
|
+
const computedPadding = Number.parseFloat(window.getComputedStyle(target).paddingRight) || 0;
|
|
63
|
+
const scrollbarWidth = target === document.body ? Math.max(0, window.innerWidth - document.documentElement.clientWidth) : Math.max(0, target.offsetWidth - target.clientWidth);
|
|
64
|
+
target.classList.add("k-scroll-locked");
|
|
65
|
+
target.style.setProperty("--kui-scrollbar-width", `${scrollbarWidth}px`);
|
|
66
|
+
if (target === document.body) target.style.overflowY = "hidden";
|
|
67
|
+
else {
|
|
68
|
+
target.style.overflow = "hidden";
|
|
69
|
+
if (scrollbarWidth > 0) target.style.paddingRight = `${computedPadding + scrollbarWidth}px`;
|
|
59
70
|
}
|
|
71
|
+
scrollLocks.set(target, state);
|
|
72
|
+
return;
|
|
60
73
|
}
|
|
74
|
+
const state = scrollLocks.get(target);
|
|
75
|
+
if (!state) return;
|
|
76
|
+
state.count -= 1;
|
|
77
|
+
if (state.count > 0) return;
|
|
78
|
+
target.style.overflow = state.overflow;
|
|
79
|
+
target.style.overflowY = state.overflowY;
|
|
80
|
+
target.style.width = state.width;
|
|
81
|
+
target.style.paddingRight = state.paddingRight;
|
|
82
|
+
if (state.scrollbarWidth) target.style.setProperty("--kui-scrollbar-width", state.scrollbarWidth);
|
|
83
|
+
else target.style.removeProperty("--kui-scrollbar-width");
|
|
84
|
+
if (!state.hadLockClass) target.classList.remove("k-scroll-locked");
|
|
85
|
+
scrollLocks.delete(target);
|
|
61
86
|
};
|
|
62
87
|
//#endregion
|
|
63
|
-
export { getChildren, setRef, toggleContainerScroll };
|
|
88
|
+
export { getChildren, hasRenderableContent, setRef, toggleContainerScroll };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { SURFACE_THEMES, resolvePaintedTheme } from "../config/use-config-appearance.js";
|
|
9
10
|
import Space from "../space/index.js";
|
|
10
11
|
import Tag from "../tag/index.js";
|
|
11
12
|
import Tooltip from "../tooltip/index.js";
|
|
12
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
//#region components/utils/selection-tags.tsx
|
|
14
|
-
function renderSelectionTags({ labels, maxTagCount, size = "medium", shape, theme, disabled, readOnly, onRemove, overflowSize =
|
|
15
|
+
function renderSelectionTags({ labels, maxTagCount, size = "medium", shape, theme, disabled, readOnly, onRemove, overflowSize = size, tagClass, restClass, tooltipClass, keys }) {
|
|
15
16
|
const count = typeof maxTagCount === "number" && Number.isFinite(maxTagCount) ? Math.max(0, Math.floor(maxTagCount)) : labels.length;
|
|
17
|
+
const chipTheme = resolvePaintedTheme(theme, SURFACE_THEMES) ?? "fill";
|
|
16
18
|
const renderTag = (label, index, overflow = false) => /* @__PURE__ */ jsx(Tag, {
|
|
17
19
|
className: overflow ? void 0 : tagClass,
|
|
18
20
|
size: overflow ? overflowSize : size,
|
|
19
21
|
shape,
|
|
20
|
-
theme,
|
|
22
|
+
theme: chipTheme,
|
|
21
23
|
compact: true,
|
|
22
24
|
closeable: !disabled && !readOnly,
|
|
23
25
|
onClose: () => onRemove(index),
|
|
@@ -40,7 +42,7 @@ function renderSelectionTags({ labels, maxTagCount, size = "medium", shape, them
|
|
|
40
42
|
className: restClass,
|
|
41
43
|
size,
|
|
42
44
|
shape,
|
|
43
|
-
theme,
|
|
45
|
+
theme: chipTheme,
|
|
44
46
|
compact: true,
|
|
45
47
|
children: [
|
|
46
48
|
"+",
|
package/es/utils/share.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
//#region components/utils/share.ts
|
|
10
|
+
var assert = (condition, ...infos) => {
|
|
11
|
+
if (!condition) console.warn(...infos);
|
|
12
|
+
};
|
|
10
13
|
var clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
11
14
|
//#endregion
|
|
12
|
-
export { clamp };
|
|
15
|
+
export { assert, clamp };
|
package/es/utils/theme.js
CHANGED
package/es/utils/transition.js
CHANGED
package/es/utils/use-value.js
CHANGED
package/es/virtual-list/index.js
CHANGED
package/es/virtual-list/range.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -15,7 +15,8 @@ var getVirtualRange = ({ count, scrollTop, viewportHeight, itemHeight, overscan
|
|
|
15
15
|
const safeViewportHeight = Number.isFinite(viewportHeight) ? Math.max(0, viewportHeight) : 0;
|
|
16
16
|
const safeScrollTop = Number.isFinite(scrollTop) ? Math.max(0, scrollTop) : 0;
|
|
17
17
|
const visibleCount = Math.ceil(safeViewportHeight / safeHeight);
|
|
18
|
-
const
|
|
18
|
+
const maxStart = Math.max(0, safeCount - visibleCount);
|
|
19
|
+
const start = Math.min(maxStart, Math.max(0, Math.floor(safeScrollTop / safeHeight) - safeOverscan));
|
|
19
20
|
return {
|
|
20
21
|
start,
|
|
21
22
|
end: Math.min(safeCount, start + visibleCount + safeOverscan * 2),
|
package/es/watermark/index.js
CHANGED