@prokodo/ui 0.0.51 → 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.base.module.scss.js +0 -24
- package/dist/components/drawer/Drawer.client.js +87 -47
- package/dist/components/drawer/Drawer.effects.client.js +78 -7
- package/dist/components/drawer/Drawer.server.js +1 -0
- package/dist/components/drawer/Drawer.view.js +13 -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 +6 -2
- 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 +132 -280
- package/package.json +3 -2
- package/dist/components/drawer/Drawer.effects.module.scss.js +0 -29
|
@@ -31,7 +31,16 @@ function List({
|
|
|
31
31
|
className: bem(void 0, void 0, className),
|
|
32
32
|
children: items.map((item, i) => {
|
|
33
33
|
var _a;
|
|
34
|
-
const {
|
|
34
|
+
const {
|
|
35
|
+
id,
|
|
36
|
+
title,
|
|
37
|
+
desc,
|
|
38
|
+
icon,
|
|
39
|
+
redirect,
|
|
40
|
+
onClick,
|
|
41
|
+
variant: itemVariant,
|
|
42
|
+
className: itemClassName
|
|
43
|
+
} = item;
|
|
35
44
|
const isClickable = Boolean(onClick || redirect);
|
|
36
45
|
const liHandlers = {};
|
|
37
46
|
if (isClickable) {
|
|
@@ -58,58 +67,101 @@ function List({
|
|
|
58
67
|
itemClassName
|
|
59
68
|
);
|
|
60
69
|
const TitleSpan = /* @__PURE__ */ __name(() => {
|
|
61
|
-
const titleClass = bem(
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
const titleClass = bem(
|
|
71
|
+
"item__title",
|
|
72
|
+
{
|
|
73
|
+
"is-clickable": isClickable,
|
|
74
|
+
...modifier
|
|
75
|
+
},
|
|
76
|
+
"list-title"
|
|
77
|
+
);
|
|
65
78
|
return /* @__PURE__ */ jsx("span", { className: titleClass, children: title });
|
|
66
79
|
}, "TitleSpan");
|
|
67
80
|
const DescParagraph = /* @__PURE__ */ __name(() => {
|
|
68
81
|
if (!isString(desc) && !isValidElement(desc)) return null;
|
|
69
|
-
return /* @__PURE__ */ jsx(
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: bem(
|
|
86
|
+
"item__desc",
|
|
87
|
+
{ card: type === "card" },
|
|
88
|
+
classNameDesc
|
|
89
|
+
),
|
|
90
|
+
children: desc
|
|
91
|
+
}
|
|
92
|
+
);
|
|
70
93
|
}, "DescParagraph");
|
|
71
94
|
const IconWrapper = /* @__PURE__ */ __name(() => {
|
|
72
95
|
if (icon === void 0 || icon === null) return null;
|
|
73
|
-
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: bem("item__icon__wrapper"), children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(
|
|
96
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: bem("item__icon__wrapper"), children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(
|
|
97
|
+
Icon,
|
|
98
|
+
{
|
|
99
|
+
color: variant,
|
|
100
|
+
name: icon,
|
|
101
|
+
...options.icon
|
|
102
|
+
}
|
|
103
|
+
) });
|
|
74
104
|
}, "IconWrapper");
|
|
75
105
|
if (type === "card") {
|
|
76
106
|
const cardItem = item;
|
|
77
|
-
return /* @__PURE__ */ jsx(
|
|
78
|
-
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
"li",
|
|
79
109
|
{
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
className: liClass,
|
|
111
|
+
...liHandlers,
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
Card,
|
|
114
|
+
{
|
|
115
|
+
priority: true,
|
|
116
|
+
variant: "white",
|
|
117
|
+
...cardItem,
|
|
118
|
+
className: bem("item__card", void 0, cardItem.className),
|
|
119
|
+
contentClassName: bem(
|
|
120
|
+
"item__card__content",
|
|
121
|
+
void 0,
|
|
122
|
+
cardItem.contentClassName
|
|
123
|
+
),
|
|
124
|
+
children: /* @__PURE__ */ jsxs(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: bem(
|
|
128
|
+
"item__inner",
|
|
129
|
+
void 0,
|
|
130
|
+
cardItem.innerClassName
|
|
131
|
+
),
|
|
132
|
+
children: [
|
|
133
|
+
icon !== void 0 && icon !== null && /* @__PURE__ */ jsx(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
className: bem(
|
|
138
|
+
"item__icon",
|
|
139
|
+
void 0,
|
|
140
|
+
(_a = cardItem.iconProps) == null ? void 0 : _a.className
|
|
141
|
+
),
|
|
142
|
+
children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(
|
|
143
|
+
Icon,
|
|
144
|
+
{
|
|
145
|
+
...cardItem.iconProps,
|
|
146
|
+
className: bem("item__icon__svg"),
|
|
147
|
+
name: icon,
|
|
148
|
+
size: "sm"
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsxs("div", { className: bem("item__content"), children: [
|
|
154
|
+
/* @__PURE__ */ jsx(TitleSpan, {}),
|
|
155
|
+
/* @__PURE__ */ jsx(DescParagraph, {})
|
|
156
|
+
] })
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
},
|
|
163
|
+
`list-item-${id ?? i}`
|
|
164
|
+
);
|
|
113
165
|
}
|
|
114
166
|
if (redirect) {
|
|
115
167
|
const linkProps = redirect;
|
|
@@ -46,7 +46,14 @@ const OverlayClient = /* @__PURE__ */ __name(({
|
|
|
46
46
|
};
|
|
47
47
|
}, [backdrop]);
|
|
48
48
|
const resolved = backdrop === "auto" ? scheme : backdrop;
|
|
49
|
-
return /* @__PURE__ */ jsx(
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
OverlayView,
|
|
51
|
+
{
|
|
52
|
+
...rest,
|
|
53
|
+
reducedMotion,
|
|
54
|
+
resolvedBackdrop: resolved
|
|
55
|
+
}
|
|
56
|
+
);
|
|
50
57
|
}, "OverlayClient");
|
|
51
58
|
const SpinnerClient = /* @__PURE__ */ __name(({
|
|
52
59
|
reducedMotion,
|
|
@@ -61,7 +68,13 @@ const LoadingClient = /* @__PURE__ */ __name((props) => {
|
|
|
61
68
|
return /* @__PURE__ */ jsx(OverlayClient, { ...rest2, reducedMotion });
|
|
62
69
|
}
|
|
63
70
|
const { variant: _v, ...rest } = props;
|
|
64
|
-
return /* @__PURE__ */ jsx(
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
SpinnerClient,
|
|
73
|
+
{
|
|
74
|
+
...rest,
|
|
75
|
+
reducedMotion
|
|
76
|
+
}
|
|
77
|
+
);
|
|
65
78
|
}, "LoadingClient");
|
|
66
79
|
export {
|
|
67
80
|
LoadingClient as default
|
|
@@ -6,7 +6,14 @@ const LoadingServer = /* @__PURE__ */ __name((props) => {
|
|
|
6
6
|
if (props.variant === "overlay") {
|
|
7
7
|
const { backdrop = "auto", ...rest2 } = props;
|
|
8
8
|
const resolved = backdrop === "dark" ? "dark" : "light";
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
OverlayView,
|
|
11
|
+
{
|
|
12
|
+
...rest2,
|
|
13
|
+
reducedMotion: props.reducedMotion,
|
|
14
|
+
resolvedBackdrop: resolved
|
|
15
|
+
}
|
|
16
|
+
);
|
|
10
17
|
}
|
|
11
18
|
const { variant: _v, ...rest } = props;
|
|
12
19
|
return /* @__PURE__ */ jsx(SpinnerView, { ...rest, reducedMotion: props.reducedMotion });
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
const PX = {
|
|
4
|
+
const PX = {
|
|
5
|
+
xs: 16,
|
|
6
|
+
sm: 24,
|
|
7
|
+
md: 32,
|
|
8
|
+
lg: 48,
|
|
9
|
+
xl: 64
|
|
10
|
+
};
|
|
5
11
|
const SpinnerView = /* @__PURE__ */ __name(({
|
|
6
12
|
className,
|
|
7
13
|
style,
|
|
@@ -28,11 +34,21 @@ const SpinnerView = /* @__PURE__ */ __name(({
|
|
|
28
34
|
...style
|
|
29
35
|
},
|
|
30
36
|
children: [
|
|
31
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
38
|
+
"linearGradient",
|
|
39
|
+
{
|
|
40
|
+
id: "ui-loading-gradient",
|
|
41
|
+
x1: "0%",
|
|
42
|
+
x2: "0%",
|
|
43
|
+
y1: "0%",
|
|
44
|
+
y2: "100%",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "1" }),
|
|
47
|
+
/* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "currentColor", stopOpacity: "0.4" }),
|
|
48
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0.1" })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
) }),
|
|
36
52
|
/* @__PURE__ */ jsxs("g", { transform: `translate(${r} ${r})`, children: [
|
|
37
53
|
/* @__PURE__ */ jsx(
|
|
38
54
|
"circle",
|
|
@@ -102,7 +118,14 @@ const OverlayView = /* @__PURE__ */ __name(({
|
|
|
102
118
|
zIndex,
|
|
103
119
|
...style
|
|
104
120
|
},
|
|
105
|
-
children: /* @__PURE__ */ jsx(
|
|
121
|
+
children: /* @__PURE__ */ jsx(
|
|
122
|
+
SpinnerView,
|
|
123
|
+
{
|
|
124
|
+
ariaLabel,
|
|
125
|
+
reducedMotion,
|
|
126
|
+
size
|
|
127
|
+
}
|
|
128
|
+
)
|
|
106
129
|
}
|
|
107
130
|
);
|
|
108
131
|
}, "OverlayView");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { calculateWordCount } from "../../helpers/calculation.js";
|
|
5
|
+
import { PostItemView } from "./PostItem.view.js";
|
|
6
|
+
const PostItemClient = memo((props) => {
|
|
7
|
+
const { content, readingWpm = 200 } = props;
|
|
8
|
+
const wordCount = useMemo(() => calculateWordCount(content), [content]);
|
|
9
|
+
const readMinutes = useMemo(
|
|
10
|
+
() => wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0,
|
|
11
|
+
[wordCount, readingWpm]
|
|
12
|
+
);
|
|
13
|
+
return /* @__PURE__ */ jsx(PostItemView, { ...props, readMinutes, wordCount });
|
|
14
|
+
});
|
|
15
|
+
PostItemClient.displayName = "PostItemClient";
|
|
16
|
+
export {
|
|
17
|
+
PostItemClient as default
|
|
18
|
+
};
|
|
@@ -1,141 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { Button } from "../button/Button.js";
|
|
11
|
-
import { Grid } from "../grid/Grid.js";
|
|
12
|
-
import { GridRow } from "../grid/GridRow.js";
|
|
13
|
-
import { Animated } from "../animated/Animated.js";
|
|
14
|
-
import { Headline } from "../headline/Headline.js";
|
|
15
|
-
import { RichText } from "../rich-text/RichText.js";
|
|
16
|
-
import { Card } from "../card/Card.js";
|
|
17
|
-
import { Skeleton } from "../skeleton/Skeleton.js";
|
|
18
|
-
const bem = create(styles, "PostItem");
|
|
19
|
-
const PostItem = memo(
|
|
20
|
-
({
|
|
21
|
-
className,
|
|
22
|
-
readCount = 0,
|
|
23
|
-
title,
|
|
24
|
-
content,
|
|
25
|
-
category,
|
|
26
|
-
author,
|
|
27
|
-
date,
|
|
28
|
-
metaDate,
|
|
29
|
-
image,
|
|
30
|
-
button,
|
|
31
|
-
imageComponent: ImageComponent
|
|
32
|
-
}) => {
|
|
33
|
-
const wordCount = calculateWordCount(content);
|
|
34
|
-
const [imageLoaded, setImageLoaded] = useState(!ImageComponent);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!ImageComponent) setImageLoaded(true);
|
|
37
|
-
}, [ImageComponent]);
|
|
38
|
-
return /* @__PURE__ */ jsxs(
|
|
39
|
-
"article",
|
|
40
|
-
{
|
|
41
|
-
itemScope: true,
|
|
42
|
-
className: bem(void 0, void 0, className),
|
|
43
|
-
itemType: "http://schema.org/BlogPosting",
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ jsxs(Grid, { className: bem("grid"), children: [
|
|
46
|
-
/* @__PURE__ */ jsx(GridRow, { className: bem("content"), md: image ? 8 : 12, xs: 12, children: /* @__PURE__ */ jsxs(Animated, { className: bem("animation"), children: [
|
|
47
|
-
/* @__PURE__ */ jsxs("header", { children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
49
|
-
Headline,
|
|
50
|
-
{
|
|
51
|
-
className: bem("headline", void 0, title == null ? void 0 : title.className),
|
|
52
|
-
size: "lg",
|
|
53
|
-
type: "h2",
|
|
54
|
-
...title,
|
|
55
|
-
children: title.content
|
|
56
|
-
}
|
|
57
|
-
),
|
|
58
|
-
/* @__PURE__ */ jsxs("div", { className: bem("info"), children: [
|
|
59
|
-
author && /* @__PURE__ */ jsx(PostItemAuthor, { avatar: author.avatar, name: author.name }),
|
|
60
|
-
isString(date) && /* @__PURE__ */ jsxs(
|
|
61
|
-
"p",
|
|
62
|
-
{
|
|
63
|
-
"aria-label": `Published at ${date}`,
|
|
64
|
-
className: bem("date"),
|
|
65
|
-
itemProp: "datePublished",
|
|
66
|
-
children: [
|
|
67
|
-
"📅 ",
|
|
68
|
-
/* @__PURE__ */ jsx("time", { dateTime: metaDate, itemProp: "datePublished", children: date })
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
readCount > 0 && /* @__PURE__ */ jsxs(
|
|
73
|
-
"div",
|
|
74
|
-
{
|
|
75
|
-
itemScope: true,
|
|
76
|
-
className: bem("read__count"),
|
|
77
|
-
itemProp: "interactionStatistic",
|
|
78
|
-
itemType: "https://schema.org/InteractionCounter",
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ jsx(
|
|
81
|
-
"meta",
|
|
82
|
-
{
|
|
83
|
-
content: "https://schema.org/ReadAction",
|
|
84
|
-
itemProp: "interactionType"
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
/* @__PURE__ */ jsx("span", { itemProp: "userInteractionCount", children: readCount })
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
] })
|
|
92
|
-
] }),
|
|
93
|
-
isString(content) && /* @__PURE__ */ jsx("div", { itemProp: "articleBody", children: /* @__PURE__ */ jsx(RichText, { className: bem("content__paragraph"), children: content }) }),
|
|
94
|
-
button && /* @__PURE__ */ jsx(
|
|
95
|
-
Button,
|
|
96
|
-
{
|
|
97
|
-
variant: "outlined",
|
|
98
|
-
...button,
|
|
99
|
-
className: bem("button", void 0, button == null ? void 0 : button.className),
|
|
100
|
-
contentClassName: bem(
|
|
101
|
-
"button__content",
|
|
102
|
-
void 0,
|
|
103
|
-
button == null ? void 0 : button.contentClassName
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
] }) }),
|
|
108
|
-
/* @__PURE__ */ jsx(GridRow, { md: 4, xs: 12, children: /* @__PURE__ */ jsxs(
|
|
109
|
-
Card,
|
|
110
|
-
{
|
|
111
|
-
enableShadow: true,
|
|
112
|
-
background: image == null ? void 0 : image.src,
|
|
113
|
-
className: bem("image__wrapper"),
|
|
114
|
-
contentClassName: bem("image__content__wrapper"),
|
|
115
|
-
redirect: button == null ? void 0 : button.redirect,
|
|
116
|
-
children: [
|
|
117
|
-
!imageLoaded && /* @__PURE__ */ jsx(Skeleton, { height: "275px" }),
|
|
118
|
-
ImageComponent !== void 0 && isString(image == null ? void 0 : image.src) && /* @__PURE__ */ jsx(
|
|
119
|
-
ImageComponent,
|
|
120
|
-
{
|
|
121
|
-
...image,
|
|
122
|
-
className: bem("image"),
|
|
123
|
-
sizes: "(max-width: 960px) 100vw, 25vw",
|
|
124
|
-
onLoad: /* @__PURE__ */ __name(() => setImageLoaded(true), "onLoad")
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
) })
|
|
130
|
-
] }),
|
|
131
|
-
wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
132
|
-
isString(category) && /* @__PURE__ */ jsx("meta", { content: category, itemProp: "articleSection" })
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
PostItem.displayName = "PostItem";
|
|
3
|
+
import { createIsland } from "../../helpers/createIsland.js";
|
|
4
|
+
import PostItemServer from "./PostItem.server.js";
|
|
5
|
+
const PostItem = createIsland({
|
|
6
|
+
name: "PostItem",
|
|
7
|
+
Server: PostItemServer,
|
|
8
|
+
loadLazy: /* @__PURE__ */ __name(() => import("./PostItem.lazy.js"), "loadLazy")
|
|
9
|
+
});
|
|
139
10
|
export {
|
|
140
11
|
PostItem
|
|
141
12
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createLazyWrapper } from "../../helpers/createLazyWrapper.js";
|
|
3
|
+
import PostItemClient from "./PostItem.client.js";
|
|
4
|
+
import PostItemServer from "./PostItem.server.js";
|
|
5
|
+
const PostItem_lazy = createLazyWrapper({
|
|
6
|
+
name: "PostItem",
|
|
7
|
+
Client: PostItemClient,
|
|
8
|
+
Server: PostItemServer,
|
|
9
|
+
// Hydrate when visible if interactive (e.g., button.onClick, redirect, etc.)
|
|
10
|
+
hydrateOnVisible: true
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
PostItem_lazy as default
|
|
14
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const styles = {
|
|
2
2
|
"prokodo-PostItem__grid": "prokodo-PostItem__grid",
|
|
3
|
+
"prokodo-PostItem__media": "prokodo-PostItem__media",
|
|
4
|
+
"prokodo-PostItem__main": "prokodo-PostItem__main",
|
|
3
5
|
"prokodo-PostItem__animation": "prokodo-PostItem__animation",
|
|
4
6
|
"prokodo-PostItem__headline": "prokodo-PostItem__headline",
|
|
5
7
|
"prokodo-PostItem__info": "prokodo-PostItem__info",
|
|
@@ -8,8 +10,8 @@ const styles = {
|
|
|
8
10
|
"prokodo-PostItem__content": "prokodo-PostItem__content",
|
|
9
11
|
"prokodo-PostItem__content__paragraph": "prokodo-PostItem__content__paragraph",
|
|
10
12
|
"prokodo-PostItem__image": "prokodo-PostItem__image",
|
|
11
|
-
"prokodo-PostItem__image__wrapper": "prokodo-PostItem__image__wrapper",
|
|
12
13
|
"prokodo-PostItem__image__content__wrapper": "prokodo-PostItem__image__content__wrapper",
|
|
14
|
+
"prokodo-PostItem__image__wrapper": "prokodo-PostItem__image__wrapper",
|
|
13
15
|
"prokodo-PostItem__button": "prokodo-PostItem__button",
|
|
14
16
|
"prokodo-PostItem__button__content": "prokodo-PostItem__button__content"
|
|
15
17
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { calculateWordCount } from "../../helpers/calculation.js";
|
|
5
|
+
import { PostItemView } from "./PostItem.view.js";
|
|
6
|
+
function PostItemServer(p) {
|
|
7
|
+
const { content, readingWpm = 200 } = p;
|
|
8
|
+
const wordCount = calculateWordCount(content);
|
|
9
|
+
const readMinutes = wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0;
|
|
10
|
+
return /* @__PURE__ */ jsx(PostItemView, { ...p, readMinutes, wordCount });
|
|
11
|
+
}
|
|
12
|
+
__name(PostItemServer, "PostItemServer");
|
|
13
|
+
export {
|
|
14
|
+
PostItemServer as default
|
|
15
|
+
};
|