@kompasid/lit-web-components 0.9.11 → 0.9.13

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.
Files changed (44) hide show
  1. package/demo/index.html +2 -2
  2. package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +9 -24
  3. package/dist/src/components/kompasid-freewall/KompasFreewall.js +44 -100
  4. package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -1
  5. package/dist/src/components/kompasid-freewall/old_KompasFreewall.d.ts +96 -0
  6. package/dist/src/components/kompasid-freewall/old_KompasFreewall.js +305 -0
  7. package/dist/src/components/kompasid-freewall/old_KompasFreewall.js.map +1 -0
  8. package/dist/src/components/kompasid-freewall/types.d.ts +26 -0
  9. package/dist/src/components/kompasid-freewall/types.js.map +1 -1
  10. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +9 -14
  11. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +58 -102
  12. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -1
  13. package/dist/src/components/kompasid-freewall-body/old_KompasFreewallBody.d.ts +34 -0
  14. package/dist/src/components/kompasid-freewall-body/old_KompasFreewallBody.js +228 -0
  15. package/dist/src/components/kompasid-freewall-body/old_KompasFreewallBody.js.map +1 -0
  16. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +8 -19
  17. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +33 -52
  18. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -1
  19. package/dist/src/components/kompasid-freewall-head/old_KompasFreewallHead.d.ts +38 -0
  20. package/dist/src/components/kompasid-freewall-head/old_KompasFreewallHead.js +125 -0
  21. package/dist/src/components/kompasid-freewall-head/old_KompasFreewallHead.js.map +1 -0
  22. package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js +1 -1
  23. package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js.map +1 -1
  24. package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js +5 -7
  25. package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js.map +1 -1
  26. package/dist/tailwind/tailwind.js +48 -8
  27. package/dist/tailwind/tailwind.js.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +1 -1
  30. package/src/components/kompasid-freewall/KompasFreewall.ts +52 -85
  31. package/src/components/kompasid-freewall/old_KompasFreewall.ts +255 -0
  32. package/src/components/kompasid-freewall/readme.md +40 -84
  33. package/src/components/kompasid-freewall/types.ts +29 -0
  34. package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +59 -101
  35. package/src/components/kompasid-freewall-body/old_KompasFreewallBody.ts +224 -0
  36. package/src/components/kompasid-freewall-body/readme.md +31 -7
  37. package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +31 -39
  38. package/src/components/kompasid-freewall-head/old_KompasFreewallHead.ts +103 -0
  39. package/src/components/kompasid-freewall-head/readme.md +29 -13
  40. package/src/components/kompasid-grace-period/KompasGracePeriod.ts +1 -1
  41. package/src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts +5 -7
  42. package/tailwind/tailwind.css +48 -6
  43. package/tailwind/tailwind.ts +48 -8
  44. package/tailwind.config.js +1 -1
