@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
|
@@ -16,13 +16,16 @@ const InputOTP = memo(
|
|
|
16
16
|
onChange,
|
|
17
17
|
...props
|
|
18
18
|
}) => {
|
|
19
|
-
const [otp, setOtp] = useState(
|
|
19
|
+
const [otp, setOtp] = useState(
|
|
20
|
+
() => Array(length).fill("")
|
|
21
|
+
);
|
|
20
22
|
const inputs = useRef([]);
|
|
21
23
|
useEffect(() => {
|
|
22
24
|
inputs.current = inputs.current.slice(0, length);
|
|
23
25
|
setOtp((prev) => {
|
|
24
26
|
const next = Array(length).fill("");
|
|
25
|
-
for (let i = 0; i < Math.min(prev.length, length); i++)
|
|
27
|
+
for (let i = 0; i < Math.min(prev.length, length); i++)
|
|
28
|
+
next[i] = prev[i] ?? "";
|
|
26
29
|
return next;
|
|
27
30
|
});
|
|
28
31
|
}, [length]);
|
|
@@ -35,104 +38,118 @@ const InputOTP = memo(
|
|
|
35
38
|
(_a = el.setSelectionRange) == null ? void 0 : _a.call(el, 0, el.value.length);
|
|
36
39
|
}
|
|
37
40
|
}, []);
|
|
38
|
-
const emitChange = useCallback(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
completedRef.current
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
completedRef.current
|
|
47
|
-
|
|
48
|
-
}, [onChange, onComplete]);
|
|
49
|
-
const setDigit = useCallback((digit, index) => {
|
|
50
|
-
const d = digit.replace(/\D/g, "");
|
|
51
|
-
if (d.length > 1) return;
|
|
52
|
-
setOtp((prev) => {
|
|
53
|
-
if (prev[index] === d) return prev;
|
|
54
|
-
const next = [...prev];
|
|
55
|
-
next[index] = d;
|
|
56
|
-
if (d !== "" && index < length - 1) {
|
|
57
|
-
const nextEmpty = next.findIndex((val, i) => i > index && val === "");
|
|
58
|
-
const to = nextEmpty !== -1 ? nextEmpty : index + 1;
|
|
59
|
-
focusIndex(to);
|
|
41
|
+
const emitChange = useCallback(
|
|
42
|
+
(next) => {
|
|
43
|
+
const joined = next.join("");
|
|
44
|
+
onChange == null ? void 0 : onChange(joined);
|
|
45
|
+
const complete = next.every((d) => d !== "");
|
|
46
|
+
if (complete && !completedRef.current) {
|
|
47
|
+
completedRef.current = true;
|
|
48
|
+
onComplete == null ? void 0 : onComplete(joined);
|
|
49
|
+
} else if (!complete && completedRef.current) {
|
|
50
|
+
completedRef.current = false;
|
|
60
51
|
}
|
|
61
|
-
emitChange(next);
|
|
62
|
-
return next;
|
|
63
|
-
});
|
|
64
|
-
}, [emitChange, focusIndex, length]);
|
|
65
|
-
const handleChange = useCallback(
|
|
66
|
-
(e, index) => {
|
|
67
|
-
setDigit(e.target.value, index);
|
|
68
52
|
},
|
|
69
|
-
[
|
|
53
|
+
[onChange, onComplete]
|
|
70
54
|
);
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
const setDigit = useCallback(
|
|
56
|
+
(digit, index) => {
|
|
57
|
+
const d = digit.replace(/\D/g, "");
|
|
58
|
+
if (d.length > 1) return;
|
|
75
59
|
setOtp((prev) => {
|
|
60
|
+
if (prev[index] === d) return prev;
|
|
76
61
|
const next = [...prev];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
next[index] = d;
|
|
63
|
+
if (d !== "" && index < length - 1) {
|
|
64
|
+
const nextEmpty = next.findIndex(
|
|
65
|
+
(val, i) => i > index && val === ""
|
|
66
|
+
);
|
|
67
|
+
const to = nextEmpty !== -1 ? nextEmpty : index + 1;
|
|
68
|
+
focusIndex(to);
|
|
83
69
|
}
|
|
84
70
|
emitChange(next);
|
|
85
71
|
return next;
|
|
86
72
|
});
|
|
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
|
-
|
|
73
|
+
},
|
|
74
|
+
[emitChange, focusIndex, length]
|
|
75
|
+
);
|
|
76
|
+
const handleChange = useCallback(
|
|
77
|
+
(e, index) => {
|
|
78
|
+
setDigit(e.target.value, index);
|
|
79
|
+
},
|
|
80
|
+
[setDigit]
|
|
81
|
+
);
|
|
82
|
+
const handleKeyDown = useCallback(
|
|
83
|
+
(e, index) => {
|
|
84
|
+
const { key } = e;
|
|
85
|
+
if (key === "Backspace") {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
setOtp((prev) => {
|
|
88
|
+
const next = [...prev];
|
|
89
|
+
if (next[index] !== "") {
|
|
90
|
+
next[index] = "";
|
|
91
|
+
focusIndex(index);
|
|
92
|
+
} else if (index > 0) {
|
|
93
|
+
next[index - 1] = "";
|
|
94
|
+
focusIndex(index - 1);
|
|
95
|
+
}
|
|
96
|
+
emitChange(next);
|
|
97
|
+
return next;
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (key === "ArrowLeft") {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
if (index > 0) focusIndex(index - 1);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (key === "ArrowRight") {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
if (index < length - 1) focusIndex(index + 1);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (key === "Home") {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
focusIndex(0);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (key === "End") {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
focusIndex(length - 1);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (key.length === 1 && !/[0-9]/.test(key)) {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
[emitChange, focusIndex, length]
|
|
126
|
+
);
|
|
113
127
|
const handleFocus = useCallback((index) => {
|
|
114
128
|
var _a;
|
|
115
129
|
const el = inputs.current[index];
|
|
116
130
|
(_a = el == null ? void 0 : el.setSelectionRange) == null ? void 0 : _a.call(el, 0, el.value.length);
|
|
117
131
|
}, []);
|
|
118
|
-
const handlePaste = useCallback(
|
|
119
|
-
e
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
const handlePaste = useCallback(
|
|
133
|
+
(e) => {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
const digits = (e.clipboardData.getData("text") || "").replace(/\D/g, "").slice(0, length).split("");
|
|
136
|
+
if (digits.length === 0) return;
|
|
137
|
+
setOtp((prev) => {
|
|
138
|
+
const next = [...prev];
|
|
139
|
+
let writeIndex = next.findIndex((d) => d === "");
|
|
140
|
+
if (writeIndex === -1) writeIndex = 0;
|
|
141
|
+
for (let i = 0; i < digits.length && writeIndex < length; i++) {
|
|
142
|
+
next[writeIndex] = digits[i];
|
|
143
|
+
writeIndex++;
|
|
144
|
+
}
|
|
145
|
+
emitChange(next);
|
|
146
|
+
const nextEmpty = next.findIndex((d) => d === "");
|
|
147
|
+
focusIndex(nextEmpty === -1 ? length - 1 : nextEmpty);
|
|
148
|
+
return next;
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
[emitChange, focusIndex, length]
|
|
152
|
+
);
|
|
136
153
|
return /* @__PURE__ */ jsxs(
|
|
137
154
|
"div",
|
|
138
155
|
{
|
|
@@ -156,17 +173,17 @@ const InputOTP = memo(
|
|
|
156
173
|
inputClassName: bem("input__node"),
|
|
157
174
|
inputContainerClassName: bem("input__container"),
|
|
158
175
|
inputMode: "numeric",
|
|
159
|
-
inputRef: /* @__PURE__ */ __name((el) => {
|
|
160
|
-
inputs.current[index] = el ?? null;
|
|
161
|
-
}, "inputRef"),
|
|
162
176
|
maxLength: 1,
|
|
163
177
|
name: `otp-${index}`,
|
|
164
178
|
pattern: "\\\\d*",
|
|
165
179
|
placeholder: "•",
|
|
166
180
|
type: "text",
|
|
167
181
|
value,
|
|
168
|
-
|
|
182
|
+
inputRef: /* @__PURE__ */ __name((el) => {
|
|
183
|
+
inputs.current[index] = el ?? null;
|
|
184
|
+
}, "inputRef"),
|
|
169
185
|
onFocus: /* @__PURE__ */ __name(() => handleFocus(index), "onFocus"),
|
|
186
|
+
onChange: /* @__PURE__ */ __name((e) => handleChange(e, index), "onChange"),
|
|
170
187
|
onKeyDown: /* @__PURE__ */ __name((e) => handleKeyDown(e, index), "onKeyDown")
|
|
171
188
|
},
|
|
172
189
|
`otp-${index}`
|
|
@@ -52,14 +52,7 @@ const Label = /* @__PURE__ */ __name(({
|
|
|
52
52
|
] }), "renderContent");
|
|
53
53
|
if (!splittedLabel) return children;
|
|
54
54
|
if (type === "legend") {
|
|
55
|
-
return /* @__PURE__ */ jsx(
|
|
56
|
-
"legend",
|
|
57
|
-
{
|
|
58
|
-
...props,
|
|
59
|
-
className: bem(void 0, void 0, className),
|
|
60
|
-
children: renderContent()
|
|
61
|
-
}
|
|
62
|
-
);
|
|
55
|
+
return /* @__PURE__ */ jsx("legend", { ...props, className: bem(void 0, void 0, className), children: renderContent() });
|
|
63
56
|
}
|
|
64
57
|
return /* @__PURE__ */ jsx(
|
|
65
58
|
"label",
|
|
@@ -41,7 +41,9 @@ function LinkView({
|
|
|
41
41
|
onClick: hasHandlers ? onClick : void 0,
|
|
42
42
|
onKeyDown: hasHandlers ? (e) => {
|
|
43
43
|
if (e.key === "Enter" || e.key === " ") {
|
|
44
|
-
onClick == null ? void 0 : onClick(
|
|
44
|
+
onClick == null ? void 0 : onClick(
|
|
45
|
+
e
|
|
46
|
+
);
|
|
45
47
|
}
|
|
46
48
|
} : void 0,
|
|
47
49
|
...rest,
|
|
@@ -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
|
+
};
|