react-kui 3.2.1 → 3.3.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/kui-components.json +819 -162
- package/es/_virtual/_rolldown/runtime.js +2 -3
- package/es/affix/index.js +73 -185
- package/es/alert/index.js +3 -4
- package/es/anchor/anchor-context.js +2 -3
- package/es/anchor/anchor-link.js +3 -4
- package/es/anchor/anchor.js +195 -398
- package/es/auto-complete/index.js +160 -561
- package/es/avatar/avatar-group-context.js +2 -3
- package/es/avatar/avatar-group.js +32 -124
- package/es/avatar/avatar.js +58 -159
- package/es/back-top/index.js +66 -201
- package/es/badge/index.js +4 -5
- package/es/base/teleport.js +22 -54
- package/es/base/transition-props.js +2 -3
- package/es/base/transition.js +2 -3
- package/es/breadcrumb/breadcrumb-context.js +2 -3
- package/es/breadcrumb/breadcrumb-item.js +19 -102
- package/es/breadcrumb/breadcrumb.js +10 -59
- package/es/button/button-group-context.js +2 -3
- package/es/button/button-group.js +15 -75
- package/es/button/button.js +4 -5
- package/es/calendar/index.js +4 -5
- package/es/card/index.js +4 -5
- package/es/carousel/carousel-context.js +2 -3
- package/es/carousel/carousel-item.js +3 -4
- package/es/carousel/carousel.js +281 -628
- package/es/carousel/drag.js +2 -3
- package/es/cascader/index.js +7 -8
- package/es/check-card/check-card-group.js +53 -179
- package/es/check-card/check-card.js +100 -293
- package/es/check-card/context.js +2 -3
- package/es/checkbox/checkbox-group-context.js +2 -3
- package/es/checkbox/checkbox-group.js +34 -138
- package/es/checkbox/checkbox.js +4 -5
- package/es/checkbox/index.js +2 -3
- package/es/collapse/collapse-panel.js +84 -206
- package/es/collapse/collapse.js +38 -170
- package/es/color-picker/alpha.js +44 -125
- package/es/color-picker/hue.js +39 -108
- package/es/color-picker/index.js +7 -6
- package/es/color-picker/mode.js +76 -159
- package/es/color-picker/paint.js +66 -163
- package/es/color-picker/presets.js +12 -44
- package/es/components.js +37 -32
- package/es/config/config-context.js +2 -3
- package/es/config/context.js +2 -3
- package/es/config/index.js +3 -4
- package/es/config/popup-host.js +3 -4
- package/es/config/size-context.js +2 -3
- package/es/config/use-config-appearance.js +3 -4
- package/es/const/var.js +2 -3
- package/es/date-picker/index.js +8 -9
- package/es/descriptions/descriptions-item.js +3 -4
- package/es/descriptions/descriptions.js +53 -144
- package/es/divider/index.js +2 -3
- package/es/drawer/index.js +171 -465
- package/es/dropdown/dropdown-button.js +25 -128
- package/es/dropdown/dropdown-context.js +2 -3
- package/es/dropdown/dropdown.js +56 -207
- package/es/dropdown/trigger.js +37 -125
- package/es/empty/index.js +34 -111
- package/es/feature-card/index.js +2 -3
- package/es/feedback-panel/index.js +30 -155
- package/es/flame-wrap/index.js +3 -4
- package/es/flame-wrap/types.js +2 -3
- package/es/flex/index.js +2 -3
- package/es/form/field-context.js +3 -4
- package/es/form/form-context.js +2 -3
- package/es/form/form-item.js +4 -5
- package/es/form/form.js +108 -279
- package/es/form/utils.js +2 -3
- package/es/gradient-picker/corners.js +55 -0
- package/es/gradient-picker/index.js +191 -0
- package/es/gradient-picker/stops.js +219 -0
- package/es/gradient-picker/types.js +147 -0
- package/es/grid/grid-item.js +25 -116
- package/es/grid/grid.js +40 -151
- package/es/grid/useBreakpoint.js +3 -4
- package/es/icon/index.js +24 -126
- package/es/image/group.js +3 -4
- package/es/image/image-group-context.js +2 -3
- package/es/image/image.js +5 -6
- package/es/image/instance.js +2 -3
- package/es/image/preview.js +4 -5
- package/es/image/utils.js +2 -3
- package/es/index.js +5 -4
- package/es/input/index.js +2 -3
- package/es/input/input-base.js +4 -5
- package/es/input/input-box.js +2 -3
- package/es/input/input-group.js +4 -5
- package/es/input/input.js +3 -4
- package/es/input/textarea.js +3 -4
- package/es/input-number/drag.js +63 -0
- package/es/input-number/index.js +41 -11
- package/es/input-otp/index.js +3 -4
- package/es/input-tag/index.js +5 -6
- package/es/kanban/index.js +31 -168
- package/es/layout/index.js +43 -215
- package/es/layout/layout-context.js +2 -3
- package/es/list-panel/index.js +47 -185
- package/es/loading/index.js +2 -3
- package/es/loading/loading-bar.js +54 -114
- package/es/locale/de.js +2 -3
- package/es/locale/el.js +2 -3
- package/es/locale/en.js +2 -3
- package/es/locale/fr.js +2 -3
- package/es/locale/it.js +2 -3
- package/es/locale/ja.js +2 -3
- package/es/locale/ko.js +2 -3
- package/es/locale/ru.js +2 -3
- package/es/locale/th.js +2 -3
- package/es/locale/uk.js +2 -3
- package/es/locale/vi.js +2 -3
- package/es/locale/zh-CN.js +2 -3
- package/es/locale/zh-TW.js +2 -3
- package/es/mentions/index.js +214 -581
- package/es/menu/menu-context.js +2 -3
- package/es/menu/menu-divider.js +3 -4
- package/es/menu/menu-group.js +3 -4
- package/es/menu/menu-item.js +2 -3
- package/es/menu/menu-keyboard.js +2 -3
- package/es/menu/menu.js +184 -442
- package/es/menu/recursive-menu.js +3 -4
- package/es/menu/sub-menu.js +5 -6
- package/es/message/index.js +2 -3
- package/es/modal/api.js +2 -3
- package/es/modal/modal.js +263 -599
- package/es/modal/toast.js +63 -179
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +2 -3
- package/es/notice/container.js +2 -3
- package/es/notice/content.js +4 -5
- package/es/notice/index.js +2 -3
- package/es/notice/instance.js +2 -3
- package/es/page/index.js +4 -5
- package/es/page/responsive.js +2 -3
- package/es/page-header/index.js +3 -4
- package/es/popconfirm/index.js +24 -70
- package/es/poptip/index.js +29 -88
- package/es/popup/index.js +8 -6
- package/es/popup/layers.js +2 -3
- package/es/progress/index.js +95 -229
- package/es/qrcode/index.js +3 -4
- package/es/radio/radio-button.js +37 -131
- package/es/radio/radio-group-context.js +2 -3
- package/es/radio/radio-group.js +69 -223
- package/es/radio/radio.js +3 -4
- package/es/rate/index.js +68 -226
- package/es/rate/star.js +38 -129
- package/es/result/index.js +35 -127
- package/es/ripple/index.js +3 -4
- package/es/ripple/types.js +2 -3
- package/es/row-col/col.js +59 -149
- package/es/row-col/row.js +2 -3
- package/es/segmented/index.js +66 -210
- package/es/select/option.js +23 -116
- package/es/select/select.js +9 -10
- package/es/skeleton/skeleton-avatar.js +2 -3
- package/es/skeleton/skeleton-button.js +2 -3
- package/es/skeleton/skeleton-image.js +28 -108
- package/es/skeleton/skeleton-text.js +17 -93
- package/es/skeleton/skeleton.js +46 -133
- package/es/skeleton/use-skeleton-loading.js +3 -4
- package/es/slider/index.js +92 -286
- package/es/slider/thumb.js +43 -133
- package/es/space/index.js +3 -4
- package/es/spin/index.js +2 -3
- package/es/splitter/splitter-panel.js +3 -4
- package/es/splitter/splitter.js +77 -219
- package/es/stat-card/countup.js +46 -141
- package/es/stat-card/rollup.js +27 -105
- package/es/stat-card/stat-card.js +3 -4
- package/es/stat-card/stat-number.js +26 -113
- package/es/stat-card/utils/countup.js +2 -3
- package/es/stat-card/utils/odometer.js +2 -3
- package/es/stat-card/utils/stat-item-key.js +2 -3
- package/es/steps/index.js +45 -123
- package/es/switch/index.js +4 -5
- package/es/table/column-setting.js +43 -139
- package/es/table/index.js +8 -9
- package/es/table/utils.js +2 -3
- package/es/tabs/tab-panel.js +19 -71
- package/es/tabs/tabs.js +6 -7
- package/es/tag/index.js +4 -5
- package/es/time-line/timeline-item.js +3 -4
- package/es/time-line/timeline.js +8 -44
- package/es/tooltip/index.js +41 -142
- package/es/tour/index.js +138 -356
- package/es/transfer/index.js +184 -487
- package/es/tree/index.js +8 -9
- package/es/tree/utils.js +2 -3
- package/es/tree-select/index.js +8 -9
- package/es/typography/index.js +75 -306
- package/es/upload/file-list.js +95 -119
- package/es/upload/index.js +8 -9
- package/es/upload/picture-sort.js +2 -3
- package/es/upload/selector.js +63 -193
- package/es/utils/checked.js +2 -3
- package/es/utils/color.js +2 -3
- package/es/utils/css.js +2 -3
- package/es/utils/focus.js +2 -3
- package/es/utils/number.js +2 -3
- package/es/utils/overlay-order.js +2 -3
- package/es/utils/overlay-stack.js +3 -4
- package/es/utils/placement.js +16 -4
- package/es/utils/popup-arrow.js +45 -0
- package/es/utils/popup.js +2 -3
- package/es/utils/promise.js +2 -3
- package/es/utils/react-node.js +2 -3
- package/es/utils/selection-tags.js +2 -3
- package/es/utils/share.js +2 -3
- package/es/utils/theme.js +2 -3
- package/es/utils/transition.js +2 -3
- package/es/utils/use-value.js +3 -4
- package/es/virtual-list/index.js +49 -187
- package/es/virtual-list/range.js +2 -3
- package/es/watermark/index.js +149 -289
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +24 -24
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +1 -1
- package/types/affix/index.d.cts +1 -1
- package/types/affix/index.d.ts +1 -1
- package/types/anchor/anchor-link.d.cts +1 -1
- package/types/anchor/anchor-link.d.ts +1 -1
- package/types/anchor/anchor.d.cts +1 -1
- package/types/anchor/anchor.d.ts +1 -1
- package/types/back-top/index.d.cts +1 -1
- package/types/back-top/index.d.ts +1 -1
- package/types/carousel/carousel-item.d.cts +1 -1
- package/types/carousel/carousel-item.d.ts +1 -1
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/color-picker/alpha.d.cts +1 -1
- package/types/color-picker/alpha.d.ts +1 -1
- package/types/color-picker/hue.d.cts +1 -1
- package/types/color-picker/hue.d.ts +1 -1
- package/types/color-picker/index.d.cts +3 -2
- package/types/color-picker/index.d.ts +3 -2
- package/types/color-picker/mode.d.cts +1 -1
- package/types/color-picker/mode.d.ts +1 -1
- package/types/color-picker/paint.d.cts +1 -1
- package/types/color-picker/paint.d.ts +1 -1
- package/types/color-picker/presets.d.cts +1 -1
- package/types/color-picker/presets.d.ts +1 -1
- package/types/components.d.cts +3 -0
- package/types/components.d.ts +3 -0
- package/types/date-picker/index.d.cts +2 -2
- package/types/date-picker/index.d.ts +2 -2
- package/types/feature-card/index.d.cts +1 -1
- package/types/feature-card/index.d.ts +1 -1
- package/types/feedback-panel/index.d.cts +1 -1
- package/types/feedback-panel/index.d.ts +1 -1
- package/types/flame-wrap/index.d.cts +1 -1
- package/types/flame-wrap/index.d.ts +1 -1
- package/types/form/form-item.d.cts +1 -1
- package/types/form/form-item.d.ts +1 -1
- package/types/gradient-picker/corners.d.cts +8 -0
- package/types/gradient-picker/corners.d.ts +8 -0
- package/types/gradient-picker/index.d.cts +25 -0
- package/types/gradient-picker/index.d.ts +25 -0
- package/types/gradient-picker/stops.d.cts +12 -0
- package/types/gradient-picker/stops.d.ts +12 -0
- package/types/gradient-picker/types.d.cts +34 -0
- package/types/gradient-picker/types.d.ts +34 -0
- package/types/grid/grid-item.d.cts +1 -1
- package/types/grid/grid-item.d.ts +1 -1
- package/types/grid/grid.d.cts +1 -1
- package/types/grid/grid.d.ts +1 -1
- package/types/image/group.d.cts +1 -1
- package/types/image/group.d.ts +1 -1
- package/types/input-number/drag.d.cts +9 -0
- package/types/input-number/drag.d.ts +9 -0
- package/types/input-number/index.d.cts +1 -0
- package/types/input-number/index.d.ts +1 -0
- package/types/kanban/index.d.cts +1 -1
- package/types/kanban/index.d.ts +1 -1
- package/types/list-panel/index.d.cts +1 -1
- package/types/list-panel/index.d.ts +1 -1
- package/types/loading/loading-bar.d.cts +1 -1
- package/types/loading/loading-bar.d.ts +1 -1
- package/types/modal/toast.d.cts +1 -1
- package/types/modal/toast.d.ts +1 -1
- package/types/notice/content.d.cts +2 -2
- package/types/notice/content.d.ts +2 -2
- package/types/page-header/index.d.cts +1 -1
- package/types/page-header/index.d.ts +1 -1
- package/types/popconfirm/index.d.cts +1 -0
- package/types/popconfirm/index.d.ts +1 -0
- package/types/poptip/index.d.cts +1 -0
- package/types/poptip/index.d.ts +1 -0
- package/types/popup/index.d.cts +1 -0
- package/types/popup/index.d.ts +1 -0
- package/types/result/index.d.cts +1 -1
- package/types/result/index.d.ts +1 -1
- package/types/ripple/index.d.cts +1 -1
- package/types/ripple/index.d.ts +1 -1
- package/types/slider/index.d.cts +1 -1
- package/types/slider/index.d.ts +1 -1
- package/types/splitter/splitter-panel.d.cts +1 -1
- package/types/splitter/splitter-panel.d.ts +1 -1
- package/types/splitter/splitter.d.cts +1 -1
- package/types/splitter/splitter.d.ts +1 -1
- package/types/stat-card/countup.d.cts +1 -1
- package/types/stat-card/countup.d.ts +1 -1
- package/types/stat-card/rollup.d.cts +1 -1
- package/types/stat-card/rollup.d.ts +1 -1
- package/types/stat-card/stat-card.d.cts +1 -1
- package/types/stat-card/stat-card.d.ts +1 -1
- package/types/stat-card/stat-number.d.cts +1 -1
- package/types/stat-card/stat-number.d.ts +1 -1
- package/types/table/column-setting.d.cts +1 -1
- package/types/table/column-setting.d.ts +1 -1
- package/types/table/index.d.cts +1 -1
- package/types/table/index.d.ts +1 -1
- package/types/time-line/timeline-item.d.cts +1 -1
- package/types/time-line/timeline-item.d.ts +1 -1
- package/types/time-line/timeline.d.cts +1 -1
- package/types/time-line/timeline.d.ts +1 -1
- package/types/tooltip/index.d.cts +1 -0
- package/types/tooltip/index.d.ts +1 -0
- package/types/transfer/index.d.cts +1 -1
- package/types/transfer/index.d.ts +1 -1
- package/types/tree-select/index.d.cts +1 -1
- package/types/tree-select/index.d.ts +1 -1
- package/types/upload/file-list.d.cts +1 -1
- package/types/upload/file-list.d.ts +1 -1
- package/types/upload/selector.d.cts +1 -1
- package/types/upload/selector.d.ts +1 -1
- package/types/utils/placement.d.cts +2 -1
- package/types/utils/placement.d.ts +2 -1
- package/types/utils/popup-arrow.d.cts +5 -0
- package/types/utils/popup-arrow.d.ts +5 -0
- package/types/utils/selection-tags.d.cts +1 -1
- package/types/utils/selection-tags.d.ts +1 -1
- package/types/watermark/index.d.cts +1 -1
- package/types/watermark/index.d.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
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
|
-
|
|
9
|
+
// \0rolldown/runtime.js
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __exportAll = (all, no_symbols) => {
|
|
12
12
|
let target = {};
|
|
@@ -17,5 +17,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
17
17
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
18
|
return target;
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { __exportAll };
|
package/es/affix/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
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 { c } from "react/compiler-runtime";
|
|
10
9
|
import clsx from "clsx";
|
|
11
|
-
import { useEffect, useRef, useState } from "react";
|
|
10
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
12
11
|
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
|
|
12
|
+
// components/affix/index.tsx
|
|
14
13
|
var defaultTarget = () => typeof window === "undefined" ? null : window;
|
|
15
14
|
function isSameStyle(current, next) {
|
|
16
15
|
const currentStyle = current;
|
|
@@ -19,39 +18,7 @@ function isSameStyle(current, next) {
|
|
|
19
18
|
const nextKeys = Object.keys(nextStyle);
|
|
20
19
|
return currentKeys.length === nextKeys.length && currentKeys.every((key) => currentStyle[key] === nextStyle[key]);
|
|
21
20
|
}
|
|
22
|
-
function Affix(
|
|
23
|
-
const $ = c(37);
|
|
24
|
-
let children;
|
|
25
|
-
let className;
|
|
26
|
-
let offsetBottom;
|
|
27
|
-
let onChange;
|
|
28
|
-
let rest;
|
|
29
|
-
let style;
|
|
30
|
-
let t1;
|
|
31
|
-
let t2;
|
|
32
|
-
if ($[0] !== t0) {
|
|
33
|
-
({children, offsetTop: t1, offsetBottom, target: t2, onChange, className, style, ...rest} = t0);
|
|
34
|
-
$[0] = t0;
|
|
35
|
-
$[1] = children;
|
|
36
|
-
$[2] = className;
|
|
37
|
-
$[3] = offsetBottom;
|
|
38
|
-
$[4] = onChange;
|
|
39
|
-
$[5] = rest;
|
|
40
|
-
$[6] = style;
|
|
41
|
-
$[7] = t1;
|
|
42
|
-
$[8] = t2;
|
|
43
|
-
} else {
|
|
44
|
-
children = $[1];
|
|
45
|
-
className = $[2];
|
|
46
|
-
offsetBottom = $[3];
|
|
47
|
-
onChange = $[4];
|
|
48
|
-
rest = $[5];
|
|
49
|
-
style = $[6];
|
|
50
|
-
t1 = $[7];
|
|
51
|
-
t2 = $[8];
|
|
52
|
-
}
|
|
53
|
-
const offsetTop = t1 === void 0 ? 0 : t1;
|
|
54
|
-
const target = t2 === void 0 ? defaultTarget : t2;
|
|
21
|
+
function Affix({ children, offsetTop = 0, offsetBottom, target = defaultTarget, onChange, className, style, ...rest }) {
|
|
55
22
|
const wrapperRef = useRef(null);
|
|
56
23
|
const innerRef = useRef(null);
|
|
57
24
|
const targetRef = useRef(null);
|
|
@@ -59,164 +26,85 @@ function Affix(t0) {
|
|
|
59
26
|
const fixedRef = useRef(false);
|
|
60
27
|
const onChangeRef = useRef(onChange);
|
|
61
28
|
const [fixed, setFixed] = useState(false);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
$[12] = t5;
|
|
83
|
-
$[13] = t6;
|
|
84
|
-
} else {
|
|
85
|
-
t5 = $[12];
|
|
86
|
-
t6 = $[13];
|
|
87
|
-
}
|
|
88
|
-
useEffect(t5, t6);
|
|
89
|
-
let t7;
|
|
90
|
-
if ($[14] !== offsetBottom || $[15] !== offsetTop) {
|
|
91
|
-
t7 = () => {
|
|
92
|
-
frameRef.current = null;
|
|
93
|
-
const wrapper = wrapperRef.current;
|
|
94
|
-
const inner = innerRef.current;
|
|
95
|
-
const scrollTarget = targetRef.current;
|
|
96
|
-
if (!wrapper || !inner || !scrollTarget || typeof window === "undefined") return;
|
|
97
|
-
const rect = wrapper.getBoundingClientRect();
|
|
98
|
-
const targetRect = scrollTarget === window ? {
|
|
99
|
-
top: 0,
|
|
100
|
-
bottom: window.innerHeight
|
|
101
|
-
} : scrollTarget.getBoundingClientRect();
|
|
102
|
-
const nextFixed = offsetBottom !== void 0 ? targetRect.bottom - rect.bottom - offsetBottom <= 0 : rect.top - targetRect.top - offsetTop <= 0;
|
|
103
|
-
let nextStyle = {};
|
|
104
|
-
if (offsetBottom !== void 0) {
|
|
105
|
-
if (nextFixed) nextStyle = {
|
|
106
|
-
position: "fixed",
|
|
107
|
-
bottom: window.innerHeight - targetRect.bottom + offsetBottom,
|
|
108
|
-
left: rect.left,
|
|
109
|
-
width: rect.width
|
|
110
|
-
};
|
|
111
|
-
} else if (nextFixed) nextStyle = {
|
|
29
|
+
const [affixStyle, setAffixStyle] = useState({});
|
|
30
|
+
const [placeholderStyle, setPlaceholderStyle] = useState({});
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
onChangeRef.current = onChange;
|
|
33
|
+
}, [onChange]);
|
|
34
|
+
const updatePosition = useCallback(() => {
|
|
35
|
+
frameRef.current = null;
|
|
36
|
+
const wrapper = wrapperRef.current;
|
|
37
|
+
const inner = innerRef.current;
|
|
38
|
+
const scrollTarget = targetRef.current;
|
|
39
|
+
if (!wrapper || !inner || !scrollTarget || typeof window === "undefined") return;
|
|
40
|
+
const rect = wrapper.getBoundingClientRect();
|
|
41
|
+
const targetRect = scrollTarget === window ? {
|
|
42
|
+
top: 0,
|
|
43
|
+
bottom: window.innerHeight
|
|
44
|
+
} : scrollTarget.getBoundingClientRect();
|
|
45
|
+
const nextFixed = offsetBottom !== void 0 ? targetRect.bottom - rect.bottom - offsetBottom <= 0 : rect.top - targetRect.top - offsetTop <= 0;
|
|
46
|
+
let nextStyle = {};
|
|
47
|
+
if (offsetBottom !== void 0) {
|
|
48
|
+
if (nextFixed) nextStyle = {
|
|
112
49
|
position: "fixed",
|
|
113
|
-
|
|
50
|
+
bottom: window.innerHeight - targetRect.bottom + offsetBottom,
|
|
114
51
|
left: rect.left,
|
|
115
52
|
width: rect.width
|
|
116
53
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
setFixed(nextFixed);
|
|
123
|
-
onChangeRef.current?.(nextFixed);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
$[14] = offsetBottom;
|
|
127
|
-
$[15] = offsetTop;
|
|
128
|
-
$[16] = t7;
|
|
129
|
-
} else t7 = $[16];
|
|
130
|
-
const updatePosition = t7;
|
|
131
|
-
let t8;
|
|
132
|
-
if ($[17] !== updatePosition) {
|
|
133
|
-
t8 = () => {
|
|
134
|
-
if (frameRef.current !== null || typeof window === "undefined") return;
|
|
135
|
-
frameRef.current = window.requestAnimationFrame(updatePosition);
|
|
54
|
+
} else if (nextFixed) nextStyle = {
|
|
55
|
+
position: "fixed",
|
|
56
|
+
top: targetRect.top + offsetTop,
|
|
57
|
+
left: rect.left,
|
|
58
|
+
width: rect.width
|
|
136
59
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
60
|
+
const nextPlaceholderStyle = nextFixed ? { height: inner.getBoundingClientRect().height } : {};
|
|
61
|
+
setAffixStyle((current) => isSameStyle(current, nextStyle) ? current : nextStyle);
|
|
62
|
+
setPlaceholderStyle((current_0) => isSameStyle(current_0, nextPlaceholderStyle) ? current_0 : nextPlaceholderStyle);
|
|
63
|
+
if (fixedRef.current !== nextFixed) {
|
|
64
|
+
fixedRef.current = nextFixed;
|
|
65
|
+
setFixed(nextFixed);
|
|
66
|
+
onChangeRef.current?.(nextFixed);
|
|
67
|
+
}
|
|
68
|
+
}, [offsetBottom, offsetTop]);
|
|
69
|
+
const scheduleUpdate = useCallback(() => {
|
|
70
|
+
if (frameRef.current !== null || typeof window === "undefined") return;
|
|
71
|
+
frameRef.current = window.requestAnimationFrame(updatePosition);
|
|
72
|
+
}, [updatePosition]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (typeof window === "undefined" || !wrapperRef.current || !innerRef.current) return;
|
|
75
|
+
targetRef.current = target();
|
|
76
|
+
const scrollTarget_0 = targetRef.current;
|
|
77
|
+
if (!scrollTarget_0) return;
|
|
78
|
+
window.addEventListener("scroll", scheduleUpdate, true);
|
|
79
|
+
window.addEventListener("resize", scheduleUpdate);
|
|
80
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(scheduleUpdate);
|
|
81
|
+
observer?.observe(wrapperRef.current);
|
|
82
|
+
observer?.observe(innerRef.current);
|
|
83
|
+
if (scrollTarget_0 !== window) observer?.observe(scrollTarget_0);
|
|
84
|
+
scheduleUpdate();
|
|
85
|
+
return () => {
|
|
86
|
+
window.removeEventListener("scroll", scheduleUpdate, true);
|
|
87
|
+
window.removeEventListener("resize", scheduleUpdate);
|
|
88
|
+
observer?.disconnect();
|
|
89
|
+
if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
|
|
90
|
+
frameRef.current = null;
|
|
91
|
+
targetRef.current = null;
|
|
164
92
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
t10 = $[21];
|
|
172
|
-
t9 = $[22];
|
|
173
|
-
}
|
|
174
|
-
useEffect(t9, t10);
|
|
175
|
-
let t11;
|
|
176
|
-
if ($[23] !== placeholderStyle || $[24] !== style) {
|
|
177
|
-
t11 = {
|
|
93
|
+
}, [scheduleUpdate, target]);
|
|
94
|
+
return /* @__PURE__ */ jsx("div", {
|
|
95
|
+
...rest,
|
|
96
|
+
ref: wrapperRef,
|
|
97
|
+
className,
|
|
98
|
+
style: {
|
|
178
99
|
...style,
|
|
179
100
|
...placeholderStyle
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
$[24] = style;
|
|
183
|
-
$[25] = t11;
|
|
184
|
-
} else t11 = $[25];
|
|
185
|
-
let t12;
|
|
186
|
-
if ($[26] !== fixed) {
|
|
187
|
-
t12 = clsx("k-affix", { "k-affix-fixed": fixed });
|
|
188
|
-
$[26] = fixed;
|
|
189
|
-
$[27] = t12;
|
|
190
|
-
} else t12 = $[27];
|
|
191
|
-
let t13;
|
|
192
|
-
if ($[28] !== affixStyle || $[29] !== children || $[30] !== t12) {
|
|
193
|
-
t13 = /* @__PURE__ */ jsx("div", {
|
|
101
|
+
},
|
|
102
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
194
103
|
ref: innerRef,
|
|
195
|
-
className:
|
|
104
|
+
className: clsx("k-affix", { "k-affix-fixed": fixed }),
|
|
196
105
|
style: affixStyle,
|
|
197
106
|
children
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
$[29] = children;
|
|
201
|
-
$[30] = t12;
|
|
202
|
-
$[31] = t13;
|
|
203
|
-
} else t13 = $[31];
|
|
204
|
-
let t14;
|
|
205
|
-
if ($[32] !== className || $[33] !== rest || $[34] !== t11 || $[35] !== t13) {
|
|
206
|
-
t14 = /* @__PURE__ */ jsx("div", {
|
|
207
|
-
...rest,
|
|
208
|
-
ref: wrapperRef,
|
|
209
|
-
className,
|
|
210
|
-
style: t11,
|
|
211
|
-
children: t13
|
|
212
|
-
});
|
|
213
|
-
$[32] = className;
|
|
214
|
-
$[33] = rest;
|
|
215
|
-
$[34] = t11;
|
|
216
|
-
$[35] = t13;
|
|
217
|
-
$[36] = t14;
|
|
218
|
-
} else t14 = $[36];
|
|
219
|
-
return t14;
|
|
107
|
+
})
|
|
108
|
+
});
|
|
220
109
|
}
|
|
221
|
-
//#endregion
|
|
222
110
|
export { Affix as default };
|
package/es/alert/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
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 { Transition } from "../base/transition.js";
|
|
10
9
|
import { resolvePaintedTheme, useConfigAppearance } from "../config/use-config-appearance.js";
|
|
11
10
|
import { CircleAlert, CircleCheck, CircleX, Info, X } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
11
|
+
import { Transition } from "../base/transition.js";
|
|
12
12
|
import { getTransitionProp } from "../utils/transition.js";
|
|
13
13
|
import Icon from "../icon/index.js";
|
|
14
14
|
import clsx from "clsx";
|
|
15
15
|
import { useRef, useState } from "react";
|
|
16
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
|
|
17
|
+
// components/alert/index.tsx
|
|
18
18
|
var PAINTED_THEMES = [
|
|
19
19
|
"fill",
|
|
20
20
|
"outline",
|
|
@@ -88,5 +88,4 @@ var Alert = ({ type = "warning", closable = false, showIcon = true, icon, messag
|
|
|
88
88
|
})
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
-
//#endregion
|
|
92
91
|
export { Alert as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext } from "react";
|
|
10
|
-
|
|
10
|
+
// components/anchor/anchor-context.ts
|
|
11
11
|
var AnchorContext = createContext(null);
|
|
12
|
-
//#endregion
|
|
13
12
|
export { AnchorContext };
|
package/es/anchor/anchor-link.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { AnchorContext } from "./anchor-context.js";
|
|
10
|
-
import { c } from "react/compiler-runtime";
|
|
11
10
|
import clsx from "clsx";
|
|
12
11
|
import { useContext, useEffect } from "react";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
|
|
13
|
+
import { c } from "react/compiler-runtime";
|
|
14
|
+
// components/anchor/anchor-link.tsx
|
|
15
15
|
function AnchorLink(t0) {
|
|
16
16
|
const $ = c(30);
|
|
17
17
|
let children;
|
|
@@ -117,5 +117,4 @@ function AnchorLink(t0) {
|
|
|
117
117
|
} else t8 = $[29];
|
|
118
118
|
return t8;
|
|
119
119
|
}
|
|
120
|
-
//#endregion
|
|
121
120
|
export { AnchorLink as default };
|