@marcoschwartz/lite-ui 0.19.0 → 0.20.0

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
@@ -1920,7 +1920,7 @@ var Tabs = ({
1920
1920
  };
1921
1921
 
1922
1922
  // src/components/Table.tsx
1923
- import { Fragment as Fragment14, jsx as jsx90, jsxs as jsxs18 } from "react/jsx-runtime";
1923
+ import { jsx as jsx90, jsxs as jsxs18 } from "react/jsx-runtime";
1924
1924
  function Table({
1925
1925
  columns,
1926
1926
  data,
@@ -1931,8 +1931,8 @@ function Table({
1931
1931
  responsive = true
1932
1932
  }) {
1933
1933
  const { theme } = useTheme();
1934
- return /* @__PURE__ */ jsxs18(Fragment14, { children: [
1935
- /* @__PURE__ */ jsxs18("div", { className: `${responsive ? "hidden md:block" : ""} overflow-x-auto ${className}`, children: [
1934
+ return /* @__PURE__ */ jsxs18("div", { className, children: [
1935
+ /* @__PURE__ */ jsxs18("div", { className: `${responsive ? "hidden md:block" : ""} overflow-x-auto`, children: [
1936
1936
  /* @__PURE__ */ jsxs18("table", { className: "w-full text-left", children: [
1937
1937
  /* @__PURE__ */ jsx90("thead", { className: "bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx90("tr", { children: columns.map((column, colIndex) => {
1938
1938
  const isLast = colIndex === columns.length - 1;
@@ -1973,11 +1973,13 @@ function Table({
1973
1973
  ] }),
1974
1974
  data.length === 0 && /* @__PURE__ */ jsx90("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: "No data available" })
1975
1975
  ] }),
1976
- responsive && /* @__PURE__ */ jsxs18("div", { className: `md:hidden space-y-4 ${className}`, children: [
1976
+ responsive && /* @__PURE__ */ jsxs18("div", { className: "md:hidden space-y-3", children: [
1977
1977
  data.map((row, rowIndex) => {
1978
1978
  const cardClasses = [
1979
1979
  "bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-4 shadow-sm",
1980
- hoverable ? "hover:shadow-md transition-shadow" : ""
1980
+ hoverable ? "hover:shadow-md transition-shadow" : "",
1981
+ "relative isolate"
1982
+ // Ensure cards are isolated layers
1981
1983
  ].filter(Boolean).join(" ");
1982
1984
  return /* @__PURE__ */ jsx90(
1983
1985
  "div",
@@ -3958,48 +3960,87 @@ var Stepper = ({
3958
3960
  steps,
3959
3961
  currentStep,
3960
3962
  orientation = "horizontal",
3961
- className = ""
3963
+ className = "",
3964
+ compact = false
3962
3965
  }) => {
3963
3966
  const isHorizontal = orientation === "horizontal";
3964
- return /* @__PURE__ */ jsx103("div", { className: `${isHorizontal ? "flex items-center" : "flex flex-col"} ${className}`, children: steps.map((step, index) => {
3967
+ const getStepVisibility = (index) => {
3968
+ if (!isHorizontal || steps.length <= 3) {
3969
+ return { mobile: true, desktop: true };
3970
+ }
3965
3971
  const stepNumber = index + 1;
3966
- const isActive = stepNumber === currentStep;
3967
- const isCompleted = stepNumber < currentStep;
3968
- const isLast = index === steps.length - 1;
3969
- return /* @__PURE__ */ jsxs30(React22.Fragment, { children: [
3970
- /* @__PURE__ */ jsxs30("div", { className: `flex ${isHorizontal ? "flex-col items-center" : "flex-row items-start"} ${isHorizontal ? "" : "flex-1"}`, children: [
3971
- /* @__PURE__ */ jsx103("div", { className: "flex items-center", children: /* @__PURE__ */ jsx103(
3972
- "div",
3973
- {
3974
- className: `flex items-center justify-center w-10 h-10 rounded-full border-2 transition-all ${isCompleted ? "bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500" : isActive ? "border-blue-600 bg-white dark:border-blue-500 dark:bg-gray-800" : "border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800"}`,
3975
- children: isCompleted ? /* @__PURE__ */ jsx103(CheckIcon, { size: "sm", className: "text-white" }) : /* @__PURE__ */ jsx103(
3976
- "span",
3972
+ const distance = Math.abs(stepNumber - currentStep);
3973
+ const mobileVisible = distance <= 1;
3974
+ const desktopVisible = !compact;
3975
+ return { mobile: mobileVisible, desktop: desktopVisible };
3976
+ };
3977
+ const shouldShowCounter = isHorizontal && steps.length > 3;
3978
+ return /* @__PURE__ */ jsxs30("div", { className: `${isHorizontal ? "flex items-start w-full" : "flex flex-col"} ${className}`, children: [
3979
+ shouldShowCounter && /* @__PURE__ */ jsx103("div", { className: "md:hidden flex items-center mr-4 flex-shrink-0", children: /* @__PURE__ */ jsxs30("span", { className: "text-sm font-medium text-gray-600 dark:text-gray-400", children: [
3980
+ currentStep,
3981
+ "/",
3982
+ steps.length
3983
+ ] }) }),
3984
+ steps.map((step, index) => {
3985
+ const stepNumber = index + 1;
3986
+ const isActive = stepNumber === currentStep;
3987
+ const isCompleted = stepNumber < currentStep;
3988
+ const isLast = index === steps.length - 1;
3989
+ const visibility = getStepVisibility(index);
3990
+ const visibleMobileSteps = steps.filter((_, i) => getStepVisibility(i).mobile);
3991
+ const isLastVisibleMobile = index === steps.map((_, i) => i).filter((i) => getStepVisibility(i).mobile).slice(-1)[0];
3992
+ return /* @__PURE__ */ jsxs30(React22.Fragment, { children: [
3993
+ /* @__PURE__ */ jsxs30("div", { className: `
3994
+ flex ${isHorizontal ? "flex-col items-center flex-shrink-0" : "flex-row items-start"}
3995
+ ${isHorizontal ? "" : isLast ? "" : "mb-6"}
3996
+ ${!visibility.mobile ? "hidden md:flex" : ""}
3997
+ ${!visibility.desktop && visibility.mobile ? "md:hidden" : ""}
3998
+ `, children: [
3999
+ /* @__PURE__ */ jsxs30("div", { className: `flex ${isHorizontal ? "flex-col items-center" : "flex-col items-center flex-shrink-0"}`, children: [
4000
+ /* @__PURE__ */ jsx103(
4001
+ "div",
3977
4002
  {
3978
- className: `text-sm font-semibold ${isActive ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400"}`,
3979
- children: stepNumber
4003
+ className: `flex items-center justify-center w-10 h-10 rounded-full border-2 transition-all ${isCompleted ? "bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500" : isActive ? "border-blue-600 bg-white dark:border-blue-500 dark:bg-gray-800" : "border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800"}`,
4004
+ children: isCompleted ? /* @__PURE__ */ jsx103(CheckIcon, { size: "sm", className: "text-white" }) : /* @__PURE__ */ jsx103(
4005
+ "span",
4006
+ {
4007
+ className: `text-sm font-semibold ${isActive ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400"}`,
4008
+ children: stepNumber
4009
+ }
4010
+ )
4011
+ }
4012
+ ),
4013
+ !isLast && !isHorizontal && /* @__PURE__ */ jsx103(
4014
+ "div",
4015
+ {
4016
+ className: `w-0.5 flex-1 min-h-[24px] ${isCompleted ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-300 dark:bg-gray-600"}`
3980
4017
  }
3981
4018
  )
4019
+ ] }),
4020
+ /* @__PURE__ */ jsxs30("div", { className: `${isHorizontal ? "mt-3 text-center" : "ml-4 flex-1 min-h-[40px] flex flex-col justify-center"}`, children: [
4021
+ /* @__PURE__ */ jsx103(
4022
+ "p",
4023
+ {
4024
+ className: `text-sm font-medium whitespace-nowrap ${isActive || isCompleted ? "text-gray-900 dark:text-gray-100" : "text-gray-500 dark:text-gray-400"}`,
4025
+ children: step.label
4026
+ }
4027
+ ),
4028
+ step.description && /* @__PURE__ */ jsx103("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1 whitespace-nowrap", children: step.description })
4029
+ ] })
4030
+ ] }),
4031
+ !isLast && isHorizontal && /* @__PURE__ */ jsx103("div", { className: `
4032
+ flex items-start pt-5 mx-4 min-w-[80px] max-w-[200px] flex-1
4033
+ ${!visibility.mobile || isLastVisibleMobile ? "hidden md:flex" : ""}
4034
+ ${!visibility.desktop && visibility.mobile ? "md:hidden" : ""}
4035
+ `, children: /* @__PURE__ */ jsx103(
4036
+ "div",
4037
+ {
4038
+ className: `h-0.5 w-full ${isCompleted ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-300 dark:bg-gray-600"}`
3982
4039
  }
3983
- ) }),
3984
- /* @__PURE__ */ jsxs30("div", { className: `${isHorizontal ? "mt-2 text-center" : "ml-4 pb-8"} ${isLast && !isHorizontal ? "pb-0" : ""}`, children: [
3985
- /* @__PURE__ */ jsx103(
3986
- "p",
3987
- {
3988
- className: `text-sm font-medium ${isActive || isCompleted ? "text-gray-900 dark:text-gray-100" : "text-gray-500 dark:text-gray-400"}`,
3989
- children: step.label
3990
- }
3991
- ),
3992
- step.description && /* @__PURE__ */ jsx103("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: step.description })
3993
- ] })
3994
- ] }),
3995
- !isLast && /* @__PURE__ */ jsx103(
3996
- "div",
3997
- {
3998
- className: `${isHorizontal ? "flex-1 h-0.5 mx-4" : "w-0.5 h-full ml-5 -mt-8"} ${isCompleted || isActive && stepNumber < currentStep ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-300 dark:bg-gray-600"}`
3999
- }
4000
- )
4001
- ] }, index);
4002
- }) });
4040
+ ) })
4041
+ ] }, index);
4042
+ })
4043
+ ] });
4003
4044
  };
4004
4045
 
4005
4046
  // src/components/Divider.tsx