react-kui 3.1.0 → 3.1.2

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.
Files changed (247) hide show
  1. package/AI.en-US.md +86 -1
  2. package/AI.md +68 -4
  3. package/ai/behaviors.json +114 -14
  4. package/ai/cli.mjs +180 -17
  5. package/ai/descriptions.json +446 -0
  6. package/ai/kui-components.json +778 -305
  7. package/ai/mcp.mjs +2 -189
  8. package/ai/query.mjs +195 -0
  9. package/ai/skills/react-kui/SKILL.md +41 -9
  10. package/ai/skills/react-kui/references/mcp.md +11 -1
  11. package/ai/skills/react-kui/references/react-to-vue.md +110 -0
  12. package/ai/skills/react-kui/references/vue-to-react.md +86 -0
  13. package/ai/validate.mjs +18 -0
  14. package/es/_virtual/_rolldown/runtime.js +1 -1
  15. package/es/affix/index.js +1 -1
  16. package/es/alert/index.js +1 -1
  17. package/es/anchor/anchor-context.js +1 -1
  18. package/es/anchor/anchor-link.js +1 -1
  19. package/es/anchor/anchor.js +1 -1
  20. package/es/auto-complete/index.js +1 -1
  21. package/es/avatar/avatar-group-context.js +1 -1
  22. package/es/avatar/avatar-group.js +1 -1
  23. package/es/avatar/avatar.js +1 -1
  24. package/es/back-top/index.js +1 -1
  25. package/es/badge/index.js +1 -1
  26. package/es/base/teleport.js +1 -1
  27. package/es/base/transition-props.js +1 -1
  28. package/es/base/transition.js +1 -1
  29. package/es/breadcrumb/breadcrumb-context.js +1 -1
  30. package/es/breadcrumb/breadcrumb-item.js +1 -1
  31. package/es/breadcrumb/breadcrumb.js +1 -1
  32. package/es/button/button-group-context.js +1 -1
  33. package/es/button/button-group.js +1 -1
  34. package/es/button/button.js +1 -1
  35. package/es/calendar/index.js +1 -1
  36. package/es/card/index.js +1 -1
  37. package/es/carousel/carousel-context.js +1 -1
  38. package/es/carousel/carousel-item.js +1 -1
  39. package/es/carousel/carousel.js +522 -274
  40. package/es/carousel/drag.js +169 -0
  41. package/es/cascader/index.js +1 -1
  42. package/es/check-card/check-card-group.js +1 -1
  43. package/es/check-card/check-card.js +1 -1
  44. package/es/check-card/context.js +1 -1
  45. package/es/checkbox/checkbox-group-context.js +1 -1
  46. package/es/checkbox/checkbox-group.js +1 -1
  47. package/es/checkbox/checkbox.js +1 -1
  48. package/es/checkbox/index.js +1 -1
  49. package/es/collapse/collapse-panel.js +1 -1
  50. package/es/collapse/collapse.js +1 -1
  51. package/es/color-picker/alpha.js +1 -1
  52. package/es/color-picker/hue.js +1 -1
  53. package/es/color-picker/index.js +1 -1
  54. package/es/color-picker/mode.js +1 -1
  55. package/es/color-picker/paint.js +1 -1
  56. package/es/color-picker/presets.js +1 -1
  57. package/es/components.js +1 -1
  58. package/es/config/config-context.js +1 -1
  59. package/es/config/context.js +1 -1
  60. package/es/config/index.js +1 -1
  61. package/es/config/size-context.js +1 -1
  62. package/es/config/use-config-appearance.js +1 -1
  63. package/es/const/var.js +1 -1
  64. package/es/date-picker/index.js +1 -1
  65. package/es/descriptions/descriptions-item.js +1 -1
  66. package/es/descriptions/descriptions.js +1 -1
  67. package/es/divider/index.js +1 -1
  68. package/es/drawer/index.js +1 -1
  69. package/es/dropdown/dropdown-button.js +1 -1
  70. package/es/dropdown/dropdown-context.js +1 -1
  71. package/es/dropdown/dropdown.js +1 -1
  72. package/es/dropdown/trigger.js +1 -1
  73. package/es/empty/index.js +1 -1
  74. package/es/feature-card/index.js +1 -1
  75. package/es/feedback-panel/index.js +1 -1
  76. package/es/flame-wrap/index.js +1 -1
  77. package/es/flame-wrap/types.js +1 -1
  78. package/es/flex/index.js +1 -1
  79. package/es/form/field-context.js +1 -1
  80. package/es/form/form-context.js +1 -1
  81. package/es/form/form-item.js +1 -1
  82. package/es/form/form.js +1 -1
  83. package/es/form/utils.js +1 -1
  84. package/es/grid/grid-item.js +1 -1
  85. package/es/grid/grid.js +1 -1
  86. package/es/grid/useBreakpoint.js +1 -1
  87. package/es/icon/index.js +1 -1
  88. package/es/image/group.js +1 -1
  89. package/es/image/image-group-context.js +1 -1
  90. package/es/image/image.js +1 -1
  91. package/es/image/instance.js +1 -1
  92. package/es/image/preview.js +1 -1
  93. package/es/image/utils.js +1 -1
  94. package/es/index.js +1 -1
  95. package/es/input/index.js +1 -1
  96. package/es/input/input-base.js +202 -0
  97. package/es/input/input-box.js +1 -1
  98. package/es/input/input-group.js +1 -1
  99. package/es/input/input.js +19 -188
  100. package/es/input/textarea.js +1 -1
  101. package/es/input-number/index.js +4 -4
  102. package/es/input-otp/index.js +1 -1
  103. package/es/input-tag/index.js +1 -1
  104. package/es/kanban/index.js +1 -1
  105. package/es/layout/index.js +1 -1
  106. package/es/layout/layout-context.js +1 -1
  107. package/es/list-panel/index.js +1 -1
  108. package/es/loading/index.js +1 -1
  109. package/es/loading/loading-bar.js +1 -1
  110. package/es/locale/de.js +1 -1
  111. package/es/locale/el.js +1 -1
  112. package/es/locale/en.js +1 -1
  113. package/es/locale/fr.js +1 -1
  114. package/es/locale/it.js +1 -1
  115. package/es/locale/ja.js +1 -1
  116. package/es/locale/ko.js +1 -1
  117. package/es/locale/ru.js +1 -1
  118. package/es/locale/th.js +1 -1
  119. package/es/locale/uk.js +1 -1
  120. package/es/locale/vi.js +1 -1
  121. package/es/locale/zh-CN.js +1 -1
  122. package/es/locale/zh-TW.js +1 -1
  123. package/es/mentions/index.js +1 -1
  124. package/es/menu/menu-context.js +1 -1
  125. package/es/menu/menu-divider.js +1 -1
  126. package/es/menu/menu-group.js +1 -1
  127. package/es/menu/menu-item.js +1 -1
  128. package/es/menu/menu-keyboard.js +1 -1
  129. package/es/menu/menu.js +1 -1
  130. package/es/menu/recursive-menu.js +1 -1
  131. package/es/menu/sub-menu.js +1 -1
  132. package/es/message/index.js +1 -1
  133. package/es/modal/api.js +1 -1
  134. package/es/modal/modal.js +1 -1
  135. package/es/modal/toast.js +1 -1
  136. package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
  137. package/es/notice/container.js +1 -1
  138. package/es/notice/content.js +1 -1
  139. package/es/notice/index.js +1 -1
  140. package/es/notice/instance.js +1 -1
  141. package/es/page/index.js +99 -76
  142. package/es/page/responsive.js +96 -0
  143. package/es/page-header/index.js +1 -1
  144. package/es/popconfirm/index.js +1 -1
  145. package/es/poptip/index.js +1 -1
  146. package/es/popup/index.js +1 -1
  147. package/es/popup/layers.js +1 -1
  148. package/es/progress/index.js +1 -1
  149. package/es/qrcode/index.js +1 -1
  150. package/es/radio/radio-button.js +1 -1
  151. package/es/radio/radio-group-context.js +1 -1
  152. package/es/radio/radio-group.js +1 -1
  153. package/es/radio/radio.js +1 -1
  154. package/es/rate/index.js +1 -1
  155. package/es/rate/star.js +1 -1
  156. package/es/result/index.js +1 -1
  157. package/es/ripple/index.js +1 -1
  158. package/es/ripple/types.js +1 -1
  159. package/es/row-col/col.js +1 -1
  160. package/es/row-col/row.js +1 -1
  161. package/es/segmented/index.js +1 -1
  162. package/es/select/option.js +1 -1
  163. package/es/select/select.js +24 -27
  164. package/es/skeleton/skeleton-avatar.js +1 -1
  165. package/es/skeleton/skeleton-button.js +1 -1
  166. package/es/skeleton/skeleton-image.js +1 -1
  167. package/es/skeleton/skeleton-text.js +1 -1
  168. package/es/skeleton/skeleton.js +1 -1
  169. package/es/skeleton/use-skeleton-loading.js +1 -1
  170. package/es/slider/index.js +1 -1
  171. package/es/slider/thumb.js +1 -1
  172. package/es/space/index.js +1 -1
  173. package/es/spin/index.js +1 -1
  174. package/es/splitter/splitter-panel.js +1 -1
  175. package/es/splitter/splitter.js +1 -1
  176. package/es/stat-card/countup.js +1 -1
  177. package/es/stat-card/rollup.js +1 -1
  178. package/es/stat-card/stat-card.js +1 -1
  179. package/es/stat-card/stat-number.js +1 -1
  180. package/es/stat-card/utils/countup.js +1 -1
  181. package/es/stat-card/utils/odometer.js +1 -1
  182. package/es/steps/index.js +1 -1
  183. package/es/switch/index.js +1 -1
  184. package/es/table/column-setting.js +1 -1
  185. package/es/table/index.js +1 -1
  186. package/es/table/utils.js +1 -1
  187. package/es/tabs/tab-panel.js +1 -1
  188. package/es/tabs/tabs.js +1 -1
  189. package/es/tag/index.js +1 -1
  190. package/es/time-line/timeline-item.js +1 -1
  191. package/es/time-line/timeline.js +1 -1
  192. package/es/tooltip/index.js +1 -1
  193. package/es/tour/index.js +1 -1
  194. package/es/transfer/index.js +1 -1
  195. package/es/tree/index.js +1 -1
  196. package/es/tree/utils.js +1 -1
  197. package/es/tree-select/index.js +1 -1
  198. package/es/typography/index.js +1 -1
  199. package/es/upload/file-list.js +1 -1
  200. package/es/upload/index.js +1 -1
  201. package/es/upload/picture-sort.js +1 -1
  202. package/es/upload/selector.js +1 -1
  203. package/es/utils/checked.js +1 -1
  204. package/es/utils/color.js +1 -1
  205. package/es/utils/number.js +1 -1
  206. package/es/utils/placement.js +1 -1
  207. package/es/utils/popup.js +1 -1
  208. package/es/utils/react-node.js +1 -1
  209. package/es/utils/selection-tags.js +1 -1
  210. package/es/utils/share.js +1 -1
  211. package/es/utils/theme.js +1 -1
  212. package/es/utils/transition.js +1 -1
  213. package/es/utils/use-value.js +1 -1
  214. package/es/virtual-list/index.js +1 -1
  215. package/es/virtual-list/range.js +1 -1
  216. package/es/watermark/index.js +1 -1
  217. package/lib/index.cjs +2 -2
  218. package/lib/locale/de.cjs +1 -1
  219. package/lib/locale/el.cjs +1 -1
  220. package/lib/locale/en.cjs +1 -1
  221. package/lib/locale/fr.cjs +1 -1
  222. package/lib/locale/it.cjs +1 -1
  223. package/lib/locale/ja.cjs +1 -1
  224. package/lib/locale/ko.cjs +1 -1
  225. package/lib/locale/ru.cjs +1 -1
  226. package/lib/locale/th.cjs +1 -1
  227. package/lib/locale/uk.cjs +1 -1
  228. package/lib/locale/vi.cjs +1 -1
  229. package/lib/locale/zh-CN.cjs +1 -1
  230. package/lib/locale/zh-TW.cjs +1 -1
  231. package/package.json +6 -3
  232. package/style/base.css +1 -1
  233. package/style/components.css +2 -2
  234. package/style/index.css +2 -2
  235. package/style/theme.css +1 -1
  236. package/types/carousel/carousel.d.cts +2 -1
  237. package/types/carousel/carousel.d.ts +2 -1
  238. package/types/carousel/drag.d.cts +19 -0
  239. package/types/carousel/drag.d.ts +19 -0
  240. package/types/input/input-base.d.cts +31 -0
  241. package/types/input/input-base.d.ts +31 -0
  242. package/types/input/input.d.cts +2 -25
  243. package/types/input/input.d.ts +2 -25
  244. package/types/page/index.d.cts +1 -0
  245. package/types/page/index.d.ts +1 -0
  246. package/types/page/responsive.d.cts +1 -0
  247. package/types/page/responsive.d.ts +1 -0
