@tiny-design/react 1.0.11 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/es/auto-complete/index.js +9 -0
  2. package/es/auto-complete/index.js.map +1 -0
  3. package/es/date-picker/style/_index.scss +0 -1
  4. package/es/date-picker/style/index.css +0 -1
  5. package/es/index.d.ts +2 -1
  6. package/es/index.js +3 -2
  7. package/es/input-otp/index.d.ts +1 -0
  8. package/es/input-otp/index.js +9 -0
  9. package/es/input-otp/index.js.map +1 -0
  10. package/es/input-otp/input-otp.d.ts +13 -0
  11. package/es/input-otp/input-otp.js +128 -0
  12. package/es/input-otp/input-otp.js.map +1 -0
  13. package/es/input-otp/otp-input.js +60 -0
  14. package/es/input-otp/otp-input.js.map +1 -0
  15. package/es/input-otp/style/_index.scss +53 -0
  16. package/es/input-otp/style/index.css +71 -0
  17. package/es/input-otp/style/index.d.ts +1 -0
  18. package/es/input-otp/style/index.js +1 -0
  19. package/es/input-otp/types.d.ts +31 -0
  20. package/es/loader/style/_index.scss +3 -3
  21. package/es/loader/style/index.css +1 -3
  22. package/es/style/_component.scss +2 -1
  23. package/es/time-picker/style/_index.scss +0 -1
  24. package/es/time-picker/style/index.css +0 -1
  25. package/lib/auto-complete/index.js +8 -0
  26. package/lib/auto-complete/index.js.map +1 -0
  27. package/lib/date-picker/style/_index.scss +0 -1
  28. package/lib/date-picker/style/index.css +0 -1
  29. package/lib/index.d.ts +2 -1
  30. package/lib/index.js +152 -150
  31. package/lib/input-otp/index.js +8 -0
  32. package/lib/input-otp/index.js.map +1 -0
  33. package/lib/input-otp/input-otp.d.ts +13 -0
  34. package/lib/input-otp/input-otp.js +131 -0
  35. package/lib/input-otp/input-otp.js.map +1 -0
  36. package/lib/input-otp/otp-input.js +63 -0
  37. package/lib/input-otp/otp-input.js.map +1 -0
  38. package/lib/input-otp/style/_index.scss +53 -0
  39. package/lib/input-otp/style/index.css +71 -0
  40. package/lib/input-otp/style/index.d.ts +1 -0
  41. package/lib/input-otp/style/index.js +1 -0
  42. package/lib/input-otp/types.d.ts +31 -0
  43. package/lib/loader/style/_index.scss +3 -3
  44. package/lib/loader/style/index.css +1 -3
  45. package/lib/style/_component.scss +2 -1
  46. package/lib/time-picker/style/_index.scss +0 -1
  47. package/lib/time-picker/style/index.css +0 -1
  48. package/package.json +3 -3
@@ -0,0 +1,9 @@
1
+ import '../style/base.css';
2
+ import './style/index.css';
3
+ import AutoComplete from "./auto-complete.js";
4
+ //#region src/auto-complete/index.tsx
5
+ var auto_complete_default = AutoComplete;
6
+ //#endregion
7
+ export { auto_complete_default as default };
8
+
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/auto-complete/index.tsx"],"sourcesContent":["import AutoComplete from './auto-complete';\n\nexport default AutoComplete;\nexport type { AutoCompleteProps, AutoCompleteOption } from './types';\n"],"mappings":";;AAEA,IAAA,wBAAe"}
@@ -5,7 +5,6 @@ $dp: #{$prefix}-date-picker;
5
5
  .#{$dp} {
6
6
  display: inline-flex;
7
7
  position: relative;
8
- font-family: $font-family;
9
8
  font-size: $font-size-base;
10
9
 
11
10
  // ---- Input ----
@@ -1,7 +1,6 @@
1
1
  .ty-date-picker {
2
2
  display: inline-flex;
3
3
  position: relative;
4
- font-family: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
5
4
  font-size: 1rem;
6
5
  }
