@expcat/tigercat-react 0.1.0 → 0.1.8
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/dist/chunk-6ZTCBQJ7.mjs +117 -0
- package/dist/{chunk-FAKTU64M.js → chunk-A3DJSVTE.js} +2 -1
- package/dist/{chunk-W7HUFFPJ.mjs → chunk-BIWO5KB4.mjs} +18 -18
- package/dist/{chunk-7KRBDT2Z.mjs → chunk-BJU5N7WU.mjs} +1 -1
- package/dist/chunk-CIL2AC3F.js +119 -0
- package/dist/{chunk-EUHWE7MN.js → chunk-KSW5JDIV.js} +18 -18
- package/dist/{chunk-AG6GVQ5O.js → chunk-Q5Q7FG4U.js} +3 -3
- package/dist/{chunk-KMQOLVWP.mjs → chunk-STEIWBMF.mjs} +2 -1
- package/dist/components/Button.d.mts +1 -0
- package/dist/components/Button.d.ts +1 -0
- package/dist/components/Button.js +2 -2
- package/dist/components/Button.mjs +1 -1
- package/dist/components/Input.d.mts +18 -2
- package/dist/components/Input.d.ts +18 -2
- package/dist/components/Input.js +2 -2
- package/dist/components/Input.mjs +1 -1
- package/dist/components/List.js +3 -3
- package/dist/components/List.mjs +2 -2
- package/dist/components/Message.d.mts +2 -2
- package/dist/components/Message.d.ts +2 -2
- package/dist/components/Message.js +7 -7
- package/dist/components/Message.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -11
- package/dist/index.mjs +4 -4
- package/package.json +2 -2
- package/dist/chunk-QL6OBKEN.js +0 -84
- package/dist/chunk-QN7NIX7D.mjs +0 -82
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { injectShakeStyle, getInputClasses, classNames, getInputAffixClasses, getInputErrorClasses, getInputWrapperClasses, SHAKE_CLASS } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/Input.tsx
|
|
6
|
+
var Input = ({
|
|
7
|
+
size = "md",
|
|
8
|
+
type = "text",
|
|
9
|
+
status = "default",
|
|
10
|
+
errorMessage,
|
|
11
|
+
prefix,
|
|
12
|
+
suffix,
|
|
13
|
+
value,
|
|
14
|
+
defaultValue,
|
|
15
|
+
placeholder = "",
|
|
16
|
+
disabled = false,
|
|
17
|
+
readonly = false,
|
|
18
|
+
required = false,
|
|
19
|
+
maxLength,
|
|
20
|
+
minLength,
|
|
21
|
+
name,
|
|
22
|
+
id,
|
|
23
|
+
autoComplete,
|
|
24
|
+
autoFocus = false,
|
|
25
|
+
onInput,
|
|
26
|
+
onChange,
|
|
27
|
+
onFocus,
|
|
28
|
+
onBlur,
|
|
29
|
+
className,
|
|
30
|
+
style,
|
|
31
|
+
...props
|
|
32
|
+
}) => {
|
|
33
|
+
injectShakeStyle();
|
|
34
|
+
const [isShaking, setIsShaking] = useState(false);
|
|
35
|
+
const inputRef = useRef(null);
|
|
36
|
+
const [internalValue, setInternalValue] = useState(defaultValue ?? "");
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (status === "error") {
|
|
39
|
+
setIsShaking(true);
|
|
40
|
+
}
|
|
41
|
+
}, [status]);
|
|
42
|
+
const handleAnimationEnd = () => {
|
|
43
|
+
setIsShaking(false);
|
|
44
|
+
};
|
|
45
|
+
const isControlled = value !== void 0;
|
|
46
|
+
const inputValue = isControlled ? value : internalValue;
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (autoFocus && inputRef.current) {
|
|
49
|
+
inputRef.current.focus();
|
|
50
|
+
}
|
|
51
|
+
}, [autoFocus]);
|
|
52
|
+
const getNextValue = (target) => {
|
|
53
|
+
if (type === "number") {
|
|
54
|
+
return Number.isNaN(target.valueAsNumber) ? target.value : target.valueAsNumber;
|
|
55
|
+
}
|
|
56
|
+
return target.value;
|
|
57
|
+
};
|
|
58
|
+
const handleInput = (event) => {
|
|
59
|
+
if (!isControlled) {
|
|
60
|
+
setInternalValue(getNextValue(event.currentTarget));
|
|
61
|
+
}
|
|
62
|
+
onInput?.(event);
|
|
63
|
+
};
|
|
64
|
+
const handleChange = (event) => {
|
|
65
|
+
if (!isControlled) {
|
|
66
|
+
setInternalValue(getNextValue(event.currentTarget));
|
|
67
|
+
}
|
|
68
|
+
onChange?.(event);
|
|
69
|
+
};
|
|
70
|
+
const hasPrefix = !!prefix;
|
|
71
|
+
const hasSuffix = !!suffix;
|
|
72
|
+
const activeError = status === "error" && !!errorMessage;
|
|
73
|
+
const inputClasses = getInputClasses({
|
|
74
|
+
size,
|
|
75
|
+
status,
|
|
76
|
+
hasPrefix,
|
|
77
|
+
hasSuffix
|
|
78
|
+
});
|
|
79
|
+
return /* @__PURE__ */ jsxs(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: classNames(getInputWrapperClasses(), className, isShaking && SHAKE_CLASS),
|
|
83
|
+
style,
|
|
84
|
+
onAnimationEnd: handleAnimationEnd,
|
|
85
|
+
children: [
|
|
86
|
+
hasPrefix && /* @__PURE__ */ jsx("div", { className: getInputAffixClasses("prefix", size), children: prefix }),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
"input",
|
|
89
|
+
{
|
|
90
|
+
...props,
|
|
91
|
+
ref: inputRef,
|
|
92
|
+
className: inputClasses,
|
|
93
|
+
type,
|
|
94
|
+
value: inputValue,
|
|
95
|
+
placeholder,
|
|
96
|
+
disabled,
|
|
97
|
+
readOnly: readonly,
|
|
98
|
+
required,
|
|
99
|
+
maxLength,
|
|
100
|
+
minLength,
|
|
101
|
+
name,
|
|
102
|
+
id,
|
|
103
|
+
autoComplete,
|
|
104
|
+
autoFocus,
|
|
105
|
+
onInput: handleInput,
|
|
106
|
+
onChange: handleChange,
|
|
107
|
+
onFocus,
|
|
108
|
+
onBlur
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
activeError ? /* @__PURE__ */ jsx("div", { className: getInputErrorClasses(size), children: errorMessage }) : hasSuffix && /* @__PURE__ */ jsx("div", { className: getInputAffixClasses("suffix", size), children: suffix })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export { Input };
|
|
@@ -10,6 +10,7 @@ var Button = ({
|
|
|
10
10
|
size = "md",
|
|
11
11
|
disabled = false,
|
|
12
12
|
loading = false,
|
|
13
|
+
loadingIcon,
|
|
13
14
|
block = false,
|
|
14
15
|
onClick,
|
|
15
16
|
children,
|
|
@@ -42,7 +43,7 @@ var Button = ({
|
|
|
42
43
|
type,
|
|
43
44
|
...props,
|
|
44
45
|
children: [
|
|
45
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2", children: loadingIcon ? loadingIcon : /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
47
|
"svg",
|
|
47
48
|
{
|
|
48
49
|
className: "animate-spin h-4 w-4",
|
|
@@ -36,28 +36,28 @@ var Icon = ({ path, className, isLoading = false }) => {
|
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
|
-
var MessageItem = ({ message
|
|
39
|
+
var MessageItem = ({ message, onClose }) => {
|
|
40
40
|
const [isVisible, setIsVisible] = useState(false);
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
setTimeout(() => setIsVisible(true), 10);
|
|
43
43
|
}, []);
|
|
44
|
-
const colorScheme = getMessageTypeClasses(
|
|
44
|
+
const colorScheme = getMessageTypeClasses(message.type, defaultMessageThemeColors);
|
|
45
45
|
const messageClasses = classNames(
|
|
46
46
|
messageBaseClasses,
|
|
47
47
|
colorScheme.bg,
|
|
48
48
|
colorScheme.border,
|
|
49
49
|
colorScheme.text,
|
|
50
|
-
|
|
50
|
+
message.className,
|
|
51
51
|
isVisible ? "opacity-100 translate-y-0" : "opacity-0 -translate-y-2"
|
|
52
52
|
);
|
|
53
|
-
const iconPath =
|
|
53
|
+
const iconPath = message.icon || getMessageIconPath(message.type);
|
|
54
54
|
const iconClass = classNames(messageIconClasses, colorScheme.icon);
|
|
55
55
|
const handleClose = useCallback(() => {
|
|
56
56
|
setIsVisible(false);
|
|
57
|
-
setTimeout(() => onClose(
|
|
58
|
-
}, [
|
|
59
|
-
const a11yRole =
|
|
60
|
-
const ariaLive =
|
|
57
|
+
setTimeout(() => onClose(message.id), 300);
|
|
58
|
+
}, [message.id, onClose]);
|
|
59
|
+
const a11yRole = message.type === "error" ? "alert" : "status";
|
|
60
|
+
const ariaLive = message.type === "error" ? "assertive" : "polite";
|
|
61
61
|
return /* @__PURE__ */ jsxs(
|
|
62
62
|
"div",
|
|
63
63
|
{
|
|
@@ -65,14 +65,14 @@ var MessageItem = ({ message: message2, onClose }) => {
|
|
|
65
65
|
role: a11yRole,
|
|
66
66
|
"aria-live": ariaLive,
|
|
67
67
|
"aria-atomic": "true",
|
|
68
|
-
"aria-busy":
|
|
68
|
+
"aria-busy": message.type === "loading" || void 0,
|
|
69
69
|
"data-tiger-message": true,
|
|
70
|
-
"data-tiger-message-type":
|
|
71
|
-
"data-tiger-message-id": String(
|
|
70
|
+
"data-tiger-message-type": message.type,
|
|
71
|
+
"data-tiger-message-id": String(message.id),
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */ jsx(Icon, { path: iconPath, className: iconClass, isLoading:
|
|
74
|
-
/* @__PURE__ */ jsx("div", { className: messageContentClasses, children:
|
|
75
|
-
|
|
73
|
+
/* @__PURE__ */ jsx(Icon, { path: iconPath, className: iconClass, isLoading: message.type === "loading" }),
|
|
74
|
+
/* @__PURE__ */ jsx("div", { className: messageContentClasses, children: message.content }),
|
|
75
|
+
message.closable && /* @__PURE__ */ jsx(
|
|
76
76
|
"button",
|
|
77
77
|
{
|
|
78
78
|
className: messageCloseButtonClasses,
|
|
@@ -121,7 +121,7 @@ var MessageContainer = ({ position = "top" }) => {
|
|
|
121
121
|
"aria-live": "polite",
|
|
122
122
|
"aria-relevant": "additions",
|
|
123
123
|
"data-tiger-message-container": true,
|
|
124
|
-
children: messages.map((
|
|
124
|
+
children: messages.map((message) => /* @__PURE__ */ jsx(MessageItem, { message, onClose: handleRemove }, message.id))
|
|
125
125
|
}
|
|
126
126
|
);
|
|
127
127
|
};
|
|
@@ -215,7 +215,7 @@ function normalizeOptions(options) {
|
|
|
215
215
|
}
|
|
216
216
|
return options;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
var Message = {
|
|
219
219
|
/**
|
|
220
220
|
* Show an info message
|
|
221
221
|
*/
|
|
@@ -258,6 +258,6 @@ var message = {
|
|
|
258
258
|
clearAll();
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
|
-
var Message_default =
|
|
261
|
+
var Message_default = Message;
|
|
262
262
|
|
|
263
|
-
export { MessageContainer, Message_default
|
|
263
|
+
export { Message, MessageContainer, Message_default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Select } from './chunk-YYKJ63LD.mjs';
|
|
2
|
-
import { Button } from './chunk-
|
|
2
|
+
import { Button } from './chunk-STEIWBMF.mjs';
|
|
3
3
|
import { useState, useMemo } from 'react';
|
|
4
4
|
import { getSpinnerSVG, paginateData, calculatePagination, classNames, getListClasses, listSizeClasses, listGridContainerClasses, getGridColumnClasses, listWrapperClasses, listLoadingOverlayClasses, getListHeaderFooterClasses, listEmptyStateClasses, listPaginationContainerClasses, getLoadingOverlaySpinnerClasses, getListItemClasses, listItemAvatarClasses, listItemTitleClasses, listItemDescriptionClasses, listItemContentClasses, listItemMetaClasses, listItemExtraClasses } from '@expcat/tigercat-core';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
// src/components/Input.tsx
|
|
8
|
+
var Input = ({
|
|
9
|
+
size = "md",
|
|
10
|
+
type = "text",
|
|
11
|
+
status = "default",
|
|
12
|
+
errorMessage,
|
|
13
|
+
prefix,
|
|
14
|
+
suffix,
|
|
15
|
+
value,
|
|
16
|
+
defaultValue,
|
|
17
|
+
placeholder = "",
|
|
18
|
+
disabled = false,
|
|
19
|
+
readonly = false,
|
|
20
|
+
required = false,
|
|
21
|
+
maxLength,
|
|
22
|
+
minLength,
|
|
23
|
+
name,
|
|
24
|
+
id,
|
|
25
|
+
autoComplete,
|
|
26
|
+
autoFocus = false,
|
|
27
|
+
onInput,
|
|
28
|
+
onChange,
|
|
29
|
+
onFocus,
|
|
30
|
+
onBlur,
|
|
31
|
+
className,
|
|
32
|
+
style,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
tigercatCore.injectShakeStyle();
|
|
36
|
+
const [isShaking, setIsShaking] = react.useState(false);
|
|
37
|
+
const inputRef = react.useRef(null);
|
|
38
|
+
const [internalValue, setInternalValue] = react.useState(defaultValue ?? "");
|
|
39
|
+
react.useEffect(() => {
|
|
40
|
+
if (status === "error") {
|
|
41
|
+
setIsShaking(true);
|
|
42
|
+
}
|
|
43
|
+
}, [status]);
|
|
44
|
+
const handleAnimationEnd = () => {
|
|
45
|
+
setIsShaking(false);
|
|
46
|
+
};
|
|
47
|
+
const isControlled = value !== void 0;
|
|
48
|
+
const inputValue = isControlled ? value : internalValue;
|
|
49
|
+
react.useEffect(() => {
|
|
50
|
+
if (autoFocus && inputRef.current) {
|
|
51
|
+
inputRef.current.focus();
|
|
52
|
+
}
|
|
53
|
+
}, [autoFocus]);
|
|
54
|
+
const getNextValue = (target) => {
|
|
55
|
+
if (type === "number") {
|
|
56
|
+
return Number.isNaN(target.valueAsNumber) ? target.value : target.valueAsNumber;
|
|
57
|
+
}
|
|
58
|
+
return target.value;
|
|
59
|
+
};
|
|
60
|
+
const handleInput = (event) => {
|
|
61
|
+
if (!isControlled) {
|
|
62
|
+
setInternalValue(getNextValue(event.currentTarget));
|
|
63
|
+
}
|
|
64
|
+
onInput?.(event);
|
|
65
|
+
};
|
|
66
|
+
const handleChange = (event) => {
|
|
67
|
+
if (!isControlled) {
|
|
68
|
+
setInternalValue(getNextValue(event.currentTarget));
|
|
69
|
+
}
|
|
70
|
+
onChange?.(event);
|
|
71
|
+
};
|
|
72
|
+
const hasPrefix = !!prefix;
|
|
73
|
+
const hasSuffix = !!suffix;
|
|
74
|
+
const activeError = status === "error" && !!errorMessage;
|
|
75
|
+
const inputClasses = tigercatCore.getInputClasses({
|
|
76
|
+
size,
|
|
77
|
+
status,
|
|
78
|
+
hasPrefix,
|
|
79
|
+
hasSuffix
|
|
80
|
+
});
|
|
81
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: tigercatCore.classNames(tigercatCore.getInputWrapperClasses(), className, isShaking && tigercatCore.SHAKE_CLASS),
|
|
85
|
+
style,
|
|
86
|
+
onAnimationEnd: handleAnimationEnd,
|
|
87
|
+
children: [
|
|
88
|
+
hasPrefix && /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.getInputAffixClasses("prefix", size), children: prefix }),
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
"input",
|
|
91
|
+
{
|
|
92
|
+
...props,
|
|
93
|
+
ref: inputRef,
|
|
94
|
+
className: inputClasses,
|
|
95
|
+
type,
|
|
96
|
+
value: inputValue,
|
|
97
|
+
placeholder,
|
|
98
|
+
disabled,
|
|
99
|
+
readOnly: readonly,
|
|
100
|
+
required,
|
|
101
|
+
maxLength,
|
|
102
|
+
minLength,
|
|
103
|
+
name,
|
|
104
|
+
id,
|
|
105
|
+
autoComplete,
|
|
106
|
+
autoFocus,
|
|
107
|
+
onInput: handleInput,
|
|
108
|
+
onChange: handleChange,
|
|
109
|
+
onFocus,
|
|
110
|
+
onBlur
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
activeError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.getInputErrorClasses(size), children: errorMessage }) : hasSuffix && /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.getInputAffixClasses("suffix", size), children: suffix })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.Input = Input;
|
|
@@ -38,28 +38,28 @@ var Icon = ({ path, className, isLoading = false }) => {
|
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
|
-
var MessageItem = ({ message
|
|
41
|
+
var MessageItem = ({ message, onClose }) => {
|
|
42
42
|
const [isVisible, setIsVisible] = react.useState(false);
|
|
43
43
|
react.useEffect(() => {
|
|
44
44
|
setTimeout(() => setIsVisible(true), 10);
|
|
45
45
|
}, []);
|
|
46
|
-
const colorScheme = tigercatCore.getMessageTypeClasses(
|
|
46
|
+
const colorScheme = tigercatCore.getMessageTypeClasses(message.type, tigercatCore.defaultMessageThemeColors);
|
|
47
47
|
const messageClasses = tigercatCore.classNames(
|
|
48
48
|
tigercatCore.messageBaseClasses,
|
|
49
49
|
colorScheme.bg,
|
|
50
50
|
colorScheme.border,
|
|
51
51
|
colorScheme.text,
|
|
52
|
-
|
|
52
|
+
message.className,
|
|
53
53
|
isVisible ? "opacity-100 translate-y-0" : "opacity-0 -translate-y-2"
|
|
54
54
|
);
|
|
55
|
-
const iconPath =
|
|
55
|
+
const iconPath = message.icon || tigercatCore.getMessageIconPath(message.type);
|
|
56
56
|
const iconClass = tigercatCore.classNames(tigercatCore.messageIconClasses, colorScheme.icon);
|
|
57
57
|
const handleClose = react.useCallback(() => {
|
|
58
58
|
setIsVisible(false);
|
|
59
|
-
setTimeout(() => onClose(
|
|
60
|
-
}, [
|
|
61
|
-
const a11yRole =
|
|
62
|
-
const ariaLive =
|
|
59
|
+
setTimeout(() => onClose(message.id), 300);
|
|
60
|
+
}, [message.id, onClose]);
|
|
61
|
+
const a11yRole = message.type === "error" ? "alert" : "status";
|
|
62
|
+
const ariaLive = message.type === "error" ? "assertive" : "polite";
|
|
63
63
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
@@ -67,14 +67,14 @@ var MessageItem = ({ message: message2, onClose }) => {
|
|
|
67
67
|
role: a11yRole,
|
|
68
68
|
"aria-live": ariaLive,
|
|
69
69
|
"aria-atomic": "true",
|
|
70
|
-
"aria-busy":
|
|
70
|
+
"aria-busy": message.type === "loading" || void 0,
|
|
71
71
|
"data-tiger-message": true,
|
|
72
|
-
"data-tiger-message-type":
|
|
73
|
-
"data-tiger-message-id": String(
|
|
72
|
+
"data-tiger-message-type": message.type,
|
|
73
|
+
"data-tiger-message-id": String(message.id),
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon, { path: iconPath, className: iconClass, isLoading:
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.messageContentClasses, children:
|
|
77
|
-
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { path: iconPath, className: iconClass, isLoading: message.type === "loading" }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.messageContentClasses, children: message.content }),
|
|
77
|
+
message.closable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
78
|
"button",
|
|
79
79
|
{
|
|
80
80
|
className: tigercatCore.messageCloseButtonClasses,
|
|
@@ -123,7 +123,7 @@ var MessageContainer = ({ position = "top" }) => {
|
|
|
123
123
|
"aria-live": "polite",
|
|
124
124
|
"aria-relevant": "additions",
|
|
125
125
|
"data-tiger-message-container": true,
|
|
126
|
-
children: messages.map((
|
|
126
|
+
children: messages.map((message) => /* @__PURE__ */ jsxRuntime.jsx(MessageItem, { message, onClose: handleRemove }, message.id))
|
|
127
127
|
}
|
|
128
128
|
);
|
|
129
129
|
};
|
|
@@ -217,7 +217,7 @@ function normalizeOptions(options) {
|
|
|
217
217
|
}
|
|
218
218
|
return options;
|
|
219
219
|
}
|
|
220
|
-
var
|
|
220
|
+
var Message = {
|
|
221
221
|
/**
|
|
222
222
|
* Show an info message
|
|
223
223
|
*/
|
|
@@ -260,8 +260,8 @@ var message = {
|
|
|
260
260
|
clearAll();
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
|
-
var Message_default =
|
|
263
|
+
var Message_default = Message;
|
|
264
264
|
|
|
265
|
+
exports.Message = Message;
|
|
265
266
|
exports.MessageContainer = MessageContainer;
|
|
266
267
|
exports.Message_default = Message_default;
|
|
267
|
-
exports.message = message;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkFQ6UHRAO_js = require('./chunk-FQ6UHRAO.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkA3DJSVTE_js = require('./chunk-A3DJSVTE.js');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var tigercatCore = require('@expcat/tigercat-core');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -218,7 +218,7 @@ var List = ({
|
|
|
218
218
|
),
|
|
219
219
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
|
|
220
220
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
221
|
-
|
|
221
|
+
chunkA3DJSVTE_js.Button,
|
|
222
222
|
{
|
|
223
223
|
size: "sm",
|
|
224
224
|
variant: "outline",
|
|
@@ -238,7 +238,7 @@ var List = ({
|
|
|
238
238
|
totalPages
|
|
239
239
|
] }),
|
|
240
240
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
-
|
|
241
|
+
chunkA3DJSVTE_js.Button,
|
|
242
242
|
{
|
|
243
243
|
size: "sm",
|
|
244
244
|
variant: "outline",
|
|
@@ -8,6 +8,7 @@ var Button = ({
|
|
|
8
8
|
size = "md",
|
|
9
9
|
disabled = false,
|
|
10
10
|
loading = false,
|
|
11
|
+
loadingIcon,
|
|
11
12
|
block = false,
|
|
12
13
|
onClick,
|
|
13
14
|
children,
|
|
@@ -40,7 +41,7 @@ var Button = ({
|
|
|
40
41
|
type,
|
|
41
42
|
...props,
|
|
42
43
|
children: [
|
|
43
|
-
loading && /* @__PURE__ */ jsx("span", { className: "mr-2", children: /* @__PURE__ */ jsx(
|
|
44
|
+
loading && /* @__PURE__ */ jsx("span", { className: "mr-2", children: loadingIcon ? loadingIcon : /* @__PURE__ */ jsx(
|
|
44
45
|
"svg",
|
|
45
46
|
{
|
|
46
47
|
className: "animate-spin h-4 w-4",
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ButtonProps as ButtonProps$1 } from '@expcat/tigercat-core';
|
|
3
3
|
|
|
4
4
|
interface ButtonProps extends ButtonProps$1, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> {
|
|
5
|
+
loadingIcon?: React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
declare const Button: React.FC<ButtonProps>;
|
|
7
8
|
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ButtonProps as ButtonProps$1 } from '@expcat/tigercat-core';
|
|
3
3
|
|
|
4
4
|
interface ButtonProps extends ButtonProps$1, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> {
|
|
5
|
+
loadingIcon?: React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
declare const Button: React.FC<ButtonProps>;
|
|
7
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkA3DJSVTE_js = require('../chunk-A3DJSVTE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Button", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkA3DJSVTE_js.Button; }
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Button } from '../chunk-
|
|
1
|
+
export { Button } from '../chunk-STEIWBMF.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InputProps as InputProps$1 } from '@expcat/tigercat-core';
|
|
2
|
+
import { InputProps as InputProps$1, InputStatus } from '@expcat/tigercat-core';
|
|
3
3
|
|
|
4
|
-
interface InputProps extends InputProps$1, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'autoComplete' | 'onInput' | 'onChange' | 'onFocus' | 'onBlur' | 'readOnly'> {
|
|
4
|
+
interface InputProps extends InputProps$1, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'autoComplete' | 'onInput' | 'onChange' | 'onFocus' | 'onBlur' | 'readOnly' | 'prefix'> {
|
|
5
5
|
/**
|
|
6
6
|
* Input event handler
|
|
7
7
|
*/
|
|
@@ -22,6 +22,22 @@ interface InputProps extends InputProps$1, Omit<React.InputHTMLAttributes<HTMLIn
|
|
|
22
22
|
* Additional CSS classes
|
|
23
23
|
*/
|
|
24
24
|
className?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Validation status
|
|
27
|
+
*/
|
|
28
|
+
status?: InputStatus;
|
|
29
|
+
/**
|
|
30
|
+
* Error message to display
|
|
31
|
+
*/
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Prefix content
|
|
35
|
+
*/
|
|
36
|
+
prefix?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Suffix content
|
|
39
|
+
*/
|
|
40
|
+
suffix?: React.ReactNode;
|
|
25
41
|
}
|
|
26
42
|
declare const Input: React.FC<InputProps>;
|
|
27
43
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InputProps as InputProps$1 } from '@expcat/tigercat-core';
|
|
2
|
+
import { InputProps as InputProps$1, InputStatus } from '@expcat/tigercat-core';
|
|
3
3
|
|
|
4
|
-
interface InputProps extends InputProps$1, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'autoComplete' | 'onInput' | 'onChange' | 'onFocus' | 'onBlur' | 'readOnly'> {
|
|
4
|
+
interface InputProps extends InputProps$1, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value' | 'defaultValue' | 'autoComplete' | 'onInput' | 'onChange' | 'onFocus' | 'onBlur' | 'readOnly' | 'prefix'> {
|
|
5
5
|
/**
|
|
6
6
|
* Input event handler
|
|
7
7
|
*/
|
|
@@ -22,6 +22,22 @@ interface InputProps extends InputProps$1, Omit<React.InputHTMLAttributes<HTMLIn
|
|
|
22
22
|
* Additional CSS classes
|
|
23
23
|
*/
|
|
24
24
|
className?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Validation status
|
|
27
|
+
*/
|
|
28
|
+
status?: InputStatus;
|
|
29
|
+
/**
|
|
30
|
+
* Error message to display
|
|
31
|
+
*/
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Prefix content
|
|
35
|
+
*/
|
|
36
|
+
prefix?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Suffix content
|
|
39
|
+
*/
|
|
40
|
+
suffix?: React.ReactNode;
|
|
25
41
|
}
|
|
26
42
|
declare const Input: React.FC<InputProps>;
|
|
27
43
|
|
package/dist/components/Input.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCIL2AC3F_js = require('../chunk-CIL2AC3F.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Input", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkCIL2AC3F_js.Input; }
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Input } from '../chunk-
|
|
1
|
+
export { Input } from '../chunk-6ZTCBQJ7.mjs';
|
package/dist/components/List.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQ5Q7FG4U_js = require('../chunk-Q5Q7FG4U.js');
|
|
4
4
|
require('../chunk-FQ6UHRAO.js');
|
|
5
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-A3DJSVTE.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "List", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkQ5Q7FG4U_js.List; }
|
|
12
12
|
});
|
package/dist/components/List.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { List } from '../chunk-
|
|
1
|
+
export { List } from '../chunk-BJU5N7WU.mjs';
|
|
2
2
|
import '../chunk-YYKJ63LD.mjs';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-STEIWBMF.mjs';
|
|
@@ -14,7 +14,7 @@ declare const MessageContainer: React.FC<MessageContainerProps>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Message API
|
|
16
16
|
*/
|
|
17
|
-
declare const
|
|
17
|
+
declare const Message: {
|
|
18
18
|
/**
|
|
19
19
|
* Show an info message
|
|
20
20
|
*/
|
|
@@ -41,4 +41,4 @@ declare const message: {
|
|
|
41
41
|
clear(): void;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export { MessageContainer, type MessageContainerProps,
|
|
44
|
+
export { Message, MessageContainer, type MessageContainerProps, Message as default };
|
|
@@ -14,7 +14,7 @@ declare const MessageContainer: React.FC<MessageContainerProps>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Message API
|
|
16
16
|
*/
|
|
17
|
-
declare const
|
|
17
|
+
declare const Message: {
|
|
18
18
|
/**
|
|
19
19
|
* Show an info message
|
|
20
20
|
*/
|
|
@@ -41,4 +41,4 @@ declare const message: {
|
|
|
41
41
|
clear(): void;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export { MessageContainer, type MessageContainerProps,
|
|
44
|
+
export { Message, MessageContainer, type MessageContainerProps, Message as default };
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var chunkKSW5JDIV_js = require('../chunk-KSW5JDIV.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "Message", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkKSW5JDIV_js.Message; }
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "MessageContainer", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkKSW5JDIV_js.MessageContainer; }
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "default", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkKSW5JDIV_js.Message_default; }
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MessageContainer, Message_default as default
|
|
1
|
+
export { Message, MessageContainer, Message_default as default } from '../chunk-BIWO5KB4.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -57,7 +57,7 @@ export { DropdownItem, DropdownItemProps } from './components/DropdownItem.mjs';
|
|
|
57
57
|
export { Drawer, DrawerProps } from './components/Drawer.mjs';
|
|
58
58
|
export { Modal, ModalProps } from './components/Modal.mjs';
|
|
59
59
|
export { Alert, AlertProps } from './components/Alert.mjs';
|
|
60
|
-
export { MessageContainer, MessageContainerProps
|
|
60
|
+
export { default as Message, MessageContainer, MessageContainerProps } from './components/Message.mjs';
|
|
61
61
|
export { NotificationContainer, NotificationContainerProps, default as notification } from './components/Notification.mjs';
|
|
62
62
|
export { Loading, LoadingProps } from './components/Loading.mjs';
|
|
63
63
|
export { Popconfirm, PopconfirmProps } from './components/Popconfirm.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export { DropdownItem, DropdownItemProps } from './components/DropdownItem.js';
|
|
|
57
57
|
export { Drawer, DrawerProps } from './components/Drawer.js';
|
|
58
58
|
export { Modal, ModalProps } from './components/Modal.js';
|
|
59
59
|
export { Alert, AlertProps } from './components/Alert.js';
|
|
60
|
-
export { MessageContainer, MessageContainerProps
|
|
60
|
+
export { default as Message, MessageContainer, MessageContainerProps } from './components/Message.js';
|
|
61
61
|
export { NotificationContainer, NotificationContainerProps, default as notification } from './components/Notification.js';
|
|
62
62
|
export { Loading, LoadingProps } from './components/Loading.js';
|
|
63
63
|
export { Popconfirm, PopconfirmProps } from './components/Popconfirm.js';
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var chunkIY4LEJYF_js = require('./chunk-IY4LEJYF.js');
|
|
|
24
24
|
var chunkLXA2YBAO_js = require('./chunk-LXA2YBAO.js');
|
|
25
25
|
var chunk3WPKVV4N_js = require('./chunk-3WPKVV4N.js');
|
|
26
26
|
var chunkQFVE7GKD_js = require('./chunk-QFVE7GKD.js');
|
|
27
|
-
var
|
|
27
|
+
var chunkKSW5JDIV_js = require('./chunk-KSW5JDIV.js');
|
|
28
28
|
var chunkTBIEWDY5_js = require('./chunk-TBIEWDY5.js');
|
|
29
29
|
var chunkOTRGVENC_js = require('./chunk-OTRGVENC.js');
|
|
30
30
|
var chunkDZJUFU55_js = require('./chunk-DZJUFU55.js');
|
|
@@ -32,10 +32,10 @@ var chunkENR3RIMM_js = require('./chunk-ENR3RIMM.js');
|
|
|
32
32
|
var chunkP273E6XE_js = require('./chunk-P273E6XE.js');
|
|
33
33
|
var chunkVJJ76I7U_js = require('./chunk-VJJ76I7U.js');
|
|
34
34
|
var chunkAQ6DHCP6_js = require('./chunk-AQ6DHCP6.js');
|
|
35
|
-
var
|
|
35
|
+
var chunkCIL2AC3F_js = require('./chunk-CIL2AC3F.js');
|
|
36
36
|
var chunkR4JSBXGG_js = require('./chunk-R4JSBXGG.js');
|
|
37
37
|
var chunkMKWXJZ3T_js = require('./chunk-MKWXJZ3T.js');
|
|
38
|
-
var
|
|
38
|
+
var chunkQ5Q7FG4U_js = require('./chunk-Q5Q7FG4U.js');
|
|
39
39
|
var chunkFQ6UHRAO_js = require('./chunk-FQ6UHRAO.js');
|
|
40
40
|
var chunk6MGEGOYJ_js = require('./chunk-6MGEGOYJ.js');
|
|
41
41
|
var chunkUFAXJVMD_js = require('./chunk-UFAXJVMD.js');
|
|
@@ -61,7 +61,7 @@ var chunkTZ26HQAW_js = require('./chunk-TZ26HQAW.js');
|
|
|
61
61
|
var chunk5ZVSFIZD_js = require('./chunk-5ZVSFIZD.js');
|
|
62
62
|
var chunk6PUSRC6S_js = require('./chunk-6PUSRC6S.js');
|
|
63
63
|
var chunk2DOPHSZP_js = require('./chunk-2DOPHSZP.js');
|
|
64
|
-
var
|
|
64
|
+
var chunkA3DJSVTE_js = require('./chunk-A3DJSVTE.js');
|
|
65
65
|
var chunkVO4WDK4K_js = require('./chunk-VO4WDK4K.js');
|
|
66
66
|
var tigercatCore = require('@expcat/tigercat-core');
|
|
67
67
|
|
|
@@ -183,13 +183,13 @@ Object.defineProperty(exports, "useMenuContext", {
|
|
|
183
183
|
enumerable: true,
|
|
184
184
|
get: function () { return chunkQFVE7GKD_js.useMenuContext; }
|
|
185
185
|
});
|
|
186
|
-
Object.defineProperty(exports, "
|
|
186
|
+
Object.defineProperty(exports, "Message", {
|
|
187
187
|
enumerable: true,
|
|
188
|
-
get: function () { return
|
|
188
|
+
get: function () { return chunkKSW5JDIV_js.Message; }
|
|
189
189
|
});
|
|
190
|
-
Object.defineProperty(exports, "
|
|
190
|
+
Object.defineProperty(exports, "MessageContainer", {
|
|
191
191
|
enumerable: true,
|
|
192
|
-
get: function () { return
|
|
192
|
+
get: function () { return chunkKSW5JDIV_js.MessageContainer; }
|
|
193
193
|
});
|
|
194
194
|
Object.defineProperty(exports, "Modal", {
|
|
195
195
|
enumerable: true,
|
|
@@ -225,7 +225,7 @@ Object.defineProperty(exports, "Icon", {
|
|
|
225
225
|
});
|
|
226
226
|
Object.defineProperty(exports, "Input", {
|
|
227
227
|
enumerable: true,
|
|
228
|
-
get: function () { return
|
|
228
|
+
get: function () { return chunkCIL2AC3F_js.Input; }
|
|
229
229
|
});
|
|
230
230
|
Object.defineProperty(exports, "Layout", {
|
|
231
231
|
enumerable: true,
|
|
@@ -237,7 +237,7 @@ Object.defineProperty(exports, "Link", {
|
|
|
237
237
|
});
|
|
238
238
|
Object.defineProperty(exports, "List", {
|
|
239
239
|
enumerable: true,
|
|
240
|
-
get: function () { return
|
|
240
|
+
get: function () { return chunkQ5Q7FG4U_js.List; }
|
|
241
241
|
});
|
|
242
242
|
Object.defineProperty(exports, "Select", {
|
|
243
243
|
enumerable: true,
|
|
@@ -349,7 +349,7 @@ Object.defineProperty(exports, "useBreadcrumbContext", {
|
|
|
349
349
|
});
|
|
350
350
|
Object.defineProperty(exports, "Button", {
|
|
351
351
|
enumerable: true,
|
|
352
|
-
get: function () { return
|
|
352
|
+
get: function () { return chunkA3DJSVTE_js.Button; }
|
|
353
353
|
});
|
|
354
354
|
Object.defineProperty(exports, "Card", {
|
|
355
355
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ export { Skeleton } from './chunk-427CM2U6.mjs';
|
|
|
22
22
|
export { MenuItemGroup } from './chunk-IWENGARY.mjs';
|
|
23
23
|
export { MenuItem } from './chunk-NSGDRTSQ.mjs';
|
|
24
24
|
export { Menu, useMenuContext } from './chunk-WDAMDVLU.mjs';
|
|
25
|
-
export {
|
|
25
|
+
export { Message, MessageContainer } from './chunk-BIWO5KB4.mjs';
|
|
26
26
|
export { Modal } from './chunk-7OLWGHUR.mjs';
|
|
27
27
|
export { NotificationContainer, notification } from './chunk-ADOPAXPG.mjs';
|
|
28
28
|
export { Pagination } from './chunk-CTAMMQBC.mjs';
|
|
@@ -30,10 +30,10 @@ export { Popconfirm } from './chunk-HQXZVTP4.mjs';
|
|
|
30
30
|
export { FormItem } from './chunk-GIYBVWR4.mjs';
|
|
31
31
|
export { Header } from './chunk-HUMGEP7S.mjs';
|
|
32
32
|
export { Icon } from './chunk-ALP3KYYY.mjs';
|
|
33
|
-
export { Input } from './chunk-
|
|
33
|
+
export { Input } from './chunk-6ZTCBQJ7.mjs';
|
|
34
34
|
export { Layout } from './chunk-7O2OQKVY.mjs';
|
|
35
35
|
export { Link } from './chunk-WSJO2PIE.mjs';
|
|
36
|
-
export { List } from './chunk-
|
|
36
|
+
export { List } from './chunk-BJU5N7WU.mjs';
|
|
37
37
|
export { Select } from './chunk-YYKJ63LD.mjs';
|
|
38
38
|
export { Loading } from './chunk-PUDU34R4.mjs';
|
|
39
39
|
export { Descriptions } from './chunk-6575DOCV.mjs';
|
|
@@ -59,7 +59,7 @@ export { Avatar } from './chunk-V2HVHLBY.mjs';
|
|
|
59
59
|
export { Badge } from './chunk-HQLZL3XQ.mjs';
|
|
60
60
|
export { BreadcrumbItem } from './chunk-WEGU7O4J.mjs';
|
|
61
61
|
export { Breadcrumb, useBreadcrumbContext } from './chunk-7JQ7LURS.mjs';
|
|
62
|
-
export { Button } from './chunk-
|
|
62
|
+
export { Button } from './chunk-STEIWBMF.mjs';
|
|
63
63
|
export { Card } from './chunk-VD3IK5XT.mjs';
|
|
64
64
|
export * from '@expcat/tigercat-core';
|
|
65
65
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expcat/tigercat-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "React components for Tigercat UI library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Yizhe Wang",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@expcat/tigercat-core": "0.1.
|
|
41
|
+
"@expcat/tigercat-core": "0.1.8"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^25.0.3",
|
package/dist/chunk-QL6OBKEN.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var tigercatCore = require('@expcat/tigercat-core');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
|
|
7
|
-
// src/components/Input.tsx
|
|
8
|
-
var Input = ({
|
|
9
|
-
size = "md",
|
|
10
|
-
type = "text",
|
|
11
|
-
value,
|
|
12
|
-
defaultValue,
|
|
13
|
-
placeholder = "",
|
|
14
|
-
disabled = false,
|
|
15
|
-
readonly = false,
|
|
16
|
-
required = false,
|
|
17
|
-
maxLength,
|
|
18
|
-
minLength,
|
|
19
|
-
name,
|
|
20
|
-
id,
|
|
21
|
-
autoComplete,
|
|
22
|
-
autoFocus = false,
|
|
23
|
-
onInput,
|
|
24
|
-
onChange,
|
|
25
|
-
onFocus,
|
|
26
|
-
onBlur,
|
|
27
|
-
className,
|
|
28
|
-
...props
|
|
29
|
-
}) => {
|
|
30
|
-
const inputRef = react.useRef(null);
|
|
31
|
-
const [internalValue, setInternalValue] = react.useState(defaultValue ?? "");
|
|
32
|
-
const isControlled = value !== void 0;
|
|
33
|
-
const inputValue = isControlled ? value : internalValue;
|
|
34
|
-
react.useEffect(() => {
|
|
35
|
-
if (autoFocus && inputRef.current) {
|
|
36
|
-
inputRef.current.focus();
|
|
37
|
-
}
|
|
38
|
-
}, [autoFocus]);
|
|
39
|
-
const getNextValue = (target) => {
|
|
40
|
-
if (type === "number") {
|
|
41
|
-
return Number.isNaN(target.valueAsNumber) ? target.value : target.valueAsNumber;
|
|
42
|
-
}
|
|
43
|
-
return target.value;
|
|
44
|
-
};
|
|
45
|
-
const handleInput = (event) => {
|
|
46
|
-
if (!isControlled) {
|
|
47
|
-
setInternalValue(getNextValue(event.currentTarget));
|
|
48
|
-
}
|
|
49
|
-
onInput?.(event);
|
|
50
|
-
};
|
|
51
|
-
const handleChange = (event) => {
|
|
52
|
-
if (!isControlled) {
|
|
53
|
-
setInternalValue(getNextValue(event.currentTarget));
|
|
54
|
-
}
|
|
55
|
-
onChange?.(event);
|
|
56
|
-
};
|
|
57
|
-
const inputClasses = tigercatCore.classNames(tigercatCore.getInputClasses(size), className);
|
|
58
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
-
"input",
|
|
60
|
-
{
|
|
61
|
-
...props,
|
|
62
|
-
ref: inputRef,
|
|
63
|
-
className: inputClasses,
|
|
64
|
-
type,
|
|
65
|
-
value: inputValue,
|
|
66
|
-
placeholder,
|
|
67
|
-
disabled,
|
|
68
|
-
readOnly: readonly,
|
|
69
|
-
required,
|
|
70
|
-
maxLength,
|
|
71
|
-
minLength,
|
|
72
|
-
name,
|
|
73
|
-
id,
|
|
74
|
-
autoComplete,
|
|
75
|
-
autoFocus,
|
|
76
|
-
onInput: handleInput,
|
|
77
|
-
onChange: handleChange,
|
|
78
|
-
onFocus,
|
|
79
|
-
onBlur
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
exports.Input = Input;
|
package/dist/chunk-QN7NIX7D.mjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useRef, useState, useEffect } from 'react';
|
|
2
|
-
import { classNames, getInputClasses } from '@expcat/tigercat-core';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
// src/components/Input.tsx
|
|
6
|
-
var Input = ({
|
|
7
|
-
size = "md",
|
|
8
|
-
type = "text",
|
|
9
|
-
value,
|
|
10
|
-
defaultValue,
|
|
11
|
-
placeholder = "",
|
|
12
|
-
disabled = false,
|
|
13
|
-
readonly = false,
|
|
14
|
-
required = false,
|
|
15
|
-
maxLength,
|
|
16
|
-
minLength,
|
|
17
|
-
name,
|
|
18
|
-
id,
|
|
19
|
-
autoComplete,
|
|
20
|
-
autoFocus = false,
|
|
21
|
-
onInput,
|
|
22
|
-
onChange,
|
|
23
|
-
onFocus,
|
|
24
|
-
onBlur,
|
|
25
|
-
className,
|
|
26
|
-
...props
|
|
27
|
-
}) => {
|
|
28
|
-
const inputRef = useRef(null);
|
|
29
|
-
const [internalValue, setInternalValue] = useState(defaultValue ?? "");
|
|
30
|
-
const isControlled = value !== void 0;
|
|
31
|
-
const inputValue = isControlled ? value : internalValue;
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (autoFocus && inputRef.current) {
|
|
34
|
-
inputRef.current.focus();
|
|
35
|
-
}
|
|
36
|
-
}, [autoFocus]);
|
|
37
|
-
const getNextValue = (target) => {
|
|
38
|
-
if (type === "number") {
|
|
39
|
-
return Number.isNaN(target.valueAsNumber) ? target.value : target.valueAsNumber;
|
|
40
|
-
}
|
|
41
|
-
return target.value;
|
|
42
|
-
};
|
|
43
|
-
const handleInput = (event) => {
|
|
44
|
-
if (!isControlled) {
|
|
45
|
-
setInternalValue(getNextValue(event.currentTarget));
|
|
46
|
-
}
|
|
47
|
-
onInput?.(event);
|
|
48
|
-
};
|
|
49
|
-
const handleChange = (event) => {
|
|
50
|
-
if (!isControlled) {
|
|
51
|
-
setInternalValue(getNextValue(event.currentTarget));
|
|
52
|
-
}
|
|
53
|
-
onChange?.(event);
|
|
54
|
-
};
|
|
55
|
-
const inputClasses = classNames(getInputClasses(size), className);
|
|
56
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
-
"input",
|
|
58
|
-
{
|
|
59
|
-
...props,
|
|
60
|
-
ref: inputRef,
|
|
61
|
-
className: inputClasses,
|
|
62
|
-
type,
|
|
63
|
-
value: inputValue,
|
|
64
|
-
placeholder,
|
|
65
|
-
disabled,
|
|
66
|
-
readOnly: readonly,
|
|
67
|
-
required,
|
|
68
|
-
maxLength,
|
|
69
|
-
minLength,
|
|
70
|
-
name,
|
|
71
|
-
id,
|
|
72
|
-
autoComplete,
|
|
73
|
-
autoFocus,
|
|
74
|
-
onInput: handleInput,
|
|
75
|
-
onChange: handleChange,
|
|
76
|
-
onFocus,
|
|
77
|
-
onBlur
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export { Input };
|