@@ -0,0 +1,202 @@
1
+ /*!
2
+ * react-kui v3.1.2
3
+ * Copyright 2017-present, kui-react.
4
+ * All rights reserved.
5
+ * Homepage: https://react.k-ui.cn
6
+ * Author: Qiu / https://chuchur.com
7
+ */
8
+
9
+ import { useConfigAppearance } from "../config/use-config-appearance.js";
10
+ import { CircleX, Eye, EyeOff, Search } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
11
+ import Icon from "../icon/index.js";
12
+ import { useValue } from "../utils/use-value.js";
13
+ import { SizeContext } from "../config/size-context.js";
14
+ import { isEmpty } from "../utils/number.js";
15
+ import InputBox from "./input-box.js";
16
+ import InputGroup from "./input-group.js";
17
+ import clsx from "clsx";
18
+ import React, { useContext, useImperativeHandle, useRef, useState } from "react";
19
+ import { jsx, jsxs } from "react/jsx-runtime";
20
+ //#region components/input/input-base.tsx
21
+ /** Shared implementation. Deliberately absent from the public component barrel. */
22
+ var InputBase = React.forwardRef(({ clearable = true, visiblePasswordIcon = true, size: sizeProp, value, disabled = false, readOnly = false, type = "text", icon, suffix, prefix, addonBefore, addonAfter, theme: themeProp, shape: shapeProp, onSearch, onIconClick, onClear, onChange, className = "", style, onFocus, onBlur, onInput, controls, stylePrefix: inputType = "input", ...rest }, ref) => {
23
+ const inheritedAppearance = useConfigAppearance();
24
+ const size = sizeProp ?? inheritedAppearance.size;
25
+ const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
26
+ const shape = shapeProp ?? inheritedAppearance.shape;
27
+ const parentSize = useContext(SizeContext);
28
+ const currentSize = sizeProp ?? parentSize ?? size;
29
+ const [innerValue, setInnerValue] = useValue(value, (next) => next ?? "");
30
+ const currentValue = innerValue;
31
+ const [focused, setFocused] = useState(false);
32
+ const [showPassword, setShowPassword] = useState(false);
33
+ const inputRef = useRef(null);
34
+ useImperativeHandle(ref, () => ({
35
+ focus: () => inputRef.current?.focus(),
36
+ blur: () => inputRef.current?.blur()
37
+ }));
38
+ const handleClear = () => {
39
+ if (disabled || readOnly) return;
40
+ setInnerValue("");
41
+ onClear?.();
42
+ onChange?.("");
43
+ inputRef.current?.focus();
44
+ };
45
+ const togglePassword = () => {
46
+ if (disabled || readOnly) return;
47
+ setShowPassword(!showPassword);
48
+ };
49
+ const hasPrefix = prefix !== null && prefix !== void 0 && prefix !== "";
50
+ const hasSuffix = suffix !== null && suffix !== void 0 && suffix !== "";
51
+ const useGroup = addonBefore !== void 0 || addonAfter !== void 0;
52
+ const getSuffix = () => {
53
+ if (type === "password" && visiblePasswordIcon) return /* @__PURE__ */ jsx(Icon, {
54
+ className: "k-input-password-icon",
55
+ type: !showPassword ? Eye : EyeOff,
56
+ role: "button",
57
+ tabIndex: disabled || readOnly ? void 0 : 0,
58
+ "aria-label": showPassword ? "Hide password" : "Show password",
59
+ onClick: togglePassword,
60
+ onKeyDown: (event) => {
61
+ if (event.key === "Enter" || event.key === " ") {
62
+ event.preventDefault();
63
+ togglePassword();
64
+ }
65
+ }
66
+ });
67
+ else if (onSearch) return /* @__PURE__ */ jsx(Icon, {
68
+ type: Search,
69
+ className: "k-input-search-icon",
70
+ role: "button",
71
+ tabIndex: disabled || readOnly ? void 0 : 0,
72
+ "aria-label": "Search",
73
+ onClick: () => !disabled && !readOnly && onSearch(currentValue),
74
+ onKeyDown: (event_0) => {
75
+ if (event_0.key === "Enter" || event_0.key === " ") {
76
+ event_0.preventDefault();
77
+ if (!disabled && !readOnly) onSearch(currentValue);
78
+ }
79
+ }
80
+ });
81
+ return hasSuffix ? /* @__PURE__ */ jsx("div", {
82
+ className: `k-${inputType}-suffix`,
83
+ children: suffix
84
+ }) : null;
85
+ };
86
+ const clearableShow = clearable && !isEmpty(currentValue) && type !== "password" && !disabled && !readOnly;
87
+ const multiple = (!!icon || !!onSearch || hasSuffix || hasPrefix || addonBefore !== void 0 || addonAfter !== void 0 || type === "password" || clearable || !!controls) && type !== "hidden";
88
+ const handleInputChange = (e) => {
89
+ const v = e.target.value;
90
+ setInnerValue(v);
91
+ onChange?.(v);
92
+ };
93
+ const handleInputFocus = (e_0) => {
94
+ setFocused(true);
95
+ onFocus?.(e_0);
96
+ };
97
+ const handleInputBlur = (e_1) => {
98
+ setFocused(false);
99
+ onBlur?.(e_1);
100
+ };
101
+ const inputBoxProps = {
102
+ ...rest,
103
+ disabled,
104
+ readOnly,
105
+ multiple,
106
+ type,
107
+ size,
108
+ theme,
109
+ shape,
110
+ inputRef,
111
+ inputType,
112
+ value: currentValue,
113
+ showPassword,
114
+ onChange: handleInputChange,
115
+ onInput,
116
+ onFocus: handleInputFocus,
117
+ onBlur: handleInputBlur,
118
+ className: !multiple ? className : void 0,
119
+ style: !multiple ? style : void 0
120
+ };
121
+ if (typeof currentSize === "string") inputBoxProps.size = currentSize;
122
+ const textInput = /* @__PURE__ */ jsx(InputBox, { ...inputBoxProps });
123
+ if (!multiple) return textInput;
124
+ const rootClasses = clsx(`k-${inputType}`, {
125
+ [`k-${inputType}-focus`]: focused,
126
+ [`k-${inputType}-disabled`]: disabled,
127
+ [`k-${inputType}-readonly`]: readOnly,
128
+ [`k-${inputType}-has-clear`]: clearableShow,
129
+ [`k-${inputType}-sm`]: currentSize === "small",
130
+ [`k-${inputType}-lg`]: currentSize === "large",
131
+ [`k-${inputType}-${theme}`]: theme && theme !== "outline",
132
+ [`k-${inputType}-circle`]: shape === "circle",
133
+ [`k-${inputType}-square`]: shape === "square"
134
+ }, !useGroup && className);
135
+ const innerChildren = [];
136
+ if (icon) innerChildren.push(/* @__PURE__ */ jsx(Icon, {
137
+ type: icon,
138
+ className: `k-${inputType}-icon`,
139
+ role: onIconClick ? "button" : void 0,
140
+ tabIndex: onIconClick && !disabled && !readOnly ? 0 : void 0,
141
+ onClick: (e_2) => !disabled && !readOnly && onIconClick?.(e_2),
142
+ onKeyDown: (event_1) => {
143
+ if (event_1.key === "Enter" || event_1.key === " ") {
144
+ event_1.preventDefault();
145
+ event_1.currentTarget.click();
146
+ }
147
+ }
148
+ }, "input-icon"));
149
+ if (hasPrefix) innerChildren.push(/* @__PURE__ */ jsx("div", {
150
+ className: `k-${inputType}-prefix`,
151
+ children: prefix
152
+ }, "input-prefix"));
153
+ innerChildren.push(React.cloneElement(textInput, { key: "input-box" }));
154
+ if (clearable) innerChildren.push(/* @__PURE__ */ jsx(Icon, {
155
+ type: CircleX,
156
+ className: clsx(`k-${inputType}-clearable`, { [`k-${inputType}-clearable-hidden`]: !clearableShow }),
157
+ role: "button",
158
+ tabIndex: clearableShow ? 0 : void 0,
159
+ "aria-label": "Clear",
160
+ onPointerDown: (event_2) => event_2.preventDefault(),
161
+ onClick: handleClear,
162
+ onKeyDown: (event_3) => {
163
+ if (event_3.key === "Enter" || event_3.key === " ") {
164
+ event_3.preventDefault();
165
+ handleClear();
166
+ }
167
+ }
168
+ }, "input-clear"));
169
+ const suffixNode = getSuffix();
170
+ if (suffixNode) innerChildren.push(/* @__PURE__ */ jsx(React.Fragment, { children: suffixNode }, "input-suffix-node"));
171
+ if (controls) innerChildren.push(/* @__PURE__ */ jsx(React.Fragment, { children: controls }, "input-controls"));
172
+ if (useGroup) return /* @__PURE__ */ jsxs(InputGroup, {
173
+ size: currentSize,
174
+ theme,
175
+ className,
176
+ style,
177
+ children: [
178
+ addonBefore !== void 0 ? /* @__PURE__ */ jsx("div", {
179
+ className: "k-input-group-prefix",
180
+ children: addonBefore
181
+ }) : null,
182
+ /* @__PURE__ */ jsx("div", {
183
+ className: rootClasses,
184
+ "data-multiple": "",
185
+ children: innerChildren
186
+ }),
187
+ addonAfter !== void 0 ? /* @__PURE__ */ jsx("div", {
188
+ className: "k-input-group-suffix",
189
+ children: addonAfter
190
+ }) : null
191
+ ]
192
+ });
193
+ return /* @__PURE__ */ jsx("div", {
194
+ className: rootClasses,
195
+ style,
196
+ "data-multiple": "",
197
+ children: innerChildren
198
+ });
199
+ });
200
+ InputBase.displayName = "InputBase";
201
+ //#endregion
202
+ export { InputBase as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/input/input.js CHANGED
@@ -1,201 +1,32 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
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 { useConfigAppearance } from "../config/use-config-appearance.js";
10
- import { CircleX, Eye, EyeOff, Search } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
11
- import Icon from "../icon/index.js";
12
- import { useValue } from "../utils/use-value.js";
13
- import { SizeContext } from "../config/size-context.js";
14
9
  import { createFormFieldComponent } from "../form/field-context.js";
15
- import { isEmpty } from "../utils/number.js";
16
- import InputBox from "./input-box.js";
17
- import InputGroup from "./input-group.js";
18
- import clsx from "clsx";
19
- import React, { useContext, useImperativeHandle, useRef, useState } from "react";
20
- import { jsx, jsxs } from "react/jsx-runtime";
10
+ import InputBase from "./input-base.js";
11
+ import { c } from "react/compiler-runtime";
12
+ import React from "react";
13
+ import { jsx } from "react/jsx-runtime";
21
14
  //#region components/input/input.tsx
22
- var Input = React.forwardRef(({ clearable = true, visiblePasswordIcon = true, size: sizeProp, value, disabled = false, readOnly = false, type = "text", icon, suffix, prefix, addonBefore, addonAfter, theme: themeProp, shape: shapeProp, inputType = "input", onSearch, onIconClick, onClear, onChange, className = "", style, onFocus, onBlur, onInput, controls, ...rest }, ref) => {
23
- const inheritedAppearance = useConfigAppearance();
24
- const size = sizeProp ?? inheritedAppearance.size;
25
- const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
26
- const shape = shapeProp ?? inheritedAppearance.shape;
27
- const parentSize = useContext(SizeContext);
28
- const currentSize = sizeProp ?? parentSize ?? size;
29
- const [innerValue, setInnerValue] = useValue(value, (next) => next ?? "");
30
- const currentValue = innerValue;
31
- const [focused, setFocused] = useState(false);
32
- const [showPassword, setShowPassword] = useState(false);
33
- const inputRef = useRef(null);
34
- useImperativeHandle(ref, () => ({
35
- focus: () => inputRef.current?.focus(),
36
- blur: () => inputRef.current?.blur()
37
- }));
38
- const handleClear = () => {
39
- if (disabled || readOnly) return;
40
- setInnerValue("");
41
- onClear?.();
42
- onChange?.("");
43
- inputRef.current?.focus();
44
- };
45
- const togglePassword = () => {
46
- if (disabled || readOnly) return;
47
- setShowPassword(!showPassword);
48
- };
49
- const hasPrefix = prefix !== null && prefix !== void 0 && prefix !== "";
50
- const hasSuffix = suffix !== null && suffix !== void 0 && suffix !== "";
51
- const useGroup = addonBefore !== void 0 || addonAfter !== void 0;
52
- const getSuffix = () => {
53
- if (type === "password" && visiblePasswordIcon) return /* @__PURE__ */ jsx(Icon, {
54
- className: "k-input-password-icon",
55
- type: !showPassword ? Eye : EyeOff,
56
- role: "button",
57
- tabIndex: disabled || readOnly ? void 0 : 0,
58
- "aria-label": showPassword ? "Hide password" : "Show password",
59
- onClick: togglePassword,
60
- onKeyDown: (event) => {
61
- if (event.key === "Enter" || event.key === " ") {
62
- event.preventDefault();
63
- togglePassword();
64
- }
65
- }
15
+ var Input = React.forwardRef((props, ref) => {
16
+ const $ = c(3);
17
+ let t0;
18
+ if ($[0] !== props || $[1] !== ref) {
19
+ t0 = /* @__PURE__ */ jsx(InputBase, {
20
+ ...props,
21
+ ref,
22
+ stylePrefix: "input",
23
+ controls: void 0
66
24
  });
67
- else if (onSearch) return /* @__PURE__ */ jsx(Icon, {
68
- type: Search,
69
- className: "k-input-search-icon",
70
- role: "button",
71
- tabIndex: disabled || readOnly ? void 0 : 0,
72
- "aria-label": "Search",
73
- onClick: () => !disabled && !readOnly && onSearch(currentValue),
74
- onKeyDown: (event_0) => {
75
- if (event_0.key === "Enter" || event_0.key === " ") {
76
- event_0.preventDefault();
77
- if (!disabled && !readOnly) onSearch(currentValue);
78
- }
79
- }
80
- });
81
- return hasSuffix ? /* @__PURE__ */ jsx("div", {
82
- className: `k-${inputType}-suffix`,
83
- children: suffix
84
- }) : null;
85
- };
86
- const clearableShow = clearable && !isEmpty(currentValue) && type !== "password" && !disabled && !readOnly;
87
- const multiple = (!!icon || !!onSearch || hasSuffix || hasPrefix || addonBefore !== void 0 || addonAfter !== void 0 || type === "password" || clearable || !!controls) && type !== "hidden";
88
- const handleInputChange = (e) => {
89
- const v = e.target.value;
90
- setInnerValue(v);
91
- onChange?.(v);
92
- };
93
- const handleInputFocus = (e_0) => {
94
- setFocused(true);
95
- onFocus?.(e_0);
96
- };
97
- const handleInputBlur = (e_1) => {
98
- setFocused(false);
99
- onBlur?.(e_1);
100
- };
101
- const inputBoxProps = {
102
- ...rest,
103
- disabled,
104
- readOnly,
105
- multiple,
106
- type,
107
- size,
108
- theme,
109
- shape,
110
- inputRef,
111
- inputType,
112
- value: currentValue,
113
- showPassword,
114
- onChange: handleInputChange,
115
- onInput,
116
- onFocus: handleInputFocus,
117
- onBlur: handleInputBlur,
118
- className: !multiple ? className : void 0,
119
- style: !multiple ? style : void 0
120
- };
121
- if (typeof currentSize === "string") inputBoxProps.size = currentSize;
122
- const textInput = /* @__PURE__ */ jsx(InputBox, { ...inputBoxProps });
123
- if (!multiple) return textInput;
124
- const rootClasses = clsx(`k-${inputType}`, {
125
- [`k-${inputType}-focus`]: focused,
126
- [`k-${inputType}-disabled`]: disabled,
127
- [`k-${inputType}-readonly`]: readOnly,
128
- [`k-${inputType}-has-clear`]: clearableShow,
129
- [`k-${inputType}-sm`]: currentSize === "small",
130
- [`k-${inputType}-lg`]: currentSize === "large",
131
- [`k-${inputType}-${theme}`]: theme && theme !== "outline",
132
- [`k-${inputType}-circle`]: shape === "circle",
133
- [`k-${inputType}-square`]: shape === "square"
134
- }, !useGroup && className);
135
- const innerChildren = [];
136
- if (icon) innerChildren.push(/* @__PURE__ */ jsx(Icon, {
137
- type: icon,
138
- className: `k-${inputType}-icon`,
139
- role: onIconClick ? "button" : void 0,
140
- tabIndex: onIconClick && !disabled && !readOnly ? 0 : void 0,
141
- onClick: (e_2) => !disabled && !readOnly && onIconClick?.(e_2),
142
- onKeyDown: (event_1) => {
143
- if (event_1.key === "Enter" || event_1.key === " ") {
144
- event_1.preventDefault();
145
- event_1.currentTarget.click();
146
- }
147
- }
148
- }, "input-icon"));
149
- if (hasPrefix) innerChildren.push(/* @__PURE__ */ jsx("div", {
150
- className: `k-${inputType}-prefix`,
151
- children: prefix
152
- }, "input-prefix"));
153
- innerChildren.push(React.cloneElement(textInput, { key: "input-box" }));
154
- if (clearable) innerChildren.push(/* @__PURE__ */ jsx(Icon, {
155
- type: CircleX,
156
- className: clsx(`k-${inputType}-clearable`, { [`k-${inputType}-clearable-hidden`]: !clearableShow }),
157
- role: "button",
158
- tabIndex: clearableShow ? 0 : void 0,
159
- "aria-label": "Clear",
160
- onPointerDown: (event_2) => event_2.preventDefault(),
161
- onClick: handleClear,
162
- onKeyDown: (event_3) => {
163
- if (event_3.key === "Enter" || event_3.key === " ") {
164
- event_3.preventDefault();
165
- handleClear();
166
- }
167
- }
168
- }, "input-clear"));
169
- const suffixNode = getSuffix();
170
- if (suffixNode) innerChildren.push(/* @__PURE__ */ jsx(React.Fragment, { children: suffixNode }, "input-suffix-node"));
171
- if (controls) innerChildren.push(/* @__PURE__ */ jsx(React.Fragment, { children: controls }, "input-controls"));
172
- if (useGroup) return /* @__PURE__ */ jsxs(InputGroup, {
173
- size: currentSize,
174
- theme,
175
- className,
176
- style,
177
- children: [
178
- addonBefore !== void 0 ? /* @__PURE__ */ jsx("div", {
179
- className: "k-input-group-prefix",
180
- children: addonBefore
181
- }) : null,
182
- /* @__PURE__ */ jsx("div", {
183
- className: rootClasses,
184
- "data-multiple": "",
185
- children: innerChildren
186
- }),
187
- addonAfter !== void 0 ? /* @__PURE__ */ jsx("div", {
188
- className: "k-input-group-suffix",
189
- children: addonAfter
190
- }) : null
191
- ]
192
- });
193
- return /* @__PURE__ */ jsx("div", {
194
- className: rootClasses,
195
- style,
196
- "data-multiple": "",
197
- children: innerChildren
198
- });
25
+ $[0] = props;
26
+ $[1] = ref;
27
+ $[2] = t0;
28
+ } else t0 = $[2];
29
+ return t0;
199
30
  });
200
31
  Input.displayName = "Input";
201
32
  var input_default = createFormFieldComponent(Input);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -13,7 +13,7 @@ import { useValue } from "../utils/use-value.js";
13
13
  import { SizeContext } from "../config/size-context.js";
14
14
  import { createFormFieldComponent } from "../form/field-context.js";
15
15
  import { isValidBig, normalize } from "../utils/number.js";
16
- import input_default from "../input/input.js";
16
+ import InputBase from "../input/input-base.js";
17
17
  import { useContext, useState } from "react";
18
18
  import { jsx, jsxs } from "react/jsx-runtime";
19
19
  import Big from "big.js";
@@ -122,8 +122,9 @@ var InputNumber = ({ value, min = -Infinity, max = Infinity, step = 1, precision
122
122
  children: /* @__PURE__ */ jsx(Icon, { type: ChevronDown })
123
123
  })]
124
124
  }) : void 0;
125
- return /* @__PURE__ */ jsx(input_default, {
125
+ return /* @__PURE__ */ jsx(InputBase, {
126
126
  ...rest,
127
+ stylePrefix: "input-number",
127
128
  value: displayValue,
128
129
  disabled,
129
130
  readOnly,
@@ -135,7 +136,6 @@ var InputNumber = ({ value, min = -Infinity, max = Infinity, step = 1, precision
135
136
  icon,
136
137
  shape,
137
138
  theme,
138
- inputType: "input-number",
139
139
  role: "spinbutton",
140
140
  inputMode: "decimal",
141
141
  "aria-valuemin": min === -Infinity ? void 0 : min,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/de.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/el.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/en.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/fr.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/it.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/ja.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/ko.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/ru.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/th.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/uk.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
package/es/locale/vi.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * react-kui v3.1.0
2
+ * react-kui v3.1.2
3
3
  * Copyright 2017-present, kui-react.
4
4
  * All rights reserved.
5
5
  * Homepage: https://react.k-ui.cn