@colisweb/rescript-toolkit 2.44.0 → 2.45.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/bsconfig.json +0 -2
- package/package.json +1 -3
- package/src/ui/Toolkit__Ui_ButtonGroup.res +1 -31
- package/src/ui/Toolkit__Ui_Card.res +2 -8
- package/src/ui/Toolkit__Ui_Checkbox.res +4 -18
- package/src/ui/Toolkit__Ui_Modal.res +22 -31
- package/src/ui/Toolkit__Ui_ProgressBar.res +1 -1
- package/src/ui/Toolkit__Ui_Radio.res +3 -17
- package/src/ui/Toolkit__Ui_Tooltip.res +18 -27
- package/src/ui/styles.css +18 -1
- package/src/vendors/reach-ui/ReachUi_Tooltip.res +1 -0
package/bsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colisweb/rescript-toolkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rescript clean",
|
|
6
6
|
"build": "rescript build -with-deps",
|
|
@@ -41,8 +41,6 @@
|
|
|
41
41
|
"autoprefixer": "10.4.7",
|
|
42
42
|
"axios": "0.24.0",
|
|
43
43
|
"bs-axios": "0.0.43",
|
|
44
|
-
"bs-css": "13.4.0",
|
|
45
|
-
"bs-css-emotion": "2.4.0",
|
|
46
44
|
"case": "1.6.3",
|
|
47
45
|
"click-outside-hook": "1.1.0",
|
|
48
46
|
"copy-to-clipboard": "3.3.1",
|
|
@@ -4,39 +4,9 @@ let make = (~children, ~className="", ~size: [#md | #xl]=#md) => {
|
|
|
4
4
|
<div
|
|
5
5
|
className={cx([
|
|
6
6
|
className,
|
|
7
|
-
"flex justify-center items-center rounded-full font-display bg-gray-200",
|
|
7
|
+
"flex justify-center items-center rounded-full font-display bg-gray-200 cw-ButtonGroup",
|
|
8
8
|
isMd ? "h-6" : "h-10",
|
|
9
9
|
isMd ? "text-sm" : "text-xl",
|
|
10
|
-
{
|
|
11
|
-
open Css
|
|
12
|
-
style(list{
|
|
13
|
-
selector(
|
|
14
|
-
"& > button",
|
|
15
|
-
list{
|
|
16
|
-
whiteSpace(#nowrap),
|
|
17
|
-
height(100.->pct),
|
|
18
|
-
padding2(~v=0.75->rem, ~h=isMd ? 0.75->rem : 1.->rem),
|
|
19
|
-
display(#flex),
|
|
20
|
-
alignItems(#center),
|
|
21
|
-
justifyContent(#center),
|
|
22
|
-
borderRadius(2.->rem),
|
|
23
|
-
selector("&:hover", list{backgroundColor("3DDEF3"->hex)}),
|
|
24
|
-
},
|
|
25
|
-
),
|
|
26
|
-
selector(
|
|
27
|
-
"& > button.selected",
|
|
28
|
-
list{
|
|
29
|
-
background(
|
|
30
|
-
linearGradient(
|
|
31
|
-
270.->deg,
|
|
32
|
-
list{(0.->pct, "11a3b6"->hex), (100.->pct, "27d0dc"->hex)},
|
|
33
|
-
),
|
|
34
|
-
),
|
|
35
|
-
color(white),
|
|
36
|
-
},
|
|
37
|
-
),
|
|
38
|
-
})
|
|
39
|
-
},
|
|
40
10
|
])}>
|
|
41
11
|
children
|
|
42
12
|
</div>
|
|
@@ -79,13 +79,7 @@ module Footer = {
|
|
|
79
79
|
@react.component
|
|
80
80
|
let make = (~className="", ~children=React.null, ~customMinHeight=200) =>
|
|
81
81
|
<div
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"rounded-lg shadow-sm bg-white p-6",
|
|
85
|
-
{
|
|
86
|
-
open Css
|
|
87
|
-
style(list{minHeight(customMinHeight->px)})
|
|
88
|
-
},
|
|
89
|
-
])}>
|
|
82
|
+
style={ReactDOMStyle.make(~minHeight=`${customMinHeight->Int.toString}px`, ())}
|
|
83
|
+
className={cx([className, "rounded-lg shadow-sm bg-white p-6"])}>
|
|
90
84
|
children
|
|
91
85
|
</div>
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
type size = [#xs | #sm | #md | #lg]
|
|
2
2
|
|
|
3
|
-
module Styles = {
|
|
4
|
-
open Css
|
|
5
|
-
|
|
6
|
-
let label = style(list{
|
|
7
|
-
selector("& > input + .checkmark", list{backgroundColor(hex("fff"))}),
|
|
8
|
-
selector(
|
|
9
|
-
"& > input:checked + .checkmark",
|
|
10
|
-
list{backgroundColor(hex("15cbe3")), borderColor(hex("15cbe3"))},
|
|
11
|
-
),
|
|
12
|
-
selector("& > input + .checkmark > *", list{opacity(0.)}),
|
|
13
|
-
selector("& > input:checked + .checkmark > *", list{opacity(1.)}),
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
3
|
@react.component
|
|
18
4
|
let make = (
|
|
19
5
|
~value,
|
|
@@ -45,8 +31,7 @@ let make = (
|
|
|
45
31
|
|
|
46
32
|
<label
|
|
47
33
|
className={cx([
|
|
48
|
-
|
|
49
|
-
"items-center",
|
|
34
|
+
"items-center cw-Checkbox",
|
|
50
35
|
inverseLabel ? "inline-flex flex-row-reverse justify-end" : "flex flex-row",
|
|
51
36
|
disabled->Option.getWithDefault(false)
|
|
52
37
|
? "cursor-not-allowed opacity-75 text-gray-600"
|
|
@@ -58,7 +43,7 @@ let make = (
|
|
|
58
43
|
type_="checkbox"
|
|
59
44
|
value
|
|
60
45
|
?defaultChecked
|
|
61
|
-
className="hidden"
|
|
46
|
+
className="hidden peer"
|
|
62
47
|
onChange={event => {
|
|
63
48
|
let target = ReactEvent.Form.target(event)
|
|
64
49
|
let checked = target["checked"]
|
|
@@ -73,7 +58,8 @@ let make = (
|
|
|
73
58
|
/>
|
|
74
59
|
<span
|
|
75
60
|
className={cx([
|
|
76
|
-
"
|
|
61
|
+
"peer-checked:bg-primary-500 peer-checked:border-primary-500",
|
|
62
|
+
"bg-white rounded border text-white border-neutral-300 transform transition-all ease-in-out flex items-center justify-center flex-shrink-0",
|
|
77
63
|
switch size {
|
|
78
64
|
| #xs => "w-4 h-4"
|
|
79
65
|
| #sm => "w-6 h-6"
|
|
@@ -2,19 +2,6 @@ type size = [#xs | #sm | #md | #lg | #custom(int)]
|
|
|
2
2
|
type color = [#primary | #success | #danger | #neutral]
|
|
3
3
|
type style = [#default | #colored(color)]
|
|
4
4
|
|
|
5
|
-
let sizeRule = size => {
|
|
6
|
-
let value = switch size {
|
|
7
|
-
| #xs => 480
|
|
8
|
-
| #sm => 600
|
|
9
|
-
| #md => 768
|
|
10
|
-
| #lg => 900
|
|
11
|
-
| #custom(value) => value
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
open Css
|
|
15
|
-
style(list{width(pct(100.)), important(maxWidth(px(value)))})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
5
|
let modalStyle = (~type_) =>
|
|
19
6
|
switch type_ {
|
|
20
7
|
| #default => "rounded"
|
|
@@ -51,23 +38,6 @@ let closeIconStyle = (~type_) =>
|
|
|
51
38
|
| #colored(_) => "hover:bg-white hover:text-black text-white"
|
|
52
39
|
}
|
|
53
40
|
|
|
54
|
-
let blockBody = () => {
|
|
55
|
-
open Css
|
|
56
|
-
global("body", list{overflow(#hidden)})
|
|
57
|
-
}
|
|
58
|
-
let resetBody = () => {
|
|
59
|
-
open Css
|
|
60
|
-
global("body", list{overflow(#auto)})
|
|
61
|
-
}
|
|
62
|
-
{
|
|
63
|
-
open Css
|
|
64
|
-
global("[data-reach-dialog-overlay]", list{important(background(rgba(74, 115, 120, #num(0.5))))})
|
|
65
|
-
}
|
|
66
|
-
{
|
|
67
|
-
open Css
|
|
68
|
-
global("[data-reach-dialog-content]", list{important(background(transparent))})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
41
|
@react.component
|
|
72
42
|
let make = (
|
|
73
43
|
~isVisible,
|
|
@@ -79,7 +49,28 @@ let make = (
|
|
|
79
49
|
~footer=?,
|
|
80
50
|
~ariaLabel="",
|
|
81
51
|
) =>
|
|
82
|
-
<ReachUi.Dialog
|
|
52
|
+
<ReachUi.Dialog
|
|
53
|
+
ariaLabel
|
|
54
|
+
isOpen=isVisible
|
|
55
|
+
onDismiss=hide
|
|
56
|
+
style={ReactDOMStyle.make(
|
|
57
|
+
~maxWidth={
|
|
58
|
+
let value = switch size {
|
|
59
|
+
| #xs => 480
|
|
60
|
+
| #sm => 600
|
|
61
|
+
| #md => 768
|
|
62
|
+
| #lg => 900
|
|
63
|
+
| #custom(value) => value
|
|
64
|
+
}
|
|
65
|
+
`${value->Int.toString}px`
|
|
66
|
+
},
|
|
67
|
+
(),
|
|
68
|
+
)}
|
|
69
|
+
className={cx([
|
|
70
|
+
{
|
|
71
|
+
"w-full "
|
|
72
|
+
},
|
|
73
|
+
])}>
|
|
83
74
|
<div className={cx(["bg-white pb-5 z-40 shadow-lg w-full", modalStyle(~type_)])}>
|
|
84
75
|
<header
|
|
85
76
|
className={cx([
|
|
@@ -4,6 +4,7 @@ type color = [#success | #danger | #warning | #info]
|
|
|
4
4
|
let make = (~progression: float, ~color: color=#success) =>
|
|
5
5
|
<div className="flex flex-row w-full h-2 bg-neutral-300 rounded-lg">
|
|
6
6
|
<div
|
|
7
|
+
style={ReactDOMStyle.make(~width=`${progression->Float.toString}%`, ())}
|
|
7
8
|
className={cx([
|
|
8
9
|
"h-full rounded-lg",
|
|
9
10
|
switch color {
|
|
@@ -12,7 +13,6 @@ let make = (~progression: float, ~color: color=#success) =>
|
|
|
12
13
|
| #warning => "bg-warning-500"
|
|
13
14
|
| #info => "bg-info-500"
|
|
14
15
|
},
|
|
15
|
-
Css.style(list{Css.width(progression->#percent)}),
|
|
16
16
|
])}
|
|
17
17
|
/>
|
|
18
18
|
</div>
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
type size = [#xs | #sm | #md | #lg]
|
|
2
2
|
|
|
3
|
-
module Styles = {
|
|
4
|
-
open Css
|
|
5
|
-
|
|
6
|
-
let label = style(list{
|
|
7
|
-
selector("& > input + .checkmark", list{backgroundColor(hex("fff"))}),
|
|
8
|
-
selector("& > input:focus + .checkmark", list{unsafe("boxShadow", "0px 0px 4px #15CBE3")}),
|
|
9
|
-
selector(
|
|
10
|
-
"& > input:checked + .checkmark",
|
|
11
|
-
list{backgroundColor(hex("15cbe3")), borderColor(hex("15cbe3"))},
|
|
12
|
-
),
|
|
13
|
-
selector("& > input + .checkmark > *", list{opacity(0.)}),
|
|
14
|
-
selector("& > input:checked + .checkmark > *", list{opacity(1.)}),
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
3
|
@react.component
|
|
19
4
|
let make = (
|
|
20
5
|
~value,
|
|
@@ -28,7 +13,6 @@ let make = (
|
|
|
28
13
|
) =>
|
|
29
14
|
<label
|
|
30
15
|
className={cx([
|
|
31
|
-
Styles.label,
|
|
32
16
|
"flex items-center",
|
|
33
17
|
disabled->Option.getWithDefault(false)
|
|
34
18
|
? "cursor-not-allowed opacity-75 text-gray-600"
|
|
@@ -38,7 +22,7 @@ let make = (
|
|
|
38
22
|
<input
|
|
39
23
|
type_="radio"
|
|
40
24
|
value
|
|
41
|
-
className="opacity-0 w-0 h-0"
|
|
25
|
+
className="opacity-0 w-0 h-0 peer"
|
|
42
26
|
onChange={event => {
|
|
43
27
|
let target = ReactEvent.Form.target(event)
|
|
44
28
|
let value = target["value"]
|
|
@@ -51,6 +35,8 @@ let make = (
|
|
|
51
35
|
/>
|
|
52
36
|
<span
|
|
53
37
|
className={cx([
|
|
38
|
+
"bg-white peer-focus:shadow-sm peer-focus:shadow-primary-500",
|
|
39
|
+
"peer-checked:border-primary-500 peer-checked:bg-primary-500",
|
|
54
40
|
"checkmark rounded-full border text-white mr-3 border-neutral-300 transform transition-all ease-in-out flex items-center justify-center",
|
|
55
41
|
switch size {
|
|
56
42
|
| #xs => "w-4 h-4"
|
|
@@ -38,32 +38,23 @@ let make = (
|
|
|
38
38
|
{isVisible && canBeShowed
|
|
39
39
|
? <ReachUi.Portal>
|
|
40
40
|
<div
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
top(
|
|
59
|
-
triggerRect
|
|
60
|
-
->Js.Nullable.toOption
|
|
61
|
-
->Option.mapWithDefault(0, triggerRect => triggerRect.bottom + scrollY)
|
|
62
|
-
->px,
|
|
63
|
-
),
|
|
64
|
-
})
|
|
65
|
-
},
|
|
66
|
-
])}
|
|
41
|
+
style={ReactDOMStyle.make(
|
|
42
|
+
~borderLeft="10px solid transparent",
|
|
43
|
+
~borderRight="10px solid transparent",
|
|
44
|
+
~borderBottom="10px solid",
|
|
45
|
+
~left=`${triggerRect
|
|
46
|
+
->Js.Nullable.toOption
|
|
47
|
+
->Option.mapWithDefault(0, triggerRect =>
|
|
48
|
+
triggerRect.left - 10 + triggerRect.width / 2
|
|
49
|
+
)
|
|
50
|
+
->Int.toString}px`,
|
|
51
|
+
~top=`${triggerRect
|
|
52
|
+
->Js.Nullable.toOption
|
|
53
|
+
->Option.mapWithDefault(0, triggerRect => triggerRect.bottom + scrollY)
|
|
54
|
+
->Int.toString}px`,
|
|
55
|
+
(),
|
|
56
|
+
)}
|
|
57
|
+
className={cx(["absolute w-0 h-0 border-gray-800", triangleClassName])}
|
|
67
58
|
/>
|
|
68
59
|
</ReachUi.Portal>
|
|
69
60
|
: React.null}
|
|
@@ -71,10 +62,10 @@ let make = (
|
|
|
71
62
|
? <Toolkit__Ui_Spread props=tooltip>
|
|
72
63
|
<TooltipPopup
|
|
73
64
|
label
|
|
65
|
+
style={ReactDOMStyle.make(~maxWidth=`${maxWidth->Int.toString}px`, ())}
|
|
74
66
|
className={cx([
|
|
75
67
|
"px-3 py-2 bg-gray-800 rounded text-white text-sm z-40 whitespace-pre-wrap",
|
|
76
68
|
tooltipClassName,
|
|
77
|
-
Css.style(list{Css.maxWidth(maxWidth->Css.px)}),
|
|
78
69
|
])}
|
|
79
70
|
position=centered
|
|
80
71
|
/>
|
package/src/ui/styles.css
CHANGED
|
@@ -39,12 +39,13 @@ body,
|
|
|
39
39
|
|
|
40
40
|
[data-reach-dialog-content] {
|
|
41
41
|
padding: 0 !important;
|
|
42
|
+
background: transparent;
|
|
42
43
|
margin: 10vh auto;
|
|
43
44
|
outline: 0;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
[data-reach-dialog-overlay] {
|
|
47
|
-
background: rgba(
|
|
48
|
+
background: rgba(74, 115, 120, 0.5);
|
|
48
49
|
z-index: 40;
|
|
49
50
|
position: fixed;
|
|
50
51
|
top: 0;
|
|
@@ -376,4 +377,20 @@ input[type=number] {
|
|
|
376
377
|
color: #15373a;
|
|
377
378
|
}
|
|
378
379
|
|
|
380
|
+
.cw-ButtonGroup > button {
|
|
381
|
+
@apply whitespace-nowrap h-full px-3 md:px-4 flex items-center justify-center rounded-3xl py-3
|
|
382
|
+
}
|
|
383
|
+
.cw-ButtonGroup > button:hover {
|
|
384
|
+
@apply bg-primary-300
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.cw-ButtonGroup > button.selected {
|
|
388
|
+
background: linear-gradient(270deg, #11a3b6 0%, #27d0dc 100%);
|
|
389
|
+
color: white;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.cw-Checkbox > input:checked + .checkmark > * {
|
|
393
|
+
@apply opacity-100
|
|
394
|
+
}
|
|
395
|
+
|
|
379
396
|
/* purgecss end ignore */
|