@alexgorbatchev/shadcn 0.0.67 → 0.0.68
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.
|
@@ -2565,6 +2565,7 @@ function InlineEdit2({
|
|
|
2565
2565
|
const shouldCancel = useRef2(false);
|
|
2566
2566
|
const [isSaving, setSaving] = useState2(false);
|
|
2567
2567
|
const [error, setError] = useState2(null);
|
|
2568
|
+
const [isErrorOpen, setErrorOpen] = useState2(false);
|
|
2568
2569
|
useEffect2(() => {
|
|
2569
2570
|
input.current?.focus();
|
|
2570
2571
|
if (shouldSelectOnMount)
|
|
@@ -2580,73 +2581,85 @@ function InlineEdit2({
|
|
|
2580
2581
|
}
|
|
2581
2582
|
setSaving(true);
|
|
2582
2583
|
setError("");
|
|
2584
|
+
setErrorOpen(false);
|
|
2583
2585
|
try {
|
|
2584
2586
|
await onCommit(value);
|
|
2585
2587
|
track({ name: "ui.commit" });
|
|
2586
2588
|
} catch (error) {
|
|
2587
2589
|
isFinished.current = false;
|
|
2588
2590
|
setError(renderError ? renderError(error) : "Could not save this edit.");
|
|
2591
|
+
setErrorOpen(true);
|
|
2589
2592
|
} finally {
|
|
2590
2593
|
setSaving(false);
|
|
2591
2594
|
}
|
|
2592
2595
|
};
|
|
2593
|
-
return /* @__PURE__ */
|
|
2596
|
+
return /* @__PURE__ */ jsxs15("form", {
|
|
2594
2597
|
className: "min-w-0",
|
|
2595
2598
|
onSubmit: (event) => {
|
|
2596
2599
|
event.preventDefault();
|
|
2597
2600
|
save();
|
|
2598
2601
|
},
|
|
2599
|
-
children:
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2602
|
+
children: [
|
|
2603
|
+
/* @__PURE__ */ jsxs15(Tooltip2, {
|
|
2604
|
+
open: Boolean(error) && isErrorOpen,
|
|
2605
|
+
onOpenChange: setErrorOpen,
|
|
2606
|
+
disableHoverablePopup: true,
|
|
2607
|
+
triggerId,
|
|
2608
|
+
children: [
|
|
2609
|
+
/* @__PURE__ */ jsx26(TooltipTrigger2, {
|
|
2610
|
+
id: triggerId,
|
|
2611
|
+
render: /* @__PURE__ */ jsx26(Input2, {
|
|
2612
|
+
analytics: false,
|
|
2613
|
+
ref: input,
|
|
2614
|
+
density,
|
|
2615
|
+
className: "h-[1lh] rounded-none border-0 px-0 py-0 text-[length:inherit] leading-[inherit]",
|
|
2616
|
+
"aria-label": label,
|
|
2617
|
+
"aria-invalid": Boolean(error),
|
|
2618
|
+
"aria-errormessage": error ? errorId : undefined,
|
|
2619
|
+
"aria-description": "Enter saves. Escape cancels.",
|
|
2620
|
+
value,
|
|
2621
|
+
disabled: isDisabled || isSaving,
|
|
2622
|
+
onChange: (event) => onValueChange(event.target.value),
|
|
2623
|
+
onBlur: () => {
|
|
2624
|
+
if (shouldCancel.current && !isFinished.current) {
|
|
2625
|
+
isFinished.current = true;
|
|
2626
|
+
onCancel();
|
|
2627
|
+
} else
|
|
2628
|
+
save();
|
|
2629
|
+
},
|
|
2630
|
+
onKeyDown: (event) => {
|
|
2631
|
+
if (event.key === "Escape") {
|
|
2632
|
+
event.preventDefault();
|
|
2633
|
+
event.stopPropagation();
|
|
2634
|
+
shouldCancel.current = true;
|
|
2635
|
+
event.currentTarget.blur();
|
|
2636
|
+
} else if (event.key === "Enter") {
|
|
2637
|
+
event.preventDefault();
|
|
2638
|
+
event.currentTarget.blur();
|
|
2639
|
+
}
|
|
2633
2640
|
}
|
|
2634
|
-
}
|
|
2635
|
-
})
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2641
|
+
})
|
|
2642
|
+
}),
|
|
2643
|
+
error && /* @__PURE__ */ jsx26(TooltipContent2, {
|
|
2644
|
+
density,
|
|
2645
|
+
side: "bottom",
|
|
2646
|
+
align: "start",
|
|
2647
|
+
"data-testid": "InlineEdit--error-popup",
|
|
2648
|
+
"aria-hidden": true,
|
|
2649
|
+
children: /* @__PURE__ */ jsx26("p", {
|
|
2650
|
+
className: "text-destructive",
|
|
2651
|
+
children: error
|
|
2652
|
+
})
|
|
2646
2653
|
})
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2654
|
+
]
|
|
2655
|
+
}),
|
|
2656
|
+
error && /* @__PURE__ */ jsx26("p", {
|
|
2657
|
+
id: errorId,
|
|
2658
|
+
role: "alert",
|
|
2659
|
+
className: "sr-only",
|
|
2660
|
+
children: error
|
|
2661
|
+
})
|
|
2662
|
+
]
|
|
2650
2663
|
});
|
|
2651
2664
|
}
|
|
2652
2665
|
// src/components/StarRating.tsx
|
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.68",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -66,6 +66,18 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
### DismissedValidation
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
{
|
|
73
|
+
args: {
|
|
74
|
+
onCommit: async () => {
|
|
75
|
+
throw new Error("Private storage diagnostic");
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
69
81
|
### UnchangedEnter
|
|
70
82
|
|
|
71
83
|
```tsx
|