@icure/form 1.1.26 → 2.0.2

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 (46) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/components/common/metadata-buttons-bar.js +66 -15
  3. package/components/common/metadata-buttons-bar.js.map +1 -1
  4. package/components/icure-button/index.js +66 -15
  5. package/components/icure-button/index.js.map +1 -1
  6. package/components/icure-button-group/index.js +66 -15
  7. package/components/icure-button-group/index.js.map +1 -1
  8. package/components/icure-date-picker/index.js +70 -18
  9. package/components/icure-date-picker/index.js.map +1 -1
  10. package/components/icure-dropdown-field/index.js +66 -15
  11. package/components/icure-dropdown-field/index.js.map +1 -1
  12. package/components/icure-form/index.js +66 -15
  13. package/components/icure-form/index.js.map +1 -1
  14. package/components/icure-form/renderer/form/form-selection-button.d.ts +6 -1
  15. package/components/icure-form/renderer/form/form-selection-button.js +1126 -58
  16. package/components/icure-form/renderer/form/form-selection-button.js.map +1 -1
  17. package/components/icure-form/renderer/form/form.js +22 -19
  18. package/components/icure-form/renderer/form/form.js.map +1 -1
  19. package/components/icure-label/index.js +66 -15
  20. package/components/icure-label/index.js.map +1 -1
  21. package/components/icure-text-field/index.js +66 -15
  22. package/components/icure-text-field/index.js.map +1 -1
  23. package/components/model/index.d.ts +7 -1
  24. package/components/model/index.js +47 -3
  25. package/components/model/index.js.map +1 -1
  26. package/components/themes/default/index.js +2 -0
  27. package/components/themes/default/index.js.map +1 -1
  28. package/components/themes/icure-blue/index.js +2 -0
  29. package/components/themes/icure-blue/index.js.map +1 -1
  30. package/components/themes/kendo/index.js +2 -0
  31. package/components/themes/kendo/index.js.map +1 -1
  32. package/generic/model.d.ts +6 -5
  33. package/generic/model.js.map +1 -1
  34. package/icure/form-values-container.d.ts +31 -17
  35. package/icure/form-values-container.js +134 -75
  36. package/icure/form-values-container.js.map +1 -1
  37. package/package.json +1 -1
  38. package/utils/code-utils.d.ts +2 -0
  39. package/utils/code-utils.js +4 -1
  40. package/utils/code-utils.js.map +1 -1
  41. package/utils/fields-values-provider.d.ts +4 -9
  42. package/utils/fields-values-provider.js +6 -15
  43. package/utils/fields-values-provider.js.map +1 -1
  44. package/utils/form-value-container.d.ts +1 -1
  45. package/utils/form-value-container.js +25 -36
  46. package/utils/form-value-container.js.map +1 -1
@@ -12,80 +12,1141 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.FormSelectionButton = void 0;
13
13
  const lit_1 = require("lit");
14
14
  const decorators_js_1 = require("lit/decorators.js");
