@farmzone/fz-react-ui 1.0.12 → 1.0.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.js CHANGED
@@ -48,7 +48,7 @@ var buttonVariants = cva(
48
48
  carousel: "bg-white border border-gray-300 hover:bg-gray-100 hover:text-black rounded-full",
49
49
  accent: "btn-grad text-white rounded-full",
50
50
  metal: "btn-metal text-white min-w-22",
51
- ghost: "p-1 h-auto rounded-sm bg-transparent hover:bg-sub-lightgray text-sub-darkgray hover:bg-inherit",
51
+ ghost: "p-1 h-auto rounded-sm bg-transparent text-sub-darkgray transition-colors hover:bg-gray-100",
52
52
  link: "bg-transparent border-none text-main-blue underline-offset-4 hover:underline h-auto p-0"
53
53
  },
54
54
  size: {
@@ -412,7 +412,7 @@ function Input({ className, type, ...props }) {
412
412
  "data-slot": "input",
413
413
  className: cn(
414
414
  "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input border-gray-300 flex h-8 w-full min-w-0 rounded-sm border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
415
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[1px]",
415
+ "focus-visible:border-blue-600 focus-visible:ring-blue-600/30 focus-visible:ring-[1px]",
416
416
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
417
417
  className
418
418
  ),
@@ -2528,9 +2528,11 @@ function DatePickerRange(props) {
2528
2528
  const dateToShow = position === "end" ? endInputValue || startInputValue : startInputValue || endInputValue;
2529
2529
  toggleCalendar(dateToShow);
2530
2530
  };
2531
- const handleFieldEnter = () => {
2532
- onKeyDownEnter?.();
2531
+ const handleFieldEnter = (value) => {
2533
2532
  closeCalendar();
2533
+ if (onKeyDownEnter && value.length === 10) {
2534
+ onKeyDownEnter();
2535
+ }
2534
2536
  };
2535
2537
  const inputClassName = cn(
2536
2538
  "w-full px-2 py-1.25 border border-gray-300 shadow-xs outline-none text-sm rounded-sm pr-7 transition-colors",
@@ -2590,7 +2592,10 @@ function DatePickerRange(props) {
2590
2592
  className: inputClassName,
2591
2593
  maxLength: 10,
2592
2594
  onKeyDown: (e) => {
2593
- if (e.key === "Enter") handleFieldEnter();
2595
+ if (e.key === "Enter") {
2596
+ e.preventDefault();
2597
+ handleFieldEnter(startInputValue);
2598
+ }
2594
2599
  }
2595
2600
  }
2596
2601
  ),
@@ -2618,7 +2623,10 @@ function DatePickerRange(props) {
2618
2623
  className: inputClassName,
2619
2624
  maxLength: 10,
2620
2625
  onKeyDown: (e) => {
2621
- if (e.key === "Enter") handleFieldEnter();
2626
+ if (e.key === "Enter") {
2627
+ e.preventDefault();
2628
+ handleFieldEnter(endInputValue);
2629
+ }
2622
2630
  }
2623
2631
  }
2624
2632
  ),
@@ -2713,9 +2721,11 @@ function DatePickerSingle(props) {
2713
2721
  onBlur?.(formatted);
2714
2722
  closeCalendar();
2715
2723
  };
2716
- const handleFieldEnter = () => {
2717
- onKeyDownEnter?.();
2724
+ const handleFieldEnter = (value2) => {
2718
2725
  closeCalendar();
2726
+ if (onKeyDownEnter && value2.length === 10) {
2727
+ onKeyDownEnter();
2728
+ }
2719
2729
  };
2720
2730
  const calendarNode = /* @__PURE__ */ jsx(
2721
2731
  CalendarPortal,
@@ -2764,12 +2774,15 @@ function DatePickerSingle(props) {
2764
2774
  disabled,
2765
2775
  className: cn(
2766
2776
  "w-full px-2 py-1.25 border text-sm rounded-sm outline-none shadow-xs transition-colors",
2767
- validation ? "border-red-600 focus:border-main focus-visible:border-main focus-visible:ring-1 focus-visible:ring-main/30 focus-visible:outline-none" : "border-gray-300 focus:border-main focus-visible:border-main focus-visible:ring-1 focus-visible:ring-main/30 focus-visible:outline-none",
2777
+ validation ? "border-red-600 focus:border-blue-600 focus-visible:border-blue-600 focus-visible:ring-1 focus-visible:ring-blue-600/30 focus-visible:outline-none" : "border-gray-300 focus:border-blue-600 focus-visible:border-blue-600 focus-visible:ring-1 focus-visible:ring-blue-600/30 focus-visible:outline-none",
2768
2778
  disabled ? DATE_PICKER_FIELD_DISABLED_CLASS : "bg-white text-gray-900"
2769
2779
  ),
2770
2780
  maxLength: 10,
2771
2781
  onKeyDown: (e) => {
2772
- if (e.key === "Enter") handleFieldEnter();
2782
+ if (e.key === "Enter") {
2783
+ e.preventDefault();
2784
+ handleFieldEnter(inputValue);
2785
+ }
2773
2786
  },
2774
2787
  "data-date-input": "true"
2775
2788
  }
@@ -4544,7 +4557,7 @@ function TableEmpty(props) {
4544
4557
  const { columnCount } = props;
4545
4558
  return /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: columnCount, className: "border-none bg-white p-0 align-middle", children: /* @__PURE__ */ jsxs(Empty, { className: "flex min-h-72 w-full flex-col items-center justify-center gap-1", children: [
4546
4559
  /* @__PURE__ */ jsx(TriangleAlert, { className: "size-8 shrink-0 text-gray-400", strokeWidth: 1.5 }),
4547
- /* @__PURE__ */ jsx("span", { className: "text-lg text-gray-500", children: "\uB4F1\uB85D\uB41C \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4." })
4560
+ /* @__PURE__ */ jsx("span", { className: "text-md text-gray-500", children: "\uB4F1\uB85D\uB41C \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4." })
4548
4561
  ] }) }) });
4549
4562
  }
