@alexgorbatchev/shadcn 0.0.145 → 0.0.147

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/README.md CHANGED
@@ -73,7 +73,7 @@ Import shared controls and providers from `@alexgorbatchev/shadcn`. Import the f
73
73
  | `/image-crop` | ImageCrop and native export helpers | `bun add react-image-crop@^11.1.2` |
74
74
  | `/image-viewer` | ImageViewer, ImageZoomToggle, ImageComparison, and image helpers | Existing core peers |
75
75
  | `/text-diff` | TextDiff: two versions of a text as a line diff | `bun add diff@9.0.0 parse-diff@0.12.0` |
76
- | `/tree` | Tree, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0`; patched runtimes are bundled |
76
+ | `/tree` | Tree, TreeSelect, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0`; patched runtimes are bundled |
77
77
  | `/editor` | RichTextEditor, native Tiptap hooks and StarterKit | `bun add @tiptap/core@^3.32.0 @tiptap/react@^3.32.0 @tiptap/pm@^3.32.0 @tiptap/starter-kit@^3.32.0` |
78
78
  | `/event-calendar` | EventCalendar, EventForm and native calendar APIs | `bun add date-fns@^4.4.0`; TypeScript: `bun add -d @types/react-big-calendar@^1.16.3` |
79
79
  | `/gantt` | Gantt and Roadmap | `bun add date-fns@^4.4.0 @date-fns/tz@^1.5.0` |
