@swan-io/lake 1.1.0 → 1.2.1

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.
Files changed (35) hide show
  1. package/package.json +4 -3
  2. package/src/assets/fonts/Inter-Italic.woff +0 -0
  3. package/src/assets/fonts/Inter-Italic.woff2 +0 -0
  4. package/src/assets/fonts/Inter-Light.woff +0 -0
  5. package/src/assets/fonts/Inter-Light.woff2 +0 -0
  6. package/src/assets/fonts/Inter-Medium.woff +0 -0
  7. package/src/assets/fonts/Inter-Medium.woff2 +0 -0
  8. package/src/assets/fonts/Inter-Regular.woff +0 -0
  9. package/src/assets/fonts/Inter-Regular.woff2 +0 -0
  10. package/src/assets/fonts/Inter-SemiBold.woff +0 -0
  11. package/src/assets/fonts/Inter-SemiBold.woff2 +0 -0
  12. package/src/assets/fonts/Inter.css +39 -0
  13. package/src/assets/fonts/InterCard.css +8 -0
  14. package/src/assets/images/flags.svg +1 -0
  15. package/src/assets/main.css +466 -0
  16. package/src/components/FilterChooser.d.ts +1 -3
  17. package/src/components/Filters.d.ts +8 -2
  18. package/src/components/Filters.js +4 -0
  19. package/src/components/InputError.js +1 -1
  20. package/src/components/LakeCombobox.d.ts +2 -1
  21. package/src/components/LakeCombobox.js +10 -2
  22. package/src/components/LakeLabel.d.ts +3 -2
  23. package/src/components/LakeLabel.js +6 -1
  24. package/src/components/LakeModal.js +1 -1
  25. package/src/components/LakeStepper.js +4 -1
  26. package/src/components/LakeTextInput.d.ts +2 -0
  27. package/src/components/LakeTextInput.js +3 -3
  28. package/src/components/PlainListView.js +1 -1
  29. package/src/components/RadioGroup.js +11 -2
  30. package/src/components/Switch.js +1 -1
  31. package/src/components/TabView.d.ts +3 -1
  32. package/src/components/TabView.js +5 -4
  33. package/src/constants/commonStyles.d.ts +4 -0
  34. package/src/constants/commonStyles.js +1 -0
  35. package/src/utils/rifm.d.ts +2 -2