4550
4563
  function TableCellContent(props) {
@@ -4707,15 +4720,26 @@ function Table(props) {
4707
4720
  if (!isDynamicHeight) return;
4708
4721
  const el = scrollRef.current;
4709
4722
  if (!el) return;
4723
+ const pageContainer = el.parentElement?.parentElement;
4724
+ const isContainerConstrained = (container2) => {
4725
+ if (!container2) return false;
4726
+ const style = window.getComputedStyle(container2);
4727
+ return style.overflow === "hidden" || style.overflowY === "hidden";
4728
+ };
4729
+ const getContainerBottom = () => {
4730
+ if (isContainerConstrained(pageContainer)) {
4731
+ return Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight);
4732
+ }
4733
+ return window.innerHeight;
4734
+ };
4710
4735
  const update = () => {
4711
4736
  const top = el.getBoundingClientRect().top;
4712
4737
  const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
4713
- setTableHeight(window.innerHeight - top - footerH - 24);
4738
+ setTableHeight(getContainerBottom() - top - footerH - 24);
4714
4739
  };
4715
4740
  update();
4716
4741
  window.addEventListener("resize", update);
4717
4742
  const observer = new ResizeObserver(update);
4718
- const pageContainer = el.parentElement?.parentElement;
4719
4743
  if (pageContainer) observer.observe(pageContainer);
4720
4744
  const footer = footerRef.current;
4721
4745
  if (footer) observer.observe(footer);
@@ -4728,9 +4752,15 @@ function Table(props) {
4728
4752
  if (!isDynamicHeight) return;
4729
4753
  const el = scrollRef.current;
4730
4754
  if (!el) return;
4755
+ const pageContainer = el.parentElement?.parentElement;
4731
4756
  const top = el.getBoundingClientRect().top;
4732
4757
  const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
4733
- setTableHeight(window.innerHeight - top - footerH - 24);
4758
+ const isContainerConstrained = !!pageContainer && (() => {
4759
+ const style = window.getComputedStyle(pageContainer);
4760
+ return style.overflow === "hidden" || style.overflowY === "hidden";
4761
+ })();
4762
+ const containerBottom = isContainerConstrained ? Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight) : window.innerHeight;
4763
+ setTableHeight(containerBottom - top - footerH - 24);
4734
4764
  }, [showSkeleton, showEmpty]);
4735
4765
  const selectedKeysRef = useRef(selectedKeys);
4736
4766
  selectedKeysRef.current = selectedKeys;
@@ -7782,7 +7812,8 @@ function PageFilter(props) {
7782
7812
  {
7783
7813
  value: currentValue,
7784
7814
  onChange: handleDateChange(optionKey),
7785
- placeholder: option.placeholder
7815
+ placeholder: option.placeholder,
7816
+ onKeyDownEnter: handleSubmit
7786
7817
  }
7787
7818
  ) }, String(optionKey));
7788
7819
  case "date-range":
@@ -7791,7 +7822,8 @@ function PageFilter(props) {
7791
7822
  {
7792
7823
  startValue: currentValue,
7793
7824
  endValue: String(values[option.endKey] ?? ""),
7794
- onRangeChange: handleRangeChangeCurried(optionKey, option.endKey)
7825
+ onRangeChange: handleRangeChangeCurried(optionKey, option.endKey),
7826
+ onKeyDownEnter: handleSubmit
7795
7827
  }
7796
7828
  ) }, String(optionKey));
7797
7829
  case "checkbox":