@instockng/storefront-ui 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.
Files changed (152) hide show
  1. package/README.md +394 -0
  2. package/dist/components/CartItem.d.ts +15 -0
  3. package/dist/components/CartItem.d.ts.map +1 -0
  4. package/dist/components/Checkout.d.ts +39 -0
  5. package/dist/components/Checkout.d.ts.map +1 -0
  6. package/dist/components/DiscountCodeInput.d.ts +20 -0
  7. package/dist/components/DiscountCodeInput.d.ts.map +1 -0
  8. package/dist/components/OrderConfirmation.d.ts +30 -0
  9. package/dist/components/OrderConfirmation.d.ts.map +1 -0
  10. package/dist/components/ProductCard.d.ts +42 -0
  11. package/dist/components/ProductCard.d.ts.map +1 -0
  12. package/dist/components/ProductGrid.d.ts +33 -0
  13. package/dist/components/ProductGrid.d.ts.map +1 -0
  14. package/dist/components/ShoppingCart.d.ts +28 -0
  15. package/dist/components/ShoppingCart.d.ts.map +1 -0
  16. package/dist/components/ui/badge.d.ts +10 -0
  17. package/dist/components/ui/badge.d.ts.map +1 -0
  18. package/dist/components/ui/button.d.ts +12 -0
  19. package/dist/components/ui/button.d.ts.map +1 -0
  20. package/dist/components/ui/card.d.ts +9 -0
  21. package/dist/components/ui/card.d.ts.map +1 -0
  22. package/dist/components/ui/form-input.d.ts +20 -0
  23. package/dist/components/ui/form-input.d.ts.map +1 -0
  24. package/dist/components/ui/form-select.d.ts +18 -0
  25. package/dist/components/ui/form-select.d.ts.map +1 -0
  26. package/dist/components/ui/modal.d.ts +31 -0
  27. package/dist/components/ui/modal.d.ts.map +1 -0
  28. package/dist/contexts/CartContext.d.ts +60 -0
  29. package/dist/contexts/CartContext.d.ts.map +1 -0
  30. package/dist/hooks/usePaystackPayment.d.ts +46 -0
  31. package/dist/hooks/usePaystackPayment.d.ts.map +1 -0
  32. package/dist/index.d.ts +34 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.mjs +99 -0
  35. package/dist/index10.mjs +644 -0
  36. package/dist/index100.mjs +7 -0
  37. package/dist/index101.mjs +35 -0
  38. package/dist/index102.mjs +33 -0
  39. package/dist/index103.mjs +30 -0
  40. package/dist/index104.mjs +63 -0
  41. package/dist/index105.mjs +5 -0
  42. package/dist/index106.mjs +4 -0
  43. package/dist/index107.mjs +4 -0
  44. package/dist/index108.mjs +19 -0
  45. package/dist/index109.mjs +15 -0
  46. package/dist/index11.mjs +62 -0
  47. package/dist/index110.mjs +8 -0
  48. package/dist/index111.mjs +32 -0
  49. package/dist/index12.mjs +64 -0
  50. package/dist/index13.mjs +26 -0
  51. package/dist/index14.mjs +117 -0
  52. package/dist/index15.mjs +44 -0
  53. package/dist/index16.mjs +44 -0
  54. package/dist/index17.mjs +44 -0
  55. package/dist/index18.mjs +43 -0
  56. package/dist/index19.mjs +11 -0
  57. package/dist/index2.mjs +24 -0
  58. package/dist/index20.mjs +29 -0
  59. package/dist/index21.mjs +34 -0
  60. package/dist/index22.mjs +22 -0
  61. package/dist/index23.mjs +90 -0
  62. package/dist/index24.mjs +22 -0
  63. package/dist/index25.mjs +13 -0
  64. package/dist/index26.mjs +99 -0
  65. package/dist/index27.mjs +20 -0
  66. package/dist/index28.mjs +67 -0
  67. package/dist/index29.mjs +98 -0
  68. package/dist/index3.mjs +121 -0
  69. package/dist/index30.mjs +21 -0
  70. package/dist/index31.mjs +21 -0
  71. package/dist/index32.mjs +13 -0
  72. package/dist/index33.mjs +6 -0
  73. package/dist/index34.mjs +1435 -0
  74. package/dist/index35.mjs +4 -0
  75. package/dist/index36.mjs +59 -0
  76. package/dist/index37.mjs +53 -0
  77. package/dist/index38.mjs +35 -0
  78. package/dist/index39.mjs +17 -0
  79. package/dist/index4.mjs +201 -0
  80. package/dist/index40.mjs +2265 -0
  81. package/dist/index41.mjs +25 -0
  82. package/dist/index42.mjs +38 -0
  83. package/dist/index43.mjs +46 -0
  84. package/dist/index44.mjs +101 -0
  85. package/dist/index45.mjs +114 -0
  86. package/dist/index46.mjs +78 -0
  87. package/dist/index47.mjs +89 -0
  88. package/dist/index48.mjs +106 -0
  89. package/dist/index49.mjs +87 -0
  90. package/dist/index5.mjs +112 -0
  91. package/dist/index50.mjs +76 -0
  92. package/dist/index51.mjs +20 -0
  93. package/dist/index52.mjs +19 -0
  94. package/dist/index53.mjs +64 -0
  95. package/dist/index54.mjs +131 -0
  96. package/dist/index55.mjs +135 -0
  97. package/dist/index56.mjs +77 -0
  98. package/dist/index57.mjs +17 -0
  99. package/dist/index58.mjs +65 -0
  100. package/dist/index59.mjs +6 -0
  101. package/dist/index6.mjs +82 -0
  102. package/dist/index60.mjs +4 -0
  103. package/dist/index61.mjs +7 -0
  104. package/dist/index62.mjs +36 -0
  105. package/dist/index63.mjs +45 -0
  106. package/dist/index64.mjs +237 -0
  107. package/dist/index65.mjs +8 -0
  108. package/dist/index66.mjs +136 -0
  109. package/dist/index67.mjs +70 -0
  110. package/dist/index68.mjs +89 -0
  111. package/dist/index69.mjs +31 -0
  112. package/dist/index7.mjs +100 -0
  113. package/dist/index70.mjs +11 -0
  114. package/dist/index71.mjs +77 -0
  115. package/dist/index72.mjs +6 -0
  116. package/dist/index73.mjs +4 -0
  117. package/dist/index74.mjs +85 -0
  118. package/dist/index75.mjs +56 -0
  119. package/dist/index76.mjs +8 -0
  120. package/dist/index77.mjs +7 -0
  121. package/dist/index78.mjs +181 -0
  122. package/dist/index79.mjs +55 -0
  123. package/dist/index8.mjs +165 -0
  124. package/dist/index80.mjs +71 -0
  125. package/dist/index81.mjs +23 -0
  126. package/dist/index82.mjs +58 -0
  127. package/dist/index83.mjs +31 -0
  128. package/dist/index84.mjs +9 -0
  129. package/dist/index85.mjs +54 -0
  130. package/dist/index86.mjs +8 -0
  131. package/dist/index87.mjs +14 -0
  132. package/dist/index88.mjs +9 -0
  133. package/dist/index89.mjs +30 -0
  134. package/dist/index9.mjs +100 -0
  135. package/dist/index90.mjs +4 -0
  136. package/dist/index91.mjs +72 -0
  137. package/dist/index92.mjs +169 -0
  138. package/dist/index93.mjs +15 -0
  139. package/dist/index94.mjs +9 -0
  140. package/dist/index95.mjs +33 -0
  141. package/dist/index96.mjs +13 -0
  142. package/dist/index97.mjs +6 -0
  143. package/dist/index98.mjs +6 -0
  144. package/dist/index99.mjs +14 -0
  145. package/dist/lib/utils.d.ts +7 -0
  146. package/dist/lib/utils.d.ts.map +1 -0
  147. package/dist/mockServiceWorker.js +349 -0
  148. package/dist/providers/StorefrontProvider.d.ts +47 -0
  149. package/dist/providers/StorefrontProvider.d.ts.map +1 -0
  150. package/dist/test-utils/MockCartProvider.d.ts +21 -0
  151. package/dist/test-utils/MockCartProvider.d.ts.map +1 -0
  152. package/package.json +77 -0
