@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.d.mts CHANGED
@@ -406,6 +406,7 @@ interface StepperProps {
406
406
  currentStep: number;
407
407
  orientation?: 'horizontal' | 'vertical';
408
408
  className?: string;
409
+ compact?: boolean;
409
410
  }
410
411
  declare const Stepper: React.FC<StepperProps>;
411
412
 
package/dist/index.d.ts CHANGED
@@ -406,6 +406,7 @@ interface StepperProps {
406
406
  currentStep: number;
407
407
  orientation?: 'horizontal' | 'vertical';
408
408
  className?: string;
409
+ compact?: boolean;
409
410
  }
410
411
  declare const Stepper: React.FC<StepperProps>;
411
412
 
package/dist/index.js CHANGED
@@ -2082,8 +2082,8 @@ function Table({
2082
2082
  responsive = true
2083
2083
  }) {
2084
2084
  const { theme } = useTheme();
2085
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
2086
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `${responsive ? "hidden md:block" : ""} overflow-x-auto ${className}`, children: [
2085
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className, children: [
2086
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `${responsive ? "hidden md:block" : ""} overflow-x-auto`, children: [
2087
2087
  /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("table", { className: "w-full text-left", children: [
2088
2088
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("thead", { className: "bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("tr", { children: columns.map((column, colIndex) => {
2089
2089
  const isLast = colIndex === columns.length - 1;
@@ -2124,11 +2124,13 @@ function Table({
2124
2124
  ] }),
2125
2125
  data.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: "No data available" })
2126
2126
  ] }),
2127
- responsive && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `md:hidden space-y-4 ${className}`, children: [
2127
+ responsive && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "md:hidden space-y-3", children: [
2128
2128
  data.map((row, rowIndex) => {
2129
2129
  const cardClasses = [
2130
2130
  "bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-4 shadow-sm",
2131
- hoverable ? "hover:shadow-md transition-shadow" : ""
2131
+ hoverable ? "hover:shadow-md transition-shadow" : "",
2132
+ "relative isolate"
2133
+ // Ensure cards are isolated layers
2132
2134
  ].filter(Boolean).join(" ");
2133
2135
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
2134
2136
  "div",
@@ -4109,48 +4111,87 @@ var Stepper = ({
4109
4111
  steps,
4110
4112
  currentStep,
4111
4113
  orientation = "horizontal",
4112
- className = ""
4114
+ className = "",
4115
+ compact = false
4113
4116
  }) => {
4114
4117
  const isHorizontal = orientation === "horizontal";
4115
- return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: `${isHorizontal ? "flex items-center" : "flex flex-col"} ${className}`, children: steps.map((step, index) => {
4118
+ const getStepVisibility = (index) => {
4119
+ if (!isHorizontal || steps.length <= 3) {
4120
+ return { mobile: true, desktop: true };
4121
+ }
4116
4122
  const stepNumber = index + 1;
4117
- const isActive = stepNumber === currentStep;
4118
- const isCompleted = stepNumber < currentStep;
4119
- const isLast = index === steps.length - 1;
4120
- return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_react22.default.Fragment, { children: [
4121
- /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: `flex ${isHorizontal ? "flex-col items-center" : "flex-row items-start"} ${isHorizontal ? "" : "flex-1"}`, children: [
4122
- /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4123
- "div",
4124
- {
4125
- 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"}`,
4126
- children: isCompleted ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(CheckIcon, { size: "sm", className: "text-white" }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4127
- "span",
4123
+ const distance = Math.abs(stepNumber - currentStep);
4124
+ const mobileVisible = distance <= 1;
4125
+ const desktopVisible = !compact;
4126
+ return { mobile: mobileVisible, desktop: desktopVisible };
4127
+ };
4128
+ const shouldShowCounter = isHorizontal && steps.length > 3;
4129
+ return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: `${isHorizontal ? "flex items-start w-full" : "flex flex-col"} ${className}`, children: [
4130
+ shouldShowCounter && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "md:hidden flex items-center mr-4 flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("span", { className: "text-sm font-medium text-gray-600 dark:text-gray-400", children: [
4131
+ currentStep,
4132
+ "/",
4133
+ steps.length
4134
+ ] }) }),
4135
+ steps.map((step, index) => {
4136
+ const stepNumber = index + 1;
4137
+ const isActive = stepNumber === currentStep;
4138
+ const isCompleted = stepNumber < currentStep;
4139
+ const isLast = index === steps.length - 1;
4140
+ const visibility = getStepVisibility(index);
4141
+ const visibleMobileSteps = steps.filter((_, i) => getStepVisibility(i).mobile);
4142
+ const isLastVisibleMobile = index === steps.map((_, i) => i).filter((i) => getStepVisibility(i).mobile).slice(-1)[0];
4143
+ return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_react22.default.Fragment, { children: [
4144
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: `
4145
+ flex ${isHorizontal ? "flex-col items-center flex-shrink-0" : "flex-row items-start"}
4146
+ ${isHorizontal ? "" : isLast ? "" : "mb-6"}
4147
+ ${!visibility.mobile ? "hidden md:flex" : ""}
4148
+ ${!visibility.desktop && visibility.mobile ? "md:hidden" : ""}
4149
+ `, children: [
4150
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: `flex ${isHorizontal ? "flex-col items-center" : "flex-col items-center flex-shrink-0"}`, children: [
4151
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4152
+ "div",
4128
4153
  {
4129
- className: `text-sm font-semibold ${isActive ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400"}`,
4130
- children: stepNumber
4154
+ 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"}`,
4155
+ children: isCompleted ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(CheckIcon, { size: "sm", className: "text-white" }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4156
+ "span",
4157
+ {
4158
+ className: `text-sm font-semibold ${isActive ? "text-blue-600 dark:text-blue-400" : "text-gray-500 dark:text-gray-400"}`,
4159
+ children: stepNumber
4160
+ }
4161
+ )
4162
+ }
4163
+ ),
4164
+ !isLast && !isHorizontal && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4165
+ "div",
4166
+ {
4167
+ className: `w-0.5 flex-1 min-h-[24px] ${isCompleted ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-300 dark:bg-gray-600"}`
4131
4168
  }
4132
4169
  )
4170
+ ] }),
4171
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: `${isHorizontal ? "mt-3 text-center" : "ml-4 flex-1 min-h-[40px] flex flex-col justify-center"}`, children: [
4172
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4173
+ "p",
4174
+ {
4175
+ className: `text-sm font-medium whitespace-nowrap ${isActive || isCompleted ? "text-gray-900 dark:text-gray-100" : "text-gray-500 dark:text-gray-400"}`,
4176
+ children: step.label
4177
+ }
4178
+ ),
4179
+ step.description && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1 whitespace-nowrap", children: step.description })
4180
+ ] })
4181
+ ] }),
4182
+ !isLast && isHorizontal && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: `
4183
+ flex items-start pt-5 mx-4 min-w-[80px] max-w-[200px] flex-1
4184
+ ${!visibility.mobile || isLastVisibleMobile ? "hidden md:flex" : ""}
4185
+ ${!visibility.desktop && visibility.mobile ? "md:hidden" : ""}
4186
+ `, children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4187
+ "div",
4188
+ {
4189
+ className: `h-0.5 w-full ${isCompleted ? "bg-blue-600 dark:bg-blue-500" : "bg-gray-300 dark:bg-gray-600"}`
4133
4190
  }
4134
- ) }),
4135
- /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: `${isHorizontal ? "mt-2 text-center" : "ml-4 pb-8"} ${isLast && !isHorizontal ? "pb-0" : ""}`, children: [
4136
- /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4137
- "p",
4138
- {
4139
- className: `text-sm font-medium ${isActive || isCompleted ? "text-gray-900 dark:text-gray-100" : "text-gray-500 dark:text-gray-400"}`,
4140
- children: step.label
4141
- }
4142
- ),
4143
- step.description && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: step.description })
4144
- ] })
4145
- ] }),
4146
- !isLast && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
4147
- "div",
4148
- {
4149
- 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"}`
4150
- }
4151
- )
4152
- ] }, index);
4153
- }) });
4191
+ ) })
4192
+ ] }, index);
4193
+ })
4194
+ ] });
4154
4195
  };
4155
4196
 
4156
4197
  // src/components/Divider.tsx