@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.mjs CHANGED
@@ -464,7 +464,7 @@ var Navbar = ({
464
464
  }) => {
465
465
  const { theme } = useTheme();
466
466
  const baseClasses = sticky ? "sticky top-0 z-40" : "";
467
- const getVariantClasses = () => {
467
+ const getVariantClasses2 = () => {
468
468
  switch (variant) {
469
469
  case "glass":
470
470
  return "bg-transparent backdrop-blur-xl";
@@ -475,7 +475,7 @@ var Navbar = ({
475
475
  return "bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700";
476
476
  }
477
477
  };
478
- return /* @__PURE__ */ jsx5("nav", { className: `${getVariantClasses()} ${baseClasses} ${className}`, children: /* @__PURE__ */ jsx5("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs4("div", { className: "flex justify-between items-center h-16", children: [
478
+ return /* @__PURE__ */ jsx5("nav", { className: `${getVariantClasses2()} ${baseClasses} ${className}`, children: /* @__PURE__ */ jsx5("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs4("div", { className: "flex justify-between items-center h-16", children: [
479
479
  logo && /* @__PURE__ */ jsx5("div", { className: "flex items-center", children: logo }),
480
480
  children && /* @__PURE__ */ jsx5("div", { className: "flex items-center gap-6", children })
481
481
  ] }) }) });
@@ -1094,6 +1094,17 @@ var breakpointClasses = {
1094
1094
  lg: "lg",
1095
1095
  xl: "xl"
1096
1096
  };
1097
+ var getVariantClasses = (variant) => {
1098
+ switch (variant) {
1099
+ case "glass":
1100
+ return "bg-transparent backdrop-blur-xl";
1101
+ case "transparent":
1102
+ return "bg-transparent";
1103
+ case "solid":
1104
+ default:
1105
+ return "bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700";
1106
+ }
1107
+ };
1097
1108
  var AppShell = ({
1098
1109
  children,
1099
1110
  navbar,
@@ -1130,7 +1141,7 @@ var AppShell = ({
1130
1141
  const mobileMenuClass = navbarBreakpoint === "sm" ? "sm:hidden" : navbarBreakpoint === "md" ? "md:hidden" : navbarBreakpoint === "lg" ? "lg:hidden" : "xl:hidden";
1131
1142
  const desktopNavClass = navbarBreakpoint === "sm" ? "sm:flex" : navbarBreakpoint === "md" ? "md:flex" : navbarBreakpoint === "lg" ? "lg:flex" : "xl:flex";
1132
1143
  return /* @__PURE__ */ jsxs9("div", { className: `min-h-screen flex flex-col bg-gray-50 dark:bg-gray-900 ${className}`, children: [
1133
- /* @__PURE__ */ jsx78("nav", { className: "sticky top-0 z-30 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx78("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs9("div", { className: "flex justify-between items-center h-16", children: [
1144
+ /* @__PURE__ */ jsx78("nav", { className: `sticky top-0 z-30 ${getVariantClasses(navbar.variant)}`, children: /* @__PURE__ */ jsx78("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs9("div", { className: "flex justify-between items-center h-16", children: [
1134
1145
  /* @__PURE__ */ jsx78("div", { className: "flex items-center", children: navbarLogo ? /* @__PURE__ */ jsx78("div", { children: navbarLogo }) : navbarTitle ? /* @__PURE__ */ jsx78("span", { className: "text-xl font-bold text-gray-900 dark:text-gray-100", children: navbarTitle }) : null }),
1135
1146
  /* @__PURE__ */ jsx78("div", { className: `hidden ${desktopNavClass} items-center gap-6`, children: navbar.content }),
1136
1147
  /* @__PURE__ */ jsx78(
@@ -1184,7 +1195,7 @@ var AppShell = ({
1184
1195
  const mobileDrawerClass = navbarBreakpoint === "sm" ? "sm:hidden" : navbarBreakpoint === "md" ? "md:hidden" : navbarBreakpoint === "lg" ? "lg:hidden" : "xl:hidden";
1185
1196
  const sidebarWidthClass = navbarWidth === "sm" ? "w-48" : navbarWidth === "lg" ? "w-80" : "w-64";
1186
1197
  return /* @__PURE__ */ jsxs9("div", { className: `min-h-screen flex flex-col bg-gray-50 dark:bg-gray-900 ${className}`, children: [
1187
- /* @__PURE__ */ jsxs9("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: [
1198
+ /* @__PURE__ */ jsxs9("div", { className: `${mobileHeaderClass} sticky top-0 z-30 ${getVariantClasses(navbar.variant)} px-4 py-3 flex items-center justify-between`, children: [
1188
1199
  navbarLogo ? /* @__PURE__ */ jsx78("div", { children: navbarLogo }) : navbarTitle ? /* @__PURE__ */ jsx78("span", { className: "text-xl font-bold text-gray-900 dark:text-gray-100", children: navbarTitle }) : null,
1189
1200
  /* @__PURE__ */ jsx78(
1190
1201
  "button",
@@ -1198,7 +1209,7 @@ var AppShell = ({
1198
1209
  ] }),
1199
1210
  header && /* @__PURE__ */ jsx78("div", { className: "w-full", children: header }),
1200
1211
  /* @__PURE__ */ jsxs9("div", { className: "flex flex-1 min-h-0", children: [
1201
- /* @__PURE__ */ jsx78("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 }),
1212
+ /* @__PURE__ */ jsx78("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 }),
1202
1213
  isMobileNavbarOpen && /* @__PURE__ */ jsxs9(Fragment11, { children: [
1203
1214
  /* @__PURE__ */ jsx78(
1204
1215
  "div",
@@ -2933,15 +2944,22 @@ var Slider = ({
2933
2944
  setInternalValue(newValue);
2934
2945
  onChange?.(newValue);
2935
2946
  };
2936
- const handleRangeMouseDown = (e, handle) => {
2947
+ const handleRangeStart = (clientX, handle) => {
2937
2948
  if (disabled) return;
2938
- e.preventDefault();
2939
2949
  setIsDragging(handle);
2940
2950
  };
2941
- const handleRangeMouseMove = (e) => {
2951
+ const handleRangeMouseDown = (e, handle) => {
2952
+ e.preventDefault();
2953
+ handleRangeStart(e.clientX, handle);
2954
+ };
2955
+ const handleRangeTouchStart = (e, handle) => {
2956
+ e.preventDefault();
2957
+ handleRangeStart(e.touches[0].clientX, handle);
2958
+ };
2959
+ const updateRangeValue = (clientX) => {
2942
2960
  if (!isDragging || !trackRef.current || disabled) return;
2943
2961
  const rect = trackRef.current.getBoundingClientRect();
2944
- const percentage2 = Math.max(0, Math.min(100, (e.clientX - rect.left) / rect.width * 100));
2962
+ const percentage2 = Math.max(0, Math.min(100, (clientX - rect.left) / rect.width * 100));
2945
2963
  const newValue = Math.round(percentage2 / 100 * (max - min) / step) * step + min;
2946
2964
  if (isDragging === "min") {
2947
2965
  const newMin = Math.min(newValue, rangeValue[1] - step);
@@ -2955,16 +2973,28 @@ var Slider = ({
2955
2973
  onRangeChange?.(newRange);
2956
2974
  }
2957
2975
  };
2958
- const handleRangeMouseUp = () => {
2976
+ const handleRangeMouseMove = (e) => {
2977
+ updateRangeValue(e.clientX);
2978
+ };
2979
+ const handleRangeTouchMove = (e) => {
2980
+ if (e.touches.length > 0) {
2981
+ updateRangeValue(e.touches[0].clientX);
2982
+ }
2983
+ };
2984
+ const handleRangeEnd = () => {
2959
2985
  setIsDragging(null);
2960
2986
  };
2961
2987
  React18.useEffect(() => {
2962
2988
  if (isDragging) {
2963
2989
  document.addEventListener("mousemove", handleRangeMouseMove);
2964
- document.addEventListener("mouseup", handleRangeMouseUp);
2990
+ document.addEventListener("mouseup", handleRangeEnd);
2991
+ document.addEventListener("touchmove", handleRangeTouchMove);
2992
+ document.addEventListener("touchend", handleRangeEnd);
2965
2993
  return () => {
2966
2994
  document.removeEventListener("mousemove", handleRangeMouseMove);
2967
- document.removeEventListener("mouseup", handleRangeMouseUp);
2995
+ document.removeEventListener("mouseup", handleRangeEnd);
2996
+ document.removeEventListener("touchmove", handleRangeTouchMove);
2997
+ document.removeEventListener("touchend", handleRangeEnd);
2968
2998
  };
2969
2999
  }
2970
3000
  }, [isDragging, rangeValue]);
@@ -3001,6 +3031,7 @@ var Slider = ({
3001
3031
  `,
3002
3032
  style: { left: `${minPercentage}%` },
3003
3033
  onMouseDown: (e) => handleRangeMouseDown(e, "min"),
3034
+ onTouchStart: (e) => handleRangeTouchStart(e, "min"),
3004
3035
  role: "slider",
3005
3036
  "aria-label": `${label ? label + " " : ""}minimum value`,
3006
3037
  "aria-valuemin": min,
@@ -3017,6 +3048,7 @@ var Slider = ({
3017
3048
  `,
3018
3049
  style: { left: `${maxPercentage}%` },
3019
3050
  onMouseDown: (e) => handleRangeMouseDown(e, "max"),
3051
+ onTouchStart: (e) => handleRangeTouchStart(e, "max"),
3020
3052
  role: "slider",
3021
3053
  "aria-label": `${label ? label + " " : ""}maximum value`,
3022
3054
  "aria-valuemin": rangeValue[0],