@scripso-homepad/ui 0.4.34 → 0.4.36

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": "@scripso-homepad/ui",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "type": "module",
5
5
  "description": "Cross-platform UI components for Homepad (React Web + React Native)",
6
6
  "license": "MIT",
@@ -31,6 +31,8 @@ export type TableActionsMenuProps = {
31
31
  triggerAriaLabel: string;
32
32
  className?: string;
33
33
  menuClassName?: string;
34
+ /** Optional custom trigger icon. Defaults to TableMoreIcon. */
35
+ triggerIcon?: ReactNode;
34
36
  /** Dropdown menu width in pixels. Defaults to 231. Ignored when menuFitContent is true. */
35
37
  menuWidth?: number;
36
38
  /** Size the menu to its content width instead of a fixed pixel width. Defaults to true so labels stay on one line. */
@@ -73,6 +75,7 @@ export function TableActionsMenu({
73
75
  triggerAriaLabel,
74
76
  className,
75
77
  menuClassName,
78
+ triggerIcon,
76
79
  menuWidth = MENU_WIDTH_PX,
77
80
  menuFitContent = true,
78
81
  }: TableActionsMenuProps) {
@@ -193,13 +196,27 @@ export function TableActionsMenu({
193
196
  item.onSelect();
194
197
  }}
195
198
  className={cn(
196
- 'flex h-[51px] w-full cursor-pointer items-center gap-2.5 px-3 text-left typography-14 font-medium text-storm-gray-900 transition-colors hover:bg-storm-gray-0',
199
+ 'flex h-[51px] w-full cursor-pointer items-center gap-2.5 px-3 text-left typography-14 font-medium transition-colors hover:bg-storm-gray-0',
197
200
  index > 0 && 'border-t border-storm-gray-50',
198
201
  item.disabled && 'cursor-not-allowed opacity-50',
202
+ item.tone === 'danger'
203
+ ? 'text-[#AE0011]'
204
+ : item.tone === 'success'
205
+ ? 'text-green-600'
206
+ : 'text-storm-gray-900',
199
207
  )}
200
208
  >
201
209
  {icon ? (
202
- <span className="inline-flex size-5 shrink-0 items-center justify-center text-storm-gray-200">
210
+ <span
211
+ className={cn(
212
+ 'inline-flex size-5 shrink-0 items-center justify-center',
213
+ item.tone === 'danger'
214
+ ? 'text-[#AE0011]'
215
+ : item.tone === 'success'
216
+ ? 'text-green-600'
217
+ : 'text-storm-gray-200',
218
+ )}
219
+ >
203
220
  {icon}
204
221
  </span>
205
222
  ) : null}
@@ -215,7 +232,7 @@ export function TableActionsMenu({
215
232
  <TableActionButton
216
233
  ref={triggerRef}
217
234
  variant="menu"
218
- icon={<TableMoreIcon className="size-5" />}
235
+ icon={triggerIcon ?? <TableMoreIcon className="size-5" />}
219
236
  ariaLabel={triggerAriaLabel}
220
237
  onClick={() => setOpen((current) => !current)}
221
238
  aria-expanded={open}
@@ -0,0 +1,32 @@
1
+ type SidebarCollapseIconProps = {
2
+ className?: string;
3
+ size?: number | string;
4
+ strokeWidth?: number | string;
5
+ };
6
+
7
+ /** Shown when the sidebar is open — click collapses it. */
8
+ export function SidebarCollapseIcon({
9
+ className,
10
+ size = 20,
11
+ strokeWidth = 2,
12
+ }: SidebarCollapseIconProps) {
13
+ return (
14
+ <svg
15
+ width={size}
16
+ height={size}
17
+ viewBox="0 0 20 20"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ aria-hidden
21
+ className={className}
22
+ >
23
+ <path
24
+ d="M12.5 2.5V17.5M8.33333 12.5L5.83333 10L8.33333 7.5M4.16667 2.5H15.8333C16.7538 2.5 17.5 3.24619 17.5 4.16667V15.8333C17.5 16.7538 16.7538 17.5 15.8333 17.5H4.16667C3.24619 17.5 2.5 16.7538 2.5 15.8333V4.16667C2.5 3.24619 3.24619 2.5 4.16667 2.5Z"
25
+ stroke="currentColor"
26
+ strokeWidth={strokeWidth}
27
+ strokeLinecap="round"
28
+ strokeLinejoin="round"
29
+ />
30
+ </svg>
31
+ );
32
+ }
@@ -0,0 +1,32 @@
1
+ type SidebarExpandIconProps = {
2
+ className?: string;
3
+ size?: number | string;
4
+ strokeWidth?: number | string;
5
+ };
6
+
7
+ /** Shown when the sidebar is closed — click expands it. */
8
+ export function SidebarExpandIcon({
9
+ className,
10
+ size = 20,
11
+ strokeWidth = 2,
12
+ }: SidebarExpandIconProps) {
13
+ return (
14
+ <svg
15
+ width={size}
16
+ height={size}
17
+ viewBox="0 0 20 20"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ aria-hidden
21
+ className={className}
22
+ >
23
+ <path
24
+ d="M12.5 2.5V17.5M6.66667 7.5L9.16667 10L6.66667 12.5M4.16667 2.5H15.8333C16.7538 2.5 17.5 3.24619 17.5 4.16667V15.8333C17.5 16.7538 16.7538 17.5 15.8333 17.5H4.16667C3.24619 17.5 2.5 16.7538 2.5 15.8333V4.16667C2.5 3.24619 3.24619 2.5 4.16667 2.5Z"
25
+ stroke="currentColor"
26
+ strokeWidth={strokeWidth}
27
+ strokeLinecap="round"
28
+ strokeLinejoin="round"
29
+ />
30
+ </svg>
31
+ );
32
+ }
package/src/web/index.ts CHANGED
@@ -23,6 +23,8 @@ export type { SidebarUserCardProps } from './layout/SidebarUserCard';
23
23
 
24
24
  export { BellIcon } from './icons/BellIcon';
25
25
  export { BuildingIcon } from './icons/BuildingIcon';
26
+ export { SidebarCollapseIcon } from './icons/SidebarCollapseIcon';
27
+ export { SidebarExpandIcon } from './icons/SidebarExpandIcon';
26
28
  export { TableMoreIcon } from './icons/TableMoreIcon';
27
29
  export { TableSortIcon } from './icons/TableSortIcon';
28
30
  export { TableMenuCheckIcon } from './icons/TableMenuCheckIcon';
@@ -1,6 +1,8 @@
1
- import { PanelLeftClose, PanelLeftOpen, X } from 'lucide-react';
1
+ import { X } from 'lucide-react';
2
2
  import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';
3
3
 
4
+ import { SidebarCollapseIcon } from '../icons/SidebarCollapseIcon';
5
+ import { SidebarExpandIcon } from '../icons/SidebarExpandIcon';
4
6
  import { useMediaQuery } from '../hooks/useMediaQuery';
5
7
  import { cn } from '../utils/cn';
6
8
  import { isNavItemActive } from './nav-active';
@@ -208,9 +210,9 @@ export function Sidebar({
208
210
  >
209
211
  {isDesktop ? (
210
212
  isExpanded ? (
211
- collapseIcon ?? <PanelLeftClose size={20} strokeWidth={1.75} />
213
+ collapseIcon ?? <SidebarCollapseIcon />
212
214
  ) : (
213
- expandIcon ?? <PanelLeftOpen size={20} strokeWidth={1.75} />
215
+ expandIcon ?? <SidebarExpandIcon />
214
216
  )
215
217
  ) : (
216
218
  closeIcon ?? <X size={20} strokeWidth={1.75} />