@asafarim/booking-calendar 0.3.0 → 0.4.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/README.md +76 -23
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @asafarim/booking-calendar
|
|
2
2
|
|
|
3
|
-
Google Calendar-style booking UI for
|
|
3
|
+
Google Calendar-style booking UI for React. Built with TypeScript, Vite, and ASafariM design tokens.
|
|
4
|
+
|
|
5
|
+

|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -41,22 +43,36 @@ function App() {
|
|
|
41
43
|
|
|
42
44
|
## Features
|
|
43
45
|
|
|
44
|
-
- ✅ Month/Week/Day views
|
|
45
|
-
- ✅ Click
|
|
46
|
-
- ✅ Click
|
|
47
|
-
- ✅
|
|
48
|
-
- ✅ Drag
|
|
49
|
-
- ✅
|
|
50
|
-
- ✅
|
|
51
|
-
- ✅
|
|
52
|
-
- ✅
|
|
53
|
-
- ✅
|
|
46
|
+
- ✅ **Month/Week/Day views** - Switch between calendar views
|
|
47
|
+
- ✅ **Jump to Date** - Click month/year label to quickly navigate to any date
|
|
48
|
+
- ✅ **Click to create** - Click empty slot to create booking
|
|
49
|
+
- ✅ **Click to edit** - Click booking to edit details
|
|
50
|
+
- ✅ **Drag to move** - Drag bookings to reschedule
|
|
51
|
+
- ✅ **Drag to resize** - Adjust booking duration
|
|
52
|
+
- ✅ **Status badges** - Pending, Confirmed, Cancelled, Completed, NoShow
|
|
53
|
+
- ✅ **Delivery status** - Track notification delivery
|
|
54
|
+
- ✅ **Availability checking** - Validate time slots
|
|
55
|
+
- ✅ **Client details** - Display client info on bookings
|
|
56
|
+
- ✅ **Mobile-first responsive** - Works on 320px–4K screens
|
|
57
|
+
- ✅ **Dark theme** - Built-in dark mode with design tokens
|
|
58
|
+
- ✅ **Keyboard accessible** - Full keyboard navigation support
|
|
59
|
+
- ✅ **Modal dialogs** - Create/edit bookings with validation
|
|
60
|
+
|
|
61
|
+
## Jump to Date Modal
|
|
62
|
+
|
|
63
|
+
Click the month/year label in the header to open the Jump to Date modal. Navigate to any date using:
|
|
64
|
+
|
|
65
|
+
- Year input with +/- buttons
|
|
66
|
+
- 12-month grid selector
|
|
67
|
+
- Mini calendar with 6-week view
|
|
68
|
+
|
|
69
|
+

|
|
54
70
|
|
|
55
71
|
## API Integration
|
|
56
72
|
|
|
57
73
|
The component expects these FreelanceToolkit.Api endpoints:
|
|
58
74
|
|
|
59
|
-
```
|
|
75
|
+
```bash
|
|
60
76
|
GET /api/calendar/bookings
|
|
61
77
|
POST /api/calendar/bookings
|
|
62
78
|
PUT /api/calendar/bookings/{id}
|
|
@@ -67,7 +83,7 @@ POST /api/calendar/bookings/check-availability
|
|
|
67
83
|
## Props
|
|
68
84
|
|
|
69
85
|
| Prop | Type | Required | Description |
|
|
70
|
-
|
|
86
|
+
| --- | --- | --- | --- |
|
|
71
87
|
| `bookings` | `BookingEvent[]` | Yes | Array of bookings |
|
|
72
88
|
| `onCreateBooking` | `(dto) => Promise<void>` | No | Create handler |
|
|
73
89
|
| `onUpdateBooking` | `(id, dto) => Promise<void>` | No | Update handler |
|
|
@@ -101,35 +117,72 @@ interface BookingEvent {
|
|
|
101
117
|
|
|
102
118
|
## Styling
|
|
103
119
|
|
|
120
|
+
The component uses ASafariM design tokens for colors, spacing, and typography. All styles are mobile-first responsive and support dark theme.
|
|
121
|
+
|
|
104
122
|
Override CSS variables:
|
|
105
123
|
|
|
106
124
|
```css
|
|
107
125
|
.booking-calendar {
|
|
108
|
-
--
|
|
109
|
-
--
|
|
110
|
-
--
|
|
111
|
-
--
|
|
112
|
-
--
|
|
113
|
-
--
|
|
126
|
+
--bc-bg: #0b0b10;
|
|
127
|
+
--bc-surface: #111827;
|
|
128
|
+
--bc-grid-line: #1f2933;
|
|
129
|
+
--bc-text: #e5e7eb;
|
|
130
|
+
--bc-muted: #9ca3af;
|
|
131
|
+
--bc-accent: #3b82f6;
|
|
132
|
+
--bc-danger: #ef4444;
|
|
133
|
+
--bc-success: #22c55e;
|
|
134
|
+
--bc-warning: #eab308;
|
|
135
|
+
--bc-border-radius-sm: 4px;
|
|
136
|
+
--bc-border-radius-md: 8px;
|
|
114
137
|
}
|
|
115
138
|
```
|
|
116
139
|
|
|
140
|
+
## Responsive Design
|
|
141
|
+
|
|
142
|
+
The calendar is built mobile-first and works seamlessly on all screen sizes:
|
|
143
|
+
|
|
144
|
+
- **Mobile (320–479px)**: Stacked header, compact buttons, sheet-style modals
|
|
145
|
+
- **Tablet (480–767px)**: Adjusted spacing, single-column form rows
|
|
146
|
+
- **Desktop (768px+)**: Full layout with side-by-side elements
|
|
147
|
+
|
|
148
|
+
## Accessibility
|
|
149
|
+
|
|
150
|
+
- Full keyboard navigation (Tab, Enter, Escape)
|
|
151
|
+
- ARIA labels on all interactive elements
|
|
152
|
+
- Focus-visible states for keyboard users
|
|
153
|
+
- Semantic HTML structure
|
|
154
|
+
- Color contrast compliant
|
|
155
|
+
|
|
117
156
|
## Development
|
|
118
157
|
|
|
119
158
|
```bash
|
|
120
159
|
# Install dependencies
|
|
121
160
|
pnpm install
|
|
122
161
|
|
|
123
|
-
# Run
|
|
124
|
-
pnpm
|
|
162
|
+
# Run demo
|
|
163
|
+
pnpm demo
|
|
125
164
|
|
|
126
165
|
# Build package
|
|
127
166
|
pnpm build
|
|
128
167
|
|
|
129
|
-
#
|
|
130
|
-
|
|
168
|
+
# Build and deploy demo
|
|
169
|
+
pnpm deploy
|
|
170
|
+
|
|
171
|
+
# Release new version
|
|
172
|
+
pnpm release
|
|
131
173
|
```
|
|
132
174
|
|
|
175
|
+
## Components
|
|
176
|
+
|
|
177
|
+
- `BookingCalendar` - Main calendar component
|
|
178
|
+
- `MonthView` - Month view renderer
|
|
179
|
+
- `WeekView` - Week view renderer
|
|
180
|
+
- `DayView` - Day view renderer
|
|
181
|
+
- `BookingModal` - Create/edit booking modal
|
|
182
|
+
- `JumpToDateModal` - Date navigation modal
|
|
183
|
+
- `BookingStatusBadge` - Status indicator
|
|
184
|
+
- `DeliveryStatusBadge` - Delivery status indicator
|
|
185
|
+
|
|
133
186
|
## License
|
|
134
187
|
|
|
135
188
|
MIT © ASafariM
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asafarim/booking-calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Google Calendar-style booking UI for FreelanceToolkit.Api",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"predemo": "pnpm install && pnpm run build",
|
|
63
63
|
"demo": "cd demo && pnpm run dev",
|
|
64
64
|
"deploy-demo": "cd demo && pnpm run deploy",
|
|
65
|
-
"deploy": "pnpm run predemo && cd demo && pnpm run deploy-demo"
|
|
65
|
+
"deploy": "pnpm run predemo && cd demo && pnpm run deploy-demo",
|
|
66
|
+
"release": "pnpm run build && node ./scripts/release.js"
|
|
66
67
|
}
|
|
67
68
|
}
|