@colisweb/rescript-toolkit 3.4.2 → 3.5.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/.yarn/install-state.gz +0 -0
- package/package.json +1 -1
- package/playground/PlaygroundComponents.res +1 -0
- package/playground/components/Playground_Coordinates.res +12 -0
- package/src/ui/Toolkit__Ui.res +1 -0
- package/src/ui/Toolkit__Ui_Coordinates.res +20 -0
- package/src/ui/Toolkit__Ui_Coordinates.resi +5 -0
- package/src/ui/Toolkit__Ui_CopyWrapper.res +3 -3
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ let components: array<(string, module(Config))> = [
|
|
|
38
38
|
("IconButton", module(Playground_IconButton)),
|
|
39
39
|
("CopyWrapper", module(Playground_CopyWrapper)),
|
|
40
40
|
("Listbox", module(Playground_Listbox)),
|
|
41
|
+
("Coordinates", module(Playground_Coordinates)),
|
|
41
42
|
]
|
|
42
43
|
|
|
43
44
|
module List = {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@module("@root/src/ui/Toolkit__Ui_Coordinates.resi?raw")
|
|
2
|
+
external resi: string = "default"
|
|
3
|
+
|
|
4
|
+
@module("@root/playground/components/Playground_Coordinates.res?raw")
|
|
5
|
+
external codeExample: string = "default"
|
|
6
|
+
|
|
7
|
+
@react.component
|
|
8
|
+
let make = () => {
|
|
9
|
+
<div className="inline-block">
|
|
10
|
+
<Toolkit__Ui_Coordinates coordinates={{latitude: 50.222, longitude: 20.33333}} />
|
|
11
|
+
</div>
|
|
12
|
+
}
|
package/src/ui/Toolkit__Ui.res
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
open ReactIntl
|
|
2
|
+
|
|
3
|
+
@react.component
|
|
4
|
+
let make = (~coordinates: Toolkit__Decoders.Coordinates.t, ~copyWrapperClassName="") => {
|
|
5
|
+
let intl = useIntl()
|
|
6
|
+
|
|
7
|
+
<Toolkit__Ui_CopyWrapper
|
|
8
|
+
intl
|
|
9
|
+
className={cx(["inline-flex items-center", copyWrapperClassName])}
|
|
10
|
+
textToCopy={`${coordinates.latitude->Float.toString}, ${coordinates.longitude->Float.toString}`}>
|
|
11
|
+
<div className="inline-flex flex-row items-center gap-2 text-info-600">
|
|
12
|
+
<ReactIcons.MdMyLocation size=15 />
|
|
13
|
+
<p className="e2e-coordinates-gps">
|
|
14
|
+
{`${coordinates.latitude->Js.Float.toFixedWithPrecision(
|
|
15
|
+
~digits=3,
|
|
16
|
+
)}, ${coordinates.longitude->Js.Float.toFixedWithPrecision(~digits=3)}`->React.string}
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
</Toolkit__Ui_CopyWrapper>
|
|
20
|
+
}
|
|
@@ -10,7 +10,7 @@ module Msg = {
|
|
|
10
10
|
|
|
11
11
|
@react.component
|
|
12
12
|
let make = (~children, ~textToCopy, ~className="", ~intl) => {
|
|
13
|
-
let ref1Clipboard =
|
|
13
|
+
let ref1Clipboard = Toolkit__Hooks.useClipboard(
|
|
14
14
|
textToCopy,
|
|
15
15
|
~onCopyNotificationMessage=intl->Intl.formatMessage(Msg.copied),
|
|
16
16
|
)
|
|
@@ -18,11 +18,11 @@ let make = (~children, ~textToCopy, ~className="", ~intl) => {
|
|
|
18
18
|
<div className={cx(["rounded-md border border-info-500 bg-info-50", className])}>
|
|
19
19
|
<div className="relative w-full">
|
|
20
20
|
<div
|
|
21
|
-
className="absolute -
|
|
21
|
+
className="absolute left-full transform -translate-x-1/2 top-1 p-1 bg-info-50 text-info-500 cursor-pointer hover:bg-info-400 hover:text-white rounded active:bg-info-500"
|
|
22
22
|
onClick={_ => {
|
|
23
23
|
ref1Clipboard.copy()
|
|
24
24
|
}}>
|
|
25
|
-
<ReactIcons.MdContentCopy size=
|
|
25
|
+
<ReactIcons.MdContentCopy size=14 />
|
|
26
26
|
</div>
|
|
27
27
|
<div className="py-1 px-2 pr-4"> {children} </div>
|
|
28
28
|
</div>
|