@colisweb/rescript-toolkit 4.14.16 → 4.15.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/.secure_files/{ci-functions-v16.5.0 → ci-functions-v17.7.1} +393 -174
- package/.secure_files/{ci-functions-v16.6.0 → ci-functions-v17.7.2} +415 -193
- package/package.json +1 -1
- package/src/ui/Toolkit__Ui_Dropdown.res +4 -3
- package/src/ui/Toolkit__Ui_SelectWithValidation.res +12 -3
- package/src/ui/Toolkit__Ui_SelectWithValidation.resi +4 -0
- package/src/vendors/Browser.res +12 -0
- package/src/vendors/Browser.resi +11 -0
package/package.json
CHANGED
|
@@ -82,9 +82,10 @@ let make = (
|
|
|
82
82
|
onClick={event => {
|
|
83
83
|
switch dropDownRef.current->Js.Nullable.toOption {
|
|
84
84
|
| None => toggle()
|
|
85
|
-
| Some(
|
|
86
|
-
let
|
|
87
|
-
|
|
85
|
+
| Some(dropDownRef) => {
|
|
86
|
+
let clickedElement = event->ReactEvent.Mouse.target->Browser.DomElement.toDomElement
|
|
87
|
+
|
|
88
|
+
if !(dropDownRef->Browser.DomElement.Node.contains(clickedElement)) {
|
|
88
89
|
toggle()
|
|
89
90
|
}
|
|
90
91
|
}
|
|
@@ -91,6 +91,9 @@ let make = (
|
|
|
91
91
|
~validateButtonClassName="",
|
|
92
92
|
~cancelButtonClassName="",
|
|
93
93
|
~itemClassName="",
|
|
94
|
+
~buttonColor=?,
|
|
95
|
+
~buttonSize=?,
|
|
96
|
+
~buttonVariant=?,
|
|
94
97
|
~searchPlaceholder: option<string>=?,
|
|
95
98
|
~allowFilter=true,
|
|
96
99
|
~defaultValue: option<item>=?,
|
|
@@ -98,6 +101,7 @@ let make = (
|
|
|
98
101
|
~disabled: option<bool>=?,
|
|
99
102
|
~onCancel: option<unit => unit>=?,
|
|
100
103
|
~validateMessage: option<React.element>=?,
|
|
104
|
+
~showCarret=true,
|
|
101
105
|
) => {
|
|
102
106
|
let (selectedOption, setSelectedOption) = React.useState(() => defaultValue)
|
|
103
107
|
let previousDefaultValue = Toolkit__Hooks.usePrevious(defaultValue)
|
|
@@ -116,6 +120,9 @@ let make = (
|
|
|
116
120
|
|
|
117
121
|
<Toolkit__Ui_Dropdown
|
|
118
122
|
?disabled
|
|
123
|
+
?buttonColor
|
|
124
|
+
?buttonSize
|
|
125
|
+
?buttonVariant
|
|
119
126
|
buttonClassName
|
|
120
127
|
onClose={_ => setSelectedOption(_ => defaultValue)}
|
|
121
128
|
dropdownClassName
|
|
@@ -133,9 +140,11 @@ let make = (
|
|
|
133
140
|
<span className="table-cell truncate text-left w-full">
|
|
134
141
|
{selectedOption.itemLabel->Option.getWithDefault(selectedOption.label->React.string)}
|
|
135
142
|
</span>
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
|
|
143
|
+
{showCarret
|
|
144
|
+
? <span className="absolute inset-y-0 right-2 flex items-center">
|
|
145
|
+
<ReactIcons.FaAngleDown />
|
|
146
|
+
</span>
|
|
147
|
+
: React.null}
|
|
139
148
|
</div>
|
|
140
149
|
}}>
|
|
141
150
|
<div className="py-2 pl-2 pr-1 max-h-[300px] overflow-y-scroll">
|
|
@@ -10,6 +10,9 @@ let make: (
|
|
|
10
10
|
~validateButtonClassName: string=?,
|
|
11
11
|
~cancelButtonClassName: string=?,
|
|
12
12
|
~itemClassName: string=?,
|
|
13
|
+
~buttonColor: Toolkit__Ui_Button.color=?,
|
|
14
|
+
~buttonSize: Toolkit__Ui_Button.size=?,
|
|
15
|
+
~buttonVariant: Toolkit__Ui_Button.variant=?,
|
|
13
16
|
~searchPlaceholder: string=?,
|
|
14
17
|
~allowFilter: bool=?,
|
|
15
18
|
~defaultValue: item=?,
|
|
@@ -17,4 +20,5 @@ let make: (
|
|
|
17
20
|
~disabled: bool=?,
|
|
18
21
|
~onCancel: unit => unit=?,
|
|
19
22
|
~validateMessage: React.element=?,
|
|
23
|
+
~showCarret: bool=?,
|
|
20
24
|
) => React.element
|
package/src/vendors/Browser.res
CHANGED
|
@@ -48,6 +48,18 @@ module DomElement = {
|
|
|
48
48
|
@send external getBoundingClientRect: Dom.element => rect = "getBoundingClientRect"
|
|
49
49
|
|
|
50
50
|
@send external focus: Dom.element => unit = "focus"
|
|
51
|
+
|
|
52
|
+
external toDomElement: 'a => Dom.element = "%identity"
|
|
53
|
+
|
|
54
|
+
module ClassList = {
|
|
55
|
+
@send @scope("classList")
|
|
56
|
+
external contains: (Dom.element, string) => bool = "contains"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module Node = {
|
|
60
|
+
@send
|
|
61
|
+
external contains: (Dom.element, Dom.element) => bool = "contains"
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
|
|
53
65
|
@val
|
package/src/vendors/Browser.resi
CHANGED
|
@@ -34,6 +34,17 @@ module DomElement: {
|
|
|
34
34
|
}
|
|
35
35
|
let getBoundingClientRect: Dom.element => rect
|
|
36
36
|
let focus: Dom.element => unit
|
|
37
|
+
|
|
38
|
+
external toDomElement: 'a => Dom.element = "%identity"
|
|
39
|
+
|
|
40
|
+
module ClassList: {
|
|
41
|
+
@send @scope("classList")
|
|
42
|
+
external contains: (Dom.element, string) => bool = "contains"
|
|
43
|
+
}
|
|
44
|
+
module Node: {
|
|
45
|
+
@send
|
|
46
|
+
external contains: (Dom.element, Dom.element) => bool = "contains"
|
|
47
|
+
}
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
let innerWidth: int
|