@colisweb/rescript-toolkit 4.14.5 → 4.14.6
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
|
@@ -10,7 +10,7 @@ type options = array<item>
|
|
|
10
10
|
|
|
11
11
|
module Footer = {
|
|
12
12
|
@react.component
|
|
13
|
-
let make = (~onCancel, ~onValidateClick) => {
|
|
13
|
+
let make = (~onCancel, ~onValidateClick, ~validateMessage=?) => {
|
|
14
14
|
let dropdownContext = React.useContext(Toolkit__Ui_Dropdown.dropdownContext)
|
|
15
15
|
|
|
16
16
|
<footer className="bg-white p-1 flex flex-row justify-between">
|
|
@@ -29,7 +29,7 @@ module Footer = {
|
|
|
29
29
|
onValidateClick()
|
|
30
30
|
dropdownContext.hide()
|
|
31
31
|
}}>
|
|
32
|
-
<FormattedMessage defaultMessage={"Valider"} />
|
|
32
|
+
{validateMessage->Option.getWithDefault(<FormattedMessage defaultMessage={"Valider"} />)}
|
|
33
33
|
</Toolkit__Ui_Button>
|
|
34
34
|
</footer>
|
|
35
35
|
}
|
|
@@ -85,6 +85,7 @@ let make = (
|
|
|
85
85
|
~onValidate: item => unit,
|
|
86
86
|
~disabled: option<bool>=?,
|
|
87
87
|
~onCancel: option<unit => unit>=?,
|
|
88
|
+
~validateMessage: option<React.element>=?,
|
|
88
89
|
) => {
|
|
89
90
|
let (selectedOption, setSelectedOption) = React.useState(() => defaultValue)
|
|
90
91
|
let previousDefaultValue = Toolkit__Hooks.usePrevious(defaultValue)
|
|
@@ -149,6 +150,7 @@ let make = (
|
|
|
149
150
|
setSelectedOption(_ => defaultValue)
|
|
150
151
|
onCancel->Option.forEach(fn => fn())
|
|
151
152
|
}}
|
|
153
|
+
?validateMessage
|
|
152
154
|
onValidateClick={() => selectedOption->Option.forEach(onValidate)}
|
|
153
155
|
/>
|
|
154
156
|
</Toolkit__Ui_Dropdown>
|