@prokodo/ui 0.0.49 → 0.0.50
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/dist/components/accordion/{Accordion.module.scss.js → Accordion.base.module.scss.js} +2 -8
- package/dist/components/accordion/Accordion.effects.client.js +16 -0
- package/dist/components/accordion/Accordion.effects.module.scss.js +8 -0
- package/dist/components/accordion/Accordion.view.js +84 -80
- package/dist/components/animated/Animated.module.scss.js +2 -8
- package/dist/components/avatar/Avatar.module.scss.js +2 -8
- package/dist/components/button/Button.module.scss.js +2 -8
- package/dist/components/calendly/Calendly.client.js +98 -22
- package/dist/components/calendly/Calendly.server.js +3 -2
- package/dist/components/calendly/Calendly.view.js +2 -1
- package/dist/components/card/{Card.module.scss.js → Card.base.module.scss.js} +2 -12
- package/dist/components/card/Card.effects.client.js +16 -0
- package/dist/components/card/Card.effects.module.scss.js +14 -0
- package/dist/components/card/Card.view.js +15 -4
- package/dist/components/carousel/Carousel.client.js +44 -20
- package/dist/components/carousel/Carousel.lazy.js +1 -1
- package/dist/components/carousel/Carousel.module.scss.js +2 -8
- package/dist/components/chip/Chip.module.scss.js +2 -8
- package/dist/components/datePicker/DatePicker.client.js +52 -51
- package/dist/components/datePicker/DatePicker.view.js +14 -3
- package/dist/components/dialog/Dialog.module.scss.js +2 -8
- package/dist/components/drawer/{Drawer.module.scss.js → Drawer.base.module.scss.js} +27 -32
- package/dist/components/drawer/Drawer.client.js +19 -2
- package/dist/components/drawer/Drawer.effects.client.js +16 -0
- package/dist/components/drawer/Drawer.effects.module.scss.js +29 -0
- package/dist/components/drawer/Drawer.server.js +0 -1
- package/dist/components/drawer/Drawer.view.js +44 -40
- package/dist/components/dynamic-list/DynamicList.module.scss.js +2 -8
- package/dist/components/form/Form.client.js +131 -54
- package/dist/components/form/Form.module.scss.js +2 -8
- package/dist/components/form/FormField.module.scss.js +2 -8
- package/dist/components/form/FormResponse.module.scss.js +2 -8
- package/dist/components/grid/Grid.module.scss.js +2 -8
- package/dist/components/grid/GridRow.module.scss.js +2 -8
- package/dist/components/headline/{Headline.module.scss.js → Headline.base.module.scss.js} +2 -15
- package/dist/components/headline/Headline.effects.client.js +14 -0
- package/dist/components/headline/Headline.effects.module.scss.js +13 -0
- package/dist/components/headline/Headline.js +28 -18
- package/dist/components/icon/Icon.module.scss.js +2 -8
- package/dist/components/image/Image.module.scss.js +2 -8
- package/dist/components/image-text/ImageText.module.scss.js +2 -8
- package/dist/components/input/Input.client.js +12 -1
- package/dist/components/input/Input.module.scss.js +3 -8
- package/dist/components/input/Input.view.js +10 -2
- package/dist/components/inputOTP/InputOTP.js +124 -41
- package/dist/components/inputOTP/InputOTP.module.scss.js +2 -8
- package/dist/components/label/Label.module.scss.js +2 -8
- package/dist/components/link/Link.module.scss.js +2 -8
- package/dist/components/list/List.module.scss.js +2 -8
- package/dist/components/loading/Loading.client.js +68 -0
- package/dist/components/loading/Loading.js +9 -55
- package/dist/components/loading/Loading.lazy.js +15 -0
- package/dist/components/loading/Loading.server.js +16 -0
- package/dist/components/loading/Loading.view.js +124 -0
- package/dist/components/lottie/Lottie.module.scss.js +2 -8
- package/dist/components/post-item/PostItem.module.scss.js +2 -8
- package/dist/components/post-item/PostItemAuthor.module.scss.js +2 -8
- package/dist/components/post-teaser/PostTeaser.module.scss.js +2 -8
- package/dist/components/post-widget/PostWidget.module.scss.js +2 -8
- package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +2 -8
- package/dist/components/progressBar/ProgressBar.module.scss.js +1 -7
- package/dist/components/quote/Quote.module.scss.js +2 -8
- package/dist/components/rich-text/RichText.client.js +54 -23
- package/dist/components/rich-text/RichText.js +1 -1
- package/dist/components/rich-text/RichText.lazy.js +1 -1
- package/dist/components/rich-text/RichText.module.scss.js +4 -8
- package/dist/components/rich-text/RichText.server.js +2 -1
- package/dist/components/select/Select.module.scss.js +2 -8
- package/dist/components/sidenav/SideNav.module.scss.js +2 -8
- package/dist/components/skeleton/{Skeleton.module.scss.js → Skeleton.base.module.scss.js} +2 -8
- package/dist/components/skeleton/Skeleton.effects.client.js +16 -0
- package/dist/components/skeleton/Skeleton.effects.module.scss.js +7 -0
- package/dist/components/skeleton/Skeleton.js +21 -18
- package/dist/components/slider/Slider.client.js +70 -30
- package/dist/components/slider/Slider.module.scss.js +2 -8
- package/dist/components/snackbar/Snackbar.module.scss.js +2 -8
- package/dist/components/stepper/Stepper.module.scss.js +2 -8
- package/dist/components/switch/Switch.module.scss.js +2 -8
- package/dist/components/table/Table.module.scss.js +2 -8
- package/dist/components/table/TableCell.module.scss.js +2 -8
- package/dist/components/teaser/Teaser.module.scss.js +2 -8
- package/dist/constants/project.js +1 -1
- package/dist/hooks/useResponsiveValue.js +123 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/accordion/Accordion.effects.client.d.ts +5 -0
- package/dist/types/components/calendly/Calendly.server.d.ts +1 -1
- package/dist/types/components/calendly/Calendly.view.d.ts +1 -1
- package/dist/types/components/card/Card.effects.client.d.ts +7 -0
- package/dist/types/components/carousel/Carousel.d.ts +2 -0
- package/dist/types/components/carousel/Carousel.lazy.d.ts +2 -0
- package/dist/types/components/carousel/Carousel.model.d.ts +14 -0
- package/dist/types/components/datePicker/DatePicker.view.d.ts +3 -5
- package/dist/types/components/drawer/Drawer.effects.client.d.ts +5 -0
- package/dist/types/components/headline/Headline.effects.client.d.ts +1 -0
- package/dist/types/components/input/Input.client.d.ts +1 -1
- package/dist/types/components/input/Input.view.d.ts +1 -1
- package/dist/types/components/loading/Loading.client.d.ts +4 -0
- package/dist/types/components/loading/Loading.d.ts +4 -2
- package/dist/types/components/loading/Loading.lazy.d.ts +5 -0
- package/dist/types/components/loading/Loading.model.d.ts +16 -1
- package/dist/types/components/loading/Loading.server.d.ts +4 -0
- package/dist/types/components/loading/Loading.view.d.ts +6 -0
- package/dist/types/components/loading/index.d.ts +2 -2
- package/dist/types/components/rich-text/RichText.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.lazy.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.model.d.ts +3 -3
- package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +5 -0
- package/dist/types/components/slider/Slider.model.d.ts +1 -0
- package/dist/types/hooks/useResponsiveValue.d.ts +21 -0
- package/dist/ui.css +1078 -1543
- package/package.json +1 -1
- package/dist/components/loading/Loading.module.scss.js +0 -22
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
3
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
import { create } from "../../helpers/bem.js";
|
|
5
5
|
import { isString } from "../../helpers/validations.js";
|
|
6
|
-
import styles from "./Drawer.module.scss.js";
|
|
6
|
+
import styles from "./Drawer.base.module.scss.js";
|
|
7
|
+
import { DrawerEffectsLoader } from "./Drawer.effects.client.js";
|
|
7
8
|
import { Button } from "../button/Button.js";
|
|
8
9
|
import { Headline } from "../headline/Headline.js";
|
|
9
10
|
const bem = create(styles, "Drawer");
|
|
@@ -25,48 +26,51 @@ const DrawerView = /* @__PURE__ */ __name(({
|
|
|
25
26
|
...rest
|
|
26
27
|
}) => {
|
|
27
28
|
const isOpen = Boolean(open);
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
29
30
|
"div",
|
|
30
31
|
{
|
|
31
32
|
className: bem("backdrop", { open: isOpen }),
|
|
32
33
|
...backdropProps,
|
|
33
|
-
children:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(DrawerEffectsLoader, { useSlide: true }),
|
|
36
|
+
/* @__PURE__ */ jsxs(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
ref: containerRef,
|
|
40
|
+
"aria-labelledby": isString(title) ? "drawer-title" : void 0,
|
|
41
|
+
"aria-modal": "true",
|
|
42
|
+
role: "dialog",
|
|
43
|
+
className: bem(
|
|
44
|
+
"container",
|
|
45
|
+
{
|
|
46
|
+
open: isOpen,
|
|
47
|
+
[`anchor-${anchor}`]: true,
|
|
48
|
+
[`anchor-${anchor}--open`]: isOpen,
|
|
49
|
+
fullscreen
|
|
50
|
+
},
|
|
51
|
+
containerClassName
|
|
52
|
+
),
|
|
53
|
+
...rest,
|
|
54
|
+
children: [
|
|
55
|
+
renderHeader ? renderHeader() : /* @__PURE__ */ jsxs("div", { className: bem("header"), children: [
|
|
56
|
+
isString(title) && /* @__PURE__ */ jsx(Headline, { size: "md", ...titleProps, id: "drawer-title", children: title }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Button,
|
|
59
|
+
{
|
|
60
|
+
"aria-label": "Close drawer",
|
|
61
|
+
iconProps: { name: "Cancel01Icon", size: "sm" },
|
|
62
|
+
variant: "text",
|
|
63
|
+
...closeButtonProps,
|
|
64
|
+
ref: closeButtonRef,
|
|
65
|
+
onClick: /* @__PURE__ */ __name(() => onClose == null ? void 0 : onClose("escapeKeyDown"), "onClick")
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsx("div", { className: bem("content", void 0, className), children })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
70
74
|
}
|
|
71
75
|
);
|
|
72
76
|
}, "DrawerView");
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-DynamicList": "prokodo-DynamicList",
|
|
5
3
|
"prokodo-DynamicList__label": "prokodo-DynamicList__label",
|
|
@@ -10,12 +8,8 @@ const styles = {
|
|
|
10
8
|
"prokodo-DynamicList__delete__button--is-multi": "prokodo-DynamicList__delete__button--is-multi",
|
|
11
9
|
"prokodo-DynamicList__helperText": "prokodo-DynamicList__helperText",
|
|
12
10
|
"prokodo-DynamicList__helperText__content": "prokodo-DynamicList__helperText__content",
|
|
13
|
-
"prokodo-DynamicList__helperText__content--is-error": "prokodo-DynamicList__helperText__content--is-error"
|
|
14
|
-
gradientMove,
|
|
15
|
-
fadeInKeyframe
|
|
11
|
+
"prokodo-DynamicList__helperText__content--is-error": "prokodo-DynamicList__helperText__content--is-error"
|
|
16
12
|
};
|
|
17
13
|
export {
|
|
18
|
-
styles as default
|
|
19
|
-
fadeInKeyframe,
|
|
20
|
-
gradientMove
|
|
14
|
+
styles as default
|
|
21
15
|
};
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
4
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { memo, useState, useEffect, useCallback, useMemo } from "react";
|
|
5
|
+
import { memo, useState, useEffect, useCallback, useMemo, useRef } from "react";
|
|
4
6
|
import { isString } from "../../helpers/validations.js";
|
|
5
7
|
import { FormView } from "./Form.view.js";
|
|
8
|
+
function mergeField(prev, patch) {
|
|
9
|
+
return { ...prev, ...patch };
|
|
10
|
+
}
|
|
11
|
+
__name(mergeField, "mergeField");
|
|
12
|
+
const useDeferredNotifier = /* @__PURE__ */ __name((cb) => {
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (ref.current && cb) {
|
|
16
|
+
const f = ref.current;
|
|
17
|
+
ref.current = null;
|
|
18
|
+
cb(f);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return (f) => {
|
|
22
|
+
ref.current = f;
|
|
23
|
+
};
|
|
24
|
+
}, "useDeferredNotifier");
|
|
6
25
|
const FormClient = memo((props) => {
|
|
7
26
|
const {
|
|
8
27
|
disabled,
|
|
@@ -15,11 +34,14 @@ const FormClient = memo((props) => {
|
|
|
15
34
|
hideResponse,
|
|
16
35
|
...restProps
|
|
17
36
|
} = props;
|
|
18
|
-
const [formState, setFormState] = useState(
|
|
37
|
+
const [formState, setFormState] = useState(
|
|
38
|
+
() => fields ?? []
|
|
39
|
+
);
|
|
19
40
|
const [formMessages, setFormMessages] = useState(
|
|
20
41
|
initialMessages
|
|
21
42
|
);
|
|
22
43
|
const [honeypotValue, setHoneypotValue] = useState("");
|
|
44
|
+
const notifyChange = useDeferredNotifier(onChangeForm);
|
|
23
45
|
useEffect(() => {
|
|
24
46
|
if (initialMessages !== void 0) {
|
|
25
47
|
setFormMessages(initialMessages);
|
|
@@ -28,15 +50,14 @@ const FormClient = memo((props) => {
|
|
|
28
50
|
const updateSingleField = useCallback(
|
|
29
51
|
(index, update) => {
|
|
30
52
|
setFormState((prev) => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
const next = [...prev];
|
|
54
|
+
const nextField = { ...next[index], ...update };
|
|
55
|
+
next[index] = nextField;
|
|
56
|
+
notifyChange(nextField);
|
|
57
|
+
return next;
|
|
34
58
|
});
|
|
35
|
-
if (onChangeForm) {
|
|
36
|
-
onChangeForm({ ...formState[index], ...update });
|
|
37
|
-
}
|
|
38
59
|
},
|
|
39
|
-
[
|
|
60
|
+
[notifyChange]
|
|
40
61
|
);
|
|
41
62
|
const handleFieldValidate = useCallback(
|
|
42
63
|
(field, err) => {
|
|
@@ -51,9 +72,9 @@ const FormClient = memo((props) => {
|
|
|
51
72
|
...(prev == null ? void 0 : prev.errors) ?? {}
|
|
52
73
|
};
|
|
53
74
|
if (isString(err)) {
|
|
54
|
-
updatedErrors[field.label ?? ""] = [err];
|
|
75
|
+
updatedErrors[field.name ?? field.label ?? ""] = [err];
|
|
55
76
|
} else {
|
|
56
|
-
delete updatedErrors[field.label ?? ""];
|
|
77
|
+
delete updatedErrors[field.name ?? field.label ?? ""];
|
|
57
78
|
}
|
|
58
79
|
return {
|
|
59
80
|
errors: Object.keys(updatedErrors).length > 0 ? updatedErrors : void 0
|
|
@@ -64,45 +85,97 @@ const FormClient = memo((props) => {
|
|
|
64
85
|
);
|
|
65
86
|
const handleFieldChange = useCallback(
|
|
66
87
|
(field, value) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
defaultFields == null ? void 0 : defaultFields.forEach((defField) => {
|
|
78
|
-
var _a;
|
|
79
|
-
if (Boolean((_a = defField.conditions) == null ? void 0 : _a.some((c) => c.fieldId === field.name))) {
|
|
80
|
-
const targetIdx = formState.findIndex((f) => f.name === defField.name);
|
|
81
|
-
if (targetIdx >= 0) updateSingleField(targetIdx, defField);
|
|
88
|
+
setFormState((prev) => {
|
|
89
|
+
const next = [...prev];
|
|
90
|
+
const srcIdx = next.findIndex((f) => f.name === field.name);
|
|
91
|
+
if (srcIdx < 0) return prev;
|
|
92
|
+
if (field.fieldType === "dynamic-list") {
|
|
93
|
+
const prevSelf = next[srcIdx];
|
|
94
|
+
const updated = mergeField(prevSelf, { value });
|
|
95
|
+
next[srcIdx] = updated;
|
|
96
|
+
notifyChange(updated);
|
|
97
|
+
return next;
|
|
82
98
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return
|
|
99
|
+
const matches = /* @__PURE__ */ __name((equalTo, v) => {
|
|
100
|
+
const emptyScalar = v === void 0 || v === "";
|
|
101
|
+
const emptyArray = Array.isArray(v) && v.length === 0;
|
|
102
|
+
if (emptyScalar || emptyArray) return false;
|
|
103
|
+
if (typeof equalTo === "boolean") return equalTo === v;
|
|
104
|
+
if (typeof equalTo === "string" || typeof equalTo === "number") {
|
|
105
|
+
return equalTo === v;
|
|
106
|
+
}
|
|
107
|
+
if (Array.isArray(equalTo)) {
|
|
108
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
109
|
+
return equalTo.includes(v);
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(v)) {
|
|
112
|
+
const vv = v;
|
|
113
|
+
const ee = equalTo;
|
|
114
|
+
return vv.some((item) => ee.includes(item));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}, "matches");
|
|
119
|
+
const defaultsByName = /* @__PURE__ */ new Map();
|
|
120
|
+
for (const df of defaultFields ?? []) {
|
|
121
|
+
if (isString(df == null ? void 0 : df.name)) defaultsByName.set(df.name, df);
|
|
88
122
|
}
|
|
89
|
-
|
|
90
|
-
|
|
123
|
+
const conds = Array.isArray(field.conditions) ? field.conditions : [];
|
|
124
|
+
const targetNames = Array.from(new Set(conds.map((c) => c.fieldId).filter(Boolean)));
|
|
125
|
+
for (const targetName of targetNames) {
|
|
126
|
+
const depIdx = next.findIndex((f) => f.name === targetName);
|
|
127
|
+
if (depIdx < 0) continue;
|
|
128
|
+
const prevDep = next[depIdx];
|
|
129
|
+
const def = defaultsByName.get(targetName);
|
|
130
|
+
const dfPatch = def ? { ...def } : { visible: false };
|
|
131
|
+
delete dfPatch.value;
|
|
132
|
+
delete dfPatch.errorText;
|
|
133
|
+
let merged = mergeField(prevDep, dfPatch);
|
|
134
|
+
const defaultVisible = def && typeof def.visible === "boolean" ? def.visible : false;
|
|
135
|
+
if (defaultVisible === false) {
|
|
136
|
+
merged = mergeField(merged, {
|
|
137
|
+
value: void 0,
|
|
138
|
+
errorText: void 0
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
next[depIdx] = merged;
|
|
91
142
|
}
|
|
92
|
-
|
|
93
|
-
|
|
143
|
+
const appliedTargets = /* @__PURE__ */ new Set();
|
|
144
|
+
for (const c of conds) {
|
|
145
|
+
const targetIdx = next.findIndex((f) => f.name === c.fieldId);
|
|
146
|
+
if (targetIdx < 0) continue;
|
|
147
|
+
const shouldApply = typeof c.equalTo === "undefined" ? true : matches(c.equalTo, value);
|
|
148
|
+
if (shouldApply) {
|
|
149
|
+
const prevTarget = next[targetIdx];
|
|
150
|
+
const patch = c.updateProps ?? {};
|
|
151
|
+
next[targetIdx] = mergeField(prevTarget, patch);
|
|
152
|
+
appliedTargets.add(prevTarget.name ?? "");
|
|
153
|
+
}
|
|
94
154
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
155
|
+
for (const targetName of targetNames) {
|
|
156
|
+
if (appliedTargets.has(targetName)) continue;
|
|
157
|
+
const targetIdx = next.findIndex((f) => f.name === targetName);
|
|
158
|
+
if (targetIdx < 0) continue;
|
|
159
|
+
const prevTarget = next[targetIdx];
|
|
160
|
+
const def = defaultsByName.get(targetName);
|
|
161
|
+
const defaultVisible = def && typeof def.visible === "boolean" ? def.visible : false;
|
|
162
|
+
let merged = mergeField(prevTarget, { visible: defaultVisible });
|
|
163
|
+
if (defaultVisible === false) {
|
|
164
|
+
merged = mergeField(merged, {
|
|
165
|
+
value: void 0,
|
|
166
|
+
errorText: void 0
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
next[targetIdx] = merged;
|
|
101
170
|
}
|
|
171
|
+
const prevSelf2 = next[srcIdx];
|
|
172
|
+
const updatedSelf = mergeField(prevSelf2, { value });
|
|
173
|
+
next[srcIdx] = updatedSelf;
|
|
174
|
+
notifyChange(updatedSelf);
|
|
175
|
+
return next;
|
|
102
176
|
});
|
|
103
|
-
updateSingleField(idx, { value });
|
|
104
177
|
},
|
|
105
|
-
[defaultFields,
|
|
178
|
+
[defaultFields, notifyChange]
|
|
106
179
|
);
|
|
107
180
|
const handleHpChange = useCallback(
|
|
108
181
|
(e) => {
|
|
@@ -114,18 +187,23 @@ const FormClient = memo((props) => {
|
|
|
114
187
|
const errors = {};
|
|
115
188
|
formState.forEach((field) => {
|
|
116
189
|
var _a, _b, _c, _d;
|
|
117
|
-
|
|
190
|
+
const visible = field.visible !== false;
|
|
191
|
+
const emptyArray = Array.isArray(field.value) && field.value.length === 0;
|
|
192
|
+
const emptyScalar = field.value === void 0 || field.value === "";
|
|
193
|
+
if (Boolean(field.required) && visible && (emptyScalar || emptyArray)) {
|
|
118
194
|
const errMsg = ((_b = (_a = messagesFields == null ? void 0 : messagesFields.errors) == null ? void 0 : _a.input) == null ? void 0 : _b["required"]) ?? "This field is required";
|
|
119
|
-
|
|
120
|
-
|
|
195
|
+
const key = field.name ?? field.label ?? "";
|
|
196
|
+
if (!errors[key]) {
|
|
197
|
+
errors[key] = [];
|
|
121
198
|
}
|
|
122
|
-
(_c = errors[
|
|
199
|
+
(_c = errors[key]) == null ? void 0 : _c.push(errMsg);
|
|
123
200
|
}
|
|
124
201
|
if (isString(field.errorText)) {
|
|
125
|
-
|
|
126
|
-
|
|
202
|
+
const key = field.name ?? field.label ?? "";
|
|
203
|
+
if (!errors[key]) {
|
|
204
|
+
errors[key] = [];
|
|
127
205
|
}
|
|
128
|
-
(_d = errors[
|
|
206
|
+
(_d = errors[key]) == null ? void 0 : _d.push(field.errorText);
|
|
129
207
|
}
|
|
130
208
|
});
|
|
131
209
|
return {
|
|
@@ -146,10 +224,9 @@ const FormClient = memo((props) => {
|
|
|
146
224
|
const isFormValid = useMemo(() => {
|
|
147
225
|
if (Boolean(hideResponse)) {
|
|
148
226
|
return formState.every((f) => {
|
|
149
|
-
if (Boolean(f.required)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return true;
|
|
227
|
+
if (!Boolean(f.required) || f.visible === false) return true;
|
|
228
|
+
if (Array.isArray(f.value)) return f.value.length > 0;
|
|
229
|
+
return f.value !== void 0 && f.value !== "";
|
|
153
230
|
});
|
|
154
231
|
}
|
|
155
232
|
return true;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Form__label": "prokodo-Form__label",
|
|
5
3
|
"prokodo-Form__label--is-hidden": "prokodo-Form__label--is-hidden",
|
|
6
4
|
"prokodo-Form__grid": "prokodo-Form__grid",
|
|
7
5
|
"prokodo-Form__hp": "prokodo-Form__hp",
|
|
8
6
|
"prokodo-Form__footer": "prokodo-Form__footer",
|
|
9
|
-
"prokodo-Form__footer__submit": "prokodo-Form__footer__submit"
|
|
10
|
-
gradientMove,
|
|
11
|
-
fadeInKeyframe
|
|
7
|
+
"prokodo-Form__footer__submit": "prokodo-Form__footer__submit"
|
|
12
8
|
};
|
|
13
9
|
export {
|
|
14
|
-
styles as default
|
|
15
|
-
fadeInKeyframe,
|
|
16
|
-
gradientMove
|
|
10
|
+
styles as default
|
|
17
11
|
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
|
-
"prokodo-FormField": "prokodo-FormField"
|
|
5
|
-
gradientMove,
|
|
6
|
-
fadeInKeyframe
|
|
2
|
+
"prokodo-FormField": "prokodo-FormField"
|
|
7
3
|
};
|
|
8
4
|
export {
|
|
9
|
-
styles as default
|
|
10
|
-
fadeInKeyframe,
|
|
11
|
-
gradientMove
|
|
5
|
+
styles as default
|
|
12
6
|
};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-FormResponse": "prokodo-FormResponse",
|
|
5
3
|
"prokodo-FormResponse__success": "prokodo-FormResponse__success",
|
|
6
4
|
"prokodo-FormResponse__errors": "prokodo-FormResponse__errors",
|
|
7
5
|
"prokodo-FormResponse__errors__item": "prokodo-FormResponse__errors__item",
|
|
8
|
-
"prokodo-FormResponse__errors__desc": "prokodo-FormResponse__errors__desc"
|
|
9
|
-
gradientMove,
|
|
10
|
-
fadeInKeyframe
|
|
6
|
+
"prokodo-FormResponse__errors__desc": "prokodo-FormResponse__errors__desc"
|
|
11
7
|
};
|
|
12
8
|
export {
|
|
13
|
-
styles as default
|
|
14
|
-
fadeInKeyframe,
|
|
15
|
-
gradientMove
|
|
9
|
+
styles as default
|
|
16
10
|
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
|
-
"prokodo-Grid": "prokodo-Grid"
|
|
5
|
-
gradientMove,
|
|
6
|
-
fadeInKeyframe
|
|
2
|
+
"prokodo-Grid": "prokodo-Grid"
|
|
7
3
|
};
|
|
8
4
|
export {
|
|
9
|
-
styles as default
|
|
10
|
-
fadeInKeyframe,
|
|
11
|
-
gradientMove
|
|
5
|
+
styles as default
|
|
12
6
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-GridRow": "prokodo-GridRow",
|
|
5
3
|
"prokodo-GridRow--align-left": "prokodo-GridRow--align-left",
|
|
@@ -64,12 +62,8 @@ const styles = {
|
|
|
64
62
|
"prokodo-GridRow--xl-9": "prokodo-GridRow--xl-9",
|
|
65
63
|
"prokodo-GridRow--xl-10": "prokodo-GridRow--xl-10",
|
|
66
64
|
"prokodo-GridRow--xl-11": "prokodo-GridRow--xl-11",
|
|
67
|
-
"prokodo-GridRow--xl-12": "prokodo-GridRow--xl-12"
|
|
68
|
-
gradientMove,
|
|
69
|
-
fadeInKeyframe
|
|
65
|
+
"prokodo-GridRow--xl-12": "prokodo-GridRow--xl-12"
|
|
70
66
|
};
|
|
71
67
|
export {
|
|
72
|
-
styles as default
|
|
73
|
-
fadeInKeyframe,
|
|
74
|
-
gradientMove
|
|
68
|
+
styles as default
|
|
75
69
|
};
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Headline": "prokodo-Headline",
|
|
5
|
-
"prokodo-Headline--is-highlighted": "prokodo-Headline--is-highlighted",
|
|
6
|
-
"prokodo-Headline--primary--highlighted": "prokodo-Headline--primary--highlighted",
|
|
7
|
-
"prokodo-Headline--secondary--highlighted": "prokodo-Headline--secondary--highlighted",
|
|
8
|
-
"prokodo-Headline--success--highlighted": "prokodo-Headline--success--highlighted",
|
|
9
|
-
"prokodo-Headline--warning--highlighted": "prokodo-Headline--warning--highlighted",
|
|
10
|
-
"prokodo-Headline--error--highlighted": "prokodo-Headline--error--highlighted",
|
|
11
3
|
"prokodo-Headline--inherit": "prokodo-Headline--inherit",
|
|
12
|
-
"prokodo-Headline--inherit--highlighted": "prokodo-Headline--inherit--highlighted",
|
|
13
4
|
"prokodo-Headline--primary": "prokodo-Headline--primary",
|
|
14
5
|
"prokodo-Headline--secondary": "prokodo-Headline--secondary",
|
|
15
6
|
"prokodo-Headline--success": "prokodo-Headline--success",
|
|
@@ -25,12 +16,8 @@ const styles = {
|
|
|
25
16
|
"prokodo-Headline--xl": "prokodo-Headline--xl",
|
|
26
17
|
"prokodo-Headline--xxl": "prokodo-Headline--xxl",
|
|
27
18
|
"prokodo-Headline--center": "prokodo-Headline--center",
|
|
28
|
-
"prokodo-Headline--right": "prokodo-Headline--right"
|
|
29
|
-
gradientMove,
|
|
30
|
-
fadeInKeyframe
|
|
19
|
+
"prokodo-Headline--right": "prokodo-Headline--right"
|
|
31
20
|
};
|
|
32
21
|
export {
|
|
33
|
-
styles as default
|
|
34
|
-
fadeInKeyframe,
|
|
35
|
-
gradientMove
|
|
22
|
+
styles as default
|
|
36
23
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
function HeadlineEffectsLoader() {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
void import("./Headline.effects.module.scss.js");
|
|
8
|
+
}, []);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
__name(HeadlineEffectsLoader, "HeadlineEffectsLoader");
|
|
12
|
+
export {
|
|
13
|
+
HeadlineEffectsLoader
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const Headline_effects_module = {
|
|
2
|
+
"prokodo-Headline": "prokodo-Headline",
|
|
3
|
+
"prokodo-Headline--is-highlighted": "prokodo-Headline--is-highlighted",
|
|
4
|
+
"prokodo-Headline--inherit--highlighted": "prokodo-Headline--inherit--highlighted",
|
|
5
|
+
"prokodo-Headline--primary--highlighted": "prokodo-Headline--primary--highlighted",
|
|
6
|
+
"prokodo-Headline--secondary--highlighted": "prokodo-Headline--secondary--highlighted",
|
|
7
|
+
"prokodo-Headline--success--highlighted": "prokodo-Headline--success--highlighted",
|
|
8
|
+
"prokodo-Headline--warning--highlighted": "prokodo-Headline--warning--highlighted",
|
|
9
|
+
"prokodo-Headline--error--highlighted": "prokodo-Headline--error--highlighted"
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
Headline_effects_module as default
|
|
13
|
+
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
4
4
|
import { create } from "../../helpers/bem.js";
|
|
5
|
-
import styles from "./Headline.module.scss.js";
|
|
5
|
+
import styles from "./Headline.base.module.scss.js";
|
|
6
|
+
import { HeadlineEffectsLoader } from "./Headline.effects.client.js";
|
|
6
7
|
import { POSSIBLE_HIGHLIGHTS } from "./Headline.variants.js";
|
|
7
8
|
import { RichText } from "../rich-text/RichText.js";
|
|
8
9
|
import { AnimatedText } from "../animatedText/AnimatedText.js";
|
|
9
10
|
const bem = create(styles, "Headline");
|
|
10
11
|
const Headline = /* @__PURE__ */ __name(({
|
|
12
|
+
id,
|
|
11
13
|
animated,
|
|
12
14
|
animationProps = {},
|
|
13
15
|
type = "h3",
|
|
@@ -34,6 +36,7 @@ const Headline = /* @__PURE__ */ __name(({
|
|
|
34
36
|
const customStyle = typeof size === "number" ? { fontSize: `${size}em` } : {};
|
|
35
37
|
const ariaLabel = typeof children === "string" ? children : void 0;
|
|
36
38
|
const baseProps = {
|
|
39
|
+
id,
|
|
37
40
|
"aria-label": ariaLabel,
|
|
38
41
|
className: bemClass,
|
|
39
42
|
style: customStyle,
|
|
@@ -48,24 +51,31 @@ const Headline = /* @__PURE__ */ __name(({
|
|
|
48
51
|
const renderHTag = /* @__PURE__ */ __name(({ children: headingChildren }) => {
|
|
49
52
|
const HTag = type;
|
|
50
53
|
const headingLevel = parseInt(type.charAt(1), 10);
|
|
51
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
isHighlighted && /* @__PURE__ */ jsx(HeadlineEffectsLoader, {}),
|
|
56
|
+
/* @__PURE__ */ jsx(HTag, { ...baseProps, "aria-level": headingLevel, children: animateText(headingChildren) })
|
|
57
|
+
] });
|
|
52
58
|
}, "renderHTag");
|
|
53
59
|
if (isRichtext) {
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
+
isHighlighted && /* @__PURE__ */ jsx(HeadlineEffectsLoader, {}),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
RichText,
|
|
64
|
+
{
|
|
65
|
+
animated,
|
|
66
|
+
animationProps,
|
|
67
|
+
className: bem("headline", void 0, className),
|
|
68
|
+
id,
|
|
69
|
+
itemProp: void 0,
|
|
70
|
+
linkComponent: void 0,
|
|
71
|
+
schema,
|
|
72
|
+
variant,
|
|
73
|
+
...remainingProps,
|
|
74
|
+
overrideParagraph: /* @__PURE__ */ __name((textContent) => renderHTag({ children: textContent }), "overrideParagraph"),
|
|
75
|
+
children
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] });
|
|
69
79
|
}
|
|
70
80
|
return renderHTag({ children });
|
|
71
81
|
}, "Headline");
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Icon": "prokodo-Icon",
|
|
5
3
|
"prokodo-Icon--primary": "prokodo-Icon--primary",
|
|
@@ -8,12 +6,8 @@ const styles = {
|
|
|
8
6
|
"prokodo-Icon--success": "prokodo-Icon--success",
|
|
9
7
|
"prokodo-Icon--warning": "prokodo-Icon--warning",
|
|
10
8
|
"prokodo-Icon--error": "prokodo-Icon--error",
|
|
11
|
-
"prokodo-Icon--white": "prokodo-Icon--white"
|
|
12
|
-
gradientMove,
|
|
13
|
-
fadeInKeyframe
|
|
9
|
+
"prokodo-Icon--white": "prokodo-Icon--white"
|
|
14
10
|
};
|
|
15
11
|
export {
|
|
16
|
-
styles as default
|
|
17
|
-
fadeInKeyframe,
|
|
18
|
-
gradientMove
|
|
12
|
+
styles as default
|
|
19
13
|
};
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Image": "prokodo-Image",
|
|
5
|
-
"prokodo-Image__caption": "prokodo-Image__caption"
|
|
6
|
-
gradientMove,
|
|
7
|
-
fadeInKeyframe
|
|
3
|
+
"prokodo-Image__caption": "prokodo-Image__caption"
|
|
8
4
|
};
|
|
9
5
|
export {
|
|
10
|
-
styles as default
|
|
11
|
-
fadeInKeyframe,
|
|
12
|
-
gradientMove
|
|
6
|
+
styles as default
|
|
13
7
|
};
|