@@ -0,0 +1,103 @@
1
+ import { html, css, LitElement, nothing } from 'lit'
2
+ import { property, customElement } from 'lit/decorators.js'
3
+ import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
4
+ import { TWStyles } from '../../../tailwind/tailwind.js'
5
+ import { addGoogleFonts } from '../../utils/googleFont.js'
6
+ import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'
7
+ import { JsonPackageData, PackageData } from '../kompasid-freewall/types.js'
8
+
9
+ @customElement('kompasid-freewall-head')
10
+ export class KompasFreewallHead extends LitElement {
11
+ static styles = [css``, TWStyles]
12
+
13
+ /**
14
+ * Props
15
+ */
16
+ /**
17
+ * property isLogin untuk menghandle apakah user sudah login atau belum
18
+ * property type untuk menghandle tipe freewall
19
+ * property head_copy_expand to update copy header when expand
20
+ * property head_copy_collapse to update copy header when collapse
21
+ * property expand to handle expand/collapse
22
+ * property toggleExpand to handle toggle expand/collapse
23
+ * property onSubscriptionClick to handle cta when subscription button is clicked
24
+ */
25
+
26
+ @property({ type: Boolean }) isLogin = false
27
+ @property({ type: String }) type: 'article' | 'landing_page' = 'article'
28
+ @property({ type: String }) head_copy_expand = ''
29
+ @property({ type: String }) head_copy_collapse = ''
30
+ @property({ type: Boolean }) expand = true
31
+ @property() toggleExpand = () => {}
32
+ @property() onSubscriptionClick = () => {}
33
+ @property({ type: Object }) packageData: PackageData = {} as PackageData
34
+ @property({ type: Object }) jsonPackageData: JsonPackageData =
35
+ {} as JsonPackageData
36
+
37
+ /**
38
+ * Getter
39
+ */
40
+
41
+ get headCopy() {
42
+ return (
43
+ (this.expand ? this.head_copy_expand : this.head_copy_collapse) ||
44
+ 'Akses seluruh konten dan fitur Kompas.id dengan berlangganan.'
45
+ )
46
+ }
47
+
48
+ /**
49
+ * Lifecycle
50
+ */
51
+
52
+ override async connectedCallback() {
53
+ super.connectedCallback()
54
+ await this.updateComplete
55
+ addGoogleFonts(['pt-sans'])
56
+ }
57
+
58
+ /**
59
+ * Render Statement
60
+ */
61
+
62
+ render() {
63
+ return html`
64
+ <div class="flex flex-col px-4 md:px-0 space-y-4 pt-4 pb-5 md:py-2">
65
+ <div class="flex justify-between items-center h-full">
66
+ <div
67
+ class="hidden ${this.expand ? 'md:block' : 'lg:block'} w-9 h-9"
68
+ ></div>
69
+ <div class="flex items-center md:justify-start">
70
+ <p class="w-full text-grey-600">${this.headCopy}</p>
71
+ ${!this.expand
72
+ ? html`<button
73
+ @click=${this.onSubscriptionClick}
74
+ class="bg-green-500 hidden md:block ml-3 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
75
+ >
76
+ ${this.jsonPackageData.subscriptionButtonText}
77
+ </button>`
78
+ : nothing}
79
+ </div>
80
+ <div>
81
+ <button
82
+ @click=${this.toggleExpand}
83
+ aria-label="Toggle Expand"
84
+ class="h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200"
85
+ >
86
+ <div class="${!this.expand && 'rotate-180'}">
87
+ ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}
88
+ </div>
89
+ </button>
90
+ </div>
91
+ </div>
92
+ ${!this.expand
93
+ ? html`<button
94
+ @click=${this.onSubscriptionClick}
95
+ class="bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
96
+ >
97
+ ${this.jsonPackageData.subscriptionButtonText}
98
+ </button>`
99
+ : nothing}
100
+ </div>
101
+ `
102
+ }
103
+ }
@@ -2,16 +2,32 @@
2
2
 
3
3
  ## Properties
4
4
 
