@latitude-ui/widgets 0.0.1 → 0.0.5

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,833 @@
1
+ lat-input-label {
2
+ color: var(--lat-text-color-subtle);
3
+ //color: var(--lat-text-color-strong);
4
+
5
+ font-size: var(--lat-font-size-small);
6
+ font-family: var(--lat-font-family-sans), sans-serif;
7
+ font-weight: var(--lat-font-weight-normal);
8
+
9
+ user-select: none;
10
+ line-height: 1rem;
11
+
12
+
13
+ label {
14
+ display: inline-flex;
15
+
16
+ align-self: flex-start;
17
+ align-items: center;
18
+ justify-self: start;
19
+
20
+ color: inherit;
21
+ text-align: right;
22
+ line-height: inherit;
23
+ vertical-align: middle;
24
+
25
+ font-size: inherit;
26
+ font-family: inherit;
27
+ font-weight: inherit;
28
+
29
+ .lat-label-asterix {
30
+ color: var(--lat-danger-color);
31
+ margin-left: 4px;
32
+ }
33
+ }
34
+ }
35
+
36
+
37
+ lat-input {
38
+ display: flex;
39
+
40
+ gap: 4px;
41
+ flex-direction: column;
42
+
43
+ align-items: flex-start;
44
+ justify-content: flex-start;
45
+
46
+ font-family: var(--lat-font-family-sans), sans-serif;
47
+ font-weight: var(--lat-font-weight-normal);
48
+
49
+ line-height: normal;
50
+
51
+ & > div[role="textbox"] {
52
+ position: relative;
53
+
54
+ overflow: hidden;
55
+ box-sizing: border-box;
56
+
57
+ margin-inline: calc(0.25rem * -1);
58
+
59
+ button {
60
+ position: relative;
61
+
62
+ box-sizing: border-box;
63
+
64
+ display: flex;
65
+
66
+ align-items: center;
67
+ justify-content: flex-start;
68
+
69
+ width: 100%;
70
+
71
+ height: auto;
72
+ min-height: 28px;
73
+ line-height: 28px;
74
+
75
+ cursor: default;
76
+
77
+ text-align: left;
78
+ touch-action: manipulation;
79
+
80
+ border-radius: 4px;
81
+
82
+ padding-block: 0.25rem;
83
+ padding-inline: 0.25rem;
84
+
85
+ color: var(--lat-text-color);
86
+ background-color: transparent;
87
+
88
+ font-size: inherit;
89
+ font-family: inherit;
90
+ font-weight: inherit;
91
+
92
+ &:hover {
93
+ color: var(--lat-text-color);
94
+ background-color: var(--lat-background-color-active);
95
+ }
96
+
97
+ transition-property: background, border, color, fill, opacity;
98
+ transition-duration: 0.2s;
99
+ }
100
+ }
101
+
102
+ & > * {
103
+ width: 100%;
104
+ }
105
+
106
+ lat-input-label {
107
+ }
108
+
109
+ lat-input-error {
110
+ display: flex;
111
+
112
+ cursor: default;
113
+ flex-direction: column;
114
+
115
+ align-items: flex-start;
116
+
117
+ gap: 4px;
118
+
119
+ color: var(--lat-danger-color);
120
+ text-align: right;
121
+ line-height: inherit;
122
+ vertical-align: middle;
123
+
124
+ font-size: 11px;
125
+ font-family: inherit;
126
+ font-weight: inherit;
127
+ }
128
+ }
129
+
130
+ lat-switch {
131
+ display: inline-flex;
132
+
133
+ cursor: default;
134
+
135
+ align-items: center;
136
+ justify-content: flex-start;
137
+
138
+ font-family: var(--lat-font-family-sans), sans-serif;
139
+ font-weight: var(--lat-font-weight-normal);
140
+
141
+ &[data-size="sm"] {
142
+ height: 24px;
143
+ font-size: 12px;
144
+ line-height: 24px;
145
+
146
+ button {
147
+ width: 32px;
148
+ height: 18px;
149
+ line-height: 18px;
150
+
151
+ & > div {
152
+ width: 14px;
153
+ height: 14px;
154
+ }
155
+
156
+ &[aria-checked="true"] {
157
+ --lat-translate-x: 14px;
158
+ }
159
+
160
+ &[aria-checked="false"] {
161
+ --lat-translate-x: 0;
162
+ }
163
+ }
164
+ }
165
+
166
+ &[data-size="md"] {
167
+ height: 28px;
168
+ font-size: 12px;
169
+ line-height: 28px;
170
+
171
+ button {
172
+ width: 40px;
173
+ height: 22px;
174
+ line-height: 22px;
175
+
176
+ & > div {
177
+ width: 18px;
178
+ height: 18px;
179
+ }
180
+
181
+ &[aria-checked="true"] {
182
+ --lat-translate-x: 18px;
183
+ }
184
+
185
+ &[aria-checked="false"] {
186
+ --lat-translate-x: 0;
187
+ }
188
+ }
189
+ }
190
+
191
+ &[data-size="lg"] {
192
+ height: 32px;
193
+ font-size: 14px;
194
+ line-height: 32px;
195
+
196
+ button {
197
+ width: 44px;
198
+ height: 26px;
199
+ line-height: 26px;
200
+
201
+ & > div {
202
+ width: 22px;
203
+ height: 22px;
204
+ }
205
+
206
+ &[aria-checked="true"] {
207
+ --lat-translate-x: 22px;
208
+ }
209
+
210
+ &[aria-checked="false"] {
211
+ --lat-translate-x: 0;
212
+ }
213
+ }
214
+ }
215
+
216
+ button {
217
+ display: inline-flex;
218
+
219
+ align-items: center;
220
+ justify-content: flex-start;
221
+
222
+ height: 100%;
223
+
224
+ flex-shrink: 0;
225
+
226
+ border-width: 1px;
227
+ border-style: solid;
228
+ border-color: var(--lat-thumb-border-color);
229
+ border-radius: 9999px;
230
+
231
+ color: var(--lat-text-color);
232
+ background-color: var(--lat-thumb-background-color);
233
+
234
+
235
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
236
+ transition-timing-function: cubic-bezier(.4, 0, .2, 1);
237
+ transition-duration: .2s;
238
+
239
+ padding: 2px 1px;
240
+ margin-right: .5rem;
241
+
242
+
243
+ & > div {
244
+ display: block;
245
+ box-sizing: border-box;
246
+
247
+ border-width: 0;
248
+ border-style: solid;
249
+ border-color: var(--lat-outline-color-strong);
250
+ border-radius: 9999px;
251
+
252
+ box-shadow: inset 0 0 0 var(--lat-thumb-border-width) var(--lat-thumb-border-color);
253
+ background-color: var(--lat-thumb-color);
254
+
255
+ transition-property: transform;
256
+ transition-timing-function: cubic-bezier(.4, 0, .2, 1);
257
+ transition-duration: .2s;
258
+
259
+ transform: translate(var(--lat-translate-x), 0)
260
+ }
261
+
262
+ &[aria-checked="true"] {
263
+ --lat-thumb-color: #ffffff;
264
+ --lat-thumb-border-width: 0;
265
+ --lat-thumb-border-color: var(--lat-primary-color);
266
+ --lat-thumb-background-color: var(--lat-primary-color);
267
+ }
268
+
269
+ &[aria-checked="false"] {
270
+ --lat-thumb-color: #ffffff;
271
+ --lat-thumb-border-width: 1px;
272
+ --lat-thumb-border-color: var(--lat-outline-color-strong);
273
+ --lat-thumb-background-color: var(--lat-background-color-subtle);
274
+ }
275
+ }
276
+ }
277
+
278
+ @mixin textbox-size(
279
+ $size,
280
+ $height,
281
+ $font-size,
282
+ $line-height,
283
+ $padding-block,
284
+ $padding-inline,
285
+ ) {
286
+ &[data-size="#{$size}"] {
287
+ --lat-textbox-height: #{$height};
288
+ --lat-textbox-font-size: #{$font-size};
289
+ --lat-textbox-line-height: #{$line-height};
290
+ --lat-textbox-padding-block: #{$padding-block};
291
+ --lat-textbox-padding-inline: #{$padding-inline};
292
+
293
+ @content;
294
+ }
295
+ }
296
+
297
+
298
+ lat-textbox, lat-textarea, lat-select {
299
+ --lat-textbox-height: auto;
300
+ --lat-textbox-line-height: inherit;
301
+ --lat-textbox-font-size: var(--lat-font-size-small);
302
+ --lat-textbox-font-family: var(--lat-font-family-sans);
303
+ --lat-textbox-font-weight: var(--lat-font-weight-normal);
304
+ --lat-textbox-padding-block: 0;
305
+ --lat-textbox-padding-inline: 0;
306
+ --lat-textbox-border-style: solid;
307
+ --lat-textbox-border-color: transparent;
308
+ --lat-textbox-border-width: 1px;
309
+ --lat-textbox-border-radius: 4px;
310
+ --lat-textbox-color: initial;
311
+ --lat-textbox-background-color: initial;
312
+ --lat-textbox-placeholder-color: initial;
313
+ }
314
+
315
+ lat-textbox, lat-textarea, lat-select {
316
+ --lat-textbox-color: var(--lat-text-color);
317
+ --lat-textbox-placeholder-color: var(--lat-text-color-subtle);
318
+ --lat-textbox-border-width: 0.0625rem;
319
+ --lat-textbox-border-color: var(--lat-outline-color-strong);
320
+ --lat-textbox-background-color: #ffffff;
321
+ }
322
+
323
+ lat-textbox, lat-textarea {
324
+ position: relative;
325
+ box-sizing: border-box;
326
+
327
+ display: inline-flex;
328
+ overflow: hidden;
329
+
330
+ width: 100%;
331
+ height: var(--lat-textbox-height);
332
+ line-height: var(--lat-textbox-line-height);
333
+
334
+ font-size: var(--lat-textbox-font-size);
335
+ font-family: var(--lat-textbox-font-family), sans-serif;
336
+ font-weight: var(--lat-textbox-font-weight);
337
+
338
+ border-width: var(--lat-textbox-border-width);
339
+ border-style: var(--lat-textbox-border-style);
340
+ border-color: var(--lat-textbox-border-color);
341
+ border-radius: var(--lat-textbox-border-radius);
342
+
343
+ color: var(--lat-textbox-color);
344
+ background-color: var(--lat-textbox-background-color);
345
+
346
+ transition-property: background, border, color, fill, opacity;
347
+ transition-duration: .2s;
348
+
349
+ &:hover {
350
+ --lat-textbox-color: var(--lat-text-color);
351
+ --lat-textbox-border-color: var(--lat-outline-color-hover);
352
+ }
353
+
354
+ &:focus-within {
355
+ --lat-textbox-color: var(--lat-text-color);
356
+ --lat-textbox-border-color: var(--lat-outline-color-active);
357
+ }
358
+
359
+ &[data-dirty="true"][data-invalid="true"] {
360
+ --lat-textbox-border-color: var(--lat-danger-color);
361
+ }
362
+
363
+ &[data-readonly="true"] {
364
+ --lat-textbox-color: var(--lat-text-color);
365
+ --lat-textbox-border-color: transparent;
366
+ --lat-textbox-background-color: #ffffff;
367
+
368
+ margin-inline: calc(var(--lat-textbox-padding-inline) * -1);
369
+
370
+ input, textarea {
371
+ cursor: default;
372
+ }
373
+
374
+ &:hover {
375
+ --lat-textbox-color: var(--lat-text-color);
376
+ --lat-textbox-border-color: transparent;
377
+ --lat-textbox-background-color: var(--lat-background-color-hover);
378
+ }
379
+
380
+ &:focus-within {
381
+ --lat-textbox-color: var(--lat-text-color);
382
+ --lat-textbox-border-color: transparent;
383
+ --lat-textbox-background-color: var(--lat-background-color-active);
384
+ }
385
+ }
386
+
387
+ input, textarea {
388
+ position: relative;
389
+ overflow: hidden;
390
+ box-sizing: border-box;
391
+
392
+ display: inline-flex;
393
+
394
+ align-items: center;
395
+ justify-content: center;
396
+
397
+ text-align: left;
398
+ touch-action: manipulation;
399
+
400
+ width: 100%;
401
+
402
+ line-height: var(--lat-textbox-line-height);
403
+
404
+ font-size: inherit;
405
+ font-family: inherit;
406
+ font-weight: inherit;
407
+
408
+ margin: 0;
409
+ padding: 0;
410
+
411
+ border: none;
412
+ outline: none;
413
+
414
+ padding-block: var(--lat-textbox-padding-block);
415
+ padding-inline: var(--lat-textbox-padding-inline);
416
+
417
+ flex-grow: 1;
418
+
419
+ vertical-align: top;
420
+
421
+ color: inherit;
422
+ background-color: initial;
423
+
424
+ &::placeholder {
425
+ color: var(--lat-textbox-placeholder-color);
426
+
427
+ font-size: var(--lat-textbox-font-size);
428
+ font-family: var(--lat-textbox-font-family), sans-serif;
429
+ font-weight: var(--lat-textbox-font-weight);
430
+ }
431
+ }
432
+
433
+ @include textbox-size(
434
+ "sm",
435
+ 1.5rem,
436
+ 0.75rem,
437
+ 1.125rem,
438
+ 0.25rem,
439
+ 0.5rem
440
+ );
441
+
442
+ @include textbox-size(
443
+ "md",
444
+ 1.75rem,
445
+ 0.75rem,
446
+ 1.125rem,
447
+ 0.25rem,
448
+ 0.5rem
449
+ );
450
+
451
+ @include textbox-size(
452
+ "lg",
453
+ 2rem,
454
+ 0.875rem,
455
+ 1.3125rem,
456
+ 0.25rem,
457
+ 0.5rem
458
+ );
459
+ }
460
+
461
+ lat-textarea {
462
+ height: auto;
463
+ box-sizing: content-box;
464
+
465
+ textarea {
466
+ overflow: auto;
467
+ }
468
+ }
469
+
470
+ lat-select {
471
+ position: relative;
472
+ box-sizing: border-box;
473
+
474
+ display: flex;
475
+
476
+ overflow: hidden;
477
+
478
+ min-width: 0;
479
+ max-width: 100%;
480
+
481
+ lat-select-trigger {
482
+ position: relative;
483
+ box-sizing: border-box;
484
+
485
+ display: flex;
486
+ overflow: hidden;
487
+
488
+ flex-grow: 1;
489
+
490
+ height: var(--lat-textbox-height);
491
+ line-height: var(--lat-textbox-line-height);
492
+ width: 100%;
493
+ max-width: 100%;
494
+
495
+ font-size: var(--lat-textbox-font-size);
496
+ font-family: var(--lat-textbox-font-family), sans-serif;
497
+ font-weight: var(--lat-textbox-font-weight);
498
+
499
+ border-width: var(--lat-textbox-border-width);
500
+ border-style: var(--lat-textbox-border-style);
501
+ border-color: var(--lat-textbox-border-color);
502
+ border-radius: var(--lat-textbox-border-radius);
503
+
504
+ color: var(--lat-textbox-color);
505
+ background-color: var(--lat-textbox-background-color);
506
+
507
+ transition-property: background, border, color, fill, opacity;
508
+ transition-duration: .2s;
509
+
510
+ &:hover {
511
+ --lat-textbox-color: var(--lat-text-color);
512
+ --lat-textbox-border-color: var(--lat-outline-color-hover);
513
+ }
514
+
515
+ &:focus-within {
516
+ --lat-textbox-color: var(--lat-text-color);
517
+ --lat-textbox-border-color: var(--lat-outline-color-active);
518
+ }
519
+
520
+ @include textbox-size(
521
+ "sm",
522
+ 1.5rem,
523
+ 0.75rem,
524
+ 1.125rem,
525
+ 0.25rem,
526
+ 0.5rem
527
+ );
528
+
529
+ @include textbox-size(
530
+ "md",
531
+ 1.75rem,
532
+ 0.75rem,
533
+ 1.125rem,
534
+ 0.25rem,
535
+ 0.5rem
536
+ );
537
+
538
+ @include textbox-size(
539
+ "lg",
540
+ 2rem,
541
+ 0.875rem,
542
+ 1.3125rem,
543
+ 0.25rem,
544
+ 0.5rem
545
+ );
546
+
547
+ lat-select-value {
548
+ overflow: hidden;
549
+ position: relative;
550
+
551
+ display: inline-flex;
552
+
553
+ flex-grow: 1;
554
+
555
+ .lat-select-value-scrollable {
556
+ overflow: hidden;
557
+ position: relative;
558
+
559
+ flex-grow: 1;
560
+
561
+ .lat-select-value-scrollable-content {
562
+ position: absolute;
563
+
564
+ box-sizing: border-box;
565
+
566
+ width: 100%;
567
+ height: 100%;
568
+
569
+ display: flex;
570
+ align-items: center;
571
+
572
+ gap: 4px;
573
+ margin-inline: 4px;
574
+
575
+
576
+ }
577
+ }
578
+ }
579
+
580
+ //lat-select-value {
581
+ // display: inline-flex;
582
+ //
583
+ // overflow: hidden;
584
+ //
585
+ // min-width: 0;
586
+ //
587
+ // flex-grow: 1;
588
+ // flex-wrap: nowrap;
589
+ //
590
+ // gap: 4px;
591
+ // margin-inline: 4px;
592
+ //
593
+ .lat-select-tag {
594
+ display: flex;
595
+ overflow: hidden;
596
+
597
+ min-width: 0;
598
+ min-height: 0;
599
+
600
+ flex-shrink: 0;
601
+ align-items: center;
602
+ justify-content: flex-start;
603
+
604
+ cursor: pointer;
605
+ user-select: none;
606
+
607
+ font-size: var(--lat-textbox-font-size);
608
+ font-family: var(--lat-textbox-font-family), sans-serif;
609
+ font-weight: var(--lat-textbox-font-weight);
610
+
611
+
612
+ span {
613
+ display: inline-block;
614
+
615
+ padding-block: 2px;
616
+ padding-inline: 8px;
617
+
618
+ border-radius: 4px;
619
+
620
+ background-color: var(--lat-background-color-subtle-hover);
621
+ }
622
+ }
623
+
624
+ lat-select-value + .lat-select-control {
625
+ position: relative;
626
+ box-sizing: content-box;
627
+
628
+ display: flex;
629
+
630
+ flex-direction: column;
631
+
632
+ border-left-style: solid;
633
+ border-left-width: 1px;
634
+ border-left-color: var(--lat-textbox-border-color);
635
+
636
+ lat-button {
637
+ --lat-button-height: var(--lat-textbox-height);
638
+ width: var(--lat-textbox-height);
639
+ }
640
+ }
641
+
642
+
643
+ }
644
+
645
+ }
646
+
647
+ .lat-select-dropdown {
648
+
649
+ lat-listbox {
650
+ padding-block: 4px;
651
+ padding-inline: 4px;
652
+
653
+ box-shadow: var(--lat-box-shadow-large);
654
+ background-color: var(--lat-background-color);
655
+
656
+ border-radius: 4px;
657
+
658
+ &[data-side="top"] {
659
+ inset: 0 0 4px 0;
660
+ }
661
+
662
+ &[data-side="right"] {
663
+ inset: 0 0 0 4px;
664
+ }
665
+
666
+ &[data-side="bottom"] {
667
+ inset: 4px 0 0 0;
668
+ }
669
+
670
+ &[data-side="left"] {
671
+ inset: 0 4px 0 0;
672
+ }
673
+
674
+ [role="option"] {
675
+ display: inline-flex;
676
+
677
+ flex-wrap: wrap;
678
+ flex-direction: row;
679
+
680
+ gap: 10px;
681
+ padding-inline: 10px;
682
+
683
+ align-items: center;
684
+ justify-content: flex-start;
685
+
686
+ width: 100%;
687
+ height: 28px;
688
+
689
+ cursor: pointer;
690
+ user-select: none;
691
+
692
+
693
+ font-size: var(--lat-font-size-small);
694
+ font-family: var(--lat-font-family-sans), sans-serif;
695
+ font-weight: var(--lat-font-weight-normal);
696
+
697
+ color: var(--lat-text-color);
698
+ background-color: var(--lat-background-color);
699
+
700
+ transition-property: background, border, color, fill, opacity;
701
+ transition-duration: 0.2s;
702
+
703
+ &:hover {
704
+ fill: var(--lat-text-color);
705
+ color: var(--lat-text-color);
706
+ border-color: var(--lat-background-color-subtle-hover);
707
+ background-color: var(--lat-background-color-subtle-hover);
708
+ }
709
+
710
+ //&:active {
711
+ // fill: var(--lat-text-color);
712
+ // color: var(--lat-text-color);
713
+ // border-color: var(--lat-background-color-subtle-active);
714
+ // background-color: var(--lat-background-color-subtle-active);
715
+ //}
716
+ }
717
+ }
718
+ }
719
+
720
+ lat-textbox[type="number"] {
721
+ lat-spinners {
722
+ position: relative;
723
+ box-sizing: content-box;
724
+
725
+ display: flex;
726
+
727
+ flex-direction: column;
728
+
729
+ align-items: center;
730
+ justify-content: center;
731
+
732
+ width: var(--lat-textbox-height);
733
+ max-height: var(--lat-textbox-height);
734
+ line-height: var(--lat-textbox-height);
735
+
736
+ border-left-style: solid;
737
+ border-left-width: 1px;
738
+ border-left-color: var(--lat-textbox-border-color);
739
+
740
+ transition-property: background, border, color, fill, opacity;
741
+ transition-duration: .2s;
742
+
743
+ lat-button {
744
+ --lat-button-height: calc(var(--lat-textbox-height) / 2);
745
+
746
+ width: 100%;
747
+ border-radius: 0;
748
+ }
749
+ }
750
+ }
751
+
752
+ lat-checkbox {
753
+ display: inline-flex;
754
+
755
+ cursor: default;
756
+
757
+ align-items: center;
758
+ justify-content: flex-start;
759
+
760
+ font-family: var(--lat-font-family-sans), sans-serif;
761
+ font-weight: var(--lat-font-weight-normal);
762
+
763
+ &[data-size="sm"] {
764
+ height: 24px;
765
+ font-size: 12px;
766
+ line-height: 24px;
767
+
768
+ button {
769
+ width: 14px;
770
+ height: 14px;
771
+ line-height: 14px;
772
+ }
773
+ }
774
+
775
+ &[data-size="md"] {
776
+ height: 28px;
777
+ font-size: 12px;
778
+ line-height: 28px;
779
+
780
+ button {
781
+ width: 18px;
782
+ height: 18px;
783
+ line-height: 18px;
784
+ }
785
+ }
786
+
787
+ &[data-size="lg"] {
788
+ height: 32px;
789
+ font-size: 14px;
790
+ line-height: 32px;
791
+
792
+ button {
793
+ width: 22px;
794
+ height: 22px;
795
+ line-height: 22px;
796
+ }
797
+ }
798
+
799
+ button {
800
+ display: inline-flex;
801
+
802
+ align-items: center;
803
+ justify-content: center;
804
+
805
+ flex-shrink: 0;
806
+
807
+ border-width: 1px;
808
+ border-style: solid;
809
+ border-color: var(--lat-checkbox-border-color);
810
+ border-radius: 4px;
811
+
812
+ color: var(--lat-checkbox-text-color);
813
+ background-color: var(--lat-checkbox-background-color);
814
+
815
+ transition-property: background, border, color, fill, opacity;
816
+ transition-duration: .2s;
817
+
818
+ &[aria-checked="true"] {
819
+ --lat-checkbox-text-color: #ffffff;
820
+ --lat-checkbox-border-color: var(--lat-primary-color);
821
+ --lat-checkbox-background-color: var(--lat-primary-color);
822
+ }
823
+
824
+ &[aria-checked="false"] {
825
+ --lat-checkbox-text-color: #ffffff;
826
+ --lat-checkbox-border-color: var(--lat-outline-color);
827
+ --lat-checkbox-background-color: var(--lat-background-color);
828
+ }
829
+ }
830
+ }
831
+
832
+
833
+