@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,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-ImageText__grid": "prokodo-ImageText__grid",
|
|
5
3
|
"prokodo-ImageText__grid--is-reverse": "prokodo-ImageText__grid--is-reverse",
|
|
@@ -9,12 +7,8 @@ const styles = {
|
|
|
9
7
|
"prokodo-ImageText__animated__container": "prokodo-ImageText__animated__container",
|
|
10
8
|
"prokodo-ImageText__animation": "prokodo-ImageText__animation",
|
|
11
9
|
"prokodo-ImageText__image": "prokodo-ImageText__image",
|
|
12
|
-
"prokodo-ImageText__image__src": "prokodo-ImageText__image__src"
|
|
13
|
-
gradientMove,
|
|
14
|
-
fadeInKeyframe
|
|
10
|
+
"prokodo-ImageText__image__src": "prokodo-ImageText__image__src"
|
|
15
11
|
};
|
|
16
12
|
export {
|
|
17
|
-
styles as default
|
|
18
|
-
fadeInKeyframe,
|
|
19
|
-
gradientMove
|
|
13
|
+
styles as default
|
|
20
14
|
};
|
|
@@ -19,6 +19,7 @@ function InputClient({
|
|
|
19
19
|
customRegexPattern,
|
|
20
20
|
errorText,
|
|
21
21
|
errorTranslations,
|
|
22
|
+
readOnly,
|
|
22
23
|
onValidate,
|
|
23
24
|
onChange,
|
|
24
25
|
onFocus,
|
|
@@ -82,10 +83,20 @@ function InputClient({
|
|
|
82
83
|
isFocused: isFocused !== void 0 ? Boolean(isFocused) : focused,
|
|
83
84
|
value: val,
|
|
84
85
|
errorText: err,
|
|
86
|
+
required,
|
|
87
|
+
// ← keep required
|
|
88
|
+
min,
|
|
89
|
+
// ← if you want DOM to know about min
|
|
90
|
+
max,
|
|
91
|
+
// ← and max
|
|
92
|
+
maxLength,
|
|
93
|
+
// ← and maxLength (used by view counter)
|
|
94
|
+
readOnly,
|
|
95
|
+
// ← if you ever pass readOnly to client too
|
|
85
96
|
onChange: handleChange,
|
|
86
97
|
onFocus: handleFocus,
|
|
87
98
|
onBlur: handleBlur
|
|
88
|
-
}), [isFocused, focused, val, err, name, handleChange, handleFocus, handleBlur, rest]);
|
|
99
|
+
}), [isFocused, focused, val, err, name, required, min, max, maxLength, readOnly, handleChange, handleFocus, handleBlur, rest]);
|
|
89
100
|
const viewProps = Boolean(multiline) ? {
|
|
90
101
|
...viewBase,
|
|
91
102
|
multiline: true
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Input": "prokodo-Input",
|
|
5
3
|
"prokodo-Input__label": "prokodo-Input__label",
|
|
@@ -14,17 +12,14 @@ const styles = {
|
|
|
14
12
|
"prokodo-Input__input__node": "prokodo-Input__input__node",
|
|
15
13
|
"prokodo-Input__input__node--multiline": "prokodo-Input__input__node--multiline",
|
|
16
14
|
"prokodo-Input__footer": "prokodo-Input__footer",
|
|
15
|
+
"prokodo-Input__footer--counter-only": "prokodo-Input__footer--counter-only",
|
|
17
16
|
"prokodo-Input__helperText__wrapper": "prokodo-Input__helperText__wrapper",
|
|
18
17
|
"prokodo-Input__helperText": "prokodo-Input__helperText",
|
|
19
18
|
"prokodo-Input__helperText__content": "prokodo-Input__helperText__content",
|
|
20
19
|
"prokodo-Input__helperText__content--is-error": "prokodo-Input__helperText__content--is-error",
|
|
21
20
|
"prokodo-Input__helperText__legend": "prokodo-Input__helperText__legend",
|
|
22
|
-
"prokodo-Input__counter": "prokodo-Input__counter"
|
|
23
|
-
gradientMove,
|
|
24
|
-
fadeInKeyframe
|
|
21
|
+
"prokodo-Input__counter": "prokodo-Input__counter"
|
|
25
22
|
};
|
|
26
23
|
export {
|
|
27
|
-
styles as default
|
|
28
|
-
fadeInKeyframe,
|
|
29
|
-
gradientMove
|
|
24
|
+
styles as default
|
|
30
25
|
};
|
|
@@ -7,6 +7,7 @@ import styles from "./Input.module.scss.js";
|
|
|
7
7
|
import { Label } from "../label/Label.js";
|
|
8
8
|
const bem = create(styles, "Input");
|
|
9
9
|
function InputView({
|
|
10
|
+
inputRef,
|
|
10
11
|
name,
|
|
11
12
|
label,
|
|
12
13
|
disabled,
|
|
@@ -24,6 +25,7 @@ function InputView({
|
|
|
24
25
|
fieldClassName,
|
|
25
26
|
inputContainerClassName,
|
|
26
27
|
inputClassName,
|
|
28
|
+
hideCounter,
|
|
27
29
|
rows,
|
|
28
30
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
31
|
minRows,
|
|
@@ -65,6 +67,7 @@ function InputView({
|
|
|
65
67
|
"textarea",
|
|
66
68
|
{
|
|
67
69
|
...rest,
|
|
70
|
+
ref: inputRef,
|
|
68
71
|
"aria-describedby": describedBy,
|
|
69
72
|
"aria-invalid": isError,
|
|
70
73
|
"aria-required": required,
|
|
@@ -73,6 +76,7 @@ function InputView({
|
|
|
73
76
|
id: name,
|
|
74
77
|
name,
|
|
75
78
|
placeholder,
|
|
79
|
+
required: Boolean(required),
|
|
76
80
|
rows,
|
|
77
81
|
value: value ?? ""
|
|
78
82
|
}
|
|
@@ -80,6 +84,7 @@ function InputView({
|
|
|
80
84
|
"input",
|
|
81
85
|
{
|
|
82
86
|
...rest,
|
|
87
|
+
ref: inputRef,
|
|
83
88
|
"aria-describedby": describedBy,
|
|
84
89
|
"aria-invalid": isError,
|
|
85
90
|
"aria-required": required,
|
|
@@ -87,6 +92,7 @@ function InputView({
|
|
|
87
92
|
id: name,
|
|
88
93
|
name,
|
|
89
94
|
placeholder,
|
|
95
|
+
required: Boolean(required),
|
|
90
96
|
type,
|
|
91
97
|
value: value ?? "",
|
|
92
98
|
className: bem(
|
|
@@ -97,7 +103,9 @@ function InputView({
|
|
|
97
103
|
}
|
|
98
104
|
) }) })
|
|
99
105
|
] }),
|
|
100
|
-
(isError || hasHelperText || typeof maxLength === "number") && /* @__PURE__ */ jsxs("div", { className: bem("footer"
|
|
106
|
+
(isError || hasHelperText || typeof maxLength === "number") && /* @__PURE__ */ jsxs("div", { className: bem("footer", {
|
|
107
|
+
"counter-only": !hasHelperText && typeof maxLength === "number"
|
|
108
|
+
}), children: [
|
|
101
109
|
(isError || hasHelperText) && /* @__PURE__ */ jsx(
|
|
102
110
|
"div",
|
|
103
111
|
{
|
|
@@ -116,7 +124,7 @@ function InputView({
|
|
|
116
124
|
)
|
|
117
125
|
}
|
|
118
126
|
),
|
|
119
|
-
typeof maxLength === "number" && /* @__PURE__ */ jsx("div", { className: bem("counter"), children: /* @__PURE__ */ jsxs("span", { children: [
|
|
127
|
+
!Boolean(hideCounter) && typeof maxLength === "number" && /* @__PURE__ */ jsx("div", { className: bem("counter"), children: /* @__PURE__ */ jsxs("span", { children: [
|
|
120
128
|
value != null ? String(value).length : 0,
|
|
121
129
|
" / ",
|
|
122
130
|
maxLength
|
|
@@ -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 { jsxs, jsx } from "react/jsx-runtime";
|
|
4
|
-
import { memo, useState, useRef,
|
|
4
|
+
import { memo, useState, useRef, useEffect, useCallback } from "react";
|
|
5
5
|
import { create } from "../../helpers/bem.js";
|
|
6
6
|
import styles from "./InputOTP.module.scss.js";
|
|
7
7
|
import { Input } from "../input/Input.js";
|
|
@@ -16,45 +16,123 @@ const InputOTP = memo(
|
|
|
16
16
|
onChange,
|
|
17
17
|
...props
|
|
18
18
|
}) => {
|
|
19
|
-
const [otp, setOtp] = useState(Array(length).fill(""));
|
|
19
|
+
const [otp, setOtp] = useState(() => Array(length).fill(""));
|
|
20
20
|
const inputs = useRef([]);
|
|
21
|
-
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
inputs.current = inputs.current.slice(0, length);
|
|
23
|
+
setOtp((prev) => {
|
|
24
|
+
const next = Array(length).fill("");
|
|
25
|
+
for (let i = 0; i < Math.min(prev.length, length); i++) next[i] = prev[i] ?? "";
|
|
26
|
+
return next;
|
|
27
|
+
});
|
|
28
|
+
}, [length]);
|
|
29
|
+
const completedRef = useRef(false);
|
|
30
|
+
const focusIndex = useCallback((idx) => {
|
|
22
31
|
var _a;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (onChange) onChange(newOtp.join(""));
|
|
28
|
-
if (value && index < length - 1) {
|
|
29
|
-
(_a = inputs.current[index + 1]) == null ? void 0 : _a.focus();
|
|
32
|
+
const el = inputs.current[idx];
|
|
33
|
+
if (el) {
|
|
34
|
+
el.focus();
|
|
35
|
+
(_a = el.setSelectionRange) == null ? void 0 : _a.call(el, 0, el.value.length);
|
|
30
36
|
}
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
}, []);
|
|
38
|
+
const emitChange = useCallback((next) => {
|
|
39
|
+
const joined = next.join("");
|
|
40
|
+
onChange == null ? void 0 : onChange(joined);
|
|
41
|
+
const complete = next.every((d) => d !== "");
|
|
42
|
+
if (complete && !completedRef.current) {
|
|
43
|
+
completedRef.current = true;
|
|
44
|
+
onComplete == null ? void 0 : onComplete(joined);
|
|
45
|
+
} else if (!complete && completedRef.current) {
|
|
46
|
+
completedRef.current = false;
|
|
33
47
|
}
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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);
|
|
45
60
|
}
|
|
61
|
+
emitChange(next);
|
|
62
|
+
return next;
|
|
46
63
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
}, [emitChange, focusIndex, length]);
|
|
65
|
+
const handleChange = useCallback(
|
|
66
|
+
(e, index) => {
|
|
67
|
+
setDigit(e.target.value, index);
|
|
68
|
+
},
|
|
69
|
+
[setDigit]
|
|
70
|
+
);
|
|
71
|
+
const handleKeyDown = useCallback((e, index) => {
|
|
72
|
+
const { key } = e;
|
|
73
|
+
if (key === "Backspace") {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setOtp((prev) => {
|
|
76
|
+
const next = [...prev];
|
|
77
|
+
if (next[index] !== "") {
|
|
78
|
+
next[index] = "";
|
|
79
|
+
focusIndex(index);
|
|
80
|
+
} else if (index > 0) {
|
|
81
|
+
next[index - 1] = "";
|
|
82
|
+
focusIndex(index - 1);
|
|
83
|
+
}
|
|
84
|
+
emitChange(next);
|
|
85
|
+
return next;
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (key === "ArrowLeft") {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
if (index > 0) focusIndex(index - 1);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (key === "ArrowRight") {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
if (index < length - 1) focusIndex(index + 1);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (key === "Home") {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
focusIndex(0);
|
|
102
|
+
return;
|
|
56
103
|
}
|
|
57
|
-
|
|
104
|
+
if (key === "End") {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
focusIndex(length - 1);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (key.length === 1 && !/[0-9]/.test(key)) {
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
}
|
|
112
|
+
}, [emitChange, focusIndex, length]);
|
|
113
|
+
const handleFocus = useCallback((index) => {
|
|
114
|
+
var _a;
|
|
115
|
+
const el = inputs.current[index];
|
|
116
|
+
(_a = el == null ? void 0 : el.setSelectionRange) == null ? void 0 : _a.call(el, 0, el.value.length);
|
|
117
|
+
}, []);
|
|
118
|
+
const handlePaste = useCallback((e) => {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
const digits = (e.clipboardData.getData("text") || "").replace(/\D/g, "").slice(0, length).split("");
|
|
121
|
+
if (digits.length === 0) return;
|
|
122
|
+
setOtp((prev) => {
|
|
123
|
+
const next = [...prev];
|
|
124
|
+
let writeIndex = next.findIndex((d) => d === "");
|
|
125
|
+
if (writeIndex === -1) writeIndex = 0;
|
|
126
|
+
for (let i = 0; i < digits.length && writeIndex < length; i++) {
|
|
127
|
+
next[writeIndex] = digits[i];
|
|
128
|
+
writeIndex++;
|
|
129
|
+
}
|
|
130
|
+
emitChange(next);
|
|
131
|
+
const nextEmpty = next.findIndex((d) => d === "");
|
|
132
|
+
focusIndex(nextEmpty === -1 ? length - 1 : nextEmpty);
|
|
133
|
+
return next;
|
|
134
|
+
});
|
|
135
|
+
}, [emitChange, focusIndex, length]);
|
|
58
136
|
return /* @__PURE__ */ jsxs(
|
|
59
137
|
"div",
|
|
60
138
|
{
|
|
@@ -66,27 +144,32 @@ const InputOTP = memo(
|
|
|
66
144
|
children: [
|
|
67
145
|
/* @__PURE__ */ jsx("span", { className: bem("label"), id: "otp-group-label", children: groupLabel ?? "Enter your OTP" }),
|
|
68
146
|
/* @__PURE__ */ jsx("span", { className: bem("instruction"), id: "otp-instructions", children: groupInstruction ?? "Use the arrow keys to navigate between digits." }),
|
|
69
|
-
otp.map((value, index) => /* @__PURE__ */
|
|
147
|
+
otp.map((value, index) => /* @__PURE__ */ jsx(
|
|
70
148
|
Input,
|
|
71
149
|
{
|
|
72
|
-
placeholder: "x",
|
|
73
150
|
...props,
|
|
74
|
-
key: `otp-${index}`,
|
|
75
151
|
hideCounter: true,
|
|
76
152
|
"aria-label": `${(props == null ? void 0 : props["aria-label"]) ?? "OTP digit"} ${index + 1}`,
|
|
153
|
+
autoComplete: "one-time-code",
|
|
77
154
|
className: bem("input"),
|
|
78
155
|
fieldClassName: bem("field"),
|
|
79
156
|
inputClassName: bem("input__node"),
|
|
80
157
|
inputContainerClassName: bem("input__container"),
|
|
158
|
+
inputMode: "numeric",
|
|
159
|
+
inputRef: /* @__PURE__ */ __name((el) => {
|
|
160
|
+
inputs.current[index] = el ?? null;
|
|
161
|
+
}, "inputRef"),
|
|
81
162
|
maxLength: 1,
|
|
82
163
|
name: `otp-${index}`,
|
|
164
|
+
pattern: "\\\\d*",
|
|
165
|
+
placeholder: "•",
|
|
83
166
|
type: "text",
|
|
84
167
|
value,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
168
|
+
onChange: /* @__PURE__ */ __name((e) => handleChange(e, index), "onChange"),
|
|
169
|
+
onFocus: /* @__PURE__ */ __name(() => handleFocus(index), "onFocus"),
|
|
170
|
+
onKeyDown: /* @__PURE__ */ __name((e) => handleKeyDown(e, index), "onKeyDown")
|
|
171
|
+
},
|
|
172
|
+
`otp-${index}`
|
|
90
173
|
))
|
|
91
174
|
]
|
|
92
175
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-InputOTP": "prokodo-InputOTP",
|
|
5
3
|
"prokodo-InputOTP__label": "prokodo-InputOTP__label",
|
|
@@ -7,12 +5,8 @@ const styles = {
|
|
|
7
5
|
"prokodo-InputOTP__field": "prokodo-InputOTP__field",
|
|
8
6
|
"prokodo-InputOTP__input": "prokodo-InputOTP__input",
|
|
9
7
|
"prokodo-InputOTP__input__container": "prokodo-InputOTP__input__container",
|
|
10
|
-
"prokodo-InputOTP__input__node": "prokodo-InputOTP__input__node"
|
|
11
|
-
gradientMove,
|
|
12
|
-
fadeInKeyframe
|
|
8
|
+
"prokodo-InputOTP__input__node": "prokodo-InputOTP__input__node"
|
|
13
9
|
};
|
|
14
10
|
export {
|
|
15
|
-
styles as default
|
|
16
|
-
fadeInKeyframe,
|
|
17
|
-
gradientMove
|
|
11
|
+
styles as default
|
|
18
12
|
};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Label": "prokodo-Label",
|
|
5
3
|
"prokodo-Label__highlighted": "prokodo-Label__highlighted",
|
|
6
4
|
"prokodo-Label__highlighted--error": "prokodo-Label__highlighted--error",
|
|
7
|
-
"prokodo-Label__text": "prokodo-Label__text"
|
|
8
|
-
gradientMove,
|
|
9
|
-
fadeInKeyframe
|
|
5
|
+
"prokodo-Label__text": "prokodo-Label__text"
|
|
10
6
|
};
|
|
11
7
|
export {
|
|
12
|
-
styles as default
|
|
13
|
-
fadeInKeyframe,
|
|
14
|
-
gradientMove
|
|
8
|
+
styles as default
|
|
15
9
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-Link": "prokodo-Link",
|
|
5
3
|
"prokodo-Link--has-no-background": "prokodo-Link--has-no-background",
|
|
@@ -9,12 +7,8 @@ const styles = {
|
|
|
9
7
|
"prokodo-Link--has-no-background--success": "prokodo-Link--has-no-background--success",
|
|
10
8
|
"prokodo-Link--has-no-background--warning": "prokodo-Link--has-no-background--warning",
|
|
11
9
|
"prokodo-Link--has-no-background--error": "prokodo-Link--has-no-background--error",
|
|
12
|
-
"prokodo-Link--has-no-background--white": "prokodo-Link--has-no-background--white"
|
|
13
|
-
gradientMove,
|
|
14
|
-
fadeInKeyframe
|
|
10
|
+
"prokodo-Link--has-no-background--white": "prokodo-Link--has-no-background--white"
|
|
15
11
|
};
|
|
16
12
|
export {
|
|
17
|
-
styles as default
|
|
18
|
-
fadeInKeyframe,
|
|
19
|
-
gradientMove
|
|
13
|
+
styles as default
|
|
20
14
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const gradientMove = "gradientMove";
|
|
2
|
-
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
1
|
const styles = {
|
|
4
2
|
"prokodo-List": "prokodo-List",
|
|
5
3
|
"prokodo-List__item": "prokodo-List__item",
|
|
@@ -26,12 +24,8 @@ const styles = {
|
|
|
26
24
|
"prokodo-List__item--is-clickable--warning": "prokodo-List__item--is-clickable--warning",
|
|
27
25
|
"prokodo-List__item--is-clickable--error": "prokodo-List__item--is-clickable--error",
|
|
28
26
|
"prokodo-List__item--is-clickable--white": "prokodo-List__item--is-clickable--white",
|
|
29
|
-
"prokodo-List__item--card": "prokodo-List__item--card"
|
|
30
|
-
gradientMove,
|
|
31
|
-
fadeInKeyframe
|
|
27
|
+
"prokodo-List__item--card": "prokodo-List__item--card"
|
|
32
28
|
};
|
|
33
29
|
export {
|
|
34
|
-
styles as default
|
|
35
|
-
fadeInKeyframe,
|
|
36
|
-
gradientMove
|
|
30
|
+
styles as default
|
|
37
31
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useState, useEffect, useMemo } from "react";
|
|
6
|
+
import { OverlayView, SpinnerView } from "./Loading.view.js";
|
|
7
|
+
const getAutoScheme = /* @__PURE__ */ __name(() => {
|
|
8
|
+
const html = typeof document !== "undefined" ? document.documentElement : null;
|
|
9
|
+
const attr = html == null ? void 0 : html.getAttribute("data-theme");
|
|
10
|
+
if (attr === "dark" || attr === "light") return attr;
|
|
11
|
+
if (typeof window !== "undefined") {
|
|
12
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
13
|
+
}
|
|
14
|
+
return "light";
|
|
15
|
+
}, "getAutoScheme");
|
|
16
|
+
const useReducedMotion = /* @__PURE__ */ __name((explicit) => {
|
|
17
|
+
const [prefersReduced, setPrefersReduced] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
21
|
+
const handler = /* @__PURE__ */ __name(() => setPrefersReduced(mql.matches), "handler");
|
|
22
|
+
handler();
|
|
23
|
+
(_a = mql.addEventListener) == null ? void 0 : _a.call(mql, "change", handler);
|
|
24
|
+
return () => {
|
|
25
|
+
var _a2;
|
|
26
|
+
return (_a2 = mql.removeEventListener) == null ? void 0 : _a2.call(mql, "change", handler);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
return useMemo(() => explicit ?? prefersReduced, [explicit, prefersReduced]);
|
|
30
|
+
}, "useReducedMotion");
|
|
31
|
+
const OverlayClient = /* @__PURE__ */ __name(({
|
|
32
|
+
backdrop = "auto",
|
|
33
|
+
reducedMotion,
|
|
34
|
+
...rest
|
|
35
|
+
}) => {
|
|
36
|
+
const [scheme, setScheme] = useState(getAutoScheme());
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (backdrop !== "auto") return;
|
|
40
|
+
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
41
|
+
const onChange = /* @__PURE__ */ __name((e) => setScheme(e.matches ? "dark" : "light"), "onChange");
|
|
42
|
+
(_a = mql.addEventListener) == null ? void 0 : _a.call(mql, "change", onChange);
|
|
43
|
+
return () => {
|
|
44
|
+
var _a2;
|
|
45
|
+
return (_a2 = mql.removeEventListener) == null ? void 0 : _a2.call(mql, "change", onChange);
|
|
46
|
+
};
|
|
47
|
+
}, [backdrop]);
|
|
48
|
+
const resolved = backdrop === "auto" ? scheme : backdrop;
|
|
49
|
+
return /* @__PURE__ */ jsx(OverlayView, { ...rest, reducedMotion, resolvedBackdrop: resolved });
|
|
50
|
+
}, "OverlayClient");
|
|
51
|
+
const SpinnerClient = /* @__PURE__ */ __name(({
|
|
52
|
+
reducedMotion,
|
|
53
|
+
...rest
|
|
54
|
+
}) => /* @__PURE__ */ jsx(SpinnerView, { ...rest, reducedMotion }), "SpinnerClient");
|
|
55
|
+
const LoadingClient = /* @__PURE__ */ __name((props) => {
|
|
56
|
+
const reducedMotion = useReducedMotion(
|
|
57
|
+
"reducedMotion" in props ? props.reducedMotion : void 0
|
|
58
|
+
);
|
|
59
|
+
if (props.variant === "overlay") {
|
|
60
|
+
const { variant: _v2, ...rest2 } = props;
|
|
61
|
+
return /* @__PURE__ */ jsx(OverlayClient, { ...rest2, reducedMotion });
|
|
62
|
+
}
|
|
63
|
+
const { variant: _v, ...rest } = props;
|
|
64
|
+
return /* @__PURE__ */ jsx(SpinnerClient, { ...rest, reducedMotion });
|
|
65
|
+
}, "LoadingClient");
|
|
66
|
+
export {
|
|
67
|
+
LoadingClient as default
|
|
68
|
+
};
|
|
@@ -1,59 +1,13 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
className: bem(void 0, void 0, className),
|
|
11
|
-
style: {
|
|
12
|
-
display: "flex",
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
justifyContent: "center",
|
|
15
|
-
gap: "16px"
|
|
16
|
-
},
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsx("svg", { height: 0, style: { position: "absolute" }, width: 0, children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
19
|
-
"linearGradient",
|
|
20
|
-
{
|
|
21
|
-
className: bem("gradient"),
|
|
22
|
-
id: "loading-gradient",
|
|
23
|
-
x1: "0%",
|
|
24
|
-
x2: "0%",
|
|
25
|
-
y1: "0%",
|
|
26
|
-
y2: "100%",
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ jsx("stop", { offset: "0%" }),
|
|
29
|
-
/* @__PURE__ */ jsx("stop", { offset: "50%" }),
|
|
30
|
-
/* @__PURE__ */ jsx("stop", { offset: "100%" })
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
) }) }),
|
|
34
|
-
/* @__PURE__ */ jsx(
|
|
35
|
-
"div",
|
|
36
|
-
{
|
|
37
|
-
className: bem("animation", {
|
|
38
|
-
[`size-${size}`]: true
|
|
39
|
-
}),
|
|
40
|
-
style: {
|
|
41
|
-
borderRadius: "50%",
|
|
42
|
-
border: `4px solid transparent`,
|
|
43
|
-
// Transparent border for empty space
|
|
44
|
-
borderTop: `4px solid`,
|
|
45
|
-
// Apply color for top border only
|
|
46
|
-
animation: `${styles.spin} 1s linear infinite`,
|
|
47
|
-
// Define animation for spinning
|
|
48
|
-
background: `conic-gradient(from 0deg at 50% 50%, url(#loading-gradient) 0deg 360deg)`
|
|
49
|
-
// Create a conic gradient
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
), "Loading");
|
|
56
|
-
Loading.displayName = "Loading";
|
|
3
|
+
import { createIsland } from "../../helpers/createIsland.js";
|
|
4
|
+
import LoadingServer from "./Loading.server.js";
|
|
5
|
+
const Loading = createIsland({
|
|
6
|
+
name: "Loading",
|
|
7
|
+
Server: LoadingServer,
|
|
8
|
+
loadLazy: /* @__PURE__ */ __name(() => import("./Loading.lazy.js"), "loadLazy")
|
|
9
|
+
});
|
|
57
10
|
export {
|
|
58
|
-
Loading
|
|
11
|
+
Loading,
|
|
12
|
+
Loading as default
|
|
59
13
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
import { createLazyWrapper } from "../../helpers/createLazyWrapper.js";
|
|
5
|
+
import LoadingClient from "./Loading.client.js";
|
|
6
|
+
import LoadingServer from "./Loading.server.js";
|
|
7
|
+
const Loading_lazy = createLazyWrapper({
|
|
8
|
+
name: "Loading",
|
|
9
|
+
Client: LoadingClient,
|
|
10
|
+
Server: LoadingServer,
|
|
11
|
+
isInteractive: /* @__PURE__ */ __name(() => true, "isInteractive")
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
Loading_lazy as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { OverlayView, SpinnerView } from "./Loading.view.js";
|
|
5
|
+
const LoadingServer = /* @__PURE__ */ __name((props) => {
|
|
6
|
+
if (props.variant === "overlay") {
|
|
7
|
+
const { backdrop = "auto", ...rest2 } = props;
|
|
8
|
+
const resolved = backdrop === "dark" ? "dark" : "light";
|
|
9
|
+
return /* @__PURE__ */ jsx(OverlayView, { ...rest2, reducedMotion: props.reducedMotion, resolvedBackdrop: resolved });
|
|
10
|
+
}
|
|
11
|
+
const { variant: _v, ...rest } = props;
|
|
12
|
+
return /* @__PURE__ */ jsx(SpinnerView, { ...rest, reducedMotion: props.reducedMotion });
|
|
13
|
+
}, "LoadingServer");
|
|
14
|
+
export {
|
|
15
|
+
LoadingServer as default
|
|
16
|
+
};
|