@colisweb/rescript-toolkit 4.28.0 → 4.29.1

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.28.0",
3
+ "version": "4.29.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -1,10 +1,18 @@
1
1
  type status = [#success | #error | #warning | #info]
2
-
2
+ type size = [#xs | #sm | #md]
3
3
  @react.component
4
- let make = (~title, ~description=?, ~status, ~className=?) =>
4
+ let make = (
5
+ ~title,
6
+ ~description=?,
7
+ ~status,
8
+ ~className=?,
9
+ ~icon: option<module(ReactIcons.Icon)>=?,
10
+ ~size: size=#md,
11
+ ~borderless=false,
12
+ ) =>
5
13
  <div
6
14
  className={cx([
7
- "p-4 flex items-center border rounded-lg",
15
+ "flex border rounded-lg",
8
16
  switch status {
9
17
  | #success => "bg-success-50 border-success-500"
10
18
  | #error => "bg-danger-50 border-danger-500"
@@ -12,15 +20,33 @@ let make = (~title, ~description=?, ~status, ~className=?) =>
12
20
  | #info => "bg-info-50 border-info-500"
13
21
  },
14
22
  className->Option.getWithDefault(""),
23
+ switch size {
24
+ | #md => "p-4"
25
+ | #sm => "p-2"
26
+ | #xs => "p-1"
27
+ },
28
+ borderless ? "!border-none" : "",
15
29
  ])}>
16
- {switch status {
17
- | #success => <ReactIcons.MdCheckCircle size=28 className="text-success-600 flex-shrink-0" />
18
- | #error => <ReactIcons.MdWarning size=28 className="text-danger-600 flex-shrink-0" />
19
- | #warning =>
30
+ {switch (status, icon) {
31
+ | (#success, None) =>
32
+ <ReactIcons.MdCheckCircle size=28 className="text-success-600 flex-shrink-0" />
33
+ | (#success, Some(module(Icon))) => <Icon size=28 className="text-success-600 flex-shrink-0" />
34
+ | (#error, None) => <ReactIcons.MdWarning size=28 className="text-danger-600 flex-shrink-0" />
35
+ | (#error, Some(module(Icon))) => <Icon size=28 className="text-danger-600 flex-shrink-0" />
36
+ | (#warning, None) =>
20
37
  <ReactIcons.FaExclamationTriangle size=28 className="text-warning-600 flex-shrink-0" />
21
- | #info => <ReactIcons.FaInfoCircle size=28 className="text-info-600 flex-shrink-0" />
38
+ | (#warning, Some(module(Icon))) => <Icon size=28 className="text-warning-600 flex-shrink-0" />
39
+ | (#info, None) => <ReactIcons.FaInfoCircle size=28 className="text-info-600 flex-shrink-0" />
40
+ | (#info, Some(module(Icon))) => <Icon size=28 className="text-info-600 flex-shrink-0" />
22
41
  }}
23
- <div className="mx-3">
42
+ <div
43
+ className={cx([
44
+ switch size {
45
+ | #md => "mx-3"
46
+ | #sm => "mx-2"
47
+ | #xs => "mx-1"
48
+ },
49
+ ])}>
24
50
  <div
25
51
  className={cx([
26
52
  description->Option.isSome ? "font-semibold" : "",
@@ -1,4 +1,5 @@
1
1
  type status = [#success | #error | #warning | #info]
2
+ type size = [#xs | #sm | #md]
2
3
 
3
4
  @react.component
4
5
  let make: (
@@ -6,4 +7,7 @@ let make: (
6
7
  ~description: React.element=?,
7
8
  ~status: status,
8
9
  ~className: string=?,
10
+ ~icon: module(ReactIcons.Icon)=?,
11
+ ~size: size=?,
12
+ ~borderless: bool=?,
9
13
  ) => React.element
@@ -6152,3 +6152,9 @@ module MdBarcodeReader = {
6152
6152
  external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
6153
6153
  "MdBarcodeReader"
6154
6154
  }
6155
+
6156
+ module FaChevronCircleRight = {
6157
+ @module("react-icons/fa") @react.component
6158
+ external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
6159
+ "FaChevronCircleRight"
6160
+ }