@marcoschwartz/lite-ui 0.18.1 → 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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +141 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -70
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -220,8 +220,9 @@ interface TableProps<T = any> {
|
|
|
220
220
|
striped?: boolean;
|
|
221
221
|
hoverable?: boolean;
|
|
222
222
|
className?: string;
|
|
223
|
+
responsive?: boolean;
|
|
223
224
|
}
|
|
224
|
-
declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
225
|
+
declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, responsive, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
225
226
|
|
|
226
227
|
interface PaginationProps {
|
|
227
228
|
currentPage: number;
|
|
@@ -405,6 +406,7 @@ interface StepperProps {
|
|
|
405
406
|
currentStep: number;
|
|
406
407
|
orientation?: 'horizontal' | 'vertical';
|
|
407
408
|
className?: string;
|
|
409
|
+
compact?: boolean;
|
|
408
410
|
}
|
|
409
411
|
declare const Stepper: React.FC<StepperProps>;
|
|
410
412
|
|
package/dist/index.d.ts
CHANGED
|
@@ -220,8 +220,9 @@ interface TableProps<T = any> {
|
|
|
220
220
|
striped?: boolean;
|
|
221
221
|
hoverable?: boolean;
|
|
222
222
|
className?: string;
|
|
223
|
+
responsive?: boolean;
|
|
223
224
|
}
|
|
224
|
-
declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
225
|
+
declare function Table<T extends Record<string, any>>({ columns, data, keyField, striped, hoverable, className, responsive, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
225
226
|
|
|
226
227
|
interface PaginationProps {
|
|
227
228
|
currentPage: number;
|
|
@@ -405,6 +406,7 @@ interface StepperProps {
|
|
|
405
406
|
currentStep: number;
|
|
406
407
|
orientation?: 'horizontal' | 'vertical';
|
|
407
408
|
className?: string;
|
|
409
|
+
compact?: boolean;
|
|
408
410
|
}
|
|
409
411
|
declare const Stepper: React.FC<StepperProps>;
|
|
410
412
|
|
package/dist/index.js
CHANGED
|
@@ -2078,49 +2078,81 @@ function Table({
|
|
|
2078
2078
|
keyField = "id",
|
|
2079
2079
|
striped = false,
|
|
2080
2080
|
hoverable = true,
|
|
2081
|
-
className = ""
|
|
2081
|
+
className = "",
|
|
2082
|
+
responsive = true
|
|
2082
2083
|
}) {
|
|
2083
2084
|
const { theme } = useTheme();
|
|
2084
|
-
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className
|
|
2085
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("
|
|
2086
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
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
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("table", { className: "w-full text-left", children: [
|
|
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
|
+
const isLast = colIndex === columns.length - 1;
|
|
2090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
2091
|
+
"th",
|
|
2092
|
+
{
|
|
2093
|
+
className: isLast ? "px-6 py-3 text-xs font-medium text-gray-700 dark:text-gray-300 uppercase tracking-wider relative" : "px-6 py-3 text-xs font-medium text-gray-700 dark:text-gray-300 uppercase tracking-wider",
|
|
2094
|
+
style: { width: column.width },
|
|
2095
|
+
children: column.title
|
|
2096
|
+
},
|
|
2097
|
+
column.key
|
|
2098
|
+
);
|
|
2099
|
+
}) }) }),
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("tbody", { className: "bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700", children: data.map((row, rowIndex) => {
|
|
2101
|
+
const rowClasses = [
|
|
2102
|
+
striped && rowIndex % 2 === 1 ? "bg-gray-50 dark:bg-gray-800/50" : "",
|
|
2103
|
+
hoverable ? "hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" : ""
|
|
2104
|
+
].filter(Boolean).join(" ");
|
|
2105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
2106
|
+
"tr",
|
|
2107
|
+
{
|
|
2108
|
+
className: rowClasses,
|
|
2109
|
+
children: columns.map((column, colIndex) => {
|
|
2110
|
+
const isLast = colIndex === columns.length - 1;
|
|
2111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
2112
|
+
"td",
|
|
2113
|
+
{
|
|
2114
|
+
className: isLast ? "px-6 py-4 text-sm text-gray-900 dark:text-gray-100 overflow-visible" : "px-6 py-4 text-sm text-gray-900 dark:text-gray-100",
|
|
2115
|
+
children: column.render ? column.render(row[column.key], row, rowIndex) : row[column.key]
|
|
2116
|
+
},
|
|
2117
|
+
column.key
|
|
2118
|
+
);
|
|
2119
|
+
})
|
|
2120
|
+
},
|
|
2121
|
+
row[keyField] || rowIndex
|
|
2122
|
+
);
|
|
2123
|
+
}) })
|
|
2124
|
+
] }),
|
|
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
|
+
] }),
|
|
2127
|
+
responsive && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "md:hidden space-y-3", children: [
|
|
2128
|
+
data.map((row, rowIndex) => {
|
|
2129
|
+
const cardClasses = [
|
|
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" : "",
|
|
2132
|
+
"relative isolate"
|
|
2133
|
+
// Ensure cards are isolated layers
|
|
2102
2134
|
].filter(Boolean).join(" ");
|
|
2103
2135
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
2104
|
-
"
|
|
2136
|
+
"div",
|
|
2105
2137
|
{
|
|
2106
|
-
className:
|
|
2107
|
-
children: columns.map((column
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
"
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
children: column.render ? column.render(row[column.key], row, rowIndex) : row[column.key]
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2138
|
+
className: cardClasses,
|
|
2139
|
+
children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
2140
|
+
"div",
|
|
2141
|
+
{
|
|
2142
|
+
className: "flex justify-between items-start py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",
|
|
2143
|
+
children: [
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider flex-shrink-0 mr-4", children: column.title }),
|
|
2145
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-sm text-gray-900 dark:text-gray-100 text-right", children: column.render ? column.render(row[column.key], row, rowIndex) : row[column.key] })
|
|
2146
|
+
]
|
|
2147
|
+
},
|
|
2148
|
+
column.key
|
|
2149
|
+
))
|
|
2118
2150
|
},
|
|
2119
2151
|
row[keyField] || rowIndex
|
|
2120
2152
|
);
|
|
2121
|
-
})
|
|
2122
|
-
|
|
2123
|
-
|
|
2153
|
+
}),
|
|
2154
|
+
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" })
|
|
2155
|
+
] })
|
|
2124
2156
|
] });
|
|
2125
2157
|
}
|
|
2126
2158
|
|
|
@@ -4079,48 +4111,87 @@ var Stepper = ({
|
|
|
4079
4111
|
steps,
|
|
4080
4112
|
currentStep,
|
|
4081
4113
|
orientation = "horizontal",
|
|
4082
|
-
className = ""
|
|
4114
|
+
className = "",
|
|
4115
|
+
compact = false
|
|
4083
4116
|
}) => {
|
|
4084
4117
|
const isHorizontal = orientation === "horizontal";
|
|
4085
|
-
|
|
4118
|
+
const getStepVisibility = (index) => {
|
|
4119
|
+
if (!isHorizontal || steps.length <= 3) {
|
|
4120
|
+
return { mobile: true, desktop: true };
|
|
4121
|
+
}
|
|
4086
4122
|
const stepNumber = index + 1;
|
|
4087
|
-
const
|
|
4088
|
-
const
|
|
4089
|
-
const
|
|
4090
|
-
return
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
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",
|
|
4098
4153
|
{
|
|
4099
|
-
className: `
|
|
4100
|
-
children:
|
|
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"}`
|
|
4101
4168
|
}
|
|
4102
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"}`
|
|
4103
4190
|
}
|
|
4104
|
-
) })
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
{
|
|
4109
|
-
className: `text-sm font-medium ${isActive || isCompleted ? "text-gray-900 dark:text-gray-100" : "text-gray-500 dark:text-gray-400"}`,
|
|
4110
|
-
children: step.label
|
|
4111
|
-
}
|
|
4112
|
-
),
|
|
4113
|
-
step.description && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-1", children: step.description })
|
|
4114
|
-
] })
|
|
4115
|
-
] }),
|
|
4116
|
-
!isLast && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
4117
|
-
"div",
|
|
4118
|
-
{
|
|
4119
|
-
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"}`
|
|
4120
|
-
}
|
|
4121
|
-
)
|
|
4122
|
-
] }, index);
|
|
4123
|
-
}) });
|
|
4191
|
+
) })
|
|
4192
|
+
] }, index);
|
|
4193
|
+
})
|
|
4194
|
+
] });
|
|
4124
4195
|
};
|
|
4125
4196
|
|
|
4126
4197
|
// src/components/Divider.tsx
|