@colisweb/rescript-toolkit 5.6.9 → 5.7.0

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.9",
3
+ "version": "5.7.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -5,6 +5,7 @@ let make = (
5
5
  ~className="",
6
6
  ~textClassName="",
7
7
  ~copyButtonSize=9,
8
+ ~onReferenceClick=?,
8
9
  ) => {
9
10
  let refClipboard = Toolkit__Hooks.useClipboard(reference, ~onCopyNotificationMessage?)
10
11
 
@@ -13,7 +14,9 @@ let make = (
13
14
  "flex flex-row items-center bg-info-50 text-info-700 min-w-0 w-full",
14
15
  className,
15
16
  ])}>
16
- <p className={cx(["font-mono w-full text-sm pl-2 truncate", textClassName])}>
17
+ <p
18
+ onClick={_ => onReferenceClick->Option.forEach(fn => fn())}
19
+ className={cx(["font-mono w-full text-sm pl-2 truncate", textClassName])}>
17
20
  {reference->React.string}
18
21
  </p>
19
22
  <Toolkit__Ui_IconButton
@@ -9,4 +9,5 @@ let make: (
9
9
  ~className: string=?,
10
10
  ~textClassName: string=?,
11
11
  ~copyButtonSize: int=?,
12
+ ~onReferenceClick: unit => unit=?,
12
13
  ) => React.element
@@ -56,7 +56,7 @@ let make = (
56
56
  ) => {
57
57
  let {isSm} = Toolkit__Hooks.useMediaQuery()
58
58
 
59
- let periodLength = isSm ? periodLength->Option.getWithDefault(7) : 3
59
+ let periodLength = periodLength->Option.getWithDefault(isSm ? 7 : 3)
60
60
 
61
61
  let ({period, selectedDay}, dispatch) = ReactUpdate.useReducerWithMapState(
62
62
  (state, action) =>
@@ -203,14 +203,16 @@ let make = (
203
203
  <FormattedDate value=day day=#"2-digit" />
204
204
  </span>
205
205
  </p>
206
- <p
207
- className="text-xs text-info-500 bg-info-50 text-center mt-1 font-semibold rounded-sm">
208
- {counters
209
- ->Option.flatMap(counters =>
210
- counters->Js.Dict.get(day->DateFns.formatWithPattern("yyyy-MM-dd"))
211
- )
212
- ->Option.mapWithDefault(React.null, React.int)}
213
- </p>
206
+ {counters
207
+ ->Option.flatMap(counters =>
208
+ counters->Js.Dict.get(day->DateFns.formatWithPattern("yyyy-MM-dd"))
209
+ )
210
+ ->Option.mapWithDefault(React.null, value => {
211
+ <p
212
+ className="text-xs text-info-500 bg-info-50 text-center mt-1 font-semibold rounded-sm">
213
+ {value->React.int}
214
+ </p>
215
+ })}
214
216
  </div>
215
217
  </React.Fragment>
216
218
  })