@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.
Files changed (160) hide show
  1. package/README.md +81 -81
  2. package/dist/components/accordion/Accordion.client.js +3 -1
  3. package/dist/components/accordion/Accordion.view.js +100 -81
  4. package/dist/components/animated/Animated.server.js +3 -1
  5. package/dist/components/animatedText/AnimatedText.client.js +1 -7
  6. package/dist/components/animatedText/AnimatedText.view.js +4 -1
  7. package/dist/components/avatar/Avatar.view.js +2 -2
  8. package/dist/components/base-link/BaseLink.view.js +1 -1
  9. package/dist/components/button/Button.server.js +1 -8
  10. package/dist/components/calendly/Calendly.client.js +63 -54
  11. package/dist/components/calendly/Calendly.server.js +3 -1
  12. package/dist/components/card/Card.client.js +2 -1
  13. package/dist/components/card/Card.effects.client.js +5 -1
  14. package/dist/components/card/Card.view.js +19 -2
  15. package/dist/components/carousel/Carousel.client.js +36 -12
  16. package/dist/components/chip/Chip.view.js +10 -6
  17. package/dist/components/datePicker/DatePicker.client.js +53 -37
  18. package/dist/components/datePicker/DatePicker.view.js +3 -1
  19. package/dist/components/dialog/Dialog.client.js +22 -14
  20. package/dist/components/dialog/Dialog.view.js +10 -2
  21. package/dist/components/drawer/Drawer.base.module.scss.js +0 -24
  22. package/dist/components/drawer/Drawer.client.js +87 -47
  23. package/dist/components/drawer/Drawer.effects.client.js +78 -7
  24. package/dist/components/drawer/Drawer.server.js +1 -0
  25. package/dist/components/drawer/Drawer.view.js +13 -2
  26. package/dist/components/dynamic-list/DynamicList.client.js +8 -7
  27. package/dist/components/dynamic-list/DynamicList.server.js +10 -4
  28. package/dist/components/dynamic-list/DynamicList.view.js +1 -1
  29. package/dist/components/form/Form.client.js +16 -13
  30. package/dist/components/form/Form.view.js +8 -4
  31. package/dist/components/form/FormField.client.js +5 -5
  32. package/dist/components/form/FormField.server.js +3 -23
  33. package/dist/components/form/FormResponse.js +5 -1
  34. package/dist/components/grid/Grid.js +7 -2
  35. package/dist/components/grid/GridRow.js +12 -2
  36. package/dist/components/headline/Headline.js +3 -1
  37. package/dist/components/icon/Icon.js +8 -4
  38. package/dist/components/image-text/ImageText.js +5 -1
  39. package/dist/components/input/Input.client.js +52 -28
  40. package/dist/components/input/Input.view.js +92 -68
  41. package/dist/components/inputOTP/InputOTP.js +107 -90
  42. package/dist/components/label/Label.js +1 -8
  43. package/dist/components/link/Link.view.js +3 -1
  44. package/dist/components/list/List.js +94 -42
  45. package/dist/components/loading/Loading.client.js +15 -2
  46. package/dist/components/loading/Loading.server.js +8 -1
  47. package/dist/components/loading/Loading.view.js +30 -7
  48. package/dist/components/post-item/PostItem.client.js +18 -0
  49. package/dist/components/post-item/PostItem.js +7 -136
  50. package/dist/components/post-item/PostItem.lazy.js +14 -0
  51. package/dist/components/post-item/PostItem.module.scss.js +3 -1
  52. package/dist/components/post-item/PostItem.server.js +15 -0
  53. package/dist/components/post-item/PostItem.view.js +238 -0
  54. package/dist/components/post-item/PostItemAuthor.js +28 -22
  55. package/dist/components/post-teaser/PostTeaser.client.js +31 -0
  56. package/dist/components/post-teaser/PostTeaser.js +9 -169
  57. package/dist/components/post-teaser/PostTeaser.lazy.js +13 -0
  58. package/dist/components/post-teaser/PostTeaser.module.scss.js +3 -0
  59. package/dist/components/post-teaser/PostTeaser.server.js +23 -0
  60. package/dist/components/post-teaser/PostTeaser.view.js +252 -0
  61. package/dist/components/post-widget/PostWidget.client.js +9 -0
  62. package/dist/components/post-widget/PostWidget.js +11 -156
  63. package/dist/components/post-widget/PostWidget.lazy.js +13 -0
  64. package/dist/components/post-widget/PostWidget.module.scss.js +1 -0
  65. package/dist/components/post-widget/PostWidget.server.js +11 -0
  66. package/dist/components/post-widget/PostWidget.view.js +263 -0
  67. package/dist/components/post-widget-carousel/PostWidgetCarousel.client.js +9 -0
  68. package/dist/components/post-widget-carousel/PostWidgetCarousel.js +9 -160
  69. package/dist/components/post-widget-carousel/PostWidgetCarousel.lazy.js +13 -0
  70. package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +3 -0
  71. package/dist/components/post-widget-carousel/PostWidgetCarousel.server.js +11 -0
  72. package/dist/components/post-widget-carousel/PostWidgetCarousel.view.js +244 -0
  73. package/dist/components/rich-text/RichText.client.js +7 -2
  74. package/dist/components/select/Select.view.js +132 -116
  75. package/dist/components/sidenav/SideNav.client.js +19 -18
  76. package/dist/components/sidenav/SideNav.server.js +8 -1
  77. package/dist/components/sidenav/SideNav.view.js +21 -3
  78. package/dist/components/skeleton/Skeleton.effects.client.js +3 -1
  79. package/dist/components/slider/Slider.client.js +56 -38
  80. package/dist/components/slider/Slider.view.js +1 -7
  81. package/dist/components/snackbar/SnackbarProvider.client.js +21 -22
  82. package/dist/components/stepper/Stepper.client.js +1 -8
  83. package/dist/components/switch/Switch.client.js +1 -6
  84. package/dist/components/switch/Switch.server.js +1 -3
  85. package/dist/components/table/Table.js +3 -1
  86. package/dist/components/table/TableCell.js +13 -1
  87. package/dist/components/teaser/Teaser.js +1 -5
  88. package/dist/constants/project.js +1 -1
  89. package/dist/helpers/createIsland.js +3 -1
  90. package/dist/helpers/createLazyWrapper.js +3 -1
  91. package/dist/helpers/date.js +21 -0
  92. package/dist/tsconfig.build.tsbuildinfo +1 -1
  93. package/dist/types/components/accordion/Accordion.model.d.ts +1 -1
  94. package/dist/types/components/animated/Animated.client.d.ts +2 -2
  95. package/dist/types/components/animated/Animated.model.d.ts +1 -1
  96. package/dist/types/components/button/Button.client.d.ts +1 -1
  97. package/dist/types/components/button/Button.d.ts +1 -1
  98. package/dist/types/components/button/Button.lazy.d.ts +1 -1
  99. package/dist/types/components/button/Button.server.d.ts +1 -1
  100. package/dist/types/components/button/Button.view.d.ts +1 -1
  101. package/dist/types/components/card/Card.effects.client.d.ts +1 -1
  102. package/dist/types/components/card/index.d.ts +1 -1
  103. package/dist/types/components/carousel/Carousel.d.ts +3 -0
  104. package/dist/types/components/carousel/Carousel.lazy.d.ts +3 -0
  105. package/dist/types/components/carousel/Carousel.model.d.ts +4 -0
  106. package/dist/types/components/dialog/Dialog.client.d.ts +1 -1
  107. package/dist/types/components/dialog/Dialog.model.d.ts +4 -4
  108. package/dist/types/components/dialog/Dialog.view.d.ts +2 -2
  109. package/dist/types/components/drawer/Drawer.client.d.ts +1 -1
  110. package/dist/types/components/drawer/Drawer.d.ts +1 -1
  111. package/dist/types/components/drawer/Drawer.effects.client.d.ts +6 -2
  112. package/dist/types/components/drawer/Drawer.lazy.d.ts +1 -1
  113. package/dist/types/components/drawer/Drawer.model.d.ts +6 -6
  114. package/dist/types/components/drawer/Drawer.server.d.ts +1 -1
  115. package/dist/types/components/drawer/Drawer.view.d.ts +2 -2
  116. package/dist/types/components/drawer/index.d.ts +1 -1
  117. package/dist/types/components/icon/IconList.d.ts +1 -1
  118. package/dist/types/components/icon/index.d.ts +1 -1
  119. package/dist/types/components/image/Image.model.d.ts +2 -2
  120. package/dist/types/components/link/Link.d.ts +1 -1
  121. package/dist/types/components/link/Link.model.d.ts +1 -1
  122. package/dist/types/components/link/Link.server.d.ts +1 -1
  123. package/dist/types/components/loading/index.d.ts +1 -1
  124. package/dist/types/components/post-item/PostItem.client.d.ts +4 -0
  125. package/dist/types/components/post-item/PostItem.d.ts +3 -2
  126. package/dist/types/components/post-item/PostItem.lazy.d.ts +5 -0
  127. package/dist/types/components/post-item/PostItem.model.d.ts +46 -6
  128. package/dist/types/components/post-item/PostItem.server.d.ts +3 -0
  129. package/dist/types/components/post-item/PostItem.view.d.ts +3 -0
  130. package/dist/types/components/post-item/PostItemAuthor.model.d.ts +5 -8
  131. package/dist/types/components/post-item/index.d.ts +2 -2
  132. package/dist/types/components/post-teaser/PostTeaser.client.d.ts +4 -0
  133. package/dist/types/components/post-teaser/PostTeaser.d.ts +3 -2
  134. package/dist/types/components/post-teaser/PostTeaser.lazy.d.ts +5 -0
  135. package/dist/types/components/post-teaser/PostTeaser.model.d.ts +49 -3
  136. package/dist/types/components/post-teaser/PostTeaser.server.d.ts +3 -0
  137. package/dist/types/components/post-teaser/PostTeaser.view.d.ts +3 -0
  138. package/dist/types/components/post-teaser/index.d.ts +1 -1
  139. package/dist/types/components/post-widget/PostWidget.client.d.ts +4 -0
  140. package/dist/types/components/post-widget/PostWidget.d.ts +13 -3
  141. package/dist/types/components/post-widget/PostWidget.lazy.d.ts +14 -0
  142. package/dist/types/components/post-widget/PostWidget.model.d.ts +53 -3
  143. package/dist/types/components/post-widget/PostWidget.server.d.ts +3 -0
  144. package/dist/types/components/post-widget/PostWidget.view.d.ts +3 -0
  145. package/dist/types/components/post-widget/index.d.ts +1 -1
  146. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.client.d.ts +3 -0
  147. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.d.ts +11 -3
  148. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.lazy.d.ts +12 -0
  149. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.model.d.ts +39 -0
  150. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.server.d.ts +3 -0
  151. package/dist/types/components/post-widget-carousel/PostWidgetCarousel.view.d.ts +3 -0
  152. package/dist/types/components/post-widget-carousel/index.d.ts +1 -1
  153. package/dist/types/components/sidenav/index.d.ts +1 -1
  154. package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +2 -2
  155. package/dist/types/helpers/createIsland.d.ts +1 -1
  156. package/dist/types/helpers/createLazyWrapper.d.ts +1 -1
  157. package/dist/types/helpers/date.d.ts +5 -0
  158. package/dist/ui.css +132 -280
  159. package/package.json +3 -2
  160. 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 { id, title, desc, icon, redirect, onClick, variant: itemVariant, className: itemClassName } = item;
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("item__title", {
62
- "is-clickable": isClickable,
63
- ...modifier
64
- }, "list-title");
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("div", { className: bem("item__desc", { "card": type === "card" }, classNameDesc), children: desc });
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(Icon, { color: variant, name: icon, ...options.icon }) });
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("li", { className: liClass, ...liHandlers, children: /* @__PURE__ */ jsx(
78
- Card,
107
+ return /* @__PURE__ */ jsx(
108
+ "li",
79
109
  {
80
- priority: true,
81
- variant: "white",
82
- ...cardItem,
83
- className: bem("item__card", void 0, cardItem.className),
84
- contentClassName: bem(
85
- "item__card__content",
86
- void 0,
87
- cardItem.contentClassName
88
- ),
89
- children: /* @__PURE__ */ jsxs("div", { className: bem("item__inner", void 0, cardItem.innerClassName), children: [
90
- icon !== void 0 && icon !== null && /* @__PURE__ */ jsx(
91
- "div",
92
- {
93
- "aria-hidden": "true",
94
- className: bem("item__icon", void 0, (_a = cardItem.iconProps) == null ? void 0 : _a.className),
95
- children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(
96
- Icon,
97
- {
98
- ...cardItem.iconProps,
99
- className: bem("item__icon__svg"),
100
- name: icon,
101
- size: "sm"
102
- }
103
- )
104
- }
105
- ),
106
- /* @__PURE__ */ jsxs("div", { className: bem("item__content"), children: [
107
- /* @__PURE__ */ jsx(TitleSpan, {}),
108
- /* @__PURE__ */ jsx(DescParagraph, {})
109
- ] })
110
- ] })
111
- }
112
- ) }, `list-item-${id ?? i}`);
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(OverlayView, { ...rest, reducedMotion, resolvedBackdrop: resolved });
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(SpinnerClient, { ...rest, reducedMotion });
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(OverlayView, { ...rest2, reducedMotion: props.reducedMotion, resolvedBackdrop: resolved });
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 = { xs: 16, sm: 24, md: 32, lg: 48, xl: 64 };
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("linearGradient", { id: "ui-loading-gradient", x1: "0%", x2: "0%", y1: "0%", y2: "100%", children: [
32
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: "1" }),
33
- /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "currentColor", stopOpacity: "0.4" }),
34
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: "0.1" })
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(SpinnerView, { ariaLabel, reducedMotion, size })
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 { jsxs, jsx } from "react/jsx-runtime";
4
- import { memo, useState, useEffect } from "react";
5
- import { create } from "../../helpers/bem.js";
6
- import { calculateWordCount } from "../../helpers/calculation.js";
7
- import { isString } from "../../helpers/validations.js";
8
- import styles from "./PostItem.module.scss.js";
9
- import { PostItemAuthor } from "./PostItemAuthor.js";
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
+ };