@@ -0,0 +1,466 @@
1
+ html,
2
+ body {
3
+ height: 100%;
4
+ }
5
+
6
+ body {
7
+ overflow: hidden;
8
+ }
9
+
10
+ #app-root,
11
+ #root {
12
+ display: flex;
13
+ flex-direction: column;
14
+ height: 100%;
15
+ }
16
+
17
+ @media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 2dppx) {
18
+ body {
19
+ -moz-osx-font-smoothing: grayscale;
20
+ -webkit-font-smoothing: antialiased;
21
+ }
22
+ }
23
+
24
+ ::-webkit-input-placeholder {
25
+ color: inherit;
26
+ opacity: 0.54;
27
+ }
28
+
29
+ ::-moz-selection {
30
+ background-color: #e7e8e8;
31
+ color: #14191a;
32
+ text-shadow: none;
33
+ }
34
+
35
+ ::selection {
36
+ background-color: #e7e8e8;
37
+ color: #14191a;
38
+ text-shadow: none;
39
+ }
40
+
41
+ :root {
42
+ --shadow-tile: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
43
+ --shadow-tile-hover: 0 2px 10px 0 rgba(0, 0, 0, 0.18);
44
+ --shadow-modal: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 8px 18px -8px rgba(0, 0, 0, 0.24);
45
+
46
+ --spacing-4: 4px;
47
+ --spacing-8: 8px;
48
+ --spacing-12: 12px;
49
+ --spacing-16: 16px;
50
+ --spacing-20: 20px;
51
+ --spacing-24: 24px;
52
+ --spacing-32: 32px;
53
+ --spacing-40: 40px;
54
+ --spacing-48: 48px;
55
+ --spacing-72: 72px;
56
+ --spacing-96: 96px;
57
+
58
+ --spacing-negative-4: calc(-1 * var(--spacing-4));
59
+ --spacing-negative-8: calc(-1 * var(--spacing-8));
60
+ --spacing-negative-12: calc(-1 * var(--spacing-12));
61
+ --spacing-negative-16: calc(-1 * var(--spacing-16));
62
+ --spacing-negative-20: calc(-1 * var(--spacing-20));
63
+ --spacing-negative-24: calc(-1 * var(--spacing-24));
64
+ --spacing-negative-32: calc(-1 * var(--spacing-32));
65
+ --spacing-negative-40: calc(-1 * var(--spacing-40));
66
+ --spacing-negative-48: calc(-1 * var(--spacing-48));
67
+ --spacing-negative-72: calc(-1 * var(--spacing-72));
68
+ --spacing-negative-96: calc(-1 * var(--spacing-96));
69
+
70
+ --radius-4: 4px;
71
+ --radius-6: 6px;
72
+ --radius-8: 8px;
73
+
74
+ --color-white: #ffffff;
75
+ --color-black: #000000;
76
+
77
+ --color-swan-900: #080709;
78
+ --color-swan-800: #0f0e13;
79
+ --color-swan-700: #17151c;
80
+ --color-swan-600: #1e1c26;
81
+ --color-swan-500: #26232f;
82
+ --color-swan-400: #514f59;
83
+ --color-swan-300: #7d7b82;
84
+ --color-swan-200: #a8a7ac;
85
+ --color-swan-100: #d4d3d5;
86
+ --color-swan-50: #f4f3f5;
87
+ --color-swan-0: #f4f3f5;
88
+ --color-swan-primary: var(--color-swan-900);
89
+ --color-swan-secondary: var(--color-swan-400);
90
+ --color-swan-contrast: var(--color-white);
91
+
92
+ --color-dark-pink-900: #2e0d1d;
93
+ --color-dark-pink-800: #5d1b3b;
94
+ --color-dark-pink-700: #8b2858;
95
+ --color-dark-pink-600: #ba3676;
96
+ --color-dark-pink-500: #e84393;
97
+ --color-dark-pink-400: #ed69a9;
98
+ --color-dark-pink-300: #f18ebe;
99
+ --color-dark-pink-200: #f6b4d4;
100
+ --color-dark-pink-100: #fad9e9;
101
+ --color-dark-pink-50: #fef6fa;
102
+ --color-dark-pink-0: #fef6fa;
103
+ --color-dark-pink-primary: var(--color-dark-pink-600);
104
+ --color-dark-pink-secondary: var(--color-dark-pink-700);
105
+ --color-dark-pink-contrast: var(--color-white);
106
+
107
+ --color-medium-slade-blue-900: #21132f;
108
+ --color-medium-slade-blue-800: #42265e;
109
+ --color-medium-slade-blue-700: #63388c;
110
+ --color-medium-slade-blue-600: #844bbb;
111
+ --color-medium-slade-blue-500: #a55eea;
112
+ --color-medium-slade-blue-400: #b77eee;
113
+ --color-medium-slade-blue-300: #c99ef2;
114
+ --color-medium-slade-blue-200: #dbbff7;
115
+ --color-medium-slade-blue-100: #eddffb;
116
+ --color-medium-slade-blue-50: #fbf7fe;
117
+ --color-medium-slade-blue-0: #fbf7fe;
118
+ --color-medium-slade-blue-primary: var(--color-medium-slade-blue-600);
119
+ --color-medium-slade-blue-secondary: var(--color-medium-slade-blue-700);
120
+ --color-medium-slade-blue-contrast: var(--color-white);
121
+
122
+ --color-gray-900: #16141a;
123
+ --color-gray-800: #2d2b31;
124
+ --color-gray-700: #454348;
125
+ --color-gray-600: #5c5a5f;
126
+ --color-gray-500: #737276;
127
+ --color-gray-400: #8f8e91;
128
+ --color-gray-300: #abaaad;
129
+ --color-gray-200: #c7c7c8;
130
+ --color-gray-100: #e8e7e8;
131
+ --color-gray-75: #ededed;
132
+ --color-gray-50: #f4f4f4;
133
+ --color-gray-0: #f4f4f4;
134
+ --color-gray-primary: var(--color-gray-500);
135
+ --color-gray-secondary: var(--color-gray-700);
136
+ --color-gray-contrast: var(--color-white);
137
+
138
+ --color-live-900: #140d24;
139
+ --color-live-800: #271a48;
140
+ --color-live-700: #3b266d;
141
+ --color-live-600: #4e3391;
142
+ --color-live-500: #6240b5;
143
+ --color-live-400: #8166c4;
144
+ --color-live-300: #a18cd3;
145
+ --color-live-200: #c0b3e1;
146
+ --color-live-100: #e0d9f0;
147
+ --color-live-50: #f7f5fb;
148
+ --color-live-0: #f7f5fb;
149
+ --color-live-primary: var(--color-live-500);
150
+ --color-live-secondary: var(--color-live-600);
151
+ --color-live-contrast: var(--color-white);
152
+
153
+ --color-sandbox-900: #3d2325;
154
+ --color-sandbox-800: #643330;
155
+ --color-sandbox-700: #8b423b;
156
+ --color-sandbox-600: #b25246;
157
+ --color-sandbox-500: #d96151;
158
+ --color-sandbox-400: #e18174;
159
+ --color-sandbox-300: #e8a097;
160
+ --color-sandbox-200: #f0c0b9;
161
+ --color-sandbox-100: #f7dfdc;
162
+ --color-sandbox-50: #fdf7f6;
163
+ --color-sandbox-0: #fdf7f6;
164
+ --color-sandbox-primary: var(--color-sandbox-500);
165
+ --color-sandbox-secondary: var(--color-sandbox-600);
166
+ --color-sandbox-contrast: var(--color-white);
167
+
168
+ --color-positive-900: #062a1b;
169
+ --color-positive-800: #0c5436;
170
+ --color-positive-700: #137e50;
171
+ --color-positive-600: #19a86b;
172
+ --color-positive-500: #1fd286;
173
+ --color-positive-400: #4cdb9e;
174
+ --color-positive-300: #79e4b6;
175
+ --color-positive-200: #d2f6e7;
176
+ --color-positive-100: #f4fdf9;
177
+ --color-positive-50: #f4fdf9;
178
+ --color-positive-0: #f8fefb;
179
+ --color-positive-primary: var(--color-positive-700);
180
+ --color-positive-secondary: var(--color-positive-800);
181
+ --color-positive-contrast: var(--color-white);
182
+
183
+ --color-warning-900: #311f0f;
184
+ --color-warning-800: #623d1d;
185
+ --color-warning-700: #935c2c;
186
+ --color-warning-600: #c47a3a;
187
+ --color-warning-500: #f59949;
188
+ --color-warning-400: #f7ad6d;
189
+ --color-warning-300: #e59866;
190
+ --color-warning-200: #f9c292;
191
+ --color-warning-100: #fdebdb;
192
+ --color-warning-50: #fffaf6;
193
+ --color-warning-0: #fffcfa;
194
+ --color-warning-primary: var(--color-warning-700);
195
+ --color-warning-secondary: var(--color-warning-800);
196
+ --color-warning-contrast: var(--color-white);
197
+
198
+ --color-negative-900: #30090d;
199
+ --color-negative-800: #60111b;
200
+ --color-negative-700: #911a28;
201
+ --color-negative-600: #c12236;
202
+ --color-negative-500: #f12b43;
203
+ --color-negative-400: #f45569;
204
+ --color-negative-300: #f7808e;
205
+ --color-negative-200: #f9aab4;
206
+ --color-negative-100: #fcd5d9;
207
+ --color-negative-50: #fef4f6;
208
+ --color-negative-0: #fff9f9;
209
+ --color-negative-primary: var(--color-negative-600);
210
+ --color-negative-secondary: var(--color-negative-700);
211
+ --color-negative-contrast: var(--color-white);
212
+
213
+ /* White label defaults */
214
+ --color-partner-900: var(--color-swan-900);
215
+ --color-partner-800: var(--color-swan-800);
216
+ --color-partner-700: var(--color-swan-700);
217
+ --color-partner-600: var(--color-swan-600);
218
+ --color-partner-500: var(--color-swan-500);
219
+ --color-partner-400: var(--color-swan-400);
220
+ --color-partner-300: var(--color-swan-300);
221
+ --color-partner-200: var(--color-swan-200);
222
+ --color-partner-100: var(--color-swan-100);
223
+ --color-partner-50: var(--color-swan-50);
224
+ --color-partner-0: var(--color-swan-0);
225
+ --color-partner-primary: var(--color-partner-500);
226
+ --color-partner-secondary: var(--color-partner-600);
227
+ --color-partner-contrast: var(--color-white);
228
+
229
+ --color-shakespear-900: #132126;
230
+ --color-shakespear-800: #26414b;
231
+ --color-shakespear-700: #3a6271;
232
+ --color-shakespear-600: #4d8296;
233
+ --color-shakespear-500: #60a3bc;
234
+ --color-shakespear-400: #80b5c9;
235
+ --color-shakespear-300: #a0c8d7;
236
+ --color-shakespear-200: #bfdae4;
237
+ --color-shakespear-100: #dfedf2;
238
+ --color-shakespear-50: #f7fafc;
239
+ --color-shakespear-0: #f7fafc;
240
+ --color-shakespear-primary: var(--color-shakespear-700);
241
+ --color-shakespear-secondary: var(--color-shakespear-800);
242
+ --color-shakespear-contrast: var(--color-white);
243
+
244
+ --color-sunglow-900: #332a08;
245
+ --color-sunglow-800: #665411;
246
+ --color-sunglow-700: #997f19;
247
+ --color-sunglow-600: #cca922;
248
+ --color-sunglow-500: #ffd32a;
249
+ --color-sunglow-400: #ffdc55;
250
+ --color-sunglow-300: #ffe57f;
251
+ --color-sunglow-200: #ffedaa;
252
+ --color-sunglow-100: #fff6d4;
253
+ --color-sunglow-50: #fffdf4;
254
+ --color-sunglow-0: #fffef9;
255
+ --color-sunglow-primary: var(--color-sunglow-800);
256
+ --color-sunglow-secondary: var(--color-sunglow-900);
257
+ --color-sunglow-contrast: var(--color-white);
258
+
259
+ /* Default */
260
+ --color-current-900: var(--color-partner-900);
261
+ --color-current-800: var(--color-partner-800);
262
+ --color-current-700: var(--color-partner-700);
263
+ --color-current-600: var(--color-partner-600);
264
+ --color-current-500: var(--color-partner-500);
265
+ --color-current-400: var(--color-partner-400);
266
+ --color-current-300: var(--color-partner-300);
267
+ --color-current-200: var(--color-partner-200);
268
+ --color-current-100: var(--color-partner-100);
269
+ --color-current-50: var(--color-partner-50);
270
+ --color-current-0: var(--color-partner-50);
271
+ --color-current-primary: var(--color-partner-primary);
272
+ --color-current-secondary: var(--color-partner-secondary);
273
+ --color-current-contrast: var(--color-partner-contrast);
274
+
275
+ --color-background-light: #fafafa;
276
+ --color-background-light-50-transparency: #fafafa80;
277
+ --color-background-light-75-transparency: #fafafabf;
278
+ --color-background-light-90-transparency: #fafafae5;
279
+ --color-background-light-transparent: #fafafa00;
280
+ --color-background-light-accented: #ffffff;
281
+ --color-background-light-accented-50-transparency: #ffffff80;
282
+ --color-background-light-accented-75-transparency: #ffffffbf;
283
+ --color-background-light-accented-90-transparency: #ffffffe5;
284
+ --color-background-light-accented-transparent: #ffffff00;
285
+
286
+ --color-background-dark: #26232f;
287
+ --color-background-dark-transparent: #26232f00;
288
+ --color-background-dark-50-transparency: #26232f80;
289
+ --color-background-dark-75-transparency: #26232fbf;
290
+ --color-background-dark-90-transparency: #26232fe5;
291
+ --color-background-dark-accented: #35313f;
292
+ --color-background-dark-accented-transparent: #35313f00;
293
+ --color-background-dark-accented-50-transparency: #35313f80;
294
+ --color-background-dark-accented-75-transparency: #35313fbf;
295
+ --color-background-dark-accented-90-transparency: #35313fe5;
296
+
297
+ --color-background-default: var(--color-background-light);
298
+ --color-background-default-transparent: var(--color-background-light-transparent);
299
+ --color-background-default-50-transparency: var(--color-background-light-50-transparency);
300
+ --color-background-default-75-transparency: var(--color-background-light-75-transparency);
301
+ --color-background-default-90-transparency: var(--color-background-light-90-transparency);
302
+ --color-background-default-accented: var(--color-background-light-accented);
303
+ --color-background-default-accented-transparent: var(
304
+ --color-background-light-accented-transparent
305
+ );
306
+ --color-background-default-accented-50-transparency: var(
307
+ --color-background-light-accented-50-transparency
308
+ );
309
+ --color-background-default-accented-75-transparency: var(
310
+ --color-background-light-accented-75-transparency
311
+ );
312
+ --color-background-default-accented-90-transparency: var(
313
+ --color-background-light-accented-90-transparency
314
+ );
315
+
316
+ --gradient-vertical: linear-gradient(180deg, #8166c4 0%, #f2cbb2 70%);
317
+ --gradient-oblique: linear-gradient(128deg, #8266c4 20%, #f2cbb2 90%);
318
+
319
+ --focus-ring-color: #0019fe;
320
+
321
+ --font-family-primary: Inter, -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Helvetica,
322
+ Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji,
323
+ sans-serif;
324
+ --font-family-card-font: "Inter Card", monospace;
325
+ --font-family-code: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
326
+
327
+ --heading-color: var(--color-gray-900);
328
+ --heading-line-height: 1.25;
329
+
330
+ --heading-1-font-size: 32px;
331
+ --heading-1-font-weight: 400;
332
+ --heading-2-font-size: 32px;
333
+ --heading-2-font-weight: 300;
334
+ --heading-3-font-size: 20px;
335
+ --heading-3-font-weight: 600;
336
+ --heading-4-font-size: 20px;
337
+ --heading-4-font-weight: 400;
338
+ --heading-5-font-size: 15px;
339
+ --heading-5-font-weight: 500;
340
+ --heading-6-font-size: 15px;
341
+ --heading-6-font-weight: 400;
342
+
343
+ --text-color: var(--color-gray-500);
344
+ --text-line-height: 1.5;
345
+
346
+ --text-semibold-font-size: 15px;
347
+ --text-semibold-font-weight: 600;
348
+ --text-medium-font-size: 15px;
349
+ --text-medium-font-weight: 500;
350
+ --text-regular-font-size: 15px;
351
+ --text-regular-font-weight: 400;
352
+ --text-light-font-size: 15px;
353
+ --text-light-font-weight: 300;
354
+
355
+ --text-small-semibold-font-size: 14px;
356
+ --text-small-semibold-font-weight: 600;
357
+ --text-small-medium-font-size: 14px;
358
+ --text-small-medium-font-weight: 500;
359
+ --text-small-regular-font-size: 14px;
360
+ --text-small-regular-font-weight: 400;
361
+
362
+ --placeholder-color: var(--color-gray-400);
363
+ --placeholder-line-height: 1.5;
364
+
365
+ --placeholder-font-size: 15px;
366
+ --placeholder-font-weight: 400;
367
+
368
+ --placeholder-small-font-size: 14px;
369
+ --placeholder-small-font-weight: 400;
370
+ }
371
+
372
+ @media (prefers-reduced-motion: reduce) {
373
+ *,
374
+ *::before,
375
+ *::after {
376
+ animation-duration: 0.01ms !important;
377
+ animation-iteration-count: 1 !important;
378
+ transition-duration: 0.01ms !important;
379
+ scroll-behavior: auto !important;
380
+ }
381
+ }
382
+
383
+ [data-hide-scrollbar] {
384
+ scrollbar-width: none;
385
+ }
386
+
387
+ [data-hide-scrollbar]::-webkit-scrollbar {
388
+ display: none;
389
+ }
390
+
391
+ [data-force-scrollbar]::-webkit-scrollbar {
392
+ width: 8px;
393
+ height: 8px;
394
+ border-radius: 10px;
395
+ -webkit-appearance: none;
396
+ }
397
+
398
+ [data-force-scrollbar]::-webkit-scrollbar-thumb {
399
+ background-color: rgba(0, 0, 0, 0.5);
400
+ border-radius: 10px;
401
+ }
402
+
403
+ [tabindex="-1"] {
404
+ outline: none;
405
+ }
406
+
407
+ ::placeholder {
408
+ font-style: italic;
409
+ }
410
+
411
+ input[type="range"] {
412
+ -webkit-appearance: none;
413
+ appearance: none;
414
+ background: var(--color-gray-100);
415
+ cursor: pointer;
416
+ border-radius: 1px;
417
+ border-style: none;
418
+ height: 20px;
419
+ box-shadow: 0 0 0 2px var(--color-background-light-accented),
420
+ inset 0 0 0 9px var(--color-background-light-accented);
421
+ background-image: linear-gradient(var(--color-current-500), var(--color-current-500));
422
+ background-size: 0 100%;
423
+ background-repeat: no-repeat;
424
+ margin: 0 -10px;
425
+ }
426
+
427
+ input[type="range"]::-webkit-slider-runnable-track {
428
+ -webkit-appearance: none;
429
+ box-shadow: none;
430
+ border: none;
431
+ }
432
+
433
+ input[type="range"]::-webkit-slider-thumb {
434
+ box-shadow: inset 0 0 0 4px var(--color-current-500);
435
+ height: 20px;
436
+ width: 20px;
437
+ border-radius: 10px;
438
+ background: var(--color-background-light-accented);
439
+ cursor: pointer;
440
+ -webkit-appearance: none;
441
+ }
442
+
443
+ #app-root {
444
+ transition: 300ms ease-in-out transform, 300ms ease-in-out filter, 300ms ease-in-out opacity;
445
+ }
446
+
447
+ @media (prefers-reduced-motion: reduce) {
448
+ #app-root {
449
+ transform: none !important;
450
+ }
451
+ }
452
+
453
+ .BottomPanelOpen #app-root {
454
+ transform: scale(0.98);
455
+ filter: blur(4px);
456
+ }
457
+
458
+ .RightPanelOpen #app-root {
459
+ transform: scale(0.98);
460
+ filter: blur(4px);
461
+ }
462
+
463
+ .ModalOpen #app-root {
464
+ transform: scale(0.98);
465
+ filter: blur(4px);
466
+ }
@@ -1,8 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare function FilterChooser<FilterName extends string>({ filters, openFilters, label, title, availableFilters, large, onAddFilter, }: {
3
- filters: Partial<{
4
- [K in FilterName]: string | string[] | undefined;
5
- }>;
3
+ filters: Partial<Record<FilterName, unknown>>;
6
4
  openFilters: FilterName[];
7
5
  label: string;
8
6
  title: string;
@@ -36,12 +36,18 @@ export type FilterInputDef = {
36
36
  placeholder?: string;
37
37
  validate?: (value: string) => ValidatorResult;
38
38
  };
39
- type Filter<T> = FilterCheckboxDef<T> | FilterRadioDef<T> | FilterDateDef | FilterInputDef;
39
+ export type FilterBooleanDef = {
40
+ type: "boolean";
41
+ label: string;
42
+ };
43
+ type Filter<T> = FilterCheckboxDef<T> | FilterRadioDef<T> | FilterDateDef | FilterInputDef | FilterBooleanDef;
40
44
  type ExtractFilterValue<T extends Filter<unknown>> = T extends {
41
45
  type: "checkbox";
42
46
  } ? T["items"][number]["value"][] | undefined : T extends {
43
47
  type: "radio";
44
- } ? T["items"][number]["value"] | undefined : string | undefined;
48
+ } ? T["items"][number]["value"] | undefined : T extends {
49
+ type: "boolean";
50
+ } ? boolean | undefined : string | undefined;
45
51
  type FiltersDefinition = Record<string, Filter<unknown>>;
46
52
  export type FiltersState<T extends FiltersDefinition> = Simplify<{
47
53
  [K in keyof T]: Simplify<ExtractFilterValue<T[K]>>;
@@ -224,6 +224,10 @@ export const FiltersStack = ({ filters, openedFilters, definition, onChangeOpene
224
224
  onChangeFilters({ ...filters, [filterName]: undefined });
225
225
  onChangeOpened(openedFilters.filter(f => f !== filterName));
226
226
  } })))
