keystone-design-bootstrap 1.0.68 → 1.0.70
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 +74 -132
- package/dist/design_system/sections/index.js +110 -60
- package/dist/design_system/sections/index.js.map +1 -1
- package/dist/index.js +117 -61
- package/dist/index.js.map +1 -1
- package/dist/lib/server-api.d.ts +9 -1
- package/dist/lib/server-api.js +11 -0
- package/dist/lib/server-api.js.map +1 -1
- package/dist/tracking/index.d.ts +134 -5
- package/dist/tracking/index.js +123 -0
- package/dist/tracking/index.js.map +1 -1
- package/package.json +2 -1
- package/src/design_system/components/ChatWidget.tsx +6 -7
- package/src/design_system/portal/LoginForm.tsx +21 -2
- package/src/design_system/portal/PortalPage.tsx +5 -5
- package/src/design_system/portal/PortalTabTracker.tsx +10 -2
- package/src/design_system/sections/contact-section-form.aman.tsx +6 -1
- package/src/design_system/sections/contact-section-form.balance.tsx +6 -1
- package/src/design_system/sections/contact-section-form.barelux.tsx +6 -1
- package/src/design_system/sections/contact-section-form.tsx +6 -1
- package/src/design_system/sections/email-signup-section.tsx +6 -1
- package/src/design_system/sections/header-navigation.aman.tsx +6 -1
- package/src/design_system/sections/header-navigation.balance.tsx +6 -1
- package/src/design_system/sections/header-navigation.barelux.tsx +6 -1
- package/src/design_system/sections/header-navigation.tsx +6 -1
- package/src/design_system/sections/job-application-form.aman.tsx +6 -1
- package/src/design_system/sections/job-application-form.barelux.tsx +6 -1
- package/src/design_system/sections/job-application-form.tsx +6 -1
- package/src/lib/server-api.ts +18 -0
- package/src/next/layouts/root-layout.tsx +78 -33
- package/src/tracking/KeystoneAnalyticsTracker.tsx +41 -0
- package/src/tracking/PostHogProvider.tsx +128 -0
- package/src/tracking/captureEvent.ts +140 -0
- package/src/tracking/index.ts +5 -0
package/README.md
CHANGED
|
@@ -1,175 +1,117 @@
|
|
|
1
1
|
# Keystone Design Bootstrap
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared design system and runtime package powering all Keystone customer websites. Provides themed sections, UI elements, the member portal, server-side API helpers, form handling, Meta Pixel tracking, and the Next.js app shell.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
```typescript
|
|
9
|
-
export const config = {
|
|
10
|
-
site: { theme: "barelux" } // or "aman", "classic"
|
|
11
|
-
}
|
|
12
|
-
```
|
|
7
|
+
## Documentation
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
| Doc | Description |
|
|
10
|
+
|---|---|
|
|
11
|
+
| [`docs/architecture.md`](./docs/architecture.md) | Package structure, rendering model, theme system, publishing workflow |
|
|
12
|
+
| [`docs/server-api.md`](./docs/server-api.md) | All data-fetching functions, caching strategy, environment variables |
|
|
13
|
+
| [`docs/navigation-and-layout.md`](./docs/navigation-and-layout.md) | `KeystoneRootLayout`, `SiteConfig`, CTA URL resolution, dynamic nav, mobile sticky footer |
|
|
14
|
+
| [`docs/member-portal.md`](./docs/member-portal.md) | Member portal setup, tabs, auth flow, iframe booking, messaging |
|
|
15
|
+
| [`docs/forms.md`](./docs/forms.md) | Dynamic forms, `ContactSection`, form route, custom form pattern |
|
|
16
|
+
| [`docs/meta-tracking.md`](./docs/meta-tracking.md) | Meta Pixel initialization, automatic events, custom form tracking |
|
|
17
|
+
| [`docs/site-customization.md`](./docs/site-customization.md) | Per-site config, style overrides, component customization hierarchy |
|
|
18
|
+
| [`docs/theme-system.md`](./docs/theme-system.md) | Creating and registering themes, CSS tokens, component variants |
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
---
|
|
23
21
|
|
|
24
|
-
##
|
|
22
|
+
## Quick start (new customer site)
|
|
23
|
+
|
|
24
|
+
### 1. Environment variables
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
|
|
27
|
+
# .env.local
|
|
28
|
+
API_URL=http://localhost:3000/api/v1
|
|
29
|
+
API_KEY=your-api-key-here
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Elements
|
|
33
|
-
Reusable UI components:
|
|
32
|
+
### 2. Config
|
|
34
33
|
|
|
35
34
|
```typescript
|
|
36
|
-
|
|
35
|
+
// config/index.ts
|
|
36
|
+
import type { SiteConfig } from 'keystone-design-bootstrap/types';
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
export const config: SiteConfig = {
|
|
39
|
+
site: { title: "Business Name", description: "…", theme: "aman" },
|
|
40
|
+
navigation: { header: […], footer: [[…], […], […], […]] },
|
|
41
|
+
};
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
###
|
|
44
|
-
Async functions for fetching data server-side:
|
|
44
|
+
### 3. Root layout
|
|
45
45
|
|
|
46
46
|
```typescript
|
|
47
|
-
|
|
47
|
+
// app/layout.tsx
|
|
48
|
+
import { KeystoneRootLayout } from 'keystone-design-bootstrap/next/layouts/root-layout';
|
|
49
|
+
import { config } from '@/config';
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Sections
|
|
54
|
-
Pre-built page components that accept data via props:
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
import { HeroHome, TestimonialsHome } from '@keystone-pzjr/design-bootstrap/sections'
|
|
58
|
-
import { getTestimonials } from '@keystone-pzjr/design-bootstrap/lib/server-api'
|
|
59
|
-
|
|
60
|
-
export default async function HomePage() {
|
|
61
|
-
const testimonials = await getTestimonials()
|
|
62
|
-
return (
|
|
63
|
-
<main>
|
|
64
|
-
<HeroHome />
|
|
65
|
-
<TestimonialsHome testimonials={testimonials} />
|
|
66
|
-
</main>
|
|
67
|
-
)
|
|
51
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
52
|
+
return <KeystoneRootLayout config={config}>{children}</KeystoneRootLayout>;
|
|
68
53
|
}
|
|
69
54
|
```
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## Package Exports
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
// Sections (hero, footer, header, testimonials, etc.)
|
|
77
|
-
import { HeroHome, FooterHome, TestimonialsHome } from '@keystone-pzjr/design-bootstrap/sections'
|
|
78
|
-
|
|
79
|
-
// Elements (buttons, inputs, carousels, etc.)
|
|
80
|
-
import { Button, Input, Carousel } from '@keystone-pzjr/design-bootstrap/elements'
|
|
81
|
-
|
|
82
|
-
// Hooks
|
|
83
|
-
import { useBreakpoint } from '@keystone-pzjr/design-bootstrap/hooks'
|
|
84
|
-
|
|
85
|
-
// Theme context
|
|
86
|
-
import { ThemeProvider } from '@keystone-pzjr/design-bootstrap/contexts'
|
|
56
|
+
### 4. CSS imports
|
|
87
57
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
import
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
import { themes } from '@keystone-pzjr/design-bootstrap/themes'
|
|
58
|
+
```css
|
|
59
|
+
/* app/globals.css */
|
|
60
|
+
@import "keystone-design-bootstrap/styles/fonts.css";
|
|
61
|
+
@import "keystone-design-bootstrap/styles/theme.css";
|
|
62
|
+
@import "keystone-design-bootstrap/styles/typography.css";
|
|
63
|
+
@import "keystone-design-bootstrap/styles/style-overrides.aman.css"; /* match your theme */
|
|
64
|
+
@import "../styles/custom-overrides.css";
|
|
96
65
|
```
|
|
97
66
|
|
|
98
|
-
|
|
67
|
+
---
|
|
99
68
|
|
|
100
|
-
|
|
69
|
+
## Package exports reference
|
|
101
70
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
| Event | Trigger |
|
|
71
|
+
| Import path | Contents |
|
|
105
72
|
|---|---|
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
73
|
+
| `keystone-design-bootstrap/sections` | All section components |
|
|
74
|
+
| `keystone-design-bootstrap/elements` | UI element components |
|
|
75
|
+
| `keystone-design-bootstrap/portal` | `PortalPage` and portal sub-components |
|
|
76
|
+
| `keystone-design-bootstrap/next/layouts/root-layout` | `KeystoneRootLayout` |
|
|
77
|
+
| `keystone-design-bootstrap/next/routes/consumer-auth` | `createConsumerAuthHandlers` |
|
|
78
|
+
| `keystone-design-bootstrap/next/routes/form` | `createFormRouteHandlers` (re-exported as `POST`) |
|
|
79
|
+
| `keystone-design-bootstrap/lib/server-api` | Server-side data fetching functions |
|
|
80
|
+
| `keystone-design-bootstrap/lib/cta-urls` | `resolveCtaUrls`, `resolvePortalPath`, `isExternalCtaUrl` |
|
|
81
|
+
| `keystone-design-bootstrap/tracking` | `firePixelEvent`, `setPixelUserData` |
|
|
82
|
+
| `keystone-design-bootstrap/types` | TypeScript types |
|
|
83
|
+
| `keystone-design-bootstrap/hooks` | Client-side hooks |
|
|
84
|
+
| `keystone-design-bootstrap/styles/*` | CSS files |
|
|
114
85
|
|
|
115
|
-
|
|
116
|
-
import { firePixelEvent, setPixelUserData } from 'keystone-design-bootstrap/tracking';
|
|
117
|
-
|
|
118
|
-
// inside your success handler, after a confirmed API response:
|
|
119
|
-
await setPixelUserData({ email: data.email, phone: data.phone });
|
|
120
|
-
firePixelEvent('Lead');
|
|
121
|
-
```
|
|
86
|
+
---
|
|
122
87
|
|
|
123
|
-
|
|
88
|
+
## Local development
|
|
124
89
|
|
|
125
|
-
|
|
90
|
+
Use `yalc` to test local builds in a customer site:
|
|
126
91
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
- **Server-first**: Data fetching happens server-side, components render as Server Components where possible
|
|
132
|
-
- **Theme variants**: Components automatically select variants based on active theme
|
|
133
|
-
- **Tailwind-first**: Use semantic utility classes (`bg-primary`, `text-fg-primary`, `font-display`)
|
|
134
|
-
- **Type-safe**: Full TypeScript support throughout
|
|
135
|
-
- **CSS variables**: Themes customize via CSS custom properties
|
|
136
|
-
- **Self-hosted fonts**: Uses Fontsource for optimized, bundled font loading
|
|
137
|
-
|
|
138
|
-
## Theme System
|
|
139
|
-
|
|
140
|
-
**Available themes:** `classic`, `aman`, `barelux`
|
|
141
|
-
|
|
142
|
-
### Themes
|
|
92
|
+
```bash
|
|
93
|
+
# In this package
|
|
94
|
+
npm run build && yalc publish
|
|
143
95
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- **barelux**: Modern minimal theme with Poppins, clean lines
|
|
96
|
+
# In the customer site
|
|
97
|
+
yalc update keystone-design-bootstrap
|
|
147
98
|
|
|
148
|
-
|
|
99
|
+
# To restore the published npm version
|
|
100
|
+
yalc remove keystone-design-bootstrap && npm install
|
|
101
|
+
```
|
|
149
102
|
|
|
150
|
-
|
|
103
|
+
---
|
|
151
104
|
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
I am creating a new theme. Here is a link to an example: https://www.example.com
|
|
155
|
-
[Attach screenshots of various pages]
|
|
105
|
+
## Creating a new theme
|
|
156
106
|
|
|
157
|
-
|
|
158
|
-
```
|
|
107
|
+
See [`docs/theme-system.md`](./docs/theme-system.md) for the full guide.
|
|
159
108
|
|
|
160
|
-
|
|
109
|
+
Quick checklist:
|
|
161
110
|
1. Register in `src/themes/index.ts`
|
|
162
111
|
2. Install fonts via Fontsource
|
|
163
112
|
3. Create `src/styles/style-overrides.{theme}.css`
|
|
164
113
|
4. Create component variants (optional)
|
|
165
|
-
5. Add to design gallery
|
|
166
|
-
6.
|
|
167
|
-
|
|
168
|
-
**Critical rules:**
|
|
169
|
-
- Never modify base components or foundation CSS
|
|
170
|
-
- Use semantic variables/classes only
|
|
171
|
-
- Set BOTH `--color-*` and `--background-*` prefixes
|
|
172
|
-
- Match base component props exactly
|
|
173
|
-
- Ensure `npm run lint`, `npm run typecheck`, `npm run build` pass with zero errors/warnings
|
|
114
|
+
5. Add to design gallery
|
|
115
|
+
6. `npm run lint && npm run typecheck && npm run build` — must all pass
|
|
174
116
|
|
|
175
|
-
|
|
117
|
+
**Available themes:** `classic`, `aman`, `barelux`, `balance`
|