sales-frontend-components 0.0.73 → 0.0.75

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.js CHANGED
@@ -59,12 +59,17 @@ const FormDatePicker = ({
59
59
  ...props
60
60
  }) => {
61
61
  const { field, fieldState } = reactHookForm.useController({ name, control, disabled, defaultValue });
62
- const [initialDate, setInitialDate] = React.useState();
62
+ const [selected, setSelected] = React.useState();
63
63
  React.useEffect(() => {
64
64
  if (field.value) {
65
- setInitialDate(field.value);
65
+ setSelected(field.value);
66
66
  }
67
67
  }, [defaultValue]);
68
+ React.useEffect(() => {
69
+ if (field.value !== selected) {
70
+ setSelected(field.value);
71
+ }
72
+ }, [field.value]);
68
73
  return /* @__PURE__ */ jsxRuntime.jsx(
69
74
  salesFrontendDesignSystem.DatePicker,
70
75
  {
@@ -73,7 +78,7 @@ const FormDatePicker = ({
73
78
  ...props,
74
79
  ...field,
75
80
  id: field.name,
76
- defaultValue: initialDate,
81
+ defaultValue: selected,
77
82
  error: fieldState.invalid,
78
83
  onValueChange: field.onChange
79
84
  }
@@ -89,12 +94,18 @@ const FormDateRangePicker = ({
89
94
  ...props
90
95
  }) => {
91
96
  const { field, fieldState } = reactHookForm.useController({ name, control, disabled, defaultValue });
92
- const [initialDate, setInitialDate] = React.useState();
97
+ const [selected, setSelected] = React.useState();
93
98
  React.useEffect(() => {
94
99
  if (field.value) {
95
- setInitialDate(field.value);
100
+ setSelected(field.value);
96
101
  }
97
102
  }, [defaultValue]);
103
+ React.useEffect(() => {
104
+ if (selected && field.value.startDate.getTime() === selected.startDate?.getTime() && field.value.endDate.getTime() === selected.endDate?.getTime()) {
105
+ return;
106
+ }
107
+ setSelected(field.value);
108
+ }, [field.value]);
98
109
  return /* @__PURE__ */ jsxRuntime.jsx(
99
110
  salesFrontendDesignSystem.DateRangePicker,
100
111
  {
@@ -103,13 +114,9 @@ const FormDateRangePicker = ({
103
114
  ...props,
104
115
  ...field,
105
116
  id: field.name,
106
- defaultValue: initialDate,
117
+ defaultValue: selected,
107
118
  error: fieldState.invalid,
108
- onValueChange: (selected) => {
109
- if (field.value !== selected) {
110
- field.onChange(selected);
111
- }
112
- }
119
+ onValueChange: field.onChange
113
120
  }
114
121
  }
115
122
  );
@@ -887,7 +894,7 @@ function Attachment({
887
894
  const renderPhotoSingle = () => {
888
895
  if (photos.length === 0) {
889
896
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx$5("single-photo-item", "add-photo-item"), children: /* @__PURE__ */ jsxRuntime.jsxs("button", { className: cx$5("add-photo-button-single"), onClick: handleAddPhoto, children: [
890
- /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Icon, { name: "illust/camera" }),
897
+ /* @__PURE__ */ jsxRuntime.jsx(salesFrontendAssets.IconIllustCamera, {}),
891
898
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: buttonText || "\uC0AC\uC9C4 \uCCA8\uBD80\uD558\uAE30" })
892
899
  ] }) });
893
900
  }
@@ -902,7 +909,7 @@ function Attachment({
902
909
  if (photos.length < maxPhotos) {
903
910
  gridItems.push(
904
911
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx$5("photo-item", "add-photo-item"), children: /* @__PURE__ */ jsxRuntime.jsxs("button", { className: cx$5("add-photo-button"), onClick: handleAddPhoto, children: [
905
- /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.Icon, { name: "illust/camera" }),
912
+ /* @__PURE__ */ jsxRuntime.jsx(salesFrontendAssets.IconIllustCamera, {}),
906
913
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: buttonText || "\uCCA8\uBD80\uD558\uAE30" }),
907
914
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cx$5("photo-count"), children: [
908
915
  "(",
@@ -2032,7 +2039,11 @@ const useCustomerSearch = (onSelect) => {
2032
2039
  search,
2033
2040
  onClear,
2034
2041
  handleSelectItem,
2035
- selectedCustomer
2042
+ selectedCustomer,
2043
+ setSearchInput,
2044
+ setCustomerList,
2045
+ setSearchKeyword,
2046
+ setIsOpen
2036
2047
  };
2037
2048
  };
2038
2049
 
@@ -2080,7 +2091,7 @@ const CustomerSearch = ({ onSelect }) => {
2080
2091
  ref: triggerRef
2081
2092
  }
2082
2093
  ) }) }),
2083
- isOpen && /* @__PURE__ */ jsxRuntime.jsx(DropDown, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx("result-container"), children: customerList.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.List, { rootProps: { style: { width: "100%" } }, children: customerList.map((customer) => /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.ListItem, { onClick: () => handleSelectItem(customer), selectable: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx("customer-item"), children: [
2094
+ isOpen && customerList.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(DropDown, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx("result-container"), children: /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.List, { children: customerList.map((customer) => /* @__PURE__ */ jsxRuntime.jsx(salesFrontendDesignSystem.ListItem, { onClick: () => handleSelectItem(customer), selectable: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx("customer-item"), children: [
2084
2095
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx("name"), children: highlightOnSearchKeyword(customer.customerName || "", searchKeyword) }),
2085
2096
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx("details"), children: [
2086
2097
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: customer.birthDate }),