@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.d.cts CHANGED
@@ -108,6 +108,8 @@ interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
108
108
  message?: string;
109
109
  label?: string;
110
110
  bare?: boolean;
111
+ /** 값의 첫 글자로 스페이스 입력을 막을지 (기본 false — 막으려면 true로 선언) */
112
+ blockLeadingSpace?: boolean;
111
113
  }
112
114
  declare function Textarea(props: TextareaProps): react.JSX.Element;
113
115
 
package/dist/index.d.ts CHANGED
@@ -108,6 +108,8 @@ interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
108
108
  message?: string;
109
109
  label?: string;
110
110
  bare?: boolean;
111
+ /** 값의 첫 글자로 스페이스 입력을 막을지 (기본 false — 막으려면 true로 선언) */
112
+ blockLeadingSpace?: boolean;
111
113
  }
112
114
  declare function Textarea(props: TextareaProps): react.JSX.Element;
113
115
 
package/dist/index.js CHANGED
@@ -573,7 +573,13 @@ function Input2(props) {
573
573
  {
574
574
  id: inputId,
575
575
  type: actualType === "money" || actualType === "number" ? "text" : actualType,
576
- className: cn("w-full", leftIcon && "pl-10", hasRightSlot && "pr-10", getStatusStyles(), className),
576
+ className: cn(
577
+ "w-full",
578
+ leftIcon && "pl-10!",
579
+ hasRightSlot && "pr-10!",
580
+ getStatusStyles(),
581
+ className
582
+ ),
577
583
  placeholder,
578
584
  disabled,
579
585
  ref,
@@ -608,6 +614,8 @@ function Textarea(props) {
608
614
  bare = false,
609
615
  id,
610
616
  rows = 4,
617
+ blockLeadingSpace = false,
618
+ onKeyDown,
611
619
  ...rest
612
620
  } = props;
613
621
  const randomId = useId();
@@ -632,6 +640,12 @@ function Textarea(props) {
632
640
  return "text-muted-foreground";
633
641
  }
634
642
  };
643
+ const handleKeyDown = (event) => {
644
+ if (blockLeadingSpace && event.key === " " && event.currentTarget.selectionStart === 0) {
645
+ event.preventDefault();
646
+ }
647
+ onKeyDown?.(event);
648
+ };
635
649
  const textareaEl = /* @__PURE__ */ jsx(
636
650
  "textarea",
637
651
  {
@@ -641,9 +655,10 @@ function Textarea(props) {
641
655
  placeholder,
642
656
  disabled,
643
657
  readOnly,
658
+ onKeyDown: handleKeyDown,
644
659
  className: cn(
645
- "placeholder:text-muted-foreground custom-view-scrollbar border-input flex w-full min-w-0 resize-y 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",
646
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[1px]",
660
+ "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",
661
+ "focus-visible:border-blue-600 focus-visible:ring-blue-600/30 focus-visible:ring-[1px]",
647
662
  "aria-invalid:ring-destructive/20 aria-invalid:border-destructive",
648
663
  getStatusStyles(),
649
664
  className
@@ -1961,15 +1976,16 @@ function ToastItemCard(props) {
1961
1976
  const { toast: toast2, onRemove } = props;
1962
1977
  const [isVisible, setIsVisible] = useState(true);
1963
1978
  const removeTimeoutRef = useRef(null);
1979
+ const EXIT_ANIMATION_MS = 400;
1964
1980
  useEffect(() => {
1965
1981
  const duration = toast2.props.duration ?? 1500;
1966
- if (duration !== Infinity && duration > 300) {
1967
- const fadeOutTime = Math.max(0, duration - 300);
1982
+ if (duration !== Infinity && duration > EXIT_ANIMATION_MS) {
1983
+ const fadeOutTime = Math.max(0, duration - EXIT_ANIMATION_MS);
1968
1984
  const fadeOutTimer = setTimeout(() => {
1969
1985
  setIsVisible(false);
1970
1986
  removeTimeoutRef.current = setTimeout(() => {
1971
1987
  onRemove(toast2.id);
1972
- }, 300);
1988
+ }, EXIT_ANIMATION_MS);
1973
1989
  }, fadeOutTime);
1974
1990
  return () => {
1975
1991
  clearTimeout(fadeOutTimer);
@@ -1990,7 +2006,7 @@ function ToastItemCard(props) {
1990
2006
  }
1991
2007
  removeTimeoutRef.current = setTimeout(() => {
1992
2008
  onRemove(toast2.id);
1993
- }, 300);
2009
+ }, EXIT_ANIMATION_MS);
1994
2010
  };
1995
2011
  const handleCloseClick = (e) => {
1996
2012
  e.stopPropagation();
@@ -2017,17 +2033,15 @@ function ToastItemCard(props) {
2017
2033
  loading: "\u27F3"
2018
2034
  };
2019
2035
  if (iconTheme) {
2036
+ const colorVars = {
2037
+ "--fz-toast-icon-primary": iconTheme.primary,
2038
+ "--fz-toast-icon-secondary": iconTheme.secondary
2039
+ };
2020
2040
  if (type === "loading") {
2021
- return /* @__PURE__ */ jsx(
2022
- "span",
2023
- {
2024
- className: "h-4 w-4 shrink-0 animate-spin rounded-full",
2025
- style: {
2026
- border: `2px solid ${iconTheme.secondary}`,
2027
- borderRightColor: iconTheme.primary
2028
- }
2029
- }
2030
- );
2041
+ return /* @__PURE__ */ jsx("span", { className: "fz-toast-icon-spinner", style: colorVars });
2042
+ }
2043
+ if (type === "success" || type === "error") {
2044
+ return /* @__PURE__ */ jsx("span", { className: `fz-toast-icon-badge fz-toast-icon-badge--${type}`, style: colorVars });
2031
2045
  }
2032
2046
  return /* @__PURE__ */ jsx(
2033
2047
  "span",
@@ -2055,7 +2069,7 @@ function ToastItemCard(props) {
2055
2069
  return /* @__PURE__ */ jsxs(
2056
2070
  "div",
2057
2071
  {
2058
- className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} transition-all duration-300 ${isVisible ? "animate-in slide-in-from-top-2 fade-in-0 duration-300 opacity-100" : "animate-out slide-out-to-top-2 fade-out-0 duration-300 opacity-0"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
2072
+ className: `${getTypeStyles(toast2.props.type || "info", hasCustomStyle)} ${isVisible ? "fz-toast-card-enter" : "fz-toast-card-exit"} mb-2 cursor-pointer ${toast2.props.className ?? ""}`,
2059
2073
  style: toast2.props.style,
2060
2074
  onClick: handleClick,
2061
2075
  children: [