@geoinsight/react-components 0.8.6 → 0.8.8

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.
@@ -0,0 +1,673 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
2
+
3
+ :root {
4
+ box-sizing: border-box;
5
+ font-family: Poppins;
6
+ font-size: var(--font-size-16);
7
+
8
+ --font-size-10: 10px;
9
+ --font-size-12: 12px;
10
+ --font-size-14: 14px;
11
+ --font-size-16: 16px;
12
+ --font-size-18: 18px;
13
+ --font-size-20: 20px;
14
+ --font-size-24: 24px;
15
+ --font-size-32: 32px;
16
+ --font-size-40: 40px;
17
+
18
+ --spacing-4: 0.25rem;
19
+ --spacing-8: 0.5rem;
20
+ --spacing-16: 1rem;
21
+ --spacing-20: 1.25rem;
22
+ --spacing-24: 1.5rem;
23
+ --spacing-32: 2rem;
24
+ --spacing-40: 2.5rem;
25
+ --spacing-48: 3rem;
26
+ --spacing-64: 4rem;
27
+ --spacing-96: 6rem;
28
+ --spacing-128: 8rem;
29
+
30
+ --size-m: 12rem;
31
+
32
+ --color-black: #1d1d1d;
33
+ --color-white: #eee;
34
+
35
+ --color-neutral-200: #dedede;
36
+ --color-neutral-300: #c3c3c3;
37
+ --color-neutral-400: #afafaf;
38
+ --color-neutral-500: #818181;
39
+ --color-neutral-600: #6c6c6c;
40
+ --color-neutral-700: #403b3a;
41
+ --color-neutral-800: #201e1d;
42
+
43
+ --color-success: #20e52f;
44
+ --color-danger: #e52f20;
45
+
46
+ --transition-bg-cubic-bezier: background-color 500ms
47
+ cubic-bezier(0.1, 0.2, 0.3, 0.4);
48
+ --transition-color-cubic-bezier: color 500ms cubic-bezier(0.1, 0.2, 0.3, 0.4);
49
+ --transition-text-decoration-cubic-bezier: text-decoration 500ms cubic-bezier(0.1, 0.2, 0.3, 0.4);
50
+ --transition-box-shadow-cubic-bezier: box-shadow 500ms cubic-bezier(0.1, 0.2, 0.3, 0.4);
51
+
52
+
53
+ }
54
+
55
+ [data-theme="dark"] {
56
+ --color-neutral-900: var(--color-black);
57
+ --color-neutral-100: var(--color-white);
58
+ --color-primary: var(--color-primary-500);
59
+ --color-secondary: var(--color-primary-600);
60
+
61
+ color: var(--color-neutral-100) !important;
62
+ background-color: var(--color-neutral-900) !important;
63
+ }
64
+
65
+ [data-theme="light"] {
66
+ --color-neutral-900: var(--color-white);
67
+ --color-neutral-100: var(--color-black);
68
+ --color-primary: var(--color-primary-600);
69
+ --color-secondary: var(--color-primary-500);
70
+ color: var(--color-neutral-900) !important;
71
+ background-color: var(--color-neutral-100) !important;
72
+ }
73
+
74
+ @media (prefers-color-scheme: dark) {
75
+ html {
76
+ color-scheme: dark;
77
+ }
78
+ body {
79
+ color: var(--color-neutral-100);
80
+ background-color: var(--color-neutral-900);
81
+ }
82
+ }
83
+
84
+ [data-palette="water"] {
85
+ --color-primary-100: #d6efff;
86
+ --color-primary-200: #ade0ff;
87
+ --color-primary-300: #85d0ff;
88
+ --color-primary-400: #5cc0ff;
89
+ --color-primary-500: #33b1ff;
90
+ --color-primary-600: #009eff;
91
+ --color-primary-700: #008ae0;
92
+ --color-primary-800: #0071b8;
93
+ --color-primary-900: #00588f;
94
+ }
95
+
96
+ [data-palette="earth"]{
97
+ --color-primary-100: #f6e3cb;
98
+ --color-primary-200: #edc897;
99
+ --color-primary-300: #eabe86;
100
+ --color-primary-400: #e3ac63;
101
+ --color-primary-500: #dd9940;
102
+ --color-primary-600: #ca8323;
103
+ --color-primary-700: #ad701f;
104
+ --color-primary-800: #8b5918;
105
+ --color-primary-900: #684312;
106
+ }
107
+
108
+ [data-palette="forest"] {
109
+ --color-primary-100: #bee8b0;
110
+ --color-primary-200: #a4df90;
111
+ --color-primary-300: #8ad671;
112
+ --color-primary-400: #70cd51;
113
+ --color-primary-500: #54b435;
114
+ --color-primary-600: #4a9e2e;
115
+ --color-primary-700: #3b7e25;
116
+ --color-primary-800: #2c5f1c;
117
+ --color-primary-900: #1e3f12;
118
+ }
119
+ .accordion {
120
+ display: flex;
121
+ flex-direction: column;
122
+ gap: var(--spacing-4);
123
+ }
124
+
125
+ .accordion-item {
126
+ display: flex;
127
+ flex-direction: column;
128
+ gap: var(--spacing-4);
129
+ }
130
+
131
+ .accordion-button.button {
132
+ border: unset;
133
+ border-radius: var(--spacing-8);
134
+ color: var(--color-neutral-900);
135
+ justify-content: flex-end;
136
+ }
137
+
138
+ .accordion-button__button.button {
139
+ gap: 8px;
140
+ padding: var(--spacing-8) var(--spacing-8) var(--spacing-8) var(--spacing-16);
141
+ }
142
+
143
+ .accordion-button__link.button {
144
+ padding: var(--spacing-4) var(--spacing-32) var(--spacing-4) var(--spacing-16);
145
+ }
146
+
147
+ .accordion-button__link.button:hover {
148
+ background-color: var(--color-primary) !important;
149
+ box-shadow: 0 4px 4px 0 var(--color-neutral-400);
150
+ transition: var(--transition-bg-cubic-bezier), var(--transition-box-shadow-cubic-bezier);
151
+ color: var(--color-neutral-900);
152
+ text-decoration: unset;
153
+ text-underline-offset: unset;
154
+ }
155
+
156
+ .accordion-button__button--dark.button {
157
+ background-color: var(--color-neutral-400);
158
+ }
159
+
160
+ .accordion-button__button--light.button {
161
+ background-color: var(--color-neutral-800);
162
+ }
163
+
164
+ .accordion-button__link--dark.button {
165
+ background-color: var(--color-neutral-200) !important;
166
+ }
167
+
168
+ .accordion-button__link--light.button {
169
+ background-color: var(--color-neutral-700) !important;
170
+ }
171
+
172
+ .accordion-content {
173
+ border-radius: var(--spacing-8);
174
+ /* color: var(--color-neutral-100); */
175
+ display: flex;
176
+ flex-direction: column;
177
+ gap: var(--spacing-4);
178
+ padding: 0 0 var(--spacing-8) var(--spacing-16);
179
+ }
180
+
181
+ /* .accordion__title {
182
+ border-radius: var(--spacing-8);
183
+ background-color: var(--color-neutral-700);
184
+ color: var(--color-neutral-100);
185
+ justify-content: flex-end;
186
+ gap: 8px;
187
+ padding: var(--spacing-8) var(--spacing-8) var(--spacing-8) var(--spacing-16);
188
+ }
189
+
190
+ .accordion__menu {
191
+ display: flex;
192
+ flex-direction: column;
193
+ gap: var(--spacing-4);
194
+ padding: 0 0 var(--spacing-8) var(--spacing-16);
195
+ } */
196
+ /*
197
+ .accordion__child {
198
+ border-radius: var(--spacing-8);
199
+ background-color: var(--color-neutral-200);
200
+ color: var(--color-neutral-900);
201
+ font-size: var(--font-size-14);
202
+ }
203
+
204
+ .accordion__child--active {
205
+ background-color: var(--color-neutral-500);
206
+ } */
207
+ /*
208
+ .accordion__check {
209
+ color: var(--color-neutral-500);
210
+ margin-right: calc(var(--spacing-24) * -1);
211
+ position: absolute;
212
+ right: 0;
213
+ } */
214
+
215
+ .button {
216
+ align-items: center;
217
+ border-radius: var(--spacing-32);
218
+ border: none;
219
+ cursor: pointer;
220
+ display: flex;
221
+ justify-content: center;
222
+ gap: var(--spacing-8);
223
+ font-size: var(--font-size-16);
224
+ }
225
+
226
+ /*
227
+ .button--active {
228
+ background-color: var(--color-neutral-500) !important;
229
+ } */
230
+
231
+ .button:disabled {
232
+ cursor: unset;
233
+ opacity: 0.5;
234
+ pointer-events: none;
235
+ }
236
+
237
+ .button:hover {
238
+ background-color: var(--color-primary);
239
+ transition: var(--transition-bg-cubic-bezier);
240
+ }
241
+
242
+ .button__link {
243
+ background-color: unset !important;
244
+ color: var(--color-neutral-100);
245
+ text-decoration: underline transparent;
246
+ }
247
+
248
+ .button__link:hover {
249
+ color: var(--color-primary);
250
+ text-decoration: underline 0.1rem var(--color-primary);
251
+ text-underline-offset: var(--spacing-8);
252
+ transition: var(--transition-color-cubic-bezier),
253
+ var(--transition-text-decoration-cubic-bezier);
254
+ }
255
+
256
+ .button__primary {
257
+ background-color: var(--color-secondary);
258
+ border: 3px solid var(--color-primary);
259
+ }
260
+
261
+ .button__primary:hover {
262
+ box-shadow: 0 4px 4px 0 var(--color-neutral-400);
263
+ transition: var(--transition-bg-cubic-bezier), var(--transition-box-shadow-cubic-bezier);
264
+ }
265
+
266
+ .button__secondary {
267
+ background-color: var(--color-neutral-900);
268
+ border: 3px solid var(--color-primary);
269
+ color: var(--color-neutral-100);
270
+ }
271
+
272
+ .button__secondary:hover {
273
+ background-color: var(--color-primary);
274
+ }
275
+
276
+ .button__icon {
277
+ background-color: unset;
278
+ }
279
+
280
+ .button__icon:hover {
281
+ box-shadow: unset;
282
+ }
283
+
284
+ .button__small {
285
+ padding: var(--spacing-4);
286
+ }
287
+
288
+ .button__medium {
289
+ padding: var(--spacing-8) var(--spacing-24);
290
+ }
291
+
292
+ .button__large {
293
+ padding: var(--spacing-16);
294
+ }
295
+
296
+ .form {
297
+ align-items: center;
298
+ display: flex;
299
+ flex-direction: column;
300
+ gap: var(--spacing-32);
301
+ padding: var(--spacing-32) 0;
302
+ }
303
+
304
+ .form__message {
305
+ align-items: center;
306
+ display: flex;
307
+ justify-content: center;
308
+ gap: var(--spacing-16);
309
+ }
310
+ .input-group {
311
+ display: flex;
312
+ flex-direction: column;
313
+ align-items: flex-start;
314
+ position: relative;
315
+ width: 100%;
316
+ }
317
+
318
+ .input-subgroup {
319
+ display: flex;
320
+ flex-direction: column;
321
+ align-items: flex-start;
322
+ position: relative;
323
+ width: 100%;
324
+ }
325
+
326
+ .input {
327
+ box-sizing: border-box;
328
+ background-color: var(--color-white);
329
+ border-radius: var(--spacing-8);
330
+ border: 2px solid var(--color-primary);
331
+ color: var(--color-black);
332
+ padding: var(--spacing-16) var(--spacing-24);
333
+ font-size: var(--font-size-16);
334
+ width: 100%;
335
+ }
336
+
337
+ .input__header {
338
+ align-items: center;
339
+ display: flex;
340
+ justify-content: space-between;
341
+ width: 100%;
342
+ }
343
+
344
+ .input__header--error {
345
+ font-size: 12px;
346
+ color: var(--color-danger);
347
+ }
348
+
349
+ .input--icon {
350
+ padding: var(--spacing-16) var(--spacing-40);
351
+ }
352
+
353
+ .input__icon {
354
+ /* padding-top: var(--spacing-8); */
355
+ padding: var(--spacing-16) var(--spacing-16);
356
+ position: absolute;
357
+ }
358
+
359
+ .input__icon--right {
360
+ right: 0;
361
+ }
362
+
363
+ .input__icon--left {
364
+ left: 0;
365
+ }
366
+
367
+ .input:enabled:hover {
368
+ box-shadow: 2px 6px 4px 0 var(--color-neutral-400);
369
+ transition: var(--transition-box-shadow-cubic-bezier);
370
+ }
371
+
372
+ .input:focus {
373
+ box-shadow: 2px 6px 4px 0 var(--color-neutral-400);
374
+ transition: var(--transition-box-shadow-cubic-bezier);
375
+ outline: none;
376
+ }
377
+
378
+ .input:disabled {
379
+ opacity: 0.5;
380
+ }
381
+
382
+ .input--error {
383
+ border: 3px solid var(--color-danger) !important;
384
+ }
385
+
386
+ .input--error:focus {
387
+ border: 3px solid var(--color-danger);
388
+ outline: none;
389
+ }
390
+ .textarea {
391
+ margin-bottom: var(--spacing-8);
392
+ position: relative;
393
+ width: 100%;
394
+ }
395
+
396
+ .textarea__header {
397
+ align-items: center;
398
+ display: flex;
399
+ justify-content: space-between;
400
+ width: 100%;
401
+ }
402
+
403
+ .textarea__header--error {
404
+ font-size: 12px;
405
+ color: var(--color-danger);
406
+
407
+ }
408
+
409
+ .textarea__input {
410
+ background-color: var(--color-white);
411
+ box-sizing: border-box;
412
+ border-radius: var(--spacing-8);
413
+ border: 2px solid var(--color-primary);
414
+ cursor: text;
415
+ color: var(--color-black);
416
+ outline: none;
417
+ padding: var(--spacing-8) var(--spacing-16);
418
+ resize: vertical;
419
+ width: 100%;
420
+ }
421
+
422
+ .textarea__input--error {
423
+ border: 3px solid var(--color-danger);
424
+ }
425
+
426
+ .textarea__input:enabled:hover {
427
+ box-shadow: 4px 6px 4px 0 var(--color-neutral-400);
428
+ transition: var(--transition-box-shadow-cubic-bezier);
429
+ }
430
+
431
+ .textarea__input:disabled {
432
+ opacity: 0.5;
433
+ }
434
+
435
+ .textarea__button {
436
+ background: var(--color-primary);
437
+ border: 2px solid var(--color-secondary);
438
+ box-shadow: 2px 4px 2px 1px rgba(0, 0, 0, 0.25);
439
+ border-radius: 0px 0px var(--spacing-8) var(--spacing-8);
440
+ bottom: 0;
441
+ cursor: pointer;
442
+ left: 0;
443
+ padding-bottom: -20px;
444
+ position: absolute;
445
+ width: 100%;
446
+ }
447
+
448
+ .textarea__button--error {
449
+ background: var(--color-danger) !important;
450
+ border: 3px solid var(--color-danger);
451
+ }
452
+
453
+ .textarea__button > svg {
454
+ color: var(--color-neutral-100);
455
+ }
456
+
457
+ .textarea__button:disabled {
458
+ cursor: unset;
459
+ opacity: 0.5;
460
+ pointer-events: none;
461
+ }
462
+
463
+ .textarea__button:enabled:hover {
464
+ background: var(--color-secondary);
465
+ color: var(--color-neutral-100);
466
+ }
467
+
468
+ .textarea__button--show {
469
+ background: var(--color-primary-700);
470
+ color: var(--color-neutral-100);
471
+ }
472
+
473
+ .select-group {
474
+ display: flex;
475
+ flex-direction: column;
476
+ align-items: flex-start;
477
+ position: relative;
478
+ width: 100%;
479
+ }
480
+
481
+ .select {
482
+ box-sizing: border-box;
483
+ background-color: var(--color-white);
484
+ border-radius: var(--spacing-8);
485
+ border: 2px solid var(--color-primary);
486
+ color: var(--color-black);
487
+ padding: var(--spacing-16) var(--spacing-24);
488
+ font-size: var(--font-size-16);
489
+ width: 100%;
490
+ }
491
+
492
+ /* .select:enabled:hover {
493
+ border: 3px solid var(--color-primary-700);
494
+ }
495
+
496
+ .select:focus {
497
+ border: 3px solid var(--color-primary-700);
498
+ outline: none;
499
+ } */
500
+
501
+ .select:disabled {
502
+ opacity: 0.5;
503
+ }
504
+
505
+ .select__arrow.input__icon {
506
+ padding: 0;
507
+ }
508
+
509
+ .select__arrow-button.button {
510
+ border-radius: 0 var(--spacing-8) var(--spacing-8) 0;
511
+ padding: 15px var(--spacing-24);
512
+ }
513
+
514
+ .select__box {
515
+ background-color: var(--color-white);
516
+ border-radius: var(--spacing-8);
517
+ border: 2px solid var(--color-primary);
518
+ box-sizing: border-box;
519
+ max-height: var(--size-m);
520
+ overflow: scroll;
521
+ position: absolute;
522
+ top: 100%;
523
+ width: 100%;
524
+ z-index: 2;
525
+ }
526
+
527
+ .select__option.button {
528
+ text-align: left;
529
+ border: none;
530
+ border-radius: 0;
531
+ width: 100%;
532
+ }
533
+
534
+ .select__option.button:last-child {
535
+ border-radius: 0 0 var(--spacing-8) var(--spacing-8);
536
+ }
537
+ .select__option.button:first-child {
538
+ border-radius: var(--spacing-8) var(--spacing-8) 0 0;
539
+ }
540
+ .select--error {
541
+ border: 3px solid var(--color-danger);
542
+ }
543
+
544
+ .select--error:focus {
545
+ border: 3px solid var(--color-danger);
546
+ outline: none;
547
+ }
548
+
549
+ .loading {
550
+ align-items: center;
551
+ display: flex;
552
+ flex-direction: column;
553
+ height: 100%;
554
+ justify-content: center;;
555
+ position: relative;
556
+ }
557
+
558
+ .modal-overlay {
559
+ background: rgba(0, 0, 0, 0.3);
560
+ bottom: 0;
561
+ left: 0;
562
+ position: fixed;
563
+ right: 0;
564
+ top: 0;
565
+ }
566
+
567
+ .modal {
568
+ background: white;
569
+ border-radius: var(--spacing-8);
570
+ border: 1px solid var(--color-neutral-600);
571
+ color: var(--color-black);
572
+ left: 50%;
573
+ padding: var(--spacing-4) var(--spacing-4);
574
+ position: absolute;
575
+ right: var(--spacing-16);
576
+ top: 50%;
577
+ transform: translate(-50%, -50%);
578
+ z-index: 5;
579
+ }
580
+
581
+ .modal__close {
582
+ position: absolute;
583
+ right: calc(var(--spacing-16) * -1);
584
+ top: calc(var(--spacing-16) * -1);
585
+ z-index: 5;
586
+ }
587
+
588
+ .modal__content {
589
+ border: 1px solid var(--color-neutral-100);
590
+ border-radius: var(--spacing-8);
591
+ display: flex;
592
+ flex-direction: column;
593
+ gap: var(--spacing-16);
594
+ padding: 0 var(--spacing-16);
595
+ }
596
+
597
+ .modal__footer {
598
+ padding-bottom: var(--spacing-16);
599
+ }
600
+ .control {
601
+ display: flex;
602
+ flex-direction: column;
603
+ gap: var(--spacing-16);
604
+ position: absolute;
605
+ margin: var(--spacing-4);
606
+ }
607
+
608
+ .control--top-left {
609
+ top: 0;
610
+ }
611
+
612
+ .control--top-right {
613
+ align-items: end;
614
+ right: 0;
615
+ top: 0;
616
+ }
617
+
618
+ .control--bottom-left {
619
+ bottom: 0;
620
+ }
621
+
622
+ .control--bottom-right {
623
+ align-items: end;
624
+ bottom: 0;
625
+ right: 0;
626
+ }
627
+
628
+ .control--top-center {
629
+ left: 40%;
630
+ top: 0;
631
+ }
632
+
633
+ .control--center-left {
634
+ position: absolute;
635
+ left: 0;
636
+ top: 40%;
637
+ }
638
+
639
+ .control--center {
640
+ left: 50%;
641
+ top: 50%;
642
+ }
643
+
644
+ .control--center-right {
645
+ right: 0;
646
+ top: 40%;
647
+ }
648
+
649
+ .control--bottom-center {
650
+ bottom: 0;
651
+ left: 40%;
652
+ top: auto;
653
+ }
654
+
655
+ .map {
656
+ position: relative;
657
+ height: 100%;
658
+ }
659
+
660
+ .map__attribution {
661
+ display: flex;
662
+ flex-direction: row;
663
+ gap: var(--spacing-4);
664
+ }
665
+
666
+ .map__attribution a {
667
+ font-size: var(--font-size-12);
668
+ padding: 0;
669
+ }
670
+
671
+ .map__attribution a:hover {
672
+ text-underline-offset: var(--spacing-4);
673
+ }
package/dist/esm/index.js CHANGED
@@ -358,8 +358,8 @@ function Loading({ img, children }) {
358
358
  return (jsxs("div", { className: "loading", children: [jsx("img", { src: img ? img : "../../stories/assets/loading.gif" }), children] }));
359
359
  }
