@prokodo/ui 0.0.45 → 0.0.46
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 +3 -4
- package/dist/components/accordion/Accordion.view.js +7 -4
- package/dist/components/animatedText/AnimatedText.view.js +1 -1
- package/dist/components/card/Card.view.js +1 -1
- package/dist/components/dynamic-list/DynamicList.module.scss.js +1 -0
- package/dist/components/dynamic-list/DynamicList.view.js +1 -1
- package/dist/components/form/Form.client.js +7 -4
- package/dist/components/form/Form.view.js +69 -67
- package/dist/components/form/FormField.client.js +1 -0
- package/dist/components/grid/Grid.js +2 -2
- package/dist/components/grid/GridRow.js +2 -2
- package/dist/components/input/Input.view.js +2 -1
- package/dist/components/input/InputValidation.js +11 -8
- package/dist/constants/project.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/form/Form.model.d.ts +1 -0
- package/dist/ui.css +167 -46
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const accordionBorderShift = "accordionBorderShift";
|
|
2
2
|
const gradientMove = "gradientMove";
|
|
3
3
|
const fadeInKeyframe = "fadeInKeyframe";
|
|
4
4
|
const styles = {
|
|
@@ -6,10 +6,9 @@ const styles = {
|
|
|
6
6
|
"prokodo-Accordion__item": "prokodo-Accordion__item",
|
|
7
7
|
"prokodo-Accordion__item--is-expanded": "prokodo-Accordion__item--is-expanded",
|
|
8
8
|
"prokodo-Accordion__header": "prokodo-Accordion__header",
|
|
9
|
-
|
|
9
|
+
accordionBorderShift,
|
|
10
10
|
"prokodo-Accordion__header--is-expanded": "prokodo-Accordion__header--is-expanded",
|
|
11
11
|
"prokodo-Accordion__title": "prokodo-Accordion__title",
|
|
12
|
-
"prokodo-Accordion__title--is-expanded": "prokodo-Accordion__title--is-expanded",
|
|
13
12
|
"prokodo-Accordion__icon": "prokodo-Accordion__icon",
|
|
14
13
|
"prokodo-Accordion__icon--is-hidden": "prokodo-Accordion__icon--is-hidden",
|
|
15
14
|
"prokodo-Accordion__content": "prokodo-Accordion__content",
|
|
@@ -19,7 +18,7 @@ const styles = {
|
|
|
19
18
|
fadeInKeyframe
|
|
20
19
|
};
|
|
21
20
|
export {
|
|
22
|
-
|
|
21
|
+
accordionBorderShift,
|
|
23
22
|
styles as default,
|
|
24
23
|
fadeInKeyframe,
|
|
25
24
|
gradientMove
|
|
@@ -46,9 +46,12 @@ function AccordionView({
|
|
|
46
46
|
!isNull(renderHeader) ? renderHeader : /* @__PURE__ */ jsx(
|
|
47
47
|
Headline,
|
|
48
48
|
{
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
animated: true,
|
|
50
|
+
className: bem("title"),
|
|
51
|
+
highlight: isExpanded,
|
|
52
|
+
size: "xs",
|
|
51
53
|
type: "h3",
|
|
54
|
+
variant: isExpanded ? "primary" : "inherit",
|
|
52
55
|
...item.titleOptions ?? titleOptions,
|
|
53
56
|
children: title
|
|
54
57
|
}
|
|
@@ -57,7 +60,7 @@ function AccordionView({
|
|
|
57
60
|
Icon,
|
|
58
61
|
{
|
|
59
62
|
className: bem("icon", { "is-hidden": isExpanded }),
|
|
60
|
-
color: "
|
|
63
|
+
color: "inherit",
|
|
61
64
|
name: "PlusSignIcon",
|
|
62
65
|
size: "sm",
|
|
63
66
|
...iconProps
|
|
@@ -67,7 +70,7 @@ function AccordionView({
|
|
|
67
70
|
Icon,
|
|
68
71
|
{
|
|
69
72
|
className: bem("icon", { "is-hidden": !isExpanded }),
|
|
70
|
-
color: "
|
|
73
|
+
color: "inherit",
|
|
71
74
|
name: "MinusSignIcon",
|
|
72
75
|
size: "sm",
|
|
73
76
|
...iconProps
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
const AnimatedTextView = /* @__PURE__ */ __name(({ text, ...spanRest }) => /* @__PURE__ */ jsx("span", { ...spanRest, children: text }), "AnimatedTextView");
|
|
4
|
+
const AnimatedTextView = /* @__PURE__ */ __name((({ text, ...spanRest }) => /* @__PURE__ */ jsx("span", { ...spanRest, children: text })), "AnimatedTextView");
|
|
5
5
|
AnimatedTextView.displayName = "AnimatedTextView";
|
|
6
6
|
export {
|
|
7
7
|
AnimatedTextView
|
|
@@ -2,6 +2,7 @@ const gradientMove = "gradientMove";
|
|
|
2
2
|
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
3
|
const styles = {
|
|
4
4
|
"prokodo-DynamicList": "prokodo-DynamicList",
|
|
5
|
+
"prokodo-DynamicList__label": "prokodo-DynamicList__label",
|
|
5
6
|
"prokodo-DynamicList__list": "prokodo-DynamicList__list",
|
|
6
7
|
"prokodo-DynamicList__list__item": "prokodo-DynamicList__list__item",
|
|
7
8
|
"prokodo-DynamicList__list__item--is-multi": "prokodo-DynamicList__list__item--is-multi",
|
|
@@ -43,7 +43,7 @@ function DynamicListView({
|
|
|
43
43
|
{
|
|
44
44
|
...labelProps,
|
|
45
45
|
"aria-disabled": disabled,
|
|
46
|
-
className: bem("
|
|
46
|
+
className: bem("label", void 0, labelProps == null ? void 0 : labelProps.className),
|
|
47
47
|
error: isError,
|
|
48
48
|
id: (labelProps == null ? void 0 : labelProps.id) ?? `${name}-legend`,
|
|
49
49
|
label,
|
|
@@ -74,10 +74,11 @@ const FormClient = memo((props) => {
|
|
|
74
74
|
updateSingleField(idx, { value });
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
defaultFields == null ? void 0 : defaultFields.forEach((defField
|
|
77
|
+
defaultFields == null ? void 0 : defaultFields.forEach((defField) => {
|
|
78
78
|
var _a;
|
|
79
79
|
if (Boolean((_a = defField.conditions) == null ? void 0 : _a.some((c) => c.fieldId === field.name))) {
|
|
80
|
-
|
|
80
|
+
const targetIdx = formState.findIndex((f) => f.name === defField.name);
|
|
81
|
+
if (targetIdx >= 0) updateSingleField(targetIdx, defField);
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
84
|
const matched = (field.conditions ?? []).filter((c) => {
|
|
@@ -161,14 +162,16 @@ const FormClient = memo((props) => {
|
|
|
161
162
|
formMessages,
|
|
162
163
|
formState,
|
|
163
164
|
isFormValid,
|
|
165
|
+
isHoneypotEmpty: honeypotValue.length === 0,
|
|
164
166
|
fieldProps: {
|
|
165
167
|
onChange: handleFieldChange,
|
|
166
168
|
onValidate: handleFieldValidate
|
|
167
169
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
170
|
},
|
|
169
171
|
honeypot: {
|
|
170
|
-
|
|
171
|
-
onChange: handleHpChange
|
|
172
|
+
defaultValue: "",
|
|
173
|
+
onChange: handleHpChange,
|
|
174
|
+
autoComplete: "off"
|
|
172
175
|
},
|
|
173
176
|
onFormSubmit: handleFormSubmit
|
|
174
177
|
}
|
|
@@ -26,80 +26,82 @@ const FormView = /* @__PURE__ */ __name(({
|
|
|
26
26
|
button,
|
|
27
27
|
children,
|
|
28
28
|
honeypot,
|
|
29
|
+
isHoneypotEmpty,
|
|
29
30
|
onFormSubmit,
|
|
30
31
|
isFormValid,
|
|
31
32
|
fieldProps,
|
|
32
33
|
messagesFields,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
// ⬇️ strip non-DOM props so they don't leak to <form>
|
|
35
|
+
fields: _fields,
|
|
36
|
+
defaultFields: _defaultFields,
|
|
37
|
+
messages: _messages,
|
|
38
|
+
...htmlProps
|
|
39
|
+
}) => /* @__PURE__ */ jsxs(
|
|
40
|
+
"form",
|
|
41
|
+
{
|
|
42
|
+
...htmlProps,
|
|
43
|
+
noValidate: true,
|
|
44
|
+
action,
|
|
45
|
+
"aria-labelledby": `${id}-heading`,
|
|
46
|
+
className: bem(void 0, void 0, className),
|
|
47
|
+
id,
|
|
48
|
+
onSubmit: typeof action === "function" || typeof action === "string" ? void 0 : onFormSubmit,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
Headline,
|
|
52
|
+
{
|
|
53
|
+
type: "h2",
|
|
54
|
+
...headlineProps,
|
|
55
|
+
id: `${id}-heading`,
|
|
56
|
+
className: bem("label", {
|
|
57
|
+
"is-hidden": Boolean(hideHeadline)
|
|
58
|
+
}, headlineProps == null ? void 0 : headlineProps.className),
|
|
59
|
+
children: label
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsxs(Grid, { className: bem("grid"), spacing: 2, children: [
|
|
63
|
+
isArray(formState) && formState.map((field) => /* @__PURE__ */ createElement(
|
|
64
|
+
FormField,
|
|
65
|
+
{
|
|
66
|
+
...field,
|
|
67
|
+
key: field.name,
|
|
68
|
+
messagesFields,
|
|
69
|
+
variant,
|
|
70
|
+
disabled: disabled !== void 0 ? disabled : field == null ? void 0 : field.disabled,
|
|
71
|
+
...fieldProps
|
|
72
|
+
}
|
|
73
|
+
)),
|
|
74
|
+
children,
|
|
47
75
|
/* @__PURE__ */ jsx(
|
|
48
|
-
|
|
76
|
+
"input",
|
|
77
|
+
{
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
className: bem("hp"),
|
|
80
|
+
id: "hp",
|
|
81
|
+
name: "hp",
|
|
82
|
+
type: "text",
|
|
83
|
+
...honeypot
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: bem("footer"), children: [
|
|
88
|
+
(hideResponse === false || hideResponse === void 0) && /* @__PURE__ */ jsx(FormResponse, { messages: formMessages }),
|
|
89
|
+
!isNull(button) && Boolean(isHoneypotEmpty) && /* @__PURE__ */ jsx(
|
|
90
|
+
Button,
|
|
49
91
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
92
|
+
"aria-label": "Submit form",
|
|
93
|
+
title: "Submit",
|
|
94
|
+
type: "submit",
|
|
95
|
+
...button,
|
|
96
|
+
className: bem("footer__submit", void 0, button == null ? void 0 : button.className),
|
|
97
|
+
color: (button == null ? void 0 : button.color) ?? variant,
|
|
98
|
+
disabled: Boolean(formMessages == null ? void 0 : formMessages.errors) || !isFormValid
|
|
57
99
|
}
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...field,
|
|
64
|
-
key: field.name,
|
|
65
|
-
messagesFields,
|
|
66
|
-
variant,
|
|
67
|
-
disabled: disabled !== void 0 ? disabled : field == null ? void 0 : field.disabled,
|
|
68
|
-
...fieldProps
|
|
69
|
-
}
|
|
70
|
-
)),
|
|
71
|
-
children,
|
|
72
|
-
/* @__PURE__ */ jsx(
|
|
73
|
-
"input",
|
|
74
|
-
{
|
|
75
|
-
"aria-hidden": "true",
|
|
76
|
-
className: bem("hp"),
|
|
77
|
-
id: "hp",
|
|
78
|
-
name: "hp",
|
|
79
|
-
type: "text",
|
|
80
|
-
...honeypot
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
] }),
|
|
84
|
-
/* @__PURE__ */ jsxs("div", { className: bem("footer"), children: [
|
|
85
|
-
(hideResponse === false || hideResponse === void 0) && /* @__PURE__ */ jsx(FormResponse, { messages: formMessages }),
|
|
86
|
-
!isNull(button) && ((_a = honeypot == null ? void 0 : honeypot.value) == null ? void 0 : _a.length) === 0 && /* @__PURE__ */ jsx(
|
|
87
|
-
Button,
|
|
88
|
-
{
|
|
89
|
-
"aria-label": "Submit form",
|
|
90
|
-
title: "Submit",
|
|
91
|
-
type: "submit",
|
|
92
|
-
...button,
|
|
93
|
-
className: bem("footer__submit", void 0, button == null ? void 0 : button.className),
|
|
94
|
-
color: (button == null ? void 0 : button.color) ?? variant,
|
|
95
|
-
disabled: Boolean(formMessages == null ? void 0 : formMessages.errors) || !isFormValid
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
] })
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
}, "FormView");
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
), "FormView");
|
|
103
105
|
export {
|
|
104
106
|
FormView
|
|
105
107
|
};
|
|
@@ -34,6 +34,7 @@ function FormFieldClient({
|
|
|
34
34
|
priority: true,
|
|
35
35
|
color: variant,
|
|
36
36
|
...props,
|
|
37
|
+
checked: typeof (props == null ? void 0 : props.value) === "boolean" ? Boolean(props == null ? void 0 : props.value) : props.checked,
|
|
37
38
|
onChange: /* @__PURE__ */ __name((_, checked) => onChange == null ? void 0 : onChange(props, checked), "onChange")
|
|
38
39
|
}
|
|
39
40
|
)
|
|
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { create } from "../../helpers/bem.js";
|
|
5
5
|
import styles from "./Grid.module.scss.js";
|
|
6
6
|
const bem = create(styles, "Grid");
|
|
7
|
-
const Grid = /* @__PURE__ */ __name(({ spacing = 2, className, children, ...props }) => /* @__PURE__ */ jsx(
|
|
7
|
+
const Grid = /* @__PURE__ */ __name((({ spacing = 2, className, children, ...props }) => /* @__PURE__ */ jsx(
|
|
8
8
|
"div",
|
|
9
9
|
{
|
|
10
10
|
className: bem(void 0, void 0, className),
|
|
@@ -14,7 +14,7 @@ const Grid = /* @__PURE__ */ __name(({ spacing = 2, className, children, ...prop
|
|
|
14
14
|
...props,
|
|
15
15
|
children
|
|
16
16
|
}
|
|
17
|
-
), "Grid");
|
|
17
|
+
)), "Grid");
|
|
18
18
|
Grid.displayName = "Grid";
|
|
19
19
|
export {
|
|
20
20
|
Grid
|
|
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { create } from "../../helpers/bem.js";
|
|
5
5
|
import styles from "./GridRow.module.scss.js";
|
|
6
6
|
const bem = create(styles, "GridRow");
|
|
7
|
-
const GridRow = /* @__PURE__ */ __name(({ align, className, children, xs, sm, md, lg, xl, ...props }) => /* @__PURE__ */ jsx(
|
|
7
|
+
const GridRow = /* @__PURE__ */ __name((({ align, className, children, xs, sm, md, lg, xl, ...props }) => /* @__PURE__ */ jsx(
|
|
8
8
|
"div",
|
|
9
9
|
{
|
|
10
10
|
className: bem(
|
|
@@ -22,7 +22,7 @@ const GridRow = /* @__PURE__ */ __name(({ align, className, children, xs, sm, md
|
|
|
22
22
|
...props,
|
|
23
23
|
children
|
|
24
24
|
}
|
|
25
|
-
), "GridRow");
|
|
25
|
+
)), "GridRow");
|
|
26
26
|
GridRow.displayName = "GridRow";
|
|
27
27
|
export {
|
|
28
28
|
GridRow
|
|
@@ -40,15 +40,18 @@ const handleValidation = /* @__PURE__ */ __name((type, name, value, required, mi
|
|
|
40
40
|
password: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{8,}$/
|
|
41
41
|
};
|
|
42
42
|
if (customRegexPattern !== void 0) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
43
|
+
let customRegex;
|
|
44
|
+
const m = customRegexPattern.match(/^\/([\s\S]*)\/([gimsuy]*)$/);
|
|
45
|
+
if (m) {
|
|
46
|
+
const [, pattern = "", flags] = m;
|
|
47
|
+
customRegex = new RegExp(pattern, flags);
|
|
48
|
+
} else {
|
|
49
|
+
customRegex = new RegExp(customRegexPattern);
|
|
51
50
|
}
|
|
51
|
+
regexPatterns = {
|
|
52
|
+
...regexPatterns,
|
|
53
|
+
[String(type)]: RegExp(customRegex)
|
|
54
|
+
};
|
|
52
55
|
}
|
|
53
56
|
const errorMessages = {
|
|
54
57
|
// text: "Text can only include letters and common punctuation.",
|