@lateralus-ai/shipping-ui 2.0.0-dev.6 → 2.0.0-dev.7

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": "@lateralus-ai/shipping-ui",
3
- "version": "2.0.0-dev.6",
3
+ "version": "2.0.0-dev.7",
4
4
  "description": "Shared UI theme and components for Lateralus shipping applications",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.esm.js",
@@ -1,4 +1,7 @@
1
- import { type ReactNode } from "react";
1
+ import {
2
+ type KeyboardEvent,
3
+ type ReactNode,
4
+ } from "react";
2
5
  import { ChatIcon, IssuesIcon, ReportIcon, StatusIcon } from "../icons";
3
6
  import { cn } from "../utils/cn";
4
7
 
@@ -37,6 +40,9 @@ const variantIcons: Record<EntryVariant, ReactNode> = {
37
40
  /**
38
41
  * List entry row — Figma `Entry` (389:10001).
39
42
  * Shared by search results and activity lists.
43
+ *
44
+ * Renders a `div` (not `<button>`) so trailing controls can be real buttons
45
+ * without nested-button issues. Whole-row click uses `onClick` + keyboard.
40
46
  */
41
47
  export const Entry = ({
42
48
  variant,
@@ -53,18 +59,30 @@ export const Entry = ({
53
59
  }: EntryProps) => {
54
60
  const resolvedVariant: EntryVariant = variant ?? type ?? "chat";
55
61
  const isInteractive = typeof onClick === "function";
56
- const Comp = isInteractive ? "button" : "div";
62
+
63
+ const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
64
+ if (!onClick) {
65
+ return;
66
+ }
67
+ if (event.key === "Enter" || event.key === " ") {
68
+ event.preventDefault();
69
+ onClick();
70
+ }
71
+ };
57
72
 
58
73
  return (
59
- <Comp
60
- {...(isInteractive ? { type: "button" as const } : {})}
74
+ <div
75
+ role={isInteractive ? "button" : undefined}
76
+ tabIndex={isInteractive ? 0 : undefined}
61
77
  data-variant={resolvedVariant}
62
78
  data-state={state}
63
79
  onClick={onClick}
80
+ onKeyDown={handleKeyDown}
64
81
  className={cn(
65
82
  "group flex w-full items-center gap-4 rounded-control p-2 text-left transition-colors",
66
83
  "hover:bg-[rgba(38,36,32,0.04)]",
67
84
  state === "active" && "bg-[rgba(38,36,32,0.04)]",
85
+ isInteractive && "cursor-pointer",
68
86
  className,
69
87
  )}
70
88
  >
@@ -96,14 +114,16 @@ export const Entry = ({
96
114
 
97
115
  {(subtitle != null && subtitle !== false) || trailing ? (
98
116
  <span className="flex min-h-6 w-full items-center gap-4">
99
- {subtitle != null && subtitle !== false && (
117
+ {subtitle != null && subtitle !== false ? (
100
118
  <span className="min-w-0 flex-1 truncate text-caption-2 text-display-on-light-secondary">
101
119
  {subtitle}
102
120
  </span>
121
+ ) : (
122
+ <span className="min-w-0 flex-1" />
103
123
  )}
104
124
  {trailing != null && (
105
125
  <span
106
- className="shrink-0"
126
+ className="inline-flex size-5 shrink-0 items-center justify-center"
107
127
  onClick={(event) => event.stopPropagation()}
108
128
  onKeyDown={(event) => event.stopPropagation()}
109
129
  >
@@ -113,6 +133,6 @@ export const Entry = ({
113
133
  </span>
114
134
  ) : null}
115
135
  </span>
116
- </Comp>
136
+ </div>
117
137
  );
118
138
  };