@alexgorbatchev/shadcn 0.0.164 → 0.0.165

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.
@@ -409,25 +409,25 @@ function ImageViewport({
409
409
  "data-slot": "image-viewport-scroll-hint",
410
410
  "data-edge": "left",
411
411
  "aria-hidden": "true",
412
- className: "pointer-events-none absolute inset-y-0 left-0 w-5 bg-gradient-to-r from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_8px_0_12px_-8px_rgba(255,255,255,0.28)]"
412
+ className: "pointer-events-none absolute inset-y-0 left-0 w-5 bg-gradient-to-r from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_1px_0_0_rgba(255,255,255,0.22),inset_10px_0_14px_-8px_rgba(255,255,255,0.38)]"
413
413
  }),
414
414
  scrollHints.right && /* @__PURE__ */ jsx("div", {
415
415
  "data-slot": "image-viewport-scroll-hint",
416
416
  "data-edge": "right",
417
417
  "aria-hidden": "true",
418
- className: "pointer-events-none absolute inset-y-0 right-0 w-5 bg-gradient-to-l from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_-8px_0_12px_-8px_rgba(255,255,255,0.28)]"
418
+ className: "pointer-events-none absolute inset-y-0 right-0 w-5 bg-gradient-to-l from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_-1px_0_0_rgba(255,255,255,0.22),inset_-10px_0_14px_-8px_rgba(255,255,255,0.38)]"
419
419
  }),
420
420
  scrollHints.top && /* @__PURE__ */ jsx("div", {
421
421
  "data-slot": "image-viewport-scroll-hint",
422
422
  "data-edge": "top",
423
423
  "aria-hidden": "true",
424
- className: "pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_0_8px_12px_-8px_rgba(255,255,255,0.28)]"
424
+ className: "pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.22),inset_0_10px_14px_-8px_rgba(255,255,255,0.38)]"
425
425
  }),
426
426
  scrollHints.bottom && /* @__PURE__ */ jsx("div", {
427
427
  "data-slot": "image-viewport-scroll-hint",
428
428
  "data-edge": "bottom",
429
429
  "aria-hidden": "true",
430
- className: "pointer-events-none absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_0_-8px_12px_-8px_rgba(255,255,255,0.28)]"
430
+ className: "pointer-events-none absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_0_-1px_0_rgba(255,255,255,0.22),inset_0_-10px_14px_-8px_rgba(255,255,255,0.38)]"
431
431
  })
432
432
  ]
433
433
  });
