@lovett/ui 0.2.7 → 0.2.9
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.js +4 -14
- package/dist/index.js.map +1 -1
- package/package.json +22 -31
- package/src/sidebar-nav.tsx +13 -16
package/package.json
CHANGED
|
@@ -1,49 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovett/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Design system primitives, tokens, layouts, and patterns for the Lovett portfolio.",
|
|
7
7
|
"sideEffects": [
|
|
8
8
|
"**/*.css"
|
|
9
9
|
],
|
|
10
|
-
"main": "./
|
|
11
|
-
"types": "./
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
|
-
".":
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./tokens.css": "./dist/tokens.css",
|
|
18
|
+
"./styles.css": "./dist/styles.css",
|
|
19
|
+
"./theme-v2.css": "./dist/theme-v2.css"
|
|
17
20
|
},
|
|
18
21
|
"publishConfig": {
|
|
19
|
-
"access": "public"
|
|
20
|
-
"main": "./dist/index.js",
|
|
21
|
-
"module": "./dist/index.js",
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"exports": {
|
|
24
|
-
".": {
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
|
-
"import": "./dist/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./tokens.css": "./dist/tokens.css",
|
|
29
|
-
"./styles.css": "./dist/styles.css",
|
|
30
|
-
"./theme-v2.css": "./dist/theme-v2.css"
|
|
31
|
-
}
|
|
22
|
+
"access": "public"
|
|
32
23
|
},
|
|
33
24
|
"files": [
|
|
34
25
|
"dist",
|
|
35
26
|
"src",
|
|
36
27
|
"README.md"
|
|
37
28
|
],
|
|
38
|
-
"scripts": {
|
|
39
|
-
"lint": "eslint .",
|
|
40
|
-
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
|
|
41
|
-
"test": "vitest run",
|
|
42
|
-
"test:ci": "vitest run --no-file-parallelism",
|
|
43
|
-
"build": "tsup",
|
|
44
|
-
"clean": "rm -rf dist",
|
|
45
|
-
"prepublishOnly": "pnpm build"
|
|
46
|
-
},
|
|
47
29
|
"peerDependencies": {
|
|
48
30
|
"lucide-react": "^0.469.0",
|
|
49
31
|
"react": "^19.0.0",
|
|
@@ -87,5 +69,14 @@
|
|
|
87
69
|
"remark-gfm": "^4.0.1",
|
|
88
70
|
"sonner": "^2.0.7",
|
|
89
71
|
"tailwind-merge": "^3.6.0"
|
|
90
|
-
}
|
|
91
|
-
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"lint": "eslint .",
|
|
75
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
|
|
76
|
+
"test": "vitest run",
|
|
77
|
+
"test:ci": "vitest run --no-file-parallelism",
|
|
78
|
+
"build": "tsup",
|
|
79
|
+
"clean": "rm -rf dist"
|
|
80
|
+
},
|
|
81
|
+
"module": "./dist/index.js"
|
|
82
|
+
}
|
package/src/sidebar-nav.tsx
CHANGED
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
* `grid-template-rows` so its content keeps its size while it closes
|
|
21
21
|
* (`.ds-sidebar-group-body` in styles.css; honours reduced motion).
|
|
22
22
|
*
|
|
23
|
+
* A nested Item keeps its icon and sits inside the group's rail: one
|
|
24
|
+
* continuous hairline drops from the header's icon column and the child rows
|
|
25
|
+
* stand to its right, so a child's fill never crosses the line.
|
|
26
|
+
*
|
|
23
27
|
* Collapsed rail (`collapsed` on the root): Items become icon tiles with a
|
|
24
28
|
* `title`; a Group becomes an icon tile that opens a `Popover` flyout to its
|
|
25
29
|
* right holding the group's items at full width. Inside the flyout the rail
|
|
@@ -172,23 +176,14 @@ function SidebarNavItem({
|
|
|
172
176
|
ROW_BASE,
|
|
173
177
|
active ? ROW_ACTIVE : ROW_REST,
|
|
174
178
|
collapsed && 'justify-center px-0',
|
|
175
|
-
nested
|
|
179
|
+
// A nested row is a step shorter and a step smaller; it keeps its icon.
|
|
180
|
+
nested && !collapsed && 'h-8 gap-2.5 px-2 text-[13px]',
|
|
176
181
|
className,
|
|
177
182
|
)
|
|
178
183
|
const content = (
|
|
179
184
|
<>
|
|
180
185
|
{active && !nested && <ActiveBar />}
|
|
181
|
-
|
|
182
|
-
{nested && !collapsed && (
|
|
183
|
-
// The connector: a dot on the group's rail, filled when active.
|
|
184
|
-
<span
|
|
185
|
-
aria-hidden="true"
|
|
186
|
-
className={cn(
|
|
187
|
-
'absolute left-[1.0625rem] top-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full transition-colors',
|
|
188
|
-
active ? 'bg-[rgb(var(--accent))]' : 'bg-[rgb(var(--sidebar-rail))]',
|
|
189
|
-
)}
|
|
190
|
-
/>
|
|
191
|
-
)}
|
|
186
|
+
<RowIcon icon={icon} />
|
|
192
187
|
{!collapsed && <span className="flex-1 truncate">{label}</span>}
|
|
193
188
|
{/* The space is for the accessible name: "New audit Beta", not "New auditBeta".
|
|
194
189
|
A whitespace-only text node is invisible in a flex row. */}
|
|
@@ -333,10 +328,12 @@ function SidebarNavGroup({
|
|
|
333
328
|
id={bodyId}
|
|
334
329
|
role="group"
|
|
335
330
|
aria-labelledby={`${labelId}-text`}
|
|
336
|
-
// The rail: one hairline
|
|
337
|
-
//
|
|
338
|
-
//
|
|
339
|
-
|
|
331
|
+
// The rail: one continuous hairline dropping from the header's
|
|
332
|
+
// icon column, with the child rows INSIDE it - a child's hover
|
|
333
|
+
// or active fill starts to the right of the line, never over it.
|
|
334
|
+
// Its x derives from the icon centre (px-2.5 + half of h-4 =
|
|
335
|
+
// 1.0625rem, less half the line).
|
|
336
|
+
className="ml-[calc(1.0625rem-0.5px)] flex flex-col gap-0.5 border-l border-[rgb(var(--sidebar-rail))] py-1 pl-2"
|
|
340
337
|
// Stays in the DOM while closed so the track has something to
|
|
341
338
|
// shrink over; `inert` keeps its links out of the tab ring and
|
|
342
339
|
// the accessibility tree until it is open again.
|