react-kui 3.2.0 → 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 +825 -168
- 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 +72 -196
- 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 +25 -15
- package/es/table/utils.js +3 -5
- 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/segmented/index.d.cts +2 -1
- package/types/segmented/index.d.ts +2 -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
package/es/ripple/index.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
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
"use client";
|
|
10
10
|
import { createRipple, htmlInCanvasMarkup, supportsHtmlInCanvas } from "./types.js";
|
|
11
|
-
import { c } from "react/compiler-runtime";
|
|
12
11
|
import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
|
|
13
|
+
import { c } from "react/compiler-runtime";
|
|
14
|
+
// components/ripple/index.tsx
|
|
15
15
|
/**
|
|
16
16
|
* Adapted from Canvas UI by David Haz (DavidHDev).
|
|
17
17
|
* Source: https://github.com/DavidHDev/canvas-ui
|
|
@@ -248,5 +248,4 @@ function Ripple(t0) {
|
|
|
248
248
|
function _temp() {
|
|
249
249
|
return false;
|
|
250
250
|
}
|
|
251
|
-
//#endregion
|
|
252
251
|
export { Ripple, Ripple as default };
|
package/es/ripple/types.js
CHANGED
|
@@ -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
|
+
// components/ripple/types.ts
|
|
10
10
|
var DEFAULTS = {
|
|
11
11
|
amplitude: .5,
|
|
12
12
|
speed: .65,
|
|
@@ -482,5 +482,4 @@ function createRipple(elements, options = {}) {
|
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
|
-
//#endregion
|
|
486
485
|
export { createRipple, htmlInCanvasMarkup, supportsHtmlInCanvas };
|
package/es/row-col/col.js
CHANGED
|
@@ -1,163 +1,73 @@
|
|
|
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
10
|
import "react";
|
|
12
11
|
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
|
|
14
|
-
var Col = (
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let t1;
|
|
29
|
-
let xl;
|
|
30
|
-
let xs;
|
|
31
|
-
let xxl;
|
|
32
|
-
if ($[0] !== t0) {
|
|
33
|
-
({span, offset, order, push, pull, flex, xs, sm, md, lg, xl, xxl, children, className: t1, style, ...rest} = t0);
|
|
34
|
-
$[0] = t0;
|
|
35
|
-
$[1] = children;
|
|
36
|
-
$[2] = flex;
|
|
37
|
-
$[3] = lg;
|
|
38
|
-
$[4] = md;
|
|
39
|
-
$[5] = offset;
|
|
40
|
-
$[6] = order;
|
|
41
|
-
$[7] = pull;
|
|
42
|
-
$[8] = push;
|
|
43
|
-
$[9] = rest;
|
|
44
|
-
$[10] = sm;
|
|
45
|
-
$[11] = span;
|
|
46
|
-
$[12] = style;
|
|
47
|
-
$[13] = t1;
|
|
48
|
-
$[14] = xl;
|
|
49
|
-
$[15] = xs;
|
|
50
|
-
$[16] = xxl;
|
|
51
|
-
} else {
|
|
52
|
-
children = $[1];
|
|
53
|
-
flex = $[2];
|
|
54
|
-
lg = $[3];
|
|
55
|
-
md = $[4];
|
|
56
|
-
offset = $[5];
|
|
57
|
-
order = $[6];
|
|
58
|
-
pull = $[7];
|
|
59
|
-
push = $[8];
|
|
60
|
-
rest = $[9];
|
|
61
|
-
sm = $[10];
|
|
62
|
-
span = $[11];
|
|
63
|
-
style = $[12];
|
|
64
|
-
t1 = $[13];
|
|
65
|
-
xl = $[14];
|
|
66
|
-
xs = $[15];
|
|
67
|
-
xxl = $[16];
|
|
68
|
-
}
|
|
69
|
-
const className = t1 === void 0 ? "" : t1;
|
|
70
|
-
const parseFlex = _temp;
|
|
71
|
-
let t2;
|
|
72
|
-
if ($[17] !== className || $[18] !== lg || $[19] !== md || $[20] !== offset || $[21] !== order || $[22] !== pull || $[23] !== push || $[24] !== sm || $[25] !== span || $[26] !== xl || $[27] !== xs || $[28] !== xxl) {
|
|
73
|
-
const gridClasses = [];
|
|
74
|
-
const addGridClasses = (value, breakpoint) => {
|
|
75
|
-
if (value === void 0) return;
|
|
76
|
-
const prefix = breakpoint ? `k-col-${breakpoint}` : "k-col";
|
|
77
|
-
if (typeof value === "number") {
|
|
78
|
-
if (value >= 0 && value <= 24) gridClasses.push(`${prefix}-${value}`);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
[
|
|
82
|
-
"span",
|
|
83
|
-
"offset",
|
|
84
|
-
"order",
|
|
85
|
-
"push",
|
|
86
|
-
"pull"
|
|
87
|
-
].forEach((key) => {
|
|
88
|
-
const current = value[key];
|
|
89
|
-
if (current !== void 0 && current >= 0 && current <= 24) gridClasses.push(key === "span" ? `${prefix}-${current}` : `${prefix}-${key}-${current}`);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
addGridClasses(span);
|
|
93
|
-
addGridClasses({
|
|
94
|
-
offset,
|
|
95
|
-
order,
|
|
96
|
-
push,
|
|
97
|
-
pull
|
|
98
|
-
});
|
|
12
|
+
// components/row-col/col.tsx
|
|
13
|
+
var Col = ({ span, offset, order, push, pull, flex, xs, sm, md, lg, xl, xxl, children, className = "", style, ...rest }) => {
|
|
14
|
+
const parseFlex = (flexVal) => {
|
|
15
|
+
if (typeof flexVal === "number") return `${flexVal} ${flexVal} auto`;
|
|
16
|
+
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flexVal)) return `0 0 ${flexVal}`;
|
|
17
|
+
return flexVal;
|
|
18
|
+
};
|
|
19
|
+
const gridClasses = [];
|
|
20
|
+
const addGridClasses = (value, breakpoint) => {
|
|
21
|
+
if (value === void 0) return;
|
|
22
|
+
const prefix = breakpoint ? `k-col-${breakpoint}` : "k-col";
|
|
23
|
+
if (typeof value === "number") {
|
|
24
|
+
if (value >= 0 && value <= 24) gridClasses.push(`${prefix}-${value}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
99
27
|
[
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
xs,
|
|
109
|
-
sm,
|
|
110
|
-
md,
|
|
111
|
-
lg,
|
|
112
|
-
xl,
|
|
113
|
-
xxl
|
|
114
|
-
}[breakpoint_0], breakpoint_0);
|
|
28
|
+
"span",
|
|
29
|
+
"offset",
|
|
30
|
+
"order",
|
|
31
|
+
"push",
|
|
32
|
+
"pull"
|
|
33
|
+
].forEach((key) => {
|
|
34
|
+
const current = value[key];
|
|
35
|
+
if (current !== void 0 && current >= 0 && current <= 24) gridClasses.push(key === "span" ? `${prefix}-${current}` : `${prefix}-${key}-${current}`);
|
|
115
36
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
$[35] = colStyle;
|
|
152
|
-
$[36] = rest;
|
|
153
|
-
$[37] = t3;
|
|
154
|
-
} else t3 = $[37];
|
|
155
|
-
return t3;
|
|
37
|
+
};
|
|
38
|
+
addGridClasses(span);
|
|
39
|
+
addGridClasses({
|
|
40
|
+
offset,
|
|
41
|
+
order,
|
|
42
|
+
push,
|
|
43
|
+
pull
|
|
44
|
+
});
|
|
45
|
+
[
|
|
46
|
+
"xs",
|
|
47
|
+
"sm",
|
|
48
|
+
"md",
|
|
49
|
+
"lg",
|
|
50
|
+
"xl",
|
|
51
|
+
"xxl"
|
|
52
|
+
].forEach((breakpoint_0) => {
|
|
53
|
+
addGridClasses({
|
|
54
|
+
xs,
|
|
55
|
+
sm,
|
|
56
|
+
md,
|
|
57
|
+
lg,
|
|
58
|
+
xl,
|
|
59
|
+
xxl
|
|
60
|
+
}[breakpoint_0], breakpoint_0);
|
|
61
|
+
});
|
|
62
|
+
const classes = clsx("k-col", gridClasses, className);
|
|
63
|
+
const colStyle = {};
|
|
64
|
+
if (flex !== void 0) colStyle.flex = parseFlex(flex);
|
|
65
|
+
Object.assign(colStyle, style);
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: classes,
|
|
68
|
+
style: colStyle,
|
|
69
|
+
...rest,
|
|
70
|
+
children
|
|
71
|
+
});
|
|
156
72
|
};
|
|
157
|
-
function _temp(flexVal) {
|
|
158
|
-
if (typeof flexVal === "number") return `${flexVal} ${flexVal} auto`;
|
|
159
|
-
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flexVal)) return `0 0 ${flexVal}`;
|
|
160
|
-
return flexVal;
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
73
|
export { Col as default };
|
package/es/row-col/row.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
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import clsx from "clsx";
|
|
10
10
|
import "react";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
|
-
|
|
12
|
+
// components/row-col/row.tsx
|
|
13
13
|
var Row = ({ gutter, justify = "start", align = "top", children, className = "", style, ...rest }) => {
|
|
14
14
|
const classes = clsx("k-row", {
|
|
15
15
|
[`k-row-${justify}`]: justify,
|
|
@@ -33,5 +33,4 @@ var Row = ({ gutter, justify = "start", align = "top", children, className = "",
|
|
|
33
33
|
children
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
-
//#endregion
|
|
37
36
|
export { Row as default };
|
package/es/segmented/index.js
CHANGED
|
@@ -1,141 +1,65 @@
|
|
|
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 { useFormAppearance } from "../config/use-config-appearance.js";
|
|
10
|
-
import Icon from "../icon/index.js";
|
|
11
9
|
import { useValue } from "../utils/use-value.js";
|
|
10
|
+
import { useFormAppearance } from "../config/use-config-appearance.js";
|
|
12
11
|
import { createFormFieldComponent } from "../form/field-context.js";
|
|
13
|
-
import
|
|
12
|
+
import Icon from "../icon/index.js";
|
|
14
13
|
import clsx from "clsx";
|
|
15
|
-
import { useEffect, useRef, useState } from "react";
|
|
14
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
16
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let rest;
|
|
25
|
-
let shapeProp;
|
|
26
|
-
let sizeProp;
|
|
27
|
-
let t1;
|
|
28
|
-
let t2;
|
|
29
|
-
let t3;
|
|
30
|
-
let t4;
|
|
31
|
-
let t5;
|
|
32
|
-
let value;
|
|
33
|
-
if ($[0] !== t0) {
|
|
34
|
-
({value, options: t1, disabled: t2, readOnly: t3, block: t4, direction: t5, size: sizeProp, shape: shapeProp, onChange, renderLabel, className, onKeyDown, ...rest} = t0);
|
|
35
|
-
$[0] = t0;
|
|
36
|
-
$[1] = className;
|
|
37
|
-
$[2] = onChange;
|
|
38
|
-
$[3] = onKeyDown;
|
|
39
|
-
$[4] = renderLabel;
|
|
40
|
-
$[5] = rest;
|
|
41
|
-
$[6] = shapeProp;
|
|
42
|
-
$[7] = sizeProp;
|
|
43
|
-
$[8] = t1;
|
|
44
|
-
$[9] = t2;
|
|
45
|
-
$[10] = t3;
|
|
46
|
-
$[11] = t4;
|
|
47
|
-
$[12] = t5;
|
|
48
|
-
$[13] = value;
|
|
49
|
-
} else {
|
|
50
|
-
className = $[1];
|
|
51
|
-
onChange = $[2];
|
|
52
|
-
onKeyDown = $[3];
|
|
53
|
-
renderLabel = $[4];
|
|
54
|
-
rest = $[5];
|
|
55
|
-
shapeProp = $[6];
|
|
56
|
-
sizeProp = $[7];
|
|
57
|
-
t1 = $[8];
|
|
58
|
-
t2 = $[9];
|
|
59
|
-
t3 = $[10];
|
|
60
|
-
t4 = $[11];
|
|
61
|
-
t5 = $[12];
|
|
62
|
-
value = $[13];
|
|
63
|
-
}
|
|
64
|
-
const options = t1 === void 0 ? [] : t1;
|
|
65
|
-
const disabled = t2 === void 0 ? false : t2;
|
|
66
|
-
const readOnly = t3 === void 0 ? false : t3;
|
|
67
|
-
const block = t4 === void 0 ? false : t4;
|
|
68
|
-
const direction = t5 === void 0 ? "horizontal" : t5;
|
|
16
|
+
// components/segmented/index.tsx
|
|
17
|
+
var isOptionObject = (option) => typeof option === "object" && option !== null;
|
|
18
|
+
var normalizeOptions = (options) => options.map((option) => isOptionObject(option) ? option : {
|
|
19
|
+
label: option,
|
|
20
|
+
value: option
|
|
21
|
+
});
|
|
22
|
+
var Segmented = ({ value, options = [], disabled = false, readOnly = false, block = false, direction = "horizontal", size: sizeProp, shape: shapeProp, onChange, renderLabel, className, onKeyDown, ...rest }) => {
|
|
69
23
|
const inheritedAppearance = useFormAppearance();
|
|
70
24
|
const size = sizeProp ?? inheritedAppearance.size ?? "medium";
|
|
71
25
|
const shape = shapeProp ?? inheritedAppearance.shape ?? "round";
|
|
72
26
|
const rootRef = useRef(null);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
t6 = /* @__PURE__ */ new Map();
|
|
76
|
-
$[14] = t6;
|
|
77
|
-
} else t6 = $[14];
|
|
78
|
-
const itemRefs = useRef(t6);
|
|
79
|
-
const [innerValue, setInnerValue] = useValue(value, _temp);
|
|
27
|
+
const itemRefs = useRef(/* @__PURE__ */ new Map());
|
|
28
|
+
const [innerValue, setInnerValue] = useValue(value, (next) => next);
|
|
80
29
|
const currentValue = innerValue;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} else t7 = $[15];
|
|
86
|
-
const [indicatorStyle, setIndicatorStyle] = useState(t7);
|
|
30
|
+
const items = normalizeOptions(options);
|
|
31
|
+
const selectedItem = items.find((item) => item.value === currentValue);
|
|
32
|
+
const focusValue = selectedItem && !selectedItem.disabled ? selectedItem.value : items.find((item_0) => !item_0.disabled)?.value;
|
|
33
|
+
const [indicatorStyle, setIndicatorStyle] = useState({});
|
|
87
34
|
const [ready, setReady] = useState(false);
|
|
88
35
|
const vertical = direction === "vertical";
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const observer = new ResizeObserver(updateIndicator);
|
|
117
|
-
if (rootRef.current) observer.observe(rootRef.current);
|
|
118
|
-
return () => observer.disconnect();
|
|
119
|
-
};
|
|
120
|
-
$[19] = updateIndicator;
|
|
121
|
-
$[20] = t9;
|
|
122
|
-
} else t9 = $[20];
|
|
123
|
-
useEffect(t9, [options, updateIndicator]);
|
|
124
|
-
let t10;
|
|
125
|
-
if ($[21] !== currentValue || $[22] !== disabled || $[23] !== onChange || $[24] !== readOnly || $[25] !== setInnerValue) {
|
|
126
|
-
t10 = (option) => {
|
|
127
|
-
if (disabled || readOnly || option.disabled || option.value === currentValue) return;
|
|
128
|
-
setInnerValue(option.value);
|
|
129
|
-
onChange?.(option.value);
|
|
130
|
-
};
|
|
131
|
-
$[21] = currentValue;
|
|
132
|
-
$[22] = disabled;
|
|
133
|
-
$[23] = onChange;
|
|
134
|
-
$[24] = readOnly;
|
|
135
|
-
$[25] = setInnerValue;
|
|
136
|
-
$[26] = t10;
|
|
137
|
-
} else t10 = $[26];
|
|
138
|
-
const select = t10;
|
|
36
|
+
const updateIndicator = useCallback(() => {
|
|
37
|
+
const item_1 = currentValue === void 0 ? void 0 : itemRefs.current.get(currentValue);
|
|
38
|
+
if (!item_1) {
|
|
39
|
+
setReady(false);
|
|
40
|
+
setIndicatorStyle({});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setIndicatorStyle(vertical ? {
|
|
44
|
+
height: item_1.offsetHeight,
|
|
45
|
+
top: item_1.offsetTop
|
|
46
|
+
} : {
|
|
47
|
+
width: item_1.offsetWidth,
|
|
48
|
+
left: item_1.offsetLeft
|
|
49
|
+
});
|
|
50
|
+
requestAnimationFrame(() => setReady(true));
|
|
51
|
+
}, [currentValue, vertical]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
updateIndicator();
|
|
54
|
+
const observer = new ResizeObserver(updateIndicator);
|
|
55
|
+
if (rootRef.current) observer.observe(rootRef.current);
|
|
56
|
+
return () => observer.disconnect();
|
|
57
|
+
}, [options, updateIndicator]);
|
|
58
|
+
const select = (option) => {
|
|
59
|
+
if (disabled || readOnly || option.disabled || option.value === currentValue) return;
|
|
60
|
+
setInnerValue(option.value);
|
|
61
|
+
onChange?.(option.value);
|
|
62
|
+
};
|
|
139
63
|
const move = (event) => {
|
|
140
64
|
onKeyDown?.(event);
|
|
141
65
|
if (event.defaultPrevented || ![
|
|
@@ -146,7 +70,7 @@ var Segmented = (t0) => {
|
|
|
146
70
|
"Home",
|
|
147
71
|
"End"
|
|
148
72
|
].includes(event.key)) return;
|
|
149
|
-
const available =
|
|
73
|
+
const available = items.filter((option_0) => !option_0.disabled);
|
|
150
74
|
if (!available.length || disabled || readOnly) return;
|
|
151
75
|
event.preventDefault();
|
|
152
76
|
const current = available.findIndex((option_1) => option_1.value === currentValue);
|
|
@@ -156,85 +80,37 @@ var Segmented = (t0) => {
|
|
|
156
80
|
requestAnimationFrame(() => itemRefs.current.get(next_0.value)?.focus());
|
|
157
81
|
}
|
|
158
82
|
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
t13 = clsx("k-segmented", t11, t12, {
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
...rest,
|
|
85
|
+
ref: rootRef,
|
|
86
|
+
className: clsx("k-segmented", `k-segmented-${size}`, `k-segmented-${shape}`, {
|
|
164
87
|
"k-segmented-block": block,
|
|
165
88
|
"k-segmented-vertical": vertical,
|
|
166
89
|
"k-segmented-disabled": disabled
|
|
167
|
-
}, className)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
disabled: disabled || option_2.disabled,
|
|
189
|
-
tabIndex: option_2.value === currentValue ? 0 : -1,
|
|
190
|
-
onClick: () => select(option_2),
|
|
191
|
-
children: [option_2.icon && /* @__PURE__ */ jsx(Icon, { type: option_2.icon }), /* @__PURE__ */ jsx("span", { children: renderLabel?.(option_2, option_2.value === currentValue) ?? option_2.label ?? option_2.value })]
|
|
192
|
-
}, option_2.value));
|
|
193
|
-
let t18;
|
|
194
|
-
if ($[34] !== ready) {
|
|
195
|
-
t18 = clsx("k-segmented-indicator", { "is-ready": ready });
|
|
196
|
-
$[34] = ready;
|
|
197
|
-
$[35] = t18;
|
|
198
|
-
} else t18 = $[35];
|
|
199
|
-
let t19;
|
|
200
|
-
if ($[36] !== indicatorStyle || $[37] !== t18) {
|
|
201
|
-
t19 = /* @__PURE__ */ jsx("span", {
|
|
202
|
-
className: t18,
|
|
90
|
+
}, className),
|
|
91
|
+
role: "radiogroup",
|
|
92
|
+
"aria-orientation": vertical ? "vertical" : "horizontal",
|
|
93
|
+
"aria-disabled": disabled || void 0,
|
|
94
|
+
"aria-readonly": readOnly || void 0,
|
|
95
|
+
onKeyDown: move,
|
|
96
|
+
children: [items.map((option_2) => /* @__PURE__ */ jsxs("button", {
|
|
97
|
+
ref: (node) => {
|
|
98
|
+
if (node) itemRefs.current.set(option_2.value, node);
|
|
99
|
+
else itemRefs.current.delete(option_2.value);
|
|
100
|
+
},
|
|
101
|
+
type: "button",
|
|
102
|
+
className: clsx("k-segmented-item", { "k-segmented-item-active": option_2.value === currentValue }),
|
|
103
|
+
role: "radio",
|
|
104
|
+
"aria-checked": option_2.value === currentValue,
|
|
105
|
+
disabled: disabled || option_2.disabled,
|
|
106
|
+
tabIndex: option_2.value === focusValue ? 0 : -1,
|
|
107
|
+
onClick: () => select(option_2),
|
|
108
|
+
children: [option_2.icon && /* @__PURE__ */ jsx(Icon, { type: option_2.icon }), /* @__PURE__ */ jsx("span", { children: renderLabel?.(option_2, option_2.value === currentValue) ?? option_2.label ?? option_2.value })]
|
|
109
|
+
}, option_2.value)), /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: clsx("k-segmented-indicator", { "is-ready": ready }),
|
|
203
111
|
style: indicatorStyle
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
$[37] = t18;
|
|
207
|
-
$[38] = t19;
|
|
208
|
-
} else t19 = $[38];
|
|
209
|
-
let t20;
|
|
210
|
-
if ($[39] !== move || $[40] !== rest || $[41] !== t13 || $[42] !== t15 || $[43] !== t16 || $[44] !== t17 || $[45] !== t19) {
|
|
211
|
-
t20 = /* @__PURE__ */ jsxs("div", {
|
|
212
|
-
...rest,
|
|
213
|
-
ref: rootRef,
|
|
214
|
-
className: t13,
|
|
215
|
-
role: t14,
|
|
216
|
-
"aria-disabled": t15,
|
|
217
|
-
"aria-readonly": t16,
|
|
218
|
-
onKeyDown: move,
|
|
219
|
-
children: [t17, t19]
|
|
220
|
-
});
|
|
221
|
-
$[39] = move;
|
|
222
|
-
$[40] = rest;
|
|
223
|
-
$[41] = t13;
|
|
224
|
-
$[42] = t15;
|
|
225
|
-
$[43] = t16;
|
|
226
|
-
$[44] = t17;
|
|
227
|
-
$[45] = t19;
|
|
228
|
-
$[46] = t20;
|
|
229
|
-
} else t20 = $[46];
|
|
230
|
-
return t20;
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
231
114
|
};
|
|
232
115
|
var segmented_default = createFormFieldComponent(Segmented);
|
|
233
|
-
function _temp(next) {
|
|
234
|
-
return next;
|
|
235
|
-
}
|
|
236
|
-
function _temp2(option_0) {
|
|
237
|
-
return !option_0.disabled;
|
|
238
|
-
}
|
|
239
|
-
//#endregion
|
|
240
116
|
export { segmented_default as default };
|