@colisweb/rescript-toolkit 2.46.0 → 2.46.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": "2.46.0",
3
+ "version": "2.46.1",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build -with-deps",
@@ -77,7 +77,8 @@
77
77
  "rescript-react-update": "5.0.0",
78
78
  "sanitize-html": "2.7.0",
79
79
  "swr": "1.3.0",
80
- "tailwindcss": "3.1.4"
80
+ "tailwindcss": "3.1.4",
81
+ "@tailwindcss/line-clamp": "0.4.0"
81
82
  },
82
83
  "devDependencies": {
83
84
  "@babel/core": "7.18.6",
@@ -11,7 +11,8 @@ module.exports = {
11
11
  },
12
12
  boxShadow: {
13
13
  sidenav: "inset 0 0 1px 2px rgba(0, 0, 0, 0.2)",
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)",
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)",
15
16
  },
16
17
  borderColor: {
17
18
  currentColor: "currentColor",
@@ -149,6 +150,7 @@ module.exports = {
149
150
  },
150
151
  },
151
152
  },
153
+ plugins: [require("@tailwindcss/line-clamp")],
152
154
  content: [
153
155
  "public/index.html",
154
156
  "lib/es6_global/src/**/**.js",
@@ -18,18 +18,20 @@ let make = (
18
18
  ~buttonVariant: Toolkit__Ui_Button.variant=#default,
19
19
  ~position=#bottom,
20
20
  ) => {
21
- let ref = React.useRef(Js.Nullable.null)
21
+ let dropDownRef = React.useRef(Js.Nullable.null)
22
+ let buttonRef = React.useRef(Js.Nullable.null)
22
23
  let (position, setPosition) = React.useState(() => position)
23
24
  let {isOpen, hide, toggle} = Toolkit__Hooks.useDisclosure(~defaultIsOpen, ())
24
25
 
25
- Toolkit__Hooks.useOnClickOutside(ref, _ => {
26
+ Toolkit__Hooks.useOnClickOutside(buttonRef, _ => {
26
27
  hide()
27
28
  })
29
+
28
30
  let (adjustmentStyle, setAdjustmentStyle) = React.useState(() => None)
29
31
 
30
32
  React.useEffect2(() => {
31
33
  if isOpen {
32
- ref.current
34
+ dropDownRef.current
33
35
  ->Js.Nullable.toOption
34
36
  ->Option.forEach(dom => {
35
37
  let {left, right} = dom->Browser.DomElement.getBoundingClientRect
@@ -52,7 +54,7 @@ let make = (
52
54
  setAdjustmentStyle(_ => None)
53
55
  }
54
56
  None
55
- }, (isOpen, ref))
57
+ }, (isOpen, dropDownRef))
56
58
 
57
59
  <div className={cx(["relative", containerClassName])}>
58
60
  <Toolkit__Ui_Button
@@ -60,11 +62,12 @@ let make = (
60
62
  size=buttonSize
61
63
  type_="button"
62
64
  color=buttonColor
65
+ buttonRef={ReactDOM.Ref.domRef(buttonRef)}
63
66
  onClick={event => {
64
- switch ref.current->Js.Nullable.toOption {
67
+ switch dropDownRef.current->Js.Nullable.toOption {
65
68
  | None => toggle()
66
- | Some(domRef) => {
67
- let isInDropdown = ReactEvent.Mouse.currentTarget(event)["contains"](. domRef)
69
+ | Some(dropDownRef) => {
70
+ let isInDropdown = ReactEvent.Mouse.currentTarget(event)["contains"](. dropDownRef)
68
71
  if !isInDropdown {
69
72
  toggle()
70
73
  }
@@ -75,7 +78,7 @@ let make = (
75
78
  label
76
79
  {isOpen
77
80
  ? <div
78
- ref={ReactDOM.Ref.domRef(ref)}
81
+ ref={ReactDOM.Ref.domRef(dropDownRef)}
79
82
  className={cx([
80
83
  "dropdown",
81
84
  "absolute z-20 bg-white p-2 transform shadow rounded text-base font-normal text-neutral-700 opacity-0",
@@ -45,6 +45,7 @@ module Core = {
45
45
  ~className="",
46
46
  ~emptyMessage,
47
47
  ~additionalRow: option<(ReactTable.instanceRow<'a>, 'a) => React.element>=?,
48
+ ~trClassName="",
48
49
  ) =>
49
50
  <div className={cx([className, "flex flex-auto w-full overflow-x-auto relative"])}>
50
51
  <Toolkit__Ui_Spread props={table.getTableProps()}>
@@ -98,7 +99,7 @@ module Core = {
98
99
 
99
100
  <React.Fragment key={"tr" ++ index->Int.toString}>
100
101
  <Toolkit__Ui_Spread props={row.getRowProps()}>
101
- <tr className={"block even:bg-gray-200 min-h-[5.5rem]"}>
102
+ <tr className={cx([trClassName, "block even:bg-gray-200 min-h-[5.5rem]"])}>
102
103
  {row.cells
103
104
  ->Array.mapWithIndex((index, cell) =>
104
105
  <Toolkit__Ui_Spread
@@ -10,6 +10,7 @@ module Core: {
10
10
  ~className: string=?,
11
11
  ~emptyMessage: string,
12
12
  ~additionalRow: (ReactTable.instanceRow<'a>, 'a) => React.element=?,
13
+ ~trClassName: string=?,
13
14
  ) => React.element
14
15
  }
15
16