@stokr/components-library 3.0.59 → 3.0.61
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.
|
@@ -99,6 +99,8 @@ CountrySelect.propTypes = {
|
|
|
99
99
|
/** string for single mode, string[] for multi mode */
|
|
100
100
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
101
101
|
multiple: PropTypes.bool,
|
|
102
|
+
/** Multi mode: values that cannot be removed (e.g. countries already saved server-side). */
|
|
103
|
+
lockedValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
102
104
|
placeholder: PropTypes.string,
|
|
103
105
|
selectedLabel: PropTypes.string,
|
|
104
106
|
error: PropTypes.bool,
|
|
@@ -2,6 +2,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { useRef, useState, useCallback, useEffect } from "react";
|
|
4
4
|
import { useInView } from "react-intersection-observer";
|
|
5
|
+
const ViewportWrapper = styled.div`
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
`;
|
|
5
9
|
const VideoContainer = styled.div`
|
|
6
10
|
position: relative;
|
|
7
11
|
width: 100%;
|
|
@@ -21,7 +25,7 @@ const CLOUDINARY_VERSION = "v1745923531";
|
|
|
21
25
|
const CLOUDINARY_PUBLIC_ID = "Static/Hero_section_video_kuatj1";
|
|
22
26
|
const VIDEO_SRC_DESKTOP = `${CLOUDINARY_BASE}/f_auto,q_auto:good,vc_auto,w_1920,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.mp4`;
|
|
23
27
|
const VIDEO_SRC_MOBILE = `${CLOUDINARY_BASE}/f_auto,q_auto:good,vc_auto,w_1280,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.mp4`;
|
|
24
|
-
const VIDEO_POSTER = `${CLOUDINARY_BASE}/
|
|
28
|
+
const VIDEO_POSTER = `${CLOUDINARY_BASE}/so_auto,f_jpg,q_auto:good,w_1920,c_limit/${CLOUDINARY_VERSION}/${CLOUDINARY_PUBLIC_ID}.jpg`;
|
|
25
29
|
const shouldLoadVideo = () => {
|
|
26
30
|
if (typeof navigator === "undefined") return true;
|
|
27
31
|
const conn = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
|
|
@@ -105,7 +109,7 @@ const HeroVideoBlock = () => {
|
|
|
105
109
|
document.removeEventListener("visibilitychange", handleDocVisibilityChange);
|
|
106
110
|
};
|
|
107
111
|
}, [playVideo]);
|
|
108
|
-
return /* @__PURE__ */ jsx(
|
|
112
|
+
return /* @__PURE__ */ jsx(ViewportWrapper, { ref: windowViewportRef, children: /* @__PURE__ */ jsx(VideoContainer, { children: /* @__PURE__ */ jsx(
|
|
109
113
|
VideoBackground,
|
|
110
114
|
{
|
|
111
115
|
ref: videoRef,
|
|
@@ -95,6 +95,7 @@ const Select = (props) => {
|
|
|
95
95
|
search = false,
|
|
96
96
|
creatable = false,
|
|
97
97
|
multiple = false,
|
|
98
|
+
lockedValues = [],
|
|
98
99
|
menuHeight,
|
|
99
100
|
selectedLabel = "Selected",
|
|
100
101
|
floatingLabel = true,
|
|
@@ -117,12 +118,16 @@ const Select = (props) => {
|
|
|
117
118
|
const handleChange = (selected) => {
|
|
118
119
|
if (multiple) {
|
|
119
120
|
const arr = Array.isArray(selected) ? selected : [];
|
|
120
|
-
|
|
121
|
+
let next = arr.map((o) => o.value);
|
|
122
|
+
const locked = (Array.isArray(value) ? value : []).filter((v) => lockedValues.includes(v));
|
|
123
|
+
for (const v of locked) if (!next.includes(v)) next = [...next, v];
|
|
124
|
+
onChange?.({ name, value: next });
|
|
121
125
|
return;
|
|
122
126
|
}
|
|
123
127
|
onChange?.({ name, value: selected?.value ?? "" });
|
|
124
128
|
};
|
|
125
129
|
const removeValue = (val) => {
|
|
130
|
+
if (lockedValues.includes(val)) return;
|
|
126
131
|
const arr = Array.isArray(value) ? value.filter((v) => v !== val) : [];
|
|
127
132
|
onChange?.({ name, value: arr });
|
|
128
133
|
};
|
|
@@ -203,19 +208,22 @@ const Select = (props) => {
|
|
|
203
208
|
currentValue.length,
|
|
204
209
|
")"
|
|
205
210
|
] }),
|
|
206
|
-
/* @__PURE__ */ jsx(SelectedChipsList, { children: currentValue.map((opt) =>
|
|
207
|
-
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
/* @__PURE__ */ jsx(SelectedChipsList, { children: currentValue.map((opt) => {
|
|
212
|
+
const isLocked = lockedValues.includes(opt.value);
|
|
213
|
+
return /* @__PURE__ */ jsxs(SelectedChip, { children: [
|
|
214
|
+
renderIcon(opt.icon),
|
|
215
|
+
/* @__PURE__ */ jsx(SelectedChipLabel, { children: opt.label }),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
SelectedChipRemove,
|
|
218
|
+
{
|
|
219
|
+
onClick: () => removeValue(opt.value),
|
|
220
|
+
"aria-label": `Remove ${typeof opt.label === "string" ? opt.label : opt.value}`,
|
|
221
|
+
disabled: disabled || isLocked,
|
|
222
|
+
children: "✕"
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] }, opt.key ?? opt.value);
|
|
226
|
+
}) })
|
|
219
227
|
] })
|
|
220
228
|
] });
|
|
221
229
|
};
|
|
@@ -246,6 +254,8 @@ Select.propTypes = {
|
|
|
246
254
|
creatable: PropTypes.bool,
|
|
247
255
|
/** Multi-select: checkbox options + chips list rendered below the field. */
|
|
248
256
|
multiple: PropTypes.bool,
|
|
257
|
+
/** Multi mode: values that cannot be removed (chip ✕ disabled, can't be deselected). */
|
|
258
|
+
lockedValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
249
259
|
menuHeight: PropTypes.number,
|
|
250
260
|
/** Heading shown above the chips list in multi mode (default: "Selected"). */
|
|
251
261
|
selectedLabel: PropTypes.string,
|
|
@@ -70,7 +70,7 @@ const CheckboxProvider = ({ children }) => {
|
|
|
70
70
|
[checkboxes, loadingStates, errorStates, fetchCheckboxes]
|
|
71
71
|
);
|
|
72
72
|
const checkCheckbox = useCallback(async (checkboxId, data = {}) => {
|
|
73
|
-
const { userId, investmentId
|
|
73
|
+
const { userId, investmentId, privateInvestorId } = data;
|
|
74
74
|
if (!userId) {
|
|
75
75
|
throw new Error("userId is required to check checkbox");
|
|
76
76
|
}
|
|
@@ -81,8 +81,8 @@ const CheckboxProvider = ({ children }) => {
|
|
|
81
81
|
const response = await fetchData("compliance/check-checkbox", {
|
|
82
82
|
userId,
|
|
83
83
|
checkboxId,
|
|
84
|
-
investmentId,
|
|
85
|
-
privateInvestorId
|
|
84
|
+
...investmentId != null ? { investmentId } : {},
|
|
85
|
+
...privateInvestorId != null ? { privateInvestorId } : {}
|
|
86
86
|
});
|
|
87
87
|
return response;
|
|
88
88
|
} catch (error) {
|