@colisweb/rescript-toolkit 3.1.4 → 3.1.5

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -12,6 +12,7 @@ module Header = {
12
12
  ~action: option<action>=?,
13
13
  ~actionDisabled: option<bool>=?,
14
14
  ~containerClassName="",
15
+ ~buttonTestId="",
15
16
  ) =>
16
17
  <div className={cx(["flex flex-row items-center mb-4", containerClassName])}>
17
18
  <div
@@ -21,17 +22,20 @@ module Header = {
21
22
  ])}>
22
23
  children
23
24
  </div>
24
- {action->Option.mapWithDefault(React.null, ({label, event}) =>
25
- <Toolkit__Ui_Button
26
- variant=#pill
27
- size=#xs
28
- color=#info
29
- onClick={_ => event()}
30
- disabled={actionDisabled->Option.getWithDefault(false)}
31
- className="flex-shrink-0 ml-4">
32
- label
33
- </Toolkit__Ui_Button>
34
- )}
25
+ {action->Option.mapWithDefault(React.null, ({label, event}) => {
26
+ let btn =
27
+ <Toolkit__Ui_Button
28
+ variant=#pill
29
+ size=#xs
30
+ color=#info
31
+ onClick={_ => event()}
32
+ disabled={actionDisabled->Option.getWithDefault(false)}
33
+ className="flex-shrink-0 ml-4">
34
+ label
35
+ </Toolkit__Ui_Button>
36
+
37
+ React.cloneElement(btn, {"data-testid": cx(["card-header-button", buttonTestId])})
38
+ })}
35
39
  </div>
36
40
  }
37
41
 
@@ -44,7 +48,9 @@ module Body = {
44
48
  module FixedBody = {
45
49
  @react.component
46
50
  let make = (~className="", ~children=React.null) =>
47
- <Body> <div className={cx([className, "overflow-y-auto h-full"])}> children </div> </Body>
51
+ <Body>
52
+ <div className={cx([className, "overflow-y-auto h-full"])}> children </div>
53
+ </Body>
48
54
  }
49
55
 
50
56
  module Message = {
@@ -66,7 +72,10 @@ module Message = {
66
72
  | #error => "text-danger-600 bg-danger-50"
67
73
  }
68
74
 
69
- <div className={cx([className, "px-6 py-4 flex", color])}> icon <div> children </div> </div>
75
+ <div className={cx([className, "px-6 py-4 flex", color])}>
76
+ icon
77
+ <div> children </div>
78
+ </div>
70
79
  }
71
80
  }
72
81
 
@@ -11,6 +11,7 @@ module Header: {
11
11
  ~action: action=?,
12
12
  ~actionDisabled: bool=?,
13
13
  ~containerClassName: string=?,
14
+ ~buttonTestId: string=?,
14
15
  ) => React.element
15
16
  }
16
17