5
- | Property | Attribute | Description | Type | Default |
6
- | ------------------------------ | ------------------------------ | ---------------------------------------------------------------------------------------- | -------- | ------- |
7
- | `isLogin` | `isLogin` | property isLogin untuk menghandle apakah user sudah login atau belum | `boolean` | `false` |
8
- | `type` | `type` | property type untuk menghandle tipe freewall | `"article" \| "landing_page"` | `"article"`
9
- | `expand` | `expand` | property expand to handle expand/collapse | `boolean` | `true` |
10
- | `head_copy_expand` | `head_copy_expand` |property head_copy_expand to update copy header when expand | `string` | `""` |
11
- | `head_copy_collapse` | `head_copy_collapse` |property head_copy_expand to update copy header when collapse | `string` | `""` |
12
- | `packageData` | `packageData` | packageData sebagai data package yang akan di offer | `PackageData` | `{}` |
13
- | `toggleExpand` | `toggleExpand` |property toggleExpand to handle toggle expand/collapse | `Function` | `() => {}` |
14
-
15
- ----------------------------------------------
16
-
17
- *Terbikin oleh tim front-end kompas.id*
5
+ | Property | Attribute | Description | Type | Default |
6
+ | --------------- | --------- | ----------------------------------------------------------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7
+ | `expand` | `expand` | Property untuk mengatur apakah tampilan sedang dalam mode *expand* atau *collapse*. | `boolean` | `true` |
8
+ | `headData` | | Data header berisi teks copy untuk expand/collapse dan data tombol CTA. | `HeadDataFreeWall` | `{ headCopyExpand: 'Expand Default.', headCopyCollapse: 'Collapse Default.', cta: { text: 'Langganan', url: '#' } }` |
9
+ | `toggleExpand` | | Fungsi untuk menangani aksi klik tombol expand/collapse. | `Function` | `() => {}` |
10
+ | `onButtonClick` | | Fungsi untuk menangani klik pada tombol CTA. | `Function` | `(url: string) => url` |
11
+
12
+ ---
13
+
14
+ ## HeadDataFreeWall Structure
15
+
16
+ Tambahan deskripsi untuk membantu developer:
17
+
18
+ | Property | Type | Description |
19
+ | ------------------ | -------- | --------------------------------------------------------- |
20
+ | `headCopyExpand` | `string` | Teks header yang ditampilkan saat dalam keadaan expand. |
21
+ | `headCopyCollapse` | `string` | Teks header yang ditampilkan saat dalam keadaan collapse. |
22
+ | `cta` | `object` | Data tombol CTA. |
23
+
24
+ **cta structure:**
25
+
26
+ | Property | Type | Description |
27
+ | -------- | -------- | ------------------------------ |
28
+ | `text` | `string` | Label tombol CTA. |
29
+ | `url` | `string` | URL tujuan saat tombol diklik. |
30
+
31
+ ---
32
+
33
+ *Dibuat oleh tim front-end kompas.id*
@@ -133,7 +133,7 @@ export class KompasGracePeriod extends LitElement {
133
133
  this.sendGtmEvent('subscribe_button_clicked')
134
134
 
135
135
  window.open(
136
- `${this.checkoutPage}/kdp?productId=${this.paywall_subscription_id}&referrer=${originHost}&source=${this.source}`
136
+ `${this.checkoutPage}/v2/kdp?productId=${this.paywall_subscription_id}&autorenewal=1&referrer=${originHost}&source=${this.source}`
137
137
  )
138
138
  }
139
139
 
