@northlight/ui 2.33.8 → 2.33.10

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.
@@ -908,6 +908,7 @@ interface DatePickerProps extends AriaDatePickerProps<DateValue>, DatePickerSett
908
908
  }
909
909
  interface DateRangePickerProps extends Omit<AriaDateRangePickerProps<DateValue>, 'onChange' | 'value' | 'minValue' | 'maxValue'>, DatePickerSettings {
910
910
  onChange?: (date: null | DateRange) => void;
911
+ onSave?: () => void;
911
912
  value: DateRange | null;
912
913
  minValue?: string | undefined;
913
914
  maxValue?: string | undefined;
@@ -925,6 +926,7 @@ interface DatePickerFieldProps extends Omit<InputProps, 'onChange'>, InputFieldP
925
926
  direction?: StackDirection;
926
927
  dateFormat?: string;
927
928
  onChange?: (date: DateValue) => void;
929
+ onSave?: () => void;
928
930
  isClearable?: boolean;
929
931
  fiscalStartMonth?: number;
930
932
  fiscalStartDay?: number;
@@ -7448,7 +7448,8 @@ const RangeCalendar = (props) => {
7448
7448
  fiscalStartDay,
7449
7449
  minValue,
7450
7450
  maxValue,
7451
- firstDayOfWeek
7451
+ firstDayOfWeek,
7452
+ onSave
7452
7453
  } = props;
7453
7454
  const { locale } = useLocale();
7454
7455
  const ref = useRef(null);
@@ -7494,6 +7495,10 @@ const RangeCalendar = (props) => {
7494
7495
  maxValue
7495
7496
  };
7496
7497
  const focusedStartMonthProps = value && value.start ? {} : focusRing;
7498
+ const handleSave = () => {
7499
+ onSave == null ? void 0 : onSave();
7500
+ handleClose();
7501
+ };
7497
7502
  return /* @__PURE__ */ React.createElement(Box, { ref, __css: rangeCalendarContainer }, /* @__PURE__ */ React.createElement(Stack, null, /* @__PURE__ */ React.createElement(Flex, { gap: 4 }, /* @__PURE__ */ React.createElement(
7498
7503
  QuickSelect,
7499
7504
  {
@@ -7516,7 +7521,7 @@ const RangeCalendar = (props) => {
7516
7521
  range: value,
7517
7522
  firstDayOfWeek
7518
7523
  }
7519
- ))), /* @__PURE__ */ React.createElement(HStack, { pt: "2", alignSelf: "end" }, isClearable && /* @__PURE__ */ React.createElement(Button, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button, { variant: "brand", onClick: handleClose, size: "sm" }, "Save"))))))));
7524
+ ))), /* @__PURE__ */ React.createElement(HStack, { pt: "2", alignSelf: "end" }, isClearable && /* @__PURE__ */ React.createElement(Button, { onClick: resetDate, variant: "ghost", size: "sm" }, "Clear"), /* @__PURE__ */ React.createElement(Button, { variant: "brand", onClick: handleSave, size: "sm" }, "Save"))))))));
7520
7525
  };
7521
7526
 
7522
7527
  const isValidDateRange = (value) => is(Object, value) && has("startDate", value) && has("endDate", value) && is(String, value.startDate) && is(String, value.endDate);
@@ -7569,7 +7574,8 @@ const DateRangePicker = (props) => {
7569
7574
  minValue = "1994-03-08",
7570
7575
  maxValue,
7571
7576
  renderInPortal = false,
7572
- firstDayOfWeek
7577
+ firstDayOfWeek,
7578
+ onSave
7573
7579
  } = props;
7574
7580
  const ref = useRef();
7575
7581
  const { group } = useMultiStyleConfig("DatePicker");
@@ -7652,7 +7658,8 @@ const DateRangePicker = (props) => {
7652
7658
  fiscalStartMonth: fiscalStartMonth || 0,
7653
7659
  fiscalStartDay: fiscalStartDay || 0,
7654
7660
  isClearable,
7655
- firstDayOfWeek
7661
+ firstDayOfWeek,
7662
+ onSave
7656
7663
  })
7657
7664
  )))))
7658
7665
  );
@@ -7840,7 +7847,8 @@ const DateRangePickerField = forwardRef$1((_a, ref) => {
7840
7847
  validate,
7841
7848
  firstDayOfWeek = "monday",
7842
7849
  onChange: onChangeCallback = identity,
7843
- isClearable = true
7850
+ isClearable = true,
7851
+ onSave
7844
7852
  } = _b, rest = __objRest$19(_b, [
7845
7853
  "name",
7846
7854
  "minValue",
@@ -7851,7 +7859,8 @@ const DateRangePickerField = forwardRef$1((_a, ref) => {
7851
7859
  "validate",
7852
7860
  "firstDayOfWeek",
7853
7861
  "onChange",
7854
- "isClearable"
7862
+ "isClearable",
7863
+ "onSave"
7855
7864
  ]);
7856
7865
  const { setValue, setError, trigger } = useFormContext();
7857
7866
  const handleChange = (dateRange) => {
@@ -7883,6 +7892,7 @@ const DateRangePickerField = forwardRef$1((_a, ref) => {
7883
7892
  "aria-label": label,
7884
7893
  isInvalid: !!errors[name],
7885
7894
  onChange: handleChange,
7895
+ onSave,
7886
7896
  resetDate: () => onChange(null),
7887
7897
  value,
7888
7898
  minValue,