@bikiran/utils 2.3.7 → 2.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -10,32 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://github.com/bikirandev/bikiran-utils/commits/main)[](https://github.com/bikirandev/bikiran-utils/commits/main)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
13
|
# @bikiran/utils## Overview
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
15
|
A comprehensive collection of **React components** and **utility functions** specifically developed for modern web applications. This package provides a robust set of UI components, helper functions, and utilities designed to accelerate development while maintaining consistency and performance.A collection of utility components specifically developed for our organization's internal projects. While primarily tailored to our needs, others may find some components useful.
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
17
|
## 🌟 Overview⚠️ **Important Note**: This package was optimized for our specific use cases and may not work as expected in all projects. Use with caution.
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
19
|
A collection of utility components specifically developed for our organization's internal projects. While primarily tailored to our needs, others may find some components useful.## Dependencies
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
21
|
⚠️ **Important Note**: This package was optimized for our specific use cases and may not work as expected in all projects. Use with caution.- `clsx`
|
|
32
22
|
|
|
33
23
|
- `tailwind-merge`
|
|
34
24
|
|
|
35
25
|
## ✨ Key Features- `Next.js`
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
39
27
|
- **🎨 UI Components**: Pre-built React components with consistent styling## Peer Dependencies
|
|
40
28
|
|
|
41
29
|
- **🛠️ Utility Functions**: Helper functions for common operations
|
|
@@ -50,17 +38,13 @@ A collection of utility components specifically developed for our organization's
|
|
|
50
38
|
|
|
51
39
|
- **🔧 Configurable**: Highly customizable with sensible defaults- `dayjs` (^1.11.0) - Used for date/time utilities
|
|
52
40
|
|
|
53
|
-
|
|
54
|
-
|
|
55
41
|
## 📦 What's IncludedMake sure to install these peer dependencies in your project:
|
|
56
42
|
|
|
57
|
-
|
|
58
|
-
|
|
59
43
|
### 🧩 UI Components (15)```bash
|
|
60
44
|
|
|
61
45
|
- **Navigation & Layout**: Custom Sidebar, Header components, Project Selectornpm install react react-dom dayjs
|
|
62
46
|
|
|
63
|
-
- **User Interface**: Profile Management, User Info, Tooltip components
|
|
47
|
+
- **User Interface**: Profile Management, User Info, Tooltip components ```
|
|
64
48
|
|
|
65
49
|
- **Interactive Elements**: Button Wrapper, Currency Selector, Filter Wrapper
|
|
66
50
|
|
|
@@ -104,16 +88,10 @@ A collection of utility components specifically developed for our organization's
|
|
|
104
88
|
|
|
105
89
|
- `Next.js` - React framework (recommended)12. [UserInfoComp](https://github.com/bikirandev/bikiran-utils/wiki/13.-UserInfoComp)
|
|
106
90
|
|
|
107
|
-
|
|
108
|
-
|
|
109
91
|
### Peer Dependencies## Getting Started
|
|
110
92
|
|
|
111
|
-
|
|
112
|
-
|
|
113
93
|
The following packages are required to be installed in your project:### Installation
|
|
114
94
|
|
|
115
|
-
|
|
116
|
-
|
|
117
95
|
- `react` (^19.1.0) - React libraryInstall the package via **npm**:
|
|
118
96
|
|
|
119
97
|
- `react-dom` (^19.1.0) - React DOM rendering
|
|
@@ -124,9 +102,7 @@ npm install @bikiran/utils
|
|
|
124
102
|
|
|
125
103
|
**Install peer dependencies:**```
|
|
126
104
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
```bashOr via **yarn**:
|
|
105
|
+
```````bashOr via **yarn**:
|
|
130
106
|
|
|
131
107
|
npm install react react-dom dayjs
|
|
132
108
|
|
|
@@ -224,15 +200,11 @@ Or via **yarn**: },
|
|
|
224
200
|
|
|
225
201
|
yarn add @bikiran/utils}
|
|
226
202
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
203
|
+
```````
|
|
230
204
|
|
|
231
205
|
Or via **pnpm**:This setup allows all components—like `<ButtonWrapper>` and `<CurrencySelector>`—to **automatically inherit your color scheme** across different shades.
|
|
232
206
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
```bash### Basic Usage
|
|
207
|
+
````bash### Basic Usage
|
|
236
208
|
|
|
237
209
|
pnpm add @bikiran/utils
|
|
238
210
|
|
|
@@ -334,59 +306,53 @@ module.exports = {
|
|
|
334
306
|
|
|
335
307
|
``` git push origin my-feature-name
|
|
336
308
|
|
|
337
|
-
|
|
309
|
+
````
|
|
338
310
|
|
|
339
311
|
This setup allows all components—like `<ButtonWrapper>` and `<CurrencySelector>`—to **automatically inherit your color scheme** across different shades.7. **Open a Pull Request** with a clear title and description.
|
|
340
312
|
|
|
341
|
-
|
|
342
|
-
|
|
343
313
|
### 🔧 Basic Usage### 🧪 Before submitting:
|
|
344
314
|
|
|
345
|
-
|
|
346
|
-
|
|
347
315
|
1. **Import Components**- Run and test the component in your app.
|
|
348
316
|
|
|
349
317
|
- Check for console errors or style breakages.
|
|
350
318
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
import {
|
|
319
|
+
````tsx- Use consistent naming and follow the existing code style.
|
|
354
320
|
|
|
355
|
-
|
|
321
|
+
import {
|
|
356
322
|
|
|
357
|
-
|
|
323
|
+
ButtonWrapper, Thanks for your contribution! ❤️
|
|
358
324
|
|
|
359
|
-
|
|
325
|
+
PageLoading,
|
|
360
326
|
|
|
361
|
-
|
|
327
|
+
UserInfoComp,## License
|
|
362
328
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
} from "@bikiran/utils";
|
|
329
|
+
CopyWrapper,
|
|
366
330
|
|
|
367
|
-
|
|
331
|
+
Pagination MIT License
|
|
368
332
|
|
|
333
|
+
} from "@bikiran/utils";
|
|
369
334
|
|
|
335
|
+
```## Author
|
|
336
|
+
````
|
|
370
337
|
|
|
371
338
|
2. **Import Utility Functions**Developed by [Bikiran](https://bikiran.com/)
|
|
372
339
|
|
|
373
|
-
|
|
374
|
-
|
|
375
340
|
```tsx
|
|
376
|
-
import {
|
|
377
|
-
GetDate,
|
|
378
|
-
GetTime,
|
|
341
|
+
import {
|
|
342
|
+
GetDate,
|
|
343
|
+
GetTime,
|
|
379
344
|
timeAgo,
|
|
380
|
-
capitalizeFirstLetter
|
|
345
|
+
capitalizeFirstLetter,
|
|
381
346
|
} from "@bikiran/utils";
|
|
382
347
|
```
|
|
383
348
|
|
|
384
349
|
3. **Use with Your Theme**
|
|
350
|
+
|
|
385
351
|
```tsx
|
|
386
352
|
// Components automatically adopt your project's colors
|
|
387
|
-
<ButtonWrapper variant="primary">Click Me</ButtonWrapper
|
|
388
|
-
|
|
389
|
-
// Utility functions work independently
|
|
353
|
+
<ButtonWrapper variant="primary">Click Me</ButtonWrapper>;
|
|
354
|
+
|
|
355
|
+
// Utility functions work independently
|
|
390
356
|
const formattedDate = GetDate(Date.now() / 1000, "DD MMM YYYY");
|
|
391
357
|
```
|
|
392
358
|
|
|
@@ -411,8 +377,8 @@ To override default styles:
|
|
|
411
377
|
|
|
412
378
|
```tsx
|
|
413
379
|
// Profile with user information
|
|
414
|
-
<UserInfoComp
|
|
415
|
-
name="John Doe"
|
|
380
|
+
<UserInfoComp
|
|
381
|
+
name="John Doe"
|
|
416
382
|
email="john@example.com"
|
|
417
383
|
photoUrl="https://example.com/photo.jpg"
|
|
418
384
|
ImageComponent={Image}
|
|
@@ -423,12 +389,12 @@ To override default styles:
|
|
|
423
389
|
Click to copy
|
|
424
390
|
</CopyWrapper>
|
|
425
391
|
|
|
426
|
-
// Loading states
|
|
392
|
+
// Loading states
|
|
427
393
|
{loading && <PageLoading />}
|
|
428
394
|
{processing && <LoadingComp />}
|
|
429
395
|
|
|
430
396
|
// Navigation
|
|
431
|
-
<Pagination
|
|
397
|
+
<Pagination
|
|
432
398
|
currentPage={1}
|
|
433
399
|
totalPages={10}
|
|
434
400
|
onPageChange={(page) => setCurrentPage(page)}
|
|
@@ -486,7 +452,7 @@ const capitalized = capitalizeFirstLetter("hello world"); // "Hello world"
|
|
|
486
452
|
// Copy functionality (React hook)
|
|
487
453
|
const MyCopyComponent = () => {
|
|
488
454
|
const { copy, isCopied } = Copy();
|
|
489
|
-
|
|
455
|
+
|
|
490
456
|
return (
|
|
491
457
|
<button onClick={() => copy("Text to copy")}>
|
|
492
458
|
{isCopied ? "Copied!" : "Copy Text"}
|
|
@@ -504,7 +470,7 @@ import { cn } from "@bikiran/utils";
|
|
|
504
470
|
const buttonClasses = cn(
|
|
505
471
|
"px-4 py-2 rounded",
|
|
506
472
|
isActive && "bg-blue-500",
|
|
507
|
-
isDisabled && "opacity-50 cursor-not-allowed"
|
|
473
|
+
isDisabled && "opacity-50 cursor-not-allowed",
|
|
508
474
|
);
|
|
509
475
|
```
|
|
510
476
|
|
|
@@ -514,6 +480,7 @@ For complete documentation and usage examples, please see:
|
|
|
514
480
|
[**📚 Components Documentation**](https://github.com/bikirandev/bikiran-utils/wiki/Home)
|
|
515
481
|
|
|
516
482
|
### 🔗 Quick Links
|
|
483
|
+
|
|
517
484
|
- [Installation Guide](https://github.com/bikirandev/bikiran-utils/wiki/Installation)
|
|
518
485
|
- [Component API Reference](https://github.com/bikirandev/bikiran-utils/wiki/Components)
|
|
519
486
|
- [Utility Functions](https://github.com/bikirandev/bikiran-utils/wiki/Utilities)
|
|
@@ -543,7 +510,7 @@ We welcome contributions! To contribute to the package:
|
|
|
543
510
|
### 🧪 Before Submitting
|
|
544
511
|
|
|
545
512
|
- ✅ Run tests and ensure all pass
|
|
546
|
-
- ✅ Test components in a real application
|
|
513
|
+
- ✅ Test components in a real application
|
|
547
514
|
- ✅ Check for console errors or style conflicts
|
|
548
515
|
- ✅ Follow existing code style and naming conventions
|
|
549
516
|
- ✅ Update documentation for new features
|
|
@@ -579,4 +546,80 @@ MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
579
546
|
|
|
580
547
|
[⭐ Star this repo](https://github.com/bikirandev/bikiran-utils) • [🐛 Report Bug](https://github.com/bikirandev/bikiran-utils/issues) • [💡 Request Feature](https://github.com/bikirandev/bikiran-utils/issues/new)
|
|
581
548
|
|
|
582
|
-
</div>
|
|
549
|
+
</div>
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## 🏢 About Bikiran
|
|
554
|
+
|
|
555
|
+
**[Bikiran](https://bikiran.com/)** is a software development and cloud infrastructure company founded in 2012, headquartered in Khulna, Bangladesh. With 15,000+ clients and over a decade of experience, Bikiran builds and operates a suite of products spanning domain services, cloud hosting, app deployment, workflow automation, and developer tools.
|
|
556
|
+
|
|
557
|
+
### 🌐 Websites
|
|
558
|
+
|
|
559
|
+
| Product | Website |
|
|
560
|
+
| ------------------- | ------------------------------------------------------- |
|
|
561
|
+
| **Bikiran** | [bikiran.com](https://bikiran.com/) |
|
|
562
|
+
| **Edusoft** | [edusoft.com.bd](https://www.edusoft.com.bd/) |
|
|
563
|
+
| **n8n Clouds** | [n8nclouds.com](https://n8nclouds.com/) |
|
|
564
|
+
| **Timestamp Zone** | [timestamp.zone](https://www.timestamp.zone/) |
|
|
565
|
+
| **PDFpi** | [pdfpi.bikiran.com](https://pdfpi.bikiran.com/) |
|
|
566
|
+
| **Bikiran Blog** | [blog.bikiran.com](https://blog.bikiran.com/) |
|
|
567
|
+
| **Bikiran Support** | [support.bikiran.com](https://support.bikiran.com/) |
|
|
568
|
+
| **Probackup** | [probackup.bikiran.com](https://probackup.bikiran.com/) |
|
|
569
|
+
|
|
570
|
+
### 🛠️ Services
|
|
571
|
+
|
|
572
|
+
| Service | Link |
|
|
573
|
+
| --------------- | -------------------------------------------------------------------------------- |
|
|
574
|
+
| **Domain** | [bikiran.com/domain](https://www.bikiran.com/domain) |
|
|
575
|
+
| **Hosting** | [bikiran.com/services/hosting/web](https://www.bikiran.com/services/hosting/web) |
|
|
576
|
+
| **Email & SMS** | — |
|
|
577
|
+
|
|
578
|
+
### 📦 npm Packages
|
|
579
|
+
|
|
580
|
+
| Package | npm |
|
|
581
|
+
| ------------------------ | ------------------------------------------------------------------------ |
|
|
582
|
+
| **Chronopicks** | [@bikiran/chronopick](https://www.npmjs.com/package/@bikiran/chronopick) |
|
|
583
|
+
| **Rich Editor** | [@bikiran/editor](https://www.npmjs.com/package/@bikiran/editor) |
|
|
584
|
+
| **Dropdown** | [bik-dropdown](https://www.npmjs.com/package/bik-dropdown) |
|
|
585
|
+
| **Button** | [@bikiran/button](https://www.npmjs.com/package/@bikiran/button) |
|
|
586
|
+
| **Electron Boilerplate** | [create-edx-app](https://www.npmjs.com/package/create-edx-app) |
|
|
587
|
+
|
|
588
|
+
### 📦 NuGet Packages
|
|
589
|
+
|
|
590
|
+
| Package | NuGet |
|
|
591
|
+
| ------------------ | ----------------------------------------------------------------------------- |
|
|
592
|
+
| **Bkash** | [Bikiran.Payment.Bkash](https://www.nuget.org/packages/Bikiran.Payment.Bkash) |
|
|
593
|
+
| **Bikiran Engine** | [Bikiran.Engine](https://www.nuget.org/packages/Bikiran.Engine) |
|
|
594
|
+
|
|
595
|
+
### 🐙 Open Source
|
|
596
|
+
|
|
597
|
+
| Project | GitHub |
|
|
598
|
+
| ------------------ | ------------------------------------------------------------------------- |
|
|
599
|
+
| **PDFpi** | [bikirandev/pdfpi](https://github.com/bikirandev/pdfpi) |
|
|
600
|
+
| **Bikiran Engine** | [bikirandev/Bikiran.Engine](https://github.com/bikirandev/Bikiran.Engine) |
|
|
601
|
+
| **Drive CLI** | [bikirandev/DriveCLI](https://github.com/bikirandev/DriveCLI) |
|
|
602
|
+
|
|
603
|
+
### 🐳 Docker Tools
|
|
604
|
+
|
|
605
|
+
| Tool | GitHub |
|
|
606
|
+
| ----------- | ------------------------------------------------------------------------- |
|
|
607
|
+
| **Pgsql** | [bikirandev/docker-pgsql](https://github.com/bikirandev/docker-pgsql) |
|
|
608
|
+
| **n8n** | [bikirandev/docker-n8n](https://github.com/bikirandev/docker-n8n) |
|
|
609
|
+
| **Pgadmin** | [bikirandev/docker-pgadmin](https://github.com/bikirandev/docker-pgadmin) |
|
|
610
|
+
|
|
611
|
+
### 🔗 Social Media
|
|
612
|
+
|
|
613
|
+
**Bikiran**
|
|
614
|
+
|
|
615
|
+
| Platform | Link |
|
|
616
|
+
| -------- | ---------------------------------------------------------------------------- |
|
|
617
|
+
| LinkedIn | [linkedin.com/company/bikiran12](https://www.linkedin.com/company/bikiran12) |
|
|
618
|
+
| Facebook | [facebook.com/bikiran12](https://www.facebook.com/bikiran12) |
|
|
619
|
+
| YouTube | [youtube.com/@bikiranofficial](https://www.youtube.com/@bikiranofficial) |
|
|
620
|
+
|
|
621
|
+
**n8n Clouds**
|
|
622
|
+
|
|
623
|
+
| Platform | Link |
|
|
624
|
+
| -------- | ------------------------------------------------------------ |
|
|
625
|
+
| Facebook | [facebook.com/n8nclouds](https://www.facebook.com/n8nclouds) |
|
|
@@ -23,7 +23,11 @@ const TooltipUserInfo = ({ user, ImageComponent, redirectClick, }) => {
|
|
|
23
23
|
document.addEventListener("mousedown", handleClickOutside);
|
|
24
24
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
25
25
|
}, [setShow]);
|
|
26
|
-
return (_jsxs("div", { className: cn(style.toolTipParentComp, "parentComp"), ref: tooltipRef, children: [_jsx("div", { onClick: () =>
|
|
26
|
+
return (_jsxs("div", { className: cn(style.toolTipParentComp, "parentComp"), ref: tooltipRef, children: [_jsx("div", { onClick: (e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
setShow(show === (user === null || user === void 0 ? void 0 : user.id) ? null : user === null || user === void 0 ? void 0 : user.id);
|
|
30
|
+
}, className: cn(style.imageDiv, "imageDiv"), children: (user === null || user === void 0 ? void 0 : user.photoUrl) ? (_jsx(ImageComponent, { src: user === null || user === void 0 ? void 0 : user.photoUrl, alt: "user", width: 0, height: 0, sizes: "100vw", className: cn(style.userImage, "userImage") })) : (_jsx(IconUser, {})) }), _jsxs("button", { className: cn(style.btnRedirect, "btnRedirect", show === (user === null || user === void 0 ? void 0 : user.id) ? style.show : "show" // Show when active
|
|
27
31
|
), onClick: handleRedirectClick, children: [_jsxs("div", { className: cn(style.showImg, "showImg"), children: [(user === null || user === void 0 ? void 0 : user.photoUrl) ? (_jsx(ImageComponent, { src: user === null || user === void 0 ? void 0 : user.photoUrl, alt: "user", width: 0, height: 0, sizes: "100vw", className: cn(style.userImage, "userImage") })) : (_jsx(IconUser, {})), _jsxs("div", { children: [_jsx("div", { className: cn(style.displayName, "displayName"), children: (user === null || user === void 0 ? void 0 : user.displayName) || "-----" }), _jsx("div", { className: cn(style.email, "email"), children: (user === null || user === void 0 ? void 0 : user.email) || "-----" })] })] }), _jsx("div", { className: cn(style.tooltipArrow, "tooltipArrow") })] })] }));
|
|
28
32
|
};
|
|
29
33
|
export default TooltipUserInfo;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@apply cursor-pointer;
|
|
6
6
|
}
|
|
7
7
|
.userImage {
|
|
8
|
-
@apply size-7 xl:size-10 rounded-full;
|
|
8
|
+
@apply size-7 xl:size-10 rounded-full !flex-shrink-0;
|
|
9
9
|
}
|
|
10
10
|
.btnRedirect {
|
|
11
11
|
@apply absolute left-1/2 bottom-full mb-3 -translate-x-1/2 z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none transition-all duration-200 opacity-0 scale-95 pointer-events-none;
|