@kompasid/lit-web-components 0.8.16 → 0.8.17

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.
@@ -8,6 +8,7 @@ import {
8
8
  meteredRegisterResponse,
9
9
  meteredRegisterContent,
10
10
  } from './types.js'
11
+ import { ellipsisText } from '../../utils/ellipsisText.js'
11
12
 
12
13
  @customElement('kompasid-metered-wall-register')
13
14
  export class KompasMeteredWallRegister extends LitElement {
@@ -17,6 +18,10 @@ export class KompasMeteredWallRegister extends LitElement {
17
18
  font-family: 'PT Sans', sans-serif;
18
19
  }
19
20
 
21
+ .font-lora {
22
+ font-family: 'Lora', 'Georgia', 'serif';
23
+ }
24
+
20
25
  .body {
21
26
  position: sticky;
22
27
  top: 0;
@@ -24,8 +29,10 @@ export class KompasMeteredWallRegister extends LitElement {
24
29
  width: 100%;
25
30
  }
26
31
 
27
- .banner-content {
28
- gap: 55px;
32
+ @media (min-width: 768px) {
33
+ .md\:max-w-\[737px\] {
34
+ max-width: 737px;
35
+ }
29
36
  }
30
37
  `,
31
38
  TWStyles,
@@ -168,17 +175,17 @@ export class KompasMeteredWallRegister extends LitElement {
168
175
  <div class="flex flex-col space-y-4">
169
176
  <div class="flex justify-between items-center h-full">
170
177
  <div class="w-9 h-9 hidden lg:block"></div>
171
- <div class="banner-content flex flex-row items-center">
178
+ <div class="flex flex-row items-center gap-6">
172
179
  <div
173
- class="text-base md:text-lg font-lora"
174
- .innerHTML=${this.setTemplate('title')}
180
+ class="text-base md:text-lg font-lora md:max-w-[737px] text-grey-600"
181
+ .innerHTML=${ellipsisText(this.setTemplate('title'), 76)}
175
182
  ></div>
176
183
  <div class="hidden md:block">${this.registerButtonTemplate()}</div>
177
184
  </div>
178
185
  <div>
179
186
  <button
180
187
  @click="${this.triggerExpandBanner}"
181
- class="h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200"
188
+ class="h-9 w-9 flex ml-auto items-center justify-center text-blue-500 rounded bg-blue-200"
182
189
  >
183
190
  <div
184
191
  class="icon icon-blue-600 ${this.isExpandBanner
@@ -198,13 +205,13 @@ export class KompasMeteredWallRegister extends LitElement {
198
205
  private expandedBannerContent() {
199
206
  return html`
200
207
  <div
201
- class="flex flex-col-reverse justify-between md:flex-row gap-4 md:gap-8"
208
+ class="flex flex-col-reverse justify-between md:flex-row gap-4 md:gap-8 text-grey-600"
202
209
  >
203
210
  <div
204
211
  class="flex flex-col justify-evenly md:text-left md:w-5/12 gap-4 ml-auto"
205
212
  >
206
213
  <p
207
- class="text-lg md:text-2xl font-lora"
214
+ class="text-2xl md:text-2xl font-lora"
208
215
  .innerHTML=${this.setTemplate('title', 'expand')}
209
216
  ></p>
210
217
  <p
@@ -223,7 +230,7 @@ export class KompasMeteredWallRegister extends LitElement {
223
230
  </div>
224
231
  <button
225
232
  @click="${this.triggerExpandBanner}"
226
- class="h-9 w-9 flex items-center justify-center text-blue-500 rounded bg-blue-200"
233
+ class="h-9 w-9 flex items-center justify-center text-blue-500 rounded bg-blue-200 ml-auto"
227
234
  >
228
235
  <div
229
236
  class="icon icon-blue-600 ${this.isExpandBanner
@@ -246,15 +253,15 @@ export class KompasMeteredWallRegister extends LitElement {
246
253
  ${!this.textTemplate.expand.ctaUrl
247
254
  ? html`<button
248
255
  @click=${this.redirectToRegister}
249
- class="bg-green-500 p-1.5 w-full whitespace-nowrap rounded-md font-bold text-grey-100 text-sm md:text-base"
256
+ class="bg-green-500 p-3 w-full whitespace-nowrap rounded-md font-bold text-grey-100 text-sm md:text-base"
250
257
  >
251
258
  Daftar Akun
252
259
  </button>`
253
260
  : html`<button
254
261
  @click=${this.redirectToCTAUrl}
255
- class="bg-green-500 p-1.5 w-full whitespace-nowrap rounded-md font-bold text-grey-100 px-5 text-sm md:text-base md:w-auto"
262
+ class="bg-green-500 p-3 w-full whitespace-nowrap rounded-md font-bold text-grey-100 px-5 text-sm md:text-base md:w-auto md:mr-6"
256
263
  >
257
- ${this.textTemplate.expand.ctaText}
264
+ ${ellipsisText(this.textTemplate.expand.ctaText, 24)}
258
265
  </button>`}
259
266
  </div>
260
267
  `
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shorten a string to a given length, appending an ellipsis if necessary.
3
+ * @param {string} string The string to be shortened.
4
+ * @param {number} [length=255] The desired length of the output string.
5
+ * @return {string}
6
+ */
7
+ const ellipsisText = (string: string, length: number = 255): string => {
8
+ const parser = new DOMParser()
9
+ const doc = parser.parseFromString(string, 'text/html')
10
+
11
+ let fullText = doc.body.textContent || ''
12
+
13
+ if (fullText.length <= length) {
14
+ return fullText
15
+ }
16
+ fullText = fullText.substring(0, length - 1)
17
+
18
+ const lastSpace = fullText.lastIndexOf(' ')
19
+
20
+ return `${fullText.substring(
21
+ 0,
22
+ Math.sign(lastSpace) > 0 ? lastSpace : length
23
+ )}...`
24
+ }
25
+
26
+ export { ellipsisText }
@@ -713,10 +713,6 @@ video {
713
713
  margin-left: 0.75rem;
714
714
  }
715
715
 
716
- .ml-4 {
717
- margin-left: 1rem;
718
- }
719
-
720
716
  .ml-8 {
721
717
  margin-left: 2rem;
722
718
  }
@@ -745,6 +741,14 @@ video {
745
741
  margin-right: 1.5rem;
746
742
  }
747
743
 
744
+ .mt-0 {
745
+ margin-top: 0px;
746
+ }
747
+
748
+ .mt-0\.5 {
749
+ margin-top: 0.125rem;
750
+ }
751
+
748
752
  .mt-1 {
749
753
  margin-top: 0.25rem;
750
754
  }
@@ -801,6 +805,10 @@ video {
801
805
  height: 3rem;
802
806
  }
803
807
 
808
+ .h-14 {
809
+ height: 3.5rem;
810
+ }
811
+
804
812
  .h-16 {
805
813
  height: 4rem;
806
814
  }
@@ -845,6 +853,10 @@ video {
845
853
  height: 17px;
846
854
  }
847
855
 
856
+ .h-\[300px\] {
857
+ height: 300px;
858
+ }
859
+
848
860
  .h-\[68px\] {
849
861
  height: 68px;
850
862
  }
@@ -874,6 +886,10 @@ video {
874
886
  width: 33.333333%;
875
887
  }
876
888
 
889
+ .w-1\/4 {
890
+ width: 25%;
891
+ }
892
+
877
893
  .w-1\/5 {
878
894
  width: 20%;
879
895
  }
@@ -886,6 +902,10 @@ video {
886
902
  width: 91.666667%;
887
903
  }
888
904
 
905
+ .w-14 {
906
+ width: 3.5rem;
907
+ }
908
+
889
909
  .w-16 {
890
910
  width: 4rem;
891
911
  }
@@ -1029,6 +1049,16 @@ video {
1029
1049
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
1030
1050
  }
1031
1051
 
1052
+ @keyframes spin {
1053
+ to {
1054
+ transform: rotate(360deg);
1055
+ }
1056
+ }
1057
+
1058
+ .animate-spin {
1059
+ animation: spin 1s linear infinite;
1060
+ }
1061
+
1032
1062
  .cursor-pointer {
1033
1063
  cursor: pointer;
1034
1064
  }
@@ -1173,6 +1203,10 @@ video {
1173
1203
  overflow: hidden;
1174
1204
  }
1175
1205
 
1206
+ .overflow-y-scroll {
1207
+ overflow-y: scroll;
1208
+ }
1209
+
1176
1210
  .truncate {
1177
1211
  overflow: hidden;
1178
1212
  text-overflow: ellipsis;
@@ -1183,6 +1217,10 @@ video {
1183
1217
  white-space: nowrap;
1184
1218
  }
1185
1219
 
1220
+ .break-words {
1221
+ overflow-wrap: break-word;
1222
+ }
1223
+
1186
1224
  .rounded {
1187
1225
  border-radius: 0.25rem;
1188
1226
  }
@@ -1351,6 +1389,11 @@ video {
1351
1389
  background-color: rgb(46 46 46 / var(--tw-bg-opacity));
1352
1390
  }
1353
1391
 
1392
+ .bg-green-100 {
1393
+ --tw-bg-opacity: 1;
1394
+ background-color: rgb(238 252 210 / var(--tw-bg-opacity));
1395
+ }
1396
+
1354
1397
  .bg-green-300 {
1355
1398
  --tw-bg-opacity: 1;
1356
1399
  background-color: rgb(151 219 83 / var(--tw-bg-opacity));
@@ -1391,6 +1434,11 @@ video {
1391
1434
  background-color: rgb(255 238 204 / var(--tw-bg-opacity));
1392
1435
  }
1393
1436
 
1437
+ .bg-red-100 {
1438
+ --tw-bg-opacity: 1;
1439
+ background-color: rgb(254 225 207 / var(--tw-bg-opacity));
1440
+ }
1441
+
1394
1442
  .bg-white {
1395
1443
  --tw-bg-opacity: 1;
1396
1444
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
@@ -1443,6 +1491,11 @@ video {
1443
1491
  padding: 1.5rem;
1444
1492
  }
1445
1493
 
1494
+ .px-0 {
1495
+ padding-left: 0px;
1496
+ padding-right: 0px;
1497
+ }
1498
+
1446
1499
  .px-2 {
1447
1500
  padding-left: 0.5rem;
1448
1501
  padding-right: 0.5rem;
@@ -1488,6 +1541,11 @@ video {
1488
1541
  padding-bottom: 0.125rem;
1489
1542
  }
1490
1543
 
1544
+ .py-1 {
1545
+ padding-top: 0.25rem;
1546
+ padding-bottom: 0.25rem;
1547
+ }
1548
+
1491
1549
  .py-2 {
1492
1550
  padding-top: 0.5rem;
1493
1551
  padding-bottom: 0.5rem;
@@ -1573,8 +1631,8 @@ video {
1573
1631
  padding-left: 1px;
1574
1632
  }
1575
1633
 
1576
- .pr-14 {
1577
- padding-right: 3.5rem;
1634
+ .pr-1 {
1635
+ padding-right: 0.25rem;
1578
1636
  }
1579
1637
 
1580
1638
  .pr-2 {
@@ -1822,6 +1880,11 @@ video {
1822
1880
  color: rgb(51 51 51 / var(--tw-text-opacity));
1823
1881
  }
1824
1882
 
1883
+ .text-grey-700 {
1884
+ --tw-text-opacity: 1;
1885
+ color: rgb(0 0 0 / var(--tw-text-opacity));
1886
+ }
1887
+
1825
1888
  .text-orange-400 {
1826
1889
  --tw-text-opacity: 1;
1827
1890
  color: rgb(255 122 0 / var(--tw-text-opacity));
@@ -1832,6 +1895,11 @@ video {
1832
1895
  color: rgb(219 93 0 / var(--tw-text-opacity));
1833
1896
  }
1834
1897
 
1898
+ .text-red-600 {
1899
+ --tw-text-opacity: 1;
1900
+ color: rgb(174 9 27 / var(--tw-text-opacity));
1901
+ }
1902
+
1835
1903
  .text-white {
1836
1904
  --tw-text-opacity: 1;
1837
1905
  color: rgb(255 255 255 / var(--tw-text-opacity));
@@ -1930,8 +1998,8 @@ video {
1930
1998
  margin-right: 1.25rem;
1931
1999
  }
1932
2000
 
1933
- .md\:mt-0 {
1934
- margin-top: 0px;
2001
+ .md\:mr-6 {
2002
+ margin-right: 1.5rem;
1935
2003
  }
1936
2004
 
1937
2005
  .md\:mt-2 {
@@ -2011,10 +2079,6 @@ video {
2011
2079
  width: 13rem;
2012
2080
  }
2013
2081
 
2014
- .md\:w-\[165px\] {
2015
- width: 165px;
2016
- }
2017
-
2018
2082
  .md\:w-\[350px\] {
2019
2083
  width: 350px;
2020
2084
  }
@@ -2055,6 +2119,10 @@ video {
2055
2119
  max-width: 464px;
2056
2120
  }
2057
2121
 
2122
+ .md\:max-w-\[737px\] {
2123
+ max-width: 737px;
2124
+ }
2125
+
2058
2126
  .md\:max-w-full {
2059
2127
  max-width: 100%;
2060
2128
  }
@@ -2091,10 +2159,6 @@ video {
2091
2159
  justify-content: center;
2092
2160
  }
2093
2161
 
2094
- .md\:gap-2 {
2095
- gap: 0.5rem;
2096
- }
2097
-
2098
2162
  .md\:gap-8 {
2099
2163
  gap: 2rem;
2100
2164
  }
@@ -2149,10 +2213,6 @@ video {
2149
2213
  align-self: flex-end;
2150
2214
  }
2151
2215
 
2152
- .md\:self-center {
2153
- align-self: center;
2154
- }
2155
-
2156
2216
  .md\:rounded {
2157
2217
  border-radius: 0.25rem;
2158
2218
  }