@expcat/tigercat-react 0.1.0 → 0.1.6
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-7KRBDT2Z.mjs → chunk-BJU5N7WU.mjs} +1 -1
- package/dist/chunk-CIL2AC3F.js +119 -0
- 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/index.js +6 -6
- package/dist/index.mjs +3 -3
- 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",
|
|
@@ -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;
|
|
@@ -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';
|
package/dist/index.js
CHANGED
|
@@ -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
|
|
|
@@ -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
|
@@ -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.6",
|
|
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.6"
|
|
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 };
|