@marcoschwartz/lite-ui 0.17.0 → 0.18.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 CHANGED
@@ -80,6 +80,7 @@ interface AppShellProps {
80
80
  width?: 'sm' | 'md' | 'lg';
81
81
  breakpoint?: 'sm' | 'md' | 'lg' | 'xl';
82
82
  position?: 'side' | 'top';
83
+ variant?: 'solid' | 'glass' | 'transparent';
83
84
  };
84
85
  header?: React.ReactNode;
85
86
  navbarTitle?: string;
package/dist/index.d.ts CHANGED
@@ -80,6 +80,7 @@ interface AppShellProps {
80
80
  width?: 'sm' | 'md' | 'lg';
81
81
  breakpoint?: 'sm' | 'md' | 'lg' | 'xl';
82
82
  position?: 'side' | 'top';
83
+ variant?: 'solid' | 'glass' | 'transparent';
83
84
  };
84
85
  header?: React.ReactNode;
85
86
  navbarTitle?: string;
package/dist/index.js CHANGED
@@ -615,7 +615,7 @@ var Navbar = ({
615
615
  }) => {
616
616
  const { theme } = useTheme();
617
617
  const baseClasses = sticky ? "sticky top-0 z-40" : "";
618
- const getVariantClasses = () => {
618
+ const getVariantClasses2 = () => {
619
619
  switch (variant) {
620
620
  case "glass":
621
621
  return "bg-transparent backdrop-blur-xl";
@@ -626,7 +626,7 @@ var Navbar = ({
626
626
  return "bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700";
627
627
  }
628
628
  };
629
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: `${getVariantClasses()} ${baseClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between items-center h-16", children: [
629
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("nav", { className: `${getVariantClasses2()} ${baseClasses} ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-between items-center h-16", children: [
630
630
  logo && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex items-center", children: logo }),
631
631
  children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex items-center gap-6", children })
632
632
  ] }) }) });
@@ -1245,6 +1245,17 @@ var breakpointClasses = {
1245
1245
  lg: "lg",
1246
1246
  xl: "xl"
1247
1247
  };