@@ -548,6 +548,8 @@ function Screenshot({ src, onPick }: { src: string; onPick: (point: INormalizedI
548
548
 
549
549
  "Highlight differences" draws both images at the after image's natural size and compares premultiplied channels against a threshold. Changed pixels are aggregated into 16px cells and connected regions, outlined with the warning token over the after image (toggle and swipe) or both panes (side-by-side), and summarized as "3 changed regions" or "No visible differences". The comparison runs in time-boxed slices that yield to the browser and is cached per image pair for the component's lifetime. When pixels cannot be read, such as a cross-origin image served without CORS or an image that failed to decode, the switch is disabled and the reason is shown. Pass `crossOrigin: "anonymous"` only when the image server sends CORS headers. `computeImageDiff(before, after, options)` exposes the same pure comparison for equally sized `ImageData`.
550
550
 
551
+ `TreeSelect` (`@alexgorbatchev/shadcn/tree`) chooses one place in a hierarchy, such as a destination folder. Pass `nodes` (`{ id, label, children?, disabledReason? }`), the chosen `value` and `onValueChange`, and `label` to name the tree. A filter (named by `filterLabel`, default "Filter") keeps every node whose name matches, with its ancestors; `emptyLabel` (default "No matches") shows when nothing does. ↓ in the filter enters the tree, which is one Tab stop: arrows move and expand, and Enter, Space or a click chooses. `currentId` marks where the item sits now with `currentLabel` (default "Current location") as the row description; a node with `disabledReason`, such as "Archived", stays listed, faded and `aria-disabled` with its reason as the description, and is never chosen. `isDisabled` disables the filter and choosing.
552
+
551
553
  `TextDiff` (`@alexgorbatchev/shadcn/text-diff`) shows two versions of a text, `before` and `after`, as a line diff labelled by `beforeLabel` and `afterLabel` (default "Before" and "After"). Removed lines carry "-" and added lines "+" in a sign gutter as well as colour, and use `del` and `ins`; long lines wrap, so the diff never scrolls sideways. Unchanged runs further than `contextLines` (default 3) from a change fold behind a "Show N unchanged lines" button that toggles them with `aria-expanded`. `viewMode` is `"auto"` (default), `"unified"`, or `"split"`; auto shows the versions side by side once the diff's own width reaches `splitMinWidth` (default 560 px) and stacked below it, and stacked before the first measurement. A missing final newline is not shown as a change. `showLineNumbers` defaults to true.
552
554
 
553
555
  The toolbar holds the mode, orientation (enabled for side-by-side), zoom, hold-to-show-before (enabled for toggle), and highlight controls with the legend and status. It sits beside a comparison at least 48rem wide and wraps below narrower ones; `showToolbar={false}` hides it, leaving consumers to control the props themselves.
@@ -518,6 +518,7 @@ function OptionCheckboxGroup2({ analytics, density, className, ...props }) {
518
518
  });
519
519
  }
520
520
  var CARD_CLASS = "group/option-card grid w-full cursor-pointer grid-cols-[1.25rem_minmax(0,1fr)] items-start gap-x-2 rounded-md border border-input bg-card p-panel-sm text-start text-sm text-card-foreground transition-colors outline-none hover:bg-muted/40 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:outline-solid data-checked:border-primary data-checked:ring-1 data-checked:ring-primary forced-colors:data-checked:border-[color:Highlight] aria-invalid:not-data-checked:border-destructive data-disabled:cursor-not-allowed data-disabled:opacity-50 data-disabled:hover:bg-card data-readonly:cursor-default data-folding:pb-10";
521
+ var CARD_CONTROL_SELECTOR = '[data-slot="option-card"], [data-slot="option-checkbox-card"]';
521
522
  function useFold(lines) {
522
523
  const ref = useRef(null);
523
524
  const [isOverflowing, setIsOverflowing] = useState(false);
@@ -539,9 +540,9 @@ function useFold(lines) {
539
540
  return {
540
541
  ref,
541
542
  height,
542
- isFoldable: lines !== undefined && (isOverflowing || isOpen),
543
+ isFoldable: lines !== undefined && isOverflowing && !isOpen,
543
544
  isOpen,
544
- toggle: () => setIsOpen((open) => !open)
545
+ open: () => setIsOpen(true)
545
546
  };
546
547
  }
547
548
  function getLineHeight(element) {
@@ -639,11 +640,14 @@ function FoldToggle({ fold, descriptionId }) {
639
640
  variant: "outline",
640
641
  size: "xs",
641
642
  "data-slot": "option-card-fold",
642
- "aria-expanded": fold.isOpen,
643
+ "aria-expanded": false,
643
644
  "aria-controls": descriptionId,
644
645
  className: "absolute end-3 bottom-1.5",
645
- onClick: fold.toggle,
646
- children: fold.isOpen ? "Less" : "More"
646
+ onClick: () => {
647
+ fold.ref.current?.closest(CARD_CONTROL_SELECTOR)?.focus();
648
+ fold.open();
649
+ },
650
+ children: "More"
647
651
  });
648
652
  }
649
653
  function useOptionCardIds() {
@@ -4243,6 +4247,13 @@ function ReadMore2({ maxHeight, density, className, style, children, ...props })
4243
4247
  const ref = useRef7(null);
4244
4248
  const [isOverflowing, setIsOverflowing] = useState8(false);
4245
4249
  const [isOpen, setIsOpen] = useState8(false);
4250
+ const shouldFocusContent = useRef7(false);
4251
+ useLayoutEffect3(() => {
4252
+ if (!isOpen || !shouldFocusContent.current)
4253
+ return;
4254
+ shouldFocusContent.current = false;
4255
+ ref.current?.focus();
4256
+ }, [isOpen]);
4246
4257
  useLayoutEffect3(() => {
4247
4258
  const element = ref.current;
4248
4259
  if (!element || isOpen)
@@ -4264,20 +4275,24 @@ function ReadMore2({ maxHeight, density, className, style, children, ...props })
4264
4275
  ref,
4265
4276
  "data-slot": "read-more-content",
4266
4277
  "data-folded": isFolded && isOverflowing || undefined,
4267
- className: cn2("w-full min-w-0 data-folded:mask-b-from-[calc(100%-2rem)] data-folded:mask-b-to-100%", isFolded && "overflow-hidden", className),
4278
+ tabIndex: isOpen ? -1 : undefined,
4279
+ className: cn2("w-full min-w-0 outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring focus-visible:outline-solid data-folded:mask-b-from-[calc(100%-2rem)] data-folded:mask-b-to-100%", isFolded && "overflow-hidden", className),
4268
4280
  style: isFolded ? { ...style, maxHeight } : style,
4269
4281
  ...props,
4270
4282
  children
4271
4283
  }),
4272
- (isOverflowing || isOpen) && /* @__PURE__ */ jsx41(Button2, {
4284
+ isOverflowing && isFolded && /* @__PURE__ */ jsx41(Button2, {
4273
4285
  type: "button",
4274
4286
  variant: "link",
4275
4287
  size: "sm",
4276
4288
  "data-slot": "read-more-toggle",
4277
- "aria-expanded": isOpen,
4289
+ "aria-expanded": false,
4278
4290
  "aria-controls": `${id}-content`,
4279
- onClick: () => setIsOpen((open) => !open),
4280
- children: isOpen ? "Less" : "More"
4291
+ onClick: () => {
4292
+ shouldFocusContent.current = true;
4293
+ setIsOpen(true);
4294
+ },
4295
+ children: "More"
4281
4296
  })
4282
4297
  ]
4283
4298
  });
@@ -23,8 +23,9 @@ interface IOptionCardContentProps {
23
23
  /** A short explanation shown below the label, such as the option's trade-off. */
24
24
  description?: ReactNode;
25
25
  /**
26
- * Folds the description after this many lines, with a More button that shows the rest. The button sits inside the
27
- * card's border but outside the card's control, so pressing it never changes the choice.
26
+ * Folds the description after this many lines, with a More button that shows the rest for good: once unfolded, the
27
+ * description stays open and the button goes away. The button sits inside the card's border but outside the card's
28
+ * control, so pressing it never changes the choice.
28
29
  */
29
30
  descriptionLines?: number;
30
31
  /** Marks the option the author recommends with a tag after its label and a tinted border. */
@@ -5,8 +5,9 @@ type ReadMoreProps = ComponentProps<"div"> & IDensityProps & {
5
5
  maxHeight: string;
6
6
  };
7
7
  /**
8
- * Long content folded to `maxHeight`, with a More button that shows the rest and Less that folds it again. Content
9
- * that fits shows in full with no button. The fold fades out its last line so the cut reads as intended.
8
+ * Long content folded to `maxHeight`, with a More button that shows the rest for good: once unfolded, the content stays
9
+ * open, the button goes away and focus moves to the content. Content that fits shows in full with no button. The fold
10
+ * fades out its last line so the cut reads as intended.
10
11
  */
11
12
  declare function ReadMore({ maxHeight, density, className, style, children, ...props }: ReadMoreProps): ReactElement;
12
13
  export { ReadMore };
@@ -26,7 +26,7 @@ import {
26
26
  PaginationPrevious2,
27
27
  PaginationNext2,
28
28
  PaginationEllipsis2
29
- } from "../../chunk-wq1prnfw.js";
29
+ } from "../../chunk-v1semj30.js";
30
30
  import {
31
31
  MenuPopup,
32
32
  MenuItem2,
@@ -0,0 +1,35 @@
1
+ import type { ReactElement } from "react";
2
+ /** A place a `TreeSelect` offers, with the places inside it. */
3
+ export interface ITreeSelectNode {
4
+ id: string;
5
+ label: string;
6
+ children?: readonly ITreeSelectNode[] | undefined;
7
+ /** Why this place cannot be chosen, such as "Archived": it stays listed, reachable and described, but not choosable. */
8
+ disabledReason?: string | undefined;
9
+ }
10
+ export interface ITreeSelectProps {
11
+ nodes: readonly ITreeSelectNode[];
12
+ /** The chosen node's id, or null while nothing is chosen. */
13
+ value: string | null;
14
+ /** Called with a node chosen by click, Enter or Space; nodes with a `disabledReason` are never chosen. */
15
+ onValueChange: (id: string) => void;
16
+ /** Names the tree, such as "Destination". */
17
+ label: string;
18
+ /** Names the filter field; defaults to "Filter". */
19
+ filterLabel?: string | undefined;
20
+ filterPlaceholder?: string | undefined;
21
+ /** The node where the item sits now, marked with `currentLabel`. */
22
+ currentId?: string | undefined;
23
+ /** Defaults to "Current location". */
24
+ currentLabel?: string | undefined;
25
+ /** Shown when the filter matches nothing; defaults to "No matches". */
26
+ emptyLabel?: string | undefined;
27
+ isDisabled?: boolean | undefined;
28
+ }
29
+ /**
30
+ * Chooses one place in a hierarchy, such as a destination folder: a filter that matches any node's name and keeps its
31
+ * ancestors in view, above a tree that is one Tab stop. ↓ in the filter enters the tree; arrows move and expand; Enter,
32
+ * Space or a click chooses. The current place carries `currentLabel`, and places that cannot be chosen stay listed with
33
+ * their reason as the row's description.
34
+ */
35
+ export declare function TreeSelect({ nodes, value, onValueChange, label, filterLabel, filterPlaceholder, currentId, currentLabel, emptyLabel, isDisabled, }: ITreeSelectProps): ReactElement;
@@ -5,3 +5,5 @@ export type { TreeItemProps, TreeItemStatus } from "./TreeItem.js";
5
5
  export { useTree, AssistiveTreeDescription } from "@headless-tree/react";
6
6
  export { syncDataLoaderFeature, asyncDataLoaderFeature, hotkeysCoreFeature, selectionFeature, checkboxesFeature, searchFeature, renamingFeature, expandAllFeature, dragAndDropFeature, keyboardDragAndDropFeature, isOrderedDragTarget, } from "@headless-tree/core";
7
7
  export type { TreeInstance, ItemInstance, TreeConfig, DragTarget } from "@headless-tree/core";
8
+ export { TreeSelect } from "./TreeSelect.js";
9
+ export type { ITreeSelectNode, ITreeSelectProps } from "./TreeSelect.js";
@@ -17,6 +17,10 @@ import {
17
17
  TooltipContent2,
18
18
  Button2
19
19
  } from "../../chunk-2sx8m8b2.js";
20
+ import"../../chunk-7jpsybag.js";
21
+ import {
22
+ Input2
23
+ } from "../../chunk-7vg045gd.js";
20
24
  import {
21
25
  useAnalyticsCallback
22
26
  } from "../../chunk-5mydsjp3.js";
@@ -2624,6 +2628,143 @@ var useTree = (config) => {
2624
2628
  }));
