@marcoschwartz/lite-ui 0.24.0 → 0.24.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/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +47 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -31
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1159,7 +1159,8 @@ var MobileDrawer = ({
|
|
|
1159
1159
|
breakpoint,
|
|
1160
1160
|
title,
|
|
1161
1161
|
logo,
|
|
1162
|
-
children
|
|
1162
|
+
children,
|
|
1163
|
+
headerContent
|
|
1163
1164
|
}) => {
|
|
1164
1165
|
if (!isOpen) return null;
|
|
1165
1166
|
const hideClass = getBreakpointHideClass(breakpoint);
|
|
@@ -1175,7 +1176,7 @@ var MobileDrawer = ({
|
|
|
1175
1176
|
/* @__PURE__ */ jsxs9(
|
|
1176
1177
|
"div",
|
|
1177
1178
|
{
|
|
1178
|
-
className: `${hideClass} fixed ${slideClass} top-0 bottom-0 z-50 w-
|
|
1179
|
+
className: `${hideClass} fixed ${slideClass} top-0 bottom-0 z-50 w-72 bg-[hsl(var(--card))] shadow-2xl duration-300 flex flex-col`,
|
|
1179
1180
|
children: [
|
|
1180
1181
|
/* @__PURE__ */ jsxs9("div", { className: "p-4 border-b border-[hsl(var(--border))] flex items-center justify-between shrink-0", children: [
|
|
1181
1182
|
logo ? /* @__PURE__ */ jsx78("div", { children: logo }) : title ? /* @__PURE__ */ jsx78("span", { className: "text-xl font-bold text-[hsl(var(--foreground))]", children: title }) : /* @__PURE__ */ jsx78("div", {}),
|
|
@@ -1189,6 +1190,7 @@ var MobileDrawer = ({
|
|
|
1189
1190
|
}
|
|
1190
1191
|
)
|
|
1191
1192
|
] }),
|
|
1193
|
+
headerContent && /* @__PURE__ */ jsx78("div", { className: "p-3 border-b border-[hsl(var(--border))] shrink-0", children: headerContent }),
|
|
1192
1194
|
/* @__PURE__ */ jsx78("div", { className: "flex-1 overflow-y-auto", onClick: onClose, children })
|
|
1193
1195
|
]
|
|
1194
1196
|
}
|
|
@@ -1225,6 +1227,7 @@ var AppShell = ({
|
|
|
1225
1227
|
const headerVariant = header?.variant || "solid";
|
|
1226
1228
|
const headerWithBorder = header?.withBorder ?? true;
|
|
1227
1229
|
const headerCollapsed = header?.collapsed ?? false;
|
|
1230
|
+
const headerMobileActions = header?.mobileActions;
|
|
1228
1231
|
const footerHeight = footer?.height || "md";
|
|
1229
1232
|
const footerVariant = footer?.variant || "solid";
|
|
1230
1233
|
const footerWithBorder = footer?.withBorder ?? true;
|
|
@@ -1232,10 +1235,11 @@ var AppShell = ({
|
|
|
1232
1235
|
const showNavbarHamburger = navbar && !navbarCollapsedMobile;
|
|
1233
1236
|
const showAsideHamburger = aside && !asideCollapsedMobile;
|
|
1234
1237
|
const needsMobileHeader = showNavbarHamburger || showAsideHamburger;
|
|
1238
|
+
const mobileBreakpoint = navbarBreakpoint;
|
|
1235
1239
|
const navbarDesktopShowClass = getBreakpointShowClass(navbarBreakpoint);
|
|
1236
|
-
const
|
|
1240
|
+
const mobileHideClass = getBreakpointHideClass(mobileBreakpoint);
|
|
1241
|
+
const desktopShowClass = getBreakpointShowClass(mobileBreakpoint);
|
|
1237
1242
|
const asideDesktopShowClass = getBreakpointShowClass(asideBreakpoint);
|
|
1238
|
-
const asideMobileHideClass = getBreakpointHideClass(asideBreakpoint);
|
|
1239
1243
|
const contextValue = {
|
|
1240
1244
|
navbarOpen,
|
|
1241
1245
|
setNavbarOpen,
|
|
@@ -1255,28 +1259,31 @@ var AppShell = ({
|
|
|
1255
1259
|
}
|
|
1256
1260
|
),
|
|
1257
1261
|
/* @__PURE__ */ jsxs9("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
1258
|
-
needsMobileHeader && /* @__PURE__ */ jsxs9("div", { className: `${
|
|
1262
|
+
needsMobileHeader && /* @__PURE__ */ jsxs9("div", { className: `${mobileHideClass} sticky top-0 z-30 ${heightClasses[headerHeight]} px-4 flex items-center justify-between ${getVariantClasses(headerVariant, headerWithBorder)} ${headerWithBorder ? "border-b" : ""}`, children: [
|
|
1259
1263
|
showNavbarHamburger && /* @__PURE__ */ jsx78(
|
|
1260
1264
|
"button",
|
|
1261
1265
|
{
|
|
1262
|
-
className: "p-2 rounded-lg hover:bg-[hsl(var(--accent))] transition-colors",
|
|
1266
|
+
className: "p-2 rounded-lg hover:bg-[hsl(var(--accent))] transition-colors shrink-0",
|
|
1263
1267
|
onClick: () => setNavbarOpen(true),
|
|
1264
1268
|
"aria-label": "Open navigation",
|
|
1265
1269
|
children: /* @__PURE__ */ jsx78(MenuIcon, { size: "md" })
|
|
1266
1270
|
}
|
|
1267
1271
|
),
|
|
1268
|
-
(logo || title) && /* @__PURE__ */ jsx78("div", { className: "flex-1 flex justify-center", children: logo || /* @__PURE__ */ jsx78("span", { className: "text-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1272
|
+
(logo || title) && /* @__PURE__ */ jsx78("div", { className: "flex-1 flex items-center justify-center min-w-0", children: logo || /* @__PURE__ */ jsx78("span", { className: "text-lg font-bold text-[hsl(var(--foreground))] truncate", children: title }) }),
|
|
1273
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1274
|
+
headerMobileActions,
|
|
1275
|
+
showAsideHamburger && /* @__PURE__ */ jsx78(
|
|
1276
|
+
"button",
|
|
1277
|
+
{
|
|
1278
|
+
className: "p-2 rounded-lg hover:bg-[hsl(var(--accent))] transition-colors",
|
|
1279
|
+
onClick: () => setAsideOpen(true),
|
|
1280
|
+
"aria-label": "Open sidebar",
|
|
1281
|
+
children: /* @__PURE__ */ jsx78(MenuIcon, { size: "md" })
|
|
1282
|
+
}
|
|
1283
|
+
)
|
|
1284
|
+
] })
|
|
1278
1285
|
] }),
|
|
1279
|
-
header && !headerCollapsed && /* @__PURE__ */ jsx78("header", { className:
|
|
1286
|
+
header && !headerCollapsed && /* @__PURE__ */ jsx78("header", { className: `${needsMobileHeader ? desktopShowClass : ""} sticky top-0 z-20 ${heightClasses[headerHeight]} ${getVariantClasses(headerVariant, headerWithBorder)} ${headerWithBorder ? "border-b" : ""} px-4 items-center shrink-0`, children: header.content }),
|
|
1280
1287
|
/* @__PURE__ */ jsx78("main", { className: `flex-1 overflow-y-auto ${paddingClasses[padding]}`, children }),
|
|
1281
1288
|
footer && !footerCollapsed && /* @__PURE__ */ jsx78("footer", { className: `${heightClasses[footerHeight]} ${getVariantClasses(footerVariant, footerWithBorder)} ${footerWithBorder ? "border-t" : ""} px-4 flex items-center shrink-0`, children: footer.content })
|
|
1282
1289
|
] }),
|
|
@@ -1296,6 +1303,7 @@ var AppShell = ({
|
|
|
1296
1303
|
breakpoint: navbarBreakpoint,
|
|
1297
1304
|
title,
|
|
1298
1305
|
logo,
|
|
1306
|
+
headerContent: header?.content,
|
|
1299
1307
|
children: navbar.content
|
|
1300
1308
|
}
|
|
1301
1309
|
),
|
|
@@ -1313,28 +1321,31 @@ var AppShell = ({
|
|
|
1313
1321
|
] }) });
|
|
1314
1322
|
}
|
|
1315
1323
|
return /* @__PURE__ */ jsx78(AppShellContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs9("div", { className: `min-h-screen flex flex-col bg-[hsl(var(--background))] ${className}`, children: [
|
|
1316
|
-
needsMobileHeader && /* @__PURE__ */ jsxs9("div", { className: `${
|
|
1324
|
+
needsMobileHeader && /* @__PURE__ */ jsxs9("div", { className: `${mobileHideClass} sticky top-0 z-30 ${heightClasses[headerHeight]} px-4 flex items-center justify-between ${getVariantClasses(headerVariant, headerWithBorder)} ${headerWithBorder ? "border-b" : ""}`, children: [
|
|
1317
1325
|
showNavbarHamburger && /* @__PURE__ */ jsx78(
|
|
1318
1326
|
"button",
|
|
1319
1327
|
{
|
|
1320
|
-
className: "p-2 rounded-lg hover:bg-[hsl(var(--accent))] transition-colors",
|
|
1328
|
+
className: "p-2 rounded-lg hover:bg-[hsl(var(--accent))] transition-colors shrink-0",
|
|
1321
1329
|
onClick: () => setNavbarOpen(true),
|
|
1322
1330
|
"aria-label": "Open navigation",
|
|
1323
1331
|
children: /* @__PURE__ */ jsx78(MenuIcon, { size: "md" })
|
|
1324
1332
|
}
|
|
1325
1333
|
),
|
|
1326
|
-
(logo || title) && /* @__PURE__ */ jsx78("div", { className: "flex-1 flex justify-center", children: logo || /* @__PURE__ */ jsx78("span", { className: "text-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1334
|
+
(logo || title) && /* @__PURE__ */ jsx78("div", { className: "flex-1 flex items-center justify-center min-w-0", children: logo || /* @__PURE__ */ jsx78("span", { className: "text-lg font-bold text-[hsl(var(--foreground))] truncate", children: title }) }),
|
|
1335
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1336
|
+
headerMobileActions,
|
|
1337
|
+
showAsideHamburger && /* @__PURE__ */ jsx78(
|
|
1338
|
+
"button",
|
|
1339
|
+
{
|
|
1340
|
+
className: "p-2 rounded-lg hover:bg-[hsl(var(--accent))] transition-colors",
|
|
1341
|
+
onClick: () => setAsideOpen(true),
|
|
1342
|
+
"aria-label": "Open sidebar",
|
|
1343
|
+
children: /* @__PURE__ */ jsx78(MenuIcon, { size: "md" })
|
|
1344
|
+
}
|
|
1345
|
+
)
|
|
1346
|
+
] })
|
|
1336
1347
|
] }),
|
|
1337
|
-
header && !headerCollapsed && /* @__PURE__ */ jsxs9("header", { className:
|
|
1348
|
+
header && !headerCollapsed && /* @__PURE__ */ jsxs9("header", { className: `${needsMobileHeader ? desktopShowClass : ""} sticky top-0 z-20 ${heightClasses[headerHeight]} ${getVariantClasses(headerVariant, headerWithBorder)} ${headerWithBorder ? "border-b" : ""} px-4 items-center`, children: [
|
|
1338
1349
|
(logo || title) && /* @__PURE__ */ jsx78("div", { className: "mr-4 shrink-0", children: logo || /* @__PURE__ */ jsx78("span", { className: "text-xl font-bold text-[hsl(var(--foreground))]", children: title }) }),
|
|
1339
1350
|
/* @__PURE__ */ jsx78("div", { className: "flex-1", children: header.content })
|
|
1340
1351
|
] }),
|
|
@@ -1365,6 +1376,7 @@ var AppShell = ({
|
|
|
1365
1376
|
breakpoint: navbarBreakpoint,
|
|
1366
1377
|
title,
|
|
1367
1378
|
logo,
|
|
1379
|
+
headerContent: header?.content,
|
|
1368
1380
|
children: navbar.content
|
|
1369
1381
|
}
|
|
1370
1382
|
),
|
|
@@ -1913,7 +1925,10 @@ Checkbox.displayName = "Checkbox";
|
|
|
1913
1925
|
import { forwardRef as forwardRef3 } from "react";
|
|
1914
1926
|
import { jsx as jsx86, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1915
1927
|
var Toggle = forwardRef3(
|
|
1916
|
-
({ label, size = "md", className = "", disabled, checked, ...props }, ref) => {
|
|
1928
|
+
({ label, size = "md", className = "", disabled, checked, onChange, ...props }, ref) => {
|
|
1929
|
+
const handleChange = (e) => {
|
|
1930
|
+
onChange?.(e.target.checked);
|
|
1931
|
+
};
|
|
1917
1932
|
const toggleClasses = {
|
|
1918
1933
|
sm: {
|
|
1919
1934
|
switch: "w-9 h-5",
|
|
@@ -1939,6 +1954,7 @@ var Toggle = forwardRef3(
|
|
|
1939
1954
|
className: "sr-only peer",
|
|
1940
1955
|
disabled,
|
|
1941
1956
|
checked,
|
|
1957
|
+
onChange: handleChange,
|
|
1942
1958
|
...props
|
|
1943
1959
|
}
|
|
1944
1960
|
),
|