360
360
 
361
- function Modal({ modalref, children, title, subtitle, footer, hasCloseButton = true, handleClose, }) {
362
- return (jsxs(Fragment, { children: [jsx("div", { className: "modal-overlay" }), jsxs("div", { ref: modalref, className: "modal", children: [hasCloseButton && (jsx(Button, { mode: "secondary", className: "modal__close", size: "small", onClick: handleClose, children: jsx(IoClose, {}) })), jsxs("div", { className: "modal__content", children: [title && (jsxs("div", { className: "modal__header", children: [jsx("h3", { children: title }), jsx("h6", { children: subtitle })] })), jsx("div", { className: "modal__children", children: children }), footer && jsx("div", { className: "modal__footer", children: footer })] })] })] }));
361
+ function Modal({ modalref, children, title, subtitle, footer, hasCloseButton = true, handleClose, ...rest }) {
362
+ return (jsxs(Fragment, { children: [jsx("div", { className: "modal-overlay" }), jsxs("div", { ref: modalref, className: "modal", ...rest, children: [hasCloseButton && (jsx(Button, { mode: "secondary", className: "modal__close", size: "small", onClick: handleClose, children: jsx(IoClose, {}) })), jsxs("div", { className: "modal__content", children: [title && (jsxs("div", { className: "modal__header", children: [jsx("h3", { children: title }), jsx("h6", { children: subtitle })] })), jsx("div", { className: "modal__children", children: children }), footer && jsx("div", { className: "modal__footer", children: footer })] })] })] }));
363
363
  }
364
364
 
365
365
  function MapControl({ children, position = "top-right" }) {
@@ -470,6 +470,8 @@ const defaultState = {
470
470
  content: undefined,
471
471
  hasCloseButton: true,
472
472
  footer: undefined,
473
+ isCustom: false,
474
+ customRef: undefined
473
475
  };
474
476
  function ModalProvider({ children }) {
475
477
  const ref = useRef(null);
@@ -491,6 +493,11 @@ function ModalProvider({ children }) {
491
493
  !ref.current.contains(e.target)) {
492
494
  closeModal();
493
495
  }
496
+ if (state.isModal &&
497
+ state.customRef.current &&
498
+ !state.customRef.current.contains(e.target)) {
499
+ closeModal();
500
+ }
494
501
  };
495
502
  document.addEventListener("mousedown", listener);
496
503
  return () => {
@@ -502,7 +509,7 @@ function ModalProvider({ children }) {
502
509
  state,
503
510
  openModal,
504
511
  closeModal,
505
- }, children: [children, state.isModal && (jsx(Modal, { modalref: ref, title: state.title, footer: state.footer, handleClose: closeModal, subtitle: state.subtitle, children: state.content }))] }));
512
+ }, children: [children, state.isModal && !state.isCustom && (jsx(Modal, { modalref: ref, title: state.title, footer: state.footer, handleClose: closeModal, subtitle: state.subtitle, children: state.content }))] }));
506
513
  }
507
514
  function useModal({} = {}) {
508
515
  const context = useContext(ModalContext);