@kompasid/lit-web-components 0.8.20 → 0.8.21
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/demo/index.html +8 -2
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +1 -1
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +19 -20
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -1
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +0 -4
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js +0 -7
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js.map +1 -1
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +2 -2
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -1
- package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.d.ts +1 -0
- package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.js +18 -4
- package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.js.map +1 -1
- package/dist/src/utils/getHeaderTheme.d.ts +3 -0
- package/dist/src/utils/getHeaderTheme.js +17 -0
- package/dist/src/utils/getHeaderTheme.js.map +1 -0
- package/dist/tailwind/tailwind.js +13 -16
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/components/kompasid-header-account/KompasHeaderAccount.ts +18 -18
- package/src/components/kompasid-header-account/readme.md +46 -0
- package/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts +0 -5
- package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +2 -2
- package/src/components/kompasid-header-notification/KompasHeaderNotification.ts +16 -4
- package/src/components/kompasid-header-notification/readme.md +3 -0
- package/src/utils/getHeaderTheme.ts +19 -0
- package/tailwind/tailwind.css +4 -16
- package/tailwind/tailwind.ts +13 -16
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# kompasid-header-notification
|
|
2
|
+
|
|
3
|
+
Ini adalah komponen _header account_ yang akan di implementasi pada header
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
| Property | Attribute | Description | Type | Default | Required |
|
|
7
|
+
| ------------------------------ | ------------------------------ | --------------------------------------------- | ------------------------- | -------------- | -------- |
|
|
8
|
+
| `cartUrl` | `cart-url` | `URL to the shopping cart page` | `string` | `''` | `no` |
|
|
9
|
+
| `logoutUrl` | `logout-url` | `URL to log the user out` | `string` | `''` | `no` |
|
|
10
|
+
| `manageAccountUrl` | `manage-account-url` | `URL to manage user account settings` | `string` | `''` | `no` |
|
|
11
|
+
| `notificationUrl` | `notification-url` | `URL to view user notifications` | `string` | `''` | `no` |
|
|
12
|
+
| `ordersUrl` | `orders-url` | `URL to view user orders` | `string` | `''` | `no` |
|
|
13
|
+
| `readLaterUrl` | `read-later-url` | `URL to access the "Read Later" feature` | `string` | `''` | `no` |
|
|
14
|
+
| `userData` | `user-data` | `Object containing user data` | `object` | `{}` | `yes` |
|
|
15
|
+
| `sidebarTopSpacing` | `sidebar-top-spacing` | `Top spacing for the sidebar (in pixels)` | `number` | `0` | `no` |
|
|
16
|
+
| `subscriptionUrl` | `subscription-url` | `URL to manage subscriptions` | `string` | `''` | `no` |
|
|
17
|
+
| `totalGracePeriod` | `total-grace-period` | `Total grace period (in days)` | `number` | `0` | `no` |
|
|
18
|
+
| `theme` | `theme` | `Component theme` | `'default' \| 'primary'` | `'primary'` | `no` |
|
|
19
|
+
| `paywall_location` | `paywall-location` | `Location of the paywall` | `string` | `''` | `no` |
|
|
20
|
+
| `paywall_subscription_package` | `paywall-subscription-package` | `Subscription package for the paywall` | `string` | `''` | `no` |
|
|
21
|
+
| `paywall_subscription_id` | `paywall-subscription-id` | `ID of the subscription` | `number` | `0` | `no` |
|
|
22
|
+
| `paywall_subscription_price` | `paywall-subscription-price` | `Price of the subscription` | `number` | `0` | `no` |
|
|
23
|
+
| `paywall_position` | `paywall-position` | `Position of the paywall` | `number` | `0` | `no` |
|
|
24
|
+
| `tracker_page_type` | `tracker-page-type` | `Type of the tracked page` | `string` | `''` | `no` |
|
|
25
|
+
| `tracker_content_id` | `tracker-content-id` | `ID of the tracked content` | `string` | `''` | `no` |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
<kompas-header-account
|
|
33
|
+
cart-url="https://gerai.kompas.id/cart"
|
|
34
|
+
logout-url="https://account.kompas.cloud/logout"
|
|
35
|
+
manage-account-url="https://account.kompas.cloud/manage-account"
|
|
36
|
+
notification-url="https://account.kompas.cloud/manage-account/notification"
|
|
37
|
+
orders-url="https://gerai.kompas.id/my-account/orders"
|
|
38
|
+
sidebar-top-spacing=48
|
|
39
|
+
subscription-url="https://www.kompas.id/berlangganan"
|
|
40
|
+
read-later-url="https://www.kompas.id/bacananti"
|
|
41
|
+
theme="primary"
|
|
42
|
+
:user-data="{}"
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
_Terbikin oleh tim front-end kompas.id_
|
|
@@ -90,11 +90,6 @@ export class KompasHeaderAccountMenu extends LitElement {
|
|
|
90
90
|
*/
|
|
91
91
|
@property({ type: String }) readLaterUrl = 'https://www.kompas.id/baca-nanti'
|
|
92
92
|
|
|
93
|
-
/**
|
|
94
|
-
* Total Notification Count
|
|
95
|
-
*/
|
|
96
|
-
@property({ type: Number }) notificationTotal: number = 0
|
|
97
|
-
|
|
98
93
|
// Render Total Bubble
|
|
99
94
|
private renderTotalBubble = (total: number) => {
|
|
100
95
|
if (!total) {
|
|
@@ -110,8 +110,8 @@ export class KompasHeaderAccountProfile extends LitElement {
|
|
|
110
110
|
return html`
|
|
111
111
|
<div>
|
|
112
112
|
<img
|
|
113
|
-
class="header-account--membership-icon"
|
|
114
|
-
src="https://cdn-www.kompas.id/global-header/crown-blue-
|
|
113
|
+
class="header-account--membership-icon h-6 w-6"
|
|
114
|
+
src="https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg"
|
|
115
115
|
alt="membership-crown-icon"
|
|
116
116
|
/>
|
|
117
117
|
</div>
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
ApiRubrikResponse,
|
|
13
13
|
} from './types.js'
|
|
14
14
|
import { customFetch } from './utils.js'
|
|
15
|
+
import { getHeaderTheme } from '../../utils/getHeaderTheme.js'
|
|
15
16
|
|
|
16
17
|
@customElement('kompasid-header-notification')
|
|
17
18
|
export class KompasHeaderNotification extends LitElement {
|
|
@@ -28,8 +29,9 @@ export class KompasHeaderNotification extends LitElement {
|
|
|
28
29
|
width: 0.5rem;
|
|
29
30
|
background-color: #ff7a00;
|
|
30
31
|
border-radius: 50%;
|
|
31
|
-
right:
|
|
32
|
-
top:
|
|
32
|
+
right: 0.03rem;
|
|
33
|
+
top: 0.09rem;
|
|
34
|
+
border: 1.2px solid white;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
.break-words {
|
|
@@ -155,6 +157,8 @@ export class KompasHeaderNotification extends LitElement {
|
|
|
155
157
|
@property({ type: String }) accessToken = ''
|
|
156
158
|
@property({ type: String }) refreshToken = ''
|
|
157
159
|
@property({ type: String }) domain = 'id' // 'id' | 'cloud'
|
|
160
|
+
@property({ type: String }) theme: 'default' | 'primary' = 'default'
|
|
161
|
+
|
|
158
162
|
@property({ type: String }) tracker_user_type = ''
|
|
159
163
|
@property({ type: String }) tracker_subscription_status = ''
|
|
160
164
|
@property({ type: String }) tracker_page_domain = ''
|
|
@@ -332,7 +336,11 @@ export class KompasHeaderNotification extends LitElement {
|
|
|
332
336
|
>
|
|
333
337
|
${notificationIndicator()}
|
|
334
338
|
<div class="flex flex-row items-center self-center">
|
|
335
|
-
<div
|
|
339
|
+
<div
|
|
340
|
+
class="cursor-pointer mt-0.5 ${getHeaderTheme({
|
|
341
|
+
icon: this.theme,
|
|
342
|
+
})}"
|
|
343
|
+
>
|
|
336
344
|
${unsafeSVG(getFontAwesomeIcon('fas', 'bell', 21, 21))}
|
|
337
345
|
</div>
|
|
338
346
|
</div>
|
|
@@ -647,7 +655,11 @@ export class KompasHeaderNotification extends LitElement {
|
|
|
647
655
|
return html`<div id="headerNotification" class="relative">
|
|
648
656
|
${this.isDataLoaded
|
|
649
657
|
? this.notificationIcon()
|
|
650
|
-
: html`<div
|
|
658
|
+
: html`<div
|
|
659
|
+
class="cursor-pointer mt-0.5 animate-spin ${getHeaderTheme({
|
|
660
|
+
icon: this.theme,
|
|
661
|
+
})}"
|
|
662
|
+
>
|
|
651
663
|
${unsafeSVG(getFontAwesomeIcon('fa', 'circle-notch', 21, 21))}
|
|
652
664
|
</div>`}
|
|
653
665
|
${this.isShowDropdown ? this.notificationPopup() : ''}
|
|
@@ -14,6 +14,7 @@ Ini adalah komponen _header notification_ yang akan di implementasi pada header
|
|
|
14
14
|
| `tracker_page_domain` | `tracker_page_domain` | `Domain of the tracked page` | `string` | `''` | `no` |
|
|
15
15
|
| `tracker_metered_wall_type` | `tracker_metered_wall_type` | `Type of metered wall` | `string` | `''` | `no` |
|
|
16
16
|
| `tracker_metered_wall_balance` | `tracker_metered_wall_balance` | `Balance for metered wall` | `number` | `0` | `no` |
|
|
17
|
+
| `theme` | `theme` | `Color Theme` | `string` | `'default' //'default , primary''` | `no` |
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
@@ -29,6 +30,8 @@ Ini adalah komponen _header notification_ yang akan di implementasi pada header
|
|
|
29
30
|
tracker_page_domain="Kompas.cloud"
|
|
30
31
|
tracker_metered_wall_type="HP"
|
|
31
32
|
tracker_metered_wall_balance="0"
|
|
33
|
+
iconColor="#ffffff"
|
|
34
|
+
theme="default" --> // default | primary
|
|
32
35
|
style="margin-left: auto; margin-right:15px"
|
|
33
36
|
/>
|
|
34
37
|
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import { cva } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
let responseData
|
|
5
|
+
|
|
6
|
+
await fetch('https://cdn-www.kompas.id/global-header/theme.json', {
|
|
7
|
+
method: 'GET',
|
|
8
|
+
headers: {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
.then(response => response.json())
|
|
13
|
+
.then(data => {
|
|
14
|
+
responseData = data
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const getHeaderTheme = cva('', {
|
|
18
|
+
variants: (responseData as any).header,
|
|
19
|
+
})
|
package/tailwind/tailwind.css
CHANGED
|
@@ -813,14 +813,6 @@ video {
|
|
|
813
813
|
height: 4rem;
|
|
814
814
|
}
|
|
815
815
|
|
|
816
|
-
.h-2 {
|
|
817
|
-
height: 0.5rem;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
.h-2\.5 {
|
|
821
|
-
height: 0.625rem;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
816
|
.h-20 {
|
|
825
817
|
height: 5rem;
|
|
826
818
|
}
|
|
@@ -910,14 +902,6 @@ video {
|
|
|
910
902
|
width: 4rem;
|
|
911
903
|
}
|
|
912
904
|
|
|
913
|
-
.w-2 {
|
|
914
|
-
width: 0.5rem;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
.w-2\.5 {
|
|
918
|
-
width: 0.625rem;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
905
|
.w-2\/3 {
|
|
922
906
|
width: 66.666667%;
|
|
923
907
|
}
|
|
@@ -926,6 +910,10 @@ video {
|
|
|
926
910
|
width: 5rem;
|
|
927
911
|
}
|
|
928
912
|
|
|
913
|
+
.w-3 {
|
|
914
|
+
width: 0.75rem;
|
|
915
|
+
}
|
|
916
|
+
|
|
929
917
|
.w-3\/4 {
|
|
930
918
|
width: 75%;
|
|
931
919
|
}
|
package/tailwind/tailwind.ts
CHANGED
|
@@ -823,14 +823,6 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
823
823
|
height: 4rem;
|
|
824
824
|
}
|
|
825
825
|
|
|
826
|
-
.h-2 {
|
|
827
|
-
height: 0.5rem;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
.h-2\\.5 {
|
|
831
|
-
height: 0.625rem;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
826
|
.h-20 {
|
|
835
827
|
height: 5rem;
|
|
836
828
|
}
|
|
@@ -920,14 +912,6 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
920
912
|
width: 4rem;
|
|
921
913
|
}
|
|
922
914
|
|
|
923
|
-
.w-2 {
|
|
924
|
-
width: 0.5rem;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
.w-2\\.5 {
|
|
928
|
-
width: 0.625rem;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
915
|
.w-2\\/3 {
|
|
932
916
|
width: 66.666667%;
|
|
933
917
|
}
|
|
@@ -936,6 +920,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
936
920
|
width: 5rem;
|
|
937
921
|
}
|
|
938
922
|
|
|
923
|
+
.w-3 {
|
|
924
|
+
width: 0.75rem;
|
|
925
|
+
}
|
|
926
|
+
|
|
939
927
|
.w-3\\/4 {
|
|
940
928
|
width: 75%;
|
|
941
929
|
}
|
|
@@ -1231,6 +1219,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
1231
1219
|
white-space: nowrap;
|
|
1232
1220
|
}
|
|
1233
1221
|
|
|
1222
|
+
.break-words {
|
|
1223
|
+
overflow-wrap: break-word;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1234
1226
|
.rounded {
|
|
1235
1227
|
border-radius: 0.25rem;
|
|
1236
1228
|
}
|
|
@@ -1893,6 +1885,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
1893
1885
|
color: rgb(51 51 51 / var(--tw-text-opacity));
|
|
1894
1886
|
}
|
|
1895
1887
|
|
|
1888
|
+
.text-grey-700 {
|
|
1889
|
+
--tw-text-opacity: 1;
|
|
1890
|
+
color: rgb(0 0 0 / var(--tw-text-opacity));
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1896
1893
|
.text-orange-400 {
|
|
1897
1894
|
--tw-text-opacity: 1;
|
|
1898
1895
|
color: rgb(255 122 0 / var(--tw-text-opacity));
|