@@ -246,7 +246,7 @@ export class KompasMenuSideBar extends LitElement {
246
246
  class="py-0.5 px-1.5 rounded-full"
247
247
  style="position: relative; display: inline-flex; background-color:#D71920;"
248
248
  >
249
- <span class="font-bold font-pt-sans text-xs text-white capitalize"
249
+ <span class="font-bold font-sans text-xs text-white capitalize"
250
250
  >Baru</span
251
251
  >
252
252
  </div>
@@ -303,7 +303,7 @@ export class KompasMenuSideBar extends LitElement {
303
303
  ${unsafeSVG(getFontAwesomeIcon('fas', 'bars'))}
304
304
  </div>
305
305
  <span
306
- class="font-pt-sans hidden sm:inline ml-2 tracking-wide font-bold ${this
306
+ class="font-sans hidden sm:inline ml-2 tracking-wide font-bold ${this
307
307
  .isDark
308
308
  ? 'text-[#FFFFFF]'
309
309
  : 'text-brand-1'}"
@@ -365,9 +365,7 @@ export class KompasMenuSideBar extends LitElement {
365
365
  </div>
366
366
  `
367
367
  : ''}
368
- <span
369
- class="font-pt-sans relative text-xs text-[#666666]"
370
- >
368
+ <span class="font-sans relative text-xs text-[#666666]">
371
369
  ${item.name}
372
370
  </span>
373
371
  <div class="ml-1">
@@ -385,7 +383,7 @@ export class KompasMenuSideBar extends LitElement {
385
383
  <div class="flex justify-between flex-col">
386
384
  ${this.dataSidebar.feature.map(
387
385
  item => html`
388
- <div class="w-full font-pt-sans">
386
+ <div class="w-full font-sans">
389
387
  <!-- Parent item -->
390
388
  <div
391
389
  class="flex items-center justify-between px-4 text-sm font-medium text-gray-700 transition-all cursor-pointer"
@@ -499,7 +497,7 @@ export class KompasMenuSideBar extends LitElement {
499
497
  <div class="w-full flex justify-between flex-col">
500
498
  ${this.dataSidebar.category.map(
501
499
  item => html`
502
- <div class="w-full font-pt-sans">
500
+ <div class="w-full font-sans">
503
501
  <!-- Parent item -->
504
502
  <div
505
503
  class="flex items-center justify-between text-sm font-medium px-4 transition-all cursor-pointer"
@@ -154,7 +154,7 @@ html,
154
154
  -o-tab-size: 4;
155
155
  tab-size: 4;
156
156
  /* 3 */
157
- font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
157
+ font-family: "PT Sans", Arial, Verdana, Helvetica, sans-serif;
158
158
  /* 4 */
159
159
  font-feature-settings: normal;
160
160
  /* 5 */
@@ -730,6 +730,10 @@ video {
730
730
  margin-bottom: 1.5rem;
731
731
  }
732
732
 
733
+ .mb-8 {
734
+ margin-bottom: 2rem;
735
+ }
736
+
733
737
  .ml-0\.5 {
734
738
  margin-left: 0.125rem;
735
739
  }
@@ -1015,6 +1019,10 @@ video {
1015
1019
  width: 216px;
1016
1020
  }
1017
1021
 
1022
+ .w-\[276px\] {
1023
+ width: 276px;
1024
+ }
1025
+
1018
1026
  .w-\[296px\] {
1019
1027
  width: 296px;
1020
1028
  }
@@ -1118,6 +1126,19 @@ video {
1118
1126
  cursor: pointer;
1119
1127
  }
1120
1128
 
1129
+ .snap-x {
1130
+ scroll-snap-type: x var(--tw-scroll-snap-strictness);
1131
+ }
1132
+
1133
+ .snap-start {
1134
+ scroll-snap-align: start;
1135
+ }
1136
+
1137
+ .scroll-mx-4 {
1138
+ scroll-margin-left: 1rem;
1139
+ scroll-margin-right: 1rem;
1140
+ }
1141
+
1121
1142
  .grid-flow-row {
1122
1143
  grid-auto-flow: row;
1123
1144
  }
@@ -1268,6 +1289,10 @@ video {
1268
1289
  overflow-y: auto;
1269
1290
  }
1270
1291
 
1292
+ .overflow-x-scroll {
1293
+ overflow-x: scroll;
1294
+ }
1295
+
1271
1296
  .overflow-y-scroll {
1272
1297
  overflow-y: scroll;
1273
1298
  }
@@ -1781,12 +1806,8 @@ video {
1781
1806
  text-align: start;
1782
1807
  }
1783
1808
 
1784
- .font-pt-sans {
1785
- font-family: "PT Sans", Arial, Verdana, Helvetica, sans-serif;
1786
- }
1787
-
1788
1809
  .font-sans {
1789
- font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
1810
+ font-family: "PT Sans", Arial, Verdana, Helvetica, sans-serif;
1790
1811
  }
1791
1812
 
1792
1813
  .font-serif {
@@ -2066,6 +2087,10 @@ video {
2066
2087
  }
2067
2088
 
2068
2089
  @media (min-width: 640px) {
2090
+ .sm\:block {
2091
+ display: block;
2092
+ }
2093
+
2069
2094
  .sm\:inline {
2070
2095
  display: inline;
2071
2096
  }
@@ -2082,6 +2107,19 @@ video {
2082
2107
  grid-template-columns: repeat(4, minmax(0, 1fr));
2083
2108
  }
2084
2109
 
2110
+ .sm\:justify-center {
2111
+ justify-content: center;
2112
+ }
2113
+
2114
+ .sm\:gap-6 {
2115
+ gap: 1.5rem;
2116
+ }
2117
+
2118
+ .sm\:px-0 {
2119
+ padding-left: 0px;
2120
+ padding-right: 0px;
2121
+ }
2122
+
2085
2123
  .sm\:px-16 {
2086
2124
  padding-left: 4rem;
2087
2125
  padding-right: 4rem;
@@ -2531,6 +2569,10 @@ video {
2531
2569
  width: 410px;
2532
2570
  }
2533
2571
 
2572
+ .lg\:w-auto {
2573
+ width: auto;
2574
+ }
2575
+
2534
2576
  .lg\:max-w-7xl {
2535
2577
  max-width: 80rem;
2536
2578
  }
@@ -159,8 +159,7 @@ export const TWStyles = css`
159
159
  -o-tab-size: 4;
160
160
  tab-size: 4;
161
161
  /* 3 */
162
- font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
163
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
162
+ font-family: 'PT Sans', Arial, Verdana, Helvetica, sans-serif;
164
163
  /* 4 */
165
164
  font-feature-settings: normal;
166
165
  /* 5 */
@@ -738,6 +737,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
738
737
  margin-bottom: 1.5rem;
739
738
  }
740
739
 
740
+ .mb-8 {
741
+ margin-bottom: 2rem;
742
+ }
743
+
741
744
  .ml-0\\.5 {
742
745
  margin-left: 0.125rem;
743
746
  }
@@ -1023,6 +1026,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1023
1026
  width: 216px;
1024
1027
  }
1025
1028
 
1029
+ .w-\\[276px\\] {
1030
+ width: 276px;
1031
+ }
1032
+
1026
1033
  .w-\\[296px\\] {
1027
1034
  width: 296px;
1028
1035
  }
@@ -1130,6 +1137,19 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1130
1137
  cursor: pointer;
1131
1138
  }
1132
1139
 
1140
+ .snap-x {
1141
+ scroll-snap-type: x var(--tw-scroll-snap-strictness);
1142
+ }
1143
+
1144
+ .snap-start {
1145
+ scroll-snap-align: start;
1146
+ }
1147
+
1148
+ .scroll-mx-4 {
1149
+ scroll-margin-left: 1rem;
1150
+ scroll-margin-right: 1rem;
1151
+ }
1152
+
1133
1153
  .grid-flow-row {
1134
1154
  grid-auto-flow: row;
1135
1155
  }
@@ -1280,6 +1300,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1280
1300
  overflow-y: auto;
1281
1301
  }
1282
1302
 
1303
+ .overflow-x-scroll {
1304
+ overflow-x: scroll;
1305
+ }
1306
+
1283
1307
  .overflow-y-scroll {
1284
1308
  overflow-y: scroll;
1285
1309
  }
@@ -1793,13 +1817,8 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1793
1817
  text-align: start;
1794
1818
  }