227
+ .with({ type: "boolean" }, ({ label }) => (_jsx(Tag, { color: "current", onPressRemove: () => {
228
+ onChangeFilters({ ...filters, [filterName]: undefined });
229
+ onChangeOpened(openedFilters.filter(f => f !== filterName));
230
+ }, children: label })))
227
231
  .exhaustive() }, filterName));
228
232
  }) }));
229
233
  };
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { StyleSheet, Text } from "react-native";
3
+ import { Space } from "./Space";
3
4
  import { colors } from "../constants/colors";
4
5
  import { typography } from "../constants/typography";
5
- import { Space } from "./Space";
6
6
  const styles = StyleSheet.create({
7
7
  base: {
8
8
  ...typography.bodySmall,
@@ -2,6 +2,7 @@ import { AsyncData, Result } from "@swan-io/boxed";
2
2
  import { ForwardedRef, ReactNode, RefObject } from "react";
3
3
  import { IconName } from "./Icon";
4
4
  export type LakeComboboxProps<I> = {
5
+ inputRef?: RefObject<unknown>;
5
6
  value: string;
6
7
  items: AsyncData<Result<I[], unknown>>;
7
8
  ListFooterComponent?: ReactNode;
@@ -21,7 +22,7 @@ export type LakeComboboxRef = {
21
22
  close: () => void;
22
23
  open: () => void;
23
24
  };
24
- declare const LakeComboboxWithRef: <I>({ value, items, ListFooterComponent, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled, emptyResultText, readOnly, nativeID, error, }: LakeComboboxProps<I>, externalRef: ForwardedRef<LakeComboboxRef>) => JSX.Element;
25
+ declare const LakeComboboxWithRef: <I>({ inputRef, value, items, ListFooterComponent, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled, emptyResultText, readOnly, nativeID, error, }: LakeComboboxProps<I>, externalRef: ForwardedRef<LakeComboboxRef>) => JSX.Element;
25
26
  export declare const LakeCombobox: <I>(props: LakeComboboxProps<I> & {
26
27
  ref?: RefObject<LakeComboboxRef> | undefined;
27
28
  }) => ReturnType<typeof LakeComboboxWithRef>;
@@ -4,6 +4,7 @@ import { FlatList, Pressable, StyleSheet, Text, View, } from "react-native";
4
4
  import { backgroundColor, colors, spacings } from "../constants/design";
5
5
  import { typography } from "../constants/typography";
6
6
  import { useDisclosure } from "../hooks/useDisclosure";
7
+ import { useMergeRefs } from "../hooks/useMergeRefs";
7
8
  import { getFocusableElements } from "../utils/a11y";
8
9
  import { Box } from "./Box";
9
10
  import { Icon } from "./Icon";
@@ -80,8 +81,10 @@ const getItemLayout = (_data, index) => ({
80
81
  offset: ELEMENT_HEIGHT * index,
81
82
  index,
82
83
  });
83
- const LakeComboboxWithRef = ({ value, items, ListFooterComponent, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled = false, emptyResultText, readOnly, nativeID, error, }, externalRef) => {
84
+ const LakeComboboxWithRef = ({ inputRef, value, items, ListFooterComponent, onValueChange, onSelectItem, renderItem, keyExtractor, icon, placeholder, disabled = false, emptyResultText, readOnly, nativeID, error, }, externalRef) => {
84
85
  const ref = useRef(null);
86
+ // @ts-expect-error
87
+ const inputTextRef = useMergeRefs(ref, inputRef);
85
88
  const listRef = useRef(null);
86
89
  const listContainerRef = useRef(null);
87
90
  const blurTimeoutId = useRef(undefined);
@@ -140,7 +143,11 @@ const LakeComboboxWithRef = ({ value, items, ListFooterComponent, onValueChange,
140
143
  close();
141
144
  }, 100);
142
145
  }, [close]);
143
- return (_jsxs(View, { children: [_jsx(LakeTextInput, { ref: ref, style: styles.input, accessibilityExpanded: isFocused, accessibilityControls: isFocused ? suggestionsId : "", returnKeyType: "search", icon: icon, accessibilityRole: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, onChangeText: onValueChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, nativeID: nativeID, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus: true, returnFocus: false, visible: isFocused && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: styles.list, children: items.match({
146
+ return (_jsxs(View, { children: [_jsx(LakeTextInput
147
+ // @ts-expect-error
148
+ , {
149
+ // @ts-expect-error
150
+ ref: inputTextRef, style: styles.input, accessibilityExpanded: isFocused, accessibilityControls: isFocused ? suggestionsId : "", returnKeyType: "search", icon: icon, accessibilityRole: "combobox", placeholder: placeholder, value: value, disabled: disabled, error: error, onChangeText: onValueChange, onFocus: handleFocus, onBlur: handleBlur, onKeyPress: handleKeyPress, nativeID: nativeID, readOnly: readOnly }), _jsx(Popover, { id: suggestionsId, role: "listbox", matchReferenceWidth: true, onDismiss: close, referenceRef: ref, autoFocus: true, returnFocus: false, visible: isFocused && !items.isNotAsked(), underlay: false, forcedMode: "Dropdown", children: _jsx(View, { style: styles.list, children: items.match({
144
151
  NotAsked: () => null,
145
152
  Loading: () => _jsx(LoadingView, { style: styles.loader }),
146
153
  Done: items => items.match({
@@ -153,6 +160,7 @@ const LakeComboboxWithRef = ({ value, items, ListFooterComponent, onValueChange,
153
160
  focused && styles.focusedItem,
154
161
  pressed && styles.pressedItem,
155
162
  ], onPress: () => {
163
+ window.clearTimeout(blurTimeoutId.current);
156
164
  setIsFetchingAdditionalInfo(true);
157
165
  Promise.resolve(onSelectItem(item)).finally(() => {
158
166
  setIsFetchingAdditionalInfo(false);
@@ -1,12 +1,13 @@
1
1
  import { ReactNode } from "react";
2
2
  import { StyleProp, ViewStyle } from "react-native";
3
3
  import { ColorVariants } from "../constants/design";
4
+ type LabelType = "form" | "formSmall" | "view" | "viewSmall" | "radioGroup";
4
5
  type Props = {
5
6
  label: string;
6
7
  optionalLabel?: string;
7
8
  readOnlyColor?: string;
8
9
  color?: ColorVariants;
9
- type?: "form" | "formSmall" | "view" | "viewSmall";
10
+ type?: LabelType;
10
11
  extra?: () => ReactNode;
11
12
  help?: ReactNode;
12
13
  render: (id: string) => ReactNode;
@@ -14,6 +15,6 @@ type Props = {
14
15
  readOnly?: boolean;
15
16
  style?: StyleProp<ViewStyle>;
16
17
  };
17
- export declare const defaultLabelType: NonNullable<Props["type"]>;
18
+ export declare const defaultLabelType: LabelType;
18
19
  export declare const LakeLabel: ({ label, optionalLabel, extra, readOnly, color, readOnlyColor, type, help, render, actions, style, }: Props) => JSX.Element;
19
20
  export {};
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useRef, useState } from "react";
3
3
  import { StyleSheet, unstable_createElement, View, } from "react-native";
4
+ import { match } from "ts-pattern";
4
5
  import { v4 as uuid } from "uuid";
5
6
  import { commonStyles } from "../constants/commonStyles";
6
7
  import { colors, fonts, spacings, texts } from "../constants/design";
@@ -39,5 +40,9 @@ export const LakeLabel = ({ label, optionalLabel, extra, readOnly = false, color
39
40
  target?.focus();
40
41
  }
41
42
  }, [id]);
42
- return (_jsxs(Box, { style: [styles.container, style], direction: "row", alignItems: "center", justifyContent: "spaceBetween", children: [_jsxs(View, { style: commonStyles.fill, ref: containerRef, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", style: styles.shrink, children: [type === "form" || type === "formSmall" ? (_jsxs(Label, { onClick: onClick, htmlFor: id, style: [styles.label, readOnly && { color: readOnlyColor }], children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })) : (_jsxs(LakeText, { variant: "medium", color: readOnlyColor, nativeID: id, children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })), isNotNullish(extra) && extra()] }), isNotNullish(help) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), help] }))] }), _jsx(Space, { height: type === "formSmall" || type === "viewSmall" ? 4 : 8 }), _jsx(View, { accessibilityLabelledBy: type === "view" || type === "viewSmall" ? id : undefined, children: render(id) })] }), isNotNullish(actions) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), actions] }))] }));
43
+ return (_jsxs(Box, { style: [styles.container, style], direction: "row", alignItems: "center", justifyContent: "spaceBetween", children: [_jsxs(View, { style: commonStyles.fill, ref: containerRef, children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsxs(Box, { direction: "row", style: styles.shrink, children: [type === "form" || type === "formSmall" || type === "radioGroup" ? (_jsxs(Label, { onClick: onClick, htmlFor: id, style: [styles.label, readOnly && { color: readOnlyColor }], children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })) : (_jsxs(LakeText, { variant: "medium", color: readOnlyColor, nativeID: id, children: [label, optionalLabel != null ? (_jsxs(_Fragment, { children: [" - ", _jsx(LakeText, { color: colors.gray[400], style: styles.optionalLabel, children: optionalLabel })] })) : null] })), isNotNullish(extra) && extra()] }), isNotNullish(help) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), help] }))] }), _jsx(Space, { height: match(type)
44
+ .with("formSmall", "viewSmall", () => 4)
45
+ .with("form", "view", () => 8)
46
+ .with("radioGroup", () => 12)
47
+ .exhaustive() }), _jsx(View, { accessibilityLabelledBy: type === "view" || type === "viewSmall" ? id : undefined, children: render(id) })] }), isNotNullish(actions) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 16 }), actions] }))] }));
43
48
  };
@@ -128,5 +128,5 @@ export const LakeModal = ({ visible, icon, title, color = "current", children, m
128
128
  if (rootElement == null) {
129
129
  return null;
130
130
  }
131
- return (_jsx(Portal, { container: rootElement, children: _jsxs(View, { accessibilityModal: true, style: styles.container, pointerEvents: visible ? "auto" : "none", children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspense, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.tiny, children: ({ large, small }) => (_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: true, onEscapeKey: onPressClose, style: styles.trap, children: _jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: large ? styles.modalContentContainer : styles.modalContentContainerSmall, children: [onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null, _jsxs(View, { style: [large ? styles.modal : styles.modalSmall, { maxWidth }], children: [_jsxs(View, { style: styles.modalHeader, children: [_jsxs(View, { style: styles.modalIconTitle, children: [icon != null ? (_jsx(Icon, { name: icon, size: large ? 40 : 32, color: colors[color].primary })) : null, icon != null && title != null ? _jsx(Space, { height: 12 }) : null, title != null ? (_jsxs(_Fragment, { children: [_jsx(LakeHeading, { level: 2, variant: "h3", children: title }), _jsx(Space, { height: 12 })] })) : null, icon != null && title != null ? _jsx(Space, { height: 8 }) : null] }), onPressClose != null ? (_jsx(LakeButton, { style: styles.closeButton, mode: "tertiary", onPress: onPressClose, icon: "lake-close" })) : null] }), typeof children == "function" ? children({ large, small }) : children] })] }) })) })) : null }) })] }) }));
131
+ return (_jsx(Portal, { container: rootElement, children: _jsxs(View, { accessibilityModal: true, style: styles.container, pointerEvents: visible ? "auto" : "none", children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspense, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.tiny, children: ({ large, small }) => (_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: true, onEscapeKey: onPressClose, style: styles.trap, children: _jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: large ? styles.modalContentContainer : styles.modalContentContainerSmall, children: [onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null, _jsxs(View, { style: [large ? styles.modal : styles.modalSmall, { maxWidth }], children: [_jsxs(View, { style: styles.modalHeader, children: [_jsxs(View, { style: styles.modalIconTitle, children: [icon != null ? (_jsx(Icon, { name: icon, size: large ? 40 : 32, color: colors[color][500] })) : null, icon != null && title != null ? _jsx(Space, { height: 12 }) : null, title != null ? (_jsxs(_Fragment, { children: [_jsx(LakeHeading, { level: 2, variant: "h3", children: title }), _jsx(Space, { height: 12 })] })) : null] }), onPressClose != null ? (_jsx(LakeButton, { style: styles.closeButton, mode: "tertiary", onPress: onPressClose, icon: "lake-close" })) : null] }), typeof children == "function" ? children({ large, small }) : children] })] }) })) })) : null }) })] }) }));
132
132
  };
