@thebasenet/ui 0.1.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/brand/index.d.mts +55 -0
- package/dist/brand/index.d.ts +55 -0
- package/dist/brand/index.js +152 -0
- package/dist/brand/index.js.map +1 -0
- package/dist/brand/index.mjs +152 -0
- package/dist/brand/index.mjs.map +1 -0
- package/dist/components/index.d.mts +122 -0
- package/dist/components/index.d.ts +122 -0
- package/dist/components/index.js +848 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +7956 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +2801 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +32365 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tokens/index.d.mts +190 -0
- package/dist/tokens/index.d.ts +190 -0
- package/dist/tokens/index.js +104 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/index.mjs +104 -0
- package/dist/tokens/index.mjs.map +1 -0
- package/dist/ui/index.d.mts +302 -0
- package/dist/ui/index.d.ts +302 -0
- package/dist/ui/index.js +2058 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/index.mjs +31585 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +11 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/cn.mjs +3197 -0
- package/dist/utils/cn.mjs.map +1 -0
- package/package.json +102 -0
- package/styles/animations.css +63 -0
- package/styles/globals.css +31 -0
- package/styles/theme.css +97 -0
- package/styles/variables.css +238 -0
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import Image from 'next/image';
|
|
6
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
7
|
+
import { Cancel01Icon } from '@hugeicons/core-free-icons';
|
|
8
|
+
import { HugeiconsIcon } from '@hugeicons/react';
|
|
9
|
+
import { Calendar, Sun1, Moon, User } from 'iconsax-react';
|
|
10
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
11
|
+
import { ChevronDown, Search, Check, XIcon } from 'lucide-react';
|
|
12
|
+
import { Drawer as Drawer$1 } from 'vaul';
|
|
13
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
14
|
+
import { cva } from 'class-variance-authority';
|
|
15
|
+
import { useTheme } from 'next-themes';
|
|
16
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
17
|
+
|
|
18
|
+
// src/utils/cn.ts
|
|
19
|
+
function cn(...inputs) {
|
|
20
|
+
return twMerge(clsx(inputs));
|
|
21
|
+
}
|
|
22
|
+
var Loader = ({
|
|
23
|
+
size = 25,
|
|
24
|
+
color = "#4cbc13",
|
|
25
|
+
variant = "primary",
|
|
26
|
+
className
|
|
27
|
+
}) => {
|
|
28
|
+
const borderColor = color ? `border-t-[#4cbc13]` : variant === "primary" ? "border-t-white border-green-700" : "border-t-green-500 border-neutral-300";
|
|
29
|
+
const style = {
|
|
30
|
+
width: typeof size === "number" ? `${size}px` : size,
|
|
31
|
+
height: typeof size === "number" ? `${size}px` : size
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: cn(
|
|
37
|
+
"z-40 border-3 rounded-full animate-spin block",
|
|
38
|
+
borderColor,
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
style
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
var BrandLogo = ({
|
|
46
|
+
width,
|
|
47
|
+
height,
|
|
48
|
+
link,
|
|
49
|
+
className
|
|
50
|
+
}) => {
|
|
51
|
+
return /* @__PURE__ */ jsx(Link, { className: `inline-block ${className ?? ""}`, href: link || "/", children: /* @__PURE__ */ jsxs(
|
|
52
|
+
"svg",
|
|
53
|
+
{
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
55
|
+
xmlSpace: "preserve",
|
|
56
|
+
width: width || "150",
|
|
57
|
+
height: height || "70",
|
|
58
|
+
style: {
|
|
59
|
+
shapeRendering: "geometricPrecision",
|
|
60
|
+
textRendering: "geometricPrecision",
|
|
61
|
+
fillRule: "evenodd",
|
|
62
|
+
clipRule: "evenodd"
|
|
63
|
+
},
|
|
64
|
+
viewBox: "0 0 4606.47 1711.22",
|
|
65
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
68
|
+
/* @__PURE__ */ jsxs(
|
|
69
|
+
"font",
|
|
70
|
+
{
|
|
71
|
+
id: "FontID0",
|
|
72
|
+
horizAdvX: 642,
|
|
73
|
+
fontVariant: "normal",
|
|
74
|
+
style: { fillRule: "nonzero" },
|
|
75
|
+
fontStyle: "normal",
|
|
76
|
+
fontWeight: 400,
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx("fontFace", { fontFamily: "Coolvetica Rg", children: /* @__PURE__ */ jsx("fontFaceSrc", { children: /* @__PURE__ */ jsx("fontFaceName", { name: "CoolveticaRg-Regular" }) }) }),
|
|
79
|
+
/* @__PURE__ */ jsx("missingGlyph", { children: /* @__PURE__ */ jsx("path", { d: "M0 0z" }) }),
|
|
80
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "C", horizAdvX: 612, d: "M469 228c-19.0006,-82.9999 -68.9996,-129.999 -150.999,-129.999 -108.001,0 -162.002,86.9997 -162.002,233.999 0,145 54.0005,234.001 169.001,234.001 66.0001,0 124.999,-45.0004 144,-120.001l138.999 0c-12.9999,134.001 -118,240.001 -284,240.001 -190.001,0 -308.999,-137 -308.999,-362.001 0,-228 132.999,-347 307,-347 153.999,0 258,99.9997 285.999,251l-138.999 0z" }),
|
|
81
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "N", horizAdvX: 590, d: "M563.999 0l0 664.001 -129.999 0 0 -427.001 -264 427.001 -146.999 0 0 -664.001 128.999 0 0 445.999 284.001 -445.999 127.999 0z" }),
|
|
82
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "T", horizAdvX: 554, d: "M342.999 0l0 548 201.003 0 0 115.999 -540 0 0 -115.999 199.998 0 0 -548 139 0z" }),
|
|
83
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "a", horizAdvX: 485, d: "M324 186.999c-1.00038,-57.9987 -50.9994,-106.999 -118,-106.999 -41.0006,0 -63.0006,18.0002 -63.0006,54.9992 0,42.001 24.0008,63.0006 98.0006,77.0009 47.9999,9.00009 71.0003,15.9994 84.0003,28.9994l-1.00038 -54.0005zm131 -186.999l0 311c0,124 -53.9988,194 -210,194 -158,0 -214,-71.0003 -216,-173.001l121.001 0c5.99894,44.0001 29.9997,73.0011 89.0005,73.0011 50.9994,0 82.9999,-19.0006 82.9999,-51.0011 0,-33.9996 -18.0002,-46.9995 -82.9999,-55.9996 -131.001,-18.0002 -226.001,-33.9996 -226.001,-176 0,-80.0004 51.9998,-135 164.001,-135 66.0001,0 118,23.0004 149,57 0.998709,-15.0007 3.99985,-32.0005 7.99971,-44.0001l120.999 0z" }),
|
|
84
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "c", horizAdvX: 480, d: "M338 177.999c-5.00023,-52.9985 -45.0004,-81.9995 -95.9998,-81.9995 -51.0011,0 -95.9998,51.9998 -95.9998,159 0,106.999 44.9988,141.999 99.9997,141.999 49.0003,0 85.9993,-29.9997 93.0003,-80.9991l131 0c-7.99971,116.001 -94.9994,189 -223,189 -138.001,0 -230.001,-77.0009 -230.001,-252.999 0,-176 92,-265.001 226.001,-265.001 118.999,0 211.999,76.9993 225.999,190.999l-131 0z" }),
|
|
85
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "e", horizAdvX: 502, d: "M149 294c5.00023,67.9992 47.9999,107.999 99.9997,107.999 51.0011,0 99.001,-35 101,-107.999l-201 0zm335.001 -81.9995c0,194.999 -80.0004,293 -231.001,293 -150.999,0 -237.999,-98.0006 -237.999,-250 0,-178.001 81.9995,-268 245.998,-268 105.002,0 186.001,57 216,158l-133.999 0c-9.00009,-33.9996 -46.0008,-55.0009 -88.0001,-55.0009 -64.001,0 -106,48.0016 -110,122.001l339 0z" }),
|
|
86
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "h", horizAdvX: 503, d: "M472 0l0 348.002c0,97.9983 -70.0022,156.998 -171.001,156.998 -66.0008,0 -126.001,-32.9987 -145,-77.0004l0 244 -129.999 0 0 -671.998 129.999 0 0 282.001c0,66.0008 35.9989,119.997 101.002,119.997 58.9992,0 83.9985,-22.9969 83.9985,-96.9971l0 -305.001 131 0z" }),
|
|
87
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "i", horizAdvX: 191, d: "M159 0l0 492 -130.001 0 0 -492 130.001 0zm0 550.999l0 121.001 -130.001 0 0 -121.001 130.001 0z" }),
|
|
88
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "l", horizAdvX: 185, d: "M155.999 0l0 672 -129.999 0 0 -672 129.999 0z" }),
|
|
89
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "r", horizAdvX: 321, d: "M155.999 0l0 256.001c0,79 39.0015,119 119,119 12.0012,0 24.0008,-1.00038 36.0003,-3.00114l0 133.001 -16.9998 0c-53.0001,0 -103.001,-6.00062 -146,-72.0007l0 59.0008 -122 0 0 -492 129.999 0z" }),
|
|
90
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "t", horizAdvX: 453, d: "M304.999 195.999c0,-60.9998 -23.9991,-95.9998 -75.9989,-95.9998 -53.0001,0 -75.0002,36.0003 -75.0002,98.0006l0 202 272 0 0 92 -272 0 0 133.001 -128 0 0 -440.001c0,-106 57,-198 201,-198 139.001,0 199.001,93.0003 199.001,197l0 140 -121.001 0 0 -128z" }),
|
|
91
|
+
/* @__PURE__ */ jsx("glyph", { unicode: "u", horizAdvX: 500, d: "M469 0l0 492 -129.001 0 0 -284c0,-65.0014 -35,-112.001 -100.998,-112.001 -55.0009,0 -83.0015,29.9997 -83.0015,92l0 304.001 -129.999 0 0 -324c0,-108.001 68.9996,-181 167,-181 67.9992,0 119,25.9999 153,81.9995l0 -68.9996 123 0z" })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx("style", { type: "text/css" })
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsx("style", { type: "text/css", children: `
|
|
98
|
+
@font-face { font-family:"Coolvetica";font-variant:normal;font-style:normal;font-weight:normal;src:url("#FontID0") format(svg)}
|
|
99
|
+
.fil1 {fill:#2F61C4}
|
|
100
|
+
.fil0 {fill:#3B3A3A}
|
|
101
|
+
.fil2 {fill:#4CBC13}
|
|
102
|
+
.fnt1 {font-weight:normal;font-size:431.52px;font-family:'Coolvetica'}
|
|
103
|
+
.fnt0 {font-weight:normal;font-size:872.5px;font-family:'Coolvetica'}
|
|
104
|
+
` }),
|
|
105
|
+
/* @__PURE__ */ jsxs("g", { id: "Layer_x0020_1", children: [
|
|
106
|
+
/* @__PURE__ */ jsx("metadata", { id: "CorelCorpID_0Corel-Layer" }),
|
|
107
|
+
/* @__PURE__ */ jsxs("g", { id: "_2066693523904", children: [
|
|
108
|
+
/* @__PURE__ */ jsxs("g", { children: [
|
|
109
|
+
/* @__PURE__ */ jsx("text", { x: 1937.5, y: 1009.24, className: "fil0 fnt0 ", children: "Circular " }),
|
|
110
|
+
/* @__PURE__ */ jsx("text", { x: 1937.49, y: 1689.88, className: "fil0 fnt0", children: "Net" }),
|
|
111
|
+
/* @__PURE__ */ jsx("text", { x: 1937.49, y: 299.99, className: "fil0 fnt1", children: "The " })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsx("path", { className: "fil1", d: "M126.14 0c69.68,0 126.15,56.47 126.15,126.15 0,69.67 -56.47,126.14 -126.15,126.14 -69.67,0 -126.14,-56.47 -126.14,-126.14 0,-69.68 56.47,-126.15 126.14,-126.15zm-64.12 764.65c-31.4,0 -56.86,-25.45 -56.86,-56.85l0 -235.52c0,-31.4 25.46,-56.86 56.86,-56.86 194.36,0 353.37,-159.02 353.37,-353.39l0 -0.03c0,-31.4 25.46,-56.85 56.86,-56.85l235.56 0c31.4,0 56.85,25.46 56.85,56.85 0,386.46 -316.19,702.64 -702.64,702.64z", fill: "#2F61C4" }),
|
|
114
|
+
/* @__PURE__ */ jsx("path", { className: "fil2", d: "M472.24 1706.08l235.58 0c31.4,0 56.84,-25.44 56.84,-56.84l0 -0.04c0,-386.45 -316.2,-702.66 -702.66,-702.66 -31.4,0 -56.84,25.46 -56.84,56.85l0 235.57c0,31.4 25.45,56.85 56.84,56.85l0.03 0c194.36,0 353.36,159.02 353.36,353.37l0 0.05c0,31.4 25.45,56.84 56.84,56.84zm-346.1 -247.14c69.68,0 126.15,56.47 126.15,126.15 0,69.67 -56.47,126.14 -126.15,126.14 -69.67,0 -126.14,-56.47 -126.14,-126.14 0,-69.68 56.47,-126.15 126.14,-126.15z", fill: "#2ABC13" }),
|
|
115
|
+
/* @__PURE__ */ jsx("path", { className: "fil1", d: "M1295.81 1649.2c0,-194.36 159.03,-353.39 353.39,-353.39 31.4,0 56.84,-25.45 56.84,-56.85l0 -235.57c0,-31.4 -25.44,-56.85 -56.84,-56.85l-0.03 0c-386.44,0 -702.62,316.19 -702.62,702.63l0 0.06c0,31.4 25.44,56.84 56.84,56.84l235.58 0c31.39,0 56.84,-25.44 56.84,-56.84l0 -0.04zm289.26 -190.27c69.68,0 126.15,56.47 126.15,126.15 0,69.67 -56.47,126.14 -126.15,126.14 -69.67,0 -126.14,-56.47 -126.14,-126.14 0,-69.68 56.47,-126.15 126.14,-126.15z", fill: "#2F61C4" }),
|
|
116
|
+
/* @__PURE__ */ jsx("path", { className: "fil2", d: "M1649.19 415.43c-194.37,0 -353.38,-159.02 -353.38,-353.37l0 -0.05c0,-31.4 -25.45,-56.85 -56.86,-56.85l-235.54 0c-31.4,0 -56.86,25.46 -56.86,56.85 0,386.46 316.19,702.64 702.64,702.64 31.39,0 56.85,-25.45 56.85,-56.85l0 -235.51c0,-31.4 -25.46,-56.86 -56.85,-56.86zm-64.12 -415.43c69.68,0 126.15,56.47 126.15,126.15 0,69.67 -56.47,126.14 -126.15,126.14 -69.67,0 -126.14,-56.47 -126.14,-126.14 0,-69.68 56.47,-126.15 126.14,-126.15z", fill: "#2ABC13" })
|
|
117
|
+
] })
|
|
118
|
+
] })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
) });
|
|
122
|
+
};
|
|
123
|
+
var BrandLogo_default = BrandLogo;
|
|
124
|
+
function PageLoader({ message }) {
|
|
125
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-[100vh] w-full flex items-center justify-center bg-gray-100 dark:bg-gray-900", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center space-y-2.5", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(BrandLogo_default, { width: 110 }),
|
|
127
|
+
/* @__PURE__ */ jsx(Loader, { size: 32 }),
|
|
128
|
+
message && /* @__PURE__ */ jsx("p", { className: "text-base max-w-lg text-gray-600 dark:text-gray-300", children: message })
|
|
129
|
+
] }) });
|
|
130
|
+
}
|
|
131
|
+
var Heading1 = React.forwardRef(
|
|
132
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h1", { className: cn("text-3xl font-[700] font-onest text-black dark:text-white", className), ref, ...props, children })
|
|
133
|
+
);
|
|
134
|
+
Heading1.displayName = "Heading1";
|
|
135
|
+
var Heading2 = React.forwardRef(
|
|
136
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h2", { className: cn("text-[26px] font-[600] font-onest text-black dark:text-neutral-100", className), ref, ...props, children })
|
|
137
|
+
);
|
|
138
|
+
Heading2.displayName = "Heading2";
|
|
139
|
+
var Heading3 = React.forwardRef(
|
|
140
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h3", { className: cn("text-2xl font-semibold font-onest text-neutral-900 dark:text-neutral-200", className), ref, ...props, children })
|
|
141
|
+
);
|
|
142
|
+
Heading3.displayName = "Heading3";
|
|
143
|
+
var Heading4 = React.forwardRef(
|
|
144
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h4", { className: cn("text-[22px] font-semibold text-neutral-800 dark:text-neutral-200", className), ref, ...props, children })
|
|
145
|
+
);
|
|
146
|
+
Heading4.displayName = "Heading4";
|
|
147
|
+
var Heading5 = React.forwardRef(
|
|
148
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h5", { className: cn("text-lg font-semibold text-black dark:text-neutral-300", className), ref, ...props, children })
|
|
149
|
+
);
|
|
150
|
+
Heading5.displayName = "Heading5";
|
|
151
|
+
var Heading6 = React.forwardRef(
|
|
152
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("h6", { className: cn("text-base font-[500] text-black dark:text-neutral-300", className), ref, ...props, children })
|
|
153
|
+
);
|
|
154
|
+
Heading6.displayName = "Heading6";
|
|
155
|
+
var Body1 = React.forwardRef(
|
|
156
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("p", { className: cn("text-[18px] text-neutral-700 dark:text-neutral-400 font-golos", className), ref, ...props, children })
|
|
157
|
+
);
|
|
158
|
+
Body1.displayName = "Body1";
|
|
159
|
+
var Body2 = React.forwardRef(
|
|
160
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("p", { className: cn("text-base text-neutral-700 dark:text-neutral-400 font-golos", className), ref, ...props, children })
|
|
161
|
+
);
|
|
162
|
+
Body2.displayName = "Body2";
|
|
163
|
+
var Body3 = React.forwardRef(
|
|
164
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("p", { className: cn("text-sm lg:leading-[22px] text-neutral-600 dark:text-neutral-400 font-golos", className), ref, ...props, children })
|
|
165
|
+
);
|
|
166
|
+
Body3.displayName = "Body3";
|
|
167
|
+
var EmptyState = ({
|
|
168
|
+
imageSrc,
|
|
169
|
+
size = 200,
|
|
170
|
+
title = "No Data Found!",
|
|
171
|
+
message = "Check back later to see more content.",
|
|
172
|
+
component,
|
|
173
|
+
className = "min-h-[60vh]",
|
|
174
|
+
icon
|
|
175
|
+
}) => {
|
|
176
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
177
|
+
icon && /* @__PURE__ */ jsx("div", { className: "mb-4", children: icon }),
|
|
178
|
+
imageSrc && /* @__PURE__ */ jsx(
|
|
179
|
+
Image,
|
|
180
|
+
{
|
|
181
|
+
src: imageSrc,
|
|
182
|
+
alt: "Empty State",
|
|
183
|
+
width: size,
|
|
184
|
+
height: size,
|
|
185
|
+
className: "mx-auto mb-4"
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
/* @__PURE__ */ jsx("h1", { className: "text-[1.325rem] md:text-[1.45rem] text-black font-onest font-semibold", children: title }),
|
|
189
|
+
/* @__PURE__ */ jsx(Body2, { className: "max-w-xs text-[#646464]", children: message }),
|
|
190
|
+
component && /* @__PURE__ */ jsx("div", { className: "mt-2.5", children: component })
|
|
191
|
+
] }) });
|
|
192
|
+
};
|
|
193
|
+
function Skeleton({ className, ...props }) {
|
|
194
|
+
return /* @__PURE__ */ jsx(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
"data-slot": "skeleton",
|
|
198
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
199
|
+
...props
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
var LoadingState = ({
|
|
204
|
+
rows = 5,
|
|
205
|
+
showAvatar = false,
|
|
206
|
+
className,
|
|
207
|
+
rowClassName
|
|
208
|
+
}) => {
|
|
209
|
+
return /* @__PURE__ */ jsx(
|
|
210
|
+
"div",
|
|
211
|
+
{
|
|
212
|
+
className: cn("min-h-[60vh] flex items-center justify-center", className),
|
|
213
|
+
children: /* @__PURE__ */ jsx("div", { className: "w-full max-w-md space-y-3 px-4", children: Array.from({ length: rows }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", rowClassName), children: [
|
|
214
|
+
showAvatar && /* @__PURE__ */ jsx(Skeleton, { className: "size-10 shrink-0 rounded-full" }),
|
|
215
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
|
|
216
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4 rounded" }),
|
|
217
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-1/2 rounded" })
|
|
218
|
+
] })
|
|
219
|
+
] }, i)) })
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
var ErrorState = ({
|
|
224
|
+
title = "Error Fetching Data",
|
|
225
|
+
message = "An error occurred",
|
|
226
|
+
onRetry
|
|
227
|
+
}) => {
|
|
228
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-[60vh] flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
229
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[1.45rem] font-onest font-[600] text-primary-500", children: title }),
|
|
230
|
+
/* @__PURE__ */ jsx("p", { className: "text-[#646464] font-golosText font-[500] text-[.9rem] line-clamp-3", children: message }),
|
|
231
|
+
onRetry && /* @__PURE__ */ jsx(
|
|
232
|
+
"button",
|
|
233
|
+
{
|
|
234
|
+
onClick: onRetry,
|
|
235
|
+
className: "rounded-md h-[2.75rem] min-w-[7rem] px-6 bg-primary-500 text-white text-[.9rem] font-onest font-[600] mt-5",
|
|
236
|
+
children: "Refetch"
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
] }) });
|
|
240
|
+
};
|
|
241
|
+
function Dialog({ ...props }) {
|
|
242
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
243
|
+
}
|
|
244
|
+
function DialogTrigger({ ...props }) {
|
|
245
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
246
|
+
}
|
|
247
|
+
function DialogPortal({ ...props }) {
|
|
248
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
249
|
+
}
|
|
250
|
+
function DialogOverlay({
|
|
251
|
+
className,
|
|
252
|
+
...props
|
|
253
|
+
}) {
|
|
254
|
+
return /* @__PURE__ */ jsx(
|
|
255
|
+
DialogPrimitive.Overlay,
|
|
256
|
+
{
|
|
257
|
+
"data-slot": "dialog-overlay",
|
|
258
|
+
className: cn(
|
|
259
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
260
|
+
className
|
|
261
|
+
),
|
|
262
|
+
...props
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function DialogContent({
|
|
267
|
+
className,
|
|
268
|
+
children,
|
|
269
|
+
showCloseButton = true,
|
|
270
|
+
...props
|
|
271
|
+
}) {
|
|
272
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
273
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
274
|
+
/* @__PURE__ */ jsxs(
|
|
275
|
+
DialogPrimitive.Content,
|
|
276
|
+
{
|
|
277
|
+
"data-slot": "dialog-content",
|
|
278
|
+
className: cn(
|
|
279
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
280
|
+
className
|
|
281
|
+
),
|
|
282
|
+
...props,
|
|
283
|
+
children: [
|
|
284
|
+
children,
|
|
285
|
+
showCloseButton && /* @__PURE__ */ jsxs(
|
|
286
|
+
DialogPrimitive.Close,
|
|
287
|
+
{
|
|
288
|
+
"data-slot": "dialog-close",
|
|
289
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsx(XIcon, {}),
|
|
292
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
] });
|
|
300
|
+
}
|
|
301
|
+
function DialogHeader({ className, ...props }) {
|
|
302
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props });
|
|
303
|
+
}
|
|
304
|
+
function DialogTitle({ className, ...props }) {
|
|
305
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className), ...props });
|
|
306
|
+
}
|
|
307
|
+
function DialogDescription({ className, ...props }) {
|
|
308
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-muted-foreground text-sm", className), ...props });
|
|
309
|
+
}
|
|
310
|
+
function Drawer({ ...props }) {
|
|
311
|
+
return /* @__PURE__ */ jsx(Drawer$1.Root, { "data-slot": "drawer", ...props });
|
|
312
|
+
}
|
|
313
|
+
function DrawerTrigger({ ...props }) {
|
|
314
|
+
return /* @__PURE__ */ jsx(Drawer$1.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
315
|
+
}
|
|
316
|
+
function DrawerPortal({ ...props }) {
|
|
317
|
+
return /* @__PURE__ */ jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
|
|
318
|
+
}
|
|
319
|
+
function DrawerClose({ ...props }) {
|
|
320
|
+
return /* @__PURE__ */ jsx(Drawer$1.Close, { "data-slot": "drawer-close", ...props });
|
|
321
|
+
}
|
|
322
|
+
function DrawerOverlay({ className, ...props }) {
|
|
323
|
+
return /* @__PURE__ */ jsx(
|
|
324
|
+
Drawer$1.Overlay,
|
|
325
|
+
{
|
|
326
|
+
"data-slot": "drawer-overlay",
|
|
327
|
+
className: cn(
|
|
328
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
329
|
+
className
|
|
330
|
+
),
|
|
331
|
+
...props
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
function DrawerContent({ className, children, ...props }) {
|
|
336
|
+
return /* @__PURE__ */ jsxs(DrawerPortal, { "data-slot": "drawer-portal", children: [
|
|
337
|
+
/* @__PURE__ */ jsx(DrawerOverlay, {}),
|
|
338
|
+
/* @__PURE__ */ jsxs(
|
|
339
|
+
Drawer$1.Content,
|
|
340
|
+
{
|
|
341
|
+
"data-slot": "drawer-content",
|
|
342
|
+
className: cn(
|
|
343
|
+
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
344
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
345
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg",
|
|
346
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
347
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
348
|
+
className
|
|
349
|
+
),
|
|
350
|
+
...props,
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsx("div", { className: "bg-muted mx-auto my-2.5 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
|
|
353
|
+
children
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
] });
|
|
358
|
+
}
|
|
359
|
+
function DrawerHeader({ className, ...props }) {
|
|
360
|
+
return /* @__PURE__ */ jsx(
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
"data-slot": "drawer-header",
|
|
364
|
+
className: cn(
|
|
365
|
+
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
366
|
+
className
|
|
367
|
+
),
|
|
368
|
+
...props
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function DrawerTitle({ className, ...props }) {
|
|
373
|
+
return /* @__PURE__ */ jsx(Drawer$1.Title, { "data-slot": "drawer-title", className: cn("text-foreground font-semibold", className), ...props });
|
|
374
|
+
}
|
|
375
|
+
function DrawerDescription({ className, ...props }) {
|
|
376
|
+
return /* @__PURE__ */ jsx(Drawer$1.Description, { "data-slot": "drawer-description", className: cn("text-muted-foreground text-sm", className), ...props });
|
|
377
|
+
}
|
|
378
|
+
var MOBILE_BREAKPOINT = 768;
|
|
379
|
+
function useIsMobile() {
|
|
380
|
+
const [isMobile, setIsMobile] = useState(void 0);
|
|
381
|
+
useEffect(() => {
|
|
382
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
383
|
+
const onChange = () => setIsMobile(mql.matches);
|
|
384
|
+
mql.addEventListener("change", onChange);
|
|
385
|
+
setIsMobile(mql.matches);
|
|
386
|
+
return () => mql.removeEventListener("change", onChange);
|
|
387
|
+
}, []);
|
|
388
|
+
return !!isMobile;
|
|
389
|
+
}
|
|
390
|
+
var CustomModal = ({
|
|
391
|
+
title,
|
|
392
|
+
children,
|
|
393
|
+
description,
|
|
394
|
+
trigger,
|
|
395
|
+
triggerAsChild = false,
|
|
396
|
+
open,
|
|
397
|
+
onOpenChange,
|
|
398
|
+
className,
|
|
399
|
+
contentClassName,
|
|
400
|
+
showModalHeader = true,
|
|
401
|
+
showModalDescription = false,
|
|
402
|
+
customIcon,
|
|
403
|
+
footer
|
|
404
|
+
}) => {
|
|
405
|
+
const isMobile = useIsMobile();
|
|
406
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
407
|
+
const isControlled = open !== void 0;
|
|
408
|
+
const dialogOpen = isControlled ? open : internalOpen;
|
|
409
|
+
const closeModal = () => {
|
|
410
|
+
if (isControlled) {
|
|
411
|
+
onOpenChange?.(false);
|
|
412
|
+
} else {
|
|
413
|
+
setInternalOpen(false);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
const handleOpenChange = (newOpen) => {
|
|
417
|
+
if (isControlled) {
|
|
418
|
+
onOpenChange?.(newOpen);
|
|
419
|
+
} else {
|
|
420
|
+
setInternalOpen(newOpen);
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
if (isMobile) {
|
|
424
|
+
return /* @__PURE__ */ jsxs(Drawer, { open: dialogOpen, onOpenChange: handleOpenChange, children: [
|
|
425
|
+
trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: triggerAsChild, children: trigger }),
|
|
426
|
+
/* @__PURE__ */ jsxs(
|
|
427
|
+
DrawerContent,
|
|
428
|
+
{
|
|
429
|
+
className: cn(
|
|
430
|
+
"w-full max-h-[95vh] overflow-hidden rounded-t-xl px-0 pb-6 space-y-4",
|
|
431
|
+
className
|
|
432
|
+
),
|
|
433
|
+
children: [
|
|
434
|
+
showModalHeader ? /* @__PURE__ */ jsxs(DrawerHeader, { className: "flex flex-row items-center justify-between px-4 py-0 md:px-8", children: [
|
|
435
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
436
|
+
/* @__PURE__ */ jsx("div", { className: "size-11 shrink-0 rounded-full bg-primary-50 flex items-center justify-center", children: customIcon ? customIcon : /* @__PURE__ */ jsx(
|
|
437
|
+
Calendar,
|
|
438
|
+
{
|
|
439
|
+
size: 20,
|
|
440
|
+
color: "currentColor",
|
|
441
|
+
className: "text-primary-600"
|
|
442
|
+
}
|
|
443
|
+
) }),
|
|
444
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
445
|
+
/* @__PURE__ */ jsx(DrawerTitle, { className: "text-[20px] font-semibold text-primary-600 font-onest line-clamp-1", children: title }),
|
|
446
|
+
/* @__PURE__ */ jsx(
|
|
447
|
+
DrawerDescription,
|
|
448
|
+
{
|
|
449
|
+
className: showModalDescription ? "-mt-0.5 text-left" : "hidden",
|
|
450
|
+
children: description || "Modal description"
|
|
451
|
+
}
|
|
452
|
+
)
|
|
453
|
+
] })
|
|
454
|
+
] }),
|
|
455
|
+
/* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsx("button", { className: "size-10 shrink-0 rounded-full text-neutral-400 hover:bg-primary-50 hover:text-primary-600 transition-colors cursor-pointer flex items-center justify-center outline-none", children: /* @__PURE__ */ jsx(
|
|
456
|
+
HugeiconsIcon,
|
|
457
|
+
{
|
|
458
|
+
icon: Cancel01Icon,
|
|
459
|
+
color: "currentColor",
|
|
460
|
+
size: 20
|
|
461
|
+
}
|
|
462
|
+
) }) })
|
|
463
|
+
] }) : /* @__PURE__ */ jsx(DrawerTitle, { className: "hidden", children: title }),
|
|
464
|
+
typeof children === "function" ? children(closeModal) : /* @__PURE__ */ jsx(
|
|
465
|
+
"div",
|
|
466
|
+
{
|
|
467
|
+
className: cn(
|
|
468
|
+
"max-h-[70vh] overflow-y-auto px-4 md:px-8 pb-4 no-scrollbar",
|
|
469
|
+
contentClassName
|
|
470
|
+
),
|
|
471
|
+
children
|
|
472
|
+
}
|
|
473
|
+
),
|
|
474
|
+
footer
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
] });
|
|
479
|
+
}
|
|
480
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: dialogOpen, onOpenChange: handleOpenChange, children: [
|
|
481
|
+
trigger && /* @__PURE__ */ jsx(DialogTrigger, { asChild: triggerAsChild, children: trigger }),
|
|
482
|
+
/* @__PURE__ */ jsxs(
|
|
483
|
+
DialogContent,
|
|
484
|
+
{
|
|
485
|
+
className: cn(
|
|
486
|
+
"w-full max-w-2xl min-h-64 max-h-[80vh] overflow-hidden rounded-xl px-0",
|
|
487
|
+
className
|
|
488
|
+
),
|
|
489
|
+
showCloseButton: false,
|
|
490
|
+
children: [
|
|
491
|
+
showModalHeader ? /* @__PURE__ */ jsxs(DialogHeader, { className: "flex flex-row items-center justify-between px-4 md:px-8 h-14", children: [
|
|
492
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
493
|
+
/* @__PURE__ */ jsx("div", { className: "size-12 rounded-full bg-primary-50 flex items-center justify-center", children: customIcon ? customIcon : /* @__PURE__ */ jsx(
|
|
494
|
+
Calendar,
|
|
495
|
+
{
|
|
496
|
+
size: 26,
|
|
497
|
+
color: "currentColor",
|
|
498
|
+
className: "text-primary-600"
|
|
499
|
+
}
|
|
500
|
+
) }),
|
|
501
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
502
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-[22px] font-semibold text-primary-600 font-onest line-clamp-1", children: title }),
|
|
503
|
+
/* @__PURE__ */ jsx(
|
|
504
|
+
DialogDescription,
|
|
505
|
+
{
|
|
506
|
+
className: showModalDescription ? "-mt-0.5 text-left" : "hidden",
|
|
507
|
+
children: description || "Modal description"
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
] })
|
|
511
|
+
] }),
|
|
512
|
+
/* @__PURE__ */ jsx(
|
|
513
|
+
"button",
|
|
514
|
+
{
|
|
515
|
+
onClick: closeModal,
|
|
516
|
+
className: "size-10 rounded-full text-neutral-400 hover:bg-primary-50 hover:text-primary-600 transition-colors cursor-pointer flex items-center justify-center outline-none",
|
|
517
|
+
children: /* @__PURE__ */ jsx(
|
|
518
|
+
HugeiconsIcon,
|
|
519
|
+
{
|
|
520
|
+
icon: Cancel01Icon,
|
|
521
|
+
color: "currentColor",
|
|
522
|
+
size: 20
|
|
523
|
+
}
|
|
524
|
+
)
|
|
525
|
+
}
|
|
526
|
+
)
|
|
527
|
+
] }) : /* @__PURE__ */ jsx(DialogTitle, { className: "hidden", children: title }),
|
|
528
|
+
typeof children === "function" ? children(closeModal) : /* @__PURE__ */ jsx(
|
|
529
|
+
"div",
|
|
530
|
+
{
|
|
531
|
+
className: cn(
|
|
532
|
+
"max-h-[70vh] overflow-y-auto px-4 md:px-8 pb-4 no-scrollbar",
|
|
533
|
+
contentClassName
|
|
534
|
+
),
|
|
535
|
+
children
|
|
536
|
+
}
|
|
537
|
+
),
|
|
538
|
+
footer
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
)
|
|
542
|
+
] });
|
|
543
|
+
};
|
|
544
|
+
var buttonVariants = cva(
|
|
545
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-90 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
|
|
546
|
+
{
|
|
547
|
+
variants: {
|
|
548
|
+
variant: {
|
|
549
|
+
default: "bg-primary-500 text-primary-foreground shadow-xs hover:bg-primary-700",
|
|
550
|
+
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
551
|
+
outline: "border border-primary-500 text-primary-500 bg-background shadow-xs hover:bg-primary-50/50 dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
552
|
+
secondary: "bg-primary-50 text-primary-500 shadow-xs hover:bg-secondary/80",
|
|
553
|
+
ghost: "hover:bg-primary-50/50 text-primary-500",
|
|
554
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
555
|
+
},
|
|
556
|
+
size: {
|
|
557
|
+
default: "h-12 px-4 py-2 has-[>svg]:px-3",
|
|
558
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
559
|
+
lg: "h-12 rounded-md px-6 has-[>svg]:px-4",
|
|
560
|
+
icon: "size-9"
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
defaultVariants: { variant: "default", size: "default" }
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
function Button({
|
|
567
|
+
className,
|
|
568
|
+
variant,
|
|
569
|
+
size,
|
|
570
|
+
asChild = false,
|
|
571
|
+
...props
|
|
572
|
+
}) {
|
|
573
|
+
const Comp = asChild ? Slot : "button";
|
|
574
|
+
return /* @__PURE__ */ jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props });
|
|
575
|
+
}
|
|
576
|
+
var BackButton = ({ onClick }) => {
|
|
577
|
+
return /* @__PURE__ */ jsx(
|
|
578
|
+
Button,
|
|
579
|
+
{
|
|
580
|
+
onClick: onClick || (() => window.history.back()),
|
|
581
|
+
variant: "default",
|
|
582
|
+
className: "text-[15px] font-medium font-onest min-w-[9rem] h-12",
|
|
583
|
+
children: "Go Back"
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
};
|
|
587
|
+
var ThemeSwitcher = ({
|
|
588
|
+
variant = "ghost",
|
|
589
|
+
size = "lg",
|
|
590
|
+
className = ""
|
|
591
|
+
}) => {
|
|
592
|
+
const { setTheme, resolvedTheme } = useTheme();
|
|
593
|
+
const [mounted, setMounted] = React.useState(false);
|
|
594
|
+
React.useEffect(() => {
|
|
595
|
+
setMounted(true);
|
|
596
|
+
}, []);
|
|
597
|
+
const toggleTheme = () => {
|
|
598
|
+
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
599
|
+
};
|
|
600
|
+
if (!mounted) {
|
|
601
|
+
return /* @__PURE__ */ jsx(Button, { variant, size, className, children: /* @__PURE__ */ jsx(Sun1, { size: 18 }) });
|
|
602
|
+
}
|
|
603
|
+
const isDark = resolvedTheme === "dark";
|
|
604
|
+
return /* @__PURE__ */ jsxs(
|
|
605
|
+
Button,
|
|
606
|
+
{
|
|
607
|
+
variant,
|
|
608
|
+
size,
|
|
609
|
+
className: `${className} relative`,
|
|
610
|
+
onClick: toggleTheme,
|
|
611
|
+
children: [
|
|
612
|
+
isDark ? /* @__PURE__ */ jsx(Sun1, { size: 24, color: "#4cbc13" }) : /* @__PURE__ */ jsx(Moon, { size: 24, color: "#4cbc13" }),
|
|
613
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
614
|
+
]
|
|
615
|
+
}
|
|
616
|
+
);
|
|
617
|
+
};
|
|
618
|
+
var ProfileImage = ({
|
|
619
|
+
asLink = false,
|
|
620
|
+
size = 40,
|
|
621
|
+
profilePicUrl,
|
|
622
|
+
isVerified = false,
|
|
623
|
+
isOnline = false,
|
|
624
|
+
isOverflowHidden = true,
|
|
625
|
+
className = "",
|
|
626
|
+
link,
|
|
627
|
+
userName = "User",
|
|
628
|
+
userId
|
|
629
|
+
}) => {
|
|
630
|
+
const ImageComponent = profilePicUrl ? /* @__PURE__ */ jsx(
|
|
631
|
+
Image,
|
|
632
|
+
{
|
|
633
|
+
src: profilePicUrl,
|
|
634
|
+
alt: userName,
|
|
635
|
+
fill: true,
|
|
636
|
+
priority: true,
|
|
637
|
+
sizes: `${size}px`,
|
|
638
|
+
className: "rounded-full object-cover h-full w-full"
|
|
639
|
+
}
|
|
640
|
+
) : /* @__PURE__ */ jsx(
|
|
641
|
+
User,
|
|
642
|
+
{
|
|
643
|
+
size: size ? size / 2 : 20,
|
|
644
|
+
color: "#4cbc13",
|
|
645
|
+
className: "text-gray-500"
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
const ProfileContent = /* @__PURE__ */ jsxs(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
className: "relative w-full h-full flex items-center justify-center",
|
|
652
|
+
style: { width: size, height: size },
|
|
653
|
+
children: [
|
|
654
|
+
ImageComponent,
|
|
655
|
+
isVerified && /* @__PURE__ */ jsx(
|
|
656
|
+
"div",
|
|
657
|
+
{
|
|
658
|
+
className: "absolute -top-0.5 -right-0.5 bg-primary-500 border-2 border-white rounded-full",
|
|
659
|
+
style: { width: 14, height: 14 }
|
|
660
|
+
}
|
|
661
|
+
),
|
|
662
|
+
isOnline && /* @__PURE__ */ jsx(
|
|
663
|
+
"div",
|
|
664
|
+
{
|
|
665
|
+
className: "absolute bottom-0 right-0 bg-green-500 border-2 border-white rounded-full",
|
|
666
|
+
style: {
|
|
667
|
+
width: size * 0.25,
|
|
668
|
+
height: size * 0.25,
|
|
669
|
+
minWidth: "10px",
|
|
670
|
+
minHeight: "10px"
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
return /* @__PURE__ */ jsx(
|
|
678
|
+
"div",
|
|
679
|
+
{
|
|
680
|
+
className: cn(
|
|
681
|
+
"relative rounded-full flex items-center justify-center",
|
|
682
|
+
profilePicUrl ? "bg-primary-50" : "bg-neutral-50",
|
|
683
|
+
isOverflowHidden && "overflow-hidden",
|
|
684
|
+
className
|
|
685
|
+
),
|
|
686
|
+
style: { height: size, width: size },
|
|
687
|
+
children: asLink ? /* @__PURE__ */ jsx(
|
|
688
|
+
Link,
|
|
689
|
+
{
|
|
690
|
+
href: link || (userId ? `/profile/${userId}` : "#"),
|
|
691
|
+
className: "block w-full h-full",
|
|
692
|
+
children: ProfileContent
|
|
693
|
+
}
|
|
694
|
+
) : /* @__PURE__ */ jsx("div", { children: ProfileContent })
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
};
|
|
698
|
+
function Input({ className, type, ...props }) {
|
|
699
|
+
return /* @__PURE__ */ jsx(
|
|
700
|
+
"input",
|
|
701
|
+
{
|
|
702
|
+
type,
|
|
703
|
+
"data-slot": "input",
|
|
704
|
+
className: cn(
|
|
705
|
+
"file:text-foreground placeholder:text-neutral-200/70 selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-neutral-100/60 flex h-12 w-full min-w-0 rounded-md border-[1px] bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none file:hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-base cursor-pointer font-golos",
|
|
706
|
+
"focus-visible:border-primary-600",
|
|
707
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
708
|
+
className
|
|
709
|
+
),
|
|
710
|
+
...props
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
function Label({
|
|
715
|
+
className,
|
|
716
|
+
...props
|
|
717
|
+
}) {
|
|
718
|
+
return /* @__PURE__ */ jsx(
|
|
719
|
+
LabelPrimitive.Root,
|
|
720
|
+
{
|
|
721
|
+
"data-slot": "label",
|
|
722
|
+
className: cn(
|
|
723
|
+
"flex items-center gap-2 text-[14px] leading-none font-normal font-onest text-neutral-400 pl-1 select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
724
|
+
className
|
|
725
|
+
),
|
|
726
|
+
...props
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
var CountrySelector = ({
|
|
731
|
+
countries: rawCountries,
|
|
732
|
+
value,
|
|
733
|
+
onChange,
|
|
734
|
+
setValue,
|
|
735
|
+
fieldName = "",
|
|
736
|
+
placeholder = "Select a country",
|
|
737
|
+
error,
|
|
738
|
+
label = "Country",
|
|
739
|
+
required = false,
|
|
740
|
+
disabled = false,
|
|
741
|
+
className = ""
|
|
742
|
+
}) => {
|
|
743
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
744
|
+
const [selectedCountry, setSelectedCountry] = useState(null);
|
|
745
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
746
|
+
const ref = useRef(null);
|
|
747
|
+
const countries = useMemo(() => {
|
|
748
|
+
const unique = rawCountries.filter(
|
|
749
|
+
(c, idx, self) => idx === self.findIndex((x) => x.countryCode === c.countryCode)
|
|
750
|
+
);
|
|
751
|
+
if (!searchTerm.trim()) return unique;
|
|
752
|
+
return unique.filter(
|
|
753
|
+
(c) => c.countryName.toLowerCase().includes(searchTerm.toLowerCase())
|
|
754
|
+
);
|
|
755
|
+
}, [rawCountries, searchTerm]);
|
|
756
|
+
useEffect(() => {
|
|
757
|
+
if (value) {
|
|
758
|
+
const found = countries.find((c) => c.countryCode === value);
|
|
759
|
+
setSelectedCountry(found || null);
|
|
760
|
+
}
|
|
761
|
+
}, [value, countries]);
|
|
762
|
+
useEffect(() => {
|
|
763
|
+
if (!isOpen) return;
|
|
764
|
+
const handleClickOutside = (e) => {
|
|
765
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
766
|
+
setIsOpen(false);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
const timer = setTimeout(() => {
|
|
770
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
771
|
+
}, 0);
|
|
772
|
+
return () => {
|
|
773
|
+
clearTimeout(timer);
|
|
774
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
775
|
+
};
|
|
776
|
+
}, [isOpen]);
|
|
777
|
+
const handleCountrySelect = (country) => {
|
|
778
|
+
setSelectedCountry(country);
|
|
779
|
+
if (setValue && fieldName) setValue(fieldName, country.countryCode);
|
|
780
|
+
onChange?.(country.countryCode);
|
|
781
|
+
setSearchTerm("");
|
|
782
|
+
setIsOpen(false);
|
|
783
|
+
};
|
|
784
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative w-full", className), ref, children: [
|
|
785
|
+
label && /* @__PURE__ */ jsxs(Label, { htmlFor: fieldName, className: "mb-2 block text-sm font-medium", children: [
|
|
786
|
+
label,
|
|
787
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-red-500 ml-1", children: "*" })
|
|
788
|
+
] }),
|
|
789
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
790
|
+
/* @__PURE__ */ jsxs(
|
|
791
|
+
Button,
|
|
792
|
+
{
|
|
793
|
+
type: "button",
|
|
794
|
+
variant: "outline",
|
|
795
|
+
role: "combobox",
|
|
796
|
+
"aria-expanded": isOpen,
|
|
797
|
+
disabled,
|
|
798
|
+
className: "w-full justify-between h-11 font-normal",
|
|
799
|
+
onClick: () => {
|
|
800
|
+
if (disabled) return;
|
|
801
|
+
setIsOpen((prev) => !prev);
|
|
802
|
+
if (isOpen) setSearchTerm("");
|
|
803
|
+
},
|
|
804
|
+
children: [
|
|
805
|
+
selectedCountry ? /* @__PURE__ */ jsx("span", { className: "truncate text-black", children: selectedCountry.flag ? `${selectedCountry.flag} ${selectedCountry.countryName}` : selectedCountry.countryName }) : /* @__PURE__ */ jsx("span", { className: "text-neutral-200/70", children: placeholder }),
|
|
806
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
isOpen && /* @__PURE__ */ jsxs("div", { className: "absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-md shadow-lg max-h-72 overflow-hidden", children: [
|
|
811
|
+
/* @__PURE__ */ jsxs("div", { className: "relative border-b", children: [
|
|
812
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }),
|
|
813
|
+
/* @__PURE__ */ jsx(
|
|
814
|
+
Input,
|
|
815
|
+
{
|
|
816
|
+
type: "text",
|
|
817
|
+
placeholder: "Search countries...",
|
|
818
|
+
value: searchTerm,
|
|
819
|
+
onChange: (e) => setSearchTerm(e.target.value),
|
|
820
|
+
className: "pl-10 h-11",
|
|
821
|
+
autoFocus: true
|
|
822
|
+
}
|
|
823
|
+
)
|
|
824
|
+
] }),
|
|
825
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-y-auto max-h-60", children: countries.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-6 text-center text-sm text-gray-500", children: "No countries found" }) : countries.map((country, index) => /* @__PURE__ */ jsxs(
|
|
826
|
+
"div",
|
|
827
|
+
{
|
|
828
|
+
className: "relative flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-gray-100 transition-colors",
|
|
829
|
+
onMouseDown: (e) => {
|
|
830
|
+
e.preventDefault();
|
|
831
|
+
handleCountrySelect(country);
|
|
832
|
+
},
|
|
833
|
+
children: [
|
|
834
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: country.flag ? `${country.flag} ${country.countryName}` : country.countryName }),
|
|
835
|
+
selectedCountry?.countryCode === country.countryCode && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-primary-500" })
|
|
836
|
+
]
|
|
837
|
+
},
|
|
838
|
+
`${country.countryCode}-${index}`
|
|
839
|
+
)) })
|
|
840
|
+
] })
|
|
841
|
+
] }),
|
|
842
|
+
error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-red-500", children: error })
|
|
843
|
+
] });
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
export { BackButton, CountrySelector, CustomModal, EmptyState, ErrorState, Loader, LoadingState, PageLoader, ProfileImage, ThemeSwitcher, useIsMobile };
|
|
847
|
+
//# sourceMappingURL=index.js.map
|
|
848
|
+
//# sourceMappingURL=index.js.map
|