Skip to content

Commit 50b3566

Browse files
committed
V1 of workflows for generating code components, first few tests, libraries installed. Uses Output
1 parent b1b8cba commit 50b3566

67 files changed

Lines changed: 57072 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

calendar/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Calendar
2+
3+
A date picker calendar built on [react-day-picker](https://daypicker.dev/) that adapts to your Webflow site's design system. Drop it in, and it matches your site's colors, typography, and spacing automatically.
4+
5+
## Getting Started
6+
7+
```bash
8+
npm install
9+
npx webflow library share
10+
```
11+
12+
For local development: `npm run dev``http://localhost:5173`
13+
14+
## Designer Properties
15+
16+
These are configurable in the Webflow Designer properties panel:
17+
18+
| Property | Type | Default | Description |
19+
|----------|------|---------|-------------|
20+
| Element ID | ID || HTML ID for targeting with CSS or JavaScript |
21+
| Size | Variant | `default` | Cell sizing: `compact` (28px), `default` (36px), `large` (44px) |
22+
| Caption Layout | Variant | `label` | `label` shows month/year text, `dropdown` adds month/year selectors |
23+
| Show Outside Days | Boolean | `true` | Show dates from previous and next months |
24+
| Show Week Numbers | Boolean | `false` | Display ISO week numbers in the first column |
25+
| Fixed Weeks | Boolean | `false` | Always show 6 weeks so calendar height stays consistent |
26+
| Header | Slot || Content area above the calendar grid |
27+
| Footer | Slot || Content area below the calendar grid |
28+
29+
## Styling
30+
31+
This component automatically adapts to your Webflow site's design system. It inherits `font-family`, `color`, and `line-height` from its parent element, and references site variables for everything else.
32+
33+
### Site Variables
34+
35+
Make sure your site defines these variables, or rename them in `Calendar.css` to match your site's variable names:
36+
37+
| Site Variable | What It Controls | Fallback |
38+
|---------------|-----------------|----------|
39+
| `--background-primary` | Calendar background | `#ffffff` |
40+
| `--background-secondary` | Hover states, today highlight | `#f5f5f5` |
41+
| `--text-primary` | Day numbers, navigation | `#1a1a1a` |
42+
| `--text-secondary` | Weekday labels, outside days, week numbers | `#737373` |
43+
| `--border-color` | Calendar border, footer separator | `#e5e5e5` |
44+
| `--accent-color` | Selected date background, focus ring | `#1a1a1a` |
45+
| `--accent-text-color` | Selected date text | `#ffffff` |
46+
| `--border-radius` | Corner rounding on calendar, buttons, cells | `8px` |
47+
48+
**To find your site's variable names:** In the Webflow Designer, open the Variables panel, click the three-dot menu on any variable, and select "Copy CSS". Then update `Calendar.css` to match.
49+
50+
### Inherited Properties
51+
52+
These CSS properties pass through Shadow DOM automatically — the calendar picks them up from its parent:
53+
54+
- `font-family` — uses your site's typeface
55+
- `color` — uses your site's text color
56+
- `line-height` — uses your site's line height
57+
58+
### Tag Selectors
59+
60+
This component has `applyTagSelectors: true`, so any tag-level styles you've defined in your site (like `button` styling) will apply inside the calendar.
61+
62+
## Extending in Code
63+
64+
The calendar ships with single-date selection wired up internally. To customize behavior, edit `Calendar.tsx`:
65+
66+
### Change selection mode
67+
68+
```tsx
69+
// Range selection
70+
<DayPicker mode="range" selected={range} onSelect={setRange} />
71+
72+
// Multiple dates
73+
<DayPicker mode="multiple" selected={dates} onSelect={setDates} />
74+
```
75+
76+
### Disable specific dates
77+
78+
```tsx
79+
<DayPicker
80+
disabled={[
81+
{ before: new Date() }, // disable past dates
82+
{ dayOfWeek: [0, 6] }, // disable weekends
83+
new Date(2026, 0, 1), // disable specific date
84+
]}
85+
/>
86+
```
87+
88+
### Add locale support
89+
90+
```tsx
91+
import { es } from "react-day-picker/locale";
92+
93+
<DayPicker locale={es} />
94+
```
95+
96+
### Communicate selected date to other components
97+
98+
Since Webflow code components run in isolated Shadow DOM containers, use one of these patterns:
99+
100+
```tsx
101+
// Custom events
102+
const handleSelect = (date: Date | undefined) => {
103+
setSelected(date);
104+
window.dispatchEvent(new CustomEvent("calendar-date-selected", {
105+
detail: { date: date?.toISOString() },
106+
}));
107+
};
108+
109+
// URL params
110+
const url = new URL(window.location.href);
111+
url.searchParams.set("date", date.toISOString());
112+
window.history.pushState({}, "", url);
113+
114+
// localStorage
115+
localStorage.setItem("selectedDate", date.toISOString());
116+
```
117+
118+
## Dependencies
119+
120+
- [react-day-picker](https://daypicker.dev/) — date picker engine

calendar/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Calendar</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)