@@ -0,0 +1,35 @@
1
+ import i from "./index108.mjs";
2
+ import m from "./index109.mjs";
3
+ import f from "./index64.mjs";
4
+ const h = (t, o, a = 3) => {
5
+ let r = 0;
6
+ const c = i(50, 250);
7
+ return m((s) => {
8
+ const n = s.loaded, e = s.lengthComputable ? s.total : void 0, l = n - r, d = c(l), p = n <= e;
9
+ r = n;
10
+ const u = {
11
+ loaded: n,
12
+ total: e,
13
+ progress: e ? n / e : void 0,
14
+ bytes: l,
15
+ rate: d || void 0,
16
+ estimated: d && e && p ? (e - n) / d : void 0,
17
+ event: s,
18
+ lengthComputable: e != null,
19
+ [o ? "download" : "upload"]: !0
20
+ };
21
+ t(u);
22
+ }, a);
23
+ }, v = (t, o) => {
24
+ const a = t != null;
25
+ return [(r) => o[0]({
26
+ lengthComputable: a,
27
+ total: t,
28
+ loaded: r
29
+ }), o[1]];
30
+ }, C = (t) => (...o) => f.asap(() => t(...o));
31
+ export {
32
+ C as asyncDecorator,
33
+ v as progressEventDecorator,
34
+ h as progressEventReducer
35
+ };
@@ -0,0 +1,33 @@
1
+ import n from "./index88.mjs";
2
+ import m from "./index64.mjs";
3
+ import c from "./index110.mjs";
4
+ import h from "./index111.mjs";
5
+ import w from "./index84.mjs";
6
+ import b from "./index67.mjs";
7
+ import C from "./index78.mjs";
8
+ import g from "./index81.mjs";
9
+ const E = (a) => {
10
+ const e = b({}, a);
11
+ let { data: i, withXSRFToken: r, xsrfHeaderName: f, xsrfCookieName: d, headers: o, auth: s } = e;
12
+ if (e.headers = o = C.from(o), e.url = g(w(e.baseURL, e.url, e.allowAbsoluteUrls), a.params, a.paramsSerializer), s && o.set(
13
+ "Authorization",
14
+ "Basic " + btoa((s.username || "") + ":" + (s.password ? unescape(encodeURIComponent(s.password)) : ""))
15
+ ), m.isFormData(i)) {
16
+ if (n.hasStandardBrowserEnv || n.hasStandardBrowserWebWorkerEnv)
17
+ o.setContentType(void 0);
18
+ else if (m.isFunction(i.getHeaders)) {
19
+ const t = i.getHeaders(), u = ["content-type", "content-length"];
20
+ Object.entries(t).forEach(([l, p]) => {
21
+ u.includes(l.toLowerCase()) && o.set(l, p);
22
+ });
23
+ }
24
+ }
25
+ if (n.hasStandardBrowserEnv && (r && m.isFunction(r) && (r = r(e)), r || r !== !1 && c(e.url))) {
26
+ const t = f && d && h.read(d);
27
+ t && o.set(f, t);
28
+ }
29
+ return e;
30
+ };
31
+ export {
32
+ E as default
33
+ };
@@ -0,0 +1,30 @@
1
+ import a from "./index70.mjs";
2
+ import s from "./index75.mjs";
3
+ import m from "./index64.mjs";
4
+ const h = (e, t) => {
5
+ const { length: l } = e = e ? e.filter(Boolean) : [];
6
+ if (t || l) {
7
+ let u = new AbortController(), f;
8
+ const n = function(r) {
9
+ if (!f) {
10
+ f = !0, i();
11
+ const o = r instanceof Error ? r : this.reason;
12
+ u.abort(o instanceof s ? o : new a(o instanceof Error ? o.message : o));
13
+ }
14
+ };
15
+ let c = t && setTimeout(() => {
16
+ c = null, n(new s(`timeout ${t} of ms exceeded`, s.ETIMEDOUT));
17
+ }, t);
18
+ const i = () => {
19
+ e && (c && clearTimeout(c), c = null, e.forEach((r) => {
20
+ r.unsubscribe ? r.unsubscribe(n) : r.removeEventListener("abort", n);
21
+ }), e = null);
22
+ };
23
+ e.forEach((r) => r.addEventListener("abort", n));
24
+ const { signal: b } = u;
25
+ return b.unsubscribe = () => m.asap(i), b;
26
+ }
27
+ };
28
+ export {
29
+ h as default
30
+ };
@@ -0,0 +1,63 @@
1
+ const f = function* (e, t) {
2
+ let n = e.byteLength;
3
+ if (n < t) {
4
+ yield e;
5
+ return;
6
+ }
7
+ let a = 0, r;
8
+ for (; a < n; )
9
+ r = a + t, yield e.slice(a, r), a = r;
10
+ }, w = async function* (e, t) {
11
+ for await (const n of b(e))
12
+ yield* f(n, t);
13
+ }, b = async function* (e) {
14
+ if (e[Symbol.asyncIterator]) {
15
+ yield* e;
16
+ return;
17
+ }
18
+ const t = e.getReader();
19
+ try {
20
+ for (; ; ) {
21
+ const { done: n, value: a } = await t.read();
22
+ if (n)
23
+ break;
24
+ yield a;
25
+ }
26
+ } finally {
27
+ await t.cancel();
28
+ }
29
+ }, h = (e, t, n, a) => {
30
+ const r = w(e, t);
31
+ let d = 0, o, c = (l) => {
32
+ o || (o = !0, a && a(l));
33
+ };
34
+ return new ReadableStream({
35
+ async pull(l) {
36
+ try {
37
+ const { done: i, value: y } = await r.next();
38
+ if (i) {
39
+ c(), l.close();
40
+ return;
41
+ }
42
+ let s = y.byteLength;
43
+ if (n) {
44
+ let u = d += s;
45
+ n(u);
46
+ }
47
+ l.enqueue(new Uint8Array(y));
48
+ } catch (i) {
49
+ throw c(i), i;
50
+ }
51
+ },
52
+ cancel(l) {
53
+ return c(l), r.return();
54
+ }
55
+ }, {
56
+ highWaterMark: 2
57
+ });
58
+ };
59
+ export {
60
+ w as readBytes,
61
+ f as streamChunk,
62
+ h as trackStream
63
+ };
@@ -0,0 +1,5 @@
1
+ import a from "./index95.mjs";
2
+ const e = typeof URLSearchParams < "u" ? URLSearchParams : a;
3
+ export {
4
+ e as default
5
+ };
@@ -0,0 +1,4 @@
1
+ const a = typeof FormData < "u" ? FormData : null;
2
+ export {
3
+ a as default
4
+ };
@@ -0,0 +1,4 @@
1
+ const l = typeof Blob < "u" ? Blob : null;
2
+ export {
3
+ l as default
4
+ };
@@ -0,0 +1,19 @@
1
+ function y(t, n) {
2
+ t = t || 10;
3
+ const c = new Array(t), o = new Array(t);
4
+ let e = 0, r = 0, i;
5
+ return n = n !== void 0 ? n : 1e3, function(h) {
6
+ const d = Date.now(), a = o[r];
7
+ i || (i = d), c[e] = h, o[e] = d;
8
+ let f = r, u = 0;
9
+ for (; f !== e; )
10
+ u += c[f++], f = f % t;
11
+ if (e = (e + 1) % t, e === r && (r = (r + 1) % t), d - i < n)
12
+ return;
13
+ const w = a && d - a;
14
+ return w ? Math.round(u * 1e3 / w) : void 0;
15
+ };
16
+ }
17
+ export {
18
+ y as default
19
+ };
@@ -0,0 +1,15 @@
1
+ function h(r, a) {
2
+ let s = 0, u = 1e3 / a, e, t;
3
+ const n = (l, o = Date.now()) => {
4
+ s = o, e = null, t && (clearTimeout(t), t = null), r(...l);
5
+ };
6
+ return [(...l) => {
7
+ const o = Date.now(), i = o - s;
8
+ i >= u ? n(l, o) : (e = l, t || (t = setTimeout(() => {
9
+ t = null, n(e);
10
+ }, u - i)));
11
+ }, () => e && n(e)];
12
+ }
13
+ export {
14
+ h as default
15
+ };
@@ -0,0 +1,62 @@
1
+ import { jsxs as c, jsx as u } from "react/jsx-runtime";
2
+ import { Root as v } from "./index37.mjs";
3
+ import { cva as g } from "./index38.mjs";
4
+ import { Loader2 as l } from "lucide-react";
5
+ import { cn as p } from "./index17.mjs";
6
+ const b = g(
7
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
12
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
13
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
14
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
15
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
16
+ link: "text-primary underline-offset-4 hover:underline"
17
+ },
18
+ size: {
19
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
20
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
21
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
22
+ icon: "size-9",
23
+ "icon-sm": "size-8",
24
+ "icon-lg": "size-10"
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ variant: "default",
29
+ size: "default"
30
+ }
31
+ }
32
+ );
33
+ function z({
34
+ className: r,
35
+ variant: t,
36
+ size: i,
37
+ asChild: n = !1,
38
+ loading: e = !1,
39
+ children: o,
40
+ disabled: s,
41
+ type: a,
42
+ ...d
43
+ }) {
44
+ return /* @__PURE__ */ c(
45
+ n ? v : "button",
46
+ {
47
+ "data-slot": "button",
48
+ className: p(b({ variant: t, size: i, className: r })),
49
+ disabled: s || e,
50
+ type: a ?? "button",
51
+ ...d,
52
+ children: [
53
+ e && /* @__PURE__ */ u(l, { className: "size-4 animate-spin" }),
54
+ o
55
+ ]
56
+ }
57
+ );
58
+ }
59
+ export {
60
+ z as Button,
61
+ b as buttonVariants
62
+ };
@@ -0,0 +1,8 @@
1
+ import o from "./index88.mjs";
2
+ const n = o.hasStandardBrowserEnv ? /* @__PURE__ */ ((r, e) => (t) => (t = new URL(t, o.origin), r.protocol === t.protocol && r.host === t.host && (e || r.port === t.port)))(
3
+ new URL(o.origin),
4
+ o.navigator && /(msie|trident)/i.test(o.navigator.userAgent)
5
+ ) : () => !0;
6
+ export {
7
+ n as default
8
+ };
@@ -0,0 +1,32 @@
1
+ import r from "./index64.mjs";
2
+ import c from "./index88.mjs";
3
+ const p = c.hasStandardBrowserEnv ? (
4
+ // Standard browser envs support document.cookie
5
+ {
6
+ write(e, t, n, i, s, u) {
7
+ const o = [e + "=" + encodeURIComponent(t)];
8
+ r.isNumber(n) && o.push("expires=" + new Date(n).toGMTString()), r.isString(i) && o.push("path=" + i), r.isString(s) && o.push("domain=" + s), u === !0 && o.push("secure"), document.cookie = o.join("; ");
9
+ },
10
+ read(e) {
11
+ const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
12
+ return t ? decodeURIComponent(t[3]) : null;
13
+ },
14
+ remove(e) {
15
+ this.write(e, "", Date.now() - 864e5);
16
+ }
17
+ }
18
+ ) : (
19
+ // Non-standard browser env (web workers, react-native) lack needed support.
20
+ {
21
+ write() {
22
+ },
23
+ read() {
24
+ return null;
25
+ },
26
+ remove() {
27
+ }
28
+ }
29
+ );
30
+ export {
31
+ p as default
32
+ };
@@ -0,0 +1,64 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { cn as o } from "./index17.mjs";
4
+ const s = t.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
5
+ "div",
6
+ {
7
+ ref: r,
8
+ className: o(
9
+ "rounded-lg border bg-card text-card-foreground",
10
+ a
11
+ ),
12
+ ...e
13
+ }
14
+ ));
15
+ s.displayName = "Card";
16
+ const i = t.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
17
+ "div",
18
+ {
19
+ ref: r,
20
+ className: o("flex flex-col space-y-1.5 p-6", a),
21
+ ...e
22
+ }
23
+ ));
24
+ i.displayName = "CardHeader";
25
+ const c = t.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
26
+ "div",
27
+ {
28
+ ref: r,
29
+ className: o(
30
+ "text-2xl font-semibold leading-none tracking-tight",
31
+ a
32
+ ),
33
+ ...e
34
+ }
35
+ ));
36
+ c.displayName = "CardTitle";
37
+ const l = t.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
38
+ "div",
39
+ {
40
+ ref: r,
41
+ className: o("text-sm text-muted-foreground", a),
42
+ ...e
43
+ }
44
+ ));
45
+ l.displayName = "CardDescription";
46
+ const m = t.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d("div", { ref: r, className: o("p-6 pt-0", a), ...e }));
47
+ m.displayName = "CardContent";
48
+ const n = t.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ d(
49
+ "div",
50
+ {
51
+ ref: r,
52
+ className: o("flex items-center p-6 pt-0", a),
53
+ ...e
54
+ }
55
+ ));
56
+ n.displayName = "CardFooter";
57
+ export {
58
+ s as Card,
59
+ m as CardContent,
60
+ l as CardDescription,
61
+ n as CardFooter,
62
+ i as CardHeader,
63
+ c as CardTitle
64
+ };
@@ -0,0 +1,26 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { cva as n } from "./index38.mjs";
3
+ import { cn as a } from "./index17.mjs";
4
+ const i = n(
5
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
6
+ {
7
+ variants: {
8
+ variant: {
9
+ default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
10
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
11
+ destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
12
+ outline: "text-foreground"
13
+ }
14
+ },
15
+ defaultVariants: {
16
+ variant: "default"
17
+ }
18
+ }
19
+ );
20
+ function f({ className: r, variant: e, ...t }) {
21
+ return /* @__PURE__ */ o("div", { className: a(i({ variant: e }), r), ...t });
22
+ }
23
+ export {
24
+ f as Badge,
25
+ i as badgeVariants
26
+ };
@@ -0,0 +1,117 @@
1
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
+ import { useRef as j, useState as f, useEffect as o } from "react";
3
+ import { createPortal as A } from "react-dom";
4
+ import { X as R } from "lucide-react";
5
+ import { cn as i } from "./index17.mjs";
6
+ function L({
7
+ isOpen: t,
8
+ onClose: l,
9
+ title: a,
10
+ children: x,
11
+ footer: n,
12
+ className: y,
13
+ contentClassName: b,
14
+ size: g = "md",
15
+ closeOnOverlayClick: h = !0,
16
+ showCloseButton: d = !0
17
+ }) {
18
+ const v = j(null), [s, m] = f(!1), [w, c] = f(t);
19
+ if (o(() => {
20
+ if (t)
21
+ c(!0), requestAnimationFrame(() => {
22
+ requestAnimationFrame(() => {
23
+ m(!0);
24
+ });
25
+ });
26
+ else {
27
+ m(!1);
28
+ const e = setTimeout(() => {
29
+ c(!1);
30
+ }, 200);
31
+ return () => clearTimeout(e);
32
+ }
33
+ }, [t]), o(() => {
34
+ const e = (E) => {
35
+ E.key === "Escape" && t && l();
36
+ };
37
+ if (t)
38
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
39
+ }, [t, l]), o(() => {
40
+ if (t) {
41
+ const e = document.body.style.overflow;
42
+ return document.body.style.overflow = "hidden", () => {
43
+ document.body.style.overflow = e;
44
+ };
45
+ }
46
+ }, [t]), !w) return null;
47
+ const p = {
48
+ sm: "max-w-md",
49
+ md: "max-w-lg",
50
+ lg: "max-w-2xl",
51
+ xl: "max-w-4xl",
52
+ full: "max-w-full mx-4"
53
+ }, k = (e) => {
54
+ h && e.target === e.currentTarget && l();
55
+ }, N = /* @__PURE__ */ r(
56
+ "div",
57
+ {
58
+ className: i(
59
+ "fixed inset-0 z-50 flex items-center justify-center p-2 sm:p-4 bg-black/50 backdrop-blur-sm transition-opacity duration-200",
60
+ s ? "opacity-100" : "opacity-0"
61
+ ),
62
+ onClick: k,
63
+ children: /* @__PURE__ */ u(
64
+ "div",
65
+ {
66
+ ref: v,
67
+ className: i(
68
+ "relative w-full bg-white rounded-xl shadow-xl flex flex-col max-h-[90vh] transition-all duration-200",
69
+ s ? "opacity-100 scale-100" : "opacity-0 scale-95",
70
+ p[g],
71
+ y
72
+ ),
73
+ role: "dialog",
74
+ "aria-modal": "true",
75
+ "aria-labelledby": a ? "modal-title" : void 0,
76
+ children: [
77
+ (a || d) && /* @__PURE__ */ u("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 flex-shrink-0", children: [
78
+ a && /* @__PURE__ */ r(
79
+ "h2",
80
+ {
81
+ id: "modal-title",
82
+ className: "text-xl font-semibold text-gray-900",
83
+ children: a
84
+ }
85
+ ),
86
+ d && /* @__PURE__ */ r(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ onClick: l,
91
+ className: "ml-auto p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",
92
+ "aria-label": "Close modal",
93
+ children: /* @__PURE__ */ r(R, { size: 20 })
94
+ }
95
+ )
96
+ ] }),
97
+ /* @__PURE__ */ r(
98
+ "div",
99
+ {
100
+ className: i(
101
+ "flex-1 overflow-y-auto p-4 min-h-0",
102
+ b
103
+ ),
104
+ children: x
105
+ }
106
+ ),
107
+ n && /* @__PURE__ */ r("div", { className: "p-4 border-t border-gray-200 bg-gray-50 flex-shrink-0 rounded-b-xl", children: n })
108
+ ]
109
+ }
110
+ )
111
+ }
112
+ );
113
+ return A(N, document.body);
114
+ }
115
+ export {
116
+ L as Modal
117
+ };
@@ -0,0 +1,44 @@
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import u from "react";
3
+ import { cn as a } from "./index17.mjs";
4
+ const f = u.forwardRef(
5
+ ({
6
+ label: o,
7
+ error: r,
8
+ icon: t,
9
+ className: c,
10
+ containerClassName: d,
11
+ required: m,
12
+ disabled: s,
13
+ ...n
14
+ }, i) => /* @__PURE__ */ l("div", { className: a("w-full", d), children: [
15
+ o && /* @__PURE__ */ l("label", { className: "mb-1.5 block text-sm font-medium text-gray-700", children: [
16
+ o,
17
+ m && /* @__PURE__ */ e("span", { className: "ml-1 text-red-600", children: "*" })
18
+ ] }),
19
+ /* @__PURE__ */ l("div", { className: "relative", children: [
20
+ t && /* @__PURE__ */ e("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-gray-400", children: t }),
21
+ /* @__PURE__ */ e(
22
+ "input",
23
+ {
24
+ ref: i,
25
+ disabled: s,
26
+ className: a(
27
+ "w-full rounded-lg border px-3 py-2.5 text-sm transition-colors",
28
+ "focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
29
+ t && "pl-10",
30
+ r ? "border-red-500 focus:border-red-500 focus:ring-red-500" : "border-gray-300 focus:border-blue-500",
31
+ s && "bg-gray-50 text-gray-500 cursor-not-allowed",
32
+ c
33
+ ),
34
+ ...n
35
+ }
36
+ )
37
+ ] }),
38
+ r && /* @__PURE__ */ e("p", { className: "mt-1.5 text-sm text-red-600", role: "alert", children: r })
39
+ ] })
40
+ );
41
+ f.displayName = "FormInput";
42
+ export {
43
+ f as FormInput
44
+ };
@@ -0,0 +1,44 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import g from "react";
3
+ import { cn as l } from "./index17.mjs";
4
+ const u = g.forwardRef(
5
+ ({
6
+ label: t,
7
+ error: e,
8
+ className: a,
9
+ containerClassName: c,
10
+ required: m,
11
+ disabled: o,
12
+ children: n,
13
+ ...i
14
+ }, d) => /* @__PURE__ */ s("div", { className: l("w-full", c), children: [
15
+ t && /* @__PURE__ */ s("label", { className: "mb-1.5 block text-sm font-medium text-gray-700", children: [
16
+ t,
17
+ m && /* @__PURE__ */ r("span", { className: "ml-1 text-red-600", children: "*" })
18
+ ] }),
19
+ /* @__PURE__ */ r(
20
+ "select",
21
+ {
22
+ ref: d,
23
+ disabled: o,
24
+ className: l(
25
+ "w-full rounded-lg border px-3 py-2.5 text-sm transition-colors",
26
+ "focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
27
+ "appearance-none bg-white",
28
+ `bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E")] bg-no-repeat bg-[right_0.75rem_center]`,
29
+ "pr-10",
30
+ e ? "border-red-500 focus:border-red-500 focus:ring-red-500" : "border-gray-300 focus:border-blue-500",
31
+ o && "bg-gray-50 text-gray-500 cursor-not-allowed",
32
+ a
33
+ ),
34
+ ...i,
35
+ children: n
36
+ }
37
+ ),
38
+ e && /* @__PURE__ */ r("p", { className: "mt-1.5 text-sm text-red-600", role: "alert", children: e })
39
+ ] })
40
+ );
41
+ u.displayName = "FormSelect";
42
+ export {
43
+ u as FormSelect
44
+ };
@@ -0,0 +1,44 @@
1
+ import { clsx as r } from "./index39.mjs";
2
+ import { twMerge as n } from "./index40.mjs";
3
+ function u(...e) {
4
+ return n(r(e));
5
+ }
6
+ function g(e) {
7
+ return new Intl.NumberFormat("en-US", {
8
+ style: "currency",
9
+ currency: "NGN"
10
+ }).format(e);
11
+ }
12
+ function i(e) {
13
+ return (typeof e == "string" ? new Date(e) : e).toLocaleDateString("en-US", {
14
+ year: "numeric",
15
+ month: "long",
16
+ day: "numeric"
17
+ });
18
+ }
19
+ function l(e) {
20
+ return (typeof e == "string" ? new Date(e) : e).toLocaleString("en-US", {
21
+ year: "numeric",
22
+ month: "long",
23
+ day: "numeric",
24
+ hour: "2-digit",
25
+ minute: "2-digit"
26
+ });
27
+ }
28
+ function a(e) {
29
+ return {
30
+ pending: "bg-yellow-100 text-yellow-800",
31
+ shipped: "bg-blue-100 text-blue-800",
32
+ delivered: "bg-green-100 text-green-800",
33
+ cancelled: "bg-red-100 text-red-800",
34
+ refunded: "bg-purple-100 text-purple-800",
35
+ prospect: "bg-orange-100 text-orange-800"
36
+ }[e] || "bg-gray-100 text-gray-800";
37
+ }
38
+ export {
39
+ u as cn,
40
+ g as formatCurrency,
41
+ i as formatDate,
42
+ l as formatDateTime,
43
+ a as getStatusColor
44
+ };