sales-frontend-components 0.0.215 → 0.0.217

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
@@ -3969,6 +3969,125 @@ const FormTextField = ({
3969
3969
  );
3970
3970
  };
3971
3971
 
3972
+ const FormDatePickerRenew = ({
3973
+ name,
3974
+ control,
3975
+ disabled,
3976
+ defaultValue,
3977
+ ...props
3978
+ }) => {
3979
+ const { field, fieldState } = reactHookForm.useController({ name, control, disabled, defaultValue });
3980
+ const [selected, setSelected] = React.useState();
3981
+ React.useEffect(() => {
3982
+ if (isDate(field.value) && field.value !== selected) {
3983
+ setSelected(field.value);
3984
+ }
3985
+ }, [field.value]);
3986
+ return /* @__PURE__ */ jsxRuntime.jsx(
3987
+ salesFrontendDesignSystem.DatePickerSingleRenew,
3988
+ {
3989
+ validator: () => {
3990
+ if (props.validator) {
3991
+ return props.validator();
3992
+ }
3993
+ const _fieldState = fieldState;
3994
+ if (_fieldState.invalid) {
3995
+ throw new Error(_fieldState.error?.message ?? "");
3996
+ }
3997
+ return true;
3998
+ },
3999
+ defaultValue: dayjs(selected),
4000
+ onValueChange: field.onChange,
4001
+ inputProps: {
4002
+ comboBoxItemProps: {
4003
+ tabIndex: 0,
4004
+ id: field.name,
4005
+ ...props.inputProps?.comboBoxItemProps,
4006
+ ...field
4007
+ },
4008
+ ...props.inputProps
4009
+ },
4010
+ ...props
4011
+ }
4012
+ );
4013
+ };
4014
+
4015
+ const FormDateRangePickerRenew = ({
4016
+ name,
4017
+ control,
4018
+ disabled,
4019
+ defaultValue,
4020
+ startDateProps,
4021
+ endDateProps
4022
+ }) => {
4023
+ const { field, fieldState } = reactHookForm.useController({
4024
+ name,
4025
+ control,
4026
+ disabled,
4027
+ defaultValue
4028
+ });
4029
+ const [selected, setSelected] = React.useState();
4030
+ React.useEffect(() => {
4031
+ const fieldValue = field.value;
4032
+ if (!fieldValue) {
4033
+ setSelected(void 0);
4034
+ return;
4035
+ }
4036
+ const isStartDateDifferent = fieldValue.startDate?.getTime() !== selected?.startDate?.getTime();
4037
+ const isEndDateDifferent = fieldValue.endDate?.getTime() !== selected?.endDate?.getTime();
4038
+ if (!selected || isStartDateDifferent || isEndDateDifferent) {
4039
+ setSelected(fieldValue);
4040
+ }
4041
+ }, [field.value]);
4042
+ return /* @__PURE__ */ jsxRuntime.jsx(
4043
+ salesFrontendDesignSystem.DatePickerRangeRenew,
4044
+ {
4045
+ startDateProps: {
4046
+ validator: () => {
4047
+ const _fieldState = fieldState;
4048
+ if (_fieldState.invalid) {
4049
+ throw new Error(_fieldState.error?.message ?? "");
4050
+ }
4051
+ return true;
4052
+ },
4053
+ defaultValue: dayjs(selected?.startDate),
4054
+ onValueChange: field.onChange,
4055
+ inputProps: {
4056
+ comboBoxItemProps: {
4057
+ tabIndex: 0,
4058
+ id: field.name,
4059
+ ...startDateProps?.inputProps?.comboBoxItemProps,
4060
+ ...field
4061
+ },
4062
+ ...startDateProps?.inputProps
4063
+ },
4064
+ ...startDateProps
4065
+ },
4066
+ endDateProps: {
4067
+ validator: () => {
4068
+ const _fieldState = fieldState;
4069
+ if (_fieldState.invalid) {
4070
+ throw new Error(_fieldState.error?.message ?? "");
4071
+ }
4072
+ return true;
4073
+ },
4074
+ defaultValue: dayjs(selected?.endDate),
4075
+ onValueChange: field.onChange,
4076
+ inputProps: {
4077
+ comboBoxItemProps: {
4078
+ tabIndex: 0,
4079
+ id: field.name,
4080
+ ...endDateProps?.inputProps?.comboBoxItemProps,
4081
+ ...field
4082
+ },
4083
+ ...endDateProps?.inputProps
4084
+ },
4085
+ ...endDateProps
4086
+ }
4087
+ }
4088
+ );
4089
+ };
4090
+
3972
4091
  const cx$1 = classNames.bind(styles$c);
3973
4092
  const StepIndicator = ({
3974
4093
  items,
@@ -4059,7 +4178,14 @@ function Attachment({
4059
4178
  }
4060
4179
  return photos.map((photo) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cx("single-photo-item"), children: [
4061
4180
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx("photo-placeholder"), children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: photo.src, alt: photo.name, className: cx("photo-image") }) }),
4062
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: cx("remove-button"), onClick: () => handleRemovePhoto(photo.id), "aria-label": "\uC0AC\uC9C4 \uC0AD\uC81C", children: "\xD7" })
4181
+ /* @__PURE__ */ jsxRuntime.jsx(
4182
+ "button",
4183
+ {
4184
+ className: cx("remove-button", "dsp-icons", "dsp-icons-icons-sub-ui-reset"),
4185
+ onClick: () => handleRemovePhoto(photo.id),
4186
+ "aria-label": "\uC0AC\uC9C4 \uC0AD\uC81C"
4187
+ }
4188
+ )
4063
4189
  ] }, photo.id));
4064
4190
  };
4065
4191
  const renderPhotoGrid = () => {
@@ -4976,7 +5102,9 @@ exports.EmployeeSearchModal = EmployeeSearchModal;
4976
5102
  exports.FormCheckbox = FormCheckbox;
4977
5103
  exports.FormCheckboxButton = FormCheckboxButton;
4978
5104
  exports.FormDatePicker = FormDatePicker;
5105
+ exports.FormDatePickerRenew = FormDatePickerRenew;
4979
5106
  exports.FormDateRangePicker = FormDateRangePicker;
5107
+ exports.FormDateRangePickerRenew = FormDateRangePickerRenew;
4980
5108
  exports.FormSearchJobField = FormSearchJobField;
4981
5109
  exports.FormSegmentGroup = FormSegmentGroup;
4982
5110
  exports.FormSelect = FormSelect;