@colisweb/rescript-toolkit 4.18.2 → 4.18.4

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.18.2",
3
+ "version": "4.18.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -50,10 +50,10 @@ let make = (
50
50
  | #white => "border border-white text-white"
51
51
  | #gray => "border border-gray-400 text-gray-700"
52
52
  | #primary => "border border-primary-500 text-primary-500"
53
- | #info => "border border-info-600 text-info-600"
54
- | #danger => "border border-danger-600 text-danger-600"
55
- | #warning => "border text-warning-700 border-warning-700"
56
- | #success => "border text-success-700 border-success-700"
53
+ | #info => "border border-info-600 text-info-600 bg-info-50"
54
+ | #danger => "border border-danger-600 text-danger-600 bg-danger-50"
55
+ | #warning => "border bg-warning-50 text-warning-700 border-warning-700"
56
+ | #success => "border bg-success-50 text-success-700 border-success-700"
57
57
  | #neutral => "border text-neutral-600 border-neutral-600"
58
58
  }
59
59
  }
@@ -57,18 +57,22 @@ let make = (~initialStart=?, ~selectedDay=?, ~children: state => React.element)
57
57
  ),
58
58
  },
59
59
  ({state}) => {
60
- RescriptReactRouter.replace(
61
- Qs.stringifyWithParams(
62
- {
63
- start: Some(state.timeslot.start),
64
- selectedDay: state.selectedDay,
65
- }->queryParams_encode,
66
- {
67
- addQueryPrefix: true,
68
- serializeDate: d => d->DateFns.formatWithPattern("yyyy-MM-dd"),
69
- },
70
- ),
60
+ open Browser
61
+ let search = Location.location->Location.search->Js.String2.sliceToEnd(~from=1)
62
+ let searchParams = URLSearchParams.make(search)
63
+
64
+ searchParams->URLSearchParams.set(
65
+ "start",
66
+ state.timeslot.start->DateFns.formatWithPattern("yyyy-MM-dd"),
71
67
  )
68
+ state.selectedDay->Option.forEach(selectedDay => {
69
+ searchParams->URLSearchParams.set(
70
+ "selectedDay",
71
+ selectedDay->DateFns.formatWithPattern("yyyy-MM-dd"),
72
+ )
73
+ })
74
+
75
+ RescriptReactRouter.replace("?" ++ searchParams->URLSearchParams.toString())
72
76
  None
73
77
  },
74
78
  )
@@ -105,6 +105,18 @@ module URL = {
105
105
  external setSearchParams: (t, string, string) => unit = "set"
106
106
  }
107
107
 
108
+ module URLSearchParams = {
109
+ type t
110
+
111
+ @new
112
+ external make: string => t = "URLSearchParams"
113
+
114
+ @send
115
+ external set: (t, string, string) => unit = "set"
116
+ @send
117
+ external toString: (t, unit) => string = "toString"
118
+ }
119
+
108
120
  module History = {
109
121
  type t
110
122
 
@@ -78,6 +78,18 @@ module URL: {
78
78
  external setSearchParams: (t, string, string) => unit = "set"
79
79
  }
80
80
 
81
+ module URLSearchParams: {
82
+ type t
83
+
84
+ @new
85
+ external make: string => t = "URLSearchParams"
86
+
87
+ @send
88
+ external set: (t, string, string) => unit = "set"
89
+ @send
90
+ external toString: (t, unit) => string = "toString"
91
+ }
92
+
81
93
  module History: {
82
94
  type t
83
95