2625
2629
  return tree.current;
2626
2630
  };
2631
+ // src/components/tree/TreeSelect.tsx
2632
+ import { useEffect as useEffect2, useId as useId2, useMemo, useState as useState2 } from "react";
2633
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2634
+ var ROOT_ID = "tree-select-root";
2635
+ function indexNodes(nodes, parentId, index) {
2636
+ for (const node of nodes) {
2637
+ index.set(node.id, { node, parentId });
2638
+ indexNodes(node.children ?? [], node.id, index);
2639
+ }
2640
+ }
2641
+ function getVisibleIds(index, filter) {
2642
+ const query = filter.trim().toLocaleLowerCase();
2643
+ const visible = new Set;
2644
+ for (const [id, { node }] of index) {
2645
+ if (query && !node.label.toLocaleLowerCase().includes(query))
2646
+ continue;
2647
+ let current = id;
2648
+ while (current && current !== ROOT_ID && !visible.has(current)) {
2649
+ visible.add(current);
2650
+ current = index.get(current)?.parentId;
2651
+ }
2652
+ }
2653
+ return visible;
2654
+ }
2655
+ function TreeSelect({
2656
+ nodes,
2657
+ value,
2658
+ onValueChange,
2659
+ label,
2660
+ filterLabel = "Filter",
2661
+ filterPlaceholder,
2662
+ currentId,
2663
+ currentLabel = "Current location",
2664
+ emptyLabel = "No matches",
2665
+ isDisabled = false
2666
+ }) {
2667
+ const filterId = useId2();
2668
+ const [filter, setFilter] = useState2("");
2669
+ const index = useMemo(() => {
2670
+ const result = new Map;
2671
+ indexNodes(nodes, ROOT_ID, result);
2672
+ return result;
2673
+ }, [nodes]);
2674
+ const visible = useMemo(() => getVisibleIds(index, filter), [index, filter]);
2675
+ const [collapsed, setCollapsed] = useState2(() => new Set);
2676
+ const getChildren = (id) => (id === ROOT_ID ? nodes : index.get(id)?.node.children ?? []).map((child) => child.id).filter((child) => visible.has(child));
2677
+ const parents = useMemo(() => [...index.values()].filter(({ node }) => (node.children?.length ?? 0) > 0).map(({ node }) => node.id), [index]);
2678
+ const isFiltering = filter.trim() !== "";
2679
+ const expandedItems = useMemo(() => parents.filter((id) => isFiltering || !collapsed.has(id)), [parents, isFiltering, collapsed]);
2680
+ const selectedItems = useMemo(() => value ? [value] : [], [value]);
2681
+ const choose = (id) => {
2682
+ if (isDisabled || index.get(id)?.node.disabledReason)
2683
+ return;
2684
+ onValueChange(id);
2685
+ };
2686
+ const tree = useTree({
2687
+ rootItemId: ROOT_ID,
2688
+ getItemName: (item) => item.getItemData().label,
2689
+ isItemFolder: (item) => getChildren(item.getId()).length > 0,
2690
+ dataLoader: {
2691
+ getItem: (id) => index.get(id)?.node ?? { id: ROOT_ID, label },
2692
+ getChildren
2693
+ },
2694
+ initialState: { focusedItem: value },
2695
+ state: { expandedItems, selectedItems },
2696
+ setExpandedItems: (next) => {
2697
+ const expanded = typeof next === "function" ? next(expandedItems) : next;
2698
+ const nextCollapsed = parents.filter((id) => !expanded.includes(id));
2699
+ if (nextCollapsed.length !== collapsed.size || nextCollapsed.some((id) => !collapsed.has(id)))
2700
+ setCollapsed(new Set(nextCollapsed));
2701
+ },
2702
+ setSelectedItems: () => {
2703
+ return;
2704
+ },
2705
+ onPrimaryAction: (item) => choose(item.getId()),
2706
+ features: [syncDataLoaderFeature, hotkeysCoreFeature, selectionFeature]
2707
+ });
2708
+ const visibleKey = [...visible].join(`
2709
+ `);
2710
+ useEffect2(() => {
2711
+ tree.rebuildTree();
2712
+ }, [tree, visibleKey]);
2713
+ const hasItems = visible.size > 0;
2714
+ return /* @__PURE__ */ jsxs3("div", {
2715
+ "data-testid": "TreeSelect",
2716
+ "data-slot": "tree-select",
2717
+ className: "flex min-w-0 flex-col gap-2",
2718
+ children: [
2719
+ /* @__PURE__ */ jsx3(Input2, {
2720
+ id: filterId,
2721
+ type: "search",
2722
+ "aria-label": filterLabel,
2723
+ placeholder: filterPlaceholder,
2724
+ value: filter,
2725
+ disabled: isDisabled,
2726
+ autoComplete: "off",
2727
+ onChange: (event) => setFilter(event.target.value),
2728
+ onKeyDown: (event) => {
2729
+ if (event.key !== "ArrowDown")
2730
+ return;
2731
+ const target = tree.getItems().find((item) => item.getId() === tree.getState().focusedItem) ?? tree.getItems().at(0);
2732
+ if (!target)
2733
+ return;
2734
+ event.preventDefault();
2735
+ target.setFocused();
2736
+ target.getElement()?.focus();
2737
+ }
2738
+ }),
2739
+ hasItems ? /* @__PURE__ */ jsx3(Tree, {
2740
+ tree,
2741
+ label,
2742
+ renderItem: (item) => {
2743
+ const node = item.getItemData();
2744
+ const description = node.disabledReason ?? (node.id === currentId ? currentLabel : undefined);
2745
+ return /* @__PURE__ */ jsx3(TreeItem, {
2746
+ item,
2747
+ expandOn: "disclosure",
2748
+ description,
2749
+ isDimmed: Boolean(node.disabledReason),
2750
+ "aria-disabled": node.disabledReason || isDisabled ? true : undefined,
2751
+ "data-current": node.id === currentId ? "" : undefined,
2752
+ onKeyDown: (event) => {
2753
+ if (event.key !== " ")
2754
+ return;
2755
+ event.preventDefault();
2756
+ choose(item.getId());
2757
+ }
2758
+ });
2759
+ }
2760
+ }) : /* @__PURE__ */ jsx3("p", {
2761
+ role: "status",
2762
+ className: "px-2 py-3 text-sm text-muted-foreground",
2763
+ children: emptyLabel
2764
+ })
2765
+ ]
2766
+ });
2767
+ }
2627
2768
  export {
2628
2769
  AssistiveTreeDescription,
2629
2770
  Tree,
@@ -2631,6 +2772,7 @@ export {
2631
2772
  TreeItemAction,
2632
2773
  TreeItemDot,
2633
2774
  TreeItemStatusIcon,
2775
+ TreeSelect,
2634
2776
  asyncDataLoaderFeature,
2635
2777
  checkboxesFeature,
2636
2778
  dragAndDropFeature,
package/dist/index.js CHANGED
@@ -188,7 +188,7 @@ import {
188
188
  DashboardLayout2,
189
189
  BillingUsage2,
190
190
  SelectionAction2
191
- } from "./chunk-wq1prnfw.js";
191
+ } from "./chunk-v1semj30.js";
192
192
  import {
193
193
  statusDotVariants2,
194
194
  StatusDot2
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.145",
2054
+ version: "0.0.147",
2055
2055
  description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -1,6 +1,6 @@
1
1
  # ReadMore
2
2
 
3
- ReadMore folds long content to `maxHeight` with a More button, and Less folds it again. Content that fits shows in full without a button.
3
+ ReadMore folds long content to `maxHeight` with a More button that unfolds it for good: no Less button follows. Content that fits shows in full without a button.
4
4
 
5
5
  Story: @alexgorbatchev/shadcn/components/layout/ReadMore
6
6
  Source: src/components/stories/layout/ReadMore.stories.tsx
@@ -0,0 +1,68 @@
1
+ # TreeSelect
2
+
3
+ Story: @alexgorbatchev/shadcn/components/navigation/TreeSelect
4
+ Source: src/components/stories/navigation/TreeSelect.stories.tsx
5
+
6
+ [Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/navigation/TreeSelect.stories.tsx)
7
+
8
+ ## Public imports
9
+
10
+ ```tsx
11
+ import { TreeSelect, type ITreeSelectNode, type ITreeSelectProps } from "@alexgorbatchev/shadcn/tree";
12
+ ```
13
+
14
+ ## Supporting imports
15
+
16
+ ```tsx
17
+ import { useState, type ReactElement } from "react";
18
+ ```
19
+
20
+ ## Default component
21
+
22
+ ```tsx
23
+ TreeSelect
24
+ ```
25
+
26
+ ## Default render
27
+
28
+ ```tsx
29
+ () => <Picker />
30
+ ```
31
+
32
+ ## Examples
33
+
34
+ Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
35
+
36
+ ### Hierarchy
37
+
38
+ ```tsx
39
+ {}
40
+ ```
41
+
42
+ ### FilterAndKeys
43
+
44
+ ```tsx
45
+ {}
46
+ ```
47
+
48
+ ### NoMatches
49
+
50
+ ```tsx
51
+ {}
52
+ ```
53
+
54
+ ### SpaceAndDisabled
55
+
56
+ ```tsx
57
+ {
58
+ render: () => <Picker />
59
+ }
60
+ ```
61
+
62
+ ### Disabled
63
+
64
+ ```tsx
65
+ {
66
+ render: () => <Picker isDisabled/>
67
+ }
68
+ ```
package/llms/setup.md CHANGED
@@ -73,7 +73,7 @@ Import shared controls and providers from `@alexgorbatchev/shadcn`. Import the f
73
73
  | `/image-crop` | ImageCrop and native export helpers | `bun add react-image-crop@^11.1.2` |
74
74
  | `/image-viewer` | ImageViewer, ImageZoomToggle, ImageComparison, and image helpers | Existing core peers |
75
75
  | `/text-diff` | TextDiff: two versions of a text as a line diff | `bun add diff@9.0.0 parse-diff@0.12.0` |
76
- | `/tree` | Tree, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0`; patched runtimes are bundled |
76
+ | `/tree` | Tree, TreeSelect, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0`; patched runtimes are bundled |
77
77
  | `/editor` | RichTextEditor, native Tiptap hooks and StarterKit | `bun add @tiptap/core@^3.32.0 @tiptap/react@^3.32.0 @tiptap/pm@^3.32.0 @tiptap/starter-kit@^3.32.0` |
78
78
  | `/event-calendar` | EventCalendar, EventForm and native calendar APIs | `bun add date-fns@^4.4.0`; TypeScript: `bun add -d @types/react-big-calendar@^1.16.3` |
79
79
  | `/gantt` | Gantt and Roadmap | `bun add date-fns@^4.4.0 @date-fns/tz@^1.5.0` |
@@ -548,6 +548,8 @@ function Screenshot({ src, onPick }: { src: string; onPick: (point: INormalizedI
548
548
 
549
549
  "Highlight differences" draws both images at the after image's natural size and compares premultiplied channels against a threshold. Changed pixels are aggregated into 16px cells and connected regions, outlined with the warning token over the after image (toggle and swipe) or both panes (side-by-side), and summarized as "3 changed regions" or "No visible differences". The comparison runs in time-boxed slices that yield to the browser and is cached per image pair for the component's lifetime. When pixels cannot be read, such as a cross-origin image served without CORS or an image that failed to decode, the switch is disabled and the reason is shown. Pass `crossOrigin: "anonymous"` only when the image server sends CORS headers. `computeImageDiff(before, after, options)` exposes the same pure comparison for equally sized `ImageData`.
550
550
 
551
+ `TreeSelect` (`@alexgorbatchev/shadcn/tree`) chooses one place in a hierarchy, such as a destination folder. Pass `nodes` (`{ id, label, children?, disabledReason? }`), the chosen `value` and `onValueChange`, and `label` to name the tree. A filter (named by `filterLabel`, default "Filter") keeps every node whose name matches, with its ancestors; `emptyLabel` (default "No matches") shows when nothing does. ↓ in the filter enters the tree, which is one Tab stop: arrows move and expand, and Enter, Space or a click chooses. `currentId` marks where the item sits now with `currentLabel` (default "Current location") as the row description; a node with `disabledReason`, such as "Archived", stays listed, faded and `aria-disabled` with its reason as the description, and is never chosen. `isDisabled` disables the filter and choosing.
552
+
551
553
  `TextDiff` (`@alexgorbatchev/shadcn/text-diff`) shows two versions of a text, `before` and `after`, as a line diff labelled by `beforeLabel` and `afterLabel` (default "Before" and "After"). Removed lines carry "-" and added lines "+" in a sign gutter as well as colour, and use `del` and `ins`; long lines wrap, so the diff never scrolls sideways. Unchanged runs further than `contextLines` (default 3) from a change fold behind a "Show N unchanged lines" button that toggles them with `aria-expanded`. `viewMode` is `"auto"` (default), `"unified"`, or `"split"`; auto shows the versions side by side once the diff's own width reaches `splitMinWidth` (default 560 px) and stacked below it, and stacked before the first measurement. A missing final newline is not shown as a change. `showLineNumbers` defaults to true.
552
554
 
553
555
  The toolbar holds the mode, orientation (enabled for side-by-side), zoom, hold-to-show-before (enabled for toggle), and highlight controls with the legend and status. It sits beside a comparison at least 48rem wide and wraps below narrower ones; `showToolbar={false}` hides it, leaving consumers to control the props themselves.
package/llms.txt CHANGED
@@ -444,7 +444,7 @@ Generated from the public package exports and Storybook sources.
444
444
  - [PageHeader](./llms/components/layout/PageHeader.md)
445
445
  - [PageIntro](./llms/components/layout/PageIntro.md)
446
446
  - [PanelHeader](./llms/components/layout/PanelHeader.md)
447
- - [ReadMore](./llms/components/layout/ReadMore.md): ReadMore folds long content to `maxHeight` with a More button, and Less folds it again. Content that fits shows in full without a button.
447
+ - [ReadMore](./llms/components/layout/ReadMore.md): ReadMore folds long content to `maxHeight` with a More button that unfolds it for good: no Less button follows. Content that fits shows in full without a button.
448
448
  - [Resizable](./llms/components/layout/Resizable.md)
449
449
  - [ScrollArea](./llms/components/layout/ScrollArea.md)
450
450
  - [Separator](./llms/components/layout/Separator.md)
@@ -475,6 +475,7 @@ Generated from the public package exports and Storybook sources.
475
475
  - [SkipLink](./llms/components/navigation/SkipLink.md): SkipLink is the first Tab stop: a link to the main content that stays hidden until it has keyboard focus, then shows as an outline button pinned to the top start corner. It jumps to `targetId`; an `onClick` that calls `preventDefault` lets the app move focus itself.
476
476
  - [Tabs](./llms/components/navigation/Tabs.md)
477
477
  - [Tree](./llms/components/navigation/Tree.md)
478
+ - [TreeSelect](./llms/components/navigation/TreeSelect.md)
478
479
  - [WorkspaceSwitcher](./llms/components/navigation/WorkspaceSwitcher.md)
479
480
 
480
481
  ## overlays
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.145",
3
+ "version": "0.0.147",
4
4
  "description": "Sharp, monospace React components with compact, comfortable, and touch densities.",
5
5
  "license": "MIT",
6
6
  "repository": {