@inglorious/ui 0.1.0 → 1.0.0
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/README.md +45 -0
- package/package.json +191 -16
- package/src/all.css +7 -0
- package/src/controls/button/button.stories.js +35 -15
- package/src/controls/button/index.js +1 -3
- package/src/controls/button/style.css +80 -37
- package/src/controls/button/template.js +23 -26
- package/src/controls/button-group/button-group.stories.js +19 -15
- package/src/controls/button-group/index.js +1 -2
- package/src/controls/button-group/style.css +0 -7
- package/src/controls/button-group/template.js +46 -56
- package/src/controls/checkbox/checkbox.stories.js +16 -13
- package/src/controls/checkbox/index.js +1 -2
- package/src/controls/checkbox/style.css +23 -2
- package/src/controls/checkbox/template.js +20 -18
- package/src/controls/combobox/combobox.stories.js +92 -0
- package/src/controls/{select → combobox}/handlers.js +8 -5
- package/src/controls/combobox/helpers.js +91 -0
- package/src/controls/combobox/index.js +43 -0
- package/src/controls/combobox/style.css +203 -0
- package/src/controls/combobox/template.js +340 -0
- package/src/controls/controls.css +12 -0
- package/src/controls/fab/fab.stories.js +11 -11
- package/src/controls/fab/index.js +1 -2
- package/src/controls/fab/template.js +21 -19
- package/src/controls/icon-button/icon-button.stories.js +8 -10
- package/src/controls/icon-button/index.js +1 -2
- package/src/controls/icon-button/template.js +13 -19
- package/src/controls/input/index.js +1 -2
- package/src/controls/input/input.stories.js +24 -23
- package/src/controls/input/style.css +9 -7
- package/src/controls/input/template.js +28 -31
- package/src/controls/radio-group/index.js +1 -2
- package/src/controls/radio-group/radio-group.stories.js +11 -8
- package/src/controls/radio-group/style.css +22 -1
- package/src/controls/radio-group/template.js +20 -15
- package/src/controls/rating/index.js +1 -2
- package/src/controls/rating/rating.stories.js +7 -10
- package/src/controls/rating/style.css +1 -2
- package/src/controls/rating/template.js +20 -17
- package/src/controls/select/helpers.js +2 -21
- package/src/controls/select/index.js +1 -13
- package/src/controls/select/select.stories.js +68 -64
- package/src/controls/select/style.css +66 -189
- package/src/controls/select/template.js +77 -406
- package/src/controls/slider/index.js +1 -2
- package/src/controls/slider/slider.stories.js +15 -12
- package/src/controls/slider/style.css +24 -3
- package/src/controls/slider/template.js +30 -23
- package/src/controls/switch/index.js +1 -2
- package/src/controls/switch/style.css +23 -2
- package/src/controls/switch/switch.stories.js +14 -11
- package/src/controls/switch/template.js +18 -16
- package/src/data-display/avatar/avatar.stories.js +106 -0
- package/src/data-display/avatar/index.js +3 -0
- package/src/data-display/avatar/style.css +64 -0
- package/src/data-display/avatar/template.js +81 -0
- package/src/data-display/badge/badge.stories.js +64 -0
- package/src/data-display/badge/index.js +3 -0
- package/src/data-display/badge/style.css +84 -0
- package/src/data-display/badge/template.js +46 -0
- package/src/data-display/chip/chip.stories.js +57 -0
- package/src/data-display/chip/index.js +3 -0
- package/src/data-display/chip/style.css +84 -0
- package/src/data-display/chip/template.js +32 -0
- package/src/data-display/data-display.css +11 -0
- package/src/data-display/data-grid/base.css +58 -0
- package/src/data-display/data-grid/data-grid.stories.js +158 -0
- package/src/data-display/data-grid/filters/helpers.js +8 -0
- package/src/data-display/data-grid/filters/index.js +21 -0
- package/src/data-display/data-grid/filters/input.js +24 -0
- package/src/data-display/data-grid/filters/range.js +48 -0
- package/src/data-display/data-grid/filters/select.js +17 -0
- package/src/data-display/data-grid/handlers.js +523 -0
- package/src/data-display/data-grid/helpers.js +248 -0
- package/src/data-display/data-grid/index.js +64 -0
- package/src/data-display/data-grid/style.css +14 -0
- package/src/data-display/data-grid/template.js +458 -0
- package/src/data-display/data-grid/theme.css +148 -0
- package/src/data-display/divider/divider.stories.js +48 -0
- package/src/data-display/divider/index.js +3 -0
- package/src/data-display/divider/style.css +18 -0
- package/src/data-display/divider/template.js +17 -0
- package/src/data-display/icon/icon-implementations.mdx +160 -0
- package/src/data-display/icon/icon-utf8.stories.js +156 -0
- package/src/data-display/icon/icon.stories.js +38 -0
- package/src/data-display/icon/index.js +3 -0
- package/src/data-display/icon/style.css +17 -0
- package/src/data-display/icon/template.js +19 -0
- package/src/data-display/list/handlers.js +25 -0
- package/src/data-display/list/index.js +4 -0
- package/src/data-display/list/list.stories.js +187 -0
- package/src/data-display/list/style.css +119 -0
- package/src/data-display/list/template.js +302 -0
- package/src/data-display/material-icon/index.js +3 -0
- package/src/data-display/material-icon/material-icon.stories.js +99 -0
- package/src/data-display/material-icon/style.css +27 -0
- package/src/data-display/material-icon/template.js +21 -0
- package/src/data-display/table/index.js +1 -0
- package/src/data-display/table/style.css +42 -0
- package/src/data-display/table/table.stories.js +40 -0
- package/src/data-display/table/template.js +114 -0
- package/src/data-display/tooltip/index.js +3 -0
- package/src/data-display/tooltip/style.css +57 -0
- package/src/data-display/tooltip/template.js +58 -0
- package/src/data-display/tooltip/tooltip.stories.js +44 -0
- package/src/data-display/typography/index.js +3 -0
- package/src/data-display/typography/style.css +49 -0
- package/src/data-display/typography/template.js +110 -0
- package/src/data-display/typography/typography.stories.js +48 -0
- package/src/data-display/virtual-list/handlers.js +68 -0
- package/src/data-display/virtual-list/index.js +4 -0
- package/src/data-display/virtual-list/template.js +101 -0
- package/src/examples/dashboard/app-drawer.js +255 -0
- package/src/examples/dashboard/app-header.js +149 -0
- package/src/examples/dashboard/dashboard.js +85 -0
- package/src/examples/dashboard/dashboard.stories.js +47 -0
- package/src/examples/dashboard/data.js +205 -0
- package/src/examples/dashboard/mode.js +27 -0
- package/src/examples/dashboard/primitive-content.js +1325 -0
- package/src/examples/dashboard/primitive-section.js +158 -0
- package/src/examples/dashboard/router.js +13 -0
- package/src/examples/dashboard/social-card.js +73 -0
- package/src/examples/dashboard/stat-card.js +84 -0
- package/src/examples/dashboard/style.css +339 -0
- package/src/examples/dashboard/theme-utils.js +95 -0
- package/src/examples/dashboard/theme.js +27 -0
- package/src/examples/dashboard/traffic-card.js +108 -0
- package/src/examples/dashboard/traffic-sales-card.js +267 -0
- package/src/feedback/alert/alert.stories.js +70 -0
- package/src/feedback/alert/index.js +3 -0
- package/src/feedback/alert/style.css +98 -0
- package/src/feedback/alert/template.js +74 -0
- package/src/feedback/backdrop/backdrop.stories.js +21 -0
- package/src/feedback/backdrop/index.js +3 -0
- package/src/feedback/backdrop/style.css +25 -0
- package/src/feedback/backdrop/template.js +31 -0
- package/src/feedback/dialog/dialog.stories.js +27 -0
- package/src/feedback/dialog/index.js +3 -0
- package/src/feedback/dialog/style.css +68 -0
- package/src/feedback/dialog/template.js +64 -0
- package/src/feedback/feedback.css +6 -0
- package/src/feedback/progress/index.js +3 -0
- package/src/feedback/progress/progress.stories.js +54 -0
- package/src/feedback/progress/style.css +95 -0
- package/src/feedback/progress/template.js +88 -0
- package/src/feedback/skeleton/index.js +3 -0
- package/src/feedback/skeleton/skeleton.stories.js +44 -0
- package/src/feedback/skeleton/style.css +41 -0
- package/src/feedback/skeleton/template.js +48 -0
- package/src/feedback/snackbar/index.js +3 -0
- package/src/feedback/snackbar/snackbar.stories.js +25 -0
- package/src/feedback/snackbar/style.css +64 -0
- package/src/feedback/snackbar/template.js +55 -0
- package/src/index.js +32 -1
- package/src/layout/container/container.stories.js +105 -0
- package/src/layout/container/index.js +3 -0
- package/src/layout/container/style.css +34 -0
- package/src/layout/container/template.js +119 -0
- package/src/layout/flex/flex.stories.js +28 -10
- package/src/layout/flex/index.js +1 -2
- package/src/layout/flex/style.css +20 -0
- package/src/layout/flex/template.js +40 -13
- package/src/layout/grid/grid.stories.js +46 -30
- package/src/layout/grid/index.js +1 -2
- package/src/layout/grid/style.css +20 -0
- package/src/layout/grid/template.js +100 -20
- package/src/layout/layout.css +3 -0
- package/src/navigation/bottom-navigation/bottom-navigation.stories.js +33 -0
- package/src/navigation/bottom-navigation/index.js +1 -0
- package/src/navigation/bottom-navigation/style.css +32 -0
- package/src/navigation/bottom-navigation/template.js +74 -0
- package/src/navigation/breadcrumbs/breadcrumbs.stories.js +33 -0
- package/src/navigation/breadcrumbs/index.js +1 -0
- package/src/navigation/breadcrumbs/style.css +27 -0
- package/src/navigation/breadcrumbs/template.js +79 -0
- package/src/navigation/drawer/drawer.stories.js +60 -0
- package/src/navigation/drawer/index.js +3 -0
- package/src/navigation/drawer/style.css +125 -0
- package/src/navigation/drawer/template.js +131 -0
- package/src/navigation/link/index.js +3 -0
- package/src/navigation/link/link.stories.js +53 -0
- package/src/navigation/link/style.css +40 -0
- package/src/navigation/link/template.js +53 -0
- package/src/navigation/menu/index.js +1 -0
- package/src/navigation/menu/menu.stories.js +36 -0
- package/src/navigation/menu/style.css +44 -0
- package/src/navigation/menu/template.js +81 -0
- package/src/navigation/navigation.css +9 -0
- package/src/navigation/pagination/index.js +1 -0
- package/src/navigation/pagination/pagination.stories.js +61 -0
- package/src/navigation/pagination/style.css +29 -0
- package/src/navigation/pagination/template.js +140 -0
- package/src/navigation/speed-dial/index.js +1 -0
- package/src/navigation/speed-dial/speed-dial.stories.js +40 -0
- package/src/navigation/speed-dial/style.css +38 -0
- package/src/navigation/speed-dial/template.js +68 -0
- package/src/navigation/stepper/index.js +1 -0
- package/src/navigation/stepper/stepper.stories.js +35 -0
- package/src/navigation/stepper/style.css +49 -0
- package/src/navigation/stepper/template.js +61 -0
- package/src/navigation/tabs/index.js +1 -0
- package/src/navigation/tabs/style.css +35 -0
- package/src/navigation/tabs/tabs.stories.js +40 -0
- package/src/navigation/tabs/template.js +79 -0
- package/src/overview.mdx +39 -0
- package/src/stories/notifyStory.js +22 -25
- package/src/styles/base.css +2 -0
- package/src/styles/reset.css +15 -0
- package/src/{themes → styles/themes}/bootstrap.css +2 -0
- package/src/{themes → styles/themes}/inglorious.css +9 -1
- package/src/{themes → styles/themes}/material.css +2 -0
- package/src/{tokens/index.css → styles/tokens.css} +9 -0
- package/src/surfaces/accordion/accordion.stories.js +60 -0
- package/src/surfaces/accordion/index.js +1 -0
- package/src/surfaces/accordion/style.css +64 -0
- package/src/surfaces/accordion/template.js +85 -0
- package/src/surfaces/app-bar/app-bar.stories.js +109 -0
- package/src/surfaces/app-bar/index.js +3 -0
- package/src/surfaces/app-bar/style.css +109 -0
- package/src/surfaces/app-bar/template.js +78 -0
- package/src/surfaces/card/card.stories.js +108 -0
- package/src/surfaces/card/index.js +1 -0
- package/src/surfaces/card/style.css +107 -0
- package/src/surfaces/card/template.js +163 -0
- package/src/surfaces/paper/index.js +3 -0
- package/src/surfaces/paper/paper.stories.js +97 -0
- package/src/surfaces/paper/style.css +73 -0
- package/src/surfaces/paper/template.js +76 -0
- package/src/surfaces/surfaces.css +4 -0
- package/types/controls/button-group.d.ts +8 -7
- package/types/controls/button.d.ts +10 -7
- package/types/controls/checkbox.d.ts +8 -6
- package/types/controls/combobox.d.ts +66 -0
- package/types/controls/fab.d.ts +6 -5
- package/types/controls/icon-button.d.ts +8 -7
- package/types/controls/input.d.ts +18 -11
- package/types/controls/radio-group.d.ts +7 -5
- package/types/controls/rating.d.ts +6 -5
- package/types/controls/select.d.ts +11 -34
- package/types/controls/slider.d.ts +8 -6
- package/types/controls/switch.d.ts +7 -5
- package/types/data-display/avatar.d.ts +30 -0
- package/types/data-display/badge.d.ts +20 -0
- package/types/data-display/chip.d.ts +25 -0
- package/types/data-display/data-grid.d.ts +151 -0
- package/types/data-display/divider.d.ts +14 -0
- package/types/data-display/icon.d.ts +16 -0
- package/types/data-display/list.d.ts +66 -0
- package/types/data-display/material-icon.d.ts +15 -0
- package/types/data-display/table.d.ts +45 -0
- package/types/data-display/tooltip.d.ts +20 -0
- package/types/data-display/typography.d.ts +28 -0
- package/types/data-display/virtual-list.d.ts +94 -0
- package/types/feedback/alert.d.ts +22 -0
- package/types/feedback/backdrop.d.ts +17 -0
- package/types/feedback/dialog.d.ts +21 -0
- package/types/feedback/progress.d.ts +18 -0
- package/types/feedback/skeleton.d.ts +18 -0
- package/types/feedback/snackbar.d.ts +19 -0
- package/types/index.d.ts +92 -14
- package/types/layout/container.d.ts +28 -0
- package/types/layout/flex.d.ts +16 -5
- package/types/layout/grid.d.ts +15 -4
- package/types/navigation/bottom-navigation.d.ts +33 -0
- package/types/navigation/breadcrumbs.d.ts +29 -0
- package/types/navigation/drawer.d.ts +23 -0
- package/types/navigation/link.d.ts +22 -0
- package/types/navigation/menu.d.ts +32 -0
- package/types/navigation/pagination.d.ts +50 -0
- package/types/navigation/speed-dial.d.ts +35 -0
- package/types/navigation/stepper.d.ts +26 -0
- package/types/navigation/tabs.d.ts +31 -0
- package/types/surfaces/accordion.d.ts +32 -0
- package/types/surfaces/app-bar.d.ts +25 -0
- package/types/surfaces/card.d.ts +39 -0
- package/types/surfaces/paper.d.ts +28 -0
- package/src/shared/withRenderValidation.js +0 -19
- package/src/widgets/card/card.stories.js +0 -135
- package/src/widgets/card/index.js +0 -4
- package/src/widgets/card/style.css +0 -53
- package/src/widgets/card/template.js +0 -97
- package/types/widgets/card.d.ts +0 -21
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { html } from "@inglorious/web"
|
|
2
|
+
|
|
3
|
+
import { typography } from "../../data-display/typography/index.js"
|
|
4
|
+
import { container } from "../../layout/container/index.js"
|
|
5
|
+
import { flex } from "../../layout/flex/index.js"
|
|
6
|
+
import { grid } from "../../layout/grid/index.js"
|
|
7
|
+
import { card } from "../../surfaces/card/index.js"
|
|
8
|
+
import { getPrimitiveContent } from "./primitive-content.js"
|
|
9
|
+
|
|
10
|
+
export const primitiveSection = {
|
|
11
|
+
render(entity, api) {
|
|
12
|
+
const router = api?.getEntity?.("router")
|
|
13
|
+
const content = getPrimitiveContent(router?.path, entity)
|
|
14
|
+
const name = content?.name ?? "Primitive"
|
|
15
|
+
const category = content?.category ?? ""
|
|
16
|
+
const summary = content?.summary
|
|
17
|
+
const description = content?.description
|
|
18
|
+
const useCases = content?.useCases ?? []
|
|
19
|
+
const example = content?.example
|
|
20
|
+
const exampleCode = example?.code
|
|
21
|
+
const examplePreview =
|
|
22
|
+
typeof example?.preview === "function"
|
|
23
|
+
? example.preview()
|
|
24
|
+
: example?.preview
|
|
25
|
+
const showEmpty = !content
|
|
26
|
+
|
|
27
|
+
return container.render({
|
|
28
|
+
maxWidth: "xl",
|
|
29
|
+
padding: "lg",
|
|
30
|
+
className: "iw-dashboard-container",
|
|
31
|
+
children: flex.render({
|
|
32
|
+
direction: "column",
|
|
33
|
+
gap: "lg",
|
|
34
|
+
children: [
|
|
35
|
+
flex.render({
|
|
36
|
+
direction: "column",
|
|
37
|
+
gap: "xs",
|
|
38
|
+
children: [
|
|
39
|
+
typography.render({
|
|
40
|
+
variant: "h4",
|
|
41
|
+
children: showEmpty ? "Choose a Primitive" : name,
|
|
42
|
+
}),
|
|
43
|
+
category
|
|
44
|
+
? typography.render({
|
|
45
|
+
variant: "body2",
|
|
46
|
+
color: "secondary",
|
|
47
|
+
children: `Category: ${category}`,
|
|
48
|
+
})
|
|
49
|
+
: "",
|
|
50
|
+
summary
|
|
51
|
+
? typography.render({
|
|
52
|
+
variant: "body1",
|
|
53
|
+
color: "secondary",
|
|
54
|
+
children: summary,
|
|
55
|
+
})
|
|
56
|
+
: "",
|
|
57
|
+
],
|
|
58
|
+
}),
|
|
59
|
+
card.render({
|
|
60
|
+
padding: "xl",
|
|
61
|
+
children: flex.render({
|
|
62
|
+
align: "center",
|
|
63
|
+
justify: "center",
|
|
64
|
+
padding: "xl",
|
|
65
|
+
className: "iw-primitive-placeholder",
|
|
66
|
+
children: html`
|
|
67
|
+
<div style="text-align: center;">
|
|
68
|
+
${typography.render({
|
|
69
|
+
variant: "h6",
|
|
70
|
+
children: showEmpty
|
|
71
|
+
? "Pick a primitive from the drawer to see details."
|
|
72
|
+
: `Documentation for ${name}`,
|
|
73
|
+
})}
|
|
74
|
+
${typography.render({
|
|
75
|
+
variant: "body1",
|
|
76
|
+
children:
|
|
77
|
+
description ??
|
|
78
|
+
"This section is wired for per-primitive docs and examples.",
|
|
79
|
+
})}
|
|
80
|
+
${useCases.length
|
|
81
|
+
? html`
|
|
82
|
+
<div style="margin-top: 16px; text-align: left;">
|
|
83
|
+
${typography.render({
|
|
84
|
+
variant: "body2",
|
|
85
|
+
color: "secondary",
|
|
86
|
+
children: "Common use cases",
|
|
87
|
+
})}
|
|
88
|
+
<ul style="margin: 8px 0 0; padding-left: 20px;">
|
|
89
|
+
${useCases.map(
|
|
90
|
+
(useCase) => html`<li>${useCase}</li>`,
|
|
91
|
+
)}
|
|
92
|
+
</ul>
|
|
93
|
+
</div>
|
|
94
|
+
`
|
|
95
|
+
: ""}
|
|
96
|
+
</div>
|
|
97
|
+
`,
|
|
98
|
+
}),
|
|
99
|
+
}),
|
|
100
|
+
showEmpty
|
|
101
|
+
? ""
|
|
102
|
+
: card.render({
|
|
103
|
+
padding: "xl",
|
|
104
|
+
className: "iw-primitive-example",
|
|
105
|
+
children: flex.render({
|
|
106
|
+
direction: "column",
|
|
107
|
+
gap: "md",
|
|
108
|
+
children: [
|
|
109
|
+
typography.render({
|
|
110
|
+
variant: "h6",
|
|
111
|
+
children: "Example",
|
|
112
|
+
}),
|
|
113
|
+
grid.render({
|
|
114
|
+
minColumnWidth: "18rem",
|
|
115
|
+
gap: "lg",
|
|
116
|
+
children: [
|
|
117
|
+
flex.render({
|
|
118
|
+
direction: "column",
|
|
119
|
+
gap: "sm",
|
|
120
|
+
children: [
|
|
121
|
+
typography.render({
|
|
122
|
+
variant: "body2",
|
|
123
|
+
color: "secondary",
|
|
124
|
+
children: "Code",
|
|
125
|
+
}),
|
|
126
|
+
html`<pre
|
|
127
|
+
class="iw-primitive-code"
|
|
128
|
+
><code>${exampleCode ??
|
|
129
|
+
"// Example coming soon."}</code></pre>`,
|
|
130
|
+
],
|
|
131
|
+
}),
|
|
132
|
+
flex.render({
|
|
133
|
+
direction: "column",
|
|
134
|
+
gap: "sm",
|
|
135
|
+
children: [
|
|
136
|
+
typography.render({
|
|
137
|
+
variant: "body2",
|
|
138
|
+
color: "secondary",
|
|
139
|
+
children: "Result",
|
|
140
|
+
}),
|
|
141
|
+
html`<div class="iw-primitive-preview">
|
|
142
|
+
${examplePreview ??
|
|
143
|
+
html`<div class="iw-primitive-preview-empty">
|
|
144
|
+
Preview coming soon.
|
|
145
|
+
</div>`}
|
|
146
|
+
</div>`,
|
|
147
|
+
],
|
|
148
|
+
}),
|
|
149
|
+
],
|
|
150
|
+
}),
|
|
151
|
+
],
|
|
152
|
+
}),
|
|
153
|
+
}),
|
|
154
|
+
],
|
|
155
|
+
}),
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { setRoutes } from "@inglorious/web/router"
|
|
2
|
+
export { router } from "@inglorious/web/router"
|
|
3
|
+
|
|
4
|
+
setRoutes({
|
|
5
|
+
"/": "dashboard",
|
|
6
|
+
"/layout/:name": "primitiveSection",
|
|
7
|
+
"/controls/:name": "primitiveSection",
|
|
8
|
+
"/data-display/:name": "primitiveSection",
|
|
9
|
+
"/feedback/:name": "primitiveSection",
|
|
10
|
+
"/navigation/:name": "primitiveSection",
|
|
11
|
+
"/surfaces/:name": "primitiveSection",
|
|
12
|
+
"*": "dashboard",
|
|
13
|
+
})
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { chart } from "@inglorious/charts"
|
|
2
|
+
import { html } from "@inglorious/web"
|
|
3
|
+
|
|
4
|
+
import { divider } from "../../data-display/divider"
|
|
5
|
+
import { materialIcon } from "../../data-display/material-icon"
|
|
6
|
+
import { typography } from "../../data-display/typography"
|
|
7
|
+
import { grid } from "../../layout/grid"
|
|
8
|
+
import { card } from "../../surfaces/card"
|
|
9
|
+
|
|
10
|
+
export const socialCard = {
|
|
11
|
+
render(entity, api) {
|
|
12
|
+
return card.render({
|
|
13
|
+
className: "iw-dashboard-social-card",
|
|
14
|
+
headerPadding: "none",
|
|
15
|
+
header: html`
|
|
16
|
+
<div class="iw-dashboard-social-cap ${entity.capClass}">
|
|
17
|
+
${materialIcon.render({ name: entity.icon, size: "lg" })}
|
|
18
|
+
<div class="iw-dashboard-social-chart">
|
|
19
|
+
${this.renderAreaSpark(entity, api)}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
`,
|
|
23
|
+
body: grid.render({
|
|
24
|
+
columns: "1fr auto 1fr",
|
|
25
|
+
gap: "md",
|
|
26
|
+
className: "iw-dashboard-social-stats",
|
|
27
|
+
children: [
|
|
28
|
+
html`<div>
|
|
29
|
+
${typography.render({ variant: "h3", children: entity.top })}
|
|
30
|
+
${typography.render({
|
|
31
|
+
variant: "caption",
|
|
32
|
+
children: entity.topLabel,
|
|
33
|
+
color: "var(--iw-color-text-secondary)",
|
|
34
|
+
})}
|
|
35
|
+
</div>`,
|
|
36
|
+
divider.render({ orientation: "vertical" }),
|
|
37
|
+
html`<div>
|
|
38
|
+
${typography.render({ variant: "h3", children: entity.bottom })}
|
|
39
|
+
${typography.render({
|
|
40
|
+
variant: "caption",
|
|
41
|
+
children: entity.bottomLabel,
|
|
42
|
+
color: "var(--iw-color-text-secondary)",
|
|
43
|
+
})}
|
|
44
|
+
</div>`,
|
|
45
|
+
],
|
|
46
|
+
}),
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
renderAreaSpark(entity, api) {
|
|
51
|
+
return chart.renderAreaChart(
|
|
52
|
+
{
|
|
53
|
+
type: "area",
|
|
54
|
+
data: entity.data.map((value, index) => ({ name: `${index}`, value })),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
width: 640,
|
|
58
|
+
height: 200,
|
|
59
|
+
padding: 0,
|
|
60
|
+
dataKeys: ["value"],
|
|
61
|
+
children: [
|
|
62
|
+
chart.Area({
|
|
63
|
+
dataKey: "value",
|
|
64
|
+
stroke: "rgba(255,255,255,0.9)",
|
|
65
|
+
fill: "rgba(255,255,255,0.35)",
|
|
66
|
+
strokeWidth: 2,
|
|
67
|
+
}),
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
api,
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { chart } from "@inglorious/charts"
|
|
2
|
+
import { html } from "@inglorious/web"
|
|
3
|
+
|
|
4
|
+
import { button } from "../../controls/button"
|
|
5
|
+
import { materialIcon } from "../../data-display/material-icon"
|
|
6
|
+
import { typography } from "../../data-display/typography"
|
|
7
|
+
import { card } from "../../surfaces/card"
|
|
8
|
+
|
|
9
|
+
export const statCard = {
|
|
10
|
+
render(entity, api) {
|
|
11
|
+
return card.render({
|
|
12
|
+
className: `iw-dashboard-stat ${entity.className}`,
|
|
13
|
+
bodyPadding: "none",
|
|
14
|
+
body: html`
|
|
15
|
+
<div class="iw-dashboard-stat-container">
|
|
16
|
+
<div class="iw-dashboard-stat-top">
|
|
17
|
+
<div>
|
|
18
|
+
<div class="iw-dashboard-stat-value">
|
|
19
|
+
${typography.render({ variant: "h2", children: entity.value })}
|
|
20
|
+
<span
|
|
21
|
+
>(${typography.render({
|
|
22
|
+
variant: "caption",
|
|
23
|
+
children: html`<span class="iw-dashboard-stat-change">
|
|
24
|
+
${entity.change}
|
|
25
|
+
${materialIcon.render({
|
|
26
|
+
name: entity.direction,
|
|
27
|
+
size: "sm",
|
|
28
|
+
})}
|
|
29
|
+
</span>`,
|
|
30
|
+
})})</span
|
|
31
|
+
>
|
|
32
|
+
</div>
|
|
33
|
+
${typography.render({ children: entity.label })}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="iw-dashboard-stat-chart">
|
|
37
|
+
${this.renderStatChart(entity, api)}
|
|
38
|
+
</div>
|
|
39
|
+
${button.render({
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
shape: "square",
|
|
42
|
+
className: "iw-dashboard-stat-more",
|
|
43
|
+
children: materialIcon.render({ name: "more_vert", size: "lg" }),
|
|
44
|
+
"aria-label": "More options",
|
|
45
|
+
})}
|
|
46
|
+
</div>
|
|
47
|
+
`,
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
renderStatChart(entity, api) {
|
|
52
|
+
const data = entity.data.map((value, index) => ({
|
|
53
|
+
name: `${index}`,
|
|
54
|
+
value,
|
|
55
|
+
}))
|
|
56
|
+
|
|
57
|
+
const chartConfig = {
|
|
58
|
+
id: entity.id,
|
|
59
|
+
type: entity.chartType,
|
|
60
|
+
data,
|
|
61
|
+
width: 400,
|
|
62
|
+
height: 80,
|
|
63
|
+
padding: { top: 0, right: 16, bottom: -16, left: 16 },
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const children = []
|
|
67
|
+
if (entity.hasDots) {
|
|
68
|
+
children.push(
|
|
69
|
+
chart.Dots({ dataKey: "value", stroke: "white", fill: "#39a2f1" }),
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (entity.chartType === "area") {
|
|
74
|
+
children.push(chart.Area({ fill: "rgba(255,255,255,0.3)" }))
|
|
75
|
+
return chart.renderAreaChart(chartConfig, { children }, api)
|
|
76
|
+
} else if (entity.chartType === "bar") {
|
|
77
|
+
children.push(chart.Bar({ fill: "rgba(255,255,255,0.3)" }))
|
|
78
|
+
return chart.renderBarChart(chartConfig, { children }, api)
|
|
79
|
+
} else {
|
|
80
|
+
children.push(chart.Line({ stroke: "white" }))
|
|
81
|
+
return chart.renderLineChart(chartConfig, { children }, api)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
.iw-dashboard {
|
|
2
|
+
min-height: 100vh;
|
|
3
|
+
|
|
4
|
+
.iw-dashboard-main {
|
|
5
|
+
transition: padding-left var(--iw-transition-fast);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&.iw-dashboard-drawer-collapsed .iw-dashboard-main {
|
|
9
|
+
padding-left: var(--iw-space-16);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&.iw-dashboard-drawer-collapsed .iw-dashboard-brand-title {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.iw-dashboard-drawer-hidden .iw-dashboard-main {
|
|
17
|
+
padding-left: 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (min-width: 0rem) {
|
|
22
|
+
.iw-dashboard .iw-dashboard-main {
|
|
23
|
+
padding-left: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.iw-dashboard .iw-dashboard-header-nav {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (min-width: 64rem) {
|
|
32
|
+
.iw-dashboard .iw-dashboard-main {
|
|
33
|
+
padding-left: 16rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iw-dashboard .iw-dashboard-header-nav {
|
|
37
|
+
display: flex;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.iw-dashboard-brand {
|
|
42
|
+
font-weight: var(--iw-font-weight-semibold);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.iw-dashboard-header {
|
|
46
|
+
position: sticky;
|
|
47
|
+
top: 0;
|
|
48
|
+
z-index: 10;
|
|
49
|
+
background: var(--iw-color-surface);
|
|
50
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
51
|
+
backdrop-filter: blur(10px);
|
|
52
|
+
transition:
|
|
53
|
+
background-color var(--iw-transition-slow),
|
|
54
|
+
border-color var(--iw-transition-slow);
|
|
55
|
+
|
|
56
|
+
.iw-dashboard-header-row {
|
|
57
|
+
width: 100%;
|
|
58
|
+
padding-inline: var(--iw-space-4);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.iw-dashboard-breadcrumbs {
|
|
62
|
+
min-height: var(--iw-space-12);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.iw-dashboard-header-actions {
|
|
67
|
+
margin-inline-start: auto;
|
|
68
|
+
|
|
69
|
+
.iw-divider-vertical {
|
|
70
|
+
height: var(--iw-space-8);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.iw-dashboard-container {
|
|
75
|
+
background: var(--iw-color-bg);
|
|
76
|
+
transition: background-color var(--iw-transition-slow);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.iw-dashboard-stat {
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
color: white;
|
|
82
|
+
|
|
83
|
+
.iw-typography,
|
|
84
|
+
.iw-material-icon,
|
|
85
|
+
.iw-button,
|
|
86
|
+
.iw-button .iw-material-icon {
|
|
87
|
+
color: white;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.iw-dashboard-stat-primary {
|
|
92
|
+
background: #5856d6;
|
|
93
|
+
}
|
|
94
|
+
.iw-dashboard-stat-info {
|
|
95
|
+
background: #39a2f1;
|
|
96
|
+
}
|
|
97
|
+
.iw-dashboard-stat-warning {
|
|
98
|
+
background: #f5a524;
|
|
99
|
+
}
|
|
100
|
+
.iw-dashboard-stat-danger {
|
|
101
|
+
background: #e55353;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.iw-dashboard-stat-top {
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
gap: var(--iw-space-3);
|
|
109
|
+
padding: var(--iw-space-4);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.iw-dashboard-stat-value {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: baseline;
|
|
115
|
+
gap: var(--iw-space-2);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.iw-dashboard-stat-change {
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: var(--iw-space-1);
|
|
122
|
+
line-height: 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.iw-dashboard-stat-container {
|
|
126
|
+
position: relative;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.iw-dashboard-stat-chart {
|
|
130
|
+
height: 5rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.iw-dashboard-stat-more {
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: var(--iw-space-2);
|
|
136
|
+
right: var(--iw-space-2);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.iw-dashboard-stat-chart .iw-chart,
|
|
140
|
+
.iw-dashboard-stat-chart svg {
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: 100%;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.iw-dashboard-traffic-chart .iw-chart,
|
|
146
|
+
.iw-dashboard-traffic-chart svg {
|
|
147
|
+
width: 100%;
|
|
148
|
+
height: 100%;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.iw-dashboard-social-card {
|
|
152
|
+
.iw-dashboard-social-cap {
|
|
153
|
+
position: relative;
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
min-height: 7.5rem;
|
|
158
|
+
color: white;
|
|
159
|
+
|
|
160
|
+
&.iw-dashboard-social-cap-facebook {
|
|
161
|
+
background: #3b5998;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&.iw-dashboard-social-cap-twitter {
|
|
165
|
+
background: #00aced;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.iw-dashboard-social-cap-linkedin {
|
|
169
|
+
background: #4875b4;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.iw-dashboard-social-chart {
|
|
174
|
+
position: absolute;
|
|
175
|
+
inset: 0;
|
|
176
|
+
opacity: 0.35;
|
|
177
|
+
|
|
178
|
+
.iw-chart,
|
|
179
|
+
svg {
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 100%;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.iw-dashboard-social-stats {
|
|
187
|
+
text-align: center;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.iw-dashboard-kpi {
|
|
191
|
+
border-left: 4px solid currentColor;
|
|
192
|
+
padding-left: var(--iw-space-3);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.iw-dashboard-divider {
|
|
196
|
+
margin: var(--iw-space-4) 0;
|
|
197
|
+
border: 0;
|
|
198
|
+
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.iw-primitive-example {
|
|
202
|
+
border: 1px solid color-mix(in srgb, var(--iw-color-border) 60%, transparent);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.iw-primitive-code {
|
|
206
|
+
margin: 0;
|
|
207
|
+
padding: var(--iw-space-3);
|
|
208
|
+
border-radius: var(--iw-radius-sm);
|
|
209
|
+
background: color-mix(in srgb, var(--iw-color-surface) 85%, transparent);
|
|
210
|
+
border: 1px solid color-mix(in srgb, var(--iw-color-border) 55%, transparent);
|
|
211
|
+
font-family: var(--iw-font-family-mono, "SFMono-Regular", ui-monospace);
|
|
212
|
+
font-size: 0.85rem;
|
|
213
|
+
line-height: 1.5;
|
|
214
|
+
white-space: pre-wrap;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.iw-primitive-preview {
|
|
218
|
+
position: relative;
|
|
219
|
+
min-height: 10rem;
|
|
220
|
+
padding: var(--iw-space-3);
|
|
221
|
+
border-radius: var(--iw-radius-sm);
|
|
222
|
+
background: color-mix(in srgb, var(--iw-color-surface) 92%, transparent);
|
|
223
|
+
border: 1px dashed color-mix(in srgb, var(--iw-color-border) 55%, transparent);
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
justify-content: center;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.iw-primitive-preview-row {
|
|
230
|
+
display: flex;
|
|
231
|
+
flex-wrap: wrap;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: var(--iw-space-3);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.iw-primitive-preview-column {
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: var(--iw-space-3);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.iw-primitive-preview-empty {
|
|
243
|
+
color: var(--iw-color-text-muted, var(--iw-color-text));
|
|
244
|
+
font-size: 0.9rem;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.iw-primitive-preview .iw-backdrop,
|
|
248
|
+
.iw-primitive-preview .iw-dialog-backdrop,
|
|
249
|
+
.iw-primitive-preview .iw-snackbar,
|
|
250
|
+
.iw-primitive-preview .iw-drawer {
|
|
251
|
+
position: absolute;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.iw-primitive-preview .iw-backdrop,
|
|
255
|
+
.iw-primitive-preview .iw-dialog-backdrop {
|
|
256
|
+
inset: 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.iw-primitive-preview .iw-drawer {
|
|
260
|
+
top: var(--iw-space-3);
|
|
261
|
+
bottom: var(--iw-space-3);
|
|
262
|
+
left: var(--iw-space-3);
|
|
263
|
+
width: min(14rem, 70%);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.iw-primitive-preview .iw-snackbar {
|
|
267
|
+
left: var(--iw-space-3);
|
|
268
|
+
bottom: var(--iw-space-3);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.iw-dashboard-progress-meta {
|
|
272
|
+
color: var(--iw-color-text-secondary);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.iw-dashboard-progress-list .iw-progress-linear-track {
|
|
276
|
+
height: 0.25rem;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.iw-dashboard-user-subtitle {
|
|
280
|
+
color: var(--iw-color-text-secondary);
|
|
281
|
+
font-size: var(--iw-font-size-sm);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.iw-dashboard-avatar {
|
|
285
|
+
position: relative;
|
|
286
|
+
display: inline-flex;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.iw-dashboard-avatar-badge {
|
|
290
|
+
position: absolute;
|
|
291
|
+
right: 0;
|
|
292
|
+
bottom: 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.iw-dashboard-country {
|
|
296
|
+
text-align: center;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.iw-dashboard-payment {
|
|
300
|
+
text-align: center;
|
|
301
|
+
color: var(--iw-color-text-secondary);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.iw-dashboard-menu-cell {
|
|
305
|
+
text-align: right;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.iw-dashboard-footer {
|
|
309
|
+
color: var(--iw-color-text-secondary);
|
|
310
|
+
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@media (max-width: 80rem) {
|
|
314
|
+
.iw-dashboard-sales-layout {
|
|
315
|
+
grid-template-columns: 1fr !important;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@media (max-width: 64rem) {
|
|
320
|
+
.iw-dashboard-header-row {
|
|
321
|
+
flex-wrap: wrap;
|
|
322
|
+
padding-inline: var(--iw-space-3);
|
|
323
|
+
}
|
|
324
|
+
.iw-dashboard-content {
|
|
325
|
+
padding: var(--iw-space-3);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@media (max-width: 40rem) {
|
|
330
|
+
.iw-dashboard-kpi-grid {
|
|
331
|
+
grid-template-columns: 1fr !important;
|
|
332
|
+
}
|
|
333
|
+
.iw-dashboard-progress-row {
|
|
334
|
+
grid-template-columns: 1fr !important;
|
|
335
|
+
}
|
|
336
|
+
.iw-dashboard-footer {
|
|
337
|
+
flex-direction: column;
|
|
338
|
+
}
|
|
339
|
+
}
|