@prokodo/ui 0.0.52 → 0.0.53
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 +81 -81
- package/dist/components/accordion/Accordion.client.js +3 -1
- package/dist/components/accordion/Accordion.view.js +100 -81
- package/dist/components/animated/Animated.server.js +3 -1
- package/dist/components/animatedText/AnimatedText.client.js +1 -7
- package/dist/components/animatedText/AnimatedText.view.js +4 -1
- package/dist/components/avatar/Avatar.view.js +2 -2
- package/dist/components/base-link/BaseLink.view.js +1 -1
- package/dist/components/button/Button.server.js +1 -8
- package/dist/components/calendly/Calendly.client.js +63 -54
- package/dist/components/calendly/Calendly.server.js +3 -1
- package/dist/components/card/Card.client.js +2 -1
- package/dist/components/card/Card.effects.client.js +5 -1
- package/dist/components/card/Card.view.js +19 -2
- package/dist/components/carousel/Carousel.client.js +36 -12
- package/dist/components/chip/Chip.view.js +10 -6
- package/dist/components/datePicker/DatePicker.client.js +53 -37
- package/dist/components/datePicker/DatePicker.view.js +3 -1
- package/dist/components/dialog/Dialog.client.js +22 -14
- package/dist/components/dialog/Dialog.view.js +10 -2
- package/dist/components/drawer/Drawer.client.js +10 -2
- package/dist/components/drawer/Drawer.effects.client.js +7 -2
- package/dist/components/dynamic-list/DynamicList.client.js +8 -7
- package/dist/components/dynamic-list/DynamicList.server.js +10 -4
- package/dist/components/dynamic-list/DynamicList.view.js +1 -1
- package/dist/components/form/Form.client.js +16 -13
- package/dist/components/form/Form.view.js +8 -4
- package/dist/components/form/FormField.client.js +5 -5
- package/dist/components/form/FormField.server.js +3 -23
- package/dist/components/form/FormResponse.js +5 -1
- package/dist/components/grid/Grid.js +7 -2
- package/dist/components/grid/GridRow.js +12 -2
- package/dist/components/headline/Headline.js +3 -1
- package/dist/components/icon/Icon.js +8 -4
- package/dist/components/image-text/ImageText.js +5 -1
- package/dist/components/input/Input.client.js +52 -28
- package/dist/components/input/Input.view.js +92 -68
- package/dist/components/inputOTP/InputOTP.js +107 -90
- package/dist/components/label/Label.js +1 -8
- package/dist/components/link/Link.view.js +3 -1
- package/dist/components/list/List.js +94 -42
- package/dist/components/loading/Loading.client.js +15 -2
- package/dist/components/loading/Loading.server.js +8 -1
- package/dist/components/loading/Loading.view.js +30 -7
- package/dist/components/post-item/PostItem.client.js +18 -0
- package/dist/components/post-item/PostItem.js +7 -136
- package/dist/components/post-item/PostItem.lazy.js +14 -0
- package/dist/components/post-item/PostItem.module.scss.js +3 -1
- package/dist/components/post-item/PostItem.server.js +15 -0
- package/dist/components/post-item/PostItem.view.js +238 -0
- package/dist/components/post-item/PostItemAuthor.js +28 -22
- package/dist/components/post-teaser/PostTeaser.client.js +31 -0
- package/dist/components/post-teaser/PostTeaser.js +9 -169
- package/dist/components/post-teaser/PostTeaser.lazy.js +13 -0
- package/dist/components/post-teaser/PostTeaser.module.scss.js +3 -0
- package/dist/components/post-teaser/PostTeaser.server.js +23 -0
- package/dist/components/post-teaser/PostTeaser.view.js +252 -0
- package/dist/components/post-widget/PostWidget.client.js +9 -0
- package/dist/components/post-widget/PostWidget.js +11 -156
- package/dist/components/post-widget/PostWidget.lazy.js +13 -0
- package/dist/components/post-widget/PostWidget.module.scss.js +1 -0
- package/dist/components/post-widget/PostWidget.server.js +11 -0
- package/dist/components/post-widget/PostWidget.view.js +263 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.client.js +9 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.js +9 -160
- package/dist/components/post-widget-carousel/PostWidgetCarousel.lazy.js +13 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +3 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.server.js +11 -0
- package/dist/components/post-widget-carousel/PostWidgetCarousel.view.js +244 -0
- package/dist/components/rich-text/RichText.client.js +7 -2
- package/dist/components/select/Select.view.js +132 -116
- package/dist/components/sidenav/SideNav.client.js +19 -18
- package/dist/components/sidenav/SideNav.server.js +8 -1
- package/dist/components/sidenav/SideNav.view.js +21 -3
- package/dist/components/skeleton/Skeleton.effects.client.js +3 -1
- package/dist/components/slider/Slider.client.js +56 -38
- package/dist/components/slider/Slider.view.js +1 -7
- package/dist/components/snackbar/SnackbarProvider.client.js +21 -22
- package/dist/components/stepper/Stepper.client.js +1 -8
- package/dist/components/switch/Switch.client.js +1 -6
- package/dist/components/switch/Switch.server.js +1 -3
- package/dist/components/table/Table.js +3 -1
- package/dist/components/table/TableCell.js +13 -1
- package/dist/components/teaser/Teaser.js +1 -5
- package/dist/constants/project.js +1 -1
- package/dist/helpers/createIsland.js +3 -1
- package/dist/helpers/createLazyWrapper.js +3 -1
- package/dist/helpers/date.js +21 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/accordion/Accordion.model.d.ts +1 -1
- package/dist/types/components/animated/Animated.client.d.ts +2 -2
- package/dist/types/components/animated/Animated.model.d.ts +1 -1
- package/dist/types/components/button/Button.client.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/button/Button.lazy.d.ts +1 -1
- package/dist/types/components/button/Button.server.d.ts +1 -1
- package/dist/types/components/button/Button.view.d.ts +1 -1
- package/dist/types/components/card/Card.effects.client.d.ts +1 -1
- package/dist/types/components/card/index.d.ts +1 -1
- package/dist/types/components/carousel/Carousel.d.ts +3 -0
- package/dist/types/components/carousel/Carousel.lazy.d.ts +3 -0
- package/dist/types/components/carousel/Carousel.model.d.ts +4 -0
- package/dist/types/components/dialog/Dialog.client.d.ts +1 -1
- package/dist/types/components/dialog/Dialog.model.d.ts +4 -4
- package/dist/types/components/dialog/Dialog.view.d.ts +2 -2
- package/dist/types/components/drawer/Drawer.client.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.effects.client.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.lazy.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.model.d.ts +6 -6
- package/dist/types/components/drawer/Drawer.server.d.ts +1 -1
- package/dist/types/components/drawer/Drawer.view.d.ts +2 -2
- package/dist/types/components/drawer/index.d.ts +1 -1
- package/dist/types/components/icon/IconList.d.ts +1 -1
- package/dist/types/components/icon/index.d.ts +1 -1
- package/dist/types/components/image/Image.model.d.ts +2 -2
- package/dist/types/components/link/Link.d.ts +1 -1
- package/dist/types/components/link/Link.model.d.ts +1 -1
- package/dist/types/components/link/Link.server.d.ts +1 -1
- package/dist/types/components/loading/index.d.ts +1 -1
- package/dist/types/components/post-item/PostItem.client.d.ts +4 -0
- package/dist/types/components/post-item/PostItem.d.ts +3 -2
- package/dist/types/components/post-item/PostItem.lazy.d.ts +5 -0
- package/dist/types/components/post-item/PostItem.model.d.ts +46 -6
- package/dist/types/components/post-item/PostItem.server.d.ts +3 -0
- package/dist/types/components/post-item/PostItem.view.d.ts +3 -0
- package/dist/types/components/post-item/PostItemAuthor.model.d.ts +5 -8
- package/dist/types/components/post-item/index.d.ts +2 -2
- package/dist/types/components/post-teaser/PostTeaser.client.d.ts +4 -0
- package/dist/types/components/post-teaser/PostTeaser.d.ts +3 -2
- package/dist/types/components/post-teaser/PostTeaser.lazy.d.ts +5 -0
- package/dist/types/components/post-teaser/PostTeaser.model.d.ts +49 -3
- package/dist/types/components/post-teaser/PostTeaser.server.d.ts +3 -0
- package/dist/types/components/post-teaser/PostTeaser.view.d.ts +3 -0
- package/dist/types/components/post-teaser/index.d.ts +1 -1
- package/dist/types/components/post-widget/PostWidget.client.d.ts +4 -0
- package/dist/types/components/post-widget/PostWidget.d.ts +13 -3
- package/dist/types/components/post-widget/PostWidget.lazy.d.ts +14 -0
- package/dist/types/components/post-widget/PostWidget.model.d.ts +53 -3
- package/dist/types/components/post-widget/PostWidget.server.d.ts +3 -0
- package/dist/types/components/post-widget/PostWidget.view.d.ts +3 -0
- package/dist/types/components/post-widget/index.d.ts +1 -1
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.client.d.ts +3 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.d.ts +11 -3
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.lazy.d.ts +12 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.model.d.ts +39 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.server.d.ts +3 -0
- package/dist/types/components/post-widget-carousel/PostWidgetCarousel.view.d.ts +3 -0
- package/dist/types/components/post-widget-carousel/index.d.ts +1 -1
- package/dist/types/components/sidenav/index.d.ts +1 -1
- package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +2 -2
- package/dist/types/helpers/createIsland.d.ts +1 -1
- package/dist/types/helpers/createLazyWrapper.d.ts +1 -1
- package/dist/types/helpers/date.d.ts +5 -0
- package/dist/ui.css +116 -35
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ Adaptive Island Components (AIC) are fully modular and optimized for modern fram
|
|
|
39
39
|
Each component is built for **lazy loading**, works seamlessly with **React Server Components (RSC)**, and can be **tree-shaken** out when unused.
|
|
40
40
|
|
|
41
41
|
**Total bundle (all components): ~195 kB gzipped**
|
|
42
|
+
|
|
42
43
|
- **Only 5–20 kB** are typically loaded per page
|
|
43
44
|
- **Zero-JS on initial render** for most components
|
|
44
45
|
- **Hydration is deferred** until interaction or visibility
|
|
@@ -65,58 +66,57 @@ npm install @prokodo/ui
|
|
|
65
66
|
#### React
|
|
66
67
|
|
|
67
68
|
```tsx
|
|
68
|
-
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
69
|
+
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
69
70
|
|
|
70
71
|
export default function Layout() {
|
|
71
72
|
// Renders to HTML on the server with zero‐JS.
|
|
72
73
|
// On the client, it will hydrate when scrolled into view or the user interacts.
|
|
73
|
-
return <Button title="Click me"
|
|
74
|
+
return <Button title="Click me" />
|
|
74
75
|
}
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
|
|
78
78
|
#### Next.js (RSC + AIC, lazy‐hydrate when visible/interacted)
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
81
|
-
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
81
|
+
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
82
82
|
|
|
83
83
|
export default function Layout() {
|
|
84
84
|
// Renders to HTML on the server with zero‐JS.
|
|
85
85
|
// On the client, it will hydrate when scrolled into view or the user interacts.
|
|
86
|
-
return <Button title="Click me"
|
|
86
|
+
return <Button title="Click me" />
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
#### Next.js (RSC + AIC, force immediate hydration with priority)
|
|
91
91
|
|
|
92
92
|
```tsx
|
|
93
|
-
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
93
|
+
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
94
94
|
|
|
95
95
|
export default function AboveTheFoldHero() {
|
|
96
96
|
// Because this lives above the fold, we want it to hydrate right away:
|
|
97
|
-
return <Button priority title="Welcome to prokodo"
|
|
97
|
+
return <Button priority title="Welcome to prokodo" />
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
#### Next.js ("use client" wrapper, immediate hydration - above the fold)
|
|
102
102
|
|
|
103
103
|
```tsx
|
|
104
|
-
"use client"
|
|
104
|
+
"use client"
|
|
105
105
|
|
|
106
|
-
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
107
|
-
import { type FC, memo } from "react"
|
|
106
|
+
import { Button, type ButtonProps } from "@prokodo/ui/button"
|
|
107
|
+
import { type FC, memo } from "react"
|
|
108
108
|
|
|
109
109
|
// In a pure‐client file, you can wrap the AIC export.
|
|
110
110
|
// The `priority` prop here ensures hydration runs immediately when mounted.
|
|
111
|
-
export const HeadlineClient: FC<ButtonProps> = memo(
|
|
112
|
-
return <Button {...props} priority
|
|
113
|
-
})
|
|
111
|
+
export const HeadlineClient: FC<ButtonProps> = memo(props => {
|
|
112
|
+
return <Button {...props} priority />
|
|
113
|
+
})
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
#### Next.js (hydrate on visibility only, default behavior)
|
|
117
117
|
|
|
118
118
|
```tsx
|
|
119
|
-
import { Headline, type ButtonProps } from "@prokodo/ui/button"
|
|
119
|
+
import { Headline, type ButtonProps } from "@prokodo/ui/button"
|
|
120
120
|
|
|
121
121
|
export default function GalleryPage() {
|
|
122
122
|
return (
|
|
@@ -125,10 +125,10 @@ export default function GalleryPage() {
|
|
|
125
125
|
<div style={{ marginTop: "100vh" }}>
|
|
126
126
|
{/* This will render as HTML on the server;
|
|
127
127
|
on the client, it only hydrates when this element scrolls into view. */}
|
|
128
|
-
<Button title="I hydrate when you see me"/>
|
|
128
|
+
<Button title="I hydrate when you see me" />
|
|
129
129
|
</div>
|
|
130
130
|
</div>
|
|
131
|
-
)
|
|
131
|
+
)
|
|
132
132
|
}
|
|
133
133
|
```
|
|
134
134
|
|
|
@@ -139,52 +139,52 @@ export default function GalleryPage() {
|
|
|
139
139
|
- ✅ = Available as AIC (renders zero-JS RSC and self-hydrates when needed) and can also be used as a client‐only entry.
|
|
140
140
|
- \- = RSC (AIC) only; no client‐side bundle needed. (Usable in both, but best practice to use in RSC only)
|
|
141
141
|
|
|
142
|
-
| Component
|
|
143
|
-
|
|
144
|
-
| Accordion
|
|
145
|
-
| Animated
|
|
146
|
-
| AnimatedText
|
|
147
|
-
| Avatar
|
|
148
|
-
| BaseLink
|
|
149
|
-
| Button
|
|
150
|
-
| Calendly
|
|
151
|
-
| Card
|
|
152
|
-
| Carousel
|
|
153
|
-
| Chip
|
|
154
|
-
| DatePicker
|
|
155
|
-
| Dialog
|
|
156
|
-
| Drawer
|
|
157
|
-
| DynamicList
|
|
158
|
-
| Form
|
|
159
|
-
| FormResponse
|
|
160
|
-
| Grid/GridRow
|
|
161
|
-
| Headline
|
|
162
|
-
| Icon
|
|
163
|
-
| Image
|
|
164
|
-
| ImageText
|
|
165
|
-
| Input
|
|
166
|
-
| Label
|
|
167
|
-
| Link
|
|
168
|
-
| List
|
|
169
|
-
| Loading
|
|
170
|
-
| Lottie
|
|
171
|
-
| Map
|
|
172
|
-
| PostItem
|
|
173
|
-
| PostTeaser
|
|
174
|
-
| PostWidget
|
|
175
|
-
| PostWidgetCarousel
|
|
176
|
-
| ProgressBar
|
|
177
|
-
| Quote
|
|
178
|
-
| RichText
|
|
179
|
-
| Select
|
|
180
|
-
| SideNav
|
|
181
|
-
| Skeleton
|
|
182
|
-
| Slider
|
|
183
|
-
| Snackbar & Provider
|
|
184
|
-
| Stepper
|
|
185
|
-
| Switch
|
|
186
|
-
| Table
|
|
187
|
-
| Teaser
|
|
142
|
+
| Component | ✅ AIC (RSC + optional client) | ✅ SSR-Compatible (`"use client"`) |
|
|
143
|
+
| ------------------- | :----------------------------: | :--------------------------------: |
|
|
144
|
+
| Accordion | ✅ | ✅ |
|
|
145
|
+
| Animated | ✅ | ✅ |
|
|
146
|
+
| AnimatedText | ✅ | ✅ |
|
|
147
|
+
| Avatar | ✅ | ✅ |
|
|
148
|
+
| BaseLink | ✅ | ✅ |
|
|
149
|
+
| Button | ✅ | ✅ |
|
|
150
|
+
| Calendly | ✅ | ✅ |
|
|
151
|
+
| Card | ✅ | ✅ |
|
|
152
|
+
| Carousel | ✅ | ✅ |
|
|
153
|
+
| Chip | ✅ | ✅ |
|
|
154
|
+
| DatePicker | ✅ | ✅ |
|
|
155
|
+
| Dialog | ✅ | ✅ |
|
|
156
|
+
| Drawer | ✅ | ✅ |
|
|
157
|
+
| DynamicList | ✅ | ✅ |
|
|
158
|
+
| Form | ✅ | ✅ |
|
|
159
|
+
| FormResponse | ✅ | – |
|
|
160
|
+
| Grid/GridRow | ✅ | – |
|
|
161
|
+
| Headline | ✅ | - |
|
|
162
|
+
| Icon | ✅ | – |
|
|
163
|
+
| Image | ✅ | – |
|
|
164
|
+
| ImageText | ✅ | - |
|
|
165
|
+
| Input | ✅ | ✅ |
|
|
166
|
+
| Label | ✅ | – |
|
|
167
|
+
| Link | ✅ | ✅ |
|
|
168
|
+
| List | ✅ | – |
|
|
169
|
+
| Loading | ✅ | – |
|
|
170
|
+
| Lottie | ❌ | ✅ |
|
|
171
|
+
| Map | ❌ | ✅ |
|
|
172
|
+
| PostItem | ✅ | ✅ |
|
|
173
|
+
| PostTeaser | ✅ | ✅ |
|
|
174
|
+
| PostWidget | ✅ | ✅ |
|
|
175
|
+
| PostWidgetCarousel | ✅ | ✅ |
|
|
176
|
+
| ProgressBar | ✅ | ✅ |
|
|
177
|
+
| Quote | ✅ | – |
|
|
178
|
+
| RichText | ✅ | ✅ |
|
|
179
|
+
| Select | ✅ | ✅ |
|
|
180
|
+
| SideNav | ✅ | ✅ |
|
|
181
|
+
| Skeleton | ✅ | – |
|
|
182
|
+
| Slider | ✅ | ✅ |
|
|
183
|
+
| Snackbar & Provider | ✅ | ✅ |
|
|
184
|
+
| Stepper | ✅ | ✅ |
|
|
185
|
+
| Switch | ✅ | ✅ |
|
|
186
|
+
| Table | ✅ | – |
|
|
187
|
+
| Teaser | ✅ | - |
|
|
188
188
|
|
|
189
189
|
## How to create my own Island Component?
|
|
190
190
|
|
|
@@ -193,36 +193,35 @@ export default function GalleryPage() {
|
|
|
193
193
|
Island architecture lets you render components on the server and hydrate them on the client only when needed.
|
|
194
194
|
|
|
195
195
|
```tsx
|
|
196
|
-
import { createIsland } from
|
|
197
|
-
import { NavbarServer } from
|
|
196
|
+
import { createIsland } from "@prokodo/ui/createIsland"
|
|
197
|
+
import { NavbarServer } from "./Navbar.server"
|
|
198
198
|
|
|
199
|
-
import type { NavbarProps } from
|
|
199
|
+
import type { NavbarProps } from "./Navbar.model"
|
|
200
200
|
|
|
201
201
|
export const Navbar = createIsland<NavbarProps>({
|
|
202
|
-
name:
|
|
202
|
+
name: "Navbar",
|
|
203
203
|
Server: NavbarServer,
|
|
204
|
-
loadLazy: () => import(
|
|
204
|
+
loadLazy: () => import("./Navbar.lazy"),
|
|
205
205
|
|
|
206
206
|
// Optional: Force client-side hydration as soon as someone uses an action
|
|
207
207
|
// We are automatically recognizing onChange, onKeyDown, ... events. Only needed for custom attributes.
|
|
208
208
|
isInteractive: (p: NavbarProps) => p.customEvent === true,
|
|
209
|
-
})
|
|
210
|
-
|
|
209
|
+
})
|
|
211
210
|
```
|
|
212
211
|
|
|
213
212
|
### 2. Create your lazy-hydrate wrapper (Navbar.lazy):
|
|
214
213
|
|
|
215
214
|
```tsx
|
|
216
|
-
|
|
217
|
-
import { createLazyWrapper } from
|
|
215
|
+
"use client"
|
|
216
|
+
import { createLazyWrapper } from "@prokodo/ui/createLazyWrapper"
|
|
218
217
|
|
|
219
|
-
import { NavbarClient } from
|
|
220
|
-
import { NavbarServer } from
|
|
218
|
+
import { NavbarClient } from "./Navbar.client"
|
|
219
|
+
import { NavbarServer } from "./Navbar.server"
|
|
221
220
|
|
|
222
|
-
import type { NavbarProps } from
|
|
221
|
+
import type { NavbarProps } from "./Navbar.model"
|
|
223
222
|
|
|
224
223
|
export default createLazyWrapper<NavbarProps>({
|
|
225
|
-
name:
|
|
224
|
+
name: "Navbar",
|
|
226
225
|
Client: NavbarClient,
|
|
227
226
|
Server: NavbarServer,
|
|
228
227
|
|
|
@@ -233,8 +232,7 @@ export default createLazyWrapper<NavbarProps>({
|
|
|
233
232
|
// Optional: Force client-side hydration as soon as someone uses an action.
|
|
234
233
|
// We are automatically recognizing onChange, onKeyDown, ... events. Only needed for custom attributes.
|
|
235
234
|
isInteractive: (p: NavbarProps) => p.customEvent === true,
|
|
236
|
-
})
|
|
237
|
-
|
|
235
|
+
})
|
|
238
236
|
```
|
|
239
237
|
|
|
240
238
|
## 🎯 Next steps
|
|
@@ -245,9 +243,9 @@ export default createLazyWrapper<NavbarProps>({
|
|
|
245
243
|
|
|
246
244
|
## Examples (Next.js + Headless CMS)
|
|
247
245
|
|
|
248
|
-
- Next.js + **Strapi** content models
|
|
249
|
-
- Next.js + **Contentful** entries & preview
|
|
250
|
-
- Migration from **Headless WordPress** to Next.js
|
|
246
|
+
- Next.js + **Strapi** content models
|
|
247
|
+
- Next.js + **Contentful** entries & preview
|
|
248
|
+
- Migration from **Headless WordPress** to Next.js
|
|
251
249
|
|
|
252
250
|
Compare CMS options → [Strapi vs Contentful vs Headless WP](https://www.prokodo.com/de/loesung/next-js-cms?utm_source=github&utm_medium=readme_examples)
|
|
253
251
|
|
|
@@ -266,13 +264,15 @@ pnpm storybook # Start Storybook locally
|
|
|
266
264
|
```
|
|
267
265
|
|
|
268
266
|
To build:
|
|
267
|
+
|
|
269
268
|
```bash
|
|
270
269
|
pnpm run build
|
|
271
270
|
pnpm run storybook:build
|
|
272
271
|
```
|
|
273
272
|
|
|
274
273
|
## 📄 License
|
|
274
|
+
|
|
275
275
|
This library is published under the Business Source License 1.1 (BUSL-1.1).
|
|
276
276
|
|
|
277
277
|
© 2025 prokodo — All rights reserved.
|
|
278
|
-
Visit us at [prokodo.com](https://www.prokodo.com).
|
|
278
|
+
Visit us at [prokodo.com](https://www.prokodo.com).
|
|
@@ -6,7 +6,9 @@ import { useState, useCallback } from "react";
|
|
|
6
6
|
import { AccordionView } from "./Accordion.view.js";
|
|
7
7
|
function AccordionClient(props) {
|
|
8
8
|
const { expanded, onChange, ...rest } = props;
|
|
9
|
-
const [expandedIndex, setExpandedIndex] = useState(
|
|
9
|
+
const [expandedIndex, setExpandedIndex] = useState(
|
|
10
|
+
expanded
|
|
11
|
+
);
|
|
10
12
|
const handleToggle = useCallback(
|
|
11
13
|
(index, e) => {
|
|
12
14
|
const next = expandedIndex === index ? null : index;
|
|
@@ -21,87 +21,106 @@ function AccordionView({
|
|
|
21
21
|
iconProps,
|
|
22
22
|
...domRest
|
|
23
23
|
}) {
|
|
24
|
-
return /* @__PURE__ */ jsxs(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
...domRest,
|
|
28
|
+
className: bem(void 0, { [variant]: true }, className),
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx(AccordionEffectsLoader, { useBorderShift: true }),
|
|
31
|
+
items.map((item, index) => {
|
|
32
|
+
const {
|
|
33
|
+
title,
|
|
34
|
+
renderHeader,
|
|
35
|
+
renderContent,
|
|
36
|
+
actions,
|
|
37
|
+
className: itemCls
|
|
38
|
+
} = item;
|
|
39
|
+
const accId = `${id}-${title}`;
|
|
40
|
+
const isExpanded = expandedIndex === index;
|
|
41
|
+
return /* @__PURE__ */ jsxs(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: bem("item", { "is-expanded": isExpanded }, itemCls),
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"aria-controls": `${accId}-content`,
|
|
50
|
+
"aria-expanded": isExpanded,
|
|
51
|
+
className: bem("header", { "is-expanded": isExpanded }),
|
|
52
|
+
id: `${accId}-header`,
|
|
53
|
+
role: "button",
|
|
54
|
+
tabIndex: 0,
|
|
55
|
+
onClick: onToggle ? (e) => onToggle(index, e) : void 0,
|
|
56
|
+
onKeyDown: onToggle ? (e) => {
|
|
57
|
+
if (e.key === "Enter" || e.key === " ") onToggle(index, e);
|
|
58
|
+
} : void 0,
|
|
59
|
+
children: [
|
|
60
|
+
!isNull(renderHeader) ? renderHeader : /* @__PURE__ */ jsx(
|
|
61
|
+
Headline,
|
|
62
|
+
{
|
|
63
|
+
animated: true,
|
|
64
|
+
className: bem("title"),
|
|
65
|
+
highlight: isExpanded,
|
|
66
|
+
size: "xs",
|
|
67
|
+
type: "h3",
|
|
68
|
+
variant: isExpanded ? "primary" : "inherit",
|
|
69
|
+
...item.titleOptions ?? titleOptions,
|
|
70
|
+
children: title
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
Icon,
|
|
75
|
+
{
|
|
76
|
+
className: bem("icon", { "is-hidden": isExpanded }),
|
|
77
|
+
color: "inherit",
|
|
78
|
+
name: "PlusSignIcon",
|
|
79
|
+
size: "sm",
|
|
80
|
+
...iconProps
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
Icon,
|
|
85
|
+
{
|
|
86
|
+
className: bem("icon", { "is-hidden": !isExpanded }),
|
|
87
|
+
color: "inherit",
|
|
88
|
+
name: "MinusSignIcon",
|
|
89
|
+
size: "sm",
|
|
90
|
+
...iconProps
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsxs(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
"aria-labelledby": `${accId}-header`,
|
|
100
|
+
className: bem("content", { "is-expanded": isExpanded }),
|
|
101
|
+
hidden: !isExpanded,
|
|
102
|
+
id: `${accId}-content`,
|
|
103
|
+
role: "region",
|
|
104
|
+
children: [
|
|
105
|
+
!isNull(renderContent) && /* @__PURE__ */ jsx(Animated, { children: renderContent }),
|
|
106
|
+
actions !== void 0 && (actions == null ? void 0 : actions.length) ? /* @__PURE__ */ jsx("div", { className: bem("actions"), children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
107
|
+
Button,
|
|
108
|
+
{
|
|
109
|
+
...action
|
|
110
|
+
},
|
|
111
|
+
`${accId}-action-${action.id}`
|
|
112
|
+
)) }) : null
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
accId
|
|
119
|
+
);
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
105
124
|
}
|
|
106
125
|
__name(AccordionView, "AccordionView");
|
|
107
126
|
export {
|
|
@@ -2,7 +2,9 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { AnimatedView } from "./Animated.view.js";
|
|
5
|
-
function AnimatedServer({
|
|
5
|
+
function AnimatedServer({
|
|
6
|
+
...rest
|
|
7
|
+
}) {
|
|
6
8
|
rest == null ? true : delete rest.onAnimate;
|
|
7
9
|
return /* @__PURE__ */ jsx(AnimatedView, { ...rest, isVisible: false });
|
|
8
10
|
}
|
|
@@ -27,13 +27,7 @@ function AnimatedTextClient({
|
|
|
27
27
|
}, delay);
|
|
28
28
|
return () => clearTimeout(t0);
|
|
29
29
|
}, [children == null ? void 0 : children.length, delay, disabled, speed]);
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
31
|
-
AnimatedTextView,
|
|
32
|
-
{
|
|
33
|
-
...rest,
|
|
34
|
-
text: children == null ? void 0 : children.slice(0, index)
|
|
35
|
-
}
|
|
36
|
-
);
|
|
30
|
+
return /* @__PURE__ */ jsx(AnimatedTextView, { ...rest, text: children == null ? void 0 : children.slice(0, index) });
|
|
37
31
|
}
|
|
38
32
|
__name(AnimatedTextClient, "AnimatedTextClient");
|
|
39
33
|
export {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
const AnimatedTextView = /* @__PURE__ */ __name((
|
|
4
|
+
const AnimatedTextView = /* @__PURE__ */ __name(({
|
|
5
|
+
text,
|
|
6
|
+
...spanRest
|
|
7
|
+
}) => /* @__PURE__ */ jsx("span", { ...spanRest, children: text }), "AnimatedTextView");
|
|
5
8
|
AnimatedTextView.displayName = "AnimatedTextView";
|
|
6
9
|
export {
|
|
7
10
|
AnimatedTextView
|
|
@@ -31,9 +31,9 @@ function AvatarView({
|
|
|
31
31
|
Icon,
|
|
32
32
|
{
|
|
33
33
|
className: bem("icon", { [variant]: true }),
|
|
34
|
+
color: !["inherit", "white"].includes(variant) ? "white" : void 0,
|
|
34
35
|
name: "UserIcon",
|
|
35
|
-
size: getIconSize(size)
|
|
36
|
-
color: !["inherit", "white"].includes(variant) ? "white" : void 0
|
|
36
|
+
size: getIconSize(size)
|
|
37
37
|
}
|
|
38
38
|
) });
|
|
39
39
|
return redirect ? /* @__PURE__ */ jsx(
|
|
@@ -63,12 +63,12 @@ function BaseLinkView({
|
|
|
63
63
|
"a",
|
|
64
64
|
{
|
|
65
65
|
...aProps,
|
|
66
|
-
download: kind === "url" ? aProps.download : void 0,
|
|
67
66
|
href: finalHref,
|
|
68
67
|
rel: computedRel,
|
|
69
68
|
style: linkStyle,
|
|
70
69
|
tabIndex,
|
|
71
70
|
target: computedTarget,
|
|
71
|
+
download: kind === "url" ? aProps.download : void 0,
|
|
72
72
|
children
|
|
73
73
|
}
|
|
74
74
|
);
|
|
@@ -6,14 +6,7 @@ import { ButtonView } from "./Button.view.js";
|
|
|
6
6
|
function ButtonServer(p) {
|
|
7
7
|
var _a;
|
|
8
8
|
const isIconOnly = ((_a = p.iconProps) == null ? void 0 : _a.name) && !("title" in p && p.title);
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
-
ButtonView,
|
|
11
|
-
{
|
|
12
|
-
...p,
|
|
13
|
-
isIconOnly: Boolean(isIconOnly),
|
|
14
|
-
LinkComponent: LinkServer
|
|
15
|
-
}
|
|
16
|
-
);
|
|
9
|
+
return /* @__PURE__ */ jsx(ButtonView, { ...p, isIconOnly: Boolean(isIconOnly), LinkComponent: LinkServer });
|
|
17
10
|
}
|
|
18
11
|
__name(ButtonServer, "ButtonServer");
|
|
19
12
|
export {
|