@syscore/ui-library 1.17.0 → 1.19.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/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import React__default, { useState, useEffect, useCallback, useRef, createContext, useMemo, useContext } from "react";
3
+ import React__default, { useState, useEffect, useCallback, useRef, createContext, useMemo, useLayoutEffect, useContext } from "react";
4
4
  import { motion, AnimatePresence, useMotionValue, animate } from "motion/react";
5
5
  import { clsx } from "clsx";
6
6
  import { twMerge } from "tailwind-merge";
@@ -2442,30 +2442,30 @@ function DialogOverlay({
2442
2442
  }
2443
2443
  function DialogContent({
2444
2444
  className,
2445
+ innerClassName,
2446
+ closeClassName,
2445
2447
  children,
2446
2448
  showCloseButton = true,
2447
2449
  ...props
2448
2450
  }) {
2449
- return /* @__PURE__ */ jsx(DialogPortal, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsx(DialogOverlay, { children: /* @__PURE__ */ jsxs(
2451
+ return /* @__PURE__ */ jsx(DialogPortal, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsx(DialogOverlay, { className: "overflow-y-auto", children: /* @__PURE__ */ jsx(
2450
2452
  SheetPrimitive.Content,
2451
2453
  {
2452
2454
  "data-slot": "dialog-content",
2453
2455
  className: cn("dialog-content", className),
2454
2456
  ...props,
2455
- children: [
2456
- /* @__PURE__ */ jsx("div", { className: "dialog-content-inner", children }),
2457
- showCloseButton && /* @__PURE__ */ jsxs(
2458
- SheetPrimitive.Close,
2459
- {
2460
- "data-slot": "dialog-close",
2461
- className: "dialog-close",
2462
- children: [
2463
- /* @__PURE__ */ jsx(UtilityClose, {}),
2464
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
2465
- ]
2466
- }
2467
- )
2468
- ]
2457
+ children: /* @__PURE__ */ jsxs("div", { className: "dialog-content-wrapper", children: [
2458
+ /* @__PURE__ */ jsx("div", { className: cn("dialog-content-inner", innerClassName), children }),
2459
+ showCloseButton && /* @__PURE__ */ jsx("div", { className: "dialog-close", children: /* @__PURE__ */ jsxs(SheetPrimitive.Close, { "data-slot": "dialog-close", children: [
2460
+ /* @__PURE__ */ jsx(
2461
+ UtilityClose,
2462
+ {
2463
+ className: cn("dialog-close-icon", closeClassName)
2464
+ }
2465
+ ),
2466
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
2467
+ ] }) })
2468
+ ] })
2469
2469
  }
2470
2470
  ) }) });
2471
2471
  }
@@ -5762,9 +5762,7 @@ const UtilityClassification = ({
5762
5762
  }
5763
5763
  );
5764
5764
  };
5765
- const UtilityCompare = ({
5766
- className
5767
- }) => {
5765
+ function UtilityCompare({ className }) {
5768
5766
  return /* @__PURE__ */ jsx(
5769
5767
  "div",
5770
5768
  {
@@ -5787,7 +5785,7 @@ const UtilityCompare = ({
5787
5785
  {
5788
5786
  d: "M10.6002 5.79905C10.6002 8.44949 8.45114 10.5981 5.80011 10.5981C3.14908 10.5981 1 8.44949 1 5.79905C1 3.14861 3.14908 1 5.80011 1C8.45114 1 10.6002 3.14861 10.6002 5.79905Z",
5789
5787
  fill: "#E0FBF5",
5790
- stroke: "#282A31",
5788
+ stroke: "currentColor",
5791
5789
  "stroke-width": "2",
5792
5790
  "stroke-linecap": "round",
5793
5791
  "stroke-linejoin": "round"
@@ -5797,7 +5795,7 @@ const UtilityCompare = ({
5797
5795
  "path",
5798
5796
  {
5799
5797
  d: "M5.80078 16.998L5.80078 24.9965C5.80078 25.845 6.13793 26.6588 6.73806 27.2587C7.33819 27.8587 8.15214 28.1958 9.00086 28.1958L20.2011 28.1958",
5800
- stroke: "#282A31",
5798
+ stroke: "currentColor",
5801
5799
  "stroke-width": "2",
5802
5800
  "stroke-linecap": "round",
5803
5801
  "stroke-linejoin": "round"
@@ -5807,7 +5805,7 @@ const UtilityCompare = ({
5807
5805
  "path",
5808
5806
  {
5809
5807
  d: "M10.6002 21.7971L5.80011 16.998L1 21.7971",
5810
- stroke: "#282A31",
5808
+ stroke: "currentColor",
5811
5809
  "stroke-width": "2",
5812
5810
  "stroke-linecap": "round",
5813
5811
  "stroke-linejoin": "round"
@@ -5818,7 +5816,7 @@ const UtilityCompare = ({
5818
5816
  {
5819
5817
  d: "M29.8001 28.2014C29.8001 30.8518 27.651 33.0004 24.9999 33.0004C22.3489 33.0004 20.1998 30.8518 20.1998 28.2014C20.1998 25.551 22.3489 23.4023 24.9999 23.4023C27.651 23.4023 29.8001 25.5509 29.8001 28.2014Z",
5820
5818
  fill: "#EFF5FB",
5821
- stroke: "#282A31",
5819
+ stroke: "currentColor",
5822
5820
  "stroke-width": "2",
5823
5821
  "stroke-linecap": "round",
5824
5822
  "stroke-linejoin": "round"
@@ -5828,7 +5826,7 @@ const UtilityCompare = ({
5828
5826
  "path",
5829
5827
  {
5830
5828
  d: "M25.0002 16.9946V8.99624C25.0002 8.14771 24.663 7.33394 24.0629 6.73395C23.4628 6.13395 22.6488 5.79687 21.8001 5.79687L10.5999 5.79688",
5831
- stroke: "#282A31",
5829
+ stroke: "currentColor",
5832
5830
  "stroke-width": "2",
5833
5831
  "stroke-linecap": "round",
5834
5832
  "stroke-linejoin": "round"
@@ -5838,7 +5836,7 @@ const UtilityCompare = ({
5838
5836
  "path",
5839
5837
  {
5840
5838
  d: "M20.1998 12.2012L24.9999 17.0002L29.8001 12.2012",
5841
- stroke: "#282A31",
5839
+ stroke: "currentColor",
5842
5840
  "stroke-width": "2",
5843
5841
  "stroke-linecap": "round",
5844
5842
  "stroke-linejoin": "round"
@@ -5849,7 +5847,7 @@ const UtilityCompare = ({
5849
5847
  )
5850
5848
  }
5851
5849
  );
5852
- };
5850
+ }
5853
5851
  const UtilityDrag = ({ className }) => {
5854
5852
  return /* @__PURE__ */ jsx(
5855
5853
  "div",
@@ -6657,47 +6655,56 @@ function UtilityTargetActive({ className, ...props }) {
6657
6655
  ] });
6658
6656
  }
6659
6657
  function UtilityText({ className }) {
6660
- return /* @__PURE__ */ jsxs(
6661
- "svg",
6658
+ return /* @__PURE__ */ jsx(
6659
+ "div",
6662
6660
  {
6663
- className,
6664
- xmlns: "http://www.w3.org/2000/svg",
6665
- width: "16",
6666
- height: "14",
6667
- viewBox: "0 0 16 14",
6668
- fill: "none",
6669
- children: [
6670
- /* @__PURE__ */ jsx(
6671
- "path",
6672
- {
6673
- d: "M8.75 12.75H0.75",
6674
- stroke: "currentColor",
6675
- strokeWidth: "1.5",
6676
- strokeLinecap: "round",
6677
- "stroke-linejoin": "round"
6678
- }
6679
- ),
6680
- /* @__PURE__ */ jsx(
6681
- "path",
6682
- {
6683
- d: "M10.75 0.75H0.75",
6684
- stroke: "currentColor",
6685
- strokeWidth: "1.5",
6686
- strokeLinecap: "round",
6687
- strokeLinejoin: "round"
6688
- }
6689
- ),
6690
- /* @__PURE__ */ jsx(
6691
- "path",
6692
- {
6693
- d: "M14.75 6.75H0.75",
6694
- stroke: "currentColor",
6695
- strokeWidth: "1.5",
6696
- strokeLinecap: "round",
6697
- strokeLinejoin: "round"
6698
- }
6699
- )
6700
- ]
6661
+ className: cn(
6662
+ "size-4 flex items-center justify-center text-gray-500",
6663
+ className
6664
+ ),
6665
+ children: /* @__PURE__ */ jsxs(
6666
+ "svg",
6667
+ {
6668
+ xmlns: "http://www.w3.org/2000/svg",
6669
+ width: "16",
6670
+ height: "14",
6671
+ viewBox: "0 0 16 14",
6672
+ fill: "none",
6673
+ className: cn("text-inherit w-full h-full"),
6674
+ children: [
6675
+ /* @__PURE__ */ jsx(
6676
+ "path",
6677
+ {
6678
+ d: "M8.75 12.75H0.75",
6679
+ stroke: "currentColor",
6680
+ strokeWidth: "1.5",
6681
+ strokeLinecap: "round",
6682
+ "stroke-linejoin": "round"
6683
+ }
6684
+ ),
6685
+ /* @__PURE__ */ jsx(
6686
+ "path",
6687
+ {
6688
+ d: "M10.75 0.75H0.75",
6689
+ stroke: "currentColor",
6690
+ strokeWidth: "1.5",
6691
+ strokeLinecap: "round",
6692
+ strokeLinejoin: "round"
6693
+ }
6694
+ ),
6695
+ /* @__PURE__ */ jsx(
6696
+ "path",
6697
+ {
6698
+ d: "M14.75 6.75H0.75",
6699
+ stroke: "currentColor",
6700
+ strokeWidth: "1.5",
6701
+ strokeLinecap: "round",
6702
+ strokeLinejoin: "round"
6703
+ }
6704
+ )
6705
+ ]
6706
+ }
6707
+ )
6701
6708
  }
6702
6709
  );
6703
6710
  }
@@ -6717,7 +6724,7 @@ function UtilityRevisionsHide({ className }) {
6717
6724
  height: "15",
6718
6725
  viewBox: "0 0 17 15",
6719
6726
  fill: "none",
6720
- className: cn("text-inherit"),
6727
+ className: cn("text-inherit w-full h-full"),
6721
6728
  children: [
6722
6729
  /* @__PURE__ */ jsx(
6723
6730
  "path",
@@ -6882,7 +6889,7 @@ function UtilityFeedback({ className }) {
6882
6889
  height: "28",
6883
6890
  viewBox: "0 0 30 28",
6884
6891
  fill: "none",
6885
- className: cn("text-inherit"),
6892
+ className: cn("text-inherit w-full h-full"),
6886
6893
  children: /* @__PURE__ */ jsx(
6887
6894
  "path",
6888
6895
  {
@@ -6915,7 +6922,7 @@ function UtilityRevisionsShow({ className }) {
6915
6922
  height: "26",
6916
6923
  viewBox: "0 0 30 26",
6917
6924
  fill: "none",
6918
- className: cn("text-inherit"),
6925
+ className: cn("text-inherit w-full h-full"),
6919
6926
  children: [
6920
6927
  /* @__PURE__ */ jsx(
6921
6928
  "path",
@@ -6928,20 +6935,20 @@ function UtilityRevisionsShow({ className }) {
6928
6935
  "path",
6929
6936
  {
6930
6937
  d: "M9.84194 11.5L1 20.5006V25.0009H14.2629L18.6839 20.5006",
6931
- stroke: "#282A31",
6932
- "stroke-width": "2",
6933
- "stroke-linecap": "round",
6934
- "stroke-linejoin": "round"
6938
+ stroke: "currentColor",
6939
+ strokeWidth: "2",
6940
+ strokeLinecap: "round",
6941
+ strokeLinejoin: "round"
6935
6942
  }
6936
6943
  ),
6937
6944
  /* @__PURE__ */ jsx(
6938
6945
  "path",
6939
6946
  {
6940
6947
  d: "M28.9999 13.0008L22.2211 19.9013C21.6702 20.451 20.9295 20.7589 20.158 20.7589C19.3865 20.7589 18.6458 20.451 18.0949 19.9013L10.4319 12.1008C9.89184 11.5399 9.58936 10.7859 9.58936 10.0006C9.58936 9.21531 9.89184 8.4613 10.4319 7.90048L17.2107 1",
6941
- stroke: "#282A31",
6942
- "stroke-width": "2",
6943
- "stroke-linecap": "round",
6944
- "stroke-linejoin": "round"
6948
+ stroke: "currentColor",
6949
+ strokeWidth: "2",
6950
+ strokeLinecap: "round",
6951
+ strokeLinejoin: "round"
6945
6952
  }
6946
6953
  )
6947
6954
  ]
@@ -12410,10 +12417,7 @@ const MobileNavPanel = ({ className, children }) => {
12410
12417
  return (nav == null ? void 0 : nav.offsetHeight) ?? 0;
12411
12418
  };
12412
12419
  const getAvailableHeight = () => {
12413
- var _a;
12414
- const parent = (_a = panelRef.current) == null ? void 0 : _a.parentElement;
12415
- const container = (parent == null ? void 0 : parent.clientHeight) ?? window.innerHeight;
12416
- return container - getNavBarHeight();
12420
+ return window.innerHeight - getNavBarHeight();
12417
12421
  };
12418
12422
  const measureContentHeight = () => {
12419
12423
  const content = contentRef.current;
@@ -12432,67 +12436,94 @@ const MobileNavPanel = ({ className, children }) => {
12432
12436
  });
12433
12437
  stopAnimation.current = () => controls.stop();
12434
12438
  };
12435
- useEffect(() => {
12436
- let cancelled = false;
12439
+ useLayoutEffect(() => {
12437
12440
  if (open) {
12438
12441
  stateRef.current = "initial";
12439
- requestAnimationFrame(() => {
12440
- if (cancelled) return;
12441
- const h = measureContentHeight();
12442
- cachedInitialHeight.current = h;
12443
- springTo(h);
12444
- });
12442
+ const h = measureContentHeight();
12443
+ cachedInitialHeight.current = h;
12444
+ springTo(h);
12445
12445
  } else {
12446
12446
  stateRef.current = "closed";
12447
12447
  cachedInitialHeight.current = 0;
12448
12448
  springTo(0);
12449
12449
  }
12450
- return () => {
12451
- cancelled = true;
12452
- };
12453
12450
  }, [open]);
12451
+ useLayoutEffect(() => {
12452
+ if (!open) return;
12453
+ const h = measureContentHeight();
12454
+ cachedInitialHeight.current = h;
12455
+ if (stateRef.current !== "full") {
12456
+ stateRef.current = "initial";
12457
+ springTo(h);
12458
+ }
12459
+ }, [activeKey]);
12454
12460
  useEffect(() => {
12455
12461
  if (!open) return;
12456
- let cancelled = false;
12457
- requestAnimationFrame(() => {
12458
- requestAnimationFrame(() => {
12459
- if (cancelled) return;
12460
- const h = measureContentHeight();
12461
- cachedInitialHeight.current = h;
12462
- if (stateRef.current === "initial" || stateRef.current === "closed") {
12463
- stateRef.current = "initial";
12464
- springTo(h);
12465
- }
12466
- });
12467
- });
12468
- return () => {
12469
- cancelled = true;
12462
+ const handleKeyDown = (e) => {
12463
+ if (e.key === "Escape") close();
12470
12464
  };
12471
- }, [activeKey]);
12472
- const dragDirection = useRef(null);
12473
- const handlePanStart = () => {
12474
- dragDirection.current = null;
12465
+ document.addEventListener("keydown", handleKeyDown);
12466
+ return () => document.removeEventListener("keydown", handleKeyDown);
12467
+ }, [open, close]);
12468
+ const isDragging = useRef(false);
12469
+ const lastY = useRef(0);
12470
+ const dragStartY = useRef(0);
12471
+ const dragStartTime = useRef(0);
12472
+ const dragMaxHeight = useRef(0);
12473
+ const handlePointerDown = (e) => {
12474
+ var _a;
12475
+ e.currentTarget.setPointerCapture(e.pointerId);
12476
+ (_a = stopAnimation.current) == null ? void 0 : _a.call(stopAnimation);
12477
+ isDragging.current = true;
12478
+ lastY.current = e.clientY;
12479
+ dragStartY.current = e.clientY;
12480
+ dragStartTime.current = Date.now();
12481
+ dragMaxHeight.current = getAvailableHeight();
12475
12482
  };
12476
- const handlePan = (_, info) => {
12477
- dragDirection.current = info.offset.y < 0 ? "up" : "down";
12483
+ const handlePointerMove = (e) => {
12484
+ if (!isDragging.current) return;
12485
+ const dy = e.clientY - lastY.current;
12486
+ lastY.current = e.clientY;
12487
+ const current = heightMV.get();
12488
+ const next = Math.max(0, current - dy);
12489
+ heightMV.set(Math.min(next, dragMaxHeight.current));
12478
12490
  };
12479
- const handlePanEnd = () => {
12480
- const dir = dragDirection.current;
12481
- if (!dir) return;
12482
- if (dir === "up") {
12483
- if (stateRef.current === "initial") {
12484
- stateRef.current = "full";
12485
- springTo(getAvailableHeight());
12486
- }
12487
- } else {
12491
+ const handlePointerUp = (e) => {
12492
+ if (!isDragging.current) return;
12493
+ isDragging.current = false;
12494
+ const currentHeight = heightMV.get();
12495
+ const initial = cachedInitialHeight.current;
12496
+ const full = dragMaxHeight.current;
12497
+ const elapsed = Date.now() - dragStartTime.current;
12498
+ const totalDy = e.clientY - dragStartY.current;
12499
+ const velocity = elapsed > 0 ? totalDy / elapsed * 1e3 : 0;
12500
+ const VELOCITY_THRESHOLD = 500;
12501
+ if (velocity > VELOCITY_THRESHOLD) {
12488
12502
  if (stateRef.current === "full") {
12489
12503
  stateRef.current = "initial";
12490
- springTo(cachedInitialHeight.current);
12491
- } else if (stateRef.current === "initial") {
12504
+ springTo(initial);
12505
+ } else {
12492
12506
  stateRef.current = "closed";
12493
12507
  springTo(0);
12494
12508
  close();
12495
12509
  }
12510
+ } else if (velocity < -VELOCITY_THRESHOLD) {
12511
+ stateRef.current = "full";
12512
+ springTo(full);
12513
+ } else {
12514
+ const midInitial = initial / 2;
12515
+ const midFull = (initial + full) / 2;
12516
+ if (currentHeight < midInitial) {
12517
+ stateRef.current = "closed";
12518
+ springTo(0);
12519
+ close();
12520
+ } else if (currentHeight < midFull) {
12521
+ stateRef.current = "initial";
12522
+ springTo(initial);
12523
+ } else {
12524
+ stateRef.current = "full";
12525
+ springTo(full);
12526
+ }
12496
12527
  }
12497
12528
  };
12498
12529
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -12506,12 +12537,13 @@ const MobileNavPanel = ({ className, children }) => {
12506
12537
  style: { height: heightMV },
12507
12538
  children: [
12508
12539
  /* @__PURE__ */ jsx(
12509
- motion.div,
12540
+ "div",
12510
12541
  {
12511
12542
  className: "mobile-nav-handle",
12512
- onPanStart: handlePanStart,
12513
- onPan: handlePan,
12514
- onPanEnd: handlePanEnd,
12543
+ onPointerDown: handlePointerDown,
12544
+ onPointerMove: handlePointerMove,
12545
+ onPointerUp: handlePointerUp,
12546
+ onPointerCancel: handlePointerUp,
12515
12547
  children: /* @__PURE__ */ jsx("div", { className: "mobile-nav-handle-bar" })
12516
12548
  }
12517
12549
  ),
@@ -12540,11 +12572,15 @@ const MobileNavTrigger = ({
12540
12572
  }
12541
12573
  };
12542
12574
  return /* @__PURE__ */ jsx(
12543
- "button",
12575
+ Button,
12544
12576
  {
12577
+ variant: "clear",
12578
+ size: "icon",
12579
+ type: "button",
12545
12580
  onClick: handleClick,
12546
12581
  disabled,
12547
12582
  "data-active": activeKey === value || void 0,
12583
+ "aria-expanded": activeKey === value && open,
12548
12584
  className: cn("mobile-nav-trigger group", className),
12549
12585
  "aria-label": label,
12550
12586
  children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syscore/ui-library",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "description": "A comprehensive React component library built with Radix UI, Tailwind CSS, and TypeScript",
5
5
  "private": false,
6
6
  "type": "module",