@alexgorbatchev/shadcn 0.0.164 → 0.0.166

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,45 @@ function DiagramViewer({
889
895
  });
890
896
  const center = useRef4({ x: 0.5, y: 0.5 });
891
897
  const viewportRef = useRef4(null);
898
+ const toolbarContainerRef = useRef4(null);
899
+ const toolbarRef = useRef4(null);
892
900
  const mergedStageRef = useMergedRefs3(viewportRef, stageRef);
893
901
  const viewportSize = useElementSize(viewportRef);
894
902
  const parsedSize = useMemo(() => getDiagramSvgSize(svg), [svg]);
895
903
  const naturalSize = naturalSizeProp ?? parsedSize;
896
904
  const [openingZoom, setOpeningZoom] = useState4();
905
+ const [toolbarOverflow, setToolbarOverflow] = useState4({ left: false, right: false });
897
906
  const scales = naturalSize && viewportSize ? getImageZoomScales(naturalSize, viewportSize) : undefined;
907
+ const hasToolbar = showZoomControl || toolbar !== undefined;
908
+ const updateToolbarOverflow = useCallback(() => {
909
+ const el = toolbarRef.current;
910
+ const outer = toolbarContainerRef.current;
911
+ if (!el) {
912
+ setToolbarOverflow((current) => current.left || current.right ? { left: false, right: false } : current);
913
+ return;
914
+ }
915
+ const availableWidth = outer?.clientWidth ?? el.clientWidth;
916
+ const hasOverflow = el.scrollWidth > availableWidth + 1;
917
+ const left = hasOverflow && el.scrollLeft > 1;
918
+ const right = hasOverflow && el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
919
+ setToolbarOverflow((current) => current.left === left && current.right === right ? current : { left, right });
920
+ }, []);
921
+ useIsoLayoutEffect4(() => {
922
+ const el = toolbarRef.current;
923
+ const outer = toolbarContainerRef.current;
924
+ if (!el)
925
+ return;
926
+ updateToolbarOverflow();
927
+ const observer = new ResizeObserver(updateToolbarOverflow);
928
+ observer.observe(el);
929
+ if (outer)
930
+ observer.observe(outer);
931
+ return () => observer.disconnect();
932
+ }, [hasToolbar, updateToolbarOverflow]);
933
+ const scrollToolbar = (delta) => {
934
+ toolbarRef.current?.scrollBy({ left: delta, behavior: "smooth" });
935
+ };
936
+ const toolbarMaskImage = toolbarOverflow.left && toolbarOverflow.right ? "linear-gradient(to right, transparent, black 24px, black calc(100% - 24px), transparent)" : toolbarOverflow.left ? "linear-gradient(to right, transparent, black 24px)" : toolbarOverflow.right ? "linear-gradient(to right, black calc(100% - 24px), transparent)" : undefined;
898
937
  useIsoLayoutEffect4(() => {
899
938
  if (zoom !== undefined || openingZoom !== undefined || !naturalSize || !viewportSize)
900
939
  return;
@@ -918,18 +957,47 @@ function DiagramViewer({
918
957
  "data-zoom": shownZoom,
919
958
  className: "flex size-full min-h-0 min-w-0 flex-1 flex-col gap-2",
920
959
  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",
960
+ hasToolbar && /* @__PURE__ */ jsxs5("div", {
961
+ ref: toolbarContainerRef,
962
+ className: "flex min-w-0 shrink-0 items-center gap-control-gap",
924
963
  children: [
925
- showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
926
- zoom: shownZoom,
927
- scale,
928
- scales,
929
- onZoomChange: setZoom,
930
- density
964
+ toolbarOverflow.left && /* @__PURE__ */ jsx5(Button2, {
965
+ type: "button",
966
+ variant: "outline",
967
+ size: "icon-sm",
968
+ density,
969
+ "aria-label": "Scroll toolbar left",
970
+ className: "shrink-0",
971
+ onClick: () => scrollToolbar(-120),
972
+ children: /* @__PURE__ */ jsx5(ChevronLeftIcon, {})
931
973
  }),
932
- toolbar
974
+ /* @__PURE__ */ jsxs5("div", {
975
+ ref: toolbarRef,
976
+ "data-slot": "diagram-viewer-toolbar",
977
+ onScroll: updateToolbarOverflow,
978
+ style: toolbarMaskImage ? { maskImage: toolbarMaskImage, WebkitMaskImage: toolbarMaskImage } : undefined,
979
+ 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",
980
+ children: [
981
+ showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
982
+ zoom: shownZoom,
983
+ scale,
984
+ scales,
985
+ onZoomChange: setZoom,
986
+ density
987
+ }),
988
+ toolbar
989
+ ]
990
+ }),
991
+ toolbarOverflow.right && /* @__PURE__ */ jsx5(Button2, {
992
+ type: "button",
993
+ variant: "outline",
994
+ size: "icon-sm",
995
+ density,
996
+ "aria-label": "Scroll toolbar right",
997
+ className: "shrink-0",
998
+ onClick: () => scrollToolbar(120),
999
+ children: /* @__PURE__ */ jsx5(ChevronRightIcon, {})
1000
+ })
933
1001
  ]
934
1002
  }),
935
1003
  /* @__PURE__ */ jsx5(ImageViewport, {
@@ -1441,7 +1509,7 @@ function ImageRegionFields({
1441
1509
  }
1442
1510
  // src/components/image-viewer/ImageGallery.tsx
1443
1511
  import { useControlled as useControlled3 } from "@base-ui/utils/useControlled";
1444
- import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
1512
+ import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon2 } from "lucide-react";
1445
1513
  import {
1446
1514
  useRef as useRef6,
1447
1515
  useState as useState7
@@ -1690,7 +1758,7 @@ function ImageGallery({
1690
1758
  "aria-label": previousLabel,
1691
1759
  disabledReason: index === 0 ? "This is the first image" : undefined,
1692
1760
  onClick: () => step(index - 1),
1693
- children: /* @__PURE__ */ jsx10(ChevronLeftIcon, {})
1761
+ children: /* @__PURE__ */ jsx10(ChevronLeftIcon2, {})
1694
1762
  }),
1695
1763
  /* @__PURE__ */ jsxs8("span", {
1696
1764
  "data-slot": "image-gallery-position",
@@ -1708,7 +1776,7 @@ function ImageGallery({
1708
1776
  "aria-label": nextLabel,
1709
1777
  disabledReason: index === count - 1 ? "This is the last image" : undefined,
1710
1778
  onClick: () => step(index + 1),
1711
- children: /* @__PURE__ */ jsx10(ChevronRightIcon, {})
1779
+ children: /* @__PURE__ */ jsx10(ChevronRightIcon2, {})
1712
1780
  })
1713
1781
  ]
1714
1782
  }),
@@ -1753,6 +1821,7 @@ function MediaShell({
1753
1821
  className: "[@media(max-height:280px)]:gap-1.5 [@media(max-height:280px)]:p-2",
1754
1822
  children: [
1755
1823
  /* @__PURE__ */ jsxs9(DialogHeader2, {
1824
+ className: "[@media(max-height:280px)]:min-h-control-sm [@media(max-height:280px)]:justify-center [@media(max-height:280px)]:pe-8",
1756
1825
  children: [
1757
1826
  /* @__PURE__ */ jsx11(DialogTitle2, {
1758
1827
  className: "truncate",
@@ -1780,7 +1849,7 @@ import { useMergedRefs as useMergedRefs4 } from "@base-ui/utils/useMergedRefs";
1780
1849
  import { useRef as useRef8, useState as useState9 } from "react";
1781
1850
 
1782
1851
  // src/components/image-viewer/ImageComparisonToolbar.tsx
1783
- import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon2, Columns2Icon, Rows2Icon } from "lucide-react";
1852
+ import { ChevronLeftIcon as ChevronLeftIcon3, ChevronRightIcon as ChevronRightIcon3, Columns2Icon, Rows2Icon } from "lucide-react";
1784
1853
  import { useId as useId3 } from "react";
1785
1854
  import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1786
1855
  function ToolbarSection({ title, titleId, children }) {
@@ -1998,7 +2067,7 @@ function ImageComparisonToolbar({
1998
2067
  children: toolbar
1999
2068
  }),
2000
2069
  /* @__PURE__ */ jsxs10("div", {
2001
- className: "flex shrink-0 items-center gap-1.5",
2070
+ className: "flex min-h-control-sm shrink-0 items-center gap-1.5",
2002
2071
  children: [
2003
2072
  /* @__PURE__ */ jsx12(Switch2, {
2004
2073
  id: `${id}-differences`,
@@ -2064,7 +2133,7 @@ function ImageComparisonToolbar({
2064
2133
  "aria-label": "Previous change",
2065
2134
  "aria-keyshortcuts": "Shift+N",
2066
2135
  onClick: () => onStepChange(-1),
2067
- children: /* @__PURE__ */ jsx12(ChevronLeftIcon2, {})
2136
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon3, {})
2068
2137
  }),
2069
2138
  /* @__PURE__ */ jsx12(Button2, {
2070
2139
  variant: "outline",
@@ -2073,7 +2142,7 @@ function ImageComparisonToolbar({
2073
2142
  "aria-label": "Next change",
2074
2143
  "aria-keyshortcuts": "N",
2075
2144
  onClick: () => onStepChange(1),
2076
- children: /* @__PURE__ */ jsx12(ChevronRightIcon2, {})
2145
+ children: /* @__PURE__ */ jsx12(ChevronRightIcon3, {})
2077
2146
  }),
2078
2147
  onCommentActiveDifference && /* @__PURE__ */ jsx12(Button2, {
2079
2148
  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.166",
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.166",
4
4
  "description": "Sharp, monospace React components with compact, comfortable, and touch densities.",
5
5
  "license": "MIT",
6
6
  "repository": {