@colisweb/rescript-toolkit 4.14.5 → 4.14.7
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)
|
|
@@ -117,7 +118,7 @@ let make = (
|
|
|
117
118
|
</p>
|
|
118
119
|
| Some(selectedOption) =>
|
|
119
120
|
<div className="table table-fixed w-full" title={selectedOption.label}>
|
|
120
|
-
<span className="table-cell truncate text-left w-full">
|
|
121
|
+
<span className="table-cell truncate text-left w-full align-middle">
|
|
121
122
|
{selectedOption.itemLabel->Option.getWithDefault(selectedOption.label->React.string)}
|
|
122
123
|
</span>
|
|
123
124
|
<span className="absolute inset-y-0 right-2 flex items-center">
|
|
@@ -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>
|