@@ -863,7 +863,13 @@ function DiagramSurface({
863
863
  import { useControlled as useControlled2 } from "@base-ui/utils/useControlled";
864
864
  import { useIsoLayoutEffect as useIsoLayoutEffect4 } from "@base-ui/utils/useIsoLayoutEffect";
865
865
  import { useMergedRefs as useMergedRefs3 } from "@base-ui/utils/useMergedRefs";
866
- import { useMemo, useRef as useRef4, useState as useState4 } from "react";
866
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
867
+ import {
868
+ useCallback,
869
+ useMemo,
870
+ useRef as useRef4,
871
+ useState as useState4
872
+ } from "react";
867
873
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
868
874
  function DiagramViewer({
869
875
  svg,
@@ -889,12 +895,37 @@ function DiagramViewer({
889
895
  });
890
896
  const center = useRef4({ x: 0.5, y: 0.5 });
891
897
  const viewportRef = useRef4(null);
898
+ const toolbarRef = useRef4(null);
892
899
  const mergedStageRef = useMergedRefs3(viewportRef, stageRef);
893
900
  const viewportSize = useElementSize(viewportRef);
894
901
  const parsedSize = useMemo(() => getDiagramSvgSize(svg), [svg]);
895
902
  const naturalSize = naturalSizeProp ?? parsedSize;
896
903
  const [openingZoom, setOpeningZoom] = useState4();
904
+ const [toolbarOverflow, setToolbarOverflow] = useState4({ left: false, right: false });
897
905
  const scales = naturalSize && viewportSize ? getImageZoomScales(naturalSize, viewportSize) : undefined;
906
+ const hasToolbar = showZoomControl || toolbar !== undefined;
907
+ const updateToolbarOverflow = useCallback(() => {
908
+ const el = toolbarRef.current;
909
+ if (!el) {
910
+ setToolbarOverflow((current) => current.left || current.right ? { left: false, right: false } : current);
911
+ return;
912
+ }
913
+ const left = el.scrollLeft > 1;
914
+ const right = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
915
+ setToolbarOverflow((current) => current.left === left && current.right === right ? current : { left, right });
916
+ }, []);
917
+ useIsoLayoutEffect4(() => {
918
+ const el = toolbarRef.current;
919
+ if (!el)
920
+ return;
921
+ updateToolbarOverflow();
922
+ const observer = new ResizeObserver(updateToolbarOverflow);
923
+ observer.observe(el);
924
+ return () => observer.disconnect();
925
+ }, [hasToolbar, updateToolbarOverflow]);
926
+ const scrollToolbar = (delta) => {
927
+ toolbarRef.current?.scrollBy({ left: delta, behavior: "smooth" });
928
+ };
898
929
  useIsoLayoutEffect4(() => {
899
930
  if (zoom !== undefined || openingZoom !== undefined || !naturalSize || !viewportSize)
900
931
  return;
@@ -918,18 +949,51 @@ function DiagramViewer({
918
949
  "data-zoom": shownZoom,
919
950
  className: "flex size-full min-h-0 min-w-0 flex-1 flex-col gap-2",
920
951
  children: [
921
- (showZoomControl || toolbar !== undefined) && /* @__PURE__ */ jsxs5("div", {
922
- "data-slot": "diagram-viewer-toolbar",
923
- className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0 [@media(max-height:280px)]:flex-nowrap [@media(max-height:280px)]:overflow-x-auto",
952
+ hasToolbar && /* @__PURE__ */ jsxs5("div", {
953
+ className: "relative flex min-w-0 shrink-0 items-center",
924
954
  children: [
925
- showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
926
- zoom: shownZoom,
927
- scale,
928
- scales,
929
- onZoomChange: setZoom,
930
- density
955
+ /* @__PURE__ */ jsxs5("div", {
956
+ ref: toolbarRef,
957
+ "data-slot": "diagram-viewer-toolbar",
958
+ onScroll: updateToolbarOverflow,
959
+ className: "flex min-w-0 flex-1 flex-wrap items-center gap-control-gap *:shrink-0 [@media(max-height:280px)]:flex-nowrap [@media(max-height:280px)]:overflow-x-auto [@media(max-height:280px)]:[scrollbar-width:none] [@media(max-height:280px)]:[&::-webkit-scrollbar]:hidden",
960
+ children: [
961
+ showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
962
+ zoom: shownZoom,
963
+ scale,
964
+ scales,
965
+ onZoomChange: setZoom,
966
+ density
967
+ }),
968
+ toolbar
969
+ ]
931
970
  }),
932
- toolbar
971
+ toolbarOverflow.left && /* @__PURE__ */ jsx5("div", {
972
+ className: "pointer-events-none absolute inset-y-0 left-0 flex items-center bg-gradient-to-r from-background via-background/95 to-transparent pe-4",
973
+ children: /* @__PURE__ */ jsx5(Button2, {
974
+ type: "button",
975
+ variant: "outline",
976
+ size: "icon-sm",
977
+ density,
978
+ "aria-label": "Scroll toolbar left",
979
+ className: "pointer-events-auto bg-background",
980
+ onClick: () => scrollToolbar(-120),
981
+ children: /* @__PURE__ */ jsx5(ChevronLeftIcon, {})
982
+ })
983
+ }),
984
+ toolbarOverflow.right && /* @__PURE__ */ jsx5("div", {
985
+ className: "pointer-events-none absolute inset-y-0 right-0 flex items-center bg-gradient-to-l from-background via-background/95 to-transparent ps-4",
986
+ children: /* @__PURE__ */ jsx5(Button2, {
987
+ type: "button",
988
+ variant: "outline",
989
+ size: "icon-sm",
990
+ density,
991
+ "aria-label": "Scroll toolbar right",
992
+ className: "pointer-events-auto bg-background",
993
+ onClick: () => scrollToolbar(120),
994
+ children: /* @__PURE__ */ jsx5(ChevronRightIcon, {})
995
+ })
996
+ })
933
997
  ]
934
998
  }),
935
999
  /* @__PURE__ */ jsx5(ImageViewport, {
@@ -1441,7 +1505,7 @@ function ImageRegionFields({
1441
1505
  }
1442
1506
  // src/components/image-viewer/ImageGallery.tsx
1443
1507
  import { useControlled as useControlled3 } from "@base-ui/utils/useControlled";
1444
- import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
1508
+ import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon2 } from "lucide-react";
1445
1509
  import {
1446
1510
  useRef as useRef6,
1447
1511
  useState as useState7
@@ -1690,7 +1754,7 @@ function ImageGallery({
1690
1754
  "aria-label": previousLabel,
1691
1755
  disabledReason: index === 0 ? "This is the first image" : undefined,
1692
1756
  onClick: () => step(index - 1),
1693
- children: /* @__PURE__ */ jsx10(ChevronLeftIcon, {})
1757
+ children: /* @__PURE__ */ jsx10(ChevronLeftIcon2, {})
1694
1758
  }),
1695
1759
  /* @__PURE__ */ jsxs8("span", {
1696
1760
  "data-slot": "image-gallery-position",
@@ -1708,7 +1772,7 @@ function ImageGallery({
1708
1772
  "aria-label": nextLabel,
1709
1773
  disabledReason: index === count - 1 ? "This is the last image" : undefined,
1710
1774
  onClick: () => step(index + 1),
1711
- children: /* @__PURE__ */ jsx10(ChevronRightIcon, {})
1775
+ children: /* @__PURE__ */ jsx10(ChevronRightIcon2, {})
1712
1776
  })
1713
1777
  ]
1714
1778
  }),
@@ -1753,6 +1817,7 @@ function MediaShell({
1753
1817
  className: "[@media(max-height:280px)]:gap-1.5 [@media(max-height:280px)]:p-2",
1754
1818
  children: [
1755
1819
  /* @__PURE__ */ jsxs9(DialogHeader2, {
1820
+ className: "[@media(max-height:280px)]:min-h-control-sm [@media(max-height:280px)]:justify-center [@media(max-height:280px)]:pe-8",
1756
1821
  children: [
1757
1822
  /* @__PURE__ */ jsx11(DialogTitle2, {
1758
1823
  className: "truncate",
@@ -1780,7 +1845,7 @@ import { useMergedRefs as useMergedRefs4 } from "@base-ui/utils/useMergedRefs";
1780
1845
  import { useRef as useRef8, useState as useState9 } from "react";
1781
1846
 
1782
1847
  // src/components/image-viewer/ImageComparisonToolbar.tsx
1783
- import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon2, Columns2Icon, Rows2Icon } from "lucide-react";
1848
+ import { ChevronLeftIcon as ChevronLeftIcon3, ChevronRightIcon as ChevronRightIcon3, Columns2Icon, Rows2Icon } from "lucide-react";
1784
1849
  import { useId as useId3 } from "react";
1785
1850
  import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1786
1851
  function ToolbarSection({ title, titleId, children }) {
@@ -1998,7 +2063,7 @@ function ImageComparisonToolbar({
1998
2063
  children: toolbar
1999
2064
  }),
2000
2065
  /* @__PURE__ */ jsxs10("div", {
2001
- className: "flex shrink-0 items-center gap-1.5",
2066
+ className: "flex min-h-control-sm shrink-0 items-center gap-1.5",
2002
2067
  children: [
2003
2068
  /* @__PURE__ */ jsx12(Switch2, {
2004
2069
  id: `${id}-differences`,
@@ -2064,7 +2129,7 @@ function ImageComparisonToolbar({
2064
2129
  "aria-label": "Previous change",
2065
2130
  "aria-keyshortcuts": "Shift+N",
2066
2131
  onClick: () => onStepChange(-1),
2067
- children: /* @__PURE__ */ jsx12(ChevronLeftIcon2, {})
2132
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon3, {})
2068
2133
  }),
2069
2134
  /* @__PURE__ */ jsx12(Button2, {
2070
2135
  variant: "outline",
@@ -2073,7 +2138,7 @@ function ImageComparisonToolbar({
2073
2138
  "aria-label": "Next change",
2074
2139
  "aria-keyshortcuts": "N",
2075
2140
  onClick: () => onStepChange(1),
2076
- children: /* @__PURE__ */ jsx12(ChevronRightIcon2, {})
2141
+ children: /* @__PURE__ */ jsx12(ChevronRightIcon3, {})
2077
2142
  }),
2078
2143
  onCommentActiveDifference && /* @__PURE__ */ jsx12(Button2, {
2079
2144
  variant: "outline",
package/dist/prototype.js CHANGED
@@ -2051,7 +2051,7 @@ var program = new Command;
2051
2051
  // package.json
2052
2052
  var package_default = {
2053
2053
  name: "@alexgorbatchev/shadcn",
2054
- version: "0.0.164",
2054
+ version: "0.0.165",
2055
2055
  description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.164",
3
+ "version": "0.0.165",
4
4
  "description": "Sharp, monospace React components with compact, comfortable, and touch densities.",
5
5
  "license": "MIT",
6
6
  "repository": {