@kompasid/lit-web-components 0.9.19 → 0.9.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/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.d.ts +22 -61
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js +261 -475
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js.map +1 -1
- package/dist/src/components/kompasid-menu-side-bar/SidebarDataController.d.ts +32 -0
- package/dist/src/components/kompasid-menu-side-bar/SidebarDataController.js +72 -0
- package/dist/src/components/kompasid-menu-side-bar/SidebarDataController.js.map +1 -0
- package/dist/tailwind/tailwind.js +9 -0
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts +299 -607
- package/src/components/kompasid-menu-side-bar/SidebarDataController.ts +113 -0
- package/tailwind/tailwind.ts +9 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// SidebarDataController.ts
|
|
2
|
+
export interface DataExternalLink {
|
|
3
|
+
external: boolean
|
|
4
|
+
gtmClass: string
|
|
5
|
+
icon: string | null
|
|
6
|
+
iconify: string | null
|
|
7
|
+
isNew: boolean
|
|
8
|
+
name: string
|
|
9
|
+
url: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface DataRedDot {
|
|
13
|
+
start: string | null
|
|
14
|
+
end: string | null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DataSideBarItem {
|
|
18
|
+
isShow: boolean
|
|
19
|
+
href: string
|
|
20
|
+
external?: boolean
|
|
21
|
+
icon: string | null
|
|
22
|
+
iconify: string | null
|
|
23
|
+
name: string
|
|
24
|
+
slug: string
|
|
25
|
+
redDot: DataRedDot
|
|
26
|
+
children: DataSideBarItem[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DataSideBarLink {
|
|
30
|
+
bundles: DataSideBarItem[]
|
|
31
|
+
feature: DataSideBarItem[]
|
|
32
|
+
category: DataSideBarItem[]
|
|
33
|
+
lainnya: DataSideBarItem[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ---- Fetch External Links ----
|
|
37
|
+
export async function fetchExternalLinks(
|
|
38
|
+
isProduction: boolean
|
|
39
|
+
): Promise<DataExternalLink[]> {
|
|
40
|
+
try {
|
|
41
|
+
const baseUrl = isProduction
|
|
42
|
+
? 'https://cdn-www.kompas.id'
|
|
43
|
+
: 'https://cdn-dev-www.kompas.id'
|
|
44
|
+
const response = await fetch(
|
|
45
|
+
`${baseUrl}/assets/json/ApiMenuExternalLinkV2.json`
|
|
46
|
+
)
|
|
47
|
+
const data = await response.json()
|
|
48
|
+
|
|
49
|
+
return Array.isArray(data)
|
|
50
|
+
? data.map(
|
|
51
|
+
(item: any): DataExternalLink => ({
|
|
52
|
+
external: item.external ?? false,
|
|
53
|
+
gtmClass: item.gtmClass ?? '',
|
|
54
|
+
icon: item.icon ?? null,
|
|
55
|
+
iconify: item.iconify ?? null,
|
|
56
|
+
isNew: item.isNew ?? false,
|
|
57
|
+
name: item.name ?? '',
|
|
58
|
+
url: item.url ?? '',
|
|
59
|
+
})
|
|
60
|
+
)
|
|
61
|
+
: []
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Error fetching external links:', error)
|
|
64
|
+
return []
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ---- Fetch Sidebar Data ----
|
|
69
|
+
export async function fetchSidebarData(
|
|
70
|
+
isProduction: Boolean
|
|
71
|
+
): Promise<DataSideBarLink> {
|
|
72
|
+
try {
|
|
73
|
+
const baseUrl = isProduction
|
|
74
|
+
? 'https://cdn-www.kompas.id'
|
|
75
|
+
: 'https://cdn-dev-www.kompas.id'
|
|
76
|
+
const response = await fetch(`${baseUrl}/assets/json/ApiMenuSideV4.json`)
|
|
77
|
+
const data = await response.json()
|
|
78
|
+
|
|
79
|
+
if (data && typeof data === 'object') {
|
|
80
|
+
const mapItem = (item: any): DataSideBarItem => ({
|
|
81
|
+
isShow: item.isShow ?? true,
|
|
82
|
+
href: item.href ?? '',
|
|
83
|
+
external: item.external ?? false,
|
|
84
|
+
icon: item.icon ?? null,
|
|
85
|
+
iconify: item.iconify ?? null,
|
|
86
|
+
name: item.name ?? '',
|
|
87
|
+
slug: item.slug ?? '',
|
|
88
|
+
redDot: {
|
|
89
|
+
start: item.redDot?.start ?? '',
|
|
90
|
+
end: item.redDot?.end ?? '',
|
|
91
|
+
},
|
|
92
|
+
children: Array.isArray(item.children)
|
|
93
|
+
? item.children.map(mapItem)
|
|
94
|
+
: [],
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const mapper = (list: any[]): DataSideBarItem[] =>
|
|
98
|
+
Array.isArray(list) ? list.map(mapItem) : []
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
bundles: mapper(data.bundles),
|
|
102
|
+
feature: mapper(data.feature),
|
|
103
|
+
category: mapper(data.category),
|
|
104
|
+
lainnya: mapper(data.lainnya),
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return { bundles: [], feature: [], category: [], lainnya: [] }
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error('Error fetching sidebar data:', error)
|
|
111
|
+
return { bundles: [], feature: [], category: [], lainnya: [] }
|
|
112
|
+
}
|
|
113
|
+
}
|
package/tailwind/tailwind.ts
CHANGED
|
@@ -672,6 +672,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
672
672
|
margin-right: 1rem;
|
|
673
673
|
}
|
|
674
674
|
|
|
675
|
+
.mx-6 {
|
|
676
|
+
margin-left: 1.5rem;
|
|
677
|
+
margin-right: 1.5rem;
|
|
678
|
+
}
|
|
679
|
+
|
|
675
680
|
.mx-auto {
|
|
676
681
|
margin-left: auto;
|
|
677
682
|
margin-right: auto;
|
|
@@ -1735,6 +1740,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
1735
1740
|
padding-left: 0.25rem;
|
|
1736
1741
|
}
|
|
1737
1742
|
|
|
1743
|
+
.pl-8 {
|
|
1744
|
+
padding-left: 2rem;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1738
1747
|
.pl-11 {
|
|
1739
1748
|
padding-left: 2.75rem;
|
|
1740
1749
|
}
|