@universal-material/web 3.0.80 → 3.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +249 -249
- package/field/field-base.js +1 -1
- package/field/field-base.js.map +1 -1
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -583,255 +583,6 @@
|
|
|
583
583
|
}
|
|
584
584
|
]
|
|
585
585
|
},
|
|
586
|
-
{
|
|
587
|
-
"kind": "javascript-module",
|
|
588
|
-
"path": "src/card/card-content.styles.ts",
|
|
589
|
-
"declarations": [
|
|
590
|
-
{
|
|
591
|
-
"kind": "variable",
|
|
592
|
-
"name": "styles",
|
|
593
|
-
"default": "css `\n :host {\n display: block;\n }\n\n :host(:has(slot > *)) {\n display: none;\n }\n\n :host([has-content]) {\n padding: var(--u-card-padding, 16px);\n }\n\n slot {\n border-radius: inherit;\n }\n`"
|
|
594
|
-
}
|
|
595
|
-
],
|
|
596
|
-
"exports": [
|
|
597
|
-
{
|
|
598
|
-
"kind": "js",
|
|
599
|
-
"name": "styles",
|
|
600
|
-
"declaration": {
|
|
601
|
-
"name": "styles",
|
|
602
|
-
"module": "src/card/card-content.styles.ts"
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
]
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
"kind": "javascript-module",
|
|
609
|
-
"path": "src/card/card-content.ts",
|
|
610
|
-
"declarations": [
|
|
611
|
-
{
|
|
612
|
-
"kind": "class",
|
|
613
|
-
"description": "",
|
|
614
|
-
"name": "UmCardContent",
|
|
615
|
-
"members": [
|
|
616
|
-
{
|
|
617
|
-
"kind": "field",
|
|
618
|
-
"name": "hasContent",
|
|
619
|
-
"type": {
|
|
620
|
-
"text": "boolean"
|
|
621
|
-
},
|
|
622
|
-
"default": "false",
|
|
623
|
-
"attribute": "has-content",
|
|
624
|
-
"reflects": true
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
"kind": "method",
|
|
628
|
-
"name": "handleSlotChange",
|
|
629
|
-
"privacy": "private",
|
|
630
|
-
"parameters": [
|
|
631
|
-
{
|
|
632
|
-
"name": "e",
|
|
633
|
-
"type": {
|
|
634
|
-
"text": "Event"
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
]
|
|
638
|
-
}
|
|
639
|
-
],
|
|
640
|
-
"attributes": [
|
|
641
|
-
{
|
|
642
|
-
"name": "has-content",
|
|
643
|
-
"type": {
|
|
644
|
-
"text": "boolean"
|
|
645
|
-
},
|
|
646
|
-
"default": "false",
|
|
647
|
-
"fieldName": "hasContent"
|
|
648
|
-
}
|
|
649
|
-
],
|
|
650
|
-
"superclass": {
|
|
651
|
-
"name": "LitElement",
|
|
652
|
-
"package": "lit"
|
|
653
|
-
},
|
|
654
|
-
"tagName": "u-card-content",
|
|
655
|
-
"customElement": true
|
|
656
|
-
}
|
|
657
|
-
],
|
|
658
|
-
"exports": [
|
|
659
|
-
{
|
|
660
|
-
"kind": "js",
|
|
661
|
-
"name": "UmCardContent",
|
|
662
|
-
"declaration": {
|
|
663
|
-
"name": "UmCardContent",
|
|
664
|
-
"module": "src/card/card-content.ts"
|
|
665
|
-
}
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
"kind": "custom-element-definition",
|
|
669
|
-
"name": "u-card-content",
|
|
670
|
-
"declaration": {
|
|
671
|
-
"name": "UmCardContent",
|
|
672
|
-
"module": "src/card/card-content.ts"
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
]
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
"kind": "javascript-module",
|
|
679
|
-
"path": "src/card/card-media.styles.ts",
|
|
680
|
-
"declarations": [
|
|
681
|
-
{
|
|
682
|
-
"kind": "variable",
|
|
683
|
-
"name": "styles",
|
|
684
|
-
"default": "css `\n :host {\n display: block;\n aspect-ratio: 1;\n border-radius: var(--u-card-shape-corner, var(--u-shape-corner-medium, 12px));\n }\n\n :host([wide]) {\n aspect-ratio: 16/9;\n }\n`"
|
|
685
|
-
}
|
|
686
|
-
],
|
|
687
|
-
"exports": [
|
|
688
|
-
{
|
|
689
|
-
"kind": "js",
|
|
690
|
-
"name": "styles",
|
|
691
|
-
"declaration": {
|
|
692
|
-
"name": "styles",
|
|
693
|
-
"module": "src/card/card-media.styles.ts"
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
]
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
"kind": "javascript-module",
|
|
700
|
-
"path": "src/card/card-media.ts",
|
|
701
|
-
"declarations": [
|
|
702
|
-
{
|
|
703
|
-
"kind": "class",
|
|
704
|
-
"description": "",
|
|
705
|
-
"name": "UmCardMedia",
|
|
706
|
-
"members": [
|
|
707
|
-
{
|
|
708
|
-
"kind": "field",
|
|
709
|
-
"name": "wide",
|
|
710
|
-
"type": {
|
|
711
|
-
"text": "boolean"
|
|
712
|
-
},
|
|
713
|
-
"default": "false",
|
|
714
|
-
"attribute": "wide",
|
|
715
|
-
"reflects": true
|
|
716
|
-
}
|
|
717
|
-
],
|
|
718
|
-
"attributes": [
|
|
719
|
-
{
|
|
720
|
-
"name": "wide",
|
|
721
|
-
"type": {
|
|
722
|
-
"text": "boolean"
|
|
723
|
-
},
|
|
724
|
-
"default": "false",
|
|
725
|
-
"fieldName": "wide"
|
|
726
|
-
}
|
|
727
|
-
],
|
|
728
|
-
"superclass": {
|
|
729
|
-
"name": "LitElement",
|
|
730
|
-
"package": "lit"
|
|
731
|
-
},
|
|
732
|
-
"tagName": "u-card-media",
|
|
733
|
-
"customElement": true
|
|
734
|
-
}
|
|
735
|
-
],
|
|
736
|
-
"exports": [
|
|
737
|
-
{
|
|
738
|
-
"kind": "js",
|
|
739
|
-
"name": "UmCardMedia",
|
|
740
|
-
"declaration": {
|
|
741
|
-
"name": "UmCardMedia",
|
|
742
|
-
"module": "src/card/card-media.ts"
|
|
743
|
-
}
|
|
744
|
-
},
|
|
745
|
-
{
|
|
746
|
-
"kind": "custom-element-definition",
|
|
747
|
-
"name": "u-card-media",
|
|
748
|
-
"declaration": {
|
|
749
|
-
"name": "UmCardMedia",
|
|
750
|
-
"module": "src/card/card-media.ts"
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
]
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
"kind": "javascript-module",
|
|
757
|
-
"path": "src/card/card.styles.ts",
|
|
758
|
-
"declarations": [
|
|
759
|
-
{
|
|
760
|
-
"kind": "variable",
|
|
761
|
-
"name": "styles",
|
|
762
|
-
"default": "css `\n :host {\n display: block;\n position: relative;\n border-radius: var(--u-card-shape-corner, var(--u-shape-corner-medium, 12px));\n }\n\n :host([variant=elevated]) {\n --u-current-bg-color: var(--u-card-elevated-bg-color, var(var(--u-color-surface-container-low, rgb(247, 242, 250))));\n background-color: var(--u-current-bg-color);\n }\n :host([variant=elevated]) u-elevation {\n --u-elevation-level: var(--u-elevated-card-elevation-level, 1);\n }\n\n :host([variant=filled]) {\n --u-current-bg-color: var(--u-card-filled-bg-color, var(--u-color-surface-container-highest, rgb(230, 224, 233)));\n background-color: var(--u-current-bg-color);\n }\n\n :host([variant=outlined]) {\n border: var(--u-outlined-card-outline-width, 1px) solid var(--u-outlined-card-outline-color, var(--u-color-outline-variant, rgb(202, 196, 208)));\n }\n\n u-card-content,\n slot {\n border-radius: inherit;\n }\n`"
|
|
763
|
-
}
|
|
764
|
-
],
|
|
765
|
-
"exports": [
|
|
766
|
-
{
|
|
767
|
-
"kind": "js",
|
|
768
|
-
"name": "styles",
|
|
769
|
-
"declaration": {
|
|
770
|
-
"name": "styles",
|
|
771
|
-
"module": "src/card/card.styles.ts"
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
]
|
|
775
|
-
},
|
|
776
|
-
{
|
|
777
|
-
"kind": "javascript-module",
|
|
778
|
-
"path": "src/card/card.ts",
|
|
779
|
-
"declarations": [
|
|
780
|
-
{
|
|
781
|
-
"kind": "class",
|
|
782
|
-
"description": "",
|
|
783
|
-
"name": "UmCard",
|
|
784
|
-
"members": [
|
|
785
|
-
{
|
|
786
|
-
"kind": "field",
|
|
787
|
-
"name": "variant",
|
|
788
|
-
"type": {
|
|
789
|
-
"text": "UmCardVariant"
|
|
790
|
-
},
|
|
791
|
-
"default": "'filled'",
|
|
792
|
-
"description": "The Card variant to render.",
|
|
793
|
-
"attribute": "variant",
|
|
794
|
-
"reflects": true
|
|
795
|
-
}
|
|
796
|
-
],
|
|
797
|
-
"attributes": [
|
|
798
|
-
{
|
|
799
|
-
"name": "variant",
|
|
800
|
-
"type": {
|
|
801
|
-
"text": "UmCardVariant"
|
|
802
|
-
},
|
|
803
|
-
"default": "'filled'",
|
|
804
|
-
"description": "The Card variant to render.",
|
|
805
|
-
"fieldName": "variant"
|
|
806
|
-
}
|
|
807
|
-
],
|
|
808
|
-
"superclass": {
|
|
809
|
-
"name": "LitElement",
|
|
810
|
-
"package": "lit"
|
|
811
|
-
},
|
|
812
|
-
"tagName": "u-card",
|
|
813
|
-
"customElement": true
|
|
814
|
-
}
|
|
815
|
-
],
|
|
816
|
-
"exports": [
|
|
817
|
-
{
|
|
818
|
-
"kind": "js",
|
|
819
|
-
"name": "UmCard",
|
|
820
|
-
"declaration": {
|
|
821
|
-
"name": "UmCard",
|
|
822
|
-
"module": "src/card/card.ts"
|
|
823
|
-
}
|
|
824
|
-
},
|
|
825
|
-
{
|
|
826
|
-
"kind": "custom-element-definition",
|
|
827
|
-
"name": "u-card",
|
|
828
|
-
"declaration": {
|
|
829
|
-
"name": "UmCard",
|
|
830
|
-
"module": "src/card/card.ts"
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
]
|
|
834
|
-
},
|
|
835
586
|
{
|
|
836
587
|
"kind": "javascript-module",
|
|
837
588
|
"path": "src/button/button-base.styles.ts",
|
|
@@ -3613,6 +3364,255 @@
|
|
|
3613
3364
|
}
|
|
3614
3365
|
]
|
|
3615
3366
|
},
|
|
3367
|
+
{
|
|
3368
|
+
"kind": "javascript-module",
|
|
3369
|
+
"path": "src/card/card-content.styles.ts",
|
|
3370
|
+
"declarations": [
|
|
3371
|
+
{
|
|
3372
|
+
"kind": "variable",
|
|
3373
|
+
"name": "styles",
|
|
3374
|
+
"default": "css `\n :host {\n display: block;\n }\n\n :host(:has(slot > *)) {\n display: none;\n }\n\n :host([has-content]) {\n padding: var(--u-card-padding, 16px);\n }\n\n slot {\n border-radius: inherit;\n }\n`"
|
|
3375
|
+
}
|
|
3376
|
+
],
|
|
3377
|
+
"exports": [
|
|
3378
|
+
{
|
|
3379
|
+
"kind": "js",
|
|
3380
|
+
"name": "styles",
|
|
3381
|
+
"declaration": {
|
|
3382
|
+
"name": "styles",
|
|
3383
|
+
"module": "src/card/card-content.styles.ts"
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
]
|
|
3387
|
+
},
|
|
3388
|
+
{
|
|
3389
|
+
"kind": "javascript-module",
|
|
3390
|
+
"path": "src/card/card-content.ts",
|
|
3391
|
+
"declarations": [
|
|
3392
|
+
{
|
|
3393
|
+
"kind": "class",
|
|
3394
|
+
"description": "",
|
|
3395
|
+
"name": "UmCardContent",
|
|
3396
|
+
"members": [
|
|
3397
|
+
{
|
|
3398
|
+
"kind": "field",
|
|
3399
|
+
"name": "hasContent",
|
|
3400
|
+
"type": {
|
|
3401
|
+
"text": "boolean"
|
|
3402
|
+
},
|
|
3403
|
+
"default": "false",
|
|
3404
|
+
"attribute": "has-content",
|
|
3405
|
+
"reflects": true
|
|
3406
|
+
},
|
|
3407
|
+
{
|
|
3408
|
+
"kind": "method",
|
|
3409
|
+
"name": "handleSlotChange",
|
|
3410
|
+
"privacy": "private",
|
|
3411
|
+
"parameters": [
|
|
3412
|
+
{
|
|
3413
|
+
"name": "e",
|
|
3414
|
+
"type": {
|
|
3415
|
+
"text": "Event"
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
]
|
|
3419
|
+
}
|
|
3420
|
+
],
|
|
3421
|
+
"attributes": [
|
|
3422
|
+
{
|
|
3423
|
+
"name": "has-content",
|
|
3424
|
+
"type": {
|
|
3425
|
+
"text": "boolean"
|
|
3426
|
+
},
|
|
3427
|
+
"default": "false",
|
|
3428
|
+
"fieldName": "hasContent"
|
|
3429
|
+
}
|
|
3430
|
+
],
|
|
3431
|
+
"superclass": {
|
|
3432
|
+
"name": "LitElement",
|
|
3433
|
+
"package": "lit"
|
|
3434
|
+
},
|
|
3435
|
+
"tagName": "u-card-content",
|
|
3436
|
+
"customElement": true
|
|
3437
|
+
}
|
|
3438
|
+
],
|
|
3439
|
+
"exports": [
|
|
3440
|
+
{
|
|
3441
|
+
"kind": "js",
|
|
3442
|
+
"name": "UmCardContent",
|
|
3443
|
+
"declaration": {
|
|
3444
|
+
"name": "UmCardContent",
|
|
3445
|
+
"module": "src/card/card-content.ts"
|
|
3446
|
+
}
|
|
3447
|
+
},
|
|
3448
|
+
{
|
|
3449
|
+
"kind": "custom-element-definition",
|
|
3450
|
+
"name": "u-card-content",
|
|
3451
|
+
"declaration": {
|
|
3452
|
+
"name": "UmCardContent",
|
|
3453
|
+
"module": "src/card/card-content.ts"
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
]
|
|
3457
|
+
},
|
|
3458
|
+
{
|
|
3459
|
+
"kind": "javascript-module",
|
|
3460
|
+
"path": "src/card/card-media.styles.ts",
|
|
3461
|
+
"declarations": [
|
|
3462
|
+
{
|
|
3463
|
+
"kind": "variable",
|
|
3464
|
+
"name": "styles",
|
|
3465
|
+
"default": "css `\n :host {\n display: block;\n aspect-ratio: 1;\n border-radius: var(--u-card-shape-corner, var(--u-shape-corner-medium, 12px));\n }\n\n :host([wide]) {\n aspect-ratio: 16/9;\n }\n`"
|
|
3466
|
+
}
|
|
3467
|
+
],
|
|
3468
|
+
"exports": [
|
|
3469
|
+
{
|
|
3470
|
+
"kind": "js",
|
|
3471
|
+
"name": "styles",
|
|
3472
|
+
"declaration": {
|
|
3473
|
+
"name": "styles",
|
|
3474
|
+
"module": "src/card/card-media.styles.ts"
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
]
|
|
3478
|
+
},
|
|
3479
|
+
{
|
|
3480
|
+
"kind": "javascript-module",
|
|
3481
|
+
"path": "src/card/card-media.ts",
|
|
3482
|
+
"declarations": [
|
|
3483
|
+
{
|
|
3484
|
+
"kind": "class",
|
|
3485
|
+
"description": "",
|
|
3486
|
+
"name": "UmCardMedia",
|
|
3487
|
+
"members": [
|
|
3488
|
+
{
|
|
3489
|
+
"kind": "field",
|
|
3490
|
+
"name": "wide",
|
|
3491
|
+
"type": {
|
|
3492
|
+
"text": "boolean"
|
|
3493
|
+
},
|
|
3494
|
+
"default": "false",
|
|
3495
|
+
"attribute": "wide",
|
|
3496
|
+
"reflects": true
|
|
3497
|
+
}
|
|
3498
|
+
],
|
|
3499
|
+
"attributes": [
|
|
3500
|
+
{
|
|
3501
|
+
"name": "wide",
|
|
3502
|
+
"type": {
|
|
3503
|
+
"text": "boolean"
|
|
3504
|
+
},
|
|
3505
|
+
"default": "false",
|
|
3506
|
+
"fieldName": "wide"
|
|
3507
|
+
}
|
|
3508
|
+
],
|
|
3509
|
+
"superclass": {
|
|
3510
|
+
"name": "LitElement",
|
|
3511
|
+
"package": "lit"
|
|
3512
|
+
},
|
|
3513
|
+
"tagName": "u-card-media",
|
|
3514
|
+
"customElement": true
|
|
3515
|
+
}
|
|
3516
|
+
],
|
|
3517
|
+
"exports": [
|
|
3518
|
+
{
|
|
3519
|
+
"kind": "js",
|
|
3520
|
+
"name": "UmCardMedia",
|
|
3521
|
+
"declaration": {
|
|
3522
|
+
"name": "UmCardMedia",
|
|
3523
|
+
"module": "src/card/card-media.ts"
|
|
3524
|
+
}
|
|
3525
|
+
},
|
|
3526
|
+
{
|
|
3527
|
+
"kind": "custom-element-definition",
|
|
3528
|
+
"name": "u-card-media",
|
|
3529
|
+
"declaration": {
|
|
3530
|
+
"name": "UmCardMedia",
|
|
3531
|
+
"module": "src/card/card-media.ts"
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
]
|
|
3535
|
+
},
|
|
3536
|
+
{
|
|
3537
|
+
"kind": "javascript-module",
|
|
3538
|
+
"path": "src/card/card.styles.ts",
|
|
3539
|
+
"declarations": [
|
|
3540
|
+
{
|
|
3541
|
+
"kind": "variable",
|
|
3542
|
+
"name": "styles",
|
|
3543
|
+
"default": "css `\n :host {\n display: block;\n position: relative;\n border-radius: var(--u-card-shape-corner, var(--u-shape-corner-medium, 12px));\n }\n\n :host([variant=elevated]) {\n --u-current-bg-color: var(--u-card-elevated-bg-color, var(var(--u-color-surface-container-low, rgb(247, 242, 250))));\n background-color: var(--u-current-bg-color);\n }\n :host([variant=elevated]) u-elevation {\n --u-elevation-level: var(--u-elevated-card-elevation-level, 1);\n }\n\n :host([variant=filled]) {\n --u-current-bg-color: var(--u-card-filled-bg-color, var(--u-color-surface-container-highest, rgb(230, 224, 233)));\n background-color: var(--u-current-bg-color);\n }\n\n :host([variant=outlined]) {\n border: var(--u-outlined-card-outline-width, 1px) solid var(--u-outlined-card-outline-color, var(--u-color-outline-variant, rgb(202, 196, 208)));\n }\n\n u-card-content,\n slot {\n border-radius: inherit;\n }\n`"
|
|
3544
|
+
}
|
|
3545
|
+
],
|
|
3546
|
+
"exports": [
|
|
3547
|
+
{
|
|
3548
|
+
"kind": "js",
|
|
3549
|
+
"name": "styles",
|
|
3550
|
+
"declaration": {
|
|
3551
|
+
"name": "styles",
|
|
3552
|
+
"module": "src/card/card.styles.ts"
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
]
|
|
3556
|
+
},
|
|
3557
|
+
{
|
|
3558
|
+
"kind": "javascript-module",
|
|
3559
|
+
"path": "src/card/card.ts",
|
|
3560
|
+
"declarations": [
|
|
3561
|
+
{
|
|
3562
|
+
"kind": "class",
|
|
3563
|
+
"description": "",
|
|
3564
|
+
"name": "UmCard",
|
|
3565
|
+
"members": [
|
|
3566
|
+
{
|
|
3567
|
+
"kind": "field",
|
|
3568
|
+
"name": "variant",
|
|
3569
|
+
"type": {
|
|
3570
|
+
"text": "UmCardVariant"
|
|
3571
|
+
},
|
|
3572
|
+
"default": "'filled'",
|
|
3573
|
+
"description": "The Card variant to render.",
|
|
3574
|
+
"attribute": "variant",
|
|
3575
|
+
"reflects": true
|
|
3576
|
+
}
|
|
3577
|
+
],
|
|
3578
|
+
"attributes": [
|
|
3579
|
+
{
|
|
3580
|
+
"name": "variant",
|
|
3581
|
+
"type": {
|
|
3582
|
+
"text": "UmCardVariant"
|
|
3583
|
+
},
|
|
3584
|
+
"default": "'filled'",
|
|
3585
|
+
"description": "The Card variant to render.",
|
|
3586
|
+
"fieldName": "variant"
|
|
3587
|
+
}
|
|
3588
|
+
],
|
|
3589
|
+
"superclass": {
|
|
3590
|
+
"name": "LitElement",
|
|
3591
|
+
"package": "lit"
|
|
3592
|
+
},
|
|
3593
|
+
"tagName": "u-card",
|
|
3594
|
+
"customElement": true
|
|
3595
|
+
}
|
|
3596
|
+
],
|
|
3597
|
+
"exports": [
|
|
3598
|
+
{
|
|
3599
|
+
"kind": "js",
|
|
3600
|
+
"name": "UmCard",
|
|
3601
|
+
"declaration": {
|
|
3602
|
+
"name": "UmCard",
|
|
3603
|
+
"module": "src/card/card.ts"
|
|
3604
|
+
}
|
|
3605
|
+
},
|
|
3606
|
+
{
|
|
3607
|
+
"kind": "custom-element-definition",
|
|
3608
|
+
"name": "u-card",
|
|
3609
|
+
"declaration": {
|
|
3610
|
+
"name": "UmCard",
|
|
3611
|
+
"module": "src/card/card.ts"
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
]
|
|
3615
|
+
},
|
|
3616
3616
|
{
|
|
3617
3617
|
"kind": "javascript-module",
|
|
3618
3618
|
"path": "src/chip/chip-set.styles.ts",
|
package/field/field-base.js
CHANGED
|
@@ -99,7 +99,7 @@ export class UmFieldBase extends LitElement {
|
|
|
99
99
|
}
|
|
100
100
|
disconnectedCallback() {
|
|
101
101
|
super.disconnectedCallback();
|
|
102
|
-
this.labelSizeObserver
|
|
102
|
+
this.labelSizeObserver?.disconnect();
|
|
103
103
|
this.labelSizeObserver = null;
|
|
104
104
|
}
|
|
105
105
|
async #attach() {
|
package/field/field-base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-base.js","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAW,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,OAAgB,WAAY,SAAQ,UAAU;aAClC,WAAM,GAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,AAAvC,CAAwC;IAoC9D,MAAM,CAAC,WAAW,CAAC,WAAwB,EAAE,MAAuB;QAClE,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE;YACtC,OAAO,EAAE,oBAAoB;YAC7B,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IAqCD;QACE,KAAK,EAAE,CAAC;QAzEE,YAAO,GAAsC,QAAQ,CAAC;QAmBlE;;WAEG;QACuC,UAAK,GAAG,KAAK,CAAC;QACd,aAAQ,GAAG,KAAK,CAAC;QAE3D;;WAEG;QACuC,YAAO,GAAG,KAAK,CAAC;QAS1D;;;;WAIG;QACsE,mBAAc,GAAG,KAAK,CAAC;QAEhG;;;;WAIG;QACuE,oBAAe,GAAG,KAAK,CAAC;QAElG;;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AAY,CAAC;+CAAoC","sourcesContent":["import { consume, Context, ContextProvider } from '@lit/context';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\nimport { html, TemplateResult, LitElement, nothing } from 'lit';\nimport { property, query, queryAssignedElements, state } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './field-base.styles.js';\n\nimport { fieldDefaultsContext } from './field-defaults-context.js';\nimport { UmFieldDefaults } from './field-defaults.js';\n\nexport abstract class UmFieldBase extends LitElement {\n static override styles: CSSResultGroup = [baseStyles, styles];\n\n @consume({context: fieldDefaultsContext, subscribe: true})\n @state()\n private config: UmFieldDefaults | undefined;\n\n @property() variant: 'filled' | 'outlined' | undefined = 'filled';\n\n /**\n * The floating label for the field\n */\n @property() label: string | undefined;\n @property() counter: string | undefined;\n\n /**\n * Supporting text conveys additional information about the field, such as how it will be used\n */\n @property({attribute: 'supporting-text'}) supportingText: string | undefined;\n\n /**\n * For text fields that validate their content (such as passwords), replace supporting text with error text when applicable.\n * If `errorText` is not an empty string, changing the property `invalid` to `true` will show the `errorText` instead of `supportingText`\n */\n @property({attribute: 'error-text'}) errorText: string | undefined;\n\n /**\n * Whether the field is empty or not. This changes the behavior of the floating label when the field is not focused.\n */\n @property({type: Boolean, reflect: true}) empty = false;\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Get or sets where or not the field is in a visually invalid state.\n */\n @property({type: Boolean, reflect: true}) invalid = false;\n\n static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>> {\n return new ContextProvider(contextRoot, {\n context: fieldDefaultsContext,\n initialValue: config\n });\n }\n\n /**\n * Whether the field has a leading icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-leading-icon', reflect: true}) hasLeadingIcon = false;\n\n /**\n * Whether the field has a trailing icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-trailing-icon', reflect: true}) hasTrailingIcon = false;\n\n /**\n * Whether the field has an error text or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-error-text', reflect: true}) hasErrorText = false;\n\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly assignedLeadingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'trailing-icon', flatten: true})\n private readonly assignedTrailingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'error-text', flatten: true})\n private readonly assignedErrorTexts!: HTMLElement[];\n\n @query('.label') private _labelElement!: HTMLElement;\n @query('.container') protected _container!: HTMLElement;\n\n private labelSizeObserver: ResizeObserver | null = null;\n\n constructor() {\n super();\n this.variant = undefined;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"container ${this.variant ?? this.config?.variant ?? 'filled'}\">\n <slot\n class=\"icon leading-icon\"\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\">\n </slot>\n <label class=\"label\" slot=\"label\" id=\"label\">\n <slot name=\"label\">${this.label}</slot>\n </label>\n <div class=\"input-wrapper\" part=\"wrapper\">\n ${this.renderControl()}\n </div>\n <slot\n class=\"icon trailing-icon\"\n name=\"trailing-icon\"\n @slotchange=\"${this.handleTrailingIconSlotChange}\">\n <span>${this.renderDefaultTrailingIcon()}</span>\n </slot>\n </div>\n <div class=\"supporting-text\" id=\"supporting-text\">\n <slot\n class=\"error-text\"\n name=\"error-text\"\n @slotchange=\"${this.handleErrorTextSlotChange}\">\n <div>${this.errorText}</div>\n </slot>\n <slot name=\"supporting-text\" id=\"supporting-text\">\n <div>${this.supportingText}</div>\n </slot>\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter}</div>\n </slot>\n </div>\n ${this.renderAfterContent()}\n `;\n }\n\n protected abstract renderControl(): TemplateResult;\n protected renderAfterContent(): TemplateResult {\n return html``;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.hasLeadingIcon = !!this.assignedLeadingIcons.length;\n\n this.#attach();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.labelSizeObserver!.disconnect();\n this.labelSizeObserver = null;\n }\n\n async #attach(): Promise<void> {\n await this.updateComplete;\n this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties())\n this.labelSizeObserver.observe(this._labelElement);\n this.setLabelWidthProperties();\n }\n\n private handleLeadingIconSlotChange() {\n this._labelElement.style.transition = 'none';\n this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;\n\n setTimeout(() => {\n this._labelElement.style.transition = '';\n });\n }\n\n private handleTrailingIconSlotChange() {\n this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;\n }\n\n private handleErrorTextSlotChange() {\n this.hasErrorText = this.assignedErrorTexts.length > 0;\n }\n\n private setLabelWidthProperties() {\n\n const width = this._labelElement.offsetWidth;\n\n this.style.setProperty('--u-field-label-width', `${width}px`);\n this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);\n\n if (!width) {\n this._container.classList.add('no-label');\n return;\n }\n\n this._container.classList.remove('no-label');\n }\n\n protected renderDefaultTrailingIcon(): TemplateResult | typeof nothing {\n return nothing;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"field-base.js","sourceRoot":"","sources":["../../src/field/field-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAW,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,OAAgB,WAAY,SAAQ,UAAU;aAClC,WAAM,GA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,EAAE,IAAI,EAAC,CAAC;oDAAyB;AAO3B;IAAtE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;iDAAsB;AAG3E;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;yDACP;AAGrC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;0DACP;AAGtC;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;uDACP;AAE3B;IAAxB,KAAK,CAAC,QAAQ,CAAC;kDAAqC;AACtB;IAA9B,KAAK,CAAC,YAAY,CAAC;+CAAoC","sourcesContent":["import { consume, Context, ContextProvider } from '@lit/context';\nimport { CSSResultGroup } from '@lit/reactive-element/css-tag';\nimport { html, TemplateResult, LitElement, nothing } from 'lit';\nimport { property, query, queryAssignedElements, state } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { styles } from './field-base.styles.js';\n\nimport { fieldDefaultsContext } from './field-defaults-context.js';\nimport { UmFieldDefaults } from './field-defaults.js';\n\nexport abstract class UmFieldBase extends LitElement {\n static override styles: CSSResultGroup = [baseStyles, styles];\n\n @consume({context: fieldDefaultsContext, subscribe: true})\n @state()\n private config: UmFieldDefaults | undefined;\n\n @property() variant: 'filled' | 'outlined' | undefined = 'filled';\n\n /**\n * The floating label for the field\n */\n @property() label: string | undefined;\n @property() counter: string | undefined;\n\n /**\n * Supporting text conveys additional information about the field, such as how it will be used\n */\n @property({attribute: 'supporting-text'}) supportingText: string | undefined;\n\n /**\n * For text fields that validate their content (such as passwords), replace supporting text with error text when applicable.\n * If `errorText` is not an empty string, changing the property `invalid` to `true` will show the `errorText` instead of `supportingText`\n */\n @property({attribute: 'error-text'}) errorText: string | undefined;\n\n /**\n * Whether the field is empty or not. This changes the behavior of the floating label when the field is not focused.\n */\n @property({type: Boolean, reflect: true}) empty = false;\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Get or sets where or not the field is in a visually invalid state.\n */\n @property({type: Boolean, reflect: true}) invalid = false;\n\n static setDefaults(contextRoot: HTMLElement, config: UmFieldDefaults): ContextProvider<Context<HTMLElement, UmFieldDefaults>> {\n return new ContextProvider(contextRoot, {\n context: fieldDefaultsContext,\n initialValue: config\n });\n }\n\n /**\n * Whether the field has a leading icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-leading-icon', reflect: true}) hasLeadingIcon = false;\n\n /**\n * Whether the field has a trailing icon or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-trailing-icon', reflect: true}) hasTrailingIcon = false;\n\n /**\n * Whether the field has an error text or not\n *\n * _Note:_ Readonly\n */\n @property({type: Boolean, attribute: 'has-error-text', reflect: true}) hasErrorText = false;\n\n @queryAssignedElements({slot: 'leading-icon', flatten: true})\n private readonly assignedLeadingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'trailing-icon', flatten: true})\n private readonly assignedTrailingIcons!: HTMLElement[];\n\n @queryAssignedElements({slot: 'error-text', flatten: true})\n private readonly assignedErrorTexts!: HTMLElement[];\n\n @query('.label') private _labelElement!: HTMLElement;\n @query('.container') protected _container!: HTMLElement;\n\n private labelSizeObserver: ResizeObserver | null = null;\n\n constructor() {\n super();\n this.variant = undefined;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"container ${this.variant ?? this.config?.variant ?? 'filled'}\">\n <slot\n class=\"icon leading-icon\"\n name=\"leading-icon\"\n @slotchange=\"${this.handleLeadingIconSlotChange}\">\n </slot>\n <label class=\"label\" slot=\"label\" id=\"label\">\n <slot name=\"label\">${this.label}</slot>\n </label>\n <div class=\"input-wrapper\" part=\"wrapper\">\n ${this.renderControl()}\n </div>\n <slot\n class=\"icon trailing-icon\"\n name=\"trailing-icon\"\n @slotchange=\"${this.handleTrailingIconSlotChange}\">\n <span>${this.renderDefaultTrailingIcon()}</span>\n </slot>\n </div>\n <div class=\"supporting-text\" id=\"supporting-text\">\n <slot\n class=\"error-text\"\n name=\"error-text\"\n @slotchange=\"${this.handleErrorTextSlotChange}\">\n <div>${this.errorText}</div>\n </slot>\n <slot name=\"supporting-text\" id=\"supporting-text\">\n <div>${this.supportingText}</div>\n </slot>\n <slot class=\"counter\" name=\"counter\">\n <div>${this.counter}</div>\n </slot>\n </div>\n ${this.renderAfterContent()}\n `;\n }\n\n protected abstract renderControl(): TemplateResult;\n protected renderAfterContent(): TemplateResult {\n return html``;\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.hasLeadingIcon = !!this.assignedLeadingIcons.length;\n\n this.#attach();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n\n this.labelSizeObserver?.disconnect();\n this.labelSizeObserver = null;\n }\n\n async #attach(): Promise<void> {\n await this.updateComplete;\n this.labelSizeObserver = new ResizeObserver(() => this.setLabelWidthProperties())\n this.labelSizeObserver.observe(this._labelElement);\n this.setLabelWidthProperties();\n }\n\n private handleLeadingIconSlotChange() {\n this._labelElement.style.transition = 'none';\n this.hasLeadingIcon = this.assignedLeadingIcons.length > 0;\n\n setTimeout(() => {\n this._labelElement.style.transition = '';\n });\n }\n\n private handleTrailingIconSlotChange() {\n this.hasTrailingIcon = this.assignedTrailingIcons.length > 0;\n }\n\n private handleErrorTextSlotChange() {\n this.hasErrorText = this.assignedErrorTexts.length > 0;\n }\n\n private setLabelWidthProperties() {\n\n const width = this._labelElement.offsetWidth;\n\n this.style.setProperty('--u-field-label-width', `${width}px`);\n this.style.setProperty('--u-field-label-half-width', `${width / 2}px`);\n\n if (!width) {\n this._container.classList.add('no-label');\n return;\n }\n\n this._container.classList.remove('no-label');\n }\n\n protected renderDefaultTrailingIcon(): TemplateResult | typeof nothing {\n return nothing;\n }\n}\n"]}
|