@swisspost/design-system-components 1.3.2 → 1.3.3
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/dist/cjs/{index-a8b23f1b.js → index-126f28cf.js} +1 -11
- package/dist/cjs/index-126f28cf.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/{check-type-f24cf91d.js → package-f1eacd4f.js} +4 -1
- package/dist/cjs/{check-type-f24cf91d.js.map → package-f1eacd4f.js.map} +1 -1
- package/dist/cjs/post-collapsible.cjs.entry.js +6 -6
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -3
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon.cjs.entry.js +79 -54
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.css +184 -82
- package/dist/collection/components/post-collapsible/post-collapsible.js +3 -2
- package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
- package/dist/collection/components/post-icon/post-icon.js +70 -50
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/get-element-height.js.map +1 -1
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/collection/utils/on-transition-end.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-non-empty.js +7 -0
- package/dist/collection/utils/property-checkers/check-non-empty.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-type.js.map +1 -1
- package/dist/collection/utils/property-checkers/constants.js +2 -0
- package/dist/collection/utils/property-checkers/constants.js.map +1 -0
- package/dist/collection/utils/property-checkers/empty-or.js +1 -1
- package/dist/collection/utils/property-checkers/empty-or.js.map +1 -1
- package/dist/collection/utils/property-checkers/index.js +1 -0
- package/dist/collection/utils/property-checkers/index.js.map +1 -1
- package/dist/collection/utils/should-reduce-motion.js.map +1 -1
- package/dist/components/{check-type.js → package.js} +4 -2
- package/dist/components/package.js.map +1 -0
- package/dist/components/post-collapsible.js +4 -4
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon.js +76 -50
- package/dist/components/post-icon.js.map +1 -1
- package/dist/docs.json +2 -2
- package/dist/esm/{index-401f2d6a.js → index-286143e7.js} +1 -11
- package/dist/esm/index-286143e7.js.map +1 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/{check-type-67411ed3.js → package-144d0036.js} +4 -2
- package/dist/esm/package-144d0036.js.map +1 -0
- package/dist/esm/post-collapsible.entry.js +4 -4
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -4
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon.entry.js +76 -51
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/post-components/{p-f214c52a.js → p-0c286590.js} +3 -3
- package/dist/post-components/p-0c286590.js.map +1 -0
- package/dist/post-components/p-20d342a4.entry.js +2 -0
- package/dist/post-components/p-20d342a4.entry.js.map +1 -0
- package/dist/post-components/p-72fc6cda.entry.js +2 -0
- package/dist/post-components/p-72fc6cda.entry.js.map +1 -0
- package/dist/post-components/p-d2e9b37c.js +2 -0
- package/dist/post-components/{p-f549b3fc.js.map → p-d2e9b37c.js.map} +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/components/post-icon/post-icon.d.ts +5 -3
- package/dist/types/utils/property-checkers/check-non-empty.d.ts +1 -0
- package/dist/types/utils/property-checkers/constants.d.ts +1 -0
- package/dist/types/utils/property-checkers/index.d.ts +1 -0
- package/package.json +15 -16
- package/dist/cjs/index-a8b23f1b.js.map +0 -1
- package/dist/components/check-type.js.map +0 -1
- package/dist/esm/check-type-67411ed3.js.map +0 -1
- package/dist/esm/index-401f2d6a.js.map +0 -1
- package/dist/post-components/p-07a51673.entry.js +0 -2
- package/dist/post-components/p-07a51673.entry.js.map +0 -1
- package/dist/post-components/p-416f1e74.entry.js +0 -2
- package/dist/post-components/p-416f1e74.entry.js.map +0 -1
- package/dist/post-components/p-f214c52a.js.map +0 -1
- package/dist/post-components/p-f549b3fc.js +0 -2
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
--bs-body-font-family: Frutiger Neue For Post, system-ui, sans-serif;
|
|
178
178
|
--bs-body-font-size: 1rem;
|
|
179
179
|
--bs-body-font-weight: 400;
|
|
180
|
-
--bs-body-line-height: 1.
|
|
180
|
+
--bs-body-line-height: 1.5;
|
|
181
181
|
--bs-body-color: #000;
|
|
182
182
|
--bs-body-bg: #fff;
|
|
183
183
|
--bs-border-width: 1px;
|
|
@@ -256,7 +256,7 @@ h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 {
|
|
|
256
256
|
margin-top: 0;
|
|
257
257
|
margin-bottom: 0.5rem;
|
|
258
258
|
font-family: inherit;
|
|
259
|
-
font-weight:
|
|
259
|
+
font-weight: 700;
|
|
260
260
|
line-height: 1.2;
|
|
261
261
|
color: inherit;
|
|
262
262
|
}
|
|
@@ -746,7 +746,6 @@ progress {
|
|
|
746
746
|
*/
|
|
747
747
|
.blockquote-footer cite {
|
|
748
748
|
font-size: 0.9375rem;
|
|
749
|
-
line-height: 1.4;
|
|
750
749
|
}
|
|
751
750
|
@media (min-width: 600px) {
|
|
752
751
|
.blockquote-footer cite {
|
|
@@ -763,7 +762,6 @@ progress {
|
|
|
763
762
|
.text-body .h5,
|
|
764
763
|
.text-body p {
|
|
765
764
|
font-size: 1.0625rem;
|
|
766
|
-
line-height: 1.4;
|
|
767
765
|
}
|
|
768
766
|
@media (min-width: 1024px) {
|
|
769
767
|
.blockquote p, .text-body h5,
|
|
@@ -778,7 +776,6 @@ progress {
|
|
|
778
776
|
.text-body h4,
|
|
779
777
|
.text-body .h4 {
|
|
780
778
|
font-size: 1.25rem;
|
|
781
|
-
line-height: 1.4;
|
|
782
779
|
}
|
|
783
780
|
@media (min-width: 1024px) {
|
|
784
781
|
.text-body h3,
|
|
@@ -786,7 +783,6 @@ progress {
|
|
|
786
783
|
.text-body h4,
|
|
787
784
|
.text-body .h4 {
|
|
788
785
|
font-size: 1.5rem;
|
|
789
|
-
line-height: 1.1;
|
|
790
786
|
}
|
|
791
787
|
}
|
|
792
788
|
@media (min-width: 1441px) {
|
|
@@ -801,7 +797,6 @@ progress {
|
|
|
801
797
|
.text-body h2,
|
|
802
798
|
.text-body .h2 {
|
|
803
799
|
font-size: 1.5rem;
|
|
804
|
-
line-height: 1.1;
|
|
805
800
|
}
|
|
806
801
|
@media (min-width: 600px) {
|
|
807
802
|
.text-body h2,
|
|
@@ -825,7 +820,6 @@ progress {
|
|
|
825
820
|
.text-body h1,
|
|
826
821
|
.text-body .h1 {
|
|
827
822
|
font-size: 1.75rem;
|
|
828
|
-
line-height: 1.1;
|
|
829
823
|
}
|
|
830
824
|
@media (min-width: 600px) {
|
|
831
825
|
.text-body h1,
|
|
@@ -854,44 +848,20 @@ progress {
|
|
|
854
848
|
margin-bottom: 0.8em;
|
|
855
849
|
}
|
|
856
850
|
|
|
857
|
-
h1,
|
|
858
|
-
.h1,
|
|
859
|
-
h2,
|
|
860
|
-
.h2,
|
|
861
|
-
h3,
|
|
862
|
-
.h3,
|
|
863
|
-
h4,
|
|
864
|
-
.h4,
|
|
865
|
-
h5,
|
|
866
|
-
.h5,
|
|
867
|
-
h6,
|
|
868
|
-
.h6 {
|
|
869
|
-
font-weight: 700;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
h6,
|
|
873
|
-
.h6,
|
|
874
851
|
.font-curve-tiny {
|
|
875
852
|
font-size: 0.8125rem;
|
|
876
|
-
line-height: 1.4;
|
|
877
853
|
}
|
|
878
854
|
@media (min-width: 600px) {
|
|
879
|
-
h6,
|
|
880
|
-
.h6,
|
|
881
855
|
.font-curve-tiny {
|
|
882
856
|
font-size: 0.9375rem;
|
|
883
857
|
}
|
|
884
858
|
}
|
|
885
859
|
@media (min-width: 1024px) {
|
|
886
|
-
h6,
|
|
887
|
-
.h6,
|
|
888
860
|
.font-curve-tiny {
|
|
889
861
|
font-size: 1rem;
|
|
890
862
|
}
|
|
891
863
|
}
|
|
892
864
|
@media (min-width: 1441px) {
|
|
893
|
-
h6,
|
|
894
|
-
.h6,
|
|
895
865
|
.font-curve-tiny {
|
|
896
866
|
font-size: 1.0625rem;
|
|
897
867
|
}
|
|
@@ -899,7 +869,6 @@ h6,
|
|
|
899
869
|
|
|
900
870
|
.font-curve-small {
|
|
901
871
|
font-size: 0.9375rem;
|
|
902
|
-
line-height: 1.4;
|
|
903
872
|
}
|
|
904
873
|
@media (min-width: 600px) {
|
|
905
874
|
.font-curve-small {
|
|
@@ -914,7 +883,6 @@ h6,
|
|
|
914
883
|
|
|
915
884
|
.font-curve-regular {
|
|
916
885
|
font-size: 1.0625rem;
|
|
917
|
-
line-height: 1.4;
|
|
918
886
|
}
|
|
919
887
|
@media (min-width: 1024px) {
|
|
920
888
|
.font-curve-regular {
|
|
@@ -922,112 +890,250 @@ h6,
|
|
|
922
890
|
}
|
|
923
891
|
}
|
|
924
892
|
|
|
925
|
-
h5,
|
|
926
|
-
.h5,
|
|
927
893
|
.font-curve-bigger-regular {
|
|
928
894
|
font-size: 1.0625rem;
|
|
929
|
-
line-height: 1.4;
|
|
930
895
|
}
|
|
931
896
|
@media (min-width: 600px) {
|
|
932
|
-
h5,
|
|
933
|
-
.h5,
|
|
934
897
|
.font-curve-bigger-regular {
|
|
935
898
|
font-size: 1.25rem;
|
|
936
899
|
}
|
|
937
900
|
}
|
|
938
901
|
@media (min-width: 1024px) {
|
|
939
|
-
h5,
|
|
940
|
-
.h5,
|
|
941
902
|
.font-curve-bigger-regular {
|
|
942
903
|
font-size: 1.5rem;
|
|
943
|
-
line-height: 1.1;
|
|
944
904
|
}
|
|
945
905
|
}
|
|
946
906
|
|
|
947
|
-
h3,
|
|
948
|
-
.h3,
|
|
949
|
-
h4,
|
|
950
|
-
.h4,
|
|
951
907
|
.font-curve-medium {
|
|
952
908
|
font-size: 1.25rem;
|
|
953
|
-
line-height: 1.4;
|
|
954
909
|
}
|
|
955
910
|
@media (min-width: 1024px) {
|
|
956
|
-
h3,
|
|
957
|
-
.h3,
|
|
958
|
-
h4,
|
|
959
|
-
.h4,
|
|
960
911
|
.font-curve-medium {
|
|
961
912
|
font-size: 1.5rem;
|
|
962
|
-
line-height: 1.1;
|
|
963
913
|
}
|
|
964
914
|
}
|
|
965
915
|
@media (min-width: 1441px) {
|
|
966
|
-
h3,
|
|
967
|
-
.h3,
|
|
968
|
-
h4,
|
|
969
|
-
.h4,
|
|
970
916
|
.font-curve-medium {
|
|
971
917
|
font-size: 1.75rem;
|
|
972
918
|
}
|
|
973
919
|
}
|
|
974
920
|
|
|
975
|
-
h2,
|
|
976
|
-
.h2,
|
|
977
921
|
.font-curve-large {
|
|
978
922
|
font-size: 1.5rem;
|
|
979
|
-
line-height: 1.1;
|
|
980
923
|
}
|
|
981
924
|
@media (min-width: 600px) {
|
|
982
|
-
h2,
|
|
983
|
-
.h2,
|
|
984
925
|
.font-curve-large {
|
|
985
926
|
font-size: 1.75rem;
|
|
986
927
|
}
|
|
987
928
|
}
|
|
988
929
|
@media (min-width: 1024px) {
|
|
989
|
-
h2,
|
|
990
|
-
.h2,
|
|
991
930
|
.font-curve-large {
|
|
992
931
|
font-size: 2rem;
|
|
993
932
|
}
|
|
994
933
|
}
|
|
995
934
|
@media (min-width: 1441px) {
|
|
996
|
-
h2,
|
|
997
|
-
.h2,
|
|
998
935
|
.font-curve-large {
|
|
999
936
|
font-size: 2.5rem;
|
|
1000
937
|
}
|
|
1001
938
|
}
|
|
1002
939
|
|
|
1003
|
-
h1,
|
|
1004
|
-
.h1,
|
|
1005
940
|
.font-curve-big {
|
|
1006
941
|
font-size: 1.75rem;
|
|
1007
|
-
line-height: 1.1;
|
|
1008
942
|
}
|
|
1009
943
|
@media (min-width: 600px) {
|
|
1010
|
-
h1,
|
|
1011
|
-
.h1,
|
|
1012
944
|
.font-curve-big {
|
|
1013
945
|
font-size: 2rem;
|
|
1014
946
|
}
|
|
1015
947
|
}
|
|
1016
948
|
@media (min-width: 1024px) {
|
|
1017
|
-
h1,
|
|
1018
|
-
.h1,
|
|
1019
949
|
.font-curve-big {
|
|
1020
950
|
font-size: 2.5rem;
|
|
1021
951
|
}
|
|
1022
952
|
}
|
|
1023
953
|
@media (min-width: 1441px) {
|
|
1024
|
-
h1,
|
|
1025
|
-
.h1,
|
|
1026
954
|
.font-curve-big {
|
|
1027
955
|
font-size: 3rem;
|
|
1028
956
|
}
|
|
1029
957
|
}
|
|
1030
958
|
|
|
959
|
+
h1,
|
|
960
|
+
.h1 {
|
|
961
|
+
font-size: 1.75rem;
|
|
962
|
+
}
|
|
963
|
+
@media (min-width: 400px) {
|
|
964
|
+
h1,
|
|
965
|
+
.h1 {
|
|
966
|
+
font-size: 2rem;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
@media (min-width: 780px) {
|
|
970
|
+
h1,
|
|
971
|
+
.h1 {
|
|
972
|
+
font-size: 2.5rem;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
@media (min-width: 1441px) {
|
|
976
|
+
h1,
|
|
977
|
+
.h1 {
|
|
978
|
+
font-size: 3rem;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
h2,
|
|
983
|
+
.h2 {
|
|
984
|
+
font-size: 1.5rem;
|
|
985
|
+
}
|
|
986
|
+
@media (min-width: 400px) {
|
|
987
|
+
h2,
|
|
988
|
+
.h2 {
|
|
989
|
+
font-size: 1.75rem;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
@media (min-width: 780px) {
|
|
993
|
+
h2,
|
|
994
|
+
.h2 {
|
|
995
|
+
font-size: 2rem;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
@media (min-width: 1441px) {
|
|
999
|
+
h2,
|
|
1000
|
+
.h2 {
|
|
1001
|
+
font-size: 2.5rem;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
h3,
|
|
1006
|
+
.h3 {
|
|
1007
|
+
font-size: 1.125rem;
|
|
1008
|
+
}
|
|
1009
|
+
@media (min-width: 400px) {
|
|
1010
|
+
h3,
|
|
1011
|
+
.h3 {
|
|
1012
|
+
font-size: 1.25rem;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
@media (min-width: 780px) {
|
|
1016
|
+
h3,
|
|
1017
|
+
.h3 {
|
|
1018
|
+
font-size: 1.5rem;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
@media (min-width: 1441px) {
|
|
1022
|
+
h3,
|
|
1023
|
+
.h3 {
|
|
1024
|
+
font-size: 1.75rem;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
h4,
|
|
1029
|
+
.h4 {
|
|
1030
|
+
font-size: 1rem;
|
|
1031
|
+
}
|
|
1032
|
+
@media (min-width: 400px) {
|
|
1033
|
+
h4,
|
|
1034
|
+
.h4 {
|
|
1035
|
+
font-size: 1.125rem;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
@media (min-width: 780px) {
|
|
1039
|
+
h4,
|
|
1040
|
+
.h4 {
|
|
1041
|
+
font-size: 1.25rem;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
@media (min-width: 1441px) {
|
|
1045
|
+
h4,
|
|
1046
|
+
.h4 {
|
|
1047
|
+
font-size: 1.5rem;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
h5,
|
|
1052
|
+
.h5 {
|
|
1053
|
+
font-size: 0.875rem;
|
|
1054
|
+
}
|
|
1055
|
+
@media (min-width: 400px) {
|
|
1056
|
+
h5,
|
|
1057
|
+
.h5 {
|
|
1058
|
+
font-size: 1rem;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
@media (min-width: 780px) {
|
|
1062
|
+
h5,
|
|
1063
|
+
.h5 {
|
|
1064
|
+
font-size: 1.125rem;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
@media (min-width: 1441px) {
|
|
1068
|
+
h5,
|
|
1069
|
+
.h5 {
|
|
1070
|
+
font-size: 1.25rem;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
h6,
|
|
1075
|
+
.h6 {
|
|
1076
|
+
font-size: 0.875rem;
|
|
1077
|
+
}
|
|
1078
|
+
@media (min-width: 780px) {
|
|
1079
|
+
h6,
|
|
1080
|
+
.h6 {
|
|
1081
|
+
font-size: 1rem;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
@media (min-width: 1441px) {
|
|
1085
|
+
h6,
|
|
1086
|
+
.h6 {
|
|
1087
|
+
font-size: 1.125rem;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
.font-size-14 {
|
|
1092
|
+
font-size: 0.875rem;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
.font-size-16 {
|
|
1096
|
+
font-size: 1rem;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
.font-size-18 {
|
|
1100
|
+
font-size: 1.125rem;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
.font-size-20 {
|
|
1104
|
+
font-size: 1.25rem;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
.font-size-24 {
|
|
1108
|
+
font-size: 1.5rem;
|
|
1109
|
+
line-height: 1.2;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
.font-size-28 {
|
|
1113
|
+
font-size: 1.75rem;
|
|
1114
|
+
line-height: 1.2;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
.font-size-32 {
|
|
1118
|
+
font-size: 2rem;
|
|
1119
|
+
line-height: 1.2;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
.font-size-40 {
|
|
1123
|
+
font-size: 2.5rem;
|
|
1124
|
+
line-height: 1.2;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
.font-size-48 {
|
|
1128
|
+
font-size: 3rem;
|
|
1129
|
+
line-height: 1.2;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
.font-size-56 {
|
|
1133
|
+
font-size: 3.5rem;
|
|
1134
|
+
line-height: 1.2;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1031
1137
|
.blockquote {
|
|
1032
1138
|
margin-top: 1.5rem;
|
|
1033
1139
|
}
|
|
@@ -1107,7 +1213,6 @@ q:lang(en) {
|
|
|
1107
1213
|
}
|
|
1108
1214
|
.text-body .lead {
|
|
1109
1215
|
font-size: 1.0625rem;
|
|
1110
|
-
line-height: 1.4;
|
|
1111
1216
|
margin-bottom: 0.8em;
|
|
1112
1217
|
}
|
|
1113
1218
|
@media (min-width: 600px) {
|
|
@@ -1118,7 +1223,6 @@ q:lang(en) {
|
|
|
1118
1223
|
@media (min-width: 1024px) {
|
|
1119
1224
|
.text-body .lead {
|
|
1120
1225
|
font-size: 1.5rem;
|
|
1121
|
-
line-height: 1.1;
|
|
1122
1226
|
}
|
|
1123
1227
|
}
|
|
1124
1228
|
|
|
@@ -2482,15 +2586,15 @@ code {
|
|
|
2482
2586
|
}
|
|
2483
2587
|
|
|
2484
2588
|
.lh-sm {
|
|
2485
|
-
line-height: 1.
|
|
2589
|
+
line-height: 1.2 !important;
|
|
2486
2590
|
}
|
|
2487
2591
|
|
|
2488
2592
|
.lh-base {
|
|
2489
|
-
line-height: 1.
|
|
2593
|
+
line-height: 1.5 !important;
|
|
2490
2594
|
}
|
|
2491
2595
|
|
|
2492
2596
|
.lh-lg {
|
|
2493
|
-
line-height:
|
|
2597
|
+
line-height: 1.5 !important;
|
|
2494
2598
|
}
|
|
2495
2599
|
|
|
2496
2600
|
.text-start {
|
|
@@ -14406,10 +14510,9 @@ a:focus, a:hover {
|
|
|
14406
14510
|
|
|
14407
14511
|
.accordion-button {
|
|
14408
14512
|
font-size: 1.0625rem;
|
|
14409
|
-
line-height: 1.4;
|
|
14410
14513
|
background-color: transparent;
|
|
14411
14514
|
font-weight: 700;
|
|
14412
|
-
line-height: 1.
|
|
14515
|
+
line-height: 1.5;
|
|
14413
14516
|
}
|
|
14414
14517
|
@media (min-width: 1024px) {
|
|
14415
14518
|
.accordion-button {
|
|
@@ -14450,7 +14553,6 @@ a:focus, a:hover {
|
|
|
14450
14553
|
.accordion-body h5,
|
|
14451
14554
|
.accordion-body h6 {
|
|
14452
14555
|
font-size: 1.0625rem;
|
|
14453
|
-
line-height: 1.4;
|
|
14454
14556
|
margin-top: 2.5rem;
|
|
14455
14557
|
margin-bottom: 0;
|
|
14456
14558
|
font-weight: 700;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
2
|
import { checkOneOf, checkType, getElementHeight, onTransitionEnd } from '../../utils';
|
|
3
|
+
import { version } from '../../../package.json';
|
|
3
4
|
let nextId = 0;
|
|
4
5
|
export class PostCollapsible {
|
|
5
6
|
constructor() {
|
|
@@ -73,7 +74,7 @@ export class PostCollapsible {
|
|
|
73
74
|
if (!this.hasHeader) {
|
|
74
75
|
return (h("div", { id: `${this.collapsibleId}--collapse`, class: this.collapseClasses, style: { height: this.collapseHeight } }, h("slot", null)));
|
|
75
76
|
}
|
|
76
|
-
return (h("div", { class: "accordion-item" }, h(this.headingTag, { class: "accordion-header", id: `${this.collapsibleId}--header` }, h("button", { class: `accordion-button ${this.isOpen ? '' : 'collapsed'}`, type: "button", "aria-expanded": `${this.isOpen}`, "aria-controls": `${this.collapsibleId}--collapse`, onClick: this.onAccordionButtonClick }, h("slot", { name: "header" }))), h("div", { id: `${this.collapsibleId}--collapse`, class: `accordion-collapse ${this.collapseClasses}`, style: { height: this.collapseHeight }, "aria-labelledby": `${this.collapsibleId}--header` }, h("div", { class: "accordion-body" }, h("slot", null)))));
|
|
77
|
+
return (h(Host, { "data-version": version }, h("div", { class: "accordion-item" }, h(this.headingTag, { class: "accordion-header", id: `${this.collapsibleId}--header` }, h("button", { class: `accordion-button ${this.isOpen ? '' : 'collapsed'}`, type: "button", "aria-expanded": `${this.isOpen}`, "aria-controls": `${this.collapsibleId}--collapse`, onClick: this.onAccordionButtonClick }, h("slot", { name: "header" }))), h("div", { id: `${this.collapsibleId}--collapse`, class: `accordion-collapse ${this.collapseClasses}`, style: { height: this.collapseHeight }, "aria-labelledby": `${this.collapsibleId}--header` }, h("div", { class: "accordion-body" }, h("slot", null))))));
|
|
77
78
|
}
|
|
78
79
|
static get is() { return "post-collapsible"; }
|
|
79
80
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-collapsible.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"post-collapsible.js","sourceRoot":"","sources":["../../../../src/components/post-collapsible/post-collapsible.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, Element, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { checkOneOf, checkType, getElementHeight, onTransitionEnd } from '../../utils';\nimport { version } from '../../../package.json';\n\nlet nextId = 0;\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private collapsibleElement: HTMLElement;\n private isLoaded = false;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() collapseClasses: string;\n @State() collapseHeight: string | null = null;\n @State() collapsibleId: string;\n @State() hasHeader: boolean;\n @State() headingTag: string | undefined;\n @State() isOpen = true;\n @State() onAccordionButtonClick = () => this.toggle();\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkType(newValue, 'boolean', 'The post-collapsible \"collapsed\" prop should be a boolean.');\n\n if (!this.isLoaded) {\n this.isOpen = !newValue;\n this.collapseClasses = this.getCollapseClasses();\n } else {\n setTimeout(() => {\n this.toggle(!newValue);\n });\n }\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: number = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkOneOf(\n newValue,\n [1, 2, 3, 4, 5, 6],\n 'The post-collapsible element requires a heading level between 1 and 6.',\n );\n\n this.headingTag = `h${newValue}`;\n }\n\n componentWillLoad() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n if (!this.hasHeader) {\n console.warn(\n 'Be sure to bind the post-collapsible to its control using aria-controls and aria-expanded attributes. More information here: https://getbootstrap.com/docs/5.2/components/collapse/#accessibility',\n );\n }\n\n this.collapsibleId = this.host.id || `post-collapsible-${nextId++}`;\n this.collapseClasses = this.getCollapseClasses();\n }\n\n componentDidLoad() {\n this.isLoaded = true;\n this.collapsibleElement = this.host.shadowRoot.querySelector(\n `#${this.collapsibleId}--collapse`,\n );\n }\n\n /**\n * Triggers the collapse programmatically.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open !== this.isOpen) {\n this.isOpen = !this.isOpen;\n\n this.startTransition();\n\n await onTransitionEnd(this.collapsibleElement).then(() => {\n this.collapseHeight = null;\n this.collapseClasses = this.getCollapseClasses();\n });\n\n return this.isOpen;\n }\n }\n\n private startTransition() {\n const expandedHeight = getElementHeight(this.collapsibleElement, 'show');\n\n this.collapseHeight = `${this.isOpen ? 0 : expandedHeight}px`;\n this.collapseClasses = 'collapsing';\n\n setTimeout(() => {\n this.collapseHeight = `${this.isOpen ? expandedHeight : 0}px`;\n }, 50);\n }\n\n private getCollapseClasses() {\n return this.isOpen ? 'collapse show' : 'collapse';\n }\n\n render() {\n if (!this.hasHeader) {\n return (\n <div\n id={`${this.collapsibleId}--collapse`}\n class={this.collapseClasses}\n style={{ height: this.collapseHeight }}\n >\n <slot />\n </div>\n );\n }\n\n return (\n <Host data-version={version}>\n <div class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.collapsibleId}--header`}>\n <button\n class={`accordion-button ${this.isOpen ? '' : 'collapsed'}`}\n type=\"button\"\n aria-expanded={`${this.isOpen}`}\n aria-controls={`${this.collapsibleId}--collapse`}\n onClick={this.onAccordionButtonClick}\n >\n <slot name=\"header\" />\n </button>\n </this.headingTag>\n <div\n id={`${this.collapsibleId}--collapse`}\n class={`accordion-collapse ${this.collapseClasses}`}\n style={{ height: this.collapseHeight }}\n aria-labelledby={`${this.collapsibleId}--header`}\n >\n <div class=\"accordion-body\">\n <slot />\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
|
-
import { checkType, checkEmptyOrType, checkEmptyOrOneOf } from '../../utils';
|
|
2
|
+
import { checkNonEmpty, checkType, checkEmptyOrType, checkEmptyOrOneOf } from '../../utils';
|
|
3
|
+
import { version } from '../../../package.json';
|
|
3
4
|
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
|
|
4
|
-
const ANIMATION_KEYS = [
|
|
5
|
-
'cylon',
|
|
6
|
-
'cylon-vertical',
|
|
7
|
-
'spin',
|
|
8
|
-
'spin-reverse',
|
|
9
|
-
'fade',
|
|
10
|
-
'throb'
|
|
11
|
-
];
|
|
5
|
+
const ANIMATION_KEYS = ['cylon', 'cylon-vertical', 'spin', 'spin-reverse', 'fade', 'throb'];
|
|
12
6
|
/**
|
|
13
7
|
* @class PostIcon - representing a stencil component
|
|
14
8
|
*/
|
|
15
9
|
export class PostIcon {
|
|
16
10
|
constructor() {
|
|
17
11
|
this.svgSource = '<svg viewBox="0 0 16 16"></svg>';
|
|
12
|
+
this.pathForceCDN = false;
|
|
18
13
|
this.svgOutput = undefined;
|
|
19
14
|
this.animation = undefined;
|
|
20
15
|
this.base = undefined;
|
|
@@ -38,6 +33,7 @@ export class PostIcon {
|
|
|
38
33
|
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipV" prop should be a boolean.');
|
|
39
34
|
}
|
|
40
35
|
validateName(newValue = this.name) {
|
|
36
|
+
checkNonEmpty(newValue, 'The post-icon "name" prop is required!.');
|
|
41
37
|
checkType(newValue, 'string', 'The post-icon "name" prop should be a string.');
|
|
42
38
|
}
|
|
43
39
|
validateRotate(newValue = this.rotate) {
|
|
@@ -46,7 +42,34 @@ export class PostIcon {
|
|
|
46
42
|
validateScale(newValue = this.scale) {
|
|
47
43
|
checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
|
|
48
44
|
}
|
|
49
|
-
|
|
45
|
+
componentWillLoad() {
|
|
46
|
+
this.validateBase();
|
|
47
|
+
this.validateName();
|
|
48
|
+
this.validateFlipH();
|
|
49
|
+
this.validateFlipV();
|
|
50
|
+
this.validateScale();
|
|
51
|
+
this.validateRotate();
|
|
52
|
+
this.validateAnimation();
|
|
53
|
+
}
|
|
54
|
+
componentWillRender() {
|
|
55
|
+
// create path dependant on the props
|
|
56
|
+
this.setPath();
|
|
57
|
+
// fetch icon if the prop "name" is defined and
|
|
58
|
+
// the path has not allready been loaded
|
|
59
|
+
if (this.name && this.path !== this.loadedPath) {
|
|
60
|
+
this.loadedPath = this.path;
|
|
61
|
+
this.fetchIcon()
|
|
62
|
+
.then(successfullyLoaded => {
|
|
63
|
+
// create icon only if an svg has been loaded successfully
|
|
64
|
+
if (successfullyLoaded)
|
|
65
|
+
this.createIcon();
|
|
66
|
+
})
|
|
67
|
+
.catch(error => {
|
|
68
|
+
console.error(error);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
setPath() {
|
|
50
73
|
var _a;
|
|
51
74
|
// Construct icon path from different possible sources
|
|
52
75
|
let basePath;
|
|
@@ -60,20 +83,43 @@ export class PostIcon {
|
|
|
60
83
|
else {
|
|
61
84
|
basePath = CDN_URL;
|
|
62
85
|
}
|
|
63
|
-
|
|
86
|
+
// use "basePath" only if "pathForceCDN" state is "false"
|
|
87
|
+
this.path = this.getPath(this.pathForceCDN ? CDN_URL : basePath);
|
|
88
|
+
// try to get the "svgSource" from localStorage
|
|
64
89
|
this.svgSource = (_a = window.localStorage.getItem(`post-icon-${this.name}`)) !== null && _a !== void 0 ? _a : this.svgSource;
|
|
90
|
+
// reset "pathForceCDN" after every try
|
|
91
|
+
this.pathForceCDN = false;
|
|
65
92
|
}
|
|
66
|
-
|
|
67
|
-
this.
|
|
68
|
-
this.validateBase();
|
|
69
|
-
this.validateFlipH();
|
|
70
|
-
this.validateFlipV();
|
|
71
|
-
this.validateName();
|
|
72
|
-
this.validateRotate();
|
|
73
|
-
this.validateScale();
|
|
74
|
-
this.fetchSVG();
|
|
93
|
+
getPath(basePath) {
|
|
94
|
+
return new URL([...basePath.split('/'), `${this.name}.svg#icon`].join('/'), window.location.origin).toString();
|
|
75
95
|
}
|
|
76
|
-
|
|
96
|
+
fetchIcon() {
|
|
97
|
+
return new Promise((resolve, reject) => {
|
|
98
|
+
fetch(this.path)
|
|
99
|
+
.then(response => response.text())
|
|
100
|
+
.then(textResponse => {
|
|
101
|
+
// match "svg" out of "textResponse"
|
|
102
|
+
const match = textResponse.match(/^<svg\b([\s\S]*)><\/svg>/);
|
|
103
|
+
if (match !== null) {
|
|
104
|
+
// set "svgSource" and return "successfullyLoaded" with true
|
|
105
|
+
this.svgSource = match[0];
|
|
106
|
+
window.localStorage.setItem(`post-icon-${this.name}`, this.svgSource);
|
|
107
|
+
resolve(true);
|
|
108
|
+
}
|
|
109
|
+
else if (this.path !== this.getPath(CDN_URL)) {
|
|
110
|
+
// if used "path" is not CDN path, and fetch has loaded something else than a "svg", try to reload it from the CDN
|
|
111
|
+
console.warn(`Warning in <post-icon/>: The path "${this.path}" seems to be no svg-only content. We'll gonna try to load the icon from the cdn.`);
|
|
112
|
+
// trigger a component update, which will result in a refetch of the icon with the "CDN_URL"
|
|
113
|
+
this.pathForceCDN = true;
|
|
114
|
+
// return "successfullyLoaded" with false
|
|
115
|
+
resolve(false);
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
.catch(reject);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
createIcon() {
|
|
122
|
+
// create inline styles for some properties
|
|
77
123
|
const svgStyles = Object.entries({
|
|
78
124
|
scale: this.scale && !isNaN(Number(this.scale)) ? `${this.scale}` : null,
|
|
79
125
|
rotate: this.rotate && !isNaN(Number(this.rotate)) ? `${this.rotate}deg` : null,
|
|
@@ -81,42 +127,15 @@ export class PostIcon {
|
|
|
81
127
|
.filter(([_key, value]) => value !== null)
|
|
82
128
|
.map(([key, value]) => `${key}: ${value}`)
|
|
83
129
|
.join(';');
|
|
130
|
+
// create svg in RAM and append the above styles, before defining the "svgOutput"
|
|
84
131
|
const helperElement = document.createElement('div');
|
|
85
132
|
helperElement.innerHTML = this.svgSource;
|
|
86
133
|
const svgElement = helperElement.querySelector('svg');
|
|
87
134
|
svgElement.setAttribute('style', svgStyles);
|
|
88
135
|
this.svgOutput = helperElement.innerHTML;
|
|
89
136
|
}
|
|
90
|
-
fetchSVG() {
|
|
91
|
-
fetch(this.path)
|
|
92
|
-
.then(response => response.text())
|
|
93
|
-
.then(textResponse => {
|
|
94
|
-
const match = textResponse.match(/^<svg\b([\s\S]*)><\/svg>/);
|
|
95
|
-
if (match !== null) {
|
|
96
|
-
this.svgSource = match[0];
|
|
97
|
-
window.localStorage.setItem(`post-icon-${this.name}`, this.svgSource);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
this.initialPath = this.path;
|
|
101
|
-
this.path = this.getPath(CDN_URL);
|
|
102
|
-
if (this.initialPath !== this.path) {
|
|
103
|
-
console.warn(`Warning in <post-icon/>: The content on the path "${this.path}" seems to be no svg-only content. We'll gonna try to load the icon from the cdn.`);
|
|
104
|
-
this.fetchSVG();
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.error(`Error in <post-icon/>: Could not load the svg on the path "${this.initialPath}"!`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
.catch(error => {
|
|
112
|
-
console.log(error);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
getPath(basePath) {
|
|
116
|
-
return new URL([...basePath.split('/'), `${this.name}.svg#icon`].join('/'), window.location.origin).toString();
|
|
117
|
-
}
|
|
118
137
|
render() {
|
|
119
|
-
return (h(Host,
|
|
138
|
+
return (h(Host, { "data-version": version }, h("div", { innerHTML: this.svgOutput })));
|
|
120
139
|
}
|
|
121
140
|
static get is() { return "post-icon"; }
|
|
122
141
|
static get encapsulation() { return "shadow"; }
|
|
@@ -255,6 +274,7 @@ export class PostIcon {
|
|
|
255
274
|
}
|
|
256
275
|
static get states() {
|
|
257
276
|
return {
|
|
277
|
+
"pathForceCDN": {},
|
|
258
278
|
"svgOutput": {}
|
|
259
279
|
};
|
|
260
280
|
}
|