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
|
@@ -1,169 +1,39 @@
|
|
|
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 {
|
|
10
|
-
import Popup from "../popup/index.js";
|
|
9
|
+
import { useValue } from "../utils/use-value.js";
|
|
11
10
|
import { useFormAppearance } from "../config/use-config-appearance.js";
|
|
11
|
+
import { createFormFieldComponent } from "../form/field-context.js";
|
|
12
12
|
import { Loading } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
13
|
+
import Popup from "../popup/index.js";
|
|
14
|
+
import { ConfigContext, DEFAULT_LOCALE } from "../config/config-context.js";
|
|
13
15
|
import Icon from "../icon/index.js";
|
|
14
|
-
import { useValue } from "../utils/use-value.js";
|
|
15
|
-
import { createFormFieldComponent } from "../form/field-context.js";
|
|
16
16
|
import input_default from "../input/input.js";
|
|
17
|
-
import { c } from "react/compiler-runtime";
|
|
18
17
|
import clsx from "clsx";
|
|
19
|
-
import { useContext, useEffect, useEffectEvent, useId, useRef, useState } from "react";
|
|
18
|
+
import { useContext, useEffect, useEffectEvent, useId, useMemo, useRef, useState } from "react";
|
|
20
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
|
|
20
|
+
// components/auto-complete/index.tsx
|
|
22
21
|
var EMPTY_OPTIONS = [];
|
|
23
|
-
var AutoComplete = (
|
|
24
|
-
const $ = c(175);
|
|
25
|
-
let addonAfter;
|
|
26
|
-
let addonBefore;
|
|
27
|
-
let className;
|
|
28
|
-
let disabled;
|
|
29
|
-
let loadingText;
|
|
30
|
-
let onBlur;
|
|
31
|
-
let onChange;
|
|
32
|
-
let onClear;
|
|
33
|
-
let onCompositionEnd;
|
|
34
|
-
let onCompositionStart;
|
|
35
|
-
let onFocus;
|
|
36
|
-
let onKeyDown;
|
|
37
|
-
let onOpenChange;
|
|
38
|
-
let onSearch;
|
|
39
|
-
let onSelect;
|
|
40
|
-
let open;
|
|
41
|
-
let prefix;
|
|
42
|
-
let readOnly;
|
|
43
|
-
let rest;
|
|
44
|
-
let shapeProp;
|
|
45
|
-
let sizeProp;
|
|
46
|
-
let suffix;
|
|
47
|
-
let t1;
|
|
48
|
-
let t2;
|
|
49
|
-
let t3;
|
|
50
|
-
let t4;
|
|
51
|
-
let t5;
|
|
52
|
-
let t6;
|
|
53
|
-
let themeProp;
|
|
54
|
-
let value;
|
|
55
|
-
if ($[0] !== t0) {
|
|
56
|
-
({value, options: t1, open, showOnEmpty: t2, clearable: t3, loading: t4, loadingText, addonBefore, addonAfter, prefix, suffix, size: sizeProp, shape: shapeProp, theme: themeProp, filterOption: t5, destroyOnClose: t6, onChange, onClear, onSearch, onSelect, onOpenChange, className, disabled, readOnly, onFocus, onBlur, onKeyDown, onCompositionStart, onCompositionEnd, ...rest} = t0);
|
|
57
|
-
$[0] = t0;
|
|
58
|
-
$[1] = addonAfter;
|
|
59
|
-
$[2] = addonBefore;
|
|
60
|
-
$[3] = className;
|
|
61
|
-
$[4] = disabled;
|
|
62
|
-
$[5] = loadingText;
|
|
63
|
-
$[6] = onBlur;
|
|
64
|
-
$[7] = onChange;
|
|
65
|
-
$[8] = onClear;
|
|
66
|
-
$[9] = onCompositionEnd;
|
|
67
|
-
$[10] = onCompositionStart;
|
|
68
|
-
$[11] = onFocus;
|
|
69
|
-
$[12] = onKeyDown;
|
|
70
|
-
$[13] = onOpenChange;
|
|
71
|
-
$[14] = onSearch;
|
|
72
|
-
$[15] = onSelect;
|
|
73
|
-
$[16] = open;
|
|
74
|
-
$[17] = prefix;
|
|
75
|
-
$[18] = readOnly;
|
|
76
|
-
$[19] = rest;
|
|
77
|
-
$[20] = shapeProp;
|
|
78
|
-
$[21] = sizeProp;
|
|
79
|
-
$[22] = suffix;
|
|
80
|
-
$[23] = t1;
|
|
81
|
-
$[24] = t2;
|
|
82
|
-
$[25] = t3;
|
|
83
|
-
$[26] = t4;
|
|
84
|
-
$[27] = t5;
|
|
85
|
-
$[28] = t6;
|
|
86
|
-
$[29] = themeProp;
|
|
87
|
-
$[30] = value;
|
|
88
|
-
} else {
|
|
89
|
-
addonAfter = $[1];
|
|
90
|
-
addonBefore = $[2];
|
|
91
|
-
className = $[3];
|
|
92
|
-
disabled = $[4];
|
|
93
|
-
loadingText = $[5];
|
|
94
|
-
onBlur = $[6];
|
|
95
|
-
onChange = $[7];
|
|
96
|
-
onClear = $[8];
|
|
97
|
-
onCompositionEnd = $[9];
|
|
98
|
-
onCompositionStart = $[10];
|
|
99
|
-
onFocus = $[11];
|
|
100
|
-
onKeyDown = $[12];
|
|
101
|
-
onOpenChange = $[13];
|
|
102
|
-
onSearch = $[14];
|
|
103
|
-
onSelect = $[15];
|
|
104
|
-
open = $[16];
|
|
105
|
-
prefix = $[17];
|
|
106
|
-
readOnly = $[18];
|
|
107
|
-
rest = $[19];
|
|
108
|
-
shapeProp = $[20];
|
|
109
|
-
sizeProp = $[21];
|
|
110
|
-
suffix = $[22];
|
|
111
|
-
t1 = $[23];
|
|
112
|
-
t2 = $[24];
|
|
113
|
-
t3 = $[25];
|
|
114
|
-
t4 = $[26];
|
|
115
|
-
t5 = $[27];
|
|
116
|
-
t6 = $[28];
|
|
117
|
-
themeProp = $[29];
|
|
118
|
-
value = $[30];
|
|
119
|
-
}
|
|
120
|
-
const options = t1 === void 0 ? EMPTY_OPTIONS : t1;
|
|
121
|
-
const showOnEmpty = t2 === void 0 ? false : t2;
|
|
122
|
-
const clearable = t3 === void 0 ? false : t3;
|
|
123
|
-
const loading = t4 === void 0 ? false : t4;
|
|
124
|
-
const filterOption = t5 === void 0 ? true : t5;
|
|
125
|
-
const destroyOnClose = t6 === void 0 ? true : t6;
|
|
22
|
+
var AutoComplete = ({ value, options = EMPTY_OPTIONS, open, showOnEmpty = false, clearable = false, loading = false, loadingText, addonBefore, addonAfter, prefix, suffix, size: sizeProp, shape: shapeProp, theme: themeProp, filterOption = true, destroyOnClose = true, onChange, onClear, onSearch, onSelect, onOpenChange, className, disabled, readOnly, onFocus, onBlur, onKeyDown, onCompositionStart, onCompositionEnd, ...rest }) => {
|
|
126
23
|
const inheritedAppearance = useFormAppearance();
|
|
127
24
|
const size = sizeProp ?? inheritedAppearance.size;
|
|
128
25
|
const shape = shapeProp ?? inheritedAppearance.shape;
|
|
129
26
|
const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
|
|
130
27
|
const locale = useContext(ConfigContext)?.locale || DEFAULT_LOCALE;
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
t9 = /:/g;
|
|
137
|
-
$[33] = t9;
|
|
138
|
-
} else t9 = $[33];
|
|
139
|
-
t8 = t7.replace(t9, "");
|
|
140
|
-
$[31] = t7;
|
|
141
|
-
$[32] = t8;
|
|
142
|
-
} else t8 = $[32];
|
|
143
|
-
const listboxId = `k-auto-complete-listbox-${t8}`;
|
|
144
|
-
let t9;
|
|
145
|
-
if ($[34] !== options) {
|
|
146
|
-
t9 = options.map(_temp);
|
|
147
|
-
$[34] = options;
|
|
148
|
-
$[35] = t9;
|
|
149
|
-
} else t9 = $[35];
|
|
150
|
-
const normalized = t9;
|
|
28
|
+
const listboxId = `k-auto-complete-listbox-${useId().replace(/:/g, "")}`;
|
|
29
|
+
const normalized = useMemo(() => options.map((item) => typeof item === "string" ? {
|
|
30
|
+
value: item,
|
|
31
|
+
label: item
|
|
32
|
+
} : item), [options]);
|
|
151
33
|
const initialCurrent = value ?? "";
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
t10 = initiallyOpen && (initialCurrent || showOnEmpty) && !loading ? normalized.filter((option) => typeof filterOption === "function" ? filterOption(initialCurrent, option) : !filterOption || option.value.toLocaleLowerCase().includes(initialCurrent.toLocaleLowerCase())) : [];
|
|
156
|
-
$[36] = filterOption;
|
|
157
|
-
$[37] = initialCurrent;
|
|
158
|
-
$[38] = initiallyOpen;
|
|
159
|
-
$[39] = loading;
|
|
160
|
-
$[40] = normalized;
|
|
161
|
-
$[41] = showOnEmpty;
|
|
162
|
-
$[42] = t10;
|
|
163
|
-
} else t10 = $[42];
|
|
164
|
-
const initialShownOptions = t10;
|
|
165
|
-
const [innerValue, setInnerValue] = useValue(value, _temp2);
|
|
166
|
-
const [innerOpen, setInnerOpen] = useValue(open, _temp3);
|
|
34
|
+
const initialShownOptions = (open ?? false) && (initialCurrent || showOnEmpty) && !loading ? normalized.filter((option) => typeof filterOption === "function" ? filterOption(initialCurrent, option) : !filterOption || option.value.toLocaleLowerCase().includes(initialCurrent.toLocaleLowerCase())) : [];
|
|
35
|
+
const [innerValue, setInnerValue] = useValue(value, (next) => next ?? "");
|
|
36
|
+
const [innerOpen, setInnerOpen] = useValue(open, (next_0) => next_0 ?? false);
|
|
167
37
|
const [active, setActive] = useState(-1);
|
|
168
38
|
const [shownOptions, setShownOptions] = useState(initialShownOptions);
|
|
169
39
|
const [suppressRemoteOptions, setSuppressRemoteOptions] = useState(false);
|
|
@@ -175,43 +45,19 @@ var AutoComplete = (t0) => {
|
|
|
175
45
|
const current = innerValue;
|
|
176
46
|
const requestedOpen = innerOpen;
|
|
177
47
|
const visible = (loading || !suppressRemoteOptions && shownOptions.length > 0) && requestedOpen;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
setInnerOpen(next_1);
|
|
192
|
-
if (!next_1) setActive(-1);
|
|
193
|
-
onOpenChange?.(next_1);
|
|
194
|
-
};
|
|
195
|
-
$[46] = disabled;
|
|
196
|
-
$[47] = loading;
|
|
197
|
-
$[48] = onOpenChange;
|
|
198
|
-
$[49] = readOnly;
|
|
199
|
-
$[50] = setInnerOpen;
|
|
200
|
-
$[51] = suppressRemoteOptions;
|
|
201
|
-
$[52] = t12;
|
|
202
|
-
} else t12 = $[52];
|
|
203
|
-
const setOpen = t12;
|
|
204
|
-
let t13;
|
|
205
|
-
if ($[53] !== getMatches) {
|
|
206
|
-
t13 = (input_0) => {
|
|
207
|
-
const matches = getMatches(input_0);
|
|
208
|
-
if (matches.length) setShownOptions(matches);
|
|
209
|
-
return matches.length > 0;
|
|
210
|
-
};
|
|
211
|
-
$[53] = getMatches;
|
|
212
|
-
$[54] = t13;
|
|
213
|
-
} else t13 = $[54];
|
|
214
|
-
const commitMatches = t13;
|
|
48
|
+
const getMatches = (input) => normalized.filter((option_0) => typeof filterOption === "function" ? filterOption(input, option_0) : !filterOption || option_0.value.toLocaleLowerCase().includes(input.toLocaleLowerCase()));
|
|
49
|
+
const setOpen = (next_1) => {
|
|
50
|
+
if (next_1 && (disabled || readOnly)) return;
|
|
51
|
+
if (next_1 && suppressRemoteOptions && !loading) return;
|
|
52
|
+
setInnerOpen(next_1);
|
|
53
|
+
if (!next_1) setActive(-1);
|
|
54
|
+
onOpenChange?.(next_1);
|
|
55
|
+
};
|
|
56
|
+
const commitMatches = (input_0) => {
|
|
57
|
+
const matches = getMatches(input_0);
|
|
58
|
+
if (matches.length) setShownOptions(matches);
|
|
59
|
+
return matches.length > 0;
|
|
60
|
+
};
|
|
215
61
|
const syncOpen = (next_2) => {
|
|
216
62
|
setInnerOpen(next_2);
|
|
217
63
|
if (!next_2) setActive(-1);
|
|
@@ -220,17 +66,10 @@ var AutoComplete = (t0) => {
|
|
|
220
66
|
revision: (state?.revision ?? 0) + 1
|
|
221
67
|
}));
|
|
222
68
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
normalized
|
|
228
|
-
};
|
|
229
|
-
$[55] = loading;
|
|
230
|
-
$[56] = normalized;
|
|
231
|
-
$[57] = t14;
|
|
232
|
-
} else t14 = $[57];
|
|
233
|
-
const [previousRemoteState, setPreviousRemoteState] = useState(t14);
|
|
69
|
+
const [previousRemoteState, setPreviousRemoteState] = useState({
|
|
70
|
+
loading,
|
|
71
|
+
normalized
|
|
72
|
+
});
|
|
234
73
|
if (previousRemoteState.loading !== loading || previousRemoteState.normalized !== normalized) {
|
|
235
74
|
setPreviousRemoteState({
|
|
236
75
|
loading,
|
|
@@ -256,237 +95,73 @@ var AutoComplete = (t0) => {
|
|
|
256
95
|
setSuppressRemoteOptions(false);
|
|
257
96
|
} else setActive(-1);
|
|
258
97
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
} else {
|
|
290
|
-
t18 = $[65];
|
|
291
|
-
t19 = $[66];
|
|
292
|
-
}
|
|
293
|
-
useEffect(t18, t19);
|
|
294
|
-
let t20;
|
|
295
|
-
let t21;
|
|
296
|
-
if ($[67] !== active || $[68] !== listboxId) {
|
|
297
|
-
t20 = () => {
|
|
298
|
-
(dropdownRef.current?.querySelector(`#${listboxId}-option-${active}`))?.scrollIntoView?.({ block: "nearest" });
|
|
299
|
-
};
|
|
300
|
-
t21 = [active, listboxId];
|
|
301
|
-
$[67] = active;
|
|
302
|
-
$[68] = listboxId;
|
|
303
|
-
$[69] = t20;
|
|
304
|
-
$[70] = t21;
|
|
305
|
-
} else {
|
|
306
|
-
t20 = $[69];
|
|
307
|
-
t21 = $[70];
|
|
308
|
-
}
|
|
309
|
-
useEffect(t20, t21);
|
|
310
|
-
let t22;
|
|
311
|
-
if ($[71] !== disabled || $[72] !== onChange || $[73] !== readOnly || $[74] !== setInnerValue) {
|
|
312
|
-
t22 = (next_4) => {
|
|
313
|
-
if (disabled || readOnly) return;
|
|
314
|
-
setInnerValue(next_4);
|
|
315
|
-
onChange?.(next_4);
|
|
316
|
-
};
|
|
317
|
-
$[71] = disabled;
|
|
318
|
-
$[72] = onChange;
|
|
319
|
-
$[73] = readOnly;
|
|
320
|
-
$[74] = setInnerValue;
|
|
321
|
-
$[75] = t22;
|
|
322
|
-
} else t22 = $[75];
|
|
323
|
-
const update = t22;
|
|
324
|
-
let t23;
|
|
325
|
-
if ($[76] !== disabled || $[77] !== onSelect || $[78] !== readOnly || $[79] !== setOpen || $[80] !== update) {
|
|
326
|
-
t23 = (option_2) => {
|
|
327
|
-
if (disabled || readOnly || option_2.disabled) return;
|
|
328
|
-
update(option_2.value);
|
|
329
|
-
onSelect?.(option_2.value, option_2);
|
|
98
|
+
const emitSyncedOpen = useEffectEvent((next_3) => onOpenChange?.(next_3));
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (syncedOpenChange) emitSyncedOpen(syncedOpenChange.value);
|
|
101
|
+
}, [syncedOpenChange]);
|
|
102
|
+
useEffect(() => () => clearTimeout(blurTimer.current), []);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
(dropdownRef.current?.querySelector(`#${listboxId}-option-${active}`))?.scrollIntoView?.({ block: "nearest" });
|
|
105
|
+
}, [active, listboxId]);
|
|
106
|
+
const update = (next_4) => {
|
|
107
|
+
if (disabled || readOnly) return;
|
|
108
|
+
setInnerValue(next_4);
|
|
109
|
+
onChange?.(next_4);
|
|
110
|
+
};
|
|
111
|
+
const choose = (option_2) => {
|
|
112
|
+
if (disabled || readOnly || option_2.disabled) return;
|
|
113
|
+
update(option_2.value);
|
|
114
|
+
onSelect?.(option_2.value, option_2);
|
|
115
|
+
setOpen(false);
|
|
116
|
+
setActive(-1);
|
|
117
|
+
};
|
|
118
|
+
const handleInput = (next_5) => {
|
|
119
|
+
if (disabled || readOnly) return;
|
|
120
|
+
update(next_5);
|
|
121
|
+
if (composing.current) return;
|
|
122
|
+
search(next_5);
|
|
123
|
+
};
|
|
124
|
+
const search = (next_6) => {
|
|
125
|
+
onSearch?.(next_6);
|
|
126
|
+
if (!next_6 && !showOnEmpty) {
|
|
127
|
+
setSuppressRemoteOptions(!!onSearch);
|
|
330
128
|
setOpen(false);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
$[84] = loading;
|
|
368
|
-
$[85] = onSearch;
|
|
369
|
-
$[86] = readOnly;
|
|
370
|
-
$[87] = setOpen;
|
|
371
|
-
$[88] = showOnEmpty;
|
|
372
|
-
$[89] = update;
|
|
373
|
-
$[90] = handleInput;
|
|
374
|
-
$[91] = search;
|
|
375
|
-
} else {
|
|
376
|
-
handleInput = $[90];
|
|
377
|
-
search = $[91];
|
|
378
|
-
}
|
|
379
|
-
let t24;
|
|
380
|
-
if ($[92] !== active || $[93] !== choose || $[94] !== current || $[95] !== disabled || $[96] !== getMatches || $[97] !== readOnly || $[98] !== setOpen || $[99] !== showOnEmpty || $[100] !== shownOptions || $[101] !== suppressRemoteOptions || $[102] !== visible) {
|
|
381
|
-
t24 = (event) => {
|
|
382
|
-
if (disabled || readOnly) return;
|
|
383
|
-
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
384
|
-
if (!current && !showOnEmpty || suppressRemoteOptions) return;
|
|
385
|
-
if (!getMatches(current).length) return;
|
|
386
|
-
if (!shownOptions.length) return;
|
|
387
|
-
if (!visible) setOpen(true);
|
|
388
|
-
const enabled = shownOptions.map(_temp4).filter(_temp5);
|
|
389
|
-
if (!enabled.length) return;
|
|
390
|
-
const currentIndex = enabled.indexOf(active);
|
|
391
|
-
setActive(currentIndex < 0 ? enabled[event.key === "ArrowDown" ? 0 : enabled.length - 1] : enabled[(currentIndex + (event.key === "ArrowDown" ? 1 : -1) + enabled.length) % enabled.length]);
|
|
392
|
-
event.preventDefault();
|
|
393
|
-
} else if (event.key === "Enter" && visible && active >= 0) {
|
|
394
|
-
const option_4 = shownOptions[active];
|
|
395
|
-
if (option_4) choose(option_4);
|
|
396
|
-
event.preventDefault();
|
|
397
|
-
} else if (event.key === "Escape") {
|
|
398
|
-
event.preventDefault();
|
|
399
|
-
event.stopPropagation();
|
|
400
|
-
setOpen(false);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
$[92] = active;
|
|
404
|
-
$[93] = choose;
|
|
405
|
-
$[94] = current;
|
|
406
|
-
$[95] = disabled;
|
|
407
|
-
$[96] = getMatches;
|
|
408
|
-
$[97] = readOnly;
|
|
409
|
-
$[98] = setOpen;
|
|
410
|
-
$[99] = showOnEmpty;
|
|
411
|
-
$[100] = shownOptions;
|
|
412
|
-
$[101] = suppressRemoteOptions;
|
|
413
|
-
$[102] = visible;
|
|
414
|
-
$[103] = t24;
|
|
415
|
-
} else t24 = $[103];
|
|
416
|
-
const handleKeyDown = t24;
|
|
417
|
-
let t25;
|
|
418
|
-
if ($[104] !== className) {
|
|
419
|
-
t25 = clsx("k-auto-complete", className);
|
|
420
|
-
$[104] = className;
|
|
421
|
-
$[105] = t25;
|
|
422
|
-
} else t25 = $[105];
|
|
423
|
-
const t26 = visible ? listboxId : void 0;
|
|
424
|
-
const t27 = visible && active >= 0 ? `${listboxId}-option-${active}` : void 0;
|
|
425
|
-
let t28;
|
|
426
|
-
if ($[106] !== current || $[107] !== disabled || $[108] !== getMatches || $[109] !== loading || $[110] !== onFocus || $[111] !== readOnly || $[112] !== setOpen || $[113] !== showOnEmpty) {
|
|
427
|
-
t28 = (event_0) => {
|
|
428
|
-
onFocus?.(event_0);
|
|
429
|
-
if (event_0.defaultPrevented) return;
|
|
430
|
-
if (disabled || readOnly) return;
|
|
431
|
-
const matches_1 = getMatches(current);
|
|
432
|
-
if (matches_1.length) setShownOptions(matches_1);
|
|
433
|
-
if ((current || showOnEmpty) && (matches_1.length || loading)) setOpen(true);
|
|
434
|
-
};
|
|
435
|
-
$[106] = current;
|
|
436
|
-
$[107] = disabled;
|
|
437
|
-
$[108] = getMatches;
|
|
438
|
-
$[109] = loading;
|
|
439
|
-
$[110] = onFocus;
|
|
440
|
-
$[111] = readOnly;
|
|
441
|
-
$[112] = setOpen;
|
|
442
|
-
$[113] = showOnEmpty;
|
|
443
|
-
$[114] = t28;
|
|
444
|
-
} else t28 = $[114];
|
|
445
|
-
let t29;
|
|
446
|
-
if ($[115] !== onBlur || $[116] !== setOpen) {
|
|
447
|
-
t29 = (event_1) => {
|
|
448
|
-
onBlur?.(event_1);
|
|
449
|
-
if (event_1.defaultPrevented) return;
|
|
450
|
-
clearTimeout(blurTimer.current);
|
|
451
|
-
blurTimer.current = setTimeout(() => setOpen(false), 120);
|
|
452
|
-
};
|
|
453
|
-
$[115] = onBlur;
|
|
454
|
-
$[116] = setOpen;
|
|
455
|
-
$[117] = t29;
|
|
456
|
-
} else t29 = $[117];
|
|
457
|
-
let t30;
|
|
458
|
-
if ($[118] !== onCompositionStart) {
|
|
459
|
-
t30 = (event_2) => {
|
|
460
|
-
composing.current = true;
|
|
461
|
-
onCompositionStart?.(event_2);
|
|
462
|
-
};
|
|
463
|
-
$[118] = onCompositionStart;
|
|
464
|
-
$[119] = t30;
|
|
465
|
-
} else t30 = $[119];
|
|
466
|
-
let t31;
|
|
467
|
-
if ($[120] !== onCompositionEnd || $[121] !== search) {
|
|
468
|
-
t31 = (event_3) => {
|
|
469
|
-
composing.current = false;
|
|
470
|
-
onCompositionEnd?.(event_3);
|
|
471
|
-
if (!event_3.defaultPrevented) search(event_3.currentTarget.value);
|
|
472
|
-
};
|
|
473
|
-
$[120] = onCompositionEnd;
|
|
474
|
-
$[121] = search;
|
|
475
|
-
$[122] = t31;
|
|
476
|
-
} else t31 = $[122];
|
|
477
|
-
let t32;
|
|
478
|
-
if ($[123] !== handleKeyDown || $[124] !== onKeyDown) {
|
|
479
|
-
t32 = (event_4) => {
|
|
480
|
-
onKeyDown?.(event_4);
|
|
481
|
-
if (!event_4.defaultPrevented) handleKeyDown(event_4);
|
|
482
|
-
};
|
|
483
|
-
$[123] = handleKeyDown;
|
|
484
|
-
$[124] = onKeyDown;
|
|
485
|
-
$[125] = t32;
|
|
486
|
-
} else t32 = $[125];
|
|
487
|
-
let t33;
|
|
488
|
-
if ($[126] !== addonAfter || $[127] !== addonBefore || $[128] !== clearable || $[129] !== current || $[130] !== disabled || $[131] !== handleInput || $[132] !== onClear || $[133] !== prefix || $[134] !== readOnly || $[135] !== rest || $[136] !== shape || $[137] !== size || $[138] !== suffix || $[139] !== t26 || $[140] !== t27 || $[141] !== t28 || $[142] !== t29 || $[143] !== t30 || $[144] !== t31 || $[145] !== t32 || $[146] !== theme || $[147] !== visible) {
|
|
489
|
-
t33 = /* @__PURE__ */ jsx(input_default, {
|
|
129
|
+
} else if (loading) {
|
|
130
|
+
setSuppressRemoteOptions(false);
|
|
131
|
+
setOpen(true);
|
|
132
|
+
} else {
|
|
133
|
+
const matched_0 = commitMatches(next_6);
|
|
134
|
+
setSuppressRemoteOptions(!!onSearch && !matched_0);
|
|
135
|
+
setOpen(matched_0);
|
|
136
|
+
}
|
|
137
|
+
setActive(-1);
|
|
138
|
+
};
|
|
139
|
+
const handleKeyDown = (event) => {
|
|
140
|
+
if (disabled || readOnly) return;
|
|
141
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
142
|
+
if (!current && !showOnEmpty || suppressRemoteOptions) return;
|
|
143
|
+
if (!getMatches(current).length) return;
|
|
144
|
+
if (!shownOptions.length) return;
|
|
145
|
+
if (!visible) setOpen(true);
|
|
146
|
+
const enabled = shownOptions.map((option_3, index) => !option_3.disabled ? index : -1).filter((index_0) => index_0 >= 0);
|
|
147
|
+
if (!enabled.length) return;
|
|
148
|
+
const currentIndex = enabled.indexOf(active);
|
|
149
|
+
setActive(currentIndex < 0 ? enabled[event.key === "ArrowDown" ? 0 : enabled.length - 1] : enabled[(currentIndex + (event.key === "ArrowDown" ? 1 : -1) + enabled.length) % enabled.length]);
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
} else if (event.key === "Enter" && visible && active >= 0) {
|
|
152
|
+
const option_4 = shownOptions[active];
|
|
153
|
+
if (option_4) choose(option_4);
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
} else if (event.key === "Escape") {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
setOpen(false);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
ref: rootRef,
|
|
163
|
+
className: clsx("k-auto-complete", className),
|
|
164
|
+
children: [/* @__PURE__ */ jsx(input_default, {
|
|
490
165
|
...rest,
|
|
491
166
|
value: current,
|
|
492
167
|
disabled,
|
|
@@ -502,102 +177,38 @@ var AutoComplete = (t0) => {
|
|
|
502
177
|
role: "combobox",
|
|
503
178
|
"aria-autocomplete": "list",
|
|
504
179
|
"aria-expanded": visible,
|
|
505
|
-
"aria-controls":
|
|
506
|
-
"aria-activedescendant":
|
|
507
|
-
onFocus:
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
180
|
+
"aria-controls": visible ? listboxId : void 0,
|
|
181
|
+
"aria-activedescendant": visible && active >= 0 ? `${listboxId}-option-${active}` : void 0,
|
|
182
|
+
onFocus: (event_0) => {
|
|
183
|
+
onFocus?.(event_0);
|
|
184
|
+
if (event_0.defaultPrevented) return;
|
|
185
|
+
if (disabled || readOnly) return;
|
|
186
|
+
const matches_1 = getMatches(current);
|
|
187
|
+
if (matches_1.length) setShownOptions(matches_1);
|
|
188
|
+
if ((current || showOnEmpty) && (matches_1.length || loading)) setOpen(true);
|
|
189
|
+
},
|
|
190
|
+
onBlur: (event_1) => {
|
|
191
|
+
onBlur?.(event_1);
|
|
192
|
+
if (event_1.defaultPrevented) return;
|
|
193
|
+
clearTimeout(blurTimer.current);
|
|
194
|
+
blurTimer.current = setTimeout(() => setOpen(false), 120);
|
|
195
|
+
},
|
|
196
|
+
onCompositionStart: (event_2) => {
|
|
197
|
+
composing.current = true;
|
|
198
|
+
onCompositionStart?.(event_2);
|
|
199
|
+
},
|
|
200
|
+
onCompositionEnd: (event_3) => {
|
|
201
|
+
composing.current = false;
|
|
202
|
+
onCompositionEnd?.(event_3);
|
|
203
|
+
if (!event_3.defaultPrevented) search(event_3.currentTarget.value);
|
|
204
|
+
},
|
|
511
205
|
onClear,
|
|
512
206
|
onChange: handleInput,
|
|
513
|
-
onKeyDown:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
$[129] = current;
|
|
519
|
-
$[130] = disabled;
|
|
520
|
-
$[131] = handleInput;
|
|
521
|
-
$[132] = onClear;
|
|
522
|
-
$[133] = prefix;
|
|
523
|
-
$[134] = readOnly;
|
|
524
|
-
$[135] = rest;
|
|
525
|
-
$[136] = shape;
|
|
526
|
-
$[137] = size;
|
|
527
|
-
$[138] = suffix;
|
|
528
|
-
$[139] = t26;
|
|
529
|
-
$[140] = t27;
|
|
530
|
-
$[141] = t28;
|
|
531
|
-
$[142] = t29;
|
|
532
|
-
$[143] = t30;
|
|
533
|
-
$[144] = t31;
|
|
534
|
-
$[145] = t32;
|
|
535
|
-
$[146] = theme;
|
|
536
|
-
$[147] = visible;
|
|
537
|
-
$[148] = t33;
|
|
538
|
-
} else t33 = $[148];
|
|
539
|
-
const t34 = size === "small";
|
|
540
|
-
const t35 = size === "large";
|
|
541
|
-
let t36;
|
|
542
|
-
if ($[149] !== t34 || $[150] !== t35) {
|
|
543
|
-
t36 = clsx("k-select-dropdown", "k-auto-complete-dropdown", {
|
|
544
|
-
"k-select-dropdown-sm": t34,
|
|
545
|
-
"k-select-dropdown-lg": t35
|
|
546
|
-
});
|
|
547
|
-
$[149] = t34;
|
|
548
|
-
$[150] = t35;
|
|
549
|
-
$[151] = t36;
|
|
550
|
-
} else t36 = $[151];
|
|
551
|
-
let t37;
|
|
552
|
-
if ($[152] !== active || $[153] !== choose || $[154] !== disabled || $[155] !== listboxId || $[156] !== loading || $[157] !== loadingText || $[158] !== locale || $[159] !== readOnly || $[160] !== shownOptions) {
|
|
553
|
-
t37 = loading ? /* @__PURE__ */ jsxs("div", {
|
|
554
|
-
className: "k-select-loading",
|
|
555
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
556
|
-
type: Loading,
|
|
557
|
-
spin: true
|
|
558
|
-
}), /* @__PURE__ */ jsx("span", { children: loadingText || locale.k.select.loading })]
|
|
559
|
-
}) : /* @__PURE__ */ jsx("ul", { children: shownOptions.map((option_5, index_1) => /* @__PURE__ */ jsx("li", {
|
|
560
|
-
id: `${listboxId}-option-${index_1}`,
|
|
561
|
-
role: "option",
|
|
562
|
-
"aria-selected": active === index_1,
|
|
563
|
-
"aria-disabled": option_5.disabled || void 0,
|
|
564
|
-
className: clsx("k-select-item", {
|
|
565
|
-
"k-select-item-active": active === index_1,
|
|
566
|
-
"k-select-item-disabled": option_5.disabled
|
|
567
|
-
}),
|
|
568
|
-
onMouseDown: _temp6,
|
|
569
|
-
onMouseEnter: () => !disabled && !readOnly && !option_5.disabled && setActive(index_1),
|
|
570
|
-
onClick: () => choose(option_5),
|
|
571
|
-
children: option_5.label ?? option_5.value
|
|
572
|
-
}, option_5.value)) });
|
|
573
|
-
$[152] = active;
|
|
574
|
-
$[153] = choose;
|
|
575
|
-
$[154] = disabled;
|
|
576
|
-
$[155] = listboxId;
|
|
577
|
-
$[156] = loading;
|
|
578
|
-
$[157] = loadingText;
|
|
579
|
-
$[158] = locale;
|
|
580
|
-
$[159] = readOnly;
|
|
581
|
-
$[160] = shownOptions;
|
|
582
|
-
$[161] = t37;
|
|
583
|
-
} else t37 = $[161];
|
|
584
|
-
let t38;
|
|
585
|
-
if ($[162] !== listboxId || $[163] !== t36 || $[164] !== t37) {
|
|
586
|
-
t38 = /* @__PURE__ */ jsx("div", {
|
|
587
|
-
ref: dropdownRef,
|
|
588
|
-
id: listboxId,
|
|
589
|
-
className: t36,
|
|
590
|
-
role: "listbox",
|
|
591
|
-
children: t37
|
|
592
|
-
});
|
|
593
|
-
$[162] = listboxId;
|
|
594
|
-
$[163] = t36;
|
|
595
|
-
$[164] = t37;
|
|
596
|
-
$[165] = t38;
|
|
597
|
-
} else t38 = $[165];
|
|
598
|
-
let t39;
|
|
599
|
-
if ($[166] !== destroyOnClose || $[167] !== setOpen || $[168] !== t38 || $[169] !== visible) {
|
|
600
|
-
t39 = /* @__PURE__ */ jsx(Popup, {
|
|
207
|
+
onKeyDown: (event_4) => {
|
|
208
|
+
onKeyDown?.(event_4);
|
|
209
|
+
if (!event_4.defaultPrevented) handleKeyDown(event_4);
|
|
210
|
+
}
|
|
211
|
+
}), /* @__PURE__ */ jsx(Popup, {
|
|
601
212
|
raw: true,
|
|
602
213
|
open: visible,
|
|
603
214
|
target: rootRef,
|
|
@@ -609,49 +220,37 @@ var AutoComplete = (t0) => {
|
|
|
609
220
|
matchTriggerWidth: true,
|
|
610
221
|
destroyOnClose,
|
|
611
222
|
onOpenChange: setOpen,
|
|
612
|
-
overlay:
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
223
|
+
overlay: /* @__PURE__ */ jsx("div", {
|
|
224
|
+
ref: dropdownRef,
|
|
225
|
+
id: listboxId,
|
|
226
|
+
className: clsx("k-select-dropdown", "k-auto-complete-dropdown", {
|
|
227
|
+
"k-select-dropdown-sm": size === "small",
|
|
228
|
+
"k-select-dropdown-lg": size === "large"
|
|
229
|
+
}),
|
|
230
|
+
role: "listbox",
|
|
231
|
+
children: loading ? /* @__PURE__ */ jsxs("div", {
|
|
232
|
+
className: "k-select-loading",
|
|
233
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
234
|
+
type: Loading,
|
|
235
|
+
spin: true
|
|
236
|
+
}), /* @__PURE__ */ jsx("span", { children: loadingText || locale.k.select.loading })]
|
|
237
|
+
}) : /* @__PURE__ */ jsx("ul", { children: shownOptions.map((option_5, index_1) => /* @__PURE__ */ jsx("li", {
|
|
238
|
+
id: `${listboxId}-option-${index_1}`,
|
|
239
|
+
role: "option",
|
|
240
|
+
"aria-selected": active === index_1,
|
|
241
|
+
"aria-disabled": option_5.disabled || void 0,
|
|
242
|
+
className: clsx("k-select-item", {
|
|
243
|
+
"k-select-item-active": active === index_1,
|
|
244
|
+
"k-select-item-disabled": option_5.disabled
|
|
245
|
+
}),
|
|
246
|
+
onMouseDown: (event_5) => event_5.preventDefault(),
|
|
247
|
+
onMouseEnter: () => !disabled && !readOnly && !option_5.disabled && setActive(index_1),
|
|
248
|
+
onClick: () => choose(option_5),
|
|
249
|
+
children: option_5.label ?? option_5.value
|
|
250
|
+
}, option_5.value)) })
|
|
251
|
+
})
|
|
252
|
+
})]
|
|
253
|
+
});
|
|
633
254
|
};
|
|
634
255
|
var auto_complete_default = createFormFieldComponent(AutoComplete);
|
|
635
|
-
function _temp(item) {
|
|
636
|
-
return typeof item === "string" ? {
|
|
637
|
-
value: item,
|
|
638
|
-
label: item
|
|
639
|
-
} : item;
|
|
640
|
-
}
|
|
641
|
-
function _temp2(next) {
|
|
642
|
-
return next ?? "";
|
|
643
|
-
}
|
|
644
|
-
function _temp3(next_0) {
|
|
645
|
-
return next_0 ?? false;
|
|
646
|
-
}
|
|
647
|
-
function _temp4(option_3, index) {
|
|
648
|
-
return !option_3.disabled ? index : -1;
|
|
649
|
-
}
|
|
650
|
-
function _temp5(index_0) {
|
|
651
|
-
return index_0 >= 0;
|
|
652
|
-
}
|
|
653
|
-
function _temp6(event_5) {
|
|
654
|
-
return event_5.preventDefault();
|
|
655
|
-
}
|
|
656
|
-
//#endregion
|
|
657
256
|
export { auto_complete_default as default };
|