@farmzone/fz-react-ui 1.1.12 → 1.1.14
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/index.cjs +32 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +32 -18
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -610,7 +610,13 @@ function Input2(props) {
|
|
|
610
610
|
{
|
|
611
611
|
id: inputId,
|
|
612
612
|
type: actualType === "money" || actualType === "number" ? "text" : actualType,
|
|
613
|
-
className: cn(
|
|
613
|
+
className: cn(
|
|
614
|
+
"w-full",
|
|
615
|
+
leftIcon && "pl-10!",
|
|
616
|
+
hasRightSlot && "pr-10!",
|
|
617
|
+
getStatusStyles(),
|
|
618
|
+
className
|
|
619
|
+
),
|
|
614
620
|
placeholder,
|
|
615
621
|
disabled,
|
|
616
622
|
ref,
|
|
@@ -645,6 +651,8 @@ function Textarea(props) {
|
|
|
645
651
|
bare = false,
|
|
646
652
|
id,
|
|
647
653
|
rows = 4,
|
|
654
|
+
blockLeadingSpace = false,
|
|
655
|
+
onKeyDown,
|
|
648
656
|
...rest
|
|
649
657
|
} = props;
|
|
650
658
|
const randomId = React6.useId();
|
|
@@ -669,6 +677,12 @@ function Textarea(props) {
|
|
|
669
677
|
return "text-muted-foreground";
|
|
670
678
|
}
|
|
671
679
|
};
|
|
680
|
+
const handleKeyDown = (event) => {
|
|
681
|
+
if (blockLeadingSpace && event.key === " " && event.currentTarget.selectionStart === 0) {
|
|
682
|
+
event.preventDefault();
|
|
683
|
+
}
|
|
684
|
+
onKeyDown?.(event);
|
|
685
|
+
};
|
|
672
686
|
const textareaEl = /* @__PURE__ */ jsxRuntime.jsx(
|
|
673
687
|
"textarea",
|
|
674
688
|
{
|
|
@@ -678,9 +692,10 @@ function Textarea(props) {
|
|
|
678
692
|
placeholder,
|
|
679
693
|
disabled,
|
|
680
694
|
readOnly,
|
|
695
|
+
onKeyDown: handleKeyDown,
|
|
681
696
|
className: cn(
|
|
682
|
-
"placeholder:text-muted-foreground custom-view-scrollbar border-input flex w-full min-w-0 resize-
|
|
683
|
-
"focus-visible:border-
|
|
697
|
+
"placeholder:text-muted-foreground custom-view-scrollbar border-input flex w-full min-w-0 resize-none rounded-md border border-gray-300 bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
698
|
+
"focus-visible:border-blue-600 focus-visible:ring-blue-600/30 focus-visible:ring-[1px]",
|
|
684
699
|
"aria-invalid:ring-destructive/20 aria-invalid:border-destructive",
|
|
685
700
|
getStatusStyles(),
|
|
686
701
|
className
|
|
@@ -1998,15 +2013,16 @@ function ToastItemCard(props) {
|
|
|
1998
2013
|
const { toast: toast2, onRemove } = props;
|
|
1999
2014
|
const [isVisible, setIsVisible] = React6.useState(true);
|
|
2000
2015
|
const removeTimeoutRef = React6.useRef(null);
|
|
2016
|
+
const EXIT_ANIMATION_MS = 400;
|
|
2001
2017
|
React6.useEffect(() => {
|
|
2002
2018
|
const duration = toast2.props.duration ?? 1500;
|
|
2003
|
-
if (duration !== Infinity && duration >
|
|
2004
|
-
const fadeOutTime = Math.max(0, duration -
|
|
2019
|
+
if (duration !== Infinity && duration > EXIT_ANIMATION_MS) {
|
|
2020
|
+
const fadeOutTime = Math.max(0, duration - EXIT_ANIMATION_MS);
|
|
2005
2021
|
const fadeOutTimer = setTimeout(() => {
|
|
2006
2022
|
setIsVisible(false);
|
|
2007
2023
|
removeTimeoutRef.current = setTimeout(() => {
|
|
2008
2024
|
onRemove(toast2.id);
|
|
2009
|
-
},
|
|
2025
|
+
}, EXIT_ANIMATION_MS);
|
|
2010
2026
|
}, fadeOutTime);
|
|
2011
2027
|
return () => {
|
|
2012
2028
|
clearTimeout(fadeOutTimer);
|
|
@@ -2027,7 +2043,7 @@ function ToastItemCard(props) {
|
|
|
2027
2043
|
}
|
|
2028
2044
|
removeTimeoutRef.current = setTimeout(() => {
|
|
2029
2045
|
onRemove(toast2.id);
|
|
2030
|
-
},
|
|
2046
|
+
}, EXIT_ANIMATION_MS);
|
|
2031
2047
|
};
|
|
2032
2048
|
const handleCloseClick = (e) => {
|
|
2033
2049
|
e.stopPropagation();
|
|
@@ -2054,17 +2070,15 @@ function ToastItemCard(props) {
|
|
|
2054
2070
|
loading: "\u27F3"
|
|
2055
2071
|
};
|
|
2056
2072
|
if (iconTheme) {
|
|
2073
|
+
const colorVars = {
|
|
2074
|
+
"--fz-toast-icon-primary": iconTheme.primary,
|
|
2075
|
+
"--fz-toast-icon-secondary": iconTheme.secondary
|
|
2076
|
+
};
|
|
2057
2077
|
if (type === "loading") {
|
|
2058
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
style: {
|
|
2063
|
-
border: `2px solid ${iconTheme.secondary}`,
|
|
2064
|
-
borderRightColor: iconTheme.primary
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
);
|
|
2078
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fz-toast-icon-spinner", style: colorVars });
|
|
2079
|
+
}
|
|
2080
|
+
if (type === "success" || type === "error") {
|
|
2081
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: `fz-toast-icon-badge fz-toast-icon-badge--${type}`, style: colorVars });
|
|
2068
2082
|
}
|
|
2069
2083
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2070
2084
|
"span",
|
|
@@ -2092,7 +2106,7 @@ function ToastItemCard(props) {
|
|
|
2092
2106
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2093
2107
|
"div",
|
|
2094
2108
|
{
|
|
2095
|
-
className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)}
|
|
2109
|
+
className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} ${isVisible ? "fz-toast-card-enter" : "fz-toast-card-exit"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
|
|
2096
2110
|
style: toast2.props.style,
|
|
2097
2111
|
onClick: handleClick,
|
|
2098
2112
|
children: [
|