7
6
  .ty-date-picker__input {
package/es/index.d.ts CHANGED
@@ -31,6 +31,7 @@ import { DefaultForm } from "./form/index.js";
31
31
  import { Image } from "./image/image.js";
32
32
  import { DefaultInput } from "./input/index.js";
33
33
  import { InputNumber } from "./input-number/input-number.js";
34
+ import { InputOTP } from "./input-otp/input-otp.js";
34
35
  import { InputPassword } from "./input-password/input-password.js";
35
36
  import { IntlProvider } from "./intl-provider/intl-provider.js";
36
37
  import { Keyboard } from "./keyboard/keyboard.js";
@@ -85,4 +86,4 @@ import { en_US } from "./locale/en_US.js";
85
86
  import { zh_CN } from "./locale/zh_CN.js";
86
87
  import { useLocale } from "./_utils/use-locale.js";
87
88
  import { ThemeMode, useTheme } from "./_utils/use-theme.js";
88
- export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
89
+ export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputOTP, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
package/es/index.js CHANGED
@@ -4,7 +4,7 @@ import alert_default from "./alert/index.js";
4
4
  import sticky_default from "./sticky/index.js";
5
5
  import DefaultAnchor from "./anchor/index.js";
6
6
  import aspect_ratio_default from "./aspect-ratio/index.js";
7
- import AutoComplete from "./auto-complete/auto-complete.js";
7
+ import auto_complete_default from "./auto-complete/index.js";
8
8
  import DefaultAvatar from "./avatar/index.js";
9
9
  import back_top_default from "./back-top/index.js";
10
10
  import badge_default from "./badge/index.js";
@@ -37,6 +37,7 @@ import DefaultForm from "./form/index.js";
37
37
  import image_default from "./image/index.js";
38
38
  import DefaultInput from "./input/index.js";
39
39
  import input_number_default from "./input-number/index.js";
40
+ import input_otp_default from "./input-otp/index.js";
40
41
  import input_password_default from "./input-password/index.js";
41
42
  import keyboard_default from "./keyboard/index.js";
42
43
  import DefaultLayout from "./layout/index.js";
@@ -85,4 +86,4 @@ import { withLocale } from "./intl-provider/with-locale.js";
85
86
  import { withSpin } from "./with-spin/with-spin.js";
86
87
  import zh_CN from "./locale/zh_CN.js";
87
88
  import { useTheme } from "./_utils/use-theme.js";
88
- export { alert_default as Alert, DefaultAnchor as Anchor, aspect_ratio_default as AspectRatio, AutoComplete, DefaultAvatar as Avatar, back_top_default as BackTop, badge_default as Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, calendar_default as Calendar, DefaultCard as Card, DefaultCarousel as Carousel, cascader_default as Cascader, DefaultCheckbox as Checkbox, col_default as Col, DefaultCollapse as Collapse, color_picker_default as ColorPicker, config_provider_default as ConfigProvider, copy_to_clipboard_default as CopyToClipboard, countdown_default as Countdown, date_picker_default as DatePicker, DefaultDesc as Descriptions, divider_default as Divider, drawer_default as Drawer, dropdown_default as Dropdown, empty_default as Empty, flex_default as Flex, DefaultFlip as Flip, DefaultForm as Form, image_default as Image, DefaultInput as Input, input_number_default as InputNumber, input_password_default as InputPassword, intl_provider_default as IntlProvider, keyboard_default as Keyboard, DefaultLayout as Layout, link_default as Link, DefaultList as List, loader_default as Loader, loading_bar_default as LoadingBar, DefaultMenu as Menu, message_default as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notification_default as Notification, overlay_default as Overlay, pagination_default as Pagination, pop_confirm_default as PopConfirm, popover_default as Popover, Progress, DefaultRadio as Radio, rate_default as Rate, result_default as Result, row_default as Row, scroll_indicator_default as ScrollIndicator, segmented_default as Segmented, DefaultSelect$1 as Select, skeleton_default as Skeleton, slider_default as Slider, space_default as Space, DefaultSpeedDial as SpeedDial, split_default as Split, split_button_default as SplitButton, statistic_default as Statistic, DefaultSteps as Steps, sticky_default as Sticky, strength_indicator_default as StrengthIndicator, switch_default as Switch, table_default as Table, DefaultTabs as Tabs, DefaultTag as Tag, textarea_default as Textarea, time_picker_default as TimePicker, DefaultTimeline as Timeline, tooltip_default as Tooltip, transfer_default as Transfer, transition_default as Transition, tree_default as Tree, DefaultTypo as Typography, upload_default as Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
89
+ export { alert_default as Alert, DefaultAnchor as Anchor, aspect_ratio_default as AspectRatio, auto_complete_default as AutoComplete, DefaultAvatar as Avatar, back_top_default as BackTop, badge_default as Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, calendar_default as Calendar, DefaultCard as Card, DefaultCarousel as Carousel, cascader_default as Cascader, DefaultCheckbox as Checkbox, col_default as Col, DefaultCollapse as Collapse, color_picker_default as ColorPicker, config_provider_default as ConfigProvider, copy_to_clipboard_default as CopyToClipboard, countdown_default as Countdown, date_picker_default as DatePicker, DefaultDesc as Descriptions, divider_default as Divider, drawer_default as Drawer, dropdown_default as Dropdown, empty_default as Empty, flex_default as Flex, DefaultFlip as Flip, DefaultForm as Form, image_default as Image, DefaultInput as Input, input_number_default as InputNumber, input_otp_default as InputOTP, input_password_default as InputPassword, intl_provider_default as IntlProvider, keyboard_default as Keyboard, DefaultLayout as Layout, link_default as Link, DefaultList as List, loader_default as Loader, loading_bar_default as LoadingBar, DefaultMenu as Menu, message_default as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notification_default as Notification, overlay_default as Overlay, pagination_default as Pagination, pop_confirm_default as PopConfirm, popover_default as Popover, Progress, DefaultRadio as Radio, rate_default as Rate, result_default as Result, row_default as Row, scroll_indicator_default as ScrollIndicator, segmented_default as Segmented, DefaultSelect$1 as Select, skeleton_default as Skeleton, slider_default as Slider, space_default as Space, DefaultSpeedDial as SpeedDial, split_default as Split, split_button_default as SplitButton, statistic_default as Statistic, DefaultSteps as Steps, sticky_default as Sticky, strength_indicator_default as StrengthIndicator, switch_default as Switch, table_default as Table, DefaultTabs as Tabs, DefaultTag as Tag, textarea_default as Textarea, time_picker_default as TimePicker, DefaultTimeline as Timeline, tooltip_default as Tooltip, transfer_default as Transfer, transition_default as Transition, tree_default as Tree, DefaultTypo as Typography, upload_default as Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
@@ -0,0 +1 @@
1
+ import { InputOTP } from "./input-otp.js";
@@ -0,0 +1,9 @@
1
+ import '../style/base.css';
2
+ import './style/index.css';
3
+ import InputOTP from "./input-otp.js";
4
+ //#region src/input-otp/index.tsx
5
+ var input_otp_default = InputOTP;
6
+ //#endregion
7
+ export { input_otp_default as default };
8
+
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/input-otp/index.tsx"],"sourcesContent":["import InputOTP from './input-otp';\n\nexport default InputOTP;\n"],"mappings":";;AAEA,IAAA,oBAAe"}
@@ -0,0 +1,13 @@
1
+ import { InputOTPProps } from "./types.js";
2
+ import React from "react";
3
+
4
+ //#region src/input-otp/input-otp.d.ts
5
+ interface InputOTPRef {
6
+ focus: () => void;
7
+ blur: () => void;
8
+ nativeElement: HTMLDivElement | null;
9
+ }
10
+ declare const InputOTP: React.ForwardRefExoticComponent<InputOTPProps & React.RefAttributes<InputOTPRef>>;
11
+ //#endregion
12
+ export { InputOTP };
13
+ //# sourceMappingURL=input-otp.d.ts.map
@@ -0,0 +1,128 @@
1
+ import { ConfigContext } from "../config-provider/config-context.js";
2
+ import { getPrefixCls } from "../_utils/general.js";
3
+ import OTPInput from "./otp-input.js";
4
+ import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
5
+ import classNames from "classnames";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/input-otp/input-otp.tsx
8
+ function strToArr(str) {
9
+ return (str || "").split("");
10
+ }
11
+ const InputOTP = React.forwardRef((props, ref) => {
12
+ const { length = 6, size = "md", defaultValue, value, onChange, formatter, separator, disabled = false, mask, autoFocus, autoComplete, className, style, prefixCls: customisedCls, onFocus, ...otherProps } = props;
13
+ const configContext = useContext(ConfigContext);
14
+ const prefixCls = getPrefixCls("input-otp", configContext.prefixCls, customisedCls);
15
+ const inputSize = size || configContext.componentSize || "md";
16
+ const containerRef = useRef(null);
17
+ const inputsRef = useRef({});
18
+ const internalFormatter = useCallback((txt) => formatter ? formatter(txt) : txt, [formatter]);
19
+ const [valueCells, setValueCells] = useState(() => strToArr(internalFormatter(defaultValue || "")));
20
+ useEffect(() => {
21
+ if (value !== void 0) setValueCells(strToArr(value));
22
+ }, [value]);
23
+ React.useImperativeHandle(ref, () => ({
24
+ focus: () => {
25
+ let nextIndex = 0;
26
+ for (let i = 0; i < length; i += 1) {
27
+ if (!inputsRef.current[i]?.value) {
28
+ nextIndex = i;
29
+ break;
30
+ }
31
+ nextIndex = i;
32
+ }
33
+ inputsRef.current[nextIndex]?.focus();
34
+ },
35
+ blur: () => {
36
+ for (let i = 0; i < length; i += 1) inputsRef.current[i]?.blur();
37
+ },
38
+ nativeElement: containerRef.current
39
+ }));
40
+ const triggerValueCellsChange = useCallback((nextValueCells) => {
41
+ setValueCells((prev) => {
42
+ const prevValue = prev.join("");
43
+ const nextValue = nextValueCells.join("");
44
+ if (onChange && prevValue !== nextValue) onChange(nextValue);
45
+ return nextValueCells;
46
+ });
47
+ }, [onChange]);
48
+ const patchValue = useCallback((index, txt) => {
49
+ let nextCells = [...valueCells];
50
+ for (let i = 0; i < index; i += 1) if (!nextCells[i]) nextCells[i] = "";
51
+ if (txt.length <= 1) nextCells[index] = txt;
52
+ else nextCells = nextCells.slice(0, index).concat(strToArr(txt));
53
+ nextCells = nextCells.slice(0, length);
54
+ for (let i = nextCells.length - 1; i >= 0; i -= 1) {
55
+ if (nextCells[i]) break;
56
+ nextCells.pop();
57
+ }
58
+ nextCells = strToArr(internalFormatter(nextCells.map((c) => c || " ").join(""))).map((c, i) => {
59
+ if (c === " " && !nextCells[i]) return nextCells[i];
60
+ return c;
61
+ });
62
+ return nextCells;
63
+ }, [
64
+ valueCells,
65
+ length,
66
+ internalFormatter
67
+ ]);
68
+ const onInputChange = useCallback((index, txt) => {
69
+ const nextCells = patchValue(index, txt);
70
+ const nextIndex = Math.min(index + txt.length, length - 1);
71
+ if (nextIndex !== index && nextCells[index] !== void 0) inputsRef.current[nextIndex]?.focus();
72
+ triggerValueCellsChange(nextCells);
73
+ }, [
74
+ patchValue,
75
+ length,
76
+ triggerValueCellsChange
77
+ ]);
78
+ const onInputActiveChange = useCallback((nextIndex) => {
79
+ const clampedIndex = Math.max(0, Math.min(nextIndex, length - 1));
80
+ inputsRef.current[clampedIndex]?.focus();
81
+ }, [length]);
82
+ const onInputFocus = useCallback((event, index) => {
83
+ if (onFocus) onFocus(event);
84
+ }, [onFocus]);
85
+ const renderSeparator = useMemo(() => {
86
+ if (!separator) return null;
87
+ return (index) => {
88
+ const separatorNode = typeof separator === "function" ? separator(index) : separator;
89
+ if (!separatorNode) return null;
90
+ return /* @__PURE__ */ jsx("span", {
91
+ className: `${prefixCls}__separator`,
92
+ children: separatorNode
93
+ });
94
+ };
95
+ }, [separator, prefixCls]);
96
+ const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, { [`${prefixCls}_disabled`]: disabled });
97
+ return /* @__PURE__ */ jsx("div", {
98
+ ...otherProps,
99
+ ref: containerRef,
100
+ className: cls,
101
+ style,
102
+ role: "group",
103
+ children: Array.from({ length }).map((_, index) => {
104
+ const singleValue = valueCells[index] || "";
105
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(OTPInput, {
106
+ ref: (el) => {
107
+ inputsRef.current[index] = el;
108
+ },
109
+ index,
110
+ size: inputSize,
111
+ prefixCls,
112
+ value: singleValue,
113
+ disabled,
114
+ mask,
115
+ autoFocus: index === 0 && autoFocus,
116
+ autoComplete,
117
+ onChange: onInputChange,
118
+ onActiveChange: onInputActiveChange,
119
+ onFocus: (e) => onInputFocus(e, index)
120
+ }), index < length - 1 && renderSeparator?.(index)] }, `otp-${index}`);
121
+ })
122
+ });
123
+ });
124
+ InputOTP.displayName = "InputOTP";
125
+ //#endregion
126
+ export { InputOTP as default };
127
+
128
+ //# sourceMappingURL=input-otp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-otp.js","names":[],"sources":["../../src/input-otp/input-otp.tsx"],"sourcesContent":["import React, { useRef, useState, useEffect, useContext, useCallback, useMemo } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { InputOTPProps } from './types';\nimport OTPInput from './otp-input';\n\nfunction strToArr(str: string): string[] {\n return (str || '').split('');\n}\n\nexport interface InputOTPRef {\n focus: () => void;\n blur: () => void;\n nativeElement: HTMLDivElement | null;\n}\n\nconst InputOTP = React.forwardRef<InputOTPRef, InputOTPProps>(\n (props, ref) => {\n const {\n length = 6,\n size = 'md',\n defaultValue,\n value,\n onChange,\n formatter,\n separator,\n disabled = false,\n mask,\n autoFocus,\n autoComplete,\n className,\n style,\n prefixCls: customisedCls,\n onFocus,\n ...otherProps\n } = props;\n\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('input-otp', configContext.prefixCls, customisedCls);\n const inputSize = size || configContext.componentSize || 'md';\n\n const containerRef = useRef<HTMLDivElement>(null);\n const inputsRef = useRef<Record<number, HTMLInputElement | null>>({});\n\n // Formatter helper\n const internalFormatter = useCallback(\n (txt: string) => (formatter ? formatter(txt) : txt),\n [formatter]\n );\n\n // Value state\n const [valueCells, setValueCells] = useState<string[]>(() =>\n strToArr(internalFormatter(defaultValue || ''))\n );\n\n useEffect(() => {\n if (value !== undefined) {\n setValueCells(strToArr(value));\n }\n }, [value]);\n\n // Imperative handle\n React.useImperativeHandle(ref, () => ({\n focus: () => {\n // Focus first empty cell (or last cell if all filled)\n let nextIndex = 0;\n for (let i = 0; i < length; i += 1) {\n if (!inputsRef.current[i]?.value) {\n nextIndex = i;\n break;\n }\n nextIndex = i;\n }\n inputsRef.current[nextIndex]?.focus();\n },\n blur: () => {\n for (let i = 0; i < length; i += 1) {\n inputsRef.current[i]?.blur();\n }\n },\n nativeElement: containerRef.current,\n }));\n\n // Trigger onChange when value cells change\n const triggerValueCellsChange = useCallback(\n (nextValueCells: string[]) => {\n setValueCells((prev) => {\n const prevValue = prev.join('');\n const nextValue = nextValueCells.join('');\n if (onChange && prevValue !== nextValue) {\n onChange(nextValue);\n }\n return nextValueCells;\n });\n },\n [onChange]\n );\n\n // Patch value at given index\n const patchValue = useCallback(\n (index: number, txt: string) => {\n let nextCells = [...valueCells];\n\n // Fill cells till index\n for (let i = 0; i < index; i += 1) {\n if (!nextCells[i]) {\n nextCells[i] = '';\n }\n }\n\n if (txt.length <= 1) {\n nextCells[index] = txt;\n } else {\n nextCells = nextCells.slice(0, index).concat(strToArr(txt));\n }\n nextCells = nextCells.slice(0, length);\n\n // Clean trailing empty cells\n for (let i = nextCells.length - 1; i >= 0; i -= 1) {\n if (nextCells[i]) {\n break;\n }\n nextCells.pop();\n }\n\n // Format if needed\n const formattedValue = internalFormatter(\n nextCells.map((c) => c || ' ').join('')\n );\n nextCells = strToArr(formattedValue).map((c, i) => {\n if (c === ' ' && !nextCells[i]) {\n return nextCells[i];\n }\n return c;\n });\n\n return nextCells;\n },\n [valueCells, length, internalFormatter]\n );\n\n // Handle input change\n const onInputChange = useCallback(\n (index: number, txt: string) => {\n const nextCells = patchValue(index, txt);\n const nextIndex = Math.min(index + txt.length, length - 1);\n if (nextIndex !== index && nextCells[index] !== undefined) {\n inputsRef.current[nextIndex]?.focus();\n }\n triggerValueCellsChange(nextCells);\n },\n [patchValue, length, triggerValueCellsChange]\n );\n\n // Handle active change (arrow keys, backspace)\n const onInputActiveChange = useCallback(\n (nextIndex: number) => {\n const clampedIndex = Math.max(0, Math.min(nextIndex, length - 1));\n inputsRef.current[clampedIndex]?.focus();\n },\n [length]\n );\n\n // Handle focus — keep focus on the interacted cell\n const onInputFocus = useCallback(\n (event: React.FocusEvent<HTMLInputElement>, index: number) => {\n if (onFocus) {\n (onFocus as React.FocusEventHandler<HTMLDivElement>)(event as unknown as React.FocusEvent<HTMLDivElement>);\n }\n },\n [onFocus]\n );\n\n // Render separator\n const renderSeparator = useMemo(() => {\n if (!separator) return null;\n return (index: number) => {\n const separatorNode =\n typeof separator === 'function' ? separator(index) : separator;\n if (!separatorNode) return null;\n return (\n <span className={`${prefixCls}__separator`}>\n {separatorNode}\n </span>\n );\n };\n }, [separator, prefixCls]);\n\n const cls = classNames(prefixCls, className, `${prefixCls}_${inputSize}`, {\n [`${prefixCls}_disabled`]: disabled,\n });\n\n return (\n <div\n {...otherProps}\n ref={containerRef}\n className={cls}\n style={style}\n role=\"group\"\n >\n {Array.from({ length }).map((_, index) => {\n const singleValue = valueCells[index] || '';\n return (\n <React.Fragment key={`otp-${index}`}>\n <OTPInput\n ref={(el) => {\n inputsRef.current[index] = el;\n }}\n index={index}\n size={inputSize}\n prefixCls={prefixCls}\n value={singleValue}\n disabled={disabled}\n mask={mask}\n autoFocus={index === 0 && autoFocus}\n autoComplete={autoComplete}\n onChange={onInputChange}\n onActiveChange={onInputActiveChange}\n onFocus={(e) => onInputFocus(e, index)}\n />\n {index < length - 1 && renderSeparator?.(index)}\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n);\n\nInputOTP.displayName = 'InputOTP';\n\nexport default InputOTP;\n"],"mappings":"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"}
@@ -0,0 +1,60 @@
1
+ import React, { useCallback, useRef } from "react";
2
+ import classNames from "classnames";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/input-otp/otp-input.tsx
5
+ const OTPInput = React.forwardRef((props, ref) => {
6
+ const { index, value, disabled, mask, size = "md", autoFocus, autoComplete, prefixCls, onChange, onActiveChange, onFocus } = props;
7
+ const inputRef = useRef(null);
8
+ const setRef = useCallback((el) => {
9
+ inputRef.current = el;
10
+ if (typeof ref === "function") ref(el);
11
+ else if (ref) ref.current = el;
12
+ }, [ref]);
13
+ const syncSelection = useCallback(() => {
14
+ requestAnimationFrame(() => {
15
+ const inputEle = inputRef.current;
16
+ if (document.activeElement === inputEle && inputEle) inputEle.select();
17
+ });
18
+ }, []);
19
+ const onInternalInput = (e) => {
20
+ onChange(index, e.target.value);
21
+ };
22
+ const onInternalFocus = (e) => {
23
+ onFocus?.(e);
24
+ syncSelection();
25
+ };
26
+ const onInternalKeyDown = (event) => {
27
+ const { key, ctrlKey, metaKey } = event;
28
+ if (key === "ArrowLeft") onActiveChange(index - 1);
29
+ else if (key === "ArrowRight") onActiveChange(index + 1);
30
+ else if (key === "z" && (ctrlKey || metaKey)) event.preventDefault();
31
+ else if (key === "Backspace" && !value) onActiveChange(index - 1);
32
+ syncSelection();
33
+ };
34
+ const displayValue = mask && typeof mask === "string" && value ? mask : value;
35
+ const inputType = mask === true ? "password" : "text";
36
+ return /* @__PURE__ */ jsx("input", {
37
+ ref: setRef,
38
+ "aria-label": `OTP Input ${index + 1}`,
39
+ type: inputType,
40
+ inputMode: "numeric",
41
+ autoComplete: autoComplete || "one-time-code",
42
+ className: classNames(`${prefixCls}__cell`, `${prefixCls}__cell_${size}`, {
43
+ [`${prefixCls}__cell_disabled`]: disabled,
44
+ [`${prefixCls}__cell_mask`]: mask
45
+ }),
46
+ value: displayValue,
47
+ disabled,
48
+ autoFocus,
49
+ onInput: onInternalInput,
50
+ onFocus: onInternalFocus,
51
+ onKeyDown: onInternalKeyDown,
52
+ onMouseDown: syncSelection,
53
+ onMouseUp: syncSelection
54
+ });
55
+ });
56
+ OTPInput.displayName = "OTPInput";
57
+ //#endregion
58
+ export { OTPInput as default };
59
+
60
+ //# sourceMappingURL=otp-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp-input.js","names":[],"sources":["../../src/input-otp/otp-input.tsx"],"sourcesContent":["import React, { useRef, useCallback } from 'react';\nimport classNames from 'classnames';\nimport { OTPInputCellProps } from './types';\n\nconst OTPInput = React.forwardRef<HTMLInputElement, OTPInputCellProps>(\n (props, ref) => {\n const {\n index,\n value,\n disabled,\n mask,\n size = 'md',\n autoFocus,\n autoComplete,\n prefixCls,\n onChange,\n onActiveChange,\n onFocus,\n } = props;\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n // Merge refs\n const setRef = useCallback(\n (el: HTMLInputElement | null) => {\n inputRef.current = el;\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLInputElement | null>).current = el;\n }\n },\n [ref]\n );\n\n const syncSelection = useCallback(() => {\n requestAnimationFrame(() => {\n const inputEle = inputRef.current;\n if (document.activeElement === inputEle && inputEle) {\n inputEle.select();\n }\n });\n }, []);\n\n const onInternalInput = (e: React.FormEvent<HTMLInputElement>): void => {\n onChange(index, (e.target as HTMLInputElement).value);\n };\n\n const onInternalFocus: React.FocusEventHandler<HTMLInputElement> = (e) => {\n onFocus?.(e);\n syncSelection();\n };\n\n const onInternalKeyDown: React.KeyboardEventHandler<HTMLInputElement> = (event) => {\n const { key, ctrlKey, metaKey } = event;\n\n if (key === 'ArrowLeft') {\n onActiveChange(index - 1);\n } else if (key === 'ArrowRight') {\n onActiveChange(index + 1);\n } else if (key === 'z' && (ctrlKey || metaKey)) {\n event.preventDefault();\n } else if (key === 'Backspace' && !value) {\n onActiveChange(index - 1);\n }\n\n syncSelection();\n };\n\n const displayValue = mask && typeof mask === 'string' && value ? mask : value;\n const inputType = mask === true ? 'password' : 'text';\n\n return (\n <input\n ref={setRef}\n aria-label={`OTP Input ${index + 1}`}\n type={inputType}\n inputMode=\"numeric\"\n autoComplete={autoComplete || 'one-time-code'}\n className={classNames(`${prefixCls}__cell`, `${prefixCls}__cell_${size}`, {\n [`${prefixCls}__cell_disabled`]: disabled,\n [`${prefixCls}__cell_mask`]: mask,\n })}\n value={displayValue}\n disabled={disabled}\n autoFocus={autoFocus}\n onInput={onInternalInput}\n onFocus={onInternalFocus}\n onKeyDown={onInternalKeyDown}\n onMouseDown={syncSelection}\n onMouseUp={syncSelection}\n />\n );\n }\n);\n\nOTPInput.displayName = 'OTPInput';\n\nexport default OTPInput;\n"],"mappings":";;;;AAIA,MAAM,WAAW,MAAM,YACpB,OAAO,QAAQ;CACd,MAAM,EACJ,OACA,OACA,UACA,MACA,OAAO,MACP,WACA,cACA,WACA,UACA,gBACA,YACE;CAEJ,MAAM,WAAW,OAAgC,KAAK;CAGtD,MAAM,SAAS,aACZ,OAAgC;AAC/B,WAAS,UAAU;AACnB,MAAI,OAAO,QAAQ,WACjB,KAAI,GAAG;WACE,IACR,KAAwD,UAAU;IAGvE,CAAC,IAAI,CACN;CAED,MAAM,gBAAgB,kBAAkB;AACtC,8BAA4B;GAC1B,MAAM,WAAW,SAAS;AAC1B,OAAI,SAAS,kBAAkB,YAAY,SACzC,UAAS,QAAQ;IAEnB;IACD,EAAE,CAAC;CAEN,MAAM,mBAAmB,MAA+C;AACtE,WAAS,OAAQ,EAAE,OAA4B,MAAM;;CAGvD,MAAM,mBAA8D,MAAM;AACxE,YAAU,EAAE;AACZ,iBAAe;;CAGjB,MAAM,qBAAmE,UAAU;EACjF,MAAM,EAAE,KAAK,SAAS,YAAY;AAElC,MAAI,QAAQ,YACV,gBAAe,QAAQ,EAAE;WAChB,QAAQ,aACjB,gBAAe,QAAQ,EAAE;WAChB,QAAQ,QAAQ,WAAW,SACpC,OAAM,gBAAgB;WACb,QAAQ,eAAe,CAAC,MACjC,gBAAe,QAAQ,EAAE;AAG3B,iBAAe;;CAGjB,MAAM,eAAe,QAAQ,OAAO,SAAS,YAAY,QAAQ,OAAO;CACxE,MAAM,YAAY,SAAS,OAAO,aAAa;AAE/C,QACE,oBAAC,SAAD;EACE,KAAK;EACL,cAAY,aAAa,QAAQ;EACjC,MAAM;EACN,WAAU;EACV,cAAc,gBAAgB;EAC9B,WAAW,WAAW,GAAG,UAAU,SAAS,GAAG,UAAU,SAAS,QAAQ;IACvE,GAAG,UAAU,mBAAmB;IAChC,GAAG,UAAU,eAAe;GAC9B,CAAC;EACF,OAAO;EACG;EACC;EACX,SAAS;EACT,SAAS;EACT,WAAW;EACX,aAAa;EACb,WAAW;EACX,CAAA;EAGP;AAED,SAAS,cAAc"}
@@ -0,0 +1,53 @@
1
+ @use '../../style/variables' as *;
2
+ @use '../../input/style/mixin' as *;
3
+
4
+ .#{$prefix}-input-otp {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: 8px;
8
+
9
+ &__cell {
10
+ @include input-default;
11
+
12
+ width: 36px;
13
+ height: 36px;
14
+ text-align: center;
15
+ padding: 0;
16
+ font-size: $input-md-font-size;
17
+ border-radius: $input-border-radius;
18
+ caret-color: currentcolor;
19
+
20
+ &_sm {
21
+ width: 28px;
22
+ height: 28px;
23
+ font-size: $input-sm-font-size;
24
+ }
25
+
26
+ &_md {
27
+ width: 36px;
28
+ height: 36px;
29
+ font-size: $input-md-font-size;
30
+ }
31
+
32
+ &_lg {
33
+ width: 44px;
34
+ height: 44px;
35
+ font-size: $input-lg-font-size;
36
+ }
37
+
38
+ &_disabled {
39
+ @include input-default-disabled;
40
+ }
41
+ }
42
+
43
+ &__separator {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ color: var(--ty-color-text-secondary);
47
+ font-size: $font-size-base;
48
+ }
49
+
50
+ &_disabled {
51
+ cursor: not-allowed;
52
+ }
53
+ }
@@ -0,0 +1,71 @@
1
+ .ty-input-otp {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ }
6
+ .ty-input-otp__cell {
7
+ box-sizing: border-box;
8
+ width: 100%;
9
+ margin: 0;
10
+ color: var(--ty-color-text);
11
+ border: 1px solid var(--ty-input-border);
12
+ transition: all 0.3s;
13
+ outline: 0;
14
+ border-radius: 2px;
15
+ font-size: 1rem;
16
+ background-color: var(--ty-input-bg);
17
+ }
18
+ .ty-input-otp__cell:hover {
19
+ border-color: var(--ty-color-primary);
20
+ }
21
+ .ty-input-otp__cell:focus {
22
+ border-color: var(--ty-input-focus-border);
23
+ box-shadow: var(--ty-input-focus-shadow);
24
+ }
25
+ .ty-input-otp__cell::-moz-placeholder {
26
+ color: var(--ty-color-text-placeholder);
27
+ }
28
+ .ty-input-otp__cell::placeholder {
29
+ color: var(--ty-color-text-placeholder);
30
+ }
31
+ .ty-input-otp__cell {
32
+ width: 36px;
33
+ height: 36px;
34
+ text-align: center;
35
+ padding: 0;
36
+ font-size: 1rem;
37
+ border-radius: 2px;
38
+ caret-color: currentcolor;
39
+ }
40
+ .ty-input-otp__cell_sm {
41
+ width: 28px;
42
+ height: 28px;
43
+ font-size: 0.875rem;
44
+ }
45
+ .ty-input-otp__cell_md {
46
+ width: 36px;
47
+ height: 36px;
48
+ font-size: 1rem;
49
+ }
50
+ .ty-input-otp__cell_lg {
51
+ width: 44px;
52
+ height: 44px;
53
+ font-size: 1.25rem;
54
+ }
55
+ .ty-input-otp__cell_disabled {
56
+ cursor: not-allowed;
57
+ background-color: var(--ty-input-disabled-bg);
58
+ color: var(--ty-input-disabled-color);
59
+ }
60
+ .ty-input-otp__cell_disabled:hover {
61
+ border-color: var(--ty-input-border);
62
+ }
63
+ .ty-input-otp__separator {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ color: var(--ty-color-text-secondary);
67
+ font-size: 1rem;
68
+ }
69
+ .ty-input-otp_disabled {
70
+ cursor: not-allowed;
71
+ }
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ import "./index.css";
@@ -0,0 +1,31 @@
1
+ import { BaseProps, SizeType } from "../_utils/props.js";
2
+ import React from "react";
3
+
4
+ //#region src/input-otp/types.d.ts
5
+ interface InputOTPProps extends BaseProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onInput'> {
6
+ /** Number of OTP input cells */
7
+ length?: number;
8
+ /** Size of the input */
9
+ size?: SizeType;
10
+ /** Default value of the OTP input */
11
+ defaultValue?: string;
12
+ /** Controlled value of the OTP input */
13
+ value?: string;
14
+ /** Callback when all cells are filled */
15
+ onChange?: (value: string) => void;
16
+ /** Custom formatter to restrict/modify input */
17
+ formatter?: (value: string) => string;
18
+ /** Separator element between cells */
19
+ separator?: ((index: number) => React.ReactNode) | React.ReactNode;
20
+ /** Whether the input is disabled */
21
+ disabled?: boolean;
22
+ /** Whether to mask the values, or a custom mask character */
23
+ mask?: boolean | string;
24
+ /** Auto focus the first cell on mount */
25
+ autoFocus?: boolean;
26
+ /** Autocomplete attribute */
27
+ autoComplete?: string;
28
+ }
29
+ //#endregion
30
+ export { InputOTPProps };
31
+ //# sourceMappingURL=types.d.ts.map
@@ -2,7 +2,6 @@
2
2
  @use '../../style/mixins' as *;
