@colisweb/rescript-toolkit 5.6.4 → 5.6.6

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": "5.6.4",
3
+ "version": "5.6.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -1,4 +1,4 @@
1
- type color = [#success | #danger | #warning | #info]
1
+ type color = [#success | #danger | #warning | #info | #primary]
2
2
 
3
3
  @react.component
4
4
  let make = (~progression: float, ~color: color=#success) =>
@@ -12,6 +12,7 @@ let make = (~progression: float, ~color: color=#success) =>
12
12
  | #danger => "bg-danger-500"
13
13
  | #warning => "bg-warning-500"
14
14
  | #info => "bg-info-500"
15
+ | #primary => "bg-primary-600"
15
16
  },
16
17
  ])}
17
18
  />
@@ -1,4 +1,4 @@
1
- type color = [#success | #danger | #warning | #info]
1
+ type color = [#success | #danger | #warning | #info | #primary]
2
2
 
3
3
  @react.component
4
4
  let make: (~progression: float, ~color: color=?) => React.element
@@ -49,6 +49,10 @@ let make = (
49
49
  ~children,
50
50
  ~onChange: option<state => unit>=?,
51
51
  ~disabledBefore: option<Js.Date.t>=?,
52
+ ~showMonths=true,
53
+ ~selectedDateClassName="",
54
+ ~dateClassName="",
55
+ ~periodButtonClassName="",
52
56
  ) => {
53
57
  let {isSm} = Toolkit__Hooks.useMediaQuery()
54
58
 
@@ -149,6 +153,7 @@ let make = (
149
153
  variant=#outline
150
154
  color=#neutral
151
155
  onClick={_ => dispatch(PreviousPeriod)}
156
+ className=periodButtonClassName
152
157
  ariaLabel="previous week"
153
158
  disabled=?{disabledBefore->Option.map(disabledBefore => {
154
159
  let isPreviousPeriodOutOfBounds =
@@ -157,7 +162,7 @@ let make = (
157
162
  })}
158
163
  icon={<ReactIcons.MdKeyboardArrowLeft size=30 />}
159
164
  />
160
- <div className="flex items-center mx-2">
165
+ <div className="flex items-center gap-1 mx-1 md:mx-2">
161
166
  {days
162
167
  ->Array.mapWithIndex((i, day) => {
163
168
  let formattedDay =
@@ -170,7 +175,7 @@ let make = (
170
175
  day->DateFns.isBefore(disabledBefore)
171
176
  )
172
177
  <React.Fragment key={i->Int.toString ++ "-day"}>
173
- {i == 0 || day->DateFns.isFirstDayOfMonth
178
+ {(i == 0 || day->DateFns.isFirstDayOfMonth) && showMonths
174
179
  ? <p className="text-xs text-neutral-700 uppercase">
175
180
  <FormattedDate value=day month=#short />
176
181
  </p>
@@ -178,13 +183,15 @@ let make = (
178
183
  <div
179
184
  onClick={_ => isDisabled ? () : dispatch(UpdateSelectedDay(day))}
180
185
  className={cx([
181
- "flex flex-col items-stretch w-16 mx-1 font-display",
186
+ "flex flex-col items-stretch w-14 sm:w-16 font-display",
182
187
  isDisabled ? "opacity-50 cursor-not-allowed" : "",
183
188
  ])}>
184
189
  <p
185
190
  className={cx([
186
191
  "flex flex-col items-center justify-center uppercase text-xs w-full rounded-sm leading-tight py-1",
187
- isSelected ? "text-white bg-primary-700" : "text-primary-700 bg-primary-50",
192
+ isSelected
193
+ ? "text-white bg-primary-700 " ++ selectedDateClassName
194
+ : "text-primary-700 bg-primary-50 " ++ dateClassName,
188
195
  ])}>
189
196
  <span>
190
197
  {formattedDay
@@ -213,6 +220,7 @@ let make = (
213
220
  size=#xs
214
221
  variant=#outline
215
222
  color=#neutral
223
+ className=periodButtonClassName
216
224
  onClick={_ => dispatch(NextPeriod)}
217
225
  ariaLabel="next week"
218
226
  icon={<ReactIcons.MdKeyboardArrowRight size=30 />}