@@ -13,6 +13,9 @@ const linkStyle = {
13
13
  textDecoration: "none",
14
14
  };
15
15
  const styles = StyleSheet.create({
16
+ container: {
17
+ alignItems: "flex-end",
18
+ },
16
19
  bar: {
17
20
  width: "100%",
18
21
  height: 4,
@@ -70,7 +73,7 @@ export const LakeStepper = ({ steps, activeStepId, style }) => {
70
73
  .exhaustive())
71
74
  .flat();
72
75
  const activeStepIndex = stepIds.indexOf(activeStepId);
73
- return (_jsx(Grid, { numColumns: steps.length, horizontalSpace: 12, style: style, children: steps.map((step, index) => {
76
+ return (_jsx(Grid, { numColumns: steps.length, horizontalSpace: 12, style: [styles.container, style], children: steps.map((step, index) => {
74
77
  const stepNumber = index + 1;
75
78
  const currentId = match(step)
76
79
  .with({ id: P.string }, ({ id }) => id)
@@ -5,6 +5,7 @@ import { IconName } from "./Icon";
5
5
  export type LakeTextInputProps = Omit<TextInputProps, "editable" | "onChange"> & {
6
6
  error?: string;
7
7
  readOnly?: boolean;
8
+ validating?: boolean;
8
9
  valid?: boolean;
9
10
  disabled?: boolean;
10
11
  color?: ColorVariants;
@@ -21,6 +22,7 @@ export type LakeTextInputProps = Omit<TextInputProps, "editable" | "onChange"> &
21
22
  export declare const LakeTextInput: import("react").ForwardRefExoticComponent<Omit<TextInputProps, "editable" | "onChange"> & {
22
23
  error?: string | undefined;
23
24
  readOnly?: boolean | undefined;
25
+ validating?: boolean | undefined;
24
26
  valid?: boolean | undefined;
25
27
  disabled?: boolean | undefined;
26
28
  color?: "warning" | "current" | "gray" | "live" | "sandbox" | "positive" | "negative" | "partner" | "swan" | "shakespear" | "darkPink" | "sunglow" | "mediumSladeBlue" | undefined;