@opencosmos/ui 1.3.2 → 1.3.4
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.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/layout/AppSidebar.tsx +52 -5
- package/LICENSE +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencosmos/ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "OpenCosmos UI — Make it Lovable. 100 accessible React components, three themes, user-controlled motion.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -93,6 +93,16 @@
|
|
|
93
93
|
"./globals.css": "./src/globals.css",
|
|
94
94
|
"./theme.css": "./src/theme.css"
|
|
95
95
|
},
|
|
96
|
+
"scripts": {
|
|
97
|
+
"build": "tsup",
|
|
98
|
+
"dev": "tsup --watch",
|
|
99
|
+
"lint": "eslint src/",
|
|
100
|
+
"test": "vitest run",
|
|
101
|
+
"test:watch": "vitest",
|
|
102
|
+
"typecheck": "tsc --noEmit",
|
|
103
|
+
"size": "size-limit",
|
|
104
|
+
"size:check": "size-limit --limit"
|
|
105
|
+
},
|
|
96
106
|
"size-limit": [
|
|
97
107
|
{
|
|
98
108
|
"name": "Core (index)",
|
|
@@ -253,15 +263,5 @@
|
|
|
253
263
|
"typescript-eslint": "^8.54.0",
|
|
254
264
|
"vitest": "^4.0.18",
|
|
255
265
|
"zod": "^3.24.1"
|
|
256
|
-
},
|
|
257
|
-
"scripts": {
|
|
258
|
-
"build": "tsup",
|
|
259
|
-
"dev": "tsup --watch",
|
|
260
|
-
"lint": "eslint src/",
|
|
261
|
-
"test": "vitest run",
|
|
262
|
-
"test:watch": "vitest",
|
|
263
|
-
"typecheck": "tsc --noEmit",
|
|
264
|
-
"size": "size-limit",
|
|
265
|
-
"size:check": "size-limit --limit"
|
|
266
266
|
}
|
|
267
|
-
}
|
|
267
|
+
}
|
|
@@ -120,9 +120,11 @@ export interface AppSidebarProps {
|
|
|
120
120
|
logo?: React.ReactNode;
|
|
121
121
|
/** Wordmark shown next to the logo when expanded */
|
|
122
122
|
title?: string;
|
|
123
|
-
/** Navigation items */
|
|
123
|
+
/** Navigation items rendered at the top (below the header) */
|
|
124
124
|
items?: AppSidebarNavItem[];
|
|
125
|
-
/**
|
|
125
|
+
/** Navigation items rendered at the bottom (above the footer) */
|
|
126
|
+
bottomItems?: AppSidebarNavItem[];
|
|
127
|
+
/** Body slot — rendered in the flex-1 mid-section (e.g. conversation history). Only visible when expanded. */
|
|
126
128
|
children?: React.ReactNode;
|
|
127
129
|
/** Footer slot — auth section, user avatar, sign-in prompt, etc. */
|
|
128
130
|
footer?: React.ReactNode;
|
|
@@ -134,6 +136,7 @@ export function AppSidebar({
|
|
|
134
136
|
logo,
|
|
135
137
|
title,
|
|
136
138
|
items = [],
|
|
139
|
+
bottomItems = [],
|
|
137
140
|
children,
|
|
138
141
|
footer,
|
|
139
142
|
className,
|
|
@@ -211,7 +214,7 @@ export function AppSidebar({
|
|
|
211
214
|
|
|
212
215
|
{/* ── Nav items ──────────────────────────────────────────────────── */}
|
|
213
216
|
{items.length > 0 && (
|
|
214
|
-
<nav className="px-2 py-2 space-y-
|
|
217
|
+
<nav className="px-2 py-2 space-y-1 shrink-0" aria-label="Main navigation">
|
|
215
218
|
{items.map((item) => (
|
|
216
219
|
<a
|
|
217
220
|
key={item.label}
|
|
@@ -224,7 +227,7 @@ export function AppSidebar({
|
|
|
224
227
|
'flex items-center rounded-lg transition-colors duration-150',
|
|
225
228
|
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus)]',
|
|
226
229
|
isOpen
|
|
227
|
-
? 'gap-3 px-3 py-
|
|
230
|
+
? 'gap-3 px-3 py-3'
|
|
228
231
|
: 'justify-center w-9 h-9 mx-auto',
|
|
229
232
|
item.active
|
|
230
233
|
? 'bg-foreground/8 text-foreground font-medium'
|
|
@@ -261,12 +264,56 @@ export function AppSidebar({
|
|
|
261
264
|
{children}
|
|
262
265
|
</div>
|
|
263
266
|
|
|
267
|
+
{/* ── Bottom nav items ───────────────────────────────────────────── */}
|
|
268
|
+
{bottomItems.length > 0 && (
|
|
269
|
+
<nav className="px-2 py-2 space-y-1 shrink-0 border-t border-foreground/8" aria-label="Bottom navigation">
|
|
270
|
+
{bottomItems.map((item) => (
|
|
271
|
+
<a
|
|
272
|
+
key={item.label}
|
|
273
|
+
href={item.href}
|
|
274
|
+
target={item.external ? '_blank' : undefined}
|
|
275
|
+
rel={item.external ? 'noopener noreferrer' : undefined}
|
|
276
|
+
title={!isOpen ? item.label : undefined}
|
|
277
|
+
aria-label={!isOpen ? item.label : undefined}
|
|
278
|
+
className={cn(
|
|
279
|
+
'flex items-center rounded-lg transition-colors duration-150',
|
|
280
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus)]',
|
|
281
|
+
isOpen
|
|
282
|
+
? 'gap-3 px-3 py-3'
|
|
283
|
+
: 'justify-center w-9 h-9 mx-auto',
|
|
284
|
+
item.active
|
|
285
|
+
? 'bg-foreground/8 text-foreground font-medium'
|
|
286
|
+
: 'text-[var(--color-text-secondary)] hover:bg-foreground/5 hover:text-[var(--color-text-primary)]'
|
|
287
|
+
)}
|
|
288
|
+
>
|
|
289
|
+
<span className="shrink-0 flex items-center justify-center w-4 h-4">
|
|
290
|
+
{item.icon}
|
|
291
|
+
</span>
|
|
292
|
+
<span
|
|
293
|
+
className="text-sm whitespace-nowrap"
|
|
294
|
+
style={{
|
|
295
|
+
opacity: isOpen ? 1 : 0,
|
|
296
|
+
width: isOpen ? 'auto' : 0,
|
|
297
|
+
overflow: 'hidden',
|
|
298
|
+
pointerEvents: isOpen ? 'auto' : 'none',
|
|
299
|
+
transition: shouldAnimate
|
|
300
|
+
? `opacity ${Math.round(duration * 0.55)}ms ease-out`
|
|
301
|
+
: 'none',
|
|
302
|
+
}}
|
|
303
|
+
>
|
|
304
|
+
{item.label}
|
|
305
|
+
</span>
|
|
306
|
+
</a>
|
|
307
|
+
))}
|
|
308
|
+
</nav>
|
|
309
|
+
)}
|
|
310
|
+
|
|
264
311
|
{/* ── Footer ─────────────────────────────────────────────────────── */}
|
|
265
312
|
{footer && (
|
|
266
313
|
<div
|
|
267
314
|
className={cn(
|
|
268
315
|
'shrink-0 border-t border-foreground/8',
|
|
269
|
-
isOpen ? '
|
|
316
|
+
isOpen ? 'px-4 py-4 space-y-3' : 'px-2 py-3 flex justify-center'
|
|
270
317
|
)}
|
|
271
318
|
>
|
|
272
319
|
{footer}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-2026 Shalom Ormsby
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|