@web-my-money/blocks 1.0.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/app.mjs ADDED
@@ -0,0 +1,53 @@
1
+ import {
2
+ ActivityFeed,
3
+ AppBrand,
4
+ AppShell,
5
+ AppearanceSettings,
6
+ BrandFrame,
7
+ DashboardHeader,
8
+ DataSummaryCards,
9
+ DataTable,
10
+ EmptyState,
11
+ GlassPanel,
12
+ KPIRow,
13
+ LayoutToggle,
14
+ NotificationBanner,
15
+ PageHeader,
16
+ PageHeaderBanner,
17
+ SidebarNavigation,
18
+ StatCard,
19
+ SubTabs,
20
+ useActionRunner,
21
+ useLayoutPreference,
22
+ useOptimisticAction
23
+ } from "./chunk-UM2RDUPI.mjs";
24
+ import {
25
+ LightboxGallery,
26
+ Thumbnail
27
+ } from "./chunk-L6OIX4DG.mjs";
28
+ import "./chunk-PJO7WJ4G.mjs";
29
+ export {
30
+ ActivityFeed,
31
+ AppBrand,
32
+ AppShell,
33
+ AppearanceSettings,
34
+ BrandFrame,
35
+ DashboardHeader,
36
+ DataSummaryCards,
37
+ DataTable,
38
+ EmptyState,
39
+ GlassPanel,
40
+ KPIRow,
41
+ LayoutToggle,
42
+ LightboxGallery,
43
+ NotificationBanner,
44
+ PageHeader,
45
+ PageHeaderBanner,
46
+ SidebarNavigation,
47
+ StatCard,
48
+ SubTabs,
49
+ Thumbnail,
50
+ useActionRunner,
51
+ useLayoutPreference,
52
+ useOptimisticAction
53
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-PJO7WJ4G.mjs";
4
+
5
+ // src/lightbox/index.tsx
6
+ import * as React from "react";
7
+ import {
8
+ Lightbox,
9
+ LightboxContent,
10
+ LightboxImage,
11
+ LightboxNavButton,
12
+ LightboxCaption
13
+ } from "@web-my-money/primitives/lightbox";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ function Thumbnail({ image, onClick, className }) {
16
+ return /* @__PURE__ */ jsx(
17
+ "button",
18
+ {
19
+ type: "button",
20
+ "data-slot": "thumbnail",
21
+ onClick,
22
+ className: cn(
23
+ "group relative aspect-square overflow-hidden rounded-lg border border-border outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
24
+ className
25
+ ),
26
+ children: /* @__PURE__ */ jsx(
27
+ "img",
28
+ {
29
+ src: image.thumbnailSrc ?? image.src,
30
+ alt: image.alt ?? "",
31
+ className: "size-full object-cover transition-transform duration-200 group-hover:scale-105",
32
+ loading: "lazy"
33
+ }
34
+ )
35
+ }
36
+ );
37
+ }
38
+ function LightboxGallery({ images, className, gridClassName }) {
39
+ const [openIndex, setOpenIndex] = React.useState(null);
40
+ const hasImages = images.length > 0;
41
+ const active = openIndex !== null ? images[openIndex] : null;
42
+ const goTo = (dir) => {
43
+ setOpenIndex((i) => {
44
+ if (i === null) return i;
45
+ return (i + dir + images.length) % images.length;
46
+ });
47
+ };
48
+ if (!hasImages) return null;
49
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "lightbox-gallery", className, children: [
50
+ /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4", gridClassName), children: images.map((image, i) => /* @__PURE__ */ jsx(Thumbnail, { image, onClick: () => setOpenIndex(i) }, image.src)) }),
51
+ /* @__PURE__ */ jsx(Lightbox, { open: openIndex !== null, onOpenChange: (open) => !open && setOpenIndex(null), children: /* @__PURE__ */ jsx(LightboxContent, { children: active && /* @__PURE__ */ jsxs(Fragment, { children: [
52
+ images.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
53
+ /* @__PURE__ */ jsx(LightboxNavButton, { direction: "prev", onClick: () => goTo(-1) }),
54
+ /* @__PURE__ */ jsx(LightboxNavButton, { direction: "next", onClick: () => goTo(1) })
55
+ ] }),
56
+ /* @__PURE__ */ jsx(LightboxImage, { src: active.src, alt: active.alt ?? "" }),
57
+ active.caption && /* @__PURE__ */ jsx(LightboxCaption, { children: active.caption }),
58
+ images.length > 1 && /* @__PURE__ */ jsxs("p", { className: "text-xs text-white/60", "aria-live": "polite", children: [
59
+ (openIndex ?? 0) + 1,
60
+ " / ",
61
+ images.length
62
+ ] })
63
+ ] }) }) })
64
+ ] });
65
+ }
66
+
67
+ export {
68
+ Thumbnail,
69
+ LightboxGallery
70
+ };
@@ -0,0 +1,10 @@
1
+ // src/utils.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ export {
9
+ cn
10
+ };