@colisweb/rescript-toolkit 5.38.1 → 5.39.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "5.38.1",
3
+ "version": "5.39.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -1,7 +1,14 @@
1
1
  module MakeString = () => {
2
- module Id = {
2
+ module Id: {
3
+ @spice
4
+ type t
5
+ module Dict: {
6
+ let deleteKey: (Js.Dict.t<'a>, string) => Js.Dict.t<'a>
7
+ }
8
+ } = {
3
9
  @spice
4
10
  type t = string
11
+
5
12
  module Dict = {
6
13
  include Js.Dict
7
14
 
@@ -247,6 +247,10 @@ module Make = (Config: RouterConfig) => {
247
247
  ~isSubLink=false,
248
248
  ~isActive=false,
249
249
  ~onLinkClick=() => (),
250
+ ~containerClassName="",
251
+ ~labelClassName="",
252
+ ~tooltipClassName="",
253
+ ~activeClassName="",
250
254
  ) =>
251
255
  switch link {
252
256
  | Custom(element) => element
@@ -255,7 +259,12 @@ module Make = (Config: RouterConfig) => {
255
259
  <a
256
260
  href=url
257
261
  target="_blank"
258
- className={cx([commonClassName, "py-3 sidenav-link", isSubLink ? "ml-3" : ""])}>
262
+ className={cx([
263
+ commonClassName,
264
+ "py-3 sidenav-link",
265
+ isSubLink ? "ml-3" : "",
266
+ containerClassName,
267
+ ])}>
259
268
  <span className="overflow-hidden flex">
260
269
  {config.icon->Option.mapWithDefault(React.null, icon =>
261
270
  <div className={cx(["text-neutral-800", isNavOpen ? "pl-2" : "px-2"])}> icon </div>
@@ -265,13 +274,17 @@ module Make = (Config: RouterConfig) => {
265
274
  "transition-all duration-200 ease-in-out absolute ml-12 w-40 transform top-1/2 -translate-y-1/2",
266
275
  isNavOpen ? "pl-1 opacity-100 delay-75" : "opacity-0 invisible",
267
276
  isSubLink ? "text-sm" : "",
277
+ labelClassName,
268
278
  ])}>
269
279
  label
270
280
  </span>
271
281
  {isNavOpen
272
282
  ? React.null
273
283
  : <div
274
- className="sidenav-link-tooltip absolute left-0 p-2 bg-neutral-700 text-white rounded transform top-1/2 -translate-y-1/2 transition-all duration-200 ease-in-out opacity-0 invisible ml-16 whitespace-nowrap">
284
+ className={cx([
285
+ "sidenav-link-tooltip absolute left-0 p-2 bg-neutral-700 text-white rounded transform top-1/2 -translate-y-1/2 transition-all duration-200 ease-in-out opacity-0 invisible ml-16 whitespace-nowrap",
286
+ tooltipClassName,
287
+ ])}>
275
288
  label
276
289
  </div>}
277
290
  </span>
@@ -288,9 +301,14 @@ module Make = (Config: RouterConfig) => {
288
301
  isSubLink ? "ml-3" : "",
289
302
  config.icon->Option.isNone ? "py-5" : "",
290
303
  "sidenav-link",
304
+ containerClassName,
291
305
  isActive && !disabledActiveLink ? "bg-primary-100/75 text-neutral-700" : "",
306
+ isActive && !disabledActiveLink ? activeClassName : "",
307
+ ])}
308
+ activeClassName={cx([
309
+ disabledActiveLink ? "" : "bg-primary-100/75 text-neutral-700",
310
+ disabledActiveLink ? "" : activeClassName,
292
311
  ])}
293
- activeClassName={disabledActiveLink ? "" : "bg-primary-100/75 text-neutral-700"}
294
312
  onClick={_ => onLinkClick()}>
295
313
  <span className="overflow-hidden flex">
296
314
  {config.icon->Option.mapWithDefault(React.null, icon =>
@@ -301,13 +319,17 @@ module Make = (Config: RouterConfig) => {
301
319
  "transition-all duration-200 ease-in-out absolute ml-12 w-40 transform top-1/2 -translate-y-1/2",
302
320
  isNavOpen ? "pl-1 opacity-100 delay-75" : "opacity-0 invisible",
303
321
  isSubLink ? "text-sm" : "",
322
+ labelClassName,
304
323
  ])}>
305
324
  label
306
325
  </span>
307
326
  {isNavOpen
308
327
  ? React.null
309
328
  : <div
310
- className="sidenav-link-tooltip absolute left-0 p-2 bg-neutral-700 text-white rounded transform top-1/2 -translate-y-1/2 transition-all duration-200 ease-in-out opacity-0 invisible ml-16 whitespace-nowrap">
329
+ className={cx([
330
+ "sidenav-link-tooltip absolute left-0 p-2 bg-neutral-700 text-white rounded transform top-1/2 -translate-y-1/2 transition-all duration-200 ease-in-out opacity-0 invisible ml-16 whitespace-nowrap",
331
+ tooltipClassName,
332
+ ])}>
311
333
  label
312
334
  </div>}
313
335
  </span>
@@ -345,6 +367,8 @@ module Make = (Config: RouterConfig) => {
345
367
  ~isNavOpen: bool,
346
368
  ~onLinkClick=() => (),
347
369
  ~openMenu,
370
+ ~iconClassName="",
371
+ ~labelClassName="",
348
372
  ) => {
349
373
  let (isOpen, setIsOpen) = React.useState(() => false)
350
374
  let currentRoute = useRoute()
@@ -387,13 +411,15 @@ module Make = (Config: RouterConfig) => {
387
411
  "flex items-center w-full sidenav-link",
388
412
  hasActiveSubRoute || relativeRoute->Option.isSome ? "bg-primary-100/75" : "",
389
413
  ])}>
390
- <span className={cx(["mr-2 text-neutral-800", isNavOpen ? "pl-2" : "px-2"])}>
414
+ <span
415
+ className={cx(["mr-2 text-neutral-800", isNavOpen ? "pl-2" : "px-2", iconClassName])}>
391
416
  groupInfo.icon
392
417
  </span>
393
418
  <span
394
419
  className={cx([
395
420
  "transition-all duration-200 ease-in-out absolute ml-12 w-40 transform top-1/2 -translate-y-1/2 text-left",
396
421
  isNavOpen ? "pl-1 opacity-100 delay-75" : "opacity-0 invisible",
422
+ labelClassName,
397
423
  ])}>
398
424
  groupInfo.label
399
425
  </span>