@optilogic/core 1.3.7 → 1.5.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.cjs +56 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -4
- package/dist/index.d.ts +49 -4
- package/dist/index.js +56 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/confirmation-modal.tsx +41 -6
- package/src/components/modal.tsx +84 -5
package/dist/index.cjs
CHANGED
|
@@ -2128,7 +2128,10 @@ function Modal({
|
|
|
2128
2128
|
footer,
|
|
2129
2129
|
size = "md",
|
|
2130
2130
|
zIndex = 50,
|
|
2131
|
-
className
|
|
2131
|
+
className,
|
|
2132
|
+
contentClassName,
|
|
2133
|
+
responsive = false,
|
|
2134
|
+
forceMobile = false
|
|
2132
2135
|
}) {
|
|
2133
2136
|
React20__namespace.useEffect(() => {
|
|
2134
2137
|
if (!isOpen) return;
|
|
@@ -2154,12 +2157,23 @@ function Modal({
|
|
|
2154
2157
|
const sizeClasses = {
|
|
2155
2158
|
sm: "max-w-md",
|
|
2156
2159
|
md: "max-w-lg",
|
|
2157
|
-
lg: "max-w-2xl"
|
|
2160
|
+
lg: "max-w-2xl",
|
|
2161
|
+
xl: "max-w-4xl",
|
|
2162
|
+
"2xl": "max-w-6xl",
|
|
2163
|
+
full: "max-w-[95vw]"
|
|
2158
2164
|
};
|
|
2165
|
+
const responsiveOuter = "[@media(pointer:coarse)and(hover:none)]:!p-0";
|
|
2166
|
+
const responsiveFrame = "[@media(pointer:coarse)and(hover:none)]:!w-screen [@media(pointer:coarse)and(hover:none)]:!h-[100dvh] [@media(pointer:coarse)and(hover:none)]:!max-h-[100dvh] [@media(pointer:coarse)and(hover:none)]:!max-w-none [@media(pointer:coarse)and(hover:none)]:!rounded-none [@media(pointer:coarse)and(hover:none)]:!border-0";
|
|
2167
|
+
const forcedOuter = "!p-0";
|
|
2168
|
+
const forcedFrame = "!w-screen !h-[100dvh] !max-h-[100dvh] !max-w-none !rounded-none !border-0";
|
|
2159
2169
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2160
2170
|
"div",
|
|
2161
2171
|
{
|
|
2162
|
-
className:
|
|
2172
|
+
className: cn(
|
|
2173
|
+
"fixed inset-0 flex items-center justify-center p-4",
|
|
2174
|
+
responsive && responsiveOuter,
|
|
2175
|
+
forceMobile && forcedOuter
|
|
2176
|
+
),
|
|
2163
2177
|
style: { zIndex },
|
|
2164
2178
|
onClick: onClose,
|
|
2165
2179
|
children: [
|
|
@@ -2172,7 +2186,10 @@ function Modal({
|
|
|
2172
2186
|
"bg-card border border-border rounded-lg shadow-lg",
|
|
2173
2187
|
"flex flex-col",
|
|
2174
2188
|
"max-h-[90vh]",
|
|
2175
|
-
sizeClasses[size]
|
|
2189
|
+
sizeClasses[size],
|
|
2190
|
+
responsive && responsiveFrame,
|
|
2191
|
+
forceMobile && forcedFrame,
|
|
2192
|
+
contentClassName
|
|
2176
2193
|
),
|
|
2177
2194
|
onClick: (e) => e.stopPropagation(),
|
|
2178
2195
|
children: [
|
|
@@ -2217,6 +2234,27 @@ function ModalButton({
|
|
|
2217
2234
|
}
|
|
2218
2235
|
);
|
|
2219
2236
|
}
|
|
2237
|
+
var mobileSheetContentClasses = [
|
|
2238
|
+
"[@media(pointer:coarse)and(hover:none)]:!top-auto",
|
|
2239
|
+
"[@media(pointer:coarse)and(hover:none)]:!bottom-0",
|
|
2240
|
+
"[@media(pointer:coarse)and(hover:none)]:!left-0",
|
|
2241
|
+
"[@media(pointer:coarse)and(hover:none)]:!translate-x-0",
|
|
2242
|
+
"[@media(pointer:coarse)and(hover:none)]:!translate-y-0",
|
|
2243
|
+
"[@media(pointer:coarse)and(hover:none)]:!w-screen",
|
|
2244
|
+
"[@media(pointer:coarse)and(hover:none)]:!max-w-none",
|
|
2245
|
+
"[@media(pointer:coarse)and(hover:none)]:!rounded-t-xl",
|
|
2246
|
+
"[@media(pointer:coarse)and(hover:none)]:!rounded-b-none",
|
|
2247
|
+
"[@media(pointer:coarse)and(hover:none)]:!pb-[calc(1.5rem+env(safe-area-inset-bottom))]"
|
|
2248
|
+
].join(" ");
|
|
2249
|
+
var mobileSheetFooterClasses = [
|
|
2250
|
+
// Stack buttons full-width with comfortable tap targets on touch devices.
|
|
2251
|
+
"[@media(pointer:coarse)and(hover:none)]:!flex-col",
|
|
2252
|
+
"[@media(pointer:coarse)and(hover:none)]:!gap-2"
|
|
2253
|
+
].join(" ");
|
|
2254
|
+
var mobileSheetActionClasses = [
|
|
2255
|
+
"[@media(pointer:coarse)and(hover:none)]:!w-full",
|
|
2256
|
+
"[@media(pointer:coarse)and(hover:none)]:!min-h-11"
|
|
2257
|
+
].join(" ");
|
|
2220
2258
|
function ConfirmationModal({
|
|
2221
2259
|
open,
|
|
2222
2260
|
onOpenChange,
|
|
@@ -2236,18 +2274,28 @@ function ConfirmationModal({
|
|
|
2236
2274
|
onConfirm();
|
|
2237
2275
|
onOpenChange(false);
|
|
2238
2276
|
};
|
|
2239
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogContent, { children: [
|
|
2277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogContent, { className: mobileSheetContentClasses, children: [
|
|
2240
2278
|
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogHeader, { children: [
|
|
2241
2279
|
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogTitle, { children: title }),
|
|
2242
2280
|
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogDescription, { children: description })
|
|
2243
2281
|
] }),
|
|
2244
|
-
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogFooter, { children: [
|
|
2245
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2282
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AlertDialogFooter, { className: mobileSheetFooterClasses, children: [
|
|
2283
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2284
|
+
AlertDialogCancel,
|
|
2285
|
+
{
|
|
2286
|
+
onClick: handleCancel,
|
|
2287
|
+
className: mobileSheetActionClasses,
|
|
2288
|
+
children: cancelLabel
|
|
2289
|
+
}
|
|
2290
|
+
),
|
|
2246
2291
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2247
2292
|
AlertDialogAction,
|
|
2248
2293
|
{
|
|
2249
2294
|
onClick: handleConfirm,
|
|
2250
|
-
className:
|
|
2295
|
+
className: [
|
|
2296
|
+
destructive ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "",
|
|
2297
|
+
mobileSheetActionClasses
|
|
2298
|
+
].filter(Boolean).join(" "),
|
|
2251
2299
|
children: confirmLabel
|
|
2252
2300
|
}
|
|
2253
2301
|
)
|