@inglorious/ui 7.8.0 → 8.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 +21 -4
- package/package.json +5 -9
- package/src/data-display/avatar/style.css +8 -3
- package/src/data-display/avatar/template.js +1 -1
- package/src/data-display/data-display.css +0 -1
- package/src/data-display/icon/icon-implementations.mdx +52 -149
- package/src/data-display/icon/icon.stories.js +48 -3
- package/src/data-display/icon/style.css +10 -3
- package/src/data-display/icon/template.js +50 -4
- package/src/examples/dashboard/app-drawer.js +16 -14
- package/src/examples/dashboard/app-header.js +26 -17
- package/src/examples/dashboard/data.js +36 -19
- package/src/examples/dashboard/primitive-content.js +35 -38
- package/src/examples/dashboard/social-card.js +2 -2
- package/src/examples/dashboard/stat-card.js +5 -4
- package/src/examples/dashboard/style.css +2 -2
- package/src/examples/dashboard/traffic-card.js +3 -2
- package/src/examples/dashboard/traffic-sales-card.js +5 -11
- package/src/index.js +0 -1
- package/src/navigation/bottom-navigation/style.css +6 -2
- package/src/navigation/drawer/template.js +4 -9
- package/src/shared/icons.js +15 -0
- package/types/data-display/icon.d.ts +24 -0
- package/types/index.d.ts +1 -5
- package/src/data-display/material-icon/index.js +0 -3
- package/src/data-display/material-icon/material-icon.stories.js +0 -100
- package/src/data-display/material-icon/style.css +0 -33
- package/src/data-display/material-icon/template.js +0 -39
- package/types/data-display/material-icon.d.ts +0 -21
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import type { TemplateResult } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* An icon in the Iconify format, as every set on `@iconify-icons/*` exports
|
|
5
|
+
* it: `import arrowBack from "@iconify-icons/material-symbols/arrow-back"`.
|
|
6
|
+
*/
|
|
7
|
+
export interface IconData {
|
|
8
|
+
/** The SVG content, without the `<svg>` element. */
|
|
9
|
+
body: string
|
|
10
|
+
/** The viewBox. Defaults to 16 by 16 at the origin. */
|
|
11
|
+
width?: number
|
|
12
|
+
height?: number
|
|
13
|
+
left?: number
|
|
14
|
+
top?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
export interface IconProps {
|
|
4
18
|
id?: string
|
|
19
|
+
/** The icon to draw, as inline SVG at the size's font size. */
|
|
20
|
+
icon?: IconData
|
|
21
|
+
/** Shown when there is no `icon`: an emoji, a glyph, any markup. */
|
|
5
22
|
children?: TemplateResult | string | number
|
|
6
23
|
size?: "sm" | "md" | "lg"
|
|
7
24
|
color?: string
|
|
25
|
+
/**
|
|
26
|
+
* The direction of the text the icon sits in. An icon that points along the
|
|
27
|
+
* line (a back arrow, a chevron) is mirrored with `"rtl"`. Defaults to `"ltr"`.
|
|
28
|
+
*/
|
|
29
|
+
direction?: "ltr" | "rtl"
|
|
30
|
+
/** Names an icon that means something on its own. Without it the icon is decorative. */
|
|
31
|
+
label?: string
|
|
8
32
|
className?: string
|
|
9
33
|
onClick?: () => void
|
|
10
34
|
[key: string]: unknown
|
package/types/index.d.ts
CHANGED
|
@@ -68,17 +68,13 @@ export type {
|
|
|
68
68
|
DataGridVirtualization,
|
|
69
69
|
} from "./data-display/data-grid"
|
|
70
70
|
export type { DividerProps, DividerType } from "./data-display/divider"
|
|
71
|
-
export type { IconProps, IconType } from "./data-display/icon"
|
|
71
|
+
export type { IconData, IconProps, IconType } from "./data-display/icon"
|
|
72
72
|
export type { ListProps, ListType, ListItem } from "./data-display/list"
|
|
73
73
|
export type {
|
|
74
74
|
VirtualListEntity,
|
|
75
75
|
VirtualListItem,
|
|
76
76
|
VirtualListType,
|
|
77
77
|
} from "./data-display/virtual-list"
|
|
78
|
-
export type {
|
|
79
|
-
MaterialIconProps,
|
|
80
|
-
MaterialIconType,
|
|
81
|
-
} from "./data-display/material-icon"
|
|
82
78
|
export type {
|
|
83
79
|
TableProps,
|
|
84
80
|
TableType,
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { html } from "@inglorious/web"
|
|
2
|
-
import { repeat } from "@inglorious/web/directives/repeat"
|
|
3
|
-
|
|
4
|
-
import { MaterialIcon } from "."
|
|
5
|
-
|
|
6
|
-
const materialIcons = [
|
|
7
|
-
"search",
|
|
8
|
-
"home",
|
|
9
|
-
"menu",
|
|
10
|
-
"settings",
|
|
11
|
-
"favorite",
|
|
12
|
-
"visibility",
|
|
13
|
-
"notifications",
|
|
14
|
-
"shopping_cart",
|
|
15
|
-
"person",
|
|
16
|
-
"calendar_today",
|
|
17
|
-
"mail",
|
|
18
|
-
"chat",
|
|
19
|
-
"help",
|
|
20
|
-
"info",
|
|
21
|
-
"warning",
|
|
22
|
-
"check_circle",
|
|
23
|
-
"cancel",
|
|
24
|
-
"delete",
|
|
25
|
-
"download",
|
|
26
|
-
"upload",
|
|
27
|
-
"lock",
|
|
28
|
-
"star",
|
|
29
|
-
"play_arrow",
|
|
30
|
-
"pause",
|
|
31
|
-
"stop",
|
|
32
|
-
"cloud",
|
|
33
|
-
"camera_alt",
|
|
34
|
-
"bolt",
|
|
35
|
-
"palette",
|
|
36
|
-
"code",
|
|
37
|
-
"analytics",
|
|
38
|
-
"schedule",
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
export default {
|
|
42
|
-
title: "Data Display/Material Icon",
|
|
43
|
-
tags: ["autodocs"],
|
|
44
|
-
argTypes: {
|
|
45
|
-
size: {
|
|
46
|
-
control: "select",
|
|
47
|
-
options: ["sm", "md", "lg"],
|
|
48
|
-
},
|
|
49
|
-
isFilled: {
|
|
50
|
-
control: "boolean",
|
|
51
|
-
},
|
|
52
|
-
columns: {
|
|
53
|
-
control: "number",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
parameters: {
|
|
57
|
-
docs: {
|
|
58
|
-
description: {
|
|
59
|
-
component:
|
|
60
|
-
"Material Symbols icon set (requires Material Symbols font to be loaded).",
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const Gallery = {
|
|
67
|
-
args: {
|
|
68
|
-
size: "lg",
|
|
69
|
-
isFilled: false,
|
|
70
|
-
columns: 6,
|
|
71
|
-
},
|
|
72
|
-
render: (args) => {
|
|
73
|
-
const columns = Math.max(4, Number(args.columns ?? 6))
|
|
74
|
-
const size = args.size ?? "lg"
|
|
75
|
-
const isFilled = Boolean(args.isFilled)
|
|
76
|
-
|
|
77
|
-
return html`
|
|
78
|
-
<div
|
|
79
|
-
style=${[
|
|
80
|
-
"display: grid",
|
|
81
|
-
`grid-template-columns: repeat(${columns}, minmax(0, 1fr))`,
|
|
82
|
-
"gap: 1rem",
|
|
83
|
-
"align-items: center",
|
|
84
|
-
"justify-items: center",
|
|
85
|
-
].join("; ")}
|
|
86
|
-
>
|
|
87
|
-
${repeat(
|
|
88
|
-
materialIcons,
|
|
89
|
-
(name) => name,
|
|
90
|
-
(name) =>
|
|
91
|
-
MaterialIcon.render({
|
|
92
|
-
name,
|
|
93
|
-
size,
|
|
94
|
-
isFilled,
|
|
95
|
-
}),
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
`
|
|
99
|
-
},
|
|
100
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
.iw-material-icon {
|
|
2
|
-
font-family: "Material Symbols Outlined", "Material Symbols";
|
|
3
|
-
font-variation-settings:
|
|
4
|
-
"FILL" 0,
|
|
5
|
-
"wght" 400,
|
|
6
|
-
"GRAD" 0,
|
|
7
|
-
"opsz" 24;
|
|
8
|
-
line-height: 1;
|
|
9
|
-
display: inline-flex;
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
|
|
12
|
-
&.iw-material-icon-filled {
|
|
13
|
-
font-variation-settings:
|
|
14
|
-
"FILL" 1,
|
|
15
|
-
"wght" 400,
|
|
16
|
-
"GRAD" 0,
|
|
17
|
-
"opsz" 24;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&.iw-material-icon-sm {
|
|
21
|
-
font-size: 0.875rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&.iw-material-icon-lg {
|
|
25
|
-
font-size: 1.5rem;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* `scale` rather than `transform`, so it adds to a rotation set elsewhere
|
|
29
|
-
instead of replacing it. */
|
|
30
|
-
&.iw-material-icon-rtl {
|
|
31
|
-
scale: -1 1;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('../../../types/data-display/material-icon').MaterialIconProps} MaterialIconProps
|
|
3
|
-
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { html } from "@inglorious/web"
|
|
7
|
-
import { classMap } from "@inglorious/web/directives/class-map"
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Renders a Material Symbols icon by name.
|
|
11
|
-
* Requires the Material Symbols font and supports filled and size variants.
|
|
12
|
-
* `direction` is the direction of the text the icon sits in. An icon that
|
|
13
|
-
* points along the line, such as a back arrow or a chevron, is mirrored with
|
|
14
|
-
* `"rtl"`: in right-to-left text, back points right.
|
|
15
|
-
* @param {MaterialIconProps} props
|
|
16
|
-
* @returns {TemplateResult}
|
|
17
|
-
*/
|
|
18
|
-
export function render(props) {
|
|
19
|
-
const {
|
|
20
|
-
name = "help",
|
|
21
|
-
size = "md",
|
|
22
|
-
isFilled = true,
|
|
23
|
-
direction = "ltr",
|
|
24
|
-
onClick,
|
|
25
|
-
} = props
|
|
26
|
-
|
|
27
|
-
return html`<span
|
|
28
|
-
class=${classMap({
|
|
29
|
-
"iw-material-icon": true,
|
|
30
|
-
"material-symbols-outlined": true,
|
|
31
|
-
"iw-material-icon-filled": isFilled,
|
|
32
|
-
"iw-material-icon-rtl": direction === "rtl",
|
|
33
|
-
[`iw-material-icon-${size}`]: size !== "md",
|
|
34
|
-
})}
|
|
35
|
-
aria-hidden="true"
|
|
36
|
-
@click=${onClick}
|
|
37
|
-
>${name}</span
|
|
38
|
-
>`
|
|
39
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { TemplateResult } from "@inglorious/web"
|
|
2
|
-
|
|
3
|
-
export interface MaterialIconProps {
|
|
4
|
-
id?: string
|
|
5
|
-
name?: string
|
|
6
|
-
size?: "sm" | "md" | "lg"
|
|
7
|
-
isFilled?: boolean
|
|
8
|
-
/**
|
|
9
|
-
* The direction of the text the icon sits in. An icon that points along the
|
|
10
|
-
* line (a back arrow, a chevron) is mirrored with `"rtl"`. Defaults to `"ltr"`.
|
|
11
|
-
*/
|
|
12
|
-
direction?: "ltr" | "rtl"
|
|
13
|
-
onClick?: () => void
|
|
14
|
-
[key: string]: unknown
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface MaterialIconType {
|
|
18
|
-
render(props: MaterialIconProps): TemplateResult
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export declare const MaterialIcon: MaterialIconType
|