@inglorious/ui 7.8.1 → 8.1.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.
Files changed (34) hide show
  1. package/README.md +21 -4
  2. package/package.json +12 -16
  3. package/src/controls/select/template.js +7 -0
  4. package/src/data-display/data-display.css +0 -1
  5. package/src/data-display/icon/icon-implementations.mdx +52 -149
  6. package/src/data-display/icon/icon.stories.js +48 -3
  7. package/src/data-display/icon/style.css +10 -3
  8. package/src/data-display/icon/template.js +50 -4
  9. package/src/examples/dashboard/app-drawer.js +16 -14
  10. package/src/examples/dashboard/app-header.js +26 -17
  11. package/src/examples/dashboard/data.js +36 -19
  12. package/src/examples/dashboard/primitive-content.js +35 -38
  13. package/src/examples/dashboard/social-card.js +2 -2
  14. package/src/examples/dashboard/stat-card.js +5 -4
  15. package/src/examples/dashboard/style.css +6 -3
  16. package/src/examples/dashboard/traffic-card.js +3 -2
  17. package/src/examples/dashboard/traffic-sales-card.js +5 -11
  18. package/src/index.js +0 -1
  19. package/src/navigation/bottom-navigation/style.css +6 -2
  20. package/src/navigation/drawer/template.js +4 -9
  21. package/src/shared/icons.js +15 -0
  22. package/src/styles/themes/bootstrap.css +4 -0
  23. package/src/styles/themes/inglorious.css +5 -0
  24. package/src/styles/themes/material.css +4 -0
  25. package/src/surfaces/app-bar/style.css +3 -0
  26. package/types/controls/select.d.ts +2 -0
  27. package/types/data-display/icon.d.ts +24 -0
  28. package/types/index.d.ts +1 -5
  29. package/types/navigation/view-transitions.d.ts +5 -4
  30. package/src/data-display/material-icon/index.js +0 -3
  31. package/src/data-display/material-icon/material-icon.stories.js +0 -100
  32. package/src/data-display/material-icon/style.css +0 -33
  33. package/src/data-display/material-icon/template.js +0 -39
  34. package/types/data-display/material-icon.d.ts +0 -21
@@ -1,4 +1,8 @@
1
1
  .iw-theme-bootstrap {
2
+ /* The theme on the page itself: the element with the theme class, usually
3
+ <body>, takes its background, text color and font. */
4
+ background-color: var(--iw-color-bg);
5
+ color: var(--iw-color-text);
2
6
  font-family: var(--iw-font-family-sans);
3
7
 
4
8
  /* ========================================
@@ -6,6 +6,11 @@
6
6
 
7
7
  .iw-theme-inglorious {
8
8
  --iw-font-family-sans: var(--iw-font-family);
9
+ /* The theme on the page itself: the element with the theme class, usually
10
+ <body>, takes its background, text color and font. */
11
+ background-color: var(--iw-color-bg);
12
+ color: var(--iw-color-text);
13
+ font-family: var(--iw-font-family-sans);
9
14
 
10
15
  /* ========================================
11
16
  INGLORIOUS THEME - Neon Videogame Aesthetic
@@ -1,4 +1,8 @@
1
1
  .iw-theme-material {
2
+ /* The theme on the page itself: the element with the theme class, usually
3
+ <body>, takes its background, text color and font. */
4
+ background-color: var(--iw-color-bg);
5
+ color: var(--iw-color-text);
2
6
  font-family: var(--iw-font-family-sans);
3
7
 
4
8
  /* ========================================
@@ -3,6 +3,9 @@
3
3
  align-items: center;
4
4
  min-height: var(--iw-space-16);
5
5
  /* gap: var(--iw-space-3); */
6
+ /* Room either side of the title and controls, so they do not touch the
7
+ edges of the screen. */
8
+ padding-inline: var(--iw-space-4);
6
9
  background: var(--iw-app-bar-bg, var(--iw-color-surface));
7
10
  color: var(--iw-color-text);
8
11
  border-bottom: 1px solid var(--iw-color-border);
@@ -20,6 +20,8 @@ export interface SelectProps {
20
20
  isDisabled?: boolean
21
21
  isFullWidth?: boolean
22
22
  label?: string
23
+ /** Names the control for assistive tech when it has no visible `label`. */
24
+ ariaLabel?: string
23
25
  hint?: string
24
26
  error?: string
25
27
  isMulti?: boolean
@@ -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,
@@ -5,7 +5,7 @@ export type ViewTransitionType = "forward" | "back" | "replace"
5
5
  /** The part of a store this module needs. Declared structurally rather than
6
6
  * imported, so any store-shaped object works. */
7
7
  export interface TransitionsStore<S = unknown> {
8
- subscribe(listener: (state: S) => void): () => void
8
+ subscribe(listener: () => void): () => void
9
9
  getState(): S
10
10
  getType(name: string): unknown
11
11
  }
@@ -33,10 +33,11 @@ export interface TransitionsOptions {
33
33
  }
34
34
 
35
35
  export interface WithTransitions {
36
- <S>(
37
- store: TransitionsStore<S>,
36
+ /** Returns the store it was given, so it still fits wherever the store did, such as `mount`. */
37
+ <Store extends TransitionsStore<any>>(
38
+ store: Store,
38
39
  options?: TransitionsOptions,
39
- ): TransitionsStore<S>
40
+ ): Store
40
41
  }
41
42
 
42
43
  export declare const withTransitions: WithTransitions
@@ -1,3 +0,0 @@
1
- import * as renderers from "./template.js"
2
-
3
- export const MaterialIcon = { ...renderers }
@@ -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