@colisweb/rescript-toolkit 4.7.0 → 4.7.2

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.7.0",
3
+ "version": "4.7.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -725,7 +725,13 @@ module Make = (StateLenses: Config) => {
725
725
  module DatePicker = {
726
726
  module Picker = {
727
727
  @react.component
728
- let make = (~value, ~handleChange, ~containerClassName, ~placeholder) => {
728
+ let make = (
729
+ ~value,
730
+ ~handleChange,
731
+ ~containerClassName,
732
+ ~placeholder,
733
+ ~disabledBefore: option<Js.Date.t>=?,
734
+ ) => {
729
735
  let (date, setDate) = React.useState((): option<Js.Date.t> => value)
730
736
  let intl = useIntl()
731
737
 
@@ -763,14 +769,29 @@ module Make = (StateLenses: Config) => {
763
769
  <ReactDayPicker.ReactDayPicker.DayPicker
764
770
  className="cw-Datepicker"
765
771
  showOutsideDays=true
772
+ modifiers={disabledBefore->Option.mapWithDefault(
773
+ Js.Obj.empty()->Obj.magic,
774
+ disabledBefore => {
775
+ {
776
+ "disabled": {
777
+ "before": disabledBefore,
778
+ },
779
+ }->Obj.magic
780
+ },
781
+ )}
766
782
  locale={intl->Intl.locale}
767
783
  months=Toolkit__LocalesHelpers.DatePicker.Fr.months
768
784
  weekdaysShort=Toolkit__LocalesHelpers.DatePicker.Fr.weekdaysShort
769
785
  firstDayOfWeek=1
770
786
  selectedDays=(date->Obj.magic, {from: Js.Nullable.null, to_: Js.Nullable.null})
771
787
  onDayClick={(
772
- (day, _) => {
773
- setDate(_ => Some(day))
788
+ (day, modifiers) => {
789
+ let disabled: option<bool> = (modifiers->Obj.magic)["disabled"]
790
+
791
+ switch disabled {
792
+ | Some(true) => ()
793
+ | _ => setDate(_ => Some(day))
794
+ }
774
795
  }
775
796
  )->Obj.magic}
776
797
  />
@@ -801,7 +822,15 @@ module Make = (StateLenses: Config) => {
801
822
  }
802
823
  }
803
824
  @react.component
804
- let make = (~field, ~label=?, ~id, ~isOptional=?, ~containerClassName="", ~placeholder=?) => {
825
+ let make = (
826
+ ~field,
827
+ ~label=?,
828
+ ~id,
829
+ ~isOptional=?,
830
+ ~containerClassName="",
831
+ ~placeholder=?,
832
+ ~disabledBefore=?,
833
+ ) => {
805
834
  <Form.Field
806
835
  field
807
836
  render={({handleChange, value, error}) => <>
@@ -816,7 +845,7 @@ module Make = (StateLenses: Config) => {
816
845
  label
817
846
  </Toolkit__Ui_Label>
818
847
  }}
819
- <Picker value handleChange containerClassName placeholder />
848
+ <Picker value handleChange containerClassName placeholder ?disabledBefore />
820
849
  <ErrorMessage ?error />
821
850
  </>}
822
851
  />
@@ -45,13 +45,13 @@ let make = (
45
45
  | #lg => "w-10 h-10"
46
46
  },
47
47
  ])}>
48
- <ReactIcons.GoPrimitiveDot
48
+ <ReactIcons.FaCircle
49
49
  className="transform transition-all ease-in-out"
50
50
  size={switch size {
51
- | #xs => 12
52
- | #sm => 16
53
- | #md => 24
54
- | #lg => 32
51
+ | #xs => 8
52
+ | #sm => 12
53
+ | #md => 18
54
+ | #lg => 24
55
55
  }}
56
56
  />
57
57
  </span>