@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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "3.4.2",
3
+ "version": "3.5.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -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
+ }
@@ -35,3 +35,4 @@ module Notice = Toolkit__Ui_Notice
35
35
  module NativeDatePicker = Toolkit__Ui_NativeDatePicker
36
36
  module ErrorBoundary = Toolkit__Ui_ErrorBoundary
37
37
  module WeekDateFilter = Toolkit__Ui_WeekDateFilter
38
+ module Coordinates = Toolkit__Ui_Coordinates
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ @react.component
2
+ let make: (
3
+ ~coordinates: Toolkit__Decoders.Coordinates.t,
4
+ ~copyWrapperClassName: string=?,
5
+ ) => React.element
@@ -10,7 +10,7 @@ module Msg = {
10
10
 
11
11
  @react.component
12
12
  let make = (~children, ~textToCopy, ~className="", ~intl) => {
13
- let ref1Clipboard = Toolkit.Hooks.useClipboard(
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 -right-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"
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=10 />
25
+ <ReactIcons.MdContentCopy size=14 />
26
26
  </div>
27
27
  <div className="py-1 px-2 pr-4"> {children} </div>
28
28
  </div>