@burdenoff/microfe-coolandlovely 2026.625.2 → 2026.628.1
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/coolandlovely/CoolAndLovelyRoot.js +66 -122
- package/dist/coolandlovely/CoolAndLovelyRoot.js.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +87 -175
- package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
- package/dist/coolandlovely/components/Field.js +81 -0
- package/dist/coolandlovely/components/Field.js.map +1 -0
- package/dist/coolandlovely/components/StateViews.js +34 -0
- package/dist/coolandlovely/components/StateViews.js.map +1 -0
- package/dist/coolandlovely/components/StatusBadge.js +25 -22
- package/dist/coolandlovely/components/StatusBadge.js.map +1 -1
- package/dist/coolandlovely/components/TagList.js +21 -0
- package/dist/coolandlovely/components/TagList.js.map +1 -0
- package/dist/coolandlovely/components/Thumbnail.js +29 -0
- package/dist/coolandlovely/components/Thumbnail.js.map +1 -0
- package/dist/coolandlovely/context/CoolAndLovelyContext.js +10 -10
- package/dist/coolandlovely/context/CoolAndLovelyContext.js.map +1 -1
- package/dist/coolandlovely/hooks/index.js +1 -0
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js +462 -169
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js.map +1 -1
- package/dist/coolandlovely/pages/HomePage.js +251 -845
- package/dist/coolandlovely/pages/HomePage.js.map +1 -1
- package/dist/coolandlovely/pages/brands/BrandDetailPage.js +319 -0
- package/dist/coolandlovely/pages/brands/BrandDetailPage.js.map +1 -0
- package/dist/coolandlovely/pages/brands/BrandFormPage.js +190 -0
- package/dist/coolandlovely/pages/brands/BrandFormPage.js.map +1 -0
- package/dist/coolandlovely/pages/brands/BrandsListPage.js +158 -0
- package/dist/coolandlovely/pages/brands/BrandsListPage.js.map +1 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js +253 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js.map +1 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.js +206 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.js.map +1 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.js +129 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.js.map +1 -0
- package/dist/coolandlovely/pages/collections/CollectionDetailPage.js +217 -0
- package/dist/coolandlovely/pages/collections/CollectionDetailPage.js.map +1 -0
- package/dist/coolandlovely/pages/collections/CollectionFormPage.js +217 -0
- package/dist/coolandlovely/pages/collections/CollectionFormPage.js.map +1 -0
- package/dist/coolandlovely/pages/collections/CollectionsListPage.js +122 -0
- package/dist/coolandlovely/pages/collections/CollectionsListPage.js.map +1 -0
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js +230 -0
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js.map +1 -0
- package/dist/coolandlovely/pages/items/StyleItemFormPage.js +276 -0
- package/dist/coolandlovely/pages/items/StyleItemFormPage.js.map +1 -0
- package/dist/coolandlovely/pages/items/StyleItemsListPage.js +170 -0
- package/dist/coolandlovely/pages/items/StyleItemsListPage.js.map +1 -0
- package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.js +124 -0
- package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.js.map +1 -0
- package/dist/coolandlovely/pages/lookbooks/LookbooksListPage.js +156 -0
- package/dist/coolandlovely/pages/lookbooks/LookbooksListPage.js.map +1 -0
- package/dist/coolandlovely/pages/looks/LookDetailPage.js +238 -0
- package/dist/coolandlovely/pages/looks/LookDetailPage.js.map +1 -0
- package/dist/coolandlovely/pages/looks/LookFormPage.js +209 -0
- package/dist/coolandlovely/pages/looks/LookFormPage.js.map +1 -0
- package/dist/coolandlovely/pages/looks/LooksListPage.js +181 -0
- package/dist/coolandlovely/pages/looks/LooksListPage.js.map +1 -0
- package/dist/coolandlovely/pages/profile/StyleProfilePage.js +224 -0
- package/dist/coolandlovely/pages/profile/StyleProfilePage.js.map +1 -0
- package/dist/coolandlovely/pages/wardrobe/WardrobeFormPage.js +173 -0
- package/dist/coolandlovely/pages/wardrobe/WardrobeFormPage.js.map +1 -0
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js +172 -0
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js.map +1 -0
- package/dist/coolandlovely/store/coolandlovelyStore.js +2 -6
- package/dist/coolandlovely/store/coolandlovelyStore.js.map +1 -1
- package/dist/coolandlovely/utils/formatters.js +31 -23
- package/dist/coolandlovely/utils/formatters.js.map +1 -1
- package/dist/coolandlovely/utils/icons.js +34 -0
- package/dist/coolandlovely/utils/icons.js.map +1 -0
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/coolandlovely/components/InvestmentCard.js +0 -98
- package/dist/coolandlovely/components/InvestmentCard.js.map +0 -1
- package/dist/coolandlovely/components/RatingDisplay.js +0 -35
- package/dist/coolandlovely/components/RatingDisplay.js.map +0 -1
- package/dist/coolandlovely/mocks/data.js +0 -1517
- package/dist/coolandlovely/mocks/data.js.map +0 -1
- package/dist/coolandlovely/mocks/users.js +0 -34
- package/dist/coolandlovely/mocks/users.js.map +0 -1
- package/dist/coolandlovely/pages/admin/AdminAnalyticsPage.js +0 -651
- package/dist/coolandlovely/pages/admin/AdminAnalyticsPage.js.map +0 -1
- package/dist/coolandlovely/pages/admin/AdminDashboard.js +0 -673
- package/dist/coolandlovely/pages/admin/AdminDashboard.js.map +0 -1
- package/dist/coolandlovely/pages/admin/AdminFinancialPage.js +0 -427
- package/dist/coolandlovely/pages/admin/AdminFinancialPage.js.map +0 -1
- package/dist/coolandlovely/pages/admin/AdminOrdersPage.js +0 -665
- package/dist/coolandlovely/pages/admin/AdminOrdersPage.js.map +0 -1
- package/dist/coolandlovely/pages/admin/AdminProfilePage.js +0 -264
- package/dist/coolandlovely/pages/admin/AdminProfilePage.js.map +0 -1
- package/dist/coolandlovely/pages/admin/AdminSettingsPage.js +0 -654
- package/dist/coolandlovely/pages/admin/AdminSettingsPage.js.map +0 -1
- package/dist/coolandlovely/pages/admin/CartManagementPage.js +0 -874
- package/dist/coolandlovely/pages/admin/CartManagementPage.js.map +0 -1
- package/dist/coolandlovely/pages/admin/UserManagementPage.js +0 -898
- package/dist/coolandlovely/pages/admin/UserManagementPage.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/AnalyticsDashboard.js +0 -842
- package/dist/coolandlovely/pages/cart-owner/AnalyticsDashboard.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/BusinessSettingsPage.js +0 -705
- package/dist/coolandlovely/pages/cart-owner/BusinessSettingsPage.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/CartOwnerDashboard.js +0 -802
- package/dist/coolandlovely/pages/cart-owner/CartOwnerDashboard.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/CartOwnerProfilePage.js +0 -891
- package/dist/coolandlovely/pages/cart-owner/CartOwnerProfilePage.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/CartServiceConfigPage.js +0 -639
- package/dist/coolandlovely/pages/cart-owner/CartServiceConfigPage.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/InventoryManagementPage.js +0 -914
- package/dist/coolandlovely/pages/cart-owner/InventoryManagementPage.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/OrderManagementPage.js +0 -882
- package/dist/coolandlovely/pages/cart-owner/OrderManagementPage.js.map +0 -1
- package/dist/coolandlovely/pages/cart-owner/StaffManagementPage.js +0 -831
- package/dist/coolandlovely/pages/cart-owner/StaffManagementPage.js.map +0 -1
- package/dist/coolandlovely/pages/common/HelpSupportPage.js +0 -1325
- package/dist/coolandlovely/pages/common/HelpSupportPage.js.map +0 -1
- package/dist/coolandlovely/pages/common/NotificationCenterPage.js +0 -671
- package/dist/coolandlovely/pages/common/NotificationCenterPage.js.map +0 -1
- package/dist/coolandlovely/pages/common/SettingsPage.js +0 -973
- package/dist/coolandlovely/pages/common/SettingsPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/BookingDetailsPage.js +0 -630
- package/dist/coolandlovely/pages/customer/BookingDetailsPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/CartDetailPage.js +0 -623
- package/dist/coolandlovely/pages/customer/CartDetailPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/CartDiscoveryPage.js +0 -558
- package/dist/coolandlovely/pages/customer/CartDiscoveryPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/CheckoutPage.js +0 -529
- package/dist/coolandlovely/pages/customer/CheckoutPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/CustomerDashboard.js +0 -538
- package/dist/coolandlovely/pages/customer/CustomerDashboard.js.map +0 -1
- package/dist/coolandlovely/pages/customer/CustomerProfilePage.js +0 -658
- package/dist/coolandlovely/pages/customer/CustomerProfilePage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/DirectServiceBookingPage.js +0 -632
- package/dist/coolandlovely/pages/customer/DirectServiceBookingPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/FavoritesPage.js +0 -487
- package/dist/coolandlovely/pages/customer/FavoritesPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/OrderHistoryPage.js +0 -447
- package/dist/coolandlovely/pages/customer/OrderHistoryPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/OrderTrackingPage.js +0 -425
- package/dist/coolandlovely/pages/customer/OrderTrackingPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/PaymentMethodsPage.js +0 -494
- package/dist/coolandlovely/pages/customer/PaymentMethodsPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/ReviewsPage.js +0 -616
- package/dist/coolandlovely/pages/customer/ReviewsPage.js.map +0 -1
- package/dist/coolandlovely/pages/customer/SavedAddressesPage.js +0 -449
- package/dist/coolandlovely/pages/customer/SavedAddressesPage.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestmentDetailsPage.js +0 -887
- package/dist/coolandlovely/pages/investor/InvestmentDetailsPage.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestmentOpportunitiesPage.js +0 -945
- package/dist/coolandlovely/pages/investor/InvestmentOpportunitiesPage.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestorAnalyticsPage.js +0 -687
- package/dist/coolandlovely/pages/investor/InvestorAnalyticsPage.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestorDashboard.js +0 -455
- package/dist/coolandlovely/pages/investor/InvestorDashboard.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestorInvestmentsPage.js +0 -405
- package/dist/coolandlovely/pages/investor/InvestorInvestmentsPage.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestorPortfolioPage.js +0 -602
- package/dist/coolandlovely/pages/investor/InvestorPortfolioPage.js.map +0 -1
- package/dist/coolandlovely/pages/investor/InvestorProfilePage.js +0 -1070
- package/dist/coolandlovely/pages/investor/InvestorProfilePage.js.map +0 -1
- package/dist/coolandlovely/pages/worker/TaskDetailsPage.js +0 -533
- package/dist/coolandlovely/pages/worker/TaskDetailsPage.js.map +0 -1
- package/dist/coolandlovely/pages/worker/WorkerDashboard.js +0 -671
- package/dist/coolandlovely/pages/worker/WorkerDashboard.js.map +0 -1
- package/dist/coolandlovely/pages/worker/WorkerOrdersPage.js +0 -680
- package/dist/coolandlovely/pages/worker/WorkerOrdersPage.js.map +0 -1
- package/dist/coolandlovely/pages/worker/WorkerProfilePage.js +0 -692
- package/dist/coolandlovely/pages/worker/WorkerProfilePage.js.map +0 -1
- package/dist/coolandlovely/pages/worker/WorkerSchedulePage.js +0 -583
- package/dist/coolandlovely/pages/worker/WorkerSchedulePage.js.map +0 -1
|
@@ -4,12 +4,10 @@ import { createProfileScopedStorage as r } from "@burdenoff/fe-libs/shared/utils
|
|
|
4
4
|
//#region src/coolandlovely/store/coolandlovelyStore.ts
|
|
5
5
|
var i = {
|
|
6
6
|
viewMode: "grid",
|
|
7
|
-
activeSection: "
|
|
7
|
+
activeSection: "overview",
|
|
8
8
|
sidebarCollapsed: !1,
|
|
9
9
|
searchQuery: "",
|
|
10
|
-
categoryFilter: ""
|
|
11
|
-
selectedCartId: null,
|
|
12
|
-
selectedOrderId: null
|
|
10
|
+
categoryFilter: ""
|
|
13
11
|
}, a = e()(t(n((e) => ({
|
|
14
12
|
...i,
|
|
15
13
|
setViewMode: (t) => e({ viewMode: t }),
|
|
@@ -17,8 +15,6 @@ var i = {
|
|
|
17
15
|
toggleSidebar: () => e((e) => ({ sidebarCollapsed: !e.sidebarCollapsed })),
|
|
18
16
|
setSearchQuery: (t) => e({ searchQuery: t }),
|
|
19
17
|
setCategoryFilter: (t) => e({ categoryFilter: t }),
|
|
20
|
-
setSelectedCartId: (t) => e({ selectedCartId: t }),
|
|
21
|
-
setSelectedOrderId: (t) => e({ selectedOrderId: t }),
|
|
22
18
|
reset: () => e(i)
|
|
23
19
|
}), {
|
|
24
20
|
name: "burdenoff-coolandlovely-storage",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coolandlovelyStore.js","names":[],"sources":["../../../src/coolandlovely/store/coolandlovelyStore.ts"],"sourcesContent":["/**\n * CoolAndLovely Zustand Store\n * @module coolandlovely/store\n */\n\nimport { create } from 'zustand';\nimport { devtools, persist } from 'zustand/middleware';\nimport { createProfileScopedStorage } from '@burdenoff/fe-libs/shared/utils';\nimport type { ViewMode } from '../types';\n\
|
|
1
|
+
{"version":3,"file":"coolandlovelyStore.js","names":[],"sources":["../../../src/coolandlovely/store/coolandlovelyStore.ts"],"sourcesContent":["/**\n * CoolAndLovely Zustand Store\n * @module coolandlovely/store\n *\n * Lightweight local UI state (view preferences + last-visited section). Server\n * state lives in React Query; this store holds only ephemeral UI preferences.\n */\n\nimport { create } from 'zustand';\nimport { devtools, persist } from 'zustand/middleware';\nimport { createProfileScopedStorage } from '@burdenoff/fe-libs/shared/utils';\nimport type { ViewMode } from '../types';\n\ninterface CoolAndLovelyState {\n // View state\n viewMode: ViewMode;\n activeSection: string;\n sidebarCollapsed: boolean;\n\n // Search & filters\n searchQuery: string;\n categoryFilter: string;\n\n // Actions\n setViewMode: (mode: ViewMode) => void;\n setActiveSection: (section: string) => void;\n setSearchQuery: (query: string) => void;\n setCategoryFilter: (category: string) => void;\n toggleSidebar: () => void;\n reset: () => void;\n}\n\nconst initialState = {\n viewMode: 'grid' as ViewMode,\n activeSection: 'overview',\n sidebarCollapsed: false,\n searchQuery: '',\n categoryFilter: '',\n};\n\nexport const useCoolAndLovelyStore = create<CoolAndLovelyState>()(\n devtools(\n persist(\n (set) => ({\n ...initialState,\n\n setViewMode: (mode) => set({ viewMode: mode }),\n setActiveSection: (section) => set({ activeSection: section }),\n toggleSidebar: () => set((state) => ({ sidebarCollapsed: !state.sidebarCollapsed })),\n setSearchQuery: (query) => set({ searchQuery: query }),\n setCategoryFilter: (category) => set({ categoryFilter: category }),\n reset: () => set(initialState),\n }),\n {\n name: 'burdenoff-coolandlovely-storage',\n storage: createProfileScopedStorage(),\n partialize: (state) => ({\n viewMode: state.viewMode,\n sidebarCollapsed: state.sidebarCollapsed,\n activeSection: state.activeSection,\n }),\n }\n ),\n { name: 'CoolAndLovely Store', enabled: import.meta.env.DEV }\n )\n);\n"],"mappings":";;;;AAgCA,IAAM,IAAe;CACnB,UAAU;CACV,eAAe;CACf,kBAAkB;CAClB,aAAa;CACb,gBAAgB;CACjB,EAEY,IAAwB,GAA4B,CAC/D,EACE,GACG,OAAS;CACR,GAAG;CAEH,cAAc,MAAS,EAAI,EAAE,UAAU,GAAM,CAAC;CAC9C,mBAAmB,MAAY,EAAI,EAAE,eAAe,GAAS,CAAC;CAC9D,qBAAqB,GAAK,OAAW,EAAE,kBAAkB,CAAC,EAAM,kBAAkB,EAAE;CACpF,iBAAiB,MAAU,EAAI,EAAE,aAAa,GAAO,CAAC;CACtD,oBAAoB,MAAa,EAAI,EAAE,gBAAgB,GAAU,CAAC;CAClE,aAAa,EAAI,EAAa;CAC/B,GACD;CACE,MAAM;CACN,SAAS,GAA4B;CACrC,aAAa,OAAW;EACtB,UAAU,EAAM;EAChB,kBAAkB,EAAM;EACxB,eAAe,EAAM;EACtB;CACF,CACF,EACD;CAAE,MAAM;CAAuB,SAAA;CAA8B,CAC9D,CACF"}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
//#region src/coolandlovely/utils/formatters.ts
|
|
2
|
-
function e(e, t) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
function e(e, t = "USD", n) {
|
|
3
|
+
try {
|
|
4
|
+
return new Intl.NumberFormat("en-US", {
|
|
5
|
+
style: "currency",
|
|
6
|
+
currency: t,
|
|
7
|
+
minimumFractionDigits: 2,
|
|
8
|
+
maximumFractionDigits: 2,
|
|
9
|
+
...n
|
|
10
|
+
}).format(e);
|
|
11
|
+
} catch {
|
|
12
|
+
return `${t} ${a(e, {
|
|
13
|
+
minimumFractionDigits: 2,
|
|
14
|
+
maximumFractionDigits: 2,
|
|
15
|
+
...n
|
|
16
|
+
})}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function t(e) {
|
|
20
|
+
return e.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
21
|
+
}
|
|
22
|
+
function n(e) {
|
|
23
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
24
|
+
for (let r of e.split(",")) {
|
|
25
|
+
let e = r.trim();
|
|
26
|
+
e && !t.has(e) && (t.add(e), n.push(e));
|
|
27
|
+
}
|
|
28
|
+
return n;
|
|
10
29
|
}
|
|
11
|
-
function
|
|
30
|
+
function r(e, t) {
|
|
12
31
|
let n = typeof e == "string" ? new Date(e) : e;
|
|
13
32
|
return new Intl.DateTimeFormat("en-IN", {
|
|
14
33
|
day: "numeric",
|
|
@@ -20,7 +39,7 @@ function t(e, t) {
|
|
|
20
39
|
...t
|
|
21
40
|
}).format(n);
|
|
22
41
|
}
|
|
23
|
-
function
|
|
42
|
+
function i(e) {
|
|
24
43
|
let t = typeof e == "string" ? new Date(e) : e, n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 1e3), i = Math.floor(r / 60), a = Math.floor(i / 60), o = Math.floor(a / 24), s = Math.floor(o / 7), c = Math.floor(o / 30);
|
|
25
44
|
if (r < 60) return "just now";
|
|
26
45
|
if (i < 60) return `${i} min${i === 1 ? "" : "s"} ago`;
|
|
@@ -31,21 +50,10 @@ function n(e) {
|
|
|
31
50
|
let l = Math.floor(o / 365);
|
|
32
51
|
return `${l} year${l === 1 ? "" : "s"} ago`;
|
|
33
52
|
}
|
|
34
|
-
function
|
|
53
|
+
function a(e, t) {
|
|
35
54
|
return new Intl.NumberFormat("en-IN", t).format(e);
|
|
36
55
|
}
|
|
37
|
-
function i(e) {
|
|
38
|
-
return e < 1 ? `${Math.round(e * 1e3)} m` : e < 10 ? `${e.toFixed(1)} km` : `${Math.round(e)} km`;
|
|
39
|
-
}
|
|
40
|
-
function a(e) {
|
|
41
|
-
if (e < 1) return "instant";
|
|
42
|
-
if (e < 60) return `${e} min`;
|
|
43
|
-
let t = Math.floor(e / 60), n = e % 60;
|
|
44
|
-
if (t < 24) return n === 0 ? `${t}h` : `${t}h ${n}min`;
|
|
45
|
-
let r = Math.floor(t / 24), i = t % 24;
|
|
46
|
-
return i === 0 ? `${r} day${r === 1 ? "" : "s"}` : `${r} day${r === 1 ? "" : "s"} ${i}h`;
|
|
47
|
-
}
|
|
48
56
|
//#endregion
|
|
49
|
-
export {
|
|
57
|
+
export { r as formatDate, a as formatNumber, e as formatPrice, i as formatRelativeTime, n as parseCsv, t as titleCase };
|
|
50
58
|
|
|
51
59
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":[],"sources":["../../../src/coolandlovely/utils/formatters.ts"],"sourcesContent":["/**\n * Formatting utilities for the CoolAndLovely microfrontend\n * @module coolandlovely/utils/formatters\n */\n\n/**\n * Format a number as
|
|
1
|
+
{"version":3,"file":"formatters.js","names":[],"sources":["../../../src/coolandlovely/utils/formatters.ts"],"sourcesContent":["/**\n * Formatting utilities for the CoolAndLovely microfrontend\n * @module coolandlovely/utils/formatters\n */\n\n/**\n * Format a number as currency. Defaults to USD but accepts any ISO currency\n * code (CoolAndLovely items/collaborations carry a per-record `currency`).\n *\n * @param amount - The numeric amount to format\n * @param currency - ISO 4217 currency code (defaults to \"USD\")\n * @param options - Optional Intl.NumberFormat options to override defaults\n * @returns Formatted currency string (e.g., \"$1,200.00\")\n *\n * @example\n * formatPrice(1200) // => \"$1,200.00\"\n * formatPrice(1200, 'EUR') // => \"€1,200.00\"\n * formatPrice(1200, 'INR', { minimumFractionDigits: 0 }) // => \"₹1,200\"\n */\nexport function formatPrice(\n amount: number,\n currency = 'USD',\n options?: Partial<Intl.NumberFormatOptions>\n): string {\n try {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n ...options,\n }).format(amount);\n } catch {\n // Unknown/invalid currency code → fall back to plain number + code.\n return `${currency} ${formatNumber(amount, { minimumFractionDigits: 2, maximumFractionDigits: 2, ...options })}`;\n }\n}\n\n/**\n * Format a number as currency (legacy alias kept for the shared export\n * surface). Defaults to USD; pass a currency code as the second arg.\n */\nexport function formatCurrency(\n amount: number,\n options?: Partial<Intl.NumberFormatOptions>\n): string {\n return formatPrice(amount, 'USD', options);\n}\n\n/**\n * Convert an UPPER_SNAKE_CASE enum value into a Title Case label.\n *\n * @example\n * titleCase('PENDING_REVIEW') // => \"Pending Review\"\n * titleCase('LIVE') // => \"Live\"\n */\nexport function titleCase(value: string): string {\n return value\n .toLowerCase()\n .replace(/_/g, ' ')\n .replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\n/**\n * Parse a comma-separated input into a trimmed, de-duplicated string array.\n * Empty entries are dropped. Returns `[]` for blank input.\n *\n * @example\n * parseCsv('minimal, Y2K , minimal') // => ['minimal', 'Y2K']\n */\nexport function parseCsv(input: string): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const raw of input.split(',')) {\n const v = raw.trim();\n if (v && !seen.has(v)) {\n seen.add(v);\n out.push(v);\n }\n }\n return out;\n}\n\n/**\n * Format a date string or Date object into a human-readable format\n *\n * @param date - ISO date string or Date object\n * @param options - Optional Intl.DateTimeFormat options\n * @returns Formatted date string (e.g., \"15 Jan 2024, 4:00 PM\")\n *\n * @example\n * formatDate('2024-01-15T10:30:00Z')\n * // => \"15 Jan 2024, 4:00 PM\" (in IST)\n */\nexport function formatDate(\n date: string | Date,\n options?: Partial<Intl.DateTimeFormatOptions>\n): string {\n const d = typeof date === 'string' ? new Date(date) : date;\n return new Intl.DateTimeFormat('en-IN', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n ...options,\n }).format(d);\n}\n\n/**\n * Format a date into a relative time string (e.g., \"2 hours ago\")\n *\n * @param date - ISO date string or Date object\n * @returns Human-readable relative time string\n *\n * @example\n * formatRelativeTime('2024-01-15T10:30:00Z') // => \"3 days ago\"\n * formatRelativeTime(new Date()) // => \"just now\"\n */\nexport function formatRelativeTime(date: string | Date): string {\n const d = typeof date === 'string' ? new Date(date) : date;\n const now = new Date();\n const diffMs = now.getTime() - d.getTime();\n const diffSeconds = Math.floor(diffMs / 1000);\n const diffMinutes = Math.floor(diffSeconds / 60);\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n const diffWeeks = Math.floor(diffDays / 7);\n const diffMonths = Math.floor(diffDays / 30);\n\n if (diffSeconds < 60) return 'just now';\n if (diffMinutes < 60) return `${diffMinutes} min${diffMinutes !== 1 ? 's' : ''} ago`;\n if (diffHours < 24) return `${diffHours} hour${diffHours !== 1 ? 's' : ''} ago`;\n if (diffDays < 7) return `${diffDays} day${diffDays !== 1 ? 's' : ''} ago`;\n if (diffWeeks < 4) return `${diffWeeks} week${diffWeeks !== 1 ? 's' : ''} ago`;\n if (diffMonths < 12) return `${diffMonths} month${diffMonths !== 1 ? 's' : ''} ago`;\n\n const diffYears = Math.floor(diffDays / 365);\n return `${diffYears} year${diffYears !== 1 ? 's' : ''} ago`;\n}\n\n/**\n * Format a number with Indian locale grouping (lakhs, crores)\n *\n * @param value - The number to format\n * @param options - Optional Intl.NumberFormat options\n * @returns Formatted number string (e.g., \"12,345\" or \"1,24,500\")\n *\n * @example\n * formatNumber(1245) // => \"1,245\"\n * formatNumber(124500) // => \"1,24,500\"\n */\nexport function formatNumber(value: number, options?: Partial<Intl.NumberFormatOptions>): string {\n return new Intl.NumberFormat('en-IN', options).format(value);\n}\n\n/**\n * Format a distance value in kilometers\n *\n * @param km - Distance in kilometers\n * @returns Formatted distance string\n *\n * @example\n * formatDistance(0.5) // => \"500 m\"\n * formatDistance(1.2) // => \"1.2 km\"\n * formatDistance(15) // => \"15 km\"\n */\nexport function formatDistance(km: number): string {\n if (km < 1) {\n return `${Math.round(km * 1000)} m`;\n }\n if (km < 10) {\n return `${km.toFixed(1)} km`;\n }\n return `${Math.round(km)} km`;\n}\n\n/**\n * Format a duration in minutes into a human-readable string\n *\n * @param minutes - Duration in minutes\n * @returns Formatted duration string\n *\n * @example\n * formatDuration(5) // => \"5 min\"\n * formatDuration(90) // => \"1h 30min\"\n * formatDuration(1440) // => \"1 day\"\n * formatDuration(4320) // => \"3 days\"\n */\nexport function formatDuration(minutes: number): string {\n if (minutes < 1) return 'instant';\n if (minutes < 60) return `${minutes} min`;\n\n const hours = Math.floor(minutes / 60);\n const remainingMinutes = minutes % 60;\n\n if (hours < 24) {\n if (remainingMinutes === 0) {\n return `${hours}h`;\n }\n return `${hours}h ${remainingMinutes}min`;\n }\n\n const days = Math.floor(hours / 24);\n const remainingHours = hours % 24;\n\n if (remainingHours === 0) {\n return `${days} day${days !== 1 ? 's' : ''}`;\n }\n return `${days} day${days !== 1 ? 's' : ''} ${remainingHours}h`;\n}\n"],"mappings":";AAmBA,SAAgB,EACd,GACA,IAAW,OACX,GACQ;AACR,KAAI;AACF,SAAO,IAAI,KAAK,aAAa,SAAS;GACpC,OAAO;GACP;GACA,uBAAuB;GACvB,uBAAuB;GACvB,GAAG;GACJ,CAAC,CAAC,OAAO,EAAO;SACX;AAEN,SAAO,GAAG,EAAS,GAAG,EAAa,GAAQ;GAAE,uBAAuB;GAAG,uBAAuB;GAAG,GAAG;GAAS,CAAC;;;AAsBlH,SAAgB,EAAU,GAAuB;AAC/C,QAAO,EACJ,aAAa,CACb,QAAQ,MAAM,IAAI,CAClB,QAAQ,UAAU,MAAS,EAAK,aAAa,CAAC;;AAUnD,SAAgB,EAAS,GAAyB;CAChD,IAAM,oBAAO,IAAI,KAAa,EACxB,IAAgB,EAAE;AACxB,MAAK,IAAM,KAAO,EAAM,MAAM,IAAI,EAAE;EAClC,IAAM,IAAI,EAAI,MAAM;AACpB,EAAI,KAAK,CAAC,EAAK,IAAI,EAAE,KACnB,EAAK,IAAI,EAAE,EACX,EAAI,KAAK,EAAE;;AAGf,QAAO;;AAcT,SAAgB,EACd,GACA,GACQ;CACR,IAAM,IAAI,OAAO,KAAS,WAAW,IAAI,KAAK,EAAK,GAAG;AACtD,QAAO,IAAI,KAAK,eAAe,SAAS;EACtC,KAAK;EACL,OAAO;EACP,MAAM;EACN,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,GAAG;EACJ,CAAC,CAAC,OAAO,EAAE;;AAad,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,IAAI,OAAO,KAAS,WAAW,IAAI,KAAK,EAAK,GAAG,GAEhD,qBADM,IAAI,MAAM,EACH,SAAS,GAAG,EAAE,SAAS,EACpC,IAAc,KAAK,MAAM,IAAS,IAAK,EACvC,IAAc,KAAK,MAAM,IAAc,GAAG,EAC1C,IAAY,KAAK,MAAM,IAAc,GAAG,EACxC,IAAW,KAAK,MAAM,IAAY,GAAG,EACrC,IAAY,KAAK,MAAM,IAAW,EAAE,EACpC,IAAa,KAAK,MAAM,IAAW,GAAG;AAE5C,KAAI,IAAc,GAAI,QAAO;AAC7B,KAAI,IAAc,GAAI,QAAO,GAAG,EAAY,MAAM,MAAgB,IAAU,KAAN,IAAS;AAC/E,KAAI,IAAY,GAAI,QAAO,GAAG,EAAU,OAAO,MAAc,IAAU,KAAN,IAAS;AAC1E,KAAI,IAAW,EAAG,QAAO,GAAG,EAAS,MAAM,MAAa,IAAU,KAAN,IAAS;AACrE,KAAI,IAAY,EAAG,QAAO,GAAG,EAAU,OAAO,MAAc,IAAU,KAAN,IAAS;AACzE,KAAI,IAAa,GAAI,QAAO,GAAG,EAAW,QAAQ,MAAe,IAAU,KAAN,IAAS;CAE9E,IAAM,IAAY,KAAK,MAAM,IAAW,IAAI;AAC5C,QAAO,GAAG,EAAU,OAAO,MAAc,IAAU,KAAN,IAAS;;AAcxD,SAAgB,EAAa,GAAe,GAAqD;AAC/F,QAAO,IAAI,KAAK,aAAa,SAAS,EAAQ,CAAC,OAAO,EAAM"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Briefcase as e, Crown as t, Footprints as n, Gem as r, Shirt as i, ShoppingBag as a, Sparkles as o, Tag as s, Watch as c } from "lucide-react";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
//#region src/coolandlovely/utils/icons.tsx
|
|
4
|
+
function u(u, d = 20) {
|
|
5
|
+
let f = { size: d };
|
|
6
|
+
switch (u) {
|
|
7
|
+
case "TOPS": return /* @__PURE__ */ l(i, { ...f });
|
|
8
|
+
case "BOTTOMS": return /* @__PURE__ */ l(e, { ...f });
|
|
9
|
+
case "DRESSES": return /* @__PURE__ */ l(t, { ...f });
|
|
10
|
+
case "OUTERWEAR": return /* @__PURE__ */ l(i, { ...f });
|
|
11
|
+
case "FOOTWEAR": return /* @__PURE__ */ l(n, { ...f });
|
|
12
|
+
case "BAGS": return /* @__PURE__ */ l(a, { ...f });
|
|
13
|
+
case "ACCESSORIES": return /* @__PURE__ */ l(c, { ...f });
|
|
14
|
+
case "JEWELLERY": return /* @__PURE__ */ l(r, { ...f });
|
|
15
|
+
case "BEAUTY": return /* @__PURE__ */ l(o, { ...f });
|
|
16
|
+
default: return /* @__PURE__ */ l(s, { ...f });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
var d = [
|
|
20
|
+
"TOPS",
|
|
21
|
+
"BOTTOMS",
|
|
22
|
+
"DRESSES",
|
|
23
|
+
"OUTERWEAR",
|
|
24
|
+
"FOOTWEAR",
|
|
25
|
+
"BAGS",
|
|
26
|
+
"ACCESSORIES",
|
|
27
|
+
"JEWELLERY",
|
|
28
|
+
"BEAUTY",
|
|
29
|
+
"OTHER"
|
|
30
|
+
];
|
|
31
|
+
//#endregion
|
|
32
|
+
export { d as STYLE_CATEGORIES, u as categoryIcon };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","names":[],"sources":["../../../src/coolandlovely/utils/icons.tsx"],"sourcesContent":["/**\n * Domain icon helpers\n * @module coolandlovely/utils\n *\n * Maps style categories to a representative lucide glyph so thumbnails and\n * filters share one source of truth.\n */\n\nimport type { ReactNode } from 'react';\nimport {\n Shirt,\n Footprints,\n Gem,\n Briefcase,\n Sparkles,\n Crown,\n Watch,\n ShoppingBag,\n Tag,\n} from 'lucide-react';\nimport type { CooStyleCategory } from '../types';\n\nexport function categoryIcon(category: CooStyleCategory, size = 20): ReactNode {\n const props = { size } as const;\n switch (category) {\n case 'TOPS':\n return <Shirt {...props} />;\n case 'BOTTOMS':\n return <Briefcase {...props} />;\n case 'DRESSES':\n return <Crown {...props} />;\n case 'OUTERWEAR':\n return <Shirt {...props} />;\n case 'FOOTWEAR':\n return <Footprints {...props} />;\n case 'BAGS':\n return <ShoppingBag {...props} />;\n case 'ACCESSORIES':\n return <Watch {...props} />;\n case 'JEWELLERY':\n return <Gem {...props} />;\n case 'BEAUTY':\n return <Sparkles {...props} />;\n case 'OTHER':\n default:\n return <Tag {...props} />;\n }\n}\n\nexport const STYLE_CATEGORIES: CooStyleCategory[] = [\n 'TOPS',\n 'BOTTOMS',\n 'DRESSES',\n 'OUTERWEAR',\n 'FOOTWEAR',\n 'BAGS',\n 'ACCESSORIES',\n 'JEWELLERY',\n 'BEAUTY',\n 'OTHER',\n];\n"],"mappings":";;;AAsBA,SAAgB,EAAa,GAA4B,IAAO,IAAe;CAC7E,IAAM,IAAQ,EAAE,SAAM;AACtB,SAAQ,GAAR;EACE,KAAK,OACH,QAAO,kBAAC,GAAD,EAAO,GAAI,GAAS,CAAA;EAC7B,KAAK,UACH,QAAO,kBAAC,GAAD,EAAW,GAAI,GAAS,CAAA;EACjC,KAAK,UACH,QAAO,kBAAC,GAAD,EAAO,GAAI,GAAS,CAAA;EAC7B,KAAK,YACH,QAAO,kBAAC,GAAD,EAAO,GAAI,GAAS,CAAA;EAC7B,KAAK,WACH,QAAO,kBAAC,GAAD,EAAY,GAAI,GAAS,CAAA;EAClC,KAAK,OACH,QAAO,kBAAC,GAAD,EAAa,GAAI,GAAS,CAAA;EACnC,KAAK,cACH,QAAO,kBAAC,GAAD,EAAO,GAAI,GAAS,CAAA;EAC7B,KAAK,YACH,QAAO,kBAAC,GAAD,EAAK,GAAI,GAAS,CAAA;EAC3B,KAAK,SACH,QAAO,kBAAC,GAAD,EAAU,GAAI,GAAS,CAAA;EAEhC,QACE,QAAO,kBAAC,GAAD,EAAK,GAAI,GAAS,CAAA;;;AAI/B,IAAa,IAAuC;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CoolAndLovelyProvider as e, useCoolAndLovely as t } from "./coolandlovely/context/CoolAndLovelyContext.js";
|
|
2
2
|
import { cn as n } from "./coolandlovely/utils/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
import { CoolAndLovelyRoot as
|
|
5
|
-
import { useCoolAndLovelyStore as
|
|
3
|
+
import { formatDate as r, formatNumber as i, formatPrice as a, formatRelativeTime as o, titleCase as s } from "./coolandlovely/utils/formatters.js";
|
|
4
|
+
import { CoolAndLovelyRoot as c } from "./coolandlovely/CoolAndLovelyRoot.js";
|
|
5
|
+
import { useCoolAndLovelyStore as l } from "./coolandlovely/store/coolandlovelyStore.js";
|
|
6
6
|
import "./coolandlovely/index.js";
|
|
7
|
-
export { e as CoolAndLovelyProvider,
|
|
7
|
+
export { e as CoolAndLovelyProvider, c as CoolAndLovelyRoot, n as cn, r as formatDate, i as formatNumber, a as formatPrice, o as formatRelativeTime, s as titleCase, t as useCoolAndLovely, l as useCoolAndLovelyStore };
|
package/package.json
CHANGED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { cn as e } from "../utils/cn.js";
|
|
2
|
-
import { StatusBadge as t } from "./StatusBadge.js";
|
|
3
|
-
import { AlertTriangle as n, Shield as r, TrendingUp as i } from "lucide-react";
|
|
4
|
-
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
-
import { GlassCard as s } from "@burdenoff/fe-libs/ui";
|
|
6
|
-
//#region src/coolandlovely/components/InvestmentCard.tsx
|
|
7
|
-
var c = {
|
|
8
|
-
low: {
|
|
9
|
-
label: "Low Risk",
|
|
10
|
-
icon: r,
|
|
11
|
-
color: "text-status-success-text"
|
|
12
|
-
},
|
|
13
|
-
medium: {
|
|
14
|
-
label: "Medium Risk",
|
|
15
|
-
icon: n,
|
|
16
|
-
color: "text-status-warning-text"
|
|
17
|
-
},
|
|
18
|
-
high: {
|
|
19
|
-
label: "High Risk",
|
|
20
|
-
icon: n,
|
|
21
|
-
color: "text-status-error-text"
|
|
22
|
-
}
|
|
23
|
-
}, l = ({ id: n, cartName: r, targetAmount: l, raisedAmount: u, currency: d = "INR", expectedReturns: f, riskLevel: p, status: m, onClick: h, className: g }) => {
|
|
24
|
-
let _ = l > 0 ? Math.min(u / l * 100, 100) : 0, v = c[p], y = v.icon, b = (e) => new Intl.NumberFormat(void 0, {
|
|
25
|
-
style: "currency",
|
|
26
|
-
currency: d,
|
|
27
|
-
maximumFractionDigits: 0
|
|
28
|
-
}).format(e);
|
|
29
|
-
return /* @__PURE__ */ o(s, {
|
|
30
|
-
role: "button",
|
|
31
|
-
tabIndex: 0,
|
|
32
|
-
"aria-label": `Investment in ${r}`,
|
|
33
|
-
onClick: () => h?.(n),
|
|
34
|
-
onKeyDown: (e) => {
|
|
35
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h?.(n));
|
|
36
|
-
},
|
|
37
|
-
className: e("border-border-seam p-4 cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", g),
|
|
38
|
-
children: [
|
|
39
|
-
/* @__PURE__ */ o("div", {
|
|
40
|
-
className: "flex items-start justify-between",
|
|
41
|
-
children: [/* @__PURE__ */ a("h3", {
|
|
42
|
-
className: "text-base font-semibold text-text-primary truncate",
|
|
43
|
-
children: r
|
|
44
|
-
}), /* @__PURE__ */ a(t, { status: m })]
|
|
45
|
-
}),
|
|
46
|
-
/* @__PURE__ */ o("div", {
|
|
47
|
-
className: "mt-4",
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ o("div", {
|
|
50
|
-
className: "flex items-center justify-between text-sm",
|
|
51
|
-
children: [/* @__PURE__ */ a("span", {
|
|
52
|
-
className: "text-text-secondary",
|
|
53
|
-
children: "Raised"
|
|
54
|
-
}), /* @__PURE__ */ o("span", {
|
|
55
|
-
className: "font-medium text-text-primary tabular-nums",
|
|
56
|
-
children: [Math.round(_), "%"]
|
|
57
|
-
})]
|
|
58
|
-
}),
|
|
59
|
-
/* @__PURE__ */ a("div", {
|
|
60
|
-
className: "mt-1.5 h-2 w-full rounded-full bg-bg-sunken overflow-hidden",
|
|
61
|
-
children: /* @__PURE__ */ a("div", {
|
|
62
|
-
className: "h-full rounded-full bg-action-primary-bg transition-all duration-300",
|
|
63
|
-
style: { width: `${_}%` }
|
|
64
|
-
})
|
|
65
|
-
}),
|
|
66
|
-
/* @__PURE__ */ o("div", {
|
|
67
|
-
className: "mt-1.5 flex items-center justify-between text-xs text-text-secondary tabular-nums",
|
|
68
|
-
children: [/* @__PURE__ */ a("span", { children: b(u) }), /* @__PURE__ */ a("span", { children: b(l) })]
|
|
69
|
-
})
|
|
70
|
-
]
|
|
71
|
-
}),
|
|
72
|
-
/* @__PURE__ */ o("div", {
|
|
73
|
-
className: "mt-4 flex items-center justify-between",
|
|
74
|
-
children: [/* @__PURE__ */ o("div", {
|
|
75
|
-
className: "flex items-center gap-1.5 text-sm",
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ a(i, { className: "h-3.5 w-3.5 text-status-success-text" }),
|
|
78
|
-
/* @__PURE__ */ a("span", {
|
|
79
|
-
className: "font-medium text-text-primary tabular-nums",
|
|
80
|
-
children: f
|
|
81
|
-
}),
|
|
82
|
-
/* @__PURE__ */ a("span", {
|
|
83
|
-
className: "text-text-secondary",
|
|
84
|
-
children: "returns"
|
|
85
|
-
})
|
|
86
|
-
]
|
|
87
|
-
}), /* @__PURE__ */ o("div", {
|
|
88
|
-
className: e("flex items-center gap-1 text-xs font-medium", v.color),
|
|
89
|
-
children: [/* @__PURE__ */ a(y, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ a("span", { children: v.label })]
|
|
90
|
-
})]
|
|
91
|
-
})
|
|
92
|
-
]
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
//#endregion
|
|
96
|
-
export { l as InvestmentCard };
|
|
97
|
-
|
|
98
|
-
//# sourceMappingURL=InvestmentCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InvestmentCard.js","names":[],"sources":["../../../src/coolandlovely/components/InvestmentCard.tsx"],"sourcesContent":["/**\n * Investment Card Component\n * @module coolandlovely/components\n *\n * Displays an investment opportunity with cart name, target/raised amounts,\n * progress bar, expected returns, risk level, and status.\n */\n\nimport type { FC } from 'react';\nimport { TrendingUp, AlertTriangle, Shield } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\nimport { StatusBadge } from './StatusBadge';\nimport type { InvestmentStatus, RiskLevel } from '../types';\n\ninterface InvestmentCardProps {\n id: string;\n cartName: string;\n targetAmount: number;\n raisedAmount: number;\n currency?: string;\n expectedReturns: string;\n riskLevel: RiskLevel;\n status: InvestmentStatus;\n onClick?: (id: string) => void;\n className?: string;\n}\n\nconst riskConfig: Record<RiskLevel, { label: string; icon: typeof Shield; color: string }> = {\n low: {\n label: 'Low Risk',\n icon: Shield,\n color: 'text-status-success-text',\n },\n medium: {\n label: 'Medium Risk',\n icon: AlertTriangle,\n color: 'text-status-warning-text',\n },\n high: {\n label: 'High Risk',\n icon: AlertTriangle,\n color: 'text-status-error-text',\n },\n};\n\nexport const InvestmentCard: FC<InvestmentCardProps> = ({\n id,\n cartName,\n targetAmount,\n raisedAmount,\n currency = 'INR',\n expectedReturns,\n riskLevel,\n status,\n onClick,\n className,\n}) => {\n const progress = targetAmount > 0 ? Math.min((raisedAmount / targetAmount) * 100, 100) : 0;\n const risk = riskConfig[riskLevel];\n const RiskIcon = risk.icon;\n\n const formatAmount = (amount: number) =>\n new Intl.NumberFormat(undefined, {\n style: 'currency',\n currency,\n maximumFractionDigits: 0,\n }).format(amount);\n\n return (\n <GlassCard\n role=\"button\"\n tabIndex={0}\n aria-label={`Investment in ${cartName}`}\n onClick={() => onClick?.(id)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(id);\n }\n }}\n className={cn(\n 'border-border-seam p-4 cursor-pointer',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]',\n className\n )}\n >\n {/* Header */}\n <div className=\"flex items-start justify-between\">\n <h3 className=\"text-base font-semibold text-text-primary truncate\">{cartName}</h3>\n <StatusBadge status={status} />\n </div>\n\n {/* Progress Bar */}\n <div className=\"mt-4\">\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-secondary\">Raised</span>\n <span className=\"font-medium text-text-primary tabular-nums\">{Math.round(progress)}%</span>\n </div>\n <div className=\"mt-1.5 h-2 w-full rounded-full bg-bg-sunken overflow-hidden\">\n <div\n className=\"h-full rounded-full bg-action-primary-bg transition-all duration-300\"\n style={{ width: `${progress}%` }}\n />\n </div>\n <div className=\"mt-1.5 flex items-center justify-between text-xs text-text-secondary tabular-nums\">\n <span>{formatAmount(raisedAmount)}</span>\n <span>{formatAmount(targetAmount)}</span>\n </div>\n </div>\n\n {/* Details */}\n <div className=\"mt-4 flex items-center justify-between\">\n <div className=\"flex items-center gap-1.5 text-sm\">\n <TrendingUp className=\"h-3.5 w-3.5 text-status-success-text\" />\n <span className=\"font-medium text-text-primary tabular-nums\">{expectedReturns}</span>\n <span className=\"text-text-secondary\">returns</span>\n </div>\n <div className={cn('flex items-center gap-1 text-xs font-medium', risk.color)}>\n <RiskIcon className=\"h-3.5 w-3.5\" />\n <span>{risk.label}</span>\n </div>\n </div>\n </GlassCard>\n );\n};\n"],"mappings":";;;;;;AA4BA,IAAM,IAAuF;CAC3F,KAAK;EACH,OAAO;EACP,MAAM;EACN,OAAO;EACR;CACD,QAAQ;EACN,OAAO;EACP,MAAM;EACN,OAAO;EACR;CACD,MAAM;EACJ,OAAO;EACP,MAAM;EACN,OAAO;EACR;CACF,EAEY,KAA2C,EACtD,OACA,aACA,iBACA,iBACA,cAAW,OACX,oBACA,cACA,WACA,YACA,mBACI;CACJ,IAAM,IAAW,IAAe,IAAI,KAAK,IAAK,IAAe,IAAgB,KAAK,IAAI,GAAG,GACnF,IAAO,EAAW,IAClB,IAAW,EAAK,MAEhB,KAAgB,MACpB,IAAI,KAAK,aAAa,KAAA,GAAW;EAC/B,OAAO;EACP;EACA,uBAAuB;EACxB,CAAC,CAAC,OAAO,EAAO;AAEnB,QACE,kBAAC,GAAD;EACE,MAAK;EACL,UAAU;EACV,cAAY,iBAAiB;EAC7B,eAAe,IAAU,EAAG;EAC5B,YAAY,MAAM;AAChB,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,IAAU,EAAG;;EAGjB,WAAW,EACT,yCACA,gGACA,EACD;YAfH;GAkBE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,MAAD;KAAI,WAAU;eAAsD;KAAc,CAAA,EAClF,kBAAC,GAAD,EAAqB,WAAU,CAAA,CAC3B;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,QAAD;OAAM,WAAU;iBAAsB;OAAa,CAAA,EACnD,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CAA8D,KAAK,MAAM,EAAS,EAAC,IAAQ;SACvF;;KACN,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,OAAD;OACE,WAAU;OACV,OAAO,EAAE,OAAO,GAAG,EAAS,IAAI;OAChC,CAAA;MACE,CAAA;KACN,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,QAAD,EAAA,UAAO,EAAa,EAAa,EAAQ,CAAA,EACzC,kBAAC,QAAD,EAAA,UAAO,EAAa,EAAa,EAAQ,CAAA,CACrC;;KACF;;GAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,GAAD,EAAY,WAAU,wCAAyC,CAAA;MAC/D,kBAAC,QAAD;OAAM,WAAU;iBAA8C;OAAuB,CAAA;MACrF,kBAAC,QAAD;OAAM,WAAU;iBAAsB;OAAc,CAAA;MAChD;QACN,kBAAC,OAAD;KAAK,WAAW,EAAG,+CAA+C,EAAK,MAAM;eAA7E,CACE,kBAAC,GAAD,EAAU,WAAU,eAAgB,CAAA,EACpC,kBAAC,QAAD,EAAA,UAAO,EAAK,OAAa,CAAA,CACrB;OACF;;GACI"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { cn as e } from "../utils/cn.js";
|
|
2
|
-
import { Star as t } from "lucide-react";
|
|
3
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
-
//#region src/coolandlovely/components/RatingDisplay.tsx
|
|
5
|
-
var i = ({ value: i, count: a, maxStars: o = 5, size: s = "sm", className: c }) => {
|
|
6
|
-
let l = s === "sm" ? "h-3.5 w-3.5" : "h-4.5 w-4.5", u = Math.min(Math.max(i, 0), o);
|
|
7
|
-
return /* @__PURE__ */ r("div", {
|
|
8
|
-
className: e("flex items-center gap-1", c),
|
|
9
|
-
children: [
|
|
10
|
-
/* @__PURE__ */ n("div", {
|
|
11
|
-
className: "flex items-center",
|
|
12
|
-
children: Array.from({ length: o }, (r, i) => {
|
|
13
|
-
let a = i < Math.floor(u);
|
|
14
|
-
return /* @__PURE__ */ n(t, { className: e(l, a ? "fill-status-warning-text text-status-warning-text" : !a && i < u ? "fill-status-warning-text/50 text-status-warning-text" : "fill-none text-text-secondary/40") }, i);
|
|
15
|
-
})
|
|
16
|
-
}),
|
|
17
|
-
/* @__PURE__ */ n("span", {
|
|
18
|
-
className: "text-xs font-medium text-text-primary tabular-nums",
|
|
19
|
-
children: u.toFixed(1)
|
|
20
|
-
}),
|
|
21
|
-
a !== void 0 && /* @__PURE__ */ r("span", {
|
|
22
|
-
className: "text-xs text-text-secondary tabular-nums",
|
|
23
|
-
children: [
|
|
24
|
-
"(",
|
|
25
|
-
a,
|
|
26
|
-
")"
|
|
27
|
-
]
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
33
|
-
export { i as RatingDisplay };
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=RatingDisplay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RatingDisplay.js","names":[],"sources":["../../../src/coolandlovely/components/RatingDisplay.tsx"],"sourcesContent":["/**\n * Rating Display Component\n * @module coolandlovely/components\n *\n * Star rating display with value and review count.\n */\n\nimport type { FC } from 'react';\nimport { Star } from 'lucide-react';\nimport { cn } from '../utils/cn';\n\ninterface RatingDisplayProps {\n value: number;\n count?: number;\n maxStars?: number;\n size?: 'sm' | 'md';\n className?: string;\n}\n\nexport const RatingDisplay: FC<RatingDisplayProps> = ({\n value,\n count,\n maxStars = 5,\n size = 'sm',\n className,\n}) => {\n const starSize = size === 'sm' ? 'h-3.5 w-3.5' : 'h-4.5 w-4.5';\n const clampedValue = Math.min(Math.max(value, 0), maxStars);\n\n return (\n <div className={cn('flex items-center gap-1', className)}>\n <div className=\"flex items-center\">\n {Array.from({ length: maxStars }, (_, i) => {\n const filled = i < Math.floor(clampedValue);\n const halfFilled = !filled && i < clampedValue;\n\n return (\n <Star\n key={i}\n className={cn(\n starSize,\n filled\n ? 'fill-status-warning-text text-status-warning-text'\n : halfFilled\n ? 'fill-status-warning-text/50 text-status-warning-text'\n : 'fill-none text-text-secondary/40'\n )}\n />\n );\n })}\n </div>\n <span className=\"text-xs font-medium text-text-primary tabular-nums\">\n {clampedValue.toFixed(1)}\n </span>\n {count !== undefined && (\n <span className=\"text-xs text-text-secondary tabular-nums\">({count})</span>\n )}\n </div>\n );\n};\n"],"mappings":";;;;AAmBA,IAAa,KAAyC,EACpD,UACA,UACA,cAAW,GACX,UAAO,MACP,mBACI;CACJ,IAAM,IAAW,MAAS,OAAO,gBAAgB,eAC3C,IAAe,KAAK,IAAI,KAAK,IAAI,GAAO,EAAE,EAAE,EAAS;AAE3D,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,2BAA2B,EAAU;YAAxD;GACE,kBAAC,OAAD;IAAK,WAAU;cACZ,MAAM,KAAK,EAAE,QAAQ,GAAU,GAAG,GAAG,MAAM;KAC1C,IAAM,IAAS,IAAI,KAAK,MAAM,EAAa;AAG3C,YACE,kBAAC,GAAD,EAEE,WAAW,EACT,GACA,IACI,sDARS,CAAC,KAAU,IAAI,IAUtB,yDACA,mCACP,EACD,EATK,EASL;MAEJ;IACE,CAAA;GACN,kBAAC,QAAD;IAAM,WAAU;cACb,EAAa,QAAQ,EAAE;IACnB,CAAA;GACN,MAAU,KAAA,KACT,kBAAC,QAAD;IAAM,WAAU;cAAhB;KAA2D;KAAE;KAAM;KAAQ;;GAEzE"}
|