@colisweb/rescript-toolkit 2.8.2 → 2.9.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": "2.8.2",
3
+ "version": "2.9.0",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build",
@@ -55,6 +55,7 @@
55
55
  "postcss-loader": "4.2.0",
56
56
  "postcss-preset-env": "6.7.0",
57
57
  "prismjs": "1.25.0",
58
+ "react-datepicker": "3.8.0",
58
59
  "react-icons": "4.3.1",
59
60
  "react-select": "5.2.1",
60
61
  "react-table": "7.7.0",
@@ -67,12 +68,11 @@
67
68
  "rescript-logger": "2.0.2",
68
69
  "rescript-react-update": "5.0.0",
69
70
  "restorative": "0.4.0-beta.1",
71
+ "sanitize-html": "2.6.1",
70
72
  "swr": "1.1.1",
71
- "tailwindcss": "3.0.2",
72
- "react-datepicker": "3.8.0"
73
+ "tailwindcss": "3.0.2"
73
74
  },
74
75
  "devDependencies": {
75
- "highlight.js": "11.3.1",
76
76
  "@babel/core": "7.16.5",
77
77
  "@storybook/addon-actions": "6.1.21",
78
78
  "@storybook/addon-essentials": "6.1.21",
@@ -82,6 +82,7 @@
82
82
  "@storybook/react": "6.1.21",
83
83
  "@storybook/theming": "6.1.21",
84
84
  "babel-loader": "8.2.3",
85
+ "highlight.js": "11.3.1",
85
86
  "raw-loader": "4.0.2",
86
87
  "react": "17.0.2",
87
88
  "react-dom": "17.0.2",
@@ -54,13 +54,18 @@ let toResult = (
54
54
  | Ok(response) =>
55
55
  switch response["data"]->mapData {
56
56
  | Ok(_) as ok => ok
57
- | Error(error) =>
58
- Error(
59
- #invalidResponseData(
60
- response->castToUndecodedResponse,
61
- "\"" ++ (error.path ++ ("\" " ++ error.message)),
62
- ),
63
- )
57
+ | Error(error) => {
58
+ %log.error(
59
+ "Decoder failure"
60
+ ("err", error)
61
+ )
62
+ Error(
63
+ #invalidResponseData(
64
+ response->castToUndecodedResponse,
65
+ "\"" ++ (error.path ++ ("\" " ++ error.message)),
66
+ ),
67
+ )
68
+ }
64
69
  }
65
70
  | Error(error) =>
66
71
  if (error->castToJs)["response"] {
@@ -11,8 +11,7 @@ module.exports = {
11
11
  },
12
12
  boxShadow: {
13
13
  sidenav: "inset 0 0 1px 2px rgba(0, 0, 0, 0.2)",
14
- sm:
15
- "0px 2px 1px -1px rgba(0,0,0,0.1), 0px 1px 1px 0px rgba(0,0,0,0.1), 0px 1px 3px 0px rgba(0,0,0,0.1)",
14
+ sm: "0px 2px 1px -1px rgba(0,0,0,0.1), 0px 1px 1px 0px rgba(0,0,0,0.1), 0px 1px 3px 0px rgba(0,0,0,0.1)",
16
15
  },
17
16
  borderColor: {
18
17
  currentColor: "currentColor",
@@ -142,7 +141,7 @@ module.exports = {
142
141
  purple: {
143
142
  50: "#F8F1FF",
144
143
  100: "#DDC8F0",
145
- 300: "#8787E0",
144
+ 300: "#B787E0",
146
145
  400: "#9151C9",
147
146
  500: "#6C1CB2",
148
147
  600: "#55158B",
@@ -1,7 +1,22 @@
1
1
  let transformUrl = text =>
2
2
  text |> Js.String.unsafeReplaceBy0(%re("/(https?:\\/\\/[^\\s]+)/g"), (url, _, _) =>
3
- j`<a target='_blank' class='text-blue-500 underline' href="$url">$url</a>`
3
+ j`<a target='_blank' class='text-info-500 underline' href="$url">$url</a>`
4
4
  )
5
5
 
6
+ @module("sanitize-html")
7
+ external sanitizeHtml: (string, Js.t<'a>) => string = "default"
8
+
6
9
  @react.component
7
- let make = (~text) => <span dangerouslySetInnerHTML={"__html": text->transformUrl} />
10
+ let make = (~text) =>
11
+ <span
12
+ dangerouslySetInnerHTML={
13
+ "__html": text
14
+ ->sanitizeHtml({
15
+ "allowedTags": ["a"],
16
+ "allowedAttributes": {
17
+ "a": ["href"],
18
+ },
19
+ })
20
+ ->transformUrl,
21
+ }
22
+ />
@@ -5893,3 +5893,9 @@ module FaFilter = {
5893
5893
  external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
5894
5894
  "FaFilter"
5895
5895
  }
5896
+
5897
+ module IoIosCloseCircle = {
5898
+ @module("react-icons/io") @react.component
5899
+ external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
5900
+ "IoIosCloseCircle"
5901
+ }