3
3
 
4
4
  .#{$prefix}-loader {
5
- font-family: $font-family;
6
5
  position: relative;
7
6
  display: inline-block;
8
7
  color: var(--ty-color-primary);
@@ -21,7 +20,7 @@
21
20
  position: absolute;
22
21
  display: block;
23
22
  transform: scale(0.75);
24
- background-color: currentColor;
23
+ background-color: currentcolor;
25
24
  border-radius: 50%;
26
25
  transform-origin: 50% 50%;
27
26
  opacity: 0.5;
@@ -53,7 +52,6 @@
53
52
 
54
53
  &__label {
55
54
  margin: 5px 0;
56
- font-family: $font-family;
57
55
  user-select: none;
58
56
  opacity: 0.8;
59
57
  font-size: 16px;
@@ -133,9 +131,11 @@
133
131
  0% {
134
132
  opacity: 0.2;
135
133
  }
134
+
136
135
  50% {
137
136
  opacity: 0.9;
138
137
  }
138
+
139
139
  100% {
140
140
  opacity: 0.2;
141
141
  }
@@ -25,7 +25,6 @@
25
25
  }
26
26
  }
27
27
  .ty-loader {
28
- font-family: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
29
28
  position: relative;
30
29
  display: inline-block;
31
30
  color: var(--ty-color-primary);
@@ -43,7 +42,7 @@
43
42
  position: absolute;
44
43
  display: block;
45
44
  transform: scale(0.75);
46
- background-color: currentColor;
45
+ background-color: currentcolor;
47
46
  border-radius: 50%;
48
47
  transform-origin: 50% 50%;
49
48
  opacity: 0.5;
@@ -70,7 +69,6 @@
70
69
  }
