@alexgorbatchev/shadcn 0.0.170 → 0.0.171
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/{chunk-dje4k34n.js → chunk-7bamsyf7.js} +1 -1
- package/dist/components/json-render/index.js +1 -1
- package/dist/components/tree/index.js +5 -3
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/llms/components/forms/FilterChip.md +10 -0
- package/llms/components/navigation/TreeSelect.md +22 -0
- package/package.json +1 -1
|
@@ -5141,7 +5141,7 @@ function FilterChip2({
|
|
|
5141
5141
|
"aria-labelledby": labelId,
|
|
5142
5142
|
"data-density": density,
|
|
5143
5143
|
"data-slot": "filter-chip",
|
|
5144
|
-
className: cn2("inline-flex max-w-full min-w-0 items-center gap-
|
|
5144
|
+
className: cn2("inline-flex max-w-full min-w-0 items-center gap-2 rounded-sm border border-border bg-muted py-0.5 ps-2.5 pe-1 text-xs text-foreground", className),
|
|
5145
5145
|
onKeyDown: (event) => {
|
|
5146
5146
|
onKeyDown?.(event);
|
|
5147
5147
|
if (event.defaultPrevented || event.key !== "Escape")
|
|
@@ -173,7 +173,8 @@ function TreeItem({
|
|
|
173
173
|
item.getTree().getDataRef().current.selectUpToAnchorId = item.getId();
|
|
174
174
|
item.primaryAction();
|
|
175
175
|
};
|
|
176
|
-
const
|
|
176
|
+
const isAriaDisabled = props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
177
|
+
const faded = isDimmed && (isAriaDisabled ? "opacity-70" : "opacity-70 group-hover/tree-item:opacity-100 group-focus-within/tree-item:opacity-100");
|
|
177
178
|
const label = /* @__PURE__ */ jsxs(Fragment, {
|
|
178
179
|
children: [
|
|
179
180
|
(hasIcon || startEnhancer) && /* @__PURE__ */ jsx("span", {
|
|
@@ -248,7 +249,7 @@ function TreeItem({
|
|
|
248
249
|
onDragStart: undefined
|
|
249
250
|
} : {},
|
|
250
251
|
style: { paddingInlineStart: `${item.getItemMeta().level * (item.getTree().getConfig().indent ?? 20) + 8}px` },
|
|
251
|
-
className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm border border-transparent py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && (selectionStyle === "accent" && isSelected ? "border-primary bg-muted/60 font-medium text-foreground" : "bg-accent text-accent-foreground"), tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
|
|
252
|
+
className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm border border-transparent py-1 pr-2 text-sm outline-none", isAriaDisabled ? "focus-visible:ring-1 focus-visible:ring-muted-foreground" : "hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && (selectionStyle === "accent" && isSelected ? "border-primary bg-muted/60 font-medium text-foreground" : "bg-accent text-accent-foreground"), tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
|
|
252
253
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
253
254
|
children: [
|
|
254
255
|
item.isFolder() && expandOn === "disclosure" ? /* @__PURE__ */ jsx(Button2, {
|
|
@@ -2681,7 +2682,8 @@ function TreeSelect({
|
|
|
2681
2682
|
const parents = useMemo(() => [...index.values()].filter(({ node }) => (node.children?.length ?? 0) > 0).map(({ node }) => node.id), [index]);
|
|
2682
2683
|
const isFiltering = filter.trim() !== "";
|
|
2683
2684
|
const expandedItems = useMemo(() => parents.filter((id) => isFiltering || !collapsed.has(id)), [parents, isFiltering, collapsed]);
|
|
2684
|
-
const
|
|
2685
|
+
const isSelectedChoosable = Boolean(value && value !== currentId && !index.get(value)?.node.disabledReason);
|
|
2686
|
+
const selectedItems = useMemo(() => value && isSelectedChoosable ? [value] : [], [value, isSelectedChoosable]);
|
|
2685
2687
|
const choose = (id) => {
|
|
2686
2688
|
if (isDisabled || index.get(id)?.node.disabledReason)
|
|
2687
2689
|
return;
|
package/dist/index.js
CHANGED
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.
|
|
2054
|
+
version: "0.0.171",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -93,3 +93,13 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
|
+
|
|
97
|
+
### NarrowSpacing
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
{
|
|
101
|
+
render: () => (<div className="w-[280px]">
|
|
102
|
+
<FilterChip onClear={fn()}>Showing 2 of 2 threads · New</FilterChip>
|
|
103
|
+
</div>)
|
|
104
|
+
}
|
|
105
|
+
```
|
|
@@ -76,3 +76,25 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
76
76
|
render: () => <Picker isDisabled/>
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
|
+
|
|
80
|
+
### RefusedChoiceUnselected
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
{
|
|
84
|
+
render: function Render() {
|
|
85
|
+
const [refused, setRefused] = useState(false);
|
|
86
|
+
const dynamicNodes: ITreeSelectNode[] = destinations.map((root) => root.id !== "website"
|
|
87
|
+
? root
|
|
88
|
+
: {
|
|
89
|
+
...root,
|
|
90
|
+
children: root.children?.map((child) => child.id === "homepage" && refused ? { ...child, disabledReason: "Can't move here" } : child),
|
|
91
|
+
});
|
|
92
|
+
return (<div className="flex w-[360px] flex-col gap-2">
|
|
93
|
+
<TreeSelect nodes={dynamicNodes} value="homepage" currentId="navigation" label="Destination" onValueChange={choose}/>
|
|
94
|
+
<button type="button" onClick={() => setRefused(true)}>
|
|
95
|
+
Refuse choice
|
|
96
|
+
</button>
|
|
97
|
+
</div>);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|