@inglorious/ui 1.0.2 → 2.0.1
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/package.json +11 -9
- package/src/controls/button/button.stories.js +2 -2
- package/src/controls/button/index.js +1 -1
- package/src/controls/button-group/button-group.stories.js +2 -2
- package/src/controls/button-group/index.js +1 -1
- package/src/controls/button-group/template.js +2 -2
- package/src/controls/checkbox/checkbox.stories.js +2 -2
- package/src/controls/checkbox/index.js +1 -1
- package/src/controls/combobox/combobox.stories.js +3 -3
- package/src/controls/combobox/index.js +2 -2
- package/src/controls/combobox/template.js +3 -3
- package/src/controls/fab/fab.stories.js +2 -2
- package/src/controls/fab/index.js +1 -1
- package/src/controls/fab/template.js +2 -2
- package/src/controls/icon-button/icon-button.stories.js +2 -2
- package/src/controls/icon-button/index.js +1 -1
- package/src/controls/icon-button/template.js +2 -2
- package/src/controls/input/index.js +1 -1
- package/src/controls/input/input.stories.js +2 -2
- package/src/controls/radio-group/index.js +1 -1
- package/src/controls/radio-group/radio-group.stories.js +2 -2
- package/src/controls/rating/index.js +1 -1
- package/src/controls/rating/rating.stories.js +2 -2
- package/src/controls/select/index.js +1 -1
- package/src/controls/select/select.stories.js +2 -2
- package/src/controls/slider/index.js +1 -1
- package/src/controls/slider/slider.stories.js +2 -2
- package/src/controls/switch/index.js +1 -1
- package/src/controls/switch/switch.stories.js +2 -2
- package/src/data-display/avatar/avatar.stories.js +2 -2
- package/src/data-display/avatar/index.js +1 -1
- package/src/data-display/badge/badge.stories.js +2 -2
- package/src/data-display/badge/index.js +1 -1
- package/src/data-display/chip/chip.stories.js +2 -2
- package/src/data-display/chip/index.js +1 -1
- package/src/data-display/data-grid/data-grid.stories.js +4 -4
- package/src/data-display/data-grid/filters/index.js +10 -10
- package/src/data-display/data-grid/filters/input.js +3 -3
- package/src/data-display/data-grid/filters/range.js +4 -4
- package/src/data-display/data-grid/filters/select.js +3 -3
- package/src/data-display/data-grid/index.js +2 -2
- package/src/data-display/data-grid/template.js +16 -16
- package/src/data-display/divider/divider.stories.js +2 -2
- package/src/data-display/divider/index.js +1 -1
- package/src/data-display/icon/icon-implementations.mdx +4 -4
- package/src/data-display/icon/icon-utf8.stories.js +9 -9
- package/src/data-display/icon/icon.stories.js +2 -2
- package/src/data-display/icon/index.js +1 -1
- package/src/data-display/list/index.js +2 -2
- package/src/data-display/list/list.stories.js +2 -2
- package/src/data-display/list/template.js +8 -8
- package/src/data-display/material-icon/index.js +1 -1
- package/src/data-display/material-icon/material-icon.stories.js +2 -2
- package/src/data-display/table/index.js +1 -1
- package/src/data-display/table/table.stories.js +2 -2
- package/src/data-display/table/template.js +1 -1
- package/src/data-display/tooltip/index.js +1 -1
- package/src/data-display/tooltip/tooltip.stories.js +2 -2
- package/src/data-display/typography/index.js +1 -1
- package/src/data-display/typography/typography.stories.js +2 -2
- package/src/data-display/virtual-list/index.js +1 -1
- package/src/examples/dashboard/app-drawer.js +15 -15
- package/src/examples/dashboard/app-header.js +33 -33
- package/src/examples/dashboard/dashboard-jsx.jsx +76 -0
- package/src/examples/dashboard/dashboard-vue.vue +68 -0
- package/src/examples/dashboard/dashboard.js +43 -42
- package/src/examples/dashboard/dashboard.stories.js +46 -16
- package/src/examples/dashboard/mode.js +1 -1
- package/src/examples/dashboard/primitive-content.js +248 -248
- package/src/examples/dashboard/primitive-section.js +25 -25
- package/src/examples/dashboard/router.js +1 -1
- package/src/examples/dashboard/social-card.js +14 -14
- package/src/examples/dashboard/stat-card.js +12 -12
- package/src/examples/dashboard/theme.js +1 -1
- package/src/examples/dashboard/traffic-card.js +22 -22
- package/src/examples/dashboard/traffic-sales-card.js +39 -39
- package/src/feedback/alert/alert.stories.js +2 -2
- package/src/feedback/alert/index.js +2 -2
- package/src/feedback/backdrop/backdrop.stories.js +2 -2
- package/src/feedback/backdrop/index.js +2 -2
- package/src/feedback/dialog/dialog.stories.js +2 -2
- package/src/feedback/dialog/index.js +2 -2
- package/src/feedback/progress/index.js +1 -1
- package/src/feedback/progress/progress.stories.js +2 -2
- package/src/feedback/progress/template.js +1 -1
- package/src/feedback/skeleton/index.js +2 -2
- package/src/feedback/skeleton/skeleton.stories.js +2 -2
- package/src/feedback/snackbar/index.js +2 -2
- package/src/feedback/snackbar/snackbar.stories.js +2 -2
- package/src/index.js +45 -45
- package/src/layout/container/container.stories.js +3 -3
- package/src/layout/container/index.js +1 -1
- package/src/layout/flex/flex.stories.js +2 -2
- package/src/layout/flex/index.js +1 -1
- package/src/layout/grid/grid.stories.js +2 -2
- package/src/layout/grid/index.js +1 -1
- package/src/navigation/bottom-navigation/bottom-navigation.stories.js +2 -2
- package/src/navigation/bottom-navigation/index.js +1 -1
- package/src/navigation/bottom-navigation/template.js +2 -2
- package/src/navigation/breadcrumbs/breadcrumbs.stories.js +2 -2
- package/src/navigation/breadcrumbs/index.js +1 -1
- package/src/navigation/breadcrumbs/template.js +2 -2
- package/src/navigation/drawer/drawer.stories.js +2 -2
- package/src/navigation/drawer/index.js +1 -1
- package/src/navigation/drawer/template.js +13 -13
- package/src/navigation/link/index.js +2 -2
- package/src/navigation/link/link.stories.js +2 -2
- package/src/navigation/menu/index.js +1 -1
- package/src/navigation/menu/menu.stories.js +2 -2
- package/src/navigation/menu/template.js +1 -1
- package/src/navigation/pagination/index.js +1 -1
- package/src/navigation/pagination/pagination.stories.js +2 -2
- package/src/navigation/pagination/template.js +4 -4
- package/src/navigation/speed-dial/index.js +1 -1
- package/src/navigation/speed-dial/speed-dial.stories.js +2 -2
- package/src/navigation/speed-dial/template.js +1 -1
- package/src/navigation/stepper/index.js +1 -1
- package/src/navigation/stepper/stepper.stories.js +2 -2
- package/src/navigation/stepper/template.js +1 -1
- package/src/navigation/tabs/index.js +1 -1
- package/src/navigation/tabs/tabs.stories.js +2 -2
- package/src/navigation/tabs/template.js +1 -1
- package/src/surfaces/accordion/accordion.stories.js +2 -2
- package/src/surfaces/accordion/index.js +1 -1
- package/src/surfaces/accordion/template.js +1 -1
- package/src/surfaces/app-bar/app-bar.stories.js +2 -2
- package/src/surfaces/app-bar/index.js +1 -1
- package/src/surfaces/card/card.stories.js +2 -2
- package/src/surfaces/card/index.js +1 -1
- package/src/surfaces/card/template.js +1 -1
- package/src/surfaces/paper/index.js +2 -2
- package/src/surfaces/paper/paper.stories.js +3 -3
- package/types/controls/button-group.d.ts +1 -1
- package/types/controls/button.d.ts +2 -2
- package/types/controls/checkbox.d.ts +1 -1
- package/types/controls/combobox.d.ts +1 -1
- package/types/controls/fab.d.ts +1 -1
- package/types/controls/icon-button.d.ts +1 -1
- package/types/controls/input.d.ts +1 -1
- package/types/controls/radio-group.d.ts +1 -1
- package/types/controls/rating.d.ts +1 -1
- package/types/controls/select.d.ts +1 -1
- package/types/controls/slider.d.ts +1 -1
- package/types/controls/switch.d.ts +1 -1
- package/types/data-display/avatar.d.ts +1 -1
- package/types/data-display/badge.d.ts +1 -1
- package/types/data-display/chip.d.ts +1 -1
- package/types/data-display/divider.d.ts +1 -1
- package/types/data-display/icon.d.ts +1 -1
- package/types/data-display/list.d.ts +1 -1
- package/types/data-display/material-icon.d.ts +1 -1
- package/types/data-display/table.d.ts +1 -1
- package/types/data-display/tooltip.d.ts +1 -1
- package/types/data-display/typography.d.ts +1 -1
- package/types/data-display/virtual-list.d.ts +1 -1
- package/types/feedback/alert.d.ts +1 -1
- package/types/feedback/backdrop.d.ts +1 -1
- package/types/feedback/dialog.d.ts +1 -1
- package/types/feedback/progress.d.ts +1 -1
- package/types/feedback/skeleton.d.ts +1 -1
- package/types/feedback/snackbar.d.ts +1 -1
- package/types/layout/container.d.ts +1 -1
- package/types/layout/flex.d.ts +1 -1
- package/types/layout/grid.d.ts +1 -1
- package/types/navigation/bottom-navigation.d.ts +1 -1
- package/types/navigation/breadcrumbs.d.ts +1 -1
- package/types/navigation/drawer.d.ts +1 -1
- package/types/navigation/link.d.ts +1 -1
- package/types/navigation/menu.d.ts +1 -1
- package/types/navigation/pagination.d.ts +1 -1
- package/types/navigation/speed-dial.d.ts +1 -1
- package/types/navigation/stepper.d.ts +1 -1
- package/types/navigation/tabs.d.ts +1 -1
- package/types/surfaces/accordion.d.ts +1 -1
- package/types/surfaces/app-bar.d.ts +1 -1
- package/types/surfaces/card.d.ts +1 -1
- package/types/surfaces/paper.d.ts +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { Button } from "../../controls/button"
|
|
4
|
+
import { Avatar } from "../../data-display/avatar"
|
|
5
|
+
import { Divider } from "../../data-display/divider"
|
|
6
|
+
import { Icon } from "../../data-display/icon"
|
|
7
|
+
import { MaterialIcon } from "../../data-display/material-icon"
|
|
8
|
+
import { Flex } from "../../layout/flex"
|
|
9
|
+
import { Breadcrumbs } from "../../navigation/breadcrumbs"
|
|
10
|
+
import { AppBar } from "../../surfaces/app-bar"
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const AppHeader = {
|
|
13
13
|
render(entity, api) {
|
|
14
14
|
const themeEntity = api.getEntity("theme")
|
|
15
15
|
const modeEntity = api.getEntity("mode")
|
|
@@ -30,116 +30,116 @@ export const appHeader = {
|
|
|
30
30
|
|
|
31
31
|
return html`
|
|
32
32
|
<div class="iw-dashboard-header">
|
|
33
|
-
${
|
|
33
|
+
${AppBar.render({
|
|
34
34
|
position: "static",
|
|
35
35
|
elevated: false,
|
|
36
36
|
children: html`
|
|
37
|
-
${
|
|
37
|
+
${Flex.render({
|
|
38
38
|
justify: "between",
|
|
39
39
|
align: "center",
|
|
40
40
|
gap: "md",
|
|
41
41
|
className: "iw-dashboard-header-row",
|
|
42
42
|
children: [
|
|
43
|
-
|
|
43
|
+
Button.render({
|
|
44
44
|
color: "secondary",
|
|
45
45
|
variant: "ghost",
|
|
46
46
|
shape: "square",
|
|
47
|
-
children:
|
|
47
|
+
children: MaterialIcon.render({ name: "menu", size: "lg" }),
|
|
48
48
|
"aria-label": "Toggle navigation",
|
|
49
49
|
onClick: () => api.notify(`#appDrawer:toggle`),
|
|
50
50
|
}),
|
|
51
|
-
|
|
51
|
+
Flex.render({
|
|
52
52
|
align: "center",
|
|
53
53
|
gap: "sm",
|
|
54
54
|
className: "iw-dashboard-header-nav",
|
|
55
55
|
children: [
|
|
56
|
-
|
|
56
|
+
Button.render({
|
|
57
57
|
color: "secondary",
|
|
58
58
|
variant: "ghost",
|
|
59
59
|
children: "Dashboard",
|
|
60
60
|
}),
|
|
61
|
-
|
|
61
|
+
Button.render({
|
|
62
62
|
color: "secondary",
|
|
63
63
|
variant: "ghost",
|
|
64
64
|
children: "Users",
|
|
65
65
|
}),
|
|
66
|
-
|
|
66
|
+
Button.render({
|
|
67
67
|
color: "secondary",
|
|
68
68
|
variant: "ghost",
|
|
69
69
|
children: "Settings",
|
|
70
70
|
}),
|
|
71
71
|
],
|
|
72
72
|
}),
|
|
73
|
-
|
|
73
|
+
Flex.render({
|
|
74
74
|
align: "center",
|
|
75
75
|
gap: "sm",
|
|
76
76
|
className: "iw-dashboard-header-actions",
|
|
77
77
|
children: [
|
|
78
|
-
|
|
78
|
+
Button.render({
|
|
79
79
|
color: "secondary",
|
|
80
80
|
variant: "ghost",
|
|
81
81
|
shape: "square",
|
|
82
|
-
children:
|
|
82
|
+
children: MaterialIcon.render({
|
|
83
83
|
name: "notifications",
|
|
84
84
|
size: "lg",
|
|
85
85
|
}),
|
|
86
86
|
"aria-label": "Notifications",
|
|
87
87
|
}),
|
|
88
|
-
|
|
88
|
+
Button.render({
|
|
89
89
|
color: "secondary",
|
|
90
90
|
variant: "ghost",
|
|
91
91
|
shape: "square",
|
|
92
|
-
children:
|
|
92
|
+
children: MaterialIcon.render({
|
|
93
93
|
name: "format_list_bulleted",
|
|
94
94
|
}),
|
|
95
95
|
"aria-label": "Tasks",
|
|
96
96
|
}),
|
|
97
|
-
|
|
97
|
+
Button.render({
|
|
98
98
|
color: "secondary",
|
|
99
99
|
variant: "ghost",
|
|
100
100
|
shape: "square",
|
|
101
|
-
children:
|
|
101
|
+
children: MaterialIcon.render({
|
|
102
102
|
name: "mail",
|
|
103
103
|
size: "lg",
|
|
104
104
|
}),
|
|
105
105
|
"aria-label": "Messages",
|
|
106
106
|
}),
|
|
107
|
-
|
|
107
|
+
Divider.render({ orientation: "vertical" }),
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Button.render({
|
|
110
110
|
color: "secondary",
|
|
111
111
|
variant: "ghost",
|
|
112
112
|
shape: "square",
|
|
113
|
-
children:
|
|
113
|
+
children: Icon.render({
|
|
114
114
|
children: html`<i class=${themeIcon}></i>`,
|
|
115
115
|
size: "lg",
|
|
116
116
|
}),
|
|
117
117
|
"aria-label": `Theme: ${themeName}`,
|
|
118
118
|
onClick: () => api.notify("#theme:toggle"),
|
|
119
119
|
}),
|
|
120
|
-
|
|
120
|
+
Button.render({
|
|
121
121
|
color: "secondary",
|
|
122
122
|
variant: "ghost",
|
|
123
123
|
shape: "square",
|
|
124
|
-
children:
|
|
124
|
+
children: MaterialIcon.render({
|
|
125
125
|
name: modeIcon,
|
|
126
126
|
size: "lg",
|
|
127
127
|
}),
|
|
128
128
|
"aria-label": `Mode: ${themeMode}`,
|
|
129
129
|
onClick: () => api.notify("#mode:toggle"),
|
|
130
130
|
}),
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
Divider.render({ orientation: "vertical" }),
|
|
132
|
+
Avatar.render({ src: "/antony.jpeg" }),
|
|
133
133
|
],
|
|
134
134
|
}),
|
|
135
135
|
],
|
|
136
136
|
})}
|
|
137
137
|
`,
|
|
138
138
|
})}
|
|
139
|
-
${
|
|
139
|
+
${Flex.render({
|
|
140
140
|
align: "center",
|
|
141
141
|
className: "iw-dashboard-header-row iw-dashboard-breadcrumbs",
|
|
142
|
-
children:
|
|
142
|
+
children: Breadcrumbs.render({
|
|
143
143
|
items: [{ label: "Home", href: "#" }, { label: "Dashboard" }],
|
|
144
144
|
}),
|
|
145
145
|
})}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Container } from "../../layout/container/index.js"
|
|
2
|
+
import { Flex } from "../../layout/flex/index.js"
|
|
3
|
+
import { Grid } from "../../layout/grid/index.js"
|
|
4
|
+
import { AppDrawer } from "./app-drawer.js"
|
|
5
|
+
import { AppHeader } from "./app-header.js"
|
|
6
|
+
import { socialCards, statCards } from "./data.js"
|
|
7
|
+
import { PrimitiveSection } from "./primitive-section.js"
|
|
8
|
+
import { SocialCard } from "./social-card.js"
|
|
9
|
+
import { StatCard } from "./stat-card.js"
|
|
10
|
+
import { TrafficCard } from "./traffic-card.js"
|
|
11
|
+
import { TrafficSalesCard } from "./traffic-sales-card.js"
|
|
12
|
+
|
|
13
|
+
export const DashboardJsx = {
|
|
14
|
+
render(entity, api) {
|
|
15
|
+
const appDrawer = api.getEntity("appDrawer")
|
|
16
|
+
const dashboardClassName = [
|
|
17
|
+
"iw-dashboard",
|
|
18
|
+
appDrawer.isHidden && "iw-dashboard-drawer-hidden",
|
|
19
|
+
appDrawer.isCollapsed && "iw-dashboard-drawer-collapsed",
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join(" ")
|
|
23
|
+
|
|
24
|
+
const router = api.getEntity("router")
|
|
25
|
+
const isDashboardRoot = !router || router.path === "/"
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Flex direction="column" className={dashboardClassName}>
|
|
29
|
+
<AppDrawer />
|
|
30
|
+
|
|
31
|
+
<Flex element="main" direction="column" className="iw-dashboard-main">
|
|
32
|
+
<AppHeader />
|
|
33
|
+
|
|
34
|
+
<Container
|
|
35
|
+
maxWidth="xl"
|
|
36
|
+
padding="lg"
|
|
37
|
+
className="iw-dashboard-container"
|
|
38
|
+
>
|
|
39
|
+
{isDashboardRoot && (
|
|
40
|
+
<Flex direction="column" gap="lg">
|
|
41
|
+
<Grid minColumnWidth="18rem" gap="lg">
|
|
42
|
+
{statCards.map((card) => (
|
|
43
|
+
<StatCard key={card.id} {...card} />
|
|
44
|
+
))}
|
|
45
|
+
</Grid>
|
|
46
|
+
|
|
47
|
+
<TrafficCard />
|
|
48
|
+
|
|
49
|
+
<Grid columns={3} gap="lg">
|
|
50
|
+
{socialCards.map((card) => (
|
|
51
|
+
<SocialCard key={card.id} {...card} />
|
|
52
|
+
))}
|
|
53
|
+
</Grid>
|
|
54
|
+
|
|
55
|
+
<TrafficSalesCard />
|
|
56
|
+
</Flex>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
{!isDashboardRoot && <PrimitiveSection />}
|
|
60
|
+
</Container>
|
|
61
|
+
|
|
62
|
+
<Flex
|
|
63
|
+
element="footer"
|
|
64
|
+
justify="between"
|
|
65
|
+
gap="md"
|
|
66
|
+
padding="md"
|
|
67
|
+
className="iw-dashboard-footer"
|
|
68
|
+
>
|
|
69
|
+
<div>Admin dashboard example © 2026</div>
|
|
70
|
+
<div>Built with Inglorious UI primitives and charts</div>
|
|
71
|
+
</Flex>
|
|
72
|
+
</Flex>
|
|
73
|
+
</Flex>
|
|
74
|
+
)
|
|
75
|
+
},
|
|
76
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Flex direction="column" :className="dashboardClassName">
|
|
3
|
+
<AppDrawer />
|
|
4
|
+
|
|
5
|
+
<Flex element="main" direction="column" className="iw-dashboard-main">
|
|
6
|
+
<AppHeader />
|
|
7
|
+
|
|
8
|
+
<Container maxWidth="xl" padding="lg" className="iw-dashboard-container">
|
|
9
|
+
<Flex v-if="isDashboardRoot" direction="column" gap="lg">
|
|
10
|
+
<Grid minColumnWidth="18rem" gap="lg">
|
|
11
|
+
<StatCard v-for="card in statCards" :key="card.id" v-bind="card" />
|
|
12
|
+
</Grid>
|
|
13
|
+
|
|
14
|
+
<TrafficCard />
|
|
15
|
+
|
|
16
|
+
<Grid :columns="3" gap="lg">
|
|
17
|
+
<SocialCard
|
|
18
|
+
v-for="card in socialCards"
|
|
19
|
+
:key="card.icon"
|
|
20
|
+
v-bind="card"
|
|
21
|
+
/>
|
|
22
|
+
</Grid>
|
|
23
|
+
|
|
24
|
+
<TrafficSalesCard />
|
|
25
|
+
</Flex>
|
|
26
|
+
|
|
27
|
+
<PrimitiveSection v-else />
|
|
28
|
+
</Container>
|
|
29
|
+
|
|
30
|
+
<Flex
|
|
31
|
+
element="footer"
|
|
32
|
+
justify="between"
|
|
33
|
+
gap="md"
|
|
34
|
+
padding="md"
|
|
35
|
+
className="iw-dashboard-footer"
|
|
36
|
+
>
|
|
37
|
+
<div>Admin dashboard example © 2026</div>
|
|
38
|
+
<div>Built with Inglorious UI primitives and charts</div>
|
|
39
|
+
</Flex>
|
|
40
|
+
</Flex>
|
|
41
|
+
</Flex>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import { Container } from "../../layout/container/index.js"
|
|
46
|
+
import { Flex } from "../../layout/flex/index.js"
|
|
47
|
+
import { Grid } from "../../layout/grid/index.js"
|
|
48
|
+
import { AppDrawer } from "./app-drawer.js"
|
|
49
|
+
import { AppHeader } from "./app-header.js"
|
|
50
|
+
import { socialCards, statCards } from "./data.js"
|
|
51
|
+
import { PrimitiveSection } from "./primitive-section.js"
|
|
52
|
+
import { SocialCard } from "./social-card.js"
|
|
53
|
+
import { StatCard } from "./stat-card.js"
|
|
54
|
+
import { TrafficCard } from "./traffic-card.js"
|
|
55
|
+
import { TrafficSalesCard } from "./traffic-sales-card.js"
|
|
56
|
+
|
|
57
|
+
const appDrawer = api.getEntity("appDrawer")
|
|
58
|
+
const dashboardClassName = [
|
|
59
|
+
"iw-dashboard",
|
|
60
|
+
appDrawer.isHidden && "iw-dashboard-drawer-hidden",
|
|
61
|
+
appDrawer.isCollapsed && "iw-dashboard-drawer-collapsed",
|
|
62
|
+
]
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.join(" ")
|
|
65
|
+
|
|
66
|
+
const router = api.getEntity("router")
|
|
67
|
+
const isDashboardRoot = !router || router.path === "/"
|
|
68
|
+
</script>
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { html } from "@inglorious/web"
|
|
1
|
+
import { html, when } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { Container } from "../../layout/container/index.js"
|
|
4
|
+
import { Flex } from "../../layout/flex/index.js"
|
|
5
|
+
import { Grid } from "../../layout/grid/index.js"
|
|
6
|
+
import { AppHeader } from "./app-header.js"
|
|
7
7
|
import { socialCards, statCards } from "./data.js"
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { SocialCard } from "./social-card.js"
|
|
9
|
+
import { StatCard } from "./stat-card.js"
|
|
10
|
+
import { TrafficCard } from "./traffic-card.js"
|
|
11
|
+
import { TrafficSalesCard } from "./traffic-sales-card.js"
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const Dashboard = {
|
|
14
14
|
render(entity, api) {
|
|
15
15
|
const appDrawer = api.getEntity("appDrawer")
|
|
16
|
-
const router = api.getEntity("router")
|
|
17
|
-
|
|
18
16
|
const dashboardClassName = [
|
|
19
17
|
"iw-dashboard",
|
|
20
18
|
appDrawer.isHidden && "iw-dashboard-drawer-hidden",
|
|
@@ -23,50 +21,53 @@ export const dashboard = {
|
|
|
23
21
|
.filter(Boolean)
|
|
24
22
|
.join(" ")
|
|
25
23
|
|
|
24
|
+
const router = api.getEntity("router")
|
|
26
25
|
const isDashboardRoot = !router || router.path === "/"
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
if (isDashboardRoot) {
|
|
30
|
-
mainContent = flex.render({
|
|
31
|
-
direction: "column",
|
|
32
|
-
gap: "lg",
|
|
33
|
-
children: [
|
|
34
|
-
grid.render({
|
|
35
|
-
minColumnWidth: "18rem",
|
|
36
|
-
gap: "lg",
|
|
37
|
-
children: statCards.map((card) => statCard.render(card, api)),
|
|
38
|
-
}),
|
|
39
|
-
trafficCard.render(entity, api),
|
|
40
|
-
grid.render({
|
|
41
|
-
columns: 3,
|
|
42
|
-
gap: "lg",
|
|
43
|
-
children: socialCards.map((card) => socialCard.render(card, api)),
|
|
44
|
-
}),
|
|
45
|
-
trafficSalesCard.render(entity, api),
|
|
46
|
-
],
|
|
47
|
-
})
|
|
48
|
-
} else {
|
|
49
|
-
mainContent = api.render("primitiveSection")
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return flex.render({
|
|
27
|
+
return Flex.render({
|
|
53
28
|
direction: "column",
|
|
54
29
|
className: dashboardClassName,
|
|
55
30
|
children: [
|
|
56
31
|
api.render("appDrawer"),
|
|
57
|
-
|
|
32
|
+
Flex.render({
|
|
58
33
|
element: "main",
|
|
59
34
|
direction: "column",
|
|
60
35
|
className: "iw-dashboard-main",
|
|
61
36
|
children: [
|
|
62
|
-
|
|
63
|
-
|
|
37
|
+
AppHeader.render(entity, api),
|
|
38
|
+
Container.render({
|
|
64
39
|
maxWidth: "xl",
|
|
65
40
|
padding: "lg",
|
|
66
41
|
className: "iw-dashboard-container",
|
|
67
|
-
children:
|
|
42
|
+
children: when(
|
|
43
|
+
isDashboardRoot,
|
|
44
|
+
() =>
|
|
45
|
+
Flex.render({
|
|
46
|
+
direction: "column",
|
|
47
|
+
gap: "lg",
|
|
48
|
+
children: [
|
|
49
|
+
Grid.render({
|
|
50
|
+
minColumnWidth: "18rem",
|
|
51
|
+
gap: "lg",
|
|
52
|
+
children: statCards.map((card) =>
|
|
53
|
+
StatCard.render(card, api),
|
|
54
|
+
),
|
|
55
|
+
}),
|
|
56
|
+
TrafficCard.render(entity, api),
|
|
57
|
+
Grid.render({
|
|
58
|
+
columns: 3,
|
|
59
|
+
gap: "lg",
|
|
60
|
+
children: socialCards.map((card) =>
|
|
61
|
+
SocialCard.render(card, api),
|
|
62
|
+
),
|
|
63
|
+
}),
|
|
64
|
+
TrafficSalesCard.render(entity, api),
|
|
65
|
+
],
|
|
66
|
+
}),
|
|
67
|
+
() => api.render("primitiveSection"),
|
|
68
|
+
),
|
|
68
69
|
}),
|
|
69
|
-
|
|
70
|
+
Flex.render({
|
|
70
71
|
element: "footer",
|
|
71
72
|
justify: "between",
|
|
72
73
|
gap: "md",
|
|
@@ -6,25 +6,29 @@ import {
|
|
|
6
6
|
createEntityRender,
|
|
7
7
|
notifyActionArgType,
|
|
8
8
|
} from "../../stories/notifyStory.js"
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { AppDrawer } from "./app-drawer.js"
|
|
10
|
+
import { AppHeader } from "./app-header.js"
|
|
11
|
+
import { Dashboard } from "./dashboard.js"
|
|
12
|
+
import { DashboardJsx } from "./dashboard-jsx.jsx"
|
|
13
|
+
import { DashboardVue } from "./dashboard-vue.vue"
|
|
14
|
+
import { Mode } from "./mode.js"
|
|
15
|
+
import { PrimitiveSection } from "./primitive-section.js"
|
|
16
|
+
import { Theme } from "./theme.js"
|
|
17
|
+
|
|
18
|
+
const baseTypes = {
|
|
19
|
+
Theme,
|
|
20
|
+
Mode,
|
|
21
|
+
AppDrawer,
|
|
22
|
+
AppHeader,
|
|
23
|
+
PrimitiveSection,
|
|
24
|
+
area: areaChart,
|
|
25
|
+
bar: barChart,
|
|
26
|
+
line: lineChart,
|
|
27
|
+
}
|
|
14
28
|
|
|
15
29
|
export default {
|
|
16
30
|
title: "Examples/AdminDashboard",
|
|
17
31
|
tags: ["autodocs"],
|
|
18
|
-
render: createEntityRender({
|
|
19
|
-
theme,
|
|
20
|
-
mode,
|
|
21
|
-
appDrawer,
|
|
22
|
-
dashboard,
|
|
23
|
-
primitiveSection,
|
|
24
|
-
area: areaChart,
|
|
25
|
-
bar: barChart,
|
|
26
|
-
line: lineChart,
|
|
27
|
-
}),
|
|
28
32
|
argTypes: {
|
|
29
33
|
...notifyActionArgType,
|
|
30
34
|
},
|
|
@@ -40,8 +44,34 @@ export default {
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
export const Default = {
|
|
47
|
+
render: createEntityRender({
|
|
48
|
+
...baseTypes,
|
|
49
|
+
Dashboard,
|
|
50
|
+
}),
|
|
51
|
+
args: {
|
|
52
|
+
id: "dashboard",
|
|
53
|
+
type: "Dashboard",
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Jsx = {
|
|
58
|
+
render: createEntityRender({
|
|
59
|
+
...baseTypes,
|
|
60
|
+
Dashboard: DashboardJsx,
|
|
61
|
+
}),
|
|
62
|
+
args: {
|
|
63
|
+
id: "dashboard",
|
|
64
|
+
type: "Dashboard",
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const Vue = {
|
|
69
|
+
render: createEntityRender({
|
|
70
|
+
...baseTypes,
|
|
71
|
+
Dashboard: DashboardVue,
|
|
72
|
+
}),
|
|
43
73
|
args: {
|
|
44
74
|
id: "dashboard",
|
|
45
|
-
type: "
|
|
75
|
+
type: "Dashboard",
|
|
46
76
|
},
|
|
47
77
|
}
|