mehdi-akbari-calendar 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Represents a date range with a start and end date.
3
+ */
4
+ interface DateRange {
5
+ from: Date | null;
6
+ to: Date | null;
7
+ }
8
+ type CalendarType = 'jalali' | 'gregorian';
9
+ type CalendarViewMode = 'day' | 'month' | 'year';
10
+
11
+ export type { CalendarType, CalendarViewMode, DateRange };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Represents a date range with a start and end date.
3
+ */
4
+ interface DateRange {
5
+ from: Date | null;
6
+ to: Date | null;
7
+ }
8
+ type CalendarType = 'jalali' | 'gregorian';
9
+ type CalendarViewMode = 'day' | 'month' | 'year';
10
+
11
+ export type { CalendarType, CalendarViewMode, DateRange };
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/index.ts
17
+ var index_exports = {};
18
+ module.exports = __toCommonJS(index_exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// src/index.ts\r\n\r\n/**\r\n * This is the main entry point for non-React functionalities and types.\r\n * It allows users to import types or utility functions without pulling in React.\r\n */\r\n\r\nexport * from \"./types\";\r\n\r\n// In the future, you could also export utility functions from here:\r\n// export * from \"./utils/dateAdapter\";"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,254 @@
1
+ /* src/styles.css */
2
+
3
+ /* تعریف متغیرهای CSS برای سفارشی‌سازی آسان */
4
+ .prc-container {
5
+ --prc-width: 320px;
6
+ --prc-font-family: sans-serif;
7
+ --prc-bg-surface: #ffffff;
8
+ --prc-bg-secondary: #f8f9fa;
9
+ --prc-bg-hover: #f1f5f9;
10
+ --prc-border-primary: #e2e8f0;
11
+ --prc-text-primary: #1e293b;
12
+ --prc-text-secondary: #64748b;
13
+ --prc-text-placeholder: #94a3b8;
14
+ --prc-brand-primary: #3b82f6;
15
+ --prc-brand-primary-fg: #ffffff;
16
+ --prc-brand-primary-hover: #2563eb;
17
+ --prc-brand-primary-light-bg: rgba(59, 130, 246, 0.1);
18
+ --prc-radius-md: 0.375rem;
19
+ --prc-radius-lg: 0.5rem;
20
+ --prc-radius-full: 9999px;
21
+ --prc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
22
+ }
23
+
24
+ .prc-container {
25
+ width: var(--prc-width);
26
+ background-color: var(--prc-bg-surface);
27
+ border: 1px solid var(--prc-border-primary);
28
+ border-radius: var(--prc-radius-lg);
29
+ box-shadow: var(--prc-shadow-lg);
30
+ font-family: var(--prc-font-family);
31
+ user-select: none;
32
+ overflow: hidden;
33
+ }
34
+
35
+ .prc-container[dir="ltr"] .prc-header-nav-button svg {
36
+ transform: rotate(180deg);
37
+ }
38
+
39
+ .prc-view-container {
40
+ padding: 0.5rem;
41
+ }
42
+
43
+ /* Header */
44
+ .prc-header {
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: center;
48
+ padding: 0.75rem 0.5rem;
49
+ border-bottom: 1px solid var(--prc-border-primary);
50
+ }
51
+
52
+ .prc-header-controls {
53
+ display: flex;
54
+ align-items: center;
55
+ }
56
+
57
+ .prc-header-toggle-btn {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ background-color: var(--prc-bg-secondary);
62
+ color: var(--prc-text-secondary);
63
+ border: 1px solid transparent;
64
+ border-radius: var(--prc-radius-full);
65
+ width: 32px;
66
+ height: 32px;
67
+ cursor: pointer;
68
+ transition: all 0.2s ease-in-out;
69
+ }
70
+ .prc-header-toggle-btn:hover {
71
+ transform: scale(1.05);
72
+ }
73
+ .prc-header-toggle-btn.jalali { color: #f59e0b; background-color: #fffbeb; border-color: #fcd34d; }
74
+ .prc-header-toggle-btn.jalali:hover { background-color: #fef3c7; }
75
+ .prc-header-toggle-btn.gregorian { color: #3b82f6; background-color: #eff6ff; border-color: #93c5fd; }
76
+ .prc-header-toggle-btn.gregorian:hover { background-color: #dbeafe; }
77
+
78
+
79
+ .prc-header-title {
80
+ font-size: 1rem;
81
+ font-weight: 600;
82
+ color: var(--prc-text-primary);
83
+ background-color: transparent;
84
+ border: none;
85
+ cursor: pointer;
86
+ padding: 0.25rem 0.5rem;
87
+ border-radius: var(--prc-radius-md);
88
+ transition: background-color 0.2s;
89
+ }
90
+ .prc-header-title:hover {
91
+ background-color: var(--prc-bg-hover);
92
+ }
93
+
94
+ .prc-header-nav-button {
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ background-color: transparent;
99
+ border: none;
100
+ padding: 0.25rem;
101
+ border-radius: var(--prc-radius-full);
102
+ cursor: pointer;
103
+ color: var(--prc-text-secondary);
104
+ transition: all 0.2s;
105
+ }
106
+ .prc-header-nav-button:hover {
107
+ background-color: var(--prc-bg-hover);
108
+ color: var(--prc-text-primary);
109
+ }
110
+
111
+ /* Month View */
112
+ .prc-month-view, .prc-picker-view {
113
+ display: grid;
114
+ text-align: center;
115
+ }
116
+ .prc-month-view-weekdays {
117
+ display: grid;
118
+ grid-template-columns: repeat(7, 1fr);
119
+ }
120
+ .prc-month-view-weekday-name {
121
+ font-size: 0.75rem;
122
+ font-weight: 500;
123
+ color: var(--prc-text-secondary);
124
+ padding: 0.5rem 0;
125
+ }
126
+ .prc-month-view-days-grid {
127
+ display: grid;
128
+ grid-template-columns: repeat(7, 1fr);
129
+ }
130
+
131
+ /* Day Cell */
132
+ .prc-day-cell {
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ position: relative;
137
+ height: 40px;
138
+ }
139
+ .prc-day-cell-button {
140
+ width: 36px;
141
+ height: 36px;
142
+ border-radius: var(--prc-radius-full);
143
+ border: 1px solid transparent;
144
+ background-color: transparent;
145
+ color: var(--prc-text-primary);
146
+ font-size: 0.875rem;
147
+ cursor: pointer;
148
+ transition: all 0.2s ease-in-out;
149
+ display: flex;
150
+ align-items: center;
151
+ justify-content: center;
152
+ position: relative;
153
+ z-index: 2;
154
+ }
155
+ .prc-day-cell-button:hover:not(:disabled) {
156
+ background-color: var(--prc-bg-hover);
157
+ }
158
+ .prc-day-cell-button:disabled {
159
+ cursor: not-allowed;
160
+ color: var(--prc-text-placeholder);
161
+ }
162
+
163
+ .prc-day-cell--not-current-month .prc-day-cell-button {
164
+ color: var(--prc-text-secondary);
165
+ opacity: 0.6;
166
+ }
167
+ .prc-day-cell--is-today .prc-day-cell-button {
168
+ font-weight: bold;
169
+ border-color: var(--prc-brand-primary);
170
+ }
171
+ .prc-day-cell--is-selected .prc-day-cell-button {
172
+ background-color: var(--prc-brand-primary);
173
+ color: var(--prc-brand-primary-fg);
174
+ font-weight: bold;
175
+ border-color: transparent;
176
+ }
177
+ .prc-day-cell--is-selected .prc-day-cell-button:hover:not(:disabled) {
178
+ background-color: var(--prc-brand-primary-hover);
179
+ }
180
+
181
+ /* Range Styles */
182
+ .prc-day-cell--in-range {
183
+ background-color: var(--prc-brand-primary-light-bg);
184
+ }
185
+ .prc-day-cell--in-range .prc-day-cell-button {
186
+ border-radius: 0;
187
+ width: 100%;
188
+ }
189
+ /* RTL (default) */
190
+ .prc-day-cell--range-start { background: linear-gradient(to left, transparent 50%, var(--prc-brand-primary-light-bg) 50%); }
191
+ .prc-day-cell--range-end { background: linear-gradient(to right, transparent 50%, var(--prc-brand-primary-light-bg) 50%); }
192
+ /* LTR */
193
+ .prc-container[dir="ltr"] .prc-day-cell--range-start { background: linear-gradient(to right, transparent 50%, var(--prc-brand-primary-light-bg) 50%); }
194
+ .prc-container[dir="ltr"] .prc-day-cell--range-end { background: linear-gradient(to left, transparent 50%, var(--prc-brand-primary-light-bg) 50%); }
195
+
196
+ .prc-day-cell--range-start .prc-day-cell-button,
197
+ .prc-day-cell--range-end .prc-day-cell-button {
198
+ background-color: var(--prc-brand-primary);
199
+ color: var(--prc-brand-primary-fg);
200
+ border-radius: var(--prc-radius-full);
201
+ }
202
+ .prc-day-cell--range-start.prc-day-cell--range-end {
203
+ background: transparent;
204
+ }
205
+
206
+ /* Month/Year Picker */
207
+ .prc-picker-view {
208
+ padding: 0.5rem 0;
209
+ }
210
+ .prc-picker-view.month-picker-view { grid-template-columns: repeat(3, 1fr); }
211
+ .prc-picker-view.year-picker-view { grid-template-columns: repeat(4, 1fr); }
212
+
213
+ .prc-picker-item {
214
+ padding: 1rem 0.5rem;
215
+ border: none;
216
+ background-color: transparent;
217
+ border-radius: var(--prc-radius-md);
218
+ cursor: pointer;
219
+ font-size: 0.875rem;
220
+ color: var(--prc-text-primary);
221
+ transition: background-color 0.2s;
222
+ }
223
+ .prc-picker-item:hover:not(:disabled) {
224
+ background-color: var(--prc-bg-hover);
225
+ }
226
+ .prc-picker-item--is-current {
227
+ font-weight: bold;
228
+ color: var(--prc-brand-primary);
229
+ }
230
+ .prc-picker-item--is-disabled {
231
+ color: var(--prc-text-placeholder);
232
+ cursor: not-allowed;
233
+ text-decoration: line-through;
234
+ opacity: 0.7;
235
+ }
236
+ .prc-picker-item--is-disabled:hover {
237
+ background-color: transparent !important;
238
+ }
239
+
240
+ /* Footer */
241
+ .prc-footer {
242
+ display: flex;
243
+ align-items: center;
244
+ justify-content: center;
245
+ gap: 0.5rem;
246
+ padding: 0.5rem;
247
+ background-color: var(--prc-bg-secondary);
248
+ border-top: 1px solid var(--prc-border-primary);
249
+ font-size: 0.75rem;
250
+ color: var(--prc-text-secondary);
251
+ }
252
+ .prc-footer svg {
253
+ color: #22c55e; /* success color */
254
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "mehdi-akbari-calendar",
3
+ "version": "0.1.0",
4
+ "description": "A professional and customizable Persian (Jalali) calendar component for React.",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js"
18
+ },
19
+ "./react": {
20
+
21
+ "types": "./dist/index.react.d.ts",
22
+ "import": "./dist/index.react.mjs",
23
+ "require": "./dist/index.react.js"
24
+ },
25
+ "./styles.css": "./dist/styles.css"
26
+ },
27
+ "scripts": {
28
+ "build": "tsup && copyfiles -u 1 src/styles.css dist",
29
+ "dev": "tsup --watch",
30
+ "prepublishOnly": "npm run build",
31
+ "test": "echo \"Error: no test specified\" && exit 1"
32
+ },
33
+ "peerDependencies": {
34
+ "react": ">=18",
35
+ "react-dom": ">=18"
36
+ },
37
+ "dependencies": {
38
+ "clsx": "^2.1.1",
39
+ "date-fns": "^3.6.0",
40
+ "date-fns-jalali": "^2.30.0-0"
41
+ },
42
+ "devDependencies": {
43
+ "@types/react": "^18.3.3",
44
+ "@types/react-dom": "^18.3.0",
45
+ "copyfiles": "^2.4.1",
46
+ "react": "^18.3.1",
47
+ "react-dom": "^18.3.1",
48
+ "tsup": "^8.1.0",
49
+ "typescript": "^5.4.5"
50
+ },
51
+ "keywords": [
52
+ "react",
53
+ "calendar",
54
+ "persian",
55
+ "jalali",
56
+ "datepicker",
57
+ "ui-component"
58
+ ],
59
+ "author": "Mehdi Akbari",
60
+ "license": "MIT",
61
+ "homepage": "https://github.com/your-username/persian-react-calendar#readme",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/your-username/persian-react-calendar.git"
65
+ },
66
+ "bugs": {
67
+ "url": "https://github.com/your-username/persian-react-calendar/issues"
68
+ }
69
+ }