@itiseeron/component-lib 1.0.0
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/LICENSE +21 -0
- package/README.md +278 -0
- package/dist/index.d.mts +744 -0
- package/dist/index.d.ts +744 -0
- package/dist/index.js +1259 -0
- package/dist/index.mjs +1208 -0
- package/package.json +62 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1208 @@
|
|
|
1
|
+
// src/components/HelloWorld/HelloWorld.jsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
var HelloWorld = () => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, "HelloWorld");
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/components/Button/ThinButton.tsx
|
|
8
|
+
import React2 from "react";
|
|
9
|
+
import PropTypes from "prop-types";
|
|
10
|
+
var container = {
|
|
11
|
+
//flex: 1,
|
|
12
|
+
//alignSelf: 'center',
|
|
13
|
+
justifyContent: "center"
|
|
14
|
+
//paddingLeft: '10px',
|
|
15
|
+
//paddingRight: '10px',
|
|
16
|
+
//minHeight: '50px',
|
|
17
|
+
};
|
|
18
|
+
var button = {
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
alignContent: "center",
|
|
21
|
+
backgroundColor: "transparent",
|
|
22
|
+
borderStyle: "solid",
|
|
23
|
+
padding: "10px",
|
|
24
|
+
maxWidth: "300px",
|
|
25
|
+
minWidth: "200px",
|
|
26
|
+
borderRadius: "8px",
|
|
27
|
+
borderWidth: "2px",
|
|
28
|
+
borderColor: "#B3C0C2",
|
|
29
|
+
transition: "opacity 300ms ease"
|
|
30
|
+
};
|
|
31
|
+
var buttonText = {
|
|
32
|
+
color: "#B3C0C2",
|
|
33
|
+
fontSize: "16px",
|
|
34
|
+
alignSelf: "center",
|
|
35
|
+
font: ""
|
|
36
|
+
};
|
|
37
|
+
function ThinButton({
|
|
38
|
+
testID = "thin-button",
|
|
39
|
+
text = "Click Me",
|
|
40
|
+
containerStyle = container,
|
|
41
|
+
buttonStyle = button,
|
|
42
|
+
buttonTextStyle = buttonText,
|
|
43
|
+
onclick = () => {
|
|
44
|
+
},
|
|
45
|
+
children
|
|
46
|
+
}) {
|
|
47
|
+
const [touched, touchedSet] = React2.useState(false);
|
|
48
|
+
return /* @__PURE__ */ React2.createElement(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
id: testID,
|
|
52
|
+
style: { ...buttonStyle, opacity: touched ? 0.5 : 1, transition: "opacity 300ms ease" },
|
|
53
|
+
onClick: onclick,
|
|
54
|
+
onMouseDown: () => touchedSet(true),
|
|
55
|
+
onMouseUp: () => touchedSet(false)
|
|
56
|
+
},
|
|
57
|
+
children == void 0 || children == null ? /* @__PURE__ */ React2.createElement("span", { style: buttonTextStyle }, text) : children
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
ThinButton.propTypes = {
|
|
61
|
+
testID: PropTypes.string,
|
|
62
|
+
key: PropTypes.any,
|
|
63
|
+
text: PropTypes.string,
|
|
64
|
+
children: PropTypes.object,
|
|
65
|
+
onclick: PropTypes.func,
|
|
66
|
+
containerStyle: PropTypes.object,
|
|
67
|
+
buttonStyle: PropTypes.object,
|
|
68
|
+
buttonTextStyle: PropTypes.object
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/components/Card/Card.tsx
|
|
72
|
+
import React3 from "react";
|
|
73
|
+
import PropTypes2 from "prop-types";
|
|
74
|
+
var container2 = {
|
|
75
|
+
backgroundColor: "white",
|
|
76
|
+
marginLeft: 5,
|
|
77
|
+
marginRight: 5,
|
|
78
|
+
borderRadius: 7,
|
|
79
|
+
minHeight: "250px",
|
|
80
|
+
minWidth: "250px",
|
|
81
|
+
boxShadow: "1px 1px 5px 2px #AFB3B5",
|
|
82
|
+
flex: 1
|
|
83
|
+
};
|
|
84
|
+
var title = {
|
|
85
|
+
color: "#00ADE9",
|
|
86
|
+
fontFamily: "nunito-regular",
|
|
87
|
+
fontSize: 25,
|
|
88
|
+
alignSelf: "center"
|
|
89
|
+
};
|
|
90
|
+
var subtitle = {
|
|
91
|
+
color: "#00ADE9",
|
|
92
|
+
fontFamily: "nunito-regular",
|
|
93
|
+
fontSize: 18,
|
|
94
|
+
alignSelf: "center"
|
|
95
|
+
};
|
|
96
|
+
var titleBoxContainer = {
|
|
97
|
+
padding: 15,
|
|
98
|
+
borderBottom: "1px solid #AFB3B5"
|
|
99
|
+
};
|
|
100
|
+
var wrapper = {
|
|
101
|
+
paddingTop: "2.5%",
|
|
102
|
+
paddingBottom: "2.5%",
|
|
103
|
+
paddingLeft: "1%",
|
|
104
|
+
paddingRight: "1%"
|
|
105
|
+
};
|
|
106
|
+
var closeButton = {
|
|
107
|
+
flex: 1,
|
|
108
|
+
fontSize: 15,
|
|
109
|
+
color: "#AFB3B5"
|
|
110
|
+
};
|
|
111
|
+
var closeButtonContainer = {
|
|
112
|
+
right: 25,
|
|
113
|
+
top: 25,
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
paddingBottom: 2.5,
|
|
116
|
+
marginTop: ".5%",
|
|
117
|
+
marginRight: "1.5%",
|
|
118
|
+
minHeight: 50,
|
|
119
|
+
display: "flex",
|
|
120
|
+
position: "absolute",
|
|
121
|
+
padding: 0,
|
|
122
|
+
border: "none",
|
|
123
|
+
background: "none"
|
|
124
|
+
};
|
|
125
|
+
function Card({
|
|
126
|
+
containerStyle = container2,
|
|
127
|
+
wrapperStyle = wrapper,
|
|
128
|
+
titleText: titleText2,
|
|
129
|
+
titleStyle = title,
|
|
130
|
+
subtitleText,
|
|
131
|
+
subtitleStyle = subtitle,
|
|
132
|
+
titleContainerStyle = titleBoxContainer,
|
|
133
|
+
closeButtonStyle = closeButton,
|
|
134
|
+
showCloseButton = false,
|
|
135
|
+
onClickCloseButton: closeButtonPressedCallBack = () => {
|
|
136
|
+
},
|
|
137
|
+
children
|
|
138
|
+
}) {
|
|
139
|
+
const [touched, touchedSet] = React3.useState(false);
|
|
140
|
+
function renderCloseButton() {
|
|
141
|
+
if (showCloseButton) {
|
|
142
|
+
return /* @__PURE__ */ React3.createElement(
|
|
143
|
+
"button",
|
|
144
|
+
{
|
|
145
|
+
id: "click-card-close-button",
|
|
146
|
+
style: { ...closeButtonContainer, opacity: touched ? 0.5 : 1, transition: "opacity 300ms ease" },
|
|
147
|
+
onClick: closeButtonPressedCallBack,
|
|
148
|
+
onMouseDown: () => touchedSet(true),
|
|
149
|
+
onMouseUp: () => touchedSet(false)
|
|
150
|
+
},
|
|
151
|
+
/* @__PURE__ */ React3.createElement("span", { style: closeButtonStyle }, "X")
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null);
|
|
155
|
+
}
|
|
156
|
+
function renderSubtitle() {
|
|
157
|
+
if (subtitleText == null || subtitleText == void 0) {
|
|
158
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null);
|
|
159
|
+
}
|
|
160
|
+
return /* @__PURE__ */ React3.createElement("span", { style: subtitleStyle }, subtitleText);
|
|
161
|
+
}
|
|
162
|
+
function renderTitle() {
|
|
163
|
+
if (titleText2 == null || titleText2 == void 0) return /* @__PURE__ */ React3.createElement(React3.Fragment, null);
|
|
164
|
+
return /* @__PURE__ */ React3.createElement("div", { style: titleContainerStyle }, /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement("span", { style: titleStyle }, titleText2)), /* @__PURE__ */ React3.createElement("div", null, renderSubtitle()));
|
|
165
|
+
}
|
|
166
|
+
return /* @__PURE__ */ React3.createElement("div", { style: containerStyle }, renderCloseButton(), renderTitle(), /* @__PURE__ */ React3.createElement("div", { style: wrapperStyle }, children));
|
|
167
|
+
}
|
|
168
|
+
Card.propTypes = {
|
|
169
|
+
key: PropTypes2.string,
|
|
170
|
+
children: PropTypes2.any,
|
|
171
|
+
containerStyle: PropTypes2.object,
|
|
172
|
+
wrapperStyle: PropTypes2.object,
|
|
173
|
+
title: PropTypes2.string,
|
|
174
|
+
titleStyle: PropTypes2.object,
|
|
175
|
+
subtitle: PropTypes2.string,
|
|
176
|
+
subtitleStyle: PropTypes2.string,
|
|
177
|
+
titleContainerStyle: PropTypes2.object,
|
|
178
|
+
closeButtonStyle: PropTypes2.object,
|
|
179
|
+
closeButtonContainerStyle: PropTypes2.object,
|
|
180
|
+
showCloseButton: PropTypes2.object,
|
|
181
|
+
closeButtonPressedCallBack: PropTypes2.func
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/components/InputForm/InputForm.tsx
|
|
185
|
+
import React4 from "react";
|
|
186
|
+
import PropTypes3 from "prop-types";
|
|
187
|
+
var container3 = {
|
|
188
|
+
flex: 1,
|
|
189
|
+
marginBottom: "3.5%"
|
|
190
|
+
};
|
|
191
|
+
var formTitle = {
|
|
192
|
+
flex: 1,
|
|
193
|
+
fontFamily: "nunito_regular",
|
|
194
|
+
color: "#AFB3B5",
|
|
195
|
+
fontSize: "15px"
|
|
196
|
+
};
|
|
197
|
+
var formTitleWrapper = {
|
|
198
|
+
marginTop: 5,
|
|
199
|
+
marginBottom: 5,
|
|
200
|
+
flex: 1,
|
|
201
|
+
paddingLeft: 13,
|
|
202
|
+
paddingRight: 10
|
|
203
|
+
};
|
|
204
|
+
var inputWrapper = {
|
|
205
|
+
paddingLeft: 10,
|
|
206
|
+
paddingRight: 10,
|
|
207
|
+
flex: 1
|
|
208
|
+
};
|
|
209
|
+
var inputForm = {
|
|
210
|
+
alignItems: "center",
|
|
211
|
+
alignSelf: "center",
|
|
212
|
+
flex: 1,
|
|
213
|
+
minWidth: 40,
|
|
214
|
+
height: "40px",
|
|
215
|
+
border: "1px solid #AFB3B5",
|
|
216
|
+
borderRadius: 4,
|
|
217
|
+
paddingRight: 10,
|
|
218
|
+
paddingLeft: 10
|
|
219
|
+
};
|
|
220
|
+
var errorText = {
|
|
221
|
+
fontFamily: "nunito_regular",
|
|
222
|
+
fontSize: 14,
|
|
223
|
+
color: "#C70000"
|
|
224
|
+
};
|
|
225
|
+
function InputForm({
|
|
226
|
+
testID = "input-form",
|
|
227
|
+
name,
|
|
228
|
+
onInput = () => {
|
|
229
|
+
},
|
|
230
|
+
defaultValue = "",
|
|
231
|
+
secureTextEntry = false,
|
|
232
|
+
formTitleStyle = formTitle,
|
|
233
|
+
containerStyle = container3,
|
|
234
|
+
inputStyle = inputForm,
|
|
235
|
+
errorStyle = errorText,
|
|
236
|
+
placeholder,
|
|
237
|
+
value: controlledValue,
|
|
238
|
+
errorMessage,
|
|
239
|
+
numberOfLines = 1,
|
|
240
|
+
multiline = false,
|
|
241
|
+
trim = false,
|
|
242
|
+
maxLength = 200
|
|
243
|
+
}) {
|
|
244
|
+
const [internalValue, setInternalValue] = React4.useState(defaultValue);
|
|
245
|
+
const isControlled = controlledValue != null;
|
|
246
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
247
|
+
function onChange(rawValue) {
|
|
248
|
+
if (!isControlled) setInternalValue(rawValue);
|
|
249
|
+
onInput(trim ? rawValue.trim() : rawValue);
|
|
250
|
+
}
|
|
251
|
+
function renderLabel() {
|
|
252
|
+
if (name == null) return /* @__PURE__ */ React4.createElement(React4.Fragment, null);
|
|
253
|
+
return /* @__PURE__ */ React4.createElement("div", { style: formTitleWrapper }, /* @__PURE__ */ React4.createElement("label", { style: formTitleStyle }, name));
|
|
254
|
+
}
|
|
255
|
+
function renderError() {
|
|
256
|
+
if (errorMessage == null) return /* @__PURE__ */ React4.createElement(React4.Fragment, null);
|
|
257
|
+
return /* @__PURE__ */ React4.createElement("span", { style: errorStyle }, errorMessage);
|
|
258
|
+
}
|
|
259
|
+
return /* @__PURE__ */ React4.createElement("div", { id: testID, style: containerStyle }, renderLabel(), /* @__PURE__ */ React4.createElement("div", { style: inputWrapper }, multiline ? /* @__PURE__ */ React4.createElement(
|
|
260
|
+
"textarea",
|
|
261
|
+
{
|
|
262
|
+
value,
|
|
263
|
+
placeholder,
|
|
264
|
+
style: inputStyle,
|
|
265
|
+
rows: numberOfLines,
|
|
266
|
+
maxLength,
|
|
267
|
+
onChange: (input) => onChange(input.currentTarget.value)
|
|
268
|
+
}
|
|
269
|
+
) : /* @__PURE__ */ React4.createElement(
|
|
270
|
+
"input",
|
|
271
|
+
{
|
|
272
|
+
value,
|
|
273
|
+
type: secureTextEntry ? "password" : "text",
|
|
274
|
+
placeholder,
|
|
275
|
+
style: inputStyle,
|
|
276
|
+
maxLength,
|
|
277
|
+
onChange: (input) => onChange(input.currentTarget.value)
|
|
278
|
+
}
|
|
279
|
+
)), renderError());
|
|
280
|
+
}
|
|
281
|
+
InputForm.propTypes = {
|
|
282
|
+
key: PropTypes3.any,
|
|
283
|
+
name: PropTypes3.string,
|
|
284
|
+
testID: PropTypes3.string,
|
|
285
|
+
onInput: PropTypes3.func,
|
|
286
|
+
defaultValue: PropTypes3.string,
|
|
287
|
+
secureTextEntry: PropTypes3.bool,
|
|
288
|
+
formTitleStyle: PropTypes3.object,
|
|
289
|
+
containerStyle: PropTypes3.object,
|
|
290
|
+
inputStyle: PropTypes3.object,
|
|
291
|
+
errorStyle: PropTypes3.object,
|
|
292
|
+
placeholder: PropTypes3.string,
|
|
293
|
+
value: PropTypes3.string,
|
|
294
|
+
errorMessage: PropTypes3.string,
|
|
295
|
+
numberOfLines: PropTypes3.number,
|
|
296
|
+
multiline: PropTypes3.bool,
|
|
297
|
+
trim: PropTypes3.bool,
|
|
298
|
+
maxLength: PropTypes3.number
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// src/components/NavigationBar/NavigationBar.tsx
|
|
302
|
+
import React6 from "react";
|
|
303
|
+
import PropTypes5 from "prop-types";
|
|
304
|
+
|
|
305
|
+
// src/components/NavigationBar/NavigationBarView.tsx
|
|
306
|
+
import React5 from "react";
|
|
307
|
+
import PropTypes4 from "prop-types";
|
|
308
|
+
var container4 = {
|
|
309
|
+
display: "flex",
|
|
310
|
+
flexDirection: "row",
|
|
311
|
+
alignItems: "center",
|
|
312
|
+
backgroundColor: "white",
|
|
313
|
+
borderRadius: 7,
|
|
314
|
+
boxShadow: "1px 1px 5px 2px #AFB3B5",
|
|
315
|
+
padding: "10px"
|
|
316
|
+
};
|
|
317
|
+
var item = {
|
|
318
|
+
display: "flex",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
backgroundColor: "transparent",
|
|
321
|
+
borderStyle: "solid",
|
|
322
|
+
borderWidth: "2px",
|
|
323
|
+
borderColor: "transparent",
|
|
324
|
+
borderRadius: "8px",
|
|
325
|
+
padding: "10px 15px",
|
|
326
|
+
cursor: "pointer",
|
|
327
|
+
transition: "opacity 300ms ease"
|
|
328
|
+
};
|
|
329
|
+
var activeItem = {
|
|
330
|
+
borderColor: "#00ADE9"
|
|
331
|
+
};
|
|
332
|
+
var itemText = {
|
|
333
|
+
color: "#B3C0C2",
|
|
334
|
+
fontFamily: "nunito-regular",
|
|
335
|
+
fontSize: "16px"
|
|
336
|
+
};
|
|
337
|
+
var activeItemText = {
|
|
338
|
+
color: "#00ADE9"
|
|
339
|
+
};
|
|
340
|
+
function NavigationBarView({
|
|
341
|
+
testID = "navigation-bar",
|
|
342
|
+
items,
|
|
343
|
+
selectedKey,
|
|
344
|
+
onItemSelect,
|
|
345
|
+
containerStyle = container4,
|
|
346
|
+
itemStyle = item,
|
|
347
|
+
activeItemStyle = activeItem,
|
|
348
|
+
itemTextStyle = itemText,
|
|
349
|
+
activeItemTextStyle = activeItemText
|
|
350
|
+
}) {
|
|
351
|
+
function renderItem(navItem) {
|
|
352
|
+
const active = navItem.key === selectedKey;
|
|
353
|
+
return /* @__PURE__ */ React5.createElement(
|
|
354
|
+
"button",
|
|
355
|
+
{
|
|
356
|
+
id: `${testID}-item-${navItem.key}`,
|
|
357
|
+
key: navItem.key,
|
|
358
|
+
disabled: navItem.disabled,
|
|
359
|
+
style: { ...itemStyle, ...active ? activeItemStyle : {}, opacity: navItem.disabled ? 0.4 : 1 },
|
|
360
|
+
onClick: () => onItemSelect(navItem)
|
|
361
|
+
},
|
|
362
|
+
navItem.icon,
|
|
363
|
+
/* @__PURE__ */ React5.createElement("span", { style: { ...itemTextStyle, ...active ? activeItemTextStyle : {} } }, navItem.label)
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
return /* @__PURE__ */ React5.createElement("nav", { id: testID, style: containerStyle }, items.map(renderItem));
|
|
367
|
+
}
|
|
368
|
+
NavigationBarView.propTypes = {
|
|
369
|
+
testID: PropTypes4.string,
|
|
370
|
+
items: PropTypes4.arrayOf(PropTypes4.shape({
|
|
371
|
+
key: PropTypes4.string.isRequired,
|
|
372
|
+
label: PropTypes4.string.isRequired,
|
|
373
|
+
icon: PropTypes4.node,
|
|
374
|
+
disabled: PropTypes4.bool
|
|
375
|
+
})).isRequired,
|
|
376
|
+
selectedKey: PropTypes4.string,
|
|
377
|
+
onItemSelect: PropTypes4.func.isRequired,
|
|
378
|
+
containerStyle: PropTypes4.object,
|
|
379
|
+
itemStyle: PropTypes4.object,
|
|
380
|
+
activeItemStyle: PropTypes4.object,
|
|
381
|
+
itemTextStyle: PropTypes4.object,
|
|
382
|
+
activeItemTextStyle: PropTypes4.object
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/components/NavigationBar/NavigationBar.tsx
|
|
386
|
+
function NavigationBar({
|
|
387
|
+
testID = "navigation-bar",
|
|
388
|
+
items,
|
|
389
|
+
defaultSelectedKey,
|
|
390
|
+
selectedKey: controlledSelectedKey,
|
|
391
|
+
onSelect: onSelectCallback = () => {
|
|
392
|
+
},
|
|
393
|
+
render = (viewProps) => /* @__PURE__ */ React6.createElement(NavigationBarView, { ...viewProps }),
|
|
394
|
+
containerStyle,
|
|
395
|
+
itemStyle,
|
|
396
|
+
activeItemStyle,
|
|
397
|
+
itemTextStyle,
|
|
398
|
+
activeItemTextStyle
|
|
399
|
+
}) {
|
|
400
|
+
var _a;
|
|
401
|
+
const [internalSelectedKey, setInternalSelectedKey] = React6.useState(defaultSelectedKey != null ? defaultSelectedKey : (_a = items[0]) == null ? void 0 : _a.key);
|
|
402
|
+
const isControlled = controlledSelectedKey != null;
|
|
403
|
+
const selectedKey = isControlled ? controlledSelectedKey : internalSelectedKey;
|
|
404
|
+
function selectItem(navItem) {
|
|
405
|
+
if (navItem.disabled || navItem.key === selectedKey) return;
|
|
406
|
+
if (!isControlled) setInternalSelectedKey(navItem.key);
|
|
407
|
+
onSelectCallback(navItem.key, navItem);
|
|
408
|
+
}
|
|
409
|
+
return render({
|
|
410
|
+
testID,
|
|
411
|
+
items,
|
|
412
|
+
selectedKey,
|
|
413
|
+
onItemSelect: selectItem,
|
|
414
|
+
containerStyle,
|
|
415
|
+
itemStyle,
|
|
416
|
+
activeItemStyle,
|
|
417
|
+
itemTextStyle,
|
|
418
|
+
activeItemTextStyle
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
NavigationBar.propTypes = {
|
|
422
|
+
key: PropTypes5.any,
|
|
423
|
+
testID: PropTypes5.string,
|
|
424
|
+
items: PropTypes5.arrayOf(PropTypes5.shape({
|
|
425
|
+
key: PropTypes5.string.isRequired,
|
|
426
|
+
label: PropTypes5.string.isRequired,
|
|
427
|
+
icon: PropTypes5.node,
|
|
428
|
+
disabled: PropTypes5.bool
|
|
429
|
+
})).isRequired,
|
|
430
|
+
defaultSelectedKey: PropTypes5.string,
|
|
431
|
+
selectedKey: PropTypes5.string,
|
|
432
|
+
onSelect: PropTypes5.func,
|
|
433
|
+
render: PropTypes5.func,
|
|
434
|
+
containerStyle: PropTypes5.object,
|
|
435
|
+
itemStyle: PropTypes5.object,
|
|
436
|
+
activeItemStyle: PropTypes5.object,
|
|
437
|
+
itemTextStyle: PropTypes5.object,
|
|
438
|
+
activeItemTextStyle: PropTypes5.object
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// src/components/HamburgerMenu/HamburgerMenu.tsx
|
|
442
|
+
import React8 from "react";
|
|
443
|
+
import PropTypes7 from "prop-types";
|
|
444
|
+
|
|
445
|
+
// src/components/HamburgerMenu/HamburgerMenuView.tsx
|
|
446
|
+
import React7 from "react";
|
|
447
|
+
import PropTypes6 from "prop-types";
|
|
448
|
+
var container5 = {
|
|
449
|
+
position: "relative",
|
|
450
|
+
display: "inline-block"
|
|
451
|
+
};
|
|
452
|
+
var button2 = {
|
|
453
|
+
display: "flex",
|
|
454
|
+
alignItems: "center",
|
|
455
|
+
justifyContent: "center",
|
|
456
|
+
backgroundColor: "transparent",
|
|
457
|
+
borderStyle: "solid",
|
|
458
|
+
borderWidth: "2px",
|
|
459
|
+
borderColor: "#B3C0C2",
|
|
460
|
+
borderRadius: "8px",
|
|
461
|
+
width: "44px",
|
|
462
|
+
height: "44px",
|
|
463
|
+
cursor: "pointer",
|
|
464
|
+
transition: "opacity 300ms ease"
|
|
465
|
+
};
|
|
466
|
+
var iconText = {
|
|
467
|
+
color: "#B3C0C2",
|
|
468
|
+
fontSize: "24px"
|
|
469
|
+
};
|
|
470
|
+
var panel = {
|
|
471
|
+
position: "absolute",
|
|
472
|
+
top: "100%",
|
|
473
|
+
left: 0,
|
|
474
|
+
marginTop: 5,
|
|
475
|
+
display: "flex",
|
|
476
|
+
flexDirection: "column",
|
|
477
|
+
alignItems: "stretch",
|
|
478
|
+
backgroundColor: "white",
|
|
479
|
+
borderRadius: 7,
|
|
480
|
+
boxShadow: "1px 1px 5px 2px #AFB3B5",
|
|
481
|
+
minWidth: "200px",
|
|
482
|
+
padding: "5px 0",
|
|
483
|
+
zIndex: 10
|
|
484
|
+
};
|
|
485
|
+
function HamburgerMenuView({
|
|
486
|
+
testID = "hamburger-menu",
|
|
487
|
+
items,
|
|
488
|
+
selectedKey,
|
|
489
|
+
onItemSelect,
|
|
490
|
+
icon,
|
|
491
|
+
containerStyle = container5,
|
|
492
|
+
buttonStyle = button2,
|
|
493
|
+
iconStyle = iconText,
|
|
494
|
+
panelStyle = panel,
|
|
495
|
+
itemStyle,
|
|
496
|
+
activeItemStyle,
|
|
497
|
+
itemTextStyle,
|
|
498
|
+
activeItemTextStyle
|
|
499
|
+
}) {
|
|
500
|
+
const [isOpen, setIsOpen] = React7.useState(false);
|
|
501
|
+
function selectAndClose(navItem) {
|
|
502
|
+
onItemSelect(navItem);
|
|
503
|
+
setIsOpen(false);
|
|
504
|
+
}
|
|
505
|
+
return /* @__PURE__ */ React7.createElement("div", { id: testID, style: containerStyle }, /* @__PURE__ */ React7.createElement(
|
|
506
|
+
"button",
|
|
507
|
+
{
|
|
508
|
+
id: `${testID}-toggle`,
|
|
509
|
+
type: "button",
|
|
510
|
+
"aria-expanded": isOpen,
|
|
511
|
+
style: buttonStyle,
|
|
512
|
+
onClick: () => setIsOpen((open) => !open)
|
|
513
|
+
},
|
|
514
|
+
icon != null ? icon : /* @__PURE__ */ React7.createElement("span", { style: iconStyle }, "\u2630")
|
|
515
|
+
), isOpen && /* @__PURE__ */ React7.createElement(
|
|
516
|
+
NavigationBarView,
|
|
517
|
+
{
|
|
518
|
+
testID: `${testID}-panel`,
|
|
519
|
+
items,
|
|
520
|
+
selectedKey,
|
|
521
|
+
onItemSelect: selectAndClose,
|
|
522
|
+
containerStyle: panelStyle,
|
|
523
|
+
itemStyle,
|
|
524
|
+
activeItemStyle,
|
|
525
|
+
itemTextStyle,
|
|
526
|
+
activeItemTextStyle
|
|
527
|
+
}
|
|
528
|
+
));
|
|
529
|
+
}
|
|
530
|
+
HamburgerMenuView.propTypes = {
|
|
531
|
+
testID: PropTypes6.string,
|
|
532
|
+
items: PropTypes6.arrayOf(PropTypes6.shape({
|
|
533
|
+
key: PropTypes6.string.isRequired,
|
|
534
|
+
label: PropTypes6.string.isRequired,
|
|
535
|
+
icon: PropTypes6.node,
|
|
536
|
+
disabled: PropTypes6.bool
|
|
537
|
+
})).isRequired,
|
|
538
|
+
selectedKey: PropTypes6.string,
|
|
539
|
+
onItemSelect: PropTypes6.func.isRequired,
|
|
540
|
+
icon: PropTypes6.node,
|
|
541
|
+
containerStyle: PropTypes6.object,
|
|
542
|
+
buttonStyle: PropTypes6.object,
|
|
543
|
+
iconStyle: PropTypes6.object,
|
|
544
|
+
panelStyle: PropTypes6.object,
|
|
545
|
+
itemStyle: PropTypes6.object,
|
|
546
|
+
activeItemStyle: PropTypes6.object,
|
|
547
|
+
itemTextStyle: PropTypes6.object,
|
|
548
|
+
activeItemTextStyle: PropTypes6.object
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/components/HamburgerMenu/HamburgerMenu.tsx
|
|
552
|
+
function HamburgerMenu({
|
|
553
|
+
testID = "hamburger-menu",
|
|
554
|
+
items,
|
|
555
|
+
defaultSelectedKey,
|
|
556
|
+
selectedKey,
|
|
557
|
+
onSelect,
|
|
558
|
+
icon,
|
|
559
|
+
containerStyle,
|
|
560
|
+
buttonStyle,
|
|
561
|
+
iconStyle,
|
|
562
|
+
panelStyle,
|
|
563
|
+
itemStyle,
|
|
564
|
+
activeItemStyle,
|
|
565
|
+
itemTextStyle,
|
|
566
|
+
activeItemTextStyle
|
|
567
|
+
}) {
|
|
568
|
+
return /* @__PURE__ */ React8.createElement(
|
|
569
|
+
NavigationBar,
|
|
570
|
+
{
|
|
571
|
+
testID,
|
|
572
|
+
items,
|
|
573
|
+
defaultSelectedKey,
|
|
574
|
+
selectedKey,
|
|
575
|
+
onSelect,
|
|
576
|
+
render: (viewProps) => /* @__PURE__ */ React8.createElement(
|
|
577
|
+
HamburgerMenuView,
|
|
578
|
+
{
|
|
579
|
+
testID: viewProps.testID,
|
|
580
|
+
items: viewProps.items,
|
|
581
|
+
selectedKey: viewProps.selectedKey,
|
|
582
|
+
onItemSelect: viewProps.onItemSelect,
|
|
583
|
+
icon,
|
|
584
|
+
containerStyle,
|
|
585
|
+
buttonStyle,
|
|
586
|
+
iconStyle,
|
|
587
|
+
panelStyle,
|
|
588
|
+
itemStyle,
|
|
589
|
+
activeItemStyle,
|
|
590
|
+
itemTextStyle,
|
|
591
|
+
activeItemTextStyle
|
|
592
|
+
}
|
|
593
|
+
)
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
HamburgerMenu.propTypes = {
|
|
598
|
+
key: PropTypes7.any,
|
|
599
|
+
testID: PropTypes7.string,
|
|
600
|
+
items: PropTypes7.arrayOf(PropTypes7.shape({
|
|
601
|
+
key: PropTypes7.string.isRequired,
|
|
602
|
+
label: PropTypes7.string.isRequired,
|
|
603
|
+
icon: PropTypes7.node,
|
|
604
|
+
disabled: PropTypes7.bool
|
|
605
|
+
})).isRequired,
|
|
606
|
+
defaultSelectedKey: PropTypes7.string,
|
|
607
|
+
selectedKey: PropTypes7.string,
|
|
608
|
+
onSelect: PropTypes7.func,
|
|
609
|
+
icon: PropTypes7.node,
|
|
610
|
+
containerStyle: PropTypes7.object,
|
|
611
|
+
buttonStyle: PropTypes7.object,
|
|
612
|
+
iconStyle: PropTypes7.object,
|
|
613
|
+
panelStyle: PropTypes7.object,
|
|
614
|
+
itemStyle: PropTypes7.object,
|
|
615
|
+
activeItemStyle: PropTypes7.object,
|
|
616
|
+
itemTextStyle: PropTypes7.object,
|
|
617
|
+
activeItemTextStyle: PropTypes7.object
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// src/components/RadioButtonGroup/RadioButtonGroup.tsx
|
|
621
|
+
import React10 from "react";
|
|
622
|
+
import PropTypes9 from "prop-types";
|
|
623
|
+
|
|
624
|
+
// src/components/RadioButtonGroup/RadioButtonGroupView.tsx
|
|
625
|
+
import React9 from "react";
|
|
626
|
+
import PropTypes8 from "prop-types";
|
|
627
|
+
var titleContainer = {
|
|
628
|
+
width: "100%"
|
|
629
|
+
};
|
|
630
|
+
var titleText = {
|
|
631
|
+
marginTop: "3.5%",
|
|
632
|
+
marginBottom: "3.5%",
|
|
633
|
+
fontFamily: "nunito-regular",
|
|
634
|
+
color: "rgba(55,66,69,.5)"
|
|
635
|
+
};
|
|
636
|
+
var container6 = {
|
|
637
|
+
display: "flex",
|
|
638
|
+
flexDirection: "row",
|
|
639
|
+
width: "100%",
|
|
640
|
+
paddingTop: 2.5,
|
|
641
|
+
paddingLeft: 2.5,
|
|
642
|
+
paddingRight: 2.5,
|
|
643
|
+
marginBottom: "3.5%"
|
|
644
|
+
};
|
|
645
|
+
var item2 = {
|
|
646
|
+
display: "flex",
|
|
647
|
+
alignItems: "center",
|
|
648
|
+
justifyContent: "center",
|
|
649
|
+
flex: 1,
|
|
650
|
+
height: "40px",
|
|
651
|
+
padding: "10px",
|
|
652
|
+
backgroundColor: "transparent",
|
|
653
|
+
border: "1px solid rgba(55,66,69,.5)",
|
|
654
|
+
cursor: "pointer",
|
|
655
|
+
transition: "opacity 300ms ease"
|
|
656
|
+
};
|
|
657
|
+
var activeItem2 = {
|
|
658
|
+
backgroundColor: "#00ADE9",
|
|
659
|
+
borderColor: "#1177B0"
|
|
660
|
+
};
|
|
661
|
+
var itemText2 = {
|
|
662
|
+
color: "rgba(55,66,69,.5)",
|
|
663
|
+
fontFamily: "nunito-regular",
|
|
664
|
+
fontSize: "16px"
|
|
665
|
+
};
|
|
666
|
+
var activeItemText2 = {
|
|
667
|
+
color: "white"
|
|
668
|
+
};
|
|
669
|
+
function RadioButtonGroupView({
|
|
670
|
+
testID = "radio-button-group",
|
|
671
|
+
items,
|
|
672
|
+
selectedKey,
|
|
673
|
+
onItemSelect,
|
|
674
|
+
title: title2,
|
|
675
|
+
titleContainerStyle = titleContainer,
|
|
676
|
+
titleStyle = titleText,
|
|
677
|
+
containerStyle = container6,
|
|
678
|
+
itemStyle = item2,
|
|
679
|
+
activeItemStyle = activeItem2,
|
|
680
|
+
itemTextStyle = itemText2,
|
|
681
|
+
activeItemTextStyle = activeItemText2
|
|
682
|
+
}) {
|
|
683
|
+
function renderTitle() {
|
|
684
|
+
if (title2 == null) return /* @__PURE__ */ React9.createElement(React9.Fragment, null);
|
|
685
|
+
return /* @__PURE__ */ React9.createElement("div", { style: titleContainerStyle }, /* @__PURE__ */ React9.createElement("span", { style: titleStyle }, title2));
|
|
686
|
+
}
|
|
687
|
+
function renderItem(navItem, index) {
|
|
688
|
+
const active = navItem.key === selectedKey;
|
|
689
|
+
const positionStyle = {
|
|
690
|
+
...index === 0 ? { borderTopLeftRadius: 4, borderBottomLeftRadius: 4 } : {},
|
|
691
|
+
...index === items.length - 1 ? { borderTopRightRadius: 4, borderBottomRightRadius: 4 } : {}
|
|
692
|
+
};
|
|
693
|
+
return /* @__PURE__ */ React9.createElement(
|
|
694
|
+
"button",
|
|
695
|
+
{
|
|
696
|
+
id: `${testID}-item-${navItem.key}`,
|
|
697
|
+
key: navItem.key,
|
|
698
|
+
disabled: navItem.disabled,
|
|
699
|
+
style: { ...positionStyle, ...itemStyle, ...active ? activeItemStyle : {}, opacity: navItem.disabled ? 0.4 : 1 },
|
|
700
|
+
onClick: () => onItemSelect(navItem)
|
|
701
|
+
},
|
|
702
|
+
navItem.icon,
|
|
703
|
+
/* @__PURE__ */ React9.createElement("span", { style: { ...itemTextStyle, ...active ? activeItemTextStyle : {} } }, navItem.label)
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
return /* @__PURE__ */ React9.createElement("div", { id: testID }, renderTitle(), /* @__PURE__ */ React9.createElement("div", { style: containerStyle }, items.map(renderItem)));
|
|
707
|
+
}
|
|
708
|
+
RadioButtonGroupView.propTypes = {
|
|
709
|
+
testID: PropTypes8.string,
|
|
710
|
+
items: PropTypes8.arrayOf(PropTypes8.shape({
|
|
711
|
+
key: PropTypes8.string.isRequired,
|
|
712
|
+
label: PropTypes8.string.isRequired,
|
|
713
|
+
icon: PropTypes8.node,
|
|
714
|
+
disabled: PropTypes8.bool
|
|
715
|
+
})).isRequired,
|
|
716
|
+
selectedKey: PropTypes8.string,
|
|
717
|
+
onItemSelect: PropTypes8.func.isRequired,
|
|
718
|
+
title: PropTypes8.string,
|
|
719
|
+
titleContainerStyle: PropTypes8.object,
|
|
720
|
+
titleStyle: PropTypes8.object,
|
|
721
|
+
containerStyle: PropTypes8.object,
|
|
722
|
+
itemStyle: PropTypes8.object,
|
|
723
|
+
activeItemStyle: PropTypes8.object,
|
|
724
|
+
itemTextStyle: PropTypes8.object,
|
|
725
|
+
activeItemTextStyle: PropTypes8.object
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// src/components/RadioButtonGroup/RadioButtonGroup.tsx
|
|
729
|
+
function RadioButtonGroup({
|
|
730
|
+
testID = "radio-button-group",
|
|
731
|
+
items,
|
|
732
|
+
defaultSelectedKey,
|
|
733
|
+
selectedKey,
|
|
734
|
+
onSelect,
|
|
735
|
+
title: title2,
|
|
736
|
+
titleContainerStyle,
|
|
737
|
+
titleStyle,
|
|
738
|
+
containerStyle,
|
|
739
|
+
itemStyle,
|
|
740
|
+
activeItemStyle,
|
|
741
|
+
itemTextStyle,
|
|
742
|
+
activeItemTextStyle
|
|
743
|
+
}) {
|
|
744
|
+
return /* @__PURE__ */ React10.createElement(
|
|
745
|
+
NavigationBar,
|
|
746
|
+
{
|
|
747
|
+
testID,
|
|
748
|
+
items,
|
|
749
|
+
defaultSelectedKey,
|
|
750
|
+
selectedKey,
|
|
751
|
+
onSelect,
|
|
752
|
+
render: (viewProps) => /* @__PURE__ */ React10.createElement(
|
|
753
|
+
RadioButtonGroupView,
|
|
754
|
+
{
|
|
755
|
+
testID: viewProps.testID,
|
|
756
|
+
items: viewProps.items,
|
|
757
|
+
selectedKey: viewProps.selectedKey,
|
|
758
|
+
onItemSelect: viewProps.onItemSelect,
|
|
759
|
+
title: title2,
|
|
760
|
+
titleContainerStyle,
|
|
761
|
+
titleStyle,
|
|
762
|
+
containerStyle,
|
|
763
|
+
itemStyle,
|
|
764
|
+
activeItemStyle,
|
|
765
|
+
itemTextStyle,
|
|
766
|
+
activeItemTextStyle
|
|
767
|
+
}
|
|
768
|
+
)
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
RadioButtonGroup.propTypes = {
|
|
773
|
+
key: PropTypes9.any,
|
|
774
|
+
testID: PropTypes9.string,
|
|
775
|
+
items: PropTypes9.arrayOf(PropTypes9.shape({
|
|
776
|
+
key: PropTypes9.string.isRequired,
|
|
777
|
+
label: PropTypes9.string.isRequired,
|
|
778
|
+
icon: PropTypes9.node,
|
|
779
|
+
disabled: PropTypes9.bool
|
|
780
|
+
})).isRequired,
|
|
781
|
+
defaultSelectedKey: PropTypes9.string,
|
|
782
|
+
selectedKey: PropTypes9.string,
|
|
783
|
+
onSelect: PropTypes9.func,
|
|
784
|
+
title: PropTypes9.string,
|
|
785
|
+
titleContainerStyle: PropTypes9.object,
|
|
786
|
+
titleStyle: PropTypes9.object,
|
|
787
|
+
containerStyle: PropTypes9.object,
|
|
788
|
+
itemStyle: PropTypes9.object,
|
|
789
|
+
activeItemStyle: PropTypes9.object,
|
|
790
|
+
itemTextStyle: PropTypes9.object,
|
|
791
|
+
activeItemTextStyle: PropTypes9.object
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
// src/components/Loading/Loading.tsx
|
|
795
|
+
import React11 from "react";
|
|
796
|
+
import PropTypes10 from "prop-types";
|
|
797
|
+
var spinnerKeyframes = `
|
|
798
|
+
@keyframes component-lib-loading-spin {
|
|
799
|
+
from { transform: rotate(0deg); }
|
|
800
|
+
to { transform: rotate(360deg); }
|
|
801
|
+
}`;
|
|
802
|
+
var container7 = {
|
|
803
|
+
display: "flex",
|
|
804
|
+
flexDirection: "column",
|
|
805
|
+
alignItems: "center",
|
|
806
|
+
justifyContent: "center",
|
|
807
|
+
backgroundColor: "#fff",
|
|
808
|
+
maxHeight: 100,
|
|
809
|
+
width: "75%",
|
|
810
|
+
maxWidth: 350,
|
|
811
|
+
boxShadow: "1px 1px 8px rgba(170,170,170,0.1)",
|
|
812
|
+
borderRadius: 10
|
|
813
|
+
};
|
|
814
|
+
var wrapper2 = {
|
|
815
|
+
display: "flex",
|
|
816
|
+
flexDirection: "column",
|
|
817
|
+
alignItems: "center",
|
|
818
|
+
gap: 10
|
|
819
|
+
};
|
|
820
|
+
var spinner = {
|
|
821
|
+
width: 32,
|
|
822
|
+
height: 32,
|
|
823
|
+
borderRadius: "50%",
|
|
824
|
+
border: "3px solid #E9ECEF",
|
|
825
|
+
borderTopColor: "#00ADE9",
|
|
826
|
+
animation: "component-lib-loading-spin 800ms linear infinite"
|
|
827
|
+
};
|
|
828
|
+
function Loading({
|
|
829
|
+
testID = "loading",
|
|
830
|
+
children,
|
|
831
|
+
containerStyle = container7,
|
|
832
|
+
wrapperStyle = wrapper2,
|
|
833
|
+
spinnerStyle = spinner
|
|
834
|
+
}) {
|
|
835
|
+
return /* @__PURE__ */ React11.createElement("div", { id: testID }, /* @__PURE__ */ React11.createElement("style", null, spinnerKeyframes), /* @__PURE__ */ React11.createElement(Card, { containerStyle, wrapperStyle }, /* @__PURE__ */ React11.createElement("div", { style: spinnerStyle }), children));
|
|
836
|
+
}
|
|
837
|
+
Loading.propTypes = {
|
|
838
|
+
key: PropTypes10.any,
|
|
839
|
+
testID: PropTypes10.string,
|
|
840
|
+
children: PropTypes10.node,
|
|
841
|
+
containerStyle: PropTypes10.object,
|
|
842
|
+
wrapperStyle: PropTypes10.object,
|
|
843
|
+
spinnerStyle: PropTypes10.object
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
// src/components/ScrollMenu/ScrollMenu.tsx
|
|
847
|
+
import React13 from "react";
|
|
848
|
+
import PropTypes12 from "prop-types";
|
|
849
|
+
|
|
850
|
+
// src/components/ScrollMenu/ScrollMenuView.tsx
|
|
851
|
+
import React12 from "react";
|
|
852
|
+
import PropTypes11 from "prop-types";
|
|
853
|
+
var container8 = {
|
|
854
|
+
display: "flex",
|
|
855
|
+
flexDirection: "row",
|
|
856
|
+
alignItems: "center",
|
|
857
|
+
gap: 11,
|
|
858
|
+
overflowX: "auto",
|
|
859
|
+
backgroundColor: "#374245",
|
|
860
|
+
minHeight: 80,
|
|
861
|
+
maxHeight: 100,
|
|
862
|
+
padding: "10px",
|
|
863
|
+
borderRadius: 7
|
|
864
|
+
};
|
|
865
|
+
var tile = {
|
|
866
|
+
display: "flex",
|
|
867
|
+
alignItems: "center",
|
|
868
|
+
justifyContent: "center",
|
|
869
|
+
flexShrink: 0,
|
|
870
|
+
width: 70,
|
|
871
|
+
height: 70,
|
|
872
|
+
borderRadius: 7.5,
|
|
873
|
+
border: "1px solid #E9ECEF",
|
|
874
|
+
backgroundColor: "white",
|
|
875
|
+
overflow: "hidden",
|
|
876
|
+
padding: 0,
|
|
877
|
+
cursor: "pointer",
|
|
878
|
+
transition: "opacity 300ms ease"
|
|
879
|
+
};
|
|
880
|
+
var activeTile = {
|
|
881
|
+
border: "2px solid #00ADE9"
|
|
882
|
+
};
|
|
883
|
+
var tileText = {
|
|
884
|
+
color: "#919799",
|
|
885
|
+
fontFamily: "nunito-regular",
|
|
886
|
+
fontSize: "14px",
|
|
887
|
+
textAlign: "center"
|
|
888
|
+
};
|
|
889
|
+
function ScrollMenuView({
|
|
890
|
+
testID = "scroll-menu",
|
|
891
|
+
items,
|
|
892
|
+
selectedKey,
|
|
893
|
+
onItemSelect,
|
|
894
|
+
containerStyle = container8,
|
|
895
|
+
tileStyle = tile,
|
|
896
|
+
activeTileStyle = activeTile,
|
|
897
|
+
tileTextStyle = tileText
|
|
898
|
+
}) {
|
|
899
|
+
function renderItem(navItem) {
|
|
900
|
+
var _a;
|
|
901
|
+
const active = navItem.key === selectedKey;
|
|
902
|
+
return /* @__PURE__ */ React12.createElement(
|
|
903
|
+
"button",
|
|
904
|
+
{
|
|
905
|
+
id: `${testID}-item-${navItem.key}`,
|
|
906
|
+
key: navItem.key,
|
|
907
|
+
disabled: navItem.disabled,
|
|
908
|
+
style: { ...tileStyle, ...active ? activeTileStyle : {}, opacity: navItem.disabled ? 0.4 : 1 },
|
|
909
|
+
onClick: () => onItemSelect(navItem)
|
|
910
|
+
},
|
|
911
|
+
(_a = navItem.icon) != null ? _a : /* @__PURE__ */ React12.createElement("span", { style: tileTextStyle }, navItem.label)
|
|
912
|
+
);
|
|
913
|
+
}
|
|
914
|
+
return /* @__PURE__ */ React12.createElement("div", { id: testID, style: containerStyle }, items.map(renderItem));
|
|
915
|
+
}
|
|
916
|
+
ScrollMenuView.propTypes = {
|
|
917
|
+
testID: PropTypes11.string,
|
|
918
|
+
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
919
|
+
key: PropTypes11.string.isRequired,
|
|
920
|
+
label: PropTypes11.string.isRequired,
|
|
921
|
+
icon: PropTypes11.node,
|
|
922
|
+
disabled: PropTypes11.bool
|
|
923
|
+
})).isRequired,
|
|
924
|
+
selectedKey: PropTypes11.string,
|
|
925
|
+
onItemSelect: PropTypes11.func.isRequired,
|
|
926
|
+
containerStyle: PropTypes11.object,
|
|
927
|
+
tileStyle: PropTypes11.object,
|
|
928
|
+
activeTileStyle: PropTypes11.object,
|
|
929
|
+
tileTextStyle: PropTypes11.object
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
// src/components/ScrollMenu/ScrollMenu.tsx
|
|
933
|
+
function ScrollMenu({
|
|
934
|
+
testID = "scroll-menu",
|
|
935
|
+
items,
|
|
936
|
+
defaultSelectedKey,
|
|
937
|
+
selectedKey,
|
|
938
|
+
onSelect,
|
|
939
|
+
containerStyle,
|
|
940
|
+
tileStyle,
|
|
941
|
+
activeTileStyle,
|
|
942
|
+
tileTextStyle
|
|
943
|
+
}) {
|
|
944
|
+
return /* @__PURE__ */ React13.createElement(
|
|
945
|
+
NavigationBar,
|
|
946
|
+
{
|
|
947
|
+
testID,
|
|
948
|
+
items,
|
|
949
|
+
defaultSelectedKey,
|
|
950
|
+
selectedKey,
|
|
951
|
+
onSelect,
|
|
952
|
+
render: (viewProps) => /* @__PURE__ */ React13.createElement(
|
|
953
|
+
ScrollMenuView,
|
|
954
|
+
{
|
|
955
|
+
testID: viewProps.testID,
|
|
956
|
+
items: viewProps.items,
|
|
957
|
+
selectedKey: viewProps.selectedKey,
|
|
958
|
+
onItemSelect: viewProps.onItemSelect,
|
|
959
|
+
containerStyle,
|
|
960
|
+
tileStyle,
|
|
961
|
+
activeTileStyle,
|
|
962
|
+
tileTextStyle
|
|
963
|
+
}
|
|
964
|
+
)
|
|
965
|
+
}
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
ScrollMenu.propTypes = {
|
|
969
|
+
key: PropTypes12.any,
|
|
970
|
+
testID: PropTypes12.string,
|
|
971
|
+
items: PropTypes12.arrayOf(PropTypes12.shape({
|
|
972
|
+
key: PropTypes12.string.isRequired,
|
|
973
|
+
label: PropTypes12.string.isRequired,
|
|
974
|
+
icon: PropTypes12.node,
|
|
975
|
+
disabled: PropTypes12.bool
|
|
976
|
+
})).isRequired,
|
|
977
|
+
defaultSelectedKey: PropTypes12.string,
|
|
978
|
+
selectedKey: PropTypes12.string,
|
|
979
|
+
onSelect: PropTypes12.func,
|
|
980
|
+
containerStyle: PropTypes12.object,
|
|
981
|
+
tileStyle: PropTypes12.object,
|
|
982
|
+
activeTileStyle: PropTypes12.object,
|
|
983
|
+
tileTextStyle: PropTypes12.object
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
// src/components/Tile/Tile.tsx
|
|
987
|
+
import React14 from "react";
|
|
988
|
+
import PropTypes13 from "prop-types";
|
|
989
|
+
var imageTileContainer = {
|
|
990
|
+
display: "flex",
|
|
991
|
+
alignItems: "center",
|
|
992
|
+
justifyContent: "center",
|
|
993
|
+
aspectRatio: "1",
|
|
994
|
+
width: 70,
|
|
995
|
+
height: 70,
|
|
996
|
+
borderRadius: 7.5,
|
|
997
|
+
border: "1px solid #E9ECEF",
|
|
998
|
+
backgroundColor: "white",
|
|
999
|
+
overflow: "hidden"
|
|
1000
|
+
};
|
|
1001
|
+
var imageTileContainerLarge = {
|
|
1002
|
+
...imageTileContainer,
|
|
1003
|
+
width: 100,
|
|
1004
|
+
height: 100
|
|
1005
|
+
};
|
|
1006
|
+
var tileImage = {
|
|
1007
|
+
width: "100%",
|
|
1008
|
+
height: "100%",
|
|
1009
|
+
objectFit: "cover",
|
|
1010
|
+
borderRadius: 5,
|
|
1011
|
+
backgroundColor: "white"
|
|
1012
|
+
};
|
|
1013
|
+
var textTileContainer = {
|
|
1014
|
+
display: "flex",
|
|
1015
|
+
alignItems: "center",
|
|
1016
|
+
justifyContent: "center",
|
|
1017
|
+
aspectRatio: "1",
|
|
1018
|
+
width: 70,
|
|
1019
|
+
height: 70,
|
|
1020
|
+
borderRadius: 7.5,
|
|
1021
|
+
border: "1px solid white",
|
|
1022
|
+
backgroundColor: "#919799"
|
|
1023
|
+
};
|
|
1024
|
+
var tileText2 = {
|
|
1025
|
+
alignSelf: "center",
|
|
1026
|
+
textAlign: "center",
|
|
1027
|
+
color: "#E9ECEF",
|
|
1028
|
+
fontFamily: "nunito-light"
|
|
1029
|
+
};
|
|
1030
|
+
function ImageTile({
|
|
1031
|
+
testID = "image-tile",
|
|
1032
|
+
image,
|
|
1033
|
+
enlarge = false,
|
|
1034
|
+
containerStyle = enlarge ? imageTileContainerLarge : imageTileContainer,
|
|
1035
|
+
imageStyle = tileImage
|
|
1036
|
+
}) {
|
|
1037
|
+
return /* @__PURE__ */ React14.createElement("div", { id: testID, style: containerStyle }, /* @__PURE__ */ React14.createElement("img", { src: image, style: imageStyle }));
|
|
1038
|
+
}
|
|
1039
|
+
ImageTile.propTypes = {
|
|
1040
|
+
key: PropTypes13.any,
|
|
1041
|
+
testID: PropTypes13.string,
|
|
1042
|
+
image: PropTypes13.string.isRequired,
|
|
1043
|
+
enlarge: PropTypes13.bool,
|
|
1044
|
+
containerStyle: PropTypes13.object,
|
|
1045
|
+
imageStyle: PropTypes13.object
|
|
1046
|
+
};
|
|
1047
|
+
function TextTile({
|
|
1048
|
+
testID = "text-tile",
|
|
1049
|
+
text,
|
|
1050
|
+
fontSize = 30,
|
|
1051
|
+
containerStyle = textTileContainer,
|
|
1052
|
+
textStyle = tileText2
|
|
1053
|
+
}) {
|
|
1054
|
+
return /* @__PURE__ */ React14.createElement("div", { id: testID, style: containerStyle }, /* @__PURE__ */ React14.createElement("span", { style: { ...textStyle, fontSize } }, text));
|
|
1055
|
+
}
|
|
1056
|
+
TextTile.propTypes = {
|
|
1057
|
+
key: PropTypes13.any,
|
|
1058
|
+
testID: PropTypes13.string,
|
|
1059
|
+
text: PropTypes13.string.isRequired,
|
|
1060
|
+
fontSize: PropTypes13.number,
|
|
1061
|
+
containerStyle: PropTypes13.object,
|
|
1062
|
+
textStyle: PropTypes13.object
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
// src/components/SearchBar/SearchBar.tsx
|
|
1066
|
+
import React15 from "react";
|
|
1067
|
+
import PropTypes14 from "prop-types";
|
|
1068
|
+
|
|
1069
|
+
// src/components/SearchBar/matching.ts
|
|
1070
|
+
function normalizeText(value, options) {
|
|
1071
|
+
let result = value;
|
|
1072
|
+
if (options.ignoreAccents) result = result.normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
1073
|
+
if (!options.caseSensitive) result = result.toLowerCase();
|
|
1074
|
+
return result;
|
|
1075
|
+
}
|
|
1076
|
+
function collectLeaves(value) {
|
|
1077
|
+
if (value == null) return [];
|
|
1078
|
+
if (typeof value === "object") return Object.values(value).flatMap(collectLeaves);
|
|
1079
|
+
return [String(value)];
|
|
1080
|
+
}
|
|
1081
|
+
function collectSearchableText(item3, keys) {
|
|
1082
|
+
if (keys == null || keys.length === 0) return collectLeaves(item3);
|
|
1083
|
+
return keys.flatMap((key) => collectLeaves(item3 == null ? void 0 : item3[key]));
|
|
1084
|
+
}
|
|
1085
|
+
function fuzzyScore(query, text) {
|
|
1086
|
+
if (query.length === 0) return 0;
|
|
1087
|
+
let queryIndex = 0;
|
|
1088
|
+
let score = 0;
|
|
1089
|
+
let consecutive = 0;
|
|
1090
|
+
for (let i = 0; i < text.length && queryIndex < query.length; i++) {
|
|
1091
|
+
if (text[i] === query[queryIndex]) {
|
|
1092
|
+
score += 1 + consecutive;
|
|
1093
|
+
consecutive += 1;
|
|
1094
|
+
queryIndex += 1;
|
|
1095
|
+
} else {
|
|
1096
|
+
consecutive = 0;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return queryIndex === query.length ? score : null;
|
|
1100
|
+
}
|
|
1101
|
+
var builtInMatchers = {
|
|
1102
|
+
substring: (query, text) => text.includes(query) ? 0 : null,
|
|
1103
|
+
prefix: (query, text) => {
|
|
1104
|
+
if (text.startsWith(query)) return 0;
|
|
1105
|
+
return text.split(/\s+/).some((word) => word.startsWith(query)) ? 0 : null;
|
|
1106
|
+
},
|
|
1107
|
+
tokenized: (query, text) => {
|
|
1108
|
+
const words = query.split(/\s+/).filter(Boolean);
|
|
1109
|
+
return words.every((word) => text.includes(word)) ? 0 : null;
|
|
1110
|
+
},
|
|
1111
|
+
fuzzy: fuzzyScore,
|
|
1112
|
+
regex: (query, text) => {
|
|
1113
|
+
try {
|
|
1114
|
+
return new RegExp(query).test(text) ? 0 : null;
|
|
1115
|
+
} catch {
|
|
1116
|
+
return null;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
function filterObjects(search, list, keys, options) {
|
|
1121
|
+
const query = normalizeText(search.trim(), options);
|
|
1122
|
+
const matcher = typeof options.matchStrategy === "function" ? options.matchStrategy : builtInMatchers[options.matchStrategy];
|
|
1123
|
+
const scored = [];
|
|
1124
|
+
list.forEach((item3) => {
|
|
1125
|
+
const text = normalizeText(collectSearchableText(item3, keys).join(" "), options);
|
|
1126
|
+
const score = matcher(query, text);
|
|
1127
|
+
if (score != null) scored.push({ item: item3, score });
|
|
1128
|
+
});
|
|
1129
|
+
if (options.rank) scored.sort((a, b) => b.score - a.score);
|
|
1130
|
+
return scored.map((entry) => entry.item);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// src/components/SearchBar/SearchBar.tsx
|
|
1134
|
+
function SearchBar({
|
|
1135
|
+
objects = [],
|
|
1136
|
+
keys,
|
|
1137
|
+
onResults = () => {
|
|
1138
|
+
},
|
|
1139
|
+
defaultValue = "",
|
|
1140
|
+
matchStrategy = "fuzzy",
|
|
1141
|
+
caseSensitive = false,
|
|
1142
|
+
ignoreAccents = false,
|
|
1143
|
+
rank = true,
|
|
1144
|
+
debounceMs = 0,
|
|
1145
|
+
...inputFormProps
|
|
1146
|
+
}) {
|
|
1147
|
+
const [text, setText] = React15.useState(defaultValue);
|
|
1148
|
+
const isFirstRender = React15.useRef(true);
|
|
1149
|
+
const debounceRef = React15.useRef();
|
|
1150
|
+
const matchOptions = { matchStrategy, caseSensitive, ignoreAccents, rank };
|
|
1151
|
+
function emitResults(searchText) {
|
|
1152
|
+
onResults(filterObjects(searchText, objects, keys, matchOptions));
|
|
1153
|
+
}
|
|
1154
|
+
function runFilter(searchText) {
|
|
1155
|
+
setText(searchText);
|
|
1156
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
1157
|
+
if (debounceMs > 0) {
|
|
1158
|
+
debounceRef.current = setTimeout(() => emitResults(searchText), debounceMs);
|
|
1159
|
+
} else {
|
|
1160
|
+
emitResults(searchText);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
React15.useEffect(() => {
|
|
1164
|
+
return () => {
|
|
1165
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
1166
|
+
};
|
|
1167
|
+
}, []);
|
|
1168
|
+
React15.useEffect(() => {
|
|
1169
|
+
if (isFirstRender.current) {
|
|
1170
|
+
isFirstRender.current = false;
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
emitResults(text);
|
|
1174
|
+
}, [objects]);
|
|
1175
|
+
return /* @__PURE__ */ React15.createElement(InputForm, { ...inputFormProps, value: text, onInput: runFilter });
|
|
1176
|
+
}
|
|
1177
|
+
SearchBar.propTypes = {
|
|
1178
|
+
objects: PropTypes14.array,
|
|
1179
|
+
keys: PropTypes14.arrayOf(PropTypes14.string),
|
|
1180
|
+
onResults: PropTypes14.func,
|
|
1181
|
+
defaultValue: PropTypes14.string,
|
|
1182
|
+
matchStrategy: PropTypes14.oneOfType([
|
|
1183
|
+
PropTypes14.oneOf(["substring", "prefix", "tokenized", "fuzzy", "regex"]),
|
|
1184
|
+
PropTypes14.func
|
|
1185
|
+
]),
|
|
1186
|
+
caseSensitive: PropTypes14.bool,
|
|
1187
|
+
ignoreAccents: PropTypes14.bool,
|
|
1188
|
+
rank: PropTypes14.bool,
|
|
1189
|
+
debounceMs: PropTypes14.number
|
|
1190
|
+
};
|
|
1191
|
+
export {
|
|
1192
|
+
Card,
|
|
1193
|
+
HamburgerMenu,
|
|
1194
|
+
HamburgerMenuView,
|
|
1195
|
+
HelloWorld,
|
|
1196
|
+
ImageTile,
|
|
1197
|
+
InputForm,
|
|
1198
|
+
Loading,
|
|
1199
|
+
NavigationBar,
|
|
1200
|
+
NavigationBarView,
|
|
1201
|
+
RadioButtonGroup,
|
|
1202
|
+
RadioButtonGroupView,
|
|
1203
|
+
ScrollMenu,
|
|
1204
|
+
ScrollMenuView,
|
|
1205
|
+
SearchBar,
|
|
1206
|
+
TextTile,
|
|
1207
|
+
ThinButton
|
|
1208
|
+
};
|