1248
+ var getVariantClasses = (variant) => {
1249
+ switch (variant) {
1250
+ case "glass":
1251
+ return "bg-transparent backdrop-blur-xl";
1252
+ case "transparent":
1253
+ return "bg-transparent";
1254
+ case "solid":
1255
+ default:
1256
+ return "bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700";
1257
+ }
1258
+ };
1248
1259
  var AppShell = ({
1249
1260
  children,
1250
1261
  navbar,
@@ -1281,7 +1292,7 @@ var AppShell = ({
1281
1292
  const mobileMenuClass = navbarBreakpoint === "sm" ? "sm:hidden" : navbarBreakpoint === "md" ? "md:hidden" : navbarBreakpoint === "lg" ? "lg:hidden" : "xl:hidden";
1282
1293
  const desktopNavClass = navbarBreakpoint === "sm" ? "sm:flex" : navbarBreakpoint === "md" ? "md:flex" : navbarBreakpoint === "lg" ? "lg:flex" : "xl:flex";
1283
1294
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `min-h-screen flex flex-col bg-gray-50 dark:bg-gray-900 ${className}`, children: [
1284
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("nav", { className: "sticky top-0 z-30 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex justify-between items-center h-16", children: [
1295
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("nav", { className: `sticky top-0 z-30 ${getVariantClasses(navbar.variant)}`, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex justify-between items-center h-16", children: [
1285
1296
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex items-center", children: navbarLogo ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { children: navbarLogo }) : navbarTitle ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-xl font-bold text-gray-900 dark:text-gray-100", children: navbarTitle }) : null }),
1286
1297
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: `hidden ${desktopNavClass} items-center gap-6`, children: navbar.content }),
1287
1298
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
@@ -1335,7 +1346,7 @@ var AppShell = ({
1335
1346
  const mobileDrawerClass = navbarBreakpoint === "sm" ? "sm:hidden" : navbarBreakpoint === "md" ? "md:hidden" : navbarBreakpoint === "lg" ? "lg:hidden" : "xl:hidden";
1336
1347
  const sidebarWidthClass = navbarWidth === "sm" ? "w-48" : navbarWidth === "lg" ? "w-80" : "w-64";
1337
1348
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `min-h-screen flex flex-col bg-gray-50 dark:bg-gray-900 ${className}`, children: [
1338
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `${mobileHeaderClass} sticky top-0 z-30 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-3 flex items-center justify-between`, children: [
1349
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `${mobileHeaderClass} sticky top-0 z-30 ${getVariantClasses(navbar.variant)} px-4 py-3 flex items-center justify-between`, children: [
1339
1350
  navbarLogo ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { children: navbarLogo }) : navbarTitle ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-xl font-bold text-gray-900 dark:text-gray-100", children: navbarTitle }) : null,
1340
1351
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
1341
1352
  "button",
@@ -1349,7 +1360,7 @@ var AppShell = ({
1349
1360
  ] }),
1350
1361
  header && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-full", children: header }),
1351
1362
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-1 min-h-0", children: [
1352
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("aside", { className: `hidden ${desktopNavbarClass} ${sidebarWidthClass} bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 overflow-y-auto shrink-0`, children: navbar.content }),
1363
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("aside", { className: `hidden ${desktopNavbarClass} ${sidebarWidthClass} ${navbar.variant === "glass" ? "bg-transparent backdrop-blur-xl" : navbar.variant === "transparent" ? "bg-transparent" : "bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700"} overflow-y-auto shrink-0`, children: navbar.content }),
1353
1364
  isMobileNavbarOpen && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
1354
1365
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
1355
1366
  "div",
@@ -3084,15 +3095,22 @@ var Slider = ({
3084
3095
  setInternalValue(newValue);
3085
3096
  onChange?.(newValue);
3086
3097
  };
3087
- const handleRangeMouseDown = (e, handle) => {
3098
+ const handleRangeStart = (clientX, handle) => {
3088
3099
  if (disabled) return;
3089
- e.preventDefault();
3090
3100
  setIsDragging(handle);
3091
3101
  };
3092
- const handleRangeMouseMove = (e) => {
3102
+ const handleRangeMouseDown = (e, handle) => {
3103
+ e.preventDefault();
3104
+ handleRangeStart(e.clientX, handle);
3105
+ };
3106
+ const handleRangeTouchStart = (e, handle) => {
3107
+ e.preventDefault();
3108
+ handleRangeStart(e.touches[0].clientX, handle);
3109
+ };
3110
+ const updateRangeValue = (clientX) => {
3093
3111
  if (!isDragging || !trackRef.current || disabled) return;
3094
3112
  const rect = trackRef.current.getBoundingClientRect();
3095
- const percentage2 = Math.max(0, Math.min(100, (e.clientX - rect.left) / rect.width * 100));
3113
+ const percentage2 = Math.max(0, Math.min(100, (clientX - rect.left) / rect.width * 100));
3096
3114
  const newValue = Math.round(percentage2 / 100 * (max - min) / step) * step + min;
3097
3115
  if (isDragging === "min") {
3098
3116
  const newMin = Math.min(newValue, rangeValue[1] - step);
@@ -3106,16 +3124,28 @@ var Slider = ({
3106
3124
  onRangeChange?.(newRange);
3107
3125
  }
3108
3126
  };
3109
- const handleRangeMouseUp = () => {
3127
+ const handleRangeMouseMove = (e) => {
3128
+ updateRangeValue(e.clientX);
3129
+ };
3130
+ const handleRangeTouchMove = (e) => {
3131
+ if (e.touches.length > 0) {
3132
+ updateRangeValue(e.touches[0].clientX);
3133
+ }
3134
+ };
3135
+ const handleRangeEnd = () => {
3110
3136
  setIsDragging(null);
3111
3137
  };
3112
3138
  import_react18.default.useEffect(() => {
3113
3139
  if (isDragging) {
3114
3140
  document.addEventListener("mousemove", handleRangeMouseMove);
3115
- document.addEventListener("mouseup", handleRangeMouseUp);
3141
+ document.addEventListener("mouseup", handleRangeEnd);
3142
+ document.addEventListener("touchmove", handleRangeTouchMove);
3143
+ document.addEventListener("touchend", handleRangeEnd);
3116
3144
  return () => {
3117
3145
  document.removeEventListener("mousemove", handleRangeMouseMove);
3118
- document.removeEventListener("mouseup", handleRangeMouseUp);
3146
+ document.removeEventListener("mouseup", handleRangeEnd);
3147
+ document.removeEventListener("touchmove", handleRangeTouchMove);
3148
+ document.removeEventListener("touchend", handleRangeEnd);
3119
3149
  };
3120
3150
  }
3121
3151
  }, [isDragging, rangeValue]);
@@ -3152,6 +3182,7 @@ var Slider = ({
3152
3182
  `,
3153
3183
  style: { left: `${minPercentage}%` },
3154
3184
  onMouseDown: (e) => handleRangeMouseDown(e, "min"),
3185
+ onTouchStart: (e) => handleRangeTouchStart(e, "min"),
3155
3186
  role: "slider",
3156
3187
  "aria-label": `${label ? label + " " : ""}minimum value`,
3157
3188
  "aria-valuemin": min,
@@ -3168,6 +3199,7 @@ var Slider = ({
3168
3199
  `,
3169
3200
  style: { left: `${maxPercentage}%` },
3170
3201
  onMouseDown: (e) => handleRangeMouseDown(e, "max"),
3202
+ onTouchStart: (e) => handleRangeTouchStart(e, "max"),
3171
3203
  role: "slider",
3172
3204
  "aria-label": `${label ? label + " " : ""}maximum value`,
3173
3205
  "aria-valuemin": rangeValue[0],