@appcorp/shadcn 2.0.0 → 2.0.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/components/app-sidebar.js +1 -34
- package/components/audio.js +1 -13
- package/components/dashboard.js +1 -29
- package/components/drawer-generic.js +1 -39
- package/components/enhanced-checkbox.js +1 -39
- package/components/enhanced-combobox.js +1 -271
- package/components/enhanced-drawer-footer.js +1 -30
- package/components/enhanced-drawer-header.js +1 -7
- package/components/enhanced-dropzone-impl.js +1 -218
- package/components/enhanced-dropzone.js +1 -8
- package/components/enhanced-input.js +1 -40
- package/components/enhanced-label.js +1 -22
- package/components/enhanced-radio.js +1 -15
- package/components/enhanced-select.js +1 -33
- package/components/enhanced-slider.js +1 -33
- package/components/enhanced-switch.js +1 -42
- package/components/enhanced-table-footer-action.js +1 -102
- package/components/enhanced-table-footer-page.js +1 -124
- package/components/enhanced-table-footer-pagination.js +1 -108
- package/components/enhanced-table-header-action.js +1 -32
- package/components/enhanced-table-header-search.js +1 -10
- package/components/enhanced-table.js +1 -301
- package/components/enhanced-textarea.js +1 -40
- package/components/field.js +1 -96
- package/components/image-resize-dialog.js +1 -82
- package/components/nav-main.js +1 -40
- package/components/nav-projects.js +1 -39
- package/components/nav-user.js +1 -52
- package/components/show-toast.js +1 -7
- package/components/sidebar.js +1 -257
- package/components/team-switcher.js +1 -42
- package/components/theme-provider.js +1 -112
- package/components/timeline.js +1 -13
- package/components/tooltip.js +1 -36
- package/components/ui/accordion.js +1 -37
- package/components/ui/alert-dialog.js +1 -63
- package/components/ui/alert.js +1 -41
- package/components/ui/area-chart-v1-impl.js +1 -75
- package/components/ui/area-chart-v1.js +1 -5
- package/components/ui/aspect-ratio.js +1 -4
- package/components/ui/avatar.js +1 -31
- package/components/ui/badge.js +1 -32
- package/components/ui/breadcrumb.js +1 -54
- package/components/ui/button.js +1 -44
- package/components/ui/calendar-impl.js +1 -55
- package/components/ui/calendar.js +1 -6
- package/components/ui/card.js +1 -44
- package/components/ui/carousel-impl.js +1 -117
- package/components/ui/carousel.js +1 -9
- package/components/ui/chart-impl.js +6 -161
- package/components/ui/chart.js +1 -10
- package/components/ui/checkbox.js +1 -24
- package/components/ui/collapsible.js +1 -6
- package/components/ui/combobox.js +1 -52
- package/components/ui/command-impl.js +1 -63
- package/components/ui/command.js +1 -13
- package/components/ui/context-menu.js +1 -80
- package/components/ui/dialog.js +1 -57
- package/components/ui/drawer-impl.js +1 -56
- package/components/ui/drawer.js +1 -14
- package/components/ui/dropdown-menu.js +1 -82
- package/components/ui/form.d.ts +1 -1
- package/components/ui/form.js +1 -78
- package/components/ui/hover-card.js +1 -23
- package/components/ui/input-otp-impl.js +1 -43
- package/components/ui/input-otp.js +1 -8
- package/components/ui/input.js +1 -19
- package/components/ui/label.js +1 -23
- package/components/ui/language-selector.js +1 -25
- package/components/ui/menubar.js +1 -103
- package/components/ui/navigation-menu.js +1 -59
- package/components/ui/pagination.js +1 -60
- package/components/ui/popover.js +1 -25
- package/components/ui/progress.js +1 -22
- package/components/ui/radio-group.js +1 -29
- package/components/ui/resizable-impl.js +1 -27
- package/components/ui/resizable.js +1 -7
- package/components/ui/scroll-area.js +1 -32
- package/components/ui/select.js +1 -71
- package/components/ui/separator.js +1 -21
- package/components/ui/sheet.js +1 -71
- package/components/ui/skeleton.js +1 -18
- package/components/ui/slider.js +1 -32
- package/components/ui/sonner.js +1 -28
- package/components/ui/switch.js +1 -22
- package/components/ui/table.js +1 -55
- package/components/ui/tabs.js +1 -32
- package/components/ui/textarea.js +1 -19
- package/components/ui/theme-switcher.js +1 -102
- package/components/ui/toggle.js +1 -39
- package/data/admin-dashboard.js +1 -301
- package/hooks/use-enhanced-combobox.js +1 -73
- package/hooks/use-mobile.js +1 -15
- package/hooks/use-outside-click.js +1 -19
- package/lib/themes.js +1 -147
- package/lib/toast-utils.js +1 -170
- package/lib/utils.js +1 -5
- package/package.json +2 -2
- package/utils/transform-breadcrumbs.js +1 -7
- package/utils/transform-navitems.js +1 -18
package/data/admin-dashboard.js
CHANGED
|
@@ -1,301 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const adminDashboardData = {
|
|
3
|
-
apps: [
|
|
4
|
-
{
|
|
5
|
-
name: "Analytics",
|
|
6
|
-
url: "#",
|
|
7
|
-
icon: PieChart,
|
|
8
|
-
enabled: true,
|
|
9
|
-
order: 1,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: "Terminal",
|
|
13
|
-
url: "#",
|
|
14
|
-
icon: SquareTerminal,
|
|
15
|
-
enabled: true,
|
|
16
|
-
order: 2,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
offerUrl: "/offer",
|
|
20
|
-
username: "Muntazim",
|
|
21
|
-
email: "admin@company.com",
|
|
22
|
-
avatar: "https://www.w3schools.com/w3images/avatar6.png",
|
|
23
|
-
showLanguageSelector: true,
|
|
24
|
-
handleSignOut: () => console.log("Sign out"),
|
|
25
|
-
clearBrowserCache: () => console.log("Clear browser cache"),
|
|
26
|
-
profiles: [
|
|
27
|
-
{
|
|
28
|
-
name: "Subhan",
|
|
29
|
-
avatar: "https://www.w3schools.com/w3images/avatar6.png",
|
|
30
|
-
age: "3 Yrs",
|
|
31
|
-
enabled: true,
|
|
32
|
-
order: 1,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "Mustajab",
|
|
36
|
-
avatar: "https://www.w3schools.com/w3images/avatar6.png",
|
|
37
|
-
age: "4 Yrs",
|
|
38
|
-
enabled: false,
|
|
39
|
-
order: 2,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
navItems: [
|
|
43
|
-
{
|
|
44
|
-
title: "Dashboard",
|
|
45
|
-
url: "/dashboard",
|
|
46
|
-
icon: SquareTerminal,
|
|
47
|
-
isActive: false,
|
|
48
|
-
enabled: true,
|
|
49
|
-
order: 1,
|
|
50
|
-
subItems: [],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
title: "Flashcard Category",
|
|
54
|
-
url: "#",
|
|
55
|
-
icon: Bot,
|
|
56
|
-
isActive: true,
|
|
57
|
-
enabled: true,
|
|
58
|
-
order: 2,
|
|
59
|
-
subItems: [
|
|
60
|
-
{
|
|
61
|
-
title: "Manage",
|
|
62
|
-
url: "",
|
|
63
|
-
isActive: true,
|
|
64
|
-
enabled: true,
|
|
65
|
-
order: 1,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
title: "Toddler / Early childhood",
|
|
69
|
-
url: "#",
|
|
70
|
-
isActive: false,
|
|
71
|
-
enabled: true,
|
|
72
|
-
order: 2,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
title: "Preschool / Pre-kindergarten",
|
|
76
|
-
url: "#",
|
|
77
|
-
isActive: false,
|
|
78
|
-
enabled: true,
|
|
79
|
-
order: 3,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
title: "Kindergarten",
|
|
83
|
-
url: "#",
|
|
84
|
-
isActive: false,
|
|
85
|
-
enabled: true,
|
|
86
|
-
order: 4,
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
title: "Grade / Standard 1",
|
|
90
|
-
url: "#",
|
|
91
|
-
isActive: false,
|
|
92
|
-
enabled: true,
|
|
93
|
-
order: 5,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
title: "Grade / Standard 2",
|
|
97
|
-
url: "#",
|
|
98
|
-
isActive: false,
|
|
99
|
-
enabled: true,
|
|
100
|
-
order: 6,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
title: "Grade / Standard 3",
|
|
104
|
-
url: "#",
|
|
105
|
-
isActive: false,
|
|
106
|
-
enabled: true,
|
|
107
|
-
order: 7,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
title: "Grade / Standard 4",
|
|
111
|
-
url: "#",
|
|
112
|
-
isActive: false,
|
|
113
|
-
enabled: true,
|
|
114
|
-
order: 8,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
title: "Grade / Standard 5",
|
|
118
|
-
url: "#",
|
|
119
|
-
isActive: false,
|
|
120
|
-
enabled: true,
|
|
121
|
-
order: 9,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
title: "Flashcard",
|
|
127
|
-
url: "#",
|
|
128
|
-
icon: Bot,
|
|
129
|
-
isActive: false,
|
|
130
|
-
enabled: true,
|
|
131
|
-
order: 3,
|
|
132
|
-
subItems: [
|
|
133
|
-
{
|
|
134
|
-
title: "Toddler / Early childhood",
|
|
135
|
-
url: "#",
|
|
136
|
-
isActive: false,
|
|
137
|
-
enabled: true,
|
|
138
|
-
order: 1,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
title: "Preschool / Pre-kindergarten",
|
|
142
|
-
url: "#",
|
|
143
|
-
isActive: false,
|
|
144
|
-
enabled: true,
|
|
145
|
-
order: 2,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
title: "Kindergarten",
|
|
149
|
-
url: "#",
|
|
150
|
-
isActive: false,
|
|
151
|
-
enabled: true,
|
|
152
|
-
order: 3,
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
title: "Grade / Standard 1",
|
|
156
|
-
url: "#",
|
|
157
|
-
isActive: false,
|
|
158
|
-
enabled: true,
|
|
159
|
-
order: 4,
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
title: "Grade / Standard 2",
|
|
163
|
-
url: "#",
|
|
164
|
-
isActive: false,
|
|
165
|
-
enabled: true,
|
|
166
|
-
order: 5,
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
title: "Grade / Standard 3",
|
|
170
|
-
url: "#",
|
|
171
|
-
isActive: false,
|
|
172
|
-
enabled: true,
|
|
173
|
-
order: 6,
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
title: "Grade / Standard 4",
|
|
177
|
-
url: "#",
|
|
178
|
-
isActive: false,
|
|
179
|
-
enabled: true,
|
|
180
|
-
order: 7,
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
title: "Grade / Standard 5",
|
|
184
|
-
url: "#",
|
|
185
|
-
isActive: false,
|
|
186
|
-
enabled: true,
|
|
187
|
-
order: 8,
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
title: "Quizzes",
|
|
193
|
-
url: "#",
|
|
194
|
-
icon: BookOpen,
|
|
195
|
-
isActive: false,
|
|
196
|
-
enabled: true,
|
|
197
|
-
order: 4,
|
|
198
|
-
subItems: [
|
|
199
|
-
{
|
|
200
|
-
title: "Introduction",
|
|
201
|
-
url: "#",
|
|
202
|
-
isActive: false,
|
|
203
|
-
enabled: true,
|
|
204
|
-
order: 1,
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
title: "Get Started",
|
|
208
|
-
url: "#",
|
|
209
|
-
isActive: false,
|
|
210
|
-
enabled: true,
|
|
211
|
-
order: 2,
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
title: "Tutorials",
|
|
215
|
-
url: "#",
|
|
216
|
-
isActive: false,
|
|
217
|
-
enabled: true,
|
|
218
|
-
order: 3,
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
title: "Changelog",
|
|
222
|
-
url: "#",
|
|
223
|
-
isActive: false,
|
|
224
|
-
enabled: true,
|
|
225
|
-
order: 4,
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
title: "Settings",
|
|
231
|
-
url: "#",
|
|
232
|
-
icon: Settings2,
|
|
233
|
-
isActive: false,
|
|
234
|
-
enabled: true,
|
|
235
|
-
order: 5,
|
|
236
|
-
subItems: [
|
|
237
|
-
{
|
|
238
|
-
title: "General",
|
|
239
|
-
url: "#",
|
|
240
|
-
isActive: false,
|
|
241
|
-
enabled: true,
|
|
242
|
-
order: 1,
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
title: "Kids",
|
|
246
|
-
url: "#",
|
|
247
|
-
isActive: false,
|
|
248
|
-
enabled: true,
|
|
249
|
-
order: 2,
|
|
250
|
-
},
|
|
251
|
-
],
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
footerNavItems: [
|
|
255
|
-
{
|
|
256
|
-
title: "Upgrade to Pro",
|
|
257
|
-
url: "#",
|
|
258
|
-
icon: Sparkles,
|
|
259
|
-
isActive: false,
|
|
260
|
-
enabled: true,
|
|
261
|
-
order: 1,
|
|
262
|
-
subItems: [],
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
title: "Divider",
|
|
266
|
-
url: "#",
|
|
267
|
-
icon: Sparkles,
|
|
268
|
-
isActive: false,
|
|
269
|
-
enabled: true,
|
|
270
|
-
order: 2,
|
|
271
|
-
subItems: [],
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
title: "Account",
|
|
275
|
-
url: "#",
|
|
276
|
-
icon: BadgeCheck,
|
|
277
|
-
isActive: false,
|
|
278
|
-
enabled: true,
|
|
279
|
-
order: 3,
|
|
280
|
-
subItems: [],
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
title: "Billing",
|
|
284
|
-
url: "#",
|
|
285
|
-
icon: CreditCard,
|
|
286
|
-
isActive: false,
|
|
287
|
-
enabled: true,
|
|
288
|
-
order: 4,
|
|
289
|
-
subItems: [],
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
title: "Notifications",
|
|
293
|
-
url: "#",
|
|
294
|
-
icon: Bell,
|
|
295
|
-
isActive: false,
|
|
296
|
-
enabled: true,
|
|
297
|
-
order: 5,
|
|
298
|
-
subItems: [],
|
|
299
|
-
},
|
|
300
|
-
],
|
|
301
|
-
};
|
|
1
|
+
"use strict";import{BadgeCheck as a,Bell as l,BookOpen as i,Bot as e,CreditCard as d,PieChart as s,Settings2 as o,Sparkles as r,SquareTerminal as t}from"lucide-react";export const adminDashboardData={apps:[{name:"Analytics",url:"#",icon:s,enabled:!0,order:1},{name:"Terminal",url:"#",icon:t,enabled:!0,order:2}],offerUrl:"/offer",username:"Muntazim",email:"admin@company.com",avatar:"https://www.w3schools.com/w3images/avatar6.png",showLanguageSelector:!0,handleSignOut:()=>console.log("Sign out"),clearBrowserCache:()=>console.log("Clear browser cache"),profiles:[{name:"Subhan",avatar:"https://www.w3schools.com/w3images/avatar6.png",age:"3 Yrs",enabled:!0,order:1},{name:"Mustajab",avatar:"https://www.w3schools.com/w3images/avatar6.png",age:"4 Yrs",enabled:!1,order:2}],navItems:[{title:"Dashboard",url:"/dashboard",icon:t,isActive:!1,enabled:!0,order:1,subItems:[]},{title:"Flashcard Category",url:"#",icon:e,isActive:!0,enabled:!0,order:2,subItems:[{title:"Manage",url:"",isActive:!0,enabled:!0,order:1},{title:"Toddler / Early childhood",url:"#",isActive:!1,enabled:!0,order:2},{title:"Preschool / Pre-kindergarten",url:"#",isActive:!1,enabled:!0,order:3},{title:"Kindergarten",url:"#",isActive:!1,enabled:!0,order:4},{title:"Grade / Standard 1",url:"#",isActive:!1,enabled:!0,order:5},{title:"Grade / Standard 2",url:"#",isActive:!1,enabled:!0,order:6},{title:"Grade / Standard 3",url:"#",isActive:!1,enabled:!0,order:7},{title:"Grade / Standard 4",url:"#",isActive:!1,enabled:!0,order:8},{title:"Grade / Standard 5",url:"#",isActive:!1,enabled:!0,order:9}]},{title:"Flashcard",url:"#",icon:e,isActive:!1,enabled:!0,order:3,subItems:[{title:"Toddler / Early childhood",url:"#",isActive:!1,enabled:!0,order:1},{title:"Preschool / Pre-kindergarten",url:"#",isActive:!1,enabled:!0,order:2},{title:"Kindergarten",url:"#",isActive:!1,enabled:!0,order:3},{title:"Grade / Standard 1",url:"#",isActive:!1,enabled:!0,order:4},{title:"Grade / Standard 2",url:"#",isActive:!1,enabled:!0,order:5},{title:"Grade / Standard 3",url:"#",isActive:!1,enabled:!0,order:6},{title:"Grade / Standard 4",url:"#",isActive:!1,enabled:!0,order:7},{title:"Grade / Standard 5",url:"#",isActive:!1,enabled:!0,order:8}]},{title:"Quizzes",url:"#",icon:i,isActive:!1,enabled:!0,order:4,subItems:[{title:"Introduction",url:"#",isActive:!1,enabled:!0,order:1},{title:"Get Started",url:"#",isActive:!1,enabled:!0,order:2},{title:"Tutorials",url:"#",isActive:!1,enabled:!0,order:3},{title:"Changelog",url:"#",isActive:!1,enabled:!0,order:4}]},{title:"Settings",url:"#",icon:o,isActive:!1,enabled:!0,order:5,subItems:[{title:"General",url:"#",isActive:!1,enabled:!0,order:1},{title:"Kids",url:"#",isActive:!1,enabled:!0,order:2}]}],footerNavItems:[{title:"Upgrade to Pro",url:"#",icon:r,isActive:!1,enabled:!0,order:1,subItems:[]},{title:"Divider",url:"#",icon:r,isActive:!1,enabled:!0,order:2,subItems:[]},{title:"Account",url:"#",icon:a,isActive:!1,enabled:!0,order:3,subItems:[]},{title:"Billing",url:"#",icon:d,isActive:!1,enabled:!0,order:4,subItems:[]},{title:"Notifications",url:"#",icon:l,isActive:!1,enabled:!0,order:5,subItems:[]}]};
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EnhancedCombobox } from "../components/enhanced-combobox";
|
|
3
|
-
const API_METHODS = { GET: "GET" };
|
|
4
|
-
function useDebounce(value, delay) {
|
|
5
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
8
|
-
return () => clearTimeout(timer);
|
|
9
|
-
}, [value, delay]);
|
|
10
|
-
return debouncedValue;
|
|
11
|
-
}
|
|
12
|
-
export const useEnhancedCombobox = ({ emptyText, error, formatSearchResult, id, info, label, onValueChange, options, placeholder, required, searchEndpoint, searchPlaceholder, value, }) => {
|
|
13
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
14
|
-
const [searchOptions, setSearchOptions] = useState([]);
|
|
15
|
-
const [loading, setLoading] = useState(false);
|
|
16
|
-
const debouncedSearchQuery = useDebounce(searchQuery, 800);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (!debouncedSearchQuery) {
|
|
19
|
-
setSearchOptions([]);
|
|
20
|
-
setLoading(false);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
setLoading(true);
|
|
24
|
-
(async () => {
|
|
25
|
-
try {
|
|
26
|
-
const { fetchData } = await import("@react-pakistan/util-functions/general/fetch-data");
|
|
27
|
-
const { data } = await fetchData({
|
|
28
|
-
url: searchEndpoint,
|
|
29
|
-
method: API_METHODS.GET,
|
|
30
|
-
params: { searchQuery: debouncedSearchQuery },
|
|
31
|
-
});
|
|
32
|
-
const formatter = formatSearchResult ||
|
|
33
|
-
((item) => {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
return ({
|
|
36
|
-
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
37
|
-
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
setSearchOptions((data.items || []).map(formatter));
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.error("Failed to fetch expense categories:", error);
|
|
44
|
-
setSearchOptions([]);
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
setLoading(false);
|
|
48
|
-
}
|
|
49
|
-
})();
|
|
50
|
-
}, [debouncedSearchQuery, searchEndpoint]);
|
|
51
|
-
const mappedOptions = useMemo(() => {
|
|
52
|
-
return searchOptions.length > 0 ? searchOptions : options;
|
|
53
|
-
}, [searchOptions, options]);
|
|
54
|
-
const handleSearchChange = useCallback((query) => {
|
|
55
|
-
setSearchQuery(query);
|
|
56
|
-
}, []);
|
|
57
|
-
const enhancedComboboxElement = useMemo(() => (React.createElement(EnhancedCombobox, { emptyText: emptyText, error: error, id: id, info: info, label: label, loading: loading, onSearchChange: handleSearchChange, onValueChange: onValueChange, options: mappedOptions, placeholder: placeholder, required: required, searchPlaceholder: searchPlaceholder, value: value })), [
|
|
58
|
-
emptyText,
|
|
59
|
-
error,
|
|
60
|
-
handleSearchChange,
|
|
61
|
-
id,
|
|
62
|
-
info,
|
|
63
|
-
label,
|
|
64
|
-
loading,
|
|
65
|
-
mappedOptions,
|
|
66
|
-
onValueChange,
|
|
67
|
-
placeholder,
|
|
68
|
-
required,
|
|
69
|
-
searchPlaceholder,
|
|
70
|
-
value,
|
|
71
|
-
]);
|
|
72
|
-
return { enhancedComboboxElement };
|
|
73
|
-
};
|
|
1
|
+
"use strict";import M,{useCallback as V,useEffect as O,useMemo as Q,useState as r}from"react";import{EnhancedCombobox as k}from"../components/enhanced-combobox";const A={GET:"GET"};function F(e,t){const[c,n]=r(e);return O(()=>{const a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},[e,t]),c}export const useEnhancedCombobox=({emptyText:e,error:t,formatSearchResult:c,id:n,info:a,label:d,onValueChange:b,options:f,placeholder:p,required:g,searchEndpoint:E,searchPlaceholder:S,value:C})=>{const[v,G]=r(""),[s,u]=r([]),[x,l]=r(!1),i=F(v,800);O(()=>{if(!i){u([]),l(!1);return}l(!0),(async()=>{try{const{fetchData:o}=await import("@react-pakistan/util-functions/general/fetch-data"),{data:_}=await o({url:E,method:A.GET,params:{searchQuery:i}}),w=c||(D=>{var m,h;return{label:String((m=D.label)!==null&&m!==void 0?m:""),value:String((h=D.value)!==null&&h!==void 0?h:"")}});u((_.items||[]).map(w))}catch(o){console.error("Failed to fetch expense categories:",o),u([])}finally{l(!1)}})()},[i,E]);const y=Q(()=>s.length>0?s:f,[s,f]),T=V(o=>{G(o)},[]);return{enhancedComboboxElement:Q(()=>M.createElement(k,{emptyText:e,error:t,id:n,info:a,label:d,loading:x,onSearchChange:T,onValueChange:b,options:y,placeholder:p,required:g,searchPlaceholder:S,value:C}),[e,t,T,n,a,d,x,y,b,p,g,S,C])}};
|
package/hooks/use-mobile.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const MOBILE_BREAKPOINT = 768;
|
|
3
|
-
export function useIsMobile() {
|
|
4
|
-
const [isMobile, setIsMobile] = React.useState(undefined);
|
|
5
|
-
React.useEffect(() => {
|
|
6
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
7
|
-
const onChange = () => {
|
|
8
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
9
|
-
};
|
|
10
|
-
mql.addEventListener("change", onChange);
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
12
|
-
return () => mql.removeEventListener("change", onChange);
|
|
13
|
-
}, []);
|
|
14
|
-
return !!isMobile;
|
|
15
|
-
}
|
|
1
|
+
"use strict";import*as o from"react";const e=768;export function useIsMobile(){const[s,n]=o.useState(void 0);return o.useEffect(()=>{const t=window.matchMedia(`(max-width: ${e-1}px)`),i=()=>{n(window.innerWidth<e)};return t.addEventListener("change",i),n(window.innerWidth<e),()=>t.removeEventListener("change",i)},[]),!!s}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const useOutsideClick = (ref, callback) => {
|
|
3
|
-
useEffect(() => {
|
|
4
|
-
const listener = (event) => {
|
|
5
|
-
const target = event.target;
|
|
6
|
-
// DO NOTHING if the element being clicked is the target element or their children
|
|
7
|
-
if (!ref.current || (target && ref.current.contains(target))) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
callback(event);
|
|
11
|
-
};
|
|
12
|
-
document.addEventListener("mousedown", listener);
|
|
13
|
-
document.addEventListener("touchstart", listener);
|
|
14
|
-
return () => {
|
|
15
|
-
document.removeEventListener("mousedown", listener);
|
|
16
|
-
document.removeEventListener("touchstart", listener);
|
|
17
|
-
};
|
|
18
|
-
}, [ref, callback]);
|
|
19
|
-
};
|
|
1
|
+
"use strict";import{useEffect as s}from"react";export const useOutsideClick=(e,n)=>{s(()=>{const t=r=>{const o=r.target;!e.current||o&&e.current.contains(o)||n(r)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[e,n])};
|
package/lib/themes.js
CHANGED
|
@@ -1,147 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const themes = {
|
|
3
|
-
light: {
|
|
4
|
-
name: "light",
|
|
5
|
-
displayName: "Light",
|
|
6
|
-
colors: {
|
|
7
|
-
background: "oklch(1 0 0)",
|
|
8
|
-
foreground: "oklch(0.145 0 0)",
|
|
9
|
-
card: "oklch(1 0 0)",
|
|
10
|
-
"card-foreground": "oklch(0.145 0 0)",
|
|
11
|
-
popover: "oklch(1 0 0)",
|
|
12
|
-
"popover-foreground": "oklch(0.145 0 0)",
|
|
13
|
-
primary: "oklch(0.205 0 0)",
|
|
14
|
-
"primary-foreground": "oklch(0.985 0 0)",
|
|
15
|
-
secondary: "oklch(0.97 0 0)",
|
|
16
|
-
"secondary-foreground": "oklch(0.205 0 0)",
|
|
17
|
-
muted: "oklch(0.97 0 0)",
|
|
18
|
-
"muted-foreground": "oklch(0.556 0 0)",
|
|
19
|
-
accent: "oklch(0.97 0 0)",
|
|
20
|
-
"accent-foreground": "oklch(0.205 0 0)",
|
|
21
|
-
destructive: "oklch(0.577 0.245 27.325)",
|
|
22
|
-
border: "oklch(0.922 0 0)",
|
|
23
|
-
input: "oklch(0.922 0 0)",
|
|
24
|
-
ring: "oklch(0.708 0 0)",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
dark: {
|
|
28
|
-
name: "dark",
|
|
29
|
-
displayName: "Dark",
|
|
30
|
-
colors: {
|
|
31
|
-
background: "oklch(0.145 0 0)",
|
|
32
|
-
foreground: "oklch(0.985 0 0)",
|
|
33
|
-
card: "oklch(0.205 0 0)",
|
|
34
|
-
"card-foreground": "oklch(0.985 0 0)",
|
|
35
|
-
popover: "oklch(0.205 0 0)",
|
|
36
|
-
"popover-foreground": "oklch(0.985 0 0)",
|
|
37
|
-
primary: "oklch(0.922 0 0)",
|
|
38
|
-
"primary-foreground": "oklch(0.205 0 0)",
|
|
39
|
-
secondary: "oklch(0.269 0 0)",
|
|
40
|
-
"secondary-foreground": "oklch(0.985 0 0)",
|
|
41
|
-
muted: "oklch(0.269 0 0)",
|
|
42
|
-
"muted-foreground": "oklch(0.708 0 0)",
|
|
43
|
-
accent: "oklch(0.269 0 0)",
|
|
44
|
-
"accent-foreground": "oklch(0.985 0 0)",
|
|
45
|
-
destructive: "oklch(0.704 0.191 22.216)",
|
|
46
|
-
border: "oklch(1 0 0 / 10%)",
|
|
47
|
-
input: "oklch(1 0 0 / 15%)",
|
|
48
|
-
ring: "oklch(0.556 0 0)",
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
blue: {
|
|
52
|
-
name: "blue",
|
|
53
|
-
displayName: "Blue",
|
|
54
|
-
colors: {
|
|
55
|
-
background: "oklch(0.99 0.005 246.049)",
|
|
56
|
-
foreground: "oklch(0.15 0.02 247.858)",
|
|
57
|
-
card: "oklch(0.99 0.005 246.049)",
|
|
58
|
-
"card-foreground": "oklch(0.15 0.02 247.858)",
|
|
59
|
-
popover: "oklch(0.99 0.005 246.049)",
|
|
60
|
-
"popover-foreground": "oklch(0.15 0.02 247.858)",
|
|
61
|
-
primary: "oklch(0.492 0.215 265.75)",
|
|
62
|
-
"primary-foreground": "oklch(0.985 0.003 106.423)",
|
|
63
|
-
secondary: "oklch(0.956 0.013 253.559)",
|
|
64
|
-
"secondary-foreground": "oklch(0.15 0.02 247.858)",
|
|
65
|
-
muted: "oklch(0.956 0.013 253.559)",
|
|
66
|
-
"muted-foreground": "oklch(0.533 0.015 252.096)",
|
|
67
|
-
accent: "oklch(0.956 0.013 253.559)",
|
|
68
|
-
"accent-foreground": "oklch(0.15 0.02 247.858)",
|
|
69
|
-
destructive: "oklch(0.577 0.245 27.325)",
|
|
70
|
-
border: "oklch(0.898 0.013 252.096)",
|
|
71
|
-
input: "oklch(0.898 0.013 252.096)",
|
|
72
|
-
ring: "oklch(0.492 0.215 265.75)",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
green: {
|
|
76
|
-
name: "green",
|
|
77
|
-
displayName: "Green",
|
|
78
|
-
colors: {
|
|
79
|
-
background: "oklch(0.99 0.01 142.425)",
|
|
80
|
-
foreground: "oklch(0.15 0.025 142.425)",
|
|
81
|
-
card: "oklch(0.99 0.01 142.425)",
|
|
82
|
-
"card-foreground": "oklch(0.15 0.025 142.425)",
|
|
83
|
-
popover: "oklch(0.99 0.01 142.425)",
|
|
84
|
-
"popover-foreground": "oklch(0.15 0.025 142.425)",
|
|
85
|
-
primary: "oklch(0.4 0.177 150.861)",
|
|
86
|
-
"primary-foreground": "oklch(0.985 0.007 106.423)",
|
|
87
|
-
secondary: "oklch(0.956 0.02 142.425)",
|
|
88
|
-
"secondary-foreground": "oklch(0.15 0.025 142.425)",
|
|
89
|
-
muted: "oklch(0.956 0.02 142.425)",
|
|
90
|
-
"muted-foreground": "oklch(0.533 0.022 142.425)",
|
|
91
|
-
accent: "oklch(0.956 0.02 142.425)",
|
|
92
|
-
"accent-foreground": "oklch(0.15 0.025 142.425)",
|
|
93
|
-
destructive: "oklch(0.577 0.245 27.325)",
|
|
94
|
-
border: "oklch(0.898 0.02 142.425)",
|
|
95
|
-
input: "oklch(0.898 0.02 142.425)",
|
|
96
|
-
ring: "oklch(0.4 0.177 150.861)",
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
purple: {
|
|
100
|
-
name: "purple",
|
|
101
|
-
displayName: "Purple",
|
|
102
|
-
colors: {
|
|
103
|
-
background: "oklch(0.99 0.008 285.257)",
|
|
104
|
-
foreground: "oklch(0.15 0.025 285.257)",
|
|
105
|
-
card: "oklch(0.99 0.008 285.257)",
|
|
106
|
-
"card-foreground": "oklch(0.15 0.025 285.257)",
|
|
107
|
-
popover: "oklch(0.99 0.008 285.257)",
|
|
108
|
-
"popover-foreground": "oklch(0.15 0.025 285.257)",
|
|
109
|
-
primary: "oklch(0.45 0.224 293.334)",
|
|
110
|
-
"primary-foreground": "oklch(0.985 0.003 106.423)",
|
|
111
|
-
secondary: "oklch(0.956 0.015 285.257)",
|
|
112
|
-
"secondary-foreground": "oklch(0.15 0.025 285.257)",
|
|
113
|
-
muted: "oklch(0.956 0.015 285.257)",
|
|
114
|
-
"muted-foreground": "oklch(0.533 0.025 285.257)",
|
|
115
|
-
accent: "oklch(0.956 0.015 285.257)",
|
|
116
|
-
"accent-foreground": "oklch(0.15 0.025 285.257)",
|
|
117
|
-
destructive: "oklch(0.577 0.245 27.325)",
|
|
118
|
-
border: "oklch(0.898 0.015 285.257)",
|
|
119
|
-
input: "oklch(0.898 0.015 285.257)",
|
|
120
|
-
ring: "oklch(0.45 0.224 293.334)",
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
orange: {
|
|
124
|
-
name: "orange",
|
|
125
|
-
displayName: "Orange",
|
|
126
|
-
colors: {
|
|
127
|
-
background: "oklch(0.99 0.01 70.67)",
|
|
128
|
-
foreground: "oklch(0.15 0.025 70.67)",
|
|
129
|
-
card: "oklch(0.99 0.01 70.67)",
|
|
130
|
-
"card-foreground": "oklch(0.15 0.025 70.67)",
|
|
131
|
-
popover: "oklch(0.99 0.01 70.67)",
|
|
132
|
-
"popover-foreground": "oklch(0.15 0.025 70.67)",
|
|
133
|
-
primary: "oklch(0.5 0.207 60.234)",
|
|
134
|
-
"primary-foreground": "oklch(0.985 0.005 106.423)",
|
|
135
|
-
secondary: "oklch(0.956 0.02 70.67)",
|
|
136
|
-
"secondary-foreground": "oklch(0.15 0.025 70.67)",
|
|
137
|
-
muted: "oklch(0.956 0.02 70.67)",
|
|
138
|
-
"muted-foreground": "oklch(0.533 0.025 70.67)",
|
|
139
|
-
accent: "oklch(0.956 0.02 70.67)",
|
|
140
|
-
"accent-foreground": "oklch(0.15 0.025 70.67)",
|
|
141
|
-
destructive: "oklch(0.577 0.245 27.325)",
|
|
142
|
-
border: "oklch(0.898 0.02 70.67)",
|
|
143
|
-
input: "oklch(0.898 0.02 70.67)",
|
|
144
|
-
ring: "oklch(0.5 0.207 60.234)",
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
};
|
|
1
|
+
"use strict";export const themes={light:{name:"light",displayName:"Light",colors:{background:"oklch(1 0 0)",foreground:"oklch(0.145 0 0)",card:"oklch(1 0 0)","card-foreground":"oklch(0.145 0 0)",popover:"oklch(1 0 0)","popover-foreground":"oklch(0.145 0 0)",primary:"oklch(0.205 0 0)","primary-foreground":"oklch(0.985 0 0)",secondary:"oklch(0.97 0 0)","secondary-foreground":"oklch(0.205 0 0)",muted:"oklch(0.97 0 0)","muted-foreground":"oklch(0.556 0 0)",accent:"oklch(0.97 0 0)","accent-foreground":"oklch(0.205 0 0)",destructive:"oklch(0.577 0.245 27.325)",border:"oklch(0.922 0 0)",input:"oklch(0.922 0 0)",ring:"oklch(0.708 0 0)"}},dark:{name:"dark",displayName:"Dark",colors:{background:"oklch(0.145 0 0)",foreground:"oklch(0.985 0 0)",card:"oklch(0.205 0 0)","card-foreground":"oklch(0.985 0 0)",popover:"oklch(0.205 0 0)","popover-foreground":"oklch(0.985 0 0)",primary:"oklch(0.922 0 0)","primary-foreground":"oklch(0.205 0 0)",secondary:"oklch(0.269 0 0)","secondary-foreground":"oklch(0.985 0 0)",muted:"oklch(0.269 0 0)","muted-foreground":"oklch(0.708 0 0)",accent:"oklch(0.269 0 0)","accent-foreground":"oklch(0.985 0 0)",destructive:"oklch(0.704 0.191 22.216)",border:"oklch(1 0 0 / 10%)",input:"oklch(1 0 0 / 15%)",ring:"oklch(0.556 0 0)"}},blue:{name:"blue",displayName:"Blue",colors:{background:"oklch(0.99 0.005 246.049)",foreground:"oklch(0.15 0.02 247.858)",card:"oklch(0.99 0.005 246.049)","card-foreground":"oklch(0.15 0.02 247.858)",popover:"oklch(0.99 0.005 246.049)","popover-foreground":"oklch(0.15 0.02 247.858)",primary:"oklch(0.492 0.215 265.75)","primary-foreground":"oklch(0.985 0.003 106.423)",secondary:"oklch(0.956 0.013 253.559)","secondary-foreground":"oklch(0.15 0.02 247.858)",muted:"oklch(0.956 0.013 253.559)","muted-foreground":"oklch(0.533 0.015 252.096)",accent:"oklch(0.956 0.013 253.559)","accent-foreground":"oklch(0.15 0.02 247.858)",destructive:"oklch(0.577 0.245 27.325)",border:"oklch(0.898 0.013 252.096)",input:"oklch(0.898 0.013 252.096)",ring:"oklch(0.492 0.215 265.75)"}},green:{name:"green",displayName:"Green",colors:{background:"oklch(0.99 0.01 142.425)",foreground:"oklch(0.15 0.025 142.425)",card:"oklch(0.99 0.01 142.425)","card-foreground":"oklch(0.15 0.025 142.425)",popover:"oklch(0.99 0.01 142.425)","popover-foreground":"oklch(0.15 0.025 142.425)",primary:"oklch(0.4 0.177 150.861)","primary-foreground":"oklch(0.985 0.007 106.423)",secondary:"oklch(0.956 0.02 142.425)","secondary-foreground":"oklch(0.15 0.025 142.425)",muted:"oklch(0.956 0.02 142.425)","muted-foreground":"oklch(0.533 0.022 142.425)",accent:"oklch(0.956 0.02 142.425)","accent-foreground":"oklch(0.15 0.025 142.425)",destructive:"oklch(0.577 0.245 27.325)",border:"oklch(0.898 0.02 142.425)",input:"oklch(0.898 0.02 142.425)",ring:"oklch(0.4 0.177 150.861)"}},purple:{name:"purple",displayName:"Purple",colors:{background:"oklch(0.99 0.008 285.257)",foreground:"oklch(0.15 0.025 285.257)",card:"oklch(0.99 0.008 285.257)","card-foreground":"oklch(0.15 0.025 285.257)",popover:"oklch(0.99 0.008 285.257)","popover-foreground":"oklch(0.15 0.025 285.257)",primary:"oklch(0.45 0.224 293.334)","primary-foreground":"oklch(0.985 0.003 106.423)",secondary:"oklch(0.956 0.015 285.257)","secondary-foreground":"oklch(0.15 0.025 285.257)",muted:"oklch(0.956 0.015 285.257)","muted-foreground":"oklch(0.533 0.025 285.257)",accent:"oklch(0.956 0.015 285.257)","accent-foreground":"oklch(0.15 0.025 285.257)",destructive:"oklch(0.577 0.245 27.325)",border:"oklch(0.898 0.015 285.257)",input:"oklch(0.898 0.015 285.257)",ring:"oklch(0.45 0.224 293.334)"}},orange:{name:"orange",displayName:"Orange",colors:{background:"oklch(0.99 0.01 70.67)",foreground:"oklch(0.15 0.025 70.67)",card:"oklch(0.99 0.01 70.67)","card-foreground":"oklch(0.15 0.025 70.67)",popover:"oklch(0.99 0.01 70.67)","popover-foreground":"oklch(0.15 0.025 70.67)",primary:"oklch(0.5 0.207 60.234)","primary-foreground":"oklch(0.985 0.005 106.423)",secondary:"oklch(0.956 0.02 70.67)","secondary-foreground":"oklch(0.15 0.025 70.67)",muted:"oklch(0.956 0.02 70.67)","muted-foreground":"oklch(0.533 0.025 70.67)",accent:"oklch(0.956 0.02 70.67)","accent-foreground":"oklch(0.15 0.025 70.67)",destructive:"oklch(0.577 0.245 27.325)",border:"oklch(0.898 0.02 70.67)",input:"oklch(0.898 0.02 70.67)",ring:"oklch(0.5 0.207 60.234)"}}};
|