15
+ // @ts-ignore
16
+ const lit_2 = require("lit");
17
+ const baseCss = (0, lit_2.css) `@charset "UTF-8";
18
+ :host {
19
+ --bg-color-1: #f44336;
20
+ }
21
+
22
+ .ProseMirror {
23
+ position: relative;
24
+ width: 100%;
25
+ word-wrap: break-word;
26
+ white-space: pre-wrap;
27
+ -webkit-font-variant-ligatures: none;
28
+ font-variant-ligatures: none;
29
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
30
+ padding: 6px 8px 2px 8px;
31
+ line-height: 1.2;
32
+ color: #274768;
33
+ font-size: 14px;
34
+ font-weight: 400;
35
+ outline: none;
36
+ }
37
+ .ProseMirror p:last-child,
38
+ .ProseMirror h1:last-child,
39
+ .ProseMirror h2:last-child,
40
+ .ProseMirror h3:last-child,
41
+ .ProseMirror h4:last-child,
42
+ .ProseMirror h5:last-child,
43
+ .ProseMirror h6:last-child {
44
+ margin-bottom: 2px;
45
+ }
46
+ .ProseMirror p {
47
+ margin-bottom: 1em;
48
+ }
49
+ .ProseMirror pre {
50
+ white-space: pre-wrap;
51
+ }
52
+ .ProseMirror li {
53
+ position: relative;
54
+ }
55
+ .ProseMirror ul,
56
+ .ProseMirror ol {
57
+ padding-left: 30px;
58
+ }
59
+ .ProseMirror blockquote {
60
+ padding-left: 1em;
61
+ border-left: 3px solid #eee;
62
+ margin-left: 0;
63
+ margin-right: 0;
64
+ }
65
+
66
+ .ProseMirror-hideselection {
67
+ caret-color: transparent;
68
+ }
69
+ .ProseMirror-hideselection *::selection {
70
+ background: transparent;
71
+ }
72
+ .ProseMirror-hideselection *::-moz-selection {
73
+ background: transparent;
74
+ }
75
+
76
+ .ProseMirror-selectednode {
77
+ outline: 2px solid #8cf;
78
+ }
79
+
80
+ /* Make sure li selections wrap around markers */
81
+ li.ProseMirror-selectednode {
82
+ outline: none;
83
+ }
84
+ li.ProseMirror-selectednode :after {
85
+ content: "";
86
+ position: absolute;
87
+ left: -32px;
88
+ right: -2px;
89
+ top: -2px;
90
+ bottom: -2px;
91
+ border: 2px solid #8cf;
92
+ pointer-events: none;
93
+ }
94
+
95
+ .ProseMirror-gapcursor {
96
+ display: none;
97
+ pointer-events: none;
98
+ position: absolute;
99
+ }
100
+ .ProseMirror-gapcursor:after {
101
+ content: "";
102
+ display: block;
103
+ position: absolute;
104
+ top: -2px;
105
+ width: 20px;
106
+ border-top: 1px solid black;
107
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
108
+ }
109
+
110
+ @keyframes ProseMirror-cursor-blink {
111
+ to {
112
+ visibility: hidden;
113
+ }
114
+ }
115
+ .ProseMirror-focused .ProseMirror-gapcursor {
116
+ display: block;
117
+ }
118
+
119
+ /* Add space around the hr to make clicking it easier */
120
+ .ProseMirror-example-setup-style hr {
121
+ padding: 2px 10px;
122
+ border: none;
123
+ margin: 1em 0;
124
+ }
125
+ .ProseMirror-example-setup-style hr:after {
126
+ content: "";
127
+ display: block;
128
+ height: 1px;
129
+ background: silver;
130
+ line-height: 2px;
131
+ }
132
+
133
+ .ProseMirror-example-setup-style img {
134
+ cursor: default;
135
+ }
136
+
137
+ .ProseMirror-prompt {
138
+ background: white;
139
+ padding: 5px 10px 5px 15px;
140
+ border: 1px solid silver;
141
+ position: fixed;
142
+ border-radius: 3px;
143
+ z-index: 11;
144
+ box-shadow: -0.5px 2px 5px rgba(0, 0, 0, 0.2);
145
+ }
146
+ .ProseMirror-prompt h5 {
147
+ margin: 0;
148
+ font-weight: normal;
149
+ font-size: 100%;
150
+ color: #444;
151
+ }
152
+ .ProseMirror-prompt input[type=text],
153
+ .ProseMirror-prompt textarea {
154
+ background: #eee;
155
+ border: none;
156
+ outline: none;
157
+ }
158
+ .ProseMirror-prompt input[type=text] {
159
+ padding: 0 4px;
160
+ }
161
+
162
+ .ProseMirror-prompt-close {
163
+ position: absolute;
164
+ left: 2px;
165
+ top: 1px;
166
+ color: #666;
167
+ border: none;
168
+ background: transparent;
169
+ padding: 0;
170
+ }
171
+ .ProseMirror-prompt-close:after {
172
+ content: "✕";
173
+ font-size: 12px;
174
+ }
175
+
176
+ .ProseMirror-invalid {
177
+ background: #ffc;
178
+ border: 1px solid #cc7;
179
+ border-radius: 4px;
180
+ padding: 5px 10px;
181
+ position: absolute;
182
+ min-width: 10em;
183
+ }
184
+
185
+ .ProseMirror-prompt-buttons {
186
+ margin-top: 5px;
187
+ display: none;
188
+ }
189
+
190
+ #editor,
191
+ .editor {
192
+ color: rgb(101, 101, 101);
193
+ background-clip: padding-box;
194
+ border-radius: 4px;
195
+ border: 2px solid rgba(0, 0, 0, 0.2);
196
+ padding: 5px 0;
197
+ display: flex;
198
+ align-items: flex-end;
199
+ }
200
+
201
+ .icure-input {
202
+ background: #edf2f7;
203
+ border-radius: 8px;
204
+ border: none;
205
+ min-height: 28px;
206
+ height: auto;
207
+ display: flex;
208
+ flex-flow: row nowrap;
209
+ align-items: flex-start;
210
+ justify-content: space-between;
211
+ }
212
+
213
+ #editor {
214
+ background: transparent;
215
+ border: none;
216
+ padding: 0;
217
+ flex-grow: 1;
218
+ display: flex;
219
+ align-items: stretch;
220
+ }
221
+ #editor.tokens-list .ProseMirror, #editor.styled-tokens-list .ProseMirror {
222
+ display: flex;
223
+ flex-direction: row;
224
+ flex-wrap: wrap;
225
+ align-items: flex-start;
226
+ }
227
+ #editor.tokens-list .ProseMirror li, #editor.styled-tokens-list .ProseMirror li {
228
+ display: flex;
229
+ flex-direction: row;
230
+ border-radius: 8px;
231
+ padding: 2px 4px;
232
+ margin-right: 2px;
233
+ background-color: #dadada;
234
+ border-color: rgba(42, 61, 108, 0.44);
235
+ min-height: 20px;
236
+ }
237
+ #editor.tokens-list .ProseMirror li span, #editor.styled-tokens-list .ProseMirror li span {
238
+ display: inline-block;
239
+ min-height: 18px;
240
+ }
241
+ #editor.tokens-list .ProseMirror li span br, #editor.styled-tokens-list .ProseMirror li span br {
242
+ display: none;
243
+ }
244
+ #editor.items-list .ProseMirror {
245
+ display: flex;
246
+ flex-direction: column;
247
+ flex-wrap: nowrap;
248
+ align-items: flex-start;
249
+ gap: 6px;
250
+ }
251
+ #editor.items-list .ProseMirror li {
252
+ list-style-type: none;
253
+ width: 100%;
254
+ padding-bottom: 4px;
255
+ border-bottom: 1px dotted rgba(128, 128, 128, 0.5098039216);
256
+ }
257
+ #editor.items-list .ProseMirror li:last-child {
258
+ border-bottom: none;
259
+ }
260
+
261
+ #content {
262
+ position: relative;
263
+ padding: 0;
264
+ }
265
+
266
+ * {
267
+ font-family: "Roboto", Helvetica, sans-serif;
268
+ }
269
+
270
+ p {
271
+ margin-top: 0;
272
+ }
273
+
274
+ h3 {
275
+ color: #274768;
276
+ margin-top: 0;
277
+ }
278
+
279
+ .icure-input-metadata-container {
280
+ display: flex;
281
+ }
282
+ .icure-input-metadata-container .icure-metadata-container {
283
+ display: flex;
284
+ flex-grow: 1;
285
+ padding: 0 4px;
286
+ border: 1px solid #DDE3E7;
287
+ border-left: none;
288
+ border-radius: 0 6px 6px 0;
289
+ outline: 0;
290
+ box-sizing: border-box;
291
+ }
292
+ .icure-input-metadata-container .icure-metadata-container__validationError {
293
+ border-color: red;
294
+ }
295
+
296
+ .extra {
297
+ min-width: 20px;
298
+ width: auto;
299
+ height: 20px;
300
+ transition: all 0.24s cubic-bezier(0.42, 0.01, 1, 0.62);
301
+ }
302
+ .extra:hover .info {
303
+ display: none;
304
+ }
305
+ .extra:hover .buttons-container .menu-container .btn {
306
+ animation: slideIn 0.24s ease-in forwards;
307
+ pointer-events: none;
308
+ display: unset !important;
309
+ }
310
+ .extra.forced .info, .extra.forced .extra .info.hidden {
311
+ opacity: 0 !important;
312
+ z-index: 0 !important;
313
+ display: none;
314
+ }
315
+ .extra.forced .buttons-container .btn {
316
+ opacity: 1 !important;
317
+ display: unset !important;
318
+ }
319
+ .extra.forced:hover .buttons-container .menu-container .btn {
320
+ animation: none;
321
+ pointer-events: all;
322
+ }
323
+ .extra--metadataButtonsBar {
324
+ height: 100%;
325
+ display: flex;
326
+ align-items: center;
327
+ padding: 0 4px;
328
+ }
329
+ .extra .info {
330
+ color: #809ab4;
331
+ font-size: 15px;
332
+ width: 100%;
333
+ height: auto;
334
+ overflow: hidden;
335
+ pointer-events: none;
336
+ text-align: center;
337
+ }
338
+ .extra .info span {
339
+ font-weight: 700;
340
+ }
341
+ .extra .info.hidden {
342
+ display: none;
343
+ }
344
+ .extra .buttons-container {
345
+ display: flex;
346
+ height: 20px;
347
+ width: auto;
348
+ flex-flow: row nowrap;
349
+ align-items: center;
350
+ justify-content: flex-end;
351
+ transition: all 0.24s cubic-bezier(0.14, 0.69, 0.87, 0.54);
352
+ z-index: 1000;
353
+ }
354
+ .extra .buttons-container .btn {
355
+ border: none;
356
+ background: transparent;
357
+ position: relative;
358
+ top: 0;
359
+ display: none;
360
+ opacity: 0;
361
+ cursor: pointer;
362
+ height: 20px;
363
+ margin-left: 4px;
364
+ margin-right: 4px;
365
+ padding: 0;
366
+ }
367
+ .extra .buttons-container .btn svg {
368
+ width: 15px;
369
+ height: 15px;
370
+ }
371
+ .extra .buttons-container .btn svg path {
372
+ fill: #809ab4;
373
+ }
374
+ .extra .buttons-container .btn.forced {
375
+ opacity: 1 !important;
376
+ display: unset !important;
377
+ }
378
+ .extra .buttons-container .btn.forced svg path {
379
+ fill: crimson !important;
380
+ }
381
+ .extra .buttons-container .btn:focus, .extra .buttons-container .btn:focus-within {
382
+ border: none;
383
+ outline: none;
384
+ }
385
+ .extra .buttons-container .btn:hover svg path {
386
+ fill: #274768;
387
+ }
388
+ .extra .buttons-container .menu-container .btn:hover::before {
389
+ content: "";
390
+ display: block;
391
+ border-color: #274768 transparent transparent transparent;
392
+ border-style: solid;
393
+ border-width: 4px;
394
+ position: absolute;
395
+ top: -6px;
396
+ }
397
+ .extra .buttons-container .menu-container .btn:hover::after {
398
+ content: attr(data-content);
399
+ position: absolute;
400
+ top: -21px;
401
+ height: 16px;
402
+ left: 50%;
403
+ transform: translateX(-50%);
404
+ border-radius: 8px;
405
+ background: #274768;
406
+ color: white;
407
+ display: flex;
408
+ flex-flow: row wrap;
409
+ align-items: center;
410
+ text-transform: capitalize;
411
+ white-space: nowrap;
412
+ padding: 0 12px;
413
+ font-size: 12px;
414
+ line-height: 0;
415
+ }
416
+ .extra .buttons-container .menu-container:last-child .btn {
417
+ margin-right: 0;
418
+ }
419
+
420
+ @keyframes slideIn {
421
+ 0% {
422
+ top: 0;
423
+ opacity: 0;
424
+ pointer-events: none;
425
+ }
426
+ 100% {
427
+ top: 0;
428
+ opacity: 1;
429
+ pointer-events: all;
430
+ }
431
+ }
432
+ .menu-container {
433
+ display: flex;
434
+ align-items: center;
435
+ height: fit-content;
436
+ }
437
+ .menu-container .item {
438
+ height: 30px;
439
+ width: 100%;
440
+ background: transparent;
441
+ border-radius: 4px;
442
+ font-size: 14px;
443
+ color: #274768;
444
+ display: flex;
445
+ flex-flow: row nowrap;
446
+ align-items: center;
447
+ justify-content: flex-start;
448
+ box-shadow: none;
449
+ border: none;
450
+ white-space: nowrap;
451
+ overflow-x: hidden;
452
+ text-overflow: ellipsis;
453
+ }
454
+ .menu-container .item.existing {
455
+ background-color: #BFE8EA;
456
+ }
457
+ .menu-container .item.selected {
458
+ color: white;
459
+ background-color: #084B83;
460
+ }
461
+ .menu-container .item:hover {
462
+ background: #DCE7F2;
463
+ color: #274768;
464
+ font-weight: 500;
465
+ border-radius: 4px;
466
+ }
467
+
468
+ .value-date-menu {
469
+ width: unset !important;
470
+ }
471
+
472
+ .menu {
473
+ display: flex;
474
+ flex-direction: column;
475
+ gap: 2px;
476
+ position: absolute;
477
+ top: 32px;
478
+ right: -12px;
479
+ z-index: 2;
480
+ background: #fff;
481
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
482
+ border-radius: 8px;
483
+ padding: 8px;
484
+ width: 220px;
485
+ min-height: 120px;
486
+ max-height: 320px;
487
+ overflow-y: scroll;
488
+ }
489
+ .menu .input-container {
490
+ background: #edf2f7;
491
+ border-radius: 4px;
492
+ display: flex;
493
+ flex-flow: row nowrap;
494
+ align-items: center;
495
+ justify-content: flex-start;
496
+ height: 32px;
497
+ margin-bottom: 4px;
498
+ padding: 0 4px;
499
+ }
500
+ .menu .input-container:hover {
501
+ box-shadow: 0 0 0 3px rgba(40, 151, 255, 0.2);
502
+ }
503
+ .menu .input-container:focus-within {
504
+ box-shadow: 0 0 0 3px rgba(40, 151, 255, 0.2), 0 0 0 1px rgb(40, 151, 255);
505
+ }
506
+ .menu .input-container input {
507
+ background: transparent;
508
+ border: none;
509
+ flex-grow: 1;
510
+ height: 100%;
511
+ }
512
+ .menu .input-container input:focus {
513
+ background: transparent;
514
+ border: none;
515
+ outline: none;
516
+ }
517
+
518
+ .menu-trigger:focus .menu {
519
+ display: flex;
520
+ }
521
+
522
+ span {
523
+ position: relative;
524
+ z-index: 1;
525
+ }
526
+ span.date {
527
+ margin-right: 1px;
528
+ }
529
+ span.time {
530
+ margin-left: 1px;
531
+ }
532
+ span.measure {
533
+ display: inline-block;
534
+ margin-right: 1px;
535
+ }
536
+ span.unit {
537
+ margin-left: 1px;
538
+ display: inline-block;
539
+ }
540
+ span[data-content]:hover::after {
541
+ position: absolute;
542
+ content: attr(data-content);
543
+ background: #274768;
544
+ color: #ffffff;
545
+ font-size: 9px;
546
+ line-height: 12px;
547
+ top: -12px;
548
+ left: 0px;
549
+ padding: 0px 2px;
550
+ }
551
+ span[data-content]::before {
552
+ position: absolute;
553
+ content: "";
554
+ top: 0;
555
+ left: 0;
556
+ width: 100%;
557
+ height: 100%;
558
+ z-index: -1;
559
+ opacity: 0.3;
560
+ }
561
+
562
+ .masked {
563
+ display: none;
564
+ }
565
+
566
+ .companion {
567
+ position: absolute;
568
+ width: 15px;
569
+ background-color: hsl(194, 100%, 50%);
570
+ color: white;
571
+ z-index: 20;
572
+ padding: 0;
573
+ text-align: center;
574
+ font-size: 14px;
575
+ font-weight: 500;
576
+ display: flex;
577
+ align-items: center;
578
+ justify-content: center;
579
+ cursor: pointer;
580
+ border-radius: 0 2px 2px 0;
581
+ }
582
+ .companion:hover {
583
+ font-weight: 700;
584
+ background: hsl(202, 100%, 50%);
585
+ }
586
+
587
+ *::selection {
588
+ background-color: hsla(194, 100%, 50%, 0.2);
589
+ }
590
+
591
+ .suggestion-palette {
592
+ position: absolute;
593
+ z-index: 20;
594
+ max-width: 380px;
595
+ font-size: 11px;
596
+ overflow: hidden;
597
+ text-overflow: ellipsis;
598
+ padding: 4px;
599
+ border: none;
600
+ border-radius: 8px;
601
+ background: white;
602
+ box-shadow: 0 1.1px 1.1px rgba(0, 0, 0, 0.022), 0 2.7px 2.7px rgba(0, 0, 0, 0.032), 0 5px 5px rgba(0, 0, 0, 0.04), 0 8.9px 8.9px rgba(0, 0, 0, 0.048), 0 16.7px 16.7px rgba(0, 0, 0, 0.058), 0 40px 40px rgba(0, 0, 0, 0.08);
603
+ }
604
+ .suggestion-palette ul {
605
+ white-space: nowrap;
606
+ list-style-type: none;
607
+ margin: 0;
608
+ padding: 0;
609
+ }
610
+ .suggestion-palette ul li:not(:first-child) svg.tab-icn,
611
+ .suggestion-palette ul li:not(.focused) svg.return-icn, .suggestion-palette ul.focused li:first-child svg.tab-icn {
612
+ height: 0;
613
+ width: 0;
614
+ transform: scale(0);
615
+ opacity: 0;
616
+ }
617
+ .suggestion-palette ul li {
618
+ padding: 0 8px;
619
+ font-size: 11px;
620
+ height: 20px;
621
+ box-sizing: border-box;
622
+ display: flex;
623
+ align-items: center;
624
+ justify-content: space-between;
625
+ border-radius: 4px;
626
+ color: rgb(39, 71, 104);
627
+ }
628
+ .suggestion-palette ul li.focused {
629
+ background-color: rgb(237, 242, 247);
630
+ }
631
+ .suggestion-palette ul li.focused svg.return-icn {
632
+ animation: growIn 0.24s ease-in forwards;
633
+ }
634
+ .suggestion-palette ul li svg {
635
+ height: 12px;
636
+ width: 12px;
637
+ border-radius: 4px;
638
+ transform-origin: center center;
639
+ }
640
+ .suggestion-palette ul li svg path {
641
+ fill: rgb(128, 154, 180);
642
+ }
643
+
644
+ @keyframes growIn {
645
+ 0% {
646
+ transform: scale(0.5);
647
+ }
648
+ 90% {
649
+ transform: scale(1.1);
650
+ }
651
+ 100% {
652
+ transform: scale(1);
653
+ }
654
+ }
655
+ span.code-count-1::after,
656
+ span.code-count-1::before {
657
+ background: var(--bg-code-color-1);
658
+ color: var(--text-code-color-1);
659
+ }
660
+
661
+ span.code-count-2::after,
662
+ span.code-count-2::before {
663
+ background: var(--bg-code-color-1);
664
+ color: var(--text-code-color-1);
665
+ /* STRIPES */
666
+ /*background: repeating-linear-gradient(*/
667
+ /* 45deg,*/
668
+ /* var(--bg-code-color-1),*/
669
+ /* var(--bg-code-color-1) 10px,*/
670
+ /* var(--bg-code-color-2) 10px,*/
671
+ /* var(--bg-code-color-2) 20px*/
672
+ /*);*/
673
+ /* PAS STRIPES */
674
+ background: linear-gradient(90deg, var(--bg-code-color-1) 0%, var(--bg-code-color-2) 100%);
675
+ }
676
+
677
+ span.code-count-3::after,
678
+ span.code-count-3::before {
679
+ background: var(--bg-code-color-1);
680
+ color: var(--text-code-color-1);
681
+ /* STRIPES */
682
+ background: repeating-linear-gradient(45deg, var(--bg-code-color-1), var(--bg-code-color-1) 10px, var(--bg-code-color-2) 10px, var(--bg-code-color-2) 20px);
683
+ /* PAS STRIPES */
684
+ /* background: linear-gradient(90deg, var(--bg-code-color-1) 0%, var(--bg-code-color-2) 100%);*/
685
+ }
686
+
687
+ .selected-option {
688
+ padding: 2px;
689
+ margin-right: 5px;
690
+ }
691
+
692
+ .options {
693
+ display: flex;
694
+ flex-direction: column;
695
+ align-items: flex-start;
696
+ position: absolute;
697
+ top: calc(100% + 6px);
698
+ left: 0;
699
+ z-index: 2;
700
+ background: #fff;
701
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
702
+ width: auto;
703
+ min-width: 100%;
704
+ overflow-y: auto;
705
+ max-height: 280px;
706
+ padding: 2px;
707
+ border-radius: 6px;
708
+ }
709
+ .options--subformView {
710
+ top: 46px;
711
+ min-width: unset;
712
+ left: unset;
713
+ right: 0;
714
+ }
715
+
716
+ .date-picker {
717
+ display: flex;
718
+ flex-direction: column;
719
+ align-items: flex-start;
720
+ position: absolute;
721
+ top: calc(100% + 6px);
722
+ left: 0;
723
+ z-index: 2;
724
+ background: #fff;
725
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
726
+ width: 260px;
727
+ overflow-y: auto;
728
+ max-height: 280px;
729
+ }
730
+
731
+ app-date-picker {
732
+ --app-primary: #084B83;
733
+ --app-hover: #5b7da2;
734
+ --app-selected-hover: #5b7da2;
735
+ }
736
+
737
+ .option {
738
+ height: 28px;
739
+ min-height: 28px;
740
+ width: 100%;
741
+ background: transparent;
742
+ border-radius: 4px;
743
+ font-size: 14px;
744
+ color: #545454;
745
+ display: flex;
746
+ flex-flow: row nowrap;
747
+ align-items: center;
748
+ justify-content: flex-start;
749
+ box-shadow: none;
750
+ border: none;
751
+ white-space: nowrap;
752
+ overflow-x: hidden;
753
+ text-overflow: ellipsis;
754
+ padding: 4px 8px;
755
+ -webkit-user-select: none; /* Safari */
756
+ -ms-user-select: none; /* IE 10 and IE 11 */
757
+ user-select: none; /* Standard syntax */
758
+ cursor: pointer;
759
+ }
760
+ .option:hover {
761
+ color: #656565;
762
+ background-color: #ededed;
763
+ }
764
+
765
+ .select-arrow {
766
+ border: none;
767
+ background: 0px 0px;
768
+ position: relative;
769
+ top: 0px;
770
+ opacity: 0.5;
771
+ cursor: pointer;
772
+ height: 20px;
773
+ width: 10px;
774
+ margin-left: 4px;
775
+ margin-right: 4px;
776
+ padding: 0px;
777
+ }
778
+
779
+ .hidden {
780
+ display: none;
781
+ }
782
+
783
+ .container {
784
+ position: relative;
785
+ }
786
+
787
+ .group {
788
+ align-items: end;
789
+ display: grid;
790
+ }
791
+
792
+ .subform {
793
+ display: grid;
794
+ position: relative;
795
+ padding: 8px;
796
+ border-radius: 6px;
797
+ background-color: #e7f0fd;
798
+ gap: 12px;
799
+ }
800
+ .subform__heading {
801
+ display: flex;
802
+ justify-content: space-between;
803
+ align-items: center;
804
+ height: auto;
805
+ }
806
+ .subform__heading__title {
807
+ padding: 0;
808
+ margin: 0;
809
+ }
810
+ .subform__addBtn, .subform__removeBtn {
811
+ cursor: pointer;
812
+ background-color: #084B83;
813
+ color: white;
814
+ height: 32px;
815
+ padding: 0 16px;
816
+ border-radius: 6px;
817
+ border: none;
818
+ outline: none;
819
+ }
820
+ .subform__addBtn:hover, .subform__removeBtn:hover {
821
+ background-color: #3D87C5;
822
+ }
823
+ .subform__removeBtn {
824
+ justify-self: end;
825
+ border: 1px solid #DDE3E7;
826
+ background-color: #FCFCFD;
827
+ color: #084B83;
828
+ }
829
+ .subform__removeBtn:hover {
830
+ background-color: #F2F2F2;
831
+ }
832
+ .subform__child {
833
+ display: grid;
834
+ grid-template-rows: auto;
835
+ gap: 8px;
836
+ padding: 8px;
837
+ border-radius: 6px;
838
+ background: white;
839
+ border: 1px solid #3D87C5;
840
+ }
841
+ .subform__child__title {
842
+ padding: 12px !important;
843
+ border-radius: 6px;
844
+ margin: 0;
845
+ background-color: #BFE8EA;
846
+ }
847
+ .subform__child .subform {
848
+ background: unset;
849
+ margin: 0;
850
+ padding: 0;
851
+ }
852
+
853
+ .icure-form {
854
+ background-color: rgba(0, 0, 0, 0);
855
+ display: grid;
856
+ gap: 16px 6px;
857
+ grid-template-columns: repeat(24, 1fr);
858
+ }
859
+ .icure-form hr {
860
+ display: block;
861
+ margin-top: 20px;
862
+ border-top: 1px solid rgba(8, 75, 131, 0.13);
863
+ margin-bottom: 20px;
864
+ }
865
+ .icure-form h2 {
866
+ font-size: 14.4px;
867
+ font-weight: 700;
868
+ color: #084B83;
869
+ padding: 2px;
870
+ }
871
+ .icure-form h3 {
872
+ font-size: 13.2px;
873
+ font-weight: 500;
874
+ color: #084B83;
875
+ padding: 6px;
876
+ }
877
+ .icure-form .group.bordered {
878
+ background: #f6f6f6;
879
+ border-radius: 12px;
880
+ }
881
+
882
+ .icure-form-field {
883
+ display: grid;
884
+ align-items: flex-start;
885
+ }
886
+
887
+ .error {
888
+ color: red;
889
+ font-size: 12px;
890
+ margin-top: 4px;
891
+ }
892
+
893
+ .icure-text-field .icure-label-extra, .icure-button-group .icure-label-extra {
894
+ display: flex;
895
+ width: 100%;
896
+ gap: 12px;
897
+ }
898
+ .icure-text-field .icure-label, .icure-button-group .icure-label {
899
+ z-index: 1;
900
+ pointer-events: none;
901
+ line-height: 1.4em;
902
+ cursor: text;
903
+ font-size: 12px;
904
+ left: 9px;
905
+ color: #084B83;
906
+ align-items: center;
907
+ height: 28px;
908
+ max-width: 85%;
909
+ min-width: 0;
910
+ }
911
+ .icure-text-field .icure-label.float, .icure-button-group .icure-label.float {
912
+ display: flex;
913
+ white-space: nowrap;
914
+ text-overflow: ellipsis;
915
+ overflow: hidden;
916
+ }
917
+
918
+ .icure-text-field {
919
+ position: relative;
920
+ width: 100%;
921
+ }
922
+ .icure-text-field > .icure-label {
923
+ transition: transform 0.2s ease-out, color 0.2s ease-out;
924
+ }
925
+ .icure-text-field > .icure-input {
926
+ flex: 1 1 auto;
927
+ width: auto;
928
+ }
929
+ .icure-text-field > .icure-label.side {
930
+ position: relative;
931
+ }
932
+ .icure-text-field > .icure-label.side.left {
933
+ order: -1;
934
+ margin-right: 1em;
935
+ }
936
+ .icure-text-field > .icure-label.side.right {
937
+ order: 1;
938
+ margin-left: 1em;
939
+ }
940
+ .icure-text-field .icure-input,
941
+ .icure-text-field .input-container {
942
+ padding: 8px;
943
+ width: 100%;
944
+ box-sizing: border-box;
945
+ border-width: 1px;
946
+ border-style: solid;
947
+ border-color: #DDE3E7;
948
+ border-radius: 2px;
949
+ box-sizing: border-box;
950
+ outline: 0;
951
+ font: inherit;
952
+ font-size: 14px;
953
+ line-height: 1.4em;
954
+ display: flex;
955
+ align-items: center;
956
+ vertical-align: middle;
957
+ position: relative;
958
+ -webkit-appearance: none;
959
+ background-color: #ffffff;
960
+ color: #000000;
961
+ }
962
+ .icure-text-field .icure-input__validationError,
963
+ .icure-text-field .input-container__validationError {
964
+ border-color: red;
965
+ }
966
+ .icure-text-field .icure-input__withMetadata,
967
+ .icure-text-field .input-container__withMetadata {
968
+ border-radius: 6px 0 0 6px;
969
+ }
970
+ .icure-text-field .icure-input:focus, .icure-text-field .icure-input:focus-within,
971
+ .icure-text-field .input-container:focus,
972
+ .icure-text-field .input-container:focus-within {
973
+ box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);
974
+ }
975
+ .icure-text-field .icure-input:hover,
976
+ .icure-text-field .input-container:hover {
977
+ border-color: rgba(0, 0, 0, 0.15);
978
+ box-shadow: none;
979
+ }
980
+ .icure-text-field .icure-input:hover:focus, .icure-text-field .icure-input:hover:focus-within,
981
+ .icure-text-field .input-container:hover:focus,
982
+ .icure-text-field .input-container:hover:focus-within {
983
+ box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);
984
+ }
985
+ .icure-text-field .icure-input .ProseMirror,
986
+ .icure-text-field .input-container .ProseMirror {
987
+ padding: 0;
988
+ font-size: 14px;
989
+ line-height: 1.4em;
990
+ color: #000000;
991
+ }
992
+ .icure-text-field .icure-input .ProseMirror .date,
993
+ .icure-text-field .input-container .ProseMirror .date {
994
+ padding: 1px;
995
+ }
996
+ .icure-text-field .icure-input .ProseMirror .time,
997
+ .icure-text-field .input-container .ProseMirror .time {
998
+ padding: 1px;
999
+ }
1000
+ .icure-text-field .icure-input .ProseMirror:focus .focused,
1001
+ .icure-text-field .input-container .ProseMirror:focus .focused {
1002
+ background-color: rgba(0, 0, 0, 0.05);
1003
+ border-radius: 3px;
1004
+ border-color: rgba(0, 0, 0, 0.1);
1005
+ }
1006
+ .icure-text-field .icure-input > svg,
1007
+ .icure-text-field .input-container > svg {
1008
+ opacity: 0.5;
1009
+ }
1010
+ .icure-text-field .icure-input > svg path,
1011
+ .icure-text-field .input-container > svg path {
1012
+ fill: #656565;
1013
+ }
1014
+ .icure-text-field .icure-input .extra,
1015
+ .icure-text-field .input-container .extra {
1016
+ height: 20px;
1017
+ }
1018
+ .icure-text-field .icure-input .extra > .info,
1019
+ .icure-text-field .input-container .extra > .info {
1020
+ color: #656565;
1021
+ opacity: 0.5;
1022
+ }
1023
+ .icure-text-field .icure-input .extra .btn svg path,
1024
+ .icure-text-field .input-container .extra .btn svg path {
1025
+ fill: #656565;
1026
+ opacity: 0.5;
1027
+ }
1028
+ .icure-text-field .icure-input .extra .btn svg path:hover,
1029
+ .icure-text-field .input-container .extra .btn svg path:hover {
1030
+ fill: #656565;
1031
+ opacity: 1;
1032
+ }
1033
+
1034
+ input[type=radio] {
1035
+ margin-top: -1px;
1036
+ vertical-align: middle;
1037
+ }
1038
+
1039
+ .icure-checkbox:checked {
1040
+ accent-color: #06a070;
1041
+ }
1042
+
1043
+ .icure-button {
1044
+ display: flex;
1045
+ height: 32px;
1046
+ padding: 0 16px;
1047
+ background-color: #084B83;
1048
+ color: white;
1049
+ border-radius: 6px;
1050
+ cursor: pointer;
1051
+ font-size: 14px;
1052
+ font-weight: normal;
1053
+ }
1054
+ .icure-button:hover {
1055
+ background-color: #3D87C5;
1056
+ }
1057
+
1058
+ .icure-button-group {
1059
+ display: flex;
1060
+ flex-direction: column;
1061
+ gap: 4px;
1062
+ }
1063
+ .icure-button-group > div {
1064
+ display: grid;
1065
+ }
1066
+ .icure-button-group > div > div {
1067
+ display: flex;
1068
+ align-items: center;
1069
+ }
1070
+ .icure-button-group > div > div > .icure-button-group-label {
1071
+ z-index: 1;
1072
+ line-height: 1.4em;
1073
+ cursor: text;
1074
+ font-size: 12px;
1075
+ top: calc(1.4em + 1px);
1076
+ left: 9px;
1077
+ transition: transform 0.2s ease-out, color 0.2s ease-out;
1078
+ color: #084B83;
1079
+ display: flex;
1080
+ align-items: center;
1081
+ height: 28px;
1082
+ max-width: 85%;
1083
+ min-width: 0;
1084
+ }
1085
+ .icure-button-group > div > div > .icure-button-group-label > span {
1086
+ display: block;
1087
+ white-space: nowrap;
1088
+ text-overflow: ellipsis;
1089
+ overflow: hidden;
1090
+ padding-right: 8px;
1091
+ }
1092
+ .icure-button-group > .icure-input {
1093
+ flex: 1 1 auto;
1094
+ width: auto;
1095
+ }
1096
+ .icure-button-group > .icure-label {
1097
+ transform: translate(0, 0) scale(1);
1098
+ }
1099
+ .icure-button-group > .icure-label.above, .icure-button-group.has-content > .icure-label, .icure-button-group:focus > .icure-label, .icure-button-group:focus-within > .icure-label {
1100
+ font-weight: 500;
1101
+ height: 1.4em;
1102
+ }`;
15
1103
  class FormSelectionButton extends lit_1.LitElement {
16
1104
  constructor() {
17
1105
  super(...arguments);
18
1106
  this.formAdded = () => {
19
1107
  /* Do nothing */
20
1108
  };
1109
+ this.translationProvider = (language, text) => text;
1110
+ this.language = 'en';
21
1111
  this.displayMenu = false;
22
1112
  }
23
1113
  static get styles() {
24
- return (0, lit_1.css) `
25
- .options-container {
26
- position: relative;
27
- }
28
-
29
- .options {
30
- display: flex;
31
- flex-direction: column;
32
- align-items: flex-start;
33
- position: absolute;
34
- top: 30px;
35
- right: 0;
36
- z-index: 2;
37
- background: #fff;
38
- box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.25);
39
- width: auto;
40
- min-width: 100%;
41
- overflow-y: auto;
42
- max-height: 280px;
43
- }
44
-
45
- .option {
46
- height: 28px;
47
- min-height: 28px;
48
- width: 100%;
49
- background: transparent;
50
- border-radius: 4px;
51
- font-size: 14px;
52
- color: #545454;
53
- display: flex;
54
- flex-flow: row nowrap;
55
- align-items: center;
56
- justify-content: flex-start;
57
- box-shadow: none;
58
- border: none;
59
- white-space: nowrap;
60
- overflow-x: hidden;
61
- text-overflow: ellipsis;
62
- padding: 4px 8px;
63
- -webkit-user-select: none; /* Safari */
64
- -ms-user-select: none; /* IE 10 and IE 11 */
65
- user-select: none; /* Standard syntax */
66
- }
67
-
68
- .option:hover {
69
- color: #656565;
70
- background-color: #ededed;
71
- }
72
- `;
1114
+ return [baseCss];
1115
+ }
1116
+ _handleClickOutside(event) {
1117
+ if (!event.composedPath().includes(this)) {
1118
+ if (this.displayMenu) {
1119
+ this.displayMenu = false;
1120
+ }
1121
+ event.stopPropagation();
1122
+ }
1123
+ }
1124
+ connectedCallback() {
1125
+ super.connectedCallback();
1126
+ document.addEventListener('click', this._handleClickOutside.bind(this));
1127
+ }
1128
+ disconnectedCallback() {
1129
+ super.disconnectedCallback();
1130
+ document.removeEventListener('click', this._handleClickOutside.bind(this));
73
1131
  }
74
1132
  render() {
75
1133
  var _a;
76
1134
  return (0, lit_1.html) `<div class="options-container">
77
- <button class="btn" @click="${() => (this.displayMenu = true)}">+</button>
1135
+ <button class="subform__addBtn" @click="${() => (this.displayMenu = true)}">Add subform</button>
78
1136
  ${this.displayMenu
79
- ? (0, lit_1.html) `<div class="options">
80
- ${(_a = this.forms) === null || _a === void 0 ? void 0 : _a.map(([id, form]) => (0, lit_1.html) `<button
1137
+ ? (0, lit_1.html) `<div class="options options--subformView">
1138
+ ${(_a = this.forms) === null || _a === void 0 ? void 0 : _a.map(([id, form]) => {
1139
+ var _a;
1140
+ return (0, lit_1.html) `<button
81
1141
  class="option"
82
1142
  @click=${() => {
83
- this.formAdded(id, form);
84
- this.displayMenu = false;
85
- }}
1143
+ this.formAdded(id, form);
1144
+ this.displayMenu = false;
1145
+ }}
86
1146
  >
87
- ${id}
88
- </button>`)}
1147
+ ${(_a = (this.translationProvider ? this.translationProvider(this.language, form.form) : form.form)) !== null && _a !== void 0 ? _a : id}
1148
+ </button>`;
1149
+ })}
89
1150
  </div>`
90
1151
  : lit_1.nothing}
91
1152
  </div>`;
@@ -100,9 +1161,16 @@ __decorate([
100
1161
  (0, decorators_js_1.property)(),
101
1162
  __metadata("design:type", Function)
102
1163
  ], FormSelectionButton.prototype, "formAdded", void 0);
1164
+ __decorate([
1165
+ (0, decorators_js_1.property)(),
1166
+ __metadata("design:type", Function)
1167
+ ], FormSelectionButton.prototype, "translationProvider", void 0);
1168
+ __decorate([
1169
+ (0, decorators_js_1.property)(),
1170
+ __metadata("design:type", Object)
1171
+ ], FormSelectionButton.prototype, "language", void 0);
103
1172
  __decorate([
104
1173
  (0, decorators_js_1.state)(),
105
1174
  __metadata("design:type", Object)
106
1175
  ], FormSelectionButton.prototype, "displayMenu", void 0);
107
- customElements.define('form-selection-button', FormSelectionButton);
108
1176
  //# sourceMappingURL=form-selection-button.js.map