@colisweb/rescript-toolkit 1.25.3 → 1.26.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "1.25.3",
3
+ "version": "1.26.3",
4
4
  "scripts": {
5
5
  "clean": "rescript clean",
6
6
  "build": "rescript build",
@@ -28,3 +28,4 @@ module Layout = Toolkit__Ui_Layout
28
28
  module SpinnerFullScreen = Toolkit__Ui_SpinnerFullScreen
29
29
  module MultiSelect = Toolkit__Ui_MultiSelect
30
30
  module Notice = Toolkit__Ui_Notice
31
+ module NativeDatePicker = Toolkit__Ui_NativeDatePicker
@@ -51,7 +51,7 @@ let make = (
51
51
  />
52
52
  <span
53
53
  className={cx([
54
- "checkmark rounded border text-white mr-3 border-neutral-300 transform transition-all ease-in-out flex items-center justify-center",
54
+ "checkmark rounded border text-white mr-3 border-neutral-300 transform transition-all ease-in-out flex items-center justify-center flex-shrink-0",
55
55
  switch size {
56
56
  | #xs => "w-4 h-4"
57
57
  | #sm => "w-6 h-6"
@@ -11,6 +11,7 @@ let make = (
11
11
  ~children,
12
12
  ~dropdownClassName="",
13
13
  ~buttonClassName="",
14
+ ~containerClassName="",
14
15
  ~defaultIsOpen=false,
15
16
  ~buttonColor: Toolkit__Ui_Button.color=#white,
16
17
  ~buttonSize: Toolkit__Ui_Button.size=#md,
@@ -53,10 +54,11 @@ let make = (
53
54
  None
54
55
  }, (isOpen, ref))
55
56
 
56
- <div className="relative">
57
+ <div className={cx(["relative", containerClassName])}>
57
58
  <Toolkit__Ui_Button
58
59
  variant=buttonVariant
59
60
  size=buttonSize
61
+ type_="button"
60
62
  color=buttonColor
61
63
  onClick={event => {
62
64
  switch ref.current->Js.Nullable.toOption {
@@ -11,6 +11,7 @@ let make: (
11
11
  ~children: React.element,
12
12
  ~dropdownClassName: string=?,
13
13
  ~buttonClassName: string=?,
14
+ ~containerClassName: string=?,
14
15
  ~defaultIsOpen: bool=?,
15
16
  ~buttonColor: Toolkit__Ui_Button.color=?,
16
17
  ~buttonSize: Toolkit__Ui_Button.size=?,
@@ -41,13 +41,20 @@ let make = (
41
41
  position=#bottom
42
42
  label={switch selectedOptions {
43
43
  | [] =>
44
- <span className="flex flex-row gap-2 items-end">
45
- placeholder <BsReactIcons.FaAngleDown />
46
- </span>
44
+ <p className="flex flex-row gap-2 w-full items-center">
45
+ <span className="ml-1"> {placeholder} </span>
46
+ <span className="absolute inset-y-0 right-0 flex items-center px-2">
47
+ <BsReactIcons.FaAngleDown />
48
+ </span>
49
+ </p>
47
50
  | options =>
48
- <span className="truncate">
49
- {options->Array.map(({label}) => label)->Js.Array2.joinWith(", ")->React.string}
50
- </span>
51
+ <div
52
+ className="table table-fixed w-full"
53
+ title={options->Array.map(({label}) => label)->Js.Array2.joinWith(", ")}>
54
+ <span className="table-cell truncate text-left">
55
+ {options->Array.map(({label}) => label)->Js.Array2.joinWith(", ")->React.string}
56
+ </span>
57
+ </div>
51
58
  }}>
52
59
  <div className="py-2 pl-2 pr-1">
53
60
  {allowFilter
@@ -0,0 +1,23 @@
1
+ @react.component
2
+ let make = (~onChange, ~value=?, ~id=?, ~disabled=false, ~isInvalid=false, ~className="") =>
3
+ <div className="relative">
4
+ <input
5
+ ?id
6
+ value=?{value->Option.map(d => d->BsDateFns.formatWithPattern("yyyy-MM-dd"))}
7
+ disabled
8
+ ariaDisabled={disabled}
9
+ onChange={event => {
10
+ let value = ReactEvent.Form.target(event)["value"]
11
+ onChange(Some(Js.Date.fromString(value))->Option.keep(BsDateFns.isValid))
12
+ }}
13
+ className={cx([
14
+ "h-[38px] border rounded transition-all duration-150 ease-in-out py-2 pl-4 pr-8 appearance-none w-full bg-white text-gray-800 leading-tight focus:outline-none focus:shadow-none focus:border-info-500 disabled:bg-gray-200 disabled:text-gray-700 focus:z30 relative border-gray-300",
15
+ switch isInvalid {
16
+ | true => "border-danger-500 shadow-danger-500"
17
+ | _ => "border-gray-300"
18
+ },
19
+ className,
20
+ ])}
21
+ type_="date"
22
+ />
23
+ </div>
@@ -0,0 +1,9 @@
1
+ @react.component
2
+ let make: (
3
+ ~onChange: option<Js.Date.t> => unit,
4
+ ~value: Js.Date.t=?,
5
+ ~id: string=?,
6
+ ~disabled: bool=?,
7
+ ~isInvalid: bool=?,
8
+ ~className: string=?,
9
+ ) => React.element
@@ -32,7 +32,7 @@ let make = (
32
32
  onChange(value)
33
33
  }}>
34
34
  {placeholder->Option.mapWithDefault(React.null, placeholder =>
35
- <option> {placeholder->React.string} </option>
35
+ <option value=""> {placeholder->React.string} </option>
36
36
  )}
37
37
  {options
38
38
  ->Array.mapWithIndex((i, (label, value, enabled)) =>
@@ -44,6 +44,6 @@ let make = (
44
44
  </select>
45
45
  <div
46
46
  className="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-800">
47
- <BsReactIcons.MdArrowDropDown className="w-6 h-6 z-30" />
47
+ <BsReactIcons.FaAngleDown />
48
48
  </div>
49
49
  </div>
@@ -88,6 +88,9 @@ external endOfMonth: Js.Date.t => Js.Date.t = "endOfMonth"
88
88
 
89
89
  // booleans
90
90
 
91
+ @module("date-fns")
92
+ external isValid: Js.Date.t => bool = "isValid"
93
+
91
94
  @module("date-fns")
92
95
  external isEqual: (Js.Date.t, Js.Date.t) => bool = "isEqual"
93
96
 
@@ -5887,3 +5887,9 @@ module GoPrimitiveDot = {
5887
5887
  external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
5888
5888
  "GoPrimitiveDot"
5889
5889
  }
5890
+
5891
+ module FaFilter = {
5892
+ @module("react-icons/fa") @react.component
5893
+ external make: (~size: int=?, ~color: string=?, ~className: string=?) => React.element =
5894
+ "FaFilter"
5895
+ }
@@ -1,6 +1,10 @@
1
1
  module Sentry = {
2
2
  // init
3
3
  type initOptions
4
+ type integration
5
+
6
+ @module("@sentry/tracing") @as("Integrations") @new
7
+ external browserTracing: unit => integration = "BrowserTracing"
4
8
 
5
9
  @obj
6
10
  external initOptions: (
@@ -8,6 +12,7 @@ module Sentry = {
8
12
  ~environment: string,
9
13
  ~beforeSend: ('a, 'b) => 'c=?,
10
14
  ~ignoreErrors: array<string>=?,
15
+ ~integrations: array<integration>=?,
11
16
  unit,
12
17
  ) => initOptions = ""
13
18
 
@@ -37,9 +42,9 @@ module Sentry = {
37
42
  module Scope = {
38
43
  type t
39
44
 
40
- @bs.send external setExtra: (t, string, 'a) => unit = "setExtra"
41
- @bs.send external setTag: (t, string, 'a) => unit = "setTag"
42
- @bs.send external setUser: (t, 'a) => unit = "setUser"
45
+ @send external setExtra: (t, string, 'a) => unit = "setExtra"
46
+ @send external setTag: (t, string, 'a) => unit = "setTag"
47
+ @send external setUser: (t, 'a) => unit = "setUser"
43
48
  }
44
49
 
45
50
  // withScope