@colisweb/rescript-toolkit 4.14.12 → 4.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "4.14.12",
3
+ "version": "4.14.14",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -63,7 +63,7 @@ module Core = {
63
63
  ? <Toolkit__Ui_Spread
64
64
  key={"thead-th" ++ index->Int.toString} props={column.getHeaderProps()}>
65
65
  <td
66
- className="px-2 pt-2 border-b border-r border-gray-300 xl:h-20"
66
+ className="px-2 pt-2 border-b border-r border-gray-300 xl:min-h-[5rem]"
67
67
  key={"thead-thd" ++ index->Int.toString}>
68
68
  <Toolkit__Ui_Spread props={column.getSortByToggleProps()}>
69
69
  <div
@@ -356,7 +356,7 @@ module RangeDayPickerInput = {
356
356
  ~modifiersClassNames: modifiersClassNames=?,
357
357
  ~defaultMonth: Js.Date.t=?,
358
358
  ) => {
359
- let (validatedRange, setValidatedRange) = React.useState(() => value)
359
+ let previousValue = Toolkit__Hooks.usePrevious(value)
360
360
 
361
361
  let (state, dispatch) = ReactUpdate.useReducerWithMapState(
362
362
  (state, action) =>
@@ -457,7 +457,9 @@ module RangeDayPickerInput = {
457
457
  dropdownClassName
458
458
  buttonClassName={cx(["min-w-[100px] h-[38px]", buttonClassName])}
459
459
  label={<div className={cx(["absolute", labelClassName])}>
460
- {validatedRange->Option.mapWithDefault(
460
+ {previousValue
461
+ ->Option.flatMap(v => v)
462
+ ->Option.mapWithDefault(
461
463
  placeholder->Option.getWithDefault("-"->React.string),
462
464
  labelFormatter,
463
465
  )}
@@ -579,7 +581,6 @@ module RangeDayPickerInput = {
579
581
  ? <Toolkit__Ui_Button
580
582
  onClick={_ => {
581
583
  dispatch(ResetRange)
582
- setValidatedRange(_ => None)
583
584
  onChange(None)
584
585
  disclosure.hide()
585
586
  }}>
@@ -588,19 +589,19 @@ module RangeDayPickerInput = {
588
589
  : React.null}
589
590
  <Toolkit__Ui_Button
590
591
  onClick={_ => {
591
- dispatch(UpdateRange(validatedRange))
592
592
  disclosure.hide()
593
593
  }}>
594
594
  <ReactIntl.FormattedMessage defaultMessage="Annuler" />
595
595
  </Toolkit__Ui_Button>
596
596
  <Toolkit__Ui_Button
597
597
  color=#success
598
- disabled={allowEmpty
599
- ? false
600
- : state.range->Option.flatMap(e => e.from)->Option.isNone ||
601
- state.range->Option.flatMap(e => e.to)->Option.isNone}
598
+ disabled={switch state.range {
599
+ | _ if allowEmpty => false
600
+ | Some({from: ?None})
601
+ | Some({to: ?None}) => true
602
+ | _ => false
603
+ }}
602
604
  onClick={_ => {
603
- setValidatedRange(_ => state.range)
604
605
  onChange(state.range)
605
606
  disclosure.hide()
606
607
  }}>