@gyramais/gyra-design 0.1.21 → 0.1.23
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/components/Filter/Filter.d.ts +5 -1
- package/dist/components/Filter/MultipleFilter.d.ts +5 -1
- package/dist/components/Filter/index.js +6 -6
- package/dist/components/Filter/index.js.map +1 -1
- package/dist/components/List/index.js +1 -1
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Menubar/Menubar.d.ts +2 -2
- package/dist/components/Menubar/index.js +1 -1
- package/dist/components/Menubar/index.js.map +1 -1
- package/dist/components/Table/Table.d.ts +3 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/index.css +69 -68
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -3124,12 +3124,14 @@ h6 {
|
|
|
3124
3124
|
}
|
|
3125
3125
|
|
|
3126
3126
|
.gyramais-list .gyramais-list-item-title {
|
|
3127
|
+
overflow-wrap: break-word;
|
|
3127
3128
|
font-size: 1rem;
|
|
3128
3129
|
font-weight: 600;
|
|
3129
3130
|
line-height: 1.25rem
|
|
3130
3131
|
}
|
|
3131
3132
|
|
|
3132
3133
|
.gyramais-list .gyramais-list-item-description {
|
|
3134
|
+
overflow-wrap: break-word;
|
|
3133
3135
|
font-size: 0.75rem;
|
|
3134
3136
|
line-height: 1rem;
|
|
3135
3137
|
--tw-text-opacity: 1;
|
|
@@ -3210,6 +3212,7 @@ h6 {
|
|
|
3210
3212
|
|
|
3211
3213
|
.gyramais-menubar-option {
|
|
3212
3214
|
border-radius: 4px;
|
|
3215
|
+
font-weight: 600;
|
|
3213
3216
|
--tw-text-opacity: 1;
|
|
3214
3217
|
color: rgb(79 87 98 / var(--tw-text-opacity));
|
|
3215
3218
|
transition-duration: 300ms;
|
|
@@ -3261,6 +3264,7 @@ h6 {
|
|
|
3261
3264
|
}
|
|
3262
3265
|
|
|
3263
3266
|
.gyramais-menubar-content {
|
|
3267
|
+
z-index: 95 !important;
|
|
3264
3268
|
--tw-bg-opacity: 1 !important;
|
|
3265
3269
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity)) !important
|
|
3266
3270
|
}
|
|
@@ -3770,6 +3774,21 @@ h6 {
|
|
|
3770
3774
|
border-bottom-right-radius: 16px;
|
|
3771
3775
|
border-bottom-left-radius: 16px
|
|
3772
3776
|
}
|
|
3777
|
+
.gyramais-status-tag {
|
|
3778
|
+
display: flex;
|
|
3779
|
+
width: -moz-fit-content;
|
|
3780
|
+
width: fit-content;
|
|
3781
|
+
align-items: center;
|
|
3782
|
+
border-radius: 4px;
|
|
3783
|
+
padding-left: 0.5rem;
|
|
3784
|
+
padding-right: 0.5rem;
|
|
3785
|
+
padding-top: 2px;
|
|
3786
|
+
padding-bottom: 2px;
|
|
3787
|
+
font-size: 0.75rem;
|
|
3788
|
+
line-height: 1rem;
|
|
3789
|
+
font-weight: 700;
|
|
3790
|
+
line-height: 20px
|
|
3791
|
+
}
|
|
3773
3792
|
.gyramais-switch {
|
|
3774
3793
|
position: relative;
|
|
3775
3794
|
height: 25px;
|
|
@@ -3810,186 +3829,168 @@ h6 {
|
|
|
3810
3829
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
|
3811
3830
|
}
|
|
3812
3831
|
.gyramais-table-container {
|
|
3813
|
-
|
|
3814
3832
|
position: relative;
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
padding-
|
|
3833
|
+
overflow-y: auto
|
|
3834
|
+
}
|
|
3835
|
+
.gyramais-table-container.gyramais-table-card-container {
|
|
3836
|
+
padding-left: 0.25rem;
|
|
3837
|
+
padding-right: 0.5rem;
|
|
3838
|
+
padding-bottom: 0.25rem
|
|
3819
3839
|
}
|
|
3820
3840
|
|
|
3821
3841
|
.gyramais-table-container > table {
|
|
3822
|
-
|
|
3823
3842
|
width: 100%
|
|
3824
3843
|
}
|
|
3825
3844
|
|
|
3826
3845
|
.gyramais-table-container > table > thead th {
|
|
3827
|
-
|
|
3828
3846
|
position: sticky;
|
|
3829
|
-
|
|
3830
3847
|
top: -1px;
|
|
3831
|
-
|
|
3832
3848
|
z-index: 1;
|
|
3833
|
-
|
|
3834
3849
|
height: 3rem;
|
|
3835
|
-
|
|
3836
3850
|
text-wrap: nowrap;
|
|
3837
|
-
|
|
3838
3851
|
--tw-bg-opacity: 1;
|
|
3839
|
-
|
|
3840
3852
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
3841
|
-
|
|
3842
3853
|
padding-left: 1rem;
|
|
3843
|
-
|
|
3844
3854
|
padding-right: 1rem;
|
|
3845
|
-
|
|
3846
3855
|
font-size: 0.875rem;
|
|
3847
|
-
|
|
3848
3856
|
line-height: 1.25rem;
|
|
3849
|
-
|
|
3850
3857
|
font-weight: 500;
|
|
3851
|
-
|
|
3852
3858
|
line-height: 14px;
|
|
3853
|
-
|
|
3854
3859
|
--tw-text-opacity: 1;
|
|
3855
|
-
|
|
3856
3860
|
color: rgb(0 0 0 / var(--tw-text-opacity))
|
|
3857
3861
|
}
|
|
3858
3862
|
.gyramais-table-container > table > thead tr th:nth-child(1) {
|
|
3859
|
-
|
|
3860
3863
|
padding-left: 0px
|
|
3861
3864
|
}
|
|
3865
|
+
.gyramais-table-container.gyramais-table-card-container > table > thead tr th:nth-child(1) {
|
|
3866
|
+
padding-left: 1rem
|
|
3867
|
+
}
|
|
3862
3868
|
.gyramais-table-container > table > thead tr th:last-child {
|
|
3863
|
-
|
|
3864
3869
|
padding-right: 0px
|
|
3865
3870
|
}
|
|
3871
|
+
.gyramais-table-container.gyramais-table-card-container > table > thead tr th:last-child {
|
|
3872
|
+
padding-right: 1rem
|
|
3873
|
+
}
|
|
3866
3874
|
.gyramais-table-container > table > thead tr th.gyramais-table-align-left {
|
|
3867
|
-
|
|
3868
3875
|
text-align: left
|
|
3869
3876
|
}
|
|
3870
3877
|
.gyramais-table-container > table > thead tr th.gyramais-table-align-center {
|
|
3871
|
-
|
|
3872
3878
|
text-align: center
|
|
3873
3879
|
}
|
|
3874
3880
|
.gyramais-table-container > table > thead tr th.gyramais-table-align-right {
|
|
3875
|
-
|
|
3876
3881
|
text-align: right
|
|
3877
3882
|
}
|
|
3878
3883
|
|
|
3879
3884
|
.gyramais-table-container > table > tbody tr td {
|
|
3880
|
-
|
|
3881
3885
|
padding-top: 0.5rem;
|
|
3882
|
-
|
|
3883
3886
|
padding-bottom: 0.5rem;
|
|
3884
|
-
|
|
3885
3887
|
padding-left: 1rem;
|
|
3886
|
-
|
|
3887
3888
|
padding-right: 1rem;
|
|
3888
|
-
|
|
3889
3889
|
font-size: 1rem;
|
|
3890
|
-
|
|
3891
3890
|
line-height: 1.5rem;
|
|
3892
|
-
|
|
3893
3891
|
font-weight: 400;
|
|
3894
|
-
|
|
3895
3892
|
line-height: 19.2px;
|
|
3896
|
-
|
|
3897
3893
|
--tw-text-opacity: 1;
|
|
3898
|
-
|
|
3899
3894
|
color: rgb(98 105 118 / var(--tw-text-opacity))
|
|
3900
3895
|
}
|
|
3901
3896
|
|
|
3902
3897
|
@media (min-width: 768px) {
|
|
3903
|
-
|
|
3904
3898
|
.gyramais-table-container > table > tbody tr td {
|
|
3905
|
-
|
|
3906
3899
|
padding-top: 1rem;
|
|
3907
|
-
|
|
3908
3900
|
padding-bottom: 1rem
|
|
3909
3901
|
}
|
|
3910
3902
|
}
|
|
3903
|
+
.gyramais-table-container.gyramais-table-card-container > table > tbody tr td {
|
|
3904
|
+
line-height: 40px
|
|
3905
|
+
}
|
|
3906
|
+
@media (min-width: 768px) {
|
|
3907
|
+
.gyramais-table-container.gyramais-table-card-container > table > tbody tr td {
|
|
3908
|
+
padding-top: 14px;
|
|
3909
|
+
padding-bottom: 14px;
|
|
3910
|
+
line-height: 22px
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3911
3913
|
.gyramais-table-container > table > tbody tr td:nth-child(1) {
|
|
3912
|
-
|
|
3913
3914
|
padding-left: 0px
|
|
3914
3915
|
}
|
|
3916
|
+
.gyramais-table-container.gyramais-table-card-container > table > tbody tr td:nth-child(1) {
|
|
3917
|
+
padding-left: 1rem
|
|
3918
|
+
}
|
|
3915
3919
|
.gyramais-table-container > table > tbody tr td:last-child {
|
|
3916
|
-
|
|
3917
3920
|
padding-right: 0px
|
|
3918
3921
|
}
|
|
3922
|
+
.gyramais-table-container.gyramais-table-card-container > table > tbody tr td:last-child {
|
|
3923
|
+
padding-right: 1rem
|
|
3924
|
+
}
|
|
3919
3925
|
.gyramais-table-container > table > tbody tr td.gyramais-table-align-left {
|
|
3920
|
-
|
|
3921
3926
|
text-align: left
|
|
3922
3927
|
}
|
|
3923
3928
|
.gyramais-table-container > table > tbody tr td.gyramais-table-align-center {
|
|
3924
|
-
|
|
3925
3929
|
text-align: center
|
|
3926
3930
|
}
|
|
3927
3931
|
.gyramais-table-container > table > tbody tr td.gyramais-table-align-right {
|
|
3928
|
-
|
|
3929
3932
|
text-align: right
|
|
3930
3933
|
}
|
|
3931
3934
|
|
|
3932
|
-
.gyramais-table-container > table > tbody tr
|
|
3935
|
+
.gyramais-table-container.gyramais-table-card-container > table > tbody > tr {
|
|
3936
|
+
position: relative
|
|
3937
|
+
}
|
|
3938
|
+
.gyramais-table-container.gyramais-table-card-container > table > tbody > tr::after {
|
|
3939
|
+
position: absolute;
|
|
3940
|
+
left: 0px;
|
|
3941
|
+
top: 0.25rem;
|
|
3942
|
+
z-index: -1;
|
|
3943
|
+
height: calc(100% - 8px);
|
|
3944
|
+
width: 100%;
|
|
3945
|
+
--tw-translate-y: 0px;
|
|
3946
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
3947
|
+
border-radius: 12px;
|
|
3948
|
+
--tw-bg-opacity: 1;
|
|
3949
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
3950
|
+
--tw-shadow: 0 0 4px 2px rgba(24,39,75,.08), 0 2px 4px 0 rgba(24,39,75,.12);
|
|
3951
|
+
--tw-shadow-colored: 0 0 4px 2px var(--tw-shadow-color), 0 2px 4px 0 var(--tw-shadow-color);
|
|
3952
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
3953
|
+
--tw-content: '';
|
|
3954
|
+
content: var(--tw-content)
|
|
3955
|
+
}
|
|
3933
3956
|
|
|
3957
|
+
.gyramais-table-container > table > tbody tr td div {
|
|
3934
3958
|
position: relative;
|
|
3935
|
-
|
|
3936
3959
|
text-wrap: nowrap
|
|
3937
3960
|
}
|
|
3938
3961
|
|
|
3939
3962
|
@media (min-width: 768px) {
|
|
3940
|
-
|
|
3941
3963
|
.gyramais-table-container > table > tbody tr td div {
|
|
3942
|
-
|
|
3943
3964
|
overflow: hidden;
|
|
3944
|
-
|
|
3945
3965
|
display: -webkit-box;
|
|
3946
|
-
|
|
3947
3966
|
-webkit-box-orient: vertical;
|
|
3948
|
-
|
|
3949
3967
|
-webkit-line-clamp: 1;
|
|
3950
|
-
|
|
3951
3968
|
text-wrap: wrap;
|
|
3952
|
-
|
|
3953
3969
|
word-break: break-all
|
|
3954
3970
|
}
|
|
3955
3971
|
}
|
|
3956
3972
|
|
|
3957
3973
|
.gyramais-table-container .gyramais-table-empty-container {
|
|
3958
|
-
|
|
3959
3974
|
padding-top: 1rem;
|
|
3960
|
-
|
|
3961
3975
|
padding-bottom: 1rem
|
|
3962
3976
|
}
|
|
3963
3977
|
.gyramais-table-container .gyramais-table-empty-icon {
|
|
3964
|
-
|
|
3965
3978
|
display: flex;
|
|
3966
|
-
|
|
3967
3979
|
justify-content: center
|
|
3968
3980
|
}
|
|
3969
3981
|
.gyramais-table-container .gyramais-table-empty-icon svg {
|
|
3970
|
-
|
|
3971
3982
|
font-size: 40px;
|
|
3972
|
-
|
|
3973
3983
|
--tw-text-opacity: 1;
|
|
3974
|
-
|
|
3975
3984
|
color: rgb(184 184 184 / var(--tw-text-opacity))
|
|
3976
3985
|
}
|
|
3977
3986
|
.gyramais-table-container .gyramais-table-empty-text {
|
|
3978
|
-
|
|
3979
3987
|
display: flex;
|
|
3980
|
-
|
|
3981
3988
|
justify-content: center;
|
|
3982
|
-
|
|
3983
3989
|
font-size: 0.875rem;
|
|
3984
|
-
|
|
3985
3990
|
line-height: 1.25rem;
|
|
3986
|
-
|
|
3987
3991
|
font-weight: 400;
|
|
3988
|
-
|
|
3989
3992
|
line-height: 22px;
|
|
3990
|
-
|
|
3991
3993
|
--tw-text-opacity: 1;
|
|
3992
|
-
|
|
3993
3994
|
color: rgb(0 0 0 / var(--tw-text-opacity))
|
|
3994
3995
|
}
|
|
3995
3996
|
.gyramais-tabs {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/theme.ts"],"sourcesContent":["interface Colors {\r\n backgroundColor: string;\r\n primaryButton: string;\r\n secondaryButton: string;\r\n linkButton: string;\r\n}\r\n\r\ninterface Images {\r\n whiteLogoUrl: string;\r\n darkLogoUrl: string;\r\n iconUrl: string;\r\n}\r\n\r\nconst isColorDark = (hexColor: string) => {\r\n const color = hexColor.replace('#', '');\r\n\r\n const r = parseInt(color.substr(0, 2), 16);\r\n const g = parseInt(color.substr(2, 2), 16);\r\n const b = parseInt(color.substr(4, 2), 16);\r\n \r\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\r\n return (yiq <= 128);\r\n};\r\n\r\nconst getContrastYIQ = (hexColor: string) => (isColorDark(hexColor) ? '#ffffff' : '#2b2b2b');\r\n\r\nconst getTintedColor: (hexColor: string, v: number) => string = (hexColor, v) => {\r\n if (hexColor.length > 6) {\r\n hexColor= hexColor.substring(1, hexColor.length)\r\n }\r\n\r\n const rgb = parseInt(hexColor, 16); \r\n \r\n let r = Math.abs(((rgb >> 16) & 0xFF) + v);\r\n if (r > 255) {\r\n r = r - (r - 255);\r\n }\r\n \r\n let g = Math.abs(((rgb >> 8) & 0xFF) + v);\r\n if (g > 255) {\r\n g = g - (g - 255);\r\n }\r\n \r\n let b = Math.abs((rgb & 0xFF) + v);\r\n if (b > 255) {\r\n b = b - (b - 255);\r\n }\r\n\r\n const rString = (`${Number(r < 0 || isNaN(r)) ? 0 : ((r > 255) ? 255 : r).toString(16)}`).padStart(2, '0');\r\n const gString = (`${Number(g < 0 || isNaN(g)) ? 0 : ((g > 255) ? 255 : g).toString(16)}`).padStart(2, '0'); \r\n const bString = (`${Number(b < 0 || isNaN(b)) ? 0 : ((b > 255) ? 255 : b).toString(16)}`).padStart(2 ,'0'); \r\n \r\n return \"#\" + rString + gString + bString;\r\n} \r\n\r\nconst setTheme = ({ colors, images }: {\r\n colors: Colors;\r\n images: Images;\r\n}) => {\r\n const {\r\n backgroundColor,\r\n primaryButton,\r\n secondaryButton,\r\n linkButton,\r\n } = colors;\r\n\r\n if (backgroundColor) {\r\n document.documentElement.style.setProperty('--background-color', backgroundColor);\r\n document.documentElement.style.setProperty('--background-text-color', getContrastYIQ(backgroundColor));\r\n }\r\n\r\n if (primaryButton) {\r\n document.documentElement.style.setProperty('--primary-button-color', primaryButton);\r\n document.documentElement.style.setProperty('--primary-button-text-color', getContrastYIQ(primaryButton));\r\n\r\n document.documentElement.style.setProperty('--dark-button-color', `${primaryButton}66`);\r\n document.documentElement.style.setProperty('--dark-button-text-color', getContrastYIQ(primaryButton));\r\n\r\n const primaryButtonIsDark = isColorDark(primaryButton);\r\n for (let x = 0; x < 5; x += 1) {\r\n const variant = getTintedColor(primaryButton, ((x * 35) * (primaryButtonIsDark ? 1 : -1)));\r\n \r\n document.documentElement.style.setProperty(`--primary-button-color-${x}00`, variant);\r\n }\r\n }\r\n\r\n if (secondaryButton) {\r\n document.documentElement.style.setProperty('--secondary-button-color', secondaryButton);\r\n document.documentElement.style.setProperty('--secondary-button-text-color', getContrastYIQ(secondaryButton));\r\n }\r\n\r\n if (linkButton) {\r\n document.documentElement.style.setProperty('--link-button-color', linkButton);\r\n }\r\n\r\n const {\r\n darkLogoUrl,\r\n whiteLogoUrl,\r\n iconUrl,\r\n } = images;\r\n\r\n if (darkLogoUrl) {\r\n document.documentElement.style.setProperty('--dark-logo-url', `url(${darkLogoUrl})`);\r\n }\r\n\r\n if (whiteLogoUrl) {\r\n document.documentElement.style.setProperty('--white-logo-url', `url(${whiteLogoUrl})`);\r\n }\r\n\r\n if (iconUrl) {\r\n document.documentElement.style.setProperty('--icon-url', `url(${iconUrl})`);\r\n }\r\n\r\n if (backgroundColor && darkLogoUrl && whiteLogoUrl) {\r\n const backgroundColorIsDark = isColorDark(backgroundColor);\r\n\r\n document.documentElement.style.setProperty('--background-logo-url', `${backgroundColorIsDark ? `url(${whiteLogoUrl})` : `url(${darkLogoUrl})`}`)\r\n }\r\n};\r\n\r\nexport default {\r\n setTheme,\r\n};"],"names":["isColorDark","hexColor","color","replace","parseInt","substr","getContrastYIQ","getTintedColor","v","length","substring","rgb","r","Math","abs","g","b","concat","Number","isNaN","toString","padStart","theme","setTheme","_a","colors","images","backgroundColor","primaryButton","secondaryButton","linkButton","document","documentElement","style","setProperty","primaryButtonIsDark","x","variant","darkLogoUrl","whiteLogoUrl","iconUrl","backgroundColorIsDark"],"mappings":"aAaA,IAAMA,EAAc,SAACC,GACnB,IAAMC,EAAQD,EAASE,QAAQ,IAAK,IAOpC,OADkB,IAJRC,SAASF,EAAMG,OAAO,EAAG,GAAI,IAIT,IAHpBD,SAASF,EAAMG,OAAO,EAAG,GAAI,IAGG,IAFhCD,SAASF,EAAMG,OAAO,EAAG,GAAI,KAEW,KACnC,GACjB,EAEMC,EAAiB,SAACL,GAAqB,OAACD,EAAYC,GAAY,UAAY,WAE5EM,EAA0D,SAACN,EAAUO,GACrEP,EAASQ,OAAS,IACpBR,EAAUA,EAASS,UAAU,EAAGT,EAASQ,SAG3C,IAAME,EAAMP,SAASH,EAAU,IAE3BW,EAAIC,KAAKC,KAAMH,GAAO,GAAM,KAAQH,GACpCI,EAAI,MACNA,GAASA,EAAI,KAGf,IAAIG,EAAIF,KAAKC,KAAMH,GAAO,EAAK,KAAQH,GACnCO,EAAI,MACNA,GAASA,EAAI,KAGf,IAAIC,EAAIH,KAAKC,KAAW,IAANH,GAAcH,GAShC,OARIQ,EAAI,MACNA,GAASA,EAAI,KAOR,IAJU,GAAAC,OAAGC,OAAON,EAAI,GAAKO,MAAMP,IAAM,GAAMA,EAAI,IAAO,IAAMA,GAAGQ,SAAS,KAAOC,SAAS,EAAG,KACrF,GAAAJ,OAAGC,OAAOH,EAAI,GAAKI,MAAMJ,IAAM,GAAMA,EAAI,IAAO,IAAMA,GAAGK,SAAS,KAAOC,SAAS,EAAG,KACrF,GAAAJ,OAAGC,OAAOF,EAAI,GAAKG,MAAMH,IAAM,GAAMA,EAAI,IAAO,IAAMA,GAAGI,SAAS,KAAOC,SAAS,EAAG,IAGxG,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/theme.ts"],"sourcesContent":["interface Colors {\r\n backgroundColor: string;\r\n primaryButton: string;\r\n secondaryButton: string;\r\n linkButton: string;\r\n}\r\n\r\ninterface Images {\r\n whiteLogoUrl: string;\r\n darkLogoUrl: string;\r\n iconUrl: string;\r\n}\r\n\r\nconst isColorDark = (hexColor: string) => {\r\n const color = hexColor.replace('#', '');\r\n\r\n const r = parseInt(color.substr(0, 2), 16);\r\n const g = parseInt(color.substr(2, 2), 16);\r\n const b = parseInt(color.substr(4, 2), 16);\r\n \r\n const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;\r\n return (yiq <= 128);\r\n};\r\n\r\nconst getContrastYIQ = (hexColor: string) => (isColorDark(hexColor) ? '#ffffff' : '#2b2b2b');\r\n\r\nconst getTintedColor: (hexColor: string, v: number) => string = (hexColor, v) => {\r\n if (hexColor.length > 6) {\r\n hexColor= hexColor.substring(1, hexColor.length)\r\n }\r\n\r\n const rgb = parseInt(hexColor, 16); \r\n \r\n let r = Math.abs(((rgb >> 16) & 0xFF) + v);\r\n if (r > 255) {\r\n r = r - (r - 255);\r\n }\r\n \r\n let g = Math.abs(((rgb >> 8) & 0xFF) + v);\r\n if (g > 255) {\r\n g = g - (g - 255);\r\n }\r\n \r\n let b = Math.abs((rgb & 0xFF) + v);\r\n if (b > 255) {\r\n b = b - (b - 255);\r\n }\r\n\r\n const rString = (`${Number(r < 0 || isNaN(r)) ? 0 : ((r > 255) ? 255 : r).toString(16)}`).padStart(2, '0');\r\n const gString = (`${Number(g < 0 || isNaN(g)) ? 0 : ((g > 255) ? 255 : g).toString(16)}`).padStart(2, '0'); \r\n const bString = (`${Number(b < 0 || isNaN(b)) ? 0 : ((b > 255) ? 255 : b).toString(16)}`).padStart(2 ,'0'); \r\n \r\n return \"#\" + rString + gString + bString;\r\n} \r\n\r\nconst setTheme = ({ colors, images }: {\r\n colors: Colors;\r\n images: Images;\r\n}) => {\r\n const {\r\n backgroundColor,\r\n primaryButton,\r\n secondaryButton,\r\n linkButton,\r\n } = colors;\r\n\r\n if (backgroundColor) {\r\n document.documentElement.style.setProperty('--background-color', backgroundColor);\r\n document.documentElement.style.setProperty('--background-text-color', getContrastYIQ(backgroundColor));\r\n }\r\n\r\n if (primaryButton) {\r\n document.documentElement.style.setProperty('--primary-button-color', primaryButton);\r\n document.documentElement.style.setProperty('--primary-button-text-color', getContrastYIQ(primaryButton));\r\n\r\n document.documentElement.style.setProperty('--dark-button-color', `${primaryButton}66`);\r\n document.documentElement.style.setProperty('--dark-button-text-color', getContrastYIQ(primaryButton));\r\n\r\n const primaryButtonIsDark = isColorDark(primaryButton);\r\n for (let x = 0; x < 5; x += 1) {\r\n const variant = getTintedColor(primaryButton, ((x * 35) * (primaryButtonIsDark ? 1 : -1)));\r\n \r\n document.documentElement.style.setProperty(`--primary-button-color-${x}00`, variant);\r\n }\r\n }\r\n\r\n if (secondaryButton) {\r\n document.documentElement.style.setProperty('--secondary-button-color', secondaryButton);\r\n document.documentElement.style.setProperty('--secondary-button-text-color', getContrastYIQ(secondaryButton));\r\n }\r\n\r\n if (linkButton) {\r\n document.documentElement.style.setProperty('--link-button-color', linkButton);\r\n }\r\n\r\n const {\r\n darkLogoUrl,\r\n whiteLogoUrl,\r\n iconUrl,\r\n } = images;\r\n\r\n if (darkLogoUrl) {\r\n document.documentElement.style.setProperty('--dark-logo-url', `url(${darkLogoUrl})`);\r\n }\r\n\r\n if (whiteLogoUrl) {\r\n document.documentElement.style.setProperty('--white-logo-url', `url(${whiteLogoUrl})`);\r\n }\r\n\r\n if (iconUrl) {\r\n document.documentElement.style.setProperty('--icon-url', `url(${iconUrl})`);\r\n }\r\n\r\n if (backgroundColor && darkLogoUrl && whiteLogoUrl) {\r\n const backgroundColorIsDark = isColorDark(backgroundColor);\r\n\r\n document.documentElement.style.setProperty('--background-logo-url', `${backgroundColorIsDark ? `url(${whiteLogoUrl})` : `url(${darkLogoUrl})`}`)\r\n }\r\n};\r\n\r\nexport {\r\n isColorDark,\r\n}\r\n\r\nexport default {\r\n setTheme,\r\n};"],"names":["isColorDark","hexColor","color","replace","parseInt","substr","getContrastYIQ","getTintedColor","v","length","substring","rgb","r","Math","abs","g","b","concat","Number","isNaN","toString","padStart","theme","setTheme","_a","colors","images","backgroundColor","primaryButton","secondaryButton","linkButton","document","documentElement","style","setProperty","primaryButtonIsDark","x","variant","darkLogoUrl","whiteLogoUrl","iconUrl","backgroundColorIsDark"],"mappings":"aAaA,IAAMA,EAAc,SAACC,GACnB,IAAMC,EAAQD,EAASE,QAAQ,IAAK,IAOpC,OADkB,IAJRC,SAASF,EAAMG,OAAO,EAAG,GAAI,IAIT,IAHpBD,SAASF,EAAMG,OAAO,EAAG,GAAI,IAGG,IAFhCD,SAASF,EAAMG,OAAO,EA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