@farmzone/fz-react-ui 1.1.13 → 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