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