@timmbr/ui 1.0.0-beta → 1.2.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/README.md +20 -16
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Alert/Alert.types.d.ts +2 -4
- package/dist/components/Alert/Alert.types.d.ts.map +1 -1
- package/dist/components/AlertDialog/AlertDialog.d.ts +16 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/dist/components/AlertDialog/AlertDialog.js +94 -0
- package/dist/components/AlertDialog/AlertDialog.styles.d.ts +8 -0
- package/dist/components/AlertDialog/AlertDialog.styles.d.ts.map +1 -0
- package/dist/components/AlertDialog/AlertDialog.styles.js +25 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +16 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts.map +1 -0
- package/dist/components/AlertDialog/index.d.ts +4 -0
- package/dist/components/AlertDialog/index.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.styles.d.ts +2 -2
- package/dist/components/Badge/Badge.styles.d.ts +1 -1
- package/dist/components/Button/Button.styles.d.ts +2 -2
- package/dist/components/Chip/Chip.styles.d.ts +1 -1
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts +10 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.js +111 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts +8 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.styles.js +33 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts +31 -0
- package/dist/components/CrossZoneLink/CrossZoneLink.types.d.ts.map +1 -0
- package/dist/components/CrossZoneLink/index.d.ts +4 -0
- package/dist/components/CrossZoneLink/index.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +8 -6
- package/dist/components/Dialog/Dialog.styles.d.ts +1 -0
- package/dist/components/Dialog/Dialog.styles.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.styles.js +7 -4
- package/dist/components/Dialog/Dialog.types.d.ts +4 -6
- package/dist/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/dist/components/Divider/Divider.styles.d.ts +1 -1
- package/dist/components/Drawer/Drawer.types.d.ts +3 -6
- package/dist/components/Drawer/Drawer.types.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.types.d.ts +1 -2
- package/dist/components/Dropdown/Dropdown.types.d.ts.map +1 -1
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/Heading/Heading.styles.d.ts +2 -2
- package/dist/components/Icon/Icon.styles.d.ts +1 -1
- package/dist/components/ImageUpload/ImageUpload.d.ts +4 -0
- package/dist/components/ImageUpload/ImageUpload.d.ts.map +1 -0
- package/dist/components/ImageUpload/ImageUpload.helpers.d.ts +30 -0
- package/dist/components/ImageUpload/ImageUpload.helpers.d.ts.map +1 -0
- package/dist/components/ImageUpload/ImageUpload.helpers.js +95 -0
- package/dist/components/ImageUpload/ImageUpload.js +365 -0
- package/dist/components/ImageUpload/ImageUpload.styles.d.ts +17 -0
- package/dist/components/ImageUpload/ImageUpload.styles.d.ts.map +1 -0
- package/dist/components/ImageUpload/ImageUpload.styles.js +72 -0
- package/dist/components/ImageUpload/ImageUpload.types.d.ts +112 -0
- package/dist/components/ImageUpload/ImageUpload.types.d.ts.map +1 -0
- package/dist/components/ImageUpload/index.d.ts +6 -0
- package/dist/components/ImageUpload/index.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.d.ts +25 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadDropzone.js +106 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadIcons.d.ts +6 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadIcons.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadIcons.js +61 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.d.ts +12 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadModal.js +137 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.d.ts +14 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadSinglePreview.js +142 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.d.ts +23 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.d.ts.map +1 -0
- package/dist/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.js +139 -0
- package/dist/components/ImageUpload/subcomponents/index.d.ts +6 -0
- package/dist/components/ImageUpload/subcomponents/index.d.ts.map +1 -0
- package/dist/components/Inline/Inline.styles.d.ts +2 -2
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Input/Input.styles.d.ts +1 -1
- package/dist/components/Input/Input.styles.js +1 -1
- package/dist/components/Input/Input.types.d.ts +1 -1
- package/dist/components/Input/Input.types.d.ts.map +1 -1
- package/dist/components/LinkButton/LinkButton.d.ts +13 -0
- package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.js +179 -0
- package/dist/components/LinkButton/LinkButton.styles.d.ts +8 -0
- package/dist/components/LinkButton/LinkButton.styles.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.styles.js +61 -0
- package/dist/components/LinkButton/LinkButton.types.d.ts +60 -0
- package/dist/components/LinkButton/LinkButton.types.d.ts.map +1 -0
- package/dist/components/LinkButton/index.d.ts +4 -0
- package/dist/components/LinkButton/index.d.ts.map +1 -0
- package/dist/components/List/List.types.d.ts +2 -4
- package/dist/components/List/List.types.d.ts.map +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -2
- package/dist/components/Popover/Popover.types.d.ts.map +1 -1
- package/dist/components/Progress/Progress.styles.d.ts +1 -1
- package/dist/components/Radio/Radio.js +2 -2
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/Select.styles.d.ts +1 -1
- package/dist/components/SideBarNavigation/SideBarNavigation.context.d.ts +15 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.context.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.context.js +10 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.d.ts +4 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.d.ts +19 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.helpers.js +48 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.js +132 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.d.ts +18 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.styles.js +85 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.types.d.ts +69 -0
- package/dist/components/SideBarNavigation/SideBarNavigation.types.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/index.d.ts +13 -0
- package/dist/components/SideBarNavigation/index.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarBranding.js +58 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.d.ts +10 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarFooter.js +27 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.d.ts +14 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarNavItem.js +147 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarPopoverMenu.js +106 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarProfile.js +118 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.d.ts +13 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarSubItem.js +34 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.d.ts +8 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.d.ts.map +1 -0
- package/dist/components/SideBarNavigation/subcomponents/SidebarToggle.js +40 -0
- package/dist/components/Stack/Stack.styles.d.ts +2 -2
- package/dist/components/Stat/Stat.types.d.ts +3 -6
- package/dist/components/Stat/Stat.types.d.ts.map +1 -1
- package/dist/components/Table/Table.types.d.ts +7 -14
- package/dist/components/Table/Table.types.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.styles.d.ts +2 -2
- package/dist/components/Text/Text.styles.d.ts +2 -2
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.styles.d.ts +1 -1
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +13 -4
- package/dist/components/Toast/Toast.types.d.ts +35 -2
- package/dist/components/Toast/Toast.types.d.ts.map +1 -1
- package/dist/components/Toast/ToastContainer.d.ts +7 -0
- package/dist/components/Toast/ToastContainer.d.ts.map +1 -0
- package/dist/components/Toast/ToastContainer.js +104 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/toastStore.d.ts +31 -0
- package/dist/components/Toast/toastStore.d.ts.map +1 -0
- package/dist/components/Toast/toastStore.js +104 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -3
- package/dist/providers/TimmbrConfigProvider.d.ts +20 -2
- package/dist/providers/TimmbrConfigProvider.d.ts.map +1 -1
- package/dist/providers/TimmbrConfigProvider.js +38 -3
- package/package.json +15 -6
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '@timmbr/utils';
|
|
4
|
+
import { Eye, Trash2 } from '@timmbr/icons';
|
|
5
|
+
import { imagePreviewContainerVariants } from '../ImageUpload.styles.js';
|
|
6
|
+
import { PlayIcon, UploadCloudIcon } from './ImageUploadIcons.js';
|
|
7
|
+
import { isVideoMedia } from '../ImageUpload.helpers.js';
|
|
8
|
+
import { Button } from '../../Button/Button.js';
|
|
9
|
+
|
|
10
|
+
const ImageUploadSinglePreview = ({
|
|
11
|
+
item,
|
|
12
|
+
aspectRatio,
|
|
13
|
+
disabled = false,
|
|
14
|
+
isUploading = false,
|
|
15
|
+
enablePreviewModal = true,
|
|
16
|
+
onReplace,
|
|
17
|
+
onRemove,
|
|
18
|
+
onPreview
|
|
19
|
+
}) => {
|
|
20
|
+
const isVideo = isVideoMedia(item);
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
style: aspectRatio === "square" ? {
|
|
25
|
+
width: "120px",
|
|
26
|
+
height: "120px",
|
|
27
|
+
minWidth: "120px",
|
|
28
|
+
minHeight: "120px",
|
|
29
|
+
maxWidth: "120px",
|
|
30
|
+
maxHeight: "120px"
|
|
31
|
+
} : void 0,
|
|
32
|
+
className: cn(imagePreviewContainerVariants({ aspectRatio })),
|
|
33
|
+
children: [
|
|
34
|
+
isVideo ? /* @__PURE__ */ jsx(
|
|
35
|
+
"video",
|
|
36
|
+
{
|
|
37
|
+
src: item.url,
|
|
38
|
+
className: "w-full h-full object-cover",
|
|
39
|
+
muted: true,
|
|
40
|
+
loop: true,
|
|
41
|
+
playsInline: true,
|
|
42
|
+
onMouseEnter: (e) => e.currentTarget.play().catch(() => {
|
|
43
|
+
}),
|
|
44
|
+
onMouseLeave: (e) => {
|
|
45
|
+
const v = e.currentTarget;
|
|
46
|
+
v.pause();
|
|
47
|
+
v.currentTime = 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
) : /* @__PURE__ */ jsx(
|
|
51
|
+
"img",
|
|
52
|
+
{
|
|
53
|
+
src: item.url,
|
|
54
|
+
alt: item.name || "Uploaded preview",
|
|
55
|
+
className: cn(
|
|
56
|
+
"w-full h-full",
|
|
57
|
+
aspectRatio === "square" ? "object-contain p-2" : "object-cover"
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
isVideo && /* @__PURE__ */ jsxs("div", { className: "absolute top-2 left-2 z-10 bg-black/65 backdrop-blur-md text-white text-[10px] font-medium px-2 py-0.5 rounded-full border border-white/20 flex items-center gap-1 shadow-sm pointer-events-none", children: [
|
|
62
|
+
/* @__PURE__ */ jsx(PlayIcon, { className: "size-2.5" }),
|
|
63
|
+
/* @__PURE__ */ jsx("span", { children: "Video" })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-1.5 p-1 backdrop-blur-[2px]", children: aspectRatio === "square" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
enablePreviewModal && /* @__PURE__ */ jsx(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
className: "size-8 rounded-lg bg-black/60 hover:bg-black/85 text-white flex items-center justify-center border border-white/20 transition-all cursor-pointer shadow-xs",
|
|
71
|
+
onClick: onPreview,
|
|
72
|
+
title: "Preview full size",
|
|
73
|
+
children: /* @__PURE__ */ jsx(Eye, { className: "size-3.5" })
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
disabled: disabled || isUploading,
|
|
81
|
+
onClick: onReplace,
|
|
82
|
+
className: "size-8 rounded-lg bg-primary hover:bg-primary/90 text-white flex items-center justify-center transition-all cursor-pointer shadow-xs disabled:opacity-50",
|
|
83
|
+
title: "Replace image",
|
|
84
|
+
children: /* @__PURE__ */ jsx(UploadCloudIcon, { className: "size-3.5" })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
disabled: disabled || isUploading,
|
|
92
|
+
onClick: onRemove,
|
|
93
|
+
className: "size-8 rounded-lg bg-destructive hover:bg-destructive/90 text-white flex items-center justify-center transition-all cursor-pointer shadow-xs disabled:opacity-50",
|
|
94
|
+
title: "Remove image",
|
|
95
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
+
enablePreviewModal && /* @__PURE__ */ jsx(
|
|
100
|
+
Button,
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
variant: "outline",
|
|
104
|
+
size: "sm",
|
|
105
|
+
className: "border-white/40 bg-black/40 text-white hover:bg-black/60 hover:text-white backdrop-blur-xs",
|
|
106
|
+
onClick: onPreview,
|
|
107
|
+
leftIcon: /* @__PURE__ */ jsx(Eye, { className: "size-3.5" }),
|
|
108
|
+
children: "Preview"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
Button,
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
variant: "default",
|
|
116
|
+
size: "sm",
|
|
117
|
+
disabled: disabled || isUploading,
|
|
118
|
+
onClick: onReplace,
|
|
119
|
+
children: "Replace"
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
Button,
|
|
124
|
+
{
|
|
125
|
+
type: "button",
|
|
126
|
+
variant: "outline",
|
|
127
|
+
size: "sm",
|
|
128
|
+
disabled: disabled || isUploading,
|
|
129
|
+
className: "border-destructive/60 bg-destructive/80 text-white hover:bg-destructive hover:text-white",
|
|
130
|
+
onClick: onRemove,
|
|
131
|
+
leftIcon: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }),
|
|
132
|
+
children: "Remove"
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] }) })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
ImageUploadSinglePreview.displayName = "ImageUploadSinglePreview";
|
|
141
|
+
|
|
142
|
+
export { ImageUploadSinglePreview };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ImageUploadItem } from '../ImageUpload.types';
|
|
3
|
+
export interface ImageUploadThumbnailCardProps {
|
|
4
|
+
item: ImageUploadItem;
|
|
5
|
+
index: number;
|
|
6
|
+
layout?: 'grid' | 'scroll';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
enablePreviewModal?: boolean;
|
|
9
|
+
shouldAnimate?: boolean;
|
|
10
|
+
onPreview: (e: React.MouseEvent) => void;
|
|
11
|
+
onRemove: (e: React.MouseEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ImageUploadThumbnailCard: React.FC<ImageUploadThumbnailCardProps>;
|
|
14
|
+
export interface ImageUploadTaskCardProps {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
previewUrl: string;
|
|
18
|
+
isVideo: boolean;
|
|
19
|
+
layout?: 'grid' | 'scroll';
|
|
20
|
+
shouldAnimate?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const ImageUploadTaskCard: React.FC<ImageUploadTaskCardProps>;
|
|
23
|
+
//# sourceMappingURL=ImageUploadThumbnailCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageUploadThumbnailCard.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/subcomponents/ImageUploadThumbnailCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAwF5E,CAAC;AAIF,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA4ClE,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { cn } from '@timmbr/utils';
|
|
4
|
+
import { Eye, Trash2 } from '@timmbr/icons';
|
|
5
|
+
import { motion, scaleVariants, getTransition } from '@timmbr/motion';
|
|
6
|
+
import { thumbnailCardVariants } from '../ImageUpload.styles.js';
|
|
7
|
+
import { PlayIcon } from './ImageUploadIcons.js';
|
|
8
|
+
import { isVideoMedia } from '../ImageUpload.helpers.js';
|
|
9
|
+
import { Spinner } from '../../Spinner/Spinner.js';
|
|
10
|
+
|
|
11
|
+
const ImageUploadThumbnailCard = ({
|
|
12
|
+
item,
|
|
13
|
+
index,
|
|
14
|
+
layout = "grid",
|
|
15
|
+
disabled = false,
|
|
16
|
+
enablePreviewModal = true,
|
|
17
|
+
shouldAnimate = true,
|
|
18
|
+
onPreview,
|
|
19
|
+
onRemove
|
|
20
|
+
}) => {
|
|
21
|
+
const isVideo = isVideoMedia(item);
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
motion.div,
|
|
24
|
+
{
|
|
25
|
+
layout: shouldAnimate,
|
|
26
|
+
initial: shouldAnimate ? "hidden" : false,
|
|
27
|
+
animate: shouldAnimate ? "visible" : void 0,
|
|
28
|
+
exit: shouldAnimate ? "exit" : void 0,
|
|
29
|
+
variants: shouldAnimate ? scaleVariants : void 0,
|
|
30
|
+
transition: getTransition("spring"),
|
|
31
|
+
className: cn(
|
|
32
|
+
thumbnailCardVariants({ aspectRatio: "square" }),
|
|
33
|
+
layout === "scroll" && "shrink-0 w-36 sm:w-40 snap-start"
|
|
34
|
+
),
|
|
35
|
+
children: [
|
|
36
|
+
isVideo ? /* @__PURE__ */ jsx(
|
|
37
|
+
"video",
|
|
38
|
+
{
|
|
39
|
+
src: item.url,
|
|
40
|
+
className: "w-full h-full object-cover",
|
|
41
|
+
muted: true,
|
|
42
|
+
playsInline: true,
|
|
43
|
+
preload: "metadata"
|
|
44
|
+
}
|
|
45
|
+
) : /* @__PURE__ */ jsx(
|
|
46
|
+
"img",
|
|
47
|
+
{
|
|
48
|
+
src: item.url,
|
|
49
|
+
alt: item.name || `Media #${index + 1}`,
|
|
50
|
+
className: "w-full h-full object-cover"
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1.5 pointer-events-none", children: index === 0 ? /* @__PURE__ */ jsxs("div", { className: "bg-black/65 backdrop-blur-md text-white text-[10px] font-semibold px-2 py-0.5 rounded-full border border-white/20 shadow-md flex items-center gap-1.5", children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.8)]" }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { children: "Cover" })
|
|
56
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "bg-black/55 backdrop-blur-md text-white/90 text-[10px] font-medium px-2 py-0.5 rounded-full border border-white/10 shadow-sm", children: [
|
|
57
|
+
"#",
|
|
58
|
+
index + 1
|
|
59
|
+
] }) }),
|
|
60
|
+
isVideo && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 z-10 bg-black/65 backdrop-blur-md text-white p-1 rounded-full border border-white/20 shadow-md pointer-events-none", children: /* @__PURE__ */ jsx(PlayIcon, { className: "size-2.5" }) }),
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute inset-0 bg-black/55 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2 backdrop-blur-[2px] z-20", children: [
|
|
62
|
+
enablePreviewModal && /* @__PURE__ */ jsx(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
type: "button",
|
|
66
|
+
onClick: onPreview,
|
|
67
|
+
className: "size-8 rounded-full bg-white/25 hover:bg-white/40 text-white flex items-center justify-center transition-colors shadow-xs cursor-pointer",
|
|
68
|
+
title: "Preview full size",
|
|
69
|
+
children: /* @__PURE__ */ jsx(Eye, { className: "size-4" })
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
type: "button",
|
|
76
|
+
disabled,
|
|
77
|
+
onClick: onRemove,
|
|
78
|
+
className: "size-8 rounded-full bg-destructive/90 hover:bg-destructive text-white flex items-center justify-center transition-colors shadow-xs cursor-pointer",
|
|
79
|
+
title: "Remove item",
|
|
80
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] })
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
item.key || item.url || index
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
ImageUploadThumbnailCard.displayName = "ImageUploadThumbnailCard";
|
|
90
|
+
const ImageUploadTaskCard = ({
|
|
91
|
+
id,
|
|
92
|
+
name,
|
|
93
|
+
previewUrl,
|
|
94
|
+
isVideo,
|
|
95
|
+
layout = "grid",
|
|
96
|
+
shouldAnimate = true
|
|
97
|
+
}) => {
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
motion.div,
|
|
100
|
+
{
|
|
101
|
+
layout: shouldAnimate,
|
|
102
|
+
initial: shouldAnimate ? "hidden" : false,
|
|
103
|
+
animate: shouldAnimate ? "visible" : void 0,
|
|
104
|
+
exit: shouldAnimate ? "exit" : void 0,
|
|
105
|
+
variants: shouldAnimate ? scaleVariants : void 0,
|
|
106
|
+
transition: getTransition("fast"),
|
|
107
|
+
className: cn(
|
|
108
|
+
thumbnailCardVariants({ aspectRatio: "square" }),
|
|
109
|
+
"border-primary/50 bg-primary-50/20 dark:bg-primary-950/20",
|
|
110
|
+
layout === "scroll" && "shrink-0 w-36 sm:w-40 snap-start"
|
|
111
|
+
),
|
|
112
|
+
children: [
|
|
113
|
+
isVideo ? /* @__PURE__ */ jsx(
|
|
114
|
+
"video",
|
|
115
|
+
{
|
|
116
|
+
src: previewUrl,
|
|
117
|
+
className: "w-full h-full object-cover blur-xs scale-105 opacity-60",
|
|
118
|
+
muted: true
|
|
119
|
+
}
|
|
120
|
+
) : /* @__PURE__ */ jsx(
|
|
121
|
+
"img",
|
|
122
|
+
{
|
|
123
|
+
src: previewUrl,
|
|
124
|
+
alt: name,
|
|
125
|
+
className: "w-full h-full object-cover blur-xs scale-105 opacity-60"
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute inset-0 bg-black/50 flex flex-col items-center justify-center gap-1.5 p-2 text-center", children: [
|
|
129
|
+
/* @__PURE__ */ jsx(Spinner, { size: "sm", className: "text-white" }),
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-white line-clamp-1 max-w-full px-1", children: name })
|
|
131
|
+
] })
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
id
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
ImageUploadTaskCard.displayName = "ImageUploadTaskCard";
|
|
138
|
+
|
|
139
|
+
export { ImageUploadTaskCard, ImageUploadThumbnailCard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/subcomponents/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const inlineVariants: (props?: ({
|
|
3
|
-
align?: "center" | "
|
|
4
|
-
justify?: "center" | "
|
|
3
|
+
align?: "center" | "start" | "end" | "baseline" | null | undefined;
|
|
4
|
+
justify?: "center" | "start" | "end" | "between" | "around" | "evenly" | null | undefined;
|
|
5
5
|
wrap?: boolean | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export type InlineVariants = VariantProps<typeof inlineVariants>;
|
|
@@ -175,12 +175,12 @@ const Input = React.forwardRef(
|
|
|
175
175
|
{
|
|
176
176
|
id: `${id}-desc`,
|
|
177
177
|
className: cn(
|
|
178
|
-
"text-xs mt-
|
|
178
|
+
"text-xs mt-1 flex items-center gap-1.5 text-left",
|
|
179
179
|
isError ? "text-destructive font-medium" : "text-muted-foreground"
|
|
180
180
|
),
|
|
181
181
|
children: [
|
|
182
182
|
isError ? /* @__PURE__ */ jsx(AlertCircle, { className: "w-3.5 h-3.5 shrink-0 text-destructive", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Info, { className: "w-3.5 h-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
|
|
183
|
-
/* @__PURE__ */ jsx("span", { children: errorMessage || helperText })
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "leading-normal", children: errorMessage || helperText })
|
|
184
184
|
]
|
|
185
185
|
}
|
|
186
186
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const inputWrapperVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "filled" | "outline" | "subtle" | null | undefined;
|
|
4
4
|
size?: "default" | "sm" | "lg" | "md" | null | undefined;
|
|
5
5
|
isError?: boolean | null | undefined;
|
|
6
6
|
isDisabled?: boolean | null | undefined;
|
|
@@ -33,7 +33,7 @@ const inputWrapperVariants = cva(
|
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
35
|
const inputFieldVariants = cva(
|
|
36
|
-
"w-full h-full bg-transparent font-sans border-0 p-0 text-foreground placeholder:text-muted focus:outline-none focus:ring-0 focus-visible:outline-none disabled:cursor-not-allowed"
|
|
36
|
+
"w-full h-full bg-transparent font-sans border-0 p-0 text-foreground placeholder:text-muted focus:outline-none focus:ring-0 focus-visible:outline-none disabled:cursor-not-allowed [box-shadow:none] [&:-webkit-autofill]:[-webkit-background-clip:text] [&:-webkit-autofill]:[background-clip:text] [&:-webkit-autofill]:[-webkit-text-fill-color:currentColor] [&:-webkit-autofill]:[caret-color:currentColor] [&:-webkit-autofill]:[transition:background-color_5000000s_ease-in-out_0s] [&:-webkit-autofill]:[box-shadow:none] [&:autofill]:[-webkit-background-clip:text] [&:autofill]:[background-clip:text] [&:autofill]:[-webkit-text-fill-color:currentColor] [&:autofill]:[caret-color:currentColor] [&:autofill]:[transition:background-color_5000000s_ease-in-out_0s] [&:autofill]:[box-shadow:none]"
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
export { inputFieldVariants, inputWrapperVariants };
|
|
@@ -41,7 +41,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
41
41
|
/**
|
|
42
42
|
* HTML input type (text, password, email, number, search, tel, url, date, etc.).
|
|
43
43
|
*/
|
|
44
|
-
type?: 'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url' | 'date' | 'time' | (string &
|
|
44
|
+
type?: 'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url' | 'date' | 'time' | (string & Record<never, never>);
|
|
45
45
|
/**
|
|
46
46
|
* Whether to display an interactive show/hide password toggle button when type="password".
|
|
47
47
|
* Defaults to true.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.types.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EAC/D,aAAa;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EACD,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,KAAK,GACL,MAAM,GACN,MAAM,GACN,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Input.types.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EAC/D,aAAa;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EACD,MAAM,GACN,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,KAAK,GACL,MAAM,GACN,MAAM,GACN,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACpC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { LinkButtonProps } from './LinkButton.types';
|
|
3
|
+
/**
|
|
4
|
+
* LinkButton is a unified navigation component for internal, cross-zone, and external links.
|
|
5
|
+
*
|
|
6
|
+
* NAVIGATION RULES:
|
|
7
|
+
* 1. Internal same-zone navigation: Uses Next.js `next/link` by default for client-side SPA routing and prefetching.
|
|
8
|
+
* 2. Cross-zone boundary navigation: Uses native HTML `<a>` navigation when `crossZone={true}` or when `zone` points
|
|
9
|
+
* to an external zone. NEVER use `next/link` across zone boundaries.
|
|
10
|
+
* 3. Default variant: Styled as a link by default, with button visual styling available via variant props.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LinkButton: React.ForwardRefExoticComponent<LinkButtonProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
13
|
+
//# sourceMappingURL=LinkButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkButton.d.ts","sourceRoot":"","sources":["../../../src/components/LinkButton/LinkButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,2FAyMtB,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import NextLink from 'next/link';
|
|
5
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
6
|
+
import { cn } from '@timmbr/utils';
|
|
7
|
+
import { SpinnerIcon } from '@timmbr/icons';
|
|
8
|
+
import { resolveMotion } from '../../types/motion.js';
|
|
9
|
+
import { linkButtonVariants } from './LinkButton.styles.js';
|
|
10
|
+
import { useTimmbrConfig, resolveZoneHref } from '../../providers/TimmbrConfigProvider.js';
|
|
11
|
+
import { useGlobalAnimation } from '../../providers/AnimationProvider.js';
|
|
12
|
+
|
|
13
|
+
const LinkButton = React.forwardRef(
|
|
14
|
+
({
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
variant,
|
|
18
|
+
size,
|
|
19
|
+
asChild = false,
|
|
20
|
+
motion,
|
|
21
|
+
leftIcon,
|
|
22
|
+
rightIcon,
|
|
23
|
+
loading = false,
|
|
24
|
+
loadingText,
|
|
25
|
+
disabled = false,
|
|
26
|
+
href,
|
|
27
|
+
zone,
|
|
28
|
+
crossZone = false,
|
|
29
|
+
prefetch,
|
|
30
|
+
replace,
|
|
31
|
+
scroll,
|
|
32
|
+
target,
|
|
33
|
+
rel,
|
|
34
|
+
onClick,
|
|
35
|
+
children,
|
|
36
|
+
...props
|
|
37
|
+
}, ref) => {
|
|
38
|
+
const config = useTimmbrConfig();
|
|
39
|
+
const globalMotion = useGlobalAnimation();
|
|
40
|
+
const resolvedVariant = variant ?? config.components?.button?.defaultVariant ?? "default";
|
|
41
|
+
const resolvedSize = size ?? config.components?.button?.defaultSize ?? "default";
|
|
42
|
+
const { shouldAnimate, motionClass } = resolveMotion(motion, globalMotion);
|
|
43
|
+
const isDisabled = disabled || loading;
|
|
44
|
+
const resolvedHref = href ? resolveZoneHref(href, zone, config.zones?.zones) : void 0;
|
|
45
|
+
const handleClick = (e) => {
|
|
46
|
+
if (isDisabled) {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
onClick?.(e);
|
|
52
|
+
};
|
|
53
|
+
const buttonClassName = cn(
|
|
54
|
+
linkButtonVariants({
|
|
55
|
+
variant: resolvedVariant,
|
|
56
|
+
size: resolvedSize,
|
|
57
|
+
disabled: isDisabled,
|
|
58
|
+
className
|
|
59
|
+
}),
|
|
60
|
+
!shouldAnimate && "transition-none active:scale-100",
|
|
61
|
+
motionClass
|
|
62
|
+
);
|
|
63
|
+
if (asChild) {
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Slot,
|
|
66
|
+
{
|
|
67
|
+
ref,
|
|
68
|
+
className: buttonClassName,
|
|
69
|
+
style,
|
|
70
|
+
"data-slot": "link-button",
|
|
71
|
+
"aria-disabled": isDisabled ? "true" : void 0,
|
|
72
|
+
tabIndex: isDisabled ? -1 : props.tabIndex,
|
|
73
|
+
onClick: handleClick,
|
|
74
|
+
...props,
|
|
75
|
+
children
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const content = loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(SpinnerIcon, { size: resolvedSize === "sm" ? 14 : 18 }),
|
|
81
|
+
loadingText ? /* @__PURE__ */ jsx("span", { children: loadingText }) : children
|
|
82
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
|
+
leftIcon && /* @__PURE__ */ jsx(
|
|
84
|
+
"span",
|
|
85
|
+
{
|
|
86
|
+
className: "inline-flex shrink-0 items-center justify-center pointer-events-none",
|
|
87
|
+
"data-slot": "link-button-left-icon",
|
|
88
|
+
children: leftIcon
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
children && /* @__PURE__ */ jsx("span", { children }),
|
|
92
|
+
rightIcon && /* @__PURE__ */ jsx(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: "inline-flex shrink-0 items-center justify-center pointer-events-none",
|
|
96
|
+
"data-slot": "link-button-right-icon",
|
|
97
|
+
children: rightIcon
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] });
|
|
101
|
+
if (isDisabled) {
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
"a",
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
"data-slot": "link-button",
|
|
107
|
+
"data-testid": "timmbr-link-button",
|
|
108
|
+
"aria-disabled": "true",
|
|
109
|
+
tabIndex: -1,
|
|
110
|
+
style,
|
|
111
|
+
onClick: handleClick,
|
|
112
|
+
className: buttonClassName,
|
|
113
|
+
...props,
|
|
114
|
+
children: content
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
const isExternal = Boolean(resolvedHref) && (resolvedHref.startsWith("http://") || resolvedHref.startsWith("https://") || resolvedHref.startsWith("mailto:") || resolvedHref.startsWith("tel:") || target === "_blank");
|
|
119
|
+
const isDifferentZone = Boolean(zone) && Boolean(config.zones?.currentZone) && zone !== config.zones?.currentZone;
|
|
120
|
+
const requiresCrossZone = crossZone || isDifferentZone || Boolean(zone && !config.zones?.currentZone);
|
|
121
|
+
const resolvedRel = rel ?? (isExternal ? "noopener noreferrer" : void 0);
|
|
122
|
+
if (requiresCrossZone || isExternal) {
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
"a",
|
|
125
|
+
{
|
|
126
|
+
ref,
|
|
127
|
+
href: resolvedHref ?? "#",
|
|
128
|
+
target,
|
|
129
|
+
rel: resolvedRel,
|
|
130
|
+
"data-slot": "link-button",
|
|
131
|
+
"data-cross-zone": requiresCrossZone ? "true" : void 0,
|
|
132
|
+
"data-testid": "timmbr-link-button",
|
|
133
|
+
style,
|
|
134
|
+
onClick: handleClick,
|
|
135
|
+
className: buttonClassName,
|
|
136
|
+
...props,
|
|
137
|
+
children: content
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
if (resolvedHref) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
NextLink,
|
|
144
|
+
{
|
|
145
|
+
ref,
|
|
146
|
+
href: resolvedHref,
|
|
147
|
+
prefetch,
|
|
148
|
+
replace,
|
|
149
|
+
scroll,
|
|
150
|
+
target,
|
|
151
|
+
rel: resolvedRel,
|
|
152
|
+
"data-slot": "link-button",
|
|
153
|
+
"data-testid": "timmbr-link-button",
|
|
154
|
+
style,
|
|
155
|
+
onClick: handleClick,
|
|
156
|
+
className: buttonClassName,
|
|
157
|
+
...props,
|
|
158
|
+
children: content
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
return /* @__PURE__ */ jsx(
|
|
163
|
+
"a",
|
|
164
|
+
{
|
|
165
|
+
ref,
|
|
166
|
+
"data-slot": "link-button",
|
|
167
|
+
"data-testid": "timmbr-link-button",
|
|
168
|
+
style,
|
|
169
|
+
onClick: handleClick,
|
|
170
|
+
className: buttonClassName,
|
|
171
|
+
...props,
|
|
172
|
+
children: content
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
LinkButton.displayName = "LinkButton";
|
|
178
|
+
|
|
179
|
+
export { LinkButton };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const linkButtonVariants: (props?: ({
|
|
3
|
+
variant?: "link" | "default" | "destructive" | "outline" | "ghost" | "subtle" | "primary" | "secondary" | "muted" | null | undefined;
|
|
4
|
+
size?: "default" | "icon" | "sm" | "lg" | "md" | null | undefined;
|
|
5
|
+
disabled?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type LinkButtonVariants = VariantProps<typeof linkButtonVariants>;
|
|
8
|
+
//# sourceMappingURL=LinkButton.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkButton.styles.d.ts","sourceRoot":"","sources":["../../../src/components/LinkButton/LinkButton.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;8EAiE9B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
const linkButtonVariants = cva(
|
|
4
|
+
"inline-flex items-center justify-center font-sans transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 select-none no-underline",
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "text-primary underline-offset-4 hover:underline font-medium p-0 h-auto active:scale-100",
|
|
9
|
+
link: "text-primary underline-offset-4 hover:underline font-medium p-0 h-auto active:scale-100",
|
|
10
|
+
primary: "bg-primary text-white hover:bg-primary-600 hover:brightness-105 hover:shadow-md active:bg-primary-700 active:brightness-95 shadow-sm active:scale-[0.98] font-semibold whitespace-nowrap",
|
|
11
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-bg-subtle hover:brightness-105 active:bg-secondary-foreground/10 active:brightness-95 shadow-xs hover:shadow-sm active:scale-[0.98] font-semibold whitespace-nowrap",
|
|
12
|
+
outline: "border border-grey-300 dark:border-grey-700 bg-transparent text-foreground hover:bg-grey-100 dark:hover:bg-grey-900 active:bg-grey-200 dark:active:bg-grey-800 hover:border-grey-400 dark:hover:border-grey-600 active:scale-[0.98] font-semibold whitespace-nowrap",
|
|
13
|
+
ghost: "text-foreground hover:bg-grey-100 dark:hover:bg-grey-900 active:bg-grey-200 dark:active:bg-grey-800 active:scale-[0.98] font-semibold whitespace-nowrap",
|
|
14
|
+
destructive: "bg-destructive text-white hover:bg-red-700 hover:brightness-105 hover:shadow-md active:brightness-95 shadow-sm active:scale-[0.98] font-semibold whitespace-nowrap",
|
|
15
|
+
muted: "text-grey-600 dark:text-grey-400 hover:text-foreground underline-offset-4 hover:underline font-normal p-0 h-auto active:scale-100",
|
|
16
|
+
subtle: "text-foreground/80 hover:text-foreground underline-offset-4 hover:underline font-normal p-0 h-auto active:scale-100"
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
sm: "text-xs gap-1",
|
|
20
|
+
default: "text-sm gap-1.5",
|
|
21
|
+
md: "text-sm gap-1.5",
|
|
22
|
+
lg: "text-base gap-2",
|
|
23
|
+
icon: "p-1 shrink-0"
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
true: "pointer-events-none opacity-50 cursor-not-allowed",
|
|
27
|
+
false: "cursor-pointer"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
compoundVariants: [
|
|
31
|
+
// Button sizing variants when rendered with button appearance
|
|
32
|
+
{
|
|
33
|
+
variant: ["primary", "secondary", "outline", "ghost", "destructive"],
|
|
34
|
+
size: "sm",
|
|
35
|
+
className: "h-9 px-3 rounded-[2px] gap-2"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
variant: ["primary", "secondary", "outline", "ghost", "destructive"],
|
|
39
|
+
size: ["default", "md"],
|
|
40
|
+
className: "h-11 px-5 rounded-[2px] gap-2"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
variant: ["primary", "secondary", "outline", "ghost", "destructive"],
|
|
44
|
+
size: "lg",
|
|
45
|
+
className: "h-[52px] px-6 rounded-[2px] gap-2"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
variant: ["primary", "secondary", "outline", "ghost", "destructive"],
|
|
49
|
+
size: "icon",
|
|
50
|
+
className: "h-10 w-10 p-0 rounded-[2px]"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
variant: "default",
|
|
55
|
+
size: "default",
|
|
56
|
+
disabled: false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export { linkButtonVariants };
|