@colisweb/rescript-toolkit 2.22.0 → 2.23.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
|
@@ -42,6 +42,18 @@ let make = (
|
|
|
42
42
|
~color=#primary,
|
|
43
43
|
) => {
|
|
44
44
|
let (isChecked, setIsChecked) = React.useState(() => checked->Option.getWithDefault(false))
|
|
45
|
+
let previousChecked = Toolkit__Hooks.usePrevious(checked)
|
|
46
|
+
|
|
47
|
+
React.useEffect2(() => {
|
|
48
|
+
checked->Option.forEach(checked => {
|
|
49
|
+
switch (previousChecked, checked) {
|
|
50
|
+
| (Some(Some(c1)), c2) if c1 != c2 => setIsChecked(_ => c2)
|
|
51
|
+
| _ => ()
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
None
|
|
56
|
+
}, (checked, previousChecked))
|
|
45
57
|
|
|
46
58
|
<label
|
|
47
59
|
ref=?switchRef
|
|
@@ -53,7 +65,7 @@ let make = (
|
|
|
53
65
|
])}>
|
|
54
66
|
<span
|
|
55
67
|
className={cx([
|
|
56
|
-
"flex items-center relative rounded-full py-[2px] cursor-pointer border transition-all",
|
|
68
|
+
"shrink-0 flex items-center relative rounded-full py-[2px] cursor-pointer border transition-all",
|
|
57
69
|
getLabelSize(size),
|
|
58
70
|
isChecked
|
|
59
71
|
? switch color {
|
|
@@ -84,7 +96,7 @@ let make = (
|
|
|
84
96
|
<span
|
|
85
97
|
className={cx([
|
|
86
98
|
"rounded-full shadow transition duration-200 ease-linear transform bg-white",
|
|
87
|
-
isChecked ? getTranslateBySize(size) : "translate-x-
|
|
99
|
+
isChecked ? getTranslateBySize(size) : "translate-x-[3px]",
|
|
88
100
|
getBulletSize(size),
|
|
89
101
|
])}
|
|
90
102
|
/>
|
|
@@ -5908,3 +5908,15 @@ module AiFillEye = {
|
|
|
5908
5908
|
@module("react-icons/ai") @react.component
|
|
5909
5909
|
external make: (~size: int=?) => React.element = "AiFillEye"
|
|
5910
5910
|
}
|
|
5911
|
+
|
|
5912
|
+
module FaCalendarCheck = {
|
|
5913
|
+
@module("react-icons/fa") @react.component
|
|
5914
|
+
external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
|
|
5915
|
+
"FaCalendarCheck"
|
|
5916
|
+
}
|
|
5917
|
+
|
|
5918
|
+
module FaUserCog = {
|
|
5919
|
+
@module("react-icons/fa") @react.component
|
|
5920
|
+
external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
|
|
5921
|
+
"FaUserCog"
|
|
5922
|
+
}
|