71
70
  .ty-loader__label {
72
71
  margin: 5px 0;
73
- font-family: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
74
72
  -webkit-user-select: none;
75
73
  -moz-user-select: none;
76
74
  user-select: none;
@@ -28,6 +28,7 @@
28
28
  @use "../image/style/index" as *;
29
29
  @use "../input/style/index" as *;
30
30
  @use "../input-number/style/index" as *;
31
+ @use "../input-otp/style/index" as *;
31
32
  @use "../input-password/style/index" as *;
32
33
  @use "../layout/style/index" as *;
33
34
  @use "../link/style/index" as *;
@@ -75,4 +76,4 @@
75
76
  @use "../tree/style/index" as *;
76
77
  @use "../typography/style/index" as *;
77
78
  @use "../upload/style/index" as *;
78
- @use "../with-spin/style/index" as *;
79
+ @use "../with-spin/style/index" as *;
@@ -6,7 +6,6 @@ $tp: #{$prefix}-time-picker;
6
6
  display: inline-flex;
7
7
  position: relative;
8
8
  font-size: $font-size-base;
9
- font-family: $font-family;
10
9
 
11
10
  // ---- Input ----
12
11
  &__input {
@@ -2,7 +2,6 @@
2
2
  display: inline-flex;
3
3
  position: relative;
4
4
  font-size: 1rem;
5
- font-family: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
6
5
  }
7
6
  .ty-time-picker__input {
8
7
  display: inline-flex;
@@ -0,0 +1,8 @@
1
+ require('../style/base.css');
2
+ require('./style/index.css');
3
+ //#region src/auto-complete/index.tsx
4
+ var auto_complete_default = require("./auto-complete.js").default;
5
+ //#endregion
6
+ exports.default = auto_complete_default;
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["AutoComplete"],"sources":["../../src/auto-complete/index.tsx"],"sourcesContent":["import AutoComplete from './auto-complete';\n\nexport default AutoComplete;\nexport type { AutoCompleteProps, AutoCompleteOption } from './types';\n"],"mappings":";AAEA,IAAA,sDAAeA"}
@@ -5,7 +5,6 @@ $dp: #{$prefix}-date-picker;
5
5
  .#{$dp} {
6
6
  display: inline-flex;
7
7
  position: relative;
8
- font-family: $font-family;
9
8
  font-size: $font-size-base;
10
9
 
11
10
  // ---- Input ----
@@ -1,7 +1,6 @@
1
1
  .ty-date-picker {
2
2
  display: inline-flex;
3
3
  position: relative;
4
- font-family: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
5
4
  font-size: 1rem;
6
5
  }
7
6
  .ty-date-picker__input {
package/lib/index.d.ts CHANGED
@@ -31,6 +31,7 @@ import { DefaultForm } from "./form/index.js";
31
31
  import { Image } from "./image/image.js";
32
32
  import { DefaultInput } from "./input/index.js";
33
33
  import { InputNumber } from "./input-number/input-number.js";
34
+ import { InputOTP } from "./input-otp/input-otp.js";
34
35
  import { InputPassword } from "./input-password/input-password.js";
35
36
  import { IntlProvider } from "./intl-provider/intl-provider.js";
36
37
  import { Keyboard } from "./keyboard/keyboard.js";
@@ -85,4 +86,4 @@ import { en_US } from "./locale/en_US.js";
85
86
  import { zh_CN } from "./locale/zh_CN.js";
86
87
  import { useLocale } from "./_utils/use-locale.js";
87
88
  import { ThemeMode, useTheme } from "./_utils/use-theme.js";
88
- export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
89
+ export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputOTP, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };