@assure-one/design-system 1.21.0 → 1.22.0
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/index.d.ts +19 -0
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3757,6 +3757,25 @@ interface SidebarProps extends React$1.HTMLAttributes<HTMLElement> {
|
|
|
3757
3757
|
* descendant atoms restyle via `group-data-[variant=floating]`.
|
|
3758
3758
|
*/
|
|
3759
3759
|
variant?: "classic" | "floating";
|
|
3760
|
+
/**
|
|
3761
|
+
* Whether hovering the collapsed rail transiently expands it.
|
|
3762
|
+
*
|
|
3763
|
+
* `true` (default) is the legacy behavior: hovering the column widens
|
|
3764
|
+
* it to an overlay after a short delay. Set `false` for a sidebar with
|
|
3765
|
+
* exactly two states — collapsed and open — switched only by
|
|
3766
|
+
* <SidebarTrigger> or Mod+\. Collapsed rows then explain themselves via
|
|
3767
|
+
* a tooltip on icon hover instead of by widening the column.
|
|
3768
|
+
*
|
|
3769
|
+
* Peek is an accelerator when the sidebar is the only chrome. It stops
|
|
3770
|
+
* being one next to a second fixed column (a product rail), where an
|
|
3771
|
+
* incidental mouse pass on the way to the rail expands the sidebar and
|
|
3772
|
+
* shoves the canvas sideways — motion the user did not ask for, from a
|
|
3773
|
+
* gesture they did not intend.
|
|
3774
|
+
*
|
|
3775
|
+
* Only meaningful alongside `collapsible`; with `collapsible={false}`
|
|
3776
|
+
* there is no rail to peek out of.
|
|
3777
|
+
*/
|
|
3778
|
+
peek?: boolean;
|
|
3760
3779
|
}
|
|
3761
3780
|
declare const Sidebar: React$1.ForwardRefExoticComponent<SidebarProps & React$1.RefAttributes<HTMLElement>>;
|
|
3762
3781
|
interface SidebarTriggerProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
package/dist/index.js
CHANGED
|
@@ -13799,11 +13799,23 @@ function SidebarProvider({
|
|
|
13799
13799
|
SidebarProvider.displayName = "SidebarProvider";
|
|
13800
13800
|
var PEEK_ENTER_DELAY_MS = 100;
|
|
13801
13801
|
var PEEK_LEAVE_DELAY_MS = 200;
|
|
13802
|
-
var
|
|
13802
|
+
var SidebarLabelsHiddenContext = React39.createContext(false);
|
|
13803
|
+
var SidebarPeekEnabledContext = React39.createContext(true);
|
|
13804
|
+
var Sidebar = React39.forwardRef(function Sidebar2({
|
|
13805
|
+
className,
|
|
13806
|
+
collapsible = false,
|
|
13807
|
+
variant = "classic",
|
|
13808
|
+
peek: peekEnabled = true,
|
|
13809
|
+
onMouseEnter,
|
|
13810
|
+
onMouseLeave,
|
|
13811
|
+
style,
|
|
13812
|
+
children,
|
|
13813
|
+
...props
|
|
13814
|
+
}, ref) {
|
|
13803
13815
|
const isFloating = variant === "floating";
|
|
13804
13816
|
const ctx = React39.useContext(SidebarContext);
|
|
13805
13817
|
const state = collapsible && ctx ? ctx.state : "expanded";
|
|
13806
|
-
const peekLockCount = collapsible && ctx ? ctx.peekLockCount : 0;
|
|
13818
|
+
const peekLockCount = collapsible && ctx && peekEnabled ? ctx.peekLockCount : 0;
|
|
13807
13819
|
const [peek, setPeek] = React39.useState(false);
|
|
13808
13820
|
const enterTimer = React39.useRef(null);
|
|
13809
13821
|
const leaveTimer = React39.useRef(null);
|
|
@@ -13826,6 +13838,7 @@ var Sidebar = React39.forwardRef(function Sidebar2({ className, collapsible = fa
|
|
|
13826
13838
|
}, [state, clearTimers]);
|
|
13827
13839
|
const handleEnter = (e) => {
|
|
13828
13840
|
onMouseEnter?.(e);
|
|
13841
|
+
if (!peekEnabled) return;
|
|
13829
13842
|
if (!collapsible || state !== "rail") return;
|
|
13830
13843
|
if (leaveTimer.current != null) {
|
|
13831
13844
|
window.clearTimeout(leaveTimer.current);
|
|
@@ -13836,6 +13849,7 @@ var Sidebar = React39.forwardRef(function Sidebar2({ className, collapsible = fa
|
|
|
13836
13849
|
};
|
|
13837
13850
|
const handleLeave = (e) => {
|
|
13838
13851
|
onMouseLeave?.(e);
|
|
13852
|
+
if (!peekEnabled) return;
|
|
13839
13853
|
if (!collapsible) return;
|
|
13840
13854
|
if (enterTimer.current != null) {
|
|
13841
13855
|
window.clearTimeout(enterTimer.current);
|
|
@@ -13893,7 +13907,8 @@ var Sidebar = React39.forwardRef(function Sidebar2({ className, collapsible = fa
|
|
|
13893
13907
|
// labels rightward rather than shifting the icons leftward.
|
|
13894
13908
|
className
|
|
13895
13909
|
),
|
|
13896
|
-
...props
|
|
13910
|
+
...props,
|
|
13911
|
+
children: /* @__PURE__ */ jsx(SidebarPeekEnabledContext.Provider, { value: peekEnabled, children: /* @__PURE__ */ jsx(SidebarLabelsHiddenContext.Provider, { value: labelsHidden, children: collapsible && !peekEnabled ? /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children }) : children }) })
|
|
13897
13912
|
}
|
|
13898
13913
|
)
|
|
13899
13914
|
);
|
|
@@ -14130,7 +14145,11 @@ var SidebarLink = React39.forwardRef(
|
|
|
14130
14145
|
function SidebarLink2({ href, icon, active = false, asChild, className, children, "aria-label": ariaLabel, ...props }, ref) {
|
|
14131
14146
|
const Comp = asChild ? Slot : "a";
|
|
14132
14147
|
const accessibleLabel = ariaLabel ?? (asChild ? void 0 : getTextContent(children) || void 0);
|
|
14133
|
-
|
|
14148
|
+
const labelsHidden = React39.useContext(SidebarLabelsHiddenContext);
|
|
14149
|
+
const peekEnabled = React39.useContext(SidebarPeekEnabledContext);
|
|
14150
|
+
const tooltipLabel = ariaLabel ?? (getTextContent(children) || void 0);
|
|
14151
|
+
const showTooltip = labelsHidden && !peekEnabled && Boolean(tooltipLabel);
|
|
14152
|
+
const link = /* @__PURE__ */ jsx(
|
|
14134
14153
|
Comp,
|
|
14135
14154
|
{
|
|
14136
14155
|
ref,
|
|
@@ -14194,6 +14213,11 @@ var SidebarLink = React39.forwardRef(
|
|
|
14194
14213
|
] })
|
|
14195
14214
|
}
|
|
14196
14215
|
);
|
|
14216
|
+
if (!showTooltip) return link;
|
|
14217
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
14218
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: link }),
|
|
14219
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", children: tooltipLabel })
|
|
14220
|
+
] });
|
|
14197
14221
|
}
|
|
14198
14222
|
);
|
|
14199
14223
|
SidebarLink.displayName = "SidebarLink";
|