1795
1819
 
1796
- .font-pt-sans {
1797
- font-family: 'PT Sans', Arial, Verdana, Helvetica, sans-serif;
1798
- }
1799
-
1800
1820
  .font-sans {
1801
- font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
1802
- 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
1821
+ font-family: 'PT Sans', Arial, Verdana, Helvetica, sans-serif;
1803
1822
  }
1804
1823
 
1805
1824
  .font-serif {
@@ -2089,6 +2108,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2089
2108
  }
2090
2109
 
2091
2110
  @media (min-width: 640px) {
2111
+ .sm\\:block {
2112
+ display: block;
2113
+ }
2114
+
2092
2115
  .sm\\:inline {
2093
2116
  display: inline;
2094
2117
  }
@@ -2105,6 +2128,19 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2105
2128
  grid-template-columns: repeat(4, minmax(0, 1fr));
2106
2129
  }
2107
2130
 
2131
+ .sm\\:justify-center {
2132
+ justify-content: center;
2133
+ }
2134
+
2135
+ .sm\\:gap-6 {
2136
+ gap: 1.5rem;
2137
+ }
2138
+
2139
+ .sm\\:px-0 {
2140
+ padding-left: 0px;
2141
+ padding-right: 0px;
2142
+ }
2143
+
2108
2144
  .sm\\:px-16 {
2109
2145
  padding-left: 4rem;
2110
2146
  padding-right: 4rem;
@@ -2554,6 +2590,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2554
2590
  width: 410px;
2555
2591
  }
2556
2592
 
2593
+ .lg\\:w-auto {
2594
+ width: auto;
2595
+ }
2596
+
2557
2597
  .lg\\:max-w-7xl {
2558
2598
  max-width: 80rem;
2559
2599
  }
@@ -88,7 +88,7 @@ export default {
88
88
  },
89
89
  // Add custom font famliy
90
90
  fontFamily: {
91
- 'pt-sans': ['"PT Sans"', 'Arial', 'Verdana', 'Helvetica', 'sans-serif'],
91
+ 'sans': ['"PT Sans"', 'Arial', 'Verdana', 'Helvetica', 'sans-serif'],
92
92
  },
93
93
  width: {
94
94
  '106': '32rem'