@stasho/ds 0.15.0 → 0.15.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stasho/ds",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "stasho design system",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,7 +9,11 @@ import {
9
9
  type MouseEvent,
10
10
  type ReactNode,
11
11
  } from "react";
12
- import { CaretDoubleLeft, CaretDoubleRight } from "@phosphor-icons/react";
12
+ import {
13
+ CaretDoubleLeft,
14
+ CaretDoubleRight,
15
+ CaretRight,
16
+ } from "@phosphor-icons/react";
13
17
  import { LogoLetter, LogoWordmark } from "@ac/components/logo/logo";
14
18
  import {
15
19
  Tooltip,
@@ -167,12 +171,16 @@ export function SidebarNav({
167
171
 
168
172
  export interface SidebarSectionProps {
169
173
  title?: string;
174
+ titleHref?: string;
175
+ onTitleClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
170
176
  children: ReactNode;
171
177
  className?: string;
172
178
  }
173
179
 
174
180
  export function SidebarSection({
175
181
  title,
182
+ titleHref,
183
+ onTitleClick,
176
184
  children,
177
185
  className,
178
186
  }: SidebarSectionProps) {
@@ -183,7 +191,24 @@ export function SidebarSection({
183
191
  aria-label={title ?? "Section"}
184
192
  className={cn("flex flex-col gap-1", className)}
185
193
  >
186
- {title && !collapsed && (
194
+ {title && !collapsed && titleHref && (
195
+ <a
196
+ href={titleHref}
197
+ onClick={onTitleClick}
198
+ className={cn(
199
+ "flex items-center gap-0.5 rounded-sm px-2 pb-1 pt-2",
200
+ "text-[10px] font-semibold uppercase tracking-wider text-foreground/50",
201
+ "transition-colors duration-150 hover:text-foreground",
202
+ "focus-visible:outline-none focus-visible:ring-2",
203
+ "focus-visible:ring-accent focus-visible:ring-offset-2",
204
+ "motion-reduce:transition-none",
205
+ )}
206
+ >
207
+ {title}
208
+ <CaretRight size={10} aria-hidden="true" />
209
+ </a>
210
+ )}
211
+ {title && !collapsed && !titleHref && (
187
212
  <div className="px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wider text-foreground/50">
188
213
  {title}
189
214
  </div>